Change currency to int

This commit is contained in:
Joseph Ferano 2022-01-21 14:56:01 +07:00
parent 9af3f7ef9d
commit 41cf24c774
4 changed files with 9 additions and 7 deletions

View File

@ -118,11 +118,12 @@ let handleAttack (event : ComponentInteractionCreateEventArgs) =
|> Array.contains Weak
match wasSuccessfulHack with
| false ->
let prize = 1.337f // LEET
// let prize = 1.337f // LEET
let prize = 13
let attack = { HackType = enum<Hack>(int weapon) ; Timestamp = DateTime.UtcNow ; Target = { Id = targetId ; Name = split.[3] } }
// TODO: Make a single update instead of two
do! DbService.updatePlayer <| updatePlayer prize attack player
do! DbService.updatePlayer { target with Bank = MathF.Max(target.Bank - prize, 0f)}
do! DbService.updatePlayer { target with Bank = Math.Max(target.Bank - prize, 0)}
let builder = DiscordInteractionResponseBuilder()
builder.IsEphemeral <- true
@ -138,7 +139,7 @@ let handleAttack (event : ComponentInteractionCreateEventArgs) =
|> Async.Ignore
| true ->
let builder = DiscordInteractionResponseBuilder()
let prize = 0.223f
let prize = 2
builder.IsEphemeral <- true
builder.Content <- $"Hack failed! {split.[3]} was able to mount a successful defense! You lost {prize} GoodBoyTokenz!"
do! event.Interaction.CreateResponseAsync(InteractionResponseType.UpdateMessage, builder)

View File

@ -2,6 +2,7 @@ module Degenz.PlayerInteractions
open System
open System.Threading.Tasks
open AsciiTableFormatter
open DSharpPlus.Entities
open DSharpPlus
open DSharpPlus.SlashCommands
@ -29,7 +30,7 @@ module Commands =
Shields = shields
Attacks = [||]
Defenses = [||]
Bank = 15f }
Bank = 15 }
let addHackerRole (ctx : InteractionContext) =
async {

View File

@ -26,9 +26,9 @@ type SlotMachine() =
|| (results.[0] <> results.[1] && results.[1] <> results.[2] && results.[0] <> results.[2])
if winConditions then
do! DbService.updatePlayer { player with Bank = player.Bank + 10.0f }
do! DbService.updatePlayer { player with Bank = player.Bank + 10 }
else
do! DbService.updatePlayer { player with Bank = MathF.Max(player.Bank - 0.5f, 0.0f) }
do! DbService.updatePlayer { player with Bank = Math.Max(player.Bank - 1, 0) }
do! ctx.Interaction.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource)

View File

@ -50,7 +50,7 @@ let handleDefense (event : ComponentInteractionCreateEventArgs) =
do! sendMessage' $"Hacking attempt failed! {player.Name} defended hack from Degenz-Trainer and took {prize} from them! "
do! sendMessage' "Great, I wasn't able to hack you. Great job! Because you had your system protected, when I tried to hack you, I lost some money and had to give it to you"
do! sendMessage' "But you can make even more by successfully hacking your target. Why don't you try hacking me?"
let weaponName = player.Weapons |> Array.tryHead |> Option.defaultValue Weapon.Virus
let weaponName = player.Weapons |> Array.tryHead |> Option.defaultValue Hack.Virus
do! sendMessage' $"You currently have {weaponName} equipped. To attempt a hack, type the '/hack' command and select {weaponName}."
| None ->
do! sendMessage' $"Something went wrong, please contact a moderator"