mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Some early glamourer changes.
This commit is contained in:
parent
c2bc8252f1
commit
9dee0862cc
17 changed files with 192 additions and 840 deletions
|
|
@ -1,16 +1,51 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Penumbra.GameData.Structs
|
||||
{
|
||||
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
||||
public readonly struct CharacterWeapon
|
||||
{
|
||||
public readonly SetId Set;
|
||||
public readonly WeaponType Type;
|
||||
public readonly ushort Variant;
|
||||
public readonly StainId Stain;
|
||||
namespace Penumbra.GameData.Structs;
|
||||
|
||||
public override string ToString()
|
||||
=> $"{Set},{Type},{Variant},{Stain}";
|
||||
[StructLayout( LayoutKind.Explicit, Pack = 1, Size = 7 )]
|
||||
public readonly struct CharacterWeapon : IEquatable< CharacterWeapon >
|
||||
{
|
||||
[FieldOffset( 0 )]
|
||||
public readonly SetId Set;
|
||||
|
||||
[FieldOffset( 2 )]
|
||||
public readonly WeaponType Type;
|
||||
|
||||
[FieldOffset( 4 )]
|
||||
public readonly ushort Variant;
|
||||
|
||||
[FieldOffset( 6 )]
|
||||
public readonly StainId Stain;
|
||||
|
||||
public ulong Value
|
||||
=> ( ulong )Set | ( ( ulong )Type << 16 ) | ( ( ulong )Variant << 32 ) | ( ( ulong )Stain << 48 );
|
||||
|
||||
public override string ToString()
|
||||
=> $"{Set},{Type},{Variant},{Stain}";
|
||||
|
||||
public CharacterWeapon( SetId set, WeaponType type, ushort variant, StainId stain )
|
||||
{
|
||||
Set = set;
|
||||
Type = type;
|
||||
Variant = variant;
|
||||
Stain = stain;
|
||||
}
|
||||
|
||||
public static readonly CharacterWeapon Empty = new(0, 0, 0, 0);
|
||||
|
||||
public bool Equals( CharacterWeapon other )
|
||||
=> Value == other.Value;
|
||||
|
||||
public override bool Equals( object? obj )
|
||||
=> obj is CharacterWeapon other && Equals( other );
|
||||
|
||||
public override int GetHashCode()
|
||||
=> Value.GetHashCode();
|
||||
|
||||
public static bool operator ==( CharacterWeapon left, CharacterWeapon right )
|
||||
=> left.Value == right.Value;
|
||||
|
||||
public static bool operator !=( CharacterWeapon left, CharacterWeapon right )
|
||||
=> left.Value != right.Value;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue