diff --git a/muni.js b/muni.js
index c70065f..45f814f 100644
--- a/muni.js
+++ b/muni.js
@@ -1,10 +1,163 @@
const MAXSTEPS= 10000
+ function Korean(str) {
+ switch (str) {
+ case "Hello":{
+ return "안녕하세요"
+ }break;
+ default:{
+ return English(str)
+ }
+ }
+ }
+
+ function English(str) {
+ switch (str) {
+ case 1:{ //Tab Title of Webpage
+ return "D4DJ Parking Calculator | Powered by Muni"
+ }break;
+ case 2:{ //Header Title (Top) of Webpage
+ return "D4DJ Event Parking Calculator"
+ }break;
+ case 3:{ //Set up your options (Category Title)
+ return "Parking Configuration"
+ }break;
+ case 4:{ //Selection for event type: Poker/Raid
+ return "Poker/Raid"
+ }break;
+ case 5:{ //Selection for event type: Bingo
+ return "Bingo"
+ }break;
+ case 6:{ //Selection for event type: Medley
+ return "Medley"
+ }break;
+ case 7:{ //Label for team % selector (Include ":")
+ return "Event Team Bonus:"
+ }break;
+ case 17:{ //Label for whether to enable flexible team options.
+ return "Flexible Team?"
+ }break;
+ case 8:{ //Tooltip for flexible team options (mouseover)
+ return "If turned on, calculates scoring options using lower % teams also."
+ }break;
+ case 18:{ //Label for what the max score in free lives is.
+ return "Max Free Live Score:"
+ }break;
+ case 9:{ //Tooltip for what the max score in free lives is. (Setting it to 0 forces the calculator to use Rehearsal)
+ return "The maximum score you can get from playing a song using Free Live.
(Use 0 for Rehearsals Only)"
+ }break;
+ case 10:{ //Label for Advanced Settings toggle.
+ return "Advanced Options?"
+ }break;
+ case 11:{ //Tooltip for Advanced Settings toggle.
+ return "Enable voltage & EP limits."
+ }break;
+ case 12:{ //Label for setting the lowest EP where voltage is allowed.
+ return "Lowest EP to use Voltage:"
+ }break;
+ case 13:{ //Label for setting the total amount of voltage the calculator may consume.
+ return "Max Voltage to consume:"
+ }break;
+ case 14:{ //Label for setting the Starting EP amount.
+ return "Starting EP:"
+ }break;
+ case 15:{ //Label for setting the final EP amount.
+ return "Target EP:"
+ }break;
+ case 16:{ //The text for the button users click to run the calculator.
+ return "Calculate"
+ }break;
+ case "%INITIAL%":{ //This message is the first thing to display for a normal calculation.
+ //Sample message:
+ /*
+ Calculating from 100000 to 104000 for event type Poker/Raid...
+ (All games are done in Free Live)
+
+ Found a park! 9 steps and 13 voltage required!
+ */
+ //Variables for this message:
+ /*
+ Calculating from %START% to %TARGET% for event type %EVENT%...
+ (All games are done in Free Live)
+
+ Found a park! %STEPS% step%PLURAL_STEPS% and %VOLTAGE% voltage required!
+ */
+ return "Calculating from %START% to %TARGET% for event type %EVENT%...\n\t(All games are done in Free Live)\n\nFound a park! %STEPS% step%PLURAL_STEPS% and %VOLTAGE% voltage required!"
+ }break;
+ case "%STEP%":{ //This message is displayed for each normal voltage step in the process.
+ //Sample message:
+ /*
+ Step 1) Using 5 voltage w/160% team, score between 640000~649999 pts. EP +1480. Remaining:2520 EP
+ */
+ //Variables for this message:
+ /*
+ Step %STEP%) Using %VOLTAGE% voltage w/%PERCENT%% team, score between %LOWSCORE~%HIGHSCORE% pts. EP +%EPGAIN%. Remaining:%REMAINING% EP
+ */
+ return "Step %STEP%) Using %VOLTAGE% voltage w/%PERCENT%% team, score between %LOWSCORE%~%HIGHSCORE% pts. EP +%EPGAIN%. Remaining:%REMAINING% EP"
+ }break;
+ case "%REHEARSAL%":{ //Similar to above, but for a rehearsal step instead.
+ return "Step %STEP%) Use Rehearsal w/%PERCENT%% team. EP +%EPGAIN%. Remaining:%REMAINING% EP"
+ }break;
+ case "%LARGEGAP%":{ //This message is displayed if the Starting EP and Final EP gap is too big for reasonable calculations.
+ return "Get closer to target score before using parking calculator!";
+ }break;
+ case "%FAILED%":{ //This message is displayed if it's impossible to park.
+ return "Impossible to park using this team!"
+ }break;
+ default:{
+ return "???"
+ }
+ }
+ }
+
+ function Reveal(str) {
+ switch (str) {
+ case "Hello":{
+ return "Hi"
+ }break;
+ default:{
+ return English(str)
+ }
+ }
+ }
+
+ function ConvertVariables(str,data) {
+ return str
+ .replaceAll("%START%",data.start)
+ .replaceAll("%TARGET%",data.target)
+ .replaceAll("%EVENT%",data.event)
+ .replaceAll("%STEPS%",data.steps)
+ .replaceAll("%PLURAL_STEPS%",Plural(data.steps))
+ .replaceAll("%VOLTAGE%",data.voltage)
+ .replaceAll("%STEP%",data.step)
+ .replaceAll("%PERCENT%",data.percent)
+ .replaceAll("%LOWSCORE%",data.lowscore)
+ .replaceAll("%HIGHSCORE%",data.highscore)
+ .replaceAll("%EPGAIN%",data.epgain)
+ .replaceAll("%REMAINING%",data.remaining)
+ }
+
+ var LANGUAGE=Reveal
+ var LANGUAGELIST={English:English,Korean:Korean}
+ var TRANSLATEELEMENTS=100 //Increase as number of translated elements increases.
+
function Plural(t) {
return t==1?"":"s"
}
+
+ function ConvertLanguage() {
+ for (var i=0;i=0;j-=0.2) {
@@ -179,14 +340,16 @@ const MAXSTEPS= 10000
var gain=end-start-10
start+=gain
//document.getElementById("console").value+="2)"
- document.getElementById("console").value+="Step "+(step++)+") Use Rehearsal w/"+((gain-10)*10)+"% team. EP +"+gain+". Remaining:"+(end-start)+" EP \n"
+ document.getElementById("console").value+=ConvertVariables(LANGUAGE("%REHEARSAL%"),{step:step++,percent:((gain-10)*10),epgain:gain,remaining:end-start})+"\n"
+ /*"Step "+(step++)+") Use Rehearsal w/"+((gain-10)*10)+"% team. EP +"+gain+". Remaining:"+(end-start)+" EP \n"*/
return true
} else
if ((end-start)%10==0) {
var gain=10
start+=gain
//document.getElementById("console").value+="3)"
- document.getElementById("console").value+="Step "+(step++)+") Use Rehearsal w/0% team. EP +"+gain+". Remaining:"+(end-start)+" EP \n"
+ document.getElementById("console").value+=ConvertVariables(LANGUAGE("%REHEARSAL%"),{step:step++,percent:0,epgain:gain,remaining:end-start})+"\n"
+ /*"Step "+(step++)+") Use Rehearsal w/0% team. EP +"+gain+". Remaining:"+(end-start)+" EP \n"*/
return false
} else
{
@@ -194,7 +357,8 @@ const MAXSTEPS= 10000
if (((gain-10)*10)>=0) {
start+=gain
//document.getElementById("console").value+="4)"
- document.getElementById("console").value+="Step "+(step++)+") Use Rehearsal w/"+((gain-10)*10)+"% team. EP +"+(gain)+". Remaining:"+(end-start)+" EP \n"
+ document.getElementById("console").value+=ConvertVariables(LANGUAGE("%REHEARSAL%"),{step:step++,percent:((gain-10)*10),epgain:gain,remaining:end-start})+"\n"
+ /*"Step "+(step++)+") Use Rehearsal w/"+((gain-10)*10)+"% team. EP +"+(gain)+". Remaining:"+(end-start)+" EP \n"*/
return false
} else {
return undefined
@@ -232,7 +396,9 @@ const MAXSTEPS= 10000
}
if ((end-start)>1000000) {
- document.getElementById("console").value="Get closer to target score before using parking calculator!"
+ document.getElementById("console").value=
+ LANGUAGE("%LARGEGAP%")
+ //"Get closer to target score before using parking calculator!"
}
else {
var result=true
@@ -317,12 +483,29 @@ const MAXSTEPS= 10000
}
}
}
+
+ function ConvertEvent(str) {
+ switch (str) {
+ case "Poker/Raid":{
+ return LANGUAGE(4)
+ }break;
+ case "Bingo":{
+ return LANGUAGE(5)
+ }break;
+ case "Medley":{
+ return LANGUAGE(6)
+ }break;
+ }
+ }
start=end
if (result===undefined) {
- document.getElementById("console").value="Impossible to park using this team!"
+ document.getElementById("console").value=LANGUAGE("%FAILED%")
+ //"Impossible to park using this team!"
} else {
- document.getElementById("console").value="Calculating from "+originalTarget+" to "+end+" for event type "+type+"...\n\t(All games are done in Free Live)\n\nFound a park! "+(step-1)+" step"+Plural(step-1)+" and "+flameCount+" voltage required!\n\n"+document.getElementById("console").value
+ document.getElementById("console").value=ConvertVariables(LANGUAGE("%INITIAL%"),{
+ start:originalTarget,target:end,event:ConvertEvent(type),steps:(step-1),voltage:flameCount})+"\n\n"+document.getElementById("console").value
+ /*"Calculating from "+originalTarget+" to "+end+" for event type "+type+"...\n\t(All games are done in Free Live)\n\nFound a park! "+(step-1)+" step"+Plural(step-1)+" and "+flameCount+" voltage required!\n\n"+document.getElementById("console").value*/
}
//document.getElementById("console").value+="Step "+(step++)+")"+start+" EP"+"\n"
step++