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.)
31 lines
961 B
Python
31 lines
961 B
Python
import pytest
|
|
from mocks.screen_mock import ScreenMock
|
|
from logger import Logger
|
|
from pather import Pather
|
|
from screen import convert_screen_to_abs
|
|
|
|
|
|
class TestPather:
|
|
def setup_method(self):
|
|
Logger.init()
|
|
Logger.remove_file_logger()
|
|
|
|
screen = ScreenMock()
|
|
self.pather = Pather()
|
|
|
|
@pytest.mark.parametrize("test_input, expected", [
|
|
((90, 90), True),
|
|
((25, 70), True),
|
|
((150, 120), False),
|
|
((500, 400), False),
|
|
((400, 1300), True),
|
|
])
|
|
def test_adjust_abs_range_to_screen(self, test_input, expected):
|
|
should_be_adapted = expected
|
|
pos_abs = convert_screen_to_abs(test_input)
|
|
new_pos_abs = self.pather._adjust_abs_range_to_screen(pos_abs)
|
|
is_adapted = new_pos_abs != pos_abs
|
|
assert(should_be_adapted == is_adapted)
|
|
new_pos_abs_2 = self.pather._adjust_abs_range_to_screen(new_pos_abs)
|
|
assert(new_pos_abs == new_pos_abs_2)
|