mudpy.git
18 years agoImported from archive.
Jeremy Stanley [Mon, 5 Sep 2005 03:43:11 +0000 (03:43 +0000)]
Imported from archive.

* menu (menu:activate_avatar): Add a default of the first avatar in
the list.
(menu:choose_name): Change the generate more names choice from m to
g and make it the default.
(menu:delete_avatar): Make abort the default choice and correct a
misleading copy/paste error in the prompt.

* menu (menu:delete_account), mudpy.py (User.delete): New menu and
supporting method to allow deletion of an existing account.

* mudpy.py (Element.get, Element.getboolean, Element.getdict)
(Element.getfloat, Element.getint, Element.getlist): Reworked
default parameter handling to fall back to the None type and then
replace it with the appropriate type of empty variable if not
overridden, solving obscure bugs arising from mutable sequence
reuse.
(get_choice_action, get_choice_branch, generic_menu_handler):
Consolidated default choice fallback into generic_menu_handler.

* testdata: Removed pending something better.

18 years agoImported from archive.
Jeremy Stanley [Fri, 2 Sep 2005 02:51:15 +0000 (02:51 +0000)]
Imported from archive.

* menu (menu:activate_avatar): New menu to delete an existing
avatar.

* menu (menu:delete_avatar), mudpy.py (User.delete_avatar): New menu
and supporting method to select an existing avatar.

18 years agoImported from archive.
Jeremy Stanley [Wed, 31 Aug 2005 03:28:44 +0000 (03:28 +0000)]
Imported from archive.

* command (control), menu (control): Locked these files to be
read-only, for added security.

* mudpy.conf (categories, control, include): Moved categories and
include elements to be control meta-element list facets called
default_files and include_files respectively, allowing them to be
utilized in multiple files within the data tree.
(control): Added a list facet called private_files which works like
default_files but creates them mode 0600, and moved the accounts
file to this list to prevent leaking MD5 password hashes for
accounts.
(internal:general): Renamed to internal:limits and added a
max_avatars int facet providing the means to cap the number an
account is allowed to have.

* mudpy.py (Element.get, Element.getdict, Element.getfloat)
(Element.getint, Element.getlist): Reworked to provide a means to
override the default values through a function parameter, similar to
getboolean.
(Element.set): Strip trailing L off long ints.
(handler_checking_new_account_name): Abstracted this entire function
out into the checking_new_account_name menu configuration.

18 years agoImported from archive.
Jeremy Stanley [Tue, 30 Aug 2005 00:03:05 +0000 (00:03 +0000)]
Imported from archive.

* all files: Lower-cased any MUDpy references to mudpy throughout
the code.

* muff: Collapsed the Python module package directory into a single
mudpy.py module for now, to simplify on-the-fly source code
reloading functionality (this will be re-split in a more effective
fashion later).

* testdata: New example data file with generic contents.

18 years agoImported from archive.
Jeremy Stanley [Sun, 28 Aug 2005 18:36:46 +0000 (18:36 +0000)]
Imported from archive.

* data/commands: Renamed to command and moved into the top-level
directory.

* data/universe, lib/index: Removed this sample data.

* lib/menus: Collapsed the contents of the directory into a menu
file within the top-level directory.

* lib/muff: Moved into the top-level directory.

* lib/muff, mudpy.py: Assorted minor code readability fixes and
additional comments. Replaced several more vague try/except
constructs with more specific if/then/else checks.

* lib/muff/muffcmds.py (command_time, command_show): Changed the
admin command time to be a parameter to the admin command show
instead.
(handler_checking_new_account_name, handler_entering_new_password)
(handler_verifying_new_password): Adjusted the fix for stray empty
accounts to create them upon entry but delete them again if no
password is successfully added, avoiding a potential race and
exception where two sockets start to create a user with the same
name.
(handler_entering_account_name): Disallow non-alphanumeric
characters in account names.

* lib/muff/muffconf.py: Replaced with object methods in class
definitions within muffuniv.py.

* mud.py: Renamed to mudpy matching, the executable to the project
name.

18 years agoImported from archive.
Jeremy Stanley [Thu, 25 Aug 2005 21:23:07 +0000 (21:23 +0000)]
Imported from archive.

* data/universe/rooms: Added a few example locations.

* lib/commands: Collapsed this directory into a single file.

* lib/muff/muffcmds.py, lib/muff/muffmisc.py, lib/muff/muffvars.py:
Replaced some risky try/except constructs with if/then/else
clauses.

* lib/muff/muffcmds.py (command_show): Added files and universe
parameter options.

* lib/muff/muffmisc.py (getlong, repr_long, setlong): Folded into
getint and friends.

* lib/muff/muffvars.py (save): Finished migrating into the
muffuniv.Universe.save method.
(variable_data): Moved to muffuniv.Universe.internals dict.

18 years agoImported from archive.
Jeremy Stanley [Thu, 25 Aug 2005 02:25:34 +0000 (02:25 +0000)]
Imported from archive.

* lib/menus/active: Merged into lib/menus/miscellaneous and removed.

* lib/menus/miscellaneous (choose_gender, choose_name)
(main_utility): Added menus to enter/exit the game, select gender
and pick a randomly-generated avatar name from a list.

