Fix item rolls
parent
337f578a51
commit
e1d9c59889
|
@ -54,7 +54,9 @@ Hooks.once("init", async function () {
|
||||||
makeDefault: true,
|
makeDefault: true,
|
||||||
});
|
});
|
||||||
Items.unregisterSheet("core", ItemSheet);
|
Items.unregisterSheet("core", ItemSheet);
|
||||||
Items.registerSheet("acks", AcksItemSheet, { makeDefault: true });
|
Items.registerSheet("acks", AcksItemSheet, {
|
||||||
|
makeDefault: true,
|
||||||
|
});
|
||||||
|
|
||||||
await preloadHandlebarsTemplates();
|
await preloadHandlebarsTemplates();
|
||||||
});
|
});
|
||||||
|
@ -87,8 +89,8 @@ Hooks.on("renderSidebarTab", async (object, html) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on("createCombatant", async (combatant, options, userId) => {
|
Hooks.on("createCombatant", async (combatant, options, userId) => {
|
||||||
let init = game.settings.get("acks", "initiative");
|
const init = game.settings.get("acks", "initiative");
|
||||||
if (init == "group") {
|
if (init === "group") {
|
||||||
await AcksCombat.addCombatant(combatant, options, userId);
|
await AcksCombat.addCombatant(combatant, options, userId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
import { AcksActor } from '../actor/entity.js';
|
|
||||||
|
|
||||||
export class AcksCharacterModifiers extends FormApplication {
|
export class AcksCharacterModifiers extends FormApplication {
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
const options = super.defaultOptions;
|
const options = super.defaultOptions;
|
||||||
|
@ -29,8 +27,10 @@ export class AcksCharacterModifiers extends FormApplication {
|
||||||
* @return {Object}
|
* @return {Object}
|
||||||
*/
|
*/
|
||||||
getData() {
|
getData() {
|
||||||
let data = this.object.data;
|
const data = this.object.data;
|
||||||
|
|
||||||
data.user = game.user;
|
data.user = game.user;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
import { AcksActor } from '../actor/entity.js';
|
|
||||||
|
|
||||||
export class AcksEntityTweaks extends FormApplication {
|
export class AcksEntityTweaks extends FormApplication {
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
const options = super.defaultOptions;
|
const options = super.defaultOptions;
|
||||||
|
@ -28,12 +26,15 @@ export class AcksEntityTweaks extends FormApplication {
|
||||||
* @return {Object}
|
* @return {Object}
|
||||||
*/
|
*/
|
||||||
getData() {
|
getData() {
|
||||||
let data = this.object.data;
|
const data = this.object.data;
|
||||||
|
|
||||||
if (this.object.data.type === 'character') {
|
if (this.object.data.type === 'character') {
|
||||||
data.isCharacter = true;
|
data.isCharacter = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.user = game.user;
|
data.user = game.user;
|
||||||
data.config = CONFIG.ACKS;
|
data.config = CONFIG.ACKS;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,9 +53,11 @@ export class AcksEntityTweaks extends FormApplication {
|
||||||
*/
|
*/
|
||||||
async _updateObject(event, formData) {
|
async _updateObject(event, formData) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
// Update the actor
|
|
||||||
|
// Update the actor.
|
||||||
this.object.update(formData);
|
this.object.update(formData);
|
||||||
// Re-draw the updated sheet
|
|
||||||
|
// Render the updated sheet.
|
||||||
this.object.sheet.render(true);
|
this.object.sheet.render(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,14 @@ export class AcksPartySheet extends FormApplication {
|
||||||
const settings = {
|
const settings = {
|
||||||
ascending: game.settings.get('acks', 'ascendingAC')
|
ascending: game.settings.get('acks', 'ascendingAC')
|
||||||
};
|
};
|
||||||
let data = {
|
|
||||||
|
const data = {
|
||||||
data: this.object,
|
data: this.object,
|
||||||
config: CONFIG.ACKS,
|
config: CONFIG.ACKS,
|
||||||
user: game.user,
|
user: game.user,
|
||||||
settings: settings
|
settings: settings
|
||||||
};
|
};
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +66,7 @@ export class AcksPartySheet extends FormApplication {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
let pcs = this.object.documents.filter((actor) => {
|
let pcs = this.object.documents.filter((actor) => {
|
||||||
return actor.getFlag('acks', 'party') && actor.data.type == "character";
|
return actor.getFlag('acks', 'party') && actor.data.type === "character";
|
||||||
});
|
});
|
||||||
|
|
||||||
new Dialog({
|
new Dialog({
|
||||||
|
|
|
@ -47,8 +47,8 @@ export const registerHelpers = async function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper("getTagIcon", function (tag) {
|
Handlebars.registerHelper("getTagIcon", function (tag) {
|
||||||
let idx = Object.keys(CONFIG.ACKS.tags).find(k => (CONFIG.ACKS.tags[k] == tag));
|
const index = Object.keys(CONFIG.ACKS.tags).find(k => (CONFIG.ACKS.tags[k] == tag));
|
||||||
return CONFIG.ACKS.tag_images[idx];
|
return CONFIG.ACKS.tag_images[index];
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper("counter", function (status, value, max) {
|
Handlebars.registerHelper("counter", function (status, value, max) {
|
||||||
|
|
|
@ -280,7 +280,7 @@ export class AcksItem extends Item {
|
||||||
const token = this.actor.token;
|
const token = this.actor.token;
|
||||||
const templateData = {
|
const templateData = {
|
||||||
actor: this.actor,
|
actor: this.actor,
|
||||||
tokenId: token ? `${token.scene._id}.${token.id}` : null,
|
tokenId: token ? `${token.parent.id}.${token.id}` : null,
|
||||||
item: this.data,
|
item: this.data,
|
||||||
data: this.getChatData(),
|
data: this.getChatData(),
|
||||||
labels: this.labels,
|
labels: this.labels,
|
||||||
|
@ -297,11 +297,11 @@ export class AcksItem extends Item {
|
||||||
|
|
||||||
// Basic chat message data
|
// Basic chat message data
|
||||||
const chatData = {
|
const chatData = {
|
||||||
user: game.user._id,
|
user: game.user.id,
|
||||||
type: CONST.CHAT_MESSAGE_TYPES.OTHER,
|
type: CONST.CHAT_MESSAGE_TYPES.OTHER,
|
||||||
content: html,
|
content: html,
|
||||||
speaker: {
|
speaker: {
|
||||||
actor: this.actor._id,
|
actor: this.actor.id,
|
||||||
token: this.actor.token,
|
token: this.actor.token,
|
||||||
alias: this.actor.name,
|
alias: this.actor.name,
|
||||||
},
|
},
|
||||||
|
@ -311,7 +311,7 @@ export class AcksItem extends Item {
|
||||||
let rollMode = game.settings.get("core", "rollMode");
|
let rollMode = game.settings.get("core", "rollMode");
|
||||||
if (["gmroll", "blindroll"].includes(rollMode))
|
if (["gmroll", "blindroll"].includes(rollMode))
|
||||||
chatData["whisper"] = ChatMessage.getWhisperRecipients("GM");
|
chatData["whisper"] = ChatMessage.getWhisperRecipients("GM");
|
||||||
if (rollMode === "selfroll") chatData["whisper"] = [game.user._id];
|
if (rollMode === "selfroll") chatData["whisper"] = [game.user.id];
|
||||||
if (rollMode === "blindroll") chatData["blind"] = true;
|
if (rollMode === "blindroll") chatData["blind"] = true;
|
||||||
|
|
||||||
// Create the chat message
|
// Create the chat message
|
||||||
|
@ -395,7 +395,7 @@ export class AcksItem extends Item {
|
||||||
const [sceneId, tokenId] = tokenKey.split(".");
|
const [sceneId, tokenId] = tokenKey.split(".");
|
||||||
const scene = game.scenes.get(sceneId);
|
const scene = game.scenes.get(sceneId);
|
||||||
if (!scene) return null;
|
if (!scene) return null;
|
||||||
const tokenData = scene.getEmbeddedEntity("Token", tokenId);
|
const tokenData = scene.tokens.get(tokenId);
|
||||||
if (!tokenData) return null;
|
if (!tokenData) return null;
|
||||||
const token = new Token(tokenData);
|
const token = new Token(tokenData);
|
||||||
return token.actor;
|
return token.actor;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="acks chat-card item-card" data-actor-id="{{actor._id}}" data-item-id="{{item._id}}"
|
<div class="acks chat-card item-card" data-actor-id="{{actor.id}}" data-item-id="{{item._id}}"
|
||||||
{{#if tokenId}}data-token-id="{{tokenId}}" {{/if}}>
|
{{#if tokenId}}data-token-id="{{tokenId}}" {{/if}}>
|
||||||
<header class="card-header flexrow">
|
<header class="card-header flexrow">
|
||||||
<img src="{{item.img}}" title="{{item.name}}" width="36" height="36" />
|
<img src="{{item.img}}" title="{{item.name}}" width="36" height="36" />
|
||||||
|
|
Loading…
Reference in New Issue