Advertisement
Guest User

World of Tanks Crew Training Calculator

a guest
Jul 4th, 2019
2,931
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.94 KB | None | 0 0
  1.  <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Training Book Calculator</title>
  5. </head>
  6. <body>
  7.  
  8. <script>
  9. function CalcIncrease( pcent, skills, xp, nb ) {
  10.  
  11.     var keep_trying = 1, y, xp_req;
  12.  
  13.     xp = xp * nb;
  14.  
  15.     while ( keep_trying == 1 ) {
  16.         y = skills + 2;
  17.         xp_req = ( 2 ** y ) * 25 * ( 100 ** ( pcent / 100 ) );
  18.  
  19.         if ( xp_req <= xp ) {
  20.             xp = xp - xp_req;
  21.             pcent++;
  22.  
  23.             if ( pcent == 100 ) {
  24.                 skills++;
  25.                 pcent = 0;
  26.             }
  27.         } else {
  28.             keep_trying = 0;
  29.         }
  30.     }
  31.  
  32.     document.getElementById("noskills").innerHTML = "After applying the book(s), you will have " + skills + " completed skills and be at " + pcent + " percent in the next.";
  33.     return " ";
  34. }
  35. </script>
  36.  
  37. <h1>Calculate the crew skill resulting from the application of crew books</h1>
  38.  
  39. <form onsubmit="return false" onchange="x.value=CalcIncrease(parseInt(a.value), parseInt(noperks.value), parseInt(books.value), parseInt(nb.value))">
  40.  
  41.  <input type="radio" name="noperks" value="0" checked> No completed skills<br>
  42.   <input type="radio" name="noperks" value="1"> One completed skill<br>
  43.   <input type="radio" name="noperks" value="2"> Two completed skills<br>
  44.   <input type="radio" name="noperks" value="3"> Three completed skills<br>
  45.   <input type="radio" name="noperks" value="4"> Four completed skills<br>
  46.   <input type="radio" name="noperks" value="5"> Five completed skills<br>
  47.   <input type="radio" name="noperks" value="6"> Six completed skills<br><br><br>
  48.   Percent in current skill (0-99)
  49.   <input type="number" id="a" step="1" name="a" min="0" max="99" value="50" >
  50.   <br>
  51.   <input type="number" id="nb" step="1" name="nb" min="1" max="50" value="1" >
  52.    <select name="books">
  53.   <option value="20000">20,000 XP book</option>
  54.   <option value="100000">100,000 XP book</option>
  55.   <option value="250000">250,000 XP book</option>
  56.   <option value="850000">850,000 XP book</option>
  57. </select>
  58.   <output name="x"></output>
  59. </form>
  60. <p id="noskills" ></p>
  61.  
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement