Exemplo n.º 1
0
        public static bool IsThereRoomForItem(CustomItem customItem)
        {
            var inventory = GetCurrentInventoryArray();

            for (int x = 0; x < 12; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    if (CheckForOpenSpaceFrom(x, y, customItem.Width, customItem.Height, inventory) == true)
                    {
                        Console.WriteLine("There is room for item");
                        return(true);
                    }
                }
            }
            Console.WriteLine("There is NO room for item");
            return(false);
        }
Exemplo n.º 2
0
        private IEnumerator TryToPickV2(CustomItem pickItItem)
        {
            if (!pickItItem.IsValid)
            {
                FullWork = true;
                //LogMessage("PickItem is not valid.", 5, Color.Red);
                yield break;
            }

            var centerOfItemLabel     = pickItItem.LabelOnGround.Label.GetClientRectCache.Center;
            var rectangleOfGameWindow = basePlugin.GameController.Window.GetWindowRectangleTimeCache;
            var oldMousePosition      = Mouse.GetCursorPositionVector();

            _clickWindowOffset = rectangleOfGameWindow.TopLeft;
            rectangleOfGameWindow.Inflate(-55, -55);
            centerOfItemLabel.X += rectangleOfGameWindow.Left;
            centerOfItemLabel.Y += rectangleOfGameWindow.Top;

            if (!rectangleOfGameWindow.Intersects(new RectangleF(centerOfItemLabel.X, centerOfItemLabel.Y, 3, 3)))
            {
                FullWork = true;
                //LogMessage($"Label outside game window. Label: {centerOfItemLabel} Window: {rectangleOfGameWindow}", 5, Color.Red);
                yield break;
            }

            var tryCount = 0;

            while (!pickItItem.IsTargeted() && tryCount < 5)
            {
                var completeItemLabel = pickItItem.LabelOnGround?.Label;

                if (completeItemLabel == null)
                {
                    if (tryCount > 0)
                    {
                        //  LogMessage("Probably item already picked.", 3);
                        yield break;
                    }

                    //LogError("Label for item not found.", 5);
                    yield break;
                }

                /*while (GameController.Player.GetComponent<Actor>().isMoving)
                 * {
                 *  yield return waitPlayerMove;
                 * }*/
                var clientRect = completeItemLabel.GetClientRect();

                var clientRectCenter = clientRect.Center;

                var vector2 = clientRectCenter + _clickWindowOffset;

                Mouse.MoveCursorToPosition(vector2);
                yield return(wait3ms);

                Mouse.MoveCursorToPosition(vector2);
                yield return(wait3ms);

                yield return(Mouse.LeftClick());

                yield return(toPick);

                tryCount++;
            }

            if (pickItItem.IsTargeted())
            {
                Input.Click(MouseButtons.Left);
            }

            tryCount = 0;

            while (basePlugin.GameController.Game.IngameState.IngameUi.ItemsOnGroundLabels.FirstOrDefault(
                       x => x.Address == pickItItem.LabelOnGround.Address) != null && tryCount < 6)
            {
                tryCount++;
                yield return(new WaitTime(200));
            }

            //yield return waitForNextTry;

            //   Mouse.MoveCursorToPosition(oldMousePosition);
        }
