Beispiel #1
0
def stopped_working():
    global stop

    letter = array([       [  0,   0,   0,   0,   0,   0,   0,   0],
                              [255, 255,   0, 255, 255, 255,   0,   0],
                              [  0, 255, 255,   0,   0,   0, 255,   0],
                              [  0, 255, 255,   0,   0,   0, 255, 255],
                              [  0, 255, 255,   0,   0,   0, 255, 255],
                              [  0, 255, 255,   0,   0,   0, 255, 255],
                              [  0, 255, 255,   0,   0,   0, 255,   0],
                              [  0, 255, 255, 255, 255, 255,   0,   0],
                              [  0, 255, 255,   0,   0,   0,   0,   0],
                              [  0, 255, 255, 255, 255,   0,   0,   0],
                              [255, 255, 255, 255, 255,   0,   0,   0]], dtype="uint8")

    while not stop:
        with shoot_lock:
            # screenshots letter "N" as gray object, of the word "Nothing"
            # when "Nothing to mix..." comes up.
            gray_img = shoot(61,222,69,233)

        ret, thresh = threshold(gray_img, 50, 255,THRESH_BINARY)
        # numpy array of letter "N"
        if (letter == thresh).all():
            with turn_lock:
                mix_all()
                wait(1)
        else:
            wait(1)
Beispiel #2
0
def stopped_working():
    global stop

    letter = array(
        [[0, 0, 0, 0, 0, 0, 0, 0], [255, 255, 0, 255, 255, 255, 0, 0],
         [0, 255, 255, 0, 0, 0, 255, 0], [0, 255, 255, 0, 0, 0, 255, 255],
         [0, 255, 255, 0, 0, 0, 255, 255], [0, 255, 255, 0, 0, 0, 255, 255],
         [0, 255, 255, 0, 0, 0, 255, 0], [0, 255, 255, 255, 255, 255, 0, 0],
         [0, 255, 255, 0, 0, 0, 0, 0], [0, 255, 255, 255, 255, 0, 0, 0],
         [255, 255, 255, 255, 255, 0, 0, 0]],
        dtype="uint8")

    while not stop:
        with shoot_lock:
            # screenshots letter "N" as gray object, of the word "Nothing"
            # when "Nothing to mix..." comes up.
            gray_img = shoot(61, 222, 69, 233)

        ret, thresh = threshold(gray_img, 50, 255, THRESH_BINARY)
        # numpy array of letter "N"
        if (letter == thresh).all():
            with turn_lock:
                mix_all()
                wait(1)
        else:
            wait(1)
Beispiel #3
0
def you_failed():
    global stop
    letter_f = array([[  0,   0,   0, 255, 255, 255,   0],
                         [  0,   0, 255, 255, 255, 255, 255],
                         [  0,   0, 255,   0,   0,   0,   0],
                         [255, 255, 255, 255, 255, 255,   0],
                         [  0,   0, 255,   0,   0,   0,   0],
                         [  0,   0, 255,   0,   0,   0,   0],
                         [  0,   0, 255,   0,   0,   0,   0],
                         [  0,   0, 255,   0,   0,   0,   0],
                         [  0,   0, 255,   0,   0,   0,   0],
                         [255, 255, 255, 255, 255, 255,   0],
                         [  0,   0,   0,   0,   0,   0,   0]], dtype="uint8")
    
    while not stop:
        with shoot_lock:
            # screenshots letter "F" as gray object, of the word "Nothing"
            # when "Nothing to mix..." comes up.
            gray_img = shoot(38,220,45,231)
        # thresh is a binary image omg gray_img
        _, thresh = threshold(gray_img, 50, 255, THRESH_BINARY) 
        #cv2.imwrite('thresh.png', thresh)

        # if all elements in array equate to True
        if (letter_f == thresh).all():
            with turn_lock:
                mix_all()
                wait(1)
        wait(2)
Beispiel #4
0
def you_failed():
    global stop
    letter_f = array(
        [[0, 0, 0, 255, 255, 255, 0], [0, 0, 255, 255, 255, 255, 255],
         [0, 0, 255, 0, 0, 0, 0], [255, 255, 255, 255, 255, 255, 0],
         [0, 0, 255, 0, 0, 0, 0], [0, 0, 255, 0, 0, 0, 0],
         [0, 0, 255, 0, 0, 0, 0], [0, 0, 255, 0, 0, 0, 0],
         [0, 0, 255, 0, 0, 0, 0], [255, 255, 255, 255, 255, 255, 0],
         [0, 0, 0, 0, 0, 0, 0]],
        dtype="uint8")

    while not stop:
        with shoot_lock:
            # screenshots letter "F" as gray object, of the word "Nothing"
            # when "Nothing to mix..." comes up.
            gray_img = shoot(38, 220, 45, 231)
        # thresh is a binary image omg gray_img
        _, thresh = threshold(gray_img, 50, 255, THRESH_BINARY)
        #cv2.imwrite('thresh.png', thresh)

        # if all elements in array equate to True
        if (letter_f == thresh).all():
            with turn_lock:
                mix_all()
                wait(1)
        wait(2)
Beispiel #5
0
def safefail_mix():
    """Clicks on mix all in case a rare item is made, or something else not detected"""
    global stop

    counter = 0
    while not stop:
        # clicks mix all every 2 mins
        # in case a rare item is created or some other reason
        # to kickstart the other detector threads
        if counter == 120:
            with turn_lock:
                counter = 0
                mix_all()
        counter += 1
        wait(1)
