Commit Graph
260 Commits
Author SHA1 Message Date
Shauren 605e5f94c0 Core/Creatures: Moved autoattack handling from scripts to game 2024-01-08 22:23:12 +01:00
ModoX 12186ef857 Core/Waypoints: Refactor to split data into path and node related info in db (#29506) 2024-01-05 17:56:19 +01:00
Meji d015711fbb Core/SAI: Implemented new source type SMART_SCRIPT_TYPE_EVENT (3) (#28816) 2023-07-09 11:59:35 +02:00
Meji 76d2f29e4e Core/SAI: Fixed event SMART_EVENT_WAYPOINT_ENDED (#29025)
* also moved "any" pointid to 0xFFFFFFFF for waypoint sai events:
* SMART_EVENT_WAYPOINT_REACHED
* SMART_EVENT_WAYPOINT_RESUMED
* SMART_EVENT_WAYPOINT_PAUSED
* SMART_EVENT_WAYPOINT_STOPPED
* SMART_EVENT_WAYPOINT_ENDED
2023-06-24 19:21:37 +02:00
Meji 06d0b16f15 Core/Creatures: Move creature difficulty specific data from creature_template table to creature_template_difficulty (#28931) 2023-05-29 00:01:23 +02:00
ModoX 356c98579b Core/SAI: Drop waypoints table and move existing rows to waypoint_data table (#28834) 2023-04-08 01:33:05 +02:00
Shauren d26d38075c Core/Creatures: Allow disabling melee attacks for all creatures, not just the ones using SAI 2023-03-13 20:22:47 +01:00
Meji 7b14b9ef22 Core/SAI: Set the trigger player as baseobject when the source type isn't a WorldObject (#28767) 2023-01-31 19:38:34 +01:00
Shauren 3df16c12b7 Core/Scripts: Move EvadeReason outside of CreatureAI class 2023-01-19 21:23:06 +01:00
Shauren d791afae1d Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api) 2023-01-08 21:16:53 +01:00
Shauren 3ef5079fee Core/Loot: Move loot rolls from Group to Loot
* Partial port of cmangos/mangos-wotlk@ffdf9a05d6
2022-09-16 16:58:03 +02:00
offl b0164fb2b9 Core/SAI: Rename LeavingWorld to OnDespawn & use it in SAI (#28059)
(cherry picked from commit b9450bcdd0924ca69b5b2cc675f5c2b558ff9b47)
2022-09-05 19:43:09 +02:00
offl 04b0596021 Scripts/Quest: Rework 'The Way to His Heart...' & make SAI's StopFollow work again (#28001)
(cherry picked from commit 861ec6a5b9a1e579e3cc3e415898fe7a2a28cf62)
2022-06-10 19:22:08 +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 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 3dca705acc953d20e4a43d4c2b3c97a84e5ab346)
2022-03-26 15:15:46 +01:00
offl e27724b362 Core/SAI: Remove deprecated events and actions (#27258)
(cherry picked from commit c508203895517885d09bbea0ae39da700f49708c)
2022-03-21 23:26: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 0800ab20a8039620fd271a43c173c008af68c22a)
2022-03-12 14:45:04 +01:00
jackpoz 67541c58ba Core/SAI: Fix typo
(cherry picked from commit 483f24c5ed8238a9b3a1747f49191b7ba6f3c90e)
2022-03-10 23:57:14 +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 f6e52f6b3df92a837787f63514417a7d240144cd)
2022-03-06 21:40: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 5be7c2ad4f7cd561951e1285227211e03886703f)
2022-02-28 14:42:53 +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 7dd51ae6d98cf6dd8ac71412aa689f888c7bf369)
2022-02-27 20:08:41 +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 41188eb535e445b73909659980257da2939e4be4)
2022-02-05 22:18:19 +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 c9356190b7891deb7878bc30064eaf1c81857c2c)
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 b3694bf47bfdab8ee9c074ac4a22d8f389e1cfc1)
2022-02-05 13:31:00 +01:00
jackpoz b3545479bf Core/SAI: Fix creatures casting spells while moving with flag SMARTCAST_COMBAT_MOVE
Fixes #24019

(cherry picked from commit 2910d0fb2436d9865d792ef92cb415f831a0af93)
2022-01-26 16:23:15 +01:00
akrom23 77d76ecc1d Creature/AI: Remove SetVisible from SmartAI::InitializeAI
Closes #24184

