diff --git a/client/HousingLocationExt.cs b/client/HousingLocationExt.cs
index bb67121..2446337 100755
--- a/client/HousingLocationExt.cs
+++ b/client/HousingLocationExt.cs
@@ -1,4 +1,4 @@
-using XivCommon.Functions.Housing;
+using OrangeGuidanceTomestone.Util;
namespace OrangeGuidanceTomestone;
diff --git a/client/Messages.cs b/client/Messages.cs
index 448f6be..c274c24 100644
--- a/client/Messages.cs
+++ b/client/Messages.cs
@@ -5,6 +5,7 @@ using Dalamud.Plugin.Services;
using Lumina.Excel.GeneratedSheets;
using Newtonsoft.Json;
using OrangeGuidanceTomestone.Helpers;
+using OrangeGuidanceTomestone.Util;
namespace OrangeGuidanceTomestone;
@@ -178,7 +179,7 @@ internal class Messages : IDisposable {
return;
}
- var housing = this.Plugin.Common.Functions.Housing.Location;
+ var housing = HousingLocation.Current();
var ward = housing?.Ward;
var plot = housing?.CombinedPlot();
diff --git a/client/OrangeGuidanceTomestone.csproj b/client/OrangeGuidanceTomestone.csproj
index b67a66b..efe82ce 100755
--- a/client/OrangeGuidanceTomestone.csproj
+++ b/client/OrangeGuidanceTomestone.csproj
@@ -54,10 +54,9 @@
-
-
+
+
-
diff --git a/client/Plugin.cs b/client/Plugin.cs
index 3174a0c..63abc48 100644
--- a/client/Plugin.cs
+++ b/client/Plugin.cs
@@ -2,7 +2,6 @@
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using OrangeGuidanceTomestone.MiniPenumbra;
-using XivCommon;
namespace OrangeGuidanceTomestone;
@@ -13,7 +12,7 @@ public class Plugin : IDalamudPlugin {
internal static IPluginLog Log { get; private set; }
[PluginService]
- internal DalamudPluginInterface Interface { get; init; }
+ internal IDalamudPluginInterface Interface { get; init; }
[PluginService]
internal IChatGui ChatGui { get; init; }
@@ -39,8 +38,10 @@ public class Plugin : IDalamudPlugin {
[PluginService]
internal IGameInteropProvider GameInteropProvider { get; init; }
+ [PluginService]
+ internal ITextureProvider TextureProvider { get; init; }
+
internal Configuration Config { get; }
- internal XivCommonBase Common { get; }
internal Vfx Vfx { get; }
internal PluginUi Ui { get; }
internal Messages Messages { get; }
@@ -54,7 +55,6 @@ public class Plugin : IDalamudPlugin {
this.AvfxFilePath = this.CopyAvfxFile();
this.Config = this.Interface!.GetPluginConfig() as Configuration ?? new Configuration();
- this.Common = new XivCommonBase(this.Interface);
this.Vfx = new Vfx(this);
this.Messages = new Messages(this);
this.Ui = new PluginUi(this);
@@ -74,7 +74,6 @@ public class Plugin : IDalamudPlugin {
this.Ui.Dispose();
this.Messages.Dispose();
this.Vfx.Dispose();
- this.Common.Dispose();
}
internal void SaveConfig() {
@@ -96,7 +95,7 @@ public class Plugin : IDalamudPlugin {
internal void GetApiKey() {
Task.Run(async () => {
- var resp = await new HttpClient().PostAsync("https://tryfingerbuthole.anna.lgbt/account", null);
+ var resp = await new HttpClient().PostAsync("http://192.168.174.246:8080/account", null);
var key = await resp.Content.ReadAsStringAsync();
this.Config.ApiKey = key;
this.SaveConfig();
diff --git a/client/Ui/MainWindowTabs/Write.cs b/client/Ui/MainWindowTabs/Write.cs
index 762ffcb..bd6c9fe 100644
--- a/client/Ui/MainWindowTabs/Write.cs
+++ b/client/Ui/MainWindowTabs/Write.cs
@@ -1,7 +1,7 @@
using System.Numerics;
using System.Text;
using Dalamud.Game.ClientState.Conditions;
-using Dalamud.Interface.Internal;
+using Dalamud.Interface.Textures.TextureWraps;
using ImGuiNET;
using Newtonsoft.Json;
using OrangeGuidanceTomestone.Helpers;
@@ -58,13 +58,15 @@ internal class Write : ITab {
private List GlyphImages { get; } = [];
private void LoadSignImages() {
- for (var i = 0; i < Messages.VfxPaths.Length; i++) {
- var stream = Resourcer.Resource.AsStreamUnChecked($"OrangeGuidanceTomestone.img.sign_{i}.jpg");
- using var mem = new MemoryStream();
- stream.CopyTo(mem);
- var wrap = this.Plugin.Interface.UiBuilder.LoadImage(mem.ToArray());
- this.GlyphImages.Add(wrap);
- }
+ Task.Run(async () => {
+ for (var i = 0; i < Messages.VfxPaths.Length; i++) {
+ var stream = Resourcer.Resource.AsStreamUnChecked($"OrangeGuidanceTomestone.img.sign_{i}.jpg");
+ using var mem = new MemoryStream();
+ await stream.CopyToAsync(mem);
+ var wrap = await this.Plugin.TextureProvider.CreateFromImageAsync(mem.ToArray());
+ this.GlyphImages.Add(wrap);
+ }
+ });
}
internal Write(Plugin plugin) {
@@ -310,11 +312,12 @@ internal class Write : ITab {
|| this.Plugin.Condition[ConditionFlag.Jumping61]
|| this.Plugin.Condition[ConditionFlag.InFlight];
if (ImGui.Button("Write") && valid && !inAir && this.Plugin.ClientState.LocalPlayer is { } player) {
+ var location = HousingLocation.Current();
var req = new MessageRequest {
Territory = this.Plugin.ClientState.TerritoryType,
World = this.Plugin.ClientState.LocalPlayer?.CurrentWorld.Id ?? 0,
- Ward = this.Plugin.Common.Functions.Housing.Location?.Ward,
- Plot = this.Plugin.Common.Functions.Housing.Location?.CombinedPlot(),
+ Ward = location?.Ward,
+ Plot = location?.CombinedPlot(),
X = player.Position.X,
Y = player.Position.Y,
Z = player.Position.Z,
diff --git a/client/Util/HousingLocation.cs b/client/Util/HousingLocation.cs
new file mode 100755
index 0000000..b849ff9
--- /dev/null
+++ b/client/Util/HousingLocation.cs
@@ -0,0 +1,71 @@
+using FFXIVClientStructs.FFXIV.Client.Game;
+
+namespace OrangeGuidanceTomestone.Util;
+
+///
+/// Information about a player's current location in a housing ward.
+///
+public class HousingLocation {
+ ///
+ /// The housing ward that the player is in.
+ ///
+ public ushort? Ward;
+
+ ///
+ ///
+ /// The yard that the player is in.
+ ///
+ ///
+ /// This is the same as plot number but indicates that the player is in
+ /// the exterior area (the yard) of that plot.
+ ///
+ ///
+ public ushort? Yard;
+
+ ///
+ /// The plot that the player is in.
+ ///
+ public ushort? Plot;
+
+ ///
+ /// The apartment wing (1 or 2 for normal or subdivision) that the
+ /// player is in.
+ ///
+ public ushort? ApartmentWing;
+
+ ///
+ /// The apartment that the player is in.
+ ///
+ public ushort? Apartment;
+
+ internal static unsafe HousingLocation? Current() {
+ var manager = HousingManager.Instance();
+ return manager == null ? null : new HousingLocation(manager);
+ }
+
+ private unsafe HousingLocation(HousingManager* manager) {
+ var ward = manager->GetCurrentWard();
+ var currentPlot = manager->GetCurrentPlot();
+ if (currentPlot < -1) {
+ // the struct is in apartment mode
+ this.ApartmentWing = (ushort?) ((unchecked((byte) currentPlot) & ~0x80) + 1);
+ this.Apartment = (ushort) manager->GetCurrentRoom();
+ if (this.Apartment == 0) {
+ this.Apartment = null;
+ }
+ } else if (currentPlot > 0) {
+ if (manager->GetCurrentHouseId() == -1) {
+ // not inside a plot
+ // yard is 0xFF when not in one
+ this.Yard = (ushort?) (currentPlot + 1);
+ } else {
+ // inside a plot
+ this.Plot = (ushort?) (currentPlot + 1);
+ }
+ }
+
+ if (ward > -1) {
+ this.Ward = (ushort) (ward + 1);
+ }
+ }
+}
diff --git a/client/packages.lock.json b/client/packages.lock.json
old mode 100644
new mode 100755
index 6239537..3fcbddb
--- a/client/packages.lock.json
+++ b/client/packages.lock.json
@@ -4,15 +4,15 @@
"net8.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
- "requested": "[2.1.12, )",
- "resolved": "2.1.12",
- "contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
+ "requested": "[2.1.13, )",
+ "resolved": "2.1.13",
+ "contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
},
"Fody": {
"type": "Direct",
- "requested": "[6.8.0, )",
- "resolved": "6.8.0",
- "contentHash": "hfZ/f8Mezt8aTkgv9nsvFdYoQ809/AqwsJlOGOPYIfBcG2aAIG3v3ex9d8ZqQuFYyMoucjRg4eKy3VleeGodKQ=="
+ "requested": "[6.8.1, )",
+ "resolved": "6.8.1",
+ "contentHash": "pwk2/No1kL1ft+zMT2y0MvzB6W5cpkdOTj+0+T2u7LGJMTw37qtlnHzCSCyvwRiZVoJ/V/DE78eQ/WEcutUVDw=="
},
"Resourcer.Fody": {
"type": "Direct",
@@ -22,12 +22,6 @@
"dependencies": {
"Fody": "6.6.4"
}
- },
- "XivCommon": {
- "type": "Direct",
- "requested": "[9.0.0, )",
- "resolved": "9.0.0",
- "contentHash": "avaBp3FmSCi/PiQhntCeBDYOHejdyTWmFtz4pRBVQQ8vHkmRx+YTk1la9dkYBMlXxRXKckEdH1iI1Fu61JlE7w=="
}
}
}