Compare commits
No commits in common. "3c4bfbe7722e0e6adba3e58629377b281487dc8e" and "7c2f2304cf54351600a4a523435f6022e56d5aa5" have entirely different histories.
3c4bfbe772
...
7c2f2304cf
6 changed files with 34 additions and 109 deletions
|
|
@ -13,6 +13,7 @@ namespace MosswartMassacre
|
||||||
private static IStaticText lblRareCount;
|
private static IStaticText lblRareCount;
|
||||||
private static IButton btnRestart;
|
private static IButton btnRestart;
|
||||||
private static IButton btnToggleRareMeta;
|
private static IButton btnToggleRareMeta;
|
||||||
|
private static bool rareMetaEnabled = true;
|
||||||
|
|
||||||
public static void ViewInit()
|
public static void ViewInit()
|
||||||
{
|
{
|
||||||
|
|
@ -66,15 +67,7 @@ namespace MosswartMassacre
|
||||||
|
|
||||||
public static void UpdateElapsedTime(TimeSpan elapsed)
|
public static void UpdateElapsedTime(TimeSpan elapsed)
|
||||||
{
|
{
|
||||||
int days = elapsed.Days;
|
lblElapsedTime.Text = $"Elapsed Time: {elapsed:hh\\:mm\\:ss}";
|
||||||
int hours = elapsed.Hours;
|
|
||||||
int minutes = elapsed.Minutes;
|
|
||||||
int seconds = elapsed.Seconds;
|
|
||||||
|
|
||||||
if (days > 0)
|
|
||||||
lblElapsedTime.Text = $"Time: {days}d {hours:D2}:{minutes:D2}:{seconds:D2}";
|
|
||||||
else
|
|
||||||
lblElapsedTime.Text = $"Time: {hours:D2}:{minutes:D2}:{seconds:D2}";
|
|
||||||
}
|
}
|
||||||
public static void UpdateRareCount(int rareCount)
|
public static void UpdateRareCount(int rareCount)
|
||||||
{
|
{
|
||||||
|
|
@ -86,11 +79,10 @@ namespace MosswartMassacre
|
||||||
}
|
}
|
||||||
private static void OnToggleRareMetaClick(object sender, EventArgs e)
|
private static void OnToggleRareMetaClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
PluginCore.ToggleRareMeta();
|
rareMetaEnabled = !rareMetaEnabled;
|
||||||
}
|
btnToggleRareMeta.Text = rareMetaEnabled ? "Meta: ON" : "Meta: OFF";
|
||||||
public static void SetRareMetaToggleState(bool enabled)
|
PluginCore.rareMetaEnabled = rareMetaEnabled; // Share toggle with PluginCore
|
||||||
{
|
PluginCore.WriteToChat($"[Debug] rareMetaEnabled is now: {rareMetaEnabled}");
|
||||||
btnToggleRareMeta.Text = enabled ? "Meta: ON" : "Meta: OFF";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
MosswartMassacre/MosswartMassacre.dll
Normal file
BIN
MosswartMassacre/MosswartMassacre.dll
Normal file
Binary file not shown.
|
|
@ -19,7 +19,7 @@ namespace MosswartMassacre
|
||||||
internal static double killsPerHour = 0;
|
internal static double killsPerHour = 0;
|
||||||
internal static DateTime statsStartTime = DateTime.Now;
|
internal static DateTime statsStartTime = DateTime.Now;
|
||||||
internal static Timer updateTimer;
|
internal static Timer updateTimer;
|
||||||
public static bool RareMetaEnabled { get; private set; } = true;
|
internal static bool rareMetaEnabled = true;
|
||||||
private static Queue<string> rareMessageQueue = new Queue<string>();
|
private static Queue<string> rareMessageQueue = new Queue<string>();
|
||||||
private static DateTime _lastSent = DateTime.MinValue;
|
private static DateTime _lastSent = DateTime.MinValue;
|
||||||
private static readonly Queue<string> _chatQueue = new Queue<string>();
|
private static readonly Queue<string> _chatQueue = new Queue<string>();
|
||||||
|
|
@ -33,7 +33,6 @@ namespace MosswartMassacre
|
||||||
|
|
||||||
// Subscribe to chat message event
|
// Subscribe to chat message event
|
||||||
CoreManager.Current.ChatBoxMessage += new EventHandler<ChatTextInterceptEventArgs>(OnChatText);
|
CoreManager.Current.ChatBoxMessage += new EventHandler<ChatTextInterceptEventArgs>(OnChatText);
|
||||||
CoreManager.Current.CommandLineText += OnChatCommand;
|
|
||||||
|
|
||||||
// Initialize the timer
|
// Initialize the timer
|
||||||
updateTimer = new Timer(1000); // Update every second
|
updateTimer = new Timer(1000); // Update every second
|
||||||
|
|
@ -57,7 +56,6 @@ namespace MosswartMassacre
|
||||||
|
|
||||||
// Unsubscribe from chat message event
|
// Unsubscribe from chat message event
|
||||||
CoreManager.Current.ChatBoxMessage -= new EventHandler<ChatTextInterceptEventArgs>(OnChatText);
|
CoreManager.Current.ChatBoxMessage -= new EventHandler<ChatTextInterceptEventArgs>(OnChatText);
|
||||||
CoreManager.Current.CommandLineText -= OnChatCommand;
|
|
||||||
|
|
||||||
// Stop and dispose of the timer
|
// Stop and dispose of the timer
|
||||||
if (updateTimer != null)
|
if (updateTimer != null)
|
||||||
|
|
@ -96,36 +94,36 @@ namespace MosswartMassacre
|
||||||
rareCount++;
|
rareCount++;
|
||||||
MainView.UpdateRareCount(rareCount);
|
MainView.UpdateRareCount(rareCount);
|
||||||
|
|
||||||
if (RareMetaEnabled)
|
if (rareMetaEnabled)
|
||||||
{
|
{
|
||||||
Decal_DispatchOnChatCommand("/vt setmetastate loot_rare");
|
Decal_DispatchOnChatCommand("/vt setmetastate loot_rare");
|
||||||
}
|
}
|
||||||
|
|
||||||
DelayedCommandManager.AddDelayedCommand($"/a {rareText}", 3000);
|
DelayedCommandManager.AddDelayedCommand($"/a {rareText}", 3000);
|
||||||
}
|
}
|
||||||
// if (e.Text.EndsWith("!testrare\""))
|
if (e.Text.EndsWith("!testrare\""))
|
||||||
// {
|
{
|
||||||
// string simulatedText = $"{CoreManager.Current.CharacterFilter.Name} has discovered the Ancient Pickle!";
|
string simulatedText = $"{CoreManager.Current.CharacterFilter.Name} has discovered the Ancient Pickle!";
|
||||||
//
|
|
||||||
// if (IsRareDiscoveryMessage(simulatedText, out string simulatedRareText))
|
if (IsRareDiscoveryMessage(simulatedText, out string simulatedRareText))
|
||||||
// {
|
{
|
||||||
// rareCount++;
|
rareCount++;
|
||||||
// MainView.UpdateRareCount(rareCount);
|
MainView.UpdateRareCount(rareCount);
|
||||||
//
|
|
||||||
// if (RareMetaEnabled)
|
if (rareMetaEnabled)
|
||||||
// {
|
{
|
||||||
// Decal_DispatchOnChatCommand("/vt setmetastate loot_rare");
|
Decal_DispatchOnChatCommand("/vt setmetastate loot_rare");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// DelayedCommandManager.AddDelayedCommand($"/a {simulatedRareText}", 3000);
|
DelayedCommandManager.AddDelayedCommand($"/a {simulatedRareText}", 3000);
|
||||||
// }
|
}
|
||||||
// else
|
else
|
||||||
// {
|
{
|
||||||
// WriteToChat("[Test] Simulated rare message didn't match the regex.");
|
WriteToChat("[Test] Simulated rare message didn't match the regex.");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
if (e.Color == 18 && e.Text.EndsWith("!report\""))
|
if (e.Color == 18 && e.Text.EndsWith("!report\""))
|
||||||
{
|
{
|
||||||
TimeSpan elapsed = DateTime.Now - statsStartTime;
|
TimeSpan elapsed = DateTime.Now - statsStartTime;
|
||||||
|
|
@ -139,21 +137,6 @@ namespace MosswartMassacre
|
||||||
WriteToChat("Error processing chat message: " + ex.Message);
|
WriteToChat("Error processing chat message: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void OnChatCommand(object sender, ChatParserInterceptEventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (e.Text.StartsWith("/mm", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
e.Eat = true; // Prevent the message from showing in chat
|
|
||||||
HandleMmCommand(e.Text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
PluginCore.WriteToChat($"[Error] Failed to process /mm command: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateStats(object sender, ElapsedEventArgs e)
|
private void UpdateStats(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
@ -266,12 +249,6 @@ namespace MosswartMassacre
|
||||||
MainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
|
MainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
|
||||||
MainView.UpdateRareCount(rareCount);
|
MainView.UpdateRareCount(rareCount);
|
||||||
}
|
}
|
||||||
public static void ToggleRareMeta()
|
|
||||||
{
|
|
||||||
RareMetaEnabled = !RareMetaEnabled;
|
|
||||||
MainView.SetRareMetaToggleState(RareMetaEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("Decal.dll")]
|
[DllImport("Decal.dll")]
|
||||||
private static extern int DispatchOnChatCommand(ref IntPtr str, [MarshalAs(UnmanagedType.U4)] int target);
|
private static extern int DispatchOnChatCommand(ref IntPtr str, [MarshalAs(UnmanagedType.U4)] int target);
|
||||||
|
|
||||||
|
|
@ -294,50 +271,6 @@ namespace MosswartMassacre
|
||||||
if (!Decal_DispatchOnChatCommand(cmd))
|
if (!Decal_DispatchOnChatCommand(cmd))
|
||||||
CoreManager.Current.Actions.InvokeChatParser(cmd);
|
CoreManager.Current.Actions.InvokeChatParser(cmd);
|
||||||
}
|
}
|
||||||
private void HandleMmCommand(string text)
|
|
||||||
{
|
|
||||||
// Remove the /mm prefix and trim extra whitespace
|
|
||||||
string[] args = text.Substring(3).Trim().Split(' ');
|
|
||||||
|
|
||||||
if (args.Length == 0 || string.IsNullOrEmpty(args[0]))
|
|
||||||
{
|
|
||||||
WriteToChat("Usage: /mm <command>. Try /mm help");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string subCommand = args[0].ToLower();
|
|
||||||
|
|
||||||
switch (subCommand)
|
|
||||||
{
|
|
||||||
case "help":
|
|
||||||
WriteToChat("Mosswart Massacre Commands:");
|
|
||||||
WriteToChat("/mm report - Show current stats");
|
|
||||||
WriteToChat("/mm reset - Reset all counters");
|
|
||||||
WriteToChat("/mm meta - Toggle rare meta state");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "report":
|
|
||||||
TimeSpan elapsed = DateTime.Now - statsStartTime;
|
|
||||||
string reportMessage = $"Total Kills: {totalKills}, Kills per Hour: {killsPerHour:F2}, Elapsed Time: {elapsed:dd\\.hh\\:mm\\:ss}, Rares Found: {rareCount}";
|
|
||||||
WriteToChat(reportMessage);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "reset":
|
|
||||||
RestartStats();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "meta":
|
|
||||||
RareMetaEnabled = !RareMetaEnabled;
|
|
||||||
WriteToChat($"Rare meta state is now {(RareMetaEnabled ? "ON" : "OFF")}");
|
|
||||||
MainView.SetRareMetaToggleState(RareMetaEnabled); // <-- sync the UI
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
WriteToChat($"Unknown /mm command: {subCommand}. Try /mm help");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,5 +26,5 @@ using System.Runtime.InteropServices;
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
[assembly: AssemblyVersion("1.0.0.1")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.1")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<control progid="DecalControls.StaticText" name="lblTotalKills" left="10" top="10" width="250" height="20" text="Total Kills: 0"/>
|
<control progid="DecalControls.StaticText" name="lblTotalKills" left="10" top="10" width="250" height="20" text="Total Kills: 0"/>
|
||||||
<control progid="DecalControls.StaticText" name="lblKillsPer5Min" left="10" top="30" width="250" height="20" text="Kills per 5 Min: 0"/>
|
<control progid="DecalControls.StaticText" name="lblKillsPer5Min" left="10" top="30" width="250" height="20" text="Kills per 5 Min: 0"/>
|
||||||
<control progid="DecalControls.StaticText" name="lblKillsPerHour" left="10" top="50" width="250" height="20" text="Kills per Hour: 0"/>
|
<control progid="DecalControls.StaticText" name="lblKillsPerHour" left="10" top="50" width="250" height="20" text="Kills per Hour: 0"/>
|
||||||
<control progid="DecalControls.StaticText" name="lblElapsedTime" left="10" top="70" width="250" height="20" text="Time: 00:00:00"/>
|
<control progid="DecalControls.StaticText" name="lblElapsedTime" left="10" top="70" width="250" height="20" text="Elapsed Time: 00:00:00"/>
|
||||||
<control progid="DecalControls.StaticText" name="lblRareCount" left="10" top="90" width="250" height="20" text="Rare Count: 0"/>
|
<control progid="DecalControls.StaticText" name="lblRareCount" left="10" top="90" width="250" height="20" text="Rare Count: 0"/>
|
||||||
<control progid="DecalControls.PushButton" name="btnRestart" left="10" top="110" width="60" height="20" text="Restart"/>
|
<control progid="DecalControls.PushButton" name="btnRestart" left="10" top="110" width="60" height="20" text="Restart"/>
|
||||||
<control progid="DecalControls.PushButton" name="btnToggleRareMeta" left="10" top="135" width="60" height="20" text="Meta Rare: ON"/>
|
<control progid="DecalControls.PushButton" name="btnToggleRareMeta" left="10" top="135" width="60" height="20" text="Meta Rare: ON"/>
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue