mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
XivChatEntry should use SeString
This commit is contained in:
parent
85113e263f
commit
5c4ed3f715
7 changed files with 27 additions and 16 deletions
|
|
@ -257,7 +257,7 @@ namespace Dalamud.Game
|
|||
{
|
||||
this.dalamud.Framework.Gui.Chat.PrintChat(new XivChatEntry
|
||||
{
|
||||
MessageBytes = Encoding.UTF8.GetBytes(Loc.Localize("DalamudUpdated", "The In-Game addon has been updated or was reinstalled successfully! Please check the discord for a full changelog.")),
|
||||
Message = Loc.Localize("DalamudUpdated", "The In-Game addon has been updated or was reinstalled successfully! Please check the discord for a full changelog."),
|
||||
Type = XivChatType.Notice,
|
||||
});
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ namespace Dalamud.Game
|
|||
{
|
||||
this.dalamud.Framework.Gui.Chat.PrintChat(new XivChatEntry
|
||||
{
|
||||
MessageBytes = new SeString(new List<Payload>()
|
||||
Message = new SeString(new List<Payload>()
|
||||
{
|
||||
new TextPayload(Loc.Localize("DalamudPluginUpdateRequired", "One or more of your plugins needs to be updated. Please use the /xlplugins command in-game to update them!")),
|
||||
new TextPayload(" ["),
|
||||
|
|
@ -299,7 +299,7 @@ namespace Dalamud.Game
|
|||
RawPayload.LinkTerminator,
|
||||
new UIForegroundPayload(this.dalamud.Data, 0),
|
||||
new TextPayload("]"),
|
||||
}).Encode(),
|
||||
}),
|
||||
Type = XivChatType.Urgent,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ namespace Dalamud.Game.Internal.Gui
|
|||
Log.Verbose("[CHATGUI PRINT REGULAR]{0}", message);
|
||||
this.PrintChat(new XivChatEntry
|
||||
{
|
||||
MessageBytes = Encoding.UTF8.GetBytes(message),
|
||||
Message = message,
|
||||
Type = this.dalamud.Configuration.GeneralChatType,
|
||||
});
|
||||
}
|
||||
|
|
@ -199,7 +199,7 @@ namespace Dalamud.Game.Internal.Gui
|
|||
Log.Verbose("[CHATGUI PRINT SESTRING]{0}", message.TextValue);
|
||||
this.PrintChat(new XivChatEntry
|
||||
{
|
||||
MessageBytes = message.Encode(),
|
||||
Message = message,
|
||||
Type = this.dalamud.Configuration.GeneralChatType,
|
||||
});
|
||||
}
|
||||
|
|
@ -214,7 +214,7 @@ namespace Dalamud.Game.Internal.Gui
|
|||
Log.Verbose("[CHATGUI PRINT REGULAR ERROR]{0}", message);
|
||||
this.PrintChat(new XivChatEntry
|
||||
{
|
||||
MessageBytes = Encoding.UTF8.GetBytes(message),
|
||||
Message = message,
|
||||
Type = XivChatType.Urgent,
|
||||
});
|
||||
}
|
||||
|
|
@ -229,7 +229,7 @@ namespace Dalamud.Game.Internal.Gui
|
|||
Log.Verbose("[CHATGUI PRINT SESTRING ERROR]{0}", message.TextValue);
|
||||
this.PrintChat(new XivChatEntry
|
||||
{
|
||||
MessageBytes = message.Encode(),
|
||||
Message = message,
|
||||
Type = XivChatType.Urgent,
|
||||
});
|
||||
}
|
||||
|
|
@ -249,10 +249,10 @@ namespace Dalamud.Game.Internal.Gui
|
|||
continue;
|
||||
}
|
||||
|
||||
var senderRaw = Encoding.UTF8.GetBytes(chat.Name ?? string.Empty);
|
||||
var senderRaw = (chat.Name ?? string.Empty).Encode();
|
||||
using var senderOwned = framework.Libc.NewString(senderRaw);
|
||||
|
||||
var messageRaw = chat.MessageBytes ?? Array.Empty<byte>();
|
||||
var messageRaw = (chat.Message ?? string.Empty).Encode();
|
||||
using var messageOwned = framework.Libc.NewString(messageRaw);
|
||||
|
||||
this.HandlePrintMessageDetour(this.baseAddress, chat.Type, senderOwned.Address, messageOwned.Address, chat.SenderId, chat.Parameters);
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ namespace Dalamud.Game.Text.SeStringHandling
|
|||
EmphasisItalic = 0x1A,
|
||||
|
||||
/// <summary>
|
||||
/// See the <see cref="NewLinePayload"/>
|
||||
/// See the <see cref="NewLinePayload"/>.
|
||||
/// </summary>
|
||||
NewLine = 0x10,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Dalamud.Game.Text.SeStringHandling.Payloads
|
||||
|
|
@ -16,7 +16,7 @@ namespace Dalamud.Game.Text.SeStringHandling.Payloads
|
|||
public static NewLinePayload Payload => new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the text of this payload, evaluates to <c>Environment.NewLine</c>
|
||||
/// Gets the text of this payload, evaluates to <c>Environment.NewLine</c>.
|
||||
/// </summary>
|
||||
public string Text => Environment.NewLine;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,15 @@ namespace Dalamud.Game.Text.SeStringHandling
|
|||
/// </summary>
|
||||
public class SeString
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SeString"/> class.
|
||||
/// Creates a new SeString from an ordered list of payloads.
|
||||
/// </summary>
|
||||
public SeString()
|
||||
{
|
||||
this.Payloads = new List<Payload>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SeString"/> class.
|
||||
/// Creates a new SeString from an ordered list of payloads.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
|
||||
namespace Dalamud.Game.Text
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -20,12 +22,12 @@ namespace Dalamud.Game.Text
|
|||
/// <summary>
|
||||
/// Gets or sets the sender name.
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public SeString Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the message bytes.
|
||||
/// Gets or sets the message.
|
||||
/// </summary>
|
||||
public byte[] MessageBytes { get; set; }
|
||||
public SeString Message { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the message parameters.
|
||||
|
|
|
|||
|
|
@ -727,7 +727,7 @@ namespace Dalamud.Plugin.Internal
|
|||
{
|
||||
this.dalamud.Framework.Gui.Chat.PrintChat(new XivChatEntry
|
||||
{
|
||||
MessageBytes = Encoding.UTF8.GetBytes(Locs.DalamudPluginUpdateFailed(metadata.Name, metadata.Version)),
|
||||
Message = Locs.DalamudPluginUpdateFailed(metadata.Name, metadata.Version),
|
||||
Type = XivChatType.Urgent,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue