Пример #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)
Пример #2
0
def waitOnWorldSave():
    if inJournal('The world will save in 10 seconds.') and not inJournal('World save complete.'):
        #Print('Waiting out world save!')

        while inJournal('The world will save in 10 seconds.') and not inJournal('World save complete.'):
            stealth.Wait(1000)
    stealth.Wait(1000)
Пример #3
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
Пример #4
0
def waitforgump( gumpid, milliseconds ):
    while milliseconds:
        if gumpexists( gumpid ):
            return True
        waitTime = 100 if milliseconds >= 100 else milliseconds
        stealth.Wait( waitTime )
    return False
Пример #5
0
def speechHandler(text, sendername, senderid):
    if senderid != stealth.Self(
    ) and senderid != 'System' and stealth.GetDistance(senderid) < 4:
        stealth.AddToSystemJournal('{}: {}'.format(sendername, text))
        response = cb1.ask(text)
        #See header comment for wait algorithm details
        stealth.Wait(60000 * len(response) / random.randint(300, 350))
        stealth.UOSay(response)
Пример #6
0
def cuttingForResources():
    for cuttable in findTypes( cutlist, ['0xFFFF'], stealth.Backpack() ):

        #Use a pair of scissors on anything you've found,
        #I don't know if this also checks the ground...
        scissors = findTypes('0x0F9F','0x0',resourceContainer)
        if scissors:
            stealth.UseObject(scissors[0])
            stealth.WaitForTarget(5000)
            stealth.TargetToObject(cuttable)
            stealth.Wait(750)
        else:
            Print('Someone stole the scissors, mayne. Gotta put some more in the resource container!')
            stealth.exit()
Пример #7
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)
Пример #8
0
                                                 stealth.Backpack(), 0, 0, 0)
                            else:
                                stealth.MoveItem(pile, amountGrabbable,
                                                 stealth.Backpack(), 0, 0, 0)

                            stealth.Wait(750)
    stealth.SetFindDistance(findDistance)


try:
    stealth.AddToSystemJournal('Starting AutoMiner Script!')

    # If you're mounted, unmount
    if Mounted():
        stealth.UseObject(stealth.Self())
        stealth.Wait(750)

    # Main Loop
    while not stealth.Dead():

        #Used for sysjournal output
        currentbook = 0

        #Used for statistics keeping:
        runtimestamp = time.time()

        for runebook in miningBooks:

            #Used for sysjournal output
            currentbook += 1
