Use UnitClassBase for class detection

This commit is contained in:
Brues
2026-07-30 01:26:29 -05:00
parent 838f7f5d25
commit 6d1bfe805e
16 changed files with 22 additions and 24 deletions
+1 -1
View File
@@ -231,7 +231,7 @@ end
-- unit [string] the unitstring
-- return: [table] string, r, g, b
function pfUI.api.GetUnitColor(unitstr)
local _, class = UnitClass(unitstr)
local class = UnitClassBase(unitstr)
local classColor = PFUI_CLASS_COLORS[class]
return classColor:GenerateHexColorMarkup(), classColor:GetRGB()
end
+5 -5
View File
@@ -1519,7 +1519,7 @@ function pfUI.uf:RefreshIndicators(unit)
end
if unit.happinessIcon and unit:GetName() == "pfPet" then -- Happiness Icon
local _, pclass = UnitClass("player")
local pclass = UnitClassBase("player")
if unit.config.happinessicon == "0" or pclass ~= "HUNTER" then
unit.happinessIcon:Hide()
else
@@ -1563,7 +1563,7 @@ function pfUI.uf:UpdateDruidMana(unit)
local unitstr = unit.label .. unit.id
if not UnitExists(unitstr) then bar:Hide() return end
if unit.label ~= "player" then
local _, cls = UnitClass(unitstr)
local cls = UnitClassBase(unitstr)
if cls ~= "DRUID" then bar:Hide() return end
end
if UnitPowerType(unitstr) == Enum.PowerType.Mana then bar:Hide() return end
@@ -2217,7 +2217,7 @@ function pfUI.uf:ClickAction(button)
-- drop food on petframe
if label == "pet" and CursorHasItem() then
local _, playerClass = UnitClass("player")
local playerClass = UnitClassBase("player")
if playerClass == "HUNTER" then
DropItemOnUnit("pet")
return
@@ -2327,7 +2327,7 @@ function pfUI.uf:HideIcon(frame, pos)
end
function pfUI.uf:SetupDebuffFilter(allclasses)
local _, myclass = UnitClass("player")
local myclass = UnitClassBase("player")
local debuffs = {}
if myclass == "PALADIN" or myclass == "PRIEST" or myclass == "WARLOCK" or allclasses then
@@ -2350,7 +2350,7 @@ function pfUI.uf:SetupDebuffFilter(allclasses)
end
function pfUI.uf:SetupBuffIndicators(config)
local _, myclass = UnitClass("player")
local myclass = UnitClassBase("player")
local indicators = {}
if config.show_buffs == "1" then -- buffs
+1 -2
View File
@@ -29,8 +29,7 @@ if GetLocale() == "ruRU" then
end
local libdebuff = CreateFrame("Frame", "pfdebuffsScanner", UIParent)
local _, class = UnitClass("player")
local lastspell
local class = UnitClassBase("player")
-- Nampower Support
local hasNampower = false
+1 -1
View File
@@ -1,5 +1,5 @@
pfUI:RegisterModule("actionbar", function ()
local _, class = UnitClass("player")
local class = UnitClassBase("player")
local _, cr, cg, cb = GetUnitColor('player')
local er, eg, eb, ea = GetStringColor(pfUI_config.appearance.border.color)
+1 -1
View File
@@ -429,7 +429,7 @@ pfUI:RegisterModule("chat", function ()
_G["ChatFrame" .. i .. "TabFlash"].Show = function() return end
end
local _, class = UnitClass("player")
local class = UnitClassBase("player")
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")
+1 -1
View File
@@ -5,7 +5,7 @@ pfUI:RegisterModule("combopoints", function ()
ComboFrame:Hide()
ComboFrame:UnregisterAllEvents()
local _, class = UnitClass("player")
local class = UnitClassBase("player")
local combo_width = C["unitframes"]["combowidth"]
local combo_height = C["unitframes"]["comboheight"]
pfUI.combopoints = {}
+1 -1
View File
@@ -2,7 +2,7 @@ local function getAdjustedTickTimer()
local adjustedEnergyTick = 2
-- Check rogue talents and compute energy tick timing reduction for Combat spec (1.18.0 Blade Rush Talent)
if UnitClass("player") == "Rogue" then
if UnitClassBase("player") == "ROGUE" then
local _, _, _, _, currRank = GetTalentInfo(2, 16)
local bladeRushRank = currRank or 0
+1 -1
View File
@@ -1,5 +1,5 @@
pfUI:RegisterModule("hunterbar", function ()
local _,class = UnitClass("player")
local class = UnitClassBase("player")
if class ~= "HUNTER" or C.bars.hunterbar == "0" then return end
-- Wing Clip (any rank) and Arcane Shot (any rank) spell IDs.
+1 -2
View File
@@ -7,8 +7,7 @@ pfUI:RegisterModule("innervatecall", function ()
if not GetNampowerVersion then return end
-- Only load for druids
local _, playerClass = UnitClass("player")
if playerClass ~= "DRUID" then return end
if UnitClassBase("player") ~= "DRUID" then return end
local INNERVATE_SPELLID = 29166
+1 -1
View File
@@ -85,7 +85,7 @@ pfUI:RegisterModule("mapcolors", function ()
end
local function ColorizeName(frame)
local _, class = UnitClass(frame.unit)
local class = UnitClassBase(frame.unit)
local color = PFUI_CLASS_COLORS[class]
frame.name = frame.name or UnitName(frame.unit)
frame.name = '|c'..color.colorStr..frame.name..'|r'
+1 -1
View File
@@ -34,7 +34,7 @@ pfUI:RegisterModule("player", function ()
playerFrame.infoTopCenterText:SetHeight(14)
end
local _, myclass = UnitClass("player")
local myclass = UnitClassBase("player")
playerFrame.myclass = myclass
playerFrame.isSpellCaster = myclass ~= "WARRIOR" and myclass ~= "ROGUE" and myclass ~= "HUNTER"
+2 -2
View File
@@ -82,7 +82,7 @@ pfUI:RegisterModule("swingtimer", function ()
local ohR, ohG, ohB, ohA = ParseColor(C.unitframes.swingtimerohcolor, 0.3, 0.8, 0.3, 1)
local raR, raG, raB, raA = ParseColor(C.unitframes.swingtimerrangedcolor, 0.3, 0.6, 1.0, 1)
local rwR, rwG, rwB, rwA = ParseColor(C.unitframes.swingtimerrangedwarncolor, 0.9, 0.0, 0.0, 1)
local isHunter = UnitClass("player") == "Hunter"
local isHunter = UnitClassBase("player") == "HUNTER"
local mhDefaultR, mhDefaultG, mhDefaultB = mhR, mhG, mhB
@@ -908,7 +908,7 @@ pfUI:RegisterModule("swingtimer", function ()
S.autoAttackActive = false
elseif event == "PLAYER_ENTERING_WORLD" then
local _, class = UnitClass("player")
local class = UnitClassBase("player")
S.isWarrior = (class == "WARRIOR")
S.isDruid = (class == "DRUID")
UpdateWeaponSpeeds()
+2 -2
View File
@@ -201,7 +201,7 @@ pfUI:RegisterModule("tooltip", function ()
local pvpname = UnitPVPName(unit)
local name = UnitName(unit)
local validTarget, target = pcall(UnitName, unit .. 'target')
local _, class = UnitClass(unit)
local class = UnitClassBase(unit)
local guild, rankstr, rankid = GetGuildInfo(unit)
local reaction = UnitReaction(unit, "player")
local pvptitle = gsub(gsub(pvpname or name, name, "", 1), "^%s*(.-)%s*$", "%1")
@@ -236,7 +236,7 @@ pfUI:RegisterModule("tooltip", function ()
end
if validTarget and target then
local _, targetClass = UnitClass(unit .. "target")
local targetClass = UnitClassBase(unit .. "target")
local targetReaction = UnitReaction("player",unit .. "target")
if UnitIsPlayer(unit .. "target") and targetClass then
local color = PFUI_CLASS_COLORS[targetClass]
+1 -1
View File
@@ -128,7 +128,7 @@ pfUI:RegisterModule("tracking", function ()
end)
function pfUI.tracking:RefreshSpells()
local _, playerClass = UnitClass("player")
local playerClass = UnitClassBase("player")
local isCatForm = pfUI.tracking:PlayerIsDruidInCatForm(playerClass)
-- Build set of valid SpellIDs for this class
+1 -1
View File
@@ -309,7 +309,7 @@ function pfUI:CheckNewModules()
pfUI_init.seen_modules = pfUI_init.seen_modules or {}
local pending = 0
local _, playerClass = UnitClass("player")
local playerClass = UnitClassBase("player")
for _, entry in pairs(pfUI.new_modules) do
if not pfUI_init.seen_modules[entry.name] and pfUI_init["finalize"] then
if not entry.class or entry.class == playerClass then
+1 -1
View File
@@ -105,7 +105,7 @@ pfUI:RegisterSkin("Options - New", function ()
local er, eg, eb = pfUI.api.GetStringColor(pfUI_config.appearance.border.color)
btn:SetBackdropColor(br, bg, bb, 0.75)
btn:SetBackdropBorderColor(er, eg, eb, 1)
local _, class = UnitClass("player")
local class = UnitClassBase("player")
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")