Skip to content

Commit

Permalink
Set wifeversion given by server for OnlineScores
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Dec 19, 2020
1 parent 3ea10c8 commit f95912a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Etterna/Models/Misc/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,11 @@ HighScore::GetValidationKey(ValidationKey vk) const -> const std::string&
return m_Impl->ValidationKeys[vk];
}
void
HighScore::SetWifeVersion(int i)
{
m_Impl->WifeVersion = i;
}
void
HighScore::SetRadarValues(const RadarValues& rv)
{
m_Impl->radarValues = rv;
Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Models/Misc/HighScore.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ struct HighScore
auto GenerateValidationKeys() -> std::string;
[[nodiscard]] auto GetValidationKey(ValidationKey vk) const
-> const std::string&;
void SetWifeVersion(int i);
auto GetRescoreJudgeVector(int x) -> std::vector<int>;
// laazy
std::string scoreid;
Expand Down
18 changes: 17 additions & 1 deletion src/Etterna/Singletons/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,10 @@ DownloadManager::RequestChartLeaderBoard(const string& chartkey,
StringBuffer buffer;
Writer<StringBuffer> writer(buffer);
score_obj.Accept(writer);
Locator::getLogger()->trace("Malformed score in chart leaderboard (chart: {}): {}", chartkey, buffer.GetString());
Locator::getLogger()->trace(
"Malformed score in chart leaderboard (chart: {}): {}",
chartkey,
buffer.GetString());
continue;
}
auto& score = score_obj["attributes"];
Expand Down Expand Up @@ -1762,6 +1765,16 @@ DownloadManager::RequestChartLeaderBoard(const string& chartkey,
tmp.valid = score["valid"].GetBool();
else
tmp.valid = false;
if (score.HasMember("wifeVersion") &&
score["wifeVersion"].IsInt()) {
auto v = score["wifeVersion"].GetInt();
if (v == 3)
tmp.wifeversion = 3;
else
tmp.wifeversion = 2;
}
else
tmp.wifeversion = 2;

auto& ssrs = score["skillsets"];
FOREACH_ENUM(Skillset, ss)
Expand Down Expand Up @@ -1803,6 +1816,7 @@ DownloadManager::RequestChartLeaderBoard(const string& chartkey,
hs.SetModifiers(tmp.modifiers);
hs.SetChordCohesion(tmp.nocc);
hs.SetWifeScore(tmp.wife);
hs.SetWifeVersion(tmp.wifeversion);
hs.SetSSRNormPercent(tmp.wife);
hs.SetMusicRate(tmp.rate);
hs.SetChartKey(chartkey);
Expand Down Expand Up @@ -2539,6 +2553,8 @@ class LunaDownloadManager : public Luna<DownloadManager>
lua_setfield(L, -2, "rate");
lua_pushnumber(L, score.wife);
lua_setfield(L, -2, "wife");
lua_pushnumber(L, score.wifeversion);
lua_setfield(L, -2, "wifeversion");
lua_pushnumber(L, score.miss);
lua_setfield(L, -2, "miss");
lua_pushnumber(L, score.marvelous);
Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Singletons/DownloadManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class OnlineScore
std::map<Skillset, float> SSRs;
float rate{ 0.0f };
float wife{ 0.0f };
int wifeversion{ 0 };
int maxcombo{ 0 };
int miss{ 0 };
int bad{ 0 };
Expand Down

0 comments on commit f95912a

Please sign in to comment.