fix: improve endgame clock and gameplay stability

This commit is contained in:
CAtlas0784 committed 2026-11-04 15:59:48 +07:00
1 parent ce6aabfc55
commit 658298ee86
46 files changed
+1915 -99

No files matched your search

+7 -1
View File
@@ -19,6 +19,9 @@ type CurrencyWarsCommand struct {
Star uint32 `json:"star,omitempty"`
}
// CurrencyWarsCommandEnd requests the same settlement as quitting the run.
const CurrencyWarsCommandEnd = "end"
func ReadCurrencyWarsCommands() ([]CurrencyWarsCommand, error) {
root, err := readCurrencyWarsPersistentRoot()
if err != nil {
@@ -39,9 +42,12 @@ func QueueCurrencyWarsGrant(uid, runID uint32, field string, value, quantity, st
if field == "tb" || field == "trailblaze" {
field = "tbpower"
}
if uid == 0 || runID == 0 || quantity == 0 || (field != "gold" && field != "hp" && field != "exp" && field != "equip" && field != "role" && field != "orb" && field != "consumable" && field != "forge" && field != "tbpower") {
if uid == 0 || runID == 0 || quantity == 0 || (field != CurrencyWarsCommandEnd && field != "gold" && field != "hp" && field != "exp" && field != "equip" && field != "role" && field != "orb" && field != "consumable" && field != "forge" && field != "tbpower") {
return "", fmt.Errorf("invalid CW command")
}
if field == CurrencyWarsCommandEnd && (value != 0 || quantity != 1 || star != 0) {
return "", fmt.Errorf("CW end does not accept arguments")
}
var nonce [16]byte
if _, err := rand.Read(nonce[:]); err != nil {
return "", err