Skip to content

Commit 41215e9

Browse files
author
Rochet2
committed
Merge TrinityCore 3.3.5 to ElunaTrinityWotlk [skip ci]
2 parents 741b37e + 11f01b3 commit 41215e9

9 files changed

Lines changed: 64 additions & 59 deletions

File tree

src/server/game/Entities/Creature/CreatureData.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ struct CreatureModelInfo
459459
{
460460
float bounding_radius;
461461
float combat_reach;
462-
uint8 gender;
463-
uint32 modelid_other_gender;
462+
int8 gender;
463+
uint32 displayId_other_gender;
464464
bool is_trigger;
465465
};
466466

src/server/game/Entities/Player/Player.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
#include "MapManager.h"
7171
#include "MiscPackets.h"
7272
#include "MotionMaster.h"
73+
#include "MovementPackets.h"
7374
#include "ObjectAccessor.h"
7475
#include "ObjectMgr.h"
7576
#include "Opcodes.h"
@@ -1745,14 +1746,11 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
17451746

17461747
if (!GetSession()->PlayerLogout())
17471748
{
1748-
WorldPacket data(SMSG_NEW_WORLD, 4 + 4 + 4 + 4 + 4);
1749-
data << uint32(mapid);
1750-
if (GetTransport())
1751-
data << m_movementInfo.transport.pos.PositionXYZOStream();
1752-
else
1753-
data << m_teleport_dest.PositionXYZOStream();
1749+
WorldPackets::Movement::NewWorld packet;
1750+
packet.MapID = mapid;
1751+
packet.Pos = GetTransport() ? m_movementInfo.transport.pos : m_teleport_dest.GetPosition();
17541752

1755-
SendDirectMessage(&data);
1753+
SendDirectMessage(packet.Write());
17561754
SendSavedInstances();
17571755
}
17581756

src/server/game/Globals/ObjectMgr.cpp

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,15 +1695,15 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* display
16951695
return nullptr;
16961696

16971697
// If a model for another gender exists, 50% chance to use it
1698-
if (modelInfo->modelid_other_gender != 0 && urand(0, 1) == 0)
1698+
if (modelInfo->displayId_other_gender != 0 && urand(0, 1) == 0)
16991699
{
1700-
CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender);
1700+
CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->displayId_other_gender);
17011701
if (!minfo_tmp)
1702-
TC_LOG_ERROR("sql.sql", "Model (Entry: {}) has modelid_other_gender {} not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender);
1702+
TC_LOG_ERROR("sql.sql", "Model (Entry: {}) has modelid_other_gender {} not found in table `creature_model_info`. ", *displayID, modelInfo->displayId_other_gender);
17031703
else
17041704
{
1705-
// Model ID changed
1706-
*displayID = modelInfo->modelid_other_gender;
1705+
// DisplayID changed
1706+
*displayID = modelInfo->displayId_other_gender;
17071707
return minfo_tmp;
17081708
}
17091709
}
@@ -1714,8 +1714,8 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* display
17141714
void ObjectMgr::LoadCreatureModelInfo()
17151715
{
17161716
uint32 oldMSTime = getMSTime();
1717-
// 0 1 2 3 4
1718-
QueryResult result = WorldDatabase.Query("SELECT DisplayID, BoundingRadius, CombatReach, Gender, DisplayID_Other_Gender FROM creature_model_info");
1717+
// 0 1 2 3 4
1718+
QueryResult result = WorldDatabase.Query("SELECT DisplayID, BoundingRadius, CombatReach, DisplayID_Other_Gender, Gender FROM creature_model_info");
17191719

17201720
if (!result)
17211721
{
@@ -1730,34 +1730,35 @@ void ObjectMgr::LoadCreatureModelInfo()
17301730
{
17311731
Field* fields = result->Fetch();
17321732

1733-
uint32 modelId = fields[0].GetUInt32();
1734-
CreatureDisplayInfoEntry const* creatureDisplay = sCreatureDisplayInfoStore.LookupEntry(modelId);
1733+
uint32 displayId = fields[0].GetUInt32();
1734+
1735+
CreatureDisplayInfoEntry const* creatureDisplay = sCreatureDisplayInfoStore.LookupEntry(displayId);
17351736
if (!creatureDisplay)
17361737
{
1737-
TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has model for nonexistent display id ({}).", modelId);
1738+
TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has a non-existent DisplayID (ID: {}). Skipped.", displayId);
17381739
continue;
17391740
}
17401741

1741-
CreatureModelInfo& modelInfo = _creatureModelStore[modelId];
1742+
CreatureModelInfo& modelInfo = _creatureModelStore[displayId];
17421743

1743-
modelInfo.bounding_radius = fields[1].GetFloat();
1744-
modelInfo.combat_reach = fields[2].GetFloat();
1745-
modelInfo.gender = fields[3].GetUInt8();
1746-
modelInfo.modelid_other_gender = fields[4].GetUInt32();
1747-
modelInfo.is_trigger = false;
1744+
modelInfo.bounding_radius = fields[1].GetFloat();
1745+
modelInfo.combat_reach = fields[2].GetFloat();
1746+
modelInfo.displayId_other_gender = fields[3].GetUInt32();
1747+
modelInfo.gender = fields[4].GetInt8();
1748+
modelInfo.is_trigger = false;
17481749

17491750
// Checks
17501751

17511752
if (modelInfo.gender > GENDER_NONE)
17521753
{
1753-
TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has wrong gender ({}) for display id ({}).", uint32(modelInfo.gender), modelId);
1754+
TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has wrong gender ({}) for display id ({}).", uint32(modelInfo.gender), displayId);
17541755
modelInfo.gender = GENDER_MALE;
17551756
}
17561757

1757-
if (modelInfo.modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.modelid_other_gender))
1758+
if (modelInfo.displayId_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.displayId_other_gender))
17581759
{
1759-
TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has nonexistent alt.gender model ({}) for existed display id ({}).", modelInfo.modelid_other_gender, modelId);
1760-
modelInfo.modelid_other_gender = 0;
1760+
TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has a non-existent DisplayID_Other_Gender (ID: {}) being used by DisplayID (ID: {}).", modelInfo.displayId_other_gender, displayId);
1761+
modelInfo.displayId_other_gender = 0;
17611762
}
17621763

17631764
if (modelInfo.combat_reach < 0.1f)

src/server/game/Handlers/MovementHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ uint32 WorldSession::AdjustClientMovementTime(uint32 time) const
182182
return uint32(movementTime);
183183
}
184184

