Inheritance: Client.AutomatedGame
示例#1
0
 void DisplayStatistics(BotGame bot)
 {
     Console.WriteLine("Bot username: "******"\tBehavior: " + bot.Behavior.Name);
     Console.WriteLine("\tRunning: " + bot.Running);
     Console.WriteLine("\tConnected: " + bot.Connected);
     Console.WriteLine("\tLogged In: " + bot.LoggedIn);
     Console.WriteLine("\tPosition: " + bot.Player.GetPosition());
     if (bot.GroupLeaderGuid == 0)
     {
         Console.WriteLine("\tGroup Leader: " + "Not in group");
     }
     else if (!bot.World.PlayerNameLookup.ContainsKey(bot.GroupLeaderGuid))
     {
         Console.WriteLine("\tGroup Leader: " + "Not found");
     }
     else
     {
         Console.WriteLine("\tGroup Leader: " + bot.World.PlayerNameLookup[bot.GroupLeaderGuid]);
     }
     Console.WriteLine("\tLast Received Packet: " + bot.LastReceivedPacket);
     Console.WriteLine("\tLast Received Packet Time: " + bot.LastReceivedPacketTime.ToLongTimeString());
     Console.WriteLine("\tLast Sent Packet: " + bot.LastSentPacket);
     Console.WriteLine("\tLast Sent Packet Time: " + bot.LastSentPacketTime.ToLongTimeString());
     Console.WriteLine("\tLast Update() call: " + bot.LastUpdate.ToLongTimeString());
     Console.WriteLine("\tSchedule Actions: " + bot.ScheduledActionsCount);
 }
示例#2
0
        public void RemoveBot(BotGame bot)
        {
            lock (bots)
            {
                botInfos.Remove(botInfos.Single(info => info.Username == bot.Username && info.Password == bot.Password));
                bots.Remove(bot);
            }

            bot.Dispose().Wait();
        }
示例#3
0
        public BotGame LoadBot(BotInfo info)
        {
            BotGame game = new BotGame(Settings.Default.Hostname,
                                       Settings.Default.Port,
                                       info.Username,
                                       info.Password,
                                       Settings.Default.RealmID,
                                       0);

            game.Start();
            return(game);
        }
示例#4
0
        public BotGame CreateBot()
        {
            Log("Creating new bot");
            Random  random = new Random();
            BotGame game   = null;

            do
            {
                string username = "******" + random.Next();
                string password = random.Next().ToString();
                factoryGame.DoSayChat(".account create " + username + " " + password);
                Thread.Sleep(1000);

                for (int loginTries = 0; loginTries < 5; loginTries++)
                {
                    game = new BotGame(Settings.Default.Hostname,
                                       Settings.Default.Port,
                                       username,
                                       password,
                                       Settings.Default.RealmID,
                                       0);
                    game.SettingUp = true;
                    game.Start();
                    for (int tries = 0; !game.Connected && tries < 10; tries++)
                    {
                        Thread.Sleep(1000);
                    }
                    if (!game.Connected)
                    {
                        game.Dispose();
                        game = null;
                    }
                    else
                    {
                        botInfos.Add(new BotInfo(username, password));
                        break;
                    }
                }
            } while (game == null);


            game.CreateCharacter();
            Thread.Sleep(1000);
            game.SendPacket(new OutPacket(WorldCommand.ClientEnumerateCharacters));
            Thread.Sleep(1000);
            game.SettingUp = false;
            return(game);
        }
示例#5
0
        public BotGame CreateBot(bool startBot)
        {
            Log("Creating new bot");

            string username = "******" + randomGenerator.Next();
            string password = randomGenerator.Next().ToString();

            lock (factoryGame)
                factoryGame.DoSayChat(".account create " + username + " " + password);

            uint behaviorRandomIndex        = (uint)randomGenerator.Next(100);
            uint behaviorCurrentIndex       = 0;
            BotBehaviorSettings botBehavior = botBehaviors.Values.First();

            foreach (var behavior in botBehaviors.Values)
            {
                if (behaviorRandomIndex < behaviorCurrentIndex + behavior.Probability)
                {
                    botBehavior = behavior;
                    break;
                }

                behaviorCurrentIndex += behavior.Probability;
            }

            BotGame game = new BotGame(Settings.Default.Hostname,
                                       Settings.Default.Port,
                                       username,
                                       password,
                                       Settings.Default.RealmID,
                                       0,
                                       botBehavior);

            if (startBot)
            {
                game.Start();
            }
            botInfos.Add(new BotInfo(username, password, botBehavior.Name));

            return(game);
        }
