Skip to content

Commit

Permalink
add unverified coins filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Jul 10, 2024
1 parent 2016145 commit 56599de
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/hooks/GameLevelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class BI_DLL $modify(GameLevelManager) {
}
if(Mod::get()->getSavedValue<bool>("user_search_nostar") && level->m_stars != 0) continue;
if(Mod::get()->getSavedValue<bool>("user_search_verifiedcoins") && (level->m_coinsVerified == 0)) continue;
if(Mod::get()->getSavedValue<bool>("user_search_unverifiedcoins") && (level->m_coinsVerified)) continue;
if(Mod::get()->getSavedValue<bool>("user_search_nocoins") && level->m_coins != 0) continue;
if(Mod::get()->getSavedValue<bool>("user_search_twoplayer") && !(level->m_twoPlayerMode)) continue;
if(Mod::get()->getSavedValue<bool>("user_search_copied") && level->m_originalLevel == 0) continue;
Expand Down
3 changes: 3 additions & 0 deletions src/layers/LevelFiltering/ProfileSearchOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ void ProfileSearchOptions::drawTogglesSecondary(){
if(!m_prefix.empty()) createToggle("ldm", "LDM");
createToggle("twoplayer", "2-Player");
createToggle("gameversion", "Game Ver.", menu_selector(ProfileSearchOptions::onGameVersionRange));
createToggle("unverifiedcoins", "Unverified Coins");

}

Expand Down Expand Up @@ -423,6 +424,7 @@ BISearchObject ProfileSearchOptions::getSearchObject() {
searchObj.twoPlayer = getOption("twoplayer");
searchObj.noCoins = getOption("nocoins");
searchObj.verifiedCoins = getOption("verifiedcoins");
searchObj.unverifiedCoins = getOption("unverifiedcoins");
searchObj.epic = getOption("epic");
searchObj.legendary = getOption("legendary");
searchObj.mythic = getOption("mythic");
Expand Down Expand Up @@ -489,6 +491,7 @@ void ProfileSearchOptions::setSearchObject(const BISearchObject& searchObj) {
setOption("twoplayer", searchObj.twoPlayer);
setOption("nocoins", searchObj.noCoins);
setOption("verifiedcoins", searchObj.verifiedCoins);
setOption("unverifiedcoins", searchObj.unverifiedCoins);
setOption("epic", searchObj.epic);
setOption("legendary", searchObj.legendary);
setOption("mythic", searchObj.mythic);
Expand Down
1 change: 1 addition & 0 deletions src/objects/BISearchObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct BISearchObject {
RangeItem coins = {false, 1, 3};
bool noCoins = false;
bool verifiedCoins = false;
bool unverifiedCoins = false;
bool epic = false;
bool legendary = false;
bool mythic = false;
Expand Down
3 changes: 2 additions & 1 deletion src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ bool BetterInfo::isSavedFiltered() {
"user_search_uncompletedleaderboard", "user_search_percentage", "user_search_percentageorbs",
"user_search_percentageleaderboard", "user_search_starrange", "user_search_completedcoins",
"user_search_uncompletedcoins", "user_search_legendary", "user_search_mythic",
"user_search_gameversion", "user_search_verifiedcoins"
"user_search_gameversion", "user_search_verifiedcoins", "user_search_unverifiedcoins"
};

for(auto option : options) {
Expand Down Expand Up @@ -347,6 +347,7 @@ bool BetterInfo::levelMatchesObject(GJGameLevel* level, const BISearchObject& se
if(searchObj.twoPlayer && !level->m_twoPlayerMode) return false;
if(!validateRangeItem(searchObj.coins, level->m_coins)) return false;
if(searchObj.noCoins && level->m_coins != 0) return false;
if(searchObj.unverifiedCoins && level->m_coinsVerified) return false;
if(searchObj.verifiedCoins && !level->m_coinsVerified) return false;
if(searchObj.epic && level->m_isEpic != 1) return false;
if(searchObj.legendary && level->m_isEpic != 2) return false;
Expand Down

0 comments on commit 56599de

Please sign in to comment.