Cleanup
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Game.ClientState.Party;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Logging;
|
||||
using PlayerTags.Configuration;
|
||||
using PlayerTags.GameInterface.ContextMenus;
|
||||
using PlayerTags.PluginStrings;
|
||||
@@ -281,23 +282,22 @@ namespace PlayerTags.Data
|
||||
{
|
||||
if (contextMenuOpenedArgs.GameObjectContext == null
|
||||
|| contextMenuOpenedArgs.GameObjectContext.Name == null
|
||||
|| contextMenuOpenedArgs.GameObjectContext.WorldId == 0
|
||||
|| contextMenuOpenedArgs.GameObjectContext.WorldId == 65535)
|
||||
|| contextMenuOpenedArgs.GameObjectContext.WorldId == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return GetIdentity(contextMenuOpenedArgs.GameObjectContext.Name.TextValue, contextMenuOpenedArgs.GameObjectContext.WorldId);
|
||||
return GetIdentity(contextMenuOpenedArgs.GameObjectContext.Name, contextMenuOpenedArgs.GameObjectContext.WorldId);
|
||||
}
|
||||
|
||||
public Identity GetIdentity(PlayerCharacter playerCharacter)
|
||||
{
|
||||
return GetIdentity(playerCharacter.Name.TextValue, playerCharacter.HomeWorld.GameData.RowId);
|
||||
return GetIdentity(playerCharacter.Name.TextValue, playerCharacter.HomeWorld.Id);
|
||||
}
|
||||
|
||||
public Identity GetIdentity(PartyMember partyMember)
|
||||
{
|
||||
return GetIdentity(partyMember.Name.TextValue, partyMember.World.GameData.RowId);
|
||||
return GetIdentity(partyMember.Name.TextValue, partyMember.World.Id);
|
||||
}
|
||||
|
||||
public Identity GetIdentity(PlayerPayload playerPayload)
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace PlayerTags.Features
|
||||
if (stringMatch.GameObject is PlayerCharacter playerCharacter)
|
||||
{
|
||||
// Add the job tag
|
||||
if (m_PluginData.JobTags.TryGetValue(playerCharacter.ClassJob.GameData.Abbreviation, out var jobTag))
|
||||
if (playerCharacter.ClassJob.GameData != null && m_PluginData.JobTags.TryGetValue(playerCharacter.ClassJob.GameData.Abbreviation, out var jobTag))
|
||||
{
|
||||
if (jobTag.TagPositionInChat.InheritedValue != null)
|
||||
{
|
||||
@@ -260,7 +260,7 @@ namespace PlayerTags.Features
|
||||
|
||||
if (stringMatch.GameObject is PlayerCharacter playerCharacter1)
|
||||
{
|
||||
if (m_PluginData.JobTags.TryGetValue(playerCharacter1.ClassJob.GameData.Abbreviation, out var jobTag))
|
||||
if (playerCharacter1.ClassJob.GameData != null && m_PluginData.JobTags.TryGetValue(playerCharacter1.ClassJob.GameData.Abbreviation, out var jobTag))
|
||||
{
|
||||
if (IsTagVisible(jobTag, stringMatch.GameObject))
|
||||
{
|
||||
|
||||
@@ -88,16 +88,6 @@ namespace PlayerTags.Features
|
||||
m_PluginConfiguration.Save(m_PluginData);
|
||||
})));
|
||||
}
|
||||
|
||||
newContextMenuItems.Add(new OpenSubContextMenuItem("1", (args) =>
|
||||
{
|
||||
PluginLog.Debug("WOW1");
|
||||
args.Items.Add(new CustomContextMenuItem("2", (args2) =>
|
||||
{
|
||||
PluginLog.Debug("WOW2");
|
||||
}));
|
||||
}));
|
||||
|
||||
subContextMenuOpenedArgs.Items.InsertRange(0, newContextMenuItems);
|
||||
})));
|
||||
}
|
||||
@@ -116,16 +106,6 @@ namespace PlayerTags.Features
|
||||
m_PluginConfiguration.Save(m_PluginData);
|
||||
})));
|
||||
}
|
||||
|
||||
newContextMenuItems.Add(new OpenSubContextMenuItem("1", (args) =>
|
||||
{
|
||||
PluginLog.Debug("WOW1");
|
||||
args.Items.Add(new CustomContextMenuItem("2", (args2) =>
|
||||
{
|
||||
PluginLog.Debug("WOW2");
|
||||
}));
|
||||
}));
|
||||
|
||||
subContextMenuOpenedArgs.Items.InsertRange(0, newContextMenuItems);
|
||||
})));
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace PlayerTags.Features
|
||||
if (gameObject is PlayerCharacter playerCharacter)
|
||||
{
|
||||
// Add the job tags
|
||||
if (m_PluginData.JobTags.TryGetValue(playerCharacter.ClassJob.GameData.Abbreviation, out var jobTag))
|
||||
if (playerCharacter.ClassJob.GameData != null && m_PluginData.JobTags.TryGetValue(playerCharacter.ClassJob.GameData.Abbreviation, out var jobTag))
|
||||
{
|
||||
if (jobTag.TagTargetInNameplates.InheritedValue != null && jobTag.TagPositionInNameplates.InheritedValue != null)
|
||||
{
|
||||
@@ -280,7 +280,7 @@ namespace PlayerTags.Features
|
||||
}
|
||||
}
|
||||
|
||||
if (m_PluginData.JobTags.TryGetValue(playerCharacter1.ClassJob.GameData.Abbreviation, out var jobTag))
|
||||
if (playerCharacter1.ClassJob.GameData != null && m_PluginData.JobTags.TryGetValue(playerCharacter1.ClassJob.GameData.Abbreviation, out var jobTag))
|
||||
{
|
||||
if (IsTagVisible(jobTag, gameObject))
|
||||
{
|
||||
|
||||
@@ -426,15 +426,41 @@ namespace PlayerTags.GameInterface.ContextMenus
|
||||
else
|
||||
{
|
||||
var agentContext = (AgentContext*)agentContextInterface;
|
||||
if (agentContext->GameObjectContentId != 0 || agentContext->GameObjectWorldId != 0)
|
||||
{
|
||||
SeString objectName;
|
||||
unsafe
|
||||
{
|
||||
objectName = GameInterfaceHelper.ReadSeString((IntPtr)agentContext->GameObjectName.StringPtr);
|
||||
}
|
||||
|
||||
gameObjectContext = new GameObjectContext(agentContext->GameObjectId, agentContext->GameObjectContentId, objectName, agentContext->GameObjectWorldId);
|
||||
uint? id = agentContext->GameObjectId;
|
||||
if (id == 0)
|
||||
{
|
||||
id = null;
|
||||
}
|
||||
|
||||
ulong? contentId = agentContext->GameObjectContentId;
|
||||
if (contentId == 0)
|
||||
{
|
||||
contentId = null;
|
||||
}
|
||||
|
||||
string? name;
|
||||
unsafe
|
||||
{
|
||||
name = GameInterfaceHelper.ReadSeString((IntPtr)agentContext->GameObjectName.StringPtr).TextValue;
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
name = null;
|
||||
}
|
||||
}
|
||||
|
||||
ushort? worldId = agentContext->GameObjectWorldId;
|
||||
if (worldId == 0)
|
||||
{
|
||||
worldId = null;
|
||||
}
|
||||
|
||||
if (id != null
|
||||
|| contentId != null
|
||||
|| name != null
|
||||
|| worldId != null)
|
||||
{
|
||||
gameObjectContext = new GameObjectContext(id, contentId, name, worldId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,6 @@ namespace FFXIVClientStructs.FFXIV.Client.UI
|
||||
[FieldOffset(0x0)] public unsafe AddonInterface AddonInterface;
|
||||
[FieldOffset(0x160)] public unsafe AtkValue* AtkValues;
|
||||
[FieldOffset(0x1CA)] public ushort AtkValuesCount;
|
||||
[FieldOffset(0x690)] public /*long*/ bool IsInitialMenu;
|
||||
[FieldOffset(0x690)] public bool IsInitialMenu;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,22 +10,22 @@ namespace PlayerTags.GameInterface.ContextMenus
|
||||
/// <summary>
|
||||
/// The id of the game object.
|
||||
/// </summary>
|
||||
public uint Id { get; }
|
||||
public uint? Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The content id of the game object.
|
||||
/// </summary>
|
||||
public ulong ContentId { get; }
|
||||
public ulong? ContentId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the game object.
|
||||
/// </summary>
|
||||
public SeString Name { get; }
|
||||
public string? Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The world id of the game object.
|
||||
/// </summary>
|
||||
public ushort WorldId { get; }
|
||||
public ushort? WorldId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GameObjectContext"/> class.
|
||||
@@ -34,7 +34,7 @@ namespace PlayerTags.GameInterface.ContextMenus
|
||||
/// <param name="contentId">The lower content id of the game object.</param>
|
||||
/// <param name="name">The name of the game object.</param>
|
||||
/// <param name="worldId">The world id of the game object.</param>
|
||||
public GameObjectContext(uint id, ulong contentId, SeString name, ushort worldId)
|
||||
public GameObjectContext(uint? id, ulong? contentId, string? name, ushort? worldId)
|
||||
{
|
||||
Id = id;
|
||||
ContentId = contentId;
|
||||
|
||||
Reference in New Issue
Block a user