mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-13 12:14:18 +01:00
Maybe fix problem with Mare syncing wrong with Restricted Gear protection enabled.
This commit is contained in:
parent
ad577c7005
commit
2e9a30427d
3 changed files with 25 additions and 9 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Glamourer.Customization;
|
using Glamourer.Customization;
|
||||||
|
using Glamourer.Events;
|
||||||
using Glamourer.Interop;
|
using Glamourer.Interop;
|
||||||
using Glamourer.Interop.Penumbra;
|
using Glamourer.Interop.Penumbra;
|
||||||
using Glamourer.Interop.Structs;
|
using Glamourer.Interop.Structs;
|
||||||
|
|
@ -91,7 +92,7 @@ public class StateApplier
|
||||||
/// This uses the current customization of the model to potentially prevent restricted gear types from appearing.
|
/// This uses the current customization of the model to potentially prevent restricted gear types from appearing.
|
||||||
/// This never requires redrawing.
|
/// This never requires redrawing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ChangeArmor(ActorData data, EquipSlot slot, CharacterArmor armor, bool isHatVisible = true)
|
public void ChangeArmor(ActorData data, EquipSlot slot, CharacterArmor armor, bool checkRestrictions, bool isHatVisible = true)
|
||||||
{
|
{
|
||||||
if (slot is EquipSlot.Head && !isHatVisible)
|
if (slot is EquipSlot.Head && !isHatVisible)
|
||||||
return;
|
return;
|
||||||
|
|
@ -102,18 +103,26 @@ public class StateApplier
|
||||||
if (!mdl.IsHuman)
|
if (!mdl.IsHuman)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var customize = mdl.GetCustomize();
|
if (checkRestrictions)
|
||||||
var (_, resolvedItem) = _items.ResolveRestrictedGear(armor, slot, customize.Race, customize.Gender);
|
{
|
||||||
_updateSlot.UpdateSlot(actor.Model, slot, resolvedItem);
|
var customize = mdl.GetCustomize();
|
||||||
|
var (_, resolvedItem) = _items.ResolveRestrictedGear(armor, slot, customize.Race, customize.Gender);
|
||||||
|
_updateSlot.UpdateSlot(actor.Model, slot, resolvedItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_updateSlot.UpdateSlot(actor.Model, slot, armor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc cref="ChangeArmor(ActorData,EquipSlot,CharacterArmor,bool)"/>
|
/// <inheritdoc cref="ChangeArmor(ActorData,EquipSlot,CharacterArmor,bool,bool)"/>
|
||||||
public ActorData ChangeArmor(ActorState state, EquipSlot slot, bool apply)
|
public ActorData ChangeArmor(ActorState state, EquipSlot slot, bool apply)
|
||||||
{
|
{
|
||||||
|
// If the source is not IPC we do not want to apply restrictions.
|
||||||
var data = GetData(state);
|
var data = GetData(state);
|
||||||
if (apply)
|
if (apply)
|
||||||
ChangeArmor(data, slot, state.ModelData.Armor(slot), state.ModelData.IsHatVisible());
|
ChangeArmor(data, slot, state.ModelData.Armor(slot), state[slot, false] is not StateChanged.Source.Ipc, state.ModelData.IsHatVisible());
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -225,12 +225,19 @@ public class StateListener : IDisposable
|
||||||
if (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart)
|
if (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// If the model comes from IPC it is probably from Mare,
|
||||||
|
// then we do not want to use our restricted gear protection
|
||||||
|
// since we assume the player has that gear modded to availability.
|
||||||
|
var locked = false;
|
||||||
if (actor.Identifier(_actors.AwaitedService, out var identifier)
|
if (actor.Identifier(_actors.AwaitedService, out var identifier)
|
||||||
&& _manager.TryGetValue(identifier, out var state))
|
&& _manager.TryGetValue(identifier, out var state))
|
||||||
|
{
|
||||||
HandleEquipSlot(actor, state, slot, ref armor.Value);
|
HandleEquipSlot(actor, state, slot, ref armor.Value);
|
||||||
|
locked = state[slot, false] is StateChanged.Source.Ipc;
|
||||||
|
}
|
||||||
|
|
||||||
_funModule.ApplyFun(actor, ref armor.Value, slot);
|
_funModule.ApplyFun(actor, ref armor.Value, slot);
|
||||||
if (!_config.UseRestrictedGearProtection)
|
if (!_config.UseRestrictedGearProtection || locked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var customize = model.GetCustomize();
|
var customize = model.GetCustomize();
|
||||||
|
|
@ -263,7 +270,7 @@ public class StateListener : IDisposable
|
||||||
_applier.ChangeWeapon(objects, slot, currentItem, stain);
|
_applier.ChangeWeapon(objects, slot, currentItem, stain);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_applier.ChangeArmor(objects, slot, current.ToArmor(), state.ModelData.IsHatVisible());
|
_applier.ChangeArmor(objects, slot, current.ToArmor(), state[slot, false] is not StateChanged.Source.Ipc, state.ModelData.IsHatVisible());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
|
||||||
{
|
{
|
||||||
_applier.ChangeCustomize(actors, state.ModelData.Customize);
|
_applier.ChangeCustomize(actors, state.ModelData.Customize);
|
||||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||||
_applier.ChangeArmor(actors, slot, state.ModelData.Armor(slot), state.ModelData.IsHatVisible());
|
_applier.ChangeArmor(actors, slot, state.ModelData.Armor(slot), state[slot, false] is not StateChanged.Source.Ipc, state.ModelData.IsHatVisible());
|
||||||
var mainhandActors = state.ModelData.MainhandType != state.BaseData.MainhandType ? actors.OnlyGPose() : actors;
|
var mainhandActors = state.ModelData.MainhandType != state.BaseData.MainhandType ? actors.OnlyGPose() : actors;
|
||||||
_applier.ChangeMainhand(mainhandActors, state.ModelData.Item(EquipSlot.MainHand), state.ModelData.Stain(EquipSlot.MainHand));
|
_applier.ChangeMainhand(mainhandActors, state.ModelData.Item(EquipSlot.MainHand), state.ModelData.Stain(EquipSlot.MainHand));
|
||||||
var offhandActors = state.ModelData.OffhandType != state.BaseData.OffhandType ? actors.OnlyGPose() : actors;
|
var offhandActors = state.ModelData.OffhandType != state.BaseData.OffhandType ? actors.OnlyGPose() : actors;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue