-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEngine.php
More file actions
56 lines (49 loc) · 1.37 KB
/
Copy pathEngine.php
File metadata and controls
56 lines (49 loc) · 1.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
<?php
class Engine extends Module
{
protected $power;
protected $fire_chance;
protected $type;
function __construct($properties)
{
foreach($properties as $key => $value){
if(property_exists(Engine, $key) || property_exists(Module, $key)){
$this->$key = $value;
}
}
parent::__construct($properties);
}
function toSql($tank_id)
{
$sql = "
INSERT IGNORE INTO `engines`
(tank_id, tier, name, price, xp_cost, weight,
power, fire_chance, type)
VALUES
({$tank_id}, {$this->tier}, '{$this->name}', {$this->price}, {$this->xp_cost}, {$this->weight},
{$this->power}, {$this->fire_chance}, '{$this->type}')
ON DUPLICATE KEY UPDATE
tier = {$this->tier},
price = {$this->price},
xp_cost = {$this->xp_cost},
weight = {$this->weight},
power = {$this->power},
fire_chance = {$this->fire_chance},
type = '{$this->type}'
";
return $sql;
}
function getPower()
{
return $this->power;
}
function getFireChance()
{
return $this->fire_chance;
}
function getType()
{
return $this->type;
}
}
?>