refactor: update for api 10
This commit is contained in:
parent
72f675c5f7
commit
52ac341c93
@ -1,4 +1,4 @@
|
|||||||
using XivCommon.Functions.Housing;
|
using OrangeGuidanceTomestone.Util;
|
||||||
|
|
||||||
namespace OrangeGuidanceTomestone;
|
namespace OrangeGuidanceTomestone;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ using Dalamud.Plugin.Services;
|
|||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using OrangeGuidanceTomestone.Helpers;
|
using OrangeGuidanceTomestone.Helpers;
|
||||||
|
using OrangeGuidanceTomestone.Util;
|
||||||
|
|
||||||
namespace OrangeGuidanceTomestone;
|
namespace OrangeGuidanceTomestone;
|
||||||
|
|
||||||
@ -178,7 +179,7 @@ internal class Messages : IDisposable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var housing = this.Plugin.Common.Functions.Housing.Location;
|
var housing = HousingLocation.Current();
|
||||||
var ward = housing?.Ward;
|
var ward = housing?.Ward;
|
||||||
var plot = housing?.CombinedPlot();
|
var plot = housing?.CombinedPlot();
|
||||||
|
|
||||||
|
@ -54,10 +54,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
|
<PackageReference Include="DalamudPackager" Version="2.1.13" />
|
||||||
<PackageReference Include="Fody" Version="6.8.0" PrivateAssets="all"/>
|
<PackageReference Include="Fody" Version="6.8.1" PrivateAssets="all" />
|
||||||
<PackageReference Include="Resourcer.Fody" Version="1.8.1" PrivateAssets="all"/>
|
<PackageReference Include="Resourcer.Fody" Version="1.8.1" PrivateAssets="all"/>
|
||||||
<PackageReference Include="XivCommon" Version="9.0.0" PrivateAssets="all"/>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using OrangeGuidanceTomestone.MiniPenumbra;
|
using OrangeGuidanceTomestone.MiniPenumbra;
|
||||||
using XivCommon;
|
|
||||||
|
|
||||||
namespace OrangeGuidanceTomestone;
|
namespace OrangeGuidanceTomestone;
|
||||||
|
|
||||||
@ -13,7 +12,7 @@ public class Plugin : IDalamudPlugin {
|
|||||||
internal static IPluginLog Log { get; private set; }
|
internal static IPluginLog Log { get; private set; }
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal DalamudPluginInterface Interface { get; init; }
|
internal IDalamudPluginInterface Interface { get; init; }
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal IChatGui ChatGui { get; init; }
|
internal IChatGui ChatGui { get; init; }
|
||||||
@ -39,8 +38,10 @@ public class Plugin : IDalamudPlugin {
|
|||||||
[PluginService]
|
[PluginService]
|
||||||
internal IGameInteropProvider GameInteropProvider { get; init; }
|
internal IGameInteropProvider GameInteropProvider { get; init; }
|
||||||
|
|
||||||
|
[PluginService]
|
||||||
|
internal ITextureProvider TextureProvider { get; init; }
|
||||||
|
|
||||||
internal Configuration Config { get; }
|
internal Configuration Config { get; }
|
||||||
internal XivCommonBase Common { get; }
|
|
||||||
internal Vfx Vfx { get; }
|
internal Vfx Vfx { get; }
|
||||||
internal PluginUi Ui { get; }
|
internal PluginUi Ui { get; }
|
||||||
internal Messages Messages { get; }
|
internal Messages Messages { get; }
|
||||||
@ -54,7 +55,6 @@ public class Plugin : IDalamudPlugin {
|
|||||||
this.AvfxFilePath = this.CopyAvfxFile();
|
this.AvfxFilePath = this.CopyAvfxFile();
|
||||||
|
|
||||||
this.Config = this.Interface!.GetPluginConfig() as Configuration ?? new Configuration();
|
this.Config = this.Interface!.GetPluginConfig() as Configuration ?? new Configuration();
|
||||||
this.Common = new XivCommonBase(this.Interface);
|
|
||||||
this.Vfx = new Vfx(this);
|
this.Vfx = new Vfx(this);
|
||||||
this.Messages = new Messages(this);
|
this.Messages = new Messages(this);
|
||||||
this.Ui = new PluginUi(this);
|
this.Ui = new PluginUi(this);
|
||||||
@ -74,7 +74,6 @@ public class Plugin : IDalamudPlugin {
|
|||||||
this.Ui.Dispose();
|
this.Ui.Dispose();
|
||||||
this.Messages.Dispose();
|
this.Messages.Dispose();
|
||||||
this.Vfx.Dispose();
|
this.Vfx.Dispose();
|
||||||
this.Common.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SaveConfig() {
|
internal void SaveConfig() {
|
||||||
@ -96,7 +95,7 @@ public class Plugin : IDalamudPlugin {
|
|||||||
|
|
||||||
internal void GetApiKey() {
|
internal void GetApiKey() {
|
||||||
Task.Run(async () => {
|
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();
|
var key = await resp.Content.ReadAsStringAsync();
|
||||||
this.Config.ApiKey = key;
|
this.Config.ApiKey = key;
|
||||||
this.SaveConfig();
|
this.SaveConfig();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Dalamud.Game.ClientState.Conditions;
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Interface.Internal;
|
using Dalamud.Interface.Textures.TextureWraps;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using OrangeGuidanceTomestone.Helpers;
|
using OrangeGuidanceTomestone.Helpers;
|
||||||
@ -58,13 +58,15 @@ internal class Write : ITab {
|
|||||||
private List<IDalamudTextureWrap> GlyphImages { get; } = [];
|
private List<IDalamudTextureWrap> GlyphImages { get; } = [];
|
||||||
|
|
||||||
private void LoadSignImages() {
|
private void LoadSignImages() {
|
||||||
for (var i = 0; i < Messages.VfxPaths.Length; i++) {
|
Task.Run(async () => {
|
||||||
var stream = Resourcer.Resource.AsStreamUnChecked($"OrangeGuidanceTomestone.img.sign_{i}.jpg");
|
for (var i = 0; i < Messages.VfxPaths.Length; i++) {
|
||||||
using var mem = new MemoryStream();
|
var stream = Resourcer.Resource.AsStreamUnChecked($"OrangeGuidanceTomestone.img.sign_{i}.jpg");
|
||||||
stream.CopyTo(mem);
|
using var mem = new MemoryStream();
|
||||||
var wrap = this.Plugin.Interface.UiBuilder.LoadImage(mem.ToArray());
|
await stream.CopyToAsync(mem);
|
||||||
this.GlyphImages.Add(wrap);
|
var wrap = await this.Plugin.TextureProvider.CreateFromImageAsync(mem.ToArray());
|
||||||
}
|
this.GlyphImages.Add(wrap);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Write(Plugin plugin) {
|
internal Write(Plugin plugin) {
|
||||||
@ -310,11 +312,12 @@ internal class Write : ITab {
|
|||||||
|| this.Plugin.Condition[ConditionFlag.Jumping61]
|
|| this.Plugin.Condition[ConditionFlag.Jumping61]
|
||||||
|| this.Plugin.Condition[ConditionFlag.InFlight];
|
|| this.Plugin.Condition[ConditionFlag.InFlight];
|
||||||
if (ImGui.Button("Write") && valid && !inAir && this.Plugin.ClientState.LocalPlayer is { } player) {
|
if (ImGui.Button("Write") && valid && !inAir && this.Plugin.ClientState.LocalPlayer is { } player) {
|
||||||
|
var location = HousingLocation.Current();
|
||||||
var req = new MessageRequest {
|
var req = new MessageRequest {
|
||||||
Territory = this.Plugin.ClientState.TerritoryType,
|
Territory = this.Plugin.ClientState.TerritoryType,
|
||||||
World = this.Plugin.ClientState.LocalPlayer?.CurrentWorld.Id ?? 0,
|
World = this.Plugin.ClientState.LocalPlayer?.CurrentWorld.Id ?? 0,
|
||||||
Ward = this.Plugin.Common.Functions.Housing.Location?.Ward,
|
Ward = location?.Ward,
|
||||||
Plot = this.Plugin.Common.Functions.Housing.Location?.CombinedPlot(),
|
Plot = location?.CombinedPlot(),
|
||||||
X = player.Position.X,
|
X = player.Position.X,
|
||||||
Y = player.Position.Y,
|
Y = player.Position.Y,
|
||||||
Z = player.Position.Z,
|
Z = player.Position.Z,
|
||||||
|
71
client/Util/HousingLocation.cs
Executable file
71
client/Util/HousingLocation.cs
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
|
|
||||||
|
namespace OrangeGuidanceTomestone.Util;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Information about a player's current location in a housing ward.
|
||||||
|
/// </summary>
|
||||||
|
public class HousingLocation {
|
||||||
|
/// <summary>
|
||||||
|
/// The housing ward that the player is in.
|
||||||
|
/// </summary>
|
||||||
|
public ushort? Ward;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// The yard that the player is in.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// This is the same as plot number but indicates that the player is in
|
||||||
|
/// the exterior area (the yard) of that plot.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
public ushort? Yard;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The plot that the player is in.
|
||||||
|
/// </summary>
|
||||||
|
public ushort? Plot;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The apartment wing (1 or 2 for normal or subdivision) that the
|
||||||
|
/// player is in.
|
||||||
|
/// </summary>
|
||||||
|
public ushort? ApartmentWing;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The apartment that the player is in.
|
||||||
|
/// </summary>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
client/packages.lock.json
Normal file → Executable file
18
client/packages.lock.json
Normal file → Executable file
@ -4,15 +4,15 @@
|
|||||||
"net8.0-windows7.0": {
|
"net8.0-windows7.0": {
|
||||||
"DalamudPackager": {
|
"DalamudPackager": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[2.1.12, )",
|
"requested": "[2.1.13, )",
|
||||||
"resolved": "2.1.12",
|
"resolved": "2.1.13",
|
||||||
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
|
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
|
||||||
},
|
},
|
||||||
"Fody": {
|
"Fody": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[6.8.0, )",
|
"requested": "[6.8.1, )",
|
||||||
"resolved": "6.8.0",
|
"resolved": "6.8.1",
|
||||||
"contentHash": "hfZ/f8Mezt8aTkgv9nsvFdYoQ809/AqwsJlOGOPYIfBcG2aAIG3v3ex9d8ZqQuFYyMoucjRg4eKy3VleeGodKQ=="
|
"contentHash": "pwk2/No1kL1ft+zMT2y0MvzB6W5cpkdOTj+0+T2u7LGJMTw37qtlnHzCSCyvwRiZVoJ/V/DE78eQ/WEcutUVDw=="
|
||||||
},
|
},
|
||||||
"Resourcer.Fody": {
|
"Resourcer.Fody": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
@ -22,12 +22,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Fody": "6.6.4"
|
"Fody": "6.6.4"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"XivCommon": {
|
|
||||||
"type": "Direct",
|
|
||||||
"requested": "[9.0.0, )",
|
|
||||||
"resolved": "9.0.0",
|
|
||||||
"contentHash": "avaBp3FmSCi/PiQhntCeBDYOHejdyTWmFtz4pRBVQQ8vHkmRx+YTk1la9dkYBMlXxRXKckEdH1iI1Fu61JlE7w=="
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user