Skip to content

Commit

Permalink
[11062] Correctly show team member status while teleporting
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberium authored and Ambal committed Jan 21, 2011
1 parent f0475c8 commit b447452
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
32 changes: 28 additions & 4 deletions src/game/GroupHandler.cpp
Expand Up @@ -806,7 +806,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
ObjectGuid guid;
recv_data >> guid;

Player *player = sObjectMgr.GetPlayer(guid);
Player * player = HashMapHolder<Player>::Find(guid);
if(!player)
{
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2);
Expand Down Expand Up @@ -837,9 +837,33 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data << uint16(player->GetPower(powerType)); // GROUP_UPDATE_FLAG_CUR_POWER
data << uint16(player->GetMaxPower(powerType)); // GROUP_UPDATE_FLAG_MAX_POWER
data << uint16(player->getLevel()); // GROUP_UPDATE_FLAG_LEVEL
data << uint16(player->GetZoneId()); // GROUP_UPDATE_FLAG_ZONE
data << uint16(player->GetPositionX()); // GROUP_UPDATE_FLAG_POSITION
data << uint16(player->GetPositionY()); // GROUP_UPDATE_FLAG_POSITION

//verify player coordinates and zoneid to send to teammates
uint16 iZoneId = 0;
uint16 iCoordX = 0;
uint16 iCoordY = 0;

if (player->IsInWorld())
{
iZoneId = player->GetZoneId();
iCoordX = player->GetPositionX();
iCoordY = player->GetPositionY();
}
else if (player->IsBeingTeleported()) // Player is in teleportation
{
WorldLocation& loc = player->GetTeleportDest(); // So take teleportation destination
iZoneId = sTerrainMgr.GetZoneId(loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z);
iCoordX = loc.coord_x;
iCoordY = loc.coord_y;
}
else
{
//unknown player status.
}

data << uint16(iZoneId); // GROUP_UPDATE_FLAG_ZONE
data << uint16(iCoordX); // GROUP_UPDATE_FLAG_POSITION
data << uint16(iCoordY); // GROUP_UPDATE_FLAG_POSITION

uint64 auramask = 0;
size_t maskPos = data.wpos();
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11061"
#define REVISION_NR "11062"
#endif // __REVISION_NR_H__

7 comments on commit b447452

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//unknown player status.

zone cached in Player field. Ofc it can be not exatly same for in world state to current pos but for non in world state it useful.
I recently use it for another packet.

@Ambal
Copy link
Contributor

@Ambal Ambal commented on b447452 Jan 22, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Vladimir. Thanks for comment. 'Unknown' player status case shouldn't appear at all: if player is not in world and is not being teleported then what is his status?

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then why else part ;)

@Ambal
Copy link
Contributor

@Ambal Ambal commented on b447452 Jan 22, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to place MANGOS_ASSERT() there to crash some servers and find out how we can get in this case :D

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact i also think good place assert in like case

@cyberium
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have tryed with one of my "BOOM!!!" code but i can confirm never seen it active in last "else".
Place assert will definitivly help us to see if another player status is possible.
If no feedback about this we simply can assume 'if not in world then is being teleported'

@Ambal
Copy link
Contributor

@Ambal Ambal commented on b447452 Jan 24, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should definitely add some checks to prevent wrong code use in the future.

Please sign in to comment.