diff --git a/.gitignore b/.gitignore index 87e0fb6..a8c96d3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,10 @@ /bin.py python/dontlook.py expected_values.md +/bin.py +python/dontlook.py +expected_values.md +releases/* # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/Cargo.lock b/Cargo.lock index 9d5c6dc..090a8c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,9 +86,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -241,9 +241,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] @@ -310,9 +310,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -342,9 +342,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "scopeguard" @@ -354,9 +354,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.144" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" [[package]] name = "smallvec" @@ -394,9 +394,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.99" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +checksum = "d56e159d99e6c2b93995d171050271edb50ecc5288fbc7cc17de8fdce4e58c14" dependencies = [ "proc-macro2", "quote", @@ -429,18 +429,18 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] [[package]] name = "unicode-ident" -version = "1.0.3" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unindent" @@ -553,7 +553,7 @@ checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "xiv_craft_solver" -version = "0.1.2" +version = "0.1.3" dependencies = [ "clap", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index a1ced99..2fabe8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,13 @@ [package] name = "xiv_craft_solver" -version = "0.1.2" +version = "0.1.3" edition = "2021" authors = ["谭俊健","Dandaedre","Vkyfox"] description = "Small XIV solver library in rust, with python and rust bindings" +homepage = "https://proxy.dandaedre.com/gitea/Dandaedre/rcraft_solver" +documentation = "https://proxy.dandaedre.com/gitea/Dandaedre/rcraft_solver" +repository = "https://proxy.dandaedre.com/gitea/Dandaedre/rcraft_solver.git" +license = "MIT OR Apache-2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -35,12 +39,12 @@ no_python = [] # Removes the python bindings fast = [] # Remove some under optimisations that try to find other routes [lib] -name = "xiv_craft_solver" +name = "xiv_craft_solver" # Pending rename ffcraft_solver_lib path = "src/lib.rs" crate-type = ["cdylib","rlib"] [[bin]] -name = "ffcraft" +name = "ffcraft_solver_cli" path = "src/bin/ffcraft.rs" [tool.maturin] diff --git a/Todo.md b/Todo.md new file mode 100644 index 0000000..626a4e8 --- /dev/null +++ b/Todo.md @@ -0,0 +1,28 @@ +# Pre-Release + +## v0.2 +### Breaking + 🟩 (GUI) Visual feedback when pressing solve + 🟩 (GUI) Ability to save + 🟩 (GUI) Make the logging work + 🟩 (PKG) Rename libs, bin, python, exe +### Important + 🟩 (PKG) Have cargo-make setup for release/cleanup/build + 🟩 (PKG) Merge latest pre-release for the GUI +### Features + 🟩 (GUI) Refactor code + +# Roadmap +## v1.0.0 + +### Important + 🟩 (LIB) Rust API docs + 🟩 (CLI) Accept and copy from the base recipes + 🟩 (CLI) Accept and copy pots & food + 🟩 (PKG) Have a unified toml/yaml way of registering recipes + 🟩 (LIB) Tests + +### Features + 🟩 (GUI) Have full documentation + 🟩 (LIB) Benchmarks + 🟩 (GUI) Code coverage \ No newline at end of file diff --git a/craft.toml b/craft.toml index 5829bc9..99b2be9 100644 --- a/craft.toml +++ b/craft.toml @@ -48,6 +48,21 @@ craftsmanship = 4041 control = 3959 max_cp = 602 +[frenetic] +craftsmanship = 4041 +control = 3971 +max_cp = 595 + +[frenefood] +craftsmanship = 4041 +control = 4061 +max_cp = 681 + +[frenechad] +craftsmanship = 4041 +control = 4055 +max_cp = 619 + [cero] craftsmanship = 1818 control = 1983 diff --git a/makefile b/makefile new file mode 100755 index 0000000..9906582 --- /dev/null +++ b/makefile @@ -0,0 +1,27 @@ +clean: + @echo "[MAKE] Cleaning last release" + cargo clean + rm -rf releases + rm -rf python/build + rm -rf python/dist + +rust: + @echo "[MAKE] Building the libraries" + maturin develop --release -q + cargo build --release -q # --features="no_python" + +python: + @echo "[MAKE] Building the python project" + cd python && rm -rf build dist + cd python && pip install -q -r requirements_dev.txt + cd python && pip install -q -e . + cd python && pyinstaller src/ffcraft_solver/__main__.py -i "src/ffcraft_solver/ressources/ffcraft_solver.ico" --add-data "src/ffcraft_solver/configs/:ffcraft_solver/configs" --add-data "src/ffcraft_solver/ressources/:ffcraft_solver/ressources" --name ffcraft_solver_gui -y > /dev/null 2>pyinstaller_log.txt + + + +.PHONY: clean rust python +release: clean rust python + mkdir -p releases # Add version as an arg and things + @echo "[MAKE] Copying releases in the releases/ directory" + zip releases/ffcraft_solver_cli.zip -q -j target/release/ffcraft_solver_cli craft.toml -j target/release/libxiv_craft_solver.so + cd python/dist/ && zip -q ../../releases/ffcraft_solver_gui.zip -r ffcraft_solver_gui/ \ No newline at end of file diff --git a/python/ffcraft_solver-0.0.4-py3-none-any.whl b/python/ffcraft_solver-0.0.4-py3-none-any.whl new file mode 100644 index 0000000..05f4662 Binary files /dev/null and b/python/ffcraft_solver-0.0.4-py3-none-any.whl differ diff --git a/python/pyinstaller_log.txt b/python/pyinstaller_log.txt new file mode 100644 index 0000000..0d5d164 --- /dev/null +++ b/python/pyinstaller_log.txt @@ -0,0 +1,58 @@ +71 INFO: PyInstaller: 5.8.0 +71 INFO: Python: 3.10.6 +72 INFO: Platform: Linux-6.1.11-76060111-generic-x86_64-with-glibc2.35 +72 INFO: wrote /home/dandaedre/Documents/Git/ffcraft_solver/python/ffcraft_solver_gui.spec +74 INFO: UPX is available. +74 INFO: Extending PYTHONPATH with paths +['/home/dandaedre/Documents/Git/ffcraft_solver/python/src'] +166 INFO: checking Analysis +166 INFO: Building Analysis because Analysis-00.toc is non existent +166 INFO: Initializing module dependency graph... +167 INFO: Caching module graph hooks... +176 INFO: Analyzing base_library.zip ... +581 INFO: Loading module hook 'hook-heapq.py' from '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks'... +625 INFO: Loading module hook 'hook-encodings.py' from '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks'... +1292 INFO: Loading module hook 'hook-pickle.py' from '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks'... +2161 INFO: Caching module dependency graph... +2221 INFO: running Analysis Analysis-00.toc +2236 INFO: Analyzing /home/dandaedre/Documents/Git/ffcraft_solver/python/src/ffcraft_solver/__main__.py +2508 INFO: Loading module hook 'hook-platform.py' from '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks'... +2672 INFO: Loading module hook 'hook-pygments.py' from '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks'... +3097 INFO: Loading module hook 'hook-pkg_resources.py' from '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks'... +3438 INFO: Loading module hook 'hook-xml.py' from '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks'... +3457 INFO: Loading module hook 'hook-sysconfig.py' from '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks'... +4100 INFO: Processing module hooks... +5030 INFO: Processing pre-safe import module hook win32com from '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/_pyinstaller_hooks_contrib/hooks/pre_safe_import_module/hook-win32com.py'. +5209 INFO: Loading module hook 'hook-packaging.py' from '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks'... +5271 INFO: Looking for ctypes DLLs +5276 INFO: Analyzing run-time hooks ... +5278 INFO: Including run-time hook '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks/rthooks/pyi_rth_inspect.py' +5279 INFO: Including run-time hook '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks/rthooks/pyi_rth_pkgres.py' +5281 INFO: Including run-time hook '/home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/hooks/rthooks/pyi_rth_pkgutil.py' +5288 INFO: Looking for dynamic libraries +5630 INFO: Looking for eggs +5630 INFO: Python library not among binary dependencies. Performing additional search... +5642 INFO: Using Python library /lib/x86_64-linux-gnu/libpython3.10.so.1.0 +5644 INFO: Warnings written to /home/dandaedre/Documents/Git/ffcraft_solver/python/build/ffcraft_solver_gui/warn-ffcraft_solver_gui.txt +5669 INFO: Graph cross-reference written to /home/dandaedre/Documents/Git/ffcraft_solver/python/build/ffcraft_solver_gui/xref-ffcraft_solver_gui.html +5679 INFO: Appending 'datas' from .spec +5684 INFO: checking PYZ +5684 INFO: Building PYZ because PYZ-00.toc is non existent +5684 INFO: Building PYZ (ZlibArchive) /home/dandaedre/Documents/Git/ffcraft_solver/python/build/ffcraft_solver_gui/PYZ-00.pyz +6064 INFO: Building PYZ (ZlibArchive) /home/dandaedre/Documents/Git/ffcraft_solver/python/build/ffcraft_solver_gui/PYZ-00.pyz completed successfully. +6073 WARNING: Ignoring icon; supported only on Windows and macOS! +6073 INFO: checking PKG +6073 INFO: Building PKG because PKG-00.toc is non existent +6073 INFO: Building PKG (CArchive) ffcraft_solver_gui.pkg +6087 INFO: Building PKG (CArchive) ffcraft_solver_gui.pkg completed successfully. +6087 INFO: Bootloader /home/dandaedre/Documents/Git/ffcraft_solver/.venv/lib/python3.10/site-packages/PyInstaller/bootloader/Linux-64bit-intel/run +6087 INFO: checking EXE +6087 INFO: Building EXE because EXE-00.toc is non existent +6087 INFO: Building EXE from EXE-00.toc +6087 INFO: Copying bootloader EXE to /home/dandaedre/Documents/Git/ffcraft_solver/python/build/ffcraft_solver_gui/ffcraft_solver_gui +6088 INFO: Appending PKG archive to custom ELF section in EXE +6096 INFO: Building EXE from EXE-00.toc completed successfully. +6096 INFO: checking COLLECT +6096 INFO: Building COLLECT because COLLECT-00.toc is non existent +6096 INFO: Building COLLECT COLLECT-00.toc +6236 INFO: Building COLLECT COLLECT-00.toc completed successfully. diff --git a/python/requirements_dev.txt b/python/requirements_dev.txt index a8b4c81..96c3071 100644 --- a/python/requirements_dev.txt +++ b/python/requirements_dev.txt @@ -5,4 +5,9 @@ pytest-cov==3.0.0 mypy==0.941 dearpygui==1.8.0 PyYAML==6.0 -rich==13.3.1 \ No newline at end of file +<<<<<<< HEAD +rich==13.3.1 +pyinstaller==5.8.0 +======= +rich==13.3.1 +>>>>>>> develop diff --git a/python/src/ffcraft_solver/ressources/ffcraft_solver.ico b/python/src/ffcraft_solver/ressources/ffcraft_solver.ico new file mode 100644 index 0000000..3b9f0cf Binary files /dev/null and b/python/src/ffcraft_solver/ressources/ffcraft_solver.ico differ diff --git a/python/src/ffcraft_solver/ressources/ffcraft_solver.png b/python/src/ffcraft_solver/ressources/ffcraft_solver.png new file mode 100644 index 0000000..60a51ef Binary files /dev/null and b/python/src/ffcraft_solver/ressources/ffcraft_solver.png differ diff --git a/src/action.rs b/src/action.rs index 513927c..d59cc12 100644 --- a/src/action.rs +++ b/src/action.rs @@ -25,7 +25,7 @@ impl ActionBuilder { short_name = short_name.replace("II", "2"); short_name.retain(|c| !c.is_whitespace() && c != '\''); short_name[0..1].make_ascii_lowercase(); - if name == "Basic Synthesis" { short_name = "basicSynth".to_string(); } + if name == "Basic Synthesis" { short_name = "basicSynth2".to_string(); } if name == "Groundwork" { short_name = "groundwork".to_string(); } if name == "Careful Synthesis" { short_name = "carefulSynthesis".to_string(); } diff --git a/src/io.rs b/src/io.rs index af0c153..9c8e7f5 100644 --- a/src/io.rs +++ b/src/io.rs @@ -95,8 +95,7 @@ impl Display for SolverResult{ //#[pymethods] impl SolverResult{ pub fn from_craft(craft: & Craft,step1_solutions : usize,step2_solutions : usize, found_100_percent: bool)->SolverResult{ - // Todo: recreate actions - // Where steps ? + let mut actions = craft.actions.iter().map(|action| format!("{}",action.short_name) ).collect::>(); diff --git a/src/python_bindings.rs b/src/python_bindings.rs new file mode 100644 index 0000000..44e2247 --- /dev/null +++ b/src/python_bindings.rs @@ -0,0 +1,4 @@ +#[cfg(not(feature="no_python"))] +use pyo3::prelude::*; + + diff --git a/src/solver.rs b/src/solver.rs index f2b6d0d..b17613c 100644 --- a/src/solver.rs +++ b/src/solver.rs @@ -129,7 +129,7 @@ pub fn next_action_phase_2<'a>(craft: & Craft<'a>) -> Vec> { available_actions.push(&ACTIONS.advanced_touch); forbidden_actions.push(&ACTIONS.basic_touch); } - // Todo, allow earlier byregot if the craft can be finished all the same (useless with always optimize on) + if craft.buffs.inner_quiet >= craft.args.byregot_step { // 10 available_actions.push(&ACTIONS.trained_finesse); available_actions.push(&ACTIONS.great_strides); @@ -155,7 +155,6 @@ pub fn next_action_phase_2<'a>(craft: & Craft<'a>) -> Vec> { pub fn generate_routes_phase2<'a>(craft: Craft<'a>) -> Option>> { let mut queue = VecDeque::new(); - // Todo: Return a vec of relevant functions, instead of the most quality one let mut top_route: Craft<'a> = craft.clone(); // Default route, no hq on that one let mut top_routes: Vec> = vec![];