1
0
Fork 0

fix: missing DalamudChat bind

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

View File

@ -69,27 +69,23 @@ namespace FFXIV_Vibe_Plugin {
if (DalamudChat != null) { if (DalamudChat != null) {
DalamudChat.ChatMessage += ChatWasTriggered; 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 // 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);
@ -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) { 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,13 +35,14 @@ 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;
this.Configuration = this.PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); 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) { this.CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand) {
HelpMessage = "A vibe plugin for fun..." HelpMessage = "A vibe plugin for fun..."
@ -51,9 +52,9 @@ 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);
} }