 SpellHelper_Stack = {} SPELL_HELPER_MAX_BUTTONS = 4 if (GetLocale() == "zhCN") then MOD_SPELLHELPER_TITLE = "法术助手" SPELLHELPER_SHOW_NEW_SPELL = "便捷显示新学法术" elseif (GetLocale() == "zhTW") then MOD_SPELLHELPER_TITLE = "法術助手" SPELLHELPER_SHOW_NEW_SPELL = "便捷顯示新學法術" else MOD_SPELLHELPER_TITLE = "Spell Helper" SPELLHELPER_SHOW_NEW_SPELL = "Show new spell easily" end function SpellHelper_OnLoad() ModManagement_RegisterMod( "SpellHelper", "Interface\\Icons\\INV_Gizmo_06", MOD_SPELLHELPER_TITLE, "", nil ) ModManagement_RegisterCheckBox( "SpellHelper", SPELLHELPER_SHOW_NEW_SPELL, nil, "DisableQuestFading", 1, function (SpellHelperl1111l1lll1111l11111lll) if ( SpellHelperl1111l1lll1111l11111lll == 1 ) then BigFootSpells_RegisterNewSpellSink(BIGFOOT_SPELL_EVENT_NEW, "SpellHelperButton_Sink") else BigFootSpells_UnregisterNewSpellSink(BIGFOOT_SPELL_EVENT_NEW, "SpellHelperButton_Sink") end end ) end 
