mirror of
https://github.com/azerothcore/mod-transmog
synced 2025-11-29 22:48:30 +08:00
Implement retroactive quest appearance collection
This commit is contained in:
@@ -28,6 +28,16 @@
|
||||
# This allows these appearances to be used later if the configuration is changed.
|
||||
# Default: 1
|
||||
#
|
||||
# Transmogrification.RetroActiveAppearances
|
||||
# Description: Enables/Disables checking all completed quests for uncollected appearances.
|
||||
# Occurs only once per player.
|
||||
# Default: 1
|
||||
#
|
||||
# Transmogrification.ResetRetroActiveAppearancesFlag
|
||||
# Description: Resets the flag indicating whether the retroactive appearance check has been run.
|
||||
# Occurs for each character on log in.
|
||||
# Default: 0
|
||||
#
|
||||
# Transmogrification.EnableTransmogInfo
|
||||
# Description: Enables / Disables the info button for transmogrification
|
||||
# Default: 1
|
||||
@@ -50,6 +60,8 @@ Transmogrification.Enable = 1
|
||||
Transmogrification.UseCollectionSystem = 1
|
||||
Transmogrification.AllowHiddenTransmog = 1
|
||||
Transmogrification.TrackUnusableItems = 1
|
||||
Transmogrification.RetroActiveAppearances = 1
|
||||
Transmogrification.ResetRetroActiveAppearancesFlag = 0
|
||||
|
||||
Transmogrification.EnableTransmogInfo = 1
|
||||
Transmogrification.TransmogNpcText = 601083
|
||||
|
||||
@@ -797,6 +797,8 @@ void Transmogrification::LoadConfig(bool reload)
|
||||
UseCollectionSystem = sConfigMgr->GetOption<bool>("Transmogrification.UseCollectionSystem", true);
|
||||
AllowHiddenTransmog = sConfigMgr->GetOption<bool>("Transmogrification.AllowHiddenTransmog", true);
|
||||
TrackUnusableItems = sConfigMgr->GetOption<bool>("Transmogrification.TrackUnusableItems", true);
|
||||
RetroActiveAppearances = sConfigMgr->GetOption<bool>("Transmogrification.RetroActiveAppearances", true);
|
||||
ResetRetroActiveAppearances = sConfigMgr->GetOption<bool>("Transmogrification.ResetRetroActiveAppearancesFlag", false);
|
||||
|
||||
IsTransmogEnabled = sConfigMgr->GetOption<bool>("Transmogrification.Enable", true);
|
||||
|
||||
@@ -886,6 +888,16 @@ bool Transmogrification::GetTrackUnusableItems() const
|
||||
return TrackUnusableItems;
|
||||
}
|
||||
|
||||
bool Transmogrification::EnableRetroActiveAppearances() const
|
||||
{
|
||||
return RetroActiveAppearances;
|
||||
}
|
||||
|
||||
bool Transmogrification::EnableResetRetroActiveAppearances() const
|
||||
{
|
||||
return ResetRetroActiveAppearances;
|
||||
}
|
||||
|
||||
bool Transmogrification::IsEnabled() const
|
||||
{
|
||||
return IsTransmogEnabled;
|
||||
|
||||
@@ -27,6 +27,7 @@ struct ItemTemplate;
|
||||
enum TransmogSettings
|
||||
{
|
||||
SETTING_HIDE_TRANSMOG = 0,
|
||||
SETTING_RETROACTIVE_CHECK = 1
|
||||
};
|
||||
|
||||
enum TransmogAcoreStrings // Language.h might have same entries, appears when executing SQL, change if needed
|
||||
@@ -133,6 +134,8 @@ public:
|
||||
bool UseCollectionSystem;
|
||||
bool AllowHiddenTransmog;
|
||||
bool TrackUnusableItems;
|
||||
bool RetroActiveAppearances;
|
||||
bool ResetRetroActiveAppearances;
|
||||
|
||||
bool IsTransmogEnabled;
|
||||
|
||||
@@ -184,6 +187,8 @@ public:
|
||||
bool GetUseCollectionSystem() const;
|
||||
bool GetAllowHiddenTransmog() const;
|
||||
bool GetTrackUnusableItems() const;
|
||||
bool EnableRetroActiveAppearances() const;
|
||||
bool EnableResetRetroActiveAppearances() const;
|
||||
[[nodiscard]] bool IsEnabled() const;
|
||||
};
|
||||
#define sTransmogrification Transmogrification::instance()
|
||||
|
||||
@@ -517,6 +517,21 @@ private:
|
||||
CharacterDatabase.Execute( "INSERT INTO custom_unlocked_appearances (account_id, item_template_id) VALUES ({}, {})", accountId, itemId);
|
||||
}
|
||||
}
|
||||
|
||||
void CheckRetroActiveQuestAppearances(Player* player)
|
||||
{
|
||||
QueryResult result = CharacterDatabase.Query("SELECT `quest` FROM `character_queststatus` WHERE `status` = 3 AND `guid` = {}", player->GetGUID().GetCounter());
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32 questId = (*result)[0].Get<uint32>();
|
||||
Quest* questTemplate = const_cast<Quest*>(sObjectMgr->GetQuestTemplate(questId));
|
||||
OnPlayerCompleteQuest(player, questTemplate);
|
||||
} while (result->NextRow());
|
||||
}
|
||||
player->UpdatePlayerSetting("mod-transmog", SETTING_RETROACTIVE_CHECK, 1);
|
||||
}
|
||||
public:
|
||||
PS_Transmogrification() : PlayerScript("Player_Transmogrify") { }
|
||||
|
||||
@@ -597,6 +612,14 @@ public:
|
||||
|
||||
void OnLogin(Player* player) override
|
||||
{
|
||||
if (sT->EnableResetRetroActiveAppearances())
|
||||
{
|
||||
player->UpdatePlayerSetting("mod-transmog", SETTING_RETROACTIVE_CHECK, 0);
|
||||
}
|
||||
if (sT->EnableRetroActiveAppearances() && !(player->GetPlayerSetting("mod-transmog", SETTING_RETROACTIVE_CHECK).value))
|
||||
{
|
||||
CheckRetroActiveQuestAppearances(player);
|
||||
}
|
||||
ObjectGuid playerGUID = player->GetGUID();
|
||||
sT->entryMap.erase(playerGUID);
|
||||
QueryResult result = CharacterDatabase.Query("SELECT GUID, FakeEntry FROM custom_transmogrification WHERE Owner = {}", player->GetGUID().GetCounter());
|
||||
|
||||
Reference in New Issue
Block a user