Actor resolving fixes for UI actors

Profiles should now properly apply to UI actors in Crystalline Conflict and other places
Added ability to control which parts of the UI profiles are applying to
This commit is contained in:
RisaDev
2024-04-11 23:33:41 +03:00
parent c663e3c22f
commit 99990c9208
7 changed files with 183 additions and 64 deletions

View File

@@ -1,6 +1,7 @@
using Dalamud.Game.ClientState.Objects.Enums;
using Penumbra.GameData.Actors;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Interop;
using PenumbraExtensions = Penumbra.GameData.Actors.ActorIdentifierExtensions;
namespace CustomizePlus.GameData.Extensions;
@@ -80,48 +81,4 @@ public static class ActorIdentifierExtensions
return false;
}
}
/// <summary>
/// Get "true" actor for special actors. Returns ActorIdentifier.Invalid for non-special actors or if actor cannot be found.
/// </summary>
/// <param name="identifier"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static ActorIdentifier GetTrueActorForSpecialType(this ActorIdentifier identifier)
{
if (!identifier.IsValid)
return ActorIdentifier.Invalid;
if (identifier.Type != IdentifierType.Special)
return ActorIdentifier.Invalid;
if (PenumbraExtensions.Manager == null)
throw new Exception("ActorIdentifier.Manager is not initialized");
switch (identifier.Special)
{
case ScreenActor.GPosePlayer:
case ScreenActor.CharacterScreen:
case ScreenActor.FittingRoom:
case ScreenActor.DyePreview:
case ScreenActor.Portrait:
return PenumbraExtensions.Manager.GetCurrentPlayer();
case ScreenActor.ExamineScreen:
var examineIdentifier = PenumbraExtensions.Manager.GetInspectPlayer();
if (!examineIdentifier.IsValid)
examineIdentifier = PenumbraExtensions.Manager.GetGlamourPlayer(); //returns ActorIdentifier.Invalid if player is invalid
if (!examineIdentifier.IsValid)
return ActorIdentifier.Invalid;
return examineIdentifier;
case ScreenActor.Card6:
case ScreenActor.Card7:
case ScreenActor.Card8:
return PenumbraExtensions.Manager.GetCardPlayer();
}
return ActorIdentifier.Invalid;
}
}