Skip to content

Commit

Permalink
Merge pull request #344 from ben/mix-and-match
Browse files Browse the repository at this point in the history
Mix and match IS/SF sheets and moves/oracles
  • Loading branch information
ben authored May 6, 2022
2 parents 160e7e6 + 6bd3472 commit de6afca
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## In progress

- Use the Starforged-style oracle tree for Ironsworn, with Dataforged-powered tables ([#337](https://github.com/ben/foundry-ironsworn/pull/337))
- Allow explicit setting of which toolbox to use ([#344](https://github.com/ben/foundry-ironsworn/pull/344))

## 1.10.62

Expand Down
8 changes: 7 additions & 1 deletion src/module/actor/sheets/charactersheet-v2.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IronswornSettings } from '../../helpers/settings'
import { IronswornVueActorSheet } from '../vueactorsheet'
import { CharacterMoveSheet } from './charactermovesheet'
import { SFCharacterMoveSheet } from './sf-charactermovesheet'

export class IronswornCharacterSheetV2 extends IronswornVueActorSheet {
static get defaultOptions() {
Expand Down Expand Up @@ -66,7 +67,12 @@ export class IronswornCharacterSheetV2 extends IronswornVueActorSheet {
if (this.actor.moveSheet) {
this.actor.moveSheet.render(true, { focus: true })
} else {
new CharacterMoveSheet(this.actor).render(true)
if (IronswornSettings.toolbox === 'starforged') {
this.actor.moveSheet ||= new SFCharacterMoveSheet(this.actor)
this.actor.moveSheet.render(true, { focus: true })
} else {
new CharacterMoveSheet(this.actor).render(true)
}
}
}
}
8 changes: 7 additions & 1 deletion src/module/actor/sheets/charactersheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { RollDialog } from '../../helpers/rolldialog'
import { IronswornSettings } from '../../helpers/settings'
import { IronswornItem } from '../../item/item'
import { CharacterMoveSheet } from './charactermovesheet'
import { SFCharacterMoveSheet } from './sf-charactermovesheet'

export class IronswornCharacterSheet extends ActorSheet {
static get defaultOptions() {
Expand Down Expand Up @@ -82,7 +83,12 @@ export class IronswornCharacterSheet extends ActorSheet {
if (this.actor.moveSheet) {
this.actor.moveSheet.render(true, { focus: true })
} else {
new CharacterMoveSheet(this.actor).render(true)
if (IronswornSettings.toolbox === 'starforged') {
this.actor.moveSheet ||= new SFCharacterMoveSheet(this.actor)
this.actor.moveSheet.render(true, { focus: true })
} else {
new CharacterMoveSheet(this.actor).render(true)
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/module/actor/sheets/sf-charactersheet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IronswornSettings } from '../../helpers/settings'
import { IronswornVueActorSheet } from '../vueactorsheet'
import { CharacterMoveSheet } from './charactermovesheet'
import { SFCharacterMoveSheet } from './sf-charactermovesheet'

export class StarforgedCharacterSheet extends IronswornVueActorSheet {
Expand Down Expand Up @@ -63,7 +64,11 @@ export class StarforgedCharacterSheet extends IronswornVueActorSheet {
}

_openMoveSheet(_e?: JQuery.ClickEvent) {
this.actor.moveSheet ||= new SFCharacterMoveSheet(this.actor)
this.actor.moveSheet.render(true, { focus: true })
if (IronswornSettings.toolbox === 'ironsworn') {
new CharacterMoveSheet(this.actor).render(true)
} else {
this.actor.moveSheet ||= new SFCharacterMoveSheet(this.actor)
this.actor.moveSheet.render(true, { focus: true })
}
}
}
18 changes: 18 additions & 0 deletions src/module/helpers/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ export class IronswornSettings {
onChange: reload,
})

game.settings.register('foundry-ironsworn', 'toolbox', {
name: 'IRONSWORN.Settings.Tools.Name',
hint: 'IRONSWORN.Settings.Tools.Hint',
scope: 'world',
config: true,
type: String,
choices: {
sheet: 'IRONSWORN.Settings.Tools.Sheet',
ironsworn: 'IRONSWORN.Ironsworn',
starforged: 'IRONSWORN.Starforged',
},
default: 'sheet',
})

game.settings.register('foundry-ironsworn', 'shared-supply', {
name: 'IRONSWORN.Settings.SharedSupply.Name',
hint: 'IRONSWORN.Settings.SharedSupply.Hint',
Expand Down Expand Up @@ -67,6 +81,10 @@ export class IronswornSettings {
return game.settings.get('foundry-ironsworn', 'theme') as string
}

static get toolbox(): string {
return game.settings.get('foundry-ironsworn', 'toolbox') as string
}

static get starforgedBeta(): boolean {
return game.settings.get('foundry-ironsworn', 'starforged-beta') as boolean
}
Expand Down
7 changes: 7 additions & 0 deletions system/lang/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"IRONSWORN": {
"Ironsworn": "Ironsworn",
"Starforged": "Starforged",
"CreateActor": "Create Actor",
"YourWorldTruths": "Your World: Truths",
"TruthQuestStarter": "Quest Starter:",
Expand Down Expand Up @@ -201,6 +203,11 @@
"Ironsworn": "Ironsworn Classic",
"Starforged": "Starforged (experimental)"
},
"Tools": {
"Name": "Character Tools",
"Hint": "Which set of moves and oracles will appear when opening a character sheet.",
"Sheet": "Match sheet"
},
"SharedSupply": {
"Name": "Shared Supply Tracker",
"Hint": "If on, changing any character/shared supply tracker changes all other actors' supply trackers as well."
Expand Down

0 comments on commit de6afca

Please sign in to comment.