Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/Transmogrification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,29 @@ 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>();
uint32 itemId = (*result)[1].Get<uint32>();
if (sTransmogrification->AddCollectedAppearance(accountId, itemId))
collectedAppearanceCount++;

} while (result->NextRow());
}

LOG_INFO("module", "Loaded {} collected appearances into cache", collectedAppearanceCount);
}
}

bool Transmogrification::GetEnableTransmogInfo() const
{
return EnableTransmogInfo;
Expand Down
1 change: 1 addition & 0 deletions src/Transmogrification.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class Transmogrification

void LoadPlayerSets(ObjectGuid pGUID);
void UnloadPlayerSets(ObjectGuid pGUID);
void LoadCollections();
#endif

bool EnableTransmogInfo;
Expand Down
20 changes: 15 additions & 5 deletions src/cs_transmog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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)
{
sTransmogrification->LoadConfig(true);
handler->SendSysMessage("Transmog configs reloaded.");
sTransmogrification->LoadCollections();
handler->SendSysMessage("Transmog collections reloaded.");
return true;
}
};

void AddSC_transmog_commandscript()
Expand Down
22 changes: 2 additions & 20 deletions src/transmog_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
uint32 itemId = (*result)[1].Get<uint32>();
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
Expand Down