Update GaCy-GO
This commit is contained in:
1 parent
da8a32f60d
commit
0cbe460e49
345 files changed
+98202
-77559
No files matched your search
@@ -10,11 +10,13 @@ import (
|
||||
// Commands are separate from the run revision. The live game session applies
|
||||
// them only during Preparation, so a web command cannot invalidate settlement.
|
||||
type CurrencyWarsCommand struct {
|
||||
ID string `json:"id"`
|
||||
UID uint32 `json:"uid"`
|
||||
RunID uint32 `json:"run_id"`
|
||||
Field string `json:"field"`
|
||||
Value uint32 `json:"value"`
|
||||
ID string `json:"id"`
|
||||
UID uint32 `json:"uid"`
|
||||
RunID uint32 `json:"run_id"`
|
||||
Field string `json:"field"`
|
||||
Value uint32 `json:"value"`
|
||||
Quantity uint32 `json:"quantity,omitempty"`
|
||||
Star uint32 `json:"star,omitempty"`
|
||||
}
|
||||
|
||||
func ReadCurrencyWarsCommands() ([]CurrencyWarsCommand, error) {
|
||||
@@ -30,7 +32,11 @@ func ReadCurrencyWarsCommands() ([]CurrencyWarsCommand, error) {
|
||||
}
|
||||
|
||||
func QueueCurrencyWarsCommand(uid, runID uint32, field string, value uint32) (string, error) {
|
||||
if uid == 0 || runID == 0 || (field != "gold" && field != "hp") {
|
||||
return QueueCurrencyWarsGrant(uid, runID, field, value, 1, 0)
|
||||
}
|
||||
|
||||
func QueueCurrencyWarsGrant(uid, runID uint32, field string, value, quantity, star uint32) (string, error) {
|
||||
if uid == 0 || runID == 0 || quantity == 0 || (field != "gold" && field != "hp" && field != "exp" && field != "equip" && field != "role" && field != "orb" && field != "consumable" && field != "forge") {
|
||||
return "", fmt.Errorf("invalid CW command")
|
||||
}
|
||||
var nonce [16]byte
|
||||
@@ -55,7 +61,7 @@ func QueueCurrencyWarsCommand(uid, runID uint32, field string, value uint32) (st
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
commands = append(commands, CurrencyWarsCommand{ID: id, UID: uid, RunID: runID, Field: field, Value: value})
|
||||
commands = append(commands, CurrencyWarsCommand{ID: id, UID: uid, RunID: runID, Field: field, Value: value, Quantity: quantity, Star: star})
|
||||
raw, err := json.Marshal(commands)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
Reference in new issue
Block a user