From 0285dde27417bdd5aa344d10a85bf3b070469e03 Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Sun, 18 Aug 2024 23:32:48 +0900 Subject: [PATCH] Support unknown macrocode in sestring spans and support ruby payload --- src/Lumina/Text/Payloads/MacroCode.cs | 7 +++++++ src/Lumina/Text/ReadOnly/ReadOnlySePayloadSpan.cs | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Lumina/Text/Payloads/MacroCode.cs b/src/Lumina/Text/Payloads/MacroCode.cs index 657604d2..54eddcd2 100644 --- a/src/Lumina/Text/Payloads/MacroCode.cs +++ b/src/Lumina/Text/Payloads/MacroCode.cs @@ -184,6 +184,13 @@ public enum MacroCode : byte /// Parameters: row ID in UIColor sheet or 0 to pop(or reset?) the pushed color, terminator. [MacroCodeData( null, "n x" )] EdgeColorType = 0x49, + /// Displays ruby text (furigana, interlinear annotation) above standard text. + /// + /// Parameters: standard text, ruby text. + /// Name of this payload is not defined in the client. + /// + [MacroCodeData(null, "s s")] Ruby = 0x4A, + /// Adds a zero-padded number as text. /// Parameters: integer expression, target length, terminator. [MacroCodeData( null, "n n x" )] Digit = 0x50, diff --git a/src/Lumina/Text/ReadOnly/ReadOnlySePayloadSpan.cs b/src/Lumina/Text/ReadOnly/ReadOnlySePayloadSpan.cs index 4a016952..f0fb960f 100644 --- a/src/Lumina/Text/ReadOnly/ReadOnlySePayloadSpan.cs +++ b/src/Lumina/Text/ReadOnly/ReadOnlySePayloadSpan.cs @@ -39,8 +39,14 @@ public ReadOnlySePayloadSpan( ReadOnlySePayloadType type, MacroCode macroCode, R throw new ArgumentOutOfRangeException( nameof( macroCode ), macroCode, "MacroCode may not be defined if the payload is of text type." ); break; case ReadOnlySePayloadType.Macro: - if( !Enum.IsDefined( macroCode ) || macroCode == 0 ) - throw new ArgumentOutOfRangeException( nameof( macroCode ), macroCode, null ); + if( macroCode == default ) + throw new ArgumentOutOfRangeException( nameof( macroCode ), macroCode, "MacroCode must be defined if the payload is of macro type." ); + if( (byte) macroCode >= 0xCF ) + { + throw new ArgumentOutOfRangeException( nameof( macroCode ), macroCode, + "Whether MacroCode is an integer expression is unknown. Change it when it happens." ); + } + break; default: throw new ArgumentOutOfRangeException( nameof( type ), type, null );