Exemplo n.º 1
0
async def print_party(ctx, name=None):
    if not name:
        for character_name in party.keys():
            response = characters.print_character(character_name)
            await ctx.send(embed=response)
    else:
        response = characters.print_character(name)
        await ctx.send(embed=response)
Exemplo n.º 2
0
async def npc(ctx, name=None):
    if not name:
        length = str(len(npcs.keys()))
        await ctx.send("There are currently " + length + " NPCs in the pool.")
        return
    if name == "all":
        for character in npcs:
            await ctx.send(embed=characters.print_character(character))
    else:
        await ctx.send(embed=characters.print_character(name))
Exemplo n.º 3
0
async def change_blessing(ctx, name, blessing, override=False):
    character = shared_functions.find_character(name)
    if not character:
        await ctx.send("Character does not exist")
        return
    if blessing not in blessing_dict and override is not False:
        await ctx.send("Blessing does not exist or is not unlocked")
        return
    character["Blessing"] = blessing
    await ctx.send(embed=characters.print_character(name))
Exemplo n.º 4
0
async def heal(ctx, name, number=None):
    if number is not None:
        await increase(ctx, name, "Health", number)
    else:
        character = shared_functions.find_character(name)
        if not character:
            await ctx.send("Character " + name + " does not exist, dummy")
            return
        # hardcoded max health right now; will eventually need to change to a character["Max Health"] attribute if i
        # implement things like Blessing of Bloat
        characters.change_character_data(name, "Health",
                                         2 * character["Strongness"] + 1)
        await ctx.send(embed=characters.print_character(name))
Exemplo n.º 5
0
async def add_item(ctx, name, item):
    character = shared_functions.find_character(name)
    if not character:
        await ctx.send("Character does not exist!")
        return
    for i in range(0, len(character["Inventory"])):
        if character["Inventory"][i] == "Empty slot" or character["Inventory"][
                i] == "Empty Slot":
            character["Inventory"][i] = item
            break
    else:
        await ctx.send(name + "'s inventory is full!")
        return
    await ctx.send(embed=characters.print_character(name))
Exemplo n.º 6
0
async def remove_item(ctx, name, item):
    character = shared_functions.find_character(name)
    if not character:
        await ctx.send("Character does not exist!")
        return
    length = len(item)
    for i in range(0, len(character["Inventory"])):
        print(character["Inventory"][i][0:length])
        if character["Inventory"][i][0:length] == item:
            character["Inventory"][i] = "Empty slot"
            break
    else:
        await ctx.send("Item not found.")
        return
    await ctx.send(embed=characters.print_character(name))
Exemplo n.º 7
0
async def inventory_size(ctx, name, size):
    character = shared_functions.find_character(name)
    if not character:
        await ctx.send("Character does not exist!")
        return
    try:
        int(size)
    except ValueError:
        await ctx.send("That is not a number you moron!")
        return
    length = len(party[name]["Inventory"])
    if length > int(size):
        party[name]["Inventory"] = party[name]["Inventory"][0:int(size)]
    elif length < int(size):
        for i in range(length, int(size)):
            party[name]["Inventory"].append("Empty slot")
    else:
        await ctx.send("Character already has inventory of size " + size + ".")
        return
    await ctx.send(embed=characters.print_character(name))
Exemplo n.º 8
0
async def buy(ctx, name, item_name):
    if item_name not in item_dict.keys():
        await ctx.send("I've never heard of that item...")
        return
    gold = item_dict[item_name].last_price
    character = shared_functions.find_character(name)
    if not character:
        await ctx.send("Character " + name + " does not exist!")
        return
    if gold > int(character["Gold"]):
        await ctx.send("Not enough gold!")
        return
    for slot in character["Inventory"]:
        if slot == "Empty slot":
            slot_number = character["Inventory"].index(slot)
            break
    else:
        await ctx.send("Not enough inventory space!")
    character["Inventory"][slot_number] = item_name
    character["Gold"] = character["Gold"] - gold
    await ctx.send(embed=characters.print_character(name))
Exemplo n.º 9
0
async def increase(ctx, name, stat, number):
    try:
        number = int(number)
    except ValueError:
        await ctx.send("Stat must be increased by a number.")
        return
    character = shared_functions.find_character(name)
    if not character:
        await ctx.send("Character " + name + " does not exist")
        return
    if stat not in character:
        await ctx.send("Stat " + stat + " does not exist")
        return
    try:
        # prevent some jackass from crashing bot by trying to increase "Backstory"
        int(character[stat])
    except ValueError:
        await ctx.send("Are you trying to increase a non-numerical stat...?")
        return
    character[stat] += number
    await ctx.send(embed=characters.print_character(name))
