Shorten quest names if too long

pull/14/head
Liza 2024-07-30 04:45:23 +02:00
parent f533ca673f
commit aa0c0b6757
Signed by: liza
GPG Key ID: 7199F8D727D55F67
1 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,7 @@
using System.Globalization;
using System.Linq;
using System.Numerics;
using Dalamud.Game.Text;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
@ -103,7 +104,7 @@ internal sealed class ActiveQuestComponent
{
using var _ = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
ImGui.TextUnformatted(
$"Simulated Quest: {currentQuest.Quest.Info.Name} / {currentQuest.Sequence} / {currentQuest.Step}");
$"Simulated Quest: {Shorten(currentQuest.Quest.Info.Name)} / {currentQuest.Sequence} / {currentQuest.Step}");
}
else
{
@ -111,7 +112,7 @@ internal sealed class ActiveQuestComponent
if (startedQuest != null)
{
ImGui.TextUnformatted(
$"Quest: {startedQuest.Quest.Info.Name} / {startedQuest.Sequence} / {startedQuest.Step}");
$"Quest: {Shorten(startedQuest.Quest.Info.Name)} / {startedQuest.Sequence} / {startedQuest.Step}");
if (startedQuest.Quest.Root.Disabled)
{
@ -133,7 +134,7 @@ internal sealed class ActiveQuestComponent
{
using var _ = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
ImGui.TextUnformatted(
$"Next Quest: {currentQuest.Quest.Info.Name} / {currentQuest.Sequence} / {currentQuest.Step}");
$"Next Quest: {Shorten(currentQuest.Quest.Info.Name)} / {currentQuest.Sequence} / {currentQuest.Step}");
}
}
}
@ -363,4 +364,12 @@ internal sealed class ActiveQuestComponent
}
}
}
private static string Shorten(string text)
{
if (text.Length > 35)
return string.Concat(text.AsSpan(0, 35).Trim(), ((SeIconChar)57434).ToIconString());
return text;
}
}