Ejemplo n.º 1
0
def track(directory):
    global check_init

    if cursor[1] > 0:
        if cursor[2] == 0:
            cursor[2] = time.time()
        length_ = 10
        if abs(cursor[0][0] - autoit.mouse_get_pos()[0]) > length_ or \
                abs(cursor[0][1] - autoit.mouse_get_pos()[1]) > length_:
            autoit.mouse_move(*cursor[0], speed=0)
        if time.time() - cursor[2] > cursor[1]:
            cursor[1] = 0
            cursor[2] = 0
    elif cursor_down[0]:
        autoit.mouse_up()
        autoit.mouse_down()
        if time.time() - cursor_down[1] > cursor_down[0]:
            cursor_down[0] = 0
    if check_init:
        init(directory)
        check_init = False

    delay = 0.1
    time.sleep(delay)
def mainThread():
    global inputBet, inputColor
    print(
        "\n\n\nWelcome to the gta casino roulette autobet bot. Please put your game in Windowed mode"
    )
    inputBet = int(input("Enter base bet (ex. 1500): "))
    inputColor = input("Enter bet color (ex. red, black, green): ")
    print("\nPress 'END' to toggle the script ON/OFF \n\n\n")
    bet_color = inputColor
    small_bet = inputBet
    betting_target = inputBet
    finished_betting = False
    lastmoney = 0
    lastcolor = ""
    rounds_played = 0
    increased = False
    bet_list = [100, 500, 1000, 5000, 10000]
    while True:
        if startScript:
            frame = getFrame()
            time = get_time(frame)
            if time != 0:
                if finished_betting == False:
                    print("Current time: ", time)
                    current_money = get_current_Money(frame)
                    current_bet = get_current_Bet(frame)
                    currentColor = get_last_color(frame)
                    center_frame = [frame.size[0] / 2, frame.size[1] / 2]
                    if current_money < lastmoney and rounds_played != 0 and increased == False:
                        print("bet target increased")
                        betting_target *= 2
                        increased = True
                    elif current_money >= lastmoney:
                        betting_target = small_bet
                    if current_bet == betting_target:
                        rounds_played += 1
                        print("\n\n")
                        print("Rounds played: ", rounds_played)
                        print("Current color: ", currentColor)
                        print("Last color: ", lastcolor)
                        print("Current money: ", current_money)
                        print("Current bet: ", current_bet)
                        print("Current target: ", betting_target)
                        print("\n\n")
                        lastmoney = current_money
                        lastcolor = currentColor
                        finished_betting = True
                    else:
                        #increment bet
                        for i in range(5):
                            pressKey(DIK_ARROW_DOWN)
                            sleep(0.07)
                            releaseKey(DIK_ARROW_DOWN)
                        if bet_color == "red":
                            autoit.mouse_move(int(center_frame[0] - 90),
                                              int(center_frame[1] + 330))
                        elif bet_color == "black":
                            autoit.mouse_move(int(center_frame[0] + 90),
                                              int(center_frame[1] + 330))
                        elif bet_color == "green":
                            autoit.mouse_move(int(center_frame[0] - 550),
                                              int(center_frame[1]) - 75)
                        for k in reversed(bet_list):
                            temp = (betting_target - current_bet) - k
                            if temp >= 0:
                                for x in range(bet_list.index(k)):
                                    pressKey(DIK_ARROW_UP)
                                    sleep(0.09)
                                    releaseKey(DIK_ARROW_UP)
                                autoit.mouse_down("left")
                                sleep(0.15)
                                autoit.mouse_up("left")
                                break
            else:
                finished_betting = False
                increased = False
        else:
            releaseFrame()
Ejemplo n.º 3
0
def _tapCursor():
    autoit.mouse_down('left')
    autoit.mouse_up('left')
