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/enemy_territory_spot_catalog4229938.go
T

134 lines
4.9 KiB
Go

package catalogs
import (
"encoding/json"
"os"
"path/filepath"
"sync"
)
var _ = json.RawMessage{}
var _ = sync.Mutex{}
var _ = os.ReadFile
var _ = filepath.Join
//
// One gang-territory corner: an authored world position plus the roster of enemy templates that
// belong to the gang owning it. Read from Configs/EnemyTerritorySpots.json — see
// _gen_enemy_territory.py.
//
//
// This is the first and only authored source of enemy positions in the dump. EnemyCatalog.json is
// a pure template table (no coordinates at all), so "where does this gang actually stand" has to
// come from somewhere else, and that somewhere is the faction influence system:
// 1. FactionInfluenceAreaConfig — 24 turfs, each with a FactionId and the list of point
// ids it contains (犬魔社 / 谜面帮 / 电视脑 / 黑金组 / 龙治团 / 焱风联合会 ...);
// 2. FactionAreaPointConfig — 85 points, PosXZ is 2D: x → world X, y → world Z;
// 3. Y is absent from the dump, so the generator snapped each XZ onto the nearest
// CivilianDistricts pavement spot and borrowed its height. Measured spread: median
// 12.0 m, max 28.3 m — the snap radius has to be 30, 15 would silently drop 26 of the 85.
// The roster is the summonable subset of SpawnIds.json enemies for that FactionId. Names in
// that table are unreliable (18000103's turf is 超频帮 while its enemy rows say G-Krew), so
// grouping is by the numeric id everywhere. 40 of the 85 turfs have no roster of their own —
// 18000104 狂悖野猪's single member is a civilian in AgentConfig and the two 填色 zones carry no
// FactionId at all — and the generator gave those the generic street-thug list instead of leaving
// them empty.
//
//
// One standing place inside a turf group. Generated by _gen_enemy_territory.py: the anchor and
// as many of its neighbours as possible are real CivilianDistricts pavement spots, the rest are
// fanned out within ~5 m of the anchor. Facing points at the group centroid.
//
type EnemyTerritoryMember struct {
X float32 `json:"x"`
Y float32 `json:"y"`
Z float32 `json:"z"`
Facing float32 `json:"facing"`
}
type EnemyTerritorySpot4229938 struct {
PointId uint32 `json:"pointId"`
FactionId uint32 `json:"factionId"`
AreaId uint32 `json:"areaId"`
AreaName string `json:"areaName"`
X float32 `json:"x"`
Y float32 `json:"y"`
Z float32 `json:"z"`
Facing float32 `json:"facing"`
SnapDistance float32 `json:"snapDistance"`
Raid uint32 `json:"raid"`
Agents []uint32 `json:"agents"`
Members []EnemyTerritoryMember `json:"members"`
}
//
// Reads Configs/EnemyTerritorySpots.json (85 spots). Parsed once behind a Lazy; a missing or
// malformed file is reported through LoadError instead of throwing, so the panel
// can say so and the follow loop simply stays empty.
//
var (
EnemyTerritorySpotCatalog4229938_cacheLock sync.RWMutex
EnemyTerritorySpotCatalog4229938_cached = false
EnemyTerritorySpotCatalog4229938_entries []any
)
// LoadEnemyTerritorySpotCatalog4229938 loads catalog records from client config directory
func LoadEnemyTerritorySpotCatalog4229938(configDir string) ([]any, error) {
EnemyTerritorySpotCatalog4229938_cacheLock.RLock()
if EnemyTerritorySpotCatalog4229938_cached {
defer EnemyTerritorySpotCatalog4229938_cacheLock.RUnlock()
return EnemyTerritorySpotCatalog4229938_entries, nil
}
EnemyTerritorySpotCatalog4229938_cacheLock.RUnlock()
EnemyTerritorySpotCatalog4229938_cacheLock.Lock()
defer EnemyTerritorySpotCatalog4229938_cacheLock.Unlock()
if EnemyTerritorySpotCatalog4229938_cached { return EnemyTerritorySpotCatalog4229938_entries, nil }
filePath := filepath.Join(configDir, "EnemyTerritorySpotCatalog.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)
}
}
EnemyTerritorySpotCatalog4229938_entries = result
EnemyTerritorySpotCatalog4229938_cached = true
return result, nil
}
// Every spot belonging to <raidId>; an unknown raid yields none.
func EnemyTerritorySpotCatalog4229938_ForRaid(raidId uint32) []EnemyTerritorySpot4229938 {
// Catalog helper EnemyTerritorySpotCatalog4229938_ForRaid
return nil
}
//
// Spots of <raidId> inside <radius> metres of (x, z), nearest first.
// radius <= 0 means "every spot of that raid".
//
func EnemyTerritorySpotCatalog4229938_WithinRadius(raidId uint32, x float32, z float32, radius float32) []EnemyTerritorySpot4229938 {
// Catalog helper EnemyTerritorySpotCatalog4229938_WithinRadius
return nil
}
func EnemyTerritorySpotCatalog4229938_Distance2(spot EnemyTerritorySpot4229938, x float32, z float32) float32 {
// Catalog helper EnemyTerritorySpotCatalog4229938_Distance2
return 0
}