예제 #1
0
파일: Inventory.cs 프로젝트: iwaitu/babbot
 public static void CheckForScrollsAndElixirs()
 {
     /* check inventory for srolls and elixirs */
     Regex elixirPattern = new Regex("Elixir of.*");
     Regex scrollPattern = new Regex("Scroll of.*");
     foreach (KeyValuePair<long, EasyItem> e in Character.InventoryItems)
     {
         int myLevel = GPlayerSelf.Me.Level;
         int itemLevel = Convert.ToInt32(e.Value.Item.Required);
         //PPather.WriteLine("AutoEquip: myLevel = {0} , itemLevel = {1} [{2}]", myLevel, itemLevel, e.Value.Item.Name);
         if (itemLevel <= myLevel)
         {
             Match m = scrollPattern.Match(e.Value.Item.Name);
             if (m.Success)
             {
                 BagManager bm = new BagManager();
                 GItem[] bagItems = bm.GetAllItems();
                 foreach (GItem bagItem in bagItems)
                 {
                     if (bagItem.Name.Equals(e.Value.Item.Name))
                     {
                         PPather.WriteLine("Inventory: using " + bagItem.Name);
                         GContext.Main.Debug("Inventory: using " + bagItem.Name);
                         if (!bm.ClickItem(bagItem, true))
                         {
                             PPather.WriteLine("Inventory: BagManger failed to click the item. Aborting...");
                             break;
                         }
                         Thread.Sleep(500);
                         break;
                     }
                 }
                 bm.CloseAllBags();
                 bm.UpdateItems();
                 continue;
             }
             m = elixirPattern.Match(e.Value.Item.Name);
             if (m.Success)
             {
                 BagManager bm = new BagManager();
                 GItem[] bagItems = bm.GetAllItems();
                 foreach (GItem bagItem in bagItems)
                 {
                     if (bagItem.Name.Equals(e.Value.Item.Name))
                     {
                         PPather.WriteLine("Inventory: using " + bagItem.Name);
                         GContext.Main.Debug("Inventory: using " + bagItem.Name);
                         if (!bm.ClickItem(bagItem, true))
                         {
                             PPather.WriteLine("Inventory: BagManger failed to click the item. Aborting...");
                             break;
                         }
                         Thread.Sleep(500);
                         break;
                     }
                 }
                 bm.CloseAllBags();
                 bm.UpdateItems();
                 continue;
             }
         }
     }
 }
예제 #2
0
파일: Inventory.cs 프로젝트: iwaitu/babbot
 public static bool EquipNewBag(GItem Item)
 {
     BagManager bm = new BagManager();
     GContainer bag = (GContainer)GObjectList.FindObject(Item.GUID);
     if (bag != null)
     {
         bm.ClickItem(Item, true);
         for (int p = 1; p <= 4; p++)
         {
             if (Popup.IsVisible(p))
             {
                 String text = Popup.GetText(p);
                 PPather.WriteLine("Inventory: Got a popup ('" + text + "')");
                 if (text.Contains("will bind it to you"))
                 {
                     Popup.ClickButton(p, 1);
                 }
                 else
                 {
                     Popup.ClickButton(p, 2);
                 }
             }
         }
         bm.CloseAllBags();
         return true;
     }
     bm.CloseAllBags();
     return false;
 }
예제 #3
0
파일: Inventory.cs 프로젝트: iwaitu/babbot
 public static bool EquipNewBag()
 {
     if (HasFreeBagSlot())
     {
         GItem[] Items = GObjectList.GetItems();
         foreach (GItem Item in Items)
         {
             if (Item.Type.ToString() == "Container" && !IsEquippedBag(Item.GUID))
             {
                 GContainer bag = (GContainer)GObjectList.FindObject(Item.GUID);
                 if (bag != null)
                 {
                     BagManager bm = new BagManager();
                     bm.ClickItem(Item, true);
                     for (int p = 1; p <= 4; p++)
                     {
                         if (Popup.IsVisible(p))
                         {
                             String text = Popup.GetText(p);
                             PPather.WriteLine("Inventory: Got a popup ('" + text + "')");
                             if (text.Contains("will bind it to you"))
                             {
                                 Popup.ClickButton(p, 1);
                             }
                             else
                             {
                                 Popup.ClickButton(p, 2);
                             }
                         }
                     }
                     bm.CloseAllBags();
                     return true;
                 }
             }
         }
     }
     return false;
 }
예제 #4
0
파일: Inventory.cs 프로젝트: iwaitu/babbot
 public static bool EquipBetterBag()
 {
     GItem[] Items = GObjectList.GetItems();
     foreach (GItem Item in Items)
     {
         if (Item.Type.ToString() == "Container" && !IsEquippedBag(Item.GUID))
         {
             GContainer bag = (GContainer)GObjectList.FindObject(Item.GUID);
             if (bag != null)
             {
                 long[] AllBags = GPlayerSelf.Me.Bags;
                 for (int i = 0; i < AllBags.Length; i++)
                 {
                     GContainer cbag = (GContainer)GObjectList.FindObject(AllBags[i]);
                     if (cbag != null)
                     {
                         if (cbag.SlotCount < bag.SlotCount && !cbag.Name.ToString().ToLower().Contains("ammo") && !cbag.Name.ToString().ToLower().Contains("quiver"))
                         {
                             GInterfaceObject OldBag = GContext.Main.Interface.GetByName("CharacterBag" + i + "Slot");
                             BagManager bm = new BagManager();
                             bm.ClickItem(Item, false);
                             Functions.Click(OldBag, false);
                             for (int p = 1; p <= 4; p++)
                             {
                                 if (Popup.IsVisible(p))
                                 {
                                     String text = Popup.GetText(p);
                                     PPather.WriteLine("Inventory: Got a popup ('" + text + "')");
                                     if (text.Contains("will bind it to you"))
                                     {
                                         Popup.ClickButton(p, 1);
                                     }
                                     else
                                     {
                                         Popup.ClickButton(p, 2);
                                     }
                                 }
                             }
                             return true;
                         }
                     }
                 }
             }
         }
     }
     return true;
 }
예제 #5
0
파일: Inventory.cs 프로젝트: iwaitu/babbot
        public static bool EquipBetterBag(GItem Item, string BagSlotName)
        {
            GContainer bag = (GContainer)GObjectList.FindObject(Item.GUID);
            if (bag != null)
            {
                long[] AllBags = GPlayerSelf.Me.Bags;
                for (int i = 0; i < AllBags.Length; i++)
                {
                    GContainer cbag = (GContainer)GObjectList.FindObject(AllBags[i]);
                    if (cbag != null)
                    {

                        GInterfaceObject OldBag = GContext.Main.Interface.GetByName(BagSlotName);
                        BagManager bm = new BagManager();
                        bm.ClickItem(Item, false);
                        Functions.Click(OldBag, false);
                        for (int p = 1; p <= 4; p++)
                        {
                            if (Popup.IsVisible(p))
                            {
                                String text = Popup.GetText(p);
                                PPather.WriteLine("Inventory: Got a popup ('" + text + "')");
                                if (text.Contains("will bind it to you"))
                                {
                                    Popup.ClickButton(p, 1);
                                }
                                else
                                {
                                    Popup.ClickButton(p, 2);
                                }
                            }
                        }
                        bm.CloseAllBags();
                        return true;
                    }
                }
            }
            return false;
        }
예제 #6
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;
        }