Compare commits
No commits in common. "main" and "5ca8dcc49033c59cfa28809bca5c1d2b71ab3768" have entirely different histories.
main
...
5ca8dcc490
|
@ -1,46 +1,23 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net5.0-windows</TargetFramework>
|
||||||
<Version>1.0.2</Version>
|
<Version>1.0.0</Version>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<RootNamespace>PeepingTom.Ipc</RootNamespace>
|
<RootNamespace>PeepingTom.Ipc</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
||||||
<PackageId>PeepingTom.Ipc</PackageId>
|
|
||||||
<Title>PeepingTom.Ipc</Title>
|
|
||||||
<Authors>lojewalo</Authors>
|
|
||||||
<RepositoryUrl>https://git.anna.lgbt/anna/PeepingTom</RepositoryUrl>
|
|
||||||
<Description>Types for IPC with the Dalamud plugin Peeping Tom.</Description>
|
|
||||||
<PackageLicenseExpression>EUPL-1.2</PackageLicenseExpression>
|
|
||||||
</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>
|
<ItemGroup>
|
||||||
<Reference Include="Dalamud">
|
<Reference Include="Dalamud">
|
||||||
<HintPath>$(DalamudLibPath)\Dalamud.dll</HintPath>
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
|
||||||
<Private>false</Private>
|
<Private>false</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Lumina.Excel">
|
<Reference Include="Lumina.Excel">
|
||||||
<HintPath>$(DalamudLibPath)\Lumina.Excel.dll</HintPath>
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.Excel.dll</HintPath>
|
||||||
<Private>false</Private>
|
<Private>false</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json">
|
<Reference Include="Newtonsoft.Json">
|
||||||
<HintPath>$(DalamudLibPath)\Newtonsoft.Json.dll</HintPath>
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>false</Private>
|
<Private>false</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Dalamud.Game.ClientState.Objects;
|
||||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Plugin.Services;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace PeepingTom.Ipc {
|
namespace PeepingTom.Ipc {
|
||||||
|
@ -29,7 +29,7 @@ namespace PeepingTom.Ipc {
|
||||||
this.When = when;
|
this.When = when;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerCharacter? GetPlayerCharacter(IObjectTable objectTable) {
|
public PlayerCharacter? GetPlayerCharacter(ObjectTable objectTable) {
|
||||||
return objectTable.FirstOrDefault(actor => actor.ObjectId == this.ObjectId && actor is PlayerCharacter) as PlayerCharacter;
|
return objectTable.FirstOrDefault(actor => actor.ObjectId == this.ObjectId && actor is PlayerCharacter) as PlayerCharacter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,7 @@ namespace PeepingTom {
|
||||||
public bool PlaySoundOnTarget { get; set; }
|
public bool PlaySoundOnTarget { get; set; }
|
||||||
public string? SoundPath { get; set; }
|
public string? SoundPath { get; set; }
|
||||||
public float SoundVolume { get; set; } = 1f;
|
public float SoundVolume { get; set; } = 1f;
|
||||||
[Obsolete("use new", true)]
|
|
||||||
public int SoundDevice { get; set; } = -1;
|
public int SoundDevice { get; set; } = -1;
|
||||||
public Guid SoundDeviceNew { get; set; } = Guid.Empty;
|
|
||||||
public float SoundCooldown { get; set; } = 10f;
|
public float SoundCooldown { get; set; } = 10f;
|
||||||
public bool PlaySoundWhenClosed { get; set; }
|
public bool PlaySoundWhenClosed { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@ using PeepingTom.Ipc.To;
|
||||||
|
|
||||||
namespace PeepingTom {
|
namespace PeepingTom {
|
||||||
internal class IpcManager : IDisposable {
|
internal class IpcManager : IDisposable {
|
||||||
private Plugin Plugin { get; }
|
private PeepingTomPlugin Plugin { get; }
|
||||||
|
|
||||||
private ICallGateProvider<IFromMessage, object> Provider { get; }
|
private ICallGateProvider<IFromMessage, object> Provider { get; }
|
||||||
private ICallGateSubscriber<IToMessage, object> Subscriber { get; }
|
private ICallGateSubscriber<IToMessage, object> Subscriber { get; }
|
||||||
|
|
||||||
internal IpcManager(Plugin plugin) {
|
internal IpcManager(PeepingTomPlugin plugin) {
|
||||||
this.Plugin = plugin;
|
this.Plugin = plugin;
|
||||||
|
|
||||||
this.Provider = this.Plugin.Interface.GetIpcProvider<IFromMessage, object>(IpcInfo.FromRegistrationName);
|
this.Provider = this.Plugin.Interface.GetIpcProvider<IFromMessage, object>(IpcInfo.FromRegistrationName);
|
||||||
|
|
|
@ -1,26 +1,16 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8-windows</TargetFramework>
|
<TargetFramework>net5-windows</TargetFramework>
|
||||||
<RootNamespace>PeepingTom</RootNamespace>
|
<RootNamespace>PeepingTom</RootNamespace>
|
||||||
<Version>1.7.16</Version>
|
<Version>1.7.7</Version>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AssemblyName>PeepingTom</AssemblyName>
|
<AssemblyName>PeepingTom</AssemblyName>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
|
||||||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
||||||
</PropertyGroup>
|
</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>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Resources\target.wav"/>
|
<EmbeddedResource Include="Resources\target.wav"/>
|
||||||
<EmbeddedResource Update="Resources\Language.resx">
|
<EmbeddedResource Update="Resources\Language.resx">
|
||||||
|
@ -30,33 +20,32 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Dalamud">
|
<Reference Include="Dalamud">
|
||||||
<HintPath>$(DalamudLibPath)\Dalamud.dll</HintPath>
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ImGui.NET">
|
<Reference Include="ImGui.NET">
|
||||||
<HintPath>$(DalamudLibPath)\ImGui.NET.dll</HintPath>
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGui.NET.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Lumina">
|
<Reference Include="Lumina">
|
||||||
<HintPath>$(DalamudLibPath)\Lumina.dll</HintPath>
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Lumina.Excel">
|
<Reference Include="Lumina.Excel">
|
||||||
<HintPath>$(DalamudLibPath)\Lumina.Excel.dll</HintPath>
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.Excel.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json">
|
<Reference Include="Newtonsoft.Json">
|
||||||
<HintPath>$(DalamudLibPath)\Newtonsoft.Json.dll</HintPath>
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
|
<PackageReference Include="DalamudPackager" Version="2.1.2"/>
|
||||||
<PackageReference Include="Fody" Version="6.8.0" PrivateAssets="all"/>
|
<PackageReference Include="Fody" Version="6.5.2" PrivateAssets="all"/>
|
||||||
<PackageReference Include="NAudio.Core" Version="2.2.1"/>
|
<PackageReference Include="NAudio" Version="2.0.1"/>
|
||||||
<PackageReference Include="NAudio.Wasapi" Version="2.2.1"/>
|
<PackageReference Include="Resourcer.Fody" Version="1.8.0" PrivateAssets="all"/>
|
||||||
<PackageReference Include="Resourcer.Fody" Version="1.8.1" PrivateAssets="all"/>
|
<PackageReference Include="XivCommon" Version="3.0.1"/>
|
||||||
<PackageReference Include="XivCommon" Version="9.0.0"/>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Peeping Tom.Ipc\Peeping Tom.Ipc.csproj"/>
|
<ProjectReference Include="..\Peeping Tom.Ipc\Peeping Tom.Ipc.csproj"/>
|
||||||
|
@ -68,4 +57,7 @@
|
||||||
<DependentUpon>Language.resx</DependentUpon>
|
<DependentUpon>Language.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="..\icon.png" Link="images/icon.png" CopyToOutputDirectory="PreserveNewest" Visible="false"/>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
author: Anna
|
author: ascclemens
|
||||||
name: Peeping Tom
|
name: Peeping Tom
|
||||||
punchline: Shows who is currently or was previously targeting you.
|
punchline: Shows who is currently or was previously targeting you.
|
||||||
description: Shows who is currently or was previously targeting you.
|
description: Shows who is currently or was previously targeting you.
|
||||||
repo_url: https://git.anna.lgbt/anna/PeepingTom
|
repo_url: https://sr.ht/~jkcclemens/PeepingTom
|
||||||
|
|
|
@ -1,54 +1,58 @@
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using Dalamud.Data;
|
||||||
|
using Dalamud.Game;
|
||||||
|
using Dalamud.Game.ClientState;
|
||||||
using Dalamud.Game.ClientState.Objects;
|
using Dalamud.Game.ClientState.Objects;
|
||||||
|
using Dalamud.Game.Gui;
|
||||||
|
using Dalamud.Game.Gui.Toast;
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Logging;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
using PeepingTom.Resources;
|
using PeepingTom.Resources;
|
||||||
using XivCommon;
|
using XivCommon;
|
||||||
|
using Condition = Dalamud.Game.ClientState.Conditions.Condition;
|
||||||
|
|
||||||
namespace PeepingTom {
|
namespace PeepingTom {
|
||||||
// ReSharper disable once ClassNeverInstantiated.Global
|
// ReSharper disable once ClassNeverInstantiated.Global
|
||||||
public class Plugin : IDalamudPlugin {
|
public class PeepingTomPlugin : IDalamudPlugin {
|
||||||
internal static string Name => "Peeping Tom";
|
public string Name => "Peeping Tom";
|
||||||
|
|
||||||
[PluginService]
|
|
||||||
internal static IPluginLog Log { get; private set; } = null!;
|
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal DalamudPluginInterface Interface { get; init; } = null!;
|
internal DalamudPluginInterface Interface { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal IChatGui ChatGui { get; init; } = null!;
|
internal ChatGui ChatGui { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal IClientState ClientState { get; init; } = null!;
|
internal ClientState ClientState { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
private ICommandManager CommandManager { get; init; } = null!;
|
private CommandManager CommandManager { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal ICondition Condition { get; init; } = null!;
|
internal Condition Condition { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal IDataManager DataManager { get; init; } = null!;
|
internal DataManager DataManager { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal IFramework Framework { get; init; } = null!;
|
internal Framework Framework { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal IGameGui GameGui { get; init; } = null!;
|
internal GameGui GameGui { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal IObjectTable ObjectTable { get; init; } = null!;
|
internal ObjectTable ObjectTable { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal ITargetManager TargetManager { get; init; } = null!;
|
internal TargetManager TargetManager { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal IToastGui ToastGui { get; init; } = null!;
|
internal ToastGui ToastGui { get; init; } = null!;
|
||||||
|
|
||||||
internal Configuration Config { get; }
|
internal Configuration Config { get; }
|
||||||
internal PluginUi Ui { get; }
|
internal PluginUi Ui { get; }
|
||||||
|
@ -58,8 +62,8 @@ namespace PeepingTom {
|
||||||
|
|
||||||
internal bool InPvp { get; private set; }
|
internal bool InPvp { get; private set; }
|
||||||
|
|
||||||
public Plugin() {
|
public PeepingTomPlugin() {
|
||||||
this.Common = new XivCommonBase(this.Interface);
|
this.Common = new XivCommonBase();
|
||||||
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||||
this.Config.Initialize(this.Interface);
|
this.Config.Initialize(this.Interface);
|
||||||
this.Watcher = new TargetWatcher(this);
|
this.Watcher = new TargetWatcher(this);
|
||||||
|
@ -106,12 +110,12 @@ namespace PeepingTom {
|
||||||
Language.Culture = new CultureInfo(langCode);
|
Language.Culture = new CultureInfo(langCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTerritoryChange(ushort e) {
|
private void OnTerritoryChange(object? sender, ushort e) {
|
||||||
try {
|
try {
|
||||||
var territory = this.DataManager.GetExcelSheet<TerritoryType>()!.GetRow(e);
|
var territory = this.DataManager.GetExcelSheet<TerritoryType>()!.GetRow(e);
|
||||||
this.InPvp = territory?.IsPvpZone == true;
|
this.InPvp = territory?.IsPvpZone == true;
|
||||||
} catch (KeyNotFoundException) {
|
} catch (KeyNotFoundException) {
|
||||||
Log.Warning("Could not get territory for current zone");
|
PluginLog.Warning("Could not get territory for current zone");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +127,7 @@ namespace PeepingTom {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLogin() {
|
private void OnLogin(object? sender, EventArgs args) {
|
||||||
if (!this.Config.OpenOnLogin) {
|
if (!this.Config.OpenOnLogin) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +135,7 @@ namespace PeepingTom {
|
||||||
this.Ui.WantsOpen = true;
|
this.Ui.WantsOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLogout() {
|
private void OnLogout(object? sender, EventArgs args) {
|
||||||
this.Ui.WantsOpen = false;
|
this.Ui.WantsOpen = false;
|
||||||
this.Watcher.ClearPrevious();
|
this.Watcher.ClearPrevious();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,15 +11,13 @@ using Dalamud.Game.ClientState.Objects.Types;
|
||||||
using Dalamud.Game.Text;
|
using Dalamud.Game.Text;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface;
|
||||||
using PeepingTom.Ipc;
|
using PeepingTom.Ipc;
|
||||||
using PeepingTom.Resources;
|
using PeepingTom.Resources;
|
||||||
using Dalamud.Interface.ImGuiFileDialog;
|
|
||||||
using Dalamud.Interface;
|
|
||||||
|
|
||||||
namespace PeepingTom {
|
namespace PeepingTom {
|
||||||
internal class PluginUi : IDisposable {
|
internal class PluginUi : IDisposable {
|
||||||
private Plugin Plugin { get; }
|
private PeepingTomPlugin Plugin { get; }
|
||||||
|
|
||||||
private uint? PreviousFocus { get; set; } = new();
|
private uint? PreviousFocus { get; set; } = new();
|
||||||
|
|
||||||
|
@ -39,11 +37,8 @@ namespace PeepingTom {
|
||||||
set => this._settingsOpen = value;
|
set => this._settingsOpen = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileDialogManager FileDialogManager { get; }
|
public PluginUi(PeepingTomPlugin plugin) {
|
||||||
|
|
||||||
public PluginUi(Plugin plugin) {
|
|
||||||
this.Plugin = plugin;
|
this.Plugin = plugin;
|
||||||
this.FileDialogManager = new FileDialogManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
|
@ -128,10 +123,8 @@ namespace PeepingTom {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowSettings() {
|
private void ShowSettings() {
|
||||||
this.FileDialogManager.Draw();
|
|
||||||
|
|
||||||
ImGui.SetNextWindowSize(new Vector2(700, 250));
|
ImGui.SetNextWindowSize(new Vector2(700, 250));
|
||||||
var windowTitle = string.Format(Language.SettingsTitle, Plugin.Name);
|
var windowTitle = string.Format(Language.SettingsTitle, this.Plugin.Name);
|
||||||
if (!ImGui.Begin($"{windowTitle}###ptom-settings", ref this._settingsOpen, ImGuiWindowFlags.NoResize)) {
|
if (!ImGui.Begin($"{windowTitle}###ptom-settings", ref this._settingsOpen, ImGuiWindowFlags.NoResize)) {
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
return;
|
return;
|
||||||
|
@ -233,46 +226,13 @@ namespace PeepingTom {
|
||||||
this.Plugin.Config.Save();
|
this.Plugin.Config.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.TextUnformatted(Language.SettingsSoundPath);
|
|
||||||
Vector2 buttonSize;
|
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
|
||||||
try {
|
|
||||||
buttonSize = ImGuiHelpers.GetButtonSize(FontAwesomeIcon.Folder.ToIconString());
|
|
||||||
} finally {
|
|
||||||
ImGui.PopFont();
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = this.Plugin.Config.SoundPath ?? "";
|
var path = this.Plugin.Config.SoundPath ?? "";
|
||||||
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - buttonSize.X);
|
if (ImGui.InputText(Language.SettingsSoundPath, ref path, 1_000)) {
|
||||||
if (ImGui.InputText("###sound-path", ref path, 1_000)) {
|
|
||||||
path = path.Trim();
|
path = path.Trim();
|
||||||
this.Plugin.Config.SoundPath = path.Length == 0 ? null : path;
|
this.Plugin.Config.SoundPath = path.Length == 0 ? null : path;
|
||||||
this.Plugin.Config.Save();
|
this.Plugin.Config.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
|
||||||
|
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
|
||||||
try {
|
|
||||||
if (ImGui.Button(FontAwesomeIcon.Folder.ToIconString())) {
|
|
||||||
this.FileDialogManager.OpenFileDialog(
|
|
||||||
Language.SettingsSoundPath,
|
|
||||||
".wav,.mp3,.aif,.aiff,.wma,.aac",
|
|
||||||
(selected, selectedPath) => {
|
|
||||||
if (!selected) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
path = selectedPath.Trim();
|
|
||||||
this.Plugin.Config.SoundPath = path.Length == 0 ? null : path;
|
|
||||||
this.Plugin.Config.Save();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
ImGui.PopFont();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.Text(Language.SettingsSoundPathHelp);
|
ImGui.Text(Language.SettingsSoundPathHelp);
|
||||||
|
|
||||||
var volume = this.Plugin.Config.SoundVolume * 100f;
|
var volume = this.Plugin.Config.SoundVolume * 100f;
|
||||||
|
@ -281,18 +241,32 @@ namespace PeepingTom {
|
||||||
this.Plugin.Config.Save();
|
this.Plugin.Config.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
var devices = DirectSoundOut.Devices.ToList();
|
var soundDevice = this.Plugin.Config.SoundDevice;
|
||||||
var soundDevice = devices.FirstOrDefault(d => d.Guid == this.Plugin.Config.SoundDeviceNew);
|
string name;
|
||||||
var name = soundDevice != null ? soundDevice.Description : Language.SettingsSoundInvalidDevice;
|
if (soundDevice == -1) {
|
||||||
|
name = Language.SettingsSoundDefaultDevice;
|
||||||
|
} else if (soundDevice > -1 && soundDevice < WaveOut.DeviceCount) {
|
||||||
|
var caps = WaveOut.GetCapabilities(soundDevice);
|
||||||
|
name = caps.ProductName;
|
||||||
|
} else {
|
||||||
|
name = Language.SettingsSoundInvalidDevice;
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui.BeginCombo($"{Language.SettingsSoundOutputDevice}###sound-output-device-combo", name)) {
|
if (ImGui.BeginCombo($"{Language.SettingsSoundOutputDevice}###sound-output-device-combo", name)) {
|
||||||
for (var deviceNum = 0; deviceNum < devices.Count; deviceNum++) {
|
if (ImGui.Selectable(Language.SettingsSoundDefaultDevice)) {
|
||||||
var info = devices[deviceNum];
|
this.Plugin.Config.SoundDevice = -1;
|
||||||
if (!ImGui.Selectable($"{info.Description}##{deviceNum}")) {
|
this.Plugin.Config.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.Separator();
|
||||||
|
|
||||||
|
for (var deviceNum = 0; deviceNum < WaveOut.DeviceCount; deviceNum++) {
|
||||||
|
var caps = WaveOut.GetCapabilities(deviceNum);
|
||||||
|
if (!ImGui.Selectable(caps.ProductName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Plugin.Config.SoundDeviceNew = info.Guid;
|
this.Plugin.Config.SoundDevice = deviceNum;
|
||||||
this.Plugin.Config.Save();
|
this.Plugin.Config.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,6 +370,41 @@ namespace PeepingTom {
|
||||||
ImGui.EndTabItem();
|
ImGui.EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
if (ImGui.BeginTabItem("Debug")) {
|
||||||
|
if (ImGui.Button("Log targeting you")) {
|
||||||
|
var player = this.Plugin.Interface.ClientState.LocalPlayer;
|
||||||
|
if (player != null) {
|
||||||
|
// loop over all players looking at the current player
|
||||||
|
var actors = this.Plugin.Interface.ClientState.Actors
|
||||||
|
.Where(actor => actor.TargetActorID == player.ActorId && actor is PlayerCharacter)
|
||||||
|
.Cast<PlayerCharacter>();
|
||||||
|
foreach (var actor in actors) {
|
||||||
|
var payload = new PlayerPayload(this.Plugin.Interface.Data, actor.Name.TextValue, actor.HomeWorld.Id);
|
||||||
|
Payload[] payloads = {payload};
|
||||||
|
this.Plugin.Interface.Framework.Gui.Chat.PrintChat(new XivChatEntry {
|
||||||
|
Message = new SeString(payloads),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.Button("Log your target")) {
|
||||||
|
var target = this.GetCurrentTarget();
|
||||||
|
|
||||||
|
if (target != null) {
|
||||||
|
var payload = new PlayerPayload(this.Plugin.Interface.Data, target.Name.TextValue, target.HomeWorld.Id);
|
||||||
|
Payload[] payloads = {payload};
|
||||||
|
this.Plugin.Interface.Framework.Gui.Chat.PrintChat(new XivChatEntry {
|
||||||
|
Message = new SeString(payloads),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndTabItem();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ImGui.EndTabBar();
|
ImGui.EndTabBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +441,7 @@ namespace PeepingTom {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SetNextWindowSize(new Vector2(290, 195), ImGuiCond.FirstUseEver);
|
ImGui.SetNextWindowSize(new Vector2(290, 195), ImGuiCond.FirstUseEver);
|
||||||
if (!ImGui.Begin(Plugin.Name, ref this._wantsOpen, flags)) {
|
if (!ImGui.Begin(this.Plugin.Name, ref this._wantsOpen, flags)) {
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -519,8 +528,7 @@ namespace PeepingTom {
|
||||||
var time = DateTime.UtcNow - targeter.When >= TimeSpan.FromDays(1)
|
var time = DateTime.UtcNow - targeter.When >= TimeSpan.FromDays(1)
|
||||||
? targeter.When.ToLocalTime().ToString("dd/MM")
|
? targeter.When.ToLocalTime().ToString("dd/MM")
|
||||||
: targeter.When.ToLocalTime().ToString("t");
|
: targeter.When.ToLocalTime().ToString("t");
|
||||||
var windowWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
ImGui.SameLine(ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(time).X);
|
||||||
ImGui.SameLine(windowWidth - ImGui.CalcTextSize(time).X);
|
|
||||||
|
|
||||||
if (flags.HasFlag(ImGuiSelectableFlags.Disabled)) {
|
if (flags.HasFlag(ImGuiSelectableFlags.Disabled)) {
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetStyle().Colors[(int) ImGuiCol.TextDisabled]);
|
ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetStyle().Colors[(int) ImGuiCol.TextDisabled]);
|
||||||
|
@ -562,7 +570,7 @@ namespace PeepingTom {
|
||||||
} else {
|
} else {
|
||||||
var payload = new PlayerPayload(targeter.Name.TextValue, targeter.HomeWorldId);
|
var payload = new PlayerPayload(targeter.Name.TextValue, targeter.HomeWorldId);
|
||||||
Payload[] payloads = { payload };
|
Payload[] payloads = { payload };
|
||||||
this.Plugin.ChatGui.Print(new XivChatEntry {
|
this.Plugin.ChatGui.PrintChat(new XivChatEntry {
|
||||||
Message = new SeString(payloads),
|
Message = new SeString(payloads),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,17 @@ using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||||
using Dalamud.Game.ClientState.Objects.Types;
|
using Dalamud.Game.ClientState.Objects.Types;
|
||||||
using Dalamud.Game.Text;
|
using Dalamud.Game.Text;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Logging;
|
||||||
using PeepingTom.Ipc;
|
using PeepingTom.Ipc;
|
||||||
using PeepingTom.Resources;
|
using PeepingTom.Resources;
|
||||||
|
|
||||||
namespace PeepingTom {
|
namespace PeepingTom {
|
||||||
internal class TargetWatcher : IDisposable {
|
internal class TargetWatcher : IDisposable {
|
||||||
private Plugin Plugin { get; }
|
private PeepingTomPlugin Plugin { get; }
|
||||||
|
|
||||||
private Stopwatch UpdateWatch { get; } = new();
|
private Stopwatch UpdateWatch { get; } = new();
|
||||||
private Stopwatch? SoundWatch { get; set; }
|
private Stopwatch? SoundWatch { get; set; }
|
||||||
|
@ -29,7 +30,7 @@ namespace PeepingTom {
|
||||||
|
|
||||||
public IReadOnlyCollection<Targeter> PreviousTargeters => this.Previous;
|
public IReadOnlyCollection<Targeter> PreviousTargeters => this.Previous;
|
||||||
|
|
||||||
public TargetWatcher(Plugin plugin) {
|
public TargetWatcher(PeepingTomPlugin plugin) {
|
||||||
this.Plugin = plugin;
|
this.Plugin = plugin;
|
||||||
this.UpdateWatch.Start();
|
this.UpdateWatch.Start();
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ namespace PeepingTom {
|
||||||
this.Previous.Clear();
|
this.Previous.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFrameworkUpdate(IFramework framework1) {
|
private void OnFrameworkUpdate(Framework framework) {
|
||||||
if (this.Plugin.InPvp) {
|
if (this.Plugin.InPvp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +68,7 @@ namespace PeepingTom {
|
||||||
try {
|
try {
|
||||||
this.Plugin.IpcManager.SendNewTargeter(newTargeter);
|
this.Plugin.IpcManager.SendNewTargeter(newTargeter);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Plugin.Log.Error(ex, "Failed to send IPC message");
|
PluginLog.LogError(ex, "Failed to send IPC message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ namespace PeepingTom {
|
||||||
try {
|
try {
|
||||||
this.Plugin.IpcManager.SendStoppedTargeting(stopped);
|
this.Plugin.IpcManager.SendStoppedTargeting(stopped);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Plugin.Log.Error(ex, "Failed to send IPC message");
|
PluginLog.LogError(ex, "Failed to send IPC message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,9 +160,9 @@ namespace PeepingTom {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlaySound() {
|
private void PlaySound() {
|
||||||
var soundDevice = DirectSoundOut.Devices.FirstOrDefault(d => d.Guid == this.Plugin.Config.SoundDeviceNew);
|
var soundDevice = this.Plugin.Config.SoundDevice;
|
||||||
if (soundDevice == null) {
|
if (soundDevice < -1 || soundDevice > WaveOut.DeviceCount) {
|
||||||
return;
|
soundDevice = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
new Thread(() => {
|
new Thread(() => {
|
||||||
|
@ -170,7 +171,7 @@ namespace PeepingTom {
|
||||||
if (this.Plugin.Config.SoundPath == null) {
|
if (this.Plugin.Config.SoundPath == null) {
|
||||||
reader = new WaveFileReader(Resource.AsStream("Resources/target.wav"));
|
reader = new WaveFileReader(Resource.AsStream("Resources/target.wav"));
|
||||||
} else {
|
} else {
|
||||||
reader = new MediaFoundationReader(this.Plugin.Config.SoundPath);
|
reader = new AudioFileReader(this.Plugin.Config.SoundPath);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
var error = string.Format(Language.SoundChatError, e.Message);
|
var error = string.Format(Language.SoundChatError, e.Message);
|
||||||
|
@ -184,8 +185,9 @@ namespace PeepingTom {
|
||||||
};
|
};
|
||||||
|
|
||||||
using (reader) {
|
using (reader) {
|
||||||
using var output = new DirectSoundOut(soundDevice.Guid);
|
using var output = new WaveOutEvent {
|
||||||
|
DeviceNumber = soundDevice,
|
||||||
|
};
|
||||||
try {
|
try {
|
||||||
output.Init(channel);
|
output.Init(channel);
|
||||||
output.Play();
|
output.Play();
|
||||||
|
@ -194,15 +196,15 @@ namespace PeepingTom {
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Plugin.Log.Error(ex, "Exception playing sound");
|
PluginLog.LogError(ex, "Exception playing sound");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).Start();
|
}).Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendError(string message) {
|
private void SendError(string message) {
|
||||||
this.Plugin.ChatGui.Print(new XivChatEntry {
|
this.Plugin.ChatGui.PrintChat(new XivChatEntry {
|
||||||
Message = $"[{Plugin.Name}] {message}",
|
Message = $"[{this.Plugin.Name}] {message}",
|
||||||
Type = XivChatType.ErrorMessage,
|
Type = XivChatType.ErrorMessage,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
{
|
|
||||||
"version": 1,
|
|
||||||
"dependencies": {
|
|
||||||
"net8.0-windows7.0": {
|
|
||||||
"DalamudPackager": {
|
|
||||||
"type": "Direct",
|
|
||||||
"requested": "[2.1.12, )",
|
|
||||||
"resolved": "2.1.12",
|
|
||||||
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
|
|
||||||
},
|
|
||||||
"Fody": {
|
|
||||||
"type": "Direct",
|
|
||||||
"requested": "[6.8.0, )",
|
|
||||||
"resolved": "6.8.0",
|
|
||||||
"contentHash": "hfZ/f8Mezt8aTkgv9nsvFdYoQ809/AqwsJlOGOPYIfBcG2aAIG3v3ex9d8ZqQuFYyMoucjRg4eKy3VleeGodKQ=="
|
|
||||||
},
|
|
||||||
"NAudio.Core": {
|
|
||||||
"type": "Direct",
|
|
||||||
"requested": "[2.2.1, )",
|
|
||||||
"resolved": "2.2.1",
|
|
||||||
"contentHash": "GgkdP6K/7FqXFo7uHvoqGZTJvW4z8g2IffhOO4JHaLzKCdDOUEzVKtveoZkCuUX8eV2HAINqi7VFqlFndrnz/g=="
|
|
||||||
},
|
|
||||||
"NAudio.Wasapi": {
|
|
||||||
"type": "Direct",
|
|
||||||
"requested": "[2.2.1, )",
|
|
||||||
"resolved": "2.2.1",
|
|
||||||
"contentHash": "lFfXoqacZZe0WqNChJgGYI+XV/n/61LzPHT3C1CJp4khoxeo2sziyX5wzNYWeCMNbsWxFvT3b3iXeY1UYjBhZw==",
|
|
||||||
"dependencies": {
|
|
||||||
"NAudio.Core": "2.2.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Resourcer.Fody": {
|
|
||||||
"type": "Direct",
|
|
||||||
"requested": "[1.8.1, )",
|
|
||||||
"resolved": "1.8.1",
|
|
||||||
"contentHash": "FPeK4jKyyX5+mIjTnHNReGZk2/2xDhmu44UsBI5w9WEhbr4oTMmht3rnBr46A+GCGepC4+2N41K4vExDYiGNVQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"Fody": "6.6.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"XivCommon": {
|
|
||||||
"type": "Direct",
|
|
||||||
"requested": "[9.0.0, )",
|
|
||||||
"resolved": "9.0.0",
|
|
||||||
"contentHash": "avaBp3FmSCi/PiQhntCeBDYOHejdyTWmFtz4pRBVQQ8vHkmRx+YTk1la9dkYBMlXxRXKckEdH1iI1Fu61JlE7w=="
|
|
||||||
},
|
|
||||||
"PeepingTom.Ipc": {
|
|
||||||
"type": "Project"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user