mirror of
https://github.com/azerothcore/mod-transmog
synced 2025-11-29 22:48:30 +08:00
Merge remote-tracking branch 'origin/add-transmog-item' into add-transmog-item
This commit is contained in:
@@ -18,6 +18,11 @@
|
|||||||
# If disabled, players must have an item in their bags to use as a transmogrification appearance source.
|
# If disabled, players must have an item in their bags to use as a transmogrification appearance source.
|
||||||
# Default: 1
|
# Default: 1
|
||||||
#
|
#
|
||||||
|
# Transmogrification.AllowHiddenTransmog
|
||||||
|
# Description: Enables/Disables the hiding of equipment through transmog
|
||||||
|
# If enabled, players can select an "invisible" appearance for items at the transmog vendor
|
||||||
|
# Default: 1
|
||||||
|
#
|
||||||
# Transmogrification.TrackUnusableItems
|
# Transmogrification.TrackUnusableItems
|
||||||
# Description: If enabled, appearances are collected even for items that are not suitable for transmogrification.
|
# Description: If enabled, appearances are collected even for items that are not suitable for transmogrification.
|
||||||
# This allows these appearances to be used later if the configuration is changed.
|
# This allows these appearances to be used later if the configuration is changed.
|
||||||
@@ -43,6 +48,7 @@
|
|||||||
|
|
||||||
Transmogrification.Enable = 1
|
Transmogrification.Enable = 1
|
||||||
Transmogrification.UseCollectionSystem = 1
|
Transmogrification.UseCollectionSystem = 1
|
||||||
|
Transmogrification.AllowHiddenTransmog = 1
|
||||||
Transmogrification.TrackUnusableItems = 1
|
Transmogrification.TrackUnusableItems = 1
|
||||||
|
|
||||||
Transmogrification.EnableTransmogInfo = 1
|
Transmogrification.EnableTransmogInfo = 1
|
||||||
|
|||||||
@@ -293,9 +293,29 @@ void Transmogrification::SetFakeEntry(Player* player, uint32 newEntry, uint8 /*s
|
|||||||
UpdateItem(player, itemTransmogrified);
|
UpdateItem(player, itemTransmogrified);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Transmogrification::AddCollectedAppearance(uint32 accountId, uint32 itemId)
|
||||||
|
{
|
||||||
|
if (collectionCache.find(accountId) == collectionCache.end())
|
||||||
|
{
|
||||||
|
collectionCache.insert({accountId, {itemId}});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (std::find(collectionCache[accountId].begin(), collectionCache[accountId].end(), itemId) == collectionCache[accountId].end())
|
||||||
|
{
|
||||||
|
collectionCache[accountId].push_back(itemId);
|
||||||
|
std::sort(collectionCache[accountId].begin(), collectionCache[accountId].end());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, uint32 itemEntry, uint8 slot, /*uint32 newEntry, */bool no_cost) {
|
TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, uint32 itemEntry, uint8 slot, /*uint32 newEntry, */bool no_cost) {
|
||||||
|
if (itemEntry == UINT_MAX) // Hidden transmog
|
||||||
|
{
|
||||||
|
return Transmogrify(player, nullptr, slot, no_cost, true);
|
||||||
|
}
|
||||||
Item* itemTransmogrifier = Item::CreateItem(itemEntry, 1, 0);
|
Item* itemTransmogrifier = Item::CreateItem(itemEntry, 1, 0);
|
||||||
return Transmogrify(player, itemTransmogrifier, slot, no_cost);
|
return Transmogrify(player, itemTransmogrifier, slot, no_cost, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, ObjectGuid itemGUID, uint8 slot, /*uint32 newEntry, */bool no_cost) {
|
TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, ObjectGuid itemGUID, uint8 slot, /*uint32 newEntry, */bool no_cost) {
|
||||||
@@ -310,10 +330,10 @@ TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, ObjectGuid
|
|||||||
return LANG_ERR_TRANSMOG_MISSING_SRC_ITEM;
|
return LANG_ERR_TRANSMOG_MISSING_SRC_ITEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Transmogrify(player, itemTransmogrifier, slot, no_cost);
|
return Transmogrify(player, itemTransmogrifier, slot, no_cost, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, Item* itemTransmogrifier, uint8 slot, /*uint32 newEntry, */bool no_cost)
|
TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, Item* itemTransmogrifier, uint8 slot, /*uint32 newEntry, */bool no_cost, bool hidden_transmog)
|
||||||
{
|
{
|
||||||
int32 cost = 0;
|
int32 cost = 0;
|
||||||
// slot of the transmogrified item
|
// slot of the transmogrified item
|
||||||
@@ -331,6 +351,12 @@ TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, Item* item
|
|||||||
return LANG_ERR_TRANSMOG_MISSING_DEST_ITEM;
|
return LANG_ERR_TRANSMOG_MISSING_DEST_ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hidden_transmog)
|
||||||
|
{
|
||||||
|
SetFakeEntry(player, HIDDEN_ITEM_ID, slot, itemTransmogrified); // newEntry
|
||||||
|
return LANG_ERR_TRANSMOG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (!itemTransmogrifier) // reset look newEntry
|
if (!itemTransmogrifier) // reset look newEntry
|
||||||
{
|
{
|
||||||
// Custom
|
// Custom
|
||||||
@@ -673,6 +699,7 @@ void Transmogrification::LoadConfig(bool reload)
|
|||||||
IgnoreReqEvent = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqEvent", false);
|
IgnoreReqEvent = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqEvent", false);
|
||||||
IgnoreReqStats = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqStats", false);
|
IgnoreReqStats = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqStats", false);
|
||||||
UseCollectionSystem = sConfigMgr->GetOption<bool>("Transmogrification.UseCollectionSystem", true);
|
UseCollectionSystem = sConfigMgr->GetOption<bool>("Transmogrification.UseCollectionSystem", true);
|
||||||
|
AllowHiddenTransmog = sConfigMgr->GetOption<bool>("Transmogrification.AllowHiddenTransmog", true);
|
||||||
TrackUnusableItems = sConfigMgr->GetOption<bool>("Transmogrification.TrackUnusableItems", true);
|
TrackUnusableItems = sConfigMgr->GetOption<bool>("Transmogrification.TrackUnusableItems", true);
|
||||||
|
|
||||||
IsTransmogEnabled = sConfigMgr->GetOption<bool>("Transmogrification.Enable", true);
|
IsTransmogEnabled = sConfigMgr->GetOption<bool>("Transmogrification.Enable", true);
|
||||||
@@ -748,6 +775,11 @@ bool Transmogrification::GetUseCollectionSystem() const
|
|||||||
return UseCollectionSystem;
|
return UseCollectionSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool Transmogrification::GetAllowHiddenTransmog() const
|
||||||
|
{
|
||||||
|
return AllowHiddenTransmog;
|
||||||
|
}
|
||||||
|
|
||||||
bool Transmogrification::GetTrackUnusableItems() const
|
bool Transmogrification::GetTrackUnusableItems() const
|
||||||
{
|
{
|
||||||
return TrackUnusableItems;
|
return TrackUnusableItems;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#define PRESETS // comment this line to disable preset feature totally
|
#define PRESETS // comment this line to disable preset feature totally
|
||||||
|
#define HIDDEN_ITEM_ID 1 // used for hidden transmog - do not use a valid equipment ID
|
||||||
#define MAX_OPTIONS 25 // do not alter
|
#define MAX_OPTIONS 25 // do not alter
|
||||||
|
|
||||||
class Item;
|
class Item;
|
||||||
@@ -59,8 +60,10 @@ public:
|
|||||||
typedef std::unordered_map<ObjectGuid, ObjectGuid> transmogData;
|
typedef std::unordered_map<ObjectGuid, ObjectGuid> transmogData;
|
||||||
typedef std::unordered_map<ObjectGuid, uint32> transmog2Data;
|
typedef std::unordered_map<ObjectGuid, uint32> transmog2Data;
|
||||||
typedef std::unordered_map<ObjectGuid, transmog2Data> transmogMap;
|
typedef std::unordered_map<ObjectGuid, transmog2Data> transmogMap;
|
||||||
|
typedef std::unordered_map<uint32, std::vector<uint32>> collectionCacheMap;
|
||||||
transmogMap entryMap; // entryMap[pGUID][iGUID] = entry
|
transmogMap entryMap; // entryMap[pGUID][iGUID] = entry
|
||||||
transmogData dataMap; // dataMap[iGUID] = pGUID
|
transmogData dataMap; // dataMap[iGUID] = pGUID
|
||||||
|
collectionCacheMap collectionCache;
|
||||||
|
|
||||||
#ifdef PRESETS
|
#ifdef PRESETS
|
||||||
bool EnableSetInfo;
|
bool EnableSetInfo;
|
||||||
@@ -127,6 +130,7 @@ public:
|
|||||||
bool IgnoreReqStats;
|
bool IgnoreReqStats;
|
||||||
|
|
||||||
bool UseCollectionSystem;
|
bool UseCollectionSystem;
|
||||||
|
bool AllowHiddenTransmog;
|
||||||
bool TrackUnusableItems;
|
bool TrackUnusableItems;
|
||||||
|
|
||||||
bool IsTransmogEnabled;
|
bool IsTransmogEnabled;
|
||||||
@@ -147,10 +151,11 @@ public:
|
|||||||
void UpdateItem(Player* player, Item* item) const;
|
void UpdateItem(Player* player, Item* item) const;
|
||||||
void DeleteFakeEntry(Player* player, uint8 slot, Item* itemTransmogrified, CharacterDatabaseTransaction* trans = nullptr);
|
void DeleteFakeEntry(Player* player, uint8 slot, Item* itemTransmogrified, CharacterDatabaseTransaction* trans = nullptr);
|
||||||
void SetFakeEntry(Player* player, uint32 newEntry, uint8 slot, Item* itemTransmogrified);
|
void SetFakeEntry(Player* player, uint32 newEntry, uint8 slot, Item* itemTransmogrified);
|
||||||
|
bool AddCollectedAppearance(uint32 accountId, uint32 itemId);
|
||||||
|
|
||||||
TransmogAcoreStrings Transmogrify(Player* player, ObjectGuid itemGUID, uint8 slot, /*uint32 newEntry, */bool no_cost = false);
|
TransmogAcoreStrings Transmogrify(Player* player, ObjectGuid itemGUID, uint8 slot, /*uint32 newEntry, */bool no_cost = false);
|
||||||
TransmogAcoreStrings Transmogrify(Player* player, uint32 itemEntry, uint8 slot, /*uint32 newEntry, */bool no_cost = false);
|
TransmogAcoreStrings Transmogrify(Player* player, uint32 itemEntry, uint8 slot, /*uint32 newEntry, */bool no_cost = false);
|
||||||
TransmogAcoreStrings Transmogrify(Player* player, Item* itemTransmogrifier, uint8 slot, /*uint32 newEntry, */bool no_cost = false);
|
TransmogAcoreStrings Transmogrify(Player* player, Item* itemTransmogrifier, uint8 slot, /*uint32 newEntry, */bool no_cost = false, bool hidden_transmog = false);
|
||||||
bool CanTransmogrifyItemWithItem(Player* player, ItemTemplate const* destination, ItemTemplate const* source) const;
|
bool CanTransmogrifyItemWithItem(Player* player, ItemTemplate const* destination, ItemTemplate const* source) const;
|
||||||
bool SuitableForTransmogrification(Player* player, ItemTemplate const* proto) const;
|
bool SuitableForTransmogrification(Player* player, ItemTemplate const* proto) const;
|
||||||
// bool CanBeTransmogrified(Item const* item);
|
// bool CanBeTransmogrified(Item const* item);
|
||||||
@@ -175,6 +180,7 @@ public:
|
|||||||
uint32 GetSetNpcText() const;
|
uint32 GetSetNpcText() const;
|
||||||
|
|
||||||
bool GetUseCollectionSystem() const;
|
bool GetUseCollectionSystem() const;
|
||||||
|
bool GetAllowHiddenTransmog() const;
|
||||||
bool GetTrackUnusableItems() const;
|
bool GetTrackUnusableItems() const;
|
||||||
[[nodiscard]] bool IsEnabled() const;
|
[[nodiscard]] bool IsEnabled() const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Cant transmogrify rediculus items // Foereaper: would be fun to stab people with
|
|||||||
|
|
||||||
#include "Transmogrification.h"
|
#include "Transmogrification.h"
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
|
#include "ItemTemplate.h"
|
||||||
|
|
||||||
#define sT sTransmogrification
|
#define sT sTransmogrification
|
||||||
#define GTS session->GetAcoreString // dropped translation support, no one using?
|
#define GTS session->GetAcoreString // dropped translation support, no one using?
|
||||||
@@ -358,9 +359,6 @@ public:
|
|||||||
{
|
{
|
||||||
sendGossip = false;
|
sendGossip = false;
|
||||||
|
|
||||||
std::string query = "SELECT item_template_id FROM custom_unlocked_appearances WHERE account_id = " + std::to_string(player->GetSession()->GetAccountId()) + " ORDER BY item_template_id";
|
|
||||||
session->GetQueryProcessor().AddCallback(CharacterDatabase.AsyncQuery(query).WithCallback([=](QueryResult result)
|
|
||||||
{
|
|
||||||
uint16 pageNumber = 0;
|
uint16 pageNumber = 0;
|
||||||
uint32 startValue = 0;
|
uint32 startValue = 0;
|
||||||
uint32 endValue = MAX_OPTIONS - 3;
|
uint32 endValue = MAX_OPTIONS - 3;
|
||||||
@@ -371,11 +369,25 @@ public:
|
|||||||
startValue = (pageNumber * (MAX_OPTIONS - 2));
|
startValue = (pageNumber * (MAX_OPTIONS - 2));
|
||||||
endValue = (pageNumber + 1) * (MAX_OPTIONS - 2) - 1;
|
endValue = (pageNumber + 1) * (MAX_OPTIONS - 2) - 1;
|
||||||
}
|
}
|
||||||
if (result)
|
uint32 accountId = player->GetSession()->GetAccountId();
|
||||||
|
if (sT->collectionCache.find(accountId) != sT->collectionCache.end())
|
||||||
{
|
{
|
||||||
std::vector<Item*> allowedItems;
|
std::vector<Item*> allowedItems;
|
||||||
do {
|
if (sT->GetAllowHiddenTransmog())
|
||||||
uint32 newItemEntryId = (*result)[0].Get<uint32>();
|
{
|
||||||
|
// Offset the start and end values to make space for invisible item entry
|
||||||
|
endValue--;
|
||||||
|
if (pageNumber != 0)
|
||||||
|
{
|
||||||
|
startValue--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Add invisible item entry
|
||||||
|
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Hide Slot", slot, UINT_MAX, "You are hiding the item in this slot.\nDo you wish to continue?\n\n" + lineEnd, 0, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (uint32 newItemEntryId : sT->collectionCache[accountId]) {
|
||||||
Item* newItem = Item::CreateItem(newItemEntryId, 1, 0);
|
Item* newItem = Item::CreateItem(newItemEntryId, 1, 0);
|
||||||
if (!newItem)
|
if (!newItem)
|
||||||
continue;
|
continue;
|
||||||
@@ -384,7 +396,7 @@ public:
|
|||||||
if (sT->GetFakeEntry(oldItem->GetGUID()) == newItem->GetEntry())
|
if (sT->GetFakeEntry(oldItem->GetGUID()) == newItem->GetEntry())
|
||||||
continue;
|
continue;
|
||||||
allowedItems.push_back(newItem);
|
allowedItems.push_back(newItem);
|
||||||
} while (result->NextRow());
|
}
|
||||||
for (uint32 i = startValue; i <= endValue; i++)
|
for (uint32 i = startValue; i <= endValue; i++)
|
||||||
{
|
{
|
||||||
if (allowedItems.empty() || i > allowedItems.size() - 1)
|
if (allowedItems.empty() || i > allowedItems.size() - 1)
|
||||||
@@ -421,7 +433,6 @@ public:
|
|||||||
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/PaperDollInfoFrame/UI-GearManager-Undo:30:30:-18:0|tUpdate menu", EQUIPMENT_SLOT_END, slot);
|
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/PaperDollInfoFrame/UI-GearManager-Undo:30:30:-18:0|tUpdate menu", EQUIPMENT_SLOT_END, slot);
|
||||||
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|tBack...", EQUIPMENT_SLOT_END + 1, 0);
|
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "|TInterface/ICONS/Ability_Spy:30:30:-18:0|tBack...", EQUIPMENT_SLOT_END + 1, 0);
|
||||||
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
|
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -476,6 +487,14 @@ public:
|
|||||||
class PS_Transmogrification : public PlayerScript
|
class PS_Transmogrification : public PlayerScript
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
void AddToDatabase(Player* player, Item* item)
|
||||||
|
{
|
||||||
|
if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE) || item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE))
|
||||||
|
return;
|
||||||
|
ItemTemplate const* itemTemplate = item->GetTemplate();
|
||||||
|
AddToDatabase(player, itemTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
void AddToDatabase(Player* player, ItemTemplate const* itemTemplate)
|
void AddToDatabase(Player* player, ItemTemplate const* itemTemplate)
|
||||||
{
|
{
|
||||||
if (!sT->GetTrackUnusableItems() && !sT->SuitableForTransmogrification(player, itemTemplate))
|
if (!sT->GetTrackUnusableItems() && !sT->SuitableForTransmogrification(player, itemTemplate))
|
||||||
@@ -489,16 +508,12 @@ private:
|
|||||||
tempStream << std::hex << ItemQualityColors[itemTemplate->Quality];
|
tempStream << std::hex << ItemQualityColors[itemTemplate->Quality];
|
||||||
std::string itemQuality = tempStream.str();
|
std::string itemQuality = tempStream.str();
|
||||||
bool showChatMessage = !(player->GetPlayerSetting("mod-transmog", SETTING_HIDE_TRANSMOG).value);
|
bool showChatMessage = !(player->GetPlayerSetting("mod-transmog", SETTING_HIDE_TRANSMOG).value);
|
||||||
std::string query = "SELECT account_id, item_template_id FROM custom_unlocked_appearances WHERE account_id = " + std::to_string(accountId) + " AND item_template_id = " + std::to_string(itemId);
|
if (sT->AddCollectedAppearance(accountId, itemId))
|
||||||
player->GetSession()->GetQueryProcessor().AddCallback(CharacterDatabase.AsyncQuery(query).WithCallback([=](QueryResult result)
|
|
||||||
{
|
|
||||||
if (!result)
|
|
||||||
{
|
{
|
||||||
if (showChatMessage)
|
if (showChatMessage)
|
||||||
ChatHandler(player->GetSession()).PSendSysMessage( R"(|c%s|Hitem:%u:0:0:0:0:0:0:0:0|h[%s]|h|r has been added to your appearance collection.)", itemQuality.c_str(), itemId, itemName.c_str());
|
ChatHandler(player->GetSession()).PSendSysMessage( R"(|c%s|Hitem:%u:0:0:0:0:0:0:0:0|h[%s]|h|r has been added to your appearance collection.)", itemQuality.c_str(), itemId, itemName.c_str());
|
||||||
CharacterDatabase.Execute( "INSERT INTO custom_unlocked_appearances (account_id, item_template_id) VALUES ({}, {})", accountId, itemId);
|
CharacterDatabase.Execute( "INSERT INTO custom_unlocked_appearances (account_id, item_template_id) VALUES ({}, {})", accountId, itemId);
|
||||||
}
|
}
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
PS_Transmogrification() : PlayerScript("Player_Transmogrify") { }
|
PS_Transmogrification() : PlayerScript("Player_Transmogrify") { }
|
||||||
@@ -507,8 +522,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (!sT->GetUseCollectionSystem())
|
if (!sT->GetUseCollectionSystem())
|
||||||
return;
|
return;
|
||||||
ItemTemplate const* pProto = it->GetTemplate();
|
AddToDatabase(player, it);
|
||||||
AddToDatabase(player, pProto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnLootItem(Player* player, Item* item, uint32 /*count*/, ObjectGuid /*lootguid*/) override
|
void OnLootItem(Player* player, Item* item, uint32 /*count*/, ObjectGuid /*lootguid*/) override
|
||||||
@@ -517,7 +531,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
if (item->GetTemplate()->Bonding == ItemBondingType::BIND_WHEN_PICKED_UP || item->IsSoulBound())
|
if (item->GetTemplate()->Bonding == ItemBondingType::BIND_WHEN_PICKED_UP || item->IsSoulBound())
|
||||||
{
|
{
|
||||||
AddToDatabase(player, item->GetTemplate());
|
AddToDatabase(player, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,7 +541,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
if (item->GetTemplate()->Bonding == ItemBondingType::BIND_WHEN_PICKED_UP || item->IsSoulBound())
|
if (item->GetTemplate()->Bonding == ItemBondingType::BIND_WHEN_PICKED_UP || item->IsSoulBound())
|
||||||
{
|
{
|
||||||
AddToDatabase(player, item->GetTemplate());
|
AddToDatabase(player, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,7 +551,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
if (item->GetTemplate()->Bonding == ItemBondingType::BIND_WHEN_PICKED_UP || item->IsSoulBound())
|
if (item->GetTemplate()->Bonding == ItemBondingType::BIND_WHEN_PICKED_UP || item->IsSoulBound())
|
||||||
{
|
{
|
||||||
AddToDatabase(player, item->GetTemplate());
|
AddToDatabase(player, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,7 +604,7 @@ public:
|
|||||||
{
|
{
|
||||||
ObjectGuid itemGUID = ObjectGuid::Create<HighGuid::Item>((*result)[0].Get<uint32>());
|
ObjectGuid itemGUID = ObjectGuid::Create<HighGuid::Item>((*result)[0].Get<uint32>());
|
||||||
uint32 fakeEntry = (*result)[1].Get<uint32>();
|
uint32 fakeEntry = (*result)[1].Get<uint32>();
|
||||||
if (sObjectMgr->GetItemTemplate(fakeEntry))
|
if (fakeEntry == HIDDEN_ITEM_ID || sObjectMgr->GetItemTemplate(fakeEntry))
|
||||||
{
|
{
|
||||||
sT->dataMap[itemGUID] = playerGUID;
|
sT->dataMap[itemGUID] = playerGUID;
|
||||||
sT->entryMap[playerGUID][itemGUID] = fakeEntry;
|
sT->entryMap[playerGUID][itemGUID] = fakeEntry;
|
||||||
@@ -637,6 +651,25 @@ public:
|
|||||||
void OnAfterConfigLoad(bool reload) override
|
void OnAfterConfigLoad(bool reload) override
|
||||||
{
|
{
|
||||||
sT->LoadConfig(reload);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnStartup() override
|
void OnStartup() override
|
||||||
|
|||||||
Reference in New Issue
Block a user