Commit Graph

101 Commits

Author SHA1 Message Date
Stefano Borzì
e5e514bbbe feat(Core/Scripting): add OnBeforeArenaCheckWinConditions hook for mod-arena-replay compatibility (#19856) 2024-09-04 10:33:38 -03:00
Benjamin Jackson
1edac37ac3 refactor(Core): Make more use of helpers. (#19835)
* Init.

* Reword.

* Update codestyle script.

Co-Authored-By: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

* Add gameobject type ID check, reorder checks.

* Add helper/codestyle check for unit type.

* `IsUnit()` -> `IsCreature()`

* Add `IsUnit()` method.

* Use type mask.

https: //github.com/TrinityCore/TrinityCore/commit/cc71da35b5dc74abf71f8691161525a23d870bb5
Co-Authored-By: Giacomo Pozzoni <giacomopoz@gmail.com>
Co-Authored-By: Ovahlord <18347559+Ovahlord@users.noreply.github.com>

* Replace instances of `isType` with `IsUnit`.

---------

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>
Co-authored-by: Ovahlord <18347559+Ovahlord@users.noreply.github.com>
2024-09-03 14:41:31 -03:00
ianmeesters
a83cd03bfb feat(Core/Player): add OnCalculateTalentsPoints hook (#19749)
* playerTalentsHook

* oeps :#

* :#

* does this work?

* make reference

---------

Co-authored-by: Amy Fang <amy@cavemail.ddns.net>
2024-08-30 09:06:07 -03:00
Kitzunu
f0e6b0f1ab chore(Core/GameObjectAI): Cleanup register macro (#19409) 2024-07-17 00:17:49 +02:00
sudlud
60be029e4c fix(Core/Scripting): fix OnBeforeCreateInstanceScript hook (#19252)
- to me this hook should obviously provide an option to overwrite
  the InstanceScript pointer
- this is e.g. beeing used by mod-eluna (but currently broken)
2024-07-03 14:54:45 -03:00
AnchyDev
e0cf15db93 fix(Scripts/Misc) CanExecuteCommand renamed and moved to be executed for all commands. (#19081)
* Fix CanExecuteCommand only being executed on command failure.

* Updated for style guide.

* Removed pointless hook call.

* Modified the name of the hook to better reflect function and moved the call to trigger for non-existent commands.

* Updated to OnTryExecuteCommand because Foe has a special place in my heart.

* Forgot to change these 2 areas.
2024-06-17 21:39:11 +02:00
silviu20092
3988e9581d feat(core): add hooks for applying item mods (#18760) 2024-05-18 10:02:57 +02:00
天鹿
f203b1b9dc fix(Scripts/PlayerScript): PlayerScript Error (#18806)
Update PlayerScript.cpp
2024-04-29 02:31:14 -03:00
Anton Popovichenko
c796d9291e fix(Core/PlayerScript): Fix adding XP on quest completion and other overlooks. (#18728)
* fix(Core/PlayerScript): Fix adding XP on quest completion.

* Fix other overlooks.
2024-04-12 12:12:57 -03:00
天鹿
0e1888ac92 feat(Core/Scripts): Optimize AchievementScript (#18705)
* Add files via upload

* Update AchievementScript.h
2024-04-12 11:00:31 -03:00
天鹿
b3a332f57c feat(Core/Scripts): Optimize AllBattlegroundScript (#18704)
* Add files via upload

* Update AllBattlegroundScript.h
2024-04-12 11:00:16 -03:00
天鹿
a4af83b277 feat(Core/Scripts): Optimize AllCommandScript (#18703)
* Add files via upload

* Update AllCommandScript.h
2024-04-12 10:59:56 -03:00
天鹿
d87af54675 feat(Core/Scripts): Optimize AllSpellScript (#18702)
* Add files via upload

* Update AllSpellScript.h
2024-04-12 10:59:37 -03:00
天鹿
170817e66d feat(Core/Scripts): Optimize GameEventScript (#18711)
* Add files via upload

* Update GameEventScript.h
2024-04-12 10:56:46 -03:00
天鹿
a2c867fcf2 feat(Core/Scripts): Optimize GroupScript (#18713)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update GroupScript.h
2024-04-12 10:56:31 -03:00
天鹿
e2a07cf9b7 feat(Core/Scripts): Optimize GuildScript (#18714)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update GuildScript.h
2024-04-12 10:56:12 -03:00
天鹿
1ecce50e06 feat(Core/Scripts): Optimize LootScript (#18715)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update LootScript.h
2024-04-12 10:55:54 -03:00
天鹿
9464068625 feat(Core/Scripts): Optimize MailScript (#18716)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update MailScript.h
2024-04-12 10:55:35 -03:00
天鹿
e4cae908fa feat(Core/Scripts): Optimize MiscScript (#18719)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update MiscScript.h
2024-04-12 10:55:18 -03:00
天鹿
574bdc2869 feat(Core/Scripts): Optimize PetScript (#18720)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update PetScript.h
2024-04-12 10:55:04 -03:00
天鹿
55233dd17b feat(Core/Scripts): Optimize ServerScript (#18721)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update ServerScript.h
2024-04-12 10:54:35 -03:00
天鹿
8d20a25e96 feat(Core/Scripts): Optimize UnitScript (#18722)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update UnitScript.h
2024-04-12 10:54:20 -03:00
天鹿
83c4562f3d feat(Core/Scripts): Optimize WorldObjectScript (#18723)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update WorldObjectScript.h
2024-04-12 10:53:59 -03:00
天鹿
d162817d33 feat(Core/Scripts): Optimize WorldScript (#18724)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update WorldScript.h

* Update ScriptMgr.cpp
2024-04-12 10:53:42 -03:00
天鹿
130044fb01 feat(Core/Scripts): Optimize GlobalScript (#18712)
* Add files via upload

* Update GlobalScript.h
2024-04-12 10:53:26 -03:00
天鹿
f0a21100c5 feat(Core/Scripts): Optimize FormulaScript (#18710)
* Add files via upload

* Update FormulaScript.h
2024-04-12 10:53:08 -03:00
天鹿
bf4f9774c1 feat(Core/Scripts): Optimize DatabaseScript (#18709)
Add files via upload
2024-04-12 10:52:43 -03:00
天鹿
97fc546c4b refactor(Core/Scripts): Optimize Script (#18708)
* Add files via upload

* Update PlayerScript.h
2024-04-12 10:50:44 -03:00
Anton Popovichenko
3a6231cb65 fix(Core/Scripts): Fix build and crash when calling uninitialized scripts (#18718)
fix(Core/Scripts): Fix build and crash when calling uninitialized scripts.
2024-04-12 07:13:37 -03:00
天鹿
f05200fcca feat(Core/Scripts): Optimize AuctionHouseScript need#18672 (#18698)
Add files via upload
2024-04-11 17:10:02 -03:00
天鹿
33592f93cf feat(Core/Scripts): Optimize ArenaTeamScript need#18672 (#18699)
Add files via upload
2024-04-11 17:09:47 -03:00
天鹿
e28a432fa2 feat(Core/Scripts): Optimize ArenaScript need#18672 (#18700)
Add files via upload
2024-04-11 17:09:32 -03:00
天鹿
bcf1ffa9f5 feat(Core/Scripts): Optimize MovementHandlerScript need#18672 (#18701)
* Add files via upload

* Add files via upload
2024-04-11 17:09:17 -03:00
天鹿
83c4382c70 feat(Core/Scripts): Optimize AccountScript need#18672 (#18697)
Add files via upload
2024-04-11 17:09:02 -03:00
Anton Popovichenko
f792b0d708 feat(Core/Scripts): Optimize PlayerScripts by calling only overridden/implemented functions. (#18672)
* feat(Core/Scripts): Optimize PlayerScripts by calling only overridden/implemented functions.

* Fix codestyle.

* Fix typo

* PLAYERHOOK_END is not a hook

* Address code review feedback.

Co-authored-by: Winfidonarleyan <dowlandtop@yandex.com>

* Codestyle fixes

* Fix typo



Co-authored-by: PkllonG

---------

Co-authored-by: Winfidonarleyan <dowlandtop@yandex.com>
2024-04-11 17:08:30 -03:00
Anton Popovichenko
1f640c9872 feat(Core/Optimization): Optimize build of units update object by leveraging cache (#18637)
* feat(Core/Optimization): Optimize build of units update object by leveraging cache.

* Remove whitespaces.

* Add alternative hooks to handle transmog and other similar things.

* Fix build on some compilers.

* Fix codestyle

* Fix build again.

* Take into account updateType.
2024-04-05 08:03:11 +02:00
Elmsroth
b1cf830009 chore(PlayerScript/Hook) : Add CanSetTradeItem Hook in PlayerScript (#18583)
* chore(PlayerScript/Hook) : Add CanSetTradeItem Hook in PlayerScript

* Allowing non traded slots

* Fix typo and codestyle
2024-03-26 21:28:37 -03:00
silviu20092
5b8bc792b8 feat(core): account delete hook (#18605)
Add account delete hook
2024-03-26 20:57:42 -03:00
Mykhailo Redko
86bff27611 fix(Core/GameObject): Remove unneeded ClearGossipMenuFor call (#18331) 2024-02-18 11:21:52 +01:00
AnchyDev
1d8c4056b3 feat(Core/Hooks): Add the KillRewarder reference to the OnRewardKillRewarder hook. (#18290)
* Another hackfix attempt at warden payload forcechecks ban fix.

* Revert last commit, interrupt all forcechecks instead of just _dataSent ones.

* Add rewarder parameter to OnRewardKillRewarder hook.

* Undo old warden changes.

* Removed too much!
2024-02-10 21:58:49 +01:00
Nathan Handley
df33a57b78 feat(Core/Unit): New helper IsClass and script hook OnPlayerIsClass (#18243)
* Class Comparison Logic Encapsulation - Parity

* Add Context to IsClass

* Add Unit IsClass script hook

* Replace additional getClass with IsClass

* Update CanUseItem to replace getClass with IsClass

* Add separate context for pet vs ability

* Change Create to Init since not all referenced contexts are creation

* Align spacing in ClassContext

* Drop context on LFGManager max power

* Update IsClass context that wraps around Missle Barrage

* Rename context for swapping weapons

* Be more specific than CLASS_CONTEXT_TALENT

* Remove duplicate context

* Moved IsClass Hook to Player

* Removed unused parameter in virtual base function

* Added maybe_unused to IsClass virtual in order to compile

To match the override signature, the virtual base needs to include the parameter in question, so using [maybe_unused] to signal to the compiler to allow it

* Remove extra blank line

* Add ABILITY_REACTIVE context

* Add context for PET_CHARM

* Remove explicit nullopt check per review

* Code Readability - Change if to if else in pet

Due to the return pattern, this doesn't change functionality in any way

* Add OnPlayer to disambiguate

---------

Co-authored-by: NathanHandley <nathanhandley@protonmail.com>
2024-02-10 12:25:00 -03:00
Nathan Handley
425a490a7b feat(Core/Unit): New helper HasActivePowerType and script hook OnPlayerHasActivePowerType (#18293)
* Create HasActivePower for script intercept

* Replace relevant player-related getPowerType() comparators with HasActivePowerType

* Change OnPlayerHasActivePowerType to regular bool instead of optional

---------

Co-authored-by: NathanHandley <nathanhandley@protonmail.com>
2024-02-09 06:27:02 -03:00
Nathan Handley
4321b8a4de feat(Core/Scripting): Implement new hook OnBeforePlayerLogout() (#18163)
* new hook OnPlayerPreLogout

* Changed PreLogout to BeforeLogout per review

* Renamed OnPlayerBeforeLogout to OnBeforePlayerLogout per review

---------

Co-authored-by: NathanHandley <nathanhandley@protonmail.com>
2024-01-14 00:10:49 +01:00
avarishd
f476c8a6c9 feat(Core/Hooks): Add OnPlayerJustDied hook (#17973)
feat(Core/Hooks): Add OnPlayerJustDied
2023-12-10 19:06:23 -03:00
Tristan 'Natrist' Cormier
ac676f87ab chore(Core/Player): remove unused AnticheatSetSkipOnePacketForASH() function (#17947) 2023-12-09 01:09:52 +01:00
Andrew
0fa6a67815 feat(Core/Scripting): Implement AfterInstanceGameObjectCreate() global hook (#17935) 2023-12-03 18:04:16 -03:00
Winfidonarleyan
eb1ecc38a5 feat(Core/Scripting): move all script objects to separated files (#17860)
* feat(Core/Scripts): move all script objects to separated files

* Apply 5bfeabde81

* try gcc build

* again
2023-12-02 21:13:20 +01:00
Kitzunu
5bfeabde81 chore(Core/Misc): rename spellInfo pointers (#17914)
* Rename all
2023-12-02 06:03:15 -03:00
KJack
48a43c7f44 fix(Core/Creature): Resolve issue with dialog options randomly not working (#17596)
Remove unneeded ClearGossipMenuFor
2023-11-08 19:33:03 -03:00
KJack
f417a166bc feat(Core/Scripts): added OnAfterSpecSlotChanged hook (#17637) 2023-11-07 23:46:08 +07:00