Remove slow walk + adjust node positions (#164)

This commit is contained in:
aeon0
2021-12-01 18:39:43 +01:00
committed by GitHub
parent 65a8085065
commit 3f81bf3d75
5 changed files with 9 additions and 16 deletions

View File

@@ -75,7 +75,6 @@ run_shenk | Run shenk in each new game. Select "1" to run it "0" to leave it out
--------------------------------|---------------------------------------------
type | Build type. Currently only "sorceress" or "hammerdin" is supported
casting_frames | Depending on your char and fcr you will have a specific casting frame count. Check it here: https://diablo2.diablowiki.net/Breakpoints and fill in the right number. Determines how much delay there is after each teleport for example.
slow_walk | With this set to 1 the char will have a large delay for each running action in town. Set this to 1 if you keep getting stuck during traversing town.
stash_gold | Bool value to stash gold each time when stashing items
atk_len_pindle | Attack length for hdin or number of attack sequences for sorc when fighting pindle
atk_len_eldritch | Attack length for hdin or number of attack sequences for sorc when fighting eldritch

View File

@@ -22,7 +22,6 @@ run_shenk=0
[char]
type=sorceress
casting_frames=11
slow_walk=0
stash_gold=0
atk_len_pindle=3
atk_len_eldritch=3

View File

@@ -76,18 +76,13 @@ class IChar:
pos_abs = self._screen.convert_screen_to_abs(pos_screen)
dist = math.dist(pos_abs, (0, 0))
min_wd = self._config.ui_pos["min_walk_dist"]
if self._config.char["slow_walk"]:
max_wd = dist
else:
max_wd = random.randint(int(self._config.ui_pos["max_walk_dist"] * 0.65), self._config.ui_pos["max_walk_dist"])
max_wd = random.randint(int(self._config.ui_pos["max_walk_dist"] * 0.65), self._config.ui_pos["max_walk_dist"])
adjust_factor = max(max_wd, min(min_wd, dist - 50)) / dist
pos_abs = [int(pos_abs[0] * adjust_factor), int(pos_abs[1] * adjust_factor)]
x, y = self._screen.convert_abs_to_monitor(pos_abs)
mouse.move(x, y, randomize=5, delay_factor=[factor*0.1, factor*0.14])
wait(0.012, 0.02)
mouse.click(button="left")
if self._config.char["slow_walk"]:
wait(0.8)
def tp_town(self):
skill_before = cut_roi(self._screen.grab(), self._config.ui_roi["skill_right"])

View File

@@ -74,7 +74,6 @@ class Config:
"battle_orders": self._select_val("char", "battle_orders"),
"battle_command": self._select_val("char", "battle_command"),
"casting_frames": int(self._select_val("char", "casting_frames")),
"slow_walk": bool(int(self._select_val("char", "slow_walk"))),
"atk_len_pindle": int(self._select_val("char", "atk_len_pindle")),
"atk_len_eldritch": int(self._select_val("char", "atk_len_eldritch")),
"atk_len_shenk": int(self._select_val("char", "atk_len_shenk")),

View File

@@ -58,8 +58,8 @@ class Pather:
2: {'A5_TOWN_0': (-368, -39), 'A5_TOWN_0.5': (423, 7)},
3: {'A5_TOWN_1': (-276, 94), 'A5_TOWN_2': (485, -60)},
4: {'A5_TOWN_1': (-467, 267), 'A5_TOWN_2': (293, 113), 'A5_TOWN_3': (-267, -139), 'A5_TOWN_4': (162, -163)},
5: {'A5_TOWN_2': (303, 219), 'A5_TOWN_3': (-257, -33), 'A5_TOWN_4': (172, -57)},
6: {'A5_TOWN_3': (-583, 175), 'A5_TOWN_4': (-155, 151), 'A5_TOWN_5': (-13, -240), 'A5_TOWN_6': (307, 61)},
5: {'A5_TOWN_2': (303+60, 219+40), 'A5_TOWN_3': (-257+60, -33+40), 'A5_TOWN_4': (172+60, -57+40)},
6: {'A5_TOWN_3': (-583+80, 175+60), 'A5_TOWN_4': (-155+80, 151+60), 'A5_TOWN_5': (-13+80, -240+60), 'A5_TOWN_6': (307+80, 61+60)},
8: {'A5_TOWN_6': (127, 293), 'A5_TOWN_5': (-195, -5), 'A5_TOWN_7': (598, -87)},
9: {'A5_TOWN_5': (-407, 167), 'A5_TOWN_7': (386, 85)},
10: {'A5_TOWN_4': (-472, 58), 'A5_TOWN_6': (-11, -32), 'A5_TOWN_8': (321, 131)},
@@ -86,8 +86,8 @@ class Pather:
144: {'SHENK_6': (-108, 123), 'SHENK_7': (481, 151)},
145: {'SHENK_12': (97, -133), 'SHENK_7': (803, 372), 'SHENK_6': (209, 347), 'SHENK_8': (-245, 18)},
146: {'SHENK_12': (272, 111), 'SHENK_9': (-331, -144), 'SHENK_8': (-72, 258)},
147: {'SHENK_16': (193, -100), 'SHENK_9': (-67, 139), 'SHENK_10': (-431, 67)},
148: {'SHENK_16': (645, 63), 'SHENK_9': (301, 263), 'SHENK_10': (-65, 188), 'SHENK_11': (-306, 139)},
147: {'SHENK_16': (317, -18), 'SHENK_9': (-67, 139), 'SHENK_10': (-431, 67)},
148: {'SHENK_16': (682, 103), 'SHENK_9': (301, 263), 'SHENK_10': (-65, 188), 'SHENK_11': (-306, 139)},
149: {'SHENK_11': (261, 395), 'SHENK_10': (495, 421), 'SHENK_13': (393, -9)}
}
self._paths = {
@@ -133,6 +133,7 @@ class Pather:
for node_idx in self._nodes:
for template_type in self._nodes[node_idx]:
if filter is None or filter in template_type:
success = False
if template_type in template_map:
success = True
ref_pos_screen = template_map[template_type]
@@ -276,7 +277,7 @@ if __name__ == "__main__":
t_finder = TemplateFinder(screen)
pather = Pather(screen, t_finder)
ui_manager = UiManager(screen, t_finder)
char = Hammerdin(config.hammerdin, config.char, screen, t_finder, ui_manager, pather)
char = Sorceress(config.hammerdin, config.char, screen, t_finder, ui_manager, pather)
# pather.traverse_nodes_fixed("pindle_save_dist", char)
# pather.traverse_nodes(Location.A5_TOWN_START, Location.NIHLATHAK_PORTAL, char)
pather._display_all_nodes_debug(filter="SHENK")
pather.traverse_nodes(Location.A5_TOWN_START, Location.NIHLATHAK_PORTAL, char)
# pather._display_all_nodes_debug(filter="A5")