diff options
-rw-r--r-- | doc/EventAI.txt | 7 | ||||
-rw-r--r-- | src/game/Creature.cpp | 7 | ||||
-rw-r--r-- | src/game/Creature.h | 2 | ||||
-rw-r--r-- | src/game/CreatureEventAI.cpp | 5 | ||||
-rw-r--r-- | src/game/CreatureEventAI.h | 3 | ||||
-rw-r--r-- | src/game/CreatureEventAIMgr.cpp | 1 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 8 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 23 |
8 files changed, 33 insertions, 23 deletions
diff --git a/doc/EventAI.txt b/doc/EventAI.txt index 0f411b62833..2557bada995 100644 --- a/doc/EventAI.txt +++ b/doc/EventAI.txt @@ -132,6 +132,7 @@ Params are always read from Param1, then Param2, then Param3. 38 ACTION_T_ZONE_COMBAT_PULSE No Params Places all players within the instance into combat with the creature. Only works in combat and only works inside of instances. 39 ACTION_T_CALL_FOR_HELP Radius Call any friendly creatures (if its not in combat/etc) in radius attack creature target. 40 ACTION_T_SET_SHEATH Sheath Let set sheath state for creature (0-no weapon show (not used mostly by creatures), 1-melee weapon show, 2-ranged weapon show) +41 ACTION_T_FORCE_DESPAWN No Params Despawns the creature * = Use -1 to specify that if this param is picked to do nothing. Random is constant between actions within an event. So if you have a random Yell and a random Sound they will match up (ex: param2 with param2) @@ -725,6 +726,12 @@ Let set sheath state for creature. Note: SHEATH_STATE_RANGED case work in combat state only if combat not start as melee commands. This possible setup by set ar event AI start (single used EVENT_T_TIMER_OOC set ACTION_T_COMBAT_MOVEMENT 0 for creature that prefered ranged attack) +------------------------- +41 ACTION_T_FORCE_DESPAWN +------------------------- +Despawns the creature (in or out of combat) +No parameters + ========================================= Target Types ========================================= diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 56c7ce8ef75..a099bdec797 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1854,6 +1854,13 @@ void Creature::Respawn(bool force) SetToNotify(); } +void Creature::ForcedDespawn() +{ + setDeathState(JUST_DIED); + RemoveCorpse(); + SetHealth(0); // just for nice GM-mode view +} + bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo) { if (!spellInfo) diff --git a/src/game/Creature.h b/src/game/Creature.h index c1047e31977..b3433c2f1f4 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -669,6 +669,8 @@ class TRINITY_DLL_SPEC Creature : public Unit void RemoveCorpse(); bool isDeadByDefault() const { return m_isDeadByDefault; }; + void ForcedDespawn(); + time_t const& GetRespawnTime() const { return m_respawnTime; } time_t GetRespawnTimeEx() const; void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(NULL) + respawn : 0; } diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 3d83b2c4fb4..8aa4cf38b49 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -791,6 +791,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 m_creature->SetSheath(SheathState(action.set_sheath.sheath)); break; } + case ACTION_T_FORCE_DESPAWN: + { + m_creature->ForcedDespawn(); + break; + } } } diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index db9cb680670..ccfd997d9f7 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -111,7 +111,8 @@ enum EventAI_ActionType ACTION_T_ATTACK_START_PULSE = 103, //Distance ACTION_T_SUMMON_GO = 104, //GameObjectID, DespawnTime in ms - ACTION_T_END, + ACTION_T_FORCE_DESPAWN = 41, // No Params + ACTION_T_END = 105, }; enum Target diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp index 643a5a3212a..38cc84177e4 100644 --- a/src/game/CreatureEventAIMgr.cpp +++ b/src/game/CreatureEventAIMgr.cpp @@ -666,6 +666,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() case ACTION_T_FLEE_FOR_ASSIST: //No Params case ACTION_T_DIE: //No Params case ACTION_T_ZONE_COMBAT_PULSE: //No Params + case ACTION_T_FORCE_DESPAWN: //No Params case ACTION_T_AUTO_ATTACK: //AllowAttackState (0 = stop attack, anything else means continue attacking) case ACTION_T_COMBAT_MOVEMENT: //AllowCombatMovement (0 = stop combat based movement, anything else continue attacking) case ACTION_T_RANGED_MOVEMENT: //Distance, Angle diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index abc0e97206a..bf765f65c74 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1884,9 +1884,7 @@ void AuraEffect::TriggerSpell() player->AutoStoreLoot(creature->GetCreatureInfo()->SkinLootId,LootTemplates_Skinning,true); - creature->setDeathState(JUST_DIED); - creature->RemoveCorpse(); - creature->SetHealth(0); // just for nice GM-mode view + creature->ForcedDespawn(); } return; } @@ -2035,9 +2033,7 @@ void AuraEffect::TriggerSpell() Creature* creatureTarget = (Creature*)m_target; - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view + creatureTarget->ForcedDespawn(); return; } // // Magic Sucker Device timer diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index a4fc30cb2f7..8f23f5e6f81 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -896,9 +896,8 @@ void Spell::EffectDummy(uint32 i) return; Creature* creatureTarget = (Creature*)unitTarget; - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view + + creatureTarget->ForcedDespawn(); return; } case 16589: // Noggenfogger Elixir @@ -956,9 +955,7 @@ void Spell::EffectDummy(uint32 i) GameObject* Crystal_Prison = m_caster->SummonGameObject(179644, creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), creatureTarget->GetOrientation(), 0, 0, 0, 0, creatureTarget->GetRespawnTime()-time(NULL)); sLog.outDebug("SummonGameObject at SpellEfects.cpp EffectDummy for Spell 23019"); - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view + creatureTarget->ForcedDespawn(); WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << uint64(Crystal_Prison->GetGUID()); @@ -1176,9 +1173,7 @@ void Spell::EffectDummy(uint32 i) Creature* creatureTarget = (Creature*)unitTarget; - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view + creatureTarget->ForcedDespawn(); //cast spell Raptor Capture Credit m_caster->CastSpell(m_caster, 42337, true, NULL); @@ -1267,9 +1262,7 @@ void Spell::EffectDummy(uint32 i) Creature* creatureTarget = (Creature*)unitTarget; - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view + creatureTarget->ForcedDespawn(); return; } @@ -4018,10 +4011,8 @@ void Spell::EffectTameCreature(uint32 /*i*/) if(!pet) // in versy specific state like near world end/etc. return; - // kill original creature - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view + // "kill" original creature + creatureTarget->ForcedDespawn(); uint32 level = (creatureTarget->getLevel() < (m_caster->getLevel() - 5)) ? (m_caster->getLevel() - 5) : creatureTarget->getLevel(); |