コード例 #1
0
 public static bool CompareGear(EasyItem E, string item)
 {
     eq_item_score  = 0;
     new_item_score = 0;
     if (!initialized)
     {
         return(false);
     }
     if (E == null && E.Item == null)
     {
         return(false);
     }
     if (IsEquippable(E))
     {
         if (IsWanted(E))
         {
             if (!IsProtected(E))
             {
                 if (IsUsable(E))
                 {
                     PPather.Debug("CompareGear: checking {0} (Type={1}, SubType={2}, Slot={3})", E.RealName, E.Item.Type, E.Item.SubType, E.Item.Slot);
                     return(Compare(E, item));
                 }
             }
         }
     }
     return(false);
 }
コード例 #2
0
        public static void CheckForBetterGear()
        {
            List <EasyItem> containers = new List <EasyItem>();

            PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Inventory: Reading Inventory Items");
            Character.GetInventoryItems();
            PPather.Debug("\n=====================================\n=== CHECK OF {0} BAG ITEMS START ===\n=====================================\n", Character.InventoryItems.Count);
            foreach (KeyValuePair <long, EasyItem> e in Character.InventoryItems)
            {
                //PPather.WriteLine("AutoEquipTask: Got " + e.Key + " from InventoryItems");
                EasyItem E = e.Value;
                PPather.Debug("\n\n=== AUTOEQUIP FOR {0} START ===", E.RealName);
                if (E.Item.Type.Equals("Containers"))
                {
                    PPather.Debug("AutoEquip: {0} saved for CompareAndEquipBags()", E.RealName);
                    containers.Add(E);
                    PPather.Debug("\n=== AUTOEQUIP FOR {0} END ===\n", E.RealName);
                    continue;
                }
                if (ItemCompare.CompareGear(E, E.RealName))
                {
                    PPather.WriteLine(LOG_CATEGORY.DEBUG, "AutoEquip: Equipped better gear [{0}]", E.RealName);
                }
                PPather.Debug("\n=== AUTOEQUIP FOR {0} END ===\n", E.RealName);
            }

            if (containers.Count > 0)
            {
                EasyItem[] C = containers.ToArray();
                Inventory.CompareAndEquipBags(C);
                containers.Clear();
            }
            PPather.Debug("\n=====================================\n=== CHECK OF {0} BAG ITEMS END ===\n=====================================\n", Character.InventoryItems.Count);
        }
コード例 #3
0
ファイル: EasyItem.cs プロジェクト: iwaitu/babbot
 public EasyItem Create(Item i, string rn)
 {
     GItem gi = Inventory.GetItem(i.Name);
     if (gi == null) return null;
     EasyItem E = new EasyItem(gi, i, gi.GUID, rn);
     return E;
 }
コード例 #4
0
ファイル: Character.cs プロジェクト: uvbs/babbot
        public static void ReplaceCurrentlyEquipped(EasyItem E, string slot)
        {
            if (E == null)
            {
                return;
            }
            EasyItem w = null;

            if (CurrentlyEquipped == null || CurrentlyEquipped.Count < 1)
            {
                return;
            }
            if (CurrentlyEquipped.ContainsKey(slot))
            {
                w = GetCurrent(slot);
                CurrentlyEquipped.Remove(slot);
            }

            SetCurrent(slot, E);
            string oldName = "null";

            if (w != null && w.Item != null)
            {
                oldName = w.GItem.Name;
            }
            if (w != null && w.GItem != null)
            {
                PPather.AutoEquipForceSell.Add(w.GItem.GUID);
                GContext.Main.Debug(String.Format("Character: Added {0} to ForceSell list", w.GItem.Name));
            }
            PPather.WriteLine(String.Format("Character: Replaced {0} with {1} in CurrentlyEquipped", oldName, E.GItem.Name));
        }
コード例 #5
0
ファイル: Character.cs プロジェクト: uvbs/babbot
        public static void GetEquippedItems()
        {
            GItemHelper GIH = new GItemHelper();

            if (CharacterSlots == null)
            {
                CharacterSlots = GetCharacterSlots();
            }

            CharacterFrame.ShowFrame();
            foreach (string slot in CharacterSlots)
            {
                string tooltipName = "none";
                PPather.Debug("\n\n == SLOT LOOKUP FOR {0} START ==", slot);
                List <string> tooltip = CharacterFrame.GetTooltip(slot);
                if (tooltip != null && tooltip.Count > 0)
                {
                    //foreach (string tip in tooltip)
                    //    PPather.WriteLine("Character: Tooltip[{0}]\t=>\t{1}", slot, tip);
                    tooltipName = tooltip[tooltip.Count - 1];
                }
                PPather.Debug("Character: Name for {0} = {1}", slot, tooltipName);
                if (tooltip == null || IsEmptySlotName(tooltipName))
                {
                    AddNullSlot(slot);
                }
                else
                {
                    Item i = ItemManager.get(tooltipName);
                    if (i == null)
                    {
                        AddNullSlot(slot);
                    }
                    else
                    {
                        GItem Item = (GItem)GObjectList.FindObject(GIH.GetEquippedGUID(slot));
                        if (Item == null)
                        {
                            continue;
                        }
                        EasyItem E = new EasyItem(Item, i, Item.GUID, tooltipName);
                        try
                        {
                            CurrentlyEquipped.Add(slot, E);
                            PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Character: Item [{0}] equipped in '{1}'", tooltipName, slot);
                            PPather.Debug(String.Format("ToolTip[{0}]: {1}", i.Name, CleanToolTip(tooltip)));
                        }
                        catch (ArgumentException)
                        {
                            PPather.Debug("Character: " + tooltipName + " is already added to CurrentlyEquipped (skipping)");
                        }
                    }
                }
                PPather.Debug("\n=== SLOT LOOKUP FOR {0} END ===\n", slot);
            }
            CharacterFrame.HideFrame();
        }
コード例 #6
0
        public EasyItem Create(Item i, string rn)
        {
            GItem gi = Inventory.GetItem(i.Name);

            if (gi == null)
            {
                return(null);
            }
            EasyItem E = new EasyItem(gi, i, gi.GUID, rn);

            return(E);
        }
コード例 #7
0
        public static bool Equip(EasyItem E, bool EquipBOE)
        {
            PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Equip: Attempting to equip {0}", E.RealName);
            BagManager bm = new BagManager();

            //PPather.WriteLine(String.Format("AutoEquipTask: Equipping {0} (GITem name: {1}", E.RealName, E.GItem.Name));
            if (!bm.ClickItem(E.GItem, true))
            {
                PPather.WriteLine(String.Format("Equip: BagManger failed to click item ({0}). Aborting...", E.RealName));
                GContext.Main.Debug(String.Format("Equip: BagManger failed to click item ({0}). Aborting...", E.RealName));
                return(false);
            }
            Thread.Sleep(1000);
            string BOEButton = "StaticPopup1Button2";

            if (EquipBOE)
            {
                BOEButton = "StaticPopup1Button1";
            }
            GInterfaceObject AcceptBOE = GContext.Main.Interface.GetByName(BOEButton);

            if (AcceptBOE != null && AcceptBOE.IsVisible)
            {
                GContext.Main.EnableCursorHook();
                AcceptBOE.Hover();
                AcceptBOE.ClickMouse(false);
                GContext.Main.DisableCursorHook();
                GContext.Main.ClearTarget();
                if (EquipBOE)
                {
                    PPather.WriteLine("Equip: Accepted BOE for " + E.RealName);
                    GContext.Main.Debug("Equip: Accepted BOE for " + E.RealName);
                    bm.CloseAllBags();
                    bm.UpdateItems();
                    //Character.SetCurrent(E.Item.Slot, E, true);
                    Character.ReplaceCurrentlyEquipped(E);
                    return(true);
                }
                else
                {
                    PPather.WriteLine("Equip: Declined BOE for " + E.RealName);
                    GContext.Main.Debug("Equip: Declined BOE for " + E.RealName);
                    bm.CloseAllBags();
                    bm.UpdateItems();
                    return(false);
                }
            }
            Character.ReplaceCurrentlyEquipped(E);
            bm.UpdateItems();
            bm.CloseAllBags();
            return(true);
        }
コード例 #8
0
 public static bool IsEquippable(EasyItem E)
 {
     if (E.Item.Type.Equals("Armor") || E.Item.Type.Equals("Weapons") && E.Item.Slot != null && !E.Item.Slot.Equals('0'))
     {
         return(true);
     }
     else
     {
         PPather.WriteLine(String.Format("ItemCompare: Type [{0}] is not equippable, skipping {1}", E.Item.Type, E.RealName));
         GContext.Main.Debug(String.Format("ItemCompare: Type [{0}] is not equippable, skipping {1}", E.Item.Type, E.RealName));
         return(false);
     }
 }
