mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Implements true endpoints for all glamourer operations, also correctly marks reverts and gearsets. Replaced back excessive logging to maintain with logging formats expected by glamourer.
This commit is contained in:
parent
c605d19510
commit
e1a41b5f3c
21 changed files with 225 additions and 99 deletions
|
|
@ -14,6 +14,7 @@ using Penumbra.GameData.DataContainers;
|
|||
using Glamourer.Designs;
|
||||
using Penumbra.GameData.Interop;
|
||||
using ObjectManager = Glamourer.Interop.ObjectManager;
|
||||
using Glamourer.Api.Enums;
|
||||
|
||||
namespace Glamourer.State;
|
||||
|
||||
|
|
@ -34,10 +35,12 @@ public class StateListener : IDisposable
|
|||
private readonly PenumbraService _penumbra;
|
||||
private readonly EquipSlotUpdating _equipSlotUpdating;
|
||||
private readonly BonusSlotUpdating _bonusSlotUpdating;
|
||||
private readonly GearsetDataLoaded _gearsetDataLoaded;
|
||||
private readonly WeaponLoading _weaponLoading;
|
||||
private readonly HeadGearVisibilityChanged _headGearVisibility;
|
||||
private readonly VisorStateChanged _visorState;
|
||||
private readonly WeaponVisibilityChanged _weaponVisibility;
|
||||
private readonly StateUpdated _stateUpdated;
|
||||
private readonly AutoDesignApplier _autoDesignApplier;
|
||||
private readonly FunModule _funModule;
|
||||
private readonly HumanModelList _humans;
|
||||
|
|
@ -54,11 +57,11 @@ public class StateListener : IDisposable
|
|||
private ActorState? _customizeState;
|
||||
|
||||
public StateListener(StateManager manager, ItemManager items, PenumbraService penumbra, ActorManager actors, Configuration config,
|
||||
EquipSlotUpdating equipSlotUpdating, WeaponLoading weaponLoading, VisorStateChanged visorState,
|
||||
EquipSlotUpdating equipSlotUpdating, GearsetDataLoaded gearsetDataLoaded, WeaponLoading weaponLoading, VisorStateChanged visorState,
|
||||
WeaponVisibilityChanged weaponVisibility, HeadGearVisibilityChanged headGearVisibility, AutoDesignApplier autoDesignApplier,
|
||||
FunModule funModule, HumanModelList humans, StateApplier applier, MovedEquipment movedEquipment, ObjectManager objects,
|
||||
GPoseService gPose, ChangeCustomizeService changeCustomizeService, CustomizeService customizations, ICondition condition,
|
||||
CrestService crestService, BonusSlotUpdating bonusSlotUpdating)
|
||||
CrestService crestService, BonusSlotUpdating bonusSlotUpdating, StateUpdated stateUpdated)
|
||||
{
|
||||
_manager = manager;
|
||||
_items = items;
|
||||
|
|
@ -66,6 +69,7 @@ public class StateListener : IDisposable
|
|||
_actors = actors;
|
||||
_config = config;
|
||||
_equipSlotUpdating = equipSlotUpdating;
|
||||
_gearsetDataLoaded = gearsetDataLoaded;
|
||||
_weaponLoading = weaponLoading;
|
||||
_visorState = visorState;
|
||||
_weaponVisibility = weaponVisibility;
|
||||
|
|
@ -82,6 +86,7 @@ public class StateListener : IDisposable
|
|||
_condition = condition;
|
||||
_crestService = crestService;
|
||||
_bonusSlotUpdating = bonusSlotUpdating;
|
||||
_stateUpdated = stateUpdated;
|
||||
Subscribe();
|
||||
}
|
||||
|
||||
|
|
@ -259,6 +264,22 @@ public class StateListener : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
private void OnGearsetDataLoaded(Model model)
|
||||
{
|
||||
var actor = _penumbra.GameObjectFromDrawObject(model);
|
||||
if (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart)
|
||||
return;
|
||||
|
||||
// ensure actor and state are valid.
|
||||
if (!actor.Identifier(_actors, out var identifier))
|
||||
return;
|
||||
|
||||
_objects.Update();
|
||||
if (_objects.TryGetValue(identifier, out var actors) && actors.Valid)
|
||||
_stateUpdated.Invoke(StateUpdateType.Gearset, actors);
|
||||
}
|
||||
|
||||
|
||||
private void OnMovedEquipment((EquipSlot, uint, StainIds)[] items)
|
||||
{
|
||||
_objects.Update();
|
||||
|
|
@ -382,7 +403,7 @@ public class StateListener : IDisposable
|
|||
lastFistOffhand = new CharacterWeapon((PrimaryId)(weapon.Skeleton.Id + 50), weapon.Weapon, weapon.Variant,
|
||||
weapon.Stains);
|
||||
_fistOffhands[actor] = lastFistOffhand;
|
||||
Glamourer.Log.Verbose($"Storing fist weapon offhand {lastFistOffhand} for 0x{actor.Address:X}.");
|
||||
Glamourer.Log.Excessive($"Storing fist weapon offhand {lastFistOffhand} for 0x{actor.Address:X}.");
|
||||
}
|
||||
|
||||
_funModule.ApplyFunToWeapon(actor, ref weapon, slot);
|
||||
|
|
@ -765,6 +786,7 @@ public class StateListener : IDisposable
|
|||
_penumbra.CreatedCharacterBase += OnCreatedCharacterBase;
|
||||
_equipSlotUpdating.Subscribe(OnEquipSlotUpdating, EquipSlotUpdating.Priority.StateListener);
|
||||
_bonusSlotUpdating.Subscribe(OnBonusSlotUpdating, BonusSlotUpdating.Priority.StateListener);
|
||||
_gearsetDataLoaded.Subscribe(OnGearsetDataLoaded, GearsetDataLoaded.Priority.StateListener);
|
||||
_movedEquipment.Subscribe(OnMovedEquipment, MovedEquipment.Priority.StateListener);
|
||||
_weaponLoading.Subscribe(OnWeaponLoading, WeaponLoading.Priority.StateListener);
|
||||
_visorState.Subscribe(OnVisorChange, VisorStateChanged.Priority.StateListener);
|
||||
|
|
@ -782,6 +804,7 @@ public class StateListener : IDisposable
|
|||
_penumbra.CreatedCharacterBase -= OnCreatedCharacterBase;
|
||||
_equipSlotUpdating.Unsubscribe(OnEquipSlotUpdating);
|
||||
_bonusSlotUpdating.Unsubscribe(OnBonusSlotUpdating);
|
||||
_gearsetDataLoaded.Unsubscribe(OnGearsetDataLoaded);
|
||||
_movedEquipment.Unsubscribe(OnMovedEquipment);
|
||||
_weaponLoading.Unsubscribe(OnWeaponLoading);
|
||||
_visorState.Unsubscribe(OnVisorChange);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue