def main(self): weapons = 0 try: self.display() while True: settings.get_tibia_active(self.CHAR_NAME) settings.idle(.5) self.hit_dummy() weapons += 1 print('-*' * 16) print('Dummy position:', self.dummy_pos) print('Exercises Weapons utilizadas:', weapons) settings.idle(500) except KeyboardInterrupt: print('#' * 10 + ' CANCELADO ' + '#' * 10)
def soft_boots(self, SOFT_HOTKEY): ''' Check if there's some soft boots equipped If so, equip it @params SOFT_HOTKEY: hotkey to equip boots @return void ''' img = os.path.join(os.path.dirname(__file__), 'imgs', 'soft_boots.png') template = cv2.imread(img, 0) tmp = settings.is_visible(template, self.pic_path, False) x = [] for item in tmp: x.extend(item) if x == []: print('- DIDN\'T EQUIP BOOTS: SLOT NOT EMPTY!') else: print('- SOFT EQUIPPED') settings.get_tibia_active(self.char_name) pyautogui.press(SOFT_HOTKEY)
def ring(self, RING_HOTKEY): ''' Check if there's some ring equipped If so, equip it @params RING_HOTKEY: hotkey to equip ring @return void ''' img = os.path.join(os.path.dirname(__file__), 'imgs', 'empty_ring.png') template = cv2.imread(img, 0) tmp = settings.is_visible(template, self.pic_path, False) x = [] for item in tmp: x.extend(item) if x == []: print('- DIDN\'T PULL UP RING: SLOT NOT EMPTY!') else: print('- RING NOT FOUND! TRYING TO EQUIP') settings.get_tibia_active(self.char_name) pyautogui.press(RING_HOTKEY)
def enable_mouseposition(self): print('~' * 30) print('AGUARDANDO O CLIQUE NO DUMMY...') print('APÓS USAR O DUMMY NÃO SE MEXA!') settings.get_tibia_active(CHAR_NAME) self.after(10, self.get_mouseposition)
def main(self): try: self.displayInit() cycle_count = 1 cycle_break = 0 ''' finding mana bar position ''' settings.idle(.5) settings.get_tibia_active(self.CHAR_NAME) settings.take_screenshot(self.SS_HOTKEY) ########## SS settings.idle(1.5) #cd to del mana_full_path = settings.get_latest_image(self.SS_DIRPATH, valid_extensions='png') x_min, x_max, y_min, y_max, mana_full = Mana(self.SS_DIRPATH, mana_full_path)\ .get_mana_loc() settings.del_screenshot(mana_full_path) ''' main loop ''' pyautogui.press(self.RUNE_HOTKEY) # first rune while True: settings.get_tibia_active(self.CHAR_NAME) settings.idle(.5) settings.take_screenshot(self.SS_HOTKEY) settings.idle(1.5) cycle_pic = settings.get_latest_image(self.SS_DIRPATH, valid_extensions='png') print('#'*30) print('Cycle:', cycle_count) currentMana = Mana(self.SS_DIRPATH, cycle_pic) pixels_mana = currentMana.counting_pixels(x_min, x_max, y_min, y_max) print('MANA PIXELS:', pixels_mana) percentage_mana = round(currentMana.percentage(mana_full, pixels_mana)) print('PERCENTAGE MANA:', percentage_mana) if percentage_mana == 100 or percentage_mana == 0: cycle_break+=1 settings.get_tibia_active(self.CHAR_NAME) currentMana.rune(int(self.RUNES_PER_CYCLE), self.RUNE_HOTKEY) print('SUA MANA ESTÁ {}%!'.format(percentage_mana)) print('Verifique seu tempo de ciclo e/ou numero de runas.\n') print('- RUNED') elif percentage_mana >= 50: settings.get_tibia_active(self.CHAR_NAME) currentMana.rune(int(self.RUNES_PER_CYCLE), self.RUNE_HOTKEY) print('- RUNED') else: print('- DIDN\'T RUNED') healing = Healing(cycle_pic, self.CHAR_NAME) healing.ring(self.RING_HOTKEY) settings.idle(.25) healing.eat_food(self.FOOD_HOTKEY) settings.idle(.5) healing.soft_boots(self.SOFT_HOTKEY) print('#'*30) print(' TECLE CRTL+C PARA CANCELAR ') if cycle_break == 5: print('ATENÇÃO: 5 CICLOS COM MANA ESTÁTICA!') break cycle_count = settings.increment(cycle_count) settings.del_screenshot(cycle_pic) settings.idle(int(self.CYCLE_TIME)*60) except KeyboardInterrupt: print('#'*10+' CANCELADO '+'#'*10)