- Replace all possible hooks with CS

- Mark ones that can be replaced soon
- Use Dalamuds ConfigOption for chat color parsing
This commit is contained in:
Infi
2024-05-25 16:50:37 +02:00
parent 8aaaa684a2
commit 0c19772b18
10 changed files with 104 additions and 109 deletions
+2 -2
View File
@@ -675,7 +675,7 @@ public sealed class ChatLogWindow : Window
}
var normalColor = ImGui.GetColorU32(ImGuiCol.Text);
var inputColour = Plugin.Config.ChatColours.TryGetValue(inputType, out var inputCol) ? inputCol : inputType.DefaultColour();
var inputColour = Plugin.Config.ChatColours.TryGetValue(inputType, out var inputCol) ? inputCol : inputType.DefaultColor();
if (!isCommand && Plugin.ExtraChat.ChannelOverride is var (_, overrideColour))
inputColour = overrideColour;
@@ -1583,7 +1583,7 @@ public sealed class ChatLogWindow : Window
if (colour == null && text.FallbackColour != null)
{
var type = text.FallbackColour.Value;
colour = Plugin.Config.ChatColours.TryGetValue(type, out var col) ? col : type.DefaultColour();
colour = Plugin.Config.ChatColours.TryGetValue(type, out var col) ? col : type.DefaultColor();
}
var push = colour != null;
+8 -3
View File
@@ -178,6 +178,7 @@ public partial class InputPreview : Window
NextChunkIsAutoTranslate = true;
// TODO: Remove after Key and Group in AutoTranslatePayload became public
// Skipping: StartByte, PayloadType, PayloadLength
using var reader = new BinaryReader(new MemoryStream(chunk.Link!.Encode().Skip(3).ToArray()));
var group = (uint) reader.ReadByte();
@@ -199,7 +200,7 @@ public partial class InputPreview : Window
if (ImGui.GetContentRegionAvail().X < emoteSize.X)
ImGui.NewLine();
// We only draw a dummy if it is still loading, in the case it failed we draw the actual name
// We only draw a dummy if it is still loading, in case it failed, we draw the actual name
var image = EmoteCache.GetEmote(emotePayload.Code);
if (image is { Failed: false })
{
@@ -216,11 +217,15 @@ public partial class InputPreview : Window
}
}
if (text.Link != null || NextChunkIsAutoTranslate)
if (NextChunkIsAutoTranslate)
{
NextChunkIsAutoTranslate = false;
ImGuiUtil.WrapText(text.Content, chunk, handler, LogWindow.DefaultText, lineWidth);
return;
}
if (text.Link != null)
{
if (text.Link is ItemPayload)
CursorPosition += "<item>".Length;
else if (text.Link is MapLinkPayload)
+3 -3
View File
@@ -50,15 +50,15 @@ internal sealed class ChatColours : ISettingsTab
if (ImGuiUtil.IconButton(FontAwesomeIcon.LongArrowAltDown, $"{type}", Language.Options_ChatColours_Import))
{
var gameColour = Plugin.Functions.Chat.GetChannelColour(type);
Mutable.ChatColours[type] = gameColour ?? type.DefaultColour() ?? 0;
var gameColour = Plugin.Functions.Chat.GetChannelColor(type);
Mutable.ChatColours[type] = gameColour ?? type.DefaultColor() ?? 0;
}
ImGui.SameLine();
var vec = Mutable.ChatColours.TryGetValue(type, out var colour)
? ColourUtil.RgbaToVector3(colour)
: ColourUtil.RgbaToVector3(type.DefaultColour() ?? 0);
: ColourUtil.RgbaToVector3(type.DefaultColor() ?? 0);
if (ImGui.ColorEdit3(type.Name(), ref vec, ImGuiColorEditFlags.NoInputs))
Mutable.ChatColours[type] = ColourUtil.Vector3ToRgba(vec);
}