From 6d1bfe805e68e8be94870586d394e6d006040c69 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Thu, 30 Jul 2026 01:26:29 -0500 Subject: [PATCH] Use UnitClassBase for class detection --- api/api.lua | 2 +- api/unitframes.lua | 10 +++++----- libs/libdebuff.lua | 3 +-- modules/actionbar.lua | 2 +- modules/chat.lua | 2 +- modules/combopoints.lua | 2 +- modules/energytick.lua | 2 +- modules/hunterbar.lua | 2 +- modules/innervatecall.lua | 3 +-- modules/mapcolors.lua | 2 +- modules/player.lua | 2 +- modules/swingtimer.lua | 4 ++-- modules/tooltip.lua | 4 ++-- modules/tracking.lua | 2 +- pfUI.lua | 2 +- skins/blizzard/options-new.lua | 2 +- 16 files changed, 22 insertions(+), 24 deletions(-) diff --git a/api/api.lua b/api/api.lua index 6b38c820..d3192953 100644 --- a/api/api.lua +++ b/api/api.lua @@ -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 diff --git a/api/unitframes.lua b/api/unitframes.lua index 3d629f83..8e70a6ba 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -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 diff --git a/libs/libdebuff.lua b/libs/libdebuff.lua index 851e8da7..cb43e939 100644 --- a/libs/libdebuff.lua +++ b/libs/libdebuff.lua @@ -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 diff --git a/modules/actionbar.lua b/modules/actionbar.lua index 950af601..e2173e0a 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -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) diff --git a/modules/chat.lua b/modules/chat.lua index 3987ef8f..c97aee0b 100644 --- a/modules/chat.lua +++ b/modules/chat.lua @@ -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") diff --git a/modules/combopoints.lua b/modules/combopoints.lua index fb83f710..09c52a20 100644 --- a/modules/combopoints.lua +++ b/modules/combopoints.lua @@ -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 = {} diff --git a/modules/energytick.lua b/modules/energytick.lua index adc4a36f..ad7d7fab 100644 --- a/modules/energytick.lua +++ b/modules/energytick.lua @@ -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 diff --git a/modules/hunterbar.lua b/modules/hunterbar.lua index 628e6442..9cc5cedb 100644 --- a/modules/hunterbar.lua +++ b/modules/hunterbar.lua @@ -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. diff --git a/modules/innervatecall.lua b/modules/innervatecall.lua index 893dfaad..9deddd45 100644 --- a/modules/innervatecall.lua +++ b/modules/innervatecall.lua @@ -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 diff --git a/modules/mapcolors.lua b/modules/mapcolors.lua index f85eab87..119ca2ab 100644 --- a/modules/mapcolors.lua +++ b/modules/mapcolors.lua @@ -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' diff --git a/modules/player.lua b/modules/player.lua index 98db1614..4b1d685e 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -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" diff --git a/modules/swingtimer.lua b/modules/swingtimer.lua index 84dd3592..38100f86 100644 --- a/modules/swingtimer.lua +++ b/modules/swingtimer.lua @@ -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() diff --git a/modules/tooltip.lua b/modules/tooltip.lua index 28057e95..bbcb833c 100644 --- a/modules/tooltip.lua +++ b/modules/tooltip.lua @@ -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] diff --git a/modules/tracking.lua b/modules/tracking.lua index d78c7e9c..852a440b 100644 --- a/modules/tracking.lua +++ b/modules/tracking.lua @@ -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 diff --git a/pfUI.lua b/pfUI.lua index 831f98ed..a3dfe8a5 100644 --- a/pfUI.lua +++ b/pfUI.lua @@ -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 diff --git a/skins/blizzard/options-new.lua b/skins/blizzard/options-new.lua index d99777a6..bffc0e71 100644 --- a/skins/blizzard/options-new.lua +++ b/skins/blizzard/options-new.lua @@ -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")