mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-19 14:39:43 -04:00
Core/Packets: updated EquipmentSet save packets
This commit is contained in:
@@ -1832,7 +1832,7 @@ void Creature::SendAIReaction(AiReaction reactionType)
|
||||
packet.UnitGUID = GetGUID();
|
||||
packet.Reaction = reactionType;
|
||||
|
||||
((WorldObject*)this)->SendMessageToSet(packet.Write(), true);
|
||||
SendMessageToSet(packet.Write(), true);
|
||||
|
||||
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType);
|
||||
}
|
||||
|
||||
@@ -2166,7 +2166,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||
packet.Pos = m_teleport_dest;
|
||||
packet.Reason = 16;
|
||||
|
||||
GetSession()->SendPacket(packet.Write());
|
||||
SendDirectMessage(packet.Write());
|
||||
SendSavedInstances();
|
||||
}
|
||||
|
||||
@@ -6217,7 +6217,7 @@ void Player::SendActionButtons(uint32 state) const
|
||||
|
||||
packet.Reason = state;
|
||||
|
||||
GetSession()->SendPacket(packet.Write());
|
||||
SendDirectMessage(packet.Write());
|
||||
TC_LOG_INFO("network", "Action Buttons for '%s' group '%u' Sent", GetGUID().ToString().c_str(), GetActiveTalentGroup());
|
||||
}
|
||||
|
||||
@@ -16745,28 +16745,25 @@ void Player::_LoadEquipmentSets(PreparedQueryResult result)
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
uint32 count = 0;
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
EquipmentSet eqSet;
|
||||
EquipmentSetInfo eqSet;
|
||||
|
||||
eqSet.Guid = fields[0].GetUInt64();
|
||||
uint8 index = fields[1].GetUInt8();
|
||||
eqSet.Name = fields[2].GetString();
|
||||
eqSet.IconName = fields[3].GetString();
|
||||
eqSet.IgnoreMask = fields[4].GetUInt32();
|
||||
eqSet.state = EQUIPMENT_SET_UNCHANGED;
|
||||
eqSet.Data.Guid = fields[0].GetUInt64();
|
||||
eqSet.Data.SetID = fields[1].GetUInt8();
|
||||
eqSet.Data.SetName = fields[2].GetString();
|
||||
eqSet.Data.SetIcon = fields[3].GetString();
|
||||
eqSet.Data.IgnoreMask = fields[4].GetUInt32();
|
||||
eqSet.State = EQUIPMENT_SET_UNCHANGED;
|
||||
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
eqSet.Items[i] = fields[5 + i].GetUInt64();
|
||||
eqSet.Data.Pieces[i] = ObjectGuid::Create<HighGuid::Item>(fields[5 + i].GetUInt64());
|
||||
|
||||
m_EquipmentSets[index] = eqSet;
|
||||
if (eqSet.Data.SetID >= MAX_EQUIPMENT_SET_INDEX) // client limit
|
||||
continue;
|
||||
|
||||
++count;
|
||||
|
||||
if (count >= MAX_EQUIPMENT_SET_INDEX) // client limit
|
||||
break;
|
||||
_equipmentSets[eqSet.Data.SetID] = eqSet;
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
@@ -20463,7 +20460,7 @@ void Player::WhisperAddon(std::string const& text, const std::string& prefix, Pl
|
||||
|
||||
WorldPackets::Chat::Chat packet;
|
||||
ChatHandler::BuildChatPacket(&packet, CHAT_MSG_WHISPER, LANG_ADDON, this, this, text, 0, "", DEFAULT_LOCALE, prefix);
|
||||
receiver->GetSession()->SendPacket(packet.Write());
|
||||
receiver->SendDirectMessage(packet.Write());
|
||||
}
|
||||
|
||||
void Player::Whisper(std::string const& text, Language language, Player* target, bool /*= false*/)
|
||||
@@ -20480,14 +20477,14 @@ void Player::Whisper(std::string const& text, Language language, Player* target,
|
||||
|
||||
WorldPackets::Chat::Chat packet;
|
||||
ChatHandler::BuildChatPacket(&packet, CHAT_MSG_WHISPER, Language(language), this, this, _text);
|
||||
target->GetSession()->SendPacket(packet.Write());
|
||||
target->SendDirectMessage(packet.Write());
|
||||
|
||||
// rest stuff shouldn't happen in case of addon message
|
||||
if (isAddonMessage)
|
||||
return;
|
||||
|
||||
ChatHandler::BuildChatPacket(&packet, CHAT_MSG_WHISPER_INFORM, Language(language), target, target, _text);
|
||||
GetSession()->SendPacket(packet.Write());
|
||||
SendDirectMessage(packet.Write());
|
||||
|
||||
if (!isAcceptWhispers() && !IsGameMaster() && !target->IsGameMaster())
|
||||
{
|
||||
@@ -20980,7 +20977,7 @@ void Player::SendProficiency(ItemClass itemClass, uint32 itemSubclassMask)
|
||||
WorldPackets::Item::SetProficiency packet;
|
||||
packet.ProficiencyMask = itemSubclassMask;
|
||||
packet.ProficiencyClass = itemClass;
|
||||
GetSession()->SendPacket(packet.Write());
|
||||
SendDirectMessage(packet.Write());
|
||||
}
|
||||
|
||||
void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
|
||||
@@ -25627,7 +25624,7 @@ void Player::SendTalentsInfoData()
|
||||
packet.Info.TalentGroups.push_back(groupInfoPkt);
|
||||
}
|
||||
|
||||
GetSession()->SendPacket(packet.Write());
|
||||
SendDirectMessage(packet.Write());
|
||||
}
|
||||
|
||||
void Player::BuildEnchantmentsInfoData(WorldPacket* data)
|
||||
@@ -25677,117 +25674,98 @@ void Player::SendEquipmentSetList()
|
||||
{
|
||||
WorldPackets::EquipmentSet::LoadEquipmentSet data;
|
||||
|
||||
for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
|
||||
for (EquipmentSetContainer::value_type const& eqSet : _equipmentSets)
|
||||
{
|
||||
if (itr->second.state == EQUIPMENT_SET_DELETED)
|
||||
if (eqSet.second.State == EQUIPMENT_SET_DELETED)
|
||||
continue;
|
||||
|
||||
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)
|
||||
{
|
||||
if (!(itr->second.IgnoreMask & (1 << i)))
|
||||
setData.Pieces[i] = ObjectGuid::Create<HighGuid::Item>(itr->second.Items[i]);
|
||||
}
|
||||
|
||||
data.SetData.emplace_back(setData);
|
||||
data.SetData.push_back(&eqSet.second.Data);
|
||||
}
|
||||
|
||||
SendDirectMessage(data.Write());
|
||||
}
|
||||
|
||||
void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset)
|
||||
void Player::SetEquipmentSet(EquipmentSetInfo::EquipmentSetData&& newEqSet)
|
||||
{
|
||||
if (eqset.Guid != 0)
|
||||
if (newEqSet.Guid != 0)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
|
||||
// something wrong...
|
||||
EquipmentSetContainer::const_iterator itr = _equipmentSets.find(newEqSet.SetID);
|
||||
if (itr == _equipmentSets.end() || itr->second.Data.Guid != newEqSet.Guid)
|
||||
{
|
||||
if ((itr->second.Guid == eqset.Guid) && (itr->first == index))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) // something wrong...
|
||||
{
|
||||
TC_LOG_ERROR("entities.player", "Player %s tried to save equipment set " UI64FMTD " (index %u), but that equipment set not found!", GetName().c_str(), eqset.Guid, index);
|
||||
TC_LOG_ERROR("entities.player", "Player %s tried to save equipment set " UI64FMTD " (index: %u), but that equipment set not found!", GetName().c_str(), newEqSet.Guid, newEqSet.SetID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EquipmentSet& eqslot = m_EquipmentSets[index];
|
||||
EquipmentSetInfo& eqSlot = _equipmentSets[newEqSet.SetID];
|
||||
|
||||
EquipmentSetUpdateState old_state = eqslot.state;
|
||||
EquipmentSetUpdateState oldState = eqSlot.State;
|
||||
|
||||
eqslot = eqset;
|
||||
eqSlot.Data = newEqSet;
|
||||
|
||||
if (eqset.Guid == 0)
|
||||
if (eqSlot.Data.Guid == 0)
|
||||
{
|
||||
eqslot.Guid = sObjectMgr->GenerateEquipmentSetGuid();
|
||||
eqSlot.Data.Guid = sObjectMgr->GenerateEquipmentSetGuid();
|
||||
|
||||
WorldPacket data(SMSG_EQUIPMENT_SET_SAVED, 4 + 1);
|
||||
data << uint32(index);
|
||||
data.AppendPackedUInt64(eqslot.Guid);
|
||||
GetSession()->SendPacket(&data);
|
||||
WorldPackets::EquipmentSet::EquipmentSetID data;
|
||||
data.GUID = eqSlot.Data.Guid;
|
||||
data.SetID = eqSlot.Data.SetID;
|
||||
SendDirectMessage(data.Write());
|
||||
}
|
||||
|
||||
eqslot.state = old_state == EQUIPMENT_SET_NEW ? EQUIPMENT_SET_NEW : EQUIPMENT_SET_CHANGED;
|
||||
eqSlot.State = oldState == EQUIPMENT_SET_NEW ? EQUIPMENT_SET_NEW : EQUIPMENT_SET_CHANGED;
|
||||
}
|
||||
|
||||
void Player::_SaveEquipmentSets(SQLTransaction& trans)
|
||||
{
|
||||
for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end();)
|
||||
for (EquipmentSetContainer::iterator itr = _equipmentSets.begin(); itr != _equipmentSets.end();)
|
||||
{
|
||||
uint32 index = itr->first;
|
||||
EquipmentSet& eqset = itr->second;
|
||||
PreparedStatement* stmt = NULL;
|
||||
EquipmentSetInfo& eqSet = itr->second;
|
||||
PreparedStatement* stmt = nullptr;
|
||||
uint8 j = 0;
|
||||
switch (eqset.state)
|
||||
switch (eqSet.State)
|
||||
{
|
||||
case EQUIPMENT_SET_UNCHANGED:
|
||||
++itr;
|
||||
break; // nothing do
|
||||
case EQUIPMENT_SET_CHANGED:
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_EQUIP_SET);
|
||||
stmt->setString(j++, eqset.Name.c_str());
|
||||
stmt->setString(j++, eqset.IconName.c_str());
|
||||
stmt->setUInt32(j++, eqset.IgnoreMask);
|
||||
for (uint8 i=0; i<EQUIPMENT_SLOT_END; ++i)
|
||||
stmt->setUInt64(j++, eqset.Items[i]);
|
||||
stmt->setString(j++, eqSet.Data.SetName);
|
||||
stmt->setString(j++, eqSet.Data.SetIcon);
|
||||
stmt->setUInt32(j++, eqSet.Data.IgnoreMask);
|
||||
|
||||
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
stmt->setUInt64(j++, eqSet.Data.Pieces[i].GetCounter());
|
||||
|
||||
stmt->setUInt64(j++, GetGUID().GetCounter());
|
||||
stmt->setUInt64(j++, eqset.Guid);
|
||||
stmt->setUInt32(j, index);
|
||||
stmt->setUInt64(j++, eqSet.Data.Guid);
|
||||
stmt->setUInt32(j, eqSet.Data.SetID);
|
||||
trans->Append(stmt);
|
||||
eqset.state = EQUIPMENT_SET_UNCHANGED;
|
||||
eqSet.State = EQUIPMENT_SET_UNCHANGED;
|
||||
++itr;
|
||||
break;
|
||||
case EQUIPMENT_SET_NEW:
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_EQUIP_SET);
|
||||
stmt->setUInt64(j++, GetGUID().GetCounter());
|
||||
stmt->setUInt64(j++, eqset.Guid);
|
||||
stmt->setUInt32(j++, index);
|
||||
stmt->setString(j++, eqset.Name.c_str());
|
||||
stmt->setString(j++, eqset.IconName.c_str());
|
||||
stmt->setUInt32(j++, eqset.IgnoreMask);
|
||||
for (uint8 i=0; i<EQUIPMENT_SLOT_END; ++i)
|
||||
stmt->setUInt64(j++, eqset.Items[i]);
|
||||
stmt->setUInt64(j++, eqSet.Data.Guid);
|
||||
stmt->setUInt32(j++, eqSet.Data.SetID);
|
||||
stmt->setString(j++, eqSet.Data.SetName);
|
||||
stmt->setString(j++, eqSet.Data.SetIcon);
|
||||
stmt->setUInt32(j++, eqSet.Data.IgnoreMask);
|
||||
|
||||
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
stmt->setUInt64(j++, eqSet.Data.Pieces[i].GetCounter());
|
||||
|
||||
trans->Append(stmt);
|
||||
eqset.state = EQUIPMENT_SET_UNCHANGED;
|
||||
eqSet.State = EQUIPMENT_SET_UNCHANGED;
|
||||
++itr;
|
||||
break;
|
||||
case EQUIPMENT_SET_DELETED:
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EQUIP_SET);
|
||||
stmt->setUInt64(0, eqset.Guid);
|
||||
stmt->setUInt64(0, eqSet.Data.Guid);
|
||||
trans->Append(stmt);
|
||||
m_EquipmentSets.erase(itr++);
|
||||
itr = _equipmentSets.erase(itr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -25816,16 +25794,17 @@ void Player::_SaveBGData(SQLTransaction& trans)
|
||||
|
||||
void Player::DeleteEquipmentSet(uint64 setGuid)
|
||||
{
|
||||
for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
|
||||
for (EquipmentSetContainer::iterator itr = _equipmentSets.begin(); itr != _equipmentSets.end();)
|
||||
{
|
||||
if (itr->second.Guid == setGuid)
|
||||
if (itr->second.Data.Guid == setGuid)
|
||||
{
|
||||
if (itr->second.state == EQUIPMENT_SET_NEW)
|
||||
m_EquipmentSets.erase(itr);
|
||||
if (itr->second.State == EQUIPMENT_SET_NEW)
|
||||
itr = _equipmentSets.erase(itr);
|
||||
else
|
||||
itr->second.state = EQUIPMENT_SET_DELETED;
|
||||
itr->second.State = EQUIPMENT_SET_DELETED;
|
||||
break;
|
||||
}
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26191,7 +26170,7 @@ void Player::SendTimeSync()
|
||||
|
||||
WorldPackets::Misc::TimeSyncRequest packet;
|
||||
packet.SequenceIndex = m_timeSyncQueue.back();
|
||||
GetSession()->SendPacket(packet.Write());
|
||||
SendDirectMessage(packet.Write());
|
||||
|
||||
// Schedule next sync in 10 sec
|
||||
m_timeSyncTimer = 10000;
|
||||
|
||||
@@ -747,24 +747,26 @@ enum EquipmentSetUpdateState
|
||||
EQUIPMENT_SET_DELETED = 3
|
||||
};
|
||||
|
||||
struct EquipmentSet
|
||||
struct EquipmentSetInfo
|
||||
{
|
||||
EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW)
|
||||
/// Data sent in EquipmentSet related packets
|
||||
struct EquipmentSetData
|
||||
{
|
||||
memset(Items, 0, sizeof(Items));
|
||||
}
|
||||
uint64 Guid = 0; ///< Set Identifier
|
||||
uint32 SetID = 0; ///< Index
|
||||
uint32 IgnoreMask = 0; ///< Mask of EquipmentSlot
|
||||
std::string SetName;
|
||||
std::string SetIcon;
|
||||
ObjectGuid Pieces[EQUIPMENT_SLOT_END];
|
||||
} Data;
|
||||
|
||||
uint64 Guid;
|
||||
std::string Name;
|
||||
std::string IconName;
|
||||
uint32 IgnoreMask;
|
||||
ObjectGuid::LowType Items[EQUIPMENT_SLOT_END];
|
||||
EquipmentSetUpdateState state;
|
||||
/// Server-side data
|
||||
EquipmentSetUpdateState State = EQUIPMENT_SET_NEW;
|
||||
};
|
||||
|
||||
#define MAX_EQUIPMENT_SET_INDEX 10 // client limit
|
||||
|
||||
typedef std::map<uint32, EquipmentSet> EquipmentSets;
|
||||
typedef std::map<uint32, EquipmentSetInfo> EquipmentSetContainer;
|
||||
|
||||
struct ItemPosCount
|
||||
{
|
||||
@@ -2229,7 +2231,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item* item, ItemTemplate const* proto);
|
||||
|
||||
void SendEquipmentSetList();
|
||||
void SetEquipmentSet(uint32 index, EquipmentSet eqset);
|
||||
void SetEquipmentSet(EquipmentSetInfo::EquipmentSetData&& newEqSet);
|
||||
void DeleteEquipmentSet(uint64 setGuid);
|
||||
|
||||
void SendInitWorldStates(uint32 zone, uint32 area);
|
||||
@@ -2842,7 +2844,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
DeclinedName *m_declinedname;
|
||||
Runes *m_runes;
|
||||
EquipmentSets m_EquipmentSets;
|
||||
EquipmentSetContainer _equipmentSets;
|
||||
|
||||
bool CanAlwaysSee(WorldObject const* obj) const override;
|
||||
|
||||
|
||||
@@ -12868,7 +12868,7 @@ void Unit::SendPetAIReaction(ObjectGuid guid)
|
||||
WorldPackets::Combat::AIReaction packet;
|
||||
packet.UnitGUID = guid;
|
||||
packet.Reaction = AI_REACTION_HOSTILE;
|
||||
owner->ToPlayer()->GetSession()->SendPacket(packet.Write());
|
||||
owner->ToPlayer()->SendDirectMessage(packet.Write());
|
||||
}
|
||||
|
||||
///----------End of Pet responses methods----------
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "ClientConfigPackets.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "EquipmentSetPackets.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildFinderMgr.h"
|
||||
@@ -857,6 +858,16 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||
/// Send FeatureSystemStatus
|
||||
{
|
||||
WorldPackets::System::FeatureSystemStatus features;
|
||||
|
||||
/// START OF DUMMY VALUES
|
||||
features.ComplaintStatus = 2;
|
||||
features.ScrollOfResurrectionRequestsRemaining = 1;
|
||||
features.ScrollOfResurrectionMaxRequestsPerDay = 1;
|
||||
features.CfgRealmID = 2;
|
||||
features.CfgRealmRecID = 0;
|
||||
features.VoiceEnabled = true;
|
||||
/// END OF DUMMY VALUES
|
||||
|
||||
features.CharUndeleteEnabled = sWorld->getBoolConfig(CONFIG_FEATURE_SYSTEM_CHARACTER_UNDELETE_ENABLED);
|
||||
features.BpayStoreEnabled = sWorld->getBoolConfig(CONFIG_FEATURE_SYSTEM_BPAY_STORE_ENABLED);
|
||||
|
||||
@@ -1525,59 +1536,36 @@ void WorldSession::HandleCharCustomizeCallback(PreparedQueryResult result, World
|
||||
GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), customizeInfo->CharGUID.ToString().c_str(), customizeInfo->CharName.c_str());
|
||||
}
|
||||
|
||||
void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData)
|
||||
void WorldSession::HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipmentSet& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "CMSG_EQUIPMENT_SET_SAVE");
|
||||
|
||||
uint64 setGuid;
|
||||
recvData.ReadPackedUInt64(setGuid);
|
||||
|
||||
uint32 index;
|
||||
recvData >> index;
|
||||
if (index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
|
||||
if (packet.Set.SetID >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
|
||||
return;
|
||||
|
||||
std::string name;
|
||||
recvData >> name;
|
||||
|
||||
std::string iconName;
|
||||
recvData >> iconName;
|
||||
|
||||
EquipmentSet eqSet;
|
||||
|
||||
eqSet.Guid = setGuid;
|
||||
eqSet.Name = name;
|
||||
eqSet.IconName = iconName;
|
||||
eqSet.state = EQUIPMENT_SET_NEW;
|
||||
|
||||
ObjectGuid ignoredItemGuid;
|
||||
ignoredItemGuid.SetRawValue(0, 1);
|
||||
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
ObjectGuid itemGuid;
|
||||
recvData >> itemGuid.ReadAsPacked();
|
||||
|
||||
// equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set)
|
||||
if (itemGuid == ignoredItemGuid)
|
||||
if (!(packet.Set.IgnoreMask & (1 << i)))
|
||||
{
|
||||
// ignored slots saved as bit mask because we have no free special values for Items[i]
|
||||
eqSet.IgnoreMask |= 1 << i;
|
||||
continue;
|
||||
ObjectGuid const& itemGuid = packet.Set.Pieces[i];
|
||||
|
||||
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
|
||||
/// cheating check 1 (item equipped but sent empty guid)
|
||||
if (!item && !itemGuid.IsEmpty())
|
||||
return;
|
||||
|
||||
/// cheating check 2 (sent guid does not match equipped item)
|
||||
if (item && item->GetGUID() != itemGuid)
|
||||
return;
|
||||
}
|
||||
|
||||
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
|
||||
if (!item && !itemGuid.IsEmpty()) // cheating check 1
|
||||
return;
|
||||
|
||||
if (item && item->GetGUID() != itemGuid) // cheating check 2
|
||||
return;
|
||||
|
||||
eqSet.Items[i] = itemGuid.GetCounter();
|
||||
else
|
||||
packet.Set.Pieces[i].Clear();
|
||||
}
|
||||
|
||||
_player->SetEquipmentSet(index, eqSet);
|
||||
packet.Set.IgnoreMask &= 0x7FFFF; /// clear invalid bits (i > EQUIPMENT_SLOT_END)
|
||||
|
||||
_player->SetEquipmentSet(std::move(packet.Set));
|
||||
}
|
||||
|
||||
void WorldSession::HandleEquipmentSetDelete(WorldPacket& recvData)
|
||||
|
||||
@@ -650,7 +650,7 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData)
|
||||
|
||||
WorldPackets::Chat::Chat packet;
|
||||
ChatHandler::BuildChatPacket(&packet, CHAT_MSG_IGNORED, LANG_UNIVERSAL, _player, _player, GetPlayer()->GetName());
|
||||
player->GetSession()->SendPacket(packet.Write());
|
||||
player->SendDirectMessage(packet.Write());
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelDeclineInvite(WorldPacket &recvPacket)
|
||||
|
||||
@@ -642,14 +642,10 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPackets::Quest::Ques
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY");
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
WorldPackets::Quest::QuestGiverStatusMultiple response;
|
||||
|
||||
for (GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
|
||||
{
|
||||
uint32 questStatus = DIALOG_STATUS_NONE;
|
||||
|
||||
if (itr->IsAnyTypeCreature())
|
||||
{
|
||||
// need also pet quests case support
|
||||
@@ -659,12 +655,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPackets::Quest::Ques
|
||||
if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
|
||||
continue;
|
||||
|
||||
questStatus = _player->GetQuestDialogStatus(questgiver);
|
||||
|
||||
WorldPackets::Quest::QuestGiverInfo info;
|
||||
info.Guid = questgiver->GetGUID();
|
||||
info.Status = questStatus;
|
||||
response.QuestGiver.push_back(info);
|
||||
response.QuestGiver.emplace_back(questgiver->GetGUID(), _player->GetQuestDialogStatus(questgiver));
|
||||
}
|
||||
else if (itr->IsGameObject())
|
||||
{
|
||||
@@ -672,12 +663,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPackets::Quest::Ques
|
||||
if (!questgiver || questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
continue;
|
||||
|
||||
questStatus = _player->GetQuestDialogStatus(questgiver);
|
||||
|
||||
WorldPackets::Quest::QuestGiverInfo info;
|
||||
info.Guid = questgiver->GetGUID();
|
||||
info.Status = questStatus;
|
||||
response.QuestGiver.push_back(info);
|
||||
response.QuestGiver.emplace_back(questgiver->GetGUID(), _player->GetQuestDialogStatus(questgiver));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,24 +17,49 @@
|
||||
|
||||
#include "EquipmentSetPackets.h"
|
||||
|
||||
WorldPacket const* WorldPackets::EquipmentSet::EquipmentSetID::Write()
|
||||
{
|
||||
_worldPacket << uint64(GUID);
|
||||
_worldPacket << uint32(SetID);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::EquipmentSet::LoadEquipmentSet::Write()
|
||||
{
|
||||
_worldPacket << uint32(SetData.size());
|
||||
|
||||
for (EquipmentSetData const& equipSet : SetData)
|
||||
for (EquipmentSetInfo::EquipmentSetData const* equipSet : SetData)
|
||||
{
|
||||
_worldPacket << uint64(equipSet.Guid);
|
||||
_worldPacket << uint32(equipSet.SetID);
|
||||
_worldPacket << uint32(equipSet.IgnoreMask);
|
||||
_worldPacket << uint64(equipSet->Guid);
|
||||
_worldPacket << uint32(equipSet->SetID);
|
||||
_worldPacket << uint32(equipSet->IgnoreMask);
|
||||
|
||||
for (ObjectGuid const& guid : equipSet.Pieces)
|
||||
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);
|
||||
_worldPacket.WriteBits(equipSet->SetName.length(), 8);
|
||||
_worldPacket.WriteBits(equipSet->SetIcon.length(), 9);
|
||||
_worldPacket.WriteString(equipSet->SetName);
|
||||
_worldPacket.WriteString(equipSet->SetIcon);
|
||||
_worldPacket.FlushBits();
|
||||
}
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::EquipmentSet::SaveEquipmentSet::Read()
|
||||
{
|
||||
_worldPacket >> Set.Guid;
|
||||
_worldPacket >> Set.SetID;
|
||||
_worldPacket >> Set.IgnoreMask;
|
||||
|
||||
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
_worldPacket >> Set.Pieces[i];
|
||||
|
||||
uint32 setNameLength = _worldPacket.ReadBits(8);
|
||||
uint32 setIconLength = _worldPacket.ReadBits(9);
|
||||
|
||||
Set.SetName = _worldPacket.ReadString(setNameLength);
|
||||
Set.SetIcon = _worldPacket.ReadString(setIconLength);
|
||||
}
|
||||
|
||||
@@ -24,14 +24,15 @@ namespace WorldPackets
|
||||
{
|
||||
namespace EquipmentSet
|
||||
{
|
||||
struct EquipmentSetData
|
||||
class EquipmentSetID final : public ServerPacket
|
||||
{
|
||||
uint64 Guid = 0; ///< Set Identifier
|
||||
public:
|
||||
EquipmentSetID() : ServerPacket(SMSG_EQUIPMENT_SET_SAVED, 8 + 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
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
|
||||
@@ -41,7 +42,17 @@ namespace WorldPackets
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::vector<EquipmentSetData> SetData;
|
||||
std::vector<EquipmentSetInfo::EquipmentSetData const*> SetData;
|
||||
};
|
||||
|
||||
class SaveEquipmentSet final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
SaveEquipmentSet(WorldPacket&& packet) : ClientPacket(CMSG_EQUIPMENT_SET_SAVE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
EquipmentSetInfo::EquipmentSetData Set;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,16 @@
|
||||
#include "MovementPackets.h"
|
||||
#include "MovementTypedefs.h"
|
||||
|
||||
ByteBuffer& operator << (ByteBuffer& data, const G3D::Vector3& v)
|
||||
ByteBuffer& operator<<(ByteBuffer& data, G3D::Vector3 const& v)
|
||||
{
|
||||
data << v.x << v.y << v.z;
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator >> (ByteBuffer& data, G3D::Vector3& v)
|
||||
ByteBuffer& operator>>(ByteBuffer& data, G3D::Vector3& v)
|
||||
{
|
||||
data >> v.x >> v.y >> v.z;
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, MovementInfo& movementInfo)
|
||||
@@ -53,8 +55,6 @@ ByteBuffer& operator<<(ByteBuffer& data, MovementInfo& movementInfo)
|
||||
data << ObjectGuid;
|
||||
}*/
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
data.WriteBits(movementInfo.flags, 30);
|
||||
data.WriteBits(movementInfo.flags2, 15);
|
||||
|
||||
@@ -86,8 +86,6 @@ ByteBuffer& operator<<(ByteBuffer& data, MovementInfo& movementInfo)
|
||||
data << movementInfo.jump.fallTime;
|
||||
data << movementInfo.jump.zspeed;
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
data.WriteBit(hasFallDirection);
|
||||
if (hasFallDirection)
|
||||
{
|
||||
@@ -98,6 +96,8 @@ ByteBuffer& operator<<(ByteBuffer& data, MovementInfo& movementInfo)
|
||||
}
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo)
|
||||
@@ -161,6 +161,8 @@ ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo)
|
||||
data >> movementInfo.jump.xyspeed;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void WorldPackets::Movement::ClientPlayerMovement::Read()
|
||||
@@ -172,6 +174,8 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFi
|
||||
{
|
||||
data << monsterSplineFilterKey.Idx;
|
||||
data << monsterSplineFilterKey.Speed;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFilter& monsterSplineFilter)
|
||||
@@ -183,8 +187,10 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MonsterSplineFi
|
||||
for (WorldPackets::Movement::MonsterSplineFilterKey& filterKey : monsterSplineFilter.FilterKeys)
|
||||
data << filterKey;
|
||||
data << monsterSplineFilter.AddedToStart;
|
||||
data.FlushBits();
|
||||
data.WriteBits(monsterSplineFilter.FilterFlags, 2);
|
||||
data.FlushBits();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementSpline& movementSpline)
|
||||
@@ -202,13 +208,14 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementSpline&
|
||||
data << movementSpline.TransportGUID;
|
||||
data << movementSpline.VehicleSeat;
|
||||
data << int32(movementSpline.PackedDeltas.size());
|
||||
for (G3D::Vector3& pos : movementSpline.Points)
|
||||
for (G3D::Vector3 const& pos : movementSpline.Points)
|
||||
data << pos;
|
||||
for (G3D::Vector3& pos : movementSpline.PackedDeltas)
|
||||
for (G3D::Vector3 const& pos : movementSpline.PackedDeltas)
|
||||
data.appendPackXYZ(pos.x, pos.y, pos.z);
|
||||
data.FlushBits();
|
||||
data.WriteBits(movementSpline.Face, 2);
|
||||
data.WriteBit(movementSpline.SplineFilter.HasValue);
|
||||
data.FlushBits();
|
||||
|
||||
switch (movementSpline.Face)
|
||||
{
|
||||
case MONSTER_MOVE_FACING_SPOT:
|
||||
@@ -222,8 +229,11 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementSpline&
|
||||
data << movementSpline.FaceDirection;
|
||||
break;
|
||||
}
|
||||
|
||||
if (movementSpline.SplineFilter.HasValue)
|
||||
data << movementSpline.SplineFilter.value;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementMonsterSpline& movementMonsterSpline)
|
||||
@@ -231,8 +241,10 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementMonster
|
||||
data << movementMonsterSpline.ID;
|
||||
data << movementMonsterSpline.Destination;
|
||||
data << movementMonsterSpline.Move;
|
||||
data.FlushBits();
|
||||
data.WriteBit(movementMonsterSpline.CrzTeleport);
|
||||
data.FlushBits();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Movement::MonsterMove::Write()
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace WorldPackets
|
||||
}
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, const G3D::Vector3& v);
|
||||
ByteBuffer& operator<<(ByteBuffer& data, G3D::Vector3 const& v);
|
||||
ByteBuffer& operator>>(ByteBuffer& data, G3D::Vector3& v);
|
||||
|
||||
ByteBuffer& operator>>(ByteBuffer& data, MovementInfo& movementInfo);
|
||||
|
||||
@@ -41,11 +41,15 @@ namespace WorldPackets
|
||||
public:
|
||||
QuestGiverStatusMultipleQuery(WorldPacket&& packet) : ClientPacket(CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY, std::move(packet)) { }
|
||||
|
||||
void Read() override {};
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
struct QuestGiverInfo
|
||||
{
|
||||
QuestGiverInfo() { }
|
||||
QuestGiverInfo(ObjectGuid const& guid, uint32 status)
|
||||
: Guid(guid), Status(status) { }
|
||||
|
||||
ObjectGuid Guid;
|
||||
uint32 Status = DIALOG_STATUS_NONE;
|
||||
};
|
||||
@@ -53,7 +57,7 @@ namespace WorldPackets
|
||||
class QuestGiverStatus final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
QuestGiverStatus() : ServerPacket(SMSG_QUESTGIVER_STATUS, 12) { }
|
||||
QuestGiverStatus() : ServerPacket(SMSG_QUESTGIVER_STATUS, 22) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
|
||||
@@ -78,5 +78,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spell::SpellCastLogData&
|
||||
data.WriteBit(false);
|
||||
// data << float // Unk data if bit is true
|
||||
data.FlushBits();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Packets/ChatPackets.h"
|
||||
#include "Packets/ClientConfigPackets.h"
|
||||
#include "Packets/CombatPackets.h"
|
||||
#include "Packets/EquipmentSetPackets.h"
|
||||
#include "Packets/GuildPackets.h"
|
||||
#include "Packets/MiscPackets.h"
|
||||
#include "Packets/MovementPackets.h"
|
||||
@@ -278,7 +279,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_ENABLETAXI, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleTaxiQueryAvailableNodes );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_ENABLE_NAGLE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_EarlyProccess );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_EQUIPMENT_SET_DELETE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleEquipmentSetDelete );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_EQUIPMENT_SET_SAVE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleEquipmentSetSave );
|
||||
DEFINE_HANDLER(CMSG_EQUIPMENT_SET_SAVE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::EquipmentSet::SaveEquipmentSet, &WorldSession::HandleEquipmentSetSave);
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_EQUIPMENT_SET_USE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleEquipmentSetUse );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_FACTION_BONUS_INFO, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_FAR_SIGHT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleFarSightOpcode );
|
||||
@@ -889,8 +890,8 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_ENABLE_BARBER_SHOP, STATUS_UNHANDLED);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_ENCHANTMENTLOG, STATUS_UNHANDLED);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_ENVIRONMENTALDAMAGELOG, STATUS_UNHANDLED);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_EQUIPMENT_SET_LIST, STATUS_UNHANDLED);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_EQUIPMENT_SET_SAVED, STATUS_UNHANDLED);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_EQUIPMENT_SET_LIST, STATUS_NEVER);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_EQUIPMENT_SET_SAVED, STATUS_NEVER);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_EQUIPMENT_SET_USE_RESULT, STATUS_UNHANDLED);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_EXPECTED_SPAM_RECORDS, STATUS_UNHANDLED);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_EXPLORATION_EXPERIENCE, STATUS_UNHANDLED);
|
||||
|
||||
@@ -126,6 +126,11 @@ namespace WorldPackets
|
||||
class AttackStop;
|
||||
}
|
||||
|
||||
namespace EquipmentSet
|
||||
{
|
||||
class SaveEquipmentSet;
|
||||
}
|
||||
|
||||
namespace Guild
|
||||
{
|
||||
class QueryGuildInfo;
|
||||
@@ -1095,7 +1100,7 @@ class WorldSession
|
||||
void HandleRemoveGlyph(WorldPacket& recvData);
|
||||
void HandleQueryInspectAchievements(WorldPacket& recvData);
|
||||
void HandleGuildAchievementProgressQuery(WorldPacket& recvData);
|
||||
void HandleEquipmentSetSave(WorldPacket& recvData);
|
||||
void HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipmentSet& packet);
|
||||
void HandleEquipmentSetDelete(WorldPacket& recvData);
|
||||
void HandleEquipmentSetUse(WorldPacket& recvData);
|
||||
void HandleWorldStateUITimerUpdate(WorldPacket& recvData);
|
||||
|
||||
Reference in New Issue
Block a user