[12158] Fix MSG_BATTLEGROUND_PLAYER_POSITIONS in BG - Eye of the Storm

This fixes map display of flag carrier
This commit is contained in:
stfx 2012-08-30 12:47:53 +02:00 committed by Antz
parent 328a349a23
commit 975c2b1e1c
2 changed files with 46 additions and 32 deletions

View file

@ -26,6 +26,7 @@
#include "WorldSession.h" #include "WorldSession.h"
#include "Object.h" #include "Object.h"
#include "Chat.h" #include "Chat.h"
#include "BattleGroundEY.h"
#include "BattleGroundMgr.h" #include "BattleGroundMgr.h"
#include "BattleGroundWS.h" #include "BattleGroundWS.h"
#include "BattleGround.h" #include "BattleGround.h"
@ -227,55 +228,68 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket& /*recv_d
{ {
case BATTLEGROUND_WS: case BATTLEGROUND_WS:
{ {
uint32 count1 = 0; // always constant zero? uint32 flagCarrierCount = 0;
uint32 count2 = 0; // count of next fields
Player* ali_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGuid()); Player* flagCarrierAlliance = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagCarrierGuid());
if (ali_plr) if (flagCarrierAlliance)
++count2; ++flagCarrierCount;
Player* horde_plr = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGuid()); Player* flagCarrierHorde = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagCarrierGuid());
if (horde_plr) if (flagCarrierHorde)
++count2; ++flagCarrierCount;
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4 + 4 + 16 * count1 + 16 * count2)); WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * flagCarrierCount);
data << count1; // alliance flag holders count - obsolete, now always 0 data << uint32(0);
/*for(uint8 i = 0; i < count1; ++i) data << uint32(flagCarrierCount);
if (flagCarrierAlliance)
{ {
data << ObjectGuid(0); // guid data << flagCarrierAlliance->GetObjectGuid();
data << (float)0; // x data << float(flagCarrierAlliance->GetPositionX());
data << (float)0; // y data << float(flagCarrierAlliance->GetPositionY());
}*/
data << count2; // horde flag holders count - obsolete, now count of next fields
if (ali_plr)
{
data << ObjectGuid(ali_plr->GetObjectGuid());
data << float(ali_plr->GetPositionX());
data << float(ali_plr->GetPositionY());
} }
if (horde_plr) if (flagCarrierHorde)
{ {
data << ObjectGuid(horde_plr->GetObjectGuid()); data << flagCarrierHorde->GetObjectGuid();
data << float(horde_plr->GetPositionX()); data << float(flagCarrierHorde->GetPositionX());
data << float(horde_plr->GetPositionY()); data << float(flagCarrierHorde->GetPositionY());
} }
SendPacket(&data); SendPacket(&data);
}
break;
case BATTLEGROUND_EY:
// TODO : fix me!
break; break;
}
case BATTLEGROUND_EY:
{
uint32 flagCarrierCount = 0;
Player* flagCarrier = sObjectMgr.GetPlayer(((BattleGroundEY*)bg)->GetFlagCarrierGuid());
if (flagCarrier)
flagCarrierCount = 1;
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * flagCarrierCount);
data << uint32(0);
data << uint32(flagCarrierCount);
if (flagCarrier)
{
data << flagCarrier->GetObjectGuid();
data << float(flagCarrier->GetPositionX());
data << float(flagCarrier->GetPositionY());
}
SendPacket(&data);
break;
}
case BATTLEGROUND_AB: case BATTLEGROUND_AB:
case BATTLEGROUND_AV: case BATTLEGROUND_AV:
{ {
// for other BG types - send default // for other BG types - send default
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4 + 4)); WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4);
data << uint32(0); data << uint32(0);
data << uint32(0); data << uint32(0);
SendPacket(&data); SendPacket(&data);
break;
} }
break;
default: default:
// maybe it is sent also in arena - do nothing // maybe it is sent also in arena - do nothing
break; break;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12157" #define REVISION_NR "12158"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__