From cdbd92397bd8d49feab2a0521dc2ee57187cd237 Mon Sep 17 00:00:00 2001 From: evilchili Date: Mon, 4 Dec 2023 22:00:37 -0800 Subject: [PATCH] updating for new npc generator --- deadsands/site_tools/jobs.py | 9 +++--- .../site_tools/shell/interactive_shell.py | 31 +++++++------------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/deadsands/site_tools/jobs.py b/deadsands/site_tools/jobs.py index 21d717d..dfc74d6 100644 --- a/deadsands/site_tools/jobs.py +++ b/deadsands/site_tools/jobs.py @@ -3,8 +3,7 @@ import collections from pathlib import Path from rolltable.tables import RollTable -from npc.generator.base import generate_npc - +from npc import random_npc Crime = collections.namedtuple('Crime', ['name', 'min_bounty', 'max_bounty']) @@ -39,7 +38,7 @@ class BaseJob: self._name = name self._details = details self._reward = reward - self._contact = contact or generate_npc() + self._contact = contact or random_npc() self._location = location @property @@ -129,7 +128,7 @@ class Bounty(BaseJob): @property def target(self): if not self._target: - self._target = generate_npc() + self._target = random_npc() return self._target @@ -144,7 +143,7 @@ class Determinant(BaseJob): class Escort(BaseJob): def __init__(self, **kwargs): super().__init__(**kwargs) - self._contact = generate_npc() + self._contact = random_npc() self._location = generate_location('settlements') self._destination = generate_location('default') self._reward = f"{nearest(random.randint(5, 20), step=5)} GP/day" diff --git a/deadsands/site_tools/shell/interactive_shell.py b/deadsands/site_tools/shell/interactive_shell.py index 2d4482d..aa731d3 100644 --- a/deadsands/site_tools/shell/interactive_shell.py +++ b/deadsands/site_tools/shell/interactive_shell.py @@ -10,13 +10,16 @@ from site_tools.shell.base import BasePrompt, command from site_tools import campaign from site_tools import jobs -from npc.generator.base import generate_npc from reckoning.calendar import TelisaranCalendar from reckoning.telisaran import Day from reckoning.telisaran import ReckoningError +import npc + BINDINGS = KeyBindings() +ANCESTRY_PACK, ANCESTRIES = npc.load_ancestry_pack() + class DMShell(BasePrompt): def __init__(self, cache={}): @@ -203,31 +206,19 @@ class DMShell(BasePrompt): [title]CLI[/title] [link]npc --ancestry ANCESTRY[/link] - """, completer=WordCompleter( - [ - 'human', - 'dragon', - 'drow', - 'dwarf', - 'elf', - 'highelf', - 'halfling', - 'halforc', - 'tiefling', - 'hightiefling', - ] - )) + """, completer=WordCompleter(list(ANCESTRIES.keys()))) def npc(self, parts=[]): """ Generate an NPC commoner """ - c = generate_npc(ancestry=parts[0] if parts else None) + char = npc.random_npc([parts[0]] if parts else []) + self.console.print(char.ancestry.capitalize()) self.console.print("\n".join([ "", - f"{c.description}", - f"Personality: {c.personality}", - f"Flaw: {c.flaw}", - f"Goal: {c.goal}", + f"{char.description}", + f"Personality: {char.personality}", + f"Flaw: {char.flaw}", + f"Goal: {char.goal}", "", ]))