Ejemplo n.º 4
0
def play(log, speed, tlast, debug_mode):
    st = 0.0
    stt = 0.0
    tlast -= 0.01

    if debug_mode:
        timer = time.perf_counter()
    offset_timer = time.perf_counter()

    for step in log:
        if step[0] == 'mousemove':
            t_offset = time.perf_counter() - offset_timer - st
            # print(t_offset)
            st = (float(step[-1]) - tlast - t_offset) / speed
            # print(st)
            offset_timer = time.perf_counter()
            if st > 0:
                time.sleep(st)
            stt += t_offset
            autoit.mouse_move(int(step[1]), int(step[2]), 0)
            tlast = float(step[-1])
            continue

        if step[0] == 'mousepressed':
            t_offset = time.perf_counter() - offset_timer - st
            st = (float(step[-1]) - tlast - t_offset) / speed
            offset_timer = time.perf_counter()
            if st < 0.0:
                time.sleep(st)
            stt += t_offset
            autoit.mouse_move(int(step[2]), int(step[3]), 0)
            autoit.mouse_down(step[1])
            tlast = float(step[-1])
            continue

        if step[0] == 'mousereleased':
            t_offset = time.perf_counter() - offset_timer - st
            st = (float(step[-1]) - tlast - t_offset) / speed
            offset_timer = time.perf_counter()
            if st < 0.0:
                time.sleep(st)
            stt += t_offset
            autoit.mouse_move(int(step[2]), int(step[3]), 0)
            autoit.mouse_up(step[1])
            tlast = float(step[-1])
            continue

        if step[0] == 'mousescrolled':
            t_offset = time.perf_counter() - offset_timer - st
            st = (float(step[-1]) - tlast - t_offset) / speed
            offset_timer = time.perf_counter()
            if st > 0:
                time.sleep(st)
            stt += t_offset
            autoit.mouse_wheel(int(step[2]), int(step[3]), 0)
            autoit.mouse_up(step[1])
            tlast = float(step[-1])
            continue

        if step[0] == 'keypressed':
            t_offset = time.perf_counter() - offset_timer - st
            # print(t_offset)
            st = (float(step[-1]) - tlast - t_offset) / speed
            offset_timer = time.perf_counter()
            if st > 0:
                time.sleep(st)
            stt += t_offset
            autoit.send(step[1])
            tlast = float(step[-1])
            continue

        if step[0] == 'keyreleased':
            t_offset = time.perf_counter() - offset_timer - st
            st = (float(step[-1]) - tlast - t_offset) / speed
            offset_timer = time.perf_counter()
            if st > 0:
                time.sleep(st)
            stt += t_offset
            autoit.send(step[1])
            tlast = float(step[-1])
            continue

        if step[0] == 'done':
            print('End playing')
            if debug_mode:
                print(time.perf_counter() - timer)
                print(stt)
            pass
Ejemplo n.º 5
0
def click(x, y, button="left"):
    autoit.mouse_move(x, y)
    autoit.mouse_down(button)
    time.sleep(0.2)
    autoit.mouse_up(button)
Ejemplo n.º 6
0
def mouseRotate():
    autoit.mouse_move(655, 521)
    sleep(0.2, 0.6)
    autoit.mouse_down('right')
    autoit.mouse_move(670, 521)
    autoit.mouse_up('right')
 def up(cls):
     """
     :description 执行鼠标当前位置的释放事件
     :return:
     """
     autoit.mouse_up()
