aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp37
-rw-r--r--src/server/game/Server/Packets/EquipmentSetPackets.cpp40
-rw-r--r--src/server/game/Server/Packets/EquipmentSetPackets.h47
-rw-r--r--src/server/game/Server/WorldSession.cpp10
-rw-r--r--src/server/game/Server/WorldSession.h10
5 files changed, 115 insertions, 29 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index eef2276423d..29c3af9d685 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -39,6 +39,7 @@
#include "DatabaseEnv.h"
#include "DB2Stores.h"
#include "DisableMgr.h"
+#include "EquipmentSetPackets.h"
#include "Formulas.h"
#include "GameEventMgr.h"
#include "GameObjectAI.h"
@@ -23011,8 +23012,9 @@ void Player::SendInitialPacketsBeforeAddToMap()
m_reputationMgr->SendInitialReputations();
/// SMSG_SET_FORCED_REACTIONS
m_reputationMgr->SendForceReactions();
-
+ /// SMSG_INIT_CURRENCY
SendCurrencies();
+ /// SMSG_EQUIPMENT_SET_LIST
SendEquipmentSetList();
m_achievementMgr->SendAllAchievementData(this);
@@ -25671,33 +25673,30 @@ void Player::BuildEnchantmentsInfoData(WorldPacket* data)
void Player::SendEquipmentSetList()
{
- ObjectGuid ignoredItemGuid;
- ignoredItemGuid.SetRawValue(0, 1);
- uint32 count = 0;
- WorldPacket data(SMSG_EQUIPMENT_SET_LIST, 4);
- size_t count_pos = data.wpos();
- data << uint32(count); // count placeholder
+ WorldPackets::EquipmentSet::LoadEquipmentSet data;
+
for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
{
if (itr->second.state == EQUIPMENT_SET_DELETED)
continue;
- data.AppendPackedUInt64(itr->second.Guid);
- data << uint32(itr->first);
- data << itr->second.Name;
- data << itr->second.IconName;
+
+ WorldPackets::EquipmentSet::EquipmentSetData setData;
+ setData.Guid = itr->second.Guid;
+ setData.SetID = itr->first;
+ setData.IgnoreMask = itr->second.IgnoreMask;
+ setData.SetName = itr->second.Name;
+ setData.SetIcon = itr->second.IconName;
+
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
- // ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HIGHGUID_ITEM
- if (itr->second.IgnoreMask & (1 << i))
- data << ignoredItemGuid;
- else
- data << ObjectGuid::Create<HighGuid::Item>(itr->second.Items[i]);
+ if (!(itr->second.IgnoreMask & (1 << i)))
+ setData.Pieces[i] = ObjectGuid::Create<HighGuid::Item>(itr->second.Items[i]);
}
- ++count; // client have limit but it checked at loading and set
+ data.SetData.emplace_back(setData);
}
- data.put<uint32>(count_pos, count);
- GetSession()->SendPacket(&data);
+
+ SendDirectMessage(data.Write());
}
void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset)
diff --git a/src/server/game/Server/Packets/EquipmentSetPackets.cpp b/src/server/game/Server/Packets/EquipmentSetPackets.cpp
new file mode 100644
index 00000000000..ea8df38bcd1
--- /dev/null
+++ b/src/server/game/Server/Packets/EquipmentSetPackets.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "EquipmentSetPackets.h"
+
+WorldPacket const* WorldPackets::EquipmentSet::LoadEquipmentSet::Write()
+{
+ _worldPacket << uint32(SetData.size());
+
+ for (EquipmentSetData const& equipSet : SetData)
+ {
+ _worldPacket << uint64(equipSet.Guid);
+ _worldPacket << uint32(equipSet.SetID);
+ _worldPacket << uint32(equipSet.IgnoreMask);
+
+ for (ObjectGuid const& guid : equipSet.Pieces)
+ _worldPacket << guid;
+
+ _worldPacket.WriteBits(equipSet.SetName.length(), 8);
+ _worldPacket.WriteBits(equipSet.SetIcon.length(), 9);
+ _worldPacket.WriteString(equipSet.SetName);
+ _worldPacket.WriteString(equipSet.SetIcon);
+ }
+
+ return &_worldPacket;
+}
diff --git a/src/server/game/Server/Packets/EquipmentSetPackets.h b/src/server/game/Server/Packets/EquipmentSetPackets.h
new file mode 100644
index 00000000000..530a8b0efad
--- /dev/null
+++ b/src/server/game/Server/Packets/EquipmentSetPackets.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "Packet.h"
+#include "Player.h"
+
+namespace WorldPackets
+{
+ namespace EquipmentSet
+ {
+ struct EquipmentSetData
+ {
+ uint64 Guid = 0; ///< Set Identifier
+ uint32 SetID = 0; ///< Index
+ uint32 IgnoreMask = 0;
+ std::string SetName;
+ std::string SetIcon;
+ ObjectGuid Pieces[EQUIPMENT_SLOT_END];
+ };
+
+ class LoadEquipmentSet final : public ServerPacket
+ {
+ public:
+ LoadEquipmentSet() : ServerPacket(SMSG_EQUIPMENT_SET_LIST, 4) { }
+
+ WorldPacket const* Write() override;
+
+ std::vector<EquipmentSetData> SetData;
+ };
+ }
+}
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index a8d19434cc3..12ba71c4423 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -121,7 +121,7 @@ WorldSession::WorldSession(uint32 id, uint32 battlenetAccountId, std::shared_ptr
m_sessionDbLocaleIndex(locale),
m_latency(0),
m_clientTimeDelay(0),
- m_TutorialsChanged(false),
+ _tutorialsChanged(false),
_filterAddonMessages(false),
recruiterId(recruiter),
isRecruiter(isARecruiter),
@@ -130,7 +130,7 @@ WorldSession::WorldSession(uint32 id, uint32 battlenetAccountId, std::shared_ptr
forceExit(false),
m_currentBankerGUID()
{
- memset(m_Tutorials, 0, sizeof(m_Tutorials));
+ memset(_tutorials, 0, sizeof(_tutorials));
if (sock)
{
@@ -763,7 +763,7 @@ void WorldSession::LoadTutorialsData()
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
_tutorials[i] = (*result)[i].GetUInt32();
- m_TutorialsChanged = false;
+ _tutorialsChanged = false;
}
void WorldSession::SendTutorialsData()
@@ -775,7 +775,7 @@ void WorldSession::SendTutorialsData()
void WorldSession::SaveTutorialsData(SQLTransaction& trans)
{
- if (!m_TutorialsChanged)
+ if (!_tutorialsChanged)
return;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_HAS_TUTORIALS);
@@ -788,7 +788,7 @@ void WorldSession::SaveTutorialsData(SQLTransaction& trans)
stmt->setUInt32(MAX_ACCOUNT_TUTORIAL_VALUES, GetAccountId());
trans->Append(stmt);
- m_TutorialsChanged = false;
+ _tutorialsChanged = false;
}
void WorldSession::ReadAddonsInfo(ByteBuffer& data)
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 652ce589eac..1b2d6c5762a 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -420,13 +420,13 @@ class WorldSession
void LoadTutorialsData();
void SendTutorialsData();
void SaveTutorialsData(SQLTransaction& trans);
- uint32 GetTutorialInt(uint8 index) const { return m_Tutorials[index]; }
+ uint32 GetTutorialInt(uint8 index) const { return _tutorials[index]; }
void SetTutorialInt(uint8 index, uint32 value)
{
- if (m_Tutorials[index] != value)
+ if (_tutorials[index] != value)
{
- m_Tutorials[index] = value;
- m_TutorialsChanged = true;
+ _tutorials[index] = value;
+ _tutorialsChanged = true;
}
}
//used with item_page table
@@ -1210,7 +1210,7 @@ class WorldSession
std::atomic<uint32> m_clientTimeDelay;
AccountData _accountData[NUM_ACCOUNT_DATA_TYPES];
uint32 _tutorials[MAX_ACCOUNT_TUTORIAL_VALUES];
- bool m_TutorialsChanged;
+ bool _tutorialsChanged;
AddonsList m_addonsList;
std::vector<std::string> _registeredAddonPrefixes;
bool _filterAddonMessages;