예제 #1
0
def main():
    item_n = RS.inventory_counter()
    print("Current itme number is:{}".format(item_n))
    while 1:
        if item_n == 28:
            break
        try:
            #mines the ore
            find_mine()
        except:
            RandTime.randTime(1, 0, 0, 1, 0, 9)
            continue

        # waits for obtained ore to move on
        safe_counter = 0  #if reaches a X amount safe switches
        while 1:
            current_n_items = RS.inventory_counter()
            # counts to make sure +1 has been added to inv
            if item_n + 1 == current_n_items:
                item_n = current_n_items
                break
            else:
                if safe_counter >= 45:
                    break
                RandTime.randTime(0, 1, 0, 0, 9, 9)
                safe_counter += 1
                continue

    print("Full Inv")
예제 #2
0
def tp_duel_arena():
    RS.press_button('equipment')
    # Teleports to Duel Arena
    # moves to the ring equpiment
    x,y = Mouse.genCoords(689,395,712,417)
    Mouse.moveClick(x,y,3)
    RS.findOptionClick(x,y,'duelArenaTeleport')
예제 #3
0
파일: miner.py 프로젝트: jjvilm/osrmacro
def main():
    item_n = RS.inventory_counter()
    print("Current itme number is:{}".format(item_n))
    while 1:
        if item_n == 28:
            break
        try:
            #mines the ore
            find_mine()
        except:
            RandTime.randTime(1,0,0,1,0,9)
            continue

        # waits for obtained ore to move on
        safe_counter = 0 #if reaches a X amount safe switches
        while 1:
            current_n_items = RS.inventory_counter()
            # counts to make sure +1 has been added to inv
            if item_n + 1 == current_n_items:
                item_n = current_n_items
                break
            else:
                if safe_counter >=45:
                    break
                RandTime.randTime(0,1,0,0,9,9)
                safe_counter += 1
                continue

    print("Full Inv")
예제 #4
0
def find_template(template_file, option=None):#pass template to function
    #option == to option in menu when righ-clicked on item
    #checks to see wheater to add cur dir or not
    if "/" not in template_file:
        template_file = cwd+"/imgs/"+template_file

    rs_bag, bagx,bagy = RS.get_bag("bag, and it's coords") #Screenshot taken here, 
    #loc is where the templates found are in 
    loc, w, h = Match.this(rs_bag, template_file)
    #for loops iterates through every found template
    for pt in zip(*loc[::-1]):#goes through each found image
        #pt = ((pt[0]+bagx),(pt[1]+bagy))
        #pt is the Top-left coord of the found template


        #create Bott-Right coord of found template
        btmX = pt[0] + w - ((w/2)/2)
        btmY = pt[1] + h - ((h/2)/2)
        #moving the pt coord of the template a bit to the right, so options menu get brought up
        pt = (pt[0]+((w/2)/2), pt[1]+((h/2)/2))

        #gencoord adds RS position
        x, y = gen_coords(pt,btmX, btmY)#gets random x, y coords relative to RSposition on where to click
        #x, y = Mouse.randCoord(pt, w, h)
        if option == 'click' or option == 1:
            Mouse.moveClick(x,y, 1)#left clicks on given x,y coords
        else:
            Mouse.moveClick(x,y, 3)#right clicks on given x,y coords
            #menu_x, menu_y, menu = RS.getOptionsMenu(x,y)#takes screenshot of options menu and returns the point at Top-left of the menu
            RandTime.randTime(0,0,0,0,0,1)

            #RS.findOptionClick(x,y, menu_x, menu_y, menu, option)
            RS.findOptionClick(x,y,option)
        break
예제 #5
0
파일: stringer.py 프로젝트: jjvilm/osrmacro
def withdrawFromBank(template_):
    rsx, rsy = RS.position()
    bankWindow, x1, y1 = RS.getBankWindow()
    loc, w, h = Match.this(bankWindow,template_)
    for pt in zip(*loc[::-1]):
        #unpackaged pt
        x, y = pt
        #make btm coords
        btmx = x + x1 + w - 5
        btmy = y + y1 + h - 5

        #add bankwindow+RS coords to pt
        x += x1 + 5
        y += y1 + 5
        #gen random coords
        x = random.randint(x,btmx)
        y = random.randint(y,btmy)

     
        Mouse.moveClick(x, y, 3 )
        #removing RS coords since they are added findOptionClick
        x -= rsx
        y -= rsy
        RS.findOptionClick(x,y,'withdraw14')
        break
예제 #6
0
def find_ham_guard():
    import random
    try:
        ps, psx, psy = RS.getPlayingScreen()

        lower_pink = np.array([154,0,0])
        upper_pink = np.array([160,255,255])

        mask = cv2.inRange(ps, lower_pink, upper_pink)


        _, contours, _ = cv2.findContours(mask.copy(), 1,2)

        for cnt in contours:
            if cv2.contourArea(cnt) <= 1:
                continue
            #print("Area: {}".format(cv2.contourArea(cnt)))
            M = cv2.moments(cnt)
            cx = int(M['m10']/M['m00'])
            cy = int(M['m01']/M['m00'])

            cx += psx
            cy += psy

            cx += random.randint(-20,20)
            cy += random.randint(-20,20)

            # Find bouding box coords

            Mouse.moveClick(cx,cy, 3)
            break

        RS.findOptionClick(cx,cy, 'pickpocket')
    except Exception as e:
        print(e)
예제 #7
0
def alching(clicks):
    RS.press_button('magic')

    for c in range(clicks):

#        autopy.mouse.toggle(True,1)
#        RandTime.randTime(0,0,0,0,0,1)
#        autopy.mouse.toggle(False,1)
#
#        RandTime.randTime(0,0,0,0,9,9)
#
#        autopy.mouse.toggle(True,1)
#        RandTime.randTime(0,0,0,0,0,1)
#        autopy.mouse.toggle(False,1)
#
#        #randomly moves mouse
#        x = random.randint(x1,x2)
#        y = random.randint(y1,y2)
#        print(x,y)

        # randomly moves to alch spell
        x,y = Mouse.genCoords(713,345,720,352)
        Mouse.moveClick(x+RSX,y+RSY,1)

        #RandTime.randTime(0,1,0,0,1,9)
        # randomly moves to alched item
        x,y = Mouse.genCoords(697,348,713,364)
        Mouse.moveClick(x+RSX,y+RSY,1)


        RandTime.randTime(1,1,0,1,9,9)
        RS.antiban('magic')
예제 #8
0
def moveToFletchingOptions(item):
    cwd = os.getcwd()
    rsx, rsy = RS.position()  #gets position of RS window

    #x = rsx + random.randint(23,167)#x coord range of short bow
    #y = rsy + random.randint(397,469) #y respectivaly
    x, y = Mouse.genCoords(206, 225, 221, 266)

    Mouse.moveClick(x, y, 3)  #right-clicks on short bow
    #taking away rs position since getoptionsmenu func adds them back in
    x = x - rsx
    y = y - rsy
    #gets screenshot
    menu_x, menu_y, menu = RS.getOptionsMenu(x, y)
    loc, w, h = Match.this(menu, cwd + '/imgs/makeX.png')
    #runs though the imgae to find it and click it
    for pt in zip(*loc[::-1]):
        pt_x, pt_y = pt  #unpackes the pt into x,y

        x_a = menu_x + pt_x + (random.randint(1, (w * 2)))
        y_a = menu_y + pt_y + (random.randint(5, h))

        #moves to 'Make X'
        Mouse.moveTo(x_a, y_a)

        #clicks on 'Make X'
        Mouse.click(1)
        RandTime.randTime(1, 5, 0, 1, 9, 9)

        Keyboard.type_this("99")
        Keyboard.press('enter')
        break
