This repository has been archived by the owner on Mar 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GauntletClass.py
98 lines (89 loc) · 3.07 KB
/
GauntletClass.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import pyautogui
import time
import logging
import asyncio
from colorama import *
from termcolor import colored, cprint
from ClassBot import classe
import json
init(autoreset=True) # Permette ad ogni print di ritornare al suo colore base
errore = colored("Please report this bug/error on github", 'red', attrs=['bold'])
def cimento(run):
#--------------
f = open("data.json", "r")
data = json.loads(f.read())
gaunt_data = float(data['Function'][0]['gauntlet'][0]['gaunt'])
play_data = float(data['Function'][0]['gauntlet'][0]['play'])
accept_data = float(data['Function'][0]['gauntlet'][0]['accept'])
no_shard_data = float(data['Function'][0]['gauntlet'][0]['no_shard'])
f.close()
#--------------
logging.debug("---------GAUNTLET----------")
conta = 0
logging.debug(f"run = {run}")
cprint("\n-----GAUNTLET-----", 'cyan', attrs=['bold'])
print(colored("run = ", 'green', attrs=['bold']), colored(run, 'white'))
print(" ")
if run <= 0:
logging.debug("run <= 0")
pyautogui.alert(text="Run must be > 0", button="OK")
return 0
else:
# load-----------------------------
gaunt = classe.bit(r"image\cimento.png", gaunt_data)
play = classe.bit(r"image\play.png", play_data)
accept = classe.bit(r"image\accept.png", accept_data)
no_shard = classe.bit(r"image\noshard.png", no_shard_data)
# ---------------------------------
error = gaunt.bottone()
if error == 0:
cprint(errore)
return 0
while True:
conta += 1
error = play.bottone()
if error == 0:
cprint(errore)
return 0
# check if no shard is presence
error = no_shard.SafeControl()
if error == 1:
logging.debug("No shard available!")
pyautogui.press("esc")
time.sleep(2)
pyautogui.press("esc")
return 0
# case have shard
error = accept.bottone()
if error == 0:
cprint(errore)
return 0
'''
error = auto.ispresence()
if error == 0:
pyautogui.press('space')
'''
print("----------------------------------")
print(f"run number: {conta}")
asyncio.run(test())
print("----------------------------------\n")
time.sleep(2)
if conta == int(run):
pyautogui.press('esc')
time.sleep(3)
pyautogui.press('esc')
break
else:
pyautogui.press('esc')
time.sleep(2)
async def fine():
vittoria = classe.bit(r"image\cittadina.png", 0.5)
no_shard = classe.bit(r"image\noshard.png", 0.5)
while True:
await asyncio.sleep(1)
test = vittoria.SafeControl()
if test == 1:
return 1 # return 2 in caso ci sia sconfitta
async def test():
prova = asyncio.create_task(fine())
await prova