Fix issue with assigning indexed npcs.

This commit is contained in:
Ottermandias 2023-03-05 14:52:28 +01:00
parent 009499cdf6
commit 64c8f29c47
9 changed files with 31 additions and 29 deletions

View file

@ -848,7 +848,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
return PenumbraApiEc.InvalidArgument;
}
var identifier = Penumbra.Actors.FromObject( Dalamud.Objects[ actorIndex ], false, false );
var identifier = Penumbra.Actors.FromObject( Dalamud.Objects[ actorIndex ], false, false, true );
if( !identifier.IsValid )
{
return PenumbraApiEc.InvalidArgument;
@ -1042,7 +1042,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
}
var ptr = ( FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject* )Dalamud.Objects.GetObjectAddress( gameObjectIdx );
return Penumbra.Actors.FromObject( ptr, out _, false, true );
return Penumbra.Actors.FromObject( ptr, out _, false, true, true );
}
// Resolve a path given by string for a specific collection.

View file

@ -143,10 +143,10 @@ public sealed partial class IndividualCollections : IReadOnlyList< (string Displ
}
public bool TryGetCollection( GameObject? gameObject, out ModCollection? collection )
=> TryGetCollection( _actorManager.FromObject( gameObject, true, false ), out collection );
=> TryGetCollection( _actorManager.FromObject( gameObject, true, false, false ), out collection );
public unsafe bool TryGetCollection( FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject* gameObject, out ModCollection? collection )
=> TryGetCollection( _actorManager.FromObject( gameObject, out _, true, false ), out collection );
=> TryGetCollection( _actorManager.FromObject( gameObject, out _, true, false, false ), out collection );
private bool CheckWorlds( ActorIdentifier identifier, out ModCollection? collection )
{

View file

@ -47,7 +47,7 @@ public readonly struct ResolveData
try
{
var id = Penumbra.Actors.FromObject( ( GameObject* )AssociatedGameObject, out _, false, true );
var id = Penumbra.Actors.FromObject( ( GameObject* )AssociatedGameObject, out _, false, true, true );
if( id.IsValid )
{
var name = id.ToString();

View file

@ -297,7 +297,7 @@ public class CommandHandler : IDisposable
{
if( ObjectReloader.GetName( split[ 2 ].ToLowerInvariant(), out var obj ) )
{
identifier = _actors.FromObject( obj, false, true );
identifier = _actors.FromObject( obj, false, true, true );
if( !identifier.IsValid )
{
Dalamud.Chat.Print( new SeStringBuilder().AddText( "The placeholder " ).AddGreen( split[ 2 ] )

View file

@ -56,7 +56,7 @@ public unsafe partial class PathResolver
return IdentifiedCache.Set( collection2, ActorIdentifier.Invalid, gameObject );
}
var identifier = Penumbra.Actors.FromObject( gameObject, out var owner, true, false );
var identifier = Penumbra.Actors.FromObject( gameObject, out var owner, true, false, false );
if( identifier.Type is IdentifierType.Special )
{
( identifier, var type ) = Penumbra.CollectionManager.Individuals.ConvertSpecialIdentifier( identifier );

View file

@ -243,10 +243,10 @@ public partial class ConfigWindow
var buttonWidth1 = new Vector2( 90 * ImGuiHelpers.GlobalScale, 0 );
var buttonWidth2 = new Vector2( 120 * ImGuiHelpers.GlobalScale, 0 );
var assignWidth = new Vector2((_window._inputTextWidth.X - ImGui.GetStyle().ItemSpacing.X) / 2, 0);
var change = DrawNewCurrentPlayerCollection(assignWidth);
var assignWidth = new Vector2( ( _window._inputTextWidth.X - ImGui.GetStyle().ItemSpacing.X ) / 2, 0 );
var change = DrawNewCurrentPlayerCollection( assignWidth );
ImGui.SameLine();
change |= DrawNewTargetCollection(assignWidth);
change |= DrawNewTargetCollection( assignWidth );
change |= DrawNewPlayerCollection( buttonWidth1, width );
ImGui.SameLine();
@ -263,7 +263,7 @@ public partial class ConfigWindow
}
}
private static bool DrawNewCurrentPlayerCollection(Vector2 width)
private static bool DrawNewCurrentPlayerCollection( Vector2 width )
{
var player = Penumbra.Actors.GetCurrentPlayer();
var result = Penumbra.CollectionManager.Individuals.CanAdd( player );
@ -285,10 +285,10 @@ public partial class ConfigWindow
return false;
}
private static bool DrawNewTargetCollection(Vector2 width)
private static bool DrawNewTargetCollection( Vector2 width )
{
var target = Dalamud.Targets.Target;
var player = Penumbra.Actors.FromObject( target, false, true );
var player = Penumbra.Actors.FromObject( target, false, true, true );
var result = Penumbra.CollectionManager.Individuals.CanAdd( player );
var tt = result switch
{
@ -299,7 +299,7 @@ public partial class ConfigWindow
};
if( ImGuiUtil.DrawDisabledButton( "Assign Current Target", width, tt, result != IndividualCollections.AddResult.Valid ) )
{
Penumbra.CollectionManager.Individuals.Add( new[] { player }, Penumbra.CollectionManager.Default );
Penumbra.CollectionManager.Individuals.Add( Penumbra.CollectionManager.Individuals.GetGroup( player ), Penumbra.CollectionManager.Default );
return true;
}

View file

@ -215,7 +215,7 @@ public partial class ConfigWindow
{
ImGuiUtil.DrawTableColumn( $"{( ( GameObject* )obj.Address )->ObjectIndex}" );
ImGuiUtil.DrawTableColumn( $"0x{obj.Address:X}" );
var identifier = Penumbra.Actors.FromObject( obj, false, true );
var identifier = Penumbra.Actors.FromObject( obj, false, true, false );
ImGuiUtil.DrawTableColumn( Penumbra.Actors.ToString( identifier ) );
var id = obj.ObjectKind == ObjectKind.BattleNpc ? $"{identifier.DataId} | {obj.DataId}" : identifier.DataId.ToString();
ImGuiUtil.DrawTableColumn( id );