Skip to content

Commit

Permalink
Add Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
MidoriKami committed Oct 7, 2023
0 parents commit 9dc2176
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 0 deletions.
29 changes: 29 additions & 0 deletions WhoAmIAgain.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WhoAmIAgain", "WhoAmIAgain\WhoAmIAgain.csproj", "{13C812E9-0D42-4B95-8646-40EEBF30636F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.ActiveCfg = Debug|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.Build.0 = Debug|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.ActiveCfg = Release|x64
{13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.Build.0 = Release|x64
{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Debug|x64.ActiveCfg = Debug|x64
{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Debug|x64.Build.0 = Debug|x64
{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Release|x64.ActiveCfg = Release|x64
{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B17E85B1-5F60-4440-9F9A-3DDE877E8CDF}
EndGlobalSection
EndGlobal
46 changes: 46 additions & 0 deletions WhoAmIAgain/WhoAmIAgain.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Dalamud.Game.Gui.Dtr;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;

namespace WhereAmIAgain;

public sealed class WhoAmIAgainPlugin : IDalamudPlugin
{
private readonly IClientState clientState;
private readonly IDtrBar dtrBar;

private DtrBarEntry? dtrBarEntry;

public WhoAmIAgainPlugin(IClientState clientStateService, IDtrBar dtrService)
{
clientState = clientStateService;
dtrBar = dtrService;

if (clientState.IsLoggedIn) OnLogin();

clientState.Login += OnLogin;
clientState.Logout += OnLogout;
}

private void OnLogin()
{
if (dtrBar.Get("WhoAmIAgain") is not { } entry) return;

dtrBarEntry = entry;
dtrBarEntry.Text = clientState.LocalPlayer?.Name;
dtrBarEntry.Tooltip = new SeStringBuilder().AddText($"You are: {clientState.LocalPlayer?.Name ?? "Unknown"}").Build();
}

private void OnLogout()
{
dtrBarEntry?.Remove();
dtrBarEntry = null;
}

public void Dispose()
{
clientState.Login -= OnLogin;
clientState.Logout -= OnLogout;
}
}
60 changes: 60 additions & 0 deletions WhoAmIAgain/WhoAmIAgain.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyVersion>1.0.0.1</AssemblyVersion>
<Description>Shows what zone/region/territory you are in next to the server info.</Description>
<PackageProjectUrl>https://github.com/cassandra308/WhereAmIAgain</PackageProjectUrl>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<Platforms>x64</Platforms>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<PropertyGroup>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.12" />
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Dalamud">
<HintPath>$(DalamudLibPath)Dalamud.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGui.NET">
<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>
</Reference>
<Reference Include="Lumina.Excel">
<HintPath>$(DalamudLibPath)Lumina.Excel.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>

<ItemGroup>
<None Remove="packages.lock.json" />
<None Remove="WhereAmIAgain.json" />
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions WhoAmIAgain/WhoAmIAgain.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>F:\dev\WhereAmIAgainVS\WhereAmIAgain\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
</Project>
11 changes: 11 additions & 0 deletions WhoAmIAgain/WhoAmIAgain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Author": "MidoriKami",
"Name": "Who am I again?",
"InternalName": "WhoAmIAgain",
"Description": "Shows how you are in the server info bar.",
"ApplicableVersion": "any",
"RepoUrl": "https://github.com/MidoriKami/WhoAmIAgain",
"Tags": [ "Area", "Info", "Location", "Overlay", "UI", "Zone" ],
"CategoryTags": [ "UI" ],
"Punchline": "Ever forget who you are? We can fix that!"
}

0 comments on commit 9dc2176

Please sign in to comment.