mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Some Glamourer stuff
This commit is contained in:
parent
a293e7dfea
commit
7d1d6ac829
4 changed files with 42 additions and 15 deletions
|
|
@ -3,22 +3,24 @@ using System.Runtime.InteropServices;
|
|||
|
||||
namespace Penumbra.GameData.Structs;
|
||||
|
||||
[StructLayout( LayoutKind.Explicit, Pack = 1 )]
|
||||
public struct CharacterArmor : IEquatable< CharacterArmor >
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 1)]
|
||||
public struct CharacterArmor : IEquatable<CharacterArmor>
|
||||
{
|
||||
[FieldOffset( 0 )]
|
||||
public const int Size = 4;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public uint Value;
|
||||
|
||||
[FieldOffset( 0 )]
|
||||
[FieldOffset(0)]
|
||||
public SetId Set;
|
||||
|
||||
[FieldOffset( 2 )]
|
||||
[FieldOffset(2)]
|
||||
public byte Variant;
|
||||
|
||||
[FieldOffset( 3 )]
|
||||
[FieldOffset(3)]
|
||||
public StainId Stain;
|
||||
|
||||
public CharacterArmor( SetId set, byte variant, StainId stain )
|
||||
public CharacterArmor(SetId set, byte variant, StainId stain)
|
||||
{
|
||||
Value = 0;
|
||||
Set = set;
|
||||
|
|
@ -26,23 +28,32 @@ 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}";
|
||||
|
||||
public static readonly CharacterArmor Empty;
|
||||
|
||||
public bool Equals( CharacterArmor other )
|
||||
public bool Equals(CharacterArmor other)
|
||||
=> Value == other.Value;
|
||||
|
||||
public override bool Equals( object? obj )
|
||||
=> obj is CharacterArmor other && Equals( other );
|
||||
public override bool Equals(object? obj)
|
||||
=> obj is CharacterArmor other && Equals(other);
|
||||
|
||||
public override int GetHashCode()
|
||||
=> ( int )Value;
|
||||
=> (int)Value;
|
||||
|
||||
public static bool operator ==( CharacterArmor left, CharacterArmor right )
|
||||
public static bool operator ==(CharacterArmor left, CharacterArmor right)
|
||||
=> left.Value == right.Value;
|
||||
|
||||
public static bool operator !=( CharacterArmor left, CharacterArmor right )
|
||||
public static bool operator !=(CharacterArmor left, CharacterArmor right)
|
||||
=> left.Value != right.Value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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