Skip to content

Commit

Permalink
Correctly remove paladins on leaving group in non-English locales (PR #9
Browse files Browse the repository at this point in the history
)
  • Loading branch information
SaschaJankowiak authored Jul 20, 2022
1 parent b52f1ce commit e2aa992
Showing 1 changed file with 35 additions and 34 deletions.
69 changes: 35 additions & 34 deletions PallyPower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ do
end

PallyPower.Credits1 = "PallyPower - by Aznamir (Lightbringer US)"
PallyPower.Credits2 = "Updated for Classic by Dyaxler, Es, and gallantron"
PallyPower.Credits2 = "Updated for Classic by Dyaxler, Es, gallantron and irregularly by Zid"

function PallyPower:Debug(s)
if (PP_DebugEnabled) then
Expand Down Expand Up @@ -174,7 +174,6 @@ function PallyPower:OnEnable()
self:ScanSpells()
self:ScanCooldowns()
self:RegisterEvent("CHAT_MSG_ADDON")
self:RegisterEvent("CHAT_MSG_SYSTEM")
self:RegisterEvent("ZONE_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
Expand All @@ -186,6 +185,7 @@ function PallyPower:OnEnable()
self:RegisterBucketEvent("SPELLS_CHANGED", 1, "SPELLS_CHANGED")
self:RegisterBucketEvent("PLAYER_ENTERING_WORLD", 2, "PLAYER_ENTERING_WORLD")
self:RegisterBucketEvent({"GROUP_ROSTER_UPDATE", "PLAYER_REGEN_ENABLED", "UNIT_PET", "UNIT_AURA"}, 1, "UpdateRoster")
self:RegisterBucketEvent({"GROUP_ROSTER_UPDATE"}, 1, "UpdateAllPallys")
if isPally then
self:ScheduleRepeatingTimer(self.ScanInventory, 60, self)
self.ButtonsUpdate(self)
Expand Down Expand Up @@ -1613,43 +1613,44 @@ function PallyPower:GROUP_LEFT(event)
self:UpdateRoster()
end

function PallyPower:CHAT_MSG_SYSTEM(event, text)
function PallyPower:UpdateAllPallys()
if not initialized then
return
end
if text then
if strfind(text, "leaves the party.") or strfind(text, "has left the raid group") or strfind(text, "has left the instance group.") then
local _, _, pname = strfind(text, "(.+) leaves the party.")
local _, _, rname = strfind(text, "(.+) has left the raid group")
local _, _, bgname = strfind(text, "(.+) has left the instance group.")
local playerName
if pname then
playerName = pname
elseif rname then
playerName = rname
elseif bgname then
playerName = bgname
end
for name in pairs(AllPallys) do
if name == playerName then
C_Timer.After(
2.0,
function()
AllPallys = {}
SyncList = {}
self:ScanSpells()
self:ScanCooldowns()
self:ScanInventory()
self:SendSelf()
self:SendMessage("REQ")
self:UpdateLayout()
self:UpdateRoster()
end
)
end
end

local units
if IsInRaid() then
units = raid_units
else
units = party_units
end

local countAllPallys = 0
for _ in pairs(AllPallys) do countAllPallys = countAllPallys + 1 end

local found = 0
for _, unitid in pairs(units) do
if unitid and (not unitid:find("pet")) and UnitExists(unitid) then
if AllPallys[GetUnitName(unitid, true)] then found = found + 1 end
end
end

if found < countAllPallys then -- Zid: if AllPallys count is reduced do a fresh setup
C_Timer.After(
0.5,
function()
AllPallys = {}
SyncList = {}
self:ScanSpells()
self:ScanCooldowns()
self:ScanInventory()
self:SendSelf()
self:SendMessage("REQ")
self:UpdateLayout()
self:UpdateRoster()
end
)
end
end

function PallyPower:UNIT_SPELLCAST_SUCCEEDED(event, unitTarget, castGUID, spellID)
Expand Down

0 comments on commit e2aa992

Please sign in to comment.