From c484a433366a1965b99358ca0e54dfe0408ff58d Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Wed, 24 Dec 2025 09:10:34 -0300 Subject: [PATCH 1/3] feat: move collections away from worldserver config reload --- src/Transmogrification.cpp | 24 ++++++++++++++++++++++++ src/Transmogrification.h | 1 + src/cs_transmog.cpp | 20 +++++++++++++++----- src/transmog_scripts.cpp | 22 ++-------------------- 4 files changed, 42 insertions(+), 25 deletions(-) diff --git a/src/Transmogrification.cpp b/src/Transmogrification.cpp index 8f5631a4..aaffdd34 100644 --- a/src/Transmogrification.cpp +++ b/src/Transmogrification.cpp @@ -1247,6 +1247,30 @@ bool Transmogrification::IsPlusFeatureEligible(ObjectGuid const &playerGuid, uin return false; } +void Transmogrification::LoadCollections() +{ + if (sTransmogrification->GetUseCollectionSystem()) + { + LOG_INFO("module", "Loading transmog appearance collection cache...."); + uint32 collectedAppearanceCount = 0; + QueryResult result = CharacterDatabase.Query("SELECT account_id, item_template_id FROM custom_unlocked_appearances"); + if (result) + { + do + { + uint32 accountId = (*result)[0].Get(); + uint32 itemId = (*result)[1].Get(); + if (sTransmogrification->AddCollectedAppearance(accountId, itemId)) + { + collectedAppearanceCount++; + } + } while (result->NextRow()); + } + + LOG_INFO("module", "Loaded {} collected appearances into cache", collectedAppearanceCount); + } +} + bool Transmogrification::GetEnableTransmogInfo() const { return EnableTransmogInfo; diff --git a/src/Transmogrification.h b/src/Transmogrification.h index 409e357e..ca516677 100644 --- a/src/Transmogrification.h +++ b/src/Transmogrification.h @@ -149,6 +149,7 @@ class Transmogrification void LoadPlayerSets(ObjectGuid pGUID); void UnloadPlayerSets(ObjectGuid pGUID); + void LoadCollections(); #endif bool EnableTransmogInfo; diff --git a/src/cs_transmog.cpp b/src/cs_transmog.cpp index fbd72629..c099ca06 100644 --- a/src/cs_transmog.cpp +++ b/src/cs_transmog.cpp @@ -41,11 +41,12 @@ class transmog_commandscript : public CommandScript static ChatCommandTable transmogTable = { - { "add", addCollectionTable }, - { "", HandleDisableTransMogVisual, SEC_PLAYER, Console::No }, - { "sync", HandleSyncTransMogCommand, SEC_PLAYER, Console::No }, - { "portable", HandleTransmogPortableCommand, SEC_PLAYER, Console::No }, - { "interface", HandleInterfaceOption, SEC_PLAYER, Console::No } + { "add", addCollectionTable }, + { "", HandleDisableTransMogVisual, SEC_PLAYER, Console::No }, + { "sync", HandleSyncTransMogCommand, SEC_PLAYER, Console::No }, + { "portable", HandleTransmogPortableCommand, SEC_PLAYER, Console::No }, + { "interface", HandleInterfaceOption, SEC_PLAYER, Console::No }, + { "reload", HandleReloadTransmogConfig, SEC_ADMINISTRATOR, Console::Yes} }; static ChatCommandTable commandTable = @@ -315,6 +316,15 @@ class transmog_commandscript : public CommandScript handler->SendSysMessage(enable ? LANG_CMD_TRANSMOG_VENDOR_INTERFACE_ENABLE : LANG_CMD_TRANSMOG_VENDOR_INTERFACE_DISABLE); return true; } + + static bool HandleReloadTransmogConfig(ChatHandler* handler, bool hide) + { + sTransmogrification->LoadConfig(true); + handler->SendSysMessage("Transmog configs reloaded."); + sTransmogrification->LoadCollections(); + handler->SendSysMessage("Transmog collections reloaded."); + return true; + } }; void AddSC_transmog_commandscript() diff --git a/src/transmog_scripts.cpp b/src/transmog_scripts.cpp index 451327e0..8d8c18bc 100644 --- a/src/transmog_scripts.cpp +++ b/src/transmog_scripts.cpp @@ -1222,26 +1222,8 @@ class WS_Transmogrification : public WorldScript void OnAfterConfigLoad(bool reload) override { - sT->LoadConfig(reload); - if (sT->GetUseCollectionSystem()) - { - LOG_INFO("module", "Loading transmog appearance collection cache...."); - uint32 collectedAppearanceCount = 0; - QueryResult result = CharacterDatabase.Query("SELECT account_id, item_template_id FROM custom_unlocked_appearances"); - if (result) - { - do - { - uint32 accountId = (*result)[0].Get(); - uint32 itemId = (*result)[1].Get(); - if (sT->AddCollectedAppearance(accountId, itemId)) - { - collectedAppearanceCount++; - } - } while (result->NextRow()); - } - LOG_INFO("module", "Loaded {} collected appearances into cache", collectedAppearanceCount); - } + if (!reload) + sT->LoadCollections(); } void OnStartup() override From 609c39bb323af1baed124fbeb1862b87f4e35027 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Wed, 24 Dec 2025 09:11:07 -0300 Subject: [PATCH 2/3] Update cs_transmog.cpp --- src/cs_transmog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cs_transmog.cpp b/src/cs_transmog.cpp index c099ca06..d578bbbe 100644 --- a/src/cs_transmog.cpp +++ b/src/cs_transmog.cpp @@ -317,7 +317,7 @@ class transmog_commandscript : public CommandScript return true; } - static bool HandleReloadTransmogConfig(ChatHandler* handler, bool hide) + static bool HandleReloadTransmogConfig(ChatHandler* handler) { sTransmogrification->LoadConfig(true); handler->SendSysMessage("Transmog configs reloaded."); From 696e6088520a458d94e3df8a6b4589cea8b32f62 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Wed, 24 Dec 2025 09:11:47 -0300 Subject: [PATCH 3/3] Update Transmogrification.cpp --- src/Transmogrification.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Transmogrification.cpp b/src/Transmogrification.cpp index aaffdd34..4b773021 100644 --- a/src/Transmogrification.cpp +++ b/src/Transmogrification.cpp @@ -1261,9 +1261,8 @@ void Transmogrification::LoadCollections() uint32 accountId = (*result)[0].Get(); uint32 itemId = (*result)[1].Get(); if (sTransmogrification->AddCollectedAppearance(accountId, itemId)) - { collectedAppearanceCount++; - } + } while (result->NextRow()); }