1 | <?php |
||
10 | class Player extends Client |
||
11 | { |
||
12 | 3 | public function __construct($steamId) |
|
19 | |||
20 | public function GetSteamLevel() |
||
21 | { |
||
22 | // Set up the api details |
||
23 | $this->setApiDetails(__FUNCTION__, 'v0001'); |
||
24 | |||
25 | // Set up the arguments |
||
26 | $arguments = ['steamId' => $this->steamId]; |
||
27 | |||
28 | // Get the client |
||
29 | $client = $this->getServiceResponse($arguments); |
||
30 | |||
31 | return $client->player_level; |
||
32 | } |
||
33 | |||
34 | public function GetPlayerLevelDetails() |
||
35 | { |
||
36 | $details = $this->GetBadges(); |
||
37 | |||
38 | $details = new Level($details); |
||
39 | |||
40 | return $details; |
||
41 | } |
||
42 | |||
43 | public function GetBadges() |
||
44 | { |
||
45 | // Set up the api details |
||
46 | $this->setApiDetails(__FUNCTION__, 'v0001'); |
||
47 | |||
48 | // Set up the arguments |
||
49 | $arguments = ['steamId' => $this->steamId]; |
||
50 | |||
51 | // Get the client |
||
52 | $client = $this->getServiceResponse($arguments); |
||
53 | |||
54 | return $client; |
||
55 | } |
||
56 | |||
57 | 1 | public function GetCommunityBadgeProgress($badgeId = null) |
|
73 | |||
74 | 1 | public function GetOwnedGames($includeAppInfo = true, $includePlayedFreeGames = false, $appIdsFilter = []) |
|
75 | { |
||
76 | // Set up the api details |
||
77 | 1 | $this->setApiDetails(__FUNCTION__, 'v0001'); |
|
78 | |||
79 | // Set up the arguments |
||
80 | 1 | $arguments = ['steamId' => $this->steamId]; |
|
81 | 1 | if ($includeAppInfo) { |
|
82 | 1 | $arguments['include_appinfo'] = $includeAppInfo; |
|
83 | } |
||
84 | 1 | if ($includePlayedFreeGames) { |
|
85 | $arguments['include_played_free_games'] = $includePlayedFreeGames; |
||
86 | } |
||
87 | |||
88 | 1 | $appIdsFilter = (array) $appIdsFilter; |
|
89 | |||
90 | 1 | if (count($appIdsFilter) > 0) { |
|
91 | $arguments['appids_filter'] = $appIdsFilter; |
||
92 | } |
||
93 | |||
94 | // Get the client |
||
95 | 1 | $client = $this->getServiceResponse($arguments); |
|
96 | |||
97 | // Clean up the games |
||
98 | 1 | $games = $this->convertToObjects(isset($client->games) ? $client->games : []); |
|
99 | |||
100 | 1 | return $games; |
|
101 | } |
||
102 | |||
103 | public function GetRecentlyPlayedGames($count = null) |
||
104 | { |
||
105 | // Set up the api details |
||
106 | $this->setApiDetails(__FUNCTION__, 'v0001'); |
||
107 | |||
108 | // Set up the arguments |
||
109 | $arguments = ['steamId' => $this->steamId]; |
||
110 | if (! is_null($count)) { |
||
111 | $arguments['count'] = $count; |
||
112 | } |
||
113 | |||
114 | // Get the client |
||
115 | $client = $this->getServiceResponse($arguments); |
||
116 | |||
117 | if (isset($client->total_count) && $client->total_count > 0) { |
||
118 | // Clean up the games |
||
119 | $games = $this->convertToObjects($client->games); |
||
120 | |||
121 | return $games; |
||
122 | } |
||
123 | |||
124 | return null; |
||
125 | } |
||
126 | |||
127 | 1 | public function IsPlayingSharedGame($appIdPlaying) |
|
128 | { |
||
129 | // Set up the api details |
||
130 | 1 | $this->setApiDetails(__FUNCTION__, 'v0001'); |
|
131 | |||
132 | // Set up the arguments |
||
133 | $arguments = [ |
||
134 | 1 | 'steamId' => $this->steamId, |
|
135 | 1 | 'appid_playing' => $appIdPlaying, |
|
136 | ]; |
||
137 | |||
138 | // Get the client |
||
139 | 1 | $client = $this->getServiceResponse($arguments); |
|
140 | |||
141 | 1 | return $client->lender_steamid; |
|
142 | } |
||
143 | |||
144 | 1 | protected function convertToObjects($games) |
|
152 | |||
153 | 1 | private function convertGames($games) |
|
163 | } |
||
164 |