RuneScape II Combat Calculator
Door Nick Mulder, 22 jaar geleden, 7.238x bekeken
UPDATE: v2
Een PHP Script dat het combat lvl aan de hand van je RuneScape levels uitrekend... inclusief form.
De combat formule is gemaakt door Covey van Sythe.org.
Changelog:
v2:
*Herscript in een class (ruimte open voor uitbreiding)...
*Selecteerd automatisch type account...
*Kan afronden naar beneden, afronden op 2 decimalen of niet afronden...
*Valid XHTML Transitional...
*Valid CSS...
*Geen errors op error_reporting(E_ALL); ...
Voorbeeld: http://ypm-design.com/cb.php
Gesponsorde koppelingen
PHP script bestanden
Er zijn 23 reacties op 'Runescape ii combat calculator'
Gesponsorde koppelingen
Ik vind het heel leuk dat er scripts worden geplaatst.. maar voor spellen? Ten eerste heb je dit niet zelf gescript en is dat - neem ik aan - wel de bedoeling hier op PHPhulp. Ten tweede zie ik het nut niet echt in van dit script, want niemand snapt waarom er speciale waardes worden uitgerekend, dus het grootste deel van de bezoekers hier heeft er niks aan.
A. Meneer Covey heeft op Sythe.org alleen zijn formule gepost, de mensen opgedragen deze zelf maar tot een calculator te verwerken, deze formule was in VB.
Dus dan had je zoiets (kan zijn orginele post niet meer vinden):
B. Er zijn meerdere Runescape scripts hier te vinden... (zo ben ik hier ooit terecht gekomen)
Er zijn een stuk of 5.000.000 mensen die RuneScape Spelen wereldwijd...
Dus dan had je zoiets (kan zijn orginele post niet meer vinden):
B. Er zijn meerdere Runescape scripts hier te vinden... (zo ben ik hier ooit terecht gekomen)
Er zijn een stuk of 5.000.000 mensen die RuneScape Spelen wereldwijd...
Kwestie van JS uitschakelen en linkje uit de source kopieren.
KLIK!
snap nu ook meteen waarom alleen die twee resoluties ondersteund worden...
KLIK!
snap nu ook meteen waarom alleen die twee resoluties ondersteund worden...
Bovenstaand is een hele webpagina... als je hem in wilt voegen in je eigen pagina moet je het script aanpassen... Zie hieronder...
Handig om te hebben:
HTML/CSS Kennis
Een begin met PHP...
Sla je pagina op als een .php bestand, anders zal het niet werken...
Code voor invoegen (http://ypm-design.com/cb-insert.php):
Tussen <head></head>:
Tussen <body></body>:
Handig om te hebben:
HTML/CSS Kennis
Een begin met PHP...
Sla je pagina op als een .php bestand, anders zal het niet werken...
Code voor invoegen (http://ypm-design.com/cb-insert.php):
Tussen <head></head>:
Code (php)
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
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
<!--
Script by YPM Design - http://ypm-design.com
Combat Formula by Covey (Sythe.org) - http://sythe.org
License: GNU: General Public License (GPL)
-->
<style type="text/css">
.buttons2
{
/*Uiterlijk van de calculate button hier aanpassen*/
vertical-align: middle;
margin: 5px;
border: 1px solid #ffffff;
background: url(http://teampk.ypm-design.com/images/form.jpg) #333333;
font-size: 10pt; color:#FFFFFF;
height: 20px;
width: 125px;
text-align: inherit;
}
.lvl {
/*Uiterlijk van de input velden hier aanpassen*/
border: 1px solid #ffffff;
background: url(http://teampk.ypm-design.com/images/form.jpg);
font-size: 9pt; color:#FFFFFF;
}
.text {
/*Uiterlijk van de tekst hier aanpassen*/
font-family: Verdana;
font-size: 10px;
}
</style>
Script by YPM Design - http://ypm-design.com
Combat Formula by Covey (Sythe.org) - http://sythe.org
License: GNU: General Public License (GPL)
-->
<style type="text/css">
.buttons2
{
/*Uiterlijk van de calculate button hier aanpassen*/
vertical-align: middle;
margin: 5px;
border: 1px solid #ffffff;
background: url(http://teampk.ypm-design.com/images/form.jpg) #333333;
font-size: 10pt; color:#FFFFFF;
height: 20px;
width: 125px;
text-align: inherit;
}
.lvl {
/*Uiterlijk van de input velden hier aanpassen*/
border: 1px solid #ffffff;
background: url(http://teampk.ypm-design.com/images/form.jpg);
font-size: 9pt; color:#FFFFFF;
}
.text {
/*Uiterlijk van de tekst hier aanpassen*/
font-family: Verdana;
font-size: 10px;
}
</style>
Tussen <body></body>:
Code (php)
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
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
<form name="form1" method="post" action="<?=$_SERVER['PHP_SELF'];?>">
<div align="center">
<table width="125" border="0">
<tr>
<td><div align="left"><label class="text">Attack lvl:</label>
</div></td>
<td><input name="att" type="text" class="lvl" id="att" value="<?php if(isset($_POST['att'])) echo $_POST['att'];?>" size="5" maxlength="2" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">Strenght lvl:</label>
</div></td>
<td><input name="str" type="text" id="str" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['str'])) echo $_POST['str'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">Defence lvl:</label>
</div></td>
<td><input name="def" type="text" id="def" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['def'])) echo $_POST['def'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">HP lvl: </label>
</div></td>
<td><input name="hp" type="text" id="hp" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['hp'])) echo $_POST['hp'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">Magic lvl:</label>
</div></td>
<td><input name="mag" type="text" id="mag" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['mag'])) echo $_POST['mag'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">Prayer lvl:</label>
</div></td>
<td><input name="pray" type="text" id="pray" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['pray'])) echo $_POST['pray'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">Ranged lvl:</label>
</div></td>
<td><input name="ran" type="text" id="ran" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['ran'])) echo $_POST['ran'];?>" /></td>
</tr>
</table>
<br/>
</div>
<div align="center">
<label>
<input type="submit" name="Submit" value="Calculate" class="buttons2" />
</label>
</div>
</form>
<div align="center" class="text">
<?php
/*==============================================================*/
/* Combat Formula */
/*==============================================================*/
/*Made by: Covey */
/*URL: http://sythe.org */
/*==============================================================*/
/* License */
/*==============================================================*/
/*License: GNU: General Public License (GPL) */
/*==============================================================*/
/*=================Copyright © YPM Design 2007==================*/
/*==============================================================*/
//error_reporting
error_reporting(E_ALL);
//defineer $action
$action = "floor"; //actie, kan zijn: floor (naar beneden afronden (RuneScape gebruikt deze)) of round_2 (afronden op 2 decimalen)
class cb{
function cblvl($att, $def, $str, $hp, $pray, $ran, $mag, $action){
//bereken melee-based combat level
$ranged_cb = (0.483 * $ran + 0.249 * $def + 0.25 * $hp + 0.124 * $pray);
//bereken magic-based combat level
$magic_cb = (0.483 * $mag + 0.249 * $def + 0.25 * $hp + 0.124 * $pray);
//bereken ranged-based combat level
$warrior_cb = (0.32707 * $att + 0.249 * $def + 0.324 * $str + 0.25 * $hp + 0.124 * $pray);
//defineer account type
if($warrior_cb>=$magic_cb && $warrior_cb>=$ranged_cb){
//warrior
$cb = $warrior_cb;
}
elseif($magic_cb>$warrior_cb && $magic_cb>=$ranged_cb){
//mage
$cb = $magic_cb;
}
elseif($ranged_cb>$warrior_cb && $ranged_cb>$magic_cb){
//ranger
$cb = $ranged_cb;
}
if(!empty($cb)){//controleer of het een geldige uitkomst is
//verwerk $cb met $action
if($action == "floor"){
//naar beneden afronden (net als RuneScape doet)
echo "Combat lvl: ";
echo floor($cb);
}
elseif ($action == "round_2"){
//afronden op 2 decimalen
echo "Combat lvl: ";
echo round($cb, 2);
}
else{
//verander niks
echo "Combat lvl: ";
echo $cb;
}
}
}
}
if(
//controleer of alle gegevens zijn ingevuld
!empty($_POST['att']) &&
!empty($_POST['def']) &&
!empty($_POST['str']) &&
!empty($_POST['hp']) &&
!empty($_POST['pray']) &&
!empty($_POST['mag']) &&
!empty($_POST['ran'])
){
//zo ja, echo het combat lvl
$calc = new cb();
$calc->cblvl($_POST['att'], $_POST['def'], $_POST['str'], $_POST['hp'], $_POST['pray'], $_POST['mag'], $_POST['ran'], $action);
}
?>
</div>
<div align="center">
<table width="125" border="0">
<tr>
<td><div align="left"><label class="text">Attack lvl:</label>
</div></td>
<td><input name="att" type="text" class="lvl" id="att" value="<?php if(isset($_POST['att'])) echo $_POST['att'];?>" size="5" maxlength="2" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">Strenght lvl:</label>
</div></td>
<td><input name="str" type="text" id="str" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['str'])) echo $_POST['str'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">Defence lvl:</label>
</div></td>
<td><input name="def" type="text" id="def" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['def'])) echo $_POST['def'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">HP lvl: </label>
</div></td>
<td><input name="hp" type="text" id="hp" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['hp'])) echo $_POST['hp'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">Magic lvl:</label>
</div></td>
<td><input name="mag" type="text" id="mag" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['mag'])) echo $_POST['mag'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">Prayer lvl:</label>
</div></td>
<td><input name="pray" type="text" id="pray" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['pray'])) echo $_POST['pray'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label class="text">Ranged lvl:</label>
</div></td>
<td><input name="ran" type="text" id="ran" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['ran'])) echo $_POST['ran'];?>" /></td>
</tr>
</table>
<br/>
</div>
<div align="center">
<label>
<input type="submit" name="Submit" value="Calculate" class="buttons2" />
</label>
</div>
</form>
<div align="center" class="text">
<?php
/*==============================================================*/
/* Combat Formula */
/*==============================================================*/
/*Made by: Covey */
/*URL: http://sythe.org */
/*==============================================================*/
/* License */
/*==============================================================*/
/*License: GNU: General Public License (GPL) */
/*==============================================================*/
/*=================Copyright © YPM Design 2007==================*/
/*==============================================================*/
//error_reporting
error_reporting(E_ALL);
//defineer $action
$action = "floor"; //actie, kan zijn: floor (naar beneden afronden (RuneScape gebruikt deze)) of round_2 (afronden op 2 decimalen)
class cb{
function cblvl($att, $def, $str, $hp, $pray, $ran, $mag, $action){
//bereken melee-based combat level
$ranged_cb = (0.483 * $ran + 0.249 * $def + 0.25 * $hp + 0.124 * $pray);
//bereken magic-based combat level
$magic_cb = (0.483 * $mag + 0.249 * $def + 0.25 * $hp + 0.124 * $pray);
//bereken ranged-based combat level
$warrior_cb = (0.32707 * $att + 0.249 * $def + 0.324 * $str + 0.25 * $hp + 0.124 * $pray);
//defineer account type
if($warrior_cb>=$magic_cb && $warrior_cb>=$ranged_cb){
//warrior
$cb = $warrior_cb;
}
elseif($magic_cb>$warrior_cb && $magic_cb>=$ranged_cb){
//mage
$cb = $magic_cb;
}
elseif($ranged_cb>$warrior_cb && $ranged_cb>$magic_cb){
//ranger
$cb = $ranged_cb;
}
if(!empty($cb)){//controleer of het een geldige uitkomst is
//verwerk $cb met $action
if($action == "floor"){
//naar beneden afronden (net als RuneScape doet)
echo "Combat lvl: ";
echo floor($cb);
}
elseif ($action == "round_2"){
//afronden op 2 decimalen
echo "Combat lvl: ";
echo round($cb, 2);
}
else{
//verander niks
echo "Combat lvl: ";
echo $cb;
}
}
}
}
if(
//controleer of alle gegevens zijn ingevuld
!empty($_POST['att']) &&
!empty($_POST['def']) &&
!empty($_POST['str']) &&
!empty($_POST['hp']) &&
!empty($_POST['pray']) &&
!empty($_POST['mag']) &&
!empty($_POST['ran'])
){
//zo ja, echo het combat lvl
$calc = new cb();
$calc->cblvl($_POST['att'], $_POST['def'], $_POST['str'], $_POST['hp'], $_POST['pray'], $_POST['mag'], $_POST['ran'], $action);
}
?>
</div>
iets zegt mij dat warior en ranger omgewisseld zijn...
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?php
//bereken melee-based combat level
$ranged_cb = (0.483 * $ran + 0.249 * $def + 0.25 * $hp + 0.124 * $pray);
//bereken magic-based combat level
$magic_cb = (0.483 * $mag + 0.249 * $def + 0.25 * $hp + 0.124 * $pray);
//bereken ranged-based combat level
$warrior_cb = (0.32707 * $att + 0.249 * $def + 0.324
?>
//bereken melee-based combat level
$ranged_cb = (0.483 * $ran + 0.249 * $def + 0.25 * $hp + 0.124 * $pray);
//bereken magic-based combat level
$magic_cb = (0.483 * $mag + 0.249 * $def + 0.25 * $hp + 0.124 * $pray);
//bereken ranged-based combat level
$warrior_cb = (0.32707 * $att + 0.249 * $def + 0.324
?>
Ik heb de code een ietsje omgevormd zodat je er nu ook je cb mee kunt berekenen met Summoning :)
Code (php)
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
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>RuneScape II Combat Calculator</title>
<!--
Valid XHTML 1.0 Transitional/CSS
Script by YPM Design - http://ypm-design.com
Combat Formula by Covey (Sythe.org) - http://sythe.org
License: GNU: General Public License (GPL)
-->
<style type="text/css">
body {
background-image: url();
background-repeat: no-repeat;
background-color: #000000;
}
.style2 {color: #FF0000}
.buttons2
{
vertical-align: middle;
margin: 5px;
border: 1px solid #ffffff;
background: url(http://teampk.ypm-design.com/images/form.jpg) #333333;
font-size: 10pt; color:#FFFFFF;
height: 20px;
width: 125px;
text-align: inherit;
}
.lvl { border: 1px solid #ffffff;
background: url(http://teampk.ypm-design.com/images/form.jpg);
font-size: 9pt; color:#FFFFFF;
}
body,td,th {
color: #FFFFFF;
font-family: Verdana;
font-size: 10px;
}
a:link {
color: #CCCCCC;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #CCCCCC;
}
a:hover {
text-decoration: none;
color: #999999;
}
a:active {
text-decoration: none;
color: #999999;
}
</style>
</head>
<body>
<form name="form1" method="post" action="<?=$_SERVER['PHP_SELF'];?>">
<div align="center">
<table width="125" border="0">
<tr>
<td><div align="left"><label>Attack lvl:</label></div></td>
<td><input name="att" type="text" class="lvl" id="att" value="<?php if(isset($_POST['att'])) echo $_POST['att'];?>" size="5" maxlength="2" /></td>
</tr>
<tr>
<td><div align="left"><label>Strenght lvl:</label></div></td>
<td><input name="str" type="text" id="str" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['str'])) echo $_POST['str'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>Defence lvl:</label></div></td>
<td><input name="def" type="text" id="def" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['def'])) echo $_POST['def'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>HP lvl: </label></div></td>
<td><input name="hp" type="text" id="hp" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['hp'])) echo $_POST['hp'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>Magic lvl:</label></div></td>
<td><input name="mag" type="text" id="mag" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['mag'])) echo $_POST['mag'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>Prayer lvl:</label></div></td>
<td><input name="pray" type="text" id="pray" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['pray'])) echo $_POST['pray'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>Ranged lvl:</label></div></td>
<td><input name="ran" type="text" id="ran" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['ran'])) echo $_POST['ran'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>Summ lvl:</label></div></td>
<td><input name="sum" type="text" id="sum" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['sum'])) echo $_POST['sum'];?>" /></td>
</tr>
</table>
<br/>
</div>
<div align="center">
<label>
<input type="submit" name="Submit" value="Calculate" class="buttons2" />
</label>
</div>
</form>
<div align="center">
<?php
/*==============================================================*/
/* HTML/CSS */
/*==============================================================*/
/*Info: Valid XHTML 1.0 Transitional */
/*Made by: YPM Design - http://ypm-design.com */
/*==============================================================*/
/* Combat Formula */
/*==============================================================*/
/*Made by: Covey */
/*URL: http://sythe.org */
/*==============================================================*/
/* License */
/*==============================================================*/
/*License: GNU: General Public License (GPL) */
/*==============================================================*/
/*=================Copyright © YPM Design 2007==================*/
/*==============================================================*/
//error_reporting
error_reporting(E_ALL);
//defineer $action
$action = "floor"; //actie, kan zijn: floor (naar beneden afronden (RuneScape gebruikt deze)) of round_2 (afronden op 2 decimalen)
class cb{
function cblvl($att, $def, $str, $hp, $pray, $ran, $mag, $sum, $action){
//bereken melee-based combat level
$ranged_cb = (0.483 * $ran + 0.249 * $def + 0.25 * $hp + 0.124 * $pray + 0.125 * $sum);
//bereken magic-based combat level
$magic_cb = (0.483 * $mag + 0.249 * $def + 0.25 * $hp + 0.124 * $pray + 0.125 * $sum);
//bereken ranged-based combat level
$warrior_cb = (0.32707 * $att + 0.249 * $def + 0.324 * $str + 0.25 * $hp + 0.124 * $pray + 0.125 * $sum);
//defineer account type
if($warrior_cb>=$magic_cb && $warrior_cb>=$ranged_cb){
//warrior
$cb = $warrior_cb;
}
elseif($magic_cb>$warrior_cb && $magic_cb>=$ranged_cb){
//mage
$cb = $magic_cb;
}
elseif($ranged_cb>$warrior_cb && $ranged_cb>$magic_cb){
//ranger
$cb = $ranged_cb;
}
if(!empty($cb)){//controleer of het een geldige uitkomst is
//verwerk $cb met $action
if($action == "floor"){
//naar beneden afronden (net als RuneScape doet)
echo "Combat lvl: ";
echo floor($cb);
}
elseif ($action == "round_2"){
//afronden op 2 decimalen
echo "Combat lvl: ";
echo round($cb, 2);
}
else{
//verander niks
echo "Combat lvl: ";
echo $cb;
}
}
}
}
if(
//controleer of alle gegevens zijn ingevuld
!empty($_POST['att']) &&
!empty($_POST['def']) &&
!empty($_POST['str']) &&
!empty($_POST['hp']) &&
!empty($_POST['pray']) &&
!empty($_POST['mag']) &&
!empty($_POST['ran']) &&
!empty($_POST['sum'])
){
//zo ja, echo het combat lvl
$calc = new cb();
$calc->cblvl($_POST['att'], $_POST['def'], $_POST['str'], $_POST['hp'], $_POST['pray'], $_POST['mag'], $_POST['ran'], $_POST['sum'], $action);
}
?>
<p>
</p>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>RuneScape II Combat Calculator</title>
<!--
Valid XHTML 1.0 Transitional/CSS
Script by YPM Design - http://ypm-design.com
Combat Formula by Covey (Sythe.org) - http://sythe.org
License: GNU: General Public License (GPL)
-->
<style type="text/css">
body {
background-image: url();
background-repeat: no-repeat;
background-color: #000000;
}
.style2 {color: #FF0000}
.buttons2
{
vertical-align: middle;
margin: 5px;
border: 1px solid #ffffff;
background: url(http://teampk.ypm-design.com/images/form.jpg) #333333;
font-size: 10pt; color:#FFFFFF;
height: 20px;
width: 125px;
text-align: inherit;
}
.lvl { border: 1px solid #ffffff;
background: url(http://teampk.ypm-design.com/images/form.jpg);
font-size: 9pt; color:#FFFFFF;
}
body,td,th {
color: #FFFFFF;
font-family: Verdana;
font-size: 10px;
}
a:link {
color: #CCCCCC;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #CCCCCC;
}
a:hover {
text-decoration: none;
color: #999999;
}
a:active {
text-decoration: none;
color: #999999;
}
</style>
</head>
<body>
<form name="form1" method="post" action="<?=$_SERVER['PHP_SELF'];?>">
<div align="center">
<table width="125" border="0">
<tr>
<td><div align="left"><label>Attack lvl:</label></div></td>
<td><input name="att" type="text" class="lvl" id="att" value="<?php if(isset($_POST['att'])) echo $_POST['att'];?>" size="5" maxlength="2" /></td>
</tr>
<tr>
<td><div align="left"><label>Strenght lvl:</label></div></td>
<td><input name="str" type="text" id="str" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['str'])) echo $_POST['str'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>Defence lvl:</label></div></td>
<td><input name="def" type="text" id="def" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['def'])) echo $_POST['def'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>HP lvl: </label></div></td>
<td><input name="hp" type="text" id="hp" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['hp'])) echo $_POST['hp'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>Magic lvl:</label></div></td>
<td><input name="mag" type="text" id="mag" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['mag'])) echo $_POST['mag'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>Prayer lvl:</label></div></td>
<td><input name="pray" type="text" id="pray" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['pray'])) echo $_POST['pray'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>Ranged lvl:</label></div></td>
<td><input name="ran" type="text" id="ran" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['ran'])) echo $_POST['ran'];?>" /></td>
</tr>
<tr>
<td><div align="left"><label>Summ lvl:</label></div></td>
<td><input name="sum" type="text" id="sum" size="5" maxlength="2" class="lvl" value="<?php if(isset($_POST['sum'])) echo $_POST['sum'];?>" /></td>
</tr>
</table>
<br/>
</div>
<div align="center">
<label>
<input type="submit" name="Submit" value="Calculate" class="buttons2" />
</label>
</div>
</form>
<div align="center">
<?php
/*==============================================================*/
/* HTML/CSS */
/*==============================================================*/
/*Info: Valid XHTML 1.0 Transitional */
/*Made by: YPM Design - http://ypm-design.com */
/*==============================================================*/
/* Combat Formula */
/*==============================================================*/
/*Made by: Covey */
/*URL: http://sythe.org */
/*==============================================================*/
/* License */
/*==============================================================*/
/*License: GNU: General Public License (GPL) */
/*==============================================================*/
/*=================Copyright © YPM Design 2007==================*/
/*==============================================================*/
//error_reporting
error_reporting(E_ALL);
//defineer $action
$action = "floor"; //actie, kan zijn: floor (naar beneden afronden (RuneScape gebruikt deze)) of round_2 (afronden op 2 decimalen)
class cb{
function cblvl($att, $def, $str, $hp, $pray, $ran, $mag, $sum, $action){
//bereken melee-based combat level
$ranged_cb = (0.483 * $ran + 0.249 * $def + 0.25 * $hp + 0.124 * $pray + 0.125 * $sum);
//bereken magic-based combat level
$magic_cb = (0.483 * $mag + 0.249 * $def + 0.25 * $hp + 0.124 * $pray + 0.125 * $sum);
//bereken ranged-based combat level
$warrior_cb = (0.32707 * $att + 0.249 * $def + 0.324 * $str + 0.25 * $hp + 0.124 * $pray + 0.125 * $sum);
//defineer account type
if($warrior_cb>=$magic_cb && $warrior_cb>=$ranged_cb){
//warrior
$cb = $warrior_cb;
}
elseif($magic_cb>$warrior_cb && $magic_cb>=$ranged_cb){
//mage
$cb = $magic_cb;
}
elseif($ranged_cb>$warrior_cb && $ranged_cb>$magic_cb){
//ranger
$cb = $ranged_cb;
}
if(!empty($cb)){//controleer of het een geldige uitkomst is
//verwerk $cb met $action
if($action == "floor"){
//naar beneden afronden (net als RuneScape doet)
echo "Combat lvl: ";
echo floor($cb);
}
elseif ($action == "round_2"){
//afronden op 2 decimalen
echo "Combat lvl: ";
echo round($cb, 2);
}
else{
//verander niks
echo "Combat lvl: ";
echo $cb;
}
}
}
}
if(
//controleer of alle gegevens zijn ingevuld
!empty($_POST['att']) &&
!empty($_POST['def']) &&
!empty($_POST['str']) &&
!empty($_POST['hp']) &&
!empty($_POST['pray']) &&
!empty($_POST['mag']) &&
!empty($_POST['ran']) &&
!empty($_POST['sum'])
){
//zo ja, echo het combat lvl
$calc = new cb();
$calc->cblvl($_POST['att'], $_POST['def'], $_POST['str'], $_POST['hp'], $_POST['pray'], $_POST['mag'], $_POST['ran'], $_POST['sum'], $action);
}
?>
<p>
</p>
</div>
</body>
</html>
Om te reageren heb je een account nodig en je moet ingelogd zijn.
Inhoudsopgave
Labels
- Geen tags toegevoegd.
PHP hulp
0 seconden vanaf nu