Пример #1
0
def confirm():
    # keyboard.wait("esc")
    #
    # pyautogui.click(x=592, y=37)
    # pyautogui.hotkey("ctrl", "c")
    # pyautogui.click(x=316, y=856, button="right")
    # pyautogui.move(10, -340)
    # time.sleep(0.40)
    # pyautogui.click(x=559, y=584)
    # time.sleep(0.30)
    # pyautogui.hotkey("ctrl", "v")
    # keyboard.press("enter")

    keyboard.wait("esc")
    pydirectinput.PAUSE = False

    pyautogui.click(x=592, y=37)

    # pyautogui.hotkey("ctrl", "c")
    # keyboard.on_press_key("ctrl")
    # keyboard.press("c")
    pydirectinput.keyDown("ctrl")
    pydirectinput.press("c")
    pydirectinput.keyUp("ctrl")

    pyautogui.click(x=316, y=856, button="right")
    pyautogui.moveTo(378, 632)
    time.sleep(0.40)
    pyautogui.click(x=534, y=682)
    time.sleep(1.5)

    # pyautogui.hotkey("ctrl", "v")
    pydirectinput.keyDown("ctrl")
    pydirectinput.press("v")
    pydirectinput.keyUp("ctrl")

    keyboard.press("enter")

    time.sleep(0.5)

    filename = f"{json_file['defaultPath']}/{root.clipboard_get()}.xls"

    df = pd.read_excel(filename)

    df.rename(columns={
        "Unnamed: 2": "Glass Type",
        "Unnamed: 1": "Job Type"
    },
              inplace=True)

    df[["Height", "Width"]] = df["Size"].str.split("x", expand=True)

    cols = df.columns.tolist()

    # df = df[cols]
    # print(cols)

    try:
        df = df[[
            "Quantity", "Height", "Width", "Marks / Code", "Glass Type",
            "Job Type"
        ]]
    except KeyError as e:
        tk.messagebox.showerror(f"Error: {e} not found", f"{e}")
        return

    df["Quantity"] = df["Quantity"].replace("x ", "", regex=True)

    df["Job Type"] = df["Job Type"].ffill()

    # df_group = df.groupby("Glass Type")

    df_group = df.groupby("Job Type")

    # print(df_group.groups.keys())

    df_group_list = list(df_group.groups.keys())

    for glass_type in df_group_list:
        df_select = df_group.get_group(glass_type)

        df_select = df_select[df_select["Glass Type"].notna()]

        try:
            df_select.to_csv(filename[:-3] + f"{glass_type}." + "csv",
                             index=False)
        except OSError as e:

            error_list = list('\\/:*?"<>|')

            if any(x in error_list for x in glass_type):
                current_value = glass_type
                current_value = current_value.replace('\\', "_")
                current_value = current_value.replace("/", "_")
                current_value = current_value.replace(":", "_")
                current_value = current_value.replace("*", "_")
                current_value = current_value.replace("?", "_")
                current_value = current_value.replace("<", "_")
                current_value = current_value.replace(">", "_")
                current_value = current_value.replace("|", "_")

                try:
                    df_select.to_csv(filename[:-3] + f"{current_value}." +
                                     "csv",
                                     index=False)
                except OSError:
                    tk.messagebox.showerror("Error: OSError", f"{e}")
                    return
            else:
                tk.messagebox.showerror("Error: OSError", f"{e}")
                return
Пример #2
0
    if pyautogui.locateOnScreen('assets/playgame.png',
                                grayscale=True,
                                confidence=0.8) is not None:
        start_game_are_u_sure()
        numberOfGames += 1
        print("Game number " + str(numberOfGames) + " starting")
    elif pyautogui.locateOnScreen('assets/endseason.png',
                                  grayscale=True,
                                  confidence=0.8) is not None:
        ens_season_are_u_sure()
    elif pyautogui.locateOnScreen('assets/allstar.png',
                                  grayscale=True,
                                  confidence=0.8) is not None:
        skip_all_star()
    elif pyautogui.locateOnScreen('assets/teampractice.png',
                                  grayscale=True,
                                  confidence=0.8) is not None:
        go_to_next_game()
    elif pyautogui.locateOnScreen('assets/simToNext.png',
                                  grayscale=True,
                                  confidence=0.8) is not None:
        skip_to_sub_in()
    elif pyautogui.locateOnScreen('assets/simulator.png',
                                  grayscale=True,
                                  confidence=0.8) is not None:
        skip_to_sub_in()
        print(get_time_stamp(), "Player back in the game")
    else:
        pydirectinput.press('space')
        pydirectinput.press('x')
Пример #3
0
Файл: tft.py Проект: yvanat/PE
def sell(pos, data):
    auto.moveTo(pos, duration=random.uniform(t1fast, t2fast))
    direct.press("e", _pause=False)
