Commit Graph

206 Commits

Author SHA1 Message Date
Wyrserth
88c6c61b95 Core/Script: add script hook to allow overriding of a vehicle passenger's exit position (#23322)
* Core/Script: add script hook to allow overriding of a vehicle passenger's exit position.

* Allow to change orientation, and fix nopch.

* Keep original orientation, thanks jackpoz!

* Update Unit.cpp

Code cleanup

* Update Unit.cpp
2019-05-30 17:35:18 +02:00
Wyrserth
404c4f8091 Core/Scripts: implement a PlayerScript hook called when a quest's objective receives progress (#23286) 2019-05-17 20:38:15 +02:00
ccrs
0eb5d240fa Core/AI: silence a freaking annoying VS IntelliSense warning 2019-05-15 16:42:28 +02:00
Giacomo Pozzoni
5b7ead65bb Core/Scripts: Change PlayerScript and CreatureScript inheritance (#23048)
Remove UnitScript from PlayerScript and CreatureScript classes as that's how the original system that was PR'd worked, see https://github.com/TrinityCore/TrinityCore/pull/7867 for reference.
Please note these are used as global hooks and should really just invoke stateless functions.
If you need to hook methods from PlayerScript/CreatureScript and UnitScript, just define 2 different scripts (this is how the original system worked and how it was designed to work)
2019-02-15 20:29:14 +01:00
Treeston
fcfcb0eb6f Happy New Year, folks. It's 2019! 2019-01-01 15:45:25 +01:00
Treeston
042f5515e4 Core/AI: Clean up charm AI handling, we now have two unique_ptr instead of a crapton of booleans 2018-08-23 16:34:42 +02:00
Treeston
94b5d9bfa1 Core/Spawning: Actually check spawn group state before processing a respawn. It feels like that is something that should've been noticed at some point.
Also remove CreatureScript::CanSpawn since nobody uses it, and spawn groups do the same thing.
2018-02-22 20:31:42 +01:00
Shauren
2fd9dc2edb Core/Scripts: Fixed ENSURE_AI assertion failures when used in Reset()/InitializeAI() hooks with hotswap
Updates #20727
2018-02-05 20:52:19 +01:00
tkrokli
f6b6f57a6d Update copyright note for 2018
Best wishes for the new year.
2018-01-01 01:55:29 +01:00
Treeston
971ed856a4 Core/Scripts: Implemented OnlyOnceAreaTriggerScript (#20288) 2017-09-14 22:53:02 -03:00
Yehonal
4ee16fb536 Core/Scripts: FOR_SCRIPTS macro shouldn't return early (#20187)
FOR_SCRIPTS, insteadof FOR_SCRIPTS_RET, shouldn't return
otherwise methods such as void ScriptMgr::OnPlayerEnterMap(Map* map, Player* player) will end prematurely
2017-08-22 21:24:22 +02:00
r00ty-tc
59db2eeea0 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.
2017-07-31 21:21:04 +02:00
ariel-
85a7d5ce9a Core: ported headers cleanup from master branch 2017-06-19 23:20:06 -03:00
ariel-
3e7b64b2f7 Core/OutdoorPvP: refactor using Position and Quat to pack parameters
- Moved statics to cpp
- Save scriptids into an array
2017-06-11 17:02:01 -03:00
treeston
aeaa8ecfab Fix an issue where CanSpawn would never get invoked on creatures without per-guid script. 2017-05-31 14:03:48 +02:00
ariel-
f913f3bb89 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)
2017-05-01 18:19:36 -03:00
ariel-
b6b59f6c23 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-04-28 18:59:14 -03:00
Aokromes
0999ef0b77 Core/Scripts: Add support for spawn specific C++ scripts
By Krudor
2017-03-26 13:32:28 +02:00
ariel-
eac9c1f0b9 Core/Scripts: fix Nightfall proc chance and reduce it for victims with level above 60
Closes #15734
2017-02-21 22:38:30 -03:00
Kittnz
9d74252e8d Reverting: Game/Scripting: Add OnGameEvent hook for game objects. 2017-02-17 20:30:52 +01:00
Kittnz
343d2c7f91 Game/Scripting: Add OnGameEvent hook for game objects.
Called when specific game event starts
2017-02-17 20:16:22 +01:00
Kittnz
d550ba7392 Game/Scripting: Add OnPlayerRepop hook
Called when a player presses release when he died
2017-02-07 17:28:16 +01:00
sirikfoll
afa8527338 Core/Scripting: Fixed hotswap calling evade mode for dead creatures 2017-01-13 14:26:43 -03:00
tkrokli
6a51a88767 Update Copyright notice for 2017
Happy new year!
2017-01-02 19:52:45 +01:00
ariel-
cbb5c073ce Core/ScriptMgr: use vector instead of list to contain Spell and Aura scripts and hooks 2016-11-14 02:05:51 -03:00
treeston
84cf239fda Various: Fix coverity reported issues. 2016-10-04 13:49:05 +02:00
treeston
6d00d3f283 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. 2016-09-20 00:37:36 +02:00
Naios
79adaf4ee0 Core/Scripts: Fix a crash when adding/removing objects from the map while swapping
* Ref #17833
2016-09-15 15:13:57 +02:00
Rochet2
c52566a888 Core/Scripts: Enhance quest status hook by making it catch more status changes (#17865) 2016-09-09 21:11:36 +02:00
treeston
0c2c88ed50 Fine, this time I actually built it. Promise. 2016-09-09 19:48:31 +02:00
treeston
91c2b3162d Game/Scripting: Follow-up to b3d44d6. Fix script selection for creatures on difficulty > 0. 2016-09-09 19:37:04 +02:00
treeston
b3d44d6c36 Creature/Scripting: Move CreatureAI::CanRespawn to CreatureScript::CanSpawn. Now also applies to initial spawn. Dynamic spawning prep. 2016-09-09 16:21:27 +02:00
Naios
445746c402 Core/Scripting: Fix acquiring of references between script swaps
* Delay unloading of shared libraries to the next update tick
  to prevent crashes in the destructor of the last referenced
  script instance.
* Closes #17557
2016-07-13 21:58:50 +02:00
Naios
d68316fcd2 Core/Scripting: Don't force event cancellation when swapping creatures.
* EventProcessor::KillAllEvents(force = false) should only be used
  by the EventProcessor.
2016-07-03 00:14:22 +02:00
Naios
851c73b3e4 Core/Scripting: Kill pending unit events when swapping AI's 2016-05-01 17:49:37 +02:00
Naios
e82a934387 Core/Scripting: Fix an assertion which was triggered at lazy unloading
* Also fixes 2 warnings
2016-04-12 16:52:29 +02:00
Naios
410cf0dd05 Core/Scripting: Fix loading of spell/aurascripts
* Broken since 9cc97f226d
* There is still a crash when using lazy unloading which I
  will fix in a later commit (this commit should fix at least
  the static build and normal usage of the dynamic build).
* Closes #16948
2016-04-12 15:42:16 +02:00
Naios
498c1e22ca Core/Scripting: Fix another warning when building statically 2016-04-11 22:13:13 +02:00
Naios
eaf102b3c5 Core/Game: Rewrote the ScriptMgr to support script reloading.
* Finally this commit enables dynamic script hotswapping
  and finished the PR #15671.
* Split the storage layout to use optimized storages
  for database bound and unbound scripts.
* Add several unload workers to reload scripts correctly
  -> Requires further investigation.
* Fixes memory leaks in ScriptMgr when dropping invalid scripts.
* Fixes VehicleScripts
* Makes OutdoorPvP scripts reloadable
* Makes InstanceMapScripts reloadable
* Makes CommandScripts reloadable

(cherry picked from commit 9cc97f226d)
2016-04-11 21:42:28 +02:00
Naios
3123c278b9 Core/Game: Add a dynamic script reloader which reloads scripts modules on changes.
* is responsible for registering plain modules.
* requires compilation with the `WITH_DYNAMIC_LINKING` flag.
* requires further support of the ScriptMgr.

(cherry picked from commit bc0f2b6e5a)
2016-04-11 21:42:16 +02:00
Naios
775e0764e8 Core/Game: Move scheduled map scripts counter methods into MapManager
* Since those have nothing to do with core scripts and are
  not wished inside the ScriptMgr

(cherry picked from commit 59e3cf82ac)
2016-04-11 21:40:38 +02:00
Naios
9f61b72679 Core/Game: Converted the game library to a shared library.
* There is still the possibility to static link against game.

(cherry picked from commit bf33159a70)
2016-03-24 02:46:42 +01:00
Naios
96bc31924a CMake: Use inherited dependencies in scripts
* Removes the circular dependency between game <-> scripts
2016-03-18 02:53:00 +01:00
Shauren
5a6db6e84d Core/Misc: Minimize differences between branches in WorldSession::Update
This commit removes OnUnknownPacketReceive script hook - it could never be fired anyway at that point
2016-03-13 00:12:09 +01:00
Naios
b7f936891a Core/Game: Move singleton instances into compilation units
* Fixes issues when building shared libraries
  (prevents gcc and clang from providing several instance)

(cherry picked from commit 329225b40d)
2016-03-11 20:03:12 +01:00
Shauren
7f817a4fc0 Core/Scripts: Fixed calling UnitScript hooks
Closes #16543

(cherry picked from commit f809e5e13e)
2016-02-11 16:36:08 +01:00
treeston
6102a7937d Maps/Instances: Implement handling of CMSG_SET_SAVED_INSTANCE_EXTEND 2016-02-10 19:35:11 +01:00
jackpoz
841ce54a0d Scripts/Commands: Fix ".help" command to show commands in alphabetical order 2016-01-04 23:30:46 +01:00
Rushor
923a368ac7 Update copyright note for 2016 2016-01-01 12:02:33 +01:00
Naios
97dd18cb78 Core/ScriptMgr: Improve commit 155a289f05
(cherry picked from commit 30c421bf57)
2015-11-07 13:10:21 +01:00