Widget:YieldCalc: Difference between revisions

From Ara: History Untold Wiki
No edit summary
No edit summary
Line 18: Line 18:
   <input type="number" id="farmCount"> - Amount of Farms in the region<br />
   <input type="number" id="farmCount"> - Amount of Farms in the region<br />
   <input type="number" id="percBonus"> - Total Percentage Bonus (e.g. 50% from a Plow)<br />
   <input type="number" id="percBonus"> - Total Percentage Bonus (e.g. 50% from a Plow)<br />
   <input type="checkbox" id="verseBonus" value="Yes"> - Religious Verse active?<br />
   <input type="checkbox" id="verseBonus"> - Religious Verse active?<br />
   <input type="submit" value="Calculate" onClick="yieldScript()">   
   <input type="submit" value="Calculate" onClick="yieldScript()">   
</form>
</form>
Line 35: Line 35:
   let E = Number(document.getElementById('percBonus').value); // Total Percentage Bonus (e.g. 50% from a Plow)
   let E = Number(document.getElementById('percBonus').value); // Total Percentage Bonus (e.g. 50% from a Plow)


   let F = document.getElementById('verseBonus').value; // Extra farm adjacency from religious verse
   let F = document.getElementById('verseBonus'); // Extra farm adjacency from religious verse


   let H = C + F; // Add F to the actual amount of farms in the region
  if (F.checked == true){
    let G = 1
  } else {
    let G = 0
  }
 
   let H = C + G; // Add G to the actual amount of farms in the region


   let Z = Number(Math.floor(A*B+B*5*C+5+(A+5*C)*(E/100)+(C-1)*5+A)); // Resulting production of a single farm
   let Z = Number(Math.floor(A*B+B*5*C+5+(A+5*C)*(E/100)+(C-1)*5+A)); // Resulting production of a single farm

Revision as of 02:09, 25 October 2024

This widget is used to display and calculate the yield with the values submitted by the user.

Usage: ‎{{#Widget:YieldCalc}}