Beispiel #1
0
def test_spells_above():
    character = Character(name="GucciMane", local_mode=True)
    spells = character.spells_above(4)
    expected_spells = [
        "Poison Arrow Conj/Pois #######... 1% 6.0 None",
        "Throw Icicle Conj/Ice ######.. 1% 4.0 None",
        "Yara's Violent Unravell Hex/Tmut ######.... 4% 5.0 None",
        "Invisibility Hex ######.. 14% 6.0 None",
        "Metabolic Englaciation Hex/Ice ######.... 17% 5.0 None",
        "Alistair's Intoxication Tmut/Pois #####... 24% 5.0 None",
        "Petrify Tmut/Erth ####.... 38% 4.0 None",
    ]
    assert spells == expected_spells
Beispiel #2
0
def process_event(event):
    morgue_event = MorgueEvent.from_event(event)

    if morgue_event.command == "!h?":
        return print_the_help()

    # Elif Island
    msg = None
    if morgue_event.is_character_command():
        print("A single Character Command!")
        character = Character(name=morgue_event.character)
        formatter = Formatter(character)

        if morgue_event.command == "!armour":
            msg = formatter.print_armour()
        elif morgue_event.command == "!weapons":
            msg = formatter.print_weapons()
        elif morgue_event.command == "!runes":
            msg = formatter.print_runes()
        elif morgue_event.command == "!spells":

            if morgue_event.level_barrier:
                msg = character.spells_above(morgue_event.level_barrier)
            else:
                msg = formatter.print_spells()

        elif morgue_event.command == "!skills":
            msg = formatter.print_skills()
        elif morgue_event.command == "!version":
            msg = formatter.print_version()
        elif morgue_event.command == "!jewellery":
            msg = formatter.print_jewellery()
            print(
                f"WE are looking for jewellery and this is what we found {msg}"
            )
        elif morgue_event.command == "!max_damage":
            msg = formatter.print_max_damage()
        elif morgue_event.command == "!mutations":
            msg = formatter.print_mutations()
        elif morgue_event.command == "!scrolls":
            msg = formatter.print_scrolls()
        elif morgue_event.command == "!potions":
            msg = formatter.print_potions()
        elif morgue_event.command == "!gods":
            msg = formatter.print_gods()
        elif morgue_event.command == "!overview":
            morgue_parser = MorgueParser(character.non_saved_morgue_file())
            msg = morgue_parser.overview()
        elif morgue_event.command == "!fetch":
            morgue_saver(character, character.non_saved_morgue_file(), True)
        elif morgue_event.command == "!fetch_s3_morgue":
            print(f"We are fetching the S3 Morgue for {character.name}")
            with open(f"tmp/s3_{character.name}.txt", "w") as f:
                f.write(character.s3_morgue_file())
        elif morgue_event.command == "!save_morgue":
            save_morgue(character)
        elif morgue_event.command == "!search":
            pass
            # for c in ["!armour", "!weapons", "!jewellery"]:
            #     call_command_with_arg(formatter, c, morgue_event.args[0])

    elif morgue_event.is_multi_character_command():
        print("A multiple Character Command!")
        if morgue_event.command == "!stalk_all":
            characters = fetch_characters()
            for character in characters:
                character = Character(name=character)
                morgue_saver(character, character.non_saved_morgue_file(),
                             True)
        elif morgue_event.command == "!rune_awards":
            rune_awards()
        elif morgue_event.command == "!characters":
            characters = fetch_characters()
            msg = ["All The Characters"] + [", ".join(characters)]
        elif morgue_event.command == "!clean_morgue":
            print("COMING SOON")
            # clean_the_morgue()
        elif morgue_event.command == "!weapon_awards":
            find_the_max_damage_for_all_characters()
    else:
        print("WE DON'T KNOW THAT COMMAND!!!!!!!")

    if morgue_event.search:
        print(f"We are searching: {morgue_event.search}")

        if type(msg) is list:
            print("Search a List")
            msg = [item for item in msg if morgue_event.search in item]
        else:
            print("Search a strang")
            if morgue_event.search not in msg:
                msg = None

    if msg:
        send_chat_to_stream(msg)
    else:
        print(
            f"No Message return for command: {morgue_event.command} character: {morgue_event.character}"
        )