merge branche 'master' into master
This commit is contained in:
Submodule Pilz.Dalamud updated: 8e7d49ca01...3715dcb9ac
@@ -26,6 +26,7 @@ Global
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
RESX_ShowErrorsInErrorList = False
|
||||
SolutionGuid = {B17E85B1-5F60-4440-9F9A-3DDE877E8CDF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -30,45 +30,19 @@ namespace PlayerTags.Configuration.GameConfig
|
||||
}
|
||||
}
|
||||
|
||||
private int? GetIntValue(ConfigOption option)
|
||||
private uint? GetIntValue(ConfigOption option)
|
||||
{
|
||||
int? value = null;
|
||||
|
||||
unsafe
|
||||
{
|
||||
var index = configModule->GetIndex(option);
|
||||
if (index.HasValue)
|
||||
value = configModule->GetIntValue(index.Value);
|
||||
}
|
||||
|
||||
return value;
|
||||
if (PluginServices.GameConfig.UiConfig.TryGetUInt(nameof(ConfigOption.LogNameType), out var value))
|
||||
return value;
|
||||
return null;
|
||||
}
|
||||
|
||||
public LogNameType? GetLogNameType()
|
||||
{
|
||||
LogNameType? logNameType = null;
|
||||
int? value = GetIntValue(ConfigOption.LogNameType);
|
||||
|
||||
if (value.HasValue)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
logNameType = LogNameType.FullName;
|
||||
break;
|
||||
case 1:
|
||||
logNameType = LogNameType.LastNameShorted;
|
||||
break;
|
||||
case 2:
|
||||
logNameType = LogNameType.FirstNameShorted;
|
||||
break;
|
||||
case 3:
|
||||
logNameType = LogNameType.Initials;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return logNameType;
|
||||
uint? value = GetIntValue(ConfigOption.LogNameType);
|
||||
if (value != null)
|
||||
return (LogNameType)value;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace PlayerTags.Configuration.GameConfig
|
||||
{
|
||||
public enum LogNameType
|
||||
public enum LogNameType : uint
|
||||
{
|
||||
FullName,
|
||||
LastNameShorted,
|
||||
|
||||
@@ -3,6 +3,7 @@ using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Logging;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using FFXIVClientStructs.Havok;
|
||||
@@ -802,7 +803,7 @@ namespace PlayerTags.Configuration
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginLog.Warning($"Rendering for inheritable option not implemented: {selectedInheritable.Inheritable.Key}");
|
||||
PluginServices.PluginLog.Warning($"Rendering for inheritable option not implemented: {selectedInheritable.Inheritable.Key}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Dalamud.ContextMenu;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Plugin;
|
||||
using PlayerTags.Configuration;
|
||||
using PlayerTags.Data;
|
||||
using PlayerTags.Resources;
|
||||
@@ -33,9 +34,9 @@ namespace PlayerTags.Features
|
||||
|
||||
private DalamudContextMenu? m_ContextMenu;
|
||||
|
||||
public CustomTagsContextMenuFeature(PluginConfiguration pluginConfiguration, PluginData pluginData) : base(pluginConfiguration, pluginData)
|
||||
public CustomTagsContextMenuFeature(PluginConfiguration pluginConfiguration, PluginData pluginData, DalamudPluginInterface pluginInterface) : base(pluginConfiguration, pluginData)
|
||||
{
|
||||
m_ContextMenu = new DalamudContextMenu();
|
||||
m_ContextMenu = new DalamudContextMenu(pluginInterface);
|
||||
m_ContextMenu.OnOpenGameObjectContextMenu += ContextMenuHooks_ContextMenuOpened;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,12 +75,12 @@ namespace PlayerTags.Features
|
||||
}
|
||||
}
|
||||
|
||||
private void ClientState_Login(object? sender, EventArgs e)
|
||||
private void ClientState_Login()
|
||||
{
|
||||
Hook();
|
||||
}
|
||||
|
||||
private void ClientState_Logout(object? sender, EventArgs e)
|
||||
private void ClientState_Logout()
|
||||
{
|
||||
Unhook();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace PlayerTags.GameInterface.Nameplates
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PluginLog.Error(ex, $"SetPlayerNameplateDetour");
|
||||
PluginServices.PluginLog.Error(ex, $"SetPlayerNameplateDetour");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace PlayerTags.Inheritables
|
||||
else if (inheritableData.Value == null)
|
||||
{
|
||||
// This should never happen
|
||||
PluginLog.Error($"Expected value of type {Value.GetType()} but received null");
|
||||
PluginServices.PluginLog.Error($"Expected value of type {Value.GetType()} but received null");
|
||||
}
|
||||
else if (typeof(T) == typeof(Guid) && inheritableData.Value is string strValue)
|
||||
{
|
||||
@@ -81,7 +81,7 @@ namespace PlayerTags.Inheritables
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PluginLog.Error(ex, $"Failed to convert {inheritableData.Value.GetType()} value '{inheritableData.Value}' to {Value.GetType()}");
|
||||
PluginServices.PluginLog.Error(ex, $"Failed to convert {inheritableData.Value.GetType()} value '{inheritableData.Value}' to {Value.GetType()}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace PlayerTags
|
||||
if (value != null)
|
||||
return value;
|
||||
|
||||
PluginLog.Error($"Failed to get localized string for id {localizedStringId}");
|
||||
PluginServices.PluginLog.Error($"Failed to get localized string for id {localizedStringId}");
|
||||
return localizedStringId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Dalamud.Logging;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Internal;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using PlayerTags.Configuration;
|
||||
using PlayerTags.Data;
|
||||
using PlayerTags.Features;
|
||||
@@ -16,29 +17,28 @@ namespace PlayerTags
|
||||
{
|
||||
public sealed class Plugin : IDalamudPlugin
|
||||
{
|
||||
public string Name => "Player Tags";
|
||||
private const string c_CommandName = "/playertags";
|
||||
private const string c_SubCommandName_EnableGlobal = "enableglobal";
|
||||
private const string c_CommandArg_On = "on";
|
||||
private const string c_CommandArg_Off = "off";
|
||||
private const string c_CommandArg_toggle = "toggle";
|
||||
|
||||
private PluginConfiguration m_PluginConfiguration;
|
||||
private PluginData m_PluginData;
|
||||
private PluginConfigurationUI m_PluginConfigurationUI;
|
||||
private PluginConfiguration pluginConfiguration = null;
|
||||
private PluginData pluginData = null;
|
||||
private PluginConfigurationUI pluginConfigurationUI = null;
|
||||
|
||||
private CustomTagsContextMenuFeature m_CustomTagsContextMenuFeature;
|
||||
private NameplateTagTargetFeature m_NameplatesTagTargetFeature;
|
||||
private ChatTagTargetFeature m_ChatTagTargetFeature;
|
||||
private CustomTagsContextMenuFeature customTagsContextMenuFeature;
|
||||
private NameplateTagTargetFeature nameplatesTagTargetFeature;
|
||||
private ChatTagTargetFeature chatTagTargetFeature;
|
||||
|
||||
public Plugin(DalamudPluginInterface pluginInterface)
|
||||
{
|
||||
PluginServices.Initialize(pluginInterface);
|
||||
Pilz.Dalamud.PluginServices.Initialize(pluginInterface);
|
||||
|
||||
m_PluginConfiguration = PluginConfiguration.LoadPluginConfig() ?? new PluginConfiguration();
|
||||
m_PluginData = new PluginData(m_PluginConfiguration);
|
||||
m_PluginConfigurationUI = new PluginConfigurationUI(m_PluginConfiguration, m_PluginData);
|
||||
pluginConfiguration = PluginConfiguration.LoadPluginConfig() ?? new PluginConfiguration();
|
||||
pluginData = new PluginData(pluginConfiguration);
|
||||
pluginConfigurationUI = new PluginConfigurationUI(pluginConfiguration, pluginData);
|
||||
|
||||
Localizer.SetLanguage(PluginServices.DalamudPluginInterface.UiLanguage);
|
||||
PluginServices.DalamudPluginInterface.LanguageChanged += DalamudPluginInterface_LanguageChanged;
|
||||
@@ -49,16 +49,16 @@ namespace PlayerTags
|
||||
{
|
||||
HelpMessage = Resources.Strings.Loc_Command_playertags_v2
|
||||
});
|
||||
m_CustomTagsContextMenuFeature = new CustomTagsContextMenuFeature(m_PluginConfiguration, m_PluginData);
|
||||
m_NameplatesTagTargetFeature = new NameplateTagTargetFeature(m_PluginConfiguration, m_PluginData);
|
||||
m_ChatTagTargetFeature = new ChatTagTargetFeature(m_PluginConfiguration, m_PluginData);
|
||||
customTagsContextMenuFeature = new CustomTagsContextMenuFeature(pluginConfiguration, pluginData, pluginInterface);
|
||||
nameplatesTagTargetFeature = new NameplateTagTargetFeature(pluginConfiguration, pluginData);
|
||||
chatTagTargetFeature = new ChatTagTargetFeature(pluginConfiguration, pluginData);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
m_ChatTagTargetFeature.Dispose();
|
||||
m_NameplatesTagTargetFeature.Dispose();
|
||||
m_CustomTagsContextMenuFeature.Dispose();
|
||||
chatTagTargetFeature.Dispose();
|
||||
nameplatesTagTargetFeature.Dispose();
|
||||
customTagsContextMenuFeature.Dispose();
|
||||
PluginServices.DalamudPluginInterface.LanguageChanged -= DalamudPluginInterface_LanguageChanged;
|
||||
PluginServices.CommandManager.RemoveHandler(c_CommandName);
|
||||
PluginServices.DalamudPluginInterface.UiBuilder.OpenConfigUi -= UiBuilder_OpenConfigUi;
|
||||
@@ -90,13 +90,13 @@ namespace PlayerTags
|
||||
switch (lowerArgs[0])
|
||||
{
|
||||
case c_CommandArg_On:
|
||||
m_PluginConfiguration.EnabledGlobal = true;
|
||||
pluginConfiguration.EnabledGlobal = true;
|
||||
break;
|
||||
case c_CommandArg_Off:
|
||||
m_PluginConfiguration.EnabledGlobal = false;
|
||||
pluginConfiguration.EnabledGlobal = false;
|
||||
break;
|
||||
case c_CommandArg_toggle:
|
||||
m_PluginConfiguration.EnabledGlobal = !m_PluginConfiguration.EnabledGlobal;
|
||||
pluginConfiguration.EnabledGlobal = !pluginConfiguration.EnabledGlobal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -110,14 +110,14 @@ namespace PlayerTags
|
||||
|
||||
private void UiBuilder_Draw()
|
||||
{
|
||||
if (m_PluginConfiguration.IsVisible)
|
||||
m_PluginConfigurationUI.Draw();
|
||||
if (pluginConfiguration.IsVisible)
|
||||
pluginConfigurationUI.Draw();
|
||||
}
|
||||
|
||||
private void UiBuilder_OpenConfigUi()
|
||||
{
|
||||
m_PluginConfiguration.IsVisible = true;
|
||||
m_PluginConfiguration.Save(m_PluginData);
|
||||
pluginConfiguration.IsVisible = true;
|
||||
pluginConfiguration.Save(pluginData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,20 +7,24 @@ using Dalamud.Game.Command;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace PlayerTags
|
||||
{
|
||||
public class PluginServices
|
||||
{
|
||||
[PluginService] public static ChatGui ChatGui { get; set; } = null!;
|
||||
[PluginService] public static ClientState ClientState { get; set; } = null!;
|
||||
[PluginService] public static CommandManager CommandManager { get; set; } = null!;
|
||||
[PluginService] public static DalamudPluginInterface DalamudPluginInterface { get; set; } = null!;
|
||||
[PluginService] public static DataManager DataManager { get; set; } = null!;
|
||||
[PluginService] public static Framework Framework { get; set; } = null!;
|
||||
[PluginService] public static GameGui GameGui { get; set; } = null!;
|
||||
[PluginService] public static ObjectTable ObjectTable { get; set; } = null!;
|
||||
[PluginService] public static PartyList PartyList { get; set; } = null!;
|
||||
[PluginService] public static IPluginLog PluginLog { get; set; } = null;
|
||||
[PluginService] public static IGameConfig GameConfig { get; set; } = null;
|
||||
[PluginService] public static IChatGui ChatGui { get; set; } = null!;
|
||||
[PluginService] public static IClientState ClientState { get; set; } = null!;
|
||||
[PluginService] public static ICommandManager CommandManager { get; set; } = null!;
|
||||
[PluginService] public static IDataManager DataManager { get; set; } = null!;
|
||||
[PluginService] public static IFramework Framework { get; set; } = null!;
|
||||
[PluginService] public static IGameGui GameGui { get; set; } = null!;
|
||||
[PluginService] public static IObjectTable ObjectTable { get; set; } = null!;
|
||||
[PluginService] public static IPartyList PartyList { get; set; } = null!;
|
||||
[PluginService] public static IGameInteropProvider GameInteropProvider { get; set; } = null;
|
||||
|
||||
public static void Initialize(DalamudPluginInterface pluginInterface)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace PlayerTags
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PluginLog.Error(ex, $"RandomNameGenerator failed to read adjectives");
|
||||
PluginServices.PluginLog.Error(ex, $"RandomNameGenerator failed to read adjectives");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace PlayerTags
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PluginLog.Error(ex, $"RandomNameGenerator failed to read nouns");
|
||||
PluginServices.PluginLog.Error(ex, $"RandomNameGenerator failed to read nouns");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user