X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=blobdiff_plain;f=lib%2Fmudpy%2Fmisc.py;h=2dc75c0cfcb857c04000e18af47baf9fe348ebeb;hp=bf107a4bd59f770f44002282d7bb768d4625f09b;hb=f2e017445df6026bcde0000b2490caee4ae1e7e3;hpb=c107f5282c9c7356103a5556a7173aa35a5805ec diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index bf107a4..2dc75c0 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -685,13 +685,8 @@ class User: if self.state is not "authenticated": log("User " + self.account.get("name") + " logged in.", 2) self.authenticated = True - if self.account.subkey in universe.categories[ - "internal" - ][ - "limits" - ].get( - "default_admins" - ): + if self.account.subkey in universe.contents["mudpy.limit"].get( + "admins"): self.account.set("administrator", "True") def show_menu(self): @@ -908,8 +903,7 @@ class User: # log non-printable characters remaining if mudpy.telnet.is_enabled(self, mudpy.telnet.TELOPT_BINARY, mudpy.telnet.HIM): - asciiline = b"".join( - filter(lambda x: b" " <= x <= b"~", line)) + asciiline = bytes([x for x in line if 32 <= x <= 126]) if line != asciiline: logline = "Non-ASCII characters from " if self.account and self.account.get("name"): @@ -1761,13 +1755,8 @@ def handler_checking_password(user): user.state = "main_utility" # if at first your hashes don't match, try, try again - elif user.password_tries < universe.categories[ - "internal" - ][ - "limits" - ].get( - "password_tries" - ) - 1: + elif user.password_tries < universe.contents["mudpy.limit"].get( + "password_tries") - 1: user.password_tries += 1 user.error = "incorrect" @@ -1800,13 +1789,8 @@ def handler_entering_new_password(user): user.state = "verifying_new_password" # the password was weak, try again if you haven't tried too many times - elif user.password_tries < universe.categories[ - "internal" - ][ - "limits" - ].get( - "password_tries" - ) - 1: + elif user.password_tries < universe.contents["mudpy.limit"].get( + "password_tries") - 1: user.password_tries += 1 user.error = "weak" @@ -1835,13 +1819,8 @@ def handler_verifying_new_password(user): # go back to entering the new password as long as you haven't tried # too many times - elif user.password_tries < universe.categories[ - "internal" - ][ - "limits" - ].get( - "password_tries" - ) - 1: + elif user.password_tries < universe.contents["mudpy.limit"].get( + "password_tries") - 1: user.password_tries += 1 user.error = "differs" user.state = "entering_new_password" @@ -2055,11 +2034,11 @@ def command_say(actor, parameters): if message: # match the punctuation used, if any, to an action - actions = universe.categories["internal"]["language"].get( + actions = universe.contents["mudpy.linguistic"].get( "actions" ) default_punctuation = ( - universe.categories["internal"]["language"].get( + universe.contents["mudpy.linguistic"].get( "default_punctuation")) action = "" @@ -2084,7 +2063,7 @@ def command_say(actor, parameters): message = message[0].lower() + message[1:] # iterate over all words in message, replacing typos - typos = universe.categories["internal"]["language"].get( + typos = universe.contents["mudpy.linguistic"].get( "typos" ) words = message.split() @@ -2184,8 +2163,8 @@ def command_show(actor, parameters): elif arguments[0] == "element": if len(arguments) != 2: message = "You must specify one element." - elif arguments[1] in universe.contents: - element = universe.contents[arguments[1]] + elif arguments[1].strip(".") in universe.contents: + element = universe.contents[arguments[1].strip(".")] message = ("These are the properties of the \"" + arguments[1] + "\" element (in \"" + element.origin.filename + "\"):$(eol)")