mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Some Glamourer stuff
This commit is contained in:
parent
a293e7dfea
commit
7d1d6ac829
4 changed files with 42 additions and 15 deletions
|
|
@ -6,6 +6,8 @@ namespace Penumbra.GameData.Structs;
|
|||
[StructLayout(LayoutKind.Explicit, Pack = 1)]
|
||||
public struct CharacterArmor : IEquatable<CharacterArmor>
|
||||
{
|
||||
public const int Size = 4;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public uint Value;
|
||||
|
||||
|
|
@ -26,6 +28,15 @@ public struct CharacterArmor : IEquatable< CharacterArmor >
|
|||
Stain = stain;
|
||||
}
|
||||
|
||||
public CharacterArmor With(StainId stain)
|
||||
=> new(Set, Variant, stain);
|
||||
|
||||
public CharacterWeapon ToWeapon()
|
||||
=> new(Set, 0, Variant, Stain);
|
||||
|
||||
public CharacterWeapon ToWeapon(StainId stain)
|
||||
=> new(Set, 0, Variant, stain);
|
||||
|
||||
public override string ToString()
|
||||
=> $"{Set},{Variant},{Stain}";
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ namespace Penumbra.GameData.Structs;
|
|||
|
||||
public readonly unsafe struct CharacterEquip
|
||||
{
|
||||
public const int Slots = 10;
|
||||
public const int Size = CharacterArmor.Size * Slots;
|
||||
|
||||
public static readonly CharacterEquip Null = new(null);
|
||||
|
||||
private readonly CharacterArmor* _armor;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,12 @@ public struct CharacterWeapon : IEquatable<CharacterWeapon>
|
|||
Stain = (StainId)(value >> 48);
|
||||
}
|
||||
|
||||
public CharacterArmor ToArmor()
|
||||
=> new(Set, (byte)Variant, Stain);
|
||||
|
||||
public CharacterArmor ToArmor(StainId stain)
|
||||
=> new(Set, (byte)Variant, stain);
|
||||
|
||||
public static readonly CharacterWeapon Empty = new(0, 0, 0, 0);
|
||||
|
||||
public bool Equals(CharacterWeapon other)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Penumbra.GameData.Structs;
|
||||
|
||||
public readonly struct StainId : IEquatable< StainId >
|
||||
public readonly struct StainId : IEquatable< StainId >, IEqualityOperators<StainId, StainId, bool>
|
||||
{
|
||||
public readonly byte Value;
|
||||
|
||||
|
|
@ -26,4 +27,10 @@ public readonly struct StainId : IEquatable< StainId >
|
|||
|
||||
public override int GetHashCode()
|
||||
=> Value.GetHashCode();
|
||||
|
||||
public static bool operator ==(StainId left, StainId right)
|
||||
=> left.Value == right.Value;
|
||||
|
||||
public static bool operator !=(StainId left, StainId right)
|
||||
=> left.Value != right.Value;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue