public bool InCustomList(HashSet <string> checkList, CustomItem itemEntity, ItemRarity rarity) { if (checkList.Contains(itemEntity.BaseName) && !_ignoreRules.Contains(itemEntity.BaseName) && itemEntity.Rarity == rarity) { return(true); } if (checkList.Contains(itemEntity.ClassName) && !_ignoreRules.Contains(itemEntity.ClassName) && itemEntity.Rarity == rarity) { return(true); } return(false); }
/* Container.FindSpot(item) * Finds a spot available in the buffer to place the item. */ public static Vector2 FindSpotInventory(CustomItem item) { var location = new Vector2(-1, -1); var InventorySlots = PickIt.Controller.inventorySlots; var inventoryItems = PickIt.Controller.InventoryItems.InventorySlotItems; var width = 12; var height = 5; if (InventorySlots == null) { return(location); } for (var yCol = 0; yCol < height - (item.Height - 1); yCol++) { for (var xRow = 0; xRow < width - (item.Width - 1); xRow++) { var success = 0; for (var xWidth = 0; xWidth < item.Width; xWidth++) { for (var yHeight = 0; yHeight < item.Height; yHeight++) { if (InventorySlots[yCol + yHeight, xRow + xWidth] == 0) { success++; } else if (inventoryItems.Any(x => x.PosX == xRow && x.PosY == yCol && CanItemBeStacked(item, x) == StackableItem.Can)) { success++; } } } if (success >= item.Height * item.Width) { return(new Vector2(xRow, yCol)); } } } return(location); }
public static bool CanFitInventory(CustomItem groundItem) { return(FindSpotInventory(groundItem) != new Vector2(-1, -1)); }
private IEnumerator TryToPickV2(CustomItem pickItItem) { if (!pickItItem.IsValid && !pickItItem.IsMetamorphBodyPart) { _fullWork = true; LogMessage("PickItem is not valid.", 5, Color.Red); yield break; } var centerOfItemLabel = pickItItem.LabelOnGround.Label.GetClientRectCache.Center; var rectangleOfGameWindow = GameController.Window.GetWindowRectangleTimeCache; var oldMousePosition = Mouse.GetCursorPositionVector(); _clickWindowOffset = rectangleOfGameWindow.TopLeft; centerOfItemLabel.X += rectangleOfGameWindow.Left; centerOfItemLabel.Y += rectangleOfGameWindow.Top; rectangleOfGameWindow.Inflate(-155, -100); rectangleOfGameWindow.Height -= 50; if (!rectangleOfGameWindow.Contains(centerOfItemLabel)) { _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 (GameController.Game.IngameState.IngameUi.ItemsOnGroundLabels.FirstOrDefault( x => x.Address == pickItItem.LabelOnGround.Address) != null && tryCount < 6) { tryCount++; yield return(_waitForNextTry); } yield return(_waitForNextTry); // Mouse.MoveCursorToPosition(oldMousePosition); }
public bool DoWePickThis(CustomItem itemEntity) { 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 return(pickItemUp); }
public bool OverrideChecks(CustomItem item) { try { #region Metamorph Body Parts if (Settings.MetamorphBodyParts && (item.IsMetamorphBodyPart || item.ClassName.EndsWith("MetamorphosisDNA"))) { return(true); } #endregion #region Currency if (Settings.AllCurrency && item.ClassName.EndsWith("Currency")) { return(!_ignoredCurrency.Contains(item.BaseName)); } #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.Rares && item.Rarity == ItemRarity.Rare) { if (Settings.RareJewels && (item.ClassName == "Jewel" || item.ClassName == "AbyssJewel")) { return(true); } if (Settings.RareRings && item.ClassName == "Ring" && item.ItemLevel >= Settings.RareRingsilvl) { return(true); } if (Settings.RareAmulets && item.ClassName == "Amulet" && item.ItemLevel >= Settings.RareAmuletsilvl) { return(true); } if (Settings.RareBelts && item.ClassName == "Belt" && item.ItemLevel >= Settings.RareBeltsilvl) { return(true); } if (Settings.RareGloves && item.ClassName == "Gloves" && item.ItemLevel >= Settings.RareGlovesilvl) { return(true); } if (Settings.RareBoots && item.ClassName == "Boots" && item.ItemLevel >= Settings.RareBootsilvl) { return(true); } if (Settings.RareHelmets && item.ClassName == "Helmet" && item.ItemLevel >= Settings.RareHelmetsilvl) { return(true); } if (Settings.RareArmour && item.ClassName == "Body Armour" && item.ItemLevel >= Settings.RareArmourilvl) { 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); }
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 = GameController.Window.GetWindowRectangleTimeCache; var oldMousePosition = Mouse.GetCursorPositionVector(); _clickWindowOffset = rectangleOfGameWindow.TopLeft; rectangleOfGameWindow.Inflate(-36, -36); 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 (tryCount < 3) { 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; if (!rectangleOfGameWindow.Intersects(new RectangleF(vector2.X, vector2.Y, 3, 3))) { FullWork = true; //LogMessage($"x,y outside game window. Label: {centerOfItemLabel} Window: {rectangleOfGameWindow}", 5, Color.Red); yield break; } Mouse.MoveCursorToPosition(vector2); yield return(wait2ms); if (pickItItem.IsTargeted()) { yield return(Mouse.LeftClick()); } yield return(toPick); tryCount++; } tryCount = 0; while (GameController.Game.IngameState.IngameUi.ItemsOnGroundLabelsVisible.FirstOrDefault( x => x.Address == pickItItem.LabelOnGround.Address) != null && tryCount < 6) { tryCount++; //yield return waitForNextTry; } //yield return waitForNextTry; // Mouse.MoveCursorToPosition(oldMousePosition); }
public bool OverrideChecks(CustomItem item) { try { if (_ignoreRules.Contains(item.BaseName) || _ignoreRules.Contains(item.ClassName)) { return(false); } #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 if (Settings.HeistItems) { if (item.IsHeist) { return(true); } } #region Influenced if (Settings.HunterItems) { if (item.IsHunter) { return(true); } } if (Settings.RedeemerItems) { if (item.IsRedeemer) { return(true); } } if (Settings.CrusaderItems) { if (item.IsCrusader) { return(true); } } if (Settings.WarlordItems) { if (item.IsWarlord) { return(true); } } if (Settings.VeiledItems) { if (item.IsVeiled) { return(true); } } #endregion #region Rare Overrides if (Settings.Rares && item.Rarity == ItemRarity.Rare) { var setData = FullRareSetManagerData; var maxSetWanted = setData.WantedSets; var maxPickupOverides = Settings.FullRareSetManagerPickupOverrides; if (Settings.FullRareSetManagerOverride.Value && (maxPickupOverides.MinItemLevel > -1 ? item.ItemLevel >= maxPickupOverides.MinItemLevel : item.ItemLevel >= 60) && (maxPickupOverides.MaxItemLevel > -1 ? item.ItemLevel <= maxPickupOverides.MaxItemLevel : item.ItemLevel <= 74)) { if (item.IsIdentified && !Settings.FullRareSetManagerOverrideAllowIdentifiedItems.Value) { return(false); } if (Settings.RareRings && item.ClassName == "Ring" && setData.GatheredRings < (maxPickupOverides.Rings > -1 ? maxPickupOverides.Rings : maxSetWanted)) { return(true); } if (Settings.RareAmulets && item.ClassName == "Amulet" && setData.GatheredAmulets < (maxPickupOverides.Amulets > -1 ? maxPickupOverides.Amulets : maxSetWanted)) { return(true); } if (Settings.RareBelts && item.ClassName == "Belt" && setData.GatheredBelts < (maxPickupOverides.Belts > -1 ? maxPickupOverides.Belts : maxSetWanted)) { return(true); } if (Settings.RareGloves && item.ClassName == "Gloves" && setData.GatheredGloves < (maxPickupOverides.Gloves > -1 ? maxPickupOverides.Gloves : maxSetWanted)) { return(true); } if (Settings.RareBoots && item.ClassName == "Boots" && setData.GatheredBoots < (maxPickupOverides.Boots > -1 ? maxPickupOverides.Boots : maxSetWanted)) { return(true); } if (Settings.RareHelmets && item.ClassName == "Helmet" && setData.GatheredHelmets < (maxPickupOverides.Helmets > -1 ? maxPickupOverides.Helmets : maxSetWanted)) { return(true); } if (Settings.RareArmour && item.ClassName == "Body Armour" && setData.GatheredBodyArmors < (maxPickupOverides.BodyArmors > -1 ? maxPickupOverides.BodyArmors : maxSetWanted)) { return(true); } if (Settings.RareWeapon && item.IsWeapon && setData.GatheredWeapons < (maxPickupOverides.Weapons > -1 ? maxPickupOverides.Weapons : maxSetWanted)) { if (item.Width <= Settings.RareWeaponWidth && item.Height <= Settings.RareWeaponHeight) { return(true); } } } else { if (Settings.RareRings && item.ClassName == "Ring" && item.ItemLevel >= Settings.RareRingsilvl) { return(true); } if (Settings.RareAmulets && item.ClassName == "Amulet" && item.ItemLevel >= Settings.RareAmuletsilvl) { return(true); } if (Settings.RareBelts && item.ClassName == "Belt" && item.ItemLevel >= Settings.RareBeltsilvl) { return(true); } if (Settings.RareGloves && item.ClassName == "Gloves" && item.ItemLevel >= Settings.RareGlovesilvl) { return(true); } if (Settings.RareBoots && item.ClassName == "Boots" && item.ItemLevel >= Settings.RareBootsilvl) { return(true); } if (Settings.RareHelmets && item.ClassName == "Helmet" && item.ItemLevel >= Settings.RareHelmetsilvl) { return(true); } if (Settings.RareArmour && item.ClassName == "Body Armour" && item.ItemLevel >= Settings.RareArmourilvl) { return(true); } if (Settings.RareWeapon && item.IsWeapon && item.ItemLevel >= Settings.RareWeaponilvl) { if (item.Width <= Settings.RareWeaponWidth && item.Height <= Settings.RareWeaponHeight) { return(true); } } } if (Settings.RareShield && item.ClassName == "Shield" && item.ItemLevel >= Settings.RareShieldilvl) { if (item.Width <= Settings.RareShieldWidth && item.Height <= Settings.RareShieldHeight) { return(true); } } if (Settings.RareJewels && (item.ClassName == "Jewel" || item.ClassName == "AbyssJewel")) { 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 && item.Width <= Settings.RGBWidth && item.Height <= Settings.RGBHeight) { 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 Qualiity Rules if (Settings.Gems && item.Quality >= Settings.GemQuality.Value && item.ClassName.Contains("Skill Gem")) { return(true); } if (Settings.Flasks && item.Quality >= Settings.FlasksQuality.Value && item.ClassName.Contains("Flask")) { return(true); } #endregion #region Uniques if (Settings.AllUniques && item.Rarity == ItemRarity.Unique) { return(true); } #endregion #region Custom Rules if (item.BaseName.Contains("Watchstone")) { return(true); } if (item.BaseName.Contains("Incubator")) { return(true); } if (item.BaseName.Contains(" Seed")) { return(true); } if (item.BaseName.Contains(" Grain")) { return(true); } if (item.BaseName.Contains(" Bulb")) { return(true); } #endregion } catch (Exception e) { LogError($"{nameof(OverrideChecks)} error: {e}"); } return(false); }
private IEnumerator TryToPickV2(CustomItem pickItItem, LabelOnGround portalLabel) { if (!pickItItem.IsValid) { _fullWork = true; //LogMessage("PickItem is not valid.", 5, Color.Red); yield break; } var centerOfItemLabel = pickItItem.LabelOnGround.Label.GetClientRectCache.Center; var rectangleOfGameWindow = GameController.Window.GetWindowRectangleTimeCache; _clickWindowOffset = rectangleOfGameWindow.TopLeft; rectangleOfGameWindow.Inflate(-36, -36); 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 (tryCount < 3) { 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; } Vector2 vector2; if (IsPortalNearby(portalLabel, pickItItem.LabelOnGround)) { vector2 = completeItemLabel.GetClientRect().ClickRandom() + _clickWindowOffset; } else { vector2 = completeItemLabel.GetClientRect().Center + _clickWindowOffset; } if (!rectangleOfGameWindow.Intersects(new RectangleF(vector2.X, vector2.Y, 3, 3))) { _fullWork = true; //LogMessage($"x,y outside game window. Label: {centerOfItemLabel} Window: {rectangleOfGameWindow}", 5, Color.Red); yield break; } Input.SetCursorPos(vector2); yield return(_wait2Ms); if (pickItItem.IsTargeted()) { // in case of portal nearby do extra checks with delays if (IsPortalNearby(portalLabel, pickItItem.LabelOnGround) && !IsPortalTargeted(portalLabel)) { yield return(new WaitTime(25)); if (IsPortalNearby(portalLabel, pickItItem.LabelOnGround) && !IsPortalTargeted(portalLabel)) { Input.Click(MouseButtons.Left); } } else if (!IsPortalNearby(portalLabel, pickItItem.LabelOnGround)) { Input.Click(MouseButtons.Left); } } yield return(_toPick); tryCount++; } tryCount = 0; while (GameController.Game.IngameState.IngameUi.ItemsOnGroundLabelsVisible.FirstOrDefault( x => x.Address == pickItItem.LabelOnGround.Address) != null && tryCount < 6) { tryCount++; } }
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 Influenced if (Settings.HunterItems) { if (item.IsHunter) { return(true); } } if (Settings.RedeemerItems) { if (item.IsRedeemer) { return(true); } } if (Settings.CrusaderItems) { if (item.IsCrusader) { return(true); } } if (Settings.WarlordItems) { if (item.IsWarlord) { return(true); } } #endregion #region Rare Overrides 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 >= Settings.RareRingsilvl) { return(true); } if (Settings.RareAmulets && item.ClassName == "Amulet" && item.ItemLevel >= Settings.RareAmuletsilvl) { return(true); } if (Settings.RareBelts && item.ClassName == "Belt" && item.ItemLevel >= Settings.RareBeltsilvl) { return(true); } if (Settings.RareGloves && item.ClassName == "Gloves" && item.ItemLevel >= Settings.RareGlovesilvl) { return(true); } if (Settings.RareBoots && item.ClassName == "Boots" && item.ItemLevel >= Settings.RareBootsilvl) { return(true); } if (Settings.RareHelmets && item.ClassName == "Helmet" && item.ItemLevel >= Settings.RareHelmetsilvl) { return(true); } if (Settings.RareArmour && item.ClassName == "Body Armour" && item.ItemLevel >= Settings.RareArmourilvl) { 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); }