adding NPC generator

This commit is contained in:
evilchili 2023-07-04 12:14:23 -07:00
parent 6a09e6cf44
commit b96e46b67d
2 changed files with 59 additions and 3 deletions

View File

@ -26,7 +26,9 @@ pelican-sitemap = "^1.0.2"
pelican-yaml-metadata = { git = "https://github.com/pR0Ps/pelican-yaml-metadata.git", branch = "cdc1b9708916410e455e8e258e3d39a9d575c7b5" } pelican-yaml-metadata = { git = "https://github.com/pR0Ps/pelican-yaml-metadata.git", branch = "cdc1b9708916410e455e8e258e3d39a9d575c7b5" }
# local wotsits # local wotsits
dnd-npcs = { git = "https://github.com/evilchili/dnd-npcs", branch = 'main' } #dnd-npcs = { git = "https://github.com/evilchili/dnd-npcs", branch = 'main' }
#dnd-npcs = { path = "../../dnd-npcs" }
dnd-npcs = { file = "../../dnd-npcs/dist/dnd_npcs-0.2.0-py3-none-any.whl" }
elethis-cipher= { git = "https://github.com/evilchili/elethis-cipher", branch = 'main' } elethis-cipher= { git = "https://github.com/evilchili/elethis-cipher", branch = 'main' }
#dnd-rolltable = { git = "https://github.com/evilchili/dnd-rolltable", branch = 'main' } #dnd-rolltable = { git = "https://github.com/evilchili/dnd-rolltable", branch = 'main' }
dnd-rolltable = { file = "../../dnd-rolltable/dist/dnd_rolltable-1.1.9-py3-none-any.whl" } dnd-rolltable = { file = "../../dnd-rolltable/dist/dnd_rolltable-1.1.9-py3-none-any.whl" }

View File

@ -8,6 +8,8 @@ from rolltable.tables import RollTable
from site_tools.shell.base import BasePrompt, command from site_tools.shell.base import BasePrompt, command
from npc.generator.base import generate_npc
BINDINGS = KeyBindings() BINDINGS = KeyBindings()
@ -26,6 +28,7 @@ class DMShell(BasePrompt):
[ [
("", " [?] Help "), ("", " [?] Help "),
("", " [F2] Wild Magic Table "), ("", " [F2] Wild Magic Table "),
("", " [F3] NPC"),
("", " [^Q] Quit "), ("", " [^Q] Quit "),
] ]
) )
@ -44,6 +47,50 @@ class DMShell(BasePrompt):
def wmt(event): def wmt(event):
self.wmt() self.wmt()
@self.key_bindings.add("f3")
def npc(event):
self.npc()
@command(usage="""
[title]NPC[/title]
Generate a randomized NPC commoner.
[title]USAGE[/title]
[link]> npc \\[ANCESTRY\\][/link]
[title]CLI[/title]
[link]npc --ancestry ANCESTRY[/link]
""", completer=WordCompleter(
[
'human',
'dragon',
'drow',
'dwarf',
'elf',
'highelf',
'halfling',
'halforc',
'tiefling',
'hightiefling',
]
))
def npc(self, parts=[]):
"""
Generate an NPC commoner
"""
c = generate_npc(ancestry=parts[0] if parts else None)
self.console.print("\n".join([
"",
f"{c.description}",
f"Personality: {c.personality}",
f"Flaw: {c.flaw}",
f"Goal: {c.goal}",
"",
]))
@command(usage=""" @command(usage="""
[title]QUIT[/title] [title]QUIT[/title]
@ -104,7 +151,14 @@ class DMShell(BasePrompt):
[link]loc LOCATION[/link] [link]loc LOCATION[/link]
""", """,
completer=WordCompleter(["The Blooming Wastes", "Dust River Canyon", "Gopher Gulch", "Calamity Ridge"]), completer=WordCompleter(
[
"The Blooming Wastes",
"Dust River Canyon",
"Gopher Gulch",
"Calamity Ridge"
]
),
) )
def loc(self, parts=[]): def loc(self, parts=[]):
""" """
@ -144,7 +198,7 @@ class DMShell(BasePrompt):
sources/sahwat_magic_table.yaml \\ sources/sahwat_magic_table.yaml \\
--frequency default --die 20[/link] --frequency default --die 20[/link]
""") """)
def wmt(self, *parts, source="sahwat_magic_table.yaml"): def wmt(self, parts=[], source="sahwat_magic_table.yaml"):
""" """
Generate a Wild Magic Table for resolving spell effects. Generate a Wild Magic Table for resolving spell effects.
""" """