From c4ec3eea35258233f93b47a1c9a4f16cf308f8aa Mon Sep 17 00:00:00 2001 From: Cvolton Date: Mon, 8 Jul 2024 12:25:57 +0200 Subject: [PATCH] show glow in followed and profile fix --- src/managers/BetterInfoCache.cpp | 13 +++++++++++-- src/managers/BetterInfoOnline.cpp | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/managers/BetterInfoCache.cpp b/src/managers/BetterInfoCache.cpp index c7b5678..0909b82 100644 --- a/src/managers/BetterInfoCache.cpp +++ b/src/managers/BetterInfoCache.cpp @@ -4,6 +4,7 @@ #include "../layers/FoundListsPopup.h" #include "Geode/utils/general.hpp" +#include bool BetterInfoCache::init(){ if(!BaseJsonManager::init("cache.json")) return false; @@ -74,7 +75,10 @@ void BetterInfoCache::cacheFollowedCreators() { thread::setName("BI Followed Creators Cache"); for(auto accountID : followedCreators) { - if(objectExists("user-info-dict", std::to_string(accountID))) continue; + if(objectExists("user-info-dict", std::to_string(accountID))) { + std::shared_lock guard(m_jsonMutex); + if(m_json["user-info-dict"][std::to_string(accountID)].contains("special")) continue; + }; Loader::get()->queueInMainThread([accountID] { BetterInfoOnline::sharedState()->loadScores(accountID, false, nullptr, nullptr); @@ -104,6 +108,7 @@ void BetterInfoCache::cacheScore(GJUserScore* score) { object["iconID"] = score->m_iconID; object["color-1"] = score->m_color1; object["color-2"] = score->m_color2; + object["special"] = score->m_special; object["accountID"] = score->m_accountID; object["cached"] = std::time(nullptr); @@ -130,6 +135,7 @@ GJUserScore* BetterInfoCache::getCachedOrPlaceholderScore(int accountID) { score->m_iconID = 1; score->m_color1 = 0; score->m_color2 = 0; + score->m_special = 0; score->m_accountID = accountID; return score; } @@ -153,8 +159,11 @@ GJUserScore* BetterInfoCache::getCachedScore(int accountID) { score->m_color1 = object["color-1"].as_int(); score->m_color2 = object["color-2"].as_int(); score->m_accountID = object["accountID"].as_int(); - return score; + if(!object.contains("special") || !object["special"].is_number()) return score; + + score->m_special = object["special"].as_int(); + return score; } void BetterInfoCache::cacheRatedLists(int page) { diff --git a/src/managers/BetterInfoOnline.cpp b/src/managers/BetterInfoOnline.cpp index b2fef60..6327d0c 100644 --- a/src/managers/BetterInfoOnline.cpp +++ b/src/managers/BetterInfoOnline.cpp @@ -89,6 +89,8 @@ void BetterInfoOnline::sendScoreToProfilePage(cocos2d::CCArray* scores, int acco auto score = static_cast(obj); score->m_messageState = 2; score->m_friendStatus = 1; + score->m_glowEnabled = score->m_special == 2; + //if(score->m_special == 2) score->m_color3 = score->m_color1; if(score->m_accountID == accountID) { score->m_globalRank = score->m_playerRank; switch(score->m_iconType) {