コード例 #1
0
ファイル: FocusTargetTask.cs プロジェクト: xFloBot/FloBot
        public bool doTask(mainForm main_form, MemoryRW mc, Player player)
        {
            Console.WriteLine(player.Target.isTargetFriendly());



            if (player.inCombat && !player.Target.isTargetFriendly())
            {
                return(true);
            }

            if (player.MobToLootCount > 0)
            {
                return(false);
            }

            DateTime mobSearchBreak = DateTime.Now;

            while (
                (DateTime.Now - mobSearchBreak).TotalSeconds < 5 &&
                !player.Target.isValidTarget(main_form) ||
                player.Target.isTargetFriendly() && (DateTime.Now - mobSearchBreak).TotalSeconds < 5
                )
            {
                mc.sendKeystroke(Keys.Tab);
                Thread.Sleep(600);
            }

            while (!player.Target.isValidTarget(main_form) && player.Target.targetCurrentHP > 0)
            {
                mc.sendKeystroke(Keys.Escape);
                Thread.Sleep(50);
            }
            return(false);
        }
コード例 #2
0
ファイル: AutoLootTask.cs プロジェクト: xFloBot/FloBot
        public bool doTask(mainForm main_form, MemoryRW mc, Player player)
        {
            while (!player.inCombat && player.MobToLootCount > 0)
            {
                int counter = 0;
                while (counter++ < 10 && !player.inCombat)
                {
                    Thread.Sleep(100);
                }
                mc.sendKeystroke(Keys.X);

                while (player.Pos.moved() && !player.inCombat)
                {
                    Thread.Sleep(100);
                }

                if (player.inCombat)
                {
                    return(true);
                }

                player.MobToLootCount--;
                Thread.Sleep(2000);
            }

            return(true);
        }
コード例 #3
0
ファイル: EmergencyMpTask.cs プロジェクト: xFloBot/FloBot
 public bool doTask(mainForm main_form, MemoryRW mc, Player player)
 {
     if (checkForLowMP(main_form, player))
     {
         mc.sendKeystroke(Keys.OemMinus);
     }
     Thread.Sleep(100);
     return(true);
 }
コード例 #4
0
        public bool doTask(mainForm main_form, MemoryRW mc, Player player)
        {
            if (player.inCombat || player.Resting)
            {
                return(false);
            }

            Skill[] copy = new Skill[player.BuffArray.Count];
            player.BuffArray.CopyTo(copy);

            foreach (Skill buff in copy)
            {
                int counter = 0;
                if (buff.skillCanBeUsed() || !player.Buffed)
                {
                    counter = (int)buff.CastTime * 4;
                    mc.sendKeystroke(buff.Hotkey);
                    buff.LastTimeUsed = DateTime.Now;
                }

                do
                {
                    if (player.inCombat)
                    {
                        return(false);
                    }
                    Thread.Sleep(250);
                } while (counter-- >= 0);
            }

            while (player.targetingMyself())
            {
                mc.sendKeystroke(Keys.Escape);
                Thread.Sleep(100);
            }
            player.Buffed = true;
            return(true);
        }
コード例 #5
0
        public bool doTask(mainForm main_form, MemoryRW mc, Player player)
        {
            if (player.inCombat)
            {
                return(true);
            }

            //Check if autoloot is checked then if the target name is not "NoTarget"
            if (main_form.cbAutoLoot.Checked && !player.Target.targetName.Contains("NoTarget"))
            {
                player.MobToLootCount++;
            }

            while (!player.Target.targetName.Contains("NoTarget") && player.Target.targetName.Length > 0)
            {
                mc.sendKeystroke(Keys.Escape);
                Thread.Sleep(100);
            }
            player.PlayerEngaged = false;
            return(false);
        }
コード例 #6
0
ファイル: GetRestTask.cs プロジェクト: xFloBot/FloBot
        public bool doTask(mainForm main_form, MemoryRW mc, Player player)
        {
            //Check if in combat yes -> return false (not resting) incase you were resting, stand up and set resting to false
            if (player.inCombat)
            {
                if (player.Resting)
                {
                    mc.sendKeystroke(Keys.Z);
                    player.Resting = false;
                    oldHP          = -1;
                    return(false);
                }
                else
                {
                    return(false);
                }
            }

            if (player.Resting && oldHP > player.PlayerCurrentHP)
            {
                mc.sendKeystroke(Keys.Tab);
                return(true);
            }

            //Check if player is not resting but needs to rest
            if (!player.Resting && (getRestHP(main_form, player) || getRestMP(main_form, player)))
            {
                if (player.inCombat)
                {
                    return(false);
                }
                //Try to avoid not being able to sit down when you killed an enemy with a cast time spell
                //Bot notices that an enemy died even befor shown in the client
                do
                {
                    Thread.Sleep(200);
                } while (player.Pos.moved());
                Thread.Sleep(2000);
                oldHP          = player.PlayerCurrentHP;
                player.Resting = true;
                mc.sendKeystroke(Keys.Z);

                return(true);
            }
            //Check if player has finished resting
            if (player.Resting)
            {
                if (player.PlayerMaxHP == player.PlayerCurrentHP && player.PlayerMaxMP == player.PlayerCurrentMP)
                {
                    oldHP = -1;
                    mc.sendKeystroke(Keys.Z);
                    player.Resting = false;
                    Thread.Sleep(1500);
                    return(false);
                }
                else
                {
                    if (oldHP < player.PlayerCurrentHP)
                    {
                        oldHP = player.PlayerCurrentHP;
                    }
                    Thread.Sleep(200);
                    return(true);
                }
            }
            return(false);
        }
コード例 #7
0
ファイル: AttackTargetTask.cs プロジェクト: xFloBot/FloBot
        public bool doTask(mainForm main_form, MemoryRW mc, Player player)
        {
            int counter = 400;

            if (!player.PlayerEngaged)
            {  //Attack
                mc.sendKeystroke(Keys.Space);
                // Stop Moving
                //mc.sendKeystroke(Keys.S);
                player.PlayerEngaged = true;
                do
                {
                    Thread.Sleep(50);
                }while (player.Pos.moved() && counter-- > 0);
                counter = 400;
            }


            Console.WriteLine((DateTime.Now - lastTimeUsedSpell).TotalSeconds);
            Console.WriteLine("DelayTime: " + delayTime);
            if (delayTime > 0)
            {
                if ((DateTime.Now - lastTimeUsedSpell).TotalSeconds <= delayTime)
                {
                    return(true);
                }
                else
                {
                    delayTime = 0;
                }
            }

            Skill[] copy = new Skill[player.AttArray.Count];
            player.AttArray.CopyTo(copy);
            foreach (Skill attk in copy)
            {
                Console.WriteLine(attk.Hotkey);
                if (attk.attackCanBeUsed(player.Target, player))
                {
                    if (!player.inCombat)
                    {
                        return(false);
                    }

                    mc.sendKeystroke(attk.Hotkey);

                    do
                    {
                        Thread.Sleep(50);
                    }while (player.Pos.moved() && counter-- > 0);
                    Console.WriteLine("Set Time Used");
                    attk.LastTimeUsed = DateTime.Now;
                    lastTimeUsedSpell = attk.LastTimeUsed;
                    Console.WriteLine(attk.CastTime);
                    delayTime = attk.CastTime;
                    //Thread.Sleep(2000);

                    return(true);
                }
            }

            //Attack
            mc.sendKeystroke(Keys.Space);
            do
            {
                Thread.Sleep(50);
            }while (player.Pos.moved() && counter-- > 0);

            return(true);
        }