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

@@ -3706,7 +3706,7 @@ class spell_gen_despawn_self : public SpellScript
void HandleDummy(SpellEffIndex effIndex)
{
if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_SCRIPT_EFFECT)
GetCaster()->ToCreature()->DespawnOrUnsummon(1);
GetCaster()->ToCreature()->DespawnOrUnsummon(1ms);
}
void Register() override

View File

@@ -302,7 +302,7 @@ class spell_hun_taming_the_beast : public AuraScript
{
if (Unit* target = GetTarget())
if (Creature* creature = target->ToCreature())
creature->DespawnOrUnsummon(1);
creature->DespawnOrUnsummon(1ms);
}
void Register() override

View File

@@ -347,7 +347,7 @@ class spell_item_rocket_chicken : public AuraScript
{
if (roll_chance_i(5))
{
GetTarget()->ToCreature()->DespawnOrUnsummon(8000);
GetTarget()->ToCreature()->DespawnOrUnsummon(8s);
GetTarget()->Kill(GetTarget(), GetTarget());
}
else if (roll_chance_i(50))
@@ -468,7 +468,7 @@ class spell_item_toxic_wasteling : public SpellScript
GetCaster()->GetMotionMaster()->MoveIdle();
GetCaster()->ToCreature()->SetHomePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f);
GetCaster()->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 12.0f, 3.0f, 1);
target->DespawnOrUnsummon(1500);
target->DespawnOrUnsummon(1500ms);
}
}
@@ -505,7 +505,7 @@ class spell_item_lil_xt : public SpellScript
return;
if (GetCaster()->IsCreature() && GetCaster()->ToCreature()->AI())
GetCaster()->ToCreature()->AI()->Talk(2);
target->DespawnOrUnsummon(500);
target->DespawnOrUnsummon(500ms);
}
void Register() override

View File

@@ -68,7 +68,7 @@ class spell_q11065_wrangle_some_aether_rays_aura : public AuraScript
{
cr->CastSpell(player, 40926, true);
cr->GetMotionMaster()->MoveFollow(player, 5.0f, 2 * M_PI * rand_norm());
ar->ToCreature()->DespawnOrUnsummon(500);
ar->ToCreature()->DespawnOrUnsummon(500ms);
}
}
}
@@ -756,10 +756,10 @@ private:
uint32 _originalEntry;
uint32 _newEntry;
bool _shouldAttack;
uint32 _despawnTime;
Milliseconds _despawnTime;
public:
spell_generic_quest_update_entry_SpellScript(uint16 spellEffect, uint8 effIndex, uint32 originalEntry, uint32 newEntry, bool shouldAttack, uint32 despawnTime = 0) :
spell_generic_quest_update_entry_SpellScript(uint16 spellEffect, uint8 effIndex, uint32 originalEntry, uint32 newEntry, bool shouldAttack, Milliseconds despawnTime = 0ms) :
SpellScript(), _spellEffect(spellEffect), _effIndex(effIndex), _originalEntry(originalEntry),
_newEntry(newEntry), _shouldAttack(shouldAttack), _despawnTime(despawnTime) { }
@@ -772,7 +772,7 @@ public:
if (_shouldAttack && creatureTarget->IsAIEnabled)
creatureTarget->AI()->AttackStart(GetCaster());
if (_despawnTime)
if (_despawnTime > 0ms)
creatureTarget->DespawnOrUnsummon(_despawnTime);
}
}
@@ -900,10 +900,11 @@ enum Quests6124_6129Data
NPC_SICKLY_GAZELLE = 12296,
NPC_CURED_GAZELLE = 12297,
NPC_SICKLY_DEER = 12298,
NPC_CURED_DEER = 12299,
DESPAWN_TIME = 30000
NPC_CURED_DEER = 12299
};
constexpr Milliseconds DESPAWN_TIME = 30s;
class spell_q6124_6129_apply_salve : public SpellScript
{
PrepareSpellScript(spell_q6124_6129_apply_salve);
@@ -1372,7 +1373,7 @@ class spell_q12937_relief_for_the_fallen : public AuraScript
if (target && target->ToCreature())
{
caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER);
target->ToCreature()->DespawnOrUnsummon(5000);
target->ToCreature()->DespawnOrUnsummon(5s);
target->SetStandState(UNIT_STAND_STATE_STAND);
target->ToCreature()->AI()->Talk(TALK_FALLEN_EARTHEN_HEALED);
@@ -1513,7 +1514,7 @@ class spell_q9874_liquid_fire : public SpellScript
{
caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT);
target->CastSpell(target, SPELL_FLAMES, true);
target->DespawnOrUnsummon(20000);
target->DespawnOrUnsummon(20s);
}
}
@@ -1560,7 +1561,7 @@ class spell_q12805_lifeblood_dummy : public SpellScript
caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT);
target->CastSpell(target, uint32(GetEffectValue()), true);
target->DespawnOrUnsummon(2000);
target->DespawnOrUnsummon(2s);
}
void Register() override
@@ -2144,7 +2145,7 @@ class spell_q12690_burst_at_the_seams : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
GetCaster()->ToCreature()->DespawnOrUnsummon(2 * IN_MILLISECONDS);
GetCaster()->ToCreature()->DespawnOrUnsummon(2s);
}
void Register() override