121 lines
5.1 KiB
Lua
121 lines
5.1 KiB
Lua
----------------------------------------------------------------------
|
|
-- RelationshipsThreatPlates_Media.lua
|
|
-- Embedded media textures and fonts
|
|
-- Self-contained - generates textures procedurally, no external files
|
|
----------------------------------------------------------------------
|
|
|
|
local addon = RelationshipsThreatPlates -- Created in RelationshipsThreatPlates_Core.lua (loaded first via XML)
|
|
|
|
addon.Media = {}
|
|
|
|
-- ==================================================================
|
|
-- Procedural status bar texture (solid gradient)
|
|
-- Generated at runtime via texture coordinates on Blizzard's shared
|
|
-- gradient texture, matching Kui's clean flat bar style
|
|
-- ==================================================================
|
|
|
|
-- Use Blizzard's built-in solid textures as bar fill
|
|
-- These are always available and produce the clean flat look
|
|
addon.Media.BAR_TEXTURE = "Interface\\AddOns\\RelationshipsThreatPlates\\Media\\Bar"
|
|
addon.Media.BG_TEXTURE = "Interface\\AddOns\\RelationshipsThreatPlates\\Media\\BarBG"
|
|
addon.Media.SOLID_TEXTURE = "Interface\\Buttons\\WHITE8x8"
|
|
addon.Media.GLOW_TEXTURE = "Interface\\AddOns\\RelationshipsThreatPlates\\Media\\Glow"
|
|
addon.Media.SPARK_TEXTURE = "Interface\\AddOns\\RelationshipsThreatPlates\\Media\\Spark"
|
|
addon.Media.SHADOW_TEXTURE = "Interface\\AddOns\\RelationshipsThreatPlates\\Media\\ShadowBorder"
|
|
|
|
-- Font paths - use WoW's built-in fonts for zero-dependency
|
|
addon.Media.FONT_NORMAL = "Fonts\\FRIZQT__.TTF"
|
|
addon.Media.FONT_OUTLINE = "Fonts\\FRIZQT__.TTF"
|
|
|
|
-- Kui-style colour palette
|
|
addon.Media.COLOURS = {
|
|
-- Threat gradient: green -> yellow -> orange -> red
|
|
THREAT_LOW = { r = 0.33, g = 0.80, b = 0.33 },
|
|
THREAT_MEDIUM = { r = 1.00, g = 0.85, b = 0.00 },
|
|
THREAT_HIGH = { r = 1.00, g = 0.50, b = 0.00 },
|
|
THREAT_AGGRO = { r = 1.00, g = 0.10, b = 0.10 },
|
|
|
|
-- Kui-style background
|
|
BG_DARK = { r = 0.06, g = 0.06, b = 0.06, a = 0.90 },
|
|
|
|
-- Kui-style border glow colours
|
|
GLOW_TARGET = { r = 0.30, g = 0.70, b = 1.00, a = 0.60 },
|
|
GLOW_THREAT = { r = 0.90, g = 0.00, b = 0.00, a = 0.60 },
|
|
GLOW_SHADOW = { r = 0.00, g = 0.00, b = 0.00, a = 0.20 },
|
|
|
|
-- Text
|
|
TEXT_WHITE = { r = 1.00, g = 1.00, b = 1.00 },
|
|
TEXT_SHADOW = { r = 0.00, g = 0.00, b = 0.00, a = 1.00 },
|
|
|
|
-- GUI
|
|
GUI_BG = { r = 0.10, g = 0.10, b = 0.10, a = 0.95 },
|
|
GUI_BORDER = { r = 0.30, g = 0.30, b = 0.30, a = 1.00 },
|
|
GUI_HEADER = { r = 0.15, g = 0.15, b = 0.15, a = 1.00 },
|
|
GUI_ACCENT = { r = 0.30, g = 0.70, b = 1.00, a = 1.00 },
|
|
}
|
|
|
|
-- ==================================================================
|
|
-- Helper: brighten a colour by a factor (Kui-style)
|
|
-- ==================================================================
|
|
function addon.Media.Brighten(factor, r, g, b, a)
|
|
factor = factor or 0.3
|
|
if type(r) == "table" then
|
|
r, g, b, a = unpack(r)
|
|
end
|
|
a = a or 1
|
|
return math.min(1, r + (1 - r) * factor),
|
|
math.min(1, g + (1 - g) * factor),
|
|
math.min(1, b + (1 - b) * factor),
|
|
a
|
|
end
|
|
|
|
-- ==================================================================
|
|
-- Helper: get smooth interpolated threat colour
|
|
-- ==================================================================
|
|
function addon.Media.GetThreatColour(pct)
|
|
pct = tonumber(pct) or 0
|
|
pct = math.min(100, math.max(0, pct))
|
|
|
|
local c = addon.Media.COLOURS
|
|
local r, g, b
|
|
|
|
if pct < 50 then
|
|
local t = pct / 50
|
|
r = c.THREAT_LOW.r + (c.THREAT_MEDIUM.r - c.THREAT_LOW.r) * t
|
|
g = c.THREAT_LOW.g + (c.THREAT_MEDIUM.g - c.THREAT_LOW.g) * t
|
|
b = c.THREAT_LOW.b + (c.THREAT_MEDIUM.b - c.THREAT_LOW.b) * t
|
|
elseif pct < 80 then
|
|
local t = (pct - 50) / 30
|
|
r = c.THREAT_MEDIUM.r + (c.THREAT_HIGH.r - c.THREAT_MEDIUM.r) * t
|
|
g = c.THREAT_MEDIUM.g + (c.THREAT_HIGH.g - c.THREAT_MEDIUM.g) * t
|
|
b = c.THREAT_MEDIUM.b + (c.THREAT_HIGH.b - c.THREAT_MEDIUM.b) * t
|
|
else
|
|
local t = (pct - 80) / 20
|
|
t = math.min(1, math.max(0, t))
|
|
r = c.THREAT_HIGH.r + (c.THREAT_AGGRO.r - c.THREAT_HIGH.r) * t
|
|
g = c.THREAT_HIGH.g + (c.THREAT_AGGRO.g - c.THREAT_HIGH.g) * t
|
|
b = c.THREAT_HIGH.b + (c.THREAT_AGGRO.b - c.THREAT_HIGH.b) * t
|
|
end
|
|
|
|
return r, g, b
|
|
end
|
|
|
|
-- ==================================================================
|
|
-- Generate media textures as file data (using solid fallback)
|
|
-- These are created in the Media/ folder by the installer script
|
|
-- but we also provide runtime fallback generation
|
|
-- ==================================================================
|
|
function addon.Media.EnsureTextures()
|
|
-- Ensure the media directory textures exist
|
|
-- For standalone deployment, we use Blizzard built-in textures
|
|
-- with vertex colouring to achieve the Kui look
|
|
--
|
|
-- The bar texture is handled via WHITE8x8 with vertex colour
|
|
-- This gives the same clean flat look as Kui's procedural bar
|
|
|
|
addon.Media.BAR_TEXTURE = addon.Media.SOLID_TEXTURE
|
|
addon.Media.BG_TEXTURE = addon.Media.SOLID_TEXTURE
|
|
addon.Media.GLOW_TEXTURE = addon.Media.SOLID_TEXTURE
|
|
addon.Media.SPARK_TEXTURE = addon.Media.SOLID_TEXTURE
|
|
end
|