112 auto GetAllPBPtrs(
const std::string& profileID =
113 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
114 ->
const std::vector<vector<HighScore*>>;
115 auto GetAllPBsPreferringReplays(
116 const std::string& profileID =
117 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
118 -> std::vector<HighScore*>;
120 auto GetChartPBAt(
const std::string& ck,
122 const std::string& profileID =
123 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
128 auto GetChartPBUpTo(
const std::string& ck,
130 const std::string& profileID =
131 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
134 [[nodiscard]]
auto GetBestGradeFor(
135 const std::string& ck,
136 const std::string& profileID =
137 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
const -> Grade
139 if (KeyHasScores(ck, profileID)) {
140 return pscores.at(profileID).at(ck).bestGrade;
143 return Grade_Invalid;
146 [[nodiscard]]
auto GetBestWifeScoreFor(
147 const std::string& ck,
148 const std::string& profileID =
149 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
const ->
float
151 if (KeyHasScores(ck, profileID)) {
152 return pscores.at(profileID).at(ck).bestWifeScore;
161 const std::string& profileID =
162 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID) ->
int
165 HighScore* h = pscores[profileID][hs.GetChartKey()].AddScore(hs);
166 RegisterScoreThisSession(h);
167 RegisterScoreInProfile(h, profileID);
168 return hs.GetTopScore();
172 const std::string& profileID =
173 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
176 const float minpercent = PREFSMAN->m_fMinPercentToSaveScores;
179 std::vector<float> SortTopSSRPtrs(
181 const std::string& profileID =
182 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID,
183 bool getSSRs =
false);
184 std::map<DateTime, std::vector<float>> GetPlayerRatingOverTime(
185 const std::string& profileID =
186 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
187 void SortTopSSRPtrsForGame(
189 const std::string& profileID =
190 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
192 void RecalculateSSRs(
const std::string& profileID);
193 void UnInvalidateAllScores(
const std::string& profileID);
194 void CalcPlayerRating(
float& prating,
196 const std::string& profileID);
198 auto GetTopSSRValue(
unsigned int rank,
int ss) -> float;
200 auto GetTopSSRHighScore(
unsigned int rank,
int ss) ->
HighScore*;
201 auto GetTopSSRHighScoreForGame(
unsigned int rank,
int ss) ->
HighScore*;
202 auto GetRecentScore(
int rank) ->
HighScore*;
203 auto GetRecentScoreForGame(
int rank) ->
HighScore*;
204 void SortRecentScores(
const std::string& profileID =
205 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
206 void SortRecentScoresForGame(
207 const std::string& profileID =
208 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
210 [[nodiscard]]
auto KeyHasScores(
211 const std::string& ck,
212 const std::string& profileID =
213 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
const ->
bool
215 return pscores.count(profileID) == 1 && pscores.at(profileID).count(ck) == 1;
217 [[nodiscard]]
auto HasAnyScores()
const ->
bool
219 return !AllScores.empty();
222 [[nodiscard]]
auto CreateNode(
223 const std::string& profileID =
224 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
const ->
XNode*;
225 void LoadFromNode(
const XNode* node,
226 const std::string& profileID =
227 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
229 auto GetScoresForChart(
const std::string& ck,
230 const std::string& profileID =
231 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
233 auto GetSortedKeys() ->
const std::vector<std::string>;
235 void PushSelf(lua_State* L);
238 if (camefromreplay) {
239 ASSERT_M(tempscoreforonlinereplayviewing !=
nullptr,
240 "Temp score for Replay & Practice viewing was empty.");
241 return tempscoreforonlinereplayviewing;
244 if (AllScores.empty())
246 return AllScores.back();
248 void PutScoreAtTheTop(
const std::string& scorekey)
250 auto score = ScoresByKey[scorekey];
251 std::swap(score, AllScores.back());
253 auto GetAllScores() ->
const std::vector<HighScore*>& {
return AllScores; }
254 auto GetScoresByKey() ->
const std::unordered_map<std::string, HighScore*>&
258 auto GetAllProfileScores(
const std::string& profileID =
259 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
260 ->
const std::vector<HighScore*>&
262 return AllProfileScores[profileID];
264 void RegisterScore(
HighScore* hs) { AllScores.emplace_back(hs); }
267 ScoresByKey.emplace(hs->GetScoreKey(), hs);
269 void RegisterScoreInProfile(
HighScore* hs_,
const std::string& profileID);
272 std::vector<Skillset> GetTopPlayedSkillsets(
273 const std::string& profileID = PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
275 std::vector<int> GetPlaycountPerSkillset(
276 const std::string& profileID = PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
278 void SetAllTopScores(
const std::string& profileID =
279 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
281 auto GetProfileScores(
const std::string& profileID =
282 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID)
283 -> std::unordered_map<std::string, ScoresForChart>*
285 return &(pscores[profileID]);
288 void PurgeProfileScores(
const std::string& profileID =
289 PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
290 void UnloadAllReplayData()
292 for (
auto& s : AllScores) {
293 if (s->replay !=
nullptr &&
294 s->replay->GetReplayType() != ReplayType_Invalid)
295 s->UnloadReplayData();
298 bool camefromreplay =
false;
299 HighScore* tempscoreforonlinereplayviewing;
300 std::vector<HighScore*> scorestorecalc;
303 std::set<HighScore*> rescores;
305 auto GetNumScoresThisSession() ->
int
307 return scoresThisSession.size();
309 auto GetScoresThisSession() -> std::vector<HighScore*>
311 return scoresThisSession;
313 void RegisterScoreThisSession(
HighScore* hs)
315 scoresThisSession.push_back(hs);
319 std::unordered_map<std::string,
320 std::unordered_map<std::string, ScoresForChart>>
325 std::vector<HighScore*> TopSSRs;
326 std::vector<HighScore*> TopSSRsForGame;
327 std::vector<HighScore*> AllScores;
328 std::unordered_map<std::string, std::vector<HighScore*>> AllProfileScores;
332 std::unordered_map<std::string, HighScore*> ScoresByKey;
337 std::vector<HighScore*> scoresThisSession;