Commit Graph

798 Commits

Author SHA1 Message Date
Shauren
e598cfe28d Core/SAI: Fixed silence logic in 1e8227eda7
(cherry picked from commit 668df7fd01)
2021-09-25 20:46:13 +02:00
Killyana
c0cb8fc1fe Core/SAI: Allow movements for creature using castflag 64 when silenced
Closes #20222

(cherry picked from commit 1e8227eda7)
2021-09-25 20:45:27 +02:00
Killyana
e7f93ca96d Core/SmartAI: Remove PauseMovement on AttackStart
Closes #21144

(cherry picked from commit e27a745c58)
2021-09-25 20:43:39 +02:00
Shauren
8a4e1119ac Core/Spells: Unify spell effect access api in both branches 2021-09-04 15:13:15 +02:00
Shauren
8cc418460f Core/Misc: Fix gcc warnings 2021-08-28 16:08:33 +02:00
ariel-
962f6d7988 Core/Spells: rework part 5: GameObject casting
Closes #21330
Closes #18885
Ref #18752

(cherry picked from commit 45c5e1b9d6)
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 98d6258efd)
2021-08-08 21:21:34 +02:00
Treeston
32997a5989 Core/SmartScripts: Rename SMART_ACTION_RESPAWN_TARGET -> SMART_ACTION_ENABLE_TEMP_GOBJ, since that's the only thing it still does in the dynspawn model. Adjust body accordingly to warn on misuse.
(cherry picked from commit 0850b5ff39)
2021-08-08 21:21:34 +02:00
Treeston
61baf6704c AI/SmartAI: New SMART_ACTION_RESPAWN_BY_SPAWNID (hi kilyana)
(cherry picked from commit 691c67f0be)
2021-08-08 21:21:34 +02:00
Killyana
4b6e76a5ef Core/SAI: Add an action_param3 to "summon gob" to control when the object will despawn
0 - For despawn when creature dies or time runs out
1 - For despawn after time
Closes #11601

(cherry picked from commit ca4f1e334a)
2021-06-22 12:51:28 +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 cfc77fd843)
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 264d4e1d30)
2021-06-20 22:10:08 +02:00
Treeston
bccd81e12a Entities/GO: GameObjects now support (delayed) despawning in a reasonable manner. Closes #21406.
(cherry picked from commit f071fa9e93)
2021-06-20 21:49:11 +02:00
Treeston
bd158f6c29 oops, now it builds (and a bonus refactor that annoyed me)
(cherry picked from commit 2cd5992f37)
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 6fb0bc1038)
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 482328bddf)
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 6e0df9fce1)
2021-06-19 01:55:18 +02:00
ariel-
d0f4310c44 Core/Entities: don't allow client control if player is still affected by any lose of control state
(cherry picked from commit e315e41d36)
2021-06-16 21:26:57 +02:00
ariel-
c77925da4a Core/Entities: killed Creature::SetInCombatWithZone and replaced with AI version
Closes #12108 (again)

(cherry picked from commit 7c9722a4ae)
2021-06-16 21:03:06 +02:00
ariel-
861cf261c5 Core/Formations: update codestyle and fix crash
Closes #21288

