diff --git a/src/common/Utilities/EventMap.h b/src/common/Utilities/EventMap.h index 15d2e233d..31fd13591 100644 --- a/src/common/Utilities/EventMap.h +++ b/src/common/Utilities/EventMap.h @@ -97,6 +97,32 @@ public: return _eventMap.empty(); } + /** + * @return Current internal time as uint32 milliseconds + * + * was removed in core https://github.com/azerothcore/azerothcore-wotlk/pull/23121, + * but still required atm for mod-playerbot. + */ + uint32 GetTimer() const + { + return static_cast(duration_cast(_time.time_since_epoch()).count()); + } + + /** + * @return Time of found even + * + * was removed in core https://github.com/azerothcore/azerothcore-wotlk/pull/23121, + * but still required atm for mod-playerbot. + */ + uint32 GetNextEventTime(uint16 eventId) const + { + auto timeUntil = GetTimeUntilEvent(eventId); + if (timeUntil == Milliseconds::max()) + return 0; + + return GetTimer() + static_cast(timeUntil.count()); + } + /** * @name SetPhase * @brief Sets the phase of the map (absolute). diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 8c093974e..c5596e401 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -939,7 +939,7 @@ void MotionMaster::MoveKnockbackFromForPlayer(float srcX, float srcY, float spee init.SetOrientationFixed(true); init.SetVelocity(speedXY); init.Launch(); - Mutate(new EffectMovementGenerator(0), MOTION_SLOT_CONTROLLED); + Mutate(new EffectMovementGenerator(init, 0), MOTION_SLOT_CONTROLLED); } // Similar to MovePoint except setting orientationInversed @@ -951,12 +951,12 @@ void MotionMaster::MovePointBackwards(uint32 id, float x, float y, float z, bool if (_owner->IsPlayer()) { LOG_DEBUG("movement.motionmaster", "Player ({}) targeted point (Id: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z); - Mutate(new PointMovementGenerator(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination, ObjectGuid::Empty, true), slot); + Mutate(new PointMovementGenerator(id, x, y, z,FORCED_MOVEMENT_NONE,0.0f,orientation,nullptr,generatePath,forceDestination), slot); } else { LOG_DEBUG("movement.motionmaster", "Creature ({}) targeted point (ID: {} X: {} Y: {} Z: {})", _owner->GetGUID().ToString(), id, x, y, z); - Mutate(new PointMovementGenerator(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination, ObjectGuid::Empty, true), slot); + Mutate(new PointMovementGenerator(id, x, y, z, FORCED_MOVEMENT_NONE, 0.0f, orientation, nullptr, generatePath, forceDestination), slot); } } diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index 0917a6184..13519822f 100644 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -48,7 +48,7 @@ void PointMovementGenerator::DoInitialize(T* unit) i_recalculateSpeed = false; Movement::MoveSplineInit init(unit); /// Added by mod-playerbots - if (_orientationInversed) + if (_reverseOrientation) init.SetOrientationInversed(); /// End added if (m_precomputedPath.size() > 2) // pussywizard: for charge diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.h b/src/server/scripts/Northrend/Naxxramas/boss_gluth.h index 0d10dcdd3..285d2fd7b 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.h +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.h @@ -103,7 +103,7 @@ public: me->SetInCombatWithZone(); events.ScheduleEvent(EVENT_MORTAL_WOUND, 10s); events.ScheduleEvent(EVENT_ENRAGE, 22s); - events.ScheduleEvent(EVENT_DECIMATE, RAID_MODE(110000, 90000)); + events.ScheduleEvent(EVENT_DECIMATE, RAID_MODE(110s, 90s)); events.ScheduleEvent(EVENT_BERSERK, 6min); events.ScheduleEvent(EVENT_SUMMON_ZOMBIE, 10s); events.ScheduleEvent(EVENT_CAN_EAT_ZOMBIE, 1s); @@ -182,7 +182,7 @@ public: case EVENT_DECIMATE: Talk(EMOTE_DECIMATE); me->CastSpell(me, RAID_MODE(SPELL_DECIMATE_10, SPELL_DECIMATE_25), false); - events.RepeatEvent(RAID_MODE(110000, 90000)); + events.Repeat(RAID_MODE(110s, 90s)); break; case EVENT_SUMMON_ZOMBIE: { @@ -206,7 +206,7 @@ public: break; } case EVENT_CAN_EAT_ZOMBIE: - events.RepeatEvent(1000); + events.Repeat(1s); if (me->GetVictim()->GetEntry() == NPC_ZOMBIE_CHOW && me->IsWithinMeleeRange(me->GetVictim())) { me->CastCustomSpell(SPELL_CHOW_SEARCHER, SPELLVALUE_RADIUS_MOD, 20000, me, true); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.h b/src/server/scripts/Northrend/Naxxramas/boss_gothik.h index 57429c57d..3eaf06e61 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.h +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.h @@ -428,7 +428,7 @@ public: if (gothikWaves[waveCount][0]) { SummonHelpers(gothikWaves[waveCount][0]); - events.RepeatEvent(gothikWaves[waveCount][1]); + events.Repeat(Milliseconds(gothikWaves[waveCount][1])); } else { @@ -510,7 +510,7 @@ public: events.ScheduleEvent(EVENT_SHADOW_BOLT_VOLLEY, 3s); break; case NPC_DEAD_RIDER: - events.ScheduleEvent(EVENT_DRAIN_LIFE, 2000ms, 3500ms); + events.ScheduleEvent(EVENT_DRAIN_LIFE, 2s, 3500ms); events.ScheduleEvent(EVENT_UNHOLY_FRENZY, 5s, 9s); break; case NPC_DEAD_HORSE: diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.h b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.h index 7d88305f6..a423309b8 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.h +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.h @@ -90,7 +90,7 @@ public: events.ScheduleEvent(EVENT_POISON_CLOUD, 15s); events.ScheduleEvent(EVENT_MUTATING_INJECTION, 20s); events.ScheduleEvent(EVENT_SLIME_SPRAY, 10s); - events.ScheduleEvent(EVENT_BERSERK, RAID_MODE(720000, 540000)); + events.ScheduleEvent(EVENT_BERSERK, RAID_MODE(720s, 540s)); } void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override @@ -165,7 +165,7 @@ public: { me->CastSpell(target, SPELL_MUTATING_INJECTION, false); } - events.RepeatEvent(6000 + uint32(120 * me->GetHealthPct())); + events.Repeat(Milliseconds(6000 + uint32(120 * me->GetHealthPct()))); break; } DoMeleeAttackIfReady(); @@ -279,6 +279,7 @@ class spell_grobbulus_mutating_injection_aura : public AuraScript } }; + } #endif \ No newline at end of file diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.h b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.h index a990a4dde..6ba60167a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.h +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.h @@ -439,7 +439,7 @@ public: cr->AI()->Talk(SAY_ANSWER_REQUEST); for (uint8 i = 0 ; i < RAID_MODE(2, 4); ++i) - events.ScheduleEvent(EVENT_SUMMON_GUARDIAN_OF_ICECROWN, 10000 + (i * 5000)); + events.ScheduleEvent(EVENT_SUMMON_GUARDIAN_OF_ICECROWN, Milliseconds(10000 + (i * 5000))); break; } @@ -495,7 +495,7 @@ public: { if (!me->IsInCombat()) { - me->DespawnOrUnsummon(500); + me->DespawnOrUnsummon(500ms); } } if (param == ACTION_GUARDIANS_OFF) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.h b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.h index 1627510b7..6cf7d1c23 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.h +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.h @@ -268,7 +268,7 @@ public: { cr->GetMotionMaster()->MoveRandom(40); } - events.RepeatEvent(RAID_MODE(8000, 6500)); + events.Repeat(RAID_MODE(8000ms, 6500ms)); return; } case EVENT_FLIGHT_START: @@ -337,7 +337,7 @@ public: blockList.push_back((*itr)->GetGUID()); currentTarget = (*itr)->GetGUID(); --iceboltCount; - events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, (me->GetExactDist(*itr) / 13.0f)*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, Seconds(uint32(me->GetExactDist(*itr) / 13.0f))); } else {