-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathskill.php
More file actions
46 lines (41 loc) · 1.37 KB
/
skill.php
File metadata and controls
46 lines (41 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
<?php
use MainModel as MainModel;
class Skill extends MainModel
{
public $id;
public $subject_id;
public $subject_type;
public $skill_type;
public $name;
public $skill_chance;
public $number_strikes;
public function __construct(Array $properties=array()) {
foreach($properties as $key => $value){
$this->{$key} = $value;
}
}
public function playerDetails($row, $id){
return (object) [
'id' => $row["id"],
'skill_type' => $row["skill_type"],
'name' => $row["name"],
'skill_chance' => $row["skill_chance"],
'number_strikes' => $row["number_strikes"],
'active' => $row["active"],
'subject_type' => $row["subject_type"],
'subject_id' => $row["subject_id"],
];
}
public function relation($id, $player){
$results = [];
foreach(parent::all() as $entry){
if ($entry->subject_id == $id && $entry->subject_type == $player){
if($entry->active == 0){
continue;
}
array_push($results, $entry);
}
}
return (object) $results;
}
}