Fix prompt command to show correct active template
This commit is contained in:
parent
7ae82480bc
commit
9a4ceca74b
1 changed files with 12 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
"""Prompt customization command."""
|
"""Prompt customization command."""
|
||||||
|
|
||||||
from mudlib.player import Player
|
from mudlib.player import Player
|
||||||
from mudlib.prompt import DEFAULT_TEMPLATES
|
from mudlib.prompt import ADMIN_TEMPLATES, DEFAULT_TEMPLATES
|
||||||
|
|
||||||
|
|
||||||
async def cmd_prompt(player: Player, args: str) -> None:
|
async def cmd_prompt(player: Player, args: str) -> None:
|
||||||
|
|
@ -15,9 +15,17 @@ async def cmd_prompt(player: Player, args: str) -> None:
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
# Show current template and available variables
|
# Show current template and available variables
|
||||||
current = player.prompt_template or DEFAULT_TEMPLATES.get(
|
if player.prompt_template:
|
||||||
player.mode, "{stamina_gauge} {pl} > "
|
current = player.prompt_template
|
||||||
|
elif player.paint_mode:
|
||||||
|
current = DEFAULT_TEMPLATES["paint"]
|
||||||
|
elif player.is_admin:
|
||||||
|
current = ADMIN_TEMPLATES.get(
|
||||||
|
player.mode,
|
||||||
|
DEFAULT_TEMPLATES.get(player.mode, "{stamina_gauge} {pl} > "),
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
current = DEFAULT_TEMPLATES.get(player.mode, "{stamina_gauge} {pl} > ")
|
||||||
msg = f"Current prompt: {current}\r\n\r\n"
|
msg = f"Current prompt: {current}\r\n\r\n"
|
||||||
msg += "Available variables:\r\n"
|
msg += "Available variables:\r\n"
|
||||||
msg += " stamina_pct - stamina percentage (0-100)\r\n"
|
msg += " stamina_pct - stamina percentage (0-100)\r\n"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue