Change log levels

This commit is contained in:
Liza 2023-10-12 11:07:18 +02:00
parent 2cd9013e3e
commit 37bdefcc55
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 33 additions and 14 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>2.1</Version> <Version>2.2</Version>
<LangVersion>11.0</LangVersion> <LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View File

@ -55,8 +55,7 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
_ventureResolver = new VentureResolver(_gameCache, _pluginLog); _ventureResolver = new VentureResolver(_gameCache, _pluginLog);
_configWindow = _configWindow =
new ConfigWindow(_pluginInterface, _configuration, _gameCache, _clientState, _commandManager, _iconCache, new ConfigWindow(_pluginInterface, _configuration, _gameCache, _clientState, _commandManager, _iconCache,
_pluginLog) _pluginLog);
{ IsOpen = true };
_windowSystem.AddWindow(_configWindow); _windowSystem.AddWindow(_configWindow);
ECommonsMain.Init(_pluginInterface, this); ECommonsMain.Init(_pluginInterface, this);
@ -118,7 +117,7 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
var venturesInProgress = CalculateVenturesInProgress(ch); var venturesInProgress = CalculateVenturesInProgress(ch);
foreach (var inpr in venturesInProgress) foreach (var inpr in venturesInProgress)
{ {
_pluginLog.Information($"In Progress: {inpr.Key} → {inpr.Value}"); _pluginLog.Verbose($"Venture In Progress: ItemId {inpr.Key} for a total amount of {inpr.Value}");
} }
IReadOnlyList<Guid> itemListIds; IReadOnlyList<Guid> itemListIds;
@ -178,18 +177,23 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
itemsOnList = itemsOnList.OrderBy(x => x.InventoryCount).ToList().AsReadOnly(); itemsOnList = itemsOnList.OrderBy(x => x.InventoryCount).ToList().AsReadOnly();
} }
_pluginLog.Information($"Found {itemsOnList.Count} items on current list"); _pluginLog.Debug($"Found {itemsOnList.Count} to-do items on current list");
if (itemsOnList.Count == 0) if (itemsOnList.Count == 0)
continue; continue;
foreach (var itemOnList in itemsOnList) foreach (var itemOnList in itemsOnList)
{ {
_pluginLog.Information($"Checking venture info for itemId {itemOnList.ItemId}"); _pluginLog.Debug($"Checking venture info for itemId {itemOnList.ItemId}");
var (venture, reward) = _ventureResolver.ResolveVenture(ch, retainer, itemOnList.ItemId); var (venture, reward) = _ventureResolver.ResolveVenture(ch, retainer, itemOnList.ItemId);
if (venture == null || reward == null) if (venture == null)
{ {
_pluginLog.Information($"Retainer can't complete venture '{venture?.Name}'"); venture = _gameCache.Ventures.FirstOrDefault(x => x.ItemId == itemOnList.ItemId);
_pluginLog.Debug($"Retainer doesn't know how to gather itemId {itemOnList.ItemId} ({venture?.Name})");
}
else if (reward == null)
{
_pluginLog.Debug($"Retainer can't complete venture '{venture.Name}'");
} }
else else
{ {
@ -235,7 +239,7 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
} }
} }
// fallback: managed but no venture found // fallback: managed but no venture found/
if (retainer.LastVenture != QuickVentureId) if (retainer.LastVenture != QuickVentureId)
{ {
_chatGui.Print( _chatGui.Print(
@ -251,7 +255,7 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
.Append("Quick Venture") .Append("Quick Venture")
.Append(new UIForegroundPayload(0)) .Append(new UIForegroundPayload(0))
.Append(".")); .Append("."));
_pluginLog.Information($"No tasks left (previous venture = {retainer.LastVenture}), using QC"); _pluginLog.Information($"No tasks left (previous venture = {retainer.LastVenture}), using QV");
if (!dryRun) if (!dryRun)
{ {
@ -337,7 +341,7 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
{ {
if (arguments == "sync") if (arguments == "sync")
Sync(); Sync();
else if (arguments == "d") else if (arguments.StartsWith("dnv"))
{ {
var ch = _configuration.Characters.SingleOrDefault(x => x.LocalContentId == _clientState.LocalContentId); var ch = _configuration.Characters.SingleOrDefault(x => x.LocalContentId == _clientState.LocalContentId);
if (ch == null || ch.Type == Configuration.CharacterType.NotManaged || ch.Retainers.Count == 0) if (ch == null || ch.Type == Configuration.CharacterType.NotManaged || ch.Retainers.Count == 0)
@ -346,7 +350,22 @@ public sealed partial class AutoRetainerControlPlugin : IDalamudPlugin
return; return;
} }
string retainerName = ch.Retainers.OrderBy(x => x.DisplayOrder).First().Name; string[] s = arguments.Split(" ");
string? retainerName;
if (s.Length > 1)
retainerName = ch.Retainers.SingleOrDefault(x => x.Name.EqualsIgnoreCase(s[1]))?.Name;
else
retainerName = ch.Retainers.MinBy(x => x.DisplayOrder)?.Name;
if (retainerName == null)
{
if (s.Length > 1)
_chatGui.PrintError($"Could not find retainer {s[1]}.");
else
_chatGui.PrintError("Could not find retainer.");
return;
}
var venture = GetNextVenture(retainerName, true); var venture = GetNextVenture(retainerName, true);
if (venture == QuickVentureId) if (venture == QuickVentureId)
_chatGui.Print($"Next venture for {retainerName} is Quick Venture."); _chatGui.Print($"Next venture for {retainerName} is Quick Venture.");

View File

@ -22,7 +22,7 @@ internal sealed class VentureResolver
.FirstOrDefault(x => x.ItemId == itemId && x.MatchesJob(retainer.Job)); .FirstOrDefault(x => x.ItemId == itemId && x.MatchesJob(retainer.Job));
if (venture == null) if (venture == null)
{ {
_pluginLog.Information($"No applicable venture found for itemId {itemId}"); _pluginLog.Debug($"No applicable venture found for itemId {itemId} as {retainer.Job}");
return (null, null); return (null, null);
} }
@ -33,7 +33,7 @@ internal sealed class VentureResolver
return (null, null); return (null, null);
} }
_pluginLog.Information( _pluginLog.Debug(
$"Found venture {venture.Name}, row = {venture.RowId}, checking if we have high enough stats"); $"Found venture {venture.Name}, row = {venture.RowId}, checking if we have high enough stats");
VentureReward? reward = null; VentureReward? reward = null;
if (venture.CategoryName is "MIN" or "BTN") if (venture.CategoryName is "MIN" or "BTN")