Fix some cases of Glamourer not respecting the Apply Fixed Designs setting.

This commit is contained in:
Ottermandias 2021-10-12 10:16:29 +02:00
parent 131844e54f
commit f21d430811
2 changed files with 13 additions and 6 deletions

View file

@ -6,6 +6,7 @@ using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Logging; using Dalamud.Logging;
using Glamourer.FileSystem; using Glamourer.FileSystem;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.PlayerWatch;
namespace Glamourer.Designs namespace Glamourer.Designs
{ {
@ -57,9 +58,15 @@ namespace Glamourer.Designs
} }
design.Enabled = true; design.Enabled = true;
if (Dalamud.Objects.FirstOrDefault(o => o.ObjectKind == ObjectKind.Player && o.Name.ToString() == design.Name) if (Glamourer.Config.ApplyFixedDesigns)
is Character character) {
OnPlayerChange(character); var character =
CharacterFactory.Convert(Dalamud.Objects.FirstOrDefault(o
=> o.ObjectKind == ObjectKind.Player && o.Name.ToString() == design.Name));
if (character != null)
OnPlayerChange(character);
}
return changes; return changes;
} }

View file

@ -41,10 +41,10 @@ namespace Glamourer
Designs = new DesignManager(); Designs = new DesignManager();
Penumbra = new PenumbraAttach(Config.AttachToPenumbra); Penumbra = new PenumbraAttach(Config.AttachToPenumbra);
PlayerWatcher = PlayerWatchFactory.Create(Dalamud.Framework, Dalamud.ClientState, Dalamud.Objects); PlayerWatcher = PlayerWatchFactory.Create(Dalamud.Framework, Dalamud.ClientState, Dalamud.Objects);
FixedDesigns = new FixedDesigns(Designs); if (!Config.ApplyFixedDesigns)
PlayerWatcher.Disable();
if (Config.ApplyFixedDesigns) FixedDesigns = new FixedDesigns(Designs);
PlayerWatcher.Enable();
Dalamud.Commands.AddHandler("/glamourer", new CommandInfo(OnGlamourer) Dalamud.Commands.AddHandler("/glamourer", new CommandInfo(OnGlamourer)
{ {