forked from wille/relayawards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlightning.php
68 lines (48 loc) · 1.3 KB
/
lightning.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
<?php
require_once "abstract_level.php";
abstract class Lightning extends AbstractLevelAward {
public function get_name() {
return "Lightning " . $this->level;
}
public function get_icon() {
return "speed_" . $this->level . ".png";
}
public function get_description() {
return "Over " . $this->fraction . " MB/s";
}
public function is_granted($relay) {
$mb = pow(1024, 2) * $this->fraction;
return $relay->bandwidth >= $mb;
}
}
class Lightning1 extends Lightning {
public function __construct() {
parent::__construct(1, 1, 1);
}
}
class Lightning2 extends Lightning {
public function __construct() {
parent::__construct(2, 5, 2);
}
}
class Lightning3 extends Lightning {
public function __construct() {
parent::__construct(3, 10, 5);
}
}
class Lightning4 extends Lightning {
public function __construct() {
parent::__construct(4, 15, 10);
}
}
class Lightning5 extends Lightning {
public function __construct() {
parent::__construct(5, 25, 20);
}
}
class Lightning6 extends Lightning {
public function __construct() {
parent::__construct(6, 50, 30);
}
}
?>