Пример #4
0

def healAndUp():
    for i in range(0, 3):
        #use health potion
        pydirectinput.press("1")
        #pick up item
        pydirectinput.press("`")


while 1:
    pydirectinput.keyDown("space")
    for i in range(len(keys)):
        pydirectinput.keyDown("space")
        #Turning
        pydirectinput.press(keys[i])
        healAndUp()
    healAndUp()

    #AntyBOT {
    pydirectinput.moveTo(1000, 1000)
    time.sleep(0.5)
    pydirectinput.moveTo(795, 597)
    pydirectinput.click()
    #}
    now = int(time.time())

    #Use hood every 30s
    if now - was >= 30:
        was = int(time.time())
        pydirectinput.press("2")
Пример #5
0
        quit(1)
    if console_text_entry_location is None:
        print("couldn't find console text entry")
        quit(1)
    pydirectinput.moveTo(
        int(console_text_entry_location.left +
            console_text_entry_location.width / 3),
        int(console_text_entry_location.top +
            console_text_entry_location.height / 2))
    pyautogui.click()
    pyautogui.write(f'''exec {config}\n''')

    time.sleep(40)

    # run post load configs
    pydirectinput.press('`')
    pyautogui.write(f'''exec {match_prefix}_post_load_{team_number}\n''')

    time.sleep(3)

    # move demoui to top left corner
    demo_playback_name_path = end_image_path.parent / 'demo_playback_name.png'
    try:
        demo_playback_name_location = pyautogui.locateOnScreen(
            str(demo_playback_name_path), confidence=0.9)
    except pyautogui.ImageNotFoundException:
        print("couldn't find demo playback name")
        quit(1)
    if demo_playback_name_location is None:
        print("couldn't find demo playback name")
        quit(1)
Пример #6
0
from PIL import Image
import ctypes
import pydirectinput

# def click(x,y):
#     print('jalan1')
#     ctypes.windll.user32.SetCursorPos(x, y)
#     time.sleep(1)
#     # pyautogui.click()
#     # win32api.SetCursorPos((x,y))
#     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
#     time.sleep(0.1)
#     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
#     # win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
#     # time.sleep(0.1)
#     # win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
#     # # pydirectinput.click()
#     # time.sleep(1)

# time.sleep(3)
# selesai = pyautogui.locateCenterOnScreen('selesai event.png', grayscale=True, confidence=0.6)
# print(selesai)
# x, y = selesai
# click(int(x), int(y))

print('Pencet spasi')
time.sleep(3)
# pyautogui.press('a')
pyautogui.write('Hello There')
pydirectinput.press('j')
Пример #7
0
def move():
    pyautogui.PAUSE = 1.5
    pydirectinput.press('left', presses=1)
    pydirectinput.press('right', presses=1)
    checkEncounter()
Пример #8
0
'''
for pos in pydirectinput.locateAllOnScreen('./clock.png'):
    print(pos)
    cnt += 1

if cnt == 0: print('There was nothing matched.')
'''
'''
for i in range(5):
    #pydirectinput.click(x = d[0], y = d[1])
    pydirectinput.mouseDown(x=d[0], y=d[1], button='left')
    time.sleep(0.1)
    pydirectinput.mouseUp(x=d[0], y=d[1], button='left')
    time.sleep(0.3)
'''
'''
for pos in pyautogui.locateAllOnScreen('./ScreenShots/test.png', grayscale=True):
    print(pos)
'''
'''
pos = pyautogui.locateOnScreen('./ScreenShots/clock.png')
print(pos)
'''
'''
t1 = time.time()
time.sleep(0.2)
t2 = time.time()
print(t2-t1)
'''
pydirectinput.press('1')
Пример #9
0
import pydirectinput

pydirectinput.press('f')
Пример #10
0
def buff(t=1):
    global t_120, t_180, t_200, t_90, t_900
    tn = time.time()
    if tn - t_900 >= 900 * 0.8:
        pydirectinput.press('1')
        time.sleep(1)
        t_900 = tn

    if t == 1:
        if tn - t_180 >= 180 * 0.8:
            pydirectinput.press('3')
            time.sleep(3)
            pydirectinput.press('4')
            time.sleep(2)
            pydirectinput.press('0')
            time.sleep(1)
            pydirectinput.press('ctrl')
            time.sleep(1)
            pydirectinput.press('j')
            time.sleep(1)
            t_180 = tn
        if tn - t_120 >= 120:
            pydirectinput.press('6')
            time.sleep(1)
            t_120 = tn

    elif t == 2:
        if tn - t_200 >= 200 * 0.8:
            pydirectinput.press('3')
            time.sleep(3)
            t_200 = tn
        if tn - t_120 >= 120:
            pydirectinput.press('2')
            time.sleep(1)
            t_120 = tn
        if tn - t_90 >= 90:
            pydirectinput.press('5')
            time.sleep(1)
            t_90 = tn
