1
0
Fork 0
forked from aly/qstbak
qstbak/Questionable.Model/Questionable.Model.Questing/QuestWorkValue.cs
2025-12-18 00:49:57 +10:00

36 lines
780 B
C#

using System.Text.Json.Serialization;
using Questionable.Model.Questing.Converter;
namespace Questionable.Model.Questing;
[JsonConverter(typeof(QuestWorkConfigConverter))]
public sealed class QuestWorkValue(byte? high, byte? low, EQuestWorkMode mode)
{
public byte? High { get; set; } = high;
public byte? Low { get; set; } = low;
public EQuestWorkMode Mode { get; set; } = mode;
public QuestWorkValue(byte value)
: this((byte)(value >> 4), (byte)(value & 0xF), EQuestWorkMode.Bitwise)
{
}
public override string ToString()
{
if (High.HasValue && Low.HasValue)
{
return ((byte)((High.Value << 4) + Low.Value)).ToString();
}
if (High.HasValue)
{
return High.Value + "H";
}
if (Low.HasValue)
{
return Low.Value + "L";
}
return "-";
}
}