diff --git a/README.md b/README.md index d6212aa3..dab11765 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ await damageRoller.roll(); const cardHtml = await damageRoller.render("Knockback roll"); const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, rolls: damageRoller.rawRolls(), user: game.user._id, content: cardHtml, diff --git a/module/actor/actor-sheet.mjs b/module/actor/actor-sheet.mjs index c7747e2a..13d4529e 100644 --- a/module/actor/actor-sheet.mjs +++ b/module/actor/actor-sheet.mjs @@ -933,7 +933,7 @@ export class HeroSystemActorSheet extends ActorSheet { speaker.alias = actor.name; const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: heroRoller.rawRolls(), user: game.user._id, content: cardHtml, @@ -969,8 +969,10 @@ export class HeroSystemActorSheet extends ActorSheet { const cardHtml = await characteristicRoller.render(flavor); const speaker = ChatMessage.getSpeaker({ actor: this.actor }); + speaker.alias = this.actor.name; + const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: characteristicRoller.rawRolls(), user: game.user._id, content: cardHtml, @@ -1042,8 +1044,10 @@ export class HeroSystemActorSheet extends ActorSheet { const template = `systems/${HEROSYS.module}/templates/chat/item-damage-card.hbs`; const cardHtml = await renderTemplate(template, cardData); const speaker = ChatMessage.getSpeaker({ actor: this.actor }); + speaker.alias = this.actor.name; + const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: characteristicRoller.rawRolls(), user: game.user._id, content: cardHtml, @@ -1335,7 +1339,7 @@ export class HeroSystemActorSheet extends ActorSheet { const speaker = ChatMessage.getSpeaker({ actor: this.actor, token }); const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: content, speaker: speaker, }; diff --git a/module/actor/actor.mjs b/module/actor/actor.mjs index 449901b7..465a6824 100644 --- a/module/actor/actor.mjs +++ b/module/actor/actor.mjs @@ -324,7 +324,7 @@ export class HeroSystem6eActor extends Actor { if (asAction) { const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: content, speaker: speaker, }; @@ -373,7 +373,7 @@ export class HeroSystem6eActor extends Actor { const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: content, speaker: speaker, whisper: [...ChatMessage.getWhisperRecipients(this.name), ...ChatMessage.getWhisperRecipients("GM")], @@ -445,9 +445,10 @@ export class HeroSystem6eActor extends Actor { //token, }); speaker["alias"] = game.user.name; + const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: `${this.name} is ${badStatus.join(", ")} and cannot move. Override key was used.`, whisper: whisperUserTargetsForActor(this), speaker, @@ -503,12 +504,12 @@ export class HeroSystem6eActor extends Actor { if (!result && overrideCanAct) { const speaker = ChatMessage.getSpeaker({ actor: this, - //token, }); speaker["alias"] = game.user.name; + const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: `${this.name} is ${badStatus.join(", ")} and cannot act. Override key was used.`, whisper: whisperUserTargetsForActor(this), speaker, diff --git a/module/combat.mjs b/module/combat.mjs index 1b7268f6..ca9de06c 100644 --- a/module/combat.mjs +++ b/module/combat.mjs @@ -531,7 +531,7 @@ export class HeroSystem6eCombat extends Combat { const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: content, whisper: whisperUserTargetsForActor(combatant.actor), speaker, @@ -587,18 +587,12 @@ export class HeroSystem6eCombat extends Combat { await effect.delete(); - let content = `${combatant.actor.name} recovers from being stunned.`; - const token = combatant.token; - const speaker = ChatMessage.getSpeaker({ - actor: combatant.actor, - token, - }); - speaker["alias"] = combatant.actor.name; + const content = `${combatant.actor.name} recovers from being stunned.`; + const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: content, - //speaker: speaker }; await ChatMessage.create(chatData); @@ -650,8 +644,8 @@ export class HeroSystem6eCombat extends Combat {
Skipping because this has already been performed on this turn during this combat. This typically occurs when rewinding combat or during speed changes.
`; const chatData = { + style: CONST.CHAT_MESSAGE_STYLES.OTHER, user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, content: content, }; @@ -731,8 +725,8 @@ export class HeroSystem6eCombat extends Combat { content += ""; contentHidden += ""; const chatData = { + style: CONST.CHAT_MESSAGE_STYLES.OTHER, user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, content: content, }; diff --git a/module/herosystem6e.mjs b/module/herosystem6e.mjs index 3e7fd257..b7574edf 100644 --- a/module/herosystem6e.mjs +++ b/module/herosystem6e.mjs @@ -727,14 +727,6 @@ Hooks.on("updateWorldTime", async (worldTime, options) => { } if (game.time.worldTime >= aeWithCharges.flags.startTime + aeWithCharges.duration.seconds) { await aeWithCharges.parent.toggle(); - // const chatData = { - // user: game.user._id, - // type: CONST.CHAT_MESSAGE_TYPES.OTHER, - // content: `${aeWithCharges.name} expired`, - // whisper: whisperUserTargetsForActor(aeWithCharges.parent?.actor), - // }; - // ChatMessage.create(chatData); - // await aeWithCharges.delete(); } else { if (game.ready) game[HEROSYS.module].effectPanel.refresh(); } diff --git a/module/item/item-attack.mjs b/module/item/item-attack.mjs index 24476b1d..721c5152 100644 --- a/module/item/item-attack.mjs +++ b/module/item/item-attack.mjs @@ -349,8 +349,7 @@ export async function AttackAoeToHit(item, options) { speaker.alias = actor.name; const chatData = { - //type: CONST.CHAT_MESSAGE_TYPES.ROLL, - style: CONST.CHAT_MESSAGE_STYLES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: attackHeroRoller.rawRolls(), user: game.user._id, content: cardHtml, @@ -860,9 +859,10 @@ export async function AttackToHit(item, options) { if (!(await item)) { const speaker = ChatMessage.getSpeaker({ actor: item.actor }); speaker["alias"] = item.actor.name; + const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: `${resourcesUsedDescription}${resourcesUsedDescriptionRenderedRoll}`, whisper: ChatMessage.getWhisperRecipients("GM"), speaker, @@ -899,9 +899,10 @@ export async function AttackToHit(item, options) { if (item.system.EFFECT?.toLowerCase().indexOf("dodge") > -1) { const speaker = ChatMessage.getSpeaker({ actor: item.actor }); speaker["alias"] = item.actor.name; + const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: `${item.name} ${dcv.signedString()} DCV`, speaker, }; @@ -951,8 +952,7 @@ export async function AttackToHit(item, options) { speaker.alias = actor.name; const chatData = { - //type: aoeAlwaysHit ? CONST.CHAT_MESSAGE_TYPES.OTHER : CONST.CHAT_MESSAGE_TYPES.ROLL, // most AOEs are auto hit - style: aoeAlwaysHit ? CONST.CHAT_MESSAGE_STYLES.OTHER : CONST.CHAT_MESSAGE_STYLES.ROLL, // most AOEs are auto hit + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: targetData .map((target) => target.roller?.rawRolls()) .flat() @@ -1343,9 +1343,10 @@ async function _rollApplyKnockback(token, knockbackDice) { const template = `systems/${HEROSYS.module}/templates/chat/apply-damage-card.hbs`; const cardHtml = await renderTemplate(template, cardData); const speaker = ChatMessage.getSpeaker({ actor: actor }); + speaker.alias = actor.name; const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: damageRoller.rawRolls(), user: game.user._id, content: cardHtml, @@ -1573,8 +1574,10 @@ export async function _onRollDamage(event) { const template = `systems/${HEROSYS.module}/templates/chat/item-damage-card.hbs`; const cardHtml = await renderTemplate(template, cardData); const speaker = ChatMessage.getSpeaker({ actor: item.actor }); + speaker.alias = item.actor.name; + const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: damageRoller.rawRolls(), user: game.user._id, content: cardHtml, @@ -1631,7 +1634,7 @@ export async function _onRollMindScan(event) { const content = await renderTemplate(template2, data); const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content, speaker: ChatMessage.getSpeaker({ actor: item.actor }), }; @@ -1793,8 +1796,10 @@ export async function _onRollMindScanEffectRoll(event) { const template = `systems/${HEROSYS.module}/templates/attack/item-mindscan-damage-card.hbs`; const cardHtml = await renderTemplate(template, cardData); const speaker = ChatMessage.getSpeaker({ actor: item.actor }); + speaker.alias = item.actor.name; + const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: damageRoller.rawRolls(), user: game.user._id, content: cardHtml, @@ -2124,7 +2129,7 @@ export async function _onApplyDamageToSpecificToken(event, tokenId) { speaker["alias"] = token.actor.name; const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content, whisper: ChatMessage.getWhisperRecipients("GM"), speaker, @@ -2388,9 +2393,10 @@ export async function _onApplyDamageToSpecificToken(event, tokenId) { const template = `systems/${HEROSYS.module}/templates/chat/apply-damage-card.hbs`; const cardHtml = await renderTemplate(template, cardData); const speaker = ChatMessage.getSpeaker({ actor: item.actor }); + speaker.alias = item.actor.name; const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: damageDetail.knockbackRoller?.rawRolls(), user: game.user._id, content: cardHtml, @@ -2437,8 +2443,8 @@ export async function _onApplyEntangleToSpecificToken(item, token, originalRoll) // If a character is affected by more than one Entangle, use the // highest BODY and the highest PD and ED for all the Entangles, // then add +1 BODY for each additional Entangle. - // NOTE: Having a normal ENTANGLE combined witha MENTAL PARALYSIS is unusual, not not sure this code works properly in those cases. - const prevEntangle = token.actor.effects.find((o) => o.statuses.has("entangled")); //token.actor.temporaryEffects.find((o) => o.flags.XMLID === "ENTANGLE"); + // NOTE: Having a normal ENTANGLE combined with a MENTAL PARALYSIS is unusual, not not sure this code works properly in those cases. + const prevEntangle = token.actor.effects.find((o) => o.statuses.has("entangled")); const prevBody = parseInt(prevEntangle?.changes?.find((o) => o.key === "body")?.value) || 0; if (prevEntangle) { entangleDefense.rPD = Math.max(entangleDefense.rPD, parseInt(prevEntangle.flags.entangleDefense?.rPD) || 0); @@ -2451,8 +2457,7 @@ export async function _onApplyEntangleToSpecificToken(item, token, originalRoll) }`), (body = Math.max(body, prevBody + 1)); } - const effecttData = { - //...HeroSystem6eActorActiveEffects.entangledEffect, + const effectData = { id: "entangled", icon: HeroSystem6eActorActiveEffects.entangledEffect.icon, changes: foundry.utils.deepClone(HeroSystem6eActorActiveEffects.entangledEffect.changes), @@ -2464,23 +2469,23 @@ export async function _onApplyEntangleToSpecificToken(item, token, originalRoll) }, origin: item.uuid, }; - const changeBody = effecttData.changes?.find((o) => o.key === "body"); + const changeBody = effectData.changes?.find((o) => o.key === "body"); if (changeBody) { changeBody.value === body; } else { - effecttData.changes ??= []; - effecttData.changes.push({ key: "body", value: body, mode: 5 }); + effectData.changes ??= []; + effectData.changes.push({ key: "body", value: body, mode: 5 }); } if (prevEntangle) { prevEntangle.update({ - name: effecttData.name, - flags: effecttData.flags, - changes: effecttData.changes, - origin: effecttData.origin, + name: effectData.name, + flags: effectData.flags, + changes: effectData.changes, + origin: effectData.origin, }); } else { - token.actor.addActiveEffect(effecttData); + token.actor.addActiveEffect(effectData); } const cardData = { @@ -2507,9 +2512,10 @@ export async function _onApplyEntangleToSpecificToken(item, token, originalRoll) const template = `systems/${HEROSYS.module}/templates/chat/apply-entangle-card.hbs`; const cardHtml = await renderTemplate(template, cardData); const speaker = ChatMessage.getSpeaker({ actor: item.actor }); + speaker.alias = item.actor.name; const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, user: game.user._id, content: cardHtml, speaker: speaker, @@ -2550,7 +2556,7 @@ export async function _onApplyDamageToEntangle(attackItem, token, originalRoll, if (!defense) { return ui.notifications.error( - `Unable to determine appropraite defenses for ${entangleAE.name} vs ${attackItem.name}.`, + `Unable to determine appropriate defenses for ${entangleAE.name} vs ${attackItem.name}.`, ); } @@ -2600,31 +2606,18 @@ export async function _onApplyDamageToEntangle(attackItem, token, originalRoll, // dice rolls roller: originalRoll, - // renderedDamageRoll: damageRenderedResult, - // renderedStunMultiplierRoll: damageDetail.renderedStunMultiplierRoll, // body - //bodyDamage: damageDetail.bodyDamage, bodyDamageEffective: bodyDamage, // stun - // stunDamage: damageDetail.stunDamage, stunDamageEffective: stunDamage, - // hasRenderedDamageRoll: true, - // stunMultiplier: damageDetail.stunMultiplier, - // hasStunMultiplierRoll: damageDetail.hasStunMultiplierRoll, - - // damage info - // damageString: heroRoller.getTotalSummary(), - // useHitLoc: damageDetail.useHitLoc, - // hitLocText: damageDetail.hitLocText, // effects effects: effectsFinal, // defense defense: `${defense} resistant`, - // damageNegationValue: damageNegationValue, // misc tags: defenseTags, @@ -2637,10 +2630,10 @@ export async function _onApplyDamageToEntangle(attackItem, token, originalRoll, const template = `systems/${HEROSYS.module}/templates/chat/apply-damage-card.hbs`; const cardHtml = await renderTemplate(template, cardData); const speaker = ChatMessage.getSpeaker({ actor: attackItem.actor }); + speaker.alias = attackItem.actor.name; const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, - //rolls: damageDetail.knockbackRoller?.rawRolls(), + style: CONST.CHAT_MESSAGE_STYLES.OOC, user: game.user._id, content: cardHtml, speaker: speaker, @@ -2688,7 +2681,7 @@ async function _performAbsorptionForToken(token, absorptionItems, damageDetail, speaker.alias = actor.name; const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: absorptionRoller.rawRolls(), user: game.user._id, content: cardHtml, @@ -3428,7 +3421,7 @@ export async function userInteractiveVerifyOptionallyPromptThenSpendResources(it const overrideKeyText = game.keybindings.get(HEROSYS.module, "OverrideCanAct")?.[0].key; const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: `${game.user.name} is using ${overrideKeyText} to override using ${resourcesUsedDescription} for ${item.name}${resourcesUsedDescriptionRenderedRoll}`, whisper: whisperUserTargetsForActor(this), speaker, diff --git a/module/item/item.mjs b/module/item/item.mjs index 4d3c2965..00da8687 100644 --- a/module/item/item.mjs +++ b/module/item/item.mjs @@ -450,9 +450,8 @@ export class HeroSystem6eItem extends Item { const chatData = { user: game.user._id, speaker: ChatMessage.getSpeaker({ actor: this.actor }), - type: CONST.CHAT_MESSAGE_TYPES.ChatMessage, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: content, - //speaker: speaker }; ChatMessage.create(chatData); } @@ -489,9 +488,10 @@ export class HeroSystem6eItem extends Item { if (!success) { const speaker = ChatMessage.getSpeaker({ actor: item.actor }); speaker["alias"] = item.actor.name; + const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: `${ resourcesUsedDescription ? `Spent ${resourcesUsedDescription} to attempt` : "Attempted" } to activate ${item.name} but attempt failed${resourcesUsedDescriptionRenderedRoll}`, @@ -505,9 +505,10 @@ export class HeroSystem6eItem extends Item { const speaker = ChatMessage.getSpeaker({ actor: item.actor }); speaker["alias"] = item.actor.name; + const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: `${ resourcesUsedDescription ? `Spent ${resourcesUsedDescription} to activate` : "Activated " } ${item.name}${resourcesUsedDescriptionRenderedRoll}`, @@ -548,9 +549,10 @@ export class HeroSystem6eItem extends Item { // Let GM know power was deactivated const speaker = ChatMessage.getSpeaker({ actor: item.actor }); speaker["alias"] = item.actor.name; + const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: `Turned off ${item.name}`, whisper: whisperUserTargetsForActor(item.actor), speaker, @@ -3773,7 +3775,7 @@ export class HeroSystem6eItem extends Item { } // Disadvantages sorted low to high - for (let modifier of modifiers) { + for (const modifier of modifiers) { system.description += this.createPowerDescriptionModifier(modifier); } @@ -3844,8 +3846,9 @@ export class HeroSystem6eItem extends Item { { // 1 Recoverable Continuing Charge lasting 1 Minute result += ", "; + const maxCharges = parseInt(modifier.OPTION_ALIAS); - if (maxCharges != parseInt(this.system.charges.max)) { + if (maxCharges !== parseInt(system.charges.max)) { console.error("CHARGES mismatch", item); } const currentCharges = parseInt(this.system.charges.value); @@ -3854,18 +3857,34 @@ export class HeroSystem6eItem extends Item { } result += modifier.OPTION_ALIAS; - let recoverable = (modifier.ADDER || []).find((o) => o.XMLID == "RECOVERABLE"); + const recoverable = (modifier.ADDER || []).find((o) => o.XMLID === "RECOVERABLE"); if (recoverable) { - result += " " + recoverable.ALIAS; + result += ` ${recoverable.ALIAS}`; } - let continuing = (modifier.ADDER || []).find((o) => o.XMLID == "CONTINUING"); + const boostable = (modifier.ADDER || []).find((o) => o.XMLID === "BOOSTABLE"); + if (boostable) { + result += ` ${boostable.ALIAS}`; + } + + const continuing = (modifier.ADDER || []).find((o) => o.XMLID === "CONTINUING"); if (continuing) { - result += " " + continuing.ALIAS; + result += ` ${continuing.ALIAS}`; + } + + const fuel = (modifier.ADDER || []).find((o) => o.XMLID === "FUEL"); + if (fuel) { + result += ` ${fuel.ALIAS}`; } result += maxCharges > 1 ? " Charges" : " Charge"; + const totalClips = this.system.charges.clipsMax; + if (totalClips > 1) { + const currentClips = this.system.charges.clips; + result += ` (${currentClips}/${totalClips} clips)`; + } + if (continuing) { result += " lasting " + continuing.OPTION_ALIAS; } @@ -5130,7 +5149,7 @@ export async function RequiresASkillRollCheck(item) { speaker.alias = actor.name; const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: activationRoller.rawRolls(), user: game.user._id, content: cardHtml, diff --git a/module/item/skill.mjs b/module/item/skill.mjs index 994c0eeb..c47c9ab2 100644 --- a/module/item/skill.mjs +++ b/module/item/skill.mjs @@ -178,7 +178,7 @@ async function skillRoll(item, actor, target) { const cardHtml = await renderTemplate(template, cardData); const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: skillRoller.rawRolls(), user: game.user._id, content: cardHtml, diff --git a/module/migration.mjs b/module/migration.mjs index b28610a2..42c70ca9 100644 --- a/module/migration.mjs +++ b/module/migration.mjs @@ -93,7 +93,7 @@ export async function migrateWorld() { // } const chatData = { user: game.user._id, - type: CONST.CHAT_MESSAGE_TYPES.OTHER, + style: CONST.CHAT_MESSAGE_STYLES.OTHER, content: content, }; diff --git a/module/ruler.mjs b/module/ruler.mjs index 3b39a520..2a100acd 100644 --- a/module/ruler.mjs +++ b/module/ruler.mjs @@ -49,7 +49,7 @@ export class HeroRuler extends Ruler { const activeMovement = movementItems.length === 0 ? "none" - : movementItems.find((o) => o._id == relevantToken.actor.flags.activeMovement)?._id || + : movementItems.find((o) => o._id === relevantToken.actor.flags.activeMovement)?._id || movementItems[0]._id; const radioOptions = movementItems @@ -201,7 +201,7 @@ export class HeroRuler extends Ruler { if ( automation === "all" || - (automation === "npcOnly" && actor.type == "npc") || + (automation === "npcOnly" && actor.type === "npc") || (automation === "pcEndOnly" && actor.type === "pc") ) { // Only consume endurance on token's phase, allowing for Knockback movement (which does not consume END) @@ -318,10 +318,10 @@ export class HeroRuler extends Ruler { return; } - // Kluge to update actor right away so the render has proper data. + // Kludge to update actor right away so the render has proper data. // There is likely a better way to deal with this, possibly in the refreshToken hook. if (args?.flags?.activeMovement) { - actor.flags.activeMovement = args?.flags?.activeMovement; + actor.flags.activeMovement = args.flags.activeMovement; } that._movementRadioSelectRender(); @@ -346,15 +346,6 @@ export class HeroRuler extends Ruler { * @returns {string} * @protected */ - - /** V11 - * Get the text label for a segment of the measured path - * @param {RulerMeasurementSegment} segment - * @param {number} totalDistance - * @returns {string} - * @protected - */ - _getSegmentLabel(_segment, _totalDistance) { // second argument only provided in v11 // however total distance is avail in v12 @@ -376,7 +367,7 @@ export class HeroRuler extends Ruler { const activeMovement = movementItems.length === 0 ? "none" - : movementItems.find((o) => o._id == actor.flags.activeMovement)?._id || movementItems[0]._id; + : movementItems.find((o) => o._id === actor.flags.activeMovement)?._id || movementItems[0]._id; const activeMovementLabel = activeMovement === "none" ? "Running" : movementItems.find((e) => e._id === activeMovement)?.name; diff --git a/module/utility/chat-dice.mjs b/module/utility/chat-dice.mjs index 575c3517..c8825174 100644 --- a/module/utility/chat-dice.mjs +++ b/module/utility/chat-dice.mjs @@ -107,7 +107,7 @@ async function doRollAndGenerateChatMessage(chatMessageCmd) { const speaker = ChatMessage.getSpeaker(); const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: roller.rawRolls(), user: game.user._id, content: cardHtml, diff --git a/module/utility/presence-attack.mjs b/module/utility/presence-attack.mjs index 45258b4a..e9f41df2 100644 --- a/module/utility/presence-attack.mjs +++ b/module/utility/presence-attack.mjs @@ -37,7 +37,7 @@ async function presenceAttackRoll(actor, html) { speaker.alias = actor.name; const chatData = { - type: CONST.CHAT_MESSAGE_TYPES.ROLL, + style: CONST.CHAT_MESSAGE_STYLES.OOC, rolls: heroRoller.rawRolls(), user: game.user._id, content: cardHtml,