Compare commits

...

No commits in common. "main" and "e8fef5524bc37fcb93a734849773dabf23362754" have entirely different histories.

6 changed files with 34 additions and 53 deletions

View File

@ -1,42 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.2.10</Version>
<TargetFramework>net7-windows</TargetFramework>
<Version>1.2.4</Version>
<TargetFramework>net5-windows</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
<PropertyGroup>
<DalamudLibPath>$(AppData)\XIVLauncher\addon\Hooks\dev</DalamudLibPath>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
<DalamudLibPath>$(DALAMUD_HOME)</DalamudLibPath>
</PropertyGroup>
<PropertyGroup Condition="'$(IsCI)' == 'true'">
<DalamudLibPath>$(HOME)/dalamud</DalamudLibPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="Dalamud">
<HintPath>$(DalamudLibPath)\Dalamud.dll</HintPath>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ImGui.NET">
<HintPath>$(DalamudLibPath)\ImGui.NET.dll</HintPath>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGui.NET.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ImGuiScene">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGuiScene.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Lumina">
<HintPath>$(DalamudLibPath)\Lumina.dll</HintPath>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Lumina.Excel">
<HintPath>$(DalamudLibPath)\Lumina.Excel.dll</HintPath>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.Excel.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.12" />
<PackageReference Include="DalamudPackager" Version="2.1.5"/>
</ItemGroup>
<ItemGroup>
<Content Include="..\icon.png" Link="images/icon.png" CopyToOutputDirectory="PreserveNewest" Visible="false"/>
</ItemGroup>
</Project>

View File

@ -1,8 +1,8 @@
author: Anna
author: ascclemens
name: Globetrotter
punchline: Automatically shows where treasure maps are located.
description: |-
Automatically shows where treasure maps are located.
Icon: Map by Adrien Coquet from the Noun Project
repo_url: https://git.anna.lgbt/anna/Globetrotter
repo_url: https://git.sr.ht/~jkcclemens/Globetrotter

View File

@ -1,41 +1,38 @@
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 Plugin : IDalamudPlugin {
public class GlobetrotterPlugin : IDalamudPlugin {
private bool _disposedValue;
[PluginService]
internal static IPluginLog Log { get; private set; } = null!;
public string Name => "Globetrotter";
[PluginService]
private DalamudPluginInterface Interface { get; init; } = null!;
[PluginService]
private ICommandManager CommandManager { get; init; } = null!;
private CommandManager CommandManager { get; init; } = null!;
[PluginService]
internal IDataManager DataManager { get; init; } = null!;
internal DataManager DataManager { get; init; } = null!;
[PluginService]
internal IGameGui GameGui { get; init; } = null!;
internal GameGui GameGui { get; init; } = null!;
[PluginService]
internal ISigScanner SigScanner { get; init; } = null!;
[PluginService]
internal IGameInteropProvider GameInteropProvider { get; init; } = null!;
internal SigScanner SigScanner { get; init; } = null!;
internal Configuration Config { get; }
private PluginUi Ui { get; }
private TreasureMaps Maps { get; }
public Plugin() {
public GlobetrotterPlugin() {
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
this.Config.Initialize(this.Interface);

View File

@ -3,7 +3,7 @@ using System.Numerics;
namespace Globetrotter {
internal class PluginUi {
private Plugin Plugin { get; }
private GlobetrotterPlugin Plugin { get; }
private bool _displaySettings;
@ -12,7 +12,7 @@ namespace Globetrotter {
set => this._displaySettings = value;
}
public PluginUi(Plugin plugin) {
public PluginUi(GlobetrotterPlugin plugin) {
this.Plugin = plugin;
}

View File

@ -5,6 +5,7 @@ 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 {
@ -47,7 +48,7 @@ namespace Globetrotter {
}
}
private Plugin Plugin { get; }
private GlobetrotterPlugin Plugin { get; }
private TreasureMapPacket? _lastMap;
private delegate char HandleActorControlSelfDelegate(long a1, long a2, IntPtr dataPtr);
@ -57,15 +58,15 @@ namespace Globetrotter {
private readonly Hook<HandleActorControlSelfDelegate> _acsHook;
private readonly Hook<ShowTreasureMapDelegate> _showMapHook;
public TreasureMaps(Plugin plugin) {
public TreasureMaps(GlobetrotterPlugin 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 = this.Plugin.GameInteropProvider.HookFromAddress<HandleActorControlSelfDelegate>(acsPtr, this.OnACS);
this._acsHook = new Hook<HandleActorControlSelfDelegate>(acsPtr, this.OnACS);
this._acsHook.Enable();
var showMapPtr = this.Plugin.SigScanner.ScanText("E8 ?? ?? ?? ?? 40 84 FF 0F 85 ?? ?? ?? ?? 48 8B 0D");
this._showMapHook = this.Plugin.GameInteropProvider.HookFromAddress<ShowTreasureMapDelegate>(showMapPtr, this.OnShowMap);
this._showMapHook = new Hook<ShowTreasureMapDelegate>(showMapPtr, this.OnShowMap);
this._showMapHook.Enable();
}
@ -88,7 +89,7 @@ namespace Globetrotter {
return IntPtr.Zero;
}
} catch (Exception ex) {
Plugin.Log.Error(ex, "Exception on show map");
PluginLog.LogError(ex, "Exception on show map");
}
return this._showMapHook.Original(manager, rowId, subRowId, a4);
@ -116,7 +117,7 @@ namespace Globetrotter {
try {
this.OnACSInner(dataPtr);
} catch (Exception ex) {
Plugin.Log.Error(ex, "Exception on ACS");
PluginLog.LogError(ex, "Exception on ACS");
}
return this._acsHook.Original(a1, a2, dataPtr);

View File

@ -1,13 +0,0 @@
{
"version": 1,
"dependencies": {
"net7.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[2.1.12, )",
"resolved": "2.1.12",
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
}
}
}
}