WoWInterface SVN KuiNameplates

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 155 to Rev 152
    Reverse comparison

Rev 155 → Rev 152

Kui_Nameplates/lib/embeds.xml
9,7 → 9,6
<Include file="Ace3\AceDBOptions-3.0\AceDBOptions-3.0.xml"/>
<Include file="Ace3\AceGUI-3.0\AceGUI-3.0.xml"/>
<Include file="Ace3\AceConfig-3.0\AceConfig-3.0.xml"/>
<Include file="Ace3\AceTimer-3.0\AceTimer-3.0.xml"/>
 
<Include file="LibSharedMedia-3.0\lib.xml"/>
<Include file="Ace3\AceGUI-3.0-SharedMediaWidgets\widget.xml"/>
Kui_Nameplates/core.lua
2,7 → 2,7
Kui Nameplates
Kesava-Auchindoun EU
]]
local addon = LibStub('AceAddon-3.0'):NewAddon('KuiNameplates', 'AceEvent-3.0', 'AceTimer-3.0')
local addon = LibStub('AceAddon-3.0'):NewAddon('KuiNameplates', 'AceEvent-3.0')
local kui = LibStub('Kui-1.0')
local LSM = LibStub('LibSharedMedia-3.0')
 
Kui_Nameplates/layout.lua
10,6 → 10,9
 
--KuiNameplatesDebug=true
 
-- frame to run OnUpdate
kn.f = CreateFrame('Frame')
 
kn.font = ''
kn.fontSizes = {}
kn.sizes = {}
849,25 → 852,29
local WorldFrame, lastUpdate
= WorldFrame, 1
 
function kn:OnUpdate()
local frames = select('#', WorldFrame:GetChildren())
function kn.f:OnUpdate(elapsed)
lastUpdate = lastUpdate + elapsed
 
if frames ~= self.numFrames then
local i, f
if lastUpdate >= .1 then
lastUpdate = 0
 
for i = 1, frames do
f = select(i, WorldFrame:GetChildren())
if self:IsNameplate(f) and not f.init then
self:InitFrame(f)
tinsert(self.frameList, f)
local frames = select('#', WorldFrame:GetChildren())
 
if frames ~= kn.numFrames then
local i, f
 
for i = 1, frames do
f = select(i, WorldFrame:GetChildren())
if kn:IsNameplate(f) and not f.init then
kn:InitFrame(f)
tinsert(kn.frameList, f)
end
end
 
kn.numFrames = frames
end
 
self.numFrames = frames
end
end
 
kn:ScheduleRepeatingTimer('OnUpdate', .1)
end
 
function kn:ToggleCombatEvents(io)
1043,6 → 1050,7
end)
end
 
self.f:SetScript('OnUpdate', self.f.OnUpdate)
self:RegisterEvent('PLAYER_TARGET_CHANGED')
self.ToggleCombatEvents(profile.general.combat)
end
Kui_Nameplates_Auras/auras.lua
3,14 → 3,17
local kui = LibStub('Kui-1.0')
local mod = addon:NewModule('Auras', 'AceEvent-3.0')
 
-- combat log events to listen to for fading auras
local auraEvents = {
-- ['SPELL_DISPEL'] = true,
['SPELL_AURA_REMOVED'] = true,
['SPELL_AURA_BROKEN'] = true,
['SPELL_AURA_BROKEN_SPELL'] = true,
}
local currentFrame = nil
 
--[[ TODO
 
Make work on mouseover
 
If only two containers are ever displayed, just make two containers and
move them around rather than making 1 container for every nameplate
 
]]
 
local function ArrangeButtons(self)
local pv, pc
self.visible = 0
78,7 → 81,7
end
 
if timeLeft <= 0 then
self.time:SetText('0')
self:Hide()
end
 
self.elapsed = .5
207,42 → 210,31
end
 
-------------------------------------------------------------- event handlers --
function mod:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
local castTime, event, _, guid, name, _, _, targetGUID, targetName = ...
if not guid then return end
if not auraEvents[event] then return end
if guid ~= UnitGUID('player') then return end
function mod:PLAYER_TARGET_CHANGED()
local frame = addon:GetNameplate(UnitGUID('target'), nil)
 
