private void ValiOpenBag() { Thread.Sleep(50); IntPtr hdc = SelectColor.GetHDC(); string colorHex = ""; string colorGRB = "#A4A3A3"; colorHex = SelectColor.GetColorHexByDC(hdc, globalParam.ValiOpenBagPoint); Color colorToSearch = ColorTranslator.FromHtml(colorHex); Color color = ColorTranslator.FromHtml(colorGRB); if (Math.Abs(colorToSearch.R - color.R) < interval && Math.Abs(colorToSearch.G - color.G) < interval && Math.Abs(colorToSearch.B - color.B) < interval) { player.openBag = true; LogHelper.ShowLog("openBag"); } else { player.openBag = false; } LogHelper.ShowLog("ValiOpenBag color: {0}", colorHex); }
private bool ValiOpenBag() { IntPtr hdc = SelectColor.GetHDC(); string colorHex = SelectColor.GetColorHexByDC(hdc, globalParam.ValiOpenBagPoint); string colorGRB = "#AEACAA"; Color colorToSearch = ColorTranslator.FromHtml(colorHex); Color color = ColorTranslator.FromHtml(colorGRB); if (Math.Abs(colorToSearch.R - color.R) < interval && Math.Abs(colorToSearch.G - color.G) < interval && Math.Abs(colorToSearch.B - color.B) < interval) { player.openBag = true; LogHelper.ShowLog("openBag"); return(true); } else { player.openBag = false; } LogHelper.ShowLog("shoot color: {0}", colorHex); return(false); }
private static void ValiAmmo(ref bool HasAmmo) { GlobalParam globalParam = GlobalParam.GetGlobalParam(); IntPtr hdc = SelectColor.GetHDC(); string colorHex = SelectColor.GetColorHexByDC(hdc, globalParam.ValiAmmoPoint); if (colorHex.Equals("#FF0000") || colorHex.Equals("#916E3D")) { HasAmmo = false; } LogHelper.ShowLog("ammo color: {0}", colorHex); }
public static void ValiShoot(GlobalParam globalParam, Player player) { // TODO 验证射击颜色偏移数值 int interval = 55; IntPtr hdc = SelectColor.GetHDC(); string colorHex = ""; string colorGRB = "#F5F5F3"; switch (player.position) { case "蹲": colorGRB = "#E3DDDA"; colorHex = SelectColor.GetColorHexByDC(hdc, globalParam.ValiDunShootPoint); break; case "趴": colorHex = SelectColor.GetColorHexByDC(hdc, globalParam.ValiPaShootPoint); break; default: colorHex = SelectColor.GetColorHexByDC(hdc, globalParam.ValiShootPoint); break; } Color colorToSearch = ColorTranslator.FromHtml(colorHex); Color color = ColorTranslator.FromHtml(colorGRB); if (Math.Abs(colorToSearch.R - color.R) < interval && Math.Abs(colorToSearch.G - color.G) < interval && Math.Abs(colorToSearch.B - color.B) < interval) { player.isShoot = true; LogHelper.ShowLog("get Shoot"); } else { player.isShoot = false; } if (colorHex.Equals("#EDE")) { player.isShoot = false; } LogHelper.ShowLog("shoot color: {0}", colorHex); }