mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 13:14:17 +01:00
commit
20a1d1ae2d
3 changed files with 58 additions and 0 deletions
|
|
@ -178,6 +178,10 @@ namespace Dalamud.Game.Chat.SeStringHandling
|
||||||
payload = new UIGlowPayload();
|
payload = new UIGlowPayload();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SeStringChunkType.Icon:
|
||||||
|
payload = new IconPayload();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Log.Verbose("Unhandled SeStringChunkType: {0}", chunkType);
|
Log.Verbose("Unhandled SeStringChunkType: {0}", chunkType);
|
||||||
break;
|
break;
|
||||||
|
|
@ -208,6 +212,7 @@ namespace Dalamud.Game.Chat.SeStringHandling
|
||||||
|
|
||||||
protected enum SeStringChunkType
|
protected enum SeStringChunkType
|
||||||
{
|
{
|
||||||
|
Icon = 0x12,
|
||||||
EmphasisItalic = 0x1A,
|
EmphasisItalic = 0x1A,
|
||||||
Interactable = 0x27,
|
Interactable = 0x27,
|
||||||
AutoTranslateKey = 0x2E,
|
AutoTranslateKey = 0x2E,
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,10 @@ namespace Dalamud.Game.Chat.SeStringHandling
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EmphasisItalic,
|
EmphasisItalic,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// An SeString payload representing a bitmap icon.
|
||||||
|
/// </summary>
|
||||||
|
Icon,
|
||||||
|
/// <summary>
|
||||||
/// An SeString payload representing any data we don't handle.
|
/// An SeString payload representing any data we don't handle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Unknown
|
Unknown
|
||||||
|
|
|
||||||
49
Dalamud/Game/Chat/SeStringHandling/Payloads/IconPayload.cs
Normal file
49
Dalamud/Game/Chat/SeStringHandling/Payloads/IconPayload.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace Dalamud.Game.Chat.SeStringHandling.Payloads {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SeString payload representing a bitmap icon from fontIcon
|
||||||
|
/// </summary>
|
||||||
|
public class IconPayload : Payload {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Index of the icon
|
||||||
|
/// </summary>
|
||||||
|
public uint IconIndex { get; private set; }
|
||||||
|
|
||||||
|
internal IconPayload() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a Icon payload for the specified icon.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="iconIndex">Index of the icon</param>
|
||||||
|
public IconPayload(uint iconIndex) {
|
||||||
|
this.IconIndex = iconIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override PayloadType Type => PayloadType.Icon;
|
||||||
|
|
||||||
|
protected override byte[] EncodeImpl() {
|
||||||
|
var indexBytes = MakeInteger(this.IconIndex);
|
||||||
|
var chunkLen = indexBytes.Length + 1;
|
||||||
|
var bytes = new List<byte>(new byte[] {
|
||||||
|
START_BYTE, (byte)SeStringChunkType.Icon, (byte)chunkLen
|
||||||
|
});
|
||||||
|
bytes.AddRange(indexBytes);
|
||||||
|
bytes.Add(END_BYTE);
|
||||||
|
return bytes.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void DecodeImpl(BinaryReader reader, long endOfStream) {
|
||||||
|
this.IconIndex = GetInteger(reader);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return $"{Type} - IconIndex: {this.IconIndex}";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue