Added sort by proximity option
This commit is contained in:
@@ -20,6 +20,7 @@ namespace PlayerTags.Configuration
|
||||
public bool IsPlayerNameRandomlyGenerated = false;
|
||||
public bool IsCustomTagsContextMenuEnabled = true;
|
||||
public bool IsShowInheritedPropertiesEnabled = true;
|
||||
public bool IsSortedByProximity = true;
|
||||
|
||||
[JsonProperty(TypeNameHandling = TypeNameHandling.None, ItemTypeNameHandling = TypeNameHandling.None)]
|
||||
public Dictionary<string, InheritableData> AllTagsChanges = new Dictionary<string, InheritableData>();
|
||||
|
||||
@@ -138,12 +138,14 @@ namespace PlayerTags.Configuration
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui.BeginTabItem(Strings.Loc_Static_Vicinity))
|
||||
if (ImGui.BeginTabItem(Strings.Loc_Static_Proximity))
|
||||
{
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.TreePush();
|
||||
if (ImGui.BeginTable("##VicinityAssignTable", 1 + m_PluginData.CustomTags.Count))
|
||||
DrawCheckbox(nameof(m_PluginConfiguration.IsSortedByProximity), true, ref m_PluginConfiguration.IsSortedByProximity, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
|
||||
if (ImGui.BeginTable("##ProximityAssignTable", 1 + m_PluginData.CustomTags.Count))
|
||||
{
|
||||
ImGui.TableHeader(Strings.Loc_Static_PlayerName);
|
||||
ImGui.TableSetupColumn(Strings.Loc_Static_PlayerName);
|
||||
@@ -156,8 +158,18 @@ namespace PlayerTags.Configuration
|
||||
}
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
var players = PluginServices.ObjectTable.Where(gameObject => gameObject is PlayerCharacter);
|
||||
if (m_PluginConfiguration.IsSortedByProximity && PluginServices.ClientState.LocalPlayer != null)
|
||||
{
|
||||
players = players.OrderBy(gameObject => (gameObject.Position - PluginServices.ClientState.LocalPlayer.Position).Length());
|
||||
}
|
||||
else
|
||||
{
|
||||
players = players.OrderBy(obj => obj.Name.TextValue);
|
||||
}
|
||||
|
||||
int rowIndex = 0;
|
||||
foreach (var gameObject in PluginServices.ObjectTable.Where(obj => obj is PlayerCharacter).OrderBy(obj => obj.Name.TextValue))
|
||||
foreach (var gameObject in players)
|
||||
{
|
||||
DrawPlayerAssignmentRow(gameObject.Name.TextValue, rowIndex);
|
||||
++rowIndex;
|
||||
|
||||
61
PlayerTags/Resources/Strings.Designer.cs
generated
61
PlayerTags/Resources/Strings.Designer.cs
generated
@@ -276,6 +276,24 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sort by proximity.
|
||||
/// </summary>
|
||||
public static string Loc_IsSortedByProximity {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_IsSortedByProximity", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Players that are closer to the local player will be ordered towards the top..
|
||||
/// </summary>
|
||||
public static string Loc_IsSortedByProximity_Description {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_IsSortedByProximity_Description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Text italic.
|
||||
/// </summary>
|
||||
@@ -331,7 +349,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Visible for alliance players.
|
||||
/// Looks up a localized string similar to Show for alliance members.
|
||||
/// </summary>
|
||||
public static string Loc_IsVisibleForAlliancePlayers {
|
||||
get {
|
||||
@@ -340,7 +358,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Visible for enemy players.
|
||||
/// Looks up a localized string similar to Show for enemies.
|
||||
/// </summary>
|
||||
public static string Loc_IsVisibleForEnemyPlayers {
|
||||
get {
|
||||
@@ -349,7 +367,16 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Visible for other players.
|
||||
/// Looks up a localized string similar to Show for friends.
|
||||
/// </summary>
|
||||
public static string Loc_IsVisibleForFriendPlayers {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_IsVisibleForFriendPlayers", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show for others.
|
||||
/// </summary>
|
||||
public static string Loc_IsVisibleForOtherPlayers {
|
||||
get {
|
||||
@@ -358,7 +385,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Visible for party players.
|
||||
/// Looks up a localized string similar to Show for party members.
|
||||
/// </summary>
|
||||
public static string Loc_IsVisibleForPartyPlayers {
|
||||
get {
|
||||
@@ -367,7 +394,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Visible for self.
|
||||
/// Looks up a localized string similar to Show for self.
|
||||
/// </summary>
|
||||
public static string Loc_IsVisibleForSelf {
|
||||
get {
|
||||
@@ -376,7 +403,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Visible in overworld.
|
||||
/// Looks up a localized string similar to Show elsewhere.
|
||||
/// </summary>
|
||||
public static string Loc_IsVisibleInOverworld {
|
||||
get {
|
||||
@@ -385,7 +412,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Visible in pve duties.
|
||||
/// Looks up a localized string similar to Show in pve duties.
|
||||
/// </summary>
|
||||
public static string Loc_IsVisibleInPveDuties {
|
||||
get {
|
||||
@@ -394,7 +421,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Visible in pvp duties.
|
||||
/// Looks up a localized string similar to Show in pvp duties.
|
||||
/// </summary>
|
||||
public static string Loc_IsVisibleInPvpDuties {
|
||||
get {
|
||||
@@ -816,6 +843,15 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Proximity.
|
||||
/// </summary>
|
||||
public static string Loc_Static_Proximity {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_Static_Proximity", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove this custom tag..
|
||||
/// </summary>
|
||||
@@ -852,15 +888,6 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Vicinity.
|
||||
/// </summary>
|
||||
public static string Loc_Static_Vicinity {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_Static_Vicinity", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to This plugin can modify nameplates. When combined with other plugins that modify nameplates, you are likely to see unexpected behavior..
|
||||
/// </summary>
|
||||
|
||||
@@ -129,8 +129,8 @@
|
||||
<data name="Loc_Static_Party" xml:space="preserve">
|
||||
<value>Party</value>
|
||||
</data>
|
||||
<data name="Loc_Static_Vicinity" xml:space="preserve">
|
||||
<value>Vicinity</value>
|
||||
<data name="Loc_Static_Proximity" xml:space="preserve">
|
||||
<value>Proximity</value>
|
||||
</data>
|
||||
<data name="Loc_Static_TaggedPlayers" xml:space="preserve">
|
||||
<value>Tagged Players</value>
|
||||
@@ -452,4 +452,11 @@
|
||||
<data name="Loc_IsVisibleForOtherPlayers" xml:space="preserve">
|
||||
<value>Show for others</value>
|
||||
</data>
|
||||
|
||||
<data name="Loc_IsSortedByProximity" xml:space="preserve">
|
||||
<value>Sort by proximity</value>
|
||||
</data>
|
||||
<data name="Loc_IsSortedByProximity_Description" xml:space="preserve">
|
||||
<value>Players that are closer to the local player will be ordered towards the top.</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user