Exemplo n.º 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")
Exemplo n.º 2
0
def readlines(f):
    if f =='':
        print("Reading {}".format("mstats file"))
        with open('mstats', 'r') as f:
            for line in f:
                f = line.find("x")+1
                s = line.find("y")
                x =int( line[f:s])
                y = int(line[s+2:])

                #Mouse.moveTo(x,y)
                autopy.mouse.move(x,y)
                #autopy.mouse.smooth_move(x,y)
                time.sleep(.001)
    else:
        try:
            print("Reading {}".format(f))
            with open(f, 'r') as f:
                for line in f:
                    if 'r' in line:
                        continue
                    f = line.find("x")+1
                    s = line.find("y")
                    x =int( line[f:s])
                    y = int(line[s+2:])

                    #Mouse.moveTo(x,y)
                    autopy.mouse.move(x,y)
                    #autopy.mouse.smooth_move(x,y)
                    #time.sleep(.0005)
                    RandTime.randTime(0,0,1,0,0,1)
        except:
            print("Not a valid file!")
            time.sleep(1.5)
Exemplo n.º 3
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')
Exemplo n.º 4
0
    def greetings(self, skill):
        n = random.randint(0,10)
        if random.randint(0,10):
            if n == 0:
                Keyboard.type_this("What's going on guys?")
            elif n == 1:
                Keyboard.type_this("whats up ppl!?")
            elif n == 2:
                Keyboard.type_this("what you all doing?")
            elif n == 3:
                Keyboard.type_this("hiiiii guys!")
            elif n == 4:
                Keyboard.type_this("what's your guys highest skill lv??")
            elif n == 5:
                Keyboard.type_this("flash1:what!?")
            elif n == 6:
                Keyboard.type_this("what are you talking about?")
            elif n == 7:
                Keyboard.type_this("i dont need to be hearing this")
            elif n == 8:
                Keyboard.type_this("chilling...")
            elif n == 9:
                Keyboard.type_this("skilling, what about you all?")
            elif n == 10:
                Keyboard.type_this("right now im working on {}, what about you guys??".format(skill))

            Keyboard.press('enter')


        RandTime.randTime(5,0,0,13,9,9)
Exemplo n.º 5
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
Exemplo n.º 6
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
Exemplo n.º 7
0
def check_mine_availability(mine_x, mine_y):
    RandTime.randTime(3, 0, 0, 5, 9, 9)
    cmx, cmy = Mouse.mouse_loc()
    mine_x = cmx - mine_x
    mine_y = cmy - mine_y
    while 1:
        # expands by 4X4 to check color values
        x = mine_x - 2
        y = mine_y - 2
        x2 = mine_x + 2
        y2 = mine_y + 2

        checked_area = Screenshot.shoot(x, y, x2, y2, 'hsv')

        lower_gray = np.array([0, 0, 153])
        upper_gray = np.array([8, 25, 209])

        mask = cv2.inRange(checked_area, lower_gray, upper_gray)
        for colors in mask:
            for value in colors:
                if value == 255:
                    print('mine ACTIVE')
                    RandTime.randTime(5, 0, 0, 5, 9, 9)
                    break
        else:
            print("mine INACTIVE")
            break
Exemplo n.º 8
0
def greetings(skill):
    n = random.randint(0,10)
    if random.randint(0,10):
        if n == 0:
            Keyboard.type_this("What's going on guys?")
        elif n == 1:
            Keyboard.type_this("whats up ppl!?")
        elif n == 2:
            Keyboard.type_this("what you all doing?")
        elif n == 3:
            Keyboard.type_this("hiiiii guys!")
        elif n == 4:
            Keyboard.type_this("what's your guys highest skill lv??")
        elif n == 5:
            Keyboard.type_this("flash1:what!?")
        elif n == 6:
            Keyboard.type_this("what are you talking about?")
        elif n == 7:
            Keyboard.type_this("i dont need to be hearing this")
        elif n == 8:
            Keyboard.type_this("chilling...")
        elif n == 9:
            Keyboard.type_this("skilling, what about you all?")
        elif n == 10:
            Keyboard.type_this("right now im working on {}, what about you guys??".format(skill))

        Keyboard.press('enter')


    RandTime.randTime(5,0,0,13,9,9)
Exemplo n.º 9
0
def moveClick(x,y, button=0):#moves to random X,Y of found match of template
    moveTo(x,y)
    RandTime.randTime(0,0,0,0,0,2)
    if button != 0:
        pyautogui.mouseDown(button='left')
        RandTime.randTime(0,1,0,0,2,9)#time between click
        pyautogui.mouseUp(button='left')
