mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 06:06:23 +00:00
feat(Scripts/Commands): deserter add now also kicks from bg or group (#24451)
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user