def waypoint_action(client, action): if action == "refill": # No stash for free acc pass elif action == "check_time": check_time(client, 'exit', 'start') elif action == "check_floor": check_hunt(client, 'upper', 'skip_floor', mana='mana_name' in client.hunt_config.keys(), health='health_name' in client.hunt_config.keys(), rune='rune_name' in client.hunt_config.keys(), ammo='ammo_name' in client.hunt_config.keys(), other=client.script_options['upper_level']) elif action == "check_lower": check_hunt(client, 'lower', 'skip_lower', mana='mana_name' in client.hunt_config.keys(), health='health_name' in client.hunt_config.keys(), rune='rune_name' in client.hunt_config.keys(), ammo='ammo_name' in client.hunt_config.keys(), other=client.script_options['lower_level']) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "refill": if not withdraw_item_from_stash(client, 'brown mushroom', 50, client.items['brown mushroom']): print('Not enough mushrooms') health_name, take_health = client.hunt_config[ 'health_name'], client.hunt_config['take_health'] if not withdraw_item_from_stash(client, health_name, take_health, client.items[health_name]): print('Not enough health potions') gem_name, take_gem = client.hunt_config[ 'gem_name'], client.hunt_config['take_gem'] if not withdraw_item_from_stash(client, gem_name, take_gem, client.items[gem_name]): print('Not enough small amethysts') client.logout() elif action == "use_gem_north": x, y = client.gameboard.sqm_to_coordinate(0, 1) gem_name = client.hunt_config['gem_name'] client.hotkey(client.item_hotkeys[gem_name]) sleep(0.3) client.click(x, y, button='left') sleep(1) elif action == "skip_portal": client.jump_label('after_portal') elif action == "skip_portal_2": client.jump_label('after_portal_2') else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "use_elevator": client.use_lever((1, 0)) elif action == "levitate_north_up": levitate(client, 'north', client.spells['exani hur up']) elif action == "levitate_west_up": levitate(client, 'west', client.spells['exani hur up']) elif action == "levitate_south_down": levitate(client, 'south', client.spells['exani hur down']) elif action == "levitate_east_down": levitate(client, 'east', client.spells['exani hur down']) elif action == "refill": if not withdraw_item_from_stash(client, 'brown mushroom', 50, client.items['brown mushroom']): print('Not enough mushrooms') health_name, take_health = client.hunt_config[ 'health_name'], client.hunt_config['take_health'] if not withdraw_item_from_stash(client, health_name, take_health, client.items[health_name]): print('Not enough health potions') elif action == "check_down": check_hunt(client, 'continue', 'leave', time=True) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "use_elevator": client.use_lever((1, 0)) elif action == "jump_travel_back": client.jump_label('travel_back') elif action == "jump_elevator_gohunt": client.jump_label('elevator_gohunt') elif action == "gohunt_14": conditional_jump_floor(client, 14, 'continue_gohunt_14', 'skip_gohunt_14') elif action == "gohunt_12": conditional_jump_floor(client, 12, 'continue_gohunt_12', 'gohunt_10') elif action == "back_14": conditional_jump_floor(client, 14, 'continue_back_14', 'skip_back_14') elif action == "back_12": conditional_jump_floor(client, 12, 'continue_back_12', 'back_10') elif action == "levitate_north_up": levitate(client, 'north', client.spells['exani hur up']) elif action == "levitate_west_up": levitate(client, 'west', client.spells['exani hur up']) elif action == "levitate_south_down": levitate(client, 'south', client.spells['exani hur down']) elif action == "levitate_east_down": levitate(client, 'east', client.spells['exani hur down']) elif action == "check_down": check_hunt(client, 'continue', 'leave', time=True) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "refill_avalanche": rune_name, take_rune = client.hunt_config[ 'rune_name'], client.hunt_config['take_rune'] if not withdraw_item_from_stash(client, rune_name, take_rune, client.items[rune_name]): print('Not enough runes') client.logout() else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "check_soft": use_soft_boots = client.script_options.get('use_soft_boots', False) if use_soft_boots: client.jump_label('go_soft') else: client.jump_label('skip_soft') elif action == "fix_soft": client.npc_say(['soft', 'yes']) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "lever": print('Check lever') status = client.reach_stand((33171, 31897, 8)) print('status', status) sleep(3) cur_coord = client.minimap.get_current_coord() if cur_coord != (33171, 31897, 8): status = client.use_ladder_at_coord((33172, 31896, 8)) print('Use ladder:', status) status = client.reach_stand((33171, 31897, 8)) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "check_down_1": if not client.script_options['hunt_down']: client.jump_label('skip_down_1') elif action == "check_down_2": if not client.script_options['hunt_down']: client.jump_label('skip_down_2') elif action == "check2": check_hunt(client, 'continue', 'leave', time=True) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "check_tasks": if not client.script_options.get('task', False): client.jump_label('skip_tasks') elif action == "get_tasks": client.npc_say( ['tasks', 'yes', 'promotion', 'tasks', 'sea serpent', 'yes']) elif action == "check_hunt": if client.script_options['respawn'] == 'north': client.jump_label('go_north') elif client.script_options['respawn'] == 'south': client.jump_label('go_south') else: client.jump_label('go_south_down') elif action == "check_north": check_hunt(client, 'hunt_north', 'leave_north', mana='mana_name' in client.hunt_config.keys(), health='health_name' in client.hunt_config.keys(), ammo='ammo_name' in client.hunt_config.keys(), rune='rune_name' in client.hunt_config.keys(), time=True) elif action == "check_south": check_hunt(client, 'hunt_south', 'leave_south', mana='mana_name' in client.hunt_config.keys(), health='health_name' in client.hunt_config.keys(), ammo='ammo_name' in client.hunt_config.keys(), rune='rune_name' in client.hunt_config.keys(), time=True) elif action == "check_south_down": check_hunt(client, 'hunt_south_down', 'leave_south_down', mana='mana_name' in client.hunt_config.keys(), health='health_name' in client.hunt_config.keys(), ammo='ammo_name' in client.hunt_config.keys(), rune='rune_name' in client.hunt_config.keys(), time=True) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "check_tasks": if not client.script_options.get('task', False): client.jump_label('skip_tasks') elif action == "get_tasks": client.npc_say( ['tasks', 'yes', 'promotion', 'tasks', 'sea serpent', 'yes']) elif action == "check_hunt": if client.script_options['respawn'] == 'north': client.jump_label('go_north') elif client.script_options['respawn'] == 'south': client.jump_label('go_south') else: client.jump_label('go_south_down') elif action == "check_north": check_hunt(client, 'hunt_north', 'leave_north', ammo=ammo, time=True) elif action == "check_south": check_hunt(client, 'hunt_south', 'leave_south', ammo=ammo, time=True) elif action == "check_south_down": check_hunt(client, 'hunt_south_down', 'leave_south_down', ammo=ammo, time=True) elif action == "levitate_south_down": levitate(client, 'south', levitate_down) elif action == "levitate_east_down": levitate(client, 'east', levitate_down) elif action == "levitate_west_down": levitate(client, 'west', levitate_down) elif action == "levitate_north_down": levitate(client, 'north', levitate_down) elif action == "levitate_south_up": levitate(client, 'south', levitate_up) elif action == "levitate_east_up": levitate(client, 'east', levitate_up) elif action == "levitate_west_up": levitate(client, 'west', levitate_up) elif action == "levitate_north_up": levitate(client, 'north', levitate_up) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "refill": # No stash for free acc pass elif action == "check_time": check_time(client, 'exit', 'start') elif action == "check_floor": check_hunt(client, 'upper', 'skip_floor', other=client.script_options['upper_level']) elif action == "check_lower": check_hunt(client, 'lower', 'skip_lower', other=client.script_options['lower_level']) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "openChest": client.use_sqm(1, 0) elif action == "takeMissions": client.npc_say([ 'mission', 'trolls', 'yes', 'goblins', 'yes', 'minotaurs', 'yes', 'herb', 'yes', 'log book', 'yes' ]) elif action == "doneLogBook": client.npc_say(['log book', 'yes', 'trolls', 'yes']) elif action == "escape": client.hotkey('esc') elif action == 'gotoPartDone': client.jump_label('firstPartDone') elif action == 'checkEQ': mana_count = client.get_hotkey_item_count(2) if mana_count > 10: client.jump_label('normalMonsters') else: client.jump_label('easyMonsters') elif action == 'dropAmmo': client.drop_item_from_container(client.equips, 'ammunition') elif action == 'buyEquips': if client.get_name_item_in_slot(client.equips, 'weapon') == 'dagger': client.drop_item_from_container(client.equips, 'weapon') sleep(1) client.drop_item_from_container(client.equips, 'weapon') client.buy_items_from_npc(['sabre'], [1]) elif action == 'checkerNormal': if client.cap() < 50 or client.get_hotkey_item_count(3) < 3: client.jump_label('leaveNormal') else: client.jump_label('atNormalM') else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "buy_rake": client.buy_items_from_npc(['rake'], [1]) elif action == "buy_poem": client.npc_say(["love poem", 'yes']) elif action == "ring": client.npc_say(["ring", 'yes']) elif action == "use_rake_north": use_item_at_sqm(client, 'rake', (0, 1)) elif action == "give_ring": client.npc_say(["ring", 'yes', 'yes', 'yes']) elif action == "errand": client.npc_say(["errand", 'yes']) elif action == "peg_leg": client.npc_say(["errand", 'peg leg', 'yes']) elif action == "travel_meriana": client.npc_say(['peg leg', 'yes']) elif action == "raymond": client.npc_say(['eleonore', 'mermaid']) elif action == "mermaid": client.npc_say(['raymond striker']) elif action == "djinn": client.npc_say(['eleonore', 'mermaid', 'date', 'yes']) elif action == "mermaid2": client.npc_say(['date']) elif action == "djinn2": client.npc_say(['mermaid', 'love poem', 'yes']) elif action == "finish": client.npc_say(['raymond striker', 'mermaid']) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "check_supplies": check_supplies(client, logout_fail=True) elif action == "bless_thais": client.npc_say(['spiritual', 'yes']) elif action == "bless_carlin": client.npc_say(['embrace', 'yes']) elif action == "bless_abdendriel": client.npc_say(['suns', 'yes']) elif action == "travel_eremo": client.npc_say(['eremo', 'yes']) elif action == "bless_eremo": client.npc_say(['solitude', 'yes']) elif action == "travel_passage": client.npc_say(['passage', 'yes']) elif action == "buy_ticket": client.npc_say(['ticket', 'yes']) elif action == "bless_kaz1": client.npc_say(['phoenix', 'yes']) elif action == "bless_kaz2": client.npc_say(['phoenix', 'yes']) elif action == "check_enhanced": print(client.script_options) if client.script_options['enhanced']: client.jump_label('enhanced') else: client.jump_label('go_train_edron') elif action == "bless_enhanced": client.say('hi') client.say('enhanced') client.say('yes') elif action == "travel_camp": client.npc_say(['passage', 'camp', 'yes']) client.sleep(2) elif action == "check_svargrond_to_camp": conditional_jump_position(client, [[32224,31381,7]], label_jump='okolnir_to_camp') conditional_jump_position(client, [[32332,31227,7]], label_jump='tyrsung_to_camp') conditional_jump_position(client, [[32256,31197,7]], label_jump='svargrond_to_camp') conditional_jump_position(client, [[32021,31294,7]], label_jump='in_camp') elif action == "travel_back_camp": client.npc_say(['passage', 'svargrond', 'yes']) client.sleep(2) elif action == "check_camp_to_svargrond": conditional_jump_position(client, [[32224,31381,7]], label_jump='okolnir_to_svargrond') conditional_jump_position(client, [[32332,31227,7]], label_jump='tyrsung_to_svargrond') conditional_jump_position(client, [[32021,31294,7]], label_jump='camp_to_svargrond') conditional_jump_position(client, [[32256,31197,7]], label_jump='in_svar') else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "get_mission": client.npc_say(["test"]) elif action == "mead": prev_cap = client.get_cap() client.npc_say(["mead", "yes"]) sleep(1.0) if client.get_cap() >= prev_cap: print('Finished test 1') client.jump_label('second_test') containers = client.get_opened_containers() has_item = False for container in containers: num_slots = container.get_num_slots() for slot in reversed(range(num_slots)): if 'honeycomb' in container.get_item_in_slot(slot): print('Has honeycomb') has_item = True if not has_item: print('Failed quest, no honeycomb') client.logout() elif action == "drink": for i in range(20): client.use_sqm(-1, 0) sleep(1.0) client.jump_label('mead') elif action == "fill_mead": containers = client.get_opened_containers() has_item = False for container in containers: num_slots = container.get_num_slots() for slot in reversed(range(num_slots)): print(client.get_name_item_in_slot(container, slot)) if 'mead horn' in client.get_name_item_in_slot( container, slot): print('Fill mead horn') sleep(0.2) client.use_slot(container, slot) sleep(0.2) client.click_sqm(-1, 0) sleep(0.2) has_item = True if not has_item: print('Did not find mead horn') client.logout() elif action == "use_mead_bear": containers = client.get_opened_containers() has_item = False for container in containers: num_slots = container.get_num_slots() for slot in reversed(range(num_slots)): print(client.get_name_item_in_slot(container, slot)) if 'mead horn' in client.get_name_item_in_slot( container, slot): print('Fill mead horn') sleep(0.2) client.use_slot(container, slot) sleep(0.2) client.click_sqm(0, 1) sleep(0.7) client.use_sqm(0, 1) has_item = True if not has_item: print('Did not find mead horn') client.logout() elif action == "bear_complete": client.npc_say(["bear", "yes"]) elif action == "mamooth": client.hotkey('f6') sleep(0.5) client.hotkey('f6') sleep(0.5) client.hotkey('f6') sleep(0.5) client.use_sqm(0, 1) elif action == "mamooth_complete": client.npc_say(["push", "yes"]) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "check_1": check_hunt(client, 'continue', 'leave', time=True) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): def withdraw_items_to_backpack(backpack, depot): # Returns true if withdraw was successful dest = client.get_container(backpack) if not dest: print('Could not find backpack', backpack, 'to hold items') return False # Open up to last backpack tries = 20 while not dest.is_empty() and tries: tries -= 1 client.use_slot(dest, 0) sleep(0.3) client.use_slot(dest, 1) sleep(0.3) client.hotkey('esc') # Try 3 times to open depot for tries in range(3): client.reach_locker() src = client.open_depot(depot) if src: client.use_slot(src, depot - 1) sleep(1) break else: print('Failed to reach locker') return False # Withdraw items until no backpack slots or no cap withdraw_any = False if client.get_cap() < 800: return False for i in range(10): print('cap:', client.get_cap()) if client.get_cap() < 200: print('Low cap') return withdraw_any dest = client.get_container(backpack) if not dest: print('Could not find backpack', backpack, 'to hold items') return withdraw_any if src.is_empty(): print('Depot is empty') return withdraw_any # Withdraw 19 items to current backpack items = 19 while items > 0: items -= 1 client.take_item_from_slot(src, 0, dest) withdraw_any = True # Go back one backpack client.return_container(dest) print('Withdrawed more than 250 items') return True if action == 'check_sell_edron': if not client.script_options['lailene'] and not client.script_options['alexander'] and not client.script_options['telas']: client.jump_label('end_edron') elif action == 'check_sell_edron_tower': if not client.script_options['lailene'] and not client.script_options['alexander']: client.jump_label('goto_telas') elif action == 'check_sell_rashid': if not client.script_options['rashid']: client.jump_label('skip_sell_rashid') elif action == 'check_sell_green_djinn': if not client.script_options['green_djinn']: client.jump_label('skip_sell_green_djinn') elif action == 'check_sell_flint': if not client.script_options['flint']: client.jump_label('skip_sell_flint') elif action == 'check_sell_lailene': if not client.script_options['lailene']: client.jump_label('skip_sell_lailene') elif action == 'check_sell_alexander': if not client.script_options['alexander']: client.jump_label('skip_sell_alexander') elif action == 'check_sell_telas': if not client.script_options['telas']: client.jump_label('skip_sell_telas') elif action == 'check_sell_tamoril': if not client.script_options['tamoril']: client.jump_label('skip_sell_tamoril') elif action == 'check_sell_esrik': if not client.script_options['esrik']: client.jump_label('skip_sell_esrik') elif action == "travel_darashia": # Only for carpet client.npc_say(['darashia', 'yes']) elif action == "repeat_flint": client.jump_label('start_flint') elif action == "flint": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=5) if not withdraw: client.jump_label('end_flint') elif action == "repeat_djinn": client.jump_label('start_djinn') elif action == "djinn": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=10) if not withdraw: client.jump_label('end_djinn') elif action == "repeat_edron": client.jump_label('start_edron') elif action == "edron": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=6) if not withdraw: client.jump_label('end_edron') elif action == "skip_edron": client.jump_label('skip_edron') elif action == "repeat_farmine": client.jump_label('start_farmine') elif action == "farmine": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=7) if not withdraw: client.jump_label('end_farmine') elif action == "use_elevator": client.use_lever((1,0)) elif action == "repeat_yalahar": client.jump_label('start_yalahar') elif action == "yalahar": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=8) if not withdraw: client.jump_label('end_yalahar') elif action == "check_rashid": if not client.script_options['rashid']: client.jump_label('end_rashid') weekday = datetime.utcnow().weekday() # Adjust date to sever save if 0 < datetime.utcnow().hour + 1 < 10: weekday -= 1 # still before server save weekday %= 7 if weekday == 0: client.jump_label('goto_svargrond_depot') elif weekday == 1: client.jump_label('goto_liberty_bay_depot') elif weekday == 2: client.jump_label('goto_port_hope_depot') elif weekday == 3: client.jump_label('goto_ankrahmun_depot') elif weekday == 4: client.jump_label('goto_darashia_depot') elif weekday == 5: client.jump_label('goto_edron_depot') elif weekday == 6: client.jump_label('goto_carlin_depot') elif action == "end_rashid": client.jump_label('end_rashid') elif action == "repeat_rashid_svargrond": client.jump_label('start_rashid_svargrond') elif action == "rashid_svargrond": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=9) if not withdraw: client.jump_label('end_rashid_svargrond') elif action == "repeat_rashid_carlin": client.jump_label('start_rashid_carlin') elif action == "rashid_carlin": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=9) if not withdraw: client.jump_label('end_rashid_carlin') elif action == "repeat_rashid_liberty_bay": client.jump_label('start_rashid_liberty_bay') elif action == "rashid_liberty_bay": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=9) if not withdraw: client.jump_label('end_rashid_liberty_bay') elif action == "repeat_rashid_port_hope": client.jump_label('start_rashid_port_hope') elif action == "rashid_port_hope": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=9) if not withdraw: client.jump_label('end_rashid_port_hope') elif action == "repeat_rashid_ankrahmun": client.jump_label('start_rashid_ankrahmun') elif action == "rashid_ankrahmun": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=9) if not withdraw: client.jump_label('end_rashid_ankrahmun') elif action == "repeat_rashid_darashia": client.jump_label('start_rashid_darashia') elif action == "rashid_darashia": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=9) if not withdraw: client.jump_label('end_rashid_darashia') elif action == "repeat_rashid_edron": client.jump_label('start_rashid_edron') elif action == "rashid_edron": withdraw = withdraw_items_to_backpack(backpack='Golden Backpack', depot=9) if not withdraw: client.jump_label('end_rashid_edron') elif action == "stash_all": client.reach_locker() stash_item_from_slot(client, client.equips, 'backpack') elif action == "buy_potions": npc_refill(client, mana=True, health=False) elif action == "refill": if not withdraw_item_from_stash(client, 'brown mushroom', 50, client.items['brown mushroom']): print('Not enough mushrooms') if 'ammo_name' in client.hunt_config.keys(): ammo_name = client.hunt_config['ammo_name'] if not withdraw_item_from_stash(client, ammo_name, client.hunt_config['take_ammo'], client.items[ammo_name]): print('Not enough ammo') elif action == "check_ammo": if 'ammo_name' not in client.hunt_config.keys(): client.jump_label('skip_ammo') else: ammo_name = client.hunt_config['ammo_name'] if 'arrow' not in ammo_name and 'bolt' not in ammo_name: client.jump_label('skip_ammo') elif action == "buy_ammo": npc_refill(client, ammo='ammo_name' in client.hunt_config.keys()) elif action == "check_supplies": check_supplies(client, health=False, imbuement=False, ammo='ammo_name' in client.hunt_config.keys(), logout_fail=True) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): def use_pick_south(): pick_hotkey = client.item_hotkeys["pick"] x, y = client.gameboard.sqm_to_coordinate(0, -1) client.hotkey(pick_hotkey) sleep(0.3) client.click(x, y, button='left') sleep(0.5) def use_fishing_rod_south(): x, y = client.gameboard.sqm_to_coordinate(0, -1) client.hotkey('O') sleep(0.3) client.click(x, y, button='left') sleep(1) def get_sqm_type_south(): x, y = client.gameboard.sqm_to_coordinate(0, -1) client.keyDown('shift') sleep(0.1) client.click(x, y, button='left') sleep(0.1) client.keyUp('shift') sleep(0.4) client.hotkey('alt', 'd') sleep(0.4) client.hotkey('tab') sleep(0.6) # get last 4 server messages client.hotkey('shift', 'ctrl', 'a') sleep(0.3) client.hotkey('ctrl', 'c') sleep(0.5) s = clipboard.paste().split('\n') look_results = [line for line in s if 'You' in line and 'see' in line] sleep(1) if 'fragile ice' in look_results[-1]: return 'closed' elif 'movement of fish' in look_results[-1]: return 'fish' elif 'ice hole' in look_results[-1]: return 'empty' else: return 'other' if action == "fish_south": type_sqm = get_sqm_type_south() if type_sqm == 'closed': use_pick_south() sleep(1) type_sqm = get_sqm_type_south() if type_sqm == 'fish': worm_hotkey = client.items["worm"] worm_count = client.get_hotkey_item_count(worm_hotkey) for i in range(30): use_fishing_rod_south() new_worm_count = client.get_hotkey_item_count(worm_hotkey) if new_worm_count < worm_count: print('Catched fish') break # Move fish to Loot backpack src = client.get_container(client.container_conf['main_bp']) if not src: print('Could not find backpack with items') dest = client.get_container(client.container_conf['loot_bp']) if not src: print('Could not find backpack with items') name_item = client.get_name_item_in_slot(src, 0) print('Item backpack', name_item) if name_item in ('fish', 'northern pike', 'rainbow trout', 'green perch'): client.take_item_from_slot(src, 0, dest, dest_slot=0) elif action == "buy_worms": worm_hotkey = client.items["worm"] worm_count = client.get_hotkey_item_count(worm_hotkey) client.buy_items_from_npc(['worm'], [200 - worm_count]) elif action == "refill": food_hotkey = client.items["brown mushroom"] if not withdraw_item_from_stash(client, 'brown mushroom', client.hunt_config['food_amount'], food_hotkey): print('Not enough mushrooms') elif action == "check_worms": worm_hotkey = client.items["worm"] worm_count = client.get_hotkey_item_count(worm_hotkey) if worm_count > 100: client.jump_label('skip_worms') elif action == "check": worm_hotkey = client.items["worm"] worm_count = client.get_hotkey_item_count(worm_hotkey) if worm_count < 100 or client.get_cap() < client.hunt_config['cap_leave']: client.jump_label('leave') else: client.jump_label('hunt') elif action == "check_supplies": worm_hotkey = client.items["worm"] worm_count = client.get_hotkey_item_count(worm_hotkey) if worm_count < 100: client.logout() elif action == "wait": sleep(300) elif action == "exit": print('Logout') client.logout() else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): if action == "check_teleport": check_hunt(client, 'continue', 'skip_teleport', ammo='ammo_name' in client.hunt_config.keys(), time=True) else: global_actions.waypoint_action(client, action)
def waypoint_action(client, action): def withdraw_items_to_backpack(backpack, depot): # Returns true if withdraw was successful dest = client.get_container(backpack) if not dest: print('Could not find backpack', backpack, 'to hold items') return False # Open up to last backpack tries = 20 while not dest.is_empty() and tries: tries -= 1 client.use_slot(dest, 0) sleep(0.3) client.use_slot(dest, 1) sleep(0.3) client.hotkey('esc') # Try 3 times to open depot for tries in range(3): client.reach_locker() src = client.open_depot(depot) if src: client.use_slot(src, depot - 1) sleep(1) break else: print('Failed to reach locker') return False # Withdraw items until no backpack slots or no cap withdraw_any = False if client.get_cap() < 800: print('[Action] Need at least 800 cap to sell items') return False prev_cap = 100000 for i in range(15): print('cap:', client.get_cap()) if client.get_cap() >= prev_cap: print('[Action] Could not withdraw more items') break prev_cap = client.get_cap() if client.get_cap() < 200: print('[Action] Low cap') return withdraw_any dest = client.get_container(backpack) if not dest: print('Could not find backpack', backpack, 'to hold items') return withdraw_any if src.is_empty(): print('Depot is empty') return withdraw_any # Withdraw 19 items to current backpack items = 19 while items > 0: items -= 1 client.take_item_from_slot(src, 0, dest) sleep(0.2) withdraw_any = True # Go back one backpack client.return_container(dest) print('Withdrawed more than 250 items') return True if action == 'check_sell_edron': if not client.script_options['lailene'] and not client.script_options[ 'alexander'] and not client.script_options['telas']: client.jump_label('end_edron') elif action == 'check_sell_edron_tower': if not client.script_options['lailene'] and not client.script_options[ 'alexander']: client.jump_label('goto_telas') elif action == 'check_sell_djinn': if not client.script_options[ 'green_djinn'] and not client.script_options['blue_djinn']: client.jump_label('skip_sell_djinn') elif action == 'check_djinn_type': if client.script_options['green_djinn']: client.jump_label('green_djinn') elif client.script_options['blue_djinn']: client.jump_label('blue_djinn') else: client.jump_label('end_djinn') elif action == 'check_sell_flint': if not client.script_options['flint']: client.jump_label('skip_sell_flint') elif action == 'check_sell_lailene': if not client.script_options['lailene']: client.jump_label('skip_sell_lailene') elif action == 'check_sell_alexander': if not client.script_options['alexander']: client.jump_label('skip_sell_alexander') elif action == 'check_sell_telas': if not client.script_options['telas']: client.jump_label('skip_sell_telas') elif action == 'check_sell_tamoril': if not client.script_options['tamoril']: client.jump_label('skip_sell_tamoril') elif action == 'check_sell_esrik': if not client.script_options['esrik']: client.jump_label('skip_sell_esrik') elif action == "travel_darashia": # Only for carpet client.npc_say(['darashia', 'yes']) elif action == "repeat_flint": client.jump_label('start_flint') elif action == "flint": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['flint_depot']) if not withdraw: client.jump_label('end_flint') elif action == "repeat_djinn": client.jump_label('start_djinn') elif action == "djinn": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['djinn_depot']) if not withdraw: client.jump_label('end_djinn') elif action == "repeat_edron": client.jump_label('start_edron') elif action == "edron": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['edron_depot']) if not withdraw: client.jump_label('end_edron') elif action == "skip_edron": client.jump_label('skip_edron') elif action == "repeat_farmine": client.jump_label('start_farmine') elif action == "farmine": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['esrik_depot']) if not withdraw: client.jump_label('end_farmine') elif action == "use_elevator": client.use_lever((1, 0)) elif action == "repeat_yalahar": client.jump_label('start_yalahar') elif action == "yalahar": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['tamoril_depot']) if not withdraw: client.jump_label('end_yalahar') elif action == "check_rashid": if not client.script_options['rashid']: client.jump_label('end_rashid') return weekday = datetime.utcnow().weekday() # Adjust date to sever save if 0 < datetime.utcnow().hour + 1 < 10: weekday -= 1 # still before server save weekday %= 7 if weekday == 0: client.jump_label('goto_svargrond_depot') elif weekday == 1: client.jump_label('goto_liberty_bay_depot') elif weekday == 2: client.jump_label('goto_port_hope_depot') elif weekday == 3: client.jump_label('goto_ankrahmun_depot') elif weekday == 4: client.jump_label('goto_darashia_depot') elif weekday == 5: client.jump_label('goto_edron_depot') elif weekday == 6: client.jump_label('goto_carlin_depot') elif action == "end_rashid": client.jump_label('end_rashid') elif action == "repeat_rashid_svargrond": client.jump_label('start_rashid_svargrond') elif action == "rashid_svargrond": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['rashid_depot']) if not withdraw: client.jump_label('end_rashid_svargrond') elif action == "repeat_rashid_carlin": client.jump_label('start_rashid_carlin') elif action == "rashid_carlin": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['rashid_depot']) if not withdraw: client.jump_label('end_rashid_carlin') elif action == "repeat_rashid_liberty_bay": client.jump_label('start_rashid_liberty_bay') elif action == "rashid_liberty_bay": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['rashid_depot']) if not withdraw: client.jump_label('end_rashid_liberty_bay') elif action == "repeat_rashid_port_hope": client.jump_label('start_rashid_port_hope') elif action == "rashid_port_hope": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['rashid_depot']) if not withdraw: client.jump_label('end_rashid_port_hope') elif action == "repeat_rashid_ankrahmun": client.jump_label('start_rashid_ankrahmun') elif action == "rashid_ankrahmun": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['rashid_depot']) if not withdraw: client.jump_label('end_rashid_ankrahmun') elif action == "repeat_rashid_darashia": client.jump_label('start_rashid_darashia') elif action == "rashid_darashia": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['rashid_depot']) if not withdraw: client.jump_label('end_rashid_darashia') elif action == "repeat_rashid_edron": client.jump_label('start_rashid_edron') elif action == "rashid_edron": withdraw = withdraw_items_to_backpack( backpack=client.script_options['backpack_name'], depot=client.script_options['rashid_depot']) if not withdraw: client.jump_label('end_rashid_edron') elif action == "stash_all": client.reach_locker() stash_item_from_slot(client, client.equips, 'backpack') else: global_actions.waypoint_action(client, action)