From 22cac7c96a16045946c68c7945bd0501e718d79a Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Sat, 7 May 2022 10:52:27 +0700 Subject: [PATCH] Remove GBT reward from Trainer --- Bot/Games/Trainer.fs | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/Bot/Games/Trainer.fs b/Bot/Games/Trainer.fs index bf20c88..45ab6b9 100644 --- a/Bot/Games/Trainer.fs +++ b/Bot/Games/Trainer.fs @@ -13,7 +13,6 @@ let hackItem = Arsenal.weapons |> Inventory.findItemById (string ItemId.REMOTE) let shieldItem = Arsenal.weapons |> Inventory.findItemById (string ItemId.FIREWALL) let defaultHack = (Inventory.getHackItem hackItem).Value let defaultShield = (Inventory.getShieldItem shieldItem ).Value -let CurrencyGift = 250 let BeginnerProtectionHours = 24 let HackEvent () = { @@ -169,7 +168,6 @@ Here, I'm going to gift you: 1. A hack - `{defaultHack.Name}`, 2. A shield - `{defaultShield.Name}`, -3. `{CurrencyGift} 💰 $GBT`, I'm also going to give you some **TEMPORARY SHIELDS** until you buy your own. They will **ONLY** protect you from hacks for **{BeginnerProtectionHours} hrs**... @@ -199,22 +197,6 @@ let handleArsenal (ctx : IDiscordContext) = PlayerInteractions.executePlayerActi if inventory |> List.exists (fun i -> i.Id = weapon.Id) then inventory else weapon::inventory - let updatedPlayer = { - player with - Events = - player - |> Player.removeExpiredActions - |> fun p -> p.Events - |> List.filter (fun e -> match e.Type with Shielding _ -> false | _ -> true) - |> List.append (ShieldEvents()) - |> List.consTo (HackEvent()) - Inventory = - player.Inventory - |> addIfDoesntExist hackItem - |> addIfDoesntExist shieldItem - Bank = player.Bank + CurrencyGift - } - do! DbService.updatePlayer updatedPlayer |> Async.Ignore if player.Inventory |> List.exists (fun i -> i.Id = hackItem.Id) |> not then do! DbService.addToPlayerInventory player.DiscordId hackItem |> Async.Ignore if player.Inventory |> List.exists (fun i -> i.Id = shieldItem.Id) |> not then @@ -228,11 +210,25 @@ let handleArsenal (ctx : IDiscordContext) = PlayerInteractions.executePlayerActi printfn "%s" ex.Message () + let updatedPlayer = { + player with + Events = + player + |> Player.removeExpiredActions + |> fun p -> p.Events + |> List.filter (fun e -> match e.Type with Shielding _ -> false | _ -> true) + |> List.append (ShieldEvents()) + |> List.consTo (HackEvent()) + Inventory = + player.Inventory + |> addIfDoesntExist hackItem + |> addIfDoesntExist shieldItem + } let embed = Embeds.getArsenalEmbed updatedPlayer do! ctx.FollowUp(embed) |> Async.AwaitTask do! Async.Sleep 2000 - let rewards = [ $"{defaultHack.Name} Hack" ; $"{defaultShield.Name} Shield" ; $"{CurrencyGift} 💰$GBT"] + let rewards = [ $"{defaultHack.Name} Hack" ; $"{defaultShield.Name} Shield" ] let embed = Embeds.getAchievementEmbed rewards "You completed the Training Dojo and collected some gifts." TrainerAchievement do! ctx.FollowUp(embed) |> Async.AwaitTask