Пример #1
0
        public async Task Execute(IBotEngine instance)
        {
            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.Transfer));

            string cmdMap = Map.Contains("-") ? Map.Split('-')[0] : Map;
            string curMap = Player.Map;

            if (!cmdMap.Equals(curMap, StringComparison.OrdinalIgnoreCase))
            {
                await instance.WaitUntil(() => World.IsActionAvailable(LockActions.Transfer));

                if (Player.CurrentState == Player.State.InCombat)
                {
                    Player.MoveToCell(Player.Cell, Player.Pad);
                    await instance.WaitUntil(() => Player.CurrentState == Player.State.InCombat);
                }

                Player.JoinMap(Map, Cell, Pad);
                await instance.WaitUntil(() => Player.Map.Equals(cmdMap, StringComparison.OrdinalIgnoreCase));

                await instance.WaitUntil(() => !World.IsMapLoading, null, 40);

                if (!Player.Cell.Equals(Cell, StringComparison.OrdinalIgnoreCase))
                {
                    Player.MoveToCell(Cell, Pad);
                    await Task.Delay(500);
                }
            }
        }
Пример #2
0
        public async Task TryJoin(IBotEngine instance, string MapName, string RoomProp = "")
        {
            fMap = MapName;

            //Proxy.Instance.ReceivedFromServer += JsonMapHandler;
            if (MapName == "mobius" || MapName == "rangda")
            {
                Proxy.Instance.ReceivedFromServer += JsonMapHandler;
            }

            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.Transfer), null, 15);

            if (Player.CurrentState == Player.State.InCombat)
            {
                Player.MoveToCell(Player.Cell, Player.Pad);
                await Task.Delay(1250);
            }
            Player.JoinMap(MapName + RoomProp, this.Cell, this.Pad);
            await instance.WaitUntil(() => Player.Map.Equals(MapName, StringComparison.OrdinalIgnoreCase), null, 5);

            await instance.WaitUntil(() => !World.IsMapLoading, null, 40);

            //Proxy.Instance.ReceivedFromServer -= JsonMapHandler;
            if (MapName == "mobius" || MapName == "rangda")
            {
                await Proxy.Instance.SendToClient(result);

                await Task.Delay(500);
            }
        }
Пример #3
0
        public async Task Execute(IBotEngine instance)
        {
            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.BuyItem));

            Shop.ResetShopInfo();
            Shop.Load(ShopId);
            await instance.WaitUntil(() => Shop.IsShopLoaded);

            InventoryItem i =
                Player.Inventory.Items.FirstOrDefault(
                    item => item.Name.Equals(ItemName, StringComparison.OrdinalIgnoreCase));

            if (i != null)
            {
                Shop.BuyItem(ItemName);
                await instance.WaitUntil(() => Player.Inventory.Items
                                         .FirstOrDefault(it => it.Name.Equals(ItemName,
                                                                              StringComparison.OrdinalIgnoreCase))
                                         .Quantity != i.Quantity);
            }
            else
            {
                Shop.BuyItem(ItemName);
                await instance.WaitUntil(
                    () => Player.Inventory.Items.FirstOrDefault(
                        it => it.Name.Equals(ItemName, StringComparison.OrdinalIgnoreCase)) != null);
            }
        }
Пример #4
0
        public async Task Execute(IBotEngine instance)
        {
            await instance.WaitUntil(() => World.IsMonsterAvailable(Monster), null, 3);

            if (instance.Configuration.WaitForSkills)
            {
                await instance.WaitUntil(() => Player.AllSkillsAvailable);
            }

            if (!instance.IsRunning || !Player.IsAlive || !Player.IsLoggedIn)
            {
                return;
            }

            Player.AttackMonster(Monster);

            if (instance.Configuration.Skills.Count > 0)
            {
                Task.Run(() => UseSkillsSet(instance));
            }

            await instance.WaitUntil(() => !Player.HasTarget, null, 360);

            Player.CancelTarget();

            _cts?.Cancel(false);
        }
Пример #5
0
        public async Task Execute(IBotEngine instance)
        {
            await instance.WaitUntil(() => Player.Quests.QuestTree.Any(q => q.Id == Quest.Id));

            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.AcceptQuest));

            Quest.Accept();
            await instance.WaitUntil(() => Player.Quests.IsInProgress(Quest.Id));
        }
Пример #6
0
        public async Task Execute(IBotEngine instance)
        {
            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.TryQuestComplete));

            bool provokeMons = instance.Configuration.ProvokeMonsters;

            int i = 0;

            if (!Player.Quests.AcceptedQuests.Contains(Quest))
            {
                Quest.Accept();
            }
            while (Player.Quests.CanComplete(Quest.Id) && i < CompleteTry && instance.IsRunning && Player.IsLoggedIn)
            {
                if (provokeMons)
                {
                    instance.Configuration.ProvokeMonsters = false;
                }
                if (instance.Configuration.ExitCombatBeforeQuest && !InBlank)
                {
                    Player.MoveToCell(Player.Cell, Player.Pad);
                    await instance.WaitUntil(() => Player.CurrentState != Player.State.InCombat);

                    await Task.Delay(1000);
                }
                if (InBlank && !Player.Cell.Equals("Blank"))
                {
                    Player.MoveToCell("Blank", "Spawn");
                    await Task.Delay(2000);
                }
                Quest.Complete();
                if (CompleteTry > 1)
                {
                    await Task.Delay(Delay);
                }
                i++;
                //await instance.WaitUntil(() => !Player.Quests.IsInProgress(Quest.Id));
            }
            instance.Configuration.ProvokeMonsters = provokeMons;

            if (ReAccept)
            {
                await Task.Delay(1000);

                Quest.Accept();
            }
            if (Player.Quests.CanComplete(Quest.Id) && LogoutFailed)
            {
                await Task.Delay(1000);

                Player.Logout();
            }
        }
Пример #7
0
        public async Task Execute(IBotEngine instance)
        {
            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.SellItem));

            InventoryItem item =
                Player.Inventory.Items.FirstOrDefault(
                    i => i.Name.Equals(ItemName, StringComparison.OrdinalIgnoreCase));

            if (item != null)
            {
                Shop.SellItem(ItemName);
                await instance.WaitUntil(() => !Player.Inventory.ContainsItem(item.Name, item.Quantity));
            }
        }
Пример #8
0
        public async Task Execute(IBotEngine instance)
        {
            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.EquipItem));

            InventoryItem item =
                Player.Inventory.Items.FirstOrDefault(
                    i => i.Name.Equals(ItemName, StringComparison.OrdinalIgnoreCase) && i.IsEquippable);

            if (item != null)
            {
                Player.Equip(item.Id);
                await instance.WaitUntil(() => Player.Inventory.Items.FirstOrDefault(
                                             it => it.IsEquipped && it.Id == item.Id) != null);
            }
        }
Пример #9
0
        public async Task Execute(IBotEngine instance)
        {
            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.TryQuestComplete));

            if (Player.Quests.CanComplete(Quest.Id))
            {
                if (instance.Configuration.ExitCombatBeforeQuest)
                {
                    Player.MoveToCell(Player.Cell, Player.Pad);
                    await instance.WaitUntil(() => Player.CurrentState != Player.State.InCombat);
                }

                Quest.Complete();
                await instance.WaitUntil(() => !Player.Quests.IsInProgress(Quest.Id));
            }
        }
Пример #10
0
        public async Task Execute(IBotEngine instance)
        {
            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.GetMapItem));

            Player.GetMapItem(ItemId);
            await Task.Delay(2000);
        }
