1
0

fix: missing DalamudChat bind

This commit is contained in:
Kacie 2023-01-30 21:04:22 +01:00
parent f2739939c6
commit c7bb9fc2b0
2 changed files with 14 additions and 20 deletions

View File

@ -71,25 +71,21 @@ namespace FFXIV_Vibe_Plugin {
DalamudChat.ChatMessage += ChatWasTriggered; DalamudChat.ChatMessage += ChatWasTriggered;
} }
this.Logger = new Logger(this.DalamudChat, ShortName, Logger.LogLevel.VERBOSE); this.Logger = new Logger(this.DalamudChat, ShortName, Logger.LogLevel.VERBOSE);
if(DalamudChat == null) {
this.Logger.Error("DalamudChat was not initialized correctly.");
}
// Migrations // Migrations
Migration migration = new(Configuration, Logger); 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 // Configuration Profile
this.ConfigurationProfile = this.Configuration.GetDefaultProfile(); this.ConfigurationProfile = this.Configuration.GetDefaultProfile();
// Patterns // Patterns
this.Patterns = new Patterns(); this.Patterns = new Patterns();
this.Patterns.SetCustomPatterns(this.ConfigurationProfile.PatternList); this.Patterns.SetCustomPatterns(this.ConfigurationProfile.PatternList);
// Initialize the devices Controller // Initialize the devices Controller
this.DeviceController = new Device.DevicesController(this.Logger, this.Configuration, this.ConfigurationProfile, this.Patterns); this.DeviceController = new Device.DevicesController(this.Logger, this.Configuration, this.ConfigurationProfile, this.Patterns);
if (this.ConfigurationProfile.AUTO_CONNECT) { if (this.ConfigurationProfile.AUTO_CONNECT) {
@ -100,13 +96,10 @@ namespace FFXIV_Vibe_Plugin {
t.Start(); t.Start();
} }
// Initialize Hook ActionEffect // Initialize Hook ActionEffect
this.hook_ActionEffect = new(this.DataManager, this.Logger, this.Scanner, clientState, gameObjects); this.hook_ActionEffect = new(this.DataManager, this.Logger, this.Scanner, clientState, gameObjects);
this.hook_ActionEffect.ReceivedEvent += SpellWasTriggered; this.hook_ActionEffect.ReceivedEvent += SpellWasTriggered;
// Init the login event. // Init the login event.
this.ClientState.Login += this.ClientState_LoginEvent; this.ClientState.Login += this.ClientState_LoginEvent;
@ -115,7 +108,6 @@ namespace FFXIV_Vibe_Plugin {
PlayerStats.Event_CurrentHpChanged += this.PlayerCurrentHPChanged; PlayerStats.Event_CurrentHpChanged += this.PlayerCurrentHPChanged;
PlayerStats.Event_MaxHpChanged += this.PlayerCurrentHPChanged; PlayerStats.Event_MaxHpChanged += this.PlayerCurrentHPChanged;
// Triggers // Triggers
this.TriggersController = new Triggers.TriggersController(this.Logger, this.PlayerStats, this.ConfigurationProfile); this.TriggersController = new Triggers.TriggersController(this.Logger, this.PlayerStats, this.ConfigurationProfile);
@ -293,11 +285,12 @@ 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) { if (this.TriggersController == null) {
this.Logger.Warn("ChatWasTriggered: TriggersController not init yet, ignoring chat..."); this.Logger.Warn("ChatWasTriggered: TriggersController not init yet, ignoring chat...");
return; return;
} }
string fromPlayerName = _sender.ToString();
if (this.ConfigurationProfile != null && this.ConfigurationProfile.VERBOSE_CHAT) { if (this.ConfigurationProfile != null && this.ConfigurationProfile.VERBOSE_CHAT) {
string XivChatTypeName = ((XivChatType)chatType).ToString(); string XivChatTypeName = ((XivChatType)chatType).ToString();
this.Logger.Debug($"VERBOSE_CHAT: {fromPlayerName} type={XivChatTypeName}: {_message}"); this.Logger.Debug($"VERBOSE_CHAT: {fromPlayerName} type={XivChatTypeName}: {_message}");

View File

@ -35,7 +35,8 @@ namespace FFXIV_Vibe_Plugin {
[RequiredVersion("1.0")] GameNetwork gameNetwork, [RequiredVersion("1.0")] GameNetwork gameNetwork,
[RequiredVersion("1.0")] SigScanner scanner, [RequiredVersion("1.0")] SigScanner scanner,
[RequiredVersion("1.0")] ObjectTable gameObjects, [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.PluginInterface = pluginInterface;
this.CommandManager = commandManager; this.CommandManager = commandManager;
@ -51,7 +52,7 @@ namespace FFXIV_Vibe_Plugin {
this.PluginInterface.UiBuilder.OpenConfigUi += DrawConfigUI; this.PluginInterface.UiBuilder.OpenConfigUi += DrawConfigUI;
// Init our own app // Init our own app
this.app = new FFXIV_Vibe_Plugin.App(this, CommandName, ShortName, gameNetwork, clientState, dataManager, DalamudChat, Configuration, scanner, gameObjects, pluginInterface); this.app = new FFXIV_Vibe_Plugin.App(this, CommandName, ShortName, gameNetwork, clientState, dataManager, dalamudChat, Configuration, scanner, gameObjects, pluginInterface);
// Setting the windows // Setting the windows
WindowSystem.AddWindow(this.app.PluginUi); WindowSystem.AddWindow(this.app.PluginUi);