Fix bug to get HoP message working
This commit is contained in:
parent
1d9dddfec0
commit
b78fce3cad
@ -97,7 +97,6 @@ let printOddsTable symbols (prizeTable : PrizeEntry array) =
|
|||||||
|
|
||||||
//printOddsTable symbols prizeTable
|
//printOddsTable symbols prizeTable
|
||||||
|
|
||||||
|
|
||||||
let getReel fn = List.fold (fun acc elem -> (List.replicate (fn elem) elem) @ acc) [] symbols |> List.toArray
|
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 reel1 = getReel (fun s -> s.reel1Count)
|
||||||
let reel2 = getReel (fun s -> s.reel2Count)
|
let reel2 = getReel (fun s -> s.reel2Count)
|
||||||
@ -168,7 +167,7 @@ let resetJackpot amount =
|
|||||||
GuildEnvironment.connectionString
|
GuildEnvironment.connectionString
|
||||||
|> Sql.connect
|
|> Sql.connect
|
||||||
|> Sql.parameters [ ( "amount" , Sql.int (int amount) ) ]
|
|> 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
|
|> Sql.executeNonQueryAsync
|
||||||
|> Async.AwaitTask
|
|> Async.AwaitTask
|
||||||
|
|
||||||
@ -274,7 +273,6 @@ let spin multiplier (ctx : IDiscordContext) =
|
|||||||
do! DbService.updatePlayerCurrency prizeWithMultiplier player |> Async.Ignore
|
do! DbService.updatePlayerCurrency prizeWithMultiplier player |> Async.Ignore
|
||||||
embed.Color <- DiscordColor.Green
|
embed.Color <- DiscordColor.Green
|
||||||
embed.Description <- $"You WIN `💰` **{prizeWithMultiplier}** GBT 🎉"
|
embed.Description <- $"You WIN `💰` **{prizeWithMultiplier}** GBT 🎉"
|
||||||
// embed.AddField("Result", $"{slotsContent}", true) |> ignore
|
|
||||||
embed.AddField("Bet", $"{playAmount}", true) |> ignore
|
embed.AddField("Bet", $"{playAmount}", true) |> ignore
|
||||||
embed.AddField("Prize", $"{prizeWithMultiplier}") |> ignore
|
embed.AddField("Prize", $"{prizeWithMultiplier}") |> ignore
|
||||||
addGBTField embed prizeWithMultiplier
|
addGBTField embed prizeWithMultiplier
|
||||||
@ -283,7 +281,6 @@ let spin multiplier (ctx : IDiscordContext) =
|
|||||||
let! jackpot = getJackpotAmount ()
|
let! jackpot = getJackpotAmount ()
|
||||||
embed.Color <- DiscordColor.Green
|
embed.Color <- DiscordColor.Green
|
||||||
embed.Description <- $"🎉🎉 YOU HIT THE JACKPOT 🎉🎉"
|
embed.Description <- $"🎉🎉 YOU HIT THE JACKPOT 🎉🎉"
|
||||||
// embed.AddField("Result", $"{slotsContent}", true) |> ignore
|
|
||||||
embed.AddField("Bet", $"{playAmount}", true) |> ignore
|
embed.AddField("Bet", $"{playAmount}", true) |> ignore
|
||||||
embed.AddField("Prize", $"{jackpot}") |> ignore
|
embed.AddField("Prize", $"{jackpot}") |> ignore
|
||||||
addGBTField embed jackpot
|
addGBTField embed jackpot
|
||||||
@ -292,11 +289,9 @@ let spin multiplier (ctx : IDiscordContext) =
|
|||||||
return "JACKPOT" , jackpot
|
return "JACKPOT" , jackpot
|
||||||
| None ->
|
| None ->
|
||||||
do! incrementJackpot playAmount |> Async.Ignore
|
do! incrementJackpot playAmount |> Async.Ignore
|
||||||
embed.Description <- $"You LOST `💰` **{playAmount}** $GBT `😭`"
|
embed.Description <- $"You LOST `💰` **{playAmount}** $GBT 😭"
|
||||||
embed.Color <- DiscordColor.Red
|
embed.Color <- DiscordColor.Red
|
||||||
embed.AddField("Bet", $"{playAmount}", true) |> ignore
|
embed.AddField("Bet", $"{playAmount}", true) |> ignore
|
||||||
// embed.AddField("New JACKPOT", $"`💰` {jackpot} `$GBT`", true) |> ignore
|
|
||||||
// embed.AddField("Result", $"{slotsContent}", true) |> ignore
|
|
||||||
addGBTField embed -playAmount
|
addGBTField embed -playAmount
|
||||||
return "LOST" , 0<GBT>
|
return "LOST" , 0<GBT>
|
||||||
}
|
}
|
||||||
@ -304,6 +299,18 @@ let spin multiplier (ctx : IDiscordContext) =
|
|||||||
let button = DiscordButtonComponent(ButtonStyle.Success, $"spin-{multiplier}x", $"🎰 Spin Again") :> DiscordComponent
|
let button = DiscordButtonComponent(ButtonStyle.Success, $"spin-{multiplier}x", $"🎰 Spin Again") :> DiscordComponent
|
||||||
dwb.AddComponents([| button |]).AddEmbed(embed).WithContent(slotsContent) |> ignore
|
dwb.AddComponents([| button |]).AddEmbed(embed).WithContent(slotsContent) |> ignore
|
||||||
do! itx.EditFollowupMessageAsync(followUpMessage.Id, dwb) |> Async.AwaitTask |> Async.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
|
do! Analytics.slotPlayed (ctx.GetDiscordMember()) playAmount result prizeAmount
|
||||||
}
|
}
|
||||||
PlayerInteractions.executePlayerAction ctx (fun player -> async {
|
PlayerInteractions.executePlayerAction ctx (fun player -> async {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user