Пример #11
0
def search(file):
    print("Searching for ", file)
    button = pyautogui.locateOnScreen(file, confidence=0.7)
    print(button)
    res = (button != None)
    if res:
        print(file, button)
        pyautogui.moveTo(button)
        time.sleep(0.3)
        di.press("enter")
    return res


print("Starting in 3s :")
for i in range(3):
    time.sleep(1)
    print(".")

while (True):
    res = search(deck)
    res = search(ab)
    if res:
        time.sleep(0.3)
        di.press("left")
        time.sleep(0.3)
        di.press("enter")
    else:
        pyautogui.click((900, 500))
    di.press("enter")
Пример #12
0
def trigger(key):
    pydirectinput.press(key)
    return ""
def loot_treasure(raid_info, inventory, areas, area_name, party, tile_number,
                  dungeon_path, debug):
    c = Controller(debug)
    print('Looting treasure!')
    dungeon_name = raid_info['raid_instance']['dungeon']
    queued_loot = raid_info['loot']['queue_items']['items']
    battle_reward = raid_info['loot']['result']['inventory_system'][
        'items'] if 'result' in raid_info['loot'] else []
    c.write(
        c.left_stick_down
    )  # in case didn't exit from battle and accidentally grabbed item, let it go
    c.write(c.left_stick_up, 2)

    # check how many empty slots we have in our inventory
    item_data = {}
    for i in inventory.items:
        total = sum(item.quantity for item in inventory.items
                    if item.name == i.name)
        stacks = math.ceil(total / i.full_stack)
        if i.name not in item_data:
            item_data.update({i.name: {'total': total, 'stacks': stacks}})
    total_stacks = sum(item['stacks'] for item in item_data.values())
    empty_slots = 16 - total_stacks
    print(f'number of empty slots in inventory: {empty_slots}')

    # combine item stacks in inventory if necessary
    items = inventory.items.copy()
    for i in items:
        items_to_combine = [
            item for item in inventory.items
            if item.name == i.name and item.quantity != item.full_stack
        ]
        for index, item in enumerate(items_to_combine):
            if index != len(items_to_combine) - 1:
                combine_items(item.item_slot,
                              items_to_combine[index + 1].item_slot, debug)
                new_item = items_to_combine[index + 1]
                leftover = item.quantity + new_item.quantity - item.full_stack
                if leftover <= 0:
                    new_item.quantity += item.quantity
                    inventory.empty_slots.append(item.item_slot)
                    inventory.items.remove(item)
                else:
                    new_item.quantity = item.full_stack
                    item.quantity = leftover
                    item.value = Items[item.name][
                        'value'] * item.quantity if item.value is not None else item.value
                new_item.value = Items[new_item.name]['value'] * new_item.quantity if new_item.value is not None \
                    else new_item.value

    # if the loot is contained in the save file, parse it and sort it by value
    if len(queued_loot) > 0 or len(battle_reward) > 0:
        loot = [
            Item(item['id'], item['type'], item['amount'], item_slot)
            for item_slot, item in (queued_loot.items(
            ) if len(queued_loot) > 0 else battle_reward.items())
        ]
        print('Specific loot contained in save file!')
        print(queued_loot if len(queued_loot) > 0 else battle_reward)

        # combine loot items with items in our inventory if possible
        # - it is assumed that items in inventory are already combined such that there can only be 1 incomplete
        #   stack per item
        for i in loot.copy():
            if i.quantity != i.full_stack:
                item = next((item
                             for item in inventory.items if i.name == item.name
                             and item.quantity != item.full_stack), None)
                if item is not None:
                    take_item(i.item_slot, debug)
                    leftover = i.quantity + item.quantity - item.full_stack
                    if leftover <= 0:
                        item.quantity += i.quantity
                        for j in loot:
                            if j.item_slot > i.item_slot:
                                j.item_slot -= 1
                        loot.remove(i)
                    elif leftover > 0 >= empty_slots:
                        item.quantity = item.full_stack
                        i.quantity = leftover
                        i.value = Items[i.name][
                            'value'] * i.quantity if i.value is not None else i.value
                        c.write(c.left_stick_down)
                        c.write(c.left_stick_up, 2)
                    elif leftover > 0 and empty_slots > 0:
                        item.quantity = item.full_stack
                        empty_slots -= 1
                        for j in loot:
                            if j.item_slot > i.item_slot:
                                j.item_slot -= 1
                        loot.remove(i)
                        for index in range(16):
                            if not any(j.item_slot == index
                                       for j in inventory.items):
                                inventory.items.append(
                                    Item(i.name,
                                         i.type,
                                         quantity=leftover,
                                         item_slot=index))
                                if index in inventory.empty_slots:
                                    inventory.empty_slots.remove(index)
                                break
                    item.value = Items[item.name][
                        'value'] * item.quantity if item.value is not None else item.value
        print('Combining loot items with inventory items finished!')

        # sort loot in order of priority
        # future - add priority for stacks of heirlooms and sort
        loot_to_take = [item for item in loot if item.value is None]
        other_loot = [item for item in loot if item.value is not None]
        other_loot.sort(key=lambda k: k.value, reverse=True)
        loot_to_take.extend(other_loot)
        loot = loot_to_take.copy()

        # take items until no more empty slots
        print(f'number of empty slots in inventory: {empty_slots}')
        for index, i in enumerate(loot_to_take):
            if index < empty_slots:
                take_item(i.item_slot, debug)
                for j in loot_to_take:
                    if j.item_slot > i.item_slot:
                        j.item_slot -= 1
                for j in range(16):
                    if not any(item.item_slot == j
                               for item in inventory.items):
                        inventory.items.append(
                            Item(i.name, i.type, i.quantity, item_slot=j))
                        if j in inventory.empty_slots:
                            inventory.empty_slots.remove(j)
                        break
                loot.remove(i)

        # compare highest value loot with the lowest value item in our inventory
        #  to determine whether or not we should switch them
        loot_to_take = loot.copy()
        droppable_items = get_droppable_items(raid_info, areas, inventory,
                                              dungeon_name, party,
                                              dungeon_path)
        drop_count = 0
        for item in loot_to_take:
            if not ((item.type == 'trinket' and item.rating >= 6)
                    or item.value is None
                    or item.value > droppable_items[drop_count].value):
                break
            # check again first, and only drop item if it won't combine
            # if not any(i for i in inventory.items
            #            if i.name == item.name and i.quantity + item.quantity <= i.full_stack):
            drop_item(droppable_items[drop_count].item_slot, debug)
            drop_count += 1
            take_item(item.item_slot, debug)
            for i in loot_to_take:
                if i.item_slot > item.item_slot:
                    i.item_slot -= 1
            loot.remove(item)

        if len(loot) > 0:
            c.write(c.b)
    else:
        # the loot only exists in the game client, can't determine what the items are using the save file reader
        # future - use pattern recognition to perform classification of items, for now just drop the lowest value
        #           item one at a time and take items randomly
        # loot = identify_lootscreen_items(search_region, dungeon_name, party)
        #       - Currently runs pretty fast but accuracy is terrible. Game icons are most likely being scaled
        #         and overlayed in the game in such a way that they can't recognized. Either need to create custom
        #         thumbnails instead of using game assests, or need to use a better library for image recognition
        print('Random loot, not contained in save file!')
        area_tiles = areas[area_name]['tiles']
        curio_prop = area_tiles[f'tile{tile_number}']['curio_prop']

        # rearrange inventory to fill in empty slots (must do this step!!!)
        for empty_slot in inventory.empty_slots.copy():
            print(f'filling in empty inventory slot {empty_slot}')
            last_item_slot = max(i.item_slot for i in inventory.items)
            last_item = next(item for item in inventory.items
                             if item.item_slot == last_item_slot)
            last_slot_trinket = Items[
                last_item.name] if last_item.type == 'trinket' else None
            selected_hero_class = next(
                hero.heroClass for hero in party
                if hero.rank == get_selected_hero_rank())
            combine_items(last_item.item_slot, empty_slot, debug,
                          last_slot_trinket, selected_hero_class)
            last_item.item_slot = empty_slot
            inventory.empty_slots.remove(empty_slot)

        # attempt to take all items using space
        print('attempting to take all items with space ...')
        c.write(c.right)  # needed before space command, don't remove
        pydirectinput.press(
            c.space, interval=.05
        )  # need to use pydirectinput.press for 'space'/'enter' key
        pydirectinput.press(
            c.space, interval=.05
        )  # repeat command in case input doesn't work (don't remove!)
        time.sleep(.3)
        pydirectinput.press(c.enter,
                            interval=.05)  # close inventory full notification
        time.sleep(.3)

        sfr.decrypt_save_info('persist.map.json')
        f = open(Path(f'{sfr.save_editor_path()}/persist.map.json'))
        map_info = json.load(f)['base_root']
        f.close()
        areas = map_info['map']['static_dynamic']['areas']
        area_tile = areas[area_name]['tiles'][f'tile{tile_number}']

        # if that doesn't work, drop the lowest value item and take items until there are none left
        if area_tile['content'] != 0:
            droppable_items = get_droppable_items(raid_info, areas, inventory,
                                                  dungeon_name, party,
                                                  dungeon_path)

            while area_tile['content'] != 0:
                # stop if don't want to drop lowest value item
                if ((droppable_items[0].value >= 800 and droppable_items[0].name != 'gold')
                    or (droppable_items[0].value >= 500 and droppable_items[0].name == 'gold')) \
                        and not area_name.startswith('sec') and 'quest' not in Curios[curio_prop]['reward']:
                    c.write(c.b)
                    break

                drop_item(droppable_items[0].item_slot, debug)
                # don't add gaps created to inventory.empty slots since they will always be getting filled in
                inventory.items.remove(droppable_items[0])
                droppable_items.pop(0)

                print('attempting to take all items with space ...')
                pydirectinput.press(
                    c.space, interval=.05
                )  # need to use pydirectinput.press for 'space' key
                pydirectinput.press(
                    c.space, interval=.05
                )  # repeat command in case doesn't work (don't remove!)
                time.sleep(.3)
                pydirectinput.press(
                    c.enter, interval=.05)  # close inventory full notification
                pydirectinput.press(
                    c.enter, interval=.05
                )  # repeat command in case doesn't work (don't remove!)
                time.sleep(.3)

                sfr.decrypt_save_info('persist.map.json')
                f = open(Path(f'{sfr.save_editor_path()}/persist.map.json'))
                map_info = json.load(f)['base_root']
                f.close()
                areas = map_info['map']['static_dynamic']['areas']
                area_tile = areas[area_name]['tiles'][f'tile{tile_number}']

    c.write(c.b, 2)  # important, make sure inventory is no longer selected
    time.sleep(.3)
    print('Looting Complete!')
