diff --git a/Bot/Games/SlotMachine.fs b/Bot/Games/SlotMachine.fs index 4cf50e7..4402cde 100644 --- a/Bot/Games/SlotMachine.fs +++ b/Bot/Games/SlotMachine.fs @@ -93,11 +93,10 @@ let printOddsTable symbols (prizeTable : PrizeEntry array) = let s1 , s2, s3, _ = prizeTable.[elem] acc + $"{name s1} | {name s2} | {name s3} --- {getOddsForPrize symbols prizeTable elem}\n") "") + "-----------------------------\n" - + $"Odds of winning something:{getTotalWaysOfWinning prizeTable} out of {getTotalCombinations symbols}" + + $"Odds of winning something: {getTotalWaysOfWinning prizeTable} out of {getTotalCombinations symbols}" //printOddsTable symbols prizeTable - let getReel fn = List.fold (fun acc elem -> (List.replicate (fn elem) elem) @ acc) [] symbols |> List.toArray let reel1 = getReel (fun s -> s.reel1Count) let reel2 = getReel (fun s -> s.reel2Count) @@ -168,7 +167,7 @@ let resetJackpot amount = GuildEnvironment.connectionString |> Sql.connect |> Sql.parameters [ ( "amount" , Sql.int (int amount) ) ] - |> Sql.query "UPDATE item SET stock = amount WHERE symbol = 'JACKPOT'" + |> Sql.query "UPDATE item SET stock = @amount WHERE symbol = 'JACKPOT'" |> Sql.executeNonQueryAsync |> Async.AwaitTask @@ -274,7 +273,6 @@ let spin multiplier (ctx : IDiscordContext) = do! DbService.updatePlayerCurrency prizeWithMultiplier player |> Async.Ignore embed.Color <- DiscordColor.Green embed.Description <- $"You WIN `💰` **{prizeWithMultiplier}** GBT 🎉" -// embed.AddField("Result", $"{slotsContent}", true) |> ignore embed.AddField("Bet", $"{playAmount}", true) |> ignore embed.AddField("Prize", $"{prizeWithMultiplier}") |> ignore addGBTField embed prizeWithMultiplier @@ -283,7 +281,6 @@ let spin multiplier (ctx : IDiscordContext) = let! jackpot = getJackpotAmount () 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 addGBTField embed jackpot @@ -292,11 +289,9 @@ let spin multiplier (ctx : IDiscordContext) = return "JACKPOT" , jackpot | None -> do! incrementJackpot playAmount |> Async.Ignore - embed.Description <- $"You LOST `💰` **{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 -// embed.AddField("Result", $"{slotsContent}", true) |> ignore addGBTField embed -playAmount return "LOST" , 0 } @@ -304,6 +299,18 @@ let spin multiplier (ctx : IDiscordContext) = 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 + + let hopMsg = DiscordMessageBuilder() + hopMsg.Content <- + let s1 = $"{slotsContent} | {player.Name}" + match result with + | "WON" -> s1 + $" **WON** {prizeAmount} $GBT playing slots!" + | "LOST" -> s1 + $" **LOST** playing slots" + | "JACKPOT" -> s1 + $" 🎉🎉🎉 **JUST HIT THE JACKPOT** and **WON**!!! 🎉🎉🎉" + | _ -> "" + let channel = ctx.GetGuild().GetChannel(GuildEnvironment.channelEventsHackerBattle) + do! channel.SendMessageAsync(hopMsg) |> Async.AwaitTask |> Async.Ignore + do! Analytics.slotPlayed (ctx.GetDiscordMember()) playAmount result prizeAmount } PlayerInteractions.executePlayerAction ctx (fun player -> async {