[7630] Implement MSG_BATTLEGROUND_PLAYER_POSITIONS sending for AB and AV battleground.

Corrected some comments

Signed-off-by: Triply <triply@getmangos.com>
This commit is contained in:
Triply 2009-04-07 09:36:07 +02:00
parent ca5a3d95ca
commit 060203749c
3 changed files with 57 additions and 32 deletions

View file

@ -211,40 +211,62 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
if(!bg) // can't be received if player not in battleground if(!bg) // can't be received if player not in battleground
return; return;
if(bg->GetTypeID() == BATTLEGROUND_WS) switch( bg->GetTypeID() )
{ {
uint32 count1 = 0; case BATTLEGROUND_WS:
uint32 count2 = 0; {
uint32 count1 = 0; //always constant zero?
uint32 count2 = 0; //count of next fields
Player *ap = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID()); Player *ali_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID());
if(ap) ++count2; if( ali_plr )
++count2;
Player *hp = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID()); Player *horde_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID());
if(hp) ++count2; if( horde_plr )
++count2;
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2)); WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2));
data << count1; // alliance flag holders count data << count1; // alliance flag holders count - obsolete, now always 0
/*for(uint8 i = 0; i < count1; i++) /*for(uint8 i = 0; i < count1; i++)
{ {
data << uint64(0); // guid data << uint64(0); // guid
data << (float)0; // x data << (float)0; // x
data << (float)0; // y data << (float)0; // y
}*/ }*/
data << count2; // horde flag holders count data << count2; // horde flag holders count - obsolete, now count of next fields
if(ap) if( ali_plr )
{ {
data << (uint64)ap->GetGUID(); data << (uint64)ali_plr->GetGUID();
data << (float)ap->GetPositionX(); data << (float)ali_plr->GetPositionX();
data << (float)ap->GetPositionY(); data << (float)ali_plr->GetPositionY();
} }
if(hp) if( horde_plr )
{ {
data << (uint64)hp->GetGUID(); data << (uint64)horde_plr->GetGUID();
data << (float)hp->GetPositionX(); data << (float)horde_plr->GetPositionX();
data << (float)hp->GetPositionY(); data << (float)horde_plr->GetPositionY();
} }
SendPacket(&data); 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);
}
break;
default:
//maybe it is sent also in arena - do nothing
break;
} }
} }

View file

@ -19026,14 +19026,17 @@ bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const
bool Player::CanUseBattleGroundObject() bool Player::CanUseBattleGroundObject()
{ {
// TODO : some spells gives player ForceReaction to one faction (ReputationMgr::ApplyForceReaction)
// maybe gameobject code should handle that ForceReaction usage
// BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet
return ( //InBattleGround() && // in battleground - not need, check in other cases return ( //InBattleGround() && // in battleground - not need, check in other cases
//!IsMounted() && - not correct, player is dismounted when he clicks on flag //!IsMounted() && - not correct, player is dismounted when he clicks on flag
//i'm not sure if these two are correct, because invisible players should get visible when they click on flag //player cannot use object when he is invulnerable (immune)
!isTotalImmune() && // not totally immune !isTotalImmune() && // not totally immune
//i'm not sure if these two are correct, because invisible players should get visible when they click on flag
!HasStealthAura() && // not stealthed !HasStealthAura() && // not stealthed
!HasInvisibilityAura() && // not invisible !HasInvisibilityAura() && // not invisible
!HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) && // can't pickup !HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) && // can't pickup
//TODO player cannot use object when he is invulnerable (immune) - (ice block, divine shield, divine protection, divine intervention ...)
isAlive() // live player isAlive() // live player
); );
} }

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 "7629" #define REVISION_NR "7630"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__