Skip to content

Commit

Permalink
Release prep
Browse files Browse the repository at this point in the history
  • Loading branch information
HadaIonut committed Aug 22, 2021
1 parent 3b68a92 commit ff0448a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "https://github.com/HadaIonut"
}
],
"version": "1.1.4",
"version": "1.1.6",
"esmodules": [
"scripts/foundry-mgl.js"
],
Expand All @@ -28,7 +28,7 @@
"minimumCoreVersion": "0.8.2",
"compatibleCoreVersion": "0.8.3",
"url": "https://github.com/HadaIonut/Foundry-mgl",
"manifest": "https://github.com/HadaIonut/Foundry-mgl/releases/download/v1.1.4/module.json",
"download": "https://github.com/HadaIonut/Foundry-mgl/releases/download/v1.1.4/module.zip",
"manifest": "https://github.com/HadaIonut/Foundry-mgl/releases/download/v1.1.6/module.json",
"download": "https://github.com/HadaIonut/Foundry-mgl/releases/download/v1.1.6/module.zip",
"changelog": ""
}
12 changes: 6 additions & 6 deletions scripts/Utils/ConversionEngineNew.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const convertValueToMetric = (value, unit) => {
}

const convertText = (text) => {
return !text ? '' : text.replace(/(\b[^\d\W]+\b )?(\b[^\d\W]+\b)([ -])(feet|foot)/g, (_0, wordNumber1, wordNumber2, separator, unit) => {
return text?.replace(/(\b[^\d\W]+\b )?(\b[^\d\W]+\b)([ -])(feet|foot)/g, (_0, wordNumber1, wordNumber2, separator, unit) => {
const capitalized = wordNumber1 !== wordNumber1?.toLowerCase();
const selectedNumber = numberSelector(wordNumber1 ? wordNumber1?.toLowerCase().trim() : '', wordNumber2?.toLowerCase());
if (selectedNumber.number) {
Expand All @@ -123,15 +123,15 @@ const convertText = (text) => {
return capitalized ? `${returnText.charAt(0).toUpperCase()}${returnText.slice(1)}` : returnText;
}
return `${selectedNumber.text}${separator}${unit}`;
}).replace(/([0-9]+) (to|and) ([0-9]+) (feet|inch|foot|ft\.)/g, (_0, number1, separatorWord, number2, units) => {
})?.replace(/([0-9]+) (to|and) ([0-9]+) (feet|inch|foot|ft\.)/g, (_0, number1, separatorWord, number2, units) => {
return `${convertValueToMetric(number1, units)} ${separatorWord} ${convertValueToMetric(number2, units)} ${convertStringFromImperialToMetric(units)}`
}).replace(/([0-9]{1,3}(,[0-9]{3})+)([ -])(feet|foot|pounds)/g, (_0, number, _1, separator, label) => {
})?.replace(/([0-9]{1,3}(,[0-9]{3})+)([ -])(feet|foot|pounds)/g, (_0, number, _1, separator, label) => {
return `${convertValueToMetric(number, label)}${separator}${convertStringFromImperialToMetric(label)}`;
}).replace(/([0-9]+)\/([0-9]+) (feet|inch|foot|ft\.)/g, (_0, firstNumber, secondNumber, label) => {
})?.replace(/([0-9]+)\/([0-9]+) (feet|inch|foot|ft\.)/g, (_0, firstNumber, secondNumber, label) => {
return `${convertValueToMetric(firstNumber, label)}/${convertValueToMetric(secondNumber, label)} ${convertStringFromImperialToMetric(label)}`;
}).replace(/([0-9]+)(\W| | cubic |-|){1,2}(feet|inch|foot|ft\.|pounds|lbs\.|pound|lbs|lb|ft|mile)/g, (_0, number, separator, label) => {
})?.replace(/([0-9]+)(\W| | cubic |-|){1,2}(feet|inch|foot|ft\.|pounds|lbs\.|pound|lbs|lb|ft|mile)/g, (_0, number, separator, label) => {
return `${convertValueToMetric(number, label)}${separator}${convertStringFromImperialToMetric(label)}`;
}).replace(/(several \w+ )(feet|yards)/g, (_0, several, unit) => {
})?.replace(/(several \w+ )(feet|yards)/g, (_0, several, unit) => {
return `${several}${convertStringFromImperialToMetric(unit)}`;
})
}
Expand Down
1 change: 0 additions & 1 deletion scripts/foundry-mgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {consoleLog} from "./Utils/Utils.js";
* Defines distance units and sets encumbrance
*/
Hooks.on('init', () => {
CONFIG.debug.hooks = true;
consoleLog("Changing labels 'Feet' and 'Miles' to 'Meters' and 'Kilometers'.")
DND5E.distanceUnits["m"] = game.i18n.localize("metricsystem.meters");
DND5E.distanceUnits["km"] = game.i18n.localize("metricsystem.kilometers");
Expand Down

0 comments on commit ff0448a

Please sign in to comment.