예제 #1
0
파일: Character.cs 프로젝트: uvbs/babbot
        public static List <string> GetTooltipOnOpenBags(GItem item)
        {
            List <string>    text    = new List <string>();
            GInterfaceObject ItemObj = bm.GetItem(item);

            if (ItemObj != null)
            {
                GContext.Main.EnableCursorHook();
                ItemObj.Hover();
                Thread.Sleep(50);
                GInterfaceObject ToolTip = GContext.Main.Interface.GetByName("GameTooltip");
                if (ToolTip != null)
                {
                    foreach (GInterfaceObject child in ToolTip.Children)
                    {
                        if (child.ToString().Contains("GameTooltipText"))
                        {
                            text.Add(child.LabelText);
                        }
                    }
                }
                GContext.Main.DisableCursorHook();
            }
            return(text);
        }
예제 #2
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);
        }