/trunk
local addon, ns = ... |
local kui = LibStub('Kui-1.0') |
------------------------------------------------------------------ Ace config -- |
local AceConfig = LibStub('AceConfig-3.0') |
--------------------------------------------------------------- Options table -- |
do |
local fontSelection = { |
'Yanone Kaffeesatz', |
'Accidental Presidency', |
'Standard font (Friz Quadrata)', |
'Chat font (Arial Narrow)', |
'Morpheus', |
'Skurri', |
} |
local fontSelectionValues = { |
kui.m.f.yanone, |
kui.m.f.accid, |
STANDARD_TEXT_FONT, |
select(1, DEFAULT_CHAT_FRAME:GetFont()), |
'Fonts\\MORPHEUS.ttf', |
'Fonts\\skurri.ttf', |
} |
local handler = {} |
local options = { |
name = 'Kui Nameplates', |
name = 'Font', |
desc = 'The font used for all text on frames', |
type = 'select', |
dialogControl = 'LSM30_Font', |
values = AceGUIWidgetLSMlists.font, |
order = 4 |
get = 'GetFont', |
set = 'SetFont', |
values = fontSelection |
}, |
fontscale = { |
name = 'Font scale', |
desc = 'The scale of all fonts displayed on nameplates', |
type = 'range', |
min = 0.01, |
min = 0, |
softMax = 2, |
order = 5 |
order = 4 |
} |
} |
}, |
ns.db.profile[info[1]][info[#info]] = val |
end |
end |
function handler:GetFont(info) |
local path = ns.db.profile[info[1]][info[#info]] |
for id, thisPath in pairs(fontSelectionValues) do |
if path == thisPath then |
return id |
end |
end |
return 1 |
end |
function handler:SetFont(info, val) |
ns.db.profile[info[1]][info[#info]] = fontSelectionValues[val] |
end |
AceConfig:RegisterOptionsTable('kuinameplates', options) |
AceConfigDialog:AddToBlizOptions('kuinameplates', 'Kui Nameplates') |
end |
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"> |
<Script file="LibStub\LibStub.lua"/> |
<Include file="Kui\kui.xml"/> |
<Include file="Ace3\CallbackHandler-1.0\CallbackHandler-1.0.xml"/> |
<Include file="Ace3\AceAddon-3.0\AceAddon-3.0.xml"/> |
<Include file="Ace3\AceDB-3.0\AceDB-3.0.xml"/> |
<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="LibSharedMedia-3.0\lib.xml"/> |
<Include file="Ace3\AceGUI-3.0-SharedMediaWidgets\widget.xml"/> |
<Include file="Ace3\AceDB-3.0\AceDB-3.0.xml"/> |
<Include file="Ace3\AceDBOptions-3.0\AceDBOptions-3.0.xml"/> |
</Ui> |
]] |
local addon, ns = ... |
local kui = LibStub('Kui-1.0') |
local LSM = LibStub('LibSharedMedia-3.0') |
LibStub('AceAddon-3.0'):NewAddon(ns, 'KuiNameplates') |
-- 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) |
-- TODO should probably move LSM stuff into Kui, and replace the table there |
ns.kui = kui |
local locale = GetLocale() |
local latin = (locale ~= 'zhCN' and locale ~= 'zhTW' and locale ~= 'koKR' and locale ~= 'ruRU') |
-------------------------------------------------------------- Default config -- |
local defaults = { |
profile = { |
highlight = true, -- highlight plates on mouse-over |
combopoints = true, -- display combo points |
fixaa = true, -- attempt to make plates appear sharper (with some drawbacks) |
font = (latin and 'Yanone Kaffesatz' or LSM:GetDefault(LSM.MediaType.FONT)), -- the font used for all text |
font = kui.m.f.yanone, -- the font used for all text |
fontscale = 1.0, -- the scale of all displayed font sizes |
}, |
fade = { |
glowcolour = { 1, 0, 0, 1, 1 } -- the glow colour to use when you have threat |
}, |
hp = { |
--[[ |
syntax help: |
A simple pattern is used to determine what text should be displayed for health. |
A pattern consists of rules seperated by semi-colons (;). |
A rule consists of the condition followed by the result of the rule seperated by a colon (:). |
For example: |
A rule: condition:result |
A pattern: rule1;rule2;rule3 (etc) |
Valid conditions are as follows: |
<= : When health is less than or equal to its maximum value... |
< : When health is less than its maximum value... |
= : When health is equal to its maximum value... |
Valid results are: |
c : the current, precise health value (i.e. 128.4k) |
d : precise value of health that is currently missing (i.e. -12.3k) |
m : the maximum amount of health |
p : the current amount of health in percent |
Health display defaults to blank if no rule is matched. |
The default patterns and their meanings are: |
Friendly: =:m;<:d; |
Meaning: When at max health, display max health (=:m;) |
When below max health, display health deficit (<:d;) |
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 |
showalt = true, -- show alternate (contextual) health values as well as main values |
spellname = true, -- display spell name |
spellicon = true, -- display spell icon |
barcolour = { .43, .47, .55, 1 }, -- the colour of the spell bar (interruptible casts) |
warnings = false, -- display spell cast warnings on any plates |
usenames = false -- use unit names to display cast warnings on their correct frames: may increase memory usage and may cause warnings to be displayed on incorrect frames when there are many units with the same name. Reccommended on for PvP, off for PvE. |
warnings = true, -- display spell cast warnings on any plates |
usenames = true -- use unit names to display cast warnings on their correct frames: may increase memory usage and may cause warnings to be displayed on incorrect frames when there are many units with the same name. Reccommended on for PvP, off for PvE. |
}, |
} |
} |
]] |
local addon, ns = ... |
local kui = LibStub('Kui-1.0') |
local LSM = LibStub('LibSharedMedia-3.0') |
local kui = ns.kui |
local uiscale, prevuiscale |
local loadedGUIDs, loadedNames, targetExists, profile |
= {}, {} |
-- our frame, whee |
ns.f = CreateFrame('Frame') |
['SPELL_PERIODIC_HEAL'] = true |
} |
local font, uiscale, prevuiscale |
local loadedGUIDs, loadedNames, targetExists, profile = {}, {} |
local origSizes, origFontSizes, sizes, fontSizes = {},{},{},{} |
--------------------------------------------------------------------- globals -- |
local blue = (1 - (1 / 5) * self.points) |
self:SetText(self.points) |
self:SetFont(font, size, 'OUTLINE') |
self:SetFont(profile.general.font, size, 'OUTLINE') |
self:SetTextColor(1, 1, blue) |
elseif self:GetText() then |
self:SetText('') |
-- health text ------------------------------------------------------------- |
frame.health.p = kui.CreateFontString(frame.overlay, { |
font = font, size = fontSizes.large, outline = "OUTLINE" }) |
font = profile.general.font, size = fontSizes.large, outline = "OUTLINE" }) |
frame.health.p:SetJustifyH('RIGHT') |
frame.health.p:SetPoint('BOTTOMRIGHT', frame.health, 'TOPRIGHT', -2, uiscale and -(3/uiscale) or -3) |
if profile.hp.showalt then |
frame.health.mo = kui.CreateFontString(frame.overlay, { |
font = font, size = fontSizes.small, outline = "OUTLINE" }) |
font = profile.general.font, size = fontSizes.small, outline = "OUTLINE" }) |
frame.health.mo:SetJustifyH('RIGHT') |
frame.health.mo:SetPoint('BOTTOMRIGHT', frame.health, -2, uiscale and -(3/uiscale) or -3) |
-- level text -------------------------------------------------------------- |
frame.level = kui.CreateFontString(frame.level, { reset = true, |
font = font, size = fontSizes.name, outline = 'OUTLINE' }) |
font = profile.general.font, size = fontSizes.name, outline = 'OUTLINE' }) |
frame.level:SetParent(frame.overlay) |
frame.level:ClearAllPoints() |
-- name text --------------------------------------------------------------- |
frame.name = kui.CreateFontString(frame.overlay, { |
font = font, size = fontSizes.name, outline = 'OUTLINE' }) |
font = profile.general.font, size = fontSizes.name, outline = 'OUTLINE' }) |
frame.name:SetJustifyH('LEFT') |
frame.name:SetHeight(8) |
-- combo point text -------------------------------------------------------- |
if profile.general.combopoints then |
frame.cp = kui.CreateFontString(frame.health, |
{ font = font, size = fontSizes.combopoints, outline = 'OUTLINE', shadow = true }) |
{ font = profile.general.font, size = fontSizes.combopoints, outline = 'OUTLINE', shadow = true }) |
frame.cp:SetPoint('LEFT', frame.health, 'RIGHT', 5, 1) |
frame.cp.Update = ComboPointsUpdate |
-- cast bar text ------------------------------------------------------- |
if profile.castbar.spellname then |
frame.castbar.name = kui.CreateFontString(frame.castbar, { |
font = font, size = fontSizes.name, outline = "OUTLINE" }) |
font = profile.general.font, size = fontSizes.name, outline = "OUTLINE" }) |
frame.castbar.name:SetPoint('TOPLEFT', frame.castbar, 'BOTTOMLEFT', 2, -2) |
end |
if profile.castbar.casttime then |
frame.castbar.max = kui.CreateFontString(frame.castbar, { |
font = font, size = fontSizes.name, outline = "OUTLINE" }) |
font = profile.general.font, size = fontSizes.name, outline = "OUTLINE" }) |
frame.castbar.max:SetPoint('TOPRIGHT', frame.castbar, 'BOTTOMRIGHT', -2, -1) |
frame.castbar.curr = kui.CreateFontString(frame.castbar, { |
font = font, size = fontSizes.small, outline = "OUTLINE" }) |
font = profile.general.font, size = fontSizes.small, outline = "OUTLINE" }) |
frame.castbar.curr:SetAlpha(.5) |
frame.castbar.curr:SetPoint('TOPRIGHT', frame.castbar.max, 'TOPLEFT', -1, -1) |
end |
if profile.castbar.warnings then |
-- casting spell name |
frame.castWarning = kui.CreateFontString(frame.overlay, { |
font = font, size = fontSizes.spellname, outline = 'OUTLINE' }) |
font = profile.general.font, size = fontSizes.spellname, outline = 'OUTLINE' }) |
frame.castWarning:SetPoint('BOTTOMLEFT', frame.level, 'TOPLEFT', 0, 1) |
frame.castWarning:Hide() |
-- incoming healing |
frame.incWarning = kui.CreateFontString(frame.overlay, { |
font = font, size = fontSizes.small, outline = 'OUTLINE' }) |
font = profile.general.font, size = fontSizes.small, outline = 'OUTLINE' }) |
frame.incWarning:SetPoint('BOTTOMRIGHT', frame.health.p, 'TOPRIGHT', 1) |
frame.incWarning:Hide() |
frame:SetBackdropColor(1, 1, 1, .5) |
frame.isfriend = kui.CreateFontString(frame, { |
font = font, size = 10, outline = 'OUTLINE' }) |
font = profile.general.font, size = 10, outline = 'OUTLINE' }) |
frame.isfriend:SetPoint('BOTTOM', frame, 'TOP') |
frame.guidtext = kui.CreateFontString(frame, { |
font = font, size = 10, outline = "OUTLINE" }) |
font = profile.general.font, size = 10, outline = "OUTLINE" }) |
frame.guidtext:SetPoint('TOP', frame, 'BOTTOM') |
frame.nametext = kui.CreateFontString(frame, { |
font = font, size = 10, outline = "OUTLINE" }) |
font = profile.general.font, size = 10, outline = "OUTLINE" }) |
frame.nametext:SetPoint('TOP', frame.guidtext, 'BOTTOM') |
]] |
fontSizes[k] = size * profile.general.fontscale |
end |
-- fetch font path from lsm |
font = LSM:Fetch(LSM.MediaType.FONT, profile.general.font) |
ns.f:SetScript('OnUpdate', self.OnUpdate) |
ns.f:SetScript('OnEvent', self.OnEvent) |