Commit Graph
504 Commits
Author SHA1 Message Date
ModoX bc4e285c21 Core/SAI: added new action type SMART_ACTION_ADD_TO_STORED_TARGET_LIST (#27029) 2021-12-25 16:00:34 +01:00
Shauren e8d1f37ee0 Core/Maps: Citizens of Dalaran! Raise your eyes to the skies and observe! Any non-map-default light can now be overriden!
Closes #24250

(cherry picked from commit e10313b380c84dafde462bdb116827f2b8be1851)
2021-12-22 21:51:33 +01:00
Ujp8LfXBJ6wCPR ee5384a15d Modernize codebase with Clang-Tidy range based loops (#24165)
Manual expansion of auto types into "typed types"

(cherry picked from commit a933ba60151f478c7bae23dddbba315a448ffe3e)
2021-12-22 16:42:54 +01:00
ForesterDev 5e178b30fa Core/DynamicInfo: rename some parameters according packet definitions (#24192)
(cherry picked from commit 5cfce94619cc02cc04bb25ccdd2e1b98e53d9160)
2021-12-22 14:54:59 +01:00
ForesterDev 1d08423725 Core/SmartAI: implement SMART_ACTION_OVERRIDE_LIGHT and SMART_ACTION_OVERRIDE_WEATHER (#24146)
* Core\SmartAI: implement SMART_ACTION_OVERRIDE_LIGHT and SMART_ACTION_OVERRIDE_WEATHER

* Change the invoker of action to any worldobject

* Revert "Change the invoker of action to any worldobject"

This reverts commit 2e15f7258553b7057c3e8f67c54efc77fb6d75b8.

* Add dbc-validations for new actions

* Use GetBaseObject() instead of Creature* for new actions. Add debug-logging

(cherry picked from commit c65ba35269a68c94c3e423f78fa1585f9d89dd04)
2021-12-22 01:15:52 +01:00
Ovahlord a90b9abbf0 Core/SAI: SMART_ACTION_PAUSE_MOVEMENT
Closes #22346

(cherry picked from commit 6f31784979569c1a9ae3ee3f70416f5e11d3e7f0)
2021-12-21 23:55:34 +01:00
Regigicas aa81d8979f Core/SAI: Fix SMART_ACTION_SET_MOVEMENT_SPEED behavior (#24059)
(cherry picked from commit 13696204368ed933695bc0b738905f545dcbc836)
2021-12-20 21:25:33 +01:00
ccrs e94dca132b Core/SmartAI: add missing movement generator type check on SmartAI::SetCombatMove
ref #21562

(cherry picked from commit 0e3e4353a1824dd6e40ca10a01c4465aa1b1fbad)
2021-12-16 22:10:54 +01:00
Treeston eee950cdd7 Core/Misc: Various dynspawn cleanup and refactors split off from pooling rewrite:
- Map::RemoveRespawnTime(SpawnObjectType, LowType, doRespawn) split into Map::Respawn and Map::RemoveRespawnTime, without the extra boolean
- Map::RemoveRespawnTime(RespawnInfo*) merged into Map::DeleteRespawnInfo(RespawnInfo*) and is now private
- Map::DeleteRespawnInfo(void) renamed to Map::UnloadAllRespawnInfos to properly describe what it does
- Map::ProcessRespawns now actually saves the delayed respawn time to DB if the respawn was delayed
- Map::AddRespawnInfo now takes const reference, and returns success as a boolean
- Map::AddRespawnInfo no longer offers an unused "replace" parameter
- Map::DeleteRespawnInfo no longer offers a variety of unused private overloads
- Map::SaveRespawnTime no longer offers a tantalizing writeDB parameter. Parameter is now called "startup" to properly describe what it does.
- Map::SaveRespawnInfoDB now takes RespawnInfo reference instead of all the various fields. Still public because compatibility mode. QQ.
- Map::GetWorldObjectBySpawnId sanitized
- Map::GetXRespawnTime methods sanitized to all go through Map::GetRespawnTime

(cherry picked from commit d60082ae866d77a12a9e6d09dfce27fc1cb5df90)
2021-12-16 01:33:09 +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 5c09ff51f7015b775def8d5cc1f678eaef37200f)
2021-12-13 00:42:20 +01:00
Wyrserth d197a7ce9b Core/SAI: add param3 to SMART_ACTION_CALL_TIMED_ACTIONLIST to allow it to override a currently running actionlist.
(cherry picked from commit eeba12778b330f799eab1530da14bcd8a01b8269)
2021-12-13 00:42:17 +01:00
Wyrserth 62f5d9b46b Core/SAI: do not pass old creatureData to UpdateEntry() and keep current health when changing a NPC's entry. (#23493)
(cherry picked from commit 8967cc96df4c1c5c7465e9fd1fa66400f3e992b3)
2021-12-13 00:42:17 +01:00
Wyrserth e8c1adcf8f Core/SAI: silence wrong SAI error when using SMART_ACTION_SET_DATA on a creature using CreatureAI.
This behavior is fully allowed and should not report any kind of error.

(cherry picked from commit c95531595e666c64829499d2bc920cf5b848bbe2)
2021-12-13 00:42:16 +01:00
Wyrserth 7745e3f943 Core/SAI: add cooldownMin (event_param2) and cooldownMax (event_param3) to SMART_EVENT_ACCEPTED_QUEST and SMART_EVENT_REWARD_QUEST. (#23422)
(cherry picked from commit 50be697e1f3a56760e593b15bfbd576f4d370dcf)
2021-12-11 14:14:10 +01:00
Wyrserth e846d4c3ef Core/SAI: don't allow to start a new SAI actionlist while the entity is already running one. (#23421)
(cherry picked from commit 2b1cde25604b6400ac327801d8e1649e30688f5a)
2021-12-11 14:13:11 +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
Wyrserth d037c6b086 Core/SAI: add action_param3 to SMART_ACTION_REMOVEAURASFROMSPELL to allow it to remove only auras from spells that were cast by the entity itself. (#23345)
(cherry picked from commit d365dd915715d4608ae69fa54f094ab65f02e984)
2021-12-10 21:12:25 +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 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