Core/Units: Partial implementation of SMSG_MOVE_SET_COLLISION_HGT - send proper character collision height on dismount.

Fixes #2642

NOTE: Still have to properly implement collision height calculation for mounting up.
This commit is contained in:
Machiavelli
2011-11-21 22:54:25 +01:00
parent 7c8f4358ea
commit a14cbcaa3e
6 changed files with 51 additions and 2 deletions
+14
View File
@@ -2493,6 +2493,20 @@ class Player : public Unit, public GridObject<Player>
void AddWhisperWhiteList(uint64 guid) { WhisperList.push_back(guid); }
bool IsInWhisperWhiteList(uint64 guid);
//! Return collision height sent to client
//! we currently only send this on dismount
float GetCollisionHeight()
{
CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
ASSERT(displayInfo);
CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
ASSERT(modelData);
return modelData->CollisionHeight;
//! TODO: Need a proper calculation for collision height when mounted
}
protected:
// Gamemaster whisper whitelist
WhisperListContainer WhisperList;
+9
View File
@@ -11946,6 +11946,15 @@ void Unit::Unmount()
SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0);
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT);
if (Player* thisPlayer = ToPlayer())
{
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
data.append(GetPackGUID());
data << uint32(sWorld->GetGameTime()); // Packet counter
data << thisPlayer->GetCollisionHeight();
thisPlayer->GetSession()->SendPacket(&data);
}
WorldPacket data(SMSG_DISMOUNT, 8);
data.appendPackGUID(GetGUID());
SendMessageToSet(&data, true);