From daf692ffc586b8bdbeb603238887278ae53b8cb1 Mon Sep 17 00:00:00 2001 From: jensbrak <52660827+jensbrak@users.noreply.github.com> Date: Thu, 22 Dec 2022 10:20:10 +0100 Subject: [PATCH] Update Item.cs This will at least prevent Loki from crashing but maybe there are better ways of solving this. Another thought: I'd like to insert the actual internal game id (ie name) of the item in the inventory slot, instead of the fallback value 'item_name'. That way you can see what the name is that is missing, to be added in the SharedItemData DB. WPF is not my expertise so I don't know how to make a fallback that use the name of an item. Well, you could replace "item_data" with the item.name in code but that seems backwards... --- Loki/Item.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Loki/Item.cs b/Loki/Item.cs index 1514742..88e9c2f 100644 --- a/Loki/Item.cs +++ b/Loki/Item.cs @@ -77,7 +77,7 @@ public string CrafterName { public bool HasCrafterTag => CrafterId != 0; - public double MaxDurability => SharedData.MaxDurability + Math.Max(0, Quality - 1) * SharedData.DurabilityPerLevel; + public double MaxDurability => SharedData == null ? 0d : SharedData.MaxDurability + Math.Max(0, Quality - 1) * SharedData.DurabilityPerLevel; public Item(string name, int stack, float durability, Vector2i pos, bool equiped, int quality, int variant, long crafterId, string crafterName, List<(string, string)> itemData)