Пример #9
0
def speechHandler( text, sendername, senderid ):
    #if it wasn't a system message or something you said, and they're in range,
    if sendername not in ['System',''] and senderid != stealth.Self() and stealth.GetDistance(senderid) < 4:

        #Lets let it take at least half a second to respond!
        stealth.Wait( 500 )

        #We're going to update our timestamp so that it uses this as the last time the
        #bot has "responded" or been used.
        lastafkmessagetimestamp = time.time()

        #If it's one of our poker options:
        if text.lower() == 'hit':

            #Add them to the stats collection if they're not already there,
            if not senderid in blackjackStats:
                blackjackStats[senderid] = blackjackStatistics(senderid)

            #Start a new game if necessary,
            #(After checking if they have enough gold)
            if not blackjackStats[senderid].currentHand:

                #Check if they have enough money to play their wager amount,
                if blackjackStats[senderid].betamount > blackjackStats[senderid].earnings:
                    stealth.UOSayColor("You do not have enough gold to wager {:,}gp! Change your wager amount or add funds".format(blackjackStats[senderid].betamount),__msgcolor__)
                    return

                blackjackStats[senderid].currentHand = pokerGame(senderid)
                blackjackStats[senderid].currentHand.blackjackCheck()
            else:
                blackjackStats[senderid].currentHand.hit()

        elif text.lower() == 'stand':

            #Add them to the stats collection if they're not already there,
            if not senderid in blackjackStats:
                blackjackStats[senderid] = blackjackStatistics(senderid)

            if blackjackStats[senderid].currentHand:
                blackjackStats[senderid].currentHand.stand()

            #Tell them they need to say hit to start a new game
            else:
                stealth.UOSayColor("You must start a game first by saying 'hit' before standing!",__msgcolor__)

        elif text.lower() == 'hand':

            #Add them to the stats collection if they're not already there,
            if not senderid in blackjackStats:
                blackjackStats[senderid] = blackjackStatistics(senderid)
            if blackjackStats[senderid].currentHand:
                blackjackStats[senderid].currentHand.hand()
            else:
                stealth.UOSay("You need to play to have a hand!")

        elif text.lower() == 'help':
            stealth.UOSayColor("Available commands: hit, stand, hand, bet, rules, earnings, scores, about, and help",__msgcolor__)

        elif text.lower() == 'rules':
            stealth.UOSayColor("The payout is 5:6, dealer stands on soft 17, and there are {} decks!".format(__decks__),__msgcolor__)

        elif text.lower() == 'about':
            stealth.UOSayColor("I am Blackjack v{} by Vlek! I am a player-made goldsink written in UOSteam!".format(__version__),__msgcolor__)

        elif text.lower() == 'scores':
            if senderid in blackjackStats:
                #Wins: 38 (45.2%); Losses: 46 (54.8%); Blackjacks: 3; Total: 84 (+10 ties)
                totalPlays = float(blackjackStats[senderid].wins+blackjackStats[senderid].losses+blackjackStats[senderid].ties)
                stealth.UOSayColor("{} - Wins: {} ({:.1f}%), Losses: {} ({:.1f}%), Ties: {} ({:.1f}%)".format(stealth.GetName(senderid).title(),
                                                                                                      blackjackStats[senderid].wins,
                                                                                                      blackjackStats[senderid].wins/totalPlays*100,
                                                                                                      blackjackStats[senderid].losses,
                                                                                                      blackjackStats[senderid].losses/totalPlays*100,
                                                                                                      blackjackStats[senderid].ties,
                                                                                                      blackjackStats[senderid].ties/totalPlays*100),__msgcolor__)
            else:
                stealth.UOSayColor("You must play first to have scores!",__msgcolor__)

        elif text.lower() == 'bet':
            if not senderid in blackjackStats:
                blackjackStats[senderid] = blackjackStatistics(senderid)
            stealth.UOSayColor("Your current wager amount is {:,}gp per hand.".format(blackjackStats[senderid].betamount),__msgcolor__)

        #If it looks like it could be a wage change
        elif 'bet' in text.lower() and text.lower().index('bet') == 0:
            possibleBet = text.lower().split(' ')
            if len(possibleBet) == 2 and possibleBet[1].isalnum():

                if not senderid in blackjackStats:
                    blackjackStats[senderid] = blackjackStatistics(senderid)

                #Disallow changing bet when the player has a hand,
                if blackjackStats[senderid].currentHand:
                    stealth.UOSayColor("Sorry, no changing bets during a hand",__msgcolor__)
                    return

                if int(possibleBet[1]) > __maxbet__:
                    stealth.UOSayColor("I'm sorry, I do not allow betting over {}gp per hand!".format(__maxbet__),__msgcolor__)
                    return

                #The player can return their betting to zero for free gameplay,
                #but that doesn't mean there's not a minimum amount of gold per hand.
                if int(possibleBet[1]) != 0 and int(possibleBet[1]) < __minbet__:
                    stealth.UOSayColor("I'm sorry, I do not allow betting under {}gp per hand!".format(__minbet__),__msgcolor__)
                    return

                blackjackStats[senderid].betamount = int(possibleBet[1])
                stealth.UOSayColor("You've changed your wager amount to {:,}gp per hand".format(blackjackStats[senderid].betamount),__msgcolor__)
            else:
                stealth.UOSayColor('''To change your amount wagered, say "bet (amount)"''',__msgcolor__)

        elif text.lower() == 'earnings':
            if not senderid in blackjackStats:
                blackjackStats[senderid] = blackjackStatistics(senderid)
            stealth.UOSayColor('Your current balance is {:,}gp!'.format(int(blackjackStats[senderid].earnings)),__msgcolor__)

        elif text.lower() == '*aaahh!*':
            stealth.UOSayColor('[e scream',__msgcolor__)

        elif text.lower() == '*farts*':
            stealth.UOSayColor(random.choice(['[e giggle','[e sniff','[e puke','[e fart','[e groan']), __msgcolor__)

        #Owner commands
        elif senderid in [0xebe9e]: #Orlok

            if 'earnings' in text.lower() and text.lower().index('earnings') == 0:
                if not senderid in blackjackStats:
                    blackjackStats[senderid] = blackjackStatistics(senderid)

                possibleEarnings = text.lower().split(' ')

                if len(possibleEarnings) == 2 and possibleEarnings[1].isalnum():
                    blackjackStats[senderid].earnings = int(possibleEarnings[1])
                    stealth.UOSayColor('Your total earnings amount is now {:,}gp.'.format(int(possibleEarnings[1])),__msgcolor__)
