X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=blobdiff_plain;f=mudpy%2Fmenu.py;h=b3851986e61bf83db8a24373e9bb46ce4775c15a;hp=a1d18f74b3fe0da478811afd6930e3ce46766509;hb=9dc3f8de8d178b629852c6a6cdbbfc81214e09b8;hpb=04f0120c2208fe2335905943f94f66eee8fa74b7 diff --git a/mudpy/menu.py b/mudpy/menu.py index a1d18f7..b385198 100644 --- a/mudpy/menu.py +++ b/mudpy/menu.py @@ -3,3 +3,34 @@ # Copyright (c) 2019 mudpy authors. Permission to use, copy, # modify, and distribute this software is granted under terms # provided in the LICENSE file distributed with this software. + + +def activate_avatar_action(user): + """Activate the selected avatar in the activate_avatar state.""" + return user.activate_avatar_by_index(int(user.choice) - 1) + + +def activate_avatar_action_a(user): + """Abort selection by doing nothing.""" + return True + + +def activate_avatar_create(user): + """List available avatars as choices for the activate_avatar state.""" + return dict( + [(str(x + 1), y) for x, y in enumerate(user.list_avatar_names())]) + + +def checking_new_account_name_action_d(user): + """Destroy the new account because the user asked to disconnect.""" + return user.account.destroy() + + +def checking_new_account_name_action_g(user): + """Destroy the new account, the user asked to go back to name entry.""" + return user.account.destroy() + + +def choose_gender_action(user): + """Set the avatar's gender to the selected value.""" + return user.avatar.set("gender", user.menu_choices[user.choice])