function SpellHelperButton_OnClick(SpellHelperl11l11l11l1l111l1ll1l1lll11111ll) 
local SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l = this.info 
local SpellHelperlll111lll1l11111ll11lll1lll111111 = BigFootSpell_GetSpellIdFromName(SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l["name"]) 
if (not SpellHelperlll111lll1l11111ll11lll1lll111111) then 
SpellHelperButton_Clear(this) 
end 
this:SetChecked("false") 
if (arg1 == "RightButton") then 
elseif ( SpellHelperl11l11l11l1l111l1ll1l1lll11111ll ) then 
PickupSpell(SpellHelperlll111lll1l11111ll11lll1lll111111, SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l["bookType"]) 
elseif ( IsShiftKeyDown() ) then 
if ( MacroFrame:IsVisible() ) then 
local spellName, subSpellName = GetSpellName(SpellHelperlll111lll1l11111ll11lll1lll111111, SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l["bookType"]) 
if ( spellName and not IsSpellPassive(SpellHelperlll111lll1l11111ll11lll1lll111111, SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l["bookType"]) ) then 
if ( subSpellName and (strlen(subSpellName) > 0) ) then 
MacroFrame_AddMacroLine(TEXT(SLASH_CAST1).." "..spellName.."("..subSpellName..")") 
else 
MacroFrame_AddMacroLine(TEXT(SLASH_CAST1).." "..spellName) end end else PickupSpell(SpellHelperlll111lll1l11111ll11lll1lll111111, SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l["bookType"]) end else CastSpell(SpellHelperlll111lll1l11111ll11lll1lll111111, SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l["bookType"]) end local SpellHelperl11ll1lll111lll1lll111l = getglobal(this:GetName().."Flash") this:Hide() SpellHelperl11ll1lll111lll1lll111l:Hide() this.info = nil SpellHelperButton_UpdateButtons() end function SpellHelperButton_Clear(SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l) SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l.info = ni SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l:Hide() local SpellHelperl11ll1lll111lll1lll111l = getglobal(SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l:GetName().."Flash") SpellHelperl11ll1lll111lll1lll111l:Hide() SpellHelperButton_UpdateButtons() end function SpellHelperButton_OnEnter() local SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l = this.info local SpellHelperlll111lll1l11111ll11lll1lll111111 = BigFootSpell_GetSpellIdFromName(SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l["name"]) if (not SpellHelperlll111lll1l11111ll11lll1lll111111) then SpellHelperButton_Clear(this) return end GameTooltip:SetOwner(this, "ANCHOR_RIGHT") if ( GameTooltip:SetSpell(SpellHelperlll111lll1l11111ll11lll1lll111111, SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l["bookType"]) ) then this.updateTooltip = TOOLTIP_UPDATE_TIME else this.updateTooltip = nil end end function SpellHelperButton_OnUpdate(elapsed) if ( not this.updateTooltip ) then return end this.updateTooltip = this.updateTooltip - elapsed if ( this.updateTooltip > 0 ) then return end if ( GameTooltip:IsOwned(this) ) then SpellHelperButton_OnEnter() else this.updateTooltip = nil end end function SpellHelperButton_OnLoad() this:RegisterForDrag("LeftButton") this:RegisterForClicks("LeftButtonUp", "RightButtonUp") end function SpellHelperButton_UpdateButtons() for SpellHelper11llll111llll1ll1l1111l1ll1111l11ll1l = 1, SPELL_HELPER_MAX_BUTTONS, 1 do local SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l = getglobal("SpellHelperButton"..SpellHelper11llll111llll1ll1l1111l1ll1111l11ll1l) if (SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l) then if (not SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l:IsVisible()) then for SpellHelperl1llll1ll11111lll11ll1l11 = SpellHelper11llll111llll1ll1l1111l1ll1111l11ll1l + 1, SPELL_HELPER_MAX_BUTTONS, 1 do local SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1 = getglobal("SpellHelperButton"..SpellHelperl1llll1ll11111lll11ll1l11) if (SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1 and SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1:IsVisible()) then SpellHelper1l11ll111l111llllll1lll(SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l, SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1) end end end end end for SpellHelper1l1111llllll11l111111l111l111l, SpellHelper1l1llllll1lll11l1111l1l1l11111l in SpellHelper_Stack do for SpellHelper11llll111llll1ll1l1111l1ll1111l11ll1l = 1, SPELL_HELPER_MAX_BUTTONS, 1 do local SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l = getglobal("SpellHelperButton"..SpellHelper11llll111llll1ll1l1111l1ll1111l11ll1l) if (SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l and SpellHelper_Stack[SpellHelper1l1111llllll11l111111l111l111l] and not SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l:IsVisible()) then local SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1 = SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l:GetName() local SpellHelper111llll11l111ll1l11l1ll11l1 = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."IconTexture") local SpellHelperlll1lll1lll1l11l1l11l11l1l1 = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."SpellName") local SpellHelperl11llll1111ll1ll1l1111lll11l1l1l = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."SubSpellName") local SpellHelperl11ll1lll111lll1lll111l = getglobal("SpellHelperButton"..SpellHelper11llll111llll1ll1l1111l1ll1111l11ll1l.."Flash") SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l.info = SpellHelper1l1llllll1lll11l1111l1l1l11111l SpellHelper111llll11l111ll1l11l1ll11l1:SetTexture(SpellHelper1l1llllll1lll11l1111l1l1l11111l["texture"]) SpellHelperlll1lll1lll1l11l1l11l11l1l1:SetText(SpellHelper1l1llllll1lll11l1111l1l1l11111l["spellName"]) SpellHelperl11llll1111ll1ll1l1111lll11l1l1l:SetText(SpellHelper1l1llllll1lll11l1111l1l1l11111l["subSpellName"]) SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l.info = SpellHelper1l1llllll1lll11l1111l1l1l11111l SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l:Show() SpellHelperl11ll1lll111lll1lll111l:Show() SpellHelper_Stack[SpellHelper1l1111llllll11l111111l111l111l] = nil end end end for SpellHelper11llll111llll1ll1l1111l1ll1111l11ll1l = 1, SPELL_HELPER_MAX_BUTTONS, 1 do local SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l = getglobal("SpellHelperButton"..SpellHelper11llll111llll1ll1l1111l1ll1111l11ll1l) if (SpellHelperl11111lll1lll1ll1ll1111ll1ll11l1l111l:IsVisible()) then UIFrameFlash(SpellHelperFlashFrame, 0.5, 0.5, 30, nil) return end end UIFrameFlashRemoveFrame(SpellHelperFlashFrame) end function SpellHelper1l11ll111l111llllll1lll(SpellHelperll1111ll1ll11l1l11lll11l1, SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1) local SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l = SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1.info SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1.info = SpellHelperll1111ll1ll11l1l11lll11l1.info SpellHelperll1111ll1ll11l1l11lll11l1.info = SpellHelperl1lll1ll1l1lll1ll11111l1l1ll11ll1lll1l if (SpellHelperll1111ll1ll11l1l11lll11l1.info) then local SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1 = SpellHelperll1111ll1ll11l1l11lll11l1:GetName() local SpellHelper111llll11l111ll1l11l1ll11l1 = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."IconTexture") local SpellHelperlll1lll1lll1l11l1l11l11l1l1 = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."SpellName") local SpellHelperl11llll1111ll1ll1l1111lll11l1l1l = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."SubSpellName") local SpellHelper111lll1l1l1ll1l1ll1ll11ll111111 = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."Flash") SpellHelper111llll11l111ll1l11l1ll11l1:SetTexture(SpellHelperll1111ll1ll11l1l11lll11l1.info["texture"]) SpellHelperlll1lll1lll1l11l1l11l11l1l1:SetText(SpellHelperll1111ll1ll11l1l11lll11l1.info["spellName"]) SpellHelperl11llll1111ll1ll1l1111lll11l1l1l:SetText(SpellHelperll1111ll1ll11l1l11lll11l1.info["subSpellName"]) SpellHelperll1111ll1ll11l1l11lll11l1:Show() SpellHelper111lll1l1l1ll1l1ll1ll11ll111111:Show() else local SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1 = SpellHelperll1111ll1ll11l1l11lll11l1:GetName() local SpellHelper111lll1l1l1ll1l1ll1ll11ll111111 = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."Flash") SpellHelperll1111ll1ll11l1l11lll11l1:Hide() SpellHelper111lll1l1l1ll1l1ll1ll11ll111111:Hide() end if (SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1.info) then local SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1 = SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1:GetName() local SpellHelper111llll11l111ll1l11l1ll11l1 = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."IconTexture") local SpellHelperlll1lll1lll1l11l1l11l11l1l1 = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."SpellName") local SpellHelperl11llll1111ll1ll1l1111lll11l1l1l = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."SubSpellName") local SpellHelperll111ll111lll11111l11111l11l1lll = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."Flash") SpellHelper111llll11l111ll1l11l1ll11l1:SetTexture(SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1.info["texture"]) SpellHelperlll1lll1lll1l11l1l11l11l1l1:SetText(SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1.info["spellName"]) SpellHelperl11llll1111ll1ll1l1111lll11l1l1l:SetText(SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1.info["subSpellName"]) SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1:Show() SpellHelperll111ll111lll11111l11111l11l1lll:Show() else local SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1 = SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1:GetName() local SpellHelperll111ll111lll11111l11111l11l1lll = getglobal(SpellHelper1lll11l1l1lll11l1ll1l111lll1lll1.."Flash") SpellHelper1ll1ll11ll1111lll1l11ll111lll1lll1l1:Hide() SpellHelperll111ll111lll11111l11111l11l1lll:Hide() end end function SpellHelperButton_Sink(SpellHelperllll111l1111l11l11l1111) if (not SpellHelperllll111l1111l11l11l1111["isPassive"]) then SpellHelper_Stack[SpellHelperllll111l1111l11l11l1111["name"]] = SpellHelperllll111l1111l11l11l1111 SpellHelperButton_UpdateButtons() end end