* lib/muff/muffcmds.py: Changed user state names to employ
underscores instead of spaces.
(command_show): New admin command to ease debugging of data
relationships.
(generic_menu_handler): New function abstract out common routines
from typical menu state handlers.
(handle_user_input): For aesthetics, user input is now followed by a
blank line of output if we expect the client isn't echoing.

* lib/muff/muffmain.py (main): The main loop is now followed by a
muffiniv.universe.save during shutdown, in case any changes have
occurred since the last save.

* lib/muff/muffmenu.py
(get_menu): Refactored to be more modular, and broke out a lot of
its pieces into additional functions.
(get_choice_action, get_choice_branch, get_default_action)
(get_default_branch, get_default_menu_choice)
(get_formatted_default_menu_choice, get_formatted_menu_choices)
(get_menu_actions, get_menu_branches, get_menu_choices)
(get_menu_description, get_menu_prompt): New functions abstracted
out of the previously spaghetti-like get_menu function.
(get_echo_message, get_echo_sequence, menu_echo_on): New functions
to take care of enabling and disabling echo for password prompts.

* lib/muff/muffmisc.py (replace_macros): Implemented gender-specific
pronoun replacement macros, to make English-language messages less
awkward.

* lib/muff/muffuniv.py: New module implementing DataFile, Element
and Universe classes, for a more object-oriented approach.

* muff: Renamed to mud.py.

* muff.conf: Renamed to mudpy.conf.

18 years agoImported from archive.
Jeremy Stanley [Fri, 5 Aug 2005 15:54:48 +0000 (15:54 +0000)]
Imported from archive.

* lib/menus/login (disconnecting duplicates), lib/menus/miscellaneous
(disconnecting), lib/muff/muffcmds.py (handler_checking_password):
Messages are now colored in ANSI red.

* lib/muff/muffcmds.py (command_halt): Added a reason message
parameter which gets logged and broadcast to all connected users.
(command_reload): Now gets logged when run.
(command_say): Disallowed replacement macro sequences and refactored
the correction routines, abstracting the punctuation and typo maps
out into configuration.
(command_time): New admin command to report current world time in
elapsed increments.
(handle_user_input): Switched to a generic caller based dynamically
based on the user state names.
(handler_disconnecting, handler_disconnecting_duplicates): Added
code to handle disconnecting an existing socket for a user who
successfully authenticates on a new socket.
(handler_entering_account_name): Now adds a log entry when a user
logs into an account.
(handler_fallthrough): Removed.

* lib/muff/muffconf.py: Refactored the initial config file finding
routines to be more robust.
(get, getfloat, getint, set): New convenience
functions for calling the corresponding Data class methods.

* lib/muff/muffmain.py (main): Ammended the loop to continue, giving
the next pulse an opportunity to more courteously disconnect active
user sockets.

* lib/muff/muffmain.py (main), lib/muff/muffmisc.py (on_pulse):
Relocated more loop content.

* lib/muff/muffmisc.py (broadcast): For aesthetics, an additional
blank line is now prepended to output.
(getlong, repr_long, setlong): Additional functions implemented to
deal with Python's long integer representation format.
(reload_data): New function allowing the admin reload command to
refreshe already instantiated objects by migrating their contents to
new ones and deleting the originals.

* lib/muff/muffuser.py (User.save): The account file is now
unconditionally set to 0600 permissions for additional protection of
the MD5 password hashes.

18 years agoImported from archive.
Jeremy Stanley [Sat, 30 Jul 2005 17:04:00 +0000 (17:04 +0000)]
Imported from archive.

* lib/muff/muffcmds.py (command_quit): Replaced with a disconnecting
state.
(handle_user_input): Reorganized the user state handlers.
(handler_entering_account_name): Fixed a race condition where empty
accounts would be created even if the user never got around to
entering a password before disconnecting.

* lib/muff/muffmisc.py (log): New function to abstract logging of
arbitrary information, for later flexibility.
(random_name, weighted_choice): Added a random name generator
function for later use.

18 years agoImported from archive.
Jeremy Stanley [Thu, 21 Jul 2005 20:19:02 +0000 (20:19 +0000)]
Imported from archive.

* bin/muff, lib/muff: Replaced the embedded license copies with
pointers to the LICENSE file. Added lots of in-line code commentary
and docstrings. Refactored some blocks of code for improved
readability.

* bin/muff, etc/mudpy.conf: Moved to the top-level directory.

* doc/license: Renamed to LICENSE and moved it to the top-level
directory.

* lib/muff/muffcmds.py (command_null): Removed.
(command_say): Additional output cleanup.

* lib/muff/muffmain.py (main): More robust handling for variable
files.

* lib/muff/muffmisc.py (wrap_ansi_text): Minor word-wrapping fix.
(User.__init__): Added tracking of last login address.

18 years agoImported from archive.
Jeremy Stanley [Mon, 18 Jul 2005 22:24:29 +0000 (22:24 +0000)]
Imported from archive.

* Initial commit of working project files.

18 years agoImported from archive.
Jeremy Stanley [Sat, 16 Jul 2005 22:22:13 +0000 (22:22 +0000)]
Imported from archive.

* New project.