From 9dc2176ec6c19e21081edc413abae9c85423538f Mon Sep 17 00:00:00 2001 From: MidoriKami <9083275+MidoriKami@users.noreply.github.com> Date: Sat, 7 Oct 2023 13:26:43 -0700 Subject: [PATCH] Add Plugin --- WhoAmIAgain.sln | 29 ++++++++++++++ WhoAmIAgain/WhoAmIAgain.cs | 46 ++++++++++++++++++++++ WhoAmIAgain/WhoAmIAgain.csproj | 60 +++++++++++++++++++++++++++++ WhoAmIAgain/WhoAmIAgain.csproj.user | 6 +++ WhoAmIAgain/WhoAmIAgain.json | 11 ++++++ 5 files changed, 152 insertions(+) create mode 100644 WhoAmIAgain.sln create mode 100644 WhoAmIAgain/WhoAmIAgain.cs create mode 100644 WhoAmIAgain/WhoAmIAgain.csproj create mode 100644 WhoAmIAgain/WhoAmIAgain.csproj.user create mode 100644 WhoAmIAgain/WhoAmIAgain.json diff --git a/WhoAmIAgain.sln b/WhoAmIAgain.sln new file mode 100644 index 0000000..8496b50 --- /dev/null +++ b/WhoAmIAgain.sln @@ -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 diff --git a/WhoAmIAgain/WhoAmIAgain.cs b/WhoAmIAgain/WhoAmIAgain.cs new file mode 100644 index 0000000..903eb9d --- /dev/null +++ b/WhoAmIAgain/WhoAmIAgain.cs @@ -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; + } +} \ No newline at end of file diff --git a/WhoAmIAgain/WhoAmIAgain.csproj b/WhoAmIAgain/WhoAmIAgain.csproj new file mode 100644 index 0000000..cca80fe --- /dev/null +++ b/WhoAmIAgain/WhoAmIAgain.csproj @@ -0,0 +1,60 @@ + + + + 1.0.0.1 + Shows what zone/region/territory you are in next to the server info. + https://github.com/cassandra308/WhereAmIAgain + + + + net7.0-windows + x64 + enable + latest + true + false + false + true + + + + $(appdata)\XIVLauncher\addon\Hooks\dev\ + + + + + + $(DalamudLibPath)FFXIVClientStructs.dll + false + + + $(DalamudLibPath)Newtonsoft.Json.dll + false + + + $(DalamudLibPath)Dalamud.dll + false + + + $(DalamudLibPath)ImGui.NET.dll + false + + + $(DalamudLibPath)ImGuiScene.dll + false + + + $(DalamudLibPath)Lumina.dll + false + + + $(DalamudLibPath)Lumina.Excel.dll + false + + + + + + + + diff --git a/WhoAmIAgain/WhoAmIAgain.csproj.user b/WhoAmIAgain/WhoAmIAgain.csproj.user new file mode 100644 index 0000000..db6cecb --- /dev/null +++ b/WhoAmIAgain/WhoAmIAgain.csproj.user @@ -0,0 +1,6 @@ + + + + <_LastSelectedProfileId>F:\dev\WhereAmIAgainVS\WhereAmIAgain\Properties\PublishProfiles\FolderProfile.pubxml + + \ No newline at end of file diff --git a/WhoAmIAgain/WhoAmIAgain.json b/WhoAmIAgain/WhoAmIAgain.json new file mode 100644 index 0000000..30b3534 --- /dev/null +++ b/WhoAmIAgain/WhoAmIAgain.json @@ -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!" +}