forked from public/bol
Update v11
This commit is contained in:
parent
1b8e0840b0
commit
3be7f4bf9f
@ -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 { 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.
|
||||
@ -753,7 +752,7 @@ export class BoLActor extends Actor {
|
||||
|
||||
/*-------------------------------------------- */
|
||||
buildListeActions() {
|
||||
return this.melee.concat(this.ranged).concat(this.natural)
|
||||
return this.melee.concat(this.ranged).concat(this.natural).concat(this.fightoptions)
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
|
@ -27,23 +27,23 @@ export class BoLItemSheet extends ItemSheet {
|
||||
data.category = itemData.system.category
|
||||
data.isGM = game.user.isGM;
|
||||
data.itemProperties = this.item.itemProperties;
|
||||
data.description = await TextEditor.enrichHTML(this.object.system.description, {async: true})
|
||||
data.description = await TextEditor.enrichHTML(this.object.system.description, { async: true })
|
||||
|
||||
// Dynamic default data fix/adapt
|
||||
if (itemData.type == "item") {
|
||||
if (!itemData.system.category) {
|
||||
itemData.system.category = "equipment"
|
||||
}
|
||||
if ( itemData.system.category == "equipment" && itemData.system.properties.equipable) {
|
||||
if (itemData.system.category == "equipment" && itemData.system.properties.equipable) {
|
||||
if (!itemData.system.properties.slot) {
|
||||
itemData.system.properties.slot = "-"
|
||||
}
|
||||
}
|
||||
if (itemData.system.category == 'spell') {
|
||||
if(!itemData.system.properties.mandatoryconditions) {
|
||||
if (!itemData.system.properties.mandatoryconditions) {
|
||||
itemData.system.properties.mandatoryconditions = []
|
||||
}
|
||||
if(!itemData.system.properties.optionnalconditions) {
|
||||
if (!itemData.system.properties.optionnalconditions) {
|
||||
itemData.system.properties.optionnalconditions = []
|
||||
}
|
||||
for (let i = 0; i < 4; i++) {
|
||||
@ -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 */
|
||||
setPosition(options = {}) {
|
||||
const position = super.setPosition(options);
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* -------------------------------------------- */
|
||||
import { BoLRoll } from "../controllers/bol-rolls.js";
|
||||
import { BoLUtility } from "../system/bol-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class BoLTokenHud {
|
||||
@ -30,10 +31,17 @@ export class BoLTokenHud {
|
||||
(event) => {
|
||||
let actionIndex = Number(event.currentTarget.attributes['data-action-index'].value)
|
||||
let action = hudData.actionsList[actionIndex]
|
||||
const weapon = actor.items.get( action._id )
|
||||
BoLRoll.weaponCheckWithWeapon(hudData.actor, duplicate(weapon))
|
||||
//console.log("Clicked", action)
|
||||
} )
|
||||
const actionItem = actor.items.get(action._id)
|
||||
if (actionItem.system.subtype == "weapon") {
|
||||
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]');
|
||||
// att+apt+career
|
||||
@ -41,18 +49,18 @@ export class BoLTokenHud {
|
||||
(event) => {
|
||||
let rollIndex = Number(event.currentTarget.attributes['data-roll-index'].value)
|
||||
let roll = hudData.rollsList[rollIndex]
|
||||
if ( roll.type == "aptitude") {
|
||||
BoLRoll.aptitudeCheck(actor, roll.key )
|
||||
} else if ( roll.type == "attribute") {
|
||||
BoLRoll.attributeCheck(actor, roll.key )
|
||||
if (roll.type == "aptitude") {
|
||||
BoLRoll.aptitudeCheck(actor, roll.key)
|
||||
} else if (roll.type == "attribute") {
|
||||
BoLRoll.attributeCheck(actor, roll.key)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async addTokenHudExtensions(app, html, tokenId) {
|
||||
const controlIconCombat = html.find('.control-icon[data-action=combat]')
|
||||
if (controlIconCombat.length>0 ) {
|
||||
const controlIconCombat = html.find('.control-icon[data-action=combat]')
|
||||
if (controlIconCombat.length > 0) {
|
||||
BoLTokenHud.addExtensionHud(app, html, tokenId);
|
||||
}
|
||||
}
|
||||
@ -61,9 +69,9 @@ export class BoLTokenHud {
|
||||
static async _configureSubMenu(insertionPoint, template, hudData, onMenuItem) {
|
||||
const hud = $(await renderTemplate(template, hudData))
|
||||
const list = hud.find('div.bol-hud-list')
|
||||
|
||||
|
||||
BoLTokenHud._toggleHudListActive(hud, list);
|
||||
|
||||
|
||||
hud.find('img.bol-hud-togglebutton').click(event => BoLTokenHud._toggleHudListActive(hud, list));
|
||||
list.find('.bol-hud-menu').click(onMenuItem);
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { BoLRoll, BoLDefaultRoll } from "../controllers/bol-rolls.js";
|
||||
|
||||
// Spell circle to min PP cost
|
||||
const __circle2minpp = { 0: 0, 1: 2, 2: 6, 3: 11 }
|
||||
const __validDices = {"6": 1, "8": 1, "10": 1, "12": 1}
|
||||
const __validDices = { "6": 1, "8": 1, "10": 1, "12": 1 }
|
||||
export class BoLUtility {
|
||||
|
||||
|
||||
@ -41,8 +41,8 @@ export class BoLUtility {
|
||||
config: true,
|
||||
default: "6",
|
||||
type: String,
|
||||
choices: { "6": "2d6", "8":"2d8", "10":"2d10", "12":"2d12", "20":"2d20"},
|
||||
onChange: value => {
|
||||
choices: { "6": "2d6", "8": "2d8", "10": "2d10", "12": "2d12", "20": "2d20" },
|
||||
onChange: value => {
|
||||
BoLUtility.setDiceFormula(value)
|
||||
}
|
||||
})
|
||||
@ -58,7 +58,7 @@ export class BoLUtility {
|
||||
step: 1
|
||||
},
|
||||
type: Number,
|
||||
onChange: value => {
|
||||
onChange: value => {
|
||||
BoLUtility.setSuccessValue(value)
|
||||
}
|
||||
})
|
||||
@ -74,7 +74,7 @@ export class BoLUtility {
|
||||
step: 1
|
||||
},
|
||||
type: Number,
|
||||
onChange: value => {
|
||||
onChange: value => {
|
||||
BoLUtility.setCriticalSuccessValue(value)
|
||||
}
|
||||
})
|
||||
@ -90,7 +90,7 @@ export class BoLUtility {
|
||||
step: 1
|
||||
},
|
||||
type: Number,
|
||||
onChange: value => {
|
||||
onChange: value => {
|
||||
BoLUtility.setCriticalFailureValue(value)
|
||||
}
|
||||
})
|
||||
@ -153,12 +153,12 @@ export class BoLUtility {
|
||||
}
|
||||
static getDiceData() {
|
||||
let df = this.diceFormula
|
||||
if ( !__validDices[String(this.diceFormula)]) {
|
||||
if (!__validDices[String(this.diceFormula)]) {
|
||||
df = "6"
|
||||
}
|
||||
return {
|
||||
diceFormula: df,
|
||||
successValue : this.successValue,
|
||||
successValue: this.successValue,
|
||||
criticalSuccessValue: this.criticalSuccessValue,
|
||||
criticalFailureValue: this.criticalFailureValue
|
||||
}
|
||||
@ -199,6 +199,44 @@ export class BoLUtility {
|
||||
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) {
|
||||
let options = {};
|
||||
@ -314,11 +352,11 @@ export class BoLUtility {
|
||||
return message.getFlag("world", "bol-roll-data")
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static requestInitRoll(actorId, combatData ) {
|
||||
let actor = game.actors.get( actorId )
|
||||
static requestInitRoll(actorId, combatData) {
|
||||
let actor = game.actors.get(actorId)
|
||||
if (actor && actor.isOwner) {
|
||||
ui.notifications.info(game.i18n.localize("BOL.ui.warninitiative"))
|
||||
BoLRoll.aptitudeCheck(actor, "init", undefined, combatData)
|
||||
BoLRoll.aptitudeCheck(actor, "init", undefined, combatData)
|
||||
}
|
||||
}
|
||||
|
||||
@ -390,7 +428,7 @@ export class BoLUtility {
|
||||
})
|
||||
|
||||
html.on("click", '.recup-vitalite', event => {
|
||||
event.preventDefault()
|
||||
event.preventDefault()
|
||||
let actorId = event.currentTarget.attributes['data-actor-id'].value
|
||||
let recupHP = event.currentTarget.attributes['data-recup-hp'].value
|
||||
let actor = game.actors.get(actorId)
|
||||
@ -422,7 +460,7 @@ export class BoLUtility {
|
||||
rollData.defenseMode = defenseMode
|
||||
let token = game.scenes.current.tokens.get(rollData.targetId)
|
||||
let defender = token.actor
|
||||
|
||||
|
||||
if (defenseMode == 'damage-with-armor') {
|
||||
let armorFormula = defender.getArmorFormula()
|
||||
rollData.rollArmor = new Roll(armorFormula)
|
||||
@ -591,7 +629,7 @@ export class BoLUtility {
|
||||
$(`#${sockmsg.data.id}`).hide() // Hide the options roll buttons
|
||||
}
|
||||
if (sockmsg.name == "msg_request_init_roll") {
|
||||
this.requestInitRoll( sockmsg.data.actorId, sockmsg.data.combatData)
|
||||
this.requestInitRoll(sockmsg.data.actorId, sockmsg.data.combatData)
|
||||
}
|
||||
if (sockmsg.name == "msg_damage_handling") {
|
||||
BoLUtility.processDamageHandling(sockmsg.data.attackId, sockmsg.data.defenseMode, sockmsg.data.weaponId, sockmsg.data.msgId)
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "bol",
|
||||
"title": "Barbarians of Lemuria",
|
||||
"description": "The Barbarians of Lemuria system for FoundryVTT!",
|
||||
"description": "The Barbarians of Lemuria system for FoundryVTT !",
|
||||
"authors": [
|
||||
{
|
||||
"name": "LeRatierBretonnien",
|
||||
@ -14,7 +14,7 @@
|
||||
],
|
||||
"url": "https://www.uberwald.me/gitea/public/bol",
|
||||
"license": "LICENSE.txt",
|
||||
"version": "11.0.5",
|
||||
"version": "11.0.6",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"maximum": "11",
|
||||
@ -203,7 +203,7 @@
|
||||
],
|
||||
"socket": true,
|
||||
"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",
|
||||
"gridDistance": 1.5,
|
||||
"gridUnits": "m",
|
||||
|
Loading…
Reference in New Issue
Block a user