Generic roll and update items
This commit is contained in:
parent
9111a73555
commit
b4a06a5049
@ -2,6 +2,7 @@
|
||||
|
||||
import { PegasusActorCreate } from "./pegasus-create-char.js";
|
||||
import { PegasusUtility } from "./pegasus-utility.js";
|
||||
import { PegasusRollDialog } from "./pegasus-roll-dialog.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class PegasusCommands {
|
||||
@ -10,6 +11,7 @@ export class PegasusCommands {
|
||||
if (!game.system.pegasus.commands) {
|
||||
const pegasusCommands = new PegasusCommands();
|
||||
pegasusCommands.registerCommand({ path: ["/char"], func: (content, msg, params) => pegasusCommands.createChar(msg), descr: "Create a new character" });
|
||||
pegasusCommands.registerCommand({ path: ["/pool"], func: (content, msg, params) => pegasusCommands.poolRoll(msg), descr: "Generic Roll Window" });
|
||||
game.system.pegasus.commands = pegasusCommands;
|
||||
}
|
||||
}
|
||||
@ -102,7 +104,26 @@ export class PegasusCommands {
|
||||
static _chatAnswer(msg, content) {
|
||||
msg.whisper = [game.user.id];
|
||||
msg.content = content;
|
||||
ChatMessage.create(msg);
|
||||
ChatMessage.create(msg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async poolRoll( msg) {
|
||||
let rollData = {
|
||||
rollId:randomID(16),
|
||||
alias: "Generic Roll",
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
optionsDiceList: PegasusUtility.getOptionsDiceList(),
|
||||
statDicesLevel: 0,
|
||||
specDicesLevel: 0,
|
||||
bonusDicesLevel: 0,
|
||||
hindranceDicesLevel: 0,
|
||||
otherDicesLevel: 0,
|
||||
}
|
||||
rollData.mode = "generic"
|
||||
rollData.title = `Generic Pool Roll`;
|
||||
let rollDialog = await PegasusRollDialog.create( this, rollData);
|
||||
rollDialog.render( true );
|
||||
}
|
||||
|
||||
}
|
@ -7,7 +7,10 @@ export class PegasusRollDialog extends Dialog {
|
||||
|
||||
let html
|
||||
let options = { classes: ["WotGdialog"], width: 420, height: 320, 'z-index': 99999 };
|
||||
if ( rollData.mode == "stat" || rollData.mode == "MR") {
|
||||
if ( rollData.mode == "generic" ) {
|
||||
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-generic.html', rollData);
|
||||
options.height = 320;
|
||||
} else if ( rollData.mode == "stat" || rollData.mode == "MR") {
|
||||
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-stat.html', rollData);
|
||||
options.height = 320;
|
||||
} else if (rollData.mode == "spec") {
|
||||
@ -65,6 +68,12 @@ export class PegasusRollDialog extends Dialog {
|
||||
html.find('#specList').change((event) => {
|
||||
this.rollData.selectedSpec = event.currentTarget.value;
|
||||
});
|
||||
html.find('#statDicesLevel').change((event) => {
|
||||
this.rollData.statDicesLevel = Number(event.currentTarget.value);
|
||||
});
|
||||
html.find('#specDicesLevel').change((event) => {
|
||||
this.rollData.specDicesLevel = Number(event.currentTarget.value);
|
||||
});
|
||||
html.find('#bonusDicesLevel').change((event) => {
|
||||
this.rollData.bonusDicesLevel = Number(event.currentTarget.value);
|
||||
});
|
||||
|
@ -374,6 +374,9 @@ export class PegasusUtility {
|
||||
dicePool[0].level += Number(rollData.stat.value);
|
||||
dicePool[0].statmod = Number(rollData.stat.mod);
|
||||
}
|
||||
if ( rollData.statDicesLevel) {
|
||||
dicePool[0].level = rollData.statDicesLevel;
|
||||
}
|
||||
if (rollData.selectedSpec && rollData.selectedSpec != "0") {
|
||||
rollData.spec = rollData.specList.find( item => item._id == rollData.selectedSpec);
|
||||
rollData.spec.data.dice = PegasusUtility.getDiceFromLevel(rollData.spec.data.level);
|
||||
@ -381,6 +384,9 @@ export class PegasusUtility {
|
||||
if (rollData.spec) {
|
||||
dicePool[1].level += Number(rollData.spec.data.level);
|
||||
}
|
||||
if ( rollData.specDicesLevel) {
|
||||
dicePool[0].level = rollData.specDicesLevel;
|
||||
}
|
||||
if (rollData.bonusDicesLevel) {
|
||||
dicePool[2].level += Number(rollData.bonusDicesLevel);
|
||||
}
|
||||
|
@ -403,6 +403,7 @@
|
||||
"cost": 0,
|
||||
"idr": "",
|
||||
"equipped": false,
|
||||
"locationprotected": "",
|
||||
"description":""
|
||||
},
|
||||
"shield": {
|
||||
@ -429,6 +430,14 @@
|
||||
"weight": 0,
|
||||
"idr": "",
|
||||
"range": "",
|
||||
"maxrange": "",
|
||||
"ao": "",
|
||||
"damagetype": "",
|
||||
"damagetypelevel": 0,
|
||||
"vehicledamagetype": "",
|
||||
"vehicledamagetypelevel": 0,
|
||||
"ammocurrent": 0,
|
||||
"ammomax": 0,
|
||||
"equipped": false,
|
||||
"description": ""
|
||||
}
|
||||
|
@ -1,12 +1,17 @@
|
||||
<div class="chat-message-header">
|
||||
{{#if actorImg}}
|
||||
<img class="actor-icon" src="{{actorImg}}" alt="{{alias}}" />
|
||||
{{/if}}
|
||||
<h4 class=chat-actor-name>{{alias}}</h4>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
{{#if img}}
|
||||
<div >
|
||||
<img class="chat-icon" src="{{img}}" alt="{{name}}" />
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="flexcol">
|
||||
</div>
|
||||
|
@ -18,8 +18,16 @@
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">DMG RES Other Dice</label>
|
||||
<input type="text" class="padd-right" name="data.resistance" value="{{data.resistance}}" data-dtype="String"/>
|
||||
<select class="competence-base flexrow" type="text" name="data.resistance" value="{{data.resistance}}" data-dtype="Number">
|
||||
{{#select data.resistance}}
|
||||
{{{optionsDiceList}}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Location Protected</label>
|
||||
<input type="text" class="" name="data.locationprotected" value="{{data.locationprotected}}" data-dtype="String"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Equipped ?</label>
|
||||
|
@ -51,8 +51,6 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
{{#if (eq data.genre "positive")}}
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Affected Stat</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.stataffected" value="{{data.stataffected}}" data-dtype="String">
|
||||
{{#select data.stataffected}}
|
||||
@ -61,6 +59,9 @@
|
||||
</select>
|
||||
</li>
|
||||
|
||||
{{#if (eq data.genre "positive")}}
|
||||
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Stat Dice ?</label>
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="data.statdice" {{checked data.statdice}}/></label>
|
||||
</li>
|
||||
@ -75,14 +76,6 @@
|
||||
|
||||
{{else}}
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Affected Stat</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.stataffected" value="{{data.stataffected}}" data-dtype="String">
|
||||
{{#select data.stataffected}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true mr=true all=true}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Reduce Dice Value ?</label>
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="data.reducedicevalue" {{checked data.reducedicevalue}}/></label>
|
||||
</li>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<ul>
|
||||
<li class="flexrow"><label class="generic-label">Type</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.type" value="{{data.type}}" data-dtype="String">
|
||||
{{#select data.statistic}}
|
||||
{{#select data.type}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-equipment-types.html}}
|
||||
{{/select}}
|
||||
</select>
|
||||
|
@ -13,8 +13,10 @@
|
||||
<ul>
|
||||
<li class="flexrow"><label class="generic-label">Defense Type</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.deftype" value="{{data.deftype}}" data-dtype="String">
|
||||
{{#select data.deftype}}
|
||||
<option value="dodge">Dodge</option>
|
||||
<option value="block">Block</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Dice Level</label>
|
||||
|
@ -14,7 +14,7 @@
|
||||
<li class="flexrow"><label class="generic-label">Related Statistic</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.statistic" value="{{data.statistic}}" data-dtype="String">
|
||||
{{#select data.statistic}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=true special=true}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
@ -25,14 +25,70 @@
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Range</label>
|
||||
<li class="flexrow"><label class="generic-label">Optimal Range</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.range" value="{{data.range}}" data-dtype="String">
|
||||
{{#select data.range}}
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-options-range.html notapplicable=true}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Max Range</label>
|
||||
<input type="text" class="" name="data.maxrange" value="{{data.maxrange}}" data-dtype="String"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">AoE</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.aoe" value="{{data.aoe}}" data-dtype="String">
|
||||
{{#select data.aoe}}
|
||||
<option value="none">None</option>
|
||||
<option value="tz">TZ</option>
|
||||
<option value="close">Close</option>
|
||||
<option value="medium">Medium</option>
|
||||
<option value="long">Long</option>
|
||||
<option value="extreme">Extreme</option>
|
||||
<option value="special">Special</option>
|
||||
{{{optionsDiceList}}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Damage Type</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.damagetype" value="{{data.damagetype}}" data-dtype="String">
|
||||
{{#select data.damagetype}}
|
||||
<option value="slashing">Slashing</option>
|
||||
<option value="crushing">Crushing</option>
|
||||
<option value="piercing">Piercing</option>
|
||||
{{{optionsDiceList}}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Damage Type Level</label>
|
||||
<input type="text" class="input-numeric-short padd-right" name="data.damagetypelevel" value="{{data.damagetypelevel}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Vehicle Damage Type</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.vehicledamagetype" value="{{data.vehicledamagetype}}" data-dtype="String">
|
||||
{{#select data.vehicledamagetype}}
|
||||
<option value="emp">EMP</option>
|
||||
<option value="thermal">Thermal</option>
|
||||
<option value="kinetic">Kinetic</option>
|
||||
{{{optionsDiceList}}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Vehicle Damage Type Level</label>
|
||||
<input type="text" class="input-numeric-short padd-right" name="data.vehicledamagetypelevel" value="{{data.vehicledamagetypelevel}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Ammon - Current</label>
|
||||
<input type="text" class="input-numeric-short padd-right" name="data.ammocurrent" value="{{data.ammocurrent}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Ammon - Max</label>
|
||||
<input type="text" class="input-numeric-short padd-right" name="data.ammomax" value="{{data.ammomax}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Equipped ?</label>
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="data.equipped" {{checked data.equipped}}/></label>
|
||||
</li>
|
||||
|
@ -1,9 +1,13 @@
|
||||
{{#if notapplicable}}
|
||||
<option value="notapplicable">Not applicable</option>
|
||||
{{/if}}
|
||||
<option value="threatzone">Threat Zone</option>
|
||||
<option value="tz">Threat Zone</option>
|
||||
<option value="close">Close</option>
|
||||
<option value="medium">Medium</option>
|
||||
<option value="long">Long</option>
|
||||
<option value="extreme">Extreme</option>
|
||||
<option value="sight">Line of Sight</option>
|
||||
<option value="tz_close">TZ/Close</option>
|
||||
<option value="close_medium">Close/Medium</option>
|
||||
<option value="medium_long">Medium/Long</option>
|
||||
<option value="long_extreme">Long/Extreme</option>
|
||||
|
@ -2,7 +2,10 @@
|
||||
<option value="notapplicable">Not applicable</option>
|
||||
{{/if}}
|
||||
{{#if all}}
|
||||
<option value="notapplicable">All</option>
|
||||
<option value="all">All</option>
|
||||
{{/if}}
|
||||
{{#if all}}
|
||||
<option value="special">Special</option>
|
||||
{{/if}}
|
||||
<option value="agi">AGI</option>
|
||||
<option value="mnd">MND</option>
|
||||
|
33
templates/roll-dialog-generic.html
Normal file
33
templates/roll-dialog-generic.html
Normal file
@ -0,0 +1,33 @@
|
||||
<form class="skill-roll-dialog">
|
||||
<header class="roll-dialog-header">
|
||||
{{#if img}}
|
||||
<img class="actor-icon" src="{{img}}" data-edit="img" title="{{name}}" />
|
||||
{{/if}}
|
||||
<h1 class="dialog-roll-title roll-dialog-header">{{title}}</h1>
|
||||
</header>
|
||||
|
||||
<div class="floxrow">
|
||||
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label" >Stat Dice : </span>
|
||||
<select class="competence-base" id="statDicesLevel" type="text" name="statDicesLevel" value="{{statDicesLevel}}" data-dtype="Number">
|
||||
{{#select statDicesLevel}}
|
||||
{{{optionsDiceList}}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label" >Spec Dice : </span>
|
||||
<select class="competence-base" id="specDicesLevel" type="text" name="specDicesLevel" value="{{specDicesLevel}}" data-dtype="Number">
|
||||
{{#select specDicesLevel}}
|
||||
{{{optionsDiceList}}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{> systems/fvtt-pegasus-rpg/templates/partial-roll-common-dices.html}}
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user