mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 01:23:47 +00:00
new BattlegroundDesertionTypes for hook OnBattlegroundDesertion (#20039)
* new BattlegroundDesertionTypes for hook OnBattlegroundDesertion * chore: minor improvements --------- Co-authored-by: laasker <79991768+laasker@users.noreply.github.com>
This commit is contained in:
@@ -47,11 +47,15 @@ struct GraveyardStruct;
|
||||
|
||||
enum BattlegroundDesertionType : uint8
|
||||
{
|
||||
BG_DESERTION_TYPE_LEAVE_BG = 0, // player leaves the BG
|
||||
BG_DESERTION_TYPE_OFFLINE = 1, // player is kicked from BG because offline
|
||||
BG_DESERTION_TYPE_LEAVE_QUEUE = 2, // player is invited to join and refuses to do it
|
||||
BG_DESERTION_TYPE_NO_ENTER_BUTTON = 3, // player is invited to join and do nothing (time expires)
|
||||
BG_DESERTION_TYPE_INVITE_LOGOUT = 4, // player is invited to join and logs out
|
||||
BG_DESERTION_TYPE_LEAVE_BG = 0, // player leaves the BG
|
||||
BG_DESERTION_TYPE_OFFLINE = 1, // player is kicked from BG because offline
|
||||
BG_DESERTION_TYPE_LEAVE_QUEUE = 2, // player is invited to join and refuses to do it
|
||||
BG_DESERTION_TYPE_NO_ENTER_BUTTON = 3, // player is invited to join and do nothing (time expires)
|
||||
BG_DESERTION_TYPE_INVITE_LOGOUT = 4, // player is invited to join and logs out
|
||||
ARENA_DESERTION_TYPE_LEAVE_BG = 5, // player leaves the Arena
|
||||
ARENA_DESERTION_TYPE_LEAVE_QUEUE = 6, // player is invited to join arena and refuses to do it
|
||||
ARENA_DESERTION_TYPE_NO_ENTER_BUTTON = 7, // player is invited to join arena and do nothing (time expires)
|
||||
ARENA_DESERTION_TYPE_INVITE_LOGOUT = 8, // player is invited to join arena and logs out
|
||||
};
|
||||
|
||||
enum BattlegroundMaps
|
||||
|
||||
@@ -1357,6 +1357,9 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
sScriptMgr->OnBattlegroundDesertion(player, BG_DESERTION_TYPE_NO_ENTER_BUTTON);
|
||||
}
|
||||
|
||||
if (bg && bg->isArena() && (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
sScriptMgr->OnBattlegroundDesertion(player, ARENA_DESERTION_TYPE_NO_ENTER_BUTTON);
|
||||
|
||||
LOG_DEBUG("bg.battleground", "Battleground: removing player {} from bg queue for instance {} because of not pressing enter battle in time.", player->GetGUID().ToString(), m_BgInstanceGUID);
|
||||
|
||||
player->RemoveBattlegroundQueueId(m_BgQueueTypeId);
|
||||
|
||||
@@ -11336,6 +11336,9 @@ void Player::LeaveBattleground(Battleground* bg)
|
||||
sScriptMgr->OnBattlegroundDesertion(this, BG_DESERTION_TYPE_LEAVE_BG);
|
||||
}
|
||||
|
||||
if (bg->isArena() && (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
sScriptMgr->OnBattlegroundDesertion(this, ARENA_DESERTION_TYPE_LEAVE_BG);
|
||||
|
||||
bg->RemovePlayerAtLeave(this);
|
||||
|
||||
// xinef: reset corpse reclaim time
|
||||
|
||||
@@ -580,6 +580,9 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recvData)
|
||||
|
||||
sScriptMgr->OnBattlegroundDesertion(_player, BG_DESERTION_TYPE_LEAVE_QUEUE);
|
||||
}
|
||||
|
||||
if (bg->isArena() && (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
sScriptMgr->OnBattlegroundDesertion(_player, ARENA_DESERTION_TYPE_LEAVE_QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -637,6 +637,9 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
sScriptMgr->OnBattlegroundDesertion(_player, BG_DESERTION_TYPE_INVITE_LOGOUT);
|
||||
}
|
||||
|
||||
if (bgQueueTypeId >= BATTLEGROUND_QUEUE_2v2 && bgQueueTypeId < MAX_BATTLEGROUND_QUEUE_TYPES && _player->IsInvitedForBattlegroundQueueType(bgQueueTypeId))
|
||||
sScriptMgr->OnBattlegroundDesertion(_player, ARENA_DESERTION_TYPE_INVITE_LOGOUT);
|
||||
|
||||
_player->RemoveBattlegroundQueueId(bgQueueTypeId);
|
||||
sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId).RemovePlayer(_player->GetGUID(), true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user