Update GaCy-GO
This commit is contained in:
1 parent
da8a32f60d
commit
0cbe460e49
345 files changed
+98202
-77559
No files matched your search
@@ -30,6 +30,10 @@ func readCurrencyWarsData(catalog *common.CurrencyWarsCatalog) (*goproto.GridFig
|
||||
if err := proto.Unmarshal(snapshot.WireData, &saved); err != nil {
|
||||
return nil, 0, fmt.Errorf("decode saved CW protocol: %w", err)
|
||||
}
|
||||
cwProjectRoleIDs(&saved, catalog)
|
||||
if err := cwProjectLegacyBonfirePhase(catalog, &saved, snapshot.Runtime); err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
if err := validateCurrencyWarsSavedData(&saved, catalog); err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
@@ -75,7 +79,12 @@ func validateCurrencyWarsSavedData(data *goproto.GridFightGetDataScRsp, catalog
|
||||
|
||||
// saveCurrencyWarsData must be called only after a validated CW state-machine
|
||||
// transition, under the session state lock. It does not alter adventure data.
|
||||
func (s *Session) saveCurrencyWarsData(data *goproto.GridFightGetDataScRsp, catalog *common.CurrencyWarsCatalog) error {
|
||||
func (s *Session) saveCurrencyWarsData(data *goproto.GridFightGetDataScRsp, catalog *common.CurrencyWarsCatalog, commandID ...string) error {
|
||||
return s.saveCurrencyWarsDataWithRuntime(data, catalog, nil, commandID...)
|
||||
}
|
||||
|
||||
func (s *Session) saveCurrencyWarsDataWithRuntime(data *goproto.GridFightGetDataScRsp, catalog *common.CurrencyWarsCatalog, runtime *common.CurrencyWarsRuntimeState, commandID ...string) error {
|
||||
cwProjectRoleIDs(data, catalog)
|
||||
if err := validateCurrencyWarsSavedData(data, catalog); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -88,7 +97,24 @@ func (s *Session) saveCurrencyWarsData(data *goproto.GridFightGetDataScRsp, cata
|
||||
return err
|
||||
}
|
||||
next := common.NewCurrencyWarsSnapshot(cfg.PlayerUID, catalog.ClientVersion, catalog.Provenance.GameAssemblySHA256, wire)
|
||||
revision, err := common.CommitCurrencyWarsSnapshot(s.currencyWarsRevision, next)
|
||||
if run := data.DHFOFLFCLAH; run != nil {
|
||||
if runtime != nil && runtime.RunID != run.UniqueId {
|
||||
return fmt.Errorf("CW runtime rules belong to a different run")
|
||||
}
|
||||
if runtime == nil {
|
||||
runtime = &common.CurrencyWarsRuntimeState{RunID: run.UniqueId}
|
||||
}
|
||||
next.Runtime = runtime
|
||||
}
|
||||
var revision uint64
|
||||
if len(commandID) > 1 {
|
||||
return fmt.Errorf("only one CW command may be committed per transaction")
|
||||
}
|
||||
if len(commandID) == 1 {
|
||||
revision, err = common.CommitCurrencyWarsCommand(s.currencyWarsRevision, next, commandID[0])
|
||||
} else {
|
||||
revision, err = common.CommitCurrencyWarsSnapshot(s.currencyWarsRevision, next)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user