fix: handle plots better
This commit is contained in:
parent
544ef9a65b
commit
71ebff5cba
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue