mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Add option to skip or partially apply invalid automatic design customizations.
This commit is contained in:
parent
f8f90124ee
commit
279a5d6923
3 changed files with 19 additions and 14 deletions
|
|
@ -102,7 +102,7 @@ public class AutoDesignApplier : IDisposable
|
||||||
if (!GetPlayerSet(id, out var set))
|
if (!GetPlayerSet(id, out var set))
|
||||||
{
|
{
|
||||||
if (_state.TryGetValue(id, out var s))
|
if (_state.TryGetValue(id, out var s))
|
||||||
s.LastJob = (byte) newJob.Id;
|
s.LastJob = (byte)newJob.Id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,23 +143,14 @@ public class AutoDesignApplier : IDisposable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (!GetPlayerSet(identifier, out set!))
|
else if (!GetPlayerSet(identifier, out set!))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Reduce(actor, state, set, true);
|
Reduce(actor, state, set, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reduce(Actor actor, ActorIdentifier identifier, ActorState state)
|
|
||||||
{
|
|
||||||
if (!_config.EnableAutoDesigns)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!GetPlayerSet(identifier, out var set))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Reduce(actor, state, set, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private unsafe void Reduce(Actor actor, ActorState state, AutoDesignSet set, bool respectManual)
|
private unsafe void Reduce(Actor actor, ActorState state, AutoDesignSet set, bool respectManual)
|
||||||
{
|
{
|
||||||
EquipFlag totalEquipFlags = 0;
|
EquipFlag totalEquipFlags = 0;
|
||||||
|
|
@ -273,6 +264,15 @@ public class AutoDesignApplier : IDisposable
|
||||||
|
|
||||||
var customize = state.ModelData.Customize;
|
var customize = state.ModelData.Customize;
|
||||||
CustomizeFlag fixFlags = 0;
|
CustomizeFlag fixFlags = 0;
|
||||||
|
|
||||||
|
// Skip invalid designs entirely.
|
||||||
|
if (_config.SkipInvalidCustomizations
|
||||||
|
&& !_code.EnabledMesmer
|
||||||
|
&& (customize.Clan != design.Customize.Clan
|
||||||
|
|| customize.Gender != design.Customize.Gender
|
||||||
|
|| customize.Face != design.Customize.Face))
|
||||||
|
return;
|
||||||
|
|
||||||
if (customizeFlags.HasFlag(CustomizeFlag.Clan))
|
if (customizeFlags.HasFlag(CustomizeFlag.Clan))
|
||||||
{
|
{
|
||||||
if (!respectManual || state[CustomizeIndex.Clan] is not StateChanged.Source.Manual)
|
if (!respectManual || state[CustomizeIndex.Clan] is not StateChanged.Source.Manual)
|
||||||
|
|
@ -283,6 +283,9 @@ public class AutoDesignApplier : IDisposable
|
||||||
|
|
||||||
if (customizeFlags.HasFlag(CustomizeFlag.Gender))
|
if (customizeFlags.HasFlag(CustomizeFlag.Gender))
|
||||||
{
|
{
|
||||||
|
if (_config.SkipInvalidCustomizations && customize.Gender != design.Customize.Gender)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!respectManual || state[CustomizeIndex.Gender] is not StateChanged.Source.Manual)
|
if (!respectManual || state[CustomizeIndex.Gender] is not StateChanged.Source.Manual)
|
||||||
fixFlags |= _customizations.ChangeGender(ref customize, design.Customize.Gender);
|
fixFlags |= _customizations.ChangeGender(ref customize, design.Customize.Gender);
|
||||||
customizeFlags &= ~CustomizeFlag.Gender;
|
customizeFlags &= ~CustomizeFlag.Gender;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ public class Configuration : IPluginConfiguration, ISavable
|
||||||
public bool EnableAutoDesigns { get; set; } = true;
|
public bool EnableAutoDesigns { get; set; } = true;
|
||||||
public bool IncognitoMode { get; set; } = false;
|
public bool IncognitoMode { get; set; } = false;
|
||||||
public bool UnlockDetailMode { get; set; } = true;
|
public bool UnlockDetailMode { get; set; } = true;
|
||||||
|
public bool SkipInvalidCustomizations { get; set; } = false;
|
||||||
public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings;
|
public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings;
|
||||||
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,9 @@ public class SettingsTab : ITab
|
||||||
Checkbox("Enabled", "Enable main functionality of keeping and applying state.", _stateListener.Enabled, _stateListener.Enable);
|
Checkbox("Enabled", "Enable main functionality of keeping and applying state.", _stateListener.Enabled, _stateListener.Enable);
|
||||||
Checkbox("Enable Auto Designs", "Enable the application of designs associated to characters to be applied automatically.",
|
Checkbox("Enable Auto Designs", "Enable the application of designs associated to characters to be applied automatically.",
|
||||||
_config.EnableAutoDesigns, v => _config.EnableAutoDesigns = v);
|
_config.EnableAutoDesigns, v => _config.EnableAutoDesigns = v);
|
||||||
|
Checkbox("Skip Invalid Customizations",
|
||||||
|
"Entirely skip customizations for any automatically applied design that does not have the same race, gender or face as the affected character currently has.",
|
||||||
|
_config.SkipInvalidCustomizations, v => _config.SkipInvalidCustomizations = v);
|
||||||
Checkbox("Restricted Gear Protection",
|
Checkbox("Restricted Gear Protection",
|
||||||
"Use gender- and race-appropriate models when detecting certain items not available for a characters current gender and race.",
|
"Use gender- and race-appropriate models when detecting certain items not available for a characters current gender and race.",
|
||||||
_config.UseRestrictedGearProtection, v => _config.UseRestrictedGearProtection = v);
|
_config.UseRestrictedGearProtection, v => _config.UseRestrictedGearProtection = v);
|
||||||
|
|
@ -78,10 +81,8 @@ public class SettingsTab : ITab
|
||||||
var color = _codeService.CheckCode(_currentCode) != null ? ColorId.ActorAvailable : ColorId.ActorUnavailable;
|
var color = _codeService.CheckCode(_currentCode) != null ? ColorId.ActorAvailable : ColorId.ActorUnavailable;
|
||||||
using var c = ImRaii.PushColor(ImGuiCol.Border, color.Value(), _currentCode.Length > 0);
|
using var c = ImRaii.PushColor(ImGuiCol.Border, color.Value(), _currentCode.Length > 0);
|
||||||
if (ImGui.InputTextWithHint("##Code", "Enter Code...", ref _currentCode, 512, ImGuiInputTextFlags.EnterReturnsTrue))
|
if (ImGui.InputTextWithHint("##Code", "Enter Code...", ref _currentCode, 512, ImGuiInputTextFlags.EnterReturnsTrue))
|
||||||
{
|
|
||||||
if (_codeService.AddCode(_currentCode))
|
if (_codeService.AddCode(_currentCode))
|
||||||
_currentCode = string.Empty;
|
_currentCode = string.Empty;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_config.Codes.Count <= 0)
|
if (_config.Codes.Count <= 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue