1 """Utility functions for menu operation."""
3 # Copyright (c) 2019 mudpy authors. Permission to use, copy,
4 # modify, and distribute this software is granted under terms
5 # provided in the LICENSE file distributed with this software.
8 def activate_avatar_action(user):
9 """Activate the selected avatar in the activate_avatar state."""
10 return user.activate_avatar_by_index(int(user.choice) - 1)
13 def activate_avatar_action_a(user):
14 """Abort selection by doing nothing."""
18 def activate_avatar_create(user):
19 """List available avatars as choices for the activate_avatar state."""
21 [(str(x + 1), y) for x, y in enumerate(user.list_avatar_names())])
24 def checking_new_account_name_action_d(user):
25 """Destroy the new account because the user asked to disconnect."""
26 return user.account.destroy()
29 def checking_new_account_name_action_g(user):
30 """Destroy the new account, the user asked to go back to name entry."""
31 return user.account.destroy()
34 def choose_gender_action(user):
35 """Set the avatar's gender to the selected value."""
36 return user.avatar.set("gender", user.menu_choices[user.choice])