diff --git a/HuntBuddy/HuntBuddy.csproj b/HuntBuddy/HuntBuddy.csproj index 1778654..4a4104f 100644 --- a/HuntBuddy/HuntBuddy.csproj +++ b/HuntBuddy/HuntBuddy.csproj @@ -3,7 +3,7 @@ net7.0-windows enable - 1.0.2.0 + 1.0.3.0 $(AssemblyVersion) true HuntBuddy @@ -54,6 +54,6 @@ - + diff --git a/HuntBuddy/Ipc/TeleportConsumer.cs b/HuntBuddy/Ipc/TeleportConsumer.cs index 914102e..782b06c 100644 --- a/HuntBuddy/Ipc/TeleportConsumer.cs +++ b/HuntBuddy/Ipc/TeleportConsumer.cs @@ -45,7 +45,7 @@ private void Subscribe() } catch (Exception ex) { - PluginLog.LogDebug($"Failed to subscribe to Teleporter\nReason: {ex}"); + Plugin.PluginLog.Debug($"Failed to subscribe to Teleporter\nReason: {ex}"); } } diff --git a/HuntBuddy/MobHuntEntry.cs b/HuntBuddy/MobHuntEntry.cs index f90b86d..9b325ae 100644 --- a/HuntBuddy/MobHuntEntry.cs +++ b/HuntBuddy/MobHuntEntry.cs @@ -1,5 +1,5 @@ using System; -using ImGuiScene; +using Dalamud.Interface.Internal; namespace HuntBuddy { @@ -25,7 +25,7 @@ public class MobHuntEntry : IDisposable public uint NeededKills { get; set; } - public TextureWrap Icon { get; init; } = null!; + public IDalamudTextureWrap Icon { get; init; } = null!; public void Dispose() { diff --git a/HuntBuddy/Plugin.cs b/HuntBuddy/Plugin.cs index 02d8c75..441a512 100644 --- a/HuntBuddy/Plugin.cs +++ b/HuntBuddy/Plugin.cs @@ -5,22 +5,19 @@ using System.Globalization; using System.Linq; using System.Threading.Tasks; -using Dalamud.Data; using Dalamud.Game; -using Dalamud.Game.ClientState; -using Dalamud.Game.Command; -using Dalamud.Game.Gui; +using Dalamud.Interface.Internal; using Dalamud.IoC; using Dalamud.Logging; using Dalamud.Plugin; +using Dalamud.Plugin.Services; using Dalamud.Utility; using Lumina.Excel.GeneratedSheets; using HuntBuddy.Attributes; using HuntBuddy.Ipc; using HuntBuddy.Structs; using ImGuiNET; -using ImGuiScene; -using Lumina.Data.Files; +using Lumina.Extensions; namespace HuntBuddy { @@ -28,37 +25,23 @@ public class Plugin : IDalamudPlugin { public string Name => "Hunt Buddy"; - [PluginService] - [RequiredVersion("1.0")] - public static DalamudPluginInterface PluginInterface { get; set; } = null!; + [PluginService] public static DalamudPluginInterface PluginInterface { get; set; } = null!; - [PluginService] - [RequiredVersion("1.0")] - public static CommandManager Commands { get; set; } = null!; + [PluginService] public static ICommandManager Commands { get; set; } = null!; - [PluginService] - [RequiredVersion("1.0")] - public static ChatGui Chat { get; set; } = null!; + [PluginService] public static IChatGui Chat { get; set; } = null!; - [PluginService] - [RequiredVersion("1.0")] - public static DataManager DataManager { get; set; } = null!; + [PluginService] public static IDataManager DataManager { get; set; } = null!; - [PluginService] - [RequiredVersion("1.0")] - public static SigScanner SigScanner { get; set; } = null!; + [PluginService] public static ISigScanner SigScanner { get; set; } = null!; - [PluginService] - [RequiredVersion("1.0")] - public static GameGui GameGui { get; set; } = null!; + [PluginService] public static IGameGui GameGui { get; set; } = null!; - [PluginService] - [RequiredVersion("1.0")] - public static ClientState ClientState { get; set; } = null!; + [PluginService] public static IClientState ClientState { get; set; } = null!; - [PluginService] - [RequiredVersion("1.0")] - public static Framework Framework { get; set; } = null!; + [PluginService] public static IFramework Framework { get; set; } = null!; + + [PluginService] public static IPluginLog PluginLog { get; set; } = null!; private readonly PluginCommandManager commandManager; private readonly Interface pluginInterface; @@ -96,7 +79,7 @@ public Plugin() Plugin.Framework.Update += this.FrameworkOnUpdate; } - private unsafe void FrameworkOnUpdate(Framework framework) + private unsafe void FrameworkOnUpdate(IFramework framework) { if (this.lastState == this.MobHuntStruct->ObtainedBillEnumFlags) { @@ -107,7 +90,7 @@ private unsafe void FrameworkOnUpdate(Framework framework) this.PluginCommand(string.Empty, "reload"); } - private void ClientStateOnTerritoryChanged(object? sender, ushort e) + private void ClientStateOnTerritoryChanged(ushort e) { this.CurrentAreaMobHuntEntries.Clear(); @@ -321,20 +304,14 @@ public unsafe void ReloadData() this.MobHuntEntries[key][subKey].Add(entry); } - this.ClientStateOnTerritoryChanged(null, 0); + this.ClientStateOnTerritoryChanged(0); this.MobHuntEntriesReady = true; } - private static TexFile? GetHdIcon(uint id) - { - var path = $"ui/icon/{id / 1000 * 1000:000000}/{id:000000}_hr1.tex"; - return Plugin.DataManager.GetFile(path); - } - - private static TextureWrap LoadIcon(uint id) + private static IDalamudTextureWrap LoadIcon(uint id) { - var icon = Plugin.GetHdIcon(id) ?? Plugin.DataManager.GetIcon(id)!; + var icon = Plugin.DataManager.GameData.GetHqIcon(id) ?? Plugin.DataManager.GameData.GetIcon(id)!; var iconData = icon.GetRgbaImageData(); return Plugin.PluginInterface.UiBuilder.LoadImageRaw(iconData, icon.Header.Width, icon.Header.Height, 4); diff --git a/HuntBuddy/PluginCommandManager.cs b/HuntBuddy/PluginCommandManager.cs index 64dd572..4f3b712 100644 --- a/HuntBuddy/PluginCommandManager.cs +++ b/HuntBuddy/PluginCommandManager.cs @@ -3,17 +3,18 @@ using System.Linq; using System.Reflection; using Dalamud.Game.Command; +using Dalamud.Plugin.Services; using HuntBuddy.Attributes; namespace HuntBuddy { public class PluginCommandManager : IDisposable { - private readonly CommandManager commandManager; + private readonly ICommandManager commandManager; private readonly (string, CommandInfo)[] pluginCommands; private readonly THost host; - public PluginCommandManager(THost host, CommandManager commandManager) + public PluginCommandManager(THost host, ICommandManager commandManager) { this.commandManager = commandManager; this.host = host; diff --git a/HuntBuddy/packages.lock.json b/HuntBuddy/packages.lock.json index 467f0f2..6cf1c73 100644 --- a/HuntBuddy/packages.lock.json +++ b/HuntBuddy/packages.lock.json @@ -4,9 +4,9 @@ "net7.0-windows7.0": { "DalamudPackager": { "type": "Direct", - "requested": "[2.1.11, )", - "resolved": "2.1.11", - "contentHash": "9qlAWoRRTiL/geAvuwR/g6Bcbrd/bJJgVnB/RurBiyKs6srsP0bvpoo8IK+Eg8EA6jWeM6/YJWs66w4FIAzqPw==" + "requested": "[2.1.12, )", + "resolved": "2.1.12", + "contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg==" } } }