Initial pieces of payload rework; everything is read-only at the moment, pending next stages. Lumina is now used for on-demand property resolution, properties are only exposed for user-facing values, and mostly expose the lumina object(s) where applicable

This commit is contained in:
meli 2020-04-21 16:41:03 -07:00
parent 22e9eb89b8
commit f2cee5f5bc
17 changed files with 355 additions and 253 deletions

View file

@ -1,3 +1,4 @@
using Lumina.Excel.GeneratedSheets;
using System;
using System.Collections.Generic;
using System.IO;
@ -8,15 +9,29 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads
{
public override PayloadType Type => PayloadType.UIGlow;
public ushort RawColor { get; private set; }
private UIColor color;
public UIColor UIColor
{
get
{
this.color ??= this.dataResolver.GetExcelSheet<UIColor>().GetRow(this.colorKey);
return this.color;
}
}
//public int Red { get; private set; }
//public int Green { get; private set; }
//public int Blue { get; private set; }
public uint RGB
{
get
{
return UIColor.UIGlow;
}
}
private ushort colorKey;
public override byte[] Encode()
{
var colorBytes = MakeInteger(RawColor);
var colorBytes = MakeInteger(this.colorKey);
var chunkLen = colorBytes.Length + 1;
var bytes = new List<byte>(new byte[]
@ -30,19 +45,14 @@ namespace Dalamud.Game.Chat.SeStringHandling.Payloads
return bytes.ToArray();
}
public override void Resolve()
{
// TODO: resolve color keys to hex colors via UIColor table
}
public override string ToString()
{
return $"{Type} - RawColor: {RawColor}";
return $"{Type} - UIColor: {colorKey}";
}
protected override void ProcessChunkImpl(BinaryReader reader, long endOfStream)
{
RawColor = (ushort)GetInteger(reader);
this.colorKey = (ushort)GetInteger(reader);
}
protected override byte GetMarkerForIntegerBytes(byte[] bytes)