Try to use player collection during aesthetician.

This commit is contained in:
Ottermandias 2022-12-05 19:48:41 +01:00
parent cac6017392
commit c800f3191f

View file

@ -34,24 +34,33 @@ public unsafe partial class PathResolver
// Login screen. Names are populated after actors are drawn, // Login screen. Names are populated after actors are drawn,
// so it is not possible to fetch names from the ui list. // so it is not possible to fetch names from the ui list.
// Actors are also not named. So use Yourself > Players > Racial > Default. // Actors are also not named. So use Yourself > Players > Racial > Default.
if( !Dalamud.ClientState.IsLoggedIn || Dalamud.GameGui.GetAddonByName( "ScreenLog", 1 ) == IntPtr.Zero ) if( !Dalamud.ClientState.IsLoggedIn )
{ {
var collection = Penumbra.CollectionManager.ByType( CollectionType.Yourself ) var collection2 = Penumbra.CollectionManager.ByType( CollectionType.Yourself )
?? CollectionByAttributes( gameObject ) ?? CollectionByAttributes( gameObject )
?? Penumbra.CollectionManager.Default; ?? Penumbra.CollectionManager.Default;
return IdentifiedCache.Set( collection, ActorIdentifier.Invalid, gameObject ); return IdentifiedCache.Set( collection2, ActorIdentifier.Invalid, gameObject );
} }
else
// Aesthetician. The relevant actor is yourself, so use player collection when possible.
if( Dalamud.GameGui.GetAddonByName( "ScreenLog", 1 ) == IntPtr.Zero )
{ {
var identifier = Penumbra.Actors.FromObject( gameObject, out var owner, false ); var player = Penumbra.Actors.GetCurrentPlayer();
identifier = Penumbra.CollectionManager.Individuals.ConvertSpecialIdentifier( identifier ); var collection2 = ( player.IsValid ? CollectionByIdentifier( player ) : null )
var collection = CollectionByIdentifier( identifier ) ?? Penumbra.CollectionManager.ByType( CollectionType.Yourself )
?? CheckYourself( identifier, gameObject )
?? CollectionByAttributes( gameObject ) ?? CollectionByAttributes( gameObject )
?? CheckOwnedCollection( identifier, owner )
?? Penumbra.CollectionManager.Default; ?? Penumbra.CollectionManager.Default;
return IdentifiedCache.Set( collection, identifier, gameObject ); return IdentifiedCache.Set( collection2, ActorIdentifier.Invalid, gameObject );
} }
var identifier = Penumbra.Actors.FromObject( gameObject, out var owner, false );
identifier = Penumbra.CollectionManager.Individuals.ConvertSpecialIdentifier( identifier );
var collection = CollectionByIdentifier( identifier )
?? CheckYourself( identifier, gameObject )
?? CollectionByAttributes( gameObject )
?? CheckOwnedCollection( identifier, owner )
?? Penumbra.CollectionManager.Default;
return IdentifiedCache.Set( collection, identifier, gameObject );
} }
catch( Exception e ) catch( Exception e )
{ {