Generic roll and update items

This commit is contained in:
sladecraven 2022-01-13 16:13:00 +01:00
parent 9111a73555
commit b4a06a5049
13 changed files with 167 additions and 18 deletions

View File

@ -2,6 +2,7 @@
import { PegasusActorCreate } from "./pegasus-create-char.js"; import { PegasusActorCreate } from "./pegasus-create-char.js";
import { PegasusUtility } from "./pegasus-utility.js"; import { PegasusUtility } from "./pegasus-utility.js";
import { PegasusRollDialog } from "./pegasus-roll-dialog.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
export class PegasusCommands { export class PegasusCommands {
@ -10,6 +11,7 @@ export class PegasusCommands {
if (!game.system.pegasus.commands) { if (!game.system.pegasus.commands) {
const pegasusCommands = new PegasusCommands(); const pegasusCommands = new PegasusCommands();
pegasusCommands.registerCommand({ path: ["/char"], func: (content, msg, params) => pegasusCommands.createChar(msg), descr: "Create a new character" }); 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; game.system.pegasus.commands = pegasusCommands;
} }
} }
@ -102,7 +104,26 @@ export class PegasusCommands {
static _chatAnswer(msg, content) { static _chatAnswer(msg, content) {
msg.whisper = [game.user.id]; msg.whisper = [game.user.id];
msg.content = content; 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 );
} }
} }

View File

