This commit is contained in:
2023-12-15 13:39:16 +01:00
parent df901c9c29
commit b98f4d51a3

View File

@@ -19,22 +19,22 @@ def post_to_discord(message):
def right_click(x, y):
pyautogui.moveTo(x, y)
log_and_print("Performing right click.")
log_and_print(f"Performing right click at ({x}, {y}).")
pyautogui.rightClick()
def drag_slider(start_x, start_y, end_x, end_y):
log_and_print("Dragging slider.")
log_and_print(f"Dragging slider from ({start_x}, {start_y}) to ({end_x}, {end_y}).")
pyautogui.mouseDown(start_x, start_y, button='left')
pyautogui.moveTo(end_x, end_y, duration=2)
pyautogui.mouseUp(button='left')
def click(x, y):
pyautogui.moveTo(x, y)
log_and_print("Performing left click.")
log_and_print(f"Performing left click at ({x}, {y}).")
pyautogui.click()
def shift_click(x, y):
log_and_print("Performing shift click.")
log_and_print(f"Performing shift click at ({x}, {y}).")
pyautogui.keyDown('shift')
click(x, y)
pyautogui.keyUp('shift')
@@ -51,7 +51,9 @@ def check_trade_window():
log_and_print("Checking for trade window...")
trade_window_area = (2314, 974, 3124, 1455)
screenshot = ImageGrab.grab(trade_window_area)
screenshot.save("debug_trade_window.png") # Save screenshot for debugging
r, g, b = screenshot.getpixel((51, 69))[:3]
log_and_print(f"Color at check position: {r}, {g}, {b}")
if (r, g, b) == (137, 51, 24):
log_and_print("Trade window detected.")
return True
@@ -78,6 +80,7 @@ def trade_actions():
log_and_print("Taking a screenshot for color search...")
screenshot = ImageGrab.grab()
screenshot.save("debug_color_search.png") # Save screenshot for debugging
target_color = (222, 227, 114) # The color to search for
found_x, found_y = find_color_in_image(target_color, screenshot)