From b4a06a504953ab4dfbff437b87a41f164b741c95 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Thu, 13 Jan 2022 16:13:00 +0100 Subject: [PATCH] Generic roll and update items --- modules/pegasus-commands.js | 23 ++++++++- modules/pegasus-roll-dialog.js | 11 ++++- modules/pegasus-utility.js | 6 +++ template.json | 9 ++++ templates/chat-generic-result.html | 5 ++ templates/item-armor-sheet.html | 10 +++- templates/item-effect-sheet.html | 13 ++--- templates/item-equipment-sheet.html | 2 +- templates/item-shield-sheet.html | 2 + templates/item-weapon-sheet.html | 60 ++++++++++++++++++++++- templates/partial-options-range.html | 6 ++- templates/partial-options-statistics.html | 5 +- templates/roll-dialog-generic.html | 33 +++++++++++++ 13 files changed, 167 insertions(+), 18 deletions(-) create mode 100644 templates/roll-dialog-generic.html diff --git a/modules/pegasus-commands.js b/modules/pegasus-commands.js index 3b41b9a..933161d 100644 --- a/modules/pegasus-commands.js +++ b/modules/pegasus-commands.js @@ -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 ); } } \ No newline at end of file diff --git a/modules/pegasus-roll-dialog.js b/modules/pegasus-roll-dialog.js index 8ea5e4d..de5814f 100644 --- a/modules/pegasus-roll-dialog.js +++ b/modules/pegasus-roll-dialog.js @@ -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); }); diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js index f669777..3d507af 100644 --- a/modules/pegasus-utility.js +++ b/modules/pegasus-utility.js @@ -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); } diff --git a/template.json b/template.json index 519af9a..50e39d5 100644 --- a/template.json +++ b/template.json @@ -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": "" } diff --git a/templates/chat-generic-result.html b/templates/chat-generic-result.html index ac32aa4..366f0c5 100644 --- a/templates/chat-generic-result.html +++ b/templates/chat-generic-result.html @@ -1,12 +1,17 @@
+ {{#if actorImg}} {{alias}} + {{/if}}

{{alias}}


+ + {{#if img}}
{{name}}
+ {{/if}}
diff --git a/templates/item-armor-sheet.html b/templates/item-armor-sheet.html index fee2317..cdd43bd 100644 --- a/templates/item-armor-sheet.html +++ b/templates/item-armor-sheet.html @@ -18,8 +18,16 @@ {{/select}} +
  • - + +
  • +
  • +
  • diff --git a/templates/item-effect-sheet.html b/templates/item-effect-sheet.html index 5179845..cee1ab1 100644 --- a/templates/item-effect-sheet.html +++ b/templates/item-effect-sheet.html @@ -51,8 +51,6 @@
  • - {{#if (eq data.genre "positive")}} -
  • + {{#if (eq data.genre "positive")}} + +
  • @@ -75,14 +76,6 @@ {{else}} -
  • - -
  • -
  • diff --git a/templates/item-equipment-sheet.html b/templates/item-equipment-sheet.html index 97c1e1d..27bb7e0 100644 --- a/templates/item-equipment-sheet.html +++ b/templates/item-equipment-sheet.html @@ -13,7 +13,7 @@