updating rolltable interface
This commit is contained in:
parent
734645f559
commit
280949c9e7
|
@ -6,7 +6,7 @@ from pathlib import Path
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import typer
|
import typer
|
||||||
from rolltable.tables import RollTable
|
from rolltable.types import RollTable
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
from site_tools.content_manager import create
|
from site_tools.content_manager import create
|
||||||
|
|
|
@ -2,7 +2,7 @@ import random
|
||||||
import collections
|
import collections
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from rolltable.tables import RollTable
|
from rolltable.types import RollTable
|
||||||
from npc import random_npc
|
from npc import random_npc
|
||||||
|
|
||||||
Crime = collections.namedtuple('Crime', ['name', 'min_bounty', 'max_bounty'])
|
Crime = collections.namedtuple('Crime', ['name', 'min_bounty', 'max_bounty'])
|
||||||
|
|
|
@ -3,8 +3,7 @@ from pathlib import Path
|
||||||
from prompt_toolkit.application import get_app
|
from prompt_toolkit.application import get_app
|
||||||
from prompt_toolkit.completion import WordCompleter
|
from prompt_toolkit.completion import WordCompleter
|
||||||
from prompt_toolkit.key_binding import KeyBindings
|
from prompt_toolkit.key_binding import KeyBindings
|
||||||
from rich.table import Table
|
from rolltable.types import RollTable
|
||||||
from rolltable.tables import RollTable
|
|
||||||
|
|
||||||
from site_tools.shell.base import BasePrompt, command
|
from site_tools.shell.base import BasePrompt, command
|
||||||
from site_tools import campaign
|
from site_tools import campaign
|
||||||
|
@ -115,15 +114,11 @@ class DMShell(BasePrompt):
|
||||||
return self.date()
|
return self.date()
|
||||||
|
|
||||||
def _rolltable(self, source, frequency='default', die=20):
|
def _rolltable(self, source, frequency='default', die=20):
|
||||||
rt = RollTable(
|
return RollTable(
|
||||||
[Path(f"{self.cache['table_sources_path']}/{source}").read_text()],
|
[Path(f"{self.cache['table_sources_path']}/{source}").read_text()],
|
||||||
frequency=frequency,
|
frequency=frequency,
|
||||||
die=die
|
die=die
|
||||||
)
|
).as_table()
|
||||||
table = Table(*rt.rows[0])
|
|
||||||
for row in rt.rows[1:]:
|
|
||||||
table.add_row(*row)
|
|
||||||
return table
|
|
||||||
|
|
||||||
@command(usage="""
|
@command(usage="""
|
||||||
[title]DATE[/title]
|
[title]DATE[/title]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user