131 lines
4.0 KiB
Go
131 lines
4.0 KiB
Go
package catalogs
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"path/filepath"
|
|
"sync"
|
|
)
|
|
|
|
var _ = json.RawMessage{}
|
|
var _ = sync.Mutex{}
|
|
var _ = os.ReadFile
|
|
var _ = filepath.Join
|
|
|
|
//
|
|
// One TaskEventConfig row — a task-panel list entry.
|
|
// The Mission / task panel list does NOT render TaskConfig rows: it renders events. Evidence
|
|
// (PrivateServerPor branch, docs/任务列表不显示_根因分析.md): the server pushes them in
|
|
// SyncPlayerAllTask(64260853).eventPanelInfo.EventsInfo, the client stores them in
|
|
// TaskManager.m_TaskEvents (SyncPlayerAllEventPanel), and nothing else feeds that list. The map
|
|
// icons come from the client's own local TaskEventConfig — different data source, no server
|
|
// involvement — which is why map markers worked while the panel stayed empty.
|
|
// Tasks is the event's own task chain in progression order, walked through
|
|
// TaskConfig.NextTasks offline (_gen_task_event_cfg.py). Task ids are NOT contiguous, so
|
|
// [StartTask..EndTask] is not a valid range. Order matters: the newest step is the LAST chain
|
|
// entry still present in the published container, not the first.
|
|
//
|
|
type TaskEventEntry4229938 struct {
|
|
Id uint32 `json:"id"`
|
|
Name string `json:"name"`
|
|
NameCn string `json:"nameCn"`
|
|
Chapter int32 `json:"chapter"`
|
|
SortOrder int32 `json:"sortOrder"`
|
|
StartTask uint32 `json:"startTask"`
|
|
EndTasks []uint32 `json:"endTasks"`
|
|
Tasks []uint32 `json:"tasks"`
|
|
Tag []int32 `json:"tag"`
|
|
}
|
|
|
|
//
|
|
// Build-4229938 task-event catalog, read from TaskEventCatalog.json in the configured client-data
|
|
// directory. Regenerate with _gen_task_event_cfg.py.
|
|
//
|
|
var (
|
|
TaskEventCatalog4229938_cacheLock sync.RWMutex
|
|
TaskEventCatalog4229938_cached = false
|
|
TaskEventCatalog4229938_entries []any
|
|
)
|
|
|
|
// LoadTaskEventCatalog4229938 loads catalog records from client config directory
|
|
func LoadTaskEventCatalog4229938(configDir string) ([]any, error) {
|
|
TaskEventCatalog4229938_cacheLock.RLock()
|
|
if TaskEventCatalog4229938_cached {
|
|
defer TaskEventCatalog4229938_cacheLock.RUnlock()
|
|
return TaskEventCatalog4229938_entries, nil
|
|
}
|
|
TaskEventCatalog4229938_cacheLock.RUnlock()
|
|
|
|
TaskEventCatalog4229938_cacheLock.Lock()
|
|
defer TaskEventCatalog4229938_cacheLock.Unlock()
|
|
if TaskEventCatalog4229938_cached { return TaskEventCatalog4229938_entries, nil }
|
|
|
|
filePath := filepath.Join(configDir, "TaskEventCatalog.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)
|
|
}
|
|
}
|
|
|
|
TaskEventCatalog4229938_entries = result
|
|
TaskEventCatalog4229938_cached = true
|
|
return result, nil
|
|
}
|
|
|
|
func TaskEventCatalog4229938_Find(eventId uint32) *TaskEventEntry4229938 {
|
|
// Catalog helper TaskEventCatalog4229938_Find
|
|
return nil
|
|
}
|
|
|
|
// Events whose task chain contains .
|
|
func TaskEventCatalog4229938_EventsForTask(taskId uint32) []uint32 {
|
|
// Catalog helper TaskEventCatalog4229938_EventsForTask
|
|
return nil
|
|
}
|
|
|
|
// Progression-ordered task chain of an event (may be empty for orphan events).
|
|
func TaskEventCatalog4229938_TasksOf(eventId uint32) []uint32 {
|
|
// Catalog helper TaskEventCatalog4229938_TasksOf
|
|
return nil
|
|
}
|
|
|
|
func TaskEventCatalog4229938_ReadUInts(row any, name string) []uint32 {
|
|
// Catalog helper TaskEventCatalog4229938_ReadUInts
|
|
return nil
|
|
}
|
|
|
|
func TaskEventCatalog4229938_ReadInts(row any, name string) []int32 {
|
|
// Catalog helper TaskEventCatalog4229938_ReadInts
|
|
return nil
|
|
}
|
|
|
|
func TaskEventCatalog4229938_ReadText(row any, name string) string {
|
|
// Catalog helper TaskEventCatalog4229938_ReadText
|
|
return ""
|
|
}
|
|
|
|
func TaskEventCatalog4229938_BuildTaskIndex() map[uint32][]uint32 {
|
|
// Catalog helper TaskEventCatalog4229938_BuildTaskIndex
|
|
return nil
|
|
}
|
|
|
|
func TaskEventCatalog4229938_BuildEventIndex() map[uint32][]uint32 {
|
|
// Catalog helper TaskEventCatalog4229938_BuildEventIndex
|
|
return nil
|
|
}
|
|
|