예제 #1
0
 private static PesterchumAccMgr getInstance()
 {
     if (instance == null)
     {
         instance = new PesterchumAccMgr();
     }
     return(instance);
 }
예제 #2
0
 private void processLine(string line)
 {
     //left in as a joke.
     //line = line.Replace("food", "potato").Replace("vegetables","potatoes").Replace("meat","potatoes").Replace("sandwich","potato");
     if (line.StartsWith("PESTER") || line.StartsWith("TROLL"))
     {
         List <string> args = new List <string>(from str in line.Split(' ') where str != "" select str);
         if (args.Count != 4)
         {
             appendOutput("FORMAT ERROR NEED 3 ARGUMENTS\n", Color.Red); return;
         }
         Chum chum1 = PesterchumAccMgr.findChum(args[1]);
         Chum chum2 = PesterchumAccMgr.findChum(args[2]);
         if (chum1 == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[1] + "\n", Color.Red); return;
         }
         if (chum2 == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[2] + "\n", Color.Red); return;
         }
         appendOutput("-- ");
         chum1.printWholeName();
         appendOutput("began " + args[0].ToLower() + "ing ");
         chum2.printWholeName();
         appendOutput("at " + args[3] + " --\n");
         return;
     }
     if (line.StartsWith("ENDPESTER") || line.StartsWith("ENDTROLL"))
     {
         List <string> args = new List <string>(from str in line.Split(' ') where str != "" select str);
         if (args.Count != 3)
         {
             appendOutput("FORMAT ERROR NEED 2 ARGUMENTS\n", Color.Red); return;
         }
         Chum chum1 = PesterchumAccMgr.findChum(args[1]);
         Chum chum2 = PesterchumAccMgr.findChum(args[2]);
         if (chum1 == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[1] + "\n", Color.Red); return;
         }
         if (chum2 == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[2] + "\n", Color.Red); return;
         }
         appendOutput("-- ");
         chum1.printWholeName();
         appendOutput("ceased " + args[0].Substring(3).ToLower() + "ing ");
         chum2.printWholeName();
         appendOutput("--\n");
         return;
     }
     if (line.StartsWith("IDLE"))
     {
         List <string> args = new List <string>(from str in line.Split(' ') where str != "" select str);
         if (args.Count != 2)
         {
             appendOutput("FORMAT ERROR NEED 1 ARGUMENT\n", Color.Red); return;
         }
         Chum chum = PesterchumAccMgr.findChum(args[1]);
         if (chum == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[1] + "\n", Color.Red); return;
         }
         appendOutput("-- ");
         chum.printWholeName();
         appendOutput("is now an idle " + (line.StartsWith("IDLETROLL")?"troll":"chum") + "! --\n");
         return;
     }
     if (line.StartsWith("MEMO"))
     {
         List <string> args = new List <string>(from str in line.Split(' ') where str != "" select str);
         if (args.Count < 3)
         {
             appendOutput("FORMAT ERROR NEED 4 ARGUMENTS\n", Color.Red); return;
         }
         args[2] = line.Substring(line.IndexOf(' ', line.IndexOf(' ') + 1) + 1);
         if (args[2].IndexOf(';') == -1)
         {
             appendOutput("ARGUMENT 3 and 4 NEED ; IN THE MIDDLE\n", Color.Red); return;
         }
         Chum chum = PesterchumAccMgr.findChum(args[1]);
         if (chum == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[1] + "\n", Color.Red); return;
         }
         chum.printWholeName();
         appendOutput(args[2].Substring(0, args[2].IndexOf(';')));
         appendOutput(" opened memo on board ");
         appendOutput(args[2].Substring(args[2].IndexOf(';') + 1));
         appendOutput(".\n");
         return;
     }
     if (line.StartsWith("RESPOND"))
     {
         List <string> args = new List <string>(from str in line.Split(' ') where str != "" select str);
         if (args.Count < 3)
         {
             appendOutput("FORMAT ERROR NEED 2 ARGUMENTS\n", Color.Red); return;
         }
         Chum chum = PesterchumAccMgr.findChum(args[1]);
         if (chum == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[1] + "\n", Color.Red); return;
         }
         chum.printWholeName();
         appendOutput(line.Substring(line.IndexOf(' ', line.IndexOf(' ') + 1) + 1) + " responded to memo.\n");
         return;
     }
     if (line.StartsWith("BAN") || line.StartsWith("UNBAN"))
     {
         List <string> args = new List <string>(from str in line.Split(' ') where str != "" select str);
         if (args.Count != 3)
         {
             appendOutput("FORMAT ERROR NEED 2 ARGUMENTS\n", Color.Red); return;
         }
         Chum chum1 = PesterchumAccMgr.findChum(args[1]);
         Chum chum2 = PesterchumAccMgr.findChum(args[2]);
         if (chum1 == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[1] + "\n", Color.Red); return;
         }
         if (chum2 == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[2] + "\n", Color.Red); return;
         }
         chum1.printShortName();
         appendOutput(" " + args[0].ToLower() + "ned ");
         chum2.printShortName();
         appendOutput(" from replying to memo.\n");
         return;
     }
     if (line.StartsWith("ENDRESPOND"))
     {
         List <string> args = new List <string>(from str in line.Split(' ') where str != "" select str);
         if (args.Count != 2)
         {
             appendOutput("FORMAT ERROR NEED 1 ARGUMENT\n", Color.Red); return;
         }
         Chum chum = PesterchumAccMgr.findChum(args[1]);
         if (chum == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[1] + "\n", Color.Red); return;
         }
         chum.printShortName();
         appendOutput(" ceased responding to memo.\n");
         return;
     }
     if (line.StartsWith("ENDMEMO"))
     {
         List <string> args = new List <string>(from str in line.Split(' ') where str != "" select str);
         if (args.Count != 2)
         {
             appendOutput("FORMAT ERROR NEED 1 ARGUMENT\n", Color.Red); return;
         }
         Chum chum = PesterchumAccMgr.findChum(args[1]);
         if (chum == null)
         {
             appendOutput("CHUM NOT FOUND ERROR:" + args[1] + "\n", Color.Red); return;
         }
         chum.printShortName();
         appendOutput(" closed memo.\n");
         return;
     }
     if (line.IndexOf(':') != -1)
     {
         Chum c = PesterchumAccMgr.findChum(line.Substring(0, line.IndexOf(':')));
         if (c != null)
         {
             c.Say(line);
             return;
         }
     }
     if (line.StartsWith("="))
     {
         int arrowLoc = line.IndexOf(">");
         if (arrowLoc != -1)
         {
             if (!(from c in line.Substring(0, arrowLoc) where c != '=' select c).Any())
             {
                 appendOutput(line + "\n", Color.Blue, commandFont);
             }
             return;
         }
     }
     //left in as a joke.
     //if (line == "potato") appendOutput("PS: F**K NO.", PesterchumAccMgr.findChum("PS").color);else
     appendOutput(line + "\n");
 }