Files
GaCy-GO/internal/common/warp_mode.go
T

26 lines
448 B
Go

package common
import (
"encoding/json"
"fmt"
)
func ReadWarpUnlockMode() (*int, error) {
root, err := readCurrencyWarsPersistentRoot()
if err != nil {
return nil, err
}
raw, ok := root["warp_unlock_mode"]
if !ok {
return nil, nil
}
var mode int
if err := json.Unmarshal(raw, &mode); err != nil {
return nil, err
}
if mode < 0 || mode > 3 {
return nil, fmt.Errorf("invalid saved Warp visibility mode")
}
return &mode, nil
}