-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8a2626c
Showing
6 changed files
with
212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Publish | ||
on: | ||
push: | ||
tags: ["*"] | ||
|
||
env: | ||
SOLUTION_NAME: Umbra.CounterSpyPlugin | ||
RELEASE_DIR: out/Release | ||
|
||
jobs: | ||
Build: | ||
permissions: | ||
contents: write | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up .NET | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Download Dalamud Latest | ||
run: | | ||
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/latest.zip -OutFile latest.zip | ||
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev" | ||
- name: Download Umbra Latest | ||
run: | | ||
Invoke-WebRequest -Uri https://raw.githubusercontent.com/una-xiv/umbra-dist/main/dist/Umbra/latest.zip -OutFile latest.zip | ||
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\installedPlugins\Umbra\dist" | ||
- name: Restore solution | ||
run: dotnet restore -r win ${{ env.SOLUTION_NAME }}.sln | ||
|
||
- name: Build solution | ||
run: | | ||
dotnet restore -r win ${{ env.SOLUTION_NAME }}.sln | ||
dotnet build --configuration Release | ||
- name: Create plugin archive | ||
run: Compress-Archive -Path ${{env.RELEASE_DIR}}* -DestinationPath ${{env.RELEASE_DIR}}/${{env.SOLUTION_NAME}}.zip | ||
|
||
- name: Publish Plugin | ||
uses: softprops/action-gh-release@v2 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: ${{env.RELEASE_DIR}}/${{env.SOLUTION_NAME}}.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
out/ | ||
obj/ | ||
/packages/ | ||
riderModule.iml | ||
/_ReSharper.Caches/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Counter Spy plugin for Umbra | ||
|
||
Adds world markers to other players that are currently targeting you. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbra.CounterSpyPlugin", "Umbra.CounterSpyPlugin\Umbra.CounterSpyPlugin.csproj", "{53E266A9-368F-40F3-9A37-BB1ED7385B06}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{53E266A9-368F-40F3-9A37-BB1ED7385B06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{53E266A9-368F-40F3-9A37-BB1ED7385B06}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{53E266A9-368F-40F3-9A37-BB1ED7385B06}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{53E266A9-368F-40F3-9A37-BB1ED7385B06}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath> | ||
</PropertyGroup> | ||
<!-- <PropertyGroup>--> | ||
<!-- <UmbraLibPath>Z:\FFXIV-plugins\una-xiv-plugins\Umbra\out\Release\</UmbraLibPath>--> | ||
<!-- </PropertyGroup>--> | ||
<PropertyGroup> | ||
<UmbraLibPath>$([System.IO.Directory]::GetDirectories($(appdata)\XIVLauncher\installedPlugins\Umbra\)[0])\</UmbraLibPath> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0-windows</TargetFramework> | ||
<Platforms>x64</Platforms> | ||
<Nullable>enable</Nullable> | ||
<LangVersion>latest</LangVersion> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly> | ||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> | ||
<OutputPath>..\out\$(Configuration)\</OutputPath> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<Authors>Una</Authors> | ||
<Company>Una XIV</Company> | ||
<Version>1.0.0.0</Version> | ||
<Description>A counter spy plugin.</Description> | ||
<Copyright>(C)2024</Copyright> | ||
<PackageProjectUrl>https://github.com/una-xiv/Umbra.CounterSpyPlugin</PackageProjectUrl> | ||
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Umbra"> | ||
<HintPath>$(UmbraLibPath)Umbra.dll</HintPath> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Umbra.Common"> | ||
<HintPath>$(UmbraLibPath)Umbra.Common.dll</HintPath> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Umbra.Game"> | ||
<HintPath>$(UmbraLibPath)Umbra.Game.dll</HintPath> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Una.Drawing"> | ||
<HintPath>$(UmbraLibPath)Una.Drawing.dll</HintPath> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Dalamud"> | ||
<HintPath>$(DalamudLibPath)Dalamud.dll</HintPath> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="FFXIVClientStructs"> | ||
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Lumina"> | ||
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath> | ||
<Private>false</Private> | ||
</Reference> | ||
<Reference Include="Lumina.Excel"> | ||
<HintPath>$(DalamudLibPath)Lumina.Excel.dll</HintPath> | ||
<Private>false</Private> | ||
</Reference> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System.Collections.Generic; | ||
using Dalamud.Game.ClientState.Objects.Enums; | ||
using Dalamud.Plugin.Services; | ||
using Umbra.Common; | ||
using Umbra.Game; | ||
using Umbra.Markers; | ||
|
||
namespace Umbra.CounterSpyPlugin; | ||
|
||
[Service] | ||
internal sealed class CounterSpyMarker( | ||
IObjectTable objectTable, | ||
IClientState clientState, | ||
IZoneManager zoneManager | ||
) : WorldMarkerFactory | ||
{ | ||
public override string Id => "Umbra_CounterSpyMarker"; | ||
public override string Name => "Counter Spy Marker"; | ||
public override string Description => "Shows world markers on players and NPCs that are targeting you."; | ||
|
||
public override List<IMarkerConfigVariable> GetConfigVariables() | ||
{ | ||
return [ | ||
..DefaultStateConfigVariables, | ||
]; | ||
} | ||
|
||
[OnTick] | ||
private void OnTick() | ||
{ | ||
if (!zoneManager.HasCurrentZone) { | ||
RemoveAllMarkers(); | ||
return; | ||
} | ||
|
||
if (null == clientState.LocalPlayer) return; | ||
ulong localPlayerId = clientState.LocalPlayer.GameObjectId; | ||
|
||
List<string> usedIds = []; | ||
|
||
foreach (var obj in objectTable) { | ||
if (!obj.IsValid() | ||
|| obj.IsDead | ||
|| obj.ObjectKind != ObjectKind.Player | ||
|| obj.GameObjectId == localPlayerId | ||
|| obj.TargetObjectId != localPlayerId) | ||
continue; | ||
|
||
var key = $"CounterSpyMarker_{obj.GameObjectId}"; | ||
usedIds.Add(key); | ||
|
||
SetMarker( | ||
new() { | ||
Key = key, | ||
MapId = zoneManager.CurrentZone.Id, | ||
IconId = 60407u, | ||
Position = obj.Position with { Y = obj.Position.Y + 2f }, | ||
SubLabel = "Targeting you", | ||
FadeDistance = new(0.1f, 1f), | ||
ShowOnCompass = GetConfigValue<bool>("ShowOnCompass"), | ||
} | ||
); | ||
} | ||
|
||
RemoveMarkersExcept(usedIds); | ||
} | ||
} |