*/
class Profile
{
+ protected string $avatarDir;
+
public int $id;
public string $hwId;
public string $sessionId;
public string $created_at;
+ public function __construct()
+ {
+ $this->avatarDir = dirname(__FILE__) . '/../www/resources/avatars/';
+ }
+
public function complete(): bool
{
return $this->gamerTag !== null;
if (strpos($this->avatar, '://')) {
return $this->avatar;
}
+
+ if (file_exists($this->avatarDir . $this->avatar . '.large.jpg')) {
+ $ext = 'jpg';
+ } else {
+ $ext = 'png';
+ }
+
return 'http://l2.gamestickservices.net/resources/avatars/'
- . $this->avatar . '.large.jpg';
+ . $this->avatar . '.large.' . $ext;
}
public function getAvatarSmallUrl(): string
if (strpos($this->avatar, '://')) {
return $this->avatar;
}
+
+ if (file_exists($this->avatarDir . $this->avatar . '.small.jpg')) {
+ $ext = 'jpg';
+ } else {
+ $ext = 'png';
+ }
+
return 'http://l2.gamestickservices.net/resources/avatars/'
- . $this->avatar . '.small.jpg';
+ . $this->avatar . '.small.' . $ext;
}
}