Пример #11
0
        public async Task Execute(IBotEngine instance)
        {
            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.Rest), () => instance.IsRunning && Player.IsLoggedIn);

            if (instance.Configuration.ExitCombatBeforeRest)
            {
                Player.MoveToCell(Player.Cell, Player.Pad);
                await instance.WaitUntil(() => Player.CurrentState != Player.State.InCombat);
            }

            Player.Rest();
            if (Full)
            {
                await instance.WaitUntil(() => Player.Mana >= Player.ManaMax &&
                                         Player.Health >= Player.HealthMax);
            }
        }
Пример #12
0
 public async Task Execute(IBotEngine instance)
 {
     Player.WalkToPoint(X, Y);
     await instance.WaitUntil(() =>
     {
         float[] pos = Player.Position;
         return(pos[0].ToString() == X && pos[1].ToString() == Y);
     });
 }
Пример #13
0
 public async Task Execute(IBotEngine instance)
 {
     if (TransferFromBank)
     {
         if (Player.Bank.ContainsItem(ItemName))
         {
             Player.Bank.TransferFromBank(ItemName);
             await instance.WaitUntil(() => !Player.Bank.ContainsItem(ItemName));
         }
     }
     else
     {
         if (Player.Inventory.ContainsItem(ItemName, "*"))
         {
             Player.Bank.TransferToBank(ItemName);
             await instance.WaitUntil(() => !Player.Inventory.ContainsItem(ItemName, "*"));
         }
     }
 }
Пример #14
0
        public async Task Execute(IBotEngine instance)
        {
            bool CanExecute() => Player.Bank.ContainsItem(BankItemName) && Player.Inventory.ContainsItem(InventoryItemName, "*");

            if (CanExecute())
            {
                Player.Bank.Swap(InventoryItemName, BankItemName);
                await instance.WaitUntil(() => !CanExecute());
            }
        }
Пример #15
0
        public async Task Execute(IBotEngine instance)
        {
            List <string> areaUsers = World.PlayersInMap;

            Player.GoToPlayer(PlayerName);

            if (areaUsers.Any(p => p.Equals(PlayerName, StringComparison.OrdinalIgnoreCase)))
            {
                await Task.Delay(500);
            }
            else
            {
                await instance.WaitUntil(() =>
                                         World.PlayersInMap.Any(p =>
                                                                p.Equals(PlayerName, StringComparison.OrdinalIgnoreCase)) && !World.IsMapLoading, null, 40);
            }
        }
Пример #16
0
        public async Task Execute(IBotEngine instance)
        {
            BotData.BotState = BotData.State.Move;
            await instance.WaitUntil(() => World.IsActionAvailable(LockActions.Transfer), null, 15);

            string cmdMap = this.Map.Contains("-") ? this.Map.Split(new char[]
            {
                '-'
            })[0] : this.Map;
            string text = this.Map.Substring(cmdMap.Length);

            if (!cmdMap.Equals(Player.Map, StringComparison.OrdinalIgnoreCase))
            {
                int n;
                if (!int.TryParse(text, out n) && text != "")
                {
                    Random random = new Random();
                    int    num    = random.Next(9000, 9999);
                    text = "-" + num;
                }

                await this.TryJoin(instance, cmdMap, text);
            }
            if (cmdMap.Equals(Player.Map, StringComparison.OrdinalIgnoreCase))
            {
                if (!Player.Cell.Equals(this.Cell, StringComparison.OrdinalIgnoreCase))
                {
                    Player.MoveToCell(this.Cell, this.Pad);
                    await Task.Delay(1250);
                }
                World.SetSpawnPoint();
                BotData.BotMap  = cmdMap;
                BotData.BotCell = this.Cell;
                BotData.BotPad  = this.Pad;
            }
        }
Пример #17
0
        public async Task Execute(IBotEngine instance)
        {
            await World.DropStack.GetDrop(ItemName);

            await instance.WaitUntil(() => !World.DropStack.Contains(ItemName));
        }