mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-11 10:24:35 +01:00
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using Glamourer.Designs.Links;
|
|
using OtterGui.Services;
|
|
using Penumbra.GameData.Actors;
|
|
using Penumbra.GameData.Enums;
|
|
using Penumbra.GameData.Structs;
|
|
|
|
namespace Glamourer.State;
|
|
|
|
public sealed class JobChangeState : IService
|
|
{
|
|
private readonly WeaponList _weaponList = new();
|
|
|
|
public ActorState? State { get; private set; }
|
|
|
|
public void Reset()
|
|
{
|
|
State = null;
|
|
_weaponList.Clear();
|
|
}
|
|
|
|
public bool HasState
|
|
=> State != null;
|
|
|
|
public ActorIdentifier Identifier
|
|
=> State?.Identifier ?? ActorIdentifier.Invalid;
|
|
|
|
public bool TryGetValue(FullEquipType slot, JobId jobId, bool gameStateAllowed, out (EquipItem, StateSource) data)
|
|
=> _weaponList.TryGet(slot, jobId, gameStateAllowed, out data);
|
|
|
|
public void Set(ActorState state, IEnumerable<(EquipItem, StateSource, JobFlag)> items)
|
|
{
|
|
Reset();
|
|
foreach (var (item, source, flags) in items.Where(p => p.Item1.Valid))
|
|
_weaponList.TryAdd(item.Type, item, source, flags);
|
|
State = state;
|
|
}
|
|
}
|