Exemple #1
0
def gen_grindhouse():
    # The generated macro assumes you are on the Buy screen, Tier 3 is already selected, and an item is
    # highlighted.
    print()
    items_to_buy = nox.prompt_user_for_int(
        "How many items should be purchased each cycle?\n"
        "If you don't have at least this much inventory space the macro will de-sync.\n"
        "Number of items to purchase: ")

    print()
    buy_delay = nox.prompt_user_for_int(
        "Enter the number of milliseconds between each click while purchasing\n"
        "items.  A lower number will make the macro run faster, but could cause\n"
        "the macro to get out of sync on slower machines.  If the macro doesn't\n"
        "register clicks properly while buying items, run the generator again\n"
        "and choose a higher number until you find what works.\n\n"
        "Milliseconds (Default=325): ",
        default=325)

    confirm(
        properties={
            'Items to buy': items_to_buy,
            'Delay': buy_delay
        },
        start_condition=
        'The macro should be started from the forge shop, with an item selected.'
    )

    # Buy 300 items
    for i in range(0, items_to_buy):
        nox.click_button('buy', buy_delay)
        nox.click_button('buy_confirm', buy_delay)

    # Exit twice (to Orvel map)
    nox.click_button('exit', 1500)
    nox.click_button('exit', 1500)

    # Open inventory
    nox.click_button('inventory', 1500)

    grind_or_sell_all(True)

    # Exit back to Orvel world map
    nox.click_button('exit', 1500)

    # Re-enter the shop.  Delay set to 2500 here since there's an animated transition
    # that takes a little extra time
    nox.click_button('enter_node', 5000)

    # Click Use Shop button
    nox.click_button('use_shop', 1500)
Exemple #2
0
def gen_single_upper_dungeon(chapter, transition_duration_alter):

    longest_run_time = nox.prompt_user_for_int(
        "Enter longest run in seconds for {0} or 0 to skip (45-90s suggested for hell): "
        .format(chapter))

    if longest_run_time > 0:
        nox.click_button('portal', 2000 + transition_duration_alter)
        nox.click_button('upper_dungeon', 2000 + transition_duration_alter)
        nox.click_button(chapter, 2000 + transition_duration_alter)
        nox.click_button('move_to_conquest', 6000 +
                         (transition_duration_alter * 2))  # map render delay
        nox.click_button('prepare_battle', 2000 + transition_duration_alter)
        nox.click_button('get_ready_for_battle',
                         2000 + transition_duration_alter)
        nox.click_button('auto_repeat', 2000 + transition_duration_alter)
        nox.click_button(
            'repeat_ok', (longest_run_time * 1000 * 5)
        )  # for now this will be 60s per run or 5 min total.  We can make this smarter later.
        # nox.click_button('insufficient_keys', 2000 + transition_duration_alter) # should click x_out instead
        nox.click_button('x_out', 1000 + transition_duration_alter)
        nox.click_button(
            'x_out', 1000 +
            transition_duration_alter)  # second x_out in case of key reset
        nox.click_button('exit_conquest', 20000 +
                         (transition_duration_alter * 3))  # long render
Exemple #3
0
def gen_raid_leader():
    Common.confirm(
        start_condition=
        'The macro can be started in a raid lobby or while a raid is in progress.'
    )

    start_clicks = nox.prompt_user_for_int(
        'How many repetitive start clicks? (default is 3)', default=3)
    click_duration = nox.prompt_user_for_int(
        'How many milliseconds between clicks? (default is 500)', default=500)

    # click here first to add a long wait and slow the macro down
    nox.click_button('abandon_raid', 2500)

    for i in range(0, start_clicks):
        nox.click_button('start_raid', click_duration)
        nox.click_button('confirm_insufficient_members', click_duration)
Exemple #4
0
def gen_conquest():

    transition_duration_alter = nox.prompt_user_for_int(
        "Main transition times are 2000 milliseconds.  Please enter a positive or negative value in milliseconds if you want this changed or (enter) for no change: "
    )

    gen_single_conquest('ch2_conquest', transition_duration_alter)
    gen_single_conquest('ch3_conquest', transition_duration_alter)
    gen_single_conquest('ch4_conquest', transition_duration_alter)
    gen_single_conquest('ch5_conquest', transition_duration_alter)
    gen_single_conquest('ch6_conquest', transition_duration_alter)
    gen_single_conquest('ch7_conquest', transition_duration_alter)

    Common.confirm(
        start_condition=
        'The macro should be started only when the Portal button is visible')
Exemple #5
0
def gen_upper_dungeon():

    print(
        'All Upper Dungeons should have set levels.  To do this manually, you can start and then stop a battle on the chosen level per dungeon.  This is also a good way to alter which levels/fragments you want to focus on.'
    )

    transition_duration_alter = nox.prompt_user_for_int(
        "Main transition times are 2000 milliseconds.  Please enter a positive or negative value in milliseconds if you want this changed or (enter) for no change: "
    )

    gen_single_upper_dungeon('ch1_upper_dungeon', transition_duration_alter)
    gen_single_upper_dungeon('ch2_upper_dungeon', transition_duration_alter)
    gen_single_upper_dungeon('ch3_upper_dungeon', transition_duration_alter)
    gen_single_upper_dungeon('ch4_upper_dungeon', transition_duration_alter)
    gen_single_upper_dungeon('ch5_upper_dungeon', transition_duration_alter)
    gen_single_upper_dungeon('ch6_upper_dungeon', transition_duration_alter)
    gen_single_upper_dungeon('ch7_upper_dungeon', transition_duration_alter)

    Common.confirm(
        start_condition=
        'The macro should be started only when the Portal button is visible')
