1
0
forked from liza/Questionable

Code cleanup

This commit is contained in:
Liza 2024-07-14 16:17:08 +02:00
parent 3c1ebdb403
commit 72c2858cae
Signed by: liza
GPG Key ID: 7199F8D727D55F67
4 changed files with 9 additions and 10 deletions

View File

@ -5,6 +5,7 @@ using Dalamud.Plugin;
using Dalamud.Plugin.Ipc; using Dalamud.Plugin.Ipc;
using Dalamud.Plugin.Ipc.Exceptions; using Dalamud.Plugin.Ipc.Exceptions;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using JetBrains.Annotations;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Questionable.Model; using Questionable.Model;
@ -89,6 +90,7 @@ internal sealed class RotationSolverRebornModule : ICombatModule, IDisposable
public void Dispose() => Stop(); public void Dispose() => Stop();
[PublicAPI]
enum StateCommandType : byte enum StateCommandType : byte
{ {
Off, Off,

View File

@ -28,7 +28,7 @@ internal static class AethernetShard
{ {
public EAetheryteLocation AetheryteLocation { get; set; } public EAetheryteLocation AetheryteLocation { get; set; }
public ITask? With(EAetheryteLocation aetheryteLocation) public ITask With(EAetheryteLocation aetheryteLocation)
{ {
AetheryteLocation = aetheryteLocation; AetheryteLocation = aetheryteLocation;
return this; return this;

View File

@ -90,20 +90,20 @@ internal static class EquipItem
return ETaskResult.StillRunning; return ETaskResult.StillRunning;
} }
private unsafe bool Equip() private unsafe void Equip()
{ {
var inventoryManager = InventoryManager.Instance(); var inventoryManager = InventoryManager.Instance();
if (inventoryManager == null) if (inventoryManager == null)
return false; return;
var equippedContainer = inventoryManager->GetInventoryContainer(InventoryType.EquippedItems); var equippedContainer = inventoryManager->GetInventoryContainer(InventoryType.EquippedItems);
if (equippedContainer == null) if (equippedContainer == null)
return false; return;
if (_targetSlots.Any(slot => equippedContainer->GetInventorySlot(slot)->ItemId == _itemId)) if (_targetSlots.Any(slot => equippedContainer->GetInventorySlot(slot)->ItemId == _itemId))
{ {
logger.LogInformation("Already equipped {Item}, skipping step", _item.Name?.ToString()); logger.LogInformation("Already equipped {Item}, skipping step", _item.Name?.ToString());
return false; return;
} }
foreach (InventoryType sourceInventoryType in SourceInventoryTypes) foreach (InventoryType sourceInventoryType in SourceInventoryTypes)
@ -134,11 +134,9 @@ internal static class EquipItem
int result = inventoryManager->MoveItemSlot(sourceInventoryType, sourceSlot, int result = inventoryManager->MoveItemSlot(sourceInventoryType, sourceSlot,
InventoryType.EquippedItems, targetSlot, 1); InventoryType.EquippedItems, targetSlot, 1);
logger.LogInformation("MoveItemSlot result: {Result}", result); logger.LogInformation("MoveItemSlot result: {Result}", result);
return result == 0; return;
} }
} }
return false;
} }
private static List<ushort>? GetEquipSlot(Item item) private static List<ushort>? GetEquipSlot(Item item)

View File

@ -2,7 +2,6 @@
using System.Linq; using System.Linq;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Lumina.Excel.GeneratedSheets2; using Lumina.Excel.GeneratedSheets2;
using Microsoft.Extensions.Logging;
namespace Questionable.Data; namespace Questionable.Data;
@ -10,7 +9,7 @@ internal sealed class AetherCurrentData
{ {
private readonly ImmutableDictionary<ushort, ImmutableList<uint>> _overworldCurrents; private readonly ImmutableDictionary<ushort, ImmutableList<uint>> _overworldCurrents;
public AetherCurrentData(IDataManager dataManager, ILogger<AetherCurrentData> logger) public AetherCurrentData(IDataManager dataManager)
{ {
_overworldCurrents = dataManager.GetExcelSheet<AetherCurrentCompFlgSet>()! _overworldCurrents = dataManager.GetExcelSheet<AetherCurrentCompFlgSet>()!
.Where(x => x.RowId > 0) .Where(x => x.RowId > 0)