mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-22 21:43:35 +00:00
bug fixes
This commit is contained in:
parent
83caecbe30
commit
0ce02cac87
@ -41,7 +41,7 @@ std::vector<ILeaderboard::Entry> MySQLDatabase::GetDefaultLeaderboard(const uint
|
||||
}
|
||||
|
||||
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, 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, 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);
|
||||
|
@ -149,7 +149,7 @@ std::vector<ILeaderboard::Entry> FilterTo10(const std::vector<ILeaderboard::Entr
|
||||
|
||||
int32_t index = 0;
|
||||
// for friends and top, we dont need to find this players index.
|
||||
if (infoType == Leaderboard::InfoType::MyStanding) {
|
||||
if (infoType == Leaderboard::InfoType::MyStanding || infoType == Leaderboard::InfoType::Friends) {
|
||||
for (; index < leaderboard.size(); index++) {
|
||||
if (leaderboard[index].charId == relatedPlayer) break;
|
||||
}
|
||||
@ -157,12 +157,16 @@ std::vector<ILeaderboard::Entry> FilterTo10(const std::vector<ILeaderboard::Entr
|
||||
|
||||
if (leaderboard.size() < 10) {
|
||||
toReturn.assign(leaderboard.begin(), leaderboard.end());
|
||||
index = 0;
|
||||
} else if (index < 10) {
|
||||
toReturn.assign(leaderboard.begin(), leaderboard.begin() + 10); // get the top 10 since we are in the top 10
|
||||
index = 0;
|
||||
} else if (index > leaderboard.size() - 10) {
|
||||
toReturn.assign(leaderboard.end() - 10, leaderboard.end()); // get the bottom 10 since we are in the bottom 10
|
||||
index = leaderboard.size() - 10;
|
||||
} else {
|
||||
toReturn.assign(leaderboard.begin() + index - 5, leaderboard.begin() + index + 5); // get the 5 above and below
|
||||
index -= 5;
|
||||
}
|
||||
|
||||
int32_t i = index;
|
||||
|
Loading…
Reference in New Issue
Block a user