Commit Graph
437 Commits
Author SHA1 Message Date
Aokromes ae1abb63be Revert "Core/SAI: Fixed crashes when SAI targets pets that use sai if not tamed"
This reverts commit 9fd67b7044.
It's crashing core, it very likely needs to import more commits from 3.3.5a before this can be re-added
2018-05-12 13:17:14 +02:00
Shauren 9fd67b7044 Core/SAI: Fixed crashes when SAI targets pets that use sai if not tamed
Closes #21870
2018-04-25 00:22:02 +02:00
Ovahlord 20314730ad Core/SAI: fixed a crash 2018-03-28 22:05:25 +02:00
ariel- 925264c000 Misc: build fixes (linux) 2018-03-28 05:54:57 -03: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
jackpoz 19ce97eae4 Core/SmartScripts: Code cleanup 2018-03-12 12:40:23 +01:00
Killyana 81698da80d Core/SAI: Add event_parm5 "player only" for EVENT_OOC_LOS and EVENT_IC_LOS
Closes #21497
2018-03-12 12:40:14 +01:00
Ovahlord e44bb5f387 Core/Entities: Phase Rework (main commit) 2018-03-08 22:58:50 +01:00
Aokromes ca5e3445b8 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
2018-02-16 04:05:47 +01: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 8365119235 Core/Battleground: Dropped battleground texts from trinity_string and replaced them with proper BroadcastText 2018-01-27 16:00:38 +01:00
Aokromes 079f2002ac Core/SAI: Extended SMART_TARGET_VEHICLE_PASSENGER to allow specifying
seat mask instead of single seat index (can now target all passengers)
2018-01-21 12:34:54 +01:00
Aokromes c2861bf887 Core/SAI: Add a 5th parameter to SAI events 2018-01-14 07:56:47 +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 4bd0525edd Update copyright note for 2018 2018-01-01 01:06:19 +01:00
Erik Strandberg a3b16c040b Port https://github.com/TrinityCore/TrinityCore/commit/f913f3bb8977c127d200d5d4a608ab434b21bbcd 2017-12-10 00:37:21 +00:00
Ovalord 01d62f0ca0 Core/AI: fixed a small logic mistake for SAI directAdd == 0. 1 is suposed to add the quest directly. 2017-11-28 09:53:18 +01:00
Ovalord 05250fe4ad Core/Quests: Implemented quest popups 2017-11-28 08:30:58 +01:00
Aokromes 91affef0c6 Misc: Kill trailing white spaces 2017-11-25 01:36:21 +01:00
Aokromes 0a71d36af5 Core/SAI: Add distance option for SMART_ACTION_SOUND & SMART_ACTION_RANDOM_SOUND 2017-10-26 12:33:57 +02:00
Aokromes 1a5c0f5c3b Core/Grids: Ported cmangos/mangos-wotlk@ea99457
(cherry picked from commit 9299e9b)
2017-06-19 20:20:26 +02:00
ariel- 206c82ead4 Core/SmartAI: implemented SMART_EVENT_EVENT_PHASE_CHANGE
- Use instead of Update + event_phase_mask when action needs to be synchronized
2017-06-11 17:50:24 +02:00
Aokromes ac3dbcb880 Core/Utilities: Rename RandomResizeList->RandomResize as it is no longer restricted to a list 2017-06-07 09:53:04 +02:00
treeston 2b721ca16c SAI fixes follow-up: I missed one. 2017-06-06 22:22:01 +02:00
treeston 3cc2419c2f Fix a whole set of possible infinite loop crashes in SAI (events triggering themselves even with cooldown set). 2017-06-06 22:14:22 +02:00
xinef1 b88200cd58 Core/Misc: Various crash fixes 2017-05-05 01:59:34 +01: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
tkrokli d40b252c01 Game/AI: SMART_ACTION_JUMP_TO_POS should resume path when reached jump location (#19029)
SmartAI NPCs using SMART_ACTION_JUMP_TO_POS
should resume their path when they have reached the jump location.

The changes in this PR makes the action work as intended.

Closes #18760
2017-04-01 07:05:03 +02:00
Aokromes d8febab3ad Core/SmartAI: Missing parts on previous commit
By Malcrom
2017-03-26 01:03:41 +01:00
Aokromes dca200d6b6 Core/SmartAI: Implement SMART_TARGET_VEHICLE_ACCESSORY
By Malcrom
2017-03-23 04:05:15 +01:00
Aokromes 41c30413c9 Core/Misc: Minimize branch differences 2017-03-13 09:52:07 +01:00
Aokromes 58a585a3f1 Core/Misc: Build fix 2017-03-12 13:51:20 +01:00
Aokromes 546d71a7b4 Core/SAI: added new action SMART_ACTION_PLAY_ANIMKIT 2017-03-11 15:45:16 +01:00
ariel- 7544544cf1 Core/Entities: spawned movementtype should override template movementtype
Core/SmartAI: pass the CreatureData pointer (if any) on updating template

Closes #19223
2017-03-03 01:30:25 +01: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
ariel- 79e6325716 Core/SmartAI: Delay SMART_ACTION_FORCE_DESPAWN by at least one world tick
- Restore old despawn behavior of SmartAI despawning (without reintroducing the run time logs caused by IsSmart)
- Some SAIs relied on this to function (for example #1249)

Partial reverts commit 4fc4c81e89
2017-02-10 05:24:35 +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
Rushor 304ecbc8b1 Game/AI: Implement ContactDistance for ACTION_MOVE_TO_POS (#18720) 2017-01-23 00:15:25 +01:00
Aokromes 31484029a0 Revert "[3.3.5][master] Core/Movement: Smooth movement 2017-01-20 16:26:38 +01:00
Aokromes 719a317a67 Update copyright note for 2017 2017-01-02 07:26:38 +01:00
Kittnz 79e28d4452 Tabs 2016-12-28 16:10:54 +01:00
Kittnz a2e01f386a Core/SmartScript: update ACTION_GO_SET_GO_STATE
GO_STATE_ACTIVE             = 0,                        // show in world as used and not reset (closed door open)
GO_STATE_READY              = 1,                        // show in world as ready (closed door close)
GO_STATE_ACTIVE_ALTERNATIVE = 2                         // show in world as used in alt way and not reset (closed door open by cannon fire)

Credits to Sunwell
2016-12-28 16:10:44 +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 477ba4e439 Core/SAI: reset event phase when calling SMART_ACTION_CALL_SCRIPT_RESET.
Now it really does what it says on the tin.
2016-11-02 03:14:26 +01:00
SnapperRy fe4da7ede8 Core/SAI: remove wrong DB errors.
It is normal to have events applicable only to certain instance difficulties.

Closes #18082.
2016-11-02 02:50:57 +01:00
SnapperRy 4fc4c81e89 Core/SAI: always use DespawnOrUnsummon() for SMART_ACTION_FORCE_DESPAWN.
SmartAI uses that same method internally, so there's no need to handle it in two different ways.

Does not affect functionality, but prevents useless SAI error log in case the target creature is not using SAI.
2016-10-24 13:27:26 +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
ariel- 947086fb54 Core/SmartAI: There's a function for that 2016-10-24 11:10:26 +02:00
SnapperRy 76d8a6e636 Core/SAI: don't reset event phase when npc evades/resets.
The scripts themselves should take care of that.
2016-10-24 11:06:13 +02:00