From 760d8992b6f42a6a0a8eb5302462c06f4f76d806 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sat, 27 Jun 2026 18:54:04 -0500 Subject: [PATCH] switch group-membership checks to IsInGroup / IsInRaid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ClassicAPI ships modern IsInGroup() / IsInRaid() backports — drop the GetNumPartyMembers() > 0 and GetNumRaidMembers() > 0 idioms (and the GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0 conflation) for the named-intent variants. UnitInRaid("player") → IsInRaid() at the same sites. --- api/unitframes.lua | 10 +++++----- libs/libpredict.lua | 12 ++++++------ modules/innervatecall.lua | 4 ++-- modules/mapcolors.lua | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/api/unitframes.lua b/api/unitframes.lua index a4931a95..2f949ee5 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -305,12 +305,12 @@ function pfUI.uf:UpdateVisibility() local id = self.cache_raid -- always show self in raidframes - if not UnitInRaid("player") and GetNumPartyMembers() == 0 and C.unitframes.selfinraid == "1" and id == 1 then + if not IsInRaid() and IsInGroup() and C.unitframes.selfinraid == "1" and id == 1 then self.id = "" self.label = "player" -- use raidframes for groups - elseif not UnitInRaid("player") and GetNumPartyMembers() > 0 and C.unitframes.raidforgroup == "1" then + elseif not IsInRaid() and IsInGroup() and C.unitframes.raidforgroup == "1" then if id == 1 then self.id = "" self.label = "player" @@ -347,12 +347,12 @@ function pfUI.uf:UpdateVisibility() -- frame shall not be visible visibility = "hide" self.visible = nil - elseif C["unitframes"]["group"]["hide_in_raid"] == "1" and self.label and strsub(self.label,0,5) == "party" and UnitInRaid("player") then + elseif C["unitframes"]["group"]["hide_in_raid"] == "1" and self.label and strsub(self.label,0,5) == "party" and IsInRaid() then -- hide group while in raid and option is set visibility = "hide" self.visible = nil elseif ( self.fname == "Group0" or self.fname == "PartyPet0" or self.fname == "Party0Target" ) - and (GetNumPartyMembers() <= 0 or (C["unitframes"]["group"]["hide_in_raid"] == "1" and UnitInRaid("player"))) then + and (not IsInGroup() or (C["unitframes"]["group"]["hide_in_raid"] == "1" and IsInRaid())) then -- hide self in group if solo or hide in raid is set visibility = "hide" self.visible = nil @@ -1773,7 +1773,7 @@ function pfUI.uf:RefreshIndicators(unit) local unitstr = unit.label .. unit.id if unit.leaderIcon then -- Leader Icon - if unit.config.leadericon == "1" and UnitIsPartyLeader(unitstr) and ( GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0 ) then + if unit.config.leadericon == "1" and UnitIsPartyLeader(unitstr) and IsInGroup() then unit.leaderIcon:Show() else unit.leaderIcon:Hide() diff --git a/libs/libpredict.lua b/libs/libpredict.lua index 587c89aa..df143dd1 100644 --- a/libs/libpredict.lua +++ b/libs/libpredict.lua @@ -366,9 +366,9 @@ pfUI.libdebuff_spell_go_hooks["libpredict"] = function(spellId, a1, a2, a3, a4, local rankStr = tostring(rank) if libpredict.sender and libpredict.sender.SendHealCommMsg then libpredict.sender:SendHealCommMsg(hotType .. "/" .. targetName .. "/" .. duration .. "/" .. rankStr .. "/") - elseif GetNumRaidMembers() > 0 then + elseif IsInRaid() then SendAddonMessage("HealComm", hotType .. "/" .. targetName .. "/" .. duration .. "/" .. rankStr .. "/", "RAID") - elseif GetNumPartyMembers() > 0 then + elseif IsInGroup() then SendAddonMessage("HealComm", hotType .. "/" .. targetName .. "/" .. duration .. "/" .. rankStr .. "/", "PARTY") end end @@ -1083,10 +1083,10 @@ libpredict.sender = CreateFrame("Frame", "pfPredictionSender", UIParent) libpredict.sender.enabled = true libpredict.sender.SendHealCommMsg = function(self, msg) -- Smart channel selection: Only send to relevant channel to avoid duplicates - if GetNumRaidMembers() > 0 then + if IsInRaid() then -- In raid: Only send to RAID (includes all raid members) SendAddonMessage("HealComm", msg, "RAID") - elseif GetNumPartyMembers() > 0 then + elseif IsInGroup() then -- In party: Only send to PARTY SendAddonMessage("HealComm", msg, "PARTY") end @@ -1095,10 +1095,10 @@ libpredict.sender.SendHealCommMsg = function(self, msg) end libpredict.sender.SendResCommMsg = function(self, msg) -- Smart channel selection: Only send to relevant channel to avoid duplicates - if GetNumRaidMembers() > 0 then + if IsInRaid() then -- In raid: Only send to RAID (includes all raid members) SendAddonMessage("CTRA", msg, "RAID") - elseif GetNumPartyMembers() > 0 then + elseif IsInGroup() then -- In party: Only send to PARTY SendAddonMessage("CTRA", msg, "PARTY") end diff --git a/modules/innervatecall.lua b/modules/innervatecall.lua index 8e448b42..f6f44fa3 100644 --- a/modules/innervatecall.lua +++ b/modules/innervatecall.lua @@ -39,11 +39,11 @@ pfUI:RegisterModule("innervatecall", function () return "BATTLEGROUND" end - if GetNumRaidMembers() > 0 then + if IsInRaid() then return "RAID" end - if GetNumPartyMembers() > 0 then + if IsInGroup() then return "PARTY" end diff --git a/modules/mapcolors.lua b/modules/mapcolors.lua index 41ae099d..f85eab87 100644 --- a/modules/mapcolors.lua +++ b/modules/mapcolors.lua @@ -50,7 +50,7 @@ pfUI:RegisterModule("mapcolors", function () end local function UpdateUnitFrames(unit_button_name) - if GetNumRaidMembers() > 0 then + if IsInRaid() then for i=1, MAX_RAID_MEMBERS do local frame_name = unit_button_name.."Raid"..i local frame = _G[frame_name] @@ -68,7 +68,7 @@ pfUI:RegisterModule("mapcolors", function () end end end - elseif GetNumPartyMembers() > 0 then + elseif IsInGroup() then for i=1, MAX_PARTY_MEMBERS do local frame_name = unit_button_name.."Party"..i local frame = _G[frame_name]