From 512a24e5c3b1a51045a91acd9049c64266cc6d64 Mon Sep 17 00:00:00 2001 From: maru Date: Tue, 30 Apr 2024 14:34:40 -0400 Subject: [PATCH] Remove anti cheat --- api/savedata/clear.go | 4 ---- api/savedata/update.go | 7 ------- db/account.go | 9 --------- db/daily.go | 4 ++-- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/api/savedata/clear.go b/api/savedata/clear.go index 2940c57..1aa988e 100644 --- a/api/savedata/clear.go +++ b/api/savedata/clear.go @@ -53,10 +53,6 @@ func Clear(uuid []byte, slot int, seed string, save defs.SessionSaveData) (Clear waveCompleted-- } - if save.Score >= 20000 { - db.SetAccountLimited(uuid, true) - } - err = db.AddOrUpdateAccountDailyRun(uuid, save.Score, waveCompleted) if err != nil { log.Printf("failed to add or update daily run record: %s", err) diff --git a/api/savedata/update.go b/api/savedata/update.go index db5150a..c4ee109 100644 --- a/api/savedata/update.go +++ b/api/savedata/update.go @@ -56,13 +56,6 @@ func Update(uuid []byte, slot int, save any) error { return fmt.Errorf("client version out of date") } - if save.VoucherCounts["0"] > 300 || - save.VoucherCounts["1"] > 150 || - save.VoucherCounts["2"] > 100 || - save.VoucherCounts["3"] > 10 { - db.SetAccountLimited(uuid, true) - } - err = db.UpdateAccountStats(uuid, save.GameStats, save.VoucherCounts) if err != nil { return fmt.Errorf("failed to update account stats: %s", err) diff --git a/db/account.go b/db/account.go index b30e79b..7432e50 100644 --- a/db/account.go +++ b/db/account.go @@ -144,15 +144,6 @@ func UpdateAccountStats(uuid []byte, stats defs.GameStats, voucherCounts map[str return nil } -func SetAccountLimited(uuid []byte, limited bool) error { - _, err := handle.Exec("UPDATE accounts SET limited = ? WHERE uuid = ?", limited, uuid) - if err != nil { - return err - } - - return nil -} - func FetchAndClaimAccountCompensations(uuid []byte) (map[int]int, error) { var compensations = make(map[int]int) diff --git a/db/daily.go b/db/daily.go index d92222a..55eb04e 100644 --- a/db/daily.go +++ b/db/daily.go @@ -49,9 +49,9 @@ func FetchRankings(category int, page int) ([]defs.DailyRanking, error) { var query string switch category { case 0: - query = "SELECT RANK() OVER (ORDER BY adr.score DESC, adr.timestamp), a.username, adr.score, adr.wave FROM accountDailyRuns adr JOIN dailyRuns dr ON dr.date = adr.date JOIN accounts a ON adr.uuid = a.uuid WHERE dr.date = UTC_DATE() AND a.limited = 0 LIMIT 10 OFFSET ?" + query = "SELECT RANK() OVER (ORDER BY adr.score DESC, adr.timestamp), a.username, adr.score, adr.wave FROM accountDailyRuns adr JOIN dailyRuns dr ON dr.date = adr.date JOIN accounts a ON adr.uuid = a.uuid WHERE dr.date = UTC_DATE() AND a.banned = 0 LIMIT 10 OFFSET ?" case 1: - query = "SELECT RANK() OVER (ORDER BY SUM(adr.score) DESC, adr.timestamp), a.username, SUM(adr.score), 0 FROM accountDailyRuns adr JOIN dailyRuns dr ON dr.date = adr.date JOIN accounts a ON adr.uuid = a.uuid WHERE dr.date >= DATE_SUB(DATE(UTC_TIMESTAMP()), INTERVAL DAYOFWEEK(UTC_TIMESTAMP()) - 1 DAY) AND a.limited = 0 GROUP BY a.username ORDER BY 1 LIMIT 10 OFFSET ?" + query = "SELECT RANK() OVER (ORDER BY SUM(adr.score) DESC, adr.timestamp), a.username, SUM(adr.score), 0 FROM accountDailyRuns adr JOIN dailyRuns dr ON dr.date = adr.date JOIN accounts a ON adr.uuid = a.uuid WHERE dr.date >= DATE_SUB(DATE(UTC_TIMESTAMP()), INTERVAL DAYOFWEEK(UTC_TIMESTAMP()) - 1 DAY) AND a.banned = 0 GROUP BY a.username ORDER BY 1 LIMIT 10 OFFSET ?" } results, err := handle.Query(query, offset)