Fix bug with achievements
This commit is contained in:
parent
5cc8b76dba
commit
2ea9b65c46
@ -346,11 +346,9 @@ let checkHasAchievement (did : uint64) (achievement : string) = async {
|
|||||||
[ ( "did" , Sql.string (string did) )
|
[ ( "did" , Sql.string (string did) )
|
||||||
( "symbol", Sql.string achievement ) ]
|
( "symbol", Sql.string achievement ) ]
|
||||||
|> Sql.query """
|
|> Sql.query """
|
||||||
WITH ach AS (SELECT id FROM achievement WHERE id = @symbol),
|
SELECT achievement_id FROM user_achievements_achievement WHERE user_id = @did AND achievement_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;
|
|
||||||
"""
|
"""
|
||||||
|> Sql.executeAsync (fun read -> read.int "achievement_id")
|
|> Sql.executeAsync (fun read -> read.string "achievement_id")
|
||||||
|> Async.AwaitTask
|
|> Async.AwaitTask
|
||||||
return List.isEmpty result |> not
|
return List.isEmpty result |> not
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,6 @@ let handleAttack (ctx : IDiscordContext) =
|
|||||||
executePlayerAction ctx (fun attacker -> async {
|
executePlayerAction ctx (fun attacker -> async {
|
||||||
let tokens = ctx.GetInteractionId().Split("-")
|
let tokens = ctx.GetInteractionId().Split("-")
|
||||||
let hackId = tokens.[1]
|
let hackId = tokens.[1]
|
||||||
// TODO: This sucks
|
|
||||||
let item = Arsenal.weapons |> Inventory.findItemById hackId
|
let item = Arsenal.weapons |> Inventory.findItemById hackId
|
||||||
let hackItem = (Inventory.getHackItem item).Value
|
let hackItem = (Inventory.getHackItem item).Value
|
||||||
let resultId , targetId = UInt64.TryParse tokens.[2]
|
let resultId , targetId = UInt64.TryParse tokens.[2]
|
||||||
|
@ -119,7 +119,7 @@ let getBuyItemsEmbed storeId (playerInventory : Inventory) (storeInventory : Sto
|
|||||||
|
|
||||||
let purchaseItemEmbed (item : Item) =
|
let purchaseItemEmbed (item : Item) =
|
||||||
let embed = DiscordEmbedBuilder()
|
let embed = DiscordEmbedBuilder()
|
||||||
embed.ImageUrl <- item.IconUrl
|
embed.ImageUrl <- item.ImageUrl
|
||||||
embed.Title <- $"Purchased {item.Name}"
|
embed.Title <- $"Purchased {item.Name}"
|
||||||
match item.Type with
|
match item.Type with
|
||||||
| ItemType.Jpeg ->
|
| ItemType.Jpeg ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user