diff --git a/module/config.js b/module/config.js index 7b3aa51..50c6479 100644 --- a/module/config.js +++ b/module/config.js @@ -147,3 +147,11 @@ rmfrp.armor_values = { "19": "19", "20": "20" } + +rmfrp.keyToCriticalTable ={ + K: "krush", + P: "puncture", + S: "slash", + U: "unbalance", + G: "grapple" +} \ No newline at end of file diff --git a/module/rmfrp-process-table.js b/module/rmfrp-process-table.js index 6942f6d..1302f6f 100644 --- a/module/rmfrp-process-table.js +++ b/module/rmfrp-process-table.js @@ -183,19 +183,24 @@ export class RMFRPProcessTable { } let roll = new Roll("1d100") await roll.evaluate() + await RMFRPUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode")) let score = roll.total console.log("Critical Roll: ", score) // Search the result for (let criticalDef of table.criticals) { if (Number(criticalDef.score) ) { if (Number(criticalDef.score) == score) { - return criticalDef.levels[criticalKey.toUpperCase()] + let critDef = foundry.utils.duplicate(criticalDef.levels[criticalKey.toUpperCase()]) + critDef.diceResult = score + return critDef } } else { // Score is XX-YY so split it to get the range values let range = criticalDef.score.split("-") if (Number(range[0]) <= score && score <= Number(range[1])) { - return criticalDef.levels[criticalKey.toUpperCase()] + let critDef = foundry.utils.duplicate(criticalDef.levels[criticalKey.toUpperCase()]) + critDef.diceResult = score + return critDef } } } diff --git a/module/rmfrp-utility.js b/module/rmfrp-utility.js index 46dc6e9..cbd93d0 100644 --- a/module/rmfrp-utility.js +++ b/module/rmfrp-utility.js @@ -6,9 +6,9 @@ export class RMFRPUtility { static async init() { } - static capitalizeFirstLetters(str){ + static capitalizeFirstLetters(str) { return str.toLowerCase().replace(/^\w|\s\w/g, function (letter) { - return letter.toUpperCase(); + return letter.toUpperCase(); }) } @@ -19,7 +19,7 @@ export class RMFRPUtility { this.gameSystem = game.settings.get("fvtt-rolemaster-frp", "game_system"); const skillCategories = await RMFRPUtility.loadCompendium("fvtt-rolemaster-frp.skill_categories") - this.skillCategories = skillCategories.map(i => i.toObject()).filter( i => i.system.game_system == "common" || i.system.game_system == this.gameSystem); + this.skillCategories = skillCategories.map(i => i.toObject()).filter(i => i.system.game_system == "common" || i.system.game_system == this.gameSystem); // Sort skill categories by name this.skillCategories.sort((a, b) => a.name.localeCompare(b.name)); } @@ -27,7 +27,7 @@ export class RMFRPUtility { static getGameSystem() { return this.gameSystem; } - + /* -------------------------------------------- */ static getSkillCategories() { return this.skillCategories @@ -47,9 +47,35 @@ export class RMFRPUtility { rmfrp: "Rolemaster Fantasy Role Playing (RMFRP)", merp: "Middle Earth Role Playing (MERP)" } - }); + }); } + + /* -------------------------------------------- */ + static async showDiceSoNice(roll, rollMode) { + if (game.modules.get("dice-so-nice")?.active) { + if (game.dice3d) { + let whisper = null; + let blind = false; + rollMode = rollMode ?? game.settings.get("core", "rollMode"); + switch (rollMode) { + case "blindroll": //GM only + blind = true; + case "gmroll": //GM + rolling player + whisper = this.getUsers(user => user.isGM); + break; + case "roll": //everybody + whisper = this.getUsers(user => user.active); + break; + case "selfroll": + whisper = [game.user.id]; + break; + } + await game.dice3d.showForRoll(roll, game.user, true, whisper, blind); + } + } + } + /* -------------------------------------------- */ static async loadCompendiumData(compendium) { const pack = game.packs.get(compendium); diff --git a/module/sheets/apps/rmfrp_dice_roller.js b/module/sheets/apps/rmfrp_dice_roller.js index cb873d5..c2dbc5f 100644 --- a/module/sheets/apps/rmfrp_dice_roller.js +++ b/module/sheets/apps/rmfrp_dice_roller.js @@ -1,3 +1,4 @@ +import { RMFRPUtility } from "../../rmfrp-utility.js"; export default class RMFRPToolsDiceRoller extends FormApplication { @@ -72,34 +73,14 @@ export default class RMFRPToolsDiceRoller extends FormApplication { } /* -------------------------------------------- */ - async showDiceSoNice(roll, rollMode) { - if (game.modules.get("dice-so-nice")?.active) { - if (game.dice3d) { - let whisper = null; - let blind = false; - rollMode = rollMode ?? game.settings.get("core", "rollMode"); - switch (rollMode) { - case "blindroll": //GM only - blind = true; - case "gmroll": //GM + rolling player - whisper = this.getUsers(user => user.isGM); - break; - case "roll": //everybody - whisper = this.getUsers(user => user.active); - break; - case "selfroll": - whisper = [game.user.id]; - break; - } - await game.dice3d.showForRoll(roll, game.user, true, whisper, blind); - } - } + getWeaponCriticalTableName( key) { + return CONFIG.rmfrp.keyToCriticalTable[key.toUpperCase()] } /* -------------------------------------------- */ async roll(rollKey, formData) { let baseRoll = await new Roll("1d100").roll(); - await this.showDiceSoNice(baseRoll, game.settings.get("core", "rollMode")) + await RMFRPUtility.showDiceSoNice(baseRoll, game.settings.get("core", "rollMode")) let rollType = this.rollType.find(r => r.value == rollKey)?.text; let rollData = { name: this.itemName, @@ -126,11 +107,11 @@ export default class RMFRPToolsDiceRoller extends FormApplication { if (baseRoll.result < 6) { rollData.lowopen = true let newRoll = await new Roll("-1d100").roll(); - await this.showDiceSoNice(newRoll, game.settings.get("core", "rollMode")) + await RMFRPUtility.showDiceSoNice(newRoll, game.settings.get("core", "rollMode")) rollData.rolls.push(newRoll); while (newRoll.result > 95) { newRoll = await new Roll("-1d100").roll(); - await this.showDiceSoNice(newRoll, game.settings.get("core", "rollMode")) + await RMFRPUtility.showDiceSoNice(newRoll, game.settings.get("core", "rollMode")) rollData.rolls.push(newRoll); } } @@ -140,11 +121,11 @@ export default class RMFRPToolsDiceRoller extends FormApplication { if (baseRoll.result > 95) { rollData.highopen = true let newRoll = await new Roll("1d100").roll(); - await this.showDiceSoNice(newRoll, game.settings.get("core", "rollMode")) + await RMFRPUtility.showDiceSoNice(newRoll, game.settings.get("core", "rollMode")) rollData.rolls.push(newRoll); while (newRoll.result > 95) { newRoll = await new Roll("1d100").roll(); - await this.showDiceSoNice(newRoll, game.settings.get("core", "rollMode")) + await RMFRPUtility.showDiceSoNice(newRoll, game.settings.get("core", "rollMode")) rollData.rolls.push(newRoll); } } @@ -181,17 +162,19 @@ export default class RMFRPToolsDiceRoller extends FormApplication { rollData.attackResult = attackResult; // Is it a a critical ? let critical = attackResult.match(/(\d+)(\w)?(\w)?/); - if (critical && critical[2]) { + if (critical && critical[2] && critical[3]) { if ( critical[2] === "F") { hasFumble = true } else { - let criticalTable = this.weapon.system.critical_table + let criticalTable = this.getWeaponCriticalTableName(critical[3]) + //let criticalTable = this.weapon.system.critical_table if ( !criticalTable ) { ui.notifications.error("Critical table not found for weapon: " + this.weapon.name); return } let criticalResult = await game.rmfrp.attackTables.getCriticalResult(criticalTable, critical[2]); rollData.criticalResult = criticalResult; + rollData.criticalTable = criticalTable; console.log("Critical Result: ", criticalResult); } } diff --git a/packs/skill_categories/000210.log b/packs/skill_categories/000214.log similarity index 100% rename from packs/skill_categories/000210.log rename to packs/skill_categories/000214.log diff --git a/packs/skill_categories/CURRENT b/packs/skill_categories/CURRENT index 704e06e..7d5a51c 100644 --- a/packs/skill_categories/CURRENT +++ b/packs/skill_categories/CURRENT @@ -1 +1 @@ -MANIFEST-000208 +MANIFEST-000212 diff --git a/packs/skill_categories/LOG b/packs/skill_categories/LOG index 54d5b15..d7260f4 100644 --- a/packs/skill_categories/LOG +++ b/packs/skill_categories/LOG @@ -1,8 +1,8 @@ -2025/01/18-18:15:46.177424 7f3b919fa6c0 Recovering log #206 -2025/01/18-18:15:46.187462 7f3b919fa6c0 Delete type=3 #204 -2025/01/18-18:15:46.187523 7f3b919fa6c0 Delete type=0 #206 -2025/01/18-18:19:43.034876 7f3b8b3ff6c0 Level-0 table #211: started -2025/01/18-18:19:43.034902 7f3b8b3ff6c0 Level-0 table #211: 0 bytes OK -2025/01/18-18:19:43.041054 7f3b8b3ff6c0 Delete type=0 #209 -2025/01/18-18:19:43.041200 7f3b8b3ff6c0 Manual compaction at level-0 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) -2025/01/18-18:19:43.041231 7f3b8b3ff6c0 Manual compaction at level-1 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) +2025/02/09-17:59:02.058056 7f46ad7fa6c0 Recovering log #210 +2025/02/09-17:59:02.108672 7f46ad7fa6c0 Delete type=3 #208 +2025/02/09-17:59:02.108745 7f46ad7fa6c0 Delete type=0 #210 +2025/02/09-18:10:51.141649 7f46abbff6c0 Level-0 table #215: started +2025/02/09-18:10:51.141686 7f46abbff6c0 Level-0 table #215: 0 bytes OK +2025/02/09-18:10:51.147603 7f46abbff6c0 Delete type=0 #213 +2025/02/09-18:10:51.166026 7f46abbff6c0 Manual compaction at level-0 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) +2025/02/09-18:10:51.166064 7f46abbff6c0 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 index c1bc075..54d5b15 100644 --- a/packs/skill_categories/LOG.old +++ b/packs/skill_categories/LOG.old @@ -1,8 +1,8 @@ -2025/01/18-15:51:04.184298 7f3b911f96c0 Recovering log #202 -2025/01/18-15:51:04.200991 7f3b911f96c0 Delete type=3 #200 -2025/01/18-15:51:04.201070 7f3b911f96c0 Delete type=0 #202 -2025/01/18-18:14:32.987104 7f3b8b3ff6c0 Level-0 table #207: started -2025/01/18-18:14:32.987144 7f3b8b3ff6c0 Level-0 table #207: 0 bytes OK -2025/01/18-18:14:32.993171 7f3b8b3ff6c0 Delete type=0 #205 -2025/01/18-18:14:33.006820 7f3b8b3ff6c0 Manual compaction at level-0 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) -2025/01/18-18:14:33.006858 7f3b8b3ff6c0 Manual compaction at level-1 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) +2025/01/18-18:15:46.177424 7f3b919fa6c0 Recovering log #206 +2025/01/18-18:15:46.187462 7f3b919fa6c0 Delete type=3 #204 +2025/01/18-18:15:46.187523 7f3b919fa6c0 Delete type=0 #206 +2025/01/18-18:19:43.034876 7f3b8b3ff6c0 Level-0 table #211: started +2025/01/18-18:19:43.034902 7f3b8b3ff6c0 Level-0 table #211: 0 bytes OK +2025/01/18-18:19:43.041054 7f3b8b3ff6c0 Delete type=0 #209 +2025/01/18-18:19:43.041200 7f3b8b3ff6c0 Manual compaction at level-0 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) +2025/01/18-18:19:43.041231 7f3b8b3ff6c0 Manual compaction at level-1 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end) diff --git a/packs/skill_categories/MANIFEST-000208 b/packs/skill_categories/MANIFEST-000212 similarity index 72% rename from packs/skill_categories/MANIFEST-000208 rename to packs/skill_categories/MANIFEST-000212 index 6a26583..4ed4519 100644 Binary files a/packs/skill_categories/MANIFEST-000208 and b/packs/skill_categories/MANIFEST-000212 differ diff --git a/packs/skills/000116.log b/packs/skills/000120.log similarity index 100% rename from packs/skills/000116.log rename to packs/skills/000120.log diff --git a/packs/skills/CURRENT b/packs/skills/CURRENT index 3182b19..7530019 100644 --- a/packs/skills/CURRENT +++ b/packs/skills/CURRENT @@ -1 +1 @@ -MANIFEST-000114 +MANIFEST-000118 diff --git a/packs/skills/LOG b/packs/skills/LOG index b2590e7..5b203c6 100644 --- a/packs/skills/LOG +++ b/packs/skills/LOG @@ -1,8 +1,8 @@ -2025/01/18-18:15:46.190110 7f3b909f86c0 Recovering log #112 -2025/01/18-18:15:46.200873 7f3b909f86c0 Delete type=3 #110 -2025/01/18-18:15:46.200953 7f3b909f86c0 Delete type=0 #112 -2025/01/18-18:19:43.027077 7f3b8b3ff6c0 Level-0 table #117: started -2025/01/18-18:19:43.027109 7f3b8b3ff6c0 Level-0 table #117: 0 bytes OK -2025/01/18-18:19:43.034763 7f3b8b3ff6c0 Delete type=0 #115 -2025/01/18-18:19:43.041192 7f3b8b3ff6c0 Manual compaction at level-0 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end) -2025/01/18-18:19:43.041225 7f3b8b3ff6c0 Manual compaction at level-1 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end) +2025/02/09-17:59:02.113663 7f46ac7f86c0 Recovering log #116 +2025/02/09-17:59:02.167668 7f46ac7f86c0 Delete type=3 #114 +2025/02/09-17:59:02.167740 7f46ac7f86c0 Delete type=0 #116 +2025/02/09-18:10:51.159538 7f46abbff6c0 Level-0 table #121: started +2025/02/09-18:10:51.159574 7f46abbff6c0 Level-0 table #121: 0 bytes OK +2025/02/09-18:10:51.165836 7f46abbff6c0 Delete type=0 #119 +2025/02/09-18:10:51.166053 7f46abbff6c0 Manual compaction at level-0 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end) +2025/02/09-18:10:51.178042 7f46abbff6c0 Manual compaction at level-1 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end) diff --git a/packs/skills/LOG.old b/packs/skills/LOG.old index 0cb3859..b2590e7 100644 --- a/packs/skills/LOG.old +++ b/packs/skills/LOG.old @@ -1,8 +1,8 @@ -2025/01/18-15:51:04.203957 7f3b919fa6c0 Recovering log #108 -2025/01/18-15:51:04.219103 7f3b919fa6c0 Delete type=3 #106 -2025/01/18-15:51:04.219174 7f3b919fa6c0 Delete type=0 #108 -2025/01/18-18:14:33.000727 7f3b8b3ff6c0 Level-0 table #113: started -2025/01/18-18:14:33.000756 7f3b8b3ff6c0 Level-0 table #113: 0 bytes OK -2025/01/18-18:14:33.006724 7f3b8b3ff6c0 Delete type=0 #111 -2025/01/18-18:14:33.006839 7f3b8b3ff6c0 Manual compaction at level-0 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end) -2025/01/18-18:14:33.006865 7f3b8b3ff6c0 Manual compaction at level-1 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end) +2025/01/18-18:15:46.190110 7f3b909f86c0 Recovering log #112 +2025/01/18-18:15:46.200873 7f3b909f86c0 Delete type=3 #110 +2025/01/18-18:15:46.200953 7f3b909f86c0 Delete type=0 #112 +2025/01/18-18:19:43.027077 7f3b8b3ff6c0 Level-0 table #117: started +2025/01/18-18:19:43.027109 7f3b8b3ff6c0 Level-0 table #117: 0 bytes OK +2025/01/18-18:19:43.034763 7f3b8b3ff6c0 Delete type=0 #115 +2025/01/18-18:19:43.041192 7f3b8b3ff6c0 Manual compaction at level-0 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end) +2025/01/18-18:19:43.041225 7f3b8b3ff6c0 Manual compaction at level-1 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end) diff --git a/packs/skills/MANIFEST-000114 b/packs/skills/MANIFEST-000118 similarity index 73% rename from packs/skills/MANIFEST-000114 rename to packs/skills/MANIFEST-000118 index 897526d..afaef77 100644 Binary files a/packs/skills/MANIFEST-000114 and b/packs/skills/MANIFEST-000118 differ diff --git a/system.json b/system.json index 055c214..ac65065 100644 --- a/system.json +++ b/system.json @@ -3,7 +3,7 @@ "title": "Rolemaster FRP System", "description": "The Rolemaster FRP system for FoundryVTT.", "manifest": "https://www.uberwald.me/gitea/public/fvtt-rolemaster-frp/raw/branch/develop/system.json", - "download": "https://www.uberwald.me/gitea/public/fvtt-rolemaster-frp/archive/v12.0.18.zip", + "download": "https://www.uberwald.me/gitea/public/fvtt-rolemaster-frp/archive/v12.0.19.zip", "authors": [ { "name": "Cynicide", @@ -14,7 +14,7 @@ "email": "" } ], - "version": "12.0.18", + "version": "12.0.19", "compatibility": { "minimum": "12", "verified": "12" diff --git a/templates/chat/chat_dice_roll.html b/templates/chat/chat_dice_roll.html index 152d397..60d1f3a 100644 --- a/templates/chat/chat_dice_roll.html +++ b/templates/chat/chat_dice_roll.html @@ -89,6 +89,9 @@ {{/if}} {{#if criticalResult}} +
{{localize "rmfrp.weapon.range_modifier"}} |
---|