Пример #14
0
def on_release(key):
    all_key.append(str(key))
    # print(all_key)
    delaytime = 0.02
    if "'w'" in all_key:
        # print("開場技能")
        pydirectinput.press('`')
        time.sleep(delaytime)
        pydirectinput.press('5')
        time.sleep(delaytime)
        pydirectinput.press('h')
        time.sleep(delaytime)        
        pydirectinput.press('2')
        time.sleep(delaytime)
        pydirectinput.press('r')
        time.sleep(delaytime)
        pydirectinput.press('3')
        time.sleep(delaytime)
        pydirectinput.press('r')
        time.sleep(delaytime)
        pydirectinput.press('1')
        time.sleep(delaytime)
        pydirectinput.keyDown('ctrl')
        pydirectinput.press('g')
        time.sleep(delaytime)
        pydirectinput.press('t')   
        pydirectinput.keyUp('ctrl')
        time.sleep(delaytime)                       
        all_key.clear()
        return False
    if "'e'" in all_key:
      # print("攻擊技能組")
        pydirectinput.press('`')
        time.sleep(delaytime)
        pydirectinput.press('8')
        time.sleep(delaytime)
        pydirectinput.press('r')
        time.sleep(delaytime)
        pydirectinput.press('7')
        time.sleep(delaytime)
        pydirectinput.press('r')
        time.sleep(delaytime)
        pydirectinput.press('6')
        time.sleep(delaytime)
        pydirectinput.press('r')
        time.sleep(delaytime)     
        pydirectinput.press('4')
        time.sleep(delaytime)
        pydirectinput.press('r')
        time.sleep(delaytime)               
        all_key.clear()
        return False

    # if "'q'" in all_key:
    #     print("快速離場")
    #     all_key.clear()

    if 'Key.caps_lock' in all_key:
        print("中斷程式")
        os._exit()
    try:
        if all_key[-1] == 'Key.ctrl_l':
            time1 = time.time()
            while True:
                if time.time() - time1 >= 1:
                    all_key.clear()
                    break
    except:
        pass
