Add button to use priority seal allowance

This commit is contained in:
Liza 2023-10-12 02:09:46 +02:00
parent 9889e89fc7
commit 0b201d7daa
Signed by: liza
GPG Key ID: 7199F8D727D55F67
5 changed files with 23 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<Version>2.7</Version>
<Version>2.8</Version>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View File

@ -77,7 +77,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
_gcRewardsCache = new GcRewardsCache(dataManager);
_configWindow = new ConfigWindow(_pluginInterface, this, _configuration, _gcRewardsCache, _clientState, _pluginLog);
_windowSystem.AddWindow(_configWindow);
_turnInWindow = new TurnInWindow(this, _pluginInterface, _configuration, _gcRewardsCache, _configWindow);
_turnInWindow = new TurnInWindow(this, _pluginInterface, _configuration, _condition, _gcRewardsCache, _configWindow);
_windowSystem.AddWindow(_turnInWindow);
_sealCaps = dataManager.GetExcelSheet<GrandCompanyRank>()!.Where(x => x.RowId > 0)
.ToDictionary(x => x.RowId, x => x.MaxSeals);

View File

@ -2,5 +2,6 @@
public static class ItemIds
{
public const uint PrioritySealAllowance = 14946;
public const uint Venture = 21072;
}

View File

@ -9,7 +9,6 @@ using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Deliveroo.GameData;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using ImGuiNET;
using LLib;

View File

@ -2,12 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Deliveroo.GameData;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
@ -21,16 +23,18 @@ internal sealed class TurnInWindow : Window
private readonly DeliverooPlugin _plugin;
private readonly DalamudPluginInterface _pluginInterface;
private readonly Configuration _configuration;
private readonly ICondition _condition;
private readonly GcRewardsCache _gcRewardsCache;
private readonly ConfigWindow _configWindow;
public TurnInWindow(DeliverooPlugin plugin, DalamudPluginInterface pluginInterface, Configuration configuration,
GcRewardsCache gcRewardsCache, ConfigWindow configWindow)
ICondition condition, GcRewardsCache gcRewardsCache, ConfigWindow configWindow)
: base("GC Delivery###DeliverooTurnIn")
{
_plugin = plugin;
_pluginInterface = pluginInterface;
_configuration = configuration;
_condition = condition;
_gcRewardsCache = gcRewardsCache;
_configWindow = configWindow;
@ -89,7 +93,7 @@ internal sealed class TurnInWindow : Window
}
}
public override void Draw()
public override unsafe void Draw()
{
LImGui.AddPatreonIcon(_pluginInterface);
@ -134,6 +138,20 @@ internal sealed class TurnInWindow : Window
ImGui.TextColored(ImGuiColors.HealerGreen, $"Current Buff: {(Multiplier - 1m) * 100:N0}%%");
}
if (Multiplier <= 1.10m)
{
InventoryManager* inventoryManager = InventoryManager.Instance();
if (inventoryManager->GetInventoryItemCount(ItemIds.PrioritySealAllowance) > 0)
{
ImGui.BeginDisabled(_condition[ConditionFlag.OccupiedInQuestEvent] || _condition[ConditionFlag.Casting]);
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Bolt, "Use Priority Seal Allowance (15%)"))
{
AgentInventoryContext.Instance()->UseItem(ItemIds.PrioritySealAllowance);
}
ImGui.EndDisabled();
}
}
ImGui.Unindent(27);
ImGui.Separator();
ImGui.BeginDisabled(state);