コード例 #9
0
 public static bool IsWanted(EasyItem E)
 {
     if ((EquipArmor && E.Item.Type.Equals("Armor")) || (EquipWeapons && E.Item.Type.Equals("Weapons")))
     {
         return(true);
     }
     else
     {
         PPather.WriteLine(String.Format("ItemCompare: Type [{0}] is not wanted, skipping {1}", E.Item.Type, E.RealName));
         GContext.Main.Debug(String.Format("ItemCompare: Type [{0}] is not wanted, skipping {1}", E.Item.Type, E.RealName));
         return(false);
     }
 }
コード例 #10
0
ファイル: Character.cs プロジェクト: uvbs/babbot
 public static void RemoveCurrentlyEquipped(EasyItem E)
 {
     if (E == null)
     {
         return;
     }
     if (CurrentlyEquipped == null || CurrentlyEquipped.Count < 1)
     {
         return;
     }
     if (CurrentlyEquipped.ContainsKey(E.Item.Slot))
     {
         CurrentlyEquipped.Remove(E.Item.Slot);
     }
 }
コード例 #11
0
ファイル: Character.cs プロジェクト: gaknoia/babbot
 public static void GetInventoryItems()
 {
     InventoryItems.Clear();
     bm.UpdateItemsSorted();
     for (int j = 0; j < bm.Bags.Length; j++ )
     {
         //PPather.Debug("Charcater: Bags.Length = {0}",bm.Bags.Length);
         BagManager.Bag b = bm.Bags[j];
         if (b.count < 1) continue;
         //PPather.Debug("Characater: Bags[{0}] contains {1} items",j,b.I.Length);
         bm.OpenBag(b.bag);
         GItem[] Items = null;
         if(b.I != null)
             Items = b.I;
         if (Items == null || Items.Length < 1) continue;
         foreach (GItem Item in Items)
         {
             if (Item == null || Item.GUID == 0) continue;
             PPather.Debug("\n\n == ITEM LOOKUP FOR {0} START ==", Item.Name);
             List<string> tooltip = GetTooltipOnOpenBags(Item);
             if (tooltip == null || tooltip.Count < 1)
             {
                 PPather.Debug("Character.GetInventoryItems: tooltip for {0} is emtpy", Item.Name);
             }
             else
             {
                 string tooltipName = tooltip[tooltip.Count - 1];
                 PPather.Debug("Character.GetInventoryItems: tooltip[0] for {0} is {1}", Item.Name,tooltipName);
                 Item i = ItemManager.get(tooltipName);
                 if (i == null)
                 {
                     PPather.Debug("Character: ItemManager return null, {0} most likely not equippable", tooltipName);
                     continue;
                 }
                 try
                 {
                     EasyItem E = new EasyItem(Item, i, Item.GUID, tooltipName);
                     InventoryItems.Add(Item.GUID,E);
                     PPather.WriteLine(Pather.LOG_CATEGORY.INFORMATION,"Character: {0} added to InventoryItems", tooltipName);
                     //PPather.WriteLine(String.Format("DEBUG: Item.Type = {0} , Item.Quality = {1}",E.GItem.Type.ToString(), E.GItem.Definition.Quality.ToString()));
                     //PPather.WriteLine(String.Format("Charcter: Item [{0}] found in bags", i.Name));
                     //PPather.WriteLine(String.Format("ToolTip[{0}]: {1}", i.Name, CleanToolTip(tooltip)));
                 }
                 catch (ArgumentException)
                 {
                     PPather.Debug("Character.GetInventoryItems: {0}({1}) is already added to InventoryItems (skipping)",tooltipName, Item.GUID);
                 }
             }
             PPather.Debug("\n=== ITEM LOOKUP FOR {0} END ===\n",Item.Name);
         }
     }
     bm.CloseAllBags();
 }
