Example #1
0
 public bool Cmd_KickAccount(string command, IList <string> args)
 {
     if (args.Count > 1 && args[1].Length > 0)
     {
         this.manager[args[0]].RequestKick(args[1], "");
         HeroesCommandBridge.Notify("{0} Kick Account [{1}].", new object[]
         {
             args[0],
             args[1]
         });
         return(true);
     }
     return(false);
 }
Example #2
0
 public bool Cmd_announce(string command, IList <string> args)
 {
     if (args.Count > 1 && args[1].Length > 0)
     {
         HeroesCommandBridge.Notify("{0} Server Announce - \"{1}\".", new object[]
         {
             args[0],
             args[1]
         });
         this.manager[args[0]].RequestNotify(args[1]);
         return(true);
     }
     return(false);
 }
Example #3
0
 public bool Cmd_extendcashitem(string command, IList <string> args)
 {
     if (args.Count > 2)
     {
         this.manager[args[0]].RequestExtendCashItem(DateTime.Parse(args[1]), int.Parse(args[2]));
         HeroesCommandBridge.Notify("{0} Extendcashitem {1} {2}", new object[]
         {
             args[0],
             args[1],
             args[2]
         });
         return(true);
     }
     return(false);
 }
Example #4
0
 public bool Cmd_shutdown(string command, IList <string> args)
 {
     if (args.Count > 1)
     {
         string text = string.Empty;
         if (args.Count > 2)
         {
             text = args[2];
         }
         int num = int.Parse(args[1]);
         if (num < 0)
         {
             this.manager[args[0]].RequestShutDown(-1, text);
             HeroesCommandBridge.Notify("Shutdown Canceled");
         }
         else
         {
             if (num == 0)
             {
                 num = 1;
             }
             this.manager[args[0]].RequestShutDown(num, text);
             if (text == string.Empty)
             {
                 HeroesCommandBridge.Notify("{0} Shutdown Reserved after {1} seconds", new object[]
                 {
                     args[0],
                     num
                 });
             }
             else
             {
                 HeroesCommandBridge.Notify("{0} Shutdown Reserved after {1} seconds with announce - \"{2}\".", new object[]
                 {
                     args[0],
                     num,
                     text
                 });
             }
         }
         return(true);
     }
     return(false);
 }
Example #5
0
 public bool Cmd_sv_cheats(string command, IList <string> args)
 {
     if (args.Count > 1)
     {
         bool flag = int.Parse(args[1]) != 0;
         this.manager[args[0]].RequestDSCheat(flag ? 1 : 0);
         string text = string.Empty;
         if (args.Count > 2 && args[2].Length > 0)
         {
             text = args[2];
         }
         HeroesCommandBridge.Notify("{0} DS Cheat(sv_cheat) {1}. - \"{2}\"", new object[]
         {
             args[0],
             flag ? "On" : "Off",
             text
         });
         return(true);
     }
     return(false);
 }
Example #6
0
 public bool Cmd_freetoken(string command, IList <string> args)
 {
     if (args.Count > 1)
     {
         bool flag = int.Parse(args[1]) != 0;
         this.manager[args[0]].RequestFreeToken(flag);
         string text = string.Empty;
         if (args.Count > 2 && args[2].Length > 0)
         {
             text = args[2];
             this.manager[args[0]].RequestNotify(text);
         }
         HeroesCommandBridge.Notify("{0} FreeToken Mode {1}. - \"{2}\"", new object[]
         {
             args[0],
             flag ? "On" : "Off",
             text
         });
         return(true);
     }
     return(false);
 }
