aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/SpellHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers/SpellHandler.cpp')
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp80
1 files changed, 33 insertions, 47 deletions
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 2d3090825da..6d3b2a7cb5b 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -501,11 +501,9 @@ void WorldSession::HandleSpellClick(WorldPacket& recvData)
unit->HandleSpellClick(_player);
}
-void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
+void WorldSession::HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData& packet)
{
- ObjectGuid guid;
- recvData >> guid;
- recvData.read_skip<uint32>(); // DisplayId ?
+ ObjectGuid guid = packet.UnitGUID;
// Get unit for which data is needed by client
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
@@ -520,27 +518,25 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
if (!creator)
return;
- WorldPacket data(SMSG_MIRROR_IMAGE_COMPONENTED_DATA, 68);
- data << guid;
- data << uint32(creator->GetDisplayId());
- data << uint8(creator->getRace());
- data << uint8(creator->getGender());
- data << uint8(creator->getClass());
-
- if (creator->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = creator->ToPlayer())
{
- Player* player = creator->ToPlayer();
- Guild* guild = NULL;
+ WorldPackets::Spells::MirrorImageComponentedData packet;
+ packet.UnitGUID = guid;
+ packet.DisplayID = creator->GetDisplayId();
+ packet.RaceID = creator->getRace();
+ packet.Gender = creator->getGender();
+ packet.ClassID = creator->getClass();
- if (ObjectGuid::LowType guildId = player->GetGuildId())
- guild = sGuildMgr->GetGuildById(guildId);
+ Guild* guild = player->GetGuild();
- data << uint8(player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_SKIN_ID));
- data << uint8(player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_FACE_ID));
- data << uint8(player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_STYLE_ID));
- data << uint8(player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_COLOR_ID));
- data << uint8(player->GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_FACIAL_STYLE));
- data << (guild ? guild->GetGUID() : ObjectGuid::Empty);
+ packet.SkinColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_SKIN_ID);
+ packet.FaceVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_FACE_ID);
+ packet.HairVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_STYLE_ID);
+ packet.HairColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_COLOR_ID);
+ packet.BeardVariation = player->GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_FACIAL_STYLE);
+ packet.GuildGUID = (guild ? guild->GetGUID() : ObjectGuid::Empty);
+
+ packet.ItemDisplayID.reserve(11);
static EquipmentSlots const itemSlots[] =
{
@@ -559,38 +555,28 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
};
// Display items in visible slots
- for (EquipmentSlots const* itr = &itemSlots[0]; *itr != EQUIPMENT_SLOT_END; ++itr)
+ for (auto const& slot : itemSlots)
{
- if (*itr == EQUIPMENT_SLOT_HEAD && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM))
- data << uint32(0);
- else if (*itr == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK))
- data << uint32(0);
- else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr))
- data << uint32(item->GetDisplayId());
+ uint32 itemDisplayId;
+ if ((slot == EQUIPMENT_SLOT_HEAD && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM)) ||
+ (slot == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK)))
+ itemDisplayId = 0;
+ else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ itemDisplayId = item->GetDisplayId();
else
- data << uint32(0);
+ itemDisplayId = 0;
+
+ packet.ItemDisplayID.push_back(itemDisplayId);
}
+ SendPacket(packet.Write());
}
else
{
- // Skip player data for creatures
- data << uint8(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
+ WorldPackets::Spells::MirrorImageCreatureData packet;
+ packet.UnitGUID = guid;
+ packet.DisplayID = creator->GetDisplayId();
+ SendPacket(packet.Write());
}
-
- SendPacket(&data);
}
void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket)