more fixes to encounters

This commit is contained in:
Greg Gauthier 2024-07-02 13:15:12 +01:00
parent 5e3e241dec
commit 2620720b47
16 changed files with 18 additions and 26 deletions

View File

@ -12,7 +12,7 @@ class EncounterTable:
'forest': ['hisser', 'sep', 'blaash', 'blackun', 'terl', 'win seen', 'pineto', 'perth', 'obb', 'kailin', 'forest': ['hisser', 'sep', 'blaash', 'blackun', 'terl', 'win seen', 'pineto', 'perth', 'obb', 'kailin',
'gren', 'badder', 'arn', 'lil', 'blood bird', 'horl choo', 'soul besh', 'dabber', 'centisteed', 'gren', 'badder', 'arn', 'lil', 'blood bird', 'horl choo', 'soul besh', 'dabber', 'centisteed',
None], None],
'desert': ['serf', 'kamodo', 'blight', 'perth', 'parn', 'zarn', 'yexil', 'hisser', 'sep', 'calthen', 'desert': ['serf', 'kamodo', 'blight', 'perth', 'parn', 'zarn', 'yexil', 'hisser', 'sep', 'cal then',
'manta', 'kep plant', 'carrin', 'podog', None, None, None, None, None, None], 'manta', 'kep plant', 'carrin', 'podog', None, None, None, None, None, None],
'watery': ['win seen', 'crep plant', 'seroon lou', 'terl', 'ert telden', 'barl nep', 'ert', 'fleshin', 'watery': ['win seen', 'crep plant', 'seroon lou', 'terl', 'ert telden', 'barl nep', 'ert', 'fleshin',
'keeshin', 'narl ep', 'menarl', 'herkel', 'ber lep', 'cren tosh', 'fen', 'gator', None, None, None, 'keeshin', 'narl ep', 'menarl', 'herkel', 'ber lep', 'cren tosh', 'fen', 'gator', None, None, None,

View File

@ -43,11 +43,11 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
function setResultImage(name) { function setResultImage(name) {
let imgElement = document.createElement('img'); let imgElement = document.createElement('img');
imgElement.src = './img/' + name + ".jpg"; imgElement.src = '/img/' + name + ".jpg";
console.log(imgElement.src); console.log(imgElement.src);
imgElement.onerror = function () { imgElement.onerror = function () {
this.onerror = null; this.onerror = null;
this.src = './img/404.jpg'; this.src = '/img/404.jpg';
}; };
resultSection.appendChild(imgElement); resultSection.appendChild(imgElement);
} }
@ -67,6 +67,7 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
// Make the key names bold: // Make the key names bold:
tdKey.style.fontWeight = 'bold'; tdKey.style.fontWeight = 'bold';
if (Array.isArray(data[key])) { if (Array.isArray(data[key])) {
if (key === 'environ' || key === 'mutations') { if (key === 'environ' || key === 'mutations') {
tdValue.innerText = data[key].join(', '); tdValue.innerText = data[key].join(', ');
@ -98,34 +99,25 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
tdValue.innerText = data[key]; tdValue.innerText = data[key];
} }
if (key === 'name') {
let imgURL = "/img/" + data[key] + ".jpg";
tdKey.innerHTML = `
<div>
<h2 style=\'font-size: 1.2em;\'>${data[key].toUpperCase()}</h2>
</div>`;
tdValue.innerHTML = `
<div>
<img src='${imgURL}' onerror='this.src="/img/404.jpg";' style='width: 230px; height: 230px;'>
</div>`;
console.log(tdValue.innerHTML);
}
tr.appendChild(tdKey); tr.appendChild(tdKey);
tr.appendChild(tdValue); tr.appendChild(tdValue);
table.appendChild(tr); table.appendChild(tr);
} }
// append image row if name key exists
if(data.name) {
let tr = document.createElement('tr');
let tdKey = document.createElement('td');
let tdValue = document.createElement('td');
let imgElement = document.createElement('img');
tdKey.innerText = 'IMAGE';
tdKey.style.fontWeight = 'bold';
imgElement.src = './img/' + data.name + ".jpg";
imgElement.onerror = function() {
this.onerror = null;
this.src = './img/404.jpg';
};
tdValue.appendChild(imgElement);
tr.appendChild(tdKey);
tr.appendChild(tdValue);
table.appendChild(tr);
}
resultSection.appendChild(table); resultSection.appendChild(table);
} }
}, 1000); }, 1000);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 32 KiB