Update for new ActorObjectManager.

This commit is contained in:
Ottermandias 2025-04-05 18:48:39 +02:00
parent 8fe0ac8195
commit c0ad4aab51
38 changed files with 273 additions and 578 deletions

View file

@ -11,7 +11,6 @@ using Penumbra.GameData.Enums;
using Penumbra.GameData.Interop;
using Penumbra.GameData.Structs;
using CustomizeIndex = Penumbra.GameData.Enums.CustomizeIndex;
using ObjectManager = Glamourer.Interop.ObjectManager;
namespace Glamourer.State;
@ -35,7 +34,7 @@ public unsafe class FunModule : IDisposable
private readonly StateManager _stateManager;
private readonly DesignConverter _designConverter;
private readonly DesignManager _designManager;
private readonly ObjectManager _objects;
private readonly ActorObjectManager _objects;
private readonly NpcCustomizeSet _npcs;
private readonly StainId[] _stains;
@ -69,7 +68,7 @@ public unsafe class FunModule : IDisposable
=> OnDayChange(DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year);
public FunModule(CodeService codes, CustomizeService customizations, ItemManager items, Configuration config,
GenericPopupWindow popupWindow, StateManager stateManager, ObjectManager objects, DesignConverter designConverter,
GenericPopupWindow popupWindow, StateManager stateManager, ActorObjectManager objects, DesignConverter designConverter,
DesignManager designManager, NpcCustomizeSet npcs)
{
_codes = codes;
@ -125,9 +124,7 @@ public unsafe class FunModule : IDisposable
switch (_codes.Masked(CodeService.GearCodes))
{
case CodeService.CodeFlag.Emperor:
SetRandomItem(slot, ref armor);
break;
case CodeService.CodeFlag.Emperor: SetRandomItem(slot, ref armor); break;
case CodeService.CodeFlag.Elephants:
case CodeService.CodeFlag.Dolphins:
case CodeService.CodeFlag.World when actor.Index != 0:
@ -137,9 +134,7 @@ public unsafe class FunModule : IDisposable
switch (_codes.Masked(CodeService.DyeCodes))
{
case CodeService.CodeFlag.Clown:
SetRandomDye(ref armor);
break;
case CodeService.CodeFlag.Clown: SetRandomDye(ref armor); break;
}
}
@ -306,9 +301,7 @@ public unsafe class FunModule : IDisposable
SetDolphin(EquipSlot.Body, ref armor[1]);
SetDolphin(EquipSlot.Head, ref armor[0]);
break;
case CodeService.CodeFlag.World when actor.Index != 0:
_worldSets.Apply(actor, _rng, armor);
break;
case CodeService.CodeFlag.World when actor.Index != 0: _worldSets.Apply(actor, _rng, armor); break;
}
switch (_codes.Masked(CodeService.DyeCodes))
@ -368,17 +361,17 @@ public unsafe class FunModule : IDisposable
private static IReadOnlyList<CharacterArmor> DolphinBodies
=>
[
new CharacterArmor(6089, 1, new StainIds(4)), // Toad
new CharacterArmor(6089, 1, new StainIds(4)), // Toad
new CharacterArmor(6089, 1, new StainIds(4)), // Toad
new CharacterArmor(6023, 1, new StainIds(4)), // Swine
new CharacterArmor(6023, 1, new StainIds(4)), // Swine
new CharacterArmor(6023, 1, new StainIds(4)), // Swine
new CharacterArmor(6133, 1, new StainIds(4)), // Gaja
new CharacterArmor(6182, 1, new StainIds(3)), // Imp
new CharacterArmor(6182, 1, new StainIds(3)), // Imp
new CharacterArmor(6182, 1, new StainIds(4)), // Imp
new CharacterArmor(6182, 1, new StainIds(4)), // Imp
new(6089, 1, new StainIds(4)), // Toad
new(6089, 1, new StainIds(4)), // Toad
new(6089, 1, new StainIds(4)), // Toad
new(6023, 1, new StainIds(4)), // Swine
new(6023, 1, new StainIds(4)), // Swine
new(6023, 1, new StainIds(4)), // Swine
new(6133, 1, new StainIds(4)), // Gaja
new(6182, 1, new StainIds(3)), // Imp
new(6182, 1, new StainIds(3)), // Imp
new(6182, 1, new StainIds(4)), // Imp
new(6182, 1, new StainIds(4)), // Imp
];
private void SetDolphin(EquipSlot slot, ref CharacterArmor armor)

View file

