diff --git a/PallyPower.lua b/PallyPower.lua index 050c343..df9453d 100644 --- a/PallyPower.lua +++ b/PallyPower.lua @@ -1031,50 +1031,44 @@ function PallyPowerBuffButton_OnLoad(btn) end function PallyPowerBuffButton_OnClick(btn, mousebtn) - local _,class = UnitClass("player") - if class ~= "PALADIN" then return end - + local _, class = UnitClass("player") + if class ~= "PALADIN" then return end + RestorSelfAutoCastTimeOut = 1; if (GetCVar("autoSelfCast") == "1") then - RestorSelfAutoCast = true; - SetCVar("autoSelfCast", "0"); + RestorSelfAutoCast = true; + SetCVar("autoSelfCast", "0"); end - + ClearTarget() PP_Debug("Casting " .. btn.buffID .. " on " .. btn.classID) CastSpell(AllPallys[UnitName("player")][btn.buffID]["id"], BOOKTYPE_SPELL); local RecentCast = false - --[[ - if (FiveMinBlessing == true) then - if LastCast[btn.buffID .. btn.classID] and LastCast[btn.buffID .. btn.classID] > (5 * 60) - 30 then - RecentCast = true - end - else - if LastCast[btn.buffID .. btn.classID] and LastCast[btn.buffID .. btn.classID] > (15 * 60) - 30 then - RecentCast = true - end - end - ]]-- for unit, stats in CurrentBuffs[btn.classID] do - if SpellCanTargetUnit(unit) and not (RecentCast and string.find(table.concat(LastCastOn[btn.classID], " "), unit)) then - PP_Debug("Trying to cast on " .. unit); - SpellTargetUnit(unit) - PP_NextScan = 1 - if (FiveMinBlessing == true) then - LastCast[btn.buffID .. btn.classID] = 10 * 60; - else - LastCast[btn.buffID .. btn.classID] = 30 * 60; - end - LastCastOn[btn.classID] = {} - tinsert(LastCastOn[btn.classID], unit) - PallyPower_ShowFeedback(format(PallyPower_Casting, PallyPower_BlessingID[btn.buffID], PallyPower_ClassID[btn.classID], UnitName(unit)), 0.0, 1.0, 0.0); - TargetLastTarget() - return + if not stats[btn.buffID] then + if SpellCanTargetUnit(unit) and not (RecentCast and string.find(table.concat(btn.need, ", "), unit)) then + PP_Debug("Trying to cast on " .. unit); + SpellTargetUnit(unit) + PP_NextScan = 1 + if (FiveMinBlessing == true) then + LastCast[btn.buffID .. btn.classID] = 10 * 60; + else + LastCast[btn.buffID .. btn.classID] = 30 * 60; + end + LastCastOn[btn.classID] = {} + tinsert(LastCastOn[btn.classID], unit) + PallyPower_ShowFeedback( + format(PallyPower_Casting, PallyPower_BlessingID[btn.buffID], PallyPower_ClassID[btn.classID], + UnitName(unit)), 0.0, 1.0, 0.0); + TargetLastTarget() + return + end end end SpellStopTargeting() TargetLastTarget() - PallyPower_ShowFeedback(format(PallyPower_CouldntFind, PallyPower_BlessingID[btn.buffID], PallyPower_ClassID[btn.classID]), 1.0, 0.0, 0.0); + PallyPower_ShowFeedback( + format(PallyPower_CouldntFind, PallyPower_BlessingID[btn.buffID], PallyPower_ClassID[btn.classID]), 1.0, 0.0, 0.0); end function PallyPowerBuffButton_OnEnter(btn)