public static List <ActorCommonData> Get_RareUpgradableItems() { List <ActorCommonData> Items = new List <ActorCommonData>(); try { var inventory = ActorCommonDataHelper.EnumerateInventoryItems(); foreach (var item in inventory) { var quality = item.GetAttributeValue(AttributeId.ItemQualityLevel); if (quality >= 6 && quality <= 8) //Rare { Items.Add(item); } } return(Items); } catch (Exception) { return(Items); } }
private static bool tryCheckInventoryFull() { try { var inventoryItems = ActorCommonDataHelper.EnumerateInventoryItems(); if (inventoryItems.Count() <= 20) { return(false); } string error_notification_uielement = "Root.TopLayer.error_notify.error_text"; //string inventory_full_text = "Not enough Inventory space to complete this operation."; string item_canot_be_picked = "That item cannot be picked up."; var errortext = UXHelper.GetControl <UXLabel>(error_notification_uielement); if (errortext.xA20_Text_StructStart_Min84Bytes == item_canot_be_picked && errortext.IsVisible()) { return(true); } return(false); } catch { return(true); } }
public static void UpdateSwapItems() { try { if (A_Collection.Me.HeroStates.isInGame && A_Collection.D3UI.isOpenInventory) { List <GearSwapItem> GearSwaps; lock (A_Collection.Me.GearSwap.GearSwaps) GearSwaps = A_Collection.Me.GearSwap.GearSwaps.ToList(); bool CollectionChanged = false; var HeroId = A_Collection.Me.HeroGlobals.HeroID; var CurrentSwaps = GearSwaps.Where(x => x.HeroID == HeroId).ToList(); List <GearSwapItem> Buffer = new List <GearSwapItem>(); if (CurrentSwaps.Count() > 0) { var InventoryItems = ActorCommonDataHelper.EnumerateInventoryItems(); foreach (var Item in CurrentSwaps) { var tryGetEntry = InventoryItems.FirstOrDefault( x => x.GetAttributeValue(Enigma.D3.Enums.AttributeId.Seed) == Item.ItemSeed); if (tryGetEntry != null) { Buffer.Add(new GearSwapItem(HeroId, Item.SwapId, Item.ItemSeed, tryGetEntry.x118_ItemSlotX, tryGetEntry.x11C_ItemSlotY, Item.ItemSize)); if (Item.ItemSlotX != tryGetEntry.x118_ItemSlotX || Item.ItemSlotY != tryGetEntry.x11C_ItemSlotY) { CollectionChanged = true; } } else { CollectionChanged = true; } } if (CollectionChanged) { A_Collection.Me.GearSwap.GearSwaps = Buffer; A_Tools.T_ExternalFile.GearSwaps.Save(); } } } } catch { } }
public static double Get_AvailableMaterial_Convert(string inputQuality, out List <ActorCommonData> Materials) { Materials = new List <ActorCommonData>(); try { int ConvertMaterialCost = 100; int ConvertMaterialDBCost = 1; int CountMaterial = 0; var inventory = ActorCommonDataHelper.EnumerateInventoryItems().ToList(); ActorCommonData acd; switch (inputQuality) { case "normal": CountMaterial = GetMaterial_ReusableParts(inventory, out acd); Materials.Add(acd); break; case "magic": CountMaterial = GetMaterial_ArcaneDust(inventory, out acd); Materials.Add(acd); break; case "rare": CountMaterial = GetMaterial_VeiledCrystal(inventory, out acd); Materials.Add(acd); break; } int Count_DB = GetMaterial_DeathBreath(inventory, out acd); Materials.Add(acd); double Enchants_DB = Count_DB / ConvertMaterialDBCost; double Enchants = CountMaterial / ConvertMaterialCost; double[] x = new[] { Enchants_DB, Enchants }; double possibleEnchants = x.OrderBy(y => y).First(); return(Enchants); } catch (Exception) { return(0); } }
public static List <double> GetInventoryChanges() { try { List <double> Changes_Seeds = new List <double>(); bool InventoryChanged = false; List <ActorCommonData> Inventory_Buffer = ActorCommonDataHelper.EnumerateInventoryItems().ToList(); while (true) { var Inventory = ActorCommonDataHelper.EnumerateInventoryItems().ToList(); foreach (var item in Inventory) { var tryGetEntry = Inventory_Buffer.FirstOrDefault(x => x.x000_Id == item.x000_Id); if (tryGetEntry == null) { InventoryChanged = true; Changes_Seeds.Add(item.GetAttributeValue(Enigma.D3.Enums.AttributeId.Seed)); } } if (InventoryChanged) { break; } Inventory_Buffer = Inventory; Thread.Sleep(50); } return(Changes_Seeds); } catch { return(new List <double>()); } }
private static int[] Costs_UpgradeRare = new int[] { 25, 50, 50, 50 }; // Deaths Breath | Reusable Parts | Arcane Dust | Veiled Crystal public static double Get_AvailableEnchants_UpgradeRare(out List <ActorCommonData> Materials) { Materials = new List <ActorCommonData>(); try { var inventory = ActorCommonDataHelper.EnumerateInventoryItems().ToList(); ActorCommonData acd; int Count_DB = GetMaterial_DeathBreath(inventory, out acd); Materials.Add(acd); int Count_RP = GetMaterial_ReusableParts(inventory, out acd); Materials.Add(acd); int Count_AD = GetMaterial_ArcaneDust(inventory, out acd); Materials.Add(acd); int Count_VC = GetMaterial_VeiledCrystal(inventory, out acd); Materials.Add(acd); double Enchants_DB = Count_DB / Costs_UpgradeRare[0]; double Enchants_RP = Count_RP / Costs_UpgradeRare[1]; double Enchants_AD = Count_AD / Costs_UpgradeRare[2]; double Enchants_VC = Count_VC / Costs_UpgradeRare[3]; double[] x = new[] { Enchants_DB, Enchants_RP, Enchants_AD, Enchants_VC }; double possibleEnchants = x.OrderBy(y => y).First(); return(possibleEnchants); } catch (Exception) { return(0); } }
public static List <ActorCommonData> Get_Items(string inputQuality) { int QualityRange1 = 0; int QualityRange2 = 0; bool ancient = false; bool primal = false; List <ActorCommonData> Items = new List <ActorCommonData>(); switch (inputQuality) { case "normal": QualityRange1 = 0; QualityRange2 = 2; break; case "magic": QualityRange1 = 3; QualityRange2 = 5; break; case "rare": QualityRange1 = 6; QualityRange2 = 8; break; case "legendary": QualityRange1 = 9; QualityRange2 = 9; break; case "ancient": QualityRange1 = 9; QualityRange2 = 9; ancient = true; break; case "primal": QualityRange1 = 9; QualityRange2 = 9; primal = true; break; } try { var inventory = ActorCommonDataHelper.EnumerateInventoryItems(); foreach (var item in inventory) { // Ignore these materials (these have "normal" quality) switch (item.x090_ActorSnoId) { case 361988: //Crafting_Legendary_05 case 361989: //Crafting_Looted_Reagent_05 case 361986: //Crafting_Rare_05 case 361985: //Crafting_Magic_05 case 361984: //Crafting_AssortedParts_05 case 137958: //CraftingMaterials_Flippy_Global case 365020: //CraftingReagent_Legendary_Set_Borns_X1 case 364281: //CraftingReagent_Legendary_Set_Cains_X1 case 364290: //CraftingReagent_Legendary_Set_Demon_X1 case 364305: //CraftingReagent_Legendary_Set_Hallowed_X1 case 364975: //CraftingReagent_Legendary_Set_CaptainCrimsons_X1 case 364725: //DemonOrgan_Diablo_x1 case 364723: //DemonOrgan_Ghom_x1 case 364724: //DemonOrgan_SiegeBreaker_x1 case 364722: //DemonOrgan_SkeletonKing_x1 case 366949: //InfernalMachine_Diablo_x1 case 366947: //InfernalMachine_Ghom_x1 case 366948: //InfernalMachine_SiegeBreaker_x1 case 366946: //InfernalMachine_SkeletonKing_x1 case 359504: //HoradricRelic case 437414: //Amethyst_15 Marquise Amethyst case 437415: //Amethyst_16 Imperial Amethyst case 437459: //Ruby_15 Marquise Ruby case 437460: //Ruby_16 Imperial Ruby case 437481: //x1_Diamond_06 Marquise Diamond case 437482: //x1_Diamond_07 Imperial Diamond case 437448: //x1_Emerald_06 Marquise Emerald case 437449: //x1_Emerald_07 Imperial Emerald case 437469: //x1_Topaz_06 Marquise Topaz case 437470: //x1_Topaz_07 Imperial Topaz break; default: var name = item.x004_Name; // not needed but nice for debug var quality = item.GetAttributeValue(AttributeId.ItemQualityLevel); if (quality >= QualityRange1 && quality <= QualityRange2) // Magic { if (ancient) { var ancientRank = item.GetAttributeValue(AttributeId.AncientRank); if (ancientRank == 1) { Items.Add(item); } } else if (primal) { var ancientRank = item.GetAttributeValue(AttributeId.AncientRank); if (ancientRank == 2) { Items.Add(item); } } else { Items.Add(item); } } break; } } return(Items); } catch (Exception) { return(Items); } }
private static A_Enums.ItemTypes GetItemTypeByItemSeed(double ItemSeed) { try { var InventoryItems = ActorCommonDataHelper.EnumerateInventoryItems(); string ItemName = InventoryItems.FirstOrDefault(x => x.GetAttributeValue(Enigma.D3.Enums.AttributeId.Seed) == ItemSeed).x004_Name.ToLower(); if (ItemName.Contains("x1_")) { ItemName = ItemName.TrimStart('x', '1', '_'); } if (ItemName.Contains("p2_")) { ItemName = ItemName.TrimStart('p', '2', '_'); } // 1HWeapons if (ItemName.StartsWith("sword")) { return(A_Enums.ItemTypes._1HWeapon); } if (ItemName.StartsWith("axe")) { return(A_Enums.ItemTypes._1HWeapon); } if (ItemName.StartsWith("dagger")) { return(A_Enums.ItemTypes._1HWeapon); } if (ItemName.StartsWith("wand")) { return(A_Enums.ItemTypes._1HWeapon); } if (ItemName.StartsWith("ceremonial")) { return(A_Enums.ItemTypes._1HWeapon); } if (ItemName.StartsWith("fistweapon")) { return(A_Enums.ItemTypes._1HWeapon); } if (ItemName.StartsWith("handxbow")) { return(A_Enums.ItemTypes._1HWeapon); } if (ItemName.StartsWith("mace")) { return(A_Enums.ItemTypes._1HWeapon); } if (ItemName.StartsWith("mightyweapon")) { return(A_Enums.ItemTypes._1HWeapon); } // Ring if (ItemName.StartsWith("ring")) { return(A_Enums.ItemTypes.Ring); } // Amulet if (ItemName.StartsWith("amulet")) { return(A_Enums.ItemTypes.Amulet); } return(A_Enums.ItemTypes.Armor); } catch { return(A_Enums.ItemTypes.Other); } }
private static ActorCommonData GetSelectedItemAcd(int AcdId) { var InventoryItemContainer = ActorCommonDataHelper.EnumerateInventoryItems(); return(InventoryItemContainer.FirstOrDefault(x => x.x000_Id == AcdId)); }
public static void tryGearSwap() { try { isSwaping = true; bool CollectionChanged = false; // Save Current Cursor Pos Point getCursorPos = new Point((int)Cursor.Position.X, (int)Cursor.Position.Y); // Get Current Pressed SwapHotkey Id int Current_SwapId = A_Collection.Me.GearSwap.Selected_SwapId; long HeroId = A_Collection.Me.HeroGlobals.HeroID; // Get Collection of Items to Swap lock (A_Collection.Me.GearSwap.GearSwaps) { var GearSwap = A_Collection.Me.GearSwap.GearSwaps.ToList().Where(x => x.HeroID == HeroId && x.SwapId == Current_SwapId).ToList(); if (GearSwap.Count() > 0) { // Check If Inventory is opened otherwise Open it if (InventoryOpened()) { int _Ring_Counter = 0; int _1HWeapon_Counter = 0; for (int i = 0; i < GearSwap.Count(); i++) { // Get ItemType A_Enums.ItemTypes ItemType = GetItemTypeByItemSeed(GearSwap[i].ItemSeed); if (ItemType == A_Enums.ItemTypes.Ring) { _Ring_Counter = _Ring_Counter + 1; } if (ItemType == A_Enums.ItemTypes._1HWeapon) { _1HWeapon_Counter = _1HWeapon_Counter + 1; } // Get UIRect of current Item to Swap UIRect ItemUIRect = A_Collection.D3UI.InventoryItemUIRectMesh.FirstOrDefault(x => x.Key.ItemSlotX == GearSwap[i].ItemSlotX && x.Key.ItemSlotY == GearSwap[i].ItemSlotY).Value; // Buffer Current Equipped Items before Swaping Item var Inventory_Buffer = ActorCommonDataHelper.EnumerateInventoryItems(); List <double> Pre_Inventory_Seeds = new List <double>(); foreach (var Item in Inventory_Buffer) { double Seed = Item.GetAttributeValue(Enigma.D3.Enums.AttributeId.Seed); Pre_Inventory_Seeds.Add(Seed); } // Right Click on Random Point in Items UIRect bool IsAltSwap = false; if (ItemType == A_Enums.ItemTypes._1HWeapon && _1HWeapon_Counter >= 2) { IsAltSwap = true; InputSimulator.SimulateKeyDown(VirtualKeyCode.LMENU); } if (ItemType == A_Enums.ItemTypes.Ring && _Ring_Counter >= 2) { IsAltSwap = true; InputSimulator.SimulateKeyDown(VirtualKeyCode.LMENU); } while (!IsItemSeedEquipped(GearSwap[i].ItemSeed) && A_Tools.T_D3UI.UIElement.isVisible(A_Enums.UIElements.Inventory)) { A_Tools.InputSimulator.IS_Mouse.RightCLick((int)ItemUIRect.Left, (int)ItemUIRect.Top, (int)ItemUIRect.Right, (int)ItemUIRect.Bottom); Thread.Sleep(250); } if (IsAltSwap) { InputSimulator.SimulateKeyUp(VirtualKeyCode.LMENU); } // Equipped Items after Swaping var Inventory = ActorCommonDataHelper.EnumerateInventoryItems(); List <double> Cur_Inventory_Seeds = new List <double>(); foreach (var Item in Inventory) { double Seed = Item.GetAttributeValue(Enigma.D3.Enums.AttributeId.Seed); Cur_Inventory_Seeds.Add(Seed); } // Diff Equipped and Equipped_Buffer and add Swapped Item(s) to GearSwap foreach (var seed in Pre_Inventory_Seeds) { if (!Cur_Inventory_Seeds.Contains(seed)) { //Console.WriteLine("Inventory Items changed! Item removed!"); var TryGetEntry = A_Collection.Me.GearSwap.GearSwaps.FirstOrDefault(x => x.HeroID == HeroId && x.SwapId == Current_SwapId && x.ItemSeed == seed); if (TryGetEntry != null) { A_Collection.Me.GearSwap.GearSwaps.Remove(TryGetEntry); CollectionChanged = true; } } } foreach (var seed in Cur_Inventory_Seeds) { if (!Pre_Inventory_Seeds.Contains(seed)) { //Console.WriteLine("Inventory Items changed! Item added!"); var TryGetEntry = A_Collection.Me.GearSwap.GearSwaps.FirstOrDefault(x => x.HeroID == HeroId && x.SwapId == Current_SwapId && x.ItemSeed == seed); if (TryGetEntry == null) { var item = Inventory.FirstOrDefault( x => x.GetAttributeValue(AttributeId.Seed) == seed); A_Collection.Me.GearSwap.GearSwaps.Add(new GearSwapItem(HeroId, Current_SwapId, seed, item.x118_ItemSlotX, item.x11C_ItemSlotY, GearSwap[i].ItemSize)); CollectionChanged = true; } } } if (CollectionChanged) { A_Tools.T_ExternalFile.GearSwaps.Save(); } } } } // Close Inventory CloseInventory(); // Restore Cursor Pos to previous Pos Cursor.Position = getCursorPos; isSwaping = false; } } catch { isSwaping = false; } }