Add Target button to collection assignments.

This commit is contained in:
Ottermandias 2023-01-17 16:41:25 +01:00
parent 6b558c5940
commit b64a9a51f8

View file

@ -244,6 +244,7 @@ public partial class ConfigWindow
var buttonWidth2 = new Vector2( 120 * ImGuiHelpers.GlobalScale, 0 );
var change = DrawNewCurrentPlayerCollection();
change |= DrawNewTargetCollection();
change |= DrawNewPlayerCollection( buttonWidth1, width );
ImGui.SameLine();
@ -278,6 +279,28 @@ public partial class ConfigWindow
return true;
}
return false;
}
private bool DrawNewTargetCollection()
{
var target = Dalamud.Targets.Target;
var player = Penumbra.Actors.FromObject( target, false, true );
var result = Penumbra.CollectionManager.Individuals.CanAdd( player );
var tt = result switch
{
IndividualCollections.AddResult.Valid => $"Assign a collection to {player}.",
IndividualCollections.AddResult.AlreadySet => AlreadyAssigned,
IndividualCollections.AddResult.Invalid => "No valid character in target detected.",
_ => string.Empty,
};
if( ImGuiUtil.DrawDisabledButton( "Assign Current Target", _window._inputTextWidth, tt, result != IndividualCollections.AddResult.Valid ) )
{
Penumbra.CollectionManager.Individuals.Add( new[] { player }, Penumbra.CollectionManager.Default );
return true;
}
ImGui.SameLine();
ImGuiComponents.HelpMarker( "- Bell Retainers also apply to Mannequins named after them, but not to outdoor retainers, since they only carry their owners name.\n"
+ "- Some NPCs are available as Battle- and Event NPCs and need to be setup for both if desired.\n"