/trunk
The default patterns and their meanings are: |
Friendly: =:m;<:d |
Meaning: When at max health, display max health (=:max) |
When below max health, display health deficit (<:deficit) |
Friendly: =:m;<:d; |
Meaning: When at max health, display max health (=:m;) |
When below max health, display health deficit (<:d;) |
Hostile: <:p |
Hostile: <:p; |
Meaning: When below max health, display health as a percentage. |
Otherwise, display nothing. |
]] |
friendly = '=:m;<:d', -- health display pattern for friendly units |
hostile = '<:p', -- health display pattern for hostile/neutral units |
friendly = '=:m;<:d;', -- health display pattern for friendly units |
hostile = '<:p;', -- health display pattern for hostile/neutral units |
showalt = true, -- show alternate (contextual) health values as well as main values |
mouseover = false, -- hide health values until you mouse over or target the plate |
smooth = true -- smoothly animate health bar changes |
local strsplit, pairs, ipairs, unpack |
= strsplit, pairs, ipairs, unpack |
local function SetFontSize(fontstring, size) |
-- helper function for setting a FontString's font size |
local font, _, flags = fontstring:GetFont() |
fontstring:SetFont(font, size, flags) |
end |
------------------------------------------------------------- Frame functions -- |
-- set colour of health bar according to reaction/threat |
local function SetHealthColour(self) |
end |
end |
------------------------------------------------------------ Target stuff -- |
if targetExists and |
self.defaultAlpha == 1 and |
self.name.text == UnitName('target') |
if targetExists and |
self.defaultAlpha == 1 and |
self.name.text == UnitName('target') |
then |
-- this frame is targetted |
-- this frame is targeted |
if not self.target then |
-- the frame just became targetted |
-- the frame just became targeted |
self.target = true |
self:StoreGUID(UnitGUID('target')) |
]] |
end |
local function SetFontSize(fontstring, size) |
local font, _, flags = fontstring:GetFont() |
fontstring:SetFont(font, size, flags) |
end |
-- Update sizes of child frames, fonts and the position of .bg in this nameplate |
-- To be used when UIScale is changed (i.e. hardly ever) |
-- TODO I don't think I actually use this at the moment |
local function UpdateScales(self) |
-- all this for what is hopefully not a common occurrence |
self.carrier:SetScale(uiscale) |
self.carrier:SetSize(self:GetWidth()/uiscale, self:GetHeight()/uiscale) |
end |
function ns.f:InitFrame(frame) |
-- TODO: this is just a tad long |
frame.init = true |
local healthBar, castBar = frame:GetChildren() |
self.parent = parent |
do -- using CENTER breaks pixel-perfectness with oddly sized frames |
-- .. so we're doing it manually |
local w,h = parent:GetSize() |
x = floor((w / 2) - (sizes.width / 2)) |
y = floor((h / 2) - (sizes.height / 2)) |
end |
-- using CENTER breaks pixel-perfectness with oddly sized frames |
-- .. so we have to align frames manually. |
local w,h = parent:GetSize() |
local x,y |
x = floor((w / 2) - (sizes.width / 2)) |
y = floor((h / 2) - (sizes.height / 2)) |
-- border ------------------------------------------------------------------ |
--frame.bg = (frame.carrier and frame.carrier or frame):CreateTexture(nil, 'BACKGROUND') |
frame.bg:SetParent(parent) |
if not f.SetIncomingWarning then return end |
local spName, spSch = select(13, ...) |
if event == 'SPELL_HEAL' or |
event == 'SPELL_PERIODIC_HEAL' |
if event == 'SPELL_HEAL' or |
event == 'SPELL_PERIODIC_HEAL' |
then |
-- display heal warning |
local amount = select(15, ...) |
= CreateFrame('Frame'), {}, GetFramerate, math.min, math.max, math.abs |
function ns.SetValueSmooth(self, value) |
local _, max = self:GetMinMaxValues() |
local _, maxv = self:GetMinMaxValues() |
if value == self:GetValue() or (self.prevMax and self.prevMax ~= max) then |
if value == self:GetValue() or (self.prevMax and self.prevMax ~= maxv) then |
-- finished smoothing/max health updated |
smoothing[self] = nil |
self:OrigSetValue(value) |
smoothing[self] = value |
end |
self.prevMax = max |
self.prevMax = maxv |
end |
f:SetScript('OnUpdate', function() |
end |
end |
do -- events for custom cast bar |
do -- events for custom cast bar |
local castEvents = { |
['UNIT_SPELLCAST_START'] = true, |
['UNIT_SPELLCAST_FAILED'] = true, |
end |
------------------------------------------------------- Event ... registerers -- |
-- needs access to castEvents |
-- here as it needs access to castEvents |
function ns.ToggleCastbar(io) |
if io then |
for event,_ in pairs(castEvents) do |
icon = 16 |
}, { |
combopoints = 13, |
large = 11, |
large = 10, -- TODO this was 11, test at 10 |
spellname = 10, |
name = 9, |
small = 8, |