Added auto enroll feature #1
@ -85,6 +85,8 @@ internal sealed class InfluxPlugin : IDalamudPlugin
|
||||
_pluginInterface.UiBuilder.OpenConfigUi += _configurationWindow.Toggle;
|
||||
_pluginInterface.UiBuilder.OpenMainUi += _statisticsWindow.Toggle;
|
||||
_condition.ConditionChange += UpdateOnLogout;
|
||||
_clientState.Login += AutoEnrollCharacter;
|
||||
|
||||
}
|
||||
|
||||
private Configuration LoadConfig()
|
||||
@ -204,6 +206,22 @@ internal sealed class InfluxPlugin : IDalamudPlugin
|
||||
return allSubs;
|
||||
}
|
||||
|
||||
|
||||
private void AutoEnrollCharacter()
|
||||
{
|
||||
if (_configuration.AutoEnrollCharacters)
|
||||
{
|
||||
_configuration.IncludedCharacters.Add(new Configuration.CharacterInfo
|
||||
{
|
||||
LocalContentId = _clientState.LocalContentId,
|
||||
CachedPlayerName = _clientState.LocalPlayer?.Name.ToString() ?? "??",
|
||||
CachedWorldName = _clientState.LocalPlayer?.HomeWorld.Value.Name.ToString(),
|
||||
});
|
||||
_pluginInterface.SavePluginConfig(_configuration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void UpdateOnLogout(ConditionFlag flag, bool value)
|
||||
{
|
||||
if (flag == ConditionFlag.LoggingOut && value)
|
||||
|
@ -243,6 +243,8 @@ internal sealed class LocalStatsCalculator : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private unsafe List<short> ExtractClassJobLevels(PlayerState* playerState)
|
||||
{
|
||||
List<short> levels = new();
|
||||
|
@ -104,9 +104,10 @@ internal sealed class ConfigurationWindow : Window
|
||||
return;
|
||||
|
||||
var refIncludeAll = _configuration.AutoEnrollCharacters;
|
||||
if (ImGui.Checkbox("Auto enroll characters", ref refIncludeAll))
|
||||
if (ImGui.Checkbox("Auto enroll characters on login", ref refIncludeAll))
|
||||
{
|
||||
_configuration.AutoEnrollCharacters = refIncludeAll;
|
||||
|
||||
Save(true);
|
||||
}
|
||||
|
||||
if (_clientState is { IsLoggedIn: true, LocalContentId: > 0, LocalPlayer.HomeWorld.RowId: > 0 })
|
||||
@ -141,7 +142,9 @@ internal sealed class ConfigurationWindow : Window
|
||||
}
|
||||
else
|
||||
{
|
||||
liza
commented
The way this is phrased should probably be running in a 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.
Asuna
commented
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
|
||||
if (_configuration.AutoEnrollCharacters)
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed,
|
||||
"This character is currently excluded.");
|
||||
if (ImGui.Button("Include current character"))
|
||||
{
|
||||
_configuration.IncludedCharacters.Add(new Configuration.CharacterInfo
|
||||
{
|
||||
@ -151,21 +154,6 @@ internal sealed class ConfigurationWindow : Window
|
||||
});
|
||||
Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed,
|
||||
"This character is currently excluded.");
|
||||
if (ImGui.Button("Include current character"))
|
||||
{
|
||||
_configuration.IncludedCharacters.Add(new Configuration.CharacterInfo
|
||||
{
|
||||
LocalContentId = _clientState.LocalContentId,
|
||||
CachedPlayerName = _clientState.LocalPlayer?.Name.ToString() ?? "??",
|
||||
CachedWorldName = worldName,
|
||||
});
|
||||
Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Unindent(30);
|
||||
|
Loading…
Reference in New Issue
Block a user
This is probably missing a
Save(true);
if I'm not mistaken.Thanks!! Fixed and will repush in a sec