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,61 @@
|
||||
//go:build ignore
|
||||
|
||||
// Extract only the pending-state recipe from a controlled native replay.
|
||||
// Rewards and random shop contents are deliberately not copied into live runs.
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
pb "gac-hkrpg-go/protocol/proto"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
input := flag.String("capture", "", "GetData capture after the initial RoundBegin")
|
||||
output := flag.String("output", "", "output resource")
|
||||
flag.Parse()
|
||||
if *input == "" || *output == "" {
|
||||
panic("capture and output are required")
|
||||
}
|
||||
raw, err := os.ReadFile(*input)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
var data pb.GridFightGetDataScRsp
|
||||
if err = proto.Unmarshal(raw, &data); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
pending := data.GetDHFOFLFCLAH().GetFMIGOKIDKJL()
|
||||
if pending == nil || pending.GetLGNPHHBGKFH() == nil {
|
||||
panic("capture does not contain ReturnPreparation")
|
||||
}
|
||||
wire, err := proto.Marshal(pending)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
raw, err = os.ReadFile("resources/CurrencyWarsInitialRuns.json")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
var identity map[string]json.RawMessage
|
||||
if err = json.Unmarshal(raw, &identity); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
result := map[string]any{"format_version": 1, "return_preparation_wire": wire,
|
||||
"scope": "Initial RoundBegin/ReturnPreparation pending recipe only; no rewards or random inventory copied.",
|
||||
"shop_draw_policy": "remaining_copies"}
|
||||
for _, key := range []string{"target_client_version", "target_assembly_sha256", "source_binary_sha256"} {
|
||||
result[key] = identity[key]
|
||||
}
|
||||
raw, err = json.MarshalIndent(result, "", " ")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err = os.WriteFile(*output, append(raw, '\n'), 0644); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("Extracted ReturnPreparation recipe queue", pending.QueuePosition)
|
||||
}
|
||||
Reference in new issue
Block a user