@ -7,6 +7,7 @@ using Glamourer.Interop.Structs;
using Glamourer.Services;
using Penumbra.Api.Enums;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Interop;
using Penumbra.GameData.Structs;
namespace Glamourer.State;
@ -23,7 +24,7 @@ public class StateApplier(
ItemManager _items,
PenumbraService _penumbra,
MetaService _metaService,
ObjectManager _objects,
ActorObjectManager _objects,
CrestService _crests,
DirectXService _directX)
{
@ -411,8 +412,5 @@ public class StateApplier(
}
private ActorData GetData(ActorState state)
{
_objects.Update();
return _objects.TryGetValue(state.Identifier, out var data) ? data : ActorData.Invalid;
}
=> _objects.TryGetValue(state.Identifier, out var data) ? data : ActorData.Invalid;
}

View file

@ -9,6 +9,7 @@ using Glamourer.Interop.Penumbra;
using Glamourer.Interop.Structs;
using Glamourer.Services;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Interop;
using Penumbra.GameData.Structs;
namespace Glamourer.State;

View file

@ -15,7 +15,6 @@ using Penumbra.GameData.DataContainers;
using Glamourer.Designs;
using Penumbra.GameData.Interop;
using Glamourer.Api.Enums;
using ObjectManager = Glamourer.Interop.ObjectManager;
namespace Glamourer.State;
@ -28,7 +27,7 @@ public class StateListener : IDisposable
{
private readonly Configuration _config;
private readonly ActorManager _actors;
private readonly ObjectManager _objects;
private readonly ActorObjectManager _objects;
private readonly StateManager _manager;
private readonly StateApplier _applier;
private readonly ItemManager _items;
@ -61,7 +60,7 @@ public class StateListener : IDisposable
public StateListener(StateManager manager, ItemManager items, PenumbraService penumbra, ActorManager actors, Configuration config,
EquipSlotUpdating equipSlotUpdating, GearsetDataLoaded gearsetDataLoaded, WeaponLoading weaponLoading, VisorStateChanged visorState,
WeaponVisibilityChanged weaponVisibility, HeadGearVisibilityChanged headGearVisibility, AutoDesignApplier autoDesignApplier,
FunModule funModule, HumanModelList humans, StateApplier applier, MovedEquipment movedEquipment, ObjectManager objects,
FunModule funModule, HumanModelList humans, StateApplier applier, MovedEquipment movedEquipment, ActorObjectManager objects,
GPoseService gPose, ChangeCustomizeService changeCustomizeService, CustomizeService customizations, ICondition condition,
CrestService crestService, BonusSlotUpdating bonusSlotUpdating, StateFinalized stateFinalized)
{
@ -205,9 +204,7 @@ public class StateListener : IDisposable
}
break;
case UpdateState.NoChange:
customize = state.ModelData.Customize;
break;
case UpdateState.NoChange: customize = state.ModelData.Customize; break;
}
}
@ -262,9 +259,7 @@ public class StateListener : IDisposable
item = state.ModelData.BonusItem(slot).Armor();
break;
// Use current model data.
case UpdateState.NoChange:
item = state.ModelData.BonusItem(slot).Armor();
break;
case UpdateState.NoChange: item = state.ModelData.BonusItem(slot).Armor(); break;
case UpdateState.Transformed: break;
}
}
@ -279,7 +274,6 @@ public class StateListener : IDisposable
if (!actor.Identifier(_actors, out var identifier))
return;
_objects.Update();
if (_objects.TryGetValue(identifier, out var actors) && actors.Valid)
_stateFinalized.Invoke(StateFinalizationType.Gearset, actors);
}
@ -287,7 +281,6 @@ public class StateListener : IDisposable
private void OnMovedEquipment((EquipSlot, uint, StainIds)[] items)
{
_objects.Update();
var (identifier, objects) = _objects.PlayerData;
if (!identifier.IsValid || !_manager.TryGetValue(identifier, out var state))
return;
@ -310,7 +303,7 @@ public class StateListener : IDisposable
var stainChanged = current.Stains == changed.Stains && !state.Sources[slot, true].IsFixed();
switch ((itemChanged, stainChanged))
switch (itemChanged, stainChanged)
{
case (true, true):
_manager.ChangeEquip(state, slot, currentItem, current.Stains, ApplySettings.Game);
@ -376,9 +369,7 @@ public class StateListener : IDisposable
else
apply = true;
break;
case UpdateState.NoChange:
apply = true;
break;
case UpdateState.NoChange: apply = true; break;
}
var baseType = slot is EquipSlot.OffHand ? state.BaseData.MainhandType.Offhand() : state.BaseData.MainhandType;