From 21f5eaf3dbddf6d370ac33319c294abdea9966bc Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Sat, 17 Aug 2024 04:54:46 -0300 Subject: [PATCH] fix: Fix logic and improve readibility (#164) --- src/Transmogrification.cpp | 4 ++-- src/Transmogrification.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Transmogrification.cpp b/src/Transmogrification.cpp index d57ab669..5637b07c 100644 --- a/src/Transmogrification.cpp +++ b/src/Transmogrification.cpp @@ -798,7 +798,7 @@ bool Transmogrification::SuitableForTransmogrification(Player* player, ItemTempl return false; } - if (!IgnoreReqLevel && IsPlusFeatureEligible(player->GetGUID(), PLUS_FEATURE_SKIP_LEVEL_REQ) && player->GetLevel() < proto->RequiredLevel) + if (!IgnoreLevelRequirement(player->GetGUID()) && player->GetLevel() < proto->RequiredLevel) return false; if (AllowLowerTiers && TierAvailable(player, 0, proto->SubClass)) @@ -887,7 +887,7 @@ bool Transmogrification::SuitableForTransmogrification(ObjectGuid guid, ItemTemp return false; } - if (!IgnoreReqLevel && IsPlusFeatureEligible(guid, PLUS_FEATURE_SKIP_LEVEL_REQ) && playerLevel < proto->RequiredLevel) + if (!IgnoreLevelRequirement(guid) && IsPlusFeatureEligible(guid, PLUS_FEATURE_SKIP_LEVEL_REQ) && playerLevel < proto->RequiredLevel) return false; if (AllowLowerTiers && TierAvailable(NULL, playerGuid, proto->SubClass)) diff --git a/src/Transmogrification.h b/src/Transmogrification.h index 7fd0325b..17c55922 100644 --- a/src/Transmogrification.h +++ b/src/Transmogrification.h @@ -263,6 +263,8 @@ class Transmogrification [[nodiscard]] bool IsPlusFeatureEligible(ObjectGuid const& playerGuid, uint32 feature) const; uint32 getPlayerMembershipLevel(ObjectGuid const & playerGuid) const; + [[nodiscard]] bool IgnoreLevelRequirement(ObjectGuid const& playerGuid) const { return IgnoreReqLevel || IsPlusFeatureEligible(playerGuid, PLUS_FEATURE_SKIP_LEVEL_REQ); } + }; #define sTransmogrification Transmogrification::instance()