From 290d79034cfdd3c69cc68e4bd77890f6bf028358 Mon Sep 17 00:00:00 2001 From: Anna Date: Sun, 19 Feb 2023 23:52:04 -0500 Subject: [PATCH] fix: account for world --- client/Message.cs | 1 + client/Messages.cs | 11 +++++++++-- client/Ui/MainWindowTabs/MessageList.cs | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/client/Message.cs b/client/Message.cs index 89c4b42..c165d7d 100644 --- a/client/Message.cs +++ b/client/Message.cs @@ -32,6 +32,7 @@ internal class MessageWithTerritory { public uint Territory { get; init; } public uint? Ward { get; init; } public uint? Plot { get; init; } + public uint? World { get; init; } public float X { get; init; } public float Y { get; init; } public float Z { get; init; } diff --git a/client/Messages.cs b/client/Messages.cs index bb1fba7..3505308 100644 --- a/client/Messages.cs +++ b/client/Messages.cs @@ -181,6 +181,11 @@ internal class Messages : IDisposable { return; } + var world = this.Plugin.ClientState.LocalPlayer?.CurrentWorld.Id ?? 0; + if (world == 0) { + return; + } + var housing = this.Plugin.Common.Functions.Housing.Location; var ward = housing?.Ward; var plot = housing?.CombinedPlot(); @@ -205,14 +210,14 @@ internal class Messages : IDisposable { Task.Run(async () => { try { - await this.DownloadMessages(territory, ward, plot); + await this.DownloadMessages(world, territory, ward, plot); } catch (Exception ex) { PluginLog.LogError(ex, $"Failed to get messages for territory {territory}"); } }); } - private async Task DownloadMessages(ushort territory, ushort? ward, ushort? plot) { + private async Task DownloadMessages(uint world, ushort territory, ushort? ward, ushort? plot) { var route = $"/messages/{territory}"; if (ward != null) { route += $"?ward={ward}"; @@ -220,6 +225,8 @@ internal class Messages : IDisposable { if (plot != null) { route += $"&plot={plot}"; } + + route += $"&world={world}"; } var resp = await ServerHelper.SendRequest( diff --git a/client/Ui/MainWindowTabs/MessageList.cs b/client/Ui/MainWindowTabs/MessageList.cs index 6757e37..f582f76 100644 --- a/client/Ui/MainWindowTabs/MessageList.cs +++ b/client/Ui/MainWindowTabs/MessageList.cs @@ -76,7 +76,20 @@ internal class MessageList : ITab { var loc = $"Location: {territoryName}"; if (message.Ward != null) { - loc += $" (Ward {message.Ward.Value}"; + loc += " ("; + + if (message.World != null) { + var world = this.Plugin.DataManager.GetExcelSheet()?.GetRow((ushort) message.World); + if (world != null) { + loc += world.Name.ToDalamudString().TextValue; + } + } + + if (loc != " (") { + loc += ", "; + } + + loc += $"Ward {message.Ward.Value}"; if (message.Plot != null) { if (message.Plot.Value >= HousingLocationExt.Apt) {