62 lines
1.3 KiB
C#
62 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using FFXIVClientStructs.FFXIV.Application.Network.WorkDefinitions;
|
|
using LLib.GameData;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.Model;
|
|
|
|
internal sealed class QuestProgressInfo
|
|
{
|
|
private readonly string _asString;
|
|
|
|
public ElementId Id { get; }
|
|
|
|
public byte Sequence { get; }
|
|
|
|
public ushort Flags { get; init; }
|
|
|
|
public List<byte> Variables { get; }
|
|
|
|
public bool IsHidden { get; }
|
|
|
|
public EClassJob ClassJob { get; }
|
|
|
|
public string Tooltip { get; }
|
|
|
|
public QuestProgressInfo(QuestWork questWork)
|
|
{
|
|
Id = new QuestId(questWork.QuestId);
|
|
Sequence = questWork.Sequence;
|
|
Flags = questWork.Flags;
|
|
Variables = questWork.Variables.ToArray().ToList();
|
|
IsHidden = questWork.IsHidden;
|
|
ClassJob = (EClassJob)questWork.AcceptClassJob;
|
|
Tooltip = "";
|
|
Span<byte> variables = questWork.Variables;
|
|
string text = "";
|
|
for (int i = 0; i < variables.Length; i++)
|
|
{
|
|
byte b = variables[i];
|
|
Tooltip = Tooltip + Convert.ToString(b, 2).PadLeft(8).Replace(" ", "0") + "\n";
|
|
int num = b & 0xF;
|
|
text += b;
|
|
if (num != 0)
|
|
{
|
|
text += $"({num})";
|
|
}
|
|
text += " ";
|
|
if (i % 2 == 1)
|
|
{
|
|
text += " ";
|
|
}
|
|
}
|
|
_asString = "QW: " + text.Trim();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return _asString;
|
|
}
|
|
}
|