Skip to content

Commit

Permalink
lint: lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
jwmarb committed Feb 20, 2024
1 parent 06d9691 commit 91002c7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

HWND_NAME = "Granblue Fantasy: Relink"
CONFIDENCE = 0.7
INPUT_DELAY = 0.05
INPUT_DELAY = 0.05
6 changes: 4 additions & 2 deletions src/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def macro(fn: Callable[[], None]):
"""
Executes a macro based on virtual gamepad
"""

def wrapper():
# Focuses application window, if applicable
if win32gui.GetForegroundWindow() != Macros._get_relink_hwnd():
Expand Down Expand Up @@ -58,12 +59,13 @@ def continue_playing():
Macros._gamepad.press_button(vgamepad.XUSB_BUTTON.XUSB_GAMEPAD_A)
Macros._gamepad.update()
Macros.delay()
Macros._gamepad.release_button(vgamepad.XUSB_BUTTON.XUSB_GAMEPAD_DPAD_UP)
Macros._gamepad.release_button(
vgamepad.XUSB_BUTTON.XUSB_GAMEPAD_DPAD_UP
)
Macros._gamepad.release_button(vgamepad.XUSB_BUTTON.XUSB_GAMEPAD_A)
Macros._gamepad.update()
Macros.delay()


@staticmethod
@macro
def left_click():
Expand Down
3 changes: 2 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def log(msg: str):
print(f"[{timestamp}]\t{msg}")

while True:

@decorators.loop_run_once
def on_run_complete():
"""
Expand All @@ -43,7 +44,7 @@ def on_run_complete():
if runs == 1:
while not is_on_screen(constants.REPEAT_QUEST_FIRST_PROMPT):
Macros.left_click()

Macros.repeat_quest()

while is_on_screen(*QUEST_DONE):
Expand Down
19 changes: 14 additions & 5 deletions src/transmute_sigils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,37 @@
from macros import Macros
from utils import is_on_screen


def exit_listener():
while not keyboard.is_pressed("escape"):
pass
os._exit(0)


def main():
paused = False

def pause_listener(_):
nonlocal paused
paused = not paused
print("Auto-Transmute Sigils Paused" if paused else "Resumed Auto-Transmute Sigils")
print(
"Auto-Transmute Sigils Paused"
if paused
else "Resumed Auto-Transmute Sigils"
)

keyboard.on_press_key(callback=pause_listener, key="backspace", suppress=True)
keyboard.on_press_key(
callback=pause_listener, key="backspace", suppress=True
)

keyboard.on_press_key(callback=exit_listener, key="escape", suppress=True)

threading.Thread(target=exit_listener).start()

while not is_on_screen(constants.INSUFFICIENT_KNICKKNACKS):
if not paused:
Macros.left_click()

if __name__ == '__main__':
main()

if __name__ == "__main__":
main()

0 comments on commit 91002c7

Please sign in to comment.