Compare commits

..

No commits in common. "master" and "1.2.0" have entirely different histories.

17 changed files with 502 additions and 1383 deletions

3
.gitignore vendored
View file

@ -22,5 +22,4 @@ data.json
.DS_Store
fantasy-content-generator.zip
fantasy-content-generator
fantasy-content-generator/styles.css
builds
fantasy-content-generator/styles.css

View file

@ -35,9 +35,9 @@ In the settings of the plugin you will Find settings and options to add your own
## Inline Generator
If you found yourself needing a quick name for an Elf or really wanting a quick dungeon description then look no further then the Inline generator. You can activate this by using the Callout token (Default is set to '@', can be changed in settings) and scrolling through the list of generators possible.
If you found yourself needing a quick name for an Elf or really wanting a quick dungeon description then look no further then the Inline generator. You can activate this by using the Callout token (Default is set to '@', can be changed in settings)and scrolling through the list of generators possible.
### Inline Example
### Example
![Example](Obsidian_mrGSNRjLpe.gif)
@ -67,4 +67,3 @@ Below is a table for all the settings in this plugin
- ~~Randomization within a note.~~
- Possibly more Generation type.
- Better UI
- ~~JSON Import And Export~~

View file

@ -14,7 +14,7 @@ import { dwarfFamilyNames } from "lists/dwarvenFamilyNames";
import * as FCG from "fantasy-content-generator";
import { generateCityName } from "generators/city";
import { generateLoot } from "generators/loot";
import FantasyPlugin from "main";
import MyPlugin from "main";
import { generateInn } from "generators/inn";
import { generatePathfinderName } from "generators/Pathfinder/pathfinderName";
import { ISettlementDomainObject } from "fantasy-content-generator/dist/interfaces";
@ -36,8 +36,8 @@ let genSettings = {
export class GeneratorModal extends Modal {
result: string | Error;
onSubmit: (result: string | Error) => void;
plugin: FantasyPlugin;
constructor(app: App, onSubmit: (result: string | Error) => void, plugin: FantasyPlugin) {
plugin: MyPlugin;
constructor(app: App, onSubmit: (result: string | Error) => void, plugin: MyPlugin) {
super(app);
this.onSubmit = onSubmit;
this.plugin = plugin;
@ -119,7 +119,7 @@ export class GeneratorModal extends Modal {
multiNames: false
}
genSettings.race = raceSelected;
settingsdiv.empty();
settingsdiv.innerHTML = "";
settingsdiv.createEl("h3", { text: "Customise The Generation" });
new Setting(settingsdiv)
.setName("Male or Female?")
@ -197,7 +197,7 @@ export class GeneratorModal extends Modal {
}
generatorInnSettings(settingsdiv: HTMLElement, genAmount: number, generatorFunction: (settings: innGeneratorSettings) => {name:string,description:string,rumors:string[]}) {
settingsdiv.empty();
settingsdiv.innerHTML = "";
settingsdiv.createEl("h3", { text: "Customise The Generation" });
genAmount = 1;
let innList = '';
@ -245,7 +245,7 @@ export class GeneratorModal extends Modal {
}
generatorLootSettings(settingsdiv: HTMLElement, genAmount: number, generatorFunction: (enableCurrency:boolean, currencyFrequency: number, currencyTypes: object[], lootTable: lootTables) => string, enableCurrency:boolean, currencyFrequency: number, currencyTypes: object[]) {
settingsdiv.empty();
settingsdiv.innerHTML = "";
settingsdiv.createEl("h3", { text: "Customise The Generation" });
genAmount = 1;
let list = '';
@ -292,7 +292,7 @@ export class GeneratorModal extends Modal {
}
generatorFCGSettlementSettings(settingsdiv: HTMLElement, genAmount: number, generatorFunction: () => ISettlementDomainObject) {
settingsdiv.empty();
settingsdiv.innerHTML = "";
settingsdiv.createEl("h3", { text: "Customise The Generation" });
genAmount = 1;
let list = '';
@ -343,7 +343,7 @@ export class GeneratorModal extends Modal {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
generatorCustomSettings(settingsdiv: HTMLElement, genAmount: number, generatorFunction: (settings ?: any) => string, settings ?: any) {
settingsdiv.empty();
settingsdiv.innerHTML = "";
settingsdiv.createEl("h3", { text: "Customise The Generation" });
genAmount = 1;
let list = "";

View file

@ -7,8 +7,8 @@ import { elfFamilyNames } from "lists/elvenFamilyNames";
import { familyNameList } from "lists/humanFamilyNames";
import { titleLastNames } from "lists/titleLastNames";
import * as FCG from "fantasy-content-generator";
import FantasyPlugin from "main";
import { Editor, EditorPosition, EditorSuggest, EditorSuggestContext, EditorSuggestTriggerInfo } from "obsidian";
import MyPlugin from "main";
import { Editor, EditorPosition, EditorSuggest, EditorSuggestContext, EditorSuggestTriggerInfo, MarkdownView } from "obsidian";
import { generatorAirships } from "generators/airship";
import { generatorDrinks } from "generators/drink";
import { generateMiscellaneousArtifacts } from "generators/artifact";
@ -21,7 +21,6 @@ import { generatorGroups } from "generators/groups";
import { generatorReligions } from "generators/religions";
import { generatePathfinderName } from "generators/Pathfinder/pathfinderName";
import { generatePlotHook } from "generators/plothook";
import { generateTradingPost } from "generators/tradingPost";
type Generator = () => string | Error;
@ -35,129 +34,128 @@ export class InlineGeneratorSuggester extends EditorSuggest<string> {
private getCompletions: () => string[]; // function to retrieve completions
startChar: EditorPosition
endChar: EditorPosition
plugin: FantasyPlugin
plugin: MyPlugin
//An object storing all the Generator functions used by the particular selection
private generators: Generators = {
'TradingPost': () => "Trading Post Name: " + generateCityName(this.plugin.settings.citySettings) + "\n" + generateTradingPost(),
'ElfMale': () => nameByRace("elf", { gender: "male" }),
'ElfMaleLastname': () => nameByRace("elf", { gender: "male" }) + " " + elfFamilyNames[Math.floor(Math.random() * elfFamilyNames.length)],
'ElfFemale': () => nameByRace("elf", { gender: "female" }),
'ElfFemaleLastname': () => nameByRace("elf", { gender: "female" }) + " " + elfFamilyNames[Math.floor(Math.random() * elfFamilyNames.length)],
'Orc': () => nameByRace("orc"),
'OrcLastname': () => nameByRace("orc") + " " + titleLastNames[Math.floor(Math.random() * titleLastNames.length)],
'DwarfMale': () => nameByRace("elf", { gender: "male" }),
'DwarfMaleLastname': () => nameByRace("elf", { gender: "male" }) + " " + dwarfFamilyNames[Math.floor(Math.random() * dwarfFamilyNames.length)],
'DwarfFemale': () => nameByRace("elf", { gender: "female" }),
'DwarfFemaleLastname': () => nameByRace("elf", { gender: "female" }) + " " + dwarfFamilyNames[Math.floor(Math.random() * dwarfFamilyNames.length)],
'HumanMale': () => nameByRace("elf", { gender: "male" }),
'HumanFemale': () => nameByRace("elf", { gender: "female" }),
'HumanMaleLastname': () => nameByRace("elf", { gender: "male" }) + " " + familyNameList[Math.floor(Math.random() * familyNameList.length)],
'HumanFemaleLastname': () => nameByRace("elf", { gender: "female" }) + " " + familyNameList[Math.floor(Math.random() * familyNameList.length)],
"DungeonsLabryinths": () => generateDungeonName(this.plugin.settings.dungeonSettings),
"InnsTaverns": () => {
'Gen-ElfMale': () => nameByRace("elf", { gender: "male" }),
'Gen-ElfMaleLastname': () => nameByRace("elf", { gender: "male" }) + " " + elfFamilyNames[Math.floor(Math.random() * elfFamilyNames.length)],
'Gen-ElfFemale': () => nameByRace("elf", { gender: "female" }),
'Gen-ElfFemaleLastname': () => nameByRace("elf", { gender: "female" }) + " " + elfFamilyNames[Math.floor(Math.random() * elfFamilyNames.length)],
'Gen-Orc': () => nameByRace("orc"),
'Gen-OrcLastname': () => nameByRace("orc") + " " + titleLastNames[Math.floor(Math.random() * titleLastNames.length)],
'Gen-DwarfMale': () => nameByRace("elf", { gender: "male" }),
'Gen-DwarfMaleLastname': () => nameByRace("elf", { gender: "male" }) + " " + dwarfFamilyNames[Math.floor(Math.random() * dwarfFamilyNames.length)],
'Gen-DwarfFemale': () => nameByRace("elf", { gender: "female" }),
'Gen-DwarfFemaleLastname': () => nameByRace("elf", { gender: "female" }) + " " + dwarfFamilyNames[Math.floor(Math.random() * dwarfFamilyNames.length)],
'Gen-HumanMale': () => nameByRace("elf", { gender: "male" }),
'Gen-HumanFemale': () => nameByRace("elf", { gender: "female" }),
'Gen-HumanMaleLastname': () => nameByRace("elf", { gender: "male" }) + " " + familyNameList[Math.floor(Math.random() * familyNameList.length)],
'Gen-HumanFemaleLastname': () => nameByRace("elf", { gender: "female" }) + " " + familyNameList[Math.floor(Math.random() * familyNameList.length)],
"Gen-DungeonsLabryinths": () => generateDungeonName(this.plugin.settings.dungeonSettings),
"Gen-InnsTaverns": () => {
const innInfo = generateInn(this.plugin.settings.innSettings);
return innInfo.name + "\nDescription: " + innInfo.description + "\nRumors: " + innInfo.rumors;
},
"Settlement": () => {
"Gen-Settlement": () => {
const CityInfo = FCG.Settlements.generate();
const name = generateCityName(this.plugin.settings.citySettings);
return "Name: " + name + "\nPopulation: " + CityInfo.population + "\nType: " + CityInfo.type.split("_").map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
},
"Airships": () => generatorAirships(),
"Drinks": () => generatorDrinks(this.plugin.settings.drinkSettings),
"Artifacts": () => generateMiscellaneousArtifacts(),
"LootTreasure": () => generateLoot(this.plugin.settings.enableCurrency, this.plugin.settings.currencyFrequency, this.plugin.settings.currencyTypes, this.plugin.settings.lootSettings),
"Metals": () => generatorMetals(),
"MagicalTrees": () => generatorMagical_trees(),
"Ship": () => generateShipName(),
"AnimalGroups": () => generatorAnimal_groups(),
"Groups": () => generatorGroups(this.plugin.settings.groupSettings),
"Religion": () => generatorReligions(),
"AasimarsLastname": () => generatePathfinderName("aasimars", "male", true),
"CatfolkLastname": () => generatePathfinderName("catfolk", "male", true),
"FetchlingsLastname": () => generatePathfinderName("fetchlings", "male", true),
"HalfElfLastname": () => generatePathfinderName("halfelf", "male", true),
"HalfOrcLastname": () => generatePathfinderName("halforc", "male", true),
"HobgoblinLastname": () => generatePathfinderName("hobgoblin", "male", true),
"IfritsLastname": () => generatePathfinderName("ifrits", "male", true),
"KobaldsLastname": () => generatePathfinderName("kobalds", "male", true),
"OreadsLastname": () => generatePathfinderName("oreads", "male", true),
"RatfolkLastname": () => generatePathfinderName("ratfolk", "male", true),
"SylphsLastname": () => generatePathfinderName("sylphs", "male", true),
"TenguLastname": () => generatePathfinderName("tengu", "male", true),
"TiansLastname": () => generatePathfinderName("tians", "male", true),
"TieflingLastname": () => generatePathfinderName("tiefling", "male", true),
"UndinesLastname": () => generatePathfinderName("undines", "male", true),
"AngelMaleLastname": () => nameByRace("angel", { gender: "male" }) + " " + nameByRace("angel", { gender: "male" }),
"AngelFemaleLastname": () => nameByRace("angel", { gender: "female" }) + " " + nameByRace("angel", { gender: "female" }),
"CavePersonMaleLastname": () => nameByRace("cavePerson", { gender: "male" }) + " " + nameByRace("cavePerson", { gender: "male" }),
"CavePersonFemaleLastname": () => nameByRace("cavePerson", { gender: "female" }) + " " + nameByRace("cavePerson", { gender: "female" }),
"DarkElfMaleLastname": () => nameByRace("darkelf", { gender: "male" }) + " " + nameByRace("darkelf", { gender: "male" }),
"DarkElfFemaleLastname": () => nameByRace("darkelf", { gender: "female" }) + " " + nameByRace("darkelf", { gender: "female" }),
"DemonLastname": () => nameByRace("demon") + " " + nameByRace("demon"),
"DragonMaleLastname": () => nameByRace("dragon", { gender: "male" }) + " " + nameByRace("dragon", { gender: "male" }),
"DragonFemaleLastname": () => nameByRace("dragon", { gender: "female" }) + " " + nameByRace("dragon", { gender: "female" }),
"DrowMaleLastname": () => nameByRace("drow", { gender: "male" }) + " " + nameByRace("drow", { gender: "male" }),
"DrowFemaleLastname": () => nameByRace("drow", { gender: "female" }) + " " + nameByRace("drow", { gender: "female" }),
"FairyMaleLastname": () => nameByRace("fairy", { gender: "male" }) + " " + nameByRace("fairy", { gender: "male" }),
"FairyFemaleLastname": () => nameByRace("fairy", { gender: "female" }) + " " + nameByRace("fairy", { gender: "female" }),
"GnomeMaleLastname": () => nameByRace("gnome", { gender: "male" }) + " " + nameByRace("gnome", { gender: "male" }),
"GnomeFemaleLastname": () => nameByRace("gnome", { gender: "female" }) + " " + nameByRace("gnome", { gender: "female" }),
"GoblinLastname": () => nameByRace("goblin") + " " + nameByRace("goblin"),
"HalfDemonMaleLastname": () => nameByRace("halfdemon", { gender: "male" }) + " " + nameByRace("halfdemon", { gender: "male" }),
"HalfDemonFemaleLastname": () => nameByRace("halfdemon", { gender: "female" }) + " " + nameByRace("halfdemon", { gender: "female" }),
"HalflingMaleLastname": () => nameByRace("halfling", { gender: "male" }) + " " + nameByRace("halfling", { gender: "male" }),
"HalflingFemaleLastname": () => nameByRace("halfling", { gender: "female" }) + " " + nameByRace("halfling", { gender: "female" }),
"HighElfMaleLastname": () => nameByRace("highelf", { gender: "male" }) + " " + nameByRace("highelf", { gender: "male" }),
"HighElfFemaleLastname": () => nameByRace("highelf", { gender: "female" }) + " " + nameByRace("highelf", { gender: "female" }),
"HighFairyMaleLastname": () => nameByRace("highfairy", { gender: "male" }) + " " + nameByRace("highfairy", { gender: "male" }),
"HighFairyFemaleLastname": () => nameByRace("highfairy", { gender: "female" }) + " " + nameByRace("angel", { gender: "female" }),
"OgreLastname": () => nameByRace("ogre") + " " + nameByRace("ogre"),
"Aasimars": () => generatePathfinderName("aasimars", "male", false),
"Catfolk": () => generatePathfinderName("catfolk", "male", false),
"Fetchlings": () => generatePathfinderName("fetchlings", "male", false),
"HalfElf": () => generatePathfinderName("halfelf", "male", false),
"HalfOrc": () => generatePathfinderName("halforc", "male", false),
"Hobgoblin": () => generatePathfinderName("hobgoblin", "male", false),
"Ifrits": () => generatePathfinderName("ifrits", "male", false),
"Kobalds": () => generatePathfinderName("kobalds", "male", false),
"Oreads": () => generatePathfinderName("oreads", "male", false),
"Ratfolk": () => generatePathfinderName("ratfolk", "male", false),
"Sylphs": () => generatePathfinderName("sylphs", "male", false),
"Tengu": () => generatePathfinderName("tengu", "male", false),
"Tians": () => generatePathfinderName("tians", "male", false),
"Tiefling": () => generatePathfinderName("tiefling", "male", false),
"Undines": () => generatePathfinderName("undines", "male", false),
"AngelMale": () => nameByRace("angel", { gender: "male" }),
"CavePersonMale": () => nameByRace("cavePerson", { gender: "male" }),
"DarkElfMale": () => nameByRace("darkelf", { gender: "male" }),
"DragonMale": () => nameByRace("dragon", { gender: "male" }),
"DrowMale": () => nameByRace("drow", { gender: "male" }),
"FairyMale": () => nameByRace("fairy", { gender: "male" }),
"GnomeMale": () => nameByRace("Gnome", { gender: "male" }),
"HalfDemonMale": () => nameByRace("halfdemon", { gender: "male" }),
"HalflingMale": () => nameByRace("halfling", { gender: "male" }),
"HighElfMale": () => nameByRace("highelf", { gender: "male" }),
"HighFairyMale": () => nameByRace("highfairy", { gender: "male" }),
"Ogre": () => nameByRace("ogre"),
"AngelFemale": () => nameByRace("angel", { gender: "female" }),
"CavePersonFemale": () => nameByRace("cavePerson", { gender: "female" }),
"DarkElfFemale": () => nameByRace("darkelf", { gender: "female" }),
"Demon": () => nameByRace("demon"),
"DragonFemale": () => nameByRace("dragon", { gender: "female" }),
"DrowFemale": () => nameByRace("drow", { gender: "female" }),
"FairyFemale": () => nameByRace("fairy", { gender: "female" }),
"GnomeFemale": () => nameByRace("gnome", { gender: "female" }),
"Goblin": () => nameByRace("goblin"),
"HalfDemonFemale": () => nameByRace("halfdemon", { gender: "female" }),
"HalflingFemale": () => nameByRace("halfling", { gender: "female" }),
"HighElfFemale": () => nameByRace("highelf", { gender: "female" }),
"HighFairyFemale": () => nameByRace("highfairy", { gender: "female" }),
"PlotStoryHooks": () => generatePlotHook(),
"Gen-Airships": () => generatorAirships(),
"Gen-Drinks": () => generatorDrinks(this.plugin.settings.drinkSettings),
"Gen-Artifacts": () => generateMiscellaneousArtifacts(),
"Gen-LootTreasure": () => generateLoot(this.plugin.settings.enableCurrency, this.plugin.settings.currencyFrequency, this.plugin.settings.currencyTypes, this.plugin.settings.lootSettings),
"Gen-Metals": () => generatorMetals(),
"Gen-MagicalTrees": () => generatorMagical_trees(),
"Gen-Ship": () => generateShipName(),
"Gen-AnimalGroups": () => generatorAnimal_groups(),
"Gen-Groups": () => generatorGroups(this.plugin.settings.groupSettings),
"Gen-Religion": () => generatorReligions(),
"Gen-AasimarsLastname": () => generatePathfinderName("aasimars", "male", true),
"Gen-CatfolkLastname": () => generatePathfinderName("catfolk", "male", true),
"Gen-FetchlingsLastname": () => generatePathfinderName("fetchlings", "male", true),
"Gen-HalfElfLastname": () => generatePathfinderName("halfelf", "male", true),
"Gen-HalfOrcLastname": () => generatePathfinderName("halforc", "male", true),
"Gen-HobgoblinLastname": () => generatePathfinderName("hobgoblin", "male", true),
"Gen-IfritsLastname": () => generatePathfinderName("ifrits", "male", true),
"Gen-KobaldsLastname": () => generatePathfinderName("kobalds", "male", true),
"Gen-OreadsLastname": () => generatePathfinderName("oreads", "male", true),
"Gen-RatfolkLastname": () => generatePathfinderName("ratfolk", "male", true),
"Gen-SylphsLastname": () => generatePathfinderName("sylphs", "male", true),
"Gen-TenguLastname": () => generatePathfinderName("tengu", "male", true),
"Gen-TiansLastname": () => generatePathfinderName("tians", "male", true),
"Gen-TieflingLastname": () => generatePathfinderName("tiefling", "male", true),
"Gen-UndinesLastname": () => generatePathfinderName("undines", "male", true),
"Gen-AngelMaleLastname": () => nameByRace("angel", { gender: "male" }) + " " + nameByRace("angel", { gender: "male" }),
"Gen-AngelFemaleLastname": () => nameByRace("angel", { gender: "female" }) + " " + nameByRace("angel", { gender: "female" }),
"Gen-CavePersonMaleLastname": () => nameByRace("cavePerson", { gender: "male" }) + " " + nameByRace("cavePerson", { gender: "male" }),
"Gen-CavePersonFemaleLastname": () => nameByRace("cavePerson", { gender: "female" }) + " " + nameByRace("cavePerson", { gender: "female" }),
"Gen-DarkElfMaleLastname": () => nameByRace("darkelf", { gender: "male" }) + " " + nameByRace("darkelf", { gender: "male" }),
"Gen-DarkElfFemaleLastname": () => nameByRace("darkelf", { gender: "female" }) + " " + nameByRace("darkelf", { gender: "female" }),
"Gen-DemonLastname": () => nameByRace("demon") + " " + nameByRace("demon"),
"Gen-DragonMaleLastname": () => nameByRace("dragon", { gender: "male" }) + " " + nameByRace("dragon", { gender: "male" }),
"Gen-DragonFemaleLastname": () => nameByRace("dragon", { gender: "female" }) + " " + nameByRace("dragon", { gender: "female" }),
"Gen-DrowMaleLastname": () => nameByRace("drow", { gender: "male" }) + " " + nameByRace("drow", { gender: "male" }),
"Gen-DrowFemaleLastname": () => nameByRace("drow", { gender: "female" }) + " " + nameByRace("drow", { gender: "female" }),
"Gen-FairyMaleLastname": () => nameByRace("fairy", { gender: "male" }) + " " + nameByRace("fairy", { gender: "male" }),
"Gen-FairyFemaleLastname": () => nameByRace("fairy", { gender: "female" }) + " " + nameByRace("fairy", { gender: "female" }),
"Gen-GnomeMaleLastname": () => nameByRace("gnome", { gender: "male" }) + " " + nameByRace("gnome", { gender: "male" }),
"Gen-GnomeFemaleLastname": () => nameByRace("gnome", { gender: "female" }) + " " + nameByRace("gnome", { gender: "female" }),
"Gen-GoblinLastname": () => nameByRace("goblin") + " " + nameByRace("goblin"),
"Gen-HalfDemonMaleLastname": () => nameByRace("halfdemon", { gender: "male" }) + " " + nameByRace("halfdemon", { gender: "male" }),
"Gen-HalfDemonFemaleLastname": () => nameByRace("halfdemon", { gender: "female" }) + " " + nameByRace("halfdemon", { gender: "female" }),
"Gen-HalflingMaleLastname": () => nameByRace("halfling", { gender: "male" }) + " " + nameByRace("halfling", { gender: "male" }),
"Gen-HalflingFemaleLastname": () => nameByRace("halfling", { gender: "female" }) + " " + nameByRace("halfling", { gender: "female" }),
"Gen-HighElfMaleLastname": () => nameByRace("highelf", { gender: "male" }) + " " + nameByRace("highelf", { gender: "male" }),
"Gen-HighElfFemaleLastname": () => nameByRace("highelf", { gender: "female" }) + " " + nameByRace("highelf", { gender: "female" }),
"Gen-HighFairyMaleLastname": () => nameByRace("highfairy", { gender: "male" }) + " " + nameByRace("highfairy", { gender: "male" }),
"Gen-HighFairyFemaleLastname": () => nameByRace("highfairy", { gender: "female" }) + " " + nameByRace("angel", { gender: "female" }),
"Gen-OgreLastname": () => nameByRace("ogre") + " " + nameByRace("ogre"),
"Gen-Aasimars": () => generatePathfinderName("aasimars", "male", false),
"Gen-Catfolk": () => generatePathfinderName("catfolk", "male", false),
"Gen-Fetchlings": () => generatePathfinderName("fetchlings", "male", false),
"Gen-HalfElf": () => generatePathfinderName("halfelf", "male", false),
"Gen-HalfOrc": () => generatePathfinderName("halforc", "male", false),
"Gen-Hobgoblin": () => generatePathfinderName("hobgoblin", "male", false),
"Gen-Ifrits": () => generatePathfinderName("ifrits", "male", false),
"Gen-Kobalds": () => generatePathfinderName("kobalds", "male", false),
"Gen-Oreads": () => generatePathfinderName("oreads", "male", false),
"Gen-Ratfolk": () => generatePathfinderName("ratfolk", "male", false),
"Gen-Sylphs": () => generatePathfinderName("sylphs", "male", false),
"Gen-Tengu": () => generatePathfinderName("tengu", "male", false),
"Gen-Tians": () => generatePathfinderName("tians", "male", false),
"Gen-Tiefling": () => generatePathfinderName("tiefling", "male", false),
"Gen-Undines": () => generatePathfinderName("undines", "male", false),
"Gen-AngelMale": () => nameByRace("angel", { gender: "male" }),
"Gen-CavePersonMale": () => nameByRace("cavePerson", { gender: "male" }),
"Gen-DarkElfMale": () => nameByRace("darkelf", { gender: "male" }),
"Gen-DragonMale": () => nameByRace("dragon", { gender: "male" }),
"Gen-DrowMale": () => nameByRace("drow", { gender: "male" }),
"Gen-FairyMale": () => nameByRace("fairy", { gender: "male" }),
"Gen-GnomeMale": () => nameByRace("Gnome", { gender: "male" }),
"Gen-HalfDemonMale": () => nameByRace("halfdemon", { gender: "male" }),
"Gen-HalflingMale": () => nameByRace("halfling", { gender: "male" }),
"Gen-HighElfMale": () => nameByRace("highelf", { gender: "male" }),
"Gen-HighFairyMale": () => nameByRace("highfairy", { gender: "male" }),
"Gen-Ogre": () => nameByRace("ogre"),
"Gen-AngelFemale": () => nameByRace("angel", { gender: "female" }),
"Gen-CavePersonFemale": () => nameByRace("cavePerson", { gender: "female" }),
"Gen-DarkElfFemale": () => nameByRace("darkelf", { gender: "female" }),
"Gen-Demon": () => nameByRace("demon"),
"Gen-DragonFemale": () => nameByRace("dragon", { gender: "female" }),
"Gen-DrowFemale": () => nameByRace("drow", { gender: "female" }),
"Gen-FairyFemale": () => nameByRace("fairy", { gender: "female" }),
"Gen-GnomeFemale": () => nameByRace("gnome", { gender: "female" }),
"Gen-Goblin": () => nameByRace("goblin"),
"Gen-HalfDemonFemale": () => nameByRace("halfdemon", { gender: "female" }),
"Gen-HalflingFemale": () => nameByRace("halfling", { gender: "female" }),
"Gen-HighElfFemale": () => nameByRace("highelf", { gender: "female" }),
"Gen-HighFairyFemale": () => nameByRace("highfairy", { gender: "female" }),
"Gen-PlotStoryHooks": () => generatePlotHook(),
}
constructor(getCompletions: () => string[], plugin: FantasyPlugin) {
constructor(getCompletions: () => string[], plugin: MyPlugin) {
super(app);
this.getCompletions = getCompletions;
this.plugin = plugin;
@ -202,8 +200,10 @@ export class InlineGeneratorSuggester extends EditorSuggest<string> {
result = this.generators[value]();
}
if (this.plugin.currentEditor) {
this.plugin.currentEditor.replaceRange(result.toString(), this.startChar, this.endChar);
// insert the result into the editor
const activeView = app.workspace.getActiveViewOfType(MarkdownView);
if (activeView) {
activeView.editor.replaceRange(result.toString(), this.startChar, this.endChar);
}
}
}

View file

@ -38,7 +38,7 @@ const context = await esbuild.context({
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
outfile: "fantasy-content-generator/main.js",
});
if (prod) {

View file

@ -4,32 +4,7 @@ export function generateCityName(settings : cityGeneratorSetting) {
const prefixes = settings.prefixArray;
const suffixes = settings.suffixArray;
const syllables = [
'ab', 'ac', 'ad', 'al', 'an', 'ap', 'ar', 'as', 'at', 'au',
'ba', 'be', 'bi', 'bo', 'bu',
'ca', 'ce', 'ci', 'co', 'cu',
'da', 'de', 'di', 'do', 'du',
'ea', 'eb', 'ec', 'ed', 'el', 'em', 'en', 'er', 'es', 'et', 'eu',
'fa', 'fe', 'fi', 'fo', 'fu',
'ga', 'ge', 'gi', 'go', 'gu',
'ha', 'he', 'hi', 'ho', 'hu',
'ia', 'ib', 'ic', 'id', 'ie', 'if', 'ig', 'il', 'im', 'in', 'io', 'ip', 'ir', 'is', 'it', 'iu',
'ja', 'je', 'ji', 'jo', 'ju',
'ka', 'ke', 'ki', 'ko', 'ku',
'la', 'le', 'li', 'lo', 'lu',
'ma', 'me', 'mi', 'mo', 'mu',
'na', 'ne', 'ni', 'no', 'nu',
'oa', 'ob', 'oc', 'od', 'oe', 'of', 'og', 'oi', 'oj', 'ok', 'ol', 'om', 'on', 'oo', 'op', 'or', 'os', 'ot', 'ou', 'ov', 'ow', 'ox', 'oz',
'pa', 'pe', 'pi', 'po', 'pu',
'qa', 'qe', 'qi', 'qo', 'qu',
'ra', 're', 'ri', 'ro', 'ru',
'sa', 'se', 'si', 'so', 'su',
'ta', 'te', 'ti', 'to', 'tu',
'wa', 'we', 'wi', 'wo', 'wu',
'xa', 'xe', 'xi', 'xo', 'xu',
'ya', 'ye', 'yi', 'yo', 'yu',
'za', 'ze', 'zi', 'zo'
];
const syllables = ["ab", "ac", "al", "am", "an", "ap", "apo", "ar", "arr", "as", "ast", "at", "ate", "au", "av", "ay", "aye", "ba", "be", "ben", "bo", "br", "bri", "bu", "bur", "ca", "cal", "car", "ce", "chi", "ci", "ck", "co", "com", "con", "cor", "cy", "d", "da", "dan", "dar", "de", "den", "di", "do", "dor", "du", "dur", "ed", "el", "en", "eon", "er", "es", "ey", "fa", "far", "fe", "fi", "fin", "fo", "for", "foy", "fr", "fu", "ga", "gal", "ge", "gi", "gil", "gin", "go", "gor", "gr", "gu", "ha", "han", "har", "he", "hi", "hin", "ho", "hoe", "hos", "hu", "ic", "il", "ill", "in", "ing", "ion", "ir", "irk", "is", "ja", "je", "jen", "jo", "ju", "ka", "ke", "ker", "ki", "kir", "ko", "la", "lan", "las", "le", "ler", "li", "lin", "lis", "lo", "lor", "loy", "lu", "ma", "mac", "mal", "man", "mas", "me", "mi", "mo", "mon", "mu", "mul", "mur", "na", "nal", "ne", "ni", "no", "nor", "nov", "nu", "och", "ode", "oka", "ol", "ome", "on", "op", "or", "ore", "os", "ou", "ous", "pa", "par", "pe", "pen", "pi", "po", "pol", "pon", "por", "pu", "qu", "ra", "re", "ri", "ro", "ru", "sa", "se", "si", "so", "su", "ta", "te", "ti", "to", "tu", "ul", "un", "ur", "us", "va", "ve", "vi", "vo", "vu", "wa", "we", "wi", "wo", "wu", "y", "ya", "ye", "yi", "yo", "yu", "za", "ze", "zi", "zo"];
let prefix = prefixes[Math.floor(Math.random() * prefixes.length)];
const suffix = suffixes[Math.floor(Math.random() * suffixes.length)];
@ -43,7 +18,7 @@ export function generateCityName(settings : cityGeneratorSetting) {
generatedName = capitalizeFirstLetter(generatedName);
prefix = capitalizeFirstLetter(prefix);
return numSyllables > 3 ? `${prefix} ${generatedName}` : `${generatedName}${suffix}`;
return numSyllables > 2 ? `${prefix} ${generatedName}` : `${generatedName}${suffix}`;
}
function capitalizeFirstLetter(string:string) {

View file

@ -1,64 +1,91 @@
import { currency, lootTables } from "settings/Datatypes";
export function generateLoot(enableCurrency: boolean, currencyFrequency: number, currencyTypes: currency[], lootTable: lootTables) {
const { adj, items } = lootTable;
const itemAmount = Math.floor(Math.random() * 5) + 1;
const adjectives = lootTable.adj;
const nouns = lootTable.nouns;
const ItemAmount = Math.floor(Math.random() * (5 - 1 + 1)) + 1;
let loot = '';
for (let index = 0; index < itemAmount; index++) {
const randomAdjective = adj[Math.floor(Math.random() * adj.length)];
const amount = generateRareHighNumber(50, 0.1);
const randomNoun = getRandomElement(items);
const article = /^[aeiou]/i.test(randomAdjective) ? 'an' : 'a';
const plural = randomNoun?.endsWith('s') ? `${randomNoun}'` : `${randomNoun}s`;
loot += `${amount > 1 ? `${amount} ${randomAdjective} ${plural}` : `${article} ${randomAdjective} ${randomNoun}`}, `;
for (let index = 0; index < ItemAmount; index++) {
const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];
const amount = generateRareHighNumber(50, 0.1);
const vowels = ["a", "e", "i", "o", "u"];
const randomNoun = nouns[Math.floor(Math.random() * nouns.length)];
const vowelOrNot = isFirstCharInArray(vowels, randomAdjective) ? "an" : "a";
let addS = randomNoun;
if (!(randomNoun[randomNoun.length-1] === "e") && !(randomNoun[randomNoun.length] === "s")) {
addS = randomNoun[randomNoun.length] === "s" ? randomNoun + "'s" : randomNoun + "s";
}
amount > 1 ? loot += `${amount} ${randomAdjective} ${addS}` : loot += `${vowelOrNot} ${randomAdjective} ${randomNoun}`;
loot += ", "
}
if (enableCurrency) {
const shouldGenCurrency = Math.random() * 100;
const currencyLoot = currencyTypes
.map((element) => {
const randomCurrencyAmount = generateRareHighNumberByRarity(element.rarity);
return randomCurrencyAmount > 0 ? `${randomCurrencyAmount} ${element.name}, ` : '';
})
.join('');
let currencyLoot = '';
const shouldGenCurrency = Math.floor(Math.random() * 100);
if (shouldGenCurrency < currencyFrequency) {
loot += currencyLoot;
currencyTypes.forEach(element => {
const randomCurrencyAmount = generateRareHighNumberByRarity(element.rarity);
if (randomCurrencyAmount > 0) {
currencyLoot += randomCurrencyAmount + " " + element.name + ", ";
}
});
}
loot += currencyLoot;
}
return loot.slice(0, -2);
return loot;
}
function isFirstCharInArray(array: string[], string: string) {
return array.includes(string[0]);
}
function generateRareHighNumber(maxNumber: number, rarityFactor: number) {
const randomNumber = Math.random();
const rarity = randomNumber < rarityFactor ? rarityFactor : rarityFactor / 10;
return Math.floor(Math.random() * maxNumber * rarity);
if (randomNumber < rarityFactor) {
return Math.floor(Math.random() * maxNumber);
} else {
return Math.floor(Math.random() * (maxNumber / 10));
}
}
function generateRareHighNumberByRarity(rarity: string) {
const rarityFactors: { [key: string]: number } = { common: 0.7, uncommon: 0.5, rare: 0.2, rarest: 0.02 };
const maxNumbers: { [key: string]: number } = { common: 300, uncommon: 150, rare: 30, rarest: 10 };
let rarityFactor = 0;
let maxNumber = 0;
const randomNumber = Math.random();
const isZero = Math.random();
if (randomNumber > rarityFactors[rarity] || rarityFactors[rarity] === undefined) {
if (rarity === "common" && isZero > 0.3) {
rarityFactor = 0.7;
maxNumber = 300;
}
if (rarity === "uncommon" && isZero > 0.5) {
rarityFactor = 0.5;
maxNumber = 150;
}
if (rarity === "rare" && isZero > 0.8) {
rarityFactor = 0.2
maxNumber = 30
}
if (rarity === "rarest" && isZero > 0.98) {
rarityFactor = 0.02
maxNumber = 10
}
if (rarityFactor === 0) {
return 0;
}
return Math.floor(Math.random() * maxNumbers[rarity]);
}
function getRandomElement<T>(arr: { item: T, weight: number }[]): T | undefined {
const totalWeight = arr.reduce((acc, cur) => acc + cur.weight, 0);
let randomWeight = Math.random() * totalWeight;
for (const { item, weight } of arr) {
if (randomWeight < weight) {
return item;
}
randomWeight -= weight;
if (randomNumber < rarityFactor) {
return Math.floor(Math.random() * maxNumber);
} else {
return Math.floor(Math.random() * (maxNumber / 10));
}
return undefined;
}

View file

@ -1,495 +0,0 @@
import { rollD100, rollD20, weightedRandomItem } from "settings/Datatypes";
//Inspiration for this Generator Was taken from Spectactular Settlements Published By Nord Games. https://nordgamesllc.com/product/spectacular-settlements/ Please Buy the Book if you like this Generator.
const specialtyOptions: string[] = ["Atypical Shipping Methods", "Food & Drink", "Hospitality", "Information", "Purchasing Connections", "Unscrupulous Contractors"];
const ageOptions: { string: string, range: number[] }[] = [
{ string: "Established", range: [4, 8] },
{ string: "Mature", range: [9, 13] },
{ string: "Old", range: [14, 17] },
{ string: "Recently Established", range: [1, 3] },
{ string: "Ancient", range: [18, 19] },
{ string: "Unknown", range: [20, 20] },
];
const conditionOptions: { string: string, range: number[] }[] = [
{ string: "Ramshackled", range: [1, 2] },
{ string: "Poor", range: [3, 6] },
{ string: "Fair", range: [7, 14] },
{ string: "Good", range: [15, 18] },
{ string: "Immaculate", range: [19, 20] },
];
const visitorTrafficOptions: { string: string, range: number[] }[] = [
{ string: "Vacant: No one is really visiting.", range: [1, 2] },
{ string: "Groups: Visitors are a rarity, though a few might be around.", range: [3, 6] },
{ string: "Crowds: It's typical to see new visitors most days.", range: [7, 14] },
{ string: "Droves: New people come in and out of this trading post.", range: [15, 18] },
{ string: "Masses: The post is swarming with faces that would not be deemed as familiar.", range: [19, 20] },
];
const sizeOptions: { string: string, range: number[] }[] = [
{ string: "Tiny", range: [1, 2] },
{ string: "Small", range: [3, 6] },
{ string: "Medium", range: [7, 14] },
{ string: "Large", range: [15, 18] },
{ string: "Very Large", range: [19, 20] },
];
const environmentOptions: { string: string, range: number[] }[] = [
{ string: "Mountainous", range: [1, 2] },
{ string: "Desert", range: [3, 4] },
{ string: "Valley", range: [5, 6] },
{ string: "Swamp", range: [7, 8] },
{ string: "Plains", range: [9, 10] },
{ string: "Coastal", range: [11, 12] },
{ string: "Forest", range: [13, 14] },
{ string: "River", range: [15, 16] },
{ string: "Tundra", range: [17, 18] },
{ string: "Underground", range: [19, 20] }
];
const residentPopulationOptions: { string: string, range: number[] }[] = [
{ string: "Nearly Deserted", range: [1, 2] },
{ string: "Sparse", range: [3, 6] },
{ string: "Comfortable", range: [7, 14] },
{ string: "Congested", range: [15, 18] },
{ string: "Overwhelmed", range: [19, 20] },
];
const visitorDispositionOptions: { string: string, range: number[] }[] = [
{ string: "Hostile", range: [1, 2] },
{ string: "Unfriendly", range: [3, 6] },
{ string: "Neutral", range: [7, 14] },
{ string: "Friendly", range: [15, 18] },
{ string: "Open", range: [19, 20] },
];
const lawEnforcementOptions = [
{ string: "None", range: [1, 2] },
{ string: "Sheriff", range: [3, 6] },
{ string: "Local Watch", range: [7, 14] },
{ string: "Well-equipped", range: [15, 18] },
{ string: "Overwhelmingly Present", range: [19, 20] },
];
const leadershipOptions: { string: string, range: number[] }[] = [
{ string: "No Leader", range: [1, 1] },
{ string: "Hereditary", range: [2, 4] },
{ string: "Merchant Monarch", range: [5, 7] },
{ string: "Underworld or Criminal", range: [8, 10] },
{ string: "Oligarchy", range: [11, 13] },
{ string: "Local Council", range: [14, 16] },
{ string: "Single Elected Leader", range: [17, 19] },
{ string: "Commune", range: [20, 20] }
];
const wealthOptions: { string: string, range: number[] }[] = [
{ string: "Destitute", range: [1, 2] },
{ string: "Impoverished", range: [3, 6] },
{ string: "Average", range: [7, 14] },
{ string: "Prosperous", range: [15, 17] },
{ string: "Wealthy", range: [18, 19] },
{ string: "Affluent", range: [20, 20] }
];
const crimeOptions: { string: string, range: number[] }[] = [
{ string: "Regular", range: [1, 2] },
{ string: "Common", range: [3, 6] },
{ string: "Average", range: [7, 14] },
{ string: "Uncommon", range: [15, 18] },
{ string: "Rare", range: [19, 20] }
];
const shopOptions: { string: string, range: number[] }[] = [
{ string: "Baker", range: [1, 4] },
{ string: "Butcher", range: [5, 8] },
{ string: "Cooper", range: [9, 12] },
{ string: "Carpenter", range: [13, 16] },
{ string: "General Store", range: [17, 24] },
{ string: "Herbalist", range: [25, 28] },
{ string: "Smithy", range: [29, 36] },
{ string: "Tailor", range: [37, 40] },
{ string: "Tanner", range: [41, 44] },
{ string: "Thatcher", range: [45, 48] },
{ string: "Wainwright", range: [49, 52] },
{ string: "Weaver", range: [53, 56] },
{ string: "Alchemist", range: [57, 59] },
{ string: "Artist", range: [60, 62] },
{ string: "Bank/Exchange", range: [63, 65] },
{ string: "Cobbler", range: [66, 68] },
{ string: "Foundry", range: [69, 71] },
{ string: "Mill", range: [72, 74] },
{ string: "Textile Production", range: [75, 77] },
{ string: "Shipwright", range: [78, 80] },
{ string: "Rare Botanicals", range: [81, 82] },
{ string: "Luxury Furnishings", range: [83, 84] },
{ string: "Rare Trade Goods", range: [85, 86] },
{ string: "Rare Drink Brewery", range: [87, 88] },
{ string: "Magic Shop-Armor", range: [89, 90] },
{ string: "Magic Shop-Books", range: [91, 92] },
{ string: "Magic Shop-Clothing", range: [93, 94] },
{ string: "Magic Shop-Jewelry", range: [95, 96] },
{ string: "Magic Shop-Weapons", range: [97, 98] },
{ string: "Magic Shop-Miscellaneous & Curiosities", range: [99, 100] }
];
const serviceOptions: { string: string, range: number[] }[] = [
{ string: "Barber", range: [1, 8] },
{ string: "Bathhouse", range: [9, 16] },
{ string: "Doctor/Apothercary", range: [17, 24] },
{ string: "House of Leisure (GM Discretion)", range: [25, 32] },
{ string: "Inn", range: [33, 44] },
{ string: "Club", range: [45, 52] },
{ string: "Soothsayer", range: [53, 60] },
{ string: "Stable", range: [61, 68] },
{ string: "Tavern", range: [69, 80] },
{ string: "Hired Help - Muscle", range: [81, 82] },
{ string: "Hired Help - Assassins/Thieves", range: [83, 84] },
{ string: "Hired Help - Ranged Attack Specialists", range: [85, 86] },
{ string: "Hired Help - Scribes and Clerks", range: [87, 88] },
{ string: "Hired Help - Caravans and Mounts", range: [89, 90] },
{ string: "Hired Help - Arcane Academics/Inventors", range: [91, 92] },
{ string: "Hired Help - Magic Mercs", range: [93, 94] },
{ string: "Hired Help - Religious Guidance", range: [95, 96] },
{ string: "Hired Help - Divine Specialists", range: [97, 98] },
{ string: "Hired Help - Guides and Trackers", range: [99, 100] }
];
const origins: string[] = [
"Accidental: 'the trading post came about due to an accident, such as a caravan breaking down or mistaken directions. What was set up to deal with the eventually become the trading post.'",
"Business Venture: 'The trading post was established by a wealthy entrepreneur specifically to be a trading post from the start.'",
"Crossroads: 'The trading post is at the intersection of more than one major trade route.'",
"Military Outpost: 'The trading post was built on the remnants of an old fortress or watchtower, the structures of which have long since fallen down or been repurposed by the locals.'",
"No Man's Land: 'The trading post was established as a neutral place where opposing forces could purchase wares, without encroaching on enemy territory.'",
"Native: 'The trading post was started by someone native to the area, who saw potential in trade with passersby.'",
"Overnight Stop: 'The trading post was originally a single, large house for overnight stays for weary travellers, which soon grew, along with the demand for accommodations.'",
"Wilderness Expert: 'The trading post was started when a trapper, hunter or guide set up a camp, in order to aid those passing through the area.'",
"Religious: 'The trading post was established by a religious order, as a means of supporting their ministry.'",
"River Crossing: 'The trading post was built near a major river crossing so that traders could more easily cross and barter their goods.'",
"Pilgrimage: 'The trading post was set up to serve the needs of people travelling on a pilgrimage.'",
"King's Grant: 'The trading post was established as part of a royal grant, as a means of encouraging trade and commerce in the region.'",
"Scavengers: 'The trading post was created by a group of scavengers, who had discovered a valuable resource or sought to capitalize on the needs of travellers.'",
"Fishing Group: 'The trading post was established by a Group of Fishermen, in order to support a nearby population and capitalize on the sea trade.'",
"Frontier Expansion: 'The trading post was established as part of a larger effort to expand the kingdom's frontier, and to open up new trade routes.'"
];
export function generateTradingPost(): string {
let visitorTrafficMod = 0;
let popWealth = 0;
let sizeMod = 0;
let crimeMod = 0;
const origin = origins[Math.floor(Math.random() * origins.length)];
const specialiaty = specialtyOptions[Math.floor(Math.random() * specialtyOptions.length)];
const age = ageRoll();
visitorTrafficMod += age.mod;
const condition = conditionRoll();
popWealth += condition.mod;
const visitorTraffic = visitorTrafficRoll(visitorTrafficMod);
sizeMod += visitorTraffic.mod[0];
crimeMod += visitorTraffic.mod[1];
const postSize = weightedRandomItem(sizeOptions, rollD20(sizeMod));
const environment = weightedRandomItem(environmentOptions, rollD20(0));
const residentPop = residentPopRoll();
crimeMod += residentPop.mod;
const visitorDisposition = weightedRandomItem(visitorDispositionOptions, rollD20(0));
const lawEnforcement = lawEnforcementRoll();
crimeMod += lawEnforcement.mod;
const leadership = leadershipRoll();
const wealth = wealthRoll(popWealth);
crimeMod += wealth.mod;
const crime = weightedRandomItem(crimeOptions, rollD20(crimeMod));
const shops = shopRoll(postSize as string);
const services = serviceRoll(postSize as string);
return `Origin: ${origin}\nSpeciality: ${specialiaty}\nAge: ${age.string}\nCondition: ${condition.string}\nVisitor Traffic: ${visitorTraffic.string}\nTrading Post Size: ${postSize}\nEnvironment: ${environment}\nResident Population: ${residentPop.string}\nDisposition to Visitors: ${visitorDisposition}\nLaw Enforcement: ${lawEnforcement.string}\nLeadership: ${leadership}\nWealth: ${wealth.string}\nCrime: ${crime}\nShops: ${shops}\nServices: ${services}`
}
function serviceRoll(tradingPostSize: string): string {
let shopAmount = 0;
switch (tradingPostSize) {
case "Tiny":
shopAmount = Math.floor((Math.random() * 6) + 1);
break;
case "Small":
shopAmount = Math.floor((Math.random() * 6) + 1) + 1;
break;
case "Medium":
shopAmount = Math.floor((Math.random() * 6) + 1) + 3;
break;
case "Large":
shopAmount = Math.floor((Math.random() * 6) + 1) + 5;
break;
case "Very Large":
shopAmount = Math.floor((Math.random() * 6) + 1) + 7;
break;
default:
break;
}
const services: string[] = [];
for (let index = 0; index < shopAmount; index++) {
const roll: string = weightedRandomItem(serviceOptions, rollD100(0)) as string;
let hiredHelp = "";
if (roll.includes("Hired Help")) {
const helpSize = Math.floor((Math.random() * 12) + 1);
if (helpSize <= 6) {
hiredHelp = ": An Individual Person who is hiring out their services of this type";
}
if (helpSize <= 10) {
hiredHelp = ": A Team of people who are hiring out their services of this type";
} else {
hiredHelp = ": A Guild that is organised for this type of service "
}
}
services.push(`${roll + hiredHelp}`);
}
return generateStringWithCounts(services);
}
function shopRoll(tradingPostSize: string): string {
let shopAmount = 0;
switch (tradingPostSize) {
case "Tiny":
shopAmount = Math.floor((Math.random() * 8) + 1) + 2;
break;
case "Small":
shopAmount = Math.floor((Math.random() * 8) + 1) + 4;
break;
case "Medium":
shopAmount = Math.floor((Math.random() * 8) + 1) + 6;
break;
case "Large":
shopAmount = Math.floor((Math.random() * 8) + 1) + 8;
break;
case "Very Large":
shopAmount = Math.floor((Math.random() * 8) + 1) + 10;
break;
default:
break;
}
const shops: string[] = [];
for (let index = 0; index < shopAmount; index++) {
const roll: string = weightedRandomItem(shopOptions, rollD100(0)) as string;
shops.push(roll);
}
console.log(shops);
return generateStringWithCounts(shops);
}
function leadershipRoll(): string {
const roll: string = weightedRandomItem(leadershipOptions, rollD20(0)) as string;
let result = roll;
leadershipOptions.forEach(element => {
if (element.string === roll) {
if (element.string === leadershipOptions[4].string) {
const sway = Math.floor((Math.random() * 4) + 1);
switch (sway) {
case 1:
result = "Plutocracy (Merchant Group Runs the Post)";
break;
case 2:
result = "Magocracy (Mages and Magic users Run the Post)";
break;
case 3:
result = "Theocracy (Priests and Religious Orders Run the Post)";
break;
case 4:
result = "A Small unknown group Runs the Post";
break;
default:
break;
}
}
}
});
return result;
}
function ageRoll(): { string: string, mod: number } {
const roll: string = weightedRandomItem(ageOptions, rollD20(0)) as string;
if (roll === ageOptions[0].string) {
return { string: roll, mod: 0 }
}
if (roll === ageOptions[1].string) {
return { string: roll, mod: 1 };
}
if (roll === ageOptions[2].string) {
return { string: roll, mod: 2 };
}
if (roll === ageOptions[3].string) {
return { string: roll, mod: -1 };
}
if (roll === ageOptions[4].string) {
return { string: roll, mod: 3 };
}
return { string: roll, mod: 4 };
}
function wealthRoll(mod: number): { string: string, mod: number } {
const roll: string = weightedRandomItem(wealthOptions, rollD20(mod)) as string;
if (roll === ageOptions[0].string) {
return { string: roll, mod: -4 }
}
if (roll === ageOptions[1].string) {
return { string: roll, mod: -2 };
}
if (roll === ageOptions[2].string) {
return { string: roll, mod: 0 };
}
if (roll === ageOptions[3].string) {
return { string: roll, mod: -1 };
}
if (roll === ageOptions[4].string) {
return { string: roll, mod: -2 };
}
return { string: roll, mod: -4 };
}
function conditionRoll(): { string: string, mod: number } {
const roll: string = weightedRandomItem(conditionOptions, rollD20(0)) as string;
if (roll === ageOptions[0].string) {
return { string: roll, mod: -6 }
}
if (roll === ageOptions[1].string) {
return { string: roll, mod: -3 };
}
if (roll === ageOptions[2].string) {
return { string: roll, mod: 0 };
}
if (roll === ageOptions[3].string) {
return { string: roll, mod: 3 };
}
return { string: roll, mod: 6 };
}
function visitorTrafficRoll(mod: number): { string: string, mod: number[] } {
const roll: string = weightedRandomItem(visitorTrafficOptions, rollD20(mod)) as string;
if (roll === ageOptions[0].string) {
return { string: roll, mod: [0, 2] }
}
if (roll === ageOptions[1].string) {
return { string: roll, mod: [1, 1] };
}
if (roll === ageOptions[2].string) {
return { string: roll, mod: [2, 0] };
}
if (roll === ageOptions[3].string) {
return { string: roll, mod: [3, -1] };
}
return { string: roll, mod: [4, -2] };
}
function residentPopRoll(): { string: string, mod: number } {
const roll: string = weightedRandomItem(residentPopulationOptions, rollD20(0)) as string;
if (roll === ageOptions[0].string) {
return { string: roll, mod: 2 }
}
if (roll === ageOptions[1].string) {
return { string: roll, mod: 1 };
}
if (roll === ageOptions[2].string) {
return { string: roll, mod: 0 };
}
if (roll === ageOptions[3].string) {
return { string: roll, mod: -1 };
}
return { string: roll, mod: -2 };
}
function lawEnforcementRoll(): { string: string, mod: number } {
const roll: string = weightedRandomItem(lawEnforcementOptions, rollD20(0)) as string;
if (roll === ageOptions[0].string) {
return { string: roll, mod: -8 }
}
if (roll === ageOptions[1].string) {
return { string: roll, mod: -4 };
}
if (roll === ageOptions[2].string) {
return { string: roll, mod: 0 };
}
if (roll === ageOptions[3].string) {
return { string: roll, mod: 4 };
}
return { string: roll, mod: 8 };
}
function generateStringWithCounts(arr: string[]): string {
const counts: Record<string, number> = {};
for (const item of arr) {
counts[item] = (counts[item] || 0) + 1;
}
let result = "";
for (const item in counts) {
const count = counts[item];
const itemString = count > 1 ? `${item}s` : item;
if (result === "") {
result = `${count} ${itemString}`;
} else {
result = `${result}, ${count} ${itemString}`;
}
}
return result;
}

64
main.ts
View file

@ -1,13 +1,12 @@
import { GeneratorModal } from 'editor/GeneratorModal';
import { MarkdownView, Notice, Plugin, Editor } from 'obsidian';
import { MarkdownView, Notice, Plugin } from 'obsidian';
import { InlineGeneratorSuggester } from "editor/InlineGenerator";
import { FantasyPluginSettings, possibleOptions } from 'settings/Datatypes';
import { MyPluginSettings, possibleOptions } from 'settings/Datatypes';
import { DEFAULT_SETTINGS } from 'settings/DefaultSetting';
import { SettingTab } from 'settings/SettingsTab';
export default class FantasyPlugin extends Plugin {
settings: FantasyPluginSettings;
currentEditor: Editor | null = null;
export default class MyPlugin extends Plugin {
settings: MyPluginSettings;
//Function used to return the array of options for the suggester.
getOptionsForSuggest(): string[] {
@ -16,55 +15,21 @@ export default class FantasyPlugin extends Plugin {
async onload() {
await this.loadSettings();
this.app.workspace.on('active-leaf-change', (leaf) => {
if (leaf) {
const view = leaf.view;
if (view instanceof MarkdownView) {
this.currentEditor = view.editor;
} else {
this.currentEditor = null;
}
} else {
this.currentEditor = null;
app.workspace.onLayoutReady(() => {
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
// Make sure the user is editing a Markdown file.
if (view) {
//Register the InlineGeneratorSuggester to the Editor suggester.
this.registerEditorSuggest(new InlineGeneratorSuggester(this.getOptionsForSuggest, this));
}
});
//Command to open Modal dialog
this.addCommand({
id: 'open-fantasy-generator',
name: 'Open Fantasy Generator',
callback: () => {
new GeneratorModal(this.app, (result) => {
const copyContent = async () => {
//Try to see if any generators spit out an Error or if copying the string fails.
try {
if (result instanceof Error) {
new Notice(`${result}`);
} else {
await navigator.clipboard.writeText(result);
new Notice(`${result} was copied to the clipboard.`);
}
} catch (err) {
console.error('Failed to copy: ', err);
new Notice("Failed to copy, Check error in console.");
}
}
copyContent();
}, this).open();
},
});
//Register the InlineGeneratorSuggester to the Editor suggester.
this.registerEditorSuggest(new InlineGeneratorSuggester(this.getOptionsForSuggest, this));
// This creates an icon in the left ribbon to access the modal for the Fantasy Content Generator.
this.addRibbonIcon('book', 'Fantasy Generators', (evt: MouseEvent) => {
const ribbonIconEl = this.addRibbonIcon('book', 'Fantasy Generators', (evt: MouseEvent) => {
// Called when the user clicks the icon.
new GeneratorModal(this.app, (result) => {
const copyContent = async () => {
console.log();
//Try to see if any generators spit out an Error or if copying the string fails.
try {
if (result instanceof Error) {
@ -83,10 +48,15 @@ export default class FantasyPlugin extends Plugin {
}, this).open();
});
// Perform additional things with the ribbon
ribbonIconEl.addClass('my-plugin-ribbon-class');
// This adds a settings tab so the user can configure various aspects of the plugin
this.addSettingTab(new SettingTab(this.app, this));
// When registering intervals, this function will automatically clear the interval when the plugin is disabled.
this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000));
console.log("loaded Fantasy Content Generator");
}

View file

@ -1,9 +1,11 @@
{
"id": "fantasy-content-generator",
"id": "obsidian-fantasy-content-generator",
"name": "Fantasy Content Generator",
"version": "1.2.4",
"version": "1.2.0",
"minAppVersion": "0.15.0",
"description": "A Fantasy Content Generator for Obsidian for All Your TTRPG / World Building Needs",
"author": "Gregory Jagermeister ",
"description": "A Fantasy Content Generator for Obsidian",
"author": "Obsidian",
"authorUrl": "https://obsidian.md",
"fundingUrl": "https://obsidian.md/pricing",
"isDesktopOnly": false
}
}

View file

@ -1,11 +1,11 @@
{
"name": "fantasy-content-generator",
"version": "1.2.4",
"description": "A Fantasy Content Generator For all your TTRPG Needs",
"version": "1.2.0",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "tsc -noEmit -skipLibCheck && node prod.esbuild.config.mjs production && copy manifest.json fantasy-content-generator && copy styles.css fantasy-content-generator && zip-build fantasy-content-generator builds",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production && copy manifest.json fantasy-content-generator && copy styles.css fantasy-content-generator && zip-build fantasy-content-generator fantasy-content-generator",
"version": "node version-bump.mjs && git add manifest.json versions.json"
},
"keywords": [],

View file

@ -1,49 +0,0 @@
import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";
const banner =
`/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;
const prod = (process.argv[2] === "production");
const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ["main.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins,
],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "fantasy-content-generator/main.js",
});
if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}

View file

@ -1,118 +1,113 @@
import * as fs from 'fs';
import { Notice } from 'obsidian';
// The possible Options that could be selected durring inline generation
export const possibleOptions = [
'TradingPost',
'ElfMale',
'ElfMaleLastname',
'ElfFemale',
'ElfFemaleLastname',
'Orc',
'OrcLastname',
'DwarfMale',
'DwarfMaleLastname',
'DwarfFemale',
'DwarfFemaleLastname',
'HumanMale',
'HumanFemale',
'HumanMaleLastname',
'HumanFemaleLastname',
"DungeonsLabryinths",
"InnsTaverns",
"Settlement",
"Airships",
"Drinks",
"Artifacts",
"LootTreasure",
"Metals",
"MagicalTrees",
"Ship",
"AnimalGroups",
"Groups",
"Religion",
"AasimarsLastname",
"CatfolkLastname",
"FetchlingsLastname",
"HalfElfLastname",
"HalfOrcLastname",
"HobgoblinLastname",
"IfritsLastname",
"KobaldsLastname",
"OreadsLastname",
"RatfolkLastname",
"SylphsLastname",
"TenguLastname",
"TiansLastname",
"TieflingLastname",
"UndinesLastname",
"AngelMaleLastname",
"AngelFemaleLastname",
"CavePersonMaleLastname",
"CavePersonFemaleLastname",
"DarkElfMaleLastname",
"DarkElfFemaleLastname",
"DemonLastname",
"DragonMaleLastname",
"DragonFemaleLastname",
"DrowMaleLastname",
"DrowFemaleLastname",
"FairyMaleLastname",
"FairyFemaleLastname",
"GnomeMaleLastname",
"GnomeFemaleLastname",
"GoblinLastname",
"HalfDemonMaleLastname",
"HalfDemonFemaleLastname",
"HalflingMaleLastname",
"HalflingFemaleLastname",
"HighElfMaleLastname",
"HighElfFemaleLastname",
"HighFairyMaleLastname",
"HighFairyFemaleLastname",
"OgreLastname",
"Aasimars",
"Catfolk",
"Fetchlings",
"HalfElf",
"HalfOrc",
"Hobgoblin",
"Ifrits",
"Kobalds",
"Oreads",
"Ratfolk",
"Sylphs",
"Tengu",
"Tians",
"Tiefling",
"Undines",
"AngelMale",
"CavePersonMale",
"DarkElfMale",
"DragonMale",
"DrowMale",
"FairyMale",
"GnomeMale",
"HalfDemonMale",
"HalflingMale",
"HighElfMale",
"HighFairyMale",
"Ogre",
"AngelFemale",
"CavePersonFemale",
"DarkElfFemale",
"Demon",
"DragonFemale",
"DrowFemale",
"FairyFemale",
"GnomeFemale",
"Goblin",
"HalfDemonFemale",
"HalflingFemale",
"HighElfFemale",
"HighFairyFemale",
"PlotStoryHooks"
'Gen-ElfMale',
'Gen-ElfMaleLastname',
'Gen-ElfFemale',
'Gen-ElfFemaleLastname',
'Gen-Orc',
'Gen-OrcLastname',
'Gen-DwarfMale',
'Gen-DwarfMaleLastname',
'Gen-DwarfFemale',
'Gen-DwarfFemaleLastname',
'Gen-HumanMale',
'Gen-HumanFemale',
'Gen-HumanMaleLastname',
'Gen-HumanFemaleLastname',
"Gen-DungeonsLabryinths",
"Gen-InnsTaverns",
"Gen-Settlement",
"Gen-Airships",
"Gen-Drinks",
"Gen-Artifacts",
"Gen-LootTreasure",
"Gen-Metals",
"Gen-MagicalTrees",
"Gen-Ship",
"Gen-AnimalGroups",
"Gen-Groups",
"Gen-Religion",
"Gen-AasimarsLastname",
"Gen-CatfolkLastname",
"Gen-FetchlingsLastname",
"Gen-HalfElfLastname",
"Gen-HalfOrcLastname",
"Gen-HobgoblinLastname",
"Gen-IfritsLastname",
"Gen-KobaldsLastname",
"Gen-OreadsLastname",
"Gen-RatfolkLastname",
"Gen-SylphsLastname",
"Gen-TenguLastname",
"Gen-TiansLastname",
"Gen-TieflingLastname",
"Gen-UndinesLastname",
"Gen-AngelMaleLastname",
"Gen-AngelFemaleLastname",
"Gen-CavePersonMaleLastname",
"Gen-CavePersonFemaleLastname",
"Gen-DarkElfMaleLastname",
"Gen-DarkElfFemaleLastname",
"Gen-DemonLastname",
"Gen-DragonMaleLastname",
"Gen-DragonFemaleLastname",
"Gen-DrowMaleLastname",
"Gen-DrowFemaleLastname",
"Gen-FairyMaleLastname",
"Gen-FairyFemaleLastname",
"Gen-GnomeMaleLastname",
"Gen-GnomeFemaleLastname",
"Gen-GoblinLastname",
"Gen-HalfDemonMaleLastname",
"Gen-HalfDemonFemaleLastname",
"Gen-HalflingMaleLastname",
"Gen-HalflingFemaleLastname",
"Gen-HighElfMaleLastname",
"Gen-HighElfFemaleLastname",
"Gen-HighFairyMaleLastname",
"Gen-HighFairyFemaleLastname",
"Gen-OgreLastname",
"Gen-Aasimars",
"Gen-Catfolk",
"Gen-Fetchlings",
"Gen-HalfElf",
"Gen-HalfOrc",
"Gen-Hobgoblin",
"Gen-Ifrits",
"Gen-Kobalds",
"Gen-Oreads",
"Gen-Ratfolk",
"Gen-Sylphs",
"Gen-Tengu",
"Gen-Tians",
"Gen-Tiefling",
"Gen-Undines",
"Gen-AngelMale",
"Gen-CavePersonMale",
"Gen-DarkElfMale",
"Gen-DragonMale",
"Gen-DrowMale",
"Gen-FairyMale",
"Gen-GnomeMale",
"Gen-HalfDemonMale",
"Gen-HalflingMale",
"Gen-HighElfMale",
"Gen-HighFairyMale",
"Gen-Ogre",
"Gen-AngelFemale",
"Gen-CavePersonFemale",
"Gen-DarkElfFemale",
"Gen-Demon",
"Gen-DragonFemale",
"Gen-DrowFemale",
"Gen-FairyFemale",
"Gen-GnomeFemale",
"Gen-Goblin",
"Gen-HalfDemonFemale",
"Gen-HalflingFemale",
"Gen-HighElfFemale",
"Gen-HighFairyFemale",
"Gen-PlotStoryHooks"
];
// currency Datatype for defining custom currency
@ -142,7 +137,7 @@ export type dungeonGenSettings = {
// Datatype for collecting loot settings
export type lootTables = {
adj: string[]
items: { item: string, weight: number }[];
nouns: string[];
}
// Datatype for collecting Drink settings
@ -166,12 +161,8 @@ export type innGeneratorSettings = {
rumors: string[]
}
export interface FileWithPath extends File {
path: string
}
// the interface that uses all
export interface FantasyPluginSettings {
export interface MyPluginSettings {
enableCurrency: boolean;
citySettings: cityGeneratorSetting;
currencyTypes: currency[];
@ -182,49 +173,4 @@ export interface FantasyPluginSettings {
groupSettings: groupGenSettings;
dungeonSettings: dungeonGenSettings;
inlineCallout: string;
}
export function importJSON(path: string, callback: (data: object) => void): void {
fs.readFile(path, 'utf8', (error, data) => {
if (error) {
new Notice("Error Importing: " + error);
return;
}
const jsonData = JSON.parse(data);
new Notice("Data Successfully Imported!");
callback(jsonData);
});
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function exportJSON(data: any) {
const json = JSON.stringify(data);
const blob = new Blob([json], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.download = 'data.json';
a.href = url;
a.click();
new Notice("Data Exporting!");
}
export function weightedRandomItem(table: { string: string, range: number[] }[], roll: number) {
// Find the object in the table that corresponds to the roll
const item = table.find(({ range }) => range[0] <= roll && roll <= range[1]);
// Return the item
return item?.string;
}
export function rollD20(modifier: number) {
return Math.clamp(Math.floor((Math.random() * 20) + 1) + modifier, 1, 20);
}
export function rollD100(modifier: number) {
return Math.clamp(Math.floor((Math.random() * 100) + 1) + modifier, 1, 100);
}

View file

@ -1,11 +1,11 @@
import { FantasyPluginSettings } from "./Datatypes";
import { MyPluginSettings } from "./Datatypes";
//The Default Settings for the Plugin.
export const DEFAULT_SETTINGS: FantasyPluginSettings = {
export const DEFAULT_SETTINGS: MyPluginSettings = {
enableCurrency: false,
citySettings: {
prefixArray: ["camp", "castle", "east", "edge", "ever", "great", "mount", "new", "north", "red", "rose", "south", "west"],
suffixArray: ["avon", "bank", "barrow", "bay", "beach", "bell", "borough", "berg", "bourne", "broad", "bridge", "brook", "brough", "burgh", "burn", "bury", "by", "caster", "chester", "cliffe", "combe", "cot", "cott", "cote", "cove", "croft", "crook", "dale", "den", "din", "dine", "don", "downs", "falls", "field", "fin", "flats", "ford", "fork", "gate", "grove", "ham", "harbour", "heights", "hill", "holm", "hurst", "ing", "kirk", "land", "lake", "latch", "lea", "leigh", "ley", "marsh", "mere", "minster", "mond", "ness", "park", "pilly", "point", "pond", "ridge", "river", "rock", "sett", "side", "son", "stead", "stoke", "stone", "stow", "thorpe", "ton", "tor", "town", "vale", "valley", "well", "wick", "worth", "cadia"],
suffixArray: ["wood", "avon", "bank", "bark", "barrow", "bay", "beach", "bell", "borough", "berg", "bourne", "broad", "bridge", "brook", "brough", "burgh", "burn", "bury", "by", "canyon", "caster", "chester", "cliffe", "combe", "cot", "cott", "cote", "cove", "creek", "croft", "crook", "dale", "den", "din", "dine", "don", "downs", "falls", "field", "fin", "flats", "ford", "fork", "gate", "grove", "gum", "ham", "harbour", "heights", "hill", "holm", "hurst", "ing", "kirk", "land", "lake", "latch", "lea", "leigh", "ley", "marsh", "mere", "minster", "mond", "mont", "more", "ness", "park", "pilly", "pine", "point", "pond", "ridge", "river", "rock", "sett", "side", "son", "stead", "stoke", "stone", "stow", "terrace", "thorpe", "ton", "tor", "town", "vale", "valley", "view", "village", "ville", "water", "well", "wharf", "wick", "wood", "worth"],
},
innSettings: {
prefixes: ["The Rusty", "The Cosy", "The Grand", "The Quiet", "The Friendly", "Bashur's", "Harmony", "Harmonic", "Bald Faced", "Black", "Grey", "Silver", "White", "Blue", "Purple", "Green", "The Ugly", "The Pretty", "Ye Ol' Fighting", "The Drunk", "One", "Two", "Three", "Four", "Five", "Busta", "The Terrified"],
@ -145,52 +145,8 @@ export const DEFAULT_SETTINGS: FantasyPluginSettings = {
nouns: ["Cocktail", "Smoothie", "Shake", "Juice", "Iced Tea", "Lemonade", "Soda", "Ale", "Brandy", "Tea", "Tea", "Sherry", "Brew", "Cappuchino", "Cider", "Coffee", "Cognac", "Dark Ale", "Dark Beer", "Drink", "Espresso", "Gin", "Java", "Lager", "Light Ale", "Light Beer", "Mead", "Mocha", "Red Wine", "Rum", "Sake", "Tea", "Tonic", "Vodka", "Whiskey", "White Wine", "Wine"]
},
lootSettings: {
adj: ["old", "tattered", "rotten", "shiny", "polished", "rusty", "broken", "priceless", "ancient", "precious", 'shiny', 'glowing', 'mysterious', 'ancient', 'enchanted', 'ornate', 'magical', 'powerful'],
items: [
{ item: 'feather', weight: 0.8 },
{ item: 'sword', weight: 0.2 },
{ item: 'bow', weight: 0.2 },
{ item: 'wand', weight: 0.1 },
{ item: 'armor', weight: 0.2 },
{ item: 'shield', weight: 0.1 },
{ item: 'amulet', weight: 0.1 },
{ item: 'ring', weight: 0.1 },
{ item: 'book', weight: 0.2 },
{ item: 'scroll', weight: 0.2 },
{ item: 'potion', weight: 0.3 },
{ item: 'trinket', weight: 0.3 },
{ item: 'gemstone', weight: 0.2 },
{ item: 'wand core', weight: 0.1 },
{ item: 'tome', weight: 0.2 },
{ item: 'relic', weight: 0.1 },
{ item: 'spellbook', weight: 0.2 },
{ item: 'grimoire', weight: 0.2 },
{ item: 'tome', weight: 0.2 },
{ item: 'journal', weight: 0.2 },
{ item: 'ledger', weight: 0.1 },
{ item: 'diary', weight: 0.1 },
{ item: 'healing potion', weight: 0.2 },
{ item: 'mana potion', weight: 0.2 },
{ item: 'invisibility potion', weight: 0.1 },
{ item: 'poison', weight: 0.1 },
{ item: 'love potion', weight: 0.1 },
{ item: 'strength potion', weight: 0.1 },
{ item: 'speed potion', weight: 0.1 },
{ item: 'water breathing potion', weight: 0.1 },
{ item: 'fire resistance potion', weight: 0.1 },
{ item: 'flying potion', weight: 0.1 },
{ item: 'locket', weight: 0.2 },
{ item: 'charm', weight: 0.3 },
{ item: 'statue', weight: 0.2 },
{ item: 'figurine', weight: 0.2 },
{ item: 'music box', weight: 0.1 },
{ item: 'dagger', weight: 0.1 },
{ item: 'pen', weight: 0.1 },
{ item: 'hourglass', weight: 0.1 },
{ item: 'pipe', weight: 0.1 },
{ item: 'goblet', weight: 0.1 },
{ item: 'candle', weight: 0.2 },
]
adj: ["old", "tattered", "rotten", "shiny", "polished", "rusty", "broken", "priceless", "ancient", "precious"],
nouns: ["bag", "scroll", "book", "map", "key", "ring", "necklace", "potion", "ball bearing", "alchemists fire", "antitoxin", "caltrop", "book", "candle", "map scroll", "chain", "climbers kit", "crowbar", "fishing tackle", "holy water", "hunting trap", "lantern", "lock", "oil", "poison", "ram portable", "spyglass", "tent", "bucket", "glass bottle", "chest", "signet ring", "sealing wax", "whetstone", "arrows", "bolt", "censer", "dice set", "dragonchess set", "flute", "glass blowers tool", "holy oil", "lute", "playing card set", "sack", "saddle", "sovereign glue", "universal solvent", "prosthetic wooden arm", "hook hand", "peg leg", "glass eye", "bag of marbles", "hatchet", "alchemists supplies", "brewers supplies", "burglars pack", "lockpicks", "calligraphers supplies", "carpenter's tool", "cartographers tool", "chain mail", "cooks utensil", "disguise kit", "dungeoneers pack", "entertainers pack", "explorers pack", "forgery kit", "half plate", "healers kit", "ink", "ink pen", "parchment", "shovel", "leather worker's tool", "masons tool", "navigator's tool", "net", "painters supplies", "perfume", "plate armor", "potters tool", "priests pack", "ring mail", "scale mail", "scholar's pack", "scimitar", "shield", "whistle", "smiths tool", "thieves tool", "torch", "weaver's tool", "cobblers tool", "jewelers tools", "tinkers tool", "poisoners kit", "herbalism kit", "bell", "block and tackle", "animal or pet", "traveler's clothes", "fine clothes"]
},
groupSettings: {
adj: ["azure", "black", "blue", "brass", "bronze", "brown", "cardinal", "cobalt", "copper", "crimson", "crystal", "demon", "denim", "diamond", "ebony", "electric", "emerald", "fire", "flame", "gold", "green", "grey", "grizzly", "ice", "ivory", "jade", "onyx", "orange", "red", "royal", "ruby", "sanguine", "sapphire", "scarlet", "thunder", "violet", "white", "yellow", "", "", "", "", "", "", "", "", "", "", "", ""],

View file

@ -1,12 +1,11 @@
import FantasyPlugin from "main";
import { PluginSettingTab, App, Setting, Platform } from "obsidian";
import { cityGeneratorSetting, currency, drinkGeneratorSettings, dungeonGenSettings, exportJSON, FileWithPath, groupGenSettings, importJSON, innGeneratorSettings, lootTables } from "./Datatypes";
import MyPlugin from "main";
import { PluginSettingTab, App, Setting } from "obsidian";
import { DEFAULT_SETTINGS } from "./DefaultSetting";
export class SettingTab extends PluginSettingTab {
plugin: FantasyPlugin;
plugin: MyPlugin;
constructor(app: App, plugin: FantasyPlugin) {
constructor(app: App, plugin: MyPlugin) {
super(app, plugin);
this.plugin = plugin;
}
@ -20,8 +19,7 @@ export class SettingTab extends PluginSettingTab {
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
createSettingsBlock(containerEl: HTMLElement, textA: string, arr: any[], type: string, weights: boolean): void {
new Setting(containerEl).setName(type + " being used").setDesc("Click 'remove' for any item you want removed from the Array");
createSettingsBlock(containerEl: HTMLElement, textA: string, arr: any[], type: string): void {
new Setting(containerEl)
.setName("New Addition:")
.addTextArea((text) => {
@ -38,12 +36,15 @@ export class SettingTab extends PluginSettingTab {
})
})
containerEl.createEl("p", { text: "Click 'remove' on a prefix you would like to removed" });
const foldDiv = containerEl.createEl('details', { cls: "OFCGDetails" });
foldDiv.createEl("summary", { text: type, cls: "OFCGSummary" });
for (let index = 0; index < arr.length; index++) {
new Setting(foldDiv)
.setName(weights ? JSON.stringify(arr[index]) : arr[index])
.setName(arr[index])
.addButton((btn) => btn
.setCta()
.setButtonText("Remove")
@ -55,6 +56,7 @@ export class SettingTab extends PluginSettingTab {
)
}
containerEl.createEl('hr');
}
@ -64,8 +66,8 @@ export class SettingTab extends PluginSettingTab {
containerEl.empty();
containerEl.createEl('h1', { text: 'Fantasy Content Generator' });
const generalSettings = containerEl.createDiv("general")
new Setting(generalSettings)
new Setting(containerEl)
.setName('Reset To Defaults')
.setDesc('Click if you would like to use the default settings again')
.addButton((btn) => {
@ -78,7 +80,7 @@ export class SettingTab extends PluginSettingTab {
})
})
new Setting(generalSettings).setName("Inline Generator Callout").setDesc("Set callout character to activate the inline Generator.")
new Setting(containerEl).setName("Inline Generator Callout").setDesc("Set callout character to activate the inline Generator.")
.addText((text) => {
text.setValue(String(this.plugin.settings.inlineCallout));
text.onChange(async (value) => {
@ -89,11 +91,9 @@ export class SettingTab extends PluginSettingTab {
// CURRENCEY SETTINGS //
const currencyEl = containerEl.createDiv("currencyDiv");
containerEl.createEl("h2", { text: "Currency Settings" });
new Setting(currencyEl).setHeading().setName("Currency Settings");
new Setting(currencyEl)
new Setting(containerEl)
.setName('Enable Currency for Loot Generation.')
.setDesc('If you have Currency in your World or game consider Activating this')
.addToggle((toggle) => {
@ -107,7 +107,7 @@ export class SettingTab extends PluginSettingTab {
if (this.plugin.settings.enableCurrency) {
new Setting(currencyEl).setName("Occurance Rate:").setDesc("Set How Frequently Loot generates currency as a percentage of 100")
new Setting(containerEl).setName("Occurance Rate:").setDesc("Set How Frequently Loot generates currency as a percentage of 100")
.addText((text) => {
text.setValue(String(this.plugin.settings.currencyFrequency));
text.onChange(async (value) => {
@ -119,53 +119,11 @@ export class SettingTab extends PluginSettingTab {
})
})
if (Platform.isDesktopApp) {
const importExportFile = new Setting(currencyEl)
.setName("Import | Export")
.setDesc("Import A Json File With Supported information");
const inputAppfile = createEl("input", {
attr: {
type: "file",
name: "currency",
accept: ".json",
multiple: false
}
});
inputAppfile.onchange = async () => {
const { files } = inputAppfile;
if (files === null || !files.length) return;
try {
const file = files[0] as FileWithPath;
importJSON(file.path, async (data) => {
this.plugin.settings.currencyTypes = data as currency[];
this.display();
await this.plugin.saveSettings();
});
} catch (e) { /* empty */ }
}
importExportFile.addButton((b) => {
b.setButtonText("Choose Import File").setTooltip(
"Import Json File for the Generator"
).buttonEl.appendChild(inputAppfile)
b.buttonEl.addClass("FCGInput");
b.onClick(() => inputAppfile.click());
}).addButton((b) => {
b.setButtonText("Export Section To File").setCta()
.onClick(() => {
exportJSON(this.plugin.settings.currencyTypes);
})
});
}
const ctext = {
name: '',
rarity: 'common'
}
new Setting(currencyEl)
new Setting(containerEl)
.setName("Currency Name:")
.addText((text) => {
text.onChange((value) => {
@ -189,9 +147,10 @@ export class SettingTab extends PluginSettingTab {
})
})
new Setting(currencyEl).setName("Added currency").setDesc("Click Remove on a Currency you would like to Remove");
containerEl.createEl("h4", { text: "Added Currency" });
containerEl.createEl("p", { text: "Click remove on a currency you would like to removed" });
const foldDiv = currencyEl.createEl('details', { cls: "OFCGDetails" });
const foldDiv = containerEl.createEl('details', { cls: "OFCGDetails" });
foldDiv.createEl("summary", { text: "Currency", cls: "OFCGSummary" });
for (let index = 0; index < this.plugin.settings.currencyTypes.length; index++) {
@ -212,108 +171,99 @@ export class SettingTab extends PluginSettingTab {
}
// END CURRENCY SETTINGS //
currencyEl.createEl('hr');
containerEl.createEl('hr');
//SETTLEMENT SETTINGS//
const settlementDiv = containerEl.createDiv("settlementDiv");
new Setting(settlementDiv).setHeading().setName("Settlement Settings");
settlementDiv.createEl('br');
containerEl.createEl("h2", { text: "Settlement Settings" });
if (Platform.isDesktopApp) {
const importExportFile = new Setting(settlementDiv)
.setName("Import | Export")
.setDesc("Import A Json File With Supported information");
const inputAppfile = createEl("input", {
attr: {
type: "file",
name: "settlement",
accept: ".json",
multiple: false
}
});
inputAppfile.onchange = async () => {
const { files } = inputAppfile;
if (files === null || !files.length) return;
try {
const file = files[0] as FileWithPath;
importJSON(file.path, async (data) => {
this.plugin.settings.citySettings = data as cityGeneratorSetting;
let preText = "";
let sufText = "";
containerEl.createEl("h4", { text: "Prefixes being used" });
new Setting(containerEl)
.setName("New Prefix:")
.addTextArea((text) => {
text.onChange((value) => {
preText = value;
})
})
.addButton((btn) => {
btn.setCta().setButtonText("Add")
.onClick(async () => {
this.convertStringToArray(preText, this.plugin.settings.citySettings.prefixArray);
this.display();
await this.plugin.saveSettings();
});
} catch (e) { /* empty */ }
}
importExportFile.addButton((b) => {
b.setButtonText("Choose Import File").setTooltip(
"Import Json File for the Generator"
).buttonEl.appendChild(inputAppfile)
b.buttonEl.addClass("FCGInput");
b.onClick(() => inputAppfile.click());
}).addButton((b) => {
b.setButtonText("Export Section To File").setCta()
.onClick(() => {
exportJSON(this.plugin.settings.citySettings);
})
});
})
containerEl.createEl("p", { text: "Click 'remove' on a prefix you would like to removed" });
const foldDiv = containerEl.createEl('details', { cls: "OFCGDetails" });
foldDiv.createEl("summary", { text: "Prefixes", cls: "OFCGSummary" });
for (let index = 0; index < this.plugin.settings.citySettings.prefixArray.length; index++) {
new Setting(foldDiv)
.setName(this.plugin.settings.citySettings.prefixArray[index])
.addButton((btn) => btn
.setCta()
.setButtonText("Remove")
.onClick(async () => {
this.plugin.settings.citySettings.prefixArray.splice(index, 1);
this.display();
await this.plugin.saveSettings();
})
)
}
const preText = "";
const sufText = "";
this.createSettingsBlock(settlementDiv, preText, this.plugin.settings.citySettings.prefixArray, "Prefixes", false);
this.createSettingsBlock(settlementDiv, sufText, this.plugin.settings.citySettings.suffixArray, "Suffixes", false);
containerEl.createEl('hr');
containerEl.createEl("h4", { text: "Suffixes being used" });
new Setting(containerEl)
.setName("New Suffix:")
.addTextArea((text) => {
text.onChange((value) => {
sufText = value;
})
})
.addButton((btn) => {
btn.setCta().setButtonText("Add")
.onClick(async () => {
this.convertStringToArray(sufText, this.plugin.settings.citySettings.suffixArray);
this.display();
await this.plugin.saveSettings();
})
})
containerEl.createEl("p", { text: "Click 'remove' on a suffix you would like to removed" });
const foldDiv2 = containerEl.createEl('details', { cls: "OFCGDetails" });
foldDiv2.createEl("summary", { text: "Suffixes", cls: "OFCGSummary" });
for (let index = 0; index < this.plugin.settings.citySettings.suffixArray.length; index++) {
new Setting(foldDiv2)
.setName(this.plugin.settings.citySettings.suffixArray[index])
.addButton((btn) => btn
.setCta()
.setButtonText("Remove")
.onClick(async () => {
this.plugin.settings.citySettings.suffixArray.splice(index, 1);
this.display();
await this.plugin.saveSettings();
})
)
}
// END SETTLEMENT SETTINGS //
containerEl.createEl('hr');
// INN'S / TAVERN SETTINGS //
const innDiv = containerEl.createDiv("innDiv");
new Setting(innDiv).setHeading().setName("Inn Settings");
innDiv.createEl('br');
if (Platform.isDesktopApp) {
const importExportFile = new Setting(innDiv)
.setName("Import | Export")
.setDesc("Import A Json File With Supported information");
const inputAppfile = createEl("input", {
attr: {
type: "file",
name: "inn",
accept: ".json",
multiple: false
}
});
inputAppfile.onchange = async () => {
const { files } = inputAppfile;
if (files === null || !files.length) return;
try {
const file = files[0] as FileWithPath;
importJSON(file.path, async (data) => {
this.plugin.settings.innSettings = data as innGeneratorSettings;
this.display();
await this.plugin.saveSettings();
});
} catch (e) { /* empty */ }
}
importExportFile.addButton((b) => {
b.setButtonText("Choose Import File").setTooltip(
"Import Json File for the Generator"
).buttonEl.appendChild(inputAppfile)
b.buttonEl.addClass("FCGInput");
b.onClick(() => inputAppfile.click());
}).addButton((b) => {
b.setButtonText("Export Section To File").setCta()
.onClick(() => {
exportJSON(this.plugin.settings.innSettings);
})
});
}
containerEl.createEl("h2", { text: "Inn & Tavern Settings" });
const innPreText = "";
const innTypeText = "";
@ -321,169 +271,52 @@ export class SettingTab extends PluginSettingTab {
const innDescText = "";
const innRumorText = "";
this.createSettingsBlock(innDiv, innPreText, this.plugin.settings.innSettings.prefixes, "Prefixes", false);
this.createSettingsBlock(innDiv, innTypeText, this.plugin.settings.innSettings.innType, "Type's", false);
this.createSettingsBlock(innDiv, innNounText, this.plugin.settings.innSettings.nouns, "Nouns", false);
this.createSettingsBlock(innDiv, innDescText, this.plugin.settings.innSettings.desc, "Description's", false);
this.createSettingsBlock(innDiv, innRumorText, this.plugin.settings.innSettings.rumors, "Rumors", false);
containerEl.createEl("h4", { text: "Prefixes being used" });
this.createSettingsBlock(containerEl, innPreText, this.plugin.settings.innSettings.prefixes, "Prefixes");
containerEl.createEl("h4", { text: "Type's being used" });
this.createSettingsBlock(containerEl, innTypeText, this.plugin.settings.innSettings.innType, "Type's");
containerEl.createEl("h4", { text: "Nouns being used" });
this.createSettingsBlock(containerEl, innNounText, this.plugin.settings.innSettings.nouns, "Nouns");
containerEl.createEl("h4", { text: "Description's being used" });
this.createSettingsBlock(containerEl, innDescText, this.plugin.settings.innSettings.desc, "Description's");
containerEl.createEl("h4", { text: "Rumors being used" });
this.createSettingsBlock(containerEl, innRumorText, this.plugin.settings.innSettings.rumors, "Rumors");
// END INN'S / TAVERN SETTINGS //
// DRINK SETTINGS //
const drinkDiv = containerEl.createDiv("drinkDiv");
new Setting(drinkDiv).setHeading().setName("Drink Settings");
drinkDiv.createEl('br');
if (Platform.isDesktopApp) {
const importExportFile = new Setting(drinkDiv)
.setName("Import | Export")
.setDesc("Import A Json File With Supported information");
const inputAppfile = createEl("input", {
attr: {
type: "file",
name: "drink",
accept: ".json",
multiple: false
}
});
inputAppfile.onchange = async () => {
const { files } = inputAppfile;
if (files === null || !files.length) return;
try {
const file = files[0] as FileWithPath;
importJSON(file.path, async (data) => {
this.plugin.settings.drinkSettings = data as drinkGeneratorSettings;
this.display();
await this.plugin.saveSettings();
});
} catch (e) { /* empty */ }
}
importExportFile.addButton((b) => {
b.setButtonText("Choose Import File").setTooltip(
"Import Json File for the Generator"
).buttonEl.appendChild(inputAppfile)
b.buttonEl.addClass("FCGInput");
b.onClick(() => inputAppfile.click());
}).addButton((b) => {
b.setButtonText("Export Section To File").setCta()
.onClick(() => {
exportJSON(this.plugin.settings.drinkSettings);
})
});
}
containerEl.createEl("h2", { text: "Drink Generator Settings" });
const drinkNounText = "";
const drinkAdjText = "";
this.createSettingsBlock(drinkDiv, drinkAdjText, this.plugin.settings.drinkSettings.adj, "Adjectives", false);
this.createSettingsBlock(drinkDiv, drinkNounText, this.plugin.settings.drinkSettings.nouns, "Nouns", false);
containerEl.createEl("h4", { text: "Adjectives being used" });
this.createSettingsBlock(containerEl, drinkAdjText, this.plugin.settings.drinkSettings.adj, "Adjectives");
containerEl.createEl("h4", { text: "Nouns being used" });
this.createSettingsBlock(containerEl, drinkNounText, this.plugin.settings.drinkSettings.nouns, "Nouns");
// LOOT SETTINGS //
const lootDiv = containerEl.createDiv("lootDiv");
new Setting(lootDiv).setHeading().setName("Loot Settings");
lootDiv.createEl('br');
if (Platform.isDesktopApp) {
const importExportFile = new Setting(lootDiv)
.setName("Import | Export")
.setDesc("Import A Json File With Supported information");
const inputAppfile = createEl("input", {
attr: {
type: "file",
name: "loot",
accept: ".json",
multiple: false
}
});
inputAppfile.onchange = async () => {
const { files } = inputAppfile;
if (files === null || !files.length) return;
try {
const file = files[0] as FileWithPath;
importJSON(file.path, async (data) => {
this.plugin.settings.lootSettings = data as lootTables;
this.display();
await this.plugin.saveSettings();
});
} catch (e) { /* empty */ }
}
importExportFile.addButton((b) => {
b.setButtonText("Choose Import File").setTooltip(
"Import Json File for the Generator"
).buttonEl.appendChild(inputAppfile)
b.buttonEl.addClass("FCGInput");
b.onClick(() => inputAppfile.click());
}).addButton((b) => {
b.setButtonText("Export Section To File").setCta()
.onClick(() => {
exportJSON(this.plugin.settings.lootSettings);
})
});
}
containerEl.createEl("h2", { text: "Loot Generator Settings" });
const lootNounText = "";
const lootAdjText = "";
this.createSettingsBlock(lootDiv, lootAdjText, this.plugin.settings.lootSettings.adj, "Adjectives", false);
this.createSettingsBlock(lootDiv, lootNounText, this.plugin.settings.lootSettings.items, "Items", true);
containerEl.createEl("h4", { text: "Adjectives being used" });
this.createSettingsBlock(containerEl, lootAdjText, this.plugin.settings.drinkSettings.adj, "Adjectives");
containerEl.createEl("h4", { text: "Nouns being used" });
this.createSettingsBlock(containerEl, lootNounText, this.plugin.settings.drinkSettings.nouns, "Nouns");
// GROUP SETTINGS //
const groupDiv = containerEl.createDiv("groupDiv");
new Setting(groupDiv).setHeading().setName("Group Settings");
groupDiv.createEl('br');
if (Platform.isDesktopApp) {
const importExportFile = new Setting(groupDiv)
.setName("Import | Export")
.setDesc("Import A Json File With Supported information");
const inputAppfile = createEl("input", {
attr: {
type: "file",
name: "group",
accept: ".json",
multiple: false
}
});
inputAppfile.onchange = async () => {
const { files } = inputAppfile;
if (files === null || !files.length) return;
try {
const file = files[0] as FileWithPath;
importJSON(file.path, async (data) => {
this.plugin.settings.groupSettings = data as groupGenSettings;
this.display();
await this.plugin.saveSettings();
});
} catch (e) { /* empty */ }
}
importExportFile.addButton((b) => {
b.setButtonText("Choose Import File").setTooltip(
"Import Json File for the Generator"
).buttonEl.appendChild(inputAppfile)
b.buttonEl.addClass("FCGInput");
b.onClick(() => inputAppfile.click());
}).addButton((b) => {
b.setButtonText("Export Section To File").setCta()
.onClick(() => {
exportJSON(this.plugin.settings.groupSettings);
})
});
}
containerEl.createEl("h2", { text: "Group Generator Settings" });
const groupAdjectives = ''
const groupNouns = ''
@ -491,59 +324,24 @@ export class SettingTab extends PluginSettingTab {
const groupTypes = ''
const groupSingleDescriptors = ''
this.createSettingsBlock(groupDiv, groupAdjectives, this.plugin.settings.groupSettings.adj, "Adjectives", false);
this.createSettingsBlock(groupDiv, groupNouns, this.plugin.settings.groupSettings.nouns, "Nouns", false);
this.createSettingsBlock(groupDiv, groupNounsPlural, this.plugin.settings.groupSettings.nounsP, "Plural Nouns", false);
this.createSettingsBlock(groupDiv, groupTypes, this.plugin.settings.groupSettings.groupTypes, "Types", false);
this.createSettingsBlock(groupDiv, groupSingleDescriptors, this.plugin.settings.groupSettings.singleDescriptors, "Descriptors", false);
containerEl.createEl("h4", { text: "Adjectives being used" });
this.createSettingsBlock(containerEl, groupAdjectives, this.plugin.settings.groupSettings.adj, "Adjectives");
containerEl.createEl("h4", { text: "Nouns being used" });
this.createSettingsBlock(containerEl, groupNouns, this.plugin.settings.groupSettings.nouns, "Nouns");
containerEl.createEl("h4", { text: "Plural Nouns being used" });
this.createSettingsBlock(containerEl, groupNounsPlural, this.plugin.settings.groupSettings.nounsP, "Plural Nouns");
containerEl.createEl("h4", { text: "Group Types being used" });
this.createSettingsBlock(containerEl, groupTypes, this.plugin.settings.groupSettings.groupTypes, "Types");
containerEl.createEl("h4", { text: "Single Descriptors being used" });
this.createSettingsBlock(containerEl, groupSingleDescriptors, this.plugin.settings.groupSettings.singleDescriptors, "Descriptors");
// END GROUP SETTINGS //
const dungDiv = containerEl.createDiv("dungDiv");
new Setting(dungDiv).setHeading().setName("Dungeon Settings");
dungDiv.createEl('br');
if (Platform.isDesktopApp) {
const importExportFile = new Setting(dungDiv)
.setName("Import | Export")
.setDesc("Import A Json File With Supported information");
const inputAppfile = createEl("input", {
attr: {
type: "file",
name: "dungeon",
accept: ".json",
multiple: false
}
});
inputAppfile.onchange = async () => {
const { files } = inputAppfile;
if (files === null || !files.length) return;
try {
const file = files[0] as FileWithPath;
importJSON(file.path, async (data) => {
this.plugin.settings.dungeonSettings = data as dungeonGenSettings;
this.display();
await this.plugin.saveSettings();
});
} catch (e) { /* empty */ }
}
importExportFile.addButton((b) => {
b.setButtonText("Choose Import File").setTooltip(
"Import Json File for the Generator"
).buttonEl.appendChild(inputAppfile)
b.buttonEl.addClass("FCGInput");
b.onClick(() => inputAppfile.click());
}).addButton((b) => {
b.setButtonText("Export Section To File").setCta()
.onClick(() => {
exportJSON(this.plugin.settings.dungeonSettings);
})
});
}
containerEl.createEl("h2", { text: "Dungeon Generator Settings" });
const dungAdjectives = ''
const dungNouns = ''
@ -551,11 +349,20 @@ export class SettingTab extends PluginSettingTab {
const dungLocations = ''
const dungRandomDesc = ''
this.createSettingsBlock(dungDiv, dungAdjectives, this.plugin.settings.dungeonSettings.adjectives, "Adjectives", false);
this.createSettingsBlock(dungDiv, dungNouns, this.plugin.settings.groupSettings.nouns, "Nouns", false);
this.createSettingsBlock(dungDiv, dungLocations, this.plugin.settings.dungeonSettings.locations, "Locations", false);
this.createSettingsBlock(dungDiv, dungTypes, this.plugin.settings.dungeonSettings.dungeonTypes, "Types", false);
this.createSettingsBlock(dungDiv, dungRandomDesc, this.plugin.settings.dungeonSettings.randomDesc, "Descriptors", false);
containerEl.createEl("h4", { text: "Adjectives being used" });
this.createSettingsBlock(containerEl, dungAdjectives, this.plugin.settings.dungeonSettings.adjectives, "Adjectives");
containerEl.createEl("h4", { text: "Nouns being used" });
this.createSettingsBlock(containerEl, dungNouns, this.plugin.settings.groupSettings.nouns, "Nouns");
containerEl.createEl("h4", { text: "Locations being used" });
this.createSettingsBlock(containerEl, dungLocations, this.plugin.settings.dungeonSettings.locations, "Locations");
containerEl.createEl("h4", { text: "Dungeon Types being used" });
this.createSettingsBlock(containerEl, dungTypes, this.plugin.settings.dungeonSettings.dungeonTypes, "Types");
containerEl.createEl("h4", { text: "Random Descriptions being used" });
this.createSettingsBlock(containerEl, dungRandomDesc, this.plugin.settings.dungeonSettings.randomDesc, "Descriptors");
}
}

View file

@ -1,20 +1,7 @@
.theme-light .OFCGDetails {
border: 1px solid #ccc;
box-shadow: 0px 12px 0px 0px rgba(255, 255, 255, 0.37);
background-color: #f0f0f0;
}
.theme-light .OFCGDetails[open] summary {
border-bottom: 1px solid #666;
margin-bottom: 0.5em;
}
.theme-dark .OFCGDetails {
border: 1px solid #272727;
box-shadow: 0px 12px 0px 0px rgba(0, 0, 0, 0.37);
background-color: #313131;
.OFCGDetails {
border: 1px solid #aaa;
border-radius: 4px;
padding: 0.5em 0.5em 0.5em;
margin: 1em;
}
.OFCGSSummary {
@ -27,10 +14,7 @@
padding: 0.5em;
}
.theme-dark .OFCGDetails[open] summary {
.OFCGDetails[open] summary {
border-bottom: 1px solid #aaa;
margin-bottom: 0.5em;
}
.FCGInput>input[type="file"] {
display: none;
}

View file

@ -1,5 +1,3 @@
{
"1.2.3": "0.15.0",
"1.2.2": "0.15.0",
"1.2.4": "0.15.0"
}
"1.2.0": "0.15.0"
}