diff --git a/assets/fonts/PragRoman.ttf b/assets/fonts/PragRoman.ttf new file mode 100644 index 0000000..d229380 Binary files /dev/null and b/assets/fonts/PragRoman.ttf differ diff --git a/assets/fonts/PragRoman.woff2 b/assets/fonts/PragRoman.woff2 new file mode 100644 index 0000000..e935647 Binary files /dev/null and b/assets/fonts/PragRoman.woff2 differ diff --git a/assets/icons/R.svg b/assets/icons/R.svg new file mode 100644 index 0000000..4bfad63 --- /dev/null +++ b/assets/icons/R.svg @@ -0,0 +1,68 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/assets/icons/vec-alldice-jp.svg b/assets/icons/vec-alldice-jp.svg new file mode 100644 index 0000000..0fec769 --- /dev/null +++ b/assets/icons/vec-alldice-jp.svg @@ -0,0 +1,354 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + D4 + + + + + + + + + + D8 + + + + + + + D6 + + + + + + + + + + + + D10 + + + + + + + + + + + + + D12 + + + + + + + + + + + + D20 + + + + + + 1 + + + + + + 2 + + + + + + 3 + + + + + + 14 + + + + + + 15 + + + + + + 16 + + + + + + 17 + + + + + + 18 + + + + + + 19 + + + + + + 20 + + + + + + 4 + + + + + + 5 + + + + + + 6 + + + + + + 7 + + + + + + 8 + + + + + + 9 + + + + + + 10 + + + + + + 11 + + + + + + 12 + + + + + + 13 + + + + + + 40 + + + + + + 50 + + + + + + 60 + + + + + + 70 + + + + + + 80 + + + + + + 90 + + + + + + 0 + + + + + + 00 + + + + + + 30 + + + + + + * + + + + + + X + + + + + + - + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 65e056a..0841fc8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,5 +1,5 @@ var gulp = require('gulp'); -var less = require('gulp.less'); +var less = require('gulp-less'); gulp.task('less', function (cb) { gulp @@ -15,4 +15,4 @@ gulp.task( gulp.watch('less/*.less', gulp.series('less')); cb(); }) -); \ No newline at end of file +); diff --git a/less/actor-sheet/actor-sheet-skillcat.less b/less/actor-sheet/actor-sheet-skillcat.less index c3794e6..da74fd4 100644 --- a/less/actor-sheet/actor-sheet-skillcat.less +++ b/less/actor-sheet/actor-sheet-skillcat.less @@ -12,7 +12,7 @@ padding-bottom: 3px; display: flex; justify-content: flex-end; - flex-direction: column; + //flex-direction: column; justify-content: center; } @@ -37,7 +37,7 @@ padding-bottom: 3px; display: flex; justify-content: flex-end; - flex-direction: column; + //flex-direction: column; justify-content: center; background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); } diff --git a/less/actor-sheet/actor-sheet.less b/less/actor-sheet/actor-sheet.less index 9d410ba..2bcddf4 100644 --- a/less/actor-sheet/actor-sheet.less +++ b/less/actor-sheet/actor-sheet.less @@ -4,6 +4,13 @@ display: flex; } + +.rm-heading { + font-size: 1.0em; + font-family: PragRoman; + border-bottom: 0px; +} + // Header CSS .actor-icon { diff --git a/less/icons/R.svg b/less/icons/R.svg new file mode 100644 index 0000000..4bfad63 --- /dev/null +++ b/less/icons/R.svg @@ -0,0 +1,68 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/less/icons/vec-alldice-jp.svg b/less/icons/vec-alldice-jp.svg new file mode 100644 index 0000000..0fec769 --- /dev/null +++ b/less/icons/vec-alldice-jp.svg @@ -0,0 +1,354 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + D4 + + + + + + + + + + D8 + + + + + + + D6 + + + + + + + + + + + + D10 + + + + + + + + + + + + + D12 + + + + + + + + + + + + D20 + + + + + + 1 + + + + + + 2 + + + + + + 3 + + + + + + 14 + + + + + + 15 + + + + + + 16 + + + + + + 17 + + + + + + 18 + + + + + + 19 + + + + + + 20 + + + + + + 4 + + + + + + 5 + + + + + + 6 + + + + + + 7 + + + + + + 8 + + + + + + 9 + + + + + + 10 + + + + + + 11 + + + + + + 12 + + + + + + 13 + + + + + + 40 + + + + + + 50 + + + + + + 60 + + + + + + 70 + + + + + + 80 + + + + + + 90 + + + + + + 0 + + + + + + 00 + + + + + + 30 + + + + + + * + + + + + + X + + + + + + - + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + + + + + + + + \ No newline at end of file diff --git a/less/rmss.less b/less/rmss.less index 93ac91f..1ad38b1 100644 --- a/less/rmss.less +++ b/less/rmss.less @@ -16,5 +16,9 @@ @import "./skillcat-sheet/skillcat-sheet.less"; @import "./skillcat-sheet/applicable-stats-grid.less"; +//Apps + +@import "./tools/dice-roller.less"; + // Generics @import "./item-sheet.less"; \ No newline at end of file diff --git a/less/skillcat-sheet/skillcat-sheet.less b/less/skillcat-sheet/skillcat-sheet.less index 48139e6..342fdff 100644 --- a/less/skillcat-sheet/skillcat-sheet.less +++ b/less/skillcat-sheet/skillcat-sheet.less @@ -1,3 +1,10 @@ +//.skillcat-icons { +// display: flex; +// justify-content: space-around; +// flex-direction: row; +// align-items: center; +//} + .skillcat-name, .skill-name, .item-name, .spell-name, .equipable-name { font-family: Signika, sans-serif; font-size: 12px; diff --git a/less/tools/dice-roller.less b/less/tools/dice-roller.less new file mode 100644 index 0000000..158cd22 --- /dev/null +++ b/less/tools/dice-roller.less @@ -0,0 +1,20 @@ +.dice-roller-options { + display: flex; + flex-direction: column; +} + +.dice-roller-item { + display: flex; + align-items: center; + margin:5px; +} + +.dice-roller-item div { + flex: 1; +} + +.roll-button-container { + display: flex; + flex-direction: column; + justify-content: flex-end; +} \ No newline at end of file diff --git a/module/controls.js b/module/controls.js new file mode 100644 index 0000000..311503d --- /dev/null +++ b/module/controls.js @@ -0,0 +1,26 @@ + +export function registerGetSceneControlButtonsHook() { + Hooks.on("getSceneControlButtons", getSceneControlButtons); +} + +function getSceneControlButtons(controls) { + if (canvas == null) { + return; + } + controls.push({ + name: "fvtt-rolemaster-frp", + title: "Rolemaster FRP System", + icon: "fas fa-r", + layer: "ControlsLayer", + tools: [ + { + name: "rmmsdiceroller", + title: "Dice Roller", + icon: "fas fa-dice", + onClick: () => { return new game.rmss.applications.RMSSToolsDiceRoller().render(true); }, + button: true + } + ], + activeTool: "rmmsdiceroller" + }); +} diff --git a/module/documents/actor.js b/module/documents/actor.js index 23e47d6..cb4edb8 100644 --- a/module/documents/actor.js +++ b/module/documents/actor.js @@ -27,6 +27,8 @@ export class RMSSActor extends Actor { _prepareCharacterData(actorData) { if (actorData.type !== "character") return; + this.calculateBasicStatBonus(actorData); + // Calculate Stat Bonuses for the Actor this.calculateStatBonuses(actorData); @@ -51,6 +53,56 @@ export class RMSSActor extends Actor { const data = actorData.data; } + // This checks to see if you have a Rollable Table called "Basic Stat Bonus Table" and uses it to calculate the basic stat bonuses. + calculateBasicStatBonus(actorData) { + const systemData = actorData.system; + for (const table of game.tables) { + if (table.name === "Basic Stat Bonus Table") { + for (const result of table.results) { + if (actorData.system.stats.agility.temp >= Number(result.range[0]) && actorData.system.stats.agility.basic_bonus <= Number(result.range[1])) { + actorData.system.stats.agility.basic_bonus = parseInt(result.text, 10); + } + + if (actorData.system.stats.constitution.temp >= Number(result.range[0]) && actorData.system.stats.constitution.basic_bonus <= Number(result.range[1])) { + actorData.system.stats.constitution.basic_bonus = parseInt(result.text, 10); + } + + if (actorData.system.stats.memory.temp >= Number(result.range[0]) && actorData.system.stats.memory.basic_bonus <= Number(result.range[1])) { + actorData.system.stats.memory.basic_bonus = parseInt(result.text, 10); + } + + if (actorData.system.stats.reasoning.temp >= Number(result.range[0]) && actorData.system.stats.reasoning.basic_bonus <= Number(result.range[1])) { + actorData.system.stats.reasoning.basic_bonus = parseInt(result.text, 10); + } + + if (actorData.system.stats.self_discipline.temp >= Number(result.range[0]) && actorData.system.stats.self_discipline.basic_bonus <= Number(result.range[1])) { + actorData.system.stats.self_discipline.basic_bonus = parseInt(result.text, 10); + } + + if (actorData.system.stats.empathy.temp >= Number(result.range[0]) && actorData.system.stats.empathy.basic_bonus <= Number(result.range[1])) { + actorData.system.stats.empathy.basic_bonus = parseInt(result.text, 10); + } + + if (actorData.system.stats.intuition.temp >= Number(result.range[0]) && actorData.system.stats.intuition.basic_bonus <= Number(result.range[1])) { + actorData.system.stats.intuition.basic_bonus = parseInt(result.text, 10); + } + + if (actorData.system.stats.presence.temp >= Number(result.range[0]) && actorData.system.stats.presence.basic_bonus <= Number(result.range[1])) { + actorData.system.stats.presence.basic_bonus = parseInt(result.text, 10); + } + + if (actorData.system.stats.quickness.temp >= Number(result.range[0]) && actorData.system.stats.quickness.basic_bonus <= Number(result.range[1])) { + actorData.system.stats.quickness.basic_bonus = parseInt(result.text, 10); + } + + if (actorData.system.stats.strength.temp >= Number(result.range[0]) && actorData.system.stats.strength.basic_bonus <= Number(result.range[1])) { + actorData.system.stats.strength.basic_bonus = parseInt(result.text, 10); + } + } + } + } + } + // Tally each stat bonus and populate the total field. calculateStatBonuses(actorData) { const systemData = actorData.system; diff --git a/module/documents/item.js b/module/documents/item.js index 7f88db9..18ef11e 100644 --- a/module/documents/item.js +++ b/module/documents/item.js @@ -105,12 +105,14 @@ export class RMSSItem extends Item { } else { - const items = this.parent.items; + const items = this.parent?.items; console.log(`rmss | item.js | Skill ${this.name} has owner, calculating skill category bonus.`); - for (const item of items) { - if (item.type === "skill_category" && item._id === itemData.system.category) { - console.log(`rmss | item.js | Calculating Skill Category bonus for skill: ${this.name}`); - this.system.category_bonus = item.system.total_bonus; + if (items) { + for (const item of items) { + if (item.type === "skill_category" && item._id === itemData.system.category) { + console.log(`rmss | item.js | Calculating Skill Category bonus for skill: ${this.name}`); + this.system.category_bonus = item.system.total_bonus; + } } } } diff --git a/module/sheets/actors/rmss_player_sheet.js b/module/sheets/actors/rmss_player_sheet.js index f562780..a3c2434 100644 --- a/module/sheets/actors/rmss_player_sheet.js +++ b/module/sheets/actors/rmss_player_sheet.js @@ -202,7 +202,7 @@ export default class RMSSPlayerSheet extends ActorSheet { async renderCharacterSettings(data) { console.log(data); - const configSheet = await renderTemplate("systems/fvtt-rolemaster-frp/templates/sheets/actors/dialogs/actor-settings.html", data); + const configSheet = await renderTemplate("systems/fvtt-rolemaster-frp/templates/sheets/actors/dialogs/app_skill_category_importer.html", data); return (configSheet); } @@ -215,6 +215,11 @@ export default class RMSSPlayerSheet extends ActorSheet { item.sheet.render(true); }); + html.find(".item-roll").click(ev => { + const item = this.actor.items.get(ev.currentTarget.getAttribute("data-item-id")); + new game.rmss.applications.RMSSToolsDiceRoller(item.name, item.system.total_bonus).render(true); + }); + // ------------------------------------------------------------- // Everything below here is only needed if the sheet is editable if (!this.isEditable) return; @@ -229,15 +234,14 @@ export default class RMSSPlayerSheet extends ActorSheet { item.delete(); }); - // Show Sheet Settings + // Show Skill Category Importer html.find(".import-skillcats").click(async ev => { let selectOptions = {}; for (const pack of game.packs) { selectOptions[pack.metadata.id] = pack.metadata.label; } - - new game.rmss.applications.RMSSActorSheetConfig(selectOptions, this.actor).render(true); + new game.rmss.applications.RMSSToolsSCImporter(selectOptions, this.actor).render(true); }); // Check/Uncheck Favorite Skill diff --git a/module/sheets/apps/rmss_dice_roller.js b/module/sheets/apps/rmss_dice_roller.js new file mode 100644 index 0000000..0aebc1a --- /dev/null +++ b/module/sheets/apps/rmss_dice_roller.js @@ -0,0 +1,85 @@ +import { + roll_one_to_onehundred, + roll_low_open_ended, + roll_high_open_ended, + roll_open_ended +} from "./rmss_dice_roller_rolls.js"; +import { + getOpenEndedRollModifier, + processOpenEndedSixtySixRoll, + processOpenEndedRoll, + processHighOpenEndedRoll, + processLowOpenEndedRoll +} from "./rmss_dice_roller_processing.js"; + +export default class RMSSToolsDiceRoller extends FormApplication { + constructor(itemName, characterBonus) { + super(); + this.itemName = itemName; + this.characterBonus = characterBonus; + this.rollType = [ + {value: "one_to_onehundred", text: "1-100", selected: false}, + {value: "open_ended", text: "Open-Ended", selected: true}, + {value: "high_open_ended", text: "High Open-Ended", selected: false}, + {value: "low_open_ended", text: "Low Open-Ended", selected: false} + ]; + } + + static get defaultOptions() { + return foundry.utils.mergeObject(super.defaultOptions, { + classes: ["form"], + title: "Rolemaster Dice Roller", + popOut: true, + width: 380, + height: 210, + template: "systems/fvtt-rolemaster-frp/templates/sheets/apps/app_dice_roller.html" + }); + } + + getData() { + // Send data to the template + return { + itemName: this.itemName, + characterBonus: this.characterBonus, + selectOptions: this.rollType, + }; + } + + activateListeners(html) { + super.activateListeners(html); + } + + async _updateObject(event, formData) { + console.log("Rolling Dice"); + console.log(formData); + console.log(event); + switch (formData.rollType) { + case "one_to_onehundred": + this.roll_one_to_onehundred(); + break; + case "open_ended": + this.roll_open_ended(); + break; + case "high_open_ended": + this.roll_high_open_ended(); + break; + case "low_open_ended": + this.roll_low_open_ended(); + break; + } + } +} + +RMSSToolsDiceRoller.prototype.roll_one_to_onehundred = roll_one_to_onehundred; +RMSSToolsDiceRoller.prototype.roll_low_open_ended = roll_low_open_ended; +RMSSToolsDiceRoller.prototype.roll_high_open_ended = roll_high_open_ended; +RMSSToolsDiceRoller.prototype.roll_open_ended = roll_open_ended; + +RMSSToolsDiceRoller.prototype.getOpenEndedRollModifier = + getOpenEndedRollModifier; +RMSSToolsDiceRoller.prototype.processOpenEndedSixtySixRoll = + processOpenEndedSixtySixRoll; +RMSSToolsDiceRoller.prototype.processOpenEndedRoll = processOpenEndedRoll; +RMSSToolsDiceRoller.prototype.processHighOpenEndedRoll = + processHighOpenEndedRoll; +RMSSToolsDiceRoller.prototype.processLowOpenEndedRoll = processLowOpenEndedRoll; diff --git a/module/sheets/apps/rmss_dice_roller_processing.js b/module/sheets/apps/rmss_dice_roller_processing.js new file mode 100644 index 0000000..e156454 --- /dev/null +++ b/module/sheets/apps/rmss_dice_roller_processing.js @@ -0,0 +1,131 @@ +export async function getOpenEndedRollModifier() { + return await new Roll("1d100x>95").roll(); +} + +export function processOpenEndedSixtySixRoll(baseroll, rolltype) { + // Log the Roll to Chat + let chatOptions = { + type: CONST.CHAT_MESSAGE_TYPES.ROLL, + rolls: [baseroll], + flavor: rolltype, + rollMode: game.settings.get("core", "rollMode"), + content: "You rolled a 66!", + }; + + ChatMessage.create(chatOptions); +} + +export function processOpenEndedRoll(baseroll, rolltype) { + // Define the Chat Message Template + let chatTemplate = "systems/fvtt-rolemaster-frp/templates/chat/chat_dice_roll.html"; + + // Pass the Data through to be used in the Chat Message + let chatData = { + baseroll: baseroll, + total: baseroll.result, + highopen: false, + lowopen: false, + }; + + // Render the Rolls to the Chat Window + renderTemplate(chatTemplate, chatData).then((html) => { + let chatOptions = { + type: CONST.CHAT_MESSAGE_TYPES.ROLL, + rolls: [baseroll], + flavor: rolltype, + rollMode: game.settings.get("core", "rollMode"), + content: html, + }; + + ChatMessage.create(chatOptions); + }); +} + +export async function processHighOpenEndedRoll(baseroll, rolltype) { + // Get the Base Roll followed by the High Open Ended Roll + let originalRoll = baseroll; + let openendedRoll = await this.getOpenEndedRollModifier(); + + // Create a rolls array for Dice So Nice integration. + let rolls = [originalRoll, openendedRoll]; + + // Create an Array to hold the High Open Ended Roll Results and set the total to base roll + let openendedResults = []; + let total = Number(originalRoll.result); + + // Each time the High Open Ended Roll is triggered add the result to an array and add it to the total. + for (const rollResult of openendedRoll.dice[0].results) { + openendedResults.push(rollResult.result); + total = total + Number(rollResult.result); + } + + // Define the Chat Message Template + let chatTemplate = "systems/fvtt-rolemaster-frp/templates/chat/chat_dice_roll.html"; + + // Pass the Data through to be used in the Chat Message + let chatData = { + baseroll: baseroll, + opeendedresults: [openendedResults], + highopen: true, + lowopen: false, + total: total, + }; + + // Render the Rolls to the Chat Window + renderTemplate(chatTemplate, chatData).then((html) => { + let chatOptions = { + style: CONST.CHAT_MESSAGE_STYLES.ROLL, + rolls: rolls, + flavor: rolltype, + rollMode: game.settings.get("core", "rollMode"), + content: html, + }; + + ChatMessage.create(chatOptions); + }); +} + +export async function processLowOpenEndedRoll(baseroll, rolltype) { + // Get the Base Roll followed by the Low Open Ended Roll + let originalRoll = baseroll; + let openendedRoll = await this.getOpenEndedRollModifier(); + + // Create a rolls array for Dice So Nice integration. + let rolls = [originalRoll, openendedRoll]; + + // Create an Array to hold the Low Open Ended Roll Results and set the total to base roll + let openendedResults = []; + let total = Number(originalRoll.result); + + // Each time the Low Open Ended Roll is triggered add the result to an array and subtract it from the total. + for (const rollResult of openendedRoll.dice[0].results) { + openendedResults.push(rollResult.result); + total = total - Number(rollResult.result); + } + + // Define the Chat Message Template + let chatTemplate = "systems/fvtt-rolemaster-frp/templates/chat/chat_dice_roll.html"; + + // Pass the Data through to be used in the Chat Message + let chatData = { + baseroll: baseroll, + rolls: rolls, + opeendedresults: [openendedResults], + highopen: false, + lowopen: true, + total: total, + }; + + // Render the Rolls to the Chat Window + renderTemplate(chatTemplate, chatData).then((html) => { + let chatOptions = { + style: CONST.CHAT_MESSAGE_STYLES.ROLL, + rolls: rolls, + flavor: rolltype, + rollMode: game.settings.get("core", "rollMode"), + content: html, + }; + + ChatMessage.create(chatOptions); + }); +} diff --git a/module/sheets/apps/rmss_dice_roller_rolls.js b/module/sheets/apps/rmss_dice_roller_rolls.js new file mode 100644 index 0000000..21bff32 --- /dev/null +++ b/module/sheets/apps/rmss_dice_roller_rolls.js @@ -0,0 +1,71 @@ +export async function roll_one_to_onehundred() { + // Construct the Roll instance + let baseroll = await new Roll("1d100 + @characterBonus", {characterBonus: this.characterBonus}).roll({async: true}); + let rolltype = "Roll Type: 1-100"; + + // Log the Roll to Chat + let chatOptions = { + type: CONST.CHAT_MESSAGE_TYPES.ROLL, + rolls: [baseroll], + flavor: rolltype, + rollMode: game.settings.get("core", "rollMode") + }; + + ChatMessage.create(chatOptions); + this.close(); +}; + +export async function roll_low_open_ended() { + // Construct the Roll instance + let baseroll = await new Roll("1d100").roll({async: true}); + console.log(baseroll.result); + let rolltype = "Roll Type: Low Open-Ended"; + + switch (true) { + case (baseroll.result < 6): + this.processLowOpenEndedRoll(baseroll, rolltype); + break; + case (baseroll.result === 66): + this.processOpenEndedSixtySixRoll(baseroll, rolltype); + break; + default: + this.processOpenEndedRoll(baseroll, rolltype); + } +} + +export async function roll_high_open_ended() { + // Construct the Roll instance + let baseroll = await new Roll("1d100").roll({async: true}); + console.log(baseroll.result); + let rolltype = "Roll Type: High Open-Ended"; + switch (true) { + case (baseroll.result === 66): + this.processOpenEndedSixtySixRoll(baseroll, rolltype); + break; + case (baseroll.result > 95): + this.processHighOpenEndedRoll(baseroll, rolltype); + break; + default: + this.processOpenEndedRoll(baseroll, rolltype); + } +} + +export async function roll_open_ended() { + // Construct the Roll instance + let baseroll = await new Roll("1d100").roll({async: true}); + console.log(baseroll.result); + let rolltype = "Roll Type: Open-Ended"; + switch (true) { + case (baseroll.result < 6): + this.processLowOpenEndedRoll(baseroll, rolltype); + break; + case (baseroll.result === 66): + this.processOpenEndedSixtySixRoll(baseroll, rolltype); + break; + case (baseroll.result > 95): + this.processHighOpenEndedRoll(baseroll, rolltype); + break; + default: + this.processOpenEndedRoll(baseroll, rolltype); + } +} diff --git a/module/sheets/apps/rmss_import_skill_categories.js b/module/sheets/apps/rmss_import_skill_categories.js new file mode 100644 index 0000000..da85e50 --- /dev/null +++ b/module/sheets/apps/rmss_import_skill_categories.js @@ -0,0 +1,56 @@ +export default class RMSSToolsSCImporter extends FormApplication { + + constructor(selectOptions, character) { + super(); + this.selectOptions = selectOptions; + this.character = character; + } + + static get defaultOptions() { + return foundry.utils.mergeObject(super.defaultOptions, { + classes: ["form"], + popOut: true, + title: "Import Skill Categories", + template: "systems/fvtt-rolemaster-frp/templates/sheets/apps/app_skill_category_importer.html" + }); + } + + getData() { + // Send data to the template + return { + selectOptions: this.selectOptions + }; + } + + activateListeners(html) { + super.activateListeners(html); + } + + async _updateObject(event, formData) { + console.log("Deleting Old Skill Categories."); + for (const item of this.character.items) { + if (item.type === "skill_category") { + item.delete(); + } + } + + const pack = game.packs.get(formData.selectOptions); + const skillCategoryData = await pack.getIndex(); + + console.log("Importing New Skill Categories."); + + for (const sc of skillCategoryData) { + const newitem = await pack.getDocument(sc._id); + + let newDocuments = []; + if (newitem.type === "skill_category") { + console.log(newitem); + newDocuments.push(newitem); + } + if (newDocuments.length > 0) { + await Item.createDocuments(newDocuments, {parent: this.character}); + } + } + } +} + diff --git a/packs/skill_categories/000004.log b/packs/skill_categories/000008.log similarity index 100% rename from packs/skill_categories/000004.log rename to packs/skill_categories/000008.log diff --git a/packs/skill_categories/CURRENT b/packs/skill_categories/CURRENT index 1a84852..f7753e2 100644 --- a/packs/skill_categories/CURRENT +++ b/packs/skill_categories/CURRENT @@ -1 +1 @@ -MANIFEST-000002 +MANIFEST-000006 diff --git a/packs/skill_categories/LOG b/packs/skill_categories/LOG index 7f95692..07bacba 100644 --- a/packs/skill_categories/LOG +++ b/packs/skill_categories/LOG @@ -1,5 +1,8 @@ -2024/07/26-09:38:09.968297 7f70fa0006c0 Delete type=3 #1 -2024/07/26-09:40:38.576572 7f70f3e006c0 Level-0 table #5: started -2024/07/26-09:40:38.595934 7f70f3e006c0 Level-0 table #5: 24247 bytes OK -2024/07/26-09:40:38.633153 7f70f3e006c0 Delete type=0 #3 -2024/07/26-09:40:38.675601 7f70f3e006c0 Manual compaction at level-0 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) +2024/07/26-13:01:33.184951 7f70fa0006c0 Recovering log #4 +2024/07/26-13:01:33.276590 7f70fa0006c0 Delete type=0 #4 +2024/07/26-13:01:33.276711 7f70fa0006c0 Delete type=3 #2 +2024/07/26-14:15:40.712242 7f70f3e006c0 Level-0 table #9: started +2024/07/26-14:15:40.712297 7f70f3e006c0 Level-0 table #9: 0 bytes OK +2024/07/26-14:15:40.750893 7f70f3e006c0 Delete type=0 #7 +2024/07/26-14:15:40.806643 7f70f3e006c0 Manual compaction at level-0 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) +2024/07/26-14:15:40.863267 7f70f3e006c0 Manual compaction at level-1 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) diff --git a/packs/skill_categories/LOG.old b/packs/skill_categories/LOG.old new file mode 100644 index 0000000..7f95692 --- /dev/null +++ b/packs/skill_categories/LOG.old @@ -0,0 +1,5 @@ +2024/07/26-09:38:09.968297 7f70fa0006c0 Delete type=3 #1 +2024/07/26-09:40:38.576572 7f70f3e006c0 Level-0 table #5: started +2024/07/26-09:40:38.595934 7f70f3e006c0 Level-0 table #5: 24247 bytes OK +2024/07/26-09:40:38.633153 7f70f3e006c0 Delete type=0 #3 +2024/07/26-09:40:38.675601 7f70f3e006c0 Manual compaction at level-0 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) diff --git a/packs/skill_categories/MANIFEST-000002 b/packs/skill_categories/MANIFEST-000002 deleted file mode 100644 index af87e5b..0000000 Binary files a/packs/skill_categories/MANIFEST-000002 and /dev/null differ diff --git a/packs/skill_categories/MANIFEST-000006 b/packs/skill_categories/MANIFEST-000006 new file mode 100644 index 0000000..f3664e9 Binary files /dev/null and b/packs/skill_categories/MANIFEST-000006 differ diff --git a/rmss.css b/rmss.css index 04c8b12..653de51 100644 --- a/rmss.css +++ b/rmss.css @@ -11,7 +11,6 @@ padding-bottom: 3px; display: flex; justify-content: flex-end; - flex-direction: column; justify-content: center; } .skillcat-grid-container > div:nth-child(24n+1), @@ -34,7 +33,6 @@ padding-bottom: 3px; display: flex; justify-content: flex-end; - flex-direction: column; justify-content: center; background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); } @@ -46,6 +44,11 @@ .container { display: flex; } +.rm-heading { + font-size: 1em; + font-family: PragRoman; + border-bottom: 0px; +} .actor-icon { flex-shrink: 1; } @@ -505,6 +508,23 @@ flex-direction: column; justify-content: center; } +.dice-roller-options { + display: flex; + flex-direction: column; +} +.dice-roller-item { + display: flex; + align-items: center; + margin: 5px; +} +.dice-roller-item div { + flex: 1; +} +.roll-button-container { + display: flex; + flex-direction: column; + justify-content: flex-end; +} .sheet form { display: flex; flex-direction: column; diff --git a/rmss.js b/rmss.js index 7f20a96..a279ab2 100644 --- a/rmss.js +++ b/rmss.js @@ -1,5 +1,6 @@ // Import Configuration Object import { rmss } from "./module/config.js"; +//import { registerGetSceneControlButtonsHook } from "./module/controls.js"; // Import document classes. import { RMSSActor } from "./module/documents/actor.js"; @@ -16,7 +17,8 @@ import RMSSSkillCategorySheet from "./module/sheets/skills/rmss_skill_category_s import RMSSSkillSheet from "./module/sheets/skills/rmss_skill_sheet.js"; import RMSSPlayerSheet from "./module/sheets/actors/rmss_player_sheet.js"; -import RMSSActorSheetConfig from "./module/sheets/actors/rmss_player_sheet_config.js"; +import RMSSToolsSCImporter from "./module/sheets/apps/rmss_import_skill_categories.js"; +import RMSSToolsDiceRoller from "./module/sheets/apps/rmss_dice_roller.js"; /** Preload handlebars templates for character sheets */ async function preloadHandlebarsTemplates() { @@ -41,11 +43,14 @@ async function preloadHandlebarsTemplates() { "systems/fvtt-rolemaster-frp/templates/sheets/actors/parts/actor-spells.html", "systems/fvtt-rolemaster-frp/templates/sheets/actors/parts/actor-fav-spells.html", "systems/fvtt-rolemaster-frp/templates/sheets/actors/parts/actor-fav-items.html", - "systems/fvtt-rolemaster-frp/templates/sheets/actors/apps/actor-settings.html" + "systems/fvtt-rolemaster-frp/templates/sheets/apps/app_skill_category_importer.html" ]; return loadTemplates(templatePaths); } +// Register Scene Controls +// registerGetSceneControlButtonsHook(); + // Hook the init function and set up our system Hooks.once("init", function() { console.log("rmss | Initialising Rolemaster Standard System"); @@ -56,7 +61,8 @@ Hooks.once("init", function() { RMSSActor, RMSSItem, applications: { - RMSSActorSheetConfig + RMSSToolsSCImporter, + RMSSToolsDiceRoller } }; @@ -64,6 +70,14 @@ Hooks.once("init", function() { CONFIG.Actor.documentClass = RMSSActor; CONFIG.Item.documentClass = RMSSItem; + // Add PragRoman Font + CONFIG.fontDefinitions["PragRoman"] = { + editor: true, + fonts: [ + {urls: ["systems/fvtt-rolemaster-frp/assets/fonts/PragRoman.woff2"]} + ] + }; + // Make Config Data Available CONFIG.rmss = rmss; @@ -77,21 +91,21 @@ Hooks.once("init", function() { console.log("rmss | Registering RMSS sheets"); // Items - Items.registerSheet("rmss", RMSSItemSheet, {makeDefault: true, label: "rmss.entity_sheet.item", types: ["item"]}); - Items.registerSheet("rmss", RMSSArmorSheet, {makeDefault: true, label: "rmss.entity_sheet.armor", types: ["armor"]}); - Items.registerSheet("rmss", RMSSTransportSheet, {makeDefault: true, label: "rmss.entity_sheet.transport", types: ["transport"]}); - Items.registerSheet("rmss", RMSSWeaponSheet, {makeDefault: true, label: "rmss.entity_sheet.weapon", types: ["weapon"]}); - Items.registerSheet("rmss", RMSSHerbOrPoisonSheet, {makeDefault: true, label: "rmss.entity_sheet.herb_or_poison", types: ["herb_or_poison"]}); + Items.registerSheet("fvtt-rolemaster-frp", RMSSItemSheet, {makeDefault: true, label: "rmss.entity_sheet.item", types: ["item"]}); + Items.registerSheet("fvtt-rolemaster-frp", RMSSArmorSheet, {makeDefault: true, label: "rmss.entity_sheet.armor", types: ["armor"]}); + Items.registerSheet("fvtt-rolemaster-frp", RMSSTransportSheet, {makeDefault: true, label: "rmss.entity_sheet.transport", types: ["transport"]}); + Items.registerSheet("fvtt-rolemaster-frp", RMSSWeaponSheet, {makeDefault: true, label: "rmss.entity_sheet.weapon", types: ["weapon"]}); + Items.registerSheet("fvtt-rolemaster-frp", RMSSHerbOrPoisonSheet, {makeDefault: true, label: "rmss.entity_sheet.herb_or_poison", types: ["herb_or_poison"]}); // Spells - Items.registerSheet("rmss", RMSSSpellSheet, {makeDefault: true, label: "rmss.entity_sheet.spell", types: ["spell"]}); + Items.registerSheet("fvtt-rolemaster-frp", RMSSSpellSheet, {makeDefault: true, label: "rmss.entity_sheet.spell", types: ["spell"]}); // Skills - Items.registerSheet("rmss", RMSSSkillCategorySheet, {makeDefault: true, label: "rmss.entity_sheet.skill_category", types: ["skill_category"]}); - Items.registerSheet("rmss", RMSSSkillSheet, {makeDefault: true, label: "rmss.entity_sheet.skill", types: ["skill"]}); + Items.registerSheet("fvtt-rolemaster-frp", RMSSSkillCategorySheet, {makeDefault: true, label: "rmss.entity_sheet.skill_category", types: ["skill_category"]}); + Items.registerSheet("fvtt-rolemaster-frp", RMSSSkillSheet, {makeDefault: true, label: "rmss.entity_sheet.skill", types: ["skill"]}); // Actors - Actors.registerSheet("rmss", RMSSPlayerSheet, {makeDefault: true, label: "rmss.entity_sheet.player_characrer", types: ["character"]}); + Actors.registerSheet("fvtt-rolemaster-frp", RMSSPlayerSheet, {makeDefault: true, label: "rmss.entity_sheet.player_characrer", types: ["character"]}); // Preload Handlebars Templates console.log("rmss | Preloading Handlebars Templates"); diff --git a/templates/chat/chat_dice_roll.html b/templates/chat/chat_dice_roll.html new file mode 100644 index 0000000..64a5896 --- /dev/null +++ b/templates/chat/chat_dice_roll.html @@ -0,0 +1,28 @@ +
+
+ Original Roll: +

{{ baseroll.result }}

+
+ {{#if highopen }} +
+ Rolled over 95 - High Open-Ended! + {{#each opeendedresults as |rollresult|}} +

{{ rollresult }}

+ {{/each}} +
+ {{/if}} + + {{#if lowopen }} +
+ Rolled under 6 - Low Open-Ended! + {{#each opeendedresults as |rollresult|}} +

{{ rollresult }}

+ {{/each}} +
+ {{/if}} + +
+ Total: +

{{ total }}

+
+
\ No newline at end of file diff --git a/templates/sheets/actors/parts/actor-skill-categories.html b/templates/sheets/actors/parts/actor-skill-categories.html index 50f7b77..f971ad1 100644 --- a/templates/sheets/actors/parts/actor-skill-categories.html +++ b/templates/sheets/actors/parts/actor-skill-categories.html @@ -34,9 +34,10 @@
{{skill_category.system.special_bonus_1}}
{{skill_category.system.special_bonus_2}}
{{skill_category.system.total_bonus}}
-
+
+
{{/each}}
\ No newline at end of file diff --git a/templates/sheets/apps/app_dice_roller.html b/templates/sheets/apps/app_dice_roller.html new file mode 100644 index 0000000..e3dd5d4 --- /dev/null +++ b/templates/sheets/apps/app_dice_roller.html @@ -0,0 +1,27 @@ +
+
+
+
+
Rolling for:
{{itemName}}
+
+
+
Character Bonus:
{{characterBonus}}
+
+
+
Misc Bonus:
+
+
+
Select Roll Type:
+
+ +
+
+
+ +
+
+ \ No newline at end of file diff --git a/templates/sheets/apps/app_skill_category_importer.html b/templates/sheets/apps/app_skill_category_importer.html new file mode 100644 index 0000000..d6187d1 --- /dev/null +++ b/templates/sheets/apps/app_skill_category_importer.html @@ -0,0 +1,17 @@ +
+
+

Import Skill Categories

+
+ WARNING: This will erase your existing Skill Categories and import all Skill Categories from the selected Compendium. +
+
+ Select Compendium: +
+
+ +
+ +
+
\ No newline at end of file