Exemplo n.º 1
0
def combineOre(combineAll=True):
    """Combines down either to where the player is under weight or until all are combined as specified by combineAll"""
    # Try to put piles together again
    findDistance = stealth.GetFindDistance()
    stealth.SetFindDistance(2)
    for color in orecolors:

        # if have a small pile of the current color,
        if stealth.FindTypesArrayEx(['0x19b7'], [color], [stealth.Backpack()],
                                    False):
            smallPile = stealth.GetFindedList()[0]

            # If you find any larger pile of the ore color,
            if stealth.FindTypesArrayEx(['0x19b9', '0x19ba', '0x19b8'],
                                        [color], [stealth.Backpack()], False):
                largePiles = stealth.GetFindedList()

                # Combine each larger pile with the small pile
                for pile in largePiles:
                    stealth.UseObject(pile)
                    stealth.WaitForTarget(5000)
                    stealth.TargetToObject(smallPile)
                    stealth.Wait(750)

                    # If we can recall after that last combination, break out
                    if not combineAll and stealth.Weight(
                    ) <= stealth.MaxWeight() + 4:
                        break

        # Else, if you find a small on the ground,
        elif stealth.FindTypesArrayEx(['0x19b7'], [color], [stealth.Ground()],
                                      False):
            smallPile = stealth.GetFindedList()[0]

            # If you find any larger pile of the ore color,
            if stealth.FindTypesArrayEx(['0x19b9', '0x19ba', '0x19b8'],
                                        [color], [stealth.Backpack()], False):
                largePiles = stealth.GetFindedList()
                # First, gotta get the small off the ground
                stealth.UseObject(smallPile)
                stealth.WaitForTarget(5000)
                stealth.TargetToObject(largePiles[0])
                stealth.Wait(750)

                # If we can recall after that last combination, break out
                if not combineAll and stealth.Weight(
                ) <= stealth.MaxWeight() + 4:
                    break

                # The first large is now small. Target everything on it.
                for pile in largePiles[1:]:
                    stealth.UseObject(pile)
                    stealth.WaitForTarget(5000)
                    stealth.TargetToObject(largePiles[0])
                    stealth.Wait(750)

                    # If we can recall after that last combination, break out
                    if stealth.Weight() <= stealth.MaxWeight() + 4:
                        break
    stealth.SetFindDistance(findDistance)
Exemplo n.º 2
0
def sluffOre():
    """Remove the least amount of ore necessary to get out"""
    if stealth.Weight() > stealth.MaxWeight() + 4:
        for color in orecolors:
            for oretype in oretypes:
                if stealth.FindTypesArrayEx([oretype], [color],
                                            [stealth.Backpack()], False):

                    # If it's a large pile,
                    if oretype == '0x19b9':
                        weightPerPile = 12

                    # One of the medium piles,
                    elif oretype in ['0x19ba', '0x19b8']:
                        weightPerPile = 7

                    # Else, it's a small
                    else:
                        weightPerPile = 2

                    # Calculate how much you'd have to remove in order to get to a recallable amount
                    sluffAmount = int(
                        math.ceil(
                            (stealth.Weight() - (stealth.MaxWeight() + 4)) /
                            float(weightPerPile)))

                    # Remove as much as needed, up to the whole pile, to get under weight
                    for pile in stealth.GetFindedList():

                        pileQuantity = stealth.GetQuantity(pile)

                        # If the current pile isn't enough,
                        if pileQuantity < sluffAmount:
                            stealth.MoveItem(pile, pileQuantity,
                                             stealth.Ground(),
                                             stealth.GetX(stealth.Self()),
                                             stealth.GetY(stealth.Self()),
                                             stealth.GetZ(stealth.Self()))
                            sluffAmount -= pileQuantity
                            stealth.Wait(750)

                        # Otherwise, you have enough to take care of your plite
                        else:
                            stealth.MoveItem(pile, sluffAmount,
                                             stealth.Ground(),
                                             stealth.GetX(stealth.Self()),
                                             stealth.GetY(stealth.Self()),
                                             stealth.GetZ(stealth.Self()))
                            stealth.Wait(750)
                            break

                if stealth.Weight() <= stealth.MaxWeight() + 4:
                    break

            if stealth.Weight() <= stealth.MaxWeight() + 4:
                break
Exemplo n.º 3
0
def findTypes(types, colors, containers, subcontainerSearch=False):
    """searches the list of containers for the item types of the specified colors"""
    if type(types) != list:
        types = [types]
    if type(colors) != list:
        colors = [colors]
    if type(containers) != list:
        containers = [containers]
    stealth.FindTypesArrayEx(types, colors, containers, subcontainerSearch)
    return stealth.GetFindedList()
