local AddTotems = function(self, width, height)
local numTotems = MAX_TOTEMS
self.Totems = CreateFrame("Frame", "oUF_Rain_Totems", self.Overlay)
self.Totems:SetHeight(height)
self.Totems:SetPoint("BOTTOMLEFT", self.Overlay, 0, 1)
self.Totems:SetPoint("BOTTOMRIGHT", self.Overlay, 0, 1)
for i = 1, numTotems do
self.Totems[i] = CreateFrame("StatusBar", "oUF_Rain_Totem"..i, self.Totems)
self.Totems[i]:SetStatusBarTexture(ns.media.TEXTURE)
self.Totems[i]:SetMinMaxValues(0, 1)
if (playerClass == "SHAMAN") then
self.Totems[i]:SetSize((215 - numTotems - 1) / numTotems, height)
self.Totems[i]:SetPoint("BOTTOMLEFT", self.Totems, (i - 1) * (214 / numTotems) + 1, 0)
self.Totems[i]:SetStatusBarColor(unpack(ns.colors.totems[i]))
elseif (playerClass == "DRUID") then -- Druid's mushrooms
self.Totems[i]:SetSize(width, height)
self.Totems[i]:SetStatusBarColor(unpack(ns.colors.class[playerClass]))
if (i == 1) then
self.Totems[i]:SetPoint("BOTTOM", self.Overlay, "TOP", 0, 0)
elseif (i == 2) then
self.Totems[i]:SetPoint("RIGHT", self.Totems[1], "LEFT", -1, 0)
else
self.Totems[i]:SetPoint("LEFT", self.Totems[1], "RIGHT", 1, 0)
end
elseif (playerClass) == "DEATHKNIGHT" then -- Death knight's ghoul
self.Totems[i]:SetSize(width, height)
self.Totems[i]:SetStatusBarColor(unpack(ns.colors.class[playerClass]))
self.Totems[i]:SetPoint("BOTTOM", self.Overlay, "TOP", 0, 0)
end
self.Totems[i]:SetBackdrop(ns.media.BACKDROP)
self.Totems[i]:SetBackdropColor(0, 0, 0)
self.Totems[i].Destroy = CreateFrame("Button", nil, self.Totems[i])
self.Totems[i].Destroy:SetAllPoints()
self.Totems[i].Destroy:RegisterForClicks("RightButtonUp")
self.Totems[i].Destroy:SetScript("OnClick", function()
if (IsShiftKeyDown()) then
DestroyTotem(i)
end
end)
self.Totems[i].Destroy:EnableMouse()
self.Totems[i].Destroy:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT")
local totem = self:GetParent()
GameTooltip:SetTotem(totem:GetID())
GameTooltip:AddLine("|cffff0000"..GLYPH_SLOT_REMOVE_TOOLTIP.."|r") -- <Shift Right Click to Remove>
GameTooltip:Show()
end)
self.Totems[i].Destroy:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
end
self.Totems.PostUpdate = ns.PostUpdateTotems
end
ns.AddTotems = AddTotems