public static void ItemListTest() { Core.Logger.Log("Starting ItemList Backpack Test"); var backpackItems = InventoryManager.Backpack as ACDItem[] ?? InventoryManager.Backpack.ToArray(); var total = backpackItems.Count(); var toBeStashed = 0; foreach (var acdItem in backpackItems) { Core.Logger.Log($"{acdItem.Name} ActorSnoId={acdItem.ActorSnoId} GameBalanceId={acdItem.GameBalanceId} ACDId={acdItem.ACDId} AnnId={acdItem.AnnId}"); Core.Logger.Verbose(acdItem.ToString()); if (ItemListEvaluator.ShouldStashItem(acdItem, true)) { toBeStashed++; } } Core.Logger.Log("Finished ItemList Backpack Test"); Core.Logger.Log("Finished - Stash {0} / {1}", toBeStashed, total); }
public bool ShouldStash(TrinityItem item) { if (Core.ProfileSettings.Options.ShouldKeepInBackpack(item.ActorSnoId)) { Core.Logger.Debug($"Profile Setting Keep in Backpack - Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(false); } if (item.IsAncient && Core.Settings.ItemList.AlwaysStashAncients) { Core.Logger.Debug($"Stashing due to ItemList setting - Always stash ancients. (col={item.InventoryColumn}, row={item.InventoryRow}). Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(true); } if (item.IsPrimalAncient && Core.Settings.ItemList.AlwaysStashPrimalAncients) { Core.Logger.Debug($"Stashing due to ItemList setting - Always stash primal ancients. (col={item.InventoryColumn}, row={item.InventoryRow}). Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(true); } // 451002, //sir williams - 451002 (TentacleBear_C_Unique_Cosmetic_02) // portrait - 410998 (Cosmetic_Portrait_Frame_1) if (item.InternalNameLowerCase.Contains("cosmetic")) { return(true); } if (item.IsProtected()) { Core.Logger.Debug($"Not stashing due to item being in a protected slot (col={item.InventoryColumn}, row={item.InventoryRow}). Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(false); } if (Core.Player.IsInventoryLockedForGreaterRift || !Core.Settings.Items.KeepLegendaryUnid && Core.Player.ParticipatingInTieredLootRun) { Core.Logger.Debug($"Not stashing due to inventory locked, keep unidentified setting or participating in loot run. Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(false); } if (item.RawItemType == RawItemType.TreasureBag) { return(Core.Settings.Items.StashTreasureBags); } if (GameData.VanityItems.Any(i => item.InternalName.StartsWith(i))) { return(true); } if (GameData.TransmogTable.Contains(item.GameBalanceId) || item.InternalName.StartsWith("Transmog") || item.ActorSnoId == 110952) //Rakanishu's Blade { var setting = Core.Settings.Items.SpecialItems.HasFlag(SpecialItemTypes.TransmogWhites); Core.Logger.Log($"Transmog found! - Stash Setting={setting} {item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId}"); return(setting); } if (item.RawItemType == RawItemType.CosmeticPet) { Core.Logger.Log($"Pet found! - Stashing it {item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId}"); return(true); } if (item.RawItemType == RawItemType.CosmeticWings) { Core.Logger.Log($"Wings found! - Stashing it {item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId}"); return(true); } if (item.RawItemType == RawItemType.CosmeticPennant) { Core.Logger.Log($"Wings found! - Stashing it {item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId}"); return(true); } if (item.RawItemType == RawItemType.CosmeticPortraitFrame) { Core.Logger.Log($"Portrait found! - Stashing it {item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId}"); return(true); } if (Core.Settings.Items.SpecialItems.HasFlag(SpecialItemTypes.RottenMushroom) && item.ActorSnoId == (int)SNOActor.A1_BlackMushroom) { Core.Logger.Log($"Rotten Mushroom found! - Stash Setting. Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(true); } if (GameData.HerdingMatsSnoIds.Contains(item.ActorSnoId)) { Core.Logger.Log($"Staff of Herding Mat found! - Stash Setting. Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(true); } // Now look for Misc items we might want to keep TrinityItemType tItemType = item.TrinityItemType; TrinityItemBaseType tBaseType = item.TrinityItemBaseType; // Keep any high gems placed in backpack while levelling, so we can socket items with them. if (item.IsGem && item.GemQuality >= GemQuality.Marquise && ZetaDia.Me.Level < 70) { return(false); } var isHandledLegendaryType = item.ItemBaseType == ItemBaseType.Armor || item.ItemBaseType == ItemBaseType.Jewelry || item.ItemBaseType == ItemBaseType.Weapon || item.IsPotion; if (item.ItemQualityLevel >= ItemQuality.Legendary && isHandledLegendaryType) { /* Stash items that hasn't had their legendary power extracted if the CubeExtractOption is set, if we have no currency for extracting it we can assume it would have been salvaged instead. * if (Core.Settings.KanaisCube.ExtractLegendaryPowers != CubeExtractOption.None && !Core.Inventory.Currency.HasCurrency(TransmuteRecipe.ExtractLegendaryPower)) * { * Item legendaryItem = Legendary.GetItem(item); * * if (legendaryItem != null && legendaryItem.LegendaryAffix != "" && * Core.Inventory.Stash.ByActorSno(legendaryItem.Id) != null && * !ZetaDia.Storage.PlayerDataManager.ActivePlayerData.KanaisPowersExtractedActorSnoIds.Contains( * legendaryItem.Id)) * { * Core.Logger.Debug($"Stashing due to legendary power hasn't been extracted yet."); * return true; * } * }*/ if (Core.Settings.Items.LegendaryMode == LegendaryMode.Ignore) { Core.Logger.Log($"TRASHING: Ignore Legendary. Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(false); } if (Core.Settings.Items.LegendaryMode == LegendaryMode.AlwaysStash) { Core.Logger.Log($"STASHING: Always Stash Legendary Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(true); } if (Core.Settings.Items.LegendaryMode == LegendaryMode.StashAncients) { if (item.IsAncient) { Core.Logger.Log($"STASHING: Only Stash Ancients Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(true); } Core.Logger.Log($"TRASHING: Only Stash Ancients Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(false); } if (Core.Settings.ItemList.AlwaysTrashNonAncients && !item.IsAncient) { Core.Logger.Log($"TRASHING: ItemList Option - Always Sell/Salvage Non-Ancients Item={item.Name} InternalName={item.InternalName} Sno={item.ActorSnoId} GbId={item.GameBalanceId} RawItemType={item.RawItemType}"); return(false); } } bool isEquipment = (tBaseType == TrinityItemBaseType.Armor || tBaseType == TrinityItemBaseType.Jewelry || tBaseType == TrinityItemBaseType.Offhand || tBaseType == TrinityItemBaseType.WeaponOneHand || tBaseType == TrinityItemBaseType.WeaponRange || tBaseType == TrinityItemBaseType.WeaponTwoHand); if (item.ItemType == ItemType.KeystoneFragment) { return(true); } if (item.TrinityItemType == TrinityItemType.HoradricCache) { return(false); } if (item.IsUnidentified) { Core.Logger.Log("{0} [{1}] = (autokeep unidentified items)", item.Name, item.InternalName); return(true); } if (tItemType == TrinityItemType.StaffOfHerding) { Core.Logger.Log(LogCategory.ItemValuation, "{0} [{1}] [{2}] = (autokeep staff of herding)", item.Name, item.InternalName, tItemType); return(true); } if (tItemType == TrinityItemType.CraftingMaterial || item.IsCraftingReagent) { Core.Logger.Log(LogCategory.ItemValuation, "{0} [{1}] [{2}] = (autokeep craft materials)", item.Name, item.InternalName, tItemType); return(true); } if (tItemType == TrinityItemType.Emerald || tItemType == TrinityItemType.Amethyst || tItemType == TrinityItemType.Topaz || tItemType == TrinityItemType.Ruby || tItemType == TrinityItemType.Diamond) { Core.Logger.Log(LogCategory.ItemValuation, "{0} [{1}] [{2}] = (autokeep gems)", item.Name, item.InternalName, tItemType); return(true); } if (tItemType == TrinityItemType.CraftTome) { Core.Logger.Log(LogCategory.ItemValuation, "{0} [{1}] [{2}] = (autokeep tomes)", item.Name, item.InternalName, tItemType); return(true); } if (tItemType == TrinityItemType.InfernalKey) { Core.Logger.Log("{0} [{1}] [{2}] = (autokeep infernal key)", item.Name, item.InternalName, tItemType); return(true); } if (tItemType == TrinityItemType.HealthPotion) { var equippedPotion = Core.Player.EquippedHealthPotion; if (equippedPotion == null) { Core.Logger.Debug("Potion being stashed because an equipped potion was not found."); return(true); } if (equippedPotion.AnnId == item.AnnId) { Core.Logger.Debug($"{item.Name} [{item.InternalName}] [{tItemType}] = (dont stash equipped potion)"); return(false); } } if (tItemType == TrinityItemType.CraftingPlan && item.ItemQualityLevel >= ItemQuality.Legendary) { Core.Logger.Log("{0} [{1}] [{2}] = (autokeep legendary plans)", item.Name, item.InternalName, tItemType); return(true); } if (tItemType == TrinityItemType.ConsumableAddSockets) { Core.Logger.Log("{0} [{1}] [{2}] = (autokeep Ramaladni's Gift)", item.Name, item.InternalName, tItemType); return(true); } if (tItemType == TrinityItemType.PortalDevice) { Core.Logger.Log("{0} [{1}] [{2}] = (autokeep Machines)", item.Name, item.InternalName, tItemType); return(true); } if (tItemType == TrinityItemType.UberReagent) { Core.Logger.Log("{0} [{1}] [{2}] = (autokeep Uber Reagents)", item.Name, item.InternalName, tItemType); return(true); } if (tItemType == TrinityItemType.TieredLootrunKey) { Core.Logger.Log("{0} [{1}] [{2}] = (ignoring Tiered Rift Keys)", item.Name, item.InternalName, tItemType); return(false); } if (tItemType == TrinityItemType.CraftingPlan) { Core.Logger.Log("{0} [{1}] [{2}] = (autokeep plans)", item.Name, item.InternalName, tItemType); return(true); } if (item.ItemQualityLevel <= ItemQuality.Superior && (isEquipment || item.TrinityItemBaseType == TrinityItemBaseType.FollowerItem)) { Core.Logger.Log("{0} [{1}] [{2}] = (trash whites)", item.Name, item.InternalName, tItemType); return(false); } if (item.ItemQualityLevel >= ItemQuality.Magic1 && item.ItemQualityLevel <= ItemQuality.Magic3 && (isEquipment || item.TrinityItemBaseType == TrinityItemBaseType.FollowerItem)) { Core.Logger.Log("{0} [{1}] [{2}] = (trashing blues)", item.Name, item.InternalName, tItemType); return(false); } if (item.ItemQualityLevel >= ItemQuality.Rare4 && item.ItemQualityLevel <= ItemQuality.Rare6 && (isEquipment || item.TrinityItemBaseType == TrinityItemBaseType.FollowerItem)) { Core.Logger.Log("{0} [{1}] [{2}] = (force salvage rare)", item.Name, item.InternalName, tItemType); return(false); } if (item.ItemQualityLevel >= ItemQuality.Legendary && Core.Settings.Items.LegendaryMode == LegendaryMode.ItemList && (item.IsEquipment || item.TrinityItemBaseType == TrinityItemBaseType.FollowerItem || item.IsPotion)) { var result = ItemListEvaluator.ShouldStashItem(item); Core.Logger.Log("{0} [{1}] [{2}] = {3}", item.Name, item.InternalName, tItemType, "ItemListCheck=" + (result ? "KEEP" : "TRASH")); return(result); } if (item.ItemQualityLevel >= ItemQuality.Legendary) { Core.Logger.Log("{0} [{1}] [{2}] = (autokeep legendaries)", item.Name, item.InternalName, tItemType); return(true); } // If we reached this point, then we found no reason to keep the item! return(false); }