namespace PRoConEvents { using System; using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Collections; using System.Net; using System.Net.Mail; using System.Web; using System.Data; class LimitEvaluator4 { public bool FirstCheck(PlayerInfoInterface player, ServerInfoInterface server, PluginInterface plugin, TeamInfoInterface team1, TeamInfoInterface team2, TeamInfoInterface team3, TeamInfoInterface team4) { try { return ( (( Regex.Match(player.LastChat, @"^\s*[!@\?](?:killers|victims|versus)", RegexOptions.IgnoreCase).Success )) == true); } catch(Exception e) { plugin.DumpException(e); } return false; } public bool SecondCheck(PlayerInfoInterface player, ServerInfoInterface server, PluginInterface plugin, TeamInfoInterface team1, TeamInfoInterface team2, TeamInfoInterface team3, TeamInfoInterface team4, LimitInfoInterface limit) { try { // Show standings String prefix = "LBS_"; String kKillers = prefix + "killers"; // Killers of a player String kVictims = prefix + "victims"; // Victims of a player int level = Convert.ToInt32(plugin.getPluginVarValue("debug_level")); if (level >= 2) { plugin.ConsoleWrite("^b[LBS] OnAnyChat^n: Orig cmd: " + player.LastChat); } // Parse the command bool needName = false; Match chat = Regex.Match(player.LastChat, @"^\s*([!@\?])(killers|victims)", RegexOptions.IgnoreCase); bool privScope = false; String cmd = "versus"; String who = player.Name; if (chat.Success) { cmd = chat.Groups[2].Value; } else { needName = true; chat = Regex.Match(player.LastChat, @"^\s*([!@\?])versus\s+([^ ]+)", RegexOptions.IgnoreCase); if (!chat.Success) { if (level >= 2) { plugin.ConsoleWarn(@"^b[LBS] OnAnyChat^n: parse failed: " + player.LastChat); } return false; } who = chat.Groups[2].Value; } privScope = chat.Groups[1].Value.Equals("@"); // Show requested data DataDictionaryInterface d = player.RoundData; if (needName) { if (level >= 2) plugin.ConsoleWrite("^b[LBS] OnAnyChat^n: versus not implemented yet: " + who); return false; } // Otherwise, sort data Dictionary by = null; String message; if (cmd.Equals("killers")) { by = (Dictionary)d.getObject("kKillers"); message = "Top killers: "; } else if (cmd.Equals("victims")) { by = (Dictionary)d.getObject("kVictims"); message = "Top victims: "; } else { if (level >= 2) { plugin.ConsoleWarn("^b[LBS] OnAnyChat^n: unknown cmd: " + cmd); } return false; } int first = -1; int second = -1; int third = -1; String name1 = "stfu"; String name2 = "stfu"; String name3 = "stfu"; foreach (KeyValuePair pair in by) { if (pair.Value > third || pair.Value == second) { third = pair.Value; name3 = pair.Key; } if (pair.Value > second || pair.Value == first) { third = second; name3 = name2; second = pair.Value; name2 = pair.Key; } if (pair.Value > first) { second = first; name2 = name1; first = pair.Value; name1 = pair.Key; } } message = message + name1 + "(" + first + "), " + name2 + "(" + second + "), " + name3 + "(" + third + ")"; plugin.ConsoleWrite("^[LBS] OnAnyChat^n: Results:"); plugin.ConsoleWrite(message); return false; return true; } catch(Exception e) { plugin.DumpException(e); } return true; } } }