Advertisement
Guest User

World of Tanks - Crew Skill Calculator

a guest
Jul 9th, 2019
2,286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.91 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.  
  5. <head>
  6.  
  7. <title>Crew Skill Calculator</title>
  8.  
  9. </head>
  10.  
  11. <body>
  12.  
  13.  
  14. <style>
  15. * {
  16.   box-sizing: border-box;
  17. }
  18.  
  19. /* Create two equal columns that floats next to each other */
  20. .column {
  21.   float: left;
  22.   width: 50%;
  23.   padding: 10px;
  24. }
  25.  
  26. /* Clear floats after the columns */
  27. .row:after {
  28.   content: "";
  29.   display: table;
  30.   clear: both;
  31. }
  32. </style>
  33.  
  34.  
  35. <script>
  36.  
  37. function CalcIncrease( cpcent, cskills, wpcent, wskills ) {
  38.  
  39.  
  40.     var keep_trying = 0, y, xp_req = 0, xp;
  41.  
  42.  
  43.     if ( cpcent == 100 ) {
  44.         cskills++;
  45.         cpcent = 0;
  46.     }
  47.     if ( wpcent == 100 ) {
  48.         wskills++;
  49.         wpcent = 0;
  50.     }
  51.    
  52.     if ( ( wskills == cskills )  && ( wpcent > cpcent ) ) {
  53.         keep_trying = 1;
  54.     } else if ( wskills > cskills ) {
  55.         keep_trying = 1;
  56.     }
  57.    
  58.  
  59.     while ( keep_trying == 1 ) {
  60.  
  61.         y = cskills + 1;
  62.  
  63.         xp_req = xp_req + ( ( 2 ** y ) * 25 * ( 100 ** ( cpcent / 100 ) ) );
  64.  
  65.         cpcent++;
  66.         if ( cpcent == 100 ) {
  67.             cskills++;
  68.             cpcent = 0;
  69.         }
  70.  
  71.         if ( ( wskills == cskills )  && ( wpcent == cpcent ) ) {
  72.             keep_trying = 0;
  73.         }
  74.     }
  75.  
  76.  
  77.     xpd = Math.floor( xp_req );
  78.  
  79.     if ( xpd != xp_req ) {
  80.         xpd++;
  81.     }
  82.    
  83.     if ( cskills > 1 ) {
  84.         document.getElementById("noskills").innerHTML = "After gaining " + xpd.toLocaleString() + " experience, you will have " + (cskills - 1) + " completed skill(s) and be at " + cpcent + " percent in the next.";
  85.  
  86.     } else if ( cskills == 1 ) {
  87.         document.getElementById("noskills").innerHTML = "After gaining " + xpd.toLocaleString() + " experience, you will have 100% in your major qualifaction and be at " + cpcent + " percent in your first skill.";
  88.  
  89.  
  90.     } else {
  91.         document.getElementById("noskills").innerHTML = "After gaining " + xpd.toLocaleString() + " experience, you will have " + cpcent + " percent in the major qualification.";
  92.  
  93.  
  94.     }
  95.    
  96.  
  97.     return " ";
  98.  
  99. }
  100.  
  101.  
  102. </script>
  103.  
  104.  
  105. <h1>Calculate the required experience to attain a certain crew skill</h1>
  106.  
  107.  
  108.  
  109.  
  110. <form onsubmit="return false" onchange="x.value=CalcIncrease(parseInt(a.value), parseInt(noperks.value), parseInt(b.value), parseInt(nowanted.value))">
  111.  
  112.     <div class="row">
  113.         <div class="column" style="background-color:#aaa;">
  114.             <h2>My crew has ...</h2>
  115.  
  116.             <input type="number" id="a" step="1" name="a" min="0" max="100" value="90" > percent in their <br>
  117.  
  118.             <input type="radio" name="noperks" value="0" checked> major qualification.<br>
  119.  
  120.             <input type="radio" name="noperks" value="1" > first skill.<br>
  121.  
  122.             <input type="radio" name="noperks" value="2"> second skill.<br>
  123.  
  124.             <input type="radio" name="noperks" value="3"> third skill.<br>
  125.  
  126.             <input type="radio" name="noperks" value="4"> fourth skill.<br>
  127.  
  128.             <input type="radio" name="noperks" value="5"> fifth skill.<br>
  129.  
  130.             <input type="radio" name="noperks" value="6"> sixth skill.<br>
  131.  
  132.             <input type="radio" name="noperks" value="7"> seventh skill.<br><br><br>
  133.  
  134.    
  135.         </div>
  136.         <div class="column" style="background-color:#bbb;">
  137.             <h2>I want to get them to ...</h2>
  138.             <input type="number" id="b" step="1" name="b" min="0" max="100" value="100" > percent in their <br>
  139.  
  140.             <input type="radio" name="nowanted" value="0" checked> major qualifiaction.<br>
  141.  
  142.             <input type="radio" name="nowanted" value="1" > first skill (and 100% in their major qualification).<br>
  143.  
  144.             <input type="radio" name="nowanted" value="2"> second skill.<br>
  145.  
  146.             <input type="radio" name="nowanted" value="3"> third skill.<br>
  147.  
  148.             <input type="radio" name="nowanted" value="4"> fourth skill.<br>
  149.  
  150.             <input type="radio" name="nowanted" value="5"> fifth skill.<br>
  151.  
  152.             <input type="radio" name="nowanted" value="6"> sixth skill.<br>
  153.  
  154.             <input type="radio" name="nowanted" value="7"> seventh skill.<br><br><br>
  155.  
  156.         </div>
  157.     </div>
  158.     <output name="x"></output>
  159.  
  160. </form>
  161.  
  162. <p id="noskills" > </p>
  163.  
  164.  
  165.  
  166. <p>Note that 0-skill BIA crews are not accounted for in the calculation.  In those cases, reduce the number of skills, have and desired, by 1.</p>
  167. </body>
  168.  
  169. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement