diff --git a/src/common/Utilities/EventMap.cpp b/src/common/Utilities/EventMap.cpp index b82507b5281..ae83ab0571f 100644 --- a/src/common/Utilities/EventMap.cpp +++ b/src/common/Utilities/EventMap.cpp @@ -33,7 +33,7 @@ void EventMap::SetPhase(uint8 phase) _phase = uint8(1 << (phase - 1)); } -void EventMap::ScheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group /*= 0*/, uint32 phase /*= 0*/) +void EventMap::ScheduleEvent(uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group /*= 0*/, uint32 phase /*= 0*/) { ScheduleEvent(eventId, urand(uint32(minTime.count()), uint32(maxTime.count())), group, phase); } @@ -49,7 +49,7 @@ void EventMap::ScheduleEvent(uint32 eventId, uint32 time, uint32 group /*= 0*/, _eventMap.insert(EventStore::value_type(_time + time, eventId)); } -void EventMap::RescheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group /*= 0*/, uint32 phase /*= 0*/) +void EventMap::RescheduleEvent(uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group /*= 0*/, uint32 phase /*= 0*/) { RescheduleEvent(eventId, urand(uint32(minTime.count()), uint32(maxTime.count())), group, phase); } diff --git a/src/common/Utilities/EventMap.h b/src/common/Utilities/EventMap.h index e8f062c54fe..6c99665126e 100644 --- a/src/common/Utilities/EventMap.h +++ b/src/common/Utilities/EventMap.h @@ -120,7 +120,7 @@ public: * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. */ - void ScheduleEvent(uint32 eventId, Milliseconds const& time, uint32 group = 0, uint8 phase = 0) + void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group = 0, uint8 phase = 0) { ScheduleEvent(eventId, uint32(time.count()), group, phase); } @@ -134,7 +134,7 @@ public: * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. */ - void ScheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group = 0, uint32 phase = 0); + void ScheduleEvent(uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group = 0, uint32 phase = 0); /** * @name ScheduleEvent @@ -154,7 +154,7 @@ public: * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. */ - void RescheduleEvent(uint32 eventId, Milliseconds const& time, uint32 group = 0, uint8 phase = 0) + void RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group = 0, uint8 phase = 0) { RescheduleEvent(eventId, uint32(time.count()), group, phase); } @@ -168,7 +168,7 @@ public: * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group. * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases. */ - void RescheduleEvent(uint32 eventId, Milliseconds const& minTime, Milliseconds const& maxTime, uint32 group = 0, uint32 phase = 0); + void RescheduleEvent(uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group = 0, uint32 phase = 0); /** * @name RescheduleEvent @@ -189,7 +189,7 @@ public: * @brief Repeats the mostly recently executed event. * @param time Time until in milliseconds as std::chrono::duration the event occurs. */ - void Repeat(Milliseconds const& time) + void Repeat(Milliseconds time) { Repeat(uint32(time.count())); } @@ -210,7 +210,7 @@ public: * @param minTime Minimum time as std::chrono::duration until the event occurs. * @param maxTime Maximum time as std::chrono::duration until the event occurs. */ - void Repeat(Milliseconds const& minTime, Milliseconds const& maxTime) + void Repeat(Milliseconds minTime, Milliseconds maxTime) { Repeat(uint32(minTime.count()), uint32(maxTime.count())); } @@ -235,7 +235,7 @@ public: * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0. * @param delay Amount of delay in ms as std::chrono::duration. */ - void DelayEvents(Milliseconds const& delay) + void DelayEvents(Milliseconds delay) { DelayEvents(uint32(delay.count())); } @@ -256,7 +256,7 @@ public: * @param delay Amount of delay in ms as std::chrono::duration. * @param group Group of the events. */ - void DelayEvents(Milliseconds const& delay, uint32 group) + void DelayEvents(Milliseconds delay, uint32 group) { DelayEvents(uint32(delay.count()), group); } diff --git a/src/common/Utilities/EventProcessor.h b/src/common/Utilities/EventProcessor.h index 7686c5faeb7..a90fa4c3d08 100644 --- a/src/common/Utilities/EventProcessor.h +++ b/src/common/Utilities/EventProcessor.h @@ -80,7 +80,7 @@ class TC_COMMON_API EventProcessor void Update(uint32 p_time); void KillAllEvents(bool force); void AddEvent(BasicEvent* event, uint64 e_time, bool set_addtime = true); - void AddEventAtOffset(BasicEvent* event, Milliseconds const& offset) { AddEvent(event, CalculateTime(offset.count())); } + void AddEventAtOffset(BasicEvent* event, Milliseconds offset) { AddEvent(event, CalculateTime(offset.count())); } void ModifyEventTime(BasicEvent* event, uint64 newTime); uint64 CalculateTime(uint64 t_offset) const { return m_time + t_offset; } diff --git a/src/common/Utilities/Random.cpp b/src/common/Utilities/Random.cpp index f4902c51710..4423e07fa67 100644 --- a/src/common/Utilities/Random.cpp +++ b/src/common/Utilities/Random.cpp @@ -63,7 +63,7 @@ float frand(float min, float max) return float(GetRng()->Random() * (max - min) + min); } -Milliseconds randtime(Milliseconds const& min, Milliseconds const& max) +Milliseconds randtime(Milliseconds min, Milliseconds max) { long long diff = max.count() - min.count(); ASSERT(diff >= 0); diff --git a/src/common/Utilities/Random.h b/src/common/Utilities/Random.h index 9e13e7cd7e0..612b0312318 100644 --- a/src/common/Utilities/Random.h +++ b/src/common/Utilities/Random.h @@ -36,7 +36,7 @@ TC_COMMON_API uint32 urandms(uint32 min, uint32 max); TC_COMMON_API uint32 rand32(); /* Return a random time in the range min..max (up to millisecond precision). Only works for values where millisecond difference is a valid uint32. */ -TC_COMMON_API Milliseconds randtime(Milliseconds const& min, Milliseconds const& max); +TC_COMMON_API Milliseconds randtime(Milliseconds min, Milliseconds max); /* Return a random number in the range min..max */ TC_COMMON_API float frand(float min, float max); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index a92ae3e960d..88a1c146ad7 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1894,7 +1894,7 @@ void Creature::Respawn(bool force) GetName().c_str(), GetGUID().ToString().c_str()); } -void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds const& forceRespawnTimer) +void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer) { if (timeMSToDespawn) { @@ -1946,7 +1946,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds const& forceRespawn } } -void Creature::DespawnOrUnsummon(uint32 msTimeToDespawn /*= 0*/, Seconds const& forceRespawnTimer /*= 0*/) +void Creature::DespawnOrUnsummon(uint32 msTimeToDespawn /*= 0*/, Seconds forceRespawnTimer /*= 0*/) { if (TempSummon* summon = this->ToTempSummon()) summon->UnSummon(msTimeToDespawn); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 12c9bb3618a..36fcc75b13c 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -224,8 +224,8 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma void RemoveCorpse(bool setSpawnTime = true); - void DespawnOrUnsummon(uint32 msTimeToDespawn = 0, Seconds const& forceRespawnTime = Seconds(0)); - void DespawnOrUnsummon(Milliseconds const& time, Seconds const& forceRespawnTime = Seconds(0)) { DespawnOrUnsummon(uint32(time.count()), forceRespawnTime); } + void DespawnOrUnsummon(uint32 msTimeToDespawn = 0, Seconds forceRespawnTime = 0s); + void DespawnOrUnsummon(Milliseconds time, Seconds forceRespawnTime = 0s) { DespawnOrUnsummon(uint32(time.count()), forceRespawnTime); } time_t const& GetRespawnTime() const { return m_respawnTime; } time_t GetRespawnTimeEx() const; @@ -384,7 +384,7 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma bool CanAlwaysSee(WorldObject const* obj) const override; private: - void ForcedDespawn(uint32 timeMSToDespawn = 0, Seconds const& forceRespawnTimer = Seconds(0)); + void ForcedDespawn(uint32 timeMSToDespawn = 0, Seconds forceRespawnTimer = 0s); bool CheckNoGrayAggroConfig(uint32 playerLevel, uint32 creatureLevel) const; // No aggro from gray creatures //WaypointMovementGenerator vars @@ -424,7 +424,7 @@ class TC_GAME_API AssistDelayEvent : public BasicEvent class TC_GAME_API ForcedDespawnDelayEvent : public BasicEvent { public: - ForcedDespawnDelayEvent(Creature& owner, Seconds const& respawnTimer) : BasicEvent(), m_owner(owner), m_respawnTimer(respawnTimer) { } + ForcedDespawnDelayEvent(Creature& owner, Seconds respawnTimer) : BasicEvent(), m_owner(owner), m_respawnTimer(respawnTimer) { } bool Execute(uint64 e_time, uint32 p_time) override; private: diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 3d936750c46..9c3886d5dad 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -801,7 +801,7 @@ void GameObject::AddUniqueUse(Player* player) m_unique_users.insert(player->GetGUID()); } -void GameObject::DespawnOrUnsummon(Milliseconds const& delay, Seconds const& forceRespawnTime) +void GameObject::DespawnOrUnsummon(Milliseconds delay, Seconds forceRespawnTime) { if (delay > 0ms) { diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 8654c8b2bc7..8931829538a 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -153,7 +153,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject void SetSpawnedByDefault(bool b) { m_spawnedByDefault = b; } uint32 GetRespawnDelay() const { return m_respawnDelayTime; } void Refresh(); - void DespawnOrUnsummon(Milliseconds const& delay = 0ms, Seconds const& forceRespawnTime = 0s); + void DespawnOrUnsummon(Milliseconds delay = 0ms, Seconds forceRespawnTime = 0s); void Delete(); void SendGameObjectDespawn(); void getFishLoot(Loot* loot, Player* loot_owner); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 2b84e0b9f1f..9497af15e84 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -394,8 +394,9 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation ZoneScript* GetZoneScript() const { return m_zoneScript; } TempSummon* SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, uint32 despawnTime = 0, uint32 vehId = 0, bool visibleBySummonerOnly = false); - TempSummon* SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType, Milliseconds const& despawnTime, uint32 vehId = 0, bool visibleBySummonerOnly = false) { return SummonCreature(entry, pos, despawnType, uint32(despawnTime.count()), vehId, visibleBySummonerOnly); } + TempSummon* SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType, Milliseconds despawnTime, uint32 vehId = 0, bool visibleBySummonerOnly = false) { return SummonCreature(entry, pos, despawnType, uint32(despawnTime.count()), vehId, visibleBySummonerOnly); } TempSummon* SummonCreature(uint32 entry, float x, float y, float z, float o = 0, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, uint32 despawnTime = 0, bool visibleBySummonerOnly = false); + GameObject* SummonGameObject(uint32 entry, Position const& pos, QuaternionData const& rot, uint32 respawnTime /* s */, GOSummonType summonType = GO_SUMMON_TIMED_OR_CORPSE_DESPAWN); GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, QuaternionData const& rot, uint32 respawnTime /* s */); Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = nullptr); diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp index 7fcbcc7566d..3e38adcfc43 100644 --- a/src/server/game/Scripting/ScriptReloadMgr.cpp +++ b/src/server/game/Scripting/ScriptReloadMgr.cpp @@ -1034,7 +1034,7 @@ private: // Wait for the current build job to finish, if the job finishes in time // evaluate it and continue with the next one. if (_build_job->GetProcess()->GetFutureResult(). - wait_for(std::chrono::seconds(0)) == std::future_status::ready) + wait_for(0s) == std::future_status::ready) ProcessReadyBuildJob(); else return; // Return when the job didn't finish in time diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 046c880bab3..b8d2fb8e8bc 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -1045,11 +1045,11 @@ void WorldSession::ProcessQueryCallbacks() { _queryProcessor.ProcessReadyQueries(); - if (_realmAccountLoginCallback.valid() && _realmAccountLoginCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) + if (_realmAccountLoginCallback.valid() && _realmAccountLoginCallback.wait_for(0s) == std::future_status::ready) InitializeSessionCallback(_realmAccountLoginCallback.get()); //! HandlePlayerLoginOpcode - if (_charLoginCallback.valid() && _charLoginCallback.wait_for(std::chrono::seconds(0)) == std::future_status::ready) + if (_charLoginCallback.valid() && _charLoginCallback.wait_for(0s) == std::future_status::ready) HandlePlayerLogin(reinterpret_cast(_charLoginCallback.get())); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index 6f930c22739..ccccd955062 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -167,7 +167,7 @@ public: void SetupGroundPhase() { events.SetPhase(PHASE_GROUND); - events.ScheduleEvent(EVENT_CLEAVE, Seconds(0), Seconds(15), GROUP_GROUND); + events.ScheduleEvent(EVENT_CLEAVE, 0s, Seconds(15), GROUP_GROUND); events.ScheduleEvent(EVENT_TAIL_SWEEP, Seconds(4), Seconds(23), GROUP_GROUND); events.ScheduleEvent(EVENT_BELLOWING_ROAR, Seconds(48), GROUP_GROUND); events.ScheduleEvent(EVENT_CHARRED_EARTH, Seconds(12), Seconds(18), GROUP_GROUND); diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 306caa6c3f5..827628b7e7e 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -385,12 +385,12 @@ public: _assassinCount = 6; _guardianCount = 2; _venomancerCount = 2; - events.ScheduleEvent(EVENT_DARTER, Seconds(0), 0, PHASE_SUBMERGE); + events.ScheduleEvent(EVENT_DARTER, 0s, 0, PHASE_SUBMERGE); break; } _petCount = _guardianCount + _venomancerCount; if (_assassinCount) - events.ScheduleEvent(EVENT_ASSASSIN, Seconds(0), 0, PHASE_SUBMERGE); + events.ScheduleEvent(EVENT_ASSASSIN, 0s, 0, PHASE_SUBMERGE); if (_guardianCount) events.ScheduleEvent(EVENT_GUARDIAN, Seconds(4), 0, PHASE_SUBMERGE); if (_venomancerCount) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index a5724679fb5..a2b3a98a8af 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -104,7 +104,7 @@ class boss_faerlina : public CreatureScript summons.DoZoneInCombat(); events.ScheduleEvent(EVENT_POISON, randtime(Seconds(10), Seconds(15))); events.ScheduleEvent(EVENT_FIRE, randtime(Seconds(6), Seconds(18))); - events.ScheduleEvent(EVENT_FRENZY, Minutes(1)+randtime(Seconds(0), Seconds(20))); + events.ScheduleEvent(EVENT_FRENZY, Minutes(1)+randtime(0s, Seconds(20))); } void Reset() override @@ -174,7 +174,7 @@ class boss_faerlina : public CreatureScript { DoCast(SPELL_FRENZY); Talk(EMOTE_FRENZY); - events.Repeat(Minutes(1) + randtime(Seconds(0), Seconds(20))); + events.Repeat(Minutes(1) + randtime(0s, Seconds(20))); } break; } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 2cd43cb8865..10a816333f4 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -532,7 +532,7 @@ class boss_gothik : public CreatureScript break; case EVENT_RESUME_ATTACK: me->SetReactState(REACT_AGGRESSIVE); - events.ScheduleEvent(EVENT_BOLT, Seconds(0), 0, PHASE_TWO); + events.ScheduleEvent(EVENT_BOLT, 0s, 0, PHASE_TWO); // return to the start of this method so victim side etc is re-evaluated return UpdateAI(0u); // tail recursion for efficiency case EVENT_BOLT: diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index 72027239e6c..2a3382261a9 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -182,7 +182,7 @@ class boss_sapphiron : public CreatureScript me->CastSpell(me, SPELL_FROST_AURA, true); events.SetPhase(PHASE_GROUND); - events.ScheduleEvent(EVENT_CHECK_RESISTS, Seconds(0)); + events.ScheduleEvent(EVENT_CHECK_RESISTS, 0s); events.ScheduleEvent(EVENT_BERSERK, Minutes(15)); EnterPhaseGround(true); } @@ -207,7 +207,7 @@ class boss_sapphiron : public CreatureScript void MovementInform(uint32 /*type*/, uint32 id) override { if (id == 1) - events.ScheduleEvent(EVENT_LIFTOFF, Seconds(0), 0, PHASE_FLIGHT); + events.ScheduleEvent(EVENT_LIFTOFF, 0s, 0, PHASE_FLIGHT); } void DoAction(int32 param) override diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index 64f0e1d3b75..e05ad60430f 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -223,7 +223,7 @@ class boss_erekem : public CreatureScript task.Repeat(Seconds(8), Seconds(13)); }); - scheduler.Schedule(Seconds(0), [this](TaskContext task) + scheduler.Schedule(0s, [this](TaskContext task) { for (uint32 i = DATA_EREKEM_GUARD_1; i <= DATA_EREKEM_GUARD_2; ++i) { diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 54573cf91c9..661e593f9eb 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -585,7 +585,7 @@ class npc_azure_saboteur : public CreatureScript { if (type == EFFECT_MOTION_TYPE && pointId == POINT_INTRO) { - _scheduler.Schedule(Seconds(0), [this](TaskContext task) + _scheduler.Schedule(0s, [this](TaskContext task) { me->CastSpell(me, SPELL_SHIELD_DISRUPTION, false); diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 7e34fc1646b..e5e35ae150c 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -1464,7 +1464,7 @@ public: switch (me->GetEntry()) { case NPC_ENRAGED_WATER_SPIRIT: - _events.ScheduleEvent(EVENT_ENRAGED_WATER_SPIRIT, Seconds(0), Seconds(1)); + _events.ScheduleEvent(EVENT_ENRAGED_WATER_SPIRIT, 0s, Seconds(1)); break; case NPC_ENRAGED_FIRE_SPIRIT: if (!me->GetAura(SPELL_FEL_FIRE_AURA))