Commit Graph
100 Commits
Author SHA1 Message Date
Giacomo Pozzoni e0ad19dc96 CMake: Add WITH_BOOST_STACKTRACE option to use libbacktrace (#26119)
* CMake: Add WITH_BOOST_STACKTRACE option to use libbacktrace

* Allow to specify where backtrace.h header is with cmake option -DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE="/usr/lib/gcc/x86_64-linux-gnu/10/include/backtrace.h"

Co-authored-by: Trond B. Krokli <[email protected]>
(cherry picked from commit dc78b5a6a7410092df7ac426fbb2f2551072c889)
2022-03-06 22:24:18 +01:00
Giacomo Pozzoni 9bcff210f9 Core/Maps: Use a fixed offset instead of full collision height when retrieving floor Z (#26092)
Use a fixed offset 0.5f instead of full collision height when retrieving floor Z as a full collision height ended up on the floor above a few times. It makes more sense to cast the ray just a bit higher up than using a full collision height (which by default is 2.0f)

(cherry picked from commit f96aab2186d17ddd286fa42913f3f14e9562c4eb)
2022-03-06 22:24:01 +01:00
jackpoz c93d6856c7 Core/Unit: Fix crash when exiting a vehicle
Ref #25649

(cherry picked from commit b84b92506354fc37017cb687aac263218265cf06)
2022-03-06 20:01:38 +01:00
jackpoz 730a8da9e9 Core/Unit: Set stand state on damage only to players
(cherry picked from commit 4cc1f850670b868a1d16833a2cf5c60715f749ef)
2022-03-06 20:01:25 +01:00
jackpoz 4b91670ed6 CI/CircleCI: Show at the end of the build ccache stats of current build
(cherry picked from commit 0dee695f3bf1e7eea8082f84e1c552c03a137dab)
2022-03-06 19:39:34 +01:00
jackpoz 3886c82d0f Scripts/EoE: Attempt to fix players getting stuck after dying
Attempt to fix players getting stuck after dying caused by a hack that calls SetControlled(true, UNIT_STATE_ROOT) by calling the opposite when a dead player leaves the instance, i.e. on releasing.
Close #24458

(cherry picked from commit dc21ac342ec3293ecf37b6a87244c46a39ff687f)
2022-03-06 19:00:26 +01:00
Giacomo Pozzoni a4a3e2e759 Core/Creature: Allow to skip Rate.Corpse.Decay.Looted when calling SetCorpseDelay() (#25989)
Add a second parameter to SetCorpseDelay() that specifies if Rate.Corpse.Decay.Looted setting should be ignored, false by default (aka don't ignore by default).
Add a second parameter to SMART_ACTION_SET_CORPSE_DELAY to specify if Rate.Corpse.Decay.Looted should be included, false by default (aka ignore by default).

(cherry picked from commit d5fc86af8b22fed5b054e51349eb3ab47b06b784)
2022-03-06 18:59:38 +01:00
Giacomo Pozzoni 1ec33095e6 Core/Warden: Send Lua checks only when ingame (#25977)
(cherry picked from commit 3e6b3f88b0169600e9e09281723d82476e08fae7)
2022-03-06 18:54:04 +01:00
Giacomo Pozzoni 4c30b2a182 Core/SAI: Add new action SMART_ACTION_SET_HEALTH_PCT (#25932)
* Core/SAI: Add new action SMART_ACTION_SET_HEALTH_PCT

Add new action SMART_ACTION_SET_HEALTH_PCT (142) with one single parameter "percent" to set the Unit health.
Close #25317

* Do not allow 0%

(cherry picked from commit 7d6f7e4d19b298632deeb27830b876b12c490a03)
2022-03-06 01:43:57 +01:00
Giacomo Pozzoni a66b968f91 Core/Misc: Fix static analysis issues (#25924)
* Core/Misc: Fix static analysis issues

* Fix infinite loop in ".debug send opcode"
Fix using uninitialized memory in ".debug send opcode"

(cherry picked from commit 661f554b9e08a3721227f1e4a4fe6fd74e43a1f4)
2022-03-06 01:35:01 +01:00
jackpoz 4e3d23188e Scripts/Commands: Improve ".debug objectcount"
Include the number of SetActive objects in ".debug objectcount" command

(cherry picked from commit d0231c5a8fdea9704be442cbd8840079caf47a6d)
2022-03-06 01:23:14 +01:00
Giacomo Pozzoni 5180abfb19 Core/Creature: Add new db field InteractionPauseTimer (#25880)
* Core/Creature: Add new db field InteractionPauseTimer

Add new db field InteractionPauseTimer to allow to define different interaction pause timers for each creature (the previous system was a global setting in worldserver.conf Creature.MovingStopTimeForPlayer)

* Set all columns in creature_template_movement as optional (can be NULL, default NULL). Fill only the columns that should override the default C++ value

* Use the InteractionPauseTimer value throughout the code instead of Creature.MovingStopTimeForPlayer

* Handle InteractionPauseTimer set to 0 as "don't stop at all"

* Implement InteractionPauseTimer in creature_movement_override

creature_movement_override allows NULL values, in which case the values from creature_template_movement will be used for those columns that are NULL, falling back to default C++ values if creature_template_movement has NULL values too (or no rows for the creature)

* Read default InteractionPauseTimer from worldserver.conf

* Rename 2021_99_99_99_world.sql to 2021_01_22_00_world.sql

(cherry picked from commit a22bc236ebc038c723774e5b38cd93e814ccc43d)
2022-03-06 00:56:46 +01:00
Giacomo Pozzoni c2068bd423 CI/CircleCI: Expose binaries built on Circle CI as docker images in the Circle CI artifacts (#25832)
Co-authored-by: Shauren <[email protected]>
(cherry picked from commit 9af6bf15aa2fe836c3ebba306eaaa8971f00fac4)
2022-03-06 00:24:04 +01:00
Giacomo Pozzoni 6b242eee13 Core/Unit: Fix movement hiccups in water (#24020)
* Core/Unit: Allow to define Units which can enter water but cannot swim

Allow to define Units which can enter water but cannot swim, i.e. crabs walking at the bottom of a sea.

* Add UNIT_FLAG_SWIMMING to creatures when entering combat

* Fix charmed creatures not entering water

* Always allow Creatures controlled by players to enter water

* Add swimming flag when possessing a unit and remove it properly at the end, even if the creature engaged combat before and after.
When adding/removing UNIT_FLAG_SWIMMING manually calling Creature::RefreshSwimmingFlag(true) might be required.

(cherry picked from commit fc1a0d936888395f114028af3337e7d674e0a43c)
2022-03-05 23:04:24 +01:00
jackpoz f32a7ed27d CI/Circle CI: Add codestyle check
Don't leave 2 blank lines, 1 is enough.

(cherry picked from commit ed975ef4c0e614addc069785f23c1b7f522f3b8e)
2022-03-05 21:13:38 +01:00
Giacomo Pozzoni da0d9ee283 Core/SAI: Fix SMART_EVENT_FLAG_NOT_REPEATABLE flag being ignored when specifying a chance (and other SMART_ACTION_CAST fixes) (#25778)
* Core/SAI: Fix SMART_EVENT_FLAG_NOT_REPEATABLE flag being ignored when specifying a chance

Fix SMART_EVENT_FLAG_NOT_REPEATABLE flag being ignored when specifying a chance, always making the action trigger.

* Fix SMART_ACTION_CAST with SMART_EVENT_FLAG_NOT_REPEATABLE not casting the spell at all if rolled chance was successful but creature couldn't cast the spell

* Prevent linked actions if SMART_ACTION_CAST couldn't be completed and will be retried later

(cherry picked from commit 96b289cadbf304e427ddbd281d1a6f592af612a7)
2022-03-05 17:11:58 +01:00
jackpoz abbac041bf Scripts/ICC: Fix teleporter not removing players from Gunship
A more generic solution might be better, maybe depending on spell flags

Ref #25652

(cherry picked from commit 0ad1854d1c6a3b6ff93e71272c919f1f5f11d5ed)
2022-03-05 17:03:54 +01:00
Giacomo Pozzoni 30ebecc0de Core/Maps: Attempt to fix picking the wrong min height (#25771)
Close #25652

(cherry picked from commit aabd2b49e2710e00c39c4b4f22fef08aa029d4db)
2022-03-05 17:03:14 +01:00
jackpoz 90a05037cf Core/Maps: Partially revert 0c69316714d0558e32462f5401197fe1e803ae75
Revert define to constexpr as this also broke some calculations

(cherry picked from commit ed1c0b6ec9232cc638fa242ea839c4645bb4be07)
2022-03-05 17:03:02 +01:00
jackpoz bea8894bce Core/Maps: Partially revert 0c69316714d0558e32462f5401197fe1e803ae75
The development will continue in a PR

(cherry picked from commit 1e3d85e2839c5ee3170223f4d985eecd527c5533)
2022-03-05 17:02:38 +01:00
jackpoz 26962127a5 COre/Misc: Remove whitespace
(cherry picked from commit 01b1f20d3ea1f1dca3d614396634c85646b77ff8)
2022-03-05 17:02:30 +01:00
jackpoz c14f4dc835 Core/Maps: Use the same logic to calculate grid coords to avoid mismatches
Use the same logic of (CENTER_GRID_ID - x / SIZE_OF_GRIDS) in GridMap::getMinHeight() as Map::GetGrid() to avoid coord grid mismatches caused by floating point precision, i.e. getting the wrong grid.
Replace defines with constexpr in grids to make debugging easier.

Closes #25652

(cherry picked from commit 0c69316714d0558e32462f5401197fe1e803ae75)
2022-03-05 17:02:19 +01:00
jackpoz 13bf0e71b9 Scripts/Commands: Include map min height in ".gps" command
(cherry picked from commit 9994459bd197d5555cfa16ab3d35d9c362a563fd)
2022-03-05 17:01:36 +01:00
jackpoz 362a1c32c2 Core/Movement: Add a debug log when a player falls below the map
(cherry picked from commit 1c08395e8acf0ecebcc3fcaf24201b2ad44ed2dd)
2022-03-05 00:56:56 +01:00
jackpoz 20e96eead4 Core/Player: Adjust fall damage log
Move fall damage log to "entities.player.falldamage" category and include the usual debug info

(cherry picked from commit 5270ff58daf31ce10919d9da53e09f494956a5f2)
2022-03-01 22:49:22 +01:00
Giacomo Pozzoni 2e70d6b45f CI/GitHub: Install GCC 8 (#26341)
(cherry picked from commit 39bd263c72757acb7facd27cc12b0230866a8f25)
2022-03-01 11:37:35 +01:00
jackpoz 1ba5e17c95 Core/AI: Fix CorpseRemoved() and SMART_EVENT_CORPSE_REMOVED not being called for creatures without m_respawnCompatibilityMode
Fixes #24958

(cherry picked from commit 28a1132211aaf8d43e3459a7dc8ee093df1bcfa0)
2022-02-28 23:14:37 +01:00
Giacomo Pozzoni b7a3124156 CI/GitHub: Switch to GCC 8 (#25610)
* CI/GitHub: Switch to GCC 8

Build on GitHub Actions using GCC 8 as it's the oldest supported GCC

* Core/Misc: Attempt to fix GCC 8 build

(cherry picked from commit d7459cccedc7ca9ba85e209dfeef61969fc78d9a)
2022-02-28 23:13:59 +01:00
Giacomo Pozzoni a7473f1a91 CI/CircleCI: Authenticate to DockerHub when pulling the docker image (#25581)
For more information see the following links:
- https://www.docker.com/blog/scaling-docker-to-serve-millions-more-developers-network-egress/
- https://docs.docker.com/docker-hub/download-rate-limit/
- https://circleci.com/docs/2.0/private-images/

Add DOCKERHUB_USERNAME and DOCKERHUB_PASSWORD secrets to CircleCI Environment Variables. DOCKERHUB_PASSWORD can be either the password or an access token.

(cherry picked from commit e3da1ed2455676cfe31757cbd816d92ee1d93a3c)
2022-02-28 21:47:38 +01:00
jackpoz eb17e94b2e Core/SAI: Fix SMART_ACTION_WP_RESUME actually pausing next waypoint if the current path was not paused
Fixes #25519

(cherry picked from commit 5be7c2ad4f7cd561951e1285227211e03886703f)
2022-02-28 14:42:53 +01:00
jackpoz b059f2f8ee Core/SAI: Allow to debug SmartAI methods
(cherry picked from commit 59bb822f78291c3b0d7b5811478637729569e07d)
2022-02-28 14:42:40 +01:00
jackpoz e7fc68d74b Core/Commands: Enable .debug loadcells on console and allow to load a specific tile
Specify the tile as XY. Note that this is not Grid XY

(cherry picked from commit 6f6cec89e598a046e73d48df14be26b053875470)
2022-02-28 12:18:19 +01:00
jackpoz f3787c6559 Core/Commands: Fix typo in .mmap loc command
The displayed "tileloc" value is a "swapped" Tile XY, not to be confused with Grid XY.

(cherry picked from commit 34af088c9b381db5b5212075f0df486a8593fae3)
2022-02-28 12:09:19 +01:00
jackpoz df94ce0f68 Core/Creature: Ignore combat reach when looking for assisting creatures
Fixes #25487

(cherry picked from commit 24018b7a74ec8e68e43895e0e57f6397f59ea890)
2022-02-27 23:26:54 +01:00
jackpoz 2bd7d00e56 Core/Pet: Fix GetDebugInfo() output
(cherry picked from commit 16292f9d94ebbc69ccfff547cb14f78d4deb4423)
2022-02-27 23:15:47 +01:00
Giacomo Pozzoni bfdabb8c37 Core/Quest: Fix wrong feedback sent to the quest sharing sender with auto-accept quests. (PR #25477) Closes #25474.
Co-authored-by: Treeston <[email protected]>
(cherry picked from commit e2d643f5518d256e17851243896985b2773db281)
2022-02-27 23:03:06 +01:00
jackpoz 7a2c3af988 CI/AppVeyor: Add artifact without symbols for smaller download size
(cherry picked from commit a724903b8b307516780474dd23977d2a9b502eb5)
2022-02-27 20:08:41 +01:00
Giacomo Pozzoni a65b3493a7 Core/SAI: Add orientation and delay columns to waypoints table (#25472)
* Core/SAI: Add orientation and delay columns to waypoints table

* Rename 2020_99_99_99_world.sql to 2020_09_19_00_world.sql

(cherry picked from commit 4b7d19c91bde2cabb8498809dee935c7efb2660a)
2022-02-27 20:08:41 +01:00
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