def shop(ID, m): h = existing_char(ID) if h != None: if m.lower() == "life potion": if db.select('character', 'gold', ID) >= 600: inventory = db.select_list("character", "inventory", ID) inventory.append("Life Potion") db.update_list("character", "inventory", ID, inventory) new_gold = db.select("character", "gold", ID) - 600 db.update("character", "gold", ID, new_gold) return f"You have obtained a Life Potion. You have {db.select('character', 'gold', ID)} Gold remaining." if db.select('character', 'gold', ID) < 600: return "You do not have enough Gold." elif m.lower() == "stamina potion": if db.select('character', 'gold', ID) >= 600: inventory = db.select_list("character", "inventory", ID) inventory.append("Stamina Potion") db.update_list("character", "inventory", ID, inventory) new_gold = db.select("character", "gold", ID) - 600 db.update("character", "gold", ID, new_gold) return f"You have obtained a Stamina Potion. You have {db.select('character', 'gold', ID)} Gold remaining." if db.select('character', 'gold', ID) < 600: return "You do not have enough Gold." else: return "This item is not in the shop" else: return "You do not have a character yet."
def current_titles_available(ID): h = existing_char(ID) if h != None: if len(db.select_list("character", "titleavailable", ID)) >= 1: titles_in_order = [ f"- {x}" for x in db.select_list("character", "titleavailable", ID) ] c = "\n".join(titles_in_order) return f"The titles available to be equipped are: {c}" else: return "You don't have a title except the one which is equipped" else: return "You don't have a character yet"
def weartitle(ID, m): if m in db.select_list("character", "titleavailable", ID): cur_title = db.select("character", "titleequipped", ID) available = db.select_list("character", "titleavailable", ID) available.append(cur_title) available.remove(m) db.update_list("character", "titleavailable", ID, available) db.update("character", "titleequipped", ID, m) #db.update_list("character", "titleavailable", ID, cur_title) #db.update("character", "titleequipped", ID, m) #b = db.select_list("character", "titleavailable", ID) #b.remove(db.select("character", "titleequipped", ID)) #db.update_list("character", "titleavailable", ID, b) return f"The title {db.select('character', 'titleequipped', ID)} has been equipped" else: return f"This is not an available title."
def Yatori(ID): h = existing_char(ID) if h != None: if ID == 257115950623490049: if "God of Creation" not in db.select_list( "character", "titleavailable", ID) and "God of Creation" != db.select( "character", "titleequipped", ID): add_title = db.select_list("character", "titleavailable", ID) add_title.append("God of Creation") db.update_list("character", "titleavailable", ID, add_title) db.update("character", "race", ID, "God") return "You have gotten your lost strength back" else: return "You already are divine, Master" else: return "You are not the creator of this bot" else: return "You have not created a character yet"
def use(ID, m): h = existing_char(ID) if h != None: if m.lower() == "life potion": m = "Life Potion" if m in db.select_list("character", "inventory", ID): if (db.select("character", "hp", ID) - db.select("character", "curhp", ID)) < 50 and ( db.select("character", "hp", ID) - db.select("character", "curhp", ID)) != 0: gainedhp = db.select("character", "hp", ID) - db.select( "character", "curhp", ID) max_hp = db.select("character", "hp", ID) db.update("character", "curhp", ID, max_hp) inventory = db.select_list("character", "inventory", ID) new_inventory = inventory.remove("Life Potion") db.update_list("character", "inventory", ID, new_inventory) return f"{gainedhp} hp have been added, you are now full health." elif (db.select("character", "hp", ID) - db.select("character", "curhp", ID)) >= 50: more_hp = db.select("character", "curhp", ID) + 50 db.update("character", "curhp", ID, more_hp) inventory = db.select_list("character", "inventory", ID) new_inventory = inventory.remove("Life Potion") db.update_list("character", "inventory", ID, new_inventory) return f"50 hp have been added. You currently have {db.select('character', 'curhp', ID)}/{db.select('character', 'hp', ID)}hp." elif (db.select("character", "hp", ID) - db.select("character", "curhp", ID)) == 0: return "You are already full health." elif m.lower() == "stamina potion": m = "Stamina Potion" if m in db.select_list("character", "inventory", ID): if (db.select("character", "mana", ID) - db.select("character", "curmana", ID)) < 50 and ( db.select("character", "mana", ID) - db.select("character", "curmana", ID)) != 0: gained_stamina = db.select("character", "mana", ID) - db.select( "character", "curmana", ID) max_stamina = db.select("character", "mana", ID) db.update("character", "curmana", ID, max_stamina) inventory = db.select_list("character", "inventory", ID) new_inventory = inventory.remove("Stamina Potion") db.update_list("character", "inventory", ID, new_inventory) return f"{gained_stamina}stamina has been added, you are now at max Stamina" elif (db.select("character", "mana", ID) - db.select("character", "curmana", ID)) >= 50: more_stamina = db.select("character", "curmana", ID) + 50 db.update("character", "curmana", ID, more_stamina) inventory = db.select_list("character", "inventory", ID) new_inventory = inventory.remove("Stamina Potion") db.update_("character", "inventory", ID, new_inventory) return f"50 Stamina has been added. You currently have {db.select('character', 'curmana', ID)}/{db.select('character', 'mana', ID)}stamina" elif (db.select("character", "mana", ID) - db.select("character", "curmana", ID)) == 0: return "You already are at max Stamina." else: return "You do not have that item in your inventory." else: return "You do not have a character yet."
def skills(ID): h = existing_char(ID) if h != None: if db.select_list("character", "actskills", ID) != [""] and db.select_list( "character", "passskills", ID) != [""]: actives = [ f"--{x}" for x in db.select_list("character", "actskills", ID) ] passives = [ f"--{y}" for y in db.select_list("character", "passskills", ID) ] passives2 = "".join(passives) actives2 = "".join(actives) return f"The active skills available to you are: \n {actives2} \n The passive skills available to you are: \n {passives2}" elif db.select_list("character", "actskills", ID) != [""] and db.select_list( "character", "passskills", ID) == [""]: actives = [ f"--{x}" for x in db.select_list("character", "actskills", ID) ] print(db.select_list("character", "actskills", ID)) print(actives) actives2 = "".join(actives) print(actives2) return f"The active skills available to you are: \n {actives2} \n You have no passive skill." elif db.select_list("character", "passskills", ID) != [""] and db.select_list( "character", "actskills", ID) == [""]: passives = [ f"--{y}" for y in db.select_list("character", "passskills", ID) ] passives2 = "".join(passives) return f"The passive skills available to you are: \n {passives2} \n You have no active skill" else: return "You don't have a skill yet. Get your first skill using ^learnskill" else: return "You don't have a character yet."