Ejemplo n.º 8
0
def add_household(household):
    print('>>> Starting entry for %s' % str(household))

    autoit.win_activate("Link2Feed Portal - Google Chrome")
    time.sleep(DEFAULT_TIME)

    prime = household.primary
    second = household.secondary

    autoit.mouse_click("left", 2281, 328)
    time.sleep(1.0)
    autoit.send('{TAB}')
    autoit.send('{DOWN}{DOWN}{DOWN}{DOWN}')
    time.sleep(DEFAULT_TIME)
    autoit.send('{ENTER}')
    autoit.send('{TAB}')
    time.sleep(DEFAULT_TIME)
    if prime.last_visit:
        visit_date = datetime.strptime(
            prime.last_visit.replace('00:00:00',
                                     '').replace('MST', '').replace('MDT', ''),
            "%a %b %d %Y")
        autoit.send(visit_date.strftime(DATE_FORMAT))
    else:
        autoit.send(prime.creation_date.strftime(DATE_FORMAT))
    autoit.send('{TAB}{UP}{TAB}')

    autoit.send(prime.last_name.upper())
    autoit.send('{TAB}')
    autoit.send(prime.first_name.upper())
    autoit.send('{TAB}')

    time.sleep(DEFAULT_TIME)
    autoit.send(prime.birthdate.strftime(DATE_FORMAT))
    time.sleep(DEFAULT_TIME)
    autoit.send('{TAB}')

    time.sleep(1.0)
    if hex(autoit.pixel_get_color(2877, 223)) == '0xf4b04f':
        write_duplicate(prime.first_name, prime.last_name, prime.birthdate)
        print('duplicate detected: %s' % str(prime))
        autoit.mouse_click("left", 3816, 15)
        time.sleep(4.0)
        autoit.send('{ENTER}')
        time.sleep(4.0)
        autoit.send('#3')
        time.sleep(10.0)
        autoit.mouse_click("left", 2246, 54)
        autoit.send('https://portal.link2feed.ca/org/2191/intake/')
        time.sleep(DEFAULT_TIME)
        autoit.send('{ENTER}')
        time.sleep(6.0)
        return

    autoit.send('{TAB}')

    if prime.gender == "female":
        autoit.send('{DOWN}')
    elif prime.gender == "male":
        autoit.send('{DOWN}{DOWN}')
    else:
        autoit.send('{DOWN}{DOWN}{DOWN}{DOWN}')
    time.sleep(DEFAULT_TIME)
    autoit.send('{ENTER}')

    if not second:
        autoit.mouse_click("left", 2206, 807)
    elif household.relationship == 'commonlaw':
        autoit.mouse_click("left", 2474, 808)
    elif household.relationship == 'spouse':
        autoit.mouse_click("left", 2207, 831)
    else:
        autoit.mouse_click("left", 3011, 807)
    time.sleep(DEFAULT_TIME)

    autoit.mouse_move(3832, 317, 0)
    time.sleep(DEFAULT_TIME)
    autoit.mouse_down("left")
    autoit.mouse_move(3832, 716)
    autoit.mouse_up("left")

    autoit.mouse_click("left", 2206, 171)
    autoit.mouse_click("left", 2922, 224)
    autoit.mouse_click("left", 3011, 680)
    click_point_from_city(prime.city)

    if prime.income == "Student Scholarship":
        autoit.mouse_click("left", 2207, 915)
    else:
        autoit.mouse_click("left", 2205, 964)

    if prime.phone:
        fixed_phone = prime.phone.replace('(',
                                          '').replace(')',
                                                      '').replace('-', '')
        if len(fixed_phone) == 10:
            autoit.mouse_click("left", 2245, 486)
            time.sleep(DEFAULT_TIME)
            autoit.send(fixed_phone)

    autoit.mouse_wheel("down", 20)
    time.sleep(DEFAULT_TIME)

    member_count = 0
    if household.secondary:
        member_count += 1
        success = add_member(household.secondary, household.relationship, 1)
        if not success:
            return

    # for child in household.children:
    #     member_count += 1
    #     success = add_member(child, 'child', member_count)
    #     if not success:
    #         return

    autoit.mouse_click("left", 3726, 966)
    time.sleep(3.0)
    autoit.mouse_click("left", 2248, 547)
    time.sleep(DEFAULT_TIME)
    autoit.send('+{TAB}')
    time.sleep(DEFAULT_TIME)
    down_count = 1
    if not prime.income:
        down_count = 5
    elif prime.income == 'Child Benefits':
        down_count = 2
    elif prime.income == 'Disability / PWD':
        down_count = 3
    elif prime.income == 'Employment Insurance':
        down_count = 4
    elif prime.income == 'OAP / CPP':
        down_count = 6
    elif prime.income == 'Social Assistance':
        down_count = 8
    elif prime.income == 'Student Scholarship':
        down_count = 10
    elif prime.income == 'Works Casual':
        down_count = 11
    elif prime.income == 'Works Full-Time':
        down_count = 12
    else:
        down_count = 13

    for i in range(down_count):
        autoit.send('{DOWN}')

    autoit.send('{ENTER}')

    time.sleep(DEFAULT_TIME)

    autoit.mouse_click("left", 2246, 535)

    if not household.secondary:
        autoit.mouse_click("left", 3737, 736)
    else:
        autoit.mouse_click("left", 3738, 871)

    time.sleep(1.5)
    autoit.mouse_click("left", 3747, 769)
    time.sleep(1.5)
    autoit.mouse_click("left", 2762, 193)
    time.sleep(1.5)
    autoit.mouse_click("left", 3765, 353)
    time.sleep(DEFAULT_TIME)

    if prime.dietary:
        prime.dietary = prime.dietary.replace('+',
                                              '').replace('^', '').replace(
                                                  '!', '').replace('#', '')
        autoit.send('--DIET--{ENTER}')
        autoit.send(prime.dietary.replace('\n', '{ENTER}'))
        autoit.send('--DIET--{ENTER}')
    if prime.notes:
        prime.notes = prime.notes.replace('+', '').replace('^', '').replace(
            '!', '').replace('#', '')
        autoit.send(prime.notes.replace('\n', '{ENTER}'))
        if household.children:
            autoit.send('Children: %s {ENTER}' %
                        [child.age for child in household.children])
    if prime.comments:
        prime.comments = prime.comments.replace('+',
                                                '').replace('^', '').replace(
                                                    '!', '').replace('#', '')
        autoit.send(prime.comments.replace('\n', '{ENTER}'))

    autoit.mouse_click("left", 3113, 487)
    time.sleep(1.5)

    # Check for green services in case something went wrong
    if hex(autoit.pixel_get_color(2611, 192)) != '0x43a543':
        print('>>> Entry failed: green services check: %s' %
              hex(autoit.pixel_get_color(2611, 192)))
        exit(1)

    autoit.mouse_click("left", 2462, 49)
    time.sleep(DEFAULT_TIME)
    autoit.send('https://portal.link2feed.ca/org/2191/intake/')
    autoit.send('{ENTER}')

    print(">>> Finished entry for %s" % str(household))
