public void RunNub(int num) { var tas = new TasClient("Nubotron"); var name = "TestNub" + num; var ord = num / 16; var batname = "Test " + ord; //tas.Input += (sender, args) => { Console.WriteLine(" < {0}", args); }; //tas.Output += (sender, args) => { Console.WriteLine(" > {0}", args); }; tas.Connected += (sender, args) => { tas.Login(name, "dummy"); }; tas.ConnectionLost += (sender, args) => { tas.Connect(GlobalConst.LobbyServerHost, GlobalConst.LobbyServerPort); Console.WriteLine("disconnected"); }; tas.LoginAccepted += (sender, args) => { Console.WriteLine(name + " accepted"); }; tas.LoginDenied += (sender, args) => { tas.Register(name, "dummy"); }; tas.RegistrationAccepted += (sender, args) => { tas.Login(name, "dummy"); }; tas.RegistrationDenied += (sender, response) => { Console.WriteLine(name + "registration denied"); }; tas.UserAdded += (sender, args) => { if (args.Name == name) { tas.JoinChannel("bots"); if (num%16 == 0) tas.OpenBattle(new BattleHeader() { Title = batname, MaxPlayers = 16, }); else { var bat = tas.ExistingBattles.Values.FirstOrDefault(x => x.Title == batname); if (bat != null) tas.JoinBattle(bat.BattleID); } } }; tas.BattleFound += (sender, args) => { if (args.Title == batname) { //await Task.Delay(200); tas.JoinBattle(args.BattleID); } }; tas.Connect(GlobalConst.LobbyServerHost, GlobalConst.LobbyServerPort); /*Task.Factory.StartNew(async () => { while (true) { await Task.Delay(rand.Next(400000)); tas.Say(SayPlace.Channel, "zk", sent.GetNext(), false); } }, TaskCreationOptions.LongRunning);*/ }
public void RunNub(int num) { var tas = new TasClient("Nubotron"); var name = "TestNub" + num; var ord = num / 16; var batname = "Test " + ord; //tas.Input += (sender, args) => { Console.WriteLine(" < {0}", args); }; //tas.Output += (sender, args) => { Console.WriteLine(" > {0}", args); }; tas.Connected += (sender, args) => { tas.Login(name, "dummy"); }; tas.ConnectionLost += (sender, args) => { Console.WriteLine("disconnected"); }; tas.LoginAccepted += (sender, args) => { Console.WriteLine(name + " accepted"); }; tas.LoginDenied += (sender, args) => { tas.Register(name, "dummy"); }; tas.UserAdded += (sender, args) => { if (args.Name == name) { tas.JoinChannel("bots"); if (num % 16 == 0) { tas.OpenBattle(new Battle("91.0", null, 4955, 16, "SmallDivide", "Test " + ord, "Zero-K v1.3.1.15")); } else { var bat = tas.ExistingBattles.Values.FirstOrDefault(x => x.Title == batname); if (bat != null) { tas.JoinBattle(bat.BattleID); } } } }; tas.BattleFound += (sender, args) => { if (args.Title == batname) { //await Task.Delay(200); tas.JoinBattle(args.BattleID); } }; tas.Connect(GlobalConst.LobbyServerHost, GlobalConst.LobbyServerPort); }
public void RunNub(int num) { var tas = new TasClient("Nubotron"); var name = "TestNub" + num; var ord = num / 16; var batname = "Test " + ord; //tas.Input += (sender, args) => { Console.WriteLine(" < {0}", args); }; //tas.Output += (sender, args) => { Console.WriteLine(" > {0}", args); }; tas.Connected += (sender, args) => { tas.Login(name, "dummy"); }; tas.ConnectionLost += (sender, args) => { Console.WriteLine("disconnected"); }; tas.LoginAccepted += (sender, args) => { Console.WriteLine(name + " accepted"); }; tas.LoginDenied += (sender, args) => { tas.Register(name, "dummy"); }; tas.UserAdded += (sender, args) => { if (args.Name == name) { tas.JoinChannel("bots"); if (num%16 == 0) tas.OpenBattle(new BattleHeader() { Engine = "91.0", Game = "Zero-K v1.3.1.15", Title = "test" + ord, Map = "SmallDivide", MaxPlayers = 16, }); else { var bat = tas.ExistingBattles.Values.FirstOrDefault(x => x.Title == batname); if (bat != null) tas.JoinBattle(bat.BattleID); } } }; tas.BattleFound += (sender, args) => { if (args.Title == batname) { //await Task.Delay(200); tas.JoinBattle(args.BattleID); } }; tas.Connect(GlobalConst.LobbyServerHost, GlobalConst.LobbyServerPort); }
public void RunNub(int num) { var tas = new TasClient("Nubotron"); var maps = AutoRegistrator.RegistratorRes.campaignMaps.Split('\n'); var name = "TestNub" + num; var ord = num / 16; //tas.Input += (sender, args) => { Console.WriteLine(" < {0}", args); }; //tas.Output += (sender, args) => { Console.WriteLine(" > {0}", args); }; tas.Connected += (sender, args) => { tas.Login(name, "dummy"); }; tas.ConnectionLost += (sender, args) => { tas.Connect(GlobalConst.LobbyServerHost, GlobalConst.LobbyServerPort); Console.WriteLine("disconnected"); }; tas.LoginAccepted += (sender, args) => { Console.WriteLine(name + " accepted"); }; tas.LoginDenied += (sender, args) => { tas.Register(name, "dummy"); }; tas.RegistrationAccepted += (sender, args) => { tas.Login(name, "dummy"); }; tas.RegistrationDenied += (sender, response) => { Console.WriteLine(name + "registration denied"); }; tas.Connect(GlobalConst.LobbyServerHost, GlobalConst.LobbyServerPort); Task.Factory.StartNew(async() => { while (true) { await Task.Delay(rand.Next(10000)); if (tas.IsLoggedIn) { await tas.LeaveBattle(); if (tas.ExistingBattles.Count < 20) { await tas.OpenBattle(new BattleHeader() { Title = "" + name, MaxPlayers = 16, Mode = AutohostMode.None, Engine = tas.ServerWelcome.Engine, Game = tas.ServerWelcome.Game, Map = maps[rand.Next(maps.Length)], }); } else { var bats = tas.ExistingBattles.Values.ToList(); if (bats.Count > 0) { var bat = bats[rand.Next(bats.Count)]; if (bat != null) { tas.JoinBattle(bat.BattleID); } } } } } }, TaskCreationOptions.LongRunning); Task.Factory.StartNew(async() => { while (true) { await Task.Delay(rand.Next(50000)); if (tas.IsLoggedIn) { tas.Say(SayPlace.Channel, "zk", sent.GetNext(), false); } } }, TaskCreationOptions.LongRunning); Task.Factory.StartNew(async() => { bool cycler = false; while (true) { await Task.Delay(rand.Next(5000)); if (tas.IsLoggedIn) { await tas.ChangeMyUserStatus(cycler, cycler); //await tas.ChangeMyBattleStatus(cycler, SyncStatuses.Synced, 1); cycler = !cycler; } } }, TaskCreationOptions.LongRunning); }
public void RunNub(int num) { var tas = new TasClient("Nubotron"); var name = "TestNub" + num; var ord = num / 16; var batname = "Test " + ord; //tas.Input += (sender, args) => { Console.WriteLine(" < {0}", args); }; //tas.Output += (sender, args) => { Console.WriteLine(" > {0}", args); }; tas.Connected += (sender, args) => { tas.Login(name, "dummy"); }; tas.ConnectionLost += (sender, args) => { tas.Connect(GlobalConst.LobbyServerHost, GlobalConst.LobbyServerPort); Console.WriteLine("disconnected"); }; tas.LoginAccepted += (sender, args) => { Console.WriteLine(name + " accepted"); }; tas.LoginDenied += (sender, args) => { tas.Register(name, "dummy"); }; tas.RegistrationAccepted += (sender, args) => { tas.Login(name, "dummy"); }; tas.RegistrationDenied += (sender, response) => { Console.WriteLine(name + "registration denied"); }; tas.UserAdded += (sender, args) => { if (args.Name == name) { tas.JoinChannel("bots"); if (num % 16 == 0) { tas.OpenBattle(new BattleHeader() { Title = batname, MaxPlayers = 16, }); } else { var bat = tas.ExistingBattles.Values.FirstOrDefault(x => x.Title == batname); if (bat != null) { tas.JoinBattle(bat.BattleID); } } } }; tas.BattleFound += (sender, args) => { if (args.Title == batname) { //await Task.Delay(200); tas.JoinBattle(args.BattleID); } }; tas.Connect(GlobalConst.LobbyServerHost, GlobalConst.LobbyServerPort); /*Task.Factory.StartNew(async () => * { * while (true) * { * await Task.Delay(rand.Next(400000)); * tas.Say(SayPlace.Channel, "zk", sent.GetNext(), false); * } * }, TaskCreationOptions.LongRunning);*/ }