Skip to content

Commit

Permalink
This has been sitting here for 2 weeks...
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurochi51 committed Aug 21, 2024
1 parent b2ba81e commit 3a5db58
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 26 deletions.
28 changes: 11 additions & 17 deletions TickTracker/TickTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public sealed class TickTracker : IDalamudPlugin
private readonly IGameGui gameGui;
private readonly ICommandManager commandManager;
private readonly ICondition condition;
private readonly IJobGauges jobGauges;
private readonly IPluginLog log;
private readonly IGameConfig gameConfig;
private readonly IAddonLifecycle addonLifecycle;
Expand All @@ -94,6 +93,7 @@ public sealed class TickTracker : IDalamudPlugin
private readonly uint secondaryTickerImageID = NativeUi.Get("TickerImageSecondary");
private readonly ImageNode primaryTickerNode, secondaryTickerNode;
private readonly CancellationTokenSource cts;
private readonly BLMGauge blmGauge;

private double syncValue, regenValue, fastValue;
private bool finishedLoading, primaryNodeCreationFailed, secondaryNodeCreationFailed, penumbraAvailable;
Expand Down Expand Up @@ -123,7 +123,6 @@ public TickTracker(IDalamudPluginInterface _pluginInterface,
gameGui = _gameGui;
commandManager = _commandManager;
condition = _condition;
jobGauges = _jobGauges;
log = _pluginLog;
gameConfig = _gameConfig;
addonLifecycle = _addonLifecycle;
Expand All @@ -137,6 +136,7 @@ public TickTracker(IDalamudPluginInterface _pluginInterface,
receiveActorUpdateHook.Enable();

cts = new CancellationTokenSource();
blmGauge = _jobGauges.Get<BLMGauge>();

var tickerUld = pluginInterface.UiBuilder.LoadUld(ParamWidgetUldPath);
primaryTickerNode = new ImageNode(_dataManager, log, tickerUld)
Expand All @@ -158,17 +158,9 @@ public TickTracker(IDalamudPluginInterface _pluginInterface,
PenumbraCheck();
InitializeWindows();

var barWindowList = new List<BarWindowBase>();
foreach (var window in WindowSystem.Windows.OfType<BarWindowBase>())
{
barWindowList.Add(window);
}
barWindows = barWindowList is not [] ? barWindowList.ToFrozenSet() : FrozenSet<BarWindowBase>.Empty;

commandManager.AddHandler(CommandName, new CommandInfo(OnCommand)
{
HelpMessage = "Open or close Tick Tracker's config window.",
});
barWindows = WindowSystem.Windows.OfType<BarWindowBase>().Any()
? WindowSystem.Windows.OfType<BarWindowBase>().ToFrozenSet()
: FrozenSet<BarWindowBase>.Empty;

RegisterEvents();
_ = Task.Run(InitializeLuminaSheets, cts.Token);
Expand Down Expand Up @@ -235,6 +227,11 @@ private void InitializeWindows()

private void RegisterEvents()
{
commandManager.AddHandler(CommandName, new CommandInfo(OnCommand)
{
HelpMessage = "Open or close Tick Tracker's config window.",
});

pluginInterface.UiBuilder.Draw += WindowSystem.Draw;
pluginInterface.UiBuilder.OpenConfigUi += ConfigWindow.Toggle;
framework.Update += OnFrameworkUpdate;
Expand Down Expand Up @@ -326,8 +323,7 @@ private void ProcessTicks(double currentTime, IPlayerCharacter player)

// MP Section
MPBarWindow.RegenActive = statusList.Exists(e => manaRegenSet.Contains(e.StatusId));
var blmGauge = player.ClassJob.Id is 25 ? jobGauges.Get<BLMGauge>() : null;
MPBarWindow.TickHalted = blmGauge is not null && blmGauge.InAstralFire;
MPBarWindow.TickHalted = player.ClassJob.Id is 25 && blmGauge.InAstralFire;
var currentMP = player.CurrentMp;
var fullMP = currentMP == player.MaxMp;

Expand Down Expand Up @@ -618,8 +614,6 @@ private unsafe void DevWindowThings(IPlayerCharacter? player, double currentTime
{
return;
}
DevWindow.Print("Player Entity Id: " + player.EntityId.ToString());
DevWindow.Print("Player Class Job Id " + player.ClassJob.Id.ToString());
var cultureFormat = System.Globalization.CultureInfo.InvariantCulture;
foreach (var window in windowList)
{
Expand Down
6 changes: 3 additions & 3 deletions TickTracker/TickTracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Authors></Authors>
<Company></Company>
<Version>1.6.0.0</Version>
<Version>1.6.1.0</Version>
<Description>A plugin that keeps track of HP/MP/GP ticks.</Description>
<Copyright></Copyright>
<PackageProjectUrl>https://github.com/Kurochi51/TickTracker</PackageProjectUrl>
Expand Down Expand Up @@ -39,11 +39,11 @@

<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.13" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.160">
<PackageReference Include="Meziantou.Analyzer" Version="2.0.163">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Penumbra.Api" Version="5.2.0" />
<PackageReference Include="Penumbra.Api" Version="5.3.0" />
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
Expand Down
12 changes: 6 additions & 6 deletions TickTracker/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
},
"Meziantou.Analyzer": {
"type": "Direct",
"requested": "[2.0.160, )",
"resolved": "2.0.160",
"contentHash": "KTvB5q8Sx6aieSyBcX/jgzMRj8a66NN5JbdMXXKdQeuIvzVNtzCOJHFpU0nI//FvlBn5VYZAy1xCZCFu94pafQ=="
"requested": "[2.0.163, )",
"resolved": "2.0.163",
"contentHash": "vN0YmOkuvPLukMsefLHYCWYaLPzpc6SfoR74aPwuLeK8QdxgxkavywQ1q/II0shLEEaN1RhlMjmL1RxMPW853w=="
},
"Penumbra.Api": {
"type": "Direct",
"requested": "[5.2.0, )",
"resolved": "5.2.0",
"contentHash": "fi36rbPTR76MTtC++0dMXmycidpGnMU2OGt+Wf/ckaEs5qmWJbIW9RE8O+rCOEFhtmzWcXIjKAMYJSSyb9nU8g=="
"requested": "[5.3.0, )",
"resolved": "5.3.0",
"contentHash": "WThL0e5UnkIESgsvihzss91h6Ny/UUq3ghSR0/npC7rBgqnWjml7/KWcUkDMWTpw6NLUp8DAivJwOtcZR95wLA=="
}
}
}
Expand Down

0 comments on commit 3a5db58

Please sign in to comment.