Exemplo n.º 10
0
async def change_trait(ctx, name, old_trait, new_trait):
    character = shared_functions.find_character(name)
    if not character:
        await ctx.send("Party member or NPC not found.")
        return
    if new_trait not in trait_dict:
        await ctx.send("Trait " + new_trait + " does not exist!")
        return
    if old_trait not in character["Traits"]:
        if old_trait == "1":
            old_trait = character["Traits"][0]
        elif old_trait == "2":
            old_trait = character["Traits"][1]
        elif old_trait == "3":
            old_trait = character["Traits"][2]
        else:
            await ctx.send("Character " + name + " does not have trait " +
                           old_trait + "!")
            return
    character["Traits"][character["Traits"].index(old_trait)] = new_trait
    await ctx.send(embed=characters.print_character(name))
Exemplo n.º 11
0
async def random_char(ctx, boss=False):
    if boss:
        stat_cap = world["boss stat cap"]
    else:
        stat_cap = world["stat cap"]
    if world["number"] <= 0:
        await ctx.send("Invalid world.")
        return
    global next_backstory
    global next_short_name
    global next_name
    if next_backstory:
        backstory = next_backstory
        next_backstory = None
    else:
        backstory = random.choice(random_lists.Backstories)
    if next_short_name:
        first_name = next_short_name
        next_short_name = None
    else:
        first_name = random.choice(names.Names)
        while first_name in npcs.keys():
            first_name = random.choice(names.Names)
    if next_name:
        full_name = next_name
        next_name = None
    else:
        middle_name = None
        if random.randint(1, 2) == 2:
            middle_name = random.choice(names.Names)
        last_name = random.choice(names.Names)
        if middle_name:
            full_name = first_name + " " + middle_name + " " + last_name
        else:
            full_name = first_name + " " + last_name
    strongness = random.randint(0, stat_cap)
    smartness = random.randint(0, stat_cap)
    coolness = random.randint(0, stat_cap)
    health = 2 * strongness + 1
    gold = random.randint(0, stat_cap * 10)
    blessing_level = None
    blessing_roll = random.randint(1, 20)
    if blessing_roll <= world["number"]:
        blessing_level = "Level I"
        blessing_roll = random.randint(1, 20)
        if blessing_roll <= world["number"]:
            blessing_level = "Level II"
            blessing_roll = random.randint(1, 20)
            if blessing_roll <= world["number"]:
                blessing_level = "Level III"
    blessing_name = random.choice(random_lists.Blessings)
    if blessing_level is None:
        blessing = "No blessing"
    else:
        blessing = "**Blessing of " + blessing_name + "** " + blessing_level
    trait1 = random.choice(list(traits.trait_dict.keys()))
    trait2 = trait1
    while trait2 == trait1:
        trait2 = random.choice(list(traits.trait_dict.keys()))
    color_string = shared_functions.random_color()
    inventory = []
    for i in range(0, 3):
        if random.randint(1, 4) == 1:
            inventory.append((await
                              items.random_item(ctx, -2 * world["number"], 1,
                                                False)).name)
        else:
            inventory.append("Empty slot")
    if boss:
        backstory = random.choice(random_lists.BossBackstories)
        trait1 = random.choice(list(traits.boss_trait_dict.keys()))
        health *= (5 * world["number"])
        gold *= (world["number"] * world["number"])
        full_name = "*Boss:* " + full_name
        secondary_trait_roll = random.randint(1, 20)
        if secondary_trait_roll <= world["number"]:
            trait2 = random.choice(traits.boss_trait_dict)
            while trait1 == trait2:
                trait2 = random.choice(traits.boss_trait_dict)
    character = {
        "Backstory": backstory,
        "Name": full_name,
        "Traits": [trait1, trait2],
        "Smartness": smartness,
        "Coolness": coolness,
        "Strongness": strongness,
        "Health": health,
        "Gold": gold,
        "Color": color_string,
        "Inventory": inventory,
        "Blessing": blessing
    }
    npcs[first_name] = character
    await ctx.send(embed=characters.print_character(first_name))
    shared_functions.backup_characters()
Exemplo n.º 12
0
async def randnpc(ctx):
    if len(npcs.keys()) == 0:
        await ctx.send("There are no NPCs!")
        return
    npc = random.choice(list(npcs.keys()))
    await ctx.send(embed=characters.print_character(npc))