fix: Support saving hidden items as part of transmog sets (#102)

This commit is contained in:
ZhengPeiRu21
2022-09-07 21:05:09 -06:00
committed by GitHub
parent e576e69c8e
commit 915aa1672f
2 changed files with 18 additions and 8 deletions

View File

@@ -18,7 +18,7 @@ void Transmogrification::PresetTransmog(Player* player, Item* itemTransmogrified
return;
if (slot >= EQUIPMENT_SLOT_END)
return;
if (!CanTransmogrifyItemWithItem(player, itemTransmogrified->GetTemplate(), sObjectMgr->GetItemTemplate(fakeEntry)))
if (fakeEntry != HIDDEN_ITEM_ID && (!CanTransmogrifyItemWithItem(player, itemTransmogrified->GetTemplate(), sObjectMgr->GetItemTemplate(fakeEntry))))
return;
// [AZTH] Custom
@@ -66,7 +66,7 @@ void Transmogrification::LoadPlayerSets(ObjectGuid pGUID)
LOG_ERROR("module", "Item entry (FakeEntry: {}, player: {}, slot: {}, presetId: {}) has invalid slot, ignoring.", entry, pGUID.ToString(), slot, PresetID);
continue;
}
if (sObjectMgr->GetItemTemplate(entry))
if (entry == HIDDEN_ITEM_ID || sObjectMgr->GetItemTemplate(entry))
presetById[pGUID][PresetID][slot] = entry; // Transmogrification::Preset(presetName, fakeEntry);
}
@@ -238,6 +238,13 @@ std::string Transmogrification::GetItemLink(uint32 entry, WorldSession* session)
{
LOG_DEBUG("module", "Transmogrification::GetItemLink");
if (entry == HIDDEN_ITEM_ID)
{
std::ostringstream oss;
oss << "(Hidden)";
return oss.str();
}
const ItemTemplate* temp = sObjectMgr->GetItemTemplate(entry);
int loc_idx = session->GetSessionDbLocaleIndex();
std::string name = temp->Name1;

View File

@@ -316,12 +316,15 @@ public:
uint32 entry = sT->GetFakeEntry(newItem->GetGUID());
if (!entry)
continue;
const ItemTemplate* temp = sObjectMgr->GetItemTemplate(entry);
if (!temp)
continue;
if (!sT->SuitableForTransmogrification(player, temp))
continue;
cost += sT->GetSpecialPrice(temp);
if (entry != HIDDEN_ITEM_ID)
{
const ItemTemplate* temp = sObjectMgr->GetItemTemplate(entry);
if (!temp)
continue;
if (!sT->SuitableForTransmogrification(player, temp))
continue;
cost += sT->GetSpecialPrice(temp);
}
items[slot] = entry;
}
}