diff --git a/src/commands/comsys.py b/src/commands/comsys.py index 697c7e08f3..90f9466437 100644 --- a/src/commands/comsys.py +++ b/src/commands/comsys.py @@ -91,7 +91,7 @@ def cmd_delcom(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("You must specify a channel alias.") + source_object.emit_to("Usage: delcom ") return try: @@ -255,7 +255,7 @@ def cmd_cdestroy(command): cname = command.command_argument if not cname: - source_object.emit_to("You must supply a name!") + source_object.emit_to("Usage: @cdestroy ") return name_matches = comsys.cname_search(cname, exact=True) @@ -302,7 +302,7 @@ def cmd_cboot(command): switches = command.command_switches if not args or not "=" in args: - source_object.emit_to("Usage: @cboot[/quiet] =") + source_object.emit_to("Usage: @cboot[/quiet] = ") return cname, objname = args.split("=",1) cname, objname = cname.strip(), objname.strip() @@ -364,7 +364,7 @@ def cmd_cemit(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("Channel emit what?") + source_object.emit_to("@cemit[/switches] = ") return eq_args = command.command_argument.split('=', 1) @@ -373,8 +373,8 @@ def cmd_cemit(command): source_object.emit_to("You must provide a channel name and a message to emit.") return - cname = eq_args[0] - cmessage = eq_args[1] + cname = eq_args[0].strip() + cmessage = eq_args[1].strip() final_cmessage = cmessage if len(cname) == 0: source_object.emit_to("You must provide a channel name to emit to.") @@ -440,7 +440,7 @@ def cmd_cwho(command): if not command.command_argument: cmd_clist(command) - source_object.emit_to("You must specify a channel name.") + source_object.emit_to("Usage: @cwho [/all]") return channel_name = command.command_argument @@ -477,7 +477,7 @@ def cmd_ccreate(command): cname = command.command_argument if not cname: - source_object.emit_to("You must supply a name!") + source_object.emit_to("Usage @ccreate ") return if not source_object.has_perm("objects.channel_admin"): @@ -504,9 +504,10 @@ def cmd_cchown(command): source_object = command.source_object args = command.command_argument if not args or "=" not in args: - source_object.emit_to("Usage: @cchown =") + source_object.emit_to("Usage: @cchown = ") return cname, pname = args.split("=",1) + cname, pname = cname.strip(), pname.strip() #locate channel try: channel = CommChannel.objects.get(name__iexact=cname) diff --git a/src/commands/general.py b/src/commands/general.py index 71ca9c62b4..0710fe3118 100644 --- a/src/commands/general.py +++ b/src/commands/general.py @@ -24,7 +24,7 @@ def cmd_password(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("This command requires arguments.") + source_object.emit_to("Usage: @password = ") return if not source_object.is_player(): @@ -342,7 +342,7 @@ def cmd_quit(command): """ if command.session: session = command.session - session.msg("Quitting!") + session.msg("Quitting. Hope to see you soon again.") session.handle_close() GLOBAL_CMD_TABLE.add_command("quit", cmd_quit) diff --git a/src/commands/info.py b/src/commands/info.py index 83898cdc88..a96c61038d 100644 --- a/src/commands/info.py +++ b/src/commands/info.py @@ -63,7 +63,7 @@ def cmd_list(command): server = command.session.server source_object = command.source_object - msg_invalid = "Unknown option. Use one of: commands, flags, process" + msg_invalid = "Usage @list commands|flags|process" if not command.command_argument: source_object.emit_to(msg_invalid) @@ -131,4 +131,4 @@ def cmd_stats(command): stats_dict["things"], stats_dict["players"], stats_dict["garbage"])) -GLOBAL_CMD_TABLE.add_command("@stats", cmd_stats), \ No newline at end of file +GLOBAL_CMD_TABLE.add_command("@stats", cmd_stats), diff --git a/src/commands/objmanip.py b/src/commands/objmanip.py index d2a6646b83..26021c39c6 100644 --- a/src/commands/objmanip.py +++ b/src/commands/objmanip.py @@ -15,7 +15,7 @@ def cmd_teleport(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("Teleport where/what?") + source_object.emit_to("Usage: @teleport[/switches] [ =] |home") return eq_args = command.command_argument.split('=', 1) @@ -73,7 +73,7 @@ def cmd_alias(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("Alias whom?") + source_object.emit_to("Usage: @alias ") return eq_args = command.command_argument.split('=', 1) @@ -123,7 +123,7 @@ def cmd_wipe(command): attr_search = False if not command.command_argument: - source_object.emit_to("Wipe what?") + source_object.emit_to("Usage: @wipe [/attribute-wildcard]") return # Look for a slash in the input, indicating an attribute wipe. @@ -336,7 +336,7 @@ GLOBAL_CMD_TABLE.add_command("@cpattr", cmd_cpattr, def cmd_mvattr(command): """ - @mvattr =,[,]... + @mvattr =,[,[, ") return searchstring = command.command_argument @@ -439,7 +437,7 @@ def cmd_create(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("You must supply a name!") + source_object.emit_to("Usage: @create [:path_to_script_parent]") return eq_args = command.command_argument.split(':', 1) @@ -470,13 +468,15 @@ GLOBAL_CMD_TABLE.add_command("@create", cmd_create, def cmd_nextfree(command): - """ + """Usage: + @nextfree + Returns the next free object number. """ nextfree = Object.objects.get_nextfree_dbnum() command.source_object.emit_to("Next free object number: #%s" % nextfree) GLOBAL_CMD_TABLE.add_command("@nextfree", cmd_nextfree, - priv_tuple=("genperms.builder")) + priv_tuple=("genperms.builder"),auto_help=True) def cmd_open(command): """ @@ -490,7 +490,7 @@ def cmd_open(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("Open an exit to where?") + source_object.emit_to("Usage: @open [=dbref [,]]") return eq_args = command.command_argument.split('=', 1) @@ -562,7 +562,7 @@ def cmd_chown(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("Change the ownership of what?") + source_object.emit_to("Usage: @chown = ") return eq_args = command.command_argument.split('=', 1) @@ -613,7 +613,7 @@ def cmd_chzone(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("Change the zone of what?") + source_object.emit_to("Usage: @chzone = ") return eq_args = command.command_argument.split('=', 1) @@ -664,7 +664,7 @@ def cmd_link(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("Link what?") + source_object.emit_to("Usage: @link = ") return eq_args = command.command_argument.split('=', 1) @@ -715,7 +715,7 @@ def cmd_unlink(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("Unlink what?") + source_object.emit_to("Usage: @unlink ") return else: target_obj = source_object.search_for_object(command.command_argument) @@ -753,7 +753,7 @@ def cmd_dig(command): exits = [] if not args: - source_object.emit_to("Usage[/teleport]: @dig roomname [:parent] [=exitthere,exithere]") + source_object.emit_to("Usage[/teleport]: @dig roomname [:parent] [= exitthere, exithere]") return #handle arguments @@ -841,7 +841,7 @@ def cmd_name(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("What do you want to name?") + source_object.emit_to("Usage: = ") return eq_args = command.command_argument.split('=', 1) @@ -879,27 +879,32 @@ def cmd_description(command): Set an object's description. """ source_object = command.source_object - - if not command.command_argument: - source_object.emit_to("What do you want to describe?") - return - - eq_args = command.command_argument.split('=', 1) - - if len(eq_args) < 2: - source_object.emit_to("How would you like to describe that object?") - return + args = command.command_argument - target_obj = source_object.search_for_object(eq_args[0].strip()) - # Use search_for_object to handle duplicate/nonexistant results. - if not target_obj: + if not args: + source_object.emit_to("Usage: @desc [obj=] ") return - + + if not '=' in args: + target_obj = source_object.get_location() + if not target_obj: + return + new_desc = args.strip() + else: + eq_args = command.command_argument.split('=', 1) + target_obj = source_object.search_for_object(eq_args[0].strip()) + if not target_obj: + source_object.emit_to("'%s' was not found." % eq_args[0]) + return + if len(eq_args) < 2: + source_object.emit_to("You must supply a description too.") + return + new_desc = eq_args[1].strip() + if not source_object.controls_other(target_obj): source_object.emit_to(defines_global.NOCONTROL_MSG) return - - new_desc = eq_args[1].strip() + if not new_desc: source_object.emit_to("%s - description cleared." % target_obj) target_obj.set_attribute('desc', 'Nothing special.') @@ -1000,7 +1005,7 @@ def cmd_destroy(command): switches = command.command_switches if not args: - source_object.emit_to("Destroy what?") + source_object.emit_to("Usage: @destroy[/switches] obj [,obj2, obj3, ...]") return if ',' in args: targetlist = args.split(',') diff --git a/src/commands/parents.py b/src/commands/parents.py index 8a5fdf079e..7f280c7082 100644 --- a/src/commands/parents.py +++ b/src/commands/parents.py @@ -5,7 +5,9 @@ from src import scripthandler from src.cmdtable import GLOBAL_CMD_TABLE def cmd_scriptcache(command): - """ + """Usage + @scriptcache + Shows the contents of the script cache. """ cache_dict = scripthandler.CACHED_SCRIPTS @@ -18,7 +20,8 @@ def cmd_scriptcache(command): retval += "%d cached parents" % len(cache_dict) command.source_object.emit_to(retval) GLOBAL_CMD_TABLE.add_command("@scriptcache", cmd_scriptcache, - priv_tuple=("genperms.builder")) + priv_tuple=("genperms.builder"), + auto_help=True,staff_help=True) def cmd_parent(command): """ @@ -27,7 +30,7 @@ def cmd_parent(command): source_object = command.source_object if not command.command_argument: - source_object.emit_to("Change/check the parent of what?") + source_object.emit_to("Usage: @parent [=): connect ") + session.msg("No arguments provided.\n\r Usage (without <>): connect ") return arg_list = command.command_argument.split() if not functions_general.cmd_check_num_args(session, arg_list, 2): + session.msg("Not enough arguments provided.\n\r Usage (without <>): connect ") return uemail = arg_list[0] @@ -34,7 +35,7 @@ def cmd_connect(command): # No username match if email_matches.count() == 0: - session.msg("Specified email does not match any accounts!") + session.msg("The email '%s' does not match any accounts.\n\rIf you are new you should create a new account." % uemail) return # We have at least one result, so we can check the password. @@ -56,11 +57,12 @@ def cmd_create(command): # Argument check. # Fail gracefully if no argument is provided if not command.command_argument: - session.msg("No arguments provided\n Usage (without <>): create \"\" ") + session.msg("No arguments provided\n\r Usage (without <>): create \"\" ") return arg_list = command.command_argument.split() if not functions_general.cmd_check_num_args(session, arg_list, 2): + session.msg("Too few arguments provided\n\r Usage (without <>): create \"\" ") return quote_split = command.command_argument.split("\"") @@ -73,11 +75,17 @@ def cmd_create(command): lastarg_split = quote_split[2].split() if len(lastarg_split) != 2: - session.msg("You must specify an email address, followed by a password!") + session.msg("You must specify an email address, followed by a password.") return - email = lastarg_split[0] - password = lastarg_split[1] + email = lastarg_split[0].strip() + password = lastarg_split[1].strip() + + #check so the email is at least on the form xxxx@xxx.xxx + addr = email.split('@') + if len(addr) != 2 or not len(addr[1].split('.')) > 1 or not addr[1].split('.')[-1]: + session.msg("'%s' is not a valid e-mail address." % email) + return # Search for a user object with the specified username. account = User.objects.filter(username=uname) @@ -90,11 +98,11 @@ def cmd_create(command): type=defines_global.OTYPE_PLAYER) if not account.count() == 0 or not alias_matches.count() == 0: - session.msg("There is already a player with that name!") + session.msg("Sorry, there is already a player with that name.") elif not email_matches.count() == 0: - session.msg("There is already a player with that email address!") + session.msg("Sorry, there is already a player with that email address.") elif len(password) < 3: - session.msg("Your password must be 3 characters or longer.") + session.msg("Your password must be at least 3 characters or longer.\n\rFor best security, make it at least 8 characters long, avoid making it a real word and mix numbers into it.") else: Object.objects.create_user(command, uname, email, password) GLOBAL_UNCON_CMD_TABLE.add_command("create", cmd_create) @@ -106,6 +114,6 @@ def cmd_quit(command): version will be a bit more complicated. """ session = command.session - session.msg("Disconnecting...") + session.msg("Good bye! Disconnecting ...") session.handle_close() -GLOBAL_UNCON_CMD_TABLE.add_command("quit", cmd_quit) \ No newline at end of file +GLOBAL_UNCON_CMD_TABLE.add_command("quit", cmd_quit) diff --git a/src/objects/models.py b/src/objects/models.py index f1c58c7588..7f5dc523b1 100755 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -467,11 +467,10 @@ class Object(models.Model): uobj.is_active = False uobj.save() except: - functions_general.log_errmsg('Destroying object %s but no matching player.' - % (self,)) - + functions_general.log_errmsg('Destroying object %s but no matching player.' % (self,)) + # Set the object type to GOING - self.type = defines_global.OTYPE_GOING + self.type = defines_global.OTYPE_GOING # Destroy any exits to and from this room, do this first self.clear_exits() # Clear out any objects located within the object @@ -534,20 +533,24 @@ class Object(models.Model): # If for some reason it's still None... if not home: - functions_general.log_errmsg("Missing default home, %s '%s(#%d)' now has a null location." % (text, obj.name, obj.id)) + functions_general.log_errmsg("Missing default home, %s '%s(#%d)' now has a null location." % + (text, obj.name, obj.id)) if obj.is_player(): if obj.is_connected_plr(): if home: - obj.emit_to("Your current location has ceased to exist, moving you to your home %s(#%d)." % (home.name, home.id)) + obj.emit_to("Your current location has ceased to exist, moving you to your home %s(#%d)." % + (home.name, home.id)) else: # Famous last words: The player should never see this. - obj.emit_to("You seem to have found a place that does not exist.") + obj.emit_to("You seem to have found a place that does not exist ...") - # If home is still None, it goes to a null location. + # If home is still None, it goes to a null location. obj.move_to(home) obj.save() + + def set_attribute(self, attribute, new_value=None): """ Sets an attribute on an object. Creates the attribute if need @@ -899,7 +902,7 @@ class Object(models.Model): if force_look: self.execute_cmd('look') - + def dbref_match(self, oname): """ diff --git a/src/script_parents/basicobject.py b/src/script_parents/basicobject.py index f613dcc174..f0f0a7c080 100644 --- a/src/script_parents/basicobject.py +++ b/src/script_parents/basicobject.py @@ -90,7 +90,7 @@ class EvenniaBasicObject(object): obj = self.scripted_obj loc = obj.get_location() if loc: - loc.emit_to_contents("%s has left." % (obj.get_name(),), exclude=self) + loc.emit_to_contents("%s has left." % obj.get_name(), exclude=obj) if loc.is_player(): loc.emit_to("%s has left your inventory." % (obj.get_name())) @@ -101,9 +101,9 @@ class EvenniaBasicObject(object): obj = self.scripted_obj loc = obj.get_location() if loc: - loc.emit_to_contents("%s has arrived." % obj.get_name()) + loc.emit_to_contents("%s has arrived." % obj.get_name(), exclude=obj) if loc.is_player(): - loc.emit_to("%s is now in your inventory." % self.get_name()) + loc.emit_to("%s is now in your inventory." % obj.get_name()) def at_after_move(self): """ diff --git a/src/script_parents/basicplayer.py b/src/script_parents/basicplayer.py index 74e682df41..293850df71 100644 --- a/src/script_parents/basicplayer.py +++ b/src/script_parents/basicplayer.py @@ -64,7 +64,7 @@ class EvenniaBasicPlayer(object): obj = self.scripted_obj loc = obj.get_location() if loc: - loc.emit_to_contents("%s has left." % (obj.get_name(),), exclude=self) + loc.emit_to_contents("%s has left." % obj.get_name(), exclude=obj) if loc.is_player(): loc.emit_to("%s has left your inventory." % (obj.get_name())) @@ -75,7 +75,7 @@ class EvenniaBasicPlayer(object): obj = self.scripted_obj loc = obj.get_location() if loc: - loc.emit_to_contents("%s has arrived." % obj.get_name()) + loc.emit_to_contents("%s has arrived." % obj.get_name(),exclude=obj) if loc.is_player(): loc.emit_to("%s is now in your inventory." % obj.get_name())