Skip to content

Commit

Permalink
Resolved issue where many normal affixes were being read as greater a…
Browse files Browse the repository at this point in the history
…ffixes (#433)
  • Loading branch information
cjshrader authored Feb 8, 2025
1 parent 64717b7 commit 4f2d89b
Show file tree
Hide file tree
Showing 7 changed files with 270 additions and 5 deletions.
1 change: 1 addition & 0 deletions assets/lang/enUS/affixes.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
"core_attack_speed": "core attack speed",
"core_damage": "core damage",
"corpse_attack_speed": "corpse attack speed",
"corpse_damage": "corpse damage",
"corpse_explosion_damage": "corpse explosion damage",
"corpse_explosion_fears_and_slows_for_seconds": "corpse explosion fears and slows for seconds",
"corpse_explosion_size": "corpse explosion size",
Expand Down
3 changes: 2 additions & 1 deletion assets/lang/enUS/uniques.json
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,8 @@
"desc": "when consuming a corpse there is a chance to also create a decaying",
"num_idx": [
0
]
],
"num_inherents": 2
},
"the_oculus": {
"desc": "gain the effect of the teleport enchantment for free. when you evade using teleport enchantment you are taken to a random location.",
Expand Down
2 changes: 1 addition & 1 deletion src/item/descr/read_descr_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
r"(?P<affixvalue2>[0-9]+\.[0-9]+).+?\[(?P<minvalue2>[0-9]+\.[0-9]+) - (?P<maxvalue2>[0-9]+\.[0-9]+)\]|"
r"(?P<affixvalue3>[.0-9]+)[^0-9]+\[(?P<onlyvalue>[.0-9]+)\]|"
r".?![^\[\]]*[\[\]](?P<affixvalue4>\d+.?:\.\d+?)(?P<greateraffix1>[ ]*)|"
r"(?P<greateraffix2>\d+)(?![^\[]*\[).*",
r"(?P<greateraffix2>\d+)(?![^\[(]*[])]).*",
re.DOTALL,
)

