mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +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();
|
||||
break;
|
||||
|
||||
case SeStringChunkType.Icon:
|
||||
payload = new IconPayload();
|
||||
break;
|
||||
|
||||
default:
|
||||
Log.Verbose("Unhandled SeStringChunkType: {0}", chunkType);
|
||||
break;
|
||||
|
|
@ -208,6 +212,7 @@ namespace Dalamud.Game.Chat.SeStringHandling
|
|||
|
||||
protected enum SeStringChunkType
|
||||
{
|
||||
Icon = 0x12,
|
||||
EmphasisItalic = 0x1A,
|
||||
Interactable = 0x27,
|
||||
AutoTranslateKey = 0x2E,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@ namespace Dalamud.Game.Chat.SeStringHandling
|
|||
/// </summary>
|
||||
EmphasisItalic,
|
||||
/// <summary>
|
||||
/// An SeString payload representing a bitmap icon.
|
||||
/// </summary>
|
||||
Icon,
|
||||
/// <summary>
|
||||
/// An SeString payload representing any data we don't handle.
|
||||
/// </summary>
|
||||
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