예제 #9
0
def main():
    while 1:
        # check health
        if Health.percentage() <= 0.20:
            print(Health.percentage())
            print("Low on Health!\nStopping!!")
            return
        # initial count of inventory
        n_items_in_inventory = RS.inventory_counter()
        # stops if inv full
        if n_items_in_inventory >= 28:
            print("Inventory Full\nScript stopped!")
            # drop items here, then continue script
            RS.inventory_counter(showImg)

            return
        # pickpockets guard
        find_ham_guard()
        # loop to wait while confuse
        #RandTime.randTime(0,4,0,0,8,9)
        RandTime.randTime(0,0,1,0,0,9)
        if RS.inventory_counter() > n_items_in_inventory:
            continue
        else:
            while 1:
                if find_yellow_birds():
                    # waits for confuse to stop to loop
                    while find_yellow_birds():
                        pass
                else:
                    break
예제 #10
0
def main():
    while 1:
        # check health
        if Health.percentage() <= 0.20:
            print(Health.percentage())
            print("Low on Health!\nStopping!!")
            return
        # initial count of inventory
        n_items_in_inventory = RS.inventory_counter()
        # stops if inv full
        if n_items_in_inventory >= 28:
            print("Inventory Full\nScript stopped!")
            # drop items here, then continue script
            RS.inventory_counter(showImg)

            return
        # pickpockets guard
        find_ham_guard()
        # loop to wait while confuse
        #RandTime.randTime(0,4,0,0,8,9)
        RandTime.randTime(0, 0, 1, 0, 0, 9)
        if RS.inventory_counter() > n_items_in_inventory:
            continue
        else:
            while 1:
                if find_yellow_birds():
                    # waits for confuse to stop to loop
                    while find_yellow_birds():
                        pass
                else:
                    break
예제 #11
0
def alching(clicks):
    RS.press_button('magic')

    for c in range(clicks):

        #        autopy.mouse.toggle(True,1)
        #        RandTime.randTime(0,0,0,0,0,1)
        #        autopy.mouse.toggle(False,1)
        #
        #        RandTime.randTime(0,0,0,0,9,9)
        #
        #        autopy.mouse.toggle(True,1)
        #        RandTime.randTime(0,0,0,0,0,1)
        #        autopy.mouse.toggle(False,1)
        #
        #        #randomly moves mouse
        #        x = random.randint(x1,x2)
        #        y = random.randint(y1,y2)
        #        print(x,y)

        # randomly moves to alch spell
        x, y = Mouse.genCoords(713, 345, 720, 352)
        Mouse.moveClick(x + RSX, y + RSY, 1)

        #RandTime.randTime(0,1,0,0,1,9)
        # randomly moves to alched item
        x, y = Mouse.genCoords(697, 348, 713, 364)
        Mouse.moveClick(x + RSX, y + RSY, 1)

        RandTime.randTime(1, 1, 0, 1, 9, 9)
        RS.antiban('magic')
예제 #12
0
def find_ham_guard():
    import random
    try:
        ps, psx, psy = RS.getPlayingScreen()

        lower_pink = np.array([154, 0, 0])
        upper_pink = np.array([160, 255, 255])

        mask = cv2.inRange(ps, lower_pink, upper_pink)

        _, contours, _ = cv2.findContours(mask.copy(), 1, 2)

        for cnt in contours:
            if cv2.contourArea(cnt) <= 1:
                continue
            #print("Area: {}".format(cv2.contourArea(cnt)))
            M = cv2.moments(cnt)
            cx = int(M['m10'] / M['m00'])
            cy = int(M['m01'] / M['m00'])

            cx += psx
            cy += psy

            cx += random.randint(-20, 20)
            cy += random.randint(-20, 20)

            # Find bouding box coords

            Mouse.moveClick(cx, cy, 3)
            break

        RS.findOptionClick(cx, cy, 'pickpocket')
    except Exception as e:
        print(e)
예제 #13
0
def moveToFletchingOptions(item):
    cwd = os.getcwd()
    rsx, rsy = RS.position() #gets position of RS window

    #x = rsx + random.randint(23,167)#x coord range of short bow
    #y = rsy + random.randint(397,469) #y respectivaly
    x,y = Mouse.genCoords(206,225,221,266)


    Mouse.moveClick(x,y,3) #right-clicks on short bow
    #taking away rs position since getoptionsmenu func adds them back in
    x = x - rsx
    y = y - rsy
    #gets screenshot
    menu_x, menu_y, menu = RS.getOptionsMenu(x,y)
    loc, w, h = Match.this(menu, cwd+'/imgs/makeX.png')
    #runs though the imgae to find it and click it
    for pt in zip(*loc[::-1]):
        pt_x, pt_y = pt #unpackes the pt into x,y

        x_a = menu_x + pt_x + (random.randint(1,(w*2)))
        y_a = menu_y + pt_y + (random.randint(5,h))

        #moves to 'Make X'
        Mouse.moveTo(x_a,y_a)

        #clicks on 'Make X'
        Mouse.click(1)
        RandTime.randTime(1,5,0,1,9,9)

        Keyboard.type_this("99")
        Keyboard.press('enter')
        break
예제 #14
0
파일: stringer.py 프로젝트: jjvilm/osrmacro
def makeBow():
    """selects option to "make all" bows when bowstring and unstrung bow are clicked"""
    rsx, rsy = RS.position()
    x = random.randint(rsx+220, rsx+300)
    y = random.randint(rsy+408, rsy+467)
    Mouse.moveClick(x,y, 3)

    #Remvoing RS coords 
    x -= rsx
    y -= rsy
    RS.findOptionClick(x,y,'makeAll')
예제 #15
0
def makeBow():
    """selects option to "make all" bows when bowstring and unstrung bow are clicked"""
    rsx, rsy = RS.position()
    x = random.randint(rsx + 220, rsx + 300)
    y = random.randint(rsy + 408, rsy + 467)
    Mouse.moveClick(x, y, 3)

    #Remvoing RS coords
    x -= rsx
    y -= rsy
    RS.findOptionClick(x, y, 'makeAll')
예제 #16
0
def main():
    while True:
        p = check_prayer()
        print("{:.2f}".format(p))
        if p <= .25:
            if not RS.is_button_selected('inventory'):
                RS.press_button('inventory')
            find_prayer_pot()
        if p == 0:
            print('NO POTIONS FOUND, TERMINATING MACRO!')
            return
        time.sleep(3)
예제 #17
0
def find_template(template_name):  #pass template to function
    global imd
    #checks to see wheater to add cur dir or not
    x1, y1 = RS.position()  #Get runescapes top-left coords

    x1 += 557  #make The Bag's top-left, and btm-right coords
    y1 += 229  #x2,y2 == btm-right coord, width and height
    x2 = x1 + 173
    y2 = y1 + 253

    if not RS.is_button_selected('inventory'):
        #RS.press_button('inventory')
        init_x = random.randint(x1, x2)
        init_y = random.randint(y1, y2)

        Mouse.moveTo(init_x, init_y)
        autopy.key.tap(autopy.key.K_F1)

    # image of bag
    rs_bag = Screenshot.shoot(x1, y1, x2, y2)  #Screenshot taken here,
    # cv2.imshow('bag', rs_bag)
    # cv2.waitKey(0)

    #template
    template = imd.pickled_dict[template_name]
    #imd.showImg('salmon')
    color_mode, w, h = template.shape[::-1]
    # change img to grayscale
    if color_mode == 3:
        template = cv2.cvtColor(template, cv2.COLOR_RGB2GRAY)
    res = cv2.matchTemplate(rs_bag, template, cv2.TM_CCOEFF_NORMED)
    threshold = .8  #default is 8
    loc = np.where(res >= threshold)
    for pt in zip(*loc[::-1]):  #goes through each found image
        btmX = pt[
            0] + w - 5  #pt == top-left coord of template, bottom-right point of of template image
        btmY = pt[1] + h - 5
        #moving the pt coord of the template a bit to the right, so options menu get brought up
        pt = (pt[0] + 5, pt[1] + 2)

        x, y = gen_coords(
            pt, btmX, btmY
        )  #gets random x, y coords relative to RSposition on where to click
        #Mouse.moveClick(x,y, 3)#right clicks on given x,y coords

        # using new method to drop. holding shift
        autopy.key.toggle(autopy.key.K_SHIFT, True)
        Mouse.moveClick(x, y, 1)  #right clicks on given x,y coords
        autopy.key.toggle(autopy.key.K_SHIFT, False)

        #RS.findOptionClick(x,y,'drop')

    RandTime.randTime(2, 0, 0, 2, 9, 9)
예제 #18
0
def withdraw_from_bank(template_file, option):  #pass template to function
    #option == to option in menu options when righ-clicked on item
    #checks to see wheater to add cur dir or not
    cwd = os.getcwd()
    if "/" not in template_file:
        template_file = cwd + "/imgs/" + template_file
    #	print(template_file, "file in withraw_from_bank()")

    #creating bank window coords
    rsx, rsy = RS.position()
    #creates  sceenshot object of bankwindow,
    bankWindow, x1, y1 = RS.getBankWindow()
    #SAVE for DEBUG
    #cv2.imwrite('debug_inBankLog.png',bankWindow)

    # This For loop runs through found matches and clicks or right-clicks
    #loc == coordinates found in match
    loc, w, h = Match.this(bankWindow, template_file)
    for pt in zip(*loc[::-1]):  #goes through each found image
        #adds x1,y1 coords to pt to be relative to the window
        #pt = (x1+pt[0]+((w/2)/2), y1+pt[1]+((h/2)/2))#
        pt = (x1 + pt[0], y1 + pt[1])  #
        #Bottom-Right coords of found template
        btmX = pt[0] + w - ((w / 2) / 2)
        btmY = pt[1] + h - ((h / 2) / 2)

        # moving point inwards
        pt = (pt[0] + ((w / 2) / 2), pt[1] + ((h / 2) / 2))

        #create random coords within the coords of the found template
        rx = random.randint(pt[0], btmX)
        ry = random.randint(pt[1], btmY)

        if option == 'click':
            Mouse.moveClick(rx, ry, 1)
            break
        else:
            #right clicks on given x,y coords
            Mouse.moveClick(rx, ry, 3)
            RandTime.randTime(0, 0, 0, 0, 0, 1)

            #Removing rsx,rsy coords from rx, ry
            #becuase RS.getOptions adds them in by default
            rx -= rsx
            ry -= rsy

            RS.findOptionClick(rx, ry, 'withdrawAll')
            break
예제 #19
0
def withdraw_from_bank(template_file, option):#pass template to function
    #option == to option in menu options when righ-clicked on item
    #checks to see wheater to add cur dir or not
    cwd = os.getcwd()
    if "/" not in template_file:
            template_file = cwd+"/imgs/"+template_file
    #	print(template_file, "file in withraw_from_bank()")

    #creating bank window coords
    rsx,rsy = RS.position()
    #creates  sceenshot object of bankwindow, 	
    bankWindow, x1, y1 = RS.getBankWindow()
    #SAVE for DEBUG
    #cv2.imwrite('debug_inBankLog.png',bankWindow)
    
    # This For loop runs through found matches and clicks or right-clicks
    #loc == coordinates found in match
    loc, w, h = Match.this(bankWindow, template_file)
    for pt in zip(*loc[::-1]):#goes through each found image
        #adds x1,y1 coords to pt to be relative to the window
        #pt = (x1+pt[0]+((w/2)/2), y1+pt[1]+((h/2)/2))#
        pt = (x1+pt[0], y1+pt[1])#
        #Bottom-Right coords of found template
        btmX =  pt[0] + w - ((w/2)/2)
        btmY =  pt[1] + h - ((h/2)/2)

        # moving point inwards
        pt = (pt[0]+((w/2)/2), pt[1]+((h/2)/2))

        #create random coords within the coords of the found template
        rx = random.randint(pt[0],btmX)
        ry = random.randint(pt[1],btmY)

        if option == 'click':
            Mouse.moveClick(rx,ry,1)
            break
        else:
            #right clicks on given x,y coords
            Mouse.moveClick(rx,ry, 3)
            RandTime.randTime(0,0,0,0,0,1)

            #Removing rsx,rsy coords from rx, ry 
            #becuase RS.getOptions adds them in by default
            rx -= rsx
            ry -= rsy

            RS.findOptionClick(rx,ry,'withdrawAll')
            break
예제 #20
0
def find_prayer_pot():
    rs_bag, bagx, bagy = RS.get_bag('bag coords', 'hsv')
    # prayer potion color ranges
    low = np.array([78,140,0])
    high= np.array([81,225,211])
    mask = cv2.inRange(rs_bag, low, high)

    kernel = np.ones((5,5), np.uint8)
    dilation = cv2.dilate(mask, kernel, iterations = 1)
    
    _,contours, _ = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

    for con in contours:
        x, y, w, h = cv2.boundingRect(con)
        cv2.rectangle(mask,(x,y), (x+w, y+h), (255,255,255),-1)

    _,contours, _ = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    for con in contours[::-1]:
        M = cv2.moments(con)
        mx, my = int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"])
        mx += RSX + bagx
        my += RSY + bagy

        mx += random.randint(-7,7)
        my += random.randint(-12,5)

        Mouse.moveClick(mx,my,1)
        #Mouse.moveTo(mx,my)
        break
