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

Z Altaron Wiki
Nie podano opisu zmian
Nie podano opisu zmian
 
(Nie pokazano 4 wersji utworzonych przez 2 użytkowników)
Linia 2: Linia 2:


<html>
<html>
<center>
  <body>
    <style>
       <div class="form-group">
       .container {
        <label for="profession">Wybierz profesję:</label>
        width: 500px;
        <select class="form-control" id="profession">
        margin: 5 auto;
          <option value="3000">Wojownik</option>
        text-align: center;
          <option value="4000">Łucznik</option>
        padding: 20px;
          <option value="2000">Mag</option>
      }
        </select>
      h1 {
       </div>
        font-size: 24px;
      <div class="form-group">
        margin-bottom: 20px;
        <label for="ability">Wybierz umiejętność:</label>
      }
        <select class="form-control" id="ability">
      select {
          <option value="strength">Siła</option>
        font-size: 16px;
          <option value="shield">Obrona Tarczą</option>
        padding: 10px;
          <option value="1h">Bron Jednoręczna</option>
        margin-bottom: 5px;
          <option value="2h">Broń Dwuręczna</option>
        width: 100%;
          <option value="dist">Walka Dystansowa</option>
        text-align: center;
          <option value="magic">Magia</option>
      }
          <option value="alchemy">Alchemia</option>
      input[type="number"] {
          <option value="agility">Zręczność</option>
        font-size: 12px;
        </select>
        padding: 5px 10px;
      </div>
        margin-bottom: 5px;
      <div class="form-group">
        width: 100%;
        <label for="currentLevel">Wybierz obecny poziom:</label>
        text-align: center;
        <select class="form-control" id="currentLevel">
      }
        </select>
      button {
      </div>
        padding: 10px 20px;
      <div class="form-group">
        font-size: 16px;
        <label for="targetLevel" id="targetLevelLabel">Wybierz docelowy poziom:</label>
        margin-top: 20px;
        <select class="form-control" id="targetLevel">
        width: 100%;
        </select>
        background-color: #4CAF50;
      </div>
        color: white;
      <div class="form-group d-flex justify-content-center">
        border: none;
        <button onclick="calculatePoints()" class="btn btn-primary">Oblicz</button>
        border-radius: 5px;
      </div>
        cursor: pointer;
      <p id="pointsNeeded" class="font-weight-bold text-center">
      }
      </p>
      label {
     </div>
        font-size: 14px;
  </body>
        display: block;
   
        margin-bottom: 5px;
<script>
      }
document.addEventListener("DOMContentLoaded",function(){
      #pointsNeeded {
const currentLevelSelect = document.querySelector('#currentLevel');
        font-weight: bold;
const targetLevelSelect = document.querySelector('#targetLevel');
        font-size: 18px;
const professionInput = document.getElementById("profession");
        margin-top: 0px;
const abilityInput = document.getElementById("ability");
      }
    </style>
    <div class="container">
      <label for="profession">Wybierz profesję:</label>
    <select id="profession">
      <option value="3000">Wojownik</option>
  <option value="4000">Łucznik</option>
      <option value="2000">Mag</option>
    </select>
       <label for="ability">Wybierz umiejętność:</label>
    <select 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>
<br />


  <label for="currentLevel">Wybierz obecny poziom:</label>
const updateLevels = function() {
  <select id="currentLevel">
currentLevelSelect.innerHTML = '';
  </select>
targetLevelSelect.innerHTML = '';
  <br>
  <label for="targetLevel">Wybierz docelowy poziom:</label>
const limit = !!this.Altaron ? Altaron.getSkillLimit(professionInput.value, abilityInput.value) : 200;
  <select id="targetLevel">
  </select>
for (let i = 1; i <= limit; i++) {
  <br>
const option1 = document.createElement('option');
 
option1.value = i;
<script>
option1.textContent = i;
  const currentLevelSelect = document.querySelector('#currentLevel');
targetLevelSelect.appendChild(option1);
  for (let i = 1; i <= 200; i++) {
 
    const option = document.createElement('option');
const option2 = document.createElement('option');
    option.value = i;
option2.value = i;
    option.textContent = i;
option2.textContent = i;
    currentLevelSelect.appendChild(option);
currentLevelSelect.appendChild(option2);
  }
}
};
   
    updateLevels();
const clearInputErrors = function() {
document.getElementById("targetLevel").classList.remove("is-invalid");
document.getElementById("targetLevelLabel").classList.remove("text-danger");
};


  const targetLevelSelect = document.querySelector('#targetLevel');
professionInput.addEventListener('change', function(){
  for(let i = 2; i <= 200; i++) {
updateLevels();
    const option = document.createElement('option');
clearInputErrors();
    option.value = i;
});
    option.textContent = i;
abilityInput.addEventListener('change', function(){
    targetLevelSelect.appendChild(option);
updateLevels();
  }
clearInputErrors();
 
});
  function calculatePoints() {
         var profession = document.getElementById("profession").value;
         var currentLevel = parseInt(document.getElementById("currentLevel").value);
window.calculatePoints = function() {
         var targetLevel = parseInt(document.getElementById("targetLevel").value);
         var profession = professionInput.value;
         var ability = document.getElementById("ability").value;
         var ability = abilityInput.value;
         var currentLevel = parseInt(currentLevelSelect.value);
         var targetLevel = parseInt(targetLevelSelect.value);
         var pointsNeeded = 0;
         var pointsNeeded = 0;
         var limit = Altaron.getSkillLimit(profession, ability);
         var limit = Altaron.getSkillLimit(profession, ability);


  if (targetLevel > limit) {
clearInputErrors();
    document.getElementById("pointsNeeded").innerHTML ="Docelowy poziom jest większy niż maksymalny poziom " + limit + ".";
 
    return;
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++) {
         for(var i = currentLevel; i < targetLevel; i++) {
                pointsNeeded += Altaron.getLearnPointsForLevel(profession, ability, i);
pointsNeeded += Altaron.getLearnPointsForLevel(profession, ability, i);
         }
         }
        document.getElementById("pointsNeeded").innerHTML = "Brakuje Ci " + pointsNeeded + " punktów nauki.";
};


        document.getElementById("pointsNeeded").innerHTML = "Brakuje Ci " + pointsNeeded + " punktów nauki.";  
});
  }
</script>
</script>
<button onclick="calculatePoints()">Oblicz</button>
<br>
<span id="pointsNeeded"></span>
</center>
</html>
</html>
</altaronpanel>
</altaronpanel>

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

Zwój Przemiany.gif Kalkulator Punktów Nauki