Change pomander logic

This commit is contained in:
Liza 2022-10-27 00:25:09 +02:00
parent 16a2305892
commit 6c7389c831
2 changed files with 17 additions and 26 deletions

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework> <TargetFramework>net6.0-windows</TargetFramework>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<Version>1.6.0.0</Version> <Version>1.7.0.0</Version>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

View File

@ -4,9 +4,7 @@ using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.Command; using Dalamud.Game.Command;
using Dalamud.Game.Text; using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Logging;
using Dalamud.Plugin; using Dalamud.Plugin;
using ECommons; using ECommons;
using ECommons.Schedulers; using ECommons.Schedulers;
@ -41,7 +39,6 @@ namespace Pal.Client
{ Marker.EType.SilverCoffer, new MarkerConfig { Radius = 1f } }, { Marker.EType.SilverCoffer, new MarkerConfig { Radius = 1f } },
}; };
private bool _configUpdated = false; private bool _configUpdated = false;
private bool _pomandersUpdated = false;
private LocalizedChatMessages _localizedChatMessages = new(); private LocalizedChatMessages _localizedChatMessages = new();
internal ConcurrentDictionary<ushort, ConcurrentBag<Marker>> FloorMarkers { get; } = new(); internal ConcurrentDictionary<ushort, ConcurrentBag<Marker>> FloorMarkers { get; } = new();
@ -190,8 +187,6 @@ namespace Pal.Client
} }
else else
return; return;
_pomandersUpdated = true;
} }
private void OnFrameworkUpdate(Framework framework) private void OnFrameworkUpdate(Framework framework)
@ -286,33 +281,29 @@ namespace Pal.Client
saveMarkers = true; saveMarkers = true;
} }
if (_pomandersUpdated) if (!recreateLayout && currentFloorMarkers.Count > 0 && (config.OnlyVisibleTrapsAfterPomander || config.OnlyVisibleHoardAfterPomander))
{ {
if (currentFloorMarkers.Count > 0 && (config.OnlyVisibleTrapsAfterPomander || config.OnlyVisibleHoardAfterPomander))
try
{ {
foreach (var marker in currentFloorMarkers)
try
{ {
foreach (var marker in currentFloorMarkers) uint desiredColor = DetermineColor(marker, visibleMarkers);
if (marker.SplatoonElement == null || !marker.SplatoonElement.IsValid())
{ {
uint desiredColor = DetermineColor(marker, visibleMarkers); recreateLayout = true;
if (marker.SplatoonElement == null || !marker.SplatoonElement.IsValid()) break;
{
recreateLayout = true;
break;
}
if (marker.SplatoonElement.color != desiredColor)
marker.SplatoonElement.color = desiredColor;
} }
}
catch (Exception e) if (marker.SplatoonElement.color != desiredColor)
{ marker.SplatoonElement.color = desiredColor;
DebugMessage = $"{DateTime.Now}\n{e}";
recreateLayout = true;
} }
} }
_pomandersUpdated = false; catch (Exception e)
{
DebugMessage = $"{DateTime.Now}\n{e}";
recreateLayout = true;
}
} }
if (saveMarkers) if (saveMarkers)