def backflip(direction): if direction == "": exits = list(s.room_info.exits.keys()) if len(exits) == 0: c.echo("NO EXITS TO BACKFLIP!!!!") c.echo("NO EXITS TO BACKFLIP!!!!") return direction = random.choice(exits) eqbal(f"stand;backflip {direction}")
def gmcp_ferocity(gmcp_data): #Char.Vitals { "hp": "4500", "maxhp": "4275", "mp": "4107", "maxmp": "4207", "ep": "16525", "maxep": "16525", "wp": "14275", "maxwp": "14275", "nl": "32", "bal": "1", "eq": "1", "vote": "1", "string": "H:4500/4275 M:4107/4207 E:16525/16525 W:14275/14275 NL:32/100 ", "charstats": [ "Bleed: 0", "Rage: 0", "Spec: Sword and Shield", "Ferocity: 0" ] } global ferocity char_stats = gmcp_data.get("charstats", []) for stat in char_stats: if stat.startswith("Ferocity: "): _, str_ferocity = stat.split(" ") ferocity = int(str_ferocity) if ferocity > 0: c.echo(f"Ferocity: {ferocity}")
def threw_something(matches): # You c**k back your arm and throw an obsidian dagger at Parthenope. # You c**k back your arm and throw an obsidian dagger southwest at Ellryn. # figure out if it was a direction global juggled_items item = matches[0] try: juggled_items.remove(item) except ValueError as e: c.echo(f"I guess I wasn't juggling: {item}") c.echo(f"ha! threw: {item}")
def parse_enemies(current_chunk): """ You have the following enemies: Farrah Mezghar You have currently used 2 enemy slots of your 20 maximum. """ global enemies global frenemy current_chunk = strip_ansi(current_chunk) m = re_enemies.search(current_chunk) enemies = m.groups()[0].split("\r\n") c.echo(f"enemies: {' '.join(enemies)}") frenemy.notify("enemies", enemies)
def parse_allies(current_chunk): """ You have the following allies: Ada is an ally (M). Aina is an ally. Rhogan is an ally. You have currently used 5 ally slots of your 20 maximum. """ global allies global frenemy current_chunk = strip_ansi(current_chunk) allies = re_allies.findall(current_chunk) c.echo(f"allies: {' '.join(allies)}") frenemy.notify("allies", allies)
def make_bomb(bomb_type=""): if bomb_type == "": c.echo(BOMB_HELP) elif "concussion".startswith(bomb_type.lower()): eqbal(f"stand;outr 1 iron;construct concussion bomb") elif "butterfly".startswith(bomb_type.lower()): eqbal(f"stand;outr 1 iron;construct butterfly bomb") elif "smoke".startswith(bomb_type.lower()): eqbal(f"stand;outr 1 iron;construct smoke bomb") elif "web".startswith(bomb_type.lower()): eqbal(f"stand;outr 1 rope;construct web bomb") elif "dust".startswith(bomb_type.lower()): eqbal(f"stand;outr 1 diamonddust;construct dust bomb")
async def handle_from_server_queue(from_server_queue): while True: data = await from_server_queue.get() c.current_chunk = data c.main_log(data, "server_text") output = [] try: for line in data.split("\n"): c.modified_current_line = None c.current_line = line stripped_line = strip_ansi(line).rstrip("\r") c.handle_triggers(stripped_line) # c.echo(f"stripped_line: '{ascii(stripped_line)}'") # c.echo(f"dl: {c._delete_lines}") if c._delete_line is True or stripped_line in c._delete_lines: # "delete" the line by not appending it to the output c._delete_line = False elif c.modified_current_line is None: output.append(line) elif c.modified_current_line != "": output.append(c.modified_current_line) # clear the delete_lines c._delete_lines.clear() c.run_after_current_chunk() # some triggers have probably queued stuff to send, so send it if c.to_send: c.send_flush() c.echo("\n".join(output).strip()) from_server_queue.task_done() except Exception: traceback.print_exc(file=sys.stdout)
def wielding(hand, item_name, long_name): if hand == "left": global left_hand left_hand = (item_name, long_name) c.echo(f"{hand} now wielding: {left_hand}") elif hand == "right": global right_hand right_hand = (item_name, long_name) c.echo(f"{hand} now wielding: {right_hand}") else: c.echo(f"Which hand is this? {hand}")
def throw_bomb(bomb_type, direction): if direction == "": direction = "at ground" c.echo(f"throw_bomb type: {bomb_type} dir: {direction}") if bomb_type == "": c.echo(THROW_BOMB_HELP) elif bomb_type.startswith("c"): eqbal(_throw_bomb("concussionbomb", direction)) elif bomb_type.startswith("b"): eqbal(_throw_bomb("butterflybomb", direction)) elif bomb_type.startswith("s"): eqbal(_throw_bomb("smokebomb", direction)) elif bomb_type.startswith("w"): eqbal(_throw_bomb("webbomb", direction)) elif bomb_type.startswith("d"): eqbal(_throw_bomb("dustbomb", direction)) else: c.echo(f"HMMMMM???? throw_bomb type: {bomb_type} dir: {direction}")
def shatter_target(): # not checking for shielder == target because it might be a long mob name c.echo(f"rage: {s.rage}") if s.rage >= 17: c.send("throw jacks at &tar"),
def begin_juggling(matches): global juggled_items juggled_items = list(matches) c.echo(f"juggling: {juggled_items}")
def queued_throw_dagger(current_chunk): #Running queued eqbal command: STAND;GET DAGGER;THROW DAGGER AT RASAHI ACONITE\r\nYou are not fallen or kneeling.\r\nI see no \"dagger\" to take.\r\nYou rub some aconite on an obsidian dagger.\r\nYou c**k back your arm and throw an obsidian dagger at Rasahi. #Running queued eqbal command: STAND;GET DAGGER;THROW DAGGER AT RASAHI ACONITE\r\nYou are not fallen or kneeling.\r\nYou pick up an obsidian dagger.\r\nYou must have whatever you wish to throw wielded. #Lizabel twists her body out of harm's way. current_chunk = strip_ansi(current_chunk) info = {} info["missed"] = False for line in current_chunk.split("\r\n"): matches = re_venom.match(line) if matches: m = matches.groups() venom = m[0] weapon = m[1] c.echo(f"venom: {venom} weapon: {weapon}") info["venom"] = venom info["weapon"] = weapon continue matches = re_throw.match(line) if matches: m = matches.groups() weapon = m[0] target = m[1] info["target"] = target c.echo(f"target: {target} weapon: {weapon}") if line == "You must have whatever you wish to throw wielded.": c.echo(f"{Fore.YELLOW}{Style.BRIGHT}#######################") c.echo("## NOT JUGGLING !!! ##") c.echo(f"#######################{Style.NORMAL}") matches = re_throw_miss.match(line) if matches: info["missed"] = True if info["missed"] == False: c.echo(f"{Fore.YELLOW}{Style.BRIGHT}#######################") c.echo("## NOT JUGGLING !!! ##") c.echo(f"#######################{Style.NORMAL}")
def _throw_dagger(target, venom): eqbal(f"stand;get dagger;throw dagger at {target} {venom}") def juggle_daggers(): eqbal( f"stand;get dagger;get dagger;get dagger;unwield left;juggle dagger dagger dagger;wield blackjack" ) dagger_aliases = [ ( "^dd$", "dagger help", lambda m: c.echo(THROW_DAGGER_HELP) ), ( "^dj$", "juggle daggers!", lambda m: juggle_daggers() ), ( "^dc$", "throw daggers curare!", lambda m: _throw_dagger(s.target, "curare") ), ( "^dk$", "throw daggers kalmia!", lambda m: _throw_dagger(s.target, "kalmia")
def fragment_target(): c.echo(f"rage: {s.rage}") if s.rage >= 17: send("fragment &tar")
def stop_raze(shielder): if shielder == s.target: c.echo(f"{s.target} stopped rebounding! Stop razing!")
def summarize_afflictions(): affs = _summarize_afflictions() if affs: c.echo(f"Affs: {' '.join(affs)}")