GatheringPathRenderer: minor updates gpr/v0.1
authorLiza Carvelli <liza@carvel.li>
Thu, 9 Jan 2025 18:34:16 +0000 (19:34 +0100)
committerLiza Carvelli <liza@carvel.li>
Thu, 9 Jan 2025 18:34:16 +0000 (19:34 +0100)
Directory.Build.targets
GatheringPathRenderer/.gitignore [new file with mode: 0644]
GatheringPathRenderer/DalamudPackager.targets [new file with mode: 0644]
GatheringPathRenderer/GatheringPathRenderer.csproj
GatheringPathRenderer/GatheringPathRenderer.json
GatheringPathRenderer/RendererPlugin.cs
GatheringPathRenderer/Windows/ConfigWindow.cs [new file with mode: 0644]
GatheringPathRenderer/Windows/EditorWindow.cs
GatheringPaths/7.x - Dawntrail/Shaaloani/1002_Yawtanane Grasslands_BTN.json [new file with mode: 0644]

index 9c7a8c24ac1e0eb52dd8dbfe880a4bfa41139be4..58a5fad2fbfff07bba89f91d0ad64be67fed7844 100644 (file)
@@ -1,5 +1,5 @@
 <Project>
-    <PropertyGroup>
+    <PropertyGroup Condition="$(MSBuildProjectName) != 'GatheringPathRenderer'">
         <Version>4.13</Version>
     </PropertyGroup>
 </Project>
diff --git a/GatheringPathRenderer/.gitignore b/GatheringPathRenderer/.gitignore
new file mode 100644 (file)
index 0000000..a60a458
--- /dev/null
@@ -0,0 +1 @@
+/dist
diff --git a/GatheringPathRenderer/DalamudPackager.targets b/GatheringPathRenderer/DalamudPackager.targets
new file mode 100644 (file)
index 0000000..7f129a8
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+    <Target Name="PackagePluginDebug" AfterTargets="Build" Condition="'$(Configuration)' == 'Debug'">
+        <DalamudPackager
+                ProjectDir="$(ProjectDir)"
+                OutputPath="$(OutputPath)"
+                AssemblyName="$(AssemblyName)"
+                MakeZip="false"
+                VersionComponents="2"/>
+    </Target>
+
+    <Target Name="PackagePlugin" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
+        <DalamudPackager
+                ProjectDir="$(ProjectDir)"
+                OutputPath="$(OutputPath)"
+                AssemblyName="$(AssemblyName)"
+                MakeZip="true"
+                VersionComponents="2"
+                Exclude="GatheringPathRenderer.deps.json;ECommons.xml;ECommons.pdb;LLib.pdb"/>
+    </Target>
+</Project>
index 6009a518396e4428cc8ba295c51b7d92d6739f81..73d05cbeb051946e409eed78ee1539a016d52195 100644 (file)
@@ -1,4 +1,11 @@
 <Project Sdk="Dalamud.NET.Sdk/11.0.0">
+    <PropertyGroup>
+        <Version>0.1</Version>
+        <OutputPath>dist</OutputPath>
+        <PathMap Condition="$(SolutionDir) != ''">$(SolutionDir)=X:\</PathMap>
+        <Platforms>x64</Platforms>
+    </PropertyGroup>
+
     <ItemGroup>
       <ProjectReference Include="..\LLib\LLib.csproj" />
       <ProjectReference Include="..\Questionable.Model\Questionable.Model.csproj" />
@@ -6,4 +13,5 @@
     </ItemGroup>
 
     <Import Project="..\LLib\LLib.targets"/>
+    <Import Project="..\LLib\RenameZip.targets"/>
 </Project>
index 8d68d1d89a95308a0e8f07133ee7bed5500770f8..56f9170991fd6d1f3b81419d822d983ab7cb7695 100644 (file)
@@ -1,6 +1,7 @@
 {
   "Name": "GatheringPathRenderer",
   "Author": "Liza Carvelli",
-  "Punchline": "dev only plugin: Renders gathering location.",
-  "Description": "dev only plugin: Renders gathering location (without ECommons polluting the entire normal project)."
+  "Punchline": "[Questionable dev plugin]: Renders gathering location.",
+  "Description": "[Questionable dev plugin]: Renders gathering location using Splatoon.",
+  "RepoUrl": "https://git.carvel.li/liza/Questionable/src/branch/master/GatheringPathRenderer"
 }
index 5ef430eaea0928e070ff80d19752524bfcbf378d..02e01bb7021bff54e21960ee0c75ec44505a86ff 100644 (file)
@@ -1,6 +1,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
 using System.IO;
 using System.Linq;
 using System.Text.Encodings.Web;
@@ -17,11 +18,11 @@ using ECommons.Schedulers;
 using ECommons.SplatoonAPI;
 using GatheringPathRenderer.Windows;
 using LLib.GameData;
-using Questionable.Model;
 using Questionable.Model.Gathering;
 
 namespace GatheringPathRenderer;
 
+[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
 public sealed class RendererPlugin : IDalamudPlugin
 {
     private const long OnTerritoryChange = -2;
@@ -56,8 +57,10 @@ public sealed class RendererPlugin : IDalamudPlugin
 
         _editorCommands = new EditorCommands(this, dataManager, commandManager, targetManager, clientState, chatGui,
             configuration);
-        _editorWindow = new EditorWindow(this, _editorCommands, dataManager, targetManager, clientState, objectTable)
+        var configWindow = new ConfigWindow(pluginInterface, configuration);
+        _editorWindow = new EditorWindow(this, _editorCommands, dataManager, targetManager, clientState, objectTable, configWindow)
             { IsOpen = true };
+        _windowSystem.AddWindow(configWindow);
         _windowSystem.AddWindow(_editorWindow);
         _currentClassJob = (EClassJob?)_clientState.LocalPlayer?.ClassJob.RowId ?? EClassJob.Adventurer;
 
@@ -78,6 +81,7 @@ public sealed class RendererPlugin : IDalamudPlugin
     {
         get
         {
+#if DEBUG
             DirectoryInfo? solutionDirectory = _pluginInterface.AssemblyLocation.Directory?.Parent?.Parent?.Parent;
             if (solutionDirectory != null)
             {
@@ -88,6 +92,12 @@ public sealed class RendererPlugin : IDalamudPlugin
             }
 
             throw new Exception("Unable to resolve project path");
+#else
+            var allPluginsDirectory = _pluginInterface.ConfigFile.Directory ?? throw new Exception("Unknown directory for plugin configs");
+            return allPluginsDirectory
+                .CreateSubdirectory("Questionable")
+                .CreateSubdirectory("GatheringPaths");
+#endif
         }
     }
 
@@ -103,12 +113,18 @@ public sealed class RendererPlugin : IDalamudPlugin
 
         try
         {
+#if DEBUG
             foreach (var expansionFolder in ExpansionData.ExpansionFolders.Values)
                 LoadFromDirectory(
                     new DirectoryInfo(Path.Combine(PathsDirectory.FullName, expansionFolder)));
-
             _pluginLog.Information(
                 $"Loaded {_gatheringLocations.Count} gathering root locations from project directory");
+#else
+            LoadFromDirectory(PathsDirectory);
+            _pluginLog.Information(
+                $"Loaded {_gatheringLocations.Count} gathering root locations from {PathsDirectory.FullName} directory");
+#endif
+
         }
         catch (Exception e)
         {
diff --git a/GatheringPathRenderer/Windows/ConfigWindow.cs b/GatheringPathRenderer/Windows/ConfigWindow.cs
new file mode 100644 (file)
index 0000000..0e9ba04
--- /dev/null
@@ -0,0 +1,33 @@
+using Dalamud.Interface.Windowing;
+using Dalamud.Plugin;
+using ImGuiNET;
+
+namespace GatheringPathRenderer.Windows;
+
+internal sealed class ConfigWindow : Window
+{
+    private readonly IDalamudPluginInterface _pluginInterface;
+    private readonly Configuration _configuration;
+
+    public ConfigWindow(IDalamudPluginInterface pluginInterface, Configuration configuration)
+        : base("Gathering Path Config", ImGuiWindowFlags.AlwaysAutoResize)
+    {
+        _pluginInterface = pluginInterface;
+        _configuration = configuration;
+
+        AllowPinning = false;
+        AllowClickthrough = false;
+    }
+
+    public override void Draw()
+    {
+        string authorName = _configuration.AuthorName;
+        if (ImGui.InputText("Author name for new files", ref authorName, 256))
+        {
+            _configuration.AuthorName = authorName;
+            Save();
+        }
+    }
+
+    private void Save() => _pluginInterface.SavePluginConfig(_configuration);
+}
index 1150558fa3a0e743713c87fc5d1950f7e341f7e7..c117f4a9bba32ced6335671e55a3dc534a65f688 100644 (file)
@@ -6,6 +6,7 @@ using System.Numerics;
 using Dalamud.Game.ClientState.Objects;
 using Dalamud.Game.ClientState.Objects.Enums;
 using Dalamud.Game.ClientState.Objects.Types;
+using Dalamud.Interface;
 using Dalamud.Interface.Colors;
 using Dalamud.Interface.Windowing;
 using Dalamud.Plugin.Services;
@@ -32,8 +33,8 @@ internal sealed class EditorWindow : Window
         _targetLocation;
 
     public EditorWindow(RendererPlugin plugin, EditorCommands editorCommands, IDataManager dataManager,
-        ITargetManager targetManager, IClientState clientState, IObjectTable objectTable)
-        : base("Gathering Path Editor###QuestionableGatheringPathEditor",
+        ITargetManager targetManager, IClientState clientState, IObjectTable objectTable, ConfigWindow configWindow)
+        : base($"Gathering Path Editor {typeof(EditorWindow).Assembly.GetName().Version!.ToString(2)}###QuestionableGatheringPathEditor",
             ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNavFocus | ImGuiWindowFlags.AlwaysAutoResize)
     {
         _plugin = plugin;
@@ -48,6 +49,20 @@ internal sealed class EditorWindow : Window
             MinimumSize = new Vector2(300, 100),
         };
 
+        TitleBarButtons.Add(new TitleBarButton
+        {
+            Icon = FontAwesomeIcon.Cog,
+            IconOffset = new Vector2(1.5f, 1),
+            Click = _ => configWindow.IsOpen = true,
+            Priority = int.MinValue,
+            ShowTooltip = () =>
+            {
+                ImGui.BeginTooltip();
+                ImGui.Text("Open Configuration");
+                ImGui.EndTooltip();
+            }
+        });
+
         RespectCloseHotkey = false;
         ShowCloseButton = false;
         AllowPinning = false;
diff --git a/GatheringPaths/7.x - Dawntrail/Shaaloani/1002_Yawtanane Grasslands_BTN.json b/GatheringPaths/7.x - Dawntrail/Shaaloani/1002_Yawtanane Grasslands_BTN.json
new file mode 100644 (file)
index 0000000..44d8489
--- /dev/null
@@ -0,0 +1,138 @@
+{
+  "$schema": "https://git.carvel.li/liza/Questionable/raw/branch/master/GatheringPaths/gatheringlocation-v1.json",
+  "Author": "liza",
+  "Steps": [
+    {
+      "TerritoryId": 1190,
+      "InteractionType": "None"
+    }
+  ],
+  "Groups": [
+    {
+      "Nodes": [
+        {
+          "DataId": 34920,
+          "Locations": [
+            {
+              "Position": {
+                "X": 192.6021,
+                "Y": 12.31054,
+                "Z": 631.2545
+              }
+            },
+            {
+              "Position": {
+                "X": 194.8373,
+                "Y": 12.50387,
+                "Z": 646.5401
+              }
+            },
+            {
+              "Position": {
+                "X": 180.8447,
+                "Y": 12.43262,
+                "Z": 610.7131
+              }
+            }
+          ]
+        },
+        {
+          "DataId": 34919,
+          "Locations": [
+            {
+              "Position": {
+                "X": 186.171,
+                "Y": 12.54104,
+                "Z": 634.9042
+              }
+            }
+          ]
+        }
+      ]
+    },
+    {
+      "Nodes": [
+        {
+          "DataId": 34917,
+          "Locations": [
+            {
+              "Position": {
+                "X": 39.45634,
+                "Y": -0.06042051,
+                "Z": 502.3853
+              }
+            }
+          ]
+        },
+        {
+          "DataId": 34918,
+          "Locations": [
+            {
+              "Position": {
+                "X": 46.03248,
+                "Y": -0.7049216,
+                "Z": 491.6059
+              }
+            },
+            {
+              "Position": {
+                "X": 36.15481,
+                "Y": -0.0501074,
+                "Z": 505.9388
+              }
+            },
+            {
+              "Position": {
+                "X": 24.72226,
+                "Y": 0.5922582,
+                "Z": 528.0809
+              }
+            }
+          ]
+        }
+      ]
+    },
+    {
+      "Nodes": [
+        {
+          "DataId": 34922,
+          "Locations": [
+            {
+              "Position": {
+                "X": 2.302937,
+                "Y": -4.586716,
+                "Z": 687.4797
+              }
+            },
+            {
+              "Position": {
+                "X": 30.02284,
+                "Y": -2.447479,
+                "Z": 704.4326
+              }
+            },
+            {
+              "Position": {
+                "X": 41.59287,
+                "Y": -0.8454803,
+                "Z": 692.0099
+              }
+            }
+          ]
+        },
+        {
+          "DataId": 34921,
+          "Locations": [
+            {
+              "Position": {
+                "X": 18.47237,
+                "Y": -2.987581,
+                "Z": 690.8011
+              }
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file