Ejemplo n.º 9
0
def mouseRotate():
    autoit.mouse_move(655, 521)
    sleep(0.2, 0.6)
    autoit.mouse_down('right')
    autoit.mouse_move(670, 521)
    autoit.mouse_up('right')
def play(log, speed, tlast, debug_mode):
    print("Ready, press 'alt + .' to start")
    keyboard.wait("alt+.")
    if debug_mode:
        timer = time.time()
    t_offset = time.time()
    tlast -= 0.1
    for step in log:
        if step[0] == 'mousemove':
            t_offset = time.time() - t_offset
            # print(t_offset)
            time.sleep((float(step[-1]) - tlast - t_offset) / speed)
            autoit.mouse_move(int(step[1]), int(step[2]), 0)
            tlast = float(step[-1])
            t_offset = time.time()
            continue

        if step[0] == 'mousepressed':
            t_offset = time.time() - t_offset
            time.sleep((float(step[-1]) - tlast - t_offset) / speed)
            autoit.mouse_move(int(step[2]), int(step[3]), 0)
            autoit.mouse_down(step[1])
            tlast = float(step[-1])
            t_offset = time.time()
            continue

        if step[0] == 'mousereleased':
            t_offset = time.time() - t_offset
            time.sleep((float(step[-1]) - tlast - t_offset) / speed)
            autoit.mouse_move(int(step[2]), int(step[3]), 0)
            autoit.mouse_up(step[1])
            tlast = float(step[-1])
            t_offset = time.time()
            continue

        if step[0] == 'mousescrolled':
            t_offset = time.time() - t_offset
            time.sleep((float(step[-1]) - tlast - t_offset) / speed)
            autoit.mouse_wheel(int(step[2]), int(step[3]), 0)
            autoit.mouse_up(step[1])
            tlast = float(step[-1])
            t_offset = time.time()
            continue

        if step[0] == 'keypressed':
            t_offset = time.time() - t_offset
            time.sleep((float(step[-1]) - tlast - t_offset) / speed)
            autoit.send(step[1])
            tlast = float(step[-1])
            t_offset = time.time()
            continue

        if step[0] == 'keyreleased':
            t_offset = time.time() - t_offset
            time.sleep((float(step[-1]) - tlast - t_offset) / speed)
            autoit.send(step[1])
            tlast = float(step[-1])
            t_offset = time.time()
            continue

        if step[0] == 'done':
            print('Lobby settings are all set')
            if debug_mode:
                print(time.time() - timer)
            pass