--print(event..' from '..name..' on '..targetName)
if currentFrame and (not frame or frame ~= currentFrame) then
-- hide auras on the previous target
currentFrame.auras:Hide()
end
 
-- fetch the subject's nameplate
local f = addon:GetNameplate(targetGUID, targetName)
if not f or not f.auras then return end
if frame ~= currentFrame then
currentFrame = frame
end
 
--print('(frame for guid: '..targetGUID..')')
 
local spId = select(12, ...)
 
if f.auras.spellIds[spId] then
f.auras.spellIds[spId]:Hide()
if frame then
-- scan auras on the new target
self:UNIT_AURA('UNIT_AURA', 'target')
end
end
 
function mod:PLAYER_TARGET_CHANGED()
self:UNIT_AURA('UNIT_AURA', 'target')
end
 
function mod:UPDATE_MOUSEOVER_UNIT()
self:UNIT_AURA('UNIT_AURA', 'mouseover')
end
 
function mod:UNIT_AURA(event, unit)
if unit ~= 'target' then return end
 
-- select the targeted nameplate
local frame = addon:GetNameplate(UnitGUID(unit), nil)
if not frame or not frame.auras or frame.trivial then return end
if not frame or not frame.auras then return end
 
--print('Scan auras on unit: '..unit)
 
local filter = 'PLAYER '
if UnitIsFriend(unit, 'player') then
filter = filter..'HELPFUL'
250,18 → 242,13
filter = filter..'HARMFUL'
end
 
-- hide currently displayed auras
local _,button
for _,button in pairs(frame.auras.spellIds) do
button:Hide()
end
 
for i = 0,40 do
-- TODO optimise
local name, _, icon, count, _, duration, expirationTime, _, _, _, spellId = UnitAura(unit, i, filter)
-- TODO find auras which are no longer present
local name, _, icon, count, _, duration, expirationTime, _, _, _, spellId = UnitAura('target', i, filter)
 
if name and
(not self.db.profile.behav.useWhitelist or
(not self.db.profile.display.useWhitelist or
whitelist[spellId]) and
(duration >= self.db.profile.display.lengthMin) and
(self.db.profile.display.lengthMax == -1 or
272,6 → 259,13
button:Show()
end
end
 
if frame ~= currentFrame then
if currentFrame then
currentFrame.auras:Hide()
end
currentFrame = frame
end
end
 
---------------------------------------------------- Post db change functions --
306,7 → 300,6
name = 'Timer threshold (s)',
desc = 'Timer text will be displayed on auras when their remaining length is less than or equal to this value. -1 to always display timer.',
type = 'range',
order = 10,
min = -1,
softMax = 180,
step = 1
315,7 → 308,6
name = 'Effect length minimum (s)',
desc = 'Auras with a total duration of less than this value will never be displayed. 0 to disable.',
type = 'range',
order = 20,
min = 0,
softMax = 60,
step = 1
324,27 → 316,14
name = 'Effect length maximum (s)',
desc = 'Auras with a total duration greater than this value will never be displayed. -1 to disable.',
type = 'range',
order = 30,
min = -1,
softMax= 1800,
step = 1
},
 
}
},
behav = {
name = 'Behaviour',
type = 'group',
inline = true,
disabled = function()
return not self.db.profile.enabled
end,
args = {
useWhitelist = {
name = 'Use whitelist',
desc = 'Only display spells which your class needs to keep track of for PVP or an effective DPS rotation. Most passive effects are excluded.',
type = 'toggle',
order = 0,
type = 'toggle'
},
}
}
359,8 → 338,6
timerThreshold = 20,
lengthMin = 0,
lengthMax = -1,
},
behav = {
useWhitelist = true,
}
}
380,8 → 357,6
 
self:RegisterEvent('UNIT_AURA')
self:RegisterEvent('PLAYER_TARGET_CHANGED')
self:RegisterEvent('UPDATE_MOUSEOVER_UNIT')
self:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
 
local _, frame
for _, frame in pairs(addon.frameList) do
394,8 → 369,6
function mod:OnDisable()
self:UnregisterEvent('UNIT_AURA')
self:UnregisterEvent('PLAYER_TARGET_CHANGED')
self:UnregisterEvent('UPDATE_MOUSEOVER_UNIT')
self:UnregisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
 
local _, frame
for _, frame in pairs(addon.frameList) do