1
0
forked from liza/Deliveroo
This commit is contained in:
Liza 2024-07-02 21:28:51 +02:00
parent 2be09089f5
commit 70b69b786e
Signed by: liza
GPG Key ID: 7199F8D727D55F67
14 changed files with 140 additions and 115 deletions

View File

@ -17,10 +17,10 @@ internal sealed class CharacterConfiguration
public bool OverrideItemsToPurchase { get; set; } public bool OverrideItemsToPurchase { get; set; }
public List<Configuration.PurchasePriority> ItemsToPurchase { get; set; } = new(); public List<Configuration.PurchasePriority> ItemsToPurchase { get; set; } = new();
public static string ResolveFilePath(DalamudPluginInterface pluginInterface, ulong localContentId) public static string ResolveFilePath(IDalamudPluginInterface pluginInterface, ulong localContentId)
=> Path.Join(pluginInterface.GetPluginConfigDirectory(), $"char.{localContentId:X}.json"); => Path.Join(pluginInterface.GetPluginConfigDirectory(), $"char.{localContentId:X}.json");
public static CharacterConfiguration? Load(DalamudPluginInterface pluginInterface, ulong localContentId) public static CharacterConfiguration? Load(IDalamudPluginInterface pluginInterface, ulong localContentId)
{ {
string path = ResolveFilePath(pluginInterface, localContentId); string path = ResolveFilePath(pluginInterface, localContentId);
if (!File.Exists(path)) if (!File.Exists(path))
@ -29,11 +29,11 @@ internal sealed class CharacterConfiguration
return JsonConvert.DeserializeObject<CharacterConfiguration>(File.ReadAllText(path)); return JsonConvert.DeserializeObject<CharacterConfiguration>(File.ReadAllText(path));
} }
public void Save(DalamudPluginInterface pluginInterface) public void Save(IDalamudPluginInterface pluginInterface)
{ {
File.WriteAllText(ResolveFilePath(pluginInterface, LocalContentId), JsonConvert.SerializeObject(this, Formatting.Indented)); File.WriteAllText(ResolveFilePath(pluginInterface, LocalContentId), JsonConvert.SerializeObject(this, Formatting.Indented));
} }
public void Delete(DalamudPluginInterface pluginInterface) => public void Delete(IDalamudPluginInterface pluginInterface) =>
File.Delete(ResolveFilePath(pluginInterface, LocalContentId)); File.Delete(ResolveFilePath(pluginInterface, LocalContentId));
} }

View File

@ -1,63 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Dalamud.NET.Sdk/9.0.2">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework> <Version>5.0</Version>
<Version>4.10</Version>
<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<OutputPath>dist</OutputPath> <OutputPath>dist</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<DebugType>portable</DebugType>
<PathMap Condition="$(SolutionDir) != ''">$(SolutionDir)=X:\</PathMap>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <Import Project="..\LLib\LLib.targets"/>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath> <Import Project="..\LLib\RenameZip.targets"/>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
<DalamudLibPath>$(DALAMUD_HOME)/</DalamudLibPath>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LLib\LLib.csproj" /> <ProjectReference Include="..\LLib\LLib.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
</ItemGroup>
<ItemGroup>
<Reference Include="Dalamud">
<HintPath>$(DalamudLibPath)Dalamud.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGui.NET">
<HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina">
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina.Excel">
<HintPath>$(DalamudLibPath)Lumina.Excel.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<Target Name="RenameLatestZip" AfterTargets="PackagePlugin">
<Exec Command="rename $(OutDir)$(AssemblyName)\latest.zip $(AssemblyName)-$(Version).zip"/>
</Target>
</Project> </Project>

View File

