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)
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 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()
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)
currentbook += 1 #Stats keeping: booktimestamp = time.time() for slot in runebookslots: try: waitOnWorldSave() stealth.UOSayColor('Bank', 54) stealth.Wait(750) # For each ore pile in your backpack, for ore in findTypes(oretypes, orecolors, [stealth.Backpack()]): # Move them to the bank ### There should probably be a check or a while loop here to make sure it makes it into the bank stealth.MoveItem( ore, stealth.GetQuantity(ore), stealth.ObjAtLayer(stealth.BankLayer()), 0, 0, 0) stealth.Wait(750) # While we don't have enough mana to go there and back, wait while stealth.Mana() < 22: stealth.Wait(250) if not inJournal('enter a meditative trance'): stealth.UseSkill('Meditation') #Might want to check lag here to inform the pauses. (No lag: 750, lag: 750 + lagoffset) stealth.Wait(1000)
def backpack(self) -> int: logging.info(f"Getting backpack id") self._backpack = stealth.Backpack() return self._backpack
#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() #If the tailoring gump is open, if gumpexists(0x38920abd): currentSkill = calcbonus( stealth.GetSkillValue('Tailoring'), stealth.Str(), stealth.Dex(), stealth.Int() ) #If we either don't have resources or are overweight, if countTypes(resource,['0x0'],[stealth.Backpack()]) < 20: