mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +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)
|
if (m_DelayedOperations & DELAYED_SAVE_PLAYER)
|
||||||
SaveToDB(false, false);
|
SaveToDB(false, false);
|
||||||
|
|
||||||
if (m_DelayedOperations & DELAYED_SPELL_CAST_DESERTER)
|
if ((m_DelayedOperations & DELAYED_SPELL_CAST_DESERTER)
|
||||||
{
|
&& !GetAura(26013))
|
||||||
Aura* aura = GetAura(26013);
|
|
||||||
if (!aura || aura->GetDuration() <= 900000)
|
|
||||||
CastSpell(this, 26013, true);
|
CastSpell(this, 26013, true);
|
||||||
}
|
|
||||||
|
|
||||||
if (m_DelayedOperations & DELAYED_BG_MOUNT_RESTORE)
|
if (m_DelayedOperations & DELAYED_BG_MOUNT_RESTORE)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "CommandScript.h"
|
#include "CommandScript.h"
|
||||||
|
#include "GroupMgr.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "SpellAuras.h"
|
#include "SpellAuras.h"
|
||||||
@@ -211,6 +212,16 @@ public:
|
|||||||
CharacterDatabase.Execute(stmt);
|
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));
|
handler->PSendSysMessage("{} of {} Deserter has been added to player {}.", secsToTimeString(duration), isInstance ? "Instance" : "Battleground", handler->playerLink(*playerName));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user