From b43da165a2ad202e7c3f805b697ab5cd532634b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Sat, 6 Jul 2024 08:34:53 -0700 Subject: [PATCH] add entities for sundered isles Fixes: https://github.com/iron-vault-plugin/iron-vault/issues/373 --- data/sundered-isles.supplement.json | 77 +++++++++++++++++++++ data/sundered-isles.supplement.yaml | 53 +++++++++++++++ package.json | 2 +- src/datastore.ts | 2 + src/entity/specs.ts | 100 +++++++++++++--------------- 5 files changed, 180 insertions(+), 54 deletions(-) create mode 100644 data/sundered-isles.supplement.json create mode 100644 data/sundered-isles.supplement.yaml diff --git a/data/sundered-isles.supplement.json b/data/sundered-isles.supplement.json new file mode 100644 index 00000000..4404ef3c --- /dev/null +++ b/data/sundered-isles.supplement.json @@ -0,0 +1,77 @@ +{ + "type": "expansion", + "_id": "sundered_isles_supp", + "title": "Sundered Isles Iron Vault Support", + "datasworn_version": "0.1.0", + "ruleset": "sundered_isles", + "oracles": { + "templates": { + "_id": "oracle_collection:sundered_isles_supp/templates", + "name": "Templates", + "type": "oracle_collection", + "oracle_type": "tables", + "_source": { + "title": "Iron Vault Support Oracles for Sundered Isles", + "authors": [ + { + "name": "Iron Vault Dev Team" + } + ], + "date": "2024-06-15", + "url": "https://github.com/iron-vault-plugin/iron-vault", + "license": "MIT" + }, + "collections": {}, + "contents": { + "region": { + "_id": "oracle_rollable:sundered_isles_supp/core/region", + "name": "Region", + "dice": "1d100", + "type": "oracle_rollable", + "oracle_type": "table_text", + "_source": { + "title": "Iron Vault Support Oracles for Sundered Isles", + "authors": [ + { + "name": "Iron Vault Dev Team" + } + ], + "date": "2024-06-15", + "url": "https://github.com/iron-vault-plugin/iron-vault", + "license": "MIT" + }, + "column_labels": { + "roll": "Roll", + "text": "Region" + }, + "rows": [ + { + "_id": "oracle_rollable.row:sundered_isles_supp/core/region.0", + "roll": { + "min": 1, + "max": 45 + }, + "text": "Myriads" + }, + { + "_id": "oracle_rollable.row:sundered_isles_supp/core/region.1", + "roll": { + "min": 46, + "max": 80 + }, + "text": "Margins" + }, + { + "_id": "oracle_rollable.row:sundered_isles_supp/core/region.2", + "roll": { + "min": 81, + "max": 100 + }, + "text": "Reaches" + } + ] + } + } + } + } +} diff --git a/data/sundered-isles.supplement.yaml b/data/sundered-isles.supplement.yaml new file mode 100644 index 00000000..0251cd65 --- /dev/null +++ b/data/sundered-isles.supplement.yaml @@ -0,0 +1,53 @@ +--- +type: expansion +_id: sundered_isles_supp +title: "Sundered Isles Iron Vault Support" +datasworn_version: 0.1.0 +ruleset: sundered_isles +oracles: + templates: + _id: oracle_collection:sundered_isles_supp/templates + name: Templates + type: oracle_collection + oracle_type: tables + _source: + title: Iron Vault Support Oracles for Sundered Isles + authors: + - name: Iron Vault Dev Team + date: "2024-06-15" + url: "https://github.com/iron-vault-plugin/iron-vault" + license: "MIT" + collections: {} + contents: + "region": + _id: oracle_rollable:sundered_isles_supp/core/region + name: Region + dice: "1d100" + type: oracle_rollable + oracle_type: table_text + _source: + title: Iron Vault Support Oracles for Sundered Isles + authors: + - name: Iron Vault Dev Team + date: "2024-06-15" + url: "https://github.com/iron-vault-plugin/iron-vault" + license: "MIT" + column_labels: + roll: Roll + text: Region + rows: + - _id: oracle_rollable.row:sundered_isles_supp/core/region.0 + roll: + min: 1 + max: 45 + text: "Myriads" + - _id: oracle_rollable.row:sundered_isles_supp/core/region.1 + roll: + min: 46 + max: 80 + text: "Margins" + - _id: oracle_rollable.row:sundered_isles_supp/core/region.2 + roll: + min: 81 + max: 100 + text: "Reaches" diff --git a/package.json b/package.json index 6a99bae4..96aa3cc0 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "test": "jest", "build": "tsc --noEmit && node esbuild.config.js production", "dev:build": "tsc --noEmit && node esbuild.config.js nowatch", - "compile-data": "yq -ojson data/starforged.supplement.yaml > data/starforged.supplement.json", + "compile-data": "yq -ojson data/starforged.supplement.yaml > data/starforged.supplement.json && yq -ojson data/sundered-isles.supplement.yaml > data/sundered-isles.supplement.json", "dev": "node esbuild.config.js", "bump": "node ./scripts/update_manifest.js ${npm_config_tag:?} && npm version --no-git-tag-version ${npm_config_tag} && git commit -a -m \"bumping manifest version to ${npm_config_tag}\" && git tag -a ${npm_config_tag} -m ${npm_config_tag} && git push --follow-tags", "latestrev": "git tag -l --sort -creatordate '[0-9]*' | head -n 1", diff --git a/src/datastore.ts b/src/datastore.ts index 19b7cb7c..764e0a3f 100644 --- a/src/datastore.ts +++ b/src/datastore.ts @@ -29,6 +29,7 @@ import { Component, Notice, TFile, TFolder, type App } from "obsidian"; import { OracleRoller } from "oracles/roller"; import { Ruleset } from "rules/ruleset"; import starforgedSupp from "../data/starforged.supplement.json" assert { type: "json" }; +import sunderedSupp from "../data/sundered-isles.supplement.json" assert { type: "json" }; import { PLUGIN_DATASWORN_VERSION } from "./constants"; const logger = rootLogger.getLogger("datastore"); @@ -91,6 +92,7 @@ export class Datastore extends Component implements IDataContext { if (this.plugin.settings.enableSunderedIsles) { this.indexBuiltInData(sunderedIslesPackage as Datasworn.Expansion); + this.indexBuiltInData(sunderedSupp as Datasworn.Expansion, 5); } if (this.plugin.settings.useHomebrew) { diff --git a/src/entity/specs.ts b/src/entity/specs.ts index ab49483f..b3c96042 100644 --- a/src/entity/specs.ts +++ b/src/entity/specs.ts @@ -183,59 +183,6 @@ export const ENTITIES: Record> = { }, }, }, - - sfSettlement: { - label: "Settlement", - nameGen: (ent) => ent.name[0]?.simpleResult, - collectionId: "oracle_collection:starforged/settlement", - spec: { - region: { - id: "oracle_rollable:starforgedsupp/core/region", - firstLook: true, - definesAttribute: { - order: 1, - mechanism: AttributeMechanism.Snakecase, - }, - }, - name: { - id: "oracle_rollable:starforged/settlement/name", - firstLook: true, - }, - location: { - id: "oracle_rollable:starforged/settlement/location", - firstLook: true, - }, - population: { - id: "oracle_rollable:starforged/settlement/population/{{region}}", - firstLook: true, - name: "Population", - }, - authority: { - id: "oracle_rollable:starforged/settlement/authority", - firstLook: true, - }, - project: { - id: "oracle_rollable:starforged/settlement/projects", - firstLook: true, - }, - firstLook: { - id: "oracle_rollable:starforged/settlement/first_look", - // lol this is ironic, but that's what the rulebook says - firstLook: false, - name: "First look", - }, - initialContact: { - id: "oracle_rollable:starforged/settlement/initial_contact", - firstLook: false, - name: "Initial contact", - }, - trouble: { - id: "oracle_rollable:starforged/settlement/trouble", - firstLook: false, - }, - }, - }, - sfPlanet: { label: "Planet", nameGen: (ent) => ent.name[0]?.simpleResult, @@ -309,4 +256,51 @@ export const ENTITIES: Record> = { }, }, }, + siIsland: { + label: "Island", + nameGen: (ent) => ent.name[0]?.simpleResult, + collectionId: "oracle_collection:sundered_isles/island", + spec: { + region: { + id: "oracle_rollable:sundered_isles_supp/core/region", + firstLook: true, + definesAttribute: { + order: 1, + mechanism: AttributeMechanism.Snakecase, + }, + }, + name: { + id: "oracle_rollable:sundered_isles/island/name", + firstLook: true, + }, + size: { + id: "oracle_rollable:sundered_isles/island/landscape/size", + firstLook: true, + }, + terrain: { + id: "oracle_rollable:sundered_isles/island/landscape/terrain", + firstLook: true, + }, + vitality: { + id: "oracle_rollable:sundered_isles/island/landscape/vitality/{{region}}", + firstLook: true, + name: "Vitality", + }, + nearby_islands: { + id: "oracle_rollable:sundered_isles/island/nearby_islands/{{region}}", + firstLook: true, + name: "Nearby islands", + }, + coastline_aspects: { + id: "oracle_rollable:sundered_isles/island/coastline_aspects", + }, + offshore_observations: { + id: "oracle_rollable:sundered_isles/island/offshore_observations", + }, + visible_habitation: { + id: "oracle_rollable:sundered_isles/island/visible_habitation/{{region}}", + name: "Visible habitation", + }, + }, + }, };