Skip to content

Commit 825acd1

Browse files
authored
Merge pull request #14902 from Zen-Raven/Draw-Steel-Mar26-Updates
[Draw Steel] Bugfix and i18n update
2 parents 5b09011 + 8aafc88 commit 825acd1

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

Draw Steel/draw-steel.html

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4893,7 +4893,7 @@ <h2 data-i18n="standard-move-actions"></h2>
48934893

48944894
const characteristicTranslation = getTranslationByKey(directMap.characteristic) || directMap.characteristic;
48954895

4896-
const name = !directMap.name ? '{{name=' + characteristicTranslation + ` ` + powerRollTranslation + '}} ': '';
4896+
const name = !directMap.name ? `{{name=${characteristicTranslation} ${t['power-roll']}}} `: '';
48974897
rollString += [
48984898
'[[ [[2d10cs>11cf<0]][2d10]',
48994899
`+ [[${rollValueMap.characteristicValue}[${characteristicTranslation}]]][${characteristicTranslation}]`,
@@ -5298,10 +5298,7 @@ <h2 data-i18n="standard-move-actions"></h2>
52985298
* )
52995299
* )? : End Optional group (the "?" makes "3 damage" work).
53005300
*/
5301-
const damageRegex = new RegExp(
5302-
`^(\\d+)(?:\\s*\\+\\s*([${charList}](?:[\\s,]+(?:${orTrans}\\s+)?[${charList}]) *))?`,
5303-
"i"
5304-
);
5301+
const damageRegex = new RegExp(`^(\\d+)(?:\\s*\\+\\s*([${charList}](?:[\\s,]+(?:${orTrans}\\s+)?[${charList}])*))?`, "");
53055302

53065303
const match = rawDamage.trim().match(damageRegex);
53075304
if (!match) return tierEffect;
@@ -6152,17 +6149,22 @@ <h2 data-i18n="standard-move-actions"></h2>
61526149
importMonster(data, []);
61536150
} else if (data.hasOwnProperty('monsters')) {
61546151
// iterate through the monsters and add them to a list.
6155-
let queryString = "!{{template:default}}{{ask=![[?{Monster to Import";
6152+
6153+
let queryString = `!{{template:default}}{{ask=![[?{${getTranslationByKey('import-monster')}|${getTranslationByKey('import-select-prompt')},-1`;
61566154
for (const [index, monster] of data.monsters.entries()) {
61576155

6158-
queryString += "|" + monster.name + ", " + index.toString();
6156+
queryString += '|' + monster.name + ', ' + index.toString();
61596157
}
6160-
queryString += "}]]}}";
6158+
queryString += '}]]}}';
61616159

61626160
// Use a roll to provide the user with an choice of the monsters in the
61636161
const results = await startRoll(queryString);
61646162
finishRoll( results.rollId );
61656163
const choice = results.results.ask.result;
6164+
if (parseInt(choice) < 0) {
6165+
console.log('Invalid monster selection');
6166+
return;
6167+
}
61666168
await importMonster(data.monsters[choice], data.malice);
61676169
console.log(data.monsters[choice].name);
61686170
}
@@ -6178,6 +6180,12 @@ <h2 data-i18n="standard-move-actions"></h2>
61786180
* @param {object} data the loaded and validated JSON file
61796181
**/
61806182
async function importPlayer(data) {
6183+
console.log('~~~ importPlayer ~~~');
6184+
6185+
if (!data) {
6186+
console.log('No Player Data Found');
6187+
return;
6188+
}
61816189
const {
61826190
name: character_name,
61836191
ancestry,
@@ -6376,6 +6384,12 @@ <h2 data-i18n="standard-move-actions"></h2>
63766384
**/
63776385

63786386
async function importMonster(data, malice) {
6387+
console.log('~~~ importMonster ~~~');
6388+
6389+
if (!data) {
6390+
console.log('No Monster Data Found');
6391+
return;
6392+
}
63796393
const {
63806394
name, level, characteristics, keywords, role: dataRole,
63816395
size: dataSize, speed: dataSpeed, stability, stamina,

Draw Steel/translation.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,5 +565,6 @@
565565
"roll-surge-potency": "Using Surges for Potency",
566566
"roll-surge-potency-desc": "Surges used to increase potency by 1",
567567
"roll-resource-gain": "Gain",
568-
"damage-calc-or": "or"
568+
"damage-calc-or": "or",
569+
"import-select-prompt": "Select One"
569570
}

0 commit comments

Comments
 (0)