feat:初版

This commit is contained in:
2025-12-26 18:10:39 +08:00
commit fd15f9eb8f
17 changed files with 3486 additions and 0 deletions

42
pz_config/models.py Normal file
View File

@@ -0,0 +1,42 @@
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal, Mapping
ValueType = Literal["bool", "int", "float", "string"]
@dataclass(frozen=True)
class Setting:
"""
A single editable setting from either server.ini or server_SandboxVars.lua.
- For INI: `path == key`
- For Lua: `path` is dotted (e.g. "ZombieLore.Speed")
"""
source: Literal["ini", "lua"]
path: str
key: str
group: str
value_type: ValueType
value: bool | int | float | str
raw_value: str
line_index: int
description_zh: str
description_en: str | None = None
min_value: int | float | None = None
max_value: int | float | None = None
default_value: str | None = None
choices: Mapping[str, str] | None = None
@dataclass(frozen=True)
class ParsedConfig:
source: Literal["ini", "lua"]
filepath: str
lines: list[str]
settings: list[Setting]