Roll : Added target info in ChatMessage

This commit is contained in:
Vlyan
2022-02-16 17:20:56 +01:00
parent bc103c2988
commit 448fadeca7
22 changed files with 295 additions and 101 deletions

View File

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 484.227 484.227" style="enable-background:new 0 0 484.227 484.227;" xml:space="preserve">
<g>
<path d="M7.32,255.207c7.1,1.7,14.3,3.6,21.5,3.4c7.4-0.2,14.8-1.1,22.1-2.1c0.3,15.1,2.5,30.4,6.7,45.1
c6.6,23.7,18.1,46.2,33.6,65.7s34.9,36.1,56.9,48.2l16.9,8.3c5.9,2.3,11.8,4.4,17.7,6.6c6,1.8,12.2,3.3,18.3,4.9
c6.3,1.3,13,2.1,19.5,3.1l2.5,0.3h0.1c-1.4,12.9-1.6,25.8,2.2,38.7c1.2,3.9,5.8,7.1,14.8,6.8c8.3-0.3,14.4-3,15.3-7
c1.7-7.2,3.6-14.4,3.4-21.6c-0.2-5.6-0.7-11.1-1.4-16.7l4.6-0.3c1.6-0.2,3.1-0.4,4.7-0.7l9.4-1.4c6.3-0.7,12.3-2.7,18.4-4.2
c24.3-6.7,47.3-18.2,67.2-33.6c20-15.3,37-34.4,49.9-56c1.6-2.7,3.4-5.3,4.8-8.1l4.1-8.5c1.3-2.9,2.9-5.6,4-8.5l3.3-8.8
c1.1-3,2.3-5.9,3.2-8.9l2.4-9.1l2.4-9.1l1.6-9.8c0.7-3.5,0.7-7.2,0.4-10.8c14.4,1.9,28.9-0.7,43.2,1c0.9,0.1,2.4-3.4,2.9-5.8
c0.9-4.9-0.3-9-2-12.1c-5.8-10.3-12.9-14.8-20.2-16c-11.6-1.9-23.1-4.5-34.8-5c0-0.1,0-0.1,0-0.2c0.5-5.6,0.7-12.3,0.2-19.9
c-0.5-3.8-1.2-7.7-2-11.9c-0.4-2.1-0.8-4.2-1.4-6.4c-0.7-2.1-1.4-4.3-2.1-6.5c-4.8-16-12.7-30.9-21.5-45.1
c-4.9-6.8-9.5-13.9-15.2-20c-2.8-3.1-5.4-6.5-8.5-9.4l-9.2-8.7c-12.8-11-26.7-21-42.1-28.1c-7.5-4.1-15.6-6.7-23.5-9.7
c-4-1.4-8.2-2.3-12.3-3.4c-4.1-1-8.1-2.3-12.6-2.8l-10.6-1.5l-5.3-0.7h-0.3c2.6-15.2-0.3-30.5,1.4-45.7c0.1-0.9-3.4-2.4-5.8-2.9
c-4.9-0.9-9,0.3-12.1,2c-10.3,5.8-14.8,12.9-16,20.1c-1.5,8.9-3.3,17.8-4.4,26.7c-2.6,0.2-5.1,0.5-7.7,1c-6.7,1.1-13.5,2-20,4
c-26.4,6.7-51.2,19.1-72.3,36s-38.8,38.1-50.9,62.1c-2.7,6.1-5.9,12.1-8.2,18.4l-3.3,9.5l-1.7,4.8c-0.5,1.6-0.8,3.3-1.2,4.9
c-1.5,6.6-3.5,12.8-4.2,19.9c-0.6,4.7-1.4,9.6-1.8,14.2c-1.5-0.3-3-0.6-4.5-0.7c-13.7-1.7-27.4-2.2-41,1.9
c-3.9,1.2-7.1,5.8-6.8,14.8C0.62,248.107,3.32,254.207,7.32,255.207z M86.02,214.007c2.8-16.1,8-32.7,15.6-47.8
c8.5-14.5,19.2-27.6,31.4-39c24.6-23.1,56.6-37.3,89.7-41.3c-1.2,12.1-1.2,24.2,2.5,36.2c1.2,3.9,5.8,7.1,14.8,6.8
c8.3-0.3,14.4-3,15.3-7c1.7-7.1,3.6-14.4,3.4-21.5c-0.2-5-0.6-9.9-1.2-14.9c7.5,0.7,14.9,1.9,22.2,3.8l9.5,2.4l9.2,3.3l4.6,1.6
c1.5,0.6,3,1.4,4.5,2.1l8.9,4.2c11.4,6.4,22.7,13.4,32.4,22.4c10.1,8.5,18.6,18.7,26.5,29.4c3.5,5.6,7.5,10.9,10.3,17
c1.5,3,3.2,5.8,4.6,8.9l3.8,9.2c5.1,12.3,8.4,24.3,11.4,33.7c-0.7-0.1-1.5-0.3-2.2-0.3c-13.7-1.7-27.4-2.2-41.1,1.9
c-3.9,1.2-7.1,5.8-6.8,14.8c0.3,8.3,3,14.4,7,15.3c7.2,1.7,14.4,3.6,21.6,3.4c11.6-0.4,23.1-2.4,34.7-3.7c1.4,0.8,2.7,1.4,4.1,2
c-0.6,1.8-1.1,3.7-1.7,5.7c-8,25-20.5,49.7-37.8,71.8c-8.9,10.8-18.6,21.3-29.8,30.1c-5.3,4.8-11.4,8.6-17.3,12.7
c-2.9,2.1-6.2,3.6-9.3,5.5c-3.1,1.7-6.1,3.7-9.5,5.1c-15.4,7.9-32.3,12.5-49.3,14.9c-2.3,0.2-4.5,0.6-6.8,0.9
c2.5-15.1-0.4-30.3,1.3-45.4c0.1-0.9-3.4-2.4-5.8-2.9c-4.9-0.9-9,0.3-12.1,2c-10.3,5.9-14.8,13-16,20.2c-1.4,8.4-3.1,16.9-4.2,25.3
c-0.6-0.1-1.2-0.2-1.8-0.3l-6-1.1l-6-1c-2-0.4-4.1-1.1-6.1-1.7c-4.1-1.3-8.3-2-12.2-3.7l-11.9-4.6l-11.4-5.7
c-14.9-8.2-28.4-18.5-40.2-30.7c-11.7-12.2-21.2-26.4-28.6-41.4l-2.7-5.7l-1.4-2.8l-1.1-3l-4.3-11.9l-3.1-12.2
c-0.6-2-1-4.1-1.2-6.2l-0.9-6.2l-0.5-3.1c13.6,1.4,27.4-0.8,41,0.8c0.9,0.1,2.4-3.4,2.8-5.8c0.9-4.9-0.3-9-2-12.1
c-5.8-10.3-12.9-14.8-20.1-16c-7.4-1.2-14.7-2.7-22.1-3.8C85.02,220.807,85.62,217.507,86.02,214.007z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 488.842 488.842" style="enable-background:new 0 0 488.842 488.842;" xml:space="preserve">
<g>
<path d="M0,184.605h108.793v-75.813h75.808V0H0V184.605z M20.802,20.802H163.8v67.189H87.992v75.813h-67.19V20.802z"/>
<path d="M304.247,0v108.792h75.808v75.813h108.787V0H304.247z M468.041,163.804h-67.184V87.991h-75.808V20.802h142.992V163.804z"/>
<path d="M380.055,380.06h-75.808v108.783h184.595V304.246H380.055V380.06z M400.857,325.048h67.184v142.993H325.049v-67.179h75.808
V325.048z"/>
<path d="M108.793,304.246H0v184.596h184.601V380.06h-75.808V304.246z M163.8,400.861v67.179H20.802V325.048h67.19v75.813H163.8z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 808 B

