finally fix status icon priorizing & add new option

This commit is contained in:
2022-11-15 21:06:50 +01:00
parent 6ec3a1a970
commit 8573555af7
7 changed files with 61 additions and 13 deletions

View File

@@ -23,26 +23,30 @@ namespace Pilz.Dalamud.Nameplates.Tools
}
}
public static bool ApplyStatusIconWithPrio(ref int statusIcon, int newStatusIcon, StringChange stringChange, ActivityContext activityContext, StatusIconPriorizer priorizer)
public static bool ApplyStatusIconWithPrio(ref int statusIcon, int newStatusIcon, StringChange stringChange, ActivityContext activityContext, StatusIconPriorizer priorizer, bool moveIconToNameplateIfPossible)
{
var isPrio = priorizer.IsPriorityIcon(statusIcon, activityContext);
if (!isPrio)
bool? isPrio = null;
var fontIcon = StatusIconFontConverter.GetBitmapFontIconFromStatusIcon((StatusIcons)statusIcon);
if (moveIconToNameplateIfPossible)
{
var fontIcon = StatusIconFontConverter.GetBitmapFontIconFromStatusIcon((StatusIcons)statusIcon);
if (fontIcon != null)
{
// Set new font icon as string change
var iconPayload = new IconPayload(fontIcon.Value);
stringChange.Payloads.Insert(0, iconPayload);
// Use new status icon as status icon
statusIcon = newStatusIcon;
// If we moved it, we don't need it as icon anymore, yay :D
isPrio = false;
}
}
return isPrio;
isPrio ??= priorizer.IsPriorityIcon(statusIcon, activityContext);
if (!isPrio.Value)
statusIcon = newStatusIcon;
return isPrio.Value;
}
}
}

View File

@@ -65,6 +65,12 @@ namespace Pilz.Dalamud.Nameplates.Tools
StatusIcons.PartyMember, // Party Member
StatusIcons.RolePlaying, // Role Playing
StatusIcons.GroupPose, // Group Pose
StatusIcons.Mentor,
StatusIcons.MentorCrafting,
StatusIcons.MentorPvE,
StatusIcons.MentorPvP,
StatusIcons.Returner,
StatusIcons.NewAdventurer,
});
var setInDuty = GetConditionSet(StatusIconPriorizerConditionSets.InDuty);
@@ -74,6 +80,12 @@ namespace Pilz.Dalamud.Nameplates.Tools
StatusIcons.ViewingCutscene, // Viewing Cutscene
StatusIcons.Idle, // Idle
StatusIcons.GroupPose, // Group Pose
StatusIcons.Mentor,
StatusIcons.MentorCrafting,
StatusIcons.MentorPvE,
StatusIcons.MentorPvP,
StatusIcons.Returner,
StatusIcons.NewAdventurer,
});
var setInForay = GetConditionSet(StatusIconPriorizerConditionSets.InForay);
@@ -86,6 +98,12 @@ namespace Pilz.Dalamud.Nameplates.Tools
StatusIcons.ViewingCutscene, // Viewing Cutscene
StatusIcons.Idle, // Idle
StatusIcons.GroupPose, // Group Pose
StatusIcons.Mentor,
StatusIcons.MentorCrafting,
StatusIcons.MentorPvE,
StatusIcons.MentorPvP,
StatusIcons.Returner,
StatusIcons.NewAdventurer,
});
}
}

View File

@@ -34,6 +34,7 @@ namespace PlayerTags.Configuration
public DefaultPluginDataTemplate DefaultPluginDataTemplate = DefaultPluginDataTemplate.Simple;
public StatusIconPriorizerSettings StatusIconPriorizerSettings = new(true);
public bool MoveStatusIconToNameplateTextIfPossible = true;
public bool IsPlayerNameRandomlyGenerated = false;
public bool IsCustomTagsContextMenuEnabled = true;
public bool IsShowInheritedPropertiesEnabled = true;

View File

@@ -266,6 +266,8 @@ namespace PlayerTags.Configuration
SaveSettings();
});
DrawCheckbox(nameof(PluginConfiguration.MoveStatusIconToNameplateTextIfPossible), true, ref m_PluginConfiguration.MoveStatusIconToNameplateTextIfPossible, () => SaveSettings());
if (isPriorizerEnabled)
{
var statusIcons = Enum.GetValues<StatusIcons>();

View File

@@ -136,7 +136,7 @@ namespace PlayerTags.Features
}
if (applyTags)
AddTagsToNameplate(args.PlayerCharacter, args.Name, args.Title, args.FreeCompany, ref iconID);
AddTagsToNameplate(args.PlayerCharacter, args.Name, args.Title, args.FreeCompany, ref iconID, generalOptions);
else if(grayOut)
GrayOutNameplate(args.PlayerCharacter, args.Name, args.Title, args.FreeCompany, ref iconID);
@@ -195,7 +195,7 @@ namespace PlayerTags.Features
/// <param name="name">The name text to change.</param>
/// <param name="title">The title text to change.</param>
/// <param name="freeCompany">The free company text to change.</param>
private void AddTagsToNameplate(GameObject gameObject, SeString name, SeString title, SeString freeCompany, ref int statusIcon)
private void AddTagsToNameplate(GameObject gameObject, SeString name, SeString title, SeString freeCompany, ref int statusIcon, GeneralOptionsClass generalOptions)
{
int? newStatusIcon = null;
NameplateChanges nameplateChanges = GenerateEmptyNameplateChanges(name, title, freeCompany);
@@ -250,8 +250,7 @@ namespace PlayerTags.Features
if (newStatusIcon != null)
{
var change = nameplateChanges.GetChange(NameplateElements.Name, StringPosition.Before);
if (NameplateUpdateFactory.ApplyStatusIconWithPrio(ref statusIcon, (int)newStatusIcon, change, ActivityContextManager.CurrentActivityContext, statusiconPriorizer))
statusIcon = (int)newStatusIcon;
NameplateUpdateFactory.ApplyStatusIconWithPrio(ref statusIcon, (int)newStatusIcon, change, ActivityContextManager.CurrentActivityContext, statusiconPriorizer, m_PluginConfiguration.MoveStatusIconToNameplateTextIfPossible);
}
// Build the final strings out of the payloads

View File

@@ -1094,6 +1094,24 @@ namespace PlayerTags.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Move Status Icon to Nameplate if possible ähnelt.
/// </summary>
public static string Loc_MoveStatusIconToNameplateTextIfPossible {
get {
return ResourceManager.GetString("Loc_MoveStatusIconToNameplateTextIfPossible", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die If the current status icon is available as Font Icon then move it to the Player Name text in the Nameplate, so there is place for another icon to use, e.g. the job icon. ähnelt.
/// </summary>
public static string Loc_MoveStatusIconToNameplateTextIfPossible_Description {
get {
return ResourceManager.GetString("Loc_MoveStatusIconToNameplateTextIfPossible_Description", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Nameplate properties ähnelt.
/// </summary>

View File

@@ -813,4 +813,10 @@ Use this if you want to to have every option under your control or just want to
<data name="Loc_DeadPlayerHandling_Include_Description" xml:space="preserve">
<value>Handle dead players as they are alive. No difference between dead and alive players.</value>
</data>
<data name="Loc_MoveStatusIconToNameplateTextIfPossible" xml:space="preserve">
<value>Move Status Icon to Nameplate if possible</value>
</data>
<data name="Loc_MoveStatusIconToNameplateTextIfPossible_Description" xml:space="preserve">
<value>If the current status icon is available as Font Icon then move it to the Player Name text in the Nameplate, so there is place for another icon to use, e.g. the job icon.</value>
</data>
</root>