@ -7,7 +7,10 @@ export class PegasusRollDialog extends Dialog {
let html let html
let options = { classes: ["WotGdialog"], width: 420, height: 320, 'z-index': 99999 }; 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); html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-stat.html', rollData);
options.height = 320; options.height = 320;
} else if (rollData.mode == "spec") { } else if (rollData.mode == "spec") {
@ -65,6 +68,12 @@ export class PegasusRollDialog extends Dialog {
html.find('#specList').change((event) => { html.find('#specList').change((event) => {
this.rollData.selectedSpec = event.currentTarget.value; 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) => { html.find('#bonusDicesLevel').change((event) => {
this.rollData.bonusDicesLevel = Number(event.currentTarget.value); this.rollData.bonusDicesLevel = Number(event.currentTarget.value);
}); });

View File

@ -374,6 +374,9 @@ export class PegasusUtility {
dicePool[0].level += Number(rollData.stat.value); dicePool[0].level += Number(rollData.stat.value);
dicePool[0].statmod = Number(rollData.stat.mod); dicePool[0].statmod = Number(rollData.stat.mod);
} }
if ( rollData.statDicesLevel) {
dicePool[0].level = rollData.statDicesLevel;
}
if (rollData.selectedSpec && rollData.selectedSpec != "0") { if (rollData.selectedSpec && rollData.selectedSpec != "0") {
rollData.spec = rollData.specList.find( item => item._id == rollData.selectedSpec); rollData.spec = rollData.specList.find( item => item._id == rollData.selectedSpec);
rollData.spec.data.dice = PegasusUtility.getDiceFromLevel(rollData.spec.data.level); rollData.spec.data.dice = PegasusUtility.getDiceFromLevel(rollData.spec.data.level);
@ -381,6 +384,9 @@ export class PegasusUtility {
if (rollData.spec) { if (rollData.spec) {
dicePool[1].level += Number(rollData.spec.data.level); dicePool[1].level += Number(rollData.spec.data.level);
} }
if ( rollData.specDicesLevel) {
dicePool[0].level = rollData.specDicesLevel;
}
if (rollData.bonusDicesLevel) { if (rollData.bonusDicesLevel) {
dicePool[2].level += Number(rollData.bonusDicesLevel); dicePool[2].level += Number(rollData.bonusDicesLevel);
} }

View File

@ -403,6 +403,7 @@
"cost": 0, "cost": 0,
"idr": "", "idr": "",
"equipped": false, "equipped": false,
"locationprotected": "",
"description":"" "description":""
}, },
"shield": { "shield": {
@ -429,6 +430,14 @@
"weight": 0, "weight": 0,
"idr": "", "idr": "",
"range": "", "range": "",
"maxrange": "",
"ao": "",
"damagetype": "",
"damagetypelevel": 0,
"vehicledamagetype": "",
"vehicledamagetypelevel": 0,
"ammocurrent": 0,
"ammomax": 0,
"equipped": false, "equipped": false,
"description": "" "description": ""
} }

View File

@ -1,12 +1,17 @@
<div class="chat-message-header"> <div class="chat-message-header">
{{#if actorImg}}
<img class="actor-icon" src="{{actorImg}}" alt="{{alias}}" /> <img class="actor-icon" src="{{actorImg}}" alt="{{alias}}" />
{{/if}}
<h4 class=chat-actor-name>{{alias}}</h4> <h4 class=chat-actor-name>{{alias}}</h4>
</div> </div>
<hr> <hr>
{{#if img}}
<div > <div >
<img class="chat-icon" src="{{img}}" alt="{{name}}" /> <img class="chat-icon" src="{{img}}" alt="{{name}}" />
</div> </div>
{{/if}}
<div class="flexcol"> <div class="flexcol">
</div> </div>

View File

@ -18,8 +18,16 @@
{{/select}} {{/select}}
</select> </select>
</li> </li>
<li class="flexrow"><label class="generic-label">DMG RES Other Dice</label> <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>
<li class="flexrow"><label class="generic-label">Equipped ?</label> <li class="flexrow"><label class="generic-label">Equipped ?</label>

View File

@ -51,8 +51,6 @@
</ul> </ul>
</li> </li>
{{#if (eq data.genre "positive")}}
<li class="flexrow"><label class="generic-label">Affected Stat</label> <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 class="competence-base flexrow" type="text" name="data.stataffected" value="{{data.stataffected}}" data-dtype="String">
{{#select data.stataffected}} {{#select data.stataffected}}
@ -61,6 +59,9 @@
</select> </select>
</li> </li>
{{#if (eq data.genre "positive")}}
<li class="flexrow"><label class="generic-label">Stat Dice ?</label> <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> <label class="attribute-value checkbox"><input type="checkbox" name="data.statdice" {{checked data.statdice}}/></label>
</li> </li>
@ -75,14 +76,6 @@
{{else}} {{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> <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> <label class="attribute-value checkbox"><input type="checkbox" name="data.reducedicevalue" {{checked data.reducedicevalue}}/></label>
</li> </li>

View File

@ -13,7 +13,7 @@
<ul> <ul>
<li class="flexrow"><label class="generic-label">Type</label> <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 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}} {{> systems/fvtt-pegasus-rpg/templates/partial-options-equipment-types.html}}
{{/select}} {{/select}}
</select> </select>

View File

@ -13,8 +13,10 @@
<ul> <ul>
<li class="flexrow"><label class="generic-label">Defense Type</label> <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 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="dodge">Dodge</option>
<option value="block">Block</option> <option value="block">Block</option>
{{/select}}
</select> </select>
</li> </li>
<li class="flexrow"><label class="generic-label">Dice Level</label> <li class="flexrow"><label class="generic-label">Dice Level</label>

View File

@ -14,7 +14,7 @@
<li class="flexrow"><label class="generic-label">Related Statistic</label> <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 class="competence-base flexrow" type="text" name="data.statistic" value="{{data.statistic}}" data-dtype="String">
{{#select data.statistic}} {{#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}}
</select> </select>
</li> </li>
@ -25,14 +25,70 @@
{{/select}} {{/select}}
</select> </select>
</li> </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 class="competence-base flexrow" type="text" name="data.range" value="{{data.range}}" data-dtype="String">
{{#select data.range}} {{#select data.range}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-range.html notapplicable=true}} {{> systems/fvtt-pegasus-rpg/templates/partial-options-range.html notapplicable=true}}
{{/select}} {{/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> </select>
</li> </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> <li class="flexrow"><label class="generic-label">Equipped ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="data.equipped" {{checked data.equipped}}/></label> <label class="attribute-value checkbox"><input type="checkbox" name="data.equipped" {{checked data.equipped}}/></label>
</li> </li>

View File

@ -1,9 +1,13 @@
{{#if notapplicable}} {{#if notapplicable}}
<option value="notapplicable">Not applicable</option> <option value="notapplicable">Not applicable</option>
{{/if}} {{/if}}
<option value="threatzone">Threat Zone</option> <option value="tz">Threat Zone</option>
<option value="close">Close</option> <option value="close">Close</option>
<option value="medium">Medium</option> <option value="medium">Medium</option>
<option value="long">Long</option> <option value="long">Long</option>
<option value="extreme">Extreme</option> <option value="extreme">Extreme</option>
<option value="sight">Line of Sight</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>

View File

@ -2,7 +2,10 @@
<option value="notapplicable">Not applicable</option> <option value="notapplicable">Not applicable</option>
{{/if}} {{/if}}
{{#if all}} {{#if all}}
<option value="notapplicable">All</option> <option value="all">All</option>
{{/if}}
{{#if all}}
<option value="special">Special</option>
{{/if}} {{/if}}
<option value="agi">AGI</option> <option value="agi">AGI</option>
<option value="mnd">MND</option> <option value="mnd">MND</option>

View 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>