GPR: Only show when on gatherer

master
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"> <Project Sdk="Dalamud.NET.Sdk/10.0.0">
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LLib\LLib.csproj" />
<ProjectReference Include="..\Questionable.Model\Questionable.Model.csproj" /> <ProjectReference Include="..\Questionable.Model\Questionable.Model.csproj" />
<ProjectReference Include="..\vendor\ECommons\ECommons\ECommons.csproj" /> <ProjectReference Include="..\vendor\ECommons\ECommons\ECommons.csproj" />
</ItemGroup> </ItemGroup>

View File

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

View File

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