Commit Graph
486 Commits
Author SHA1 Message Date
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
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
MejiandShauren 198d18bef5 Core/SAI: Fixed crash when using SMART_TARGET_CLOSEST_* in areatrigger smart script (#27336)
Co-authored-by: Shauren <[email protected]>
2021-12-04 20:40:06 +01:00
Aokromes dad95d16b2 Core/SmartScripts: Implement SMART_ACTION_PLAY_CINEMATIC
By Malcrom

(cherry picked from commit 63aa5d1e3559f580551544b71fb7dd63d6b54b60)
2021-11-30 23:10:57 +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
ModoX 437fb2aaba Core/CreatureTexts: Added new field SoundPlayType to enable usage of ObjectSounds within creature_text (#27136)
* Also adjusted Vigilant Quoram texts to use ObjectSounds
2021-10-23 13:10:32 +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
Treeston f6ceb4bf0c Scripts/SmartScripts: _SET_IN_COMBAT_WITH_ZONE and _CALL_FOR_HELP no longer use a target. Because that feature made no sense and was unused.
(cherry picked from commit 5706d49e49733f70a6ea2304b7e3671c16ca0c13)
2021-10-22 23:20:36 +02:00
Treeston 0aee79dfb8 AI/SmartScripts: Replace SMART_ACTION_INVOKER_CAST with SMART_ACTION_SELF_CAST in action 85. SMART_ACTION_INVOKER_CAST moves to 134.
(cherry picked from commit 0df3cb5bcc8097070b1f215032d3914d6a577f01)
2021-10-17 22:07:54 +02:00
Shauren d2dcce09d7 Core/SAI: Fixed SMART_ACTION_EQUIP to properly set values in all slots (cherry-pick error) 2021-10-10 14:22:18 +02:00
Shauren 3fe9b0a296 Core/Conversations: Replace _participants with generic personal object implementation 2021-10-09 13:30:47 +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
Shauren 334b02e1da Core/SAI: Fixed crashes when SAI targets pets that use sai if not tamed
Closes #21870

(cherry picked from commit beb333738db0d493bf95994eb5557e174e5dd3a6)
2021-09-26 12:43:18 +02:00
Shauren e598cfe28d Core/SAI: Fixed silence logic in 1e8227eda7f9c6a989fe6c928c857d76491e008c
(cherry picked from commit 668df7fd01a2b3bdac1ea4600ed17df03e51bd60)
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 1e8227eda7f9c6a989fe6c928c857d76491e008c)
2021-09-25 20:45:27 +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 0850b5ff39b187d8a1adb032dfd7900d4474cfaf)
2021-08-08 21:21:34 +02:00
Treeston 61baf6704c AI/SmartAI: New SMART_ACTION_RESPAWN_BY_SPAWNID (hi kilyana)
(cherry picked from commit 691c67f0be09095a34421043baf245fdf28e5d04)
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 ca4f1e334a98cbd810168b24714c46201079fc5a)
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 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 bccd81e12a Entities/GO: GameObjects now support (delayed) despawning in a reasonable manner. Closes #21406.
(cherry picked from commit f071fa9e931533c28e6b9d8b0e38ed8878ce2b45)
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 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
ariel- d0f4310c44 Core/Entities: don't allow client control if player is still affected by any lose of control state
(cherry picked from commit e315e41d36061fc88dfa09bfa0da1fbc0c00826f)
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 7c9722a4ae08b5f283f6a085a411e37604a7da9f)
2021-06-16 21:03:06 +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 891bca934e1522fe33b00e27eef5d4f07bb83fa8)
2021-06-15 23:37:25 +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 532ab1c7f8653d1a2e48aa1f1f8a9ba1041d4bb7)
2021-05-16 21:56:01 +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 f555a67bf850e1a9659c89551d7bb69cc812f161)
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 5ad38c31b0ed633555f281318684e57ea5d6dd73)
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 a80c95a1c788932696fb43e69b9012a751431bac)
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 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
Kittnz 097335f2c4 Core/SAI: Add distance option for SMART_ACTION_SOUND & SMART_ACTION_RANDOM_SOUND (#20717)
(cherry picked from commit 37995ade2991ed27845728eb6a6dd95f3a490849)
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 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 37dff2b7a1850f9f751c472e277277305a660229)
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 f279207d482b886fc8b049e94b46653325ec4d2d)
2020-08-23 17:00:59 +02:00
ccrs 9a5e2b80b3 Core/Creature: regenerate health
There are three possible scenarios regarding regenerating health
- db lock and curhealth set to > 0
- db lock and curhealth set to 0
- dynamic lock (set in scripts and such) overriding db lock

(cherry picked from commit 91c0d49c188977c3d797f5749b1204612ce50195)
2020-08-23 15:56:21 +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
r00ty-tc 03b125e6d1 Dynamic Creature/Go spawning:
- True blizzlike creature spawn/respawn behavior - new creature = new object
 - Toggleable spawn groups (with C++/SAI/command options to use them)
 - Custom feature: dynamic spawn rate scaling. Accelerates respawn rate based on players in the zone.
 - Backward compatibility mode (set via group and for summons)
   to support creatures/gos that currently don't work well with this
   (this should be removed once the exceptions are fixed)

Fixes and closes #2858
Tags #8661 as fixable.
Fixes and closes #13787
Fixes #15222.

(cherry picked from commit 59db2eeea0a35028779fd76372ae06cc98c8086f)
2020-08-22 12:59:57 +02:00