Remove unused features: HTTP server, old telemetry, !do/!dot chat commands

- Delete HttpCommandServer.cs (localhost:8085 HTTP listener)
- Delete Telemetry.cs (old HTTP POST to mosswart.snakedesert.se/position/)
- Remove !do/!dot allegiance chat regex matching from OnChatText
- Remove RemoteCommandsEnabled, HttpServerEnabled, TelemetryEnabled settings
- Remove corresponding UI checkboxes, /mm command handlers, and wiring
- Keep: WebSocket command receive, ClientTelemetry.cs (used by WS streaming)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
erik 2026-02-27 07:02:07 +00:00
parent c53aa4b31b
commit 9e9a94f159
8 changed files with 6 additions and 452 deletions

View file

@ -111,10 +111,7 @@ namespace MosswartMassacre
Views.VVSTabbedMainView.RefreshUpdateStatus();
}
}
public static bool RemoteCommandsEnabled { get; set; } = false;
public static bool HttpServerEnabled { get; set; } = false;
public static string CharTag { get; set; } = "";
public static bool TelemetryEnabled { get; set; } = false;
public static bool WebSocketEnabled { get; set; } = false;
public bool InventoryLogEnabled { get; set; } = false;
public static bool AggressiveChatStreamingEnabled { get; set; } = true;
@ -240,8 +237,6 @@ namespace MosswartMassacre
try
{
PluginSettings.Save();
if (TelemetryEnabled)
Telemetry.Stop(); // ensure no dangling timer / HttpClient
WriteToChat("Mosswart Massacre is shutting down. Bye!");
@ -367,14 +362,9 @@ namespace MosswartMassacre
// Apply the values
RareMetaEnabled = PluginSettings.Instance.RareMetaEnabled;
WebSocketEnabled = PluginSettings.Instance.WebSocketEnabled;
RemoteCommandsEnabled = PluginSettings.Instance.RemoteCommandsEnabled;
HttpServerEnabled = PluginSettings.Instance.HttpServerEnabled;
TelemetryEnabled = PluginSettings.Instance.TelemetryEnabled;
CharTag = PluginSettings.Instance.CharTag;
ViewManager.SetRareMetaToggleState(RareMetaEnabled);
ViewManager.RefreshSettingsFromConfig(); // Refresh all UI settings after loading
if (TelemetryEnabled)
Telemetry.Start();
if (WebSocketEnabled)
WebSocket.Start();
@ -575,9 +565,6 @@ namespace MosswartMassacre
// 2. Apply the values from settings
RareMetaEnabled = PluginSettings.Instance.RareMetaEnabled;
WebSocketEnabled = PluginSettings.Instance.WebSocketEnabled;
RemoteCommandsEnabled = PluginSettings.Instance.RemoteCommandsEnabled;
HttpServerEnabled = PluginSettings.Instance.HttpServerEnabled;
TelemetryEnabled = PluginSettings.Instance.TelemetryEnabled;
CharTag = PluginSettings.Instance.CharTag;
// 3. Update UI with current settings
@ -585,24 +572,12 @@ namespace MosswartMassacre
ViewManager.RefreshSettingsFromConfig();
// 4. Restart services if they were enabled (stop first, then start)
if (TelemetryEnabled)
{
Telemetry.Stop(); // Stop existing
Telemetry.Start(); // Restart
}
if (WebSocketEnabled)
{
WebSocket.Stop(); // Stop existing
WebSocket.Stop(); // Stop existing
WebSocket.Start(); // Restart
}
if (HttpServerEnabled)
{
HttpCommandServer.Stop(); // Stop existing
HttpCommandServer.Start(); // Restart
}
// 5. Initialize Harmony patches (only if not already done)
// Note: Harmony patches are global and don't need reinitialization
if (!DecalHarmonyClean.IsActive())
@ -1086,31 +1061,6 @@ namespace MosswartMassacre
WriteToChat($"[Mosswart Massacre] Reporting to allegiance: {reportMessage}");
MyHost.Actions.InvokeChatParser($"/a {reportMessage}");
}
if (RemoteCommandsEnabled && e.Color == 18)
{
string characterName = Regex.Escape(CoreManager.Current.CharacterFilter.Name);
string pattern = $@"^\[Allegiance\].*Dunking Rares.*say[s]?, \""!do {characterName} (?<command>.+)\""$";
string tag = Regex.Escape(PluginCore.CharTag);
string patterntag = $@"^\[Allegiance\].*Dunking Rares.*say[s]?, \""!dot {tag} (?<command>.+)\""$";
var match = Regex.Match(e.Text, pattern);
var matchtag = Regex.Match(e.Text, patterntag);
if (match.Success)
{
string command = match.Groups["command"].Value;
DispatchChatToBoxWithPluginIntercept(command);
DelayedCommandManager.AddDelayedCommand($"/a [Remote] Executing: {command}", 2000);
}
else if (matchtag.Success)
{
string command = matchtag.Groups["command"].Value;
DispatchChatToBoxWithPluginIntercept(command);
DelayedCommandManager.AddDelayedCommand($"/a [Remote] Executing: {command}", 2000);
}
}
@ -1416,33 +1366,6 @@ namespace MosswartMassacre
switch (subCommand)
{
case "telemetry":
if (args.Length > 1)
{
if (args[1].Equals("enable", StringComparison.OrdinalIgnoreCase))
{
TelemetryEnabled = true;
Telemetry.Start();
PluginSettings.Instance.TelemetryEnabled = true;
WriteToChat("Telemetry streaming ENABLED.");
}
else if (args[1].Equals("disable", StringComparison.OrdinalIgnoreCase))
{
TelemetryEnabled = false;
Telemetry.Stop();
PluginSettings.Instance.TelemetryEnabled = false;
WriteToChat("Telemetry streaming DISABLED.");
}
else
{
WriteToChat("Usage: /mm telemetry <enable|disable>");
}
}
else
{
WriteToChat("Usage: /mm telemetry <enable|disable>");
}
break;
case "ws":
if (args.Length > 1)
{
@ -1475,12 +1398,9 @@ namespace MosswartMassacre
WriteToChat("Mosswart Massacre Commands:");
WriteToChat("/mm report - Show current stats");
WriteToChat("/mm loc - Show current location");
WriteToChat("/mm telemetry - Telemetry streaming enable|disable");
WriteToChat("/mm ws - Websocket streaming enable|disable");
WriteToChat("/mm reset - Reset all counters");
WriteToChat("/mm meta - Toggle rare meta state!!");
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");
@ -1526,58 +1446,6 @@ namespace MosswartMassacre
WriteToChat($"Rare meta state is now {(RareMetaEnabled ? "ON" : "OFF")}");
ViewManager.SetRareMetaToggleState(RareMetaEnabled); // <-- sync the UI
break;
case "http":
if (args.Length > 1)
{
if (args[1].Equals("enable", StringComparison.OrdinalIgnoreCase))
{
PluginSettings.Instance.HttpServerEnabled = true;
HttpServerEnabled = true;
HttpCommandServer.Start();
}
else if (args[1].Equals("disable", StringComparison.OrdinalIgnoreCase))
{
PluginSettings.Instance.HttpServerEnabled = false;
HttpServerEnabled = false;
HttpCommandServer.Stop();
}
else
{
WriteToChat("Usage: /mm http <enable|disable>");
}
}
else
{
WriteToChat("Usage: /mm http <enable|disable>");
}
break;
case "remotecommands":
if (args.Length > 1)
{
if (args[1].Equals("enable", StringComparison.OrdinalIgnoreCase))
{
PluginSettings.Instance.RemoteCommandsEnabled = true;
RemoteCommandsEnabled = true;
WriteToChat("Remote command listening is now ENABLED.");
}
else if (args[1].Equals("disable", StringComparison.OrdinalIgnoreCase))
{
PluginSettings.Instance.RemoteCommandsEnabled = false;
RemoteCommandsEnabled = false;
WriteToChat("Remote command listening is now DISABLED.");
}
else
{
WriteToChat("Invalid remotecommands argument. Use 'enable' or 'disable'.");
}
}
else
{
WriteToChat("Usage: /mm remotecommands <enable|disable>");
}
break;
case "nextwp":
double result = VtankControl.VtAdvanceWaypoint();
if (result == 1)