Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Training Book Calculator</title>
- </head>
- <body>
- <script>
- function CalcIncrease( pcent, skills, xp, nb ) {
- var keep_trying = 1, y, xp_req;
- xp = xp * nb;
- while ( keep_trying == 1 ) {
- y = skills + 2;
- xp_req = ( 2 ** y ) * 25 * ( 100 ** ( pcent / 100 ) );
- if ( xp_req <= xp ) {
- xp = xp - xp_req;
- pcent++;
- if ( pcent == 100 ) {
- skills++;
- pcent = 0;
- }
- } else {
- keep_trying = 0;
- }
- }
- document.getElementById("noskills").innerHTML = "After applying the book(s), you will have " + skills + " completed skills and be at " + pcent + " percent in the next.";
- return " ";
- }
- </script>
- <h1>Calculate the crew skill resulting from the application of crew books</h1>
- <form onsubmit="return false" onchange="x.value=CalcIncrease(parseInt(a.value), parseInt(noperks.value), parseInt(books.value), parseInt(nb.value))">
- <input type="radio" name="noperks" value="0" checked> No completed skills<br>
- <input type="radio" name="noperks" value="1"> One completed skill<br>
- <input type="radio" name="noperks" value="2"> Two completed skills<br>
- <input type="radio" name="noperks" value="3"> Three completed skills<br>
- <input type="radio" name="noperks" value="4"> Four completed skills<br>
- <input type="radio" name="noperks" value="5"> Five completed skills<br>
- <input type="radio" name="noperks" value="6"> Six completed skills<br><br><br>
- Percent in current skill (0-99)
- <input type="number" id="a" step="1" name="a" min="0" max="99" value="50" >
- <br>
- <input type="number" id="nb" step="1" name="nb" min="1" max="50" value="1" >
- <select name="books">
- <option value="20000">20,000 XP book</option>
- <option value="100000">100,000 XP book</option>
- <option value="250000">250,000 XP book</option>
- <option value="850000">850,000 XP book</option>
- </select>
- <output name="x"></output>
- </form>
- <p id="noskills" ></p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement