Carrrièes, stat patch et log

This commit is contained in:
sladecraven 2022-01-30 09:18:49 +01:00
parent 222842d2e6
commit e3c9213969
7 changed files with 96 additions and 102 deletions

View File

@ -37,32 +37,6 @@ Hooks.once('init', () => {
return statParserFR( statString, type);
}
/*---------------------------------------------------------------------*/
game.wfrp4e.utility.handleConditionClick = function(event) {
let cond = $(event.currentTarget).attr("data-cond")
if (!cond)
cond = event.target.text;
cond = cond.trim();
let condkey
// En vo, les noms d'états sont égaux aux clés en minuscules
if ( game.wfrp4e.config.conditions[cond.toLowerCase()] ) {
condkey = cond.toLowerCase();
} else {
try {
condkey = game.wfrp4e.utility.findKey(cond.toLowerCase(), game.wfrp4e.config.conditions, {caseInsensitive: true});
}
catch {
ui.notifications.error("L'état est inconnu : " + cond);
}
}
let condName = game.wfrp4e.config.conditions[condkey];
let condDescr = game.wfrp4e.config.conditionDescriptions[condkey];
let messageContent = `<b>${condName}</b><br>${condDescr}`
let chatData = game.wfrp4e.utility.chatDataSetup(messageContent)
ChatMessage.create(chatData);
}
/*---------------------------------------------------------------------*/
game.wfrp4e.entities.ItemWfrp4e.prototype.computeSpellDamage = function(formula, isMagicMissile) {
try {
@ -510,3 +484,31 @@ Hooks.once('init', () => {
} );
/* -------------------------------------------- */
// Register world usage statistics
function registerUsageCount( registerKey ) {
if ( game.user.isGM ) {
game.settings.register(registerKey, "world-key", {
name: "Unique world key",
scope: "world",
config: false,
type: String
});
let worldKey = game.settings.get(registerKey, "world-key")
if ( worldKey == undefined || worldKey == "" ) {
worldKey = randomID(32)
game.settings.set(registerKey, "world-key", worldKey )
}
// Simple API counter
$.ajax(`https://jdr.lahiette.com/fvtt_appcount/count.php?name="${registerKey}"&worldKey="${worldKey}"&version="${game.release.generation}.${game.release.build}"&system="${game.system.id}"&systemversion="${game.system.data.version}"`)
/* -------------------------------------------- */
}
}
/*---------------------------------------------------------------------*/
Hooks.once('ready', () => {
registerUsageCount("wh4-fr-translation")
});

File diff suppressed because one or more lines are too long

View File

@ -1078,7 +1078,7 @@
"WFRP4E.ConditionName.Broken" : "Brisé",
"WFRP4E.ConditionName.Deafened" : "Assourdi",
"WFRP4E.ConditionName.Entangled" : "Empêtré",
"WFRP4E.ConditionName.Fatigued" : "Exténué",
"WFRP4E.ConditionName.Fatigued" : "Extenué",
"WFRP4E.ConditionName.Poisoned" : "Empoisonné",
"WFRP4E.ConditionName.Prone" : "A Terre",
"WFRP4E.ConditionName.Stunned" : "Assommé",

View File

@ -2,7 +2,7 @@
"name": "WH4-fr-translation",
"title": "WFRP4e - Core Module en français.",
"description": "Traduction Française pour Warhammer v4.",
"version": "5.0.16",
"version": "5.0.18",
"minimumCoreVersion" : "0.8.0",
"compatibleCoreVersion": "9",
"author": "LeRatierBretonnien",

View File

@ -140,36 +140,38 @@ export class WH4FRPatchConfig {
this.patch_subspecies();
this.patch_career();
game.wfrp4e.config.conditionScripts = {
"ablaze": async function (actor) {
/*game.wfrp4e.config.conditionScripts = {
"ablaze" : async function (actor) {
let effect = actor.hasCondition("ablaze")
let value = effect.conditionValue;
let leastProtectedLoc;
let leastProtectedValue = 999;
for (let loc in actor.status.armour) {
if (actor.status.armour[loc].value != undefined && actor.status.armour[loc].value < leastProtectedValue) {
leastProtectedLoc = loc;
leastProtectedValue = actor.status.armour[loc].value;
}
for (let loc in actor.status.armour)
{
if (actor.status.armour[loc].value != undefined && actor.status.armour[loc].value < leastProtectedValue)
{
leastProtectedLoc = loc;
leastProtectedValue = actor.status.armour[loc].value;
}
}
let rollString = `1d10 + ${value - 1}`
let roll = new Roll(`${rollString} - ${leastProtectedValue || 0}`).roll();
let roll = await new Roll(`${rollString} - ${leastProtectedValue || 0}`).roll();
let msg = `<h2>En Flammes</h2><b>Formule</b>: ${rollString}<br><b>Lancer</b>: ${roll.terms.map(i => i.total).splice(0, 3).join(" ")}` // Don't show AP in the roll formula
let msg = `<h2>${game.i18n.localize("WFRP4E.ConditionName.Ablaze")}</h2><b>${game.i18n.localize("Formula")}</b>: ${rollString}<br><b>${game.i18n.localize("Roll")}</b>: ${roll.terms.map(i => i.total).splice(0, 3).join(" ")}` // Don't show AP in the roll formula
actor.runEffects("preApplyCondition", { effect, data: { msg, roll, rollString } })
actor.runEffects("preApplyCondition", {effect, data : {msg, roll, rollString}})
value = effect.conditionValue;
let damageMsg = (`<br>` + await actor.applyBasicDamage(roll.total, { damageType: game.wfrp4e.config.DAMAGE_TYPE.IGNORE_AP, suppressMsg: true })).split("")
damageMsg.splice(damageMsg.length - 1, 1) // Removes the parentheses and adds + AP amount.
msg += damageMsg.join("").concat(` + ${leastProtectedValue} AP)`)
let damageMsg = (`<br>` + await actor.applyBasicDamage(roll.total, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_AP, suppressMsg : true})).split("")
damageMsg.splice(damageMsg.length-1, 1) // Removes the parentheses and adds + AP amount.
msg += damageMsg.join("").concat(` + ${leastProtectedValue} ${game.i18n.localize("AP")})`)
let messageData = game.wfrp4e.utility.chatDataSetup(msg);
messageData.speaker = { alias: actor.data.token.name }
actor.runEffects("applyCondition", { effect, data: { messageData } })
messageData.speaker = {alias: actor.data.token.name}
actor.runEffects("applyCondition", {effect, data : {messageData}})
return messageData
},
"poisoned": async function (actor) {
"poisoned": async function (actor) {
let effect = actor.hasCondition("poisoned")
let msg = `<h2>Empoisonné</h2>`
@ -217,7 +219,7 @@ export class WH4FRPatchConfig {
actor.runEffects("applyCondition", { effect, data: { messageData, bleedingRoll } })
return messageData
}
}
}*/
game.wfrp4e.config.statusEffects = [
{
@ -239,9 +241,9 @@ export class WH4FRPatchConfig {
wfrp4e: {
"trigger": "endRound",
"effectTrigger": "prefillDialog",
"script": "args.prefillModifiers.modifier -= 10 * getProperty(this.effect, 'flags.wfrp4e.value')",
"script": "args.prefillModifiers.modifier -= 10 * this.effect.conditionValue",
"value": 1
}
}
}
},
@ -280,7 +282,7 @@ export class WH4FRPatchConfig {
wfrp4e: {
"trigger": "endRound",
"effectTrigger": "prefillDialog",
"script": "args.prefillModifiers.modifier -= 10 * getProperty(this.effect, 'flags.wfrp4e.value')",
"script": "args.prefillModifiers.modifier -= 10 * this.effect.conditionValue",
"value": 1
}
}
@ -308,8 +310,8 @@ export class WH4FRPatchConfig {
flags: {
wfrp4e: {
"effectTrigger": "prefillDialog",
"script": "args.prefillModifiers.modifier -= 10 * getProperty(this.effect, 'flags.wfrp4e.value')",
"value": 1
"script": "args.prefillModifiers.modifier -= 10 * this.effect.conditionValue",
"value" : 1
}
}
},
@ -321,14 +323,14 @@ export class WH4FRPatchConfig {
wfrp4e: {
"trigger": "endRound",
"effectTrigger": "dialogChoice",
"effectData": {
"description": "Tests relatifs à la vue",
"modifier": "-10 * this.flags.wfrp4e.value"
"effectData" : {
"description" : "Tests related to sight",
"modifier" : "-10 * this.flags.wfrp4e.value"
},
"value": 1,
"secondaryEffect": {
"effectTrigger": "targetPrefillDialog",
"script": "if (args.type == 'weapon' && args.item.attackType=='melee') args.prefillModifiers.modifier += 10 * getProperty(this.effect, 'flags.wfrp4e.value')",
"secondaryEffect" :{
"effectTrigger": "targetPrefillDialog",
"script": "if (args.item && args.item.attackType=='melee') args.prefillModifiers.modifier += 10 * this.effect.conditionValue",
}
}
}
@ -340,7 +342,7 @@ export class WH4FRPatchConfig {
flags: {
wfrp4e: {
"effectTrigger": "prefillDialog",
"script": "args.prefillModifiers.modifier -= 10 * getProperty(this.effect, 'flags.wfrp4e.value')",
"script": "args.prefillModifiers.modifier -= 10 * this.effect.conditionValue",
"value": 1
}
}
@ -352,14 +354,14 @@ export class WH4FRPatchConfig {
flags: {
wfrp4e: {
"effectTrigger": "dialogChoice",
"effectData": {
"description": "Tout les tests relatifs au mouvement",
"modifier": "-20"
"effectData" : {
"description" : "Tests related to movement of any kind",
"modifier" : "-20"
},
"value": null,
"secondaryEffect": {
"effectTrigger": "targetPrefillDialog",
"script": "if (args.type == 'weapon' && args.item.attackType=='melee') args.prefillModifiers.modifier += 20",
"secondaryEffect" :{
"effectTrigger": "targetPrefillDialog",
"script": "if (args.type == 'weapon' && args.item.attackType=='melee') args.prefillModifiers.modifier += 20",
}
}
}
@ -371,16 +373,16 @@ export class WH4FRPatchConfig {
flags: {
wfrp4e: {
"effectTrigger": "dialogChoice",
"effectData": {
"description": "Tests affectés ",
"slBonus": "-1"
"effectData" : {
"description" : "Tests to affect",
"slBonus" : "-1"
},
"script": `
if (this.flags.wfrp4e.fearName)
this.flags.wfrp4e.effectData.description += " " + this.flags.wfrp4e.fearName
else
this.flags.wfrp4e.effectData.description += " la source de la Peur"
`,
"script" : `
if (this.flags.wfrp4e.fearName)
this.flags.wfrp4e.effectData.description += " " + this.flags.wfrp4e.fearName
else
this.flags.wfrp4e.effectData.description += " the source of fear"
`,
"value": null
}
}
@ -392,9 +394,9 @@ export class WH4FRPatchConfig {
flags: {
wfrp4e: {
"value": null,
"secondaryEffect": {
"effectTrigger": "targetPrefillDialog",
"script": "if (args.type == 'weapon' && args.item.attackType=='melee') args.prefillModifiers.modifier += 20",
"secondaryEffect" :{
"effectTrigger": "targetPrefillDialog",
"script": "if (args.type == 'weapon' && args.item.attackType=='melee') args.prefillModifiers.modifier += 20",
}
}
}

View File

@ -34,7 +34,7 @@ import WFRP_Utility from "/systems/wfrp4e/modules/system/utility-wfrp4e.js";
import "./xregexp-all.js";
const us_carac = 'm\\s+ws\\s+bs\\s+s\\s+t\\s+i\\s+agi?\\s+dex\\s+int\\s+\\wp\\s+fel\\s+w';
const fr_carac = 'm\\s+ws\\s+bs\\s+s\\s+t\\s+i\\s+agi?\\s+dex\\s+int\\s+\\wp\\s+fel\\s+w';
const carac_val = '(?<m>[0-9-]+)\\s+(?<ws>[0-9-]+)\\s+(?<bs>[0-9-]+)\\s+(?<s>[0-9-]+)\\s+(?<t>[0-9-]+)\\s+(?<i>[0-9-]+)\\s+(?<ag>[0-9-]+)\\s+(?<dex>[0-9-]+)\\s+(?<int>[0-9-]+)\\s+(?<wp>[0-9-]+)\\s+(?<fel>[0-9-]+)\\s+(?<w>[0-9-\*]+)';
const carac_val = '(?<m>[0-9\\-]+)\\s+(?<ws>[0-9\\-]+)\\s+(?<bs>[0-9\\-]+)\\s+(?<s>[0-9\\-]+)\\s+(?<t>[0-9\\-]+)\\s+(?<i>[0-9\\-]+)\\s+(?<ag>[0-9\\-]+)\\s+(?<dex>[0-9\\-]+)\\s+(?<int>[0-9\\-]+)\\s+(?<wp>[0-9\\-]+)\\s+(?<fel>[0-9\\-]+)\\s+(?<w>[0-9\\-\*]+)';
const name_val = '(?<name>[a-zA-Z\\s\\-,]*)[\\s\\r\\na-zA-Z]*(?<tiers>.*|[\\(\\)a-z0-9]+)';
let sectionData = [
{ name: "trait", toFind: "Traits\\s*:", secondParse: '(?<name>[a-z\\s]*)[\\s\\+]*(?<value>.*|[\\+0-9]+)', index: -1 },
@ -164,6 +164,9 @@ function __patchName ( name) {
export default async function statParserFR(statString, type = "npc") {
let model = duplicate(game.system.model.Actor[type]);
// Patch wront/strange carac value before processing
statString = statString.replace(/ /g, " 0")
let reg1 = XRegExp(us_carac, 'gi');
let res = reg1.test(statString);
if (res) { //stat block identified go on
@ -196,7 +199,8 @@ export default async function statParserFR(statString, type = "npc") {
let resCarac = XRegExp.exec(statString, reg2); // resr contains all carac found
// Setup carac
if (resCarac["Agi"]) resCarac["Ag"] = resCarac["Agi"]; // Auto patch
//console.log("CARAC", resCarac)
if (resCarac["Agi"]) resCarac["Ag"] = resCarac["Agi"] // Auto patch
model.details.move.value = Number(resCarac["m"]);
for (let key in model.characteristics) {
if (resCarac[key] === '-') resCarac[key] = 0;

View File

@ -1,14 +0,0 @@
{
"folders": [
{
"path": "."
},
{
"path": "../WFRP4e-FoundryVTT"
},
{
"path": "../../../foundry/foundrydata-dev/Data/modules/wfrp4e-core"
}
],
"settings": {}
}