forked from Kruithne/Shame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCombatGenerics.lua
105 lines (87 loc) · 3.17 KB
/
CombatGenerics.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
--[[
Shame (C) Kruithne <[email protected]>
Licensed under GNU General Public Licence version 3.
https://github.com/Kruithne/Shame
CombatGenerics.lua - Contains generic handling functions for encounters.
]]--
do
local Shame = Shame;
local select = select;
local UnitAura = UnitAura;
local GetSpellInfo = GetSpellInfo;
local UnitGroupRolesAssigned = UnitGroupRolesAssigned;
local BreakUpLargeNumbers = BreakUpLargeNumbers;
local mselect = function(indexes, ...)
local data = {...};
end
--[[
Shame.CombatGeneric_HandleMistake
Used by generic combat triggers to trigger mistakes.
self - Reference to the addon container.
node - Tracker node.
actor - Name of the actor who made the mistake.
damage - Damage value of the mistake.
message - Unformatted message string.
... - Arguments for the message string.
]]--
Shame.CombatGeneric_HandleMistake = function(self, node, actor, damage, message, ...)
if node.excludeRole then
local role = UnitGroupRolesAssigned(actor);
if role == node.excludeRole then
-- This role is excluded from this fuckery.
return;
end
end
if node.excludeDebuff then
local debuff = UnitDebuff(actor, node.excludeDebuff);
if debuff then
-- Players with this debuff are excluded from this fuckery.
return;
end
end
self:RegisterMistake(actor, damage, node.message or message, ...);
end
--[[
Shame.CombatGeneric_Damage
Triggered when a player is damaged by a spell.
self - Reference to the addon container.
node - Tracker node.
... - Combat arguments.
]]--
Shame.CombatGeneric_SpellDamage = function(self, node, ...)
local _, _, _, _, descName, _, _, _, targetName, _, _, spellID, spellName, _, damageTaken = ...;
if spellID == node.spellID or node.spellName and node.spellName == spellName then
self:CombatGeneric_HandleMistake(node, targetName, damageTaken, self.L_CALLOUT_DAMAGE, targetName, spellName, BreakUpLargeNumbers(damageTaken));
end
end
--[[
Shame.CombatGeneric_SpellInterrupt
Triggered when a player is interrupted by a spell.
self - Reference to the addon container.
node - Tracker node.
... - Combat arguments.
]]--
Shame.CombatGeneric_SpellInterrupt = function(self, node, ...)
local _, _, _, _, descName, _, _, _, targetName, _, _, spellID, spellName = ...;
if spellID == node.spellID or node.spellName and node.spellName == spellName then
self:CombatGeneric_HandleMistake(node, targetName, 0, self.L_CALLOUT_DAMAGE, targetName, spellName, self.L_CC_INTERRUPT);
end
end
--[[
Shame.CombatGeneric_AuraApplied
Triggered when a player gains a specific aura.
self - Reference to the addon container.
node - Tracker node.
... - Combat arguments.
]]--
Shame.CombatGeneric_AuraApplied = function(self, node, ...)
local _, _, _, _, descName, _, _, _, targetName, _, _, spellID, spellName, auraType = ...;
if node.auraType and node.auraType ~= auraType then
-- Aura type does not match specified.
return;
end
if spellID == node.spellID or node.spellName and node.spellName == spellName then
self:CombatGeneric_HandleMistake(node, targetName, 0, self.L_CALLOUT_DAMAGE, targetName, spellName, node.failType or self.L_CC_UNKNOWN);
end
end
end