Switch to ActorObjectManager provided by Penumbra.GameData
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
using Penumbra.GameData.Interop;
|
|
||||||
|
|
||||||
namespace CustomizePlus.GameData.Data;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A single actor with its label and the list of associated game objects.
|
|
||||||
/// </summary>
|
|
||||||
public readonly struct ActorData
|
|
||||||
{
|
|
||||||
public readonly List<Actor> Objects;
|
|
||||||
public readonly string Label;
|
|
||||||
|
|
||||||
public bool Valid
|
|
||||||
=> Objects.Count > 0;
|
|
||||||
|
|
||||||
public ActorData(Actor actor, string label)
|
|
||||||
{
|
|
||||||
Objects = new List<Actor> { actor };
|
|
||||||
Label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly ActorData Invalid = new(false);
|
|
||||||
|
|
||||||
private ActorData(bool _)
|
|
||||||
{
|
|
||||||
Objects = new List<Actor>(0);
|
|
||||||
Label = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*public LazyString ToLazyString(string invalid)
|
|
||||||
{
|
|
||||||
var objects = Objects;
|
|
||||||
return Valid
|
|
||||||
? new LazyString(() => string.Join(", ", objects.Select(o => o.ToString())))
|
|
||||||
: new LazyString(() => invalid);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private ActorData(List<Actor> objects, string label)
|
|
||||||
{
|
|
||||||
Objects = objects;
|
|
||||||
Label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActorData OnlyGPose()
|
|
||||||
=> new(Objects.Where(o => o.IsGPoseOrCutscene).ToList(), Label);
|
|
||||||
}
|
|
||||||
@@ -5,6 +5,7 @@ using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
|||||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||||
using OtterGui.Services;
|
using OtterGui.Services;
|
||||||
using Penumbra.GameData.Enums;
|
using Penumbra.GameData.Enums;
|
||||||
|
using Penumbra.GameData.Interop;
|
||||||
using Penumbra.String;
|
using Penumbra.String;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
|||||||
@@ -1,247 +0,0 @@
|
|||||||
using CustomizePlus.GameData.Data;
|
|
||||||
using Dalamud.Game.ClientState.Objects;
|
|
||||||
using Dalamud.Plugin;
|
|
||||||
using Dalamud.Plugin.Services;
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.Control;
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
|
||||||
using OtterGui.Log;
|
|
||||||
using Penumbra.GameData.Actors;
|
|
||||||
using Penumbra.GameData.Enums;
|
|
||||||
using Penumbra.GameData.Interop;
|
|
||||||
using Penumbra.String;
|
|
||||||
|
|
||||||
namespace CustomizePlus.GameData.Services;
|
|
||||||
|
|
||||||
public class ObjectManager(
|
|
||||||
IFramework framework,
|
|
||||||
IClientState clientState,
|
|
||||||
IObjectTable objects,
|
|
||||||
IDalamudPluginInterface pi,
|
|
||||||
Logger log,
|
|
||||||
ActorManager actors,
|
|
||||||
ITargetManager targets)
|
|
||||||
: global::Penumbra.GameData.Interop.ObjectManager(pi, log, framework, objects)
|
|
||||||
{
|
|
||||||
public DateTime LastUpdate
|
|
||||||
=> LastFrame;
|
|
||||||
|
|
||||||
private DateTime _identifierUpdate;
|
|
||||||
|
|
||||||
public bool IsInGPose => clientState.IsGPosing;
|
|
||||||
//c+ custom
|
|
||||||
public bool IsInLobby { get; private set; }
|
|
||||||
public ushort World { get; private set; }
|
|
||||||
|
|
||||||
private readonly Dictionary<ActorIdentifier, ActorData> _identifiers = new(200);
|
|
||||||
private readonly Dictionary<ActorIdentifier, ActorData> _allWorldIdentifiers = new(200);
|
|
||||||
private readonly Dictionary<ActorIdentifier, ActorData> _nonOwnedIdentifiers = new(200);
|
|
||||||
|
|
||||||
public IReadOnlyDictionary<ActorIdentifier, ActorData> Identifiers
|
|
||||||
=> _identifiers;
|
|
||||||
|
|
||||||
public override bool Update()
|
|
||||||
{
|
|
||||||
if (!base.Update() && _identifierUpdate >= LastUpdate)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
_identifierUpdate = LastUpdate;
|
|
||||||
World = (ushort)(Player.Valid ? Player.HomeWorld : 0);
|
|
||||||
_identifiers.Clear();
|
|
||||||
_allWorldIdentifiers.Clear();
|
|
||||||
_nonOwnedIdentifiers.Clear();
|
|
||||||
|
|
||||||
foreach (var actor in BattleNpcs.Concat(CutsceneCharacters))
|
|
||||||
{
|
|
||||||
if (actor.Identifier(actors, out var identifier))
|
|
||||||
HandleIdentifier(identifier, actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddSpecial(ScreenActor idx, string label)
|
|
||||||
{
|
|
||||||
var actor = this[(int)idx];
|
|
||||||
if (actor.Identifier(actors, out var ident))
|
|
||||||
{
|
|
||||||
var data = new ActorData(actor, label);
|
|
||||||
_identifiers.Add(ident, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSpecial(ScreenActor.CharacterScreen, "Character Screen Actor");
|
|
||||||
AddSpecial(ScreenActor.ExamineScreen, "Examine Screen Actor");
|
|
||||||
AddSpecial(ScreenActor.FittingRoom, "Fitting Room Actor");
|
|
||||||
AddSpecial(ScreenActor.DyePreview, "Dye Preview Actor");
|
|
||||||
AddSpecial(ScreenActor.Portrait, "Portrait Actor");
|
|
||||||
AddSpecial(ScreenActor.Card6, "Card Actor 6");
|
|
||||||
AddSpecial(ScreenActor.Card7, "Card Actor 7");
|
|
||||||
AddSpecial(ScreenActor.Card8, "Card Actor 8");
|
|
||||||
|
|
||||||
foreach (var actor in EventNpcs)
|
|
||||||
{
|
|
||||||
if (actor.Identifier(actors, out var identifier))
|
|
||||||
HandleIdentifier(identifier, actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
//C+ custom
|
|
||||||
IsInLobby = AddLobbyCharacters();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleIdentifier(ActorIdentifier identifier, Actor character)
|
|
||||||
{
|
|
||||||
if (!identifier.IsValid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!_identifiers.TryGetValue(identifier, out var data))
|
|
||||||
{
|
|
||||||
data = new ActorData(character, identifier.ToString());
|
|
||||||
_identifiers[identifier] = data;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data.Objects.Add(character);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (identifier.Type is IdentifierType.Player or IdentifierType.Owned)
|
|
||||||
{
|
|
||||||
var allWorld = actors.CreateIndividualUnchecked(identifier.Type, identifier.PlayerName, ushort.MaxValue,
|
|
||||||
identifier.Kind,
|
|
||||||
identifier.DataId);
|
|
||||||
|
|
||||||
if (!_allWorldIdentifiers.TryGetValue(allWorld, out var allWorldData))
|
|
||||||
{
|
|
||||||
allWorldData = new ActorData(character, allWorld.ToString());
|
|
||||||
_allWorldIdentifiers[allWorld] = allWorldData;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
allWorldData.Objects.Add(character);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (identifier.Type is IdentifierType.Owned)
|
|
||||||
{
|
|
||||||
var nonOwned = actors.CreateNpc(identifier.Kind, identifier.DataId);
|
|
||||||
if (!_nonOwnedIdentifiers.TryGetValue(nonOwned, out var nonOwnedData))
|
|
||||||
{
|
|
||||||
nonOwnedData = new ActorData(character, nonOwned.ToString());
|
|
||||||
_nonOwnedIdentifiers[nonOwned] = nonOwnedData;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nonOwnedData.Objects.Add(character);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Actor GPosePlayer
|
|
||||||
=> this[(int)ScreenActor.GPosePlayer];
|
|
||||||
|
|
||||||
public Actor Player
|
|
||||||
=> this[0];
|
|
||||||
|
|
||||||
public unsafe Actor Target
|
|
||||||
=> clientState.IsGPosing ? TargetSystem.Instance()->GPoseTarget : TargetSystem.Instance()->Target;
|
|
||||||
|
|
||||||
public Actor Focus
|
|
||||||
=> targets.FocusTarget?.Address ?? nint.Zero;
|
|
||||||
|
|
||||||
public Actor MouseOver
|
|
||||||
=> targets.MouseOverTarget?.Address ?? nint.Zero;
|
|
||||||
|
|
||||||
public (ActorIdentifier Identifier, ActorData Data) PlayerData
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
Update();
|
|
||||||
return Player.Identifier(actors, out var ident) && _identifiers.TryGetValue(ident, out var data)
|
|
||||||
? (ident, data)
|
|
||||||
: (ident, ActorData.Invalid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public (ActorIdentifier Identifier, ActorData Data) TargetData
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
Update();
|
|
||||||
return Target.Identifier(actors, out var ident) && _identifiers.TryGetValue(ident, out var data)
|
|
||||||
? (ident, data)
|
|
||||||
: (ident, ActorData.Invalid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Also handles All Worlds players and non-owned NPCs. </summary>
|
|
||||||
public bool ContainsKey(ActorIdentifier key)
|
|
||||||
=> Identifiers.ContainsKey(key) || _allWorldIdentifiers.ContainsKey(key) || _nonOwnedIdentifiers.ContainsKey(key);
|
|
||||||
|
|
||||||
public bool TryGetValue(ActorIdentifier key, out ActorData value)
|
|
||||||
=> Identifiers.TryGetValue(key, out value);
|
|
||||||
|
|
||||||
public bool TryGetValueAllWorld(ActorIdentifier key, out ActorData value)
|
|
||||||
=> _allWorldIdentifiers.TryGetValue(key, out value);
|
|
||||||
|
|
||||||
public bool TryGetValueNonOwned(ActorIdentifier key, out ActorData value)
|
|
||||||
=> _nonOwnedIdentifiers.TryGetValue(key, out value);
|
|
||||||
|
|
||||||
public ActorData this[ActorIdentifier key]
|
|
||||||
=> Identifiers[key];
|
|
||||||
|
|
||||||
public IEnumerable<ActorIdentifier> Keys
|
|
||||||
=> Identifiers.Keys;
|
|
||||||
|
|
||||||
public IEnumerable<ActorData> Values
|
|
||||||
=> Identifiers.Values;
|
|
||||||
|
|
||||||
public bool GetName(string lowerName, out Actor actor)
|
|
||||||
{
|
|
||||||
(actor, var ret) = lowerName switch
|
|
||||||
{
|
|
||||||
"" => (Actor.Null, true),
|
|
||||||
"<me>" => (Player, true),
|
|
||||||
"self" => (Player, true),
|
|
||||||
"<t>" => (Target, true),
|
|
||||||
"target" => (Target, true),
|
|
||||||
"<f>" => (Focus, true),
|
|
||||||
"focus" => (Focus, true),
|
|
||||||
"<mo>" => (MouseOver, true),
|
|
||||||
"mouseover" => (MouseOver, true),
|
|
||||||
_ => (Actor.Null, false),
|
|
||||||
};
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
//c+ custom
|
|
||||||
private unsafe bool AddLobbyCharacters()
|
|
||||||
{
|
|
||||||
if (clientState.IsLoggedIn)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var agent = AgentLobby.Instance();
|
|
||||||
if (agent == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var span = agent->LobbyData.CharaSelectEntries.AsSpan();
|
|
||||||
|
|
||||||
// The lobby uses the first 8 cutscene actors.
|
|
||||||
int cnt = 0;
|
|
||||||
foreach (var actor in CutsceneCharacters.Take(8))
|
|
||||||
{
|
|
||||||
if (!actor.Valid) //shouldn't happen so should be safe to break?
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (cnt >= span.Length)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (span[cnt].Value == null) //should mean the end of valid actors so should be safe to break?
|
|
||||||
break;
|
|
||||||
|
|
||||||
var chara = span[cnt].Value;
|
|
||||||
HandleIdentifier(actors.CreatePlayer(new ByteString(chara->Name), chara->HomeWorldId), actor);
|
|
||||||
|
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
52
CustomizePlus.GameData/packages.lock.json
Normal file
52
CustomizePlus.GameData/packages.lock.json
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"dependencies": {
|
||||||
|
"net9.0-windows7.0": {
|
||||||
|
"DotNet.ReproducibleBuilds": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[1.2.25, )",
|
||||||
|
"resolved": "1.2.25",
|
||||||
|
"contentHash": "xCXiw7BCxHJ8pF6wPepRUddlh2dlQlbr81gXA72hdk4FLHkKXas7EH/n+fk5UCA/YfMqG1Z6XaPiUjDbUNBUzg=="
|
||||||
|
},
|
||||||
|
"JetBrains.Annotations": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2024.3.0",
|
||||||
|
"contentHash": "ox5pkeLQXjvJdyAB4b2sBYAlqZGLh3PjSnP1bQNVx72ONuTJ9+34/+Rq91Fc0dG29XG9RgZur9+NcP4riihTug=="
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.DependencyInjection": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.2",
|
||||||
|
"contentHash": "ZffbJrskOZ40JTzcTyKwFHS5eACSWp2bUQBBApIgGV+es8RaTD4OxUG7XxFr3RIPLXtYQ1jQzF2DjKB5fZn7Qg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.DependencyInjection.Abstractions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.2",
|
||||||
|
"contentHash": "MNe7GSTBf3jQx5vYrXF0NZvn6l7hUKF6J54ENfAgCO8y6xjN1XUmKKWG464LP2ye6QqDiA1dkaWEZBYnhoZzjg=="
|
||||||
|
},
|
||||||
|
"ottergui": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"JetBrains.Annotations": "[2024.3.0, )",
|
||||||
|
"Microsoft.Extensions.DependencyInjection": "[9.0.2, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"penumbra.api": {
|
||||||
|
"type": "Project"
|
||||||
|
},
|
||||||
|
"penumbra.gamedata": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"OtterGui": "[1.0.0, )",
|
||||||
|
"Penumbra.Api": "[5.6.1, )",
|
||||||
|
"Penumbra.String": "[1.0.6, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"penumbra.string": {
|
||||||
|
"type": "Project"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,6 @@ 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;
|
||||||
using ObjectManager = CustomizePlus.GameData.Services.ObjectManager;
|
|
||||||
|
|
||||||
namespace CustomizePlus.Armatures.Services;
|
namespace CustomizePlus.Armatures.Services;
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ public unsafe sealed class ArmatureManager : IDisposable
|
|||||||
private readonly ProfileChanged _profileChangedEvent;
|
private readonly ProfileChanged _profileChangedEvent;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
private readonly FrameworkManager _framework;
|
private readonly FrameworkManager _framework;
|
||||||
private readonly ObjectManager _objectManager;
|
private readonly ActorObjectManager _objectManager;
|
||||||
private readonly ActorManager _actorManager;
|
private readonly ActorManager _actorManager;
|
||||||
private readonly GPoseService _gposeService;
|
private readonly GPoseService _gposeService;
|
||||||
private readonly ArmatureChanged _event;
|
private readonly ArmatureChanged _event;
|
||||||
@@ -53,7 +52,7 @@ public unsafe sealed class ArmatureManager : IDisposable
|
|||||||
ProfileChanged profileChangedEvent,
|
ProfileChanged profileChangedEvent,
|
||||||
Logger logger,
|
Logger logger,
|
||||||
FrameworkManager framework,
|
FrameworkManager framework,
|
||||||
ObjectManager objectManager,
|
ActorObjectManager objectManager,
|
||||||
ActorManager actorManager,
|
ActorManager actorManager,
|
||||||
GPoseService gposeService,
|
GPoseService gposeService,
|
||||||
ArmatureChanged @event)
|
ArmatureChanged @event)
|
||||||
@@ -125,8 +124,6 @@ public unsafe sealed class ArmatureManager : IDisposable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void RefreshArmatures()
|
private void RefreshArmatures()
|
||||||
{
|
{
|
||||||
_objectManager.Update();
|
|
||||||
|
|
||||||
var currentTime = DateTime.UtcNow;
|
var currentTime = DateTime.UtcNow;
|
||||||
var armatureExpirationDateTime = currentTime.AddSeconds(-30);
|
var armatureExpirationDateTime = currentTime.AddSeconds(-30);
|
||||||
foreach (var kvPair in Armatures.ToList())
|
foreach (var kvPair in Armatures.ToList())
|
||||||
@@ -134,7 +131,7 @@ public unsafe sealed class ArmatureManager : IDisposable
|
|||||||
var armature = kvPair.Value;
|
var armature = kvPair.Value;
|
||||||
//Only remove armatures which haven't been seen for a while
|
//Only remove armatures which haven't been seen for a while
|
||||||
//But remove armatures of special actors (like examine screen) right away
|
//But remove armatures of special actors (like examine screen) right away
|
||||||
if (!_objectManager.Identifiers.ContainsKey(kvPair.Value.ActorIdentifier) &&
|
if (!_objectManager.ContainsKey(kvPair.Value.ActorIdentifier) &&
|
||||||
(armature.LastSeen <= armatureExpirationDateTime || armature.ActorIdentifier.Type == IdentifierType.Special))
|
(armature.LastSeen <= armatureExpirationDateTime || armature.ActorIdentifier.Type == IdentifierType.Special))
|
||||||
{
|
{
|
||||||
_logger.Debug($"Removing armature {armature} because {kvPair.Key.IncognitoDebug()} is gone");
|
_logger.Debug($"Removing armature {armature} because {kvPair.Key.IncognitoDebug()} is gone");
|
||||||
@@ -147,7 +144,7 @@ public unsafe sealed class ArmatureManager : IDisposable
|
|||||||
armature.IsVisible = armature.LastSeen.AddSeconds(1) >= currentTime;
|
armature.IsVisible = armature.LastSeen.AddSeconds(1) >= currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var obj in _objectManager.Identifiers)
|
foreach (var obj in _objectManager)
|
||||||
{
|
{
|
||||||
var actorIdentifier = obj.Key.CreatePermanent();
|
var actorIdentifier = obj.Key.CreatePermanent();
|
||||||
if (!Armatures.ContainsKey(actorIdentifier))
|
if (!Armatures.ContainsKey(actorIdentifier))
|
||||||
@@ -243,9 +240,8 @@ public unsafe sealed class ArmatureManager : IDisposable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool TryLinkSkeleton(Armature armature)
|
private bool TryLinkSkeleton(Armature armature)
|
||||||
{
|
{
|
||||||
_objectManager.Update();
|
|
||||||
|
|
||||||
if (!_objectManager.Identifiers.ContainsKey(armature.ActorIdentifier))
|
if (!_objectManager.ContainsKey(armature.ActorIdentifier))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var actor = _objectManager[armature.ActorIdentifier].Objects[0];
|
var actor = _objectManager[armature.ActorIdentifier].Objects[0];
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ using OtterGui.Log;
|
|||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
using OtterGui.Services;
|
using OtterGui.Services;
|
||||||
using Penumbra.GameData.Actors;
|
using Penumbra.GameData.Actors;
|
||||||
|
using Penumbra.GameData.Interop;
|
||||||
using Penumbra.GameData.Structs;
|
using Penumbra.GameData.Structs;
|
||||||
|
|
||||||
namespace CustomizePlus.Core;
|
namespace CustomizePlus.Core;
|
||||||
@@ -60,7 +61,7 @@ public static class ServiceManagerBuilder
|
|||||||
|
|
||||||
services.AddIServices(typeof(EquipItem).Assembly);
|
services.AddIServices(typeof(EquipItem).Assembly);
|
||||||
services.AddIServices(typeof(Plugin).Assembly);
|
services.AddIServices(typeof(Plugin).Assembly);
|
||||||
services.AddIServices(typeof(ObjectManager).Assembly);
|
services.AddIServices(typeof(CutsceneService).Assembly);
|
||||||
services.AddIServices(typeof(ImRaii).Assembly);
|
services.AddIServices(typeof(ImRaii).Assembly);
|
||||||
|
|
||||||
services.CreateProvider();
|
services.CreateProvider();
|
||||||
@@ -206,7 +207,7 @@ public static class ServiceManagerBuilder
|
|||||||
.AddSingleton<CutsceneService>()
|
.AddSingleton<CutsceneService>()
|
||||||
.AddSingleton<GameEventManager>()
|
.AddSingleton<GameEventManager>()
|
||||||
.AddSingleton(p => new CutsceneResolver(idx => (short)p.GetRequiredService<CutsceneService>().GetParentIndex(idx)))
|
.AddSingleton(p => new CutsceneResolver(idx => (short)p.GetRequiredService<CutsceneService>().GetParentIndex(idx)))
|
||||||
.AddSingleton<ObjectManager>();
|
.AddSingleton<ActorObjectManager>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using Dalamud.Plugin.Services;
|
|||||||
using Penumbra.GameData.Actors;
|
using Penumbra.GameData.Actors;
|
||||||
using Penumbra.GameData.Enums;
|
using Penumbra.GameData.Enums;
|
||||||
using Penumbra.GameData.Interop;
|
using Penumbra.GameData.Interop;
|
||||||
using ObjectManager = CustomizePlus.GameData.Services.ObjectManager;
|
|
||||||
using DalamudGameObject = Dalamud.Game.ClientState.Objects.Types.IGameObject;
|
using DalamudGameObject = Dalamud.Game.ClientState.Objects.Types.IGameObject;
|
||||||
using CustomizePlus.Configuration.Data;
|
using CustomizePlus.Configuration.Data;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||||
@@ -17,13 +16,13 @@ public class GameObjectService
|
|||||||
{
|
{
|
||||||
private readonly ActorManager _actorManager;
|
private readonly ActorManager _actorManager;
|
||||||
private readonly IObjectTable _objectTable;
|
private readonly IObjectTable _objectTable;
|
||||||
private readonly ObjectManager _objectManager;
|
private readonly ActorObjectManager _objectManager;
|
||||||
private readonly PluginConfiguration _configuration;
|
private readonly PluginConfiguration _configuration;
|
||||||
|
|
||||||
public GameObjectService(
|
public GameObjectService(
|
||||||
ActorManager actorManager,
|
ActorManager actorManager,
|
||||||
IObjectTable objectTable,
|
IObjectTable objectTable,
|
||||||
ObjectManager objectManager,
|
ActorObjectManager objectManager,
|
||||||
PluginConfiguration configuration)
|
PluginConfiguration configuration)
|
||||||
{
|
{
|
||||||
_actorManager = actorManager;
|
_actorManager = actorManager;
|
||||||
@@ -62,9 +61,7 @@ public class GameObjectService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<(ActorIdentifier, Actor)> FindActorsByName(string name)
|
public IEnumerable<(ActorIdentifier, Actor)> FindActorsByName(string name)
|
||||||
{
|
{
|
||||||
_objectManager.Update();
|
foreach (var kvPair in _objectManager)
|
||||||
|
|
||||||
foreach (var kvPair in _objectManager.Identifiers)
|
|
||||||
{
|
{
|
||||||
var identifier = kvPair.Key;
|
var identifier = kvPair.Key;
|
||||||
|
|
||||||
@@ -92,9 +89,7 @@ public class GameObjectService
|
|||||||
if (!identifier.IsValid)
|
if (!identifier.IsValid)
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
_objectManager.Update();
|
foreach (var kvPair in _objectManager)
|
||||||
|
|
||||||
foreach (var kvPair in _objectManager.Identifiers)
|
|
||||||
{
|
{
|
||||||
var objectIdentifier = kvPair.Key;
|
var objectIdentifier = kvPair.Key;
|
||||||
|
|
||||||
@@ -116,7 +111,6 @@ public class GameObjectService
|
|||||||
|
|
||||||
public Actor GetLocalPlayerActor()
|
public Actor GetLocalPlayerActor()
|
||||||
{
|
{
|
||||||
_objectManager.Update();
|
|
||||||
return _objectManager.Player;
|
return _objectManager.Player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,10 +173,10 @@ public class GameObjectService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Actor? GetActorByObjectIndex(ushort objectIndex)
|
public Actor? GetActorByObjectIndex(ushort objectIndex)
|
||||||
{
|
{
|
||||||
if (objectIndex < 0 || objectIndex >= _objectManager.TotalCount)
|
if (objectIndex < 0 || objectIndex >= _objectManager.Objects.TotalCount)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var ptr = _objectManager[(int)objectIndex];
|
var ptr = _objectManager.Objects[(int)objectIndex];
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ using Penumbra.GameData.Enums;
|
|||||||
using Penumbra.GameData.Interop;
|
using Penumbra.GameData.Interop;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using CustomizePlus.Game.Services;
|
using CustomizePlus.Game.Services;
|
||||||
using ObjectManager = CustomizePlus.GameData.Services.ObjectManager;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@ public partial class ProfileManager : IDisposable
|
|||||||
private readonly PluginConfiguration _configuration;
|
private readonly PluginConfiguration _configuration;
|
||||||
private readonly ActorManager _actorManager;
|
private readonly ActorManager _actorManager;
|
||||||
private readonly GameObjectService _gameObjectService;
|
private readonly GameObjectService _gameObjectService;
|
||||||
private readonly ObjectManager _objectManager;
|
private readonly ActorObjectManager _objectManager;
|
||||||
private readonly ReverseNameDicts _reverseNameDicts;
|
private readonly ReverseNameDicts _reverseNameDicts;
|
||||||
private readonly MessageService _messageService;
|
private readonly MessageService _messageService;
|
||||||
private readonly ProfileChanged _event;
|
private readonly ProfileChanged _event;
|
||||||
@@ -66,7 +65,7 @@ public partial class ProfileManager : IDisposable
|
|||||||
PluginConfiguration configuration,
|
PluginConfiguration configuration,
|
||||||
ActorManager actorManager,
|
ActorManager actorManager,
|
||||||
GameObjectService gameObjectService,
|
GameObjectService gameObjectService,
|
||||||
ObjectManager objectManager,
|
ActorObjectManager objectManager,
|
||||||
ReverseNameDicts reverseNameDicts,
|
ReverseNameDicts reverseNameDicts,
|
||||||
MessageService messageService,
|
MessageService messageService,
|
||||||
ProfileChanged @event,
|
ProfileChanged @event,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using CustomizePlus.Core.Extensions;
|
|||||||
using CustomizePlus.Configuration.Data;
|
using CustomizePlus.Configuration.Data;
|
||||||
using CustomizePlus.Api.Data;
|
using CustomizePlus.Api.Data;
|
||||||
using CustomizePlus.GameData.Extensions;
|
using CustomizePlus.GameData.Extensions;
|
||||||
|
using Penumbra.GameData.Interop;
|
||||||
|
|
||||||
namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug;
|
namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug;
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ public class IPCTestTab //: IDisposable
|
|||||||
private readonly ProfileManager _profileManager;
|
private readonly ProfileManager _profileManager;
|
||||||
private readonly PopupSystem _popupSystem;
|
private readonly PopupSystem _popupSystem;
|
||||||
private readonly GameObjectService _gameObjectService;
|
private readonly GameObjectService _gameObjectService;
|
||||||
private readonly ObjectManager _objectManager;
|
private readonly ActorObjectManager _objectManager;
|
||||||
private readonly ActorManager _actorManager;
|
private readonly ActorManager _actorManager;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ public class IPCTestTab //: IDisposable
|
|||||||
IObjectTable objectTable,
|
IObjectTable objectTable,
|
||||||
ProfileManager profileManager,
|
ProfileManager profileManager,
|
||||||
PopupSystem popupSystem,
|
PopupSystem popupSystem,
|
||||||
ObjectManager objectManager,
|
ActorObjectManager objectManager,
|
||||||
GameObjectService gameObjectService,
|
GameObjectService gameObjectService,
|
||||||
ActorManager actorManager,
|
ActorManager actorManager,
|
||||||
Logger logger,
|
Logger logger,
|
||||||
@@ -115,8 +116,6 @@ public class IPCTestTab //: IDisposable
|
|||||||
|
|
||||||
public unsafe void Draw()
|
public unsafe void Draw()
|
||||||
{
|
{
|
||||||
_objectManager.Update();
|
|
||||||
|
|
||||||
if (_targetCharacterName == null)
|
if (_targetCharacterName == null)
|
||||||
_targetCharacterName = _gameObjectService.GetCurrentPlayerName();
|
_targetCharacterName = _gameObjectService.GetCurrentPlayerName();
|
||||||
|
|
||||||
@@ -136,7 +135,7 @@ public class IPCTestTab //: IDisposable
|
|||||||
if (ImGui.Button("Owned Actors Temporary Profile Test"))
|
if (ImGui.Button("Owned Actors Temporary Profile Test"))
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(var obj in _objectManager)
|
foreach(var obj in _objectManager.Objects)
|
||||||
{
|
{
|
||||||
if (!obj.Identifier(_actorManager, out var ownedIdent) ||
|
if (!obj.Identifier(_actorManager, out var ownedIdent) ||
|
||||||
ownedIdent.Type != Penumbra.GameData.Enums.IdentifierType.Owned ||
|
ownedIdent.Type != Penumbra.GameData.Enums.IdentifierType.Owned ||
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using CustomizePlus.Core.Extensions;
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using CustomizePlus.Game.Services;
|
using CustomizePlus.Game.Services;
|
||||||
using CustomizePlus.Core.Data;
|
using CustomizePlus.Core.Data;
|
||||||
|
using Penumbra.GameData.Interop;
|
||||||
|
|
||||||
namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug;
|
namespace CustomizePlus.UI.Windows.MainWindow.Tabs.Debug;
|
||||||
|
|
||||||
@@ -21,14 +22,14 @@ public class StateMonitoringTab
|
|||||||
private readonly ProfileManager _profileManager;
|
private readonly ProfileManager _profileManager;
|
||||||
private readonly TemplateManager _templateManager;
|
private readonly TemplateManager _templateManager;
|
||||||
private readonly ArmatureManager _armatureManager;
|
private readonly ArmatureManager _armatureManager;
|
||||||
private readonly ObjectManager _objectManager;
|
private readonly ActorObjectManager _objectManager;
|
||||||
private readonly GameObjectService _gameObjectService;
|
private readonly GameObjectService _gameObjectService;
|
||||||
|
|
||||||
public StateMonitoringTab(
|
public StateMonitoringTab(
|
||||||
ProfileManager profileManager,
|
ProfileManager profileManager,
|
||||||
TemplateManager templateManager,
|
TemplateManager templateManager,
|
||||||
ArmatureManager armatureManager,
|
ArmatureManager armatureManager,
|
||||||
ObjectManager objectManager,
|
ActorObjectManager objectManager,
|
||||||
GameObjectService gameObjectService)
|
GameObjectService gameObjectService)
|
||||||
{
|
{
|
||||||
_profileManager = profileManager;
|
_profileManager = profileManager;
|
||||||
@@ -55,7 +56,7 @@ public class StateMonitoringTab
|
|||||||
if (showArmatures)
|
if (showArmatures)
|
||||||
DrawArmatures();
|
DrawArmatures();
|
||||||
|
|
||||||
var showObjectManager = ImGui.CollapsingHeader($"Object manager ({_objectManager.Identifiers.Count})###objectmanager_header");
|
var showObjectManager = ImGui.CollapsingHeader($"Object manager ({_objectManager.Count})###objectmanager_header");
|
||||||
|
|
||||||
if (showObjectManager)
|
if (showObjectManager)
|
||||||
DrawObjectManager();
|
DrawObjectManager();
|
||||||
@@ -93,7 +94,7 @@ public class StateMonitoringTab
|
|||||||
|
|
||||||
private void DrawObjectManager()
|
private void DrawObjectManager()
|
||||||
{
|
{
|
||||||
foreach (var kvPair in _objectManager.Identifiers)
|
foreach (var kvPair in _objectManager)
|
||||||
{
|
{
|
||||||
var show = ImGui.CollapsingHeader($"{kvPair.Key} ({kvPair.Value.Objects.Count} objects)###object-{kvPair.Key}");
|
var show = ImGui.CollapsingHeader($"{kvPair.Key} ({kvPair.Value.Objects.Count} objects)###object-{kvPair.Key}");
|
||||||
|
|
||||||
|
|||||||
102
CustomizePlus/packages.lock.json
Normal file
102
CustomizePlus/packages.lock.json
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"dependencies": {
|
||||||
|
"net9.0-windows7.0": {
|
||||||
|
"DalamudPackager": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[12.0.0, )",
|
||||||
|
"resolved": "12.0.0",
|
||||||
|
"contentHash": "J5TJLV3f16T/E2H2P17ClWjtfEBPpq3yxvqW46eN36JCm6wR+EaoaYkqG9Rm5sHqs3/nK/vKjWWyvEs/jhKoXw=="
|
||||||
|
},
|
||||||
|
"DotNet.ReproducibleBuilds": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[1.2.25, )",
|
||||||
|
"resolved": "1.2.25",
|
||||||
|
"contentHash": "xCXiw7BCxHJ8pF6wPepRUddlh2dlQlbr81gXA72hdk4FLHkKXas7EH/n+fk5UCA/YfMqG1Z6XaPiUjDbUNBUzg=="
|
||||||
|
},
|
||||||
|
"GitInfo": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[3.3.5, )",
|
||||||
|
"resolved": "3.3.5",
|
||||||
|
"contentHash": "xt8tAMq42KompgmZI5fpko9IY9cuGqjvNFCc+B6iZeoCHlqcbuGZz33SFD+jTsPZTFfrxqTXvywm/s8DcFcEIg==",
|
||||||
|
"dependencies": {
|
||||||
|
"ThisAssembly.Constants": "1.4.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.DependencyInjection": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[9.0.2, )",
|
||||||
|
"resolved": "9.0.2",
|
||||||
|
"contentHash": "ZffbJrskOZ40JTzcTyKwFHS5eACSWp2bUQBBApIgGV+es8RaTD4OxUG7XxFr3RIPLXtYQ1jQzF2DjKB5fZn7Qg==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"StyleCop.Analyzers": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[1.1.118, )",
|
||||||
|
"resolved": "1.1.118",
|
||||||
|
"contentHash": "Onx6ovGSqXSK07n/0eM3ZusiNdB6cIlJdabQhWGgJp3Vooy9AaLS/tigeybOJAobqbtggTamoWndz72JscZBvw=="
|
||||||
|
},
|
||||||
|
"JetBrains.Annotations": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "2024.3.0",
|
||||||
|
"contentHash": "ox5pkeLQXjvJdyAB4b2sBYAlqZGLh3PjSnP1bQNVx72ONuTJ9+34/+Rq91Fc0dG29XG9RgZur9+NcP4riihTug=="
|
||||||
|
},
|
||||||
|
"Microsoft.CSharp": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.7.0",
|
||||||
|
"contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA=="
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.DependencyInjection.Abstractions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "9.0.2",
|
||||||
|
"contentHash": "MNe7GSTBf3jQx5vYrXF0NZvn6l7hUKF6J54ENfAgCO8y6xjN1XUmKKWG464LP2ye6QqDiA1dkaWEZBYnhoZzjg=="
|
||||||
|
},
|
||||||
|
"System.Threading.Tasks.Extensions": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "4.5.4",
|
||||||
|
"contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg=="
|
||||||
|
},
|
||||||
|
"ThisAssembly.Constants": {
|
||||||
|
"type": "Transitive",
|
||||||
|
"resolved": "1.4.1",
|
||||||
|
"contentHash": "sV0CDYlC6YSIkYbdwd4+jRinLb888Dac71pmNhF2Ll6UXY1J+1oVt3EfmX6euXEKz2RLdfV+4GyZctfEA0NSqA==",
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.CSharp": "4.7.0",
|
||||||
|
"System.Threading.Tasks.Extensions": "4.5.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"customizeplus.gamedata": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"Penumbra.GameData": "[1.0.0, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ecommonslite": {
|
||||||
|
"type": "Project"
|
||||||
|
},
|
||||||
|
"ottergui": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"JetBrains.Annotations": "[2024.3.0, )",
|
||||||
|
"Microsoft.Extensions.DependencyInjection": "[9.0.2, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"penumbra.api": {
|
||||||
|
"type": "Project"
|
||||||
|
},
|
||||||
|
"penumbra.gamedata": {
|
||||||
|
"type": "Project",
|
||||||
|
"dependencies": {
|
||||||
|
"OtterGui": "[1.0.0, )",
|
||||||
|
"Penumbra.Api": "[5.6.1, )",
|
||||||
|
"Penumbra.String": "[1.0.6, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"penumbra.string": {
|
||||||
|
"type": "Project"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Submodule submodules/OtterGui updated: 3396ee176f...f53fd227a2
Submodule submodules/Penumbra.GameData updated: ab63da8047...801e98a295
Reference in New Issue
Block a user