Ajout du xplog

This commit is contained in:
2024-01-12 18:42:12 +01:00
parent c7c26c0033
commit 5de40d4998
117 changed files with 566 additions and 472 deletions

View File

@ -27,7 +27,7 @@ export class BoLActorSheet extends ActorSheet {
function onLoad() {
let logoSheet = BoLUtility.getLogoActorSheet()
$(".bol-actor-form").css("backgroundImage",`url(${logoSheet})`)
$(".bol-actor-form").css("backgroundImage", `url(${logoSheet})`)
}
// Setup everything onload
$(function () { onLoad(); });
@ -147,6 +147,7 @@ export class BoLActorSheet extends ActorSheet {
formData.fightoptions = this.actor.fightoptions
formData.ammos = this.actor.ammos
formData.misc = this.actor.misc
formData.xplog = this.actor.xplog
formData.combat = this.actor.buildCombat()
formData.initiativeRank = this.actor.getInitiativeRank()
//formData.combatCreature = this.actor.buildCombatCreature()
@ -155,12 +156,12 @@ export class BoLActorSheet extends ActorSheet {
formData.options = this.options
formData.owner = this.document.isOwner
formData.editScore = this.options.editScore
formData.useBougette = (this.actor.type == "character" && BoLUtility.getUseBougette()) || false
formData.useBougette = (this.actor.type == "character" && BoLUtility.getUseBougette()) || false
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})
formData.notes = await TextEditor.enrichHTML(this.object.system.details.notes || "", {async: true})
formData.villainy = this.actor.getVillainy()
formData.biography = await TextEditor.enrichHTML(this.object.system.details?.biography || "", { async: true })
formData.notes = await TextEditor.enrichHTML(this.object.system.details.notes || "", { async: true })
formData.isSorcerer = this.actor.isSorcerer()
formData.isAlchemist = this.actor.isAlchemist()
formData.isAstrologer = this.actor.isAstrologer()
@ -248,22 +249,22 @@ 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"))
this.actor.incCareerXP(li.data("item-id"))
break;
case "horoscope-minor":
BoLRoll.horoscopeCheck(this.actor, event, "minor")
break
case "horoscope-major":
BoLRoll.horoscopeCheck(this.actor, event, "major")
break
break
case "horoscope-major-group":
BoLRoll.horoscopeCheck(this.actor, event, "majorgroup")
break
break
case "bougette":
this.actor.rollBougette()
break;
default: break;
}
}

View File

