fix: add more validation to item dumper

This commit is contained in:
2026-06-18 17:59:24 -03:00
parent 9760446474
commit 37c7fbe8d0
+8 -4
View File
@@ -190,14 +190,18 @@ class Dumper
string itemId = row.Key.Text; string itemId = row.Key.Text;
if (!TryGetProp(props, "Type", out EInventoryItemType itemType) || !TryGetProp(props, "UIData", out FStructFallback uiDataFb)) if (!TryGetProp(props, "Type", out EInventoryItemType itemType)
throw new KeyNotFoundException("Type or UIData was not found."); || !TryGetProp(props, "UIData", out FStructFallback uiDataFb)
|| !TryGetProp(props, "Role", out EPlayerRole role)
|| !TryGetProp(props, "Inventory", out bool isInventory))
throw new KeyNotFoundException("Type, UIData or Role was not found.");
UIDataStruct uiData = uiDataFb.MapToStruct<UIDataStruct>(); UIDataStruct uiData = uiDataFb.MapToStruct<UIDataStruct>();
if (itemType != EInventoryItemType.Item) // ignore powers, slasher and challenge related items
if (!isInventory || itemType != EInventoryItemType.Item || role != EPlayerRole.VE_Camper)
{ {
_log.Verbose("Ignoring invalid item type ({0})", itemType.ToString()); _log.Verbose("Ignoring invalid item ({0})", itemId);
continue; continue;
} }