From 34056276f501335680d461bdab8eb88cd1fe0b62 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 9 Oct 2024 20:31:21 +0200 Subject: [PATCH] Update maxroll importer for spiritborn --- .github/actions/setup_env/action.yml | 1 - .github/workflows/ci.yml | 6 ------ assets/lang/enUS/item_types.json | 1 + src/__init__.py | 2 +- src/gui/importer/common.py | 2 ++ src/gui/importer/maxroll.py | 12 ++++++++---- src/item/data/item_type.py | 1 + src/tools/gen_data.py | 1 + tests/gui/importer/test_maxroll.py | 12 +++--------- 9 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.github/actions/setup_env/action.yml b/.github/actions/setup_env/action.yml index af7dac63..7fed025d 100644 --- a/.github/actions/setup_env/action.yml +++ b/.github/actions/setup_env/action.yml @@ -9,7 +9,6 @@ runs: uses: actions/setup-python@v5 with: python-version: "3.12" - cache: "pip" - name: Install dependencies shell: powershell diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5de5bc87..417c2f25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,12 +16,6 @@ jobs: - name: Setup env uses: ./.github/actions/setup_env - - name: Setup cache - uses: actions/cache@v4 - with: - path: ~/.cache/pre-commit - key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} - - name: pre-commit shell: powershell run: pre-commit run -a diff --git a/assets/lang/enUS/item_types.json b/assets/lang/enUS/item_types.json index cfa5a013..e1533a28 100644 --- a/assets/lang/enUS/item_types.json +++ b/assets/lang/enUS/item_types.json @@ -18,6 +18,7 @@ "Material": "custom type material", "OffHandTotem": "totem", "Polearm": "polearm", + "Quarterstaff": "quarterstaff", "Ring": "ring", "Scythe": "scythe", "Scythe2H": "two-handed scythe", diff --git a/src/__init__.py b/src/__init__.py index 5e363e3a..06f860f6 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -2,4 +2,4 @@ TP = concurrent.futures.ThreadPoolExecutor() -__version__ = "5.8.0" +__version__ = "5.8.1" diff --git a/src/gui/importer/common.py b/src/gui/importer/common.py index 00c313d4..6d9ba07d 100644 --- a/src/gui/importer/common.py +++ b/src/gui/importer/common.py @@ -50,6 +50,8 @@ def fix_weapon_type(input_str: str) -> ItemType | None: return ItemType.Axe2H if "2h scythe" in input_str: return ItemType.Scythe2H + if "quarterstaff" in input_str: + return ItemType.Quarterstaff if "scythe" in input_str: return ItemType.Scythe if "crossbow" in input_str: diff --git a/src/gui/importer/maxroll.py b/src/gui/importer/maxroll.py index 697ba583..e953a344 100644 --- a/src/gui/importer/maxroll.py +++ b/src/gui/importer/maxroll.py @@ -152,12 +152,14 @@ def _find_item_affixes(mapping_data: dict, item_affixes: dict) -> list[Affix]: attr_desc = f"to {skill_data["name"]}" break else: - if affix["attributes"][0]["param"] == -1460542966 and affix["attributes"][0]["id"] == 1033: + if affix["attributes"][0]["param"] == -1460542966: attr_desc = "to core skills" - elif affix["attributes"][0]["param"] == -755407686 and affix["attributes"][0]["id"] == 1034: + elif affix["attributes"][0]["param"] == -755407686: attr_desc = "to defensive skills" - elif affix["attributes"][0]["param"] == 746476422 and affix["attributes"][0]["id"] == 1034: + elif affix["attributes"][0]["param"] == 746476422: attr_desc = "to mastery skills" + elif affix["attributes"][0]["param"] == -954965341: + attr_desc = "to basic skills" clean_desc = re.sub(r"\[.*?\]|[^a-zA-Z ]", "", attr_desc) clean_desc = clean_desc.replace("SecondSeconds", "seconds") affix_obj = Affix(name=closest_match(clean_str(clean_desc), Dataloader().affix_dict)) @@ -181,6 +183,8 @@ def _attr_desc_special_handling(affix_id: str) -> str: return "maximum poison resistance" case 2037914: return "subterfuge cooldown reduction" + case 2123788: + return "chance for core skills to hit twice" case _: return "" @@ -233,7 +237,7 @@ def _extract_planner_url_and_id_from_guide(url: str) -> tuple[str, int]: if __name__ == "__main__": src.logger.setup() URLS = [ - "https://maxroll.gg/d4/planner/1i5tt0c0#2", + "https://maxroll.gg/d4/planner/pl7lv0kv#3", ] for X in URLS: import_maxroll(url=X) diff --git a/src/item/data/item_type.py b/src/item/data/item_type.py index d846980f..0d852e48 100644 --- a/src/item/data/item_type.py +++ b/src/item/data/item_type.py @@ -20,6 +20,7 @@ class ItemType(Enum): Mace2H = "two-handed mace" OffHandTotem = "totem" Polearm = "polearm" + Quarterstaff = "quarterstaff" Ring = "ring" Scythe = "scythe" Scythe2H = "two-handed scythe" diff --git a/src/tools/gen_data.py b/src/tools/gen_data.py index 417e6436..ac9c2a52 100644 --- a/src/tools/gen_data.py +++ b/src/tools/gen_data.py @@ -173,6 +173,7 @@ def main(d4data_dir: Path, companion_app_dir: Path): "Mace2H", "OffHandTotem", "Polearm", + "Quarterstaff", "Ring", "Scythe", "Scythe2H", diff --git a/tests/gui/importer/test_maxroll.py b/tests/gui/importer/test_maxroll.py index 0c5f0417..78e3a8e4 100644 --- a/tests/gui/importer/test_maxroll.py +++ b/tests/gui/importer/test_maxroll.py @@ -6,17 +6,11 @@ URLS = [ "https://maxroll.gg/d4/build-guides/double-swing-barbarian-guide", + "https://maxroll.gg/d4/build-guides/evade-spiritborn-build-guide", "https://maxroll.gg/d4/build-guides/frozen-orb-sorcerer-guide", "https://maxroll.gg/d4/build-guides/minion-necromancer-guide", - "https://maxroll.gg/d4/build-guides/shadow-minion-necromancer-guide", - "https://maxroll.gg/d4/planner/1i5tt0c0#2", - "https://maxroll.gg/d4/planner/3n11i06l", - "https://maxroll.gg/d4/planner/ailu5022#4", - "https://maxroll.gg/d4/planner/cm6pf0xa#5", - "https://maxroll.gg/d4/planner/dq1q601f#2", - "https://maxroll.gg/d4/planner/dqih026y#3", - "https://maxroll.gg/d4/planner/r61bp0om#11", - "https://maxroll.gg/d4/planner/ubaoz02q#1", + "https://maxroll.gg/d4/build-guides/quill-volley-spiritborn-guide", + "https://maxroll.gg/d4/build-guides/touch-of-death-spiritborn-guide", ]