This repository has been archived on 2026-10-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Ananta-ps/internal/catalogs/fishing_catalog4229938.go

165 lines
4.9 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package catalogs
import (
"encoding/json"
"os"
"path/filepath"
"sync"
)
var _ = json.RawMessage{}
var _ = sync.Mutex{}
var _ = os.ReadFile
var _ = filepath.Join
//
// 钓鱼小游戏(build 4229938)的客户端作者配置投影。
// 数据源 = ConfigDump_v3.zip 里的 FishingSpotConfig.json(19 个钓点)与
// FishingFishConfig.json(100 条鱼),原样落到
// Drmk.Server/ClientData/4229938/Configs/(与官方 records[] 同格式)。
// <para>为什么服务端需要它:AskFishingSpotFullSync 的回包
// FishingSpotFullSyncInfo 里每条鱼只有 Id / FishConfigId / Weight / Length
// 四个字段(RPCSerializeAuto.lua:4256-4269),名字和模型全在客户端本地表,
// 服务端只决定"这个池子里有哪些鱼、每条多重多长"。所以只需要钓点 → 鱼种 → 规格这三张投影。</para>
// <para>⛑ 硬规则 195:TryGetUInt32 / TryGetSingle 遇到非 Number 会抛
// 而不是返回 false。官方表里的数字字段偶尔写成字符串(InitGroup[].FishId = "10105001"
// 就是字符串)⇒ 所有取值器先判 ValueKind。</para>
//
// 一个钓点(FishingSpotConfig 一行)。InitGroup 是初始鱼群的构成。
type FishingSpotRow4229938 struct {
Id uint32 `json:"id"`
Name string `json:"name"`
Region uint32 `json:"region"`
FishIdList []uint32 `json:"fishIdList"`
InitGroup []any `json:"initGroup"`
}
// 一条鱼(FishingFishConfig 一行)。NormalWeight 单位 g、NormalLength 单位 cm。
type FishingFishRow4229938 struct {
Id uint32 `json:"id"`
Name string `json:"name"`
NormalWeight float32 `json:"normalWeight"`
NormalLength float32 `json:"normalLength"`
Quality uint32 `json:"quality"`
}
//
// 一件渔具(FishingGearConfig 一行,共 34 件)。
// GearType:Rod=0 / Bait=1 / Line=2 / Float=3 / Lure=4;
// Quality:White=0 … Orange=5。
//
type FishingGearRow4229938 struct {
Id uint32 `json:"id"`
Name string `json:"name"`
GearType uint32 `json:"gearType"`
Quality uint32 `json:"quality"`
}
var (
FishingCatalog4229938_cacheLock sync.RWMutex
FishingCatalog4229938_cached = false
FishingCatalog4229938_entries []any
)
// LoadFishingCatalog4229938 loads catalog records from client config directory
func LoadFishingCatalog4229938(configDir string) ([]any, error) {
FishingCatalog4229938_cacheLock.RLock()
if FishingCatalog4229938_cached {
defer FishingCatalog4229938_cacheLock.RUnlock()
return FishingCatalog4229938_entries, nil
}
FishingCatalog4229938_cacheLock.RUnlock()
FishingCatalog4229938_cacheLock.Lock()
defer FishingCatalog4229938_cacheLock.Unlock()
if FishingCatalog4229938_cached { return FishingCatalog4229938_entries, nil }
filePath := filepath.Join(configDir, "FishingCatalog.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)
}
}
FishingCatalog4229938_entries = result
FishingCatalog4229938_cached = true
return result, nil
}
func FishingCatalog4229938_FindSpot(spotId uint32) *FishingSpotRow4229938 {
// Catalog helper FishingCatalog4229938_FindSpot
return nil
}
func FishingCatalog4229938_FindFish(fishId uint32) *FishingFishRow4229938 {
// Catalog helper FishingCatalog4229938_FindFish
return nil
}
func FishingCatalog4229938_FindGear(gearId uint32) *FishingGearRow4229938 {
// Catalog helper FishingCatalog4229938_FindGear
return nil
}
// ---------------------------------------------------------------------------------------
// 取值器:先判 ValueKind 再取(硬规则 195)
// ---------------------------------------------------------------------------------------
func FishingCatalog4229938_U32(row any, name string) uint32 {
// Catalog helper FishingCatalog4229938_U32
return 0
}
func FishingCatalog4229938_F32(row any, name string) float32 {
// Catalog helper FishingCatalog4229938_F32
return 0
}
func FishingCatalog4229938_Str(row any, name string) string {
// Catalog helper FishingCatalog4229938_Str
return ""
}
//
// InitGroup[].FishId 在这张表里是字符串("10105001"),
// 而 FishIdList[] 是数字 ⇒ 两种都要认。
//
func FishingCatalog4229938_FishIdOf(node any) uint32 {
// Catalog helper FishingCatalog4229938_FishIdOf
return 0
}
func FishingCatalog4229938_LoadSpots() map[uint32]FishingSpotRow4229938 {
// Catalog helper FishingCatalog4229938_LoadSpots
return nil
}
func FishingCatalog4229938_LoadFish() map[uint32]FishingFishRow4229938 {
// Catalog helper FishingCatalog4229938_LoadFish
return nil
}
func FishingCatalog4229938_LoadGear() map[uint32]FishingGearRow4229938 {
// Catalog helper FishingCatalog4229938_LoadGear
return nil
}
func FishingCatalog4229938_Resolve(fileName string) string {
// Catalog helper FishingCatalog4229938_Resolve
return ""
}