Exemplo n.º 10
0
def camelot():
    time.sleep(3)
    cx, cy = autopy.mouse.get_pos()

    x1 = cx - 1
    x2 = cx + 1
    y1 = cy -1 
    y2 = cy +1
    
    timer = 0

    while timer < 500:
        x = random.randint(x1,x2)
        y = random.randint(y1,y2)

        if random.randint(0,5) == 0:
            autopy.mouse.move(x,y)
            RandTime.randTime(0,0,0,0,0,1)
        print('clicking')
        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) 

        timer += 1
        time.sleep(2)
        RandTime.randTime(0,0,0,0,0,9)
Exemplo n.º 11
0
    def select(self, *args):
        try:
            buysell = args[0]
            item = args[1]
        except Exception as e:
            print(e)
        #Setting for Buying
        if buysell == 'buy':
            slots = self.get_slots(buysell)
        #Setting for Selling
        elif buysell == 'sell':
            slots = self.get_slots(buysell)
        else:
            print("Make a selection buy or sell")

        ## picks random slot from buy/sell slots
        n = random.randint(0, len(slots) - 1)
        ## combines coords
        pos = slots[n]
        x = pos[0]
        y = pos[1]
        ## adds randomness
        mx, my = self.add_randomness(17, x, y + 15)
        #pyautogui.moveTo(mx,my)
        Mouse.moveTo(mx, my)
        pyautogui.click()
        RandTime.randTime(0, 5, 7, 1, 9, 9)

        if buysell == 'buy':
            Keyboard.type_this(item)
        else:
            Keyboard.type_this(item)
Exemplo n.º 12
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
Exemplo n.º 13
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")
Exemplo n.º 14
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')
Exemplo n.º 15
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
Exemplo n.º 16
0
def camelot():
    time.sleep(3)
    cx, cy = autopy.mouse.get_pos()

    x1 = cx - 1
    x2 = cx + 1
    y1 = cy - 1
    y2 = cy + 1

    timer = 0

    while timer < 500:
        x = random.randint(x1, x2)
        y = random.randint(y1, y2)

        if random.randint(0, 5) == 0:
            autopy.mouse.move(x, y)
            RandTime.randTime(0, 0, 0, 0, 0, 1)
        print('clicking')
        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)

        timer += 1
        time.sleep(2)
        RandTime.randTime(0, 0, 0, 0, 0, 9)
Exemplo n.º 17
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
Exemplo n.º 18
0
def click(btn):
    """Pass btn as 'left' or 'right'"""
    #autopy.mouse.click()
    #
    pyautogui.mouseDown(button=btn)
    RandTime.randTime(0,0,0,0,3,9)#time between click
    pyautogui.mouseUp(button=btn)
Exemplo n.º 19
0
def skillHover(skill):
    """Hovers over passed skill from 1-5 secs"""
    #Coordinates of skill's button
    skills = {
            'attack':0, 'hitpoints':0,'mining':0,

            'strength':0,'agility':0,'smithing':0,

            'defence':0,'herblore':(620,295,662,311),'fishing':0,

            'ranged':0,'thieving':0,'cooking':0,

            'prayer':0,'crafting':(621,358,664,373),'firemaking':0,

            'magic':(557,388,602,402),'fletching':(620,389,666,406),'woodcutting':0,

            'runecraft':0,'slayer':0,'farming':0,

            'construction':0,'hunter':0
            }

    x1,y1,x2,y2 =skills[skill]
    x,y = Mouse.genCoords(x1,y1,x2,y2)
    Mouse.moveTo(x,y)
    RandTime.randTime(1,0,0,5,9,9)
Exemplo n.º 20
0
def press(button):
    if button == 'enter':
        autopy.key.toggle(autopy.key.K_RETURN, True)
        RandTime.randTime(0,0,1,0,0,1)
        autopy.key.toggle(autopy.key.K_RETURN, False)

    else:
        autopy.key.toggle(autopy.key.button, True)
Exemplo n.º 21
0
def main():
    G = osr.Frame()
    #item_n = G.invCount()
    #print("Current itme number is:{}".format(item_n))
    while 1:
        find_mine()
        RandTime.randTime(5, 0, 0, 8, 9, 9)
        print("Restarting loop...")
Exemplo n.º 22
0
def press(button):
    if button == 'enter':
        autopy.key.toggle(autopy.key.K_RETURN, True)
        RandTime.randTime(0,0,1,0,0,1)
        autopy.key.toggle(autopy.key.K_RETURN, False)

    else:
        autopy.key.toggle(autopy.key.button, True)