コード例 #12
0
ファイル: ItemCompare.cs プロジェクト: gaknoia/babbot
        public static bool Compare(EasyItem E, string item)
        {
            if (!initialized) return false;
            double itemValue = 0;
            double equipValue = 0;
            bool IncludeArmor = false;
            EasyItem MainHand = null;
            EasyItem SecondHand = null;
            string nameMain = "none";
            string nameSecond = "none";

            EquipModifier EQ = new EquipModifier(GPlayerSelf.Me.PlayerClass.ToString(), ArmorUpgrade);

            // avoid some rare armor quest objects that sneaked through the tests earlier
            if (E.Item.Slot == null || E.Item.Slot.Equals("0"))
            {
                PPather.WriteLine(Pather.LOG_CATEGORY.INFORMATION,"Compare: Item slot is '0', {0} is most likely a quest armor", E.RealName);
                return false;
            }

            /* check slot for equipped item */
            if (!E.Item.SubType.Equals("Rings") && ((E.Item.Type.Equals("Armor") || E.Item.SubType.Equals("Ranged")) && Character.GetCurrent(E.Item.Slot) == null)
                || (E.Item.Type.Equals("Weapons") &&
                ((Character.GetCurrent(Character.Slots.MainHand) == null) && (Character.GetCurrent(Character.Slots.SecondaryHand) == null))
                || (E.Item.Slot.Equals(Character.Slots.Ranged) && Character.GetCurrent(Character.Slots.Ranged) == null)))
            {
                PPather.WriteLine(LOG_CATEGORY.INFORMATION,"Compare: No item found in {0}, we should equip this", E.Item.Slot);
                return Inventory.Equip(E, EquipBOE);
            }

            /* get equipped item */
            EasyItem equipped = null;
            Character.CurrentlyEquipped.TryGetValue(E.Item.Slot, out equipped);

            if (equipped == null || equipped.Item == null)
            {
                /* if we didn't hit on the tests for no item above
                 * and equipped is read as null
                 * retun false as a failsafe, something is wrong
                 */
                return false;
            }
            itemValue = ItemValue(E.Item, 0, EQ, false);

            /*
             * Compare against both slots if it's a Ring or Trinket
             */
            if (E.Item.Slot.Equals("Finger") || E.Item.Slot.Equals("Trinket"))
            {
                EasyItem Slot0 = null;
                if (Character.GetCurrent(Character.Slots.get(E.Item.Slot + "0")) != null)
                    Character.CurrentlyEquipped.TryGetValue(Character.Slots.get(E.Item.Slot + "0"), out Slot0);
                EasyItem Slot1 = null;
                if (Character.GetCurrent(Character.Slots.get(E.Item.Slot + "1")) != null)
                    Character.CurrentlyEquipped.TryGetValue(Character.Slots.get(E.Item.Slot + "1"), out Slot1);

                if (Slot0 == null) return Inventory.Equip(E, EquipBOE, Character.Slots.get(E.Item.Slot + "0"));
                if (Slot1 == null) return Inventory.Equip(E, EquipBOE, Character.Slots.get(E.Item.Slot + "1"));

                double slot0Value = 0;
                double slot1Value = 0;

                if (Slot0 != null)
                    slot0Value = ItemValue(Slot0.Item, 0, EQ, false);
                if (Slot1 != null)
                    slot1Value = ItemValue(Slot1.Item, 0, EQ, false);

                PPather.WriteLine(LOG_CATEGORY.DEBUG,"Compare: Ring or Trinket: [eq0] {0}({1}), [eq1] {2}({3}), [new] {4}({5})",Slot0.RealName, slot0Value, Slot1.RealName, slot1Value, E.RealName, itemValue);

                if (itemValue < slot0Value && itemValue < slot1Value)
                {
                    PPather.WriteLine(LOG_CATEGORY.INFORMATION,"Compare: Ring or Trinket: SCORE [new] {0}({1}) WORSE than both [equipped] {2}({3}) and [equippped] {4}({5}) => DISREGARD", E.RealName, itemValue, Slot0.RealName, slot0Value, Slot1.RealName, slot1Value);
                    return false;
                }
                else
                {
                    if (slot0Value < slot1Value)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Ring or Trinket: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, Slot0.RealName, slot0Value);
                        return Inventory.Equip(E, EquipBOE, Character.Slots.get(E.Item.Slot + "0"));
                    }
                    else
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Ring or Trinket: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, Slot1.RealName, slot1Value);
                        return Inventory.Equip(E, EquipBOE, Character.Slots.get(E.Item.Slot + "1"));
                    }
                }
            }
            else if (E.Item.Type.Equals("Weapons") || E.Item.SubType.Equals("Shields"))
            {
                /*
                 * Weapon comparsion logic
                 * If (Shield && MainHand != Two-Hand Weapon || PreferSheidl)
                 *   Compare against SecondaryHand
                 *
                 * If (Two-Hand Weapon || MainHand==TwoHanded && (Item == OneHand || Item == SecondaryHand))
                 *   Compare against sum of MainHand and SecondaryHand
                 *
                 * If (Dual-Wield Skill)
                 *   If(OneHand Weapon)
                 *     Compare against both MainHand and SecondaryHand
                 *   If(OffHand Weapon)
                 *     Compare against SecondaryHand
                 *
                 * If (OneHand Weapon)
                 *   Compare against MainHand slot (not OneHand slot)
                 *
                 * Else
                 *   Compare against MainHand
                 */

                /*
                 * Get Items currently equipped in MainHand and SecondaryHand slot
                 */
                if (Character.GetCurrent(Character.Slots.MainHand) != null)
                {
                    Character.CurrentlyEquipped.TryGetValue(Character.Slots.MainHand, out MainHand);
                    if (MainHand != null && MainHand.Item != null)
                        nameMain = MainHand.RealName;
                }
                if (Character.GetCurrent(Character.Slots.SecondaryHand) != null)
                {
                    Character.CurrentlyEquipped.TryGetValue(Character.Slots.SecondaryHand, out SecondHand);
                    if (SecondHand != null && SecondHand.Item != null)
                        nameSecond = SecondHand.RealName;
                }

                itemValue = ItemValue(E.Item, E.Item.DPS * EQ.DPS, EQ, false);
                equipValue = 0;

                /* If a shield and we don't have a two-handed weapon equipped,
                 * compare against SecondaryHandSlot */
                if (E.Item.SubType.Equals("Shields") && (!IsTwoHanded(MainHand.Item.SubType) || PreferShield))
                {
                    equipValue = ItemValue(SecondHand.Item, SecondHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);
                    if (itemValue > equipValue)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Shield: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) AND MainHand is not Two-Handed Weapon OR PreferShield => EQUIP", E.RealName, itemValue, SecondHand.RealName, equipValue);
                        return Inventory.Equip(E, EquipBOE);
                    }
                    else
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Shield: SCORE [new] {0}({1}) WORSE than [equipped] {2}({3}) OR MainHand is Two-Handed Weapon => DISREGARD", E.Item.Slot, E.RealName, itemValue, equipped.RealName, equipValue);
                        return false;
                    }
                }
                /* If Two-Handed Weapon */
                else if (IsTwoHanded(E.Item.SubType) || (IsTwoHanded(MainHand.Item.SubType) && (E.Item.Slot.Equals(Character.Slots.OneHand) || E.Item.Slot.Equals(Character.Slots.SecondaryHand))))
                {
                    equipValue = 0;
                    if(MainHand != null)
                        equipValue += ItemValue(MainHand.Item, MainHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);
                    if (SecondHand != null)
                        equipValue += ItemValue(SecondHand.Item, SecondHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);
                    if (itemValue > equipValue)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Two-Handed: SCORE [new] {0}({1}) BETTER than SUM OF [equipped] {2} and [equipped] {3} ({4}) => EQUIP", E.RealName, itemValue, nameMain, nameSecond, equipValue);
                        return Inventory.Equip(E, EquipBOE);
                    }
                    else
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Two-Handed: SCORE [new] {0}({1}) WORSE than SUM OF [equipped] {2} and [equipped] {3} (SUM: {4}) => DISREGARD", E.RealName, itemValue, nameMain, nameSecond, equipValue);
                        return false;
                    }
                }
                /* If Dual-Wield skill*/
                else if (WeaponSkills.Contains("Dual-Wield") && E.Item.Slot.Equals(Character.Slots.OneHand))
                {
                    double mainValue = 0;
                    double secondValue = 0;
                    if (MainHand != null)
                        mainValue = ItemValue(MainHand.Item, MainHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);
                    if (SecondHand != null)
                        secondValue = ItemValue(SecondHand.Item, SecondHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);

                    PPather.WriteLine(LOG_CATEGORY.DEBUG, "Compare: Dual-Wield: [eq0] {0}({1}), [eq1] {2}({3}), [new] {4}({5})", nameMain, mainValue, nameSecond, secondValue, E.RealName, itemValue);

                    if (itemValue < mainValue && itemValue < secondValue)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Dual-Wield: SCORE [new] {0}({1}) WORSE than both [equipped] {2}({3}) and [equippped] {4}({5}) => DISREGARD", E.RealName, itemValue, nameMain, mainValue, nameSecond, secondValue);
                        return false;
                    }
                    else
                    {
                        if (mainValue < secondValue)
                        {
                            PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Dual-Wield: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, nameMain, mainValue);
                            return Inventory.Equip(E, EquipBOE, Character.Slots.MainHand);
                        }
                        else
                        {
                            PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Dual-Wield: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, nameSecond, secondValue);
                            return Inventory.Equip(E, EquipBOE, Character.Slots.SecondaryHand);
                        }
                    }
                }
                else if (E.Item.Slot.Equals(Character.Slots.OneHand))
                {
                    double mainValue = 0;
                    if (MainHand != null)
                        mainValue = ItemValue(MainHand.Item, MainHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);

                    if (itemValue > mainValue)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Weapons ({0}): SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, nameMain, mainValue);
                        return Inventory.Equip(E, EquipBOE, Character.Slots.MainHand);
                    }
                    else
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Weapons ({0}): SCORE [new] {0}({1}) WORSE than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, nameMain, mainValue);
                        return false;
                    }

                }
                else
                {
                    equipValue = ItemValue(equipped.Item, 0, EQ, false);
                    if (itemValue > equipValue)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Weapons ({0}): SCORE [new] {1}({2}) BETTER than [equipped] {3}({4}) => EQUIP", E.Item.Slot, E.RealName, itemValue, equipped.RealName, equipValue);
                        return Inventory.Equip(E, EquipBOE);
                    }
                    else
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Weapons ({0}): SCORE [new] {1}({2}) WORSE than [equipped] {3}({4}) => DISREGARD", E.Item.Slot, E.RealName, itemValue, equipped.RealName, equipValue);
                        return false;
                    }
                }
            }
            else if (E.Item.Type.Equals("Armor"))
            {
                if (E.Item.Slot.Equals(Character.Slots.SecondaryHand) && IsTwoHanded(MainHand.Item.SubType))
                {
                    PPather.WriteLine(LOG_CATEGORY.INFORMATION, " Compare: Can't Equip {0} with Two-Handed Weapons ({1}) ==> DISREGARD", E.RealName, nameMain);
                    return false;
                }
                /* include armor value if any of the item are of preferred type */
                if (equipped.Item.SubType.Replace(" Armor", "").Equals(EQ.WantedArmor) ||
                    E.Item.SubType.Replace(" Armor", "").Equals(EQ.WantedArmor))
                    IncludeArmor = true;

                /* include armor if both of the items are of wrong type */
                else if (!equipped.Item.SubType.Replace(" Armor", "").Equals(EQ.WantedArmor) &&
                    !E.Item.SubType.Replace(" Armor", "").Equals(EQ.WantedArmor))
                    IncludeArmor = true;

                else if (E.Item.Slot.Equals(Character.Slots.Back))
                    IncludeArmor = true;

                else
                    IncludeArmor = false;

                itemValue = ItemValue(E.Item, 0, EQ, IncludeArmor);
                equipValue = ItemValue(equipped.Item, 0, EQ, IncludeArmor);

                eq_item_score = equipValue;
                new_item_score = itemValue;

                if (itemValue > equipValue)
                {
                    PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Armor: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, equipped.RealName, equipValue);
                    return Inventory.Equip(E, EquipBOE);
                }
                else
                {
                    PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: {0}: SCORE [new] {1}({2}) WORSE than [equipped] {3}({4}) => DISREGARD", E.Item.Slot, E.RealName, itemValue, equipped.RealName, equipValue);
                    return false;
                }
            }
            else
            {
                PPather.WriteLine(LOG_CATEGORY.INFORMATION, "WTF?");
                return false;
            }
        }
コード例 #13
0
ファイル: ItemCompare.cs プロジェクト: gaknoia/babbot
 public static bool IsWanted(EasyItem E)
 {
     if ((EquipArmor && E.Item.Type.Equals("Armor")) || (EquipWeapons && E.Item.Type.Equals("Weapons")))
         return true;
     else
     {
         PPather.WriteLine(String.Format("ItemCompare: Type [{0}] is not wanted, skipping {1}", E.Item.Type, E.RealName));
         GContext.Main.Debug(String.Format("ItemCompare: Type [{0}] is not wanted, skipping {1}", E.Item.Type, E.RealName));
         return false;
     }
 }
コード例 #14
0
ファイル: ItemCompare.cs プロジェクト: gaknoia/babbot
 public static bool IsUsable(EasyItem E)
 {
     bool usable = false;
     int PlayerLevel = GPlayerSelf.Me.Level;
     if (E.Item.Type.Equals("Armor"))
     {
         if (E.Item.SubType.Equals("Shields") && UseShield) usable = true;
         else if (E.Item.SubType.Equals("Cloaks")) usable = true;
         else
         {
             switch (GPlayerSelf.Me.PlayerClass.ToString())
             {
                 case "Warrior":
                     if (ArmorUpgrade && PlayerLevel > 40 && E.Item.SubType.Equals("Plate Armor")) usable = true;
                     else if (E.Item.SubType.Equals("Plate Armor")) usable = false;
                     else usable = true;
                     break;
                 case "Paladin":
                     if (ArmorUpgrade && PlayerLevel > 40 && E.Item.SubType.Equals("Plate Armor")) usable = true;
                     else if (E.Item.SubType.Equals("Plate Armor")) usable = false;
                     else usable = true;
                     break;
                 case "Shaman":
                     if (ArmorUpgrade && PlayerLevel > 40 && E.Item.SubType.Equals("Mail Armor")) usable = true;
                     else if (E.Item.SubType.Equals("Plate Armor")) usable = false;
                     else if (E.Item.SubType.Equals("Mail Armor")) usable = false;
                     else usable = true;
                     break;
                 case "Hunter":
                     if (ArmorUpgrade && PlayerLevel > 40 && E.Item.SubType.Equals("Mail Armor")) usable = true;
                     else if (E.Item.SubType.Equals("Plate Armor")) usable = false;
                     else if (E.Item.SubType.Equals("Mail Armor")) usable = false;
                     else usable = true;
                     break;
                 case "Rogue":
                     if (E.Item.SubType.Equals("Plate Armor")) usable = false;
                     else if (E.Item.SubType.Equals("Mail Armor")) usable = false;
                     else usable = true;
                     break;
                 case "Druid":
                     if (E.Item.SubType.Equals("Plate Armor")) usable = false;
                     else if (E.Item.SubType.Equals("Mail Armor")) usable = false;
                     else usable = true;
                     break;
                 default: // Priest, Mage and Warlock
                     if (E.Item.SubType.Equals("Plate Armor")) usable = false;
                     else if (E.Item.SubType.Equals("Mail Armor")) usable = false;
                     else if (E.Item.SubType.Equals("Leather Armor")) usable = false;
                     else usable = true;
                     break;
             }
         }
     }
     else if (E.Item.Type.Equals("Weapons"))
     {
         if (WeaponSkills.Contains(E.Item.SubType)) usable = true;
         else usable = false;
     }
     else
     {
         usable = false;
     }
     if (!usable)
     {
         PPather.WriteLine(String.Format("ItemCompare: SubType [{0}] is not usable, skipping {1}", E.Item.SubType, E.RealName));
         GContext.Main.Debug(String.Format("ItemCompare: SubType [{0}] is not usable, skipping {1}", E.Item.SubType, E.RealName));
     }
     return usable;
 }
コード例 #15
0
ファイル: ItemCompare.cs プロジェクト: gaknoia/babbot
        public static bool IsProtected(EasyItem E)
        {
            string failsafe1 = E.Item.Slot;
            string failsafe2 = E.Item.Slot;
            if(failsafe1 == null)
                failsafe1 = "";
            if (failsafe2 == null)
                failsafe2 = "";
            try
            {
                failsafe1.Replace("slot", "");
            }
            catch { }

            try
            {
                failsafe2.Replace("Slot", "");
            }
            catch { }

            if (ProtectedSlots.Contains(E.Item.Slot) || ProtectedSlots.Contains(failsafe1) || ProtectedSlots.Contains(failsafe2))
            {
                /*
                 * protected by slot
                 */
                PPather.WriteLine(String.Format("ItemCompare: Slot [{0}] is protected, skipping {1}", E.Item.Slot, E.RealName));
                GContext.Main.Debug(String.Format("ItemCompare: Slot [{0}] is protected, skipping {1}", E.Item.Slot, E.RealName));
                return true;
            }
            else
            {
                /*
                 * protected by quality
                 */
                if (!initialized) return true;
                if (E == null) return false;
                if (E.GItem == null) return false; // wtf?
                int max = Quality(MaxGearQuality);
                int iq = 10;
                switch (E.GItem.Definition.Quality)
                {
                    case GItemQuality.Unknown: iq = 10; break;
                    case GItemQuality.Poor: iq = Quality("poor"); break;
                    case GItemQuality.Common: iq = Quality("common"); break;
                    case GItemQuality.Uncommon: iq = Quality("uncommon"); break;
                    case GItemQuality.Rare: iq = Quality("rare"); break;
                    case GItemQuality.Epic: iq = Quality("epic"); break;
                    case GItemQuality.Legendary: iq = Quality("legendary"); break;
                    case GItemQuality.Artifact: iq = Quality("artifact"); break;
                    default: iq = 10; break;
                }

                if (iq > max)
                {
                    PPather.WriteLine(String.Format("ItemCompare: Quality [{0}] is protected, skipping {1}", E.GItem.Definition.Quality.ToString(), E.RealName));
                    GContext.Main.Debug(String.Format("ItemCompare: Quality [{0}] is protected, skipping {1}", E.GItem.Definition.Quality.ToString(), E.RealName));
                    return true;
                }
            }
            return false;
        }
コード例 #16
0
ファイル: ItemCompare.cs プロジェクト: gaknoia/babbot
 public static bool IsEquippable(EasyItem E)
 {
     if (E.Item.Type.Equals("Armor") || E.Item.Type.Equals("Weapons") && E.Item.Slot != null && !E.Item.Slot.Equals('0'))
         return true;
     else
     {
         PPather.WriteLine(String.Format("ItemCompare: Type [{0}] is not equippable, skipping {1}", E.Item.Type, E.RealName));
         GContext.Main.Debug(String.Format("ItemCompare: Type [{0}] is not equippable, skipping {1}", E.Item.Type, E.RealName));
         return false;
     }
 }
コード例 #17
0
ファイル: Inventory.cs プロジェクト: iwaitu/babbot
        public static bool Equip(EasyItem E, bool EquipBOE, string slot)
        {
            PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Equip: Attempting to equip {0} [{1}]", E.RealName, slot);
            bool placed = false;
            BagManager bm = new BagManager();
            CharacterFrame.ShowFrame();
            GInterfaceObject BagItemObject = null;
            GInterfaceObject TargetSlotObject;

            TargetSlotObject = GContext.Main.Interface.GetByName("Character" + slot);
            //PPather.WriteLine(LOG_CATEGORY.DEBUG, "Equip: TargetSlotObject = {0}", TargetSlotObject.LabelText);

            GItem[] Items = bm.GetAllItems();
            foreach (GItem Item in Items)
            {
                if (Item.GUID == E.GUID)
                {
                    Thread.Sleep(500);
                    BagItemObject = bm.GetItem(Item);
                    //PPather.WriteLine(LOG_CATEGORY.DEBUG, "Equip: BagItemObject = {0}", BagItemObject.LabelText);
                    //PPather.WriteLine("item: " + BagItemObject.ToString());
                    Functions.Drag(BagItemObject, TargetSlotObject);
                    placed = true;
                    Thread.Sleep(500);
                    string BOEButton = "StaticPopup1Button2";
                    if (EquipBOE)
                        BOEButton = "StaticPopup1Button1";

                    GInterfaceObject ButtonObject = GContext.Main.Interface.GetByName(BOEButton);
                    if (ButtonObject != null && ButtonObject.IsVisible)
                    {
                        if (!EquipBOE) placed = false;
                        GContext.Main.EnableCursorHook();
                        ButtonObject.Hover();
                        ButtonObject.ClickMouse(false);
                        GContext.Main.DisableCursorHook();
                        GContext.Main.ClearTarget();
                    }
                }
            }

            CharacterFrame.HideFrame();

            /* put the old item in bags */
            if (GContext.Main.Interface.CursorItemType != GCursorItemTypes.None)
                Functions.Click(BagItemObject);

            bm.UpdateItems();
            bm.CloseAllBags();

            if (placed)
            {
                Character.ReplaceCurrentlyEquipped(E, slot);
                return true;
            }

            return false;
        }
コード例 #18
0
ファイル: Character.cs プロジェクト: uvbs/babbot
 public static void SetCurrent(string slot, EasyItem i)
 {
     CurrentlyEquipped[slot] = i;
 }
コード例 #19
0
ファイル: Character.cs プロジェクト: gaknoia/babbot
 public static void RemoveCurrentlyEquipped(EasyItem E)
 {
     if (E == null) return;
     if (CurrentlyEquipped == null || CurrentlyEquipped.Count < 1) return;
     if (CurrentlyEquipped.ContainsKey(E.Item.Slot))
     {
         CurrentlyEquipped.Remove(E.Item.Slot);
     }
 }
コード例 #20
0
        public static bool IsUsable(EasyItem E)
        {
            bool usable      = false;
            int  PlayerLevel = GPlayerSelf.Me.Level;

            if (E.Item.Type.Equals("Armor"))
            {
                if (E.Item.SubType.Equals("Shields") && UseShield)
                {
                    usable = true;
                }
                else if (E.Item.SubType.Equals("Cloaks"))
                {
                    usable = true;
                }
                else
                {
                    switch (GPlayerSelf.Me.PlayerClass.ToString())
                    {
                    case "Warrior":
                        if (ArmorUpgrade && PlayerLevel > 40 && E.Item.SubType.Equals("Plate Armor"))
                        {
                            usable = true;
                        }
                        else if (E.Item.SubType.Equals("Plate Armor"))
                        {
                            usable = false;
                        }
                        else
                        {
                            usable = true;
                        }
                        break;

                    case "Paladin":
                        if (ArmorUpgrade && PlayerLevel > 40 && E.Item.SubType.Equals("Plate Armor"))
                        {
                            usable = true;
                        }
                        else if (E.Item.SubType.Equals("Plate Armor"))
                        {
                            usable = false;
                        }
                        else
                        {
                            usable = true;
                        }
                        break;

                    case "Shaman":
                        if (ArmorUpgrade && PlayerLevel > 40 && E.Item.SubType.Equals("Mail Armor"))
                        {
                            usable = true;
                        }
                        else if (E.Item.SubType.Equals("Plate Armor"))
                        {
                            usable = false;
                        }
                        else if (E.Item.SubType.Equals("Mail Armor"))
                        {
                            usable = false;
                        }
                        else
                        {
                            usable = true;
                        }
                        break;

                    case "Hunter":
                        if (ArmorUpgrade && PlayerLevel > 40 && E.Item.SubType.Equals("Mail Armor"))
                        {
                            usable = true;
                        }
                        else if (E.Item.SubType.Equals("Plate Armor"))
                        {
                            usable = false;
                        }
                        else if (E.Item.SubType.Equals("Mail Armor"))
                        {
                            usable = false;
                        }
                        else
                        {
                            usable = true;
                        }
                        break;

                    case "Rogue":
                        if (E.Item.SubType.Equals("Plate Armor"))
                        {
                            usable = false;
                        }
                        else if (E.Item.SubType.Equals("Mail Armor"))
                        {
                            usable = false;
                        }
                        else
                        {
                            usable = true;
                        }
                        break;

                    case "Druid":
                        if (E.Item.SubType.Equals("Plate Armor"))
                        {
                            usable = false;
                        }
                        else if (E.Item.SubType.Equals("Mail Armor"))
                        {
                            usable = false;
                        }
                        else
                        {
                            usable = true;
                        }
                        break;

                    default:     // Priest, Mage and Warlock
                        if (E.Item.SubType.Equals("Plate Armor"))
                        {
                            usable = false;
                        }
                        else if (E.Item.SubType.Equals("Mail Armor"))
                        {
                            usable = false;
                        }
                        else if (E.Item.SubType.Equals("Leather Armor"))
                        {
                            usable = false;
                        }
                        else
                        {
                            usable = true;
                        }
                        break;
                    }
                }
            }
            else if (E.Item.Type.Equals("Weapons"))
            {
                if (WeaponSkills.Contains(E.Item.SubType))
                {
                    usable = true;
                }
                else
                {
                    usable = false;
                }
            }
            else
            {
                usable = false;
            }
            if (!usable)
            {
                PPather.WriteLine(String.Format("ItemCompare: SubType [{0}] is not usable, skipping {1}", E.Item.SubType, E.RealName));
                GContext.Main.Debug(String.Format("ItemCompare: SubType [{0}] is not usable, skipping {1}", E.Item.SubType, E.RealName));
            }
            return(usable);
        }
コード例 #21
0
ファイル: Character.cs プロジェクト: gaknoia/babbot
        public static void ReplaceCurrentlyEquipped(EasyItem E)
        {
            if (E == null) return;
            EasyItem w = null;
            if (CurrentlyEquipped == null || CurrentlyEquipped.Count < 1) return;
            if (CurrentlyEquipped.ContainsKey(E.Item.Slot))
            {
                w = GetCurrent(E.Item.Slot);
                CurrentlyEquipped.Remove(E.Item.Slot);
            }

            SetCurrent(E.Item.Slot, E);
            string oldName = "null";
            if (w != null && w.Item != null) oldName = w.GItem.Name;
            if (w != null && w.GItem != null)
            {
                PPather.AutoEquipForceSell.Add(w.GItem.GUID);
                GContext.Main.Debug(String.Format("Character: Added {0} to ForceSell list", w.GItem.Name));
            }
            PPather.WriteLine(String.Format("Character: Replaced {0} with {1} in CurrentlyEquipped", oldName, E.GItem.Name));
            //EasyItem w = GetCurrent(E.Item.Slot, true);
            //if (w == null) CurrentlyEquipped.Add(E.Item.Slot,E);
            //else
            //{
            //    CurrentlyEquipped.Remove(w.Item.Slot);
            //    SetCurrent(E.Item.Slot,E);
            //    PPather.WriteLine(String.Format("Character: Replaced {0} with {1} in CurrentlyEquipped", w.Item.Name, E.RealName));
            //}
        }
コード例 #22
0
ファイル: Character.cs プロジェクト: gaknoia/babbot
 public static void SetCurrent(string slot, EasyItem i)
 {
     CurrentlyEquipped[slot] = i;
 }
コード例 #23
0
ファイル: Inventory.cs プロジェクト: iwaitu/babbot
        public static bool Equip(EasyItem E, bool EquipBOE)
        {
            PPather.WriteLine(LOG_CATEGORY.INFORMATION,"Equip: Attempting to equip {0}",E.RealName);
            BagManager bm = new BagManager();

            //PPather.WriteLine(String.Format("AutoEquipTask: Equipping {0} (GITem name: {1}", E.RealName, E.GItem.Name));
            if (!bm.ClickItem(E.GItem, true))
            {
                PPather.WriteLine(String.Format("Equip: BagManger failed to click item ({0}). Aborting...",E.RealName));
                GContext.Main.Debug(String.Format("Equip: BagManger failed to click item ({0}). Aborting...",E.RealName));
                return false;
            }
            Thread.Sleep(1000);
            string BOEButton = "StaticPopup1Button2";
            if (EquipBOE)
                BOEButton = "StaticPopup1Button1";
            GInterfaceObject AcceptBOE = GContext.Main.Interface.GetByName(BOEButton);
            if (AcceptBOE != null && AcceptBOE.IsVisible)
            {
                GContext.Main.EnableCursorHook();
                AcceptBOE.Hover();
                AcceptBOE.ClickMouse(false);
                GContext.Main.DisableCursorHook();
                GContext.Main.ClearTarget();
                if (EquipBOE)
                {
                    PPather.WriteLine("Equip: Accepted BOE for " + E.RealName);
                    GContext.Main.Debug("Equip: Accepted BOE for " + E.RealName);
                    bm.CloseAllBags();
                    bm.UpdateItems();
                    //Character.SetCurrent(E.Item.Slot, E, true);
                    Character.ReplaceCurrentlyEquipped(E);
                    return true;
                }
                else
                {
                    PPather.WriteLine("Equip: Declined BOE for " + E.RealName);
                    GContext.Main.Debug("Equip: Declined BOE for " + E.RealName);
                    bm.CloseAllBags();
                    bm.UpdateItems();
                    return false;
                }
            }
            Character.ReplaceCurrentlyEquipped(E);
            bm.UpdateItems();
            bm.CloseAllBags();
            return true;
        }
コード例 #24
0
ファイル: Character.cs プロジェクト: gaknoia/babbot
        public static void GetEquippedItems()
        {
            GItemHelper GIH = new GItemHelper();

            if (CharacterSlots == null)
                CharacterSlots = GetCharacterSlots();

            CharacterFrame.ShowFrame();
            foreach (string slot in CharacterSlots)
            {
                string tooltipName = "none";
                PPather.Debug("\n\n == SLOT LOOKUP FOR {0} START ==", slot);
                List<string> tooltip = CharacterFrame.GetTooltip(slot);
                if (tooltip != null && tooltip.Count > 0)
                {
                    //foreach (string tip in tooltip)
                    //    PPather.WriteLine("Character: Tooltip[{0}]\t=>\t{1}", slot, tip);
                    tooltipName = tooltip[tooltip.Count - 1];
                }
                PPather.Debug("Character: Name for {0} = {1}", slot, tooltipName);
                if (tooltip == null || IsEmptySlotName(tooltipName))
                {
                    AddNullSlot(slot);
                }
                else
                {
                    Item i = ItemManager.get(tooltipName);
                    if (i == null)
                    {
                        AddNullSlot(slot);
                    }
                    else
                    {
                        GItem Item = (GItem)GObjectList.FindObject(GIH.GetEquippedGUID(slot));
                        if (Item == null) continue;
                        EasyItem E = new EasyItem(Item, i, Item.GUID, tooltipName);
                        try
                        {
                            CurrentlyEquipped.Add(slot,E);
                            PPather.WriteLine(LOG_CATEGORY.INFORMATION,"Character: Item [{0}] equipped in '{1}'", tooltipName, slot);
                            PPather.Debug(String.Format("ToolTip[{0}]: {1}", i.Name, CleanToolTip(tooltip)));
                        }
                        catch (ArgumentException)
                        {
                            PPather.Debug("Character: " + tooltipName + " is already added to CurrentlyEquipped (skipping)");
                        }
                    }
                }
                PPather.Debug("\n=== SLOT LOOKUP FOR {0} END ===\n", slot);
            }
            CharacterFrame.HideFrame();
        }
