Fix time-based minigames saying best time was worst time

This commit is contained in:
Bluzume 2021-11-06 23:45:35 -04:00
parent ab62c65f13
commit 163b181eac
3 changed files with 10 additions and 7 deletions

View file

@ -5447,14 +5447,17 @@ namespace HISP.Server
}
}
public static Highscore.HighscoreTableEntry[] GetTopScores(string gameTitle, int limit)
public static Highscore.HighscoreTableEntry[] GetTopScores(string gameTitle, int limit, bool scores=true)
{
List<Highscore.HighscoreTableEntry> entires = new List<Highscore.HighscoreTableEntry>();
using (MySqlConnection db = new MySqlConnection(ConnectionString))
{
db.Open();
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "SELECT * FROM Leaderboards WHERE minigame=@gameTitle ORDER BY score DESC LIMIT @limit";
if(scores)
sqlCommand.CommandText = "SELECT * FROM Leaderboards WHERE minigame=@gameTitle ORDER BY score DESC LIMIT @limit";
else
sqlCommand.CommandText = "SELECT * FROM Leaderboards WHERE minigame=@gameTitle ORDER BY score ASC LIMIT @limit";
sqlCommand.Parameters.AddWithValue("@gameTitle", gameTitle);
sqlCommand.Parameters.AddWithValue("@limit", limit);
sqlCommand.Prepare();

View file

@ -512,7 +512,7 @@ namespace HISP.Server
{
ClientSocket.Send(PacketData);
}
catch (Exception e)
catch (Exception)
{
Disconnect();
}