chore: housekeeping — linter & formatter setup

Add .prettierrc.json, .markdownlint.json, .yamllint.yaml, .gitattributes
Run CSharpier, Prettier and markdownlint across the entire codebase.
No logic changes — formatting, using order and line endings only.
This commit is contained in:
2026-05-10 13:01:00 +02:00
parent cd01fa63a1
commit 699d4ede1d
141 changed files with 8833 additions and 5733 deletions
+182 -50
View File
@@ -1,8 +1,5 @@
using System.Numerics;
using HellionChat.Code;
using HellionChat.Resources;
using HellionChat.Ui;
using HellionChat.Util;
using Dalamud.Bindings.ImGui;
using Dalamud.Game.Addon.Lifecycle;
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
using Dalamud.Game.ClientState.Objects.SubKinds;
@@ -18,11 +15,14 @@ using Dalamud.Interface.Utility.Raii;
using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI;
using Dalamud.Bindings.ImGui;
using HellionChat.Code;
using HellionChat.Resources;
using HellionChat.Ui;
using HellionChat.Util;
using Lumina.Excel.Sheets;
using Action = System.Action;
using DalamudPartyFinderPayload = Dalamud.Game.Text.SeStringHandling.Payloads.PartyFinderPayload;
using ChatTwoPartyFinderPayload = HellionChat.Util.PartyFinderPayload;
using DalamudPartyFinderPayload = Dalamud.Game.Text.SeStringHandling.Payloads.PartyFinderPayload;
namespace HellionChat;
@@ -107,7 +107,9 @@ public sealed class PayloadHandler
ImGui.Separator();
var contentId = chunk.Message?.ContentId ?? 0;
var sender = chunk.Message?.Sender.Select(c => c.Link).FirstOrDefault(p => p is PlayerPayload) as PlayerPayload;
var sender =
chunk.Message?.Sender.Select(c => c.Link).FirstOrDefault(p => p is PlayerPayload)
as PlayerPayload;
using var menu = ImRaii.Menu(Language.Context_Integrations);
if (!menu.Success)
@@ -118,7 +120,14 @@ public sealed class PayloadHandler
{
try
{
LogWindow.Plugin.Ipc.Invoke(id, sender, contentId, payload, chunk.Message?.SenderSource, chunk.Message?.ContentSource);
LogWindow.Plugin.Ipc.Invoke(
id,
sender,
contentId,
payload,
chunk.Message?.SenderSource,
chunk.Message?.ContentSource
);
}
catch (Exception ex)
{
@@ -128,7 +137,10 @@ public sealed class PayloadHandler
if (cursor == ImGui.GetCursorPos())
{
using var pushedColor = ImRaii.PushColor(ImGuiCol.Text, ImGui.GetStyle().Colors[(int)ImGuiCol.TextDisabled]);
using var pushedColor = ImRaii.PushColor(
ImGuiCol.Text,
ImGui.GetStyle().Colors[(int)ImGuiCol.TextDisabled]
);
ImGui.Text("No integrations available");
}
}
@@ -168,10 +180,16 @@ public sealed class PayloadHandler
if (message.Sender.Count > 0 && ImGui.Selectable(Language.Context_CopyContent))
{
ImGui.SetClipboardText(StringifyMessage(message));
WrapperUtil.AddNotification(Language.Context_CopyContentSuccess, NotificationType.Info);
WrapperUtil.AddNotification(
Language.Context_CopyContentSuccess,
NotificationType.Info
);
}
using var pushedColor = ImRaii.PushColor(ImGuiCol.Text, ImGui.GetStyle().Colors[(int) ImGuiCol.TextDisabled]);
using var pushedColor = ImRaii.PushColor(
ImGuiCol.Text,
ImGui.GetStyle().Colors[(int)ImGuiCol.TextDisabled]
);
ImGui.TextUnformatted(message.Code.Type.Name());
}
@@ -184,7 +202,8 @@ public sealed class PayloadHandler
return string.Empty;
var chunks = withSender ? message.Sender.Concat(message.Content) : message.Content;
return chunks.Where(chunk => chunk is TextChunk)
return chunks
.Where(chunk => chunk is TextChunk)
.Cast<TextChunk>()
.Select(text => text.Content)
.Aggregate(string.Concat);
@@ -255,7 +274,10 @@ public sealed class PayloadHandler
public unsafe void MoveTooltip(AddonEvent type, AddonArgs args)
{
// Only move if the user has the "Next to Cursor" option selected
if (!Plugin.GameConfig.TryGet(UiControlOption.DetailTrackingType, out uint selected) || selected != 0)
if (
!Plugin.GameConfig.TryGet(UiControlOption.DetailTrackingType, out uint selected)
|| selected != 0
)
return;
if (LogWindow.LastViewport != ImGuiHelpers.MainViewport.Handle)
@@ -274,7 +296,10 @@ public sealed class PayloadHandler
var component = atkBase->WindowNode->AtkResNode;
var atkPos = new Vector2(component.ScreenX, component.ScreenY);
var atkSize = new Vector2(component.GetWidth() * component.ScaleX, component.GetHeight() * component.GetScaleY());
var atkSize = new Vector2(
component.GetWidth() * component.ScaleX,
component.GetHeight() * component.GetScaleY()
);
var chatRect = new MathUtil.Rectangle(LogWindow.LastWindowPos, LogWindow.LastWindowSize);
var addonRect = new MathUtil.Rectangle(atkPos, atkSize);
@@ -302,7 +327,7 @@ public sealed class PayloadHandler
if (!chatRect.HasOverlap(addonRect))
{
atkBase->SetPosition((short) addonRect.X, (short) addonRect.Y);
atkBase->SetPosition((short)addonRect.X, (short)addonRect.Y);
return;
}
@@ -320,7 +345,7 @@ public sealed class PayloadHandler
if (!chatRect.HasOverlap(addonRect))
{
atkBase->SetPosition((short) addonRect.X, (short) addonRect.Y);
atkBase->SetPosition((short)addonRect.X, (short)addonRect.Y);
return;
}
@@ -329,7 +354,7 @@ public sealed class PayloadHandler
var y = Math.Clamp(chatRect.SizeY - atkSize.Y, 0, float.MaxValue);
y -= isTop ? 0 : Plugin.Config.TooltipOffset; // offset to prevent cut-off on the bottom
atkBase->SetPosition((short) x, (short) y);
atkBase->SetPosition((short)x, (short)y);
}
private const float MaxInlineIconSize = 32f;
@@ -339,20 +364,25 @@ public sealed class PayloadHandler
if (icon.Size.X <= 0 || icon.Size.Y <= 0)
return;
var width = (float) icon.Size.X;
var height = (float) icon.Size.Y;
var width = (float)icon.Size.X;
var height = (float)icon.Size.Y;
var scale = Math.Min(1f, Math.Min(MaxInlineIconSize / width, MaxInlineIconSize / height));
var size = ImGuiHelpers.ScaledVector2(width * scale, height * scale);
var cursor = ImGui.GetCursorPos();
ImGui.Image(icon.Handle, size);
ImGui.SameLine();
ImGui.SetCursorPos(cursor + new Vector2(size.X + 4, size.Y - ImGui.GetTextLineHeightWithSpacing()));
ImGui.SetCursorPos(
cursor + new Vector2(size.X + 4, size.Y - ImGui.GetTextLineHeightWithSpacing())
);
}
private void HoverStatus(StatusPayload status)
{
if (Plugin.TextureProvider.GetFromGameIcon(status.Status.Value.Icon).GetWrapOrDefault() is { } icon)
if (
Plugin.TextureProvider.GetFromGameIcon(status.Status.Value.Icon).GetWrapOrDefault() is
{ } icon
)
InlineIcon(icon);
var builder = new SeStringBuilder();
@@ -374,7 +404,11 @@ public sealed class PayloadHandler
LogWindow.DrawChunks(name.ToList());
ImGui.Separator();
var desc = ChunkUtil.ToChunks(status.Status.Value.Description.ToDalamudString(), ChunkSource.None, null);
var desc = ChunkUtil.ToChunks(
status.Status.Value.Description.ToDalamudString(),
ChunkSource.None,
null
);
LogWindow.DrawChunks(desc.ToList());
}
@@ -389,14 +423,23 @@ public sealed class PayloadHandler
if (!item.Item.TryGetValue(out Item resolvedItem))
return;
if (Plugin.TextureProvider.GetFromGameIcon(new GameIconLookup(resolvedItem.Icon, item.IsHQ)).GetWrapOrDefault() is { } icon)
if (
Plugin
.TextureProvider.GetFromGameIcon(new GameIconLookup(resolvedItem.Icon, item.IsHQ))
.GetWrapOrDefault() is
{ } icon
)
InlineIcon(icon);
var name = ChunkUtil.ToChunks(resolvedItem.Name.ToDalamudString(), ChunkSource.None, null);
LogWindow.DrawChunks(name.ToList());
ImGui.Separator();
var desc = ChunkUtil.ToChunks(resolvedItem.Description.ToDalamudString(), ChunkSource.None, null);
var desc = ChunkUtil.ToChunks(
resolvedItem.Description.ToDalamudString(),
ChunkSource.None,
null
);
LogWindow.DrawChunks(desc.ToList());
}
@@ -405,7 +448,12 @@ public sealed class PayloadHandler
if (!Sheets.EventItemSheet.TryGetRow(payload.RawItemId, out var itemRow))
return;
if (Plugin.TextureProvider.GetFromGameIcon(new GameIconLookup(itemRow.Icon)).GetWrapOrDefault() is { } icon)
if (
Plugin
.TextureProvider.GetFromGameIcon(new GameIconLookup(itemRow.Icon))
.GetWrapOrDefault() is
{ } icon
)
InlineIcon(icon);
var name = ChunkUtil.ToChunks(itemRow.Name.ToDalamudString(), ChunkSource.None, null);
@@ -415,7 +463,11 @@ public sealed class PayloadHandler
if (!Sheets.EventItemHelpSheet.TryGetRow(payload.RawItemId, out var itemHelpRow))
return;
LogWindow.DrawChunks(ChunkUtil.ToChunks(itemHelpRow.Description.ToDalamudString(), ChunkSource.None, null).ToList());
LogWindow.DrawChunks(
ChunkUtil
.ToChunks(itemHelpRow.Description.ToDalamudString(), ChunkSource.None, null)
.ToList()
);
}
private void HoverUri(UriPayload uri)
@@ -438,7 +490,10 @@ public sealed class PayloadHandler
ClickLinkPayload(chunk, payload, link);
break;
case DalamudPartyFinderPayload pf:
if (pf.LinkType == DalamudPartyFinderPayload.PartyFinderLinkType.PartyFinderNotification)
if (
pf.LinkType
== DalamudPartyFinderPayload.PartyFinderLinkType.PartyFinderNotification
)
GameFunctions.GameFunctions.OpenPartyFinder();
else
GameFunctions.GameFunctions.OpenPartyFinder(pf.ListingId);
@@ -473,7 +528,12 @@ public sealed class PayloadHandler
return;
var payloads = source.Payloads.Skip(start).Take(end - start + 1).ToList();
if (!Plugin.ChatGui.RegisteredLinkHandlers.TryGetValue((link.Plugin, link.CommandId), out var value))
if (
!Plugin.ChatGui.RegisteredLinkHandlers.TryGetValue(
(link.Plugin, link.CommandId),
out var value
)
)
{
Plugin.Log.Warning("Could not find DalamudLinkHandlers");
return;
@@ -508,7 +568,12 @@ public sealed class PayloadHandler
return;
var hq = payload.Kind == ItemKind.Hq;
if (Plugin.TextureProvider.GetFromGameIcon(new GameIconLookup(itemRow.Icon, hq)).GetWrapOrDefault() is { } icon)
if (
Plugin
.TextureProvider.GetFromGameIcon(new GameIconLookup(itemRow.Icon, hq))
.GetWrapOrDefault() is
{ } icon
)
InlineIcon(icon);
var name = itemRow.Name.ToDalamudString();
@@ -554,10 +619,18 @@ public sealed class PayloadHandler
return;
var item = Sheets.EventItemSheet.GetRow(payload.ItemId);
if (Plugin.TextureProvider.GetFromGameIcon(new GameIconLookup(item.Icon)).GetWrapOrDefault() is { } icon)
if (
Plugin
.TextureProvider.GetFromGameIcon(new GameIconLookup(item.Icon))
.GetWrapOrDefault() is
{ } icon
)
InlineIcon(icon);
LogWindow.DrawChunks(ChunkUtil.ToChunks(item.Name.ToDalamudString(), ChunkSource.None, null).ToList(), false);
LogWindow.DrawChunks(
ChunkUtil.ToChunks(item.Name.ToDalamudString(), ChunkSource.None, null).ToList(),
false
);
ImGui.Separator();
var realItemId = payload.RawItemId;
@@ -585,7 +658,7 @@ public sealed class PayloadHandler
{
name.AddRange([
new IconChunk(ChunkSource.None, null, BitmapFontIcon.CrossWorld),
new TextChunk(ChunkSource.None, null, world.Value.Name.ExtractText())
new TextChunk(ChunkSource.None, null, world.Value.Name.ExtractText()),
]);
}
@@ -606,7 +679,15 @@ public sealed class PayloadHandler
}
else if (validContentId)
{
LogWindow.Plugin.Functions.Chat.SetEurekaTellChannel(player.PlayerName, world.Value.Name.ToString(), (ushort) world.RowId, 0, chunk.Message!.ContentId, 0, false);
LogWindow.Plugin.Functions.Chat.SetEurekaTellChannel(
player.PlayerName,
world.Value.Name.ToString(),
(ushort)world.RowId,
0,
chunk.Message!.ContentId,
0,
false
);
}
LogWindow.Activate = true;
@@ -615,12 +696,18 @@ public sealed class PayloadHandler
if (world.Value.IsPublic)
{
var party = Plugin.PartyList;
var leader = party[(int) party.PartyLeaderIndex]?.ContentId;
var leader = party[(int)party.PartyLeaderIndex]?.ContentId;
var isLeader = party.Length == 0 || Plugin.PlayerState.ContentId == leader;
var member = party.FirstOrDefault(member => member.Name.TextValue == player.PlayerName && member.World.RowId == world.RowId);
var member = party.FirstOrDefault(member =>
member.Name.TextValue == player.PlayerName && member.World.RowId == world.RowId
);
var isInParty = member != null;
var inInstance = GameFunctions.GameFunctions.IsInInstance();
var inPartyInstance = Sheets.TerritorySheet.GetRow(Plugin.ClientState.TerritoryType).TerritoryIntendedUse.RowId is (41 or 47 or 48 or 52 or 53 or 61);
var inPartyInstance =
Sheets
.TerritorySheet.GetRow(Plugin.ClientState.TerritoryType)
.TerritoryIntendedUse.RowId
is (41 or 47 or 48 or 52 or 53 or 61);
if (isLeader)
{
if (!isInParty)
@@ -636,10 +723,20 @@ public sealed class PayloadHandler
if (menu.Success)
{
if (ImGui.Selectable(Language.Context_InviteToParty_SameWorld))
GameFunctions.Party.InviteSameWorld(player.PlayerName, (ushort)world.RowId, chunk.Message?.ContentId ?? 0);
GameFunctions.Party.InviteSameWorld(
player.PlayerName,
(ushort)world.RowId,
chunk.Message?.ContentId ?? 0
);
if (validContentId && ImGui.Selectable(Language.Context_InviteToParty_DifferentWorld))
GameFunctions.Party.InviteOtherWorld(chunk.Message!.ContentId, (ushort)world.RowId);
if (
validContentId
&& ImGui.Selectable(Language.Context_InviteToParty_DifferentWorld)
)
GameFunctions.Party.InviteOtherWorld(
chunk.Message!.ContentId,
(ushort)world.RowId
);
}
}
}
@@ -654,23 +751,41 @@ public sealed class PayloadHandler
}
}
var isFriend = GameFunctions.GameFunctions.GetFriends().Any(friend => friend.NameString == player.PlayerName && friend.HomeWorld == world.RowId);
var isFriend = GameFunctions
.GameFunctions.GetFriends()
.Any(friend =>
friend.NameString == player.PlayerName && friend.HomeWorld == world.RowId
);
if (!isFriend && ImGui.Selectable(Language.Context_SendFriendRequest))
LogWindow.Plugin.Functions.SendFriendRequest(player.PlayerName, (ushort) world.RowId);
LogWindow.Plugin.Functions.SendFriendRequest(
player.PlayerName,
(ushort)world.RowId
);
using (var menuBlockFunctions = ImRaii.Menu(Language.Context_BlockFunctions))
{
if (menuBlockFunctions.Success)
{
if (ImGui.Selectable(Language.Context_AddToBlacklist))
LogWindow.Plugin.Functions.AddToBlacklist(player.PlayerName, (ushort)world.RowId);
LogWindow.Plugin.Functions.AddToBlacklist(
player.PlayerName,
(ushort)world.RowId
);
if (chunk.Message != null)
{
var message = chunk.Message;
if (message.AccountId != 0 && ImGui.Selectable(Language.Context_AddToMuteList))
LogWindow.Plugin.Functions.AddToMuteList(message.AccountId, message.ContentId, player.PlayerName, (short) world.RowId);
if (
message.AccountId != 0
&& ImGui.Selectable(Language.Context_AddToMuteList)
)
LogWindow.Plugin.Functions.AddToMuteList(
message.AccountId,
message.ContentId,
player.PlayerName,
(short)world.RowId
);
if (ImGui.Selectable(Language.Context_AddToTermsFilter))
LogWindow.Plugin.Functions.AddToTermsList(message.ContentSource);
@@ -678,8 +793,11 @@ public sealed class PayloadHandler
}
}
if (GameFunctions.GameFunctions.IsMentor() && ImGui.Selectable(Language.Context_InviteToNoviceNetwork))
GameFunctions.Context.InviteToNoviceNetwork(player.PlayerName, (ushort) world.RowId);
if (
GameFunctions.GameFunctions.IsMentor()
&& ImGui.Selectable(Language.Context_InviteToNoviceNetwork)
)
GameFunctions.Context.InviteToNoviceNetwork(player.PlayerName, (ushort)world.RowId);
}
var inputChannel = chunk.Message?.Code.Type.ToInputChannel();
@@ -694,7 +812,10 @@ public sealed class PayloadHandler
if (validContentId && ImGui.Selectable(Language.Context_AdventurerPlate))
if (!GameFunctions.GameFunctions.TryOpenAdventurerPlate(chunk.Message!.ContentId))
WrapperUtil.AddNotification(Language.Context_AdventurerPlateError, NotificationType.Warning);
WrapperUtil.AddNotification(
Language.Context_AdventurerPlateError,
NotificationType.Warning
);
}
private IPlayerCharacter? FindCharacterForPayload(PlayerPayload payload)
@@ -728,13 +849,21 @@ public sealed class PayloadHandler
if (ImGui.Selectable(Language.Context_CopyLink))
{
ImGui.SetClipboardText(uri.Uri.ToString());
WrapperUtil.AddNotification(Language.Context_CopyLinkNotification, NotificationType.Info);
WrapperUtil.AddNotification(
Language.Context_CopyLinkNotification,
NotificationType.Info
);
}
}
private void DrawStatusPopup(StatusPayload status)
{
if (Plugin.TextureProvider.GetFromGameIcon(new GameIconLookup(status.Status.Value.Icon)).GetWrapOrDefault() is { } icon)
if (
Plugin
.TextureProvider.GetFromGameIcon(new GameIconLookup(status.Status.Value.Icon))
.GetWrapOrDefault() is
{ } icon
)
InlineIcon(icon);
var builder = new SeStringBuilder();
@@ -752,7 +881,10 @@ public sealed class PayloadHandler
break;
}
LogWindow.DrawChunks(ChunkUtil.ToChunks(builder.BuiltString, ChunkSource.None, null).ToList(), false);
LogWindow.DrawChunks(
ChunkUtil.ToChunks(builder.BuiltString, ChunkSource.None, null).ToList(),
false
);
ImGui.Separator();
if (ImGui.Selectable(Language.Context_Link))