|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Kubinashi\BattlenetApi\WorldOfWarcraft\CharacterProfileApi\Service; |
|
4
|
|
|
|
|
5
|
|
|
use Kubinashi\BattlenetApi\WorldOfWarcraft\CharacterProfileApi\Model\Stat\BaseStatValueObject; |
|
6
|
|
|
use Kubinashi\BattlenetApi\WorldOfWarcraft\CharacterProfileApi\Model\Stat\DefensiveStatValueObject; |
|
7
|
|
|
use Kubinashi\BattlenetApi\WorldOfWarcraft\CharacterProfileApi\Model\Stat\OffensiveStatValueObject; |
|
8
|
|
|
use Kubinashi\BattlenetApi\WorldOfWarcraft\CharacterProfileApi\Model\Stat\SecondaryStatValueObject; |
|
9
|
|
|
use Kubinashi\BattlenetApi\WorldOfWarcraft\CharacterProfileApi\Model\Stat\StatValueObject; |
|
10
|
|
|
use Kubinashi\BattlenetApi\WorldOfWarcraft\CharacterProfileApi\Model\Stat\TertiaryStatValueObject; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @author Willy Reiche |
|
14
|
|
|
* @since 2017-08-26 |
|
15
|
|
|
* @version 1.0 |
|
16
|
|
|
*/ |
|
17
|
|
|
class StatService |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @param \StdClass $stats |
|
21
|
|
|
* @return StatValueObject |
|
22
|
|
|
*/ |
|
23
|
|
|
public function getStatValueObject($stats) |
|
24
|
|
|
{ |
|
25
|
|
|
$baseStats = $this->getBaseStatValueObject($stats); |
|
26
|
|
|
$secondaryStats = $this->getSecondaryStatValueObject($stats); |
|
27
|
|
|
$tertiaryStats = $this->getTertiaryStatValueObject($stats); |
|
28
|
|
|
$defensiveStats = $this->getDefensiveStatValueObject($stats); |
|
29
|
|
|
$offensiveStats = $this->getOffensiveStatValueObject($stats); |
|
30
|
|
|
|
|
31
|
|
|
return new StatValueObject( |
|
32
|
|
|
$baseStats, |
|
33
|
|
|
$secondaryStats, |
|
34
|
|
|
$tertiaryStats, |
|
35
|
|
|
$defensiveStats, |
|
36
|
|
|
$offensiveStats |
|
37
|
|
|
); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param \StdClass $stats |
|
42
|
|
|
* @return BaseStatValueObject |
|
43
|
|
|
*/ |
|
44
|
|
|
private function getBaseStatValueObject($stats) |
|
45
|
|
|
{ |
|
46
|
|
|
return new BaseStatValueObject( |
|
47
|
|
|
$stats->health, |
|
48
|
|
|
$stats->powerType, |
|
49
|
|
|
$stats->power, |
|
50
|
|
|
$stats->str, |
|
51
|
|
|
$stats->agi, |
|
52
|
|
|
$stats->int, |
|
53
|
|
|
$stats->sta |
|
54
|
|
|
); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @param \StdClass $stats |
|
59
|
|
|
* @return SecondaryStatValueObject |
|
60
|
|
|
*/ |
|
61
|
|
|
private function getSecondaryStatValueObject($stats) |
|
62
|
|
|
{ |
|
63
|
|
|
return new SecondaryStatValueObject( |
|
64
|
|
|
$stats->speedRating, |
|
65
|
|
|
$stats->speedRatingBonus, |
|
66
|
|
|
$stats->crit, |
|
67
|
|
|
$stats->critRating, |
|
68
|
|
|
$stats->haste, |
|
69
|
|
|
$stats->hasteRating, |
|
70
|
|
|
$stats->hasteRatingPercent, |
|
71
|
|
|
$stats->mastery, |
|
72
|
|
|
$stats->masteryRating |
|
73
|
|
|
); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @param \StdClass $stats |
|
78
|
|
|
* @return TertiaryStatValueObject |
|
79
|
|
|
*/ |
|
80
|
|
|
private function getTertiaryStatValueObject($stats) |
|
81
|
|
|
{ |
|
82
|
|
|
return new TertiaryStatValueObject( |
|
83
|
|
|
$stats->leechRating, |
|
84
|
|
|
$stats->leechRatingBonus, |
|
85
|
|
|
$stats->versatility, |
|
86
|
|
|
$stats->versatilityDamageDoneBonus, |
|
87
|
|
|
$stats->versatilityHealingDoneBonus, |
|
88
|
|
|
$stats->versatilityDamageTakenBonus, |
|
89
|
|
|
$stats->avoidanceRating, |
|
90
|
|
|
$stats->avoidanceRatingBonus, |
|
91
|
|
|
$stats->spellPen, |
|
92
|
|
|
$stats->spellCrit, |
|
93
|
|
|
$stats->spellCritRating, |
|
94
|
|
|
$stats->mana5, |
|
95
|
|
|
$stats->mana5Combat |
|
96
|
|
|
); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @param \StdClass $stats |
|
101
|
|
|
* @return DefensiveStatValueObject |
|
102
|
|
|
*/ |
|
103
|
|
|
private function getDefensiveStatValueObject($stats) |
|
104
|
|
|
{ |
|
105
|
|
|
return new DefensiveStatValueObject( |
|
106
|
|
|
$stats->armor, |
|
107
|
|
|
$stats->dodge, |
|
108
|
|
|
$stats->dodgeRating, |
|
109
|
|
|
$stats->parry, |
|
110
|
|
|
$stats->parryRating, |
|
111
|
|
|
$stats->block, |
|
112
|
|
|
$stats->blockRating |
|
113
|
|
|
); |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @param \StdClass $stats |
|
118
|
|
|
* @return OffensiveStatValueObject |
|
119
|
|
|
*/ |
|
120
|
|
|
private function getOffensiveStatValueObject($stats) |
|
121
|
|
|
{ |
|
122
|
|
|
return new OffensiveStatValueObject( |
|
123
|
|
|
$stats->mainHandDmgMin, |
|
124
|
|
|
$stats->mainHandDmgMax, |
|
125
|
|
|
$stats->mainHandSpeed, |
|
126
|
|
|
$stats->mainHandDps, |
|
127
|
|
|
$stats->offHandDmgMin, |
|
128
|
|
|
$stats->offHandDmgMax, |
|
129
|
|
|
$stats->offHandSpeed, |
|
130
|
|
|
$stats->offHandDps, |
|
131
|
|
|
$stats->rangedDmgMin, |
|
132
|
|
|
$stats->rangedDmgMax, |
|
133
|
|
|
$stats->rangedSpeed, |
|
134
|
|
|
$stats->rangedDps |
|
135
|
|
|
); |
|
136
|
|
|
} |
|
137
|
|
|
} |
|
138
|
|
|
|