Fixed bug in quests
This commit is contained in:
parent
553a2388d1
commit
c174c143c6
3 changed files with 60 additions and 13 deletions
|
|
@ -368,7 +368,9 @@ namespace MosswartMassacre
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
questManager = new QuestManager();
|
questManager = new QuestManager();
|
||||||
questManager.RefreshQuests();
|
|
||||||
|
// Trigger full quest data refresh (same as clicking refresh button)
|
||||||
|
Views.FlagTrackerView.RefreshQuestData();
|
||||||
|
|
||||||
// Initialize quest streaming timer (30 seconds)
|
// Initialize quest streaming timer (30 seconds)
|
||||||
questStreamingTimer = new Timer(30000);
|
questStreamingTimer = new Timer(30000);
|
||||||
|
|
@ -376,7 +378,7 @@ namespace MosswartMassacre
|
||||||
questStreamingTimer.AutoReset = true;
|
questStreamingTimer.AutoReset = true;
|
||||||
questStreamingTimer.Start();
|
questStreamingTimer.Start();
|
||||||
|
|
||||||
WriteToChat("[OK] Quest streaming initialized");
|
WriteToChat("[OK] Quest streaming initialized with full data refresh");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -524,16 +526,15 @@ namespace MosswartMassacre
|
||||||
{
|
{
|
||||||
questManager = new QuestManager();
|
questManager = new QuestManager();
|
||||||
WriteToChat("[OK] Quest manager reinitialized");
|
WriteToChat("[OK] Quest manager reinitialized");
|
||||||
|
|
||||||
// Request quest data immediately
|
|
||||||
questManager.RefreshQuests();
|
|
||||||
WriteToChat("[INFO] Requesting quest data for hot reload...");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WriteToChat("[INFO] Quest manager already active, refreshing data...");
|
WriteToChat("[INFO] Quest manager already active");
|
||||||
questManager.RefreshQuests();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -1732,15 +1733,15 @@ namespace MosswartMassacre
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "refreshquests":
|
case "refreshquests":
|
||||||
// Force quest data refresh
|
// Force quest data refresh (same as clicking refresh button)
|
||||||
if (questManager != null)
|
try
|
||||||
{
|
{
|
||||||
WriteToChat("[QUEST] Refreshing quest data...");
|
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;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,52 @@ namespace MosswartMassacre.Views
|
||||||
{
|
{
|
||||||
return instance != null && instance.view != null && instance.view.Visible;
|
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
|
#endregion
|
||||||
|
|
||||||
#region Initialization
|
#region Initialization
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue