Commit Graph

922 Commits

Author SHA1 Message Date
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
Treeston
fc094509e9 Core/Scripts: Remove now-unused WaypointPathStarted hook. WaypointStarted does everything it used to do, anyway. b3694bf follow-up.
(cherry picked from commit c9356190b7)
2022-02-05 13:31:50 +01:00
jackpoz
c2d2df96db Core/SAI: Fix SMART_EVENT_WAYPOINT_START not being called at every waypoint checking wrong path id parameter
Remove multiple calls to SMART_EVENT_WAYPOINT_START for the 1st waypoint.
Closes #24760

(cherry picked from commit b3694bf47b)
2022-02-05 13:31:00 +01:00
jackpoz
ae6f8bc4f5 Core/SAI: Do not allow SMART_EVENT_RESET to call SMART_ACTION_CALL_SCRIPT_RESET
There might be cases where this should be allowed (i.e. if the SMART_TARGET_* is another object) but for now we'll just never allow it.

(cherry picked from commit 28921f191d)
2022-02-05 12:08:58 +01:00
Giacomo Pozzoni
4dff5bd09b Core/SAI: Reduce the chance of infinite loops/stack overflows (#25398)
Fixes #24092

(cherry picked from commit a58aeb41f4)
2022-02-05 11:51:54 +01:00
Giacomo Pozzoni
902ed74c2a Core/SAI: Implement SMART_TARGET_ACTION_INVOKER in SMART_EVENT_FRIENDLY_HEALTH_PCT (#25318)
* Core/SAI: Implement SMART_TARGET_ACTION_INVOKER in SMART_EVENT_FRIENDLY_HEALTH_PCT

* Require radius (5th parameter) to be set

(cherry picked from commit cbed1039c4)
2022-02-04 00:27:13 +01:00
jackpoz
1f2c48f8bb Core/SAI: Remove completed timed action lists even while evading
Fixes #25294

(cherry picked from commit 03eb0886a8)
2022-02-04 00:27:12 +01:00
Shauren
88659dcebf Core/Gossip: Sync naming and db structure with 3.3.5 2022-01-26 23:49:42 +01:00
Giacomo Pozzoni
f2ee365da4 Core/SAI: Spell casts that cannot be executed because the unit is currently casting another spell will be retried asap with priority over other events (#25238)
* Core/SAI: Spell casts that cannot be executed because the unit is currently casting another spell will be retried asap with priority over other events

* Core/SAI: Re-sort the events only when needed

* Fix some priority reset and wrong mEventSortingRequired handling

* Code cleanup.
Sort only events loaded from db (not stored events, not timed action list).

* Code cleanup.
Raise priority of failed casts so they are retried before other spells

* Keep priority of the action fails and is rescheduled on next update

* Don't try recasting a spell in SMART_ACTION_CAST if there are multiple targets and at least 1 was successful

(cherry picked from commit ca25e8d019)
2022-01-26 22:26:08 +01:00
Peter Keresztes Schmidt
2e3c612c80 Core/Unit: Make HandleEmoteCommand typesafe (#25249)
* Scripts/ScarletMonastery: Fix wrong emote during Headless Horseman encounter

* Scripts/HoR: Fix wrong emote during escape event

* Core/Unit: Make improve type safety of HandleEmoteCommand

Change argument type to the expected enum type Emote

* Scripts/CoS: Use SetUInt32Value to set UNIT_NPC_EMOTESTATE

UNIT_NPC_EMOTESTATE is no flag field

(cherry picked from commit 6c7837f947)
2022-01-26 21:46:51 +01:00
Giacomo Pozzoni
e11e1938b5 Core/SAI: Fix creatures casting with flag SMARTCAST_COMBAT_MOVE not switching to melee when the school of the spell they are trying to cast gets silenced (and other cases of spell failure) (#25226)
* Core/SAI: Fix creatures casting with flag SMARTCAST_COMBAT_MOVE not switching to melee when the school of the spell they are trying to cast gets silenced (and other cases of spell failure)

* Core/SAI: Retry casting after 500ms if a cast failed

Fixes #24914

(cherry picked from commit 63a6e1e048)
2022-01-26 19:21:10 +01:00
jackpoz
b3545479bf Core/SAI: Fix creatures casting spells while moving with flag SMARTCAST_COMBAT_MOVE
Fixes #24019

(cherry picked from commit 2910d0fb24)
2022-01-26 16:23:15 +01:00
Giacomo Pozzoni
864d775280 Core/Misc: Fix static analysis issues (#25194)
(cherry picked from commit 07fd84b679)
2022-01-26 14:06:40 +01:00
Giacomo Pozzoni
1977d26050 Core/SAI: Ignore SAI while evading (#25108)
(cherry picked from commit 420b21be98)
2022-01-24 13:21:46 +01:00
Shauren
c7899c1e76 Core/WorldObject: std::chrono-ify SummonPersonalClone 2022-01-24 12:57:40 +01:00
Carbenium
82fce41852 Core/WorldObject: Replace non-std::chrono SummonGameObject overloads
Also fix intended despawn time of GOs used by the "Engineering a Disaster" quest

(cherry picked from commit 8642aaaf92)
2022-01-24 12:55:43 +01:00
Carbenium
310f996b1d Core/WorldObject: Partially std::chrono-ify SummonCreature overloads
TempSummon* SummonCreature(uint32 entry, float x, float y, float z, float o = 0, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, uint32 despawnTime = 0);
to
TempSummon* SummonCreature(uint32 entry, float x, float y, float z, float o = 0, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime = 0s);

(cherry picked from commit 1131229ee9)
2022-01-24 11:55:32 +01:00
Peter Keresztes Schmidt
ad340466d0 Misc: Use [[fallthrough]] attribute instead of comment to mark intentional fallthroughs (#25054)
Related: #25006
(cherry picked from commit 85b5b842ca)
2022-01-23 22:02:03 +01:00
akrom23
77d76ecc1d Creature/AI: Remove SetVisible from SmartAI::InitializeAI
Closes #24184

(cherry picked from commit f99a79cb43)
2022-01-22 00:34:25 +01:00
Shauren
a270005de1 Core/SAI: Support SMART_TARGET_POSITION in SMART_ACTION_BECOME_PERSONAL_CLONE_FOR_PLAYER 2022-01-19 19:20:56 +01:00