Skip to content

Commit

Permalink
refactor: Move subscriptions to its own setting (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyeriah authored Sep 7, 2024
1 parent d291297 commit 2c928ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Transmogrification.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ enum TransmogSettings
{
SETTING_HIDE_TRANSMOG = 0,
SETTING_RETROACTIVE_CHECK = 1,
SETTING_TRANSMOG_MEMBERSHIP_LEVEL = 2

// Subscriptions
SETTING_TRANSMOG_MEMBERSHIP_LEVEL = 0
};

enum MixedWeaponSettings
Expand Down Expand Up @@ -271,7 +273,7 @@ class Transmogrification
// Transmog Plus
bool IsTransmogPlusEnabled;
[[nodiscard]] bool IsPlusFeatureEligible(ObjectGuid const& playerGuid, uint32 feature) const;
[[nodiscard]] uint32 GetPlayerMembershipLevel(Player* player) const { return player->GetPlayerSetting("mod-transmog", SETTING_TRANSMOG_MEMBERSHIP_LEVEL).value; };
[[nodiscard]] uint32 GetPlayerMembershipLevel(Player* player) const { return player->GetPlayerSetting("acore_cms_subscriptions", SETTING_TRANSMOG_MEMBERSHIP_LEVEL).value; };
[[nodiscard]] bool IgnoreLevelRequirement(ObjectGuid const& playerGuid) const { return IgnoreReqLevel || IsPlusFeatureEligible(playerGuid, PLUS_FEATURE_SKIP_LEVEL_REQ); }

uint32 PetSpellId;
Expand Down
2 changes: 1 addition & 1 deletion src/transmog_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ class PS_Transmogrification : public PlayerScript
QueryResult resultAcc = LoginDatabase.Query("SELECT `membership_level` FROM `acore_cms_subscriptions` WHERE `account_name` COLLATE utf8mb4_general_ci = (SELECT `username` FROM `account` WHERE `id` = {})", accountId);

if (resultAcc)
player->UpdatePlayerSetting("mod-transmog", SETTING_TRANSMOG_MEMBERSHIP_LEVEL, (*resultAcc)[0].Get<uint32>());
player->UpdatePlayerSetting("acore_cms_subscriptions", SETTING_TRANSMOG_MEMBERSHIP_LEVEL, (*resultAcc)[0].Get<uint32>());

#ifdef PRESETS
if (sT->GetEnableSets())
Expand Down

2 comments on commit 2c928ec

@icedcolor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[1146] Table 'acore_auth.acore_cms_subscriptions' doesn't exist
Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders.

@Helias
Copy link
Member

@Helias Helias commented on 2c928ec Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#177
this should prevent the error

Please sign in to comment.