Esempio n. 1
0
        public static bool MoveItemToChaosRecipeTab(ItemTab source, ItemTab target, Item item, MoveOrganizer organizer, SortConfig config)
        {
            Item itemCopy = new Item();

            itemCopy.inventoryId = item.inventoryId;
            itemCopy.x           = item.x;
            itemCopy.y           = item.y;

            if (!ControlChaosRecipeReqs(target, item, config))
            {
                return(false);
            }

            bool removed = source.RemoveItem(item);
            bool added   = target.AddItem(item);

            if (added == false)
            {
                //Failed add, insert item in List<Item> for source again
                source.items.Add(item);
            }
            else
            {
                organizer.MoveItem(source, target, itemCopy);
            }

            return(removed && added);
        }
Esempio n. 2
0
        public void MoveItem(ItemTab source, ItemTab target, Item item)
        {
            //Calculate difference in tabs, i.e how much we need to move
            int tabDiff = (source.type == TabType.Inventory ? target.index : source.index) - currentTabIndex;

            if (tabDiff > 0)
            {
                for (int i = 0; i < tabDiff; i++)
                {
                    moves.Add("Send, {right down}{right up}");
                    addSleep(174, 243);
                }
            }
            else if (tabDiff < 0)
            {
                for (int i = 0; i < -tabDiff; i++)
                {
                    moves.Add("Send, {left down}{left up}");
                    addSleep(163, 259);
                }
            }

            currentTabIndex = source.type == TabType.Inventory ? target.index : source.index;

            TotalMS += 20;
            moves.Add("MouseMove, " + Math.Round(calcMouseX(source.type, item.x)).ToString() + ", " + Math.Round(calcMouseY(source.type, item.y)).ToString() + ", " + ran.Next(2, 10).ToString());
            addSleep(54, 76);
            moves.Add("Send, {ctrl down}{click}{ctrl up}");
            addSleep(12, 35);
        }
Esempio n. 3
0
        public static bool ControlChaosRecipeReqs(ItemTab target, Item item, SortConfig config)
        {
            var ChaosTabsSource       = config.targetTabs.Where(x => x.chaosRecipeCount > 0);
            var ChaosTabsSourceSorted = ChaosTabsSource.OrderBy(x => x.order).ToList();

            foreach (TargetTab tab in ChaosTabsSourceSorted)
            {
                int matchesCount = 0;

                foreach (Item i in target.items)
                {
                    if (MatchTargetTabItem(i, tab))
                    {
                        matchesCount++;
                    }
                }

                bool thisType = false;
                if (MatchTargetTabItem(item, tab))
                {
                    thisType = true;
                }

                if (thisType == false)
                {
                    if (matchesCount != tab.chaosRecipeCount)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (matchesCount >= tab.chaosRecipeCount)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 4
0
        public static bool MoveItem(ItemTab source, ItemTab target, Item item, MoveOrganizer organizer)
        {
            Item itemCopy = new Item();

            itemCopy.inventoryId = item.inventoryId;
            itemCopy.x           = item.x;
            itemCopy.y           = item.y;

            bool removed = source.RemoveItem(item);
            bool added   = target.AddItem(item);

            if (added == false)
            {
                //Failed add, insert item in List<Item> for source again
                source.items.Add(item);
            }
            else
            {
                organizer.MoveItem(source, target, itemCopy);
            }

            return(removed && added);
        }