Ban if vouchers over a certain threshold
parent
bc8084b70b
commit
e184e9da91
|
@ -39,6 +39,13 @@ 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.UpdateAccountBanned(uuid, true)
|
||||
}
|
||||
|
||||
err = db.UpdateAccountStats(uuid, save.GameStats, save.VoucherCounts)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update account stats: %s", err)
|
||||
|
|
|
@ -127,6 +127,15 @@ func UpdateAccountStats(uuid []byte, stats defs.GameStats, voucherCounts map[str
|
|||
return nil
|
||||
}
|
||||
|
||||
func UpdateAccountBanned(uuid []byte, banned bool) error {
|
||||
_, err := handle.Exec("UPDATE accounts SET banned = ? WHERE uuid = ?", banned, uuid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func FetchAndClaimAccountCompensations(uuid []byte) (map[int]int, error) {
|
||||
var compensations = make(map[int]int)
|
||||
|
||||
|
|
Loading…
Reference in New Issue