public override bool UpdateData() { if (ref_DiaItem == null) { try { ref_DiaItem = (DiaItem)ref_DiaObject; } catch { Logger.Write(LogLevel.Cache, "Failure to convert obj {0} to DiaItem!", InternalName); NeedsRemoved = true; return false; } } if (targetType.Value == TargetType.Item) { #region Item #region DynamicID if (!DynamicID.HasValue) { try { DynamicID = ref_DiaObject.CommonData.DynamicId; } catch { Logger.Write(LogLevel.Cache, "Failure to get Dynamic ID for {0}", InternalName); return false; } } #endregion //Gamebalance Update if (!BalanceID.HasValue) { try { BalanceID = ref_DiaObject.CommonData.GameBalanceId; } catch { Logger.Write(LogLevel.Cache, "Failure to get gamebalance ID for item {0}", InternalName); return false; } } //Check if game balance needs updated #region GameBalance if (BalanceData == null || BalanceData.bNeedsUpdated) { CacheBalance thisnewGamebalance; try { int balanceid = BalanceID.Value; int tmp_Level = ref_DiaItem.CommonData.Level; ItemType tmp_ThisType = ref_DiaItem.CommonData.ItemType; ItemBaseType tmp_ThisDBItemType = ref_DiaItem.CommonData.ItemBaseType; FollowerType tmp_ThisFollowerType = ref_DiaItem.CommonData.FollowerSpecialType; bool tmp_bThisOneHanded = false; bool tmp_bThisTwoHanded = false; if (tmp_ThisDBItemType == ItemBaseType.Weapon) { tmp_bThisOneHanded = ref_DiaItem.CommonData.IsOneHand; tmp_bThisTwoHanded = ref_DiaItem.CommonData.IsTwoHand; } thisnewGamebalance = new CacheBalance(balanceid, itemlevel: tmp_Level, itemtype: tmp_ThisType, itembasetype: tmp_ThisDBItemType, onehand: tmp_bThisOneHanded, twohand: tmp_bThisTwoHanded, followertype: tmp_ThisFollowerType); } catch { Logger.Write(LogLevel.Cache, "Failure to add/update gamebalance data for item {0}", InternalName); return false; } if (BalanceData == null) { CacheIDLookup.dictGameBalanceCache.Add(BalanceID.Value, thisnewGamebalance); } else { CacheIDLookup.dictGameBalanceCache[BalanceID.Value] = thisnewGamebalance; } } #endregion //Item Quality / Recheck #region ItemQuality if (!Itemquality.HasValue || ItemQualityRechecked == false) { try { Itemquality = ref_DiaItem.CommonData.ItemQualityLevel; } catch { Logger.Write(LogLevel.Cache, "Failure to get item quality for {0}", InternalName); return false; } if (!ItemQualityRechecked) ItemQualityRechecked = true; else NeedsUpdate = false; } #endregion //Pickup? // Now see if we actually want it #region PickupValidation if (!ShouldPickup.HasValue) { //Logger.DBLog.InfoFormat Dropped Items Here!! Bot.Game.CurrentGameStats.CurrentProfile.LootTracker.DroppedItemLog(this); Bot.Character.ItemPickupEval(this); //if (Bot.Settings.ItemRules.UseItemRules) //{ // Interpreter.InterpreterAction action = Bot.ItemRulesEval.checkPickUpItem(this, ItemEvaluationType.PickUp); // switch (action) // { // case Interpreter.InterpreterAction.PICKUP: // ShouldPickup = true; // break; // case Interpreter.InterpreterAction.IGNORE: // ShouldPickup = false; // break; // } //} //if (!ShouldPickup.HasValue) //{ // //Use Giles Scoring or DB Weighting.. // ShouldPickup = // Bot.Settings.ItemRules.ItemRuleGilesScoring ? Backpack.GilesPickupItemValidation(this) // : ItemManager.Current.EvaluateItem(ref_DiaItem.CommonData, ItemEvaluationType.PickUp); ; //} } else { NeedsUpdate = false; } #endregion #endregion } else { #region Gold //Get gold value.. if (!GoldAmount.HasValue) { try { GoldAmount = ref_DiaItem.CommonData.GetAttribute<int>(ActorAttributeType.Gold); } catch { Logger.Write(LogLevel.Cache, "Failure to get gold amount for gold pile!"); return false; } } Bot.Character.Data.UpdateCoinage = true; NeedsUpdate = false; #endregion } return true; }
public override bool UpdateData() { if (ref_DiaItem == null) { try { ref_DiaItem = (DiaItem)ref_DiaObject; } catch { Logger.Write(LogLevel.Cache, "Failure to convert obj {0} to DiaItem!", InternalName); NeedsRemoved = true; return(false); } } if (targetType.Value == TargetType.Item) { #region Item #region DynamicID if (!DynamicID.HasValue) { try { DynamicID = ref_DiaObject.CommonData.DynamicId; } catch { Logger.Write(LogLevel.Cache, "Failure to get Dynamic ID for {0}", InternalName); return(false); } } #endregion //Gamebalance Update if (!BalanceID.HasValue) { try { BalanceID = ref_DiaObject.CommonData.GameBalanceId; } catch { Logger.Write(LogLevel.Cache, "Failure to get gamebalance ID for item {0}", InternalName); return(false); } } //Check if game balance needs updated #region GameBalance if (BalanceData == null || BalanceData.bNeedsUpdated) { CacheBalance thisnewGamebalance; try { int balanceid = BalanceID.Value; int tmp_Level = ref_DiaItem.CommonData.Level; ItemType tmp_ThisType = ref_DiaItem.CommonData.ItemType; ItemBaseType tmp_ThisDBItemType = ref_DiaItem.CommonData.ItemBaseType; FollowerType tmp_ThisFollowerType = ref_DiaItem.CommonData.FollowerSpecialType; bool tmp_bThisOneHanded = false; bool tmp_bThisTwoHanded = false; if (tmp_ThisDBItemType == ItemBaseType.Weapon) { tmp_bThisOneHanded = ref_DiaItem.CommonData.IsOneHand; tmp_bThisTwoHanded = ref_DiaItem.CommonData.IsTwoHand; } thisnewGamebalance = new CacheBalance(balanceid, itemlevel: tmp_Level, itemtype: tmp_ThisType, itembasetype: tmp_ThisDBItemType, onehand: tmp_bThisOneHanded, twohand: tmp_bThisTwoHanded, followertype: tmp_ThisFollowerType); } catch { Logger.Write(LogLevel.Cache, "Failure to add/update gamebalance data for item {0}", InternalName); return(false); } if (BalanceData == null) { CacheIDLookup.dictGameBalanceCache.Add(BalanceID.Value, thisnewGamebalance); } else { CacheIDLookup.dictGameBalanceCache[BalanceID.Value] = thisnewGamebalance; } } #endregion //Item Quality / Recheck #region ItemQuality if (!Itemquality.HasValue || ItemQualityRechecked == false) { try { Itemquality = ref_DiaItem.CommonData.ItemQualityLevel; } catch { Logger.Write(LogLevel.Cache, "Failure to get item quality for {0}", InternalName); return(false); } if (!ItemQualityRechecked) { ItemQualityRechecked = true; } else { NeedsUpdate = false; } } #endregion //Pickup? // Now see if we actually want it #region PickupValidation if (!ShouldPickup.HasValue) { //Logger.DBLog.InfoFormat Dropped Items Here!! Bot.Game.CurrentGameStats.CurrentProfile.LootTracker.DroppedItemLog(this); Bot.Character.ItemPickupEval(this); //if (Bot.Settings.ItemRules.UseItemRules) //{ // Interpreter.InterpreterAction action = Bot.ItemRulesEval.checkPickUpItem(this, ItemEvaluationType.PickUp); // switch (action) // { // case Interpreter.InterpreterAction.PICKUP: // ShouldPickup = true; // break; // case Interpreter.InterpreterAction.IGNORE: // ShouldPickup = false; // break; // } //} //if (!ShouldPickup.HasValue) //{ // //Use Giles Scoring or DB Weighting.. // ShouldPickup = // Bot.Settings.ItemRules.ItemRuleGilesScoring ? Backpack.GilesPickupItemValidation(this) // : ItemManager.Current.EvaluateItem(ref_DiaItem.CommonData, ItemEvaluationType.PickUp); ; //} } else { NeedsUpdate = false; } #endregion #endregion } else { #region Gold //Get gold value.. if (!GoldAmount.HasValue) { try { GoldAmount = ref_DiaItem.CommonData.GetAttribute <int>(ActorAttributeType.Gold); } catch { Logger.Write(LogLevel.Cache, "Failure to get gold amount for gold pile!"); return(false); } } Bot.Character.Data.UpdateCoinage = true; NeedsUpdate = false; #endregion } return(true); }