Expand Down
7 changes: 5 additions & 2 deletions src/scripts/loot_filter_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def check_items(inv: InventoryBase, force_refresh: ItemRefreshType):
item_descr_previous_check = None
try:
item_descr_previous_check = src.item.descr.read_descr_tts.read_descr()
LOGGER.debug(f"Parsed item based on TTS: {item_descr}")
LOGGER.debug(f"Initial parsed item based on TTS: {item_descr_previous_check}")
except Exception:
screenshot("tts_error", img=img)
LOGGER.exception(f"Error in TTS read_descr. {src.tts.LAST_ITEM=}")
Expand All @@ -52,7 +52,7 @@ def check_items(inv: InventoryBase, force_refresh: ItemRefreshType):
time.sleep(0.1)
try:
item_descr = src.item.descr.read_descr_tts.read_descr()
LOGGER.debug(f"Parsed item based on TTS: {item_descr}")
LOGGER.debug(f"Check {retry_count + 1}: Parsed item based on TTS: {item_descr}")
if item_descr != item_descr_previous_check:
item_descr_previous_check = item_descr
item_descr = None
Expand Down Expand Up @@ -80,6 +80,9 @@ def check_items(inv: InventoryBase, force_refresh: ItemRefreshType):
if item_descr.item_type == ItemType.TemperManual:
LOGGER.info("Matched: Temper Manual")
continue
if item_descr.item_type == ItemType.Cache:
LOGGER.info("Matched: Cache")
continue
if item_descr.rarity in [ItemRarity.Magic, ItemRarity.Common] and item_descr.item_type != ItemType.Sigil:
mark_as_junk()
continue
Expand Down
1 change: 1 addition & 0 deletions src/tools/data/custom_affixes_enUS.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"corpse_damage": "corpse damage",
"crowd_control_duration_lucky_hit_up_to_a_chance_to_heal_life": "crowd control duration lucky hit up to a chance to heal life",
"fire_damage_ranks_of_the_inner_flames_passive": "fire damage ranks of the inner flames passive",
"lucky_hit_up_to_a_chance_to_gain_damage_for_seconds": "lucky hit up to a chance to gain damage for seconds",
Expand Down
3 changes: 2 additions & 1 deletion src/tools/data/custom_uniques_enUS.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"desc": "when consuming a corpse there is a chance to also create a decaying",
"num_idx": [
0
]
],
"num_inherents": 2
},
"the_third_blade": {
"desc": "your weapon mastery skills are now also core skills that have no cooldowns but",
Expand Down
258 changes: 258 additions & 0 deletions tests/item/read_descr_season6_tts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import src.tts
from src.item.data.affix import AffixType
from src.item.data.aspect import Aspect
from src.item.data.item_type import ItemType
from src.item.data.rarity import ItemRarity
from src.item.descr.read_descr_tts import read_descr
Expand Down Expand Up @@ -81,6 +82,7 @@
"TORMENTORS ELEGANT POLEARM",
"Legendary Polearm",
"750 Item Power",
"Armory Loadout",
"523 Damage Per Second",
"[466 - 698] Damage per Hit",
"0.90 Attacks per Second (Slow)",
Expand Down Expand Up @@ -109,6 +111,262 @@
rarity=ItemRarity.Legendary,
),
),
# Unique with an abnormal amount of inherents (1, normally pants have 0).
# Also, equipped, so affixes don't have a (+x.xx) at the end
(
[
"KESSIMES LEGACY",
"Unique Pants",
"750 Item Power",
"150 Armor",
"Casting Blood Wave Fortifies You For +70.0% Maximum Life [70.0]%",
"+215.0% Ultimate Damage [187.0 - 250.0]%",
"13.5% Damage Reduction while Fortified [9.5 - 14.5]%",
"+23.5% Chance for Blood Wave to Deal Double Damage [23.5 - 32.5]%",
"20.0% Blood Wave Cooldown Reduction [16.0 - 25.0]%",
"Blood Wave now forms a wave on each side of you. Both waves converge at your feet, Pulling In all surrounding enemies and exploding for 1,548 [794 - 1,588] damage.. Each wave hit causes enemies to take 9.75% [5.00 - 10.00]% more damage from your Blood Waves, up to 292.5% [150.0 - 300.0]%.",
"+30 Intelligence",
"+30 Intelligence",
"Too soon she was taken, yet Rathma let Kessime rest in death - for they both had found peace in the cycle. Upon the hill where she lay, Rathma poured forth his blood and no evil trod thereafter...",
"Requires Level 60. Account BoundNecromancer. Only. Unique Equipped",
"Sell Value: 150,482 Gold",
"Durability: 50/100",
"Right mouse button",
],
Item(
affixes=[
Affix(
max_value=250.0,
min_value=187.0,
name="ultimate_damage",
type=AffixType.normal,
value=215.0,
),
Affix(
max_value=14.5,
min_value=9.5,
name="damage_reduction_while_fortified",
type=AffixType.normal,
value=13.5,
),
Affix(
max_value=32.5,
min_value=23.5,
name="chance_for_blood_wave_to_deal_double_damage",
type=AffixType.normal,
value=23.5,
),
Affix(
max_value=25.0,
min_value=16.0,
name="blood_wave_cooldown_reduction",
type=AffixType.normal,
value=20.0,
),
],
aspect=Aspect(
name="kessimes_legacy",
text="Blood Wave now forms a wave on each side of you. Both waves converge at your feet, Pulling In all surrounding enemies and exploding for 1,548 [794 - 1,588] damage.. Each wave hit causes enemies to take 9.75% [5.00 - 10.00]% more damage from your Blood Waves, up to 292.5% [150.0 - 300.0]%.",
value=1548.0,
),
inherent=[
Affix(
max_value=70.0,
min_value=70.0,
name="casting_blood_wave_fortifies_you_for_maximum_life",
type=AffixType.inherent,
value=70.0,
)
],
item_type=ItemType.Legs,
name="kessimes_legacy",
power=750,
rarity=ItemRarity.Unique,
),
),
# Unique with no greater affixes and weird inherents
(
[
"THE MORTACRUX",
"Unique Dagger",
"750 Item Power",
"261 Damage Per Second (-334)",
"[174 - 262] Damage per Hit",
"1.20 Attacks per Second (Very Fast) (+0.30)",
"+85.0% Macabre Damage [85.0]% (+85.0%)",
"+85.0% Corpse Damage [85.0]% (+85.0%)",
"+78 Intelligence +[73 - 83] (-157)",
"+45.5% Chance for Corpse Explosion to Deal Double Damage [36.5 - 50.0]% (+45.5%)",
"Hewed Flesh Grants 7.0% Maximum Life as Barrier for 4 Seconds [7.0 - 9.0]% (+7.0%)",
"+2 to Hewed Flesh [2 - 4] (+2)",
"When consuming a Corpse, there is a 26% [20 - 40]% chance to also create a decaying Skeletal Simulacrum that seeks enemies but cannot attack. When it dies, it explodes for 2,382 Shadow damage. . This effect is treated as a Macabre Skill.",
"Empty Socket",
"Properties lost when equipped:",
"+874 Maximum Life",
"+2 to Finality",
"+512.7% Overpower Damage",
"+205.0% Damage while Fortified",
"Legendary Power",
"Socket (1)",
"One of a pair of twin daggers, forbidden from ever meeting. Nearby corpses shudder in its presence.",
"Requires Level 60Necromancer. Only. Unique Equipped",
"Unlocks new look on salvage",
"Sell Value: 184,341 Gold",
"Durability: 100/100",
"Right mouse button",
],
Item(
affixes=[
Affix(
max_value=83,
min_value=73,
name="intelligence",
text="+78 Intelligence +[73 - 83] (-157)",
type=AffixType.normal,
value=78.0,
),
Affix(
max_value=50.0,
min_value=36.5,
name="chance_for_corpse_explosion_to_deal_double_damage",
text="+45.5% Chance for Corpse Explosion to Deal Double Damage [36.5 - 50.0]% (+45.5%)",
type=AffixType.normal,
value=45.5,
),
Affix(
max_value=9.0,
min_value=7.0,
name="hewed_flesh_grants_maximum_life_as_barrier_for_seconds",
text="Hewed Flesh Grants 7.0% Maximum Life as Barrier for 4 Seconds [7.0 - 9.0]% (+7.0%)",
type=AffixType.normal,
value=7.0,
),
Affix(
max_value=4,
min_value=2,
name="to_hewed_flesh",
text="+2 to Hewed Flesh [2 - 4] (+2)",
type=AffixType.normal,
value=2.0,
),
],
aspect=Aspect(
name="the_mortacrux",
text="When consuming a Corpse, there is a 26% [20 - 40]% chance to also create a decaying Skeletal Simulacrum that seeks enemies but cannot attack. When it dies, it explodes for 2,382 Shadow damage. . This effect is treated as a Macabre Skill.",
value=26,
),
codex_upgrade=False,
inherent=[
Affix(
max_value=85,
min_value=85,
name="macabre_damage",
text="+85.0% Macabre Damage [85.0]% (+85.0%)",
type=AffixType.inherent,
value=85.0,
),
Affix(
max_value=85,
min_value=85,
name="corpse_damage",
text="+85.0% Corpse Damage [85.0]% (+85.0%)",
type=AffixType.inherent,
value=85.0,
),
],
item_type=ItemType.Dagger,
name="the_mortacrux",
power=750,
rarity=ItemRarity.Unique,
),
),
# Unique with GA
(
[
"SHARD OF VERATHIEL",
"Ancestral Unique Sword",
"800 Item Power",
"298 Damage Per Second (-297)",
"[217 - 325] Damage per Hit",
"1.10 Attacks per Second (Fast) (+0.20)",
"+50.0% Damage [50.0]% (+50.0%)",
"+56 All Stats +[51 - 65] (+56)",
"+24 Maximum Resource (+24)",
"+18.0% Basic Attack Speed [16.0 - 25.0]% (+18.0%)",
"+2 to Basic Skills [1 - 2] (+2)",
"Basic Skills deal 133%[x] [50 - 200]% increased damage but additionally cost 25 Primary Resource.",
"Empty Socket",
"Properties lost when equipped:",
"+874 Maximum Life",
"+2 to Finality",
"+512.7% Overpower Damage",
"+205.0% Damage while Fortified",
"+235 Intelligence",
"Legendary Power",
"Socket (1)",
"This blade once bore divine purpose wielded by the angel Verathiel. Like its keeper, the sword fell to Infernal depths. Yet beneath this corruption, is a heartbeat of a past memory, holding steadfast.",
"Requires Level 60. Unique Equipped",
"Sell Value: 206,382 Gold",
"Durability: 100/100",
"Right mouse button",
],
Item(
affixes=[
Affix(
max_value=65.0,
min_value=51.0,
name="all_stats",
text="+56 All Stats +[51 - 65] (+56)",
type=AffixType.normal,
value=56.0,
),
Affix(
max_value=None,
min_value=None,
name="maximum_resource",
text="+24 Maximum Resource (+24)",
type=AffixType.greater,
value=24.0,
),
Affix(
max_value=25.0,
min_value=16.0,
name="basic_attack_speed",
text="+18.0% Basic Attack Speed [16.0 - 25.0]% (+18.0%)",
type=AffixType.normal,
value=18.0,
),
Affix(
max_value=2.0,
min_value=1.0,
name="to_basic_skills",
text="+2 to Basic Skills [1 - 2] (+2)",
type=AffixType.normal,
value=2.0,
),
],
aspect=Aspect(
name="shard_of_verathiel",
text="Basic Skills deal 133%[x] [50 - 200]% increased damage but additionally cost 25 Primary Resource.",
value=133.0,
),
codex_upgrade=False,
inherent=[
Affix(
max_value=50.0,
min_value=50.0,
name="damage",
text="+50.0% Damage [50.0]% (+50.0%)",
type=AffixType.inherent,
value=50.0,
)
],
item_type=ItemType.Sword,
name="shard_of_verathiel",
power=800,
rarity=ItemRarity.Unique,
),
),
]


Expand Down

0 comments on commit 4f2d89b

Please sign in to comment.