Esempio n. 1
0
 async def get_item(self, ctx, name):
     if formatter_custom.name_formatter(name) in self.inventory.keys():
         return get_shop_item(
             self.inventory[formatter_custom.name_formatter(name)])
     else:
         await error.embed_unknown_item(ctx, name)
         return None
Esempio n. 2
0
 def change_favorite_character(self, name):
     if formatter_custom.name_formatter(name) in self.characters.keys():
         self.favorite_character = formatter_custom.name_unformatter(
             formatter_custom.name_formatter(name))
         return True
     elif name.lower() == "none":
         self.favorite_character = "None"
         return True
     else:
         return False
Esempio n. 3
0
 def remove_character(self, charName):
     c = character.get_character_from_dict(
         self.characters, formatter_custom.name_formatter(charName))
     if c.total > 1:
         if c.total <= 7:
             c.const_amnt -= 1
         c.total -= 1
         self.characters[formatter_custom.name_formatter(
             charName)] = c.get_dict()
     else:
         del self.characters[formatter_custom.name_formatter(charName)]
Esempio n. 4
0
 def remove_weapon(self, weapName):
     w = weapon.get_weapon_from_dict(
         self.weapons, formatter_custom.name_formatter(weapName))
     if w.total > 1:
         if w.total <= 5:
             w.refinement -= 1
         w.total -= 1
         self.weapons[formatter_custom.name_formatter(
             weapName)] = w.get_dict()
     else:
         del self.weapons[formatter_custom.name_formatter(weapName)]
     self.update_equiped_weapons()
Esempio n. 5
0
def get_weapon_from_dict(weapDict, name):
    n = formatter_custom.name_formatter(name)
    if n in weapDict.keys():
        w = weapDict[n]
        return Weapon(w["name"], w["URL_name"], w["URL_icon"],
                      w["weapon_type"], w["total"], w["rarity"],
                      w["refinement"], w["attack"], w["substat"],
                      w["substat_value"], w["level"], w["xp"])
Esempio n. 6
0
async def embed_show_char_info(ctx, u, c):
    color = discord.Color.red()
    char_DB = character.get_character(c["name"])
    if char_DB.element == "Anemo":
        color = discord.Color.green()
    elif char_DB.element == "Dendro":
        color = discord.Color.dark_green()
    elif char_DB.element == "Electro":
        color = discord.Color.purple()
    elif char_DB.element == "Hydro":
        color = discord.Color.dark_blue()
    elif char_DB.element == "Geo":
        color = discord.Color.orange()
    elif char_DB.element == "Cryo":
        color = discord.Color.blue()
    const_names_dict = char_DB.constellation_name
    const_names = ""
    for key in const_names_dict.keys():
        if const_names == "":
            const_names += const_names_dict[key]
        else:
            const_names += " or " + const_names_dict[key]
    embed = discord.Embed(title="{un}\'s {cn}".format(un=u.nickname,
                                                      cn=char_DB.name),
                          color=color,
                          description=char_DB.description)
    level = formatter_custom.number_format(c["level"])
    currXP = formatter_custom.number_format(c["xp"])
    maxXP = formatter_custom.number_format(
        formatter_custom.get_xp_to_next_level(c["level"]))
    embed.add_field(name="Level {l}".format(l=level),
                    value="**XP:** {x}/{xm}".format(x=currXP, xm=maxXP))
    embed.add_field(
        name="Amount Info",
        value="**Constellations Unlocked:** {cu}\n**Total Wished:** {tr}".
        format(cu=c["const_amnt"],
               tr=formatter_custom.number_format(c["total"])))
    if len(c["weapon_equiped"]) == 0:
        text = "None"
    else:
        text = c["weapon_equiped"]["name"]
    embed.add_field(name="Equiped Weapon", value=text)
    embed.add_field(
        name="Trivia Info",
        value="**Element:** {e}\n**Constellation:** {c}\n**Weapon Type:** {w}".
        format(e=char_DB.element,
               c=const_names,
               w=formatter_custom.name_unformatter(
                   formatter_custom.name_formatter(char_DB.weapon_type))))
    f = []
    f.append(discord.File(c["URL_icon"], "{}-icon.png".format(c["URL_name"])))
    f.append(
        discord.File(c["URL_portrait"],
                     "{}-portrait.png".format(c["URL_name"])))
    embed.set_image(url="attachment://{}-portrait.png".format(c["URL_name"]))
    embed.set_thumbnail(url="attachment://{}-icon.png".format(c["URL_name"]))

    await ctx.send(embed=embed, files=f)
Esempio n. 7
0
 def set_team(self, teamNum, characters):
     for name in characters:
         if not self.does_character_exist(name):
             return False, name
     self.teams[str(teamNum)] = {}
     for i in range(len(characters)):
         self.teams[str(teamNum)][str(
             i + 1)] = formatter_custom.name_unformatter(
                 formatter_custom.name_formatter(characters[i]))
     return True, "None"
Esempio n. 8
0
 def does_item_exist(self, item_name):
     if formatter_custom.name_formatter(item_name) in self.bag.keys():
         return True
     else:
         return False
Esempio n. 9
0
 def does_weapon_exist(self, weapName):
     if formatter_custom.name_formatter(weapName) in self.weapons.keys():
         return True
     else:
         return False
Esempio n. 10
0
 def does_character_exist(self, charName):
     if formatter_custom.name_formatter(charName) in self.characters.keys():
         return True
     else:
         return False
Esempio n. 11
0
def get_character_from_dict(charsDict, name):
  n = formatter_custom.name_formatter(name)
  c = charsDict[n]
  return dict_to_char(c)
Esempio n. 12
0
 def remove_item(self, name):
     if formatter_custom.name_formatter(name) not in self.inventory.keys():
         del self.inventory[formatter_custom.name_formatter(name)]
Esempio n. 13
0
def does_weap_exist(name):
    real_weap = database_mongo.get_all_weapons_of_criteria(
        "URL_name", formatter_custom.name_formatter(name))
    if real_weap == []:
        return False
    return True
Esempio n. 14
0
def get_weapon_dict(name):
    user_collection = get_weapon_collection()
    return user_collection.find_one(
        {"URL_name": formatter_custom.name_formatter(name)})
Esempio n. 15
0
def get_shop_item_dict(name):
    user_collection = get_shop_item_collection()
    return user_collection.find_one(
        {"item": {
            "URL_name": formatter_custom.name_formatter(name)
        }})
Esempio n. 16
0
 def get_character(self, charName):
     c = character.get_character_from_dict(
         self.characters, formatter_custom.name_formatter(charName))
     return c
Esempio n. 17
0
def does_char_exist(name):
  real_char = database_mongo.get_all_characters_of_criteria("URL_name", formatter_custom.name_formatter(name))
  if real_char == []:
    return False
  return True