post fell abilities of adversaries into chat

This commit is contained in:
Bodo Huesemann
2022-08-21 18:05:25 +02:00
parent 3e5eda89ec
commit 60238fe5d1
2 changed files with 56 additions and 4 deletions
+14 -3
View File
@@ -925,6 +925,16 @@
opacity: 0.8;
}
.ui-dialog .charsheet button[class~="chat"]::before {
/* change D12 to target-appropriate crosshairs */
font-family: "Pictos" !important;
content: "q" !important;
font-size: 1.1em;
color: rgb(40, 40, 40);
font-weight: normal;
opacity: 0.8;
}
.ui-dialog .charsheet :is(button[type="roll"][class~="table-rolls"],
button[type="roll"][class~="parsed-rolls"],
button[type="action"][class~="parsed-rolls"])::before {
@@ -1014,8 +1024,9 @@
.charsheet .adversary-combat-proficiencies {
display: grid;
grid-template-columns: 250px 60px 60px 60px auto;
grid-template-columns: 220px 60px 60px 60px auto;
grid-template-rows: repeat(3, 1fr);
grid-gap: 0px;
}
.charsheet .adversary-combat-proficiencies input[type="text"],
@@ -1033,7 +1044,7 @@
.charsheet .adversary-fell-abilities {
display: grid;
grid-template-columns: 200px 1fr;
grid-template-columns: 35px 190px auto;
grid-template-rows: repeat(4, auto);
justify-items: left;
grid-gap: 0px;
@@ -1089,7 +1100,7 @@
}
.sheet-rolltemplate-msg .sheet-contentmin {
padding-top: 10px;
padding-top: 5px;
height: min-content;
}
+42 -1
View File
@@ -1327,10 +1327,12 @@
</div>
<div class="adversary-fell-abilities">
<h1 data-i18n="fell-ability">Fell Ability</h1>
<span/>
<label class="empf-black left" data-i18n="description">Description</label>
</div>
<fieldset class="repeating_fell-abilities">
<div class="adversary-fell-abilities">
<button type='action' name='act_adv-fell' class="parsed-rolls chat"></button>
<input name="attr_fell_ability" type="text" />
<textarea name="attr_fell_ability_desc" type="text" />
</div>
@@ -1461,6 +1463,24 @@
}
}
const rollMessage = async ({header, header_alt, sub1, sub1_alt, sub2, sub2_alt, msg, msg_alt} = {}) => {
header = header === undefined ? "" : `{{header=${header}}}`;
header_alt = header_alt === undefined ? "" : `{{header-alt=${header_alt}}}`;
sub1 = sub1 === undefined ? "" : `{{sub1=${sub1}}}`;
sub1_alt = sub1_alt === undefined ? "" : `{{sub1-alt=${sub1_alt}}}`;
sub2 = sub2 === undefined ? "" : `{{sub2=${sub2}}}`;
sub2_alt = sub2_alt === undefined ? "" : `{{sub2-alt=${sub2_alt}}}`;
msg = msg === undefined ? "" : `{{msg=${msg}}}`;
msg_alt = msg_alt === undefined ? "" : `{{msg-alt=${msg_alt}}}`;
let rollBase = `&{template:msg} ${header}${header_alt}${sub1}${sub1_alt}${sub2_alt}${msg}${msg_alt}`;
let targetRoll = await startRoll(rollBase);
clog (`targetRoll: ${JSON.stringify(targetRoll)})`);
finishRoll(targetRoll.rollId);
clog (`targetRoll: ${JSON.stringify(targetRoll)})`);
return;
};
// isolated target call
const getTarget = async () => {
const rxGrab = /^0\[(.*)\]\s*$/;
@@ -2365,7 +2385,9 @@
clog(`Completed first roll: weapon_${index}`);
});
// Custom roll
/*==================
Custom Roll
====================*/
on('clicked:customroll', async (ev) => {
clog(`Starting first roll`);
let data = await asw.getAttrs(['character_name', 'customfeatdie', 'customtn', 'customsuccessdice', 'customrollname', 'favourill_id']),
@@ -2379,6 +2401,24 @@
clog(`Completed first roll`);
});
/*==================
Adversary Fell Abilities
====================*/
on('clicked:repeating_fell-abilities:adv-fell', async (ev) => {
const source = (ev.sourceAttribute).slice(0, -8);
clog(`${source}fell_ability_desc`);
let data = await asw.getAttrs([`${source}fell_ability`, `${source}fell_ability_desc`]),
fell_ability = data[`${source}fell_ability`],
fell_ability_desc = data[`${source}fell_ability_desc`];
// remove last dot from fell_ability if it exists
fell_ability = fell_ability.replace(/\.$/, '');
clog(`${fell_ability}: ${fell_ability_desc}`);
await rollMessage({header:fell_ability, msg:fell_ability_desc});
});
/*==================
Adversary Import
====================*/
on(`change:notes sheet:opened`, function() {
getAttrs(["notes", "sheetTab"], function(values) {
if (values.sheetTab ==="isAdversary"){
@@ -2710,6 +2750,7 @@
hlog(`
### Features
- msg custom rolltemplate: added header-alt, sub1-alt, sub2-alt and fixe horizontal line hides correctly
- added button to post fell abilities of adversaries to chat
`, releaselog);
hlog("==============", releaselog);
attrs['releaselog'] = releaselog.msg + values['releaselog'];