// muie.Program
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
internal class Program
{
private const int xSize = 1920;
private const int ySize = 1080;
private const int maxX = 70;
private const int maxY = 70;
private const float speed = 0.2f;
private const int msBetweenShots = 0;
private const int closeSize = 10;
private const bool canShoot = false;
private const int color = 11480751;
private const int colorVariation = 20;
private const double size = 60.0;
private const int maxCount = 5;
private const int MOUSEEVENTF_LEFTDOWN = 2;
private const int MOUSEEVENTF_LEFTUP = 4;
private const int MOUSEEVENTF_RIGHTDOWN = 8;
private const int MOUSEEVENTF_RIGHTUP = 16;
private static void Main(string[] args)
{
Update();
}
private static void Update()
{
_ = DateTime.Now;
while (true)
{
Task.Delay(1);
if (GetAsyncKeyState(6) == 0)
{
continue;
}
Point[] array = PixelSearch(new Rectangle(925, 505, 70, 70), Color.FromArgb(11480751), 20);
if (array.Length == 0)
{
continue;
}
Point[] array2 = array.OrderBy((Point t) => t.Y).ToArray();
List<Vector2> list = new List<Vector2>();
for (int i = 0; i < array2.Length; i++)
{
Vector2 current = new Vector2(array2[i].X, array2[i].Y);
if (list.Where((Vector2 t) => (double)(t - current).Length() < 60.0 || (double)Math.Abs(t.X - current.X) < 60.0).Count() < 1)
{
list.Add(current);
if (list.Count > 5)
{
break;
}
}
}
bool pressDown = false;
Vector2 vector = (from t in list
select t - new Vector2(960f, 540f) into t
orderby t.Length()
select t).ElementAt(0) + new Vector2(1f, 1f);
vector.Length();
_ = 10f;
Move((int)(vector.X * 0.2f), (int)(vector.Y * 0.2f), pressDown);
}
}
[DllImport("user32.dll")]
private static extern void mouse_event(int dwFlags, int dx, int dy, uint dwData, UIntPtr dwExtraInfo);
[DllImport("user32.dll")]
private static extern short GetAsyncKeyState(int vKey);
public static void Move(int xDelta, int yDelta, bool pressDown = false)
{
mouse_event((!pressDown) ? 1 : 6, xDelta, yDelta, 0u, UIntPtr.Zero);
}
public unsafe static Point[] PixelSearch(Rectangle rect, Color Pixel_Color, int Shade_Variation)
{
ArrayList arrayList = new ArrayList();
Bitmap bitmap = new Bitmap(rect.Width, rect.Height, PixelFormat.Format24bppRgb);
using (Graphics graphics = Graphics.FromImage(bitmap))
{
graphics.CopyFromScreen(rect.X, rect.Y, 0, 0, rect.Size, CopyPixelOperation.SourceCopy);
}
BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
int[] array = new int[3]
{
Pixel_Color.B,
Pixel_Color.G,
Pixel_Color.R
};
for (int i = 0; i < bitmapData.Height; i++)
{
byte* ptr = (byte*)(void*)bitmapData.Scan0 + i * bitmapData.Stride;
for (int j = 0; j < bitmapData.Width; j++)
{
if (((ptr[j * 3] >= array[0] - Shade_Variation) & (ptr[j * 3] <= array[0] + Shade_Variation)) && ((ptr[j * 3 + 1] >= array[1] - Shade_Variation) & (ptr[j * 3 + 1] <= array[1] + Shade_Variation)) && ((ptr[j * 3 + 2] >= array[2] - Shade_Variation) & (ptr[j * 3 + 2] <= array[2] + Shade_Variation)))
{
arrayList.Add(new Point(j + rect.X, i + rect.Y));
}
}
}
bitmap.Dispose();
return (Point[])arrayList.ToArray(typeof(Point));
}
}