-
Notifications
You must be signed in to change notification settings - Fork 0
/
材料转换计算.html
150 lines (145 loc) · 5.65 KB
/
材料转换计算.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <script src="./xlsx.core.min.js"></script>-->
<title>材料计算转换</title>
</head>
<body>
<h2>1.天赋计算</h2>
<h3>首先,输入你拥有的天赋书数量:</h3>
<h4>输入绿色天赋书本数</h4>
<input type="number" id="onehastianfu" placeholder="例如勤劳的教导">
<h4>输入蓝色天赋书本数</h4>
<input type="number" id="twohastianfu" placeholder="例如勤劳的指引">
<h4>输入紫色天赋书本数</h4>
<input type="number" id="threehastianfu" placeholder="例如勤劳的哲学">
<h3>然后,输入你需要的天赋书数量:</h3>
<h4>输入绿色天赋书本数</h4>
<input type="number" id="oneneedtianfu" placeholder="例如勤劳的教导">
<h4>输入蓝色天赋书本数</h4>
<input type="number" id="twoneedtianfu" placeholder="例如勤劳的指引">
<h4>输入紫色天赋书本数</h4>
<input type="number" id="threeneedtianfu" placeholder="例如勤劳的哲学">
<h3>最后,点击计算</h3>
<input type="button" onclick="tianfuCalculate()" value="计算">
<div id="resulttianfu">
</div>
<h2>2.材料计算</h2>
<h3>首先,输入你拥有的材料数量:</h3>
<h4>输入低级材料数量</h4>
<input type="number" id="onehascailiao" placeholder="例如骗骗花蜜">
<h4>输入中级材料数量</h4>
<input type="number" id="twohascailiao" placeholder="例如微光花蜜">
<h4>输入高级材料数量</h4>
<input type="number" id="threehascailiao" placeholder="例如原素花蜜">
<h3>然后,输入你需要的材料数量:</h3>
<h4>输入低级材料数量</h4>
<input type="number" id="oneneedcailiao" placeholder="例如骗骗花蜜">
<h4>输入中级材料数量</h4>
<input type="number" id="twoneedcailiao" placeholder="例如微光花蜜">
<h4>输入高级材料数量</h4>
<input type="number" id="threeneedcailiao" placeholder="例如原素花蜜">
<h3>最后,点击计算</h3>
<input type="button" onclick="cailiaoCalculate()" value="计算">
<div id="resultcailiao">
</div>
</body>
</html>
<script>
function tianfuCalculate() {
var onehas = document.getElementById("onehastianfu").value;
if (isNaN(parseInt(onehas))) {
onehas = 0;
} else {
onehas = parseInt(onehas);
}
var twohas = document.getElementById("twohastianfu").value;
if (isNaN(parseInt(twohas))) {
twohas = 0;
} else {
twohas = parseInt(twohas);
}
var threehas = document.getElementById("threehastianfu").value;
if (isNaN(parseInt(threehas))) {
threehas = 0;
} else {
threehas = parseInt(threehas);
}
var oneneed = document.getElementById("oneneedtianfu").value;
if (isNaN(parseInt(oneneed))) {
oneneed = 0;
} else {
oneneed = parseInt(oneneed);
}
var twoneed = document.getElementById("twoneedtianfu").value;
if (isNaN(parseInt(twoneed))) {
twoneed = 0;
} else {
twoneed = parseInt(twoneed);
}
var threeneed = document.getElementById("threeneedtianfu").value;
if (isNaN(parseInt(threeneed))) {
threeneed = 0;
} else {
threeneed = parseInt(threeneed);
}
var html = '';
var hassum = ((threehas) * 3 + (twohas)) * 3 + (onehas);
var needsum = ((threeneed) * 3 + (twoneed)) * 3 + (oneneed);
if (hassum > needsum) {
html = html + "你有足够的天赋书了!";
} else {
html = html + "你没有足够的天赋书!缺了绿色天赋书约<b>" + (parseInt(needsum) - parseInt(hassum)) + "</b>本";
}
document.getElementById("resulttianfu").innerHTML = html;
}
function cailiaoCalculate() {
var onehas = document.getElementById("onehascailiao").value;
if (isNaN(parseInt(onehas))) {
onehas = 0;
} else {
onehas = parseInt(onehas);
}
var twohas = document.getElementById("twohascailiao").value;
if (isNaN(parseInt(twohas))) {
twohas = 0;
} else {
twohas = parseInt(twohas);
}
var threehas = document.getElementById("threehascailiao").value;
if (isNaN(parseInt(threehas))) {
threehas = 0;
} else {
threehas = parseInt(threehas);
}
var oneneed = document.getElementById("oneneedcailiao").value;
if (isNaN(parseInt(oneneed))) {
oneneed = 0;
} else {
oneneed = parseInt(oneneed);
}
var twoneed = document.getElementById("twoneedcailiao").value;
if (isNaN(parseInt(twoneed))) {
twoneed = 0;
} else {
twoneed = parseInt(twoneed);
}
var threeneed = document.getElementById("threeneedcailiao").value;
if (isNaN(parseInt(threeneed))) {
threeneed = 0;
} else {
threeneed = parseInt(threeneed);
}
var html = '';
var hassum = ((threehas) * 3 + (twohas)) * 3 + (onehas);
var needsum = ((threeneed) * 3 + (twoneed)) * 3 + (oneneed);
if (hassum > needsum) {
html = html + "你有足够的材料了!";
} else {
html = html + "你没有足够的材料!缺了低级材料约<b>" + (parseInt(needsum) - parseInt(hassum)) + "</b>个";
}
document.getElementById("resultcailiao").innerHTML = html;
}
</script>