Commit Graph
100 Commits
Author SHA1 Message Date
jackpoz e7b94603f2 Core/Commands: Add .debug guidlimits <optional map id> chat command
Add .debug guidlimits <optional map id> chat command to show the highest low guid counter for Creature and GameObject, useful when reaching Respawn.GuidWarnLevel

(cherry picked from commit 7421ccaf7eb134f549ad3734a815397216d020ed)
2021-12-16 00:53:58 +01:00
jackpoz 71b2f8c6ab Core/Calendar: Fix issue with invite status being set to the wrong invite
Consider the case of Player A inviting Player B to a Calendar Event. After Player B clicks on Accepts/Tentative/Reject, the calendar shows that status for Player A instead.

(cherry picked from commit 7f3d8c99bb14c7b093a5c2419f3e931fef11004e)
2021-12-16 00:15:48 +01:00
Giacomo Pozzoni ebe436d2c2 Core/ChatCommands: Fix .wp reload crash
(cherry picked from commit e4c2bb4f1411f2db724a7cfcdc014013a63b37a5)
2021-12-15 00:17:32 +01:00
Giacomo Pozzoni c5173aca15 Core/Quest: Fix repeatable quest mark (#23338)
(cherry picked from commit 2cb4517303b217c57f52577a91184dc956a5c423)
2021-12-14 00:13:47 +01:00
jackpoz 841630fcc3 Core/Misc: Fix static analysis issues reported by Coverity Scan
(cherry picked from commit de88691e257af0bf078d9be74ab3bb578f016547)
2021-12-13 00:42:18 +01:00
jackpoz dd22c6fe67 Core/Misc: Code cleanup
(cherry picked from commit eeced9ae158640de67ed0cb59d01ae92570bfa77)
2021-12-11 23:20:05 +01:00
jackpoz 134fa22510 Core/Unit: Ignore On Transport spline movements if the Unit isn't on a transport anymore
On Transport splines use coordinates relative to the transport but if the transport is not found anymore than there is no way to get the absolute coordinates, leading to relative coordinates being used as absolute instead. The result is a Unit being set at position (0, 0, 0) or close by.

(cherry picked from commit c90f789eac9092d5332e92242ed0bfab7fd9e9fe)
2021-12-11 14:12:54 +01:00
jackpoz 0c1f707ca5 Core/Misc: Change some logs from INFO to ERROR when loading invalid creature template resistances and spells
(cherry picked from commit 078c5a3e18227ad9f8bd2c1bcc7d48dd0122f801)
2021-12-11 14:12:53 +01:00
jackpoz 2d7ec53330 Core/Player: Fix teleporting FlyPath dismounting the player
Issue added in 72fc79a9e63d77754699a3da90d81219b2defb0d

(cherry picked from commit 4019cae375838e3bc653936fb9705d8df57ca571)
2021-12-11 14:12:53 +01:00
Giacomo Pozzoni 7a8d15d63b Core/CreatureTemplate: Outsourced resistances and spells into creatur… (#23343)
* Core/CreatureTemplate: Outsourced resistances and spells into creature_template_spell and creature_template_resistance

* Rename 2019_99_99_00_world.sql to 2019_06_15_01_world.sql

(cherry picked from commit d5fb0a30ec62f3799416326d81d5d14992f9a6df)
2021-12-11 13:06:25 +01:00
Giacomo Pozzoni 4e7727d575 3.3.5 game event respawn (#23391)
* Core/GameEvent: Remove respawn times of Creature and GameObjects when starting/stopping an event

* Add checks for pool

* Remove the check for pools

(cherry picked from commit 678f3dd687432b4229d903a8acfb882c2336e168)
2021-12-11 13:06:13 +01:00
Giacomo Pozzoni 920a18c062 Core/Misc: Fix static analysis issues reported by Coverity Scan
(cherry picked from commit df92ceb9bc051444073a44eaf8c730357bb57355)
2021-12-11 12:03:43 +01:00
jackpoz ab3edebb5d Core/Player: Remove all Motion Masters when teleporting
Fix #22859

(cherry picked from commit 72fc79a9e63d77754699a3da90d81219b2defb0d)
2021-12-11 11:38:24 +01:00
jackpoz 1b6dee9990 Core/SmartAI: Rename SMART_EVENT_HEALT_PCT to SMART_EVENT_HEALTH_PCT
(cherry picked from commit 50ed1bb5b3d30936b844659b869fe66a0da7e04f)
2021-12-11 11:35:07 +01:00
jackpoz db0058964f DB: Add new view vw_log_history to show database logs in a better way
(cherry picked from commit 9fc4ff9dd29968c1d64f47df4e721b468ac87362)
2021-12-10 23:01:13 +01:00
jackpoz 6303c7bcb1 Core/Logs: Allow to log startup logs into Database appender
(cherry picked from commit dbd8b3fc63d1b218df755f34fd7185553f2db3a5)
2021-12-10 22:49:10 +01:00
jackpoz efbb6f5b7d Core/Map: Don't log errors about Area ID 0
Restore a check about Area ID 0 that would silently ignore this case instead of spamming log errors. Check removed in e79c595b695ea5f35b8324efbb7741ccb102bce9
Fix #23085

(cherry picked from commit bda351d7f1cb3ff663a9d231afa85864ea0f8078)
2021-12-09 00:32:48 +01:00
jackpoz 363f385fc0 Scripts/HallsOfLightning: Fix Volkhan spamming in chat when wiping at 10% health
Ref #23082

(cherry picked from commit 2d5387ea425fc4c31d664fcccad02c83a9f41aa0)
2021-12-09 00:32:32 +01:00
jackpoz b4652a38d3 Core/Misc: Headers cleanup
Use simple std::string concatenation instead of stringstream to avoid including <sstream> header.

(cherry picked from commit 9c790e231ef00c29a33b037ac2ae28d526474539)
2021-12-09 00:32:05 +01:00
Giacomo Pozzoni 33347c7d5f Core/Misc: Fix static analysis issues
Fix static analysis issues reported by Coverity Scan

(cherry picked from commit e12398afdc0ffa878b31af1dbd98fb0c995cf020)
2021-12-09 00:24:41 +01:00
jackpoz 049606e31e Core/MovementGenerator: Add more details to asserts
Implement GetDebugInfo in MovementGenerator, PathMovementBase, FlightPathMovementGenerator, WaypointMovementGenerator.
Add an additional assert in FlightPathMovementGenerator::DoEventIfAny(), the input node must not be null

(cherry picked from commit 9da81239596bf798b1beafc5ddeaeb37dcc330ff)
2021-12-08 23:51:21 +01:00
jackpoz 2cade0e6e3 Core/Channel: Sanitize channel names
(cherry picked from commit 7b8f294c024230451f82ff67150e11fc31b61293)
2021-12-08 23:47:07 +01:00
jackpoz 97249ff7b4 Core/Channel: Fix CRT Debug Assert triggered with invalid channel names
(cherry picked from commit f0bd90cc35098475b20e736cf98885c99c04be3d)
2021-12-08 23:43:19 +01:00
Giacomo Pozzoni 6e28ecd22e Core/Movement: Fix assertion triggered in SplineChainMovementGenerator
Fix an assertion triggered in SplineChainMovementGenerator happening when a new generator is added while last spline of the SplineChainMovementGenerator is being processed but is not finalized yet.
Fix #23077

(cherry picked from commit 5d7f0eef6e2f89d5dbeb0a702f7a35c95626240e)
2021-12-08 23:35:01 +01:00
jackpoz e9aed3e442 Core/SmartAI: Improve SMART_EVENT_GOSSIP_HELLO
Add another value to event_param1 for SMART_EVENT_GOSSIP_HELLO to support all cases of OnGossipHello/OnReportUse in GameObjects:
- event_param1 set to 0: execute the action for both OnGossipHello and OnReportUse. This might result in the action being executed twice when clicking the GameObject
- event_param1 set to 1: execute the action for only OnGossipHello
- event_param1 set to 2: execute the action for only OnReportUse

(cherry picked from commit 9e58ef6940c78d92f1553cf7ab75e87a6e2cf112)
2021-12-08 21:33:58 +01:00
jackpoz 6034992dff Core/SmartAI: Implement SMART_EVENT_SUMMONED_UNIT and SMART_EVENT_SUMMON_DESPAWNED for GameObject owners
(cherry picked from commit 507a56d62764f63113d35dfcca9273b8d0b16cc5)
2021-12-07 00:31:26 +01:00
Giacomo Pozzoni 5f545f5402 3.3.5 gameobject summoner (#23289)
* Scripts/Misc: Change IsSummonedBy(Unit*) to IsSummonedBy(WorldObject*)

* Scripts/Misc: Fix build

* Core/TempSummons: Rename GetSummoner() to GetSummonerUnit()

* Core/TempSummons: Add support to TempSummons::GetSummoner() to return GameObject too

* Fix build

* Core/TempSummons: Allow GameObject to be owner of TempSummon

* Core/TempSummons: Add support to SAI for GameObject owner of TempSummon

* Scripts/Misc: Fix no-pch build

* Core/TempSummons: Implement PR comments

(cherry picked from commit 797fba98e95da1236465a15061ec4122d7ec33fe)
2021-12-07 00:02:03 +01:00
jackpoz 54044bda82 Core/SmartAI: Fix SMART_EVENT_SUMMON_DESPAWNED
Fix SMART_EVENT_SUMMON_DESPAWNED not working when event_param1 was set to any value other than 0

(cherry picked from commit 457fc224733cc78cedc5e956442a9f5d7bd2f049)
2021-12-06 23:27:45 +01:00
jackpoz 7fc359559f Core/Misc: Fix static analysis issues reported by Coverity
(cherry picked from commit a0bd68cf465517786d16bcb145ed3fc8bc5b5b98)
2021-12-05 22:44:38 +01:00
jackpoz ccc8d679d8 Core/Misc: Log Map name in asserts
(cherry picked from commit 991b2a11bd8aba4351a60a5f0e13153cd3f2c71c)
2021-12-04 00:31:32 +01:00
jackpoz 6be185e6a2 Core/Misc: Log Spell/Aura name in Spell/Auras asserts
(cherry picked from commit 4130384f2e88ba266f75c553c89a351d43e52203)
2021-12-04 00:31:28 +01:00
jackpoz 8dd1f39153 Dep/Jemalloc: Update to Jemalloc 5.2.0
(cherry picked from commit 5d986f0be46bf439caf227f3c228ac1c8efddfde)
2021-12-03 22:02:24 +01:00
jackpoz a855e6221d Core/Vehicles: Fix accessories disappearing on reset
(cherry picked from commit 6dae4a747da558ca46a777186d4519c32fc1bf04)
2021-12-03 22:02:13 +01:00
jackpoz eb25fbd485 Core/Misc: Apply fatigue when flying too
Fix #22856

(cherry picked from commit a76d01278a8f7986414edd0eaefaa42344926dbd)
2021-12-03 22:01:02 +01:00
Giacomo Pozzoni 910e0b70ef Core/Vehicles: Fix multiple vehicle join events on same seat (#23233)
(cherry picked from commit d4414af2d4f0736a842c4c596546c9583692ec3c)
2021-12-03 00:23:24 +01:00
Giacomo Pozzoni 46170fdf01 Scripts/Spells: Fix implementation of #22332 (#23228)
Change the way #22332 moved spell damage calculations from SpellEffectDMG to scripts, using OnEffectLaunchTarget and SetEffectValue instead

(cherry picked from commit 20772dbf5d10c6ec2891a068fb556c9f5fc7d324)
2021-12-02 23:46:00 +01:00
jackpoz 97be87b7d5 Core/LFG: Remove dungeon cooldown when completing random dungeons
(cherry picked from commit 24fbbee4b9af7b5226772378dd83b78c103d969d)
2021-12-02 23:45:29 +01:00
jackpoz 57411da5b2 Core/Pet: Change assert to error log
Change assert added in 43dec9e4d0b6f7da3c2051624742e9fb8a9bcb31 to error log since charmed creatures lose their AI until next map update

(cherry picked from commit 70fcdc687d1227a796c03f6353fc8dbfc4f4aea3)
(cherry picked from commit f45ebe71b0d8f6e3008514324a58a92c0db3810e)
2021-12-02 00:39:28 +01:00
jackpoz 49414acaef Core/CrashHandler: Remove sensitive data from crashlogs
(cherry picked from commit 25bcb1a0b2d9326519d9226dfe968caf26bb4e2d)
(cherry picked from commit 37478c5ac1efb8e4f19ffc94f444e160600c7b27)
2021-12-02 00:39:28 +01:00
jackpoz cf979de813 Core/Misc: Fix some GCC 8 warnings
(cherry picked from commit 26b6cb0584b50a2540e977cac8fa040c82fe7bb4)
2021-12-02 00:39:28 +01:00
jackpoz 841f0452a4 Core/MMaps: Revert PATHFIND_INCOMPLETE handling change in ChaseMovementGenerator in 386b5a6fd948b4866cbd9a8a9892e8777922e9c9 since the current hp reset code in Creature::Update() will reset the hp of bosses as soon as CanNotReachTarget() is true. In case of boss mechanics like Abub'Rekhan at Naxx where the boss throws the player in the air, a PATHFIND_INCOMPLETE path is returned.
The code in Creature::Update() should be modified to wait a few seconds before resetting the hp. PATHFIND_NOPATH / PATHFIND_INCOMPLETE don't really mean that the Creature can't attack the player anyway either.

(cherry picked from commit d910ffd77949f422bd08f12079866962fb53c4dc)
2021-12-02 00:39:28 +01:00
jackpoz a4fcfbb3af Core/Scripts: Rename recent GameObject spell overloads to fix GCC warnings
Rename recent GameObject spell overloads (they used to accept only Unit as parameters) to fix GCC warnings about partial function override.

(cherry picked from commit e3a9a9bfb2cba3fc1f6ed616b07fb0ea88de461f)
2021-12-02 00:39:28 +01:00
jackpoz c73fd0e6e3 Scripts/Commands: Add .debug asan commands
Add ".debug asan memoryleak" and ".debug asan outofbounds" commands to trigger Address Sanitizer warnings at runtime (or other dynamic analysis tools)

(cherry picked from commit 71d15ea25be3e86646faaa3266617a0b8177972f)
2021-12-02 00:39:20 +01:00
jackpoz dc2fed13c8 Shared/Metric: Fix a rare memory leak
Fix a memory leak in Metric happening only when enabling/disabling Metric from configs at runtime, leaking the metric added between last SendBatch() call and the ScheduleSend() call in the same function. The only way to reproduce this is to actually freeze the thread calling SendBatch(), disable metric, reload config, unfreeze the thread.

(cherry picked from commit 0d1ff7446dce7b0641f49ac55a008669838612cd)
2021-12-02 00:39:20 +01:00
jackpoz 98863659bb Scripts/Guards: Fix infinite loop in npc_air_force_bots
Fix infinite loop in npc_air_force_bots happening when aura 38067 was removed, triggering MoveInLineOfSight() that would add back the aura. Only 1 aura add/remove for guard for player is allowed now.

(cherry picked from commit 844e7ee9262a5ba035ac9e8a6ffc298fb97fd3a9)
2021-12-02 00:39:20 +01:00
jackpoz 519e3c9ab7 Core/Commands: Fix .cheat god command letting you die
Fix .cheat god command still letting you die with Area Aura like Slime near Thaddius, broken since 777b287dff

(cherry picked from commit f26f716714fefa2af4c6e3eea263206682d45236)
2021-12-02 00:39:20 +01:00
jackpoz dd825c5614 Core/Maps: Fix crash caused by setActive(false) called after DespawnOrUnsummon()
Fix crash caused by WorldObject::setActive(false) called after WorldObject::DespawnOrUnsummon() happening because the WorldObject would be set as not active but then Map::RemoveFromActiveHelper() would not be called because of not being in world anymore.
Whenever setActive() gets desync'd with what Map actually contains a rare crash would happen since Map only reads a few values of the active WorldObject, making it hard to reproduce. If this happens again some ASSERT calls should be added (or a check in Map::RemoveFromMap() could be added about if the WorldObject is in Map::m_activeNonPlayers container).

(cherry picked from commit 1c833f28e471e3787f1d328e44af5f065ad9ca8c)
2021-12-02 00:39:20 +01:00
jackpoz 73c6c13ace Core/GameObject: Code cleanup
(cherry picked from commit 16a154c4e87ff1ff89323a8960bf601e6c18589b)
2021-12-02 00:39:20 +01:00
jackpoz 5600316c9f Core/Calendar: Improve calendar timezone handling
Improve calendar timezone handling by at least creating events with the correct time if both client and server are in the same timezone. There is currently no information received from the client about in which timezone it is.

(cherry picked from commit b33934f6ce9b0227597c712dd6a76b7ed49deea3)
2021-12-01 00:46:05 +01:00
jackpoz aeaca00d76 Buildsystem: Fix finding VS 2019 compiled boost libs
(cherry picked from commit 3d3b7f438c6638aed998f4233b809826a3cf0f54)
2021-12-01 00:28:13 +01:00
jackpoz b02143118f Core/Database: Delete gameobject_addon data when deleting a GameObject from the database
Close #23076

(cherry picked from commit f88a5b12bd7511331ea27975fe26bfc98d92d20d)
2021-11-30 23:05:27 +01:00
jackpoz aeece162b9 Core/MMaps: Fix crash added in 386b5a6fd948b4866cbd9a8a9892e8777922e9c9
(cherry picked from commit 17bb608a5e77345948a8c4f28d78e2cba5302505)
2021-11-27 01:40:13 +01:00
jackpoz b4cff8159e Core/MMaps: Simplify d182e5f7e73e614185f4470429467befd6e03981 and handle PATHFIND_INCOMPLETE in ChaseMovementGenerator as "cannot reach the target"
(cherry picked from commit 386b5a6fd948b4866cbd9a8a9892e8777922e9c9)
2021-11-27 01:38:24 +01:00
jackpoz bf1bf510fb Core/MMaps: Fallback to shortcut for flying units if Detour returned an incomplete path.
Fallback to shortcut for flying units if Detour returned an incomplete path. This is needed when a flying unit should fly to the floor below to reach the target, but since Recastnavigation doesn't support "jumping down" the unit would not find a path to the target.

(cherry picked from commit d182e5f7e73e614185f4470429467befd6e03981)
2021-11-27 01:38:11 +01:00
Giacomo Pozzoni d37a8ea038 Core/Database: Close the MySQL connection only after getting the last error code
(cherry picked from commit 3230ca74d21517204bb785e9ec799d995295ad28)
2021-11-27 01:25:47 +01:00
jackpoz ad06ab5436 Dep/Recast: Update recastnavigation to https://github.com/recastnavigation/recastnavigation/commit/54bb0943e5174a71eeeca11919920f685760a4f0
(cherry picked from commit e061663508191f7782dd62c7e13b5ea804f58f67)
2021-11-26 22:44:37 +01:00
jackpoz 721f4c6032 Core/Misc: Fix static analysis issues
Fix static analysis issues spotted by Coverity Scan

(cherry picked from commit 750d89beed38f4af9efa3699b79f2950f430bfdd)
2021-11-24 23:45:36 +01:00
jackpoz 71cb10afe0 Core/Misc: Fix static analysis issues
Fix static analysis issues spotted by Coverity Scan

(cherry picked from commit a12ea482f3eae340b54d09b7163e69524c422f06)
2021-11-24 23:45:27 +01:00
jackpoz 43a41caafb Core/Misc: Fix GCC 8 warnings
(cherry picked from commit 1d04a3b216901671eae0104547715a570b1ff3ab)
2021-11-24 23:40:15 +01:00
jackpoz 7a2ef47495 Core/Spells: Adjust range checks to GameObject targets
(cherry picked from commit 72052aa9a55683011969510f4aea6d1efd9c67c9)
2021-11-24 20:35:17 +01:00
jackpoz 71b58c2e62 Core/Spells: Adjust range checks to GameObject targets
(cherry picked from commit 270a144083d85d18cba8aff861dd6effbd04c476)
2021-11-24 20:35:17 +01:00
jackpoz 91bbaae81e Core/LFG: Teleport players to other players instead of dungeon entrance when continuing a LFG dungeon
This feature already existed in current code but was broken by d0334bf948

(cherry picked from commit d2841d6b664ac2c8e818bea1a469fdd3f1b31f6b)
2021-11-24 20:35:17 +01:00
jackpoz ace33a464f Core/Misc: Code cleanup
(cherry picked from commit 6c5d9971619ad1f3982defd67342571561dddb62)
2021-11-24 20:34:56 +01:00
jackpoz c312b926b4 Core/MMaps: MMaps logs cleanup
Move MMaps related logs from "maps" category to "maps.mmaps".
Remove newlines in logs, the log system already takes care of newlines.

(cherry picked from commit 696039cfed53334ed32583ec293db787e64ef5db)
2021-11-24 20:34:56 +01:00
jackpoz bd0e9e7aa8 Core/MMaps: Fix infinite loop in Detour
Fix another infinite loop in Detour caused by degenerated triangles.
Check the result of some previously ignored Detour calls.
Update recastnavigation to 3a619d773deb7e3a15ee215217c825995fe71312 and apply some more custom changes

(cherry picked from commit c602220e02bed1ad76c9e60064eeec5fd97bfe80)
2021-11-24 20:34:56 +01:00
jackpoz 97401a2997 Core/Commands: Don't re-add active quests with ".quest add" command
(cherry picked from commit f17120cc784ee1f52a24424a78a64d71ad73b713)
2021-11-24 00:02:13 +01:00
jackpoz b8396f682c Core/MapScripts: Add support to GameObjects to SCRIPT_COMMAND_DESPAWN_SELF
(cherry picked from commit da19ad117e3c4c15793ba8f84738efaecb4d1428)
2021-11-24 00:02:08 +01:00
jackpoz 291ee6416c Dep/Recast: Validate input values more consistently and completely, including that points are finite
Merge https://github.com/recastnavigation/recastnavigation/pull/374 .
This should fix infinite loops happening with degenerated triangles with 0 area.
Fix #23028

(cherry picked from commit a75fbe527a9c35fd0cb2e0710a3ebed1223d5c61)
2021-11-23 23:44:00 +01:00
jackpoz 2318013278 Core/MMaps: Add rcMedianFilterWalkableArea() to mmaps generation process
Add rcMedianFilterWalkableArea() to mmaps generation process to simplify some ground/water areas

(cherry picked from commit 7ddbc18aafe61434971013ed6126f5666011ab43)
2021-11-23 23:43:55 +01:00
jackpoz abb36a1e5b Core/Spells: Add range checks to GameObject targets
Close #23062
Patch by robinsch

(cherry picked from commit 76cc94f325ab68f66a4fa7b5d30316508e27c0ce)
2021-11-23 23:34:27 +01:00
jackpoz ef04a26bf4 Core/Pet: Add assert
Add additional assert to check if it's possible for a Pet not to have an active AI when the Player owner kills an enemy.
Ref #23036

(cherry picked from commit 43dec9e4d0b6f7da3c2051624742e9fb8a9bcb31)
2021-11-23 23:10:45 +01:00
Giacomo Pozzoni ed5ba915f1 Core/Scripts: Change PlayerScript and CreatureScript inheritance (#23048)
Remove UnitScript from PlayerScript and CreatureScript classes as that's how the original system that was PR'd worked, see https://github.com/TrinityCore/TrinityCore/pull/7867 for reference.
Please note these are used as global hooks and should really just invoke stateless functions.
If you need to hook methods from PlayerScript/CreatureScript and UnitScript, just define 2 different scripts (this is how the original system worked and how it was designed to work)

(cherry picked from commit 5b7ead65bb116195f4336934bcff830e1b2af5bb)
2021-11-23 22:54:24 +01:00
Giacomo Pozzoni 31dca39c05 3.3.5 threat assert (#23034)
* Core/Creature: Change assert about Threat to log

(cherry picked from commit cb8ff7976b1419c6a1334bb49783480d543aff16)
2021-11-23 22:48:39 +01:00
Giacomo Pozzoni 24f9b41622 Shared/Utilities: Handle string format exceptions
Handle StringFormat() exceptions in case of malformed string format to avoid causing unhandled exception crashes

(cherry picked from commit c79811de4fbf2b22cd74f55853516c7fc307055f)
2021-11-23 22:48:28 +01:00
jackpoz b0703f943c Core/MMaps: Change infinite loop fix in Detour
Change the infinite loop fix in Detour to allow looping through all the m_nodePool nodes max once, otherwise it most likely means that we entered an infinite loop. This is currently set to 1024.

(cherry picked from commit 12e6faa0fa0cf389bcebd4a6f2220e71c697250c)
2021-11-23 22:29:58 +01:00
jackpoz 23489568db Core/MMaps: Fix infinite loop in Detour
Fix an infinite loop in Detour happening in Dalaran Sewers.
This is more of an emergency patch until we figure out why dtNodes have a circular reference (A -> B -> C -> A) happening quite often in this place

(cherry picked from commit c8ec2dd95d07e3eec00027cdb9605529a49d6475)
2021-11-23 22:28:28 +01:00
jackpoz 3ddbf02dc7 Core/Misc: Fix issues reported by static analysis
Fix issues reported by Coverity Scan

(cherry picked from commit 2fda1572d214d0b114e0291106363f49c2d3179e)
2021-11-23 22:20:39 +01:00
jackpoz 9807f32334 Core/Misc: Fix issues reported by dynamic analysis
Closes #23021

(cherry picked from commit 9942047c721110b4d2135028ec4c17060e0301bc)
2021-11-23 22:19:06 +01:00
jackpoz 927e62e88e Core/Group: Fix memory leak
Fix memory leak happening when disbanding a group with an ongoing roll.
Please note this is not blizz-like but at least we don't leak memory anymore.

(cherry picked from commit f04e90f638425c0e0ef2e40f0cd29ab7eec625d1)
2021-11-23 21:28:23 +01:00
jackpoz e475cac631 Core/Spells: Fix assert triggered
Fix assert triggered when a spell would trigger another spell in OnEffectHitTarget that would kill the aura owner, then processing the main spell effects. The triggered spell can kill the aura owner, changing its death state to CORPSE and removing auras created.

Fix #21856
Ref 518e6299ca08a362bc3709daaaa5e5d5633d1bf1

(cherry picked from commit 46c7446bd4ef606b1091c1582df50e027fab28b6)
2021-11-23 20:47:31 +01:00
jackpoz 3f4bedd803 Tools/MMaps: Allow to specify different Recast settings for different maps
Allow to specify different Recast settings for different maps, currently handled in GetMapSpecificConfig() as a switch statement.
Set walkableRadius to 0 in Blade's Edge Arena (Map ID 562) so the pets can walk on the thin rope between the bridge and the pillar.

(cherry picked from commit e4658a1307b1d52a4e6a0ed67f7dff92f02c090d)
2021-11-22 23:54:43 +01:00
jackpoz cb8b637061 Dep/Recast: Update recastnavigation to https://github.com/recastnavigation/recastnavigation/commit/14b2631527c4792e95b2c78ebfa8ac4cd3413363
Rebuilding mmaps IS required

(cherry picked from commit 5ff88ea04aec4677f1c1d669674e5442288a25e3)
2021-11-22 00:17:11 +01:00
jackpoz 3acb420444 Core/MapScripts: Allow GameObjects to be caster of SCRIPT_COMMAND_CAST_SPELL
(cherry picked from commit 813cf761fcf8737e50486672be28900c9cf4f36f)
2021-11-21 21:10:10 +01:00
jackpoz 36468203dd Core/Spells: Fix assert triggered
Fix assert triggered when a spell would trigger another spell in OnEffectHitTarget that would kill the target, then processing the main spell effects. The triggered spell can kill the target, changing its death state to CORPSE and removing auras created.
Fix #22306

(cherry picked from commit 518e6299ca08a362bc3709daaaa5e5d5633d1bf1)
2021-11-21 21:09:36 +01:00
jackpoz d532420d79 Core/Misc: Update 85e3169fbd7b2da70e0f054399f4db64ded36325 about SOAP
Change again how SOAP is stopped if SOAP successfully binds but worldserver fails to bind its sockets.
A crash remains if SOAP fails to bind because it calls exit() and that triggers asserts everywhere.

(cherry picked from commit d05ab073cb102a4f868b0fda51ef4368350ded32)
2021-11-21 20:16:46 +01:00
jackpoz f83601de2f Core/Networking: Set SO_REUSEADDR on *nix platforms
(cherry picked from commit 46f2595f511011d577be0ecee3d9f44c980ddc92)
2021-11-21 20:16:26 +01:00
jackpoz 05210c2a34 Core/Misc: Fix shutdown with SOAP enabled
Fix worldserver entering a loop when having SOAP enabled but failing to bind both SOAP and worldserver listened socket. SOAP thread would keep trying to bind the socket over and over checking World::IsStopped() condition that was never set to true

(cherry picked from commit 85e3169fbd7b2da70e0f054399f4db64ded36325)
2021-11-21 20:16:03 +01:00
Giacomo Pozzoni b1b5a6a591 Core/Quest: Fix crash in GetQuestDialogStatus()
Fix possible NULL dereference in GetQuestDialogStatus()
Fixes #22516

(cherry picked from commit 6859dfa2d157f0d174004a00a9d047d6eb38f9a1)
2021-11-21 19:51:52 +01:00
Giacomo Pozzoni ed88435494 3.3.5 UnitAI (#22911)
* Core/AI: Revamp how UnitAI changes are applied

Revamp how UnitAI changes are applied by storing current AI in a variable and all previous AIs plus current in a stack.
The callers can push/pop AIs on the stack that will take effect only in next Unit::Update() call.
The current AI will be a valid object for the whole duration of Unit::Update() and until next Unit::Update() call.

* Core/AI: Apply new AI change code

* Core/AI: Fix build

* Core/AI: Fix crash on Creature::AIM_Create()

* Core/AI: Fix crash

* Core/AI: Restore ASSERT

* Core/AI: Fix UnitAI not being popped properly when restoring a charmed AI

(cherry picked from commit 8f9654d8176646c3076482477fc4b91011fb83cc)
2021-11-21 15:36:57 +01:00
jackpoz e9e3d2d69d Core/Utils: Handle UTF-8 conversion errors
Replace the output string when a UTF-8 conversion error happen with an error message instead of using an empty string, swallowing any message that the caller wanted to log.

(cherry picked from commit bdb7e6e5e81e0d9376c9c803bae9da470b02d8cd)
2021-11-21 14:38:29 +01:00
Giacomo Pozzoni 9668096056 Core/Networking: Fix memory leak (#22923)
Fix memory leak reported by ASan happening when ports fail to bind in Authserver

(cherry picked from commit 57d7b194522d6d44f4d2e9400c03cfc13d5a706a)
2021-11-21 13:54:27 +01:00
Giacomo Pozzoni fff0d174aa Scripts/Misc: Fix LoadMinionData() dynamic analysis issues
Fix issues reported by Address Sanitizer about LoadMinionData() calls on arrays that don't end with a {0, 0} pair.

(cherry picked from commit 08dcee0cf9a56944027d3f65b7fd5c4a4959761c)
2021-11-18 22:53:21 +01:00
jackpoz 0b556d8a91 Core/Handlers: fix ".whisper on" with opposite faction/low level
Closes #22283

(cherry picked from commit f11117584d0b787bbf36ae61dad2b46e559b0953)
2021-11-18 15:59:31 +01:00
Giacomo Pozzoni ff2cd4a032 Scripts/Commands: Fix crash caused by .set npc model (#22877)
* Scripts/Commands: Fix crash caused by .set npc model

Fix crash caused by .set npc model with invalid model id

(cherry picked from commit 20ea24bf5ccf165ce19139d1f7ec7c650719eb68)
2021-11-18 15:57:20 +01:00
Giacomo Pozzoni 4177030dcf Scripts/Nagrand: Fix crash added in PR #22806 (#22878)
Fix crash added in PR #22806 happening in quest "Ruthless Cunning and Returning the Favor"

(cherry picked from commit cb136387218bc7a5473cf1ca6707ec1ba3b8c1c0)
2021-11-16 21:04:05 +01:00
jackpoz 9dcbccce26 Core/Misc: Fix vsnprintf usage in ASSERT()
Fix vsnprintf to follow standard definition and not some old VC++ behavior, not requiring to include the '\0' character in the count parameter

(cherry picked from commit eee1f2cadf8174caca4849c22ba1fb8f12fc9e08)
2021-11-16 20:37:27 +01:00
Giacomo Pozzoni d5c41d23e6 Core/Misc: Log more information in asserts (#22783)
* Core/Misc: Log more information in asserts

Add a new function GetDebugInfos() to types that could trigger an ASSERT() to easily include more useful information in crashlogs.
This is an initial commit that requires many more commits to implement the new GetDebugInfos() function in all required types.
If the type doesn't have the function, the global default one is picked which doesn't log anything.

* Core/Misc: Fix dynamic build

Add missing attribute for dynamic build

* Core/Misc: Fix gcc/clang build

* Core/Misc: Rename GetDebugInfos() to GetDebugInfo()

* Core/Misc: Fix FormatAssertionMessage() adding an extra '\0'

* Core/Misc: Add GetDebugInfo support to Unit

* Core/Misc: Add GetDebugInfo support to Creature

* Core/Misc: Add more info to GetDebugInfo for Creature

* Core/Misc: Add GetDebugInfo support to GameObject

* Core/Misc: Add GetDebugInfo support to Player

* Core/Misc: Add more GetDebugInfo info

* Core/Misc: Add GetDebugInfo support to Item

* Core/Misc: Add GetDebugInfo support to Bag

* Core/Misc: Add GetDebugInfo support to Transport

* Core/Misc: Add GetDebugInfo support to TempSummon, Minion, Guardian, Pet

* Core/Misc: Add GetDebugInfo support to Map, InstanceMap

* Core/Misc: Add GetDebugInfo support to Spell

* Core/Misc: Fix build warning

* Core/Misc: Add GetDebugInfo support to Aura

* Core/Misc: Add GetDebugInfo support to UnitAI

(cherry picked from commit 9a924fb9d557434c5a2e4020c80db6e6bfe466ad)
2021-11-16 20:36:58 +01:00
jackpoz c4cb1748ca Scripts/BlackrockSpire: Fix infinite loop in Gyth fight
Fix infinite loop in Gyth fight and double event caused by Rend Blackhand being respawned.
Please note this event is completely bugged and unfinished and contains for sure more bugs.

(cherry picked from commit af3449e06463b3425df2ce67195fa55492af4151)
2021-11-11 21:40:03 +01:00
jackpoz d6ce2fa8b8 Core/SAI: Add maxSize parameter to SMART_TARGET_CREATURE_DISTANCE, SMART_TARGET_GAMEOBJECT_DISTANCE, SMART_TARGET_CREATURE_RANGE and SMART_TARGET_GAMEOBJECT_RANGE
(cherry picked from commit 46368188ce508359d839d8e48b65bf1df3ae3ac6)
2021-11-10 00:12:08 +01:00
jackpoz 4fabfa0903 Core/SAI: Add a 4th target parameter to SAI
(cherry picked from commit 7634a57f64a38e1151d648eeacae8480c83d19df)
2021-11-10 00:11:52 +01:00