2017-09-09 03:30:59 +00:00
|
|
|
"use strict";
|
|
|
|
//Licensed under the Apache License 2.0. See license file for information.
|
2017-09-20 21:36:13 +00:00
|
|
|
// Ardon Income Calculator v3.3 stable.
|
2017-09-17 00:52:43 +00:00
|
|
|
// Written by Josh Mudge
|
|
|
|
// Ad Mejorem Dei Glorium
|
|
|
|
|
2017-09-09 03:30:59 +00:00
|
|
|
|
|
|
|
function calculate() {
|
|
|
|
var numReg = /^\d+$/;
|
|
|
|
|
|
|
|
//Get input
|
|
|
|
|
|
|
|
var blocks = document.getElementById("blocks").value;
|
2017-09-15 04:15:29 +00:00
|
|
|
var one = document.getElementById("one").value;
|
|
|
|
var gov = document.getElementById("gov").value;
|
2017-09-16 04:05:42 +00:00
|
|
|
var design = document.getElementById("design").value;
|
2017-09-09 04:15:16 +00:00
|
|
|
var embassies = document.getElementById("embassies").value;
|
|
|
|
var capital = document.getElementById("capital").value;
|
2017-09-15 04:15:29 +00:00
|
|
|
var infra = document.getElementById("infra").value;
|
2017-09-17 00:50:30 +00:00
|
|
|
var chain = document.getElementById("chain").value;
|
2017-09-16 03:40:20 +00:00
|
|
|
var town = document.getElementById("town").value;
|
|
|
|
var city = document.getElementById("city").value;
|
|
|
|
var metro = document.getElementById("metro").value;
|
2017-09-09 03:30:59 +00:00
|
|
|
|
2017-09-09 04:15:16 +00:00
|
|
|
if (blocks.match(numReg))
|
2017-09-09 03:30:59 +00:00
|
|
|
{
|
|
|
|
//Do nothing.
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Tells them to enter only numbers.
|
|
|
|
|
|
|
|
alert("Please enter only numbers in this field.");
|
|
|
|
}
|
|
|
|
|
2017-09-19 01:25:09 +00:00
|
|
|
var gold = +blocks / 1000 * 100
|
2017-09-17 00:50:30 +00:00
|
|
|
console.log(gold)
|
2017-09-20 21:36:13 +00:00
|
|
|
var infra = +infra / 1000 * 0.0025
|
2017-09-16 04:05:42 +00:00
|
|
|
console.log(infra)
|
2017-09-15 04:15:29 +00:00
|
|
|
var one = +one / 1000 * 0.01
|
|
|
|
console.log(one)
|
2017-09-17 00:50:30 +00:00
|
|
|
var chain = +chain * 0.0025
|
|
|
|
console.log(chain)
|
2017-09-15 04:15:29 +00:00
|
|
|
var design = +design / 1000 * 0.015
|
|
|
|
console.log(design)
|
2017-09-16 04:10:51 +00:00
|
|
|
var gov = +gov * 0.02
|
2017-09-15 04:15:29 +00:00
|
|
|
console.log(gov)
|
2017-09-16 04:10:51 +00:00
|
|
|
var embassies = +embassies * 0.02
|
2017-09-09 04:15:16 +00:00
|
|
|
console.log(embassies)
|
2017-09-15 04:15:29 +00:00
|
|
|
var capital = +capital * 0.025
|
2017-09-09 04:15:16 +00:00
|
|
|
console.log(capital)
|
2017-09-16 03:40:20 +00:00
|
|
|
var town = +town * 0.005
|
|
|
|
console.log(town)
|
|
|
|
var city = +city * 0.01
|
|
|
|
console.log(city)
|
|
|
|
var metro = +metro * 0.01
|
|
|
|
console.log(metro)
|
2017-09-17 00:50:30 +00:00
|
|
|
var percent = +one + +design + +gov + +embassies + +capital + +infra + +chain + +town + +city + +metro
|
2017-09-09 04:15:16 +00:00
|
|
|
console.log(percent)
|
2017-09-19 23:34:52 +00:00
|
|
|
var bonus = +percent * 100
|
|
|
|
var bonus = bonus.toFixed(2);
|
|
|
|
console.log(bonus)
|
2017-09-19 19:48:41 +00:00
|
|
|
var total = +gold * +percent
|
|
|
|
console.log(total)
|
|
|
|
var total = +total + +gold
|
|
|
|
console.log(total)
|
2017-09-17 00:50:30 +00:00
|
|
|
var total = total.toFixed(0);
|
2017-09-09 04:15:16 +00:00
|
|
|
console.log(total)
|
2017-09-19 23:34:52 +00:00
|
|
|
var emeralds = +total / 100
|
|
|
|
console.log(emeralds)
|
|
|
|
//var date = Date();
|
|
|
|
//console.log(date)
|
2017-09-09 03:30:59 +00:00
|
|
|
|
|
|
|
//Show result
|
2017-09-19 23:34:52 +00:00
|
|
|
alert("Your Income is " + total + " Gold (or " + emeralds + " emeralds) per Minecraft Year (5 days)");
|
|
|
|
document.getElementById("Bonus").innerHTML = "Your Efficiency bonus is " + bonus + "%";
|
|
|
|
document.getElementById("Income").innerHTML = "Your Income is " + total + " Gold (or " + emeralds + " emeralds) per Minecraft Year (5 days)";
|
2017-09-09 03:30:59 +00:00
|
|
|
|
|
|
|
}
|