mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-16 20:47:43 +01:00
Update gamedata and services.
This commit is contained in:
parent
36d95c37bc
commit
a982c0a1c1
74 changed files with 907 additions and 960 deletions
|
|
@ -164,20 +164,21 @@ public unsafe class FunModule : IDisposable
|
|||
if (!_codes.EnabledEmperor)
|
||||
return;
|
||||
|
||||
void SetItem(EquipSlot slot2, ref CharacterArmor armor)
|
||||
{
|
||||
var list = _items.ItemService.AwaitedService[slot2.ToEquipType()];
|
||||
var rng = _rng.Next(0, list.Count - 1);
|
||||
var item = list[rng];
|
||||
armor.Set = item.ModelId;
|
||||
armor.Variant = item.Variant;
|
||||
}
|
||||
|
||||
if (armors.Length == 1)
|
||||
SetItem(slot, ref armors[0]);
|
||||
else
|
||||
for (var i = 0u; i < armors.Length; ++i)
|
||||
SetItem(i.ToEquipSlot(), ref armors[(int)i]);
|
||||
return;
|
||||
|
||||
void SetItem(EquipSlot slot2, ref CharacterArmor armor)
|
||||
{
|
||||
var list = _items.ItemData.ByType[slot2.ToEquipType()];
|
||||
var rng = _rng.Next(0, list.Count - 1);
|
||||
var item = list[rng];
|
||||
armor.Set = item.PrimaryId;
|
||||
armor.Variant = item.Variant;
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyOops(ref Customize customize)
|
||||
|
|
@ -197,7 +198,7 @@ public unsafe class FunModule : IDisposable
|
|||
if (!_codes.EnabledIndividual)
|
||||
return;
|
||||
|
||||
var set = _customizations.AwaitedService.GetList(customize.Clan, customize.Gender);
|
||||
var set = _customizations.Service.GetList(customize.Clan, customize.Gender);
|
||||
foreach (var index in Enum.GetValues<CustomizeIndex>())
|
||||
{
|
||||
if (index is CustomizeIndex.Face || !set.IsAvailable(index))
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ public class StateApplier(UpdateSlotService _updateSlot, VisorService _visor, We
|
|||
/// <summary> Apply a weapon to the offhand. </summary>
|
||||
public void ChangeOffhand(ActorData data, EquipItem weapon, StainId stain)
|
||||
{
|
||||
stain = weapon.ModelId.Id == 0 ? 0 : stain;
|
||||
stain = weapon.PrimaryId.Id == 0 ? 0 : stain;
|
||||
foreach (var actor in data.Objects.Where(a => a.Model.IsHuman))
|
||||
_weapon.LoadWeapon(actor, EquipSlot.OffHand, weapon.Weapon().With(stain));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Glamourer.Customization;
|
|||
using Glamourer.Events;
|
||||
using Glamourer.Services;
|
||||
using Glamourer.Structs;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.DataContainers;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class StateEditor
|
|||
|
||||
state[CustomizeIndex.Clan] = source;
|
||||
state[CustomizeIndex.Gender] = source;
|
||||
var set = _customizations.AwaitedService.GetList(state.ModelData.Customize.Clan, state.ModelData.Customize.Gender);
|
||||
var set = _customizations.Service.GetList(state.ModelData.Customize.Clan, state.ModelData.Customize.Gender);
|
||||
foreach (var index in Enum.GetValues<CustomizeIndex>().Where(set.IsAvailable))
|
||||
state[index] = source;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ using Glamourer.Interop.Structs;
|
|||
using Glamourer.Services;
|
||||
using OtterGui.Classes;
|
||||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using System;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Glamourer.Structs;
|
||||
using Penumbra.GameData.DataContainers;
|
||||
|
||||
namespace Glamourer.State;
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ namespace Glamourer.State;
|
|||
public class StateListener : IDisposable
|
||||
{
|
||||
private readonly Configuration _config;
|
||||
private readonly ActorService _actors;
|
||||
private readonly ActorManager _actors;
|
||||
private readonly ObjectManager _objects;
|
||||
private readonly StateManager _manager;
|
||||
private readonly StateApplier _applier;
|
||||
|
|
@ -50,7 +50,7 @@ public class StateListener : IDisposable
|
|||
private ActorState? _creatingState;
|
||||
private CharacterWeapon _lastFistOffhand = CharacterWeapon.Empty;
|
||||
|
||||
public StateListener(StateManager manager, ItemManager items, PenumbraService penumbra, ActorService actors, Configuration config,
|
||||
public StateListener(StateManager manager, ItemManager items, PenumbraService penumbra, ActorManager actors, Configuration config,
|
||||
SlotUpdating slotUpdating, WeaponLoading weaponLoading, VisorStateChanged visorState, WeaponVisibilityChanged weaponVisibility,
|
||||
HeadGearVisibilityChanged headGearVisibility, AutoDesignApplier autoDesignApplier, FunModule funModule, HumanModelList humans,
|
||||
StateApplier applier, MovedEquipment movedEquipment, ObjectManager objects, GPoseService gPose,
|
||||
|
|
@ -111,7 +111,7 @@ public class StateListener : IDisposable
|
|||
if (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart)
|
||||
return;
|
||||
|
||||
_creatingIdentifier = actor.GetIdentifier(_actors.AwaitedService);
|
||||
_creatingIdentifier = actor.GetIdentifier(_actors);
|
||||
|
||||
ref var modelId = ref *(uint*)modelPtr;
|
||||
ref var customize = ref *(Customize*)customizePtr;
|
||||
|
|
@ -149,7 +149,7 @@ public class StateListener : IDisposable
|
|||
if (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart)
|
||||
return;
|
||||
|
||||
if (!actor.Identifier(_actors.AwaitedService, out var identifier)
|
||||
if (!actor.Identifier(_actors, out var identifier)
|
||||
|| !_manager.TryGetValue(identifier, out var state))
|
||||
return;
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ public class StateListener : IDisposable
|
|||
return;
|
||||
}
|
||||
|
||||
var set = _customizations.AwaitedService.GetList(model.Clan, model.Gender);
|
||||
var set = _customizations.Service.GetList(model.Clan, model.Gender);
|
||||
foreach (var index in CustomizationExtensions.AllBasic)
|
||||
{
|
||||
if (state[index] is not StateChanged.Source.Fixed)
|
||||
|
|
@ -211,7 +211,7 @@ public class StateListener : IDisposable
|
|||
// 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, out var identifier)
|
||||
&& _manager.TryGetValue(identifier, out var state))
|
||||
{
|
||||
HandleEquipSlot(actor, state, slot, ref armor.Value);
|
||||
|
|
@ -238,7 +238,7 @@ public class StateListener : IDisposable
|
|||
var currentItem = state.BaseData.Item(slot);
|
||||
var model = state.ModelData.Weapon(slot);
|
||||
var current = currentItem.Weapon(state.BaseData.Stain(slot));
|
||||
if (model.Value == current.Value || !_items.ItemService.AwaitedService.TryGetValue(item, EquipSlot.MainHand, out var changedItem))
|
||||
if (model.Value == current.Value || !_items.ItemData.TryGetValue(item, EquipSlot.MainHand, out var changedItem))
|
||||
continue;
|
||||
|
||||
var changed = changedItem.Weapon(stain);
|
||||
|
|
@ -272,10 +272,10 @@ public class StateListener : IDisposable
|
|||
return;
|
||||
|
||||
// Fist weapon gauntlet hack.
|
||||
if (slot is EquipSlot.OffHand && weapon.Value.Variant == 0 && weapon.Value.Set.Id != 0 && _lastFistOffhand.Set.Id != 0)
|
||||
if (slot is EquipSlot.OffHand && weapon.Value.Variant == 0 && weapon.Value.Y.Id != 0 && _lastFistOffhand.Y.Id != 0)
|
||||
weapon.Value = _lastFistOffhand;
|
||||
|
||||
if (!actor.Identifier(_actors.AwaitedService, out var identifier)
|
||||
if (!actor.Identifier(_actors, out var identifier)
|
||||
|| !_manager.TryGetValue(identifier, out var state))
|
||||
return;
|
||||
|
||||
|
|
@ -308,13 +308,13 @@ public class StateListener : IDisposable
|
|||
var newWeapon = state.ModelData.Weapon(slot);
|
||||
if (baseType is FullEquipType.Unknown || baseType == state.ModelData.Item(slot).Type || _gPose.InGPose && actor.IsGPoseOrCutscene)
|
||||
actorWeapon = newWeapon;
|
||||
else if (actorWeapon.Set.Id != 0)
|
||||
else if (actorWeapon.X.Id != 0)
|
||||
actorWeapon = actorWeapon.With(newWeapon.Stain);
|
||||
}
|
||||
|
||||
// Fist Weapon Offhand hack.
|
||||
if (slot is EquipSlot.MainHand && weapon.Value.Set.Id is > 1600 and < 1651)
|
||||
_lastFistOffhand = new CharacterWeapon((SetId)(weapon.Value.Set.Id + 50), weapon.Value.Type, weapon.Value.Variant,
|
||||
if (slot is EquipSlot.MainHand && weapon.Value.X.Id is > 1600 and < 1651)
|
||||
_lastFistOffhand = new CharacterWeapon((PrimaryId)(weapon.Value.X.Id + 50), weapon.Value.Y, weapon.Value.Variant,
|
||||
weapon.Value.Stain);
|
||||
|
||||
_funModule.ApplyFun(actor, ref weapon.Value, slot);
|
||||
|
|
@ -329,7 +329,7 @@ public class StateListener : IDisposable
|
|||
return false;
|
||||
|
||||
var offhand = actor.GetOffhand();
|
||||
return offhand.Variant == 0 && offhand.Set.Id != 0 && armor.Set.Id == offhand.Set.Id;
|
||||
return offhand.Variant == 0 && offhand.Y.Id != 0 && armor.Set.Id == offhand.Y.Id;
|
||||
}
|
||||
|
||||
var actorArmor = actor.GetArmor(slot);
|
||||
|
|
@ -413,7 +413,7 @@ public class StateListener : IDisposable
|
|||
if (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart)
|
||||
return;
|
||||
|
||||
if (!actor.Identifier(_actors.AwaitedService, out var identifier)
|
||||
if (!actor.Identifier(_actors, out var identifier)
|
||||
|| !_manager.TryGetValue(identifier, out var state))
|
||||
return;
|
||||
|
||||
|
|
@ -439,7 +439,7 @@ public class StateListener : IDisposable
|
|||
if (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart)
|
||||
return;
|
||||
|
||||
if (!actor.Identifier(_actors.AwaitedService, out var identifier)
|
||||
if (!actor.Identifier(_actors, out var identifier)
|
||||
|| !_manager.TryGetValue(identifier, out var state))
|
||||
return;
|
||||
|
||||
|
|
@ -474,7 +474,7 @@ public class StateListener : IDisposable
|
|||
var change = UpdateState.NoChange;
|
||||
|
||||
// Fist weapon bug hack
|
||||
if (slot is EquipSlot.OffHand && weapon.Value == 0 && actor.GetMainhand().Set.Id is > 1600 and < 1651)
|
||||
if (slot is EquipSlot.OffHand && weapon.Value == 0 && actor.GetMainhand().X.Id is > 1600 and < 1651)
|
||||
return UpdateState.NoChange;
|
||||
|
||||
if (baseData.Stain != weapon.Stain)
|
||||
|
|
@ -483,9 +483,9 @@ public class StateListener : IDisposable
|
|||
change = UpdateState.Change;
|
||||
}
|
||||
|
||||
if (baseData.Set.Id != weapon.Set.Id || baseData.Type.Id != weapon.Type.Id || baseData.Variant != weapon.Variant)
|
||||
if (baseData.X.Id != weapon.X.Id || baseData.Y.Id != weapon.Y.Id || baseData.Variant != weapon.Variant)
|
||||
{
|
||||
var item = _items.Identify(slot, weapon.Set, weapon.Type, weapon.Variant,
|
||||
var item = _items.Identify(slot, weapon.X, weapon.Y, weapon.Variant,
|
||||
slot is EquipSlot.OffHand ? state.BaseData.Item(EquipSlot.MainHand).Type : FullEquipType.Unknown);
|
||||
state.BaseData.SetItem(slot, item);
|
||||
change = UpdateState.Change;
|
||||
|
|
@ -555,7 +555,7 @@ public class StateListener : IDisposable
|
|||
if (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart)
|
||||
return;
|
||||
|
||||
if (!actor.Identifier(_actors.AwaitedService, out var identifier))
|
||||
if (!actor.Identifier(_actors, out var identifier))
|
||||
return;
|
||||
|
||||
if (!_manager.TryGetValue(identifier, out var state))
|
||||
|
|
@ -588,7 +588,7 @@ public class StateListener : IDisposable
|
|||
// We do not need to handle fixed designs,
|
||||
// if there is no model that caused a fixed design to exist yet,
|
||||
// we also do not care about the invisible model.
|
||||
if (!actor.Identifier(_actors.AwaitedService, out var identifier))
|
||||
if (!actor.Identifier(_actors, out var identifier))
|
||||
return;
|
||||
|
||||
if (!_manager.TryGetValue(identifier, out var state))
|
||||
|
|
@ -621,7 +621,7 @@ public class StateListener : IDisposable
|
|||
// We do not need to handle fixed designs,
|
||||
// if there is no model that caused a fixed design to exist yet,
|
||||
// we also do not care about the invisible model.
|
||||
if (!actor.Identifier(_actors.AwaitedService, out var identifier))
|
||||
if (!actor.Identifier(_actors, out var identifier))
|
||||
return;
|
||||
|
||||
if (!_manager.TryGetValue(identifier, out var state))
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@ using Glamourer.Interop.Structs;
|
|||
using Glamourer.Services;
|
||||
using Glamourer.Structs;
|
||||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.DataContainers;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Glamourer.State;
|
||||
|
||||
public class StateManager(ActorService _actors, ItemManager _items, StateChanged _event, StateApplier _applier, StateEditor _editor,
|
||||
public class StateManager(ActorManager _actors, ItemManager _items, StateChanged _event, StateApplier _applier, StateEditor _editor,
|
||||
HumanModelList _humans, ICondition _condition, IClientState _clientState)
|
||||
: IReadOnlyDictionary<ActorIdentifier, ActorState>
|
||||
{
|
||||
private readonly Dictionary<ActorIdentifier, ActorState> _states = new();
|
||||
private readonly Dictionary<ActorIdentifier, ActorState> _states = [];
|
||||
|
||||
public IEnumerator<KeyValuePair<ActorIdentifier, ActorState>> GetEnumerator()
|
||||
=> _states.GetEnumerator();
|
||||
|
|
@ -50,7 +50,7 @@ public class StateManager(ActorService _actors, ItemManager _items, StateChanged
|
|||
|
||||
/// <inheritdoc cref="GetOrCreate(ActorIdentifier, Actor, out ActorState?)"/>
|
||||
public bool GetOrCreate(Actor actor, [NotNullWhen(true)] out ActorState? state)
|
||||
=> GetOrCreate(actor.GetIdentifier(_actors.AwaitedService), actor, out state);
|
||||
=> GetOrCreate(actor.GetIdentifier(_actors), actor, out state);
|
||||
|
||||
/// <summary> Try to obtain or create a new state for an existing actor. Returns false if no state could be created. </summary>
|
||||
public unsafe bool GetOrCreate(ActorIdentifier identifier, Actor actor, [NotNullWhen(true)] out ActorState? state)
|
||||
|
|
@ -170,8 +170,8 @@ public class StateManager(ActorService _actors, ItemManager _items, StateChanged
|
|||
}
|
||||
|
||||
// Set the weapons regardless of source.
|
||||
var mainItem = _items.Identify(EquipSlot.MainHand, main.Set, main.Type, main.Variant);
|
||||
var offItem = _items.Identify(EquipSlot.OffHand, off.Set, off.Type, off.Variant, mainItem.Type);
|
||||
var mainItem = _items.Identify(EquipSlot.MainHand, main.Skeleton, main.Weapon, main.Variant);
|
||||
var offItem = _items.Identify(EquipSlot.OffHand, off.Skeleton, off.Weapon, off.Variant, mainItem.Type);
|
||||
ret.SetItem(EquipSlot.MainHand, mainItem);
|
||||
ret.SetStain(EquipSlot.MainHand, main.Stain);
|
||||
ret.SetItem(EquipSlot.OffHand, offItem);
|
||||
|
|
@ -190,13 +190,13 @@ public class StateManager(ActorService _actors, ItemManager _items, StateChanged
|
|||
/// <summary> This is hardcoded in the game. </summary>
|
||||
private void FistWeaponHack(ref DesignData ret, ref CharacterWeapon mainhand, ref CharacterWeapon offhand)
|
||||
{
|
||||
if (mainhand.Set.Id is < 1601 or >= 1651)
|
||||
if (mainhand.Skeleton.Id is < 1601 or >= 1651)
|
||||
return;
|
||||
|
||||
var gauntlets = _items.Identify(EquipSlot.Hands, offhand.Set, (Variant)offhand.Type.Id);
|
||||
offhand.Set = (SetId)(mainhand.Set.Id + 50);
|
||||
var gauntlets = _items.Identify(EquipSlot.Hands, offhand.Skeleton, (Variant)offhand.Weapon.Id);
|
||||
offhand.Skeleton = (PrimaryId)(mainhand.Skeleton.Id + 50);
|
||||
offhand.Variant = mainhand.Variant;
|
||||
offhand.Type = mainhand.Type;
|
||||
offhand.Weapon = mainhand.Weapon;
|
||||
ret.SetItem(EquipSlot.Hands, gauntlets);
|
||||
ret.SetStain(EquipSlot.Hands, mainhand.Stain);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue