Skip to content

Commit

Permalink
* Using group inteead of acocunt id
Browse files Browse the repository at this point in the history
  • Loading branch information
jprzimba committed Jan 20, 2025
1 parent 10c67b6 commit 04fc5ff
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8577,8 +8577,9 @@ std::string Game::generateHighscoreQueryForEntries(const std::string &categoryNa

query << "SELECT *, @row AS `entries`, " << page << " AS `page` FROM (SELECT *, (@row := @row + 1) AS `rn` FROM (SELECT `id`, `name`, `level`, `vocation`, `"
<< categoryName << "` AS `points`, @curRank := IF(@prevRank = `" << categoryName << "`, @curRank, IF(@prevRank := `" << categoryName
<< "`, @curRank + 1, @curRank + 1)) AS `rank` FROM `players` `p`, (SELECT @curRank := 0, @prevRank := NULL, @row := 0) `r` WHERE `account_id` != "
<< 1 << " ORDER BY `" << categoryName << "` DESC) `t`";
<< "`, @curRank + 1, @curRank + 1)) AS `rank` FROM `players` `p`, (SELECT @curRank := 0, @prevRank := NULL, @row := 0) `r` WHERE `group_id` < "
<< static_cast<int>(GROUP_TYPE_GAMEMASTER) << " ORDER BY `" << categoryName << "` DESC) `t`";

if (vocation != 0xFFFFFFFF) {
query << generateVocationConditionHighscore(vocation);
}
Expand All @@ -8593,8 +8594,9 @@ std::string Game::generateHighscoreQueryForOurRank(const std::string &categoryNa

query << "SELECT *, @row AS `entries`, (@ourRow DIV " << entriesStr << ") + 1 AS `page` FROM (SELECT *, (@row := @row + 1) AS `rn`, @ourRow := IF(`id` = "
<< playerGUID << ", @row - 1, @ourRow) AS `rw` FROM (SELECT `id`, `name`, `level`, `vocation`, `" << categoryName << "` AS `points`, @curRank := IF(@prevRank = `"
<< categoryName << "`, @curRank, IF(@prevRank := `" << categoryName << "`, @curRank + 1, @curRank + 1)) AS `rank` FROM `players` `p`, (SELECT @curRank := 0, @prevRank := NULL, @row := 0, @ourRow := 0) `r` WHERE `account_id` != "
<< 1 << " ORDER BY `" << categoryName << "` DESC) `t`";
<< categoryName << "`, @curRank, IF(@prevRank := `" << categoryName << "`, @curRank + 1, @curRank + 1)) AS `rank` FROM `players` `p`, (SELECT @curRank := 0, @prevRank := NULL, @row := 0, @ourRow := 0) `r` WHERE `group_id` < "
<< static_cast<int>(GROUP_TYPE_GAMEMASTER) << " ORDER BY `" << categoryName << "` DESC) `t`";

if (vocation != 0xFFFFFFFF) {
query << generateVocationConditionHighscore(vocation);
}
Expand Down

0 comments on commit 04fc5ff

Please sign in to comment.