feat(integrations): add HonorificTitleData DTO and ParseTitleJson
This commit is contained in:
@@ -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<HonorificTitleData>(json);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
);
|
||||
Reference in New Issue
Block a user