Etterna 0.74.4
Loading...
Searching...
No Matches
HighScore.h
1#ifndef HIGH_SCORE_H
2#define HIGH_SCORE_H
3
4#include "Etterna/Models/Misc/DateTime.h"
5#include "Etterna/Models/Misc/GameConstantsAndTypes.h"
6#include "Etterna/Models/Misc/Grade.h"
7#include "Etterna/Models/HighScore/Replay.h"
8
9class XNode;
10struct RadarValues;
11struct lua_State;
12
13struct HighScoreImpl;
18{
19 HighScore();
20
24 [[nodiscard]] auto GetName() const -> const std::string&;
25 [[nodiscard]] auto DebugString() const -> std::string;
26 [[nodiscard]] auto GetChartKey() const -> const std::string&;
27 [[nodiscard]] auto GetSSRCalcVersion() const -> int;
32 [[nodiscard]] auto GetGrade() const -> Grade;
36 [[nodiscard]] auto GetScore() const -> unsigned int;
40 [[nodiscard]] auto IsEmpty() const -> bool;
41 [[nodiscard]] auto IsEmptyNormalized() const -> bool;
42 [[nodiscard]] auto GetWifeGrade() const -> Grade;
43 auto ConvertDpToWife() -> float;
44 [[nodiscard]] auto GetPercentDP() const -> float;
45 [[nodiscard]] auto GetWifeScore() const -> float;
46 [[nodiscard]] auto GetWifePoints() const -> float;
47 [[nodiscard]] auto GetSSRNormPercent() const -> float;
48 [[nodiscard]] auto GetMusicRate() const -> float;
49 [[nodiscard]] auto GetSongOffset() const -> float;
50 [[nodiscard]] auto GetJudgeScale() const -> float;
51 [[nodiscard]] auto GetChordCohesion() const -> bool;
52 [[nodiscard]] auto GetEtternaValid() const -> bool;
53 [[nodiscard]] auto GetDSFlag() const -> bool;
54 [[nodiscard]] auto GetStageSeed() const -> int;
55 [[nodiscard]] auto IsUploadedToServer(const std::string& s) const -> bool;
56 std::vector<float> timeStamps;
57 [[nodiscard]] auto GetOffsetVector() -> const std::vector<float>&;
58 [[nodiscard]] auto GetNoteRowVector() -> const std::vector<int>&;
59 [[nodiscard]] auto GetTrackVector() -> const std::vector<int>&;
60 [[nodiscard]] auto GetTapNoteTypeVector()
61 -> const std::vector<TapNoteType>&;
62 [[nodiscard]] auto GetHoldReplayDataVector()
63 -> const std::vector<HoldReplayResult>&;
64 [[nodiscard]] auto GetMineReplayDataVector()
65 -> const std::vector<MineReplayResult>&;
66 [[nodiscard]] auto GetMissReplayDataVector()
67 -> const std::vector<MissReplayResult>&;
68 [[nodiscard]] auto GetCopyOfOffsetVector() -> std::vector<float>;
69 [[nodiscard]] auto GetCopyOfNoteRowVector() -> std::vector<int>;
70 [[nodiscard]] auto GetCopyOfTrackVector() -> std::vector<int>;
71 [[nodiscard]] auto GetCopyOfTapNoteTypeVector() -> std::vector<TapNoteType>;
72 [[nodiscard]] auto GetCopyOfHoldReplayDataVector()
73 -> std::vector<HoldReplayResult>;
74 [[nodiscard]] auto GetCopyOfMineReplayDataVector()
75 -> std::vector<MineReplayResult>;
76 [[nodiscard]] auto GetCopyOfMissReplayDataVector()
77 -> std::vector<MissReplayResult>;
78 [[nodiscard]] auto GetCopyOfSetOnlineReplayTimestampVector()
79 -> std::vector<float>;
80 [[nodiscard]] auto GetInputDataVector() -> const std::vector<InputDataEvent>&;
81 [[nodiscard]] auto GetScoreKey() const -> const std::string&;
82 [[nodiscard]] auto GetTopScore() const -> int;
83 [[nodiscard]] auto GetReplayType() -> ReplayType;
84 [[nodiscard]] auto HasColumnData() -> bool;
85 [[nodiscard]] auto GetPlayedSeconds() const -> float;
86 [[nodiscard]] auto GetMaxCombo() const -> unsigned int;
90 [[nodiscard]] auto GetModifiers() const -> const std::string&;
91 [[nodiscard]] auto GetDateTime() const -> DateTime;
92 [[nodiscard]] auto GetPlayerGuid() const -> const std::string&;
93 [[nodiscard]] auto GetMachineGuid() const -> const std::string&;
94 [[nodiscard]] auto GetCountryCode() const -> const std::string&;
95 [[nodiscard]] auto GetProductID() const -> int;
96 [[nodiscard]] auto GetTapNoteScore(TapNoteScore tns) const -> int;
97 [[nodiscard]] auto GetTNSNormalized(TapNoteScore tns) const -> int;
98 [[nodiscard]] auto GetHoldNoteScore(HoldNoteScore hns) const -> int;
99 [[nodiscard]] auto GetRadarValues() const -> const RadarValues&;
100 [[nodiscard]] auto GetLifeRemainingSeconds() const -> float;
105 [[nodiscard]] auto GetDisqualified() const -> bool;
106
110 void SetName(const std::string& sName);
111 void SetChartKey(const std::string& ck);
112 void SetSSRCalcVersion(int cv);
113 void SetGrade(Grade g);
114 void SetScore(unsigned int iScore);
115 void SetPercentDP(float f);
116 void SetWifeScore(float f);
117 void SetWifePoints(float f);
118 void SetSSRNormPercent(float f);
119 void SetMusicRate(float f);
120 void SetSongOffset(float f);
121 void SetPlayedSeconds(float f);
122 void SetJudgeScale(float f);
123 void SetChordCohesion(bool b);
124 void SetEtternaValid(bool b);
125 void SetDSFlag(bool b);
126 void SetStageSeed(int i);
127 void AddUploadedServer(const std::string& s);
128 void SetInputDataVector(const std::vector<InputDataEvent>& v);
129 void SetMissDataVector(const std::vector<MissReplayResult>& v);
130 void SetOffsetVector(const std::vector<float>& v);
131 void SetNoteRowVector(const std::vector<int>& v);
132 void SetTrackVector(const std::vector<int>& v);
133 void SetTapNoteTypeVector(const std::vector<TapNoteType>& v);
134 void SetHoldReplayDataVector(const std::vector<HoldReplayResult>& v);
135 void SetMineReplayDataVector(const std::vector<MineReplayResult>& v);
136 void SetOnlineReplayTimestampVector(const std::vector<float>& v);
137 void SetScoreKey(const std::string& sk);
138 void SetRescoreJudgeVector(const std::vector<int>& v);
139 void SetMaxCombo(unsigned int i);
140 void SetModifiers(const std::string& s);
141 void SetDateTime(DateTime d);
142 void SetPlayerGuid(const std::string& s);
143 void SetMachineGuid(const std::string& s);
144 void SetProductID(int i);
145 void SetTapNoteScore(TapNoteScore tns, int i);
146 void SetHoldNoteScore(HoldNoteScore hns, int i);
147 void SetRadarValues(const RadarValues& rv);
148 void SetLifeRemainingSeconds(float f);
149 void SetDisqualified(bool b);
150
151 auto GetNameMutable() -> std::string*;
152
153 [[nodiscard]] auto GetNameMutable() const -> const std::string*
154 {
155 return const_cast<std::string*>(
156 const_cast<HighScore*>(this)->GetNameMutable());
157 }
158
159 auto operator<(HighScore const& other) const -> bool;
160 auto operator>(HighScore const& other) const -> bool;
161 auto operator<=(HighScore const& other) const -> bool;
162 auto operator>=(HighScore const& other) const -> bool;
163 auto operator==(HighScore const& other) const -> bool;
164 auto operator!=(HighScore const& other) const -> bool;
165 auto operator=(const HighScore &) -> HighScore&;
166
167 [[nodiscard]] auto CreateEttNode() const -> XNode*;
168 void LoadFromEttNode(const XNode* pNode);
169
170 auto WriteReplayData() -> bool;
171 auto WriteInputData() -> bool;
172 auto LoadReplayData() -> bool;
173 auto LoadReplayDataBasic(const std::string& dir) -> bool;
174 auto LoadReplayDataFull(const std::string& dir) -> bool;
175 virtual auto HasReplayData() -> bool;
176 void InitReplay();
177 void UnloadReplayData();
178 void ResetSkillsets();
179 auto GetReplay() -> Replay*;
180
181 [[nodiscard]] auto GetDisplayName() const -> const std::string&;
182
183 // Mina stuff - Mina
184 auto RescoreToWife2Judge(int x) -> float;
185 auto RescoreToWife2TimeScale(float ts) -> float;
186 // update wifescore (judge the score was achieved on) and ssrnorm
187 auto RescoreToWife3(float pmax) -> bool;
188 auto RescoreToDPJudge(int x) -> float;
189 [[nodiscard]] auto GetSkillsetSSR(Skillset ss) const -> float;
190 [[nodiscard]] auto GetWifeVersion() const -> int;
191 void SetSkillsetSSR(Skillset ss, float ssr);
192 void SetValidationKey(ValidationKey vk, std::string k);
193 void SetTopScore(int i);
194 void GenerateValidationKeys();
195 auto GenerateBrittleValidationKey() const -> std::string;
196 auto ValidateBrittleValidationKey() const -> bool;
197 [[nodiscard]] auto GetValidationKey(ValidationKey vk) const
198 -> const std::string&;
199 void SetWifeVersion(int i);
200 auto GetRescoreJudgeVector(int x) -> std::vector<int>;
201 auto NormalizeJudgments() -> bool;
202 // laazy
203 std::string scoreid;
204 int userid = -1;
205 std::string avatar;
206 std::string countryCode;
207 bool forceuploadedthissession = false;
208 int norms = 0;
209 int musics = 0;
210 int judges = 0;
211 // Lua
212 void PushSelf(lua_State* L);
213 void PushReplay(lua_State* L)
214 {
215 CheckReplayIsInit();
216 replay->PushSelf(L);
217 }
218 Replay* replay = nullptr;
219
220 private:
221 struct HSImplUniquePtr {
222 std::unique_ptr<HighScoreImpl> p;
223
224 HSImplUniquePtr();
225 ~HSImplUniquePtr();
226 HSImplUniquePtr(const HSImplUniquePtr& rhs);
227 HSImplUniquePtr(std::unique_ptr<HighScoreImpl> ptr);
228 auto operator=(const HSImplUniquePtr& rhs) -> HSImplUniquePtr&;
229
230 HighScoreImpl *operator->() { return &*p; }
231 HighScoreImpl &operator*() { return *p; }
232 HighScoreImpl const *operator->() const { return &*p; }
233 HighScoreImpl const &operator*() const { return *p; }
234 };
235 HSImplUniquePtr m_Impl;
236 void CheckReplayIsInit();
237};
238
241{
243 std::string sFileName;
245 std::string sMD5;
248
249 [[nodiscard]] auto CreateNode() const -> XNode*;
250 void LoadFromNode(const XNode* pNode);
251 auto operator<(Screenshot const& rhs) const -> bool
252 {
253 return highScore.GetDateTime() < rhs.highScore.GetDateTime();
254 }
255
256 auto operator==(Screenshot const& rhs) const -> bool
257 {
258 return sFileName == rhs.sFileName;
259 }
260};
261
262#endif
Definition Replay.h:15
void PushSelf(lua_State *L)
Lua.
Definition XmlFile.h:95
A standard way of determining the date and the time.
Definition DateTime.h:81
Definition HighScore.cpp:28
The high score that is earned by a player.
Definition HighScore.h:18
auto GetName() const -> const std::string &
Retrieve the name of the player that set the high score.
Definition HighScore.cpp:488
auto GetScore() const -> unsigned int
Retrieve the score earned.
Definition HighScore.cpp:508
auto GetModifiers() const -> const std::string &
Get the modifiers used for this run.
Definition HighScore.cpp:690
auto GetGrade() const -> Grade
Retrieve the grade earned from this score.
Definition HighScore.cpp:503
auto IsEmpty() const -> bool
Determine if any judgments were tallied during this run.
Definition HighScore.cpp:459
void SetName(const std::string &sName)
Set the name of the Player that earned the score.
Definition HighScore.cpp:779
auto GetDisqualified() const -> bool
Determine if this score was from a situation that would cause disqualification.
Definition HighScore.cpp:755
Cached song statistics.
Definition RadarValues.h:14
the picture taken of the high score.
Definition HighScore.h:241
std::string sMD5
The MD5 hash of the screen shot file above.
Definition HighScore.h:245
HighScore highScore
The actual high score in question.
Definition HighScore.h:247
std::string sFileName
the filename of the screen shot. There is no directory part.
Definition HighScore.h:243