Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Move discovered toggle into hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
Ezro committed Jun 27, 2022
1 parent 7f3ec49 commit 007c463
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def __init__(self, game_stats: GameStats):
self._ran_no_pickup = False
self._previous_run_failed = False
self._timer = time.time()
self._hotkeys_discovered = False

# Create State Machine
self._states=['initialization','hero_selection', 'town', 'pindle', 'shenk', 'trav', 'nihlathak', 'arcane', 'diablo']
Expand Down
3 changes: 3 additions & 0 deletions src/utils/hotkeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from logger import Logger

# "Public" Variables
discovered = False
## d2r_keymap represents a kvp of key: HotkeyName value: key
d2r_keymap = {}
## left_skill and right_skill represent the (last) template names found during discover_hotkey_mappings
Expand Down Expand Up @@ -95,6 +96,7 @@ def discover_hotkey_mappings(saved_games_folder, key_name):
Main entry point for discovering hotkey mapping for a character. This fn will use the provided saved_games_folder and key_name to load and parse the key file.
Using the parsed key file, it will grab Skill1-Skill16 and the representative hotkey associated with it and try to deduce the hotkeys.
"""
global discovered
global d2r_keymap
global _default_left_skill_key_map, _swap_left_skill_key_map, left_skill_key_map, left_skill
global _default_right_skill_key_map, _swap_right_skill_key_map, right_skill_key_map, right_skill
Expand Down Expand Up @@ -122,6 +124,7 @@ def discover_hotkey_mappings(saved_games_folder, key_name):
right_skill = ending_right_skill
left_skill_key_map = {**_default_left_skill_key_map, **_swap_left_skill_key_map}
right_skill_key_map = {**_default_right_skill_key_map, **_swap_right_skill_key_map}
discovered = True
log_hotkeys()

def _parse_key_file(saved_games_folder, key_name):
Expand Down

0 comments on commit 007c463

Please sign in to comment.