Пример #15
0
with pyautogui.hold('alt'):
    pyautogui.press('f')
pyautogui.press('enter')
pyautogui.press('enter')

time.sleep(25)

# load demo
pyautogui.moveTo(950, 763)
pyautogui.click()
pyautogui.write(f'''exec {args.config}\n''')

time.sleep(40)

# run post load configs
pydirectinput.press('`')
pyautogui.write(f'''exec {match_prefix}_post_load_{team_number}\n''')

time.sleep(3)
pyautogui.click()
pyautogui.write(f'''mirv_streams previewEnd\n''')
time.sleep(1.5)
pyautogui.write(f'''demo_timescale 1\n''')
time.sleep(1.5)
pyautogui.write(f'''demo_resume\n''')
time.sleep(1.5)

pydirectinput.press('`')

# process data
tick_image = Image.open(args.tick_image)
Пример #16
0
def autoqq():
    img_pos = pyautogui.locateOnScreen('BAR-fullhp.png', confidence=0.2)
    if img_pos is not None:
        pyautogui.click(img_pos)
        pydirectinput.press('q')
        print('\a')

    say = say + 1

    cikti = cv2.line(img, (soltara, 50), (sagtara, 50), (255, 255, 255), 1)
    orta = int((soltara + sagtara) / 2)
    #sure = int((64 - orta) / 100)
    #if sure < 0:
    #    sure = sure * -1

    if say > 100:
        if soltara < 5 or sagtara > 123:
            print("x")
        else:
            if orta < 60:
                pdi.press("a")
            elif orta > 68:
                pdi.press("d")

    # Display the resulting frame
    cikti = cv2.resize(cikti, (512, 512))
    cv2.imshow('wow', cikti)
    #cv2.imshow('wow2',araba)

    if sagtara == 128:
        sagtara = 64

    if soltara == 0:
        soltara = 64

    if cv2.waitKey(1) & 0xFF == ord('q'):
