Prize table

This commit is contained in:
Joseph Ferano 2022-04-12 14:10:56 +07:00
parent b20756b87a
commit 567a7c0199

View File

@ -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 Eye = { index = 1 ; reel1Count = 3 ; reel2Count = 2 ; reel3Count = 1 }
let Obey = { index = 2 ; reel1Count = 2 ; reel2Count = 2 ; reel3Count = 2 } let Obey = { index = 2 ; reel1Count = 2 ; reel2Count = 2 ; reel3Count = 2 }
let AnonMask = { index = 3 ; reel1Count = 1 ; reel2Count = 5 ; reel3Count = 8 } 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 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 Pizza = { index = 6 ; reel1Count = 2 ; reel2Count = 6 ; reel3Count = 0 }
let Alcohol = { index = 7 ; reel1Count = 1 ; reel2Count = 1 ; reel3Count = 1 } let Alcohol = { index = 7 ; reel1Count = 1 ; reel2Count = 1 ; reel3Count = 1 }
//let Circuit = { index = 0 ; reel1Count = 0 ; reel2Count = 0 ; reel3Count = 4 } //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 reel2 = getReel (fun s -> s.reel2Count)
let reel3 = getReel (fun s -> s.reel3Count) let reel3 = getReel (fun s -> s.reel3Count)
type Prize =
| Money of int<GBT>
| Jackpot
type Slot =
| Symbol of SlotSymbol
| Any
let prizeTable =
[ Symbol BigBrother , Symbol BigBrother , Symbol BigBrother , Jackpot
Symbol Eye , Symbol Eye , Symbol Eye , Money 1000<GBT>
Symbol Eye , Symbol Eye , Symbol Obey , Money 1000<GBT>
Symbol AnonMask , Symbol AnonMask , Symbol AnonMask , Money 250<GBT>
Symbol AnonMask , Symbol AnonMask , Symbol Eye , Money 250<GBT>
Symbol Ramen , Symbol Ramen , Symbol Ramen , Money 100<GBT>
Symbol Ramen , Symbol Ramen , Symbol Eye , Money 100<GBT>
Symbol Sushi , Symbol Sushi , Any , Money 10<GBT>
Symbol Pizza , Any , Any , Money 5<GBT> ]
let slots = let slots =
[| "https://s7.gifyu.com/images/aneye.png" [| "https://s7.gifyu.com/images/aneye.png"
"https://s7.gifyu.com/images/anonmask.png" "https://s7.gifyu.com/images/anonmask.png"
@ -141,6 +161,7 @@ let spinEmojis (results : int array) (ctx : IDiscordContext) =
do! Async.Sleep sleepTime do! Async.Sleep sleepTime
let content = $"{Formatter.Emoji(emojis.[results.[0]])}{Formatter.Emoji(emojis.[results.[1]])}{Formatter.Emoji(emojis.[results.[2]])}" 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 let! _ = itx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder().WithContent(content)) |> Async.AwaitTask
return () return ()
} }
@ -170,10 +191,18 @@ let spinFiles (results : int array) (ctx : IDiscordContext) =
let spin spinType (ctx : IDiscordContext) = let spin spinType (ctx : IDiscordContext) =
PlayerInteractions.executePlayerAction ctx (fun player -> async { 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 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 if winConditions
then do! DbService.updatePlayerCurrency twoOfAKindPrize player |> Async.Ignore then do! DbService.updatePlayerCurrency twoOfAKindPrize player |> Async.Ignore