From a1dc2ee0ef1ee2b5513ab62bcde3f6e7d2d74f48 Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:45:52 +0000 Subject: [PATCH 01/13] Fix CoC ID not working if using fallback translations --- module/apps/coc-id-batch.js | 3 ++- module/apps/coc-id-editor.js | 2 +- module/scripts/coc-id.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/module/apps/coc-id-batch.js b/module/apps/coc-id-batch.js index a8efaaa5..2dae4ac9 100644 --- a/module/apps/coc-id-batch.js +++ b/module/apps/coc-id-batch.js @@ -213,7 +213,8 @@ export class CoCIDBatch extends FormApplication { for (const item of items) { foundKeys[item.name] = item.flags.CoC7.cocidFlag.id } - for (const key in foundry.utils.flattenObject(game.i18n.translations.CoC7.CoCIDFlag.keys ?? {})) { + const CoCIDKeys = Object.assign(foundry.utils.flattenObject(game.i18n.translations.CoC7?.CoCIDFlag?.keys ?? {}), foundry.utils.flattenObject(game.i18n._fallback.CoC7?.CoCIDFlag?.keys ?? {})) + for (const key in CoCIDKeys) { foundKeys[game.i18n.format('CoC7.CoCIDFlag.keys.' + key)] = key } for (const name in missingNames) { diff --git a/module/apps/coc-id-editor.js b/module/apps/coc-id-editor.js index 9026d1d3..a268e3d7 100644 --- a/module/apps/coc-id-editor.js +++ b/module/apps/coc-id-editor.js @@ -42,7 +42,7 @@ export class CoCIDEditor extends FormApplication { } sheetData.eras.sort(CoC7Utilities.sortByNameKey) - const CoCIDKeys = foundry.utils.flattenObject(game.i18n.translations.CoC7.CoCIDFlag.keys ?? {}) + const CoCIDKeys = Object.assign(foundry.utils.flattenObject(game.i18n.translations.CoC7?.CoCIDFlag?.keys ?? {}), foundry.utils.flattenObject(game.i18n._fallback.CoC7?.CoCIDFlag?.keys ?? {})) const prefix = new RegExp('^' + CoC7Utilities.quoteRegExp(sheetData.idPrefix)) sheetData.existingKeys = Object.keys(CoCIDKeys).reduce((obj, k) => { if (k.match(prefix)) { diff --git a/module/scripts/coc-id.js b/module/scripts/coc-id.js index 8ec0beba..c2959444 100644 --- a/module/scripts/coc-id.js +++ b/module/scripts/coc-id.js @@ -137,7 +137,7 @@ export class CoCID { */ static findCocIdInList (cocid, list) { let itemName = '' - const CoCIDKeys = foundry.utils.flattenObject(game.i18n.translations.CoC7.CoCIDFlag.keys) + const CoCIDKeys = Object.assign(foundry.utils.flattenObject(game.i18n.translations.CoC7?.CoCIDFlag?.keys ?? {}), foundry.utils.flattenObject(game.i18n._fallback.CoC7?.CoCIDFlag?.keys ?? {})) if (typeof CoCIDKeys[cocid] !== 'undefined') { itemName = CoCIDKeys[cocid] } From 9a69cb0d151bb99918ac2b87459e00fce8b017a4 Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:49:37 +0000 Subject: [PATCH 02/13] Update CHANGELOG.md --- .github/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 6ad09ebd..f4a4c044 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -9,6 +9,8 @@ Happy gaming ! When not specified, all changes were made by @castanhocorreia, @HavlockV, and @snap01. +- Fix CoC ID not working if using fall back translations + ## Version 7.4 When not specified, all changes were made by @castanhocorreia, @HavlockV, and @snap01. From 958a5640d300a0aa88241ca81e1100a7d5e00a70 Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:07:02 +0000 Subject: [PATCH 03/13] Reverse fallback and language, to give language priority --- module/apps/coc-id-batch.js | 2 +- module/apps/coc-id-editor.js | 2 +- module/scripts/coc-id.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/apps/coc-id-batch.js b/module/apps/coc-id-batch.js index 2dae4ac9..cf5654da 100644 --- a/module/apps/coc-id-batch.js +++ b/module/apps/coc-id-batch.js @@ -213,7 +213,7 @@ export class CoCIDBatch extends FormApplication { for (const item of items) { foundKeys[item.name] = item.flags.CoC7.cocidFlag.id } - const CoCIDKeys = Object.assign(foundry.utils.flattenObject(game.i18n.translations.CoC7?.CoCIDFlag?.keys ?? {}), foundry.utils.flattenObject(game.i18n._fallback.CoC7?.CoCIDFlag?.keys ?? {})) + const CoCIDKeys = Object.assign(foundry.utils.flattenObject(game.i18n._fallback.CoC7?.CoCIDFlag?.keys ?? {}), foundry.utils.flattenObject(game.i18n.translations.CoC7?.CoCIDFlag?.keys ?? {})) for (const key in CoCIDKeys) { foundKeys[game.i18n.format('CoC7.CoCIDFlag.keys.' + key)] = key } diff --git a/module/apps/coc-id-editor.js b/module/apps/coc-id-editor.js index a268e3d7..b0d52605 100644 --- a/module/apps/coc-id-editor.js +++ b/module/apps/coc-id-editor.js @@ -42,7 +42,7 @@ export class CoCIDEditor extends FormApplication { } sheetData.eras.sort(CoC7Utilities.sortByNameKey) - const CoCIDKeys = Object.assign(foundry.utils.flattenObject(game.i18n.translations.CoC7?.CoCIDFlag?.keys ?? {}), foundry.utils.flattenObject(game.i18n._fallback.CoC7?.CoCIDFlag?.keys ?? {})) + const CoCIDKeys = Object.assign(foundry.utils.flattenObject(game.i18n._fallback.CoC7?.CoCIDFlag?.keys ?? {}), foundry.utils.flattenObject(game.i18n.translations.CoC7?.CoCIDFlag?.keys ?? {})) const prefix = new RegExp('^' + CoC7Utilities.quoteRegExp(sheetData.idPrefix)) sheetData.existingKeys = Object.keys(CoCIDKeys).reduce((obj, k) => { if (k.match(prefix)) { diff --git a/module/scripts/coc-id.js b/module/scripts/coc-id.js index c2959444..b9eedf6d 100644 --- a/module/scripts/coc-id.js +++ b/module/scripts/coc-id.js @@ -137,7 +137,7 @@ export class CoCID { */ static findCocIdInList (cocid, list) { let itemName = '' - const CoCIDKeys = Object.assign(foundry.utils.flattenObject(game.i18n.translations.CoC7?.CoCIDFlag?.keys ?? {}), foundry.utils.flattenObject(game.i18n._fallback.CoC7?.CoCIDFlag?.keys ?? {})) + const CoCIDKeys = Object.assign(foundry.utils.flattenObject(game.i18n._fallback.CoC7?.CoCIDFlag?.keys ?? {}), foundry.utils.flattenObject(game.i18n.translations.CoC7?.CoCIDFlag?.keys ?? {})) if (typeof CoCIDKeys[cocid] !== 'undefined') { itemName = CoCIDKeys[cocid] } From f87d0e9cbdce3e64dab131a87b5f689317a6221e Mon Sep 17 00:00:00 2001 From: vonv <44206935+vonv@users.noreply.github.com> Date: Thu, 14 Nov 2024 20:31:54 +0100 Subject: [PATCH 04/13] Update fr.json --- lang/fr.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lang/fr.json b/lang/fr.json index 2278493e..69799bbb 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -1364,5 +1364,11 @@ "CoC7.ErrorNoActorPermission": "Vous n'êtes pes le Proriétaire de cet Acteur", "CoC7.ErrorCombinedRollsRequireSingleActor": "Vous ne pouvez pas avoir plus d'un acteur dans un jet combiné", "CoC7.ErrorOpposedRollsLimitedToTwoActors": "Une carte de jet opposé demandes deux acteurs", - "CoC7.PauseName": "Time Stop" + "CoC7.PauseName": "Time Stop", + + "CoC7.ClickableEvents.MouseOver.Title": "Permission de cliquer", + "CoC7.ClickableEvents.MouseOver.Hint": "Renvoie un booléen si le click est permis et affiche le curseur de la souris", + "CoC7.ClickableEvents.LeftClick.Title": "Script sur Click Gauche", + "CoC7.ClickableEvents.RightClick.Title": "Script sur Click Droit", + "TYPES.RegionBehavior.coc7ClickableEvents": "Evénements clicquables" } From f718880d84c826b7cd478061ed2873febcfe1ca7 Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Fri, 22 Nov 2024 09:23:07 +0000 Subject: [PATCH 05/13] Fix manually adding sanity loss / immunity reasons --- module/apps/create-mythos-encounters.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/apps/create-mythos-encounters.js b/module/apps/create-mythos-encounters.js index 9652b2f1..c9ca389a 100644 --- a/module/apps/create-mythos-encounters.js +++ b/module/apps/create-mythos-encounters.js @@ -37,7 +37,7 @@ export class CoC7CreateMythosEncounter extends FormApplication { sanityLossEvents.sort(function (left, right) { return left.type.localeCompare(right.type) }) - this.object.actor.update({ 'data.sanityLossEvents': sanityLossEvents }) + this.object.actor.update({ 'system.sanityLossEvents': sanityLossEvents }) } this.close() } From f4279bd702d34a70698bc1e8460fd2404117b805 Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Fri, 22 Nov 2024 09:25:05 +0000 Subject: [PATCH 06/13] Updated translations list --- .github/TRANSLATIONS.md | 54 +++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/.github/TRANSLATIONS.md b/.github/TRANSLATIONS.md index d97ffa5e..d4f203c1 100644 --- a/.github/TRANSLATIONS.md +++ b/.github/TRANSLATIONS.md @@ -2,6 +2,8 @@ Thank you for being interested in making Call of Cthulhu 7th Edition for Foundry VTT better! Below is a list of translations keys on existing files that still need translated, based on `en.json`. Feel free to create a new `*.json` file for a language that is not shown here! +The **fr** translation is currently up to date + The following translations have more than 50 untranslated strings [are you able to help?](./ABANDONED.md) [cn.json (450 untranslated strings)](./ABANDONED.md#cnjson) @@ -20,32 +22,32 @@ The following translations have more than 50 untranslated strings [are you able -|Key|de|es|fr|it|ja|pl|uk| -|:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:| -|**Remaining**:|**5**|**17**|**5**|**22**|**1**|**5**|**5**| -|[CoC7.ActorCoCIDItemsActorDirectory](#coc7actorcociditemsactordirectory)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.ActorCoCIDItemsActorSheets](#coc7actorcociditemsactorsheets)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.ActorCoCIDItemsBest](#coc7actorcociditemsbest)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.ActorCoCIDItemsRules1](#coc7actorcociditemsrules1)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.ActorCoCIDItemsRules2](#coc7actorcociditemsrules2)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.ActorCoCIDItemsRules3](#coc7actorcociditemsrules3)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.ActorCoCIDItemsSceneTokens](#coc7actorcociditemsscenetokens)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.ActorCoCIDItemsUnlinkedToken](#coc7actorcociditemsunlinkedtoken)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.ActorCoCIDItemsUpdate](#coc7actorcociditemsupdate)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.ActorCoCIDItemsWarning](#coc7actorcociditemswarning)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.ActorCoCIDItemsWhich](#coc7actorcociditemswhich)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.CastHidden](#coc7casthidden)|✅|✅|✅|❌|✅|✅|✅| -|[CoC7.ClickableEvents.LeftClick.Title](#coc7clickableeventsleftclicktitle)|❌|❌|❌|❌|✅|❌|❌| -|[CoC7.ClickableEvents.MouseOver.Hint](#coc7clickableeventsmouseoverhint)|❌|❌|❌|❌|✅|❌|❌| -|[CoC7.ClickableEvents.MouseOver.Title](#coc7clickableeventsmouseovertitle)|❌|❌|❌|❌|✅|❌|❌| -|[CoC7.ClickableEvents.RightClick.Title](#coc7clickableeventsrightclicktitle)|❌|❌|❌|❌|✅|❌|❌| -|[CoC7.PauseName](#coc7pausename)|✅|❌|✅|❌|✅|✅|✅| -|[CoC7.PersonalSpecialityPlaceholder](#coc7personalspecialityplaceholder)|✅|✅|✅|✅|❌|✅|✅| -|[CoC7.SANLossFail](#coc7sanlossfail)|✅|✅|✅|❌|✅|✅|✅| -|[CoC7.SANLossPass](#coc7sanlosspass)|✅|✅|✅|❌|✅|✅|✅| -|[SETTINGS.allowMythosHardenedHint](#settingsallowmythoshardenedhint)|✅|✅|✅|❌|✅|✅|✅| -|[SETTINGS.allowMythosHardenedTitle](#settingsallowmythoshardenedtitle)|✅|✅|✅|❌|✅|✅|✅| -|[TYPES.RegionBehavior.coc7ClickableEvents](#typesregionbehaviorcoc7clickableevents)|❌|❌|❌|❌|✅|❌|❌| +|Key|de|es|it|ja|pl|uk| +|:---|:---:|:---:|:---:|:---:|:---:|:---:| +|**Remaining**:|**5**|**17**|**22**|**1**|**5**|**5**| +|[CoC7.ActorCoCIDItemsActorDirectory](#coc7actorcociditemsactordirectory)|✅|❌|❌|✅|✅|✅| +|[CoC7.ActorCoCIDItemsActorSheets](#coc7actorcociditemsactorsheets)|✅|❌|❌|✅|✅|✅| +|[CoC7.ActorCoCIDItemsBest](#coc7actorcociditemsbest)|✅|❌|❌|✅|✅|✅| +|[CoC7.ActorCoCIDItemsRules1](#coc7actorcociditemsrules1)|✅|❌|❌|✅|✅|✅| +|[CoC7.ActorCoCIDItemsRules2](#coc7actorcociditemsrules2)|✅|❌|❌|✅|✅|✅| +|[CoC7.ActorCoCIDItemsRules3](#coc7actorcociditemsrules3)|✅|❌|❌|✅|✅|✅| +|[CoC7.ActorCoCIDItemsSceneTokens](#coc7actorcociditemsscenetokens)|✅|❌|❌|✅|✅|✅| +|[CoC7.ActorCoCIDItemsUnlinkedToken](#coc7actorcociditemsunlinkedtoken)|✅|❌|❌|✅|✅|✅| +|[CoC7.ActorCoCIDItemsUpdate](#coc7actorcociditemsupdate)|✅|❌|❌|✅|✅|✅| +|[CoC7.ActorCoCIDItemsWarning](#coc7actorcociditemswarning)|✅|❌|❌|✅|✅|✅| +|[CoC7.ActorCoCIDItemsWhich](#coc7actorcociditemswhich)|✅|❌|❌|✅|✅|✅| +|[CoC7.CastHidden](#coc7casthidden)|✅|✅|❌|✅|✅|✅| +|[CoC7.ClickableEvents.LeftClick.Title](#coc7clickableeventsleftclicktitle)|❌|❌|❌|✅|❌|❌| +|[CoC7.ClickableEvents.MouseOver.Hint](#coc7clickableeventsmouseoverhint)|❌|❌|❌|✅|❌|❌| +|[CoC7.ClickableEvents.MouseOver.Title](#coc7clickableeventsmouseovertitle)|❌|❌|❌|✅|❌|❌| +|[CoC7.ClickableEvents.RightClick.Title](#coc7clickableeventsrightclicktitle)|❌|❌|❌|✅|❌|❌| +|[CoC7.PauseName](#coc7pausename)|✅|❌|❌|✅|✅|✅| +|[CoC7.PersonalSpecialityPlaceholder](#coc7personalspecialityplaceholder)|✅|✅|✅|❌|✅|✅| +|[CoC7.SANLossFail](#coc7sanlossfail)|✅|✅|❌|✅|✅|✅| +|[CoC7.SANLossPass](#coc7sanlosspass)|✅|✅|❌|✅|✅|✅| +|[SETTINGS.allowMythosHardenedHint](#settingsallowmythoshardenedhint)|✅|✅|❌|✅|✅|✅| +|[SETTINGS.allowMythosHardenedTitle](#settingsallowmythoshardenedtitle)|✅|✅|❌|✅|✅|✅| +|[TYPES.RegionBehavior.coc7ClickableEvents](#typesregionbehaviorcoc7clickableevents)|❌|❌|❌|✅|❌|❌| ##### CoC7.ActorCoCIDItemsActorDirectory ``` "CoC7.ActorCoCIDItemsActorDirectory": "Update all Actors in directory",``` ##### CoC7.ActorCoCIDItemsActorSheets From 81f94634560f70b8f74f2b2cba49f553879d8f5c Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Fri, 22 Nov 2024 09:32:03 +0000 Subject: [PATCH 07/13] Update CHANGELOG.md --- .github/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index f4a4c044..d20f207f 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -10,6 +10,8 @@ Happy gaming ! When not specified, all changes were made by @castanhocorreia, @HavlockV, and @snap01. - Fix CoC ID not working if using fall back translations +- Fix manually adding sanity loss / immunity reasons +- Update to French localization, thanks to @vonv #1634 ## Version 7.4 From 37420582af500695dbe4a1ccb81a47171fdda46b Mon Sep 17 00:00:00 2001 From: snap01 <43982555+snap01@users.noreply.github.com> Date: Sun, 1 Dec 2024 15:33:00 +0000 Subject: [PATCH 08/13] Remove bonus/penalty slider from ranged combat chat message --- lang/en.json | 2 ++ module/chat/rangecombat.js | 35 +++++++--------------- templates/chat/combat/range-initiator.html | 33 +++++++------------- 3 files changed, 24 insertions(+), 46 deletions(-) diff --git a/lang/en.json b/lang/en.json index cd3c4fe1..a16345ff 100644 --- a/lang/en.json +++ b/lang/en.json @@ -725,6 +725,8 @@ "CoC7.OpenObstacleResolutionCard": "Start obstacle resolution flow card.", "CoC7.AddBonusDie": "Add bonus die", "CoC7.RemoveBonusDie": "Remove bonus die", + "CoC7.AdditionalBonusDie": "Additional Bonus Die", + "CoC7.AdditionalPenaltyDie": "Additional Penalty Die", "CoC7.DecreaseMovementAction": "Decrease movement action", "CoC7.IncreaseMovementAction": "Increase movement action", "CoC7.CautiousApproach": "Take cautious approach", diff --git a/module/chat/rangecombat.js b/module/chat/rangecombat.js index 48a76779..9e8c91f9 100644 --- a/module/chat/rangecombat.js +++ b/module/chat/rangecombat.js @@ -13,7 +13,6 @@ export class CoC7RangeInitiator { this.cover = false this.surprised = false this.autoSuccess = false - this.diceModifier = 0 this.messageId = null this.targetCard = null this.rolled = false @@ -23,6 +22,10 @@ export class CoC7RangeInitiator { this.fullAuto = false this.tokenKey = null this.aimed = false + this.bonusDieA = false + this.bonusDieB = false + this.penaltyDieA = false + this.penaltyDieB = false this.totalBulletsFired = 0 this._targets = [] for (const t of [...game.user.targets]) { @@ -318,7 +321,7 @@ export class CoC7RangeInitiator { if (t.longRange) damage = this.weapon.system.range.long.damage if (t.extremeRange) damage = this.weapon.system.range.extreme.damage } - let modifier = parseInt(this.diceModifier, 10) + parseInt(target.modifier, 10) + let modifier = parseInt(target.modifier, 10) let difficulty this.weapon.system.properties.shotgun ? (difficulty = 1) @@ -328,6 +331,10 @@ export class CoC7RangeInitiator { if (this.reload) modifier-- if (this.multipleShots && !this.fullAuto) modifier-- if (this.fullAuto) modifier -= this.currentShotRank - 1 + if (this.bonusDieA) modifier++ + if (this.bonusDieB) modifier++ + if (this.penaltyDieA) modifier-- + if (this.penaltyDieB) modifier-- this._calculatedModifier = modifier if (modifier < -2) { const excess = Math.abs(modifier + 2) @@ -436,10 +443,6 @@ export class CoC7RangeInitiator { return 'systems/CoC7/templates/chat/combat/range-initiator.html' } - get diceModifierDisplay () { - return Math.max(-2, Math.min(2, parseInt(this.diceModifier, 10))) - } - async createChatCard () { this.calcTargetsDifficulty() const html = await renderTemplate(this.template, this) @@ -505,23 +508,7 @@ export class CoC7RangeInitiator { this.burst = !this.burst } else { this[flag] = !this[flag] - } - switch (flag) { - case 'aiming': - if (this.currentShotRank === 1) { - this.diceModifier = parseInt(this.diceModifier, 10) + (this[flag] ? 1 : -1) - } - break - case 'multipleShots': - if (!this.fullAuto) { - this.diceModifier = parseInt(this.diceModifier, 10) + (this[flag] ? -1 : 1) - } - break - case 'fullAuto': - if (!this.fullAuto) { - this.diceModifier = parseInt(this.diceModifier, 10) + (this[flag] ? -(this.currentShotRank - 1) : (this.currentShotRank - 1)) - } - break + console.log(flag, this[flag]) } } @@ -1073,7 +1060,7 @@ export class CoC7RangeTarget { this.big = false } else this.small = true } else this[flag] = !this[flag] - if (flag === 'fast' && this.fast && !this.isFast) { + if (this.actor && flag === 'fast' && this.fast && !this.isFast) { ui.notifications.warn( game.i18n.format('CoC7.WarnFastTargetWithWrongMOV', { mov: this.actor.mov diff --git a/templates/chat/combat/range-initiator.html b/templates/chat/combat/range-initiator.html index cee4d4c1..5452c905 100644 --- a/templates/chat/combat/range-initiator.html +++ b/templates/chat/combat/range-initiator.html @@ -1,4 +1,4 @@ -