diff --git a/BurntToast/BurntToast.cs b/BurntToast/BurntToast.cs index 7cfa5c1..d282da0 100755 --- a/BurntToast/BurntToast.cs +++ b/BurntToast/BurntToast.cs @@ -1,26 +1,39 @@ -using Dalamud.Plugin; +using Dalamud.Game.Command; +using Dalamud.Game.Gui; +using Dalamud.Game.Gui.Toast; +using Dalamud.IoC; +using Dalamud.Plugin; using XivCommon; namespace BurntToast { public class BurntToast : IDalamudPlugin { public string Name => "Burnt Toast"; - internal DalamudPluginInterface Interface { get; private set; } = null!; - internal Configuration Config { get; private set; } = null!; - internal PluginUi Ui { get; private set; } = null!; - internal XivCommonBase Common { get; private set; } = null!; - private Commands Commands { get; set; } = null!; - private Filter Filter { get; set; } = null!; + [PluginService] + internal DalamudPluginInterface Interface { get; private init; } = null!; - public void Initialize(DalamudPluginInterface pluginInterface) { - this.Interface = pluginInterface; + [PluginService] + internal ChatGui ChatGui { get; private init; } = null!; + [PluginService] + internal CommandManager CommandManager { get; private init; } = null!; + + [PluginService] + internal ToastGui ToastGui { get; private init; } = null!; + + internal Configuration Config { get; } + internal PluginUi Ui { get; } + internal XivCommonBase Common { get; } + private Commands Commands { get; } + private Filter Filter { get; } + + public BurntToast() { this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration(); this.Config.Initialise(this); this.Ui = new PluginUi(this); this.Commands = new Commands(this); - this.Common = new XivCommonBase(this.Interface, Hooks.BattleTalk); + this.Common = new XivCommonBase(Hooks.BattleTalk); this.Filter = new Filter(this); } diff --git a/BurntToast/BurntToast.csproj b/BurntToast/BurntToast.csproj index 89a4047..5533303 100755 --- a/BurntToast/BurntToast.csproj +++ b/BurntToast/BurntToast.csproj @@ -1,34 +1,32 @@ - net48 + net5-windows BurntToast BurntToast enable 1.2.1 latest + false + true + $(AppData)\XIVLauncher\addon\Hooks\dev - D:\code\Dalamud\bin\Dalamud.dll + $(Dalamud)\Dalamud.dll False - D:\code\Dalamud\bin\ImGui.NET.dll - False - - - D:\code\Dalamud\bin\ImGuiScene.dll + $(Dalamud)\ImGui.NET.dll False - - - - + + + diff --git a/BurntToast/Commands.cs b/BurntToast/Commands.cs index 56ddb2d..aa0a63c 100755 --- a/BurntToast/Commands.cs +++ b/BurntToast/Commands.cs @@ -14,16 +14,16 @@ namespace BurntToast { internal Commands(BurntToast plugin) { this.Plugin = plugin; - foreach (var entry in CommandList) { - this.Plugin.Interface.CommandManager.AddHandler(entry.Key, new CommandInfo(this.OnCommand) { - HelpMessage = entry.Value, + foreach (var (name, desc) in CommandList) { + this.Plugin.CommandManager.AddHandler(name, new CommandInfo(this.OnCommand) { + HelpMessage = desc, }); } } public void Dispose() { foreach (var name in CommandList.Keys) { - this.Plugin.Interface.CommandManager.RemoveHandler(name); + this.Plugin.CommandManager.RemoveHandler(name); } } diff --git a/BurntToast/Filter.cs b/BurntToast/Filter.cs index e848e2c..580dd5c 100755 --- a/BurntToast/Filter.cs +++ b/BurntToast/Filter.cs @@ -1,6 +1,6 @@ using System; using System.Linq; -using Dalamud.Game.Internal.Gui.Toast; +using Dalamud.Game.Gui.Toast; using Dalamud.Game.Text; using Dalamud.Game.Text.SeStringHandling; using XivCommon.Functions; @@ -12,17 +12,17 @@ namespace BurntToast { internal Filter(BurntToast plugin) { this.Plugin = plugin; - this.Plugin.Interface.Framework.Gui.Toast.OnToast += this.OnToast; - this.Plugin.Interface.Framework.Gui.Toast.OnQuestToast += this.OnQuestToast; - this.Plugin.Interface.Framework.Gui.Toast.OnErrorToast += this.OnErrorToast; + this.Plugin.ToastGui.Toast += this.OnToast; + this.Plugin.ToastGui.QuestToast += this.OnQuestToast; + this.Plugin.ToastGui.ErrorToast += this.OnErrorToast; this.Plugin.Common.Functions.BattleTalk.OnBattleTalk += this.OnBattleTalk; } public void Dispose() { this.Plugin.Common.Functions.BattleTalk.OnBattleTalk -= this.OnBattleTalk; - this.Plugin.Interface.Framework.Gui.Toast.OnErrorToast -= this.OnErrorToast; - this.Plugin.Interface.Framework.Gui.Toast.OnQuestToast -= this.OnQuestToast; - this.Plugin.Interface.Framework.Gui.Toast.OnToast -= this.OnToast; + this.Plugin.ToastGui.ErrorToast -= this.OnErrorToast; + this.Plugin.ToastGui.QuestToast -= this.OnQuestToast; + this.Plugin.ToastGui.Toast -= this.OnToast; } private bool AnyMatches(string text) { @@ -65,10 +65,10 @@ namespace BurntToast { isHandled = true; if (pattern.ShowMessage) { - this.Plugin.Interface.Framework.Gui.Chat.PrintChat(new XivChatEntry { + this.Plugin.ChatGui.PrintChat(new XivChatEntry { Type = (XivChatType) 68, Name = sender.TextValue, - MessageBytes = message.Encode(), + Message = message, }); } } diff --git a/BurntToast/FodyWeavers.xml b/BurntToast/FodyWeavers.xml deleted file mode 100755 index 2dfb1f4..0000000 --- a/BurntToast/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/BurntToast/PluginUi.cs b/BurntToast/PluginUi.cs index 042d82a..0a774fc 100755 --- a/BurntToast/PluginUi.cs +++ b/BurntToast/PluginUi.cs @@ -17,20 +17,20 @@ namespace BurntToast { public PluginUi(BurntToast plugin) { this.Plugin = plugin; - this.Plugin.Interface.UiBuilder.OnBuildUi += this.Draw; - this.Plugin.Interface.UiBuilder.OnOpenConfigUi += this.OnOpenConfig; + this.Plugin.Interface.UiBuilder.Draw += this.Draw; + this.Plugin.Interface.UiBuilder.OpenConfigUi += this.OnOpenConfig; } public void Dispose() { - this.Plugin.Interface.UiBuilder.OnOpenConfigUi -= this.OnOpenConfig; - this.Plugin.Interface.UiBuilder.OnBuildUi -= this.Draw; + this.Plugin.Interface.UiBuilder.OpenConfigUi -= this.OnOpenConfig; + this.Plugin.Interface.UiBuilder.Draw -= this.Draw; } internal void ToggleConfig() { this.ShowSettings = !this.ShowSettings; } - private void OnOpenConfig(object? sender, EventArgs e) { + private void OnOpenConfig() { this.ShowSettings = true; }