WoWInterface SVN KuiNameplates

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 136 to Rev 137
    Reverse comparison

Rev 136 → Rev 137

branches/v4/castbar.lua
305,29 → 305,38
order = 0,
disabled = false
},
casttime = {
name = 'Show cast time',
desc = 'Show cast time and time remaining',
type = 'toggle',
order = 4
},
spellname = {
name = 'Show spell name',
type = 'toggle',
order = 3
},
spellicon = {
name = 'Show spell icon',
type = 'toggle',
order = 2
},
barcolour = {
name = 'Bar colour',
desc = 'The colour of the cast bar (during interruptible casts)',
type = 'color',
width = 'double',
order = 1
},
display = {
name = 'Display',
type = 'group',
inline = true,
disabled = function(info)
return not self.db.profile.enabled
end,
args = {
casttime = {
name = 'Show cast time',
desc = 'Show cast time and time remaining',
type = 'toggle',
order = 4
},
spellname = {
name = 'Show spell name',
type = 'toggle',
order = 3
},
spellicon = {
name = 'Show spell icon',
type = 'toggle',
order = 2
},
barcolour = {
name = 'Bar colour',
desc = 'The colour of the cast bar (during interruptible casts)',
type = 'color',
order = 1
},
}
}
}
end
 
341,6 → 350,8
barcolour = { .43, .47, .55, 1 },
}
})
 
addon:InitModuleOptions(self)
end
 
function mod:OnEnable()
branches/v4/castwarnings.lua
17,8 → 17,10
self.castWarning.ag:Stop()
 
if spellName == nil then
-- hide the warning instantly (i.e. when interrupted)
self.castWarning:SetAlpha(0)
-- hide the warning instantly
self.castWarning.ag:Stop()
self.castWarning:SetText()
self.castWarning:Hide()
else
local col = COMBATLOG_DEFAULT_COLORS.schoolColoring[spellSchool] or
{r = 1, g = 1, b = 1}
53,9 → 55,9
end
 
-------------------------------------------------------------- Event handlers --
function mod:COMBAT_LOG_EVENT_UNFILTERED(evant, ...)
local castTime, event, _, guid, name, _, _, targetGUID, targetName
= ...
function mod:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
local castTime, event, _, guid, name, _, _, targetGUID, targetName = ...
if not guid then return end
 
if warningEvents[event] then
if event == 'SPELL_HEAL' or
67,23 → 69,15
 
--guid, name = UnitGUID('target'), GetUnitName('target') -- [DEBUG]
 
if self.db.profile.useNames then
if not guid and not name then
return
end
 
if self.db.profile.useNames and name then
name = name and name:gsub('%-.+$', '') -- remove realm names
else
if not guid then
return
end
 
name = nil
end
 
local f = addon:GetNameplate(guid, name)
if f then
if not f.SetIncomingWarning or f.trivial then return end
if not f.castWarning or f.trivial then return end
local spName, spSch = select(13, ...)
 
if event == 'SPELL_HEAL' or
156,14 → 150,29
frame.SetCastWarning = SetCastWarning
frame.SetIncomingWarning = SetIncomingWarning
end
------------------------------------------------------------------------ Hide --
function mod:HideCastWarnings(frame)
 
function mod:Hide(frame)
if frame.castWarning then
frame.castWarning.ag:Stop()
frame.castWarning:SetText()
frame.castWarning.ag:Stop()
frame.castWarning:Hide()
 
frame.incWarning.ag:Stop()
frame.incWarning:SetText()
frame.incWarning:Hide()
end
end
 
---------------------------------------------------- Post db change functions --
mod.configChangedFuncs = { runOnce = {} }
mod.configChangedFuncs.runOnce.warnings = function(val)
if val then
mod:Enable()
else
mod:Disable()
end
end
 
-------------------------------------------------------------------- Register --
function mod:GetOptions()
return {
190,12 → 199,31
useNames = false
}
})
 
addon:InitModuleOptions(self)
mod:SetEnabledState(self.db.profile.warnings)
end
 
function mod:OnEnable()
-- TODO replace this with RegisterMessage etc from AceEvent
addon:RegisterPostFunction('create', self, 'CreateCastWarnings')
addon:RegisterPostFunction('hide', self, 'HideCastWarnings')
addon:RegisterPostFunction('hide', self, 'Hide')
 
self:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
 
local _,frame
for _, frame in pairs(addon.frameList) do
if not frame.castWarning then
self:CreateCastWarnings(frame)
end
end
end
 
function mod:OnDisable()
self:UnregisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
 
local _,frame
for _, frame in pairs(addon.frameList) do
self:Hide(frame)
end
end
\ No newline at end of file
branches/v4/Kui_Nameplates.toc
1,4 → 1,4
## Interface: 50100
## Interface: 50200
## Author: Kesava
## Title: |cff9900ffKui|r Nameplates
## Notes: Prettier, lightweight, configurable nameplates.
branches/v4/config.lua
1,5 → 1,4
local addon, ns = ...
local kn = LibStub('AceAddon-3.0'):GetAddon('KuiNameplates')
local addon = LibStub('AceAddon-3.0'):GetAddon('KuiNameplates')
 
