Fix some issues

This commit is contained in:
Bluzume 2021-11-08 00:15:31 -05:00
parent 6c3cb0e9ea
commit 7815ffc630
3 changed files with 25 additions and 11 deletions

View file

@ -258,13 +258,18 @@ namespace HISP.Game
// Insert LGBT Patch here // Insert LGBT Patch here
string pronoun = ""; string pronoun = "";
if (other) if (other)
{ {
if (user.Gender == "FEMALE") if (user.Gender == "FEMALE")
{
pronoun = Messages.PronounFemaleShe; pronoun = Messages.PronounFemaleShe;
}
if (user.Gender == "MALE") if (user.Gender == "MALE")
{
pronoun = Messages.PronounMaleHe; pronoun = Messages.PronounMaleHe;
}
} }
if (!other) if (!other)
@ -363,13 +368,19 @@ namespace HISP.Game
// Insert LGBT Patch Here // Insert LGBT Patch Here
string pronoun = Messages.PronounYouYour; string pronoun = Messages.PronounYouYour;
if(other) string pronoun2 = Messages.PronounYouYour;
if (other)
{ {
if (user.Gender == "FEMALE") if (user.Gender == "FEMALE")
{
pronoun = Messages.PronounFemaleShe; pronoun = Messages.PronounFemaleShe;
pronoun2 = Messages.PronounFemaleHer;
if (user.Gender == "MALE") }
else if (user.Gender == "MALE")
{
pronoun = Messages.PronounMaleHe; pronoun = Messages.PronounMaleHe;
pronoun2 = Messages.PronounMaleHis;
}
message = Messages.FormatOtherCompetitionGear(pronoun); message = Messages.FormatOtherCompetitionGear(pronoun);
} }
@ -378,22 +389,22 @@ namespace HISP.Game
if (user.EquipedCompetitionGear.Head != null) if (user.EquipedCompetitionGear.Head != null)
{ {
message += Messages.FormatCompetitionGearHead(user.EquipedCompetitionGear.Head.Name, pronoun, user.EquipedCompetitionGear.Head.IconId, other); message += Messages.FormatCompetitionGearHead(user.EquipedCompetitionGear.Head.Name, pronoun2, user.EquipedCompetitionGear.Head.IconId, other);
hasMsg = true; hasMsg = true;
} }
if (user.EquipedCompetitionGear.Body != null) if (user.EquipedCompetitionGear.Body != null)
{ {
message += Messages.FormatCompetitionGearBody(user.EquipedCompetitionGear.Body.Name, pronoun, user.EquipedCompetitionGear.Body.IconId, other); message += Messages.FormatCompetitionGearBody(user.EquipedCompetitionGear.Body.Name, pronoun2, user.EquipedCompetitionGear.Body.IconId, other);
hasMsg = true; hasMsg = true;
} }
if (user.EquipedCompetitionGear.Legs != null) if (user.EquipedCompetitionGear.Legs != null)
{ {
message += Messages.FormatCompetitionGearLegs(user.EquipedCompetitionGear.Legs.Name, pronoun, user.EquipedCompetitionGear.Legs.IconId, other); message += Messages.FormatCompetitionGearLegs(user.EquipedCompetitionGear.Legs.Name, pronoun2, user.EquipedCompetitionGear.Legs.IconId, other);
hasMsg = true; hasMsg = true;
} }
if (user.EquipedCompetitionGear.Feet != null) if (user.EquipedCompetitionGear.Feet != null)
{ {
message += Messages.FormatCompetitionGearFeet(user.EquipedCompetitionGear.Feet.Name, pronoun, user.EquipedCompetitionGear.Feet.IconId, other); message += Messages.FormatCompetitionGearFeet(user.EquipedCompetitionGear.Feet.Name, pronoun2, user.EquipedCompetitionGear.Feet.IconId, other);
hasMsg = true; hasMsg = true;
} }
@ -919,7 +930,7 @@ namespace HISP.Game
if (highscore.Type == "SCORE") if (highscore.Type == "SCORE")
message += Messages.FormatHighscoreStat(highscore.GameName, Database.GetRanking(highscore.Score, highscore.GameName), highscore.Score, highscore.TimesPlayed); message += Messages.FormatHighscoreStat(highscore.GameName, Database.GetRanking(highscore.Score, highscore.GameName), highscore.Score, highscore.TimesPlayed);
else if (highscore.Type == "TIME") else if (highscore.Type == "TIME")
message += Messages.FormatBestTimeStat(highscore.GameName, Database.GetRanking(highscore.Score, highscore.GameName), highscore.Score, highscore.TimesPlayed); message += Messages.FormatBestTimeStat(highscore.GameName, Database.GetRanking(highscore.Score, highscore.GameName, true), highscore.Score, highscore.TimesPlayed);
} }
message += Messages.BackToMap; message += Messages.BackToMap;
message += Messages.MetaTerminator; message += Messages.MetaTerminator;

View file

@ -5482,14 +5482,17 @@ namespace HISP.Server
} }
} }
public static int GetRanking(int score, string gameTitle) public static int GetRanking(int score, string gameTitle, bool time=false)
{ {
using (MySqlConnection db = new MySqlConnection(ConnectionString)) using (MySqlConnection db = new MySqlConnection(ConnectionString))
{ {
db.Open(); db.Open();
MySqlCommand sqlCommand = db.CreateCommand(); MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "SELECT DISTINCT score FROM Leaderboards WHERE minigame=@gameTitle ORDER BY score DESC"; if(time)
sqlCommand.CommandText = "SELECT DISTINCT score FROM Leaderboards WHERE minigame=@gameTitle ORDER BY score ASC";
else
sqlCommand.CommandText = "SELECT DISTINCT score FROM Leaderboards WHERE minigame=@gameTitle ORDER BY score DESC";
sqlCommand.Parameters.AddWithValue("@gameTitle", gameTitle); sqlCommand.Parameters.AddWithValue("@gameTitle", gameTitle);
sqlCommand.Prepare(); sqlCommand.Prepare();
MySqlDataReader reader = sqlCommand.ExecuteReader(); MySqlDataReader reader = sqlCommand.ExecuteReader();

View file

@ -4594,7 +4594,7 @@ namespace HISP.Server
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent correct sec code, but invalid score value"); Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent correct sec code, but invalid score value");
return; return;
} }
Highscore.HighscoreTableEntry[] scores = Database.GetTopScores(gameTitle, 5); Highscore.HighscoreTableEntry[] scores = Database.GetTopScores(gameTitle, 5, !time);
bool bestScoreEver = false; bool bestScoreEver = false;
if (scores.Length >= 1) if (scores.Length >= 1)
bestScoreEver = scores[0].Score <= value; bestScoreEver = scores[0].Score <= value;