Example #7
0
 public bool Cmd_pushitem(string command, IList <string> args)
 {
     if (args.Count > 3)
     {
         string text = string.Empty;
         if (args.Count > 6)
         {
             text = args[6];
         }
         this.manager[args[0]].RequestItemFestivalEx(args[1], int.Parse(args[2]), int.Parse(args[3]) != 0, new DateTime?(DateTime.Parse(args[4])), int.Parse(args[5]) != 0, text);
         HeroesCommandBridge.Notify("{0} Pushitem {1} {2} {3} {4} {5} \"{6}\".", new object[]
         {
             args[0],
             args[1],
             args[2],
             args[3],
             args[4],
             args[5],
             text
         });
         return(true);
     }
     return(false);
 }
Example #8
0
        private void Loop()
        {
            HeroesCommandBridge.Client.LoginSuccess += delegate(object s, EventArgs e)
            {
                Console.WriteLine("connected");
            };
            HeroesCommandBridge.Client.LoginFail += delegate(object s, EventArgs <Exception> e)
            {
                Console.WriteLine("Login Failure:\n{0}", e.Value.ToString());
            };
            HeroesCommandBridge.Client.ServerGroupAdded += delegate(object s, EventArgs <string> e)
            {
                Console.WriteLine("ServerGroup {0} found", e.Value);
            };
            HeroesCommandBridge.Client.ServerGroupRemoved += delegate(object s, EventArgs <string> e)
            {
                Console.WriteLine("ServerGroup {0} removed", e.Value);
            };
            HeroesCommandBridge.Client.Start();
            HeroesAdminManager manager = new HeroesAdminManager(HeroesCommandBridge.Client);

            manager.ServerGroupConnected += delegate(object s, EventArgs <string> e)
            {
                RCClient.Console_AddProperty("commandbridge", manager.ServerString);
                Console.WriteLine("ServerGroup {0} conncted", e.Value);
            };
            manager.ServerGroupDisconnected += delegate(object s, EventArgs <string> e)
            {
                RCClient.Console_AddProperty("commandbridge", manager.ServerString);
                Console.WriteLine("ServerGroup {0} disconnected", e.Value);
            };
            manager.ServerGroupUserCounted += delegate(object s, EventArgs <string> e)
            {
                Console.WriteLine(e.Value);
            };
            manager.ServerGroupNotified += delegate(object s, EventArgs <string> e)
            {
                HeroesCommandBridge.Notify(e.Value);
            };
            EchoClient echoClient = null;

            if (Settings.Default.EchoServerUse)
            {
                echoClient = new EchoClient();
                echoClient.AutoReconnect = true;
                HeroesCommandBridge.Client.ProcessLogged += delegate(object s, EventArgs <string> e)
                {
                    KeyValuePair <RCClient, RCProcess> keyValuePair = (KeyValuePair <RCClient, RCProcess>)s;
                    if (keyValuePair.Key != null && keyValuePair.Value != null)
                    {
                        echoClient.SendLog(string.Format("{0}_{1}", keyValuePair.Key.ID, keyValuePair.Value.Name), string.Format("{0}({1})", keyValuePair.Value.Description, keyValuePair.Key.Name), e.Value);
                    }
                };
                echoClient.ConnectionSucceed += delegate(object s, EventArgs e)
                {
                    Console.WriteLine("Echo Client connected");
                };
                echoClient.ConnectionFailed += delegate(object s, EventArgs <Exception> e)
                {
                    Console.WriteLine("Echo Client connection failed");
                };
                echoClient.Disconnected += delegate(object s, EventArgs e)
                {
                    Console.WriteLine("Echo Client disconnected");
                };
                echoClient.Start();
            }
            this.commandHandler = new Commands(manager);
            for (;;)
            {
                string text = Console.ReadLine();
                if (text != null && text.ToLower() == "shutdown")
                {
                    break;
                }
                HeroesCommandBridge.Thread.Enqueue(Job.Create <string>(new Action <string>(this.ProcessCommand), text));
            }
            if (echoClient != null)
            {
                echoClient.Stop();
                echoClient = null;
            }
            HeroesCommandBridge.Client.Stop();
            HeroesCommandBridge.Client = null;
        }