Commit Graph

2167 Commits

Author SHA1 Message Date
Treeston c13d83796f Core/AI: Finally move the "is creature engaged" flag to be a property of the creature AI, where it honestly always belonged. Fixes #17981 and #23602 for real this time.
(cherry picked from commit 0e7c66cb4c)
2021-12-17 00:23:33 +01:00
jackpoz f65edd1130 Core/MovementGenerator: Add more details to asserts
Include movespline in Unit::GetDebugInfo() and the Player owner in FlightPathMovementGenerator::DoEventIfAny() assert

(cherry picked from commit 560b7e3397)
2021-12-16 22:03:52 +01:00
ccrs ef6a5d3c3c Core/Unit: movement related corrections prior to getting Charmed
(cherry picked from commit 294a3a2789)
2021-12-15 23:42:06 +01:00
ccrs ff11e95071 Core/Unit: f869c49 followup
Movement Pause/Clear is already handled in Unit::SetCharmedBy and Unit::RemoveCharmedBy, respectively

TODO: missing PAUSE handling in RandomMovementGenerator
(cherry picked from commit 4fa3c04b72)
2021-12-14 22:19:13 +01:00
Wyrserth 24c07367f1 Core/Vehicle: prevent creature vehicles from following their old movement generator when a player enters them in some cases.
Closes #21731 and #22368.

