diff --git a/TitanClassicRegen/TitanClassicRegen.lua b/TitanClassicRegen/TitanClassicRegen.lua index 1582092..d0af7a2 100644 --- a/TitanClassicRegen/TitanClassicRegen.lua +++ b/TitanClassicRegen/TitanClassicRegen.lua @@ -81,9 +81,9 @@ end -- NAME : TitanPanelXPButton_OnEvent -- DESC : Parse events registered to addon and act on them -- ************************************************************************** -function TitanPanelRegenButton_OnEvent(self, event, a1, ...) +function TitanPanelRegenButton_OnEvent(self, event, a1, a2, ...) if ( event == "PLAYER_ENTERING_WORLD") then - if (UnitPowerMax("player") == 0) then + if (UnitPowerMax("player", 0) == 0) then TitanSetVar(TITAN_REGEN_ID, "ShowMPRegen", 0); end end @@ -102,7 +102,7 @@ function TitanPanelRegenButton_OnEvent(self, event, a1, ...) local runUpdate = 0; if (TitanGetVar(TITAN_REGEN_ID,"ShowHPRegen") == 1) then - if ( event == "UNIT_HEALTH" and a1 == "player" ) then + if ( event == "UNIT_HEALTH" and a1 == "player") then currHealth = UnitHealth("player"); runUpdate = 1; if ( currHealth > TITAN_RegenCurrHealth and TITAN_RegenCurrHealth ~= 0 ) then @@ -120,7 +120,7 @@ function TitanPanelRegenButton_OnEvent(self, event, a1, ...) end if (TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == 1) then - if ( event == "UNIT_POWER_UPDATE" and a1 == "player" ) then + if ( event == "UNIT_POWER_UPDATE" and a1 == "player" and a2 == "MANA") then currMana = UnitPower("player"); runUpdate = 1; if ( currMana > TITAN_RegenCurrMana and TITAN_RegenCurrMana ~= 0 ) then @@ -161,7 +161,7 @@ function TitanPanelRegenButton_GetButtonText(id) if UnitHealth("player") == UnitHealthMax("player") then TITAN_RegenHP = 0; end - if UnitPower("player") == UnitPowerMax("player") then + if UnitPower("player") == UnitPowerMax("player", 0) then TITAN_RegenMP = 0; end @@ -187,7 +187,7 @@ function TitanPanelRegenButton_GetButtonText(id) if (TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == 1) then labelTextMP = L["TITAN_REGEN_BUTTON_TEXT_MP"]; if (TitanGetVar(TITAN_REGEN_ID,"ShowPercentage") == 1) then - valueTextMP = format(TITAN_REGEN_MP_FORMAT_PERCENT, (TITAN_RegenMP/UnitPowerMax("player"))*100); + valueTextMP = format(TITAN_REGEN_MP_FORMAT_PERCENT, (TITAN_RegenMP/UnitPowerMax("player", 0))*100); else valueTextMP = format(TITAN_REGEN_MP_FORMAT, TITAN_RegenMP); end @@ -216,11 +216,11 @@ function TitanPanelRegenButton_GetTooltipText() if (TitanGetVar(TITAN_REGEN_ID,"ShowMPRegen") == 1) then local regenPercent; - regenPercent = (TITAN_RegenMPDuringCombat/UnitPowerMax("player"))*100; + regenPercent = (TITAN_RegenMPDuringCombat/UnitPowerMax("player", 0))*100; return "".. format(L["TITAN_REGEN_TOOLTIP1"], UnitHealth("player"),UnitHealthMax("player"),UnitHealthMax("player")-UnitHealth("player")).."\n".. - format(L["TITAN_REGEN_TOOLTIP2"], UnitPower("player"),UnitPowerMax("player"),UnitPowerMax("player")-UnitPower("player")).."\n".. + format(L["TITAN_REGEN_TOOLTIP2"], UnitPower("player"),UnitPowerMax("player", 0),UnitPowerMax("player", 0)-UnitPower("player")).."\n".. format(L["TITAN_REGEN_TOOLTIP3"], TITAN_RegenMaxHPRate).."\n".. format(L["TITAN_REGEN_TOOLTIP4"], minHP).."\n".. format(L["TITAN_REGEN_TOOLTIP5"], TITAN_RegenMaxMPRate).."\n"..