Update (v1.3.40200):
updated toc for 40200.
Purpose:
- To add a totem display to the oUF player frame, similar to that of the default UI, and that of the original oUF_TotemBar by Soeters.
- To provide features not present in Soeters' addon (being able to show totem icons is the most significant difference).
Features:
When set up properly, this addon will show and hide a frame for each totem based on whether or not that totem is active. In addition, if configured to do so, it will update a StatusBar and FontString to reflect the time left, another FontString with the name, a Texture (with the texture!), and color certain elements to reflect the type of the placed totem.
Usage:- Add oUF_boring_totembar to the OptionalDeps in your layout's toc.
- Lament this addon's dumb name.
- Create a frame or table on your unitframe named TotemBar.
- Add four frames, TotemBar[1] through Totembar[4], to that table.
- Configure the following options/sub-elements as desired.
Options and Sub-Elements:
All of these are optional, the only thing this mod (should) need to work are the frames .TotemBar[1] through .TotemBar[4], and of course the .TotemBar element.
- .TotemBar.Destroy : true|false : If true, you will be able to right click to destroy a totem and to shift-right click to destroy all totems.
- .TotemBar.AbbreviateNames : true|false : if true, the initials of the totem name will be displayed in the text element instead of the whole name.
- .UpdateColors : true|false : if true, this addon will update the colors of the .StatusBar and the .bg elements to reflect the type of totem.
- .TotemBar[x].StatusBar : "StatusBar" UI frame. If present, it will be updated to reflect the time remaining on a placed totem.
- .TotemBar[x].StatusBar.Reverse : true|false : if true, the .StatusBar element will 'fill' as opposed to deplete.
- .TotemBar[x].Icon : UI texture : will be updated with the icon of the placed totem.
- .TotemBar[x].Text : UI fontstring : will be updated with the name of the placed totem.
- .TotemBar[x].bg : UI texture : will be colored to indicate the type of totem if .UpdateColors is true.
- .TotemBar[x].bg.multiplier : number : Factor to darken the background color with respect to the totem's color (should be in the range 0 to 1).
(ugly) Usage Example:
Code:
if select(2, UnitClass'player') == "SHAMAN" then
local w, h = 224, 16
local tb = {
AbbreviateNames = true,
Destroy = true,
UpdateColors = true,
}
for i = 1, 4 do
local t = CreateFrame('Frame', nil, self)
t:SetPoint('TOP', tb[i - 1] or self, 'BOTTOM', 0, -2)
t:SetSize(w, h)
local bg = t:CreateTexture(nil, 'BACKGROUND')
bg:SetAllPoints()
bg:SetTexture(1, 1, 1)
bg.multiplier = 0.2
t.bg = bg
local bar = CreateFrame('StatusBar', nil, t)
bar:SetPoint('RIGHT', -1, 0)
bar:SetSize(w - h - 3, h - 2)
bar.Reverse = true
t.StatusBar = bar
local icon = t:CreateTexture(nil, 'ARTWORK')
icon:SetPoint('LEFT', 1, 0)
icon:SetSize(h - 2, h - 2)
icon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
t.Icon = icon
local time = bar:CreateFontString(nil, 'OVERLAY')
time:SetPoint('RIGHT', -1, 0)
time:SetFontObject'GameFontNormal'
time:SetJustifyH'RIGHT'
t.Time = time
local text = bar:CreateFontString(nil, 'OVERLAY')
text:SetPoint('LEFT', 1, 0)
text:SetPoint('RIGHT', time, 'LEFT', -2, 0)
text:SetFontObject'GameFontNormal'
text:SetJustifyH'LEFT'
t.Text = text
tb[i] = t
end
self.TotemBar = tb
end
Credits:
This addon is all original code, but heavily inspired by the coding of the default elements of oUF (by haste), and a blatant knockoff of the idea and functionality of oUF_TotemBar (by Soeters), which in turn was an attempt to replicate features in the default WoW UI.