aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-06 10:13:33 -0500
committermegamage <none@none>2009-05-06 10:13:33 -0500
commit2cdea49d81ce2bb4e19df594c019a42fb4ba0c5b (patch)
tree4e08d48a141d74c7830df0b29d1d6ed6a104c3c2 /src
parent22667d3ee6ee258e60a711e2d1a504a9769d071c (diff)
*Fix a bug that minipet cannot be dismissed.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/PetHandler.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index 15dac10688f..42d0093510b 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -161,17 +161,27 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
break;
}
case COMMAND_ABANDON: // abandon (hunter pet) or dismiss (summoned pet)
- if(((Creature*)pet)->isPet())
+ if(pet->GetCharmerGUID() == GetPlayer()->GetGUID())
{
- Pet* p = (Pet*)pet;
- if(p->getPetType() == HUNTER_PET)
- _player->RemovePet(p,PET_SAVE_AS_DELETED);
- else
- //dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
- p->setDeathState(CORPSE);
+ if(GetPlayer()->m_seer != pet)
+ _player->StopCastingCharm();
+ }
+ else if(pet->GetOwnerGUID() == GetPlayer()->GetGUID())
+ {
+ assert(pet->GetTypeId() == TYPEID_UNIT);
+ if(((Creature*)pet)->isPet())
+ {
+ if(((Pet*)pet)->getPetType() == HUNTER_PET)
+ GetPlayer()->RemovePet((Pet*)pet, PET_SAVE_AS_DELETED);
+ else
+ //dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
+ pet->setDeathState(CORPSE);
+ }
+ else if(((Creature*)pet)->HasSummonMask(SUMMON_MASK_MINION))
+ {
+ ((Minion*)pet)->UnSummon();
+ }
}
- else // charmed or possessed
- _player->StopCastingCharm();
break;
default:
sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", flag, spellid);