Fix merge conflicts

This commit is contained in:
b 2021-01-07 02:45:41 -06:00
commit 77e9d77742
3 changed files with 147 additions and 35 deletions

View file

@ -14,7 +14,7 @@
<div class="center" style="grid-column:1;grid-row:1"> <div class="center" style="grid-column:1;grid-row:1">
<div> <div>
<label for="helmet-choice">Helmet:</label> <label for="helmet-choice">Helmet:</label>
<input list="helmet-items" id="helmet-choice" name="helmet-choice" value="No Helmet"/> <input list="helmet-items" id="helmet-choice" name="helmet-choice" value=""/>
<datalist id="helmet-items"> <datalist id="helmet-items">
</datalist> </datalist>
</div> </div>
@ -29,7 +29,7 @@
<div class="center" style="grid-column:2;grid-row:1"> <div class="center" style="grid-column:2;grid-row:1">
<div> <div>
<label for="chestplate-choice">Chestplate:</label> <label for="chestplate-choice">Chestplate:</label>
<input list="chestplate-items" id="chestplate-choice" name="chestplate-choice" value="No Chestplate" /> <input list="chestplate-items" id="chestplate-choice" name="chestplate-choice" value=""/>
<datalist id="chestplate-items"> <datalist id="chestplate-items">
</datalist> </datalist>
</div> </div>
@ -44,7 +44,7 @@
<div class="center" style="grid-column:3;grid-row:1"> <div class="center" style="grid-column:3;grid-row:1">
<div> <div>
<label for="leggings-choice">Leggings:</label> <label for="leggings-choice">Leggings:</label>
<input list="leggings-items" id="leggings-choice" name="leggings-choice" value="No Leggings"/> <input list="leggings-items" id="leggings-choice" name="leggings-choice" value=""/>
<datalist id="leggings-items"> <datalist id="leggings-items">
</datalist> </datalist>
</div> </div>
@ -59,7 +59,7 @@
<div class="center" style="grid-column:4;grid-row:1"> <div class="center" style="grid-column:4;grid-row:1">
<div id="boots"> <div id="boots">
<label for="boots-choice">Boots:</label> <label for="boots-choice">Boots:</label>
<input list="boots-items" id="boots-choice" name="boots-choice" value="No Boots"/> <input list="boots-items" id="boots-choice" name="boots-choice" value=""/>
<datalist id="boots-items"> <datalist id="boots-items">
</datalist> </datalist>
</div> </div>
@ -73,31 +73,31 @@
</div> </div>
<div class="center" style="grid-column:1;grid-row:2"> <div class="center" style="grid-column:1;grid-row:2">
<label for="ring1-choice">Ring 1:</label> <label for="ring1-choice">Ring 1:</label>
<input list="ring1-items" id="ring1-choice" name="ring1-choice" value="No Ring 1"/> <input list="ring1-items" id="ring1-choice" name="ring1-choice" value=""/>
<datalist id="ring1-items"> <datalist id="ring1-items">
</datalist> </datalist>
</div> </div>
<div class="center" style="grid-column:2;grid-row:2"> <div class="center" style="grid-column:2;grid-row:2">
<label for="ring2-choice">Ring 2:</label> <label for="ring2-choice">Ring 2:</label>
<input list="ring2-items" id="ring2-choice" name="ring2-choice" value="No Ring 2"/> <input list="ring2-items" id="ring2-choice" name="ring2-choice" value=""/>
<datalist id="ring2-items"> <datalist id="ring2-items">
</datalist> </datalist>
</div> </div>
<div class="center" style="grid-column:3;grid-row:2"> <div class="center" style="grid-column:3;grid-row:2">
<label for="bracelet-choice">Bracelet:</label> <label for="bracelet-choice">Bracelet:</label>
<input list="bracelet-items" id="bracelet-choice" name="bracelet-choice" value="No Bracelet"/> <input list="bracelet-items" id="bracelet-choice" name="bracelet-choice" value=""/>
<datalist id="bracelet-items"> <datalist id="bracelet-items">
</datalist> </datalist>
</div> </div>
<div class="center" style="grid-column:4;grid-row:2"> <div class="center" style="grid-column:4;grid-row:2">
<label for="necklace-choice">Necklace:</label> <label for="necklace-choice">Necklace:</label>
<input list="necklace-items" id="necklace-choice" name="necklace-choice" value="No Necklace" /> <input list="necklace-items" id="necklace-choice" name="necklace-choice" value="" />
<datalist id="necklace-items"> <datalist id="necklace-items">
</datalist> </datalist>
</div> </div>
<div class="center" style="grid-column:1;grid-row:3"> <div class="center" style="grid-column:1;grid-row:3">
<label for="weapon-choice">Weapon:</label> <label for="weapon-choice">Weapon:</label><br>
<input list="weapon-items" id="weapon-choice" name="weapon-choice" value="No Weapon"/> <input list="weapon-items" id="weapon-choice" name="weapon-choice" value=""/>
<datalist id="weapon-items"> <datalist id="weapon-items">
</datalist> </datalist>
</div> </div>
@ -172,25 +172,34 @@
</div> </div>
</div> </div>
<div class = "build"> <div class = "build">
<div class = "center" id = "build-helmet" style = "grid-column:1;grid-row:1"> <div class = "center build-helmet" id = "build-helmet" style = "grid-column:1;grid-row:1">
<div class = "center" id = "build-helmet-stats"></div>
</div> </div>
<div class = "center" id = "build-chestplate" style = "grid-column:2;grid-row:1"> <div class = "center build-chestplate" id = "build-chestplate" style = "grid-column:2;grid-row:1">
<div class = "center" id = "build-chestplate-stats"></div>
</div> </div>
<div class = "center" id = "build-leggings" style = "grid-column:3;grid-row:1"> <div class = "center build-leggings" id = "build-leggings" style = "grid-column:3;grid-row:1">
<div class = "center" id = "build-leggings-stats"></div>
</div> </div>
<div class = "center" id = "build-boots" style = "grid-column:4;grid-row:1"> <div class = "center build-boots" id = "build-boots" style = "grid-column:4;grid-row:1">
<div class = "center" id = "build-boots-stats"></div>
</div> </div>
<div class = "center" id = "build-ring1" style = "grid-column:1;grid-row:2"> <div class = "center build-ring1" id = "build-ring1" style = "grid-column:1;grid-row:2">
<div class = "center" id = "build-ring1-stats"></div>
</div> </div>
<div class = "center" id = "build-ring2" style = "grid-column:2;grid-row:2"> <div class = "center build-ring2" id = "build-ring2" style = "grid-column:2;grid-row:2">
<div class = "center" id = "build-ring2-stats"></div>
</div> </div>
<div class = "center" id = "build-bracelet" style = "grid-column:3;grid-row:2"> <div class = "center build-leggings" id = "build-bracelet" style = "grid-column:3;grid-row:2">
<div class = "center" id = "build-bracelet-stats"></div>
</div> </div>
<div class = "center" id = "build-necklace" style = "grid-column:4;grid-row:2"> <div class = "center build-boots" id = "build-necklace" style = "grid-column:4;grid-row:2">
<div class = "center" id = "build-necklace-stats"></div>
</div> </div>
<div class = "center" id = "build-weapon" style = "grid-column:1;grid-row:3"> <div class = "center build-weapon" id = "build-weapon" style = "grid-column:1;grid-row:3">
<div class = "center" id = "build-weapon-stats"></div>
</div> </div>
<div class = "center" id = "build-order" style = "grid-column:2;grid-row:3"> <div class = "center build-order" id = "build-order" style = "grid-column:2;grid-row:3">
</div> </div>
<div class = "center" id = "build-cumulative-stats" style = "grid-column:3;grid-row:3"> <div class = "center" id = "build-cumulative-stats" style = "grid-column:3;grid-row:3">
</div> </div>

View file

@ -24,10 +24,15 @@
} }
.build{ .build{
padding: 4%; padding: 1%;
display: grid; display: grid;
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(4, 1fr);
gap: 10px; gap: 10px;
grid-auto-rows: minmax(60px, auto); grid-auto-rows: minmax(60px, auto);
/* width: 100vw; */ width: 90vw;
}
.build-helmet, .build-chestplate, .build-leggings, .build-boots, .build-ring1, .build-ring2, .build-bracelet, .build-necklace, .build-weapon, .build-order {
border: 2px solid black;
border-radius: 3px;
width: 20vw;
} }

120
test.js
View file

@ -13,7 +13,9 @@ 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" ];
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", "agiReq", "defReq", "hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "str", "dex", "int", "agi", "def", "thorns", "expoding", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "type", "fixID", "category", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd" ]; 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", "agiReq", "defReq", "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" ];
let nonRolledIDs = ["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", "agiReq", "defReq","str", "dex", "int", "agi", "def", "fixID", "category"];
let rolledIDs = ["hprPct", "mr", "sdPct", "mdPct", "ls", "ms", "xpb", "lb", "ref", "thorns", "exploding", "spd", "atkTier", "poison", "hpBonus", "spRegen", "eSteal", "hprRaw", "sdRaw", "mdRaw", "fDamPct", "wDamPct", "aDamPct", "tDamPct", "eDamPct", "fDefPct", "wDefPct", "aDefPct", "tDefPct", "eDefPct", "spPct1", "spRaw1", "spPct2", "spRaw2", "spPct3", "spRaw3", "spPct4", "spRaw4", "rainbowRaw", "sprint", "sprintReg", "jh", "lq", "gXp", "gSpd"];
let itemTypes = armorTypes.concat(accessoryTypes).concat(weaponTypes); let itemTypes = armorTypes.concat(accessoryTypes).concat(weaponTypes);
let itemLists = new Map(); let itemLists = new Map();
for (const it of itemTypes) { for (const it of itemTypes) {
@ -195,18 +197,114 @@ function calculateBuild(){
console.log(skillpoints); console.log(skillpoints);
player_build.assigned_skillpoints; player_build.assigned_skillpoints;
setHTML("summary-box", "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints."); setHTML("summary-box", "Summary: Assigned "+player_build.assigned_skillpoints+" skillpoints.");
setHTML("build-helmet", player_build.helmet.name); setHTML("build-helmet", expandedItemToString(expandItem(player_build.helmet)));
setHTML("build-chestplate", player_build.chestplate.name); setHTML("build-chestplate", expandedItemToString(expandItem(player_build.chestplate)));
setHTML("build-leggings", player_build.helmet.name); setHTML("build-leggings", expandedItemToString(expandItem(player_build.helmet)));
setHTML("build-boots", player_build.helmet.name); setHTML("build-boots", expandedItemToString(expandItem(player_build.helmet)));
setHTML("build-ring1", player_build.ring1.name); setHTML("build-ring1", expandedItemToString(expandItem(player_build.ring1)));
setHTML("build-ring2", player_build.ring2.name); setHTML("build-ring2", expandedItemToString(expandItem(player_build.ring2)));
setHTML("build-bracelet", player_build.bracelet.name); setHTML("build-bracelet", expandedItemToString(expandItem(player_build.bracelet)));
setHTML("build-necklace", player_build.necklace.name); setHTML("build-necklace", expandedItemToString(expandItem(player_build.necklace)));
setHTML("build-weapon", player_build.weapon.name); setHTML("build-weapon", expandedItemToString(expandItem(player_build.weapon)));
}
/* Helper function that gets stats ranges for wearable items.
@param item - an item in Object format.
*/
function expandItem(item){
let minRolls = new Map();
let maxRolls = new Map();
let expandedItem = new Map();
if(item.fixID){ //The item has fixed IDs.
expandedItem.set("fixID",true);
for (const id in rolledIDs){ //all rolled IDs are numerical
if(item[rolledIDs[id]]){
minRolls.set(rolledIDs[id],item[rolledIDs[id]]);
maxRolls.set(rolledIDs[id],item[rolledIDs[id]]);
}
}
for (id in nonRolledIDs){
if(item[nonRolledIDs[id]]){
expandedItem.set(nonRolledIDs[id],item[nonRolledIDs[id]]);
}
}
}else{ //The item does not have fixed IDs.
for (const id in rolledIDs){
console.log(id);
if(item[rolledIDs[id]]){
if(item[rolledIDs[id]] > 0){ // positive rolled IDs
minRolls.set(rolledIDs[id],item[rolledIDs[id]]*0.3);
maxRolls.set(rolledIDs[id],item[rolledIDs[id]]*1.3);
}else if(item[rolledIDs[id]] < 0){ //negative rolled IDs
minRolls.set(rolledIDs[id],item[rolledIDs[id]]*1.3);
maxRolls.set(rolledIDs[id],item[rolledIDs[id]]*0.7);
}else{//Id = 0
minRolls.set(rolledIDs[id],0);
maxRolls.set(rolledIDs[id],0);
}
}
}
for (const id in nonRolledIDs){
if(item[nonRolledIDs[id]]){
expandedItem.set(nonRolledIDs[id],item[nonRolledIDs[id]]);
}
}
}
expandedItem.set("minRolls",minRolls);
expandedItem.set("maxRolls",maxRolls);
console.log(expandedItem)
return expandedItem;
}
/* A second helper function that takes items from expandItem() and stringifies them.
@param item - a map with non-rolled Ids as normal key:value pairs and all rolled IDs as 2 separate key:value pairs in the minRoll and maxRoll keys that are mapped to maps.
TODO: write the function
*/
function expandedItemToString(item){
console.log(item);
let ids = ["lvl", "classReq","strReq", "dexReq", "intReq", "defReq","agiReq", "nDam", "eDam", "tDam", "wDam", "tDam", "aDam", "atkSpd", "hp", "eDef", "tDef", "wDef", "fDef", "aDef", "str", "dex", "int", "agi", "def", "hpBonus", "hprRaw", "hprPct", "sdRaw", "sdPct", "mdRaw", "mdPct", "mr", "ms", "ref", "ls", "poison", "thorns", "exploding", "spd", "atkTier", "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", "quest", "restrict"];
let idPrefixes = {"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":"This item belongs to the ", "quest":"This item is from the quest", "restrict":""};
let idSuffixes = {"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 itemString = "";
itemString = itemString.concat(item.get("name"),"<br><br>");
if(item.has("fixID") && item.get("fixID")){//fixed IDs
for(i = 0; i < ids.length; i++){ //iterate the ids
if(nonRolledIDs.includes(ids[i]) && item.get(ids[i])){//nonRolledID & non-0/non-null/non-und ID
itemString = itemString.concat(idPrefixes[ids[i]]);
itemString = itemString.concat(item.get(ids[i]), idSuffixes[ids[i]],"<br>");
}
if(rolledIDs.includes(ids[i])&& item.get("minRolls").get(ids[i]) && item.get("maxRolls").get(ids[i]) ){//rolled ID & non-0/non-null/non-und ID
console.log("hi");
itemString = itemString.concat(idPrefixes[ids[i]]);
itemString = itemString.concat(idRound(item.get("minRolls").get(ids[i])), idSuffixes[ids[i]],"<br>");
}//Just don't do anything if else
}
}else{//non-fixed IDs
for(i = 0; i < ids.length; i++){ //iterate the ids
if(nonRolledIDs.includes(ids[i]) && item.get(ids[i])){//nonRolledID & non-0/non-null/non-und ID
itemString = itemString.concat(idPrefixes[ids[i]]);
itemString = itemString.concat(item.get(ids[i]), idSuffixes[ids[i]],"<br>");
}
if(rolledIDs.includes(ids[i])&& item.get("minRolls").get(ids[i]) && item.get("maxRolls").get(ids[i]) ){//rolled ID & non-0/non-null/non-und ID
console.log("hi");
itemString = itemString.concat(idPrefixes[ids[i]]);
itemString = itemString.concat(idRound(item.get("minRolls").get(ids[i])), idSuffixes[ids[i]], " -> ", idRound(item.get("maxRolls").get(ids[i])),idSuffixes[ids[i]],"<br>");
}//Just don't do anything if else
}
}
itemString = itemString.concat("<br>",item.get("tier")," ", item.get("type"));
return itemString;
}
/*An independent helper function that rounds a rolled ID to the nearest integer OR brings the roll away from 0.
* @param id
*/
function idRound(id){
rounded = Math.round(id);
if(rounded == 0){
return 1;
}else{
return rounded;
}
} }
function resetFields(){ function resetFields(){