-
Notifications
You must be signed in to change notification settings - Fork 0
/
Start.lua
352 lines (302 loc) · 7.7 KB
/
Start.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
--------------- Frames and Funktionallity ---------------
function MPOWA:CreateSave(i)
self.SAVE[i] = {
texture = "Interface\\AddOns\\ModifiedPowerAuras\\images\\dummy.tga",
alpha = 1,
size = 0.75,
x = 0,
y = -30,
buffname = " ",
isdebuff = false,
timer = false,
inverse = false,
used = false,
test = false,
cooldown = false,
abilityavailable=false,
enemyonly = false,
stance = false,
stanceslot=1,
autoupdate = false,
spellslot = 1,
enemytarget = false,
friendlytarget = false,
stacks = ">=0",
targetduration = 0,
alive = 0,
mounted = 0,
incombat = 0,
inparty = 0,
inraid = 0,
inbattleground = 0,
fontalpha = 1,
fontoffsetx = 0,
fontoffsety = 0,
fontsize = 1.5,
hundredth = false,
usefontcolor = false,
fontcolor_r = 1,
fontcolor_g = 1,
fontcolor_b = 1,
usebeginsound = false,
beginsound = 1,
useendsound = false,
endsound = 1,
raidgroupmember = false,
exactname = false,
flashanim = false,
flashanimstart = 5,
unit = "player",
rgmname = "",
icon_r = 1,
icon_b = 1,
icon_g = 1,
secsleft = false,
secsleftdur = 0,
inraidinstance = 0,
hidestacks = false,
secondspecifier = false,
secondspecifiertext = "",
animduration = 0.5,
translateoffsetx = 50,
translateoffsety = 50,
fadealpha = 0.99,
scalefactor = 0.8,
isdynamicgroup = false,
groupnumber = 0,
cpstacks = ">=0",
dynamicsorted = false,
dynamiccenter = false,
dynamicorientation = 1,
timerfont = 1,
dynamicspacing = 5,
blendmode = 1,
minutes = false,
timerfontsize = 1,
}
end
function MPOWA:Init()
if MPOWA_SAVE then
self.SAVE = table.copy(MPOWA_SAVE, true)
end
MPowa_Tooltip:SetOwner(UIParent, "ANCHOR_NONE")
SLASH_MPOWA1 = "/mpowa"
SlashCmdList["MPOWA"] = function(msg)
if MPowa_MainFrame:IsVisible() then
MPowa_MainFrame:Hide()
else
self:Show()
end
end
if self.SAVE == nil then
self.SAVE = {}
self:CreateSave(1)
end
if MPOWA_PROFILE == nil then
MPOWA_PROFILE = {}
end
for cat, val in self.SAVE do
if val["used"] or (self.SAVE[cat+1] and self.SAVE[cat+1]["used"]) then
if not self.frames[cat] then
self.frames[cat] = {}
end
if not self.auras[val["buffname"]] then
self.auras[val["buffname"]] = {}
end
tinsert(self.auras[val["buffname"]], cat)
if not val["spellslot"] then
self.SAVE[cat]["spellslot"] = 1
end
if not val["stanceslot"] then
self.SAVE[cat]["stanceslot"] = 1
end
if not val["stance"] then
self.SAVE[cat]["stance"] = false
end
if not val["abilityavailable"] then
self.SAVE[cat]["abilityavailable"] = false
end
if not val["enemyonly"] then
self.SAVE[cat]["enemyonly"] = false
end
MPOWA:SpellSlot(val)
if (val["inverse"] or val["cooldown"]) and val["buffname"] ~= "unitpower" then
self.NeedUpdate[cat] = true
end
if val["enemytarget"] or val["friendlytarget"] then
self.SAVE[cat]["unit"] = "target"
else
self.SAVE[cat]["unit"] = nil
end
if val["used"] then
self.NumBuffs = cat
end
if val["rgmname"] then
self.RaidGroupMembers[val["rgmname"]] = true
end
if not val["secsleftdur"] or val["secsleftdur"] == "" then
self.SAVE[cat]["secsleftdur"] = 0
end
if not val["inraidinstance"] then
self.SAVE[cat]["inraidinstance"] = 0
end
if not val["secondspecifiertext"] then
self.SAVE[cat]["secondspecifiertext"] = ""
end
-- Initializing animations
if not val["animduration"] then
self.SAVE[cat]["animduration"] = 0.5
end
if not val["translateoffsetx"] then
self.SAVE[cat]["translateoffsetx"] = 50
end
if not val["translateoffsety"] then
self.SAVE[cat]["translateoffsety"] = 50
end
if not val["fadealpha"] then
self.SAVE[cat]["fadealpha"] = 0.99
end
if not val["scalefactor"] then
self.SAVE[cat]["scalefactor"] = 0.8
end
if not val["dynamicorientation"] then
self.SAVE[cat]["dynamicorientation"] = 1
end
if not val["timerfont"] then
self.SAVE[cat]["timerfont"] = 1
end
if not val["dynamicspacing"] then
self.SAVE[cat]["dynamicspacing"] = 5
end
if not val["blendmode"] then
self.SAVE[cat]["blendmode"] = 1
end
if not val["timerfontsize"] then
self.SAVE[cat]["timerfontsize"] = 1
end
if not val["spellslot"] then
self.SAVE[cat]["spellslot"] = 1
end
self:CreateIcon(cat, cat)
self:ApplyConfig(cat)
if val["flashanim"] then
self:AddAnimFlash(cat)
end
if val["growout"] then
self:AddAnimGrowOut(cat)
end
if val["growin"] then
self:AddAnimGrowIn(cat)
end
if val["fadeout"] then
self:AddAnimFadeOut(cat)
end
if val["fadein"] then
self:AddAnimFadeIn(cat)
end
if val["escapeanimout"] then
self:AddAnimEscapeOut(cat)
end
if val["escapeanimin"] then
self:AddAnimEscapeIn(cat)
end
if val["shrinkanim"] then
self:AddAnimShrink(cat)
end
if val["sizeanim"] then
self:AddAnimSizeIn(cat)
end
if val["translateanim"] then
self:AddAnimTranslate(cat)
end
if val["rotateanimout"] then
self:AddAnimRotateOut(cat)
end
if val["rotateanimin"] then
self:AddAnimRotateIn(cat)
end
if val["batmananimout"] then
self:AddAnimRotateShrinkFadeOut(cat)
end
if val["batmananimin"] then
self:AddAnimRotateShrinkFadeIn(cat)
end
if not val["cpstacks"] then
self.SAVE[cat]["cpstacks"] = ">=0"
end
self.SAVE[cat]["test"] = false
else
self.SAVE[cat] = nil
end
end
self.testAll = false
end
function MPOWA:SpellSlot(val)
if val["buffname"] and val["spellslot"] then
val["spellslot"] = 1
local spellIndex = 1
while true do
local name, rank = GetSpellName(spellIndex, "spell")
if (not name) or strfind(strlower(name), strlower(val["buffname"])) or name==val["buffname"] then
break
end
if spellIndex > 1000 then
spellIndex=0
break-- Lets give up at this point
end
spellIndex = spellIndex + 1
end
local spellTexture = GetSpellTexture(spellIndex, "spell")
for i=1, 120 do
local slotTexture = GetActionTexture(i)
if slotTexture == spellTexture then
val["spellslot"] = i
return
end
end
return
end
end
function MPOWA:StanceSlot(val)
if self.SAVE[self.CurEdit]["stance"] then
MPOWA.SAVE[MPOWA.CurEdit]["stanceslot"] = 0;
for i=1,6 do
local icon, name, active, castable = GetShapeshiftFormInfo(i);
if active then
MPOWA.SAVE[MPOWA.CurEdit]["stanceslot"] = i
MPOWA.SAVE[MPOWA.CurEdit]["buffname"] = name
MPowa_ConfigFrame_Container_1_2_Editbox:SetText(name)
--DEFAULT_CHAT_FRAME:AddMessage("Action Bar= " .. MPOWA.SAVE[MPOWA.CurEdit]["stanceslot"])
end
end
end
--self:Iterate("player")
--self:Push("Windfury", "player", 42, false, "Windfury")
return MPOWA.SAVE[MPOWA.CurEdit]["stanceslot"]
end
function MPOWA:GetStanceSlot(val)
for i=1,6 do
local icon, name, active, castable = GetShapeshiftFormInfo(i);
if active then
return i
end
end
return 0
end
--------------- Post Init --------------------------
MPOWA:SetScript("OnUpdate", function() MPOWA:OnUpdate(arg1) end)
MPOWA:SetScript("OnEvent", function() MPOWA:OnEvent(event, arg1) end)
MPOWA:RegisterEvent("VARIABLES_LOADED")
MPOWA:RegisterEvent("UNIT_AURA")
MPOWA:RegisterEvent("PLAYER_TARGET_CHANGED")
MPOWA:RegisterEvent("RAID_ROSTER_UPDATE")
MPOWA:RegisterEvent("PARTY_MEMBERS_CHANGED")
MPOWA:RegisterEvent("PLAYER_AURAS_CHANGED")
MPOWA:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS")
MPOWA:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF")
MPOWA:RegisterEvent("PLAYER_REGEN_DISABLED")
MPOWA:RegisterEvent("PLAYER_REGEN_ENABLED")
MPOWA:RegisterEvent("UNIT_MANA")
MPOWA:RegisterEvent("UNIT_RAGE")
MPOWA:RegisterEvent("UNIT_ENERGY")
MPOWA:RegisterEvent("PLAYER_LOGOUT")