mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-23 05:53:34 +00:00
Update Leaderboard.cpp
This commit is contained in:
parent
e77d1d3536
commit
83caecbe30
@ -28,7 +28,7 @@ std::vector<ILeaderboard::Entry> ProcessQuery(UniqueResultSet& rows) {
|
|||||||
entry.tertiaryScore = rows->getUInt("tertiaryScore");
|
entry.tertiaryScore = rows->getUInt("tertiaryScore");
|
||||||
entry.numWins = rows->getUInt("numWins");
|
entry.numWins = rows->getUInt("numWins");
|
||||||
entry.numTimesPlayed = rows->getUInt("timesPlayed");
|
entry.numTimesPlayed = rows->getUInt("timesPlayed");
|
||||||
entry.name = rows->getString("ci.name");
|
entry.name = rows->getString("char_name");
|
||||||
// entry.ranking is never set because its calculated in leaderboard in code.
|
// entry.ranking is never set because its calculated in leaderboard in code.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,20 +36,20 @@ std::vector<ILeaderboard::Entry> ProcessQuery(UniqueResultSet& rows) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ILeaderboard::Entry> MySQLDatabase::GetDefaultLeaderboard(const uint32_t activityId) {
|
std::vector<ILeaderboard::Entry> MySQLDatabase::GetDefaultLeaderboard(const uint32_t activityId) {
|
||||||
auto leaderboard = ExecuteSelect("SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore DESC, secondaryscore DESC, tertiaryScore DESC, last_played ASC;", activityId);
|
auto leaderboard = ExecuteSelect("SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix, ci.name as char_name FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore DESC, secondaryscore DESC, tertiaryScore DESC, last_played ASC;", activityId);
|
||||||
return ProcessQuery(leaderboard);
|
return ProcessQuery(leaderboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ILeaderboard::Entry> MySQLDatabase::GetAgsLeaderboard(const uint32_t activityId) {
|
std::vector<ILeaderboard::Entry> MySQLDatabase::GetAgsLeaderboard(const uint32_t activityId) {
|
||||||
auto query = Game::config->GetValue("classic_survival_scoring") == "1" ?
|
auto query = Game::config->GetValue("classic_survival_scoring") == "1" ?
|
||||||
"SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore DESC, secondaryscore DESC, tertiaryScore DESC, last_played ASC;" :
|
"SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix, ci.name as char_name FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore DESC, secondaryscore DESC, tertiaryScore DESC, last_played ASC;" :
|
||||||
"SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY secondaryscore DESC, primaryscore DESC, tertiaryScore DESC, last_played ASC;";
|
"SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix, ci.name as char_name FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY secondaryscore DESC, primaryscore DESC, tertiaryScore DESC, last_played ASC;";
|
||||||
auto leaderboard = ExecuteSelect(query, activityId);
|
auto leaderboard = ExecuteSelect(query, activityId);
|
||||||
return ProcessQuery(leaderboard);
|
return ProcessQuery(leaderboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ILeaderboard::Entry> MySQLDatabase::GetNsLeaderboard(const uint32_t activityId) {
|
std::vector<ILeaderboard::Entry> MySQLDatabase::GetNsLeaderboard(const uint32_t activityId) {
|
||||||
auto leaderboard = ExecuteSelect("SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore ASC, secondaryscore DESC, tertiaryScore ASC, last_played ASC;", activityId);
|
auto leaderboard = ExecuteSelect("SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix, ci.name as char_name FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore ASC, secondaryscore DESC, tertiaryScore ASC, last_played ASC;", activityId);
|
||||||
return ProcessQuery(leaderboard);
|
return ProcessQuery(leaderboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user