Commit Graph

716 Commits

Author SHA1 Message Date
ariel-
4ab07ae4e1 Core/SmartAI: Allow scripting GameObjects by spawn id too
(cherrypicked from 05d99c5f58)
2019-08-17 20:04:14 +02:00
ariel-
a24cb8a057 Core/Entities: spawned movementtype should override template movementtype
Core/SmartAI: pass the CreatureData pointer (if any) on updating template

(cherrypicked from ff43a74822)

Closes #19223
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 b0ae5fadd1)
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 a3c6880579)
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
xinef1
4f65dc5e20 Core/Misc: Various crash fixes (#19059)
* Replaced some FindPlayer calls with GetPlayer
Fixed some more crashes

* Correction

(cherrypicked from 14dfc377b4)
2019-07-21 21:06:54 +02:00
xinef1
ad008c43b7 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.

(cherrypicked from 86da1a19bb)
2019-07-21 21:06:54 +02:00
ariel-
a29a157e34 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

(cherrypicked from aa7ef797d6)
2019-06-15 18:41:09 +02:00
Shauren
455959c606 Core/PacketIO: Rewrite updatefield handling 2019-06-08 17:06:57 +02:00
Aokromes
91409cc77e Core/SAI: Add a 5th parameter to SAI events
CP of 1c60af6328

By jackpoz
2019-04-30 13:03:49 +02:00
Shauren
ca112b0dae Removed a bunch of "reserved" SAI actions 2019-04-18 00:00:15 +02:00
Aokromes
b28d55b3dc Update SmartScriptMgr.h 2019-04-17 23:51:48 +02:00
Aokromes
0bb8f69164 Core/SmartScripts: Reserve SMART_ACTION_PLAY_CINEMATIC 2019-04-17 22:09:02 +02:00
vincent-michael
5620eb9463 Update copyright note for 2019
auto happy = new year(2019);
2019-01-01 10:14:33 +01:00
Shauren
f94deace76 Merge branch 'bfa' 2018-12-09 14:45:03 +01:00
Rushor
77cb6c1a3f Game/AI: Implement ContactDistance for ACTION_MOVE_TO_POS (#18720)
(cherry-picked from 60d1c0e20d)
2018-12-09 14:18:42 +01:00
Traesh
9d210476e5 Core/Creatures: Update creature model handling with new display scale (#22567) 2018-11-07 20:23:30 +01:00
Shauren
738f37d3cf Core/Maps: Replaced spawnmask with difficulty list 2018-09-15 17:55:26 +02: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 072ea761c6)

Tabs
(cherry picked from commit 65e84d2f0a)
2018-03-18 00:19:39 +01:00
Gustavo
bc87d3a2b3 Core/Misc Remove WhiteSpaces (#18379)
(cherry picked from commit 7e0a616657)
2018-03-12 10:32:05 +01:00
ariel-
4889d78c1a Core/SAI: restore deleted line in 28050f338d
(cherry picked from commit 80073bc368)

Field left uninitialized. Caused weird evade behaviour
2018-03-12 10:31:56 +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 28050f338d)
2018-02-11 15:53:32 +01:00
Shauren
b3f9d5e5af Core/Gossip: Revert renaming/changing types part of 853df91048
Closes #21186
2018-02-01 12:09:58 +01:00
joschiwald
ed318fdc46 Core/Battleground: Dropped battleground texts from trinity_string and replaced them with proper BroadcastText 2018-01-14 18:48:01 +01:00
Mihapro
8199eef81c Core/Misc: Added helper function Unit::SetFullPower
* Also renamed Unit::getPowerType and Unit::setPowerType to follow style guidelines

Ref #20981
2018-01-03 16:39:32 +01:00
vincent-michael
7d00ae4045 Update copyright note for 2018
auto happy = new year(2018);
2018-01-01 00:40:17 +01:00
Ovalord
1b16534e21 Core/Quests: Implemented quest popups 2017-11-28 00:04:03 +01:00
SnapperRy
cc44c5f349 Core/SAI: reset event phase when calling SMART_ACTION_CALL_SCRIPT_RESET.
Now it really does what it says on the tin.

(cherry picked from commit c189e27f39)
2017-11-11 20:47:26 +01:00
SnapperRy
748aab737f Core/SAI: remove wrong DB errors.
It is normal to have events applicable only to certain instance difficulties.

Closes #18082.

(cherry picked from commit c42e32e7e4)
2017-11-05 11:03:57 +01:00
SnapperRy
5c7b821e17 Core/Quest: do not set a quest to failed if it's rewarded or has no status at all (not taken).
(cherry picked from commit 97fd0c1b1a)
2017-10-03 17:22:48 +02:00
SnapperRy
53dde7e2ca 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.

(cherry picked from commit 727f77ec6a)
2017-10-03 15:31:09 +02:00
ariel-
d7c85d7193 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)

(cherry picked from commit 3e596376a7)
2017-09-06 15:35:04 +02:00
ariel-
f65897f3be Core/SmartAI: There's a function for that
(cherry picked from commit e2a8cf6809)
2017-09-05 19:19:21 +02:00
SnapperRy
8cb5368062 Core/SAI: don't reset event phase when npc evades/resets.
The scripts themselves should take care of that.

(cherry picked from commit 5267381e39)
2017-09-05 12:14:15 +02:00
Malcrom
acbc3f5a68 Core/Smartscripts: Add respawn timer to smartscript despawn (#20070) 2017-07-22 22:34:23 +02: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
a0a158b5b8 Core/Scripts: Include cleanup 2017-05-28 16:34:44 +02:00
Shauren
3d7c2ef88f Core/Game: Include cleanup, part 4 - packets and largest headers (after preprocessing, except player/objectmgr) 2017-05-21 23:18:43 +02:00
Gacko
506de19495 Game/SAI: Negate p instead of using abs. 2017-05-19 17:44:43 +02:00
Gacko
82d93f7712 Fix non-PCH build. 2017-05-19 17:38: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
Shauren
9299e9bde0 Core/Grids: Ported cmangos/mangos-wotlk@ea99457e50 2017-05-13 19:37:33 +02:00
joschiwald
2abfaecf0c Core/SAI: Fixed memory leak 2017-05-06 12:27:45 +02:00
Aokromes
abc8fe123b Core/SmartAI: Missing parts on previous commit
By Malcrom
2017-03-26 01:07:09 +01:00
Aokromes
7b7c90d4fb Core/SmartAI: Implement SMART_TARGET_VEHICLE_ACCESSORY
By Malcrom
2017-03-23 04:12:56 +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 6d00d3f283)

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

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 4fa646c0b2)

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 4a1a460241)
2017-03-01 22:03:35 +01:00