Exemplo n.º 4
0
def countTypes(types, colors, containers, subcontainerSearch=False):
    """Returns the total amount of the given items of the specified colors in containers"""
    if type(types) != list:
        types = [types]
    if type(colors) != list:
        colors = [colors]
    if type(containers) != list:
        containers = [containers]
    stealth.FindTypesArrayEx(types, colors, containers, subcontainerSearch)
    return stealth.FindFullQuantity()
Exemplo n.º 5
0
def find_item_types(container):
    _types = list(range(int("0x0", 16), int("0xFFFF", 16) + 1))
    _finded_list = []
    _equipments = {}

    for chunk in chunked_iterable(_types, 255):
        stealth.FindTypesArrayEx(chunk, [0xFFFF], [container.get("ID")], True)
        _finded_list += stealth.GetFindedList()

    return _finded_list
Exemplo n.º 6
0
def pickupOre():
    """Picks up as much ore off the ground within a reachable distance as possible"""
    findDistance = stealth.GetFindDistance()
    stealth.SetFindDistance(2)
    if stealth.Weight() < stealth.MaxWeight() + 4:
        #Gotta pick up the good stuff first!
        for color in reversed(orecolors):
            if stealth.FindTypesArrayEx(
                ['0x19b7', '0x19b9', '0x19ba', '0x19b8'], [color],
                [stealth.Ground()], False):
                groundPiles = stealth.GetFindedList()

                #It might make sense to first sort them by their types in order to best respond to them.

                for pile in groundPiles:
                    freeSpace = (stealth.MaxWeight() + 4) - stealth.Weight()

                    pileType = hex(stealth.GetType(pile))

                    # If it's not a small ore pile and you have a small pile of that color in your backpack,
                    if pileType != '0x19b7' and stealth.FindTypesArrayEx(
                        ['0x19b7'], [stealth.GetColor(pile)],
                        [stealth.Backpack()], False):

                        smallPile = stealth.GetFindedList()[0]

                        pileQuantity = stealth.GetQuantity(pile)

                        # If it's the case that it's a large,
                        if pileType == '0x19b9':
                            # Get the new weight considering you get four small at two stones each
                            newWeight = pileQuantity * 4 * 2

                        # If it's one of the mediums,
                        else:
                            # Get the new weight for conversion to two small at two stones each
                            newWeight = pileQuantity * 2 * 2

                        if newWeight <= freeSpace:
                            stealth.UseObject(pile)
                            stealth.WaitForTarget(5000)
                            stealth.TargetToObject(smallPile)
                            stealth.Wait(750)

                    else:
                        # Lets check how much we can grab off the pile.
                        amountGrabbable = freeSpace / pileWeights[pileType]

                        # If we can pick up any,
                        if amountGrabbable > 0:

                            pileQuantity = stealth.GetQuantity(pile)

                            # If we can grab the entire thing,
                            if amountGrabbable >= pileQuantity:
                                stealth.MoveItem(pile, pileQuantity,
                                                 stealth.Backpack(), 0, 0, 0)
                            else:
                                stealth.MoveItem(pile, amountGrabbable,
                                                 stealth.Backpack(), 0, 0, 0)

                            stealth.Wait(750)
    stealth.SetFindDistance(findDistance)
Exemplo n.º 7
0
                                stealth.GetNotoriety(peep) in scaryNotorieties
                                for peep in findTypes(humanGraphics, 0xFFFF,
                                                      stealth.Ground())
                        ] or stealth.WarTargetID() != 0:
                            Print(
                                'Recalling out because of dangerous activity! Book: {}, rune: {}'
                                .format(runebook, slot))
                            #maybe it's like toggling out of warmode in game where you have to go in and out?
                            stealth.SetWarMode(True)
                            stealth.Wait(50)
                            stealth.SetWarMode(False)
                            break

                        # If you find at least one pickaxe or shovel of regular color in your main backpack (no sub containers)
                        if stealth.FindTypesArrayEx(['0xe86', '0xf39'], [0],
                                                    [stealth.Backpack()],
                                                    False):
                            stealth.UseObject(stealth.GetFindedList()[0])
                            stealth.WaitForTarget(5000)

                            # Turns out, when you can't find the tile, it's tile of type 0. No Z issues yet.
                            stealth.TargetToTile(
                                tile, stealth.GetX(stealth.Self()),
                                stealth.GetY(stealth.Self()) - 1,
                                stealth.GetZ(stealth.Self()))

                        # If you find at least one tinker toolkit of regular color in your backpack (no sub containers)
                        elif stealth.FindTypesArrayEx(['0x1eb8'], [0],
                                                      [stealth.Backpack()],
                                                      False):
                            toolkits = stealth.GetFindedList()