Modifications suite beta 2
This commit is contained in:
@@ -189,6 +189,9 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
|
||||
this._tabs
|
||||
.find((e) => e._navSelector === ".advancements-tabs")
|
||||
.activate("advancement_rank_" + (this.actor.system.identity.school_rank || 0));
|
||||
|
||||
// Arcane roll on name click
|
||||
html.find(".dice-picker-arcane").on("click", this._openDicePickerForArcane.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,10 +223,49 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
|
||||
}
|
||||
|
||||
/**
|
||||
* Override base dice picker to open Chiaroscuro d6 dialog.
|
||||
* Open the Chiaroscuro dice dialog for an arcane item.
|
||||
* Parses `system.applicationDisplay` (comma-separated skill IDs and/or group names),
|
||||
* expands groups, pre-selects the first skill, and passes the arcane bonus.
|
||||
* @param {Event} event
|
||||
*/
|
||||
_openDicePickerForSkill(event) {
|
||||
_openDicePickerForArcane(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (event.clientX === 0 && event.clientY === 0) return;
|
||||
|
||||
const itemId = $(event.currentTarget).closest("[data-item-id]").data("item-id") ?? $(event.currentTarget).data("item-id");
|
||||
const item = this.actor.items.get(itemId);
|
||||
if (!item) return;
|
||||
|
||||
// Parse application array (database field) → expand skill groups
|
||||
const app = item.system.application || [];
|
||||
const rawEntries = (Array.isArray(app) ? app : app.split(","))
|
||||
.map((s) => s.trim().toLowerCase())
|
||||
.filter(Boolean);
|
||||
|
||||
const allGroupIds = new Set(CONFIG.l5r5e.skills.values());
|
||||
const skillIds = [];
|
||||
for (const entry of rawEntries) {
|
||||
if (allGroupIds.has(entry)) {
|
||||
// Expand group → all skills belonging to that group
|
||||
for (const [skillId, groupId] of CONFIG.l5r5e.skills.entries()) {
|
||||
if (groupId === entry && !skillIds.includes(skillId)) skillIds.push(skillId);
|
||||
}
|
||||
} else if (CONFIG.l5r5e.skills.has(entry) && !skillIds.includes(entry)) {
|
||||
skillIds.push(entry);
|
||||
}
|
||||
}
|
||||
|
||||
new game.l5r5e.ChiaroscuroDiceDialog({
|
||||
actor: this.actor,
|
||||
ringId: this.actor.system?.default_ring || "void",
|
||||
skillsList: skillIds,
|
||||
arcaneBonus: parseInt(item.system.bonus || 0),
|
||||
itemUuid: item.uuid,
|
||||
}).render(true);
|
||||
}
|
||||
|
||||
/**
|
||||
event.preventDefault();
|
||||
const el = $(event.currentTarget);
|
||||
const weapon = this._getWeaponInfos(el.data("weapon-id") || null);
|
||||
|
||||
Reference in New Issue
Block a user