Exemplo n.º 1
0
        private void ScanInventory()
        {
            if (!_ingameState.IngameUi.InventoryPanel.IsVisible)
            {
                _run = false;
                return;
            }

            LogMessage("MoveToStash start!", 3);
            Thread.Sleep(Settings.Speed * 3);
            _run = true;
            var tabsValue = MyDictionary.ReadTabSetting(Settings);

            if (Settings.Indentity)
            {
                Indentity();
            }
            FirstTab();

            if (!_run)
            {
                return;
            }

            int currentTab = 1;

            while (currentTab <= Settings.TabCount && _run)
            {
                var items = _inventory.VisibleInventoryItems;
                if (items.All(i => !CheckIngoredCell(i.GetClientRect())))
                {
                    BackToTab(currentTab, Settings.BackTo);
                    return;
                }

                foreach (var child in items)
                {
                    if (!_run)
                    {
                        return;
                    }

                    var item     = child.AsObject <NormalInventoryItem>().Item;
                    var position = child.GetClientRect();


                    if (string.IsNullOrEmpty(item?.Path))
                    {
                        continue;
                    }
                    var itemClass = CheckItem(item);

                    if (CheckAdvansedFilter(currentTab, position, item))
                    {
                        continue;
                    }

                    if (!tabsValue.ContainsKey(currentTab) || !tabsValue[currentTab].Contains(itemClass))
                    {
                        continue;
                    }

                    if (!CheckIngoredCell(position))
                    {
                        continue;
                    }

                    position.X += GameController.Window.GetWindowRectangle().X;
                    position.Y += GameController.Window.GetWindowRectangle().Y;
                    MouseClickCtrl(position.Center);
                }

                currentTab++;
                if (currentTab > _ingameState.ServerData.StashPanel.TotalStashes)
                {
                    return;
                }
                NextTab(currentTab);
            }

            BackToTab(currentTab, Settings.BackTo);
            LogMessage("MoveToStash Stop!", 3);
            _run = false;
        }
Exemplo n.º 2
0
        private void ChaosRecipe()
        {
            if (!_ingameState.IngameUi.InventoryPanel.IsVisible)
            {
                _run = false;
                return;
            }

            if (!GameController.Game.IngameState.IngameUi.IsVisible)
            {
                _run = false;
                return;
            }

            LogMessage("Chaos Recipe start!", 3);
            Thread.Sleep(Settings.Speed * 3);
            _run = true;
            var tabsValue = MyDictionary.ReadTabSetting(Settings);

            FirstTab();

            if (!_run)
            {
                return;
            }
            _onlyChaosSet = Settings.ChaosSet.Value;
            var  currentTab  = 1;
            bool needTwoHand = true;

            while (currentTab <= Settings.TabCount && _run)
            {
                if (tabsValue.ContainsKey(currentTab))
                {
                    foreach (string type in tabsValue[currentTab])
                    {
                        if (_oneClick.Contains(type))
                        {
                            if (!ClickItem(type, ref needTwoHand))
                            {
                                LogMessage($">>> Not found item: {type} in current tab", 5);
                                break;
                            }
                        }
                        else if (_twoClick.Contains(type))
                        {
                            if (!ClickItem(type, ref needTwoHand, 2))
                            {
                                LogMessage($">>> Not found item: {type} in current tab", 5);
                                break;
                            }
                        }
                    }
                }

                currentTab++;
                if (currentTab > GameController.Game.IngameState.IngameUi.StashElement.TotalStashes)
                {
                    return;
                }
                NextTab(currentTab);
            }

            BackToTab(currentTab, Settings.BackTo);
            _run = false;
            LogMessage("MoveToStash Stop!", 3);
        }