feat(Scripts/Commands): deserter add now also kicks from bg or group (#24451)

This commit is contained in:
sogladev
2026-01-20 23:49:09 +01:00
committed by GitHub
parent d5b59552e2
commit 253eb1997a
2 changed files with 13 additions and 5 deletions

View File

@@ -1642,12 +1642,9 @@ void Player::ProcessDelayedOperations()
if (m_DelayedOperations & DELAYED_SAVE_PLAYER)
SaveToDB(false, false);
if (m_DelayedOperations & DELAYED_SPELL_CAST_DESERTER)
{
Aura* aura = GetAura(26013);
if (!aura || aura->GetDuration() <= 900000)
if ((m_DelayedOperations & DELAYED_SPELL_CAST_DESERTER)
&& !GetAura(26013))
CastSpell(this, 26013, true);
}
if (m_DelayedOperations & DELAYED_BG_MOUNT_RESTORE)
{

View File

@@ -24,6 +24,7 @@
#include "Chat.h"
#include "CommandScript.h"
#include "GroupMgr.h"
#include "Language.h"
#include "Player.h"
#include "SpellAuras.h"
@@ -211,6 +212,16 @@ public:
CharacterDatabase.Execute(stmt);
}
if (isInstance)
{
if (ObjectGuid groupId = sCharacterCache->GetCharacterGroupGuidByGuid(guid))
if (Group* group = sGroupMgr->GetGroupByGUID(groupId.GetCounter()))
if (group->isLFGGroup())
Player::RemoveFromGroup(group, guid);
}
else if (target && target->GetMap()->IsBattleground())
target->LeaveBattleground();
handler->PSendSysMessage("{} of {} Deserter has been added to player {}.", secsToTimeString(duration), isInstance ? "Instance" : "Battleground", handler->playerLink(*playerName));
return true;
}