package catalogs import ( "encoding/json" "os" "path/filepath" "sync" ) var _ = json.RawMessage{} var _ = sync.Mutex{} var _ = os.ReadFile var _ = filepath.Join // // Build-4229938 computer (电脑) catalog: the computers themselves plus the files and emails that // can be unlocked on them. Read from the configured client-data directory; none of the three // source tables ship in the v0.3 Configs folder. Regenerate with _gen_computer_cfg.py. // The client treats presence as the unlock flag, so every row here simply becomes unlocked: // ComputerIndexerPanelStore.lua:150/272 iterate the computer's own FileList and look each id up // in InfoMinor.ComputerUnlockInfo.UnlockFiles — an absent row is what hides the file. // ComputerUtils.lua:9/84 do the same presence check for files and emails. // ComputerUtils.lua:19/94 read ComputerInfos[computerId] before letting a computer open. // Rows are stamped IsRead = false on purpose: ComputerUtils.lua:122 reports that flag as the // unread badge, and unlocking everything already-read would remove the reason to open them. // Rows the game retired with IsDelete are already excluded by the generator. // var ( ComputerCatalog4229938_cacheLock sync.RWMutex ComputerCatalog4229938_cached = false ComputerCatalog4229938_entries []any ) // LoadComputerCatalog4229938 loads catalog records from client config directory func LoadComputerCatalog4229938(configDir string) ([]any, error) { ComputerCatalog4229938_cacheLock.RLock() if ComputerCatalog4229938_cached { defer ComputerCatalog4229938_cacheLock.RUnlock() return ComputerCatalog4229938_entries, nil } ComputerCatalog4229938_cacheLock.RUnlock() ComputerCatalog4229938_cacheLock.Lock() defer ComputerCatalog4229938_cacheLock.Unlock() if ComputerCatalog4229938_cached { return ComputerCatalog4229938_entries, nil } filePath := filepath.Join(configDir, "ComputerCatalog.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) } } ComputerCatalog4229938_entries = result ComputerCatalog4229938_cached = true return result, nil } func ComputerCatalog4229938_ReadIds(arrayName string) []uint32 { // Catalog helper ComputerCatalog4229938_ReadIds return nil }