|
|
Linia 30: |
Linia 30: |
| {{Infobox Quest/Lista/Wstep}} | | {{Infobox Quest/Lista/Wstep}} |
| {{:WIEŻA - dziwne notatki|Lista}} | | {{:WIEŻA - dziwne notatki|Lista}} |
| | {{Info Quest/Lista/Koniec}} |
| </spoiler> | | </spoiler> |
|
| |
|
| | | <div class="table-responsive"> |
| <html>
| |
| <body> | |
| <div class="form-group">
| |
| <label for="profession">Wybierz profesję:</label>
| |
| <select class="form-control" id="profession">
| |
| <option value="3000">Wojownik</option>
| |
| <option value="4000">Łucznik</option>
| |
| <option value="2000">Mag</option>
| |
| </select>
| |
| </div>
| |
| <div class="form-group">
| |
| <label for="ability">Wybierz umiejętność:</label>
| |
| <select class="form-control" id="ability">
| |
| <option value="strength">Siła</option>
| |
| <option value="shield">Obrona Tarczą</option>
| |
| <option value="1h">Bron Jednoręczna</option>
| |
| <option value="2h">Broń Dwuręczna</option>
| |
| <option value="dist">Walka Dystansowa</option>
| |
| <option value="magic">Magia</option>
| |
| <option value="alchemy">Alchemia</option>
| |
| <option value="agility">Zręczność</option>
| |
| </select>
| |
| </div>
| |
| <div class="form-group">
| |
| <label for="currentLevel">Wybierz obecny poziom:</label>
| |
| <select class="form-control" id="currentLevel">
| |
| </select>
| |
| </div>
| |
| <div class="form-group">
| |
| <label for="targetLevel" id="targetLevelLabel">Wybierz docelowy poziom:</label>
| |
| <select class="form-control" id="targetLevel">
| |
| </select>
| |
| </div>
| |
| <div class="form-group d-flex justify-content-center">
| |
| <button onclick="calculatePoints()" class="btn btn-primary">Oblicz</button>
| |
| </div>
| |
| <p id="pointsNeeded" class="font-weight-bold text-center">
| |
| </p>
| |
| </div>
| |
| </body>
| |
| | | |
| <script> | | <thead class="thead-dark"> |
| | | |
| document.addEventListener("DOMContentLoaded",function(){
| | <nowiki></thead></nowiki> |
| const currentLevelSelect = document.querySelector('#currentLevel');
| | <table class="table table-bordered table-hover tablesorter"><tr> |
| const targetLevelSelect = document.querySelector('#targetLevel');
| | <th colspan="8" class="text-center" style="vertical-align: middle;" text-white;>{{#if:{{{1|}}}|<h4>{{{1}}}}}</th> |
| const professionInput = document.getElementById("profession");
| | </tr> |
| const abilityInput = document.getElementById("ability");
| | <tr> |
| | | <th class="text-center" width="150">Nazwa </th> |
| const updateLevels = function() {
| | <th class="text-center" width="40"></th> |
| currentLevelSelect.innerHTML = '';
| | <th class="text-center" width="160">Inkantacja </th> |
| targetLevelSelect.innerHTML = '';
| | <th class="text-center" width="120"> Status Szlachecki</th> |
|
| | <th class="text-center" width="100"> Promocja</th> |
| const limit = !!this.Altaron ? Altaron.getSkillLimit(professionInput.value, abilityInput.value) : 200;
| | <th class="text-center" width="70">Mana</th> |
|
| | <th class="text-center" width="80">Poziom</th> |
| for (let i = 1; i <= limit; i++) {
| | <th class="text-center" width="150">Koszt Czaru</th> |
| const option1 = document.createElement('option');
| | </tr> |
| option1.value = i;
| |
| option1.textContent = i;
| |
| targetLevelSelect.appendChild(option1);
| |
| | |
| const option2 = document.createElement('option');
| |
| option2.value = i;
| |
| option2.textContent = i;
| |
| currentLevelSelect.appendChild(option2);
| |
| }
| |
| };
| |
|
| |
| updateLevels();
| |
|
| |
| const clearInputErrors = function() {
| |
| document.getElementById("targetLevel").classList.remove("is-invalid");
| |
| document.getElementById("targetLevelLabel").classList.remove("text-danger");
| |
| };
| |
| | |
| professionInput.addEventListener('change', function(){
| |
| updateLevels();
| |
| clearInputErrors();
| |
| });
| |
| abilityInput.addEventListener('change', function(){
| |
| updateLevels();
| |
| clearInputErrors();
| |
| });
| |
|
| |
|
| |
| window.calculatePoints = function() {
| |
| var profession = professionInput.value; | |
| var ability = abilityInput.value; | |
| var currentLevel = parseInt(currentLevelSelect.value);
| |
| var targetLevel = parseInt(targetLevelSelect.value);
| |
| var pointsNeeded = 0;
| |
| var limit = Altaron.getSkillLimit(profession, ability);
| |
| | |
| clearInputErrors();
| |
| | |
| if (targetLevel > limit) {
| |
| document.getElementById("pointsNeeded").innerHTML ="Docelowy poziom jest większy niż maksymalny poziom " + limit + ".";
| |
| document.getElementById("targetLevel").classList.add("is-invalid");
| |
| document.getElementById("targetLevelLabel").classList.add("text-danger")
| |
| return;
| |
| }
| |
| else if (targetLevel < currentLevel) {
| |
| document.getElementById("pointsNeeded").innerHTML ="Docelowy poziom " + targetLevel + " nie może być mniejszy od obecnego " + currentLevel + ".";
| |
| document.getElementById("targetLevel").classList.add("is-invalid");
| |
| document.getElementById("targetLevelLabel").classList.add("text-danger")
| |
| return;
| |
| }
| |
| | |
| for(var i = currentLevel; i < targetLevel; i++) {
| |
| pointsNeeded += Altaron.getLearnPointsForLevel(profession, ability, i);
| |
| }
| |
| document.getElementById("pointsNeeded").innerHTML = "Brakuje Ci " + pointsNeeded + " punktów nauki.";
| |
| };
| |
| | |
| });
| |
| | |
| | |
| | |
| | |
| </script> | |
| </html> | |