mirror of
https://github.com/islehorse/HISP.git
synced 2025-06-20 01:35:12 +12:00
Fix time-based minigames saying best time was worst time
This commit is contained in:
parent
ab62c65f13
commit
163b181eac
3 changed files with 10 additions and 7 deletions
|
@ -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();
|
||||
|
|
|
@ -512,7 +512,7 @@ namespace HISP.Server
|
|||
{
|
||||
ClientSocket.Send(PacketData);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
Disconnect();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue