Summary of changes:
-Rearranged many UI-related functions across the codebase (particularly in ui_manager.py) into individual components. See src/ui_components/. Functions related to components can be called like if waypoint.use_wp("Arcane Sanctuary"): or loading.wait_for_loading_screen(2.0)
-Removed Screen and TemplateFinder dependencies across the codebase
-Screen functions separated from class
-TemplateFinder made into a singleton
-Added generic ScreenObject UI functions to simply detect UI elements on screen; e.g., detect_screen_object(ScreenObjects.TownPortal), wait_for_screen_object(ScreenObjects.Loading, 2). Also included related functions like select_screen_object_match(template_match) to automatically select the match.
-Consolidated assets. Organized templates folder into components. Adjusted some asset ROI's and alpha channels.
-Changed some template searches to grayscale for speed
-Reworked save/exit routine, should now be more consistent and faster with normal exit, chicken exit, and death exit.
-Got rid of unused and consolidated duplicate game.ini parameters
-spelling fix _last_merc_healh
-NPC manager class removed and replaced with functions
-D2 window detection now runs on its own thread for semi-live window position offsets.
-Character selection reworked. OCR your selected character for fun (not that accurate, lol)
-Simplified game start and difficulty select
-Added a get experience function, but this is not called anywhere yet
-Reworked corpse pickup. pickup_corpse is no longer a necessary argument/parameter throughout the codebase (bot.py, game_controller.py, runs, etc.)
34 lines
1.8 KiB
Python
34 lines
1.8 KiB
Python
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):
|
|
Itemprops = Config().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) |