Exemplo n.º 23
0
def depositAll():
    rsx, rsy = position()

    x = rsx + random.randint(432,457)
    y = rsy + random.randint(320,348)

    Mouse.moveClick(x,y,1)
    RandTime.randTime(0,0,1,0,0,5)
Exemplo n.º 24
0
def type_this(strings):
    """Types the passed characters with random pauses in between strokes"""
    for s in strings:
        # delay between key presses--key UP/DOWN
        #autopy.key.toggle(s, True)
        pyautogui.keyDown(s)
        RandTime.randTime(0,0,0,0,0,9)
        pyautogui.keyUp(s)
Exemplo n.º 25
0
def type_this(strings):
    """Types the passed characters with random pauses in between strokes"""
    for s in strings:
        # delay between key presses--key UP/DOWN
        #autopy.key.toggle(s, True)
        pyautogui.keyDown(s)
        RandTime.randTime(0,0,0,0,0,5)
        pyautogui.keyUp(s)
Exemplo n.º 26
0
    def findOptionClick(self, x,y,option_name):
        #Mouse.moveClick(x, y, 3)
        print(f"Right-Clicking:x{x} y:{y}")
        self.hc.move((x,y),1)
        Mouse.click('right')
        RandTime.randTime(1,0,0,1,9,9)
        """Option name of in Image database only needs to be passed, x,y are obsoleate"""
        from modules import Imgdb
        # Image DB
        idb = Imgdb.ImgDb()
        #name of option loaded from image db
        template = idb.pickled_dict[option_name]
        # turning template to graysacle if RBG
        if len(template.shape) == 3:
            template = cv2.cvtColor(template,cv2.COLOR_RGB2GRAY)
        # getting w and h for generating random coords in range
        template_w, template_h = template.shape[::-1]

        rs_window, x, y = self.getPlayingScreen('gray')


        res = cv2.matchTemplate(rs_window,template,cv2.TM_CCOEFF_NORMED)
        threshold = 1
        # Store the coordinates of matched area in a numpy array
        loc = np.where( res >= threshold)

        # clicks on option here when found in pattern
        for pt in zip(*loc[::-1]):#goes through each found image
            # Draw a rectangle around the matched region.
            # cv2.rectangle(rs_window, pt, (pt[0] + template_w, pt[1] + template_h), (0,255,255), 2)

            # creates list of possible coords
            ptx = [i for i in range(pt[0]+5, pt[0] + template_w)]
            pty = [i for i in range(pt[1]+5, pt[1] + template_h)]
            # chooses a single coords from the list
            ptx = random.choice(ptx)
            pty = random.choice(pty)
            print(f"ptx{ptx} pty{pty}")

            # debug ###
            #cv2.imshow('img', rs_window)
            #cv2.waitKey(5000)
            #cv2.destroyAllWindows()

            # range of x and y to click on.
            # in the options
            #Mouse.randMove(x,y1,x+(w/2),y2, 1)
            #ptx, pty = Mouse.randCoord(pt, template_w, template_h)
            #Mouse.moveClick(ptx,pty, 1)
            self.hc.move((ptx,pty),1)
            self.hc.click()
            RandTime.randTime(1,0,0,2,9,9)

            break
Exemplo n.º 27
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)
Exemplo n.º 28
0
def moveClick(x,y, button):#moves to random X,Y of found match of template
    moveTo(x,y)
    # RandTime.randTime(0,0,0,0,0,2)
    #print(f"button passed {button}")
    if button == 1:
        pyautogui.mouseDown(button='left')
        RandTime.randTime(0,1,0,0,2,9)#time between click
        pyautogui.mouseUp(button='left')
    elif button == 3:
        pyautogui.mouseDown(button='right')
        RandTime.randTime(0,1,0,0,2,9)#time between click
        pyautogui.mouseUp(button='right')
Exemplo n.º 29
0
def skillsHover(rsx,rsy):
        """Hovers over n skills by n times"""
        n = random.randint(0,2)
        if n > 0:
            # Tuples of locations
            stats_btn = Mouse.genCoords(567,194,589,215)
            #Clicks the skills button
            Mouse.moveClick(stats_btn[0]+rsx,stats_btn[1]+rsy,1)
            for i in range(n):
                #                              x1  y1  x2  y2
                stats_window = Mouse.genCoords(557,234,729,470)
                # Randomly hovers over a random skill
                Mouse.moveTo(stats_window[0]+rsx,stats_window[1]+rsy)
                RandTime.randTime(1,0,0,2,9,9)
