Skip to content

Commit

Permalink
show glow in followed and profile fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Jul 8, 2024
1 parent f91276e commit c4ec3ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/managers/BetterInfoCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "../layers/FoundListsPopup.h"
#include "Geode/utils/general.hpp"
#include <shared_mutex>

bool BetterInfoCache::init(){
if(!BaseJsonManager::init("cache.json")) return false;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand All @@ -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;
}
Expand All @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions src/managers/BetterInfoOnline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ void BetterInfoOnline::sendScoreToProfilePage(cocos2d::CCArray* scores, int acco
auto score = static_cast<GJUserScore*>(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) {
Expand Down

0 comments on commit c4ec3ee

Please sign in to comment.