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()
Exemple #2
0
 def set_description(self, copy_file):
     self.db.long_description = copyreader.read_file(copy_file)
Exemple #3
0
    def generate_mob_type(self):
        split_level_range = self.location.db.zone_level.split(';')
        low = int(split_level_range[0])
        high = int(split_level_range[1])
        level = random.randrange(low, high)
        if 'crypt' in self.db.dungeon_type:
            self.db.ratings = ['average', 'strong']
            self.db.skeleton_prefixes = [ 'Charred', 'Darkbone', 'Earthen', 'Frail']
            self.db.zombie_prefixes = ['Headless', 'Rotting', 'Bloated', 'Crazed']
            self.db.ghoul_prefixes = ['Hungry', 'Blood-stained', 'Slobbering', 'Disgusting']
            self.db.apparition_prefixes = ['Shadowy', 'Smokey', 'Skeletal', 'Chillborn']
            self.db.average_mob_names = ['Skeleton', 'Zombie', 'Ghoul', 'Apparition' ]
            mob_name = random.choice(self.db.average_mob_names)
            if 'Skeleton' in mob_name:
                prefix = random.choice(self.db.skeleton_prefixes)
            elif 'Zombie' in mob_name:
                prefix = random.choice(self.db.zombie_prefixes)
            elif 'Ghoul' in mob_name:
                prefix = random.choice(self.db.ghoul_prefixes)
            elif 'Apparition' in mob_name:
                prefix = random.choice(self.db.apparition_prefixes)
            mob_name = "%s %s" % (prefix, mob_name)
            mob = create.create_object("game.gamesrc.objects.world.mob.Mob", key = "%s" % mob_name, location=self.location) 
            mob.aliases = ['%s_mobs' % self.dbref, 'kill_dungeon_mobs', 'mob_runner', 'irregular_runner', 'kill_crypt_mobs', 'crypt_mobs', 'kill_undead', 'kill_%s' % mob.name.lower()]
            try:
                mob.desc = copyreader.read_file("gamesrc/copy/mobs/%s_%s.txt" % (prefix.lower(), mob_name.lower()))
            except:
                mob.desc = "Placeholder, no desc written"
            mob.db.attributes['level'] = level
            mob.db.rating = random.choice(self.db.ratings)
            mob.db.is_kos = True
            mob.db.mob_type = 'undead'
        elif 'ruins' in self.db.dungeon_type:
            self.db.ratings = ['average', 'strong']
            self.db.spider_prefixes = [ 'Common', 'Large', 'Hulking', 'Behemoth' ]
            self.db.pigmy_prefixes = [ 'Small', 'Mature', 'Young']
            self.db.gnoll_prefixes = [ 'Juvenile', 'Adult', 'Ancient']
            self.db.ancestral_spirit_prefixes = [ 'Ethereal', 'Shadowy', 'Lightbourne', 'Ancestral' ]
            self.db.average_mob_names = ['Spider', 'Pigmy', 'Spirit', 'Gnoll']
            mob_name_original = random.choice(self.db.average_mob_names)
            if 'Spider' in mob_name_original:
                prefix = random.choice(self.db.spider_prefixes)
            elif 'Pigmy' in mob_name_original:
                prefix = random.choice(self.db.pigmy_prefixes)
            elif 'Spirit' in mob_name_original:
                prefix = random.choice(self.db.ancestral_spirit_prefixes)
            elif 'Gnoll' in mob_name_original:
                prefix = random.choice(self.db.gnoll_prefixes)
            mob_name = "%s %s" % (prefix, mob_name_original)
            mob = create.create_object("game.gamesrc.objects.world.mob.Mob", key="%s" % mob_name, location=self.location)
            mob.aliases = ['%s_mobs' % self.dbref, 'kill_dungeon_mobs','mob_runner', 'irregular_runner', 'ruins_mobs', 'kill_ruins_mobs', 'kill_%s' % mob_name_original.lower()]
            mob.db.attributes['level'] = level
            mob.db.rating = random.choice(self.db.ratings)
            mob.db.mob_type = '%s' % mob_name_original.lower()
            mob.db.is_kos= True
        elif 'marshlands' in self.db.dungeon_type:
            self.db.ratings = ['average', 'strong', 'hero']
            self.db.slythain_prefixes = [ 'Young', 'Mature', 'Adolescent' ]
            self.db.slythain_suffixes = [ 'Marauder', 'Assassin', 'Hunter', 'Tracker', 'Guardian' ]
            self.db.grasswhip_prefixes = [ 'Young', 'Adult', 'Weathered', 'Juvenile' ]
            self.db.bearcat_prefixes = [ 'Matriarch', 'Patriarch', 'Juvenile', 'Young' ]
            self.db.mob_names = ['Bearcat','Slythain', 'Grasswhip' ]
            mob_name_original = random.choice(self.db.mob_names)
            if 'Slythain' in mob_name_original:
                prefix = random.choice(self.db.slythain_prefixes)
                suffix = random.choice(self.db.slythain_suffixes)
                mob_name = "%s Slythain %s" % (prefix, suffix)
                desc = copyreader.read_file("gamesrc/copy/mobs/%s_%s.txt" % (mob_name_original.lower(), suffix.lower()))
                deity = 'slyth'
            elif 'Grasswhip' in mob_name_original:
                prefix = random.choice(self.db.grasswhip_prefixes)
                mob_name = "%s Grasswhip" % prefix
                desc = copyreader.read_file("gamesrc/copy/mobs/%s_%s.txt" % (prefix.lower(), mob_name_original.lower()))
                deity = 'slyth'
            elif 'Bearcat' in mob_name_original:
                deity = 'warden'
                prefix = random.choice(self.db.bearcat_prefixes)
                mob_name = "%s Bearcat" % prefix
                desc = copyreader.read_file("gamesrc/copy/mobs/%s_%s.txt" % (prefix.lower(), mob_name_original.lower()))
            mob = create.create_object("game.gamesrc.objects.world.mob.Mob", key = "%s" % mob_name, location=self.location)
            mob.db.deity = deity
            mob.desc = desc
            mob.aliases = ['%s_mobs' % self.dbref,'kill_%s' % deity, 'kill_%s' % mob_name.lower(), 'mob_runner', 'irregular_runner','kill_marshlands', 'kill_%s' % mob_name_original.lower(), 'marshlands_mobs']
            mob.db.attributes['level'] = level
            mob.db.rating = random.choice(self.db.ratings)
            mob.db.is_kos = True
            mob.db.mob_type = '%s' % mob_name_original.lower()
        elif 'tutorial' in self.db.dungeon_type:
            pass

        try:
            mob.generate_stats()
            mob.generate_skillset()
            mob.generate_rewards()
            mob.update_stats()
        except UnboundLocalError:
            return None

        rn = random.random()
        if rn <= .40:
            weapon = self.search('mob_blade', global_search=True, ignore_errors=True)[0]
            mob_weapon = weapon.copy()
            mob_weapon.move_to(mob, quiet=True)
            mob_weapon.name = weapon.name
            equipment = mob.db.equipment
            equipment['weapon'] = mob_weapon
            mob.db.equipment = equipment

        return mob
    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()
