Commit Graph
187 Commits
Author SHA1 Message Date
Treeston ec04d3b2cd [3.3.5] Combat/Threat rewrite - prep & refactor (#19966)
* Combat/Threat rewrite (PR #19930) prep work. Mostly refactors, and a compatibility layer on ThreatManager/HostileReference that allows scripts to be changed already.
2020-07-22 13:43:23 +02:00
Ovah b09d6e2330 Core/Movement: reimplement follow movement (#124) 2020-06-26 21:22:21 +02:00
Ovahlord f2713834c7 Core/AI: cleaned up SAI initialization in order to fix some unexpected behaivior when summoning creatures with sai assigned 2020-01-31 11:27:58 +01:00
Ovahlord fcb79fee07 Core/Datastores: updated DBC structure names to generated member format 2020-01-25 12:36:32 +01:00
Aokromes d6d3f06f06 New year 2020-01-04 18:32:38 +01:00
funjoker 6c56916b29 Misc: Update copyright information
Happy new year
2020-01-01 18:47:28 +01:00
Wyrserth e3cb264262 Core/SAI: allow to start waypoint movement for a creature that is in combat. (#23426)
# Conflicts:
#	src/server/game/AI/SmartScripts/SmartAI.cpp
2019-06-18 20:42:30 +02:00
Ovahlord 1c7a520095 Revert "Core/SmartAI: Remove duplicate OnReset() call"
This reverts commit 73345b0d7f.
2019-04-27 17:38:06 +02:00
Treeston 1f15fe5096 oops, now it builds (and a bonus refactor that annoyed me)
# Conflicts:
#	src/server/game/AI/SmartScripts/SmartAI.cpp
#	src/server/game/AI/SmartScripts/SmartAI.h
#	src/server/game/AI/SmartScripts/SmartScript.cpp
#	src/server/game/AI/SmartScripts/SmartScript.h
2019-04-26 18:56:31 +02:00
Treeston 99a2c24116 Scripts/SmartAI: Forward invoker to invoked action list actions. Also JustAppeared -> InitializeAI.
# Conflicts:
#	src/server/game/AI/SmartScripts/SmartScript.h
2019-04-26 18:51:19 +02:00
sirikfoll 73345b0d7f Core/SmartAI: Remove duplicate OnReset() call
It is already called for every creature in SmartAI::InitializeAI(), removing the one from SmartAI::JustAppeared to keep as much as possible of the old behavior, because JustAppeared is called on the next tick after InitializeAI

Closes #20881
Closes #20771
2019-04-26 18:46:55 +02:00
Ovahlord 1db154f916 Core/SAI: restore PauseMovement call when a npc starts attacking a victim but don't enforce a stopMovement call to keep the Death Grip fix working 2019-02-14 09:26:31 +01:00
Ovahlord 688daf9843 Core/SAI: stop movement on CombatMove cast flags and fixed an issue that was causing npc's with smart scripts ignoring controlled motion slots 2019-02-08 17:39:46 +01:00
Ovahlord 1a1790b737 Merge branch '4.3.4' of https://gitlab.com/trinitycore/TrinityCore_434 into 4.3.4
# Conflicts:
#	src/server/game/AI/SmartScripts/SmartScript.cpp
#	src/server/game/Skills/Archaeology/ArchaeologySites.cpp
#	src/server/scripts/Spells/spell_mage.cpp
2018-09-17 15:43:22 +02:00
Aokromes 48dd914478 Scripts/SmartAI: SetData now has an invoker (if the setting is done b…
…y something using SmartAI).

Also, some refactors.
2018-09-03 14:25:57 +02:00
Ovahlord c4ce03f525 Core/AI: merged walk / run fix for EscortAI 2018-08-20 02:53:42 +02:00
Ovahlord 78e0328356 Core/Movement: fixed waypoint movement commits up to 2ce9a0a094a3d86a86a9323693c93ed6a2bbcaaf 2018-08-02 16:20:02 +02:00
Ovahlord 075a79dac1 Core/Movement: first batch of followup commits 2018-08-02 16:03:19 +02:00
Ovahlord c808b981f7 Core/Movement: merged smooth waypoint movement. Followup commits will be merged soon (tm) 2018-08-02 15:38:35 +02:00
Ovahlord b976bc1187 Core/Spawns: merged Dynamic Spawning 2018-07-21 20:44:41 +02:00
ariel- 5ff847159c Core: header cleanup, split realmlist, boost compatibility, cotire, remove stormlib/zlib and stormlib/bzip2 and instead use dep sources 2018-03-28 04:41:59 -03:00
Aokromes 74b7ac101a Scripts/SmartAI: SMART_TARGET_INVOKER cleanup step 1. The core will n…
…ow 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.)
2018-02-16 02:08:56 +01:00
Aokromes 1f95d87e92 Core/SmartAI: allow SMART_ACTION_SEND_GOSSIP_MENU to override default gossip 2018-01-06 06:46:43 +01:00
Aokromes 46366373ab Core/AI: Some more refactoring prep for #19930. CreatureAI::EnterCombat is now called CreatureAI::JustEngagedWith. There's also two new methods on UnitAI, though they're never invoked right now. 2018-01-01 16:02:22 +01:00
Aokromes f2ab43568a Core/AI: Making guid const& in SetGUID method 2018-01-01 14:55:20 +01:00
Aokromes 4bd0525edd Update copyright note for 2018 2018-01-01 01:06:19 +01:00
Krudor c8aeadc949 Remove reportUse parameter on GameObjectAI::GossipHello and give it its own event.
Ported from 3.3.5
2017-12-10 13:59:13 +01:00
Erik Strandberg a3b16c040b Port https://github.com/TrinityCore/TrinityCore/commit/f913f3bb8977c127d200d5d4a608ab434b21bbcd 2017-12-10 00:37:21 +00:00
Aokromes 91affef0c6 Misc: Kill trailing white spaces 2017-11-25 01:36:21 +01:00
Aokromes 7817610b07 Core/SAI: Disable incorrect flag change 2017-11-24 16:42:47 +01:00
Aokromes aa24608bed Core/SAI: allow to pause/resume waypoint for non-escorting NPCs 2017-10-23 09:19:45 +02:00
ccrs 622736286f Core/SmatAI: correct MoveInLineOfSight
mistake introduced in 15f2706aca that was masqueraded by other checks in combat start, till recent related commits
2017-08-13 03:47:01 +02:00
Aokromes 1c6021ba96 Core/AI: Factory functions cleanup
- Get rid of fugly void pointers
- Streamlined AI selection code, using Permissible as it should've been instead of harcoded checks on the selector code
- Moved IdleMovementGenerator singleton to factory code
2017-06-01 13:22:24 +02:00
ariel- f3246f835c Core/Scripts: remove OnDummyEffect hook/sOnDummyEffect ai hook
- Duplicated logic never used, sometimes only ScriptMgr version was called, sometimes only AI
- They only encourage bad scripting practices
- You can still use OnSpellHit or a SpellScript
2017-05-02 02:04:45 +02:00
Aokromes c015a5cf10 Core/Misc: camelize GetFaction/SetFaction properly 2017-05-02 02:02:31 +02:00
xinef1 62111a8c4a Core/SmartAI: Various fixes and extensions for smart scripts: (#18673)
- Possible crashes fixed
- Memory leak fixed
- Implemented checking of vehicle conditions
- Extended eventphasemask to 12 bits (sql required to change DB field type)
- SMART_EVENT_GOSSIP_HELLO - added possibility to detect for gameobject reportUse call
- Renamed action SMART_ACTION_SET_FLY to SMART_ACTION_SET_DISABLE_GRAVITY (to reflect actual functionality)
- Added targetsLimit to action SMART_ACTION_CAST and SMART_ACTION_INVOKER_CAST to limit max amount of targets (selected randomly)
- Action SMART_ACTION_TALK corrected to always work as intended
- Properly call GroupEventHappens in action SMART_ACTION_CALL_GROUPEVENTHAPPENS if invoker was charmed or owned by the player
- Properly utilize followAngle in action SMART_ACTION_FOLLOW (db orientation should be in degrees), but keep backward compatibility
- Added action SMART_ACTION_SET_CAN_FLY (119) 0/1
- Added action SMART_ACTION_REMOVE_AURAS_BY_TYPE (120) AuraType, can be used to exit vehicle for example
- Added action SMART_ACTION_SET_SIGHT_DIST (121) sightDist
- Added action SMART_ACTION_FLEE (122) fleeTime
- Added action SMART_ACTION_ADD_THREAT (123) +threat, -threat
- Added action SMART_ACTION_LOAD_EQUIPMENT (124) equipmentId
- Added action SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT (125) minId, maxId
- Added action SMART_ACTION_REMOVE_ALL_GAMEOBJECTS (126), removes all owned gameobjects
- Added action SMART_ACTION_STOP_MOTION (127), stopMoving, movementExpired
- Extended target SMART_TARGET_HOSTILE_SECOND_AGGRO with following parameters maxdist, playerOnly, powerType + 1
- Extended target SMART_TARGET_HOSTILE_LAST_AGGRO with following parameters maxdist, playerOnly, powerType + 1
- Extended target SMART_TARGET_HOSTILE_RANDOM with following parameters maxdist, playerOnly, powerType + 1
- Extended target SMART_TARGET_HOSTILE_RANDOM_NOT_TOP with following parameters maxdist, playerOnly, powerType + 1
- Extended target SMART_TARGET_THREAT_LIST with maxdist
- Extended target SMART_TARGET_OWNER_OR_SUMMONER to be able to get charmer/owner of current owner
- Added new target SMART_TARGET_FARTHEST with maxDist, playerOnly, isInLos restrictions
- Added SpellHit hook to GameObjectAI and extended SmartGameObjectAI to call SMART_EVENT_SPELLHIT when gameobject is hit by spell
- Call GameObjectAI Reset hook on gameobject respawn (for ex. to reset one time events in smart scripts)
- Fixed some logic errors in code
- SmartAI Escorts properly despawn escortee if no players are in range
- Disable Evading while charming creature with SmartAI
- Don't call SMART_EVENT_RESPAWN for dead units before they actually respawn
- Don't call SMART_EVENT_RESPAWN for not spawned gameobjects
- Properly call SMART_EVENT_RESPAWN for gameobject respawn
- Allow action SMART_ACTION_SET_IN_COMBAT_WITH_ZONE to utilize targetlist
- Allow action SMART_ACTION_CALL_FOR_HELP to utilize targetList
- Allow action SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL to utilize targetList
- Allow action SMART_ACTION_SET_VISIBILITY to utilize targetList
- Allow action SMART_ACTION_SET_ACTIVE to utilize targetList
- Allow action SMART_ACTION_ATTACK_START to select random attack target instead of first on the list
- Allow gameobjects to summon gameobjects with action SMART_ACTION_SUMMON_GO
- Properly store action invokers for action SMART_ACTION_WP_START, if no player invokers are found, distance despawn check won't be used
- Allow action SMART_ACTION_WP_RESUME to compensate for the state the unit actually is in (eg. combat)
- Allow action SMART_ACTION_MOVE_TO_POS to select random of the avaiable targets, not only the first one.
- Allow action SMART_ACTION_MOVE_TO_POS to utilize x, y, z parameters as an offset to calculated coordinates
- Action SMART_ACTION_RESPAWN_TARGET should never modify respawntime of already spawned gameobjects, use dedicated function
- Properly delete ontime events created by SMART_ACTION_CREATE_TIMED_EVENT
- If action could not be started because conditions were not satisfied, do not recalculate the waittime to action repeattime, use smaller value to recheck more frequently
- Allow target SMART_TARGET_CLOSEST_PLAYER to be used by gameobjects
- Allow target SMART_TARGET_OWNER_OR_SUMMONER to be used by gameobjects
- Fixed SMART_EVENT_COUNTER_SET to be only called for the id that was incremented
- Changed the way counters work
- Protect PhaseInc from surpassing maximum phase
- Added loading checks for missing NON_REPEATABLE flag if no repeatmin, repeatmax is set
- Added spell validation for SMART_ACTION_CROSS_CAST
2017-02-19 09:10:29 +01:00
xinef1 2c05a59815 Core/Misc: Fix various crashes, also related to multithreading (#19012)
* When iterating groups we have to either do it not in multithreaded context (map updates) or start with checking maps (they are guaranteed to change in single thread update).
* Properly clear ComboPoint references on player remove 
* remove some possible references item may have when it is deleted during save. 
* Also clear all hostile references when unit is removed from map.
2017-02-05 01:58:11 +01:00
Aokromes 31484029a0 Revert "[3.3.5][master] Core/Movement: Smooth movement 2017-01-20 16:26:38 +01:00
ccrs 047673175b cb634e6fba followup
updates #18401
2017-01-07 07:36:00 +01:00
Aokromes 719a317a67 Update copyright note for 2017 2017-01-02 07:26:38 +01:00
ariel- c59f8c0693 Core/SAI: restore deleted line in 28050f338dfc66e0c40b6a3915bf96e38e0613e5
Field left uninitialized. Caused weird evade behaviour
2016-12-06 11:07:00 +01:00
Aokromes f6160d4d0b Core/Movement: Smooth movement
Implement smooth movement for all waypoint pathing and escortai
2016-11-27 16:59:31 +01:00
SnapperRy d77b366703 Core/Quest: do not set a quest to failed if it's rewarded or has no status at all (not taken). 2016-10-24 13:47:32 +02:00
ariel- 9b74762644 Core/SmartScripts: fixup SMART_EVENT_FLAG_WHILE_CHARMED behaviour to only mean charmed creatures (#17738 follow-up)
Unit::IsControlledByPlayer is a expected value for TempSummons (like some triggers used in quests, summoned by spells).
Previous logic broke a lot of quests which use triggers to do stuff.

Allow JustSummoned and events linked from other events with flag set also in charmed (prevents breaking event chains)
Allow vehicles (needed for vehicles with SmartAI, eg Iron Rune Constructs and You: Rocket Jumping)
2016-10-24 13:18:45 +02:00
treeston 219fd84f1e Derp. Build fix. 2016-09-09 19:57:12 +02:00
treeston 2e896a15dd AI/SmartAI: Fix an issue where SmartAI creatures would not properly follow their owner on evade. Also fix a bug where creatures with INHABIT_ROOT would get stuck in evade under certain conditions.
This allows us to fix quest 12261 (No Place to Run). Closes #16291.
2016-09-09 19:56:30 +02:00
treeston 9da4e304ae Scripts/SmartScripts: Fix charmed behavior for SmartAI. For real this time.
- Core AI logic will no longer issue attack/movement commands while under player control.
- Add new SMART_EVENT_FLAG_WHILE_CHARMED (0x200). Any event without this flag won't run while charmed.
- Add SMART_EVENT_FLAG_WHILE_CHARMED to existing actions, except a select subset (movement, talking, and nontriggered casts, pretty much).
2016-09-03 01:21:03 +02:00
treeston 0e47f961c9 AI/SmartScripts: Add SMART_ACTION_DISABLE_EVADE (117). 2016-08-20 06:19:41 +02:00
treeston f8862f19f5 Scripts/SmartAI: Some clean-up work:
- NULL -> nullptr
- Rename "AssistPlayerInCombat(who)" to "AssistPlayerInCombatAgainst(who)" to reflect what the method actually does
- Code style

No functionality was changed.
2016-08-05 18:33:37 +02:00
Aokromes 006d89310b Core: updated creature type flags enum (#17128)
Core/Misc: Update CreatureTypeFlags enum according to TrinityCoreWiki
2016-07-20 13:47:25 +02:00