Merge branch 'develop' into vky

This commit is contained in:
vicky 2023-02-24 14:41:17 +01:00
commit aef7f86742
15 changed files with 169 additions and 26 deletions

4
.gitignore vendored
View File

@ -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__/

34
Cargo.lock generated
View File

@ -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",

View File

@ -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]

28
Todo.md Normal file
View File

@ -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

View File

@ -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

27
makefile Executable file
View File

@ -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/

Binary file not shown.

View File

@ -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.

View File

@ -5,4 +5,9 @@ pytest-cov==3.0.0
mypy==0.941
dearpygui==1.8.0
PyYAML==6.0
rich==13.3.1
<<<<<<< HEAD
rich==13.3.1
pyinstaller==5.8.0
=======
rich==13.3.1
>>>>>>> develop

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB

View File

@ -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(); }

View File

@ -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::<Vec<String>>();

4
src/python_bindings.rs Normal file
View File

@ -0,0 +1,4 @@
#[cfg(not(feature="no_python"))]
use pyo3::prelude::*;

View File

@ -129,7 +129,7 @@ pub fn next_action_phase_2<'a>(craft: & Craft<'a>) -> Vec<Option<&'a Action>> {
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<Option<&'a Action>> {
pub fn generate_routes_phase2<'a>(craft: Craft<'a>) -> Option<Vec<Craft<'a>>> {
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<Craft<'a>> = vec![];