示例#1
0
 private static bool IsValidWhiteItem(DiaItem unit)
 {
     try
     {
         if (unit != null && unit.IsValid && unit.CommonData != null && unit.CommonData.IsValid && unit.ActorType == ActorType.Item && (unit.CommonData.ItemQualityLevel == ItemQuality.Normal || unit.CommonData.ItemQualityLevel == ItemQuality.Inferior) && (unit.CommonData.ItemBaseType == ItemBaseType.Armor || unit.CommonData.ItemBaseType == ItemBaseType.Jewelry || unit.CommonData.ItemBaseType == ItemBaseType.Weapon) && unit.Distance < 30f)
         {
             return(true);
         }
     }
     catch
     {
         return(false);
     }
     return(false);
 }
示例#2
0
 private static string ItemState(DiaItem item)
 {
     try
     {
         if (item != null)
         {
             return("Name=" + item.Name.ToString() +
                    ", Position=" + item.Position.ToString() +
                    ", Distance=" + item.Position.Distance(OrganObject.Position).ToString());
         }
         else
         {
             return("itemObject null");
         }
     }
     catch { return("itemObject error"); }
 }
示例#3
0
文件: CachedItem.cs 项目: ipo/AGBA
 public CachedItem(DiaItem diaItem)
 {
     try
     {
         if (diaItem == null)
         {
             CachingFailed = true;
             return;
         }
         Quality = diaItem.CommonData.ItemQualityLevel;
         base.BaseInit(diaItem);
     }
     catch (Exception e)
     {
         CachingFailed = true;
         return;
     }
 }
示例#4
0
        private static bool RefreshGilesItem()
        {
            bool logNewItem = false;
            bool AddToCache = false;

            if (c_BalanceID == -1)
            {
                AddToCache      = false;
                c_IgnoreSubStep = "InvalidBalanceID";
            }

            DiaItem item = c_diaObject as DiaItem;

            c_ItemQuality = item.CommonData.ItemQualityLevel;

            // Ignore it if it's not in range yet - allow legendary items to have 15 feet extra beyond our profile max loot radius
            float fExtraRange = 0f;


            if (iKeepLootRadiusExtendedFor > 0)
            {
                fExtraRange = 90f;
            }

            if (c_ItemQuality >= ItemQuality.Rare4)
            {
                fExtraRange = CurrentBotLootRange;
            }

            if (c_ItemQuality >= ItemQuality.Legendary)
            {
                // always pickup
                AddToCache = true;
            }

            if (c_CentreDistance > (CurrentBotLootRange + fExtraRange) && c_ItemQuality <= ItemQuality.Legendary)
            {
                c_IgnoreSubStep = "OutOfRange";
                AddToCache      = false;
                // return here to save CPU on reading unncessary attributes for out of range items;
                if (!AddToCache)
                {
                    return(AddToCache);
                }
            }

            c_ItemDisplayName    = item.CommonData.Name;
            c_GameBalanceID      = item.CommonData.GameBalanceId;
            c_ItemLevel          = item.CommonData.Level;
            c_DBItemBaseType     = item.CommonData.ItemBaseType;
            c_DBItemType         = item.CommonData.ItemType;
            c_IsOneHandedItem    = item.CommonData.IsOneHand;
            c_IsTwoHandedItem    = item.CommonData.IsTwoHand;
            c_item_tFollowerType = item.CommonData.FollowerSpecialType;

            PickupItem pickupItem = new PickupItem()
            {
                Name             = c_ItemDisplayName,
                InternalName     = c_InternalName,
                Level            = c_ItemLevel,
                Quality          = c_ItemQuality,
                BalanceID        = c_BalanceID,
                DBBaseType       = c_DBItemBaseType,
                DBItemType       = c_DBItemType,
                IsOneHand        = c_IsOneHandedItem,
                IsTwoHand        = c_IsTwoHandedItem,
                ItemFollowerType = c_item_tFollowerType,
                DynamicID        = c_GameDynamicID,
                Position         = c_Position,
                ActorSNO         = c_ActorSNO
            };

            // Calculate custom Giles item type
            c_item_GItemType = DetermineItemType(c_InternalName, c_DBItemType, c_item_tFollowerType);

            // And temporarily store the base type
            GItemBaseType itemBaseType = DetermineBaseType(c_item_GItemType);

            // Treat all globes as a yes
            if (c_item_GItemType == GItemType.HealthGlobe)
            {
                c_ObjectType = GObjectType.Globe;
                // Create or alter this cached object type
                dictGilesObjectTypeCache[c_RActorGuid] = c_ObjectType;
                AddToCache = true;
            }

            // Item stats
            logNewItem = RefreshItemStats(itemBaseType);

            // Get whether or not we want this item, cached if possible
            if (!dictGilesPickupItem.TryGetValue(c_RActorGuid, out AddToCache))
            {
                if (Settings.Loot.ItemFilterMode == global::GilesTrinity.Settings.Loot.ItemFilterMode.DemonBuddy)
                {
                    AddToCache = ItemManager.Current.ShouldPickUpItem((ACDItem)c_CommonData);
                }
                else if (Settings.Loot.ItemFilterMode == global::GilesTrinity.Settings.Loot.ItemFilterMode.TrinityWithItemRules)
                {
                    AddToCache = ItemRulesPickupValidation(pickupItem);
                }
                else
                {
                    AddToCache = GilesPickupItemValidation(pickupItem);
                }

                dictGilesPickupItem.Add(c_RActorGuid, AddToCache);
            }

            // Using DB built-in item rules
            if (AddToCache && ForceVendorRunASAP)
            {
                c_IgnoreSubStep = "ForcedVendoring";
            }

            if (!AddToCache)
            {
                // Check if there's a monster intersecting the path-line to this item
                AddToCache = MosterObstacleInPathCacheObject(AddToCache);
            }

            // Didn't pass pickup rules, so ignore it
            if (!AddToCache && c_IgnoreSubStep == String.Empty)
            {
                c_IgnoreSubStep = "NoMatchingRule";
            }

            if (Settings.Advanced.LogDroppedItems && logNewItem && c_DBItemType != ItemType.Unknown)
            {
                LogDroppedItem();
            }

            return(AddToCache);
        }
示例#5
0
 private static string ItemState(DiaItem item)
 {
     try
     {
         if (item != null)
             return "Name=" + item.Name.ToString() +
                 ", Position=" + item.Position.ToString() +
                 ", Distance=" + item.Position.Distance(OrganObject.Position).ToString();
         else
             return "itemObject null";
     }
     catch { return "itemObject error"; }
 }