private void TimerMain_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { // minimap_title string img5 = $"{GlobalCode.PROGRAM_IMAGES_TEST}minimap_transblack.bmp"; var pointMinimapTitle = AutoHotkeyHelper.ImageSearch(POINT_MINIMAP_LEFT_TOP.X, POINT_MINIMAP_LEFT_TOP.Y, 550, 150, img5); CourrentPointMinimapTitle = pointMinimapTitle; // minimap_right string img13 = $"{GlobalCode.PROGRAM_IMAGES_TEST}minimap_right_transblack.bmp"; var pointRight = AutoHotkeyHelper.ImageSearch(POINT_MINIMAP_LEFT_TOP.X, POINT_MINIMAP_LEFT_TOP.Y, 500, 300, img13); CourrentPointRight = pointRight; // minimap_left string img14 = $"{GlobalCode.PROGRAM_IMAGES_TEST}minimap_left_transblack.bmp"; var pointLeft = AutoHotkeyHelper.ImageSearch(POINT_MINIMAP_LEFT_TOP.X, POINT_MINIMAP_LEFT_TOP.Y, 300, 500, img14); CourrentPointLeft = pointLeft; if (CourrentPointMinimapTitle.HasValue == false || CourrentPointRight.HasValue == false) { CourrentPointMinimapTitle = null; CourrentPointRight = null; CourrentPointLeft = null; CourrentPointUser = null; CourrentPointRune = null; CourrentPointHiddenStreet = null; CourrentPointDiffUser = null; return; } // minimap_user string img12 = $"{GlobalCode.PROGRAM_IMAGES_TEST}minimap_user_transblack3.bmp"; var pointUser = AutoHotkeyHelper.ImageSearch(POINT_MINIMAP_LEFT_TOP.X, POINT_MINIMAP_LEFT_TOP.Y, Math.Min(POINT_MINIMAP_RIGHT_BOTTOM.X, pointRight.Value.X), POINT_MINIMAP_RIGHT_BOTTOM.Y, img12); CourrentPointUser = pointUser; // minimap rune string img15 = $"{GlobalCode.PROGRAM_IMAGES_TEST}minimap_rune_transblack.bmp"; var pointRune = AutoHotkeyHelper.ImageSearch(POINT_MINIMAP_LEFT_TOP.X, POINT_MINIMAP_LEFT_TOP.Y, Math.Min(POINT_MINIMAP_RIGHT_BOTTOM.X, pointRight.Value.X), POINT_MINIMAP_RIGHT_BOTTOM.Y, img15); CourrentPointRune = pointRune; // minimap hidden street string img16 = $"{GlobalCode.PROGRAM_IMAGES_TEST}minimap_hiddenstreet_transblack.bmp"; var pointHiddenStreet = AutoHotkeyHelper.ImageSearch(POINT_MINIMAP_LEFT_TOP.X, POINT_MINIMAP_LEFT_TOP.Y, Math.Min(POINT_MINIMAP_RIGHT_BOTTOM.X, pointRight.Value.X), POINT_MINIMAP_RIGHT_BOTTOM.Y, img16); CourrentPointHiddenStreet = pointHiddenStreet; // minimap diff user string img17 = $"{GlobalCode.PROGRAM_IMAGES_TEST}minimap_diff_user_transblack.bmp"; var pointDiffUser = AutoHotkeyHelper.ImageSearch(POINT_MINIMAP_LEFT_TOP.X, POINT_MINIMAP_LEFT_TOP.Y, Math.Min(POINT_MINIMAP_RIGHT_BOTTOM.X, pointRight.Value.X), POINT_MINIMAP_RIGHT_BOTTOM.Y, img17); CourrentPointDiffUser = pointDiffUser; // 왼쪽/오른쪽 방향 바꾸기 if (pointUser.HasValue && pointLeft.HasValue && pointUser.Value.X < (pointLeft.Value.X + 30)) { if (화면_왼쪽에_도달_시 != null) { 화면_왼쪽에_도달_시(this, new EventArgs()); } } if (pointUser.HasValue && pointRight.HasValue && pointUser.Value.X > (pointRight.Value.X - 30)) { if (화면_오른쪽에_도달_시 != null) { 화면_오른쪽에_도달_시(this, new EventArgs()); } } if (pointMinimapTitle.HasValue && (PrevPointRune.HasValue == false) && pointRune.HasValue) { if (룬_생성_시 != null) { 룬_생성_시(this, new EventArgs()); } } if (pointMinimapTitle.HasValue && (PrevPointHiddenStreet.HasValue == false) && pointHiddenStreet.HasValue) { if (히든_스트리트_생성_시 != null) { 히든_스트리트_생성_시(this, new EventArgs()); } } if (pointMinimapTitle.HasValue && (PrevPointDiffUser.HasValue == false) && pointDiffUser.HasValue) { if (다른_유저가_존재_시 != null) { 다른_유저가_존재_시(this, new EventArgs()); } } PrevPointMinimapTitle = pointMinimapTitle; PrevPointUser = pointUser; PrevPointRune = pointRune; PrevPointHiddenStreet = pointHiddenStreet; PrevPointDiffUser = pointDiffUser; if (Tick != null) { Tick(this, new EventArgs()); } }
private void TimerMain_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { var CurrentResolution = GetCurrentResolution(); if (CurrentResolution == null) { CurrentHPPercent = null; CurrentMPPercent = null; return; } // left header string img5 = $"{GlobalCode.PROGRAM_IMAGES_TEST}hpmp_left_original.bmp"; var pointHeader = AutoHotkeyHelper.ImageSearch(CurrentResolution.HEADER_LEFT_TOP.X, CurrentResolution.HEADER_LEFT_TOP.Y, CurrentResolution.HEADER_RIGHT_BOTTOM.X, CurrentResolution.HEADER_RIGHT_BOTTOM.Y, img5); if(pointHeader.HasValue == false) { CurrentHPPercent = null; CurrentMPPercent = null; return; } // HP int? findHPPointX = null; int? findHPPercent = null; for (int i = CurrentResolution.HPMP_MIN_X; i <= CurrentResolution.HPMP_MAX_X; i = i + 20) { var color = AutoHotkeyHelper.PixelGetColor(i, CurrentResolution.HP_CHECK_Y); if (color == CurrentResolution.HP_EMPTY_COLOR) { findHPPointX = i; break; } } if (findHPPointX.HasValue) findHPPercent = (int)(((double)(findHPPointX - CurrentResolution.HPMP_MIN_X) / (double)(CurrentResolution.HPMP_MAX_X - CurrentResolution.HPMP_MIN_X)) * 100); // MP int? findMPPointX = null; int? findMPPercent = null; for (int i = CurrentResolution.HPMP_MIN_X; i <= CurrentResolution.HPMP_MAX_X; i = i + 20) { var color = AutoHotkeyHelper.PixelGetColor(i, CurrentResolution.MP_CHECK_Y); if (color == CurrentResolution.MP_EMPTY_COLOR) { findMPPointX = i; break; } } if (findMPPointX.HasValue) findMPPercent = (int)(((double)(findMPPointX - CurrentResolution.HPMP_MIN_X) / (double)(CurrentResolution.HPMP_MAX_X - CurrentResolution.HPMP_MIN_X)) * 100); if (pointHeader.HasValue && !findHPPercent.HasValue) findHPPercent = 100; if (pointHeader.HasValue && !findMPPercent.HasValue) findMPPercent = 100; if (findHPPercent.HasValue) { CurrentHPPercent = findHPPercent; if (PrevHPPercent.HasValue && PrevHPPercent.Value != findHPPercent.Value) { if (HP_변경_시 != null) HP_변경_시(this, new EventArgs()); } PrevHPPercent = findHPPercent; } if (findMPPercent.HasValue) { CurrentMPPercent = findMPPercent; if (PrevMPPercent.HasValue && PrevMPPercent.Value != findMPPercent.Value) { if (MP_변경_시 != null) MP_변경_시(this, new EventArgs()); } PrevMPPercent = findMPPercent; } if (Tick != null) Tick(this, new EventArgs()); }