2020-11-28 19:12:19 +01:00
|
|
|
/**
|
|
|
|
* Extend the basic Item.
|
|
|
|
* @extends {Item}
|
|
|
|
*/
|
|
|
|
export class ItemKH extends Item {
|
|
|
|
prepareData() {
|
|
|
|
super.prepareData();
|
|
|
|
}
|
|
|
|
|
|
|
|
async sendToChat() {
|
|
|
|
const itemData = duplicate(this.data);
|
|
|
|
|
|
|
|
if(itemData.img.includes("/mystery-man")) {
|
|
|
|
itemData.img = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
itemData.isArmor = itemData.type === "armor";
|
|
|
|
itemData.isGear = itemData.type === "gear";
|
|
|
|
itemData.isAdversaryAttack = itemData.type === "adversaryAttack";
|
|
|
|
itemData.isSkill = itemData.type === "skill";
|
|
|
|
itemData.isSpell = itemData.type === "spell";
|
|
|
|
itemData.isTalent = itemData.type === "talent";
|
|
|
|
itemData.isWeapon = itemData.type === "weapon";
|
2020-12-04 03:45:09 +01:00
|
|
|
itemData.isShipWeapon = itemData.type === "shipweapon";
|
|
|
|
itemData.isShipTalent = itemData.type === "shiptalent";
|
2020-11-28 19:12:19 +01:00
|
|
|
|
|
|
|
const html = await renderTemplate("systems/kopparhavet/templates/chat/item-card.html", itemData);
|
|
|
|
|
|
|
|
const chatData = {
|
|
|
|
user: game.user._id,
|
|
|
|
rollMode: game.settings.get("core", "rollMode"),
|
|
|
|
content: html,
|
|
|
|
};
|
|
|
|
|
|
|
|
if (["gmroll", "blindroll"].includes(chatData.rollMode)) {
|
|
|
|
chatData.whisper = ChatMessage.getWhisperRecipients("GM");
|
|
|
|
} else if (chatData.rollMode === "selfroll") {
|
|
|
|
chatData.whisper = [game.user];
|
|
|
|
}
|
|
|
|
|
|
|
|
ChatMessage.create(chatData);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare and return details of the item for display in inventory or chat.
|
|
|
|
*/
|
|
|
|
getItemDetails() {
|
|
|
|
const itemData = duplicate(this.data);
|
|
|
|
|
|
|
|
if(itemData.img.includes("/mystery-man")) {
|
|
|
|
itemData.img = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
itemData.isArmor = itemData.type === "armor";
|
|
|
|
itemData.isGear = itemData.type === "gear";
|
|
|
|
itemData.isAdversaryAttack = itemData.type === "adversaryAttack";
|
|
|
|
itemData.isSkill = itemData.type === "skill";
|
|
|
|
itemData.isSpell = itemData.type === "spell";
|
|
|
|
itemData.isTalent = itemData.type === "talent";
|
|
|
|
itemData.isWeapon = itemData.type === "weapon";
|
2020-12-04 03:45:09 +01:00
|
|
|
itemData.isShipWeapon = itemData.type === "shipweapon";
|
|
|
|
itemData.isShipTalent = itemData.type === "shiptalent";
|
2020-11-28 19:12:19 +01:00
|
|
|
|
|
|
|
return itemData
|
|
|
|
}
|
|
|
|
}
|