hook_and_sum

This commit is contained in:
alex
2024-01-05 22:54:18 +01:00
parent 190f2bf864
commit 9a9fc05ab5
2 changed files with 1754 additions and 11 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -14,8 +14,8 @@ def log_and_print(message):
logging.info(message)
def post_to_discord(message):
webhook_url = 'https://discord.com/api/webhooks/1171735460729606145/Fyls4_uD7it29TNo7LktQFynb3k1K-BHLx9Y4WqzDK806o1_bVTNz94JNc996kDi-jE6'
data = {"content": message}
webhook_url = 'https://discord.com/api/webhooks/1191486153979858996/TIbdya4kyRKFv9legPvlyTagmgpr-U5BLqgPWnwks-KyJKSvlmi8BCkJ-t5pgHrFGZNu'
data = {"content": message}
response = requests.post(webhook_url, json=data)
log_and_print(f"Posted to Discord: {message}")
@@ -95,10 +95,11 @@ def check_trade_window():
post_to_discord("Trade window not found.")
return False
trades_info = [] # List to store trade information
successful_trades = 0 # Counter for successful trades
unsuccessful_trades = 0 # Counter for unsuccessful trades
def trade_actions():
global trades_info
global successful_trades, unsuccessful_trades
right_click(1168, 306)
time.sleep(1)
@@ -133,11 +134,15 @@ def trade_actions():
time.sleep(1)
for _ in range(2):
click(found_x, found_y)
shift_click(1346, 225)
if found_x is not None and found_y is not None:
log_and_print(f"Color found at ({found_x}, {found_y}). Clicking at this position.")
click(found_x, found_y)
successful_trades += 1 # Increment successful trades counter
else:
log_and_print("Color not found on the screen. Using fallback coordinates.")
click(1052, 436)
unsuccessful_trades += 1 # Increment unsuccessful trades counter
time.sleep(1)
# Collect trade info
trades_info.append("Potion clicked at position ({}, {})".format(found_x, found_y))
log_and_print("Pressing 'Esc' key.")
subprocess.run(['xdotool', 'key', 'Escape'])
@@ -158,7 +163,7 @@ for _ in range(25): # Number of trades to perform
if not result:
break # Stop the script if trade window is not detected
# Post the collection of trades to Discord
trade_summary = "\n".join(trades_info)
post_to_discord(f"Trading session completed. Summary:\n{trade_summary}")
# Modify the summary message to include trade counts
trade_summary = f"Trading session completed. Successful trades: {successful_trades}, Unsuccessful trades: {unsuccessful_trades}"
post_to_discord(trade_summary)