|
1
|
|
|
<?php namespace GameScan\WoW\Entity\Player; |
|
2
|
|
|
|
|
3
|
|
|
trait Base |
|
4
|
|
|
{ |
|
5
|
|
|
abstract public function getEntityInformations(); |
|
6
|
|
|
abstract public function getHost(); |
|
7
|
|
|
abstract public function getRegion(); |
|
8
|
|
|
abstract protected function getApiRequest(); |
|
9
|
|
|
|
|
10
|
|
|
public function getLastModified() |
|
11
|
|
|
{ |
|
12
|
|
|
return $this->getEntityInformations()->lastInformation; |
|
13
|
|
|
} |
|
14
|
|
|
|
|
15
|
|
|
public function name() |
|
16
|
|
|
{ |
|
17
|
|
|
return $this->getEntityInformations()->name; |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
public function realm() |
|
21
|
|
|
{ |
|
22
|
|
|
return $this->getEntityInformations()->realm; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
public function playerClass() |
|
26
|
|
|
{ |
|
27
|
|
|
return $this->getEntityInformations()->class; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function playerClassName(array $className = null) |
|
31
|
|
|
{ |
|
32
|
|
|
if ($className === null) { |
|
33
|
|
|
$className = (new \GameScan\WoW\Entity\CharacterClass($this->getApiRequest()))->getClassesName(); |
|
34
|
|
|
} |
|
35
|
|
|
return $className[$this->playerClass()]; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function race() |
|
39
|
|
|
{ |
|
40
|
|
|
return $this->getEntityInformations()->race; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function gender() |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->getEntityInformations()->gender; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function level() |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->getEntityInformations()->level; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function achievementPoints() |
|
54
|
|
|
{ |
|
55
|
|
|
return $this->getEntityInformations()->achievementPoints; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
|
|
59
|
|
|
public function thumbnail() |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->getEntityInformations()->thumbnail; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function calcClass() |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->getEntityInformations()->calcClass; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function totalHonorableKills() |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->getEntityInformations()->totalHonorableKills; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function getAvatarUrl() |
|
75
|
|
|
{ |
|
76
|
|
|
$host = str_replace(".api", '', $this->getHost()); |
|
77
|
|
|
$region = $this->getRegion(); |
|
78
|
|
|
return $host . "static-render/" . $region . "/" . $this->thumbnail(); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function getProfileMainUrl() |
|
82
|
|
|
{ |
|
83
|
|
|
return str_replace("avatar", "profilemain", $this->getAvatarUrl()); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
|
|
87
|
|
|
public function getInsetUrl() |
|
88
|
|
|
{ |
|
89
|
|
|
return str_replace("avatar", "inset", $this->getAvatarUrl()); |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|