From b91bf0a0d291c4b982376b5d86e23021e1759e14 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Wed, 20 Apr 2022 16:29:37 +0700 Subject: [PATCH] Add more prize tables, move prize tables to initial embed --- Bot/Games/SlotMachine.fs | 76 +++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 24 deletions(-) diff --git a/Bot/Games/SlotMachine.fs b/Bot/Games/SlotMachine.fs index c1de4d5..59627c6 100644 --- a/Bot/Games/SlotMachine.fs +++ b/Bot/Games/SlotMachine.fs @@ -46,11 +46,13 @@ type Slot = let prizeTable = [| Symbol BigBrother , Symbol BigBrother , Symbol BigBrother , Jackpot Symbol Eye , Symbol Eye , Symbol Eye , Money 500 - Symbol Eye , Symbol Eye , Symbol Obey , Money 500 Symbol AnonMask , Symbol AnonMask , Symbol AnonMask , Money 250 - Symbol AnonMask , Symbol AnonMask , Symbol Eye , Money 250 - Symbol Ramen , Symbol Ramen , Symbol Ramen , Money 100 - Symbol Ramen , Symbol Ramen , Symbol Eye , Money 100 + Symbol Obey , Symbol Obey , Symbol Obey , Money 200 + Symbol Ramen , Symbol Ramen , Symbol Ramen , Money 150 + Symbol Alcohol , Symbol Alcohol , Symbol Alcohol , Money 100 + Symbol OldTv , Symbol OldTv , Symbol OldTv , Money 100 + Symbol Pills , Symbol Pills , Symbol Pills , Money 100 + Symbol Rat , Symbol Rat , Symbol Rat , Money 100 Symbol Sushi , Symbol Sushi , Any , Money 50 Symbol Pizza , Any , Any , Money 20 |] @@ -73,10 +75,10 @@ let getOddsForPrize prizeIndex = let total = getTotalCombinations () $"{odds} in {total }" -//getOddsForPrize 0 -//getOddsForPrize 1 -//getOddsForPrize 5 -//getOddsForPrize 8 +// getOddsForPrize 0 +// getOddsForPrize 1 +// getOddsForPrize 5 +// getOddsForPrize 10 let getTotalWaysOfWinning () = [0..prizeTable.Length - 1] @@ -184,7 +186,7 @@ let handlePrizeTable (ctx : IDiscordContext) = let! jackpot = getJackpotAmount () let rows = Array.fold folder "" prizeTable embed.Color <- DiscordColor.Green - embed.Title <- "Degenz Slots Prize Table" + embed.Title <- $"CURRENT JACKPOT: **{jackpot}** `💰` $GBT" embed.Description <- $"Current Jackpot At: **{jackpot}** $GBT\n\n**Combo** ⠀⠀⠀⠀⠀⠀⠀ **Prize**\n{rows}" do! ctx.FollowUp(DiscordFollowupMessageBuilder().AsEphemeral().AddEmbed(embed)) do! Analytics.prizeTableViewed (ctx.GetDiscordMember()) @@ -257,7 +259,7 @@ let spin multiplier (ctx : IDiscordContext) = let prizeWithMultiplier = amount * multiplier do! DbService.updatePlayerCurrency prizeWithMultiplier player |> Async.Ignore embed.Color <- DiscordColor.Green - embed.Description <- $"You win! You got **{prizeWithMultiplier}** GBT 🎉" + embed.Description <- $"You WIN `💰` **{prizeWithMultiplier}** GBT 🎉" // embed.AddField("Result", $"{slotsContent}", true) |> ignore embed.AddField("Bet", $"{playAmount}", true) |> ignore embed.AddField("Prize", $"{prizeWithMultiplier}") |> ignore @@ -265,8 +267,8 @@ let spin multiplier (ctx : IDiscordContext) = return "WON" , prizeWithMultiplier | Some (Jackpot) -> let! jackpot = getJackpotAmount () - embed.Color <- DiscordColor.Purple - embed.Description <- $"YOU HIT THE JACKPOT!!!" + embed.Color <- DiscordColor.Green + embed.Description <- $"🎉🎉 YOU HIT THE JACKPOT 🎉🎉" // embed.AddField("Result", $"{slotsContent}", true) |> ignore embed.AddField("Bet", $"{playAmount}", true) |> ignore embed.AddField("Prize", $"{jackpot}") |> ignore @@ -276,7 +278,7 @@ let spin multiplier (ctx : IDiscordContext) = return "JACKPOT" , jackpot | None -> do! incrementJackpot playAmount |> Async.Ignore - embed.Description <- $"Better luck next time! You paid {playAmount} $GBT" + embed.Description <- $"You LOST `💰` **{playAmount}** $GBT `😭`" embed.Color <- DiscordColor.Red embed.AddField("Bet", $"{playAmount}", true) |> ignore // embed.AddField("New JACKPOT", $"`💰` {jackpot} `$GBT`", true) |> ignore @@ -285,11 +287,8 @@ let spin multiplier (ctx : IDiscordContext) = return "LOST" , 0 } let dwb = DiscordWebhookBuilder() - let betText mult = if mult = multiplier then "Spin Again" else "Bet" - let button1 = DiscordButtonComponent(ButtonStyle.Success, $"spin-1x", $"{betText 1} {PlayPricex1} $GBT 🎰") :> DiscordComponent - let button2 = DiscordButtonComponent(ButtonStyle.Success, $"spin-2x", $"{betText 2} {PlayPricex2} $GBT 🎰") :> DiscordComponent - let button3 = DiscordButtonComponent(ButtonStyle.Success, $"spin-3x", $"{betText 3} {PlayPricex3} $GBT 🎰") :> DiscordComponent - dwb.AddComponents([| button1 ; button2 ; button3 |]).AddEmbed(embed).WithContent(slotsContent) |> ignore + let button = DiscordButtonComponent(ButtonStyle.Success, $"spin-{multiplier}x", $"🎰 Spin Again") :> DiscordComponent + dwb.AddComponents([| button |]).AddEmbed(embed).WithContent(slotsContent) |> ignore do! itx.EditFollowupMessageAsync(followUpMessage.Id, dwb) |> Async.AwaitTask |> Async.Ignore do! Analytics.slotPlayed (ctx.GetDiscordMember()) playAmount result prizeAmount } @@ -335,16 +334,45 @@ let sendInitialEmbed (ctx : IDiscordContext) = let builder = DiscordMessageBuilder() let embed = DiscordEmbedBuilder() embed.Title <- "Degenz Slot Machine" - embed.Description <- "Want to try your luck?" embed.ImageUrl <- "https://s7.gifyu.com/images/ezgif.com-gif-maker-268ecb6e4d28bd55a0.gif" + match guildEmojis , anyEmoji with + | Some emojis , Some any -> + let folder (i,acc,b) elem = + let s1,s2,s3,prize = elem + let prizeTxt = match prize with Money m -> $"**{m}** $GBT" | Jackpot -> $"**JACKPOT**" + let line = + match s1 , s2 , s3 with + | Symbol s1' , Symbol s2' , Symbol s3' -> + $"{Formatter.Emoji(emojis.[s1'.emojiName])}{Formatter.Emoji(emojis.[s2'.emojiName])}{Formatter.Emoji(emojis.[s3'.emojiName])}" + | Symbol s1' , Symbol s2' , Any -> + $"{Formatter.Emoji(emojis.[s1'.emojiName])}{Formatter.Emoji(emojis.[s2'.emojiName])}{Formatter.Emoji(any)}" + | Symbol s1' , Any , Any -> + $"{Formatter.Emoji(emojis.[s1'.emojiName])}{Formatter.Emoji(any)}{Formatter.Emoji(any)}" + | _ -> "" + let text = + if prizeTxt.Contains("100") then + acc + else + $"{acc}\n{line} | {prizeTxt}" + (i + 1) , text , ( b || prizeTxt.Contains("100") ) + let! jackpot = getJackpotAmount () + let _ , rows , _ = Array.fold folder (0, "", false) prizeTable + embed.Color <- DiscordColor.Green +// embed.Title <- "Degenz Slots Prize Table" +// embed.Description <- $"Current Jackpot At: **{jackpot}** $GBT\n\n" + embed.Title <- $"CURRENT JACKPOT: `{jackpot} 💰 $GBT`" + embed.Description <- embed.Description + $"\n\n**PRIZE TABLE **\n{rows}\n\n**ANY 3** | **100** $GBT" + | _ , _ -> return () + builder.AddEmbed(embed) |> ignore - let button1 = DiscordButtonComponent(ButtonStyle.Success, $"spin-1x", $"Bet 1x - {PlayPricex1} $GBT 🎰") :> DiscordComponent - let button2 = DiscordButtonComponent(ButtonStyle.Success, $"spin-2x", $"Bet 2x - {PlayPricex2} $GBT 🎰") :> DiscordComponent - let button3 = DiscordButtonComponent(ButtonStyle.Success, $"spin-3x", $"Bet 3x - {PlayPricex3} $GBT 🎰") :> DiscordComponent - let button4 = DiscordButtonComponent(ButtonStyle.Primary, $"prizes", $"Show Prizes") :> DiscordComponent - builder.AddComponents([| button1 ; button2 ; button3 ; button4 |]) |> ignore + let button1 = DiscordButtonComponent(ButtonStyle.Success, $"spin-1x", $"🎰 Bet {PlayPricex1} $GBT") :> DiscordComponent + let button2 = DiscordButtonComponent(ButtonStyle.Success, $"spin-2x", $"🎰 Bet {PlayPricex2} $GBT") :> DiscordComponent + let button3 = DiscordButtonComponent(ButtonStyle.Success, $"spin-3x", $"🎰 Bet {PlayPricex3} $GBT") :> DiscordComponent +// let button4 = DiscordButtonComponent(ButtonStyle.Primary, $"prizes", $"Prize Table") :> DiscordComponent +// builder.AddComponents([| button1 ; button2 ; button3 ; button4 |]) |> ignore + builder.AddComponents([| button1 ; button2 ; button3 |]) |> ignore do! GuildEnvironment.botClientSlots.Value.SendMessageAsync(channel, builder) |> Async.AwaitTask |> Async.Ignore