Szablon:Edycja: Różnice pomiędzy wersjami

Z Altaron Wiki
(Utworzył nową stronę „Czy znajdujesz na Wiki.Altaron błędy, niedociągnięcia albo brakujące informacje? Nie musisz tego zgłaszać nikomu, możesz naprawić to własnoręcznie! Wystarczy...”)
 
Nie podano opisu zmian
 
(Nie pokazano 17 wersji utworzonych przez 3 użytkowników)
Linia 1: Linia 1:
Czy znajdujesz na Wiki.Altaron błędy, niedociągnięcia albo brakujące informacje? Nie musisz tego zgłaszać nikomu, możesz naprawić to własnoręcznie! Wystarczy, że się zarejestrujesz i rozpoczniesz edycję.
<altaronpanel title="[[Plik:Zwój_Przemiany.gif]] Kalkulator Punktów Nauki" style="2" titleCSS="text-align: center;>


<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>
document.addEventListener("DOMContentLoaded",function(){
const currentLevelSelect = document.querySelector('#currentLevel');
const targetLevelSelect = document.querySelector('#targetLevel');
const professionInput = document.getElementById("profession");
const abilityInput = document.getElementById("ability");


'''Jeśli chcesz pomóc w edytowaniu [[Altaron Wiki]], zobacz co jeszcze pozostało [[:Kategoria:Do edycji|do zrobienia]].'''
const updateLevels = function() {
currentLevelSelect.innerHTML = '';
targetLevelSelect.innerHTML = '';
const limit = !!this.Altaron ? Altaron.getSkillLimit(professionInput.value, abilityInput.value) : 200;
for (let i = 1; i <= limit; i++) {
const option1 = document.createElement('option');
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>
</altaronpanel>

Aktualna wersja na dzień 19:26, 15 lut 2023

Zwój Przemiany.gif Kalkulator Punktów Nauki