@@ -25,6 +25,11 @@ internal sealed unsafe class Context
|
|||||||
AgentChatLog.Instance()->LinkItem(itemId);
|
AgentChatLog.Instance()->LinkItem(itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void LinkStatus(uint statusId)
|
||||||
|
{
|
||||||
|
AgentChatLog.Instance()->ContextStatusId = statusId;
|
||||||
|
}
|
||||||
|
|
||||||
internal static void OpenItemComparison(uint itemId)
|
internal static void OpenItemComparison(uint itemId)
|
||||||
{
|
{
|
||||||
AgentItemComp.Instance()->CompareItem(0x4D, itemId, 0, 0);
|
AgentItemComp.Instance()->CompareItem(0x4D, itemId, 0, 0);
|
||||||
|
|||||||
+28
-6
@@ -5,6 +5,7 @@ using Dalamud.Game.Text.SeStringHandling;
|
|||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Dalamud.Game.Text;
|
using Dalamud.Game.Text;
|
||||||
|
using Dalamud.Utility;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||||
using Lumina.Excel.Sheets;
|
using Lumina.Excel.Sheets;
|
||||||
|
|
||||||
@@ -265,14 +266,15 @@ internal partial class Message
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!text.Content.Contains("<item>") && !text.Content.Contains("<flag>"))
|
var splits = TextParamRegex().Split(text.Content);
|
||||||
|
if (splits.Length == 1)
|
||||||
{
|
{
|
||||||
newChunks.Add(chunk);
|
newChunks.Add(chunk);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var nextIsMatch = false;
|
var nextIsMatch = false;
|
||||||
foreach (var split in TextParamRegex().Split(text.Content))
|
foreach (var split in splits)
|
||||||
{
|
{
|
||||||
if (split == "" || !nextIsMatch)
|
if (split == "" || !nextIsMatch)
|
||||||
{
|
{
|
||||||
@@ -304,13 +306,33 @@ internal partial class Message
|
|||||||
};
|
};
|
||||||
|
|
||||||
var name = kind != ItemPayload.ItemKind.EventItem
|
var name = kind != ItemPayload.ItemKind.EventItem
|
||||||
? Plugin.DataManager.GetExcelSheet<Item>()!.GetRow(item.ItemId)!.Name.ToString()
|
? Plugin.DataManager.GetExcelSheet<Item>().GetRow(item.ItemId).Name.ToString()
|
||||||
: Plugin.DataManager.GetExcelSheet<EventItem>()!.GetRow(item.ItemId)!.Name.ToString();
|
: Plugin.DataManager.GetExcelSheet<EventItem>().GetRow(item.ItemId).Name.ToString();
|
||||||
|
|
||||||
var link = new ItemPayload(item.ItemId, kind, $"{SeIconChar.LinkMarker.ToIconChar()}{name}");
|
var link = new ItemPayload(item.ItemId, kind, $"{SeIconChar.LinkMarker.ToIconChar()}{name}");
|
||||||
AddChunkWithMessage(text.NewWithStyle(chunk.Source, link, link.DisplayName ?? "Unknown"));
|
AddChunkWithMessage(text.NewWithStyle(chunk.Source, link, link.DisplayName ?? "Unknown"));
|
||||||
}
|
}
|
||||||
else
|
else if (split == "<status>")
|
||||||
|
{
|
||||||
|
var statusId = AgentChatLog.Instance()->ContextStatusId;
|
||||||
|
if (statusId == 0 || !Sheets.StatusSheet.TryGetRow(statusId, out var statusRow))
|
||||||
|
{
|
||||||
|
AddChunkWithMessage(text.NewWithStyle(chunk.Source, chunk.Link, split));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var nameValue = statusRow.Name.ToDalamudString().TextValue;
|
||||||
|
var content = statusRow.StatusCategory switch
|
||||||
|
{
|
||||||
|
1 => $"{SeIconChar.Buff.ToIconString()}{nameValue}",
|
||||||
|
2 => $"{SeIconChar.Debuff.ToIconString()}{nameValue}",
|
||||||
|
_ => nameValue
|
||||||
|
};
|
||||||
|
|
||||||
|
var link = new StatusPayload(statusId);
|
||||||
|
AddChunkWithMessage(text.NewWithStyle(chunk.Source, link, content));
|
||||||
|
}
|
||||||
|
else if (split == "<flag>")
|
||||||
{
|
{
|
||||||
var agentMap = AgentMap.Instance();
|
var agentMap = AgentMap.Instance();
|
||||||
if (agentMap->IsFlagMarkerSet == 0)
|
if (agentMap->IsFlagMarkerSet == 0)
|
||||||
@@ -339,6 +361,6 @@ internal partial class Message
|
|||||||
Content = newChunks;
|
Content = newChunks;
|
||||||
}
|
}
|
||||||
|
|
||||||
[GeneratedRegex("(<item>|<flag>)")]
|
[GeneratedRegex("(<item>|<flag>|<status>)")]
|
||||||
private static partial Regex TextParamRegex();
|
private static partial Regex TextParamRegex();
|
||||||
}
|
}
|
||||||
|
|||||||
+52
-13
@@ -7,6 +7,7 @@ using Dalamud.Game.Addon.Lifecycle;
|
|||||||
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
|
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
|
||||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||||
using Dalamud.Game.Config;
|
using Dalamud.Game.Config;
|
||||||
|
using Dalamud.Game.Text;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
using Dalamud.Interface.ImGuiNotification;
|
using Dalamud.Interface.ImGuiNotification;
|
||||||
@@ -15,7 +16,6 @@ using Dalamud.Interface.Textures.TextureWraps;
|
|||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using FFXIVClientStructs.FFXIV.Client.LayoutEngine;
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
@@ -89,6 +89,10 @@ public sealed class PayloadHandler
|
|||||||
DrawUriPopup(uri);
|
DrawUriPopup(uri);
|
||||||
drawn = true;
|
drawn = true;
|
||||||
break;
|
break;
|
||||||
|
case StatusPayload status:
|
||||||
|
DrawStatusPopup(status);
|
||||||
|
drawn = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextFooter(drawn, chunk);
|
ContextFooter(drawn, chunk);
|
||||||
@@ -293,26 +297,31 @@ public sealed class PayloadHandler
|
|||||||
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 static unsafe SeString ResolveRsv(SeString input)
|
|
||||||
{
|
|
||||||
var txt = input.TextValue;
|
|
||||||
if (txt.StartsWith("_rsv_"))
|
|
||||||
input = SeString.Parse(LayoutWorld.Instance()->ResolveRsvString(txt));
|
|
||||||
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HoverStatus(StatusPayload status)
|
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);
|
InlineIcon(icon);
|
||||||
|
|
||||||
var nameString = ResolveRsv(status.Status.Value.Name.ToDalamudString());
|
var builder = new SeStringBuilder();
|
||||||
var name = ChunkUtil.ToChunks(nameString, ChunkSource.None, null);
|
var nameValue = status.Status.Value.Name.ToDalamudString().TextValue;
|
||||||
|
switch (status.Status.Value.StatusCategory)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
builder.AddUiForeground($"{SeIconChar.Buff.ToIconString()}{nameValue}", 517);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
builder.AddUiForeground($"{SeIconChar.Debuff.ToIconString()}{nameValue}", 518);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
builder.AddUiForeground(nameValue, 1);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
|
var name = ChunkUtil.ToChunks(builder.BuiltString, ChunkSource.None, null);
|
||||||
LogWindow.DrawChunks(name.ToList());
|
LogWindow.DrawChunks(name.ToList());
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
var descString = ResolveRsv(status.Status.Value.Description.ToDalamudString());
|
var descString = status.Status.Value.Description.ToDalamudString();
|
||||||
var desc = ChunkUtil.ToChunks(descString, ChunkSource.None, null);
|
var desc = ChunkUtil.ToChunks(descString, ChunkSource.None, null);
|
||||||
LogWindow.DrawChunks(desc.ToList());
|
LogWindow.DrawChunks(desc.ToList());
|
||||||
}
|
}
|
||||||
@@ -652,4 +661,34 @@ public sealed class PayloadHandler
|
|||||||
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)
|
||||||
|
InlineIcon(icon);
|
||||||
|
|
||||||
|
var builder = new SeStringBuilder();
|
||||||
|
var nameValue = status.Status.Value.Name.ToDalamudString().TextValue;
|
||||||
|
switch (status.Status.Value.StatusCategory)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
builder.AddUiForeground($"{SeIconChar.Buff.ToIconString()}{nameValue}", 517);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
builder.AddUiForeground($"{SeIconChar.Debuff.ToIconString()}{nameValue}", 518);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
builder.AddUiForeground(nameValue, 1);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
|
LogWindow.DrawChunks(ChunkUtil.ToChunks(builder.BuiltString, ChunkSource.None, null).ToList(), false);
|
||||||
|
ImGui.Separator();
|
||||||
|
|
||||||
|
if (ImGui.Selectable(Language.Context_Link))
|
||||||
|
{
|
||||||
|
GameFunctions.Context.LinkStatus(status.Status.RowId);
|
||||||
|
LogWindow.Chat += " <status>";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public static class Sheets
|
|||||||
{
|
{
|
||||||
public static readonly ExcelSheet<Item> ItemSheet;
|
public static readonly ExcelSheet<Item> ItemSheet;
|
||||||
public static readonly ExcelSheet<World> WorldSheet;
|
public static readonly ExcelSheet<World> WorldSheet;
|
||||||
|
public static readonly ExcelSheet<Status> StatusSheet;
|
||||||
public static readonly ExcelSheet<LogFilter> LogFilterSheet;
|
public static readonly ExcelSheet<LogFilter> LogFilterSheet;
|
||||||
public static readonly ExcelSheet<EventItem> EventItemSheet;
|
public static readonly ExcelSheet<EventItem> EventItemSheet;
|
||||||
public static readonly ExcelSheet<Completion> CompletionSheet;
|
public static readonly ExcelSheet<Completion> CompletionSheet;
|
||||||
@@ -18,6 +19,7 @@ public static class Sheets
|
|||||||
{
|
{
|
||||||
ItemSheet = Plugin.DataManager.GetExcelSheet<Item>();
|
ItemSheet = Plugin.DataManager.GetExcelSheet<Item>();
|
||||||
WorldSheet = Plugin.DataManager.GetExcelSheet<World>();
|
WorldSheet = Plugin.DataManager.GetExcelSheet<World>();
|
||||||
|
StatusSheet = Plugin.DataManager.GetExcelSheet<Status>();
|
||||||
EventItemSheet = Plugin.DataManager.GetExcelSheet<EventItem>();
|
EventItemSheet = Plugin.DataManager.GetExcelSheet<EventItem>();
|
||||||
LogFilterSheet = Plugin.DataManager.GetExcelSheet<LogFilter>();
|
LogFilterSheet = Plugin.DataManager.GetExcelSheet<LogFilter>();
|
||||||
CompletionSheet = Plugin.DataManager.GetExcelSheet<Completion>();
|
CompletionSheet = Plugin.DataManager.GetExcelSheet<Completion>();
|
||||||
|
|||||||
Reference in New Issue
Block a user