Commit Graph

941 Commits

Author SHA1 Message Date
Antonio Martín Berti
c6802e272b Core/SAI: Removed invalid eventId restriction on SMART_EVENT_ACTION_DONE (#27972) 2022-05-26 11:54:24 +02:00
Shauren
51299ab886 Core/SAI: Corrected wrong useSaiTargetAsGameEventSource logic in previous commit 2022-04-24 16:21:29 +02:00
Shauren
9d0187dd56 Core/SAI: Implemented new action SMART_ACTION_TRIGGER_GAME_EVENT 2022-04-24 15:02:40 +02:00
Shauren
b8246d1ba7 Core/SAI: Support gameobject targets for SMART_ACTION_PLAY_ANIMKIT 2022-04-24 14:35:38 +02:00
Shauren
98e848436d Core/Misc: Apply various cosmetic changes that were made to 3.3.5 branch when porting master branch code there 2022-04-01 20:36:30 +02:00
Shauren
b47185cabf Core/Misc: Rename AddXXXFlag updatefield functions to SetXXXFlag 2022-03-27 18:14:47 +02:00
Shauren
4eba978670 Core/Misc: Rename SetXXXFlags updatefield functions to ReplaceAllXXXFlags 2022-03-26 18:59:44 +01:00
offl
050f55b62f Core/AI: OnSpellCast, OnSpellFailed, OnSpellStart hooks (#27704)
(cherry picked from commit 3dca705acc)
2022-03-26 15:15:46 +01:00
offl
8b7effa4cf Core/SAI: Remove SMART_ACTION_ADD_AURA & actions to change object flags (#27571)
(cherry picked from commit 5ba93a95de)
2022-03-24 23:52:32 +01:00
offl
52bb230e4c Core/SAI: Use GetBaseObject as second param of SMART_ACTION_ACTIVATE_GAMEOBJECT & reorder GameObjectActions (#27461)
(cherry picked from commit 87cb0a4212)
2022-03-24 21:55:46 +01:00
offl
9ea8cdb457 Core/SAI: Remove SMART_ACTION_SEND_GO_CUSTOM_ANIM, make SMART_ACTION_ADD_AURA & SMART_ACTION_SET_GO_FLAG deprecated (#27452)
(cherry picked from commit 7709837539)
2022-03-24 21:48:47 +01:00
offl
3cfca16359 DB/SAI: Replace SMART_ACTION_SEND_GO_CUSTOM_ANIM with GameObjectActions
(cherry picked from commit 8516984ffe)
2022-03-24 00:08:45 +01:00
jackpoz
ccf8cf3bbf Core/SAI: Fix error message
Fix the error message about valid range values for SMART_ACTION_ACTIVATE_GAMEOBJECT

(cherry picked from commit 5b9acbded1)
2022-03-22 00:16:03 +01:00
offl
e27724b362 Core/SAI: Remove deprecated events and actions (#27258)
(cherry picked from commit c508203895)
2022-03-21 23:26:47 +01:00
offl
ebcd45b7e1 Core/SAI: Remove reactState param from SMART_ACTION_WP_START (#27255)
Ref #26728

(cherry picked from commit 04909bada8)
2022-03-21 23:02:31 +01:00
Giacomo Pozzoni
791b759332 Core/SAI: Add SMART_ACTION_ACTIVATE_GAMEOBJECT action (#27216)
Closes #27196

(cherry picked from commit 0817be8f76)
2022-03-21 22:59:21 +01:00
offl
6ac4e9dd4a Core/SAI: Make 'no, thanks' actions deprecated
Deprecated events and actions will be removed after 2 weeks

(cherry picked from commit ab3bb36a46)
2022-03-20 16:39:53 +01:00
offl
0ad6258d4b Core/SAI: Make SMART_EVENT_WAYPOINT_START & SMART_EVENT_CHARMED_TARGET deprecated
Deprecated events and actions will be removed after 2 weeks

(cherry picked from commit 9e78329c8b)
2022-03-20 00:47:12 +01:00
offl
2beb606cdf DB/SAI: Make SMART_EVENT_EVENT_PHASE_CHANGE deprecated; avoid AddAura, re-handle equipment in few scripts
Deprecated events and actions will be removed after 2 weeks

Ref 1d1e090fe9 0e1835ee78

(cherry picked from commit 1053345692)
2022-03-20 00:45:30 +01:00
offl
29190e5642 Core/SAI: Remove deprecated events and actions (#27039)
(cherry picked from commit 887605d945)
2022-03-20 00:13:00 +01:00
offl
e80777cb39 Core/SAI: Split set/remove unit_flags actions (#26954)
(cherry picked from commit 0a2fca1aed)
2022-03-18 00:04:03 +01:00
offl
f55e86d907 Core/SAI: Remove possibility to set/remove unit_flags2
So far I see that only Cannot Turn flag can be changed by scripts and action to change it didn't existed in 3xx. If someone will need to change that flag, it should be implemented by action which will change only that flag and not any flag of that type.

(cherry picked from commit c8061d8ba6)
2022-03-15 23:59:35 +01:00
Giacomo Pozzoni
318e0e2406 Handle deprecated SAI actions and events (#26846)
* Core/SAI: Show a clear error for no longer supported SAI actions

* Core/SAI: Show a warning for deprecated SAI events, still loading them.

Disable log "sql.sql.deprecation" in config if you want to ignore the warning

(cherry picked from commit 3af4d17188)
2022-03-14 00:09:26 +01:00
Giacomo Pozzoni
a19c71a770 Core/SAI: Change error to warning for unused parameters (#26848)
Change error to warning for unused parameters and load the scripts instead of skipping them

(cherry picked from commit cb764a932d)
2022-03-13 23:43:28 +01:00
offl
7d9088e9cf Core/SAI: Remove SMART_ACTION_INSTALL_AI_TEMPLATE (#26797)
(cherry picked from commit ff8663ca15)
2022-03-12 16:19:47 +01:00
Giacomo Pozzoni
71c2f0af46 Core/AI: Add DamageEffectType and SpellInfo parameters to UnitAI::DamageTaken (#26787)
* Core/AI: Add DamageEffectType and SpellInfo parameters to UnitAI::DamageTaken

* Update scripts

(cherry picked from commit 0800ab20a8)
2022-03-12 14:45:04 +01:00
offl
842eb3bdd7 Core/SAI: Remove SMART_ACTION_SET_DYNAMIC_FLAG (#26783)
(cherry picked from commit b3449158b1)
2022-03-12 01:20:06 +01:00
jackpoz
fc3e26fdfe Core/SAI: Temporarily allow SMART_ACTION_WP_START to specify parameter value 3 for reactState
(cherry picked from commit 60379cf2c1)
2022-03-11 19:03:36 +01:00
Giacomo Pozzoni
c9e685bd9a Core/SAI: Warn when an unused parameter is set in the database (#26628)
* Core/SAI: Warn when an unused parameter is set in the database

* Warn when an unused parameter is set in the database as all unused parameters are supposed to be set to 0.

* Remove unused struct from union.

* Add a new struct simpleTalk for SMART_ACTION_SIMPLE_TALK instead of reusing only some fields of struct talk from SMART_ACTION_TALK

* Add addAura and flag structs to be used instead of generic ones to match the parameters used by actions

* Add randRangeTimedActionList struct to be used instead of generic ones to match the parameters used by actions.

* Remove unused action structs.

(cherry picked from commit aa7279df09)
2022-03-11 18:35:58 +01:00
Giacomo Pozzoni
a85e77b47a Core/SAI: Add a warning when a boolean value is outside of [0,1] range (#26608)
* Core/SAI: Add a warning when a boolean value is outside of [0,1] range

*  Replace boolean fields in SAI with SAIBool (from uint32)

(cherry picked from commit 84c8d21ad3)
2022-03-11 13:30:59 +01:00
jackpoz
40416d62f3 Core/SAI: Allow SMART_ACTION_SUMMON_CREATURE to summon more than 1 creature
Add 6th parameter "count" to SMART_ACTION_SUMMON_CREATURE action to summon more than 1 creature. For backward compatibility, a value of 0 will be treated as 1.

(cherry picked from commit 5628ca7f7c)
2022-03-11 10:43:08 +01:00
Giacomo Pozzoni
76c470fb32 Core/SAI: Add support to friendly+hostile to SMART_EVENT_OOC_LOS and SMART_EVENT_IC_LOS (#26579)
Change SMART_EVENT_OOC_LOS and SMART_EVENT_IC_LOS first parameter to have 3 values:
- 0 : Hostile
- 1 : Not hostile (not that Friendly and Not hostile have different meanings)
- 2 : Any, as in both Hostile and Not hostile

Close #24789

* Add validation on startup for allowed values.
Code cleanup.

* Fix errors

(cherry picked from commit 9e7cdb02d2)
2022-03-11 01:04:48 +01:00
jackpoz
67541c58ba Core/SAI: Fix typo
(cherry picked from commit 483f24c5ed)
2022-03-10 23:57:14 +01:00
HelloKitty
a67bb1f575 Core/Map: Added Map::SetZoneOverrideLight std::chrono overload (#26486)
* Core/Map: Added Map::SetZoneOverrideLight std::chrono overload

* Scripts: Replace Map::SetZoneOverrideLight usages with new std::chrono overload

* Core/Map: Remove non-chrono Map::SetZoneOverrideLight overload

(cherry picked from commit e33c4b8f7f)
2022-03-09 14:56:04 +01:00
robinsch
f7956ffd1e Core/SAI: Prevent loading invalid smart_scripts entry (#26508)
(cherry picked from commit 8c0e6e9ee4)
2022-03-09 14:20:25 +01:00
Engilas
8a4d731d55 Core/SmartAI: AI change on charmed (#26065)
* Fix AI refresh on charmed

* Remove unnecessary refresh

* Check SMART_EVENT_FLAG_WHILE_CHARMED flag

(cherry picked from commit f6e52f6b3d)
2022-03-06 21:40:42 +01:00
Giacomo Pozzoni
a4a3e2e759 Core/Creature: Allow to skip Rate.Corpse.Decay.Looted when calling SetCorpseDelay() (#25989)
Add a second parameter to SetCorpseDelay() that specifies if Rate.Corpse.Decay.Looted setting should be ignored, false by default (aka don't ignore by default).
Add a second parameter to SMART_ACTION_SET_CORPSE_DELAY to specify if Rate.Corpse.Decay.Looted should be included, false by default (aka ignore by default).

(cherry picked from commit d5fc86af8b)
2022-03-06 18:59:38 +01:00
Giacomo Pozzoni
4c30b2a182 Core/SAI: Add new action SMART_ACTION_SET_HEALTH_PCT (#25932)
* Core/SAI: Add new action SMART_ACTION_SET_HEALTH_PCT

Add new action SMART_ACTION_SET_HEALTH_PCT (142) with one single parameter "percent" to set the Unit health.
Close #25317

* Do not allow 0%

(cherry picked from commit 7d6f7e4d19)
2022-03-06 01:43:57 +01:00
Kargatum
373ed8f46b Core: whitespace cleanup, reduce double blank line to single (#25795)
* Core/Misc: fix double empty line

* worldserver.conf

(cherry picked from commit a32b6b8ac4)
2022-03-05 20:07:57 +01:00
Giacomo Pozzoni
da0d9ee283 Core/SAI: Fix SMART_EVENT_FLAG_NOT_REPEATABLE flag being ignored when specifying a chance (and other SMART_ACTION_CAST fixes) (#25778)
* Core/SAI: Fix SMART_EVENT_FLAG_NOT_REPEATABLE flag being ignored when specifying a chance

Fix SMART_EVENT_FLAG_NOT_REPEATABLE flag being ignored when specifying a chance, always making the action trigger.

* Fix SMART_ACTION_CAST with SMART_EVENT_FLAG_NOT_REPEATABLE not casting the spell at all if rolled chance was successful but creature couldn't cast the spell

* Prevent linked actions if SMART_ACTION_CAST couldn't be completed and will be retried later

(cherry picked from commit 96b289cadb)
2022-03-05 17:11:58 +01:00
Ovah
dde5a3e326 Core/SAI: implement new smart actions to change AI Animkits and to enable/disable hover movement (#25623)
SMART_ACTION_SET_HOVER (parameter1: enable/disable)

* added SMART_ACTION_SET_AI_ANIM_KIT as immediately deprecated

(cherry picked from commit b7ba856b63)
2022-03-05 16:46:42 +01:00
jackpoz
eb17e94b2e Core/SAI: Fix SMART_ACTION_WP_RESUME actually pausing next waypoint if the current path was not paused
Fixes #25519

(cherry picked from commit 5be7c2ad4f)
2022-02-28 14:42:53 +01:00
jackpoz
b059f2f8ee Core/SAI: Allow to debug SmartAI methods
(cherry picked from commit 59bb822f78)
2022-02-28 14:42:40 +01:00
Giacomo Pozzoni
a65b3493a7 Core/SAI: Add orientation and delay columns to waypoints table (#25472)
* Core/SAI: Add orientation and delay columns to waypoints table

* Rename 2020_99_99_99_world.sql to 2020_09_19_00_world.sql

(cherry picked from commit 4b7d19c91b)
2022-02-27 20:08:41 +01:00
Giacomo Pozzoni
60519e947f Core/SAI: Fix SMART_ACTION_WP_PAUSE with 0 delay pausing the path only for 1 world loop update (#25471)
* Core/SAI: Fix SMART_ACTION_WP_PAUSE with 0 delay pausing the path only for 1 world loop update

* Add code comments

* Remove special handling of SMART_ACTION_WP_PAUSE in SMART_EVENT_WAYPOINT_REACHED

(cherry picked from commit 7dd51ae6d9)
2022-02-27 20:08:41 +01:00
Shauren
ad4f4bfab7 Core/Misc: Minor game include cleanup 2022-02-13 00:49:10 +01:00
Seyden
79c6054369 Core/Objects: Use player as summoner for personal clones (#27716)
* This allows clones to properly inherit phases
2022-02-08 00:03:02 +01:00
Rushor
dfeb8c267f Game/AI: Implement option to move a creature back to Homeposition on Evade. (#24492)
* Game/AI: Implement option to move a creature back to Homeposition on Evade.

* If ToHomePosition (action param 1) is 1 > Move to last stored position
* If ToHomePosition (action param 1) is 0 > Move to homeposition
* Ref: https://github.com/TrinityCore/TrinityCore/issues/24226

* Add parameter for walkmode

* Game/AI: SAI SMART_ACTION_EVADE - Rename ToHomePosition to ToRespawnPosition and store point from GetRespawnPosition.

* Game/AI: SAI SMART_ACTION_EVADE - Rename ToHomePosition to ToRespawnPosition

* Remove broken bits, simplify the code

* Update comments

* Code cleanup

Co-authored-by: jackpoz <giacomopoz@gmail.com>
(cherry picked from commit 02fca032e1)
2022-02-05 22:51:52 +01:00
Maks Szokalski
bc04acb726 Add "On" to some gossip methods in AI (#25415)
* Add "On" to some methods

* Update npc_innkeeper.cpp

* Update zone_borean_tundra.cpp

(cherry picked from commit 41188eb535)
2022-02-05 22:18:19 +01:00
NoName
ee620856ad Core/Movement: Corrected Animation Tier handling (PR #24875)
Co-authored-by: Warpten <vertozor@gmail.com>
Co-authored-by: Ovahlord <dreadkiller@gmx.de>
Co-authored-by: Carbenium <carbenium@outlook.com>
(cherry picked from commit dad187615d)
2022-02-05 15:40:31 +01:00