コード例 #25
0
ファイル: ItemCompare.cs プロジェクト: gaknoia/babbot
 public static bool CompareGear(EasyItem E, string item)
 {
     eq_item_score = 0;
     new_item_score = 0;
     if (!initialized) return false;
     if (E == null && E.Item == null) return false;
     if (IsEquippable(E))
     {
         if(IsWanted(E))
         {
             if(!IsProtected(E))
             {
                 if(IsUsable(E))
                 {
                     PPather.Debug("CompareGear: checking {0} (Type={1}, SubType={2}, Slot={3})", E.RealName, E.Item.Type, E.Item.SubType, E.Item.Slot);
                     return Compare(E, item);
                 }
             }
         }
     }
     return false;
 }
コード例 #26
0
ファイル: Inventory.cs プロジェクト: iwaitu/babbot
        public static void CompareAndEquipBags(EasyItem[] C)
        {
            RankedBag[] RankedBags = new RankedBag[C.Length + 4];
            //PPather.WriteLine(String.Format("AutoEquip: RankedBags.Length = {0}", RankedBags.Length));
            //PPather.WriteLine(String.Format("AutoEquip: containers.Count = {0}", C.Length));
            //PPather.WriteLine(String.Format("AutoEquip: GPlayerSelf.Me.Bags.Length = {0}", 4));

            /* add bags found in inventory */
            GItem[] Items = GObjectList.GetItems();
            List<long> added = new List<long>();
            int nr = 0;
            for (nr = 0; nr < C.Length; nr++)
            {
                if (!Inventory.IsEquippedBag(C[nr].GUID) && !added.Contains(C[nr].GUID))
                {
                    GContainer bag = (GContainer)GObjectList.FindObject(C[nr].GUID);
                    string SlotName = Inventory.GetBagSlotName(C[nr].GItem);
                    RankedBag b = new RankedBag(1, bag.SlotCount, bag, C[nr].GItem, SlotName);
                    RankedBags[nr] = b;
                    //PPather.WriteLine("AutoEquip: (inventory) RankedBags[{0}] = {1} (SlotCount={2}, GUID={3})", nr, C[nr].Item.Name, bag.SlotCount, C[nr].GUID);
                    added.Add(C[nr].GUID);
                }
            }

            /* add already equipped bags */
            nr = C.Length;
            foreach (GItem Item in Items)
            {
                if (Item.Type.ToString() == "Container" && Inventory.IsEquippedBag(Item.GUID) && !added.Contains(Item.GUID))
                {
                    GContainer bag = (GContainer)GObjectList.FindObject(Item.GUID);
                    string SlotName = Inventory.GetBagSlotName(Item);
                    RankedBag b = new RankedBag(0, bag.SlotCount, bag, Item, SlotName);
                    RankedBags[nr] = b;
                    //PPather.WriteLine("AutoEquip: (eqiupped) RankedBags[{0}] = {1} (SlotCount={2}, GUID={3})", nr, Item.Name, bag.SlotCount, Item.GUID);
                    added.Add(Item.GUID);
                    nr++;
                }
            }

            /* add the empty slots */
            int freeslots = 0;
            while (nr < (C.Length + 4))
            {
                RankedBag b = new RankedBag(0, 0, null, null, null);
                RankedBags[nr] = b;
                nr++;
                freeslots++;
            }

            /* sort bags on slotcount */
            Array.Sort(RankedBags);

            /* DEBUG print of ranks */
            //for (int k = 0; k < RankedBags.Length; k++)
            //{
            //    RankedBag rb = RankedBags[k];
            //    if (rb != null)
            //    {
            //        string name = "null";
            //        if (rb.item != null) name = rb.item.Name;
            //        PPather.WriteLine(String.Format("AutoEquip: Rank {0} => {1}({2})", k, name, rb.slots));
            //    }
            //}

            /* get the bag slot names to replace (reverse sort) */
            List<string> slots = new List<string>();
            for (int j = RankedBags.Length - 1; j >= 0; j--)
            {
                RankedBag r = RankedBags[j];
                if (r == null) continue;
                if (r.slotname == null) continue;
                string name = "null";
                if (r.item != null) name = r.item.Name;
                slots.Add(r.slotname);
                //PPather.WriteLine("AutoEquip: Rank {0} of BagSlot to replace is {1} ({2})", slots.Count, r.slotname, name);
            }
            String[] BagSlots = slots.ToArray();
            int ReplaceSlotIndex = 0;

            /* go through RankedBags and make sure the top 4 ranked bags are equipped */
            int index = 0; int equipped = 0;
            while (index < 4)
            {
                //PPather.WriteLine("AutoEquip: index={0}, equipped={1}, freeslots={2}", index, equipped, freeslots);
                RankedBag r = RankedBags[index];
                if (r != null)
                {
                    string name = "null";
                    if (r.item != null) name = r.item.Name;
                    if (r.location == 0)
                    {
                        //PPather.WriteLine("AutoEquip: {0} rank[{1}] is equipped", name, index);
                    }
                    else if (freeslots > 0)
                    {
                        //PPather.WriteLine("AutoEquip: {0} rank[{1}] is new bag", name, index);
                        EquipBag(r.item, true, null);
                        equipped++;
                        freeslots--;
                    }
                    else
                    {
                        //PPather.WriteLine("AutoEquip: {0} rank[{1}] is better bag", name, index);
                        EquipBag(r.item, false, BagSlots[ReplaceSlotIndex]);
                        equipped++;
                        ReplaceSlotIndex++;
                    }
                }
                index++;
            }
        }
コード例 #27
0
        public static bool IsProtected(EasyItem E)
        {
            string failsafe1 = E.Item.Slot;
            string failsafe2 = E.Item.Slot;

            if (failsafe1 == null)
            {
                failsafe1 = "";
            }
            if (failsafe2 == null)
            {
                failsafe2 = "";
            }
            try
            {
                failsafe1.Replace("slot", "");
            }
            catch { }

            try
            {
                failsafe2.Replace("Slot", "");
            }
            catch { }

            if (ProtectedSlots.Contains(E.Item.Slot) || ProtectedSlots.Contains(failsafe1) || ProtectedSlots.Contains(failsafe2))
            {
                /*
                 * protected by slot
                 */
                PPather.WriteLine(String.Format("ItemCompare: Slot [{0}] is protected, skipping {1}", E.Item.Slot, E.RealName));
                GContext.Main.Debug(String.Format("ItemCompare: Slot [{0}] is protected, skipping {1}", E.Item.Slot, E.RealName));
                return(true);
            }
            else
            {
                /*
                 * protected by quality
                 */
                if (!initialized)
                {
                    return(true);
                }
                if (E == null)
                {
                    return(false);
                }
                if (E.GItem == null)
                {
                    return(false);                 // wtf?
                }
                int max = Quality(MaxGearQuality);
                int iq  = 10;
                switch (E.GItem.Definition.Quality)
                {
                case GItemQuality.Unknown: iq = 10; break;

                case GItemQuality.Poor: iq = Quality("poor"); break;

                case GItemQuality.Common: iq = Quality("common"); break;

                case GItemQuality.Uncommon: iq = Quality("uncommon"); break;

                case GItemQuality.Rare: iq = Quality("rare"); break;

                case GItemQuality.Epic: iq = Quality("epic"); break;

                case GItemQuality.Legendary: iq = Quality("legendary"); break;

                case GItemQuality.Artifact: iq = Quality("artifact"); break;

                default: iq = 10; break;
                }


                if (iq > max)
                {
                    PPather.WriteLine(String.Format("ItemCompare: Quality [{0}] is protected, skipping {1}", E.GItem.Definition.Quality.ToString(), E.RealName));
                    GContext.Main.Debug(String.Format("ItemCompare: Quality [{0}] is protected, skipping {1}", E.GItem.Definition.Quality.ToString(), E.RealName));
                    return(true);
                }
            }
            return(false);
        }
