Szablon:Edycja: Różnice pomiędzy wersjami
Nie podano opisu zmian |
Nie podano opisu zmian |
||
Linia 1: | Linia 1: | ||
<altaronpanel title="[[Plik:Magiczny_Szmaragd.gif]] | <altaronpanel title="[[Plik:Magiczny_Szmaragd.gif]] Kalkulator PN"> | ||
<html> | |||
<style> | |||
.container { | |||
width: 500px; | |||
margin: 5 auto; | |||
text-align: center; | |||
border: 1px solid black; | |||
padding: 20px; | |||
} | |||
h1 { | |||
font-size: 24px; | |||
margin-bottom: 20px; | |||
} | |||
select { | |||
font-size: 16px; | |||
padding: 10px; | |||
margin-bottom: 20px; | |||
width: 100%; | |||
text-align: center; | |||
} | |||
input[type="number"] { | |||
font-size: 12px; | |||
padding: 5px 10px; | |||
margin-bottom: 10px; | |||
width: 100%; | |||
text-align: center; | |||
} | |||
button { | |||
padding: 10px 20px; | |||
font-size: 16px; | |||
margin-top: 20px; | |||
width: 100%; | |||
background-color: #4CAF50; | |||
color: white; | |||
border: none; | |||
border-radius: 5px; | |||
cursor: pointer; | |||
} | |||
label { | |||
font-size: 14px; | |||
display: block; | |||
margin-bottom: 10px; | |||
} | |||
#pointsNeeded { | |||
font-weight: bold; | |||
font-size: 18px; | |||
margin-top: 20px; | |||
} | |||
</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> | |||
<select id="currentLevel"> | |||
</select> | |||
<br> | |||
<label for="targetLevel">Wybierz docelowy poziom:</label> | |||
<select id="targetLevel"> | |||
</select> | |||
<br> | |||
<script> | |||
const currentLevelSelect = document.querySelector('#currentLevel'); | |||
for (let i = 3; i <= 200; i++) { | |||
const option = document.createElement('option'); | |||
option.value = i; | |||
option.textContent = i; | |||
currentLevelSelect.appendChild(option); | |||
} | |||
const targetLevelSelect = document.querySelector('#targetLevel'); | |||
for(let i = 4; i <= 200; i++) { | |||
const option = document.createElement('option'); | |||
option.value = i; | |||
option.textContent = i; | |||
targetLevelSelect.appendChild(option); | |||
} | |||
function calculatePoints() { | |||
var profession = document.getElementById("profession").value; | |||
var currentLevel = parseInt(document.getElementById("currentLevel").value); | |||
var targetLevel = parseInt(document.getElementById("targetLevel").value); | |||
var ability = document.getElementById("ability").value; | |||
var pointsNeeded = 0; | |||
var limit = Altaron.getSkillLimit(profession, ability); | |||
if (targetLevel > limit) { | |||
document.getElementById("pointsNeeded").innerHTML ="Docelowy poziom jest większy niż maksymalny poziom " + limit + "."; | |||
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> | |||
<button onclick="calculatePoints()">Oblicz</button> | |||
<br> | |||
<span id="pointsNeeded"></span> | |||
</html> | |||
</altaronpanel> | </altaronpanel> |