fix: handle plots better

This commit is contained in:
Anna 2023-02-19 22:13:29 -05:00
parent 544ef9a65b
commit 71ebff5cba
7 changed files with 29 additions and 10 deletions

0
client/FodyWeavers.xml Executable file → Normal file
View File

19
client/HousingLocationExt.cs Executable file
View File

@ -0,0 +1,19 @@
using XivCommon.Functions.Housing;
namespace OrangeGuidanceTomestone;
internal static class HousingLocationExt {
internal static ushort? CombinedPlot(this HousingLocation housing) {
if (housing is { Apartment: { } apt, ApartmentWing: { } wing }) {
return (ushort) (10_000
+ (wing - 1) * 5_000
+ apt);
}
if (housing.Plot is { } plotNum) {
return plotNum;
}
return null;
}
}

View File

@ -31,6 +31,7 @@ internal class MessageWithTerritory {
public Guid Id { get; init; }
public uint Territory { get; init; }
public uint? Ward { get; init; }
public uint? Plot { get; init; }
public float X { get; init; }
public float Y { get; init; }
public float Z { get; init; }

View File

@ -155,14 +155,7 @@ internal class Messages : IDisposable {
var housing = this.Plugin.Common.Functions.Housing.Location;
var ward = housing?.Ward;
ushort? plot = null;
if (housing is { Apartment: { } apt, ApartmentWing: { } wing }) {
plot = (ushort) (10_000
+ (wing - 1) * 5_000
+ apt);
} else if (housing?.Plot is { } plotNum) {
plot = plotNum;
}
var plot = housing?.CombinedPlot();
if (this.Plugin.Config.DisableTrials && this.Trials.Contains(territory)) {
return;

0
client/OrangeGuidanceTomestone.yaml Executable file → Normal file
View File

View File

@ -76,7 +76,13 @@ internal class MessageList : ITab {
var loc = $"Location: {territoryName}";
if (message.Ward != null) {
loc += $" (Ward {message.Ward.Value})";
loc += $" (Ward {message.Ward.Value}";
if (message.Plot != null) {
loc += $", Plot {message.Plot.Value}";
}
loc += ")";
}
ImGui.TextUnformatted(message.Text);

View File

@ -232,7 +232,7 @@ internal class Write : ITab {
var req = new MessageRequest {
Territory = this.Plugin.ClientState.TerritoryType,
Ward = this.Plugin.Common.Functions.Housing.Location?.Ward,
Plot = this.Plugin.Common.Functions.Housing.Location?.Plot,
Plot = this.Plugin.Common.Functions.Housing.Location?.CombinedPlot(),
X = player.Position.X,
Y = player.Position.Y,
Z = player.Position.Z,