Advanced pickit (#383)

* logic for ident, first attr. advanced pickit

* logic advanced vs normal pickit

* logic_empty_ID_Tome

* small adj. to fit PR

* converted yaml to ini. changed some val.

* changed param to auto_ident

* pickit integration

* added set in routine

* reset bot init value

* bugfix

* removed old id logic

* added_nested_filter

* changed pickit

* bugfix replace

* added some more props

* Cleanup

* cleanup

* cleanup

* started unittests

* unittest

* small pickit adjustments

* Added missing fct. after merge

* bugfix due to static method in config.py

* added comments in pickit.ini

* Update pickit.ini

* Update params.ini

* Update ui_manager.py

* Update pickit.ini

Co-authored-by: aeon0
Co-authored-by: mgleed
This commit is contained in:
RB-Development
2022-01-31 01:40:36 +01:00
committed by GitHub
parent 09caab2120
commit 551a547ddb
68 changed files with 215 additions and 88 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -85,7 +85,7 @@ belt_hp_columns=1
belt_mp_columns=1
pre_buff_every_run=1
always_repair=0
id_items=0
id_items=1
open_chests=1
fill_shared_stash_first=0

View File

@@ -6,11 +6,9 @@
; 2: item will be picked up and a message will be sent to you (if message endpoint is set e.g. discord hook)
; see images in assets/item_properties for current supported properties
; currently only supporting properties that exist prior to identification
; supports identified properties (id_items need to be set to 1 to support magic, rare, uniqs, and sets)
; default behavior of grouped properties (a, b) is "OR". You can use and(a, b) for "AND" boolean logic
; everything following item_name= is case insensitive
; nested logic is not supported; i.e. you can't use and(a, or(b, c))
; magic/rare/set/uniq items do not show # of sockets prior to id but will show eth
; regarding ethereal items:
; if you want to keep ONLY ethereal, add ethereal after the first comma (not contained within parenthesis) like `item=1, ethereal`
@@ -28,6 +26,25 @@
; "gray_weapon_grand_matron_bow=1, and(3_bow_skills, enhanced_damage, socketed_4)" will pickup but stash
; only GMB that have 3+ bow skills AND enhanced damage modifier AND 4 sockets
;=============================================================================;
;<<<<<<<<<<<<<<<<<<<<<<<<<<<< Advanced Pickit >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;
;=============================================================================;
; since the advanced pickit PR you are now able to use nested filters for your include and/or exclude properties
; if you add an "OR" property like described above the nested part will be treated as "AND".
; if you add an "AND" property the nested part will be treated as "OR"
; therefore you are now able to keep items if they match one of the specified property lists
; for example you can keep magic smallcharms that have all resist, 7 mf or (3 maximum damage and attack_rating)
;examples
; keeps small charms with resi, 7_mf or 3 max_AD and AR
; magic_small_charm=1, (all_resist, 7_magicfind, and(3_maximum_damage, attack_rating))
; keeps all Skiller or (Life, max_AD, Life) GC
; magic_grand_charm=1, (Amazonskiller, Assasinskiller, Barbarianskiller, Druidskiller, Necromancerskiller, Paladinskiller, Sorceressskiller, (Life, maximum_damage, attack_rating))
; keeps greater talons with (2 Assa Skills + 3 lightning sentry) or (+Traps skills and + lightning sentry)
; magic_greater_talons=1, ((2_assasin_skills, 3_lightning_sentry), (traps, lightning_sentry))
[items]
;==================================================================;
@@ -80,7 +97,7 @@ misc_sapphire=0
misc_skull=0
;flawless gems
misc_flawless_amethyst=0
misc_flawless_amethyst=1
misc_flawless_ruby=0
misc_flawless_diamond=0
misc_flawless_topaz=0
@@ -99,7 +116,7 @@ rune_4_nef=0
rune_5_eth=0
rune_6_ith=0
rune_7_tal=0
rune_8_ral=0
rune_8_ral=1
rune_9_ort=0
rune_10_thul=0
rune_11_amn=0
@@ -131,22 +148,22 @@ rune_33_zod=2
;==================================================================;
;magic charms
magic_grand_charm=1
magic_grand_charm=1, (Amazonskiller, Assasinskiller, Barbarianskiller, Druidskiller, Necromancerskiller, Paladinskiller, Sorceressskiller, (Life, maximum_damage, attack_rating))
magic_large_charm=0
magic_small_charm=1
magic_small_charm=1, (all_resist, 7_magicfind, 20_life, and(3_maximum_damage, attack_rating))
;magic jewelry
magic_jewel=1
magic_jewel=1, and(15_increased_attack_speed, enhanced_damage)
magic_amulet=0
;magic helmets
magic_circlet=0,, ethereal
magic_coronet=0,, ethereal
magic_diadem=0,, ethereal
magic_tiara=0,, ethereal
magic_circlet=1, ((faster_cast_rate, 2_amazon_skills), (faster_cast_rate, 2_assasin_skills), (faster_cast_rate, 2_barbarian_skills), (faster_cast_rate, 2_Druid_skills), (faster_cast_rate, 2_necromancer_skills), (faster_cast_rate, 2_paladin_skills), (faster_cast_rate, 2_sorceress_skills), (2_all_skills, faster_cast_rate), (3_pcombat, faster_cast_rate), (faster_run_walk, 2_amazon_skills), (faster_run_walk, 2_all_skills), (faster_run_walk, 2_assasin_skills), (faster_run_walk, 2_barbarian_skills), (faster_run_walk, 2_Druid_skills)), ethereal
magic_coronet=1, ((faster_cast_rate, 2_amazon_skills), (faster_cast_rate, 2_assasin_skills), (faster_cast_rate, 2_barbarian_skills), (faster_cast_rate, 2_Druid_skills), (faster_cast_rate, 2_necromancer_skills), (faster_cast_rate, 2_paladin_skills), (faster_cast_rate, 2_sorceress_skills), (2_all_skills, faster_cast_rate), (3_pcombat, faster_cast_rate), (faster_run_walk, 2_amazon_skills), (faster_run_walk, 2_all_skills), (faster_run_walk, 2_assasin_skills), (faster_run_walk, 2_barbarian_skills), (faster_run_walk, 2_Druid_skills)), ethereal
magic_diadem=1, ((faster_cast_rate, 2_amazon_skills), (faster_cast_rate, 2_assasin_skills), (faster_cast_rate, 2_barbarian_skills), (faster_cast_rate, 2_Druid_skills), (faster_cast_rate, 2_necromancer_skills), (faster_cast_rate, 2_paladin_skills), (faster_cast_rate, 2_sorceress_skills), (2_all_skills, faster_cast_rate), (3_pcombat, faster_cast_rate), (faster_run_walk, 2_amazon_skills), (faster_run_walk, 2_all_skills), (faster_run_walk, 2_assasin_skills), (faster_run_walk, 2_barbarian_skills), (faster_run_walk, 2_Druid_skills)), ethereal
magic_tiara=1, ((faster_cast_rate, 2_amazon_skills), (faster_cast_rate, 2_assasin_skills), (faster_cast_rate, 2_barbarian_skills), (faster_cast_rate, 2_Druid_skills), (faster_cast_rate, 2_necromancer_skills), (faster_cast_rate, 2_paladin_skills), (faster_cast_rate, 2_sorceress_skills), (2_all_skills, faster_cast_rate), (3_pcombat, faster_cast_rate), (faster_run_walk, 2_amazon_skills), (faster_run_walk, 2_all_skills), (faster_run_walk, 2_assasin_skills), (faster_run_walk, 2_barbarian_skills), (faster_run_walk, 2_Druid_skills)), ethereal
;magic shields
magic_monarch=0,, ethereal
magic_monarch=1, socketed_4, ethereal
;magic weapons
magic_gg_club=1
@@ -178,9 +195,9 @@ magic_unearthed_wand=0
;magic assassin claws
magic_greater_claws=0
magic_greater_talons=0
magic_greater_talons=1, ((2_assasin_skills, 3_lightning_sentry), (traps, lightning_sentry))
magic_feral_claws=0
magic_runic_talons=0
magic_runic_talons=1, ((2_assasin_skills, 3_lightning_sentry), (traps, lightning_sentry))
magic_suwayyah=0
;magic javelins
@@ -208,15 +225,15 @@ magic_ogre_gauntlets=0
;==================================================================;
;rare jewelry
rare_amulet=1
rare_amulet=1, (2_amazon_skills, 2_all_skills, 2_assasin_skills, 2_barbarian_skills, 2_Druid_skills, 2_necromancer_skills, 2_paladin_skills, 2_sorceress_skills)
rare_jewel=1
rare_ring=1
;rare circlets
rare_circlet=1
rare_coronet=1
rare_diadem=1
rare_tiara=1
rare_circlet=1, ((faster_cast_rate, 2_amazon_skills), (faster_cast_rate, 2_assasin_skills), (faster_cast_rate, 2_barbarian_skills), (faster_cast_rate, 2_Druid_skills), (faster_cast_rate, 2_necromancer_skills), (faster_cast_rate, 2_paladin_skills), (faster_cast_rate, 2_sorceress_skills), (2_all_skills, faster_cast_rate), (faster_run_walk, 2_amazon_skills), (faster_run_walk, 2_all_skills), (faster_run_walk, 2_assasin_skills), (faster_run_walk, 2_barbarian_skills), (faster_run_walk, 2_Druid_skills)), ethereal
rare_coronet=1, ((faster_cast_rate, 2_amazon_skills), (faster_cast_rate, 2_assasin_skills), (faster_cast_rate, 2_barbarian_skills), (faster_cast_rate, 2_Druid_skills), (faster_cast_rate, 2_necromancer_skills), (faster_cast_rate, 2_paladin_skills), (faster_cast_rate, 2_sorceress_skills), (2_all_skills, faster_cast_rate), (faster_run_walk, 2_amazon_skills), (faster_run_walk, 2_all_skills), (faster_run_walk, 2_assasin_skills), (faster_run_walk, 2_barbarian_skills), (faster_run_walk, 2_Druid_skills)), ethereal
rare_diadem=1, ((faster_cast_rate, 2_amazon_skills), (faster_cast_rate, 2_assasin_skills), (faster_cast_rate, 2_barbarian_skills), (faster_cast_rate, 2_Druid_skills), (faster_cast_rate, 2_necromancer_skills), (faster_cast_rate, 2_paladin_skills), (faster_cast_rate, 2_sorceress_skills), (2_all_skills, faster_cast_rate), (faster_run_walk, 2_amazon_skills), (faster_run_walk, 2_all_skills), (faster_run_walk, 2_assasin_skills), (faster_run_walk, 2_barbarian_skills), (faster_run_walk, 2_Druid_skills)), ethereal
rare_tiara=1, ((faster_cast_rate, 2_amazon_skills), (faster_cast_rate, 2_assasin_skills), (faster_cast_rate, 2_barbarian_skills), (faster_cast_rate, 2_Druid_skills), (faster_cast_rate, 2_necromancer_skills), (faster_cast_rate, 2_paladin_skills), (faster_cast_rate, 2_sorceress_skills), (2_all_skills, faster_cast_rate), (faster_run_walk, 2_amazon_skills), (faster_run_walk, 2_all_skills), (faster_run_walk, 2_assasin_skills), (faster_run_walk, 2_barbarian_skills), (faster_run_walk, 2_Druid_skills)), ethereal
;rare helmets
rare_bone_visage=0
@@ -241,13 +258,13 @@ rare_blade_talons=0
;exceptional rare claws
rare_greater_claws=0
rare_greater_talons=0
rare_greater_talons=1, 2_assasin_skills
rare_hand_scythe=0
rare_scissors_quhab=0
;elite rare claws
rare_feral_claws=0
rare_runic_talons=0
rare_runic_talons=1, 2_assasin_skills
rare_suwayyah=0
rare_wrist_sword=0
rare_war_fist=0
@@ -324,50 +341,50 @@ rare_colossus_girdle=0,, ethereal
;---------------------------------------;
;normal rare boots
rare_greaves=0,, ethereal
rare_boots=0,, ethereal
rare_chain_boots=0,, ethereal
rare_light_plated_boots=0,, ethereal
rare_heavy_boots=0,, ethereal
rare_greaves=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_chain_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_light_plated_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_heavy_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
;exceptional rare boots
rare_war_boots=0,, ethereal
rare_battle_boots=0,, ethereal
rare_mesh_boots=0,, ethereal
rare_sharkskin_boots=0,, ethereal
rare_demonhide_boots=0,, ethereal
rare_war_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_battle_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_mesh_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_sharkskin_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_demonhide_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
;elite rare boots
rare_myrmidon_greaves=0,, ethereal
rare_mirrored_boots=0,, ethereal
rare_boneweave_boots=0,, ethereal
rare_scarabshell_boots=0,, ethereal
rare_wyrmhide_boots=0,, ethereal
rare_myrmidon_greaves=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_mirrored_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_boneweave_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_scarabshell_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
rare_wyrmhide_boots=1, and(lightning_resist, fire_resist, cold_resist), ethereal
;---------------------------------------;
;============= RARE GLOVES =============;
;---------------------------------------;
;normal rare gloves
rare_leather_gloves=0,, ethereal
rare_heavy_gloves=0,, ethereal
rare_chain_gloves=0,, ethereal
rare_light_gauntlets=0,, ethereal
rare_gauntlets=0,, ethereal
rare_leather_gloves=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_heavy_gloves=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_chain_gloves=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_light_gauntlets=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_gauntlets=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
;exceptional rare gloves
rare_demonhide_gloves=0,, ethereal
rare_sharkskin_gloves=0,, ethereal
rare_heavy_bracers=0,, ethereal
rare_battle_gauntlets=0,, ethereal
rare_war_gauntlets=0,, ethereal
rare_demonhide_gloves=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_sharkskin_gloves=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_heavy_bracers=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_battle_gauntlets=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_war_gauntlets=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
;elite rare gloves
rare_bramble_mitts=0,, ethereal
rare_vampirebone_gloves=0,, ethereal
rare_vambraces=0,, ethereal
rare_crusader_gauntlets=0,, ethereal
rare_ogre_gauntlets=0,, ethereal
rare_bramble_mitts=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_vampirebone_gloves=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_vambraces=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_crusader_gauntlets=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
rare_ogre_gauntlets=1, and(20_increased_attack_speed, 2_javalin_spears), ethereal
;---------------------------------------;
;======= RARE BARBARIAN HELMETS ========;
@@ -723,6 +740,7 @@ white_wrist_sword=1, (3_venom, 3_lightning_sentry)
;ethereal polearms
gray_weapon_colossus_voulge=1, and(ethereal, socketed_4)
;gray_weapon_colossus_voulge=1,, ethereal
gray_weapon_thresher=1, ethereal, (socketed_1, socketed_2, socketed_3)
gray_weapon_giant_thresher=1, ethereal, (socketed_1, socketed_2, socketed_3)
gray_weapon_cryptic_axe=1, ethereal, (socketed_1, socketed_2, socketed_3)
@@ -795,7 +813,7 @@ gray_weapon_superior_grand_matron_bow=1, and(3_bow_skills, enhanced_damage, sock
;====== AMULETS / RINGS =======;
;------------------------------;
set_misc_amulets=2
set_misc_amulets=2, 2_sorceress_skills
set_ring=0
;------------------------------;
@@ -1038,8 +1056,8 @@ uniq_ravenlore=1,, ethereal
;------------------------------;
uniq_misc_amulets=2
uniq_misc_rings=2
uniq_misc_rainbow_facet=2
uniq_misc_rings=2, (1_all_skills, 15_fire_absorb, cannot_be_frozen, magicfind)
uniq_misc_rainbow_facet=2,, 3_percent
uniq_gheeds_fortune=1
;------------------------------;
@@ -1112,7 +1130,7 @@ uniq_rune_master=1, ethereal
;------------------------------;
uniq_weapon_death_fathom=2
uniq_weapon_eschuta_temper=2
uniq_weapon_eschuta_temper=2, 3_sorceress_skills
uniq_weapon_the_oculus=1
;------------------------------;

View File

@@ -69,26 +69,75 @@ class Config:
@staticmethod
def parse_item_config_string(key: str = None) -> ItemProps:
string = Config._select_val("items", key).upper()
return Config.string_to_item_prop (string)
@staticmethod
def string_to_item_prop (string: str) -> ItemProps:
item_props = ItemProps()
# split string by commas NOT contained within parentheses
item_string_as_list = re.split(r',\s*(?![^()]*\))', Config._select_val("items", key).upper())
trim_strs=["AND(", "OR(", "(", ")", " "]
clean_string = [re.sub(r'|'.join(map(re.escape, trim_strs)), '', x).strip() for x in item_string_as_list]
item_props.pickit_type = int(clean_string[0])
try:
item_props.include = clean_string[1].split(',') if clean_string[1] else None
item_props.include_type = "AND" if "AND" in item_string_as_list[1] else "OR"
except IndexError as error:
pass
except Exception as exception:
Logger.error(f"Item parsing error: {exception}")
try:
item_props.exclude = clean_string[2].split(',') if clean_string[2] else None
item_props.exclude_type = "AND" if "AND" in item_string_as_list[2] else "OR"
except IndexError as error:
pass
except Exception as exception:
Logger.error(f"Item parsing error: {exception}")
brk_on = 0
brk_off = 0
section = 0
counter = 0
start_section = 0
start_item = 0
include_list = []
exclude_list = []
for char in string:
new_section = False
counter+=1
if char == "(":
brk_on +=1
elif char == ")":
brk_off += 1
if ((char == "," and brk_on==brk_off)):
new_section = True
if (counter == len (string)):
string_section = string [start_section:counter]
else:
string_section = string [start_section:counter-1]
if section == 0:
item_props.pickit_type = int (string_section)
section +=1
start_section = counter
if ((char == "," and (brk_on==brk_off+1)) or new_section or counter == len (string)):
if new_section:
section -=1
if start_item ==0:
start_item = start_section
if (counter == len (string)):
item = string [start_item:counter]
else:
item = string [start_item:counter-1]
if section == 0 and counter == len (string):
item_props.pickit_type = int (item)
pass
if section ==1:
include_list.append (item)
start_item = counter +1
elif section ==2:
exclude_list.append (item)
start_item = counter +1
if new_section:
section +=1
if (len (include_list)>0 and (len (include_list[0]) >=6)):
if ("AND" in include_list[0][0: 6] and not ")" in include_list[0]):
item_props.include_type = "AND"
else:
item_props.include_type = "OR"
if (len (exclude_list)>0 and (len (exclude_list[0]) >=6)):
if ("AND" in exclude_list[0][0:6] and not ")" in include_list[0]):
item_props.exclude_type = "AND"
else:
item_props.exclude_type = "OR"
for i in range (len(include_list)):
include_list[i] = include_list[i].replace (" ","").replace ("OR(","").replace ("AND(", "").replace ("(", "").replace (")","")
include_list[i] = include_list[i].split (",")
for l in range (len (exclude_list)):
exclude_list[l] = exclude_list[l].replace (" ","").replace ("OR(","").replace ("AND(", "").replace ("(", "").replace (")","")
exclude_list[l] = exclude_list[l].split (",")
item_props.include = include_list
item_props.exclude = exclude_list
return item_props
@staticmethod
@@ -296,7 +345,6 @@ class Config:
"apply_pather_adjustment": bool(int(Config._select_val("scepters", "apply_pather_adjustment"))),
}
if __name__ == "__main__":
from copy import deepcopy
config = Config()

View File

@@ -272,6 +272,11 @@ class UiManager():
if ("potion" in x.name) or (self._config.items[x.name].pickit_type == 0): continue
include_props = self._config.items[x.name].include
exclude_props = self._config.items[x.name].exclude
#Disable include params for uniq, rare, magical if ident is disabled in params.ini
#if (not self._config.char["id_items"]) and ("uniq" in x.name or "magic" in x.name or "rare" in x.name or "set" in x.name):
if (not self._config.char["id_items"]) and any(item_type in x.name for item_type in ["uniq", "magic", "rare", "set"]):
include_props = False
exclude_props = False
if not (include_props or exclude_props):
if do_logging:
Logger.debug(f"{x.name}: Stashing")
@@ -283,19 +288,40 @@ class UiManager():
include = False
found_props=[]
for prop in include_props:
try:
template_match = self._template_finder.search(prop, img, threshold=0.95)
except:
Logger.error(f"{x.name}: can't find template file for required {prop}, ignore just in case")
template_match = lambda: None; template_match.valid = True
if template_match.valid:
if include_logic_type == "AND":
found_props.append(True)
else:
include = True
if len(prop)>1:
found_subprops=[]
for subprop in prop:
try:
template_match = self._template_finder.search(subprop, img, threshold=0.95)
except:
Logger.error(f"{x.name}: can't find template file for required {prop}, ignore just in case")
template_match = lambda: None; template_match.valid = True
if template_match.valid:
if include_logic_type == "OR":
found_subprops.append(True)
else:
found_props.append (True)
break
else:
found_subprops.append(False)
break
if (len(found_subprops) > 0 and all(found_subprops)):
include = True
break
else:
found_props.append(False)
try:
template_match = self._template_finder.search(prop, img, threshold=0.95)
except:
Logger.error(f"{x.name}: can't find template file for required {prop}, ignore just in case")
template_match = lambda: None; template_match.valid = True
if template_match.valid:
if include_logic_type == "AND":
found_props.append(True)
else:
include = True
break
else:
found_props.append(False)
if include_logic_type == "AND" and len(found_props) > 0 and all(found_props):
include = True
if not include:

35
test/config_test.py Normal file
View File

@@ -0,0 +1,35 @@
import pytest
import os
import sys
sys.path.append (os.getcwd () + "/src")
from config import Config
class TestConfig:
@pytest.mark.parametrize ("string, pickit_type, include, exclude, include_type",
[
("0",0, [], [], "OR"), ("1",1, [], [], "OR"), ("2",2, [], [], "OR"),
("1, (AMAZONSKILLER, ASSASINSKILLER, BARBARIANSKILLER, DRUIDSKILLER, NECROMANCERSKILLER, PALADINSKILLER, SORCERESSSKILLER, (LIFE, 3_MAXIMUM_DAMAGE, ATTACK_RATING))",
1,
[["AMAZONSKILLER"], ["ASSASINSKILLER"], ["BARBARIANSKILLER"], ["DRUIDSKILLER"], ["NECROMANCERSKILLER"], ["PALADINSKILLER"], ["SORCERESSSKILLER"], ["LIFE", "3_MAXIMUM_DAMAGE", "ATTACK_RATING"]],
[],
"OR"
),
(
"1, AND(15_INCREASED_ATTACK_SPEED, ENHANCED_DAMAGE)", 1, [["15_INCREASED_ATTACK_SPEED"], ["ENHANCED_DAMAGE"]], [],"AND"),
("1, SOCKETED_4, ETHEREAL", 1, [["SOCKETED_4"]], [["ETHEREAL"]], "OR"),
("1, 2_ASSASIN_SKILLS", 1, [["2_ASSASIN_SKILLS"]], [], "OR"),
("1, ENHANCED_DEFENSE, ETHEREAL", 1, [["ENHANCED_DEFENSE"]], [["ETHEREAL"]], "OR"),
("1, AND(LIGHTNING_RESIST, FIRE_RESIST, COLD_RESIST), ETHEREAL", 1, [["LIGHTNING_RESIST"], ["FIRE_RESIST"], ["COLD_RESIST"]], [["ETHEREAL"]], "AND"),
("1, AND(ENHANCED_DEFENSE, SOCKETED), (SOCKETED_1, SOCKETED_2)", 1, [["ENHANCED_DEFENSE"], ["SOCKETED"]], [["SOCKETED_1"], ["SOCKETED_2"]],"AND")
])
def test_string_to_item_prop (self, string, pickit_type, include, exclude, include_type):
cfg = Config()
Itemprops = cfg.string_to_item_prop (string)
assert (Itemprops.pickit_type == pickit_type)
assert (Itemprops.include == include)
assert (Itemprops.exclude == exclude)
assert (Itemprops.include_type == include_type)
def test_123 (self):
print (os.getcwd())
print (sys.path)