diff --git a/src/managers/BetterInfoStats.cpp b/src/managers/BetterInfoStats.cpp index 9a0d9d1..b5012d8 100644 --- a/src/managers/BetterInfoStats.cpp +++ b/src/managers/BetterInfoStats.cpp @@ -96,8 +96,6 @@ void BetterInfoStats::logCompletion(GJGameLevel* level, bool practice) { } void BetterInfoStats::logCompletion(GJGameLevel* level, bool practice, time_t timestamp) { - if(level->m_levelType == GJLevelType::Editor) return; - auto dict = practice ? m_practiceDict : m_normalDict; dict->setObject(CCString::create(std::to_string(timestamp).c_str()), keyForLevel(level)); @@ -114,8 +112,6 @@ time_t BetterInfoStats::getCompletion(GJGameLevel* level, bool practice) { } void BetterInfoStats::logPlay(GJGameLevel* level) { - if(level->m_levelType == GJLevelType::Editor) return; - auto idString = keyForLevel(level); auto timeString = CCString::create(std::to_string(std::time(nullptr)).c_str()); m_lastPlayedDict->setObject(timeString, idString); @@ -139,12 +135,10 @@ std::string BetterInfoStats::keyForLevel(GJGameLevel* level) { auto type = static_cast(level->m_levelType); if(!type) type = 3; - return fmt::format("{}_{}_{}_{}", level->m_levelID.value(), type, level->m_dailyID.value(), level->m_gauntletLevel); + return fmt::format("{}_{}_{}_{}", EditorIDs::getID(level), type, level->m_dailyID.value(), level->m_gauntletLevel); } void BetterInfoStats::logAttempt(GJGameLevel* level, bool practice) { - if(level->m_levelType == GJLevelType::Editor) return; - auto dict = practice ? m_practiceAttemptDict : m_normalAttemptDict; dict->setObject(CCString::create(std::to_string(getAttempts(level, practice) + 1).c_str()), keyForLevel(level)); } diff --git a/src/utils/LevelProgressDialog.cpp b/src/utils/LevelProgressDialog.cpp index 290809c..0df0f8e 100644 --- a/src/utils/LevelProgressDialog.cpp +++ b/src/utils/LevelProgressDialog.cpp @@ -38,50 +38,51 @@ void LevelProgressDialog::show(GJGameLevel* level){ return; } - std::ostringstream contentStream, secondStream; + std::ostringstream contentStream, secondStream, toMergeStream; contentStream << "Total Attempts: " << level->m_attempts << "\nTotal Jumps: " << level->m_jumps << "\nClicks (best att.): " << level->m_clicks << "\nTime (best att.): " << TimeUtils::workingTime(level->m_attemptTime); + auto stats = BetterInfoStats::sharedState(); + if(level->isPlatformer()) { + toMergeStream << "Best Time: " << TimeUtils::platformerTime(level->m_bestTime) + << "\nBest Points: " << level->m_bestPoints; + } else { + toMergeStream << "Normal: " << level->m_normalPercent + << "%\nPractice: " << level->m_practicePercent << "%"; + if(level->m_orbCompletion != level->m_normalPercent) toMergeStream << "\nOrbs: " << level->m_orbCompletion << "%"; + if(level->m_newNormalPercent2 != level->m_orbCompletion) toMergeStream << "\nLeaderboard: " << level->m_newNormalPercent2 << "%"; + } + if(level->m_levelType != GJLevelType::Editor){ - auto stats = BetterInfoStats::sharedState(); //auto statsV2 = BetterInfoStatsV2::sharedState(); - - if(level->isPlatformer()) { - contentStream << "\nBest Time: " << TimeUtils::platformerTime(level->m_bestTime) - << "\nBest Points: " << level->m_bestPoints; - } else { - contentStream << "\nNormal: " << level->m_normalPercent - << "%\nPractice: " << level->m_practicePercent << "%"; - if(level->m_orbCompletion != level->m_normalPercent) contentStream << "\nOrbs: " << level->m_orbCompletion << "%"; - if(level->m_newNormalPercent2 != level->m_orbCompletion) contentStream << "\nLeaderboard: " << level->m_newNormalPercent2 << "%"; - - } - - auto normalAttempts = stats->getAttempts(level, false); - auto practiceAttempts = stats->getAttempts(level, true); - //auto commonFail = statsV2->getCommonFail(level); - secondStream << "Attempts (normal): " << normalAttempts << "\n"; - secondStream << "Attempts (practice): " << practiceAttempts << "\n"; - if((normalAttempts + practiceAttempts) != level->m_attempts) secondStream << "Attempts (unknown): " << (level->m_attempts - practiceAttempts - normalAttempts) << "\n"; - secondStream << "\n"; - if(stats->getPlay(level, false) != 0) secondStream << "First played: " << TimeUtils::timeToString(stats->getPlay(level, false)) << "\n"; - if(stats->getPlay(level, true) != 0) secondStream << "Last played: " << TimeUtils::timeToString(stats->getPlay(level, true)) << "\n"; - if(stats->getCompletion(level, false) > 0) secondStream << "Completed: " << TimeUtils::timeToString(stats->getCompletion(level, false)) << "\n"; - if(stats->getCompletion(level, true) > 0) secondStream << "Completed (practice): " << TimeUtils::timeToString(stats->getCompletion(level, true)) << "\n"; - //secondStream << "Common fail: " << commonFail.first << "% (" << commonFail.second << "x)\n"; + contentStream << "\n" << toMergeStream.str() << "\n"; }else{ contentStream << "\nObjects: " << level->m_objectCount << "\nIn Editor: " << TimeUtils::workingTime(level->m_workingTime) << "\n"; if(level->m_workingTime2) contentStream << "Editor (C): " << TimeUtils::workingTime(level->m_workingTime2) << "\n"; - ; + + secondStream << toMergeStream.str() << "\n\n"; } + auto normalAttempts = stats->getAttempts(level, false); + auto practiceAttempts = stats->getAttempts(level, true); + //auto commonFail = statsV2->getCommonFail(level); + secondStream << "Attempts (normal): " << normalAttempts << "\n"; + secondStream << "Attempts (practice): " << practiceAttempts << "\n"; + if((normalAttempts + practiceAttempts) != level->m_attempts) secondStream << "Attempts (unknown): " << (level->m_attempts - practiceAttempts - normalAttempts) << "\n"; + secondStream << "\n"; + if(stats->getPlay(level, false) != 0) secondStream << "First played: " << TimeUtils::timeToString(stats->getPlay(level, false)) << "\n"; + if(stats->getPlay(level, true) != 0) secondStream << "Last played: " << TimeUtils::timeToString(stats->getPlay(level, true)) << "\n"; + if(stats->getCompletion(level, false) > 0) secondStream << "Completed: " << TimeUtils::timeToString(stats->getCompletion(level, false)) << "\n"; + if(stats->getCompletion(level, true) > 0) secondStream << "Completed (practice): " << TimeUtils::timeToString(stats->getCompletion(level, true)) << "\n"; + //secondStream << "Common fail: " << commonFail.first << "% (" << commonFail.second << "x)\n"; + std::string progresses; if(std::string(level->m_personalBests) != ""){ progresses = printableProgress(level->m_personalBests, level->m_newNormalPercent2); - contentStream << "\n\nProgresses: " << progresses; + contentStream << "\nProgresses: " << progresses; } std::vector contents;