Compare commits

..

8 Commits

Author SHA1 Message Date
085265df5d initiative bugfix 2022-12-01 23:57:33 +01:00
593db9ba5b initiative bugfix 2022-12-01 23:46:27 +01:00
ac96f3ca67 Enhance initiative + fix combat 2022-11-30 20:58:27 +01:00
b2fe67ab05 Enhance tokens/actor management + auto effects 2022-11-30 12:12:44 +01:00
47178d7359 Use bougette v1.2 2022-11-29 15:23:05 +01:00
e1c7304551 Add a PC list summary 2022-11-25 20:47:28 +01:00
7b4e5bcbfa Add a PC list summary 2022-11-25 15:50:12 +01:00
31bd83b0ab Add a PC list summary 2022-11-25 15:50:07 +01:00
23 changed files with 604 additions and 104 deletions

View File

@ -442,6 +442,9 @@ ul.no-bullets {
.bol .inc-dec-btns {
color: #4b4a44;
}
.summmary-number {
padding-left: 4rem;
}
/* Items List */
.items-list {
list-style: none;
@ -519,6 +522,18 @@ ul.no-bullets {
.items-list .item .item-control {
color: #4b4a44;
}
.items-list .item-name-fixed-medium {
min-width: 8rem;
width: 8rem;
}
.items-list .item-field-fixed-short {
max-width: 3rem;
min-width: 3rem;
width: 3rem;
}
.bougette-dice-img {
color:rgba(150, 44, 44, 0.70);
}
/* ----------------------------------------- */
/* Premade colors */
@ -1053,4 +1068,10 @@ body.system-bol img#logo {
.bol-margin-tb-2 {
margin-top: 2px;
margin-bottom: 2px;
}
}
.character-summary-container {
  opacity: 0.95;
}
.character-summary-rollable {
text-decoration: underline;
}

View File

@ -172,7 +172,18 @@
"BOL.ui.boleffects": "Effets (automatiques)",
"BOL.ui.modifier": "Modificateur",
"BOL.ui.effects": "Effets en cours",
"BOL.ui.pcname": "PJs",
"BOL.ui.npcname": "PNJs",
"BOL.ui.pclistbutton": "Vue compacte",
"BOL.ui.noactorfound": "PNJ inconnu, le PNJ doit être présent dans le monde pour s'afficher ici.",
"BOL.ui.deletetitle": "Suppression",
"BOL.ui.confirmdelete": "Vous êtes sûr de vouloir supprimer cet item ?",
"BOL.ui.nomorealchemypoints": "Plus assez de Points de Création !",
"BOL.ui.armornoformula": "L'armure {protect.name} n'a pas de formule pour la protection !",
"BOL.ui.selectactor": "Selectionnez votre personnage pour utiliser la macro",
"BOL.ui.itemnotfound": "Impossible de trouver l'objet de cette macro",
"BOL.ui.noinit": "Pas d'initiative trouvée, veuillez en enregistrer une.",
"BOL.featureCategory.origins": "Origines",
"BOL.featureCategory.races": "Races",
"BOL.featureCategory.careers": "Carrières",
@ -464,7 +475,11 @@
"BOL.chat.rangenotvisible": "La ligne de vue est bloquée entre les protagonistes.",
"BOL.chat.rangetitle": "Information MJ",
"BOL.chat.weaponreroll1": "Pour information, cette arme relance les 1 sur ses dégâts.",
"BOL.chat.rollbougette": "Jet de Bougette",
"BOL.chat.bougettesuccess": "Votre bougette reste inchangée !",
"BOL.chat.bougettefailure": "Vous avez trop dépensé, votre bougette s'est réduite...",
"BOL.chat.initiative": "Rang d'intiative (10 à 1)",
"BOL.dialog.soeasy": "Inmanquable (+4)",
"BOL.dialog.veryeasy": "Trés Facile (+2)",
"BOL.dialog.easy": "Facile (+1)",

View File

@ -94,8 +94,8 @@ export class BoLActorSheet extends ActorSheet {
// Delete Inventory Item
html.find('.item-delete').click(ev => {
Dialog.confirm({
title: "Suppression",
content: `Vous êtes sûr de vouloir supprimer cet item ?`,
title: game.i18n.localize("BOL.ui.deletetitle"),
content: game.i18n.localize("BOL.ui.confirmdelete"),
yes: () => {
const li = $(ev.currentTarget).parents(".item");
this.actor.deleteEmbeddedDocuments("Item", [li.data("itemId")])
@ -141,13 +141,15 @@ export class BoLActorSheet extends ActorSheet {
formData.ammos = this.actor.ammos
formData.misc = this.actor.misc
formData.combat = this.actor.buildCombat()
formData.initiativeRank = this.actor.getInitiativeRank()
//formData.combatCreature = this.actor.buildCombatCreature()
formData.features = this.actor.buildFeatures()
formData.isGM = game.user.isGM
formData.options = this.options
formData.owner = this.document.isOwner
formData.editScore = this.options.editScore
formData.useBougette = BoLUtility.getUseBougette()
formData.useBougette = BoLUtility.getUseBougette()
formData.bougette = this.actor.getBougette()
formData.charType = this.actor.getCharType()
formData.villainy = this.actor.getVillainy()
formData.biography = await TextEditor.enrichHTML(this.object.system.details.biography, {async: true})
@ -236,6 +238,9 @@ export class BoLActorSheet extends ActorSheet {
case "attributexp":
this.actor.incAttributeXP(dataset.key)
break;
case "bougette":
this.actor.rollBougette()
break;
case "careerxp":
this.actor.incCareerXP( li.data("item-id"))
break;

View File

@ -1,5 +1,6 @@
import { BoLDefaultRoll } 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.
@ -37,6 +38,28 @@ export class BoLActor extends Actor {
return true
}
/* -------------------------------------------- */
getBougette() {
let b = duplicate(this.system.bougette)
b.label = game.i18n.localize( game.bol.config.bougetteState[String(this.system.bougette.value)] )
b.diceImg = "icons/dice/" + game.bol.config.bougetteDice[String(this.system.bougette.value)] + "black.svg"
return b
}
/* -------------------------------------------- */
async rollBougette() {
//ui.notifications.info("Roll bougette done !")
let attribute = duplicate(this.system.attributes.vigor)
let rollData = BoLRoll.getCommonRollData(this, "bougette", attribute, undefined )
rollData.formula = game.bol.config.bougetteDice[String(this.system.bougette.value)]
let r = new BoLDefaultRoll(rollData)
r.roll()
}
/* -------------------------------------------- */
decBougette() {
let bougette = duplicate(this.system.bougette)
bougette.value = Math.max( Number(bougette.value) - 1, 0)
this.update( { 'system.bougette': bougette } )
}
/* -------------------------------------------- */
updateResourcesData() {
if (this.type == 'character') {
@ -343,7 +366,7 @@ export class BoLActor extends Actor {
getDamageAttributeValue(attrDamage) {
let attrDamageValue = 0
if (attrDamage.includes("vigor")) {
attrDamageValue = actor.system.attributes.vigor.value
attrDamageValue = this.system.attributes.vigor.value
if (attrDamage.includes("half")) {
attrDamageValue = Math.floor(attrDamageValue / 2)
}
@ -405,7 +428,7 @@ export class BoLActor extends Actor {
newPC = alchemy.system.properties.pccurrent + pcCost
await this.updateEmbeddedDocuments('Item', [{ _id: alchemy.id, 'system.properties.pccurrent': newPC }])
} else {
ui.notifications.warn("Plus assez de Points de Création !")
ui.notifications.warn( game.i18n.localize("BOL.ui.nomorealchemypoints") )
}
}
}
@ -429,7 +452,7 @@ export class BoLActor extends Actor {
/*-------------------------------------------- */
heroReroll() {
if (this.villainy == 'character') {
if (this.type == 'character') {
return this.system.resources.hero.value > 0;
} else {
if (this.system.villainy == 'adversary') {
@ -595,26 +618,70 @@ export class BoLActor extends Actor {
let lastHP = await this.getFlag("world", hpID)
if (lastHP != this.system.resources.hp.value && game.user.isGM) { // Only GM sends this
await this.setFlag("world", hpID, this.system.resources.hp.value)
let prone = this.effects.find( ef => ef.label == "EFFECT.StatusProne")
let dead = this.effects.find( ef => ef.label == "EFFECT.StatusDead")
if (this.system.resources.hp.value <= 0) {
if ( !prone) {
await this.createEmbeddedDocuments("ActiveEffect", [
{label: 'EFFECT.StatusProne', icon: 'icons/svg/falling.svg', flags: { core: { statusId: 'prone' } } }
])
}
if ( this.system.resources.hp.value < -5 && !dead) {
await this.createEmbeddedDocuments("ActiveEffect", [
{label: 'EFFECT.StatusDead', icon: 'icons/svg/skull.svg', flags: { core: { statusId: 'dead' } } }
])
}
ChatMessage.create({
alias: this.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name),
content: await renderTemplate('systems/bol/templates/chat/chat-vitality-zero.hbs', { name: this.name, img: this.img, hp: this.system.resources.hp.value })
})
} else {
if ( prone ) {
await this.deleteEmbeddedDocuments("ActiveEffect", [ prone.id ] )
}
if ( dead ) {
await this.deleteEmbeddedDocuments("ActiveEffect", [ dead.id ] )
}
}
}
}
/*-------------------------------------------- */
registerInit(initScore, isCritical, isFumble) {
this.update({ 'system.combat.lastinit': initScore, 'system.combat.iscritical': isCritical, 'system.combat.isfumble': isFumble })
registerInit(rollData) {
rollData.actor = undefined // Cleanup if present
this.setFlag("world", "last-initiative", rollData)
}
/*-------------------------------------------- */
getLastInitData() {
return this.system.combat
getInitiativeRank() {
let rollData = this.getFlag("world", "last-initiative")
let fvttInit = 4 // Pietaille par defaut
if (this.type == 'character' ) {
fvttInit = 5
if (!rollData) {
fvttInit = -1
} else {
if (rollData.isLegendary) {
fvttInit = 10
} else if (rollData.isCritical) {
fvttInit = 9
} else if (rollData.isSuccess ) {
fvttInit = 8
} else if (rollData.isFumble) {
fvttInit = 3
}
}
}
if ( this.getCharType() == 'adversary') {
fvttInit = 7
}
if ( this.getCharType() == 'tough') {
fvttInit = 6
}
return fvttInit
}
/*-------------------------------------------- */
async subHeroPoints(nb) {
let newHeroP = this.system.resources.hero.value - nb;
@ -638,13 +705,13 @@ export class BoLActor extends Actor {
} else if (protect.system.subtype == 'armor') {
if (BoLUtility.getRollArmor()) {
if (!protect.system.properties.soak.formula || protect.system.properties.soak.formula == "") {
ui.notifications.warn(`L'armure ${protect.name} n'a pas de formule pour la protection !`)
ui.notifications.warn( game.i18n.localize("BOL.ui.armornoformula", protect.name) )
} else {
formula += "+" + " max(" + protect.system.properties.soak.formula + ",0)"
}
} else {
if (protect.system.properties.soak.value == undefined) {
ui.notifications.warn(`L'armure ${protect.name} n'a pas de valeur fixe pour la protection !`)
ui.notifications.warn( game.i18n.localize("BOL.ui.armornoformula", protect.name) )
} else {
formula += "+ " + protect.system.properties.soak.value
}

View File

@ -16,6 +16,7 @@ import { BoLTokenHud } from "./system/bol-action-hud.js"
import { BoLHotbar } from "./system/bol-hotbar.js"
import { BoLAdventureGenerator } from "./system/bol-adventure-generator.js"
import { BoLCommands} from "./system/bol-commands.js"
import { BoLCharacterSummary} from "./system/bol-character-summary.js"
/* -------------------------------------------- */
Hooks.once('init', async function () {
@ -40,7 +41,7 @@ Hooks.once('init', async function () {
*/
CONFIG.Combat.initiative = {
formula: "2d6+@attributes.mind.value+@aptitudes.init.value",
decimals: 3
decimals: 2
};
// Define custom Entity classes
@ -117,7 +118,10 @@ function welcomeMessage() {
/* -------------------------------------------- */
Hooks.once('ready', async function () {
BoLUtility.ready()
BoLCharacterSummary.ready()
registerUsageCount('bol')

View File

@ -36,6 +36,7 @@ export class BoLRoll {
let rollData = {
mode: mode,
actorId: actor.id,
tokenId: actor.token?.id,
img: actor.img,
attribute: attribute,
attrValue: attribute.value,
@ -352,7 +353,7 @@ export class BoLRoll {
html.find('#attr').change((event) => {
let attrKey = event.currentTarget.value
let actor = game.actors.get( this.rollData.actorId)
let actor = BoLUtility.getActorFromRollData(this.rollData)
this.rollData.attribute = duplicate(actor.system.attributes[attrKey])
this.rollData.attrValue = actor.system.attributes[attrKey].value
this.rollData.bolApplicableEffects = this.updateApplicableEffects(this.rollData)
@ -360,7 +361,7 @@ export class BoLRoll {
})
html.find('#apt').change((event) => {
let aptKey = event.currentTarget.value
let actor = game.actors.get( this.rollData.actorId)
let actor = BoLUtility.getActorFromRollData(this.rollData)
this.rollData.aptitude = duplicate(actor.system.aptitudes[aptKey])
this.rollData.aptValue = actor.system.aptitudes[aptKey].value
this.rollData.bolApplicableEffects = this.updateApplicableEffects(this.rollData)
@ -432,7 +433,7 @@ export class BoLRoll {
// initialize default flags/values
const rollOptionTpl = `systems/bol/templates/dialogs/${rollData.mode}-roll-dialog.hbs`
let actor = game.actors.get( rollData.actorId )
let actor = BoLUtility.getActorFromRollData(rollData)
let defender
if ( rollData.targetId) {
let token = game.scenes.current.tokens.get(rollData.targetId)
@ -562,14 +563,15 @@ export class BoLDefaultRoll {
//this.rollData.isRealCritical = true
//this.rollData.isFumble = true
let actor = game.actors.get( this.rollData.actorId)
let actor = BoLUtility.getActorFromRollData(this.rollData)
if (this.rollData.reroll == undefined) {
this.rollData.reroll = actor.heroReroll()
}
if (this.rollData.registerInit) {
actor.registerInit(r.total, this.rollData.isCritical, this.rollData.isFumble)
actor.registerInit(this.rollData)
this.rollData.initiativeRank = actor.getInitiativeRank()
}
if (this.rollData.isSuccess && this.rollData.mode == "spell") { // PP cost management
this.rollData.remainingPP = actor.spendPowerPoint(this.rollData.ppCost + this.rollData.ppCostArmor)
@ -577,13 +579,16 @@ export class BoLDefaultRoll {
if (this.rollData.mode == "alchemy") { // PP cost management
actor.resetAlchemyStatus(this.rollData.alchemy._id)
}
if ( this.rollData.mode == "bougette" && this.rollData.isFailure) {
actor.decBougette()
}
await this.sendChatMessage()
}
/* -------------------------------------------- */
async sendChatMessage() {
let actor = game.actors.get( this.rollData.actorId)
let actor = BoLUtility.getActorFromRollData(this.rollData)
this._buildChatMessage(this.rollData).then( async msgFlavor => {
let msg = await this.rollData.roll.toMessage({
user: game.user.id,
@ -630,7 +635,7 @@ export class BoLDefaultRoll {
/* -------------------------------------------- */
async sendDamageMessage() {
let actor = game.actors.get( this.rollData.actorId)
let actor = BoLUtility.getActorFromRollData(this.rollData)
this._buildDamageChatMessage(this.rollData).then(async msgFlavor => {
let msg = await this.rollData.damageRoll.toMessage({
user: game.user.id,
@ -645,7 +650,7 @@ export class BoLDefaultRoll {
/* -------------------------------------------- */
getDamageAttributeValue(attrDamage, actorId = undefined) {
let actor = game.actors.get( (actorId) ? actorId: this.rollData.actorId)
let actor = BoLUtility.getActorFromRollData(this.rollData)
return actor.getDamageAttributeValue( attrDamage )
}
@ -689,8 +694,8 @@ export class BoLDefaultRoll {
/* -------------------------------------------- */
_buildChatMessage(rollData) {
const rollMessageTpl = 'systems/bol/templates/chat/rolls/default-roll-card.hbs';
return renderTemplate(rollMessageTpl, rollData);
const rollMessageTpl = 'systems/bol/templates/chat/rolls/default-roll-card.hbs'
return renderTemplate(rollMessageTpl, rollData)
}
}

View File

@ -40,7 +40,7 @@ export class BoLCalendar extends Application {
constructor() {
super();
// position
this.calendarPos = duplicate(game.settings.get(SYSTEM_RDD, "calendar-pos"));
this.calendarPos = duplicate(game.settings.get("bol", "calendar-pos"));
if (this.calendarPos == undefined || this.calendarPos.top == undefined) {
this.calendrierPos = BoLCalendar.createCalendarPos()
game.settings.set("bol", "calendar-pos", this.calendarPos)

View File

@ -0,0 +1,128 @@
/* -------------------------------------------- */
import { BoLUtility } from "./bol-utility.js";
import { BoLRoll } from "../controllers/bol-rolls.js";
/* -------------------------------------------- */
export class BoLCharacterSummary extends Application {
/* -------------------------------------------- */
static displayPCSummary(){
game.bol.charSummary.render(true)
}
/* -------------------------------------------- */
static createSummaryPos() {
return { top: 200, left: 200 };
}
/* -------------------------------------------- */
static ready() {
if ( !game.user.isGM ) { // Uniquement si GM
return
}
let charSummary = new BoLCharacterSummary()
game.bol.charSummary = charSummary
}
/* -------------------------------------------- */
constructor() {
super();
//game.settings.set("world", "character-summary-data", {npcList: [], x:0, y:0})
this.settings = game.settings.get("world", "character-summary-data")
}
/* -------------------------------------------- */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
template: "systems/bol/templates/apps/character-summary-template.html",
popOut: true,
resizable: true,
dragDrop: [{ dragSelector: ".items-list .item", dropSelector: null }],
classes: ["bol", "dialog"], width: 820, height: 'fit-content'
})
}
/* -------------------------------------------- */
getData() {
let formData = super.getData();
formData.pcs = game.actors.filter( ac => ac.type == "character" && ac.hasPlayerOwner )
formData.npcs = []
let newList = []
let toUpdate = false
for( let actorId of this.settings.npcList ) {
let actor = game.actors.get(actorId)
if (actor) {
formData.npcs.push( actor )
newList.push(actorId)
} else {
toUpdate = true
}
}
formData.config = game.bol.config
if ( toUpdate ) {
this.settings.npcList = newList
//console.log("Going to update ...", this.settings)
game.settings.set("world", "character-summary-data", this.settings)
}
return formData
}
/* -------------------------------------------- */
updateNPC() {
game.settings.set("world", "character-summary-data", game.bol.charSummary.settings)
game.bol.charSummary.close()
setTimeout( function() { game.bol.charSummary.render(true)}, 500)
}
/* -------------------------------------------- */
async _onDrop(event) {
//console.log("Dragged data are : ", dragData)
let data = event.dataTransfer.getData('text/plain')
let dataItem = JSON.parse( data)
let actor = fromUuidSync(dataItem.uuid)
if (actor) {
game.bol.charSummary.settings.npcList.push( actor.id )
game.bol.charSummary.updateNPC()
} else {
ui.notifications.warn( game.i18n.localize("BOL.ui.noactorfound") )
}
}
/* -------------------------------------------- */
/** @override */
async activateListeners(html) {
super.activateListeners(html);
html.find('.actor-open').click((event) => {
const li = $(event.currentTarget).parents(".item")
const actor = game.actors.get(li.data("actor-id"))
actor.sheet.render(true)
})
html.find('.summary-roll').click((event) => {
const li = $(event.currentTarget).parents(".item")
const actor = game.actors.get(li.data("actor-id"))
let type = $(event.currentTarget).data("type")
let key = $(event.currentTarget).data("key")
if ( type == "attribute") {
BoLRoll.attributeCheck(actor, key, event)
} else if (type == "aptitude") {
BoLRoll.aptitudeCheck(actor, key, event)
}
})
html.find('.actor-delete').click(event => {
const li = $(event.currentTarget).parents(".item");
let actorId = li.data("actor-id")
let newList = game.bol.charSummary.settings.npcList.filter(id => id != actorId)
game.bol.charSummary.settings.npcList = newList
game.bol.charSummary.updateNPC()
})
}
}

View File

@ -10,6 +10,8 @@ Init order =
3 - Echec critique
*/
import { BoLUtility } from "../system/bol-utility.js";
export class BoLCombatManager extends Combat {
@ -18,35 +20,12 @@ export class BoLCombatManager extends Combat {
console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions);
// Structure input data
ids = typeof ids === "string" ? [ids] : ids;
const currentId = this.combatant._id;
//const currentId = this.combatant.id;
// calculate initiative
for (let cId = 0; cId < ids.length; cId++) {
const combatant = this.combatants.get(ids[cId]);
let fvttInit = 5
//console.log("TYPE", combatant.actor.type)
if (combatant.actor.type == 'character') {
let initData = combatant.actor.getLastInitData()
console.log("Init data !!!", initData)
if (initData.isLegendary) {
fvttInit = 10
} else if (initData.isCritical) {
fvttInit = 9
} else if (initData.lastinit >= 9) {
fvttInit = 8
} else if (initData.isFumble) {
fvttInit = 3
}
} else {
fvttInit = 4 // Pietaille par defautco
//console.log("ACTOR", combatant.actor.getCharType())
if ( combatant.actor.getCharType() == 'adversary') {
fvttInit = 7
}
if ( combatant.actor.getCharType() == 'tough') {
fvttInit = 6
}
}
const combatant = this.combatants.get(ids[cId])
let fvttInit = combatant.actor.getInitiativeRank()
fvttInit += (cId / 100)
await this.updateEmbeddedDocuments("Combatant", [{ _id: ids[cId], initiative: fvttInit }]);
}

View File

@ -1,5 +1,6 @@
/* -------------------------------------------- */
import { BoLAdventureGenerator } from "./bol-adventure-generator.js"
import { BoLCharacterSummary } from "./bol-character-summary.js"
/* -------------------------------------------- */
export class BoLCommands {
@ -8,6 +9,7 @@ export class BoLCommands {
if (!game.bol.commands) {
const bolCommands = new BoLCommands()
bolCommands.registerCommand({ path: ["/adventure"], func: (content, msg, params) => BoLAdventureGenerator.createAdventure(), descr: "Nouvelle idée d'aventure!" });
bolCommands.registerCommand({ path: ["/pcview"], func: (content, msg, params) => BoLCharacterSummary.displayPCSummary(), descr: "Affiche la liste des PJs!" });
game.bol.commands = bolCommands
}

View File

@ -48,12 +48,12 @@ export class BoLHotbar {
if (speaker.token) actor = game.actors.tokens[speaker.token]
if (!actor) actor = game.actors.get(speaker.actor)
if (!actor) {
return ui.notifications.warn(`Selectionnez votre personnage pour utiliser la macro`)
return ui.notifications.warn( game.i18n.localize("BOL.ui.selectactor") )
}
let item = actor.items.find(it => it.name === itemName && it.type == itemType)
if (!item ) {
return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`)
return ui.notifications.warn( game.i18n.localize("BOL.ui.itemnotfound") )
}
// Trigger the item roll
if (item.system.category === "equipment" && item.system.subtype === "weapon") {

View File

@ -28,6 +28,13 @@ export class BoLUtility {
type: Boolean,
onChange: lang => window.location.reload()
})
game.settings.register("world", "character-summary-data", {
name: "character-summary-data",
scope: "world",
config: false,
default: { npcList : [], x: 200, y: 200},
type: Object
})
game.settings.register("bol", "logoActorSheet", {
name: "Chemin du logo des fiches de perso",
hint: "Vous pouvez changer le logo BoL des fiches de perso, pour jouer dans un autre univers (idéalement 346 x 200, défaut : /systems/bol/ui/logo.webp)",
@ -69,11 +76,24 @@ export class BoLUtility {
static getLogoTopLeft() {
return this.logoTopLeft
}
/* -------------------------------------------- */
static getActorFromRollData(rollData) {
let actor = game.actors.get( rollData.actorId)
if (rollData.tokenId) {
let token = canvas.tokens.placeables.find(t => t.id == rollData.tokenId)
if (token) {
actor = token.actor
}
}
return actor
}
/* -------------------------------------------- */
static async ready() {
//$("#logo").attr("src", this.getLogoTopLeft() )
$("#logo").css("content",`url(${this.getLogoTopLeft()})`)
$("#logo").css("content", `url(${this.getLogoTopLeft()})`)
CONFIG.statusEffects = duplicate(game.bol.config.statusEffects)
}
/* -------------------------------------------- */
@ -158,7 +178,7 @@ export class BoLUtility {
static getOtherWhisperRecipients(name) {
let users = []
for (let user of game.users) {
if (!user.isGM && user.name != name) {
if ( !user.isGM && user.name != name) {
users.push(user.id)
}
}
@ -271,7 +291,7 @@ export class BoLUtility {
let attackId = event.currentTarget.attributes['data-attack-id'].value
let defenseMode = event.currentTarget.attributes['data-defense-mode'].value
let weaponId = (event.currentTarget.attributes['data-weapon-id']) ? event.currentTarget.attributes['data-weapon-id'].value : -1
// Remove message for all
let msgId = BoLUtility.findChatMessageId(event.currentTarget)
if (game.user.isGM) {
@ -287,7 +307,7 @@ export class BoLUtility {
if (!game.user.isGM) {
return
}
BoLUtility.removeChatMessageId( msgId )
BoLUtility.removeChatMessageId(msgId)
console.log("Damage Handling", attackId, defenseMode, weaponId)
// Only GM process this
let attackDef = this.attackStore[attackId]
@ -334,10 +354,10 @@ export class BoLUtility {
let defenderUser
for (let user of game.users) {
if ( user.character && user.character.id == defender.id ) {
if (user.character && user.character.id == defender.id) {
defenderUser = user
}
}
}
let damageResults = {
attackId: attackDef.id,
attacker: attackDef.attacker,
@ -534,31 +554,29 @@ export class BoLUtility {
}
/* -------------------------------------------- */
static async confirmDelete(actorSheet, li) {
let itemId = li.data("item-id");
let msgTxt = "<p>Are you sure to remove this Item ?";
let buttons = {
delete: {
icon: '<i class="fas fa-check"></i>',
label: "Yes, remove it",
callback: () => {
actorSheet.actor.deleteEmbeddedDocuments("Item", [itemId]);
li.slideUp(200, () => actorSheet.render(false));
}
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Cancel"
}
}
msgTxt += "</p>";
let d = new Dialog({
title: "Confirm removal",
content: msgTxt,
buttons: buttons,
default: "cancel"
});
d.render(true);
static async loadCompendiumData(compendium) {
const pack = game.packs.get(compendium);
return await pack?.getDocuments() ?? [];
}
/* -------------------------------------------- */
static async loadCompendium(compendium, filter = item => true) {
let compendiumData = await this.loadCompendiumData(compendium);
return compendiumData.filter(filter);
}
/* -------------------------------------------- */
static async searchItem(dataItem) {
let item
if (dataItem.pack) {
let id = dataItem.id || dataItem._id
let items = await this.loadCompendium(dataItem.pack, item => item.id == id)
item = items[0] || undefined
} else {
item = game.items.get(dataItem.id)
}
return item
}
}

View File

@ -115,6 +115,14 @@ BOL.aptitudes = {
"def" : "BOL.aptitudes.def"
}
BOL.resources = {
"hp" : "BOL.resources.hp",
"hero" : "BOL.resources.hero",
"faith" : "BOL.resources.faith",
"power" : "BOL.resources.power",
"alchemypoints" : "BOL.resources.alchemypoints"
}
BOL.weaponSizes = {
"unarmed" : "BOL.weaponSize.unarmed",
"improvised" : "BOL.weaponSize.improvised",
@ -289,11 +297,18 @@ BOL.actorIcons = {
}
BOL.bougetteState = {
"nomoney": "BOL.bougette.nomoney",
"tolive": "BOL.bougette.tolive",
"easylife": "BOL.bougette.easylife",
"luxury": "BOL.bougette.luxury",
"rich": "BOL.bougette.rich"
"0": "BOL.bougette.nomoney",
"1": "BOL.bougette.tolive",
"2": "BOL.bougette.easylife",
"3": "BOL.bougette.luxury",
"4": "BOL.bougette.rich"
}
BOL.bougetteDice = {
"0": "0",
"1": "2d6-1",
"2": "2d6",
"3": "2d6+1",
"4": "2d6+2"
}
BOL.creatureSize = {
@ -327,4 +342,113 @@ BOL.bolEffectModifier = {
"+6": "+6",
"+8": "+8",
}
BOL.statusEffects = [
{
"id": "dead",
"label": "EFFECT.StatusDead",
"icon": "icons/svg/skull.svg"
},
{
"id": "unconscious",
"label": "EFFECT.StatusUnconscious",
"icon": "icons/svg/unconscious.svg"
},
{
"id": "sleep",
"label": "EFFECT.StatusAsleep",
"icon": "icons/svg/sleep.svg"
},
{
"id": "stun",
"label": "EFFECT.StatusStunned",
"icon": "icons/svg/daze.svg"
},
{
"id": "prone",
"label": "EFFECT.StatusProne",
"icon": "icons/svg/falling.svg"
},
{
"id": "restrain",
"label": "EFFECT.StatusRestrained",
"icon": "icons/svg/net.svg"
},
{
"id": "paralysis",
"label": "EFFECT.StatusParalysis",
"icon": "icons/svg/paralysis.svg"
},
{
"id": "fly",
"label": "EFFECT.StatusFlying",
"icon": "icons/svg/wing.svg"
},
{
"id": "blind",
"label": "EFFECT.StatusBlind",
"icon": "icons/svg/blind.svg"
},
{
"id": "deaf",
"label": "EFFECT.StatusDeaf",
"icon": "icons/svg/deaf.svg"
},
{
"id": "silence",
"label": "EFFECT.StatusSilenced",
"icon": "icons/svg/silenced.svg"
},
{
"id": "fear",
"label": "EFFECT.StatusFear",
"icon": "icons/svg/terror.svg"
},
{
"id": "burning",
"label": "EFFECT.StatusBurning",
"icon": "icons/svg/fire.svg"
},
{
"id": "frozen",
"label": "EFFECT.StatusFrozen",
"icon": "icons/svg/frozen.svg"
},
{
"id": "shock",
"label": "EFFECT.StatusShocked",
"icon": "icons/svg/lightning.svg"
},
{
"id": "disease",
"label": "EFFECT.StatusDisease",
"icon": "icons/svg/biohazard.svg"
},
{
"id": "poison",
"label": "EFFECT.StatusPoison",
"icon": "icons/svg/poison.svg"
},
{
"id": "curse",
"label": "EFFECT.StatusCursed",
"icon": "icons/svg/sun.svg"
},
{
"id": "invisible",
"label": "EFFECT.StatusInvisible",
"icon": "icons/svg/invisible.svg"
},
{
"id": "target",
"label": "EFFECT.StatusTarget",
"icon": "icons/svg/target.svg"
},
{
"id": "eye",
"label": "EFFECT.StatusMarked",
"icon": "icons/svg/eye.svg"
}
]
BOL.debug = false;

View File

@ -103,6 +103,12 @@ export const registerHandlebarsHelpers = function () {
Handlebars.registerHelper('sub', function (a, b) {
return parseInt(a) - parseInt(b);
})
Handlebars.registerHelper('abbrev2', function (a) {
return a.substring(0,2);
})
Handlebars.registerHelper('abbrev3', function (a) {
return a.substring(0,3);
})
Handlebars.registerHelper('valueAtIndex', function (arr, idx) {
return arr[idx];
})

View File

@ -75,4 +75,18 @@ export default function registerHooks() {
}
return false;
});
/********************************************************************************** */
Hooks.on("renderActorDirectory", (app, html, data) => {
if (game.user.isGM) {
const button = document.createElement('button');
button.style.width = '95%';
button.innerHTML = game.i18n.localize("BOL.ui.pclistbutton")
button.addEventListener('click', () => {
game.bol.charSummary.render(true)
})
html.find('.header-actions').after(button)
}
})
}

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@
],
"url": "https://www.uberwald.me/gitea/public/bol",
"license": "LICENSE.txt",
"version": "10.4.2",
"version": "10.4.9",
"compatibility": {
"minimum": "10",
"verified": "10",
@ -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-v10.4.2.zip",
"download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.4.9.zip",
"background": "systems/images/map_lemurie.webp",
"gridDistance": 1.5,
"gridUnits": "m",

View File

@ -141,7 +141,8 @@
"chartype": "player",
"villainy": false,
"bougette": {
"state": "nomoney"
"state": "nomoney",
"value": 0
},
"xp": {
"key": "xp",

View File

@ -12,13 +12,20 @@
<div class="item-image"><img src="icons/containers/bags/coinpouch-simple-leather-brown.webp" title="{{localize "BOL.ui.money"}}" /></div>
{{localize "BOL.ui.money"}}
</h4>
<select class="field-value" name="system.bougette.state" data-dtype="String">
{{#select system.bougette.state}}
{{#each config.bougetteState as |value id|}}
<option value="{{id}}">{{localize value}}</option>
{{/each}}
<div class="item-image">
<a class="bougette-roll rollable" data-roll-type="bougette"><i class="darkgreen fas fa-dice"></i></a>
</div>
{{#if isGM}}
<select class="field-value" name="system.bougette.value" data-dtype="String">
{{#select bougette.value}}
{{#each config.bougetteState as |value id|}}
<option value="{{id}}">{{localize value}}</option>
{{/each}}
{{/select}}
</select>
{{else}}
<label class="">{{localize bougette.label}}</label></a>
{{/if}}
</li>
</ol>
{{/if}}

View File

@ -3,7 +3,7 @@
<div class="attribute stat flex1 flex-group-center {{key}}">
<label class="stat-label"><a class="rollable" data-roll-type="attribute" data-roll="2d6+@attributes.{{key}}.value" data-adv="0" data-key="{{key}}">{{localize label}}</a></label><br/>
<input class="stat-value rounded" type="text" name="system.attributes.{{key}}.value" value="{{numberFormat value decimals=0 sign=true}}" data-dtype="Number"/><br/>
<span class="stat-roll rollable" title="2d6" data-roll-type="attribute" data-roll="2d6+@attributes.{{key}}.value" data-adv="0" data-key="{{key}}">
<span class="stat-roll rollable" title="2d6" data-roll-type="attribute" data-roll="2d6+@attributes.{{key}}.value" data-adv="0" data-key="{{key}}">
<i class="darkgreen fas fa-dice"></i>
</span>
<span class="tooltip-container">

View File

@ -0,0 +1,85 @@
<form class="{{cssClass}} flexcol character-summary-container" autocomplete="off">
<ol class="items-list">
<li class="item flexrow item-header">
<div class="item-field item-name item-name-fixed-medium">{{localize "BOL.ui.pcname"}}</div>
{{#each config.attackAttributes as |attr key|}}
<div class="item-field flex2 item-field-fixed-short">{{abbrev3 (localize attr)}}</div>
{{/each}}
{{#each config.aptitudes as |apt key|}}
<div class="item-field flex2 item-field-fixed-short">{{abbrev3 (localize apt)}}</div>
{{/each}}
{{#each config.resources as |res key|}}
<div class="item-field flex2 item-field-fixed-short">{{abbrev3 (localize res)}}</div>
{{/each}}
<div class="item-field flex1 right">
</div>
</li>
{{#each pcs as |pc key|}}
<li class="item flexrow" data-actor-id="{{pc.id}}">
<div class="item-field item-name item-name-fixed-medium">
<a class="actor-open character-summary-rollable">{{pc.name}}</a>
</div>
{{#each pc.system.attributes as |attr key|}}
<div class="item-field flex2 item-field-fixed-short">
<a class="summary-roll character-summary-rollable" data-type="attribute" data-key="{{key}}">{{attr.value}}</a>
</div>
{{/each}}
{{#each pc.system.aptitudes as |apt key|}}
<div class="item-field flex item-field-fixed-short">
<a class="summary-roll character-summary-rollable" data-type="aptitude" data-key="{{key}}">{{apt.value}}</a>
</div>
{{/each}}
{{#each pc.system.resources as |res key|}}
<div class="item-field flex2 item-field-fixed-short">{{res.value}}/{{res.max}}</div>
{{/each}}
<div class="item-field flex1 right">
</div>
</li>
{{/each}}
<li class="item flexrow item-header">
<div class="item-field item-name item-name-fixed-medium">{{localize "BOL.ui.npcname"}}</div>
{{#each config.attackAttributes as |attr key|}}
<div class="item-field flex2 item-field-fixed-short">{{abbrev3 (localize attr)}}</div>
{{/each}}
{{#each config.aptitudes as |apt key|}}
<div class="item-field flex2 item-field-fixed-short">{{abbrev3 (localize apt)}}</div>
{{/each}}
{{#each config.resources as |res key|}}
<div class="item-field flex2 item-field-fixed-short">{{abbrev3 (localize res)}}</div>
{{/each}}
<div class="item-field flex1 right">
</div>
</li>
{{#each npcs as |pc key|}}
<li class="item flexrow" data-actor-id="{{pc.id}}">
<div class="item-field item-name item-name-fixed-medium">
<a class="actor-open character-summary-rollable">{{pc.name}}</a>
</div>
{{#each pc.system.attributes as |attr key|}}
<div class="item-field flex2 item-field-fixed-short">
<a class="summary-roll character-summary-rollable" data-type="attribute" data-key="{{key}}">{{attr.value}}</a>
</div>
{{/each}}
{{#each pc.system.aptitudes as |apt key|}}
<div class="item-field flex item-field-fixed-short">
<a class="summary-roll character-summary-rollable" data-type="aptitude" data-key="{{key}}">{{apt.value}}</a>
</div>
{{/each}}
{{#each pc.system.resources as |res key|}}
<div class="item-field flex2 item-field-fixed-short">{{res.value}}/{{res.max}}</div>
{{/each}}
<div class="item-field flex1 right">
<a class="item-control actor-delete" title="{{localize "BOL.ui.delete"}}"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ol>
</form>

View File

@ -34,8 +34,27 @@
</div>
{{/if}}
{{#if initiativeRank}}
<div>
{{localize "BOL.chat.initiative"}}: {{initiativeRank}}
</div>
{{/if}}
{{#if (eq mode "bougette")}}
<div>
{{localize "BOL.chat.rollbougette"}} :
{{#if isSuccess}}
{{localize "BOL.chat.bougettesuccess"}}
{{else}}
{{localize "BOL.chat.bougettefailure"}}
{{/if}}
</div>
{{/if}}
<div id="{{optionsId}}">
{{#if isRealCritical}}
<div class="bol-margin-tb-2">
<a class="content-link" draggable="true" data-uuid="Compendium.bol.aides-de-jeu.Yl1RKQb0BjVUtilk" data-id="Yl1RKQb0BjVUtilk" data-type="JournalEntry" data-pack="bol.aides-de-jeu" data-tooltip="un journal"><i class="fas fa-book-open"></i>Succès Héroïque</a>