mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[7250] Use bg type ids enum insted raw values and catch some bugs in result for fixing.
* Replace max bg type checks by DBC valid index check * Use in functions and fields BattlegroundTypeId type instead uint32 * Fixed wrong use bg queue ids instead bg type ids in queue update/remove function calls. Many bg have same raw values for type id and queue id but some can be affected by this bug: BATTLEGROUND_EY, BATTLEGROUND_SA, and all areans (with small arena/team size exceptions) * Move Battlemaster to bg type ids map fron ObjectMgr to BatteleGroundMgr. * Remobe redundent for header itself includes for BG headers. * Use Auction location enum instead raw valus.
This commit is contained in:
parent
e355084376
commit
5a4358dda9
29 changed files with 319 additions and 262 deletions
|
|
@ -51,7 +51,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
|
|||
// Stop the npc if moving
|
||||
unit->StopMoving();
|
||||
|
||||
uint32 bgTypeId = objmgr.GetBattleMasterBG(unit->GetEntry());
|
||||
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(unit->GetEntry());
|
||||
|
||||
if(!_player->GetBGAccessByLevel(bgTypeId))
|
||||
{
|
||||
|
|
@ -63,7 +63,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
|
|||
SendBattlegGroundList(guid, bgTypeId);
|
||||
}
|
||||
|
||||
void WorldSession::SendBattlegGroundList( uint64 guid, uint32 bgTypeId )
|
||||
void WorldSession::SendBattlegGroundList( uint64 guid, BattleGroundTypeId bgTypeId )
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundListPacket(&data, guid, _player, bgTypeId);
|
||||
|
|
@ -75,22 +75,24 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
CHECK_PACKET_SIZE(recv_data, 8+4+4+1);
|
||||
|
||||
uint64 guid;
|
||||
uint32 bgTypeId;
|
||||
uint32 bgTypeId_;
|
||||
uint32 instanceId;
|
||||
uint8 joinAsGroup;
|
||||
Group * grp;
|
||||
|
||||
recv_data >> guid; // battlemaster guid
|
||||
recv_data >> bgTypeId; // battleground type id (DBC id)
|
||||
recv_data >> bgTypeId_; // battleground type id (DBC id)
|
||||
recv_data >> instanceId; // instance id, 0 if First Available selected
|
||||
recv_data >> joinAsGroup; // join as group
|
||||
|
||||
if(bgTypeId >= MAX_BATTLEGROUND_TYPES)
|
||||
if(!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype received. possible cheater? player guid %u",_player->GetGUIDLow());
|
||||
sLog.outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u",bgTypeId_,_player->GetGUIDLow());
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_);
|
||||
|
||||
sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from: " I64FMT, guid);
|
||||
|
||||
// can do this, since it's battleground, not arena
|
||||
|
|
@ -272,19 +274,15 @@ void WorldSession::HandleBattleGroundListOpcode( WorldPacket &recv_data )
|
|||
uint32 bgTypeId;
|
||||
recv_data >> bgTypeId; // id from DBC
|
||||
|
||||
if(bgTypeId >= MAX_BATTLEGROUND_TYPES)
|
||||
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
if(!bl)
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype received.");
|
||||
return;
|
||||
}
|
||||
|
||||
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
|
||||
if(!bl)
|
||||
return;
|
||||
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundListPacket(&data, _player->GetGUID(), _player, bgTypeId);
|
||||
sBattleGroundMgr.BuildBattleGroundListPacket(&data, _player->GetGUID(), _player, BattleGroundTypeId(bgTypeId));
|
||||
SendPacket( &data );
|
||||
}
|
||||
|
||||
|
|
@ -297,15 +295,15 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
uint8 type; // arenatype if arena
|
||||
uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||
uint32 instanceId;
|
||||
uint32 bgTypeId; // type id from dbc
|
||||
uint32 bgTypeId_; // type id from dbc
|
||||
uint16 unk; // 0x1F90 constant?
|
||||
uint8 action; // enter battle 0x1, leave queue 0x0
|
||||
|
||||
recv_data >> type >> unk2 >> bgTypeId >> unk >> action;
|
||||
recv_data >> type >> unk2 >> bgTypeId_ >> unk >> action;
|
||||
|
||||
if(bgTypeId >= MAX_BATTLEGROUND_TYPES)
|
||||
if(!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype received.");
|
||||
sLog.outError("Battleground: invalid bgtype (%u) received.",bgTypeId_);
|
||||
// update battleground slots for the player to fix his UI and sent data.
|
||||
// this is a HACK, I don't know why the client starts sending invalid packets in the first place.
|
||||
// it usually happens with extremely high latency (if debugging / stepping in the code for example)
|
||||
|
|
@ -329,7 +327,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
BattleGround * bg = NULL;
|
||||
|
||||
// get possibly needed data from groupinfo
|
||||
bgTypeId = itrPlayerStatus->second.GroupInfo->BgTypeId;
|
||||
BattleGroundTypeId bgTypeId = itrPlayerStatus->second.GroupInfo->BgTypeId;
|
||||
uint8 arenatype = itrPlayerStatus->second.GroupInfo->ArenaType;
|
||||
uint8 israted = itrPlayerStatus->second.GroupInfo->IsRated;
|
||||
uint8 status = 0;
|
||||
|
|
@ -365,6 +363,8 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_);
|
||||
|
||||
uint32 bgQueueTypeId = 0;
|
||||
// get the bg what we were invited to
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus;
|
||||
|
|
@ -393,7 +393,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
|
||||
if(!bg)
|
||||
{
|
||||
sLog.outError("Battleground: bg not found.");
|
||||
sLog.outError("Battleground: bg not found for type id %u.",bgTypeId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -570,7 +570,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
uint32 queue_id = _player->GetBattleGroundQueueId(i);
|
||||
if(!queue_id)
|
||||
continue;
|
||||
uint32 bgTypeId = BattleGroundMgr::BGTemplateId(queue_id);
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(queue_id);
|
||||
uint8 arenatype = BattleGroundMgr::BGArenaType(queue_id);
|
||||
uint8 isRated = 0;
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
|
|
@ -698,7 +698,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
uint8 bgTypeId = bg->GetTypeID();
|
||||
BattleGroundTypeId bgTypeId = bg->GetTypeID();
|
||||
uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||
|
||||
// check queueing conditions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue