/trunk
--[[ |
Kui Nameplates |
Kesava-Auchindoun |
TODO make option for friendly/enemy name text colour (defaults to white) |
]] |
local addon, ns = ... |
{ .7, .2, .1 }, -- hated |
{ 1, .8, 0 }, -- neutral |
{ .2, .6, .1 }, -- friendly |
{ .5, .5, .5 }, -- tapped |
} |
-- combat log events to listen to for cast warnings/healing |
elseif (r + g) > 1.8 and b == 0 then |
-- neutral NPC |
r, g, b = unpack(ns.r[2]) |
elseif b > .9 and (r+g) > 1.06 and (r+g) < 1.1 then |
-- tapped NPC |
if profile.hp.tapped then |
-- use grey... |
r, g, b = unpack(ns.r[4]) |
else |
-- or don't change |
r, g, b = self.health:GetStatusBarColor() |
end |
end |
-- enemy player, use default UI colour |
---------------------------------------------------- Update health bar & text -- |
local function OnHealthValueChanged(oldBar, curr) |
local frame = oldBar:GetParent() |
local frame = oldBar:GetParent():GetParent() |
local min, max = oldBar:GetMinMaxValues() |
local deficit, big, sml, condition, display, pattern, rules |
= max - curr, '', '' |
if profile.general.fixaa and uiscale then |
------------------------------------------------------------ Position -- |
local x, y = select(4, self:GetPoint()) |
local x, y = select(4, self.firstChild:GetPoint()) |
x = x / uiscale |
y = y / uiscale |
function ns.f:IsNameplate(frame) |
if frame:GetName() and string.find(frame:GetName(), '^NamePlate%d') then |
local overlayRegion = select(2, frame:GetRegions()) |
return (overlayRegion and overlayRegion:GetObjectType() == 'Texture') |
--local healthbar = select(2, frame:GetChildren()); |
--local overlay = select(2, healthbar:GetRegions()); |
--return (overlayRegion and overlayRegion:GetObjectType() == 'Texture') |
return true |
end |
end |
function ns.f:InitFrame(frame) |
frame.init = true |
local healthBar, castBar = frame:GetChildren() |
local overlayChild, nameTextChild = frame:GetChildren() |
local healthBar, castBar = overlayChild:GetChildren() |
local _, castbarOverlay, shieldedRegion, spellIconRegion |
= castBar:GetRegions() |
local nameTextRegion = nameTextChild:GetRegions() |
local |
glowRegion, overlayRegion, highlightRegion, nameTextRegion, |
levelTextRegion, bossIconRegion, raidIconRegion, stateIconRegion |
= frame:GetRegions() |
glowRegion, overlayRegion, highlightRegion, levelTextRegion, |
bossIconRegion, raidIconRegion, stateIconRegion |
= overlayChild:GetRegions() |
highlightRegion:SetTexture(nil) |
bossIconRegion:SetTexture(nil) |
castbarOverlay.Show = function() return end |
castBar:SetScript('OnShow', function() castBar:Hide() end) |
frame.firstChild = overlayChild |
frame.bg = overlayRegion |
frame.glow = glowRegion |
frame.boss = bossIconRegion |
## Interface: 50001 |
## Interface: 50100 |
## Author: Kesava |
## Title: |cff9900ffKui|r Nameplates |
## Notes: Prettier, lightweight, configurable nameplates. |
type = 'toggle', |
order = 3 |
}, |
tapped = { |
name = 'Use tapped colour', |
desc = 'Give tapped units a grey health bar', |
type = 'toggle', |
order = 4 |
}, |
friendly = { |
name = 'Friendly health format', |
desc = 'The health display pattern for friendly units', |
type = 'input', |
pattern = '([<=]:[dmcp];)', |
order = 4 |
order = 5 |
}, |
hostile = { |
name = 'Hostile health format', |
desc = 'The health display pattern for hostile or neutral units', |
type = 'input', |
pattern = '([<=]:[dmcp];)', |
order = 5 |
order = 6 |
} |
} |
}, |
local addon, ns = ... |
local MAJOR, MINOR = 'Kui-1.0', 1 |
local MAJOR, MINOR = 'Kui-1.0', 2 |
local kui = LibStub:NewLibrary(MAJOR, MINOR) |
if not kui then |
yanone = media .. 'f\\yanone.ttf', |
}, |
} |
------------------------------------------------------------------ var tables -- |
local ct = { -- classification table |
elite = { '+', 'elite' }, |
rare = { 'r', 'rare' }, |
rareelite = { 'r+', 'rare elite' }, |
worldboss = { 'b', 'boss' } |
} |
------------------------------------------------------------------- functions -- |
kui.GetClassColour = function(class, str) |
end |
end |
kui.UnitLevel = function(unit) |
level, cl = UnitLevel(unit), UnitClassification(unit) |
l = level |
kui.UnitLevel = function(unit, long) |
local level, classification = |
UnitLevel(unit), UnitClassification(unit) |
local diff = GetQuestDifficultyColor(level <= 0 and 999 or level) |
if l < 0 then |
level = '??' |
l = 999 |
if ct[classification] then |
classification = long and ct[classification][2] or ct[classification][1] |
else |
classification = '' |
end |
if cl == 'elite' then |
cl = '+' |
elseif cl == 'rareelite' then |
cl = 'r+' |
elseif cl == 'rare' then |
cl = 'r' |
elseif cl == 'worldboss' then |
cl = 'b' |
else |
cl = '' |
if level == -1 then |
level = '??' |
end |
return level, cl, GetQuestDifficultyColor(l) |
return level, classification, diff |
end |
kui.CreateFontString = function(parent, args) |
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 |
tapped = true, -- use grey health bar colour for tapped units |
smooth = true -- smoothly animate health bar changes |
}, |
castbar = { |