Now with Plugin chat intercept. version 3.0.1.1
This commit is contained in:
parent
591da42d36
commit
96b85ed226
8 changed files with 717 additions and 401 deletions
|
|
@ -71,8 +71,9 @@ namespace MosswartMassacre
|
|||
public static bool HttpServerEnabled { get; set; } = false;
|
||||
public static string CharTag { get; set; } = "";
|
||||
public static bool TelemetryEnabled { get; set; } = false;
|
||||
public bool WebSocketEnabled { get; set; } = false;
|
||||
public static bool WebSocketEnabled { get; set; } = false;
|
||||
public bool InventoryLogEnabled { get; set; } = false;
|
||||
public static bool AggressiveChatStreamingEnabled { get; set; } = true;
|
||||
private MossyInventory _inventoryLogger;
|
||||
public static NavVisualization navVisualization;
|
||||
|
||||
|
|
@ -85,8 +86,14 @@ namespace MosswartMassacre
|
|||
try
|
||||
{
|
||||
MyHost = Host;
|
||||
|
||||
// DIAGNOSTIC: Test basic loading first
|
||||
PluginLoadDiagnostic.TestBasicLoad();
|
||||
|
||||
// TEMPORARILY DISABLED: Harmony initialization
|
||||
// HarmonyCompatibilityEnsurer.EnsureCompatibility();
|
||||
|
||||
WriteToChat("Mosswart Massacre has started!");
|
||||
// Note: Startup messages will appear after character login
|
||||
// Subscribe to chat message event
|
||||
CoreManager.Current.ChatBoxMessage += new EventHandler<ChatTextInterceptEventArgs>(OnChatText);
|
||||
CoreManager.Current.ChatBoxMessage += new EventHandler<ChatTextInterceptEventArgs>(AllChatText);
|
||||
|
|
@ -117,7 +124,8 @@ namespace MosswartMassacre
|
|||
// Initialize navigation visualization system
|
||||
navVisualization = new NavVisualization();
|
||||
|
||||
|
||||
// Note: DECAL Harmony patches will be initialized in LoginComplete event
|
||||
// where the chat system is available for error messages
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -168,6 +176,9 @@ namespace MosswartMassacre
|
|||
navVisualization = null;
|
||||
}
|
||||
|
||||
// Clean up Harmony patches
|
||||
DecalHarmonyClean.Cleanup();
|
||||
|
||||
MyHost = null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -179,6 +190,8 @@ namespace MosswartMassacre
|
|||
{
|
||||
CoreManager.Current.CharacterFilter.LoginComplete -= CharacterFilter_LoginComplete;
|
||||
|
||||
WriteToChat("Mosswart Massacre has started!");
|
||||
|
||||
PluginSettings.Initialize(); // Safe to call now
|
||||
|
||||
// Apply the values
|
||||
|
|
@ -195,6 +208,19 @@ namespace MosswartMassacre
|
|||
if (WebSocketEnabled)
|
||||
WebSocket.Start();
|
||||
|
||||
// Initialize Harmony patches using UtilityBelt's loaded DLL
|
||||
try
|
||||
{
|
||||
bool success = DecalHarmonyClean.Initialize();
|
||||
if (success)
|
||||
WriteToChat("[OK] Plugin message interception active");
|
||||
else
|
||||
WriteToChat("[FAIL] Could not initialize message interception");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteToChat($"[ERROR] Harmony initialization failed: {ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +262,11 @@ namespace MosswartMassacre
|
|||
try
|
||||
{
|
||||
string cleaned = NormalizeChatLine(e.Text);
|
||||
|
||||
// Send to WebSocket
|
||||
await WebSocket.SendChatTextAsync(e.Color, cleaned);
|
||||
|
||||
// Note: Plugin message analysis is now handled by Harmony patches
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -578,9 +608,9 @@ namespace MosswartMassacre
|
|||
WriteToChat("/mm remotecommand - Listen to allegiance !do/!dot enable|disable");
|
||||
WriteToChat("/mm getmetastate - Gets the current metastate");
|
||||
WriteToChat("/mm nextwp - Advance VTank to next waypoint");
|
||||
break;
|
||||
case "debug":
|
||||
DispatchChatToBoxWithPluginIntercept("/ub give bajs to Town Crier");
|
||||
WriteToChat("/mm decalstatus - Check Harmony patch status (UtilityBelt version)");
|
||||
WriteToChat("/mm decaldebug - Enable/disable plugin message debug output + WebSocket streaming");
|
||||
WriteToChat("/mm harmonyraw - Show raw intercepted messages (debug output)");
|
||||
break;
|
||||
case "report":
|
||||
TimeSpan elapsed = DateTime.Now - statsStartTime;
|
||||
|
|
@ -687,6 +717,92 @@ namespace MosswartMassacre
|
|||
}
|
||||
break;
|
||||
|
||||
case "decalstatus":
|
||||
try
|
||||
{
|
||||
WriteToChat("=== Harmony Patch Status (UtilityBelt Pattern) ===");
|
||||
WriteToChat($"Patches Active: {DecalHarmonyClean.IsActive()}");
|
||||
WriteToChat($"Messages Intercepted: {DecalHarmonyClean.GetMessagesIntercepted()}");
|
||||
WriteToChat($"Debug Streaming: {AggressiveChatStreamingEnabled}");
|
||||
WriteToChat($"WebSocket Streaming: {(AggressiveChatStreamingEnabled && WebSocketEnabled ? "ACTIVE" : "INACTIVE")}");
|
||||
|
||||
// Test Harmony availability
|
||||
WriteToChat("=== Harmony Version Status ===");
|
||||
try
|
||||
{
|
||||
var harmonyTest = Harmony.HarmonyInstance.Create("test.version.check");
|
||||
WriteToChat($"[OK] Harmony Available (ID: {harmonyTest.Id})");
|
||||
|
||||
// Check Harmony assembly version
|
||||
var harmonyAssembly = typeof(Harmony.HarmonyInstance).Assembly;
|
||||
WriteToChat($"[OK] Harmony Version: {harmonyAssembly.GetName().Version}");
|
||||
WriteToChat($"[OK] Harmony Location: {harmonyAssembly.Location}");
|
||||
}
|
||||
catch (Exception harmonyEx)
|
||||
{
|
||||
WriteToChat($"[FAIL] Harmony Test Failed: {harmonyEx.Message}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteToChat($"Status check error: {ex.Message}");
|
||||
}
|
||||
break;
|
||||
|
||||
case "decaldebug":
|
||||
if (args.Length > 1)
|
||||
{
|
||||
if (args[1].Equals("enable", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
AggressiveChatStreamingEnabled = true;
|
||||
WriteToChat("[OK] DECAL debug streaming ENABLED - will show captured messages + stream via WebSocket");
|
||||
}
|
||||
else if (args[1].Equals("disable", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
AggressiveChatStreamingEnabled = false;
|
||||
WriteToChat("[FAIL] DECAL debug streaming DISABLED - WebSocket streaming also disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteToChat("Usage: /mm decaldebug <enable|disable>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteToChat("Usage: /mm decaldebug <enable|disable>");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case "harmonyraw":
|
||||
try
|
||||
{
|
||||
WriteToChat("=== Raw Harmony Interception Log ===");
|
||||
var debugEntries = DecalHarmonyClean.GetDebugLog();
|
||||
if (debugEntries.Length == 0)
|
||||
{
|
||||
WriteToChat("No debug entries found. Enable debug streaming first: /mm decaldebug enable");
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteToChat($"Last {debugEntries.Length} intercepted messages:");
|
||||
foreach (var entry in debugEntries.Skip(Math.Max(0, debugEntries.Length - 10)))
|
||||
{
|
||||
WriteToChat($" {entry}");
|
||||
}
|
||||
if (debugEntries.Length > 10)
|
||||
{
|
||||
WriteToChat($"... ({debugEntries.Length - 10} more entries)");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteToChat($"Debug log error: {ex.Message}");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
WriteToChat($"Unknown /mm command: {subCommand}. Try /mm help");
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue