Skip to content

Commit

Permalink
Additional v12 deprecation adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyorl committed Mar 20, 2024
1 parent 233b6fe commit 0d9900e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
8 changes: 5 additions & 3 deletions module/applications/award.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,13 @@ export default class Award extends DialogMixin(FormApplication) {

const whisperTargets = game.users.filter(user => destination.testUserPermission(user, "OWNER"));
const whisper = whisperTargets.length !== game.users.size;
messages.push({
type: CONST.CHAT_MESSAGE_TYPES.OTHER,
const messageData = {
content,
whisper: whisper ? whisperTargets : []
});
};
// TODO: Remove when v11 support is dropped.
if ( game.release.generation < 12 ) messageData.type = CONST.CHAT_MESSAGE_TYPES.OTHER;
messages.push(messageData);
}
if ( messages.length ) cls.createDocuments(messages);
}
Expand Down
3 changes: 2 additions & 1 deletion module/dice/damage-roll.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,11 @@ export default class DamageRoll extends Roll {
// Prepare chat data
messageData = foundry.utils.mergeObject({
user: game.user.id,
type: CONST.CHAT_MESSAGE_TYPES.ROLL,
sound: CONFIG.sounds.dice
}, messageData);
messageData.rolls = rolls;
// TODO: Remove when v11 support is dropped.
if ( game.release.generation < 12 ) messageData.type = CONST.CHAT_MESSAGE_TYPES.ROLL;

// Either create the message or just return the chat data
const cls = getDocumentClass("ChatMessage");
Expand Down
5 changes: 3 additions & 2 deletions module/documents/item.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1398,11 +1398,12 @@ export default class Item5e extends SystemDocumentMixin(Item) {
// Create the ChatMessage data object
const chatData = {
user: game.user.id,
type: CONST.CHAT_MESSAGE_TYPES.OTHER,
content: html,
speaker: ChatMessage.getSpeaker({actor: this.actor, token}),
flags: {"core.canPopout": true}
};
// TODO: Remove when v11 support is dropped.
if ( game.release.generation < 12 ) chatData.type = CONST.CHAT_MESSAGE_TYPES.OTHER;

// If the Item was destroyed in the process of displaying its card - embed the item data in the chat message
if ( (this.type === "consumable") && !this.actor.items.has(this.id) ) {
Expand Down Expand Up @@ -2160,7 +2161,7 @@ export default class Item5e extends SystemDocumentMixin(Item) {
*/
static _onChatCardToggleContent(event) {
const header = event.currentTarget;
if ( header.classList.contains("collapsible") ) {
if ( header.classList.contains("collapsible") && !event.target.closest(".collapsible-content.card-content") ) {
event.preventDefault();
header.classList.toggle("collapsed");

Expand Down
3 changes: 2 additions & 1 deletion module/enrichers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,6 @@ async function rollAction(event) {
const MessageClass = getDocumentClass("ChatMessage");
const chatData = {
user: game.user.id,
type: CONST.CHAT_MESSAGE_TYPES.OTHER,
content: await renderTemplate("systems/dnd5e/templates/chat/request-card.hbs", {
buttonLabel: createRollLabel({ ...target.dataset, format: "short", icon: true }),
hiddenLabel: createRollLabel({ ...target.dataset, format: "short", icon: true, hideDC: true }),
Expand All @@ -1001,6 +1000,8 @@ async function rollAction(event) {
flavor: game.i18n.localize("EDITOR.DND5E.Inline.RollRequest"),
speaker: MessageClass.getSpeaker({user: game.user})
};
// TODO: Remove when v11 support is dropped.
if ( game.release.generation < 12 ) chatData.type = CONST.CHAT_MESSAGE_TYPES.OTHER;
return MessageClass.create(chatData);
}
}
Expand Down
2 changes: 1 addition & 1 deletion module/migration.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ export const migrateCopyActorTransferEffects = function(actor, effects, { actorU
*/
export const migrateEffectData = function(effect, migrationData, { parent }={}) {
const updateData = {};
_migrateDocumentIcon(effect, updateData, {...migrationData, field: "icon"});
_migrateDocumentIcon(effect, updateData, {...migrationData, field: game.release.generation < 12 ? "icon" : "img"});
_migrateEffectArmorClass(effect, updateData);
if ( foundry.utils.isNewerVersion("3.1.0", effect._stats?.systemVersion ?? parent?._stats?.systemVersion) ) {
_migrateTransferEffect(effect, parent, updateData);
Expand Down

0 comments on commit 0d9900e

Please sign in to comment.