Esempio n. 1
0
        static public Composite SellItems(bool sellUnidCrItems = false)
        {
            return(new Decorator(x => DoSelling(),

                                 new Sequence(
                                     new Action(delegate
            {
                InputWrapper.ResetMouseButtons();
                // InputWrapper.KeyPress(System.Windows.Forms.Keys.Escape);
                return RunStatus.Success;
            }),
                                     FindVendor(),
                                     MoveToAndOpenVendor(),
                                     OpenVendorSellScreen(),

                                     new Action(delegate
            {
                var inventory = WillBot.gameController.Game.IngameState.IngameUi.InventoryPanel[InventoryIndex.PlayerInventory];
                var invItems = inventory.VisibleInventoryItems;
                var itemsToSell = WillBot.Me.sellit.GetItemsToSell(invItems, sellUnidCrItems);
                if (itemsToSell.Count == 0)
                {
                    WillBot.Me.HasSoldItemsThisTownCycle = true;
                    InputWrapper.KeyPress(System.Windows.Forms.Keys.Escape);
                    Thread.Sleep(200);
                    if (WillBot.gameController.IngameState.IngameUi.VendorPanel.IsVisible)
                    {
                        InputWrapper.KeyPress(System.Windows.Forms.Keys.Escape);
                    }

                    return RunStatus.Success;
                }
                int latency = (int)WillBot.gameController.IngameState.CurLatency;
                Input.KeyDown(System.Windows.Forms.Keys.LControlKey);
                foreach (var item in itemsToSell)
                {
                    Mouse.SetCursorPosAndLeftOrRightClick(item.Rect, latency, randomClick: true);
                    Thread.Sleep(200);
                }

                Input.KeyUp(System.Windows.Forms.Keys.LControlKey);

                var acceptButton = WillBot.gameController.IngameState.IngameUi.VendorAcceptButton;
                //var acceptButton = WillBot.gameController.IngameState.IngameUi.SellWindow.GetChildAtIndex(3).GetChildAtIndex(5);
                Mouse.SetCursorPosAndLeftOrRightClick(acceptButton.GetClientRectCache, latency, randomClick: true);

                Thread.Sleep(900);
                if (WillBot.gameController.IngameState.IngameUi.VendorPanel.IsVisible)
                {
                    InputWrapper.KeyPress(System.Windows.Forms.Keys.Escape);
                }
                WillBot.Me.HasSoldItemsThisTownCycle = true;
                WillBot.Me.IsPlayerInventoryFull = false;
                return RunStatus.Success;
            })

                                     )));
        }
Esempio n. 2
0
 public static Composite LevelGems()
 {
     return(new Decorator(x => GetGemsToLevelUp(),
                          new Action(delegate
     {
         Mouse.blockInput(true);
         InputWrapper.ResetMouseButtons();
         Thread.Sleep(80);
         foreach (var rect in gemRectsToLevelUp)
         {
             Mouse.SetCursorPosAndLeftOrRightClick(rect, Latency);
             Thread.Sleep(50);
         }
         Mouse.blockInput(false);
     })
                          ));
 }