Data model change
This commit is contained in:
parent
eda4455be3
commit
80708e3f0a
@ -325,10 +325,6 @@ export class CrucibleActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
syncRoll(rollData) {
|
syncRoll(rollData) {
|
||||||
let linkedRollId = CrucibleUtility.getDefenseState(this.id);
|
|
||||||
if (linkedRollId) {
|
|
||||||
rollData.linkedRollId = linkedRollId;
|
|
||||||
}
|
|
||||||
this.lastRollId = rollData.rollId;
|
this.lastRollId = rollData.rollId;
|
||||||
CrucibleUtility.saveRollData(rollData);
|
CrucibleUtility.saveRollData(rollData);
|
||||||
}
|
}
|
||||||
@ -412,17 +408,16 @@ export class CrucibleActor extends Actor {
|
|||||||
let rollData = this.getCommonRollData(abilityKey)
|
let rollData = this.getCommonRollData(abilityKey)
|
||||||
rollData.mode = "skill"
|
rollData.mode = "skill"
|
||||||
rollData.skill = skill
|
rollData.skill = skill
|
||||||
CrucibleUtility.rollCrucible(rollData)
|
|
||||||
|
this.startRoll(rollData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async startRoll(rollData) {
|
async startRoll(rollData) {
|
||||||
this.syncRoll(rollData);
|
this.syncRoll(rollData)
|
||||||
//console.log("ROLL DATA", rollData)
|
|
||||||
let rollDialog = await CrucibleRollDialog.create(this, rollData)
|
let rollDialog = await CrucibleRollDialog.create(this, rollData)
|
||||||
console.log(rollDialog)
|
rollDialog.render(true)
|
||||||
rollDialog.render(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ export class CrucibleRollDialog extends Dialog {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async create(actor, rollData) {
|
static async create(actor, rollData) {
|
||||||
|
|
||||||
let options = { classes: ["CrucibleDialog"], width: 620, height: 480, 'z-index': 99999 };
|
let options = { classes: ["CrucibleDialog"], width: 420, height: 280, 'z-index': 99999 };
|
||||||
let html = await renderTemplate('systems/fvtt-crucible-rpg/templates/roll-dialog-generic.html', rollData);
|
let html = await renderTemplate('systems/fvtt-crucible-rpg/templates/roll-dialog-generic.html', rollData);
|
||||||
|
|
||||||
return new CrucibleRollDialog(actor, rollData, html, options);
|
return new CrucibleRollDialog(actor, rollData, html, options);
|
||||||
@ -14,7 +14,7 @@ export class CrucibleRollDialog extends Dialog {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
constructor(actor, rollData, html, options, close = undefined) {
|
constructor(actor, rollData, html, options, close = undefined) {
|
||||||
let conf = {
|
let conf = {
|
||||||
title: (rollData.mode == "skill") ? "Skill" : "Roll",
|
title: (rollData.mode == "skill") ? "Skill" : "Attribute",
|
||||||
content: html,
|
content: html,
|
||||||
buttons: {
|
buttons: {
|
||||||
roll: {
|
roll: {
|
||||||
@ -58,50 +58,17 @@ export class CrucibleRollDialog extends Dialog {
|
|||||||
}
|
}
|
||||||
$(function () { onLoad(); });
|
$(function () { onLoad(); });
|
||||||
|
|
||||||
html.find('#statDicesLevel').change((event) => {
|
html.find('#none-clicked').change((event) => {
|
||||||
this.rollData.statDicesLevel = Number(event.currentTarget.value)
|
this.rollData.advantage = "none"
|
||||||
});
|
|
||||||
html.find('#specDicesLevel').change(async (event) => {
|
|
||||||
this.rollData.specDicesLevel = Number(event.currentTarget.value)
|
|
||||||
CrucibleUtility.updateSpecDicePool(this.rollData)
|
|
||||||
this.refreshDialog()
|
|
||||||
});
|
|
||||||
html.find('.effect-clicked').change(async (event) => {
|
|
||||||
let toggled = event.currentTarget.checked
|
|
||||||
let effectIdx = $(event.currentTarget).data("effect-idx")
|
|
||||||
this.manageEffects(effectIdx, toggled)
|
|
||||||
this.refreshDialog()
|
|
||||||
});
|
|
||||||
html.find('.armor-clicked').change((event) => {
|
|
||||||
let toggled = event.currentTarget.checked
|
|
||||||
let armorIdx = $(event.currentTarget).data("armor-idx")
|
|
||||||
this.manageArmors(armorIdx, toggled)
|
|
||||||
this.refreshDialog()
|
|
||||||
});
|
|
||||||
html.find('.weapon-clicked').change((event) => {
|
|
||||||
let toggled = event.currentTarget.checked
|
|
||||||
let weaponIdx = $(event.currentTarget).data("weapon-idx")
|
|
||||||
this.manageWeapons(weaponIdx, toggled)
|
|
||||||
this.refreshDialog()
|
|
||||||
});
|
|
||||||
html.find('.equip-clicked').change((event) => {
|
|
||||||
let toggled = event.currentTarget.checked
|
|
||||||
let equipIdx = $(event.currentTarget).data("equip-idx")
|
|
||||||
this.manageEquip(equipIdx, toggled)
|
|
||||||
})
|
|
||||||
|
|
||||||
html.find('.pool-add-dice').click(async (event) => {
|
|
||||||
let diceKey = $(event.currentTarget).data("dice-key")
|
|
||||||
let diceLevel = $(event.currentTarget).data("dice-level")
|
|
||||||
CrucibleUtility.addDicePool(this.rollData, diceKey, diceLevel)
|
|
||||||
this.refreshDialog()
|
this.refreshDialog()
|
||||||
})
|
})
|
||||||
html.find('.pool-remove-dice').click(async (event) => {
|
html.find('#advantage-clicked').change((event) => {
|
||||||
let idx = $(event.currentTarget).data("dice-idx")
|
this.rollData.advantage = "advantage"
|
||||||
CrucibleUtility.removeFromDicePool(this.rollData, idx)
|
this.refreshDialog()
|
||||||
|
})
|
||||||
|
html.find('#disadvantage-clicked').change((event) => {
|
||||||
|
this.rollData.advantage = "disadvantage"
|
||||||
this.refreshDialog()
|
this.refreshDialog()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -86,6 +86,7 @@ export class CrucibleUtility {
|
|||||||
|
|
||||||
const templatePaths = [
|
const templatePaths = [
|
||||||
'systems/fvtt-crucible-rpg/templates/editor-notes-gm.html',
|
'systems/fvtt-crucible-rpg/templates/editor-notes-gm.html',
|
||||||
|
'systems/fvtt-crucible-rpg/templates/partial-roll-select.html',
|
||||||
'systems/fvtt-crucible-rpg/templates/partial-actor-ability-block.html',
|
'systems/fvtt-crucible-rpg/templates/partial-actor-ability-block.html',
|
||||||
'systems/fvtt-crucible-rpg/templates/partial-actor-status.html',
|
'systems/fvtt-crucible-rpg/templates/partial-actor-status.html',
|
||||||
'systems/fvtt-crucible-rpg/templates/partial-options-abilities.html',
|
'systems/fvtt-crucible-rpg/templates/partial-options-abilities.html',
|
||||||
@ -266,7 +267,12 @@ export class CrucibleUtility {
|
|||||||
if (rollData.skill) {
|
if (rollData.skill) {
|
||||||
diceFormula += "+" + String(rollData.skill.data.level) + "d8cs>=5"
|
diceFormula += "+" + String(rollData.skill.data.level) + "d8cs>=5"
|
||||||
}
|
}
|
||||||
|
if(rollData.advantage == "advantage") {
|
||||||
|
diceFormula += "+ 1d10cs>=5"
|
||||||
|
}
|
||||||
|
if(rollData.advantage == "disadvantage") {
|
||||||
|
diceFormula += "- 1d10cs>=5"
|
||||||
|
}
|
||||||
// Performs roll
|
// Performs roll
|
||||||
let myRoll = rollData.roll
|
let myRoll = rollData.roll
|
||||||
if (!myRoll) { // New rolls only of no rerolls
|
if (!myRoll) { // New rolls only of no rerolls
|
||||||
@ -370,6 +376,7 @@ export class CrucibleUtility {
|
|||||||
let rollData = {
|
let rollData = {
|
||||||
rollId: randomID(16),
|
rollId: randomID(16),
|
||||||
rollMode: game.settings.get("core", "rollMode"),
|
rollMode: game.settings.get("core", "rollMode"),
|
||||||
|
advantage: "none"
|
||||||
}
|
}
|
||||||
CrucibleUtility.updateWithTarget(rollData)
|
CrucibleUtility.updateWithTarget(rollData)
|
||||||
return rollData
|
return rollData
|
||||||
|
0
packs/feats.db
Normal file
0
packs/feats.db
Normal file
0
packs/poisons.db
Normal file
0
packs/poisons.db
Normal file
24
system.json
24
system.json
@ -140,6 +140,26 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"skill"
|
"skill"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"entity": "Item",
|
||||||
|
"label": "Feats",
|
||||||
|
"name": "feats",
|
||||||
|
"path": "./packs/feats.db",
|
||||||
|
"system": "fvtt-crucible-rpg",
|
||||||
|
"tags": [
|
||||||
|
"feat"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"entity": "Item",
|
||||||
|
"label": "Poisons",
|
||||||
|
"name": "poisons",
|
||||||
|
"path": "./packs/poisons.db",
|
||||||
|
"system": "fvtt-crucible-rpg",
|
||||||
|
"tags": [
|
||||||
|
"poison"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primaryTokenAttribute": "secondary.health",
|
"primaryTokenAttribute": "secondary.health",
|
||||||
@ -151,8 +171,8 @@
|
|||||||
"templateVersion": 8,
|
"templateVersion": 8,
|
||||||
"title": "Crucible RPG",
|
"title": "Crucible RPG",
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/raw/master/system.json",
|
"manifest": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/raw/master/system.json",
|
||||||
"download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v0.1.9.zip",
|
"download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v0.1.10.zip",
|
||||||
"url": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg",
|
"url": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg",
|
||||||
"version": "0.1.9",
|
"version": "0.1.10",
|
||||||
"background" : "./images/ui/crucible_welcome_page.webp"
|
"background" : "./images/ui/crucible_welcome_page.webp"
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"types": [ "race", "skill", "armor", "shield", "equipment", "weapon", "money" , "feat", "spell", "condition"],
|
"types": [ "race", "skill", "armor", "shield", "equipment", "weapon", "money" , "feat", "spell", "condition", "poison"],
|
||||||
|
"poison": {
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
"condition": {
|
"condition": {
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
|
28
templates/item-poison-sheet.html
Normal file
28
templates/item-poison-sheet.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<form class="{{cssClass}}" autocomplete="off">
|
||||||
|
<header class="sheet-header">
|
||||||
|
<img class="item-sheet-img" src="{{img}}" data-edit="img" title="{{name}}" />
|
||||||
|
<div class="header-fields">
|
||||||
|
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
{{> systems/fvtt-crucible-rpg/templates/partial-item-nav.html}}
|
||||||
|
|
||||||
|
{{!-- Sheet Body --}}
|
||||||
|
<section class="sheet-body">
|
||||||
|
|
||||||
|
<div class="tab details" data-group="primary" data-tab="description">
|
||||||
|
|
||||||
|
<label class="generic-label">Description</label>
|
||||||
|
<div class="medium-editor item-text-long-line">
|
||||||
|
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab details" data-group="primary" data-tab="details">
|
||||||
|
<ul>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</form>
|
18
templates/partial-roll-select.html
Normal file
18
templates/partial-roll-select.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
<ul>
|
||||||
|
<li class="flex-group-left">
|
||||||
|
<label class="ability-value checkbox">
|
||||||
|
<input type="checkbox" id="none-clicked" class="none-clicked" {{#if (eq advantage "none")}} checked {{/if}} /></label>
|
||||||
|
<label class="generic-label">None</label>
|
||||||
|
</li>
|
||||||
|
<li class="flex-group-left">
|
||||||
|
<label class="ability-value checkbox">
|
||||||
|
<input type="checkbox" id="advantage-clicked" class="advantage-clicked" {{#if (eq advantage "advantage")}} checked {{/if}} /></label>
|
||||||
|
<label class="generic-label">Advantage ?</label>
|
||||||
|
</li>
|
||||||
|
<li class="flex-group-left">
|
||||||
|
<label class="ability-value checkbox">
|
||||||
|
<input type="checkbox" id="disadvantage-clicked" class="disadvantage-clicked" {{#if (eq advantage "disadvantage")}} checked {{/if}} /></label>
|
||||||
|
<label class="generic-label">Disadvantage ?</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
@ -10,86 +10,22 @@
|
|||||||
|
|
||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
|
|
||||||
{{#if isGeneric}}
|
|
||||||
|
|
||||||
{{else}}
|
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<span class="roll-dialog-label">Stat Dice : </span>
|
<span class="roll-dialog-label">Ability : </span>
|
||||||
<select class="roll-dialog-label" id="statDicesLevel" type="text" name="statDicesLevel"
|
<span class="roll-dialog-label">{{ability.value}}d6</span>
|
||||||
value="{{statDicesLevel}}" data-dtype="Number" {{#if statKey}}disabled{{/if}}>
|
|
||||||
{{#select statDicesLevel}}
|
|
||||||
{{{optionsDiceList}}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
<span class="small-label"> + {{statMod}}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if specList}}
|
{{#if skill}}
|
||||||
<div class="flexrow">
|
|
||||||
<span class="roll-dialog-label">Spec : </span>
|
|
||||||
<select class="roll-dialog-label" id="specList" type="text" name="selectedSpec" value="{{selectedSpec}}"
|
|
||||||
data-dtype="String">
|
|
||||||
{{#select selectedSpec}}
|
|
||||||
<option value="0">None</option>
|
|
||||||
{{#each specList as |spec idx|}}
|
|
||||||
<option value="{{spec._id}}">{{spec.name}}</option>
|
|
||||||
{{/each}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
<span class="small-label"> </span>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<span class="roll-dialog-label">Spec Dice : </span>
|
<span class="roll-dialog-label">Skill : </span>
|
||||||
<select class="roll-dialog-label" id="specDicesLevel" type="text" name="specDicesLevel"
|
<span class="roll-dialog-label">{{skill.name}} - {{skill.data.value}}d8</span>
|
||||||
value="{{specDicesLevel}}" data-dtype="Number" {{#if specList}}disabled{{/if}}>
|
|
||||||
{{#select specDicesLevel}}
|
|
||||||
{{{optionsDiceList}}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
<span class="small-label"> </span>
|
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<!--
|
|
||||||
{{#if isDamage}}
|
|
||||||
<div class="flexrow">
|
|
||||||
<span class="roll-dialog-label">Weapon Damage :</span>
|
|
||||||
<select class="roll-dialog-label" id="damageDiceLevel" type="text" name="damageDiceLevel"
|
|
||||||
value="{{damageDiceLevel}}" data-dtype="Number">
|
|
||||||
{{#select damageDiceLevel}}
|
|
||||||
{{{optionsDiceList}}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
<span class="small-label"> </span>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
-->
|
|
||||||
|
|
||||||
<div class="dice-pool-div">
|
|
||||||
<span>
|
|
||||||
<h3 class="dice-pool-label">Current pool</h3>
|
|
||||||
</span>
|
|
||||||
<div class="flexrow dice-pool-stack">
|
|
||||||
{{#each dicePool as |dice idx|}}
|
|
||||||
<span><a class="pool-remove-dice" data-dice-idx="{{idx}}" data-dice-level="{{dice.level}}" data-dice-key="{{dice.key}}"><img class="dice-pool-image"
|
|
||||||
src="{{dice.img}}"></a></span>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flexrow">
|
|
||||||
{{#each diceList as |dice idx|}}
|
|
||||||
<span><a class="pool-add-dice" data-dice-key="{{dice.key}}" data-dice-level="{{dice.level}}"><img class="dice-pool-image"
|
|
||||||
src="{{dice.img}}"></a></span>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{{> systems/fvtt-pegasus-rpg/templates/partial-roll-select-effects.html}}
|
{{> systems/fvtt-crucible-rpg/templates/partial-roll-select.html}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user