(cherry picked from commit f99a79cb4301f1d76d95b9c953918216947a2b94)
2022-01-22 00:34:25 +01:00
Seyden f383c0ea21 Core/SAI: Add SMART_ACTION_BECOME_PERSONAL_CLONE_FOR_PLAYER (#27581) 2022-01-18 20:51:23 +01:00
Rothend 381333690b Core/SAI: do not allow the waypoint pause timer to update while in combat. (#24877)
(cherry picked from commit 37cb39179629c90afb09324864bd31bddb9bd07c)
2022-01-18 00:17:44 +01:00
Rothend d4a1a7a040 Core/SAI: implement SMART_EVENT_SUMMONED_UNIT_DIES (82), useable by creatures and gameobjects (#24874)
* Core/SAI: implement SMART_EVENT_SUMMONED_UNIT_DIES (82), useable by creatures and gameobjects.

Closes #24831

* Update SmartScriptMgr.h

(cherry picked from commit 5339d1d3b835fcc8f635d34457ceb6e653e70a1c)
2022-01-18 00:17:28 +01:00
Rothend 1ddde5ca3c Core/SmartAI: allow AreaTrigger SAI scripts to use the player triggering it as base object for actions and targeting (#24817)
* Core/SmartAI: allow AreaTrigger SAI scripts to use the player triggering it as base object for actions and targeting.

Closes #23669
Closes #24791
Closes #24792
Closes #24793

* Apply suggested changes.

* Initialize atPlayer in the constructor

Co-authored-by: Giacomo Pozzoni <[email protected]>
(cherry picked from commit e7a714f66c371cdeb6585846ddedb1bc445e695f)
2022-01-06 22:05:03 +01:00
ForesterDev 3171cd3fa9 Core/AI: refactor SpellHit and SpellHitTarget. (#24691)
* Core/AI: refactor SpellHit and SpellHitTarget.

- now caster/target is WorldObject instead of Unit
- remove SpellHitByGameObject / SpellHitTargetGameObject (handled by SpellHit / SpellHitTarget)
- rename parameters in scripts according parent methods

* Restore logic in Algalon script

* Changed check for REMORSELESS_WINTER hit to avoid dublicate call, because it has TARGET_UNIT_CASTER for effects 0/1 and TARGET_GAMEOBJECT_SRC_AREA for effect 2

* Fix build after merge

(cherry picked from commit e3b232fe0e5c21a87d3fe71813e9d750259823f1)
2022-01-06 20:46:25 +01:00
jackpoz c75d75b9fa Core/AI: Fix charmed Creatures with SAI scripts not starting waypoint paths
(cherry picked from commit 49e77d7c9e4c39296536cd0b2d427d047e762f46)
2021-12-22 22:36:39 +01:00
jackpoz dab7e5688c Core/AI: Fix remaining charming issue
Make creatures evade when a charming expires and they cannot attack the charmer (i.e. charmer with .gm on)

(cherry picked from commit 69809d12031d055d8d0cffb5a187d9af09dd0efe)
2021-12-22 21:00:14 +01:00
Giacomo Pozzoni 144cfc2bce Core/AI: Make charmed creatures follow their owner (#24195)
* Core/AI: Make charmed creatures follow their owner

* Follow the charmer only when applying the charm

* Make SmartAI follow the charmer

(cherry picked from commit ddf2f60c1317f0ce728d5894064f51251cf71c72)
2021-12-22 20:46:17 +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
Killyana d946d74ff9 Core/AI: Fix creatures not updating their target properly once engaged
Closes  #21562

(cherry picked from commit 7fb74326205acbc5c0fa6b2aa9731d891e788d64)
2021-12-19 15:54:20 +01:00
Treeston 3db58c4d96 Core/SmartAI: SmartAI creatures no longer process health-based hooks after death.
(cherry picked from commit 1faa54fe8b2690507e4177a9a7373c0b24855291)
2021-12-18 00:03:55 +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
ccrs f1ef2f73a4 Core/SmartAI: allow more Unit::ResumeMovement calls on JustReachedHome()
Since ResumeMovement also works on other MOTION_SLOT_DEFAULT generators (like RandomMG)

(cherry picked from commit c8cb866db088837cd7c771059e66d98a46de4fdd)
2021-12-16 22:08:01 +01:00
Wyrserth 83a9222c39 Core/SAI: allow creatures to handle gameobject spellhit SAI events. (#23492)
(cherry picked from commit 7a71127da92bd833caf4188aee2d5e88c61ae772)
2021-12-13 00:42:17 +01:00
ccrs f4a71ea9aa Core/AI: remove extra empty line
(cherry picked from commit 3c77c04b052f721efb96bdaaceeca8de09926f12)
2021-12-12 02:15:10 +01:00
Treeston 743d022cee AI/SmartAI: Properly forward to inherited CreatureAI::JustAppeared in SmartAI::JustAppeared. Fixes #23491.
(cherry picked from commit 854a113fc7b6610873b77355aed88900ce3b5bc0)
2021-12-12 02:11:15 +01:00
Treeston e398bb1664 AI/SmartAI: Move SMART_EVENT_RESPAWN invocation from ::InitializeAI() to ::JustAppeared(). Closes #23313.
(cherry picked from commit 37fc38b91701c3e699b20f3ed8de8da3b5c42063)
2021-12-12 01:27:04 +01:00
Wyrserth 5331656785 Core/SAI: allow to start waypoint movement for a creature that is in combat. (#23426)
(cherry picked from commit d6e36601151046d5e99f97fa9594ac2d86fa698c)
2021-12-11 15:29:32 +01:00
jackpoz 6034992dff Core/SmartAI: Implement SMART_EVENT_SUMMONED_UNIT and SMART_EVENT_SUMMON_DESPAWNED for GameObject owners
(cherry picked from commit 507a56d62764f63113d35dfcca9273b8d0b16cc5)
2021-12-07 00:31:26 +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
jackpoz 54044bda82 Core/SmartAI: Fix SMART_EVENT_SUMMON_DESPAWNED
Fix SMART_EVENT_SUMMON_DESPAWNED not working when event_param1 was set to any value other than 0

(cherry picked from commit 457fc224733cc78cedc5e956442a9f5d7bd2f049)
2021-12-06 23:27:45 +01:00
ccrs 844f969ed7 Core/AI: logs, codestyle & cosmetics standarization
(cherry picked from commit fdb71ce19e02b44323fbb9dfa5f07dae2a35f8ba)
2021-12-05 16:48:58 +01:00
ccrs dd11603150 Core/AI: variable naming standarization
plus minimum codestyle changes

(cherry picked from commit 179c7da1fc264b1444aa50632317e16dca02f78b)
2021-12-05 16:17:02 +01:00