Exemple #5
0
    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()
        split_charname = charname.split(' ')
        if len(split_charname) > 2:
            self.caller.msg("Character name must be in the following format: Firstname Surname.  Or: Firstname.")
            return
        old_char = ObjectDB.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.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)
       
        if self.caller.swap_character(new_character):
            attributes = new_character.db.attributes
            nodes = []
            copy_dir = '/var/mud/evennia/game/gamesrc/copy/'
            for option in ['race', 'deity', 'alignment', 'gender', 'weapon skills', 'armor skills']:
                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.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.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=['weapons'], linktexts=['Choose which weapon to specialize in.'], code="self.caller.set_gender('male')")
                    confirm_female = MenuNode("confirm-gender-female", links=['weapons'], linktexts=['Choose which weapon to specialize in.'], code="self.caller.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)
                elif 'weapon skills' in option:
                    confirm_blades = MenuNode("confirm-blades", links=['armor'], linktexts=['Choose Armor Specialization .'], code="self.caller.set_weapon_skill('blades')")
                    confirm_heavy = MenuNode("confirm-heavy", links=['armor'], linktexts=['Choose Armor Specialization'], code="self.caller.set_weapon_skill('heavy')")
                    confirm_bludgeon = MenuNode("confirm-bludgeon", links=['armor'], linktexts=['Choose Armor Specialization.'], code="self.caller.set_weapon_skill('bludgeon')")
                    nodes.append(confirm_blades)
                    nodes.append(confirm_heavy)
                    nodes.append(confirm_bludgeon)
                    text = """
--{rWeapon Type Selection{n--
Please select which weapon type you would like to specialize in:

{GTypes:{n

{cBludgeoning{n - Weapons that bash and smash. (Maces, hammers, staves).
{cBladed{n - Weapons that slash and cut. (Swords, daggers, axes).
{cHeavy{n - Large, often two handed weaponry. (Bastard sword, Great Axe, Polearm).

Using weaponry you are not skilled in will result is an increased chance of scoring
only glancing blows on a target (damage / 2).  You may also take large and more
consistent balance reduction.
                    """
                    weapons_node = MenuNode("weapons", links=['confirm-bludgeon', 'confirm-blades', 'confirm-heavy'], linktexts=['Bludgeoning Weapons', 'Bladed Weapons', 'Heavy Weapons'], text=text)
                    nodes.append(weapons_node)
                elif 'armor skills' in option:
                    confirm_light = MenuNode("confirm-lightarmor", links=['END'], linktexts=['Begin Your Journey!'], code="self.caller.set_armor_skill('light')")
                    confirm_medium = MenuNode("confirm-mediumarmor", links=['END'], linktexts=['Begin Your Journey!'], code="self.caller.set_armor_skill('medium')")
                    confirm_heavy = MenuNode("confirm-heavyarmor", links=['END'], linktexts=['Begin Your Journey!'], code="self.caller.set_armor_skill('heavy')")  
                    nodes.append(confirm_light)
                    nodes.append(confirm_medium)
                    nodes.append(confirm_heavy)
                    text = """
--{rArmor Specilization{n--
Please select which armory type you would like to specialize in:

{GTypes:{n

{cLight{n - Lightweight, mobile armors. (leather, cloth).
{cMedium{n - Moderate weight, semi-mobile armor. (scalemail, ring mail, chainmail).
{cHeavy{n - Heavy weight, hard to move in armor. (plate and half plate)

Using armor you are not specialized in, will result in large balance loss which
in turn will result in stat loss and most likely death.
                    """
                    armor_node = MenuNode("armor", links=['confirm-lightarmor', 'confirm-mediumarmor', 'confirm-heavyarmor'], linktexts=['Light Armor', 'Medium Armor', 'Heavy Armor'], text=text)
                    nodes.append(armor_node)
                """
                elif 'alignment' in option:
                    confirm_good = MenuNode("confirm-good", links=['END'], linktexts=['Begin your journey.'], text="{rYou begin your journey down the path of light.{n", code="self.caller.set_alignment('good')")
                    confirm_evil = MenuNode("confirm-evil", links=['END'], linktexts=['Begin your journey.'], text="{rYou begin your journey down the path of darkness.{n", code="self.caller.set_alignment('evil')")
                    nodes.append(confirm_good)
                    nodes.append(confirm_evil)
                    text =
--{rAlignment Selection{n--
Which path to do you desire to walk?

                   
                    alignment_node = MenuNode("alignment", text=text, links=['confirm-evil', 'confirm-good', 'START'],
                                            linktexts=['Path of Darkness', 'Path of Light', 'Back to Customization'])
                    nodes.append(alignment_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)
            endnode = MenuNode("END", links=[], linktexts=[], code="self.caller.post_creation()")
            nodes.append(endnode)
#        node_string = ' '.join([node.key for node in nodes])
 #       self.obj.msg("{mDEBUG: nodes: %s{n" % node_string)
            menutree = MenuTree(caller=self.caller.character, nodes=nodes, exec_end=None)
            flags = new_character.db.flags
            flags['in_menu'] = True
            self.caller.db.flags = flags
            menutree.start()
Exemple #6
0
 def set_description(self, copy_file):
     self.db.long_description = copyreader.read_file(copy_file)