private StashItem ProcessItem(IEntity item) { try { var mods = item?.GetComponent <Mods>(); if (mods?.ItemRarity != ItemRarity.Rare) { return(null); } var bIdentified = mods.Identified; if (bIdentified && !Settings.AllowIdentified) { return(null); } if (mods.ItemLevel < 60) { return(null); } var newItem = new StashItem { BIdentified = bIdentified, LowLvl = mods.ItemLevel < 75 }; var bit = GameController.Files.BaseItemTypes.Translate(item.Path); newItem.ItemClass = bit.ClassName; newItem.ItemName = bit.BaseName; newItem.ItemType = GetStashItemTypeByClassName(newItem.ItemClass); if (newItem.ItemType != StashItemType.Undefined) { return(newItem); } } catch (Exception e) { LogError($"Error 0x01: {e}", 0); return(null); } return(null); }
private StashItem ProcessItem(IEntity item) { try { if (item == null) { return(null); } var mods = item?.GetComponent <Mods>(); if (mods?.ItemRarity != ItemRarity.Rare) { return(null); } var bIdentified = mods.Identified; if (bIdentified && !Settings.AllowIdentified) { return(null); } if (mods.ItemLevel < 60) { return(null); } var newItem = new StashItem { BIdentified = bIdentified, LowLvl = mods.ItemLevel < 75 }; if (string.IsNullOrEmpty(item.Path)) { LogError($"Item metadata is empty. Can be fixed by restarting the game", 10); return(null); } if (Settings.IgnoreElderShaper.Value) { var baseComp = item.GetComponent <Base>(); if (baseComp.isElder || baseComp.isShaper) { return(null); } } var bit = GameController.Files.BaseItemTypes.Translate(item.Path); if (bit == null) { return(null); } newItem.ItemClass = bit.ClassName; newItem.ItemName = bit.BaseName; newItem.ItemType = GetStashItemTypeByClassName(newItem.ItemClass); if (newItem.ItemType != StashItemType.Undefined) { return(newItem); } } catch (Exception e) { LogError($"Error in \"ProcessItem\": {e}", 10); return(null); } return(null); }