WoWInterface SVN KuiNameplates

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 157 to Rev 158
    Reverse comparison

Rev 157 → Rev 158

trunk/Kui_Nameplates/layout.lua
1,6 → 1,12
--[[
Kui Nameplates
Kesava-Auchindoun
 
TODO NEXT VERSION
customisation for sizes/positions of auras & width of container frame, etc
customisation for raid target icons
test combo points
fix cast time and spell name overlapping
]]
 
local addon, ns = ...
782,13 → 788,6
self:CreateBackground(frame)
self:CreateHealthBar(frame)
 
-- raid icon ---------------------------------------------------------------
frame.icon:SetParent(parent)
--frame.icon:SetSize(24, 24)
 
frame.icon:ClearAllPoints()
frame.icon:SetPoint('BOTTOM', parent, 'TOP', 0, -5)
 
-- overlay (text is parented to this) --------------------------------------
frame.overlay = CreateFrame('Frame', nil, parent)
frame.overlay:SetAllPoints(frame.health)
809,6 → 808,14
 
self:CreateName(frame)
 
-- raid icon ---------------------------------------------------------------
kn:RegisterSize('frame', 'raidicon', 18)
 
frame.icon:SetParent(frame.overlay)
frame.icon:SetSize(kn.sizes.raidicon, kn.sizes.raidicon)
 
frame.icon:ClearAllPoints()
frame.icon:SetPoint('LEFT', frame.health, 'RIGHT', 0, 0)
----------------------------------------------------------------- Scripts --
frame:HookScript('OnShow', OnFrameShow)
frame:HookScript('OnHide', OnFrameHide)
887,11 → 894,11
 
function kn:ToggleCombatEvents(io)
if io then
kn:RegisterEvent('PLAYER_REGEN_ENABLED')
kn:RegisterEvent('PLAYER_REGEN_DISABLED')
self:RegisterEvent('PLAYER_REGEN_ENABLED')
self:RegisterEvent('PLAYER_REGEN_DISABLED')
else
kn:UnregisterEvent('PLAYER_REGEN_ENABLED')
kn:UnregisterEvent('PLAYER_REGEN_DISABLED')
self:UnregisterEvent('PLAYER_REGEN_ENABLED')
self:UnregisterEvent('PLAYER_REGEN_DISABLED')
end
end
 
1059,5 → 1066,5
end
 
self:RegisterEvent('PLAYER_TARGET_CHANGED')
self.ToggleCombatEvents(profile.general.combat)
self:ToggleCombatEvents(profile.general.combat)
end
trunk/Kui_Nameplates/combopoint-square.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream Added: svn:executable + *
trunk/Kui_Nameplates/combopoint.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream Added: svn:executable + *
trunk/Kui_Nameplates/combopoints.lua
5,54 → 5,86
 
local function ComboPointsUpdate(self)
if self.points and self.points > 0 then
local size = (13 + ((18 - 13) / 5) * self.points)
local blue = (1 - (1 / 5) * self.points)
local i
 
for i = 1,5 do
if i <= self.points then
self[i]:SetAlpha(1)
else
self[i]:SetAlpha(.3)
end
 
addon.SetFontSize(self, size)
self[i]:SetVertexColor(unpack(self.colour))
end
 
self:SetText(self.points)
self:SetTextColor(1, 1, blue)
self:Show()
elseif self:GetText() then
self:SetText('')
elseif self:IsShown() then
self:Hide()
end
end
-------------------------------------------------------------- Event handlers --
function mod:UNIT_COMBO_POINTS(event, unit)
if not unit then return end
-- only works for player > target
if not unit or unit ~= 'player' then return end
 
local guid, name = UnitGUID(unit), UnitName(unit)
-- TODO make sure UnitName() doesn't need to have realm names removed
-- before GetNameplate will recognise them
local guid, name = UnitGUID('target'), UnitName('target')
local f = addon:GetNameplate(guid, name)
 
if f then
if f.cp then
f.cp.points = GetComboPoints(unit, unit)
f.cp:Update()
if f and f.combopoints then
local points = GetComboPoints('player', 'target')
 
if points == 5 then
f.combopoints.colour = { 1, 1, .1 }
else
f.combopoints.colour = { .79, .55, .18 }
end
 
f.combopoints.points = points
f.combopoints:Update()
end
 
-- clear points on other frames
local _, frame
for _, frame in pairs(addon.frameList) do
if frame.cp and frame ~= f then
if frame.combopoints and frame ~= f then
self:HideComboPoints(nil, frame)
end
end
end
---------------------------------------------------------------------- Create --
function mod:CreateComboPoints(msg, frame)
frame.cp = frame:CreateFontString(frame.health, {
font = addon.font, size = 'combopoints', outline = 'OUTLINE', shadow = true })
frame.cp:SetPoint('LEFT', frame.health, 'RIGHT', 5, 1)
frame.cp.Update = ComboPointsUpdate
frame.cp:Hide()
-- create combo point icons
frame.combopoints = CreateFrame('Frame', nil, frame.parent)
frame.combopoints:Hide()
 
local i, pcp
for i=0,4 do
local cp = frame.combopoints:CreateTexture(nil, 'ARTWORK')
cp:SetDrawLayer('ARTWORK', 1) -- above overlay
cp:SetTexture('Interface\\AddOns\\Kui_Nameplates\\combopoint')
cp:SetTexCoord(0, .375, 0, .375)
cp:SetSize(addon.sizes.combopoints, addon.sizes.combopoints)
 
if i == 0 then
cp:SetPoint('BOTTOM', frame.overlay, 'BOTTOM',
-((addon.sizes.combopoints*2)+2), -3)
else
cp:SetPoint('LEFT', pcp, 'RIGHT', 1, 0)
end
 
tinsert(frame.combopoints, i+1, cp)
pcp = cp -- store previous icon
end
 
frame.combopoints.Update = ComboPointsUpdate
end
------------------------------------------------------------------------ Hide --
function mod:HideComboPoints(msg, frame)
if frame.cp then
frame.cp.points = nil
frame.cp:Update()
if frame.combopoints then
frame.combopoints.points = nil
frame.combopoints:Update()
end
end
---------------------------------------------------- Post db change functions --
83,6 → 115,7
}
})
 
addon:RegisterSize('frame', 'combopoints', 5)
addon:InitModuleOptions(self)
mod:SetEnabledState(self.db.profile.enabled)
end
95,7 → 128,7
 
local _, frame
for _, frame in pairs(addon.frameList) do
if not frame.cp then
if not frame.combopoints then
self:CreateComboPoints(nil, frame)
end
end
108,4 → 141,4
for _, frame in pairs(addon.frameList) do
self:HideComboPoints(nil, frame)
end
end
\ No newline at end of file +end