-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.html
More file actions
212 lines (196 loc) · 9.37 KB
/
calc.html
File metadata and controls
212 lines (196 loc) · 9.37 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE html>
<html lang="zh-hant">
<html>
<head>
<meta charset="utf-8">
<title>HINA_AI Leveling Calculator</title>
</head>
<body>
<h3>HINA_AI Leveling Calculator</h3>
<div>
<h5>推算下一級還需多少經驗(偷窺用w)</h5>
<label for="input_area">請輸入總經驗(Experience):</label>
<input id="input_area" size="10" value="0">
<p></p>
<button id="btn_01" onclick="calc_01(document.getElementById('input_area').value);">計算</button>
<p></p>
<div id="result"></div>
</div>
<p>-----------------------------------------------------------------------</p>
<div>
<h5>推算到某個等級需要多少經驗</h5>
<label for="input_2_1">請輸入目前總經驗(Experience):</label>
<input id="input_2_1" size="10" value="0">
<p></p>
<label for="input_2_2">請選擇目標階級</label>
<select id="input_2_2" name="reach_level" class="form-select">
<option value="0" id="0w" selected='true'>無</option>
<option value="1" id="1w">人類種</option>
<option value="5" id="5w">海棲種</option>
<option value="10" id="10w">獸人種</option>
<option value="20" id="20w">月詠種</option>
<option value="40" id="40w">吸血種</option>
<option value="70" id="70w">妖魔種</option>
<option value="100" id="100w">機凱種</option>
<option value="150" id="150w">妖精種</option>
<option value="200" id="200w">地精種</option>
<option value="250" id="250w">森精種</option>
<option value="350" id="350w">天翼種</option>
<option value="450" id="450w">巨人種</option>
<option value="550" id="550w">龍精種</option>
<option value="700" id="700w">精靈種</option>
<option value="850" id="850w">幻想種</option>
<option value="1000" id="1000w">神靈種</option>
<option value="10000" id="10000w">特圖</option>
</select>
<p></p>
<button id="btn_02" onclick="calc_level();">計算</button>
<p></p>
<div id="result_2"></div>
</div>
<p>-----------------------------------------------------------------------</p>
<div>
<h5>推算到某個等級需要多少經驗_2</h5>
<label for="input_3_1">請輸入目前等級(Level):</label>
<input id="input_3_1" size="10" value="0">
<p></p>
<label for="input_3_2">請輸入目前經驗(XP):</label>
<input id="input_3_2" size="10" value="0">
<p></p>
<label for="input_3_3">請選擇目標階級</label>
<select id="input_3_3" name="reach_level" class="form-select">
<option value="0" id="0w" selected='true'>無</option>
<option value="1" id="1w">人類種</option>
<option value="5" id="5w">海棲種</option>
<option value="10" id="10w">獸人種</option>
<option value="20" id="20w">月詠種</option>
<option value="40" id="40w">吸血種</option>
<option value="70" id="70w">妖魔種</option>
<option value="100" id="100w">機凱種</option>
<option value="150" id="150w">妖精種</option>
<option value="200" id="200w">地精種</option>
<option value="250" id="250w">森精種</option>
<option value="350" id="350w">天翼種</option>
<option value="450" id="450w">巨人種</option>
<option value="550" id="550w">龍精種</option>
<option value="700" id="700w">精靈種</option>
<option value="850" id="850w">幻想種</option>
<option value="1000" id="1000w">神靈種</option>
<option value="10000" id="10000w">特圖</option>
</select>
<p></p>
<button id="btn_03" onclick="calc_level_2();">計算</button>
<p></p>
<div id="result_3"></div>
</div>
</body>
<script type="text/javascript">
function checkzero(x,id) {
if (x < 0) {
document.getElementById(id).setAttribute("style","border-color: red");
alert("經驗值必須大於0!");
return 1;
} else if ((x % 1) != 0) {
document.getElementById(id).setAttribute("style","border-color: red");
alert("經驗值必須為數字!");
return 1;
} else {
document.getElementById(id).setAttribute("style","border-color: initial");
return 0;
}
}
function checkzero_lv(x,id) {
if (x < 0) {
document.getElementById(id).setAttribute("style","border-color: red");
alert("等級必須大於0!");
return 1;
} else if ((x % 1) != 0) {
document.getElementById(id).setAttribute("style","border-color: red");
alert("等級必須為數字!");
return 1;
} else {
document.getElementById(id).setAttribute("style","border-color: initial");
return 0;
}
}
function calc_xp(x) {
//計算下一級的等級
var y0 = 800*parseInt(x);
var y1 = y0+2500
var y2 = Math.sqrt(y1);
var y3 = y2-250;
var y4 = y3/200;
//y5 == next level
if((y4 % 1) == 0) {
//剛好升等
var y5 = y4 + 2;
} else if(y4 < 0) {
//LV小於1
var y5 = 1;
} else {
var y5 = Math.ceil(y4)+1;
}
return y5;
}
function calc_01(x) {
var ch = checkzero(x,"input_area");
if (ch == 0) {
var next_lv = calc_xp(x);
show_01(x,next_lv);
}
}
function show_01(x,lv) {
var next_level_xp = (100*Math.pow((lv-1),2)+250*(lv-1)+150)/2;
var result = next_level_xp - parseInt(x);
document.getElementById("result").innerHTML = "還需要 "+result+" 經驗值才升等級 "+lv+"。";
}
//-----------------------
function calc_level() {
var x = document.getElementById("input_2_1").value;
var target_lv = parseInt(document.getElementById("input_2_2").value);
var ch = checkzero(x,"input_2_1");
var now_lv = calc_xp(x) - 1;
if (ch == 0) {
if (target_lv > now_lv) {
document.getElementById("input_2_2").setAttribute("style","border-color: initial");
show_02(x,target_lv);
} else {
document.getElementById("input_2_2").setAttribute("style","border-color: red");
alert("目標階級錯誤!");
}
}
}
function show_02(x,target_lv) {
var name = document.getElementById(target_lv+'w').innerHTML;
var next_level_xp = (100*Math.pow((target_lv-1),2)+250*(target_lv-1)+150)/2;
var result = next_level_xp - parseInt(x);
document.getElementById("result_2").innerHTML = "還需要 "+result+" 經驗值才升 "+name+"。";
}
//--------------------------
function calc_level_2() {
var now_lv = document.getElementById("input_3_1").value;
var now_xp = document.getElementById("input_3_2").value;
var target_lv = parseInt(document.getElementById("input_3_3").value);
var ch = checkzero(now_xp,"input_3_2");
var ch_lv = checkzero_lv(now_lv,"input_3_1");
if (ch == 0) {
if (ch_lv == 0) {
if (target_lv > now_lv) {
document.getElementById("input_3_3").setAttribute("style","border-color: initial");
show_03(parseInt(now_lv),parseInt(now_xp),target_lv);
} else {
document.getElementById("input_3_3").setAttribute("style","border-color: red");
alert("目標階級錯誤!");
}
}
}
}
function show_03(now_lv,now_xp,target_lv) {
var total_xp = (100*Math.pow((now_lv-1),2)+250*(now_lv-1)+150)/2 + now_xp;
var name = document.getElementById(target_lv+'w').innerHTML;
var next_level_xp = (100*Math.pow((target_lv-1),2)+250*(target_lv-1)+150)/2;
var result = next_level_xp - total_xp;
document.getElementById("result_3").innerHTML = "還需要 "+result+" 經驗值才升 "+name+"。";
}
</script>
</html>