예제 #21
0
def findherb(herb_object):
    #takes bank screenshot
    bank_screenshot, bankx, banky = RS.getBankWindow('hsv')

    # finds all grimmys first
    low, high = herb_object.herbdic['grimmy']
    low = np.array(low)
    high = np.array(high)
    mask = cv2.inRange(bank_screenshot, low, high)

    # how big in pixels to remove noise
    kernel = np.ones((5,5), np.uint8)

    # removes noise
    #erosion = cv2.erode(mask, kernel, iterations = 1)

    # increases white 
    dilation = cv2.dilate(mask, kernel, iterations = 1)

    _, contours, _ = cv2.findContours(dilation.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    # fills in the contours in the mask with a rect
    for con in contours:
        x, y, w, h = cv2.boundingRect(con)
        cv2.rectangle(mask,(x,y),(x+w,y+h),(255,255,255),-1)
    # result of finding only grimmys in the hsv image
    res = cv2.bitwise_and(bank_screenshot,bank_screenshot, mask = mask.copy())
    # finding the passed herb here based on color range 
    low, high = herb_object.hsv_range
    low = np.array(low)
    high = np.array(high)
    herb_mask = cv2.inRange(res, low, high)
    ###########
    #debug line
    #cv2.imshow('debug.png', herb_mask)
    #cv2.waitKey(0)
    #return
    ###########

    _, contours, _ = cv2.findContours(herb_mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    contour_areas = {}
    # finds center of herb
    for con in contours:
        M = cv2.moments(con)
        #print(M)
        # gets center of object
        x,y = int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"])
        break
    if y == 1:
        return 
    # makes coords relative to the window
    x += RSX + bankx
    y += RSY + banky
    # creates a list from -20 to 20
    pixels = [i for i in range(-15,15)]
    # randomly adds value from pixels list
    x += random.choice(pixels)
    y += random.choice(pixels)

    # returns coords to right click and get options
    return x, y 
예제 #22
0
def findWine():
    ######### find wine only in tabel!!! to make ti work better##########
    ps, psx, psy = RS.getPlayingScreen()

    lower = np.array([0,4,117])
    upper = np.array([16,22,182])

    mask = cv2.inRange(ps, lower, upper)

    # removes left side of stall
    w, h = mask.shape
    cv2.rectangle(mask,(0,0),(w,h),(0,0,0),-1)

    _, contours, _  = cv2.findContours(mask.copy(), 1, 2)
    # find biggest area
    biggest_area = 0
    for cnt in contours:
        if cv2.contourArea(cnt) > biggest_area:
            biggest_area = cv2.contourArea(cnt)

    # click on bnding rectangle of biggest area
    for cnt in contours:
        if cv2.contourArea(cnt) == biggest_area and biggest_area > 100:
            x,y,w,h = cv2.boundingRect(cnt)
            #cv2.rectangle(mask, (x,y), (x+w, y+h), (255,255,255), -1)
            x = x + psx
            y = y + psy

            Mouse.moveClick(x,y,1)
            return
예제 #23
0
def find_mine():
    global mine_this
    mines = {
        'tin1': ([0, 13, 104], [3, 73, 148]),
        'tin': ([0, 19, 121], [1, 30, 136]),
        'cooper': ([14, 135, 88], [15, 140, 169]),
        'iron': ([7, 138, 50], [10, 146, 85]),
        'gems': ([150, 223, 61], [151, 235, 169])
    }

    play_window, psx, psy = RS.getPlayingScreen()

    #mask = cv2.inRange(play_window, np.array(mines['tin'][0]), np.array(mines['tin'][1]))
    #mask = cv2.inRange(play_window, np.array(mines['cooper'][0]), np.array(mines['cooper'][1]))
    mask = cv2.inRange(play_window, np.array(mines[mine_this][0]),
                       np.array(mines[mine_this][1]))

    kernel = np.ones((20, 20), np.uint8)
    closing = cv2.morphologyEx(mask.copy(), cv2.MORPH_CLOSE, kernel)

    _, contours, _ = cv2.findContours(closing.copy(), 1, 2)
    # adds white rectangle around the mines
    for con in contours:
        x, y, w, h = cv2.boundingRect(con)
        cv2.rectangle(closing, (x, y), (x + w, y + h), (255, 255, 255), -1)
    #cv2.imshow('closing', closing)
    #cv2.waitKey(0)

    # finds mine mounts
    _, contours, _ = cv2.findContours(closing.copy(), 1, 2)
    mine_areas = {}
    for con in contours:
        #print("\n###############################")
        #print(cv2.contourArea(con))
        if cv2.contourArea(con) > 500:
            #print(cv2.contourArea(con))
            M = cv2.moments(con)
            cx = int(M['m10'] / M['m00'])
            cy = int(M['m01'] / M['m00'])
            # adds areas to dictionary to call next
            mine_areas[cv2.contourArea(con)] = (cx, cy)

    try:
        # gets random mine from mine areas
        random_mine = random.choice(mine_areas.keys())
    except Exception as e:
        #print(e)
        random_mine = mine_areas[mine_areas.keys()[0]]
    #print(random_mine)
    mine_center_x, mine_center_y = mine_areas[random_mine]
    # combine coords with playscreen to make relative
    mine_center_x += psx
    mine_center_y += psy

    # adds randomness to coords
    mine_center_x += random.randint(-11, 11)
    mine_center_y += random.randint(-11, 11)

    Mouse.moveClick(mine_center_x, mine_center_y, 1)
예제 #24
0
def count_logs(template_file):
    rs_bag = RS.get_bag('only')
    loc, w, h = Match.this(rs_bag, template_file)
    count = 0
    for pt in zip(*loc[::-1]):
        count += 1
        break
    return count
예제 #25
0
def count_logs(template_file):
    rs_bag = RS.get_bag('only')
    loc, w, h = Match.this(rs_bag, template_file)
    count = 0
    for pt in zip(*loc[::-1]):
        count +=1
        break
    return count
예제 #26
0
파일: miner.py 프로젝트: jjvilm/osrmacro
def find_mine():
    global mine_this
    mines = {
        'tin1':([0,13,104],[3,73,148]),
        'tin':([0,19,121],[1,30,136]),
        'cooper':([14,135,88],[15,140,169]),
        'iron':([7,138,50],[10,146,85]),
        'gems':([150,223,61],[151,235,169])
    }

    play_window,psx,psy = RS.getPlayingScreen()

    #mask = cv2.inRange(play_window, np.array(mines['tin'][0]), np.array(mines['tin'][1]))
    #mask = cv2.inRange(play_window, np.array(mines['cooper'][0]), np.array(mines['cooper'][1]))
    mask = cv2.inRange(play_window, np.array(mines[mine_this][0]), np.array(mines[mine_this][1]))

    kernel = np.ones((20,20), np.uint8)
    closing  =  cv2.morphologyEx(mask.copy(), cv2.MORPH_CLOSE, kernel)

    _,contours,_ = cv2.findContours(closing.copy(), 1, 2)
    # adds white rectangle around the mines
    for con in contours:
        x,y,w,h = cv2.boundingRect(con)
        cv2.rectangle(closing,(x,y),(x+w,y+h),(255,255,255),-1)
    #cv2.imshow('closing', closing)
    #cv2.waitKey(0)

    # finds mine mounts
    _,contours,_ = cv2.findContours(closing.copy(), 1, 2)
    mine_areas = {}
    for con in contours:
        #print("\n###############################")
        #print(cv2.contourArea(con))
        if cv2.contourArea(con) > 500:
            #print(cv2.contourArea(con))
            M = cv2.moments(con)
            cx = int(M['m10']/M['m00'])
            cy = int(M['m01']/M['m00'])
            # adds areas to dictionary to call next
            mine_areas[cv2.contourArea(con)] = (cx,cy)

    try:
        # gets random mine from mine areas
        random_mine = random.choice(mine_areas.keys())
    except Exception as e:
        #print(e)
        random_mine = mine_areas[mine_areas.keys()[0]]
    #print(random_mine)
    mine_center_x, mine_center_y = mine_areas[random_mine]
    # combine coords with playscreen to make relative
    mine_center_x += psx 
    mine_center_y += psy

    # adds randomness to coords
    mine_center_x += random.randint(-11,11)
    mine_center_y += random.randint(-11,11)

    Mouse.moveClick(mine_center_x, mine_center_y,1)
예제 #27
0
    def __init__(self):
        self.rs_x, self.rs_y = RS.position() 

        self.telSalve()
        time.sleep(3)
        self.find_transportation_arrow()
        time.sleep(5)
        print('lookcing for fairly ring')
        self.find_fairy_ring()
예제 #28
0
    def __init__(self):
        self.rs_x, self.rs_y = RS.position()

        self.telSalve()
        time.sleep(3)
        self.find_transportation_arrow()
        time.sleep(5)
        print('lookcing for fairly ring')
        self.find_fairy_ring()
예제 #29
0
    def check_list(self):
        items_dict = imd.ImageStorage()
        items_dict = items_dict.pickled_dict

        RS.press_button('equipment')
        time.sleep(1)
        for key in items_dict.keys():
            template = items_dict[key]
            #save for DEBUG
            #cv2.imwrite('debug_template_file', template_)
            w, h = template.shape[::-1]
            pattern = RS.get_bag('only','gray')
            res = cv2.matchTemplate(pattern,template,cv2.TM_CCOEFF_NORMED)
            threshold = .8 #default is 8 
            loc = np.where( res >= threshold)

            for pt in zip(*loc[::-1]):#goes through each found image
                print('{} found'.format(key))
                break
            else:
                print('{} not found'.format(key))
예제 #30
0
    def check_list(self):
        items_dict = imd.ImageStorage()
        items_dict = items_dict.pickled_dict

        RS.press_button('equipment')
        time.sleep(1)
        for key in items_dict.keys():
            template = items_dict[key]
            #save for DEBUG
            #cv2.imwrite('debug_template_file', template_)
            w, h = template.shape[::-1]
            pattern = RS.get_bag('only', 'gray')
            res = cv2.matchTemplate(pattern, template, cv2.TM_CCOEFF_NORMED)
            threshold = .8  #default is 8
            loc = np.where(res >= threshold)

            for pt in zip(*loc[::-1]):  #goes through each found image
                print('{} found'.format(key))
                break
            else:
                print('{} not found'.format(key))
예제 #31
0
파일: stringer.py 프로젝트: jjvilm/osrmacro
def checkInv(template):
    """Finds bowstring and unstrung bow in inventory and clicks them, if not found then returns false, true otherwise"""
    rs_bag, bgx, bgy = RS.get_bag('bag and other variables')
    loc, w, h = Match.this(rs_bag,template )
    for pt in zip(*loc[::-1]):
        #assigns random values to pt 
        x, y = pt
        x = random.randint(pt[0], pt[0]+w)
        y = random.randint(pt[1], pt[1]+h)
        pt = (x,y)
        dobowstring(pt, w, h, bgx, bgy)
        return True
    return False
예제 #32
0
def checkInv(template):
    """Finds bowstring and unstrung bow in inventory and clicks them, if not found then returns false, true otherwise"""
    rs_bag, bgx, bgy = RS.get_bag('bag and other variables')
    loc, w, h = Match.this(rs_bag, template)
    for pt in zip(*loc[::-1]):
        #assigns random values to pt
        x, y = pt
        x = random.randint(pt[0], pt[0] + w)
        y = random.randint(pt[1], pt[1] + h)
        pt = (x, y)
        dobowstring(pt, w, h, bgx, bgy)
        return True
    return False
예제 #33
0
파일: fletcher.py 프로젝트: jjvilm/osrmacro
def moveToFletchingOptions(bow):
    cwd = os.getcwd()
    rsx, rsy = RS.position() #gets position of RS window

    #x = rsx + random.randint(23,167)#x coord range of short bow
    #y = rsy + random.randint(397,469) #y respectivaly

    if 'magic' in bow:
        x,y = Mouse.genCoords(350,405,450,456)
        x += rsx
        y += rsy
    elif 'yew' in bow or 'maple' in bow:
        x = rsx + random.randint(290,338)#x coord range of long bow. Defautl 209,299
        y = rsy + random.randint(405,466) #BR-coord of longbow. Default: 395,456

    Mouse.moveClick(x,y,3) #right-clicks on short bow
    #taking away rs position since getoptionsmenu func adds them back in
    x = x - rsx
    y = y - rsy
    #gets screenshot
    menu_x, menu_y, menu = RS.getOptionsMenu(x,y)
    loc, w, h = Match.this(menu, cwd+'/imgs/makeX.png')
    #runs though the imgae to find it and click it
    for pt in zip(*loc[::-1]):
        pt_x, pt_y = pt #unpackes the pt into x,y

        x_a = menu_x + pt_x + (random.randint(1,(w*2)))
        y_a = menu_y + pt_y + (random.randint(5,h))

        #moves to 'Make X'
        Mouse.moveTo(x_a,y_a)

        #clicks on 'Make X'
        Mouse.click(1)
        RandTime.randTime(1,5,0,1,9,9)

        Keyboard.type_this("99")
        Keyboard.press('enter')
        break
예제 #34
0
def find_motherload_mine():
    """Returns mine's location x, and y coords"""
    play_img, psx, psy = RS.getPlayingScreen()

    mines = {
        0: (np.array([0, 0, 153]), np.array([8, 25, 209])),
        1: (np.array([0, 0, 72]), np.array([2, 25, 144]))
    }

    for mine_key in mines.keys():
        #print("Mine: {}".format(mine_key))
        lower = mines[mine_key][0]
        upper = mines[mine_key][1]

        mask = cv2.inRange(play_img, lower, upper)

        kernel = np.ones((10, 10), np.uint8)

        closing = cv2.morphologyEx(mask.copy(), cv2.MORPH_CLOSE, kernel)

        #cv2.imshow('mask', mask)
        #cv2.imshow('closing', closing)
        #cv2.waitKey(0)

        _, contours, _ = cv2.findContours(mask.copy(), cv2.RETR_TREE,
                                          cv2.CHAIN_APPROX_SIMPLE)
        if contours[0].any():
            pass
        else:
            print('didnt find contours')
            break

        for con in contours[::-1]:
            M = cv2.moments(con)
            if cv2.contourArea(con) > 20:
                # Shows the mask

                #centroid from img moments
                cx = int(M['m10'] / M['m00'])
                cy = int(M['m01'] / M['m00'])

                #combine psx,psy coords with centroid coords from above
                cx += psx
                cy += psy

                #print("Area:",cv2.contourArea(con))
                #print(con[0][0][0],con[0][0][1])
                Mouse.moveClick(cx, cy, 1)
                return cx, cy
            else:
                continue
예제 #35
0
def main():
    # runs main loop
    # gets initial count of inventory items
    item_n = RS.inventory_counter()
    while 1:
        # stops when inventory is full
        if item_n == 28:
            RS.play_sound()
            break
        try:
            # keeps mining
            cx, cy, = find_motherload_mine()
            #check_mine_availability(cx,cy)

        except:
            # slows down the loop by ~second
            RandTime.randTime(1, 0, 0, 1, 9, 9)
            continue
        # waits for obtained ore to restart loop
        item_n = RS.inventory_counter()

        times_till_break = 0
        while 1:
            # safety measure to make sure it does not get stuck counting inventory
            if times_till_break == 3:
                print('Escaping inventory loop')
                times_till_break = 0
                break
            current_n_items = RS.inventory_counter()
            # counts to make sure +1 has been added to inv
            if current_n_items >= item_n + 1:
                item_n = current_n_items
                RandTime.randTime(4, 0, 0, 7, 9, 9)
                break
            else:
                times_till_break += 1
                RandTime.randTime(7, 0, 0, 15, 9, 9)
                continue
예제 #36
0
def find_template(template_file, option=None):  #pass template to function
    #option == to option in menu when righ-clicked on item
    #checks to see wheater to add cur dir or not
    if "/" not in template_file:
        template_file = cwd + "/imgs/" + template_file

    rs_bag, bagx, bagy = RS.get_bag(
        "bag, and it's coords")  #Screenshot taken here,
    #loc is where the templates found are in
    loc, w, h = Match.this(rs_bag, template_file)
    #for loops iterates through every found template
    for pt in zip(*loc[::-1]):  #goes through each found image
        #pt = ((pt[0]+bagx),(pt[1]+bagy))
        #pt is the Top-left coord of the found template

        #create Bott-Right coord of found template
        btmX = pt[0] + w - ((w / 2) / 2)
        btmY = pt[1] + h - ((h / 2) / 2)
        #moving the pt coord of the template a bit to the right, so options menu get brought up
        pt = (pt[0] + ((w / 2) / 2), pt[1] + ((h / 2) / 2))

        #gencoord adds RS position
        x, y = gen_coords(
            pt, btmX, btmY
        )  #gets random x, y coords relative to RSposition on where to click
        #x, y = Mouse.randCoord(pt, w, h)
        if option == 'click' or option == 1:
            Mouse.moveClick(x, y, 1)  #left clicks on given x,y coords
        else:
            Mouse.moveClick(x, y, 3)  #right clicks on given x,y coords
            #menu_x, menu_y, menu = RS.getOptionsMenu(x,y)#takes screenshot of options menu and returns the point at Top-left of the menu
            RandTime.randTime(0, 0, 0, 0, 0, 1)

            #RS.findOptionClick(x,y, menu_x, menu_y, menu, option)
            RS.findOptionClick(x, y, option)
        break
예제 #37
0
def withdrawFromBank(template_):
    rsx, rsy = RS.position()
    bankWindow, x1, y1 = RS.getBankWindow()
    loc, w, h = Match.this(bankWindow, template_)
    for pt in zip(*loc[::-1]):
        #unpackaged pt
        x, y = pt
        #make btm coords
        btmx = x + x1 + w - 5
        btmy = y + y1 + h - 5

        #add bankwindow+RS coords to pt
        x += x1 + 5
        y += y1 + 5
        #gen random coords
        x = random.randint(x, btmx)
        y = random.randint(y, btmy)

        Mouse.moveClick(x, y, 3)
        #removing RS coords since they are added findOptionClick
        x -= rsx
        y -= rsy
        RS.findOptionClick(x, y, 'withdraw14')
        break
예제 #38
0
파일: login.py 프로젝트: jonkojack/osrmacro
def log_in(user='******', passwd='nopass'):
    #sets default size if not already on default
    RS.setWindowSize()
    rsx, rsy = RS.position()
    #moves to Existing User button
    Mouse.moveClick(rsx + (random.randint(403, 530)),
                    rsy + (random.randint(302, 326)), 1)
    #Types user name
    Keyboard.type_this(user)
    #presses tab
    delay_mili = random.random()
    os.system('xdotool key --delay {0} Tab'.format(delay_mili))

    #Types password
    Keyboard.type_this(passwd)
    #Moves to login button and clicks it
    Mouse.moveClick(rsx + (random.randint(238, 365)),
                    rsy + (random.randint(329, 353)), 1)
    #Waits 4 secs after login in
    time.sleep(4)
    RandTime.randTime(0, 0, 0, 0, 0, 9)
    #moves to login box(red login button)
    x, y = log_in_box()
    Mouse.moveClick(x, y)
예제 #39
0
def find_yellow_birds():
    ps, psx, psy = RS.getPlayingScreen()

    lower_pink = np.array([28,197,168])
    upper_pink = np.array([29,234,239])

    mask = cv2.inRange(ps, lower_pink, upper_pink)

    #cv2.imshow('img', mask)
    #cv2.waitKey(0)

    _, contours, _ = cv2.findContours(mask, 1,2)

    # returns true if birds found 
    for cnt in contours:
        if cv2.contourArea(cnt) > 0:
            return 1
예제 #40
0
def find_yellow_birds():
    ps, psx, psy = RS.getPlayingScreen()

    lower_pink = np.array([28, 197, 168])
    upper_pink = np.array([29, 234, 239])

    mask = cv2.inRange(ps, lower_pink, upper_pink)

    #cv2.imshow('img', mask)
    #cv2.waitKey(0)

    _, contours, _ = cv2.findContours(mask, 1, 2)

    # returns true if birds found
    for cnt in contours:
        if cv2.contourArea(cnt) > 0:
            return 1
예제 #41
0
def click_item(item):
    bag, bagx,bagy = RS.get_bag("bag x y")
    loc, w, h = Match.this(bag, item)
    for pt in zip(*loc[::-1]):
        x1 = pt[0] + bagx
        y1 = pt[1] + bagy

        x2 = x1 + w - ((w/2)/2)
        y2 = y1 + h - ((h/2)/2)

        # Moving first point inwards 
        x1 += (w/2) / 2
        y1 += (h/2) / 2

        # Gen random coords within the bound
        x,y = Mouse.genCoords(x1,y1,x2,y2)
        Mouse.moveClick(x,y,1)
        #RandTime.randTime(0,5,0,0,5,0)
        break
예제 #42
0
def click_item(item):
    bag, bagx, bagy = RS.get_bag("bag x y")
    loc, w, h = Match.this(bag, item)
    for pt in zip(*loc[::-1]):
        x1 = pt[0] + bagx
        y1 = pt[1] + bagy

        x2 = x1 + w - ((w / 2) / 2)
        y2 = y1 + h - ((h / 2) / 2)

        # Moving first point inwards
        x1 += (w / 2) / 2
        y1 += (h / 2) / 2

        # Gen random coords within the bound
        x, y = Mouse.genCoords(x1, y1, x2, y2)
        Mouse.moveClick(x, y, 1)
        #RandTime.randTime(0,5,0,0,5,0)
        break
예제 #43
0
def check_prayer():
    RSX, RSY = RS.position()
    pc = (545,109,571,135)
    prayer_level = Screenshot.shoot(pc[0],pc[1],pc[2],pc[3], 'hsv')
    
    low = np.array([116,0,0])
    high =np.array([141,255,255])

    mask = cv2.inRange(prayer_level, low, high)
    mask = np.array(mask)
     
    percentage = 0
    
    for color in mask:
        for element in color:
            if element == 255:
                percentage += 1
            else:
                continue
    return percentage/363.0
예제 #44
0
def click_camelot(clicks):
    time.sleep(4)
    cx, cy  = autopy.mouse.get_pos()
    x1 = cx - 1
    y1 = cy - 1
    x2 = cx + 1
    y2 = cy + 1
    for c in range(clicks):
        x = random.randint(x1,x2)
        y = random.randint(y1,y2)

        RandTime.randTime(0,0,0,0,0,1)

        autopy.mouse.toggle(True,1)
        RandTime.randTime(0,0,0,0,0,2)
        autopy.mouse.toggle(False,1)

        if random.randint(0,4)==0:
            Mouse.moveTo(x,y)
        RandTime.randTime(0,0,3,0,3,5)
        if not RS.antiban('magic'):
            time.sleep(1.5)
예제 #45
0
def click_camelot(clicks):
    time.sleep(4)
    cx, cy = autopy.mouse.get_pos()
    x1 = cx - 1
    y1 = cy - 1
    x2 = cx + 1
    y2 = cy + 1
    for c in range(clicks):
        x = random.randint(x1, x2)
        y = random.randint(y1, y2)

        RandTime.randTime(0, 0, 0, 0, 0, 1)

        autopy.mouse.toggle(True, 1)
        RandTime.randTime(0, 0, 0, 0, 0, 2)
        autopy.mouse.toggle(False, 1)

        if random.randint(0, 4) == 0:
            Mouse.moveTo(x, y)
        RandTime.randTime(0, 0, 3, 0, 3, 5)
        if not RS.antiban('magic'):
            time.sleep(1.5)
예제 #46
0
    def find_fairy_ring(self):
        run = 1
        while run:
            play_screen = Screenshot.shoot(6, 59, 510, 355, 'hsv')
            # finding white on fairy ring inner circle
            low = np.array([107, 92, 93])
            high = np.array([113, 255, 129])

            mask = cv2.inRange(play_screen, low, high)

            kernel = np.ones((10, 10), np.uint8)
            dilation = cv2.dilate(mask, kernel, iterations=1)
            #closing = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, kernel)

            #_,contours,_ = cv2,findContours(closing.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
            _, contours, _ = cv2.findContours(dilation, cv2.RETR_TREE,
                                              cv2.CHAIN_APPROX_SIMPLE)

            for con in contours:
                print("Area: {}".format(cv2.contourArea(con)))
                if cv2.contourArea(con) > 1.0:
                    (x, y, w, h) = cv2.boundingRect(con)
                    x += self.rs_x
                    y += self.rs_y
                    x1 = x
                    y1 = y
                    x2 = x + w
                    y2 = y + h
                    print("x1:{} y1:{} x2:{} y2:{}".format(x1, y1, x2, y2))
                    #print(cv2.contourArea(con))
                    #M = cv2.moments(con)
                    # finds centroid
                    #x,y = (int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"]))
                    Mouse.randMove(x1, y1, x2, y2, 3)
                    time.sleep(5)
                    if RS.findOptionClick(x1, y1, 'cis'):
                        run = 0
                    time.sleep(2)
                    break
예제 #47
0
    def find_fairy_ring(self):
        run = 1
        while run:
            play_screen = Screenshot.shoot(6,59,510,355,'hsv')
            # finding white on fairy ring inner circle
            low = np.array([107,92,93])
            high = np.array([113,255,129])

            mask = cv2.inRange(play_screen, low, high)

            kernel = np.ones((10,10), np.uint8)
            dilation = cv2.dilate(mask, kernel, iterations = 1)
            #closing = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, kernel)

            #_,contours,_ = cv2,findContours(closing.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
            _,contours,_ = cv2.findContours(dilation, cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

            for con in contours:
                print("Area: {}".format(cv2.contourArea(con)))
                if cv2.contourArea(con) > 1.0:
                    (x, y, w, h) = cv2.boundingRect(con)
                    x += self.rs_x
                    y += self.rs_y
                    x1 = x
                    y1 = y
                    x2 = x + w
                    y2 = y + h
                    print("x1:{} y1:{} x2:{} y2:{}".format(x1,y1,x2,y2))
                    #print(cv2.contourArea(con))
                    #M = cv2.moments(con)
                    # finds centroid
                    #x,y = (int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"]))
                    Mouse.randMove(x1,y1,x2,y2,3)
                    time.sleep(5)
                    if RS.findOptionClick(x1,y1,'cis'):
                        run = 0
                    time.sleep(2)
                    break
예제 #48
0
 def telSalve(self):
     RS.press_button('magic')
     Mouse.randMove(568,350,586,368,1)
예제 #49
0
 def telSalve(self):
     RS.press_button('magic')
     Mouse.randMove(568, 350, 586, 368, 1)
예제 #50
0
파일: prayup.py 프로젝트: jjvilm/osrmacro
from modules import RS
from modules import Screenshot
from modules import Mouse

import random
import cv2 
import numpy as np
import time

RSX, RSY = RS.position()

def check_prayer():
    RSX, RSY = RS.position()
    pc = (545,109,571,135)
    prayer_level = Screenshot.shoot(pc[0],pc[1],pc[2],pc[3], 'hsv')
    
    low = np.array([116,0,0])
    high =np.array([141,255,255])

    mask = cv2.inRange(prayer_level, low, high)
    mask = np.array(mask)
     
    percentage = 0
    
    for color in mask:
        for element in color:
            if element == 255:
                percentage += 1
            else:
                continue
    return percentage/363.0
예제 #51
0
def main(herb_object):
    # var to break out of loop after 3 bank tries
    bankchecking = 0
    n_secs = 1
    while True:
        if bankchecking == 5:
            break
        #open bank
        RS.open_cw_bank()

        #give time for window to open up
        time.sleep(1.2)

        #check if bank is open, if not end
        if not RS.isBankOpen():
            bankchecking +=1 
            n_secs = n_secs * bankchecking

            time.sleep(n_secs)
            continue

        # resets bankchecking
        bankchecking = 0
        #deposit all
        #if herb_object in inventory
        if not RS.isInvEmpty():
            RS.depositAll()
        
        #loop makes sure herbs are withdrawn!
        while True:
            try:
                herbx,herby = findherb(herb_object)
            except Exception as e:
                print('No more herbs')
                print(e)
                return
            Mouse.moveClick(herbx,herby,3)

            # removes RS coords since added back in in findOptionClick
            herbx -= RSX
            herby -= RSY
            RS.findOptionClick(herbx,herby,'withdrawAll')

            time.sleep(.9)
            randTime(0,0,0,0,0,9)
            # breaks when items are taken out into inventory
            if not RS.isInvEmpty():
                break
            else:
                # deposits all items from inventory
                x,y = Mouse.genCoords(RSX+13,RSY+60,RSX+500,RSY+352)
                Mouse.moveTo(x,y)

        #close bank
        RS.closeBank()
        find_grimmy_herbs_in_inventory(herb_object)
예제 #52
0
파일: alchstun.py 프로젝트: jjvilm/osrmacro
import cv2
import numpy as np
from modules import Screenshot
from modules import  RS
import random
from modules import Mouse
from modules import RandTime

rsx, rsy = RS.position()
def findMonk():
    global rsx
    global rsy

    x1 = rsx + 13
    y1 = rsy + 60 
    x2 = rsx + 500
    y2 = rsy + 352

    play_window = Screenshot.shoot(x1,y1,x2,y2, 'hsv')
    #finds red shades
    lower_red = np.array([0,162,63])
    upper_red = np.array([3,172,169])

    #mask = cv2.inRange(play_window, lower_red, upper_red)
    mask2 = cv2.inRange(play_window, lower_red, upper_red)
    #res = cv2.bitwise_and(play_window, play_window, mask=mask)
    #cv2.imshow('res', res)

    _, contours, _ = cv2.findContours(mask2, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

    cnt = contours[0]
예제 #53
0
        while True:
            #Finds knife, cliks it
            find_template(tool,'click')
    #   #   #
            #Finds First maple log, clicks it
            find_template(item,'click')
    #   #   #
            #right cliks, make X, type 99
            RandTime.randTime(1,0,0,1,9,9)
            moveToFletchingOptions(item)
            RandTime.randTime(3,5,0,3,9,9)
    #   #   #
            #if RS.countItemInInv('yewLongbowU.png',1):
            #    break
            break
    #   #   # 
        #waits 2 secs/log 
        if n_logs > 6:
            n_logs = (n_logs*2) - 7
        else:
            n_logs = (n_logs*2)

        if RS.antiban('crafting'):
            n_logs -= 6
        RandTime.randTime(n_logs,0,0,n_logs,9,9)
    #   #   #
if __name__ == '__main__':
    blow_glass('moltenGlass.png','glassblowingPipe.png')
    RS.logout()

예제 #54
0
def blow_glass(item, tool):
    rsx, rsy = RS.position()
    cwd = os.getcwd()

    # Main Loop starts here
    tries = 0
    while True:

        # Loop to withdraw knife and logs, and deposit and open bank
        RS.open_cw_bank()
        RandTime.randTime(0, 5, 0, 0, 9, 9)
        while True:
            if tries == 2:
                print(
                    'Maybe ran out of an item, or items not found!\nMoving on to stringing'
                )
                return 0
            #runs only if bank is open
            if RS.isBankOpen():
                RS.depositAll()
                withdraw_from_bank(tool, 'click')
                withdraw_from_bank(item, 'withdrawAll')
                RS.closeBank()

                if RS.countItemInInv(tool, 1):
                    n_logs = RS.countItemInInv(item)
                    if n_logs:
                        tries = 0
                        break
                    else:
                        print(tries)
                        #after the second try it breaks
                        tries += 1
            #Opens bank if it's not already opened
            else:
                RS.open_cw_bank()
                #gives time for bank detection to start
                RandTime.randTime(1, 0, 0, 1, 0, 9)
    #   #   #
    ########### Starts cutting logs ############
    # goes into a loop to make sure
    # logs are being cut
        while True:
            #Finds knife, cliks it
            find_template(tool, 'click')
            #   #   #
            #Finds First maple log, clicks it
            find_template(item, 'click')
            #   #   #
            #right cliks, make X, type 99
            RandTime.randTime(1, 0, 0, 1, 9, 9)
            moveToFletchingOptions(item)
            RandTime.randTime(3, 5, 0, 3, 9, 9)
            #   #   #
            #if RS.countItemInInv('yewLongbowU.png',1):
            #    break
            break
    #   #   #
    #waits 2 secs/log
        if n_logs > 6:
            n_logs = (n_logs * 2) - 7
        else:
            n_logs = (n_logs * 2)

        if RS.antiban('crafting'):
            n_logs -= 6
        RandTime.randTime(n_logs, 0, 0, n_logs, 9, 9)
예제 #55
0
def blow_glass(item, tool):
    rsx,rsy = RS.position()
    cwd= os.getcwd()
    
    # Main Loop starts here
    tries = 0
    while True:

        # Loop to withdraw knife and logs, and deposit and open bank
        RS.open_cw_bank()
        RandTime.randTime(0,5,0,0,9,9)
        while True:
            if tries == 2:
                print('Maybe ran out of an item, or items not found!\nMoving on to stringing')
                return 0
            #runs only if bank is open
            if RS.isBankOpen():
                RS.depositAll()
                withdraw_from_bank(tool,'click') 
                withdraw_from_bank(item,'withdrawAll') 
                RS.closeBank()

                if RS.countItemInInv(tool,1):
                    n_logs = RS.countItemInInv(item)
                    if n_logs:
                        tries = 0
                        break
                    else:
                        print(tries)
                        #after the second try it breaks
                        tries += 1
            #Opens bank if it's not already opened
            else:
                RS.open_cw_bank()
                #gives time for bank detection to start
                RandTime.randTime(1,0,0,1,0,9)
    #   #   #  
        ########### Starts cutting logs ############
        # goes into a loop to make sure 
        # logs are being cut
        while True:
            #Finds knife, cliks it
            find_template(tool,'click')
    #   #   #
            #Finds First maple log, clicks it
            find_template(item,'click')
    #   #   #
            #right cliks, make X, type 99
            RandTime.randTime(1,0,0,1,9,9)
            moveToFletchingOptions(item)
            RandTime.randTime(3,5,0,3,9,9)
    #   #   #
            #if RS.countItemInInv('yewLongbowU.png',1):
            #    break
            break
    #   #   # 
        #waits 2 secs/log 
        if n_logs > 6:
            n_logs = (n_logs*2) - 7
        else:
            n_logs = (n_logs*2)

        if RS.antiban('crafting'):
            n_logs -= 6
        RandTime.randTime(n_logs,0,0,n_logs,9,9)
예제 #56
0
            #Finds knife, cliks it
            find_template(tool, 'click')
            #   #   #
            #Finds First maple log, clicks it
            find_template(item, 'click')
            #   #   #
            #right cliks, make X, type 99
            RandTime.randTime(1, 0, 0, 1, 9, 9)
            moveToFletchingOptions(item)
            RandTime.randTime(3, 5, 0, 3, 9, 9)
            #   #   #
            #if RS.countItemInInv('yewLongbowU.png',1):
            #    break
            break
    #   #   #
    #waits 2 secs/log
        if n_logs > 6:
            n_logs = (n_logs * 2) - 7
        else:
            n_logs = (n_logs * 2)

        if RS.antiban('crafting'):
            n_logs -= 6
        RandTime.randTime(n_logs, 0, 0, n_logs, 9, 9)
    #   #   #


if __name__ == '__main__':
    blow_glass('moltenGlass.png', 'glassblowingPipe.png')
    RS.logout()