private static int ScanConstellations() { double yReference = 720.0; int constellation; if (Navigation.GetAspectRatio() == new Size(8, 5)) { yReference = 800.0; } Rectangle constActivate = new RECT( Left: (int)(70 / 1280.0 * Navigation.GetWidth()), Top: (int)(665 / 720.0 * Navigation.GetHeight()), Right: (int)(100 / 1280.0 * Navigation.GetWidth()), Bottom: (int)(695 / 720.0 * Navigation.GetHeight())); for (constellation = 0; constellation < 6; constellation++) { // Select Constellation int yOffset = (int)((180 + (constellation * 75)) / yReference * Navigation.GetHeight()); if (Navigation.GetAspectRatio() == new Size(8, 5)) { yOffset = (int)((225 + (constellation * 75)) / yReference * Navigation.GetHeight()); } Navigation.SetCursorPos(Navigation.GetPosition().Left + (int)(1130 / 1280.0 * Navigation.GetWidth()), Navigation.GetPosition().Top + yOffset); Navigation.Click(); Navigation.Speed speed = constellation == 0 ? Navigation.Speed.Normal : Navigation.Speed.Fast; Navigation.SystemRandomWait(speed); // Grab Color using (Bitmap region = Navigation.CaptureRegion(constActivate)) { // Check a small region next to the text "Activate" // for a mostly white backround ImageStatistics statistics = new ImageStatistics(region); if (statistics.Red.Mean >= 190 && statistics.Green.Mean >= 190 && statistics.Blue.Mean >= 190) { break; } } } Navigation.sim.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.ESCAPE); UserInterface.SetCharacter_Constellation(constellation); return(constellation); }
private static int[] ScanTalents(string name) { int[] talents = { -1, -1, -1 }; int specialOffset = 0; // Check if character has a movement talent like // Mona or Ayaka if (name.Contains("Mona") || name.Contains("Ayaka")) { specialOffset = 1; } var xRef = 1280.0; var yRef = 720.0; if (Navigation.GetAspectRatio() == new Size(8, 5)) { yRef = 800.0; } Rectangle region = new RECT( Left: (int)(160 / xRef * Navigation.GetWidth()), Top: (int)(116 / yRef * Navigation.GetHeight()), Right: (int)(225 / xRef * Navigation.GetWidth()), Bottom: (int)(141 / yRef * Navigation.GetHeight())); for (int i = 0; i < 3; i++) { // Change y-offset for talent clicking int yOffset = (int)(110 / yRef * Navigation.GetHeight()) + (i + ((i == 2) ? specialOffset : 0)) * (int)(60 / yRef * Navigation.GetHeight()); Navigation.SetCursorPos(Navigation.GetPosition().Left + (int)(1130 / xRef * Navigation.GetWidth()), Navigation.GetPosition().Top + yOffset); Navigation.Click(); Navigation.Speed speed = i == 0 ? Navigation.Speed.Normal : Navigation.Speed.Fast; Navigation.SystemRandomWait(speed); while (talents[i] < 1 || talents[i] > 15) { Bitmap talentLevel = Navigation.CaptureRegion(region); talentLevel = Scraper.ResizeImage(talentLevel, talentLevel.Width * 2, talentLevel.Height * 2); Bitmap n = Scraper.ConvertToGrayscale(talentLevel); Scraper.SetContrast(60, ref n); Scraper.SetInvert(ref n); string text = Scraper.AnalyzeText(n).Trim(); text = Regex.Replace(text, @"\D", string.Empty); if (int.TryParse(text, out int level)) { if (level >= 1 && level <= 15) { talents[i] = level; UserInterface.SetCharacter_Talent(talentLevel, text, i); } } n.Dispose(); talentLevel.Dispose(); } } Navigation.sim.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.ESCAPE); return(talents); }