Exemple #6
0
def gen_natural_stamina_farm():
    print()
    use_pot = nox.prompt_user_yes_no(
        "Should the macro automatically use a stamina potion when you run out?"
    )

    inventory_management = nox.prompt_user_for_int(
        "Enter the frequency (in minutes) at which to manage inventory.\n"
        "To disable inventory management, press Enter without entering a value: ",
        min=1,
        default=-1)

    inv_management_sync = None
    properties = {'Use Potion': use_pot}

    notes = []
    if inventory_management != -1:
        inv_management_sync = nox.prompt_user_for_int(
            'Enter the maximum amount of time (in whole numbers of minutes) it takes your team\n'
            'to complete a story dungeon.  (Default = 3): ',
            default=3)
        (should_grind, should_sell) = prompt_inventory_management_properties()
        properties['Inventory Management Sync Time'] = '{0} minutes'.format(
            inv_management_sync)
        s = None
        if should_grind and should_sell:
            s = "Sell then grind"
        elif should_grind:
            s = "Grind"
        else:
            s = "Sell"
        properties['Manage Inventory'] = '{0} every {1} minutes'.format(
            s, inventory_management)
        notes = [
            'When the macro is getting ready to transition to the inventory management\n'
            '      phase, it may appear the macro is stuck doing nothing on the victory screen.\n'
            '      This is intentional, and it can take up to {0} minutes before the transition\n'
            '      to the inventory screen happens.'.format(
                inv_management_sync)
        ]
    else:
        properties['Manage Inventory'] = 'Never'

    confirm(properties=properties,
            start_condition=
            'The macro should be started while a battle is in progress.',
            notes=notes)

    def generate_one_click_cycle():
        # No effect during battle or on victory screen, but if we get stuck in Get Ready
        # for Battle screen after inventory management, this starts us again.  Make sure
        # to do this BEFORE the continue button, otherwise the continue button will click
        # one of our heroes and remove them from the lineup.  By putting this click first
        # it guarantees that we either enter the battle, or get the stamina window (in
        # which case the click doesn't go through to the button underneath).
        nox.click_button('start_adventure', 500)

        # Be careful with the x coordinate here so that it clicks in between items in the
        # inventory if your inventory is full.
        nox.click_loc((503, 352),
                      500)  # Continue (game pauses sometimes mid-battle)

        nox.click_loc((1204, 494), 500)  # Retry
        nox.click_loc(
            (572, 467),
            500)  # Single Repeat button.  Careful not to click the button that
        # edits the count of stamina potions to use.
        if use_pot:
            nox.click_loc((759, 558), 500)  # Stamina Potion OK
        else:
            nox.click_loc((940, 190), 500)  # Close stamina pop-up

    if inventory_management == -1:
        # If we don't need to manage inventory, just generate a simple macro that can loop forever.
        generate_one_click_cycle()
    else:
        # If we do need to manage inventory, then first generate enough cycles of the normal story
        # repeat to fill up the entire specified number of minutes.
        nox.repeat_generator_for(generate_one_click_cycle,
                                 inventory_management * 60)

        # Then switch to a mode where we just try to get to the victory screen but not initiate a
        # repeat.  We do this by just clicking the continue button every second for 2 minutes.
        # Hopefully 3 minutes is enough to finish any story level.
        def get_to_victory_screen():
            # Continue (game pauses sometimes mid-battle)
            nox.click_loc((503, 352), 1000)

            # Need to make sure to click below the loot results so they get dismissed properly
            nox.click_loc((503, 500), 1000)

        nox.repeat_generator_for(get_to_victory_screen,
                                 inv_management_sync * 60)

        # At this point the Inventory button on the top left side of the victory should be clickable.
        # so initiate the process of clicking, grinding/selling, and getting back into the battle.
        do_generate_inventory_management_for_adventure(should_grind,
                                                       should_sell)

        # Re-enter the battle from the world map, using a potion if necessary
        re_enter_adventure(use_pot)
Exemple #7
0
    if args.enable_developer_commands:
        macro_generators.extend([
            ("**DEV** Natural Stamina Regen Raid Farming (Non-Leader)",
             gen_raid_experimental),
            ("**DEV** Re-enter adventure (potion)",
             lambda: re_enter_adventure(True)),
            ("**DEV** Re-enter adventure (no potion)",
             lambda: re_enter_adventure(False)),
        ])

    print()
    for (n, (desc, fn)) in enumerate(macro_generators):
        print('{0}) {1}'.format(n + 1, desc))

    macro_number = nox.prompt_user_for_int(
        'Enter the macro you wish to generate: ',
        min=1,
        max=len(macro_generators))

    (macro_name, file_path) = nox.load_macro_file()

    (desc, fn) = macro_generators[macro_number - 1]

    # Generate the macro
    fn()

    # At this point we're back where we started and the macro can loop.
    nox.close()

    print('File {0} successfully written.'.format(file_path))
except SystemExit:
    pass