Questionable/Questionable.Model/Questing/QuestWorkValue.cs

31 lines
852 B
C#
Raw Normal View History

using System;
using System.Text.Json.Serialization;
2024-08-02 16:30:21 +00:00
using Questionable.Model.Questing.Converter;
2024-07-20 17:09:51 +00:00
2024-08-02 16:30:21 +00:00
namespace Questionable.Model.Questing;
2024-07-20 17:09:51 +00:00
[JsonConverter(typeof(QuestWorkConfigConverter))]
public sealed class QuestWorkValue(byte? high, byte? low, EQuestWorkMode mode)
2024-07-20 17:09:51 +00:00
{
public QuestWorkValue(byte value)
: this((byte)(value >> 4), (byte)(value & 0xF), EQuestWorkMode.Bitwise)
2024-07-20 17:09:51 +00:00
{
}
public byte? High { get; set; } = high;
public byte? Low { get; set; } = low;
public EQuestWorkMode Mode { get; set; } = mode;
public override string ToString()
{
if (High != null && Low != null)
return ((byte)(High << 4) + Low).ToString();
else if (High != null)
return High + "H";
else if (Low != null)
return Low + "L";
else
return "-";
}
2024-07-20 17:09:51 +00:00
}