added chest looter

This commit is contained in:
erik 2025-12-09 21:23:51 +01:00
parent 2eb9a7773e
commit c90a11fc29
4 changed files with 1603 additions and 4 deletions

View file

@ -119,7 +119,8 @@ namespace MosswartMassacre
public static bool AggressiveChatStreamingEnabled { get; set; } = true;
private MossyInventory _inventoryLogger;
public static NavVisualization navVisualization;
public static ChestLooter chestLooter;
// Quest Management for always-on quest streaming
public static QuestManager questManager;
private static Timer questStreamingTimer;
@ -215,6 +216,8 @@ namespace MosswartMassacre
// Initialize navigation visualization system
navVisualization = new NavVisualization();
// Note: ChestLooter is initialized in LoginComplete after PluginSettings.Initialize()
// Note: DECAL Harmony patches will be initialized in LoginComplete event
// where the chat system is available for error messages
@ -329,6 +332,21 @@ namespace MosswartMassacre
PluginSettings.Initialize(); // Safe to call now
// Initialize chest looter system (needs PluginSettings to be ready)
try
{
chestLooter = new ChestLooter(CoreManager.Current, PluginSettings.Instance.ChestLooterSettings);
chestLooter.Initialize();
chestLooter.StatusChanged += (sender, status) =>
{
VVSTabbedMainView.UpdateChestLooterStatus(status);
};
}
catch (Exception ex)
{
WriteToChat($"[ChestLooter] Initialization failed: {ex.Message}");
}
// Apply the values
RareMetaEnabled = PluginSettings.Instance.RareMetaEnabled;
WebSocketEnabled = PluginSettings.Instance.WebSocketEnabled;
@ -494,6 +512,21 @@ namespace MosswartMassacre
// 1. Initialize settings - CRITICAL first step
PluginSettings.Initialize();
// 1b. Initialize chest looter system (needs PluginSettings to be ready)
try
{
chestLooter = new ChestLooter(CoreManager.Current, PluginSettings.Instance.ChestLooterSettings);
chestLooter.Initialize();
chestLooter.StatusChanged += (sender, status) =>
{
VVSTabbedMainView.UpdateChestLooterStatus(status);
};
}
catch (Exception ex)
{
WriteToChat($"[ChestLooter] Initialization failed: {ex.Message}");
}
// 2. Apply the values from settings
RareMetaEnabled = PluginSettings.Instance.RareMetaEnabled;
WebSocketEnabled = PluginSettings.Instance.WebSocketEnabled;
@ -1216,7 +1249,7 @@ namespace MosswartMassacre
}
else
{
// Hot reload fallback - use CoreManager directly like the original template
// Hot reload fallback1 - use CoreManager directly like the original template
CoreManager.Current.Actions.AddChatText("[Mosswart Massacre] " + message, 1);
}
}
@ -1277,7 +1310,7 @@ namespace MosswartMassacre
}
private void HandleMmCommand(string text)
{
// Remove the /mm prefix and trim extra whitespace
// Remove the /mm prefix and trim extra whitespace test
string[] args = text.Substring(3).Trim().Split(' ');
if (args.Length == 0 || string.IsNullOrEmpty(args[0]))
@ -1356,6 +1389,10 @@ namespace MosswartMassacre
WriteToChat("/mm http - Local http-command server enable|disable");
WriteToChat("/mm remotecommand - Listen to allegiance !do/!dot enable|disable");
WriteToChat("/mm getmetastate - Gets the current metastate");
WriteToChat("/mm setchest <name> - Set chest name for looter");
WriteToChat("/mm setkey <name> - Set key name for looter");
WriteToChat("/mm lootchest - Start chest looting");
WriteToChat("/mm stoploot - Stop chest looting");
WriteToChat("/mm nextwp - Advance VTank to next waypoint");
WriteToChat("/mm decalstatus - Check Harmony patch status (UtilityBelt version)");
WriteToChat("/mm decaldebug - Enable/disable plugin message debug output + WebSocket streaming");
@ -1460,6 +1497,69 @@ namespace MosswartMassacre
}
break;
case "setchest":
if (args.Length < 2)
{
WriteToChat("[ChestLooter] Usage: /mm setchest <chest name>");
return;
}
string chestName = string.Join(" ", args.Skip(1));
if (chestLooter != null)
{
chestLooter.SetChestName(chestName);
if (PluginSettings.Instance?.ChestLooterSettings != null)
{
PluginSettings.Instance.ChestLooterSettings.ChestName = chestName;
PluginSettings.Save();
}
Views.VVSTabbedMainView.RefreshChestLooterUI();
}
break;
case "setkey":
if (args.Length < 2)
{
WriteToChat("[ChestLooter] Usage: /mm setkey <key name>");
return;
}
string keyName = string.Join(" ", args.Skip(1));
if (chestLooter != null)
{
chestLooter.SetKeyName(keyName);
if (PluginSettings.Instance?.ChestLooterSettings != null)
{
PluginSettings.Instance.ChestLooterSettings.KeyName = keyName;
PluginSettings.Save();
}
Views.VVSTabbedMainView.RefreshChestLooterUI();
}
break;
case "lootchest":
if (chestLooter != null)
{
if (!chestLooter.StartByName())
{
WriteToChat("[ChestLooter] Failed to start. Check chest/key names are set.");
}
}
else
{
WriteToChat("[ChestLooter] Chest looter not initialized");
}
break;
case "stoploot":
if (chestLooter != null)
{
chestLooter.Stop();
}
else
{
WriteToChat("[ChestLooter] Chest looter not initialized");
}
break;
case "vtanktest":
try
{