mirror of
https://github.com/wlinator/luminara.git
synced 2024-10-02 18:03:12 +00:00
Stats rewrite
This commit is contained in:
parent
cd7a75c616
commit
eb87e658a1
2 changed files with 41 additions and 27 deletions
|
@ -31,9 +31,13 @@
|
|||
"duel_results": "{1} wins **{2}{3}**\n{4} loses this bet.",
|
||||
"duel_cancel": "**{0}** canceled the duel.",
|
||||
"duel_time": "Time ran out.",
|
||||
"stats_all_title": "All Racu Stats",
|
||||
"stats_all_blackjack": "BlackJack Stats",
|
||||
"stats_all_gambling_value": "**{0}** - # of games\n**{1}** - wins (#)\n**{2}** - losses (#)\n**{3}%** - ROI ($)",
|
||||
"stats_all_gambling_value2": "Racu has logged **{0}** games.\n**{1}** of those were won by players!\nThe dealer beat you in **{2}** games.\nReturn of investment: **{3}%**",
|
||||
"stats_all_gambling_value3": "Games played: **{0}**\nGames won: **{1}**\nGames lost: **{2}**\nTotal bets/payouts: `${3}` / `${4}`\nProfit margin: **{5}**%"
|
||||
"stats_all_title": "Total Racu Stats - {0}",
|
||||
"stats_all_footer": "Want to see your own stats? Do '/stats me'.",
|
||||
"stats_games": "Games played: {0}",
|
||||
"stats_games_valuet": "Games played: **{0}**\nGames won: **{1}**\nGames lost: **{2}**",
|
||||
"stats_games_value": "`{0}` wins & `{1}` losses.",
|
||||
"stats_cashflow": "Cashflow",
|
||||
"stats_cashflow_value": "Total bets/payouts: `${0}` / `${1}`",
|
||||
"stats_roi": "Return of investment",
|
||||
"stats_roi_value": "Profit margin: **{0}**%"
|
||||
}
|
|
@ -31,31 +31,41 @@ class Stats(commands.Cog):
|
|||
)
|
||||
# @commands.check(universal.channel_check)
|
||||
@commands.check(universal.beta_check)
|
||||
async def all(self, ctx):
|
||||
# collect data
|
||||
bj_games_amount = BlackJackStats.count_games()
|
||||
(bj_winning_games_amount, bj_losing_games_amount) = BlackJackStats.get_winning_and_losing_amount()
|
||||
(bj_total_investment, bj_total_payout) = BlackJackStats.get_investment_and_payout()
|
||||
async def all(self, ctx, type: discord.Option(choices=["BlackJack"])):
|
||||
if type == "BlackJack":
|
||||
# collect data
|
||||
bj_games_amount = BlackJackStats.count_games()
|
||||
(bj_winning_games_amount, bj_losing_games_amount) = BlackJackStats.get_winning_and_losing_amount()
|
||||
(bj_total_investment, bj_total_payout) = BlackJackStats.get_investment_and_payout()
|
||||
|
||||
# calculate data
|
||||
roi = ((bj_total_payout - bj_total_investment) / bj_total_investment) * 100
|
||||
roi = round(roi, 3)
|
||||
# calculate data
|
||||
roi = ((bj_total_payout - bj_total_investment) / bj_total_investment) * 100
|
||||
roi = round(roi, 3)
|
||||
|
||||
# output
|
||||
embed = discord.Embed(
|
||||
title=strings["stats_all_title"]
|
||||
)
|
||||
embed.add_field(name=strings["stats_all_blackjack"],
|
||||
value=strings["stats_all_gambling_value3"].format(
|
||||
bj_games_amount,
|
||||
bj_winning_games_amount,
|
||||
bj_losing_games_amount,
|
||||
round(bj_total_investment),
|
||||
round(bj_total_payout),
|
||||
roi
|
||||
))
|
||||
# output
|
||||
embed = discord.Embed(
|
||||
title=strings["stats_all_title"].format("BlackJack")
|
||||
)
|
||||
embed.add_field(inline=False,
|
||||
name=strings["stats_games"].format(bj_games_amount),
|
||||
value=strings["stats_games_value"].format(
|
||||
bj_winning_games_amount,
|
||||
bj_losing_games_amount
|
||||
))
|
||||
embed.add_field(inline=False,
|
||||
name=strings["stats_cashflow"],
|
||||
value=strings["stats_cashflow_value"].format(
|
||||
round(bj_total_investment),
|
||||
round(bj_total_payout)
|
||||
))
|
||||
embed.add_field(inline=False,
|
||||
name=strings["stats_roi"],
|
||||
value=strings["stats_roi_value"].format(
|
||||
roi
|
||||
))
|
||||
embed.set_footer(text=strings["stats_all_footer"])
|
||||
|
||||
await ctx.respond(embed=embed)
|
||||
await ctx.respond(embed=embed)
|
||||
|
||||
@stats.command(
|
||||
name="me",
|
||||
|
|
Loading…
Reference in a new issue