internal async Task <VentureCheck> CheckRetainer() { foreach (var lines in SelectString.Lines()) { // TODO: Add CN 'in progress' text. if (lines.Contains("(Complete on ") || lines.Contains("(Abschluss am ") || lines.Contains("[Fin le ") || lines.Contains("確認 [~")) { return(VentureCheck.InProgress); } if (lines.EndsWith("(Complete)") || lines.EndsWith("Unternehmung einsehen") || lines.EndsWith("tâche terminée") || lines.EndsWith("[完了]") || lines.EndsWith("[探险归来]")) { // Click on the completed venture SelectString.ClickSlot(5); await Coroutine.Wait(5000, () => RetainerTaskResult.IsOpen); // Assign a new venture RetainerTaskResult.Reassign(); await Coroutine.Wait(5000, () => RetainerTaskAsk.IsOpen); // Confirm new venture RetainerTaskAsk.Confirm(); await Coroutine.Wait(5000, () => Talk.DialogOpen); // Skip dialog Talk.Next(); return(VentureCheck.Completed); } } return(VentureCheck.None); }
public async Task <bool> RetainerHandleVentures() { if (!SelectString.IsOpen) { return(false); } if (SelectString.Lines().Contains(Translator.VentureCompleteText)) { //Log("Venture Done"); SelectString.ClickLineEquals(Translator.VentureCompleteText); await Coroutine.Wait(5000, () => RetainerTaskResult.IsOpen); if (!RetainerTaskResult.IsOpen) { Log("RetainerTaskResult didn't open"); return(false); } var taskId = AgentRetainerVenture.Instance.RetainerTask; var task = VentureData.Value.FirstOrDefault(i => i.Id == taskId); if (task != default(RetainerTaskData)) { Log($"Finished Venture {task.Name}"); Log($"Reassigning Venture {task.Name}"); } else { Log($"Finished Venture"); Log($"Reassigning Venture"); } RetainerTaskResult.Reassign(); await Coroutine.Wait(5000, () => RetainerTaskAsk.IsOpen); if (!RetainerTaskAsk.IsOpen) { Log("RetainerTaskAsk didn't open"); return(false); } await Coroutine.Wait(2000, RetainerTaskAskExtensions.CanAssign); if (RetainerTaskAskExtensions.CanAssign()) { RetainerTaskAsk.Confirm(); } else { Log($"RetainerTaskAsk Error: {RetainerTaskAskExtensions.GetErrorReason()}"); RetainerTaskAsk.Close(); } await Coroutine.Wait(1500, () => DialogOpen || SelectString.IsOpen); await Coroutine.Sleep(200); if (DialogOpen) { Next(); } await Coroutine.Sleep(200); await Coroutine.Wait(5000, () => SelectString.IsOpen); } else { Log("Venture Not Done"); } return(true); }
protected override async Task <bool> Main() { var retainerList = new RetainerList(); foreach (var unit in GameObjectManager.GameObjects.OrderBy(r => r.Distance())) { if (unit.NpcId == 2000401 || unit.NpcId == 2000441) { unit.Interact(); break; } } if (!await Coroutine.Wait(5000, () => RetainerList.IsOpen)) { return(isDone = true); } { uint index = 0; while (index < RetainerCount) { Log("Checking Retainer n° " + (index + 1)); await Coroutine.Sleep(200); // Select retainer await retainerList.SelectRetainerAndSkipDialog(index); await Coroutine.Wait(5000, () => SelectString.IsOpen); string ventureLine = SelectString.Lines()[5]; Log("Venture Status : " + ventureLine); if (ventureLine.EndsWith("(Complete)") || ventureLine.EndsWith("Unternehmung einsehen") || ventureLine.EndsWith("tâche terminée") || ventureLine.EndsWith("[完了]") || ventureLine.EndsWith("[探险归来]")) { Log("Venture Completed !"); // Click on the completed venture SelectString.ClickSlot(5); await Coroutine.Wait(5000, () => RetainerTaskResult.IsOpen); // Assign a new venture RetainerTaskResult.Reassign(); await Coroutine.Wait(5000, () => RetainerTaskAsk.IsOpen); // Confirm new venture RetainerTaskAsk.Confirm(); await Coroutine.Wait(5000, () => Talk.DialogOpen); // Skip Dialog Talk.Next(); await Coroutine.Wait(5000, () => SelectString.IsOpen); } SelectString.ClickSlot((uint)SelectString.LineCount - 1); await Coroutine.Wait(5000, () => Talk.DialogOpen); // Skip Dialog Talk.Next(); await Coroutine.Wait(5000, () => RetainerList.IsOpen); index++; } Log("No more Retainer to check"); await retainerList.CloseInstanceGently(); return(isDone = true); } }
protected override async Task <bool> Main() { foreach (var unit in GameObjectManager.GameObjects.OrderBy(r => r.Distance())) { if (unit.NpcId == 2000401 || unit.NpcId == 2000441) { unit.Interact(); break; } } if (!await Coroutine.Wait(5000, () => SelectString.IsOpen)) { return(isDone = true); } { uint count = 0; var lineC = SelectString.LineCount; var countLine = (uint)lineC; foreach (var retainer in SelectString.Lines()) { if (retainer.EndsWith("]") || retainer.EndsWith(")")) { Log("Checking Retainer n° " + (count + 1)); // If Venture Completed if (retainer.EndsWith("[探险归来]") || retainer.EndsWith("[Tâche terminée]") || retainer.EndsWith("(Venture complete)")) { Log("Venture Completed !"); // Select the retainer SelectString.ClickSlot(count); if (!await Coroutine.Wait(5000, () => Talk.DialogOpen)) { continue; } // Skip Dialog Talk.Next(); if (!await Coroutine.Wait(5000, () => SelectString.IsOpen)) { continue; } // Click on the completed venture SelectString.ClickSlot(5); if (!await Coroutine.Wait(5000, () => RetainerTaskResult.IsOpen)) { continue; } // Assign a new venture RetainerTaskResult.Reassign(); if (!await Coroutine.Wait(5000, () => RetainerTaskAsk.IsOpen)) { continue; } // Confirm new venture RetainerTaskAsk.Confirm(); if (!await Coroutine.Wait(5000, () => Talk.DialogOpen)) { continue; } // Skip Dialog Talk.Next(); if (!await Coroutine.Wait(5000, () => SelectString.IsOpen)) { continue; } SelectString.ClickSlot((uint)SelectString.LineCount - 1); if (!await Coroutine.Wait(5000, () => Talk.DialogOpen)) { continue; } // Skip Dialog Talk.Next(); await Coroutine.Sleep(3000); foreach (var unit in GameObjectManager.GameObjects.OrderBy(r => r.Distance())) { if (unit.NpcId == 2000401 || unit.NpcId == 2000441) { unit.Interact(); break; } } if (await Coroutine.Wait(5000, () => SelectString.IsOpen)) { count++; } } else { Log("Venture not Completed !"); count++; } } else { Log("No more Retainer to check"); SelectString.ClickSlot(countLine - 1); } } return(isDone = true); } }
protected override async Task <bool> Main() { var retainerList = new RetainerList(); foreach (var unit in GameObjectManager.GameObjects.OrderBy(r => r.Distance())) { if (unit.NpcId == 2000401 || unit.NpcId == 2000441 || unit.Name == "Summoning Bell" || unit.Name == "Sonnette" || unit.Name == "Krämerklingel" || unit.Name == "リテイナーベル" || unit.Name == "传唤铃") { unit.Interact(); break; } } if (!await Coroutine.Wait(5000, () => RetainerList.IsOpen)) { return(isDone = true); } { int retainerCount = GetRetainerNum.GetNumberOfRetainers(); uint index = 0; while (index < retainerCount) { Log("Checking Retainer n° " + (index + 1)); await Coroutine.Sleep(300); // Select retainer await retainerList.SelectRetainerAndSkipDialog(index); await Coroutine.Wait(5000, () => SelectString.IsOpen); if (!SelectString.IsOpen) { Log("Something went wrong when checking Retainer n° " + (index + 1) + ", its contract might be suspended !"); break; } string ventureLine = SelectString.Lines()[5]; Log("Venture Status : " + ventureLine); if (ventureLine.EndsWith("(Complete)") || ventureLine.EndsWith("Unternehmung einsehen") || ventureLine.EndsWith("tâche terminée") || ventureLine.EndsWith("[完了]") || ventureLine.EndsWith("[探险归来]") || ventureLine.EndsWith("[结束]")) { Log("Venture Completed !"); // Click on the completed venture SelectString.ClickSlot(5); await Coroutine.Wait(5000, () => RetainerTaskResult.IsOpen); // Assign a new venture RetainerTaskResult.Reassign(); await Coroutine.Wait(5000, () => RetainerTaskAsk.IsOpen); // Confirm new venture RetainerTaskAsk.Confirm(); await Coroutine.Wait(5000, () => Talk.DialogOpen); // Skip Dialog Talk.Next(); await Coroutine.Wait(5000, () => SelectString.IsOpen); } SelectString.ClickSlot((uint)SelectString.LineCount - 1); await Coroutine.Wait(5000, () => Talk.DialogOpen); // Skip Dialog Talk.Next(); await Coroutine.Wait(5000, () => RetainerList.IsOpen); index++; } Log("No more Retainer to check"); if (!retainerList.IsValid) { await retainerList.Refresh(1000); } await retainerList.CloseInstance(300); return(isDone = true); } }
protected override async Task <bool> Main() { foreach (var unit in GameObjectManager.GameObjects.OrderBy(r => r.Distance())) { if (unit.Name == "传唤铃" || unit.NpcId == 2000401 || unit.NpcId == 2000441) { unit.Interact(); break; } } if (!await Coroutine.Wait(3000, () => SelectString.IsOpen)) { if (RaptureAtkUnitManager.GetWindowByName("RetainerList") == null) { return(isDone = true); } const int Offset0 = 0x1CA; const int Offset2 = 0x160; var elementCount = Core.Memory.Read <ushort>(RaptureAtkUnitManager.GetWindowByName("RetainerList").Pointer + Offset0); var addr = Core.Memory.Read <IntPtr>(RaptureAtkUnitManager.GetWindowByName("RetainerList").Pointer + Offset2); TwoInt[] elements = Core.Memory.ReadArray <TwoInt>(addr, elementCount); int NumberOfRetainers = elements[2].TrimmedData; for (var i = 0; i < NumberOfRetainers; i++) { RaptureAtkUnitManager.GetWindowByName("RetainerList").SendAction(2, 3UL, 2UL, 3UL, (ulong)i); await Coroutine.Sleep(300); await Coroutine.Wait(9000, () => Talk.DialogOpen); Talk.Next(); if (!await Coroutine.Wait(5000, () => SelectString.IsOpen)) { return(isDone = true); } foreach (var retainer in SelectString.Lines()) { if (retainer.EndsWith("[结束]") || retainer.EndsWith("[Tâche terminée]") || retainer.EndsWith("(Venture complete)")) { Log("探险结束!"); SelectString.ClickSlot(5); if (!await Coroutine.Wait(5000, () => RetainerTaskResult.IsOpen)) { continue; } RetainerTaskResult.Reassign(); if (!await Coroutine.Wait(5000, () => RetainerTaskAsk.IsOpen)) { continue; } RetainerTaskAsk.Confirm(); if (!await Coroutine.Wait(5000, () => Talk.DialogOpen)) { continue; } Talk.Next(); if (!await Coroutine.Wait(5000, () => SelectString.IsOpen)) { continue; } } } SelectString.ClickSlot((uint)SelectString.LineCount - 1); if (!await Coroutine.Wait(5000, () => Talk.DialogOpen)) { continue; } Talk.Next(); await Coroutine.Sleep(3000); } RaptureAtkUnitManager.GetWindowByName("RetainerList").SendAction(1, 3uL, 4294967295uL); } return(isDone = true); }