async def bounty_remove(self, ctx, *, name: str): bounties = Data.get("bounties", []) for i in range(len(bounties)): if bounties[i]["name"].lower() == name.lower(): bounties.remove(bounties[i]) await ctx.send("Successfully cleared Bounty") Data.save() return await ctx.send("No Bounty with that name found")
def give_resource(_id, name, amount=1): inv = get_inventory(_id) inv.setdefault(name, 0) inv[name] += amount if inv[name] < 0: inv[name] -= amount return False if inv[name] == 0: inv.pop(name) Data.save() return True
async def bounty_create(self, ctx, name: str, reward: int, *, description: str = "-"): """ >bounty create Vibe 10 Have a good day or smthn idk >bounty create "Destroy Monke" 20 Perform the ultimate sacrifice, destroy monke once and for all """ bounty = { "name": name, "reward": reward, "description": description } bounties = Data.get("bounties", []) bounties.append(bounty) Data.save() await ctx.send("Bounty Created!")
async def artillery(self, ctx, target: discord.Member = None, shots: int = 1): if not Data.get_attribute(ctx.author.id, "artillery", False): await ctx.send("Clearly, you don't own any artillery") return if not target: ammo = "Artillery-Ammo" await ctx.send(f"Your artillery is ready to fire, you have {Inventory.get_resource(ctx.author.id, ammo)} shots!")
async def ammo(self, ctx, amount: int = 1): price = Data.get("ammo-price", 100000000000000) if Money.get_balance(ctx.author.id) < price * amount and not is_oda(ctx): await ctx.send(f"You don't have enough earnings!\nYou need {price * amount}") return Money.change_balance(ctx.author.id, -price * amount) Inventory.give_resource(ctx.author.id, "Artillery-Ammo", amount) await ctx.send(f"Bought {amount} artillery ammo")
async def bounty(self, ctx): embed = discord.Embed(title="Current Bounties") bounties = Data.get("bounties", []) for bounty in bounties: embed.add_field(name="%s: %s %s" % (bounty["name"], str(bounty["reward"]), "odacoins"), value=bounty[ "description"], inline=False) if len(bounties) == 0: embed.description = "No Bounties!" await ctx.send(embed=embed)
async def status_remove(self, ctx, condition: str, *, target: discord.Member): status: list = Data.get_attribute(target.id, "status", []) status.remove(condition) Data.set_attribute(target.id,"status",status) await ctx.send("De-Application successful")
async def status_apply(self, ctx, condition: str, *, target: discord.Member): status = Data.get_attribute(target.id, "status", []) status.append(condition) Data.set_attribute(target.id, "status", status) await ctx.send("Application successful")
async def status(self, ctx, target: discord.Member): status = Data.get_attribute(target.id, "status", []) await ctx.send(status)
def get(_id): return Data.get_attribute(_id, "inventory", [])