def start_arena(start=1, end=21):#UNFINISHED Count = 0 Starting_Point = 0 Round = start - 1 if Round > 10: Round -= 11 Starting_Point = 1 get_boundaries() stop_arena = False for i in range(Starting_Point, 2): if stop_arena: return for arena in Cord.arenas: if stop_arena: return Count += 1 if Cord.arenas[Round] != arena: logging.debug("skipping arena %d" % Count) continue else: Round += 1 if Count >= end: logging.info("Arenas Complete") return im = screenGrab() if not recover(): while get_health(im) != 100 or get_mana(im) != 100 or get_spirit(im) != 100: logging.debug("Player still recovering")
def start_arena(start=1, end=21):#UNFINISHED Count = 0 Starting_Point = 0 Round = start - 1 if Round > 10: Round -= 11 Starting_Point = 1 get_boundaries() stop_arena = False for i in range(Starting_Point, 2): if stop_arena: return for arena in Cord.arenas: if stop_arena: return Count += 1 if Cord.arenas[Round] != arena: logging.debug("skipping arena %d" % Count) continue else: Round += 1 if Count >= end: logging.info("Arenas Complete") return im = screenGrab() if not recover(): while get_health(im) != 100 or get_mana(im) != 100 or get_spirit(im) != 100: logging.debug("Player still recovering") time.sleep(60) mouse_position(Cord.battle_cat_loc) left_click() time.sleep(1) get_boundaries() im = screenGrab() logging.debug("%d, %d, %d" % (get_health(im), get_mana(im), get_spirit(im))) logging.info("Starting Arena %d" % Count) go_to_arena(arena, i) if not startGame(): stop_arena = True return press("spacebar") sleep() logging.info("Heading to next Arena.") Round -= 11
def start_grindfest(): while 1 == 1: get_boundaries() im = screenGrab() if not recover(): while get_health(im) != 100 or get_mana(im) != 100 or get_spirit(im) != 100: logging.debug( "Player still recovering") time.sleep(60) mouse_position(Cord.battle_cat_loc) left_click() time.sleep(1) get_boundaries() im = screenGrab() logging.info("Starting Grindfest") go_to_grindfest() if not startGame(): return sleep() mouse_position(Cord.battle_cat_loc) left_click() logging.info("Player Dead, waiting until revival.") sleep()
def restore_stats(im): current_health = get_health(im) current_spirit = get_spirit(im) current_mana = get_mana(im) message = "" if current_health == 0 and not enemies_exist(im): time.sleep(1) if current_health == 0 and not enemies_exist(screenGrab()): Cord.p_dead = True message = "Player has died" else: return False elif use_gem(0, current_health): message = "Health Gem Used" elif activate_cure(current_health): message = "Cure Casted" elif activate_spark_life(current_health): message = "Spark Life Casted" elif use_health_pot(current_health): message = "Health Potion used" elif use_gem(1, current_mana): message = "Mana Gem Used" elif use_mana_pot(current_mana): message = "Mana Potion used" elif use_gem(2, current_spirit): message = "Spirit Gem Used" elif use_spirit_pot(current_spirit): message = "Spirit Potion used" elif activate_regen(current_health): message = "Regen Casted" elif activate_protection(): message = "Protection Casted" elif is_channeling_active() and activate_premium(): message = "premium activated" #elif activate_absorb(): # message = "absorb activated") elif activate_auto_cast(): message = "auto skill activated" return message
def start_round(): logging.info("Starting Round.") enemy_num = 0 get_gem() style = Settings.Player.style Settings.pause = False while not round_won() and not Cord.p_dead: if Settings.pause: return False #reduce_cooldown() im = screenGrab() if im.getpixel((42, 710)) != (227, 224, 209): continue current_enemies = get_enemies(im) cool_down() #logging.debug("Enemies: {} Health: {} Mana: {} Spirit: {}".format(len(current_enemies), get_health(im), get_mana(im), get_spirit(im))) log_message = "{},{},{},{},".format(len(current_enemies), get_health(im), get_mana(im), get_spirit(im)) get_status() restore_message = restore_stats(im) if len(restore_message) > 0: log_message = log_message + restore_message time.sleep(0.2) elif 0 < len(current_enemies) < enemy_num: log_message = log_message + get_gem() else: message = special_attack(im, current_enemies, style) log_message = log_message + message #this sleep function triggers the amount of time between clicks, thus the time between server communication #This function is very important as it randomizes the communication times, emulating the behavior of a player #sleep() logging.info(log_message) enemy_num = len(current_enemies) return True
press('spacebar') time.sleep(0.5) im = screenGrab() #Double Checking to remove any false alarms if im.getpixel(Cord.Pony_check_loc) != Cord.Pony_check_color and len(getEnemies(im)) == 0: time.sleep(0.5) im = screenGrab() while im.getpixel(Cord.Pony_check_loc) != Cord.Pony_check_color and len(getEnemies(im)) == 0: print "Pony Time!" Freq = 2500 # Set Frequency To 2500 Hertz Dur = 1000 # Set Duration To 1000 ms == 1 second winsound.Beep(Freq, Dur) time.sleep(4) im = screenGrab() ======= logging.debug("%d, %d, %d" % (get_health(im), get_mana(im), get_spirit(im))) logging.info("Starting Arena %d" % Count) go_to_arena(arena, i) if not startGame(): stop_arena = True return press("spacebar") sleep() logging.info("Heading to next Arena.") Round -= 11 #Main Function def startGame(): #UNFINISHED logging.basicConfig(filename=Settings.log_loc, level=Settings.log_level, format='%(asctime)s %(levelname)s: %(message)s')