public void ChatOnChatMessage(XivChatType type, uint senderid, ref SeString sender, ref SeString message, ref bool ishandled) { if (!Visible && !Plugin.Config.LinkTrackerAlwaysActive) { return; } foreach (var payload in message.Payloads) { if (!(payload is MapLinkPayload mapLink)) { continue; } var link = new MapLink(Plugin, type, mapLink, sender.TextValue, message); if (link.HasAetheryte) { MapLinks.Add(link); if (Plugin.Config.LinkTrackerAutoPop) { Visible = true; } } } }
private void DrawLinkList() { if (ImGui.Button("Clear")) { MapLinks.Clear(); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Remove ALL links from the list."); } ImGui.SameLine(); if (ImGui.Button("Restore")) { if (UndoLinkStack.Count > 0) { MapLinks.Add(UndoLinkStack.Pop()); } } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Restore deleted links. (Does not undo a Clear)"); } ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Double Click = Teleport to closest Aetheryte\n" + "Shift + Left Click = Set a flag on the Map.\n" + "Shift + Right Click = Delete Link from the list"); } ImGui.BeginChild("##scrollingregion"); ImGui.Columns(3, "##listbox"); ImGui.Separator(); ImGui.Text("Sender"); ImGui.NextColumn(); ImGui.Text("Location"); ImGui.NextColumn(); ImGui.Text("Chat"); ImGui.NextColumn(); ImGui.Separator(); var mapLinks = MapLinks.Reverse().ToArray(); for (var i = 0; i < mapLinks.Length; i++) { var link = mapLinks[i]; if (ImGui.Selectable($"{link.SenderName}", _selectedLink == i, ImGuiSelectableFlags.SpanAllColumns)) { _selectedLink = i; } if (ImGui.IsItemHovered()) { if (ImGui.IsMouseDoubleClicked(0)) { if (link.HasAetheryte) { if (Plugin.Config.LinkTrackerUseTickets) { Plugin.CommandHandler("/tpt", link.Aetheryte.Name); } else { Plugin.CommandHandler("/tp", link.Aetheryte.Name); } } else { Plugin.LogError($"No Aetheryte found for: {link}"); } } else if (ImGui.IsMouseClicked(0) && IsShiftKeyPressed()) { link.OpenOnMap(); } else if (ImGui.IsMouseClicked(1) && IsShiftKeyPressed()) { UndoLinkStack.Push(link); MapLinks.Remove(link); } ImGui.SetTooltip(link.Message); } ImGui.NextColumn(); ImGui.Text(link.ToString()); ImGui.NextColumn(); ImGui.Text($"{link.GetTypeString()}"); ImGui.NextColumn(); } ImGui.EndChild(); ImGui.Columns(1); }