mirror of
https://github.com/azerothcore/mod-transmog
synced 2025-11-29 22:48:30 +08:00
feat: Implement Hidden Transmog option (#79)
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.
|
||||
# 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
|
||||
# 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.
|
||||
@@ -43,6 +48,7 @@
|
||||
|
||||
Transmogrification.Enable = 1
|
||||
Transmogrification.UseCollectionSystem = 1
|
||||
Transmogrification.AllowHiddenTransmog = 1
|
||||
Transmogrification.TrackUnusableItems = 1
|
||||
|
||||
Transmogrification.EnableTransmogInfo = 1
|
||||
|
||||
@@ -310,8 +310,12 @@ bool Transmogrification::AddCollectedAppearance(uint32 accountId, uint32 itemId)
|
||||
}
|
||||
|
||||
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);
|
||||
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) {
|
||||
@@ -326,10 +330,10 @@ TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, ObjectGuid
|
||||
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;
|
||||
// slot of the transmogrified item
|
||||
@@ -347,6 +351,12 @@ TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, Item* 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
|
||||
{
|
||||
// Custom
|
||||
@@ -689,6 +699,7 @@ void Transmogrification::LoadConfig(bool reload)
|
||||
IgnoreReqEvent = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqEvent", false);
|
||||
IgnoreReqStats = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqStats", false);
|
||||
UseCollectionSystem = sConfigMgr->GetOption<bool>("Transmogrification.UseCollectionSystem", true);
|
||||
AllowHiddenTransmog = sConfigMgr->GetOption<bool>("Transmogrification.AllowHiddenTransmog", true);
|
||||
TrackUnusableItems = sConfigMgr->GetOption<bool>("Transmogrification.TrackUnusableItems", true);
|
||||
|
||||
IsTransmogEnabled = sConfigMgr->GetOption<bool>("Transmogrification.Enable", true);
|
||||
@@ -764,6 +775,11 @@ bool Transmogrification::GetUseCollectionSystem() const
|
||||
return UseCollectionSystem;
|
||||
};
|
||||
|
||||
bool Transmogrification::GetAllowHiddenTransmog() const
|
||||
{
|
||||
return AllowHiddenTransmog;
|
||||
}
|
||||
|
||||
bool Transmogrification::GetTrackUnusableItems() const
|
||||
{
|
||||
return TrackUnusableItems;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <vector>
|
||||
|
||||
#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
|
||||
|
||||
class Item;
|
||||
@@ -127,6 +128,7 @@ public:
|
||||
bool IgnoreReqStats;
|
||||
|
||||
bool UseCollectionSystem;
|
||||
bool AllowHiddenTransmog;
|
||||
bool TrackUnusableItems;
|
||||
|
||||
bool IsTransmogEnabled;
|
||||
@@ -151,7 +153,7 @@ public:
|
||||
|
||||
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, 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 SuitableForTransmogrification(Player* player, ItemTemplate const* proto) const;
|
||||
// bool CanBeTransmogrified(Item const* item);
|
||||
@@ -176,6 +178,7 @@ public:
|
||||
uint32 GetSetNpcText() const;
|
||||
|
||||
bool GetUseCollectionSystem() const;
|
||||
bool GetAllowHiddenTransmog() const;
|
||||
bool GetTrackUnusableItems() const;
|
||||
[[nodiscard]] bool IsEnabled() const;
|
||||
};
|
||||
|
||||
@@ -373,6 +373,20 @@ public:
|
||||
if (sT->collectionCache.find(accountId) != sT->collectionCache.end())
|
||||
{
|
||||
std::vector<Item*> allowedItems;
|
||||
if (sT->GetAllowHiddenTransmog())
|
||||
{
|
||||
// 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);
|
||||
if (!newItem)
|
||||
@@ -590,7 +604,7 @@ public:
|
||||
{
|
||||
ObjectGuid itemGUID = ObjectGuid::Create<HighGuid::Item>((*result)[0].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->entryMap[playerGUID][itemGUID] = fakeEntry;
|
||||
|
||||
Reference in New Issue
Block a user