Some fixes

- Don't try to add tags to bad message types
- Fix for being unable to add properties that have duplicated names
- Some identities cleanup
- Added a temp <Do nothing> context menu item to work around the XivCommon context menu bug
This commit is contained in:
r00telement
2021-12-27 17:51:10 +00:00
parent 0026965c32
commit 69430f25c9
8 changed files with 69 additions and 43 deletions

View File

@@ -528,9 +528,9 @@ namespace PlayerTags.Configuration
foreach (var inheritableGroup in inheritableGroups1)
{
if (inheritableGroup.Key != null)
{
ImGui.PushID(inheritableGroup.Key);
DrawHeading(Localizer.GetString(inheritableGroup.Key, false));
}
@@ -560,6 +560,11 @@ namespace PlayerTags.Configuration
ImGui.SetTooltip(Localizer.GetString(selectedInheritable.Inheritable.Key, true));
}
}
if (inheritableGroup.Key != null)
{
ImGui.PopID();
}
}
ImGui.EndListBox();

View File

@@ -1,46 +1,21 @@
using Lumina.Excel.GeneratedSheets;
using Newtonsoft.Json;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
namespace PlayerTags.Data
{
[Serializable]
public class Identity : IComparable<Identity>
{
public string Name;
public uint? WorldId;
public List<Guid> CustomTagIds = new List<Guid>();
public string Name { get; init; }
public uint? WorldId { get; set; } = null;
public List<Guid> CustomTagIds { get; init; } = new List<Guid>();
[JsonIgnore]
public string? World
{
get
{
var worldId = WorldId;
if (worldId != null)
{
var worlds = PluginServices.DataManager.GetExcelSheet<World>();
if (worlds != null)
{
var world = worlds.FirstOrDefault(world => world.RowId == worldId.Value);
if (world != null)
{
return world.Name.RawString;
}
}
}
return null;
}
}
public string? World => WorldHelper.GetWorldName(WorldId);
public Identity(string name)
{
Name = name;
WorldId = null;
}
public override string ToString()
@@ -57,13 +32,7 @@ namespace PlayerTags.Data
public int CompareTo(Identity? other)
{
string? otherName = null;
if (other != null)
{
otherName = other.Name;
}
return Name.CompareTo(otherName);
return ToString().CompareTo(other != null ? other.ToString() : null);
}
}
}

View File

@@ -92,7 +92,6 @@ namespace PlayerTags.Data
};
// Deprecated
[InheritableCategory("General")]
public InheritableReference<string> GameObjectNamesToApplyTo = new InheritableReference<string>("");
public InheritableValue<Guid> CustomId = new InheritableValue<Guid>(Guid.Empty);

View File

@@ -0,0 +1,41 @@
using Lumina.Excel.GeneratedSheets;
using System.Collections.Generic;
namespace PlayerTags.Data
{
public static class WorldHelper
{
private static Dictionary<uint, string>? s_WorldNames = null;
public static Dictionary<uint, string> WorldNames
{
get
{
if (s_WorldNames == null)
{
s_WorldNames = new Dictionary<uint, string>();
var worlds = PluginServices.DataManager.GetExcelSheet<World>();
if (worlds != null)
{
foreach (var world in worlds)
{
s_WorldNames[world.RowId] = world.Name;
}
}
}
return s_WorldNames;
}
}
public static string? GetWorldName(uint? worldId)
{
if (worldId != null && WorldNames.TryGetValue(worldId.Value, out var name))
{
return name;
}
return null;
}
}
}

View File

@@ -6,6 +6,7 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Logging;
using PlayerTags.Configuration;
using PlayerTags.Data;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -100,8 +101,11 @@ namespace PlayerTags.Features
private void Chat_ChatMessage(XivChatType type, uint senderId, ref SeString sender, ref SeString message, ref bool isHandled)
{
AddTagsToChat(sender);
AddTagsToChat(message);
if (Enum.IsDefined(type))
{
AddTagsToChat(sender);
AddTagsToChat(message);
}
}
protected override bool IsIconVisible(Tag tag)

View File

@@ -68,6 +68,10 @@ namespace PlayerTags.Features
m_PluginConfiguration.Save(m_PluginData);
})));
}
itemArgs.Items.Add(new NormalContextMenuItem("<Do nothing>", (args =>
{
})));
})));
}
@@ -84,6 +88,10 @@ namespace PlayerTags.Features
m_PluginConfiguration.Save(m_PluginData);
})));
}
itemArgs.Items.Add(new NormalContextMenuItem("<Do nothing>", (args =>
{
})));
})));
}
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>r00telement</Authors>
<Version>1.1.5.1</Version>
<Version>1.1.6.0</Version>
</PropertyGroup>
<PropertyGroup>

View File

@@ -10,5 +10,5 @@
"https://github.com/r00telement/PlayerTags/raw/main/PlayerTags/Resources/Promo/Nameplates_1.png",
"https://github.com/r00telement/PlayerTags/raw/main/PlayerTags/Resources/Promo/Chat_1.png"
],
"Changelog": "- Fix for nameplates sometimes disappearing when changing a player's title color when they have no title."
"Changelog": ""
}