AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
BGQueueRemoveEvent Class Reference

#include "BattlegroundQueue.h"

Inheritance diagram for BGQueueRemoveEvent:
BasicEvent

Public Member Functions

 BGQueueRemoveEvent (ObjectGuid pl_guid, uint32 bgInstanceGUID, BattlegroundTypeId BgTypeId, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
 
 ~BGQueueRemoveEvent () override=default
 
bool Execute (uint64 e_time, uint32 p_time) override
 
void Abort (uint64 e_time) override
 
- Public Member Functions inherited from BasicEvent
 BasicEvent ()=default
 
virtual ~BasicEvent ()=default
 
virtual bool Execute (uint64, uint32)
 
virtual bool IsDeletable () const
 
virtual void Abort (uint64)
 
void ScheduleAbort ()
 

Private Attributes

ObjectGuid m_PlayerGuid
 
uint32 m_BgInstanceGUID
 
uint32 m_RemoveTime
 
BattlegroundTypeId m_BgTypeId
 
BattlegroundQueueTypeId m_BgQueueTypeId
 

Detailed Description

Constructor & Destructor Documentation

◆ BGQueueRemoveEvent()

BGQueueRemoveEvent::BGQueueRemoveEvent ( ObjectGuid  pl_guid,
uint32  bgInstanceGUID,
BattlegroundTypeId  BgTypeId,
BattlegroundQueueTypeId  bgQueueTypeId,
uint32  removeTime 
)
inline
172 :
173 m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId) { }
uint32 m_RemoveTime
Definition: BattlegroundQueue.h:182
uint32 m_BgInstanceGUID
Definition: BattlegroundQueue.h:181
BattlegroundTypeId m_BgTypeId
Definition: BattlegroundQueue.h:183
ObjectGuid m_PlayerGuid
Definition: BattlegroundQueue.h:180
BattlegroundQueueTypeId m_BgQueueTypeId
Definition: BattlegroundQueue.h:184

◆ ~BGQueueRemoveEvent()

BGQueueRemoveEvent::~BGQueueRemoveEvent ( )
overridedefault

Member Function Documentation

◆ Abort()

void BGQueueRemoveEvent::Abort ( uint64  e_time)
overridevirtual

Reimplemented from BasicEvent.

1379{
1380 //do nothing
1381}

◆ Execute()

bool BGQueueRemoveEvent::Execute ( uint64  e_time,
uint32  p_time 
)
overridevirtual

Reimplemented from BasicEvent.

1327{
1329
1330 // player logged off, so he is no longer in queue
1331 if (!player)
1332 return true;
1333
1335
1336 // battleground can be already deleted, bg may be nullptr!
1337
1338 // check if still in queue for this battleground
1340 if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
1341 {
1342 // confirm the player is invited to this instance id (he didn't requeue in the meanwhile)
1343 BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(m_BgQueueTypeId);
1345 {
1346 // track if player leaves the BG by not clicking enter button
1347 if (bg && bg->isBattleground() && (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
1348 {
1349 if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS))
1350 {
1352 stmt->SetData(0, player->GetGUID().GetCounter());
1354 CharacterDatabase.Execute(stmt);
1355 }
1356
1357 sScriptMgr->OnBattlegroundDesertion(player, BG_DESERTION_TYPE_NO_ENTER_BUTTON);
1358 }
1359
1360 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);
1361
1363 bgQueue.RemovePlayer(m_PlayerGuid, true);
1364
1365 //update queues if battleground isn't ended
1366 if (bg && bg->isBattleground() && bg->GetStatus() != STATUS_WAIT_LEAVE)
1367 sBattlegroundMgr->ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId());
1368
1369 WorldPacket data;
1370 sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL);
1371 player->SendDirectMessage(&data);
1372 }
1373 }
1374
1375 return true;
1376}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:168
std::uint32_t uint32
Definition: Define.h:107
#define sScriptMgr
Definition: ScriptMgr.h:708
@ BG_DESERTION_TYPE_NO_ENTER_BUTTON
Definition: Battleground.h:53
@ STATUS_NONE
Definition: Battleground.h:194
@ STATUS_WAIT_LEAVE
Definition: Battleground.h:198
@ STATUS_WAIT_JOIN
Definition: Battleground.h:196
@ STATUS_IN_PROGRESS
Definition: Battleground.h:197
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:188
@ CONFIG_BATTLEGROUND_TRACK_DESERTERS
Definition: IWorld.h:121
@ CHAR_INS_DESERTER_TRACK
Definition: CharacterDatabase.h:499
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
#define PLAYER_MAX_BATTLEGROUND_QUEUES
Definition: SharedDefines.h:176
#define sWorld
Definition: World.h:444
Player * FindConnectedPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:260
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
Definition: Battleground.h:298
bool isBattleground() const
Definition: Battleground.h:397
BattlegroundStatus GetStatus() const
Definition: Battleground.h:327
BattlegroundBracketId GetBracketId() const
Definition: Battleground.h:325
Definition: BattlegroundQueue.h:64
bool IsPlayerInvited(ObjectGuid pl_guid, uint32 bgInstanceGuid, uint32 removeTime)
Definition: BattlegroundQueue.cpp:377
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
Definition: BattlegroundQueue.cpp:259
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
LowType GetCounter() const
Definition: ObjectGuid.h:145
std::string ToString() const
Definition: ObjectGuid.cpp:47
Definition: Player.h:1064
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5692
void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val)
Definition: Player.cpp:12264
uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const
Definition: Player.cpp:12217
Definition: WorldPacket.h:27

References BG_DESERTION_TYPE_NO_ENTER_BUTTON, CHAR_INS_DESERTER_TRACK, CharacterDatabase, CONFIG_BATTLEGROUND_TRACK_DESERTERS, ObjectAccessor::FindConnectedPlayer(), Player::GetBattlegroundQueueIndex(), Battleground::GetBracketId(), ObjectGuid::GetCounter(), Object::GetGUID(), Battleground::GetStatus(), Battleground::isBattleground(), BattlegroundQueue::IsPlayerInvited(), LOG_DEBUG, PLAYER_MAX_BATTLEGROUND_QUEUES, Player::RemoveBattlegroundQueueId(), BattlegroundQueue::RemovePlayer(), sBattlegroundMgr, Player::SendDirectMessage(), PreparedStatementBase::SetData(), sScriptMgr, STATUS_IN_PROGRESS, STATUS_NONE, STATUS_WAIT_JOIN, STATUS_WAIT_LEAVE, sWorld, TEAM_NEUTRAL, and ObjectGuid::ToString().

Member Data Documentation

◆ m_BgInstanceGUID

uint32 BGQueueRemoveEvent::m_BgInstanceGUID
private

◆ m_BgQueueTypeId

BattlegroundQueueTypeId BGQueueRemoveEvent::m_BgQueueTypeId
private

◆ m_BgTypeId

BattlegroundTypeId BGQueueRemoveEvent::m_BgTypeId
private

◆ m_PlayerGuid

ObjectGuid BGQueueRemoveEvent::m_PlayerGuid
private

◆ m_RemoveTime

uint32 BGQueueRemoveEvent::m_RemoveTime
private