Clean up
This commit is contained in:
parent
161bf7e39c
commit
05b5654f84
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ARControl.GameData;
|
using ARControl.GameData;
|
||||||
using ARControl.Windows;
|
using ARControl.Windows;
|
||||||
@ -17,12 +18,12 @@ using ImGuiNET;
|
|||||||
|
|
||||||
namespace ARControl;
|
namespace ARControl;
|
||||||
|
|
||||||
|
[SuppressMessage("ReSharper", "UnusedType.Global")]
|
||||||
public sealed class AutoRetainerControlPlugin : IDalamudPlugin
|
public sealed class AutoRetainerControlPlugin : IDalamudPlugin
|
||||||
{
|
{
|
||||||
private readonly WindowSystem _windowSystem = new(nameof(AutoRetainerControlPlugin));
|
private readonly WindowSystem _windowSystem = new(nameof(AutoRetainerControlPlugin));
|
||||||
|
|
||||||
private readonly DalamudPluginInterface _pluginInterface;
|
private readonly DalamudPluginInterface _pluginInterface;
|
||||||
private readonly DataManager _dataManager;
|
|
||||||
private readonly ClientState _clientState;
|
private readonly ClientState _clientState;
|
||||||
private readonly ChatGui _chatGui;
|
private readonly ChatGui _chatGui;
|
||||||
private readonly CommandManager _commandManager;
|
private readonly CommandManager _commandManager;
|
||||||
@ -36,14 +37,13 @@ public sealed class AutoRetainerControlPlugin : IDalamudPlugin
|
|||||||
ClientState clientState, ChatGui chatGui, CommandManager commandManager)
|
ClientState clientState, ChatGui chatGui, CommandManager commandManager)
|
||||||
{
|
{
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
_dataManager = dataManager;
|
|
||||||
_clientState = clientState;
|
_clientState = clientState;
|
||||||
_chatGui = chatGui;
|
_chatGui = chatGui;
|
||||||
_commandManager = commandManager;
|
_commandManager = commandManager;
|
||||||
|
|
||||||
_configuration = (Configuration?)_pluginInterface.GetPluginConfig() ?? new Configuration();
|
_configuration = (Configuration?)_pluginInterface.GetPluginConfig() ?? new Configuration();
|
||||||
|
|
||||||
_gameCache = new GameCache(_dataManager);
|
_gameCache = new GameCache(dataManager);
|
||||||
_configWindow = new ConfigWindow(_pluginInterface, _configuration, _gameCache, _clientState, _commandManager);
|
_configWindow = new ConfigWindow(_pluginInterface, _configuration, _gameCache, _clientState, _commandManager);
|
||||||
_windowSystem.AddWindow(_configWindow);
|
_windowSystem.AddWindow(_configWindow);
|
||||||
|
|
||||||
@ -143,6 +143,7 @@ public sealed class AutoRetainerControlPlugin : IDalamudPlugin
|
|||||||
$"Setting AR to use venture {venture.RowId}, which should retrieve {reward.Quantity}x {venture.Name}");
|
$"Setting AR to use venture {venture.RowId}, which should retrieve {reward.Quantity}x {venture.Name}");
|
||||||
_autoRetainerApi.SetVenture(venture.RowId);
|
_autoRetainerApi.SetVenture(venture.RowId);
|
||||||
|
|
||||||
|
retainer.LastVenture = venture.RowId;
|
||||||
queuedItem.RemainingQuantity =
|
queuedItem.RemainingQuantity =
|
||||||
Math.Max(0, queuedItem.RemainingQuantity - reward.Quantity);
|
Math.Max(0, queuedItem.RemainingQuantity - reward.Quantity);
|
||||||
_pluginInterface.SavePluginConfig(_configuration);
|
_pluginInterface.SavePluginConfig(_configuration);
|
||||||
@ -158,6 +159,9 @@ public sealed class AutoRetainerControlPlugin : IDalamudPlugin
|
|||||||
_chatGui.Print("ARC → No tasks left, using QC");
|
_chatGui.Print("ARC → No tasks left, using QC");
|
||||||
PluginLog.Information($"No tasks left (previous venture = {retainer.LastVenture}), using QC");
|
PluginLog.Information($"No tasks left (previous venture = {retainer.LastVenture}), using QC");
|
||||||
_autoRetainerApi.SetVenture(395);
|
_autoRetainerApi.SetVenture(395);
|
||||||
|
|
||||||
|
retainer.LastVenture = 395;
|
||||||
|
_pluginInterface.SavePluginConfig(_configuration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PluginLog.Information("Not changing venture plan, already 395");
|
PluginLog.Information("Not changing venture plan, already 395");
|
||||||
@ -181,7 +185,7 @@ public sealed class AutoRetainerControlPlugin : IDalamudPlugin
|
|||||||
|
|
||||||
private void TerritoryChanged(object? sender, ushort e) => Sync();
|
private void TerritoryChanged(object? sender, ushort e) => Sync();
|
||||||
|
|
||||||
public void Sync()
|
private void Sync()
|
||||||
{
|
{
|
||||||
bool save = false;
|
bool save = false;
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ internal sealed class ConfigWindow : Window
|
|||||||
|
|
||||||
ImGui.PushItemWidth(ImGui.GetFontSize() * 30);
|
ImGui.PushItemWidth(ImGui.GetFontSize() * 30);
|
||||||
Vector4 buttonColor = new Vector4();
|
Vector4 buttonColor = new Vector4();
|
||||||
if (character.Managed && character.Retainers.Count > 0)
|
if (character is { Managed: true, Retainers.Count: > 0 })
|
||||||
{
|
{
|
||||||
if (character.Retainers.All(x => x.Managed))
|
if (character.Retainers.All(x => x.Managed))
|
||||||
buttonColor = ImGuiColors.HealerGreen;
|
buttonColor = ImGuiColors.HealerGreen;
|
||||||
@ -283,7 +283,7 @@ internal sealed class ConfigWindow : Window
|
|||||||
{
|
{
|
||||||
bool currentCharacter = _clientState.LocalContentId == ch.Character.LocalContentId;
|
bool currentCharacter = _clientState.LocalContentId == ch.Character.LocalContentId;
|
||||||
ImGui.BeginDisabled(currentCharacter);
|
ImGui.BeginDisabled(currentCharacter);
|
||||||
if (ImGuiComponents.IconButton($"SwitchChacters{ch.Character.LocalContentId}",
|
if (ImGuiComponents.IconButton($"SwitchCharacters{ch.Character.LocalContentId}",
|
||||||
FontAwesomeIcon.DoorOpen))
|
FontAwesomeIcon.DoorOpen))
|
||||||
{
|
{
|
||||||
_commandManager.ProcessCommand($"/ays relog {ch.Character.CharacterName}@{ch.Character.WorldName}");
|
_commandManager.ProcessCommand($"/ays relog {ch.Character.CharacterName}@{ch.Character.WorldName}");
|
||||||
|
Loading…
Reference in New Issue
Block a user