fix: process pf strings as sestrings
This commit is contained in:
parent
4e90f8f4f4
commit
df604139a5
|
@ -217,7 +217,11 @@ namespace NoSoliciting {
|
|||
continue;
|
||||
}
|
||||
|
||||
var desc = listing.Description();
|
||||
var rawName = listing.Name(this.Plugin.Interface.SeStringManager);
|
||||
var rawDesc = listing.Description(this.Plugin.Interface.SeStringManager);
|
||||
|
||||
var name = rawName.TextValue;
|
||||
var desc = rawDesc.TextValue;
|
||||
|
||||
string? reason = null;
|
||||
|
||||
|
@ -245,8 +249,8 @@ namespace NoSoliciting {
|
|||
this.Plugin.AddPartyFinderHistory(new Message(
|
||||
this.Plugin.MlFilter.Version,
|
||||
ChatType.None,
|
||||
listing.Name(),
|
||||
listing.Description(),
|
||||
rawName,
|
||||
rawDesc,
|
||||
true,
|
||||
reason
|
||||
));
|
||||
|
@ -259,7 +263,7 @@ namespace NoSoliciting {
|
|||
packet.listings[i] = new PfListing();
|
||||
|
||||
if (this.Plugin.Config.LogFilteredPfs) {
|
||||
PluginLog.Log($"Filtered PF listing from {listing.Name()} ({reason}): {listing.Description()}");
|
||||
PluginLog.Log($"Filtered PF listing from {name} ({reason}): {desc}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,7 +305,11 @@ namespace NoSoliciting {
|
|||
continue;
|
||||
}
|
||||
|
||||
var desc = listing.Description();
|
||||
var rawName = listing.Name(this.Plugin.Interface.SeStringManager);
|
||||
var rawDesc = listing.Description(this.Plugin.Interface.SeStringManager);
|
||||
|
||||
var name = rawName.TextValue;
|
||||
var desc = rawDesc.TextValue;
|
||||
|
||||
string? reason = null;
|
||||
var filter = false;
|
||||
|
@ -325,8 +333,8 @@ namespace NoSoliciting {
|
|||
this.Plugin.AddPartyFinderHistory(new Message(
|
||||
this.Plugin.Definitions.Version,
|
||||
ChatType.None,
|
||||
listing.Name(),
|
||||
listing.Description(),
|
||||
rawName,
|
||||
rawDesc,
|
||||
false,
|
||||
reason
|
||||
));
|
||||
|
@ -339,7 +347,7 @@ namespace NoSoliciting {
|
|||
packet.listings[i] = new PfListing();
|
||||
|
||||
if (this.Plugin.Config.LogFilteredPfs) {
|
||||
PluginLog.Log($"Filtered PF listing from {listing.Name()} ({reason}): {listing.Description()}");
|
||||
PluginLog.Log($"Filtered PF listing from {name} ({reason}): {desc}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Dalamud.Game.Chat.SeStringHandling;
|
||||
|
||||
namespace NoSoliciting {
|
||||
public static class PacketInfo {
|
||||
|
@ -95,17 +96,17 @@ namespace NoSoliciting {
|
|||
// 160 (0xA0) with name (32 bytes/0x20)
|
||||
// 352 (0x160) with both (192 bytes/0xC0)
|
||||
|
||||
private static string HandleString(IEnumerable<byte> bytes) {
|
||||
private static SeString HandleString(SeStringManager manager, IEnumerable<byte> bytes) {
|
||||
var nonNull = bytes.TakeWhile(b => b != 0).ToArray();
|
||||
return Encoding.UTF8.GetString(nonNull);
|
||||
return manager.Parse(nonNull);
|
||||
}
|
||||
|
||||
internal string Name() {
|
||||
return HandleString(this.name);
|
||||
internal SeString Name(SeStringManager manager) {
|
||||
return HandleString(manager, this.name);
|
||||
}
|
||||
|
||||
internal string Description() {
|
||||
return HandleString(this.description);
|
||||
internal SeString Description(SeStringManager manager) {
|
||||
return HandleString(manager, this.description);
|
||||
}
|
||||
|
||||
internal bool IsNull() {
|
||||
|
|
Loading…
Reference in New Issue