Inlined a bunch of discord webhook text to help format messages better
This commit is contained in:
@@ -17,6 +17,11 @@ let LogContentSchema = new SimpleSchema({
|
|||||||
optional: true,
|
optional: true,
|
||||||
max: STORAGE_LIMITS.summary,
|
max: STORAGE_LIMITS.summary,
|
||||||
},
|
},
|
||||||
|
// Inline with other content fields
|
||||||
|
inline: {
|
||||||
|
type: Boolean,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
context: {
|
context: {
|
||||||
type: Object,
|
type: Object,
|
||||||
optional: true,
|
optional: true,
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ function applyAttackWithoutTarget({attack, scope, log}){
|
|||||||
}
|
}
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name,
|
name,
|
||||||
value: `${resultPrefix} **${result}**`,
|
value: `${resultPrefix}\n**${result}**`,
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +103,8 @@ function applyAttackToTarget({attack, target, scope, log}){
|
|||||||
|
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name,
|
name,
|
||||||
value: `${resultPrefix} **${result}**`,
|
value: `${resultPrefix}\n**${result}**`,
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
if ((result > armor) || (criticalHit)){
|
if ((result > armor) || (criticalHit)){
|
||||||
scope['$attackHit'] = true;
|
scope['$attackHit'] = true;
|
||||||
@@ -116,7 +118,8 @@ function applyAttackToTarget({attack, target, scope, log}){
|
|||||||
});
|
});
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: criticalHit ? 'Critical Hit!' : criticalMiss ? 'Critical Miss!' : 'To Hit',
|
name: criticalHit ? 'Critical Hit!' : criticalMiss ? 'Critical Miss!' : 'To Hit',
|
||||||
value: `${resultPrefix} **${result}**`,
|
value: `${resultPrefix}\n**${result}**`,
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,23 +131,23 @@ function rollAttack(attack, scope){
|
|||||||
const [a, b] = rollDice(2, 20);
|
const [a, b] = rollDice(2, 20);
|
||||||
if (a >= b) {
|
if (a >= b) {
|
||||||
value = a;
|
value = a;
|
||||||
resultPrefix = `1d20 [ ${a}, ~~${b}~~ ] ${rollModifierText} = `;
|
resultPrefix = `1d20 [ ${a}, ~~${b}~~ ] ${rollModifierText}`;
|
||||||
} else {
|
} else {
|
||||||
value = b;
|
value = b;
|
||||||
resultPrefix = `1d20 [ ~~${a}~~, ${b} ] ${rollModifierText} = `;
|
resultPrefix = `1d20 [ ~~${a}~~, ${b} ] ${rollModifierText}`;
|
||||||
}
|
}
|
||||||
} else if (attack.advantage === -1 || scope['$attackDisadvantage']){
|
} else if (attack.advantage === -1 || scope['$attackDisadvantage']){
|
||||||
const [a, b] = rollDice(2, 20);
|
const [a, b] = rollDice(2, 20);
|
||||||
if (a <= b) {
|
if (a <= b) {
|
||||||
value = a;
|
value = a;
|
||||||
resultPrefix = `1d20 [ ${a}, ~~${b}~~ ] ${rollModifierText} = `;
|
resultPrefix = `1d20 [ ${a}, ~~${b}~~ ] ${rollModifierText}`;
|
||||||
} else {
|
} else {
|
||||||
value = b;
|
value = b;
|
||||||
resultPrefix = `1d20 [ ~~${a}~~, ${b} ] ${rollModifierText} = `;
|
resultPrefix = `1d20 [ ~~${a}~~, ${b} ] ${rollModifierText}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
value = rollDice(1, 20)[0];
|
value = rollDice(1, 20)[0];
|
||||||
resultPrefix = `1d20 [${value}] ${rollModifierText} = `
|
resultPrefix = `1d20 [${value}] ${rollModifierText}`
|
||||||
}
|
}
|
||||||
scope['$attackRoll'] = {value};
|
scope['$attackRoll'] = {value};
|
||||||
const result = value + attack.value;
|
const result = value + attack.value;
|
||||||
@@ -251,6 +254,7 @@ function spendResources({prop, log, scope}){
|
|||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Uses left',
|
name: 'Uses left',
|
||||||
value: prop.usesLeft - 1,
|
value: prop.usesLeft - 1,
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,9 +284,11 @@ function spendResources({prop, log, scope}){
|
|||||||
if (gainLog.length) log.content.push({
|
if (gainLog.length) log.content.push({
|
||||||
name: 'Gained',
|
name: 'Gained',
|
||||||
value: gainLog.join('\n'),
|
value: gainLog.join('\n'),
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
if (spendLog.length) log.content.push({
|
if (spendLog.length) log.content.push({
|
||||||
name: 'Spent',
|
name: 'Spent',
|
||||||
value: spendLog.join('\n'),
|
value: spendLog.join('\n'),
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default function applyAdjustment(node, {
|
|||||||
|
|
||||||
// Evaluate the amount
|
// Evaluate the amount
|
||||||
recalculateCalculation(prop.amount, scope, log);
|
recalculateCalculation(prop.amount, scope, log);
|
||||||
|
|
||||||
const value = +prop.amount.value;
|
const value = +prop.amount.value;
|
||||||
if (!isFinite(value)) {
|
if (!isFinite(value)) {
|
||||||
return applyChildren(node, {creature, targets, scope, log});
|
return applyChildren(node, {creature, targets, scope, log});
|
||||||
@@ -39,6 +39,7 @@ export default function applyAdjustment(node, {
|
|||||||
name: 'Attribute damage',
|
name: 'Attribute damage',
|
||||||
value: `${prop.stat}${prop.operation === 'set' ? ' set to' : ''}` +
|
value: `${prop.stat}${prop.operation === 'set' ? ' set to' : ''}` +
|
||||||
` ${value}`,
|
` ${value}`,
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -46,6 +47,7 @@ export default function applyAdjustment(node, {
|
|||||||
name: 'Attribute damage',
|
name: 'Attribute damage',
|
||||||
value: `${prop.stat}${prop.operation === 'set' ? ' set to' : ''}` +
|
value: `${prop.stat}${prop.operation === 'set' ? ' set to' : ''}` +
|
||||||
` ${value}`,
|
` ${value}`,
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ function crystalizeVariables({propList, scope, log}){
|
|||||||
// Can't strip symbols
|
// Can't strip symbols
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Error',
|
name: 'Error',
|
||||||
value: 'Variable `$target` should not be used without a property: $target.property'
|
value: 'Variable `$target` should not be used without a property: $target.property',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ export default function applyDamage(node, {
|
|||||||
log.content.push({
|
log.content.push({
|
||||||
name: logName,
|
name: logName,
|
||||||
value: logValue.join('\n'),
|
value: logValue.join('\n'),
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
return applyChildren();
|
return applyChildren();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export default function applyRoll(node, {creature, targets, scope, log}){
|
|||||||
log.content.push({
|
log.content.push({
|
||||||
name: prop.name,
|
name: prop.name,
|
||||||
value: prop.variableName + ' = ' + prop.roll.calculation + ' = ' + prop.roll.value,
|
value: prop.variableName + ' = ' + prop.roll.calculation + ' = ' + prop.roll.value,
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return node.children.forEach(child => applyProperty(child, {
|
return node.children.forEach(child => applyProperty(child, {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export default function applySavingThrow(node, {creature, targets, scope, log}){
|
|||||||
log.content.push({
|
log.content.push({
|
||||||
name: prop.name,
|
name: prop.name,
|
||||||
value: ' DC ' + dc,
|
value: ' DC ' + dc,
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
saveTargets.forEach(target => {
|
saveTargets.forEach(target => {
|
||||||
@@ -84,7 +85,8 @@ export default function applySavingThrow(node, {creature, targets, scope, log}){
|
|||||||
}
|
}
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Save',
|
name: 'Save',
|
||||||
value: resultPrefix + result + (saveSuccess ? 'Passed' : 'Failed')
|
value: resultPrefix + result + (saveSuccess ? 'Passed' : 'Failed'),
|
||||||
|
inline: true,
|
||||||
});
|
});
|
||||||
return applyChildren();
|
return applyChildren();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user