Exemplo n.º 30
0
 def skillsHover(self, rsx,rsy):
         """Hovers over n skills by n times"""
         n = random.randint(0,2)
         if n > 0:
             # Tuples of locations
             stats_btn = Mouse.genCoords(567,194,589,215)
             #Clicks the skills button
             Mouse.moveClick(stats_btn[0]+rsx,stats_btn[1]+rsy,1)
             for i in range(n):
                 #                              x1  y1  x2  y2
                 stats_window = Mouse.genCoords(557,234,729,470)
                 # Randomly hovers over a random skill
                 Mouse.moveTo(stats_window[0]+rsx,stats_window[1]+rsy)
                 RandTime.randTime(1,0,0,2,9,9)
Exemplo n.º 31
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
Exemplo n.º 32
0
def open_cw_bank():
    """Finds the visiblest square of the chest in castle wars bank, wors better when viewing from above at shortest distance."""
    # gets RS window's position
    rsx,rsy = position()

    # Takes screenshot, as Hue-saturated-value image
    play_window,psx,psy = getPlayingScreen()

    psx += rsx
    psy += rsy



    lower_gray = np.array([0,15,55])
    upper_gray = np.array([10,25,125])

    # Makes a black/white mask
    mask = cv2.inRange(play_window, lower_gray, upper_gray)
    # inverts selection
    #res = cv2.bitwise_and(play_window, play_window, mask=mask)
    kernel = np.ones((5,5), np.uint8)
    dilation = cv2.dilate(mask, kernel, iterations = 1)

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

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

    try:
        # looks for center of grey color with biggest area, > 3000
        for con in contours:
            if cv2.contourArea(con) > 3000:
                M = cv2.moments(con)
                # finds centroid
                cx,cy = (int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"]))
                psx += cx
                psy += cy
                # adds randomness to coords
                psx += random.randint(-17,17)
                psy += random.randint(-17,17)

                #move click chest
                Mouse.moveClick(psx,psy,1)
                RandTime.randTime(0,0,0,0,9,9)
                break
    except Exception as e:
        print("Bank NOT found!\nMove camera around!")
Exemplo n.º 33
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
Exemplo n.º 34
0
    def skillHover(self, skill):
        """Hovers over passed skill from 1-5 secs"""
        #Coordinates of skill's button
        skills = {
                'attack':0, 'hitpoints':0,'mining':0,

                'strength':0,'agility':0,'smithing':0,

                'defence':0,'herblore':(620,295,662,311),'fishing':0,

                'ranged':0,'thieving':0,'cooking':0,

                'prayer':0,'crafting':(621,358,664,373),'firemaking':0,

                'magic':(557,388,602,402),'fletching':(620,389,666,406),'woodcutting':0,

                'runecraft':0,'slayer':0,'farming':0,

                'construction':0,'hunter':0
                }

        x1,y1,x2,y2 =skills[skill]
        x,y = Mouse.genCoords(x1,y1,x2,y2)
        # Mouse.moveTo(x,y)
        randS = RandTime.randTime(0,0,1,1,0,9)
        self.hc.move(x,y,randS)
Exemplo n.º 35
0
    def find_bank_booth(self):
        """Finds bank booth and clicks it.  Returns True if found, else False"""

        bank_booth_glass_window = ([0,72,149],[179,82,163])
        # take screenshot of playing area
        play_area_screen,psx,psy = self.getPlayingScreen()

        # find glasswindow for bankbooth
        mask = cv2.inRange(play_area_screen, np.array(bank_booth_glass_window[0]), np.array(bank_booth_glass_window[1]))

        # gets RS window's position
        #rsx,rsy = position()

        psx += self.rsx
        psy += self.rsy

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


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

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

        try:
            for con in contours:
                if cv2.contourArea(con) > 10:
                    #print(cv2.contourArea(con))
                    M = cv2.moments(con)
                    # finds centroid
                    cx,cy = (int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"]))
                    psx += cx
                    psy += cy
                    # adds randomness to coords
                    psx += random.randint(-7,7)
                    psy += random.randint(-7,7)

                    #move click
                    Mouse.moveClick(psx,psy,1)
                    RandTime.randTime(0,0,0,0,9,9)
                    return 1
        except Exception as e:
            print(f"Bank NOT found!\nMove camera around!\n{e}")
        # returns False if bank not found
        return 0
Exemplo n.º 36
0
def find_bank_booth():
    """Finds bank booth and clicks it.  Returns True if found, else False"""

    bank_booth_glass_window = ([0,72,149],[179,82,163])
    # take screenshot of playing area
    play_area_screen,psx,psy = getPlayingScreen()

    # find glasswindow for bankbooth
    mask = cv2.inRange(play_area_screen, np.array(bank_booth_glass_window[0]), np.array(bank_booth_glass_window[1]))

    # gets RS window's position
    rsx,rsy = position()

    psx += rsx
    psy += rsy

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


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

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

    try:
        for con in contours:
            if cv2.contourArea(con) > 10:
                #print(cv2.contourArea(con))
                M = cv2.moments(con)
                # finds centroid
                cx,cy = (int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"]))
                psx += cx
                psy += cy
                # adds randomness to coords
                psx += random.randint(-7,7)
                psy += random.randint(-7,7)

                #move click
                Mouse.moveClick(psx,psy,1)
                RandTime.randTime(0,0,0,0,9,9)
                return 1
    except Exception as e:
        print("Bank NOT found!\nMove camera around!")
    # returns False if bank not found
    return 0
Exemplo n.º 37
0
    def open_cw_bank(self):
        """Finds the visiblest square of the chest in castle wars bank, wors better when viewing from above at shortest distance."""

        # Takes screenshot, as Hue-saturated-value image
        play_window,psx,psy = self.getPlayingScreen('hsv')
        lower_gray = np.array([0,15,55])
        upper_gray = np.array([10,25,125])

        # Makes a black/white mask
        mask = cv2.inRange(play_window, lower_gray, upper_gray)
        # inverts selection
        #res = cv2.bitwise_and(play_window, play_window, mask=mask)
        kernel = np.ones((5,5), np.uint8)
        dilation = cv2.dilate(mask, kernel, iterations = 1)

        #cv2.imshow('img', dilation)
        #cv2.waitKey(2000)
        #cv2.destroyAllWindows()

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

        try:
            # looks for center of grey color with biggest area, > 3000
            for con in contours:
                #print(cv2.contourArea(con))
                if cv2.contourArea(con) > 3000:
                    #print(f"big area found {cv2.contourArea(con)}")

                    M = cv2.moments(con)
                    # finds centroid
                    cx,cy = (int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"]))
                    psx += cx
                    psy += cy
                    # adds randomness to coords
                    psx += random.randint(-17,17)
                    psy += random.randint(-17,17)

                    #move click chest
                    Mouse.moveClick(psx,psy,1)
                    #pyclick.HumanClicker.move((psx, psy), 1)
                    #pyclick.HumanClicker.click()
                    RandTime.randTime(1,0,0,2,9,9)
                    break
        except Exception as e:
            print(f"Bank NOT found!\nMove camera around!\n{e}")
Exemplo n.º 38
0
def splasher():
    time.sleep(3)
    print('starting')
    cx, cy = autopy.mouse.get_pos()
    print('grabbed position')
    x1 = cx - 5
    y1 = cy - 5
    x2 = cx + 5
    y2 = cy + 5
    while True:
        x = random.randint(x1, x2)
        y = random.randint(y1, y2)
        Mouse.moveClick(x,y,1)
        multiplier = random.randint(1,5)
        print("waiting for {}".format((60*multiplier)//60))
        time.sleep(60*multiplier)
        RandTime.randTime(0,0,0,0,0,9)
Exemplo n.º 39
0
def splasher():
    time.sleep(3)
    print('starting')
    cx, cy = autopy.mouse.get_pos()
    print('grabbed position')
    x1 = cx - 5
    y1 = cy - 5
    x2 = cx + 5
    y2 = cy + 5
    while True:
        x = random.randint(x1, x2)
        y = random.randint(y1, y2)
        Mouse.moveClick(x, y, 1)
        multiplier = random.randint(1, 5)
        print("waiting for {}".format((60 * multiplier) // 60))
        time.sleep(60 * multiplier)
        RandTime.randTime(0, 0, 0, 0, 0, 9)
Exemplo n.º 40
0
def spell(*args, **kwargs):
    for s in args:
        if s == 'curse':
            x, y = genCoords(664+rsx,272+rsy,672+rsx,280+rsy)
            Mouse.moveClick(x,y, 1)
        elif s == 'alch':
            x, y = genCoords(710+rsx,346+rsy,720+rsx,356+rsy)
            Mouse.moveClick(x,y, 1)
            RandTime.randTime(0,1,0,0,1,9)
            x, y = genCoords(700+rsx,353+rsy,714+rsx,364+rsy)
            Mouse.moveClick(x,y, 1)
            RandTime.randTime(0,1,0,1,9,9)
        elif s == 'stun':
            x, y = genCoords(618+rsx,443+rsy,621+rsx,447+rsy)
            Mouse.moveClick(x,y,1)
        elif s == 'enfeeble':
            x, y = genCoords(686+rsx,416+rsy,696+rsx,426+rsy)
            Mouse.moveClick(x,y,1)
Exemplo n.º 41
0
def spell(*args, **kwargs):
    for s in args:
        if s == 'curse':
            x, y = genCoords(664 + rsx, 272 + rsy, 672 + rsx, 280 + rsy)
            Mouse.moveClick(x, y, 1)
        elif s == 'alch':
            x, y = genCoords(710 + rsx, 346 + rsy, 720 + rsx, 356 + rsy)
            Mouse.moveClick(x, y, 1)
            RandTime.randTime(0, 1, 0, 0, 1, 9)
            x, y = genCoords(700 + rsx, 353 + rsy, 714 + rsx, 364 + rsy)
            Mouse.moveClick(x, y, 1)
            RandTime.randTime(0, 1, 0, 1, 9, 9)
        elif s == 'stun':
            x, y = genCoords(618 + rsx, 443 + rsy, 621 + rsx, 447 + rsy)
            Mouse.moveClick(x, y, 1)
        elif s == 'enfeeble':
            x, y = genCoords(686 + rsx, 416 + rsy, 696 + rsx, 426 + rsy)
            Mouse.moveClick(x, y, 1)
Exemplo n.º 42
0
def keep_clicking():
    time.sleep(3)
    cx, cy  = autopy.mouse.get_pos()
    x1 = cx - 2
    y1 = cy - 2
    x2 = cx + 2
    y2 = cy + 2
    counts = 0
    while counts < 30:
        if count_logs('/home/jj/github/osrmacro/imgs/mapleLog.png') == 0:
            x = random.randint(x1,x2)
            y = random.randint(y1,y2)
            Mouse.moveClick(x,y,1)
            timer += 1
            RandTime.randTime(0,0,1,0,9,9)
            time.sleep(7)
        time.sleep(10)
        RandTime.randTime(0,0,1,0,9,9)
Exemplo n.º 43
0
def keep_clicking():
    time.sleep(3)
    cx, cy = autopy.mouse.get_pos()
    x1 = cx - 2
    y1 = cy - 2
    x2 = cx + 2
    y2 = cy + 2
    counts = 0
    while counts < 30:
        if count_logs('/home/jj/github/osrmacro/imgs/mapleLog.png') == 0:
            x = random.randint(x1, x2)
            y = random.randint(y1, y2)
            Mouse.moveClick(x, y, 1)
            timer += 1
            RandTime.randTime(0, 0, 1, 0, 9, 9)
            time.sleep(7)
        time.sleep(10)
        RandTime.randTime(0, 0, 1, 0, 9, 9)
Exemplo n.º 44
0
def custom_clicker(wait_in_secs, count_to, click, range_sq):
    print("move mouse to location to autoclick")
    time.sleep(3)
    cx, cy = autopy.mouse.get_pos()
    print("Got {} {}".format(cx, cy))
    x1 = cx - range_sq
    y1 = cy - range_sq
    x2 = cx + range_sq
    y2 = cy + range_sq

    counter = 0

    while counter < count_to:
        x = random.randint(x1, x2)
        y = random.randint(y1, y2)
        Mouse.moveClick(x, y, click)
        counter += 1
        # randomize range of time to wait
        #custom_clicker(wait_in_secs, count_to, click , range_sq ):
        print("Randomizing time")
        RandTime.randTime(2, 0, 0, wait_in_secs, 9, 9)
Exemplo n.º 45
0
def run():    
    RSX,RSY = RS.position()
    # Main stringer loop
    tries = 0 
    while True:
        if RS.isBankOpen():
            if tries == 2:
                print('Tries exausted, exiting!')
                #RS.logout()
                return 0
            #deposits all if inventory is not empty
            RS.depositAll()
            withdrawFromBank('/imgs/bowString.png')
            withdrawFromBank('/imgs/yewLongbowU.png')
            RS.closeBank()
            # starts stringing here 
            if checkInv(cwd+"/imgs/bowString.png") and checkInv(cwd+"/imgs/yewLongbowU.png"):
                makeBow()
                if RS.antiban('fletching'):
                    RandTime.randTime(11,0,0,11,9,9)
                else:
                    RandTime.randTime(15,0,0,15,9,9)
                #resets tries if items successfully found
                tries = 0
            else:
                RS.press_button('inventory')
                tries += 1
        else: 
         RS.open_cw_bank()
         RandTime.randTime(0,5,0,0,9,9)
Exemplo n.º 46
0
def run():
    RSX, RSY = RS.position()
    # Main stringer loop
    tries = 0
    while True:
        if RS.isBankOpen():
            if tries == 2:
                print('Tries exausted, exiting!')
                #RS.logout()
                return 0
            #deposits all if inventory is not empty
            RS.depositAll()
            withdrawFromBank('/imgs/bowString.png')
            withdrawFromBank('/imgs/yewLongbowU.png')
            RS.closeBank()
            # starts stringing here
            if checkInv(cwd + "/imgs/bowString.png") and checkInv(
                    cwd + "/imgs/yewLongbowU.png"):
                makeBow()
                if RS.antiban('fletching'):
                    RandTime.randTime(11, 0, 0, 11, 9, 9)
                else:
                    RandTime.randTime(15, 0, 0, 15, 9, 9)
                #resets tries if items successfully found
                tries = 0
            else:
                RS.press_button('inventory')
                tries += 1
        else:
            RS.open_cw_bank()
            RandTime.randTime(0, 5, 0, 0, 9, 9)
Exemplo n.º 47
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
Exemplo n.º 48
0
def custom_clicker(wait_in_secs, count_to, click , range_sq ):
    print("move mouse to location to autoclick")
    time.sleep(3)
    cx, cy  = autopy.mouse.get_pos()
    print("Got {} {}".format(cx,cy))
    x1 = cx - range_sq
    y1 = cy -range_sq
    x2 = cx + range_sq
    y2 = cy + range_sq

    counter = 0


    while counter < count_to:
        x = random.randint(x1,x2)
        y = random.randint(y1,y2)
        Mouse.moveClick(x,y,click)
        counter += 1
        # randomize range of time to wait
#custom_clicker(wait_in_secs, count_to, click , range_sq ):
        print("Randomizing time")
        RandTime.randTime(2,0,0,wait_in_secs,9,9)
Exemplo n.º 49
0
def clicker(item):
    time.sleep(3)
    cx, cy = autopy.mouse.get_pos()
    x1 = cx - 3
    y1 = cy - 3
    x2 = cx + 3
    y2 = cy + 3
    timer = 0
    if item == 'stringer':
        while timer < 30:
            x = random.randint(x1, x2)
            y = random.randint(y1, y2)
            Mouse.moveClick(x, y, 1)
            timer += 1
            time.sleep(33)
            RandTime.randTime(0, 0, 1, 0, 0, 9)
    else:
        while timer < 375:
            x = random.randint(x1, x2)
            y = random.randint(y1, y2)
            Mouse.moveClick(x, y, 1)
            timer += 1
Exemplo n.º 50
0
def clicker(item):
    time.sleep(3)
    cx, cy  = autopy.mouse.get_pos()
    x1 = cx - 3
    y1 = cy - 3
    x2 = cx + 3
    y2 = cy + 3
    timer = 0
    if item == 'stringer':
        while timer < 30:
            x = random.randint(x1,x2)
            y = random.randint(y1,y2)
            Mouse.moveClick(x,y,1)
            timer +=1
            time.sleep(33)
            RandTime.randTime(0,0,1,0,0,9)
    else:
        while timer < 375:
            x = random.randint(x1,x2)
            y = random.randint(y1,y2)
            Mouse.moveClick(x,y,1)
            timer +=1
Exemplo n.º 51
0
def run():
    counter = 0
    skipL = True
    skipT = True
    while True: 
        if skipL:
            click_item('/home/jj/github/osrmacro/imgs/willowLogs.png')
            skipL = False
        else:
            click_item('/home/jj/github/osrmacro/imgs/tinderbox.png')
            skipL = True
        if counter == 27:
            print("All BURNED!")
            break

        if skipT:
            click_item('/home/jj/github/osrmacro/imgs/tinderbox.png')
            skipT = False
        else:
            click_item('/home/jj/github/osrmacro/imgs/willowLogs.png')
            skipT = True
        RandTime.randTime(2,0,0,2,9,9)
        counter += 1
        print(counter)
Exemplo n.º 52
0
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)
Exemplo n.º 53
0
def run():
    counter = 0
    skipL = True
    skipT = True
    while True:
        if skipL:
            click_item('/home/jj/github/osrmacro/imgs/willowLogs.png')
            skipL = False
        else:
            click_item('/home/jj/github/osrmacro/imgs/tinderbox.png')
            skipL = True
        if counter == 27:
            print("All BURNED!")
            break

        if skipT:
            click_item('/home/jj/github/osrmacro/imgs/tinderbox.png')
            skipT = False
        else:
            click_item('/home/jj/github/osrmacro/imgs/willowLogs.png')
            skipT = True
        RandTime.randTime(2, 0, 0, 2, 9, 9)
        counter += 1
        print(counter)
Exemplo n.º 54
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
Exemplo n.º 55
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)
Exemplo n.º 56
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)
Exemplo n.º 57
0
def findOptionClick(x,y,option_name):
    """Option name of in Image database only needs to be passed, x,y are obsoleate"""
    import Imgdb
    # Image DB
    idb = Imgdb.ImgDb()

    template = idb.pickled_dict[option_name]
    # turning template to graysacle
    if len(template.shape) == 3:
        template = cv2.cvtColor(template,cv2.COLOR_RGB2GRAY)

    w, h = template.shape[::-1]#Width, height of template image

    # coords of playing window
    x1 = 0 #5
    y1 = 25
    x2 = 767
    y2 = 524
    rs_window = Screenshot.shoot(x1,y1,x2,y2)

    # Finds all black lines
    ret,thresh1 = cv2.threshold(rs_window,0,255,cv2.THRESH_BINARY)
    # inverst to black to white
    ret,thresh1 = cv2.threshold(thresh1,0,255,cv2.THRESH_BINARY_INV)

    # looks for all squares
    _, contours,h = cv2.findContours(thresh1,1,2)

    for cnt in contours:
        # looks for biggest square
        if cv2.contourArea(cnt) <= 1695.0:
            continue
        # checks contour sides
        approx = cv2.approxPolyDP(cnt,0.01*cv2.arcLength(cnt,True),True)

        # Square found here vvvv
        if len(approx)==4:
            #print("square of {}".format(cv2.contourArea(cnt)))
            #cv2.drawContours(rs_window,[cnt],0,(255,255,255),-1)

            # get geometry of approx
            # add rs coords
            x,y,w,h = cv2.boundingRect(cnt)

            #combines with playing window
            x += x1
            y += y1

            # scrshot of option menu on play window
            img = Screenshot.shoot(x,y,x+w,y+h)
            ret,pattern = cv2.threshold(img,254,255,cv2.THRESH_BINARY)
            ###  DEBUG LINE
            #cv2.imshow('img',pattern)
            #cv2.waitKey(0)
            #return
            break
    else:
        Mouse.randMove(0,0,500,500,0)
        time.sleep(1)
        print("Else ran")

    res = cv2.matchTemplate(pattern,template,cv2.TM_CCOEFF_NORMED)
    threshold = .9
    loc = np.where( res >= threshold)

    # clicks on option here when found in pattern
    for pt in zip(*loc[::-1]):#goes through each found image
        rsx, rsy = position()
        x += pt[0] + rsx
        y += pt[1] + rsy
        y1 = y
        y2 = y+10
        img = Screenshot.shoot(x,y1,x+w,y2)
        # range of x and y to click on.
        # in the options
        Mouse.randMove(x,y1,x+(w/2),y2, 1)
        # autopy.mouse.click()#taking out since it does not delay the click
        RandTime.randTime(0,0,0,0,0,9)
Exemplo n.º 58
0
def click(button):
    #autopy.mouse.click()
    #
    pyautogui.mouseDown(button='left')
    RandTime.randTime(0,1,0,0,2,9)#time between click
    pyautogui.mouseUp(button='left')
Exemplo n.º 59
0
            x, y = genCoords(686+rsx,416+rsy,696+rsx,426+rsy)
            Mouse.moveClick(x,y,1)

counter = 0
nats = int(raw_input("Alchabels??\n> "))
souls = int(raw_input("Souls??\n> "))
bodys = int(raw_input("Body runes??\n> "))
while True:
    if counter >= nats+souls+bodys:
        print('done!')
        break
#        
    if nats:
        spell('alch')
        nats -= 1
        RandTime.randTime(0,1,9,0,3,9)
    if souls:
        spell('stun')
        souls -= 1
    if bodys and not souls:
        spell('curse')
        bodys -= 1
    if (counter % (random.choice([2,3])) == 0 or counter == 0) and ((souls > 0) or (bodys > 0)):
        print(counter,'Finding Monk')
        x1,y1,x2,y2 = findMonk()
    if (souls > 0) or (bodys > 0): 
        if not RS.is_button_selected('magic'):
            RS.press_button('magic')
        x, y = genCoords(x1,y1,x2, y2)
        Mouse.moveClick(x,y,1)
        if random.randint(1,100) == 0:
Exemplo n.º 60
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)