Skip to content

Commit

Permalink
Fix invalid condition for "limit to my creatures", a bit of additiona…
Browse files Browse the repository at this point in the history
…l logging
  • Loading branch information
RisaDev committed Jun 13, 2024
1 parent 2fdf223 commit 49b220a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions CustomizePlus/Profiles/ProfileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void Dispose()

public void LoadProfiles()
{
_logger.Information("Loading profiles from directory...");
_logger.Information("Loading profiles...");

//todo: hot reload was not tested
//save temp profiles
Expand All @@ -105,6 +105,8 @@ public void LoadProfiles()
List<(Profile, string)> invalidNames = new();
foreach (var file in _saveService.FileNames.Profiles())
{
_logger.Debug($"Reading profile {file.FullName}");

try
{
var text = File.ReadAllText(file.FullName);
Expand Down Expand Up @@ -146,7 +148,7 @@ public void LoadProfiles()
_logger.Information(
$"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);
}

Expand Down Expand Up @@ -506,7 +508,7 @@ bool IsProfileAppliesToCurrentActor(Profile profile)
return profile.CharacterName.Text == name &&
(!profile.LimitLookupToOwnedObjects ||
(actorIdentifier.Type == IdentifierType.Owned &&
actorIdentifier.PlayerName != _actorManager.GetCurrentPlayer().PlayerName));
actorIdentifier.PlayerName == _actorManager.GetCurrentPlayer().PlayerName));
}

if (_templateEditorManager.IsEditorActive && _templateEditorManager.EditorProfile.Enabled && IsProfileAppliesToCurrentActor(_templateEditorManager.EditorProfile))
Expand Down
5 changes: 3 additions & 2 deletions CustomizePlus/Templates/TemplateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ public TemplateManager(

public void LoadTemplates()
{
_logger.Information("Loading templates from directory...");
_logger.Information("Loading templates...");

_templates.Clear();
List<(Template, string)> invalidNames = new();
foreach (var file in _saveService.FileNames.Templates())
{
_logger.Debug($"Reading template {file.FullName}");
try
{
var text = File.ReadAllText(file.FullName);
Expand All @@ -77,7 +78,7 @@ public void LoadTemplates()
_logger.Information(
$"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);
}

Expand Down

0 comments on commit 49b220a

Please sign in to comment.