diff --git a/HellionChat/Integrations/HonorificService.cs b/HellionChat/Integrations/HonorificService.cs new file mode 100644 index 0000000..1e3f755 --- /dev/null +++ b/HellionChat/Integrations/HonorificService.cs @@ -0,0 +1,31 @@ +using Newtonsoft.Json; + +namespace HellionChat.Integrations; + +internal sealed class HonorificService +{ + // We pull Newtonsoft.Json into this single file for IPC compatibility: + // Honorific serialises with Newtonsoft (see Honorific-master/IpcProvider.cs:9 + // and CustomTitle.cs:12). Using the same library guarantees identical + // handling of System.Numerics.Vector3? and the enum fields we ignore. + // Newtonsoft is a transitive dependency via Dalamud, so no new NuGet + // entry is needed. The rest of HellionChat keeps using System.Text.Json. + + // Returns null when the JSON is empty (Honorific signals "no custom title" + // with string.Empty — see IpcProvider.cs:100), or when deserialisation + // throws (defensive: a malformed payload shouldn't crash the chat header). + internal static HonorificTitleData? ParseTitleJson(string json) + { + if (string.IsNullOrEmpty(json)) + return null; + + try + { + return JsonConvert.DeserializeObject(json); + } + catch (JsonException) + { + return null; + } + } +} diff --git a/HellionChat/Integrations/HonorificTitleData.cs b/HellionChat/Integrations/HonorificTitleData.cs new file mode 100644 index 0000000..3f67e32 --- /dev/null +++ b/HellionChat/Integrations/HonorificTitleData.cs @@ -0,0 +1,17 @@ +using System.Numerics; + +namespace HellionChat.Integrations; + +// Local DTO mirroring Honorific's TitleData shape. We replicate the structure +// instead of referencing Honorific.dll because a hard build-time dependency +// would couple the two assemblies and break HellionChat at load time when +// Honorific is missing. Glow, Color3, GradientColourSet and GradientAnimationStyle +// are intentionally omitted — Cycle 1 renders text in the primary Color only; +// the "Honorific Full Fidelity" backlog item adds them later as a pure +// extension that won't break this DTO's existing consumers. +internal sealed record HonorificTitleData( + string? Title, + bool IsPrefix, + bool IsOriginal, + Vector3? Color +);