def func(self): "Implement the command." caller = self.caller # we don't have light, grasp around blindly. messages = ("It's pitch black. You fumble around but cannot find anything.", "You don't see a thing. You feel around, managing to bump your fingers hard against something. Ouch!", "You don't see a thing! Blindly grasping the air around you, you find nothing.", "It's totally dark here. You almost stumble over some un-evenness in the ground.", "You are completely blind. For a moment you think you hear someone breathing nearby ... \n ... surely you must be mistaken.", "Blind, you think you find some sort of object on the ground, but it turns out to be just a stone.", "Blind, you bump into a wall. The wall seems to be covered with some sort of vegetation, but its too damp to burn.", "You can't see anything, but the air is damp. It feels like you are far underground.") irand = random.randint(0, 10) if irand < len(messages): caller.msg(messages[irand]) else: # check so we don't already carry a lightsource. carried_lights = [obj for obj in caller.contents if utils.inherits_from(obj, LightSource)] if carried_lights: string = "You don't want to stumble around in blindness anymore. You already found what you need. Let's get light already!" caller.msg(string) return #if we are lucky, we find the light source. lightsources = [obj for obj in self.obj.contents if utils.inherits_from(obj, LightSource)] if lightsources: lightsource = lightsources[0] else: # create the light source from scratch. lightsource = create_object(LightSource, key="splinter") lightsource.location = caller string = "Your fingers bump against a splinter of wood in a corner. It smells of resin and seems dry enough to burn!" string += "\nYou pick it up, holding it firmly. Now you just need to {wlight{n it using the flint and steel you carry with you." caller.msg(string)
def func(self): # Sanity checking -- make sure that the ship class is one that this bot can make. self.caller.location.msg_contents("CONSTRUCTORBOT: SHIPCLASS--" + self.target_ship_class + "--SHIPNAME--" + self.target_ship_name + "--END") if self.obj.can_create_ship(self.target_ship_class): self.caller.location.msg_contents( "The constructorbot whirs to life and starts assembling modular parts from" "the shelves into a functioninig ship.") myShip = create_object(typeclass=self.target_ship_class, key=self.target_ship_name) # Make the object appear at the current location. myShip.location = self.caller.location self.caller.location.msg_content( "Emitting the 'job completed' tone, the constructorbot retreats back into its" "default position and powers down into standby mode.") else: self.caller.location.msg_contents( "With a static hiss, the constructors vocal encoder comes to life. 'INVALID SHIP TYPE SPECIFIED." )
def at_object_creation(self): self.db.mob_set = [] self.db.zone_type = None self.db.mob_names = ['Irradiated Rat', 'Survivor Scavenger', 'Infected Survivor', 'Shambling Corpse', 'Irradiated Dog', 'Reanimated Corpse', 'Crazed Looter'] self.db.difficulty = 'average' self.db.level_range = (1, 7) self.db.item_factory = create_object(ItemFactory, key='%s_loot_factory' % self.id)
def give(self, caller): """ Give objects to the caller. """ caller.msg(self.ndb.question) if not self.obj_list: # no objects caller.msg("没有可以获取的物品") else: # create objects in the list for obj_id in self.ndb.obj_list: # find object type's info matches = Object_Type_List.objects.filter(db_key=obj_id) if matches: info = matches[0] new_obj = create_object(info.db_typeclass_path, location=self, home=self) if new_obj: new_obj.set_type_id(obj_id) #move the object to the caller if not new_obj.move_to(caller, quiet=True, emit_to_obj=caller): new_obj.delete() else: caller.msg("你拿起了{w[%s]{n" % new_obj.key) commands = caller.get_available_cmd_desc(caller) if commands: caller.msg(commands + "\n") else: caller.msg("\n")
def _create_character(session, new_player, typeclass, start_location, home, permissions): """ Helper function, creates a character based on a player's name. This is meant for Guest and MULTISESSION_MODE < 2 situations. """ try: if not start_location: start_location = home # fallback new_character = create_object(typeclass, key=new_player.key, location=start_location, home=home, permissions=permissions) # set playable character list new_player.db._playable_characters.append(new_character) # allow only the character itself and the player to puppet this character (and Immortals). new_character.locks.add("puppet:id(%i) or pid(%i) or perm(Immortals) or pperm(Immortals)" % (new_character.id, new_player.id)) # If no description is set, set a default description if not new_character.db.desc: new_character.db.desc = "这是一位玩家。" # We need to set this to have @ic auto-connect to this character new_player.db._last_puppet = new_character except Exception, e: session.msg("There was an error creating the Character:\n%s\n If this problem persists, contact an admin." % e) logger.log_trace() return False
def func(self): "Implement the command" if self.caller.ndb.weapon: # we don't allow a player to take more than one weapon from rack. string = "\n你已经有一把武器了。\n" string += self.caller.get_available_cmd_desc(self.caller) self.caller.msg(string, clear_links=True) else: dmg, name, aliases, desc, magic = self.obj.randomize_type() new_weapon = create_object(Weapon, key=name, aliases=aliases, location=self, home=self) new_weapon.db.damage = dmg new_weapon.db.desc = desc new_weapon.db.magic = magic #take the object if not new_weapon.move_to(caller, quiet=True, emit_to_obj=caller): new_weapon.delete() return ostring = self.obj.db.get_text if not ostring: ostring = "你拿起了%s。" if '%s' in ostring: ostring = ostring % name ostring += "\n" + self.caller.get_available_cmd_desc(self.caller) caller.msg(ostring, clear_links=True)
def make_player(item): """Create a character/user/player""" permissions = ev.settings.PERMISSION_PLAYER_DEFAULT typeclass = ev.settings.BASE_PLAYER_TYPECLASS # Create the character. if item["db"] == 1: superuser = True email = ['*****@*****.**'] else: superuser = False # Email is special. email = [ prop['propval'] for prop in item['props'] if prop['propname'] == '@/email'] try: email = email[0] print email is_active = True except: email=None is_active = False player = ev.create_player(item["name"], email, "testpass", typeclass=typeclass, permissions=permissions, is_superuser = superuser) character = ev.create_object(typeclass=settings.BASE_CHARACTER_TYPECLASS, key=item["name"], permissions=permissions) local_tz = pytz.timezone("America/Chicago") utc_dt = datetime.utcfromtimestamp(item["createdtime"]).replace(tzinfo=pytz.utc) player.dbobj.db_date_created = utc_dt character.dbobj.db_date_created = utc_dt player.dbobj.is_active = is_active character.db.spirit = player player.db.avatar = character print character.name + " was born!" permissions_list = { "MAGE" : "PlayerHelpers", "WIZARD" : "Wizards", "ARCHWIZARD" : "Immortals", "BOY" : "Immortals" } for flag in item["flags"]: if flag in permissions_list: # These properties are special. When we assign things to them, they # trigger effects down the line. They're meant to be set and pulled # from, but not modified directly, which is why we don't append to # the property. For more info, see # http://docs.python.org/reference/datamodel.html#object.__setattr__ permission = character.permissions permission.append(permissions_list[flag]) character.permissions = permission # The Player objects should have these permissions, too. permission = player.permissions permission.append(permissions_list[flag]) player.permissions = permission print character.name + " was added to group '" + permissions_list[flag] + "'." if "WIZARD" in item["flags"] or "ARCHWIZARD" in item["flags"] or "BOY" in item["flags"]: character.locks.add('delete:superuser()') player.is_staff = True player.save() if "STAFF" in item["flags"]: player.is_staff = True player.save() repassword_player(player, item["password"]) character.save() player.save()
def load_objects(objspec): objects = {} # Create objects for identifier, spec in objspec.iteritems(): obj = create_object(spec['typeclass']) if 'key' in spec: obj.key = spec['key'] if 'aliases' in spec: obj.aliases = spec['aliases'] if 'permissions' in spec: obj.permissions = spec['permissions'] if 'locks' in spec: obj.locks.replace(spec['locks']) if 'db' in spec: for key, val in spec['db'].iteritems(): obj.set_attribute(key, val) objects[identifier] = obj # Handle links between objects for identifier, spec in objspec.iteritems(): if 'location' in spec: if spec['location'].startswith('#'): objects[identifier].location = search_object(spec['location'])[0] else: objects[identifier].location = objects[spec['location']] if 'home' in spec: if spec['home'].startswith('#'): objects[identifier].home = ev.search_object(spec['home'])[0] else: objects[identifier].home = objects[spec['home']] if 'destination' in spec: if spec['destination'].startswith('#'): objects[identifier].destination = ev.search_object(spec['destination'])[0] else: objects[identifier].destination = objects[spec['destination']] return objects
def create_lootset(self, number_of_items, loot_tier="t1"): loot_set = [] print "begin loot set logic" if number_of_items == 0: return [] # loot_groups are important. Each one represents a school of crafting...well roughly anyhow. self.check_for_uncommon_drop(loot_set) print loot_set loot_groups = ["armor"] lg = "armor" for x in range(0, number_of_items): if loot_tier == "t1": if lg == "armor": rn = random.random() print rn if rn < 0.05: name = random.choice(self.db.t1_old_armor_husks) desc = "This old set of armor while damaged, could probably be repaired." else: print "in comps" name = random.choice(self.db.t1_armor_comp_names) desc = "Components used in the crafting of wonderful sets of armor." print "out of name gen" item = create_object("game.gamesrc.objects.world.item.Item", key=name, location=self) item.desc = desc a = item.db.attributes a["lootable"] = True a["crafting_material"] = True a["crafting_group"] = lg item.db.type = "crafting_materials" item.db.attributes = a loot_set.append(item) return loot_set
def at_object_creation(self): self.db.mob_set = [] self.db.zone_type = None self.db.mob_names = [] self.db.difficulty = "average" self.db.level_range = (1, 7) self.db.item_factory = create_object(ItemFactory, key="%s_loot_factory" % self.id)
def at_object_creation(self): self.db.rooms = search.objects("%s_room" % self.key) self.db.mob_map = {} self.db.player_map = {} self.db.quest_items = [] self.db.zone_map = {} self.db.mob_factory = create_object("game.gamesrc.objects.world.factories.MobFactory", key='%s MobFactory' % self.key) self.tags.add('zone_manager')
def at_object_creation(self): self.db.mob_set = [] self.db.zone_type = None self.db.mob_names = [] self.db.difficulty = 'average' self.db.level_range = (1, 7) self.db.item_factory = create_object(ItemFactory, key='%s_loot_factory' % self.id)
def at_object_creation(self): self.db.rooms = search.objects("%s_room" % self.key) self.db.mob_map = {} self.db.player_map = {} self.db.quest_items = [] self.db.zone_map = {} self.db.mob_factory = create_object("game.gamesrc.objects.world.factories.MobFactory", key='%s MobFactory' % self.key) self.aliases = [ 'zone_manager']
def func(self): "Implement the command." caller = self.caller if caller.ndb.is_first_look: caller.ndb.is_first_look = False caller.display_available_cmds() return string = "\n{c=============================================================={n" string += "\n{c摸索{n" string += "\n{c=============================================================={n" # we don't have light, grasp around blindly. messages = ("周围一片漆黑。你四处摸索,但无法找到任何东西。", "你看不到任何东西。你摸索着周围,手指突然重重地撞上了某个物体。哎哟!", "你看不到任何东西!你盲目地向周围抓去,什么都没碰到。", "这里一丝光都没有,你差点被凹凸不平的地面绊倒。", "你完全失明了。有一会儿,你觉得好像听到附近有呼吸声……\n……想必你是弄错了。", "看不见。你以为在地上找到了什么,但发现这只是块石头。", "看不见。你撞到墙了,墙壁上似乎覆盖着一些植物,但它们太潮湿了,无法点燃。", "你什么都看不到。周围的空气很潮湿,你感觉像是在深深的地下。") irand = random.randint(0, 10) if irand < len(messages): string += "\n" + messages[irand] commands = caller.available_cmd_list(None) if commands: string += "\n\n动作:" + " ".join(commands) caller.msg(string, clear_links=True) else: # check so we don't already carry a lightsource. carried_lights = [obj for obj in caller.contents if utils.inherits_from(obj, LightSource)] if carried_lights: string += "\n你不想继续在黑暗中摸索了。你已经找到了所需的东西,点亮它吧!" commands = ["{lclight{lt点燃木片{le"] + caller.available_cmd_list(None) string += "\n\n动作:" + " ".join(commands) caller.msg(string, clear_links=True) return #if we are lucky, we find the light source. lightsources = [obj for obj in self.obj.contents if utils.inherits_from(obj, LightSource)] if lightsources: lightsource = lightsources[0] else: # create the light source from scratch. lightsource = create_object(LightSource, key="木片") lightsource.location = caller string += "\n在角落里,你的手指碰到了一些木片。它们还带着树脂的香味,而且比较干燥,应该可以点燃!" string += "\n你把它捡起来,紧紧地握手里。现在,你只需要用随身携带的火石{w点着{n它就行了。" commands = ["{lclight{lt点燃木片{le"] + caller.available_cmd_list(None) string += "\n\n动作:" + " ".join(commands) caller.msg(string, clear_links=True)
def at_start(self): self.obj.db.in_combat = True cm = create_object("game.gamesrc.objects.world.combat.CombatManager", key="%s_combat_manager" % self.obj.name) if self.obj.db.combat_manager is not None: old_cm = self.obj.db.combat_manager old_cm.delete() self.obj.db.combat_manager = cm cm.db.pc_combatant = self.db.pc cm.db.npc_combatant = self.db.npc
def give(self, typeclass, quantity=1, key=None, attributes=None): """ Create one or more new objects with the specified typeclass. Returns a list of created or modified objects. Stackable objects are handled correctly. """ quantity = int(quantity) if not callable(typeclass): typeclass = _get_object_class(typeclass) is_stackable = utils.inherits_from(typeclass, 'game.gamesrc.latitude.objects.stackable.Stackable') # Verify parameters if quantity < 1: raise ValueError('quantity must be greater than 0') if is_stackable and key: raise ValueError('name specified for stackable item') if is_stackable and attributes: raise ValueError('attributes specified for stackable item') # If there's an existing stackable object of this type, just add to it if is_stackable: for con in self.contents: if type(con) is typeclass: con.db.quantity += quantity return [con] # Create a new object if is_stackable: obj = create_object(typeclass, location=self) obj.db.quantity = quantity return [obj] else: retval = [] for i in range(quantity): new_obj = create_object(typeclass, location=self, key=key) if attributes: for name, val in attributes.iteritems(): new_obj.set_attribute(name, val) retval.append(new_obj) return(retval)
def create_ship(self, caller, name, ship_class): """ Create a new ship and register it with the space system as an active vessel. @type caller: Object @type name: str @type ship_class: str """ if self.can_create_ship(self, ship_class): the_ship = create_object(Ship, key=name) the_ship.location = self.location # ^ Does that actually put the ship in the right place? elif not self.can_create_ship(self, ship_class): return False # Unable to produce requested ship class.
def at_start(self): self.obj.db.in_combat = True cm = create_object("game.gamesrc.objects.world.combat.CombatManager", key="%s_combat_manager" % self.obj.name) if self.obj.db.combat_manager is not None: try: old_cm = self.obj.db.combat_manager old_cm.delete() except AttributeError: pass self.obj.db.combat_manager = cm cm.db.pc_combatant = self.db.pc cm.db.npc_combatant = self.db.npc
def create_mob_set(self, number_of_mobs): self.db.mob_set = [] for x in range(0, number_of_mobs): mob_name = random.choice(self.db.mob_names) mob_obj = create_object("game.gamesrc.objects.world.npc.Npc", key=mob_name, location=self) a = mob_obj.db.attributes a['level'] = random.randrange(self.db.level_range[0], self.db.level_range[1]) mob_obj.db.attributes = a mob_obj.db.difficulty_rating = self.db.difficulty mob_obj.generate_attributes() self.db.mob_set.append(mob_obj) rn = random.random() if rn >= .20: self.create_mob_loot(mob_obj) return self.db.mob_set
def func(self): "Implements the command" caller = self.caller if not self.args: caller.msg("Usage: @craftscriptable <name>") return objname = self.args.strip() obj = create_object(CraftedScriptableObject, key=objname, location=caller.location) if not obj: caller.msg("There was an error creating %s!" % objname) return # set locks on the object restrictive coding only to us, the creator. obj.db.evlang_locks = {"get":"code:id(%s) or perm(Wizards)" % caller.dbref, "drop":"code:id(%s) or perm(Wizards)" % caller.dbref, "look": "code:id(%s) or perm(Wizards)" % caller.dbref} caller.msg("Crafted %s. Use @desc and @code to customize it." % objname)
def func(self): """ Tries to create the Character object. We also put an attribute on ourselves to remember it. """ # making sure caller is really a player self.character = None if utils.inherits_from(self.caller, "src.objects.objects.Object"): # An object of some type is calling. Convert to player. #print self.caller, self.caller.__class__ self.character = self.caller if hasattr(self.caller, "player"): self.caller = self.caller.player if not self.args: self.caller.msg("Usage: create <character name>") return charname = self.args.strip() old_char = managers.objects.get_objs_with_key_and_typeclass( charname, CHARACTER_TYPECLASS) if old_char: self.caller.msg("Character {c%s{n already exists." % charname) return # create the character new_character = create_object(CHARACTER_TYPECLASS, key=charname) if not new_character: self.caller.msg( "{rThe Character couldn't be created. This is a bug. Please contact an admin." ) return # make sure to lock the character to only be puppeted by this player new_character.locks.add( "puppet:id(%i) or pid(%i) or perm(Immortals) or pperm(Immortals)" % (new_character.id, self.caller.id)) # save dbref avail_chars = self.caller.db._character_dbrefs if avail_chars: avail_chars.append(new_character.id) else: avail_chars = [new_character.id] self.caller.db._character_dbrefs = avail_chars self.caller.msg("{gThe Character {c%s{g was successfully created!" % charname)
def func(self): # Sanity checking -- make sure that the ship class is one that this bot can make. self.caller.location.msg_contents("CONSTRUCTORBOT: SHIPCLASS--" + self.target_ship_class + "--SHIPNAME--" + self.target_ship_name + "--END") if self.obj.can_create_ship(self.target_ship_class): self.caller.location.msg_contents("The constructorbot whirs to life and starts assembling modular parts from" "the shelves into a functioninig ship.") myShip = create_object(typeclass=self.target_ship_class, key=self.target_ship_name) # Make the object appear at the current location. myShip.location = self.caller.location self.caller.location.msg_content("Emitting the 'job completed' tone, the constructorbot retreats back into its" "default position and powers down into standby mode.") else: self.caller.location.msg_contents("With a static hiss, the constructors vocal encoder comes to life. 'INVALID SHIP TYPE SPECIFIED.")
def at_object_creation(self): self.db.attributes = { 'name': self.key, 'strength': 10, 'constitution': 10, 'intelligence': 10, 'dexterity': 10, 'luck': 10, 'health': 0, 'mana': 0, 'stamina': 0, 'temp_health': 0, 'temp_mana': 0, 'temp_stamina': 0, 'level': 1, 'exp_needed': 300, 'exp': 0, 'experience_currency': 0, 'total_exp': 0, 'race': None, 'deity': None, 'gender': None, } self.db.combat_attributes = {'attack_rating': 0, 'armor_rating': 0, 'defense_rating': 0 } self.db.currency = { 'gold': 0, 'silver': 0, 'copper': 0 } self.db.skills = { 'listen': { 'rating': 0, 'desc': 'Your ability to listen to your surroundings.'}, 'search': { 'rating': 0, 'desc': 'Your ability to search your surroundings visually'}, 'bladed weapons': { 'rating': 0, 'desc': 'Your innate ability to wield bladed weaponry'}, 'blunt weapons': {'rating': 0, 'desc': 'Your innate ability to wield blunt weaponry.'}, 'hide': { 'rating': 0, 'desc': 'Your innate ability to hide in the shadows and become unseen.'}, } self.db.archtypes = { 'soldier': { 'level': 1, 'exp_to_level': 100, 'exp': 0, 'total_exp': 0 }, 'mage': { 'level': 1, 'exp_to_level': 100, 'exp': 0, 'total_exp': 0 }, 'rogue': { 'level': 1, 'exp_to_level': 100, 'exp': 0, 'total_exp': 0 }, 'leader': { 'level': 1, 'exp_to_level': 100, 'exp': 0, 'total_exp': 0} } self.db.equipment = { 'armor': None, 'main_hand_weapon': None, 'offhand_weapon': None, 'shield': None, 'right_hand_ring': None, 'left_hand_ring': None} #Object creation questlog = create_object('game.gamesrc.objects.world.quests.QuestManager', location=self, key="Questlog") self.db.questlog = questlog self.tags.add('character_runner') self.at_post_creation()
def give(self, caller): "Give weapon" string = "\n{c=============================================================={n" string += "\n{c取走武器{n" string += "\n{c=============================================================={n" string += "\n" if caller.ndb.weapon: # we don't allow a player to take more than one weapon from rack. string += "你已经有一把武器了。\n" string += "(你要先丢弃行囊中的武器才能拿取新武器)\n" string += caller.get_available_cmd_desc(caller) caller.msg(string, clear_links=True) return dmg, name, aliases, desc, magic = self.randomize_type() new_weapon = create_object(Weapon, key=name, aliases=aliases, location=self, home=self) new_weapon.db.damage = dmg new_weapon.db.desc = desc new_weapon.db.magic = magic #take the object if not new_weapon.move_to(caller, quiet=True, emit_to_obj=caller): new_weapon.delete() return ostring = self.db.get_text if not ostring: ostring = "你拿起了%s。" if '%s' in ostring: ostring = ostring % name string += ostring + "\n" string += caller.get_available_cmd_desc(caller) caller.msg(string, clear_links=True) destination = search_object("tut#17") if not destination: destination = search_object("#2") if destination: source = caller.location caller.location = destination[0] # stealth move caller.location.at_object_receive(caller, source)
def func(self): """ Tries to create the Character object. We also put an attribute on ourselves to remember it. """ # making sure caller is really a player self.character = None if utils.inherits_from(self.caller, "src.objects.objects.Object"): # An object of some type is calling. Convert to player. #print self.caller, self.caller.__class__ self.character = self.caller if hasattr(self.caller, "player"): self.caller = self.caller.player if not self.args: self.caller.msg("Usage: create <character name>") return charname = self.args.strip() old_char = managers.objects.get_objs_with_key_and_typeclass(charname, CHARACTER_TYPECLASS) if old_char: self.caller.msg("Character {c%s{n already exists." % charname) return # create the character new_character = create_object(CHARACTER_TYPECLASS, key=charname) if not new_character: self.caller.msg("{rThe Character couldn't be created. This is a bug. Please contact an admin.") return # make sure to lock the character to only be puppeted by this player new_character.locks.add("puppet:id(%i) or pid(%i) or perm(Immortals) or pperm(Immortals)" % (new_character.id, self.caller.id)) # save dbref avail_chars = self.caller.db._character_dbrefs if avail_chars: avail_chars.append(new_character.id) else: avail_chars = [new_character.id] self.caller.db._character_dbrefs = avail_chars self.caller.msg("{gThe Character {c%s{g was successfully created!" % charname)
def create_mob_set(self, number_of_mobs): self.db.mob_set = [] for x in range(0, number_of_mobs): mob_name = random.choice(self.db.mob_names) mob_obj = create_object("game.gamesrc.objects.world.npc.Npc", key=mob_name, location=self) mob_obj.tags.add("%s_mobs" % self.id) a = mob_obj.db.attributes a['level'] = random.randrange(self.db.level_range[0], self.db.level_range[1]) mob_obj.db.attributes = a mob_obj.db.difficulty_rating = self.db.difficulty mob_obj.generate_attributes() self.db.mob_set.append(mob_obj) rn = random.random() if rn >= .20: self.create_mob_loot(mob_obj) return self.db.mob_set
def give_object(self, caller, obj_id): """ Give an object to the caller. """ string = "" matches = Object_Type_List.objects.filter(db_key=obj_id) if matches: info = matches[0] new_obj = create_object(info.db_typeclass_path, key="new object", location=self, home=self) if new_obj: new_obj.set_type_id(obj_id) #move the object to the caller if not new_obj.move_to(caller, quiet=True, emit_to_obj=caller): new_obj.delete() else: string += "你拿起了{w[%s]{n" % new_obj.key string += "\n " + caller.get_available_cmd_desc(caller) caller.msg(string)
def func(self): "Implement the command" rack_id = self.obj.db.rack_id if self.caller.get_attribute(rack_id): # we don't allow a player to take more than one weapon from rack. self.caller.msg("%s has no more to offer you." % self.obj.name) else: dmg, name, aliases, desc, magic = self.obj.randomize_type() new_weapon = create_object(Weapon, key=name, aliases=aliases,location=self.caller, home=self.caller) new_weapon.db.rack_id = rack_id new_weapon.db.damage = dmg new_weapon.db.desc = desc new_weapon.db.magic = magic ostring = self.obj.db.get_text if not ostring: ostring = "You pick up %s." if '%s' in ostring: self.caller.msg(ostring % name) else: self.caller.msg(ostring) # tag the caller so they cannot keep taking objects from the rack. self.caller.set_attribute(rack_id, True)
def func(self): "Implement the command" rack_id = self.obj.db.rack_id if self.caller.attributes.get(rack_id): # we don't allow a player to take more than one weapon from rack. self.caller.msg("%s has no more to offer you." % self.obj.name) else: dmg, name, aliases, desc, magic = self.obj.randomize_type() new_weapon = create_object(Weapon, key=name, aliases=aliases,location=self.caller, home=self.caller) new_weapon.db.rack_id = rack_id new_weapon.db.damage = dmg new_weapon.db.desc = desc new_weapon.db.magic = magic ostring = self.obj.db.get_text if not ostring: ostring = "You pick up %s." if '%s' in ostring: self.caller.msg(ostring % name) else: self.caller.msg(ostring) # tag the caller so they cannot keep taking objects from the rack. self.caller.attributes.add(rack_id, True)
def cmd_new(self): player = self.player key = self.args # Verify that the account has a free character slot max_characters = player.max_characters() playable_characters = player.get_characters() if len(playable_characters) >= player.max_characters(): self.msg("{RYou may only create a maximum of %i characters." % max_characters) return # Check the character name if re.search('[^a-zA-Z0-9._ -]', key) or not (3 <= len(key) <= 20): self.msg('{R[Character names must be between 3 and 20 characters, and only contain english letters, numbers, dot (.), underscore (_), or dash(-), or space ( )]') return # Verify that the character name is not already taken for existing_object in search_object(key, attribute_name='key'): if utils.inherits_from(existing_object, "src.objects.objects.Character"): self.msg("{R[That character name is already taken]") return # Verify that this is not the name of a player, unless it's your own if key.lower() != player.key.lower(): if search_player(key): self.msg("{R[That name is already taken by a player account]") return # create the character from src.objects.models import ObjectDB default_home = ObjectDB.objects.get_id(settings.CHARACTER_DEFAULT_HOME) typeclass = settings.BASE_CHARACTER_TYPECLASS permissions = settings.PERMISSION_PLAYER_DEFAULT new_character = create_object(typeclass, key=key, location=default_home, home=default_home, permissions=permissions) # only allow creator (and admins) to puppet this char new_character.locks.add("puppet:id(%i) or pid(%i) or perm(Janitors)" % (new_character.id, player.id)) # Set this new character as owned by this player new_character.set_owner(player) # Configure the character as a new character in the world new_character.db.desc = "This is a Player." # Inform the user that we're done. self.msg("{G[Created new character %s. Use {g%s/ic %s{G to enter the game as this character]" % (new_character.key, self.key, new_character.key))
def create_lootset(self, number_of_items, loot_tier='t1'): loot_set = [] print "begin loot set logic" if number_of_items == 0: return [] #loot_groups are important. Each one represents a school of crafting...well roughly anyhow. self.check_for_uncommon_drop(loot_set) print loot_set loot_groups = ['armor'] lg = 'armor' for x in range(0, number_of_items): if loot_tier == 't1': if lg == 'armor': rn = random.random() print rn if rn < .05: name = random.choice(self.db.t1_old_armor_husks) desc = "This old set of armor while damaged, could probably be repaired." else: print "in comps" name = random.choice(self.db.t1_armor_comp_names) desc = "Components used in the crafting of wonderful sets of armor." print "out of name gen" item = create_object("game.gamesrc.objects.world.item.Item", key=name, location=self) item.desc = desc a = item.db.attributes a['lootable'] = True a['crafting_material'] = True a['crafting_group'] = lg item.db.type = 'crafting_materials' item.db.attributes = a loot_set.append(item) return loot_set
def at_object_creation(self): self.db.desc = "An unadorned vessel. You shouldn't see this unless something has gone horribly wrong." self.db.transponder_id = uuid.uuid1() self.db.entry_password = '******' # Create the bridge and cargo bay. self.bridge = create_object(Room, key="Bridge") self.cargo_bay = create_object(Room, key="Cargo Bay") # Link with exits. self.bridge_entrance = create_object(Exit, key="Out") self.bridge_exit = create_object(Exit, key="Bridge") # Bridge -> Cargo Bay self.db.bridge_exit_ref = self.bridge_exit.dbref self.bridge_exit.location = self.bridge self.bridge_exit.destination = self.cargo_bay # Cargo Bay -> Bridge self.db.bridge_entrance_ref = self.bridge_entrance.dbref self.bridge_entrance.location = self.cargo_bay self.bridge_entrance.destination = self.bridge # And do the same with an airlock, on the inside of the cargo bay and the outside of the ship. self.airlock_out = create_object(Exit, key="Airlock Out") self.airlock_in = create_object(Exit, key="Airlock In") self.db.airlock_in_ref = self.airlock_in.dbref self.db.airlock_out_ref = self.airlock_out.dbref self.db.cargo_ref = self.cargo_bay.dbref self.db.bridge_ref = self.bridge.dbref #Link airlock exits to wherever the ship is being built. self.airlock_out.location = self.cargo_bay self.airlock_out.destination = self.location self.airlock_in.location = self.location self.airlock_in.destination = self.cargo_bay # TODO: State changing methods, for use by scripts and such.
from game.gamesrc.objects.examples import red_button from ev import Object limbo = search_object('Limbo')[0] #CODE (create red button) # This is the first code block. Within each block, python # code works as normal. Note how we make use if imports and # 'limbo' defined in the #HEADER block. This block's header # offers no information about red_button variable, so it # won't be able to be deleted in debug mode. # create a red button in limbo red_button = create_object(red_button.RedButton, key="Red button", location=limbo, aliases=["button"]) # we take a look at what we created caller.msg("A %s was created." % red_button.key) #CODE (create table and chair) table, chair # this code block has 'table' and 'chair' set as deletable # objects. This means that when the batchcode processor runs in # testing mode, objects created in these variables will be deleted # again (so as to avoid duplicate objects when testing the script many # times). # the python variables we assign to must match the ones given in the # header for the system to be able to delete them afterwards during a # debugging run.
def create_room(self, room_name): "Create a room with the planet's name as one of its tags." tempRoom = create_object(Room, key="room_name") tempRoom.tags.add(self.key) pass
def at_object_creation(self): self.spaceport = create_object(Room, key="Spaceport") pass
#HEADER from ev import create_object, search_object #CODE (Npcs) from ev import create_object, search_object caller.msg("Creating Battle Dummy") tutorial3 = search_object("tutorial3")[0] tut_enemynpc = create_object("game.gamesrc.objects.world.npc.Npc", key="Battle Dummy", location=tutorial3) desc = "What seems to be an animated..scarecrow...thing. \"Mmph...mppphhnnmm\" is the only sounds it seems capable of making.\n" desc += "In its hand materializes a magically summoned hammer and shield." tut_enemynpc.db.desc = desc tut_enemynpc.db.actions = { 'taunt': "Mpphhgmm mph, hpmmhhhgn!", "mock": "Hmmgpf mmpphmmgjf" } tut_enemynpc.rating = 'hero' tut_enemynpc.db.attributes['level'] = 1 tut_enemynpc.generate_attributes() caller.msg("Creating Kayleigh") tutorial1_room = search_object("tutorial1")[0] tutorial1_npc = create_object("game.gamesrc.objects.world.npc.Npc", key="Kayleigh", location=tutorial1_room) desc = "This striking woman is clearly far stronger than you and could probably kill you with a mere flick of her finger.\n" desc += "She is dressed in a black ensemble that hides all of her features except her eyes. As you look at her face, you\n" desc += "notice that her eyes are entirely white, though she does not seem to be blind." tutorial1_npc.desc = desc tutorial1_npc.name = "{Y!{n %s" % tutorial1_npc.name
# HEADER from ev import create_object, search_object from game.gamesrc.objects.world.room import Zone # CODE (Message Caller) caller.msg("Starting on zone creation: Marshlands") zone = create_object(Zone, key="marshlands") zone.aliases = ["zone_runner"] zone.db.zone_name = "The Marshlands" zone.db.mob_factory.db.zone_type = "marshlands" zone.db.mob_factory.db.mob_names = [ "Adult Grasswhip", "Large Bearcat", "Slythain Hunter", "Slythain Juvenile", "Young Grasswhip", "Bearcat cub", "Bearcat Matriarch", ] zone.set_zone_manager()
def make_room(item): """Build a room.""" typeclass = ev.settings.BASE_ROOM_TYPECLASS room = ev.create_object(typeclass=typeclass, key=item["name"]) print "Room " + room.name + " built!"
def at_object_creation(self): self.db.attributes = { 'name': self.key, 'strength': 10, 'constitution': 10, 'intelligence': 10, 'dexterity': 10, 'luck': 10, 'health': 0, 'mana': 0, 'stamina': 0, 'temp_health': 0, 'temp_mana': 0, 'temp_stamina': 0, 'level': 1, 'exp_needed': 300, 'exp': 0, 'experience_currency': 0, 'total_exp': 0, 'race': None, 'deity': None, 'gender': None, } self.db.combat_attributes = { 'attack_rating': 0, 'armor_rating': 0, 'defense_rating': 0 } self.db.currency = {'gold': 0, 'silver': 0, 'copper': 0} self.db.skills = { 'listen': { 'rating': 0, 'desc': 'Your ability to listen to your surroundings.' }, 'search': { 'rating': 0, 'desc': 'Your ability to search your surroundings visually' }, 'bladed weapons': { 'rating': 0, 'desc': 'Your innate ability to wield bladed weaponry' }, 'blunt weapons': { 'rating': 0, 'desc': 'Your innate ability to wield blunt weaponry.' }, 'hide': { 'rating': 0, 'desc': 'Your innate ability to hide in the shadows and become unseen.' }, } self.db.archtypes = { 'soldier': { 'level': 1, 'exp_to_level': 100, 'exp': 0, 'total_exp': 0 }, 'mage': { 'level': 1, 'exp_to_level': 100, 'exp': 0, 'total_exp': 0 }, 'rogue': { 'level': 1, 'exp_to_level': 100, 'exp': 0, 'total_exp': 0 }, 'leader': { 'level': 1, 'exp_to_level': 100, 'exp': 0, 'total_exp': 0 } } self.db.equipment = { 'armor': None, 'main_hand_weapon': None, 'offhand_weapon': None, 'shield': None, 'right_hand_ring': None, 'left_hand_ring': None } #Object creation questlog = create_object( 'game.gamesrc.objects.world.quests.QuestManager', location=self, key="Questlog") self.db.questlog = questlog self.tags.add('character_runner') self.at_post_creation()
#HEADER from ev import create_object, search_object from game.gamesrc.objects.world.quests import Quest #CODE from ev import create_object, search_object from game.gamesrc.objects.world.quests import Quest storage = search_object('Limbo')[0] copy_dir = 'gamesrc/copy/' tut_speak = create_object(Quest, key="Speak And Be Heard", location=storage) tut_speak.tags.add(tut_speak.key) tut_speak.short_description = "Speak in OOC chat." tut_speak.aliases = ['tutorial quests'] tut_speak.set_description('%squests/speak_and_be_heard.txt' % copy_dir) tut_speak.db.gold_reward = 100 tut_speak.db.exp_reward = 100 objective = { 'objective_name': 'Use the ooc command to speak in the global public channel', 'counter': 0, 'threshold': 3, 'completed': False, 'type': 'use_public' } tut_speak.add_objective(objective)
def make_thing(item): """Build a thing.""" typeclass = ev.settings.BASE_OBJECT_TYPECLASS thing = ev.create_object(typeclass=typeclass, key=item["name"]) print "Item " + thing.name + " was fashioned!"
from game.gamesrc.objects.examples import red_button from ev import Object limbo = search_object('Limbo')[0] #CODE (create red button) # This is the first code block. Within each block, python # code works as normal. Note how we make use if imports and # 'limbo' defined in the #HEADER block. This block's header # offers no information about red_button variable, so it # won't be able to be deleted in debug mode. # create a red button in limbo red_button = create_object(red_button.RedButton, key="Red button", location=limbo, aliases=["button"]) # we take a look at what we created caller.msg("A %s was created." % red_button.key) #CODE (create table and chair) table, chair # this code block has 'table' and 'chair' set as deletable # objects. This means that when the batchcode processor runs in # testing mode, objects created in these variables will be deleted # again (so as to avoid duplicate objects when testing the script many # times). # the python variables we assign to must match the ones given in the # header for the system to be able to delete them afterwards during a
def func(self): """ Tries to create the Character object. We also put an attribute on ourselves to remember it. """ # making sure caller is really a player self.character = None if utils.inherits_from(self.caller, "src.objects.objects.Object"): # An object of some type is calling. Convert to player. #print self.caller, self.caller.__class__ self.character = self.caller if hasattr(self.caller, "player"): self.caller = self.caller.player if not self.args: self.caller.msg("Usage: create <character name>") return charname = self.args.strip() old_char = managers.objects.get_objs_with_key_and_typeclass( charname, CHARACTER_TYPECLASS) if old_char: self.caller.msg("Character {c%s{n already exists." % charname) return # create the character new_character = create_object(CHARACTER_TYPECLASS, key=charname) if not new_character: self.caller.msg( "{rThe Character couldn't be created. This is a bug. Please contact an admin." ) return # make sure to lock the character to only be puppeted by this player new_character.locks.add( "puppet:id(%i) or pid(%i) or perm(Immortals) or pperm(Immortals)" % (new_character.id, self.caller.id)) # save dbref avail_chars = self.caller.db._character_dbrefs if avail_chars: avail_chars.append(new_character.id) else: avail_chars = [new_character.id] self.caller.db._character_dbrefs = avail_chars self.caller.msg("{gThe Character {c%s{g was successfully created!" % charname) self.caller.obj = new_character attributes = new_character.db.attributes nodes = [] copy_dir = '/Users/geoffrey/gitrepos/avaloria/game/gamesrc/copy/' for option in ['race', 'deity', 'alignment', 'gender']: if 'race' in option: for race in [ 'bardok', 'erelania', 'the unknowns', 'earthen', 'gerdling' ]: confirm_node = MenuNode( "confirm-%s" % race, links=['deity'], linktexts=['Choose your deity.'], code="self.caller.obj.set_race('%s')" % race) nodes.append(confirm_node) if 'bardok' in race: text = copyreader.read_file( "%s/races/bardok_desc.txt" % copy_dir) race_node = MenuNode("%s" % race, text=text, links=['confirm-bardok', 'race'], linktexts=[ 'Confirm Race Selection', 'Back to Races' ]) elif 'erelania' in race: text = copyreader.read_file( "%s/races/erelania_desc.txt" % copy_dir) race_node = MenuNode( "%s" % race, text=text, links=['confirm-erelania', 'race'], linktexts=[ 'Confirm Race Selection', 'Back to Races' ]) elif 'gerdling' in race: text = copyreader.read_file( "%s/races/gerdling_desc.txt" % copy_dir) race_node = MenuNode( "%s" % race, text=text, links=['confirm-gerdling', 'race'], linktexts=[ 'Confirm Race Selection', 'Back to Races' ]) elif 'earthen' in race: text = copyreader.read_file( "%s/races/earthen_desc.txt" % copy_dir) race_node = MenuNode("%s" % race, text=text, links=['confirm-earthen', 'race'], linktexts=[ 'Confirm Race Selection', 'Back to Races' ]) nodes.append(race_node) text = copyreader.read_file("%s/races/races_desc.txt" % copy_dir) root_race_node = MenuNode( "%s" % option, text=text, links=['bardok', 'erelania', 'gerdling', 'earthen'], linktexts=[ 'The Bardok', 'The Erelania', 'The Gerdling', 'The Earthen' ]) nodes.append(root_race_node) elif 'deity' in option: deities = ['ankarith', 'slyth', 'green warden', 'kaylynne'] for deity in deities: confirm_node = MenuNode( 'confirm-%s' % deity, links=['gender'], linktexts=['Choose your gender.'], code="self.caller.obj.set_deity('%s')" % deity) nodes.append(confirm_node) if 'karith' in deity: text = copyreader.read_file( "%s/deities/ankarith_desc.txt" % copy_dir) deity_node = MenuNode( "%s" % deity, text=text, links=['confirm-ankarith', 'deity'], linktexts=[ 'Confirm Deity Selection', 'Back to Deities' ]) #self.obj.msg("links: %s, linktexts: %s" % (deity_node.links, deity_node.linktexts)) elif 'slyth' in deity: text = copyreader.read_file( "%s/deities/slyth_desc.txt" % copy_dir) deity_node = MenuNode("%s" % deity, text=text, links=['confirm-slyth', 'deity'], linktexts=[ 'Confirm Deity Selection', 'Back to Deities' ]) elif 'green warden' in deity: text = copyreader.read_file( "%s/deities/greenwarden_desc.txt" % copy_dir) deity_node = MenuNode( "%s" % deity, text=text, links=['confirm-green warden', 'deity'], linktexts=[ 'Confirm Deity Selection', 'Back to Deities' ]) elif 'kaylynne' in deity: text = copyreader.read_file( "%s/deities/kaylynne_desc.txt" % copy_dir) deity_node = MenuNode( "%s" % deity, text=text, links=['confirm-kaylynne', 'deity'], linktexts=[ 'Confirm Deity Selection', 'Back to Deities' ]) nodes.append(deity_node) deity_node_text = copyreader.read_file( "%s/deities/deities_desc.txt" % copy_dir) root_deity_node = MenuNode( "deity", text=deity_node_text, links=['ankarith', 'slyth', 'green warden', 'kaylynne'], linktexts=[ 'An\'Karith', 'Slyth of the Glade', 'The Green Warden', 'Kaylynne' ]) nodes.append(root_deity_node) elif 'gender' in option: confirm_male = MenuNode( "confirm-gender-male", links=['END'], linktexts=["Go forth"], code="self.caller.obj.set_gender('male')") confirm_female = MenuNode( "confirm-gender-female", links=['END'], linktexts=["Go forth"], code="self.caller.obj.set_gender('female')") nodes.append(confirm_male) nodes.append(confirm_female) text = """ --{rGender Selection{n-- Please select which gender you would like to be: """ gender_node = MenuNode( "gender", text=text, links=['confirm-gender-male', 'confirm-gender-female'], linktexts=['Male', 'Female']) nodes.append(gender_node) start_node = MenuNode( "START", text= "{bWelcome to Avaloria. Please proceed through the menu to customize your character.{n", links=['race'], linktexts=['Choose your race.']) nodes.append(start_node) node_string = ' '.join([node.key for node in nodes]) self.caller.msg("{mDEBUG: nodes: %s{n" % node_string) menutree = MenuTree(caller=self.caller, nodes=nodes) menutree.start()
def func(self): """ Tries to create the Character object. We also put an attribute on ourselves to remember it. """ # making sure caller is really a player self.character = None if utils.inherits_from(self.caller, "src.objects.objects.Object"): # An object of some type is calling. Convert to player. #print self.caller, self.caller.__class__ self.character = self.caller if hasattr(self.caller, "player"): self.caller = self.caller.player if not self.args: self.caller.msg("Usage: create <character name>") return charname = self.args.strip() old_char = managers.objects.get_objs_with_key_and_typeclass(charname, CHARACTER_TYPECLASS) if old_char: self.caller.msg("Character {c%s{n already exists." % charname) return # create the character new_character = create_object(CHARACTER_TYPECLASS, key=charname) if not new_character: self.caller.msg("{rThe Character couldn't be created. This is a bug. Please contact an admin.") return # make sure to lock the character to only be puppeted by this player new_character.locks.add("puppet:id(%i) or pid(%i) or perm(Immortals) or pperm(Immortals)" % (new_character.id, self.caller.id)) # save dbref avail_chars = self.caller.db._character_dbrefs if avail_chars: avail_chars.append(new_character.id) else: avail_chars = [new_character.id] self.caller.db._character_dbrefs = avail_chars self.caller.msg("{gThe Character {c%s{g was successfully created!" % charname) self.caller.obj = new_character attributes = new_character.db.attributes nodes = [] copy_dir = '/Users/geoffrey/gitrepos/avaloria/game/gamesrc/copy/' for option in ['race', 'deity', 'alignment', 'gender']: if 'race' in option: for race in ['bardok', 'erelania', 'the unknowns', 'earthen', 'gerdling']: confirm_node = MenuNode("confirm-%s" % race, links=['deity'], linktexts=['Choose your deity.'], code="self.caller.obj.set_race('%s')" % race) nodes.append(confirm_node) if 'bardok' in race: text = copyreader.read_file("%s/races/bardok_desc.txt" % copy_dir) race_node = MenuNode("%s" % race, text=text, links=['confirm-bardok', 'race'], linktexts=['Confirm Race Selection', 'Back to Races']) elif 'erelania' in race: text = copyreader.read_file("%s/races/erelania_desc.txt" % copy_dir) race_node = MenuNode("%s" % race, text=text, links=['confirm-erelania', 'race'], linktexts=['Confirm Race Selection', 'Back to Races']) elif 'gerdling' in race: text = copyreader.read_file("%s/races/gerdling_desc.txt" % copy_dir) race_node = MenuNode("%s" % race, text=text, links=['confirm-gerdling', 'race'], linktexts=['Confirm Race Selection', 'Back to Races']) elif 'earthen' in race: text = copyreader.read_file("%s/races/earthen_desc.txt" % copy_dir) race_node = MenuNode("%s" % race, text=text, links=['confirm-earthen', 'race'], linktexts=['Confirm Race Selection', 'Back to Races']) nodes.append(race_node) text = copyreader.read_file("%s/races/races_desc.txt" % copy_dir) root_race_node = MenuNode("%s" % option, text=text, links=['bardok', 'erelania', 'gerdling', 'earthen'], linktexts=['The Bardok', 'The Erelania', 'The Gerdling', 'The Earthen']) nodes.append(root_race_node) elif 'deity' in option: deities = ['ankarith', 'slyth', 'green warden', 'kaylynne'] for deity in deities: confirm_node = MenuNode('confirm-%s' % deity, links=['gender'], linktexts=['Choose your gender.'], code="self.caller.obj.set_deity('%s')" % deity) nodes.append(confirm_node) if 'karith' in deity: text = copyreader.read_file("%s/deities/ankarith_desc.txt" % copy_dir) deity_node = MenuNode("%s" % deity, text=text, links=['confirm-ankarith', 'deity'], linktexts=['Confirm Deity Selection', 'Back to Deities']) #self.obj.msg("links: %s, linktexts: %s" % (deity_node.links, deity_node.linktexts)) elif 'slyth' in deity: text = copyreader.read_file("%s/deities/slyth_desc.txt" % copy_dir) deity_node = MenuNode("%s" % deity, text=text, links=['confirm-slyth', 'deity'], linktexts=['Confirm Deity Selection', 'Back to Deities']) elif 'green warden' in deity: text = copyreader.read_file("%s/deities/greenwarden_desc.txt" % copy_dir) deity_node = MenuNode("%s" % deity, text=text, links=['confirm-green warden', 'deity'], linktexts=['Confirm Deity Selection', 'Back to Deities']) elif 'kaylynne' in deity: text = copyreader.read_file("%s/deities/kaylynne_desc.txt" % copy_dir) deity_node = MenuNode("%s" % deity, text=text, links=['confirm-kaylynne', 'deity'], linktexts=['Confirm Deity Selection', 'Back to Deities']) nodes.append(deity_node) deity_node_text = copyreader.read_file("%s/deities/deities_desc.txt" % copy_dir) root_deity_node = MenuNode("deity", text=deity_node_text, links=['ankarith', 'slyth', 'green warden', 'kaylynne'], linktexts=['An\'Karith', 'Slyth of the Glade', 'The Green Warden', 'Kaylynne']) nodes.append(root_deity_node) elif 'gender' in option: confirm_male = MenuNode("confirm-gender-male", links=['END'], linktexts=["Go forth"], code="self.caller.obj.set_gender('male')") confirm_female = MenuNode("confirm-gender-female", links=['END'], linktexts=["Go forth"], code="self.caller.obj.set_gender('female')") nodes.append(confirm_male) nodes.append(confirm_female) text = """ --{rGender Selection{n-- Please select which gender you would like to be: """ gender_node = MenuNode("gender", text=text, links=['confirm-gender-male', 'confirm-gender-female'], linktexts=['Male', 'Female']) nodes.append(gender_node) start_node = MenuNode("START", text="{bWelcome to Avaloria. Please proceed through the menu to customize your character.{n", links=['race' ], linktexts=['Choose your race.']) nodes.append(start_node) node_string = ' '.join([node.key for node in nodes]) self.caller.msg("{mDEBUG: nodes: %s{n" % node_string) menutree = MenuTree(caller=self.caller, nodes=nodes) menutree.start()
#HEADER from ev import create_object, search_object #CODE (Npcs) from ev import create_object, search_object caller.msg("Creating Battle Dummy") tutorial3 = search_object("tutorial3")[0] tut_enemynpc = create_object("game.gamesrc.objects.world.npc.Npc", key="Battle Dummy", location=tutorial3) desc = "What seems to be an animated..scarecrow...thing. \"Mmph...mppphhnnmm\" is the only sounds it seems capable of making.\n" desc += "In its hand materializes a magically summoned hammer and shield." tut_enemynpc.db.desc = desc tut_enemynpc.db.actions = { 'taunt': "Mpphhgmm mph, hpmmhhhgn!", "mock": "Hmmgpf mmpphmmgjf" } tut_enemynpc.rating = 'hero' tut_enemynpc.db.attributes['level'] = 1 tut_enemynpc.generate_attributes() caller.msg("Creating Kayleigh") tutorial1_room = search_object("tutorial1")[0] tutorial1_npc = create_object("game.gamesrc.objects.world.npc.Npc", key="Kayleigh", location=tutorial1_room) desc = "This striking woman is clearly far stronger than you and could probably kill you with a mere flick of her finger.\n" desc += "She is dressed in a black ensemble that hides all of her features except her eyes. As you look at her face, you\n" desc += "notice that her eyes are entirely white, though she does not seem to be blind." tutorial1_npc.desc = desc tutorial1_npc.name = "{Y!{n %s" % tutorial1_npc.name tutorial1_npc.db.real_name = "Kayleigh" tutorial1_npc.db.quests = ['Speak And Be Heard', 'Learning New Skills'] tutorial1_npc.db.merchant = False tutorial1_npc.db.quest_giver = True tutorial1_npc.db.trainer = False caller.msg("Creating Green Warden")