@ -25,7 +25,7 @@ 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 IDalamudPluginInterface _pluginInterface;
private readonly IChatGui _chatGui; private readonly IChatGui _chatGui;
private readonly IGameGui _gameGui; private readonly IGameGui _gameGui;
private readonly IFramework _framework; private readonly IFramework _framework;
@ -55,7 +55,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
private Stage _currentStageInternal = Stage.Stopped; private Stage _currentStageInternal = Stage.Stopped;
public DeliverooPlugin(DalamudPluginInterface pluginInterface, IChatGui chatGui, IGameGui gameGui, public DeliverooPlugin(IDalamudPluginInterface pluginInterface, IChatGui chatGui, IGameGui gameGui,
IFramework framework, IClientState clientState, IObjectTable objectTable, ITargetManager targetManager, IFramework framework, IClientState clientState, IObjectTable objectTable, ITargetManager targetManager,
IDataManager dataManager, ICondition condition, ICommandManager commandManager, IPluginLog pluginLog, IDataManager dataManager, ICondition condition, ICommandManager commandManager, IPluginLog pluginLog,
IAddonLifecycle addonLifecycle, ITextureProvider textureProvider, IGameConfig gameConfig, IKeyState keyState) IAddonLifecycle addonLifecycle, ITextureProvider textureProvider, IGameConfig gameConfig, IKeyState keyState)
@ -89,7 +89,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
_pluginLog, _iconCache, _gameFunctions); _pluginLog, _iconCache, _gameFunctions);
_windowSystem.AddWindow(_configWindow); _windowSystem.AddWindow(_configWindow);
_turnInWindow = new TurnInWindow(this, _pluginInterface, _configuration, _condition, _clientState, _turnInWindow = new TurnInWindow(this, _pluginInterface, _configuration, _condition, _clientState,
_gcRewardsCache, _configWindow, _iconCache, _keyState, _gameGui, _gameFunctions); _gcRewardsCache, _configWindow, _iconCache, _keyState, _gameFunctions);
_windowSystem.AddWindow(_turnInWindow); _windowSystem.AddWindow(_turnInWindow);
_framework.Update += FrameworkUpdate; _framework.Update += FrameworkUpdate;
@ -114,7 +114,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "GrandCompanySupplyReward", GrandCompanySupplyRewardPostSetup); _addonLifecycle.RegisterListener(AddonEvent.PostSetup, "GrandCompanySupplyReward", GrandCompanySupplyRewardPostSetup);
} }
private void ChatMessage(XivChatType type, uint senderId, ref SeString sender, ref SeString message, private void ChatMessage(XivChatType type, int timestamp, ref SeString sender, ref SeString message,
ref bool isHandled) ref bool isHandled)
{ {
if (_configuration.PauseAtRank <= 0) if (_configuration.PauseAtRank <= 0)
@ -233,8 +233,8 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
if (!_clientState.IsLoggedIn || if (!_clientState.IsLoggedIn ||
_clientState.TerritoryType is not 128 and not 130 and not 132 || _clientState.TerritoryType is not 128 and not 130 and not 132 ||
_condition[ConditionFlag.OccupiedInCutSceneEvent] || _condition[ConditionFlag.OccupiedInCutSceneEvent] ||
_gameFunctions.GetDistanceToNpc(_gameFunctions.GetQuartermasterId(), out GameObject? quartermaster) >= 7f || _gameFunctions.GetDistanceToNpc(_gameFunctions.GetQuartermasterId(), out IGameObject? quartermaster) >= 7f ||
_gameFunctions.GetDistanceToNpc(_gameFunctions.GetPersonnelOfficerId(), out GameObject? personnelOfficer) >= _gameFunctions.GetDistanceToNpc(_gameFunctions.GetPersonnelOfficerId(), out IGameObject? personnelOfficer) >=
7f || 7f ||
CharacterConfiguration is { DisableForCharacter: true } || CharacterConfiguration is { DisableForCharacter: true } ||
_configWindow.IsOpen) _configWindow.IsOpen)

View File

@ -25,7 +25,7 @@ internal sealed class AllaganToolsIpc
private readonly ICallGateSubscriber<uint, bool, uint[], uint> _itemCountOwned; private readonly ICallGateSubscriber<uint, bool, uint[], uint> _itemCountOwned;
public AllaganToolsIpc(DalamudPluginInterface pluginInterface, IPluginLog pluginLog) public AllaganToolsIpc(IDalamudPluginInterface pluginInterface, IPluginLog pluginLog)
{ {
_pluginLog = pluginLog; _pluginLog = pluginLog;
_itemCountOwned = pluginInterface.GetIpcSubscriber<uint, bool, uint[], uint>("AllaganTools.ItemCountOwned"); _itemCountOwned = pluginInterface.GetIpcSubscriber<uint, bool, uint[], uint>("AllaganTools.ItemCountOwned");

View File

@ -16,7 +16,7 @@ internal sealed class DeliverooIpc : IDisposable
private bool _running; private bool _running;
public DeliverooIpc(DalamudPluginInterface pluginInterface) public DeliverooIpc(IDalamudPluginInterface pluginInterface)
{ {
_isTurnInRunning = pluginInterface.GetIpcProvider<bool>(IsTurnInRunning); _isTurnInRunning = pluginInterface.GetIpcProvider<bool>(IsTurnInRunning);
_turnInStarted = pluginInterface.GetIpcProvider<object>(TurnInStarted); _turnInStarted = pluginInterface.GetIpcProvider<object>(TurnInStarted);

View File

@ -7,7 +7,7 @@ namespace Deliveroo.External;
internal sealed class ExternalPluginHandler : IDisposable internal sealed class ExternalPluginHandler : IDisposable
{ {
private readonly DalamudPluginInterface _pluginInterface; private readonly IDalamudPluginInterface _pluginInterface;
private readonly IGameConfig _gameConfig; private readonly IGameConfig _gameConfig;
private readonly Configuration _configuration; private readonly Configuration _configuration;
private readonly IPluginLog _pluginLog; private readonly IPluginLog _pluginLog;
@ -19,7 +19,7 @@ internal sealed class ExternalPluginHandler : IDisposable
private SystemConfigState? _limitFrameRateWhenClientInactive; private SystemConfigState? _limitFrameRateWhenClientInactive;
private SystemConfigState? _uncapFrameRate; private SystemConfigState? _uncapFrameRate;
public ExternalPluginHandler(DalamudPluginInterface pluginInterface, IGameConfig gameConfig, public ExternalPluginHandler(IDalamudPluginInterface pluginInterface, IGameConfig gameConfig,
Configuration configuration, IPluginLog pluginLog) Configuration configuration, IPluginLog pluginLog)
{ {
_pluginInterface = pluginInterface; _pluginInterface = pluginInterface;

View File

@ -13,7 +13,7 @@ internal sealed class PandoraIpc
private readonly ICallGateSubscriber<string, bool?> _getEnabled; private readonly ICallGateSubscriber<string, bool?> _getEnabled;
private readonly ICallGateSubscriber<string, bool, object?> _setEnabled; private readonly ICallGateSubscriber<string, bool, object?> _setEnabled;
public PandoraIpc(DalamudPluginInterface pluginInterface, IPluginLog pluginLog) public PandoraIpc(IDalamudPluginInterface pluginInterface, IPluginLog pluginLog)
{ {
_pluginLog = pluginLog; _pluginLog = pluginLog;
_getEnabled = pluginInterface.GetIpcSubscriber<string, bool?>("PandorasBox.GetFeatureEnabled"); _getEnabled = pluginInterface.GetIpcSubscriber<string, bool?>("PandorasBox.GetFeatureEnabled");

View File

@ -79,10 +79,10 @@ internal sealed class GameFunctions : IDisposable
_retainerItemCache.Clear(); _retainerItemCache.Clear();
} }
public unsafe void InteractWithTarget(GameObject obj) public unsafe void InteractWithTarget(IGameObject 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.EntityId != obj.EntityId)
{ {
_targetManager.Target = obj; _targetManager.Target = obj;
} }
@ -111,13 +111,13 @@ internal sealed class GameFunctions : IDisposable
public unsafe byte GetGrandCompanyRank() => PlayerState.Instance()->GetGrandCompanyRank(); public unsafe byte GetGrandCompanyRank() => PlayerState.Instance()->GetGrandCompanyRank();
public float GetDistanceToNpc(int npcId, out GameObject? o) public float GetDistanceToNpc(int npcId, out IGameObject? o)
{ {
foreach (var obj in _objectTable) foreach (var obj in _objectTable)
{ {
if (obj.ObjectKind == ObjectKind.EventNpc && obj is Character c) if (obj.ObjectKind == ObjectKind.EventNpc && obj is ICharacter c)
{ {
if (GetNpcId(obj) == npcId) if (c.DataId == npcId)
{ {
o = obj; o = obj;
return Vector3.Distance(_clientState.LocalPlayer?.Position ?? Vector3.Zero, c.Position); return Vector3.Distance(_clientState.LocalPlayer?.Position ?? Vector3.Zero, c.Position);
@ -129,7 +129,7 @@ internal sealed class GameFunctions : IDisposable
return float.MaxValue; return float.MaxValue;
} }
public static int GetNpcId(GameObject obj) public static int GetNpcId(IGameObject obj)
{ {
return Marshal.ReadInt32(obj.Address + 128); return Marshal.ReadInt32(obj.Address + 128);
} }

View File

@ -31,7 +31,7 @@ internal sealed class ExchangeHandler
_pluginLog = pluginLog; _pluginLog = pluginLog;
} }
public void InteractWithQuartermaster(GameObject personnelOfficer, GameObject quartermaster) public void InteractWithQuartermaster(IGameObject personnelOfficer, IGameObject quartermaster)
{ {
if (_gameFunctions.GetCurrentSealCount() < _plugin.EffectiveReservedSealCount) if (_gameFunctions.GetCurrentSealCount() < _plugin.EffectiveReservedSealCount)
{ {

View File

@ -32,9 +32,9 @@ internal sealed class SupplyHandler
_pluginLog = pluginLog; _pluginLog = pluginLog;
} }
public void InteractWithPersonnelOfficer(GameObject personnelOfficer, GameObject quartermaster) public void InteractWithPersonnelOfficer(IGameObject personnelOfficer, IGameObject quartermaster)
{ {
if (_targetManager.Target == quartermaster) if (_targetManager.Target?.EntityId == quartermaster.EntityId)
return; return;
_gameFunctions.InteractWithTarget(personnelOfficer); _gameFunctions.InteractWithTarget(personnelOfficer);
@ -46,7 +46,7 @@ internal sealed class SupplyHandler
var agentInterface = AgentModule.Instance()->GetAgentByInternalId(AgentId.GrandCompanySupply); var agentInterface = AgentModule.Instance()->GetAgentByInternalId(AgentId.GrandCompanySupply);
if (agentInterface != null && agentInterface->IsAgentActive()) if (agentInterface != null && agentInterface->IsAgentActive())
{ {
var addonId = agentInterface->GetAddonID(); var addonId = agentInterface->GetAddonId();
if (addonId == 0) if (addonId == 0)
return; return;
@ -89,7 +89,7 @@ internal sealed class SupplyHandler
var agentInterface = AgentModule.Instance()->GetAgentByInternalId(AgentId.GrandCompanySupply); var agentInterface = AgentModule.Instance()->GetAgentByInternalId(AgentId.GrandCompanySupply);
if (agentInterface != null && agentInterface->IsAgentActive()) if (agentInterface != null && agentInterface->IsAgentActive())
{ {
var addonId = agentInterface->GetAddonID(); var addonId = agentInterface->GetAddonId();
if (addonId == 0) if (addonId == 0)
return; return;
@ -99,7 +99,7 @@ internal sealed class SupplyHandler
var addonGc = (AddonGrandCompanySupplyList*)addon; var addonGc = (AddonGrandCompanySupplyList*)addon;
if (addonGc->ExpertDeliveryList == null || if (addonGc->ExpertDeliveryList == null ||
!addonGc->ExpertDeliveryList->AtkComponentBase.OwnerNode->AtkResNode.IsVisible) !addonGc->ExpertDeliveryList->AtkComponentBase.OwnerNode->AtkResNode.IsVisible())
return; return;
if (addonGc->SelectedTab != 2) if (addonGc->SelectedTab != 2)
@ -117,7 +117,7 @@ internal sealed class SupplyHandler
} }
int currentListSize = addonGc->ExpertDeliveryList->ListLength; int currentListSize = addonGc->ExpertDeliveryList->ListLength;
if (addonGc->ListEmptyTextNode->AtkResNode.IsVisible || currentListSize == 0) if (addonGc->ListEmptyTextNode->AtkResNode.IsVisible() || currentListSize == 0)
{ {
_pluginLog.Information( _pluginLog.Information(
$"No items to turn in ({addonGc->ListEmptyTextNode->AtkResNode.IsVisible}, {currentListSize})"); $"No items to turn in ({addonGc->ListEmptyTextNode->AtkResNode.IsVisible}, {currentListSize})");
@ -226,7 +226,7 @@ internal sealed class SupplyHandler
var agentInterface = AgentModule.Instance()->GetAgentByInternalId(AgentId.GrandCompanySupply); var agentInterface = AgentModule.Instance()->GetAgentByInternalId(AgentId.GrandCompanySupply);
if (agentInterface != null && agentInterface->IsAgentActive()) if (agentInterface != null && agentInterface->IsAgentActive())
{ {
var addonId = agentInterface->GetAddonID(); var addonId = agentInterface->GetAddonId();
if (addonId == 0) if (addonId == 0)
return; return;

View File

@ -6,7 +6,7 @@ using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.Text; using Dalamud.Game.Text;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Components; using Dalamud.Interface.Components;
using Dalamud.Interface.Internal; using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
@ -20,7 +20,7 @@ namespace Deliveroo.Windows;
internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
{ {
private readonly DalamudPluginInterface _pluginInterface; private readonly IDalamudPluginInterface _pluginInterface;
private readonly DeliverooPlugin _plugin; private readonly DeliverooPlugin _plugin;
private readonly Configuration _configuration; private readonly Configuration _configuration;
private readonly GcRewardsCache _gcRewardsCache; private readonly GcRewardsCache _gcRewardsCache;
@ -42,7 +42,7 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
private string _searchString = string.Empty; private string _searchString = string.Empty;
private uint _dragDropSource; private uint _dragDropSource;
public ConfigWindow(DalamudPluginInterface pluginInterface, DeliverooPlugin plugin, Configuration configuration, public ConfigWindow(IDalamudPluginInterface pluginInterface, DeliverooPlugin plugin, Configuration configuration,
GcRewardsCache gcRewardsCache, IClientState clientState, IPluginLog pluginLog, IconCache iconCache, GcRewardsCache gcRewardsCache, IClientState clientState, IPluginLog pluginLog, IconCache iconCache,
GameFunctions gameFunctions) GameFunctions gameFunctions)
: base("Deliveroo - Configuration###DeliverooConfig") : base("Deliveroo - Configuration###DeliverooConfig")
@ -103,10 +103,12 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
_configuration.ItemsAvailableForPurchase.Count == 1 && itemId == ItemIds.Venture); _configuration.ItemsAvailableForPurchase.Count == 1 && itemId == ItemIds.Venture);
var item = _itemLookup[itemId]; var item = _itemLookup[itemId];
IDalamudTextureWrap? icon = _iconCache.GetIcon(item.IconId); var icon = _iconCache.GetIcon(item.IconId);
Vector2 pos = ImGui.GetCursorPos(); Vector2 pos = ImGui.GetCursorPos();
Vector2 iconSize = new Vector2(ImGui.GetTextLineHeight() + ImGui.GetStyle().ItemSpacing.Y); Vector2 iconSize = new Vector2(ImGui.GetTextLineHeight() + ImGui.GetStyle().ItemSpacing.Y);
if (icon != null)
icon.TryGetWrap(out IDalamudTextureWrap? wrap, out _);
if (wrap != null)
{ {
ImGui.SetCursorPos(pos + new Vector2(iconSize.X + ImGui.GetStyle().FramePadding.X, ImGui.SetCursorPos(pos + new Vector2(iconSize.X + ImGui.GetStyle().FramePadding.X,
ImGui.GetStyle().ItemSpacing.Y / 2)); ImGui.GetStyle().ItemSpacing.Y / 2));
@ -115,13 +117,15 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
ImGui.Selectable($"{item.Name}{(item.Limited ? $" {SeIconChar.Hyadelyn.ToIconString()}" : "")}", ImGui.Selectable($"{item.Name}{(item.Limited ? $" {SeIconChar.Hyadelyn.ToIconString()}" : "")}",
false, ImGuiSelectableFlags.SpanAllColumns); false, ImGuiSelectableFlags.SpanAllColumns);
if (icon != null) if (wrap != null)
{ {
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
ImGui.SetCursorPos(pos); ImGui.SetCursorPos(pos);
ImGui.Image(icon.ImGuiHandle, iconSize); ImGui.Image(wrap.ImGuiHandle, iconSize);
} }
wrap?.Dispose();
if (ImGui.BeginDragDropSource()) if (ImGui.BeginDragDropSource())
{ {
ImGui.SetDragDropPayload("DeliverooDragDrop", nint.Zero, 0); ImGui.SetDragDropPayload("DeliverooDragDrop", nint.Zero, 0);
@ -190,12 +194,14 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
foreach (var item in comboValues.Where(x => foreach (var item in comboValues.Where(x =>
x.Name.Contains(_searchString, StringComparison.OrdinalIgnoreCase))) x.Name.Contains(_searchString, StringComparison.OrdinalIgnoreCase)))
{ {
IDalamudTextureWrap? icon = _iconCache.GetIcon(item.IconId); var icon = _iconCache.GetIcon(item.IconId);
if (icon != null) if (icon.TryGetWrap(out IDalamudTextureWrap? wrap, out _))
{ {
ImGui.Image(icon.ImGuiHandle, new Vector2(ImGui.GetFrameHeight())); ImGui.Image(wrap.ImGuiHandle, new Vector2(ImGui.GetFrameHeight()));
ImGui.SameLine(); ImGui.SameLine();
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + ImGui.GetStyle().FramePadding.X); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + ImGui.GetStyle().FramePadding.X);
wrap.Dispose();
} }
bool addThis = bool addThis =

View File

@ -7,17 +7,15 @@ using Dalamud.Game.ClientState.Keys;
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.Internal; using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Deliveroo.GameData; using Deliveroo.GameData;
using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using ImGuiNET; using ImGuiNET;
using LLib; using LLib;
using LLib.GameUI;
using LLib.ImGui; using LLib.ImGui;
namespace Deliveroo.Windows; namespace Deliveroo.Windows;
@ -47,7 +45,7 @@ internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
private static readonly string[] StockingTypeLabels = { "Purchase Once", "Keep in Stock" }; private static readonly string[] StockingTypeLabels = { "Purchase Once", "Keep in Stock" };
private readonly DeliverooPlugin _plugin; private readonly DeliverooPlugin _plugin;
private readonly DalamudPluginInterface _pluginInterface; private readonly IDalamudPluginInterface _pluginInterface;
private readonly Configuration _configuration; private readonly Configuration _configuration;
private readonly ICondition _condition; private readonly ICondition _condition;
private readonly IClientState _clientState; private readonly IClientState _clientState;
@ -55,14 +53,13 @@ internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
private readonly ConfigWindow _configWindow; private readonly ConfigWindow _configWindow;
private readonly IconCache _iconCache; private readonly IconCache _iconCache;
private readonly IKeyState _keyState; private readonly IKeyState _keyState;
private readonly IGameGui _gameGui;
private readonly GameFunctions _gameFunctions; private readonly GameFunctions _gameFunctions;
private bool _state; private bool _state;
public TurnInWindow(DeliverooPlugin plugin, DalamudPluginInterface pluginInterface, Configuration configuration, public TurnInWindow(DeliverooPlugin plugin, IDalamudPluginInterface pluginInterface, Configuration configuration,
ICondition condition, IClientState clientState, GcRewardsCache gcRewardsCache, ConfigWindow configWindow, ICondition condition, IClientState clientState, GcRewardsCache gcRewardsCache, ConfigWindow configWindow,
IconCache iconCache, IKeyState keyState, IGameGui gameGui, GameFunctions gameFunctions) IconCache iconCache, IKeyState keyState, GameFunctions gameFunctions)
: base("GC Delivery###DeliverooTurnIn") : base("GC Delivery###DeliverooTurnIn")
{ {
_plugin = plugin; _plugin = plugin;
@ -74,7 +71,6 @@ internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
_configWindow = configWindow; _configWindow = configWindow;
_iconCache = iconCache; _iconCache = iconCache;
_keyState = keyState; _keyState = keyState;
_gameGui = gameGui;
_gameFunctions = gameFunctions; _gameFunctions = gameFunctions;
Position = new Vector2(100, 100); Position = new Vector2(100, 100);
@ -296,7 +292,7 @@ internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
uint requiredSeals = _gameFunctions.GetSealsRequiredForNextRank(); uint requiredSeals = _gameFunctions.GetSealsRequiredForNextRank();
int currentHuntingLog = int currentHuntingLog =
MonsterNoteManager.Instance()->RankDataArraySpan[(int)_gameFunctions.GetGrandCompany() + 7] MonsterNoteManager.Instance()->RankData[(int)_gameFunctions.GetGrandCompany() + 7]
.Rank; .Rank;
byte requiredHuntingLog = _gameFunctions.GetRequiredHuntingLogForNextRank(); byte requiredHuntingLog = _gameFunctions.GetRequiredHuntingLogForNextRank();
@ -430,11 +426,13 @@ internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
} }
var comboItem = comboValues[comboValueIndex]; var comboItem = comboValues[comboValueIndex];
IDalamudTextureWrap? icon = _iconCache.GetIcon(comboItem.Item.IconId); var icon = _iconCache.GetIcon(comboItem.Item.IconId);
if (icon != null) if (icon.TryGetWrap(out IDalamudTextureWrap? wrap, out _))
{ {
ImGui.Image(icon.ImGuiHandle, new Vector2(ImGui.GetFrameHeight())); ImGui.Image(wrap.ImGuiHandle, new Vector2(ImGui.GetFrameHeight()));
ImGui.SameLine(0, 3); ImGui.SameLine(0, 3);
wrap.Dispose();
} }
indentX = ImGui.GetCursorPosX() - indentX; indentX = ImGui.GetCursorPosX() - indentX;
@ -577,7 +575,7 @@ internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
for (int i = 0; i < container->Size; ++i) for (int i = 0; i < container->Size; ++i)
{ {
var item = container->GetInventorySlot(i); var item = container->GetInventorySlot(i);
if (item == null || item->ItemID == 0 || item->ItemID == itemId) if (item == null || item->ItemId == 0 || item->ItemId == itemId)
{ {
slotsThatCanBeUsed++; slotsThatCanBeUsed++;
} }
@ -605,10 +603,10 @@ internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
private sealed class CharacterSpecificItemsToPurchase : IItemsToPurchase private sealed class CharacterSpecificItemsToPurchase : IItemsToPurchase
{ {
private readonly CharacterConfiguration _characterConfiguration; private readonly CharacterConfiguration _characterConfiguration;
private readonly DalamudPluginInterface _pluginInterface; private readonly IDalamudPluginInterface _pluginInterface;
public CharacterSpecificItemsToPurchase(CharacterConfiguration characterConfiguration, public CharacterSpecificItemsToPurchase(CharacterConfiguration characterConfiguration,
DalamudPluginInterface pluginInterface) IDalamudPluginInterface pluginInterface)
{ {
_characterConfiguration = characterConfiguration; _characterConfiguration = characterConfiguration;
_pluginInterface = pluginInterface; _pluginInterface = pluginInterface;
@ -638,9 +636,9 @@ internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
private sealed class GlobalItemsToPurchase : IItemsToPurchase private sealed class GlobalItemsToPurchase : IItemsToPurchase
{ {
private readonly Configuration _configuration; private readonly Configuration _configuration;
private readonly DalamudPluginInterface _pluginInterface; private readonly IDalamudPluginInterface _pluginInterface;
public GlobalItemsToPurchase(Configuration configuration, DalamudPluginInterface pluginInterface) public GlobalItemsToPurchase(Configuration configuration, IDalamudPluginInterface pluginInterface)
{ {
_configuration = configuration; _configuration = configuration;
_pluginInterface = pluginInterface; _pluginInterface = pluginInterface;

View File

@ -4,12 +4,83 @@
"net8.0-windows7.0": { "net8.0-windows7.0": {
"DalamudPackager": { "DalamudPackager": {
"type": "Direct", "type": "Direct",
"requested": "[2.1.12, )", "requested": "[2.1.13, )",
"resolved": "2.1.12", "resolved": "2.1.13",
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg==" "contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
},
"DotNet.ReproducibleBuilds": {
"type": "Direct",
"requested": "[1.1.1, )",
"resolved": "1.1.1",
"contentHash": "+H2t/t34h6mhEoUvHi8yGXyuZ2GjSovcGYehJrS2MDm2XgmPfZL2Sdxg+uL2lKgZ4M6tTwKHIlxOob2bgh0NRQ==",
"dependencies": {
"Microsoft.SourceLink.AzureRepos.Git": "1.1.1",
"Microsoft.SourceLink.Bitbucket.Git": "1.1.1",
"Microsoft.SourceLink.GitHub": "1.1.1",
"Microsoft.SourceLink.GitLab": "1.1.1"
}
},
"Microsoft.SourceLink.Gitea": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "KOBodmDnlWGIqZt2hT47Q69TIoGhIApDVLCyyj9TT5ct8ju16AbHYcB4XeknoHX562wO1pMS/1DfBIZK+V+sxg==",
"dependencies": {
"Microsoft.Build.Tasks.Git": "8.0.0",
"Microsoft.SourceLink.Common": "8.0.0"
}
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
},
"Microsoft.SourceLink.AzureRepos.Git": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "qB5urvw9LO2bG3eVAkuL+2ughxz2rR7aYgm2iyrB8Rlk9cp2ndvGRCvehk3rNIhRuNtQaeKwctOl1KvWiklv5w==",
"dependencies": {
"Microsoft.Build.Tasks.Git": "1.1.1",
"Microsoft.SourceLink.Common": "1.1.1"
}
},
"Microsoft.SourceLink.Bitbucket.Git": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "cDzxXwlyWpLWaH0em4Idj0H3AmVo3L/6xRXKssYemx+7W52iNskj/SQ4FOmfCb8YQt39otTDNMveCZzYtMoucQ==",
"dependencies": {
"Microsoft.Build.Tasks.Git": "1.1.1",
"Microsoft.SourceLink.Common": "1.1.1"
}
},
"Microsoft.SourceLink.Common": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
},
"Microsoft.SourceLink.GitHub": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==",
"dependencies": {
"Microsoft.Build.Tasks.Git": "1.1.1",
"Microsoft.SourceLink.Common": "1.1.1"
}
},
"Microsoft.SourceLink.GitLab": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "tvsg47DDLqqedlPeYVE2lmiTpND8F0hkrealQ5hYltSmvruy/Gr5nHAKSsjyw5L3NeM/HLMI5ORv7on/M4qyZw==",
"dependencies": {
"Microsoft.Build.Tasks.Git": "1.1.1",
"Microsoft.SourceLink.Common": "1.1.1"
}
}, },
"llib": { "llib": {
"type": "Project" "type": "Project",
"dependencies": {
"DalamudPackager": "[2.1.13, )"
}
} }
} }
} }

2
LLib

@ -1 +1 @@
Subproject commit b5125d4b3f7cdc0c7514a01764e5b5d4d85f80a7 Subproject commit 7027d291efbbff6a55944dd521d3907210ddecbe