mirror of
https://github.com/gregory-jagermeister/Fantasy-Content-Generator.git
synced 2026-07-22 07:30:31 +00:00
Cleaned up code so most things are more modular.
This commit is contained in:
parent
aaa5ec9671
commit
8163d27e2d
8 changed files with 737 additions and 713 deletions
|
|
@ -24,17 +24,19 @@ import { generatePlotHook } from "generators/plothook";
|
||||||
|
|
||||||
type Generator = () => string | Error;
|
type Generator = () => string | Error;
|
||||||
|
|
||||||
|
//An interface to be used with Getting the keys of the Generator object.
|
||||||
interface Generators {
|
interface Generators {
|
||||||
[key: string]: Generator;
|
[key: string]: Generator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class AutoComplete extends EditorSuggest<string> {
|
export class InlineGeneratorSuggester extends EditorSuggest<string> {
|
||||||
private getCompletions: () => string[]; // function to retrieve completions
|
private getCompletions: () => string[]; // function to retrieve completions
|
||||||
startChar: EditorPosition
|
startChar: EditorPosition
|
||||||
endChar: EditorPosition
|
endChar: EditorPosition
|
||||||
plugin: MyPlugin
|
plugin: MyPlugin
|
||||||
|
|
||||||
|
//An object storing all the Generator functions used by the particular selection
|
||||||
private generators: Generators = {
|
private generators: Generators = {
|
||||||
'Gen-ElfMale': () => nameByRace("elf", { gender: "male" }),
|
'Gen-ElfMale': () => nameByRace("elf", { gender: "male" }),
|
||||||
'Gen-ElfMaleLastname': () => nameByRace("elf", { gender: "male" }) + " " + elfFamilyNames[Math.floor(Math.random() * elfFamilyNames.length)],
|
'Gen-ElfMaleLastname': () => nameByRace("elf", { gender: "male" }) + " " + elfFamilyNames[Math.floor(Math.random() * elfFamilyNames.length)],
|
||||||
|
|
@ -163,15 +165,18 @@ export class AutoComplete extends EditorSuggest<string> {
|
||||||
cursor: EditorPosition,
|
cursor: EditorPosition,
|
||||||
editor: Editor
|
editor: Editor
|
||||||
): EditorSuggestTriggerInfo | null {
|
): EditorSuggestTriggerInfo | null {
|
||||||
// check if the cursor is immediately following a "@"
|
// check if the cursor is immediately following the Callout defined in settings
|
||||||
|
const callOut = this.plugin.settings.inlineCallout;
|
||||||
|
const escapedCallOut = callOut.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
|
const regEx = new RegExp(`${escapedCallOut}(\\S*)`);
|
||||||
const line = editor.getLine(cursor.line);
|
const line = editor.getLine(cursor.line);
|
||||||
const match = line.slice(0, cursor.ch).match(/\$\$(\S*)/);
|
const match = line.slice(0, cursor.ch).match(regEx);
|
||||||
|
|
||||||
if (!match) {
|
if (!match) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const start = { line: cursor.line, ch: cursor.ch - match[1].length - 2 };
|
const start = { line: cursor.line, ch: cursor.ch - match[1].length - callOut.length };
|
||||||
const end = { line: cursor.line, ch: cursor.ch };
|
const end = { line: cursor.line, ch: cursor.ch };
|
||||||
|
|
||||||
this.startChar = start;
|
this.startChar = start;
|
||||||
|
|
@ -189,8 +194,7 @@ export class AutoComplete extends EditorSuggest<string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
selectSuggestion(value: string, _evt: MouseEvent | KeyboardEvent): void {
|
selectSuggestion(value: string, _evt: MouseEvent | KeyboardEvent): void {
|
||||||
// execute the selected function
|
// execute the selected function if the function does not exist then return "not implemented"
|
||||||
//const result = executeFunction(value);
|
|
||||||
let result: string | Error = "Not Implemented";
|
let result: string | Error = "Not Implemented";
|
||||||
if (value in this.generators) {
|
if (value in this.generators) {
|
||||||
result = this.generators[value]();
|
result = this.generators[value]();
|
||||||
|
|
|
||||||
717
main.ts
717
main.ts
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "obsidian-fantasy-content-generator",
|
"id": "obsidian-fantasy-content-generator",
|
||||||
"name": "Fantasy Content Generator",
|
"name": "Fantasy Content Generator",
|
||||||
"version": "1.1.1",
|
"version": "1.2.0",
|
||||||
"minAppVersion": "0.15.0",
|
"minAppVersion": "0.15.0",
|
||||||
"description": "A Fantasy Content Generator for Obsidian",
|
"description": "A Fantasy Content Generator for Obsidian",
|
||||||
"author": "Obsidian",
|
"author": "Obsidian",
|
||||||
|
|
|
||||||
3
modal.ts
3
modal.ts
|
|
@ -14,13 +14,14 @@ import { dwarfFamilyNames } from "lists/dwarvenFamilyNames";
|
||||||
import * as FCG from "fantasy-content-generator";
|
import * as FCG from "fantasy-content-generator";
|
||||||
import { generateCityName } from "generators/city";
|
import { generateCityName } from "generators/city";
|
||||||
import { generateLoot } from "generators/loot";
|
import { generateLoot } from "generators/loot";
|
||||||
import MyPlugin, { innGeneratorSettings, lootTables } from "main";
|
import MyPlugin from "main";
|
||||||
import { generateInn } from "generators/inn";
|
import { generateInn } from "generators/inn";
|
||||||
import { generatePathfinderName } from "generators/Pathfinder/pathfinderName";
|
import { generatePathfinderName } from "generators/Pathfinder/pathfinderName";
|
||||||
import { ISettlementDomainObject } from "fantasy-content-generator/dist/interfaces";
|
import { ISettlementDomainObject } from "fantasy-content-generator/dist/interfaces";
|
||||||
import { generateMiscellaneousArtifacts } from "generators/artifact";
|
import { generateMiscellaneousArtifacts } from "generators/artifact";
|
||||||
import { generateDungeonName } from "generators/dungeon";
|
import { generateDungeonName } from "generators/dungeon";
|
||||||
import { generatePlotHook } from "generators/plothook";
|
import { generatePlotHook } from "generators/plothook";
|
||||||
|
import { innGeneratorSettings, lootTables } from "settings/Datatypes";
|
||||||
|
|
||||||
const races: string[] = ["none", "none", "dungeon", "inn", "settlement", "none", "airships", "drinks", "artifacts", "loot", "metals", "magicaltrees", "ship", "none", "animalgroups", "groups", "religion", "none", "aasimars", "catfolk", "fetchlings", "halfelf", "halforc", "hobgoblin", "ifrits", "kobalds", "oreads", "ratfolk", "sylphs", "tengu", "tians", "tiefling", "undines", "angel", "cavePerson", "darkelf", "demon", "dragon", "drow", "dwarf", "elf", "fairy", "gnome", "goblin", "halfdemon", "halfling", "highelf", "highfairy", "human", "ogre", "orc", "none", "plothook"];
|
const races: string[] = ["none", "none", "dungeon", "inn", "settlement", "none", "airships", "drinks", "artifacts", "loot", "metals", "magicaltrees", "ship", "none", "animalgroups", "groups", "religion", "none", "aasimars", "catfolk", "fetchlings", "halfelf", "halforc", "hobgoblin", "ifrits", "kobalds", "oreads", "ratfolk", "sylphs", "tengu", "tians", "tiefling", "undines", "angel", "cavePerson", "darkelf", "demon", "dragon", "drow", "dwarf", "elf", "fairy", "gnome", "goblin", "halfdemon", "halfling", "highelf", "highfairy", "human", "ogre", "orc", "none", "plothook"];
|
||||||
const racesDisplayName: string[] = ["Select a Generator to Start", "--[Settlements and Buildings]--", "Dungeons & Labryinths", "Inn's & Taverns", "Settlement", "--[Objects and Vehicles]--", "Airships", "Drinks", "Artifacts", "Loot And Treasure", "Metals", "Magical Trees", "Ship", "--[Groups and Religions]--", "Animal Groups", "Groups", "Religion", "--[Races]--", "Aasimars", "Catfolk", "Fetchlings", "Half-Elf", "Half-Orc", "Hobgoblin", "Ifrits", "Kobalds", "Oreads", "Ratfolk", "Sylphs", "Tengu", "Tians", "Tiefling", "Undines", "Angel", "Cave Person", "Dark Elf", "Demon", "Dragon", "Drow", "Dwarf", "Elf", "Fairy", "Gnome", "Goblin", "Half Demon", "Halfling", "High Elf", "High Fairy", "Human", "Ogre", "Orc", "--[Story Tools]--", "Plot & Story Hooks"];
|
const racesDisplayName: string[] = ["Select a Generator to Start", "--[Settlements and Buildings]--", "Dungeons & Labryinths", "Inn's & Taverns", "Settlement", "--[Objects and Vehicles]--", "Airships", "Drinks", "Artifacts", "Loot And Treasure", "Metals", "Magical Trees", "Ship", "--[Groups and Religions]--", "Animal Groups", "Groups", "Religion", "--[Races]--", "Aasimars", "Catfolk", "Fetchlings", "Half-Elf", "Half-Orc", "Hobgoblin", "Ifrits", "Kobalds", "Oreads", "Ratfolk", "Sylphs", "Tengu", "Tians", "Tiefling", "Undines", "Angel", "Cave Person", "Dark Elf", "Demon", "Dragon", "Drow", "Dwarf", "Elf", "Fairy", "Gnome", "Goblin", "Half Demon", "Halfling", "High Elf", "High Fairy", "Human", "Ogre", "Orc", "--[Story Tools]--", "Plot & Story Hooks"];
|
||||||
|
|
|
||||||
176
settings/Datatypes.ts
Normal file
176
settings/Datatypes.ts
Normal file
|
|
@ -0,0 +1,176 @@
|
||||||
|
// The possible Options that could be selected durring inline generation
|
||||||
|
export const possibleOptions = [
|
||||||
|
'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
|
||||||
|
export type currency = {
|
||||||
|
name: string,
|
||||||
|
rarity: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datatype for collecting group settings
|
||||||
|
export type groupGenSettings = {
|
||||||
|
adj: string[],
|
||||||
|
nouns: string[],
|
||||||
|
nounsP: string[],
|
||||||
|
groupTypes: string[],
|
||||||
|
singleDescriptors: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datatype for collecting dungeon settings
|
||||||
|
export type dungeonGenSettings = {
|
||||||
|
dungeonTypes: string[],
|
||||||
|
adjectives: string[],
|
||||||
|
nouns: string[],
|
||||||
|
locations: string[],
|
||||||
|
randomDesc: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datatype for collecting loot settings
|
||||||
|
export type lootTables = {
|
||||||
|
adj: string[]
|
||||||
|
nouns: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datatype for collecting Drink settings
|
||||||
|
export type drinkGeneratorSettings = {
|
||||||
|
adj: string[],
|
||||||
|
nouns: string[],
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datatype for collecting city settings
|
||||||
|
export type cityGeneratorSetting = {
|
||||||
|
prefixArray: string[],
|
||||||
|
suffixArray: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datatype for collecting inn and tavern settings
|
||||||
|
export type innGeneratorSettings = {
|
||||||
|
prefixes: string[],
|
||||||
|
innType: string[],
|
||||||
|
nouns: string[],
|
||||||
|
desc: string[],
|
||||||
|
rumors: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// the interface that uses all
|
||||||
|
export interface MyPluginSettings {
|
||||||
|
enableCurrency: boolean;
|
||||||
|
citySettings: cityGeneratorSetting;
|
||||||
|
currencyTypes: currency[];
|
||||||
|
currencyFrequency: number;
|
||||||
|
innSettings: innGeneratorSettings;
|
||||||
|
drinkSettings: drinkGeneratorSettings;
|
||||||
|
lootSettings: lootTables;
|
||||||
|
groupSettings: groupGenSettings;
|
||||||
|
dungeonSettings: dungeonGenSettings;
|
||||||
|
inlineCallout: string;
|
||||||
|
}
|
||||||
166
settings/DefaultSetting.ts
Normal file
166
settings/DefaultSetting.ts
Normal file
File diff suppressed because one or more lines are too long
368
settings/SettingsTab.ts
Normal file
368
settings/SettingsTab.ts
Normal file
|
|
@ -0,0 +1,368 @@
|
||||||
|
import MyPlugin from "main";
|
||||||
|
import { PluginSettingTab, App, Setting } from "obsidian";
|
||||||
|
import { DEFAULT_SETTINGS } from "./DefaultSetting";
|
||||||
|
|
||||||
|
export class SettingTab extends PluginSettingTab {
|
||||||
|
plugin: MyPlugin;
|
||||||
|
|
||||||
|
constructor(app: App, plugin: MyPlugin) {
|
||||||
|
super(app, plugin);
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
convertStringToArray(string: string, arr: string[]): void {
|
||||||
|
//const newString = string.replace(/\s/g, '');
|
||||||
|
const array = string.split(',');
|
||||||
|
array.forEach((el) => {
|
||||||
|
arr.push(el);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
createSettingsBlock(containerEl: HTMLElement, textA: string, arr: any[], type: string): void {
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName("New Addition:")
|
||||||
|
.addTextArea((text) => {
|
||||||
|
text.onChange((value) => {
|
||||||
|
textA = value;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.addButton((btn) => {
|
||||||
|
btn.setCta().setButtonText("Add")
|
||||||
|
.onClick(async () => {
|
||||||
|
this.convertStringToArray(textA, arr);
|
||||||
|
this.display();
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
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(arr[index])
|
||||||
|
.addButton((btn) => btn
|
||||||
|
.setCta()
|
||||||
|
.setButtonText("Remove")
|
||||||
|
.onClick(async () => {
|
||||||
|
arr.splice(index, 1);
|
||||||
|
this.display();
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
containerEl.createEl('hr');
|
||||||
|
}
|
||||||
|
|
||||||
|
display(): void {
|
||||||
|
const { containerEl } = this;
|
||||||
|
|
||||||
|
containerEl.empty();
|
||||||
|
|
||||||
|
containerEl.createEl('h1', { text: 'Fantasy Content Generator' });
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName('Reset To Defaults')
|
||||||
|
.setDesc('Click if you would like to use the default settings again')
|
||||||
|
.addButton((btn) => {
|
||||||
|
btn.setCta()
|
||||||
|
.setButtonText("Reset")
|
||||||
|
.onClick(async () => {
|
||||||
|
this.plugin.settings = DEFAULT_SETTINGS;
|
||||||
|
this.display();
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
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) => {
|
||||||
|
this.plugin.settings.inlineCallout = value;
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// CURRENCEY SETTINGS //
|
||||||
|
|
||||||
|
containerEl.createEl("h2", { text: "Currency Settings" });
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName('Enable Currency for Loot Generation.')
|
||||||
|
.setDesc('If you have Currency in your World or game consider Activating this')
|
||||||
|
.addToggle((toggle) => {
|
||||||
|
toggle.setValue(this.plugin.settings.enableCurrency);
|
||||||
|
toggle.onChange(async (value) => {
|
||||||
|
this.plugin.settings.enableCurrency = value;
|
||||||
|
this.display();
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
if (this.plugin.settings.enableCurrency) {
|
||||||
|
|
||||||
|
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) => {
|
||||||
|
if (!(isNaN(+value))) {
|
||||||
|
this.plugin.settings.currencyFrequency = Number(value);
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const ctext = {
|
||||||
|
name: '',
|
||||||
|
rarity: 'common'
|
||||||
|
}
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName("Currency Name:")
|
||||||
|
.addText((text) => {
|
||||||
|
text.onChange((value) => {
|
||||||
|
ctext.name = value;
|
||||||
|
})
|
||||||
|
}).addDropdown((drop) => {
|
||||||
|
drop.addOption("common", "Common");
|
||||||
|
drop.addOption("uncommon", "Uncommon");
|
||||||
|
drop.addOption("rare", "Rare");
|
||||||
|
drop.addOption("rarest", "Rarest");
|
||||||
|
drop.onChange((value) => {
|
||||||
|
ctext.rarity = value;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.addButton((btn) => {
|
||||||
|
btn.setCta().setButtonText("Add")
|
||||||
|
.onClick(async () => {
|
||||||
|
this.plugin.settings.currencyTypes.push(ctext);
|
||||||
|
this.display();
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
containerEl.createEl("h4", { text: "Added Currency" });
|
||||||
|
containerEl.createEl("p", { text: "Click remove on a currency you would like to removed" });
|
||||||
|
|
||||||
|
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++) {
|
||||||
|
new Setting(foldDiv)
|
||||||
|
.setName(this.plugin.settings.currencyTypes[index].name)
|
||||||
|
.addButton((btn) => btn
|
||||||
|
.setCta()
|
||||||
|
.setButtonText("Remove")
|
||||||
|
.onClick(async () => {
|
||||||
|
this.plugin.settings.currencyTypes.splice(index, 1);
|
||||||
|
this.display();
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// END CURRENCY SETTINGS //
|
||||||
|
|
||||||
|
containerEl.createEl('hr');
|
||||||
|
|
||||||
|
//SETTLEMENT SETTINGS//
|
||||||
|
|
||||||
|
containerEl.createEl("h2", { text: "Settlement Settings" });
|
||||||
|
|
||||||
|
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();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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 //
|
||||||
|
containerEl.createEl("h2", { text: "Inn & Tavern Settings" });
|
||||||
|
|
||||||
|
const innPreText = "";
|
||||||
|
const innTypeText = "";
|
||||||
|
const innNounText = "";
|
||||||
|
const innDescText = "";
|
||||||
|
const innRumorText = "";
|
||||||
|
|
||||||
|
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 //
|
||||||
|
|
||||||
|
containerEl.createEl("h2", { text: "Drink Generator Settings" });
|
||||||
|
|
||||||
|
const drinkNounText = "";
|
||||||
|
const drinkAdjText = "";
|
||||||
|
|
||||||
|
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 //
|
||||||
|
|
||||||
|
containerEl.createEl("h2", { text: "Loot Generator Settings" });
|
||||||
|
|
||||||
|
const lootNounText = "";
|
||||||
|
const lootAdjText = "";
|
||||||
|
|
||||||
|
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 //
|
||||||
|
|
||||||
|
containerEl.createEl("h2", { text: "Group Generator Settings" });
|
||||||
|
|
||||||
|
const groupAdjectives = ''
|
||||||
|
const groupNouns = ''
|
||||||
|
const groupNounsPlural = ''
|
||||||
|
const groupTypes = ''
|
||||||
|
const groupSingleDescriptors = ''
|
||||||
|
|
||||||
|
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 //
|
||||||
|
|
||||||
|
containerEl.createEl("h2", { text: "Dungeon Generator Settings" });
|
||||||
|
|
||||||
|
const dungAdjectives = ''
|
||||||
|
const dungNouns = ''
|
||||||
|
const dungTypes = ''
|
||||||
|
const dungLocations = ''
|
||||||
|
const dungRandomDesc = ''
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"1.1.1": "0.15.0"
|
"1.2.0": "0.15.0"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue