feat:初版
This commit is contained in:
42
pz_config/models.py
Normal file
42
pz_config/models.py
Normal 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]
|
||||
|
||||
Reference in New Issue
Block a user