コード例 #28
0
ファイル: Character.cs プロジェクト: uvbs/babbot
 public static void GetInventoryItems()
 {
     InventoryItems.Clear();
     bm.UpdateItemsSorted();
     for (int j = 0; j < bm.Bags.Length; j++)
     {
         //PPather.Debug("Charcater: Bags.Length = {0}",bm.Bags.Length);
         BagManager.Bag b = bm.Bags[j];
         if (b.count < 1)
         {
             continue;
         }
         //PPather.Debug("Characater: Bags[{0}] contains {1} items",j,b.I.Length);
         bm.OpenBag(b.bag);
         GItem[] Items = null;
         if (b.I != null)
         {
             Items = b.I;
         }
         if (Items == null || Items.Length < 1)
         {
             continue;
         }
         foreach (GItem Item in Items)
         {
             if (Item == null || Item.GUID == 0)
             {
                 continue;
             }
             PPather.Debug("\n\n == ITEM LOOKUP FOR {0} START ==", Item.Name);
             List <string> tooltip = GetTooltipOnOpenBags(Item);
             if (tooltip == null || tooltip.Count < 1)
             {
                 PPather.Debug("Character.GetInventoryItems: tooltip for {0} is emtpy", Item.Name);
             }
             else
             {
                 string tooltipName = tooltip[tooltip.Count - 1];
                 PPather.Debug("Character.GetInventoryItems: tooltip[0] for {0} is {1}", Item.Name, tooltipName);
                 Item i = ItemManager.get(tooltipName);
                 if (i == null)
                 {
                     PPather.Debug("Character: ItemManager return null, {0} most likely not equippable", tooltipName);
                     continue;
                 }
                 try
                 {
                     EasyItem E = new EasyItem(Item, i, Item.GUID, tooltipName);
                     InventoryItems.Add(Item.GUID, E);
                     PPather.WriteLine(Pather.LOG_CATEGORY.INFORMATION, "Character: {0} added to InventoryItems", tooltipName);
                     //PPather.WriteLine(String.Format("DEBUG: Item.Type = {0} , Item.Quality = {1}",E.GItem.Type.ToString(), E.GItem.Definition.Quality.ToString()));
                     //PPather.WriteLine(String.Format("Charcter: Item [{0}] found in bags", i.Name));
                     //PPather.WriteLine(String.Format("ToolTip[{0}]: {1}", i.Name, CleanToolTip(tooltip)));
                 }
                 catch (ArgumentException)
                 {
                     PPather.Debug("Character.GetInventoryItems: {0}({1}) is already added to InventoryItems (skipping)", tooltipName, Item.GUID);
                 }
             }
             PPather.Debug("\n=== ITEM LOOKUP FOR {0} END ===\n", Item.Name);
         }
     }
     bm.CloseAllBags();
 }
コード例 #29
0
        public static bool Compare(EasyItem E, string item)
        {
            if (!initialized)
            {
                return(false);
            }
            double   itemValue    = 0;
            double   equipValue   = 0;
            bool     IncludeArmor = false;
            EasyItem MainHand     = null;
            EasyItem SecondHand   = null;
            string   nameMain     = "none";
            string   nameSecond   = "none";

            EquipModifier EQ = new EquipModifier(GPlayerSelf.Me.PlayerClass.ToString(), ArmorUpgrade);

            // avoid some rare armor quest objects that sneaked through the tests earlier
            if (E.Item.Slot == null || E.Item.Slot.Equals("0"))
            {
                PPather.WriteLine(Pather.LOG_CATEGORY.INFORMATION, "Compare: Item slot is '0', {0} is most likely a quest armor", E.RealName);
                return(false);
            }

            /* check slot for equipped item */
            if (!E.Item.SubType.Equals("Rings") && ((E.Item.Type.Equals("Armor") || E.Item.SubType.Equals("Ranged")) && Character.GetCurrent(E.Item.Slot) == null) ||
                (E.Item.Type.Equals("Weapons") &&
                 ((Character.GetCurrent(Character.Slots.MainHand) == null) && (Character.GetCurrent(Character.Slots.SecondaryHand) == null)) ||
                 (E.Item.Slot.Equals(Character.Slots.Ranged) && Character.GetCurrent(Character.Slots.Ranged) == null)))
            {
                PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: No item found in {0}, we should equip this", E.Item.Slot);
                return(Inventory.Equip(E, EquipBOE));
            }

            /* get equipped item */
            EasyItem equipped = null;

            Character.CurrentlyEquipped.TryGetValue(E.Item.Slot, out equipped);

            if (equipped == null || equipped.Item == null)
            {
                /* if we didn't hit on the tests for no item above
                 * and equipped is read as null
                 * retun false as a failsafe, something is wrong
                 */
                return(false);
            }
            itemValue = ItemValue(E.Item, 0, EQ, false);

            /*
             * Compare against both slots if it's a Ring or Trinket
             */
            if (E.Item.Slot.Equals("Finger") || E.Item.Slot.Equals("Trinket"))
            {
                EasyItem Slot0 = null;
                if (Character.GetCurrent(Character.Slots.get(E.Item.Slot + "0")) != null)
                {
                    Character.CurrentlyEquipped.TryGetValue(Character.Slots.get(E.Item.Slot + "0"), out Slot0);
                }
                EasyItem Slot1 = null;
                if (Character.GetCurrent(Character.Slots.get(E.Item.Slot + "1")) != null)
                {
                    Character.CurrentlyEquipped.TryGetValue(Character.Slots.get(E.Item.Slot + "1"), out Slot1);
                }

                if (Slot0 == null)
                {
                    return(Inventory.Equip(E, EquipBOE, Character.Slots.get(E.Item.Slot + "0")));
                }
                if (Slot1 == null)
                {
                    return(Inventory.Equip(E, EquipBOE, Character.Slots.get(E.Item.Slot + "1")));
                }

                double slot0Value = 0;
                double slot1Value = 0;

                if (Slot0 != null)
                {
                    slot0Value = ItemValue(Slot0.Item, 0, EQ, false);
                }
                if (Slot1 != null)
                {
                    slot1Value = ItemValue(Slot1.Item, 0, EQ, false);
                }


                PPather.WriteLine(LOG_CATEGORY.DEBUG, "Compare: Ring or Trinket: [eq0] {0}({1}), [eq1] {2}({3}), [new] {4}({5})", Slot0.RealName, slot0Value, Slot1.RealName, slot1Value, E.RealName, itemValue);

                if (itemValue < slot0Value && itemValue < slot1Value)
                {
                    PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Ring or Trinket: SCORE [new] {0}({1}) WORSE than both [equipped] {2}({3}) and [equippped] {4}({5}) => DISREGARD", E.RealName, itemValue, Slot0.RealName, slot0Value, Slot1.RealName, slot1Value);
                    return(false);
                }
                else
                {
                    if (slot0Value < slot1Value)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Ring or Trinket: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, Slot0.RealName, slot0Value);
                        return(Inventory.Equip(E, EquipBOE, Character.Slots.get(E.Item.Slot + "0")));
                    }
                    else
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Ring or Trinket: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, Slot1.RealName, slot1Value);
                        return(Inventory.Equip(E, EquipBOE, Character.Slots.get(E.Item.Slot + "1")));
                    }
                }
            }
            else if (E.Item.Type.Equals("Weapons") || E.Item.SubType.Equals("Shields"))
            {
                /*
                 * Weapon comparsion logic
                 * If (Shield && MainHand != Two-Hand Weapon || PreferSheidl)
                 *   Compare against SecondaryHand
                 *
                 * If (Two-Hand Weapon || MainHand==TwoHanded && (Item == OneHand || Item == SecondaryHand))
                 *   Compare against sum of MainHand and SecondaryHand
                 *
                 * If (Dual-Wield Skill)
                 *   If(OneHand Weapon)
                 *     Compare against both MainHand and SecondaryHand
                 *   If(OffHand Weapon)
                 *     Compare against SecondaryHand
                 *
                 * If (OneHand Weapon)
                 *   Compare against MainHand slot (not OneHand slot)
                 *
                 * Else
                 *   Compare against MainHand
                 */


                /*
                 * Get Items currently equipped in MainHand and SecondaryHand slot
                 */
                if (Character.GetCurrent(Character.Slots.MainHand) != null)
                {
                    Character.CurrentlyEquipped.TryGetValue(Character.Slots.MainHand, out MainHand);
                    if (MainHand != null && MainHand.Item != null)
                    {
                        nameMain = MainHand.RealName;
                    }
                }
                if (Character.GetCurrent(Character.Slots.SecondaryHand) != null)
                {
                    Character.CurrentlyEquipped.TryGetValue(Character.Slots.SecondaryHand, out SecondHand);
                    if (SecondHand != null && SecondHand.Item != null)
                    {
                        nameSecond = SecondHand.RealName;
                    }
                }

                itemValue  = ItemValue(E.Item, E.Item.DPS * EQ.DPS, EQ, false);
                equipValue = 0;


                /* If a shield and we don't have a two-handed weapon equipped,
                 * compare against SecondaryHandSlot */
                if (E.Item.SubType.Equals("Shields") && (!IsTwoHanded(MainHand.Item.SubType) || PreferShield))
                {
                    equipValue = ItemValue(SecondHand.Item, SecondHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);
                    if (itemValue > equipValue)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Shield: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) AND MainHand is not Two-Handed Weapon OR PreferShield => EQUIP", E.RealName, itemValue, SecondHand.RealName, equipValue);
                        return(Inventory.Equip(E, EquipBOE));
                    }
                    else
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Shield: SCORE [new] {0}({1}) WORSE than [equipped] {2}({3}) OR MainHand is Two-Handed Weapon => DISREGARD", E.Item.Slot, E.RealName, itemValue, equipped.RealName, equipValue);
                        return(false);
                    }
                }
                /* If Two-Handed Weapon */
                else if (IsTwoHanded(E.Item.SubType) || (IsTwoHanded(MainHand.Item.SubType) && (E.Item.Slot.Equals(Character.Slots.OneHand) || E.Item.Slot.Equals(Character.Slots.SecondaryHand))))
                {
                    equipValue = 0;
                    if (MainHand != null)
                    {
                        equipValue += ItemValue(MainHand.Item, MainHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);
                    }
                    if (SecondHand != null)
                    {
                        equipValue += ItemValue(SecondHand.Item, SecondHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);
                    }
                    if (itemValue > equipValue)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Two-Handed: SCORE [new] {0}({1}) BETTER than SUM OF [equipped] {2} and [equipped] {3} ({4}) => EQUIP", E.RealName, itemValue, nameMain, nameSecond, equipValue);
                        return(Inventory.Equip(E, EquipBOE));
                    }
                    else
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Two-Handed: SCORE [new] {0}({1}) WORSE than SUM OF [equipped] {2} and [equipped] {3} (SUM: {4}) => DISREGARD", E.RealName, itemValue, nameMain, nameSecond, equipValue);
                        return(false);
                    }
                }
                /* If Dual-Wield skill*/
                else if (WeaponSkills.Contains("Dual-Wield") && E.Item.Slot.Equals(Character.Slots.OneHand))
                {
                    double mainValue   = 0;
                    double secondValue = 0;
                    if (MainHand != null)
                    {
                        mainValue = ItemValue(MainHand.Item, MainHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);
                    }
                    if (SecondHand != null)
                    {
                        secondValue = ItemValue(SecondHand.Item, SecondHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);
                    }

                    PPather.WriteLine(LOG_CATEGORY.DEBUG, "Compare: Dual-Wield: [eq0] {0}({1}), [eq1] {2}({3}), [new] {4}({5})", nameMain, mainValue, nameSecond, secondValue, E.RealName, itemValue);

                    if (itemValue < mainValue && itemValue < secondValue)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Dual-Wield: SCORE [new] {0}({1}) WORSE than both [equipped] {2}({3}) and [equippped] {4}({5}) => DISREGARD", E.RealName, itemValue, nameMain, mainValue, nameSecond, secondValue);
                        return(false);
                    }
                    else
                    {
                        if (mainValue < secondValue)
                        {
                            PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Dual-Wield: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, nameMain, mainValue);
                            return(Inventory.Equip(E, EquipBOE, Character.Slots.MainHand));
                        }
                        else
                        {
                            PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Dual-Wield: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, nameSecond, secondValue);
                            return(Inventory.Equip(E, EquipBOE, Character.Slots.SecondaryHand));
                        }
                    }
                }
                else if (E.Item.Slot.Equals(Character.Slots.OneHand))
                {
                    double mainValue = 0;
                    if (MainHand != null)
                    {
                        mainValue = ItemValue(MainHand.Item, MainHand.Item.DPS * EQ.DPS, EQ, IncludeArmor);
                    }

                    if (itemValue > mainValue)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Weapons ({0}): SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, nameMain, mainValue);
                        return(Inventory.Equip(E, EquipBOE, Character.Slots.MainHand));
                    }
                    else
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Weapons ({0}): SCORE [new] {0}({1}) WORSE than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, nameMain, mainValue);
                        return(false);
                    }
                }
                else
                {
                    equipValue = ItemValue(equipped.Item, 0, EQ, false);
                    if (itemValue > equipValue)
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Weapons ({0}): SCORE [new] {1}({2}) BETTER than [equipped] {3}({4}) => EQUIP", E.Item.Slot, E.RealName, itemValue, equipped.RealName, equipValue);
                        return(Inventory.Equip(E, EquipBOE));
                    }
                    else
                    {
                        PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Weapons ({0}): SCORE [new] {1}({2}) WORSE than [equipped] {3}({4}) => DISREGARD", E.Item.Slot, E.RealName, itemValue, equipped.RealName, equipValue);
                        return(false);
                    }
                }
            }
            else if (E.Item.Type.Equals("Armor"))
            {
                if (E.Item.Slot.Equals(Character.Slots.SecondaryHand) && IsTwoHanded(MainHand.Item.SubType))
                {
                    PPather.WriteLine(LOG_CATEGORY.INFORMATION, " Compare: Can't Equip {0} with Two-Handed Weapons ({1}) ==> DISREGARD", E.RealName, nameMain);
                    return(false);
                }
                /* include armor value if any of the item are of preferred type */
                if (equipped.Item.SubType.Replace(" Armor", "").Equals(EQ.WantedArmor) ||
                    E.Item.SubType.Replace(" Armor", "").Equals(EQ.WantedArmor))
                {
                    IncludeArmor = true;
                }

                /* include armor if both of the items are of wrong type */
                else if (!equipped.Item.SubType.Replace(" Armor", "").Equals(EQ.WantedArmor) &&
                         !E.Item.SubType.Replace(" Armor", "").Equals(EQ.WantedArmor))
                {
                    IncludeArmor = true;
                }

                else if (E.Item.Slot.Equals(Character.Slots.Back))
                {
                    IncludeArmor = true;
                }

                else
                {
                    IncludeArmor = false;
                }

                itemValue  = ItemValue(E.Item, 0, EQ, IncludeArmor);
                equipValue = ItemValue(equipped.Item, 0, EQ, IncludeArmor);


                eq_item_score  = equipValue;
                new_item_score = itemValue;

                if (itemValue > equipValue)
                {
                    PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: Armor: SCORE [new] {0}({1}) BETTER than [equipped] {2}({3}) => EQUIP", E.RealName, itemValue, equipped.RealName, equipValue);
                    return(Inventory.Equip(E, EquipBOE));
                }
                else
                {
                    PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Compare: {0}: SCORE [new] {1}({2}) WORSE than [equipped] {3}({4}) => DISREGARD", E.Item.Slot, E.RealName, itemValue, equipped.RealName, equipValue);
                    return(false);
                }
            }
            else
            {
                PPather.WriteLine(LOG_CATEGORY.INFORMATION, "WTF?");
                return(false);
            }
        }
