Added auto enroll feature #1

Open
Asuna wants to merge 4 commits from Asuna/Influx:master into master
4 changed files with 81 additions and 26 deletions
Showing only changes of commit ade0ed4754 - Show all commits

View File

@ -1,34 +1,58 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Influx", "Influx\Influx.csproj", "{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}"
# Visual Studio Version 17
VisualStudioVersion = 17.11.35222.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Influx", "Influx\Influx.csproj", "{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLib", "LLib\LLib.csproj", "{C11552A8-9C8C-4084-A669-AAFE55E24DCC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LLib", "LLib\LLib.csproj", "{C11552A8-9C8C-4084-A669-AAFE55E24DCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ECommons", "ECommons\ECommons\ECommons.csproj", "{FC6E184C-5B01-4298-87DF-CC10C4955936}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ECommons", "ECommons\ECommons\ECommons.csproj", "{FC6E184C-5B01-4298-87DF-CC10C4955936}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRetainerAPI", "AutoRetainerAPI\AutoRetainerAPI\AutoRetainerAPI.csproj", "{7352C470-D652-4909-AD90-8A5171A86698}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoRetainerAPI", "AutoRetainerAPI\AutoRetainerAPI\AutoRetainerAPI.csproj", "{7352C470-D652-4909-AD90-8A5171A86698}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|x64 = Debug|x64
DebugForms|x64 = DebugForms|x64
Release|x64 = Release|x64
ReleaseForms|x64 = ReleaseForms|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.Debug|Any CPU.Build.0 = Debug|Any CPU
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.Release|Any CPU.Build.0 = Release|Any CPU
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Release|Any CPU.Build.0 = Release|Any CPU
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Debug|Any CPU.ActiveCfg = Debug|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Debug|Any CPU.Build.0 = Debug|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Release|Any CPU.ActiveCfg = Release|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Release|Any CPU.Build.0 = Release|x64
{7352C470-D652-4909-AD90-8A5171A86698}.Debug|Any CPU.ActiveCfg = Debug|x64
{7352C470-D652-4909-AD90-8A5171A86698}.Debug|Any CPU.Build.0 = Debug|x64
{7352C470-D652-4909-AD90-8A5171A86698}.Release|Any CPU.ActiveCfg = Release|x64
{7352C470-D652-4909-AD90-8A5171A86698}.Release|Any CPU.Build.0 = Release|x64
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.Debug|x64.ActiveCfg = Debug|x64
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.Debug|x64.Build.0 = Debug|x64
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.DebugForms|x64.ActiveCfg = Debug|x64
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.DebugForms|x64.Build.0 = Debug|x64
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.Release|x64.ActiveCfg = Release|x64
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.Release|x64.Build.0 = Release|x64
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.ReleaseForms|x64.ActiveCfg = Release|x64
{588F6FDE-C6DF-42D9-BD7A-941BE2EB7E44}.ReleaseForms|x64.Build.0 = Release|x64
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Debug|x64.ActiveCfg = Debug|x64
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Debug|x64.Build.0 = Debug|x64
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.DebugForms|x64.ActiveCfg = Debug|x64
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.DebugForms|x64.Build.0 = Debug|x64
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Release|x64.ActiveCfg = Release|x64
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.Release|x64.Build.0 = Release|x64
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.ReleaseForms|x64.ActiveCfg = Release|x64
{C11552A8-9C8C-4084-A669-AAFE55E24DCC}.ReleaseForms|x64.Build.0 = Release|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Debug|x64.ActiveCfg = Debug|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Debug|x64.Build.0 = Debug|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.DebugForms|x64.ActiveCfg = DebugForms|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.DebugForms|x64.Build.0 = DebugForms|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Release|x64.ActiveCfg = Release|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.Release|x64.Build.0 = Release|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.ReleaseForms|x64.ActiveCfg = ReleaseForms|x64
{FC6E184C-5B01-4298-87DF-CC10C4955936}.ReleaseForms|x64.Build.0 = ReleaseForms|x64
{7352C470-D652-4909-AD90-8A5171A86698}.Debug|x64.ActiveCfg = Debug|x64
{7352C470-D652-4909-AD90-8A5171A86698}.Debug|x64.Build.0 = Debug|x64
{7352C470-D652-4909-AD90-8A5171A86698}.DebugForms|x64.ActiveCfg = Debug|x64
{7352C470-D652-4909-AD90-8A5171A86698}.DebugForms|x64.Build.0 = Debug|x64
{7352C470-D652-4909-AD90-8A5171A86698}.Release|x64.ActiveCfg = Release|x64
{7352C470-D652-4909-AD90-8A5171A86698}.Release|x64.Build.0 = Release|x64
{7352C470-D652-4909-AD90-8A5171A86698}.ReleaseForms|x64.ActiveCfg = Release|x64
{7352C470-D652-4909-AD90-8A5171A86698}.ReleaseForms|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -8,6 +8,7 @@ internal sealed class Configuration : IPluginConfiguration
public int Version { get; set; } = 1;
public ServerConfiguration Server { get; set; } = new();
public bool AutoEnrollCharacters { get; set; }
public IList<CharacterInfo> IncludedCharacters { get; set; } = new List<CharacterInfo>();
public IList<FilterInfo> IncludedInventoryFilters { get; set; } = new List<FilterInfo>();

View File

@ -8,6 +8,7 @@ using Dalamud.Game.Command;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using ECommons;
using Influx.AllaganTools;
using Influx.Influx;
using Influx.LocalStatistics;
@ -65,7 +66,15 @@ internal sealed class InfluxPlugin : IDalamudPlugin
_configurationWindow.ConfigUpdated += (_, _) => _influxStatisticsClient.UpdateClient();
_windowSystem.AddWindow(_configurationWindow);
_commandManager.AddHandler("/influx", new CommandInfo(ProcessCommand));
_commandManager.AddHandler("/influx", new CommandInfo(ProcessCommand)
{
HelpMessage = "Opens influx configuration"
});
_commandManager.AddHandler("/influx gil", new CommandInfo(ProcessCommand)
Outdated
Review

I actually didn't know you could add commands with spaces, nevermind whether that is even processed correctly or not. Is there any other plugin that does this?

I actually didn't know you could add commands with spaces, nevermind whether that is even processed correctly or not. Is there any other plugin that does this?
Outdated
Review

I saw this on the Doorbell plugin code. I was trying to find a way to include the help info in /xlplugins for it

The sample I saw to get that idea:
https://github.com/Aida-Enna/Doorbell/blob/main/Plugin.cs

I saw this on the Doorbell plugin code. I was trying to find a way to include the help info in /xlplugins for it The sample I saw to get that idea: https://github.com/Aida-Enna/Doorbell/blob/main/Plugin.cs
Outdated
Review

I changed it to how Limiana does it for lifestream instead just now

I changed it to how Limiana does it for lifestream instead just now
{
HelpMessage = "Opens influx statistics"
});
_timer = new Timer(TimeSpan.FromMinutes(1));
_timer.Elapsed += (_, _) => UpdateStatistics();
@ -74,6 +83,7 @@ internal sealed class InfluxPlugin : IDalamudPlugin
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
_pluginInterface.UiBuilder.OpenConfigUi += _configurationWindow.Toggle;
_pluginInterface.UiBuilder.OpenMainUi += _statisticsWindow.Toggle;
_condition.ConditionChange += UpdateOnLogout;
}
@ -220,6 +230,7 @@ internal sealed class InfluxPlugin : IDalamudPlugin
_timer.Dispose();
_windowSystem.RemoveAllWindows();
_commandManager.RemoveHandler("/influx");
_commandManager.RemoveHandler("/influx gil");
_influxStatisticsClient.Dispose();
_fcStatsCalculator.Dispose();
_localStatsCalculator.Dispose();

View File

@ -103,6 +103,12 @@ internal sealed class ConfigurationWindow : Window
if (!tabItem)
return;
var refIncludeAll = _configuration.AutoEnrollCharacters;
if (ImGui.Checkbox("Auto enroll characters", ref refIncludeAll))
{
_configuration.AutoEnrollCharacters = refIncludeAll;
Review

This is probably missing a Save(true); if I'm not mistaken.

This is probably missing a `Save(true);` if I'm not mistaken.
Review

Thanks!! Fixed and will repush in a sec

Thanks!! Fixed and will repush in a sec
}
if (_clientState is { IsLoggedIn: true, LocalContentId: > 0, LocalPlayer.HomeWorld.RowId: > 0 })
{
string worldName = _clientState.LocalPlayer.HomeWorld.Value.Name.ToString();
@ -134,6 +140,18 @@ internal sealed class ConfigurationWindow : Window
}
}
else
{
if (_configuration.AutoEnrollCharacters)
Outdated
Review

The way this is phrased should probably be running in a IClientState.Login event, and not only when you open the configuration AND this tab in the UI.

The way this is phrased should probably be running in a `IClientState.Login` event, and not only when you open the configuration AND this tab in the UI.
Outdated
Review

Thanks for the input, i made some modifications and will push in a minute

Thanks for the input, i made some modifications and will push in a minute
{
_configuration.IncludedCharacters.Add(new Configuration.CharacterInfo
{
LocalContentId = _clientState.LocalContentId,
CachedPlayerName = _clientState.LocalPlayer?.Name.ToString() ?? "??",
CachedWorldName = worldName,
});
Save();
}
else
{
ImGui.TextColored(ImGuiColors.DalamudRed,
"This character is currently excluded.");
@ -148,6 +166,7 @@ internal sealed class ConfigurationWindow : Window
Save();
}
}
}
ImGui.Unindent(30);
}