Fix bug with achievements

This commit is contained in:
Joseph Ferano 2022-05-06 16:53:06 +07:00
parent 5cc8b76dba
commit 2ea9b65c46
3 changed files with 3 additions and 6 deletions

View File

@ -346,11 +346,9 @@ let checkHasAchievement (did : uint64) (achievement : string) = async {
[ ( "did" , Sql.string (string did) )
( "symbol", Sql.string achievement ) ]
|> Sql.query """
WITH ach AS (SELECT id FROM achievement WHERE id = @symbol),
usr AS (SELECT id FROM "user" WHERE id = @did)
SELECT achievement_id FROM user_achievements_achievement, ach, usr WHERE user_id = usr.id AND achievement_id = ach.id;
SELECT achievement_id FROM user_achievements_achievement WHERE user_id = @did AND achievement_id = @symbol;
"""
|> Sql.executeAsync (fun read -> read.int "achievement_id")
|> Sql.executeAsync (fun read -> read.string "achievement_id")
|> Async.AwaitTask
return List.isEmpty result |> not
}

View File

@ -165,7 +165,6 @@ let handleAttack (ctx : IDiscordContext) =
executePlayerAction ctx (fun attacker -> async {
let tokens = ctx.GetInteractionId().Split("-")
let hackId = tokens.[1]
// TODO: This sucks
let item = Arsenal.weapons |> Inventory.findItemById hackId
let hackItem = (Inventory.getHackItem item).Value
let resultId , targetId = UInt64.TryParse tokens.[2]

View File

@ -119,7 +119,7 @@ let getBuyItemsEmbed storeId (playerInventory : Inventory) (storeInventory : Sto
let purchaseItemEmbed (item : Item) =
let embed = DiscordEmbedBuilder()
embed.ImageUrl <- item.IconUrl
embed.ImageUrl <- item.ImageUrl
embed.Title <- $"Purchased {item.Name}"
match item.Type with
| ItemType.Jpeg ->