Commit Graph
213 Commits
Author SHA1 Message Date
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
ccrs 844f969ed7 Core/AI: logs, codestyle & cosmetics standarization
(cherry picked from commit fdb71ce19e02b44323fbb9dfa5f07dae2a35f8ba)
2021-12-05 16:48:58 +01:00
ccrs dd11603150 Core/AI: variable naming standarization
plus minimum codestyle changes

(cherry picked from commit 179c7da1fc264b1444aa50632317e16dca02f78b)
2021-12-05 16:17:02 +01:00
ccrs 356358ee15 Core/Misc: standarize a couple logs
(cherry picked from commit aee26eb46727171593ef7cc1d2652a7847dc88fc)
2021-12-02 00:39:28 +01:00
Killyana e5eff88282 Core/SAI: Fix Move to position and Set run if used after a waypoint
Closes #22976

(cherry picked from commit 9ab05e2b6dee2008aac512e98bc477c4ed637cfc)
2021-11-24 22:16:02 +01:00
Killyana da1166db98 Core/SAI: Fix the respawn event for GameObjects (#23112)
Closes #22612

(cherry picked from commit 75a8639242c9d28deaa0565aba138d2e05b12db9)
2021-11-24 22:15:52 +01:00
Aokromes 2682bf0fca Core/Misc: Add categories to 3 logs
(cherry picked from commit 2d22c027fe0df505ddc63d4faaad032cddd5e258)
2021-11-23 22:29:21 +01:00
Shauren f2456ff319 Scripts/Areatriggers: Fixed all areatrigger scripts triggering both on enter and exit instead of only on enter 2021-11-10 00:01:50 +01:00
Treeston 34f9666f20 Core/Unit: Some charm fixes:
* Properly restore react state after possession expires. Closes #20769.
* Possessed creatures now don't override player control with random/waypoint motion
* SmartAI creatures now properly re-aggress charmer after charm expires

(cherry picked from commit da21ca80fc35a325df0fb0ef2f687a91121d42de)
2021-10-23 14:44:05 +02:00
Treeston e4e8c1c59c Core/AI: Clean up charm AI handling, we now have two unique_ptr instead of a crapton of booleans
(cherry picked from commit 042f5515e4f3e52b0d2e23d9b9e147041849ce12)
2021-10-22 23:47:51 +02:00
Seyden 8f097e4425 Core/Scripts: Implement script name reloading
* Authored by Seyden
* Co-authored by Naios
* We thank Shauren for your helpful feedback
2021-10-22 12:52:37 +02:00
Treeston 0c3690db91 Core/SmartAI: SetRun fix for SAI, because for some reason it has like 95% of escortai code duplicated??? shitshow zz
closes #21463

(cherry picked from commit f95a383293e32eeae514899c132e901174f4207e)
2021-10-22 00:41:41 +02:00
ccrs 426f9f2f92 Core/Movement: MotionMaster reimplementation (#21888)
Internal structure and handling changes, nothing behavioural (or thats the intention at least).

(cherry picked from commit 982643cd96790ffc54e7a3e507469649f3b074d2)
2021-09-28 00:15:13 +02:00
Killyana e7f93ca96d Core/SmartAI: Remove PauseMovement on AttackStart
Closes #21144

(cherry picked from commit e27a745c582f1c45a5d8a1b72c1d61fe3cecf2f1)
2021-09-25 20:43:39 +02:00
ariel- 962f6d7988 Core/Spells: rework part 5: GameObject casting
Closes #21330
Closes #18885
Ref #18752

(cherry picked from commit 45c5e1b9d63796d168339a44f63418f220cf2403)
2021-08-28 15:59:11 +02:00
ariel- a1a00f823e Core/Entities: kill unused return value from Unit::HandleSpellClick
- AI hook will now receive the result by copy, as modifying it had no effect
- Some renaming: result->spellClickHandled, clickPair is actually clickBounds, the clickPair is the pair <creatureID, SpellClickInfo>

(cherry picked from commit 98d6258efdc07b53808ba6177e5427c65163bc0d)
2021-08-08 21:21:34 +02:00
Treeston 37298ca99c Scripts/SmartAI: SetData now has an invoker (if the setting is done by something using SmartAI).
Also, some refactors. SMARTAI IS SUCH A FUCKING CLUSTERFUCK I SWEAR.

(cherry picked from commit cfc77fd84355d28737f3f85f2ba318be5caacdea)
2021-06-21 00:06:41 +02:00
Treeston 168be492f5 Entities/GO: Add forceRespawnTimer support to DespawnOrUnsummon. Use it in SAI.
(cherry picked from commit 264d4e1d30debcf6feacee3d29982875672a7bbe)
2021-06-20 22:10:08 +02:00
Treeston bd158f6c29 oops, now it builds (and a bonus refactor that annoyed me)
(cherry picked from commit 2cd5992f37fe386786ddd906cd4dd691125ad2b6)
2021-06-20 21:42:35 +02:00
Treeston 1f26122528 Scripts/SmartAI: Forward invoker to invoked action list actions. Also JustAppeared -> InitializeAI.
(cherry picked from commit 6fb0bc10387b73836cea9a3c0eaaafcf58794b7d)
2021-06-20 21:42:35 +02:00
Treeston 06b5b8d8b7 Scripts/SmartAI: SMART_TARGET_INVOKER cleanup step 1. The core will now log errors on start-up if SMART_TARGET_INVOKER abuse is found, but will continue to load the scripts as deprecated for now.
Note that a lot of these scripts may either not currently work, not work reliably, or may be prone to breaking unexpectedly when core internals change. SMART_TARGET_INVOKER is undefined behavior on any event that doesn't directly specify its invoker.

(We are considering options for allowing INVOKER to make sense in timed action lists in a reliable fashion, so they are exempted at this time.)

(cherry picked from commit 482328bddf1c5fcd367268525d2f904793239bc9)
2021-06-20 21:42:33 +02:00
Treeston 7695784fd2 AI/SmartAI: Remove a silly incorrect piece of code that was breaking react state swaps on SAI creatures. Fixes #21353.
(cherry picked from commit 6e0df9fce1e1f4de3ffa97bf9ef711f13f2b9a55)
2021-06-19 01:55:18 +02:00
ariel- 861cf261c5 Core/Formations: update codestyle and fix crash
Closes #21288

(cherry picked from commit 73cc613dc86d7d72d78f22affe2faba6786bccc5)
2021-06-16 19:26:32 +02:00
Shauren b9d63c2009 Core/Scripts: Remove deprecated overload of QuestReward without LootItemType argument 2021-05-16 21:56:06 +02:00
Shauren 91b91b502f Core/Quests: Quest improvements
* Add quest log slot argument to functions dealing with objective progress
* Implemented QUEST_OBJECTIVE_FLAG_SEQUENCED (prevent progressing hidden objectives)
2021-05-09 20:21:32 +02:00
Shauren dd8aed421a Core/Quests: Drop unneeded QuestSpecialFlags 2021-05-09 16:01:34 +02:00
Treeston e0afca513a Core/AI: UnitAI.h trimming part two. WaypointX methods kicked upstairs to CreatureAI.h.
(cherry picked from commit 9c1e675590c1fa61a80b3f2c856aaf97c549f202)
2021-04-27 23:51:40 +02:00
Matan Shukry 8b0de23d0e Core/SAI: Don't clear stored pathid if it changed after processing waypoint events (#26334) 2021-04-26 21:39:22 +02:00
Treeston bce43de7f3 Core/AI: Some more refactoring prep for #19930. CreatureAI::EnterCombat is now called CreatureAI::JustEngagedWith. There's also two new methods on UnitAI, though they're never invoked right now.
(cherry picked from commit 6113b9dec2e0081c36c36c2974a28ed0693bc601)
2021-04-16 20:22:13 +02:00
Keader a7883380ce Core/AI: Making guid const& in SetGUID method (#21128)
(cherry picked from commit 465b43fabef1727432ddda27f04b882b29fd2c7f)
2021-04-15 05:53:27 +02:00
Matan Shukry 1b4c4d2164 Core/SAI: Implement quest source for SAI (#26170) 2021-03-06 14:20:39 +01:00
Shauren 875fd4107f Core/SAI: Added SAI support for new areatriggers 2021-02-05 18:12:55 +01:00
ccrs 3e5a955fc8 Core/AI: rearrange SAI private methods
(cherry picked from commit 60a5535f64e4c0301c338f5c7a5871c59e2ac218)
2021-01-29 19:23:53 +01:00
ccrs bf12bae467 Core/Misc: waypoint movement
- Creature: update current waypoint to store nodeId and pathId
- MotionMaster: change variable type on GetMotionSlotType and GetMotionSlot to keep consistency and prevent errors (ASSERT is now no longer needed)
- UnitAI: add new waypoint hooks WaypointPathStarted and WaypointPathEnded
- SAI: handle WAYPOINT related events if creature is no escorting
* SMART_EVENT_WAYPOINT_RESUMED still not implemented for no escorting

TODO: the new hooks can save, now duplicated, logic on EscortAI and SAI

closes #20777
updates #20310
updates 21bd52cb99

(cherry picked from commit e10d7dd45cfc073c791cd5e5f3f964d14b37df3d)
2021-01-29 19:23:53 +01:00
Wyreth b902e739d4 Core/SAI: remove double calls to SMART_EVENT_RESPAWN for creatures and gameobjects (#20420)
(cherry picked from commit 637b5f922d5849fa5b01d8ed28a826eddd3dc2cd)
2021-01-13 22:04:52 +01:00
Wyreth 56dca10f1b Core/SAI: allow to pause/resume waypoint for non-escorting NPCs (#20684)
(cherry picked from commit 21bd52cb995bb7ba6e0bee33317857a285ffd14c)
2021-01-13 22:04:52 +01:00
jackpoz d8804418ce Core/SAI: Fix static analysis issue
Initialize uninitialized value, move class field from public to private.

(cherry picked from commit 7dc97c035350f9505a9fba0b8ec2d2037044e586)
2021-01-13 22:04:52 +01:00
Shauren b231903932 Core/Misc: Port all the refactors sneaked in master to 3.3.5 include cleanup port 2020-09-04 13:38:24 +02:00
ccrs 138edeb34e Core/AI: add missing checks on AssistPlayerInCombatAgainst
(cherry picked from commit ee5cbf28bc003ecc52347fdd612e27432bd87c24)
2020-08-23 00:49:53 +02:00
ccrs e10018029d Core/SmatAI: correct MoveInLineOfSight
mistake introduced in 15f2706acaa that was masqueraded by other checks in combat start, till recent related commits

(cherry picked from commit d117a0e4d4aa29960c04d09ba90d2d0798a5c1b6)
2020-08-23 00:49:36 +02:00
ccrs 0a133e77d6 Core/Movement: 7fff83d6752 followup
remove home position set from creature PauseMovement, and use it when necessary
change log level on DelayedDelete

(cherry picked from commit cd4775420a4894012616d54467eb3827430245b5)
2020-08-23 00:48:46 +02:00
ccrs 97585597f0 Core/Movement: waypoint movement (#20121)
Following the work done in #19361 this is the cleanup and improvement of the related logic of waypoint management.

Ref 28050f3 #18020
(taking the good parts and ignoring the incomplete work)

(cherry picked from commit 7fff83d67526efff63867d41b9e036a19a9287b3)
2020-08-23 00:45:46 +02:00
Treeston 129dd7c909 Core/Scripts: dynamic_spawning follow-up, I had forgotten JustRespawned existed.
- Rename JustRespawned to JustAppeared, which better matches its behavior anyway.
- Properly invoke JustAppeared for new (re-)spawns - fixes #20111.
- Fix Thaddius script to work with dynamic_spawning (mostly unrelated to the above) - Feugen/Stalagg should really be a summon group, but I don't have time to fix that right now.
- Fix default value for DynamicEscortNPC to match worldserver.conf.dist.

(cherry picked from commit 184c45cfe0fbe4f3e4fb701f0f99994df98bdc8a)
2020-08-22 20:10:42 +02:00
Treeston 8be23fcbbd [3.3.5] Combat/Threat rewrite - prep & refactor (#19966)
* Combat/Threat rewrite (PR #19930) prep work. Mostly refactors, and a compatibility layer on ThreatManager/HostileReference that allows scripts to be changed already.

(cherry picked from commit e2a1ccd118d129b96e09ff1a15ed0adb1d4a3897)
2020-08-13 22:46:44 +02:00
ariel- 5903a10a83 Core/AI: segregate GameObject ReportUse from normal Use (lock open/normal click)
Closes #19819

(cherry picked from commit 2335b9de1a46a409c714a1dc89cbd0565545e70e)
2020-07-16 21:47:28 +02:00
ariel- 960bfcabc3 Core/SAI: properly validate stored targets when using SmartTrigger and fix a related crash
(cherry picked from commit 866074b6899d87df6c835b936524d9f76ba78949)
2020-07-16 21:47:27 +02:00
ariel- 259bde5914 Core/SAI: Change SmartScript::GetTargets to return an ObjectList instead of a ObjectList*
Applied the same treatment to GetWorldObjectsInDist

Honestly no idea why the original idea insisted so much
on using pointers. No more missing null checks or deletes.

SmartAI's "ObjectList" is now a std::vector instead of a std::list
because no where it was being used as an actual list.

Original idea by DDuarte :P

(cherry picked from commit a97439e8d63c0a78bda8a6ed4801f122385936e3)
2020-07-16 20:59:25 +02:00
ariel- 1881088744 Core/AI: Factory functions cleanup
- Get rid of fugly void pointers
- Streamlined AI selection code, using Permissible as it should've been instead of harcoded checks on the selector code
- Moved IdleMovementGenerator singleton to factory code

(cherry picked from commit ce3787f190d28c1e981598eef2cd24c622a2cbae)
2020-06-14 23:49:05 +02:00
ariel- 444754e65a Core/SmartAI: allow SMART_ACTION_SEND_GOSSIP_MENU to override default gossip
Closes #19769

(cherry picked from commit f2b0819e5368b2b8e8865b13555c140e4f9a59a7)
2020-06-14 23:49:04 +02:00
ariel- 6604849716 Core/Scripts: unified scripted gossip/quest api
- Changed self-accessor on GameObjectAI to "me", like UnitAI
- Moved all related functions to AI, now Unit and GameObject have the same function names with identical behaviour
- Remove "OnUpdate" from CreatureScript/GameObjectScript, was never used and we already have AI Update method
- Quest methods no longer return a bool, the return value was used to call the AI version if the ScriptMgr one returned false
- Implemented GameObjectAI::Destroyed hook (was never called), implemented Damaged method
- Rename OnStateChanged to OnLootStateChanged to reflect when it's really called, and created a new hook OnStateChanged that only gets called on GOState change
- Since the functions are now only getting called from AI, made GetAI methods full virtual. (CanSpawn method is anyways going to be used on creatures with AI)

(cherry picked from commit f913f3bb8977c127d200d5d4a608ab434b21bbcd)
2020-05-03 03:04:32 +02:00