/* Can Also do this: Will pull the same offsets Mastahg stores in RB * var off = typeof(Core).GetProperty("Offsets", BindingFlags.NonPublic | BindingFlags.Static); * var struct158 = off.PropertyType.GetFields()[72]; * var offset0 = (int)struct158.FieldType.GetFields()[0].GetValue(struct158.GetValue(off.GetValue(null))); * var offset2 = (int)struct158.FieldType.GetFields()[2].GetValue(struct158.GetValue(off.GetValue(null))); */ public static int GetAgentInterfaceId() { AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(WindowName); if (windowByName == null) { return(0); } var test = windowByName.TryFindAgentInterface(); if (test == null) { return(0); } for (int i = 0; i < AgentModule.AgentPointers.Count; i++) { if (test.Pointer.ToInt64() == AgentModule.AgentPointers.ToArray()[i].ToInt64()) { return(i); } } return(0); }
private void button6_Click(object sender, EventArgs e) { listBox3.Items.Clear(); var windowName = ((string)listBox1.SelectedItem).Trim(); if (windowName == "ItemSearch") { AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(windowName); var test = windowByName.TryFindAgentInterface(); var agentPointer = test.Pointer; if (windowByName != null) { int count = ItemSearch.GetCount(agentPointer); richTextBox1.Text += $"Number of Results: {count}\n"; var items = ItemSearch.ReadResults(agentPointer, count).Where(i => i.itemPointer.ToInt64() != 0); foreach (var result in items) { string name = Core.Memory.ReadString(result.itemPointer + 0xa0, Encoding.UTF8); listBox3.Items.Add($"{name} ({result.count})"); } } } /* var windowName = "RetainerSell"; * AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(windowName); * if (windowByName != null) * { * var agent = windowByName.TryFindAgentInterface(); * var agentPointer = agent.Pointer; * int price = Core.Memory.Read<int>(agentPointer + 0x4b74); * int qty = Core.Memory.Read<int>(agentPointer + 0x4b78); * string outS = string.Format("Price {0} Qty {1}", price, qty); * }*/ }
private void button2_Click(object sender, EventArgs e) { listBox2.Items.Clear(); listBox3.Items.Clear(); //ActionManager.DoAction(11385, GameObjectManager.GetObjectByNPCId(1026934)); richTextBox1.Text = ""; var windowName = ((string)listBox1.SelectedItem).Trim(); //AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(windowName); //string windowName = windowByName.Name; //ff14bot.Managers.AgentModule.AgentPointers[310] //listBox1.Items.Add($"{AgentModule.AgentPointers[310].ToInt64():X}"); LlamaUI.Log($"{windowName} Selected"); var elements = LlamaUI.___Elements(windowName); using (var outputFile = new StreamWriter($"{windowName}.cvs", false)) { for (var j = 0; j < elements.Length; j++) { var i = elements[j]; string data; //Log(i+ " " ); if (i.Type == 6 || i.Type == 8 || i.Type == 38) { //byte[] source = Core.Memory.ReadBytes((IntPtr)i.Data, 16); //byte[] bytes = Encoding.Convert(Encoding.UTF8, Encoding.Unicode, source.ToArray()); //string @string = Encoding.Unicode.GetString(bytes); data = Core.Memory.ReadString((IntPtr)i.Data, Encoding.UTF8); } //listBox3.Items.Add($"[{j}:{i.Type}] ({tstring})"); else if (i.Type == 4) { data = $"{i.TrimmedData}"; } //listBox3.Items.Add($"[{j}:{i.Type}] {i.TrimmedData}"); else { data = $"{i.Data}({i.TrimmedData})"; } listBox2.Items.Add($"[{j}:{i.Type}] {data}"); IntPtr ptr = (IntPtr)i.Data; outputFile.WriteLine($"{j},{i.Type},{i.Data},{i.TrimmedData},{data},{ptr.ToInt64():X}"); LlamaUI.Log($"{windowName}.cvs Written"); } } AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(windowName); if (windowByName != null) { // Core.Memory.GetRelative() AgentInterface test; try { test = windowByName.TryFindAgentInterface(); richTextBox1.Text += $"Agent ID is: {test.Id}\n"; richTextBox1.Text += $"Pointer: {test.Pointer.ToInt64():X} \nAgent Vtable: {test.VTable.ToInt64():X} \nVtableOffset {Core.Memory.GetRelative(test.VTable).ToInt64():X}\n"; } catch { } richTextBox1.Text += $"Window Pointer: {windowByName.Pointer.ToInt64():X} \nWindow Vtable: {windowByName.VTable.ToInt64():X} \nVtableOffset {Core.Memory.GetRelative(windowByName.VTable).ToInt64():X}\n"; //var test = AgentModule.GetAgentInterfaceById(99); // test.Toggle(); // var testbyte = Core.Memory.Read<byte>(test.Pointer + 0x10); // richTextBox1.Text += $"{testbyte}"; //richTextBox1.Text += $"Size is: {sizeof(ResultLayout)}\n"; } button2.Enabled = false; button3.Enabled = true; }