Skip to content

Commit

Permalink
Merge branch 'dmdorman:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
aeauseth authored Nov 9, 2024
2 parents 70b12de + 84c82d1 commit cc884b1
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 103 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 8 additions & 4 deletions module/actor/actor-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
Expand Down
11 changes: 6 additions & 5 deletions module/actor/actor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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")],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
18 changes: 6 additions & 12 deletions module/combat.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -650,8 +644,8 @@ export class HeroSystem6eCombat extends Combat {
<p>Skipping because this has already been performed on this turn during this combat.
This typically occurs when rewinding combat or during speed changes.</p>`;
const chatData = {
style: CONST.CHAT_MESSAGE_STYLES.OTHER,
user: game.user._id,
type: CONST.CHAT_MESSAGE_TYPES.OTHER,
content: content,
};

Expand Down Expand Up @@ -731,8 +725,8 @@ export class HeroSystem6eCombat extends Combat {
content += "</ul>";
contentHidden += "</ul>";
const chatData = {
style: CONST.CHAT_MESSAGE_STYLES.OTHER,
user: game.user._id,
type: CONST.CHAT_MESSAGE_TYPES.OTHER,
content: content,
};

Expand Down
8 changes: 0 additions & 8 deletions module/herosystem6e.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Loading

0 comments on commit cc884b1

Please sign in to comment.