refactor(Core): DespawnOrUnsummon (#23141)
This commit is contained in:
@@ -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 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;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
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); }
|
||||
|
||||
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())
|
||||
{
|
||||
@@ -325,13 +325,13 @@ void ScriptedAI::ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax
|
||||
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();
|
||||
|
||||
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();
|
||||
if (callForHelpRange)
|
||||
{
|
||||
ScheduleTimedEvent(0s, [&]
|
||||
ScheduleTimedEvent(0ms, [&]
|
||||
{
|
||||
me->CallForHelp(callForHelpRange);
|
||||
}, 2s);
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
void Summon(Creature const* summon) { storage_.push_back(summon->GetGUID()); }
|
||||
void Despawn(Creature const* summon) { storage_.remove(summon->GetGUID()); }
|
||||
void DespawnEntry(uint32 entry);
|
||||
void DespawnAll(uint32 delay = 0);
|
||||
void DespawnAll(Milliseconds delay = 0ms);
|
||||
bool IsAnyCreatureAlive() const;
|
||||
bool IsAnyCreatureWithEntryAlive(uint32 entry) const;
|
||||
bool IsAnyCreatureInCombat() const;
|
||||
@@ -355,11 +355,11 @@ struct ScriptedAI : public CreatureAI
|
||||
void ClearUniqueTimedEventsDone() { _uniqueTimedEvents.clear(); }
|
||||
|
||||
// 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 timerMax, std::function<void()> exec, Milliseconds repeatMin, Milliseconds repeatMax = 0s, uint32 uniqueId = 0) { ScheduleTimedEvent(0s, timerMax, exec, repeatMin, repeatMax, uniqueId); };
|
||||
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 = 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.
|
||||
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 HealthAbovePct(uint32 pct) const { return me->HealthAbovePct(pct); }
|
||||
@@ -463,7 +463,7 @@ enum HealthCheckStatus
|
||||
|
||||
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;
|
||||
std::function<void()> _exec;
|
||||
|
||||
@@ -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
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me);
|
||||
me->DespawnOrUnsummon(1);
|
||||
me->DespawnOrUnsummon(1ms);
|
||||
return;
|
||||
}
|
||||
mEscortInvokerCheckTimer = 1000;
|
||||
|
||||
Reference in New Issue
Block a user