From cee85f30653ec5eab34a0ffd6f50b2e6b615dc0e Mon Sep 17 00:00:00 2001 From: b Date: Thu, 29 Apr 2021 17:03:50 -0700 Subject: [PATCH] Move translations.txt into utils,, m --- customizer.js | 17 ---------- display.js | 4 +-- translations.txt | 83 ------------------------------------------------ utils.js | 16 ++++------ 4 files changed, 8 insertions(+), 112 deletions(-) delete mode 100644 translations.txt diff --git a/customizer.js b/customizer.js index 411cce9..00dbfab 100644 --- a/customizer.js +++ b/customizer.js @@ -1,12 +1,5 @@ -/* - * TESTING SECTION - */ - - const custom_url_base = location.href.split("#")[0]; const custom_url_tag = location.hash.slice(1); -// console.log(custom_url_base); -// console.log(custom_url_tag); const CUSTOM_BUILD_VERSION = "7.0.1"; @@ -18,22 +11,12 @@ function setTitle() { setTitle(); - - - -/* - * END testing section - */ - - let player_custom_item; let base_item; //the item that a user starts from, if any let pos_range = [0.3,1.3]; let neg_range = [1.3,0.7]; - - let roll_range_ids = ["neg_roll_range-choice-min","neg_roll_range-choice-max","pos_roll_range-choice-min","pos_roll_range-choice-max"]; diff --git a/display.js b/display.js index a395765..bd5c8a1 100644 --- a/display.js +++ b/display.js @@ -370,7 +370,7 @@ function displayBuildStats(parent_id,build){ style === "positive" ? style = "negative" : style = "positive"; } if (id === "poison" && id_val > 0) { - id_val = Math.round(id_val*(build.statMap.get("poisonPct") + build.externalStats.get("poisonPct"))/100); + id_val = Math.ceil(id_val*(build.statMap.get("poisonPct") + build.externalStats.get("poisonPct"))/100); } displayFixedID(active_elem, id, id_val, elemental_format, style); if (id === "poison" && id_val > 0) { @@ -1431,7 +1431,7 @@ function displayPoisonDamage(overallparent_elem, build) { overallpoisonDamage.classList.add("itemp"); let overallpoisonDamageFirst = document.createElement("b"); let overallpoisonDamageSecond = document.createElement("b"); - let poison_tick = Math.round(build.statMap.get("poison") * (1+skillPointsToPercentage(build.total_skillpoints[0])) * (build.statMap.get("poisonPct") + build.externalStats.get("poisonPct"))/100 /3); + let poison_tick = Math.ceil(build.statMap.get("poison") * (1+skillPointsToPercentage(build.total_skillpoints[0])) * (build.statMap.get("poisonPct") + build.externalStats.get("poisonPct"))/100 /3); overallpoisonDamageFirst.textContent = "Poison Tick: "; overallpoisonDamageSecond.textContent = Math.max(poison_tick,0); overallpoisonDamageSecond.classList.add("Damage"); diff --git a/translations.txt b/translations.txt deleted file mode 100644 index b4ed6da..0000000 --- a/translations.txt +++ /dev/null @@ -1,83 +0,0 @@ -"name": "name", -"displayName": "displayName", -"tier": "tier", -"set": "set", -"sockets": "slots", -"type": "type", -"dropType": "drop", -"quest": "quest", -"restrictions": "restrict", -"damage": "nDam", -"fireDamage": "fDam", -"waterDamage": "wDam", -"airDamage": "aDam", -"thunderDamage": "tDam", -"earthDamage": "eDam", -"attackSpeed": "atkSpd", -"health": "hp", -"fireDefense": "fDef", -"waterDefense": "wDef", -"airDefense": "aDef", -"thunderDefense": "tDef", -"earthDefense": "eDef", -"level": "lvl", -"classRequirement": "classReq", -"strength": "strReq", -"dexterity": "dexReq", -"intelligence": "intReq", -"agility": "agiReq", -"defense": "defReq", -"healthRegen": "hprPct", -"manaRegen": "mr", -"spellDamage": "sdPct", -"damageBonus": "mdPct", -"lifeSteal": "ls", -"manaSteal": "ms", -"xpBonus": "xpb", -"lootBonus": "lb", -"reflection": "ref", -"strengthPoints": "str", -"dexterityPoints": "dex", -"intelligencePoints": "int", -"agilityPoints": "agi", -"defensePoints": "def", -"thorns": "thorns", -"exploding": "expd", -"speed": "spd", -"attackSpeedBonus": "atkTier", -"poison": "poison", -"healthBonus": "hpBonus", -"soulPoints": "spRegen", -"emeraldStealing": "eSteal", -"healthRegenRaw": "hprRaw", -"spellDamageRaw": "sdRaw", -"damageBonusRaw": "mdRaw", -"bonusFireDamage": "fDamPct", -"bonusWaterDamage": "wDamPct", -"bonusAirDamage": "aDamPct", -"bonusThunderDamage": "tDamPct", -"bonusEarthDamage": "eDamPct", -"bonusFireDefense": "fDefPct", -"bonusWaterDefense": "wDefPct", -"bonusAirDefense": "aDefPct", -"bonusThunderDefense": "tDefPct", -"bonusEarthDefense": "eDefPct", -"accessoryType": "type", -"identified": "fixID", -"skin": "skin", -"category": "category", -"spellCostPct1": "spPct1", -"spellCostRaw1": "spRaw1", -"spellCostPct2": "spPct2", -"spellCostRaw2": "spRaw2", -"spellCostPct3": "spPct3", -"spellCostRaw3": "spRaw3", -"spellCostPct4": "spPct4", -"spellCostRaw4": "spRaw4", -"rainbowSpellDamageRaw": "rainbowRaw", -"sprint": "sprint", -"sprintRegen": "sprintReg", -"jumpHeight": "jh", -"lootQuality": "lq", -"gatherXpBonus": "gXp", -"gatherSpeed": "gSpd", diff --git a/utils.js b/utils.js index abfaa89..f3f418a 100644 --- a/utils.js +++ b/utils.js @@ -23,16 +23,12 @@ let elementIcons = ["\u2724","\u2726", "\u2749", "\u2739", "\u274b" ]; let skpReqs = skp_order.map(x => x + "Req"); //File reading for ID translations for JSON purposes -let reversetranslations; -let translations; -function setRevTrans(revTransText) { - reversetranslations = new Map(revTransText.replaceAll(" ", "").replaceAll("\"", "").replaceAll("\n","").replaceAll("\r","").split(",").map(x => x.split(":").reverse())) +let reversetranslations = new Map(); +let translations = new Map([["name", "name"], ["displayName", "displayName"], ["tier", "tier"], ["set", "set"], ["sockets", "slots"], ["type", "type"], ["dropType", "drop"], ["quest", "quest"], ["restrictions", "restrict"], ["damage", "nDam"], ["fireDamage", "fDam"], ["waterDamage", "wDam"], ["airDamage", "aDam"], ["thunderDamage", "tDam"], ["earthDamage", "eDam"], ["attackSpeed", "atkSpd"], ["health", "hp"], ["fireDefense", "fDef"], ["waterDefense", "wDef"], ["airDefense", "aDef"], ["thunderDefense", "tDef"], ["earthDefense", "eDef"], ["level", "lvl"], ["classRequirement", "classReq"], ["strength", "strReq"], ["dexterity", "dexReq"], ["intelligence", "intReq"], ["agility", "agiReq"], ["defense", "defReq"], ["healthRegen", "hprPct"], ["manaRegen", "mr"], ["spellDamage", "sdPct"], ["damageBonus", "mdPct"], ["lifeSteal", "ls"], ["manaSteal", "ms"], ["xpBonus", "xpb"], ["lootBonus", "lb"], ["reflection", "ref"], ["strengthPoints", "str"], ["dexterityPoints", "dex"], ["intelligencePoints", "int"], ["agilityPoints", "agi"], ["defensePoints", "def"], ["thorns", "thorns"], ["exploding", "expd"], ["speed", "spd"], ["attackSpeedBonus", "atkTier"], ["poison", "poison"], ["healthBonus", "hpBonus"], ["soulPoints", "spRegen"], ["emeraldStealing", "eSteal"], ["healthRegenRaw", "hprRaw"], ["spellDamageRaw", "sdRaw"], ["damageBonusRaw", "mdRaw"], ["bonusFireDamage", "fDamPct"], ["bonusWaterDamage", "wDamPct"], ["bonusAirDamage", "aDamPct"], ["bonusThunderDamage", "tDamPct"], ["bonusEarthDamage", "eDamPct"], ["bonusFireDefense", "fDefPct"], ["bonusWaterDefense", "wDefPct"], ["bonusAirDefense", "aDefPct"], ["bonusThunderDefense", "tDefPct"], ["bonusEarthDefense", "eDefPct"], ["accessoryType", "type"], ["identified", "fixID"], ["skin", "skin"], ["category", "category"], ["spellCostPct1", "spPct1"], ["spellCostRaw1", "spRaw1"], ["spellCostPct2", "spPct2"], ["spellCostRaw2", "spRaw2"], ["spellCostPct3", "spPct3"], ["spellCostRaw3", "spRaw3"], ["spellCostPct4", "spPct4"], ["spellCostRaw4", "spRaw4"], ["rainbowSpellDamageRaw", "rainbowRaw"], ["sprint", "sprint"], ["sprintRegen", "sprintReg"], ["jumpHeight", "jh"], ["lootQuality", "lq"], ["gatherXpBonus", "gXp"], ["gatherSpeed", "gSpd"]]); +for (const [k, v] of translations) { + reversetranslations.set(v, k); } -function setTrans(transText) { - translations = new Map(transText.replaceAll(" ", "").replaceAll("\"", "").replaceAll("\n","").replaceAll("\r","").split(",").map(x => x.split(":"))) -} -fetch('translations.txt').then(response => response.text()).then(data => {setRevTrans(data)}); -fetch('translations.txt').then(response => response.text()).then(data => {setTrans(data);}); + console.log(translations); function clamp(num, low, high){ @@ -369,4 +365,4 @@ function toggleButton(button_id) { elem.classList.add("toggleOn"); } } -} \ No newline at end of file +}