Start laying out spells, and refactor stuff
This commit is contained in:
parent
aa29998340
commit
30c142f497
6 changed files with 138 additions and 155 deletions
70
build.js
70
build.js
|
@ -49,58 +49,67 @@ class Build{
|
||||||
|
|
||||||
/*Construct a build.
|
/*Construct a build.
|
||||||
*/
|
*/
|
||||||
constructor(level,helmet,chestplate,leggings,boots,ring1,ring2,bracelet,necklace,weapon,powders){
|
constructor(level,equipment, powders){
|
||||||
// NOTE: powders is just an array of arrays of powder IDs. Not powder objects.
|
// NOTE: powders is just an array of arrays of powder IDs. Not powder objects.
|
||||||
this.powders = powders
|
this.powders = powders
|
||||||
if(helmet.type.valueOf() != "helmet".valueOf()){
|
if(itemMap.get(equipment[0]) && itemMap.get(equipment[0]).type === "helmet") {
|
||||||
throw new TypeError("No such helmet named ", helmet.name);
|
const helmet = itemMap.get(equipment[0]);
|
||||||
}else{
|
|
||||||
this.powders[0] = this.powders[0].slice(0,helmet.slots);
|
this.powders[0] = this.powders[0].slice(0,helmet.slots);
|
||||||
this.helmet = expandItem(helmet, this.powders[0]);
|
this.helmet = expandItem(helmet, this.powders[0]);
|
||||||
}
|
|
||||||
if(chestplate.type.valueOf() != "chestplate"){
|
|
||||||
throw new TypeError("No such chestplate named ", chestplate.name);
|
|
||||||
}else{
|
}else{
|
||||||
|
throw new TypeError("No such helmet named ", equipment[0]);
|
||||||
|
}
|
||||||
|
if(itemMap.get(equipment[1]).type === "chestplate") {
|
||||||
|
const chestplate = itemMap.get(equipment[1]);
|
||||||
this.powders[1] = this.powders[1].slice(0,chestplate.slots);
|
this.powders[1] = this.powders[1].slice(0,chestplate.slots);
|
||||||
this.chestplate = expandItem(chestplate, this.powders[1]);
|
this.chestplate = expandItem(chestplate, this.powders[1]);
|
||||||
}
|
|
||||||
if(leggings.type.valueOf() != "leggings"){
|
|
||||||
throw new TypeError("No such leggings named ", leggings.name);
|
|
||||||
}else{
|
}else{
|
||||||
|
throw new TypeError("No such chestplate named ", equipment[1]);
|
||||||
|
}
|
||||||
|
if(itemMap.get(equipment[2]).type === "leggings") {
|
||||||
|
const leggings = itemMap.get(equipment[2]);
|
||||||
this.powders[2] = this.powders[2].slice(0,leggings.slots);
|
this.powders[2] = this.powders[2].slice(0,leggings.slots);
|
||||||
this.leggings = expandItem(leggings, this.powders[2]);
|
this.leggings = expandItem(leggings, this.powders[2]);
|
||||||
}
|
|
||||||
if(boots.type.valueOf() != "boots"){
|
|
||||||
throw new TypeError("No such boots named ", boots.name);
|
|
||||||
}else{
|
}else{
|
||||||
|
throw new TypeError("No such leggings named ", equipment[2]);
|
||||||
|
}
|
||||||
|
if(itemMap.get(equipment[3]).type === "boots") {
|
||||||
|
const boots = itemMap.get(equipment[3]);
|
||||||
this.powders[3] = this.powders[3].slice(0,boots.slots);
|
this.powders[3] = this.powders[3].slice(0,boots.slots);
|
||||||
this.boots = expandItem(boots, this.powders[3]);
|
this.boots = expandItem(boots, this.powders[3]);
|
||||||
}
|
|
||||||
if(ring1.type.valueOf() != "ring"){
|
|
||||||
throw new TypeError("No such ring named ", ring1.name);
|
|
||||||
}else{
|
}else{
|
||||||
this.ring1 = expandItem(ring1, []);
|
throw new TypeError("No such boots named ", equipment[3]);
|
||||||
}
|
}
|
||||||
if(ring2.type.valueOf() != "ring"){
|
if(itemMap.get(equipment[4]).type === "ring") {
|
||||||
throw new TypeError("No such ring named ", ring2.name);
|
const ring = itemMap.get(equipment[4]);
|
||||||
|
this.ring1 = expandItem(ring, [])
|
||||||
}else{
|
}else{
|
||||||
this.ring2 = expandItem(ring2, []);
|
throw new TypeError("No such ring named ", equipment[4]);
|
||||||
}
|
}
|
||||||
if(bracelet.type.valueOf() != "bracelet"){
|
if(itemMap.get(equipment[5]).type === "ring") {
|
||||||
throw new TypeError("No such bracelet named ", bracelet.name);
|
const ring = itemMap.get(equipment[5]);
|
||||||
|
this.ring2 = expandItem(ring, [])
|
||||||
}else{
|
}else{
|
||||||
this.bracelet = expandItem(bracelet, []);
|
throw new TypeError("No such ring named ", equipment[5]);
|
||||||
}
|
}
|
||||||
if(necklace.type.valueOf() != "necklace"){
|
if(itemMap.get(equipment[6]).type === "bracelet") {
|
||||||
throw new TypeError("No such necklace named ", necklace.name);
|
const bracelet = itemMap.get(equipment[6]);
|
||||||
|
this.bracelet = expandItem(bracelet, [])
|
||||||
}else{
|
}else{
|
||||||
this.necklace = expandItem(necklace, []);
|
throw new TypeError("No such bracelet named ", equipment[6]);
|
||||||
}
|
}
|
||||||
if(weapon.type.valueOf() == "wand" || weapon.type.valueOf() == "bow" || weapon.type.valueOf() == "dagger" || weapon.type.valueOf() == "spear" || weapon.type.valueOf() == "relik"){
|
if(itemMap.get(equipment[7]).type === "necklace") {
|
||||||
|
const necklace = itemMap.get(equipment[7]);
|
||||||
|
this.necklace = expandItem(necklace, [])
|
||||||
|
}else{
|
||||||
|
throw new TypeError("No such necklace named ", equipment[7]);
|
||||||
|
}
|
||||||
|
if(itemMap.get(equipment[8]).category === "weapon") {
|
||||||
|
const weapon = itemMap.get(equipment[8]);
|
||||||
this.powders[4] = this.powders[4].slice(0,weapon.slots);
|
this.powders[4] = this.powders[4].slice(0,weapon.slots);
|
||||||
this.weapon = expandItem(weapon, this.powders[4]);
|
this.weapon = expandItem(weapon, this.powders[4]);
|
||||||
}else{
|
}else{
|
||||||
throw new TypeError("No such weapon named ", weapon.name);
|
throw new TypeError("No such weapon named ", equipment[8]);
|
||||||
}
|
}
|
||||||
if(level < 1){ //Should these be constants?
|
if(level < 1){ //Should these be constants?
|
||||||
this.level = 1;
|
this.level = 1;
|
||||||
|
@ -162,7 +171,10 @@ class Build{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0 for melee damage.
|
// 0 for melee damage.
|
||||||
let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], stats.get("mdRaw"), stats.get("mdPct"), 0, this.weapon, this.damageMultiplier, this.total_skillpoints);
|
let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], stats.get("mdRaw"), stats.get("mdPct"), 0, this.weapon, this.total_skillpoints);
|
||||||
|
|
||||||
|
//TODO: Account for strength (this.damageMultiplier).
|
||||||
|
|
||||||
let totalDamNorm = results[0];
|
let totalDamNorm = results[0];
|
||||||
let totalDamCrit = results[1];
|
let totalDamCrit = results[1];
|
||||||
let damages_results = results[2];
|
let damages_results = results[2];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Calculate spell damage given a spell elemental conversion table, and a spell multiplier.
|
// Calculate spell damage given a spell elemental conversion table, and a spell multiplier.
|
||||||
// If spell mult is 0, its melee damage and we don't multiply by attack speed.
|
// If spell mult is 0, its melee damage and we don't multiply by attack speed.
|
||||||
function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, spellMultiplier, weapon, damageMultiplier, total_skillpoints) {
|
function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier, spellMultiplier, weapon, total_skillpoints) {
|
||||||
// Array of neutral + ewtfa damages. Each entry is a pair (min, max).
|
// Array of neutral + ewtfa damages. Each entry is a pair (min, max).
|
||||||
let damages = [];
|
let damages = [];
|
||||||
for (const damage_string of stats.get("damageRaw")) {
|
for (const damage_string of stats.get("damageRaw")) {
|
||||||
|
@ -42,7 +42,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
||||||
damages[0][1] *= neutralRemaining / 100;
|
damages[0][1] *= neutralRemaining / 100;
|
||||||
console.log(damages);
|
console.log(damages);
|
||||||
|
|
||||||
let damageMult = damageMultiplier;
|
let damageMult = 1;
|
||||||
// If we are doing melee calculations:
|
// If we are doing melee calculations:
|
||||||
if (spellMultiplier == 0) {
|
if (spellMultiplier == 0) {
|
||||||
spellMultiplier = 1;
|
spellMultiplier = 1;
|
||||||
|
@ -77,9 +77,7 @@ function calculateSpellDamage(stats, spellConversions, rawModifier, pctModifier,
|
||||||
totalDamCrit[0] += damages_results[i][2];
|
totalDamCrit[0] += damages_results[i][2];
|
||||||
totalDamCrit[1] += damages_results[i][3];
|
totalDamCrit[1] += damages_results[i][3];
|
||||||
}
|
}
|
||||||
for (let i in damages_results[0]) {
|
damages_results[0][0] += rawModifier;
|
||||||
// Never account for attack speed.
|
damages_results[0][1] += rawModifier;
|
||||||
damages_results[0][i] += rawModifier * damageMultiplier;
|
|
||||||
}
|
|
||||||
return [totalDamNorm, totalDamCrit, damages_results];
|
return [totalDamNorm, totalDamCrit, damages_results];
|
||||||
}
|
}
|
||||||
|
|
22
display.js
22
display.js
|
@ -60,7 +60,7 @@ function displayExpandedItem(item, parent_id){
|
||||||
stats.set("atkSpd", item.get("atkSpd"));
|
stats.set("atkSpd", item.get("atkSpd"));
|
||||||
stats.set("damageBonus", [0, 0, 0, 0, 0]);
|
stats.set("damageBonus", [0, 0, 0, 0, 0]);
|
||||||
stats.set("damageRaw", [item.get("nDam"), item.get("eDam"), item.get("tDam"), item.get("wDam"), item.get("fDam"), item.get("aDam")]);
|
stats.set("damageRaw", [item.get("nDam"), item.get("eDam"), item.get("tDam"), item.get("wDam"), item.get("fDam"), item.get("aDam")]);
|
||||||
let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, 1, [0, 0, 0, 0, 0]);
|
let results = calculateSpellDamage(stats, [100, 0, 0, 0, 0, 0], 0, 0, 0, item, [0, 0, 0, 0, 0]);
|
||||||
let damages = results[2];
|
let damages = results[2];
|
||||||
let damage_keys = [ "nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_" ];
|
let damage_keys = [ "nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_" ];
|
||||||
for (const i in damage_keys) {
|
for (const i in damage_keys) {
|
||||||
|
@ -76,8 +76,8 @@ function displayExpandedItem(item, parent_id){
|
||||||
"#ldiv",
|
"#ldiv",
|
||||||
"!elemental",
|
"!elemental",
|
||||||
"hp",
|
"hp",
|
||||||
"nDam_", "eDam_", "tDam_", "wDam_", "fDam_", "aDam_",
|
"nDam_", "fDam_", "wDam_", "aDam_", "tDam_", "eDam_",
|
||||||
"eDef", "tDef", "wDef", "fDef", "aDef",
|
"fDef", "wDef", "aDef", "tDef", "eDef",
|
||||||
"!elemental",
|
"!elemental",
|
||||||
"#ldiv",
|
"#ldiv",
|
||||||
"classReq",
|
"classReq",
|
||||||
|
@ -98,8 +98,8 @@ function displayExpandedItem(item, parent_id){
|
||||||
"spd",
|
"spd",
|
||||||
"atkTier",
|
"atkTier",
|
||||||
"!elemental",
|
"!elemental",
|
||||||
"eDamPct", "tDamPct", "wDamPct", "fDamPct", "aDamPct",
|
"fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct",
|
||||||
"eDefPct", "tDefPct", "wDefPct", "fDefPct", "aDefPct",
|
"fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct",
|
||||||
"!elemental",
|
"!elemental",
|
||||||
"spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4",
|
"spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4",
|
||||||
"rainbowRaw",
|
"rainbowRaw",
|
||||||
|
@ -115,7 +115,7 @@ function displayExpandedItem(item, parent_id){
|
||||||
"quest",
|
"quest",
|
||||||
"restrict"];
|
"restrict"];
|
||||||
|
|
||||||
let idPrefixes = {"displayName": "", "lvl":"Combat Level Min: ", "classReq":"Class Req: ","strReq":"Strength Min: ","dexReq":"Dexterity Min: ","intReq":"Intelligence Min: ","defReq":"Defense Min: ","agiReq":"Agility Min: ", "nDam_":"Neutral Damage: ", "eDam_":"Earth Damage: ", "tDam_":"Thunder Damage: ", "wDam_":"Water Damage: ", "fDam_":"Fire Damage: ", "aDam_":"Air Damage: ", "atkSpd":"Attack Speed: ", "hp":"Health : ", "eDef":"Earth Defense: ", "tDef":"Thunder Defense: ", "wDef":"Water Defense: ", "fDef":"Fire Defense: ", "aDef":"Air Defense: ", "str":"Strength: ", "dex":"Dexterity: ", "int":"Intelligence: ", "def":"Defense: ","agi":"Agility: ", "hpBonus":"Health Bonus: ", "hprRaw":"Health Regen Raw: ", "hprPct":"Health Regen %: ", "sdRaw":"Raw Spell Damage: ", "sdPct":"Spell Damage %: ", "mdRaw":"Main Attack Neutral Damage: ", "mdPct":"Main Attack Damage %: ", "mr":"Mana Regen: ", "ms":"Mana Steal: ", "ref":"Reflection: ", "ls":"Life Steal: ", "poison":"Poison: ", "thorns":"Thorns: ", "exploding":"Expoding: ", "spd":"Walk Speed Bonus: ", "atkTier":"Attack Speed Bonus: ", "eDamPct":"Earth Damage %: ", "tDamPct":"Thunder Damage %: ", "wDamPct":"Water Damage %: ", "fDamPct":"Fire Damage %: ", "aDamPct":"Air Damage %: ", "eDefPct":"Earth Defense %: ", "tDefPct":"Thunder Defense %: ", "wDefPct":"Water Defense %: ", "fDefPct":"Fire Defense %: ", "aDefPct":"Air Defense %: ", "spPct1":"1st Spell Cost %: ", "spRaw1":"1st Spell Cost Raw: ", "spPct2":"2nd Spell Cost %: ", "spRaw2":"2nd Spell Cost Raw: ", "spPct3":"3rd Spell Cost %: ", "spRaw3":"3rd Spell Cost Raw: ", "spPct4":"4th Spell Cost %: ", "spRaw4":"4th Spell Cost Raw: ", "rainbowRaw":"Rainbow Spell Damage Raw: ", "sprint":"Sprint Bonus: ", "sprintReg":"Sprint Regen Bonus: ", "jh":"Jump Height: ", "xpb":"Combat XP Bonus: ", "lb":"Loot Bonus: ", "lq":"Loot Quality: ", "spRegen":"Soul Point Regen: ", "eSteal":"Stealing: ", "gXp":"Gathering XP Bonus: ", "gSpd":"Gathering Speed Bonus: ", "slots":"Powder Slots: ", "set":"Set: ", "quest":"Quest Req: ", "restrict":""};
|
let idPrefixes = {"displayName": "", "lvl":"Combat Level Min: ", "classReq":"Class Req: ","strReq":"Strength Min: ","dexReq":"Dexterity Min: ","intReq":"Intelligence Min: ","defReq":"Defense Min: ","agiReq":"Agility Min: ", "nDam_":"Neutral Damage: ", "eDam_":"Earth Damage: ", "tDam_":"Thunder Damage: ", "wDam_":"Water Damage: ", "fDam_":"Fire Damage: ", "aDam_":"Air Damage: ", "atkSpd":"Attack Speed: ", "hp":"Health : ", "eDef":"Earth Defense: ", "tDef":"Thunder Defense: ", "wDef":"Water Defense: ", "fDef":"Fire Defense: ", "aDef":"Air Defense: ", "str":"Strength: ", "dex":"Dexterity: ", "int":"Intelligence: ", "def":"Defense: ","agi":"Agility: ", "hpBonus":"Health Bonus: ", "hprRaw":"Health Regen Raw: ", "hprPct":"Health Regen %: ", "sdRaw":"Raw Spell Damage: ", "sdPct":"Spell Damage %: ", "mdRaw":"Main Attack Neutral Damage: ", "mdPct":"Main Attack Damage %: ", "mr":"Mana Regen: ", "ms":"Mana Steal: ", "ref":"Reflection: ", "ls":"Life Steal: ", "poison":"Poison: ", "thorns":"Thorns: ", "exploding":"Exploding: ", "spd":"Walk Speed Bonus: ", "atkTier":"Attack Speed Bonus: ", "eDamPct":"Earth Damage %: ", "tDamPct":"Thunder Damage %: ", "wDamPct":"Water Damage %: ", "fDamPct":"Fire Damage %: ", "aDamPct":"Air Damage %: ", "eDefPct":"Earth Defense %: ", "tDefPct":"Thunder Defense %: ", "wDefPct":"Water Defense %: ", "fDefPct":"Fire Defense %: ", "aDefPct":"Air Defense %: ", "spPct1":"1st Spell Cost %: ", "spRaw1":"1st Spell Cost Raw: ", "spPct2":"2nd Spell Cost %: ", "spRaw2":"2nd Spell Cost Raw: ", "spPct3":"3rd Spell Cost %: ", "spRaw3":"3rd Spell Cost Raw: ", "spPct4":"4th Spell Cost %: ", "spRaw4":"4th Spell Cost Raw: ", "rainbowRaw":"Rainbow Spell Damage Raw: ", "sprint":"Sprint Bonus: ", "sprintReg":"Sprint Regen Bonus: ", "jh":"Jump Height: ", "xpb":"Combat XP Bonus: ", "lb":"Loot Bonus: ", "lq":"Loot Quality: ", "spRegen":"Soul Point Regen: ", "eSteal":"Stealing: ", "gXp":"Gathering XP Bonus: ", "gSpd":"Gathering Speed Bonus: ", "slots":"Powder Slots: ", "set":"Set: ", "quest":"Quest Req: ", "restrict":""};
|
||||||
let idSuffixes = {"displayName": "", "lvl":"", "classReq":"","strReq":"","dexReq":"","intReq":"","defReq":"","agiReq":"", "nDam_":"", "eDam_":"", "tDam_":"", "wDam_":"", "fDam_":"", "aDam_":"", "atkSpd":"", "hp":"", "eDef":"", "tDef":"", "wDef":"", "fDef":"", "aDef":"", "str":"", "dex":"", "int":"", "def":"","agi":"", "hpBonus":"", "hprRaw":"", "hprPct":"%", "sdRaw":"", "sdPct":"%", "mdRaw":"", "mdPct":"%", "mr":"/4s", "ms":"/4s", "ref":"%", "ls":"/4s", "poison":"/3s", "thorns":"%", "exploding":"%", "spd":"%", "atkTier":" tier", "eDamPct":"%", "tDamPct":"%", "wDamPct":"%", "fDamPct":"%", "aDamPct":"%", "eDefPct":"%", "tDefPct":"%", "wDefPct":"%", "fDefPct":"%", "aDefPct":"%", "spPct1":"%", "spRaw1":"", "spPct2":"%", "spRaw2":"", "spPct3":"%", "spRaw3":"", "spPct4":"%", "spRaw4":"", "rainbowRaw":"", "sprint":"%", "sprintReg":"%", "jh":"", "xpb":"%", "lb":"%", "lq":"%", "spRegen":"%", "eSteal":"%", "gXp":"%", "gSpd":"%", "slots":"", "set":" set.", "quest":"", "restrict":""};
|
let idSuffixes = {"displayName": "", "lvl":"", "classReq":"","strReq":"","dexReq":"","intReq":"","defReq":"","agiReq":"", "nDam_":"", "eDam_":"", "tDam_":"", "wDam_":"", "fDam_":"", "aDam_":"", "atkSpd":"", "hp":"", "eDef":"", "tDef":"", "wDef":"", "fDef":"", "aDef":"", "str":"", "dex":"", "int":"", "def":"","agi":"", "hpBonus":"", "hprRaw":"", "hprPct":"%", "sdRaw":"", "sdPct":"%", "mdRaw":"", "mdPct":"%", "mr":"/4s", "ms":"/4s", "ref":"%", "ls":"/4s", "poison":"/3s", "thorns":"%", "exploding":"%", "spd":"%", "atkTier":" tier", "eDamPct":"%", "tDamPct":"%", "wDamPct":"%", "fDamPct":"%", "aDamPct":"%", "eDefPct":"%", "tDefPct":"%", "wDefPct":"%", "fDefPct":"%", "aDefPct":"%", "spPct1":"%", "spRaw1":"", "spPct2":"%", "spRaw2":"", "spPct3":"%", "spRaw3":"", "spPct4":"%", "spRaw4":"", "rainbowRaw":"", "sprint":"%", "sprintReg":"%", "jh":"", "xpb":"%", "lb":"%", "lq":"%", "spRegen":"%", "eSteal":"%", "gXp":"%", "gSpd":"%", "slots":"", "set":" set.", "quest":"", "restrict":""};
|
||||||
|
|
||||||
function apply_elemental_format(p_elem, id, suffix) {
|
function apply_elemental_format(p_elem, id, suffix) {
|
||||||
|
@ -176,7 +176,14 @@ function displayExpandedItem(item, parent_id){
|
||||||
apply_elemental_format(p_elem, id, item.get(id));
|
apply_elemental_format(p_elem, id, item.get(id));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]);
|
if (id === "slots") {
|
||||||
|
// HACK TO MAKE POWDERS DISPLAY NICE!! TODO
|
||||||
|
p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]) +
|
||||||
|
" [ " + item.get("powders").map(x => powderNames.get(x)) + " ]";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p_elem.textContent = idPrefixes[id].concat(item.get(id), idSuffixes[id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
active_elem.appendChild(p_elem);
|
active_elem.appendChild(p_elem);
|
||||||
}
|
}
|
||||||
|
@ -212,6 +219,7 @@ function displayExpandedItem(item, parent_id){
|
||||||
|
|
||||||
let desc_elem = document.createElement('td');
|
let desc_elem = document.createElement('td');
|
||||||
desc_elem.classList.add('center');
|
desc_elem.classList.add('center');
|
||||||
|
//TODO elemental format jank
|
||||||
if (elemental_format) {
|
if (elemental_format) {
|
||||||
apply_elemental_format(desc_elem, id);
|
apply_elemental_format(desc_elem, id);
|
||||||
}
|
}
|
||||||
|
|
18
index.html
18
index.html
|
@ -241,6 +241,24 @@
|
||||||
<div class = "center" id = "build-defense-stats" style = "grid-column:4;grid-row:3">
|
<div class = "center" id = "build-defense-stats" style = "grid-column:4;grid-row:3">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class = "spells">
|
||||||
|
<div class = "center spell-info" id = "spell1" style = "grid-column:1;grid-row:1">
|
||||||
|
<div class = "center" id = "spell1-name">Spell 1</div>
|
||||||
|
<div class = "center" id = "spell1-info"></div>
|
||||||
|
</div>
|
||||||
|
<div class = "center spell-info" id = "spell2" style = "grid-column:2;grid-row:1">
|
||||||
|
<div class = "center" id = "spell2-name">Spell 2</div>
|
||||||
|
<div class = "center" id = "spell2-info"></div>
|
||||||
|
</div>
|
||||||
|
<div class = "center spell-info" id = "spell3" style = "grid-column:3;grid-row:1">
|
||||||
|
<div class = "center" id = "spell3-name">Spell 3</div>
|
||||||
|
<div class = "center" id = "spell3-info"></div>
|
||||||
|
</div>
|
||||||
|
<div class = "center spell-info" id = "spell4" style = "grid-column:4;grid-row:1">
|
||||||
|
<div class = "center" id = "spell4-name">Spell 4</div>
|
||||||
|
<div class = "center" id = "spell4-info"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="utils.js"></script>
|
<script type="text/javascript" src="utils.js"></script>
|
||||||
<script type="text/javascript" src="skillpoints.js"></script>
|
<script type="text/javascript" src="skillpoints.js"></script>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.build{
|
.build, .spells {
|
||||||
padding: 1%;
|
padding: 1%;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
@ -44,6 +44,13 @@
|
||||||
grid-auto-rows: minmax(60px, auto);
|
grid-auto-rows: minmax(60px, auto);
|
||||||
width: 98%;
|
width: 98%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spell-info {
|
||||||
|
border: 2px solid black;
|
||||||
|
border-radius: 3px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order {
|
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
background: #110110;
|
background: #110110;
|
||||||
|
|
164
test.js
164
test.js
|
@ -20,9 +20,35 @@ let player_build;
|
||||||
let armorTypes = [ "helmet", "chestplate", "leggings", "boots" ];
|
let armorTypes = [ "helmet", "chestplate", "leggings", "boots" ];
|
||||||
let accessoryTypes = [ "ring", "bracelet", "necklace" ];
|
let accessoryTypes = [ "ring", "bracelet", "necklace" ];
|
||||||
let weaponTypes = [ "wand", "spear", "bow", "dagger", "relik" ];
|
let weaponTypes = [ "wand", "spear", "bow", "dagger", "relik" ];
|
||||||
|
// THIS IS SUPER DANGEROUS, WE SHOULD NOT BE KEEPING THIS IN SO MANY PLACES
|
||||||
let item_fields = [ "name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "str", "dex", "int", "agi", "def", "thorns", "exploding", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "fixID", "category", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd", "id" ];
|
let item_fields = [ "name", "displayName", "tier", "set", "slots", "type", "material", "drop", "quest", "restrict", "nDam", "fDam", "wDam", "aDam", "tDam", "eDam", "atkSpd", "hp", "fDef", "wDef", "aDef", "tDef", "eDef", "lvl", "classReq", "strReq", "dexReq", "intReq", "defReq", "agiReq", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "str", "dex", "int", "agi", "def", "thorns", "exploding", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "fixID", "category", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd", "id" ];
|
||||||
let skpReqs = ["strReq", "dexReq", "intReq", "defReq", "agiReq"];
|
let skpReqs = ["strReq", "dexReq", "intReq", "defReq", "agiReq"];
|
||||||
|
|
||||||
|
let equipment_fields = [
|
||||||
|
"helmet",
|
||||||
|
"chestplate",
|
||||||
|
"leggings",
|
||||||
|
"boots",
|
||||||
|
"ring1",
|
||||||
|
"ring2",
|
||||||
|
"bracelet",
|
||||||
|
"necklace",
|
||||||
|
"weapon"
|
||||||
|
];
|
||||||
|
let equipment_names = [
|
||||||
|
"Helmet",
|
||||||
|
"Chestplate",
|
||||||
|
"Leggings",
|
||||||
|
"Boots",
|
||||||
|
"Ring 1",
|
||||||
|
"Ring 2",
|
||||||
|
"Bracelet",
|
||||||
|
"Necklace",
|
||||||
|
"Weapon"
|
||||||
|
];
|
||||||
|
let equipmentInputs = equipment_fields.map(x => x + "-choice");
|
||||||
|
let buildFields = equipment_fields.map(x => "build-"+x);
|
||||||
|
|
||||||
let powderIDs = new Map();
|
let powderIDs = new Map();
|
||||||
let powderNames = new Map();
|
let powderNames = new Map();
|
||||||
let _powderID = 0;
|
let _powderID = 0;
|
||||||
|
@ -131,10 +157,6 @@ function init() {
|
||||||
itemMap.set(item.displayName, item);
|
itemMap.set(item.displayName, item);
|
||||||
idMap.set(item.id, item.displayName);
|
idMap.set(item.id, item.displayName);
|
||||||
}
|
}
|
||||||
/*for (const item of noneItems){
|
|
||||||
itemLists.get(item.type).push(item.name);
|
|
||||||
itemMap.set(item.name, item);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
for (const armorType of armorTypes) {
|
for (const armorType of armorTypes) {
|
||||||
populateItemList(armorType);
|
populateItemList(armorType);
|
||||||
|
@ -192,29 +214,15 @@ function init() {
|
||||||
*/
|
*/
|
||||||
function populateFromURL() {
|
function populateFromURL() {
|
||||||
if (url_tag) {
|
if (url_tag) {
|
||||||
let helmet;
|
let equipment = [null, null, null, null, null, null, null, null, null];
|
||||||
let chestplate;
|
|
||||||
let leggings;
|
|
||||||
let boots;
|
|
||||||
let ring1;
|
|
||||||
let ring2;
|
|
||||||
let bracelet;
|
|
||||||
let necklace;
|
|
||||||
let weapon;
|
|
||||||
let powdering = ["", "", "", "", ""];
|
let powdering = ["", "", "", "", ""];
|
||||||
let info = url_tag.split("_");
|
let info = url_tag.split("_");
|
||||||
let version = info[0];
|
let version = info[0];
|
||||||
if (version === "0" || version === "1") {
|
if (version === "0" || version === "1") {
|
||||||
let equipments = info[1];
|
let equipments = info[1];
|
||||||
helmet = idMap.get(Base64.toInt(equipments.slice(0,3)));
|
for (let i = 0; i < 9; ++i ) {
|
||||||
chestplate = idMap.get(Base64.toInt(equipments.slice(3,6)));
|
equipment[i] = idMap.get(Base64.toInt(equipments.slice(i*3,i*3+3)));
|
||||||
leggings = idMap.get(Base64.toInt(equipments.slice(6,9)));
|
}
|
||||||
boots = idMap.get(Base64.toInt(equipments.slice(9,12)));
|
|
||||||
ring1 = idMap.get(Base64.toInt(equipments.slice(12,15)));
|
|
||||||
ring2 = idMap.get(Base64.toInt(equipments.slice(15,18)));
|
|
||||||
bracelet = idMap.get(Base64.toInt(equipments.slice(18,21)));
|
|
||||||
necklace = idMap.get(Base64.toInt(equipments.slice(21,24)));
|
|
||||||
weapon = idMap.get(Base64.toInt(equipments.slice(24,27)));
|
|
||||||
}
|
}
|
||||||
if (version === "1") {
|
if (version === "1") {
|
||||||
let powder_info = info[1].slice(27);
|
let powder_info = info[1].slice(27);
|
||||||
|
@ -239,20 +247,12 @@ function populateFromURL() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setValue("helmet-choice", helmet);
|
for (let i in powderInputs) {
|
||||||
setValue("helmet-powder", powdering[0]);
|
setValue(powderInputs[i], powdering[i]);
|
||||||
setValue("chestplate-choice", chestplate);
|
}
|
||||||
setValue("chestplate-powder", powdering[1]);
|
for (let i in equipment) {
|
||||||
setValue("leggings-choice", leggings);
|
setValue(equipmentInputs[i], equipment[i]);
|
||||||
setValue("leggings-powder", powdering[2]);
|
}
|
||||||
setValue("boots-choice", boots);
|
|
||||||
setValue("boots-powder", powdering[3]);
|
|
||||||
setValue("ring1-choice", ring1);
|
|
||||||
setValue("ring2-choice", ring2);
|
|
||||||
setValue("bracelet-choice", bracelet);
|
|
||||||
setValue("necklace-choice", necklace);
|
|
||||||
setValue("weapon-choice", weapon);
|
|
||||||
setValue("weapon-powder", powdering[4]);
|
|
||||||
setValue("str-skp", "0");
|
setValue("str-skp", "0");
|
||||||
setValue("dex-skp", "0");
|
setValue("dex-skp", "0");
|
||||||
setValue("int-skp", "0");
|
setValue("int-skp", "0");
|
||||||
|
@ -308,41 +308,11 @@ function calculateBuild(){
|
||||||
/* TODO: implement level changing
|
/* TODO: implement level changing
|
||||||
Make this entire function prettier
|
Make this entire function prettier
|
||||||
*/
|
*/
|
||||||
let helmet = getValue("helmet-choice");
|
let equipment = [ null, null, null, null, null, null, null, null, null ];
|
||||||
let chestplate = getValue("chestplate-choice");
|
for (let i in equipment) {
|
||||||
let leggings = getValue("leggings-choice");
|
let equip = getValue(equipmentInputs[i]);
|
||||||
let boots = getValue("boots-choice");
|
if (equip === "") equip = "No " + equipment_names[i];
|
||||||
let ring1 = getValue("ring1-choice");
|
equipment[i] = equip;
|
||||||
let ring2 = getValue("ring2-choice");
|
|
||||||
let bracelet = getValue("bracelet-choice");
|
|
||||||
let necklace = getValue("necklace-choice");
|
|
||||||
let weapon = getValue("weapon-choice");
|
|
||||||
if(helmet===""){
|
|
||||||
helmet = "No Helmet";
|
|
||||||
}
|
|
||||||
if(chestplate===""){
|
|
||||||
chestplate = "No Chestplate";
|
|
||||||
}
|
|
||||||
if(leggings===""){
|
|
||||||
leggings = "No Leggings";
|
|
||||||
}
|
|
||||||
if(boots===""){
|
|
||||||
boots = "No Boots";
|
|
||||||
}
|
|
||||||
if(ring1===""){
|
|
||||||
ring1 = "No Ring 1";
|
|
||||||
}
|
|
||||||
if(ring2===""){
|
|
||||||
ring2 = "No Ring 2";
|
|
||||||
}
|
|
||||||
if(bracelet===""){
|
|
||||||
bracelet = "No Bracelet";
|
|
||||||
}
|
|
||||||
if(necklace===""){
|
|
||||||
necklace = "No Necklace";
|
|
||||||
}
|
|
||||||
if(weapon===""){
|
|
||||||
weapon = "No Weapon";
|
|
||||||
}
|
}
|
||||||
let powderings = [];
|
let powderings = [];
|
||||||
for (const i in powderInputs) {
|
for (const i in powderInputs) {
|
||||||
|
@ -357,19 +327,8 @@ function calculateBuild(){
|
||||||
}
|
}
|
||||||
powderings.push(powdering);
|
powderings.push(powdering);
|
||||||
}
|
}
|
||||||
player_build = new Build(
|
console.log(equipment);
|
||||||
106,
|
player_build = new Build(106, equipment, powderings);
|
||||||
itemMap.get(helmet),
|
|
||||||
itemMap.get(chestplate),
|
|
||||||
itemMap.get(leggings),
|
|
||||||
itemMap.get(boots),
|
|
||||||
itemMap.get(ring1),
|
|
||||||
itemMap.get(ring2),
|
|
||||||
itemMap.get(bracelet),
|
|
||||||
itemMap.get(necklace),
|
|
||||||
itemMap.get(weapon),
|
|
||||||
powderings
|
|
||||||
);
|
|
||||||
console.log(player_build.toString());
|
console.log(player_build.toString());
|
||||||
|
|
||||||
let equip_order_text = "Equip order: <br>";
|
let equip_order_text = "Equip order: <br>";
|
||||||
|
@ -399,16 +358,9 @@ function calculateBuild(){
|
||||||
setText("summary-box", "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints.");
|
setText("summary-box", "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints.");
|
||||||
}
|
}
|
||||||
|
|
||||||
displayExpandedItem(player_build.helmet, "build-helmet");
|
for (let i in player_build.items) {
|
||||||
displayExpandedItem(player_build.chestplate, "build-chestplate");
|
displayExpandedItem(player_build.items[i], buildFields[i]);
|
||||||
displayExpandedItem(player_build.leggings, "build-leggings");
|
}
|
||||||
displayExpandedItem(player_build.boots, "build-boots");
|
|
||||||
displayExpandedItem(player_build.ring1, "build-ring1");
|
|
||||||
displayExpandedItem(player_build.ring2, "build-ring2");
|
|
||||||
displayExpandedItem(player_build.bracelet, "build-bracelet");
|
|
||||||
displayExpandedItem(player_build.necklace, "build-necklace");
|
|
||||||
displayExpandedItem(player_build.weapon, "build-weapon");
|
|
||||||
|
|
||||||
calculateBuildStats();
|
calculateBuildStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,25 +406,13 @@ function calculateBuildStats() {
|
||||||
location.hash = encodeBuild();
|
location.hash = encodeBuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function resetFields(){
|
function resetFields(){
|
||||||
setValue("helmet-choice", "");
|
for (let i in powderInputs) {
|
||||||
setValue("helmet-powder", "");
|
setValue(powderInputs[i], "");
|
||||||
setValue("chestplate-choice", "");
|
}
|
||||||
setValue("chestplate-powder", "");
|
for (let i in equipment) {
|
||||||
setValue("leggings-choice", "");
|
setValue(equipmentInputs[i], "");
|
||||||
setValue("leggings-powder", "");
|
}
|
||||||
setValue("boots-choice", "");
|
|
||||||
setValue("boots-powder", "");
|
|
||||||
setValue("ring1-choice", "");
|
|
||||||
setValue("ring2-choice", "");
|
|
||||||
setValue("bracelet-choice", "");
|
|
||||||
setValue("necklace-choice", "");
|
|
||||||
setValue("weapon-choice", "");
|
|
||||||
setValue("weapon-powder", "");
|
|
||||||
setValue("str-skp", "0");
|
setValue("str-skp", "0");
|
||||||
setValue("dex-skp", "0");
|
setValue("dex-skp", "0");
|
||||||
setValue("int-skp", "0");
|
setValue("int-skp", "0");
|
||||||
|
|
Loading…
Add table
Reference in a new issue