Skip to content

Commit

Permalink
Add-religion-export (#573)
Browse files Browse the repository at this point in the history
* Change to be required

* Convert to ts

* Add data-town-type and data-town-name

* remove aria-expanded property

* change to use constructObject property

* add data-id and data-object-type properties

* Update file

* update file

* Update version number

* Fix typing

* fix typing.
  • Loading branch information
ryceg authored Apr 16, 2021
1 parent 9cb44c2 commit 01b97ac
Show file tree
Hide file tree
Showing 21 changed files with 703 additions and 172 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## 2.8.3

### Added
- Religion exporting to Foundry and GMBinder
- Data tags for profiles

## 2.8.1

### Added
Expand Down
2 changes: 2 additions & 0 deletions lib/buildings/_common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export interface Structure extends Location {
}

export interface Building extends Structure {
passageName: string
name: string
priceModifier: number
wealth?: string
size?: string
Expand Down
6 changes: 3 additions & 3 deletions lib/buildings/createBuilding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function createBuilding (town: Town, type: string, base: Partial<Building
console.log('Creating base building...')
console.log(base)

const building: Building = {
const building = {
key: getUUID(),
objectType: 'building',
road: '',
Expand Down Expand Up @@ -41,9 +41,9 @@ export function createBuilding (town: Town, type: string, base: Partial<Building
clampRolls(building.roll as unknown as Record<string, number>)
if (base.road) {
console.log('Road defined!')
lib.roads.addBuilding(town, town.roads[base.road], building)
lib.roads.addBuilding(town, town.roads[base.road], building as Building)
}
if (!building.road) building.road = getBuildingRoad(building, town).key
if (!building.road) building.road = getBuildingRoad(building as Building, town).key
assign(building, {
material: generateBuildingMaterial(town, town.townMaterial, building.roll.wealth)
})
Expand Down
8 changes: 4 additions & 4 deletions src/Alchemist/js/createAlchemist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const createAlchemist = (town: Town, opts: Partial<Options> = {}): Alchem

const associatedNPC = createChemist(town, opts)

lib.createReciprocalRelationship(town, alchemist, associatedNPC, {
lib.createReciprocalRelationship(town, alchemist as Building, associatedNPC, {
relationship: 'owner',
reciprocalRelationship: 'business'
})
Expand All @@ -34,7 +34,7 @@ export const createAlchemist = (town: Town, opts: Partial<Options> = {}): Alchem
name: lib.createAlchemistName(associatedNPC.firstName)
})

lib.createStructure(town, alchemist)
lib.createStructure(town, alchemist as Building)

const { structure } = alchemist
if (structure) {
Expand All @@ -49,8 +49,8 @@ export const createAlchemist = (town: Town, opts: Partial<Options> = {}): Alchem
lib.defineRollDataGetter(alchemist, rolls, propName)
}

lib.alchemistModifiers(alchemist)
lib.alchemistModifiers(alchemist as Alchemist)

console.groupEnd()
return alchemist
return alchemist as Alchemist
}
10 changes: 5 additions & 5 deletions src/MiniEstablishments/Brothel/createBrothel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ interface Brothel extends Building {
}

interface Options {
newBuilding(town: Town, type?: string): Building
newBuilding(town: Town, type?: string): Brothel
npc: Partial<NPC>
}

export const createBrothel = (town: Town, opts: Partial<Options> = {}): Brothel => {
console.log('Creating a brothel...')
const brothel = (lib.createBuilding || opts.newBuilding)(town, 'brothel', opts as Partial<Building>)
const brothel = (lib.createBuilding || opts.newBuilding)(town, 'brothel', opts as Partial<Brothel>)

lib.assign(brothel, {
name: lib.random(brothelData.name),
Expand All @@ -38,7 +38,7 @@ export const createBrothel = (town: Town, opts: Partial<Options> = {}): Brothel
owner: lib.random(lib.keys(brothelData.pimp))
})
brothel.notableFeature = `${brothel.specialty} and being owned by ${brothel.owner}`
lib.createStructure(town, brothel)
lib.createStructure(town, brothel as Building)
const rollDataVariables = ['wealth', 'size', 'cleanliness'] as const
for (const propName of rollDataVariables) {
// @ts-ignore
Expand All @@ -54,12 +54,12 @@ export const createBrothel = (town: Town, opts: Partial<Options> = {}): Brothel
'nods at you', 'welcomes you warmly', 'smiles, greets you', 'raises a hand with a wave', 'sizes you up, before $associatedNPC.heshe nods at you', 'checks you out for just a moment before smiling at you', 'waves slightly in your direction', 'gives you you a slight nod', 'turns your way', 'frowns, but greets you just the same'
]

lib.createReciprocalRelationship(town, brothel, brothel.associatedNPC, {
lib.createReciprocalRelationship(town, brothel as Building, brothel.associatedNPC, {
relationship: 'pimp',
reciprocalRelationship: 'business',
description: `Owns ${brothel.name}.`
})

console.log(brothel)
return brothel
return brothel as Brothel
}
58 changes: 29 additions & 29 deletions src/Religion/DeityProfile.twee
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
:: DeityProfile
\<<set $currentPassage to lib.findInArray(lib.getPantheon($town).gods, 'name', $currentPassage.name)>>
\<h1 class="interactive-only">$currentPassage.name</h1>
:: DeityProfile [nobr]
<<set $currentPassage to lib.findInArray(lib.getPantheon($town).gods, 'name', $currentPassage.name)>>
<h1 class="interactive-only">$currentPassage.name</h1>
<button type='button' title='Coming to an update near you soon!' data-tippy-content='Coming to an update near you soon!' id="deity-edit" disabled>Edit $currentPassage.name</button>
/* \<<button "Edit $currentPassage.name" DeitySliders>>
/* <<button "Edit $currentPassage.name" DeitySliders>>
<<run setup.history($currentPassage, "DeitySliders", "Editing " + $currentPassage.name)>>
<</button>> */
\<<include "Quotes">>
/* \<<include "AlsoKnownAs">> */
\<<if $currentPassage.aliases>>
\<<print lib.firstCharacter($currentPassage.name.slice(0, 1))>><<print lib.createTippyFull('Who is also known as ' + lib.makeList($currentPassage.aliases) + '.', $currentPassage.name.slice(1))>>
\<<else>>
\<<print lib.firstCharacter($currentPassage.name)>>
\<</if>>
\, <<print lib.createTippyFull(lib.makeList($currentPassage.titles.slice(1)), $currentPassage.titles[0])>>,
\<<print lib.deityIsWas($currentPassage.status)>> the <<print ($currentPassage.wordNoun || lib.genderData[$currentPassage.gender].godgoddess)>> of <<include "Portfolios">>.
\<<print lib.deityStatus($currentPassage)>> <<include "Symbol">>
\<<idp $currentPassage.description>> <<idp $currentPassage.appearance>> <<idp $currentPassage.realm "$currentPassage.name resides in $currentPassage.realm">>
\<<idp $currentPassage.rank "<<print lib.genderData[$currentPassage.gender].heshe.toUpperFirst()>> is <<print lib.articles.output($currentPassage.rank)>> in the pantheon.">>
\<<idp $currentPassage.alignment "<<print lib.genderData[$currentPassage.gender].heshe.toUpperFirst()>> is $currentPassage.alignment.">>
\<<idp $currentPassage.history "<h2>History</h2>$currentPassage.history">>
\<<include "Powers">>
\<<include "Possessions">>
\<<include "Followers">>
\<<idp $currentPassage.beliefs "<h3>Beliefs</h3><<print lib.printInformation($currentPassage.beliefs)>>">>
\<<idp $currentPassage.heresies "<h3>Heresies</h3><<print lib.printInformation($currentPassage.heresies)>>">>
\<<idp $currentPassage.paragraphs "<<print lib.printInformation($currentPassage.paragraphs)>>">>
\<<idp $currentPassage.combat.description "<h2>Combat</h2>$currentPassage.combat.description">> <<idp $currentPassage.combat.tactics>>
\<<include "Manifestations">>
\<<include "DeityRelationships">>
\<<idp $currentPassage.allies "<h3>Allies</h3><<print lib.printInformation($currentPassage.allies)>>">>
\<<idp $currentPassage.enemies "<h3>Enemies</h3><<print lib.printInformation($currentPassage.enemies)>>">>
<<include "Quotes">>
/* <<include "AlsoKnownAs">> */
<<if $currentPassage.aliases>>
<<print lib.firstCharacter($currentPassage.name.slice(0, 1))>><<print lib.createTippyFull('Who is also known as ' + lib.makeList($currentPassage.aliases) + '.', $currentPassage.name.slice(1))>>
<<else>>
<<print lib.firstCharacter($currentPassage.name)>>
<</if>>
, <<print lib.createTippyFull(lib.makeList($currentPassage.titles.slice(1)), $currentPassage.titles[0])>>,
<<print lib.deityIsWas($currentPassage.status)>> the <<print ($currentPassage.wordNoun || lib.genderData[$currentPassage.gender].godgoddess)>> of <<include "Portfolios">>.
<<print lib.deityStatus($currentPassage)>> <<include "Symbol">>
<<idp $currentPassage.description>> <<idp $currentPassage.appearance>> <<idp $currentPassage.realm "$currentPassage.name resides in $currentPassage.realm">>
<<idp $currentPassage.rank "<<print lib.genderData[$currentPassage.gender].heshe.toUpperFirst()>> is <<print lib.articles.output($currentPassage.rank)>> in the pantheon.">>
<<idp $currentPassage.alignment "<<print lib.genderData[$currentPassage.gender].heshe.toUpperFirst()>> is $currentPassage.alignment.">>
<<idp $currentPassage.history "<h2>History</h2>$currentPassage.history">>
<<include "Powers">>
<<include "Possessions">>
<<include "Followers">>
<<idp $currentPassage.beliefs "<h3>Beliefs</h3><<print lib.printInformation($currentPassage.beliefs)>>">>
<<idp $currentPassage.heresies "<h3>Heresies</h3><<print lib.printInformation($currentPassage.heresies)>>">>
<<idp $currentPassage.paragraphs "<<print lib.printInformation($currentPassage.paragraphs)>>">>
<<idp $currentPassage.combat.description "<h2>Combat</h2>$currentPassage.combat.description">> <<idp $currentPassage.combat.tactics>>
<<include "Manifestations">>
<<include "DeityRelationships">>
<<idp $currentPassage.allies "<h3>Allies</h3><<print lib.printInformation($currentPassage.allies)>>">>
<<idp $currentPassage.enemies "<h3>Enemies</h3><<print lib.printInformation($currentPassage.enemies)>>">>
3 changes: 3 additions & 0 deletions src/Settings/Tippy/tooltips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export function createReligionHTML (percentages: Record<string, number>, target:
})
}
})
// .addClass('ignore-remove')
$(button).appendTo(html)
}

Expand All @@ -150,5 +151,7 @@ tippy.setDefaultProps({
theme: 'blockquote',
// theme: 'descriptive',
allowHTML: true,
hideOnClick: 'toggle',
trigger: 'click',
inertia: true
})
4 changes: 2 additions & 2 deletions src/Start/BriefDescription.twee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:: BriefDescription
<h1 class='town-name'>The <<print $town.type.toUpperFirst()>> of $town.name</h1>
\<p role="main">$town.name is <<print lib.articles.output(lib.createTippyFull("With a population of " + $town.population + ".", $town.type))>> located <<print lib.terrain[$town.terrain].location[$town.location].preposition>> the $town.terrain $town.location, where the vegetation is $town.vegetation. $town.name grew around $town.origin, and is comprised <<nobr>>
<h1 class='town-name' @data-town-type=$town.type @data-town-name=$town.name>The <span @data-town-type=$town.type><<print $town.type.toUpperFirst()>></span> of <span @data-town-name=$town.name>$town.name</span></h1>
\<p role="main"><span @data-town-type=$town.type @data-town-name=$town.name>$town.name</span> is <<print lib.articles.output(lib.createTippyFull("With a population of " + $town.population + ".", $town.type))>> located <<print lib.terrain[$town.terrain].location[$town.location].preposition>> the $town.terrain $town.location, where the vegetation is $town.vegetation. $town.name grew around $town.origin, and is comprised <<nobr>>
<<include "RacesPercentageList">>. They are
<<if $town.ignoreGender is false>><<print lib.articles.find($town.equality)>> <<print lib.createTippyFull($town.equalityDescription, $town.equality)>>
<<else>>
Expand Down
2 changes: 1 addition & 1 deletion src/Start/StoryInit.twee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<<run setup.init()>>

<<set setup.data to {
versionNumber: "2.8.2",
versionNumber: "2.8.3",
badges: {
github: lib.createBadge([
lib.badges.stats.githubForks,
Expand Down
17 changes: 9 additions & 8 deletions src/Tools/Exports/FoundryTutorial.twee
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
:: FoundryTutorial
<h3>Installation</h3>
1. Go in the ''Add-on Modules'' section in __Foundry__.
2. Click ''Install Module''
3. Search for ''EEEG-Importer'' or paste the manifest ({{{.json}}} file) from https://github.com/HadaIonut/EEEG-importer/releases/ and install the module.
<ol>
<li>Go in the ''Add-on Modules'' section in __Foundry__.</li>
<li>Click ''Install Module''</li>
<li>Search for ''EEEG-Importer'' or paste the manifest ({{{.json}}} file) from https://github.com/HadaIonut/EEEG-importer/releases/ and install the module.</li></ol>
<h3>Usage</h3>
1. Go into the journal entries directory
2. Click on the EEEG-import button located at the top of the tab.
3. Copy the above text into the text box window in Foundry
4. Click the ''import'' button
5. Enjoy!
<ol><li>Go into the journal entries directory</li>
<li>Click on the EEEG-import button located at the top of the tab.</li>
<li>Copy the above text into the text box window in Foundry</li>
<li>Click the ''import'' button</li>
<li>Enjoy!</li></ol>
<h4>Additional features</h4>
* Importing NPCs as actors: With this feature you can make all NPCs into actors (these actors don't have stats generated, so they only have the name and the biography added).
* Configuring locations for NPCs as journal entries: In case anyone wants to have a single folder with all the actors then they can do so
Expand Down
2 changes: 1 addition & 1 deletion src/Tools/Exports/OutputEverything.twee
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<<set _exportContent to setup.outputGMBinder()>>
<<replace "#tutorial">><<include "GMBinderTutorial">><</replace>>
<<case "Raw JSON">>
<<set _exportContent to JSON.stringify($town) + JSON.stringify($npcs) + JSON.stringify($npcs)>>
<<set _exportContent to JSON.stringify($town) + JSON.stringify($npcs) + JSON.stringify(lib.getPantheon($town, State.metadata.get('pantheon')).gods)>>
<<replace "#tutorial">>This is all of the data from the {{{$town}}} and {{{$npcs}}} objects, for whatever purposes you may desire.<</replace>>
<<case "Foundry">>
<<set _exportContent to JSON.stringify(setup.outputEverything())>>
Expand Down
12 changes: 0 additions & 12 deletions src/Tools/Exports/clipboard.js

This file was deleted.

12 changes: 12 additions & 0 deletions src/Tools/Exports/clipboard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const copyText = (jsonText: string) => {
if (!jsonText) jsonText = State.variables.outputEverything as string
updateClipboard(jsonText)
}

function updateClipboard (copyText: string) {
navigator.clipboard.writeText(copyText).then(function () {
$('#notify').trigger(':notify', { message: 'Copied to the clipboard successfully!' })
}, function () {
$('#notify').trigger(':notify', { message: 'Copy to the clipboard failed!' })
})
}
Loading

0 comments on commit 01b97ac

Please sign in to comment.