185-
void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket & /*recvPacket*/)
185+
void WorldSession::HandleMoveWorldportAckOpcode(WorldPackets::Movement::WorldPortResponse& /*packet*/)
186186
{
187187
TC_LOG_DEBUG("network", "WORLD: got MSG_MOVE_WORLDPORT_ACK.");
188188
HandleMoveWorldportAck();

src/server/game/Server/Packets/MovementPackets.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,12 @@ WorldPacket const* FlightSplineSync::Write()
115115

116116
return &_worldPacket;
117117
}
118+
119+
WorldPacket const* NewWorld::Write()
120+
{
121+
_worldPacket << MapID;
122+
_worldPacket << Pos.PositionXYZOStream();
123+
124+
return &_worldPacket;
125+
}
118126
}

src/server/game/Server/Packets/MovementPackets.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,25 @@ namespace WorldPackets
5656
ObjectGuid Guid;
5757
float SplineDist = 0.0f;
5858
};
59+
60+
class NewWorld final : public ServerPacket
61+
{
62+
public:
63+
explicit NewWorld() : ServerPacket(SMSG_NEW_WORLD, 4 + 4 + 4 + 4 + 4) {}
64+
65+
WorldPacket const* Write() override;
66+
67+
int32 MapID = 0;
68+
Position Pos;
69+
};
70+
71+
class WorldPortResponse final : public ClientPacket
72+
{
73+
public:
74+
explicit WorldPortResponse(WorldPacket&& packet) : ClientPacket(MSG_MOVE_WORLDPORT_ACK, std::move(packet)) { }
75+
76+
void Read() override { }
77+
};
5978
}
6079
}
6180

src/server/game/Server/WorldPacket.h

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -34,41 +34,19 @@ class WorldPacket : public ByteBuffer
3434
WorldPacket(uint16 opcode, size_t res = 200) : ByteBuffer(res),
3535
m_opcode(opcode) { }
3636

37-
WorldPacket(WorldPacket&& packet) : ByteBuffer(std::move(packet)), m_opcode(packet.m_opcode)
38-
{
39-
}
40-
4137
WorldPacket(WorldPacket&& packet, TimePoint receivedTime) : ByteBuffer(std::move(packet)), m_opcode(packet.m_opcode), m_receivedTime(receivedTime)
4238
{
4339
}
4440

45-
WorldPacket(WorldPacket const& right) : ByteBuffer(right), m_opcode(right.m_opcode)
46-
{
47-
}
48-
49-
WorldPacket& operator=(WorldPacket const& right)
50-
{
51-
if (this != &right)
52-
{
53-
m_opcode = right.m_opcode;
54-
ByteBuffer::operator=(right);
55-
}
41+
WorldPacket(uint16 opcode, MessageBuffer&& buffer) : ByteBuffer(std::move(buffer)), m_opcode(opcode) { }
5642

57-
return *this;
58-
}
43+
WorldPacket(WorldPacket const& right) = default;
5944

60-
WorldPacket& operator=(WorldPacket&& right)
61-
{
62-
if (this != &right)
63-
{
64-
m_opcode = right.m_opcode;
65-
ByteBuffer::operator=(std::move(right));
66-
}
45+
WorldPacket(WorldPacket&& packet) noexcept = default;
6746

68-
return *this;
69-
}
47+
WorldPacket& operator=(WorldPacket const& right) = default;
7048

71-
WorldPacket(uint16 opcode, MessageBuffer&& buffer) : ByteBuffer(std::move(buffer)), m_opcode(opcode) { }
49+
WorldPacket& operator=(WorldPacket&& right) noexcept = default;
7250

7351
void Initialize(uint16 opcode, size_t newres = 200)
7452
{

src/server/game/Server/WorldSession.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ namespace WorldPackets
242242
namespace Movement
243243
{
244244
class ClientPlayerMovement;
245+
class WorldPortResponse;
245246
}
246247

247248
namespace NPC
@@ -781,7 +782,7 @@ class TC_GAME_API WorldSession
781782

782783
void HandleGameObjectQueryOpcode(WorldPackets::Query::QueryGameObject& query);
783784

784-
void HandleMoveWorldportAckOpcode(WorldPacket& recvPacket);
785+
void HandleMoveWorldportAckOpcode(WorldPackets::Movement::WorldPortResponse& packet);
785786
void HandleMoveWorldportAck(); // for server-side calls
786787

787788
// Validates that correct unit is moved, coords are in valid range and movement flags

src/server/shared/SharedDefines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ enum SpellAttr7 : uint32
715715
#define MAX_TALENT_GROUP 1
716716
#define MIN_TALENT_GROUPS 1
717717
#define MAX_TALENT_GROUPS 2
718-
#define MAX_GLYPH_SLOT_INDEX 6
718+
#define MAX_GLYPH_SLOT_INDEX 6
719719

720720
// Custom values
721721
enum SpellClickUserTypes

0 commit comments

Comments
 (0)