protected override async Task <bool> RunAsync() { AtkAddonControl window = RaptureAtkUnitManager.GetWindowByName(_windowName); if (window == null) { PatternFinder patternFinder = new PatternFinder(Core.Memory); IntPtr agentVtable = patternFinder.Find(_agentOffset); int agentId = AgentModule.FindAgentIdByVtable(agentVtable); AgentModule.GetAgentInterfaceById(agentId).Toggle(); await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName(_windowName) != null); window = RaptureAtkUnitManager.GetWindowByName(_windowName); } if (window != null) { // Choose Dungeon window.SendAction(2, 3, 15, 4, (ulong)Dungeon - 1); await Coroutine.Sleep(250); // Register for Duty window.SendAction(1, 3, 14); } return(false); }
/// <summary> /// Sends a reset command to a window /// </summary> internal static async Task ClickReset(uint number) { if (number >= 2) { throw new ArgumentOutOfRangeException(); } if (IsOpen && !SD.Reset) { await Close(); } if (DeepDungeonMenu.IsOpen) { await DeepDungeonMenu.OpenResetMenu(); } Logger.Info("Clicking Reset slot {0} // {1}", number + 1, SD.Reset); await Coroutine.Wait(5000, () => IsOpen); AtkAddonControl window = RaptureAtkUnitManager.GetWindowByName(WindowNames.DDsave); window.SendAction(2, 3, number, 3, 2); await Coroutine.Wait(500, () => SelectYesno.IsOpen); await Coroutine.Sleep(500); //confirm that we want to delete this data. if (SelectYesno.IsOpen) { AtkAddonControl window1 = RaptureAtkUnitManager.GetWindowByName("SelectYesno"); window1.SendAction(1, 0, 1); } }
/* 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); }
/// <summary> /// clicks a save slot. number should be greater than 0 /// </summary> /// <param name="number"></param> internal static async Task ClickSaveSlot(uint number) { if (number >= 2) { throw new ArgumentOutOfRangeException(); } if (IsOpen && SD.Reset) { await Close(); } if (DeepDungeonMenu.IsOpen) { await DeepDungeonMenu.OpenSaveMenu(); } Logger.Info("Clicking Save slot {0} // {1}", number + 1, SD.Reset); await Coroutine.Wait(5000, () => IsOpen); AtkAddonControl window = RaptureAtkUnitManager.GetWindowByName(WindowNames.DDsave); window.SendAction(1, 3, number); await Coroutine.Yield(); }
protected async Task <bool> InitiateLeve() { // if (Core.Player.IsMounted) // { // ActionManager.Dismount(); // await Coroutine.Wait(20000, () => !Core.Player.IsMounted); // await Coroutine.Sleep(500); // } var patternFinder = new GreyMagic.PatternFinder(Core.Memory); IntPtr SearchResult = patternFinder.Find("48 8D 05 ? ? ? ? 48 89 54 24 ? 48 89 03 Add 3 TraceRelative"); int agent = AgentModule.FindAgentIdByVtable(SearchResult); AgentModule.ToggleAgentInterfaceById(agent); await Coroutine.Sleep(500); AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName("JournalDetail"); while (windowByName == null) { await Coroutine.Sleep(500); windowByName = RaptureAtkUnitManager.GetWindowByName("JournalDetail"); } if (windowByName != null) { var leves = LeveManager.Leves; if (leves.Length > 0) { foreach (ff14bot.Managers.LeveWork leve in leves) { if (leve.GlobalId == LeveId && leve.Step == 1) { ulong globalId = (ulong)leve.GlobalId; windowByName.SendAction(3, 3, 0xC, 3, globalId, 3, 2); //Set Quest await Coroutine.Sleep(200); windowByName.SendAction(2, 3, 4, 4, globalId); //Initiate if (await Coroutine.Wait(10000, () => SelectYesno.IsOpen)) { SelectYesno.ClickYes(); } await Coroutine.Sleep(2000); RaptureAtkUnitManager.GetWindowByName("GuildLeveDifficulty").SendAction(1, 3, 0); await Coroutine.Sleep(3000); break; } } } windowByName = RaptureAtkUnitManager.GetWindowByName("JournalDetail"); if (windowByName != null) { AgentModule.ToggleAgentInterfaceById(agent); } } return(_done = true); }
public static ushort ElementCount(string name) { AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(name); if (windowByName != null) { return(Core.Memory.Read <ushort>(windowByName.Pointer + offset0)); } return(0); }
private static TwoInt[] ___Elements(AtkAddonControl WindowByName) { if (WindowByName == null) { return(null); } var elementCount = ElementCount(WindowByName); var addr = Core.Memory.Read <IntPtr>(WindowByName.Pointer + Offset2); return(Core.Memory.ReadArray <TwoInt>(addr, elementCount)); }
internal static async Task OpenResetMenu() { AtkAddonControl wind = RaptureAtkUnitManager.GetWindowByName(WindowNames.DDmenu); if (wind == null) { throw new Exception( "Open Reset Menu Failed. POTD Menu is not open. (The bot will attempt to correct this issue)"); } wind.SendAction(1, 3, 1); await Coroutine.Wait(3000, () => DeepDungeonSaveData.IsOpen); }
public static TwoInt[] ___Elements(string name) { AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName(name); if (windowByName != null) { ushort elementCount = ElementCount(name); IntPtr addr = Core.Memory.Read <IntPtr>(windowByName.Pointer + offset2); return(Core.Memory.ReadArray <TwoInt>(addr, elementCount)); } return(null); }
public static SendActionResult TrySendAction(this AtkAddonControl window, int pairCount, params uint[] param) { if (window == null || !window.IsValid) { return(SendActionResult.InvalidWindow); } try { window.SendAction(pairCount, param); return(SendActionResult.Success); } catch (Exception ex) { Logger.Instance.Error(ex.Message); return(SendActionResult.InjectionError); } }
internal static async Task OpenSaveMenu() { AtkAddonControl menu = RaptureAtkUnitManager.GetWindowByName(WindowNames.DDmenu); if (menu == null) { return; } try { menu.SendAction(1, 3, 0); await Coroutine.Wait(3000, () => DeepDungeonSaveData.IsOpen); } catch (Exception ex) { Logger.Verbose("{0}", ex); } }
private async Task <bool> Reduction() { //Reduce if (ReduceSettings.Instance.AEZoneCheck && ReduceSettings.Instance.AEZone != 0) { if (WorldManager.ZoneId != (ushort)ReduceSettings.Instance.AEZone) { return(false); } await Coroutine.Sleep(5000); } await GeneralFunctions.StopBusy(false, true, true); while (InventoryManager.FilledSlots.Any(x => inventoryBagIds.Contains(x.BagId) && x.IsReducable)) //&& WorldManager.ZoneId == (ushort) ReduceSettings.Instance.AEZone ) { var item = InventoryManager.FilledSlots.FirstOrDefault(x => inventoryBagIds.Contains(x.BagId) && x.IsReducable); if (item == null) { break; } Log($"Reducing - Name: {item.Item.CurrentLocaleName}"); item.Reduce(); await Coroutine.Wait(20000, () => Core.Memory.Read <uint>(Offsets.Conditions + Offsets.DesynthLock) != 0); await Coroutine.Wait(20000, () => Core.Memory.Read <uint>(Offsets.Conditions + Offsets.DesynthLock) == 0); } AtkAddonControl windowByName = RaptureAtkUnitManager.GetWindowByName("PurifyResult"); if (windowByName != null) { windowByName.SendAction(1, 3uL, 4294967295uL); } return(true); }
public override async Task<bool> Prepare(GatherCollectableTag tag) { await tag.CastAura(Ability.CollectorsGlove, AbilityAura.CollectorsGlove); var ticks = 0; do { await Wait(); if (!tag.GatherItem.TryGatherItem()) { return false; } } while (ticks++ < 10 && (MasterpieceWindow = await GetValidMasterPieceWindow(3000)) == null && Behaviors.ShouldContinue); if (ticks >= 10) { Logging.WriteDiagnostic(Colors.Red, "Timed out during collectable preparation"); } return true; }
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 static ushort ElementCount(AtkAddonControl WindowByName) { return(WindowByName != null?Core.Memory.Read <ushort>(WindowByName.Pointer + Offset0) : (ushort)0); }
protected Window(string name) { Name = name; control = RaptureAtkUnitManager.GetWindowByName(name); }
public TWindow Refresh() { updateWindows(); control = RaptureAtkUnitManager.GetWindowByName(Name); return((TWindow)this); }
public GameWindowBase Refresh() { RaptureAtkUnitManager.Update(); control = RaptureAtkUnitManager.GetWindowByName(Name); return(this); }
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; }
public override async Task<bool> Gather(GatherCollectableTag tag) { var rarity = CurrentRarity; while (tag.Node.CanGather && GatheringManager.SwingsRemaining > 0 && rarity > 0 && Behaviors.ShouldContinue) { while (!SelectYesNoItem.IsOpen && tag.Node.CanGather && GatheringManager.SwingsRemaining > 0 && rarity > 0 && Behaviors.ShouldContinue) { if (MasterpieceWindow == null || !MasterpieceWindow.IsValid) { RaptureAtkUnitManager.Update(); MasterpieceWindow = await GetValidMasterPieceWindow(3000); } var itemRarity = rarity = CurrentRarity; if (SelectYesNoItem.CollectabilityValue >= itemRarity) { await Coroutine.Wait(1000, () => SelectYesNoItem.CollectabilityValue < itemRarity); } if (MasterpieceWindow != null && MasterpieceWindow.IsValid) { MasterpieceWindow.SendAction(1, 1, 0); } await Coroutine.Wait(1000, () => SelectYesNoItem.IsOpen); } await Coroutine.Yield(); var swingsRemaining = GatheringManager.SwingsRemaining - 1; while (SelectYesNoItem.IsOpen && rarity > 0 && Behaviors.ShouldContinue) { var itemRarity = rarity = CurrentRarity; if (SelectYesNoItem.CollectabilityValue < itemRarity) { await Coroutine.Wait(4000, () => SelectYesNoItem.CollectabilityValue >= itemRarity); } Logging.Write( Colors.Chartreuse, "GatherCollectable: Collected item: {0}, value: {1} at {2} ET", tag.GatherItem.ItemData.EnglishName, SelectYesNoItem.CollectabilityValue, WorldManager.EorzaTime); SelectYesNoItem.Yes(); await Coroutine.Wait(1000, () => !SelectYesNoItem.IsOpen); } var ticks = 0; while (swingsRemaining != GatheringManager.SwingsRemaining && ticks < 60 && Behaviors.ShouldContinue) { await Coroutine.Yield(); ticks++; } } return true; }