Check if integral/floating point type arguments were parsed successfully.
std::stoull will happily parse floating point strings until the decimal separator and return the value.
Make sure for all parsing methods that we actually parsed the whole token.
This allows to use handler arguments like Variant<uint32, float> which will be populated with the right type
depending on the token value (e.g "10" vs "10.0").
(cherry picked from commit 7edad0d601a7ae925cba850c5a23019f99be2a1e)
* Core/Shared: Make Emote enum smart
* Scripts/Commands: Use enum type arg for HandleDebugAnimCommand
(cherry picked from commit 86dc58974a46b554042f33df674e3e40ef0cec1e)
* Scripts/ScarletMonastery: Fix wrong emote during Headless Horseman encounter
* Scripts/HoR: Fix wrong emote during escape event
* Core/Unit: Make improve type safety of HandleEmoteCommand
Change argument type to the expected enum type Emote
* Scripts/CoS: Use SetUInt32Value to set UNIT_NPC_EMOTESTATE
UNIT_NPC_EMOTESTATE is no flag field
(cherry picked from commit 6c7837f947ff4eb5110a116a371daa6f9e2b3bbe)
This ensures that we never pass a directory path StartProcess which results in a crash.
Closes#25216
(cherry picked from commit 98b1b20d6beea5e2fdea7e404e8d880953d4b2fb)
Cast damage spell in AfterEffectApply instead OnEffectHitTarget. This avoids the scenario where we try to apply an aura to a potential dead target.
Ref #21856
(cherry picked from commit 0dd4b685df53d9b61a53aaf3a577c2a9ed8cdd47)
* Scripts/AzjolNerub: Update Anub'Arak to current coding standards
* no functional changes
* Scripts/AzjolNerub: Update Anub'Arak Darter to current coding standards
* no functional changes
* Scripts/AzjolNerub: Update Anub'Arak Assassin to current coding standards
* no functional changes
* Scripts/AzjolNerub: Update Anub'Arak Guardian to current coding standards
* no functional changes
* Scripts/AzjolNerub: Update Anub'Arak Venomancer to current coding standards
* no functional changes
* Scripts/AzjolNerub: Update Anub'Arak Impale Target to current coding standards
* Scripts/AzjolNerub: Update Anub'Arak Pound spell to current coding standards
* Scripts/AzjolNerub: Update Anub'Arak carrion beetles aura script to current coding standards
(cherry picked from commit dab8768c183dc43f970187a65961fc8fce647c29)
* Scripts/Gundrak: Update Slad'Ran's script to use TaskScheduler
* No functional changes
* Scripts/Gundrak: Update Slad'Ran's adds to use TaskScheduler
* No functional changes
(cherry picked from commit 7abe9d66d049204240060f1976c51ff2297bf266)
* Scripts/Gundrak: Update Drakkari Colossus to current coding standards
* no functional changes
* Scripts/Gundrak: Update Drakkari Elemental to current coding standards
* no functional changes
* Scripts/Gundrak: Update Living Mojo to current coding standards
* no functional changes
(cherry picked from commit dd8666f38d6aad6401e8e303c57c62255856f5a4)
* Scripts/MoltenCore: Update Golemagg to current coding standards
* no functional changes
* Scripts/MoltenCore: Update Core Ranger to current coding standards
* no functional changes
(cherry picked from commit c88234727b47c037557eba6db8ae8ef1dee4eed7)
uint64 CalculateTime(uint64 t_offset) has been replaced with Milliseconds CalculateTime(Milliseconds t_offset).
Also add the std::chrono-ified overload void AddEvent(BasicEvent*, Milliseconds, bool)
(cherry picked from commit 92a02a5c8750913f596d7e3b58bf8439cb770c28)
DelayEvents(Milliseconds delay) had different semantics than
DelayEvents(Milliseconds delay, uint32 group).
The first method delayed the events only in the case the internal timer
already ticked at least for the amount of delay. In contrast the latter method
delayed events regardless of the internal timer value.
Use the latter semantics for DelayEvents(Milliseconds delay) as well which makes
the outcome more predictable. Adapt tests accordingly.
(cherry picked from commit 4470b9122379dc846b322a441951a03913912b71)
With the switch to std::chrono return type of GetTimeUntilEvent
we don't run into an overflow condition which happend with the previous
uint32 return value if the events scheduled execution time is in the past.
Test for this case.
(cherry picked from commit e877f988d1c4e1361612f3d5c4ebe915f746aee5)
To enable the test suite, make sure to configure CMake with -DBUILD_TESTING=1 , since it is disabled by default. The catch2 dependency will be downloaded during configure time.
Also add a new target "tests-common", which includes unit tests for the "common" project. To finally run the tests use the "test" target.
CircleCI: Run unit tests
(cherry picked from commit 6a28ee7b2a4269aa7e43265d1cd0067537e3e883)
The intention here is to add additional 30 seconds of delay to the current delay of EVENT_FLY_TO_RANDOM_PILLAR.
Instead of EventMap::GetNextEventTime, EventMap::GetTimeUntilEvent has to be used which returns the currently
scheduled delay until the event occurs.
EventMap::GetNextEventTime instead exposes the timer value internal to EventMap at which the event should occur.
(cherry picked from commit f1f251eb381bccc9164e29a81da9e013090543a4)
* Misc: Use [[fallthrough]] attribute instead of comment to mark intentional fallthroughs
Related: #25006
* Misc: Add some missing breaks (no-ops) to satisfy clang
Related: #25006Closes#25055
* Build: Enable -Wimplicit-fallthrough on clang
Closes#25006
* Core/AI: Remove unneeded null checks
GetMap() can never return NULL.
Fixes additionally -Wunused-variable warnings
reported by GCC.
* Core/GameObject: Fix a -Wunused-variable warning reported by GCC
* Core/Player: Fix a -Wunused-variable warning reported by GCC
* Scritps/CavernsOfTime: Fix -Wimplicit-fallthrough warnings reported by GCC
* Scritps/CavernsOfTime: Fix a -Wmaybe-uninitialized warning reported by GCC
Warning:
/home/peterke/DEV/TrinityCore/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/npc_arthas.cpp: In member function ‘virtual void npc_arthas_stratholme::npc_arthas_stratholmeAI::UpdateAI(uint32)’:
/home/peterke/DEV/TrinityCore/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/npc_arthas.cpp:1119:58: warning: ‘emote’ may be used uninitialized in this function [-Wmaybe-uninitialized]
1119 | (*it)->HandleEmoteCommand(emote);
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
* Scritps/PitOfSaron: Fix -Wunused-variable warnings reported by GCC
* Scritps/EyeOfEternity: Fix a -Wclass-memaccess warning reported by GCC
Warning:
/home/peterke/DEV/TrinityCore/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp: In member function ‘virtual void boss_malygos::boss_malygosAI::UpdateAI(uint32)’:
/home/peterke/DEV/TrinityCore/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp:950:81: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class ObjectGuid’; use assignment or value-initialization instead [-Wclass-memaccess]
950 | memset(_surgeTargetGUID, 0, sizeof(_surgeTargetGUID));
|
* Scritps/CoilfangReservoir: Fix a -Wclass-memaccess warning reported by GCC
Warning:
/home/peterke/DEV/TrinityCore/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp: In member function ‘void boss_leotheras_the_blind::boss_leotheras_the_blindAI::Initialize()’:
/home/peterke/DEV/TrinityCore/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp:220:55: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class ObjectGuid’; use assignment or value-initialization instead [-Wclass-memaccess]
220 | memset(InnderDemon, 0, sizeof(InnderDemon));
| ^
* Scritps/Naxx: Fix a -Wimplicit-fallthrough warning reported by GCC
For discussion see https://github.com/TrinityCore/TrinityCore/pull/25007
(cherry picked from commit 10be49bdfe6bd1f4d8e0eaf3a1b4354c5a57a2a9)
The script references BattlefieldWG, which is not exported in dynamic builds.
Move the script, so it is in the same library.
(cherry picked from commit c40b897d369cf45696ca626fdf48bf51226a73a8)