private bool TrinitySell(ACDItem item) { CachedACDItem cItem = CachedACDItem.GetCachedItem(item); // Vanity Items if (DataDictionary.VanityItems.Any(i => item.InternalName.StartsWith(i))) { return(false); } switch (cItem.TrinityItemBaseType) { case GItemBaseType.WeaponRange: case GItemBaseType.WeaponOneHand: case GItemBaseType.WeaponTwoHand: case GItemBaseType.Armor: case GItemBaseType.Offhand: case GItemBaseType.Jewelry: case GItemBaseType.FollowerItem: return(true); case GItemBaseType.Gem: case GItemBaseType.Misc: if (cItem.TrinityItemType == GItemType.CraftingPlan) { return(true); } return(false); case GItemBaseType.Unknown: return(false); } return(false); }
internal static void TrinityOnItemSalvaged(object sender, ItemEventArgs e) { ACDItem i = e.Item; var cachedItem = CachedACDItem.GetCachedItem(i); ResetTownRun(); switch (i.ItemBaseType) { case ItemBaseType.Gem: case ItemBaseType.Misc: break; default: TownRun.LogJunkItems(cachedItem, cachedItem.TrinityItemBaseType, cachedItem.TrinityItemType, ItemValuation.ValueThisItem(cachedItem, cachedItem.TrinityItemType)); break; } }
public bool ShouldSellItem(ACDItem item, ItemEvaluationType evaluationType) { ItemEvents.ResetTownRun(); CachedACDItem cItem = CachedACDItem.GetCachedItem(item); if (Current.ItemIsProtected(cItem.AcdItem)) { return(false); } if (Trinity.Settings.Loot.ItemFilterMode == ItemFilterMode.DemonBuddy) { return(Current.ShouldSellItem(item)); } if (Trinity.Settings.Loot.ItemFilterMode == ItemFilterMode.TrinityWithItemRules) { return(ItemRulesSalvageSell(item, evaluationType)); } return(TrinitySell(item)); }
private bool TrinitySalvage(ACDItem item) { CachedACDItem cItem = CachedACDItem.GetCachedItem(item); if (cItem.AcdItem.IsVendorBought) { return(false); } // Vanity Items if (DataDictionary.VanityItems.Any(i => item.InternalName.StartsWith(i))) { return(false); } GItemType trinityItemType = Trinity.DetermineItemType(cItem.InternalName, cItem.DBItemType, cItem.FollowerType); GItemBaseType trinityItemBaseType = Trinity.DetermineBaseType(trinityItemType); // Take Salvage Option corresponding to ItemLevel SalvageOption salvageOption = GetSalvageOption(cItem.Quality); // Stashing Whites if (Trinity.Settings.Loot.TownRun.StashWhites && cItem.Quality < ItemQuality.Magic1) { return(false); } // Stashing Blues if (Trinity.Settings.Loot.TownRun.StashBlues && cItem.Quality > ItemQuality.Superior && cItem.Quality < ItemQuality.Rare4) { return(false); } if (cItem.Quality >= ItemQuality.Legendary && salvageOption == SalvageOption.InfernoOnly && cItem.Level >= 60) { return(true); } switch (trinityItemBaseType) { case GItemBaseType.WeaponRange: case GItemBaseType.WeaponOneHand: case GItemBaseType.WeaponTwoHand: case GItemBaseType.Armor: case GItemBaseType.Offhand: return((cItem.Level >= 61 && salvageOption == SalvageOption.InfernoOnly) || salvageOption == SalvageOption.All); case GItemBaseType.Jewelry: return((cItem.Level >= 59 && salvageOption == SalvageOption.InfernoOnly) || salvageOption == SalvageOption.All); case GItemBaseType.FollowerItem: return((cItem.Level >= 60 && salvageOption == SalvageOption.InfernoOnly) || salvageOption == SalvageOption.All); case GItemBaseType.Gem: case GItemBaseType.Misc: case GItemBaseType.Unknown: return(false); default: return(false); } }
public bool ShouldStashItem(ACDItem item, ItemEvaluationType evaluationType) { ItemEvents.ResetTownRun(); if (Current.ItemIsProtected(item)) { return(false); } // Vanity Items if (DataDictionary.VanityItems.Any(i => item.InternalName.StartsWith(i))) { return(false); } if (Trinity.Settings.Loot.ItemFilterMode == ItemFilterMode.DemonBuddy) { return(ItemManager.Current.ShouldStashItem(item)); } CachedACDItem cItem = CachedACDItem.GetCachedItem(item); // Now look for Misc items we might want to keep GItemType tItemType = cItem.TrinityItemType; // DetermineItemType(cItem.InternalName, cItem.DBItemType, cItem.FollowerType); GItemBaseType tBaseType = cItem.TrinityItemBaseType; // DetermineBaseType(trinityItemType); bool isEquipment = (tBaseType == GItemBaseType.Armor || tBaseType == GItemBaseType.Jewelry || tBaseType == GItemBaseType.Offhand || tBaseType == GItemBaseType.WeaponOneHand || tBaseType == GItemBaseType.WeaponRange || tBaseType == GItemBaseType.WeaponTwoHand); if (cItem.TrinityItemType == GItemType.HoradricCache && Trinity.Settings.Loot.TownRun.OpenHoradricCaches) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] = (ignoring Horadric Cache)", cItem.RealName, cItem.InternalName); return(false); } // Stash all unidentified items - assume we want to keep them since we are using an identifier over-ride if (cItem.IsUnidentified) { if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] = (autokeep unidentified items)", cItem.RealName, cItem.InternalName); } return(true); } if (tItemType == GItemType.StaffOfHerding) { if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.ItemValuation, "{0} [{1}] [{2}] = (autokeep staff of herding)", cItem.RealName, cItem.InternalName, tItemType); } return(true); } if (tItemType == GItemType.CraftingMaterial) { if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.ItemValuation, "{0} [{1}] [{2}] = (autokeep craft materials)", cItem.RealName, cItem.InternalName, tItemType); } return(true); } if (tItemType == GItemType.Emerald || tItemType == GItemType.Amethyst || tItemType == GItemType.Topaz || tItemType == GItemType.Ruby || tItemType == GItemType.Diamond) { if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.ItemValuation, "{0} [{1}] [{2}] = (autokeep gems)", cItem.RealName, cItem.InternalName, tItemType); } return(true); } if (tItemType == GItemType.CraftTome) { if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.ItemValuation, "{0} [{1}] [{2}] = (autokeep tomes)", cItem.RealName, cItem.InternalName, tItemType); } return(true); } if (tItemType == GItemType.InfernalKey) { if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] [{2}] = (autokeep infernal key)", cItem.RealName, cItem.InternalName, tItemType); } return(true); } if (tItemType == GItemType.HealthPotion) { if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.ItemValuation, "{0} [{1}] [{2}] = (ignoring potions)", cItem.RealName, cItem.InternalName, tItemType); } return(false); } if (tItemType == GItemType.CraftingPlan && cItem.Quality >= ItemQuality.Legendary) { if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] [{2}] = (autokeep legendary plans)", cItem.RealName, cItem.InternalName, tItemType); } return(true); } if (Trinity.Settings.Loot.ItemFilterMode == ItemFilterMode.TrinityWithItemRules) { Interpreter.InterpreterAction action = Trinity.StashRule.checkItem(item, evaluationType); if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] [{2}] = (" + action + ")", cItem.AcdItem.Name, cItem.AcdItem.InternalName, cItem.AcdItem.ItemType); } switch (action) { case Interpreter.InterpreterAction.KEEP: return(true); case Interpreter.InterpreterAction.TRASH: return(false); case Interpreter.InterpreterAction.SCORE: break; } } if (tItemType == GItemType.CraftingPlan) { if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] [{2}] = (autokeep plans)", cItem.RealName, cItem.InternalName, tItemType); } return(true); } // Stashing Whites, auto-keep if (Trinity.Settings.Loot.TownRun.StashWhites && isEquipment && cItem.Quality <= ItemQuality.Superior) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] [{2}] = (stashing whites)", cItem.RealName, cItem.InternalName, tItemType); return(true); } // Else auto-trash if (cItem.Quality <= ItemQuality.Superior && (isEquipment || cItem.TrinityItemBaseType == GItemBaseType.FollowerItem)) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] [{2}] = (trash whites)", cItem.RealName, cItem.InternalName, tItemType); return(false); } // Stashing blues, auto-keep if (Trinity.Settings.Loot.TownRun.StashBlues && isEquipment && cItem.Quality >= ItemQuality.Magic1 && cItem.Quality <= ItemQuality.Magic3) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] [{2}] = (stashing blues)", cItem.RealName, cItem.InternalName, tItemType); return(true); } // Else auto trash if (cItem.Quality >= ItemQuality.Magic1 && cItem.Quality <= ItemQuality.Magic3 && (isEquipment || cItem.TrinityItemBaseType == GItemBaseType.FollowerItem)) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] [{2}] = (trashing blues)", cItem.RealName, cItem.InternalName, tItemType); return(false); } // Force salvage Rares if (Trinity.Settings.Loot.TownRun.ForceSalvageRares && cItem.Quality >= ItemQuality.Rare4 && cItem.Quality <= ItemQuality.Rare6 && (isEquipment || cItem.TrinityItemBaseType == GItemBaseType.FollowerItem)) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] [{2}] = (force salvage rare)", cItem.RealName, cItem.InternalName, tItemType); return(false); } if (cItem.Quality >= ItemQuality.Legendary) { if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "{0} [{1}] [{2}] = (autokeep legendaries)", cItem.RealName, cItem.InternalName, tItemType); } return(true); } // Ok now try to do some decent item scoring based on item types double iNeedScore = Trinity.ScoreNeeded(item.ItemBaseType); double iMyScore = ItemValuation.ValueThisItem(cItem, tItemType); if (evaluationType == ItemEvaluationType.Keep) { Logger.Log(TrinityLogLevel.Verbose, LogCategory.ItemValuation, "{0} [{1}] [{2}] = {3}", cItem.RealName, cItem.InternalName, tItemType, iMyScore); } if (iMyScore >= iNeedScore) { return(true); } // If we reached this point, then we found no reason to keep the item! return(false); }