This commit is contained in:
Ottermandias 2023-02-09 18:52:53 +01:00
parent 145b64bb7a
commit 4cf082aa19
37 changed files with 1362 additions and 1255 deletions

View file

@ -1,5 +1,4 @@
using Dalamud.Utility;
using Glamourer.Util;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
@ -62,6 +61,9 @@ public readonly struct Weapon
=> Model.Stain;
public Weapon WithStain(StainId id)
=> new(Name, ItemId, Model with { Stain = id }, Type);
public Weapon(string name, uint itemId, CharacterWeapon weapon, FullEquipType type)
{
Name = name;
@ -81,4 +83,23 @@ public readonly struct Weapon
? new Weapon()
: new Weapon(name, itemId, weapon, offType);
}
public Weapon(Lumina.Excel.GeneratedSheets.Item item, bool offhand)
{
Name = string.Intern(item.Name.ToDalamudString().TextValue);
ItemId = item.RowId;
Type = item.ToEquipType();
var offType = Type.Offhand();
var model = offhand && offType == Type ? item.ModelSub : item.ModelMain;
Valid = Type.ToSlot() switch
{
EquipSlot.MainHand when !offhand => true,
EquipSlot.MainHand when offhand && offType == Type => true,
EquipSlot.OffHand when offhand => true,
_ => false,
};
Model.Set = (SetId)model;
Model.Type = (WeaponType)(model >> 16);
Model.Variant = (byte)(model >> 32);
}
}