Wildos
Wildos
Extends Chat Message, issue with model data
I intend to extends ChatMessage to add a field to the schema. and then add it to the renderTemplate data to be shown. But during the "getHTML" function the value that I added to the schema is always empty. Do I have to setup something else to make it reach getHTML with the proper value ? The class extending the ChatMessage
export default class MyChatMessage extends ChatMessage {
static defineSchema() {
return {
...super.defineSchema(),
postcontent: new foundry.data.fields.HTMLField({ textSearch: true }),
};
}

async getHTML() {
console.log("getHTML");
console.dir(this);
return super.getHTML();
}

}
export default class MyChatMessage extends ChatMessage {
static defineSchema() {
return {
...super.defineSchema(),
postcontent: new foundry.data.fields.HTMLField({ textSearch: true }),
};
}

async getHTML() {
console.log("getHTML");
console.dir(this);
return super.getHTML();
}

}
Inside my "init" hook
CONFIG.ChatMessage.documentClass = documents.MyChatMessage;
CONFIG.ChatMessage.template = "systems/mysystem/templates/chat_messages/chat_message.hbs";
CONFIG.ChatMessage.documentClass = documents.MyChatMessage;
CONFIG.ChatMessage.template = "systems/mysystem/templates/chat_messages/chat_message.hbs";
The calling code
ChatMessage.create({
speaker: ChatMessage.getSpeaker({ actor: this }),
user: game.user.id,
type: CONST.CHAT_MESSAGE_TYPES.ROLL,
sound: CONFIG.sounds.dice,
rolls: [roll],
content: "<div>Content</div>",
postcontent: "<div>PostContent</div>"
}, { rollMode: roll_mode });
ChatMessage.create({
speaker: ChatMessage.getSpeaker({ actor: this }),
user: game.user.id,
type: CONST.CHAT_MESSAGE_TYPES.ROLL,
sound: CONFIG.sounds.dice,
rolls: [roll],
content: "<div>Content</div>",
postcontent: "<div>PostContent</div>"
}, { rollMode: roll_mode });
7 replies
Sort items
Hello, I am searching for where is stored the data about "items" order, as I would like to order them manually in parallel of with the CSS classes "item" and "item-list". Does anyone know where the "items" order is stored?
3 replies
How to trigger "hotbarDrop" with element that are not "Item" ?
Hello, I would like to know if it is possible to trigger "hotbarDrop" with element that are not "Item". The system I create does have some mandatory skills for each "character" (type of "Actor") that are define inside the template.json. I would like to give the possibility to player to drag and drop these skill into the Macro bar so they would be able to launch them from it. For items, I found a way to make it work with "item-list" and "item" class. But i don't know how to make it work with thing that are not "Item". Can someone help me by telling me if it is possible, and if possible, point me to the documentation I need to read ?
4 replies