private static TreeNode dumpUi_doChildren(ref GInterfaceObject gio) { // gio.Name is not defined... string s = gio.ToString(); s = s.Substring(s.IndexOf('"') + 1); s = s.Substring(0, s.IndexOf('"')); //if (s.EndsWith("Text") || s.Contains("Button")) string lblText = gio.LabelText; if (lblText != "(read failed)") { s += " \"" + lblText + "\""; } TreeNode node = new TreeNode(s); for (int i = 0; i < gio.Children.Length; i++) { if (form.dumpUiVisibleCB.Checked && !gio.Children[i].IsVisible) { continue; } TreeNode childNode = dumpUi_doChildren(ref gio.Children[i]); node.Nodes.Add(childNode); } return(node); }
//BagNr is 0-4, ItemNr is 1-BagSlots public bool ClickItem(int BagNr, int ItemNr, GItem item, bool RightMouse) { ClickItem: if (tries >= 4) { tries = 1; PPather.WriteLine(LOG_CATEGORY.INFORMATION, "BagManager: Tried to click {0} 3 times now and it didn't work. Aborting :-(", item.Name); return(false); } OpenBag(BagNr); Thread.Sleep(100); //PPather.WriteLine("BagManager: Click item " + BagNr + " " + ItemNr); String itemStr = "ContainerFrame1Item" + ItemNr; GInterfaceObject ItemObj = GContext.Main.Interface.GetByName(itemStr); if (ItemObj != null) { GContext.Main.EnableCursorHook(); ItemObj.Hover(); Thread.Sleep(100); GInterfaceObject ToolTip = GContext.Main.Interface.GetByName("GameTooltip"); if (ToolTip != null) { GInterfaceObject child = ToolTip.Children[0]; // PPather.WriteLine(child.ToString() + " with labeltext " + child.LabelText); if (child.ToString().Contains("GameTooltipTextLeft1")) { if (child.LabelText != item.Name) { PPather.WriteLine(LOG_CATEGORY.INFORMATION, "BagManger: Tried to click item {0} but found {1}. Will try again...", item.Name, child.LabelText); Thread.Sleep(100); GContext.Main.DisableCursorHook(); CloseAllBags(); CurrentOpenBag = -1; // PPather.WriteLine("BagManager: Retry number " + tries); tries++; Thread.Sleep(150); goto ClickItem; } } } GContext.Main.DisableCursorHook(); Functions.Click(ItemObj, RightMouse); return(true); } return(false); }
private static string GetGIOString(ref GInterfaceObject gio) { StringBuilder sb = new StringBuilder(); string s = String.Empty; try { s = gio.ToString(); if (!s.Contains("\"\"")) { s = s.Substring(s.IndexOf('"') + 1); s = s.Substring(0, s.IndexOf('"')); } sb.Append(s); } catch (Exception e) { s = String.Empty; sb.Append(String.Format("<Error: {0}>", e.Message)); } if (s.EndsWith("Text") || s.Contains("Button") || s.EndsWith("Label") || (s.Contains("Text") && !s.Contains("Texture"))) { try { sb.Append(String.Format(": {0}", gio.LabelText)); } catch (Exception e) { sb.Append(String.Format(": <Error: {0}>", e.Message)); } } return(sb.ToString()); }
private static string GetGIOString(ref GInterfaceObject gio) { StringBuilder sb = new StringBuilder(); string s = String.Empty; try { s = gio.ToString(); if (!s.Contains("\"\"")) { s = s.Substring(s.IndexOf('"') + 1); s = s.Substring(0, s.IndexOf('"')); } sb.Append(s); } catch (Exception e) { s = String.Empty; sb.Append(String.Format("<Error: {0}>", e.Message)); } if (s.EndsWith("Text") || s.Contains("Button") || s.EndsWith("Label") || (s.Contains("Text") && !s.Contains("Texture"))) { try { sb.Append(String.Format(": {0}", gio.LabelText)); } catch (Exception e) { sb.Append(String.Format(": <Error: {0}>", e.Message)); } } return sb.ToString(); }