Fix invalid condition for "limit to my creatures", a bit of additional logging

This commit is contained in:
RisaDev
2024-06-13 23:01:28 +03:00
parent 2fdf223683
commit 49b220ac2d
2 changed files with 8 additions and 5 deletions

View File

@@ -95,7 +95,7 @@ public class ProfileManager : IDisposable
public void LoadProfiles() public void LoadProfiles()
{ {
_logger.Information("Loading profiles from directory..."); _logger.Information("Loading profiles...");
//todo: hot reload was not tested //todo: hot reload was not tested
//save temp profiles //save temp profiles
@@ -105,6 +105,8 @@ public class ProfileManager : IDisposable
List<(Profile, string)> invalidNames = new(); List<(Profile, string)> invalidNames = new();
foreach (var file in _saveService.FileNames.Profiles()) foreach (var file in _saveService.FileNames.Profiles())
{ {
_logger.Debug($"Reading profile {file.FullName}");
try try
{ {
var text = File.ReadAllText(file.FullName); var text = File.ReadAllText(file.FullName);
@@ -146,7 +148,7 @@ public class ProfileManager : IDisposable
_logger.Information( _logger.Information(
$"Moved {invalidNames.Count - failed} profiles to correct names.{(failed > 0 ? $" Failed to move {failed} profiles to correct names." : string.Empty)}"); $"Moved {invalidNames.Count - failed} profiles to correct names.{(failed > 0 ? $" Failed to move {failed} profiles to correct names." : string.Empty)}");
_logger.Information("Directory load complete"); _logger.Information("Profiles load complete");
_event.Invoke(ProfileChanged.Type.ReloadedAll, null, null); _event.Invoke(ProfileChanged.Type.ReloadedAll, null, null);
} }
@@ -506,7 +508,7 @@ public class ProfileManager : IDisposable
return profile.CharacterName.Text == name && return profile.CharacterName.Text == name &&
(!profile.LimitLookupToOwnedObjects || (!profile.LimitLookupToOwnedObjects ||
(actorIdentifier.Type == IdentifierType.Owned && (actorIdentifier.Type == IdentifierType.Owned &&
actorIdentifier.PlayerName != _actorManager.GetCurrentPlayer().PlayerName)); actorIdentifier.PlayerName == _actorManager.GetCurrentPlayer().PlayerName));
} }
if (_templateEditorManager.IsEditorActive && _templateEditorManager.EditorProfile.Enabled && IsProfileAppliesToCurrentActor(_templateEditorManager.EditorProfile)) if (_templateEditorManager.IsEditorActive && _templateEditorManager.EditorProfile.Enabled && IsProfileAppliesToCurrentActor(_templateEditorManager.EditorProfile))

View File

@@ -45,12 +45,13 @@ public class TemplateManager
public void LoadTemplates() public void LoadTemplates()
{ {
_logger.Information("Loading templates from directory..."); _logger.Information("Loading templates...");
_templates.Clear(); _templates.Clear();
List<(Template, string)> invalidNames = new(); List<(Template, string)> invalidNames = new();
foreach (var file in _saveService.FileNames.Templates()) foreach (var file in _saveService.FileNames.Templates())
{ {
_logger.Debug($"Reading template {file.FullName}");
try try
{ {
var text = File.ReadAllText(file.FullName); var text = File.ReadAllText(file.FullName);
@@ -77,7 +78,7 @@ public class TemplateManager
_logger.Information( _logger.Information(
$"Moved {invalidNames.Count - failed} templates to correct names.{(failed > 0 ? $" Failed to move {failed} templates to correct names." : string.Empty)}"); $"Moved {invalidNames.Count - failed} templates to correct names.{(failed > 0 ? $" Failed to move {failed} templates to correct names." : string.Empty)}");
_logger.Information("Directory load complete"); _logger.Information("Templates load complete");
_event.Invoke(TemplateChanged.Type.ReloadedAll, null, null); _event.Invoke(TemplateChanged.Type.ReloadedAll, null, null);
} }