mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
34 lines
1 KiB
C#
34 lines
1 KiB
C#
namespace Glamourer.Customization;
|
|
|
|
public record struct CustomizeValue(byte Value)
|
|
{
|
|
public static readonly CustomizeValue Zero = new(0);
|
|
public static readonly CustomizeValue Max = new(0xFF);
|
|
|
|
public static CustomizeValue Bool(bool b)
|
|
=> b ? Max : Zero;
|
|
|
|
public static explicit operator CustomizeValue(byte value)
|
|
=> new(value);
|
|
|
|
public static CustomizeValue operator ++(CustomizeValue v)
|
|
=> new(++v.Value);
|
|
|
|
public static CustomizeValue operator --(CustomizeValue v)
|
|
=> new(--v.Value);
|
|
|
|
public static bool operator <(CustomizeValue v, int count)
|
|
=> v.Value < count;
|
|
|
|
public static bool operator >(CustomizeValue v, int count)
|
|
=> v.Value > count;
|
|
|
|
public static CustomizeValue operator +(CustomizeValue v, int rhs)
|
|
=> new((byte)(v.Value + rhs));
|
|
|
|
public static CustomizeValue operator -(CustomizeValue v, int rhs)
|
|
=> new((byte)(v.Value - rhs));
|
|
|
|
public override string ToString()
|
|
=> Value.ToString();
|
|
}
|