diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e08663a7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.12-slim-bookworm +COPY --from=docker.io/astral/uv:latest /uv /uvx /bin/ + +WORKDIR /app +COPY . /app + +RUN uv venv +RUN uv pip install . +ENV PATH=$PATH:/app/.venv/bin + +EXPOSE 8501 + +CMD ["zsim", "run"] diff --git a/README.md b/README.md index de45ebdc..322a5103 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,10 @@ It provides a user-friendly interface to calculate the total damage output of a - Edit agents equipment - Edit APL code -## Install +> [!TIP] +> You can either install `ZZZ-Simulator` via `uv` or run it with dockers. + +## Install via UV Download the latest source code in release page or use `git clone` @@ -33,10 +36,15 @@ Download the latest source code in release page or use `git clone` Open terminal anywhere in your device: ```bash -# On macOS or Linux: +# On Linux or macOS without Homebrew: curl -LsSf https://astral.sh/uv/install.sh | sh ``` +```bash +# On macOS with Homebrew: +brew install uv +``` + ```bash # On Windows11 24H2 or later: winget install --id=astral-sh.uv -e @@ -63,7 +71,7 @@ uv venv uv pip install . # there is a '.' refer to relative path ``` -## Run +### Run Open terminal anywhere in your device: @@ -82,6 +90,42 @@ uv run ./zsim/run.py run uv run zsim run ``` +Then you can access the simulator at `http://localhost:8501`. + +## Install via Docker + +You can also run `ZZZ-Simulator` with Docker. + +> [!NOTE] +> Make sure you have docker installed on your machine. If you haven't installed it yet, please refer to the [official Docker installation guide](https://docs.docker.com/get-docker/). +> +> On macOS, it is recommended to use [Orbstack](https://docs.orbstack.dev/install) for a better experience. + +### Build the image + +```bash +docker build -t zzzsimulator . +``` + +### Create a container + +```bash +docker create --name zzzsimulator \ + -p 8501:8501 \ + zzzsimulator +``` + +### Run the container + +```bash +docker start zzzsimulator +``` + +Then you can access the simulator at `http://localhost:8501`. + +> [!TIP] +> If you are using Orbstack, you can access the simulator at `https://zzzsimulator.orb.local/`. + ## TODO LIST Go check [develop guide](https://github.com/ZZZSimulator/ZSim/wiki/%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97-Develop-Guide) for more details. diff --git a/zsim/lib_webui/constants.py b/zsim/lib_webui/constants.py index 19191536..7af1b7d4 100644 --- a/zsim/lib_webui/constants.py +++ b/zsim/lib_webui/constants.py @@ -198,7 +198,8 @@ def _init_char_mapping() -> dict[str, str]: } # 副词条最大值 -sc_max_value = 40 +sc_max_percent = 40 +sc_max_value = 1000 # 计算结果缓存文件路径 ID_CACHE_JSON = "./results/id_cache.json" diff --git a/zsim/page_character_config.py b/zsim/page_character_config.py index 027f6ae0..f9c228fa 100644 --- a/zsim/page_character_config.py +++ b/zsim/page_character_config.py @@ -223,6 +223,7 @@ def page_character_config(): key=f"{name}_main_stat6", ) from zsim.lib_webui.constants import sc_max_value + from zsim.lib_webui.constants import sc_max_percent st.text("副词条数量:") col1, col2, col3, col4, col5 = st.columns(5) @@ -230,7 +231,7 @@ def page_character_config(): st.number_input( "攻击力%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scATK_percent", 0) if name in saved_char_config else 0, @@ -249,7 +250,7 @@ def page_character_config(): st.number_input( "生命值%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scHP_percent", 0) if name in saved_char_config else 0, @@ -268,7 +269,7 @@ def page_character_config(): st.number_input( "防御力%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scDEF_percent", 0) if name in saved_char_config else 0, @@ -287,7 +288,7 @@ def page_character_config(): st.number_input( "暴击率", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scCRIT", 0) if name in saved_char_config else 0, @@ -296,7 +297,7 @@ def page_character_config(): st.number_input( "暴击伤害", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scCRIT_DMG", 0) if name in saved_char_config else 0, @@ -306,7 +307,7 @@ def page_character_config(): st.number_input( "异常精通", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scAnomalyProficiency", 0) if name in saved_char_config else 0, @@ -315,7 +316,7 @@ def page_character_config(): st.number_input( "穿透值", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scPEN", 0) if name in saved_char_config else 0,