diff --git a/sitemap.xml b/sitemap.xml
new file mode 100644
index 0000000..d8b7d5c
--- /dev/null
+++ b/sitemap.xml
@@ -0,0 +1,34 @@
+
+
+
+ https://erdtree.palmoe.dk/
+ 2022-03-28T13:52:48+00:00
+ 1.00
+
+
+ https://erdtree.palmoe.dk/planner
+ 2022-03-28T13:52:48+00:00
+ 0.80
+
+
+ https://erdtree.palmoe.dk/class
+ 2022-03-28T13:52:48+00:00
+ 0.80
+
+
+ https://erdtree.palmoe.dk/armor
+ 2022-03-28T13:52:48+00:00
+ 0.80
+
+
+ https://erdtree.palmoe.dk/weapons
+ 2022-03-28T13:52:48+00:00
+ 0.64
+
+
+
+
\ No newline at end of file
diff --git a/src/armor.html b/src/armor.html
index 244dc88..a820e46 100644
--- a/src/armor.html
+++ b/src/armor.html
@@ -2,15 +2,22 @@
+
+
Erdtree - Armor Optimizer
-
+
+
+
+
+
diff --git a/src/class.html b/src/class.html
index 25ba767..cd15651 100644
--- a/src/class.html
+++ b/src/class.html
@@ -2,15 +2,22 @@
+
+
Erdtree - Class Optimizer
-
+
+
+
+
+
diff --git a/src/data/weapons.json b/src/data/weapons.json
index 0e38940..48f05e1 100644
--- a/src/data/weapons.json
+++ b/src/data/weapons.json
@@ -1,5 +1,23 @@
{
- "no-weapon": { "id": "no-weapons", "name": "None" },
+ "no-weapon": {
+ "id": "no-weapons",
+ "name": "None",
+ "requirements": [0, 0, 0, 0, 0],
+ "infusions": {
+ "standard": {
+ "damage": [0, 0, 0, 0, 0],
+ "scaling": [0.0, 0.0, 0.0, 0.0, 0.0],
+ "masks": [
+ [0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0]
+ ],
+ "corrections": ["0", "0", "0", "0", "0"]
+ }
+ }
+ },
"academy-glintstone-staff": {
"id": "academy-glintstone-staff",
"name": "Academy Glintstone Staff",
@@ -2954,6 +2972,25 @@
}
}
},
+ "bloody-helice": {
+ "id": "bloody-helice",
+ "name": "Bloody Helice",
+ "requirements": [16, 19, 0, 0, 17],
+ "infusions": {
+ "standard": {
+ "damage": [121, 0, 0, 0, 0],
+ "scaling": [0.1, 0.35, 0.0, 0.0, 0.5],
+ "masks": [
+ [1, 1, 0, 0, 1],
+ [0, 0, 1, 0, 0],
+ [0, 0, 0, 1, 0],
+ [0, 1, 0, 0, 0],
+ [0, 0, 0, 1, 0]
+ ],
+ "corrections": ["7", "0", "0", "0", "0"]
+ }
+ }
+ },
"blue-crest-heater-shield": {
"id": "blue-crest-heater-shield",
"name": "Blue Crest Heater Shield",
@@ -5236,6 +5273,18 @@
],
"corrections": ["0", "0", "4", "0", "0"]
},
+ "flame-art": {
+ "damage": [114, 0, 114, 0, 0],
+ "upgrade": [0.09, 0.06, 0.0, 0.34, 0.0],
+ "masks": [
+ [1, 1, 0, 0, 0],
+ [0, 0, 1, 0, 0],
+ [0, 0, 0, 1, 0],
+ [0, 1, 0, 0, 0],
+ [0, 0, 0, 1, 0]
+ ],
+ "corrections": ["0", "0", "4", "0", "0"]
+ },
"lightning": {
"damage": [114, 0, 0, 114, 0],
"upgrade": [0.07, 0.3, 0.0, 0.0, 0.0],
@@ -5322,25 +5371,6 @@
}
}
},
- "celebrants-cleaver-blades": {
- "id": "celebrants-cleaver-blades",
- "name": "Celebrant's Cleaver Blades",
- "requirements": [12, 8, 0, 0, 0],
- "infusions": {
- "flame-art": {
- "damage": [114, 0, 114, 0, 0],
- "scaling": [0.09, 0.06, 0.0, 0.34, 0.0],
- "masks": [
- [1, 1, 0, 0, 0],
- [0, 0, 1, 0, 0],
- [0, 0, 0, 1, 0],
- [0, 1, 0, 0, 0],
- [0, 0, 0, 1, 0]
- ],
- "corrections": ["0", "0", "4", "0", "0"]
- }
- }
- },
"celebrants-rib-rake": {
"id": "celebrants-rib-rake",
"name": "Celebrant's Rib-Rake",
@@ -17117,25 +17147,6 @@
}
}
},
- "helice": {
- "id": "helice",
- "name": "Helice",
- "requirements": [16, 19, 0, 0, 17],
- "infusions": {
- "blood": {
- "damage": [121, 0, 0, 0, 0],
- "scaling": [0.1, 0.35, 0.0, 0.0, 0.5],
- "masks": [
- [1, 1, 0, 0, 1],
- [0, 0, 1, 0, 0],
- [0, 0, 0, 1, 0],
- [0, 1, 0, 0, 0],
- [0, 0, 0, 1, 0]
- ],
- "corrections": ["7", "0", "0", "0", "0"]
- }
- }
- },
"helphens-steeple": {
"id": "helphens-steeple",
"name": "Helphen's Steeple",
@@ -22829,12 +22840,12 @@
}
}
},
- "mohgwyns-spear": {
- "id": "mohgwyns-spear",
- "name": "Mohgwyn's Spear",
+ "mohgwyns-sacred-spear": {
+ "id": "mohgwyns-sacred-spear",
+ "name": "Mohgwyn's Sacred Spear",
"requirements": [24, 14, 0, 0, 27],
"infusions": {
- "sacred": {
+ "standard": {
"damage": [96, 0, 62, 0, 0],
"scaling": [0.4, 0.15, 0.0, 0.0, 0.4],
"masks": [
@@ -26701,25 +26712,6 @@
}
}
},
- "relic-sword": {
- "id": "relic-sword",
- "name": "Relic Sword",
- "requirements": [14, 24, 0, 22, 0],
- "infusions": {
- "sacred": {
- "damage": [118, 0, 0, 0, 76],
- "scaling": [0.15, 0.56, 0.0, 0.36, 0.0],
- "masks": [
- [1, 1, 0, 0, 0],
- [0, 0, 1, 0, 0],
- [0, 0, 0, 1, 0],
- [0, 1, 0, 0, 0],
- [0, 0, 0, 1, 0]
- ],
- "corrections": ["0", "0", "0", "0", "4"]
- }
- }
- },
"rickety-shield": {
"id": "rickety-shield",
"name": "Rickety Shield",
@@ -28234,6 +28226,25 @@
}
}
},
+ "sacred-relic-sword": {
+ "id": "sacred-relic-sword",
+ "name": "Sacred Relic Sword",
+ "requirements": [14, 24, 0, 22, 0],
+ "infusions": {
+ "standard": {
+ "damage": [118, 0, 0, 0, 76],
+ "scaling": [0.15, 0.56, 0.0, 0.36, 0.0],
+ "masks": [
+ [1, 1, 0, 0, 0],
+ [0, 0, 1, 0, 0],
+ [0, 0, 0, 1, 0],
+ [0, 1, 0, 0, 0],
+ [0, 0, 0, 1, 0]
+ ],
+ "corrections": ["0", "0", "0", "0", "4"]
+ }
+ }
+ },
"sacrificial-axe": {
"id": "sacrificial-axe",
"name": "Sacrificial Axe",
diff --git a/src/index.html b/src/index.html
index 78c40da..49896ef 100644
--- a/src/index.html
+++ b/src/index.html
@@ -2,14 +2,20 @@
+
- Erdtree
-
+
+ Erdtree - Elden Ring Build Planner
+
+
+
+
@@ -50,14 +56,6 @@
-
-
- Attack Rating Calculator (todo)
-
- Calculate attack rating for a weapon.
-
-
-
Censor Checker (todo)
@@ -67,7 +65,7 @@
-
+
Weapon Finder (todo)
Get suggestions for usable weapons.
diff --git a/src/planner.html b/src/planner.html
index cee6aa9..30f1ea6 100644
--- a/src/planner.html
+++ b/src/planner.html
@@ -2,15 +2,22 @@
+
+
Erdtree - Build Planner
+
+
+
+
diff --git a/src/script/weapons.js b/src/script/weapons.js
index feb7dc3..4f0a276 100644
--- a/src/script/weapons.js
+++ b/src/script/weapons.js
@@ -1,34 +1,80 @@
-const fs = require("fs");
+const WEAPONS = fetch("/data/weapons.json")
+ .then(response => response.json())
+ .catch(error => console.log(error));
+const INFUSIONS = fetch("/data/infusions.json")
+ .then(response => response.json())
+ .catch(error => console.log(error));
+const CORRECTIONS = fetch("/data/damage.json")
+ .then(response => response.json())
+ .catch(error => console.log(error));
+
+let weapons;
+let infusions;
+let corrections;
const sum = (a, b) => a + b;
-let weapons = JSON.parse(fs.readFileSync("./output/weapons.json"));
-let corrections = JSON.parse(fs.readFileSync("./output/damage.json"));
-let infusions = JSON.parse(fs.readFileSync("./output/infusions.json"));
+async function init() {
+ weapons = await WEAPONS;
+ infusions = await INFUSIONS;
+ corrections = await CORRECTIONS;
-function damage(weaponId, infusionId, stats, upgradeLevel) {
- let weapon = weapons.find(weapon => weapon.id = weapon);
- let infusion = infusions.find(infusion => infusion.id = infusionId);
-
- weapon = weapon.infusions[infusionId];
-
- let bases = infusion.damage.map((amount, ty) => weapon.damage[ty] * (amount + infusion.upgrade[ty] * upgradeLevel));
-
- let extras = bases.map((amount, ty) => {
- let calc = corrections.find(c => c.id == weapon.corrections[ty]);
- let correction = modifiers(calc, stats, weapon.masks[ty]);
- console.log(correction);
- let scalings = weapon.scaling.map(itemScaling => {
- return (itemScaling * infusion.scaling[ty] + itemScaling * infusion.scaling[ty] * infusion.growth[ty] * upgradeLevel);
- })
- let extras = scalings.map((statScaling, j) => amount * statScaling * correction[j] / 100.0)
- return extras.reduce(sum);
- });
-
- return Math.floor(bases.reduce(sum) + extras.reduce(sum));
+ update();
}
-function modifiers(calc, stats, masks) {
+async function update() {
+ let infusionId = [...document.getElementsByName("infusion")].find(radio => radio.checked).id;
+ let upgradeLevel = 25;
+
+ let stats = [...document.getElementsByName("stat")].map(el => parseInt(el.value));
+
+ let sorted = sortWeapons(infusionId, upgradeLevel, stats);
+ console.log(sorted);
+
+ console.log(sorted.find(item => item.id == "royal-greatsword"))
+}
+
+function sortWeapons(infusionId, upgradeLevel, stats) {
+ return Object.values(weapons).sort((a, b) => damage(b, infusionId, upgradeLevel, stats) - damage(a, infusionId, upgradeLevel, stats));
+}
+
+function damage(weapon, infusionId, upgradeLevel, stats) {
+ if (weapon.total != undefined && weapon.total != null) {
+ return weapon.total;
+ }
+
+ let weaponInfusion = weapon.infusions[infusionId];
+ let infusion = infusions[infusionId];
+
+ let bases = infusion.damage.map((amount, ty) => weaponInfusion.damage[ty] * (amount + infusion.upgrade[ty] * upgradeLevel));
+
+ let extras;
+ if (stats.some((stat, i) => stat <= weapon.requirements[i])) {
+ extras = bases.map(dmg => dmg * -0.4);
+ } else {
+ extras = bases.map((amount, ty) => {
+ let calc = corrections[weaponInfusion.corrections[ty]];
+ let correction = typeCorrections(calc, stats, weaponInfusion.masks[ty]);
+ let scalings = weaponInfusion.scaling.map(itemScaling => {
+ return (itemScaling * infusion.scaling[ty] + itemScaling * infusion.scaling[ty] * infusion.growth[ty] * upgradeLevel);
+ })
+ let extras = scalings.map((statScaling, statIndex) => {
+ return amount * statScaling * correction[statIndex] / 100.0;
+ })
+ return extras.reduce(sum);
+ });
+ }
+
+ let total = Math.floor(bases.reduce(sum) + extras.reduce(sum));
+
+ weapon.bases = bases;
+ weapon.extras = extras;
+ weapon.total = total;
+
+ return total;
+}
+
+function typeCorrections(calc, stats, masks) {
return stats.map((stat, ty) => {
let mask = masks[ty];
if (mask == 0) {
diff --git a/src/style/main.css b/src/style/main.css
index 48aa4b7..02c6c47 100644
--- a/src/style/main.css
+++ b/src/style/main.css
@@ -198,12 +198,16 @@ button {
color: black;
}
+label {
+ user-select: none;
+}
+
/* cards */
.cards {
display: flex;
flex-flow: row wrap;
- justify-content: space-between;
- gap: 10px;
+ justify-content: center;
+ gap: 15px;
}
.cards article {
diff --git a/src/weapons.html b/src/weapons.html
index e69de29..fca8c1b 100644
--- a/src/weapons.html
+++ b/src/weapons.html
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Erdtree - Weapon Finder
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+