Merge branch 'staging'

This commit is contained in:
Joseph Ferano 2022-06-03 00:29:53 +07:00
commit 717d27a500

View File

@ -1,6 +1,7 @@
module Degenz.Embeds module Degenz.Embeds
open System open System
open DSharpPlus
open Degenz open Degenz
open Degenz.Messaging open Degenz.Messaging
open DSharpPlus.Entities open DSharpPlus.Entities
@ -10,6 +11,7 @@ let shieldGif = "https://s10.gifyu.com/images/Defense-Degenz-V2-min.gif"
let constructButtons (actionId: string) (buttonInfo : string) (player: PlayerData) (items : Inventory) ignoreCooldown = let constructButtons (actionId: string) (buttonInfo : string) (player: PlayerData) (items : Inventory) ignoreCooldown =
items items
|> List.sortBy (fun item -> item.Id)
|> List.map (fun item -> |> List.map (fun item ->
let action = let action =
player.Events player.Events
@ -42,7 +44,13 @@ let pickDefense actionId player isTrainer =
for shield in Inventory.getShields player.Inventory do for shield in Inventory.getShields player.Inventory do
let hours = TimeSpan.FromMinutes(int shield.Cooldown).TotalHours |> int let hours = TimeSpan.FromMinutes(int shield.Cooldown).TotalHours |> int
let against = WeaponClass.getGoodAgainst shield.Class |> snd let against = WeaponClass.getGoodAgainst shield.Class |> snd
embed.AddField(shield.Name, $"Active {hours} hours\nDefeats {against}", true) |> ignore let emoji =
match shield.Id with
| "FIREWALL" -> "<:firewall_shield:971620988649340989>"
| "ENCRYPTION" -> "<:encryption_shield:971620979912605727>"
| "CYPHER" -> "<:cypher_shield:971620965576503326>"
| _ -> ""
embed.AddField($"{emoji} {shield.Name}", $"Active {hours} hours\nDefeats {against}", true) |> ignore
DiscordFollowupMessageBuilder() DiscordFollowupMessageBuilder()
.AddComponents(buttons) .AddComponents(buttons)
@ -58,19 +66,19 @@ let pickHack actionId attacker defender bonus isTrainer =
let ( outcomeMsg , bonusMsg ) = let ( outcomeMsg , bonusMsg ) =
if attacker.Stats.Strength.Amount > defender.Stats.Strength.Amount then if attacker.Stats.Strength.Amount > defender.Stats.Strength.Amount then
"\nYou're stronger so you'll steal more!!!\n" , $"\n**__Potential Bonus:__**\n{bonus} 💰$GBT" "\nYou're **STRONGER** so you'll **HACK MORE!!!**\n" , $"\n**__Potential Bonus:__**\n`{bonus} 💰$GBT`"
else else
"\nYou're not stronger than them, you need to eat more!" , "" "\nYou're **NOT STRONGER** than them, you need to **EAT MORE!**" , ""
let stealMsg = let stealMsg =
if not isTrainer if not isTrainer
then $""" then $"""
{defender.Name} has **{defender.Bank} $GBT** we can take from them. **{defender.Name}** has `{defender.Bank} 💰$GBT` we can take from them.
**__Your Strength:__** **__Your Strength:__**
💪 {attacker.Stats.Strength.Amount} `💪 {attacker.Stats.Strength.Amount}`
**__Their Strength:__** **__Their Strength:__**
💪 {defender.Stats.Strength.Amount} `💪 {defender.Stats.Strength.Amount}`
{outcomeMsg}{bonusMsg}""" {outcomeMsg}{bonusMsg}"""
else "" else ""
let embed = let embed =
@ -79,9 +87,20 @@ let pickHack actionId attacker defender bonus isTrainer =
.WithDescription($"{stealMsg}\n\nPick the hack you want to use.") .WithDescription($"{stealMsg}\n\nPick the hack you want to use.")
if not isTrainer then if not isTrainer then
for hack in Inventory.getHacks attacker.Inventory do let hacks = Inventory.getHacks attacker.Inventory |> List.sortBy (fun h -> h.Id)
for hack in hacks do
let amount = if hack.Power > int defender.Bank then int defender.Bank else hack.Power let amount = if hack.Power > int defender.Bank then int defender.Bank else hack.Power
embed.AddField(hack.Name, $"Cooldown {hack.Cooldown} mins\nExtract {amount} $GBT", true) |> ignore let emoji =
match hack.Id with
| "REMOTE" -> "<:remote_access:971621009981571132>"
| "VIRUS" -> "<:virus_hack:971636840580927510>"
| "WORM" -> "<:worm_hack:971636842640310312>"
| _ -> ""
let fieldMsg = $"""
Hack Base: `{hack.Power} 💰$GBT`
Bonus: `{bonus} 💰$GBT`
**Hack Total:** `{amount + bonus} 💰$GBT`"""
embed.AddField($"{emoji} __{hack.Name}__", fieldMsg, true) |> ignore
DiscordFollowupMessageBuilder() DiscordFollowupMessageBuilder()
.AddComponents(buttons) .AddComponents(buttons)