void Pet::setDeathState(DeathState s) // overwrite virtual Creature::setDeathState and Unit::setDeathState { Creature::setDeathState(s); if (getDeathState() == CORPSE) { if (getPetType() == HUNTER_PET) { // pet corpse non lootable and non skinnable SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); //lose happiness when died and not in BG/Arena MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId()); if (!mapEntry || (mapEntry->map_type != MAP_ARENA && mapEntry->map_type != MAP_BATTLEGROUND)) ModifyPower(POWER_HAPPINESS, -HAPPINESS_LEVEL_SIZE); //SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); } } else if (getDeathState() == ALIVE) { //RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); CastPetAuras(true); } }
void Creature::Respawn() { if(getDeathState()==CORPSE) { m_deathTimer = 0; Update(0); // despawn corpse } if(getDeathState()==DEAD) { sDatabase.PExecute("DELETE FROM `creature_respawn` WHERE `guid` = '%u' AND `instance` = '%u'", m_DBTableGuid, GetInstanceId()); m_respawnTime = time(NULL); // respawn at next tick } }
bool TemporarySummon::IsDespawned() const { return !m_isActive || getDeathState() == DEAD; }