mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-25 09:03:10 +01:00
feat(rengoku): support rengoku_data.json as editable config source
Operators can now define Hunting Road configuration in a plain JSON file (rengoku_data.json) instead of maintaining an opaque pre-encrypted binary. The JSON is parsed, validated, assembled into the binary layout, and ECD-encrypted at startup; rengoku_data.bin is still used as a fallback. JSON schema covers both road modes (multi/solo) with typed floor and spawn-table entries — floor number, spawn-table index, point multipliers, and per-slot monster ID/variant/weighting fields. Out-of-range references are caught at load time before any bytes are written.
This commit is contained in:
@@ -450,12 +450,15 @@ func (s *Server) Season() uint8 {
|
||||
return uint8(((TimeAdjusted().Unix() / secsPerDay) + sid) % 3)
|
||||
}
|
||||
|
||||
// loadRengokuBinary reads, validates, and caches rengoku_data.bin from binPath.
|
||||
// The file is served to clients as-is (ECD-encrypted); decryption and parsing
|
||||
// are performed only for structural validation and startup logging.
|
||||
// Returns the raw encrypted bytes on success, or nil if the file is
|
||||
// missing or structurally invalid.
|
||||
// loadRengokuBinary loads and caches Hunting Road config. It prefers
|
||||
// rengoku_data.json (human-readable, built on the fly) and falls back to the
|
||||
// pre-encrypted rengoku_data.bin. Returns ECD-encrypted bytes ready to serve,
|
||||
// or nil if no valid source is found.
|
||||
func loadRengokuBinary(binPath string, logger *zap.Logger) []byte {
|
||||
if enc := loadRengokuFromJSON(binPath, logger); enc != nil {
|
||||
return enc
|
||||
}
|
||||
|
||||
path := filepath.Join(binPath, "rengoku_data.bin")
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user