diff --git a/Bot/Games/SlotMachine.fs b/Bot/Games/SlotMachine.fs index 92cdd8b..cbd37a1 100644 --- a/Bot/Games/SlotMachine.fs +++ b/Bot/Games/SlotMachine.fs @@ -20,8 +20,8 @@ let BigBrother = { index = 0 ; reel1Count = 1 ; reel2Count = 1 ; reel3Count = 1 let Eye = { index = 1 ; reel1Count = 3 ; reel2Count = 2 ; reel3Count = 1 } let Obey = { index = 2 ; reel1Count = 2 ; reel2Count = 2 ; reel3Count = 2 } let AnonMask = { index = 3 ; reel1Count = 1 ; reel2Count = 5 ; reel3Count = 8 } -let Sushi = { index = 4 ; reel1Count = 7 ; reel2Count = 3 ; reel3Count = 3 } let Ramen = { index = 5 ; reel1Count = 5 ; reel2Count = 5 ; reel3Count = 4 } +let Sushi = { index = 4 ; reel1Count = 7 ; reel2Count = 3 ; reel3Count = 3 } let Pizza = { index = 6 ; reel1Count = 2 ; reel2Count = 6 ; reel3Count = 0 } let Alcohol = { index = 7 ; reel1Count = 1 ; reel2Count = 1 ; reel3Count = 1 } //let Circuit = { index = 0 ; reel1Count = 0 ; reel2Count = 0 ; reel3Count = 4 } @@ -38,6 +38,26 @@ let reel1 = getReel (fun s -> s.reel1Count) let reel2 = getReel (fun s -> s.reel2Count) let reel3 = getReel (fun s -> s.reel3Count) +type Prize = + | Money of int + | Jackpot + +type Slot = + | Symbol of SlotSymbol + | Any + +let prizeTable = + [ Symbol BigBrother , Symbol BigBrother , Symbol BigBrother , Jackpot + Symbol Eye , Symbol Eye , Symbol Eye , Money 1000 + Symbol Eye , Symbol Eye , Symbol Obey , Money 1000 + 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 Sushi , Symbol Sushi , Any , Money 10 + Symbol Pizza , Any , Any , Money 5 ] + + let slots = [| "https://s7.gifyu.com/images/aneye.png" "https://s7.gifyu.com/images/anonmask.png" @@ -141,6 +161,7 @@ let spinEmojis (results : int array) (ctx : IDiscordContext) = do! Async.Sleep sleepTime let content = $"{Formatter.Emoji(emojis.[results.[0]])}{Formatter.Emoji(emojis.[results.[1]])}{Formatter.Emoji(emojis.[results.[2]])}" let! _ = itx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().WithContent(content)) |> Async.AwaitTask + return () } @@ -170,10 +191,18 @@ let spinFiles (results : int array) (ctx : IDiscordContext) = let spin spinType (ctx : IDiscordContext) = PlayerInteractions.executePlayerAction ctx (fun player -> async { - let random = Random(System.Guid.NewGuid().GetHashCode()) + let random = Random(Guid.NewGuid().GetHashCode()) let symbols = [| reel1.[random.Next(0, reel1.Length)] ; reel2.[random.Next(0, reel2.Length)] ; reel3.[random.Next(0, reel3.Length)] |] - let winConditions = (symbols.[0] = symbols.[1] && symbols.[0] = symbols.[2]) + let winConditions = symbols.[0] = symbols.[1] && symbols.[0] = symbols.[2] + let prize = + prizeTable + |> List.pick (fun (s1,s2,s3,prize) -> + match s1 , s2 , s3 with + | Symbol s1' , Symbol s2' , Symbol s3' when s1'.index = symbols.[0] && s2'.index = symbols.[1] && s3'.index = symbols.[2] -> Some prize + | Symbol s1' , Symbol s2' , Any when s1'.index = symbols.[0] && s2'.index = symbols.[1] -> Some prize + | Symbol s1' , Any , Any when s1'.index = symbols.[0] -> Some prize + | _ -> None) if winConditions then do! DbService.updatePlayerCurrency twoOfAKindPrize player |> Async.Ignore @@ -206,7 +235,7 @@ let handleSpin (_ : DiscordClient) (event : ComponentInteractionCreateEventArgs) match event.Id with | "spin-embeds" -> do! spin "Embeds" ctx | "spin-emojis" -> do! spin "Emojis" ctx - | "spin-files" -> do! spin "Files" ctx + | "spin-files" -> do! spin "Files" ctx | _ -> printfn "Wrong Spin ID" return () @@ -226,7 +255,7 @@ let sendInitialEmbed (ctx : IDiscordContext) = let button1 = DiscordButtonComponent(ButtonStyle.Success, $"spin-embeds", $"Spin Embeds 1 $GBT") :> DiscordComponent let button2 = DiscordButtonComponent(ButtonStyle.Success, $"spin-emojis", $"Spin Emojis 5 $GBT") :> DiscordComponent - let button3 = DiscordButtonComponent(ButtonStyle.Success, $"spin-files", $"Spin Files 10 $GBT") :> DiscordComponent + let button3 = DiscordButtonComponent(ButtonStyle.Success, $"spin-files", $"Spin Files 10 $GBT") :> DiscordComponent builder.AddComponents [| button1 ; button2 ; button3 |] |> ignore do! GuildEnvironment.botClientSlots.Value.SendMessageAsync(channel, builder) |> Async.AwaitTask