protected void DonateArchier() { Utils.doScreenShoot(ProcessorMapByText.tempImgName); var dw = Utils.GetAppInfo($"-input {ProcessorMapByText.tempImgName} -name dw -match data\\check\\donate_archer.png 300", context); var dwbtn = dw.FirstOrDefault(dwf => dwf.decision == "true"); if (dwbtn != null) { context.MoveMouseAndClick(50 + dwbtn.x, 50 + dwbtn.y); for (int cli = 0; cli < 5; cli++) { context.MouseClick(); } } }
private bool CheckMatchAndAct(string img, int offx, int offy, int repeat = 1) { Utils.doScreenShoot(tempImgName); var sb = new StringBuilder(); sb.Append($"-input {tempImgName} "); sb.Append($"-name g1 -match data\\check\\{img} "); var btns = context.GetAppInfo(sb.ToString()); foreach (var btn in btns) { context.DebugLog(" check rearmall " + btn); } btns = btns.Where(r => r.decision == "true").OrderBy(r => r.cmpRes).ToList(); if (btns.FirstOrDefault() != null) { var btn = btns.First(); context.LogMatchAnalyst(sb.ToString(), btn.cmpRes); context.MoveMouseAndClick(btn.x + offx, btn.y + offy); while (repeat > 0) { context.MouseClick(); repeat--; if (repeat != 0) { //btns = Utils.GetAppInfo(sb.ToString()); //btn = btns.FirstOrDefault(r => r.decision == "true"); //if (btn == null) break; } } return(true); } return(false); }
public void ProcessCommand(ProcessingContext context) { var cmd = trainButtonFinder.ProcessingWithRetryTop1(); if (cmd == null) { context.DebugLog("Didn't find Train button"); return; } context.MoveMouseAndClick(cmd); Thread.Sleep(1000); cmd = trainButtonFinder.ProcessingWithRetryTop1(); if (cmd == null) { context.DebugLog("Didn't find Train tab button"); return; } context.MoveMouseAndClick(cmd); Thread.Sleep(1000); var cmds = buildArcherWizardButton.ProcessingWithRetry(); if (!cmds.Any()) { context.DebugLog("Didn't find troop button"); return; } cmd = cmds.FirstOrDefault(c => c.extraInfo.Contains("buildwizardbutton")); if (cmd != null) { context.MoveMouseAndClick(cmd); for (int i = 0; i < 10; i++) { context.MouseClick(); } } cmd = cmds.FirstOrDefault(c => c.extraInfo.Contains("buildArchierButton")); if (cmd != null) { context.MoveMouseAndClick(cmd); context.MouseClick(); } }