aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/DataStores/DBCStructure.h6
-rwxr-xr-xsrc/server/game/DataStores/DBCfmt.h2
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h37
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp8
4 files changed, 40 insertions, 13 deletions
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index 32510da70d3..ba7be495c77 100755
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -760,7 +760,7 @@ struct CreatureModelDataEntry
//uint32 Flags;
//char* ModelPath[16]
//uint32 Unk1;
- //float Scale; // Used in calculation of unit collision data
+ float Scale; // Used in calculation of unit collision data
//int32 Unk2
//int32 Unk3
//uint32 Unk4
@@ -770,9 +770,9 @@ struct CreatureModelDataEntry
//float Unk8
//uint32 Unk9
//uint32 Unk10
- float CollisionWidth;
+ //float CollisionWidth;
float CollisionHeight;
- //float Unk11; // Used in calculation of unit collision data when mounted
+ float MountHeight; // Used in calculation of unit collision data when mounted
//float Unks[11]
};
diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h
index d71565d8a39..ac0b60d7f80 100755
--- a/src/server/game/DataStores/DBCfmt.h
+++ b/src/server/game/DataStores/DBCfmt.h
@@ -40,7 +40,7 @@ const char ChrRacesEntryfmt[]="nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxx
const char CinematicSequencesEntryfmt[]="nxxxxxxxxx";
const char CreatureDisplayInfofmt[]="nixxfxxxxxxxxxxx";
const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx";
-const char CreatureModelDatafmt[]="nxxxxxxxxxxxxxffxxxxxxxxxxxx";
+const char CreatureModelDatafmt[]="nxxxfxxxxxxxxxxffxxxxxxxxxxx";
const char CreatureSpellDatafmt[]="niiiixxxx";
const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx";
const char CurrencyTypesfmt[]="xnxi";
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index ddafefc087e..9aad63ccb1b 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -2494,16 +2494,37 @@ class Player : public Unit, public GridObject<Player>
bool IsInWhisperWhiteList(uint64 guid);
//! Return collision height sent to client
- //! we currently only send this on dismount
- float GetCollisionHeight()
+ float GetCollisionHeight(bool mounted)
{
- CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
- ASSERT(displayInfo);
- CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
- ASSERT(modelData);
-
- return modelData->CollisionHeight;
+ if (mounted)
+ {
+ CreatureDisplayInfoEntry const* mountDisplayInfo = sCreatureDisplayInfoStore.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID));
+ if (!mountDisplayInfo)
+ return GetCollisionHeight(false);
+
+ CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId);
+ if (!mountModelData)
+ return GetCollisionHeight(false);
+
+ CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.LookupEntry(GetNativeDisplayId());
+ ASSERT(displayInfo);
+ CreatureModelDataEntry const* modelData = sCreatureModelDataStore.LookupEntry(displayInfo->ModelId);
+ ASSERT(modelData);
+
+ float scaleMod = GetFloatValue(OBJECT_FIELD_SCALE_X); // 99% sure about this
+
+ return scaleMod * mountModelData->MountHeight + modelData->CollisionHeight * 0.5f;
+ }
+ else
+ {
+ //! Dismounting case - use basic default model data
+ 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
}
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 6d8f7866657..b99ccd5f35f 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -11934,6 +11934,12 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
else
player->UnsummonPetTemporaryIfAny();
}
+
+ WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
+ data.append(GetPackGUID());
+ data << uint32(sWorld->GetGameTime()); // Packet counter
+ data << player->GetCollisionHeight(true);
+ player->GetSession()->SendPacket(&data);
}
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT);
@@ -11952,7 +11958,7 @@ void Unit::Unmount()
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
data.append(GetPackGUID());
data << uint32(sWorld->GetGameTime()); // Packet counter
- data << thisPlayer->GetCollisionHeight();
+ data << thisPlayer->GetCollisionHeight(false);
thisPlayer->GetSession()->SendPacket(&data);
}