def dagger(id): dagger = Entity(["dagger"]) dagger.add_description("A small rusty dagger") dagger.add_examine_description("this dagger looks like it could do a little bit of damage") dagger.data = {"equip": "weapon", "damage": 1} dagger.add_name("dagger") dagger.add_command(command_equip(dagger)) dagger.add_command(command_pick_up(dagger)) return dagger
def Table(id): table = Entity(["table"+str(id)]) table.add_name("wooden table") table.add_description("a simple wooden table"+str(id)) table.add_examine_description("a wooden table, it looks like a good place to place things") table.data = {"health" : 1} table.add_entity(Chair(1)) table.add_entity(Chair(2)) table.add_command(command_travel(table)) table.add_entity(dagger("")) table.add_command(command_attack(table)) return table
def Store(cryptoItemEngine): name = "store" entity = Entity([name]) entity.add_entities(cryptoItemEngine.get_crypto_items_list()) entity.add_command(command_travel(entity)) entity.add_command(command_list(entity)) entity.remove_command("stats") entity.add_name(name) add_descriptions( entity, "There is shady man standing in the corner, on his shirt is a large '$' sign", "he has many items for sale, all for crypto!") return entity
def createCryptoItem(self, name, description, examine): Item = Entity([name]) Item.add_name(name) stats = getItemStatsBlockchainByName(name) if len(stats) != 8: print("couldn't find item on blockchain") #"equipement" : {"head":"", "torso": "", "hands":"", "feet":"", "auxiliary":"", "weapon":""} equipment = "" if stats[0] == ItemTypes.ONEHAND.value: equipment = "weapon" elif stats[0] == ItemTypes.TWOHAND.value: equipment = "weapon" elif stats[0] == ItemTypes.LEGS.value: equipment = "feet" elif stats[0] == ItemTypes.CHEST.value: equipment = "torso" elif stats[0] == ItemTypes.FEET.value: equipment = "feet" elif stats[0] == ItemTypes.HANDS.value: equipment = "hands" elif stats[0] == ItemTypes.HEAD.value: equipment = "head" elif stats[0] == ItemTypes.AUX.value: equipment = "auxiliary" elif stats[0] == ItemTypes.USE.value: equipment = "item" Item.data = { "equip": equipment, "damage": stats[2], "armor": stats[3], "magicRating": stats[1], "price": getPrice(name) } addr = getItemAddressBlockchain(name) Item.id = addr if getIsPurchasable(name): Item.add_command(command_buy(Item)) add_descriptions(Item, description, examine) return Item