From 4cdf3a79af4202f39253956edeab44b3400e30c1 Mon Sep 17 00:00:00 2001 From: evilchili Date: Fri, 19 Jan 2024 15:53:53 -0800 Subject: [PATCH] restock now restocks all stores in a location --- .../content/stores/angry-andoks-apothecary.md | 43 ++++++++++------- deadsands/content/stores/generals-store.md | 42 +++++++++-------- deadsands/site_tools/cli.py | 47 ++++++++++--------- 3 files changed, 72 insertions(+), 60 deletions(-) diff --git a/deadsands/content/stores/angry-andoks-apothecary.md b/deadsands/content/stores/angry-andoks-apothecary.md index ca644ec..1092265 100644 --- a/deadsands/content/stores/angry-andoks-apothecary.md +++ b/deadsands/content/stores/angry-andoks-apothecary.md @@ -4,22 +4,21 @@ title: Angry Andok's Apothecary author: evilchili show_dm_content: False -location: Tano's Edge -tags: store -date: 2023-05-13 13:18:26.226450 +tags: post +date: 2024-01-19 15:52:02.250514 description: Was that a short joke?! I'll gut you! See if I don't!
--Andok status: published --- -Andok's is a cantankerous dwarf who specializes in nonmagical salves, potions, -and reagents. He makes a killing supplying hoppers who wisely avoid magical -healing when in the desert, but is notorious for his quick, violent temper and -contempt for, well, pretty much everything and everyone. He remains stubbornly -unaligned, but his wares are so useful the Liberty Sisters don't dare chase him -out of town. +Andok is a cantankerous dwarf who specializes in nonmagical salves, potions, and reagants. He makes a killing +supplying hoppers who wisely avoid magical healing when in the desert, but is notorious for his quick, violent +temper and contempt for, well, pretty much everything and everyone. He remains stubbornly unaligned, but his wares +are so useful the Liberty Sisters don't dare chase him out of town. "Andok's Elixirs" are reliable, if vile, substitutes for potions of healing, if you can afford them. + + Location: **Tano's Edge** Faction: **Unaligned** @@ -27,12 +26,20 @@ Faction: **Unaligned** ### Current Stock -| Rarity | Item | Description | Value | Weight | -| --------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------ | -| Common | Andok's Elixir of Healing | Heals 2d4 +2 | 200 GP | 0.5 Lb | -| Rare | Andok's Elixir of the Oasis (Special Order) | You do not suffer exhaustion due to dehydration for up to 3 days. After 3 days, you gain one point of exhaustion for each day you went without water. | 1000 GP | 0.5 Lb | -| Rare | Andok's Superior Elixir of Healing (Special Order) | Heals 8d4+8 | 2000 GP | 0.5 Lb | -| Uncommon | Andok's Elixir of Fire Resistence | Grants resistence to fire damage for a half-day. | 500 GP | 0.5 Lb | -| Uncommon | Andok's Elixir of Poison Resistence | Grants resistence to poison damage and advantage on saves against the Poisoned condition for a half-day. | 500 GP | 0.5 Lb | -| Uncommon | Andok's Elixir of the Berserker | Grants the Rage ability for 1 hour. | 800 GP | 0.5 Lb | -| Very Rare | Andok's Fuckin' Great Elixir of Healing (Special Order) | Heals 10d4+20 | 200000 GP | 0.5 Lb | +| Rarity | Item | Description | Value | Weight | +| -------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------ | +| Rare | | | | | +| Rare | Andok's Amazing Cure-All Elixir of Survival (Special Order) | Grants 2d4+4 temporary hit points, cures the poision condition, removes curses (Lvl 3 or lower) | 2000 GP | 0.5 Lb | +| Common | Andok's Elixir of Healing | Heals 2d4 +2 | 200 GP | 0.5 Lb | +| Common | Andok's Elixir of Healing | Heals 2d4 +2 | 200 GP | 0.5 Lb | +| Rare | Andok's Elixir of the Oasis (Special Order) | You do not suffer exhaustion due to dehydration for up to 3 days. After 3 days, you gain one point of exhaustion for each day you went without water. | 1000 GP | 0.5 Lb | +| Common | Andok's Elixir of Healing | Heals 2d4 +2 | 200 GP | 0.5 Lb | +| Common | Andok's Elixir of Healing | Heals 2d4 +2 | 200 GP | 0.5 Lb | +| Rare | Andok's Amazing Cure-All Elixir of Survival (Special Order) | Grants 2d4+4 temporary hit points, cures the poision condition, removes curses (Lvl 3 or lower) | 2000 GP | 0.5 Lb | +| Common | Andok's Elixir of Healing | Heals 2d4 +2 | 200 GP | 0.5 Lb | +| Uncommon | Andok's Elixir of Fire Resistence | Grants resistence to fire damage for a half-day. | 500 GP | 0.5 Lb | +| Uncommon | Andok's Elixir of Poison Resistence | Grants resistence to poison damage and advantage on saves against the Poisoned condition for a half-day. | 500 GP | 0.5 Lb | +| Uncommon | Andok's Elixir of Fire Resistence | Grants resistence to fire damage for a half-day. | 500 GP | 0.5 Lb | +| Rare | Andok's Superior Elixir of Healing (Special Order) | Heals 8d4+8 | 2000 GP | 0.5 Lb | +| Uncommon | Andok's Greater Elixir of Healing | Heals 4d4+4 | 400 GP | 0.5 Lb | +| Uncommon | Andok's Elixir of Poison Resistence | Grants resistence to poison damage and advantage on saves against the Poisoned condition for a half-day. | 500 GP | 0.5 Lb | diff --git a/deadsands/content/stores/generals-store.md b/deadsands/content/stores/generals-store.md index 2ae6b31..1827d55 100644 --- a/deadsands/content/stores/generals-store.md +++ b/deadsands/content/stores/generals-store.md @@ -4,10 +4,8 @@ title: General's Store author: evilchili show_dm_content: False -location: Tano's Edge -faction: Liberty Sisters -tags: store -date: 2023-04-12 17:52:34.363950 +tags: post +date: 2024-01-19 15:52:18.731958 description: Inventory subject to availability, prices subject to change, haggle at your own risk. -- The General status: published --- @@ -20,6 +18,8 @@ The general supply is well-stocked with basic adventuring gear and a healthy cli items high. The General has a reputation for being able to move just about anything, from random metal scraps to gardening supplies to artifacts of historical interest. + + Location: **Tano's Edge** Faction: **Liberty Sisters** @@ -27,18 +27,22 @@ Faction: **Liberty Sisters** ### Current Stock -| Rarity | Item | Description | Value | Weight | -| -------- | -------------------- | ------------------------------------------------------- | ------ | ------ | -| Common | Alchemist's Supplies | | 100 GP | 8 Lb | -| Common | Carpenter's Tools | | 16 GP | 6 Lb | -| Common | Lantern, Bullseye | | 20 GP | 2 Lb | -| Common | Lantern, Hooded | | 10 GP | 2 Lb | -| Common | Smith's Tools | | 40 GP | 8 Lb | -| Supplies | 10ft Pole | | 1 GP | 7 Lb | -| Supplies | Arrows | 20 count (imported) | 5 GP | 1 Lb | -| Supplies | Crossbow Bolts | 20 count (imported) | 5 GP | 1 Lb | -| Supplies | Dungeoneer's Pack | PHB, page 151 | 24 GP | 61 Lb | -| Supplies | Pistol Ammunition | 5 count (nonaligned pricing) | 3 GP | 0.1 lb | -| Supplies | Rations | Enough food for one person per day, desert travel | 1 GP | 0.5 Lb | -| Supplies | Rope | Hemp, 50ft | 2 GP | 10 Lb | -| Supplies | Water | 1 Gallon of water, enough for 1 medium creature per day | 1 GP | 4 Lbs | +| Rarity | Item | Description | Value | Weight | +| -------- | ----------------- | ------------------------------------------------------- | ------ | ------ | +| Supplies | Pistol Ammunition | 5 count (nonaligned pricing) | 3 GP | 0.1 lb | +| Supplies | Arrows | 20 count (imported) | 5 GP | 1 Lb | +| Supplies | Water | 1 Gallon of water, enough for 1 medium creature per day | 1 GP | 4 Lbs | +| Common | Jeweler's Tools | | 50 GP | 2 Lb | +| Common | Ball Bearings | (bag of 1000) | 2 GP | 2 Lb | +| Supplies | Crossbow Bolts | 20 count (imported) | 5 GP | 1 Lb | +| Supplies | Rope | Hemp, 50ft | 2 GP | 10 Lb | +| Supplies | Torch | | 1 SP | 0.5 Lb | +| Supplies | Explorer's Pack | PHB, page 151 | 20 GP | 59 Lb | +| Supplies | Oil (flask) | 0.5 Lb | 2 SP | | +| Supplies | Rations | Enough food for one person per day, desert travel | 1 GP | 0.5 Lb | +| Supplies | Pistol Ammunition | 5 count (nonaligned pricing) | 3 GP | 0.1 lb | +| Common | Tinker's Tools | | 100 GP | 10 Lb | +| Supplies | Pistol Ammunition | 5 count (nonaligned pricing) | 3 GP | 0.1 lb | +| Supplies | Torch | | 1 SP | 0.5 Lb | +| Supplies | Water | 1 Gallon of water, enough for 1 medium creature per day | 1 GP | 4 Lbs | +| Supplies | 10ft Pole | | 1 GP | 7 Lb | diff --git a/deadsands/site_tools/cli.py b/deadsands/site_tools/cli.py index cd36e6a..774818a 100644 --- a/deadsands/site_tools/cli.py +++ b/deadsands/site_tools/cli.py @@ -5,7 +5,6 @@ from pathlib import Path import click import typer from rolltable.types import RollTable -from typing_extensions import Annotated from site_tools.content_manager import create from site_tools import build_system @@ -29,6 +28,11 @@ class Die(str, Enum): d4 = "4" +source_path = Path(build_system.CONFIG['data_path']).expanduser() / build_system.CONFIG['campaign_name'] / 'sources' +locations = dict((loc.name, loc) for loc in (source_path / 'stores').iterdir() if loc.is_dir()) +Location = Enum("Location", ((name, name) for name in locations.keys())) + + # 'site' ENTRY POINT site_app = typer.Typer() @@ -64,30 +68,27 @@ def publish() -> None: @site_app.command() def restock( - source: str = typer.Argument(..., help="The source file for the store."), - frequency: str = Annotated[str, typer.Option("default", help="use the specified frequency from the source file")], - die: Die = typer.Option(20, help="The size of the die for which to create a table"), - template_dir: str = Annotated[ - str, - typer.Argument( - build_system.CONFIG["templates_path"], - help="Override the default location for markdown templates.", - ), - ], + location: Location = typer.Argument(..., help="Where to restock."), + frequency: str = typer.Option("default", help="use the specified frequency from the source file"), + die: Die = typer.Option('20', help="The size of the die for which to create a table"), + template_dir: str = typer.Argument( + build_system.CONFIG["templates_path"], + help="Override the default location for markdown templates.", + ), ) -> None: - rt = RollTable([Path(source).read_text()], frequency=frequency, die=die, hide_rolls=True) - store = rt.datasources[0].metadata["store"] - - click.edit( - filename=create( - content_type="post", - title=store["title"], - template_dir=template_dir, - category="stores", - template="store", - extra_context=dict(inventory=rt.as_markdown, **store), + for store in locations[location.name].iterdir(): + rt = RollTable([store.read_text()], frequency=frequency, die=int(die), hide_rolls=True) + store_attributes = rt.datasources[0].metadata["store"] + click.edit( + filename=create( + content_type="post", + title=store_attributes["title"], + template_dir=template_dir, + category="stores", + template="store", + extra_context=dict(inventory=rt.as_markdown(), **store_attributes), + ) ) - ) @site_app.command()