Core/Battlegrounds: Minor cleanup
This commit is contained in:
@@ -163,13 +163,15 @@ void BattlegroundMgr::Update(uint32 diff)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battleground *bg, Player * pPlayer, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 /*uiFrame*/)
|
void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battleground *bg, Player * player, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 /*uiFrame*/)
|
||||||
{
|
{
|
||||||
if (!bg)
|
ObjectGuid playerGuid = player->GetGUID();
|
||||||
StatusID = STATUS_NONE;
|
ObjectGuid bgGuid;
|
||||||
|
|
||||||
ObjectGuid guidBytes1 = pPlayer->GetGUID();
|
if (bg)
|
||||||
ObjectGuid guidBytes2 = bg->GetGUID();
|
bgGuid = bg->GetGUID();
|
||||||
|
else
|
||||||
|
StatusID = STATUS_NONE;
|
||||||
|
|
||||||
switch (StatusID)
|
switch (StatusID)
|
||||||
{
|
{
|
||||||
@@ -177,82 +179,82 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro
|
|||||||
{
|
{
|
||||||
data->Initialize(SMSG_BATTLEFIELD_STATUS);
|
data->Initialize(SMSG_BATTLEFIELD_STATUS);
|
||||||
|
|
||||||
data->WriteBit(guidBytes1[0]);
|
data->WriteBit(playerGuid[0]);
|
||||||
data->WriteBit(guidBytes1[4]);
|
data->WriteBit(playerGuid[4]);
|
||||||
data->WriteBit(guidBytes1[7]);
|
data->WriteBit(playerGuid[7]);
|
||||||
data->WriteBit(guidBytes1[1]);
|
data->WriteBit(playerGuid[1]);
|
||||||
data->WriteBit(guidBytes1[6]);
|
data->WriteBit(playerGuid[6]);
|
||||||
data->WriteBit(guidBytes1[3]);
|
data->WriteBit(playerGuid[3]);
|
||||||
data->WriteBit(guidBytes1[5]);
|
data->WriteBit(playerGuid[5]);
|
||||||
data->WriteBit(guidBytes1[2]);
|
data->WriteBit(playerGuid[2]);
|
||||||
|
|
||||||
data->FlushBits();
|
data->FlushBits();
|
||||||
|
|
||||||
data->WriteByteSeq(guidBytes1[5]);
|
data->WriteByteSeq(playerGuid[5]);
|
||||||
data->WriteByteSeq(guidBytes1[6]);
|
data->WriteByteSeq(playerGuid[6]);
|
||||||
data->WriteByteSeq(guidBytes1[7]);
|
data->WriteByteSeq(playerGuid[7]);
|
||||||
data->WriteByteSeq(guidBytes1[2]);
|
data->WriteByteSeq(playerGuid[2]);
|
||||||
*data << uint32(1); // unk, always 1
|
*data << uint32(1); // unk, always 1
|
||||||
data->WriteByteSeq(guidBytes1[3]);
|
data->WriteByteSeq(playerGuid[3]);
|
||||||
data->WriteByteSeq(guidBytes1[1]);
|
data->WriteByteSeq(playerGuid[1]);
|
||||||
*data << uint32(QueueSlot); // Queue slot
|
*data << uint32(QueueSlot); // Queue slot
|
||||||
*data << uint32(Time1); // Join Time
|
*data << uint32(Time1); // Join Time
|
||||||
data->WriteByteSeq(guidBytes1[0]);
|
data->WriteByteSeq(playerGuid[0]);
|
||||||
data->WriteByteSeq(guidBytes1[4]);
|
data->WriteByteSeq(playerGuid[4]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STATUS_WAIT_QUEUE:
|
case STATUS_WAIT_QUEUE:
|
||||||
{
|
{
|
||||||
data->Initialize(SMSG_BATTLEFIELD_STATUS_QUEUED);
|
data->Initialize(SMSG_BATTLEFIELD_STATUS_QUEUED);
|
||||||
|
|
||||||
data->WriteBit(guidBytes1[3]);
|
data->WriteBit(playerGuid[3]);
|
||||||
data->WriteBit(guidBytes1[0]);
|
data->WriteBit(playerGuid[0]);
|
||||||
data->WriteBit(guidBytes2[3]);
|
data->WriteBit(bgGuid[3]);
|
||||||
data->WriteBit(guidBytes1[2]);
|
data->WriteBit(playerGuid[2]);
|
||||||
data->WriteBit(1); // Eligible In Queue
|
data->WriteBit(1); // Eligible In Queue
|
||||||
data->WriteBit(0); // Join Failed
|
data->WriteBit(0); // Join Failed
|
||||||
data->WriteBit(guidBytes2[2]);
|
data->WriteBit(bgGuid[2]);
|
||||||
data->WriteBit(guidBytes1[1]);
|
data->WriteBit(playerGuid[1]);
|
||||||
data->WriteBit(guidBytes2[0]);
|
data->WriteBit(bgGuid[0]);
|
||||||
data->WriteBit(guidBytes2[6]);
|
data->WriteBit(bgGuid[6]);
|
||||||
data->WriteBit(guidBytes2[4]);
|
data->WriteBit(bgGuid[4]);
|
||||||
data->WriteBit(guidBytes1[6]);
|
data->WriteBit(playerGuid[6]);
|
||||||
data->WriteBit(guidBytes1[7]);
|
data->WriteBit(playerGuid[7]);
|
||||||
data->WriteBit(guidBytes2[7]);
|
data->WriteBit(bgGuid[7]);
|
||||||
data->WriteBit(guidBytes2[5]);
|
data->WriteBit(bgGuid[5]);
|
||||||
data->WriteBit(guidBytes1[4]);
|
data->WriteBit(playerGuid[4]);
|
||||||
data->WriteBit(guidBytes1[5]);
|
data->WriteBit(playerGuid[5]);
|
||||||
data->WriteBit(bg->isRated()); // Is Rated
|
data->WriteBit(bg->isRated()); // Is Rated
|
||||||
data->WriteBit(0); // Waiting On Other Activity
|
data->WriteBit(0); // Waiting On Other Activity
|
||||||
data->WriteBit(guidBytes2[1]);
|
data->WriteBit(bgGuid[1]);
|
||||||
|
|
||||||
data->FlushBits();
|
data->FlushBits();
|
||||||
|
|
||||||
data->WriteByteSeq(guidBytes1[0]);
|
data->WriteByteSeq(playerGuid[0]);
|
||||||
*data << uint32(1); // unk, always 1
|
*data << uint32(1); // unk, always 1
|
||||||
data->WriteByteSeq(guidBytes2[5]);
|
data->WriteByteSeq(bgGuid[5]);
|
||||||
data->WriteByteSeq(guidBytes1[3]);
|
data->WriteByteSeq(playerGuid[3]);
|
||||||
*data << uint32(Time1); // Estimated Wait Time
|
*data << uint32(Time1); // Estimated Wait Time
|
||||||
data->WriteByteSeq(guidBytes2[7]);
|
data->WriteByteSeq(bgGuid[7]);
|
||||||
data->WriteByteSeq(guidBytes2[1]);
|
data->WriteByteSeq(bgGuid[1]);
|
||||||
data->WriteByteSeq(guidBytes2[2]);
|
data->WriteByteSeq(bgGuid[2]);
|
||||||
*data << uint8(0); // unk
|
*data << uint8(0); // unk
|
||||||
data->WriteByteSeq(guidBytes2[4]);
|
data->WriteByteSeq(bgGuid[4]);
|
||||||
data->WriteByteSeq(guidBytes1[2]);
|
data->WriteByteSeq(playerGuid[2]);
|
||||||
*data << uint8(0); // Player count in rated mode
|
*data << uint8(0); // Player count in rated mode
|
||||||
data->WriteByteSeq(guidBytes2[6]);
|
data->WriteByteSeq(bgGuid[6]);
|
||||||
data->WriteByteSeq(guidBytes1[7]);
|
data->WriteByteSeq(playerGuid[7]);
|
||||||
data->WriteByteSeq(guidBytes2[3]);
|
data->WriteByteSeq(bgGuid[3]);
|
||||||
data->WriteByteSeq(guidBytes1[6]);
|
data->WriteByteSeq(playerGuid[6]);
|
||||||
data->WriteByteSeq(guidBytes2[0]);
|
data->WriteByteSeq(bgGuid[0]);
|
||||||
*data << uint32(Time2); // Join Time
|
*data << uint32(Time2); // Join Time
|
||||||
*data << uint32(QueueSlot); // Queue slot
|
*data << uint32(QueueSlot); // Queue slot
|
||||||
*data << uint8(bg->GetMinLevel()); // Min Level
|
*data << uint8(bg->GetMinLevel()); // Min Level
|
||||||
*data << uint32(GetMSTimeDiffToNow(Time2)); // Time since joined
|
*data << uint32(GetMSTimeDiffToNow(Time2)); // Time since joined
|
||||||
data->WriteByteSeq(guidBytes1[1]);
|
data->WriteByteSeq(playerGuid[1]);
|
||||||
data->WriteByteSeq(guidBytes1[5]);
|
data->WriteByteSeq(playerGuid[5]);
|
||||||
*data << uint32(bg->GetClientInstanceID()); // Client Instance ID
|
*data << uint32(bg->GetClientInstanceID()); // Client Instance ID
|
||||||
data->WriteByteSeq(guidBytes1[4]);
|
data->WriteByteSeq(playerGuid[4]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STATUS_WAIT_JOIN:
|
case STATUS_WAIT_JOIN:
|
||||||
@@ -269,83 +271,83 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro
|
|||||||
*data << uint32(bg->GetMapId()); // Map Id
|
*data << uint32(bg->GetMapId()); // Map Id
|
||||||
*data << uint8(0); // Player count in rated mode
|
*data << uint8(0); // Player count in rated mode
|
||||||
|
|
||||||
data->WriteBit(guidBytes1[5]);
|
data->WriteBit(playerGuid[5]);
|
||||||
data->WriteBit(guidBytes1[2]);
|
data->WriteBit(playerGuid[2]);
|
||||||
data->WriteBit(guidBytes1[1]);
|
data->WriteBit(playerGuid[1]);
|
||||||
data->WriteBit(guidBytes2[2]);
|
data->WriteBit(bgGuid[2]);
|
||||||
data->WriteBit(guidBytes1[4]);
|
data->WriteBit(playerGuid[4]);
|
||||||
data->WriteBit(guidBytes2[6]);
|
data->WriteBit(bgGuid[6]);
|
||||||
data->WriteBit(guidBytes2[3]);
|
data->WriteBit(bgGuid[3]);
|
||||||
data->WriteBit(bg->isRated()); // Is Rated
|
data->WriteBit(bg->isRated()); // Is Rated
|
||||||
data->WriteBit(guidBytes1[7]);
|
data->WriteBit(playerGuid[7]);
|
||||||
data->WriteBit(guidBytes1[3]);
|
data->WriteBit(playerGuid[3]);
|
||||||
data->WriteBit(guidBytes2[7]);
|
data->WriteBit(bgGuid[7]);
|
||||||
data->WriteBit(guidBytes2[0]);
|
data->WriteBit(bgGuid[0]);
|
||||||
data->WriteBit(guidBytes2[4]);
|
data->WriteBit(bgGuid[4]);
|
||||||
data->WriteBit(guidBytes1[6]);
|
data->WriteBit(playerGuid[6]);
|
||||||
data->WriteBit(guidBytes2[1]);
|
data->WriteBit(bgGuid[1]);
|
||||||
data->WriteBit(guidBytes2[5]);
|
data->WriteBit(bgGuid[5]);
|
||||||
data->WriteBit(guidBytes1[0]);
|
data->WriteBit(playerGuid[0]);
|
||||||
|
|
||||||
data->FlushBits();
|
data->FlushBits();
|
||||||
|
|
||||||
data->WriteByteSeq(guidBytes2[6]);
|
data->WriteByteSeq(bgGuid[6]);
|
||||||
data->WriteByteSeq(guidBytes2[5]);
|
data->WriteByteSeq(bgGuid[5]);
|
||||||
data->WriteByteSeq(guidBytes2[7]);
|
data->WriteByteSeq(bgGuid[7]);
|
||||||
data->WriteByteSeq(guidBytes2[2]);
|
data->WriteByteSeq(bgGuid[2]);
|
||||||
data->WriteByteSeq(guidBytes1[0]);
|
data->WriteByteSeq(playerGuid[0]);
|
||||||
data->WriteByteSeq(guidBytes1[7]);
|
data->WriteByteSeq(playerGuid[7]);
|
||||||
data->WriteByteSeq(guidBytes2[4]);
|
data->WriteByteSeq(bgGuid[4]);
|
||||||
data->WriteByteSeq(guidBytes1[1]);
|
data->WriteByteSeq(playerGuid[1]);
|
||||||
data->WriteByteSeq(guidBytes2[0]);
|
data->WriteByteSeq(bgGuid[0]);
|
||||||
data->WriteByteSeq(guidBytes1[4]);
|
data->WriteByteSeq(playerGuid[4]);
|
||||||
data->WriteByteSeq(guidBytes2[1]);
|
data->WriteByteSeq(bgGuid[1]);
|
||||||
data->WriteByteSeq(guidBytes1[5]);
|
data->WriteByteSeq(playerGuid[5]);
|
||||||
data->WriteByteSeq(guidBytes2[3]);
|
data->WriteByteSeq(bgGuid[3]);
|
||||||
data->WriteByteSeq(guidBytes1[6]);
|
data->WriteByteSeq(playerGuid[6]);
|
||||||
data->WriteByteSeq(guidBytes1[2]);
|
data->WriteByteSeq(playerGuid[2]);
|
||||||
data->WriteByteSeq(guidBytes1[3]);
|
data->WriteByteSeq(playerGuid[3]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STATUS_IN_PROGRESS:
|
case STATUS_IN_PROGRESS:
|
||||||
{
|
{
|
||||||
data->Initialize(SMSG_BATTLEFIELD_STATUS_ACTIVE);
|
data->Initialize(SMSG_BATTLEFIELD_STATUS_ACTIVE);
|
||||||
|
|
||||||
data->WriteBit(guidBytes1[2]);
|
data->WriteBit(playerGuid[2]);
|
||||||
data->WriteBit(guidBytes1[7]);
|
data->WriteBit(playerGuid[7]);
|
||||||
data->WriteBit(guidBytes2[7]);
|
data->WriteBit(bgGuid[7]);
|
||||||
data->WriteBit(guidBytes2[1]);
|
data->WriteBit(bgGuid[1]);
|
||||||
data->WriteBit(guidBytes1[5]);
|
data->WriteBit(playerGuid[5]);
|
||||||
data->WriteBit(bg->GetPlayerTeam(guidBytes1) == ALLIANCE); // Battlefield Faction ( 0 horde, 1 alliance )
|
data->WriteBit(player->GetBGTeam() == ALLIANCE); // Battlefield Faction ( 0 horde, 1 alliance )
|
||||||
data->WriteBit(guidBytes2[0]);
|
data->WriteBit(bgGuid[0]);
|
||||||
data->WriteBit(guidBytes1[1]);
|
data->WriteBit(playerGuid[1]);
|
||||||
data->WriteBit(guidBytes2[3]);
|
data->WriteBit(bgGuid[3]);
|
||||||
data->WriteBit(guidBytes1[6]);
|
data->WriteBit(playerGuid[6]);
|
||||||
data->WriteBit(guidBytes2[5]);
|
data->WriteBit(bgGuid[5]);
|
||||||
data->WriteBit(0); // unk, Bit 64
|
data->WriteBit(0); // unk, Bit 64
|
||||||
data->WriteBit(guidBytes1[4]);
|
data->WriteBit(playerGuid[4]);
|
||||||
data->WriteBit(guidBytes2[6]);
|
data->WriteBit(bgGuid[6]);
|
||||||
data->WriteBit(guidBytes2[4]);
|
data->WriteBit(bgGuid[4]);
|
||||||
data->WriteBit(guidBytes2[2]);
|
data->WriteBit(bgGuid[2]);
|
||||||
data->WriteBit(guidBytes1[3]);
|
data->WriteBit(playerGuid[3]);
|
||||||
data->WriteBit(guidBytes1[0]);
|
data->WriteBit(playerGuid[0]);
|
||||||
|
|
||||||
data->FlushBits();
|
data->FlushBits();
|
||||||
|
|
||||||
data->WriteByteSeq(guidBytes2[4]);
|
data->WriteByteSeq(bgGuid[4]);
|
||||||
data->WriteByteSeq(guidBytes2[5]);
|
data->WriteByteSeq(bgGuid[5]);
|
||||||
data->WriteByteSeq(guidBytes1[5]);
|
data->WriteByteSeq(playerGuid[5]);
|
||||||
data->WriteByteSeq(guidBytes2[1]);
|
data->WriteByteSeq(bgGuid[1]);
|
||||||
data->WriteByteSeq(guidBytes2[6]);
|
data->WriteByteSeq(bgGuid[6]);
|
||||||
data->WriteByteSeq(guidBytes2[3]);
|
data->WriteByteSeq(bgGuid[3]);
|
||||||
data->WriteByteSeq(guidBytes2[7]);
|
data->WriteByteSeq(bgGuid[7]);
|
||||||
data->WriteByteSeq(guidBytes1[6]);
|
data->WriteByteSeq(playerGuid[6]);
|
||||||
|
|
||||||
*data << uint32(Time1); // Join Time
|
*data << uint32(Time1); // Join Time
|
||||||
*data << uint8(arenatype); // Teamsize (0 if not arena)
|
*data << uint8(arenatype); // Teamsize (0 if not arena)
|
||||||
|
|
||||||
data->WriteByteSeq(guidBytes1[4]);
|
data->WriteByteSeq(playerGuid[4]);
|
||||||
data->WriteByteSeq(guidBytes1[1]);
|
data->WriteByteSeq(playerGuid[1]);
|
||||||
|
|
||||||
*data << uint32(QueueSlot); // Queue slot
|
*data << uint32(QueueSlot); // Queue slot
|
||||||
*data << uint8(0); // Player count in rated mode
|
*data << uint8(0); // Player count in rated mode
|
||||||
@@ -354,17 +356,17 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro
|
|||||||
*data << uint8(bg->GetMinLevel()); // Min Level
|
*data << uint8(bg->GetMinLevel()); // Min Level
|
||||||
*data << uint32(Time2); // Elapsed Time
|
*data << uint32(Time2); // Elapsed Time
|
||||||
|
|
||||||
data->WriteByteSeq(guidBytes1[2]);
|
data->WriteByteSeq(playerGuid[2]);
|
||||||
*data << uint32(getMSTimeDiff(bg->GetRemainingTime(), Time2)); // Remaining Time
|
*data << uint32(getMSTimeDiff(bg->GetRemainingTime(), Time2)); // Remaining Time
|
||||||
|
|
||||||
data->WriteByteSeq(guidBytes1[0]);
|
data->WriteByteSeq(playerGuid[0]);
|
||||||
data->WriteByteSeq(guidBytes1[3]);
|
data->WriteByteSeq(playerGuid[3]);
|
||||||
data->WriteByteSeq(guidBytes1[2]);
|
data->WriteByteSeq(playerGuid[2]);
|
||||||
|
|
||||||
*data << uint32(bg->GetClientInstanceID()); // Client Instance ID
|
*data << uint32(bg->GetClientInstanceID()); // Client Instance ID
|
||||||
|
|
||||||
data->WriteByteSeq(guidBytes2[0]);
|
data->WriteByteSeq(bgGuid[0]);
|
||||||
data->WriteByteSeq(guidBytes1[7]);
|
data->WriteByteSeq(playerGuid[7]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STATUS_WAIT_LEAVE:
|
case STATUS_WAIT_LEAVE:
|
||||||
@@ -422,7 +424,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
|||||||
data->WriteBit(guid[5]);
|
data->WriteBit(guid[5]);
|
||||||
data->WriteBit(guid[1]);
|
data->WriteBit(guid[1]);
|
||||||
data->WriteBit(guid[6]);
|
data->WriteBit(guid[6]);
|
||||||
data->WriteBit(player->GetTeam() == ALLIANCE);
|
data->WriteBit(player->GetBGTeam() == ALLIANCE);
|
||||||
data->WriteBit(guid[7]);
|
data->WriteBit(guid[7]);
|
||||||
|
|
||||||
buff << uint32(itr2->second->HealingDone); // healing done
|
buff << uint32(itr2->second->HealingDone); // healing done
|
||||||
@@ -1215,8 +1217,6 @@ void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, Batt
|
|||||||
float x, y, z, O;
|
float x, y, z, O;
|
||||||
uint32 mapid = bg->GetMapId();
|
uint32 mapid = bg->GetMapId();
|
||||||
uint32 team = player->GetBGTeam();
|
uint32 team = player->GetBGTeam();
|
||||||
if (team == 0)
|
|
||||||
team = player->GetTeam();
|
|
||||||
|
|
||||||
bg->GetTeamStartLoc(team, x, y, z, O);
|
bg->GetTeamStartLoc(team, x, y, z, O);
|
||||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Sending %s to map %u, X %f, Y %f, Z %f, O %f (bgType %u)", player->GetName(), mapid, x, y, z, O, bgTypeId);
|
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Sending %s to map %u, X %f, Y %f, Z %f, O %f (bgType %u)", player->GetName(), mapid, x, y, z, O, bgTypeId);
|
||||||
|
|||||||
Reference in New Issue
Block a user