public static void LogMatchTemplate(ScriptBase script, string name, List <PixelMap> listPixelMap, int similarity = 98) { if (_debug) { Console.WriteLine("{0}", name); /* to print to the built-in console */ System.Diagnostics.Debug.WriteLine("{0}", name); /* to print to "Output" console in Visual Studio. */ foreach (var item in listPixelMap) { if (script.MatchTemplate(item, similarity)) { if (_level <= Level.info) { Console.WriteLine("\t*** PixelMap '{1}' return {2}", name, item.ID, script.MatchTemplate(item, similarity).ToString()); /* to print to the built-in console */ System.Diagnostics.Debug.WriteLine("\tPixelMap '{1}' return {2}", name, item.ID, script.MatchTemplate(item, similarity).ToString()); /* to print to "Output" console in Visual Studio. */ } } else { if (_level <= Level.debug) { // Find the similarity 'ok' int s; for (s = 100; s > 0 && !script.MatchTemplate(item, s); s++) { } Console.WriteLine("\t RectMap '{1}' ok for similarity {2}", name, item.ID, s); /* to print to the built-in console */ System.Diagnostics.Debug.WriteLine("\t RectMap '{1}' ok for similarity {2}", name, item.ID, s); /* to print to "Output" console in Visual Studio. */ } } } } }
public override void OnMatched(ScriptBase script) { if (script.MatchTemplate(classicFocus, 98) && !script.MatchTemplate(data, 98)) { script.Press(new DualShockState() { Triangle = true }); /* To restart AutomateMatch next time */ MyClub.Sim.AutomateMatch.Instance.MatchDone(); /* Register Match and date */ Log.Log2File(Name, "Starting match"); } else if (!script.MatchTemplate(classicFocus, 98) && script.MatchTemplate(data, 98)) { /* To keep PS4 alive while waiting end of match */ script.Press(new DualShockState() { Square = true }); Log.LogMessage(Name, "Waiting end of match ..."); Thread.Sleep(5000); } }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { divisionHeaderFocus, divisionFooterFocus }, 95); return(script.MatchTemplate(divisionHeaderFocus, 95) && script.MatchTemplate(divisionFooterFocus, 95)); }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { manageteamfocus1, manageteamfocus2, manageteamfocus3 }, 95); return(script.MatchTemplate(manageteamfocus1, 95) && script.MatchTemplate(manageteamfocus2, 95) && script.MatchTemplate(manageteamfocus3, 95)); }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { myClubFocus, noOnlineUpdateFocus, eventNewYearFocus, dailyBonusFocus }); return(script.MatchTemplate(myClubFocus, 98) || script.MatchTemplate(noOnlineUpdateFocus, 98) || script.MatchTemplate(eventNewYearFocus, 98) || script.MatchTemplate(dailyBonusFocus, 98)); }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { stats1Header, stats1Goals, stats2Header, stats2SecondeHalftime }); return(script.MatchTemplate(stats1Header, 98) && script.MatchTemplate(stats1Goals, 98) || script.MatchTemplate(stats2Header, 98) && script.MatchTemplate(stats2SecondeHalftime, 98)); }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { classicFocus, data }); return(script.MatchTemplate(classicFocus, 98) && !script.MatchTemplate(data, 98) || /* classic screen */ !script.MatchTemplate(classicFocus, 98) && script.MatchTemplate(data, 98)); /* data screen */ }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { newSeasonFocus, divisionHeader, divisionFooter, teamDescriptionFocus }); return(script.MatchTemplate(newSeasonFocus, 98) || script.MatchTemplate(divisionHeader, 98) && script.MatchTemplate(divisionFooter, 98) || script.MatchTemplate(teamDescriptionFocus, 98)); }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { clubHouseFocus }); Log.LogMatchTemplate(script, Name, new List <PixelMap> { clubHouseSelected }); return(script.MatchTemplate(clubHouseFocus, 98) && script.MatchTemplate(clubHouseSelected, 98)); }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { konami, konamiFocus, thePitchIsOurs, onlineNewsHeaderFocus, onlineUpdatePlayersFocus }); return(script.MatchTemplate(konami, 98) && script.MatchTemplate(konamiFocus, 98) || script.MatchTemplate(thePitchIsOurs, 98) || script.MatchTemplate(onlineNewsHeaderFocus, 98) || script.MatchTemplate(onlineUpdatePlayersFocus, 98)); }
// Handle all of the scene matching conditions // Pass in list of Rectmaps that have conditionals set // ie RectMap Scene Name Required Match and Passing Requiremetn, ie true or false. public static bool HandleConditions(List <ConditionMap> conditions, ScriptBase script) { var mainscript = script as Script; bool Passed = true; foreach (ConditionMap condition in conditions) { if (script.MatchTemplate(condition.RectMap, condition.Match) != condition.Required) { Passed = false; Bitmap image = script.CropFrame(Helper.RectmapToRectangle(condition.RectMap)); image.Save(condition.Name + "_" + condition.RectMap.Hash.ToString() + ".png"); } } if (Passed != true) { return(false); } else { return(true); } }
public override void OnMatched(ScriptBase script) { MyClub.Sim.AutomateMatch.ClubHouseAction action = MyClub.Sim.AutomateMatch.Instance.ActionForClubHouse(); switch (action) { case MyClub.Sim.AutomateMatch.ClubHouseAction.enterManageTeam: Log.LogMessage(Name, "Enter to 'Manage Team'."); if (script.MatchTemplate(manageTeamSelected, 98)) { script.Press(new DualShockState() { Cross = true }); MyClub.Sim.AutomateMatch.Instance.SelectManageTeamDone(); } else { SelectManageTeam(script); } break; case MyClub.Sim.AutomateMatch.ClubHouseAction.enterPlayNow: Log.LogMessage(Name, "Enter to 'Play Now'."); if (script.MatchTemplate(playNowSelected, 98)) { script.Press(new DualShockState() { Cross = true }); MyClub.Sim.AutomateMatch.Instance.LaunchMatchDone(); } else { SelectPlayNow(script); } break; case MyClub.Sim.AutomateMatch.ClubHouseAction.none: default: Log.LogMessage(Name, "No action to do."); break; } }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { teamName }); return(script.MatchTemplate(teamName, 98)); }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { majorEventsFocus }); return(script.MatchTemplate(majorEventsFocus, 98)); }
public override void OnMatched(ScriptBase script) { script.Press(new DualShockState() { Cross = true }); if (script.MatchTemplate(seasonMaintainFocus, 98)) { /* Register End of season & date */ Log.Log2File(Name, "End of season : Maintain"); } else if (script.MatchTemplate(seasonPromoteFocus, 98)) { /* Register End of season & date */ Log.Log2File(Name, "End of season : Promote"); } }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { pressStartScreen }); return(script.MatchTemplate(pressStartScreen, 98)); }
public override bool Match(ScriptBase script) { /* DEBUG */ Log.LogMatchTemplate(script, Name, new List <RectMap> { extension, extensionFocusHeader_1player, extensionFocusHeader_2players, extensionFocusHeader_3players, extensionFocusHeader_4players, extensionFocusHeader_5players, extensionFocusHeader_6players, extensionManager, extensionManagerFocusHeader }); return(script.MatchTemplate(extension, 98) && (script.MatchTemplate(extensionFocusHeader_1player, 98) || script.MatchTemplate(extensionFocusHeader_2players, 98) || script.MatchTemplate(extensionFocusHeader_3players, 98) || script.MatchTemplate(extensionFocusHeader_4players, 98) || script.MatchTemplate(extensionFocusHeader_5players, 98) || script.MatchTemplate(extensionFocusHeader_6players, 98)) || script.MatchTemplate(extensionManager, 98) && script.MatchTemplate(extensionManagerFocusHeader, 98)); }
public override void OnMatched(ScriptBase script) { var waitTime = 500; Logger.Writer("Reached Main Menu, checking if the girls need a break..."); // Checking if hosts need a break if (script.MatchTemplate(N1StatusMap, 98) || script.MatchTemplate(N2StatusMap, 98) || script.MatchTemplate(N3StatusMap, 98) || script.MatchTemplate(N4StatusMap, 98) || script.MatchTemplate(N5StatusMap, 98) || script.MatchTemplate(N6StatusMap, 98)) { Logger.Writer("Yup, girls need a break, proceeding to Assign Floor Crew..."); MultiplePresses.Press("DPad_Down", 1, waitTime, script); MultiplePresses.Press("Cross", 2, waitTime, script); // Entered Assign Floor Crew } else { Logger.Writer("Nope, they're all good, moving on to the shift..."); MultiplePresses.Press("Cross", 1, waitTime, script); MultiplePresses.Press("DPad_Up", 1, waitTime, script); MultiplePresses.Press("Cross", 2, waitTime, script); MultiplePresses.Press("Cross", 1, waitTime, script); script.Sleep(1000); MultiplePresses.Press("Cross", 1, waitTime, script); } }
public static bool MatchTemplate(this ScriptBase script, MatchedValue matchedValue) { bool matched = script.MatchTemplate(matchedValue.Position, matchedValue.Hash, matchedValue.Similarity); #if DEBUG if (Settings.Default.CreateDebugScreenshots) { var cropped = script.CropFrame(script.CurrentFrame, matchedValue.Position); var hash = ImageHashing.AverageHash(cropped); var similarity = ImageHashing.Similarity(hash, matchedValue.Hash); if (!matched) { cropped.Save($"lastnotmatch_{matchedValue.ID}.png"); } } #endif return(matched); }
private PixelMap SelectManageTeam(ScriptBase script) { PixelMap from = noSelected, to = manageTeamSelected; if (script.MatchTemplate(playNowSelected, 98)) { script.Press(new DualShockState() { DPad_Right = true }); from = playNowSelected; } else if (script.MatchTemplate(manageTeamSelected, 98)) { from = manageTeamSelected; } else if (script.MatchTemplate(memberSelected, 98)) { script.Press(new DualShockState() { DPad_Left = true }); from = memberSelected; } else if (script.MatchTemplate(trainingSelected, 98)) { script.Press(new DualShockState() { DPad_Left = true }); from = trainingSelected; } else if (script.MatchTemplate(historySelected, 98)) { script.Press(new DualShockState() { DPad_Right = true }); script.Press(new DualShockState() { DPad_Up = true }); from = historySelected; } else if (script.MatchTemplate(planSelected, 98)) { script.Press(new DualShockState() { DPad_Up = true }); from = planSelected; } else if (script.MatchTemplate(shopSelected, 98)) { script.Press(new DualShockState() { DPad_Up = true }); script.Press(new DualShockState() { DPad_Left = true }); from = shopSelected; } else if (script.MatchTemplate(mailSelected, 98)) { script.Press(new DualShockState() { DPad_Up = true }); script.Press(new DualShockState() { DPad_Left = true }); from = mailSelected; } Log.LogMessage(Name, "Go from '" + from.ID + "' to '" + to.ID + "'"); return(from); }
public override void OnMatched(ScriptBase script) { bool manager = script.MatchTemplate(extensionManagerFocusHeader, 98); Log.LogMessage(Name, "Start"); // List of player to renew script.Press(new DualShockState() { DPad_Right = true }); script.Press(new DualShockState() { Cross = true }); Log.LogMessage(Name, "Accept to renew players/Manager"); // Cost and kind of money while (!script.MatchTemplate(script.CaptureFrame(), extension2Focus, 98)) { Thread.Sleep(1000); Log.LogMessage(Name, "Waiting for 'Pay with GP money'"); } script.Press(new DualShockState() { Cross = true }); Log.LogMessage(Name, "Pay with GP money"); // Confirmation while (!script.MatchTemplate(script.CaptureFrame(), extension3Focus, 98)) { Thread.Sleep(1000); Log.LogMessage(Name, "Waiting for 'Confirm'"); } script.Press(new DualShockState() { DPad_Right = true }); script.Press(new DualShockState() { Cross = true }); Log.LogMessage(Name, "Confirm"); // Transaction'status while (!script.MatchTemplate(script.CaptureFrame(), extension4Focus, 98)) { Thread.Sleep(1000); Log.LogMessage(Name, "Waiting for 'Skip transaction status'"); } script.Press(new DualShockState() { Cross = true }); Log.LogMessage(Name, "Skip transaction'status"); /* Only for manager */ if (manager) { // Transaction'status 2 /*while (!script.MatchTemplate(script.CaptureFrame(), extension5Focus, 98)) * { * Thread.Sleep(1000); * Log.LogMessage(Name, "Waiting for 'Skip transaction status2'"); * }*/ // TODO : CAPTURE THE PICTURE !! Thread.Sleep(5000); script.Press(new DualShockState() { Cross = true }); Log.LogMessage(Name, "Skip transaction'status2"); } Log.LogMessage(Name, "End"); }
public override bool Match(ScriptBase script) { return(script.MatchTemplate(AllMatchedValues.CharacterSelectNoob)); }
public override bool Match(ScriptBase script) { return(script.MatchTemplate(R_Title, 99)); }
public override bool Match(ScriptBase script) { return(script.MatchTemplate(HeaderBar, 95) && script.MatchTemplate(QuickGPS, 92)); }
public override void OnMatched(ScriptBase script) { var waitTime = 10; // Resetting guest served status if applicable if (script.MatchTemplate(t1GuestMap)) { guest1served = false; } if (script.MatchTemplate(t2GuestMap)) { guest2served = false; } if (script.MatchTemplate(t3GuestMap)) { guest3served = false; } if (script.MatchTemplate(t4GuestMap)) { guest4served = false; } // Cursor defaults at the first girl in the leftmost list, and returns there everytime a customer is served. // Table 1 if (!script.MatchTemplate(t1GuestMap) && !guest1served) { Logger.Writer("Guest arrived at Table 1, serving on him!"); MultiplePresses.Press("DPad_Right", 1, waitTime, script); MultiplePresses.Press("Cross", 2, waitTime, script); MultiplePresses.Press("DPad_Right", 2, waitTime, script); MultiplePresses.Press("Cross", 2, waitTime, script); MultiplePresses.Press("DPad_Left", 3, waitTime, script); guest1served = true; } // Table 2 if (!script.MatchTemplate(t2GuestMap) && !guest2served) { Logger.Writer("Guest arrived at Table 2, serving on him!"); MultiplePresses.Press("DPad_Right", 1, waitTime, script); MultiplePresses.Press("DPad_Down", 1, waitTime, script); MultiplePresses.Press("Cross", 2, waitTime, script); MultiplePresses.Press("DPad_Right", 2, waitTime, script); MultiplePresses.Press("Cross", 2, waitTime, script); MultiplePresses.Press("DPad_Up", 1, waitTime, script); MultiplePresses.Press("DPad_Left", 3, waitTime, script); guest2served = true; } // Table 3 if (!script.MatchTemplate(t3GuestMap) && !guest3served) { Logger.Writer("Guest arrived at Table 3, serving on him!"); MultiplePresses.Press("DPad_Left", 1, waitTime, script); MultiplePresses.Press("Cross", 2, waitTime, script); MultiplePresses.Press("DPad_Left", 2, waitTime, script); MultiplePresses.Press("Cross", 2, waitTime, script); MultiplePresses.Press("DPad_Right", 3, waitTime, script); guest3served = true; } // Table 4 if (!script.MatchTemplate(t4GuestMap) && !guest4served) { Logger.Writer("Guest arrived at Table 4, serving on him!"); MultiplePresses.Press("DPad_Left", 1, waitTime, script); MultiplePresses.Press("DPad_Down", 1, waitTime, script); MultiplePresses.Press("Cross", 2, waitTime, script); MultiplePresses.Press("DPad_Left", 2, waitTime, script); MultiplePresses.Press("Cross", 2, waitTime, script); MultiplePresses.Press("DPad_Up", 1, waitTime, script); MultiplePresses.Press("DPad_Right", 3, waitTime, script); guest4served = true; } }
public override bool Match(ScriptBase script) { return(script.MatchTemplate(TitleMap, 95)); }
public override bool Match(ScriptBase script) { return(script.MatchTemplate(KlassicTowerMenu) && script.MatchTemplate(AllMatchedValues.SurvivorTower)); //return false; }
public override bool Match(ScriptBase script) { return(script.MatchTemplate(key, 50)); }
public override bool Match(ScriptBase script) { return(script.MatchTemplate(MatchKontinueButton)); //return false; }
public override bool Match(ScriptBase script) { return(script.MatchTemplate(MatchTowerSelectButton)); //return false; }