From c7bb9fc2b087958818c5e047ce7cb38f636ec979 Mon Sep 17 00:00:00 2001 From: Kacie <90719658+kaciexx@users.noreply.github.com> Date: Mon, 30 Jan 2023 21:04:22 +0100 Subject: [PATCH] fix: missing DalamudChat bind --- FFXIV_Vibe_Plugin/App/App.cs | 23 ++++++++--------------- FFXIV_Vibe_Plugin/Plugin.cs | 11 ++++++----- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/FFXIV_Vibe_Plugin/App/App.cs b/FFXIV_Vibe_Plugin/App/App.cs index f499f33..6e4fd85 100644 --- a/FFXIV_Vibe_Plugin/App/App.cs +++ b/FFXIV_Vibe_Plugin/App/App.cs @@ -69,27 +69,23 @@ namespace FFXIV_Vibe_Plugin { if (DalamudChat != null) { DalamudChat.ChatMessage += ChatWasTriggered; + } + this.Logger = new Logger(this.DalamudChat, ShortName, Logger.LogLevel.VERBOSE); + if(DalamudChat == null) { + this.Logger.Error("DalamudChat was not initialized correctly."); } - this.Logger = new Logger(this.DalamudChat, ShortName, Logger.LogLevel.VERBOSE); - // Migrations Migration migration = new(Configuration, Logger); - migration.Patch_0_2_0_to_1_0_0_config_profile(); - - + migration.Patch_0_2_0_to_1_0_0_config_profile(); // Configuration Profile this.ConfigurationProfile = this.Configuration.GetDefaultProfile(); - - // Patterns this.Patterns = new Patterns(); this.Patterns.SetCustomPatterns(this.ConfigurationProfile.PatternList); - - // Initialize the devices Controller this.DeviceController = new Device.DevicesController(this.Logger, this.Configuration, this.ConfigurationProfile, this.Patterns); if (this.ConfigurationProfile.AUTO_CONNECT) { @@ -100,13 +96,10 @@ namespace FFXIV_Vibe_Plugin { t.Start(); } - - // Initialize Hook ActionEffect this.hook_ActionEffect = new(this.DataManager, this.Logger, this.Scanner, clientState, gameObjects); this.hook_ActionEffect.ReceivedEvent += SpellWasTriggered; - // Init the login event. this.ClientState.Login += this.ClientState_LoginEvent; @@ -115,7 +108,6 @@ namespace FFXIV_Vibe_Plugin { PlayerStats.Event_CurrentHpChanged += this.PlayerCurrentHPChanged; PlayerStats.Event_MaxHpChanged += this.PlayerCurrentHPChanged; - // Triggers this.TriggersController = new Triggers.TriggersController(this.Logger, this.PlayerStats, this.ConfigurationProfile); @@ -292,12 +284,13 @@ namespace FFXIV_Vibe_Plugin { } } - private void ChatWasTriggered(XivChatType chatType, uint senderId, ref SeString _sender, ref SeString _message, ref bool isHandled) { + private void ChatWasTriggered(XivChatType chatType, uint senderId, ref SeString _sender, ref SeString _message, ref bool isHandled) { + string fromPlayerName = _sender.ToString(); if (this.TriggersController == null) { this.Logger.Warn("ChatWasTriggered: TriggersController not init yet, ignoring chat..."); return; } - string fromPlayerName = _sender.ToString(); + if (this.ConfigurationProfile != null && this.ConfigurationProfile.VERBOSE_CHAT) { string XivChatTypeName = ((XivChatType)chatType).ToString(); this.Logger.Debug($"VERBOSE_CHAT: {fromPlayerName} type={XivChatTypeName}: {_message}"); diff --git a/FFXIV_Vibe_Plugin/Plugin.cs b/FFXIV_Vibe_Plugin/Plugin.cs index f3e105e..01818f5 100644 --- a/FFXIV_Vibe_Plugin/Plugin.cs +++ b/FFXIV_Vibe_Plugin/Plugin.cs @@ -35,13 +35,14 @@ namespace FFXIV_Vibe_Plugin { [RequiredVersion("1.0")] GameNetwork gameNetwork, [RequiredVersion("1.0")] SigScanner scanner, [RequiredVersion("1.0")] ObjectTable gameObjects, - [RequiredVersion("1.0")] DataManager dataManager + [RequiredVersion("1.0")] DataManager dataManager, + [RequiredVersion("1.0")] Dalamud.Game.Gui.ChatGui? dalamudChat ) { this.PluginInterface = pluginInterface; this.CommandManager = commandManager; this.Configuration = this.PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); - this.Configuration.Initialize(this.PluginInterface); + this.Configuration.Initialize(this.PluginInterface); this.CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand) { HelpMessage = "A vibe plugin for fun..." @@ -51,9 +52,9 @@ namespace FFXIV_Vibe_Plugin { this.PluginInterface.UiBuilder.OpenConfigUi += DrawConfigUI; // Init our own app - this.app = new FFXIV_Vibe_Plugin.App(this, CommandName, ShortName, gameNetwork, clientState, dataManager, DalamudChat, Configuration, scanner, gameObjects, pluginInterface); - - // Setting the windows + this.app = new FFXIV_Vibe_Plugin.App(this, CommandName, ShortName, gameNetwork, clientState, dataManager, dalamudChat, Configuration, scanner, gameObjects, pluginInterface); + + // Setting the windows WindowSystem.AddWindow(this.app.PluginUi); }