From 5f1a1c74d1121f67ccd0974b7ce5accff9bbc4b7 Mon Sep 17 00:00:00 2001 From: winter <99384603+hewoicvewse@users.noreply.github.com> Date: Sat, 31 Dec 2022 16:50:14 +0900 Subject: [PATCH] progress --- src/endpoints/levels/levelScores.cr | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/endpoints/levels/levelScores.cr b/src/endpoints/levels/levelScores.cr index 57c6744..14c99de 100644 --- a/src/endpoints/levels/levelScores.cr +++ b/src/endpoints/levels/levelScores.cr @@ -24,7 +24,8 @@ CrystalGauntlet.endpoints["/getGJLevelScores211.php"] = ->(body : String): Strin clicks = params["s2"].to_i - 3991 time = params["s3"].to_i - 4085 # todo: fix - # progress = XorCrypt.encrypt_string(GDBase64.decode_string(params["s6"]), "41274") + progress = String.new(XorCrypt.encrypt_string(GDBase64.decode_string(params["s6"]), "41274")) + puts progress coins = params["s9"].to_i - 5819 if coins > 3 || coins < 0 return "-1" @@ -41,10 +42,10 @@ CrystalGauntlet.endpoints["/getGJLevelScores211.php"] = ->(body : String): Strin percent_old, coins_old = DATABASE.query_one("select percent, coins from level_scores where account_id = ? and level_id = ?", account_id, level_id, as: {Int32, Int32}) if percent > percent_old || coins > coins_old - DATABASE.exec("update level_scores set account_id=?, level_id=?, daily_id=?, percent=?, attempts=?, clicks=?, coins=?, progress=?, time=?, set_at=? where account_id = ? and level_id = ?", account_id, level_id, daily_id, percent, attempts, clicks, coins, "", time, Time.utc.to_s("%Y-%m-%d %H:%M:%S"), account_id, level_id) + DATABASE.exec("update level_scores set account_id=?, level_id=?, daily_id=?, percent=?, attempts=?, clicks=?, coins=?, progress=?, time=?, set_at=? where account_id = ? and level_id = ?", account_id, level_id, daily_id, percent, attempts, clicks, coins, progress, time, Time.utc.to_s("%Y-%m-%d %H:%M:%S"), account_id, level_id) end else - DATABASE.exec("insert into level_scores (account_id, level_id, daily_id, percent, attempts, clicks, coins, progress, time) values (?, ?, ?, ?, ?, ?, ?, ?, ?)", account_id, level_id, daily_id, percent, attempts, clicks, coins, "", time) + DATABASE.exec("insert into level_scores (account_id, level_id, daily_id, percent, attempts, clicks, coins, progress, time) values (?, ?, ?, ?, ?, ?, ?, ?, ?)", account_id, level_id, daily_id, percent, attempts, clicks, coins, progress, time) end end