示例#6
0
        public BotGame CreateBot()
        {
            Log("Creating new bot");

            string username = "******" + randomGenerator.Next();
            string password = randomGenerator.Next().ToString();

            lock (factoryGame)
                factoryGame.DoSayChat(".account create " + username + " " + password);

            BotGame game = new BotGame(Settings.Default.Hostname,
                                       Settings.Default.Port,
                                       username,
                                       password,
                                       Settings.Default.RealmID,
                                       0);

            game.SettingUp = true;
            game.Start();
            botInfos.Add(new BotInfo(username, password));

            return(game);
        }
示例#7
0
        public void RemoveBot(BotGame bot)
        {
            lock (bots)
            {
                botInfos.Remove(botInfos.Single(info => info.Username == bot.Username && info.Password == bot.Password));
                bots.Remove(bot);
            }

            bot.Dispose().Wait();
        }
示例#8
0
 void DisplayStatistics(BotGame bot)
 {
     Console.WriteLine("Bot username: "******"\tBehavior: " + bot.Behavior.Name);
     Console.WriteLine("\tRunning: " + bot.Running);
     Console.WriteLine("\tConnected: " + bot.Connected);
     Console.WriteLine("\tLogged In: " + bot.LoggedIn);
     Console.WriteLine("\tPosition: " + bot.Player.GetPosition());
     if (bot.GroupLeaderGuid == 0)
         Console.WriteLine("\tGroup Leader: " + "Not in group");
     else if (!bot.World.PlayerNameLookup.ContainsKey(bot.GroupLeaderGuid))
         Console.WriteLine("\tGroup Leader: " + "Not found");
     else
         Console.WriteLine("\tGroup Leader: " + bot.World.PlayerNameLookup[bot.GroupLeaderGuid]);
     Console.WriteLine("\tLast Received Packet: " + bot.LastReceivedPacket);
     Console.WriteLine("\tLast Sent Packet: " + bot.LastSentPacket);
     Console.WriteLine("\tLast Update() call: " + bot.LastUpdate.ToLongTimeString());
 }
示例#9
0
 public BotGame LoadBot(BotInfo info)
 {
     BotGame game = new BotGame(Settings.Default.Hostname,
                                            Settings.Default.Port,
                                            info.Username,
                                            info.Password,
                                            Settings.Default.RealmID,
                                            0,
                                            botBehaviors[info.BehaviorName]);
     game.Start();
     return game;
 }
示例#10
0
        public BotGame CreateBot()
        {
            Log("Creating new bot");

            string username = "******" + randomGenerator.Next();
            string password = randomGenerator.Next().ToString();
            lock(factoryGame)
                factoryGame.DoSayChat(".account create " + username + " " + password);

            uint behaviorRandomIndex = (uint)randomGenerator.Next(100);
            uint behaviorCurrentIndex = 0;
            BotBehaviorSettings botBehavior = botBehaviors.Values.First();
            foreach (var behavior in botBehaviors.Values)
            {
                if (behaviorRandomIndex < behaviorCurrentIndex + behavior.Probability)
                {
                    botBehavior = behavior;
                    break;
                }

                behaviorCurrentIndex += behavior.Probability;
            }

            BotGame game = new BotGame(Settings.Default.Hostname,
                                                Settings.Default.Port,
                                                username,
                                                password,
                                                Settings.Default.RealmID,
                                                0,
                                                botBehavior);
            game.SettingUp = true;
            game.Start();
            botInfos.Add(new BotInfo(username, password, botBehavior.Name));

            return game;
        }
示例#11
0
        public BotGame CreateBot()
        {
            Log("Creating new bot");

            string username = "******" + randomGenerator.Next();
            string password = randomGenerator.Next().ToString();
            lock(factoryGame)
                factoryGame.DoSayChat(".account create " + username + " " + password);

            BotGame game = new BotGame(Settings.Default.Hostname,
                                                Settings.Default.Port,
                                                username,
                                                password,
                                                Settings.Default.RealmID,
                                                0);
            game.SettingUp = true;
            game.Start();
            botInfos.Add(new BotInfo(username, password));

            return game;
        }