コード例 #30
0
        public static bool Equip(EasyItem E, bool EquipBOE, string slot)
        {
            PPather.WriteLine(LOG_CATEGORY.INFORMATION, "Equip: Attempting to equip {0} [{1}]", E.RealName, slot);
            bool       placed = false;
            BagManager bm     = new BagManager();

            CharacterFrame.ShowFrame();
            GInterfaceObject BagItemObject = null;
            GInterfaceObject TargetSlotObject;

            TargetSlotObject = GContext.Main.Interface.GetByName("Character" + slot);
            //PPather.WriteLine(LOG_CATEGORY.DEBUG, "Equip: TargetSlotObject = {0}", TargetSlotObject.LabelText);

            GItem[] Items = bm.GetAllItems();
            foreach (GItem Item in Items)
            {
                if (Item.GUID == E.GUID)
                {
                    Thread.Sleep(500);
                    BagItemObject = bm.GetItem(Item);
                    //PPather.WriteLine(LOG_CATEGORY.DEBUG, "Equip: BagItemObject = {0}", BagItemObject.LabelText);
                    //PPather.WriteLine("item: " + BagItemObject.ToString());
                    Functions.Drag(BagItemObject, TargetSlotObject);
                    placed = true;
                    Thread.Sleep(500);
                    string BOEButton = "StaticPopup1Button2";
                    if (EquipBOE)
                    {
                        BOEButton = "StaticPopup1Button1";
                    }

                    GInterfaceObject ButtonObject = GContext.Main.Interface.GetByName(BOEButton);
                    if (ButtonObject != null && ButtonObject.IsVisible)
                    {
                        if (!EquipBOE)
                        {
                            placed = false;
                        }
                        GContext.Main.EnableCursorHook();
                        ButtonObject.Hover();
                        ButtonObject.ClickMouse(false);
                        GContext.Main.DisableCursorHook();
                        GContext.Main.ClearTarget();
                    }
                }
            }

            CharacterFrame.HideFrame();

            /* put the old item in bags */
            if (GContext.Main.Interface.CursorItemType != GCursorItemTypes.None)
            {
                Functions.Click(BagItemObject);
            }

            bm.UpdateItems();
            bm.CloseAllBags();

            if (placed)
            {
                Character.ReplaceCurrentlyEquipped(E, slot);
                return(true);
            }

            return(false);
        }