Skip to content

Commit

Permalink
add enabled hook lists for performance improvement (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
sudlud authored Feb 22, 2025
1 parent e6bc9b6 commit 99e7088
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/transmog_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,18 @@ class PS_Transmogrification : public PlayerScript
player->UpdatePlayerSetting("mod-transmog", SETTING_RETROACTIVE_CHECK, 1);
}
public:
PS_Transmogrification() : PlayerScript("Player_Transmogrify") { }
PS_Transmogrification() : PlayerScript("Player_Transmogrify", {
PLAYERHOOK_ON_EQUIP,
PLAYERHOOK_ON_LOOT_ITEM,
PLAYERHOOK_ON_CREATE_ITEM,
PLAYERHOOK_ON_AFTER_STORE_OR_EQUIP_NEW_ITEM,
PLAYERHOOK_ON_PLAYER_COMPLETE_QUEST,
PLAYERHOOK_ON_AFTER_SET_VISIBLE_ITEM_SLOT,
PLAYERHOOK_ON_AFTER_MOVE_ITEM_FROM_INVENTORY,
PLAYERHOOK_ON_LOGIN,
PLAYERHOOK_ON_LOGOUT,
PLAYERHOOK_ON_BEFORE_BUY_ITEM_FROM_VENDOR
}) { }

void OnPlayerEquip(Player* player, Item* it, uint8 /*bag*/, uint8 /*slot*/, bool /*update*/) override
{
Expand Down Expand Up @@ -1215,7 +1226,10 @@ class PS_Transmogrification : public PlayerScript
class WS_Transmogrification : public WorldScript
{
public:
WS_Transmogrification() : WorldScript("WS_Transmogrification") { }
WS_Transmogrification() : WorldScript("WS_Transmogrification", {
WORLDHOOK_ON_AFTER_CONFIG_LOAD,
WORLDHOOK_ON_STARTUP
}) { }

void OnAfterConfigLoad(bool reload) override
{
Expand Down Expand Up @@ -1258,7 +1272,10 @@ class WS_Transmogrification : public WorldScript
class global_transmog_script : public GlobalScript
{
public:
global_transmog_script() : GlobalScript("global_transmog_script") { }
global_transmog_script() : GlobalScript("global_transmog_script", {
GLOBALHOOK_ON_ITEM_DEL_FROM_DB,
GLOBALHOOK_ON_MIRRORIMAGE_DISPLAY_ITEM
}) { }

void OnItemDelFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid) override
{
Expand All @@ -1284,7 +1301,10 @@ class global_transmog_script : public GlobalScript
class unit_transmog_script : public UnitScript
{
public:
unit_transmog_script() : UnitScript("unit_transmog_script") { }
unit_transmog_script() : UnitScript("unit_transmog_script", true, {
UNITHOOK_SHOULD_TRACK_VALUES_UPDATE_POS_BY_INDEX,
UNITHOOK_ON_PATCH_VALUES_UPDATE
}) { }

bool ShouldTrackValuesUpdatePosByIndex(Unit const* unit, uint8 /*updateType*/, uint16 index) override
{
Expand Down

0 comments on commit 99e7088

Please sign in to comment.