Update ObjectManager

This commit is contained in:
Ottermandias 2024-03-21 23:53:57 +01:00
parent eab1352340
commit 02fc8452d2
10 changed files with 57 additions and 75 deletions

View file

@ -168,8 +168,7 @@ public sealed partial class GlamourerIpc : IDisposable
return []; return [];
_objects.Update(); _objects.Update();
return _objects.Where(i => i.Key is { IsValid: true, Type: IdentifierType.Player } && i.Key.PlayerName == byteString) return _objects.Keys.Where(i => i is { IsValid: true, Type: IdentifierType.Player } && i.PlayerName == byteString);
.Select(i => i.Key);
} }
private IEnumerable<ActorIdentifier> FindActorsRevert(string actorName) private IEnumerable<ActorIdentifier> FindActorsRevert(string actorName)
@ -178,8 +177,8 @@ public sealed partial class GlamourerIpc : IDisposable
yield break; yield break;
_objects.Update(); _objects.Update();
foreach (var id in _objects.Where(i => i.Key is { IsValid: true, Type: IdentifierType.Player } && i.Key.PlayerName == byteString) foreach (var id in _objects.Keys.Where(i => i is { IsValid: true, Type: IdentifierType.Player } && i.PlayerName == byteString)
.Select(i => i.Key)) .Select(i => i))
yield return id; yield return id;
foreach (var id in _stateManager.Keys.Where(s => s.Type is IdentifierType.Player && s.PlayerName == byteString)) foreach (var id in _stateManager.Keys.Where(s => s.Type is IdentifierType.Player && s.PlayerName == byteString))

View file

@ -30,7 +30,7 @@ public class Glamourer : IDalamudPlugin
{ {
try try
{ {
_services = ServiceManagerA.CreateProvider(pluginInterface, Log); _services = StaticServiceManager.CreateProvider(pluginInterface, Log);
Messager = _services.GetService<MessageService>(); Messager = _services.GetService<MessageService>();
_services.EnsureRequiredServices(); _services.EnsureRequiredServices();

View file

@ -56,7 +56,7 @@ public class ActorSelector(ObjectManager objects, ActorManager actors, Ephemeral
objects.Update(); objects.Update();
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _defaultItemSpacing); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _defaultItemSpacing);
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeight()); var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeight());
var remainder = ImGuiClip.FilteredClippedDraw(objects, skips, CheckFilter, DrawSelectable); var remainder = ImGuiClip.FilteredClippedDraw(objects.Identifiers, skips, CheckFilter, DrawSelectable);
ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight()); ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight());
} }

View file

@ -23,7 +23,7 @@ public class ActiveStatePanel(StateManager _stateManager, ObjectManager _objectM
public void Draw() public void Draw()
{ {
_objectManager.Update(); _objectManager.Update();
foreach (var (identifier, actors) in _objectManager) foreach (var (identifier, actors) in _objectManager.Identifiers)
{ {
if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Trash.ToIconString()}##{actors.Label}", new Vector2(ImGui.GetFrameHeight()), if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Trash.ToIconString()}##{actors.Label}", new Vector2(ImGui.GetFrameHeight()),
string.Empty, !_stateManager.ContainsKey(identifier), true)) string.Empty, !_stateManager.ContainsKey(identifier), true))

View file

