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
+2 -2
View File
@@ -50,9 +50,9 @@ AISpellInfoType* GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i];
* @param WorldObject target The target of the speech, in case it has elements such as $n, where the target's name will be referrenced. * @param WorldObject target The target of the speech, in case it has elements such as $n, where the target's name will be referrenced.
* @param Milliseconds delay Delay until the creature says the text line. Creatures will talk immediately by default. * @param Milliseconds delay Delay until the creature says the text line. Creatures will talk immediately by default.
*/ */
void CreatureAI::Talk(uint8 id, WorldObject const* target /*= nullptr*/, Milliseconds delay /*= 0s*/) void CreatureAI::Talk(uint8 id, WorldObject const* target /*= nullptr*/, Milliseconds delay /*= 0ms*/)
{ {
if (delay > Seconds::zero()) if (delay > 0ms)
{ {
ObjectGuid targetGuid; ObjectGuid targetGuid;
+1 -1
View File
@@ -94,7 +94,7 @@ public:
EVADE_REASON_OTHER EVADE_REASON_OTHER
}; };
void Talk(uint8 id, WorldObject const* whisperTarget = nullptr, Milliseconds delay = 0s); void Talk(uint8 id, WorldObject const* whisperTarget = nullptr, Milliseconds delay = 0ms);
void Talk(uint8 id, Milliseconds delay) { Talk(id, nullptr, delay); } void Talk(uint8 id, Milliseconds delay) { Talk(id, nullptr, delay); }
WorldObject* GetSummoner() const; WorldObject* GetSummoner() const;
@@ -68,7 +68,7 @@ void SummonList::DespawnEntry(uint32 entry)
} }
} }
void SummonList::DespawnAll(uint32 delay /*= 0*/) void SummonList::DespawnAll(Milliseconds delay /*= 0ms*/)
{ {
while (!storage_.empty()) while (!storage_.empty())
{ {
@@ -325,13 +325,13 @@ void ScriptedAI::ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax
return; return;
} }
scheduler.Schedule(timerMin == 0s ? timerMax : timerMin, timerMax, [exec, repeatMin, repeatMax, uniqueId](TaskContext context) scheduler.Schedule(timerMin == 0ms ? timerMax : timerMin, timerMax, [exec, repeatMin, repeatMax, uniqueId](TaskContext context)
{ {
exec(); exec();
if (!uniqueId) if (!uniqueId)
{ {
repeatMax > 0s ? context.Repeat(repeatMin, repeatMax) : context.Repeat(repeatMin); repeatMax > 0ms ? context.Repeat(repeatMin, repeatMax) : context.Repeat(repeatMin);
} }
}); });
@@ -654,7 +654,7 @@ void BossAI::_JustEngagedWith()
ScheduleTasks(); ScheduleTasks();
if (callForHelpRange) if (callForHelpRange)
{ {
ScheduleTimedEvent(0s, [&] ScheduleTimedEvent(0ms, [&]
{ {
me->CallForHelp(callForHelpRange); me->CallForHelp(callForHelpRange);
}, 2s); }, 2s);
@@ -88,7 +88,7 @@ public:
void Summon(Creature const* summon) { storage_.push_back(summon->GetGUID()); } void Summon(Creature const* summon) { storage_.push_back(summon->GetGUID()); }
void Despawn(Creature const* summon) { storage_.remove(summon->GetGUID()); } void Despawn(Creature const* summon) { storage_.remove(summon->GetGUID()); }
void DespawnEntry(uint32 entry); void DespawnEntry(uint32 entry);
void DespawnAll(uint32 delay = 0); void DespawnAll(Milliseconds delay = 0ms);
bool IsAnyCreatureAlive() const; bool IsAnyCreatureAlive() const;
bool IsAnyCreatureWithEntryAlive(uint32 entry) const; bool IsAnyCreatureWithEntryAlive(uint32 entry) const;
bool IsAnyCreatureInCombat() const; bool IsAnyCreatureInCombat() const;
@@ -355,11 +355,11 @@ struct ScriptedAI : public CreatureAI
void ClearUniqueTimedEventsDone() { _uniqueTimedEvents.clear(); } void ClearUniqueTimedEventsDone() { _uniqueTimedEvents.clear(); }
// Schedules a timed event using task scheduler. // Schedules a timed event using task scheduler.
void ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax, std::function<void()> exec, Milliseconds repeatMin, Milliseconds repeatMax = 0s, uint32 uniqueId = 0); void ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax, std::function<void()> exec, Milliseconds repeatMin, Milliseconds repeatMax = 0ms, uint32 uniqueId = 0);
void ScheduleTimedEvent(Milliseconds timerMax, std::function<void()> exec, Milliseconds repeatMin, Milliseconds repeatMax = 0s, uint32 uniqueId = 0) { ScheduleTimedEvent(0s, timerMax, exec, repeatMin, repeatMax, uniqueId); }; void ScheduleTimedEvent(Milliseconds timerMax, std::function<void()> exec, Milliseconds repeatMin, Milliseconds repeatMax = 0ms, uint32 uniqueId = 0) { ScheduleTimedEvent(0ms, timerMax, exec, repeatMin, repeatMax, uniqueId); };
// Schedules a timed event using task scheduler that never repeats. Requires an unique non-zero ID. // Schedules a timed event using task scheduler that never repeats. Requires an unique non-zero ID.
void ScheduleUniqueTimedEvent(Milliseconds timer, std::function<void()> exec, uint32 uniqueId) { ScheduleTimedEvent(0s, timer, exec, 0s, 0s, uniqueId); }; void ScheduleUniqueTimedEvent(Milliseconds timer, std::function<void()> exec, uint32 uniqueId) { ScheduleTimedEvent(0ms, timer, exec, 0ms, 0ms, uniqueId); };
bool HealthBelowPct(uint32 pct) const { return me->HealthBelowPct(pct); } bool HealthBelowPct(uint32 pct) const { return me->HealthBelowPct(pct); }
bool HealthAbovePct(uint32 pct) const { return me->HealthAbovePct(pct); } bool HealthAbovePct(uint32 pct) const { return me->HealthAbovePct(pct); }
@@ -463,7 +463,7 @@ enum HealthCheckStatus
struct HealthCheckEventData struct HealthCheckEventData
{ {
HealthCheckEventData(uint8 healthPct, std::function<void()> exec, uint8 status = HEALTH_CHECK_SCHEDULED, bool allowedWhileCasting = true, Milliseconds Delay = 0s) : _healthPct(healthPct), _exec(exec), _status(status), _allowedWhileCasting(allowedWhileCasting), _delay(Delay) { }; HealthCheckEventData(uint8 healthPct, std::function<void()> exec, uint8 status = HEALTH_CHECK_SCHEDULED, bool allowedWhileCasting = true, Milliseconds Delay = 0ms) : _healthPct(healthPct), _exec(exec), _status(status), _allowedWhileCasting(allowedWhileCasting), _delay(Delay) { };
uint8 _healthPct; uint8 _healthPct;
std::function<void()> _exec; std::function<void()> _exec;
+1 -1
View File
@@ -410,7 +410,7 @@ void SmartAI::UpdatePath(const uint32 diff)
// Xinef: allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying // Xinef: allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me); GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me);
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
return; return;
} }
mEscortInvokerCheckTimer = 1000; mEscortInvokerCheckTimer = 1000;
@@ -415,7 +415,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
{ {
for (GuidUnorderedSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) for (GuidUnorderedSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
if (Creature* creature = GetCreature(*itr)) if (Creature* creature = GetCreature(*itr))
creature->DespawnOrUnsummon(1); creature->DespawnOrUnsummon(1ms);
m_vehicles[team].clear(); m_vehicles[team].clear();
} }
@@ -251,7 +251,7 @@ CreatureBaseStats const* CreatureBaseStats::GetBaseStats(uint8 level, uint8 unit
bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{ {
m_owner.DespawnOrUnsummon(0s, m_respawnTimer); // since we are here, we are not TempSummon as object type cannot change during runtime m_owner.DespawnOrUnsummon(0ms, m_respawnTimer); // since we are here, we are not TempSummon as object type cannot change during runtime
return true; return true;
} }
@@ -2174,12 +2174,12 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer)
// Xinef: Set new respawn time, ignore corpse decay time... // Xinef: Set new respawn time, ignore corpse decay time...
RemoveCorpse(true); RemoveCorpse(true);
if (forceRespawnTimer > Seconds::zero()) if (forceRespawnTimer > 0s)
if (GetMap()) if (GetMap())
GetMap()->ScheduleCreatureRespawn(GetGUID(), forceRespawnTimer); GetMap()->ScheduleCreatureRespawn(GetGUID(), forceRespawnTimer);
} }
void Creature::DespawnOrUnsummon(Milliseconds msTimeToDespawn /*= 0*/, Seconds forcedRespawnTimer) void Creature::DespawnOrUnsummon(Milliseconds msTimeToDespawn /*= 0ms*/, Seconds forcedRespawnTimer /*= 0s*/)
{ {
if (TempSummon* summon = this->ToTempSummon()) if (TempSummon* summon = this->ToTempSummon())
summon->UnSummon(msTimeToDespawn.count()); summon->UnSummon(msTimeToDespawn.count());
@@ -2204,7 +2204,7 @@ void Creature::DespawnOnEvade(Seconds respawnDelay)
return; return;
} }
DespawnOrUnsummon(Milliseconds(0), respawnDelay); DespawnOrUnsummon(0ms, respawnDelay);
} }
void Creature::InitializeReactState() void Creature::InitializeReactState()
+1 -2
View File
@@ -283,8 +283,7 @@ public:
void RemoveCorpse(bool setSpawnTime = true, bool skipVisibility = false); void RemoveCorpse(bool setSpawnTime = true, bool skipVisibility = false);
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer); void DespawnOrUnsummon(Milliseconds msTimeToDespawn = 0ms, Seconds forcedRespawnTimer = 0s);
void DespawnOrUnsummon(uint32 msTimeToDespawn = 0) { DespawnOrUnsummon(Milliseconds(msTimeToDespawn), 0s); };
void DespawnOnEvade(Seconds respawnDelay = 20s); void DespawnOnEvade(Seconds respawnDelay = 20s);
[[nodiscard]] time_t const& GetRespawnTime() const { return m_respawnTime; } [[nodiscard]] time_t const& GetRespawnTime() const { return m_respawnTime; }
@@ -929,7 +929,7 @@ void GameObject::AddUniqueUse(Player* player)
m_unique_users.insert(player->GetGUID()); m_unique_users.insert(player->GetGUID());
} }
void GameObject::DespawnOrUnsummon(Milliseconds delay, Seconds forceRespawnTime) void GameObject::DespawnOrUnsummon(Milliseconds delay /*= 0ms*/, Seconds forceRespawnTime /*= 0s*/)
{ {
if (delay > 0ms) if (delay > 0ms)
{ {
+3 -3
View File
@@ -692,7 +692,7 @@ void Pet::Update(uint32 diff)
} }
} }
if (m_duration > 0s) if (m_duration > 0ms)
{ {
if (m_duration > _diff) if (m_duration > _diff)
m_duration -= _diff; m_duration -= _diff;
@@ -708,7 +708,7 @@ void Pet::Update(uint32 diff)
if (getPowerType() == POWER_FOCUS) if (getPowerType() == POWER_FOCUS)
{ {
m_petRegenTimer -= _diff; m_petRegenTimer -= _diff;
if (m_petRegenTimer <= 0s) if (m_petRegenTimer <= 0ms)
{ {
m_petRegenTimer += PET_FOCUS_REGEN_INTERVAL; m_petRegenTimer += PET_FOCUS_REGEN_INTERVAL;
Regenerate(POWER_FOCUS); Regenerate(POWER_FOCUS);
@@ -1026,7 +1026,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
Unit* owner = GetOwner(); Unit* owner = GetOwner();
if (!owner) // just to be sure, asynchronous now if (!owner) // just to be sure, asynchronous now
{ {
DespawnOrUnsummon(1000); DespawnOrUnsummon(1s);
return false; return false;
} }
+1 -1
View File
@@ -52,7 +52,7 @@ public:
PetType getPetType() const { return m_petType; } PetType getPetType() const { return m_petType; }
void setPetType(PetType type) { m_petType = type; } void setPetType(PetType type) { m_petType = type; }
bool isControlled() const { return getPetType() == SUMMON_PET || getPetType() == HUNTER_PET; } bool isControlled() const { return getPetType() == SUMMON_PET || getPetType() == HUNTER_PET; }
bool isTemporarySummoned() const { return m_duration > 0s; } bool isTemporarySummoned() const { return m_duration > 0ms; }
bool IsPermanentPetFor(Player* owner) const; // pet have tab in character windows and set UNIT_FIELD_PETNUMBER bool IsPermanentPetFor(Player* owner) const; // pet have tab in character windows and set UNIT_FIELD_PETNUMBER
+3 -3
View File
@@ -9014,7 +9014,7 @@ Pet* Player::GetPet() const
return nullptr; return nullptr;
} }
Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration /*= 0s*/, uint32 healthPct /*= 0*/) Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration /*= 0ms*/, uint32 healthPct /*= 0*/)
{ {
PetStable& petStable = GetOrInitPetStable(); PetStable& petStable = GetOrInitPetStable();
@@ -9035,7 +9035,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
++itr; ++itr;
} }
if (duration > 0s) if (duration > 0ms)
pet->SetDuration(duration); pet->SetDuration(duration);
// Generate a new name for the newly summoned ghoul // Generate a new name for the newly summoned ghoul
@@ -9129,7 +9129,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
} }
} }
if (duration > 0s) if (duration > 0ms)
pet->SetDuration(duration); pet->SetDuration(duration);
if (NeedSendSpectatorData() && pet->GetCreatureTemplate()->family) if (NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
+1 -1
View File
@@ -1210,7 +1210,7 @@ public:
[[nodiscard]] PetStable const* GetPetStable() const { return m_petStable.get(); } [[nodiscard]] PetStable const* GetPetStable() const { return m_petStable.get(); }
[[nodiscard]] Pet* GetPet() const; [[nodiscard]] Pet* GetPet() const;
Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration = 0s, uint32 healthPct = 0); Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, Milliseconds duration = 0ms, uint32 healthPct = 0);
void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false); void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
bool CanPetResurrect(); bool CanPetResurrect();
bool IsExistPet(); bool IsExistPet();
+1 -1
View File
@@ -19681,7 +19681,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
else if (vehicleBase->IsCreature()) else if (vehicleBase->IsCreature())
{ {
vehicle->Uninstall(); vehicle->Uninstall();
vehicleBase->m_Events.AddEvent(new VehicleDespawnEvent(*vehicleBase, 2000), vehicleBase->m_Events.CalculateTime(2000)); vehicleBase->m_Events.AddEventAtOffset(new VehicleDespawnEvent(*vehicleBase, 2s), 2s);
} }
// xinef: ugly hack, no appripriate hook later to cast spell // xinef: ugly hack, no appripriate hook later to cast spell
+2 -2
View File
@@ -100,12 +100,12 @@ private:
class VehicleDespawnEvent : public BasicEvent class VehicleDespawnEvent : public BasicEvent
{ {
public: public:
VehicleDespawnEvent(Unit& self, uint32 duration) : _self(self), _duration(duration) { } VehicleDespawnEvent(Unit& self, Milliseconds duration) : _self(self), _duration(duration) { }
bool Execute(uint64 e_time, uint32 p_time) override; bool Execute(uint64 e_time, uint32 p_time) override;
protected: protected:
Unit& _self; Unit& _self;
uint32 _duration; Milliseconds _duration;
}; };
#endif #endif
+1 -1
View File
@@ -757,7 +757,7 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_DESPAWN_SELF: case SCRIPT_COMMAND_DESPAWN_SELF:
// Target or source must be Creature. // Target or source must be Creature.
if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script, true)) if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script, true))
cSource->DespawnOrUnsummon(step.script->DespawnSelf.DespawnDelay); cSource->DespawnOrUnsummon(Milliseconds(step.script->DespawnSelf.DespawnDelay));
break; break;
case SCRIPT_COMMAND_LOAD_PATH: case SCRIPT_COMMAND_LOAD_PATH:
+1 -1
View File
@@ -5213,7 +5213,7 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/)
{ {
// Position passed to SummonPet is irrelevant with current implementation, // Position passed to SummonPet is irrelevant with current implementation,
// pet will be relocated without using these coords in Pet::LoadPetFromDB // pet will be relocated without using these coords in Pet::LoadPetFromDB
player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET, 0s, damage); player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET, 0ms, damage);
return; return;
} }
+1 -1
View File
@@ -162,7 +162,7 @@ void WorldUpdateTime::SetRecordUpdateTimeInterval(Milliseconds t)
void WorldUpdateTime::RecordUpdateTime(Milliseconds gameTimeMs, uint32 diff, uint32 sessionCount) void WorldUpdateTime::RecordUpdateTime(Milliseconds gameTimeMs, uint32 diff, uint32 sessionCount)
{ {
if (_recordUpdateTimeInverval > 0s && diff > _recordUpdateTimeMin.count()) if (_recordUpdateTimeInverval > 0ms && diff > _recordUpdateTimeMin.count())
{ {
if (GetMSTimeDiff(_lastRecordTime, gameTimeMs) > _recordUpdateTimeInverval) if (GetMSTimeDiff(_lastRecordTime, gameTimeMs) > _recordUpdateTimeInverval)
{ {
@@ -1046,7 +1046,7 @@ public:
break; break;
case EVENT_VAEL_3_DESPAWN: case EVENT_VAEL_3_DESPAWN:
DoCast(me, SPELL_VAELASTRASZ_SPAWN); DoCast(me, SPELL_VAELASTRASZ_SPAWN);
me->DespawnOrUnsummon(1500); me->DespawnOrUnsummon(1500ms);
break; break;
default: default:
break; break;
@@ -435,7 +435,7 @@ public:
break; break;
case EVENT_SUCCESS_2: case EVENT_SUCCESS_2:
DoCast(me, SPELL_VAELASTRASZZ_SPAWN); DoCast(me, SPELL_VAELASTRASZZ_SPAWN);
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
break; break;
case EVENT_PATH_3: case EVENT_PATH_3:
me->GetMotionMaster()->MovePath(NEFARIUS_PATH_3, false); me->GetMotionMaster()->MovePath(NEFARIUS_PATH_3, false);
@@ -199,7 +199,7 @@ class spell_mc_play_dead_aura : public AuraScript
else else
{ {
Unit::Kill(creatureTarget, creatureTarget); Unit::Kill(creatureTarget, creatureTarget);
creatureTarget->DespawnOrUnsummon(14000); creatureTarget->DespawnOrUnsummon(14s);
} }
} }
@@ -146,7 +146,7 @@ public:
{ {
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
player->GroupEventHappens(QUEST_A_FINE_MESS, me); player->GroupEventHappens(QUEST_A_FINE_MESS, me);
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
} }
} }
} }
@@ -88,7 +88,7 @@ struct npc_kilrek : public ScriptedAI
DoCast(Terestian, SPELL_BROKEN_PACT, true); DoCast(Terestian, SPELL_BROKEN_PACT, true);
} }
} }
me->DespawnOrUnsummon(15000); me->DespawnOrUnsummon(15s);
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
@@ -523,9 +523,9 @@ public:
} }
} }
me->DespawnOrUnsummon(100); me->DespawnOrUnsummon(100ms);
if (Creature* arca = ObjectAccessor::GetCreature((*me), ArcanagosGUID)) if (Creature* arca = ObjectAccessor::GetCreature((*me), ArcanagosGUID))
arca->DespawnOrUnsummon(100); arca->DespawnOrUnsummon(100ms);
return 5000; return 5000;
default: default:
@@ -141,7 +141,7 @@ struct boss_vexallus : public BossAI
void SummonedCreatureDies(Creature* summon, Unit* killer) override void SummonedCreatureDies(Creature* summon, Unit* killer) override
{ {
summons.Despawn(summon); summons.Despawn(summon);
summon->DespawnOrUnsummon(1); summon->DespawnOrUnsummon(1ms);
if (killer) if (killer)
killer->CastSpell(killer, SPELL_ENERGY_FEEDBACK, true, 0, 0, summon->GetGUID()); killer->CastSpell(killer, SPELL_ENERGY_FEEDBACK, true, 0, 0, summon->GetGUID());
} }
@@ -230,7 +230,7 @@ public:
me->RemoveAllAuras(); me->RemoveAllAuras();
me->CastSpell(attacker, SPELL_DUEL_VICTORY, true); me->CastSpell(attacker, SPELL_DUEL_VICTORY, true);
me->RestoreFaction(); me->RestoreFaction();
me->DespawnOrUnsummon(10000); me->DespawnOrUnsummon(10s);
} }
} }
} }
@@ -407,7 +407,7 @@ public:
{ {
if (type == POINT_MOTION_TYPE && point == 1) if (type == POINT_MOTION_TYPE && point == 1)
{ {
me->DespawnOrUnsummon(1500); me->DespawnOrUnsummon(1500ms);
me->CastSpell(me, SPELL_GHOUL_SUBMERGE, true); me->CastSpell(me, SPELL_GHOUL_SUBMERGE, true);
} }
} }
@@ -692,7 +692,7 @@ public:
orbaz->SetReactState(REACT_PASSIVE); orbaz->SetReactState(REACT_PASSIVE);
orbaz->AI()->Talk(EMOTE_LIGHT_OF_DAWN04); orbaz->AI()->Talk(EMOTE_LIGHT_OF_DAWN04);
orbaz->GetMotionMaster()->MovePoint(2, LightOfDawnPos[2], true, true); orbaz->GetMotionMaster()->MovePoint(2, LightOfDawnPos[2], true, true);
orbaz->DespawnOrUnsummon(7000); orbaz->DespawnOrUnsummon(7s);
} }
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
@@ -839,7 +839,7 @@ public:
alex->AI()->Talk(SAY_LIGHT_OF_DAWN41); alex->AI()->Talk(SAY_LIGHT_OF_DAWN41);
if (Creature* darion = GetEntryFromSummons(NPC_DARION_MOGRAINE)) if (Creature* darion = GetEntryFromSummons(NPC_DARION_MOGRAINE))
darion->DespawnOrUnsummon(3000); darion->DespawnOrUnsummon(3s);
break; break;
case EVENT_OUTRO_SCENE_19: case EVENT_OUTRO_SCENE_19:
if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE)) if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE))
@@ -886,7 +886,7 @@ public:
case EVENT_OUTRO_SCENE_23: case EVENT_OUTRO_SCENE_23:
if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE)) if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE))
{ {
alex->DespawnOrUnsummon(5000); alex->DespawnOrUnsummon(5s);
alex->SetVisible(false); alex->SetVisible(false);
} }
break; break;
@@ -1055,7 +1055,7 @@ public:
if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING))
{ {
lk->CastSpell(lk, SPELL_EXIT_TELEPORT_VISUAL, true); lk->CastSpell(lk, SPELL_EXIT_TELEPORT_VISUAL, true);
lk->DespawnOrUnsummon(1500); lk->DespawnOrUnsummon(1500ms);
} }
if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING))
@@ -1145,7 +1145,7 @@ public:
} }
case EVENT_OUTRO_SCENE_61: case EVENT_OUTRO_SCENE_61:
summons.DespawnAll(); summons.DespawnAll();
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
events.Reset(); events.Reset();
return; return;
} }
@@ -103,7 +103,7 @@ public:
void EnterEvadeMode(EvadeReason /*why*/) override void EnterEvadeMode(EvadeReason /*why*/) override
{ {
instance->SetData(DATA_KIRTONOS_THE_HERALD, FAIL); instance->SetData(DATA_KIRTONOS_THE_HERALD, FAIL);
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
void MovementInform(uint32 type, uint32 id) override void MovementInform(uint32 type, uint32 id) override
@@ -360,7 +360,7 @@ struct npc_madrigosa : public NullCreatureAI
break; break;
case EVENT_SPAWN_FELMYST: case EVENT_SPAWN_FELMYST:
DoCastAOE(SPELL_SUMMON_FELBLAZE, true); DoCastAOE(SPELL_SUMMON_FELBLAZE, true);
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
break; break;
} }
} }
@@ -425,7 +425,7 @@ struct npc_demonic_vapor_trail : public NullCreatureAI
void Reset() override void Reset() override
{ {
me->CastSpell(me, SPELL_DEMONIC_VAPOR_TRAIL_PERIODIC, true); me->CastSpell(me, SPELL_DEMONIC_VAPOR_TRAIL_PERIODIC, true);
me->DespawnOrUnsummon(20000); me->DespawnOrUnsummon(20s);
} }
void SpellHitTarget(Unit* /*unit*/, SpellInfo const* spellInfo) override void SpellHitTarget(Unit* /*unit*/, SpellInfo const* spellInfo) override
@@ -387,7 +387,7 @@ struct boss_kiljaeden : public BossAI
{ {
anveena->RemoveAllAuras(); anveena->RemoveAllAuras();
anveena->CastSpell(anveena, SPELL_SACRIFICE_OF_ANVEENA, true); anveena->CastSpell(anveena, SPELL_SACRIFICE_OF_ANVEENA, true);
anveena->DespawnOrUnsummon(1500); anveena->DespawnOrUnsummon(1500ms);
DoCastSelf(SPELL_CUSTOM_08_STATE, true); DoCastSelf(SPELL_CUSTOM_08_STATE, true);
me->SetUnitFlag(UNIT_FLAG_PACIFIED); me->SetUnitFlag(UNIT_FLAG_PACIFIED);
scheduler.CancelAll(); scheduler.CancelAll();
@@ -555,7 +555,7 @@ struct boss_kiljaeden : public BossAI
summon->CastSpell(summon, SPELL_ARMAGEDDON_VISUAL, true); summon->CastSpell(summon, SPELL_ARMAGEDDON_VISUAL, true);
summon->SetPosition(summon->GetPositionX(), summon->GetPositionY(), summon->GetPositionZ() + 20.0f, 0.0f); summon->SetPosition(summon->GetPositionX(), summon->GetPositionY(), summon->GetPositionZ() + 20.0f, 0.0f);
summon->m_Events.AddEvent(new CastArmageddon(summon), summon->m_Events.CalculateTime(6000)); summon->m_Events.AddEvent(new CastArmageddon(summon), summon->m_Events.CalculateTime(6000));
summon->DespawnOrUnsummon(urand(8000, 10000)); summon->DespawnOrUnsummon(randtime(8s, 10s));
} }
} }
@@ -919,7 +919,7 @@ struct npc_kalecgos_kj : public NullCreatureAI
if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN))
{ {
velen->GetMotionMaster()->MovePoint(0, 1739.38f, 643.79f, 28.06f); velen->GetMotionMaster()->MovePoint(0, 1739.38f, 643.79f, 28.06f);
velen->DespawnOrUnsummon(5000); velen->DespawnOrUnsummon(5s);
} }
events.ScheduleEvent(eventId + 1, 3s); events.ScheduleEvent(eventId + 1, 3s);
break; break;
@@ -929,7 +929,7 @@ struct npc_kalecgos_kj : public NullCreatureAI
if (summon->GetEntry() == NPC_SHATTERED_SUN_SOLDIER) if (summon->GetEntry() == NPC_SHATTERED_SUN_SOLDIER)
{ {
summon->GetMotionMaster()->MovePoint(0, 1739.38f, 643.79f, 28.06f); summon->GetMotionMaster()->MovePoint(0, 1739.38f, 643.79f, 28.06f);
summon->DespawnOrUnsummon(summon->GetExactDist2d(1734.96f, 642.43f) * 100); summon->DespawnOrUnsummon(Milliseconds(uint32(summon->GetExactDist2d(1734.96f, 642.43f) * 100)));
} }
events.ScheduleEvent(eventId + 1, 7s); events.ScheduleEvent(eventId + 1, 7s);
break; break;
@@ -274,7 +274,7 @@ struct npc_singularity : public NullCreatureAI
void Reset() override void Reset() override
{ {
me->DespawnOrUnsummon(18000); me->DespawnOrUnsummon(18s);
me->m_Events.AddEventAtOffset([&] { me->m_Events.AddEventAtOffset([&] {
DoCastSelf(SPELL_BLACK_HOLE_SUMMON_VISUAL, true); DoCastSelf(SPELL_BLACK_HOLE_SUMMON_VISUAL, true);
@@ -285,10 +285,7 @@ struct boss_zuljin : public BossAI
instance->SetBossState(DATA_ZULJIN, DONE); instance->SetBossState(DATA_ZULJIN, DONE);
Talk(SAY_DEATH); Talk(SAY_DEATH);
summons.DespawnEntry(CREATURE_COLUMN_OF_FIRE); summons.DespawnEntry(CREATURE_COLUMN_OF_FIRE);
summons.DespawnAll(3s);
me->m_Events.AddEventAtOffset( [this] {
summons.DespawnAll();
}, 3s);
} }
void SpawnAdds() void SpawnAdds()
@@ -78,7 +78,7 @@ struct npc_forest_frog : public ScriptedAI
void MovementInform(uint32 type, uint32 data) override void MovementInform(uint32 type, uint32 data) override
{ {
if (type == POINT_MOTION_TYPE && data == POINT_DESPAWN) if (type == POINT_MOTION_TYPE && data == POINT_DESPAWN)
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
@@ -355,7 +355,7 @@ public:
if (arlokk->IsAlive()) if (arlokk->IsAlive())
arlokk->GetAI()->SetData(_sideData, 0); arlokk->GetAI()->SetData(_sideData, 0);
} }
me->DespawnOrUnsummon(4000); me->DespawnOrUnsummon(4s);
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
@@ -641,7 +641,7 @@ public:
{ {
DoCast(target, SPELL_REVIVE); DoCast(target, SPELL_REVIVE);
} }
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
} }
} }
@@ -64,7 +64,7 @@ struct boss_twilight_corrupter : public ScriptedAI
{ {
if (creature->IsAlive() && me->GetGUID() != creature->GetGUID()) if (creature->IsAlive() && me->GetGUID() != creature->GetGUID())
{ {
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
break; break;
} }
} }
@@ -262,7 +262,7 @@ public:
if (Unit* creature = summon->GetSummonerUnit()) if (Unit* creature = summon->GetSummonerUnit())
creature->GetAI()->DoAction(1); creature->GetAI()->DoAction(1);
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
void JustDied(Unit*) override void JustDied(Unit*) override
@@ -586,7 +586,7 @@ public:
case 13: case 13:
me->setActive(false); me->setActive(false);
if (Creature* c = me->FindNearestCreature(NPC_SUNWELL_VISUAL_BUNNY, 60.0f, true)) if (Creature* c = me->FindNearestCreature(NPC_SUNWELL_VISUAL_BUNNY, 60.0f, true))
c->DespawnOrUnsummon(1); c->DespawnOrUnsummon(1ms);
if (GameObject* go = me->FindNearestGameObject(GO_QUEL_DELAR, 60.0f)) if (GameObject* go = me->FindNearestGameObject(GO_QUEL_DELAR, 60.0f))
go->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE); go->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
me->SetWalk(true); me->SetWalk(true);
@@ -3054,10 +3054,10 @@ public:
if (Creature* valimathras = ObjectAccessor::GetCreature(*me, ValimathrasGUID)) if (Creature* valimathras = ObjectAccessor::GetCreature(*me, ValimathrasGUID))
{ {
valimathras->GetMotionMaster()->MovePoint(0, 1804.559f, 235.504f, 62.753f); valimathras->GetMotionMaster()->MovePoint(0, 1804.559f, 235.504f, 62.753f);
valimathras->DespawnOrUnsummon(3 * IN_MILLISECONDS); valimathras->DespawnOrUnsummon(3s);
} }
if (Creature* valimathrasportal = ObjectAccessor::GetCreature(*me, ValimathrasPortalGUID)) if (Creature* valimathrasportal = ObjectAccessor::GetCreature(*me, ValimathrasPortalGUID))
valimathrasportal->DespawnOrUnsummon(6 * IN_MILLISECONDS); valimathrasportal->DespawnOrUnsummon(6s);
JumpToNextStep(1 * IN_MILLISECONDS); JumpToNextStep(1 * IN_MILLISECONDS);
break; break;
case 26: case 26:
@@ -3332,10 +3332,10 @@ public:
if (Creature* valimathras = ObjectAccessor::GetCreature(*me, ValimathrasGUID)) if (Creature* valimathras = ObjectAccessor::GetCreature(*me, ValimathrasGUID))
{ {
valimathras->GetMotionMaster()->MovePoint(0, 1596.642f, 429.811f, -46.3429f); valimathras->GetMotionMaster()->MovePoint(0, 1596.642f, 429.811f, -46.3429f);
valimathras->DespawnOrUnsummon(3 * IN_MILLISECONDS); valimathras->DespawnOrUnsummon(3s);
} }
if (Creature* valimathrasportal = ObjectAccessor::GetCreature(*me, ValimathrasPortalGUID)) if (Creature* valimathrasportal = ObjectAccessor::GetCreature(*me, ValimathrasPortalGUID))
valimathrasportal->DespawnOrUnsummon(3 * IN_MILLISECONDS); valimathrasportal->DespawnOrUnsummon(3s);
JumpToNextStep(2 * IN_MILLISECONDS); JumpToNextStep(2 * IN_MILLISECONDS);
break; break;
// KHANOK - Trashspawn // KHANOK - Trashspawn
@@ -3865,8 +3865,8 @@ public:
me->GetCreatureListWithEntryInGrid(HelperList, NPC_OVERLORD_SAURFANG, 100.0f); me->GetCreatureListWithEntryInGrid(HelperList, NPC_OVERLORD_SAURFANG, 100.0f);
if (!HelperList.empty()) if (!HelperList.empty())
for (std::list<Creature*>::iterator itr = HelperList.begin(); itr != HelperList.end(); itr++) for (std::list<Creature*>::iterator itr = HelperList.begin(); itr != HelperList.end(); itr++)
(*itr)->DespawnOrUnsummon(120 * IN_MILLISECONDS); (*itr)->DespawnOrUnsummon(120s);
me->DespawnOrUnsummon(120 * IN_MILLISECONDS); me->DespawnOrUnsummon(120s);
bStepping = false; bStepping = false;
JumpToNextStep(0 * IN_MILLISECONDS); JumpToNextStep(0 * IN_MILLISECONDS);
break; break;
+1 -1
View File
@@ -603,7 +603,7 @@ struct npc_dark_iron_attack_mole_machine : public ScriptedAI
{ {
me->SummonCreature(NPC_DARK_IRON_GUZZLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); me->SummonCreature(NPC_DARK_IRON_GUZZLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000);
summonTimer = 0; summonTimer = 0;
me->DespawnOrUnsummon(3000); me->DespawnOrUnsummon(3s);
} }
} }
} }
+3 -3
View File
@@ -697,7 +697,7 @@ struct npc_hallows_end_soh : public ScriptedAI
void EnterEvadeMode(EvadeReason /* why */) override void EnterEvadeMode(EvadeReason /* why */) override
{ {
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
uint32 GetData(uint32 /*type*/) const override uint32 GetData(uint32 /*type*/) const override
@@ -848,7 +848,7 @@ struct npc_hallows_end_soh : public ScriptedAI
if (Unit* c = ObjectAccessor::GetUnit(*me, guid)) if (Unit* c = ObjectAccessor::GetUnit(*me, guid))
c->RemoveAllAuras(); c->RemoveAllAuras();
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
else else
{ {
@@ -1029,7 +1029,7 @@ struct boss_headless_horseman : public ScriptedAI
std::list<Creature*> unitList; std::list<Creature*> unitList;
me->GetCreaturesWithEntryInRange(unitList, 100.0f, NPC_PUMPKIN_FIEND); me->GetCreaturesWithEntryInRange(unitList, 100.0f, NPC_PUMPKIN_FIEND);
for (std::list<Creature*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) for (std::list<Creature*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
(*itr)->ToCreature()->DespawnOrUnsummon(500); (*itr)->ToCreature()->DespawnOrUnsummon(500ms);
Map::PlayerList const& players = me->GetMap()->GetPlayers(); Map::PlayerList const& players = me->GetMap()->GetPlayers();
if (!players.IsEmpty() && players.begin()->GetSource() && players.begin()->GetSource()->GetGroup()) if (!players.IsEmpty() && players.begin()->GetSource() && players.begin()->GetSource()->GetGroup())
+1 -1
View File
@@ -247,7 +247,7 @@ struct npc_love_in_air_snivel_real : public ScriptedAI
if (Unit* owner = me->ToTempSummon()->GetSummonerUnit()) if (Unit* owner = me->ToTempSummon()->GetSummonerUnit())
me->CastSpell(owner, SPELL_SNIVEL_GUN, true); me->CastSpell(owner, SPELL_SNIVEL_GUN, true);
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
} }
} }
} }
+1 -1
View File
@@ -192,7 +192,7 @@ class spell_winter_veil_racer_slam_hit : public SpellScript
return; return;
target->CastSpell(target->GetPositionX() + irand(-10, 10), target->GetPositionY() + irand(-10, 10), target->GetPositionZ(), SPELL_RACER_DEATH_VISUAL, true); target->CastSpell(target->GetPositionX() + irand(-10, 10), target->GetPositionY() + irand(-10, 10), target->GetPositionZ(), SPELL_RACER_DEATH_VISUAL, true);
target->DespawnOrUnsummon(3000); target->DespawnOrUnsummon(3s);
target->CastSpell(target, SPELL_RACER_FLAMES, true); target->CastSpell(target, SPELL_RACER_FLAMES, true);
caster->CastSpell(caster, SPELL_RACER_KILL_COUNTER, true); caster->CastSpell(caster, SPELL_RACER_KILL_COUNTER, true);
@@ -67,7 +67,7 @@ public:
summons.DespawnAll(); summons.DespawnAll();
if (InstanceScript* pInstance = me->GetInstanceScript()) if (InstanceScript* pInstance = me->GetInstanceScript())
if (pInstance->GetData(DATA_GUARDIANTIME_EVENT) == 0) if (pInstance->GetData(DATA_GUARDIANTIME_EVENT) == 0)
me->DespawnOrUnsummon(500); me->DespawnOrUnsummon(500ms);
me->SummonCreature(NPC_TIME_RIFT, 2337.6f, 1270.0f, 132.95f, 2.79f); me->SummonCreature(NPC_TIME_RIFT, 2337.6f, 1270.0f, 132.95f, 2.79f);
me->SummonCreature(NPC_GUARDIAN_OF_TIME, 2319.3f, 1267.7f, 132.8f, 1.0f); me->SummonCreature(NPC_GUARDIAN_OF_TIME, 2319.3f, 1267.7f, 132.8f, 1.0f);
@@ -93,11 +93,11 @@ public:
{ {
if (cr->GetEntry() == NPC_TIME_RIFT) if (cr->GetEntry() == NPC_TIME_RIFT)
{ {
cr->DespawnOrUnsummon(1000); cr->DespawnOrUnsummon(1s);
} }
else else
{ {
cr->DespawnOrUnsummon(5000); cr->DespawnOrUnsummon(5s);
cr->RemoveAllAuras(); cr->RemoveAllAuras();
cr->AI()->Talk(SAY_THANKS); cr->AI()->Talk(SAY_THANKS);
} }
@@ -120,7 +120,7 @@ public:
{ {
Talk(SAY_FAIL); Talk(SAY_FAIL);
summons.DespawnAll(); summons.DespawnAll();
me->DespawnOrUnsummon(500); me->DespawnOrUnsummon(500ms);
} }
} }
@@ -80,7 +80,7 @@ public:
if (finished) if (finished)
{ {
Talk(SAY_OUTRO); Talk(SAY_OUTRO);
me->DespawnOrUnsummon(20000); me->DespawnOrUnsummon(20s);
} }
} }
@@ -547,7 +547,7 @@ public:
if (Creature* stalker = me->SummonCreature(NPC_INVIS_TARGET, 2026.469f, 1287.088f, 143.596f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 14000)) if (Creature* stalker = me->SummonCreature(NPC_INVIS_TARGET, 2026.469f, 1287.088f, 143.596f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 14000))
{ {
me->SetFacingToObject(stalker); me->SetFacingToObject(stalker);
stalker->DespawnOrUnsummon(500); stalker->DespawnOrUnsummon(500ms);
} }
break; break;
// Reached first cityman // Reached first cityman
@@ -861,7 +861,7 @@ public:
if (Creature* stalker = me->SummonCreature(NPC_INVIS_TARGET, 2081.447f, 1287.770f, 141.3241f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 10000)) if (Creature* stalker = me->SummonCreature(NPC_INVIS_TARGET, 2081.447f, 1287.770f, 141.3241f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 10000))
{ {
me->SetFacingToObject(stalker); me->SetFacingToObject(stalker);
stalker->DespawnOrUnsummon(500); stalker->DespawnOrUnsummon(500ms);
} }
Talk(SAY_PHASE205); Talk(SAY_PHASE205);
ScheduleNextEvent(currentEvent, 4s); ScheduleNextEvent(currentEvent, 4s);
@@ -1343,7 +1343,7 @@ void npc_arthas::npc_arthasAI::SpawnTimeRift()
if (Creature* cr = me->SummonCreature(/*entry*/(uint32)RiftAndSpawnsLocations[timeRiftId][i][0], RiftAndSpawnsLocations[timeRiftId][0][1], RiftAndSpawnsLocations[timeRiftId][0][2], RiftAndSpawnsLocations[timeRiftId][0][3], RiftAndSpawnsLocations[timeRiftId][0][4])) if (Creature* cr = me->SummonCreature(/*entry*/(uint32)RiftAndSpawnsLocations[timeRiftId][i][0], RiftAndSpawnsLocations[timeRiftId][0][1], RiftAndSpawnsLocations[timeRiftId][0][2], RiftAndSpawnsLocations[timeRiftId][0][3], RiftAndSpawnsLocations[timeRiftId][0][4]))
{ {
if (cr->GetEntry() == NPC_TIME_RIFT) if (cr->GetEntry() == NPC_TIME_RIFT)
cr->DespawnOrUnsummon(10000); cr->DespawnOrUnsummon(10s);
else // x, y, z (0 is entry) else // x, y, z (0 is entry)
{ {
// first infinite // first infinite
@@ -1538,7 +1538,7 @@ public:
if (me->GetDistance(2400, 1200, 135) > 20.0f && data >= COS_PROGRESS_FINISHED_CITY_INTRO) if (me->GetDistance(2400, 1200, 135) > 20.0f && data >= COS_PROGRESS_FINISHED_CITY_INTRO)
{ {
if (data >= COS_PROGRESS_KILLED_SALRAMM) if (data >= COS_PROGRESS_KILLED_SALRAMM)
me->DespawnOrUnsummon(500); me->DespawnOrUnsummon(500ms);
else else
InfectMe(3000); InfectMe(3000);
} }
@@ -307,7 +307,7 @@ public:
if (Creature* cr = instance->SummonCreature(NPC_CHROMIE_MIDDLE, pos)) if (Creature* cr = instance->SummonCreature(NPC_CHROMIE_MIDDLE, pos))
{ {
cr->SetVisible(false); cr->SetVisible(false);
cr->DespawnOrUnsummon(1000); cr->DespawnOrUnsummon(1s);
sCreatureTextMgr->SendChat(cr, textId, player, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); sCreatureTextMgr->SendChat(cr, textId, player, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
} }
} }
@@ -382,7 +382,7 @@ public:
if (Creature* horse = me->FindNearestCreature(NPC_SKARLOC_MOUNT, 10.0f)) if (Creature* horse = me->FindNearestCreature(NPC_SKARLOC_MOUNT, 10.0f))
{ {
horse->GetMotionMaster()->MovePoint(0, 2501.15f, 572.14f, 54.13f); horse->GetMotionMaster()->MovePoint(0, 2501.15f, 572.14f, 54.13f);
horse->DespawnOrUnsummon(30 * IN_MILLISECONDS); horse->DespawnOrUnsummon(30s);
} }
Talk(SAY_EMOTE_HORSE); Talk(SAY_EMOTE_HORSE);
SetEscortPaused(true); SetEscortPaused(true);
@@ -143,7 +143,7 @@ public:
case NPC_INFINITE_EXECUTIONER_2: case NPC_INFINITE_EXECUTIONER_2:
case NPC_INFINITE_VANQUISHER: case NPC_INFINITE_VANQUISHER:
case NPC_INFINITE_VANQUISHER_2: case NPC_INFINITE_VANQUISHER_2:
creature->DespawnOrUnsummon(1); creature->DespawnOrUnsummon(1ms);
break; break;
default: default:
break; break;
@@ -109,7 +109,7 @@ struct npc_medivh_bm : public ScriptedAI
{ {
if (summon->GetEntry() == NPC_DP_CRYSTAL_STALKER) if (summon->GetEntry() == NPC_DP_CRYSTAL_STALKER)
{ {
summon->DespawnOrUnsummon(25000); summon->DespawnOrUnsummon(25s);
summon->CastSpell(summon, RAND(SPELL_BANISH_PURPLE, SPELL_BANISH_GREEN), true); summon->CastSpell(summon, RAND(SPELL_BANISH_PURPLE, SPELL_BANISH_GREEN), true);
summon->GetMotionMaster()->MoveSplinePath(&_airArray); summon->GetMotionMaster()->MoveSplinePath(&_airArray);
} }
@@ -199,19 +199,19 @@ struct npc_medivh_bm : public ScriptedAI
events.ScheduleEvent(EVENT_OUTRO_3, 2s); events.ScheduleEvent(EVENT_OUTRO_3, 2s);
break; break;
case EVENT_OUTRO_3: case EVENT_OUTRO_3:
SummonOrcs(-2046.158f, -3.0f, 37000, 30000, true); SummonOrcs(-2046.158f, -3.0f, 37s, 30000, true);
events.ScheduleEvent(EVENT_OUTRO_4, 2s); events.ScheduleEvent(EVENT_OUTRO_4, 2s);
break; break;
case EVENT_OUTRO_4: case EVENT_OUTRO_4:
SummonOrcs(-2055.97f, -2.0f, 33000, 28000, false); SummonOrcs(-2055.97f, -2.0f, 33s, 28000, false);
events.ScheduleEvent(EVENT_OUTRO_5, 2s); events.ScheduleEvent(EVENT_OUTRO_5, 2s);
break; break;
case EVENT_OUTRO_5: case EVENT_OUTRO_5:
SummonOrcs(-2064.0f, -1.5f, 29000, 26000, false); SummonOrcs(-2064.0f, -1.5f, 29s, 26000, false);
events.ScheduleEvent(EVENT_OUTRO_6, 2s); events.ScheduleEvent(EVENT_OUTRO_6, 2s);
break; break;
case EVENT_OUTRO_6: case EVENT_OUTRO_6:
SummonOrcs(-2074.35f, -0.1f, 26000, 24000, false); SummonOrcs(-2074.35f, -0.1f, 26s, 24000, false);
events.ScheduleEvent(EVENT_OUTRO_7, 7s); events.ScheduleEvent(EVENT_OUTRO_7, 7s);
break; break;
case EVENT_OUTRO_7: case EVENT_OUTRO_7:
@@ -228,7 +228,7 @@ struct npc_medivh_bm : public ScriptedAI
} }
} }
void SummonOrcs(float x, float y, uint32 duration, uint32 homeTime, bool first) void SummonOrcs(float x, float y, Milliseconds duration, uint32 homeTime, bool first)
{ {
for (uint8 i = 0; i < 6; ++i) for (uint8 i = 0; i < 6; ++i)
{ {
@@ -236,7 +236,7 @@ struct npc_medivh_bm : public ScriptedAI
{ {
cr->GetMotionMaster()->MovePoint(0, (first && i == 3) ? x + 2.0f : x, cr->GetPositionY() + y, cr->GetMapHeight(x, cr->GetPositionY() + y, cr->GetPositionZ(), true)); cr->GetMotionMaster()->MovePoint(0, (first && i == 3) ? x + 2.0f : x, cr->GetPositionY() + y, cr->GetMapHeight(x, cr->GetPositionY() + y, cr->GetPositionZ(), true));
cr->m_Events.AddEvent(new NpcRunToHome(*cr), cr->m_Events.CalculateTime(homeTime + urand(0, 2000))); cr->m_Events.AddEvent(new NpcRunToHome(*cr), cr->m_Events.CalculateTime(homeTime + urand(0, 2000)));
cr->DespawnOrUnsummon(duration + urand(0, 2000)); cr->DespawnOrUnsummon(duration + randtime(0ms, 2s));
} }
} }
} }
@@ -355,7 +355,7 @@ struct npc_time_rift : public NullCreatureAI
{ {
if (creature->GetGUID() == _riftKeeperGUID) if (creature->GetGUID() == _riftKeeperGUID)
{ {
me->DespawnOrUnsummon(0); me->DespawnOrUnsummon(0ms);
} }
} }
@@ -58,7 +58,7 @@ public:
case NPC_HIGHBORNE_SUMMONER: case NPC_HIGHBORNE_SUMMONER:
if (_pylonsState == ALL_PYLONS_OFF) if (_pylonsState == ALL_PYLONS_OFF)
{ {
creature->DespawnOrUnsummon(5000); creature->DespawnOrUnsummon(5s);
} }
else else
{ {
@@ -115,7 +115,7 @@ public:
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
me->DespawnOrUnsummon(5000); me->DespawnOrUnsummon(5s);
} }
void sQuestAccept(Player* /*player*/, Quest const* quest) override void sQuestAccept(Player* /*player*/, Quest const* quest) override
@@ -231,7 +231,7 @@ struct npc_buru_egg : public ScriptedAI
} }
} }
me->DespawnOrUnsummon(5000); me->DespawnOrUnsummon(5s);
} }
void UpdateAI(uint32 /*diff*/) override { } void UpdateAI(uint32 /*diff*/) override { }
@@ -310,7 +310,7 @@ public:
me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE); me->RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE);
DoFinalSpell(); DoFinalSpell();
Talk(EMOTE_DEVOURED); Talk(EMOTE_DEVOURED);
me->DespawnOrUnsummon(3000); me->DespawnOrUnsummon(3s);
return; return;
} }
@@ -170,7 +170,7 @@ struct boss_ouro : public BossAI
} }
} }
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
} }
void CastGroundRupture() void CastGroundRupture()
@@ -273,7 +273,7 @@ struct boss_ouro : public BossAI
if (me->GetThreatMgr().GetThreatList().empty()) if (me->GetThreatMgr().GetThreatList().empty())
{ {
DoCastSelf(SPELL_OURO_SUBMERGE_VISUAL); DoCastSelf(SPELL_OURO_SUBMERGE_VISUAL);
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
instance->SetBossState(DATA_OURO, FAIL); instance->SetBossState(DATA_OURO, FAIL);
if (GameObject* base = me->FindNearestGameObject(GO_SANDWORM_BASE, 200.f)) if (GameObject* base = me->FindNearestGameObject(GO_SANDWORM_BASE, 200.f))
base->DespawnOrUnsummon(); base->DespawnOrUnsummon();
@@ -334,7 +334,7 @@ struct npc_dirt_mound : ScriptedAI
scheduler.Schedule(30s, [this](TaskContext /*context*/) scheduler.Schedule(30s, [this](TaskContext /*context*/)
{ {
DoCastSelf(SPELL_SUMMON_SCARABS, true); DoCastSelf(SPELL_SUMMON_SCARABS, true);
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
}) })
.Schedule(100ms, [this](TaskContext context) .Schedule(100ms, [this](TaskContext context)
{ {
@@ -418,7 +418,7 @@ public:
if (Creature* mastersEye = instance->GetCreature(DATA_MASTERS_EYE)) if (Creature* mastersEye = instance->GetCreature(DATA_MASTERS_EYE))
{ {
mastersEye->AI()->Talk(EMOTE_MASTERS_EYE_AT, player); mastersEye->AI()->Talk(EMOTE_MASTERS_EYE_AT, player);
mastersEye->DespawnOrUnsummon(11000); mastersEye->DespawnOrUnsummon(11s);
mastersEye->m_Events.AddEventAtOffset([mastersEye, player]() mastersEye->m_Events.AddEventAtOffset([mastersEye, player]()
{ {
mastersEye->SetFacingToObject(player); mastersEye->SetFacingToObject(player);
@@ -474,7 +474,7 @@ struct npc_ahnqiraji_critter : public ScriptedAI
{ {
if (me->GetEntry() == NPC_QIRAJI_SCORPION) if (me->GetEntry() == NPC_QIRAJI_SCORPION)
{ {
me->DespawnOrUnsummon(5 * IN_MILLISECONDS); me->DespawnOrUnsummon(5s);
} }
} }
@@ -176,25 +176,25 @@ public:
if (Creature* weegli = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_WEEGLI))) if (Creature* weegli = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_WEEGLI)))
{ {
weegli->CastSpell(weegli, SPELL_BLYS_BAND_ESCAPE); weegli->CastSpell(weegli, SPELL_BLYS_BAND_ESCAPE);
weegli->DespawnOrUnsummon(10000); weegli->DespawnOrUnsummon(10s);
} }
if (Creature* raven = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_RAVEN))) if (Creature* raven = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_RAVEN)))
{ {
raven->CastSpell(raven, SPELL_BLYS_BAND_ESCAPE); raven->CastSpell(raven, SPELL_BLYS_BAND_ESCAPE);
raven->DespawnOrUnsummon(10000); raven->DespawnOrUnsummon(10s);
} }
if (Creature* oro = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_ORO))) if (Creature* oro = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_ORO)))
{ {
oro->CastSpell(oro, SPELL_BLYS_BAND_ESCAPE); oro->CastSpell(oro, SPELL_BLYS_BAND_ESCAPE);
oro->DespawnOrUnsummon(10000); oro->DespawnOrUnsummon(10s);
} }
if (Creature* murta = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_MURTA))) if (Creature* murta = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_MURTA)))
{ {
murta->CastSpell(murta, SPELL_BLYS_BAND_ESCAPE); murta->CastSpell(murta, SPELL_BLYS_BAND_ESCAPE);
murta->DespawnOrUnsummon(10000); murta->DespawnOrUnsummon(10s);
} }
DoCastSelf(SPELL_BLYS_BAND_ESCAPE); DoCastSelf(SPELL_BLYS_BAND_ESCAPE);
me->DespawnOrUnsummon(10000); me->DespawnOrUnsummon(10s);
Porthome_Timer = 156000; //set timer back so that the event doesn't keep triggering Porthome_Timer = 156000; //set timer back so that the event doesn't keep triggering
} }
else else
@@ -436,7 +436,7 @@ public:
case 1: case 1:
me->GetMotionMaster()->MovePoint(2, 1871.18f, 1100.f, 8.88f); me->GetMotionMaster()->MovePoint(2, 1871.18f, 1100.f, 8.88f);
Talk(SAY_WEEGLI_OUT_OF_HERE); Talk(SAY_WEEGLI_OUT_OF_HERE);
me->DespawnOrUnsummon(8000); me->DespawnOrUnsummon(8s);
instance->SetData(DATA_PYRAMID, PYRAMID_GATES_DESTROYED); instance->SetData(DATA_PYRAMID, PYRAMID_GATES_DESTROYED);
destroyingDoor = false; destroyingDoor = false;
break; break;
@@ -463,7 +463,7 @@ public:
_events.Reset(); _events.Reset();
_events.ScheduleEvent(EVENT_CHECK_FOLLOWING, 1s); _events.ScheduleEvent(EVENT_CHECK_FOLLOWING, 1s);
player->KilledMonsterCredit(NPC_CAPTURED_RABID_THISTLE_BEAR); player->KilledMonsterCredit(NPC_CAPTURED_RABID_THISTLE_BEAR);
me->DespawnOrUnsummon(240000); me->DespawnOrUnsummon(240s);
} }
} }
} }
@@ -474,7 +474,7 @@ public:
else if (spell->Id == SPELL_KODO_KOMBO_GOSSIP) else if (spell->Id == SPELL_KODO_KOMBO_GOSSIP)
{ {
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP); me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
me->DespawnOrUnsummon(60000); me->DespawnOrUnsummon(60s);
} }
} }
}; };
@@ -300,11 +300,11 @@ public:
for (uint8 i = 0; i < 6; ++i) // unsummon challengers for (uint8 i = 0; i < 6; ++i) // unsummon challengers
if (AffrayChallenger[i]) if (AffrayChallenger[i])
if (Creature* creature = ObjectAccessor::GetCreature((*me), AffrayChallenger[i])) if (Creature* creature = ObjectAccessor::GetCreature((*me), AffrayChallenger[i]))
creature->DespawnOrUnsummon(1); creature->DespawnOrUnsummon(1ms);
if (BigWill) // unsummon bigWill if (BigWill) // unsummon bigWill
if (Creature* creature = ObjectAccessor::GetCreature((*me), BigWill)) if (Creature* creature = ObjectAccessor::GetCreature((*me), BigWill))
creature->DespawnOrUnsummon(1); creature->DespawnOrUnsummon(1ms);
} }
void MoveInLineOfSight(Unit* who) override void MoveInLineOfSight(Unit* who) override
@@ -486,7 +486,7 @@ public:
if (Creature* guard = me->GetMap()->GetCreature(_guardEluneGUID)) if (Creature* guard = me->GetMap()->GetCreature(_guardEluneGUID))
{ {
guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[2].m_positionX, wingThicketLocations[2].m_positionY, wingThicketLocations[2].m_positionZ); guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[2].m_positionX, wingThicketLocations[2].m_positionY, wingThicketLocations[2].m_positionZ);
guard->DespawnOrUnsummon(4000); guard->DespawnOrUnsummon(4s);
} }
break; break;
case SAY_PRIESTESS_ALTAR_20: case SAY_PRIESTESS_ALTAR_20:
@@ -494,7 +494,7 @@ public:
if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID)) if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID))
{ {
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[0].m_positionX, wingThicketLocations[0].m_positionY, wingThicketLocations[0].m_positionZ); priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[0].m_positionX, wingThicketLocations[0].m_positionY, wingThicketLocations[0].m_positionZ);
priestess->DespawnOrUnsummon(4000); priestess->DespawnOrUnsummon(4s);
} }
break; break;
case SAY_PRIESTESS_ALTAR_21: case SAY_PRIESTESS_ALTAR_21:
@@ -502,7 +502,7 @@ public:
if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID)) if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID))
{ {
priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[1].m_positionX, wingThicketLocations[1].m_positionY, wingThicketLocations[1].m_positionZ); priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[1].m_positionX, wingThicketLocations[1].m_positionY, wingThicketLocations[1].m_positionZ);
priestess->DespawnOrUnsummon(4000); priestess->DespawnOrUnsummon(4s);
} }
break; break;
case DATA_EVENT_END: case DATA_EVENT_END:
@@ -526,7 +526,7 @@ public:
player->GroupEventHappens(QUEST_GUARDIANS_ALTAR, me); player->GroupEventHappens(QUEST_GUARDIANS_ALTAR, me);
Talk(SAY_RANSHALLA_END_2, player); Talk(SAY_RANSHALLA_END_2, player);
} }
me->DespawnOrUnsummon(4000); me->DespawnOrUnsummon(4s);
break; break;
} }
} }
@@ -1480,7 +1480,7 @@ public:
{ {
if (param == ACTION_SWITCH_PHASE) if (param == ACTION_SWITCH_PHASE)
{ {
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
} }
@@ -379,7 +379,7 @@ public:
// Xinef: after soft reset npc is no longer present // Xinef: after soft reset npc is no longer present
if (me->GetInstanceScript()->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) if (me->GetInstanceScript()->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE)
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
void DoAction(int32 action) override void DoAction(int32 action) override
@@ -1322,7 +1322,7 @@ public:
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
}; };
@@ -409,7 +409,7 @@ public:
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
me->DespawnOrUnsummon(20000); me->DespawnOrUnsummon(20s);
if (pInstance) if (pInstance)
if (Creature* paletress = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(DATA_PALETRESS))) if (Creature* paletress = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(DATA_PALETRESS)))
paletress->AI()->DoAction(1); paletress->AI()->DoAction(1);
@@ -722,7 +722,7 @@ public:
void JustDied(Unit* /*pKiller*/) override void JustDied(Unit* /*pKiller*/) override
{ {
me->DespawnOrUnsummon(10000); me->DespawnOrUnsummon(10s);
if (pInstance) if (pInstance)
pInstance->SetData(DATA_ARGENT_SOLDIER_DEFEATED, 0); pInstance->SetData(DATA_ARGENT_SOLDIER_DEFEATED, 0);
} }
@@ -131,7 +131,7 @@ public:
void EnterEvadeMode(EvadeReason why) override void EnterEvadeMode(EvadeReason why) override
{ {
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
ScriptedAI::EnterEvadeMode(why); ScriptedAI::EnterEvadeMode(why);
} }
@@ -347,7 +347,7 @@ public:
void JustDied(Unit* /*pKiller*/) override void JustDied(Unit* /*pKiller*/) override
{ {
me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0);
me->DespawnOrUnsummon(10000); me->DespawnOrUnsummon(10s);
if (pInstance) if (pInstance)
pInstance->SetData(DATA_MOUNT_DIED, 0); pInstance->SetData(DATA_MOUNT_DIED, 0);
} }
@@ -1128,7 +1128,7 @@ public:
if (Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID)) if (Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID))
{ {
boss->GetMotionMaster()->MovePoint(0, SpawnPosition); boss->GetMotionMaster()->MovePoint(0, SpawnPosition);
boss->DespawnOrUnsummon(3000); boss->DespawnOrUnsummon(3s);
} }
} }
break; break;
@@ -574,7 +574,7 @@ public:
if (spell->Id == SPELL_SPIKE_FAIL) if (spell->Id == SPELL_SPIKE_FAIL)
{ {
me->RemoveAllAuras(); me->RemoveAllAuras();
me->DespawnOrUnsummon(1500); me->DespawnOrUnsummon(1500ms);
} }
} }
@@ -353,7 +353,7 @@ public:
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
me->DespawnOrUnsummon(10000); me->DespawnOrUnsummon(10s);
} }
void EnterEvadeMode(EvadeReason /*why*/) override void EnterEvadeMode(EvadeReason /*why*/) override
@@ -434,7 +434,7 @@ public:
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
me->DespawnOrUnsummon(10000); me->DespawnOrUnsummon(10s);
} }
void EnterEvadeMode(EvadeReason /*why*/) override void EnterEvadeMode(EvadeReason /*why*/) override
@@ -710,7 +710,7 @@ public:
return; return;
if (urand(0, 2)) if (urand(0, 2))
me->DespawnOrUnsummon(0); me->DespawnOrUnsummon(0ms);
} }
void MoveToNextPoint() void MoveToNextPoint()
@@ -884,7 +884,7 @@ class spell_valkyr_ball_periodic_dummy_aura : public AuraScript
creature->GetMotionMaster()->MoveIdle(); creature->GetMotionMaster()->MoveIdle();
creature->CastSpell((Unit*)nullptr, creature->GetEntry() == NPC_CONCENTRATED_LIGHT ? SPELL_UNLEASHED_LIGHT : SPELL_UNLEASHED_DARK, false); creature->CastSpell((Unit*)nullptr, creature->GetEntry() == NPC_CONCENTRATED_LIGHT ? SPELL_UNLEASHED_LIGHT : SPELL_UNLEASHED_DARK, false);
creature->SetDisplayId(11686); creature->SetDisplayId(11686);
creature->DespawnOrUnsummon(1500); creature->DespawnOrUnsummon(1500ms);
} }
} }
@@ -348,9 +348,9 @@ public:
} }
if (Creature* c = instance->GetCreature(NPC_AcidmawGUID)) if (Creature* c = instance->GetCreature(NPC_AcidmawGUID))
c->DespawnOrUnsummon(10000); c->DespawnOrUnsummon(10s);
if (Creature* c = instance->GetCreature(NPC_DreadscaleGUID)) if (Creature* c = instance->GetCreature(NPC_DreadscaleGUID))
c->DespawnOrUnsummon(10000); c->DespawnOrUnsummon(10s);
if (AchievementTimer + 10 >= GameTime::GetGameTime().count()) if (AchievementTimer + 10 >= GameTime::GetGameTime().count())
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_JORMUNGAR_ACHIEV); DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_JORMUNGAR_ACHIEV);
AchievementTimer = 0; AchievementTimer = 0;
@@ -420,7 +420,7 @@ public:
for (ObjectGuid const& guid : NPC_ChampionGUIDs) for (ObjectGuid const& guid : NPC_ChampionGUIDs)
if (Creature* c = instance->GetCreature(guid)) if (Creature* c = instance->GetCreature(guid))
c->DespawnOrUnsummon(15000); c->DespawnOrUnsummon(15s);
NPC_ChampionGUIDs.clear(); NPC_ChampionGUIDs.clear();
if (Creature* c = instance->GetCreature(NPC_TirionGUID)) if (Creature* c = instance->GetCreature(NPC_TirionGUID))
@@ -1314,7 +1314,7 @@ public:
{ {
c->SetVisible(true); c->SetVisible(true);
c->AI()->Talk(SAY_STAGE_4_05); c->AI()->Talk(SAY_STAGE_4_05);
c->DespawnOrUnsummon(0); c->DespawnOrUnsummon(0ms);
} }
break; break;
@@ -214,7 +214,7 @@ class spell_trollgore_corpse_explode_aura : public AuraScript
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
if (Creature* target = GetTarget()->ToCreature()) if (Creature* target = GetTarget()->ToCreature())
target->DespawnOrUnsummon(1); target->DespawnOrUnsummon(1ms);
} }
void Register() override void Register() override
@@ -89,7 +89,7 @@ class spell_dtk_raise_dead_aura : public AuraScript
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
GetUnitOwner()->ToCreature()->DespawnOrUnsummon(1); GetUnitOwner()->ToCreature()->DespawnOrUnsummon(1ms);
GetUnitOwner()->SummonCreature(NPC_RISEN_DRAKKARI_WARRIOR, *GetUnitOwner()); GetUnitOwner()->SummonCreature(NPC_RISEN_DRAKKARI_WARRIOR, *GetUnitOwner());
} }
@@ -242,7 +242,7 @@ public:
{ {
me->GetMotionMaster()->MoveIdle(); me->GetMotionMaster()->MoveIdle();
me->CastSpell(b, SPELL_CONSUME_SOUL, true); me->CastSpell(b, SPELL_CONSUME_SOUL, true);
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
return; return;
} }
@@ -1153,7 +1153,7 @@ public:
ScriptedAI::EnterEvadeMode(why); ScriptedAI::EnterEvadeMode(why);
if (me->IsSummon()) if (me->IsSummon())
me->ToTempSummon()->DespawnOrUnsummon(1); me->ToTempSummon()->DespawnOrUnsummon(1ms);
} }
}; };
}; };
@@ -506,7 +506,7 @@ class spell_exploding_orb_auto_grow_aura : public AuraScript
target->RemoveAurasDueToSpell(SPELL_AUTO_GROW); target->RemoveAurasDueToSpell(SPELL_AUTO_GROW);
target->RemoveAurasDueToSpell(SPELL_EXPLODING_ORB_VISUAL); target->RemoveAurasDueToSpell(SPELL_EXPLODING_ORB_VISUAL);
if (target->IsCreature()) if (target->IsCreature())
target->ToCreature()->DespawnOrUnsummon(2000); target->ToCreature()->DespawnOrUnsummon(2s);
} }
} }
@@ -341,7 +341,7 @@ public:
Unit::Kill(c, c, false); Unit::Kill(c, c, false);
} }
c->DespawnOrUnsummon(10000); c->DespawnOrUnsummon(10s);
} }
pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_FINISHED_INTRO); pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_FINISHED_INTRO);
} }
@@ -1381,7 +1381,7 @@ class spell_pos_slave_trigger_closest : public SpellScript
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
if (Creature* c = target->ToCreature()) if (Creature* c = target->ToCreature())
{ {
c->DespawnOrUnsummon(7000); c->DespawnOrUnsummon(7s);
c->AI()->Talk(0, p); c->AI()->Talk(0, p);
c->m_Events.AddEvent(new SlaveRunEvent(*c), c->m_Events.CalculateTime(3000)); c->m_Events.AddEvent(new SlaveRunEvent(*c), c->m_Events.CalculateTime(3000));
} }
@@ -1406,7 +1406,7 @@ class spell_pos_rimefang_frost_nova : public SpellScript
{ {
Unit::Kill(caster, target); Unit::Kill(caster, target);
if (target->IsCreature()) if (target->IsCreature())
target->ToCreature()->DespawnOrUnsummon(30000); target->ToCreature()->DespawnOrUnsummon(30s);
} }
} }
@@ -308,7 +308,7 @@ public:
me->CastSpell(me, SPELL_FACE_ME, true); me->CastSpell(me, SPELL_FACE_ME, true);
me->CastSpell(me, SPELL_SURGE_VISUAL, true); me->CastSpell(me, SPELL_SURGE_VISUAL, true);
me->CastSpell(me, SPELL_MERGE, false); me->CastSpell(me, SPELL_MERGE, false);
me->DespawnOrUnsummon(2000); me->DespawnOrUnsummon(2s);
events.Reset(); events.Reset();
break; break;
} }
@@ -382,7 +382,7 @@ public:
{ {
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
me->GetMotionMaster()->MoveCharge(1672.96f, 743.488f, 143.338f, 7.0f, POINT_MERGE); me->GetMotionMaster()->MoveCharge(1672.96f, 743.488f, 143.338f, 7.0f, POINT_MERGE);
me->DespawnOrUnsummon(1200); me->DespawnOrUnsummon(1200ms);
} }
} }
@@ -133,7 +133,7 @@ public:
despawnTime = (summon->GetDistance(target) / 40.0f * 1000) + 500; despawnTime = (summon->GetDistance(target) / 40.0f * 1000) + 500;
} }
summon->DespawnOrUnsummon(despawnTime); summon->DespawnOrUnsummon(Milliseconds(despawnTime));
} }
uint32 GetData(uint32 /*type*/) const override uint32 GetData(uint32 /*type*/) const override
@@ -1213,7 +1213,7 @@ public:
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
@@ -1287,7 +1287,7 @@ public:
me->SetControlled(true, UNIT_STATE_ROOT); me->SetControlled(true, UNIT_STATE_ROOT);
me->StopMoving(); me->StopMoving();
me->CastSpell(me, SPELL_FLAMES, true); me->CastSpell(me, SPELL_FLAMES, true);
me->DespawnOrUnsummon(999); me->DespawnOrUnsummon(999ms);
me->CastSpell(me, SPELL_FLAME_SPHERE_DEATH_EFFECT, true); me->CastSpell(me, SPELL_FLAME_SPHERE_DEATH_EFFECT, true);
_exploded = true; _exploded = true;
} }
@@ -1331,7 +1331,7 @@ public:
me->SetInCombatWithZone(); me->SetInCombatWithZone();
return; return;
} }
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
void DamageDealt(Unit* target, uint32& damage, DamageEffectType /*damageType*/, SpellSchoolMask /*damageSchoolMask*/) override void DamageDealt(Unit* target, uint32& damage, DamageEffectType /*damageType*/, SpellSchoolMask /*damageSchoolMask*/) override
@@ -1424,7 +1424,7 @@ public:
case EVENT_BOMB_DESPAWN: case EVENT_BOMB_DESPAWN:
me->RemoveAllAuras(); me->RemoveAllAuras();
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->DespawnOrUnsummon(exploded ? 5000 : 0); me->DespawnOrUnsummon(exploded ? 5s : 0ms);
break; break;
case EVENT_CONTINUE_FALLING: case EVENT_CONTINUE_FALLING:
me->GetMotionMaster()->MovementExpired(false); me->GetMotionMaster()->MovementExpired(false);
@@ -1030,7 +1030,7 @@ public:
me->GetMotionMaster()->MoveCharge(chargePos[_index].GetPositionX(), chargePos[_index].GetPositionY(), chargePos[_index].GetPositionZ(), 13.0f, POINT_CHARGE); me->GetMotionMaster()->MoveCharge(chargePos[_index].GetPositionX(), chargePos[_index].GetPositionY(), chargePos[_index].GetPositionZ(), 13.0f, POINT_CHARGE);
} }
else if (action == ACTION_DESPAWN) else if (action == ACTION_DESPAWN)
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
private: private:
@@ -668,7 +668,7 @@ public:
continue; continue;
Creature* c = (*itr)->ToCreature(); Creature* c = (*itr)->ToCreature();
if (c->GetEntry() == NPC_SKYBREAKER_MARINE || c->GetEntry() == NPC_SKYBREAKER_SERGEANT || c->GetEntry() == NPC_KOR_KRON_REAVER || c->GetEntry() == NPC_KOR_KRON_SERGEANT) if (c->GetEntry() == NPC_SKYBREAKER_MARINE || c->GetEntry() == NPC_SKYBREAKER_SERGEANT || c->GetEntry() == NPC_KOR_KRON_REAVER || c->GetEntry() == NPC_KOR_KRON_SERGEANT)
c->DespawnOrUnsummon(1); c->DespawnOrUnsummon(1ms);
} }
} }
} }
@@ -880,7 +880,7 @@ public:
init.DisableTransportPathTransformations(); init.DisableTransportPathTransformations();
init.MovebyPath(path, 0); init.MovebyPath(path, 0);
init.Launch(); init.Launch();
me->DespawnOrUnsummon(18000); me->DespawnOrUnsummon(18s);
} }
} }
@@ -1216,7 +1216,7 @@ public:
init.DisableTransportPathTransformations(); init.DisableTransportPathTransformations();
init.MovebyPath(path, 0); init.MovebyPath(path, 0);
init.Launch(); init.Launch();
me->DespawnOrUnsummon(18000); me->DespawnOrUnsummon(18s);
} }
} }
@@ -482,7 +482,7 @@ public:
minrange = summon->GetExactDist(p); minrange = summon->GetExactDist(p);
} }
summon->ToTempSummon()->DespawnOrUnsummon(30000); summon->ToTempSummon()->DespawnOrUnsummon(30s);
} }
else else
{ {
@@ -949,7 +949,7 @@ public:
me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MovementExpired();
me->StopMoving(); me->StopMoving();
me->SetControlled(true, UNIT_STATE_STUNNED); me->SetControlled(true, UNIT_STATE_STUNNED);
me->DespawnOrUnsummon(500); me->DespawnOrUnsummon(500ms);
break; break;
default: default:
break; break;
@@ -977,7 +977,7 @@ public:
if (!me->GetVictim() || me->GetVictim()->GetGUID() != targetGUID) if (!me->GetVictim() || me->GetVictim()->GetGUID() != targetGUID)
{ {
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
return; return;
} }
@@ -397,7 +397,7 @@ public:
trapped->NearTeleportTo(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.GetPositionZ(), exitPos.GetOrientation(), false); trapped->NearTeleportTo(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.GetPositionZ(), exitPos.GetOrientation(), false);
} }
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
@@ -451,13 +451,13 @@ public:
} }
else else
{ {
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
return; return;
} }
} }
else else
{ {
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
return; return;
} }
@@ -352,7 +352,7 @@ public:
{ {
if (summon->GetEntry() != 38308 && summon->GetEntry() != 38309 && (!me->IsInCombat() || me->IsInEvadeMode())) if (summon->GetEntry() != 38308 && summon->GetEntry() != 38309 && (!me->IsInCombat() || me->IsInEvadeMode()))
{ {
summon->DespawnOrUnsummon(1); summon->DespawnOrUnsummon(1ms);
return; return;
} }
@@ -757,7 +757,7 @@ public:
if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE))) if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))
{ {
if (!professor->IsInCombat()) if (!professor->IsInCombat())
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
else else
professor->AI()->JustSummoned(me); professor->AI()->JustSummoned(me);
} }
@@ -1056,7 +1056,7 @@ class spell_putricide_ooze_channel : public SpellScript
if (targets.empty()) if (targets.empty())
{ {
FinishCast(SPELL_FAILED_NO_VALID_TARGETS); FinishCast(SPELL_FAILED_NO_VALID_TARGETS);
GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update GetCaster()->ToCreature()->DespawnOrUnsummon(1ms); // despawn next update
return; return;
} }
@@ -1491,7 +1491,7 @@ class spell_putricide_eat_ooze : public SpellScript
{ {
target->RemoveAurasDueToSpell(SPELL_GROW_STACKER); target->RemoveAurasDueToSpell(SPELL_GROW_STACKER);
target->RemoveAura(grow); target->RemoveAura(grow);
target->DespawnOrUnsummon(1); target->DespawnOrUnsummon(1ms);
} }
else else
grow->ModStackAmount(-4); grow->ModStackAmount(-4);
@@ -211,7 +211,7 @@ public:
if (me->IsAlive() && me->IsInCombat() && !me->IsInEvadeMode()) if (me->IsAlive() && me->IsInCombat() && !me->IsInEvadeMode())
summons.Summon(summon); summons.Summon(summon);
else else
summon->DespawnOrUnsummon(1); summon->DespawnOrUnsummon(1ms);
} }
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
@@ -373,7 +373,7 @@ public:
{ {
if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ROTFACE))) if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ROTFACE)))
rotface->AI()->SummonedCreatureDespawn(me); rotface->AI()->SummonedCreatureDespawn(me);
me->DespawnOrUnsummon(0); me->DespawnOrUnsummon(0ms);
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
@@ -798,7 +798,7 @@ class spell_rotface_unstable_ooze_explosion_suicide_aura : public AuraScript
target->SetVisible(false); target->SetVisible(false);
target->RemoveAllAuras(); target->RemoveAllAuras();
//target->ToCreature()->DespawnOrUnsummon(); //target->ToCreature()->DespawnOrUnsummon();
target->ToCreature()->DespawnOrUnsummon(60000); target->ToCreature()->DespawnOrUnsummon(60s);
} }
void Register() override void Register() override
@@ -720,7 +720,7 @@ public:
player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_DAMAGE); player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_DAMAGE);
player->RemoveAurasDueToSpell(SPELL_ASPHYXIATION); player->RemoveAurasDueToSpell(SPELL_ASPHYXIATION);
player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_UNTARGETABLE); player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_UNTARGETABLE);
me->DespawnOrUnsummon(5000); me->DespawnOrUnsummon(5s);
} }
} }
@@ -826,9 +826,9 @@ public:
me->SetDisableGravity(false); me->SetDisableGravity(false);
me->GetMotionMaster()->MoveFall(); me->GetMotionMaster()->MoveFall();
if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f))
frostmourne->DespawnOrUnsummon(1); frostmourne->DespawnOrUnsummon(1ms);
if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f)) if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f))
terenas->DespawnOrUnsummon(1); terenas->DespawnOrUnsummon(1ms);
me->m_Events.AddEvent(new LichKingDeathEvent(*me), me->m_Events.CalculateTime(2500)); // die after spinning anim is over, so death anim is visible me->m_Events.AddEvent(new LichKingDeathEvent(*me), me->m_Events.CalculateTime(2500)); // die after spinning anim is over, so death anim is visible
me->m_Events.AddEvent(new LichKingMovieEvent(*me), me->m_Events.CalculateTime(11500)); me->m_Events.AddEvent(new LichKingMovieEvent(*me), me->m_Events.CalculateTime(11500));
@@ -886,7 +886,7 @@ public:
break; break;
case NPC_VALKYR_SHADOWGUARD: case NPC_VALKYR_SHADOWGUARD:
if (_phase == PHASE_THREE || events.HasTimeUntilEvent(EVENT_QUAKE_2)) if (_phase == PHASE_THREE || events.HasTimeUntilEvent(EVENT_QUAKE_2))
summon->DespawnOrUnsummon(1); summon->DespawnOrUnsummon(1ms);
break; break;
default: default:
break; break;
@@ -2078,7 +2078,7 @@ class spell_the_lich_king_shadow_trap_periodic : public SpellScript
if (Aura* a = GetCaster()->GetAura(SPELL_SHADOW_TRAP_AURA)) if (Aura* a = GetCaster()->GetAura(SPELL_SHADOW_TRAP_AURA))
a->SetDuration(0); a->SetDuration(0);
if (GetCaster()->IsCreature()) if (GetCaster()->IsCreature())
GetCaster()->ToCreature()->DespawnOrUnsummon(3000); GetCaster()->ToCreature()->DespawnOrUnsummon(3s);
} }
void Register() override void Register() override
@@ -2134,7 +2134,7 @@ public:
{ {
me->RemoveAllAuras(); me->RemoveAllAuras();
me->CastSpell(me, SPELL_ICE_BURST, true); me->CastSpell(me, SPELL_ICE_BURST, true);
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
targetGUID.Clear(); targetGUID.Clear();
timer = 9999; timer = 9999;
me->InterruptNonMeleeSpells(true); me->InterruptNonMeleeSpells(true);
@@ -2238,7 +2238,7 @@ public:
if (Player* plr = ScriptedAI::SelectTargetFromPlayerList(100.0f, 0, true)) if (Player* plr = ScriptedAI::SelectTargetFromPlayerList(100.0f, 0, true))
plr->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL_CLONE, true); plr->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL_CLONE, true);
else else
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
} }
@@ -2449,7 +2449,7 @@ public:
if (IsHeroic()) if (IsHeroic())
GoSiphon(); GoSiphon();
else else
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
} }
void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) override void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) override
@@ -2519,7 +2519,7 @@ public:
if (IsHeroic()) if (IsHeroic())
GoSiphon(); GoSiphon();
else else
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
} }
break; break;
case POINT_START_SIPHON: case POINT_START_SIPHON:
@@ -2883,7 +2883,7 @@ class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScript
c->GetMotionMaster()->Clear(true); c->GetMotionMaster()->Clear(true);
c->StopMoving(); c->StopMoving();
c->CastSpell((Unit*)nullptr, SPELL_SPIRIT_BURST, true); c->CastSpell((Unit*)nullptr, SPELL_SPIRIT_BURST, true);
c->DespawnOrUnsummon(3000); c->DespawnOrUnsummon(3s);
c->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); c->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
} }
} }
@@ -2999,7 +2999,7 @@ public:
_events.Reset(); _events.Reset();
me->RemoveAllAuras(); me->RemoveAllAuras();
me->DespawnOrUnsummon(500); me->DespawnOrUnsummon(500ms);
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
lichKing->AI()->SummonedCreatureDespawn(me); lichKing->AI()->SummonedCreatureDespawn(me);
@@ -3050,7 +3050,7 @@ public:
case EVENT_DESPAWN_SELF: case EVENT_DESPAWN_SELF:
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
lichKing->AI()->SummonedCreatureDespawn(me); lichKing->AI()->SummonedCreatureDespawn(me);
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
break; break;
default: default:
break; break;
@@ -3098,7 +3098,7 @@ public:
{ {
_events.Reset(); _events.Reset();
me->CastSpell((Unit*)nullptr, SPELL_RESTORE_SOUL, false); me->CastSpell((Unit*)nullptr, SPELL_RESTORE_SOUL, false);
me->DespawnOrUnsummon(3000); me->DespawnOrUnsummon(3s);
} }
break; break;
} }
@@ -3118,14 +3118,14 @@ public:
if (Creature* warden = me->FindNearestCreature(NPC_SPIRIT_WARDEN, 20.0f)) if (Creature* warden = me->FindNearestCreature(NPC_SPIRIT_WARDEN, 20.0f))
{ {
warden->CastSpell((Unit*)nullptr, SPELL_DESTROY_SOUL, false); warden->CastSpell((Unit*)nullptr, SPELL_DESTROY_SOUL, false);
warden->DespawnOrUnsummon(2000); warden->DespawnOrUnsummon(2s);
} }
me->CastSpell(me, SPELL_TERENAS_LOSES_INSIDE, false); me->CastSpell(me, SPELL_TERENAS_LOSES_INSIDE, false);
me->SetDisplayId(16946); me->SetDisplayId(16946);
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
me->AttackStop(); me->AttackStop();
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->DespawnOrUnsummon(2000); me->DespawnOrUnsummon(2s);
} }
} }
} }
@@ -3414,7 +3414,7 @@ public:
npc_lk_spirit_bombAI(Creature* creature) : NullCreatureAI(creature) npc_lk_spirit_bombAI(Creature* creature) : NullCreatureAI(creature)
{ {
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
me->DespawnOrUnsummon(45000); // for safety me->DespawnOrUnsummon(45s); // for safety
timer = 0; timer = 0;
} }
@@ -3447,7 +3447,7 @@ public:
timer = 0; timer = 0;
me->RemoveAllAuras(); me->RemoveAllAuras();
me->CastSpell((Unit*)nullptr, SPELL_EXPLOSION, false); me->CastSpell((Unit*)nullptr, SPELL_EXPLOSION, false);
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
} }
else else
timer -= diff; timer -= diff;
@@ -177,14 +177,14 @@ private:
class DelayedCastEvent : public BasicEvent class DelayedCastEvent : public BasicEvent
{ {
public: public:
DelayedCastEvent(Creature* trigger, uint32 spellId, ObjectGuid originalCaster, uint32 despawnTime) : _trigger(trigger), _originalCaster(originalCaster), _spellId(spellId), _despawnTime(despawnTime) DelayedCastEvent(Creature* trigger, uint32 spellId, ObjectGuid originalCaster, Milliseconds despawnTime) : _trigger(trigger), _originalCaster(originalCaster), _spellId(spellId), _despawnTime(despawnTime)
{ {
} }
bool Execute(uint64 /*time*/, uint32 /*diff*/) override bool Execute(uint64 /*time*/, uint32 /*diff*/) override
{ {
_trigger->CastSpell(_trigger, _spellId, false, nullptr, nullptr, _originalCaster); _trigger->CastSpell(_trigger, _spellId, false, nullptr, nullptr, _originalCaster);
if (_despawnTime) if (_despawnTime > 0ms)
_trigger->DespawnOrUnsummon(_despawnTime); _trigger->DespawnOrUnsummon(_despawnTime);
return true; return true;
} }
@@ -193,7 +193,7 @@ private:
Creature* _trigger; Creature* _trigger;
ObjectGuid _originalCaster; ObjectGuid _originalCaster;
uint32 _spellId; uint32 _spellId;
uint32 _despawnTime; Milliseconds _despawnTime;
}; };
class AuraRemoveEvent : public BasicEvent class AuraRemoveEvent : public BasicEvent
@@ -406,7 +406,7 @@ public:
// this display id was found in sniff instead of the one on aura // this display id was found in sniff instead of the one on aura
me->SetDisplayId(11686); me->SetDisplayId(11686);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->DespawnOrUnsummon(4000); me->DespawnOrUnsummon(4s);
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING))) if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_LICH_KING)))
lichKing->CastSpell(lichKing, SPELL_SPAWN_CHEST, false); lichKing->CastSpell(lichKing, SPELL_SPAWN_CHEST, false);
_instance->SetData(DATA_WEEKLY_QUEST_ID, 0); // show hidden npc if necessary _instance->SetData(DATA_WEEKLY_QUEST_ID, 0); // show hidden npc if necessary
@@ -417,12 +417,12 @@ public:
{ {
if (summon->GetEntry() == NPC_DREAM_PORTAL_PRE_EFFECT) if (summon->GetEntry() == NPC_DREAM_PORTAL_PRE_EFFECT)
{ {
summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_SUMMON_DREAM_PORTAL, me->GetGUID(), 6000), summon->m_Events.CalculateTime(15000)); summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_SUMMON_DREAM_PORTAL, me->GetGUID(), 6s), summon->m_Events.CalculateTime(15000));
summon->m_Events.AddEvent(new AuraRemoveEvent(summon, SPELL_DREAM_PORTAL_VISUAL_PRE), summon->m_Events.CalculateTime(15000)); summon->m_Events.AddEvent(new AuraRemoveEvent(summon, SPELL_DREAM_PORTAL_VISUAL_PRE), summon->m_Events.CalculateTime(15000));
} }
else if (summon->GetEntry() == NPC_NIGHTMARE_PORTAL_PRE_EFFECT) else if (summon->GetEntry() == NPC_NIGHTMARE_PORTAL_PRE_EFFECT)
{ {
summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_SUMMON_NIGHTMARE_PORTAL, me->GetGUID(), 6000), summon->m_Events.CalculateTime(15000)); summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_SUMMON_NIGHTMARE_PORTAL, me->GetGUID(), 6s), summon->m_Events.CalculateTime(15000));
summon->m_Events.AddEvent(new AuraRemoveEvent(summon, SPELL_NIGHTMARE_PORTAL_VISUAL_PRE), summon->m_Events.CalculateTime(15000)); summon->m_Events.AddEvent(new AuraRemoveEvent(summon, SPELL_NIGHTMARE_PORTAL_VISUAL_PRE), summon->m_Events.CalculateTime(15000));
} }
} }
@@ -750,9 +750,9 @@ public:
void JustSummoned(Creature* summon) override void JustSummoned(Creature* summon) override
{ {
if (summon->GetEntry() == NPC_COLUMN_OF_FROST) if (summon->GetEntry() == NPC_COLUMN_OF_FROST)
summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_COLUMN_OF_FROST_DAMAGE, ObjectGuid::Empty, 8000), summon->m_Events.CalculateTime(2000)); summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_COLUMN_OF_FROST_DAMAGE, ObjectGuid::Empty, 8s), summon->m_Events.CalculateTime(2000));
else if (summon->GetEntry() == NPC_MANA_VOID) else if (summon->GetEntry() == NPC_MANA_VOID)
summon->DespawnOrUnsummon(36000); summon->DespawnOrUnsummon(36s);
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
@@ -886,7 +886,7 @@ public:
me->GetMotionMaster()->MoveIdle(); me->GetMotionMaster()->MoveIdle();
// must use originalCaster the same for all clouds to allow stacking // must use originalCaster the same for all clouds to allow stacking
me->CastSpell(me, EMERALD_VIGOR, false, nullptr, nullptr, _instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); me->CastSpell(me, EMERALD_VIGOR, false, nullptr, nullptr, _instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER));
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
break; break;
default: default:
break; break;
@@ -1054,7 +1054,7 @@ public:
timer = 0; timer = 0;
me->SetDisplayId(11686); me->SetDisplayId(11686);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->DespawnOrUnsummon(2000); me->DespawnOrUnsummon(2s);
} }
else else
timer -= diff; timer -= diff;
@@ -1096,7 +1096,7 @@ public:
void JustSummoned(Creature* summon) override void JustSummoned(Creature* summon) override
{ {
if (me->GetInstanceScript() && me->GetInstanceScript()->GetBossState(DATA_VALITHRIA_DREAMWALKER) == DONE) if (me->GetInstanceScript() && me->GetInstanceScript()->GetBossState(DATA_VALITHRIA_DREAMWALKER) == DONE)
summon->DespawnOrUnsummon(1); summon->DespawnOrUnsummon(1ms);
else if (Unit* target = SelectTargetFromPlayerList(200.0f)) else if (Unit* target = SelectTargetFromPlayerList(200.0f))
summon->AI()->AttackStart(target); summon->AI()->AttackStart(target);
} }
@@ -534,12 +534,12 @@ public:
if (Creature* factionNPC = ObjectAccessor::GetCreature(*me, _factionNPC)) if (Creature* factionNPC = ObjectAccessor::GetCreature(*me, _factionNPC))
{ {
factionNPC->GetMotionMaster()->MovePath(factionNPC->GetSpawnId() * 10, false); factionNPC->GetMotionMaster()->MovePath(factionNPC->GetSpawnId() * 10, false);
factionNPC->DespawnOrUnsummon(46500); factionNPC->DespawnOrUnsummon(46500ms);
std::list<Creature*> followers; std::list<Creature*> followers;
factionNPC->GetCreaturesWithEntryInRange(followers, 30, _instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? NPC_KOR_KRON_GENERAL : NPC_ALLIANCE_COMMANDER); factionNPC->GetCreaturesWithEntryInRange(followers, 30, _instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? NPC_KOR_KRON_GENERAL : NPC_ALLIANCE_COMMANDER);
for (Creature* follower : followers) for (Creature* follower : followers)
{ {
follower->DespawnOrUnsummon(46500); follower->DespawnOrUnsummon(46500ms);
} }
} }
me->setActive(false); me->setActive(false);
@@ -1810,7 +1810,7 @@ public:
{ {
_vehicleCheckTimer = 500; _vehicleCheckTimer = 500;
if (!me->GetVehicle()) if (!me->GetVehicle())
me->DespawnOrUnsummon(100); me->DespawnOrUnsummon(100ms);
} }
else else
_vehicleCheckTimer -= diff; _vehicleCheckTimer -= diff;
@@ -2151,7 +2151,7 @@ class spell_svalna_remove_spear : public SpellScript
{ {
if (Unit* vehicle = target->GetVehicleBase()) if (Unit* vehicle = target->GetVehicleBase())
vehicle->RemoveAurasDueToSpell(SPELL_IMPALING_SPEAR); vehicle->RemoveAurasDueToSpell(SPELL_IMPALING_SPEAR);
target->DespawnOrUnsummon(1); target->DespawnOrUnsummon(1ms);
} }
} }
@@ -499,7 +499,7 @@ public:
break; break;
case NPC_INFILTRATOR_MINCHAR_BQ: case NPC_INFILTRATOR_MINCHAR_BQ:
if (BloodQuickeningState == DONE) if (BloodQuickeningState == DONE)
creature->DespawnOrUnsummon(1); creature->DespawnOrUnsummon(1ms);
break; break;
case NPC_MINCHAR_BEAM_STALKER: case NPC_MINCHAR_BEAM_STALKER:
if (BloodQuickeningState != DONE) if (BloodQuickeningState != DONE)
@@ -661,7 +661,7 @@ public:
{ {
c->CastSpell(c, VOID_ZONE_VISUAL, true); c->CastSpell(c, VOID_ZONE_VISUAL, true);
unit->SummonCreature(NPC_RISEN_DEATHSPEAKER_SERVANT, *unit, TEMPSUMMON_MANUAL_DESPAWN); unit->SummonCreature(NPC_RISEN_DEATHSPEAKER_SERVANT, *unit, TEMPSUMMON_MANUAL_DESPAWN);
unit->ToCreature()->DespawnOrUnsummon(3000); unit->ToCreature()->DespawnOrUnsummon(3s);
} }
break; break;
default: default:
@@ -507,7 +507,7 @@ public:
{ {
if (!me->IsInCombat()) if (!me->IsInCombat())
{ {
me->DespawnOrUnsummon(500); me->DespawnOrUnsummon(500ms);
} }
} }
if (param == ACTION_GUARDIANS_OFF) if (param == ACTION_GUARDIANS_OFF)
@@ -803,10 +803,10 @@ public:
{ {
case NPC_ARCANE_OVERLOAD: case NPC_ARCANE_OVERLOAD:
summon->CastSpell(summon, SPELL_ARCANE_OVERLOAD_DMG, true); summon->CastSpell(summon, SPELL_ARCANE_OVERLOAD_DMG, true);
summon->DespawnOrUnsummon(45000); summon->DespawnOrUnsummon(45s);
break; break;
case NPC_STATIC_FIELD: case NPC_STATIC_FIELD:
summon->DespawnOrUnsummon(20000); summon->DespawnOrUnsummon(20s);
break; break;
} }
} }
@@ -1018,7 +1018,7 @@ public:
me->ReplaceAllUnitFlags(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE); me->ReplaceAllUnitFlags(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
me->RemoveAura(SPELL_POWER_SPARK_VISUAL); me->RemoveAura(SPELL_POWER_SPARK_VISUAL);
me->CastSpell(me, SPELL_POWER_SPARK_GROUND_BUFF, true); me->CastSpell(me, SPELL_POWER_SPARK_GROUND_BUFF, true);
me->DespawnOrUnsummon(60000); me->DespawnOrUnsummon(60s);
} }
} }
} }
@@ -1459,14 +1459,14 @@ public:
else if (pass && pass->IsPlayer() && me->IsAlive()) else if (pass && pass->IsPlayer() && me->IsAlive())
{ {
me->SetDisplayId(11686); // prevents nasty falling animation at despawn me->SetDisplayId(11686); // prevents nasty falling animation at despawn
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
} }
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
me->SetDisplayId(11686); // prevents nasty falling animation at despawn me->SetDisplayId(11686); // prevents nasty falling animation at despawn
me->DespawnOrUnsummon(1); me->DespawnOrUnsummon(1ms);
} }
}; };
}; };
@@ -29,7 +29,7 @@ bool EoEDrakeEnterVehicleEvent::Execute(uint64 /*eventTime*/, uint32 /*updateTim
p->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, &_owner, true); p->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, &_owner, true);
return true; return true;
} }
_owner.DespawnOrUnsummon(1); _owner.DespawnOrUnsummon(1ms);
return true; return true;
} }
@@ -150,7 +150,7 @@ struct boss_magus_telestra : public BossAI
if (spellInfo->Id >= SPELL_FIRE_MAGUS_DEATH && spellInfo->Id <= SPELL_ARCANE_MAGUS_DEATH && caster->ToCreature()) if (spellInfo->Id >= SPELL_FIRE_MAGUS_DEATH && spellInfo->Id <= SPELL_ARCANE_MAGUS_DEATH && caster->ToCreature())
{ {
events.ScheduleEvent(EVENT_MAGUS_FAIL_ACHIEVEMENT, 5s); events.ScheduleEvent(EVENT_MAGUS_FAIL_ACHIEVEMENT, 5s);
caster->ToCreature()->DespawnOrUnsummon(1000); caster->ToCreature()->DespawnOrUnsummon(1s);
if (++copiesDied >= 3) if (++copiesDied >= 3)
{ {
@@ -387,7 +387,7 @@ public:
} }
else else
{ {
me->DespawnOrUnsummon(2050); me->DespawnOrUnsummon(2050ms);
me->SetOrientation(2.5f); me->SetOrientation(2.5f);
me->SetSpeedRate(MOVE_FLIGHT, 1.0f); me->SetSpeedRate(MOVE_FLIGHT, 1.0f);
Position pos = me->GetPosition(); Position pos = me->GetPosition();
@@ -444,7 +444,7 @@ public:
} }
else else
{ {
me->DespawnOrUnsummon(2050); me->DespawnOrUnsummon(2050ms);
me->SetOrientation(2.5f); me->SetOrientation(2.5f);
me->SetSpeedRate(MOVE_FLIGHT, 1.0f); me->SetSpeedRate(MOVE_FLIGHT, 1.0f);
Position pos = me->GetPosition(); Position pos = me->GetPosition();
@@ -461,7 +461,7 @@ public:
{ {
if (despawnTimer >= 5000) if (despawnTimer >= 5000)
{ {
me->DespawnOrUnsummon(2050); me->DespawnOrUnsummon(2050ms);
me->SetOrientation(2.5f); me->SetOrientation(2.5f);
Position pos = me->GetPosition(); Position pos = me->GetPosition();
Position offset = { 10.0f, 10.0f, 12.0f, 0.0f }; Position offset = { 10.0f, 10.0f, 12.0f, 0.0f };
@@ -269,7 +269,7 @@ public:
me->RemoveAllAuras(); me->RemoveAllAuras();
me->CastSpell(me, SPELL_SPARK_DESPAWN, true); me->CastSpell(me, SPELL_SPARK_DESPAWN, true);
me->DespawnOrUnsummon(1000); me->DespawnOrUnsummon(1s);
} }
} }
}; };

Some files were not shown because too many files have changed in this diff Show More