Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Crew Skill Calculator</title>
- </head>
- <body>
- <style>
- * {
- box-sizing: border-box;
- }
- /* Create two equal columns that floats next to each other */
- .column {
- float: left;
- width: 50%;
- padding: 10px;
- }
- /* Clear floats after the columns */
- .row:after {
- content: "";
- display: table;
- clear: both;
- }
- </style>
- <script>
- function CalcIncrease( cpcent, cskills, wpcent, wskills ) {
- var keep_trying = 0, y, xp_req = 0, xp;
- if ( cpcent == 100 ) {
- cskills++;
- cpcent = 0;
- }
- if ( wpcent == 100 ) {
- wskills++;
- wpcent = 0;
- }
- if ( ( wskills == cskills ) && ( wpcent > cpcent ) ) {
- keep_trying = 1;
- } else if ( wskills > cskills ) {
- keep_trying = 1;
- }
- while ( keep_trying == 1 ) {
- y = cskills + 1;
- xp_req = xp_req + ( ( 2 ** y ) * 25 * ( 100 ** ( cpcent / 100 ) ) );
- cpcent++;
- if ( cpcent == 100 ) {
- cskills++;
- cpcent = 0;
- }
- if ( ( wskills == cskills ) && ( wpcent == cpcent ) ) {
- keep_trying = 0;
- }
- }
- xpd = Math.floor( xp_req );
- if ( xpd != xp_req ) {
- xpd++;
- }
- if ( cskills > 1 ) {
- 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.";
- } else if ( cskills == 1 ) {
- 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.";
- } else {
- document.getElementById("noskills").innerHTML = "After gaining " + xpd.toLocaleString() + " experience, you will have " + cpcent + " percent in the major qualification.";
- }
- return " ";
- }
- </script>
- <h1>Calculate the required experience to attain a certain crew skill</h1>
- <form onsubmit="return false" onchange="x.value=CalcIncrease(parseInt(a.value), parseInt(noperks.value), parseInt(b.value), parseInt(nowanted.value))">
- <div class="row">
- <div class="column" style="background-color:#aaa;">
- <h2>My crew has ...</h2>
- <input type="number" id="a" step="1" name="a" min="0" max="100" value="90" > percent in their <br>
- <input type="radio" name="noperks" value="0" checked> major qualification.<br>
- <input type="radio" name="noperks" value="1" > first skill.<br>
- <input type="radio" name="noperks" value="2"> second skill.<br>
- <input type="radio" name="noperks" value="3"> third skill.<br>
- <input type="radio" name="noperks" value="4"> fourth skill.<br>
- <input type="radio" name="noperks" value="5"> fifth skill.<br>
- <input type="radio" name="noperks" value="6"> sixth skill.<br>
- <input type="radio" name="noperks" value="7"> seventh skill.<br><br><br>
- </div>
- <div class="column" style="background-color:#bbb;">
- <h2>I want to get them to ...</h2>
- <input type="number" id="b" step="1" name="b" min="0" max="100" value="100" > percent in their <br>
- <input type="radio" name="nowanted" value="0" checked> major qualifiaction.<br>
- <input type="radio" name="nowanted" value="1" > first skill (and 100% in their major qualification).<br>
- <input type="radio" name="nowanted" value="2"> second skill.<br>
- <input type="radio" name="nowanted" value="3"> third skill.<br>
- <input type="radio" name="nowanted" value="4"> fourth skill.<br>
- <input type="radio" name="nowanted" value="5"> fifth skill.<br>
- <input type="radio" name="nowanted" value="6"> sixth skill.<br>
- <input type="radio" name="nowanted" value="7"> seventh skill.<br><br><br>
- </div>
- </div>
- <output name="x"></output>
- </form>
- <p id="noskills" > </p>
- <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>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement