async def create_item(self, ctx, member: discord.Member = None, amount: int = None, *, item=None): """Comando usado apelas por DEVS para criar itens de crafts para doadores""" if member is None: return await ctx.send("<:alert:739251822920728708>│`Você precisa mencionar alguem!`") if amount is None: return await ctx.send("<:alert:739251822920728708>│`Você precisa dizer uma quantia!`") if amount < 1: return await ctx.send("<:alert:739251822920728708>│`Você precisa dizer uma quantia maior que 0.`") if item is None: return await ctx.send("<:alert:739251822920728708>│`Você esqueceu de falar o nome do item para dar!`") item_key = convert_item_name(item, self.bot.items) if item_key is None: return await ctx.send("<:alert:739251822920728708>│`Item Inválido!`") data_member = await self.bot.db.get_data("user_id", member.id, "users") update_member = data_member if data_member is None: return await ctx.send('<:alert:739251822920728708>│**ATENÇÃO** : ' '`esse usuário não está cadastrado!`', delete_after=5.0) if member.id in self.bot.jogando: return await ctx.send("<:alert:739251822920728708>│`O usuario está jogando, aguarde para quando" " ele estiver livre!`") item_name = self.bot.items[item_key][1] try: update_member['inventory'][item_key] += amount except KeyError: update_member['inventory'][item_key] = amount await self.bot.db.update_data(data_member, update_member, 'users') return await ctx.send(f'<a:hack:525105069994278913>│`PARABENS, VC CRIOU` **{amount}** `DE` ' f'**{item_name.upper()}** `PARA` **{member.name}** `COM SUCESSO!`')
async def discover(self, ctx, *, item=None): """Abra um presente para liberar seu giftcard.""" if item is None: return await ctx.send( "<:alert:739251822920728708>│`Você esqueceu de falar o nome do item para descobrir!`" ) item_key = convert_item_name(item, self.bot.items) if item_key is None: return await ctx.send( "<:alert:739251822920728708>│`Item Inválido!`") if item_key not in [ "marry_pink", "marry_orange", "marry_green", "marry_blue" ]: return await ctx.send( "<:alert:739251822920728708>│`Você não pode descobrir esse tipo de item.`" ) data_user = await self.bot.db.get_data("user_id", ctx.author.id, "users") update_user = data_user if data_user['config']['playing']: return await ctx.send( "<:alert:739251822920728708>│`Você está jogando, aguarde para quando" " vocÊ estiver livre!`") if data_user['config']['battle']: msg = '<:negate:721581573396496464>│`VOCE ESTÁ BATALHANDO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) item_name = self.bot.items[item_key][1] if item_key not in data_user['inventory']: return await ctx.send( f"<:alert:739251822920728708>│`Você não tem {item_name.upper()} no seu " f"inventario!`") update_user['inventory'][item_key] -= 1 if update_user['inventory'][item_key] < 1: del update_user['inventory'][item_key] item_discovered = choice(self.discover_items[item_key]) amount = randint(1, item_discovered[1]) try: update_user['inventory'][item_discovered[0]] += amount except KeyError: update_user['inventory'][item_discovered[0]] = amount await self.bot.db.update_data(data_user, update_user, 'users') await ctx.send( f'<:confirmed:721581574461587496>│`PARABENS, VC DESCOBRIU` {self.i[item_discovered[0]][0]} ' f'**{amount}** `{self.i[item_discovered[0]][1].upper()} COM SUCESSO!`' ) await self.bot.data.add_sts(ctx.author, "discover", 1)
async def mercadd(self, ctx, value: int = None, amount: int = None, *, item=None): """Comando para adicionar loja no mercado""" global item_key_equip, item_key_craft, _type if value is None: return await ctx.send( "<:alert:739251822920728708>│`Você precisa dizer o preço da unidade!`" ) if value < 1: return await ctx.send( "<:alert:739251822920728708>│`Você precisa dizer uma quantia maior que 0.`" ) if amount is None: return await ctx.send( "<:alert:739251822920728708>│`Você precisa dizer uma quantidade de itens!`" ) if amount < 1: return await ctx.send( "<:alert:739251822920728708>│`Você precisa dizer uma quantia maior que 0.`" ) if item is None: return await ctx.send( "<:alert:739251822920728708>│`Você esqueceu de falar o nome do item para colocar " "na loja!`") item_key_equip, item_key_craft, _type, count = None, None, None, 0 data = await self.bot.db.get_all_data("merchant") data_user = await self.bot.db.get_data("user_id", ctx.author.id, "users") if len(data) > 0: for key in data: if key['owner'] == ctx.author.id: count += 1 TOT = _MAX_VIP if data_user['config']['vip'] else _MAX if count > TOT: return await ctx.send( "<:alert:739251822920728708>│`Você atingiu a quantidade maxima de lojas disponiveis" " por usuario, voce pode esperar as lojas esvaziarem por compras ou pode " "editar/remover a loja do mercado.`") item_key_craft = convert_item_name(item, self.bot.items) if item_key_craft is not None: _type = "craft" if self.bot.items[item_key_craft][2] is False: if self.bot.items[item_key_craft][3] == 8 or self.bot.items[ item_key_craft][3] == 12: return await ctx.send( "<:alert:739251822920728708>│`Você não pode vender esse tipo de item.`" ) equips_list = list() for ky in self.bot.config['equips'].keys(): for k, v in self.bot.config['equips'][ky].items(): equips_list.append((k, v)) if item not in [i[1]["name"] for i in equips_list]: if "sealed" in item.lower() and item.lower() != "unsealed stone": return await ctx.send( "<:negate:721581573396496464>│`ESSE ITEM ESTÁ SELADO, ANTES DISSO TIRE O SELO " "USANDO O COMANDO:` **ASH LIBERAR**") if _type is None: return await ctx.send( "<:negate:721581573396496464>│`ESSE ITEM NAO É NEM UM CRAFT NEM UM EQUIPAMENTO " "VALIDO, VERIFIQUE O NOME DO ITEM E TENTE NOVAMENTE...`") if item in [i[1]["name"] for i in equips_list] and _type is None: _type = "equip" data = await self.bot.db.get_data("user_id", ctx.author.id, "users") update = data if ctx.author.id in self.bot.jogando: return await ctx.send( "<:alert:739251822920728708>│`Você está jogando, aguarde para quando" " vocÊ estiver livre!`") if not update['rpg']['active']: embed = discord.Embed( color=self.bot.color, description= '<:negate:721581573396496464>│`USE O COMANDO` **ASH RPG** `ANTES!`' ) return await ctx.send(embed=embed) if ctx.author.id in self.bot.batalhando: msg = '<:negate:721581573396496464>│`VOCE ESTÁ BATALHANDO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) if _type == "craft": item_name = self.bot.items[item_key_craft][1] if item_key_craft not in update['inventory']: return await ctx.send( "<:alert:739251822920728708>│`Você não tem esse item no seu inventario!`" ) if update['inventory'][item_key_craft] < amount: return await ctx.send( f"<:alert:739251822920728708>│`VOCÊ NÃO TEM ESSA QUANTIDADE DISPONIVEL DE " f"{item_name.upper()}!`") update['inventory'][item_key_craft] -= amount if update['inventory'][item_key_craft] < 1: del update['inventory'][item_key_craft] item_key_equip = None if _type == "equip": for key in update['rpg']['items'].keys(): for name in equips_list: if name[0] == key and name[1]["name"] == item: item_key_equip = name if item_key_equip is None: return await ctx.send( "<:negate:721581573396496464>│`VOCE NAO TEM ESSE ITEM...`") if update['rpg']['items'][item_key_equip[0]] < amount: return await ctx.send( f"<:alert:739251822920728708>│`VOCÊ NÃO TEM ESSA QUANTIDADE DISPONIVEL DE " f"{item_key_equip[1]['name'].upper()}!`") update['rpg']['items'][item_key_equip[0]] -= amount if update['rpg']['items'][item_key_equip[0]] < 1: del update['rpg']['items'][item_key_equip[0]] if _type == "craft": item_merchant = item_key_craft else: item_merchant = item_key_equip[0] _id = create_id() a = '{:,.2f}'.format(float(value)) b = a.replace(',', 'v') c = b.replace('.', ',') d = c.replace('v', '.') data_merchant = { "_id": _id, "owner": ctx.author.id, "type": _type, "amount": amount, "item": item_merchant, "value": value } await self.bot.db.push_data(data_merchant, "merchant") await self.bot.db.update_data(data, update, 'users') await ctx.send( f'<:confirmed:721581574461587496>│`PARABENS, VC ACABOU DE CRIAR UMA LOJA` **{_id}** ' f'`NO MERCADO, CONTENDO` **{amount}** `DE` **{item.upper()}** `CUSTANDO` **R$ {d}** ' f'`A UNIDADE COM SUCESSO!`') await self.bot.data.add_sts(ctx.author, "merchant_add", 1)
async def convert(self, ctx, *, item=None): if item is None: return await ctx.send( "<:alert:739251822920728708>│``Você esqueceu de falar o nome do item para " "converter!``") item_key = convert_item_name(item, self.bot.items) if item_key is None: return await ctx.send( "<:alert:739251822920728708>│``Item Inválido!``") if item_key not in self.sealed_items: return await ctx.send( "<:alert:739251822920728708>│``Esse item nao é um equipamento selado!``" ) data = await self.bot.db.get_data("user_id", ctx.author.id, "users") update = data if item_key not in data['inventory']: return await ctx.send( "<:alert:739251822920728708>│``Você não tem esse item no seu inventario!``" ) # ========================================================================================= msg = f"\n".join([ f"{self.i[k][0]} ``{v}`` ``{self.i[k][1]}``" for k, v in self.cost_convert.items() ]) msg += "\n\n**OBS:** ``PARA CONSEGUIR OS ITENS VOCE PRECISA USAR O COMANDO`` **ASH BOX**" Embed = discord.Embed( title="O CUSTO PARA VOCE CONVERTER UM EQUIPAMENTO SELADO:", color=self.bot.color, description=msg) Embed.set_author(name=self.bot.user, icon_url=self.bot.user.avatar_url) Embed.set_thumbnail(url="{}".format(ctx.author.avatar_url)) Embed.set_footer(text="Ashley ® Todos os direitos reservados.") await ctx.send(embed=Embed) cost = {} for i_, amount in self.cost_convert.items(): if i_ in data['inventory']: if data['inventory'][i_] < self.cost_convert[i_]: cost[i_] = self.cost_convert[i_] else: cost[i_] = self.cost_convert[i_] if len(cost) > 0: msg = f"\n".join( [f"{self.i[key][0]} **{key.upper()}**" for key in cost.keys()]) return await ctx.send( f"<:alert:739251822920728708>│``Falta esses itens para converter um equipamento:``" f"\n{msg}\n``OLHE SEU INVENTARIO E VEJA A QUANTIDADE QUE ESTÁ FALTANDO.``" ) def check_option(m): return m.author == ctx.author and m.content == '0' or m.author == ctx.author and m.content == '1' msg = await ctx.send( f"<:alert:739251822920728708>│``VOCE JA TEM TODOS OS ITEM NECESSARIOS, DESEJA CONVERTER " f"SEU EQUIPAMENTO SELADO AGORA?``\n**1** para ``SIM`` ou **0** para ``NÃO``" ) try: answer = await self.bot.wait_for('message', check=check_option, timeout=30.0) except TimeoutError: await msg.delete() return await ctx.send( "<:negate:721581573396496464>│``COMANDO CANCELADO!``") if answer.content == "0": await msg.delete() return await ctx.send( "<:negate:721581573396496464>│``COMANDO CANCELADO!``") await sleep(2) await msg.edit( content= f"<a:loading:520418506567843860>│``removendo os itens de custo e o equipamento da sua" f" conta...``") # ========================================================================================= for i_, amount in self.cost_convert.items(): update['inventory'][i_] -= amount if update['inventory'][i_] < 1: del update['inventory'][i_] update['inventory'][item_key] -= 1 if update['inventory'][item_key] < 1: del update['inventory'][item_key] def check_item(m): return m.author == ctx.author msg = await ctx.send( f"<:alert:739251822920728708>│``QUAL O NOME DO EQUIPAMENTO SELADO, QUE VOCE SEJA QUE SEU" f" EQUIPAMENTO ATUAL SEJA CONVERTIDO?``") try: answer = await self.bot.wait_for('message', check=check_item, timeout=30.0) except TimeoutError: await msg.delete() return await ctx.send( "<:negate:721581573396496464>│``COMANDO CANCELADO!``") item_convert = convert_item_name(answer.content, self.bot.items) if item_convert is None: await msg.delete() return await ctx.send( "<:alert:739251822920728708>│``Item Inválido!``") if item_convert not in self.sealed_items: await msg.delete() return await ctx.send( "<:alert:739251822920728708>│``Esse item nao é um equipamento selado!``" ) try: update['inventory'][item_convert] += 1 except KeyError: update['inventory'][item_convert] = 1 await msg.edit( content= f"<:confirmed:721581574461587496>│``itens retirados com sucesso...``" ) await sleep(2) await msg.delete() await self.bot.db.update_data(data, update, 'users') await ctx.send( f"<:confirmed:721581574461587496>│``O ITEM {item.upper()} FOI CONVERTIDO PARA " f"{item_convert.upper()} COM SUCESSO, OLHE O SEU INVENTARIO DE ITENS E VEJA SEU NOVO ITEM!``" )
async def give(self, ctx, member: discord.Member = None, amount: int = None, *, item=None): """De aquele item de craft como presente para um amigo seu ou troque com alguem.""" if member is None: return await ctx.send( "<:alert:739251822920728708>│`Você precisa mencionar alguem!`") if amount is None: return await ctx.send( "<:alert:739251822920728708>│`Você precisa dizer uma quantia!`" ) if amount < 1: return await ctx.send( "<:alert:739251822920728708>│`Você precisa dizer uma quantia maior que 0.`" ) if member.id == ctx.author.id: return await ctx.send( "<:alert:739251822920728708>│`Você não pode dar um item a si mesmo!`" ) if item is None: return await ctx.send( "<:alert:739251822920728708>│`Você esqueceu de falar o nome do item para dar!`" ) item_key = convert_item_name(item, self.bot.items) if item_key is None: return await ctx.send( "<:alert:739251822920728708>│`Item Inválido!`") if self.bot.items[item_key][2] is False: return await ctx.send( "<:alert:739251822920728708>│`Você não pode dar esse tipo de item.`" ) data_user = await self.bot.db.get_data("user_id", ctx.author.id, "users") data_member = await self.bot.db.get_data("user_id", member.id, "users") update_user = data_user update_member = data_member if ctx.author.id in self.bot.jogando: return await ctx.send( "<:alert:739251822920728708>│`Você está jogando, aguarde para quando" " vocÊ estiver livre!`") if ctx.author.id in self.bot.batalhando: msg = '<:negate:721581573396496464>│`VOCE ESTÁ BATALHANDO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) if data_member is None: return await ctx.send( '<:alert:739251822920728708>│**ATENÇÃO** : ' '`esse usuário não está cadastrado!`', delete_after=5.0) if member.id in self.bot.jogando: return await ctx.send( "<:alert:739251822920728708>│`O membro está jogando, aguarde para quando" " ele estiver livre!`") if member.id in self.bot.batalhando: msg = '<:negate:721581573396496464>│`O membro está batalhando!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) item_name = self.bot.items[item_key][1] if item_key in data_user['inventory']: if data_user['inventory'][item_key] >= amount: update_user['inventory'][item_key] -= amount if update_user['inventory'][item_key] < 1: del update_user['inventory'][item_key] try: update_member['inventory'][item_key] += amount except KeyError: update_member['inventory'][item_key] = amount await self.bot.db.update_data(data_user, update_user, 'users') await self.bot.db.update_data(data_member, update_member, 'users') await ctx.send( f'<:confirmed:721581574461587496>│`PARABENS, VC DEU {amount} DE ' f'{item_name.upper()} PARA {member.name} COM SUCESSO!`') await self.bot.data.add_sts(ctx.author, "give", 1) else: await ctx.send( f"<:alert:739251822920728708>│`VOCÊ NÃO TEM ESSA QUANTIDADE DISPONIVEL DE " f"{item_name.upper()}!`") else: await ctx.send( f"<:alert:739251822920728708>│`Você não tem {item_name.upper()} no seu " f"inventario!`")
async def enchanter_weapon(self, ctx, *, enchant: str = None): """Comando usado pra encantar suas habilidades no rpg da Ashley Use ash enchant add numero_da_skill""" query = {"_id": 0, "user_id": 1, "inventory": 1, "rpg": 1} data = await (await self.bot.db.cd("users")).find_one({"user_id": ctx.author.id}, query) equips_list = list() for ky in self.bot.config['equips'].keys(): for k, v in self.bot.config['equips'][ky].items(): equips_list.append((k, v)) if not data['rpg']['active']: msg = '<:negate:721581573396496464>│`USE O COMANDO` **ASH RPG** `ANTES!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) if ctx.author.id in self.bot.batalhando: msg = '<:negate:721581573396496464>│`VOCE ESTÁ BATALHANDO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) if enchant is None: msg = '<:negate:721581573396496464>│`VOCE PRECISA DIZER UM ENCANTAMENTO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) enchants = ["enchant_hero", "enchant_violet", "enchant_inspiron", "enchant_mystic", "enchant_silver", "blessed_enchant_hero", "blessed_enchant_violet", "blessed_enchant_inspiron", "blessed_enchant_mystic", "blessed_enchant_silver"] item_key = convert_item_name(enchant, self.bot.items) if item_key not in enchants: msg = '<:negate:721581573396496464>│`VOCE PRECISA DIZER UM ENCANTAMENTO VÁLIDO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) if item_key not in data['inventory'].keys(): msg = f'<:negate:721581573396496464>│`VOCE NAO TEM {enchant.upper()} NO SEU INVENTARIO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) sword_id = data['rpg']["equipped_items"]['sword'] if sword_id is None: msg = '<:negate:721581573396496464>│`VOCE PRECISA TER UMA ARMA EQUIPADA PARA ENCANTAR!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) sword = [i[1]["name"] for i in equips_list if i[0] == sword_id][0] TIER = ["silver", "mystic", "inspiron", "violet", "hero"] tt = TIER.index(sword.split()[-2 if "+" in sword.split()[-1] else -1]) tt_enchant = TIER.index(enchant.split()[-1]) if tt != tt_enchant: msg = '<:negate:721581573396496464>│`VOCE PRECISA USAR UM ENCANTAMENTO DA MESMA RARIDADE DA SUA ARMA!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) lw = int(str(sword.split()[-1]).replace("+", "")) if "+" in sword.split()[-1] else 0 if lw >= limit_weapon: msg = '<:negate:721581573396496464>│`ESSA ARMA JA ATINGIU O SEU ENCANTAMENTO MAXIMO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) data['inventory'][item_key] -= 1 if data['inventory'][item_key] < 1: del data['inventory'][item_key] up_chance = self.chance_weapon[str(tt + 1)][lw] chance = randint(1, 100) if "blessed" not in enchant.lower() else 1 if chance < up_chance: sn = " ".join(sword.split()[:]) if lw == 0 else " ".join(sword.split()[:-1]) sn += f" +{lw + 1}" weapon_key = [i[0] for i in equips_list if i[1]["name"] == sn][0] data['rpg']["equipped_items"]['sword'] = weapon_key msg = f"<:confirmed:721581574461587496>│🎊 **PARABENS** 🎉 {ctx.author.mention} `SEU ENCATAMENTO PASSOU " \ f"PARA` **+{lw + 1}**" embed = discord.Embed(color=self.bot.color, description=msg) await ctx.send(embed=embed) await self.bot.data.add_sts(ctx.author, ["enchants", "enchant_win"]) elif chance == up_chance: msg = f'<:negate:721581573396496464>│{ctx.author.mention} `SEU ENCATAMENTO FALHOU, MAS VOCE NAO REGREDIU' \ f' O SEU ENCANTAMENTO!`' embed = discord.Embed(color=self.bot.color, description=msg) await ctx.send(embed=embed) await self.bot.data.add_sts(ctx.author, ["enchants", "enchant_lose"]) else: sn = " ".join(sword.split()[:]) if lw == 0 else " ".join(sword.split()[:-1]) sn += f" +{lw - 1}" if lw > 1 else "" weapon_key = [i[0] for i in equips_list if i[1]["name"] == sn][0] data['rpg']["equipped_items"]['sword'] = weapon_key msg = f'<:negate:721581573396496464>│{ctx.author.mention} `SEU ENCATAMENTO QUEBROU, POR CONTA DISSO ' \ f'SEU ENCANTAMENTO REGREDIU PARA` **+{lw - 1}**' embed = discord.Embed(color=self.bot.color, description=msg) await ctx.send(embed=embed) await self.bot.data.add_sts(ctx.author, ["enchants", "enchant_lose"]) cl = await self.bot.db.cd("users") query = {"$set": {"rpg": data["rpg"], "inventory": data["inventory"]}} await cl.update_one({"user_id": data["user_id"]}, query, upsert=False)
async def enchanter_armor(self, ctx, armor: str = None, *, enchant: str = None): """Comando usado pra encantar suas habilidades no rpg da Ashley Use ash enchant add numero_da_skill""" query = {"_id": 0, "user_id": 1, "inventory": 1, "rpg": 1} data = await (await self.bot.db.cd("users")).find_one({"user_id": ctx.author.id}, query) if not data['rpg']['active']: msg = '<:negate:721581573396496464>│`USE O COMANDO` **ASH RPG** `ANTES!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) if ctx.author.id in self.bot.batalhando: msg = '<:negate:721581573396496464>│`VOCE ESTÁ BATALHANDO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) armors = ["shoulder", "breastplate", "gloves", "leggings", "boots", "shield", "necklace", "earring", "ring"] if armor not in armors or armor is None: msg = '<:negate:721581573396496464>│`VOCE PRECISA DIZER UMA PARTE DA ARMADURA VÁLIDA, EXEMPLO:`\n' \ 'ash ena **gloves** blessed_armor_silver,\n' \ '`Partes validas:`\n**"shoulder", "breastplate", "gloves", "leggings", "boots", "shield", ' \ '"necklace", "earring", "ring"**' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) if enchant is None: msg = '<:negate:721581573396496464>│`VOCE PRECISA DIZER UM ENCANTAMENTO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) enchants = ["armor_hero", "armor_violet", "armor_inspiron", "armor_mystic", "armor_silver", "blessed_armor_hero", "blessed_armor_violet", "blessed_armor_inspiron", "blessed_armor_mystic", "blessed_armor_silver"] item_key = convert_item_name(enchant, self.bot.items) if item_key not in enchants: msg = '<:negate:721581573396496464>│`VOCE PRECISA DIZER UM ENCANTAMENTO VÁLIDO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) if item_key not in data['inventory'].keys(): msg = f'<:negate:721581573396496464>│`VOCE NAO TEM {enchant.upper()} NO SEU INVENTARIO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) TIER = ["silver", "mystic", "inspiron", "violet", "hero"] tt = TIER.index(enchant.split()[-1]) if data['rpg']['armors'][armor][tt] >= limit: msg = '<:negate:721581573396496464>│`ESSA ARMADURA JA ATINGIU O ENCANTAMENTO MAXIMO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) data['inventory'][item_key] -= 1 if data['inventory'][item_key] < 1: del data['inventory'][item_key] up_chance = self.chance_armor[str(tt + 1)][data['rpg']['armors'][armor][tt]] chance = randint(1, 100) if "blessed" not in enchant.lower() else 1 if chance < up_chance: data['rpg']['armors'][armor][tt] += 1 msg = f"<:confirmed:721581574461587496>│🎊 **PARABENS** 🎉 {ctx.author.mention} `SEU ENCATAMENTO PASSOU " \ f"PARA` **+{data['rpg']['armors'][armor][tt]}**" embed = discord.Embed(color=self.bot.color, description=msg) await ctx.send(embed=embed) await self.bot.data.add_sts(ctx.author, ["enchants", "enchant_win"]) elif chance == up_chance: msg = f'<:negate:721581573396496464>│{ctx.author.mention} `SEU ENCATAMENTO FALHOU, MAS VOCE NAO REGREDIU' \ f' O SEU ENCANTAMENTO!`' embed = discord.Embed(color=self.bot.color, description=msg) await ctx.send(embed=embed) await self.bot.data.add_sts(ctx.author, ["enchants", "enchant_lose"]) else: data['rpg']['armors'][armor][tt] -= 1 if data['rpg']['armors'][armor][tt] < 0: data['rpg']['armors'][armor][tt] = 0 msg = f'<:negate:721581573396496464>│{ctx.author.mention} `SEU ENCATAMENTO QUEBROU, POR CONTA DISSO ' \ f'SEU ENCANTAMENTO REGREDIU PARA` **+{data["rpg"]["armors"][armor][tt]}**' embed = discord.Embed(color=self.bot.color, description=msg) await ctx.send(embed=embed) await self.bot.data.add_sts(ctx.author, ["enchants", "enchant_lose"]) cl = await self.bot.db.cd("users") query = {"$set": {"rpg": data["rpg"], "inventory": data["inventory"]}} await cl.update_one({"user_id": data["user_id"]}, query, upsert=False)
async def adfly(self, ctx, *, item=None): """Comando de mineração de fragmento de Blessed Ethernyas""" if item is None: _bonus = None else: item_key = convert_item_name(item, self.bot.items) if item_key is None: return await ctx.send("<:alert:739251822920728708>│`Item Inválido!`") if item_key not in self._items: return await ctx.send("<:alert:739251822920728708>│`Você não pode usar esse tipo de item aqui.`") data_user = await self.bot.db.get_data("user_id", ctx.author.id, "users") update_user = data_user if update_user['config']['playing']: return await ctx.send("<:alert:739251822920728708>│`Você está jogando, aguarde para quando" " vocÊ estiver livre!`") if update_user['config']['battle']: msg = '<:negate:721581573396496464>│`VOCE ESTÁ BATALHANDO!`' embed = discord.Embed(color=self.bot.color, description=msg) return await ctx.send(embed=embed) item_name = self.bot.items[item_key][1] if item_key in data_user['inventory']: if data_user['inventory'][item_key] >= 1: update_user['inventory'][item_key] -= 1 if update_user['inventory'][item_key] < 1: del update_user['inventory'][item_key] await self.bot.db.update_data(data_user, update_user, 'users') await ctx.send(f'<:confirmed:721581574461587496>│`PARABENS, VC USOU` {self.i[item_name][0]} `1`' f'**{self.i[item_name][1]}** `COM SUCESSO!`') _bonus = item_name else: return await ctx.send(f"<:alert:739251822920728708>│`VOCÊ NÃO TEM ESSA QUANTIDADE DISPONIVEL DE " f"{item_name.upper()}!`") else: return await ctx.send(f"<:alert:739251822920728708>│`Você não tem {item_name.upper()} no seu " f"inventario!`") _data = await self.bot.db.get_data("_id", ctx.author.id, "adfly") _update = _data if _update is not None: if _update['pending']: text = f'<:alert:739251822920728708>│Você ainda tem esse link pendente:\n{_update["adlink"][1]}' embed = discord.Embed(color=self.color, description=text) try: await ctx.author.send(embed=embed) if ctx.message.guild is not None: return await ctx.send('<:send:519896817320591385>│`ENVIADO PARA O SEU PRIVADO!`') except discord.errors.Forbidden: return await ctx.send(embed=embed) else: _code1, _code2 = generate_gift() code64b = base64.b64encode(str.encode(_code1)) link = self.bot.adlinks(code64b) _update['code'] = [_code1, _code2] _update['adlink'] = [link[0], link[1]] _update['bonus'] = _bonus _update['pending'] = True await self.bot.db.update_data(_data, _update, 'adfly') text = f'<:confirmed:721581574461587496>│Clique no link para pegar seu fragmento:\n{link[1]}' embed = discord.Embed(color=self.color, description=text) try: await ctx.author.send(embed=embed) if ctx.message.guild is not None: await ctx.send('<:send:519896817320591385>│`ENVIADO PARA O SEU PRIVADO!`') except discord.errors.Forbidden: await ctx.send(embed=embed) else: _code1, _code2 = generate_gift() code64b = base64.b64encode(str.encode(_code1)) link = self.bot.adlinks(code64b) await register_code(self.bot, ctx.author.id, _code1, _code2, link[0], link[1], _bonus) text = f'<:confirmed:721581574461587496>│Clique no link para pegar seu fragmento:\n{link[1]}' embed = discord.Embed(color=self.color, description=text) try: await ctx.author.send(embed=embed) if ctx.message.guild is not None: await ctx.send('<:send:519896817320591385>│`ENVIADO PARA O SEU PRIVADO!`') except discord.errors.Forbidden: await ctx.send(embed=embed)