mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 11:10:00 +00:00
move away from RAID_CLASS_COLORS dependency
This commit is contained in:
+1
-1
@@ -227,7 +227,7 @@ end
|
||||
-- return: [table] string, r, g, b
|
||||
function pfUI.api.GetUnitColor(unitstr)
|
||||
local _, class = UnitClass(unitstr)
|
||||
local classColor = RAID_CLASS_COLORS[class]
|
||||
local classColor = PFUI_CLASS_COLORS[class]
|
||||
return classColor:GenerateHexColorMarkup(), classColor:GetRGB()
|
||||
end
|
||||
|
||||
|
||||
+3
-3
@@ -139,7 +139,7 @@ end
|
||||
|
||||
do -- dropdown
|
||||
local _, class = UnitClass("player")
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
local color = PFUI_CLASS_COLORS[class]
|
||||
|
||||
local function ListEntryOnShow()
|
||||
if this.parent.id == this.id then
|
||||
@@ -734,7 +734,7 @@ function pfUI.api.SkinRotateButton(button)
|
||||
pfUI.api.CreateBackdrop(button)
|
||||
|
||||
local _, class = UnitClass("player")
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
local color = PFUI_CLASS_COLORS[class]
|
||||
local cr, cg, cb = color.r , color.g, color.b
|
||||
|
||||
button:SetWidth(button:GetWidth() - 18)
|
||||
@@ -939,7 +939,7 @@ function pfUI.api.SkinDropDown(frame, cr, cg, cb, useSmall)
|
||||
|
||||
if not cr or not cg or not cb then
|
||||
local _, class = UnitClass("player")
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
local color = PFUI_CLASS_COLORS[class]
|
||||
cr, cg, cb = color.r , color.g, color.b
|
||||
end
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ pfUI:RegisterModule("afkcam", function ()
|
||||
local class = GetUnitData(arg2 or "")
|
||||
local author, msg
|
||||
if class and class ~= UNKNOWN then
|
||||
local class_color = RAID_CLASS_COLORS[class]:GenerateHexColorMarkup()
|
||||
local class_color = PFUI_CLASS_COLORS[class]:GenerateHexColorMarkup()
|
||||
author = string.format("%s%s|r",class_color,arg2)
|
||||
else
|
||||
author = arg2
|
||||
|
||||
+3
-2
@@ -430,7 +430,8 @@ pfUI:RegisterModule("chat", function ()
|
||||
end
|
||||
|
||||
local _, class = UnitClass("player")
|
||||
_G["ChatFrame" .. i .. "TabText"]:SetTextColor((RAID_CLASS_COLORS[class].r + .3) * .5, (RAID_CLASS_COLORS[class].g + .3) * .5, (RAID_CLASS_COLORS[class].b + .3) * .5, 1)
|
||||
local classColor = PFUI_CLASS_COLORS[class]
|
||||
_G["ChatFrame" .. i .. "TabText"]:SetTextColor((classColor.r + .3) * .5, (classColor.g + .3) * .5, (classColor.b + .3) * .5, 1)
|
||||
_G["ChatFrame" .. i .. "TabText"]:SetFont(panelfont,panelfont_size, "OUTLINE")
|
||||
|
||||
if _G["ChatFrame" .. i].isDocked or _G["ChatFrame" .. i]:IsVisible() then
|
||||
@@ -766,7 +767,7 @@ pfUI:RegisterModule("chat", function ()
|
||||
end
|
||||
if class then
|
||||
if class ~= UNKNOWN then
|
||||
color = "|c" .. RAID_CLASS_COLORS[class].colorStr
|
||||
color = "|c" .. PFUI_CLASS_COLORS[class].colorStr
|
||||
match = true
|
||||
end
|
||||
elseif C.chat.text.whosearchunknown == "1" then
|
||||
|
||||
+6
-12
@@ -267,10 +267,8 @@ pfUI:RegisterModule("loot", function ()
|
||||
info = wipe(info)
|
||||
info.text = lclass
|
||||
info.textR, info.textG, info.textB = .7,.7,.7
|
||||
if class and RAID_CLASS_COLORS[class] then
|
||||
info.textR = RAID_CLASS_COLORS[class].r
|
||||
info.textG = RAID_CLASS_COLORS[class].g
|
||||
info.textB = RAID_CLASS_COLORS[class].b
|
||||
if class and PFUI_CLASS_COLORS[class] then
|
||||
info.textR, info.textG, info.textB = PFUI_CLASS_COLORS[class]:GetRGB()
|
||||
end
|
||||
info.textHeight = 12
|
||||
info.hasArrow = 1
|
||||
@@ -290,10 +288,8 @@ pfUI:RegisterModule("loot", function ()
|
||||
info = wipe(info)
|
||||
info.text = candidate
|
||||
info.textR, info.textG, info.textB = .7,.7,.7
|
||||
if UIDROPDOWNMENU_MENU_VALUE and RAID_CLASS_COLORS[UIDROPDOWNMENU_MENU_VALUE] then
|
||||
info.textR = RAID_CLASS_COLORS[UIDROPDOWNMENU_MENU_VALUE].r
|
||||
info.textG = RAID_CLASS_COLORS[UIDROPDOWNMENU_MENU_VALUE].g
|
||||
info.textB = RAID_CLASS_COLORS[UIDROPDOWNMENU_MENU_VALUE].b
|
||||
if UIDROPDOWNMENU_MENU_VALUE and PFUI_CLASS_COLORS[UIDROPDOWNMENU_MENU_VALUE] then
|
||||
info.textR, info.textG, info.textB = PFUI_CLASS_COLORS[UIDROPDOWNMENU_MENU_VALUE]:GetRGB()
|
||||
end
|
||||
info.textHeight = 12
|
||||
info.value = name_to_index[candidate]
|
||||
@@ -314,10 +310,8 @@ pfUI:RegisterModule("loot", function ()
|
||||
local unit = GroupInfoByName(candidate,"party")
|
||||
info.text = candidate
|
||||
info.textR, info.textG, info.textB = .7,.7,.7
|
||||
if unit.class and RAID_CLASS_COLORS[unit.class] then
|
||||
info.textR = RAID_CLASS_COLORS[unit.class].r
|
||||
info.textG = RAID_CLASS_COLORS[unit.class].g
|
||||
info.textB = RAID_CLASS_COLORS[unit.class].b
|
||||
if unit.class and PFUI_CLASS_COLORS[unit.class] then
|
||||
info.textR, info.textG, info.textB = PFUI_CLASS_COLORS[unit.class]:GetRGB()
|
||||
end
|
||||
info.textHeight = 12
|
||||
info.value = i
|
||||
|
||||
@@ -86,7 +86,7 @@ pfUI:RegisterModule("mapcolors", function ()
|
||||
|
||||
local function ColorizeName(frame)
|
||||
local _, class = UnitClass(frame.unit)
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
local color = PFUI_CLASS_COLORS[class]
|
||||
frame.name = frame.name or UnitName(frame.unit)
|
||||
frame.name = '|c'..color.colorStr..frame.name..'|r'
|
||||
end
|
||||
|
||||
@@ -1215,9 +1215,9 @@ end
|
||||
|
||||
if class then
|
||||
if unittype == "ENEMY_PLAYER" and C.nameplates["enemyclassc"] == "1" then
|
||||
r, g, b, a = RAID_CLASS_COLORS[class]:GetRGBA()
|
||||
r, g, b, a = PFUI_CLASS_COLORS[class]:GetRGBA()
|
||||
elseif unittype == "FRIENDLY_PLAYER" and C.nameplates["friendclassc"] == "1" then
|
||||
r, g, b, a = RAID_CLASS_COLORS[class]:GetRGBA()
|
||||
r, g, b, a = PFUI_CLASS_COLORS[class]:GetRGBA()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1239,7 +1239,7 @@ end
|
||||
plate.cache.r, plate.cache.g, plate.cache.b = r, g, b
|
||||
end
|
||||
|
||||
if r + g + b ~= plate.cache.namecolor and unittype == "FRIENDLY_PLAYER" and C.nameplates["friendclassnamec"] == "1" and class and RAID_CLASS_COLORS[class] then
|
||||
if r + g + b ~= plate.cache.namecolor and unittype == "FRIENDLY_PLAYER" and C.nameplates["friendclassnamec"] == "1" and class and PFUI_CLASS_COLORS[class] then
|
||||
plate.name:SetTextColor(r, g, b, a)
|
||||
plate.cache.namecolor = r + g + b
|
||||
end
|
||||
|
||||
+2
-2
@@ -315,7 +315,7 @@ pfUI:RegisterModule("panel", function()
|
||||
GameTooltip:AddLine("|cff555555" .. T["Friends Online"])
|
||||
init = true
|
||||
end
|
||||
local ccolor = RAID_CLASS_COLORS[L["class"][friend_class]] or { 1, 1, 1 }
|
||||
local ccolor = PFUI_CLASS_COLORS[L["class"][friend_class]] or { 1, 1, 1 }
|
||||
local lcolor = GetDifficultyColor(tonumber(friend_level)) or { 1, 1, 1 }
|
||||
local zcolor = friend_area == playerzone and "|cff33ffcc" or "|cffcccccc"
|
||||
GameTooltip:AddDoubleLine(rgbhex(ccolor) .. friend_name .. rgbhex(lcolor) .. " [" .. friend_level .. "]", zcolor .. friend_area)
|
||||
@@ -375,7 +375,7 @@ pfUI:RegisterModule("panel", function()
|
||||
init = true
|
||||
end
|
||||
|
||||
local ccolor = RAID_CLASS_COLORS[L["class"][class]] or { 1, 1, 1 }
|
||||
local ccolor = PFUI_CLASS_COLORS[L["class"][class]] or { 1, 1, 1 }
|
||||
local lcolor = GetDifficultyColor(tonumber(level)) or { 1, 1, 1 }
|
||||
local level = "|cff555555" .. "[" .. rgbhex(lcolor) .. level .. "|cff555555]"
|
||||
local raid = raidparty[name] and "|cff555555[|cff33ffccG|cff555555]|r" or ""
|
||||
|
||||
@@ -19,7 +19,7 @@ pfUI:RegisterModule("socialmod", function ()
|
||||
|
||||
if name then
|
||||
if class then
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
local color = PFUI_CLASS_COLORS[class]
|
||||
local classicon = _G["GuildFrameButton"..i].classicon
|
||||
local coords = CLASS_ICON_TCOORDS[class]
|
||||
|
||||
@@ -86,7 +86,7 @@ pfUI:RegisterModule("socialmod", function ()
|
||||
|
||||
if connected then
|
||||
if not class or class == _G.UNKNOWN then break end
|
||||
local ccolor = RAID_CLASS_COLORS[L["class"][class]] or { 1, 1, 1 }
|
||||
local ccolor = PFUI_CLASS_COLORS[L["class"][class]] or { 1, 1, 1 }
|
||||
local lcolor = GetDifficultyColor(tonumber(level)) or { 1, 1, 1 }
|
||||
|
||||
zone = ( zone == playerzone and "|cffffffff" or "|cffcccccc" ) .. zone .. "|r"
|
||||
@@ -172,7 +172,7 @@ pfUI:RegisterModule("socialmod", function ()
|
||||
if class then
|
||||
local classicon = _G["WhoFrameButton"..i].classicon
|
||||
local coords = CLASS_ICON_TCOORDS[class]
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
local color = PFUI_CLASS_COLORS[class]
|
||||
|
||||
-- do we have classicons? (skin enabled?)
|
||||
if classicon then
|
||||
|
||||
@@ -531,9 +531,9 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
|
||||
|
||||
-- replace wim class colors with pfUI ones
|
||||
hooksecurefunc("WIM_InitClassProps", function()
|
||||
for class in pairs(RAID_CLASS_COLORS) do
|
||||
for class in pairs(PFUI_CLASS_COLORS) do
|
||||
local wimclass = _G[format("WIM_LOCALIZED_%s",class)]
|
||||
local colorstr = "|c" .. RAID_CLASS_COLORS[class].colorStr
|
||||
local colorstr = "|c" .. PFUI_CLASS_COLORS[class].colorStr
|
||||
_G.WIM_ClassColors[wimclass] = gsub(colorstr, "^|cff", "")
|
||||
end
|
||||
end)
|
||||
|
||||
+2
-2
@@ -200,7 +200,7 @@ pfUI:RegisterModule("tooltip", function ()
|
||||
|
||||
if name then
|
||||
if UnitIsPlayer(unit) and class then
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
local color = PFUI_CLASS_COLORS[class]
|
||||
GameTooltipStatusBar:SetStatusBarColor_orig(color:GetRGB())
|
||||
GameTooltip:SetBackdropBorderColor(color:GetRGB())
|
||||
GameTooltipTextLeft1:SetText("|c" .. color.colorStr .. name)
|
||||
@@ -229,7 +229,7 @@ pfUI:RegisterModule("tooltip", function ()
|
||||
local _, targetClass = UnitClass(unit .. "target")
|
||||
local targetReaction = UnitReaction("player",unit .. "target")
|
||||
if UnitIsPlayer(unit .. "target") and targetClass then
|
||||
local color = RAID_CLASS_COLORS[targetClass]
|
||||
local color = PFUI_CLASS_COLORS[targetClass]
|
||||
GameTooltip:AddLine(target, color.r, color.g, color.b)
|
||||
elseif targetReaction then
|
||||
local color = UnitReactionColor[targetReaction]
|
||||
|
||||
@@ -37,8 +37,7 @@ if not CLASSIC_API_VERSION or CLASSIC_API_VERSION < PFUI_CLASSIC_API_MIN then
|
||||
alertFrame:RegisterEvent("PLAYER_LOGIN")
|
||||
alertFrame:SetScript("OnEvent", function()
|
||||
StaticPopupDialogs["PFUI_CLASSICAPI_REQUIRED"] = {
|
||||
text = "This fork of |cff33ffccpf|cffffffffUI|r requires ClassicAPI\n v1.2.0 or newer.\n\n"
|
||||
.. "All |cff33ffccpf|cffffffffUI|r modules have been disabled.\nInstall ClassicAPI from:",
|
||||
text = "This fork of |cff33ffccpf|cffffffffUI|r requires ClassicAPI\n v1.2.0 or newer.\n\nAll |cff33ffccpf|cffffffffUI|r modules have been disabled.\nInstall ClassicAPI from:",
|
||||
button1 = OKAY,
|
||||
hasEditBox = 1,
|
||||
editBoxWidth = 280,
|
||||
@@ -58,8 +57,7 @@ if not CLASSIC_API_VERSION or CLASSIC_API_VERSION < PFUI_CLASSIC_API_MIN then
|
||||
StaticPopup_Show("PFUI_CLASSICAPI_REQUIRED")
|
||||
if DEFAULT_CHAT_FRAME then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
"This fork of pfUI requires ClassicAPI v1.2.0+. Get it at "
|
||||
.. "https://github.com/brues-code/ClassicAPI",
|
||||
"This fork of pfUI requires ClassicAPI v1.2.0+. Get it at https://github.com/brues-code/ClassicAPI",
|
||||
1, 0.3, 0.3
|
||||
)
|
||||
end
|
||||
@@ -129,23 +127,26 @@ pfUI.client = client or 11200
|
||||
-- setup pfUI namespace
|
||||
setmetatable(pfUI.env, {__index = getfenv(0)})
|
||||
|
||||
function pfUI:UpdateColors()
|
||||
-- update table to get unknown colors and blue shamans for vanilla
|
||||
RAID_CLASS_COLORS = {
|
||||
["WARRIOR"] = { r = 0.78, g = 0.61, b = 0.43, colorStr = "ffc79c6e" },
|
||||
["MAGE"] = { r = 0.41, g = 0.8, b = 0.94, colorStr = "ff69ccf0" },
|
||||
["ROGUE"] = { r = 1, g = 0.96, b = 0.41, colorStr = "fffff569" },
|
||||
["DRUID"] = { r = 1, g = 0.49, b = 0.04, colorStr = "ffff7d0a" },
|
||||
["HUNTER"] = { r = 0.67, g = 0.83, b = 0.45, colorStr = "ffabd473" },
|
||||
["SHAMAN"] = { r = 0.14, g = 0.35, b = 1.0, colorStr = "ff0070de" },
|
||||
["PRIEST"] = { r = 1, g = 1, b = 1, colorStr = "ffffffff" },
|
||||
["WARLOCK"] = { r = 0.58, g = 0.51, b = 0.79, colorStr = "ff9482c9" },
|
||||
["PALADIN"] = { r = 0.96, g = 0.55, b = 0.73, colorStr = "fff58cba" },
|
||||
}
|
||||
PFUI_CLASS_COLORS = setmetatable({
|
||||
WARRIOR = { r = 0.78, g = 0.61, b = 0.43 },
|
||||
MAGE = { r = 0.25, g = 0.78, b = 0.92 },
|
||||
ROGUE = { r = 1, g = 0.96, b = 0.41 },
|
||||
DRUID = { r = 1, g = 0.49, b = 0.04 },
|
||||
HUNTER = { r = 0.67, g = 0.83, b = 0.45 },
|
||||
SHAMAN = { r = 0, g = 0.44, b = 0.87 },
|
||||
PRIEST = { r = 1, g = 1, b = 1 },
|
||||
WARLOCK = { r = 0.53, g = 0.53, b = 0.93 },
|
||||
PALADIN = { r = 0.96, g = 0.55, b = 0.73 },
|
||||
}, { __index = function(t,k)
|
||||
local unknownColor = CreateColor(0.6, 0.6, 0.6, 1)
|
||||
unknownColor.colorStr = unknownColor:GenerateHexColor()
|
||||
return unknownColor
|
||||
end})
|
||||
|
||||
RAID_CLASS_COLORS = setmetatable(RAID_CLASS_COLORS, { __index = function(tab,key)
|
||||
return { r = 0.6, g = 0.6, b = 0.6, colorStr = "ff999999" }
|
||||
end})
|
||||
for _, classColor in pairs(PFUI_CLASS_COLORS) do
|
||||
Mixin(classColor, ColorMixin)
|
||||
classColor.a = 1
|
||||
classColor.colorStr = classColor:GenerateHexColor()
|
||||
end
|
||||
|
||||
function pfUI:UpdateFonts()
|
||||
@@ -381,9 +382,6 @@ end
|
||||
pfUI:SetScript("OnEvent", function()
|
||||
if pfUI.disabled then return end
|
||||
|
||||
-- enforce color updates on each event
|
||||
pfUI:UpdateColors()
|
||||
|
||||
-- make sure to initialize and set our fonts
|
||||
-- each time an addon got loaded but only
|
||||
-- when the config is already accessible
|
||||
|
||||
@@ -106,7 +106,7 @@ pfUI:RegisterSkin("Options - New", function ()
|
||||
btn:SetBackdropColor(br, bg, bb, 0.75)
|
||||
btn:SetBackdropBorderColor(er, eg, eb, 1)
|
||||
local _, class = UnitClass("player")
|
||||
local color = RAID_CLASS_COLORS[class]
|
||||
local color = PFUI_CLASS_COLORS[class]
|
||||
SetHighlight(btn, color.r, color.g, color.b)
|
||||
btn:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")
|
||||
HookScript(btn, "OnMouseDown", function()
|
||||
|
||||
Reference in New Issue
Block a user