mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-25 14:11:47 +01:00
Switch services.
This commit is contained in:
parent
1c360d026b
commit
2d8d6fa75f
79 changed files with 487 additions and 503 deletions
|
|
@ -1,9 +1,9 @@
|
|||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.State;
|
||||
using Luna;
|
||||
using OtterGui.Extensions;
|
||||
using OtterGui.Log;
|
||||
using OtterGui.Services;
|
||||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Interop;
|
||||
|
|
@ -84,9 +84,8 @@ public class ApiHelpers(ActorObjectManager objects, StateManager stateManager, A
|
|||
return [];
|
||||
|
||||
return stateManager.Values.Where(state => state.Identifier.Type is IdentifierType.Player && state.Identifier.PlayerName == byteString)
|
||||
.Concat(objects
|
||||
.Where(kvp => kvp.Key is { IsValid: true, Type: IdentifierType.Player } && kvp.Key.PlayerName == byteString)
|
||||
.SelectWhere(kvp =>
|
||||
.Concat(ArrayExtensions.SelectWhere(objects
|
||||
.Where(kvp => kvp.Key is { IsValid: true, Type: IdentifierType.Player } && kvp.Key.PlayerName == byteString), kvp =>
|
||||
{
|
||||
if (stateManager.ContainsKey(kvp.Key))
|
||||
return (false, null);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.State;
|
||||
using Luna;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui.Services;
|
||||
|
||||
namespace Glamourer.Api;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Glamourer.Api.Api;
|
||||
using OtterGui.Services;
|
||||
using Luna;
|
||||
|
||||
namespace Glamourer.Api;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Glamourer.Api.Helpers;
|
||||
using OtterGui.Services;
|
||||
using Glamourer.Api.Enums;
|
||||
using Luna;
|
||||
|
||||
namespace Glamourer.Api;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using Glamourer.Api.Enums;
|
|||
using Glamourer.Designs;
|
||||
using Glamourer.Services;
|
||||
using Glamourer.State;
|
||||
using OtterGui.Services;
|
||||
using Luna;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
|
|||
return ApiHelpers.Return(GlamourerApiEc.InvalidKey, args);
|
||||
|
||||
return ApiHelpers.Return(GlamourerApiEc.Success, args);
|
||||
}
|
||||
}
|
||||
|
||||
public GlamourerApiEc SetBonusItem(int objectIndex, ApiBonusSlot slot, ulong bonusItemId, uint key, ApplyFlag flags)
|
||||
{
|
||||
|
|
@ -125,8 +125,8 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
|
|||
return ApiHelpers.Return(GlamourerApiEc.InvalidKey, args);
|
||||
|
||||
return ApiHelpers.Return(GlamourerApiEc.Success, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public GlamourerApiEc SetMetaState(int objectIndex, MetaFlag types, bool newValue, uint key, ApplyFlag flags)
|
||||
{
|
||||
var args = ApiHelpers.Args("Index", objectIndex, "MetaTypes", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags);
|
||||
|
|
@ -144,10 +144,10 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
|
|||
|
||||
// Grab MetaIndices from attached flags, and update the states.
|
||||
var indices = types.ToIndices();
|
||||
foreach (var index in indices)
|
||||
{
|
||||
stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual);
|
||||
ApiHelpers.Lock(state, key, flags);
|
||||
foreach (var index in indices)
|
||||
{
|
||||
stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual);
|
||||
ApiHelpers.Lock(state, key, flags);
|
||||
}
|
||||
|
||||
return GlamourerApiEc.Success;
|
||||
|
|
@ -155,7 +155,7 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
|
|||
|
||||
public GlamourerApiEc SetMetaStateName(string playerName, MetaFlag types, bool newValue, uint key, ApplyFlag flags)
|
||||
{
|
||||
var args = ApiHelpers.Args("Name", playerName, "MetaTypes", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags);
|
||||
var args = ApiHelpers.Args("Name", playerName, "MetaTypes", types, "NewValue", newValue, "Key", key, "ApplyFlags", flags);
|
||||
if (types == 0)
|
||||
return ApiHelpers.Return(GlamourerApiEc.ItemInvalid, args);
|
||||
|
||||
|
|
@ -174,10 +174,10 @@ public class ItemsApi(ApiHelpers helpers, ItemManager itemManager, StateManager
|
|||
|
||||
anyUnlocked = true;
|
||||
// update all MetaStates for this ActorState
|
||||
foreach (var index in types.ToIndices())
|
||||
{
|
||||
stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual);
|
||||
ApiHelpers.Lock(state, key, flags);
|
||||
foreach (var index in types.ToIndices())
|
||||
{
|
||||
stateManager.ChangeMetaState(state, index, newValue, ApplySettings.Manual);
|
||||
ApiHelpers.Lock(state, key, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,9 @@ using Glamourer.Designs;
|
|||
using Glamourer.Designs.History;
|
||||
using Glamourer.Events;
|
||||
using Glamourer.State;
|
||||
using Luna;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui.Services;
|
||||
using Penumbra.GameData.Interop;
|
||||
using Penumbra.GameData.Structs;
|
||||
using StateChanged = Glamourer.Events.StateChanged;
|
||||
|
||||
namespace Glamourer.Api;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue