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)
def data_items(self, ctx, data): r = items.ls() #r.sort(key=attrgetter('name')) return r