pull/3/head v2.0
Liza 2023-10-04 10:49:39 +02:00
parent 51d1d6f9a3
commit 67b6981f7b
Signed by: liza
GPG Key ID: 7199F8D727D55F67
10 changed files with 66 additions and 75 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework> <TargetFramework>net7.0-windows</TargetFramework>
<Version>1.0</Version> <Version>2.0</Version>
<LangVersion>11.0</LangVersion> <LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
@ -22,7 +22,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.11"/> <PackageReference Include="DalamudPackager" Version="2.1.12"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -34,10 +34,6 @@
<HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath> <HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath>
<Private>false</Private> <Private>false</Private>
</Reference> </Reference>
<Reference Include="ImGuiScene">
<HintPath>$(DalamudLibPath)ImGuiScene.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina"> <Reference Include="Lumina">
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath> <HintPath>$(DalamudLibPath)Lumina.dll</HintPath>
<Private>false</Private> <Private>false</Private>

View File

@ -1,6 +1,5 @@
using System; using System;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Logging;
using Deliveroo.GameData; using Deliveroo.GameData;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType; using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
@ -51,7 +50,7 @@ partial class DeliverooPlugin
if (TryGetAddonByName<AtkUnitBase>("GrandCompanyExchange", out var addonExchange) && if (TryGetAddonByName<AtkUnitBase>("GrandCompanyExchange", out var addonExchange) &&
IsAddonReady(addonExchange)) IsAddonReady(addonExchange))
{ {
PluginLog.Information($"Selecting tier 1, {(int)item.Tier - 1}"); _pluginLog.Information($"Selecting tier 1, {(int)item.Tier - 1}");
var selectRank = stackalloc AtkValue[] var selectRank = stackalloc AtkValue[]
{ {
new() { Type = ValueType.Int, Int = 1 }, new() { Type = ValueType.Int, Int = 1 },
@ -82,7 +81,7 @@ partial class DeliverooPlugin
if (TryGetAddonByName<AtkUnitBase>("GrandCompanyExchange", out var addonExchange) && if (TryGetAddonByName<AtkUnitBase>("GrandCompanyExchange", out var addonExchange) &&
IsAddonReady(addonExchange)) IsAddonReady(addonExchange))
{ {
PluginLog.Information($"Selecting subcategory 2, {(int)item.SubCategory}"); _pluginLog.Information($"Selecting subcategory 2, {(int)item.SubCategory}");
var selectType = stackalloc AtkValue[] var selectType = stackalloc AtkValue[]
{ {
new() { Type = ValueType.Int, Int = 2 }, new() { Type = ValueType.Int, Int = 2 },
@ -131,7 +130,7 @@ partial class DeliverooPlugin
uint itemId = addonExchange->AtkValues[317 + i].UInt; uint itemId = addonExchange->AtkValues[317 + i].UInt;
if (itemId == item.ItemId) if (itemId == item.ItemId)
{ {
PluginLog.Information($"Selecting item {itemId}, {i}"); _pluginLog.Information($"Selecting item {itemId}, {i}");
long toBuy = (GetCurrentSealCount() - _configuration.ReservedSealCount) / item.SealCost; long toBuy = (GetCurrentSealCount() - _configuration.ReservedSealCount) / item.SealCost;
toBuy = Math.Min(toBuy, item.EffectiveLimit - GetItemCount(item.ItemId)); toBuy = Math.Min(toBuy, item.EffectiveLimit - GetItemCount(item.ItemId));
@ -140,7 +139,7 @@ partial class DeliverooPlugin
if (toBuy <= 0) if (toBuy <= 0)
{ {
PluginLog.Information($"Items to buy = {toBuy}"); _pluginLog.Information($"Items to buy = {toBuy}");
return false; return false;
} }
@ -162,7 +161,7 @@ partial class DeliverooPlugin
} }
} }
PluginLog.Warning("Could not find selected reward item"); _pluginLog.Warning("Could not find selected reward item");
return false; return false;
} }

View File

@ -4,7 +4,6 @@ using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Logging;
using Dalamud.Memory; using Dalamud.Memory;
using Deliveroo.GameData; using Deliveroo.GameData;
using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game;
@ -21,7 +20,7 @@ partial class DeliverooPlugin
{ {
private unsafe void InteractWithTarget(GameObject obj) private unsafe void InteractWithTarget(GameObject obj)
{ {
PluginLog.Information($"Setting target to {obj}"); _pluginLog.Information($"Setting target to {obj}");
if (_targetManager.Target == null || _targetManager.Target != obj) if (_targetManager.Target == null || _targetManager.Target != obj)
{ {
_targetManager.Target = obj; _targetManager.Target = obj;
@ -165,12 +164,9 @@ partial class DeliverooPlugin
var unitManagers = &AtkStage.GetSingleton()->RaptureAtkUnitManager->AtkUnitManager.DepthLayerOneList; var unitManagers = &AtkStage.GetSingleton()->RaptureAtkUnitManager->AtkUnitManager.DepthLayerOneList;
for (var i = 0; i < 18; i++) for (var i = 0; i < 18; i++)
{ {
var unitManager = &unitManagers[i]; foreach (AtkUnitBase* unitBase in unitManagers[i].EntriesSpan)
var unitBaseArray = &(unitManager->AtkUnitEntries);
for (var j = 0; j < unitManager->Count; j++)
{ {
var unitBase = unitBaseArray[j]; if (unitBase != null && unitBase->ID == id)
if (unitBase->ID == id)
{ {
return unitBase; return unitBase;
} }
@ -219,7 +215,7 @@ partial class DeliverooPlugin
IsAddonReady(&addonSelectYesno->AtkUnitBase) && IsAddonReady(&addonSelectYesno->AtkUnitBase) &&
predicate(MemoryHelper.ReadSeString(&addonSelectYesno->PromptText->NodeText).ToString())) predicate(MemoryHelper.ReadSeString(&addonSelectYesno->PromptText->NodeText).ToString()))
{ {
PluginLog.Information( _pluginLog.Information(
$"Selecting choice={choice} for '{MemoryHelper.ReadSeString(&addonSelectYesno->PromptText->NodeText)}'"); $"Selecting choice={choice} for '{MemoryHelper.ReadSeString(&addonSelectYesno->PromptText->NodeText)}'");
addonSelectYesno->AtkUnitBase.FireCallbackInt(choice); addonSelectYesno->AtkUnitBase.FireCallbackInt(choice);

View File

@ -1,9 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Logging;
using Dalamud.Memory;
using Deliveroo.GameData; using Deliveroo.GameData;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Client.UI.Agent;
@ -46,12 +43,12 @@ partial class DeliverooPlugin
var addonGc = (AddonGrandCompanySupplyList*)addon; var addonGc = (AddonGrandCompanySupplyList*)addon;
if (addonGc->SelectedTab == 2) if (addonGc->SelectedTab == 2)
{ {
PluginLog.Information("Tab already selected, probably due to haseltweaks"); _pluginLog.Information("Tab already selected, probably due to haseltweaks");
CurrentStage = Stage.SelectItemToTurnIn; CurrentStage = Stage.SelectItemToTurnIn;
return; return;
} }
PluginLog.Information("Switching to expert deliveries"); _pluginLog.Information("Switching to expert deliveries");
var selectExpertDeliveryTab = stackalloc AtkValue[] var selectExpertDeliveryTab = stackalloc AtkValue[]
{ {
new() { Type = ValueType.Int, Int = 0 }, new() { Type = ValueType.Int, Int = 0 },

View File

@ -1,24 +1,19 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Dalamud.Data;
using Dalamud.Game;
using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.Command; using Dalamud.Game.Command;
using Dalamud.Game.Gui;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Logging;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Deliveroo.External; using Deliveroo.External;
using Deliveroo.GameData; using Deliveroo.GameData;
using Deliveroo.Windows; using Deliveroo.Windows;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.GeneratedSheets;
using Condition = Dalamud.Game.ClientState.Conditions.Condition;
namespace Deliveroo; namespace Deliveroo;
@ -27,14 +22,15 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
private readonly WindowSystem _windowSystem = new(typeof(DeliverooPlugin).AssemblyQualifiedName); private readonly WindowSystem _windowSystem = new(typeof(DeliverooPlugin).AssemblyQualifiedName);
private readonly DalamudPluginInterface _pluginInterface; private readonly DalamudPluginInterface _pluginInterface;
private readonly ChatGui _chatGui; private readonly IChatGui _chatGui;
private readonly GameGui _gameGui; private readonly IGameGui _gameGui;
private readonly Framework _framework; private readonly IFramework _framework;
private readonly ClientState _clientState; private readonly IClientState _clientState;
private readonly ObjectTable _objectTable; private readonly IObjectTable _objectTable;
private readonly TargetManager _targetManager; private readonly ITargetManager _targetManager;
private readonly Condition _condition; private readonly ICondition _condition;
private readonly CommandManager _commandManager; private readonly ICommandManager _commandManager;
private readonly IPluginLog _pluginLog;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable // ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly Configuration _configuration; private readonly Configuration _configuration;
@ -53,9 +49,9 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
private List<PurchaseItemRequest> _itemsToPurchaseNow = new(); private List<PurchaseItemRequest> _itemsToPurchaseNow = new();
private (bool Saved, bool? PreviousState) _yesAlreadyState = (false, null); private (bool Saved, bool? PreviousState) _yesAlreadyState = (false, null);
public DeliverooPlugin(DalamudPluginInterface pluginInterface, ChatGui chatGui, GameGui gameGui, public DeliverooPlugin(DalamudPluginInterface pluginInterface, IChatGui chatGui, IGameGui gameGui,
Framework framework, ClientState clientState, ObjectTable objectTable, TargetManager targetManager, IFramework framework, IClientState clientState, IObjectTable objectTable, ITargetManager targetManager,
DataManager dataManager, Condition condition, CommandManager commandManager) IDataManager dataManager, ICondition condition, ICommandManager commandManager, IPluginLog pluginLog)
{ {
_pluginInterface = pluginInterface; _pluginInterface = pluginInterface;
_chatGui = chatGui; _chatGui = chatGui;
@ -66,12 +62,13 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
_targetManager = targetManager; _targetManager = targetManager;
_condition = condition; _condition = condition;
_commandManager = commandManager; _commandManager = commandManager;
_pluginLog = pluginLog;
var dalamudReflector = new DalamudReflector(_pluginInterface, _framework); var dalamudReflector = new DalamudReflector(_pluginInterface, _framework, _pluginLog);
_yesAlreadyIpc = new YesAlreadyIpc(dalamudReflector); _yesAlreadyIpc = new YesAlreadyIpc(dalamudReflector);
_configuration = (Configuration?)_pluginInterface.GetPluginConfig() ?? new Configuration(); _configuration = (Configuration?)_pluginInterface.GetPluginConfig() ?? new Configuration();
_gcRewardsCache = new GcRewardsCache(dataManager); _gcRewardsCache = new GcRewardsCache(dataManager);
_configWindow = new ConfigWindow(_pluginInterface, this, _configuration, _gcRewardsCache, _clientState); _configWindow = new ConfigWindow(_pluginInterface, this, _configuration, _gcRewardsCache, _clientState, _pluginLog);
_windowSystem.AddWindow(_configWindow); _windowSystem.AddWindow(_configWindow);
_turnInWindow = new TurnInWindow(this, _pluginInterface, _configuration, _gcRewardsCache, _configWindow); _turnInWindow = new TurnInWindow(this, _pluginInterface, _configuration, _gcRewardsCache, _configWindow);
_windowSystem.AddWindow(_turnInWindow); _windowSystem.AddWindow(_turnInWindow);
@ -89,7 +86,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
}); });
if (_clientState.IsLoggedIn) if (_clientState.IsLoggedIn)
Login(this, EventArgs.Empty); Login();
if (_configuration.AddVentureIfNoItemToPurchaseSelected()) if (_configuration.AddVentureIfNoItemToPurchaseSelected())
_pluginInterface.SavePluginConfig(_configuration); _pluginInterface.SavePluginConfig(_configuration);
@ -107,13 +104,13 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
{ {
if (_currentStageInternal != value) if (_currentStageInternal != value)
{ {
PluginLog.Information($"Changing stage from {_currentStageInternal} to {value}"); _pluginLog.Information($"Changing stage from {_currentStageInternal} to {value}");
_currentStageInternal = value; _currentStageInternal = value;
} }
} }
} }
private void Login(object? sender, EventArgs e) private void Login()
{ {
try try
{ {
@ -131,27 +128,27 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
CharacterConfiguration.Save(_pluginInterface); CharacterConfiguration.Save(_pluginInterface);
} }
PluginLog.Information($"Loaded character-specific information for {_clientState.LocalContentId}"); _pluginLog.Information($"Loaded character-specific information for {_clientState.LocalContentId}");
} }
else else
{ {
PluginLog.Verbose( _pluginLog.Verbose(
$"No character-specific information for {_clientState.LocalContentId}"); $"No character-specific information for {_clientState.LocalContentId}");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
PluginLog.Error(ex, "Unable to load character configuration"); _pluginLog.Error(ex, "Unable to load character configuration");
CharacterConfiguration = null; CharacterConfiguration = null;
} }
} }
private void Logout(object? sender, EventArgs e) private void Logout()
{ {
CharacterConfiguration = null; CharacterConfiguration = null;
} }
private unsafe void FrameworkUpdate(Framework f) private unsafe void FrameworkUpdate(IFramework f)
{ {
_turnInWindow.Error = string.Empty; _turnInWindow.Error = string.Empty;
if (!_clientState.IsLoggedIn || if (!_clientState.IsLoggedIn ||
@ -191,12 +188,12 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
_itemsToPurchaseNow = _turnInWindow.SelectedItems; _itemsToPurchaseNow = _turnInWindow.SelectedItems;
if (_itemsToPurchaseNow.Count > 0) if (_itemsToPurchaseNow.Count > 0)
{ {
PluginLog.Information("Items to purchase:"); _pluginLog.Information("Items to purchase:");
foreach (var item in _itemsToPurchaseNow) foreach (var item in _itemsToPurchaseNow)
PluginLog.Information($" {item.Name} (limit = {item.EffectiveLimit})"); _pluginLog.Information($" {item.Name} (limit = {item.EffectiveLimit})");
} }
else else
PluginLog.Information("No items to purchase configured or available"); _pluginLog.Information("No items to purchase configured or available");
var nextItem = GetNextItemToPurchase(); var nextItem = GetNextItemToPurchase();
@ -282,7 +279,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
break; break;
default: default:
PluginLog.Warning($"Unknown stage {CurrentStage}"); _pluginLog.Warning($"Unknown stage {CurrentStage}");
break; break;
} }
} }
@ -307,19 +304,19 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
{ {
if (_yesAlreadyState.Saved) if (_yesAlreadyState.Saved)
{ {
PluginLog.Information("Not overwriting yesalready state"); _pluginLog.Information("Not overwriting yesalready state");
return; return;
} }
_yesAlreadyState = (true, _yesAlreadyIpc.DisableIfNecessary()); _yesAlreadyState = (true, _yesAlreadyIpc.DisableIfNecessary());
PluginLog.Information($"Previous yesalready state: {_yesAlreadyState.PreviousState}"); _pluginLog.Information($"Previous yesalready state: {_yesAlreadyState.PreviousState}");
} }
private void RestoreYesAlready() private void RestoreYesAlready()
{ {
if (_yesAlreadyState.Saved) if (_yesAlreadyState.Saved)
{ {
PluginLog.Information($"Restoring previous yesalready state: {_yesAlreadyState.PreviousState}"); _pluginLog.Information($"Restoring previous yesalready state: {_yesAlreadyState.PreviousState}");
if (_yesAlreadyState.PreviousState == true) if (_yesAlreadyState.PreviousState == true)
_yesAlreadyIpc.Enable(); _yesAlreadyIpc.Enable();
} }

View File

@ -6,6 +6,7 @@ using Dalamud.Plugin;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using Dalamud.Plugin.Services;
namespace Deliveroo.External; namespace Deliveroo.External;
@ -17,14 +18,16 @@ namespace Deliveroo.External;
internal sealed class DalamudReflector : IDisposable internal sealed class DalamudReflector : IDisposable
{ {
private readonly DalamudPluginInterface _pluginInterface; private readonly DalamudPluginInterface _pluginInterface;
private readonly Framework _framework; private readonly IFramework _framework;
private readonly IPluginLog _pluginLog;
private readonly Dictionary<string, IDalamudPlugin> _pluginCache = new(); private readonly Dictionary<string, IDalamudPlugin> _pluginCache = new();
private bool _pluginsChanged = false; private bool _pluginsChanged = false;
public DalamudReflector(DalamudPluginInterface pluginInterface, Framework framework) public DalamudReflector(DalamudPluginInterface pluginInterface, IFramework framework, IPluginLog pluginLog)
{ {
_pluginInterface = pluginInterface; _pluginInterface = pluginInterface;
_framework = framework; _framework = framework;
_pluginLog = pluginLog;
var pm = GetPluginManager(); var pm = GetPluginManager();
pm.GetType().GetEvent("OnInstalledPluginsChanged")!.AddEventHandler(pm, OnInstalledPluginsChanged); pm.GetType().GetEvent("OnInstalledPluginsChanged")!.AddEventHandler(pm, OnInstalledPluginsChanged);
@ -39,7 +42,7 @@ internal sealed class DalamudReflector : IDisposable
pm.GetType().GetEvent("OnInstalledPluginsChanged")!.RemoveEventHandler(pm, OnInstalledPluginsChanged); pm.GetType().GetEvent("OnInstalledPluginsChanged")!.RemoveEventHandler(pm, OnInstalledPluginsChanged);
} }
private void FrameworkUpdate(Framework framework) private void FrameworkUpdate(IFramework framework)
{ {
if (_pluginsChanged) if (_pluginsChanged)
{ {
@ -80,7 +83,7 @@ internal sealed class DalamudReflector : IDisposable
.GetField("instance", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(t); .GetField("instance", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(t);
if (plugin == null) if (plugin == null)
{ {
PluginLog.Warning($"[DalamudReflector] Found requested plugin {internalName} but it was null"); _pluginLog.Warning($"[DalamudReflector] Found requested plugin {internalName} but it was null");
} }
else else
{ {
@ -98,7 +101,7 @@ internal sealed class DalamudReflector : IDisposable
{ {
if (!suppressErrors) if (!suppressErrors)
{ {
PluginLog.Error(e, $"Can't find {internalName} plugin: {e.Message}"); _pluginLog.Error(e, $"Can't find {internalName} plugin: {e.Message}");
} }
instance = null; instance = null;
@ -108,7 +111,7 @@ internal sealed class DalamudReflector : IDisposable
private void OnInstalledPluginsChanged() private void OnInstalledPluginsChanged()
{ {
PluginLog.Verbose("Installed plugins changed event fired"); _pluginLog.Verbose("Installed plugins changed event fired");
_pluginsChanged = true; _pluginsChanged = true;
} }
} }

View File

@ -1,6 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Dalamud.Data; using Dalamud.Plugin.Services;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.GeneratedSheets;
using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany; using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany;
@ -8,7 +8,7 @@ namespace Deliveroo.GameData;
internal sealed class GcRewardsCache internal sealed class GcRewardsCache
{ {
public GcRewardsCache(DataManager dataManager) public GcRewardsCache(IDataManager dataManager)
{ {
var categories = dataManager.GetExcelSheet<GCScripShopCategory>()! var categories = dataManager.GetExcelSheet<GCScripShopCategory>()!
.Where(x => x.RowId > 0) .Where(x => x.RowId > 0)

View File

@ -2,12 +2,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using Dalamud.Game.ClientState;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Logging;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Deliveroo.GameData; using Deliveroo.GameData;
using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using ImGuiNET; using ImGuiNET;
@ -20,13 +20,14 @@ internal sealed class ConfigWindow : Window
private readonly DeliverooPlugin _plugin; private readonly DeliverooPlugin _plugin;
private readonly Configuration _configuration; private readonly Configuration _configuration;
private readonly GcRewardsCache _gcRewardsCache; private readonly GcRewardsCache _gcRewardsCache;
private readonly ClientState _clientState; private readonly IClientState _clientState;
private readonly IPluginLog _pluginLog;
private readonly Dictionary<uint, GcRewardItem> _itemLookup; private readonly Dictionary<uint, GcRewardItem> _itemLookup;
private uint _dragDropSource = 0; private uint _dragDropSource = 0;
public ConfigWindow(DalamudPluginInterface pluginInterface, DeliverooPlugin plugin, Configuration configuration, public ConfigWindow(DalamudPluginInterface pluginInterface, DeliverooPlugin plugin, Configuration configuration,
GcRewardsCache gcRewardsCache, ClientState clientState) GcRewardsCache gcRewardsCache, IClientState clientState, IPluginLog pluginLog)
: base("Deliveroo - Configuration###DeliverooConfig") : base("Deliveroo - Configuration###DeliverooConfig")
{ {
_pluginInterface = pluginInterface; _pluginInterface = pluginInterface;
@ -34,6 +35,7 @@ internal sealed class ConfigWindow : Window
_configuration = configuration; _configuration = configuration;
_gcRewardsCache = gcRewardsCache; _gcRewardsCache = gcRewardsCache;
_clientState = clientState; _clientState = clientState;
_pluginLog = pluginLog;
_itemLookup = _gcRewardsCache.Rewards.Values _itemLookup = _gcRewardsCache.Rewards.Values
.SelectMany(x => x) .SelectMany(x => x)
@ -251,7 +253,7 @@ internal sealed class ConfigWindow : Window
CachedWorldName = currentWorldName, CachedWorldName = currentWorldName,
}; };
_plugin.CharacterConfiguration.Save(_pluginInterface); _plugin.CharacterConfiguration.Save(_pluginInterface);
PluginLog.Information( _pluginLog.Information(
$"Created character-specific configuration for {_clientState.LocalContentId}"); $"Created character-specific configuration for {_clientState.LocalContentId}");
} }
} }

View File

@ -5,6 +5,7 @@ using System.Numerics;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Plugin; using Dalamud.Plugin;
using Deliveroo.GameData; using Deliveroo.GameData;

View File

@ -4,9 +4,9 @@
"net7.0-windows7.0": { "net7.0-windows7.0": {
"DalamudPackager": { "DalamudPackager": {
"type": "Direct", "type": "Direct",
"requested": "[2.1.11, )", "requested": "[2.1.12, )",
"resolved": "2.1.11", "resolved": "2.1.12",
"contentHash": "9qlAWoRRTiL/geAvuwR/g6Bcbrd/bJJgVnB/RurBiyKs6srsP0bvpoo8IK+Eg8EA6jWeM6/YJWs66w4FIAzqPw==" "contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
} }
} }
} }