Starting rework.

This commit is contained in:
Ottermandias 2022-07-15 13:09:38 +02:00
parent 0fc8992271
commit 7af38aa2ce
58 changed files with 8857 additions and 4923 deletions

View file

@ -1,22 +1,28 @@
using Penumbra.GameData.Structs;
using Dalamud.Utility;
using Penumbra.GameData.Structs;
namespace Glamourer.Structs;
// A wrapper for the clothing dyes the game provides with their RGBA color value, game ID, unmodified color value and name.
public readonly struct Stain
{
public readonly string Name;
public readonly uint RgbaColor;
// An empty stain with transparent color.
public static readonly Stain None = new("None");
public readonly string Name;
public readonly uint RgbaColor;
// Combine the Id byte with the 3 bytes of color values.
private readonly uint _seColorId;
public byte R
=> (byte)(RgbaColor & 0xFF);
public byte G
=> (byte)(RgbaColor >> 8 & 0xFF);
=> (byte)((RgbaColor >> 8) & 0xFF);
public byte B
=> (byte)(RgbaColor >> 16 & 0xFF);
=> (byte)((RgbaColor >> 16) & 0xFF);
public byte Intensity
=> (byte)((1 + R + G + B) / 3);
@ -27,23 +33,22 @@ public readonly struct Stain
public StainId RowIndex
=> (StainId)(_seColorId >> 24);
// R and B need to be shuffled and Alpha set to max.
public static uint SeColorToRgba(uint color)
=> (color & 0xFF) << 16 | color >> 16 & 0xFF | color & 0xFF00 | 0xFF000000;
=> ((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);
Name = stain.Name.ToDalamudString().ToString();
_seColorId = stain.Color | ((uint)index << 24);
RgbaColor = SeColorToRgba(stain.Color);
}
public static readonly Stain None = new("None");
// Only used by None.
private Stain(string name)
{
Name = name;
Name = name;
_seColorId = 0;
RgbaColor = 0;
RgbaColor = 0;
}
}