pre cw with probe and a bunch script to read game behavior

This commit is contained in:
CAtlas0784 committed 2026-10-21 20:40:13 +07:00
1 parent 5120219ae2
commit da8a32f60d
310 files changed
+219693 -872

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
//go:build ignore
// Retain an observed node battle recipe and its exact route identity. Runtime
// construction must replace all role/party data; this is not a universal stage.
package main
import (
"encoding/json"
"flag"
"fmt"
pb "gac-hkrpg-go/protocol/proto"
"google.golang.org/protobuf/proto"
"os"
)
func main() {
capture := flag.String("capture", "", "native EnterBattle response")
output := flag.String("output", "", "resource output")
flag.Parse()
if *capture == "" || *output == "" {
panic("capture/output required")
}
raw, err := os.ReadFile(*capture)
if err != nil {
panic(err)
}
var response pb.GridFightEnterBattleStageScRsp
if err = proto.Unmarshal(raw, &response); err != nil {
panic(err)
}
battle := response.BattleInfo
if response.Retcode != 0 || battle == nil || battle.EIGMKOJOEEI == nil || battle.EIGMKOJOEEI.IOCKDJCDMAH == nil || len(battle.EIGMKOJOEEI.GridGameRoleList) == 0 {
panic("incomplete native CW battle")
}
wire, err := proto.Marshal(battle)
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, "scope": "Captured first-node enemy recipe only. Runtime replaces party, roles, portal, NPC, equipment and player state. Other nodes need their own recipes.", "battle_wire": wire}
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("Captured CW stage", battle.StageId)
}