aboutsummaryrefslogtreecommitdiff
path: root/src/game/PetHandler.cpp
diff options
context:
space:
mode:
authorclick <none@none>2010-04-29 23:24:31 +0200
committerclick <none@none>2010-04-29 23:24:31 +0200
commitf4dcdf9507fe6832755c140f762c604c3ba04085 (patch)
tree4372bff71dae80433d44c828698a3e38403121ce /src/game/PetHandler.cpp
parentcb0cb962831a2b0c62b0a67b750569ca3049327e (diff)
* Properly dismiss vanitypets (implements use of CMSG_DISMISS_CRITTER)
Some small code cleanups --HG-- branch : trunk
Diffstat (limited to 'src/game/PetHandler.cpp')
-rw-r--r--src/game/PetHandler.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index abfb964237a..34e6845762b 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -32,6 +32,28 @@
#include "Pet.h"
#include "World.h"
+void WorldSession::HandleDismissCritter(WorldPacket &recv_data)
+{
+ uint64 guid;
+ recv_data >> guid;
+
+ sLog.outDebug("WORLD: Received CMSG_DISMISS_CRITTER for GUID %u", guid);
+
+ Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
+
+ if (!pet)
+ {
+ sLog.outError("Vanitypet %u does not exist", uint32(GUID_LOPART(guid)));
+ return;
+ }
+
+ if (_player->GetCritterGUID() == pet->GetGUID())
+ {
+ if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isSummon())
+ pet->ToTempSummon()->UnSummon();
+ }
+}
+
void WorldSession::HandlePetAction(WorldPacket & recv_data)
{
uint64 guid1;