diff --git a/api/config.lua b/api/config.lua
index a95d14d9..6a37fb51 100644
--- a/api/config.lua
+++ b/api/config.lua
@@ -488,6 +488,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("bars", nil, "bind_size", "8")
pfUI:UpdateConfig("bars", nil, "bind_color", "1,1,0,1")
+ pfUI:UpdateConfig("totems", nil, "direction", "HORIZONTAL")
+ pfUI:UpdateConfig("totems", nil, "iconsize", "26")
+ pfUI:UpdateConfig("totems", nil, "spacing", "3")
+ pfUI:UpdateConfig("totems", nil, "showbg", "0")
+
pfUI:UpdateConfig("panel", nil, "use_unitfonts", "0")
pfUI:UpdateConfig("panel", nil, "hide_leftchat", "0")
pfUI:UpdateConfig("panel", nil, "hide_rightchat", "0")
diff --git a/init/modules.xml b/init/modules.xml
index b13cf49c..d4af50db 100644
--- a/init/modules.xml
+++ b/init/modules.xml
@@ -66,4 +66,5 @@
+
diff --git a/modules/gui.lua b/modules/gui.lua
index 92f732a9..c4e9ada6 100644
--- a/modules/gui.lua
+++ b/modules/gui.lua
@@ -848,6 +848,18 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
"4:4 " .. T["Pixel"],
"5:5 " .. T["Pixel"],
},
+ ["spacing"] = {
+ "0:0" .. T["None"],
+ "1:1 " .. T["Pixel"],
+ "2:2 " .. T["Pixel"],
+ "3:3 " .. T["Pixel"],
+ "4:4 " .. T["Pixel"],
+ "5:5 " .. T["Pixel"],
+ "6:6 " .. T["Pixel"],
+ "7:7 " .. T["Pixel"],
+ "8:8 " .. T["Pixel"],
+ "9:9 " .. T["Pixel"],
+ },
["scaling"] = {
"0:" .. T["Off"],
"4:" .. T["Huge (PixelPerfect)"],
@@ -1715,6 +1727,13 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(U["buff"], T["Buff Font Size"], C.buffs, "fontsize")
end)
+ CreateGUIEntry(T["Buffs"], T["Totem Icons"], function()
+ CreateConfig(U["totems"], T["Totem Direction"], C.totems, "direction", "dropdown", pfUI.gui.dropdowns.orientation)
+ CreateConfig(U["totems"], T["Icon Size"], C.totems, "iconsize")
+ CreateConfig(U["totems"], T["Spacing"], C.totems, "spacing", "dropdown", pfUI.gui.dropdowns.spacing)
+ CreateConfig(U["totems"], T["Show Background"], C.totems, "showbg", "checkbox")
+ end)
+
CreateGUIEntry(T["Buffs"], T["Player Buff Bar"], function()
CreateConfig(nil, T["Enable Bar"], C.buffbar.pbuff, "enable", "checkbox")
CreateConfig(nil, T["Use Unit Fonts"], C.buffbar.pbuff, "use_unitfonts", "checkbox")
diff --git a/modules/totems.lua b/modules/totems.lua
new file mode 100644
index 00000000..4f68b57c
--- /dev/null
+++ b/modules/totems.lua
@@ -0,0 +1,140 @@
+pfUI:RegisterModule("totems", "tbc", function ()
+ local slots = {
+ [FIRE_TOTEM_SLOT] = { r = .5, g = .2, b = .1 },
+ [EARTH_TOTEM_SLOT] = { r = .2, g = .4, b = .1 },
+ [WATER_TOTEM_SLOT] = { r = .1, g = .4, b = .6 },
+ [AIR_TOTEM_SLOT] = { r = .4, g = .1, b = .7 },
+ }
+
+ local totems = CreateFrame("Frame", "pfTotems", UIParent)
+ totems:RegisterEvent("PLAYER_TOTEM_UPDATE", "Update")
+ totems:RegisterEvent("PLAYER_ENTERING_WORLD", "Update")
+ totems:SetScript("OnEvent", function(self)
+ totems:RefreshList()
+ end)
+
+ totems.OnEnter = function(self)
+ if not this.id then return end
+ local active, name, start, duration, icon = GetTotemInfo(this.id)
+ local color = slots[this.id]
+ GameTooltip:SetOwner(this, "ANCHOR_LEFT")
+ GameTooltip:SetText(name, color.r+.2, color.g+.2, color.b+.2)
+ GameTooltip:AddLine(T["Right-Click to Destroy"], .5,.5,.5,.5)
+ GameTooltip:Show()
+ end
+
+ totems.OnLeave = function(self)
+ GameTooltip:Hide()
+ end
+
+ totems.OnClick = function(self)
+ if arg1 and arg1 == "LeftButton" then return end
+ if this.id then DestroyTotem(this.id) end
+ end
+
+ totems.RefreshList = function(self)
+ local count = 0
+ for i = 1, MAX_TOTEMS do
+ local active, name, start, duration, icon = GetTotemInfo(i)
+
+ if active and icon and icon ~= "" then
+ count = count + 1
+ local color = slots[i]
+
+ self.bar[count]:Show()
+ self.bar[count]:SetBackdropBorderColor(color.r, color.g, color.b)
+ self.bar[count].icon:SetTexture(icon)
+ self.bar[count].id = i
+
+ CooldownFrame_SetTimer(self.bar[count].cd, start, duration, 1)
+ end
+ end
+
+ self:UpdateSize(count)
+ end
+
+ totems.UpdateSize = function(self, count)
+ if not count or count == 0 then
+ -- hide entire panel
+ self:Hide()
+ else
+ -- hide remaining totems and show panel
+ for i = count + 1, MAX_TOTEMS do self.bar[i]:Hide() end
+ self:Show()
+ end
+
+ local count = count and count > 0 and count or MAX_TOTEMS
+
+ if pfUI_config.totems.direction == "HORIZONTAL" then
+ self:SetHeight(self.iconsize + self.spacing*2)
+ self:SetWidth(self.spacing*2 + self.iconsize + (count-1)*(self.iconsize + self.spacing*2))
+ else
+ self:SetWidth(self.iconsize + self.spacing*2)
+ self:SetHeight(self.spacing*2 + self.iconsize + (count-1)*(self.iconsize + self.spacing*2))
+ end
+ end
+
+ totems.UpdateConfig = function(self)
+ local rawborder, border = GetBorderSize()
+ self.iconsize = pfUI_config.totems.iconsize
+ self.direction = pfUI_config.totems.direction
+ self.spacing = tonumber(pfUI_config.totems.spacing) * GetPerfectPixel()
+ self.showbg = pfUI_config.totems.showbg == "1" and true or nil
+
+ for i = 1, MAX_TOTEMS do
+ self.bar = self.bar or {}
+ self.bar[i] = self.bar[i] or CreateFrame("Button", "pfTotemsBar"..i, totems)
+ self.bar[i]:ClearAllPoints()
+
+ if pfUI_config.totems.direction == "HORIZONTAL" then
+ if self.bar[i-1] then
+ self.bar[i]:SetPoint("LEFT", self.bar[i-1], "RIGHT", self.spacing*2, 0)
+ else
+ self.bar[i]:SetPoint("TOPLEFT", self, "TOPLEFT", self.spacing, -self.spacing)
+ end
+ else
+ if self.bar[i-1] then
+ self.bar[i]:SetPoint("TOP", self.bar[i-1], "BOTTOM", 0, -self.spacing*2)
+ else
+ self.bar[i]:SetPoint("TOPLEFT", self, "TOPLEFT", self.spacing, -self.spacing)
+ end
+ end
+
+ self.bar[i]:SetHeight(self.iconsize)
+ self.bar[i]:SetWidth(self.iconsize)
+ CreateBackdrop(self.bar[i], nil, true)
+
+ self.bar[i].icon = self.bar[i].icon or self.bar[i]:CreateTexture(nil, "ARTWORK")
+ self.bar[i].icon:SetTexCoord(.08, .92, .08, .92)
+ SetAllPointsOffset(self.bar[i].icon, self.bar[i], 2,-2)
+
+ self.bar[i].cdbg = self.bar[i].cdbg or CreateFrame("Frame", nil, self.bar[i])
+ SetAllPointsOffset(self.bar[i].cdbg, self.bar[i], 2,-2)
+
+ self.bar[i].cd = self.bar[i].cd or CreateFrame(COOLDOWN_FRAME_TYPE, "pfTotemsBar"..i.."Cooldown", self.bar[i].cdbg, "CooldownFrameTemplate")
+ self.bar[i].cd.pfCooldownType = "ALL"
+ SetAllPointsOffset(self.bar[i].cd, self.bar[i], 2,-2)
+
+ self.bar[i]:RegisterForClicks("LeftButtonUp", "RightButtonUp")
+ self.bar[i]:SetScript("OnClick", self.OnClick)
+ self.bar[i]:SetScript("OnEnter", self.OnEnter)
+ self.bar[i]:SetScript("OnLeave", self.OnLeave)
+ end
+
+ self:RefreshList()
+ self:ClearAllPoints()
+ self:SetPoint("BOTTOM", 0, 75)
+ UpdateMovable(self, true)
+
+ if self.showbg then
+ CreateBackdrop(self)
+ self.backdrop:Show()
+ elseif self.backdrop then
+ self.backdrop:Hide()
+ end
+ end
+
+ -- add totems to the pfUI global space
+ pfUI.totems = totems
+ pfUI.totems:UpdateConfig()
+end)