예제 #1
0
    def owner_widget(self, name, data):
        if data is None:
            tzid=None
        else:
            tzid=data.tzid

        ps = players.ls()
        ms = mobs.ls()
        cs = ps + ms
        choices = [(c.tzid, '%s (%s)' % (c.name, c.tzid)) for c in cs]
        choices.insert(0, (None, 'None'))
        choices.sort(key=itemgetter(1))
        info = dict(name=name,
                    choices=choices,
                    selected=tzid)

        return self.render_form_select(info)
예제 #2
0
파일: wizard.py 프로젝트: cryptixman/tzmud
def cmd_list(s, r):
    '''list |players|items|rooms|mobs|exits|

    List all objects of the given type.

    '''

    listing = r['type']

    if listing == 'players':
        objs = players.ls()
        classes = []
    elif listing == 'items':
        objs = items.ls()
        classes = items.classes()
    elif listing == 'rooms':
        objs = rooms.ls()
        classes = rooms.classes()
    elif listing == 'mobs':
        objs = mobs.ls()
        classes = mobs.classes()
    elif listing == 'exits':
        objs = exits.ls()
        classes = exits.classes()

    if objs:
        s.message('Existing objects:')
        objs.sort(key=operator.attrgetter('tzid'))
        msgs = []
        for obj in objs:
            tzid = '(%s)' % obj.tzid
            msgs.append('%s %s' % (tzid.rjust(4, ' '), obj))
        s.mlmessage(msgs, indent=4)
    else:
        s.message('No', listing, 'yet.')

    if classes:
        classes = list(classes)
        classes.sort()
        if objs:
            s.message()
        s.message('Cloneable:')
        s.columns_v(classes, color=colors.white)
예제 #3
0
 def data_mobs(self, ctx, data):
     r = mobs.ls()
     #r.sort(key=attrgetter('name'))
     return r