public static void GroupChatMessage(Server.NetObject ThisNetObj, Commands.CommandReader Cmd) { foreach (string ThisCommandElement in Cmd._CmdElements()) { if (Database.GroupDB.FindGroup(ThisCommandElement) != Database.GroupDB.NoGroup) { Server.EmptyClientList.Include(Database.GroupDB.FindGroup(ThisCommandElement)).Except(Database.UserDB.Find("PHP bot")).Except(ThisNetObj).SendMessage("(" + Database.GroupDB.FindGroup(ThisCommandElement).Name + ")" + ThisNetObj.UserObject.Name + ": " + Cmd._CmdRawArguments); ThisNetObj.ClientObject.SendMessage("(" + Database.GroupDB.FindGroup(ThisCommandElement).Name + ")" + ThisNetObj.UserObject.Name + ": " + Cmd._CmdRawArguments); } else { ThisNetObj.ClientObject.SendMessage("&eGroup not found: \"" + ThisCommandElement + "\"."); } } return; }
public static void StandardChatMessage(Server.NetObject ThisNetObj, Commands.CommandReader Cmd) { if (ThisNetObj.TextWaiters.Count > 0) { ThisNetObj.TextInput = Cmd._CmdComplete; foreach (AutoResetEvent ThisEvent in ThisNetObj.TextWaiters.ToArray()) { ThisEvent.Set(); ThisNetObj.TextWaiters.RemoveAll(x => x == ThisEvent); } return; } string output = FormatChatMessage(Cmd._CmdComplete, ThisNetObj); Server.AllClients.Except(Database.UserDB.Find("PHP bot")).SendMessage(output); //ThisNetObj.HostObject.SendMessage(output); Logger.Log.Chat(output); return; }
public static void PrivateChatMessage(Server.NetObject ThisNetObj, Commands.CommandReader Cmd) { foreach (string ThisCommandElement in Cmd._CmdElements()) { if (Database.UserDB.Find(ThisCommandElement) != Database.UserDB.Nobody) { if (ThisNetObj.UserObject == Database.UserDB.Find(ThisCommandElement)) { ThisNetObj.ClientObject.SendMessage("&eYou can't PM yourself!"); continue; } Server.EmptyClientList.Include(Database.UserDB.Find(ThisCommandElement)).Except(Database.UserDB.Find("PHP bot")).Except(ThisNetObj).SendMessage("&bPM From " + ThisNetObj.UserObject.Name + ": " + Cmd._CmdRawArguments); ThisNetObj.ClientObject.SendMessage("&bPM To " + Database.UserDB.Find(ThisCommandElement).Name + ": " + Cmd._CmdRawArguments); } else { ThisNetObj.ClientObject.SendMessage("&eUser not found: \"" + ThisCommandElement + "\"."); } } return; }
public static void Process(Server.NetObject ThisNetObj, string RawCommand) { if (RawCommand == "/") { //Repeat Last Command. RawCommand = ThisNetObj.LastTypedCommand; } ThisNetObj.LastTypedCommand = RawCommand; Commands.CommandReader Cmd = new Commands.CommandReader(RawCommand); if (Cmd._CmdString.ToUpperInvariant().StartsWith("@@")) { Cmd._CmdString = Cmd._CmdString.Remove(0, 1); Messaging.GroupChatMessage(ThisNetObj, Cmd); return; } if (Cmd._CmdString.ToUpperInvariant().StartsWith("@")) { Cmd._CmdString = Cmd._CmdString.Remove(0, 1); Messaging.PrivateChatMessage(ThisNetObj, Cmd); return; } if (Cmd._CmdString.ToUpperInvariant().StartsWith("//")) { Cmd._CmdComplete = Cmd._CmdComplete.Remove(0, 1); Messaging.StandardChatMessage(ThisNetObj, Cmd); return; } if (Cmd._CmdString.ToUpperInvariant() == "/HELP") { if (Cmd._CmdArguments.Count() < 1) { //show help usage ThisNetObj.ClientObject.SendMessage("Welcome To Orb For YSFlight!"); ThisNetObj.ClientObject.SendMessage(" Orb Servers are designed to extend YSFlights Functionality, by use of commands and a database."); ThisNetObj.ClientObject.SendMessage(" For more information on commands available, type \"/Commands\"."); return; } List <Commands.CommandDescriptor> MatchingCommands = Commands.FindCommand("/" + Cmd._CmdArguments[0]); if (MatchingCommands.Count() == 0) { ThisNetObj.ClientObject.SendMessage("&cCommand not found: \"" + Cmd._CmdArguments[0] + "\"."); return; } if (MatchingCommands.OneMatchingCommand()) { ThisNetObj.ClientObject.SendMessage("&a" + MatchingCommands[0]._Usage); ThisNetObj.ClientObject.SendMessage("&e" + " " + MatchingCommands[0]._Descrption); ThisNetObj.ClientObject.SendMessage("&a" + " Aliases: " + MatchingCommands[0]._Commands.Take(3).ToList().ToStringList()); } else { ThisNetObj.ClientObject.SendMessage("&cERROR: &eMore then one matching command found: \"" + Cmd._CmdArguments[0] + "\"."); } return; } if (Cmd._CmdString.ToUpperInvariant().StartsWith("/")) { List <Commands.CommandDescriptor> MatchingCommands = Commands.FindCommand(Cmd._CmdString); if (MatchingCommands.Count() == 0) { ThisNetObj.ClientObject.SendMessage("&eCommand not found: \"" + Cmd._CmdString + "\"."); return; } if (MatchingCommands.OneMatchingCommand()) { MatchingCommands[0]._Handler(ThisNetObj, Cmd); } else { ThisNetObj.ClientObject.SendMessage("&cERROR: &eMore then one matching command found: \"" + Cmd._CmdString + "\"."); } return; } Messaging.StandardChatMessage(ThisNetObj, Cmd); return; //ThisNetObj.ClientObject.SendMessage("TEST COMPLETE"); }