diff --git a/Auras.lua b/Auras.lua index 035b9b3..7630b2c 100644 --- a/Auras.lua +++ b/Auras.lua @@ -35,6 +35,7 @@ function MPOWA:OnUpdate(elapsed) for cat, val in self.NeedUpdate do if val then path = self.SAVE[cat] + if not path then return end if path["enemytarget"] and not UN("target") and not UnitIsFriend("player", "target") then return end 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 self.frames[cat][4]:Hide() @@ -104,6 +105,7 @@ function MPOWA:OnUpdate(elapsed) for cat, val in self.active do if val then path = self.SAVE[cat] + if not path then return end text, count = "", 0 if (path["unit"] or "player") == "player" then count = GetPlayerBuffApplications(val) @@ -297,18 +299,19 @@ function MPOWA:Iterate(unit) for cat, val in pairs(self.SAVE) do if (val["buffname"] == "unitpower") then - local tarid = 44 - if unit then - if (unit == "target") then - tarid = 45 - elseif (string.find(unit,"raid")) then - --local a,b = string.find(unit,"raid") - tarid = tonumber(string.sub(unit, 5))+45 - elseif (string.find(unit,"party")) then - --local a,b = string.find(unit,"party") - tarid = tonumber(string.sub(unit, 6))+45 + local unit = arg1 + if (unit == "target") then + self:Push("unitpower", unit, 45, false) + elseif (string.find(unit,"raid")) then + local st = string.sub(unit, 5) + if st and tonumber(st) then + self:Push("unitpower", unit, (tonumber(st) or 0)+45, false) + end + elseif (string.find(unit,"party")) then + local st = string.sub(unit, 6) + if st and tonumber(st) then + self:Push("unitpower", unit, (tonumber(st) or 0)+45, false) end - self:Push("unitpower", unit, tarid, false) end end end @@ -383,10 +386,13 @@ function MPOWA:Push(aura, unit, i, isdebuff) end tex = strlower(strsub(tex, strfind(tex, "Icons")+6)) end + BuffExist[val] = true -- May cause issues elsewhere :/ if path["isdebuff"]==isdebuff and ((path["secondspecifier"] and (strlower(path["secondspecifiertext"])==tex)) or not path["secondspecifier"]) then - 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"] + 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") or (path["buffname"] == "unitpower" and path["inverse"])) then - BuffExist[val] = true if path["enemytarget"] and unit == "target" then self.active[val] = i elseif path["friendlytarget"] and unit == "target" then diff --git a/GUI.lua b/GUI.lua index e9497dc..bb05ba3 100644 --- a/GUI.lua +++ b/GUI.lua @@ -1303,7 +1303,7 @@ function MPOWA:ScrollFrame_Update() local line -- 1 through 5 of our window to scroll local lineplusoffset -- an index into our data calculated from the scroll offset local FRAME = MPowa_ProfileFrame_ScrollFrame - FauxScrollFrame_Update(FRAME,self:GetTableLength(MPOWA_PROFILE),7,40) + FauxScrollFrame_Update(FRAME,MPOWA:GetTableLength(MPOWA_PROFILE),7,40) for line=1,7 do lineplusoffset = line + FauxScrollFrame_GetOffset(FRAME) if MPOWA_PROFILE[lineplusoffset] ~= nil then diff --git a/Init.lua b/Init.lua index 2ffc068..74e8d44 100644 --- a/Init.lua +++ b/Init.lua @@ -1,5 +1,5 @@ CreateFrame("Frame", "MPOWA", UIParent) -MPOWA.Build = 55 +MPOWA.Build = 56 MPOWA.Cloaded = false MPOWA.loaded = false MPOWA.selected = 1 @@ -164,19 +164,21 @@ function MPOWA:OnEvent(event, arg1) self.Windfury = false end elseif event == "UNIT_MANA" or event == "UNIT_RAGE" or event == "UNIT_ENERGY" then - local tarid = 44 if arg1 then local unit = arg1 if (unit == "target") then - tarid = 45 + self:Push("unitpower", unit, 45, false) elseif (string.find(unit,"raid")) then - --local a,b = string.find(unit,"raid") - tarid = tonumber(string.sub(unit, 5))+45 + local st = string.sub(unit, 5) + if st and tonumber(st) then + self:Push("unitpower", unit, (tonumber(st) or 0)+45, false) + end elseif (string.find(unit,"party")) then - --local a,b = string.find(unit,"party") - tarid = tonumber(string.sub(unit, 6))+45 + local st = string.sub(unit, 6) + if st and tonumber(st) then + self:Push("unitpower", unit, (tonumber(st) or 0)+45, false) + end end - self:Push("unitpower", unit, tarid, false) end elseif event == "PLAYER_LOGOUT" then MPOWA_SAVE = table.copy(self.SAVE, true)