Exemplo n.º 1
0
        bool DoInstruction()
        {
            BotInstruction ins = BotInstruction.Find(Instructions[cur].Name);

            if (ins == null)
            {
                return(false);
            }
            return(ins.Execute(this, Instructions[cur]));
        }
Exemplo n.º 2
0
        static bool DoInstruction(PlayerBot bot)
        {
            BotInstruction ins = BotInstruction.Find(bot.Instructions[bot.cur].Name);

            if (ins == null)
            {
                return(false);
            }
            return(ins.Execute(bot, bot.Instructions[bot.cur]));
        }
Exemplo n.º 3
0
        public override void Help(Player p, string message)
        {
            BotInstruction ins = BotInstruction.Find(message);

            if (ins == null)
            {
                p.Message("&HInstructions: %S{0}, reverse",
                          BotInstruction.Instructions.Join(ins2 => ins2.Name));
            }
            else
            {
                p.MessageLines(ins.Help);
            }
        }
Exemplo n.º 4
0
        public override void Help(Player p, string message)
        {
            BotInstruction ins = BotInstruction.Find(message);

            if (ins == null)
            {
                Player.Message(p, "%HInstructions: %S{0}, reverse",
                               BotInstruction.Instructions.Join(ins2 => ins2.Name.ToLower()));
            }
            else
            {
                Player.MessageLines(p, ins.Help);
            }
        }
Exemplo n.º 5
0
        public override void Load(bool startup)
        {
            hostile = new HostileInstruction();
            parkour = new ParkourInstruction();
            roam    = new RoamInstruction();
            smart   = new SmartInstruction();
            spleef  = new SpleefInstruction();

            BotInstruction.Instructions.Add(hostile);
            BotInstruction.Instructions.Add(parkour);
            BotInstruction.Instructions.Add(roam);
            BotInstruction.Instructions.Add(smart);
            BotInstruction.Instructions.Add(spleef);
        }
Exemplo n.º 6
0
        static void BotTick(PlayerBot bot)
        {
            if (bot.kill)
            {
                InstructionData data = default(InstructionData);
                // The kill instruction should not intefere with the bot AI
                int actualCur = bot.cur;
                BotInstruction.Find("kill").Execute(bot, data);
                bot.cur = actualCur;
            }
            bot.movement = false;

            if (bot.Instructions.Count == 0)
            {
                if (bot.hunt)
                {
                    InstructionData data = default(InstructionData);
                    BotInstruction.Find("hunt").Execute(bot, data);
                }
            }
            else
            {
                bool doNextInstruction = !DoInstruction(bot);
                if (bot.cur == bot.Instructions.Count)
                {
                    bot.cur = 0;
                }

                if (doNextInstruction)
                {
                    DoInstruction(bot);
                    if (bot.cur == bot.Instructions.Count)
                    {
                        bot.cur = 0;
                    }
                }
            }

            if (bot.curJump > 0)
            {
                DoJump(bot);
            }
        }
Exemplo n.º 7
0
        // Script handling
        void BotTimerFunc(object sender, ElapsedEventArgs e)
        {
            if (kill)
            {
                InstructionData data = default(InstructionData);
                BotInstruction.Find("kill").Execute(this, data);
            }
            movement = false;

            if (Instructions.Count == 0)
            {
                if (hunt)
                {
                    InstructionData data = default(InstructionData);
                    BotInstruction.Find("hunt").Execute(this, data);
                }
            }
            else
            {
                bool doNextInstruction = !DoInstruction();
                if (cur == Instructions.Count)
                {
                    cur = 0;
                }
                if (doNextInstruction)
                {
                    DoInstruction();
                    if (cur == Instructions.Count)
                    {
                        cur = 0;
                    }
                }
            }

            if (jumping)
            {
                DoJump();
            }
        }
 public override void Load(bool startup)
 {
     ins = new FootballInstruction();
     BotInstruction.Instructions.Add(ins);
 }
Exemplo n.º 9
0
 protected bool Equals(BotInstruction other)
 {
     return(Bot == other.Bot && LowDestination.Equals(other.LowDestination) && HighDestination.Equals(other.HighDestination));
 }