Update v11

This commit is contained in:
LeRatierBretonnien 2023-06-23 08:37:50 +02:00
parent 1b8e0840b0
commit 3be7f4bf9f
5 changed files with 101 additions and 36 deletions

View File

@ -1,6 +1,5 @@
import { BoLDefaultRoll } from "../controllers/bol-rolls.js"; import { BoLDefaultRoll, BoLRoll } from "../controllers/bol-rolls.js";
import { BoLUtility } from "../system/bol-utility.js"; import { BoLUtility } from "../system/bol-utility.js";
import { BoLRoll } from "../controllers/bol-rolls.js";
/** /**
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system. * Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
@ -753,7 +752,7 @@ export class BoLActor extends Actor {
/*-------------------------------------------- */ /*-------------------------------------------- */
buildListeActions() { buildListeActions() {
return this.melee.concat(this.ranged).concat(this.natural) return this.melee.concat(this.ranged).concat(this.natural).concat(this.fightoptions)
} }
/*-------------------------------------------- */ /*-------------------------------------------- */

View File

@ -64,7 +64,27 @@ export class BoLItemSheet extends ItemSheet {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_getHeaderButtons() {
let buttons = super._getHeaderButtons();
buttons.unshift({
class: "post",
icon: "fas fa-comment",
onclick: ev => this.postItem()
});
return buttons
}
/* -------------------------------------------- */
postItem() {
let chatData = duplicate(this.item)
if (this.actor) {
chatData.actor = { id: this.actor.id };
}
BoLUtility.postItem(chatData);
}
/* -------------------------------------------- */
/** @override */ /** @override */
setPosition(options = {}) { setPosition(options = {}) {
const position = super.setPosition(options); const position = super.setPosition(options);

View File

@ -1,5 +1,6 @@
/* -------------------------------------------- */ /* -------------------------------------------- */
import { BoLRoll } from "../controllers/bol-rolls.js"; import { BoLRoll } from "../controllers/bol-rolls.js";
import { BoLUtility } from "../system/bol-utility.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
export class BoLTokenHud { export class BoLTokenHud {
@ -30,9 +31,16 @@ export class BoLTokenHud {
(event) => { (event) => {
let actionIndex = Number(event.currentTarget.attributes['data-action-index'].value) let actionIndex = Number(event.currentTarget.attributes['data-action-index'].value)
let action = hudData.actionsList[actionIndex] let action = hudData.actionsList[actionIndex]
const weapon = actor.items.get( action._id ) const actionItem = actor.items.get(action._id)
BoLRoll.weaponCheckWithWeapon(hudData.actor, duplicate(weapon)) if (actionItem.system.subtype == "weapon") {
//console.log("Clicked", action) BoLRoll.weaponCheckWithWeapon(hudData.actor, duplicate(actionItem))
} else if (actionItem.system.subtype == "fightoption") {
let chatData = duplicate(actionItem)
if (actionItem.actor) {
chatData.actor = { id: actionItem.actor._id };
}
BoLUtility.postItem(chatData);
}
}) })
const controlIconTarget = html.find('.control-icon[data-action=target]'); const controlIconTarget = html.find('.control-icon[data-action=target]');

View File

@ -199,6 +199,44 @@ export class BoLUtility {
CONFIG.statusEffects = duplicate(game.bol.config.statusEffects) CONFIG.statusEffects = duplicate(game.bol.config.statusEffects)
} }
/* -------------------------------------------- */
static chatDataSetup(content, modeOverride, isRoll = false, forceWhisper) {
let chatData = {
user: game.user.id,
rollMode: modeOverride || game.settings.get("core", "rollMode"),
content: content
};
if (["gmroll", "blindroll"].includes(chatData.rollMode)) chatData["whisper"] = ChatMessage.getWhisperRecipients("GM").map(u => u.id);
if (chatData.rollMode === "blindroll") chatData["blind"] = true;
else if (chatData.rollMode === "selfroll") chatData["whisper"] = [game.user];
if (forceWhisper) { // Final force !
chatData["speaker"] = ChatMessage.getSpeaker();
chatData["whisper"] = ChatMessage.getWhisperRecipients(forceWhisper);
}
return chatData;
}
/* -------------------------------------------- */
static postItem(chatData) {
// Don't post any image for the item (which would leave a large gap) if the default image is used
if (chatData.img.includes("/blank.png")) {
chatData.img = null;
}
// JSON object for easy creation
chatData.jsondata = JSON.stringify(
{
compendium: "postedItem",
payload: chatData,
});
renderTemplate('systems/bol/templates/item/post-item.hbs', chatData).then(html => {
let chatOptions = BoLUtility.chatDataSetup(html);
ChatMessage.create(chatOptions, "selfroll")
});
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static createDirectOptionList(min, max) { static createDirectOptionList(min, max) {
let options = {}; let options = {};

View File

@ -14,7 +14,7 @@
], ],
"url": "https://www.uberwald.me/gitea/public/bol", "url": "https://www.uberwald.me/gitea/public/bol",
"license": "LICENSE.txt", "license": "LICENSE.txt",
"version": "11.0.5", "version": "11.0.6",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
"maximum": "11", "maximum": "11",
@ -203,7 +203,7 @@
], ],
"socket": true, "socket": true,
"manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json", "manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json",
"download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v11.0.5.zip", "download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v11.0.6.zip",
"background": "systems/bol/ui/page_accueil.webp", "background": "systems/bol/ui/page_accueil.webp",
"gridDistance": 1.5, "gridDistance": 1.5,
"gridUnits": "m", "gridUnits": "m",