-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from ben/legacy-tracks
Starforged character sheet
- Loading branch information
Showing
12 changed files
with
337 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { IronswornSettings } from '../../helpers/settings' | ||
import { IronswornVueActorSheet } from '../vueactorsheet' | ||
// import { CharacterMoveSheet } from './charactermovesheet' | ||
|
||
export class StarforgedCharacterSheet extends IronswornVueActorSheet { | ||
static get defaultOptions() { | ||
return mergeObject(super.defaultOptions, { | ||
classes: ['ironsworn', 'sheet', 'actor', `theme-${IronswornSettings.theme}`], | ||
width: 630, | ||
height: 800, | ||
left: 50, | ||
submitOnClose: true, | ||
submitOnChange: true, | ||
template: 'systems/foundry-ironsworn/templates/actor/sf-character.hbs', | ||
}) | ||
} | ||
|
||
getData() { | ||
let data: any = super.getData() | ||
|
||
// Allow every itemtype to add data to the actorsheet | ||
for (const itemType of CONFIG.IRONSWORN.itemClasses) { | ||
data = itemType.getActorSheetData(data, this) | ||
} | ||
|
||
data.actor = this.actor.toObject(false) | ||
data.data = data.actor.data | ||
|
||
return data | ||
} | ||
|
||
// render(...args) { | ||
// if (this._state <= Application.RENDER_STATES.NONE) this._openMoveSheet() | ||
// return super.render(...args) | ||
// } | ||
|
||
// close(...args) { | ||
// this.actor.moveSheet?.close(...args) | ||
// return super.close(...args) | ||
// } | ||
|
||
_getHeaderButtons() { | ||
return [ | ||
{ | ||
class: 'ironsworn-toggle-edit-mode', | ||
label: 'Edit', | ||
icon: 'fas fa-edit', | ||
onclick: (e) => this._toggleEditMode(e), | ||
}, | ||
{ | ||
class: 'ironsworn-open-move-sheet', | ||
label: 'Moves', | ||
icon: 'fas fa-directions', | ||
onclick: console.log // (e) => this._openMoveSheet(e), | ||
}, | ||
...super._getHeaderButtons(), | ||
] | ||
} | ||
|
||
_toggleEditMode(_e: JQuery.ClickEvent) { | ||
const currentValue = this.actor.getFlag('foundry-ironsworn', 'edit-mode') | ||
this.actor.setFlag('foundry-ironsworn', 'edit-mode', !currentValue) | ||
} | ||
|
||
// _openMoveSheet(_e?: JQuery.ClickEvent) { | ||
// if (this.actor.moveSheet) { | ||
// this.actor.moveSheet.render(true, { focus: true }) | ||
// } else { | ||
// new CharacterMoveSheet(this.actor).render(true) | ||
// } | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<header class="sheet-header flexrow"> | ||
<document-img :document="actor" size="75px" /> | ||
|
||
<div class="flexcol" style="flex-basis: 100px"> | ||
<input | ||
type="text" | ||
style="margin-bottom: 7px" | ||
:placeholder="$t('IRONSWORN.Name')" | ||
v-model="actor.name" | ||
ref="name" | ||
@blur="save" | ||
/> | ||
<input | ||
type="text" | ||
style="margin-bottom: 7px" | ||
:placeholder="$t('IRONSWORN.Pronouns')" | ||
:value="actor.data.pronouns" | ||
ref="pronouns" | ||
@blur="save" | ||
/> | ||
<input | ||
type="text" | ||
:placeholder="$t('IRONSWORN.Callsign')" | ||
:value="actor.data.callsign" | ||
ref="callsign" | ||
@blur="save" | ||
/> | ||
</div> | ||
|
||
<textarea | ||
rows="4" | ||
:value="actor.data.biography" | ||
ref="characteristics" | ||
style="flex-basis: 300px; margin-left: 6px" | ||
:placeholder="$t('IRONSWORN.Characteristics')" | ||
@blur="save" | ||
/> | ||
</header> | ||
</template> | ||
|
||
<style lang="less" scoped> | ||
input, | ||
textarea { | ||
border-color: rgba(0, 0, 0, 0.1); | ||
border-radius: 1px; | ||
font-family: var(--font-primary); | ||
resize: none; | ||
} | ||
</style> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
actor: Object, | ||
}, | ||
methods: { | ||
save() { | ||
this.$actor?.update({ | ||
name: this.$refs.name.value, | ||
data: { | ||
callsign: this.$refs.callsign.value, | ||
pronouns: this.$refs.pronouns.value, | ||
biography: this.$refs.characteristics.value, | ||
}, | ||
}) | ||
}, | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
<template> | ||
<div class="flexcol"> | ||
<!-- Header row --> | ||
<sf-characterheader :actor="actor" /> | ||
|
||
<!-- Main body row --> | ||
<div class="flexrow"> | ||
<!-- Momentum on left --> | ||
<div class="flexcol margin-left"> | ||
<div class="flexrow" style="flex-wrap: nowrap"> | ||
<div class="flexcol stack momentum"> | ||
<stack | ||
:actor="actor" | ||
stat="momentum" | ||
:top="10" | ||
:bottom="-6" | ||
:softMax="actor.data.momentumMax" | ||
></stack> | ||
<hr class="nogrow" /> | ||
<div class="nogrow"> | ||
<div class="clickable block stack-row" @click="burnMomentum"> | ||
{{ $t('IRONSWORN.Burn') }} | ||
</div> | ||
</div> | ||
|
||
{{ $t('IRONSWORN.Reset') }}: {{ actor.data.momentumReset }} | ||
{{ $t('IRONSWORN.Max') }}: {{ actor.data.momentumMax }} | ||
</div> | ||
|
||
<h4 class="vertical-v2">{{ $t('IRONSWORN.Momentum') }}</h4> | ||
</div> | ||
</div> | ||
|
||
<!-- Center area --> | ||
<div class="flexcol"> | ||
<!-- Attributes --> | ||
<div class="flexrow stats" style="margin-bottom: 10px"> | ||
<attr-box :actor="actor" attr="edge"></attr-box> | ||
<attr-box :actor="actor" attr="heart"></attr-box> | ||
<attr-box :actor="actor" attr="iron"></attr-box> | ||
<attr-box :actor="actor" attr="shadow"></attr-box> | ||
<attr-box :actor="actor" attr="wits"></attr-box> | ||
</div> | ||
|
||
<!-- Tabs --> | ||
<div class="flexrow nogrow"> | ||
<div | ||
class="tab" | ||
v-for="tab in tabs" | ||
:key="tab.titleKey" | ||
:class="['clickable', 'block', { selected: currentTab === tab }]" | ||
@click="currentTab = tab" | ||
> | ||
{{ $t(tab.titleKey) }} | ||
</div> | ||
</div> | ||
<keep-alive> | ||
<component :is="currentTab.component" /> | ||
</keep-alive> | ||
</div> | ||
|
||
<!-- Stats on right --> | ||
<div class="flexcol margin-right"> | ||
<div class="flexrow nogrow" style="flex-wrap: nowrap"> | ||
<h4 class="vertical-v2 clickable text" @click="rollStat('health')"> | ||
{{ $t('IRONSWORN.Health') }} | ||
</h4> | ||
<div class="flexcol stack health"> | ||
<stack :actor="actor" stat="health" :top="5" :bottom="0"></stack> | ||
</div> | ||
</div> | ||
|
||
<hr class="nogrow" /> | ||
|
||
<div class="flexrow nogrow" style="flex-wrap: nowrap"> | ||
<h4 class="vertical-v2 clickable text" @click="rollStat('spirit')"> | ||
{{ $t('IRONSWORN.Spirit') }} | ||
</h4> | ||
<div class="flexcol stack spirit"> | ||
<stack :actor="actor" stat="spirit" :top="5" :bottom="0"></stack> | ||
</div> | ||
</div> | ||
|
||
<hr class="nogrow" /> | ||
|
||
<div class="flexrow nogrow" style="flex-wrap: nowrap"> | ||
<h4 class="vertical-v2 clickable text" @click="rollStat('supply')"> | ||
{{ $t('IRONSWORN.Supply') }} | ||
</h4> | ||
<div class="flexcol stack supply"> | ||
<stack :actor="actor" stat="supply" :top="5" :bottom="0"></stack> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="less" scoped> | ||
.tab { | ||
text-align: center; | ||
padding: 5px; | ||
border-bottom: 1px solid grey; | ||
&.active { | ||
background-color: darkgray; | ||
} | ||
} | ||
</style> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
actor: Object, | ||
}, | ||
data() { | ||
const tabs = [ | ||
{ titleKey: 'IRONSWORN.Legacies', component: 'sf-legacies' }, | ||
{ titleKey: 'IRONSWORN.Bonds', component: 'sf-bonds' }, | ||
{ titleKey: 'IRONSWORN.Progress', component: 'sf-progresses' }, | ||
{ titleKey: 'IRONSWORN.Clocks', component: 'sf-clocks' }, | ||
{ titleKey: 'IRONSWORN.Scenes', component: 'sf-scenes' }, | ||
] | ||
return { | ||
tabs, | ||
currentTab: tabs[0], | ||
} | ||
}, | ||
methods: { | ||
burnMomentum() { | ||
this.$actor.burnMomentum() | ||
}, | ||
rollStat(stat) { | ||
CONFIG.IRONSWORN.RollDialog.show({ actor: this.$actor, stat }) | ||
}, | ||
openCompendium(name) { | ||
const pack = game.packs?.get(`foundry-ironsworn.${name}`) | ||
pack?.render(true) | ||
}, | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.