mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Initial Commit
This commit is contained in:
commit
164f304cf6
38 changed files with 2796 additions and 0 deletions
45
Glamourer.GameData/Item.cs
Normal file
45
Glamourer.GameData/Item.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Glamourer
|
||||
{
|
||||
public readonly struct Item
|
||||
{
|
||||
private static (SetId id, WeaponType type, ushort variant) ParseModel(EquipSlot slot, ulong data)
|
||||
{
|
||||
if (slot == EquipSlot.MainHand || slot == EquipSlot.OffHand)
|
||||
{
|
||||
var id = (SetId) (data & 0xFFFF);
|
||||
var type = (WeaponType) ((data >> 16) & 0xFFFF);
|
||||
var variant = (ushort) ((data >> 32) & 0xFFFF);
|
||||
return (id, type, variant);
|
||||
}
|
||||
else
|
||||
{
|
||||
var id = (SetId) (data & 0xFFFF);
|
||||
var variant = (byte) ((data >> 16) & 0xFF);
|
||||
return (id, new WeaponType(), variant);
|
||||
}
|
||||
}
|
||||
|
||||
public readonly Lumina.Excel.GeneratedSheets.Item Base;
|
||||
public readonly string Name;
|
||||
public readonly EquipSlot EquippableTo;
|
||||
|
||||
public (SetId id, WeaponType type, ushort variant) MainModel
|
||||
=> ParseModel(EquippableTo, Base.ModelMain);
|
||||
|
||||
public bool HasSubModel
|
||||
=> Base.ModelSub != 0;
|
||||
|
||||
public (SetId id, WeaponType type, ushort variant) SubModel
|
||||
=> ParseModel(EquippableTo, Base.ModelSub);
|
||||
|
||||
public Item(Lumina.Excel.GeneratedSheets.Item item, string name, EquipSlot slot = EquipSlot.Unknown)
|
||||
{
|
||||
Base = item;
|
||||
Name = name;
|
||||
EquippableTo = slot == EquipSlot.Unknown ? ((EquipSlot) item.EquipSlotCategory.Row).ToSlot() : slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue