1
0
forked from liza/Questionable

GPR: Only show when on gatherer

This commit is contained in:
Liza 2024-08-12 16:21:34 +02:00
parent 4b06c24da5
commit 59684ce212
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,6 @@
<Project Sdk="Dalamud.NET.Sdk/10.0.0">
<ItemGroup>
<ProjectReference Include="..\LLib\LLib.csproj" />
<ProjectReference Include="..\Questionable.Model\Questionable.Model.csproj" />
<ProjectReference Include="..\vendor\ECommons\ECommons\ECommons.csproj" />
</ItemGroup>

View File

@ -14,6 +14,7 @@ using ECommons;
using ECommons.Schedulers;
using ECommons.SplatoonAPI;
using GatheringPathRenderer.Windows;
using LLib.GameData;
using Questionable.Model;
using Questionable.Model.Gathering;
@ -64,6 +65,7 @@ public sealed class RendererPlugin : IDalamudPlugin
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
_clientState.TerritoryChanged += TerritoryChanged;
_clientState.ClassJobChanged += ClassJobChanged;
if (_clientState.IsLoggedIn)
TerritoryChanged(_clientState.TerritoryType);
}
@ -174,9 +176,15 @@ public sealed class RendererPlugin : IDalamudPlugin
private void TerritoryChanged(ushort territoryId) => Redraw();
internal void Redraw()
private void ClassJobChanged(uint classJobId) => Redraw((EClassJob)classJobId);
internal void Redraw() => Redraw((EClassJob)_clientState.LocalPlayer!.ClassJob.Id);
private void Redraw(EClassJob classJob)
{
Splatoon.RemoveDynamicElements("GatheringPathRenderer");
if (!classJob.IsGatherer())
return;
var elements = GetLocationsInTerritory(_clientState.TerritoryType)
.SelectMany(location =>
@ -289,6 +297,7 @@ public sealed class RendererPlugin : IDalamudPlugin
public void Dispose()
{
_clientState.ClassJobChanged -= ClassJobChanged;
_clientState.TerritoryChanged -= TerritoryChanged;
_pluginInterface.UiBuilder.Draw -= _windowSystem.Draw;

View File

@ -92,6 +92,12 @@
"ecommons": {
"type": "Project"
},
"llib": {
"type": "Project",
"dependencies": {
"DalamudPackager": "[2.1.13, )"
}
},
"questionable.model": {
"type": "Project",
"dependencies": {