Add a configurable minimum venture count, under which only quick ventures are assigned

pull/3/head v2.5
Liza 2023-10-19 01:22:25 +02:00
parent 65af6814df
commit 8b11b67c96
Signed by: liza
GPG Key ID: 7199F8D727D55F67
6 changed files with 154 additions and 107 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<Version>2.4</Version>
<Version>2.5</Version>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
@ -16,7 +16,7 @@
<PropertyGroup>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
<AutoRetainerLibPath>$(appdata)\XIVLauncher\installedPlugins\AutoRetainer\4.2.1.1\</AutoRetainerLibPath>
<AutoRetainerLibPath>$(appdata)\XIVLauncher\installedPlugins\AutoRetainer\4.2.1.2\</AutoRetainerLibPath>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">

View File

@ -4,5 +4,5 @@
"Punchline": "Better AutoRetainer Venture Planner",
"Description": "",
"RepoUrl": "https://git.carvel.li/liza/ARControl",
"IconUrl": "https://git.carvel.li/liza/plugin-repo/raw/branch/master/dist/ARControl.png"
"IconUrl": "https://plugins.carvel.li/icons/ARControl.png"
}

View File

@ -38,6 +38,12 @@ partial class AutoRetainerControlPlugin
save = true;
}
if (character.Ventures != offlineCharacterData.Ventures)
{
character.Ventures = offlineCharacterData.Ventures;
save = true;
}
List<string> seenRetainers = new();
foreach (var retainerData in offlineCharacterData.RetainerData)
{

View File

@ -112,10 +112,22 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
_pluginLog.Information("Checking tasks...");
Sync();
var venturesInProgress = CalculateVenturesInProgress(ch);
foreach (var inpr in venturesInProgress)
if (ch.Ventures == 0)
{
_pluginLog.Verbose($"Venture In Progress: ItemId {inpr.Key} for a total amount of {inpr.Value}");
_pluginLog.Warning("Could not assign a next venture from venture list, as the character has no ventures left.");
}
else if (ch.Ventures <= _configuration.Misc.VenturesToKeep)
{
_pluginLog.Warning($"Could not assign a next venture from venture list, character only has {ch.Ventures} left, configuration says to only send out above {_configuration.Misc.VenturesToKeep} ventures.");
}
else
{
var venturesInProgress = CalculateVenturesInProgress(ch);
foreach (var inProgress in venturesInProgress)
{
_pluginLog.Verbose(
$"Venture In Progress: ItemId {inProgress.Key} for a total amount of {inProgress.Value}");
}
IReadOnlyList<Guid> itemListIds;
@ -187,7 +199,8 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
if (venture == null)
{
venture = _gameCache.Ventures.FirstOrDefault(x => x.ItemId == itemOnList.ItemId);
_pluginLog.Debug($"Retainer doesn't know how to gather itemId {itemOnList.ItemId} ({venture?.Name})");
_pluginLog.Debug(
$"Retainer doesn't know how to gather itemId {itemOnList.ItemId} ({venture?.Name})");
}
else if (reward == null)
{
@ -236,6 +249,7 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
}
}
}
}
// fallback: managed but no venture found/
if (retainer.LastVenture != QuickVentureId)

View File

@ -12,6 +12,7 @@ internal sealed class Configuration : IPluginConfiguration
public List<CharacterConfiguration> Characters { get; set; } = new();
public List<ItemList> ItemLists { get; set; } = new();
public List<CharacterGroup> CharacterGroups { get; set; } = new();
public MiscConfiguration Misc { get; set; } = new();
public ConfigWindowUiOptions ConfigUiOptions { get; set; } = new();
public sealed class ItemList
@ -68,6 +69,7 @@ internal sealed class Configuration : IPluginConfiguration
public required string CharacterName { get; set; }
public required string WorldName { get; set; }
public uint Ventures { get; set; }
public CharacterType Type { get; set; } = CharacterType.NotManaged;
public Guid CharacterGroupId { get; set; }
public List<Guid> ItemListIds { get; set; } = new();
@ -107,6 +109,11 @@ internal sealed class Configuration : IPluginConfiguration
public int Perception { get; set; }
}
public sealed class MiscConfiguration
{
public int VenturesToKeep { get; set; }
}
public sealed class ConfigWindowUiOptions
{
public bool ShowVentureListContents { get; set; } = true;

View File

@ -85,7 +85,7 @@ internal sealed class ConfigWindow : Window
DrawCharacterGroups();
DrawCharacters();
DrawGatheredItemsToCheck();
DrawUiTab();
DrawMiscTab();
ImGui.EndTabBar();
}
}
@ -1020,10 +1020,30 @@ internal sealed class ConfigWindow : Window
ImGui.PopID();
}
private void DrawUiTab()
private void DrawMiscTab()
{
if (ImGui.BeginTabItem("UI"))
if (ImGui.BeginTabItem("Misc"))
{
ImGui.Text("Venture Settings");
ImGui.Spacing();
ImGui.SetNextItemWidth(130);
int venturesToKeep = _configuration.Misc.VenturesToKeep;
if (ImGui.InputInt("Minimum Ventures needed to assign retainers", ref venturesToKeep))
{
_configuration.Misc.VenturesToKeep = Math.Max(0, Math.Min(65000, venturesToKeep));
Save();
}
ImGui.SameLine();
ImGuiComponents.HelpMarker($"If you have less than {venturesToKeep} ventures, retainers will only be sent out for Quick Ventures (instead of picking the next item from the Venture List).");
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
ImGui.Text("User Interface Settings");
bool showContents = _configuration.ConfigUiOptions.ShowVentureListContents;
if (ImGui.Checkbox("Show Venture List preview in Groups/Retainer tabs", ref showContents))
{