-
Notifications
You must be signed in to change notification settings - Fork 4
/
buffs.lua
109 lines (90 loc) · 2.27 KB
/
buffs.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
106
107
108
109
local _, addonData = ...
City = {
16609, --"WarChief's Blessing",
22888, --"Rallying Cry of the Dragonslayer",
24425, --"Spirit of Zandalar",
}
DarkMoon = {
23768, --"Sayge's Dark Fortune of Damage",
23769, --"Sayge's Dark Fortune of Resistance",
23767, --"Sayge's Dark Fortune of Armor",
23766, --"Sayge's Dark Fortune of Intelligence",
23738, --"Sayge's Dark Fortune of Spirit",
23737, --"Sayge's Dark Fortune of Stamina",
23735, --"Sayge's Dark Fortune of Strength",
23737, --"Sayge's Dark Fortune of Agility",
}
DireMaul = {
22818, --"Mol'dar's Moxie",
22817, --"Fengus' Ferocity",
22820, --"Slip'kik's Savvy",
}
Felwood = {
15366, --"Songflower Serenade",
}
TimeSensitive = {
City,
DarkMoon,
DireMaul,
Felwood
}
buffs = {
buffs = {},
init = function(self)
addonData.debug:registerCategory("buffs")
-- build the buff table
for _, set in pairs(TimeSensitive) do
for _, b in pairs(set) do
db("registering buff", b)
self.buffs[b] = 1
end
end
end,
report = function(self, player)
local out, index, i = {}, 1, 1
while true do
local name, icon, _, _, _, _, _, _, _, spellId = UnitBuff(player, index)
index = index + 1
if name == nil then
break
end
db("buffs", player, "has buff", name)
if self.buffs[spellId] then
db("buffs", name, "is of interest")
out[i] = {spellId, icon}
i = i + 1
end
end
return out
end,
marshallBuffs = function(self, buffs)
local out = ""
local spacer = ""
for _,v in pairs(buffs) do
if #v > 0 then
db("buffs", v[1])
out = out .. spacer .. v[1] .. "~" .. v[2]
spacer = "&"
end
end
db("buffs", "buffs marshalled", out)
return out
end,
unmarshallBuffs = function(self, marshalled)
local out = {}
db("buffs", "unmarshalling", marshalled)
if not marshalled or marshalled == "" then
return out
end
local tmpOut = { strsplit("&", marshalled) }
for i,v in pairs(tmpOut) do
if not (v == nil or v == "") then
db("buffs", "unmarshalling", v)
out[i] = { strsplit("~", v) }
end
db("buffs", "buff unmarshalled", out[i][1], out[i][2])
end
return out
end,
}
addonData.buffs = buffs