Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
translate + fixes + betterUI
Browse files Browse the repository at this point in the history
  • Loading branch information
HoloKi committed Jul 5, 2021
1 parent 5315a91 commit 66e6879
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 23 deletions.
17 changes: 11 additions & 6 deletions PvPClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def pvp(run):
print(colored("run = ", 'green', attrs=['bold']), colored(run, 'white'), colored("\n"))
#load class-------------------------------------
pvp = classe.bit(r"image\pvp.png",0.5)
play = classe.bit(r"image\play.png",0.5)
play = classe.bit(r"image\play.png",0.4)
select = classe.bit(r"image\battle2.png",0.5)
accetta = classe.bit(r"image\accept.png",0.5)
defeat = classe.bit(r"image\defeat.png",0.7)
chiudi = classe.bit(r"image\close.png",0.5)
chiudi = classe.bit(r"image\chiudi.png",0.5)
#-----------------------------------------------
conta = 0
errore = pvp.bottone()
Expand All @@ -37,7 +37,7 @@ def pvp(run):
return 0
#timer(50)
while(True):
conta =int(conta) + 1
conta = int(conta) + 1
errore = play.bottone()
if errore == 0:
cprint(error)
Expand All @@ -54,6 +54,7 @@ def pvp(run):
break
return 0
#time.sleep(50)
print("----------------------------------")
print(f"Match n: {conta}")
timer(40)
# controllo se è morto---------------
Expand All @@ -62,13 +63,16 @@ def pvp(run):
chiudi.bottone()
print("Match Lost")
time.sleep(2)
if error == 0:
print("Winner!")
# -----------------------------------
print("----------------------------------\n")

if conta == int(run):
pyautogui.press('esc')
time.sleep(2)
pyautogui.press('esc')
print("test finito")

break
return 1
else:
Expand All @@ -81,6 +85,7 @@ def timer(tempo):
sys.stdout.write('remaining time: ' + str(i) + 's ')
sys.stdout.flush()
time.sleep(1)
sys.stdout.flush()
sys.stdout.write("\r")
sys.stdout.write("--------------Done!--------------\n")
sys.stdout.write("\033[K")
#sys.stdout.write("\033[F") # back to previous line
#sys.stdout.write("\033[K")
7 changes: 4 additions & 3 deletions RaidClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def raid(run, difficult, duration):
return 0
while(True):
count += 1
print(f"run number {count}\n")
print("----------------------------------")
print(f"run number: {count}")
timer(int(duration))
print("----------------------------------\n")
#controllo se è morto---------------
error = morte.ispresence()
if error == 1: #se è morto clicca
Expand Down Expand Up @@ -109,7 +111,6 @@ def timer(tempo):
sys.stdout.write('remaining time: ' + str(i) + 's ')
sys.stdout.flush()
time.sleep(1)
sys.stdout.flush()
sys.stdout.write("\r")
sys.stdout.write("--------------Done!--------------\n")
sys.stdout.write("\033[K")

Binary file modified __pycache__/PvPClass.cpython-39.pyc
Binary file not shown.
Binary file modified __pycache__/RaidClass.cpython-39.pyc
Binary file not shown.
Binary file modified __pycache__/classe.cpython-39.pyc
Binary file not shown.
6 changes: 3 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def menu():
return 1
else:
if int(a) == 2:
print(colored("ATTENTO: il bot selezionerà di default il primo nella lista!\n",'red',attrs=['bold']),
colored("Tempo default: 40 secondi -> se è troppo poco segnalalo allo sviluppatore!",'red',attrs=['bold']))
cprint("Quante run di pvp vuoi fare?\n",'green',attrs=['bold'])
print(colored("ATTENTION: the bot will select the first one in the list by default!\n",'red',attrs=['bold']),
colored("Default time: 40 seconds -> if it is too little report it to the developer!",'red',attrs=['bold']))
cprint("How many pvp runs do you want to do?\n",'green',attrs=['bold'])
pvprun = input()
PvPClass.pvp(int(pvprun))
return 1
Expand Down
10 changes: 5 additions & 5 deletions classe.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, image, confi):
self.confi = confi

def bottone(self):
button = pyautogui.locateCenterOnScreen(self.image, grayscale=False, confidence=self.confi)
button = pyautogui.locateCenterOnScreen(self.image, grayscale=False, confidence=float(self.confi))
logging.debug(f"bottone = {button}")
if button is not None:
time.sleep(3)
Expand All @@ -26,11 +26,11 @@ def bottone(self):
return 0

def ispresence(self):
presente = pyautogui.locateCenterOnScreen(self.image, grayscale=False, confidence=self.confi)
presente = pyautogui.locateCenterOnScreen(self.image, grayscale=False, confidence=float(self.confi))
logging.debug(f"presence = {presente}")
if presente is not None:
print("DEBUG: è presente!")
logging.debug("DEBUG: è presente!")
return 1
else:
print("DEBUG:non è presente!")
return 0
logging.debug("DEBUG:non è presente!")
return 0
22 changes: 16 additions & 6 deletions latest.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
2021-07-05 00:31:56,277 - main : VERSION : 5.0.2 - BOT by HoloKi. Info : https://github.com/HoloKi/BitHeroesBot
2021-07-05 00:31:56,278 - main : https://discord.gg/h98xsssEpe
2021-07-05 00:32:02,137 - menu : Menu input = 2
2021-07-05 00:32:03,484 - bottone : bottone = None
2021-07-05 00:32:03,486 - bottone : image\pvp.png not found!
2021-07-05 00:32:03,487 - <module> : local variable 'error' referenced before assignment
2021-07-05 11:13:22,819 - main : VERSION : 5.0.2 - BOT by HoloKi. Info : https://github.com/HoloKi/BitHeroesBot
2021-07-05 11:13:22,819 - main : https://discord.gg/h98xsssEpe
2021-07-05 11:13:27,747 - menu : Menu input = 1
2021-07-05 11:13:31,684 - raid : difficult = <classe.bit object at 0x0000020A15C3AB50>.
2021-07-05 11:13:31,694 - raid : run = 2, difficolt� = heroic, durata = 210
2021-07-05 11:13:34,951 - bottone : bottone = Point(x=596, y=392)
2021-07-05 11:13:39,334 - bottone : bottone = Point(x=1091, y=432)
2021-07-05 11:13:43,762 - bottone : bottone = Point(x=962, y=298)
2021-07-05 11:13:48,145 - bottone : bottone = Point(x=1068, y=516)
2021-07-05 11:17:24,407 - ispresence : presence = None
2021-07-05 11:17:24,407 - ispresence : DEBUG:non � presente!
2021-07-05 11:20:59,545 - ispresence : presence = None
2021-07-05 11:20:59,545 - ispresence : DEBUG:non � presente!
2021-07-05 11:20:59,545 - raid : end
2021-07-05 11:20:59,816 - bottone : bottone = Point(x=895, y=417)
2021-07-05 11:21:07,070 - menu : ritorno del raid = None

0 comments on commit 66e6879

Please sign in to comment.