refactor(Core): DespawnOrUnsummon (#23141)

This commit is contained in:
天鹭
2025-10-13 14:36:23 +08:00
committed by GitHub
parent 8e2e30328f
commit 53238a68d3
148 changed files with 363 additions and 366 deletions

View File

@@ -1436,7 +1436,7 @@ class spell_illidan_parasitic_shadowfiend_trigger : public SpellScript
{
PreventHitDefaultEffect(effIndex);
if (Creature* target = GetHitCreature())
target->DespawnOrUnsummon(1);
target->DespawnOrUnsummon(1ms);
}
void Register() override
@@ -1692,7 +1692,7 @@ class spell_illidan_cage_trap : public SpellScript
if (GetCaster()->GetExactDist2d(target) < 4.0f)
{
target->AI()->DoAction(ACTION_ILLIDAN_CAGED);
GetCaster()->ToCreature()->DespawnOrUnsummon(1);
GetCaster()->ToCreature()->DespawnOrUnsummon(1ms);
if (GameObject* gobject = GetCaster()->FindNearestGameObject(GO_CAGE_TRAP, 10.0f))
gobject->SetLootState(GO_JUST_DEACTIVATED);
}

View File

@@ -107,7 +107,7 @@ public:
{
summoner->GetAI()->DoAction(_action);
_owner.SetStandState(UNIT_STAND_STATE_SUBMERGED);
_owner.DespawnOrUnsummon(200);
_owner.DespawnOrUnsummon(200ms);
}
return true;
}

View File

@@ -391,7 +391,7 @@ struct npc_creature_generator_akama : public ScriptedAI
void SummonedCreatureDies(Creature* summon, Unit*) override
{
spawnCounter--;
summon->DespawnOrUnsummon(10000);
summon->DespawnOrUnsummon(10s);
summons.Despawn(summon);
}

View File

@@ -269,7 +269,7 @@ struct boss_fathomguard_sharkkis : public ScriptedAI
{
me->CastSpell(karathress, SPELL_POWER_OF_SHARKKIS, true);
karathress->AI()->Talk(SAY_GAIN_ABILITY2);
me->DespawnOrUnsummon(1000);
me->DespawnOrUnsummon(1s);
}
}
@@ -452,7 +452,7 @@ struct boss_fathomguard_tidalvess : public ScriptedAI
{
me->CastSpell(karathress, SPELL_POWER_OF_TIDALVESS, true);
karathress->AI()->Talk(SAY_GAIN_ABILITY1);
me->DespawnOrUnsummon(1000);
me->DespawnOrUnsummon(1s);
}
}
@@ -546,7 +546,7 @@ struct boss_fathomguard_caribdis : public ScriptedAI
{
me->CastSpell(karathress, SPELL_POWER_OF_CARIBDIS, true);
karathress->AI()->Talk(SAY_GAIN_ABILITY3);
me->DespawnOrUnsummon(1000);
me->DespawnOrUnsummon(1s);
}
}

View File

@@ -88,7 +88,7 @@ struct boss_the_lurker_below : public BossAI
pool->SetRespawnTime(10);
pool->SaveRespawnTime(10);
}
me->DespawnOrUnsummon(2000);
me->DespawnOrUnsummon(2s);
}
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*type*/, SpellSchoolMask /*school*/) override

View File

@@ -234,7 +234,7 @@ class spell_serpentshrine_cavern_serpentshrine_parasite_trigger : public SpellSc
{
PreventHitDefaultEffect(effIndex);
if (Creature* target = GetHitCreature())
target->DespawnOrUnsummon(1);
target->DespawnOrUnsummon(1ms);
}
void Register() override

View File

@@ -619,7 +619,7 @@ struct npc_ahune_ice_spear_bunny : public ScriptedAI
_scheduler.Schedule(2500ms, [this](TaskContext /*task*/)
{
DoCastSelf(SPELL_ICE_SPEAR_DELAY);
me->DespawnOrUnsummon(3500);
me->DespawnOrUnsummon(3500ms);
});
}

