package catalogs import ( "encoding/json" "os" "path/filepath" "sync" ) var _ = json.RawMessage{} var _ = sync.Mutex{} var _ = os.ReadFile var _ = filepath.Join // // Build-4229938 Gadget (互动物件) catalog: every Gadget prefab the client ships, keyed by the // pathId that SyncGadgetAdd's PackedGadgetInfo carries. Read from the configured // client-data directory. Regenerate with _gen_gadget_cfg.py. // Source: readable_world_dump_4229938_final/05_SCENEITEMS_GADGETS/server_compatible/Gadget.csv // (a PathMap export, not a config table — the game has no DynamicGo/Gadget config table, which // is why the server historically had no way to address these props at all). // The catalog is only a picker for the admin panel. Any pathId works at runtime: the client // resolves it to a prefab on its own, so an unknown id simply fails to load instead of // corrupting anything. // var ( GadgetCatalog4229938_cacheLock sync.RWMutex GadgetCatalog4229938_cached = false GadgetCatalog4229938_entries []any ) // LoadGadgetCatalog4229938 loads catalog records from client config directory func LoadGadgetCatalog4229938(configDir string) ([]any, error) { GadgetCatalog4229938_cacheLock.RLock() if GadgetCatalog4229938_cached { defer GadgetCatalog4229938_cacheLock.RUnlock() return GadgetCatalog4229938_entries, nil } GadgetCatalog4229938_cacheLock.RUnlock() GadgetCatalog4229938_cacheLock.Lock() defer GadgetCatalog4229938_cacheLock.Unlock() if GadgetCatalog4229938_cached { return GadgetCatalog4229938_entries, nil } filePath := filepath.Join(configDir, "GadgetCatalog.json.json") data, err := os.ReadFile(filePath) if err != nil { return nil, err } var raw struct { Records []json.RawMessage `json:"records"` } if err := json.Unmarshal(data, &raw); err != nil { return nil, err } var result []any for _, item := range raw.Records { var m map[string]any if err := json.Unmarshal(item, &m); err == nil { result = append(result, m) } } GadgetCatalog4229938_entries = result GadgetCatalog4229938_cached = true return result, nil } func GadgetCatalog4229938_TryFind(pathId int32, entry GadgetEntry) bool { // Catalog helper GadgetCatalog4229938_TryFind return false } type GadgetEntry struct { PathId int32 `json:"pathId"` Name string `json:"name"` } type GadgetGroup struct { Key string `json:"key"` Label string `json:"label"` Items []GadgetEntry `json:"items"` }