Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local A, C, L = select(2, ...):unpack()
- local TotemPlugin = CreateFrame("Frame")
- local DataBars = A["DataBars"]
- local Panels = A["Panels"]
- -- Lib Globals
- local select = select
- local unpack = unpack
- local format = format
- -- WoW Globals
- local GetSpellInfo = GetSpellInfo
- -- Locals
- local Class = select(2, UnitClass("player"))
- function TotemPlugin:GetWaterTotems(Name)
- if (Name == "Mana Spring Totem") then
- local _, _, Icon = GetSpellInfo(10497) -- Mana Spring Totem
- if (Icon) then
- self.WaterTotems.Icon:SetTexture(Icon)
- self.WaterTotems:Show()
- else
- self.WaterTotems:Hide()
- end
- end
- if (Name == "Healing Stream Totem") then
- local _, _, Icon = GetSpellInfo(10463) -- Healing Stream Totem
- if (Icon) then
- self.WaterTotems.Icon:SetTexture(WaterIcon)
- self.WaterTotems:Show()
- else
- self.WaterTotems:Hide()
- end
- end
- if (Name == "Mana Tide Totem") then
- local _, _, Icon = GetSpellInfo(16190) -- Mana Tide Totem
- if (Icon) then
- self.WaterTotems.Icon:SetTexture(Icon)
- self.WaterTotems:Show()
- else
- self.WaterTotems:Hide()
- end
- end
- if (Name == "Poison Cleansing Totem") then
- local _, _, Icon = GetSpellInfo(8166) -- Poison Cleansing Totem
- if (Icon) then
- self.WaterTotems.Icon:SetTexture(Icon)
- self.WaterTotems:Show()
- else
- self.WaterTotems:Hide()
- end
- end
- if (Name == "Disease Cleansing Totem") then
- local _, _, Icon = GetSpellInfo(8170) -- Disease Cleansing Totem
- if (Icon) then
- self.WaterTotems.Icon:SetTexture(Icon)
- self.WaterTotems:Show()
- else
- self.WaterTotems:Hide()
- end
- end
- if (Name == "Fire Resistance Totem") then
- local _, _, Icon = GetSpellInfo(10538) -- Fire Resistance Totem
- if (Icon) then
- self.WaterTotems.Icon:SetTexture(Icon)
- self.WaterTotems:Show()
- else
- self.WaterTotems:Hide()
- end
- end
- end
- function TotemPlugin:GetAirTotems(Name)
- if (Name == "Windfury Totem") then
- local _, _, Icon = GetSpellInfo(10614) -- Windfury Totem
- if (Icon) then
- self.AirTotems.Icon:SetTexture(Icon)
- self.AirTotems:Show()
- else
- self.AirTotems:Hide()
- end
- end
- if (Name == "Grounding Totem") then
- local _, _, Icon = GetSpellInfo(8177) -- Grounding Totem
- if (Icon) then
- self.AirTotems.Icon:SetTexture(Icon)
- self.AirTotems:Show()
- else
- self.AirTotems:Hide()
- end
- end
- if (Name == "Grace of Air Totem") then
- local _, _, Icon = GetSpellInfo(10627) -- Grace of Air Totem
- if (Icon) then
- self.AirTotems.Icon:SetTexture(Icon)
- self.AirTotems:Show()
- else
- self.AirTotems:Hide()
- end
- end
- if (Name == "Tranquil Air Totem") then
- local _, _, Icon = GetSpellInfo(25908) -- Tranquil Air Totem
- if (Icon) then
- self.AirTotems.Icon:SetTexture(Icon)
- self.AirTotems:Show()
- else
- self.AirTotems:Hide()
- end
- end
- if (Name == "Nature Resistance Totem") then
- local _, _, Icon = GetSpellInfo(10601) -- Nature Resistance Totem
- if (Icon) then
- self.AirTotems.Icon:SetTexture(Icon)
- self.AirTotems:Show()
- else
- self.AirTotems:Hide()
- end
- end
- end
- function TotemPlugin:GetEarthTotems(Name)
- if (Name == "Tremor Totem") then
- local _, _, Icon = GetSpellInfo(8143) -- Tremor Totem
- if (Icon) then
- self.EarthTotems.Icon:SetTexture(Icon)
- self.EarthTotems:Show()
- else
- self.EarthTotems:Hide()
- end
- end
- if (Name == "Strength of Earth Totem") then
- local _, _, Icon = GetSpellInfo(10442) -- Strength of Earth Totem
- if (Icon) then
- self.EarthTotems.Icon:SetTexture(Icon)
- self.EarthTotems:Show()
- else
- self.EarthTotems:Hide()
- end
- end
- if (Name == "Stoneskin Totem") then
- local _, _, Icon = GetSpellInfo(10408) -- Stoneskin Totem
- if (Icon) then
- self.EarthTotems.Icon:SetTexture(Icon)
- self.EarthTotems:Show()
- else
- self.EarthTotems:Hide()
- end
- end
- if (Name == "Earthbind Totems") then
- local _, _, Icon = GetSpellInfo(2484) -- Earthbind Totems
- if (Icon) then
- self.EarthTotems.Icon:SetTexture(Icon)
- self.EarthTotems:Show()
- else
- self.EarthTotems:Hide()
- end
- end
- if (Name == "Stoneclaw Totem") then
- local _, _, Icon = GetSpellInfo(10428) -- Stoneclaw Totem
- if (Icon) then
- self.EarthTotems.Icon:SetTexture(Icon)
- self.EarthTotems:Show()
- else
- self.EarthTotems:Hide()
- end
- end
- end
- function TotemPlugin:GetFireTotems(Name)
- if (Name == "Searing Totem") then
- local _, _, Icon = GetSpellInfo(10438) -- Searing Totem
- if (Icon) then
- self.FireTotems.Icon:SetTexture(Icon)
- self.FireTotems:Show()
- else
- self.FireTotems:Hide()
- end
- end
- if (Name == "Magma Totem") then
- local _, _, Icon = GetSpellInfo(10587) -- Magma Totem
- if (Icon) then
- self.FireTotems.Icon:SetTexture(Icon)
- self.FireTotems:Show()
- else
- self.FireTotems:Hide()
- end
- end
- if (Name == "Fire Nova Totem") then
- local _, _, Icon = GetSpellInfo(11315) -- Fire Nova Totem
- if (Icon) then
- self.FireTotems.Icon:SetTexture(Icon)
- self.FireTotems:Show()
- else
- self.FireTotems:Hide()
- end
- end
- if (Name == "Flametongue Totem") then
- local _, _, Icon = GetSpellInfo(16387) -- Earthbind Totems
- if (Icon) then
- self.FireTotems.Icon:SetTexture(Icon)
- self.FireTotems:Show()
- else
- self.FireTotems:Hide()
- end
- end
- if (Name == "Frost Resistance Totem") then
- local _, _, Icon = GetSpellInfo(10479) -- Frost Resistance Totem
- if (Icon) then
- self.FireTotems.Icon:SetTexture(Icon)
- self.FireTotems:Show()
- else
- self.FireTotems:Hide()
- end
- end
- end
- function TotemPlugin:OnEvent(event, unit, _, SpellID)
- local Name, Rank, Icon, _, _, _, ID = GetSpellInfo(SpellID)
- if (unit == "player") then
- self:GetWaterTotems(Name)
- self:GetAirTotems(Name)
- self:GetEarthTotems(Name)
- self:GetFireTotems(Name)
- end
- end
- function TotemPlugin:Create()
- local Bar = CreateFrame("Frame", "Aftermathh_TotemFrame", UIParent)
- Bar:Size(220, 12)
- Bar:Point("TOP", Panels.ActionBarPanelMiddle, 0, 48)
- -- WATER TOTEMS
- local WaterTotems = CreateFrame("Frame", "Aftermathh_WaterTotemsFrame", UIParent)
- WaterTotems:Size(38, 38)
- WaterTotems:Point("CENTER", Bar, -22, 0)
- WaterTotems:Hide()
- WaterTotems.Icon = WaterTotems:CreateTexture(nil, "OVERLAY")
- WaterTotems.Icon:SetInside()
- WaterTotems.Icon:SetTexCoord(unpack(A.TexCoords))
- WaterTotems.Icon:SetSnapToPixelGrid(false)
- WaterTotems.Icon:SetTexelSnappingBias(0)
- WaterTotems.OverlayFrameIcon = CreateFrame("Frame", nil, WaterTotems)
- WaterTotems.OverlayFrameIcon:SetFrameLevel(WaterTotems:GetFrameLevel() + 5)
- WaterTotems.OverlayFrameIcon:SetInside(WaterTotems.Icon)
- WaterTotems.OverlayFrameIcon:SetTemplate()
- WaterTotems.OverlayFrameIcon:CreateShadow()
- WaterTotems.OverlayFrameIcon:SetShadowOverlay()
- WaterTotems.Cooldown = CreateFrame("Cooldown", nil, WaterTotems, "CooldownFrameTemplate")
- WaterTotems.Cooldown:SetInside()
- WaterTotems.Cooldown:SetReverse(true)
- WaterTotems.Cooldown:SetDrawBling(false)
- if (WaterTotems.Cooldown) then
- A:RegisterCooldowns(WaterTotems.Cooldown)
- end
- -- AIR TOTEMS
- local AirTotems = CreateFrame("Frame", "Aftermathh_AirTotemsFrame", UIParent)
- AirTotems:Size(38, 38)
- AirTotems:Point("CENTER", Bar, 22*3, 0)
- AirTotems:Hide()
- AirTotems.Icon = AirTotems:CreateTexture(nil, "OVERLAY")
- AirTotems.Icon:SetInside()
- AirTotems.Icon:SetTexCoord(unpack(A.TexCoords))
- AirTotems.Icon:SetSnapToPixelGrid(false)
- AirTotems.Icon:SetTexelSnappingBias(0)
- AirTotems.OverlayFrameIcon = CreateFrame("Frame", nil, AirTotems)
- AirTotems.OverlayFrameIcon:SetFrameLevel(AirTotems:GetFrameLevel() + 5)
- AirTotems.OverlayFrameIcon:SetInside(AirTotems.Icon)
- AirTotems.OverlayFrameIcon:SetTemplate()
- AirTotems.OverlayFrameIcon:CreateShadow()
- AirTotems.OverlayFrameIcon:SetShadowOverlay()
- AirTotems.Cooldown = CreateFrame("Cooldown", nil, AirTotems, "CooldownFrameTemplate")
- AirTotems.Cooldown:SetInside()
- AirTotems.Cooldown:SetReverse(true)
- AirTotems.Cooldown:SetDrawBling(false)
- if (AirTotems.Cooldown) then
- A:RegisterCooldowns(AirTotems.Cooldown)
- end
- -- EARTH TOTEMS
- local EarthTotems = CreateFrame("Frame", "Aftermathh_EarthTotemsFrame", UIParent)
- EarthTotems:Size(38, 38)
- EarthTotems:Point("CENTER", Bar, 22, 0)
- EarthTotems:Hide()
- EarthTotems.Icon = EarthTotems:CreateTexture(nil, "OVERLAY")
- EarthTotems.Icon:SetInside()
- EarthTotems.Icon:SetTexCoord(unpack(A.TexCoords))
- EarthTotems.Icon:SetSnapToPixelGrid(false)
- EarthTotems.Icon:SetTexelSnappingBias(0)
- EarthTotems.OverlayFrameIcon = CreateFrame("Frame", nil, EarthTotems)
- EarthTotems.OverlayFrameIcon:SetFrameLevel(EarthTotems:GetFrameLevel() + 5)
- EarthTotems.OverlayFrameIcon:SetInside(EarthTotems.Icon)
- EarthTotems.OverlayFrameIcon:SetTemplate()
- EarthTotems.OverlayFrameIcon:CreateShadow()
- EarthTotems.OverlayFrameIcon:SetShadowOverlay()
- EarthTotems.Cooldown = CreateFrame("Cooldown", nil, EarthTotems, "CooldownFrameTemplate")
- EarthTotems.Cooldown:SetInside()
- EarthTotems.Cooldown:SetReverse(true)
- EarthTotems.Cooldown:SetDrawBling(false)
- if (EarthTotems.Cooldown) then
- A:RegisterCooldowns(EarthTotems.Cooldown)
- end
- -- FIRE TOTEMS
- local FireTotems = CreateFrame("Frame", "Aftermathh_FireTotemsFrame", UIParent)
- FireTotems:Size(38, 38)
- FireTotems:Point("CENTER", Bar, -22*3, 0)
- FireTotems:Hide()
- FireTotems.Icon = FireTotems:CreateTexture(nil, "OVERLAY")
- FireTotems.Icon:SetInside()
- FireTotems.Icon:SetTexCoord(unpack(A.TexCoords))
- FireTotems.Icon:SetSnapToPixelGrid(false)
- FireTotems.Icon:SetTexelSnappingBias(0)
- FireTotems.OverlayFrameIcon = CreateFrame("Frame", nil, FireTotems)
- FireTotems.OverlayFrameIcon:SetFrameLevel(FireTotems:GetFrameLevel() + 5)
- FireTotems.OverlayFrameIcon:SetInside(FireTotems.Icon)
- FireTotems.OverlayFrameIcon:SetTemplate()
- FireTotems.OverlayFrameIcon:CreateShadow()
- FireTotems.OverlayFrameIcon:SetShadowOverlay()
- FireTotems.Cooldown = CreateFrame("Cooldown", nil, FireTotems, "CooldownFrameTemplate")
- FireTotems.Cooldown:SetInside()
- FireTotems.Cooldown:SetReverse(true)
- FireTotems.Cooldown:SetDrawBling(false)
- if (FireTotems.Cooldown) then
- A:RegisterCooldowns(FireTotems.Cooldown)
- end
- -- ON EVENT
- self:RegisterEvent("PLAYER_ENTERING_WORLD")
- self:RegisterEvent("PLAYER_TOTEM_UPDATE")
- self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
- self:RegisterEvent("UNIT_AURA")
- self:SetScript("OnEvent", self.OnEvent)
- self.WaterTotems = WaterTotems
- self.AirTotems = AirTotems
- self.EarthTotems = EarthTotems
- self.FireTotems = FireTotems
- end
- function TotemPlugin:Enable()
- if (Class ~= "SHAMAN") then
- return
- end
- TotemPlugin:Create()
- end
- DataBars.TotemPlugin = TotemPlugin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement