Commit Graph
100 Commits
Author SHA1 Message Date
Giacomo Pozzoni 60519e947f Core/SAI: Fix SMART_ACTION_WP_PAUSE with 0 delay pausing the path only for 1 world loop update (#25471)
* Core/SAI: Fix SMART_ACTION_WP_PAUSE with 0 delay pausing the path only for 1 world loop update

* Add code comments

* Remove special handling of SMART_ACTION_WP_PAUSE in SMART_EVENT_WAYPOINT_REACHED

(cherry picked from commit 7dd51ae6d98cf6dd8ac71412aa689f888c7bf369)
2022-02-27 20:08:41 +01:00
jackpoz d06c93185a Core/Loot: Raise max number of loot items from 16 to 18
Fixes #23948

(cherry picked from commit 5491cb51a25b6e3c465e97b3c57ba67a8ea0bcce)
2022-02-27 20:08:41 +01:00
Giacomo Pozzoni d02ee9de37 Script/Commands: Add ".pdump copy" command (#25455)
* Script/Commands: Add ".pdump copy" command

Syntax: .pdump copy $playerNameOrGUID $account [$newname] [$newguid]
Copy character with name/guid $playerNameOrGUID into character list of $account with $newname, with first free or $newguid guid.

* Add missing return

* Restore eof check

* Fix sql

* Use forward declaration header

Co-authored-by: Shauren <[email protected]>

* Remove buffer when reading a line

* Rename sql files

Co-authored-by: Shauren <[email protected]>
(cherry picked from commit 6215da0d640bd86a7c2bc144859c1542f09fc1a6)
2022-02-27 00:28:25 +01:00
Giacomo Pozzoni 6734a70aa8 Core/Warden: Attempt to fix random ingame Lua errors with Warden enabled
(cherry picked from commit cd1858b04010fe790f9db45f629a8e81e367b7a4)
2022-02-06 00:18:17 +01:00
jackpoz 8cbc21120f Core/Characters: Replace 2 database statements with 1
Replace DELETE + INSERT with REPLACE when updating realmcharacters table

(cherry picked from commit a33ff74d92bde847b051da9fe483676fa1228c5b)
2022-02-06 00:15:31 +01:00
jackpoz a439dab179 Core/PlayerDump: Update realmcharacters table when importing a character with ".pdump load"
Fixes #24517

(cherry picked from commit 69831d2a97baf98caa82d2689e6d323af35931fe)
2022-02-06 00:15:08 +01:00
jackpoz d1bea3e8b3 Core/LFG: Handle vote kick as failed if there cannot be 3 votes agreeing
i.e: 4 players, vote kick starts, 1 rejects, vote is considered as failed.

(cherry picked from commit f0f0de01fad0bc7bdfda215ec1a0f5b58d4a0ebf)
2022-02-06 00:05:38 +01:00
jackpoz 0441f3ea5e Core/LFG: Restore ".lfg queue" command argument handling
(cherry picked from commit a46c835ed1b498d4670c149a9f3ca31ea44eb35f)
2022-02-05 22:59:46 +01:00
Giacomo Pozzoni 7bb03fab51 CI/CircleCI: Attempt using cache from master in PRs
(cherry picked from commit 6ed1810abcf212b2cf04e5c6325e185ec4f3c05a)
2022-02-05 22:28:03 +01:00
Giacomo Pozzoni ca498ffab2 Core/Maps: Always update the grid of player summons even if far away (#25406)
* Core/Maps: Always update the grid of player summons even if far away

* Code cleanup

* Use a vector instead of unordered_set

(cherry picked from commit c68faf108edf50ae8a2ff4a341eff1e0d4269cbc)
2022-02-05 13:46:49 +01:00
jackpoz 2942d06664 Core/PathFinding: Enable pathfinding (MMaps) by default
(cherry picked from commit 5498f3be96ecf09c35622c3ba5e9abb8c8b96e13)
2022-02-05 13:43:16 +01:00
jackpoz c2d2df96db Core/SAI: Fix SMART_EVENT_WAYPOINT_START not being called at every waypoint checking wrong path id parameter
Remove multiple calls to SMART_EVENT_WAYPOINT_START for the 1st waypoint.
Closes #24760

(cherry picked from commit b3694bf47bfdab8ee9c074ac4a22d8f389e1cfc1)
2022-02-05 13:31:00 +01:00
Giacomo Pozzoni b45277f1cf Core/Unit: Fix units on vehicles not dismounting on death (#25404)
* Core/Unit: Fix units on vehicles not dismounting on death

Closes #23095
Issue added in 982643cd96790ffc54e7a3e507469649f3b074d2

* Remove leftovers from previous tries

(cherry picked from commit ff26027453179448bb972d88a51e565d71e95f3f)
2022-02-05 13:08:34 +01:00
jackpoz 341ef2c0dd Core/Arena: Fix Arena.ArenaStartPersonalRating setting not having effect if the player didn't do any arena match before next server restart
Ref #16609

(cherry picked from commit cc64762f068749bbee0ef96580614f5a8cdfc867)
2022-02-05 13:08:08 +01:00
jackpoz ae6f8bc4f5 Core/SAI: Do not allow SMART_EVENT_RESET to call SMART_ACTION_CALL_SCRIPT_RESET
There might be cases where this should be allowed (i.e. if the SMART_TARGET_* is another object) but for now we'll just never allow it.

(cherry picked from commit 28921f191de2269dd90b50ac99dd0d29ba90d0c4)
2022-02-05 12:08:58 +01:00
jackpoz d561a69122 Scripts/Obsidian Sanctum: Fix portals not being visible
Change NearestGameObjectEntryInObjectRangeCheck to allow returning GameObject not spawned.
Fixes other occurrences where a similar issue exists.

(cherry picked from commit ca2159bf405fb96a8eba9f1e58bda7ee6c7eb247)
2022-02-05 12:04:35 +01:00
Giacomo Pozzoni 4dff5bd09b Core/SAI: Reduce the chance of infinite loops/stack overflows (#25398)
Fixes #24092

(cherry picked from commit a58aeb41f466fd916cdc12e805f7a8130c8ccdf5)
2022-02-05 11:51:54 +01:00
Giacomo Pozzoni c66bcc4c0e Core/Spell: Fix name clashing between local variables and class member fields (#25352)
(cherry picked from commit 8a48ece5732a47fc36fadc63d0620072ef47f8fe)
2022-02-04 13:00:08 +01:00
jackpoz 4051ccd1bd Core/AHBot: Warn about different AHBot behavior when AllowTwoSide.Interaction.Auction is enabled
Closes #18243

(cherry picked from commit 92f9abab0607609ff7e6b7434bab66cc809084ca)
2022-02-04 12:19:15 +01:00
Giacomo Pozzoni 99ee958e0a Core/Misc: Fix issues reported by static analysis (#25351)
* Core/Misc: Fix issues reported by static analysis

* Core/Vmaps: Code cleanup after e777161888

(cherry picked from commit cfc8f7b442a9dba07b198fcebe2c02ab89cf0a8b)
2022-02-04 12:18:15 +01:00
Giacomo Pozzoni 902ed74c2a Core/SAI: Implement SMART_TARGET_ACTION_INVOKER in SMART_EVENT_FRIENDLY_HEALTH_PCT (#25318)
* Core/SAI: Implement SMART_TARGET_ACTION_INVOKER in SMART_EVENT_FRIENDLY_HEALTH_PCT

* Require radius (5th parameter) to be set

(cherry picked from commit cbed1039c47f0e3487cea555bb8552a4e6445f5a)
2022-02-04 00:27:13 +01:00
jackpoz 1f34964df4 Core/Movement: Fix RandomMovementGenerator for swimming creatures
Fix RandomMovementGenerator for swimming creatures not moving at all due to PATHFIND_FARFROMPOLY being handled as wrong path.
Fixes #25236

(cherry picked from commit 1aceb413495c18e5840112d6ada0c4c71cc03c7b)
2022-02-04 00:27:12 +01:00
jackpoz 0150828841 DB/Misc: Add new view vw_conditions_with_labels that shows labels instead of numbers from conditions table
(cherry picked from commit 7cdc4b46bb6ce63ae3830fb1f8e0464093e1a015)
2022-02-04 00:27:12 +01:00
jackpoz 27405870e0 DB/Misc: Add new view vw_disables_with_labels that shows labels instead of numbers from disables table
(cherry picked from commit 6d295629cf01cc23e9c6c521c767a4fa6fd0eb41)
2022-02-04 00:27:12 +01:00
jackpoz 1f2c48f8bb Core/SAI: Remove completed timed action lists even while evading
Fixes #25294

(cherry picked from commit 03eb0886a8b0e192d3c299d72ef223d30495c534)
2022-02-04 00:27:12 +01:00
Giacomo Pozzoni f8b6137a4c Build/GCC: Raise required version to 8.3.0 (#25297)
Even when building with Clang, make sure to have libstdc++ >= 8

(cherry picked from commit 41d70a5905c152d26217cc152a1748c337cfd81e)
2022-02-04 00:27:11 +01:00
Giacomo Pozzoni a4ee8855c0 CI/GitHub: Build on GCC (#25288)
* CI/GitHub: Build on GCC

* Mark warnings as errors

(cherry picked from commit f4dc3cbd65f42f9f144c6718d717ac003fa2edc9)
2022-02-04 00:27:11 +01:00
jackpoz 238d5b1587 Core/Pet: Fix assert triggered by e203ecda88a327c4e93588f39cc4ffdcf99b30f7
(cherry picked from commit 22a5b0fcde8f04af5ed860eeb8f6b4a59e65b723)
2022-01-31 00:27:02 +01:00
Giacomo Pozzoni 40d882b754 Core/Pet: Attempt to fix assertions triggered when summoning pets (#26501)
* Core/Pet: Attempt to fix an assertion triggered when re-summoning the current pet

* Core/Pet: Attempt to fix an assertion triggered when stabling a pet while in a vehicle

* Core/Pet: Attempt to fix an assertion triggered when stabling a pet and casting spell 6962

* Core/Pet: Attempt to fix an assertion triggered when casting spell 6962 while being dead

* Core/Pet: Attempt to fix an assertion triggered when summoning a pet while on vehicle 34775

* Handle cases in a generic way

* Code cleanup

* Core/Pet: Attempt to fix an assertion triggered when summoning a pet while on vehicle 34775 with a new character

(cherry picked from commit e203ecda88a327c4e93588f39cc4ffdcf99b30f7)
2022-01-31 00:26:54 +01:00
Giacomo Pozzoni f2ee365da4 Core/SAI: Spell casts that cannot be executed because the unit is currently casting another spell will be retried asap with priority over other events (#25238)
* Core/SAI: Spell casts that cannot be executed because the unit is currently casting another spell will be retried asap with priority over other events

* Core/SAI: Re-sort the events only when needed

* Fix some priority reset and wrong mEventSortingRequired handling

* Code cleanup.
Sort only events loaded from db (not stored events, not timed action list).

* Code cleanup.
Raise priority of failed casts so they are retried before other spells

* Keep priority of the action fails and is rescheduled on next update

* Don't try recasting a spell in SMART_ACTION_CAST if there are multiple targets and at least 1 was successful

(cherry picked from commit ca25e8d0199730c0976ebc37317e9407aceccc34)
2022-01-26 22:26:08 +01:00
Giacomo Pozzoni 7d548c34a9 Core/AI: Remove code that removed UNIT_DYNFLAG_LOOTABLE from possessed units (#25229)
* Core/AI: Remove code that removed UNIT_DYNFLAG_LOOTABLE from possessed units

* Update PassiveAI.cpp

Restored logic that removes loot flag while being possessed

* Restored logic that removes loot flag while being possessed

(cherry picked from commit 298d7994850dfc777c56a7672042d78074b67f3d)
2022-01-26 20:40:24 +01:00
Giacomo Pozzoni e11e1938b5 Core/SAI: Fix creatures casting with flag SMARTCAST_COMBAT_MOVE not switching to melee when the school of the spell they are trying to cast gets silenced (and other cases of spell failure) (#25226)
* Core/SAI: Fix creatures casting with flag SMARTCAST_COMBAT_MOVE not switching to melee when the school of the spell they are trying to cast gets silenced (and other cases of spell failure)

* Core/SAI: Retry casting after 500ms if a cast failed

Fixes #24914

(cherry picked from commit 63a6e1e0480df659e773a3df5e1acc2027ebcf15)
2022-01-26 19:21:10 +01:00
jackpoz 26894508ef Core/Misc: Code cleanup
(cherry picked from commit dd28cecda36ed3912be39d0c3caefef910db707d)
2022-01-26 19:18:46 +01:00
jackpoz b3f0d92b81 Scripts/Command: Fix .mmap loc always printing command usage
(cherry picked from commit 0eb49a3cc91a11ca98cce819dd189f1519684c5f)
2022-01-26 19:16:55 +01:00
jackpoz d8cdbac670 Core/Warden: Fix Warden reporting false positive checks
Issue introduced in 210176fd915cf4ba16f428d3c1a249a71f4aa7a7

(cherry picked from commit c04f53b886ec27dd8cf100524fe93a71dc4e1aa1)
2022-01-26 19:15:22 +01:00
jackpoz 35755ba343 Core/Misc: Fix Windows 32 bits build
Close #25789

(cherry picked from commit 1cafd4ef74350cb3656917e8e033a5e21dcce193)
2022-01-26 18:48:08 +01:00
jackpoz a706c60828 Core/Misc: Code cleanup
(cherry picked from commit 3c28573d02db98ae8d7a41e04b9715da0556836b)
2022-01-26 18:12:13 +01:00
jackpoz 676d877296 Core/Battlegrounds: Fix error messages in Isle of Conquest
Fixes #24032

(cherry picked from commit 02a018ea1394452896ecdd87c98df5fc8655046d)
2022-01-26 16:36:37 +01:00
jackpoz b3545479bf Core/SAI: Fix creatures casting spells while moving with flag SMARTCAST_COMBAT_MOVE
Fixes #24019

(cherry picked from commit 2910d0fb2436d9865d792ef92cb415f831a0af93)
2022-01-26 16:23:15 +01:00
Giacomo Pozzoni ffd85f9139 Scripts/Comamnds: Improve ".debug objectcount" command (#25208)
* Scripts/Comamnds: Improve ".debug objectcount" command

Include the top 5 most common creatures in the map

* Use C++ features to copy data

* Fix build warnings

* Update src/server/scripts/Commands/cs_debug.cpp

Co-authored-by: Shauren <[email protected]>

* Update src/server/scripts/Commands/cs_debug.cpp

Co-authored-by: Shauren <[email protected]>

* Update src/server/scripts/Commands/cs_debug.cpp

Co-authored-by: Shauren <[email protected]>

* Move CreatureCountWorker out of function and use template for unhandled cases

* Code cleanup

Co-authored-by: Shauren <[email protected]>
(cherry picked from commit bd5e832a648aadf1d1be94f913ea00b67398f249)
2022-01-26 16:22:00 +01:00
jackpoz a23215c73d Scripts/Kologarn: Apply CREATURE_FLAG_EXTRA_NO_COMBAT on NPC_ARM_SWEEP_STALKER and NPC_RUBBLE_STALKER
(cherry picked from commit 6ad6d9e67069ef048c10afbdd52627b8c765a010)
2022-01-26 14:39:22 +01:00
jackpoz e2fb15fd22 Core/Metric: Include Creatures and Gameobjects panels in the Performance Profiling dashboard
(cherry picked from commit df8d50c06a6776312d5bd912dd6a5273a190a1e4)
2022-01-26 14:07:16 +01:00
jackpoz 7ea19b675f Core/Metric: Require WITH_DETAILED_METRICS CMake flag for MMaps metric
(cherry picked from commit 8ad6bd8a9ba45ef22ed0275fd402da17666d8522)
2022-01-26 14:07:00 +01:00
Giacomo Pozzoni 864d775280 Core/Misc: Fix static analysis issues (#25194)
(cherry picked from commit 07fd84b679fd6958b7e669a96c78783875e1b949)
2022-01-26 14:06:40 +01:00
Giacomo Pozzoni 61bf51874d Core/Misc: Fix static analysis issues (#25178)
(cherry picked from commit 7cf122fc2a604bae77d0b935536c41ec9203e62d)
2022-01-24 20:21:25 +01:00
Giacomo Pozzoni 9c85aee239 CI/CircleCI: Move codestyle and sql checks to their own step (#25175)
(cherry picked from commit f35582f98a6dbf7d031646bc3efe6b88d4694dcb)
2022-01-24 15:02:17 +01:00
Giacomo Pozzoni 736b9ac112 Log sync db queries in World::Update() loop (#25174)
* Core/Misc: Log sync queries on critical path

* Fix build

* Rename

* Fix warning

* Fix no-pch

* Change WarnAboutSyncQueries() to be header-only

(cherry picked from commit deceb11b5fc52c8036f249d628ccc69ca5d022b3)
2022-01-24 14:58:08 +01:00
Giacomo Pozzoni 1977d26050 Core/SAI: Ignore SAI while evading (#25108)
(cherry picked from commit 420b21be9860367c82537634fb792a4af3d9be9b)
2022-01-24 13:21:46 +01:00
jackpoz f220e46c50 Core/Metric: Add new metric in World::UpdateSessions()
Add new metric about how long adding sessions took

(cherry picked from commit 5cd93df9eec1d1b310916fefecc9282e02e9cf2d)
2022-01-24 13:12:21 +01:00
jackpoz 10e3016e85 Dep/Boost: Set boost msvc version on Windows to 14.2
14.2 is the only supported one (Visual Studio 2019)

(cherry picked from commit 2ea511b9f45d2e8ad33824fd76e848dace264469)
2022-01-24 13:02:52 +01:00
Giacomo Pozzoni 8350985975 Core/Metric: Log detailed metrics about each opcode handler (#25153)
* Core/Metric: Log detailed metrics about each opcode handler

* Add new panel to Performance profiling dashboard and use fill(0) instead of fill(none)

* Add new settings Metric.Threshold.* to be able to specify the minimum threshold for the specified metrics

* Update dashboard

* Change thresholds to be required to send the metrics. A TC_METRIC_DETAILED_TIMER metric with an expected threshold not configured will be ignored

* Use typedef Milliseconds

* Refresh realms on load

(cherry picked from commit 8a2c79c850199a73fd431d04f83d6aa89733060d)
2022-01-24 13:02:38 +01:00
jackpoz 7a532595da Core/Metric: Fix setting in Performance profiling dashboard
(cherry picked from commit f9972f2473ae2615a17ad340601a40f9723c02f4)
2022-01-24 12:45:04 +01:00
Giacomo Pozzoni 21e9fac8bd Core/Metric: Add new cmake option WITH_DETAILED_METRICS to enable more metrics (#25136)
* Core/Metric: Add new cmake option WITH_DETAILED_METRICS to enable more metrics

Add more detailed metrics in World::UpdateSessions().

* Attempt using C++17 features

* Fix cmake typo

Co-authored-by: NoName <[email protected]>

* Fix build with WITHOUT_METRICS

* Update Performance profiling dashboard with Update sessions panel

* Add panel to show sessions with update time above 100 ms

* Move legends on the right and add max update time diff in the legend of sessions

Co-authored-by: NoName <[email protected]>
(cherry picked from commit 36ef487a90d0d14c4da8ce7e19b5916b8b15056c)
2022-01-24 12:21:36 +01:00
jackpoz 699c9ed414 DB/SAI: Add new view vw_smart_scripts_with_labels that shows labels instead of numbers from smart_scripts table
(cherry picked from commit c164c257ae0586bdebb9b81ecb965d9d07eabfef)
2022-01-23 23:05:09 +01:00
jackpoz b327414abb Core/Misc: Code cleanup
Remove more unused code in UpdateTime class

(cherry picked from commit 6c4f71c84b292fd86da0d061d774a7f3629f6d85)
2022-01-23 22:49:21 +01:00
Giacomo Pozzoni e8583d04f6 Core/Metric: Add more metrics about World::Update() loop (#25098)
* Core/Metric: Add more metrics about World::Update() loop

* Add new Performance profiling grafana dashboard

* Add new cmake setting WITHOUT_METRICS that disables all metrics

As new metrics are added, someone might want to disable them if unused.

* Add more metrics about World::Update() loop

* Remove old performance profiling features

Remove "server set difftime" command, "-RecordUpdateTimeDiffInterval" and "MinRecordUpdateTimeDiff" worldserver config settings and their related code.
The whole UpdateTime class could be removed too.

* Update and rename 2020_07_99_99_world.sql to 2020_07_24_00_world.sql

(cherry picked from commit 3c0ac7302f902d1811d2c215217a3d701f8b5b19)
2022-01-23 22:45:25 +01:00
Giacomo Pozzoni 1dfcb7086e Core/Combat: Disable triggers entering combat (#25086)
* Core/Combat: Disable triggers entering combat

* Move check to database flags_extra flag in creature_template with value 0x00002000

* Fix Rotface puddle stalker too

* Rename 9999_99_99_99_world.sql to 2020_07_22_00_world.sql

(cherry picked from commit 6440c3bcac85a40de5c34aef1d8a8856966cc140)
2022-01-23 22:35:00 +01:00
Giacomo Pozzoni 8735c5f511 Dep/Boost: Remove unused thread library (#25076)
(cherry picked from commit cf5babc302d43f903b444b97bfdb934545356da2)
2022-01-23 22:17:02 +01:00
Giacomo Pozzoni 509a70f57f Core/Threads: Replace Boost TLS with C++11 one (#15782)
* Core/Threads: Replace Boost TLS with C++11 one

Replace boost::thread_specific_ptr<T> thread-local storage with C++11 thread_local to remove libboost_thread dependency from common project

* Fix no-pch build

(cherry picked from commit 00b16992f1ae3bf14ab5fe6366028a2b8648bfa0)
2022-01-23 22:16:45 +01:00
Giacomo Pozzoni fda8a09766 Core/Misc: Replace boost::shared_mutex with std::shared_mutex (#24328)
* Core/Misc: Replace boost::shared_mutex with std::shared_mutex

* Remove std forward declarations

(cherry picked from commit 7032ee0bdb47c995dfd89bce3d5b6fad13ec6d73)
2022-01-23 21:51:47 +01:00
Giacomo Pozzoni 196a62c031 Dep/Boost: Set boost version to 1.67 on *nix and 1.70 on Windows (#25069)
(cherry picked from commit c54dc3ef9273378c55e0c17acef18de731a7f8eb)
2022-01-23 21:37:33 +01:00
Giacomo Pozzoni 8834c5c724 Core/Metric: Log Map::Update() times (#25067)
* Core/Metric: Log Map::Update() times

* Add more performant version to reduce allocations when metrics are disabled

* Linux build fix

* Add metric stopwatch version that doesnt let users forget to _END it

* Fix linux build

* Code cleanup

* Add Map updates panel to General dashboard

* Add "Recent events" panel to General dashboard

* Apply latest codestyle changes

Co-authored-by: Shauren <[email protected]>
(cherry picked from commit 5eb742ee6a892b684b0c4cbde9f02f838b8300e5)
2022-01-23 21:36:28 +01:00
Giacomo Pozzoni e188a75c68 Scripts/Kologarn: Fix another "stuck in combat" issue (#24998)
(cherry picked from commit ee34a1f19ea6062ffe8612a735eede990dd2840e)
2022-01-23 15:20:29 +01:00
Giacomo Pozzoni e9cf3828ba Core/Spells: Implement SPELL_EFFECT_ACTIVATE_OBJECT. (#23) (#24997)
* Core/Spells: Implement SPELL_EFFECT_ACTIVATE_OBJECT. (#23)

Original research by @xvwyh.

* Add missing sql update

* Fix some build errors

* Remove unused enum values

* Change artkits from 0-4 to 0-3

* Remove unused code

* Code review feedback

* Fix sql

* Remove artkit4 special case handling

* Default initialize artKits

* Code review feedback

* Split sql into structure and data files

Co-authored-by: Warpten <[email protected]>
(cherry picked from commit 203573db83fb1d3f141b5aadbf1d1ca0a637bf94)
2022-01-23 15:17:54 +01:00
jackpoz ff778a7581 Core/Creature: Add null check for charmed creatures
(cherry picked from commit b4adaa838c2e44f4008152cc955410d25ff4d8b0)
2022-01-22 00:50:40 +01:00
Giacomo Pozzoni 74923df35a Core/Pools: Attempt to workaround pools being broken since 2015 (#24949)
* Core/Pools: Attempt to workaround pools being broken since 2015

Attempt n°2

* Fix warning

(cherry picked from commit 8c0a315734840f99455026ef443a21ae73d7bc3b)
2022-01-21 18:57:24 +01:00
jackpoz 8fd7a4b6e5 Core/PetAI: Validate GetCharmInfo()
Fixes #24870

(cherry picked from commit bf62901053d20da790e78394cd9b2a3129d28afa)
2022-01-21 18:55:48 +01:00
Giacomo Pozzoni 8f4db9aa69 Core/Spells: implement corpse target type support and properly fix resurrections (#24921)
* Core/Spells: implement corpse target type support and properly fix resurrections

(cherry picked from commit df193945d9aff8596985a20e2c654105354b0af7)

* Core/Spells: implement TARGET_CORPSE_SRC_AREA_RAID and updated remaining resurrection effect handlers for updated corpse targeting

(cherry picked from commit 98b075cb4b0da126d409ab42daa63a1f531a70ea)

* Fix no-pch

Co-authored-by: Ovahlord <[email protected]>
(cherry picked from commit cc71da35b5dc74abf71f8691161525a23d870bb5)
2022-01-20 00:13:02 +01:00
jackpoz 68faf5bc4b Core/Common: Replace ASSERT(false, "...") with ABORT_MSG("...")
(cherry picked from commit 54c701cf0db81c0062e8c5020e07db18984d0ffa)
2022-01-19 22:17:42 +01:00
jackpoz f7c1ae01f8 Core/Common: Add macro ASSERT_WITH_SIDE_EFFECTS to be used when asserting conditions that have side effects
(cherry picked from commit 49da3533cd4a0fcd8b2ac7ae0bf4b105f40f8c77)
2022-01-19 21:18:39 +01:00
jackpoz 4431df1f13 Core/LFG: Sanitize LFG roles sent by clients
(cherry picked from commit 3778f23c579ad1050c2b985b5f42b365a7736c24)
2022-01-06 23:31:40 +01:00
jackpoz ebe183ea93 Scripts/VioletHold: Limit the number of current summons before the waves start
(cherry picked from commit 54e30d4ebae11e0c8da77af6104a3cc0a6a11365)
2022-01-06 23:15:59 +01:00
Giacomo Pozzoni 07f42907c6 Log number of Creatures and GameObject per map (#24809)
* Shared/Metric: Allow to specify tags in metrics

* Core/Metric: Log number of Creatures and GameObject per map

* Apply feedback

* Codestyle changes

* Codestyle changes

* Remove whitespace

* Update Grafana dashboards to v7.0.3

* Fix missing filter on realm

* Include Creatures and Gameobjects in Maps dashboard

* Show instances with a different color

(cherry picked from commit 4e1dbd1cf808c9cf1f310b6d498f7e304dfb4147)
2022-01-06 23:15:07 +01:00
jackpoz 5886bf7484 Scripts/Commands: Add .debug objectcount <optional map id> chat command
Add .debug objectcount <optional map id> chat command to show the number of Creatures and GameObjects

(cherry picked from commit cd37a17103b88a56ec1fde2156c4325b74989e08)
2022-01-06 20:49:28 +01:00
jackpoz 9286734b55 Core/Misc: Fix static analysis issues reported by Coverity Scan
(cherry picked from commit adc7cd3ceec969488cd8d8fa93edc281f0169102)
2022-01-06 19:47:51 +01:00
jackpoz 5af8373cce Core/Misc: Fix Clang 10 build warnings
(cherry picked from commit 48c5c0d7a2424df73343df127d415ee18eb84296)
2022-01-06 19:46:22 +01:00
jackpoz 9e0e52f023 Scripts/Misc: Fix issues reported by ASan
(cherry picked from commit 013301088d862f634cd5b817cb3949c58454f924)
2022-01-06 16:22:58 +01:00
Giacomo Pozzoni 07863a7a68 Core/Creature: Allow to disable HP regen in Raids even if the target is unreachable (#24646)
(cherry picked from commit 247564a7ab7dc6f640bb8f4fd32c30ffdc9076d2)
2022-01-06 16:12:51 +01:00
Giacomo Pozzoni feb36f3f7d Tools/MMAPs: Show an error when running mmaps_generator built in Debug mode (#27412)
* Tools/MMAPs: Show an error when running mmaps_generator built in Debug mode

* Fix GCC build

(cherry picked from commit 8c80f28581646af110c4d2b316209ef291a95587)
2022-01-04 20:44:26 +01:00
jackpoz 071a8b5b7d Core/Misc: Remove whitespace
(cherry picked from commit 869fb748cd4f80b65b154fbd3cb9fa4ee8d64672)
2022-01-04 20:44:26 +01:00
jackpoz be7acb2527 Core/MMAPs: Reduce chances of breaking tile connections
Reduce chances of breaking tile connections caused by floating point rounding issues.

(cherry picked from commit e615e2ddefd2c18b6dec8e08fb3d17580b64ea99)
2022-01-04 20:44:26 +01:00
Giacomo Pozzoni 1ba940b17a Core/Maps: Change .map file version from FourCC to uint32 (#26326)
(cherry picked from commit 42877e75e2a67514dfeb185661e4f397b6eb044a)
2022-01-04 20:44:25 +01:00
Giacomo Pozzoni 89e183704c Improve multithreading of mmaps_generator (#25625)
* Build/Misc: Add a few *San CMake flags

Add the following flags for the related tools:
- MSAN for Memory Sanitizer
- UBSAN for Undefined Behavior Sanitizer
- TSAN for Thread Sanitizer

* Remove unused parameter

* Fix UBSan reported issue

* Disable G3D buffer pools when using Thread Sanitizer as it has its custom locking mechanisms

* Code cleanup

* Move threads from maps to tiles

* Move tile building logic to TileBuilder class

* Fix memory leak in TileBuilder

* Fix build

* Store TileBuilder as raw pointer for now, it will be changed later on to use modern C++ constructs

* Fix crash on shutdown

* Revert pvs-studio change

* Fix generating 1 single tile not closing the program

(cherry picked from commit a4e93d779c9638bc0a61cb4405ef28cb935d1065)
2022-01-04 20:44:25 +01:00
jackpoz 3820aabcd8 Core/MMAPs: Restore single slope angle of 55°
Re-generating MMAPs IS required.
Partially reverts 995a443da219ec773febd7dd29d18f3cefaa1f3b .

Having 2 different slope angles of 55° and 85° created too many polygons to fit in the current mmtile structure. This caused some polygons to become disconnected from each other, creating the old "invisible walls" effect. Because of this and because of the performance hit when loading a mmtile caused by the increase of polygon numbers, this commit reverts the recent changes and sets by default the slope angle to 55°.
Feel free to restore the previous behaviour by running .\mmaps_generator --maxAngle 85 --maxAngleNotSteep 55 , specifying the map id as number if a single map should have different slope values.
This is the last commit that will change MMAPs version to force re-generating them. Any future change that will affect only the generation settings will be optional (but recommended).

(cherry picked from commit 3947e4cb57d4c6adb78cd3cb52718bb88add91fc)
2022-01-04 20:44:02 +01:00
jackpoz ddcbc01a65 Core/MMAPs: Fix small steps being considered as NAV_AREA_GROUND_STEEP
(cherry picked from commit 3ac1992afbeb1cd7669b300b8ee4131d39f35595)
2022-01-04 20:44:02 +01:00
Giacomo Pozzoni 782a943b38 Tools/MMapsGenerator: Add some more input parameters to improve mmaps load performances (#25520)
* Some research about mmaps load performances

* Tools/MMapsGenerator: Add some more input parameters

Add some more input parameters which affect the resulting mmaps:
- --smallOutputSize: sets both walkableSlopeAngle and walkableSlopeAngleNotSteep to 55°, reducing by a lot the .mmtile size and the number of polys. A rcFilterLedgeSpans() call is included too to filter out some polys. Default to false.
- --maxAngle: Restore this parameter removed some commits ago. Specifies the max walkable angle of a Creature when in combat. Default to 85
- --maxAngleNotSteep: Max walkable angle of a Player and of a Creature out of combat. Must be less or equal than --maxAngle. Default to 55.

A performance profiling comparison highlighted that .mmtile load grows exponential with the number of polys. A small server with GridUnload enabled and without preloading all grids on startup will be more affected than a big server with GridUnload disabled and preloading grids on startup.

(cherry picked from commit b6e205f7ef32f7b82644043d82a808e67cc9acb2)
2022-01-04 20:44:02 +01:00
Giacomo Pozzoni d58d0e895c Handle different slopes in mmaps (#24765)
* Tools/MMAPs: Remove input argument --maxAngle

Remove input argument --maxAngle . This should be just hardcoded in MapBuilder::GetMapSpecificConfig() so all settings are easily found in the same place instead of being spread around.

* Tools/MMAPs: Add new area type NAV_AREA_GROUND_STEEP

Add new area type NAV_AREA_GROUND_STEEP for ground with slope in the range (55, 70] .
NAV_AREA_GROUND is used for ground with range [0, 55] .
NAV_AREA_GROUND_STEEP takes priority over NAV_AREA_GROUND.

* Tools/MMAPs: Fix NAV_GROUND_STEEP flag not being saved in the mmtile

* Core/PathFinding: Implement NAV_GROUND_STEEP flag

Implement NAV_GROUND_STEEP flag, used only by Creatures that are in combat or evading.

* Distinguish between RC_WALKABLE_AREA and NAV_AREA_GROUND.

* Allow mobs in combat to walk on steeps up to 80°

* Allow mobs in combat to walk on steeps up to 85°.
Disable rcFilterLedgeSpans() filter as it removed long steep spans.

* Increase cost of steep spans to try making creatures walk around obstacles instead of walking on them

* Revert last commit

(cherry picked from commit 995a443da219ec773febd7dd29d18f3cefaa1f3b)
2022-01-04 20:44:02 +01:00
jackpoz bafd22104c Tools/MMAPs: Output the time spent in a human readable format
(cherry picked from commit 6e34e07c48000e666ec15b26682eb15fb2f5f901)
2022-01-04 20:44:00 +01:00
Giacomo Pozzoni 9cb01a7904 Fixes/3.3.5 aura infinite loop (#24631)
* Core/Auras: Attempt to fix infinite loop with aura 18950 on map unload

* Core/Auras: Log a detailed error and assert when failing to remove all auras after a few tries

* Code cleanup

* Fix build warnings

* Fix more build warnings

(cherry picked from commit bd2d60c2676a1d7e843a2a5673b8216bad0768c7)
2022-01-04 15:33:04 +01:00
Giacomo Pozzoni 89afeed41b Core/MMAPs: Adjust walkable climb and fix a lot of mmap raycast issues (#24539)
* Core/MMAPs: Adjust walkable climb

Adjust walkable climb as recast using walkableClimb also to find the poly from a position, giving priority to polys that are below the position but closer than walkableClimb.

* Temporarily disable static collision (the whole check should be removed)

* Core/Spells: removed deprecated mmap path check for TARGET_DEST_CASTER_FRONT_LEAP

* Core/Objects: allow flying units to use the helper as well (flying units casting radius based spells)

* Code refactor

* Handle raycasts that end in a point with no height in the mmap mesh as PATHFIND_NOPATH

* Walk back a bit from raycast hitpoints as sometime the 2D result point is outside of the polygons due to floating point errors.

* Remove whitespace

* Revert 4a197ba22a as a raycast point path should have the Z retrieved with getPolyHeight(). Raycast will only return a 2-point path with Start and Hitpoint/End

* Cleanup PathGenerator raycast case

* Fix PathGenerator raycast broken if start and end are on same poly.
Fix PathGenerator raycast broken if no wall is hit.
Remove unused case of using raycast with an existing previous path (can be added back properly if needed).
Remove forcing poly length to 2 when we actually have already the right number.

* Use closestPointOnPolyBoundary on the second try of finding a point on poly for raycast.
Note that in this case the mesh height is not used which might cause issues. The poly boundary height will be used instead.

* Handle cases where getPolyHeight() fails because the point is on polygon border (and caused by floating point imprecision)

* Add far from poly flags

* Set PATHFIND_INCOMPLETE in raycast case if startFarFromPoly or endFarFromPoly

* Fix blink close to walls with no valid polygon behind the wall

* Require to re-extract mmaps

Co-authored-by: Ovah <[email protected]>
(cherry picked from commit c0b75bf40da8b447a2f3533dabbfad9eba7c6ea1)
2022-01-04 15:33:04 +01:00
jackpoz 79250cb0df CI/CircleCI: Switch to Ubuntu 20.04 and MySQL 8
(cherry picked from commit e3dfab52a639275ea130d279f4a6fe4312d34b06)
2022-01-02 21:29:32 +01:00
Giacomo Pozzoni 528e9959e8 DB: Add drop script compatible with MySQL 8
(cherry picked from commit 7e5c1cf453972e142613ab828b75c8635edf697d)
2022-01-02 19:55:05 +01:00
jackpoz 7d632d5711 Core/PathFinding: Fix buffer overflow
(cherry picked from commit dc7856644f48d6b313e973197fed69ef56d6b5e0)
2022-01-01 22:59:49 +01:00
Giacomo Pozzoni 63e5092f14 Build: Add support to MariaDB 10.4 on Windows
MariaDB 10.4 (latest stable) is the only supported version.

(cherry picked from commit 7c91c423d05aabc18d5c36af9ecc2a9c5f49970d)
2022-01-01 20:16:37 +01:00
jackpoz d690648bce Scripts/BWL: Fix crash in Razorgore encounter
(cherry picked from commit 7b8b02c32ebfb7c8c47ac1d1b94129c91346ad66)
2022-01-01 20:13:04 +01:00
jackpoz e71352db6f Core/Spells: Fix assertion triggered
(cherry picked from commit 740afc71358c32257540350a6d7d4071a851452f)
2022-01-01 20:11:02 +01:00
jackpoz 7eff81f9db Core/Pools: Fix crash on startup
(cherry picked from commit 9cde3ffd1404e784406f385061f4df0f6b429b61)
2022-01-01 14:34:20 +01:00
Giacomo Pozzoni 97c1d01cbb Core/Pooling: Remove respawn times from the database when despawning a pool (#24422)
* Core/Pooling: Remove respawn times from the database when despawning a pool

Remove respawn times from the database when despawning a pool. This is needed when a Game Event ends but there are still some respawn times saved in the database.

* Remove respawn time of active pool objects even if they are not spawned

(cherry picked from commit 4f33fd3932d362466ee017111895bf14fcc79c88)
2022-01-01 14:02:00 +01:00
Giacomo Pozzoni a947ee1912 Core/SAI: Allow SMART_TARGET_ACTION_INVOKER to target GameObjects (#24416)
* Core/SAI: Allow SMART_TARGET_ACTION_INVOKER to target GameObjects

* Include new Coalesce(..) template by @Shauren

(cherry picked from commit 90b00288c24dfefccb338bd33b025cf85e82076d)
2022-01-01 13:06:27 +01:00
jackpoz 68d947d42f Core/Log: Log all character kicks to "network.kick" category
(cherry picked from commit 31018c36527755166d8a297ac9e6c98a66f014ae)
2022-01-01 12:56:24 +01:00