diff --git a/.gitignore b/.gitignore index 4fd2865..f2bc117 100755 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ ### Custom ### +companion/ all-traits.json gen-stats.json traits.json diff --git a/.version b/.version index e6d5cb8..30290a6 100755 --- a/.version +++ b/.version @@ -1 +1 @@ -1.0.2 \ No newline at end of file +1.1.0a \ No newline at end of file diff --git a/css/main.css b/css/main.css index 578fa24..476a338 100755 --- a/css/main.css +++ b/css/main.css @@ -47,10 +47,14 @@ h3 { } h4 { - width: 500px; + width: 100%; text-align: left; font-size: 16px; - margin: 10px 0; + margin: 10px 0 0 10px; +} + +h5 { + font-size: 16px; } a, @@ -76,6 +80,25 @@ form { justify-content: space-around; } +hr { + width: calc(100% + 10px); + height: 5px; + margin: 8px 0; + border: 1px solid #000; +} + +.hrbottom { + border-top: none; + border-radius: 0; + box-shadow: 0 3px 5px #22243a; +} + +.hrtop { + border-bottom: none; + border-radius: 0; + box-shadow: 0 -3px 5px #22243a; +} + .content { margin: 10px 0; width: 950px; diff --git a/php/edit/3.php b/php/edit/3.php index a7dc28e..3e02366 100755 --- a/php/edit/3.php +++ b/php/edit/3.php @@ -34,22 +34,25 @@ let rarities = []; // Build rarities array (rarities[t][v] = r => Trair 't', variation 'v' has rarity 'r'%) for (const input of form) { - const match = input.id.match(/trait(\d+)_(\d+)_rarity/); + const match = input.id.match(/trait(\d+)_(\d+|empty)_rarity/); if (match) { const [/*ignore*/, trait, variation] = match; if (rarities[trait] === undefined) { rarities[trait] = []; } - rarities[trait][variation-1] = parseFloat(input.value); + if (variation === 'empty') { + rarities[trait]['empty'] = parseFloat(input.value); + } else { + rarities[trait][variation-1] = parseFloat(input.value); + } } } // Iterate through rarities backwards and make sure the sum is 100, or display message const first_t = (rarities[0] === undefined) ? 1 : 0; for (let t = rarities.length - 1; t >= first_t; t--) { - console.log(t); const errorH3 = document.getElementById(`trait${t}_error`); - const sum = rarities[t].reduce((cum, el) => cum + el, 0); - if (sum !== 100) { + const sum = rarities[t].reduce((cum, el) => cum + el, 0) + rarities[t]['empty']; + if (abs(sum - 100) > 1e-6) { // Float comparison for sum == 100, avoids rounding errors errorH3.innerHTML = `The rarity percentages should add up to 100% (not ${sum}%)`; errorH3.hidden = false; window.location.hash = `trait${t}`; @@ -82,14 +85,18 @@