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)
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
def speechHandler(text, sendername, senderid): if senderid != stealth.Self() and sendername not in ['System', '']: stealth.AddToSystemJournal('{}: {}'.format( sendername, re.sub(r'[^\x00-\x7f]', r'?', text))) stealth.Beep()
def Mounted(ObjectID=stealth.Self()): return stealth.ObjAtLayerEx(stealth.HorseLayer(), ObjectID)
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) 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
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__)
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))
#We're only checking cut leather. We can check hides, too. #Just seems stupid to considering the player can only hold like four anyway. resource = '0x1081' #This variable allows us to keep track of which "page" we're on in #The crafting menu. That way we know when this needs changing #Or if we can simply hit the button to craft that item or "make last" makelast = '' #We need to make sure we're kept as out of sight as possible. Hide if not hidden! if not stealth.Hidden(): stealth.UseSkill("Hiding") stealth.Wait(500) if Mounted(): stealth.UseObject( stealth.Self() ) stealth.Wait( 1000 ) stealth.UseObject( stealth.Self() ) stealth.Wait( 1000 ) #This allows those characters that've never really been logged in before #In stealth to get their backpacks open so it can "see" what goodies we have. stealth.UseObject( stealth.Backpack() ) stealth.Wait(1000) #While it's the case we're not GM tailoring, Print('Starting Tailoring Gainer on {}!'.format(stealth.CharName())) while stealth.GetSkillValue('Tailoring') < 100 and not stealth.Dead(): waitOnWorldSave()