Skip to content

Commit d6cfdcc

Browse files
committed
Fixed sounds, lua errors and a logic error
1 parent f1ac1ab commit d6cfdcc

File tree

5 files changed

+31
-22
lines changed

5 files changed

+31
-22
lines changed

Animation.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ end
2121
function MPOWA:FHide(key)
2222
local p = self.SAVE[key]
2323
if p and self.frames[key] and self.frames[key][1]:IsVisible() and not self.testall and not p["test"] then
24+
if p["useendsound"] then
25+
if p.endsound < 16 then
26+
PlaySound(self.SOUND[p.endsound], "master")
27+
else
28+
PlaySoundFile("Interface\\AddOns\\ModifiedPowerAuras\\Sounds\\"..self.SOUND[p.endsound], "master")
29+
end
30+
end
2431
if p["cdclockanimout"] then
2532
self.frames[key][6]:SetCooldown(0, 0)
2633
end
@@ -76,6 +83,13 @@ end
7683
function MPOWA:FShow(key)
7784
local p = self.SAVE[key]
7885
if not self.frames[key][1]:IsVisible() and p["used"] then
86+
if p["usebeginsound"] then
87+
if p.beginsound < 16 then
88+
PlaySound(self.SOUND[p.beginsound], "master")
89+
else
90+
PlaySoundFile("Interface\\AddOns\\ModifiedPowerAuras\\Sounds\\"..self.SOUND[path.beginsound], "master")
91+
end
92+
end
7993
if p["isdynamicgroup"] then
8094
self:ApplyDynamicGroup(key)
8195
elseif p["groupnumber"] and tnbr(p["groupnumber"])>0 then

