diff --git a/scripts/ikonis-sheet.js b/scripts/ikonis-sheet.js index 7de8db7..1260b9c 100644 --- a/scripts/ikonis-sheet.js +++ b/scripts/ikonis-sheet.js @@ -46,8 +46,35 @@ export function patchIkonisSheet() { const allAugmentsList = getAugments() || []; const processedAugments = []; + let bondedFeature = null; + + // Search for "Ikonis: Bonded" globally + const allNativeFeatures = CONFIG.DH.ITEM.allWeaponFeatures() || {}; + const bondedId = Object.keys(allNativeFeatures).find(k => allNativeFeatures[k].name === "Ikonis: Bonded"); + + // Auto-install if missing + if (bondedId && !weaponFeatures.some(f => f.value === bondedId)) { + console.log(`DH-Ikonis | Auto-installing Bonded feature on ${doc.name}`); + const newFeatures = [...weaponFeatures, { value: bondedId }]; + doc.update({ "system.weaponFeatures": newFeatures }); + } + for (const featureRef of weaponFeatures) { const nativeId = featureRef.value; + + // Special handling for Bonded + if (nativeId === bondedId) { + const feature = allNativeFeatures[bondedId]; + bondedFeature = { + id: bondedId, + name: "Bonded", + fullName: feature.name, + effect: feature.description ? feature.description.replace(/<[^>]*>?/gm, '').substring(0, 100) + "..." : "Primary module", + installed: true + }; + continue; + } + const base = allAugmentsList.find(a => String(a.id) === String(nativeId)); if (!base) continue; @@ -57,11 +84,12 @@ export function patchIkonisSheet() { context.ikonis = { enabled: true, augments: processedAugments, + bonded: bondedFeature, isGM: game.user?.isGM || false }; context.maxSlots = getSlotCount(doc); - context.usedSlots = processedAugments.length; + context.usedSlots = processedAugments.length; // Bonded doesn't count // Explicitly pass the active tab to the template context.activeTab = this.tabGroups?.primary || ""; diff --git a/templates/ikonis-motherboard.hbs b/templates/ikonis-motherboard.hbs index 644784b..c441293 100644 --- a/templates/ikonis-motherboard.hbs +++ b/templates/ikonis-motherboard.hbs @@ -7,6 +7,17 @@ + {{#if ikonis.bonded}} +
+
+
+

{{ikonis.bonded.fullName}} (Primary)

+

{{ikonis.bonded.effect}}

+
+
+
+ {{/if}} +

Installed Augments