Prize amounts

This commit is contained in:
Joseph Ferano 2022-04-15 13:54:19 +07:00
parent 7526d8bd7c
commit 86906c1b55
2 changed files with 26 additions and 26 deletions

View File

@ -93,8 +93,8 @@ let asdf (_ : DiscordClient) (event : DSharpPlus.EventArgs.InteractionCreateEven
:> Task :> Task
//hackerBattleBot.add_InteractionCreated(AsyncEventHandler(asdf)) //hackerBattleBot.add_InteractionCreated(AsyncEventHandler(asdf))
//slotsBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously slotsBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
//GuildEnvironment.botClientSlots <- Some slotsBot GuildEnvironment.botClientSlots <- Some slotsBot
hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
GuildEnvironment.botClientHacker <- Some hackerBattleBot GuildEnvironment.botClientHacker <- Some hackerBattleBot

View File

@ -48,14 +48,14 @@ type Slot =
let prizeTable = let prizeTable =
[ Symbol BigBrother , Symbol BigBrother , Symbol BigBrother , Jackpot [ Symbol BigBrother , Symbol BigBrother , Symbol BigBrother , Jackpot
Symbol Eye , Symbol Eye , Symbol Eye , Money 1000<GBT> Symbol Eye , Symbol Eye , Symbol Eye , Money 2000<GBT>
Symbol Eye , Symbol Eye , Symbol Obey , Money 1000<GBT> Symbol Eye , Symbol Eye , Symbol Obey , Money 2000<GBT>
Symbol AnonMask , Symbol AnonMask , Symbol AnonMask , Money 250<GBT> Symbol AnonMask , Symbol AnonMask , Symbol AnonMask , Money 500<GBT>
Symbol AnonMask , Symbol AnonMask , Symbol Eye , Money 250<GBT> Symbol AnonMask , Symbol AnonMask , Symbol Eye , Money 500<GBT>
Symbol Ramen , Symbol Ramen , Symbol Ramen , Money 100<GBT> Symbol Ramen , Symbol Ramen , Symbol Ramen , Money 250<GBT>
Symbol Ramen , Symbol Ramen , Symbol Eye , Money 100<GBT> Symbol Ramen , Symbol Ramen , Symbol Eye , Money 250<GBT>
Symbol Sushi , Symbol Sushi , Any , Money 10<GBT> Symbol Sushi , Symbol Sushi , Any , Money 100<GBT>
Symbol Pizza , Any , Any , Money 5<GBT> ] Symbol Pizza , Any , Any , Money 50<GBT> ]
let slots = let slots =
@ -111,7 +111,7 @@ let slotsImages =
let payTable = [| |] let payTable = [| |]
let PlayPrice = 10<GBT> let PlayPrice = 5<GBT>
let twoOfAKindPrize = 100<GBT> let twoOfAKindPrize = 100<GBT>
let threeOfAKindPrize = 1000<GBT> let threeOfAKindPrize = 1000<GBT>
let sleepTime = 1500 let sleepTime = 1500
@ -174,7 +174,7 @@ let spinFiles (results : int array) (ctx : IDiscordContext) =
builder.IsEphemeral <- true builder.IsEphemeral <- true
let! followUp = itx.CreateFollowupMessageAsync(builder) |> Async.AwaitTask let! followUp = itx.CreateFollowupMessageAsync(builder) |> Async.AwaitTask
do! Async.Sleep sleepTime // do! Async.Sleep sleepTime
// let ( name , stream ) = slotsImages.[results.[0]] // let ( name , stream ) = slotsImages.[results.[0]]
// let! _ = itx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder() // let! _ = itx.EditFollowupMessageAsync(followUp.Id, DiscordWebhookBuilder()
// .AddFile(name + "1.png", stream)) |> Async.AwaitTask // .AddFile(name + "1.png", stream)) |> Async.AwaitTask
@ -194,34 +194,33 @@ let spin spinType (ctx : IDiscordContext) =
let random = Random(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 prize = let prize =
prizeTable prizeTable
|> List.pick (fun (s1,s2,s3,prize) -> |> List.tryPick (fun (s1,s2,s3,prize) ->
match s1 , s2 , s3 with 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' , 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' , 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 | Symbol s1' , Any , Any when s1'.index = symbols.[0] -> Some prize
| _ -> None) | _ -> None)
if winConditions
then do! DbService.updatePlayerCurrency twoOfAKindPrize player |> Async.Ignore
else do! DbService.updatePlayerCurrency -PlayPrice player |> Async.Ignore
match spinType with match spinType with
| "Embeds" -> do! spinEmbeds symbols ctx | "Embeds" -> do! spinEmbeds symbols ctx
| "Emojis" -> do! spinEmojis symbols ctx | "Emojis" -> do! spinEmojis symbols ctx
| "Files" -> do! spinFiles symbols ctx | "Files" -> do! spinFiles symbols ctx
| _ -> () | _ -> ()
do! Async.Sleep sleepTime
let builder = DiscordFollowupMessageBuilder() let builder = DiscordFollowupMessageBuilder()
builder.IsEphemeral <- true builder.IsEphemeral <- true
let embed4 = DiscordEmbedBuilder() let embed4 = DiscordEmbedBuilder()
embed4.Title <- "Slot Machine" embed4.Title <- "Slot Machine"
if winConditions then match prize with
embed4.Description <- $"You win {threeOfAKindPrize} GBT!" | Some (Money amount) ->
else do! DbService.updatePlayerCurrency twoOfAKindPrize player |> Async.Ignore
embed4.Description <- $"You win {amount} GBT!"
| Some (Jackpot) ->
embed4.Description <- $"YOU HIT THE JACKPOT!!!"
| None ->
do! DbService.updatePlayerCurrency -PlayPrice player |> Async.Ignore
builder.Content <- "Better luck next time! You paid 1 $GBT" builder.Content <- "Better luck next time! You paid 1 $GBT"
builder.AddEmbed(embed4) |> ignore builder.AddEmbed(embed4) |> ignore
do! ctx.FollowUp(builder) |> Async.AwaitTask |> Async.Ignore do! ctx.FollowUp(builder) |> Async.AwaitTask |> Async.Ignore
@ -253,10 +252,11 @@ let sendInitialEmbed (ctx : IDiscordContext) =
builder.AddEmbed(embed) |> ignore builder.AddEmbed(embed) |> ignore
let button1 = DiscordButtonComponent(ButtonStyle.Success, $"spin-embeds", $"Spin Embeds 1 $GBT") :> DiscordComponent let button1 = DiscordButtonComponent(ButtonStyle.Success, $"spin-embeds", $"Spin Embeds {PlayPrice} $GBT") :> DiscordComponent
let button2 = DiscordButtonComponent(ButtonStyle.Success, $"spin-emojis", $"Spin Emojis 5 $GBT") :> DiscordComponent let button2 = DiscordButtonComponent(ButtonStyle.Success, $"spin-emojis", $"Spin Emojis {PlayPrice} $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 // builder.AddComponents [| button1 ; button2 ; button3 |] |> ignore
builder.AddComponents [| button1 ; button2 |] |> ignore
do! GuildEnvironment.botClientSlots.Value.SendMessageAsync(channel, builder) do! GuildEnvironment.botClientSlots.Value.SendMessageAsync(channel, builder)
|> Async.AwaitTask |> Async.AwaitTask
|> Async.Ignore |> Async.Ignore