Beispiel #6
0
def safefail_mix():
    """Clicks on mix all in case a rare item is made, or something else not detected"""
    global stop

    counter = 0
    while not stop:
        # clicks mix all every 2 mins
        # in case a rare item is created or some other reason
        # to kickstart the other detector threads
        if counter == 120:
            with turn_lock:
                counter = 0
                mix_all()
        counter += 1
        wait(1)
Beispiel #7
0
def calc_food():
    global stop, item_instance
    iterations = 0
    while not stop:
        with shoot_lock:
            # grabs food bar
            hsv_img = shoot(172,503,271,504, 'hsv')
        low = array([0,100,100])
        high = array([179,255,255])

        mask = inRange(hsv_img, low, high)

        #(conts, _) = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
        #print(contours)
        
        # turns the food bar into a 1 pixle wide binary image
        mask = array(mask)
        percentage = 0
        for color in mask:
            for element in color:
                if element == 0:
                    break
                percentage += 1
        # if the food bar is less than 1%
        if percentage < 1:
            with turn_lock:
                iterations += 1
                # on 4th iteration it withdraws more bones
                if iterations == 4:
                    open_itmlst_window()
                    wait(.1)
                    item_instance.get_bones() 
                    iterations = 0
                item_instance.eat()
                mix_all()

        wait(1)
Beispiel #8
0
def calc_food():
    global stop, item_instance
    iterations = 0
    while not stop:
        with shoot_lock:
            # grabs food bar
            hsv_img = shoot(172, 503, 271, 504, 'hsv')
        low = array([0, 100, 100])
        high = array([179, 255, 255])

        mask = inRange(hsv_img, low, high)

        #(conts, _) = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
        #print(contours)

        # turns the food bar into a 1 pixle wide binary image
        mask = array(mask)
        percentage = 0
        for color in mask:
            for element in color:
                if element == 0:
                    break
                percentage += 1
        # if the food bar is less than 1%
        if percentage < 1:
            with turn_lock:
                iterations += 1
                # on 4th iteration it withdraws more bones
                if iterations == 4:
                    open_itmlst_window()
                    wait(.1)
                    item_instance.get_bones()
                    iterations = 0
                item_instance.eat()
                mix_all()

        wait(1)
Beispiel #9
0
def nothing_to_mix():
    """needs fixing to a binary threshold"""
    global stop, item_instance, mix_iterations

    letter = array([       [  0, 255,   0,   0, 255, 255, 255,   0],
                              [255, 255, 255,   0, 255, 255, 255, 255],
                              [  0, 255, 255,   0,   0,   0, 255,   0],
                              [  0, 255, 255, 255,   0,   0, 255,   0],
                              [  0, 255, 255, 255,   0,   0, 255,   0],
                              [  0, 255, 255, 255, 255,   0, 255,   0],
                              [  0, 255,   0,   0, 255,   0, 255,   0],
                              [  0, 255,   0,   0, 255, 255, 255,   0],
                              [  0, 255,   0,   0,   0, 255, 255,   0],
                              [255, 255, 255, 255,   0,   0, 255,   0],
                              [  0,   0,   0,   0,   0,   0,   0,   0]], dtype="uint8")

    iterations = 0

    while not stop: 
        with shoot_lock:
            # screenshots letter "N" as gray object, of the word "Nothing"
            # when "Nothing to mix..." comes up.
            gray_img = shoot(5,220,13,231)
        _, gray_img = threshold(gray_img, 50,255,THRESH_BINARY)
        # numpy array of letter "N"
        if (letter == gray_img).all():
            if mix_iterations == iterations:
                stop = True
                break
            with turn_lock:
                # opens item list window
                open_itmlst_window()
                wait(.1)
                # withdraw more items 
                item_instance.run()
                iterations += 1
                print("Iterations: {}".format(iterations))
                wait(1)
        wait(3)
Beispiel #10
0
def nothing_to_mix():
    """needs fixing to a binary threshold"""
    global stop, item_instance, mix_iterations

    letter = array(
        [[0, 255, 0, 0, 255, 255, 255, 0],
         [255, 255, 255, 0, 255, 255, 255, 255], [
             0, 255, 255, 0, 0, 0, 255, 0
         ], [0, 255, 255, 255, 0, 0, 255, 0], [0, 255, 255, 255, 0, 0, 255, 0],
         [0, 255, 255, 255, 255, 0, 255, 0], [0, 255, 0, 0, 255, 0, 255, 0],
         [0, 255, 0, 0, 255, 255, 255, 0], [0, 255, 0, 0, 0, 255, 255, 0],
         [255, 255, 255, 255, 0, 0, 255, 0], [0, 0, 0, 0, 0, 0, 0, 0]],
        dtype="uint8")

    iterations = 0

    while not stop:
        with shoot_lock:
            # screenshots letter "N" as gray object, of the word "Nothing"
            # when "Nothing to mix..." comes up.
            gray_img = shoot(5, 220, 13, 231)
        _, gray_img = threshold(gray_img, 50, 255, THRESH_BINARY)
        # numpy array of letter "N"
        if (letter == gray_img).all():
            if mix_iterations == iterations:
                stop = True
                break
            with turn_lock:
                # opens item list window
                open_itmlst_window()
                wait(.1)
                # withdraw more items
                item_instance.run()
                iterations += 1
                print("Iterations: {}".format(iterations))
                wait(1)
        wait(3)