runescape-ii-combat-calculator

Gesponsorde koppelingen

PHP script bestanden

  1. runescape-ii-combat-calculator

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<!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>
    </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, $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);
}

?>


<!--Valid HTML/CSS Logo-->
<!--You can remove this if you want to-->
  <p>
    <a href="http://validator.w3.org/check?uri=referer"><img
        src="http://www.w3.org/Icons/valid-xhtml10"
        alt="Valid XHTML 1.0 Transitional" height="31" width="88" border="0" /></a>
    <a href="http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fypm-design.com/cb.php">
  <img style="border:0;width:88px;height:31px"
       src="http://jigsaw.w3.org/css-validator/images/vcss"
       alt="Valid CSS!" />
    </a>

  </p>
</div>
</body>
</html>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.