(cherry picked from commit f869c4969e)
2021-12-14 22:19:01 +01:00
Shauren d249a2a98a Warning fixes 2021-12-14 22:15:04 +01:00
Wyrserth edf12fd6a1 Core/Conditions: allow spellclick conditions to properly work for aura apply/remove (#23527)
(cherry picked from commit 12e545f7e2)
2021-12-14 20:52:13 +01:00
ForesterDev 104ec7a81a Core/Unit: Implement more helper methods (#23555)
(cherry picked from commit c44fb37f74)
2021-12-14 20:42:32 +01:00
Treeston bba4696de7 Entities/Player: Clean up client control handling behavior around possession. Mind Control should no longer cause various weirdness. Closes #23539.
(cherry picked from commit f6f1c48aa5)
2021-12-13 23:44:13 +01:00
ForesterDev 27886c7f5d Core/Player: add helper methods GetNativeGender/SetNativeGender/SetGender (#23520)
* Core/Player: add helper methods GetNativeGender/SetNativeGender/SetGender and fix some cases, where we should get player gender, instead of modified by display gender

* fix merge

* Add virtual methods for Unit class

(cherry picked from commit b47bb59e2a)
2021-12-13 00:42:20 +01:00
ccrs 4e6c59dca7 Core/Unit: rename several getters to follow codestyle
uint8 GetLevel()
        uint8 GetLevelForTarget(WorldObject const* /*target*/)
        void SetLevel(uint8 lvl)
        uint8 GetRace()
        uint32 GetRaceMask()
        uint8 GetClass()
        uint32 GetClassMask()
        uint8 GetGender()

(cherry picked from commit 5c09ff51f7)
2021-12-13 00:42:20 +01:00
jackpoz 841630fcc3 Core/Misc: Fix static analysis issues reported by Coverity Scan
(cherry picked from commit de88691e25)
2021-12-13 00:42:18 +01:00
Wyrserth 09e849bb69 Core/Spell: allow damage from binary spells to go through elemental resistance's damage reduction. (#23479)
(cherry picked from commit efc999227d)
2021-12-13 00:42:17 +01:00
Aokromes 30cec73c61 Coding standards (#23514)
* Coding standards

* revert part

(cherry picked from commit fe744977c9)
2021-12-13 00:42:17 +01:00
Shauren 54f607641a Core/Spells: Moved SpellVisual functions from Unit to WorldObject 2021-12-12 19:34:00 +01:00
Treeston 38d7c1530a Combat/Threat: Split ThreatManager::NotifyDisengaged off from ThreatManager::ClearAllThreat. NotifyDisengaged signifies intent to clear the engagement flag, and should only be called from AI. Fixes #23490.
(cherry picked from commit 1158f267df)
2021-12-12 02:09:15 +01:00
Treeston f9b8fe686d Entities/Unit: Adjust an overzealous assert to not catch self references, and add the inverse assert too. 396f87c follow-up.
(cherry picked from commit aeed616c22)
2021-12-12 01:27:04 +01:00
Treeston d10554da14 Entities/Unit: Fix an issue where Unit pointers could be left dangling if a channeled Charm was interrupted by a control aura application. Closes #23440.
(cherry picked from commit f4b06fd0b7)
2021-12-12 01:27:04 +01:00
Treeston edc7583119 Entities/Unit: Cleanup all the direct accesses to m_unitMovedByMe. Refactor the field to be protected. Add assertions to catch dangling pointers.
(cherry picked from commit 396f87c30d)
2021-12-12 01:26:41 +01:00
Treeston dabdad3b47 Core/Misc: Rename Unit::AttackedTarget to Unit::AtTargetAttacked to match naming scheme for these notifiers
(cherry picked from commit 632a300dd2)
2021-12-12 00:33:18 +01:00
Treeston 35e55f1089 Core/Entities: Kick engagement logic upstairs to Unit (from ThreatManager), since all Units with AI need it (not just those with threat list). Fixes #17981.
(cherry picked from commit dbe3bbefe7)
2021-12-12 00:31:15 +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 c90f789eac)
2021-12-11 14:12:54 +01:00
Wyrserth 1edd93bc0c Core/Script: add script hook to allow overriding of a vehicle passenger's exit position (#23322)
* Core/Script: add script hook to allow overriding of a vehicle passenger's exit position.

* Allow to change orientation, and fix nopch.

* Keep original orientation, thanks jackpoz!

* Update Unit.cpp

Code cleanup

* Update Unit.cpp

(cherry picked from commit 88c6c61b95)
2021-12-08 23:51:07 +01:00
Shauren e2de5000ac Core/Movement: Defined movement force type enum 2021-12-08 19:02:02 +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 797fba98e9)
2021-12-07 00:02:03 +01:00
jackpoz 7fc359559f Core/Misc: Fix static analysis issues reported by Coverity
(cherry picked from commit a0bd68cf46)
2021-12-05 22:44:38 +01:00
Shauren 7e779a6f59 Core/Units: Send PlayHoverAnim state in CreateObject if enabled by Unit::SetPlayHoverAnim 2021-12-04 12:45:46 +01:00
Killyana 1ced6d2192 Remove Deprecated code
(cherry picked from commit fd166025c8)
2021-12-03 22:00:39 +01:00
ccrs 356358ee15 Core/Misc: standarize a couple logs
(cherry picked from commit aee26eb467)
2021-12-02 00:39:28 +01:00
jackpoz 57411da5b2 Core/Pet: Change assert to error log
Change assert added in 43dec9e4d0 to error log since charmed creatures lose their AI until next map update

(cherry picked from commit 70fcdc687d)
(cherry picked from commit f45ebe71b0)
2021-12-02 00:39:28 +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 f26f716714)
2021-12-02 00:39:20 +01:00
Killyana f7048afac1 Core: Remove wrong emotes played in combat
Ref #23152

(cherry picked from commit c52eb49f71)
2021-11-26 11:22:26 +01:00
jackpoz 43a41caafb Core/Misc: Fix GCC 8 warnings
(cherry picked from commit 1d04a3b216)
2021-11-24 23:40:15 +01:00
PolarCookie f7299dce97 Core/Spell: SpellAura Redux (#22794)
* typo and correction

* spell aura no longer shared between targets

_spellAura isolated

* SPELL_AURA_CONTROL_VEHICLE is not strictly single target spell

Steam Tank Control and Wyrmrest Commander

units can reseat themselves again

* Rename 9999_99_99_99_world.sql to 2019_03_08_00_world.sql

(cherry picked from commit ec3cb05d7f)
2021-11-24 20:35:19 +01:00
Gustavo 10c915dd34 Core/Units: Only update height in SetHover if unit is bellow HoverHeight (#23061)
(cherry picked from commit 2dfea54533)
2021-11-23 23:18:58 +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 43dec9e4d0)
2021-11-23 23:10:45 +01:00
Aokromes 2682bf0fca Core/Misc: Add categories to 3 logs
(cherry picked from commit 2d22c027fe)
2021-11-23 22:29:21 +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 518e6299ca

(cherry picked from commit 46c7446bd4)
2021-11-23 20:47:31 +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 518e6299ca)
2021-11-21 21:09:36 +01:00
ccrs a8ec1ba9bc Core/Unit: rename & cleanup GetCreatePowers
it hurted my eyes too much

(cherry picked from commit 954fd2639a)
2021-11-21 19:28:17 +01:00
Shauren de8e1a4820 Core/Units: Fixed crash with charm/possess
Closes #27168
Closes #27247
2021-11-21 18:49:55 +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 8f9654d817)
2021-11-21 15:36:57 +01:00
Meji 8614690e27 Core/BattlePets: Implemented battle pet name query packet (#27294)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
2021-11-20 19:06:14 +01:00
Seyden e4630c5354 Core/Movement: Temporarily disable "no state change" checks in Unit::SetFeatherFall and Unit::SetCanTurnWhileFalling
Co-authored-by: Shauren <shauren.trinity@gmail.com>
2021-11-20 15:51:02 +01:00
acidmanifesto d4d47b52e3 Core/Misc: Corrected function name in log message (#27288) 2021-11-19 20:07:07 +01:00
Shauren ba2586c92f Core/Spells: Fixed unapplying rockbiter weapon
Closes #22528

(cherry picked from commit f93a23adc5)
2021-11-18 22:41:57 +01:00
Shauren f3c1b27c26 Core/Units: Fixed crash happening when charm was removed by its own charmed AI during update
(cherry picked from commit c7445669e8)
2021-11-16 20:40:05 +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 9a924fb9d5)
2021-11-16 20:36:58 +01:00
Treeston 1015f30704 Core/AI: Add some checks to catch if the AI changes mid-update for players. Tag #22731 #22629.
(cherry picked from commit d8fee3c46b)
2021-11-15 22:20:17 +01:00
PolarCookie 1232f1d06e Core/Creatures: Changed creatures to become tagged by player doing any action that causes creature aggro (apart from distance) (#22759)
* This was introduced in patch 3.0.8

(cherry picked from commit f2df802c50)
2021-11-15 22:16:04 +01:00