@ -1,5 +1,4 @@
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Plugin;
using Dalamud.Plugin;
using Glamourer.Api; using Glamourer.Api;
using Glamourer.Interop; using Glamourer.Interop;
using ImGuiNET; using ImGuiNET;
@ -32,7 +31,7 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
private GlamourerIpc.GlamourerErrorCode _setItemByActorNameEc; private GlamourerIpc.GlamourerErrorCode _setItemByActorNameEc;
private GlamourerIpc.GlamourerErrorCode _setItemOnceByActorNameEc; private GlamourerIpc.GlamourerErrorCode _setItemOnceByActorNameEc;
public unsafe void Draw() public void Draw()
{ {
ImGui.InputInt("Game Object Index", ref _gameObjectIndex, 0, 0); ImGui.InputInt("Game Object Index", ref _gameObjectIndex, 0, 0);
ImGui.InputTextWithHint("##gameObject", "Character Name...", ref _gameObjectName, 64); ImGui.InputTextWithHint("##gameObject", "Character Name...", ref _gameObjectName, 64);
@ -58,7 +57,7 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelGetAllCustomizationFromCharacter); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelGetAllCustomizationFromCharacter);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
base64 = GlamourerIpc.GetAllCustomizationFromCharacterSubscriber(_pluginInterface) base64 = GlamourerIpc.GetAllCustomizationFromCharacterSubscriber(_pluginInterface)
.Invoke(_objectManager.Objects.GetDalamudCharacter(_gameObjectIndex)); .Invoke(_objectManager.GetDalamudCharacter(_gameObjectIndex));
if (base64 != null) if (base64 != null)
ImGuiUtil.CopyOnClickSelectable(base64); ImGuiUtil.CopyOnClickSelectable(base64);
else else
@ -66,7 +65,7 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelGetAllCustomizationFromLockedCharacter); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelGetAllCustomizationFromLockedCharacter);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
var base64Locked = GlamourerIpc.GetAllCustomizationFromLockedCharacterSubscriber(_pluginInterface).Invoke(_objectManager.Objects.GetDalamudCharacter(_gameObjectIndex), 1337); var base64Locked = GlamourerIpc.GetAllCustomizationFromLockedCharacterSubscriber(_pluginInterface).Invoke(_objectManager.GetDalamudCharacter(_gameObjectIndex), 1337);
if (base64Locked != null) if (base64Locked != null)
ImGuiUtil.CopyOnClickSelectable(base64Locked); ImGuiUtil.CopyOnClickSelectable(base64Locked);
else else
@ -80,7 +79,7 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelRevertCharacter); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelRevertCharacter);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Revert##Character")) if (ImGui.Button("Revert##Character"))
GlamourerIpc.RevertCharacterSubscriber(_pluginInterface).Invoke(_objectManager.Objects.GetDalamudCharacter(_gameObjectIndex)); GlamourerIpc.RevertCharacterSubscriber(_pluginInterface).Invoke(_objectManager.GetDalamudCharacter(_gameObjectIndex));
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyAll); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyAll);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -96,13 +95,13 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Apply##AllCharacter")) if (ImGui.Button("Apply##AllCharacter"))
GlamourerIpc.ApplyAllToCharacterSubscriber(_pluginInterface) GlamourerIpc.ApplyAllToCharacterSubscriber(_pluginInterface)
.Invoke(_base64Apply, _objectManager.Objects.GetDalamudCharacter(_gameObjectIndex)); .Invoke(_base64Apply, _objectManager.GetDalamudCharacter(_gameObjectIndex));
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyAllOnceToCharacter); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyAllOnceToCharacter);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Apply Once##AllCharacter")) if (ImGui.Button("Apply Once##AllCharacter"))
GlamourerIpc.ApplyAllOnceToCharacterSubscriber(_pluginInterface) GlamourerIpc.ApplyAllOnceToCharacterSubscriber(_pluginInterface)
.Invoke(_base64Apply, _objectManager.Objects.GetDalamudCharacter(_gameObjectIndex)); .Invoke(_base64Apply, _objectManager.GetDalamudCharacter(_gameObjectIndex));
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyOnlyEquipment); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyOnlyEquipment);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -113,7 +112,7 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Apply##EquipCharacter")) if (ImGui.Button("Apply##EquipCharacter"))
GlamourerIpc.ApplyOnlyEquipmentToCharacterSubscriber(_pluginInterface) GlamourerIpc.ApplyOnlyEquipmentToCharacterSubscriber(_pluginInterface)
.Invoke(_base64Apply, _objectManager.Objects.GetDalamudCharacter(_gameObjectIndex)); .Invoke(_base64Apply, _objectManager.GetDalamudCharacter(_gameObjectIndex));
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyOnlyCustomization); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyOnlyCustomization);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -124,7 +123,7 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Apply##CustomizeCharacter")) if (ImGui.Button("Apply##CustomizeCharacter"))
GlamourerIpc.ApplyOnlyCustomizationToCharacterSubscriber(_pluginInterface) GlamourerIpc.ApplyOnlyCustomizationToCharacterSubscriber(_pluginInterface)
.Invoke(_base64Apply, _objectManager.Objects.GetDalamudCharacter(_gameObjectIndex)); .Invoke(_base64Apply, _objectManager.GetDalamudCharacter(_gameObjectIndex));
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyByGuid); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyByGuid);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -140,25 +139,25 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Apply##ByGuidCharacter") && Guid.TryParse(_designIdentifier, out var guid2)) if (ImGui.Button("Apply##ByGuidCharacter") && Guid.TryParse(_designIdentifier, out var guid2))
GlamourerIpc.ApplyByGuidToCharacterSubscriber(_pluginInterface) GlamourerIpc.ApplyByGuidToCharacterSubscriber(_pluginInterface)
.Invoke(guid2, _objectManager.Objects.GetDalamudCharacter(_gameObjectIndex)); .Invoke(guid2, _objectManager.GetDalamudCharacter(_gameObjectIndex));
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyByGuidOnceToCharacter); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyByGuidOnceToCharacter);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Apply Once##ByGuidCharacter") && Guid.TryParse(_designIdentifier, out var guid2Once)) if (ImGui.Button("Apply Once##ByGuidCharacter") && Guid.TryParse(_designIdentifier, out var guid2Once))
GlamourerIpc.ApplyByGuidOnceToCharacterSubscriber(_pluginInterface) GlamourerIpc.ApplyByGuidOnceToCharacterSubscriber(_pluginInterface)
.Invoke(guid2Once, _objectManager.Objects.GetDalamudCharacter(_gameObjectIndex)); .Invoke(guid2Once, _objectManager.GetDalamudCharacter(_gameObjectIndex));
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyAllLock); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelApplyAllLock);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Apply With Lock##CustomizeCharacter")) if (ImGui.Button("Apply With Lock##CustomizeCharacter"))
GlamourerIpc.ApplyAllToCharacterLockSubscriber(_pluginInterface) GlamourerIpc.ApplyAllToCharacterLockSubscriber(_pluginInterface)
.Invoke(_base64Apply, _objectManager.Objects.GetDalamudCharacter(_gameObjectIndex), 1337); .Invoke(_base64Apply, _objectManager.GetDalamudCharacter(_gameObjectIndex), 1337);
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelUnlock); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelUnlock);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Unlock##CustomizeCharacter")) if (ImGui.Button("Unlock##CustomizeCharacter"))
GlamourerIpc.UnlockSubscriber(_pluginInterface) GlamourerIpc.UnlockSubscriber(_pluginInterface)
.Invoke(_objectManager.Objects.GetDalamudCharacter(_gameObjectIndex), 1337); .Invoke(_objectManager.GetDalamudCharacter(_gameObjectIndex), 1337);
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelUnlockAll); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelUnlockAll);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -170,7 +169,7 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Revert##CustomizeCharacter")) if (ImGui.Button("Revert##CustomizeCharacter"))
GlamourerIpc.RevertToAutomationCharacterSubscriber(_pluginInterface) GlamourerIpc.RevertToAutomationCharacterSubscriber(_pluginInterface)
.Invoke(_objectManager.Objects.GetDalamudCharacter(_gameObjectIndex), 1337); .Invoke(_objectManager.GetDalamudCharacter(_gameObjectIndex), 1337);
ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelGetDesignList); ImGuiUtil.DrawTableColumn(GlamourerIpc.LabelGetDesignList);
@ -184,7 +183,7 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Set##SetItem")) if (ImGui.Button("Set##SetItem"))
_setItemEc = (GlamourerIpc.GlamourerErrorCode)GlamourerIpc.SetItemSubscriber(_pluginInterface) _setItemEc = (GlamourerIpc.GlamourerErrorCode)GlamourerIpc.SetItemSubscriber(_pluginInterface)
.Invoke(_objectManager.Objects.GetDalamudCharacter(_gameObjectIndex), (byte)_slot, _customItemId.Id, _stainId.Id, 1337); .Invoke(_objectManager.GetDalamudCharacter(_gameObjectIndex), (byte)_slot, _customItemId.Id, _stainId.Id, 1337);
if (_setItemEc != GlamourerIpc.GlamourerErrorCode.Success) if (_setItemEc != GlamourerIpc.GlamourerErrorCode.Success)
{ {
ImGui.SameLine(); ImGui.SameLine();
@ -195,7 +194,7 @@ public class IpcTesterPanel(DalamudPluginInterface _pluginInterface, ObjectManag
ImGui.TableNextColumn(); ImGui.TableNextColumn();
if (ImGui.Button("Set Once##SetItem")) if (ImGui.Button("Set Once##SetItem"))
_setItemOnceEc = (GlamourerIpc.GlamourerErrorCode)GlamourerIpc.SetItemOnceSubscriber(_pluginInterface) _setItemOnceEc = (GlamourerIpc.GlamourerErrorCode)GlamourerIpc.SetItemOnceSubscriber(_pluginInterface)
.Invoke(_objectManager.Objects.GetDalamudCharacter(_gameObjectIndex), (byte)_slot, _customItemId.Id, _stainId.Id, 1337); .Invoke(_objectManager.GetDalamudCharacter(_gameObjectIndex), (byte)_slot, _customItemId.Id, _stainId.Id, 1337);
if (_setItemOnceEc != GlamourerIpc.GlamourerErrorCode.Success) if (_setItemOnceEc != GlamourerIpc.GlamourerErrorCode.Success)
{ {
ImGui.SameLine(); ImGui.SameLine();

View file

@ -31,7 +31,7 @@ public unsafe class ModelEvaluationPanel(
public void Draw() public void Draw()
{ {
ImGui.InputInt("Game Object Index", ref _gameObjectIndex, 0, 0); ImGui.InputInt("Game Object Index", ref _gameObjectIndex, 0, 0);
var actor = _objectManager.Objects[_gameObjectIndex]; var actor = _objectManager[_gameObjectIndex];
var model = actor.Model; var model = actor.Model;
using var table = ImRaii.Table("##evaluationTable", 4, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg); using var table = ImRaii.Table("##evaluationTable", 4, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg);
ImGui.TableNextColumn(); ImGui.TableNextColumn();

View file

@ -69,7 +69,7 @@ public class ObjectManagerPanel(ObjectManager _objectManager, ActorManager _acto
var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing()); var skips = ImGuiClip.GetNecessarySkips(ImGui.GetTextLineHeightWithSpacing());
ImGui.TableNextRow(); ImGui.TableNextRow();
var remainder = ImGuiClip.FilteredClippedDraw(_objectManager, skips, var remainder = ImGuiClip.FilteredClippedDraw(_objectManager.Identifiers, skips,
p => p.Value.Label.Contains(_objectFilter, StringComparison.OrdinalIgnoreCase), p p => p.Value.Label.Contains(_objectFilter, StringComparison.OrdinalIgnoreCase), p
=> =>
{ {

View file

@ -1,23 +1,31 @@
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
using Dalamud.Plugin;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Game.Control; using FFXIVClientStructs.FFXIV.Client.Game.Control;
using Glamourer.Interop.Structs; using Glamourer.Interop.Structs;
using OtterGui.Log;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Enums; using Penumbra.GameData.Enums;
using Penumbra.GameData.Interop; using Penumbra.GameData.Interop;
namespace Glamourer.Interop; namespace Glamourer.Interop;
public class ObjectManager(IFramework framework, IClientState clientState, global::Penumbra.GameData.Interop.ObjectManager objects, ActorManager actors, ITargetManager targets) public class ObjectManager(
: IReadOnlyDictionary<ActorIdentifier, ActorData> IFramework framework,
IClientState clientState,
IObjectTable objects,
DalamudPluginInterface pi,
Logger log,
ActorManager actors,
ITargetManager targets)
: global::Penumbra.GameData.Interop.ObjectManager(pi, log, framework, objects)
{ {
public global::Penumbra.GameData.Interop.ObjectManager Objects public DateTime LastUpdate
=> objects; => LastFrame;
public DateTime LastUpdate { get; private set; } private DateTime _identifierUpdate;
public bool IsInGPose { get; private set; }
public bool IsInGPose { get; private set; } public ushort World { get; private set; }
public ushort World { get; private set; }
private readonly Dictionary<ActorIdentifier, ActorData> _identifiers = new(200); private readonly Dictionary<ActorIdentifier, ActorData> _identifiers = new(200);
private readonly Dictionary<ActorIdentifier, ActorData> _allWorldIdentifiers = new(200); private readonly Dictionary<ActorIdentifier, ActorData> _allWorldIdentifiers = new(200);
@ -26,40 +34,26 @@ public class ObjectManager(IFramework framework, IClientState clientState, globa
public IReadOnlyDictionary<ActorIdentifier, ActorData> Identifiers public IReadOnlyDictionary<ActorIdentifier, ActorData> Identifiers
=> _identifiers; => _identifiers;
public void Update() public override bool Update()
{ {
var lastUpdate = framework.LastUpdate; if (!base.Update() && _identifierUpdate >= LastUpdate)
if (lastUpdate <= LastUpdate) return false;
return;
LastUpdate = lastUpdate; _identifierUpdate = LastUpdate;
World = (ushort)(clientState.LocalPlayer?.CurrentWorld.Id ?? 0u); World = (ushort)(this[0].Valid ? this[0].HomeWorld : 0);
_identifiers.Clear(); _identifiers.Clear();
_allWorldIdentifiers.Clear(); _allWorldIdentifiers.Clear();
_nonOwnedIdentifiers.Clear(); _nonOwnedIdentifiers.Clear();
for (var i = 0; i < (int)ScreenActor.CutsceneStart; ++i) foreach (var actor in BattleNpcs.Concat(CutsceneCharacters))
{ {
var character = objects[i]; if (actor.Identifier(actors, out var identifier))
if (character.Identifier(actors, out var identifier)) HandleIdentifier(identifier, actor);
HandleIdentifier(identifier, character);
}
for (var i = (int)ScreenActor.CutsceneStart; i < (int)ScreenActor.CutsceneEnd; ++i)
{
var character = objects[i];
// Technically the game does not create holes in cutscenes or GPose.
// But for Brio compatibility, we allow holes in GPose.
// Since GPose always has the event actor in the first cutscene slot, we can still optimize in this case.
if (!character.Valid && i == (int)ScreenActor.CutsceneStart)
break;
HandleIdentifier(character.GetIdentifier(actors), character);
} }
void AddSpecial(ScreenActor idx, string label) void AddSpecial(ScreenActor idx, string label)
{ {
var actor = objects[(int)idx]; var actor = this[(int)idx];
if (actor.Identifier(actors, out var ident)) if (actor.Identifier(actors, out var ident))
{ {
var data = new ActorData(actor, label); var data = new ActorData(actor, label);
@ -76,15 +70,15 @@ public class ObjectManager(IFramework framework, IClientState clientState, globa
AddSpecial(ScreenActor.Card7, "Card Actor 7"); AddSpecial(ScreenActor.Card7, "Card Actor 7");
AddSpecial(ScreenActor.Card8, "Card Actor 8"); AddSpecial(ScreenActor.Card8, "Card Actor 8");
for (var i = (int)ScreenActor.ScreenEnd; i < objects.Count; ++i) foreach (var actor in EventNpcs)
{ {
var character = objects[i]; if (actor.Identifier(actors, out var identifier))
if (character.Identifier(actors, out var identifier)) HandleIdentifier(identifier, actor);
HandleIdentifier(identifier, character);
} }
var gPose = GPosePlayer; var gPose = GPosePlayer;
IsInGPose = gPose.Utf8Name.Length > 0; IsInGPose = gPose.Utf8Name.Length > 0;
return true;
} }
private void HandleIdentifier(ActorIdentifier identifier, Actor character) private void HandleIdentifier(ActorIdentifier identifier, Actor character)
@ -135,10 +129,10 @@ public class ObjectManager(IFramework framework, IClientState clientState, globa
} }
public Actor GPosePlayer public Actor GPosePlayer
=> objects[(int)ScreenActor.GPosePlayer]; => this[(int)ScreenActor.GPosePlayer];
public Actor Player public Actor Player
=> objects[0]; => this[0];
public unsafe Actor Target public unsafe Actor Target
=> clientState.IsGPosing ? TargetSystem.Instance()->GPoseTarget : TargetSystem.Instance()->Target; => clientState.IsGPosing ? TargetSystem.Instance()->GPoseTarget : TargetSystem.Instance()->Target;
@ -171,15 +165,6 @@ public class ObjectManager(IFramework framework, IClientState clientState, globa
} }
} }
public IEnumerator<KeyValuePair<ActorIdentifier, ActorData>> GetEnumerator()
=> Identifiers.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
=> GetEnumerator();
public int Count
=> Identifiers.Count;
/// <summary> Also handles All Worlds players and non-owned NPCs. </summary> /// <summary> Also handles All Worlds players and non-owned NPCs. </summary>
public bool ContainsKey(ActorIdentifier key) public bool ContainsKey(ActorIdentifier key)
=> Identifiers.ContainsKey(key) || _allWorldIdentifiers.ContainsKey(key) || _nonOwnedIdentifiers.ContainsKey(key); => Identifiers.ContainsKey(key) || _allWorldIdentifiers.ContainsKey(key) || _nonOwnedIdentifiers.ContainsKey(key);

View file

@ -26,12 +26,11 @@ using OtterGui.Services;
using Penumbra.GameData.Actors; using Penumbra.GameData.Actors;
using Penumbra.GameData.Data; using Penumbra.GameData.Data;
using Penumbra.GameData.DataContainers; using Penumbra.GameData.DataContainers;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs; using Penumbra.GameData.Structs;
namespace Glamourer.Services; namespace Glamourer.Services;
public static class ServiceManagerA public static class StaticServiceManager
{ {
public static ServiceManager CreateProvider(DalamudPluginInterface pi, Logger log) public static ServiceManager CreateProvider(DalamudPluginInterface pi, Logger log)
{ {

@ -1 +1 @@
Subproject commit 529e18115023732794994bfb8df4818b68951ea4 Subproject commit 66687643da2163c938575ad6949c8d0fbd03afe7