// Moves the item between the 3 horizontal slots and finds which pixel colors // were maintained between those changes. // // Obs.: move the item to the slot 1 or 5 before calling this function. // // start_x -> abscissa of the upper left corner of the item // start_y -> ordinate of the upper left corner of the item // // Returns an array that contains all the common colors between slot changes. protected static ArrayList DetectItemCommonPixelColorsFor3HorizontalSlots(int start_x, int start_y) { int item_x = start_x; int item_y = start_y; PixelColor[] item_pixels1 = Screen.GetAllPixelColors(item_x, item_y, item_x + ITEMS_WIDTH, item_y + ITEMS_HEIGHT); PixelColor[] item_pixels2; ArrayList commonPixels1 = new ArrayList(); ArrayList commonPixels2 = new ArrayList(); commonPixels1.AddRange(item_pixels1); int i = 0; while (i < 2) { MouseEvents.DragAndDropRelative(item_x, item_y, ITEMS_X_OFFSET, 0); item_x += ITEMS_X_OFFSET; Utilities.System.Sleep(300); MouseEvents.MouseMove(0, 0); Utilities.System.Sleep(300); item_pixels2 = Screen.GetAllPixelColors(item_x, item_y, item_x + ITEMS_WIDTH, item_y + ITEMS_HEIGHT); commonPixels2.Clear(); commonPixels2.AddRange(item_pixels2); commonPixels1 = Utilities.Arrays.GetCommonValues(commonPixels1, commonPixels2); Utilities.System.Sleep(300); i++; } return(commonPixels1); }
/// <summary> /// Moves the mouse to the most above and left enemy and attack it. /// </summary> /// /// <returns> /// <code>true</code> if the enemy is found. Otherwise, <code>false</code>. /// </returns> public static bool AttackEnemy() { bool success = MoveMouseToEnemy(); if (success) { MouseEvents.MouseClickRight(); } return(success); }
// Moves the item between all slots and finds which pixel colors were maintained between those changes. // // Obs.: move the item to the slot 1 before calling this function. // // Returns an array that contains all the common colors between slot changes. protected static ArrayList DetectItemCommonPixelColors() { UpdateItemsVariables(); ArrayList common_colors1 = DetectItemCommonPixelColorsFor3HorizontalSlots(ITEMS_RECTANGLE[0], ITEMS_RECTANGLE[1]); Utilities.System.Sleep(300); MouseEvents.DragAndDrop(ITEMS_RECTANGLE[0] + ITEMS_X_OFFSET * 2, ITEMS_RECTANGLE[1], ITEMS_RECTANGLE[0], ITEMS_RECTANGLE[1] + ITEMS_Y_OFFSET); Utilities.System.Sleep(300); MouseEvents.MouseMove(0, 0); Utilities.System.Sleep(300); ArrayList common_colors2 = DetectItemCommonPixelColorsFor3HorizontalSlots(ITEMS_RECTANGLE[0], ITEMS_RECTANGLE[1] + ITEMS_Y_OFFSET); return(Utilities.Arrays.GetCommonValues(common_colors1, common_colors2)); }
/// <summary> /// Moves the mouse to the most above and left enemy. /// </summary> /// /// <returns> /// <code>true</code> if the enemy is found. Otherwise, <code>false</code>. /// </returns> public static bool MoveMouseToEnemy() { return(MouseEvents.MoveMouseToCoords(GetEnemyCoords())); }
/// <summary> /// Moves the mouse to the center of the player's champion. /// </summary> public static void MoveMouseToMe() { MouseEvents.MoveMouseToCoords(GetPlayerCoords()); }