D2r on top on restart (#442)

* My pick up and sorc parameters

* Moved the game logic away from the main within the new GameController class.
Refactored the main to use built-in keyboard add_hotkey and wait functions instead of self-written main loop.

* Revert "My pick up and sorc parameters"

This reverts commit 0920a406

* Changed number of loot columns

* Changes as per the comments:
Handle non-existing backup file.
Removed newline at the beginning of GameController class.
Changed line splitted into multiple lines back to a single line.

* Refactored graphic debugger with similar logic to botty to now have a controller.

* Added a small comment on the graphic debugger class and fixed a now-typo on the presented menu

* Bug Fix: if pressing F11 repeatedly the main loop may crash due to self.bot not yet initialized in the game_controller.

A safe solution would be to try and catch all but that would also be an overkill as it would most likely mask exceptions that we might want to make the program crash.

Checking that self.bot is initialized should work for the time being.

* No need to re-assign the resume key within the game controlelr anymore

* Urgent 1 liner bug fix for always_on_top: name 'config' is not defined

* Bug fix, keyboard dependency on game_recovery.py
For some reason PyCharm seems to flag this import as unused while it is actually used.

* Set diablo to not run by default

* set d2r on top upon restart if configured to do so

* Revert "Set diablo to not run by default"

This reverts commit 6202814a8b6a0ae0ddbcd7c5dcee520ed897f3d0.
This commit is contained in:
Francesco
2022-01-13 12:37:07 +01:00
committed by GitHub
parent 1fe56c95c6
commit 4ea5e4d265
+3 -1
View File
@@ -1,7 +1,7 @@
import subprocess
import os, sys
import keyboard
from utils.misc import wait
from utils.misc import wait, set_d2r_always_on_top
from screen import Screen
from config import Config
@@ -32,6 +32,8 @@ def restart_game(d2_path = None):
wait(0.5, 1.0)
success = False
attempts = 0
if config.advanced_options['d2r_windows_always_on_top']:
set_d2r_always_on_top()
while not success:
screen = Screen(config.general["monitor"], wait=5)
success = screen.found_offsets