diff --git a/MosswartMassacre/PluginCore.cs b/MosswartMassacre/PluginCore.cs index f73fb3b..0342cab 100644 --- a/MosswartMassacre/PluginCore.cs +++ b/MosswartMassacre/PluginCore.cs @@ -368,7 +368,9 @@ namespace MosswartMassacre try { questManager = new QuestManager(); - questManager.RefreshQuests(); + + // Trigger full quest data refresh (same as clicking refresh button) + Views.FlagTrackerView.RefreshQuestData(); // Initialize quest streaming timer (30 seconds) questStreamingTimer = new Timer(30000); @@ -376,7 +378,7 @@ namespace MosswartMassacre questStreamingTimer.AutoReset = true; questStreamingTimer.Start(); - WriteToChat("[OK] Quest streaming initialized"); + WriteToChat("[OK] Quest streaming initialized with full data refresh"); } catch (Exception ex) { @@ -524,16 +526,15 @@ namespace MosswartMassacre { questManager = new QuestManager(); WriteToChat("[OK] Quest manager reinitialized"); - - // Request quest data immediately - questManager.RefreshQuests(); - WriteToChat("[INFO] Requesting quest data for hot reload..."); } else { - WriteToChat("[INFO] Quest manager already active, refreshing data..."); - questManager.RefreshQuests(); + WriteToChat("[INFO] Quest manager already active"); } + + // Trigger full quest data refresh (same as clicking refresh button) + Views.FlagTrackerView.RefreshQuestData(); + WriteToChat("[INFO] Quest data refresh triggered for hot reload"); } catch (Exception ex) { @@ -1732,15 +1733,15 @@ namespace MosswartMassacre break; case "refreshquests": - // Force quest data refresh - if (questManager != null) + // Force quest data refresh (same as clicking refresh button) + try { WriteToChat("[QUEST] Refreshing quest data..."); - questManager.RefreshQuests(); + Views.FlagTrackerView.RefreshQuestData(); } - else + catch (Exception ex) { - WriteToChat("[QUEST] Quest manager not initialized"); + WriteToChat($"[QUEST] Refresh failed: {ex.Message}"); } break; diff --git a/MosswartMassacre/Views/FlagTrackerView.cs b/MosswartMassacre/Views/FlagTrackerView.cs index d2696f2..b947879 100644 --- a/MosswartMassacre/Views/FlagTrackerView.cs +++ b/MosswartMassacre/Views/FlagTrackerView.cs @@ -108,6 +108,52 @@ namespace MosswartMassacre.Views { return instance != null && instance.view != null && instance.view.Visible; } + + public static void RefreshQuestData() + { + try + { + if (PluginCore.questManager != null) + { + PluginCore.questManager.RefreshQuests(); + + // If Flag Tracker window is open, also refresh the UI + if (instance != null) + { + instance.PopulateQuestsList(); + + // Schedule another refresh in a few seconds to catch any data + System.Threading.Timer refreshTimer = null; + refreshTimer = new System.Threading.Timer(_ => + { + try + { + if (instance != null) + { + instance.PopulateQuestsList(); + } + } + catch (Exception timerEx) + { + PluginCore.WriteToChat($"[MossyTracker] Delayed refresh failed: {timerEx.Message}"); + } + finally + { + refreshTimer?.Dispose(); + } + }, null, 4000, System.Threading.Timeout.Infinite); + } + } + else + { + PluginCore.WriteToChat("[MossyTracker] Quest manager not available for refresh"); + } + } + catch (Exception ex) + { + PluginCore.WriteToChat($"[MossyTracker] Quest refresh failed: {ex.Message}"); + } + } #endregion #region Initialization diff --git a/MosswartMassacre/bin/Release/MosswartMassacre.dll b/MosswartMassacre/bin/Release/MosswartMassacre.dll index 1610162..a9b71e1 100644 Binary files a/MosswartMassacre/bin/Release/MosswartMassacre.dll and b/MosswartMassacre/bin/Release/MosswartMassacre.dll differ