show character profile

This commit is contained in:
Greg Gauthier 2024-06-25 23:31:13 +01:00
parent 55fb134073
commit 3617475e83

View File

@ -18,6 +18,23 @@ document.getElementById('characterForm').addEventListener('submit', function(eve
var resultSection = document.getElementById('resultSection'); var resultSection = document.getElementById('resultSection');
resultSection.innerHTML = ''; resultSection.innerHTML = '';
// After existing code, add below lines for the profile rendering
if(data.profile){
resultSection.innerHTML += `<strong>Profile:</strong><br/>`;
var profile = data.profile;
resultSection.innerHTML += ` - Name: ${profile.name}<br/>`;
resultSection.innerHTML += ` - Sex: ${profile.sex}<br/>`;
resultSection.innerHTML += ` - Age: ${profile.age}<br/>`;
// Check if character type is human
if(charType === 'human' && profile.hair && profile.eyes && profile.skintone) {
resultSection.innerHTML += ` - Hair: ${profile.hair}<br/>`;
resultSection.innerHTML += ` - Eyes: ${profile.eyes}<br/>`;
resultSection.innerHTML += ` - Skin Tone: ${profile.skintone}<br/>`;
}
resultSection.innerHTML += "<br/>";
}
// Display animal-stock if it exists // Display animal-stock if it exists
if(data['animal-stock']){ if(data['animal-stock']){
resultSection.innerHTML += `<strong>Animal Stock:</strong><br/>`; resultSection.innerHTML += `<strong>Animal Stock:</strong><br/>`;