Skip to content

Commit

Permalink
Support unknown macrocode in sestring spans and support ruby payload
Browse files Browse the repository at this point in the history
  • Loading branch information
Soreepeong committed Aug 18, 2024
1 parent e99b736 commit 0285dde
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/Lumina/Text/Payloads/MacroCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ public enum MacroCode : byte
/// <remarks>Parameters: row ID in UIColor sheet or 0 to pop(or reset?) the pushed color, terminator.</remarks>
[MacroCodeData( null, "n x" )] EdgeColorType = 0x49,

/// <summary>Displays ruby text (furigana, interlinear annotation) above standard text.</summary>
/// <remarks>
/// <para>Parameters: standard text, ruby text.</para>
/// <para>Name of this payload is not defined in the client.</para>
/// </remarks>
[MacroCodeData(null, "s s")] Ruby = 0x4A,

/// <summary>Adds a zero-padded number as text.</summary>
/// <remarks>Parameters: integer expression, target length, terminator.</remarks>
[MacroCodeData( null, "n n x" )] Digit = 0x50,
Expand Down
10 changes: 8 additions & 2 deletions src/Lumina/Text/ReadOnly/ReadOnlySePayloadSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 0285dde

Please sign in to comment.