View File

@@ -123,7 +123,7 @@ struct npc_underbog_mushroom : public ScriptedAI
context.Schedule(4s, [this](TaskContext /*context*/)
{
me->RemoveAurasDueToSpell(SPELL_GROW);
me->DespawnOrUnsummon(2000);
me->DespawnOrUnsummon(2s);
});
}
else

View File

@@ -155,7 +155,7 @@ struct boss_nazan : public ScriptedAI
void EnterEvadeMode(EvadeReason /*why*/) override
{
me->DespawnOrUnsummon(1);
me->DespawnOrUnsummon(1ms);
}
void JustEngagedWith(Unit*) override
@@ -262,7 +262,7 @@ struct boss_vazruden : public ScriptedAI
void EnterEvadeMode(EvadeReason /*why*/) override
{
Talk(SAY_WIPE);
me->DespawnOrUnsummon(1);
me->DespawnOrUnsummon(1ms);
}
void JustEngagedWith(Unit*) override

View File

@@ -284,7 +284,7 @@ struct npc_target_trigger : public ScriptedAI
_scheduler.Schedule(5s, [this](TaskContext /*context*/)
{
DoCastSelf(SPELL_DEBRIS_DAMAGE);
me->DespawnOrUnsummon(6000);
me->DespawnOrUnsummon(6s);
});
}
}

View File

@@ -1013,7 +1013,7 @@ class spell_kaelthas_flame_strike : public AuraScript
{
GetUnitOwner()->RemoveAllAuras();
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FLAME_STRIKE_DAMAGE, true);
GetUnitOwner()->ToCreature()->DespawnOrUnsummon(2000);
GetUnitOwner()->ToCreature()->DespawnOrUnsummon(2s);
}
void Register() override

View File

@@ -116,7 +116,7 @@ public:
if (Creature* bunny = GetClosestCreatureWithEntry(me, NPC_EXPLOSION_BUNNY, 200.0f))
bunny->CastSpell(nullptr, SPELL_EXPLOSION, TRIGGERED_NONE);
if (Creature* cannon = ObjectAccessor::GetCreature(*me, CannonGUID))
cannon->DespawnOrUnsummon(5000);
cannon->DespawnOrUnsummon(5s);
}
me->SummonGameObject(GO_BIG_FIRE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 60);
@@ -460,7 +460,7 @@ public:
Talk(SAY_SPELL_INFLUENCE, who);
/// @todo Move the below to updateAI and run if this statement == true
DoCast(who, SPELL_DISPELLING_ANALYSIS, true);
bird->DespawnOrUnsummon(2000);
bird->DespawnOrUnsummon(2s);
}
}
}
@@ -775,7 +775,7 @@ public:
if (GameObject* relic = me->FindNearestGameObject(large ? GO_APEXIS_MONUMENT : GO_APEXIS_RELIC, searchDistance))
relic->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
me->DespawnOrUnsummon(1000);
me->DespawnOrUnsummon(1s);
}
/*
@@ -1086,7 +1086,7 @@ public:
// Spell 37392 does not exist in dbc, manually spawning
me->SummonCreature(NPC_OSCILLATING_FREQUENCY_SCANNER_TOP_BUNNY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 50000);
me->SummonGameObject(GO_OSCILLATING_FREQUENCY_SCANNER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 50);
me->DespawnOrUnsummon(50000);
me->DespawnOrUnsummon(50s);
}
timer = 500;

View File

@@ -464,7 +464,7 @@ public:
player->KilledMonsterCredit(NPC_MAGHAR_PRISONER);
prisoner->AI()->Talk(SAY_FREE, player);
prisoner->DespawnOrUnsummon(6000);
prisoner->DespawnOrUnsummon(6s);
}
return true;