Exemplo n.º 3
0
        public bool OverrideChecks(CustomItem item)
        {
            try
            {
                #region Currency

                if (Settings.AllCurrency && item.ClassName.EndsWith("Currency"))
                {
                    return(!item.Path.Equals("Metadata/Items/Currency/CurrencyIdentification", StringComparison.Ordinal) ||
                           !Settings.IgnoreScrollOfWisdom);
                }

                #endregion

                #region Shaper & Elder

                if (Settings.ElderItems)
                {
                    if (item.IsElder)
                    {
                        return(true);
                    }
                }

                if (Settings.ShaperItems)
                {
                    if (item.IsShaper)
                    {
                        return(true);
                    }
                }

                if (Settings.FracturedItems)
                {
                    if (item.IsFractured)
                    {
                        return(true);
                    }
                }

                #endregion

                #region Rare Overrides
                if (Settings.HarvestSeeds && item.ClassName == "HarvestSeed")
                {
                    return(true);
                }

                if (Settings.Rares && item.Rarity == ItemRarity.Rare)
                {
                    if (Settings.RareJewels && (item.ClassName == "Jewel" || item.ClassName == "AbyssJewel"))
                    {
                        return(true);
                    }
                    if (Settings.RareRings && item.ClassName == "Ring" && item.ItemLevel <= 74 && item.ItemLevel >= Settings.RareRingsilvl)
                    {
                        return(true);
                    }
                    if (Settings.RareAmulets && item.ClassName == "Amulet" && item.ItemLevel <= 74 && item.ItemLevel >= Settings.RareAmuletsilvl)
                    {
                        return(true);
                    }
                    if (Settings.RareBelts && item.ClassName == "Belt" && item.ItemLevel <= 74 && item.ItemLevel >= Settings.RareBeltsilvl)
                    {
                        return(true);
                    }
                    if (Settings.RareGloves && item.ClassName == "Gloves" && item.ItemLevel <= 74 && item.ItemLevel >= Settings.RareGlovesilvl)
                    {
                        return(true);
                    }
                    if (Settings.RareBoots && item.ClassName == "Boots" && item.ItemLevel <= 74 && item.ItemLevel >= Settings.RareBootsilvl)
                    {
                        return(true);
                    }
                    if (Settings.RareHelmets && item.ClassName == "Helmet" && item.ItemLevel <= 74 && item.ItemLevel >= Settings.RareHelmetsilvl)
                    {
                        return(true);
                    }
                    if (Settings.RareArmour && item.ClassName == "Body Armour" && item.ItemLevel <= 74 && item.ItemLevel >= Settings.RareArmourilvl)
                    {
                        return(true);
                    }

                    if (Settings.RareTwoHandedWeapon && item.IsTwoHandedWeapon && item.ItemLevel <= 74 && item.ItemLevel >= Settings.RareTwoHandedWeaponilvl)
                    {
                        return(true);
                    }


                    if (Settings.RareWeapon && item.IsWeapon && item.ItemLevel >= Settings.RareWeaponilvl &&
                        item.Width * item.Height <= Settings.ItemCells)
                    {
                        return(true);
                    }

                    if (Settings.RareWeapon && item.IsWeapon && item.ItemLevel >= Settings.RareWeaponilvl &&
                        item.Width <= Settings.RareWeaponWidth && item.Height <= Settings.RareWeaponHeight)
                    {
                        return(true);
                    }

                    if (Settings.RareShield && item.ClassName == "Shield" && item.ItemLevel >= Settings.RareShieldilvl &&
                        item.Width * item.Height <= Settings.ItemCells)
                    {
                        return(true);
                    }
                }

                #endregion

                #region Sockets/Links/RGB

                if (Settings.Sockets && item.Sockets >= Settings.TotalSockets.Value)
                {
                    return(true);
                }
                if (Settings.Links && item.LargestLink >= Settings.LargestLink)
                {
                    return(true);
                }
                if (Settings.RGB && item.IsRGB)
                {
                    return(true);
                }

                #endregion

                #region Divination Cards

                if (Settings.AllDivs && item.ClassName == "DivinationCard")
                {
                    return(true);
                }

                #endregion

                #region Maps

                if (Settings.Maps && item.MapTier >= Settings.MapTier.Value)
                {
                    return(true);
                }
                if (Settings.Maps && Settings.UniqueMap && item.MapTier >= 1 && item.Rarity == ItemRarity.Unique)
                {
                    return(true);
                }
                if (Settings.Maps && Settings.MapFragments && item.ClassName == "MapFragment")
                {
                    return(true);
                }

                #endregion

                #region Quest Items

                if (Settings.QuestItems && item.ClassName == "QuestItem")
                {
                    return(true);
                }

                #endregion

                #region Skill Gems

                if (Settings.Gems && item.Quality >= Settings.GemQuality.Value && item.ClassName.Contains("Skill Gem"))
                {
                    return(true);
                }

                #endregion

                #region Uniques

                if (Settings.AllUniques && item.Rarity == ItemRarity.Unique)
                {
                    return(true);
                }

                #endregion
            }
            catch (Exception e)
            {
                //LogError($"{nameof(OverrideChecks)} error: {e}");
            }

            return(false);
        }
Exemplo n.º 4
0
        public bool DoWePickThis(CustomItem itemEntity)
        {
            if (!itemEntity.IsValid)
            {
                return(false);
            }

            var pickItemUp = false;


            #region Force Pickup All

            if (Settings.PickUpEverything)
            {
                return(true);
            }

            #endregion

            #region Rarity Rule Switch

            if (CustomRulesExists)
            {
                switch (itemEntity.Rarity)
                {
                case ItemRarity.Normal:
                    if (_normalRules != null)
                    {
                        if (InCustomList(_normalRules, itemEntity, itemEntity.Rarity))
                        {
                            pickItemUp = true;
                        }
                    }

                    break;

                case ItemRarity.Magic:
                    if (_magicRules != null)
                    {
                        if (InCustomList(_magicRules, itemEntity, itemEntity.Rarity))
                        {
                            pickItemUp = true;
                        }
                    }

                    break;

                case ItemRarity.Rare:
                    if (_rareRules != null)
                    {
                        if (InCustomList(_rareRules, itemEntity, itemEntity.Rarity))
                        {
                            pickItemUp = true;
                        }
                    }

                    break;

                case ItemRarity.Unique:
                    if (_uniqueRules != null)
                    {
                        if (InCustomList(_uniqueRules, itemEntity, itemEntity.Rarity))
                        {
                            pickItemUp = true;
                        }
                    }

                    break;
                }
            }

            #endregion

            #region Override Rules

            if (OverrideChecks(itemEntity))
            {
                pickItemUp = true;
            }

            #endregion

            #region Metamorph edit

            if (itemEntity.IsMetaItem)
            {
                pickItemUp = true;
            }

            #endregion

            return(pickItemUp);
        }