var HCmemory = null; function updateHC() { var valid = true; var lv = document.getElementById("my_lv").value*1; var xp = document.getElementById("my_xp").value; var sp_g = document.getElementById("sp_goal").value*1; var mobxp = document.getElementById("mob_xp").value*1; var mobsxp = document.getElementById("mob_sxp").value*1; var kilrate = document.getElementById("mob_kil").value; if (kilrate == "") { document.getElementById("mob_kil").value="0"; kilrate = 0; } else kilrate = document.getElementById("mob_kil").value*1; var en_sp = document.getElementById("custom_sp").value*1; var en_xp = document.getElementById("custom_xp").value*1; var dfltco = tstrings[171]; if ((isNaN(en_sp))||(en_sp < 0)) { valid = false; paintField("custom_sp","#FF0000"); } else { paintField("custom_sp",dfltco); } if ((isNaN(en_xp))||(en_xp < 0)) { valid = false; paintField("custom_xp","#FF0000"); } else { paintField("custom_xp",dfltco); } if ((isNaN(lv))||(lv < 1)||(lv > levelcap)) { valid = false; paintField("my_lv","#FF0000"); } else { paintField("my_lv",dfltco); } if ((isNaN(sp_g))||(sp_g < 0)) { valid = false; paintField("sp_goal","#FF0000"); } else { paintField("sp_goal",dfltco); } if ( (isNaN(mobxp))||(mobxp < 0)) { valid = false; paintField("mob_xp","#FF0000"); } else { paintField("mob_xp",dfltco); } if ( (isNaN(mobsxp))||(mobsxp < 1)) { valid = false; paintField("mob_sxp","#FF0000"); } else { paintField("mob_sxp",dfltco); } if ( (isNaN(kilrate))||(kilrate < 1)) { valid = false; paintField("mob_kil","#FF0000"); } else { paintField("mob_kil",dfltco); } if (xp.indexOf('%') == xp.length-1) { xp = parseInt(reqXP[lv+1]*(xp.substring(0,xp.length-1)*1)/100); document.getElementById("my_xp").value = xp; if (xp +1 < reqXP[lv+1]) xp++; } else { xp *= 1; } if ( (isNaN(xp))||(xp < 0)||(xp > reqXP[lv+1])) { valid = false; paintField("my_xp","#FF0000"); } else { paintField("my_xp",dfltco); } if (!valid) { document.getElementById("help_out").innerHTML = tstrings[94]; return; } //Apply items mobxp = parseInt(mobxp*en_xp/100); mobsxp = parseInt(mobsxp*en_sp/100); var numtolv = 0; var numtospg = (10000*sp_g)/mobsxp; if (parseInt(numtospg) < numtospg) numtospg = parseInt(numtospg)+1; if (mobxp>0) numtolv = (reqXP[lv+1]-xp)/mobxp; else numtolv = numtospg; if (numtolv < 1) numtolv = 1; if (parseInt(numtolv) != numtolv) { numtolv = parseInt(numtolv)+1; } if (sp_g == 0) numtospg = numtolv + 1; //bug spg 0 //artificial : wont be displayed var str = ""; var colsp = 1; if ( ((mobxp>0)&&(numtospg > numtolv)&&(lv < levelcap)) || (HCmemory != null) ) colsp++; str += ""; str += ""; if (HCmemory != null) { str += ""; } str += "
Results :
"; ////CELL 1 ////////////////////////////////// str += tstrings[93] + "" + lv + ""; if (lv < levelcap) str += tstrings[96] + ((parseInt(10000*xp/reqXP[lv+1]))/100) + tstrings[97]; if (sp_g > 0) //bug spg = 0 str += "
" + tstrings[95] + formatLong(sp_g) + tstrings[31]; else str += "
" + tstrings[167]; str += "
" + tstrings[98] + formatLong(mobxp) + tstrings[99] + formatLong(mobsxp) + tstrings[100]; str += "
" + tstrings[101] + formatLong(kilrate) + tstrings[102]; var xp_rate = parseInt(kilrate * mobxp / reqXP[lv+1] *10000)/100; var sp_rate = parseInt(kilrate * mobsxp / 100)/100; str += "
" + tstrings[146] + xp_rate + tstrings[147] + sp_rate + tstrings[148]; if (mobxp>0) str += "

" + tstrings[103] + formatLong(numtolv) + tstrings[104]; var use_bi = document.getElementById("use_bi").checked; var use_pbi = document.getElementById("use_pbi").checked; var use_eli = document.getElementById("use_eli").checked; var use_ssp = document.getElementById("use_ssp").checked; var use_pssp = document.getElementById("use_pssp").checked; var use_efs = document.getElementById("use_efs").checked; var use_xpb = document.getElementById("use_xpb").checked; var use_spb = document.getElementById("use_spb").checked; var use_xps = document.getElementById("use_exs").checked; var use_pts = document.getElementById("use_pts").checked; var use_exe = document.getElementById("use_exe").checked; var use_dt = document.getElementById("use_dt").checked; if ((mobxp>0)&&(numtospg > numtolv)&&(lv < levelcap)) { var spgot = parseInt(numtolv*mobsxp/10000); var timetaken = parseInt(3600*numtolv/kilrate); if (sp_g > 0) //bug spg 0 str += "
" + tstrings[105] + formatLong(spgot) + tstrings[106]; else str += "
" + tstrings[168] + formatLong(spgot); str += "
" + tstrings[107] + formatTime(timetaken) + "."; if (sp_g > 0) str += "
" + tstrings[108] + formatLong(sp_g - spgot) + tstrings[31]; if (document.getElementById("mob").value > -1) { if (HCmemory == null) { HCmemory = new Array(); HCmemory[0] = lv; //first level HCmemory[1] = 0; //m. to k. HCmemory[2] = 0; //time (/s) HCmemory[3] = 0; //spb HCmemory[4] = 0; //xpb HCmemory[5] = 0; //pssp HCmemory[6] = 0; //pbi HCmemory[7] = 0; //ssp HCmemory[8] = 0; //bi HCmemory[9] = 0; //pts HCmemory[10] = 0; //xps HCmemory[11] = 0; //efs HCmemory[12] = 0; //final lv!! HCmemory[13] = 0; //total sp } HCmemory[1] += numtolv; HCmemory[2] += timetaken; HCmemory[3] += ((!customEn)&&(use_spb))?(numtolv):(0); HCmemory[4] += ((!customEn)&&(use_xpb))?(numtolv):(0); HCmemory[5] += ((!customEn)&&(use_pssp))?(timetaken/3600):(0); HCmemory[6] += ((!customEn)&&(use_pbi))?(timetaken/3600):(0); HCmemory[7] += ((!customEn)&&(use_ssp))?(timetaken/3600):(0); HCmemory[8] += ((!customEn)&&(use_bi))?(timetaken/10800):(0); HCmemory[9] += ((!customEn)&&(use_pts))?(timetaken/3600):(0); HCmemory[10] += ((!customEn)&&(use_xps))?(timetaken/600):(0); //10 min? HCmemory[11] += ((!customEn)&&(use_efs))?(timetaken/600):(0); //10 min? HCmemory[12] = lv+1; HCmemory[13] += numtolv*mobsxp/10000; var xpplus = xp-reqXP[lv+1]+(numtolv*mobxp); str += "

"; } } else { var timetaken = parseInt(3600*numtospg/kilrate); str += "
" + tstrings[109] + formatLong(numtospg) + tstrings[110]; str += "
" + tstrings[107] + formatTime(timetaken) + "."; var percreached = ((parseInt(10000*(xp+mobxp*numtospg)/reqXP[lv+1]))/100); if (percreached > 100) //when player is at the level cap percreached = 100; str += "
" + tstrings[111] + percreached + tstrings[112]; if (HCmemory != null) { HCmemory[1] += numtospg; HCmemory[2] += timetaken; HCmemory[3] += ((!customEn)&&(use_spb))?(numtospg):(0); HCmemory[4] += ((!customEn)&&(use_xpb))?(numtospg):(0); HCmemory[5] += ((!customEn)&&(use_pssp))?(timetaken/3600):(0); HCmemory[6] += ((!customEn)&&(use_pbi))?(timetaken/3600):(0); HCmemory[7] += ((!customEn)&&(use_ssp))?(timetaken/3600):(0); HCmemory[8] += ((!customEn)&&(use_bi))?(timetaken/10800):(0); HCmemory[9] += ((!customEn)&&(use_pts))?(timetaken/3600):(0); HCmemory[10] += ((!customEn)&&(use_xps))?(timetaken/600):(0); //10 min? HCmemory[11] += ((!customEn)&&(use_efs))?(timetaken/600):(0); //10 min? HCmemory[12] = lv; HCmemory[13] += numtospg*mobsxp/10000; } } ////END CELL 1 ////////////////////////////////// str += "
"; str += "" + tstrings[149] + "
"; str += "
" + tstrings[150] + HCmemory[0]; str += "
" + tstrings[162] + HCmemory[12]; str += "
" + tstrings[163] + formatDouble(parseInt(HCmemory[13])); str += "
" + tstrings[151] + formatLong(HCmemory[1]); str += "
" + tstrings[152] + formatTime(HCmemory[2]); str += (HCmemory[3]>0)?("
" + formatLong(HCmemory[3]) + tstrings[153]):(""); str += (HCmemory[4]>0)?("
" + formatLong(HCmemory[4]) + tstrings[154]):(""); str += (HCmemory[5]>0)?("
" + formatDouble(HCmemory[5]) + tstrings[155]):(""); str += (HCmemory[6]>0)?("
" + formatDouble(HCmemory[6]) + tstrings[156]):(""); str += (HCmemory[7]>0)?("
" + formatDouble(HCmemory[7]) + tstrings[157]):(""); str += (HCmemory[8]>0)?("
" + formatDouble(HCmemory[8]) + tstrings[158]):(""); str += (HCmemory[9]>0)?("
" + formatDouble(HCmemory[9]) + tstrings[159]):(""); str += (HCmemory[10]>0)?("
" + formatDouble(HCmemory[10]) + tstrings[160]):(""); str += (HCmemory[11]>0)?("
" + formatDouble(HCmemory[11]) + tstrings[161]):(""); var gcost = 0; if (document.getElementById("gc_cb").checked == true) { gcost+= HCmemory[3]*document.getElementById("spb_gc").value; gcost+= HCmemory[4]*document.getElementById("xpb_gc").value; gcost+=((HCmemory[5]==parseInt(HCmemory[5]))?(HCmemory[5]*document.getElementById("pssp_gc").value):((parseInt(HCmemory[5])+1)*document.getElementById("pssp_gc").value)); gcost+=((HCmemory[6]==parseInt(HCmemory[6]))?(HCmemory[6]*document.getElementById("pbi_gc").value):((parseInt(HCmemory[6])+1)*document.getElementById("pbi_gc").value)); gcost+=((HCmemory[7]==parseInt(HCmemory[7]))?(HCmemory[7]*document.getElementById("ssp_gc").value):((parseInt(HCmemory[7])+1)*document.getElementById("ssp_gc").value)); gcost+=((HCmemory[8]==parseInt(HCmemory[8]))?(HCmemory[8]*document.getElementById("bi_gc").value):((parseInt(HCmemory[8])+1)*document.getElementById("bi_gc").value)); gcost+=((HCmemory[9]==parseInt(HCmemory[9]))?(HCmemory[9]*document.getElementById("pts_gc").value):((parseInt(HCmemory[9])+1)*document.getElementById("pts_gc").value)); gcost+=((HCmemory[10]==parseInt(HCmemory[10]))?(HCmemory[10]*document.getElementById("exs_gc").value):((parseInt(HCmemory[10])+1)*document.getElementById("exs_gc").value)); gcost+=((HCmemory[11]==parseInt(HCmemory[11]))?(HCmemory[11]*document.getElementById("efs_gc").value):((parseInt(HCmemory[11])+1)*document.getElementById("efs_gc").value)); //other itms gcost+= (HCmemory[2]%3600 == 0)?(HCmemory[2]*document.getElementById("oth_gc").value/3600):((parseInt(HCmemory[2]/3600)+1)*document.getElementById("oth_gc").value); } str += (gcost>0)?("
" + tstrings[165] + formatLong(gcost)):(""); str += "
"; document.getElementById("help_out").innerHTML = str; }