refactor: update for api 9
This commit is contained in:
parent
0f20595e0f
commit
c76be2aaad
|
@ -7,7 +7,6 @@ using ASodium;
|
|||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Utility;
|
||||
using ExtraChat.Protocol;
|
||||
using ExtraChat.Protocol.Channels;
|
||||
|
@ -72,11 +71,11 @@ internal class Client : IDisposable {
|
|||
this._waitersSemaphore.Dispose();
|
||||
}
|
||||
|
||||
private void Login(object? sender, EventArgs e) {
|
||||
private void Login() {
|
||||
this.StartLoop();
|
||||
}
|
||||
|
||||
private void Logout(object? sender, EventArgs e) {
|
||||
private void Logout() {
|
||||
this.StopLoop();
|
||||
}
|
||||
|
||||
|
@ -98,9 +97,9 @@ internal class Client : IDisposable {
|
|||
try {
|
||||
await this.Loop();
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Error in client loop");
|
||||
Plugin.Log.Error(ex, "Error in client loop");
|
||||
if (this._wasConnected) {
|
||||
this.Plugin.ChatGui.PrintChat(new XivChatEntry {
|
||||
this.Plugin.ChatGui.Print(new XivChatEntry {
|
||||
Message = "Disconnected from ExtraChat. Trying to reconnect.",
|
||||
Type = XivChatType.Urgent,
|
||||
});
|
||||
|
@ -164,7 +163,7 @@ internal class Client : IDisposable {
|
|||
|
||||
if (await this.Authenticate()) {
|
||||
this._wasConnected = true;
|
||||
this.Plugin.ChatGui.PrintChat(new XivChatEntry {
|
||||
this.Plugin.ChatGui.Print(new XivChatEntry {
|
||||
Message = "Connected to ExtraChat.",
|
||||
Type = XivChatType.Notice,
|
||||
});
|
||||
|
@ -663,7 +662,7 @@ internal class Client : IDisposable {
|
|||
#pragma warning restore CS4014
|
||||
|
||||
private void HandleAnnounce(AnnounceResponse resp) {
|
||||
this.Plugin.ChatGui.PrintChat(new XivChatEntry {
|
||||
this.Plugin.ChatGui.Print(new XivChatEntry {
|
||||
Type = XivChatType.Notice,
|
||||
Message = $"[ExtraChat] {resp.Announcement}",
|
||||
});
|
||||
|
@ -706,7 +705,7 @@ internal class Client : IDisposable {
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
PluginLog.LogWarning($"Unhandled update kind: {resp.Kind}");
|
||||
Plugin.Log.Warning($"Unhandled update kind: {resp.Kind}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -993,7 +992,7 @@ internal class Client : IDisposable {
|
|||
outputChannel = XivChatType.Debug;
|
||||
}
|
||||
|
||||
this.Plugin.ChatGui.PrintChat(new XivChatEntry {
|
||||
this.Plugin.ChatGui.Print(new XivChatEntry {
|
||||
Message = output.Build(),
|
||||
Name = isSelf
|
||||
? resp.Sender
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Dalamud.Game.Command;
|
||||
using Dalamud.Logging;
|
||||
using ExtraChat.Util;
|
||||
|
||||
namespace ExtraChat;
|
||||
|
@ -23,7 +22,7 @@ internal class Commands : IDisposable {
|
|||
this.RegisterAll();
|
||||
}
|
||||
|
||||
private void OnLogout(object? sender, EventArgs e) {
|
||||
private void OnLogout() {
|
||||
this.UnregisterAll();
|
||||
}
|
||||
|
||||
|
@ -74,7 +73,7 @@ internal class Commands : IDisposable {
|
|||
this.RegisteredInternal[command] = id;
|
||||
|
||||
void Handler(string _, string arguments) {
|
||||
PluginLog.LogWarning("Command handler actually invoked");
|
||||
Plugin.Log.Warning("Command handler actually invoked");
|
||||
}
|
||||
|
||||
this.Plugin.CommandManager.AddHandler(command, new CommandInfo(Handler) {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Memory;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
|
@ -89,8 +88,8 @@ internal unsafe class GameFunctions : IDisposable {
|
|||
private bool _shouldForceNameLookup;
|
||||
|
||||
internal GameFunctions(Plugin plugin) {
|
||||
SignatureHelper.Initialise(this);
|
||||
this.Plugin = plugin;
|
||||
this.Plugin.GameInteropProvider.InitializeFromAttributes(this);
|
||||
|
||||
this.SendMessageHook!.Enable();
|
||||
this.SetChatChannelHook!.Enable();
|
||||
|
@ -158,7 +157,7 @@ internal unsafe class GameFunctions : IDisposable {
|
|||
this.SendMessageHook.Original(a1, message, a3);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Error in message detour");
|
||||
Plugin.Log.Error(ex, "Error in message detour");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,7 +271,7 @@ internal unsafe class GameFunctions : IDisposable {
|
|||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Error in get chat colour detour");
|
||||
Plugin.Log.Error(ex, "Error in get chat colour detour");
|
||||
}
|
||||
|
||||
return this.GetChatColourHook.Original(a1, a2);
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
using ASodium;
|
||||
using Dalamud.ContextMenu;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Game.Gui.Toast;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using ExtraChat.Integrations;
|
||||
using ExtraChat.Ui;
|
||||
using ExtraChat.Util;
|
||||
|
@ -20,40 +15,45 @@ namespace ExtraChat;
|
|||
|
||||
// ReSharper disable once ClassNeverInstantiated.Global
|
||||
public class Plugin : IDalamudPlugin {
|
||||
internal const string PluginName = "ExtraChat";
|
||||
internal const ushort DefaultColour = 578;
|
||||
|
||||
public string Name => PluginName;
|
||||
internal static string Name => "ExtraChat";
|
||||
|
||||
[PluginService]
|
||||
internal static IPluginLog Log { get; private set; }
|
||||
|
||||
[PluginService]
|
||||
internal DalamudPluginInterface Interface { get; init; }
|
||||
|
||||
[PluginService]
|
||||
internal ClientState ClientState { get; init; }
|
||||
internal IClientState ClientState { get; init; }
|
||||
|
||||
[PluginService]
|
||||
internal CommandManager CommandManager { get; init; }
|
||||
internal ICommandManager CommandManager { get; init; }
|
||||
|
||||
[PluginService]
|
||||
internal ChatGui ChatGui { get; init; }
|
||||
internal IChatGui ChatGui { get; init; }
|
||||
|
||||
[PluginService]
|
||||
internal DataManager DataManager { get; init; }
|
||||
internal IDataManager DataManager { get; init; }
|
||||
|
||||
[PluginService]
|
||||
internal Framework Framework { get; init; }
|
||||
internal IFramework Framework { get; init; }
|
||||
|
||||
[PluginService]
|
||||
internal GameGui GameGui { get; init; }
|
||||
internal IGameGui GameGui { get; init; }
|
||||
|
||||
[PluginService]
|
||||
internal ObjectTable ObjectTable { get; init; }
|
||||
internal IObjectTable ObjectTable { get; init; }
|
||||
|
||||
[PluginService]
|
||||
internal TargetManager TargetManager { get; init; }
|
||||
internal ITargetManager TargetManager { get; init; }
|
||||
|
||||
[PluginService]
|
||||
private ToastGui ToastGui { get; init; }
|
||||
internal IGameInteropProvider GameInteropProvider { get; init; }
|
||||
|
||||
[PluginService]
|
||||
private IToastGui ToastGui { get; init; }
|
||||
|
||||
internal Configuration Config { get; }
|
||||
internal ConfigInfo ConfigInfo => this.Config.GetConfig(this.ClientState.LocalContentId);
|
||||
|
@ -120,7 +120,7 @@ public class Plugin : IDalamudPlugin {
|
|||
this.ContextMenu.Dispose();
|
||||
}
|
||||
|
||||
private void FrameworkUpdate(Framework framework) {
|
||||
private void FrameworkUpdate(IFramework framework) {
|
||||
if (this.ClientState.LocalPlayer is { } player) {
|
||||
this.LocalPlayer = player;
|
||||
} else if (!this.ClientState.IsLoggedIn) {
|
||||
|
@ -173,10 +173,10 @@ public class Plugin : IDalamudPlugin {
|
|||
if (this.Config.UseNativeToasts) {
|
||||
this.ToastGui.ShowNormal(message);
|
||||
} else {
|
||||
this.Interface.UiBuilder.AddNotification(message, this.Name, NotificationType.Info);
|
||||
this.Interface.UiBuilder.AddNotification(message, Name, NotificationType.Info);
|
||||
}
|
||||
|
||||
this.ChatGui.PrintChat(new XivChatEntry {
|
||||
this.ChatGui.Print(new XivChatEntry {
|
||||
Type = XivChatType.SystemMessage,
|
||||
Message = message,
|
||||
});
|
||||
|
@ -186,10 +186,10 @@ public class Plugin : IDalamudPlugin {
|
|||
if (this.Config.UseNativeToasts) {
|
||||
this.ToastGui.ShowError(message);
|
||||
} else {
|
||||
this.Interface.UiBuilder.AddNotification(message, this.Name, NotificationType.Error);
|
||||
this.Interface.UiBuilder.AddNotification(message, Name, NotificationType.Error);
|
||||
}
|
||||
|
||||
this.ChatGui.PrintChat(new XivChatEntry {
|
||||
this.ChatGui.Print(new XivChatEntry {
|
||||
Type = XivChatType.ErrorMessage,
|
||||
Message = message,
|
||||
});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Numerics;
|
||||
using System.Text;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using ExtraChat.Protocol;
|
||||
using ExtraChat.Protocol.Channels;
|
||||
using ExtraChat.Util;
|
||||
|
@ -40,10 +41,10 @@ internal class ChannelList {
|
|||
|
||||
var syncButton = ImGui.CalcTextSize(FontAwesomeIcon.Sync.ToIconString()).X
|
||||
+ ImGui.GetStyle().FramePadding.X * 2;
|
||||
// PluginLog.Log($"syncButton: {syncButton}");
|
||||
// Plugin.Log.Info($"syncButton: {syncButton}");
|
||||
var addButton = ImGui.CalcTextSize(FontAwesomeIcon.Plus.ToIconString()).X
|
||||
+ ImGui.GetStyle().FramePadding.X * 2;
|
||||
// PluginLog.Log($"addButton: {addButton}");
|
||||
// Plugin.Log.Info($"addButton: {addButton}");
|
||||
var syncOffset = ImGui.GetContentRegionAvail().X - syncButton;
|
||||
var addOffset = ImGui.GetContentRegionAvail().X - syncButton - ImGui.GetStyle().ItemSpacing.X - addButton;
|
||||
ImGui.SameLine(syncOffset);
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Numerics;
|
|||
using System.Threading.Channels;
|
||||
using Dalamud;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Plugin;
|
||||
using ExtraChat.Protocol.Channels;
|
||||
using ExtraChat.Util;
|
||||
|
@ -77,7 +78,7 @@ internal class PluginUi : IDisposable {
|
|||
|
||||
ImGui.SetNextWindowSize(new Vector2(500, 325) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver);
|
||||
|
||||
if (!ImGui.Begin(this.Plugin.Name, ref this.Visible)) {
|
||||
if (!ImGui.Begin(Plugin.Name, ref this.Visible)) {
|
||||
ImGui.End();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Numerics;
|
||||
using System.Text;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace ExtraChat.Util;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Dalamud.Data;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace ExtraChat.Util;
|
||||
|
@ -6,7 +6,7 @@ namespace ExtraChat.Util;
|
|||
internal static class WorldUtil {
|
||||
private static readonly Dictionary<ushort, string> WorldNames = new();
|
||||
|
||||
internal static void Initialise(DataManager data) {
|
||||
internal static void Initialise(IDataManager data) {
|
||||
WorldNames.Clear();
|
||||
|
||||
var worlds = data.GetExcelSheet<World>();
|
||||
|
|
Loading…
Reference in New Issue