diff --git a/SmartBuff.lua b/SmartBuff.lua index 8281ad8..982b9d1 100644 --- a/SmartBuff.lua +++ b/SmartBuff.lua @@ -524,9 +524,9 @@ function SMARTBUFF_OnEvent(self, event, ...) if (event == "PLAYER_ENTERING_WORLD" and isInit and O.Toggle) then isSetZone = true; tStartZone = GetTime(); - - -- elseif (event == "PLAYER_ENTERING_WORLD" and isLoaded and isPlayer and not isInit and not InCombatLockdown()) then - -- SMARTBUFF_Options_Init(self); + end + if (event == "PLAYER_ENTERING_WORLD" and isLoaded and isPlayer and not isInit and not InCombatLockdown()) then + SMARTBUFF_Options_Init(self); end elseif (event == "ADDON_LOADED" and arg1 == SMARTBUFF_TITLE) then isLoaded = true; @@ -633,30 +633,6 @@ function SMARTBUFF_OnEvent(self, event, ...) if (UnitAffectingCombat("player") and (arg1 == "player" or string.find(arg1, "^party") or string.find(arg1, "^raid"))) then isSyncReq = true; end - - -- checks if aspect of cheetah or pack is active and cancel it if someone gets dazed - if (sPlayerClass == "HUNTER" and O.AntiDaze and (arg1 == "player" or string.find(arg1, "^party") or string.find(arg1, "^raid") or string.find(arg1, "pet"))) then - local _, stuntex = C_Spell.GetSpellTexture(1604); --get Dazed icon - if (SMARTBUFF_IsDebuffTexture(arg1, stuntex)) then - buff = nil; - if (arg1 == "player" and SMARTBUFF_CheckBuff(arg1, SMARTBUFF_AOTC)) then - buff = SMARTBUFF_AOTC; - elseif (SMARTBUFF_CheckBuff(arg1, SMARTBUFF_AOTP, true)) then - buff = SMARTBUFF_AOTP; - end - if (buff) then - if (O.ToggleAutoSplash and not SmartBuffOptionsFrame:IsVisible()) then - SmartBuffSplashFrame:Clear(); - SmartBuffSplashFrame:SetTimeVisible(1); - SmartBuffSplashFrame:AddMessage("!!! CANCEL " .. buff .. " !!!", O.ColSplashFont.r, O.ColSplashFont.g, - O.ColSplashFont.b, 1.0); - end - if (O.ToggleAutoChat) then - SMARTBUFF_AddMsgWarn("!!! CANCEL " .. buff .. " !!!", true); - end - end - end - end end if (event == "UI_ERROR_MESSAGE") then @@ -1050,6 +1026,7 @@ end -- Set the buff array function SMARTBUFF_SetBuffs() + if (InCombatLockdown()) then return end if (B == nil) then return; end local n = 1; @@ -1550,15 +1527,15 @@ function SMARTBUFF_SyncBuffTimers() rbTime = 0; buffS = cBuffs[i].BuffS; - -- TOCHECK - if B[CS()][ct][buffS].RBTime then + -- CHECK FOR NOT NIL; possible overkill with double check + if (B[CS()][ct][buffS] ~= nil) and (B[CS()][ct][buffS].RBTime ~= nil) then rbTime = B[CS()][ct][buffS].RBTime; if (rbTime <= 0) then rbTime = O.RebuffTimer; end end - if (buffS and B[CS()][ct][buffS].EnableS and cBuffs[i].IDS ~= nil and cBuffs[i].DurationS > 0) then + if (buffS and (B[CS()][ct][buffS] ~= nil) and B[CS()][ct][buffS].EnableS and cBuffs[i].IDS ~= nil and cBuffs[i].DurationS > 0) then if (cBuffs[i].Type ~= SMARTBUFF_CONST_SELF or (cBuffs[i].Type == SMARTBUFF_CONST_SELF and SMARTBUFF_IsPlayer(unit))) then SMARTBUFF_SyncBuffTimer(unit, unit, cBuffs[i]); end @@ -3062,7 +3039,6 @@ function SMARTBUFF_Options_Init(self) if (O.BuffInCities == nil) then O.BuffInCities = true; end if (O.LinkSelfBuffCheck == nil) then O.LinkSelfBuffCheck = true; end if (O.LinkGrpBuffCheck == nil) then O.LinkGrpBuffCheck = true; end - if (O.AntiDaze == nil) then O.AntiDaze = true; end if (O.ScrollWheel ~= nil and O.ScrollWheelUp == nil) then O.ScrollWheelUp = O.ScrollWheel; end if (O.ScrollWheel ~= nil and O.ScrollWheelDown == nil) then O.ScrollWheelDown = O.ScrollWheel; end @@ -3496,10 +3472,6 @@ function SMARTBUFF_OLinkGrpBuffCheck() O.LinkGrpBuffCheck = not O.LinkGrpBuffCheck; end -function SMARTBUFF_OAntiDaze() - O.AntiDaze = not O.AntiDaze; -end - function SMARTBUFF_OScrollWheelUp() O.ScrollWheelUp = not O.ScrollWheelUp; isKeyUpChanged = true; @@ -3551,6 +3523,9 @@ function SMARTBUFF_OSelfFirst() end function SMARTBUFF_OToggleBuff(s, i) + if (cBuffs[i] == nil) then + return + end local bs = GetBuffSettings(cBuffs[i].BuffS); if (bs == nil) then return; @@ -3874,7 +3849,6 @@ function SMARTBUFF_Options_OnShow() SmartBuffOptionsFrame_cbInShapeshift:SetChecked(O.InShapeshift); SmartBuffOptionsFrame_cbFixBuffIssue:SetChecked(O.SBButtonFix); - SmartBuffOptionsFrame_cbAntiDaze:SetChecked(O.AntiDaze); SmartBuffOptionsFrame_cbLinkGrpBuffCheck:SetChecked(O.LinkGrpBuffCheck); SmartBuffOptionsFrame_cbLinkSelfBuffCheck:SetChecked(O.LinkSelfBuffCheck); @@ -4003,16 +3977,6 @@ function SMARTBUFF_SetCheckButtonBuffs(mode) SMARTBUFF_SetBuffs(); end - SmartBuffOptionsFrame_cbAntiDaze:Hide(); - - if (sPlayerClass == "HUNTER" or sPlayerClass == "ROGUE" or sPlayerClass == "WARRIOR") then - SmartBuffOptionsFrameBLDuration:Hide(); - if (sPlayerClass == "HUNTER") then - SmartBuffOptionsFrame_cbLinkGrpBuffCheck:Hide(); - SmartBuffOptionsFrame_cbAntiDaze:Show(); - end - end - if (sPlayerClass == "DRUID" or sPlayerClass == "SHAMAN") then SmartBuffOptionsFrame_cbInShapeshift:Show(); else @@ -4056,6 +4020,7 @@ function SMARTBUFF_DropDownTemplate_OnClick(self) UIDropDownMenu_SetSelectedValue(SmartBuffOptionsFrame_ddTemplates, i); tmp = SMARTBUFF_TEMPLATES[i]; --SMARTBUFF_AddMsgD("Selected/Current Buff-Template: " .. tmp .. "/" .. currentTemplate); + SMARTBUFF_SetBuffs() if (currentTemplate ~= tmp) then SmartBuff_BuffSetup:Hide(); iLastBuffSetup = -1; @@ -4643,7 +4608,9 @@ local function OnScroll(self, cData, sBtnName) btn:SetNormalFontObject("GameFontNormalSmall"); btn:SetHighlightFontObject("GameFontHighlightSmall"); btn:SetText(cData[n]); - btn:SetChecked(t[cData[n]].EnableS); + if (t[cData[n]] ~= nil) then + btn:SetChecked(t[cData[n]].EnableS); + end btn:Show(); else btn:Hide(); diff --git a/SmartBuff.xml b/SmartBuff.xml index 75afc91..4b3adc4 100644 --- a/SmartBuff.xml +++ b/SmartBuff.xml @@ -933,37 +933,6 @@ - - - - - - - - - - - - - - - - - getglobal(self:GetName().."Text"):SetText(SMARTBUFF_OFT_ANTIDAZE); - getglobal(self:GetName().."Text"):SetFontObject(GameFontNormalSmall); - - - SMARTBUFF_OAntiDaze(); - - - GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); - GameTooltip:SetText(SMARTBUFF_OFTT_ANTIDAZE, SMARTBUFF_TTC_R, SMARTBUFF_TTC_G, SMARTBUFF_TTC_B, SMARTBUFF_TTC_A); - - - GameTooltip:Hide(); - - -