mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
[8040] Implement Creature::ForcedDespawn and ACTION_T_FORCE_DESPAWN for EventAI. Author: NoFantasy
--HG-- branch : trunk
This commit is contained in:
@@ -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
|
||||
=========================================
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user