Auras.lua

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@ local cdset = {}
3232
function MPOWA:OnUpdate(elapsed)
3333
LastUpdate = LastUpdate + elapsed
3434
if LastUpdate >= UpdateTime then
35+
local p1, p2
3536
for cat, val in pairs(self.NeedUpdate) do
3637
if val then
3738
local path = self.SAVE[cat]
3839
if path["enemytarget"] and not UN("target") and not UnitIsFriend("player", "target") then return end
39-
if not self.active[cat] and self:TernaryReturn(cat, "alive", self:Reverse(UnitIsDeadOrGhost("player"))) and self:TernaryReturn(cat, "mounted", self.mounted) and self:TernaryReturn(cat, "incombat", UnitAffectingCombat("player")) and self:TernaryReturn(cat, "inparty", self.party) and self:TernaryReturn(cat, "inraid", UnitInRaid("player")) and self:TernaryReturn(cat, "inbattleground", self.bg) and self:TernaryReturn(cat, "inraidinstance", self.instance) then
40+
p1, p2 = self:TernaryReturn(cat, "inparty", self:InParty()), self:TernaryReturn(cat, "inraid", UnitInRaid("player"))
41+
if not self.active[cat] and self:TernaryReturn(cat, "alive", self:Reverse(UnitIsDeadOrGhost("player")))
42+
and self:TernaryReturn(cat, "mounted", self.mounted) and self:TernaryReturn(cat, "incombat", UnitAffectingCombat("player"))
43+
and (((p1 or p2) and ((path["inparty"]==0 or path["inparty"]==true) and (path["inraid"]==0 or path["inraid"]==true))) or (p1 and p2))
44+
and self:TernaryReturn(cat, "inbattleground", self.bg) and self:TernaryReturn(cat, "inraidinstance", self.instance) then
4045
self.frames[cat][4]:Hide()
4146
if path["cooldown"] then
4247
local duration = self:GetCooldown(path["buffname"]) or 0
@@ -253,7 +258,7 @@ function MPOWA:Iterate(unit)
253258
BuffExist = {}
254259
if unit=="player" then
255260
self:IsMounted()
256-
self:InParty()
261+
--self:InParty()
257262
self:InBG()
258263
self:InInstance()
259264
end
@@ -295,13 +300,6 @@ function MPOWA:Iterate(unit)
295300
self.active[cat] = false
296301
self.frames[cat][3]:Hide()
297302
if not p["inverse"] and not p["cooldown"] then
298-
if p["useendsound"] then
299-
if p.endsound < 16 then
300-
PlaySound(self.SOUND[p.endsound], "master")
301-
else
302-
PlaySoundFile("Interface\\AddOns\\zzzModifiedPowerAuras\\Sounds\\"..self.SOUND[p.endsound], "master")
303-
end
304-
end
305303
self.frames[cat][1]:SetAlpha(p["alpha"])
306304
self:FHide(cat)
307305
end
@@ -327,7 +325,12 @@ function MPOWA:Push(aura, unit, i, isdebuff, castbyme)
327325
end
328326
BuffExist[val] = true
329327
if (not path["castbyme"] or (path["castbyme"] and castbyme)) and path["isdebuff"]==isdebuff and ((path["secondspecifier"] and (strlower(path["secondspecifiertext"])==tex)) or not path["secondspecifier"]) then
330-
if self:TernaryReturn(val, "alive", self:Reverse(UnitIsDeadOrGhost("player"))) and self:TernaryReturn(val, "mounted", self.mounted) and self:TernaryReturn(val, "incombat", UnitAffectingCombat("player")) and self:TernaryReturn(val, "inparty", self.party) and self:TernaryReturn(val, "inraid", UnitInRaid("player")) and self:TernaryReturn(val, "inbattleground", self.bg) and self:TernaryReturn(val, "inraidinstance", self.instance) and not path["cooldown"] and self:IsStacks(GetComboPoints("player", "target"), val, "cpstacks") then
328+
local p1, p2 = self:TernaryReturn(val, "inparty", self:InParty()), self:TernaryReturn(val, "inraid", UnitInRaid("player"))
329+
if self:TernaryReturn(val, "alive", self:Reverse(UnitIsDeadOrGhost("player"))) and self:TernaryReturn(val, "mounted", self.mounted)
330+
and self:TernaryReturn(val, "incombat", UnitAffectingCombat("player"))
331+
and (((p1 or p2) and ((path["inparty"]==0 or path["inparty"]==true) and (path["inraid"]==0 or path["inraid"]==true))) or (p1 and p2))
332+
and self:TernaryReturn(val, "inbattleground", self.bg) and self:TernaryReturn(val, "inraidinstance", self.instance)
333+
and not path["cooldown"] and self:IsStacks(GetComboPoints("player", "target"), val, "cpstacks") then
331334
if path["enemytarget"] and unit == "target" then
332335
self.active[val] = {unit, i, isdebuff}
333336
elseif path["friendlytarget"] and unit == "target" then
@@ -341,13 +344,6 @@ function MPOWA:Push(aura, unit, i, isdebuff, castbyme)
341344
if tnbr(self.frames[val][1]:GetAlpha())<=0.1 then
342345
self.frames[val][1]:SetAlpha(tnbr(path["alpha"]))
343346
end
344-
if path["usebeginsound"] then
345-
if path.beginsound < 16 then
346-
PlaySound(self.SOUND[path.beginsound], "master")
347-
else
348-
PlaySoundFile("Interface\\AddOns\\zzzModifiedPowerAuras\\Sounds\\"..self.SOUND[path.beginsound], "master")
349-
end
350-
end
351347
self:FShow(val)
352348
if path["timer"] then
353349
self.frames[val][3]:Show()

Conditions.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ function MPOWA:IsMounted()
2727
self.mounted = false
2828
end
2929

30+
local UnitInParty = UnitInParty
3031
function MPOWA:InParty()
31-
if GetNumPartyMembers() > 0 or UnitInRaid("player") then
32-
self.party = true
33-
end
34-
self.party = false
32+
return GetNumPartyMembers() > 0 or UnitInRaid("player") or UnitInParty("player")
3533
end
3634

3735
function MPOWA:InBG()

GUI.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ function MPOWA:Edit()
765765
if ConfigButton1 then
766766
local coeff = (self.Page - 1)*49
767767
self.CurEdit = self.selected+coeff
768+
if not self.SAVE[self.CurEdit] then return end
768769
for i=1, self.NumBuffs do
769770
if self.frames[i] then
770771
self.frames[i][1]:EnableMouse(false)

Init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CreateFrame("Frame", "MPOWA", UIParent)
2-
MPOWA.Build = 59
2+
MPOWA.Build = 60
33
MPOWA.Cloaded = false
44
MPOWA.loaded = false
55
MPOWA.selected = 1

0 commit comments

Comments
 (0)