-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxp.html
76 lines (71 loc) · 2.5 KB
/
xp.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>XP Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
}
#container {
max-width: 400px;
margin: 50px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
input[type="number"] {
width: 100%;
padding: 8px;
margin: 5px 0;
box-sizing: border-box;
}
button {
width: 100%;
padding: 10px;
margin-top: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
#result {
margin-top: 20px;
}
</style>
</head>
<body>
<div id="container">
<h2>XP Calculator</h2>
<label for="xpFullLevel">XP for full level:</label>
<input type="number" id="xpFullLevel" placeholder="Enter XP for full level"><br>
<label for="xpPerRound">XP per round:</label>
<input type="number" id="xpPerRound" placeholder="Enter XP per round"><br>
<label for="timePerRound">Time per round (minutes):</label>
<input type="number" id="timePerRound" placeholder="Enter time per round"><br>
<label for="xpAlreadyHave">XP you already have:</label>
<input type="number" id="xpAlreadyHave" placeholder="Enter XP you already have"><br>
<button onclick="calculate()">Calculate</button>
<div id="result"></div>
</div>
<script>
function calculate() {
var xpFullLevel = parseInt(document.getElementById('xpFullLevel').value);
var xpPerRound = parseInt(document.getElementById('xpPerRound').value);
var timePerRound = parseInt(document.getElementById('timePerRound').value);
var xpAlreadyHave = parseInt(document.getElementById('xpAlreadyHave').value);
if (isNaN(xpFullLevel) || isNaN(xpPerRound) || isNaN(timePerRound) || isNaN(xpAlreadyHave)) {
alert('Please fill in all fields with valid numbers.');
return;
}
var xpNeeded = xpFullLevel - xpAlreadyHave;
var roundsNeeded = Math.ceil(xpNeeded / xpPerRound);
var totalTime = roundsNeeded * timePerRound;
var resultDiv = document.getElementById('result');
resultDiv.innerHTML = "You need " + roundsNeeded + " rounds to reach full XP. This will take approximately " + totalTime + " minutes.";
}
</script>
</body>
</html>