Skip to content

Commit

Permalink
Maybe fix another issue with monk offhands.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ottermandias committed Jul 26, 2024
1 parent 60302c3 commit ff96e51
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Glamourer/State/StateListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ public class StateListener : IDisposable
private readonly CrestService _crestService;
private readonly ICondition _condition;

private readonly Dictionary<Actor, CharacterWeapon> _fistOffhands = [];

private ActorIdentifier _creatingIdentifier = ActorIdentifier.Invalid;
private ActorState? _creatingState;
private ActorState? _customizeState;
private CharacterWeapon _lastFistOffhand = CharacterWeapon.Empty;

public StateListener(StateManager manager, ItemManager items, PenumbraService penumbra, ActorManager actors, Configuration config,
EquipSlotUpdating equipSlotUpdating, WeaponLoading weaponLoading, VisorStateChanged visorState,
Expand Down Expand Up @@ -321,11 +322,13 @@ private void OnWeaponLoading(Actor actor, EquipSlot slot, ref CharacterWeapon we
return;

// Fist weapon gauntlet hack.
if (slot is EquipSlot.OffHand && weapon.Variant == 0 && weapon.Weapon.Id != 0 && _lastFistOffhand.Weapon.Id != 0)
if (slot is EquipSlot.OffHand
&& weapon.Variant == 0
&& weapon.Weapon.Id != 0
&& _fistOffhands.TryGetValue(actor, out var lastFistOffhand))
{
Glamourer.Log.Excessive($"Applying stored fist weapon offhand {_lastFistOffhand}.");
weapon = _lastFistOffhand;
_lastFistOffhand = CharacterWeapon.Empty;
Glamourer.Log.Information($"Applying stored fist weapon offhand {lastFistOffhand} for 0x{actor.Address:X}.");
weapon = lastFistOffhand;
}

if (!actor.Identifier(_actors, out var identifier)
Expand Down Expand Up @@ -377,9 +380,10 @@ private void OnWeaponLoading(Actor actor, EquipSlot slot, ref CharacterWeapon we
// Fist Weapon Offhand hack.
if (slot is EquipSlot.MainHand && weapon.Skeleton.Id is > 1600 and < 1651)
{
_lastFistOffhand = new CharacterWeapon((PrimaryId)(weapon.Skeleton.Id + 50), weapon.Weapon, weapon.Variant,
lastFistOffhand = new CharacterWeapon((PrimaryId)(weapon.Skeleton.Id + 50), weapon.Weapon, weapon.Variant,
weapon.Stains);
Glamourer.Log.Excessive($"Storing fist weapon offhand {_lastFistOffhand}.");
_fistOffhands[actor] = lastFistOffhand;
Glamourer.Log.Excessive($"Storing fist weapon offhand {lastFistOffhand} for 0x{actor.Address:X}.");
}

_funModule.ApplyFunToWeapon(actor, ref weapon, slot);
Expand Down

0 comments on commit ff96e51

Please sign in to comment.