Тема: [fix] Mirror Image
Показать сообщение отдельно
Старый 24.03.2010, 05:28   #36
SeT
Ученый
 
Аватар для SeT
 
Регистрация: 13.03.2010
Сообщений: 110
Сказал(а) спасибо: 55
Поблагодарили 23 раз(а) в 14 сообщениях
SeT На верном пути
По умолчанию

Код:
+void WorldSession::HandleMirrrorImageDataRequest( WorldPacket & recv_data )
+{
+	sLog.outDebug("WORLD: CMSG_GET_MIRRORIMAGE_DATA");
+	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)pCreator->GetGuildId();  // 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 (*itr == EQUIPMENT_SLOT_HEAD && pCreator->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM))
+				data << (uint32)0;
+			else if (*itr == EQUIPMENT_SLOT_BACK && pCreator->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK))
+				data << (uint32)0;
+			else 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 );
 }
SeT вне форума   Ответить с цитированием
Пользователь сказал cпасибо:
MaxXx2021 (24.03.2010)