(cherry picked from commit 73cc613dc8)
2021-06-16 19:26:32 +02:00
Moein
172df39350 Core/SAI: Extended SMART_TARGET_VEHICLE_PASSENGER to allow specifying seat mask instead of single seat index (can now target all passengers) (#21245)
(cherry picked from commit 891bca934e)
2021-06-15 23:37:25 +02:00
Shauren
b9d63c2009 Core/Scripts: Remove deprecated overload of QuestReward without LootItemType argument 2021-05-16 21:56:06 +02:00
Treeston
34c7810fe5 Core: Combat/threat system rewrite (PR #19930)
- PvE combat is now always mutual. UNIT_FLAG_IN_COMBAT is backed by actual references to the units we're in combat with.
- PvP combat is now also tracked, and almost always mutual; spells like Vanish and Feign Death can break this rule. That means we can easily determine a list of players we're fighting.
- By extension, IsInCombatWith now has sensible behavior when invoked on nonplayers.
- Threat and combat systems are no longer the same.
  - They still have an enforced relationship (threat implies combat - clearing combat clears threat)...
  - ...but we can have combat without threat. A creature (with threat list) isn't considered to be engaged until it has an entry on its threat list...
  - ...which means we can now faithfully replicate retail engage behavior. Combat on projectile launch - engagement start on projectile impact. Yay for progress!
- AI method refactor, as already ported in 6113b9d - `JustEngagedWith`, `JustEnteredCombat` and `JustExitedCombat`.
- Vehicle threat is now properly pooled on the main vehicle body (fixes #16542).
- Various edge case bug fixes for threat redirects (Misdirection "cancelling" Vigilance and similar).
- Target re-selection is now significantly faster.
- Fixed a ton of other smaller edge case bugs, probably.

Closes #7951 and #19998.

(cherry picked from commit 532ab1c7f8)
2021-05-16 21:56:01 +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 9c1e675590)
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 6113b9dec2)
2021-04-16 20:22:13 +02:00
Keader
a7883380ce Core/AI: Making guid const& in SetGUID method (#21128)
(cherry picked from commit 465b43fabe)
2021-04-15 05:53:27 +02:00
Shauren
33b3ebcae6 Core/Objects: Pass privateObjectOwner guid directly to SummonCreature functions 2021-03-28 20:22:05 +02:00
Matan Shukry
c019d4f10c Core/SAI: Don't require BaseObject when creating conversation from smart scripts (#26209) 2021-03-07 11:17:04 +01:00
Matan Shukry
1b4c4d2164 Core/SAI: Implement quest source for SAI (#26170) 2021-03-06 14:20:39 +01:00
jackpoz
55931b0d92 Core/SmartScripts: Code cleanup
(cherry picked from commit f555a67bf8)
2021-03-04 18:17:08 +01:00
Killyana
77ee6dca45 Core/SAI: Add event_parm5 "player only" for EVENT_OOC_LOS and EVENT_IC_LOS
Closes #21497

(cherry picked from commit 5ad38c31b0)
2021-03-04 18:15:55 +01:00
Shauren
afae75841b Core/SAI: Rename SMART_ACTION_TALK_CONVERSATION to SMART_ACTION_CREATE_CONVERSATION 2021-02-27 11:42:44 +01:00
Matan Shukry
0996d60944 Core/SAI: Add SAI action to create a conversation (#26169) 2021-02-27 11:22:55 +01:00
Matan Shukry
e0278f0537 Core/SAI: Added new Flags argument for SMART_ACTION_SUMMON_CREATURE (#26055)
* Added personalSpawn for SMART_ACTION_SUMMON_CREATURE
* Added flags for smart action summon creature, including prefer unit and personal spawn. When preferUnit flag is chosen only the unit will be chosen, even if nullptr
2021-02-10 21:18:01 +01:00
jackpoz
852c9e9108 Core/Misc: Fix static analysis issues
(cherry picked from commit a80c95a1c7)
2021-02-06 21:41:51 +01:00
BAndysc
17676d4d41 Core/SAI: Add missing AreaTrigger to SmartScript::GetBaseObject 2021-02-06 19:20:07 +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 60a5535f64)
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 e10d7dd45c)
2021-01-29 19:23:53 +01:00
Kittnz
097335f2c4 Core/SAI: Add distance option for SMART_ACTION_SOUND & SMART_ACTION_RANDOM_SOUND (#20717)
(cherry picked from commit 37995ade29)
2021-01-13 22:04:52 +01:00
Wyreth
b902e739d4 Core/SAI: remove double calls to SMART_EVENT_RESPAWN for creatures and gameobjects (#20420)
(cherry picked from commit 637b5f922d)
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 21bd52cb99)
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 7dc97c0353)
2021-01-13 22:04:52 +01:00
Shauren
2e4609f6e1 Core/Chat: Send broadcast text id in sound packets to allow playing encrypted sound files 2020-12-27 22:43:36 +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
Treeston
06a1271a50 Core/Misc: random refactors
(cherry picked from commit 37dff2b7a1)
2020-08-23 17:47:41 +02:00
Treeston
27806eeac9 Core/Spawn: Move spawn group state management from sObjectMgr to the Map object, which makes it actually function as intended with instances. Woops.
(cherry picked from commit f279207d48)
2020-08-23 17:00:59 +02:00