-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: python build | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
workflow_dispatch: ~ | ||
|
||
jobs: | ||
Python-Build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@master | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python -m pip install -r gcsim/requirements.txt | ||
- name: Check GCSIM scripts | ||
run: | | ||
python gcsim/main.py | ||
- name: Commit changes | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
author_name: github-actions[bot] | ||
author_email: github-actions[bot]@users.noreply.github.com | ||
push: 'origin remote --force' | ||
new_branch: 'remote' | ||
message: ':sparkles: Update gcsim scripts' | ||
add: | | ||
'gcsim.json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ on: | |
paths-ignore: | ||
- '**.md' | ||
- '**.json' | ||
- 'gcsim/**' | ||
tags: | ||
- '**' | ||
workflow_dispatch: ~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,3 +160,4 @@ cython_debug/ | |
.idea/ | ||
data/ | ||
*.exe | ||
gcsim/temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import asyncio | ||
import json | ||
import platform | ||
from pathlib import Path | ||
|
||
import aiofiles | ||
import re | ||
import gcsim_pypi | ||
|
||
data_path = Path("gcsim.json") | ||
gcsim_path = Path("gcsim") | ||
scripts_path = gcsim_path / "scripts" | ||
temp_path = gcsim_path / "temp" | ||
temp_path.mkdir(exist_ok=True) | ||
|
||
|
||
def _get_gcsim_bin_name() -> str: | ||
if platform.system() == "Windows": | ||
return "gcsim.exe" | ||
bin_name = "gcsim" | ||
if platform.system() == "Darwin": | ||
bin_name += ".darwin" | ||
if platform.machine() == "arm64": | ||
bin_name += ".arm64" | ||
return bin_name | ||
|
||
|
||
gcsim_pypi_path = Path(gcsim_pypi.__file__).parent | ||
bin_path = gcsim_pypi_path.joinpath("bin").joinpath(_get_gcsim_bin_name()) | ||
|
||
|
||
async def run_gcsim(path: Path) -> bool: | ||
try: | ||
process = await asyncio.create_subprocess_exec( | ||
bin_path, | ||
"-c", | ||
path.absolute().as_posix(), | ||
stdout=asyncio.subprocess.PIPE, | ||
stderr=asyncio.subprocess.PIPE, | ||
) | ||
_, stderr = await process.communicate() | ||
err = stderr.decode() | ||
if err: | ||
print(f"{path.name} 解析失败 {err}") | ||
return False | ||
return True | ||
except Exception: | ||
return False | ||
|
||
|
||
async def modify_script(path: Path): | ||
async with aiofiles.open(path, "r", encoding="utf-8") as f: | ||
content = await f.read() | ||
content = re.sub(r"iteration=\d+", "iteration=1", content) | ||
new_path = temp_path / path.name | ||
async with aiofiles.open(new_path, "w", encoding="utf-8") as f: | ||
await f.write(content) | ||
|
||
|
||
async def main(): | ||
for path in scripts_path.iterdir(): | ||
if path.is_file() and path.suffix == ".txt": | ||
await modify_script(path) | ||
allow = [] | ||
for path in temp_path.iterdir(): | ||
if await run_gcsim(temp_path / path.name): | ||
allow.append(path) | ||
data = {} | ||
for path in allow: | ||
async with aiofiles.open(path, "r", encoding="utf-8") as f: | ||
data[path.stem] = await f.read() | ||
async with aiofiles.open(data_path, "w", encoding="utf-8") as f: | ||
await f.write(json.dumps(data, ensure_ascii=False, indent=4)) | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
gcsim-pypi>=2.8.2.10 | ||
aiofiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
raiden char lvl=90/90 cons=0 talent=9,9,9; | ||
raiden add weapon="engulfinglightning" refine=1 lvl=90/90; | ||
raiden add set="eosf" count=4; | ||
raiden add stats hp=4780 atk=311 er=0.518 electro%=0.466 cr=0.311; | ||
raiden add stats def%=0.124 def=39.36 hp=507.88 hp%=0.0992 atk=33.08 atk%=0.1984 er=0.1102 em=39.64 cr=0.331 cd=0.7944; | ||
|
||
xingqiu char lvl=90/90 cons=6 talent=9,9,9; | ||
xingqiu add weapon="pjc" refine=1 lvl=90/90; | ||
xingqiu add set="no" count=4; | ||
xingqiu add stats hp=4780 atk=311 atk%=0.466 hydro%=0.466 cd=0.662 ; #main | ||
xingqiu add stats def%=0.124 def=39.36 hp=507.88 hp%=0.0992 atk=33.08 atk%=0.0992 er=0.4408 em=39.64 cr=0.2979 cd=0.5958; | ||
|
||
bennett char lvl=90/90 cons=6 talent=9,9,9; | ||
bennett add weapon="mistsplitterreforged" refine=1 lvl=90/90; | ||
bennett add set="instructor" count=4; | ||
bennett add stats hp=3571 atk=232 em=140.25 pyro%=0.466 cr=0.23325 ; #main | ||
bennett add stats def%=0.124 def=39.36 hp=507.88 hp%=0.0992 atk=33.08 atk%=0.0992 er=0.1102 em=39.64 cr=0.2979 cd=0.4634; | ||
|
||
xiangling char lvl=90/90 cons=6 talent=9,9,9; | ||
xiangling add weapon="staffofthescarletsands" refine=1 lvl=90/90; | ||
#xiangling add weapon="staffofthescarletsands" refine=5 lvl=90/90; | ||
xiangling add set="emblemofseveredfate" count=4; | ||
xiangling add stats hp=4780 atk=311 em=187 pyro%=0.466 cd=0.622; | ||
xiangling add stats def%=0.124 def=39.36 hp=507.88 hp%=0.0992 atk=33.08 atk%=0.0992 er=0.6612 em=39.64 cr=0.2317 cd=0.4634; | ||
|
||
options swap_delay=12 iteration=1000; | ||
target lvl=100 resist=0.1 hp=100000000 pos=3,0 radius=2; | ||
energy every interval=480,720 amount=1; | ||
|
||
set_particle_delay("bennett", 100); | ||
|
||
active raiden; | ||
|
||
raiden skill; | ||
for let x=0; x<5; x=x+1 { | ||
xingqiu skill, dash, burst, attack; | ||
bennett burst, attack, skill; | ||
xiangling attack, burst, attack, skill, dash; | ||
bennett attack, skill; | ||
raiden attack, burst, attack:4, skill, attack:4, dash, attack:4, dash, attack:5; | ||
bennett skill; | ||
} |