API 9
This commit is contained in:
parent
849f677a1b
commit
188f0033fa
@ -16,7 +16,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
|
||||
<AutoRetainerLibPath>$(appdata)\XIVLauncher\installedPlugins\AutoRetainer\4.1.2.5\</AutoRetainerLibPath>
|
||||
<AutoRetainerLibPath>$(appdata)\XIVLauncher\installedPlugins\AutoRetainer\4.2.0.2\</AutoRetainerLibPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
|
||||
@ -24,8 +24,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dalamud.ContextMenu" Version="1.2.3"/>
|
||||
<PackageReference Include="DalamudPackager" Version="2.1.11"/>
|
||||
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -37,10 +36,6 @@
|
||||
<HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="ImGuiScene">
|
||||
<HintPath>$(DalamudLibPath)ImGuiScene.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Lumina">
|
||||
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
@ -57,10 +52,6 @@
|
||||
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="FFXIVClientStructs">
|
||||
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="AutoRetainerAPI">
|
||||
<HintPath>$(AutoRetainerLibPath)AutoRetainerAPI.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"Name": "ARC",
|
||||
"Author": "Liza Carvelli",
|
||||
"Punchline": "Better AutoRetainer Venture Distribution",
|
||||
"Punchline": "Better AutoRetainer Venture Planner",
|
||||
"Description": "",
|
||||
"RepoUrl": "https://git.carvel.li/liza/ARControl"
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Linq;
|
||||
using Dalamud.Logging;
|
||||
|
||||
namespace ARControl;
|
||||
|
||||
@ -12,7 +11,7 @@ partial class AutoRetainerControlPlugin
|
||||
// FIXME This should have a way to get blacklisted character ids
|
||||
foreach (ulong registeredCharacterId in _autoRetainerApi.GetRegisteredCharacters())
|
||||
{
|
||||
PluginLog.Information($"ch → {registeredCharacterId:X}");
|
||||
_pluginLog.Verbose($"Sync for character {registeredCharacterId:X}");
|
||||
var offlineCharacterData = _autoRetainerApi.GetOfflineCharacterData(registeredCharacterId);
|
||||
if (offlineCharacterData.ExcludeRetainer)
|
||||
continue;
|
||||
|
@ -4,15 +4,12 @@ using System.Linq;
|
||||
using ARControl.GameData;
|
||||
using ARControl.Windows;
|
||||
using AutoRetainerAPI;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using ECommons;
|
||||
using ImGuiNET;
|
||||
|
||||
@ -24,9 +21,10 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
|
||||
private readonly WindowSystem _windowSystem = new(nameof(AutoRetainerControlPlugin));
|
||||
|
||||
private readonly DalamudPluginInterface _pluginInterface;
|
||||
private readonly ClientState _clientState;
|
||||
private readonly ChatGui _chatGui;
|
||||
private readonly CommandManager _commandManager;
|
||||
private readonly IClientState _clientState;
|
||||
private readonly IChatGui _chatGui;
|
||||
private readonly ICommandManager _commandManager;
|
||||
private readonly IPluginLog _pluginLog;
|
||||
|
||||
private readonly Configuration _configuration;
|
||||
private readonly GameCache _gameCache;
|
||||
@ -34,19 +32,20 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
|
||||
private readonly ConfigWindow _configWindow;
|
||||
private readonly AutoRetainerApi _autoRetainerApi;
|
||||
|
||||
public AutoRetainerControlPlugin(DalamudPluginInterface pluginInterface, DataManager dataManager,
|
||||
ClientState clientState, ChatGui chatGui, CommandManager commandManager)
|
||||
public AutoRetainerControlPlugin(DalamudPluginInterface pluginInterface, IDataManager dataManager,
|
||||
IClientState clientState, IChatGui chatGui, ICommandManager commandManager, IPluginLog pluginLog)
|
||||
{
|
||||
_pluginInterface = pluginInterface;
|
||||
_clientState = clientState;
|
||||
_chatGui = chatGui;
|
||||
_commandManager = commandManager;
|
||||
_pluginLog = pluginLog;
|
||||
|
||||
_configuration = (Configuration?)_pluginInterface.GetPluginConfig() ?? new Configuration();
|
||||
|
||||
_gameCache = new GameCache(dataManager);
|
||||
_ventureResolver = new VentureResolver(_gameCache);
|
||||
_configWindow = new ConfigWindow(_pluginInterface, _configuration, _gameCache, _clientState, _commandManager);
|
||||
_ventureResolver = new VentureResolver(_gameCache, _pluginLog);
|
||||
_configWindow = new ConfigWindow(_pluginInterface, _configuration, _gameCache, _clientState, _commandManager, _pluginLog);
|
||||
_windowSystem.AddWindow(_configWindow);
|
||||
|
||||
ECommonsMain.Init(_pluginInterface, this);
|
||||
@ -57,54 +56,55 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
|
||||
_autoRetainerApi.OnSendRetainerToVenture += SendRetainerToVenture;
|
||||
_autoRetainerApi.OnRetainerPostVentureTaskDraw += RetainerTaskButtonDraw;
|
||||
_clientState.TerritoryChanged += TerritoryChanged;
|
||||
_commandManager.AddHandler("/arc", new CommandInfo(ProcessCommand));
|
||||
_commandManager.AddHandler("/arc", new CommandInfo(ProcessCommand)
|
||||
{
|
||||
HelpMessage = "Manage retainers"
|
||||
});
|
||||
|
||||
if (_autoRetainerApi.Ready)
|
||||
Sync();
|
||||
}
|
||||
|
||||
public string Name => "ARC";
|
||||
|
||||
private void SendRetainerToVenture(string retainerName)
|
||||
{
|
||||
var ch = _configuration.Characters.SingleOrDefault(x => x.LocalContentId == _clientState.LocalContentId);
|
||||
if (ch == null)
|
||||
{
|
||||
PluginLog.Information("No character information found");
|
||||
_pluginLog.Information("No character information found");
|
||||
}
|
||||
else if (!ch.Managed)
|
||||
{
|
||||
PluginLog.Information("Character is not managed");
|
||||
_pluginLog.Information("Character is not managed");
|
||||
}
|
||||
else
|
||||
{
|
||||
var retainer = ch.Retainers.SingleOrDefault(x => x.Name == retainerName);
|
||||
if (retainer == null)
|
||||
{
|
||||
PluginLog.Information("No retainer information found");
|
||||
_pluginLog.Information("No retainer information found");
|
||||
}
|
||||
else if (!retainer.Managed)
|
||||
{
|
||||
PluginLog.Information("Retainer is not managed");
|
||||
_pluginLog.Information("Retainer is not managed");
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginLog.Information("Checking tasks...");
|
||||
_pluginLog.Information("Checking tasks...");
|
||||
Sync();
|
||||
foreach (var queuedItem in _configuration.QueuedItems.Where(x => x.RemainingQuantity > 0))
|
||||
{
|
||||
PluginLog.Information($"Checking venture info for itemId {queuedItem.ItemId}");
|
||||
_pluginLog.Information($"Checking venture info for itemId {queuedItem.ItemId}");
|
||||
|
||||
var (venture, reward) = _ventureResolver.ResolveVenture(ch, retainer, queuedItem);
|
||||
if (reward == null)
|
||||
{
|
||||
PluginLog.Information("Retainer can't complete venture");
|
||||
_pluginLog.Information("Retainer can't complete venture");
|
||||
}
|
||||
else
|
||||
{
|
||||
_chatGui.Print(
|
||||
$"ARC → Overriding venture to collect {reward.Quantity}x {venture!.Name}.");
|
||||
PluginLog.Information(
|
||||
$"[ARC] Sending retainer {retainerName} to collect {reward.Quantity}x {venture!.Name}.");
|
||||
_pluginLog.Information(
|
||||
$"Setting AR to use venture {venture.RowId}, which should retrieve {reward.Quantity}x {venture.Name}");
|
||||
_autoRetainerApi.SetVenture(venture.RowId);
|
||||
|
||||
@ -119,15 +119,15 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
|
||||
// fallback: managed but no venture found
|
||||
if (retainer.LastVenture != 395)
|
||||
{
|
||||
_chatGui.Print("ARC → No tasks left, using QC");
|
||||
PluginLog.Information($"No tasks left (previous venture = {retainer.LastVenture}), using QC");
|
||||
_chatGui.Print($"[ARC] No tasks left for retainer {retainerName}, sending to Quick Venture.");
|
||||
_pluginLog.Information($"No tasks left (previous venture = {retainer.LastVenture}), using QC");
|
||||
_autoRetainerApi.SetVenture(395);
|
||||
|
||||
retainer.LastVenture = 395;
|
||||
_pluginInterface.SavePluginConfig(_configuration);
|
||||
}
|
||||
else
|
||||
PluginLog.Information("Not changing venture plan, already 395");
|
||||
_pluginLog.Information("Not changing venture plan, already 395");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -148,7 +148,7 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
|
||||
ImGuiComponents.IconButton(FontAwesomeIcon.Book);
|
||||
}
|
||||
|
||||
private void TerritoryChanged(object? sender, ushort e) => Sync();
|
||||
private void TerritoryChanged(ushort e) => Sync();
|
||||
|
||||
private void ProcessCommand(string command, string arguments)
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Dalamud.Configuration;
|
||||
|
||||
namespace ARControl;
|
||||
|
@ -1,13 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace ARControl.GameData;
|
||||
|
||||
internal sealed class GameCache
|
||||
{
|
||||
public GameCache(DataManager dataManager)
|
||||
public GameCache(IDataManager dataManager)
|
||||
{
|
||||
Jobs = dataManager.GetExcelSheet<ClassJob>()!.ToDictionary(x => x.RowId, x => x.Abbreviation.ToString());
|
||||
Ventures = dataManager.GetExcelSheet<RetainerTask>()!
|
||||
|
@ -1,11 +1,11 @@
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace ARControl.GameData;
|
||||
|
||||
internal sealed class ItemToGather
|
||||
{
|
||||
public ItemToGather(DataManager dataManager, GatheringItem item)
|
||||
public ItemToGather(IDataManager dataManager, GatheringItem item)
|
||||
{
|
||||
GatheredItemId = item.RowId;
|
||||
ItemId = item.Item;
|
||||
|
@ -1,12 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace ARControl.GameData;
|
||||
|
||||
internal sealed class Venture
|
||||
{
|
||||
public Venture(DataManager dataManager, RetainerTask retainerTask)
|
||||
public Venture(IDataManager dataManager, RetainerTask retainerTask)
|
||||
{
|
||||
RowId = retainerTask.RowId;
|
||||
Category = retainerTask.ClassJobCategory.Value!;
|
||||
|
@ -1,16 +1,17 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Dalamud.Logging;
|
||||
using System.Linq;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace ARControl.GameData;
|
||||
|
||||
internal sealed class VentureResolver
|
||||
{
|
||||
private readonly GameCache _gameCache;
|
||||
private readonly IPluginLog _pluginLog;
|
||||
|
||||
public VentureResolver(GameCache gameCache)
|
||||
public VentureResolver(GameCache gameCache, IPluginLog pluginLog)
|
||||
{
|
||||
_gameCache = gameCache;
|
||||
_pluginLog = pluginLog;
|
||||
}
|
||||
|
||||
public (Venture?, VentureReward?) ResolveVenture(Configuration.CharacterConfiguration character,
|
||||
@ -21,18 +22,18 @@ internal sealed class VentureResolver
|
||||
.FirstOrDefault(x => x.ItemId == queuedItem.ItemId && x.MatchesJob(retainer.Job));
|
||||
if (venture == null)
|
||||
{
|
||||
PluginLog.Information($"No applicable venture found for itemId {queuedItem.ItemId}");
|
||||
_pluginLog.Information($"No applicable venture found for itemId {queuedItem.ItemId}");
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
var itemToGather = _gameCache.ItemsToGather.FirstOrDefault(x => x.ItemId == queuedItem.ItemId);
|
||||
if (itemToGather != null && !character.GatheredItems.Contains(itemToGather.GatheredItemId))
|
||||
{
|
||||
PluginLog.Information($"Character hasn't gathered {venture.Name} yet");
|
||||
_pluginLog.Information($"Character hasn't gathered {venture.Name} yet");
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
PluginLog.Information(
|
||||
_pluginLog.Information(
|
||||
$"Found venture {venture.Name}, row = {venture.RowId}, checking if it is suitable");
|
||||
VentureReward? reward = null;
|
||||
if (venture.CategoryName is "MIN" or "BTN")
|
||||
|
@ -2,15 +2,12 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using ARControl.GameData;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Style;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using ECommons.ImGuiMethods;
|
||||
using ImGuiNET;
|
||||
|
||||
@ -27,8 +24,9 @@ internal sealed class ConfigWindow : Window
|
||||
private readonly DalamudPluginInterface _pluginInterface;
|
||||
private readonly Configuration _configuration;
|
||||
private readonly GameCache _gameCache;
|
||||
private readonly ClientState _clientState;
|
||||
private readonly CommandManager _commandManager;
|
||||
private readonly IClientState _clientState;
|
||||
private readonly ICommandManager _commandManager;
|
||||
private readonly IPluginLog _pluginLog;
|
||||
|
||||
private string _searchString = string.Empty;
|
||||
private Configuration.QueuedItem? _dragDropSource;
|
||||
@ -40,8 +38,9 @@ internal sealed class ConfigWindow : Window
|
||||
DalamudPluginInterface pluginInterface,
|
||||
Configuration configuration,
|
||||
GameCache gameCache,
|
||||
ClientState clientState,
|
||||
CommandManager commandManager)
|
||||
IClientState clientState,
|
||||
ICommandManager commandManager,
|
||||
IPluginLog pluginLog)
|
||||
: base("ARC###ARControlConfig")
|
||||
{
|
||||
_pluginInterface = pluginInterface;
|
||||
@ -49,6 +48,7 @@ internal sealed class ConfigWindow : Window
|
||||
_gameCache = gameCache;
|
||||
_clientState = clientState;
|
||||
_commandManager = commandManager;
|
||||
_pluginLog = pluginLog;
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
@ -66,7 +66,7 @@ internal sealed class ConfigWindow : Window
|
||||
{
|
||||
if (ImGui.BeginTabItem("Venture Queue"))
|
||||
{
|
||||
if (ImGui.BeginCombo("Venture...##VentureSelection", ""))
|
||||
if (ImGui.BeginCombo("Add Item...##VentureSelection", ""))
|
||||
{
|
||||
ImGuiEx.SetNextItemFullWidth();
|
||||
ImGui.InputTextWithHint("", "Filter...", ref _searchString, 256);
|
||||
@ -95,7 +95,6 @@ internal sealed class ConfigWindow : Window
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
|
||||
ImGui.Checkbox("Enable Drag&Drop", ref _enableDragDrop);
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.Indent(30);
|
||||
@ -167,13 +166,29 @@ internal sealed class ConfigWindow : Window
|
||||
|
||||
if (itemToAdd != null)
|
||||
{
|
||||
PluginLog.Information($"Updating {itemToAdd.ItemId} → {indexToAdd}");
|
||||
_pluginLog.Information($"Updating {itemToAdd.ItemId} → {indexToAdd}");
|
||||
_configuration.QueuedItems.Remove(itemToAdd);
|
||||
_configuration.QueuedItems.Insert(indexToAdd, itemToAdd);
|
||||
Save();
|
||||
}
|
||||
|
||||
ImGui.Unindent(30);
|
||||
|
||||
if (_configuration.QueuedItems.Count > 0)
|
||||
ImGui.Separator();
|
||||
|
||||
if (ImGuiComponents.IconButtonWithText(_enableDragDrop ? FontAwesomeIcon.Times : FontAwesomeIcon.Sort, _enableDragDrop ? "Disable Drag&Drop" : "Enable Drag&Drop"))
|
||||
{
|
||||
_enableDragDrop = !_enableDragDrop;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Check, "Remove all finished items"))
|
||||
{
|
||||
if (_configuration.QueuedItems.RemoveAll(q => q.RemainingQuantity == 0) > 0)
|
||||
Save();
|
||||
}
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
}
|
||||
|
@ -2,17 +2,11 @@
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
"net7.0-windows7.0": {
|
||||
"Dalamud.ContextMenu": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.2.3, )",
|
||||
"resolved": "1.2.3",
|
||||
"contentHash": "ydemplF7DNcA/LLeongDVzWUD/JV0Fw3EwA2+P0jYq3Le2ZYSt4U8qyJq4FyoChqt0lFG8BxYCAzfeWp4Jmnqw=="
|
||||
},
|
||||
"DalamudPackager": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.1.11, )",
|
||||
"resolved": "2.1.11",
|
||||
"contentHash": "9qlAWoRRTiL/geAvuwR/g6Bcbrd/bJJgVnB/RurBiyKs6srsP0bvpoo8IK+Eg8EA6jWeM6/YJWs66w4FIAzqPw=="
|
||||
"requested": "[2.1.12, )",
|
||||
"resolved": "2.1.12",
|
||||
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user