@ -204,6 +204,24 @@ export class BoLActor extends Actor {
return undefined
}
/* -------------------------------------------- */
addXPLog(type, name, cost, value) {
let xplog = {
name: "XP : "+game.i18n.localize(type), type: "feature",
img: "icons/magic/symbols/chevron-elipse-circle-blue.webp",
system: {
subtype: "xplog", properties: {
xptype: type,
xpdate: new Date().toLocaleDateString(),
xpname: name,
xpcost: cost,
xpvalue: value
}
}
}
this.createEmbeddedDocuments('Item', [xplog])
}
/* -------------------------------------------- */
incAttributeXP(key) {
let attr = duplicate(this.system.attributes[key])
@ -214,6 +232,7 @@ export class BoLActor extends Actor {
attr.value += 1
xp.spent += nextXP
this.update({ [`system.attributes.${key}`]: attr, [`system.xp`]: xp })
this.addXPLog("attribute", key, nextXP, attr.value)
} else {
ui.notifications.warn("Pas assez de points d'expérience !")
}
@ -230,6 +249,7 @@ export class BoLActor extends Actor {
apt.value += 1
xp.spent += nextXP
this.update({ [`system.aptitudes.${key}`]: apt, [`system.xp`]: xp })
this.addXPLog("aptitude", key, nextXP, apt.value)
} else {
ui.notifications.warn("Pas assez de points d'expérience !")
}
@ -246,6 +266,7 @@ export class BoLActor extends Actor {
xp.spent += nextXP
this.update({ [`system.xp`]: xp })
this.updateEmbeddedDocuments('Item', [{ _id: career._id, 'system.rank': career.system.rank + 1 }])
this.addXPLog("career", career.name, nextXP, career.system.rank+1)
} else {
ui.notifications.warn("Pas assez de points d'expérience !")
}
@ -298,6 +319,9 @@ export class BoLActor extends Actor {
get boleffects() {
return this.items.filter(i => i.type === "feature" && i.system.subtype === "boleffect")
}
get xplog() {
return this.items.filter(i => i.type === "feature" && i.system.subtype === "xplog")
}
get horoscopes() {
return this.items.filter(i => i.type === "feature" && i.system.subtype === "horoscope")
}

View File

@ -15,9 +15,9 @@ import { BoLCombatManager } from "./system/bol-combat.js"
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"
import { BoLRoll} from "./controllers/bol-rolls.js"
import { BoLCommands } from "./system/bol-commands.js"
import { BoLCharacterSummary } from "./system/bol-character-summary.js"
import { BoLRoll } from "./controllers/bol-rolls.js"
/* -------------------------------------------- */
Hooks.once('init', async function () {
@ -30,7 +30,7 @@ Hooks.once('init', async function () {
macros: Macros,
config: BOL
};
// Game socket
game.socket.on("system.bol", sockmsg => {
BoLUtility.onSocketMessage(sockmsg);
@ -45,7 +45,7 @@ Hooks.once('init', async function () {
formula: "2d6+@attributes.mind.value+@aptitudes.init.value",
decimals: 2
};
// Define custom Entity classes
CONFIG.Actor.documentClass = BoLActor;
CONFIG.Item.documentClass = BoLItem;
@ -79,8 +79,8 @@ Hooks.once('init', async function () {
/* -------------------------------------------- */
// Register world usage statistics
function registerUsageCount( registerKey ) {
if ( game.user.isGM ) {
function registerUsageCount(registerKey) {
if (game.user.isGM) {
game.settings.register(registerKey, "world-key", {
name: "Unique world key",
scope: "world",
@ -90,14 +90,14 @@ function registerUsageCount( registerKey ) {
});
let worldKey = game.settings.get(registerKey, "world-key")
if ( worldKey == undefined || worldKey == "" ) {
if (worldKey == undefined || worldKey == "") {
worldKey = randomID(32)
game.settings.set(registerKey, "world-key", worldKey )
game.settings.set(registerKey, "world-key", worldKey)
}
// Simple API counter
let regURL = `https://www.uberwald.me/fvtt_appcount/count.php?name="${registerKey}"&worldKey="${worldKey}"&version="${game.release.generation}.${game.release.build}"&system="${game.system.id}"&systemversion="${game.system.version}"`
//$.ajaxSetup({
//headers: { 'Access-Control-Allow-Origin': '*' }
//headers: { 'Access-Control-Allow-Origin': '*' }
//})
$.ajax(regURL)
}
@ -110,24 +110,40 @@ function welcomeMessage() {
whisper: [game.user.id],
content: `<div id="welcome-message-pegasus"><span class="rdd-roll-part">
<strong>` + game.i18n.localize("BOL.chat.welcome1") + `</strong><p>` +
game.i18n.localize("BOL.chat.welcome2") + "<p>" +
game.i18n.localize("BOL.chat.welcome3") + "<p>" +
game.i18n.localize("BOL.chat.welcome4") + "</p>" +
game.i18n.localize("BOL.chat.welcome5") + "<br>" +
game.i18n.localize("BOL.chat.welcome6")
} )
game.i18n.localize("BOL.chat.welcome2") + "<p>" +
game.i18n.localize("BOL.chat.welcome3") + "<p>" +
game.i18n.localize("BOL.chat.welcome4") + "</p>" +
game.i18n.localize("BOL.chat.welcome5") + "<br>" +
game.i18n.localize("BOL.chat.welcome6")
})
}
/* -------------------------------------------- */
Hooks.once('ready', async function () {
BoLUtility.ready()
BoLCharacterSummary.ready()
BoLCharacterSummary.ready()
registerUsageCount(game.system.id)
welcomeMessage()
// User warning
if (!game.user.isGM && game.user.character == undefined) {
ui.notifications.info(game.i18n.localize("BOL.chat.pcwarning"));
ChatMessage.create({
content: game.i18n.localize("BOL.chat.pcwarningmsg") + game.user.name,
user: game.user._id
});
}
if (!game.user.isGM && game.user.character && !game.user.character.prototypeToken.actorLink) {
ui.notifications.info(game.i18n.localize("BOL.chat.pcnotlinked"));
ChatMessage.create({
content: game.i18n.localize("BOL.chat.pcnotlinkedmsg") + game.user.name,
user: game.user._id
});
}
})

View File

@ -28,7 +28,9 @@ export class BoLItemSheet extends ItemSheet {
data.isGM = game.user.isGM;
data.itemProperties = this.item.itemProperties;
data.description = await TextEditor.enrichHTML(this.object.system.description, { async: true })
if (data.document.actor) {
data.careers = data.document.actor.careers
}
// Dynamic default data fix/adapt
if (itemData.type == "item") {
if (!itemData.system.category) {

View File

@ -31,6 +31,15 @@ BOL.damageMultiplier = {
"8": "x8"
}
BOL.listTypes = {
"attribute": "BOL.ui.attribute",
"aptitude": "BOL.ui.aptitude",
"career": "BOL.ui.career",
"boon": "BOL.ui.boon",
"flaw": "BOL.ui.flaw",
"other": "BOL.ui.other"
}
BOL.spellType = {
"0": "BOL.spellItem.charm",
"1": "BOL.spellItem.circle1",
@ -271,6 +280,7 @@ BOL.featureSubtypes = {
"fightoption" : "BOL.featureSubtypes.fightOption",
"boleffect": "BOL.featureSubtypes.effect",
"horoscope": "BOL.featureSubtypes.horoscope",
"xplog": "BOL.featureSubtypes.xplog",
}
BOL.fightOptionTypes = {
@ -286,7 +296,7 @@ BOL.fightOptionTypes = {
BOL.itemIcons = {
"item": "icons/containers/chest/chest-worn-oak-tan.webp",
"capacity": "icons/sundries/scrolls/scroll-plain-tan-red.webp",
"feature": "icons/sundries/scrolls/scroll-plain-tan-red.webp",
"species": "icons/environment/people/group.webp",
"profile": "icons/sundries/documents/blueprint-axe.webp",
"path": "icons/sundries/books/book-embossed-gold-red.webp"

View File

@ -43,6 +43,7 @@ export const preloadHandlebarsTemplates = async function () {
"systems/bol/templates/item/parts/properties/feature/fightoption-properties.hbs",
"systems/bol/templates/item/parts/properties/item/weapon-vehicle-properties.hbs",
"systems/bol/templates/item/parts/properties/feature/horoscope-properties.hbs",
"systems/bol/templates/item/parts/properties/feature/xplog-properties.hbs",
// DIALOGS
"systems/bol/templates/chat/rolls/attack-damage-card.hbs",