From 9d06ee7250b15d6827134b33c52c4212f19e4f72 Mon Sep 17 00:00:00 2001 From: Anna Date: Sat, 10 Sep 2022 10:14:12 -0400 Subject: [PATCH] try a thing --- client/Ui/MainWindowTabs/MessageList.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/client/Ui/MainWindowTabs/MessageList.cs b/client/Ui/MainWindowTabs/MessageList.cs index c961cc5..c60fb73 100644 --- a/client/Ui/MainWindowTabs/MessageList.cs +++ b/client/Ui/MainWindowTabs/MessageList.cs @@ -73,12 +73,18 @@ internal class MessageList : ITab { ImGui.SameLine(); if (ImGuiHelper.SmallIconButton(FontAwesomeIcon.MapMarkerAlt, $"{message.Id}") && territory != null) { - this.Plugin.GameGui.OpenMapWithMapLink(new MapLinkPayload( - territory.RowId, - territory.Map.Row, - (int) (message.X * 1_000), - (int) (message.Z * 1_000) - )); + var map = this.Plugin.DataManager.GetExcelSheet()! + .Where(map => map.TerritoryType.Row == territory.RowId) + .Where(map => message.X >= map.OffsetX && message.Y >= map.OffsetY) + .MaxBy(map => Math.Max(map.OffsetX, map.OffsetY)); + if (map != null) { + this.Plugin.GameGui.OpenMapWithMapLink(new MapLinkPayload( + territory.RowId, + map.RowId, + (int) (message.X * 1_000), + (int) (message.Z * 1_000) + )); + } } if (message.IsHidden) {