mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Append SetMetaState with object index.
This commit is contained in:
parent
091aadd4a6
commit
439849edfa
1 changed files with 27 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ using Glamourer.State;
|
|||
using OtterGui.Services;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using static OtterGui.ItemSelector<T>;
|
||||
|
||||
namespace Glamourer.Api;
|
||||
|
||||
|
|
@ -127,6 +128,29 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
|
|||
return ApiHelpers.Return(GlamourerApiEc.Success, args);
|
||||
}
|
||||
|
||||
public GlamourerApiEc SetMetaState(int objectIndex, bool newValue, uint key, SetMetaFlag metaFlags)
|
||||
{
|
||||
var args = ApiHelpers.Args("Index", objectIndex, "Value", newValue, "Key", key, "Flags", metaFlags);
|
||||
if (metaFlags == 0)
|
||||
return ApiHelpers.Return(GlamourerApiEc.InvalidState, args);
|
||||
|
||||
if (helpers.FindState(objectIndex) is not { } state)
|
||||
return ApiHelpers.Return(GlamourerApiEc.ActorNotFound, args);
|
||||
|
||||
if (!state.ModelData.IsHuman)
|
||||
return ApiHelpers.Return(GlamourerApiEc.ActorNotHuman, args);
|
||||
|
||||
if (!state.CanUnlock(key))
|
||||
return ApiHelpers.Return(GlamourerApiEc.InvalidKey, args);
|
||||
|
||||
// Grab MetaIndices from attached flags, and update the states.
|
||||
var indices = metaFlags.ToIndices();
|
||||
foreach (var index in indices)
|
||||
stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual);
|
||||
|
||||
return GlamourerApiEc.Success;
|
||||
}
|
||||
|
||||
private bool ResolveItem(ApiEquipSlot apiSlot, ulong itemId, out EquipItem item)
|
||||
{
|
||||
var id = (CustomItemId)itemId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue