Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class EditCmd(Command):
- """
- Edit command for rooms, objects, mobs, and more! The power is in your hands.
- Usage
- edit [thing] [attribute] [value]
- If no arguments are supplied, stats the current room. If only [thing] is supplied,
- performs a stat command on that [thing]. With [thing] and [attribute], will attempt
- to help you understand what values you can supply. The command should not let you set
- things you shouldn't set....mostly.
- """
- key = "edit"
- locks = "perm(Builders)"
- help_category = "Building"
- def func(self):
- if not self.args.strip():
- self.msg(stat_render(self, self.caller.location))
- return
- self.args = self.args.strip().split(" ", 2)
- obj = self.caller.search(self.args[0], global_search=True)
- if not obj:
- return
- if len(self.args) == 1:
- self.msg(stat_render(self, obj))
- return
- # if self.args[1] in 'description':
- # self.args[1] = 'desc'
- # if self.args[1] in 'nightdescription':
- # self.args[1] = 'nightdesc'
- if len(self.args) == 2:
- if not obj.attributes.has(self.args[1]):
- self.msg('{} has no atrribute: {}'.format(obj, self.args[1]))
- self.msg(obj.attributes.get(self.args[1]))
- if self.args[1] == 'desc' or self.args[1] == 'nightdesc':
- def load(caller):
- "get the current value"
- return caller.attributes.get(self.args[1])
- def save(caller, buffer):
- "save the buffer"
- caller.attributes.set("{}".format(self.args[1]), buffer)
- def quit(caller):
- "Since we define it, we must handle messages"
- caller.msg("Editor exited")
- eveditor.EvEditor(self.caller,
- loadfunc=load, savefunc=save, quitfunc=quit,
- key=self.args[1], persistent=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement