public CacheACDItem(ACDItem item) { ACDItem = item; SNO = item.ActorSNO; ThisInternalName = item.InternalName; try { _thisLevel = item.Level; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item level for {0} \r\n {1}", SimpleDebugString, ex.Message); } ItemDataEntry itemEntry; if (TheCache.ObjectIDCache.ItemDataEntries.TryGetValue(SNO, out itemEntry)) { ItemType = itemEntry.ItemType; ThisDBItemType = ItemFunc.PluginItemTypeToDBItemType(ItemType); ThisFollowerType = ItemFunc.ReturnFollowerType(ItemType); LegendaryItemType = itemEntry.LegendaryType; } else { ThisFollowerType = item.FollowerSpecialType; ThisDBItemType = item.ItemType; ItemType = ItemFunc.DetermineItemType(ThisInternalName, ThisDBItemType, ThisFollowerType); } BaseItemType = ItemFunc.DetermineBaseType(ItemType); IsStackableItem = ItemFunc.DetermineIsStackable(ItemType, SNO); IsTwoSlot = !IsStackableItem && ItemFunc.DetermineIsTwoSlot(ItemType); //Armor / Jewelery / Weapons / Offhand / Follower Items if (BaseItemType == PluginBaseItemTypes.Armor || BaseItemType == PluginBaseItemTypes.Jewelry || BaseItemType == PluginBaseItemTypes.Offhand || BaseItemType == PluginBaseItemTypes.WeaponOneHand || BaseItemType == PluginBaseItemTypes.WeaponRange || BaseItemType == PluginBaseItemTypes.WeaponTwoHand || BaseItemType == PluginBaseItemTypes.FollowerItem) { if (BaseItemType == PluginBaseItemTypes.WeaponOneHand) { ThisOneHanded = true; } else if (BaseItemType == PluginBaseItemTypes.WeaponTwoHand) { TwoHanded = true; } try { ItemStats thesestats = item.Stats; ItemStatString = thesestats.ToString(); ItemStatProperties = new ItemProperties(thesestats); if (ItemStatProperties.Sockets > 0) { SocketsFilled = item.NumSocketsFilled; } } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item stats {0} \r\n {1}", SimpleDebugString, ex.Message); } #region Durability try { //Durability DurabilityCurrent = item.CurrentDurability; DurabilityMax = item.MaxDurability; DurabilityPercent = item.DurabilityPercent; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item durability {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ItemQualityLevel try { _thisQuality = item.ItemQualityLevel; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item quality {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } else { //Gem, Misc if (ItemType == PluginItemTypes.KeyStone) { KeystoneRank = ItemFunc.GetGreaterRiftKeystoneRank(SNO); if (KeystoneRank == -1) { try { KeystoneRank = item.TieredLootRunKeyLevel; } catch (Exception ex) { Logger.DBLog.DebugFormat("Failed to get TieredLootRunKeyLevel for Keystone!{0} \r\n {1}", SimpleDebugString, ex.Message); } } } else if (BaseItemType == PluginBaseItemTypes.Gem && ItemType == PluginItemTypes.LegendaryGem) { try { LegendaryGemRank = item.JewelRank; } catch (Exception ex) { Logger.DBLog.DebugFormat("Failed to get Jewel Rank for Legendary Gem!{0} \r\n {1}", SimpleDebugString, ex.Message); } try { LegendaryGemType = (LegendaryGemTypes)Enum.Parse(typeof(LegendaryGemTypes), SNO.ToString()); } catch (Exception) { LegendaryGemType = LegendaryGemTypes.None; } } else { IsPotion = ItemType == PluginItemTypes.HealthPotion || ItemType == PluginItemTypes.LegendaryHealthPotion; if (IsPotion) { PotionType = ItemFunc.ReturnPotionType(SNO); } } #region DyeType try { _thisDyeType = item.DyeType; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item dye type {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (IsStackableItem) { #region ItemStackQuantity try { _thisItemStackQuantity = item.ItemStackQuantity; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item stack quanity {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ItemStackMaxQuantity try { _maxstackquanity = item.MaxStackCount; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item max stack quanity {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } } #region GameBalanceId try { ThisBalanceID = item.GameBalanceId; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item GameBalanceId {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ACDGuid try { ACDGUID = item.ACDGuid; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item ACDGUID {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region DynamicId try { ThisDynamicID = item.DynamicId; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item DynamicId {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region Name try { _thisRealName = item.Name; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item name {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region Gold try { _thisGoldAmount = item.Gold; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item gold amount {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (!IsStackableItem) { #region IsUnidentified try { _isUnidentified = item.IsUnidentified; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item is identified {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } #region IsVendorBought try { _isVendorBought = item.IsVendorBought; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item is vendor bought {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region InventoryRow/Column try { invRow = item.InventoryRow; invCol = item.InventoryColumn; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item inventory row/column {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (itemEntry == null && !_isUnidentified && ItemType != PluginItemTypes.Unknown && _thisRealName != String.Empty) { if (FunkyBaseExtension.Settings.Debugging.DebuggingData && FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Items)) { ObjectCache.DebuggingData.CheckEntry(this); } } }
public CacheACDItem(ACDItem item) { ACDItem = item; SNO=item.ActorSNO; ThisInternalName = item.InternalName; try { _thisLevel = item.Level; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item level for {0} \r\n {1}", SimpleDebugString, ex.Message); } ItemDataEntry itemEntry; if (TheCache.ObjectIDCache.ItemDataEntries.TryGetValue(SNO, out itemEntry)) { ItemType=itemEntry.ItemType; ThisDBItemType = ItemFunc.PluginItemTypeToDBItemType(ItemType); ThisFollowerType = ItemFunc.ReturnFollowerType(ItemType); LegendaryItemType = itemEntry.LegendaryType; } else { ThisFollowerType = item.FollowerSpecialType; ThisDBItemType = item.ItemType; ItemType = ItemFunc.DetermineItemType(ThisInternalName, ThisDBItemType, ThisFollowerType); } BaseItemType = ItemFunc.DetermineBaseType(ItemType); IsStackableItem = ItemFunc.DetermineIsStackable(ItemType, SNO); IsTwoSlot = !IsStackableItem && ItemFunc.DetermineIsTwoSlot(ItemType); //Armor / Jewelery / Weapons / Offhand / Follower Items if (BaseItemType== PluginBaseItemTypes.Armor || BaseItemType== PluginBaseItemTypes.Jewelry || BaseItemType== PluginBaseItemTypes.Offhand || BaseItemType == PluginBaseItemTypes.WeaponOneHand || BaseItemType == PluginBaseItemTypes.WeaponRange || BaseItemType == PluginBaseItemTypes.WeaponTwoHand || BaseItemType == PluginBaseItemTypes.FollowerItem) { if (BaseItemType == PluginBaseItemTypes.WeaponOneHand) ThisOneHanded = true; else if (BaseItemType == PluginBaseItemTypes.WeaponTwoHand) TwoHanded = true; try { ItemStats thesestats = item.Stats; ItemStatString = thesestats.ToString(); ItemStatProperties = new ItemProperties(thesestats); if (ItemStatProperties.Sockets > 0) { SocketsFilled = item.NumSocketsFilled; } } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item stats {0} \r\n {1}", SimpleDebugString, ex.Message); } #region Durability try { //Durability DurabilityCurrent = item.CurrentDurability; DurabilityMax = item.MaxDurability; DurabilityPercent = item.DurabilityPercent; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item durability {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ItemQualityLevel try { _thisQuality = item.ItemQualityLevel; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item quality {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } else {//Gem, Misc if (ItemType == PluginItemTypes.KeyStone) { KeystoneRank = ItemFunc.GetGreaterRiftKeystoneRank(SNO); if (KeystoneRank == -1) { try { KeystoneRank = item.TieredLootRunKeyLevel; } catch (Exception ex) { Logger.DBLog.DebugFormat("Failed to get TieredLootRunKeyLevel for Keystone!{0} \r\n {1}", SimpleDebugString, ex.Message); } } } else if (BaseItemType == PluginBaseItemTypes.Gem && ItemType == PluginItemTypes.LegendaryGem) { try { LegendaryGemRank = item.JewelRank; } catch (Exception ex) { Logger.DBLog.DebugFormat("Failed to get Jewel Rank for Legendary Gem!{0} \r\n {1}", SimpleDebugString, ex.Message); } try { LegendaryGemType = (LegendaryGemTypes)Enum.Parse(typeof(LegendaryGemTypes), SNO.ToString()); } catch (Exception) { LegendaryGemType = LegendaryGemTypes.None; } } else { IsPotion = ItemType == PluginItemTypes.HealthPotion || ItemType == PluginItemTypes.LegendaryHealthPotion; if (IsPotion) PotionType = ItemFunc.ReturnPotionType(SNO); } #region DyeType try { _thisDyeType = item.DyeType; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item dye type {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (IsStackableItem) { #region ItemStackQuantity try { _thisItemStackQuantity = item.ItemStackQuantity; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item stack quanity {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ItemStackMaxQuantity try { _maxstackquanity = item.MaxStackCount; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item max stack quanity {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } } #region GameBalanceId try { ThisBalanceID = item.GameBalanceId; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item GameBalanceId {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ACDGuid try { ACDGUID = item.ACDGuid; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item ACDGUID {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region DynamicId try { ThisDynamicID = item.DynamicId; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item DynamicId {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region Name try { _thisRealName = item.Name; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item name {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region Gold try { _thisGoldAmount = item.Gold; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item gold amount {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (!IsStackableItem) { #region IsUnidentified try { _isUnidentified = item.IsUnidentified; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item is identified {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } #region IsVendorBought try { _isVendorBought = item.IsVendorBought; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item is vendor bought {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region InventoryRow/Column try { invRow = item.InventoryRow; invCol = item.InventoryColumn; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item inventory row/column {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (itemEntry==null && !_isUnidentified && ItemType!= PluginItemTypes.Unknown && _thisRealName!=String.Empty) { if (FunkyBaseExtension.Settings.Debugging.DebuggingData && FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Items)) { ObjectCache.DebuggingData.CheckEntry(this); } } }