Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support unknown macrocode in sestring spans and support ruby payload #89

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/ReadOnlySePayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ public ReadOnlySePayload( ReadOnlySePayloadType type, MacroCode macroCode, ReadO
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
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
Loading