diff --git a/Bot/DbService.fs b/Bot/DbService.fs index f2c126a..80aae0f 100644 --- a/Bot/DbService.fs +++ b/Bot/DbService.fs @@ -33,6 +33,7 @@ let readItem (reader : RowReader) = | "Food" -> ItemType.Food | "Accessory" -> ItemType.Accessory | "Jpeg" -> ItemType.Jpeg + | "Whitelist" -> ItemType.Whitelist | _ -> ItemType.Misc Item.Attributes = [ reader.intOrNone "buy_price" |> Option.map (fun a -> Buyable (a * 1)) @@ -58,8 +59,8 @@ let getPlayerInventory (did : uint64) = |> Sql.connect |> Sql.parameters [ "did", Sql.string (string did) ] |> Sql.query """ - SELECT ii.id,name,description,icon_url,image_url,category,buy_price,sell_price,rate_limit,expiration,drop_chance,can_trade,can_consume, - attack_power,defense_power,class_name,max_stack,mods + SELECT ii.id,name,description,icon_url,image_url,category,buy_price,sell_price,rate_limit, + expiration,drop_chance,can_trade,can_consume,attack_power,defense_power,class_name,max_stack,mods FROM inventory_item JOIN item ii on inventory_item.item_id = ii.id JOIN "user" usr on inventory_item.user_id = usr.id @@ -104,8 +105,8 @@ let getStoreItems (storeId : string) = |> Sql.connect |> Sql.parameters [ "sid", Sql.string storeId ] |> Sql.query """ - SELECT store_id,stock,available,limit_stock,i.id,name,description,icon_url,image_url,category,buy_price,sell_price,rate_limit,expiration,drop_chance,can_trade,can_consume, - attack_power,defense_power,class_name,max_stack,mods + SELECT store_id,stock,available,limit_stock,i.id,name,description,icon_url,image_url,category, + buy_price,sell_price,rate_limit,expiration,drop_chance,can_trade,can_consume,attack_power,defense_power,class_name,max_stack,mods FROM store_item JOIN item i on store_item.item_id = i.id WHERE store_id = @sid; @@ -124,8 +125,8 @@ let getStoreItemBySymbol (itemSymbol : string) = |> Sql.connect |> Sql.parameters [ "iid", Sql.string itemSymbol ] |> Sql.query """ - SELECT store_id,stock,available,limit_stock,i.id,name,description,icon_url,image_url,category,buy_price,sell_price,rate_limit,expiration,drop_chance,can_trade,can_consume, - attack_power,defense_power,class_name,max_stack,mods + SELECT store_id,stock,available,limit_stock,i.id,name,description,icon_url,image_url,category, + buy_price,sell_price,rate_limit,expiration,drop_chance,can_trade,can_consume,attack_power,defense_power,class_name,max_stack,mods FROM store_item JOIN item i on store_item.item_id = i.id WHERE item_id = @iid; diff --git a/Bot/GameHelpers.fs b/Bot/GameHelpers.fs index 3e60d4c..9a4d5de 100644 --- a/Bot/GameHelpers.fs +++ b/Bot/GameHelpers.fs @@ -13,6 +13,7 @@ module Inventory = | ItemType.Food -> inventory |> List.filter (fun item -> match item.Type with ItemType.Food _ -> true | _ -> false) | ItemType.Accessory -> inventory |> List.filter (fun item -> match item.Type with ItemType.Accessory _ -> true | _ -> false) | ItemType.Jpeg -> inventory |> List.filter (fun item -> match item.Type with ItemType.Jpeg _ -> true | _ -> false) + | ItemType.Whitelist -> inventory |> List.filter (fun item -> match item.Type with ItemType.Whitelist _ -> true | _ -> false) | ItemType.Misc -> inventory |> List.filter (fun item -> match item.Type with ItemType.Misc _ -> true | _ -> false) let findItemById id (inventory : Inventory) = inventory |> List.find (fun item -> item.Id = id) diff --git a/Bot/GameTypes.fs b/Bot/GameTypes.fs index 9d03522..45364fc 100644 --- a/Bot/GameTypes.fs +++ b/Bot/GameTypes.fs @@ -85,6 +85,7 @@ type ItemType = | Food | Accessory | Jpeg + | Whitelist | Misc type Effect = diff --git a/Bot/Games/Store.fs b/Bot/Games/Store.fs index 94cf161..ef44e20 100644 --- a/Bot/Games/Store.fs +++ b/Bot/Games/Store.fs @@ -57,35 +57,43 @@ let getItemEmbeds owned (items : StoreItem list) = |> List.map (fun (item,count) -> let mutable titleText = item.Item.Name let embed = DiscordEmbedBuilder() - use table = new DataTable() - table.SetBorder(Border.None) - table.SetShowTableName(false) - let values : ResizeArray = ResizeArray() if not owned && item.LimitStock then - values.Add("Stock", $"{item.Stock}") + embed.AddField("Stock", $"{item.Stock}", true) |> ignore item.Item.Attributes |> List.iter (function | Buyable price -> if not owned then - values.Add("Price", (if price = 0 then "Free" else $"{price} $GBT")) + embed.AddField("Price", (if price = 0 then "Free" else $"{price} $GBT"), true) |> ignore | Attackable power -> let title = match item.Item.Type with ItemType.Hack -> "Reward" | _ -> "Power" - values.Add($"{title}", string power) + embed.AddField($"{title}", string power, true) |> ignore + | Classable className -> + let title = + match item.Item.Type with + | ItemType.Hack -> "Weak Against" | ItemType.Shield -> "Defeats" + | _ -> "" + let goodAgainst = + match item.Item.Type with + | ItemType.Hack -> WeaponClass.getGoodAgainst className |> fst |> string + | ItemType.Shield -> WeaponClass.getGoodAgainst className |> snd |> string + | _ -> "" + let weaponName = Arsenal.weapons |> List.find (fun w -> w.Id = goodAgainst) |> fun i -> i.Name + embed.AddField(title, weaponName, true) |> ignore | RateLimitable time -> - match item.Item.Type with - | ItemType.Hack -> () - | ItemType.Shield -> - let ts = TimeSpan.FromMinutes(int time) - let timeStr = if ts.Hours = 0 then $"{ts.Minutes} mins" else $"{ts.Hours} hours" - values.Add($"Active", timeStr) - | _ -> () + let title = + match item.Item.Type with + | ItemType.Hack -> "Cooldown" | ItemType.Shield -> "Active For" + | _ -> "" + let ts = TimeSpan.FromMinutes(int time) + let timeStr = if ts.Hours = 0 then $"{ts.Minutes} mins" else $"{ts.Hours} hours" + embed.AddField(title, timeStr, true) |> ignore | Stackable max -> - if owned then - let totalOwned = getTotalOwnedOfItem item.Item (items |> List.map (fun i -> i.Item)) |> Option.defaultValue 1 - titleText <- $"{totalOwned}x " + titleText -// values.Add($"Total Owned", $"{count}") -// else values.Add($"Max Allowed", $"{max}") - () + if owned + then embed.AddField($"Owned", $"{count}", true) + else embed.AddField($"Max Allowed", $"{max}", true) + |> ignore +// let totalOwned = getTotalOwnedOfItem item.Item (items |> List.map (fun i -> i.Item)) |> Option.defaultValue 1 +// titleText <- $"{totalOwned}x " + titleText | Modifiable effects -> let fx = effects @@ -98,31 +106,14 @@ let getItemEmbeds owned (items : StoreItem list) = $"{f.TargetStat} {str} + {i}" | RateMultiplier i -> $"{f.TargetStat} Multiplier - i") |> String.concat "\n" - values.Add($"Effect - Amount", $"{fx}") + embed.AddField($"Effect - Amount", $"{fx}", true) |> ignore | _ -> ()) - for title , _ in values do - let column = table.Columns.Add(title) - column.SetWidth(10) - column.SetDataAlignment(TextAlignment.Center) - column.SetHeaderBorder(Border.Bottom) - column.SetDataBorder(Border.Top) - - let arr : obj array = values |> Seq.map snd |> Seq.cast |> Seq.toArray - table.Rows.Add(arr) |> ignore - - // TODO: This isn't working, try using an image -// if not (String.IsNullOrEmpty item.Item.Description) then -// embed.Url <- item.Item.Description -// embed.Footer <- DiscordEmbedBuilder.EmbedFooter() -// embed.Footer.Text <- item.Item.Description - embed - .WithColor(WeaponClass.getClassEmbedColor item.Item) - .WithTitle(titleText) - |> ignore - if table.Columns.Count > 0 then - let split = table.ToPrettyPrintedString().Split("\n") - let text = split |> Array.skip 1 |> Array.take (split.Length - 3) |> String.concat "\n" - embed.WithDescription($"```{text}```") |> ignore + if item.Item.Type = ItemType.Whitelist then + embed.AddField("Mint Allowance", (if item.Item.Id = "WHITEOG" then 3 else 2) |> string, true) |> ignore + embed.Color <- WeaponClass.getClassEmbedColor item.Item + embed.Title <- titleText + embed.Description <- item.Item.Description + embed.ImageUrl <- "https://stage.degenz.game/blank-row.png" if String.IsNullOrWhiteSpace(item.Item.IconUrl) then embed else embed.WithThumbnail(item.Item.IconUrl)) @@ -165,6 +156,14 @@ let purchaseItemEmbed quantity (item : Item) = embed.ImageUrl <- item.ImageUrl embed.Thumbnail <- DiscordEmbedBuilder.EmbedThumbnail() embed.Thumbnail.Url <- item.IconUrl + | ItemType.Whitelist -> + embed.ImageUrl <- item.ImageUrl + let og = if item.Id = "WHITEOG" then "OG " else "" + embed.Description <- $""" +🎉 Congratulations, you purchased {og}WHITELIST! + +**__Mint Day: 31ST MAY__** +Keep an eye on <#{GuildEnvironment.channelAnnouncements}> for updates!""" | _ -> embed.Description <- $"Purchased {item.Name}" embed @@ -253,7 +252,7 @@ let handleBuyItem (ctx : IDiscordContext) itemId = match item.Attributes , getTotalOwnedOfItem item player.Inventory |> Option.defaultValue 0 with | CanStack max , amount -> embed.AddField("Owned", $"{amount + 1}", true) |> ignore - embed.AddField("New $GBT Balance", $"`💰` {player.Bank} ⋙ `💰` {player.Bank - price} `({price} $GBT)`", true) |> ignore + embed.AddField("New $GBT Balance", $"`💰` {player.Bank - price} `(-{price} $GBT)`", true) |> ignore if amount + 1 < max then let btn = DiscordButtonComponent(WeaponClass.getClassButtonColor item, $"Buy-{item.Id}-{storeId}", $"Buy Another") builder.AddComponents(btn) |> ignore diff --git a/Bot/GuildEnvironment.fs b/Bot/GuildEnvironment.fs index c97c5e3..9cfbafd 100644 --- a/Bot/GuildEnvironment.fs +++ b/Bot/GuildEnvironment.fs @@ -41,6 +41,7 @@ let channelBackAlley = getId "CHANNEL_BACKALLEY" let channelMarket = getId "CHANNEL_MARKET" let channelAccessoryShop = getId "CHANNEL_ACCESSORIES" let channelGiveaway = getId "CHANNEL_GIVEAWAY" +let channelAnnouncements = getId "CHANNEL_ANNOUNCEMENTS" //let channelThievery = getId "CHANNEL_THIEVERY" let botIdHackerBattle = getId "BOT_HACKER_BATTLE" diff --git a/Bot/InviteTracker.fs b/Bot/InviteTracker.fs index 1b47538..fcdc6da 100644 --- a/Bot/InviteTracker.fs +++ b/Bot/InviteTracker.fs @@ -284,21 +284,21 @@ let sendInitialEmbed (ctx : IDiscordContext) = let channel = ctx.GetGuild().GetChannel(GuildEnvironment.channelRecruitment) let rewardMsg = $""" **__Win $2,000:__** -- 🙋 1 invite = 1 entry per day -- 🎟 $100 daily raffles till mint* -- 💰 Earn an additional 100 $GBT for every Degen you invite! +🙋 1 invite = 1 entry everyday* +🎟 $100 daily raffles till mint +💰 Earn an additional 100 $GBT for every Degen you invite! **__How To Invite:__** - CLICK THE BUTTON below - Share your LINK with anyone you want to invite. -**must have invited at least 1 Degen to be eligible for that days $100 raffle* +**Every invite increases your chances of winning the daily $100 raffles* """ let embed = DiscordEmbedBuilder() .WithColor(DiscordColor.CornflowerBlue) .WithDescription(rewardMsg) - .WithImageUrl("https://cdn.discordapp.com/attachments/922422890991849542/973939752321564753/invite_banner7.png") + .WithImageUrl("https://s8.gifyu.com/images/invite-banner-usdc.png") .WithTitle("Invite Degenz") let builder = DiscordMessageBuilder().AddEmbed(embed)