Ejemplo n.º 1
0
def check_for_currency(curr_item):
    # move cursor to first item slot in inventory 1300, 615
    gui.moveTo(TOP_LEFT_INVENTORY_COORDS)

    # sleep 0.1 second to allow item text to appear
    t.sleep(0.1)

    # take a screenshot of the currency item description
    img = screenshot(CURRENCY_DESCRIPTION_COORDS)

    # colors the currency image item name to white
    color_text(img, CURRENCY_ITEM_COLOR, WHITE_COLOR)

    # perform adjustments
    img = image_adjustments(img)

    #inventory_img = screenshot(top_left_inventory_coords)
    #inventory_img = image_adjustments(inventory_img)

    # parse the image for text
    currency_text = []

    for i in range(len(img)):
        currency_text.append(pytesseract.image_to_string(img[i], lang='eng', \
                                                         config = '--psm 12')\
                                                        .lower())
    return (search_text(curr_item, currency_text))
Ejemplo n.º 2
0
def check_inv_stash():
    # Screenshot top of screen
    header_img = screenshot(HEADER_COORDS)
    #header_img.show()

    # Perform adjustments
    header_img = image_adjustments(header_img)

    # Creates an empty list to store the parsed header text
    header_text = []

    # Parse the headers text
    for i in range(len(header_img)):
        header_text.append(pytesseract.image_to_string(header_img[i],
                                                       lang='eng',
                                                       config = '--psm 12')\
                                                       .lower())

    # count inventory and stash text
    inv_found = 0
    stash_found = 0
    for i in range(len(header_text)):
        if bool(re.search(HEADER_WORDS[0], header_text[i])):
            stash_found += 1
        if bool(re.search(HEADER_WORDS[1], header_text[i])):
            inv_found += 1

    # If inventory and stash counts are less than 1 return -1,
    # if both greater than 1 return 1
    if inv_found < 1 or stash_found < 1:
        return (-1)
    if inv_found > 0 and stash_found > 0:
        return (1)
Ejemplo n.º 3
0
def check_stash_tabs():
    gui.moveTo(TOP_LEFT_CORNER)
    parsed_text = []
    for i in range(len(TAB_BOARDER_COORDS)):
        img = screenshot(TAB_BOARDER_COORDS[i])
        img = color_text(img, STASH_YELLOW_TEXT, YELLOW_TEXT)
        img = color_text(img, STASH_BLACK_TEXT, BLACK_TEXT)
        img = image_adjustments(img)
        for j in range(len(img)):
            parsed_text.append(pytesseract.image_to_string(img[j], lang='eng', 
                                                      config = '--psm 12').lower())
    return(parsed_text)
Ejemplo n.º 4
0
def check_for_text(text, coords):
    gui.moveTo(TOP_LEFT_CORNER)
    
    img = screenshot(coords)
    img = color_text(img, STASH_BLACK_TEXT, BLACK_TEXT)
    img = color_text(img, STASH_YELLOW_TEXT, YELLOW_TEXT)
    img = image_adjustments(img)
    
    parsed_text = []
    for i in range(len(img)):
        parsed_text.append(pytesseract.image_to_string(img[i], lang='eng', 
                                                  config = '--psm 12').lower())
        
    text_found = 0
    #print(mod)
    for i in range(len(parsed_text)):      
        if bool(re.search(text, parsed_text[i])):
            text_found += 1
    # if mod found is greater than 0, mod is found so return -1 to stop rolling
    # mod found = 0, return 1 which indicates continue to roll
    if text_found > 0:
        return(-1)
    else:
        return(1) 
Ejemplo n.º 5
0
               (74, 74, 142), (73, 73, 141), (127, 127, 239), (81, 81, 155),\
               (98, 98, 162), (108, 108, 178), (96, 96, 182), (125, 125, 233),\
               (108, 108, 181), (97, 97, 184), (123, 123, 233),(109, 109, 207))

# create a list containing the words we're looking for in the image
currency_items = ['orb of alteration', 'chaos orb', 'orb of scouring', \
                  'orb of transmutation', 'regal orb']

coords = (52,133,586,158)

img = screenshot(coords)

img = color_text(img, STASH_BLACK_TEXT, BLACK_TEXT)
img = color_text(img, STASH_YELLOW_TEXT, YELLOW_TEXT)

img = image_adjustments(img)

parsed_text = []
for i in range(len(img)):
    parsed_text.append(pytesseract.image_to_string(img[i], lang='eng', 
                                              config = '--psm 12').lower())
parsed_text





img_set = img.getdata()
img_pixels = img.load()

counts = Counter(img_set)
Ejemplo n.º 6
0
def check_for_mod(mod):

    # moves to item coords
    gui.moveTo(ITEM_IN_STASH_COORDS)

    # Realized mod type is in name, dont need to parse alt text
    # holds down alt to display indepth item text
    #gui.keyDown('alt')

    # sleep 0.1 second to allow item text to appear
    t.sleep(0.1)

    # screenshot stash coords
    img = screenshot(ENTIRE_STASH_COORDS)

    # sleep 0.1 second to allow item text to appear
    t.sleep(0.1)

    # left off alt
    #gui.keyUp('alt')

    # adjust image colors, turn blue white
    img = color_text(img, BLUE_COLOR, WHITE_COLOR)
    #img = color_text(img, GREY_COLOR, WHITE_COLOR)

    # resize image
    img = image_adjustments(img)

    # parse the text from each imageand a create a list of strings from each images
    parsed_text_list = []
    for i in range(len(img)):
        parsed_text_list.append(
            pytesseract.image_to_string(img[i], lang='eng',
                                        config='--psm 12').lower())

#    parsed_text_list[1].split('\n')

    return (search_text(mod, parsed_text_list))


#    mod_found = 0
#    for i in range(len(parsed_text)):
#        if bool(re.search(mod, parsed_text[i])):
#            mod_found += 1
#    # if mod found is greater than 0, mod is found so return -1 to stop rolling
#    # mod found = 0, return 1 which indicates continue to roll
#    if mod_found > 0:
#        return(-1)
#    else:
#        return(1)

# checks for the desired mod on the item being rolled
#def check_for_text(text, coords):
#    #gui.moveTo(ITEM_IN_STASH_COORDS)
#
#    img = screenshot(coords)
#    img = color_text(img, STASH_BLACK_TEXT, BLACK_TEXT)
#    img = color_text(img, STASH_YELLOW_TEXT, YELLOW_TEXT)
#    img = image_adjustments(img)
#
#    parsed_text = []
#    for i in range(len(img)):
#        parsed_text.append(pytesseract.image_to_string(img[i], lang='eng',
#                                                  config = '--psm 12').lower())
#
#    text_found = 0
#    #print(mod)
#    for i in range(len(parsed_text)):
#        if bool(re.search(text, parsed_text[i])):
#            text_found += 1
#    # if mod found is greater than 0, mod is found so return -1 to stop rolling
#    # mod found = 0, return 1 which indicates continue to roll
#    if text_found > 0:
#        return(-1)
#    else:
#        return(1)