From 67717e1fe87a98e107ec0e8c0d934837aada78ad Mon Sep 17 00:00:00 2001 From: Gogo1951 <55365231+Gogo1951@users.noreply.github.com> Date: Sat, 16 Nov 2024 16:54:37 -0600 Subject: [PATCH] Update TFTB.lua --- TFTB.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/TFTB.lua b/TFTB.lua index bfa4d06..59084eb 100644 --- a/TFTB.lua +++ b/TFTB.lua @@ -30,6 +30,17 @@ local function clearExpiredCooldowns(now) end end +-- Check if a player is in your party or raid +local function isInPartyOrRaid(sourceGUID) + for i = 1, GetNumGroupMembers() do + local unitID = IsInRaid() and "raid" .. i or "party" .. i + if UnitGUID(unitID) == sourceGUID then + return true + end + end + return false +end + function BuffCheerAddon:shouldProcessEvent() return not self.state.hasLoggedIn and not self.state.inCombat end @@ -49,6 +60,11 @@ function BuffCheerAddon:OnCombatEvent(...) clearExpiredCooldowns(now) if destGUID == UnitGUID("player") and sourceGUID ~= UnitGUID("player") then + -- Check if the source is in the same party or raid + if isInPartyOrRaid(sourceGUID) then + return -- Skip thanking party/raid members + end + if not self.thankCooldown[sourceGUID] then self.thankCooldown[sourceGUID] = now + self.config.cooldownDuration local emote = self.config.randomEmotes[math.random(1, #self.config.randomEmotes)]