refactor: update for api 9
This commit is contained in:
parent
c21918fe94
commit
3c54ae9236
|
@ -27,10 +27,6 @@
|
|||
<HintPath>$(DalamudLibPath)\ImGui.NET.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="ImGuiScene">
|
||||
<HintPath>$(DalamudLibPath)\ImGuiScene.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Lumina">
|
||||
<HintPath>$(DalamudLibPath)\Lumina.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
|
|
|
@ -1,38 +1,41 @@
|
|||
using Dalamud.Game.Command;
|
||||
using Dalamud.Plugin;
|
||||
using System;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Globetrotter {
|
||||
// ReSharper disable once ClassNeverInstantiated.Global
|
||||
public class GlobetrotterPlugin : IDalamudPlugin {
|
||||
public class Plugin : IDalamudPlugin {
|
||||
private bool _disposedValue;
|
||||
|
||||
public string Name => "Globetrotter";
|
||||
[PluginService]
|
||||
internal static IPluginLog Log { get; private set; } = null!;
|
||||
|
||||
[PluginService]
|
||||
private DalamudPluginInterface Interface { get; init; } = null!;
|
||||
|
||||
[PluginService]
|
||||
private CommandManager CommandManager { get; init; } = null!;
|
||||
private ICommandManager CommandManager { get; init; } = null!;
|
||||
|
||||
[PluginService]
|
||||
internal DataManager DataManager { get; init; } = null!;
|
||||
internal IDataManager DataManager { get; init; } = null!;
|
||||
|
||||
[PluginService]
|
||||
internal GameGui GameGui { get; init; } = null!;
|
||||
internal IGameGui GameGui { get; init; } = null!;
|
||||
|
||||
[PluginService]
|
||||
internal SigScanner SigScanner { get; init; } = null!;
|
||||
internal ISigScanner SigScanner { get; init; } = null!;
|
||||
|
||||
[PluginService]
|
||||
internal IGameInteropProvider GameInteropProvider { get; init; } = null!;
|
||||
|
||||
internal Configuration Config { get; }
|
||||
private PluginUi Ui { get; }
|
||||
private TreasureMaps Maps { get; }
|
||||
|
||||
public GlobetrotterPlugin() {
|
||||
public Plugin() {
|
||||
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||
this.Config.Initialize(this.Interface);
|
||||
|
|
@ -3,7 +3,7 @@ using System.Numerics;
|
|||
|
||||
namespace Globetrotter {
|
||||
internal class PluginUi {
|
||||
private GlobetrotterPlugin Plugin { get; }
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
private bool _displaySettings;
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace Globetrotter {
|
|||
set => this._displaySettings = value;
|
||||
}
|
||||
|
||||
public PluginUi(GlobetrotterPlugin plugin) {
|
||||
public PluginUi(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Logging;
|
||||
|
||||
namespace Globetrotter {
|
||||
internal sealed class TreasureMaps : IDisposable {
|
||||
|
@ -48,7 +47,7 @@ namespace Globetrotter {
|
|||
}
|
||||
}
|
||||
|
||||
private GlobetrotterPlugin Plugin { get; }
|
||||
private Plugin Plugin { get; }
|
||||
private TreasureMapPacket? _lastMap;
|
||||
|
||||
private delegate char HandleActorControlSelfDelegate(long a1, long a2, IntPtr dataPtr);
|
||||
|
@ -58,15 +57,15 @@ namespace Globetrotter {
|
|||
private readonly Hook<HandleActorControlSelfDelegate> _acsHook;
|
||||
private readonly Hook<ShowTreasureMapDelegate> _showMapHook;
|
||||
|
||||
public TreasureMaps(GlobetrotterPlugin plugin) {
|
||||
public TreasureMaps(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
|
||||
var acsPtr = this.Plugin.SigScanner.ScanText("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 30 48 8B D9 49 8B F8 41 0F B7 08");
|
||||
this._acsHook = Hook<HandleActorControlSelfDelegate>.FromAddress(acsPtr, this.OnACS);
|
||||
this._acsHook = this.Plugin.GameInteropProvider.HookFromAddress<HandleActorControlSelfDelegate>(acsPtr, this.OnACS);
|
||||
this._acsHook.Enable();
|
||||
|
||||
var showMapPtr = this.Plugin.SigScanner.ScanText("E8 ?? ?? ?? ?? 40 84 FF 0F 85 ?? ?? ?? ?? 48 8B 0D");
|
||||
this._showMapHook = Hook<ShowTreasureMapDelegate>.FromAddress(showMapPtr, this.OnShowMap);
|
||||
this._showMapHook = this.Plugin.GameInteropProvider.HookFromAddress<ShowTreasureMapDelegate>(showMapPtr, this.OnShowMap);
|
||||
this._showMapHook.Enable();
|
||||
}
|
||||
|
||||
|
@ -89,7 +88,7 @@ namespace Globetrotter {
|
|||
return IntPtr.Zero;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Exception on show map");
|
||||
Plugin.Log.Error(ex, "Exception on show map");
|
||||
}
|
||||
|
||||
return this._showMapHook.Original(manager, rowId, subRowId, a4);
|
||||
|
@ -117,7 +116,7 @@ namespace Globetrotter {
|
|||
try {
|
||||
this.OnACSInner(dataPtr);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Exception on ACS");
|
||||
Plugin.Log.Error(ex, "Exception on ACS");
|
||||
}
|
||||
|
||||
return this._acsHook.Original(a1, a2, dataPtr);
|
||||
|
|
Loading…
Reference in New Issue