def menu(): """ Asks for the excel filename and continuously asks for the next action, allowing the user to search the excel document, run inventory, and change the current documentuntil the user inputs "exit". """ filename, wb = documentCheck.documentCheck() running = True while (running): print("\nWhat would you like to do?") choice = input( "You can choose to: Search; Inventory; Change Document; Exit \n") if (choice.lower() in ("search", "s")): searchMenu.searchMenu(filename, wb) # have to refresh the wb, because we saved the info in the wb in # the inventory method wb = openpyxl.load_workbook(filename) elif (choice.lower() in ("inventory", "i")): inventory.inventory(filename, wb) wb = openpyxl.load_workbook(filename) elif (choice.lower() in ("changedoc", "change document", "document change", "change", "document", "cd", "c", "d")): filename, wb = documentCheck.documentCheck() elif (choice.lower() in ("exit", "e")): running = False else: print("Invalid choice.") print("Have a nice day!")
def ingame_menu(): """The menu that appears after the main menu/the first menu""" # While loop for continous play while True: # Tells user that typing q goes to the main menu print('type q to go back to the main menu') # Asks for user input menu = input('type map/inventory/characters: ') # Makes all the user input into lower case menu = menu.lower() # Checks to see if user typed inventory if menu == 'inventory': # Tells user to type in certain commands to access further menus print('type [weapon], [fishing rod], [heal]') # Runs the inventory function inv.inventory() # Checks to see if user typed location elif menu == 'map': # Runs the location function loc.location() elif menu == 'characters': ch.all_characters() # Checks to see if user typed in q elif menu == 'q': # Goes to main menu break # Checks to see if anything else was typed in else: # Tells user that was an invalid selection print('invalid select again')
def __init__(self, t, x, y, m=None, s=None): super(unit, self).__init__() self.x = x self.y = y self.owner = t if m != None: self.members = args[3] if s != None: self.super = args[4] # Create the instance of the inventory and wallet for the unit self.inventory = inv.inventory() self.inventory.craftsize = 3 self.wallet = economy.wallet() self.prevcoords = (x,y) # Add the members self.members = [] self.members.append([0,0]) # this is the main member (always at 0,0 relative to everyone else) self.members.append([random.randrange(0, self.size-5),random.randrange(0, self.size-5),5,5,random.randrange(1, 10)]) self.members.append([random.randrange(0, self.size-5),random.randrange(0, self.size-5),5,5,random.randrange(1, 10)]) self.members.append([random.randrange(0, self.size-5),random.randrange(0, self.size-5),5,5,random.randrange(1, 10)]) self.members.append([random.randrange(0, self.size-5),random.randrange(0, self.size-5),5,5,random.randrange(1, 10)]) self.members.append([random.randrange(0, self.size-5),random.randrange(0, self.size-5),5,5,random.randrange(1, 10)]) self.members.append([random.randrange(0, self.size-5),random.randrange(0, self.size-5),5,5,random.randrange(1, 10)]) self.foresttimer = 0
def __init__(self, x, y): self.x = x*common.tilewidth self.y = y*common.tilewidth super(oremine, self).__init__() self.inventory = inv.inventory() self.inventory.r = 8 self.inventory.c = 5 self.itemsmade = 0
def __init__(self, x, y): super(merchantshop, self).__init__() self.x = x*common.tilewidth self.y = y*common.tilewidth self.inventory = inv.inventory() self.inventory.r = 8 self.inventory.c = 5 self.woodmade = 0
async def beh_aggressive_bag_cleaning(worker, limits=None): item_limits = limits if limits else level_limit( worker.account_info()["level"]) total = total_iventory_count(worker) if total > 300: worker.log.info( u"Aggressive bag cleaning with {} items in inventory: {}".format( str(total), str(inventory(worker)))) await beh_clean_bag_with_limits(worker, item_limits, aggressive=True)
def __init__(self, x, y): self.x = x*common.tilewidth self.y = y*common.tilewidth super(woodyard, self).__init__() self.inventory = inv.inventory() self.inventory.r = 8 self.inventory.c = 5 self.woodmade = 0 if common.cv.getTileBelow(self.x, self.y) != "forest": self.delete()
def __init__(self, dataManager): self.dataManager = dataManager self.rect = pygame.Rect( self.dataManager.spawnpoint[0] * self.dataManager.block_size_x, self.dataManager.spawnpoint[1] * self.dataManager.block_size_y, 16, 16) self.health = 100 self.maxhealth = 100 self.gold = 0 self.inv = inventory() self.xp = 0 self.level = 0
def __init__(self, hp, gold, name): self.gold = gold self.hp = hp # This is the player's non-static HP. self.name = name self.inv = inventory() self.max_hp = 20 # Max HP will only change on level up self.attack = 5 # Determines your damage, effected by weapons later self.defense = 5 # Reduces damage by 50% of defense (50% is only temporary) self.armor = 0 # Reduces damage by 25% of armor (25% is only temporary) self.speed = 10 # Speed will determine who moves first. Can be negatively effected by weight self.weight = 0 # Weight of armor effects this. self.level = 1 self.xp = 0 # XP,
def main(): while True: print("你可以进行如下操作:") print("c:收银系统 i:库存系统 s:进货系统 t:今日销量 g:修改商品信息 e:退出") op = input("请输入你的选择:") if op == 'c': csr.cashier() # break elif op == 'i': inventory.inventory() # break elif op == 's': stock.stock() # break elif op == 't': selltoday.selltoday() # break elif op == 'g': change.change() elif op == 'e': exit() else: print("操作不正确,请重新输入")
def __init__(self, x, y, w=2, h=2, name=None, pop=5, hct=None): # print hct # hct=None # hct=None self.x = x*common.tilewidth self.y = y*common.tilewidth self.w = w*common.tilewidth self.h = h*common.tilewidth self.housect = 1 self.population = pop super(village, self).__init__() self.inventory = inv.inventory() self.inventory.r = 8 self.inventory.c = 8 self.inventory.hasoven=True self.wallet = economy.wallet() self.wallet.capacity = 250.00 self.inhabitants = [] self.producefarm = 0.0 self.producebarracks = 0.0 self.refinetimer = 0.0 self.orerefinetime = 2.0 # Generate Village Name if not name: self.name = civilization.nameone[random.randrange(0, len(civilization.nameone))]+civilization.nametwo[random.randrange(0, len(civilization.nametwo))] else: self.name = name # Create house locations if hct: self.houseloc = hct self.housect = len(hct) else: for h in xrange(0, self.housect): hx = random.randrange(0, self.w-self.housewidth) hy = random.randrange(0, self.h-self.housewidth) self.houseloc.append([hx, hy, common.cv.buildingtextures[0]])
def main(): #calling the inventory functions from the class inventory1 = inventory("1", "Jacket", "12", "$59.95") print(inventory1) print() #the spacing on this constructor helps shape it when it is printed #storing 4 arguments into the three variables Product1 = product(" 1 ", "Jacket ", " 12 ", " $59.95 ") Product2 = product(" 2 ", "Designer Jeans ", " 40 ", " $34.95 ") Product3 = product(" 3 ", "Shirt ", " 20 ", " $24.95 ") print(" ID: " + " Desription: " + "Quantity: " + "Price: ") print(Product1) print() print(Product2) print() print(Product3)
def main(): status = '' while status != "dead": try: print('What do you want to do?') select = selection(["Battle", "Shop", "Inventory"], 0) if select[1] == 'Battle': print('You go to battle!') status = battle(hero) elif select[1] == 'Shop': print('You go to the shop!') wgi = shop(hero.gold, hero.inventory, hero) hero.gold = wgi[0] hero.inventory = wgi[1] elif select[1] == 'Inventory': wgi = inventory(hero.equipped_weapon, hero.gold, hero.inventory, hero) hero.equipped_weapon = wgi[0] hero.gold = wgi[1] hero.inventory = wgi[2] else: print("Invalid input %r" % select[1]) except: print("Invalid input")
def click(): clicked = pygame.mouse.get_pressed() pos = pygame.mouse.get_pos() a = [] a = chkavail() if clicked[0] is 1: if 284 < pos[0] < 388 and 184 < pos[1] < 241: if a[0] is 1: pressed_atomic() elif 397 < pos[0] < 511 and 251 < pos[1] < 313: if a[1] is 1: pressed_coal() elif 500 < pos[0] < 649 and 184 < pos[1] < 249: if a[2] is 1: pressed_natural1() elif 272 < pos[0] < 392 and 320 < pos[1] < 383: if a[3] is 1: pressed_natural2() elif 580 < pos[0] < 700 and 280 < pos[1] < 340: if a[4] is 1: pressed_solar1() elif 436 < pos[0] < 573 and 367 < pos[1] < 426: if a[5] is 1: pressed_solar2() elif 781 < pos[0] < 907 and 266 < pos[1] < 343: if a[6] is 1: pressed_wind1() elif 480 < pos[0] < 620 and 480 < pos[1] < 550: if a[7] is 1: pressed_wind2() elif 644 < pos[0] < 760 and 375 < pos[1] < 440: if a[8] is 1: pressed_hydro1() elif 74 < pos[0] < 190 and 137 < pos[1] < 200: if a[9] is 1: pressed_hydro2() elif 410 < pos[0] < 526 and 88 < pos[1] < 156: if a[10] is 1: pressed_geothermal1() elif 144 < pos[0] < 260 and 249 < pos[1] < 313: if a[11] is 1: pressed_geothermal2() elif 24 < pos[0] < 76 and 17 < pos[1] < 50: resume() elif 900 < pos[0] < 940 and 10 < pos[1] < 50: inventory()
def getStandContents(self): self.inventory=inventory.inventory() self.pitcher=pitcher.pitcher() self.recipie=recipie.recipie()
def __init__(self, name, hp): self.name = name self.hp = hp self.inv = inventory()
def test_get_item(self): inv = inventory() potion = consumable('Potion', 1, 10, 10) inv.items.append(potion) result = inv.get_item('potion') self.assertEquals(result, potion)
def test_remove_item_not_last_item(self): inv = inventory() potion = consumable('Potion', 2, 10, 10) inv.items.append(potion) inv.remove_item(potion) self.assertEquals(1, inv.items[0].count)
def test_remove_item_last_item(self): inv = inventory() potion = consumable('Potion', 1, 10, 10) inv.items.append(potion) inv.remove_item(potion) self.assertEquals(0, len(inv.items))
def test_add_item_duplicate_item(self): inv = inventory() potion = consumable('Potion', 1, 10, 10) inv.add_item(potion) inv.add_item(potion) self.assertEquals(2, inv.items[0].count)
def getStandContents(self): self.inventory = inventory.inventory() self.pitcher = pitcher.pitcher() self.recipie = recipie.recipie()
def log_inventory(self): log.info("Inventory:{}".format(str(inventory(self.worker))))
if obj.name == 'monster': obj.followPlayer(ogre) playerInv.draw(w) p.display.update() ####### main ############ m = mapp(-3600, -3700) entities.append( entity(-200, 600, -200, 600, 5, 10, 'monster', entity_type='mob')) entities.append(entity(100, 100, 100, 100, 5, 10, 'monster', entity_type='mob')) entities.append(entity(-500, 300, -500, 300, 0, 0, 'tree', entity_type='solid')) playerInv = inventory(900, SCREEN_H - 300, False, False) items.append(item(1, 'coins', 100, 100)) items.append(item(2, 'globes', 100, 100)) ogre = player(400, 300, 64, 64) ####### main ############ run = True while run: c.tick(27) for event in p.event.get(): if event.type == p.QUIT: run = False
def __init__(self, name, desc, hp, damage): self.name = name self.desc = desc self.hp = hp self.damage = damage self.inv = inventory()
def set_trainer_from_dict(self,trainer_dict=None): if trainer_dict is None: return False # mandatory information self.name = trainer_dict.get('name') self.trainer_class = trainer_dict.get('trainer class') self.trainer_id = trainer_dict.get('trainer id') self.money = trainer_dict.get('money') # safe to assume information if trainer_dict.get('gender') is not None: self.gender = trainer_dict.get('gender') else: # RANDOM GENDER roll = randint(0,1) if roll == 0: self.gender = constants.male else: self.gender = constants.female if trainer_dict.get('is player') is not None: self.is_player = True else: # ELSE ASSUME IS NPC self.is_player = False if trainer_dict.get('party') is not None: self.party = trainer_dict.get('party') else: # SET AS EMPTY self.party = [] if trainer_dict.get('inventory') is not None: self.inventory = trainer_dict.get('inventory') else: # SET AS NEW self.inventory = inventory() self.inventory.set_owner(self) if trainer_dict.get('pokedex') is not None: self.pokedex = trainer_dict.get('pokedex') self.pokedex.set_license(self) else: # SET AS NEW self.pokedex = pokedex() self.pokedex.set_license(self) if trainer_dict.get('storage') is not None: self.storage = trainer_dict.get('storage') else: # SET AS NEW self.storage = inventory() # Non key information if trainer_dict.get('region') is not None: self.region_of_origin = trainer_dict.get('region') else: self.region_of_origin = "" if trainer_dict.get('hometown') is not None: self.hometown = trainer_dict.get('hometown') else: self.hometown = None if trainer_dict.get('age') is not None: self.age = trainer_dict.get('age') else: self.age = randint(10,30) if trainer_dict.get('height') is not None: self.height = trainer_dict.get('height') else: self.height = "" if trainer_dict.get('weight') is not None: self.weight = trainer_dict.get('weight') else: self.weight = "" if trainer_dict.get('badges') is not None: self.badges = trainer_dict.get('badges') else: self.badges = {1:None} if trainer_dict.get('wins') is not None: self.wins = trainer_dict.get('wins') else: self.wins = 0 if trainer_dict.get('losses') is not None: self.losses = trainer_dict.get('losses') else: self.losses = 0 if trainer_dict.get('draws') is not None: self.draws = trainer_dict.get('draws') else: self.draws = 0
def test_get_item_no_item(self): inv = inventory() result = inv.get_item('potion') self.assertEquals(result, None)
def test_add_item_new_item(self): inv = inventory() potion = consumable('Potion', 1, 10, 10) inv.add_item(potion) self.assertEquals(potion, inv.items[0])
def beh_aggressive_bag_cleaning(worker): level = worker.account_info()["level"] item_limits = PHASE_0_ITEM_LIMITS if level < 12 else L12_ITEM_LIMITS if (12 < level < 21) else L20_ITEM_LIMITS total = total_iventory_count(worker) if total > 300: log.info("Aggressive bag cleaning with {} items in inventory: {}".format(str(total), str(inventory(worker)))) beh_clean_bag_with_limits(worker, item_limits, aggressive=True)