From 3617475e83df2d592129f2d6dcdd69db8ec25740 Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Tue, 25 Jun 2024 23:31:13 +0100 Subject: [PATCH] show character profile --- web/chargen.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/web/chargen.js b/web/chargen.js index c80aed6..3233d50 100644 --- a/web/chargen.js +++ b/web/chargen.js @@ -18,6 +18,23 @@ document.getElementById('characterForm').addEventListener('submit', function(eve var resultSection = document.getElementById('resultSection'); resultSection.innerHTML = ''; + // After existing code, add below lines for the profile rendering + if(data.profile){ + resultSection.innerHTML += `Profile:
`; + var profile = data.profile; + resultSection.innerHTML += ` - Name: ${profile.name}
`; + resultSection.innerHTML += ` - Sex: ${profile.sex}
`; + resultSection.innerHTML += ` - Age: ${profile.age}
`; + + // Check if character type is human + if(charType === 'human' && profile.hair && profile.eyes && profile.skintone) { + resultSection.innerHTML += ` - Hair: ${profile.hair}
`; + resultSection.innerHTML += ` - Eyes: ${profile.eyes}
`; + resultSection.innerHTML += ` - Skin Tone: ${profile.skintone}
`; + } + resultSection.innerHTML += "
"; + } + // Display animal-stock if it exists if(data['animal-stock']){ resultSection.innerHTML += `Animal Stock:
`;