refactor: update for api 9
This commit is contained in:
parent
5fd80a6358
commit
b939825923
|
@ -2,7 +2,6 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
using Dalamud.Logging;
|
|
||||||
|
|
||||||
namespace Tourist {
|
namespace Tourist {
|
||||||
public class GameFunctions : IDisposable {
|
public class GameFunctions : IDisposable {
|
||||||
|
@ -26,7 +25,7 @@ namespace Tourist {
|
||||||
this.Plugin = plugin;
|
this.Plugin = plugin;
|
||||||
|
|
||||||
var vistaUnlockedPtr = this.Plugin.SigScanner.ScanText("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 8B CE E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 44 8B 7C 24");
|
var vistaUnlockedPtr = this.Plugin.SigScanner.ScanText("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 8B CE E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 44 8B 7C 24");
|
||||||
this.VistaUnlockedHook = Hook<VistaUnlockedDelegate>.FromAddress(vistaUnlockedPtr, this.OnVistaUnlock);
|
this.VistaUnlockedHook = this.Plugin.GameInteropProvider.HookFromAddress<VistaUnlockedDelegate>(vistaUnlockedPtr, this.OnVistaUnlock);
|
||||||
this.VistaUnlockedHook.Enable();
|
this.VistaUnlockedHook.Enable();
|
||||||
|
|
||||||
var maskPtr = this.Plugin.SigScanner.GetStaticAddressFromSig("8B F2 48 8D 0D ?? ?? ?? ?? 8B D3");
|
var maskPtr = this.Plugin.SigScanner.GetStaticAddressFromSig("8B F2 48 8D 0D ?? ?? ?? ?? 8B D3");
|
||||||
|
@ -50,7 +49,7 @@ namespace Tourist {
|
||||||
try {
|
try {
|
||||||
this.Plugin.Markers.RemoveVfx(index);
|
this.Plugin.Markers.RemoveVfx(index);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
PluginLog.LogError(ex, "Exception in vista unlock");
|
Plugin.Log.Error(ex, "Exception in vista unlock");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.VistaUnlockedHook.Original(index, a2, a3);
|
return this.VistaUnlockedHook.Original(index, a2, a3);
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Dalamud.Game;
|
using Dalamud.Plugin.Services;
|
||||||
using Dalamud.Logging;
|
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
|
|
||||||
namespace Tourist {
|
namespace Tourist {
|
||||||
|
@ -77,7 +76,7 @@ namespace Tourist {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTerritoryChange(object? sender, ushort territory) {
|
private void OnTerritoryChange(ushort territory) {
|
||||||
if (!this.Plugin.Config.ShowArrVistas) {
|
if (!this.Plugin.Config.ShowArrVistas) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -86,11 +85,11 @@ namespace Tourist {
|
||||||
this.RemoveAllVfx();
|
this.RemoveAllVfx();
|
||||||
this.SpawnVfxForCurrentZone(territory);
|
this.SpawnVfxForCurrentZone(territory);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
PluginLog.LogError(ex, "Exception in territory change");
|
Plugin.Log.Error(ex, "Exception in territory change");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFrameworkUpdate(Framework framework) {
|
private void OnFrameworkUpdate(IFramework framework1) {
|
||||||
foreach (var vfx in this.Queue.ToArray()) {
|
foreach (var vfx in this.Queue.ToArray()) {
|
||||||
if (this.Plugin.Functions.PlayVfx(vfx)) {
|
if (this.Plugin.Functions.PlayVfx(vfx)) {
|
||||||
this.Queue.Remove(vfx);
|
this.Queue.Remove(vfx);
|
||||||
|
|
|
@ -1,36 +1,40 @@
|
||||||
using Dalamud.Data;
|
using Dalamud.Game;
|
||||||
using Dalamud.Game;
|
|
||||||
using Dalamud.Game.ClientState;
|
|
||||||
using Dalamud.Game.Command;
|
|
||||||
using Dalamud.Game.Gui;
|
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
|
using Dalamud.Plugin.Services;
|
||||||
using FFXIVWeather.Lumina;
|
using FFXIVWeather.Lumina;
|
||||||
|
|
||||||
namespace Tourist {
|
namespace Tourist {
|
||||||
// ReSharper disable once ClassNeverInstantiated.Global
|
// ReSharper disable once ClassNeverInstantiated.Global
|
||||||
public class Plugin : IDalamudPlugin {
|
public class Plugin : IDalamudPlugin {
|
||||||
public string Name => "Tourist";
|
public static string Name => "Tourist";
|
||||||
|
|
||||||
|
[PluginService]
|
||||||
|
internal static IPluginLog Log { get; private set; } = null!;
|
||||||
|
|
||||||
|
[PluginService]
|
||||||
internal DalamudPluginInterface Interface { get; }
|
internal DalamudPluginInterface Interface { get; }
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal ClientState ClientState { get; init; } = null!;
|
internal IClientState ClientState { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal CommandManager CommandManager { get; init; } = null!;
|
internal ICommandManager CommandManager { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal DataManager DataManager { get; init; } = null!;
|
internal IDataManager DataManager { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal Framework Framework { get; init; } = null!;
|
internal IFramework Framework { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal GameGui GameGui { get; init; } = null!;
|
internal IGameGui GameGui { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal SigScanner SigScanner { get; init; } = null!;
|
internal ISigScanner SigScanner { get; init; } = null!;
|
||||||
|
|
||||||
|
[PluginService]
|
||||||
|
internal IGameInteropProvider GameInteropProvider { get; init; } = null!;
|
||||||
|
|
||||||
internal Configuration Config { get; }
|
internal Configuration Config { get; }
|
||||||
internal PluginUi Ui { get; }
|
internal PluginUi Ui { get; }
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Tourist {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ImGui.Begin(this.Plugin.Name, ref this._show, ImGuiWindowFlags.MenuBar)) {
|
if (!ImGui.Begin(Plugin.Name, ref this._show, ImGuiWindowFlags.MenuBar)) {
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Dalamud.Game.Gui;
|
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
|
using Dalamud.Plugin.Services;
|
||||||
using FFXIVWeather.Lumina;
|
using FFXIVWeather.Lumina;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ namespace Tourist {
|
||||||
public static class Util {
|
public static class Util {
|
||||||
private static Dictionary<uint, (DateTimeOffset start, DateTimeOffset end)> Availability { get; } = new();
|
private static Dictionary<uint, (DateTimeOffset start, DateTimeOffset end)> Availability { get; } = new();
|
||||||
|
|
||||||
public static void OpenMapLocation(this GameGui gameGui, Adventure adventure) {
|
public static void OpenMapLocation(this IGameGui gameGui, Adventure adventure) {
|
||||||
var loc = adventure.Level?.Value;
|
var loc = adventure.Level?.Value;
|
||||||
var map = loc?.Map?.Value;
|
var map = loc?.Map?.Value;
|
||||||
var terr = map?.TerritoryType?.Value;
|
var terr = map?.TerritoryType?.Value;
|
||||||
|
|
Loading…
Reference in New Issue