예제 #1
0
    def return_appearance(self, caller):
        message = []
        message.append(header(self.key, viewer=caller))
        message.append(self.db.desc)
        message.append(header())
        chars = self.list_characters()
        objects = self.list_non_characters()
        exits = []
        if self.exits:
             for exit in self.exits:
                 exits.append(exit.format_output(caller))
        table = evtable.EvTable("{wCharacters and Objects:{n", "{wExits:{n", table=[chars + objects, exits], border=None)
        table.reformat_column(0, width=39, align="l")
        message.append(table)
        message.append("\n")
        # if chars:
        #     message.append("\nCharacters:")
        #     for char in chars:
        #         message.append(char.key + "\n")


        message2 = []
        for line in message:
            message2.append(unicode(line))
        return "\n".join(message2)
예제 #2
0
def menu_attributes(caller, raw_input):
    cmd, args = _args(raw_input)
    target = caller.ndb.editchar or caller
    sheet_section = target.storyteller.sheet_dict['attribute']
    stats = sheet_section.choices

    message = list()
    message.append(header('Attributes Menu', viewer=caller))
    message.append(sheet_section.sheet_render())
    message.append(separator())
    message.append("Set your Attributes here with <attribute> <rating>. For instance, 'strength 5'. Partial Matches work.")
    text = '\n'.join(unicode(line) for line in message)

    option_list = list()

    for stat in stats:
        option_dict = dict()
        option_dict['key'] = stat.key
        option_dict['desc'] = '(%s #) - Set your %s Attribute!' % (stat.key, stat.name)
        option_dict['goto'] = 'menu_attributes'
        option_dict['exec'] = _set_attribute
        option_list.append(option_dict)

    option_list.append(BACK_DICT)

    return text, tuple(option_list)
예제 #3
0
def menu_template(caller, raw_input):
    cmd, args = _args(raw_input)
    target = caller.ndb.editchar or caller
    sheet_section = target.storyteller.sheet_dict['template']
    templates = target.storyteller_templates
    template_names = sorted(templates.keys(), key=lambda temp: templates[temp]['list_order'])

    options = [
        {
            'key': 'change',
            'goto': 'menu_template',
            'desc': '(change <choice>) Change to: %s' % ', '.join(dramatic_capitalize(name) for name in template_names),
            'exec': _change_template
        },
        {
            'key': 'essence',
            'goto': 'menu_template',
            'desc': '(essence #) Set your Essence.',
            'exec': _set_adv
        },
        {
            'key': 'willpower',
            'goto': 'menu_template',
            'desc': '(willpower #) Set your Willpower.',
            'exec': _set_adv
        }
    ]
    for field in target.storyteller.template.info_choices.keys():
        field_dict = dict()
        field_dict['key'] = field.lower()
        field_dict['goto'] = 'menu_template'
        field_dict['exec'] = _set_template_field
        if field in target.storyteller.template.info_choices:
            field_dict['desc'] = '(%s <text>) to set %s. Choices: %s' % (field, field,
                                                                         ', '.join(target.storyteller.template.info_choices[field]))
        else:
            field_dict['desc'] = '(%s <text>) to set %s' % (field, field)
        options.append(field_dict)

    options.append(BACK_DICT)

    message = list()
    message.append(header('Template Menu', viewer=caller))
    message.append(sheet_section.sheet_render())
    message.append('Here we shall try setting up the template!')
    text = '\n'.join(unicode(line) for line in message)
    return text, tuple(options)