Пример #10
0
    while True:

        #Since there is no event for trade windows,
        #We're going to have to deal with them within the loop
        try:
            while stealth.IsTrade():
                if not acceptedTrade:
                    stealth.UOSayColor('All gold given to me goes toward your betting pile!',__msgcolor__)
                    acceptedTrade = True
                    tradeTimestamp = time.time()

                #If they've accepted the trade and we haven't,
                if stealth.TradeCheck(0,2) and not stealth.TradeCheck(0,1):
                    stealth.ConfirmTrade(0)

                stealth.Wait(500)

                #if it's been longer than 15 seconds,
                if time.time() - tradeTimestamp > 15:
                    stealth.UseSkill('hiding')
                    stealth.Wait(750)
                    stealth.UOSayColor('Sorry, you took too long to accept the trade!',__msgcolor__)
                    acceptedTrade = False
        finally:
            acceptedTrade = False

        stealth.Wait(500)

        #We don't want to always respond exact after a minute. Should be some randomness in there.
        if time.time() - lastafkmessagetimestamp > 60 and random.random() > 0.50:
            stealth.UOSayColor(random.choice(['[e sigh','[e yawn','[e groan','*Shuffles Cards*',
Пример #11
0
    #             {_name: {"name": _name.title(), "type": "", "type_id": _type}}
    #         )

    # with open("../assets/metadata/equipments.json", "r", encoding="utf-8") as fpointer:
    #     _old_equipments = json.load(fpointer)

    # _old_equipments.update(_equipments)

    # with open("../assets/metadata/equipments.json", "w+", encoding="utf-8") as fpointer:
    #     json.dump(_old_equipments, fpointer)


stealth.ClientRequestObjectTarget()

while not stealth.ClientTargetResponsePresent():
    stealth.Wait(1)

items = find_item_types(stealth.ClientTargetResponse())

equipments = {}

for item in items:
    tmp = Item(hex(item))
    equipments.update({
        tmp.name.casefold().replace(" ", "_"): {
            "name": tmp.name,
            "type": "weapon",
            "type_id": tmp.type_id,
        }
    })
Пример #12
0
import stealth

stealth.AddToSystemJournal('Now Training: Hiding')

while stealth.GetSkillValue('Hiding') < 100.0:
    stealth.UseSkill('Hiding')
    stealth.Wait(10250)

stealth.AddToSystemJournal('Finished Training: Hiding')
Disconnect()
Пример #13
0
import stealth, re

# TODO: Create a dictionary of mobile id's to save player information to
#   Only send an API request to the node webserver if it has been a
#   considerable (more than five minutes) since that person was last seen

# TODO: Figure out some way of capturing guild information. If it's not
#   given with CharName (probs not)
#   I mean, it's really not normal for someone to type with brackets
#   and also have a comma inbetween. In fact, I highly doubt anyone
#   will ever do it.

# TODO: Figure out the issue with the script randomly not working after a while


def speechHandler(text, sendername, senderid):
    # TODO: Fix this so that it's able to handle unicode
    #   Before, it couldn't handle spaces and stuff. Not good.
    if senderid != stealth.Self() and sendername not in ['System', '']:
        stealth.AddToSystemJournal(u'{}: {}'.format(sendername, text))


stealth.SetEventProc('evSpeech', speechHandler)

print('Listening to ingame speech')
while True:
    stealth.Wait(100)
Пример #14
0
                if 'All items must be exceptional.' in bodstips:
                    self.quality = 'exceptional'
                else:
                    self.quality = 'regular'


while True:
    acceptedBods = []
    rejectedBods = []
    timestamp = time.time()
    nextBODRun = timestamp + 10865  #start time plus three hours and one minute in seconds
    for character in profiles:
        stealth.ChangeProfile(character)
        stealth.Wait(
            3000
        )  #This is to ensure the last character is able to completely log out.
        stealth.Connect()
        stealth.Wait(250)

        # Walk to the blacksmiths
        for waypoint in waypoints[1:]:
            stealth.NewMoveXY(waypoint[0], waypoint[1], 0, 0, True)

        # Check blacksmiths for one close enough that you can request a BOD from
        for vendor in vendors:
            vendorID = int(vendor, 16)

            stealth.RequestContextMenu(vendorID)
            stealth.Wait(1500)