/// <summary> /// Obtains the markup of an AI's difficulty. /// </summary> /// <param name="scalar">Garanteed index of difficulty. (0 = easy, 1 = medium, 2 = hard)</param> /// <param name="saveAt">Location to save markup at.</param> public void GetAIDifficultyMarkup(int scalar, string saveAt) { cg.updateScreen(); int[] scales = new int[] { 33, 49, 34 }; Bitmap tmp = cg.BmpClone(402, 244, scales[scalar], 16); for (int x = 0; x < tmp.Width; x++) { for (int y = 0; y < tmp.Height; y++) { if (tmp.CompareColor(x, y, CALData.WhiteColor, 25)) { tmp.SetPixel(x, y, Color.Black); } else { tmp.SetPixel(x, y, Color.White); } } } if (cg.debugmode) { int scale = 5; cg.g.DrawImage(tmp, new Rectangle(750, 0, tmp.Width * scale, tmp.Height * scale)); } tmp.Save(saveAt); tmp.Dispose(); }
/// <summary> /// Generates a markup for a menu option in Overwatch. /// </summary> /// <param name="slot">Slot to generate markup from.</param> /// <param name="max">Maximum markups to capture.</param> /// <param name="savelocation">Location to save markups.</param> /// <param name="yincrement">Amount to skip on Y axis after every markup capture.</param> public void MenuOptionMarkup(int slot, int max, string savelocation, double yincrement = 11.5) { if (!cg.IsSlotValid(slot)) { throw new InvalidSlotException(string.Format("Slot argument '{0}' is out of range.", slot)); } Point slotlocation = OpenSlotMenu(slot); // Get direction opened menu is going. Direction dir = Getmenudirection(slotlocation); int[] offset = OffsetViaDirection(dir); int xstart = slotlocation.X + 14, // X position to start scanning xmax = 79, // How far on the X axis to scan ystart = 0, // Y position to start scanning ymax = 6; // How far on the Y axis to scan. if (dir == Direction.RightDown) { ystart = slotlocation.Y + 12; } else if (dir == Direction.RightUp) { ystart = slotlocation.Y - 128; yincrement = -yincrement; } cg.updateScreen(); for (int mi = 0, yii = ystart; mi < max; mi++, yii = ystart + (int)(yincrement * (mi))) // Mi is the line to scan, yii is the Y coordinate of line mi. { // Get bitmap of option Bitmap work = cg.BmpClone(xstart, yii, xmax, ymax); for (int xi = 0; xi < work.Width; xi++) { for (int yi = 0; yi < work.Height; yi++) { int fade = 80; int[] textcolor = new int[] { 169, 169, 169 }; if (work.CompareColor(xi, yi, textcolor, fade)) { work.SetPixel(xi, yi, Color.Black); } else { work.SetPixel(xi, yi, Color.White); } } } work.Save(savelocation + "markup-" + (mi).ToString() + ".png"); work.Dispose(); } // Close the menu. cg.LeftClick(400, 500, 100); cg.LeftClick(500, 500, 100); cg.ResetMouse(); }
public void GetHeroMarkup(int slot, string saveTo) { cg.updateScreen(); Bitmap save = cg.BmpClone(HeroCheckLocations[slot], HeroCheckY, 20, 9); save.Save(saveTo); }
public void MenuOptionMarkup(int slot, int max, int savestart = 0, string savelocation = null) { if (slot < 0 || slot > Queueid + 5) { throw new InvalidSlotException(string.Format("Slot argument '{0}' is out of range.", slot)); } Point slotlocation = FindSlotLocation(slot); if (slotlocation.IsEmpty) { return; } OpenSlotMenu(slotlocation); if (savelocation == null) { savelocation = @"C:\Users\" + Environment.UserName + @"\Documents\Abyxa\Library\"; } // Get direction opened menu is going. Direction dir = Getmenudirection(slotlocation); int[] offset = OffsetViaDirection(dir); int xstart = slotlocation.X + 14, // X position to start scanning xmax = 79, // How far on the X axis to scan ystart = 0, // Y position to start scanning ymax = 6; // How far on the Y axis to scan. double yincrement = 0; // Amount to increment to scan next option line if (dir == Direction.RightDown) { ystart = slotlocation.Y + 12; yincrement = 11.5; } else if (dir == Direction.RightUp) { ystart = slotlocation.Y - 128; yincrement = -11.5; } cg.updateScreen(); // Scan -the number of the variable max- lines. for (int mi = 0, yii = ystart; mi < max; mi++, yii = ystart + (int)(yincrement * (mi))) // Mi is the line to scan, yii is the Y coordinate of line mi. { // Get bitmap of option Bitmap work = cg.BmpClone(xstart, yii, xmax, ymax); for (int xi = 0; xi < work.Width; xi++) { for (int yi = 0; yi < work.Height; yi++) { int fade = 80; int[] textcolor = new int[] { 169, 169, 169 }; if (work.CompareColor(xi, yi, textcolor, fade)) { work.SetPixel(xi, yi, Color.Black); } else { work.SetPixel(xi, yi, Color.White); } } } work.Save(savelocation + "markup-" + (mi + savestart).ToString() + ".png"); work.Dispose(); } // Close the menu. cg.LeftClick(400, 500, 100); cg.LeftClick(500, 500, 100); cg.ResetMouse(); }