From 8c747ba661c0c8bd6585298a09a1077beeb431a9 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Mon, 7 Nov 2022 14:50:12 +0100 Subject: [PATCH] Include more detailed troubleshooting steps for weird splatoon installs --- Pal.Client/Pal.Client.csproj | 2 +- Pal.Client/Windows/ConfigWindow.cs | 71 ++++++++++++++++++++---------- 2 files changed, 49 insertions(+), 24 deletions(-) diff --git a/Pal.Client/Pal.Client.csproj b/Pal.Client/Pal.Client.csproj index 5f366a8..c7bf7a0 100644 --- a/Pal.Client/Pal.Client.csproj +++ b/Pal.Client/Pal.Client.csproj @@ -3,7 +3,7 @@ net6.0-windows 9.0 - 1.15.0.0 + 1.16.0.0 enable diff --git a/Pal.Client/Windows/ConfigWindow.cs b/Pal.Client/Windows/ConfigWindow.cs index 99a116d..3e0165c 100644 --- a/Pal.Client/Windows/ConfigWindow.cs +++ b/Pal.Client/Windows/ConfigWindow.cs @@ -1,11 +1,14 @@ using Dalamud.Interface.Components; using Dalamud.Interface.Windowing; +using ECommons.Reflection; using ECommons.SplatoonAPI; using ImGuiNET; using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Numerics; +using System.Reflection; using System.Threading.Tasks; namespace Pal.Client.Windows @@ -181,29 +184,7 @@ namespace Pal.Client.Windows ImGui.Separator(); if (ImGui.Button("Draw trap & coffer circles around self")) - { - try - { - Vector3? pos = Service.ClientState.LocalPlayer?.Position; - if (pos != null) - { - var elements = new List - { - Plugin.CreateSplatoonElement(Marker.EType.Trap, pos.Value, _trapColor), - Plugin.CreateSplatoonElement(Marker.EType.Hoard, pos.Value, _hoardColor), - }; - - if (!Splatoon.AddDynamicElements("PalacePal.Test", elements.ToArray(), new long[] { Environment.TickCount64 + 10000 })) - { - Service.Chat.PrintError("Could not draw markers :("); - } - } - } - catch (Exception) - { - Service.Chat.PrintError("Could not draw markers, is Splatoon installed and enabled?"); - } - } + DrawDebugItems(); ImGui.EndTabItem(); } @@ -230,5 +211,49 @@ namespace Pal.Client.Windows IsOpen = false; } } + + private void DrawDebugItems() + { + try + { + Vector3? pos = Service.ClientState.LocalPlayer?.Position; + if (pos != null) + { + var elements = new List + { + Plugin.CreateSplatoonElement(Marker.EType.Trap, pos.Value, _trapColor), + Plugin.CreateSplatoonElement(Marker.EType.Hoard, pos.Value, _hoardColor), + }; + + if (!Splatoon.AddDynamicElements("PalacePal.Test", elements.ToArray(), new long[] { Environment.TickCount64 + 10000 })) + { + Service.Chat.PrintError("Could not draw markers :("); + } + } + } + catch (Exception) + { + try + { + var pluginManager = DalamudReflector.GetPluginManager(); + IList installedPlugins = pluginManager.GetType().GetProperty("InstalledPlugins")?.GetValue(pluginManager) as IList ?? new List(); + + foreach (var t in installedPlugins) + { + AssemblyName? assemblyName = (AssemblyName?)t.GetType().GetProperty("AssemblyName")?.GetValue(t); + string? pluginName = (string?)t.GetType().GetProperty("Name")?.GetValue(t); + if (assemblyName?.Name == "Splatoon" && pluginName != "Splatoon") + { + Service.Chat.PrintError($"[Palace Pal] Splatoon is installed under the plugin name '{pluginName}', which is incompatible with the Splatoon API."); + Service.Chat.Print("[Palace Pal] You need to install Splatoon from the official repository at https://github.com/NightmareXIV/MyDalamudPlugins."); + return; + } + } + } + catch (Exception) { } + + Service.Chat.PrintError("Could not draw markers, is Splatoon installed and enabled?"); + } + } } }