View File

@@ -83,7 +83,6 @@
"region": "Region",
"upbringing": "Upbringing",
"school": "School",
"roles": "Roles",
"distinctions": "Distinctions",
"distinctionstip": "Reroll up to two dice of your choice when a distinction helps you on a check.",
"adversities": "Adversities",
@@ -554,6 +553,16 @@
"items": "Armure, Armes, et Objets",
"narrative": "Narrative (Description)"
},
"roles": {
"title": "Roles",
"artisan": "Artisan",
"bushi": "Bushi",
"courtier": "Courtier",
"monk": "Monk",
"sage": "Sage",
"shinobi": "Shinobi",
"shugenja": "Shugenja"
},
"clans": {
"title": "Clans",
"imperial": "Imperial",

View File

@@ -83,7 +83,6 @@
"region": "Region",
"upbringing": "Educación",
"school": "Escuela",
"roles": "Funciones",
"distinctions": "Distinciones",
"distinctionstip": "Puedes volver a lanzar hasta dos dados si una distinción te ayuda en la tirada.",
"adversities": "Adversidades",
@@ -554,6 +553,16 @@
"items": "Armure, Armes, et Objets",
"narrative": "Narrative (Description)"
},
"roles": {
"title": "Funciones",
"artisan": "Artisan",
"bushi": "Bushi",
"courtier": "Courtier",
"monk": "Monk",
"sage": "Sage",
"shinobi": "Shinobi",
"shugenja": "Shugenja"
},
"clans": {
"title": "Clans",
"imperial": "Imperial",

View File

@@ -82,8 +82,7 @@
"family": "Famille",
"region": "Région",
"upbringing": "Education",
"school": "Ecole",
"roles": "Rôles",
"school": "École",
"distinctions": "Aptitudes",
"distinctionstip": "Lorsque vous effectuez un test auquel s'applique une aptitude, vous pouvez relancer jusqu'à 2 dés.",
"adversities": "Coups du sort",
@@ -554,6 +553,16 @@
"items": "Armure, Armes, et Objets",
"narrative": "Narration (Description)"
},
"roles": {
"title": "Rôles",
"artisan": "Artisan",
"bushi": "Bushi",
"courtier": "Courtisan",
"monk": "Moine",
"sage": "Sage",
"shinobi": "Shinobi",
"shugenja": "Shugenja"
},
"clans": {
"title": "Clans",
"imperial": "Impérial",

View File

@@ -2,82 +2,6 @@
* L5R Character generator base object
*/
export class CharacterGenerator {
//<editor-fold desc="Config Datas">
static demeanorList = [
{ id: "adaptable", mod: { fire: 2, earth: -2 } },
{ id: "adaptable", mod: { water: 2, earth: -2 } },
{ id: "aggressive", mod: { fire: 2, air: -2 } },
{ id: "aggressive", mod: { fire: 2, water: -2 } },
{ id: "ambitious", mod: { fire: 2, water: -2 } },
{ id: "amiable", mod: { air: 2, earth: -2 } },
{ id: "analytical", mod: { fire: 2, air: -2 } },
{ id: "angry", mod: { fire: 2, air: -2 } },
{ id: "arrogant", mod: { fire: 2, water: -2 } },
{ id: "assertive", mod: { earth: 2, air: -2 } },
{ id: "assertive", mod: { earth: 2, air: 2 } },
{ id: "beguiling", mod: { air: 2, earth: -2 } },
{ id: "beguiling", mod: { fire: 2, earth: -2 } },
{ id: "bitter", mod: { fire: 2, air: -2 } },
{ id: "bold", mod: { fire: 1, earth: -1 } },
{ id: "calculating", mod: { air: 2, fire: -2 } },
{ id: "calm", mod: { fire: 2, air: -2 } },
{ id: "capricious", mod: { air: 2, earth: -2 } },
{ id: "cautious", mod: { air: 2, earth: -2 } },
{ id: "clever", mod: { air: 2, earth: -2 } },
{ id: "confused", mod: { fire: 1, void: 1, air: -2 } },
{ id: "courageous", mod: { air: 2, earth: -2 } },
{ id: "cowardly", mod: { earth: 2, fire: -2 } },
{ id: "curious", mod: { earth: 1, void: -2 } },
{ id: "curious", mod: { fire: 1, void: 1, air: -2 } },
{ id: "dependable", mod: { fire: 1, water: 1, earth: -2 } },
{ id: "detached", mod: { earth: 1, fire: 1, void: -2 } },
{ id: "disheartened", mod: { fire: 1, earth: -1 } },
{ id: "enraged", mod: { air: 1, fire: -2 } },
{ id: "feral", mod: { air: 2, fire: -2 } },
{ id: "fickle", mod: { fire: 2, air: -2 } },
{ id: "fierce", mod: { fire: 2, earth: -2 } },
{ id: "flighty", mod: { air: 2, fire: -2 } },
{ id: "flighty", mod: { water: 2, fire: -2 } },
{ id: "flippant", mod: { fire: 2, air: -2 } },
{ id: "friendly", mod: { fire: 1, earth: -2, water: -2 } },
{ id: "gruff", mod: { water: 2, earth: -2 } },
{ id: "hungry", mod: { fire: 2, air: -2 } },
{ id: "intense", mod: { air: 2, water: -2 } },
{ id: "intense", mod: { fire: 2, water: -2 } },
{ id: "intimidating", mod: { fire: 2, air: -2 } },
{ id: "irritable", mod: { fire: 2, air: -1, water: -1 } },
{ id: "loyal", mod: { air: 1, earth: -2, fire: -2 } },
{ id: "loyal", mod: { water: 2, fire: -2 } },
{ id: "mischievous", mod: { fire: 2, air: -2 } },
{ id: "mischievous", mod: { air: 2, earth: -2 } },
{ id: "mischievous", mod: { earth: 2, fire: -2 } },
{ id: "morose", mod: { water: 2, fire: -2 } },
{ id: "nurturing", mod: { earth: 2, fire: -2 } },
{ id: "obstinate", mod: { earth: 2, air: -2 } },
{ id: "obstinate", mod: { water: 2, air: -2 } },
{ id: "opportunistic", mod: { water: 2, fire: -2 } },
{ id: "passionate", mod: { earth: 2, air: -2 } },
{ id: "playful", mod: { earth: 2, water: -2 } },
{ id: "playful", mod: { fire: 1, air: 1, void: -2 } },
{ id: "power_hungry", mod: { fire: 2, earth: -2 } },
{ id: "proud", mod: { fire: 2, earth: -2 } },
{ id: "restrained", mod: { earth: 2, air: -2 } },
{ id: "scheming", mod: { air: 2, void: -2 } },
{ id: "serene", mod: { fire: 2, void: -2 } },
{ id: "serene", mod: { void: 2, fire: -2 } },
{ id: "serious", mod: { fire: 2, earth: -2 } },
{ id: "shrewd", mod: { air: 2, fire: -2 } },
{ id: "stubborn", mod: { earth: 2, water: -2 } },
{ id: "suspicious", mod: { air: 2, earth: -2 } },
{ id: "teasing", mod: { air: 2, earth: -2 } },
{ id: "territorial", mod: { fire: 2, air: -2 } },
{ id: "uncertain", mod: { air: 2, fire: -2 } },
{ id: "unenthused", mod: { earth: 2, fire: -2 } },
{ id: "vain", mod: { earth: 2, air: -2 } },
{ id: "wary", mod: { earth: 2, fire: -2 } },
];
//</editor-fold>
/**
* Payload Object
*/
@@ -464,7 +388,7 @@ export class CharacterGenerator {
*/
_generateDemeanor(actorDatas) {
// demeanor { id: "adaptable", mod: { fire: 2, earth: -2 } },
const demeanor = CharacterGenerator._getRandomArrayValue(CharacterGenerator.demeanorList);
const demeanor = CharacterGenerator._getRandomArrayValue(CONFIG.l5r5e.demeanorList);
actorDatas.attitude = game.i18n.localize("l5r5e.demeanor." + demeanor.id);
actorDatas.rings_affinities = foundry.utils.mergeObject(
{

View File

@@ -80,9 +80,7 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
game.l5r5e.HelpersL5r5e.autocomplete(
html,
"data.identity.clan",
Object.entries(game.i18n.translations.l5r5e.clans)
.filter(([k, v]) => k !== "title")
.map(([k, v]) => v)
game.l5r5e.HelpersL5r5e.getLocalizedClansList()
);
game.l5r5e.HelpersL5r5e.autocomplete(
html,
@@ -93,6 +91,12 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
)?.[0]
)
);
game.l5r5e.HelpersL5r5e.autocomplete(
html,
"data.identity.roles",
game.l5r5e.HelpersL5r5e.getLocalizedRolesList(),
","
);
// Open linked school curriculum journal
html.find(".school-journal-link").on("click", this._openLinkedJournal.bind(this));

View File

@@ -52,4 +52,30 @@ export class NpcSheetL5r5e extends BaseCharacterSheetL5r5e {
return sheetData;
}
/**
* Subscribe to events from the sheet.
* @param {jQuery} html HTML content of the sheet.
*/
activateListeners(html) {
super.activateListeners(html);
// *** Everything below here is only needed if the sheet is editable ***
if (!this.isEditable) {
return;
}
// Autocomplete
game.l5r5e.HelpersL5r5e.autocomplete(
html,
"data.attitude",
CONFIG.l5r5e.demeanorList.map((e) => {
let modifiers = [];
Object.entries(e.mod).forEach(([k, v]) => {
modifiers.push(`${game.i18n.localize(`l5r5e.rings.${k}`)} ${v}`);
});
return game.i18n.localize(`l5r5e.demeanor.${e.id}`) + ` (${modifiers.join(", ")})`;
})
);
}
}

View File

@@ -221,6 +221,19 @@ export class TwentyQuestionsDialog extends FormApplication {
await this.object.toActor(this.actor, flattenObject(this.cache));
await this.close({ submit: true, force: true });
});
// Autocomplete
game.l5r5e.HelpersL5r5e.autocomplete(html, "step1.clan", game.l5r5e.HelpersL5r5e.getLocalizedClansList());
game.l5r5e.HelpersL5r5e.autocomplete(
html,
"step2.family",
CONFIG.l5r5e.families.get(
Object.entries(game.i18n.translations.l5r5e.clans).find(
([k, v]) => v === this.object.data.step1.clan
)?.[0]
)
);
game.l5r5e.HelpersL5r5e.autocomplete(html, "step3.roles", game.l5r5e.HelpersL5r5e.getLocalizedRolesList(), ",");
}
/**

View File

@@ -7,6 +7,7 @@ L5R5E.paths = {
L5R5E.money = [50, 10];
L5R5E.stances = ["earth", "air", "water", "fire", "void"];
L5R5E.roles = ["artisan", "bushi", "courtier", "monk", "sage", "shinobi", "shugenja"];
L5R5E.xp = {
costPerRank: [0, 20, 24, 32, 44, 60],
@@ -148,3 +149,78 @@ L5R5E.families.set("tortoise", ["Kasuga"]);
L5R5E.families.set("ivory_kingdoms", []);
L5R5E.families.set("qamarist", []);
L5R5E.families.set("ujik", []);
// *** demeanor ***
L5R5E.demeanorList = [
{ id: "adaptable", mod: { fire: 2, earth: -2 } },
{ id: "adaptable", mod: { water: 2, earth: -2 } },
{ id: "aggressive", mod: { fire: 2, air: -2 } },
{ id: "aggressive", mod: { fire: 2, water: -2 } },
{ id: "ambitious", mod: { fire: 2, water: -2 } },
{ id: "amiable", mod: { air: 2, earth: -2 } },
{ id: "analytical", mod: { fire: 2, air: -2 } },
{ id: "angry", mod: { fire: 2, air: -2 } },
{ id: "arrogant", mod: { fire: 2, water: -2 } },
{ id: "assertive", mod: { earth: 2, air: -2 } },
{ id: "assertive", mod: { earth: 2, air: 2 } },
{ id: "beguiling", mod: { air: 2, earth: -2 } },
{ id: "beguiling", mod: { fire: 2, earth: -2 } },
{ id: "bitter", mod: { fire: 2, air: -2 } },
{ id: "bold", mod: { fire: 1, earth: -1 } },
{ id: "calculating", mod: { air: 2, fire: -2 } },
{ id: "calm", mod: { fire: 2, air: -2 } },
{ id: "capricious", mod: { air: 2, earth: -2 } },
{ id: "cautious", mod: { air: 2, earth: -2 } },
{ id: "clever", mod: { air: 2, earth: -2 } },
{ id: "confused", mod: { fire: 1, void: 1, air: -2 } },
{ id: "courageous", mod: { air: 2, earth: -2 } },
{ id: "cowardly", mod: { earth: 2, fire: -2 } },
{ id: "curious", mod: { earth: 1, void: -2 } },
{ id: "curious", mod: { fire: 1, void: 1, air: -2 } },
{ id: "dependable", mod: { fire: 1, water: 1, earth: -2 } },
{ id: "detached", mod: { earth: 1, fire: 1, void: -2 } },
{ id: "disheartened", mod: { fire: 1, earth: -1 } },
{ id: "enraged", mod: { air: 1, fire: -2 } },
{ id: "feral", mod: { air: 2, fire: -2 } },
{ id: "fickle", mod: { fire: 2, air: -2 } },
{ id: "fierce", mod: { fire: 2, earth: -2 } },
{ id: "flighty", mod: { air: 2, fire: -2 } },
{ id: "flighty", mod: { water: 2, fire: -2 } },
{ id: "flippant", mod: { fire: 2, air: -2 } },
{ id: "friendly", mod: { fire: 1, earth: -2, water: -2 } },
{ id: "gruff", mod: { water: 2, earth: -2 } },
{ id: "hungry", mod: { fire: 2, air: -2 } },
{ id: "intense", mod: { air: 2, water: -2 } },
{ id: "intense", mod: { fire: 2, water: -2 } },
{ id: "intimidating", mod: { fire: 2, air: -2 } },
{ id: "irritable", mod: { fire: 2, air: -1, water: -1 } },
{ id: "loyal", mod: { air: 1, earth: -2, fire: -2 } },
{ id: "loyal", mod: { water: 2, fire: -2 } },
{ id: "mischievous", mod: { fire: 2, air: -2 } },
{ id: "mischievous", mod: { air: 2, earth: -2 } },
{ id: "mischievous", mod: { earth: 2, fire: -2 } },
{ id: "morose", mod: { water: 2, fire: -2 } },
{ id: "nurturing", mod: { earth: 2, fire: -2 } },
{ id: "obstinate", mod: { earth: 2, air: -2 } },
{ id: "obstinate", mod: { water: 2, air: -2 } },
{ id: "opportunistic", mod: { water: 2, fire: -2 } },
{ id: "passionate", mod: { earth: 2, air: -2 } },
{ id: "playful", mod: { earth: 2, water: -2 } },
{ id: "playful", mod: { fire: 1, air: 1, void: -2 } },
{ id: "power_hungry", mod: { fire: 2, earth: -2 } },
{ id: "proud", mod: { fire: 2, earth: -2 } },
{ id: "restrained", mod: { earth: 2, air: -2 } },
{ id: "scheming", mod: { air: 2, void: -2 } },
{ id: "serene", mod: { fire: 2, void: -2 } },
{ id: "serene", mod: { void: 2, fire: -2 } },
{ id: "serious", mod: { fire: 2, earth: -2 } },
{ id: "shrewd", mod: { air: 2, fire: -2 } },
{ id: "stubborn", mod: { earth: 2, water: -2 } },
{ id: "suspicious", mod: { air: 2, earth: -2 } },
{ id: "teasing", mod: { air: 2, earth: -2 } },
{ id: "territorial", mod: { fire: 2, air: -2 } },
{ id: "uncertain", mod: { air: 2, fire: -2 } },
{ id: "unenthused", mod: { earth: 2, fire: -2 } },
{ id: "vain", mod: { earth: 2, air: -2 } },
{ id: "wary", mod: { earth: 2, fire: -2 } },
];

View File

@@ -41,8 +41,8 @@ export class DicePickerDialog extends FormApplication {
value: 2,
hidden: false,
addVoidPoint: false,
targetTokenId: null,
},
targetInfos: null,
useVoidPoint: false,
isInitiativeRoll: false,
};
@@ -534,7 +534,7 @@ export class DicePickerDialog extends FormApplication {
roll.l5r5e.difficultyHidden = this.object.difficulty.hidden;
roll.l5r5e.voidPointUsed = this.object.useVoidPoint;
roll.l5r5e.skillAssistance = this.object.skill.assistance;
roll.l5r5e.targetTokenId = this.object.difficulty.targetTokenId;
roll.l5r5e.targetInfos = this.object.targetInfos;
await roll.roll();
message = await roll.toMessage();
@@ -694,18 +694,17 @@ export class DicePickerDialog extends FormApplication {
// Define which actor is needed for the difficulty
let targetActor = null;
let targetTokenId = null;
let targetToken = null;
if (infos[1] === "S") {
targetActor = this._actor;
} else if (game.user.targets.size > 0) {
// Between the targets
const targetToken = DicePickerDialog._getTargetTokenFromSelection(
targetToken = DicePickerDialog._getTargetTokenFromSelection(
infos[4] || infos[2],
!infos[3] ? null : infos[3] === "min"
);
if (targetToken) {
targetActor = targetToken.actor;
targetTokenId = targetToken.data._id;
}
}
// Wrong syntax or no target set, do manual TN
@@ -728,7 +727,10 @@ export class DicePickerDialog extends FormApplication {
if (infos[1] === "T") {
this.difficultyHidden = true;
this._difficultyHiddenIsLock.option = true;
this.object.difficulty.targetTokenId = targetTokenId;
this.object.targetInfos = {
img: targetToken.data.img,
name: targetToken.data.name,
};
}
return true;
}

View File

@@ -34,7 +34,7 @@ export class RollL5r5e extends Roll {
opportunity: 0,
strife: 0,
},
targetTokenId: null,
targetInfos: null,
voidPointUsed: false,
};

View File

@@ -79,6 +79,24 @@ export class HelpersL5r5e {
}));
}
/**
* Return the list of Clans
* @return {string[]}
*/
static getLocalizedClansList() {
return Object.entries(game.i18n.translations.l5r5e.clans)
.filter(([k, v]) => k !== "title")
.map(([k, v]) => v);
}
/**
* Return the list of Roles
* @return {string[]}
*/
static getLocalizedRolesList() {
return CONFIG.l5r5e.roles.map((e) => game.i18n.localize(`l5r5e.roles.${e}`));
}
/**
* Return the target object on a drag n drop event, or null if not found
* @param {DragEvent} event
@@ -720,8 +738,11 @@ export class HelpersL5r5e {
* @param {jQuery} html HTML content of the sheet.
* @param {string} name Html name of the input
* @param {string[]} list Array of string to display
* @param {string} sep (optional) Separator
*/
static autocomplete(html, name, list = []) {
static autocomplete(html, name, list = [], sep = "") {
return; // TODO tmp disabled
/*
const inp = document.getElementsByName(name)?.[0];
if (list.length < 1) {
return;
@@ -741,11 +762,20 @@ export class HelpersL5r5e {
inp.addEventListener("input", (inputEvent) => {
closeAllLists();
const val = inputEvent.target.value;
let val = inputEvent.target.value.trim();
if (!val) {
return false;
}
// separator
let previous = [val];
let currentIdx = 0;
if (sep) {
currentIdx = (val.substring(0, inputEvent.target.selectionStart).match(new RegExp(`[${sep}]`, "g")) || []).length;
previous = val.split(sep);
val = previous[currentIdx].trim();
}
currentFocus = -1;
// create a DIV element that will contain the items (values)
@@ -772,7 +802,8 @@ export class HelpersL5r5e {
if (!list[selectedIndex]) {
return;
}
inp.value = list[selectedIndex];
previous[currentIdx] = list[selectedIndex];
inp.value = previous.map(e => e.trim()).join(sep + " ");
closeAllLists();
});
listDiv.appendChild(choiceDiv);
@@ -822,5 +853,6 @@ export class HelpersL5r5e {
html.on("focusout", (e) => {
closeAllLists(e.target);
});
*/
}
}

File diff suppressed because one or more lines are too long

View File

@@ -71,6 +71,38 @@
color: rgba(155, 55, 55, 0.75);
}
}
.target {
display: flex;
align-items: center;
flex: 0 0 100%;
.profile {
flex: 1;
margin: 0.25rem 0.25rem 0 0;
position: relative;
.target-img {
position: absolute;
left: 0;
opacity: 0.7;
}
.profile-img {
position: relative;
}
&:after {
content: "";
background: url("../assets/imgs/target-square.svg") no-repeat 0 0;
position: absolute;
top: 0;
left: 0;
opacity: 0.5;
width: 100%;
height: 100%;
}
}
.name {
flex: 6;
font-family: "BrushtipTexe", sans-serif;
}
}
}
// If DicePicker add a pointer

View File

@@ -198,5 +198,8 @@
.next {
margin: 2rem 0 4rem;
}
.autocomplete {
width: calc(100% - 2px);
}
}
}

View File

@@ -939,6 +939,7 @@ button {
cursor: pointer;
background-color: #fff;
border-bottom: 1px solid #d4d4d4;
text-align: left;
}
.autocomplete-items div:hover {
/*when hovering an item:*/

View File

@@ -32,8 +32,8 @@
</label>
</li>
<li>
<label class="attribute-label">
{{localize 'l5r5e.roles'}}
<label class="attribute-label autocomplete">
{{localize 'l5r5e.roles.title'}}
<input type="text" name="data.identity.roles" value="{{data.data.identity.roles}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label>
</li>

View File

@@ -19,7 +19,7 @@
</li>
<li class="affinities">
{{!-- Attitude --}}
<label class="attitude">
<label class="attitude autocomplete">
<input type="text" name="data.attitude" value="{{data.data.attitude}}" data-dtype="String" placeholder="" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
{{localize 'l5r5e.social.attitude'}}
</label>

View File

@@ -37,7 +37,9 @@
<article class="tab parts part1" data-group="primary" data-tab="part1">
<h2>{{localize (localize 'l5r5e.twenty_questions.part1.title{suffix}' suffix=suffix)}}</h2>
<h3>{{localize (localize 'l5r5e.twenty_questions.part1.q1{suffix}' suffix=suffix)}}</h3>
<div class="autocomplete">
<input type="text" name="step1.clan" value="{{data.step1.clan}}">
</div>
<table>
<tr>
<td class="third">
@@ -84,7 +86,9 @@
</tr>
</table>
<h3>{{localize (localize 'l5r5e.twenty_questions.part1.q2{suffix}' suffix=suffix)}}</h3>
<div class="autocomplete">
<input type="text" name="step2.family" value="{{data.step2.family}}">
</div>
<table>
<tr>
<td class="third">
@@ -147,7 +151,7 @@
{{localize 'l5r5e.twenty_questions.part2.school'}}
<input type="text" name="step3.school" value="{{data.step3.school}}">
</label>
<label class="full">
<label class="full autocomplete">
{{localize 'l5r5e.twenty_questions.part2.role'}}
<input type="text" name="step3.roles" value="{{data.step3.roles}}">
</label>

View File

@@ -38,6 +38,13 @@
</div>
{{/if}}
{{#if l5r5e.targetInfos}}
<div class="l5r5e target">
<div class="profile"><img class="profile-img" src="{{l5r5e.targetInfos.img}}" alt="{{l5r5e.targetInfos.name}}" /></div>
<div class="name"> &nbsp; {{l5r5e.targetInfos.name}}</div>
</div>
{{/if}}
<div class="l5r5e dice-formula">{{#if l5r5e.initialFormula}}{{l5r5e.initialFormula}}{{else}}{{formula}}{{/if}}</div>
<div class="l5r5e dice-result">