1bdccb02fe27c566a23104ba93deeaf9ddc57b64
[mudpy.git] / mudpy / menu.py
1 """Utility functions for menu operation."""
2
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.
6
7
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)
11
12
13 def activate_avatar_action_a(user):
14     """Abort selection by doing nothing."""
15     return True
16
17
18 def activate_avatar_create(user):
19     """List available avatars as choices for the activate_avatar state."""
20     return dict(
21         [(str(x + 1), y) for x, y in enumerate(user.list_avatar_names())])