Translate skills for technique list
Fixed img following the technique_type
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
- Trying an autocomplete on some fields : clan, family, school, roles, demeanor.
|
- Trying an autocomplete on some fields : clan, family, school, roles, demeanor.
|
||||||
- Techniques Sheet & Compendiums :
|
- Techniques Sheet & Compendiums :
|
||||||
- Added difficulty and skill values (not to all techniques).
|
- Added difficulty and skill values (not to all techniques).
|
||||||
- Trying an autocomplete on skill(id) field.
|
- Trying an autocomplete on skill field.
|
||||||
- DicePicker :
|
- DicePicker :
|
||||||
- Added TN hidden difficulty visibility for GM (ex: ?2?).
|
- Added TN hidden difficulty visibility for GM (ex: ?2?).
|
||||||
- Added a selection for techniques with skill list.
|
- Added a selection for techniques with skill list.
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
- Fixed loading properties from custom compendiums.
|
- Fixed loading properties from custom compendiums.
|
||||||
- Added a line strike on removed/unknown property and ability to remove them.
|
- Added a line strike on removed/unknown property and ability to remove them.
|
||||||
- Added Inversion and Mantra icon and tag symbols (thanks to TesserWract).
|
- Added Inversion and Mantra icon and tag symbols (thanks to TesserWract).
|
||||||
|
- Fixed image following the technique_type on technique sheet.
|
||||||
- Fixed linked actor image compatibility with Tokenizer.
|
- Fixed linked actor image compatibility with Tokenizer.
|
||||||
- Fixed svg height/width for firefox.
|
- Fixed svg height/width for firefox.
|
||||||
|
|
||||||
@@ -44,10 +45,9 @@ Technique syntaxe "quick" explanation :
|
|||||||
- `@T:vigilance|min` : Difficulty will be the `vigilance` from the target with the minimum vigilance (implicit) value. it's the same to wrote `@T:vigilance|min(vigilance)`.
|
- `@T:vigilance|min` : Difficulty will be the `vigilance` from the target with the minimum vigilance (implicit) value. it's the same to wrote `@T:vigilance|min(vigilance)`.
|
||||||
- `@T:vigilance|max(statusRank)` : Difficulty will be the `vigilance` from the target with the maximum `statusRank` value.
|
- `@T:vigilance|max(statusRank)` : Difficulty will be the `vigilance` from the target with the maximum `statusRank` value.
|
||||||
- Skill can be :
|
- Skill can be :
|
||||||
- SkillId : `melee`, `fitness`...
|
- Skill : `melee`, `fitness`...
|
||||||
- SkillCategoryId : `scholar`, `martial`...
|
- SkillCategory : `scholar`, `martial`...
|
||||||
- Or both in list, coma separated.
|
- Or both in list, coma separated.
|
||||||
- Ids are english names in lower case, see `config.js / L5R5E.skills` for the list.
|
|
||||||
- Exemples :
|
- Exemples :
|
||||||
- `theology`
|
- `theology`
|
||||||
- `melee,ranged,unarmed`
|
- `melee,ranged,unarmed`
|
||||||
|
|||||||
33
system/assets/icons/techs/title_ability.svg
Normal file
33
system/assets/icons/techs/title_ability.svg
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
width="500px" height="500px" viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#EE6F57;}
|
||||||
|
.st1{fill:#E25749;}
|
||||||
|
.st2{fill:#FDD578;}
|
||||||
|
.st3{fill:#DCE8EF;}
|
||||||
|
.st4{fill:#425F73;}
|
||||||
|
</style>
|
||||||
|
<g>
|
||||||
|
<polygon class="st0" points="241.9,337.4 234.8,362.9 207.8,459.7 172.2,420 121.1,435.5 150.2,331.3 156.4,308.8 206.1,314.1 "/>
|
||||||
|
<polygon class="st0" points="379.1,435.5 328,420 292.4,459.7 265.3,362.9 258.2,337.4 294.1,314.1 343.8,308.8 350,331.3 "/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path class="st1" d="M206.1,314.1l35.8,23.3l-7.1,25.5c-9.8-6.3-18.9-16.4-28.7-19.6c-15.3-5-37.5,3.6-50.2-5.7
|
||||||
|
c-2.3-1.7-4.2-3.8-5.7-6.3l6.3-22.5L206.1,314.1z"/>
|
||||||
|
<path class="st1" d="M350,331.3c-1.5,2.5-3.4,4.6-5.7,6.3c-12.7,9.2-35,0.7-50.3,5.7c-9.9,3.2-18.9,13.3-28.7,19.6l-7.1-25.5
|
||||||
|
l35.8-23.3l49.7-5.3L350,331.3z"/>
|
||||||
|
</g>
|
||||||
|
<path class="st2" d="M392.4,183.7c0-16.3,15-34.8,10.2-49.5c-5-15.3-28.1-21.4-37.4-34.1c-9.3-12.8-8.1-36.7-20.9-46.1
|
||||||
|
c-12.7-9.2-35-0.7-50.2-5.7c-14.7-4.8-27.7-24.9-44-24.9s-29.3,20.1-44,24.9c-15.3,5-37.5-3.6-50.2,5.7
|
||||||
|
c-12.8,9.3-11.6,33.2-20.9,46.1c-9.2,12.7-32.4,18.8-37.4,34.1c-4.8,14.7,10.2,33.2,10.2,49.5s-15,34.8-10.2,49.5
|
||||||
|
c5,15.3,28.1,21.4,37.4,34.1c9.3,12.8,8.1,36.7,20.9,46.1c12.7,9.2,35,0.7,50.2,5.7c14.7,4.8,27.7,24.9,44,24.9s29.3-20.1,44-24.9
|
||||||
|
c15.3-5,37.5,3.6,50.2-5.7c12.8-9.3,11.6-33.2,20.9-46.1c9.2-12.7,32.4-18.8,37.4-34.1C407.4,218.6,392.4,200.1,392.4,183.7z"/>
|
||||||
|
<circle class="st3" cx="250.1" cy="183.7" r="101"/>
|
||||||
|
<g>
|
||||||
|
<rect x="213.6" y="137.1" class="st4" width="72.9" height="15"/>
|
||||||
|
<rect x="213.6" y="215.4" class="st4" width="72.9" height="15"/>
|
||||||
|
<rect x="192.9" y="176.2" class="st4" width="114.5" height="15"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -430,7 +430,7 @@ export class CharacterGenerator {
|
|||||||
*/
|
*/
|
||||||
_generateDemeanor(actorDatas) {
|
_generateDemeanor(actorDatas) {
|
||||||
// demeanor { id: "adaptable", mod: { fire: 2, earth: -2 } },
|
// demeanor { id: "adaptable", mod: { fire: 2, earth: -2 } },
|
||||||
const demeanor = CharacterGenerator._getRandomArrayValue(CONFIG.l5r5e.demeanorList);
|
const demeanor = CharacterGenerator._getRandomArrayValue(CONFIG.l5r5e.demeanors);
|
||||||
actorDatas.attitude = game.i18n.localize("l5r5e.demeanor." + demeanor.id);
|
actorDatas.attitude = game.i18n.localize("l5r5e.demeanor." + demeanor.id);
|
||||||
actorDatas.rings_affinities = foundry.utils.mergeObject(
|
actorDatas.rings_affinities = foundry.utils.mergeObject(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export class NpcSheetL5r5e extends BaseCharacterSheetL5r5e {
|
|||||||
game.l5r5e.HelpersL5r5e.autocomplete(
|
game.l5r5e.HelpersL5r5e.autocomplete(
|
||||||
html,
|
html,
|
||||||
"data.attitude",
|
"data.attitude",
|
||||||
CONFIG.l5r5e.demeanorList.map((e) => {
|
CONFIG.l5r5e.demeanors.map((e) => {
|
||||||
let modifiers = [];
|
let modifiers = [];
|
||||||
Object.entries(e.mod).forEach(([k, v]) => {
|
Object.entries(e.mod).forEach(([k, v]) => {
|
||||||
modifiers.push(`${game.i18n.localize(`l5r5e.rings.${k}`)} ${v}`);
|
modifiers.push(`${game.i18n.localize(`l5r5e.rings.${k}`)} ${v}`);
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ L5R5E.families.set("qamarist", []);
|
|||||||
L5R5E.families.set("ujik", []);
|
L5R5E.families.set("ujik", []);
|
||||||
|
|
||||||
// *** demeanor ***
|
// *** demeanor ***
|
||||||
L5R5E.demeanorList = [
|
L5R5E.demeanors = [
|
||||||
{ id: "adaptable", mod: { fire: 2, earth: -2 } },
|
{ id: "adaptable", mod: { fire: 2, earth: -2 } },
|
||||||
{ id: "adaptable", mod: { water: 2, earth: -2 } },
|
{ id: "adaptable", mod: { water: 2, earth: -2 } },
|
||||||
{ id: "aggressive", mod: { fire: 2, air: -2 } },
|
{ id: "aggressive", mod: { fire: 2, air: -2 } },
|
||||||
|
|||||||
@@ -58,6 +58,34 @@ export class HelpersL5r5e {
|
|||||||
}, new Map());
|
}, new Map());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a flat map for skill translation
|
||||||
|
* @param {boolean} bToSkillId if true flip props/values
|
||||||
|
* @return {Object}
|
||||||
|
*/
|
||||||
|
static getSkillsTranslationMap(bToSkillId) {
|
||||||
|
let map = Array.from(CONFIG.l5r5e.skills).reduce((acc, [id, cat]) => {
|
||||||
|
acc[id] = game.i18n.localize(`l5r5e.skills.${cat}.${id}`);
|
||||||
|
acc[cat] = game.i18n.localize(`l5r5e.skills.${cat}.title`);
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
if (bToSkillId) {
|
||||||
|
map = Object.entries(map).reduce((obj, [key, value]) => ({ ...obj, [value]: key }), {});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translate a list of skill and category
|
||||||
|
* @param {string[]} aIn
|
||||||
|
* @param {boolean} bToSkillId
|
||||||
|
* @return {string[]}
|
||||||
|
*/
|
||||||
|
static translateSkillsList(aIn, bToSkillId) {
|
||||||
|
const map = HelpersL5r5e.getSkillsTranslationMap(bToSkillId);
|
||||||
|
return aIn.map((skill) => map[skill.trim()]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Techniques for List / Select
|
* Get Techniques for List / Select
|
||||||
* @param types core|school|title|custom
|
* @param types core|school|title|custom
|
||||||
|
|||||||
@@ -27,8 +27,11 @@ export class TechniqueSheetL5r5e extends ItemSheetL5r5e {
|
|||||||
sheetData.data.techniquesList = game.l5r5e.HelpersL5r5e.getTechniquesList({ types });
|
sheetData.data.techniquesList = game.l5r5e.HelpersL5r5e.getTechniquesList({ types });
|
||||||
|
|
||||||
// Sanitize Difficulty and Skill list
|
// Sanitize Difficulty and Skill list
|
||||||
sheetData.data.data.skill = TechniqueSheetL5r5e.formatSkillList(sheetData.data.data.skill);
|
|
||||||
sheetData.data.data.difficulty = TechniqueSheetL5r5e.formatDifficulty(sheetData.data.data.difficulty);
|
sheetData.data.data.difficulty = TechniqueSheetL5r5e.formatDifficulty(sheetData.data.data.difficulty);
|
||||||
|
sheetData.data.data.skill = game.l5r5e.HelpersL5r5e.translateSkillsList(
|
||||||
|
TechniqueSheetL5r5e.formatSkillList(sheetData.data.data.skill.split(",")),
|
||||||
|
false
|
||||||
|
).join(", ");
|
||||||
|
|
||||||
return sheetData;
|
return sheetData;
|
||||||
}
|
}
|
||||||
@@ -41,9 +44,19 @@ export class TechniqueSheetL5r5e extends ItemSheetL5r5e {
|
|||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
async _updateObject(event, formData) {
|
async _updateObject(event, formData) {
|
||||||
|
// Change the image according to the type if this is already the case
|
||||||
|
if (
|
||||||
|
formData["data.technique_type"] &&
|
||||||
|
formData.img === `${CONFIG.l5r5e.paths.assets}icons/techs/${this.object.data.data.technique_type}.svg`
|
||||||
|
) {
|
||||||
|
formData.img = `${CONFIG.l5r5e.paths.assets}icons/techs/${formData["data.technique_type"]}.svg`;
|
||||||
|
}
|
||||||
|
|
||||||
// Sanitize Difficulty and Skill list
|
// Sanitize Difficulty and Skill list
|
||||||
formData["data.skill"] = TechniqueSheetL5r5e.formatSkillList(formData["data.skill"]);
|
|
||||||
formData["data.difficulty"] = TechniqueSheetL5r5e.formatDifficulty(formData["data.difficulty"]);
|
formData["data.difficulty"] = TechniqueSheetL5r5e.formatDifficulty(formData["data.difficulty"]);
|
||||||
|
formData["data.skill"] = TechniqueSheetL5r5e.formatSkillList(
|
||||||
|
game.l5r5e.HelpersL5r5e.translateSkillsList(formData["data.skill"].split(","), true)
|
||||||
|
).join(",");
|
||||||
|
|
||||||
return super._updateObject(event, formData);
|
return super._updateObject(event, formData);
|
||||||
}
|
}
|
||||||
@@ -62,13 +75,26 @@ export class TechniqueSheetL5r5e extends ItemSheetL5r5e {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Autocomplete
|
// Autocomplete
|
||||||
|
game.l5r5e.HelpersL5r5e.autocomplete(
|
||||||
|
html,
|
||||||
|
"data.difficulty",
|
||||||
|
[
|
||||||
|
"@T:intrigueRank",
|
||||||
|
"@T:focus",
|
||||||
|
"@T:martialRank",
|
||||||
|
"@T:statusRank|max",
|
||||||
|
"@T:strife.value|max",
|
||||||
|
"@T:vigilance",
|
||||||
|
"@T:vigilance|max",
|
||||||
|
"@T:vigilance|min",
|
||||||
|
"@T:vigilance|max(@T:statusRank)",
|
||||||
|
],
|
||||||
|
","
|
||||||
|
);
|
||||||
game.l5r5e.HelpersL5r5e.autocomplete(
|
game.l5r5e.HelpersL5r5e.autocomplete(
|
||||||
html,
|
html,
|
||||||
"data.skill",
|
"data.skill",
|
||||||
Array.from(game.l5r5e.HelpersL5r5e.getCategoriesSkillsList()).reduce((acc, [cat, skills]) => {
|
Object.values(game.l5r5e.HelpersL5r5e.getSkillsTranslationMap(false)),
|
||||||
acc.push(cat, ...skills);
|
|
||||||
return acc;
|
|
||||||
}, []),
|
|
||||||
","
|
","
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -87,8 +113,8 @@ export class TechniqueSheetL5r5e extends ItemSheetL5r5e {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sanitize the technique skill list
|
* Sanitize the technique skill list
|
||||||
* @param {string} skillList
|
* @param {string[]} skillList
|
||||||
* @return {string}
|
* @return {string[]}
|
||||||
*/
|
*/
|
||||||
static formatSkillList(skillList) {
|
static formatSkillList(skillList) {
|
||||||
if (!skillList) {
|
if (!skillList) {
|
||||||
@@ -98,18 +124,18 @@ export class TechniqueSheetL5r5e extends ItemSheetL5r5e {
|
|||||||
|
|
||||||
// List categories
|
// List categories
|
||||||
const unqCatList = new Set();
|
const unqCatList = new Set();
|
||||||
skillList.split(",").forEach((s) => {
|
skillList.forEach((s) => {
|
||||||
s = s.trim();
|
s = s?.trim();
|
||||||
if (categories.has(s)) {
|
if (!!s && categories.has(s)) {
|
||||||
unqCatList.add(s);
|
unqCatList.add(s);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// List skill (not include in cat)
|
// List skill (not include in cat)
|
||||||
const unqSkillList = new Set();
|
const unqSkillList = new Set();
|
||||||
skillList.split(",").forEach((s) => {
|
skillList.forEach((s) => {
|
||||||
s = s.trim();
|
s = s?.trim();
|
||||||
if (CONFIG.l5r5e.skills.has(s)) {
|
if (!!s && CONFIG.l5r5e.skills.has(s)) {
|
||||||
const cat = CONFIG.l5r5e.skills.get(s);
|
const cat = CONFIG.l5r5e.skills.get(s);
|
||||||
if (!unqCatList.has(cat)) {
|
if (!unqCatList.has(cat)) {
|
||||||
unqSkillList.add(s);
|
unqSkillList.add(s);
|
||||||
@@ -117,6 +143,6 @@ export class TechniqueSheetL5r5e extends ItemSheetL5r5e {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return [...unqCatList, ...unqSkillList].join(",");
|
return [...unqCatList, ...unqSkillList];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user