NHSE/NHSE.Core/Structures/Item/ItemInfo.cs
Kurt 6a87f9d874 Add more item flags
10_0000th bit of Flag0 is to indicate if an item was dropped rather than placed (dropped clothing vs clothing on display)

treat dropped items and buried item sizes as 2x2 (1.0x1.0) rather than their placed sizes
2020-05-09 22:06:22 -07:00

33 lines
1020 B
C#

namespace NHSE.Core
{
public static class ItemInfo
{
private static readonly byte[] ItemKinds = ResourceUtil.GetBinaryResource("item_kind.bin");
private static readonly byte[] ItemSizes = ResourceUtil.GetBinaryResource("item_size.bin");
public static ItemKind GetItemKind(Item item) => GetItemKind(item.DisplayItemId);
public static ItemKind GetItemKind(ushort id)
{
if (id > ItemKinds.Length)
return FieldItemList.GetFieldItemKind(id);
return (ItemKind) ItemKinds[id];
}
public static ItemSizeType GetItemSize(Item item)
{
if (item.IsBuried || item.IsDropped)
return ItemSizeType.S_1_0x1_0;
return GetItemSize(item.DisplayItemId);
}
public static ItemSizeType GetItemSize(ushort id)
{
if (id > ItemSizes.Length)
return ItemSizeType.Unknown;
return (ItemSizeType)ItemSizes[id];
}
}
}