pre cw with probe and a bunch script to read game behavior
This commit is contained in:
1 parent
5120219ae2
commit
da8a32f60d
310 files changed
+219693
-872
No files matched your search
@@ -0,0 +1,100 @@
|
||||
//go:build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
pb "gac-hkrpg-go/protocol/proto"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
prefix := flag.String("prefix", "", "capture prefix before augment ID")
|
||||
ids := flag.String("ids", "", "comma-separated observed offer IDs")
|
||||
output := flag.String("output", "", "output resource")
|
||||
flag.Parse()
|
||||
read := func(path string) *pb.MPIMAEMCEFH {
|
||||
raw, e := os.ReadFile(path)
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
var d pb.GridFightGetDataScRsp
|
||||
if e = protojson.Unmarshal(raw, &d); e != nil {
|
||||
panic(e)
|
||||
}
|
||||
if d.DHFOFLFCLAH == nil {
|
||||
panic("run absent")
|
||||
}
|
||||
return d.DHFOFLFCLAH
|
||||
}
|
||||
type Choice struct {
|
||||
ID uint32 `json:"augment_id"`
|
||||
GoldDelta int64 `json:"gold_delta"`
|
||||
Info []byte `json:"augment_info_wire"`
|
||||
}
|
||||
var choices []Choice
|
||||
for _, idText := range strings.Split(*ids, ",") {
|
||||
n, e := strconv.ParseUint(idText, 10, 32)
|
||||
if e != nil || n == 0 {
|
||||
panic("invalid augment ID")
|
||||
}
|
||||
id := uint32(n)
|
||||
before, after := read(fmt.Sprintf("%s-%d-data-stage-8.json", *prefix, id)), read(fmt.Sprintf("%s-%d-data-stage-12.json", *prefix, id))
|
||||
normalizedBefore, normalizedAfter := proto.Clone(before).(*pb.MPIMAEMCEFH), proto.Clone(after).(*pb.MPIMAEMCEFH)
|
||||
var beforeGold, afterGold uint32
|
||||
var info *pb.PPGEBEBPMJC
|
||||
for _, pair := range []struct {
|
||||
run *pb.MPIMAEMCEFH
|
||||
gold *uint32
|
||||
}{{normalizedBefore, &beforeGold}, {normalizedAfter, &afterGold}} {
|
||||
for _, c := range pair.run.NAGDJGMMCBE {
|
||||
if p := c.GetFAOCFBOFCJP(); p != nil {
|
||||
*pair.gold = p.Gold
|
||||
p.Gold = 0
|
||||
}
|
||||
if a := c.GetLLDBOIANGDN(); a != nil {
|
||||
for _, v := range a.SyncAugmentInfo {
|
||||
if v.AugmentId == id {
|
||||
info = proto.Clone(v).(*pb.PPGEBEBPMJC)
|
||||
}
|
||||
}
|
||||
a.SyncAugmentInfo = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
if !proto.Equal(normalizedBefore, normalizedAfter) || info == nil {
|
||||
panic("augment changes more than gold/augment ownership; a specific effect processor is required")
|
||||
}
|
||||
wire, e := proto.Marshal(info)
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
choices = append(choices, Choice{id, int64(afterGold) - int64(beforeGold), wire})
|
||||
}
|
||||
raw, e := os.ReadFile("resources/CurrencyWarsInitialRuns.json")
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
var identity map[string]json.RawMessage
|
||||
if e = json.Unmarshal(raw, &identity); e != nil {
|
||||
panic(e)
|
||||
}
|
||||
result := map[string]any{"format_version": 1, "scope": "Observed reference outcomes for the three captured initial investment offers only. Validated that only gold and augment ownership change; no party/inventory snapshots copied. Not a general augment effect engine.", "choices": choices}
|
||||
for _, key := range []string{"target_client_version", "target_assembly_sha256", "source_binary_sha256"} {
|
||||
result[key] = identity[key]
|
||||
}
|
||||
raw, e = json.MarshalIndent(result, "", " ")
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
if e = os.WriteFile(*output, append(raw, '\n'), 0644); e != nil {
|
||||
panic(e)
|
||||
}
|
||||
fmt.Println("Exported observed augment outcomes", len(choices))
|
||||
}
|
||||
Reference in new issue
Block a user