mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Initial Commit
This commit is contained in:
commit
164f304cf6
38 changed files with 2796 additions and 0 deletions
41
Glamourer.GameData/Stain.cs
Normal file
41
Glamourer.GameData/Stain.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Glamourer
|
||||
{
|
||||
public readonly struct Stain
|
||||
{
|
||||
public readonly string Name;
|
||||
public readonly uint RgbaColor;
|
||||
|
||||
private readonly uint _seColorId;
|
||||
|
||||
public byte R
|
||||
=> (byte) (RgbaColor & 0xFF);
|
||||
|
||||
public byte G
|
||||
=> (byte) ((RgbaColor >> 8) & 0xFF);
|
||||
|
||||
public byte B
|
||||
=> (byte) ((RgbaColor >> 16) & 0xFF);
|
||||
|
||||
public byte Intensity
|
||||
=> (byte) ((1 + R + G + B) / 3);
|
||||
|
||||
public uint SeColor
|
||||
=> _seColorId & 0x00FFFFFF;
|
||||
|
||||
public StainId RowIndex
|
||||
=> (StainId) (_seColorId >> 24);
|
||||
|
||||
|
||||
public static uint SeColorToRgba(uint color)
|
||||
=> ((color & 0xFF) << 16) | ((color >> 16) & 0xFF) | (color & 0xFF00) | 0xFF000000;
|
||||
|
||||
public Stain(byte index, Lumina.Excel.GeneratedSheets.Stain stain)
|
||||
{
|
||||
Name = stain.Name.ToString();
|
||||
_seColorId = stain.Color | ((uint) index << 24);
|
||||
RgbaColor = SeColorToRgba(stain.Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue