diff --git a/src/armor.html b/src/armor.html index 3b97db4..244dc88 100644 --- a/src/armor.html +++ b/src/armor.html @@ -93,14 +93,14 @@
  • - +
  • - +
  • diff --git a/src/data/classes.json b/src/data/classes.json index f0ccfa3..d726f13 100644 --- a/src/data/classes.json +++ b/src/data/classes.json @@ -1,50 +1,60 @@ [ { + "id": "vagabond", "name": "Vagabond", "level": 9, "stats": [15, 10, 11, 14, 13, 9, 9, 7] }, { + "id": "warrior", "name": "Warrior", "level": 8, "stats": [11, 12, 11, 10, 16, 10, 8, 9] }, { + "id": "hero", "name": "Hero", "level": 7, "stats": [14, 9, 12, 16, 9, 7, 8, 11] }, { + "id": "bandit", "name": "Bandit", "level": 5, "stats": [10, 11, 10, 9, 13, 9, 8, 14] }, { + "id": "astrologer", "name": "Astrologer", "level": 6, "stats": [9, 15, 9, 8, 12, 16, 7, 9] }, { + "id": "prophet", "name": "Prophet", "level": 7, "stats": [10, 14, 8, 11, 10, 7, 16, 10] }, { + "id": "samurai", "name": "Samurai", "level": 9, "stats": [12, 11, 13, 12, 15, 9, 8, 8] }, { + "id": "prisoner", "name": "Prisoner", "level": 9, "stats": [11, 12, 11, 11, 14, 14, 6, 9] }, { + "id": "confessor", "name": "Confessor", "level": 10, "stats": [10, 13, 10, 12, 12, 9, 14, 9] }, { + "id": "wretch", "name": "Wretch", "level": 1, "stats": [10, 10, 10, 10, 10, 10, 10, 10] diff --git a/src/index.html b/src/index.html index 5aa06a7..d7cb7d1 100644 --- a/src/index.html +++ b/src/index.html @@ -28,7 +28,7 @@
    -

    Build Planner (todo)

    +

    Build Planner


    Create a new build.

    diff --git a/src/planner.html b/src/planner.html index ae4dac4..5ae1914 100644 --- a/src/planner.html +++ b/src/planner.html @@ -10,9 +10,11 @@ Erdtree - Build Planner + + - +
    +

    Build Planner

    +
    + +
    +
      +
    • + Equipment +
    • +
      + +
    • Weapons
    • + +
      + +
    • Armor
    • + +
      + +
    • Talismans
    • + +
      + +
    • Spells
    • +
    +
    + + +
    +
      +
    • Statistics
    • + +
      + +
    • + + +
    • + +
    • + + +
    • + +

    • + +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    • + + +
    • +
    +
    + + +
    +
      +
      +
      diff --git a/src/script/planner.js b/src/script/planner.js new file mode 100644 index 0000000..25811eb --- /dev/null +++ b/src/script/planner.js @@ -0,0 +1,38 @@ +const CLASSES = fetch("/data/classes.json") + .then(response => response.json()) + .catch(error => console.log(error)); + +let startingClass; + +async function init() { + await populate(); + await update(); +} + +async function update() { + // get current starting class + let classSelect = document.getElementById("class"); + let currentClass = (await CLASSES).find(c => c.id == classSelect.options[classSelect.selectedIndex].value); + + let prevClass = { ...startingClass }; + if (prevClass.id != currentClass) { + // update statistics + [...document.getElementsByName("stat")].forEach((stat, i) => { + stat.value = parseInt((stat.value || 0) == prevClass.stats[i] ? currentClass.stats[i] : stat.value); + }); + document.getElementById("level").value = [...document.getElementsByName("stat")].reduce((total, stat) => total + parseInt(stat), 0) - 79; + } + startingClass = currentClass; +} +async function populate() { + let select = document.getElementById("class"); + + CLASSES.then(classes => { + classes.forEach(c => { + let option = new Option(c.name, c.id); + select.options.add(option); + }); + select.selectedIndex = 0; + startingClass = classes[0]; + }); +} \ No newline at end of file