Esempio n. 1
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
Esempio n. 2
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
Esempio n. 3
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
Esempio n. 4
0
def closeBank():
    cwd = os.getcwd()
    rsx, rsy = position()
    x1 = rsx+449
    y1 = rsy+0
    x2 = rsx+522
    y2 = rsy+59

    closeButton = Screenshot.shoot(x1,y1,x2,y2)
    #SAVE FOR DEBUG
    #cv2.imwrite('debug_closeButton.png',closeButton)
    loc, w, h = Match.this(closeButton, cwd+'/imgs/bankXbutton.png')

    for pt in zip(*loc[::-1]):
        #making pt relative to the RS window
        pt = (pt[0] + x1, pt[1] + y1)
        #make Btm-Right pt
        btx = pt[0] + w
        bty = pt[1] + h
        #gen random coords
        rx = random.randint(pt[0], btx)
        ry = random.randint(pt[1], bty)
        #Move to and Click the X to close bank
        Mouse.moveClick(rx,ry,1)
        break
Esempio n. 5
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
Esempio n. 6
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
Esempio n. 7
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
Esempio n. 8
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
Esempio n. 9
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
Esempio n. 10
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
Esempio n. 11
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
Esempio n. 12
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
Esempio n. 13
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
Esempio n. 14
0
def countItemInInv(template_file,*args):
    """Counts the N of the item passed in INVENTORY
    if a number is passed it will count up to that"""
    #checks to see wheater to add cur dir or not
    if "/" not in template_file:
        template_file = os.getcwd()+"/imgs/"+template_file
    rs_bag = get_bag('only') #Screenshot taken here,
    #saves image for DEBUG
    #cv2.imwrite('debug_rs_bag_log_count.png',rs_bag)
    #loc == coordinates found in match
    loc, w, h = Match.this(rs_bag, template_file)
    #starts fount
    count = 0
    for pt in zip(*loc[::-1]):#goes through each found image
        if args != ():
            if args[0] == 1:
                return 1
        count += 1
    #print(count)
    return count
Esempio n. 15
0
 def countItemInInv(self,template_file,*args):
     """Counts the N of the item passed in INVENTORY
     if a number is passed it will count up to that"""
     #checks to see wheater to add cur dir or not
     if "/" not in template_file:
         template_file = os.getcwd()+"/imgs/"+template_file
     rs_bag = self.get_bag('only') #Screenshot taken here,
     #saves image for DEBUG
     #cv2.imwrite('debug_rs_bag_log_count.png',rs_bag)
     #loc == coordinates found in match
     loc, w, h = Match.this(rs_bag, template_file)
     #starts fount
     count = 0
     for pt in zip(*loc[::-1]):#goes through each found image
         if args != ():
             if args[0] == 1:
                 return 1
         count += 1
     #print(count)
     return count
Esempio n. 16
0
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
Esempio n. 17
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
Esempio n. 18
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