Commit Graph
215 Commits
Author SHA1 Message Date
Shauren b231903932 Core/Misc: Port all the refactors sneaked in master to 3.3.5 include cleanup port 2020-09-04 13:38:24 +02:00
ccrs 97585597f0 Core/Movement: waypoint movement (#20121)
Following the work done in #19361 this is the cleanup and improvement of the related logic of waypoint management.

Ref 28050f3 #18020
(taking the good parts and ignoring the incomplete work)

(cherry picked from commit 7fff83d67526efff63867d41b9e036a19a9287b3)
2020-08-23 00:45:46 +02:00
r00ty-tc 03b125e6d1 Dynamic Creature/Go spawning:
- True blizzlike creature spawn/respawn behavior - new creature = new object
 - Toggleable spawn groups (with C++/SAI/command options to use them)
 - Custom feature: dynamic spawn rate scaling. Accelerates respawn rate based on players in the zone.
 - Backward compatibility mode (set via group and for summons)
   to support creatures/gos that currently don't work well with this
   (this should be removed once the exceptions are fixed)

Fixes and closes #2858
Tags #8661 as fixable.
Fixes and closes #13787
Fixes #15222.

(cherry picked from commit 59db2eeea0a35028779fd76372ae06cc98c8086f)
2020-08-22 12:59:57 +02:00
ariel- 593d3243d4 Core/SmartAI: implemented SMART_EVENT_EVENT_PHASE_CHANGE
- Use instead of Update + event_phase_mask when action needs to be synchronized

(cherry picked from commit 619a5534c5f6ce5e736b22e645f7bac72eba9b16)
2020-07-17 18:38:25 +02:00
Carbenium 692ec8e7c1 Core/SAI: Apply include cleanups to cherry-picked changes 2020-07-16 22:00:30 +02:00
ariel- 259bde5914 Core/SAI: Change SmartScript::GetTargets to return an ObjectList instead of a ObjectList*
Applied the same treatment to GetWorldObjectsInDist

Honestly no idea why the original idea insisted so much
on using pointers. No more missing null checks or deletes.

SmartAI's "ObjectList" is now a std::vector instead of a std::list
because no where it was being used as an actual list.

Original idea by DDuarte :P

(cherry picked from commit a97439e8d63c0a78bda8a6ed4801f122385936e3)
2020-07-16 20:59:25 +02:00
Shauren c7306439e7 Core/Spells: Implement using different difficulty data from all spell related db2s, not just SpellEffect and SpellPower 2020-06-12 01:29:18 +02:00
ariel- 6604849716 Core/Scripts: unified scripted gossip/quest api
- Changed self-accessor on GameObjectAI to "me", like UnitAI
- Moved all related functions to AI, now Unit and GameObject have the same function names with identical behaviour
- Remove "OnUpdate" from CreatureScript/GameObjectScript, was never used and we already have AI Update method
- Quest methods no longer return a bool, the return value was used to call the AI version if the ScriptMgr one returned false
- Implemented GameObjectAI::Destroyed hook (was never called), implemented Damaged method
- Rename OnStateChanged to OnLootStateChanged to reflect when it's really called, and created a new hook OnStateChanged that only gets called on GOState change
- Since the functions are now only getting called from AI, made GetAI methods full virtual. (CanSpawn method is anyways going to be used on creatures with AI)

(cherry picked from commit f913f3bb8977c127d200d5d4a608ab434b21bbcd)
2020-05-03 03:04:32 +02:00
ariel- 1929ca3aa1 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

(cherry picked from commit b6b59f6c239bc0259c92c28bf43bbb50573330b5)
2020-04-29 01:36:46 +02:00
Aokromes b0bf1275ee New Year 2020-01-02 06:44:10 +01:00
Lopfest 7d999b70a1 Core/SmartScripts: implement SMART_ACTION_PLAY_SPELL_VISUAL_KIT (#23737) 2019-09-01 15:51:01 +02:00
Lopfest 5dd6d31c01 Core/SAI: Implement new action to set movement speed 2019-08-31 14:35:47 +02:00
ariel- 4ab07ae4e1 Core/SmartAI: Allow scripting GameObjects by spawn id too
(cherrypicked from 05d99c5f58256f2baa16268dd0c310e3d089a229)
2019-08-17 20:04:14 +02:00
xinef1 a32d5cfa17 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

(cherrypicked from b0ae5fadd19fd172ec5154cde4f4fd14aa20ff88)
2019-08-17 20:04:14 +02:00
Riztazz 2caec4f4d2 Revert "[3.3.5][master] Core/Movement: Smooth movement #13467 (#18020)"
This reverts commit 05fb27dae4.

(cherrypicked from a3c6880579f3326088ecbe5b8c08c4b75ed91a59)
2019-08-17 20:04:14 +02:00
Shauren e8e89f58fb Core/DBLayer: Prevent using prepared statements on wrong database 2019-07-27 01:00:37 +02:00
Aokromes 91409cc77e Core/SAI: Add a 5th parameter to SAI events
CP of https://github.com/TrinityCore/TrinityCore/commit/1c60af632888433b29a27bee76e82e96632d4096

By jackpoz
2019-04-30 13:03:49 +02:00
vincent-michael 5620eb9463 Update copyright note for 2019
auto happy = new year(2019);
2019-01-01 10:14:33 +01:00
Shauren 91be2332e2 Core/Entities: Phasing rewrite
* Optimized phase visibility checking
* Handle all phase flags

Closes #16758
Closes #21119
2018-03-25 19:28:36 +03:00
Kittnz 61a838b599 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
(cherry picked from commit 072ea761c6dc9891d0e929f0e618b7ae2327c421)

Tabs
(cherry picked from commit 65e84d2f0a77ec179bc6b0eaae2e4dc6b1daf9ef)
2018-03-18 00:19:39 +01:00
Gustavo bc87d3a2b3 Core/Misc Remove WhiteSpaces (#18379)
(cherry picked from commit 7e0a6166576304b98fac246192cf1ce23c74f915)
2018-03-12 10:32:05 +01:00
Riztazz 05fb27dae4 [3.3.5][master] Core/Movement: Smooth movement #13467 (#18020)
Implement smooth movement for all waypoint pathing and escortai

(cherry picked from commit 28050f338dfc66e0c40b6a3915bf96e38e0613e5)
2018-02-11 15:53:32 +01:00
vincent-michael 7d00ae4045 Update copyright note for 2018
auto happy = new year(2018);
2018-01-01 00:40:17 +01:00
Shauren b453e12423 Core/Game: Include cleanup part 5
* ObjectMgr.h
* Player.h
* Unit.h
* G3D should no longer propagate everywhere from Spline/MotionMaster
2017-06-04 01:00:45 +02:00
Shauren c5d3dd90be Core/Game: Include cleanup
* Mostly aimed at removing Log/DatabaseEnv includes from other headers
* Fix most packet headers including other packet headers - moved common structures such as ItemInstance to their own files
* Moved SAI function definitions to source files (massive or requiring many different dependencies)
2017-05-18 23:53:25 +02:00
Aokromes abc8fe123b Core/SmartAI: Missing parts on previous commit
By Malcrom
2017-03-26 01:07:09 +01:00
Aokromes 464ba05dd4 Core/SmartAI: Add check to SMART_ACTION_PLAY_ANIMKIT to allow zero value to remove animKit.
By Malcrom
2017-03-21 23:27:07 +01:00
Traesh 01ded93a42 Core/AI: enable SmartScripts on Scenes + add scene related actions/events
Closes #19194
2017-03-17 21:21:35 +01:00
Lopfest 61547cab59 Core/SAI: added new action SMART_ACTION_PLAY_ANIMKIT (#19170) 2017-03-11 13:39:38 +01:00
treeston 59d48ce7e4 Core/Movement: Add new SplineChainMovementGenerator that allows accurate replication of sniffed waypoints in static sequences, along with DB facilities that allow loading of waypoints from DB.
(cherry picked from commit 6d00d3f28380dd0811a18913450b1dc4f07fef48)

Merge remote-tracking branch 'Treeston/3.3.5-splinechains' into 3.3.5 (PR #17946)
(cherry picked from commit 20f483967fb3a430fbd54148c08b6d8e8937daac)

Core/Movement: Add a convenience default ctor to SplineChainResumeInfo, and fix PCH build in some configurations (zzz why do we even keep Appveyor and Travis around).
(cherry picked from commit 4fa646c0b2ae3261e7fab249f4177900d4c8d013)

PCH build fix. Again.

(( Alright, you made me waste 20 minutes of my life on a full nonPCH rebuild of the core now. ))
(( I hope you're happy. ))
(cherry picked from commit 4a1a460241acf511467decd92d2a30e19927d74d)
2017-03-01 22:03:35 +01:00
treeston 5654fb9343 Merge branch '3.3.5-goshdangitsmartai' into 3.3.5 (PR #17738)
(cherry picked from commit e9eacae7b2ca3c8899a6ee9c8b8146e21fca54db)

Core/SmartScripts: Add missing break, 5f43e7b follow-up.
(cherry picked from commit a4623efaa67be1cfea19e561be83f118a784b9d1)
2017-02-19 15:07:42 +01:00
Shauren 5dbe9e7890 Core/Creatures: Implemented all creature equipment modifiers
* It is now possible to give creatures a mythic/heroic weapon

Closes #19160
2017-02-19 10:58:08 +01:00
treeston 573cb9d20f AI/SmartScripts: SMART_ACTION_ADD_QUEST -> SMART_ACTION_OFFER_QUEST. Open quest offer instead of adding straight to log - old behavior can be requested using action_param2. Closes #17735.
(cherry picked from commit ba4d6f63936fe3269e6c8b75358bc00a78fd49df)
2017-02-12 16:07:27 +01:00
treeston b18b05ee4a AI/SmartScripts: Add SMART_ACTION_DISABLE_EVADE (117).
(cherry picked from commit 14b44af38d33be0cab4cb081c1f911b20db8884c)
2017-02-12 15:46:58 +01:00
treeston d0f4588652 Core/SmartScripts: Add SMART_TARGET_LOOT_RECIPIENTS. Does what it says on the tin.
Use this new target type to fix The Rider of Blood, The Rider of Frost, The Rider of the Unholy. Closes #17817.

(cherry picked from commit e2c915fb43ae27d695c0ab410fb1b14222745e27)
2017-02-12 15:46:19 +01:00
SnapperRy 3e74109857 Core/SmartAI: change SMART_ACTION_RISE_UP (114) to SMART_ACTION_MOVE_OFFSET and implement offset movement via target fields. (#17362)
(cherry picked from commit ba0cb53b0214ab3625830f7dac3c68d08a97e084)

Rename 9999_99_99_99_world.sql to 2016_07_15_07_world.sql
(cherry picked from commit 2fd124f9a3cbbd81f2ce6c7154d640175ed71452)
2017-02-05 17:45:07 +01:00
Aokromes 927561c4cf DB/Quest: fix availability for some quests
Closes #17371 by SnapperRy
(cherry picked from commit a307157dac691f8b98c80f32993601ceb6739fc2)
2017-01-29 20:45:47 +01:00
ariel- d40c151cc8 Core/Scripts: Extended SMART_ACTION_SET_INST_DATA to also set BossStates. (#16739)
Scripts/Dire Maul: Initialize boss states array so it may be called from SmartAI. (Ref #6429)
(cherry picked from commit d1d0c64ad11cb3faf986a5332fec6b704fb8026c)

# Conflicts:
#	src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
2017-01-29 18:04:10 +01:00
vincent-michael 86b98686a9 Update copyright note for 2017
Happy new year
2017-01-01 16:23:13 +01:00
Shauren 885d9b53c3 Core/DataStores: Updated dbc/db2 to 7.0.1.20994 2016-05-20 23:48:48 +02:00
MitchesD 92b74d6bdc Merge pull request #16523 from tkrokli/smart_action_set_corpse_delay
[3.3.5][6.x]Core/SmartScript: create SMART_ACTION_SET_CORPSE_DELAY
(cherry picked from commit 8e152e0d4a553bdc215d2c7fda41083b5382b235)
2016-04-08 23:51:18 +02:00
Shauren e6e3e799d0 Build fixes 2016-04-02 19:22:30 +02:00
DDuarte 252220ed6e Core/SAI: Code improvements to SMART_ACTION_RANDOM_SOUND
Warning fixes and extra sanity checks

Ref #16376

(cherry picked from commit 77087db79318443fff1b6fe3c91b55a315c5bf92)
2016-04-02 14:52:15 +02:00
Lopfest c457de1e80 Core/SAI: added SMART_ACTION_RANDOM_SOUND
Closes #16376

(cherry picked from commit e4af2baa7e5162b984172d54488137d4c5576d7d)
2016-04-02 14:51:13 +02:00
Naios 329225b40d Core/Game: Move singleton instances into compilation units
* Fixes issues when building shared libraries
  (prevents gcc and clang from providing several instance)
2016-03-11 18:35:49 +01:00
Shauren db0b8bf24e Core/Maps: Changed the way area data is stored in maps, it now uses ID field from AreaTable.dbc instead AreaBit used for exploration marker (and is not unique anymore on top of simply being stupidly confusing)
Note: Extracting maps is required
2016-02-02 19:13:04 +01:00
Vincent-Michael 478cc756eb Update copyright note for 2016
Happy new year (Again new year with idiots ...)
2016-01-01 00:34:25 +01:00
Rushor 58da855925 Core/SAI: Add SMART_ACTION_RISE_UP for Z Axis
* closes #15188
2015-07-30 10:37:02 +02:00
Vincent-Michael 2e586bc520 Core: Header cleanup in game/*/*.cpp 2015-07-25 20:18:42 +02:00
MitchesD d68df33c76 Core/SmartScripts: added new action SMART_ACTION_COMBAT_STOP
* this avoid using hacks like evade, faction change or rooting. I wonder how SAI could be without this
2015-07-24 22:54:15 +02:00