Widget:YieldCalc: Difference between revisions
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 7: | Line 7: | ||
<form id="yieldCalc"> | <form id="yieldCalc"> | ||
<input type="number" placeholder="62" size="4"><br /> | <input type="number" id="cityProd" placeholder="62" size="4"><br /> | ||
<input type="number" placeholder="3" size="4"><br /> | <input type="number" id="regionYield" placeholder="3" size="4"><br /> | ||
<input type="number" placeholder="3" size="4"><br /> | <input type="number" id="farmCount" placeholder="3" size="4"><br /> | ||
<input type="number" placeholder="50" size="4"><br /> | <input type="number" id="percBonus" placeholder="50" size="4"><br /> | ||
<input type="radial"><br /> | <input type="radial" id=""><br /> | ||
<button type="submit">Calculate</button> | <button type="submit">Calculate</button> | ||
</form> | </form> | ||
Line 17: | Line 17: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
/* Yield Calculator */ | /* Yield Calculator */ | ||
let a = | let a = document.getElementsById('cityProd'); /* City Production */ | ||
let b = 6; /* Yield(Apples) of the region */ | let b = 6; /* Yield(Apples) of the region */ | ||
let c = 3; /* Amount of Farms in the region */ | let c = 3; /* Amount of Farms in the region */ | ||
Line 24: | Line 24: | ||
let f = 1; /* Extra farm adjacency from religious verse (Boolean) */ | let f = 1; /* Extra farm adjacency from religious verse (Boolean) */ | ||
let h = c + f; /* Add f to the actual amount of farms in the region */ | let h = c + f; /* Add f to the actual amount of farms in the region */ | ||
z = Math.floor(a*b+b*5*h+5+(a+5*h)*(e/100)+(h-1)*5+a); /* Food yield for a single farm in the region */ | let z = Math.floor(a*b+b*5*h+5+(a+5*h)*(e/100)+(h-1)*5+a); /* Food yield for a single farm in the region */ | ||
let y = z x c /* Food yield multiplied by the amount of farms in the region */ | |||
document.getElementById("foodYield").innerHTML = z; | document.getElementById("foodYield").innerHTML = z; |
Revision as of 21:26, 24 October 2024
This widget is used to display and calculate the yield with the values submitted by the user.
Usage: {{#Widget:YieldCalc}}