public static void Click(GInterfaceObject lbtn, bool right) { if (lbtn != null && lbtn.IsVisible) { GContext.Main.EnableCursorHook(); lbtn.ClickMouse(right); GContext.Main.DisableCursorHook(); } }
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); }
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); }