Import RMFRP tables + properly rename all files
This commit is contained in:
parent
fe36edfeff
commit
45ee08e6c2
@ -1,4 +1,4 @@
|
||||
import { RFRPUtility } from "../rfrp-utility.js";
|
||||
import { RMFRPUtility } from "../rmfrp-utility.js";
|
||||
|
||||
export class RMFRPItem extends Item {
|
||||
|
||||
@ -107,7 +107,7 @@ export class RMFRPItem extends Item {
|
||||
// Find the relevant skill category
|
||||
if (!this.parent) { return; } // Only if attached to an actor
|
||||
|
||||
let skillC = this.parent?.items || RFRPUtility.getSkillCategories();
|
||||
let skillC = this.parent?.items || RMFRPUtility.getSkillCategories();
|
||||
if (skillC) {
|
||||
let item = skillC.find(it => it.type == "skill_category" && it.name.toLowerCase() == itemData.system.category.toLowerCase());
|
||||
if (item) {
|
||||
|
50
module/rmfrp-process-table.js
Normal file
50
module/rmfrp-process-table.js
Normal file
@ -0,0 +1,50 @@
|
||||
export class RMFRPProcessTable {
|
||||
|
||||
constructor() {
|
||||
// Load a reference to the rmfrp-tables.json file
|
||||
this.rmfrpTables = require('./rmfrp-tables.json');
|
||||
// Loop thru the tables and create a definition object, with key, name and min/ax value of each table
|
||||
this.rmfrpTablesDef = {}
|
||||
for (let table in this.rmfrpTables) {
|
||||
let tableData = this.rmfrpTables[table]
|
||||
// Search min and max values in the tableData
|
||||
let min = Number.MAX_SAFE_INTEGER;
|
||||
let max = Number.MIN_SAFE_INTEGER;
|
||||
tableData.forEach((element) => {
|
||||
if (element.result) {
|
||||
if (Number(element.result)) {
|
||||
min = Math.min(min, Number(element.result));
|
||||
max = Math.max(max, Number(element.result));
|
||||
} else {
|
||||
let range = element.result.split("-");
|
||||
min = Math.min(min, Number(range[0]));
|
||||
max = Math.max(max, Number(range[1]));
|
||||
}
|
||||
}
|
||||
});
|
||||
this.rmfrpTablesDef[table] = {
|
||||
key: table,
|
||||
name: RMFRPUtility.capitalizeFirstLetters(table.replace(/_/g, " ")),
|
||||
min: min,
|
||||
max: max
|
||||
};
|
||||
}
|
||||
super();
|
||||
}
|
||||
|
||||
// Get roll result from table
|
||||
getAttackRollResult(table, roll, armorValue) {
|
||||
let result = this.rmfrpTables[table].find((element) => {
|
||||
if (Number(element.result) && Number(element.result) == Number(roll)) {
|
||||
return element[String(armorValue)];
|
||||
} else {
|
||||
// SPlit the result into a range
|
||||
let range = element.result.split("-");
|
||||
if (Number(roll) >= Number(range[0]) && Number(roll) <= Number(range[1])) {
|
||||
return element[String(armorValue)];
|
||||
}
|
||||
}
|
||||
});
|
||||
return undefined;
|
||||
}
|
||||
}
|
@ -1,11 +1,17 @@
|
||||
/* -------------------------------------------- */
|
||||
export class RFRPUtility {
|
||||
export class RMFRPUtility {
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async init() {
|
||||
}
|
||||
|
||||
static capitalizeFirstLetters(str){
|
||||
return str.toLowerCase().replace(/^\w|\s\w/g, function (letter) {
|
||||
return letter.toUpperCase();
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async ready() {
|
||||
this.registerSettings();
|
@ -1,4 +1,4 @@
|
||||
import { RFRPUtility } from "../../rfrp-utility.js";
|
||||
import { RMFRPUtility } from "../../rmfrp-utility.js";
|
||||
|
||||
export default class RMFRPToolsSCImporter extends FormApplication {
|
||||
|
||||
@ -50,7 +50,7 @@ export default class RMFRPToolsSCImporter extends FormApplication {
|
||||
|
||||
console.log("Importing New Skills/Skill Categories.");
|
||||
let newDocuments = [];
|
||||
let gameSystem = RFRPUtility.getGameSystem();
|
||||
let gameSystem = RMFRPUtility.getGameSystem();
|
||||
for (const sc of skillCategoryData) {
|
||||
const newitem = await pack.getDocument(sc._id);
|
||||
if (newitem.type === itemType && (newitem.system.game_system === "common" || newitem.system.game_system === gameSystem)) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { RFRPUtility } from "../../rfrp-utility.js";
|
||||
import { RMFRPUtility } from "../../rmfrp-utility.js";
|
||||
|
||||
// Our Item Sheet extends the default
|
||||
export default class RMFRPSkillSheet extends ItemSheet {
|
||||
@ -72,7 +72,7 @@ export default class RMFRPSkillSheet extends ItemSheet {
|
||||
// If this Skill is owned then we will return a list of Skill Categories and allow them to choose
|
||||
// Otherwise we'll just return 'Skill has no owner'
|
||||
prepareSkillCategoryValues() {
|
||||
let skillCategories = RFRPUtility.getSkillCategories();
|
||||
let skillCategories = RMFRPUtility.getSkillCategories();
|
||||
if (this.item.isEmbedded) {
|
||||
skillCategories = this.item.parent.items.filter(it => it.type == "skill_category");
|
||||
}
|
||||
@ -96,7 +96,7 @@ export default class RMFRPSkillSheet extends ItemSheet {
|
||||
// Iterate through the owned skill categories and if one of them matches the item id of currently
|
||||
// selected skill category then set the Skill Category Bonus field to the Total Bonus field of the Skill Category
|
||||
prepareSelectedSkillCategoryBonus(selected_skillcat) {
|
||||
let skillC = this.parent?.items || RFRPUtility.getSkillCategories();
|
||||
let skillC = this.parent?.items || RMFRPUtility.getSkillCategories();
|
||||
if (skillC) {
|
||||
let item = skillC.find(it => it.type == "skill_category" && it.name.toLowerCase() == itemData.system.category.toLowerCase());
|
||||
if (item) {
|
||||
|
@ -1 +1 @@
|
||||
MANIFEST-000146
|
||||
MANIFEST-000150
|
||||
|
@ -1,8 +1,3 @@
|
||||
2024/08/15-22:19:09.675609 7fdec34006c0 Recovering log #144
|
||||
2024/08/15-22:19:09.731573 7fdec34006c0 Delete type=3 #142
|
||||
2024/08/15-22:19:09.731716 7fdec34006c0 Delete type=0 #144
|
||||
2024/08/15-22:24:10.619452 7fdec0c006c0 Level-0 table #149: started
|
||||
2024/08/15-22:24:10.619485 7fdec0c006c0 Level-0 table #149: 0 bytes OK
|
||||
2024/08/15-22:24:10.626074 7fdec0c006c0 Delete type=0 #147
|
||||
2024/08/15-22:24:10.632684 7fdec0c006c0 Manual compaction at level-0 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end)
|
||||
2024/08/15-22:24:10.646015 7fdec0c006c0 Manual compaction at level-1 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end)
|
||||
2024/08/15-22:43:42.844641 7fdec20006c0 Recovering log #148
|
||||
2024/08/15-22:43:42.854211 7fdec20006c0 Delete type=3 #146
|
||||
2024/08/15-22:43:42.854261 7fdec20006c0 Delete type=0 #148
|
||||
|
@ -1,8 +1,8 @@
|
||||
2024/08/11-18:35:03.709029 7f47856006c0 Recovering log #139
|
||||
2024/08/11-18:35:03.719540 7f47856006c0 Delete type=3 #137
|
||||
2024/08/11-18:35:03.719589 7f47856006c0 Delete type=0 #139
|
||||
2024/08/11-19:09:53.738475 7f4782e006c0 Level-0 table #145: started
|
||||
2024/08/11-19:09:53.738526 7f4782e006c0 Level-0 table #145: 0 bytes OK
|
||||
2024/08/11-19:09:53.744948 7f4782e006c0 Delete type=0 #143
|
||||
2024/08/11-19:09:53.757342 7f4782e006c0 Manual compaction at level-0 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end)
|
||||
2024/08/11-19:09:53.767613 7f4782e006c0 Manual compaction at level-1 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end)
|
||||
2024/08/15-22:19:09.675609 7fdec34006c0 Recovering log #144
|
||||
2024/08/15-22:19:09.731573 7fdec34006c0 Delete type=3 #142
|
||||
2024/08/15-22:19:09.731716 7fdec34006c0 Delete type=0 #144
|
||||
2024/08/15-22:24:10.619452 7fdec0c006c0 Level-0 table #149: started
|
||||
2024/08/15-22:24:10.619485 7fdec0c006c0 Level-0 table #149: 0 bytes OK
|
||||
2024/08/15-22:24:10.626074 7fdec0c006c0 Delete type=0 #147
|
||||
2024/08/15-22:24:10.632684 7fdec0c006c0 Manual compaction at level-0 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end)
|
||||
2024/08/15-22:24:10.646015 7fdec0c006c0 Manual compaction at level-1 from '!items!1HevhbCbvMonyQXe' @ 72057594037927935 : 1 .. '!items!yRIFroc5VC9Oj3qY' @ 0 : 0; will stop at (end)
|
||||
|
Binary file not shown.
@ -1 +1 @@
|
||||
MANIFEST-000052
|
||||
MANIFEST-000056
|
||||
|
@ -1,8 +1,3 @@
|
||||
2024/08/15-22:19:09.734714 7fdec16006c0 Recovering log #50
|
||||
2024/08/15-22:19:09.788430 7fdec16006c0 Delete type=3 #48
|
||||
2024/08/15-22:19:09.788488 7fdec16006c0 Delete type=0 #50
|
||||
2024/08/15-22:24:10.626217 7fdec0c006c0 Level-0 table #55: started
|
||||
2024/08/15-22:24:10.626258 7fdec0c006c0 Level-0 table #55: 0 bytes OK
|
||||
2024/08/15-22:24:10.632488 7fdec0c006c0 Delete type=0 #53
|
||||
2024/08/15-22:24:10.632706 7fdec0c006c0 Manual compaction at level-0 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end)
|
||||
2024/08/15-22:24:10.646031 7fdec0c006c0 Manual compaction at level-1 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end)
|
||||
2024/08/15-22:43:42.856529 7fdec2a006c0 Recovering log #54
|
||||
2024/08/15-22:43:42.866357 7fdec2a006c0 Delete type=3 #52
|
||||
2024/08/15-22:43:42.866410 7fdec2a006c0 Delete type=0 #54
|
||||
|
@ -1,8 +1,8 @@
|
||||
2024/08/11-18:35:03.722579 7f4784c006c0 Recovering log #45
|
||||
2024/08/11-18:35:03.732199 7f4784c006c0 Delete type=3 #43
|
||||
2024/08/11-18:35:03.732302 7f4784c006c0 Delete type=0 #45
|
||||
2024/08/11-19:09:53.712459 7f4782e006c0 Level-0 table #51: started
|
||||
2024/08/11-19:09:53.712523 7f4782e006c0 Level-0 table #51: 0 bytes OK
|
||||
2024/08/11-19:09:53.719097 7f4782e006c0 Delete type=0 #49
|
||||
2024/08/11-19:09:53.745186 7f4782e006c0 Manual compaction at level-0 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end)
|
||||
2024/08/11-19:09:53.757356 7f4782e006c0 Manual compaction at level-1 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end)
|
||||
2024/08/15-22:19:09.734714 7fdec16006c0 Recovering log #50
|
||||
2024/08/15-22:19:09.788430 7fdec16006c0 Delete type=3 #48
|
||||
2024/08/15-22:19:09.788488 7fdec16006c0 Delete type=0 #50
|
||||
2024/08/15-22:24:10.626217 7fdec0c006c0 Level-0 table #55: started
|
||||
2024/08/15-22:24:10.626258 7fdec0c006c0 Level-0 table #55: 0 bytes OK
|
||||
2024/08/15-22:24:10.632488 7fdec0c006c0 Delete type=0 #53
|
||||
2024/08/15-22:24:10.632706 7fdec0c006c0 Manual compaction at level-0 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end)
|
||||
2024/08/15-22:24:10.646031 7fdec0c006c0 Manual compaction at level-1 from '!folders!Lr9SCthdWWHecwEI' @ 72057594037927935 : 1 .. '!items!zvdsAxlRZnL6gqms' @ 0 : 0; will stop at (end)
|
||||
|
Binary file not shown.
9
rmfrp.js
9
rmfrp.js
@ -1,6 +1,5 @@
|
||||
// Import Configuration Object
|
||||
import { rmfrp } from "./module/config.js";
|
||||
//import { registerGetSceneControlButtonsHook } from "./module/controls.js";
|
||||
|
||||
// Import document classes.
|
||||
import { RMFRPActor } from "./module/documents/actor.js";
|
||||
@ -19,7 +18,7 @@ import RMFRPSkillSheet from "./module/sheets/skills/rmfrp_skill_sheet.js";
|
||||
import RMFRPPlayerSheet from "./module/sheets/actors/rmfrp_player_sheet.js";
|
||||
import RMFRPToolsSCImporter from "./module/sheets/apps/rmfrp_import_skill_categories.js";
|
||||
import RMFRPToolsDiceRoller from "./module/sheets/apps/rmfrp_dice_roller.js";
|
||||
import { RFRPUtility } from "./module/rfrp-utility.js";
|
||||
import { RMFRPUtility } from "./module/rmfrp-utility.js";
|
||||
|
||||
// Register Scene Controls
|
||||
// registerGetSceneControlButtonsHook();
|
||||
@ -80,8 +79,8 @@ Hooks.once("init", function () {
|
||||
// Actors
|
||||
Actors.registerSheet("fvtt-rolemaster-frp", RMFRPPlayerSheet, { makeDefault: true, label: "rmfrp.entity_sheet.player_characrer", types: ["character"] });
|
||||
|
||||
RFRPUtility.loadHandlebarsTemplates();
|
||||
RFRPUtility.loadHandlebarsHelpers();
|
||||
RMFRPUtility.loadHandlebarsTemplates();
|
||||
RMFRPUtility.loadHandlebarsHelpers();
|
||||
|
||||
});
|
||||
|
||||
@ -89,5 +88,5 @@ Hooks.once("ready", async function () {
|
||||
console.log("rmfrp | Ready");
|
||||
|
||||
// Load Utility
|
||||
await RFRPUtility.ready();
|
||||
await RMFRPUtility.ready();
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user