------------------------------------------------------------------ Ace config --
local AceConfig = LibStub('AceConfig-3.0')
48,9 → 47,14
else
p[k] = val
end
 
if self.dbPath.ConfigChanged then
-- inform module of configuration change
self.dbPath.ConfigChanged(k, p)
end
end
 
function kn:GetOptionHandler(mod)
function addon:GetOptionHandler(mod)
if not handlers[mod] then
handlers[mod] = setmetatable({ dbPath = mod }, handlerMeta)
end
60,7 → 64,7
 
local options = {
name = 'Kui Nameplates',
handler = kn:GetOptionHandler(kn),
handler = addon:GetOptionHandler(addon),
type = 'group',
get = 'Get',
set = 'Set',
73,7 → 77,6
general = {
name = 'General display',
type = 'group',
inline = true,
order = 1,
args = {
combat = {
99,7 → 102,6
fade = {
name = 'Frame fading',
type = 'group',
inline = true,
order = 2,
args = {
fadedalpha = {
137,7 → 139,7
softMax = 5,
order = 3,
disabled = function(info)
return not kn.db.profile.fade.smooth
return not addon.db.profile.fade.smooth
end
}
}
145,7 → 147,6
text = {
name = 'Text',
type = 'group',
inline = true,
order = 3,
args = {
level = {
171,7 → 172,6
hp = {
name = 'Health display',
type = 'group',
inline = true,
order = 4,
args = {
showalt = {
217,18 → 217,13
tank = {
name = 'Tank mode',
type = 'group',
inline = true,
order = 5,
disabled = function(info)
return not kn.db.profile.tank.enabled
end,
args = {
enabled = {
name = 'Enable tank mode',
desc = 'Change the colour of a plate\'s health bar and border when you have threat on its unit',
type = 'toggle',
order = 0,
disabled = false
order = 0
},
barcolour = {
name = 'Bar colour',
257,7 → 252,7
 
local fontsOptions = {
name = 'Fonts',
handler = kn:GetOptionHandler(kn),
handler = addon:GetOptionHandler(addon),
type = 'group',
get = 'Get',
set = 'Set',
335,29 → 330,40
}
}
 
-- create module.ConfigChanged function
-- TODO cycle these when changing profiles (or something)
function addon:CreateConfigChangedListener(module)
if module.configChangedFuncs and not module.ConfigChanged then
module.ConfigChanged = function(key, profile)
if module.configChangedFuncs.runOnce and
module.configChangedFuncs.runOnce[key]
then
-- call runOnce function
module.configChangedFuncs.runOnce[key](profile[key])
end
 
if module.configChangedFuncs[key] then
-- iterate frames and call
for _, frame in pairs(addon.frameList) do
module.configChangedFuncs[key](frame, profile[key])
end
end
end
end
end
 
-- create an options table for the given module
function kn:InitModuleOptions(module)
function addon:InitModuleOptions(module)
if not module.GetOptions then return end
local opts = module:GetOptions()
local name = module.uiName or module.moduleName
 
--[[
AceConfig:RegisterOptionsTable('kuinameplates'..name, {
name = name,
handler = self:GetOptionHandler(module),
type = 'group',
get = 'Get',
set = 'Set',
args = opts
})
self:CreateConfigChangedListener(module)
 
AceConfigDialog:AddToBlizOptions('kuinameplates'..name, name, 'Kui Nameplates')]]
 
options.args[name] = {
name = name,
handler = self:GetOptionHandler(module),
type = 'group',
inline = true,
order = 50+#handlers,
get = 'Get',
set = 'Set',
365,6 → 371,9
}
end
 
addon.configChangedFuncs = { runOnce = {} }
addon:CreateConfigChangedListener(addon)
 
AceConfig:RegisterOptionsTable('kuinameplates', options)
AceConfigDialog:AddToBlizOptions('kuinameplates', 'Kui Nameplates')
 
branches/v4/core.lua
2,12 → 2,10
Kui Nameplates
Kesava-Auchindoun EU
]]
local addon, ns = ...
local addon = LibStub('AceAddon-3.0'):NewAddon('KuiNameplates', 'AceEvent-3.0')
local kui = LibStub('Kui-1.0')
local LSM = LibStub('LibSharedMedia-3.0')
 
local kn = LibStub('AceAddon-3.0'):NewAddon('KuiNameplates', 'AceEvent-3.0')
 
-- add yanone kaffesatz and accidental presidency to LSM (only supports latin)
LSM:Register(LSM.MediaType.FONT, 'Yanone Kaffesatz', kui.m.f.yanone)
LSM:Register(LSM.MediaType.FONT, 'Accidental Presidency', kui.m.f.accid)
66,13 → 64,9
}
 
------------------------------------------------------------------------ init --
function kn:OnInitialize()
function addon:OnInitialize()
self.db = LibStub('AceDB-3.0'):New('KuiNameplatesGDB', defaults)
 
for name, module in self:IterateModules() do
self:InitModuleOptions(module)
end
 
-- enable ace3 profiles
LibStub('AceConfig-3.0'):RegisterOptionsTable('kuinameplates-profiles', LibStub('AceDBOptions-3.0'):GetOptionsTable(self.db))
LibStub('AceConfigDialog-3.0'):AddToBlizOptions('kuinameplates-profiles', 'Profiles', 'Kui Nameplates')
branches/v4/combopoints.lua
55,6 → 55,15
frame.cp:Update()
end
end
---------------------------------------------------- Post db change functions --
mod.configChangedFuncs = { runOnce = {} }
mod.configChangedFuncs.runOnce.enabled = function(val)
if val then
mod:Enable()
else
mod:Disable()
end
end
-------------------------------------------------------------------- Register --
function mod:GetOptions()
return {
72,6 → 81,9
enabled = true,
}
})
 
addon:InitModuleOptions(self)
mod:SetEnabledState(self.db.profile.enabled)
end
 
function mod:OnEnable()
branches/v4/layout.lua
962,34 → 962,11
profile = self.db.profile
end
 
-- TODO move all this crap into config.lua (or maybe not, create.lua?)
---------------------------------------------------- Post db change functions --
-- for changes which require traversal of all frames
kn.updateFunctions = {}
kn.updateFunctions.Call = function(func, val)
if not kn.updateFunctions[func] then return end
 
local runonce, _, frame = 0
for _, frame in pairs(kn.frameList) do
kn.updateFunctions[func](frame, val, runonce)
runonce = runonce + 1
end
kn.configChangedFuncs.runOnce.fontscale = function(val)
kn:ScaleFontSizes()
end
 
kn.updateFunctions.Health = function(frame)
if frame:IsShown() then
-- update health display
OnHealthValueChanged(frame.oldHealth, frame.oldHealth:GetValue())
end
end
kn.updateFunctions.friendly = kn.updateFunctions.Health
kn.updateFunctions.hostile = kn.updateFunctions.Health
 
kn.updateFunctions.fontscale = function(frame, val, runonce)
if runonce == 0 then
ns:ScaleFonts()
end
 
kn.configChangedFuncs.fontscale = function(frame, val)
local _, fontObject
for _, fontObject in pairs(frame.fontObjects) do
if type(fontObject.size) == 'string' then
998,17 → 975,23
end
end
 
kn.updateFunctions.font = function(frame, val, runonce)
val = LSM:Fetch(LSM.MediaType.FONT, val)
 
if runonce == 0 then
kn.font = val
kn.configChangedFuncs.Health = function(frame)
if frame:IsShown() then
-- update health display
OnHealthValueChanged(frame.oldHealth, frame.oldHealth:GetValue())
end
end
kn.configChangedFuncs.friendly = kn.configChangedFuncs.Health
kn.configChangedFuncs.hostile = kn.configChangedFuncs.Health
 
kn.configChangedFuncs.runOnce.font = function(val)
kn.font = LSM:Fetch(LSM.MediaType.FONT, val)
end
kn.configChangedFuncs.font = function(frame, val)
local _, fontObject
for _, fontObject in pairs(frame.fontObjects) do
local _, size, flags = fontObject:GetFont()
fontObject:SetFont(val, size, flags)
fontObject:SetFont(kn.font, size, flags)
end
end
 
branches/v4/custom-rename-me.lua
2,31 → 2,42
For Kui Nameplates
Rename this file to custom.lua to attach custom code to the addon. Once
renamed, you'll need to completely restart WoW so that it detects the file.
 
Updated 24/12/12:
 
* all functions are now inside the table `c`
 
* RegisterPostFunction calls have been updated, copy and paste the last 4
lines into your custom.lua, overwriting the previous 4 lines.
 
* kn is now set using an AceAddon call rather than a global. Copy and paste
the topmost line into your custom.lua, overwriting the previous line.
]]
local kn = KuiNameplates
local kn = LibStub('AceAddon-3.0'):GetAddon('KuiNameplates')
local c = {}
 
---------------------------------------------------------------------- Create --
local function PostCreate(frame)
function c:PostCreate(frame)
-- Place code to be performed after a frame is created here.
end
 
------------------------------------------------------------------------ Show --
local function PostShow(frame)
function c:PostShow(frame)
-- Place code to be performed after a frame is shown here.
end
 
------------------------------------------------------------------------ Hide --
local function PostHide(frame)
function c:PostHide(frame)
-- Place code to be performed after a frame is hidden here.
end
 
---------------------------------------------------------------------- Target --
local function PostTarget(frame)
function c:PostTarget(frame)
-- Place code to be performed when a frame becomes the player's target here.
end
 
-------------------------------------------------------------------- Register --
kn.RegisterPostFunction('create', PostCreate)
kn.RegisterPostFunction('show', PostShow)
kn.RegisterPostFunction('hide', PostHide)
kn.RegisterPostFunction('target', PostTarget)
\ No newline at end of file +kn:RegisterPostFunction('create', c, 'PostCreate') +kn:RegisterPostFunction('show', c, 'PostShow') +kn:RegisterPostFunction('hide', c, 'PostHide') +kn:RegisterPostFunction('target', c, 'PostTarget') \ No newline at end of file