Add pixels for X on character

This commit is contained in:
MDavid
2022-05-14 13:56:41 +02:00
parent cdba24d69b
commit aadea78853
2 changed files with 13 additions and 5 deletions

View File

@@ -20,6 +20,6 @@ public class Pixel {
public Boolean ProcessBitmap(Bitmap bmp) { public Boolean ProcessBitmap(Bitmap bmp) {
Color tempPixel = bmp.GetPixel(x, y); Color tempPixel = bmp.GetPixel(x, y);
return tempPixel.R >= R && tempPixel.B >= B && tempPixel.G >= G; return tempPixel.R == R && tempPixel.B == B && tempPixel.G == G;
} }
} }

View File

@@ -51,7 +51,8 @@ internal static class Program {
var i = 0; var i = 0;
foreach (var game in games) foreach (var game in games)
if (game != activeGame) { if (game != activeGame) {
var processAffinty = defaultAffinity >> i; // var processAffinty = defaultAffinity >> i;
var processAffinty = defaultAffinity;
fullAffinity = fullAffinity & ~processAffinty; fullAffinity = fullAffinity & ~processAffinty;
game.ProcessorAffinity = new IntPtr(processAffinty); game.ProcessorAffinity = new IntPtr(processAffinty);
i++; i++;
@@ -75,6 +76,7 @@ internal static class Program {
} }
private static void SwitchToGame(int index) { private static void SwitchToGame(int index) {
if (index >= games.Length) return;
SetForegroundWindow(games[index].MainWindowHandle); SetForegroundWindow(games[index].MainWindowHandle);
activeGame = games[index]; activeGame = games[index];
AdjustAffinities(); AdjustAffinities();
@@ -109,12 +111,14 @@ internal static class Program {
HotKeyManager.RegisterHotKey(Keys.D3, KeyModifiers.Alt); HotKeyManager.RegisterHotKey(Keys.D3, KeyModifiers.Alt);
HotKeyManager.RegisterHotKey(Keys.D4, KeyModifiers.Alt); HotKeyManager.RegisterHotKey(Keys.D4, KeyModifiers.Alt);
HotKeyManager.RegisterHotKey(Keys.D5, KeyModifiers.Alt); HotKeyManager.RegisterHotKey(Keys.D5, KeyModifiers.Alt);
HotKeyManager.RegisterHotKey(Keys.D6, KeyModifiers.Alt);
HotKeyManager.RegisterHotKey(Keys.Q, KeyModifiers.Alt); HotKeyManager.RegisterHotKey(Keys.Q, KeyModifiers.Alt);
HotKeyManager.RegisterHotKey(Keys.W, KeyModifiers.Alt); HotKeyManager.RegisterHotKey(Keys.W, KeyModifiers.Alt);
HotKeyManager.HotKeyPressed += HotKeyManager_HotKeyPressed; HotKeyManager.HotKeyPressed += HotKeyManager_HotKeyPressed;
List<Pixel> pixelList = new List<Pixel>(); List<Pixel> pixelList = new List<Pixel>();
pixelList.Add(new Pixel(1062, 885, 240, 240, 240)); pixelList.Add(new Pixel(108, 108, 0, 0, 0));
pixelList.Add(new Pixel(1062, 885, 255, 255, 255));
static void HotKeyManager_HotKeyPressed(object sender, HotKeyEventArgs e) { static void HotKeyManager_HotKeyPressed(object sender, HotKeyEventArgs e) {
switch (e.Key) { switch (e.Key) {
@@ -133,6 +137,9 @@ internal static class Program {
case Keys.D5: case Keys.D5:
SwitchMainGame(); SwitchMainGame();
break; break;
case Keys.D6:
Environment.Exit(0);
break;
case Keys.Q: case Keys.Q:
NerfAll(); NerfAll();
break; break;
@@ -155,11 +162,12 @@ internal static class Program {
foreach (Pixel p in pixelList) { foreach (Pixel p in pixelList) {
if (p.ProcessBitmap(screenshot)) { if (p.ProcessBitmap(screenshot)) {
Console.Beep(1500, 850); Console.Beep(1500, 850);
break;
} }
} }
Thread.Sleep(1000); Thread.Sleep(250);
} }
Thread.Sleep(1000); Thread.Sleep(250);
} }
} }
} }