Skip to content

Commit

Permalink
feat(Piglin): Add loot table choice
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Aug 27, 2023
1 parent 2fe1be5 commit 135ff4c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/zibot/exts/fun/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ async def dadjokes(self, ctx):
example=("rps rock",),
),
)
@app_commands.rename(choice_="choice")
@commands.cooldown(1, 5, commands.BucketType.user)
async def rps(self, ctx, choice_: str):
choice_ = choice_.lower()
Expand Down Expand Up @@ -397,17 +398,18 @@ async def clap(self, ctx, *, text: str = ""):
@cmds.command(
name=_("barter"),
description=_("barter-desc"),
help="\n**Note**: The loot table is based on JE 1.16.1 (before nerf)",
aliases=("piglin",),
hybrid=True,
usage="[amount of gold]",
usage="[amount of gold] [loot table]",
extras=dict(
example=("barter 64", "piglin", "barter 262"),
example=("barter 64", "piglin", "barter 262", "barter 64 nerfed"),
),
)
@app_commands.rename(gold=_("barter-gold"))
@app_commands.rename(lootTable=_("barter-loot-table"))
@commands.cooldown(5, 25, type=commands.BucketType.user)
async def barter(self, ctx, gold: ClampedRange[int, 1, 2240] = 64):
trade = Piglin(gold)
async def barter(self, ctx, gold: ClampedRange[int, 1, 2240] = 64, lootTable: str = "nerfed"):
trade = Piglin(gold, lootTable=1 if lootTable.lower() == "nerfed" else 0)

items = {}
for item in trade.items:
Expand Down Expand Up @@ -435,6 +437,10 @@ def emoji(name: str):
"obsidian": "<:obsidian3D:807536509837770762>",
"cry-obsidian": "<:cryobsidian3D:807536510152474644>",
"soul-sand": "<:soulsand3D:807536744253227049>",
"spectral-arrow": "<:spectralarrow:1145171838104768582>",
"blackstone": "<:blackstone:1145172970617180203>",
"netherite-hoe": "<:netheritehoe:1145173422591180951>",
"water-bottle": "<:waterbottle:1145173809276661900>",
}.get(name, "<:missingtexture:807536928361545729>")

e = ZEmbed(
Expand All @@ -446,3 +452,8 @@ def emoji(name: str):
colour=discord.Colour.gold(),
)
await ctx.try_reply(embed=e)

@barter.autocomplete("lootTable")
async def lootTableSuggestion(self, inter, choice):
rps = (("Before Nerf", "before"), ("After Nerfed", "nerfed"))
return [app_commands.Choice(name=i[0], value=i[1]) for i in rps]
2 changes: 2 additions & 0 deletions src/zibot/locale/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ barter-result-title = Bartering with { $goldCount ->
barter-result = You got:
{ $barterResult }
barter-gold = gold
barter-loot-table = loot-table
# --- Info
weather = weather
Expand Down
2 changes: 2 additions & 0 deletions src/zibot/locale/id.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ dadjokes-desc = Dapatkan candaan acak bapak-bapak
rps-desc = Main Baru Gunting Kertas dengan bot
flip-desc = Lempar Koin
barter-desc = Barter dengan Minecraft Piglin
barter-gold = emas
barter-loot-table = loot-table
# --- Info
weather = cuaca
Expand Down
4 changes: 4 additions & 0 deletions src/zibot/locale/ja.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ var = こんにちは、{ $name }!
anime = アニメ
manga = 漫画
# --- Fun
barter-gold =
barter-loot-table = ルートテーブル
# --- Info
stats = スタッツ
jisho = 辞書
Expand Down

0 comments on commit 135ff4c

Please sign in to comment.