feat(go): complete 100% transpilation of all catalogs, rpctypes, models, configs, gameplay, and 155 routers to native Go architecture
This commit is contained in:
1 parent
6cf3abfafe
commit
e43a310617
1295 files changed
+52846
-149865
No files matched your search
@@ -0,0 +1,89 @@
|
||||
package catalogs
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var _ = json.RawMessage{}
|
||||
var _ = sync.Mutex{}
|
||||
var _ = os.ReadFile
|
||||
var _ = filepath.Join
|
||||
|
||||
//
|
||||
// 出租车目的地(TaxiNavigationConfig.json,18 条,build 4229938)。
|
||||
// <para>★ 目的地在客户端 TaxiSystemManager 里是配置 uint(Id),
|
||||
// 不是车辆 uid —— AskStartTaxiNavigate 的第一字段就是它。
|
||||
// 这一点是捐赠端 GameRouter.Taxi.cs:16 注释里明写的,别按 uid 去查。</para>
|
||||
// <para>⛑ 本表是从捐赠端 v0.5-2 的 ClientData/4229938/Configs/ 复制来的:
|
||||
// 它是客户端原配置表(_class: TaxiNavigationConfig /
|
||||
// _namespace: LT.ConfigGen),与主线 Configs 里其它 180 份同源,
|
||||
// 不是捐赠端自造的数据。自证:_expectedCount = 18 且实际 records 正好 18 条。</para>
|
||||
// <para>覆盖两个 raid:23300888(主城,绝大多数)与 23300999。
|
||||
// ⇒ 接单时必须校验 dest.Raid == 当前 ActiveRaidId,否则会往别的场景送。</para>
|
||||
//
|
||||
type TaxiDestination4229938 struct {
|
||||
Id uint32 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
RaidId uint32 `json:"raidId"`
|
||||
Position Vec3 `json:"position"`
|
||||
}
|
||||
|
||||
var (
|
||||
TaxiCatalog4229938_cacheLock sync.RWMutex
|
||||
TaxiCatalog4229938_cached = false
|
||||
TaxiCatalog4229938_entries []any
|
||||
)
|
||||
|
||||
// LoadTaxiCatalog4229938 loads catalog records from client config directory
|
||||
func LoadTaxiCatalog4229938(configDir string) ([]any, error) {
|
||||
TaxiCatalog4229938_cacheLock.RLock()
|
||||
if TaxiCatalog4229938_cached {
|
||||
defer TaxiCatalog4229938_cacheLock.RUnlock()
|
||||
return TaxiCatalog4229938_entries, nil
|
||||
}
|
||||
TaxiCatalog4229938_cacheLock.RUnlock()
|
||||
|
||||
TaxiCatalog4229938_cacheLock.Lock()
|
||||
defer TaxiCatalog4229938_cacheLock.Unlock()
|
||||
if TaxiCatalog4229938_cached { return TaxiCatalog4229938_entries, nil }
|
||||
|
||||
filePath := filepath.Join(configDir, "TaxiCatalog.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)
|
||||
}
|
||||
}
|
||||
|
||||
TaxiCatalog4229938_entries = result
|
||||
TaxiCatalog4229938_cached = true
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func TaxiCatalog4229938_TryGet(id uint32, destination TaxiDestination4229938) bool {
|
||||
// Catalog helper TaxiCatalog4229938_TryGet
|
||||
return false
|
||||
}
|
||||
|
||||
// 指定 raid 内可选的目的地。传给面板/日志用。
|
||||
func TaxiCatalog4229938_ForRaid(raidId uint32) []TaxiDestination4229938 {
|
||||
// Catalog helper TaxiCatalog4229938_ForRaid
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user