Пример #18
0
def save_every_image(image):
    cv.imwrite("./debug/"+str(time.time())+".jpg",image)


gather_amount = 0

while(True):
    # get an updated image of the game
    #screenshot = pyag.screenshot("screennow.png")
    #cap("screennow.png")

    #screenshot = cv.imread("screennow.png")

    if(gather_amount == -1):
        pydi.press("2")

    screenshot = pyag.screenshot()
    screenshot = np.array(screenshot)
    screenshot = cv.cvtColor(screenshot, cv.COLOR_RGB2BGR)

    screenshot = cv.resize(screenshot, (screenshot.shape[1]//2, screenshot.shape[0]//2))

    threading.Thread(target=save_every_image, args=(screenshot,)).start()

    rectangles = cascade.detectMultiScale(screenshot, 1.1)

    show_rectangles(screenshot, rectangles)

    click_points = get_click_points(rectangles)
Пример #19
0
 def pressActionDirect(self, key):
     print( "----------> PRESSING " + key )
     pydirectinput.press( key )
Пример #20
0
def gather():
    print("Going to gather")
    time.sleep(4)
    loop_amount = 3
    collected = False
    for i in range(loop_amount):
        if(collected):
            break
        res = pyag.locateOnScreen("./needles/gather.png", confidence=0.5)
        if(res):
            print("Gathering")
            pydi.press("r")
            pydi.press("r")
            pydi.press("r")
            for j in range(5):
                if(pyag.locateOnScreen("./needles/getall.png", confidence=0.75)):
                    print("Collecting")
                    pydi.press("r")
                    pydi.press("r")
                    pydi.press("r")
                    collected = True
                    break;
Пример #21
0
def sendInput(input):
    inputCharacter = input.lower()
    if inputCharacter == "start":
        pydirectinput.press('enter')
    if inputCharacter == "select":
        pydirectinput.press('shiftright')
    if inputCharacter == 'f1':  # RetroArch Menu button
        pydirectinput.press('f1')
    if inputCharacter == 'up':
        pydirectinput.press('w')
    if inputCharacter == 'left':
        pydirectinput.press('a')
    if inputCharacter == 'down':
        pydirectinput.press('s')
    if inputCharacter == 'right':
        pydirectinput.press('d')

    if inputCharacter == 'a':  # A button
        pydirectinput.press('6')
    if inputCharacter == 'b':  # B button
        pydirectinput.press('2')
    if inputCharacter == 'x':  # X button
        pydirectinput.press('8')
    if inputCharacter == 'y':  # Y button
        pydirectinput.press('4')

    if inputCharacter == 'l1':  # L1 button
        pydirectinput.press('7')
    if inputCharacter == 'r1':  # R1 button
        pydirectinput.press('9')
    if inputCharacter == 'l2':  # L2 button
        pydirectinput.press('o')
    if inputCharacter == 'r2':  # R2 button
        pydirectinput.press('p')
    if inputCharacter == 'l3':  # L3 button
        pydirectinput.press('k')
    if inputCharacter == 'r3':  # R3 button
        pydirectinput.press('l')

    if inputCharacter == 'anu':  # Analog Up button
        pydirectinput.press('b')
    if inputCharacter == 'and':  # Analog Down button
        pydirectinput.press('n')
    if inputCharacter == 'anl':  # Analog Left button
        pydirectinput.press('m')
    if inputCharacter == 'anr':  # Analog Right button
        pydirectinput.press(',')
Пример #22
0
# Open A Chrome
auto.leftClick(464, 1059)
sleep(1)

# Open A New Tab
auto.keyDown('ctrl')
auto.typewrite('n')
auto.keyUp('ctrl')

# Go To The Site
auto.write('https')
auto.keyDown('shift')
auto.write(';')
auto.keyUp('shift')
auto.write('//dailyhealth.rit.edu/')
auto.press('enter')
sleep(1)

# Enter Site
auto.leftClick(296, 438)
sleep(1)

# Click No
auto.leftClick(991, 632)
sleep(1)

# Close Site
auto.keyDown('ctrl')
auto.typewrite('w')
auto.keyUp('ctrl')
Пример #23
0
def healAndUp():
    for i in range(0, 3):
        #use health potion
        pydirectinput.press("1")
        #pick up item
        pydirectinput.press("`")
Пример #24
0
def repeat_input_x(inp, x):
    for i in range(0, x):
        pydirectinput.press(inp)
#first get the bounding box
topLeft = getBoundingBox()

print("you have 5 seconds before calibration starts")
time.sleep(5)

# Aim Down Sight and wait a sec for it to aim
pdi.keyDown('end')
time.sleep(1)

#Fire first shot
pdi.click()

time.sleep(1)
#one press to the right
for i in range(1):
    pdi.press('right')

time.sleep(1)
#second shot
pdi.click()

time.sleep(1)
#aim up
pdi.keyUp('end')

time.sleep(1)
#save a screenshot
pyautogui.screenshot('calibration.png',
                     region=(topLeft[0], topLeft[1], 640, 400))
Пример #26
0
async def take_screenshot():
    await asyncio.sleep(5)
    pydirectinput.press('f')
    pydirectinput.press('tab')
    pydirectinput.press('tab')
    pydirectinput.press('tab')
    pydirectinput.press('enter')
    pydirectinput.press('tab')
    pydirectinput.press('enter')
Пример #27
0
    "[21:25:53] [Async Chat Thread - #8/INFO]: <ehawk08> 1412 79 -418",
    "[21:25:54] [Async Chat Thread - #8/INFO]: <IonImpulse> 1391 73 -385",
    "[21:25:55] [Async Chat Thread - #8/INFO]: <Fozzy623> 1351,83, -401",
    "[21:26:11] [Async Chat Thread - #8/INFO]: <DMR_Rocks> 1385 73 -365",
    "[21:26:12] [Async Chat Thread - #8/INFO]: <arimeffie> 1399 73 -410",
    "[21:26:12] [Async Chat Thread - #8/INFO]: <ColonelJJHawkins> 1420 72 -402",
    "[21:26:36] [Async Chat Thread - #8/INFO]: <arimeffie> 1373 73 -411",
    "[21:26:49] [Async Chat Thread - #8/INFO]: <ehawk08> 1423 78 -407",
    "[21:27:02] [Async Chat Thread - #8/INFO]: <arimeffie> 1369 73 -419",
    "[21:27:24] [Async Chat Thread - #8/INFO]: <arimeffie> 1374 77 -417",
    "[21:27:34] [Async Chat Thread - #8/INFO]: <ehawk08> 1411 74 -390"
]
loot_table = ["end_city_treasure", "woodland_mansion", "spawn_bonus_chest"]

time.sleep(5)
for index, msg in enumerate(locations):
    temp = msg.replace("", "").replace(",", "").replace(".", "")
    temp = temp.split("> ")[1]

    coords = temp.split(" ")

    loot = loot_table[random.randint(0, len(loot_table) - 1)]

    print(coords, loot)

    output = "/setblock {} {} {} ".format(coords[0], coords[1], coords[2])
    output += "minecraft:chest{LootTable:\"minecraft:chests/" + loot + "\"}"
    pydirectinput.press('t')
    typewrite(output)
    pydirectinput.press('enter')
Пример #28
0
	def press_key(self, key):
		pydirectinput.press(key)
		time.sleep(self.get_random_delay())
Пример #29
0
Файл: tft.py Проект: yvanat/PE
def specific_routine(data, stage, substage):
    if data.check:
        data.check = False
        if substage == "./captures/stage/1-4.png":
            sell(data.board_pos[3], data)
            buy(data)
            arrange_board(data)
            if count_champ(data) < 2:
                auto.moveTo(data.shop_pos[0], duration=random.uniform(t1, t2))
                click_left()
                time.sleep(tping)
                drag_to(data.bench_pos[0], data.board_pos[21])
                auto.moveTo(data.shop_pos[1], duration=random.uniform(t1, t2))
                click_left()
                time.sleep(tping)
                drag_to(data.bench_pos[0], data.board_pos[22])
        elif substage == "./captures/stage/2-1.png":
            sell_loot(data)
            sell(data.board_pos[21], data)
            sell(data.board_pos[22], data)
            buy(data)
            arrange_board(data)
            if count_champ(data) < 3:
                auto.moveTo(data.shop_pos[0], duration=random.uniform(t1, t2))
                click_left()
                time.sleep(tping)
                drag_to(data.bench_pos[0], data.board_pos[21])
                auto.moveTo(data.shop_pos[1], duration=random.uniform(t1, t2))
                click_left()
                time.sleep(tping)
                drag_to(data.bench_pos[0], data.board_pos[22])
                auto.moveTo(data.shop_pos[2], duration=random.uniform(t1, t2))
                click_left()
                time.sleep(tping)
                drag_to(data.bench_pos[0], data.board_pos[23])
                sell_loot(data)
        elif substage == "./captures/stage/2-2.png":
            sell_loot(data)
            sell(data.board_pos[21], data)
            sell(data.board_pos[22], data)
            sell(data.board_pos[23], data)
            buy(data)
            arrange_board(data)
        elif substage == "./captures/stage/3-1.png" or substage == "./captures/stage/3-2.png":
            while not onscreen("./captures/notime.png") and not onscreenarea(
                    "./captures/no_interest_3.png", data.interest_pos[2][0],
                    data.interest_pos[2][1], data.interest_pos[2][2],
                    data.interest_pos[2][3]):
                buy(data)
                direct.press("d")
            buy(data)
            arrange_board(data)
        elif data.stages.index(
                stage
        ) > 1 and not "./captures/tristana3.png" in data.board_champ and not "./captures/diana3.png" in data.board_champ:
            while not onscreenarea(
                    "./captures/no_interest_5.png", data.interest_pos[4][0],
                    data.interest_pos[4][1], data.interest_pos[4][2],
                    data.interest_pos[4][3]):
                buy(data)
                direct.press("d")
            buy(data)
            arrange_board(data)
        elif data.level < 6 and "./captures/tristana3.png" in data.board_champ and "./captures/diana3.png" in data.board_champ:
            count = 0
            while data.level < 6 and count < 20:
                count += 1
                direct.press("f")
                data.level = data.levels.index(
                    msearcharea(data.levels,
                                data.lvl_pos[0],
                                data.lvl_pos[1],
                                data.lvl_pos[2],
                                data.lvl_pos[3],
                                precision=prec)) + 2
            arrange_board(data)
Пример #30
0
def refuel(amount: int, tritium_placement: int) -> None:
    '''
    input -> int containing amount of tritium to refuel
    output -> terminal text and keyboard strokes
    desc -> uses keyboard inputs to simulate taking
    '''
    # go into right panel
    pydirectinput.press("4")
    time.sleep(1)

    # go to inventory tab
    print("going to inventory tab")
    for i in range(4):
        pydirectinput.press("e")
    time.sleep(1)

    # go into transfer tab
    print("going to transfer tab")
    time.sleep(1)
    pydirectinput.press("d")
    pydirectinput.press("d")
    pydirectinput.press("d")
    pydirectinput.press("d")
    time.sleep(1)
    pydirectinput.press("space")
    pydirectinput.press("w")

    # select tritium as comodity
    for j in range(50):
        time.sleep(0.25)
        pydirectinput.press("s")
    print("selecting tritium as commodity")

    for z in range(tritium_placement):
        pydirectinput.press("w")
    # transfer tritium to cargo hold

    print("transferring tritium used by last jump")
    for k in range(amount):
        time.sleep(0.025)
        pydirectinput.press("a")
    # accept transfer
    print("accepting transfer")

    pydirectinput.press("s")
    pydirectinput.press("s")
    pydirectinput.press("d")
    pydirectinput.press("space")

    # backout of inventory
    print("backing out of inventory")
    pydirectinput.press("backspace")

    # go to main right panel screen
    for p in range(4):
        pydirectinput.press("q")
        time.sleep(1)
    # selects FC panel for future jumps

    print("resseting FC panel for future jumps")
    time.sleep(2)
    pydirectinput.press("w")
    time.sleep(0.025)
    pydirectinput.press("w")
    time.sleep(0.025)
    pydirectinput.press("w")
    time.sleep(0.025)
    pydirectinput.press("w")
    time.sleep(0.025)
    pydirectinput.press("w")
    time.sleep(0.025)
    pydirectinput.press("w")
    time.sleep(1)
    pydirectinput.press("a")
    time.sleep(0.025)
    pydirectinput.press("a")
    time.sleep(0.025)
    pydirectinput.press("a")
    time.sleep(0.025)
    pydirectinput.press("a")
    time.sleep(1)
    pydirectinput.press("s")
    time.sleep(0.025)
    pydirectinput.press("d")
    time.sleep(1)

    # backout
    print("backing out")
    pydirectinput.press("backspace")

    # got to carrier managment
    print("going to carrier management")
    pydirectinput.press("s")
    pydirectinput.press("s")
    pydirectinput.press("w")
    pydirectinput.press("space")
    # going to tritium depot and selecting
    print("going to tritium depot and selecting")
    pydirectinput.press("s")
    pydirectinput.press("s")
    pydirectinput.press("space")
    pydirectinput.press("space")
    pydirectinput.press("w")
    # dropping off tritium used in depot
    print("dropping off tritium in tritium depot")
    for tritium in range(amount):
        pydirectinput.press("d")
        # confirm drop off
        print("confirming drop-off")
    pydirectinput.press("space")
    # full backout
    print("fully backing out")
    pydirectinput.press("backspace")
    pydirectinput.press("backspace")
    pydirectinput.press("backspace")