Core/ArenaTeam: Use full captain guid instead of low guid on team creation and some code cleanup

This commit is contained in:
Spp-
2011-09-09 13:05:51 +02:00
parent 7a9cb4fdc7
commit c4c9165428
6 changed files with 74 additions and 83 deletions
@@ -246,7 +246,6 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_data*/)
{
// empty opcode
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
Battleground *bg = _player->GetBattleground();
@@ -256,56 +255,49 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_
switch(bg->GetTypeID(true))
{
case BATTLEGROUND_WS:
{
uint32 count = 0;
Player* aplr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetAllianceFlagPickerGUID());
if (aplr)
++count;
Player* hplr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetHordeFlagPickerGUID());
if (hplr)
++count;
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * count);
data << 0;
data << count;
if (aplr)
{
uint32 count1 = 0; //always constant zero?
uint32 count2 = 0; //count of next fields
Player *ali_plr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetAllianceFlagPickerGUID());
if (ali_plr)
++count2;
Player *horde_plr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetHordeFlagPickerGUID());
if (horde_plr)
++count2;
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2));
data << count1; // alliance flag holders count - obsolete, now always 0
/*for (uint8 i = 0; i < count1; ++i)
{
data << uint64(0); // guid
data << (float)0; // x
data << (float)0; // y
}*/
data << count2; // horde flag holders count - obsolete, now count of next fields
if (ali_plr)
{
data << (uint64)ali_plr->GetGUID();
data << (float)ali_plr->GetPositionX();
data << (float)ali_plr->GetPositionY();
}
if (horde_plr)
{
data << (uint64)horde_plr->GetGUID();
data << (float)horde_plr->GetPositionX();
data << (float)horde_plr->GetPositionY();
}
SendPacket(&data);
data << uint64(aplr->GetGUID());
data << float(aplr->GetPositionX());
data << float(aplr->GetPositionY());
}
if (hplr)
{
data << uint64(hplr->GetGUID());
data << float(hplr->GetPositionX());
data << float(hplr->GetPositionY());
}
SendPacket(&data);
break;
}
case BATTLEGROUND_EY:
//TODO : fix me!
break;
case BATTLEGROUND_AB:
case BATTLEGROUND_AV:
{
//for other BG types - send default
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4));
data << uint32(0);
data << uint32(0);
SendPacket(&data);
}
{
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4));
data << uint32(0);
data << uint32(0);
SendPacket(&data);
break;
}
default:
//maybe it is sent also in arena - do nothing
break;
@@ -835,7 +835,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
// Create arena team
ArenaTeam* arenaTeam = new ArenaTeam();
if (!arenaTeam->Create(GUID_LOPART(_player->GetGUID()), type, name, background, icon, iconcolor, border, bordercolor))
if (!arenaTeam->Create(_player->GetGUID(), type, name, background, icon, iconcolor, border, bordercolor))
{
delete arenaTeam;
return;