forked from liza/Influx
Modified how it auto enrolls to use the IClientState.Login event instead.
Changed the wording of the option itself Fixed a bug where it wouldn't save to the config that you had auto enroll enabled.
This commit is contained in:
parent
ade0ed4754
commit
2f10811afe
@ -85,6 +85,8 @@ internal sealed class InfluxPlugin : IDalamudPlugin
|
|||||||
_pluginInterface.UiBuilder.OpenConfigUi += _configurationWindow.Toggle;
|
_pluginInterface.UiBuilder.OpenConfigUi += _configurationWindow.Toggle;
|
||||||
_pluginInterface.UiBuilder.OpenMainUi += _statisticsWindow.Toggle;
|
_pluginInterface.UiBuilder.OpenMainUi += _statisticsWindow.Toggle;
|
||||||
_condition.ConditionChange += UpdateOnLogout;
|
_condition.ConditionChange += UpdateOnLogout;
|
||||||
|
_clientState.Login += AutoEnrollCharacter;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Configuration LoadConfig()
|
private Configuration LoadConfig()
|
||||||
@ -204,6 +206,22 @@ internal sealed class InfluxPlugin : IDalamudPlugin
|
|||||||
return allSubs;
|
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)
|
private void UpdateOnLogout(ConditionFlag flag, bool value)
|
||||||
{
|
{
|
||||||
if (flag == ConditionFlag.LoggingOut && value)
|
if (flag == ConditionFlag.LoggingOut && value)
|
||||||
|
@ -243,6 +243,8 @@ internal sealed class LocalStatsCalculator : IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private unsafe List<short> ExtractClassJobLevels(PlayerState* playerState)
|
private unsafe List<short> ExtractClassJobLevels(PlayerState* playerState)
|
||||||
{
|
{
|
||||||
List<short> levels = new();
|
List<short> levels = new();
|
||||||
|
@ -104,9 +104,10 @@ internal sealed class ConfigurationWindow : Window
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var refIncludeAll = _configuration.AutoEnrollCharacters;
|
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;
|
_configuration.AutoEnrollCharacters = refIncludeAll;
|
||||||
|
Save(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_clientState is { IsLoggedIn: true, LocalContentId: > 0, LocalPlayer.HomeWorld.RowId: > 0 })
|
if (_clientState is { IsLoggedIn: true, LocalContentId: > 0, LocalPlayer.HomeWorld.RowId: > 0 })
|
||||||
@ -141,7 +142,9 @@ internal sealed class ConfigurationWindow : Window
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_configuration.AutoEnrollCharacters)
|
ImGui.TextColored(ImGuiColors.DalamudRed,
|
||||||
|
"This character is currently excluded.");
|
||||||
|
if (ImGui.Button("Include current character"))
|
||||||
{
|
{
|
||||||
_configuration.IncludedCharacters.Add(new Configuration.CharacterInfo
|
_configuration.IncludedCharacters.Add(new Configuration.CharacterInfo
|
||||||
{
|
{
|
||||||
@ -151,21 +154,6 @@ internal sealed class ConfigurationWindow : Window
|
|||||||
});
|
});
|
||||||
Save();
|
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);
|
ImGui.Unindent(30);
|
||||||
|
Loading…
Reference in New Issue
Block a user