feat: Do not show appearance added message for items that cannot ever be transmogged (#91)

This commit is contained in:
ZhengPeiRu21
2022-08-26 12:57:00 -06:00
committed by GitHub
parent 59cd8dc8b7
commit 06d7c88c4d
4 changed files with 13 additions and 2 deletions

View File

@@ -714,6 +714,16 @@ bool Transmogrification::IsAllowedQuality(uint32 quality) const
} }
} }
bool Transmogrification::CanNeverTransmog(ItemTemplate const* itemTemplate)
{
return (itemTemplate->InventoryType == INVTYPE_BAG ||
itemTemplate->InventoryType == INVTYPE_RELIC ||
itemTemplate->InventoryType == INVTYPE_FINGER ||
itemTemplate->InventoryType == INVTYPE_TRINKET ||
itemTemplate->InventoryType == INVTYPE_AMMO ||
itemTemplate->InventoryType == INVTYPE_QUIVER);
}
void Transmogrification::LoadConfig(bool reload) void Transmogrification::LoadConfig(bool reload)
{ {
#ifdef PRESETS #ifdef PRESETS

View File

@@ -146,6 +146,7 @@ public:
bool IsNotAllowed(uint32 entry) const; bool IsNotAllowed(uint32 entry) const;
bool IsAllowedQuality(uint32 quality) const; bool IsAllowedQuality(uint32 quality) const;
bool IsRangedWeapon(uint32 Class, uint32 SubClass) const; bool IsRangedWeapon(uint32 Class, uint32 SubClass) const;
bool CanNeverTransmog(ItemTemplate const* itemTemplate);
void LoadConfig(bool reload); // thread unsafe void LoadConfig(bool reload); // thread unsafe

View File

@@ -133,7 +133,7 @@ public:
if (sTransmogrification->AddCollectedAppearance(accountId, itemId)) if (sTransmogrification->AddCollectedAppearance(accountId, itemId))
{ {
// Notify target of new item in appearance collection // Notify target of new item in appearance collection
if (target && !(target->GetPlayerSetting("mod-transmog", SETTING_HIDE_TRANSMOG).value)) if (target && !(target->GetPlayerSetting("mod-transmog", SETTING_HIDE_TRANSMOG).value) && !sTransmogrification->CanNeverTransmog(itemTemplate))
{ {
ChatHandler(target->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(target->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());
} }

View File

@@ -546,7 +546,7 @@ private:
std::stringstream tempStream; std::stringstream tempStream;
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) && !sT->CanNeverTransmog(itemTemplate);
if (sT->AddCollectedAppearance(accountId, itemId)) if (sT->AddCollectedAppearance(accountId, itemId))
{ {
if (showChatMessage) if (showChatMessage)