aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellHandler.cpp
diff options
context:
space:
mode:
authorQAston <none@none>2009-07-22 17:10:30 +0200
committerQAston <none@none>2009-07-22 17:10:30 +0200
commit2ff21d4cefc6c871790676de9461f5bd105bde66 (patch)
tree792e50dfdd0f3dc39624e73cda72633db491ceb0 /src/game/SpellHandler.cpp
parenta00473d79510f80ae1fd6b4ed882d0e696c22659 (diff)
*Implement Aura Type 247 (SPELL_AURA_CLONE_CASTER) and 279 (SPELL_AURA_INITIALIZE_IMAGES)
*Handle CMSG_GET_MIRRORIMAGE_DATA opcode. *Save Minions follow angle to allow themmoving in a formation *Improvements in SpellAI: correctly evade and select attack target for creatures without threat list *Use SpellAI instead of PetAI for not controllable guardians *Only guardians with SUMMON_TYPE_PET are controllable now *Add script and template data for Mirror Image. *Thanks to Drahy for help. --HG-- branch : trunk
Diffstat (limited to 'src/game/SpellHandler.cpp')
-rw-r--r--src/game/SpellHandler.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 74313eaa38b..dd88ef8e50a 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -537,3 +537,79 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
if(unit->isVehicle())
_player->EnterVehicle((Vehicle*)unit);
}
+
+void WorldSession::HandleMirrrorImageDataRequest( WorldPacket & recv_data )
+{
+ sLog.outDebug("WORLD: CMSG_GET_MIRRORIMAGE_DATA");
+ CHECK_PACKET_SIZE(recv_data, 8);
+ uint64 guid;
+ recv_data >> guid;
+
+ // Get unit for which data is needed by client
+ Unit *unit = ObjectAccessor::GetObjectInWorld(guid, (Unit*)NULL);
+ if(!unit)
+ return;
+ // Get creator of the unit
+ Unit *creator = ObjectAccessor::GetObjectInWorld(unit->GetCreatorGUID(),(Unit*)NULL);
+ if (!creator)
+ return;
+ WorldPacket data(SMSG_MIRRORIMAGE_DATA, 68);
+ data << (uint64)guid;
+ data << (uint32)creator->GetDisplayId();
+ if (creator->GetTypeId()==TYPEID_PLAYER)
+ {
+ Player * pCreator = (Player *)creator;
+ data << (uint8)pCreator->getRace();
+ data << (uint8)pCreator->getGender();
+ data << (uint8)pCreator->getClass();
+ data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 0); // skin
+
+ data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 1); // face
+ data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 2); // hair
+ data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 3); // haircolor
+ data << (uint8)pCreator->GetByteValue(PLAYER_BYTES_2, 0); // facialhair
+
+ data << (uint32)0; // unk
+ static const EquipmentSlots ItemSlots[] =
+ {
+ EQUIPMENT_SLOT_HEAD,
+ EQUIPMENT_SLOT_SHOULDERS,
+ EQUIPMENT_SLOT_BODY,
+ EQUIPMENT_SLOT_CHEST,
+ EQUIPMENT_SLOT_WAIST,
+ EQUIPMENT_SLOT_LEGS,
+ EQUIPMENT_SLOT_FEET,
+ EQUIPMENT_SLOT_WRISTS,
+ EQUIPMENT_SLOT_HANDS,
+ EQUIPMENT_SLOT_BACK,
+ EQUIPMENT_SLOT_TABARD,
+ EQUIPMENT_SLOT_END
+ };
+ // Display items in visible slots
+ for (EquipmentSlots const* itr = &ItemSlots[0];*itr!=EQUIPMENT_SLOT_END;++itr)
+ if (Item const *item = pCreator->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr))
+ data << (uint32)item->GetProto()->DisplayInfoID;
+ else
+ data << (uint32)0;
+ }
+ else
+ {
+ // Skip player data for creatures
+ 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;
+ data << (uint32)0;
+ }
+ SendPacket( &data );
+}
+