fix: account for world

This commit is contained in:
Anna 2023-02-19 23:52:04 -05:00
parent 581b4806ed
commit 290d79034c
3 changed files with 24 additions and 3 deletions

View File

@ -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; }

View File

@ -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(

View File

@ -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<World>()?.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) {