@@ -167,7 +167,7 @@ |
||
| 167 | 167 | */ |
| 168 | 168 | public function getTagsAttribute(): array |
| 169 | 169 | { |
| 170 | - return array_filter(explode(';', $this->attributes['tags']), function ($element) { |
|
| 170 | + return array_filter(explode(';', $this->attributes['tags']), function($element) { |
|
| 171 | 171 | return !empty($element); |
| 172 | 172 | }); |
| 173 | 173 | } |
@@ -1,76 +1,76 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | -use Illuminate\Database\Eloquent\Model; |
|
| 6 | -use Illuminate\Support\Facades\Config; |
|
| 7 | -use Sofa\Eloquence\Eloquence; |
|
| 8 | -use Sofa\Eloquence\Mappable; |
|
| 5 | + use Illuminate\Database\Eloquent\Model; |
|
| 6 | + use Illuminate\Support\Facades\Config; |
|
| 7 | + use Sofa\Eloquence\Eloquence; |
|
| 8 | + use Sofa\Eloquence\Mappable; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Class Room. |
| 12 | 12 | * |
| 13 | 13 | * @property int id |
| 14 | 14 | */ |
| 15 | -class Room extends Model |
|
| 16 | -{ |
|
| 17 | - use Eloquence, Mappable; |
|
| 15 | + class Room extends Model |
|
| 16 | + { |
|
| 17 | + use Eloquence, Mappable; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 19 | + /** |
|
| 20 | 20 | * Disable Timestamps. |
| 21 | 21 | * |
| 22 | 22 | * @var bool |
| 23 | 23 | */ |
| 24 | - public $timestamps = false; |
|
| 24 | + public $timestamps = false; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | + /** |
|
| 27 | 27 | * Leader Board Rank. |
| 28 | 28 | * |
| 29 | 29 | * @var int |
| 30 | 30 | */ |
| 31 | - public $leaderboardRank = 1; |
|
| 31 | + public $leaderboardRank = 1; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | + /** |
|
| 34 | 34 | * The table associated with the model. |
| 35 | 35 | * |
| 36 | 36 | * @var string |
| 37 | 37 | */ |
| 38 | - protected $table = 'rooms'; |
|
| 38 | + protected $table = 'rooms'; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | + /** |
|
| 41 | 41 | * Primary Key of the Table. |
| 42 | 42 | * |
| 43 | 43 | * @var string |
| 44 | 44 | */ |
| 45 | - protected $primaryKey = 'id'; |
|
| 45 | + protected $primaryKey = 'id'; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | + /** |
|
| 48 | 48 | * The attributes that will be mapped. |
| 49 | 49 | * |
| 50 | 50 | * @var array |
| 51 | 51 | */ |
| 52 | - protected $maps = ['uniqueId' => 'id', 'ownerName' => 'owner_name', 'ownerUniqueId' => 'owner_id', 'doorMode' => 'state', |
|
| 53 | - 'leaderboardValue' => 'score', 'maximumVisitors' => 'users_max', 'habboGroupId' => 'guild_id', 'rating' => 'score', ]; |
|
| 52 | + protected $maps = ['uniqueId' => 'id', 'ownerName' => 'owner_name', 'ownerUniqueId' => 'owner_id', 'doorMode' => 'state', |
|
| 53 | + 'leaderboardValue' => 'score', 'maximumVisitors' => 'users_max', 'habboGroupId' => 'guild_id', 'rating' => 'score', ]; |
|
| 54 | 54 | |
| 55 | - /** |
|
| 55 | + /** |
|
| 56 | 56 | * The Appender(s) of the Model. |
| 57 | 57 | * |
| 58 | 58 | * @var array |
| 59 | 59 | */ |
| 60 | - protected $appends = ['uniqueId', 'leaderboardRank', 'thumbnailUrl', 'imageUrl', 'leaderboardValue', 'doorMode', 'maximumVisitors', |
|
| 61 | - 'publicRoom', 'ownerUniqueId', 'ownerName', 'showOwnerName', 'categories', 'rating', ]; |
|
| 60 | + protected $appends = ['uniqueId', 'leaderboardRank', 'thumbnailUrl', 'imageUrl', 'leaderboardValue', 'doorMode', 'maximumVisitors', |
|
| 61 | + 'publicRoom', 'ownerUniqueId', 'ownerName', 'showOwnerName', 'categories', 'rating', ]; |
|
| 62 | 62 | |
| 63 | - /** |
|
| 63 | + /** |
|
| 64 | 64 | * The attributes excluded from the model's JSON form. |
| 65 | 65 | * |
| 66 | 66 | * @var array |
| 67 | 67 | */ |
| 68 | - protected $hidden = ['owner_name', 'owner_id', 'is_public', 'state', 'password', 'model', 'users', 'users_max', 'guild_id', 'category', 'score', 'paper_floor', 'paper_wall', |
|
| 69 | - 'paper_landscape', 'thickness_wall', 'wall_height', 'thickness_floor', 'moodlight_data', 'is_staff_picked', 'allow_other_pets', 'allow_other_pets_eat', 'allow_walkthrough', |
|
| 70 | - 'allow_hidewall', 'chat_mode', 'chat_weight', 'chat_speed', 'chat_hearing_distance', 'chat_protection', 'override_model', 'who_can_mute', 'who_can_kick', 'who_can_ban', 'poll_id', |
|
| 71 | - 'roller_speed', 'promoted', 'trade_mode', 'move_diagonally', ]; |
|
| 68 | + protected $hidden = ['owner_name', 'owner_id', 'is_public', 'state', 'password', 'model', 'users', 'users_max', 'guild_id', 'category', 'score', 'paper_floor', 'paper_wall', |
|
| 69 | + 'paper_landscape', 'thickness_wall', 'wall_height', 'thickness_floor', 'moodlight_data', 'is_staff_picked', 'allow_other_pets', 'allow_other_pets_eat', 'allow_walkthrough', |
|
| 70 | + 'allow_hidewall', 'chat_mode', 'chat_weight', 'chat_speed', 'chat_hearing_distance', 'chat_protection', 'override_model', 'who_can_mute', 'who_can_kick', 'who_can_ban', 'poll_id', |
|
| 71 | + 'roller_speed', 'promoted', 'trade_mode', 'move_diagonally', ]; |
|
| 72 | 72 | |
| 73 | - /** |
|
| 73 | + /** |
|
| 74 | 74 | * Stores a new Room. |
| 75 | 75 | * |
| 76 | 76 | * @param string $roomName |
@@ -86,112 +86,112 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return Room |
| 88 | 88 | */ |
| 89 | - public function store(string $roomName, string $description, string $model, int $maxUsers, int $roomCategory, int $floorPaper, int $wallPaper, float $landscapePaper, int $ownerId, string $ownerName) |
|
| 90 | - { |
|
| 91 | - $this->attributes['name'] = $roomName; |
|
| 92 | - $this->attributes['description'] = $description; |
|
| 93 | - $this->attributes['model'] = $model; |
|
| 94 | - $this->attributes['users_max'] = $maxUsers; |
|
| 95 | - $this->attributes['category'] = $roomCategory; |
|
| 96 | - $this->attributes['paper_floor'] = $floorPaper; |
|
| 97 | - $this->attributes['paper_wall'] = $wallPaper; |
|
| 98 | - $this->attributes['paper_landscape'] = $landscapePaper; |
|
| 99 | - $this->attributes['thickness_wall'] = 0; |
|
| 100 | - $this->attributes['wall_height'] = -1; |
|
| 101 | - $this->attributes['thickness_floor'] = 0; |
|
| 102 | - $this->attributes['owner_id'] = $ownerId; |
|
| 103 | - $this->attributes['owner_name'] = $ownerName; |
|
| 104 | - |
|
| 105 | - $this->save(); |
|
| 106 | - |
|
| 107 | - return $this; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - /** |
|
| 89 | + public function store(string $roomName, string $description, string $model, int $maxUsers, int $roomCategory, int $floorPaper, int $wallPaper, float $landscapePaper, int $ownerId, string $ownerName) |
|
| 90 | + { |
|
| 91 | + $this->attributes['name'] = $roomName; |
|
| 92 | + $this->attributes['description'] = $description; |
|
| 93 | + $this->attributes['model'] = $model; |
|
| 94 | + $this->attributes['users_max'] = $maxUsers; |
|
| 95 | + $this->attributes['category'] = $roomCategory; |
|
| 96 | + $this->attributes['paper_floor'] = $floorPaper; |
|
| 97 | + $this->attributes['paper_wall'] = $wallPaper; |
|
| 98 | + $this->attributes['paper_landscape'] = $landscapePaper; |
|
| 99 | + $this->attributes['thickness_wall'] = 0; |
|
| 100 | + $this->attributes['wall_height'] = -1; |
|
| 101 | + $this->attributes['thickness_floor'] = 0; |
|
| 102 | + $this->attributes['owner_id'] = $ownerId; |
|
| 103 | + $this->attributes['owner_name'] = $ownerName; |
|
| 104 | + |
|
| 105 | + $this->save(); |
|
| 106 | + |
|
| 107 | + return $this; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | 111 | * Get Room Tags. |
| 112 | 112 | * |
| 113 | 113 | * @return array |
| 114 | 114 | */ |
| 115 | - public function getTagsAttribute(): array |
|
| 116 | - { |
|
| 117 | - return array_filter(explode(';', $this->attributes['tags']), function ($element) { |
|
| 118 | - return !empty($element); |
|
| 119 | - }); |
|
| 120 | - } |
|
| 115 | + public function getTagsAttribute(): array |
|
| 116 | + { |
|
| 117 | + return array_filter(explode(';', $this->attributes['tags']), function ($element) { |
|
| 118 | + return !empty($element); |
|
| 119 | + }); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - /** |
|
| 122 | + /** |
|
| 123 | 123 | * Get Image Url. |
| 124 | 124 | * |
| 125 | 125 | * @TODO: Get Real Full Room Image |
| 126 | 126 | * |
| 127 | 127 | * @return string |
| 128 | 128 | */ |
| 129 | - public function getImageUrlAttribute(): string |
|
| 130 | - { |
|
| 131 | - return "//arcturus.wf/full_{$this->attributes['id']}.png"; |
|
| 132 | - } |
|
| 129 | + public function getImageUrlAttribute(): string |
|
| 130 | + { |
|
| 131 | + return "//arcturus.wf/full_{$this->attributes['id']}.png"; |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | - /** |
|
| 134 | + /** |
|
| 135 | 135 | * Get Thumbnail Url. |
| 136 | 136 | * |
| 137 | 137 | * @return string |
| 138 | 138 | */ |
| 139 | - public function getThumbnailUrlAttribute(): string |
|
| 140 | - { |
|
| 141 | - $userName = Config::get('chocolatey.arcturus'); |
|
| 139 | + public function getThumbnailUrlAttribute(): string |
|
| 140 | + { |
|
| 141 | + $userName = Config::get('chocolatey.arcturus'); |
|
| 142 | 142 | |
| 143 | - return "//arcturus.wf/camera/{$userName}/thumbnail_{$this->attributes['id']}.png"; |
|
| 144 | - } |
|
| 143 | + return "//arcturus.wf/camera/{$userName}/thumbnail_{$this->attributes['id']}.png"; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - /** |
|
| 146 | + /** |
|
| 147 | 147 | * Return if need show Owner Name. |
| 148 | 148 | * |
| 149 | 149 | * @TODO: What this really does? |
| 150 | 150 | * |
| 151 | 151 | * @return bool |
| 152 | 152 | */ |
| 153 | - public function getShowOwnerNameAttribute(): bool |
|
| 154 | - { |
|
| 155 | - return true; |
|
| 156 | - } |
|
| 153 | + public function getShowOwnerNameAttribute(): bool |
|
| 154 | + { |
|
| 155 | + return true; |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | - /** |
|
| 158 | + /** |
|
| 159 | 159 | * Set a Leader Board Position. |
| 160 | 160 | * |
| 161 | 161 | * @param int $roomPosition |
| 162 | 162 | */ |
| 163 | - public function setLeaderBoardRankAttribute(int $roomPosition = 1) |
|
| 164 | - { |
|
| 165 | - $this->leaderboardRank = $roomPosition; |
|
| 166 | - } |
|
| 163 | + public function setLeaderBoardRankAttribute(int $roomPosition = 1) |
|
| 164 | + { |
|
| 165 | + $this->leaderboardRank = $roomPosition; |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - /** |
|
| 168 | + /** |
|
| 169 | 169 | * Get Leader Board Rank. |
| 170 | 170 | * |
| 171 | 171 | * @return int |
| 172 | 172 | */ |
| 173 | - public function getLeaderBoardRankAttribute(): int |
|
| 174 | - { |
|
| 175 | - return $this->leaderboardRank; |
|
| 176 | - } |
|
| 173 | + public function getLeaderBoardRankAttribute(): int |
|
| 174 | + { |
|
| 175 | + return $this->leaderboardRank; |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - /** |
|
| 178 | + /** |
|
| 179 | 179 | * Get if the Room is Public. |
| 180 | 180 | * |
| 181 | 181 | * @return bool |
| 182 | 182 | */ |
| 183 | - public function getPublicRoomAttribute(): bool |
|
| 184 | - { |
|
| 185 | - return $this->attributes['is_public'] == 1; |
|
| 186 | - } |
|
| 183 | + public function getPublicRoomAttribute(): bool |
|
| 184 | + { |
|
| 185 | + return $this->attributes['is_public'] == 1; |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | - /** |
|
| 188 | + /** |
|
| 189 | 189 | * Get Room Category. |
| 190 | 190 | * |
| 191 | 191 | * @return array |
| 192 | 192 | */ |
| 193 | - public function getCategoriesAttribute(): array |
|
| 194 | - { |
|
| 195 | - return [str_replace('}', '', str_replace('${', '', FlatCat::find($this->attributes['category'])))]; |
|
| 196 | - } |
|
| 193 | + public function getCategoriesAttribute(): array |
|
| 194 | + { |
|
| 195 | + return [str_replace('}', '', str_replace('${', '', FlatCat::find($this->attributes['category'])))]; |
|
| 196 | + } |
|
| 197 | 197 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | { |
| 346 | 346 | $accountCreated = $this->attributes['account_created'] ?? time(); |
| 347 | 347 | |
| 348 | - return date('Y-m-d', $accountCreated).'T'.date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
| 348 | + return date('Y-m-d', $accountCreated) . 'T' . date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | /** |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | { |
| 358 | 358 | $accountCreated = $this->attributes['account_created'] ?? time(); |
| 359 | 359 | |
| 360 | - return date('Y-m-d', $accountCreated).'T'.date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
| 360 | + return date('Y-m-d', $accountCreated) . 'T' . date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | { |
| 380 | 380 | $lastLogin = $this->attributes['last_login'] ?? time(); |
| 381 | 381 | |
| 382 | - return date('Y-m-d', $lastLogin).'T'.date('H:i:s.ZZZZ+ZZZZ', $lastLogin); |
|
| 382 | + return date('Y-m-d', $lastLogin) . 'T' . date('H:i:s.ZZZZ+ZZZZ', $lastLogin); |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | /** |
@@ -1,15 +1,15 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | -use Illuminate\Auth\Authenticatable; |
|
| 6 | -use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; |
|
| 7 | -use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; |
|
| 8 | -use Illuminate\Database\Eloquent\Model; |
|
| 9 | -use Illuminate\Support\Facades\Config; |
|
| 10 | -use Laravel\Lumen\Auth\Authorizable; |
|
| 11 | -use Sofa\Eloquence\Eloquence; |
|
| 12 | -use Sofa\Eloquence\Mappable; |
|
| 5 | + use Illuminate\Auth\Authenticatable; |
|
| 6 | + use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; |
|
| 7 | + use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; |
|
| 8 | + use Illuminate\Database\Eloquent\Model; |
|
| 9 | + use Illuminate\Support\Facades\Config; |
|
| 10 | + use Laravel\Lumen\Auth\Authorizable; |
|
| 11 | + use Sofa\Eloquence\Eloquence; |
|
| 12 | + use Sofa\Eloquence\Mappable; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Class User. |
@@ -20,77 +20,77 @@ discard block |
||
| 20 | 20 | * @property string name |
| 21 | 21 | * @property string motto |
| 22 | 22 | */ |
| 23 | -class User extends Model implements AuthenticatableContract, AuthorizableContract |
|
| 24 | -{ |
|
| 25 | - use Authenticatable, Authorizable, Eloquence, Mappable; |
|
| 23 | + class User extends Model implements AuthenticatableContract, AuthorizableContract |
|
| 24 | + { |
|
| 25 | + use Authenticatable, Authorizable, Eloquence, Mappable; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | + /** |
|
| 28 | 28 | * Disable Timestamps. |
| 29 | 29 | * |
| 30 | 30 | * @var bool |
| 31 | 31 | */ |
| 32 | - public $timestamps = false; |
|
| 32 | + public $timestamps = false; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | + /** |
|
| 35 | 35 | * User Traits. |
| 36 | 36 | * |
| 37 | 37 | * @var array |
| 38 | 38 | */ |
| 39 | - public $traits = ['USER']; |
|
| 39 | + public $traits = ['USER']; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | + /** |
|
| 42 | 42 | * The table associated with the model. |
| 43 | 43 | * |
| 44 | 44 | * @var string |
| 45 | 45 | */ |
| 46 | - protected $table = 'users'; |
|
| 46 | + protected $table = 'users'; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | + /** |
|
| 49 | 49 | * Primary Key of the Table. |
| 50 | 50 | * |
| 51 | 51 | * @var string |
| 52 | 52 | */ |
| 53 | - protected $primaryKey = 'id'; |
|
| 53 | + protected $primaryKey = 'id'; |
|
| 54 | 54 | |
| 55 | - /** |
|
| 55 | + /** |
|
| 56 | 56 | * The attributes that will be mapped. |
| 57 | 57 | * |
| 58 | 58 | * @var array |
| 59 | 59 | */ |
| 60 | - protected $maps = ['uniqueId' => 'id', 'name' => 'username', 'figureString' => 'look', 'lastWebAccess' => 'last_login', 'creationTime' => 'account_created', 'email' => 'mail', 'identityId' => 'id', 'accountId' => 'id']; |
|
| 60 | + protected $maps = ['uniqueId' => 'id', 'name' => 'username', 'figureString' => 'look', 'lastWebAccess' => 'last_login', 'creationTime' => 'account_created', 'email' => 'mail', 'identityId' => 'id', 'accountId' => 'id']; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | + /** |
|
| 63 | 63 | * The Appender(s) of the Model. |
| 64 | 64 | * |
| 65 | 65 | * @var array |
| 66 | 66 | */ |
| 67 | - protected $appends = ['habboClubMember', 'buildersClubMember', 'sessionLoginId', 'loginLogId', 'identityVerified', 'identityType', 'trusted', 'country', 'traits', |
|
| 68 | - 'uniqueId', 'name', 'figureString', 'lastWebAccess', 'creationTime', 'email', 'identityId', 'emailVerified', 'accountId', 'memberSince', 'isBanned', 'banDetails', 'isStaff', ]; |
|
| 67 | + protected $appends = ['habboClubMember', 'buildersClubMember', 'sessionLoginId', 'loginLogId', 'identityVerified', 'identityType', 'trusted', 'country', 'traits', |
|
| 68 | + 'uniqueId', 'name', 'figureString', 'lastWebAccess', 'creationTime', 'email', 'identityId', 'emailVerified', 'accountId', 'memberSince', 'isBanned', 'banDetails', 'isStaff', ]; |
|
| 69 | 69 | |
| 70 | - /** |
|
| 70 | + /** |
|
| 71 | 71 | * The attributes that are mass assignable. |
| 72 | 72 | * |
| 73 | 73 | * @var array |
| 74 | 74 | */ |
| 75 | - protected $fillable = ['mail', 'id', 'username', 'auth_ticket', 'last_login', 'ip_current', 'ip_register', 'mail_verified', 'account_day_of_birth', |
|
| 76 | - 'real_name', 'look', 'gender', 'credits', 'pixels', 'home_room', ]; |
|
| 75 | + protected $fillable = ['mail', 'id', 'username', 'auth_ticket', 'last_login', 'ip_current', 'ip_register', 'mail_verified', 'account_day_of_birth', |
|
| 76 | + 'real_name', 'look', 'gender', 'credits', 'pixels', 'home_room', ]; |
|
| 77 | 77 | |
| 78 | - /** |
|
| 78 | + /** |
|
| 79 | 79 | * The attributes excluded from the model's JSON form. |
| 80 | 80 | * |
| 81 | 81 | * @var array |
| 82 | 82 | */ |
| 83 | - protected $hidden = ['id', 'username', 'mail', 'account_created', 'password', 'mail_verified', 'real_name', 'account_day_of_birth', |
|
| 84 | - 'last_online', 'last_login', 'ip_register', 'auth_ticket', 'home_room', 'points', 'look', 'ip_current', 'online', 'pixels', 'credits', 'gender', 'points', 'rank', ]; |
|
| 83 | + protected $hidden = ['id', 'username', 'mail', 'account_created', 'password', 'mail_verified', 'real_name', 'account_day_of_birth', |
|
| 84 | + 'last_online', 'last_login', 'ip_register', 'auth_ticket', 'home_room', 'points', 'look', 'ip_current', 'online', 'pixels', 'credits', 'gender', 'points', 'rank', ]; |
|
| 85 | 85 | |
| 86 | - /** |
|
| 86 | + /** |
|
| 87 | 87 | * The attributes that should be casted to native types. |
| 88 | 88 | * |
| 89 | 89 | * @var array |
| 90 | 90 | */ |
| 91 | - protected $casts = ['traits' => 'string']; |
|
| 91 | + protected $casts = ['traits' => 'string']; |
|
| 92 | 92 | |
| 93 | - /** |
|
| 93 | + /** |
|
| 94 | 94 | * Store an User on the Database. |
| 95 | 95 | * |
| 96 | 96 | * @param string $username |
@@ -100,158 +100,158 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @return User |
| 102 | 102 | */ |
| 103 | - public function store(string $username, string $email, string $address = '', bool $newUser = true): User |
|
| 104 | - { |
|
| 105 | - $this->attributes['username'] = $username; |
|
| 106 | - $this->attributes['mail'] = $email; |
|
| 103 | + public function store(string $username, string $email, string $address = '', bool $newUser = true): User |
|
| 104 | + { |
|
| 105 | + $this->attributes['username'] = $username; |
|
| 106 | + $this->attributes['mail'] = $email; |
|
| 107 | 107 | |
| 108 | - $this->attributes['motto'] = Config::get('chocolatey.motto'); |
|
| 109 | - $this->attributes['look'] = Config::get('chocolatey.figure'); |
|
| 110 | - $this->attributes['auth_ticket'] = ''; |
|
| 108 | + $this->attributes['motto'] = Config::get('chocolatey.motto'); |
|
| 109 | + $this->attributes['look'] = Config::get('chocolatey.figure'); |
|
| 110 | + $this->attributes['auth_ticket'] = ''; |
|
| 111 | 111 | |
| 112 | - $this->attributes['password'] = hash(Config::get('chocolatey.security.hash'), openssl_random_pseudo_bytes(50)); |
|
| 113 | - $this->attributes['account_created'] = time(); |
|
| 112 | + $this->attributes['password'] = hash(Config::get('chocolatey.security.hash'), openssl_random_pseudo_bytes(50)); |
|
| 113 | + $this->attributes['account_created'] = time(); |
|
| 114 | 114 | |
| 115 | - $this->attributes['ip_current'] = $address; |
|
| 115 | + $this->attributes['ip_current'] = $address; |
|
| 116 | 116 | |
| 117 | - $this->traits = $newUser ? ['NEW_USER', 'USER'] : ['USER']; |
|
| 117 | + $this->traits = $newUser ? ['NEW_USER', 'USER'] : ['USER']; |
|
| 118 | 118 | |
| 119 | - $this->save(); |
|
| 120 | - $this->createData(); |
|
| 119 | + $this->save(); |
|
| 120 | + $this->createData(); |
|
| 121 | 121 | |
| 122 | - return $this; |
|
| 123 | - } |
|
| 122 | + return $this; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - /** |
|
| 125 | + /** |
|
| 126 | 126 | * Store an User Alias Set on Database. |
| 127 | 127 | */ |
| 128 | - public function createData() |
|
| 129 | - { |
|
| 130 | - (new UserPreferences())->store($this->attributes['id']); |
|
| 131 | - } |
|
| 128 | + public function createData() |
|
| 129 | + { |
|
| 130 | + (new UserPreferences())->store($this->attributes['id']); |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - /** |
|
| 133 | + /** |
|
| 134 | 134 | * Get Is User is Banned. |
| 135 | 135 | * |
| 136 | 136 | * @return bool |
| 137 | 137 | */ |
| 138 | - public function getIsBannedAttribute(): bool |
|
| 139 | - { |
|
| 140 | - return Ban::where('user_id', $this->attributes['id'])->first() !== null; |
|
| 141 | - } |
|
| 138 | + public function getIsBannedAttribute(): bool |
|
| 139 | + { |
|
| 140 | + return Ban::where('user_id', $this->attributes['id'])->first() !== null; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - /** |
|
| 143 | + /** |
|
| 144 | 144 | * Check if Is Staff. |
| 145 | 145 | * |
| 146 | 146 | * @return bool |
| 147 | 147 | */ |
| 148 | - public function getIsStaffAttribute(): bool |
|
| 149 | - { |
|
| 150 | - return array_key_exists('rank', $this->attributes) ? $this->attributes['rank'] >= 5 : false; |
|
| 151 | - } |
|
| 148 | + public function getIsStaffAttribute(): bool |
|
| 149 | + { |
|
| 150 | + return array_key_exists('rank', $this->attributes) ? $this->attributes['rank'] >= 5 : false; |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - /** |
|
| 153 | + /** |
|
| 154 | 154 | * Get Ban Details. |
| 155 | 155 | * |
| 156 | 156 | * @return Ban |
| 157 | 157 | */ |
| 158 | - public function getBanDetailsAttribute() |
|
| 159 | - { |
|
| 160 | - return Ban::where('user_id', $this->attributes['id'])->first(); |
|
| 161 | - } |
|
| 158 | + public function getBanDetailsAttribute() |
|
| 159 | + { |
|
| 160 | + return Ban::where('user_id', $this->attributes['id'])->first(); |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - /** |
|
| 163 | + /** |
|
| 164 | 164 | * Get Current User Country. |
| 165 | 165 | * |
| 166 | 166 | * @TODO: Implement this in a proper way |
| 167 | 167 | * |
| 168 | 168 | * @return string |
| 169 | 169 | */ |
| 170 | - public function getCountryAttribute(): string |
|
| 171 | - { |
|
| 172 | - return 'com'; |
|
| 173 | - } |
|
| 170 | + public function getCountryAttribute(): string |
|
| 171 | + { |
|
| 172 | + return 'com'; |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - /** |
|
| 175 | + /** |
|
| 176 | 176 | * Set the Trait Attribute. |
| 177 | 177 | * |
| 178 | 178 | * @param array $accountType |
| 179 | 179 | */ |
| 180 | - public function setTraitsAttribute(array $accountType) |
|
| 181 | - { |
|
| 182 | - $this->traits = $accountType; |
|
| 183 | - } |
|
| 180 | + public function setTraitsAttribute(array $accountType) |
|
| 181 | + { |
|
| 182 | + $this->traits = $accountType; |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - /** |
|
| 185 | + /** |
|
| 186 | 186 | * What is this field? |
| 187 | 187 | * |
| 188 | 188 | * @return array |
| 189 | 189 | */ |
| 190 | - public function getTraitsAttribute(): array |
|
| 191 | - { |
|
| 192 | - if (array_key_exists('rank', $this->attributes) && $this->attributes['rank'] >= 6) { |
|
| 193 | - return ['STAFF']; |
|
| 194 | - } |
|
| 190 | + public function getTraitsAttribute(): array |
|
| 191 | + { |
|
| 192 | + if (array_key_exists('rank', $this->attributes) && $this->attributes['rank'] >= 6) { |
|
| 193 | + return ['STAFF']; |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | - return $this->traits; |
|
| 197 | - } |
|
| 196 | + return $this->traits; |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - /** |
|
| 199 | + /** |
|
| 200 | 200 | * We don't care about this? |
| 201 | 201 | * |
| 202 | 202 | * @return bool |
| 203 | 203 | */ |
| 204 | - public function getTrustedAttribute(): bool |
|
| 205 | - { |
|
| 206 | - if (UserSecurity::find($this->attributes['id']) == null) { |
|
| 207 | - return true; |
|
| 208 | - } |
|
| 204 | + public function getTrustedAttribute(): bool |
|
| 205 | + { |
|
| 206 | + if (UserSecurity::find($this->attributes['id']) == null) { |
|
| 207 | + return true; |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - return in_array($this->attributes['ip_current'], |
|
| 211 | - UserSecurity::find($this->attributes['id'])->trustedDevices); |
|
| 212 | - } |
|
| 210 | + return in_array($this->attributes['ip_current'], |
|
| 211 | + UserSecurity::find($this->attributes['id'])->trustedDevices); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | - /** |
|
| 214 | + /** |
|
| 215 | 215 | * What is this field? |
| 216 | 216 | * |
| 217 | 217 | * @return string |
| 218 | 218 | */ |
| 219 | - public function getIdentityTypeAttribute(): string |
|
| 220 | - { |
|
| 221 | - return 'HABBO'; |
|
| 222 | - } |
|
| 219 | + public function getIdentityTypeAttribute(): string |
|
| 220 | + { |
|
| 221 | + return 'HABBO'; |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - /** |
|
| 224 | + /** |
|
| 225 | 225 | * We don't care about this, every user is trusted. |
| 226 | 226 | * |
| 227 | 227 | * @return bool |
| 228 | 228 | */ |
| 229 | - public function getIdentityVerifiedAttribute(): bool |
|
| 230 | - { |
|
| 231 | - return true; |
|
| 232 | - } |
|
| 229 | + public function getIdentityVerifiedAttribute(): bool |
|
| 230 | + { |
|
| 231 | + return true; |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | - /** |
|
| 234 | + /** |
|
| 235 | 235 | * We don't care about this. |
| 236 | 236 | * |
| 237 | 237 | * @return int |
| 238 | 238 | */ |
| 239 | - public function getLoginLogIdAttribute(): int |
|
| 240 | - { |
|
| 241 | - return 1; |
|
| 242 | - } |
|
| 239 | + public function getLoginLogIdAttribute(): int |
|
| 240 | + { |
|
| 241 | + return 1; |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - /** |
|
| 244 | + /** |
|
| 245 | 245 | * We don't care about this. |
| 246 | 246 | * |
| 247 | 247 | * @return int |
| 248 | 248 | */ |
| 249 | - public function getSessionLoginIdAttribute(): int |
|
| 250 | - { |
|
| 251 | - return 1; |
|
| 252 | - } |
|
| 249 | + public function getSessionLoginIdAttribute(): int |
|
| 250 | + { |
|
| 251 | + return 1; |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | - /** |
|
| 254 | + /** |
|
| 255 | 255 | * Get the HabboClub Attribute |
| 256 | 256 | * In a Retro Habbo everyone is HC, yeah? |
| 257 | 257 | * |
@@ -259,12 +259,12 @@ discard block |
||
| 259 | 259 | * |
| 260 | 260 | * @return bool |
| 261 | 261 | */ |
| 262 | - public function getHabboClubMemberAttribute(): bool |
|
| 263 | - { |
|
| 264 | - return Config::get('chocolatey.ads.enabled') == false; |
|
| 265 | - } |
|
| 262 | + public function getHabboClubMemberAttribute(): bool |
|
| 263 | + { |
|
| 264 | + return Config::get('chocolatey.ads.enabled') == false; |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - /** |
|
| 267 | + /** |
|
| 268 | 268 | * Get the Builders Club Attribute |
| 269 | 269 | * In a Retro Habbo everyone is BC, yeah? |
| 270 | 270 | * |
@@ -272,74 +272,74 @@ discard block |
||
| 272 | 272 | * |
| 273 | 273 | * @return bool |
| 274 | 274 | */ |
| 275 | - public function getBuildersClubMemberAttribute(): bool |
|
| 276 | - { |
|
| 277 | - return Config::get('chocolatey.ads.enabled') == false; |
|
| 278 | - } |
|
| 275 | + public function getBuildersClubMemberAttribute(): bool |
|
| 276 | + { |
|
| 277 | + return Config::get('chocolatey.ads.enabled') == false; |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - /** |
|
| 280 | + /** |
|
| 281 | 281 | * Get GTimestamp in Habbo UserCurrency. |
| 282 | 282 | * |
| 283 | 283 | * @return string |
| 284 | 284 | */ |
| 285 | - public function getAccountCreatedAttribute(): string |
|
| 286 | - { |
|
| 287 | - $accountCreated = $this->attributes['account_created'] ?? time(); |
|
| 285 | + public function getAccountCreatedAttribute(): string |
|
| 286 | + { |
|
| 287 | + $accountCreated = $this->attributes['account_created'] ?? time(); |
|
| 288 | 288 | |
| 289 | - return date('Y-m-d', $accountCreated).'T'.date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
| 290 | - } |
|
| 289 | + return date('Y-m-d', $accountCreated).'T'.date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - /** |
|
| 292 | + /** |
|
| 293 | 293 | * Get GTimestamp in Habbo UserCurrency. |
| 294 | 294 | * |
| 295 | 295 | * @return string |
| 296 | 296 | */ |
| 297 | - public function getMemberSinceAttribute(): string |
|
| 298 | - { |
|
| 299 | - $accountCreated = $this->attributes['account_created'] ?? time(); |
|
| 297 | + public function getMemberSinceAttribute(): string |
|
| 298 | + { |
|
| 299 | + $accountCreated = $this->attributes['account_created'] ?? time(); |
|
| 300 | 300 | |
| 301 | - return date('Y-m-d', $accountCreated).'T'.date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
| 302 | - } |
|
| 301 | + return date('Y-m-d', $accountCreated).'T'.date('H:i:s.ZZZZ+ZZZZ', $accountCreated); |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - /** |
|
| 304 | + /** |
|
| 305 | 305 | * Retrieve User Figure String. |
| 306 | 306 | * |
| 307 | 307 | * @return string |
| 308 | 308 | */ |
| 309 | - public function getFigureStringAttribute(): string |
|
| 310 | - { |
|
| 311 | - return $this->attributes['look'] ?? 'hr-115-42.hd-195-19.ch-3030-82.lg-275-1408.fa-1201.ca-1804-64'; |
|
| 312 | - } |
|
| 309 | + public function getFigureStringAttribute(): string |
|
| 310 | + { |
|
| 311 | + return $this->attributes['look'] ?? 'hr-115-42.hd-195-19.ch-3030-82.lg-275-1408.fa-1201.ca-1804-64'; |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | - /** |
|
| 314 | + /** |
|
| 315 | 315 | * Get GTimestamp in Habbo UserCurrency. |
| 316 | 316 | * |
| 317 | 317 | * @return false|string |
| 318 | 318 | */ |
| 319 | - public function getLastLoginAttribute(): string |
|
| 320 | - { |
|
| 321 | - $lastLogin = $this->attributes['last_login'] ?? time(); |
|
| 319 | + public function getLastLoginAttribute(): string |
|
| 320 | + { |
|
| 321 | + $lastLogin = $this->attributes['last_login'] ?? time(); |
|
| 322 | 322 | |
| 323 | - return date('Y-m-d', $lastLogin).'T'.date('H:i:s.ZZZZ+ZZZZ', $lastLogin); |
|
| 324 | - } |
|
| 323 | + return date('Y-m-d', $lastLogin).'T'.date('H:i:s.ZZZZ+ZZZZ', $lastLogin); |
|
| 324 | + } |
|
| 325 | 325 | |
| 326 | - /** |
|
| 326 | + /** |
|
| 327 | 327 | * Get E-Mail Verified Attribute. |
| 328 | 328 | * |
| 329 | 329 | * @return bool |
| 330 | 330 | */ |
| 331 | - public function getEmailVerifiedAttribute(): bool |
|
| 332 | - { |
|
| 333 | - return $this->getChocolateyId()->mail_verified; |
|
| 334 | - } |
|
| 331 | + public function getEmailVerifiedAttribute(): bool |
|
| 332 | + { |
|
| 333 | + return $this->getChocolateyId()->mail_verified; |
|
| 334 | + } |
|
| 335 | 335 | |
| 336 | - /** |
|
| 336 | + /** |
|
| 337 | 337 | * Get Account Chocolatey Id. |
| 338 | 338 | * |
| 339 | 339 | * @return ChocolateyId |
| 340 | 340 | */ |
| 341 | - public function getChocolateyId() |
|
| 342 | - { |
|
| 343 | - return ChocolateyId::find($this->attributes['mail']); |
|
| 344 | - } |
|
| 341 | + public function getChocolateyId() |
|
| 342 | + { |
|
| 343 | + return ChocolateyId::find($this->attributes['mail']); |
|
| 344 | + } |
|
| 345 | 345 | } |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | */ |
| 81 | 81 | public function getCreationTimeAttribute(): string |
| 82 | 82 | { |
| 83 | - return date('Y-m-d', strtotime($this->attributes['created_at'])).'T'. |
|
| 83 | + return date('Y-m-d', strtotime($this->attributes['created_at'])) . 'T' . |
|
| 84 | 84 | date('H:i:s.ZZZZ+ZZZZ', strtotime($this->attributes['created_at'])); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -1,124 +1,124 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | -use Illuminate\Support\Facades\DB; |
|
| 6 | -use Sofa\Eloquence\Eloquence; |
|
| 7 | -use Sofa\Eloquence\Mappable; |
|
| 5 | + use Illuminate\Support\Facades\DB; |
|
| 6 | + use Sofa\Eloquence\Eloquence; |
|
| 7 | + use Sofa\Eloquence\Mappable; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Class ShopHistory. |
| 11 | 11 | * |
| 12 | 12 | * @property int transactionId |
| 13 | 13 | */ |
| 14 | -class ShopHistory extends ChocolateyModel |
|
| 15 | -{ |
|
| 16 | - use Eloquence, Mappable; |
|
| 14 | + class ShopHistory extends ChocolateyModel |
|
| 15 | + { |
|
| 16 | + use Eloquence, Mappable; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Disable Timestamps. |
| 20 | 20 | * |
| 21 | 21 | * @var bool |
| 22 | 22 | */ |
| 23 | - public $timestamps = true; |
|
| 23 | + public $timestamps = true; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 25 | + /** |
|
| 26 | 26 | * The table associated with the model. |
| 27 | 27 | * |
| 28 | 28 | * @var string |
| 29 | 29 | */ |
| 30 | - protected $table = 'chocolatey_shop_history'; |
|
| 30 | + protected $table = 'chocolatey_shop_history'; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | + /** |
|
| 33 | 33 | * Primary Key of the Table. |
| 34 | 34 | * |
| 35 | 35 | * @var string |
| 36 | 36 | */ |
| 37 | - protected $primaryKey = 'id'; |
|
| 37 | + protected $primaryKey = 'id'; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 39 | + /** |
|
| 40 | 40 | * The attributes that will be mapped. |
| 41 | 41 | * |
| 42 | 42 | * @var array |
| 43 | 43 | */ |
| 44 | - protected $maps = ['transactionSystemName' => 'payment_method', 'transactionId' => 'id']; |
|
| 44 | + protected $maps = ['transactionSystemName' => 'payment_method', 'transactionId' => 'id']; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 46 | + /** |
|
| 47 | 47 | * The Appender(s) of the Model. |
| 48 | 48 | * |
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | - protected $appends = ['creationTime', 'transactionSystemName', 'credits', 'price', 'transactionId', 'product']; |
|
| 51 | + protected $appends = ['creationTime', 'transactionSystemName', 'credits', 'price', 'transactionId', 'product']; |
|
| 52 | 52 | |
| 53 | - /** |
|
| 53 | + /** |
|
| 54 | 54 | * The attributes excluded from the model's JSON form. |
| 55 | 55 | * |
| 56 | 56 | * @var array |
| 57 | 57 | */ |
| 58 | - protected $hidden = ['created_at', 'updated_at', 'approved_by', 'user_id', 'item_id']; |
|
| 58 | + protected $hidden = ['created_at', 'updated_at', 'approved_by', 'user_id', 'item_id']; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 60 | + /** |
|
| 61 | 61 | * Get Creation Time Attribute. |
| 62 | 62 | * |
| 63 | 63 | * @return string |
| 64 | 64 | */ |
| 65 | - public function getCreationTimeAttribute(): string |
|
| 66 | - { |
|
| 67 | - return date('Y-m-d', strtotime($this->attributes['created_at'])).'T'. |
|
| 68 | - date('H:i:s.ZZZZ+ZZZZ', strtotime($this->attributes['created_at'])); |
|
| 69 | - } |
|
| 65 | + public function getCreationTimeAttribute(): string |
|
| 66 | + { |
|
| 67 | + return date('Y-m-d', strtotime($this->attributes['created_at'])).'T'. |
|
| 68 | + date('H:i:s.ZZZZ+ZZZZ', strtotime($this->attributes['created_at'])); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 71 | + /** |
|
| 72 | 72 | * Get Payment Method Name. |
| 73 | 73 | * |
| 74 | 74 | * @return string |
| 75 | 75 | */ |
| 76 | - public function getTransactionSystemNameAttribute(): string |
|
| 77 | - { |
|
| 78 | - return PaymentMethod::find($this->attributes['payment_method'])->name; |
|
| 79 | - } |
|
| 76 | + public function getTransactionSystemNameAttribute(): string |
|
| 77 | + { |
|
| 78 | + return PaymentMethod::find($this->attributes['payment_method'])->name; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 81 | + /** |
|
| 82 | 82 | * Get Transaction Id. |
| 83 | 83 | * |
| 84 | 84 | * @return int |
| 85 | 85 | */ |
| 86 | - public function getTransactionIdAttribute(): int |
|
| 87 | - { |
|
| 88 | - return $this->attributes['id']; |
|
| 89 | - } |
|
| 86 | + public function getTransactionIdAttribute(): int |
|
| 87 | + { |
|
| 88 | + return $this->attributes['id']; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 91 | + /** |
|
| 92 | 92 | * Get Amount of Given Credits. |
| 93 | 93 | * |
| 94 | 94 | * @return int |
| 95 | 95 | */ |
| 96 | - public function getCreditsAttribute(): int |
|
| 97 | - { |
|
| 98 | - return DB::table('chocolatey_shop_items')->where('id', $this->attributes['item_id'])->first()->creditAmount; |
|
| 99 | - } |
|
| 96 | + public function getCreditsAttribute(): int |
|
| 97 | + { |
|
| 98 | + return DB::table('chocolatey_shop_items')->where('id', $this->attributes['item_id'])->first()->creditAmount; |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - /** |
|
| 101 | + /** |
|
| 102 | 102 | * Get Product Attribute. |
| 103 | 103 | * |
| 104 | 104 | * @return mixed|object|array |
| 105 | 105 | */ |
| 106 | - public function getProductAttribute() |
|
| 107 | - { |
|
| 108 | - return DB::table('chocolatey_shop_items')->where('id', $this->attributes['item_id'])->first(['name', 'description']); |
|
| 109 | - } |
|
| 106 | + public function getProductAttribute() |
|
| 107 | + { |
|
| 108 | + return DB::table('chocolatey_shop_items')->where('id', $this->attributes['item_id'])->first(['name', 'description']); |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 111 | + /** |
|
| 112 | 112 | * Get Price Attribute. |
| 113 | 113 | * |
| 114 | 114 | * @return string |
| 115 | 115 | */ |
| 116 | - public function getPriceAttribute(): string |
|
| 117 | - { |
|
| 118 | - return DB::table('chocolatey_shop_items')->where('id', $this->attributes['item_id'])->first()->price; |
|
| 119 | - } |
|
| 116 | + public function getPriceAttribute(): string |
|
| 117 | + { |
|
| 118 | + return DB::table('chocolatey_shop_items')->where('id', $this->attributes['item_id'])->first()->price; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 121 | + /** |
|
| 122 | 122 | * Store a new Purchase. |
| 123 | 123 | * |
| 124 | 124 | * @param int $paymentMethod |
@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | * |
| 128 | 128 | * @return ShopHistory |
| 129 | 129 | */ |
| 130 | - public function store(int $paymentMethod, int $userId, int $itemId): ShopHistory |
|
| 131 | - { |
|
| 132 | - $this->attributes['payment_method'] = $paymentMethod; |
|
| 133 | - $this->attributes['user_id'] = $userId; |
|
| 134 | - $this->attributes['item_id'] = $itemId; |
|
| 130 | + public function store(int $paymentMethod, int $userId, int $itemId): ShopHistory |
|
| 131 | + { |
|
| 132 | + $this->attributes['payment_method'] = $paymentMethod; |
|
| 133 | + $this->attributes['user_id'] = $userId; |
|
| 134 | + $this->attributes['item_id'] = $itemId; |
|
| 135 | 135 | |
| 136 | - $this->save(); |
|
| 136 | + $this->save(); |
|
| 137 | 137 | |
| 138 | - return $this; |
|
| 139 | - } |
|
| 138 | + return $this; |
|
| 139 | + } |
|
| 140 | 140 | } |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function getUserHead(Request $request) |
| 27 | 27 | { |
| 28 | - return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') : |
|
| 29 | - User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1'); |
|
| 28 | + return redirect(Config::get('chocolatey.imaging') . 'avatarimage?figure=' . ($request->has('figure') ? $request->input('figure') : User::where('username', $request->input('user'))->first()->figureString) . '&size=l&headonly=1'); |
|
| 30 | 29 | } |
| 31 | 30 | |
| 32 | 31 | /** |
@@ -39,7 +38,7 @@ discard block |
||
| 39 | 38 | */ |
| 40 | 39 | public function getUserBody(string $figure) |
| 41 | 40 | { |
| 42 | - return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}"); |
|
| 41 | + return redirect(Config::get('chocolatey.imaging') . "avatar/{$figure}"); |
|
| 43 | 42 | } |
| 44 | 43 | |
| 45 | 44 | /** |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Http\Controllers; |
|
| 3 | + namespace App\Http\Controllers; |
|
| 4 | 4 | |
| 5 | -use App\Models\EmulatorSettings; |
|
| 6 | -use App\Models\User; |
|
| 7 | -use Illuminate\Http\Request; |
|
| 8 | -use Illuminate\Support\Facades\Config; |
|
| 9 | -use Intervention\Image\Facades\Image; |
|
| 10 | -use Laravel\Lumen\Http\Redirector; |
|
| 11 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 5 | + use App\Models\EmulatorSettings; |
|
| 6 | + use App\Models\User; |
|
| 7 | + use Illuminate\Http\Request; |
|
| 8 | + use Illuminate\Support\Facades\Config; |
|
| 9 | + use Intervention\Image\Facades\Image; |
|
| 10 | + use Laravel\Lumen\Http\Redirector; |
|
| 11 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Class ImagingController. |
| 15 | 15 | */ |
| 16 | -class ImagingController extends BaseController |
|
| 17 | -{ |
|
| 18 | - /** |
|
| 16 | + class ImagingController extends BaseController |
|
| 17 | + { |
|
| 18 | + /** |
|
| 19 | 19 | * Get User Figure for Big Header |
| 20 | 20 | * based on User Name or Figure. |
| 21 | 21 | * |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return Redirector |
| 25 | 25 | */ |
| 26 | - public function getUserHead(Request $request) |
|
| 27 | - { |
|
| 28 | - return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') : |
|
| 29 | - User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1'); |
|
| 30 | - } |
|
| 26 | + public function getUserHead(Request $request) |
|
| 27 | + { |
|
| 28 | + return redirect(Config::get('chocolatey.imaging').'avatarimage?figure='.($request->has('figure') ? $request->input('figure') : |
|
| 29 | + User::where('username', $request->input('user'))->first()->figureString).'&size=l&headonly=1'); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | + /** |
|
| 33 | 33 | * Get User Figure for Body |
| 34 | 34 | * based on User Figure. |
| 35 | 35 | * |
@@ -37,36 +37,36 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return Redirector |
| 39 | 39 | */ |
| 40 | - public function getUserBody(string $figure) |
|
| 41 | - { |
|
| 42 | - return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}"); |
|
| 43 | - } |
|
| 40 | + public function getUserBody(string $figure) |
|
| 41 | + { |
|
| 42 | + return redirect(Config::get('chocolatey.imaging')."avatar/{$figure}"); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | + /** |
|
| 46 | 46 | * Get Youtube Thumbnail. |
| 47 | 47 | * |
| 48 | 48 | * @param Request $request |
| 49 | 49 | * |
| 50 | 50 | * @return string |
| 51 | 51 | */ |
| 52 | - public function getYoutubeThumbnail(Request $request) |
|
| 53 | - { |
|
| 54 | - return Image::make($request->input('url'))->response('jpg'); |
|
| 55 | - } |
|
| 52 | + public function getYoutubeThumbnail(Request $request) |
|
| 53 | + { |
|
| 54 | + return Image::make($request->input('url'))->response('jpg'); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 57 | + /** |
|
| 58 | 58 | * Return Group Badge. |
| 59 | 59 | * |
| 60 | 60 | * @param string $badgeCode |
| 61 | 61 | * |
| 62 | 62 | * @return mixed |
| 63 | 63 | */ |
| 64 | - public function getGroupBadge(string $badgeCode) |
|
| 65 | - { |
|
| 66 | - $imagePath = EmulatorSettings::where('key', 'imager.location.output.badges')->first(); |
|
| 64 | + public function getGroupBadge(string $badgeCode) |
|
| 65 | + { |
|
| 66 | + $imagePath = EmulatorSettings::where('key', 'imager.location.output.badges')->first(); |
|
| 67 | 67 | |
| 68 | - $badgeCode = str_replace('.gif', '', $badgeCode); |
|
| 68 | + $badgeCode = str_replace('.gif', '', $badgeCode); |
|
| 69 | 69 | |
| 70 | - return Image::make("{$imagePath->value}/{$badgeCode}.png")->response('gif'); |
|
| 71 | - } |
|
| 70 | + return Image::make("{$imagePath->value}/{$badgeCode}.png")->response('gif'); |
|
| 71 | + } |
|
| 72 | 72 | } |
@@ -1,35 +1,35 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class Question. |
| 7 | 7 | */ |
| 8 | -class Question |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class Question |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * Question Identifier (One or Two). |
| 12 | 12 | * |
| 13 | 13 | * @var int |
| 14 | 14 | */ |
| 15 | - public $questionId = 1; |
|
| 15 | + public $questionId = 1; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Question Key (Translate Text). |
| 19 | 19 | * |
| 20 | 20 | * @var string |
| 21 | 21 | */ |
| 22 | - public $questionKey = ''; |
|
| 22 | + public $questionKey = ''; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * Store a Question. |
| 26 | 26 | * |
| 27 | 27 | * @param int $questionId |
| 28 | 28 | * @param string $questionKey |
| 29 | 29 | */ |
| 30 | - public function __construct(int $questionId, string $questionKey) |
|
| 31 | - { |
|
| 32 | - $this->questionId = $questionId; |
|
| 33 | - $this->questionKey = $questionKey; |
|
| 34 | - } |
|
| 30 | + public function __construct(int $questionId, string $questionKey) |
|
| 31 | + { |
|
| 32 | + $this->questionId = $questionId; |
|
| 33 | + $this->questionKey = $questionKey; |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -1,18 +1,18 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Http\Controllers; |
|
| 3 | + namespace App\Http\Controllers; |
|
| 4 | 4 | |
| 5 | -use App\Models\Article; |
|
| 6 | -use App\Models\ArticleCategory; |
|
| 7 | -use Illuminate\Http\Response; |
|
| 8 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 5 | + use App\Models\Article; |
|
| 6 | + use App\Models\ArticleCategory; |
|
| 7 | + use Illuminate\Http\Response; |
|
| 8 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Class ArticleController. |
| 12 | 12 | */ |
| 13 | -class ArticleController extends BaseController |
|
| 14 | -{ |
|
| 15 | - /** |
|
| 13 | + class ArticleController extends BaseController |
|
| 14 | + { |
|
| 15 | + /** |
|
| 16 | 16 | * Render a specific view of Article set. |
| 17 | 17 | * |
| 18 | 18 | * @param string $countryId |
@@ -20,28 +20,28 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @return Response |
| 22 | 22 | */ |
| 23 | - public function many(string $countryId, string $articleCategory): Response |
|
| 24 | - { |
|
| 25 | - $category = ArticleCategory::find(strstr(($articleCategory = |
|
| 26 | - str_replace('.html', '', $articleCategory)), '_', true)); |
|
| 23 | + public function many(string $countryId, string $articleCategory): Response |
|
| 24 | + { |
|
| 25 | + $category = ArticleCategory::find(strstr(($articleCategory = |
|
| 26 | + str_replace('.html', '', $articleCategory)), '_', true)); |
|
| 27 | 27 | |
| 28 | - $categoryPage = strstr(strrev($articleCategory), '_', true); |
|
| 28 | + $categoryPage = strstr(strrev($articleCategory), '_', true); |
|
| 29 | 29 | |
| 30 | - return $articleCategory == 'front' ? $this->front() : $this->category($countryId, $category, $categoryPage, |
|
| 31 | - $categoryPage == 1 ? 0 : (10 * ($categoryPage - 1))); |
|
| 32 | - } |
|
| 30 | + return $articleCategory == 'front' ? $this->front() : $this->category($countryId, $category, $categoryPage, |
|
| 31 | + $categoryPage == 1 ? 0 : (10 * ($categoryPage - 1))); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | + /** |
|
| 35 | 35 | * Render the Front Page of the Articles Page. |
| 36 | 36 | * |
| 37 | 37 | * @return Response |
| 38 | 38 | */ |
| 39 | - protected function front(): Response |
|
| 40 | - { |
|
| 41 | - return response(view('habbo-web-news.articles-front', ['set' => Article::orderBy('id', 'DESC')->limit(10)->get()])); |
|
| 42 | - } |
|
| 39 | + protected function front(): Response |
|
| 40 | + { |
|
| 41 | + return response(view('habbo-web-news.articles-front', ['set' => Article::orderBy('id', 'DESC')->limit(10)->get()])); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | + /** |
|
| 45 | 45 | * Render a specific Category Articles Page. |
| 46 | 46 | * |
| 47 | 47 | * @TODO: Proper Way to use Country ID |
@@ -53,18 +53,18 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return Response |
| 55 | 55 | */ |
| 56 | - protected function category(string $countryId, ArticleCategory $category, int $categoryPage, int $start): Response |
|
| 57 | - { |
|
| 58 | - $articles = Article::where('id', '>=', $start)->limit(10)->orderBy('id', 'DESC')->get()->filter(function ($item) use ($category) { |
|
| 59 | - return $category->name == 'all' || in_array($category, $item->categories); |
|
| 60 | - }); |
|
| 56 | + protected function category(string $countryId, ArticleCategory $category, int $categoryPage, int $start): Response |
|
| 57 | + { |
|
| 58 | + $articles = Article::where('id', '>=', $start)->limit(10)->orderBy('id', 'DESC')->get()->filter(function ($item) use ($category) { |
|
| 59 | + return $category->name == 'all' || in_array($category, $item->categories); |
|
| 60 | + }); |
|
| 61 | 61 | |
| 62 | - return response(view('habbo-web-news.articles-category', [ |
|
| 63 | - 'category' => $category, 'page' => $categoryPage, 'categories' => ArticleCategory::all(), 'articles' => $articles, |
|
| 64 | - ])); |
|
| 65 | - } |
|
| 62 | + return response(view('habbo-web-news.articles-category', [ |
|
| 63 | + 'category' => $category, 'page' => $categoryPage, 'categories' => ArticleCategory::all(), 'articles' => $articles, |
|
| 64 | + ])); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 67 | + /** |
|
| 68 | 68 | * Render a specific view of a specific Article. |
| 69 | 69 | * |
| 70 | 70 | * @TODO: Proper Way to use Country ID |
@@ -74,30 +74,30 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return Response |
| 76 | 76 | */ |
| 77 | - public function one(string $countryId, string $articleName): Response |
|
| 78 | - { |
|
| 79 | - if (($article = Article::find(strstr($articleName, '_', true))) == null) { |
|
| 80 | - return response()->json(null, 404); |
|
| 81 | - } |
|
| 77 | + public function one(string $countryId, string $articleName): Response |
|
| 78 | + { |
|
| 79 | + if (($article = Article::find(strstr($articleName, '_', true))) == null) { |
|
| 80 | + return response()->json(null, 404); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - $related = ($latest = Article::all())->filter(function ($item) use ($article) { |
|
| 84 | - return in_array($article->categories[0], $item->categories); |
|
| 85 | - }); |
|
| 83 | + $related = ($latest = Article::all())->filter(function ($item) use ($article) { |
|
| 84 | + return in_array($article->categories[0], $item->categories); |
|
| 85 | + }); |
|
| 86 | 86 | |
| 87 | - return response(view('habbo-web-news.articles-view', |
|
| 88 | - ['article' => $article, 'latest' => $latest->slice(0, 5), 'related' => $related->slice(0, 5)] |
|
| 89 | - )); |
|
| 90 | - } |
|
| 87 | + return response(view('habbo-web-news.articles-view', |
|
| 88 | + ['article' => $article, 'latest' => $latest->slice(0, 5), 'related' => $related->slice(0, 5)] |
|
| 89 | + )); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 92 | + /** |
|
| 93 | 93 | * Get All Habbo Articles as XML/RSS. |
| 94 | 94 | * |
| 95 | 95 | * @return Response |
| 96 | 96 | */ |
| 97 | - public function getRss() |
|
| 98 | - { |
|
| 99 | - return response(view('habbo-rss', [ |
|
| 100 | - 'articles' => Article::limit(20)->get(), |
|
| 101 | - ]))->header('Content-Type', 'text/xml'); |
|
| 102 | - } |
|
| 97 | + public function getRss() |
|
| 98 | + { |
|
| 99 | + return response(view('habbo-rss', [ |
|
| 100 | + 'articles' => Article::limit(20)->get(), |
|
| 101 | + ]))->header('Content-Type', 'text/xml'); |
|
| 102 | + } |
|
| 103 | 103 | } |
@@ -1,34 +1,34 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Http\Middleware; |
|
| 3 | + namespace App\Http\Middleware; |
|
| 4 | 4 | |
| 5 | -use Closure; |
|
| 6 | -use Illuminate\Contracts\Auth\Factory as Auth; |
|
| 7 | -use Illuminate\Http\Request; |
|
| 5 | + use Closure; |
|
| 6 | + use Illuminate\Contracts\Auth\Factory as Auth; |
|
| 7 | + use Illuminate\Http\Request; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Class Authenticate. |
| 11 | 11 | */ |
| 12 | -class Authenticate |
|
| 13 | -{ |
|
| 14 | - /** |
|
| 12 | + class Authenticate |
|
| 13 | + { |
|
| 14 | + /** |
|
| 15 | 15 | * The authentication guard factory instance. |
| 16 | 16 | * |
| 17 | 17 | * @var Auth |
| 18 | 18 | */ |
| 19 | - protected $auth; |
|
| 19 | + protected $auth; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 21 | + /** |
|
| 22 | 22 | * Create a new middleware instance. |
| 23 | 23 | * |
| 24 | 24 | * @param Auth $auth |
| 25 | 25 | */ |
| 26 | - public function __construct(Auth $auth) |
|
| 27 | - { |
|
| 28 | - $this->auth = $auth; |
|
| 29 | - } |
|
| 26 | + public function __construct(Auth $auth) |
|
| 27 | + { |
|
| 28 | + $this->auth = $auth; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * Handle an incoming request. |
| 33 | 33 | * |
| 34 | 34 | * @param Request $request |
@@ -37,16 +37,16 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return mixed |
| 39 | 39 | */ |
| 40 | - public function handle($request, Closure $next, $guard = null) |
|
| 41 | - { |
|
| 42 | - if ($this->auth->guard($guard)->guest()) { |
|
| 43 | - return response()->json(['message' => 'authentication-needed'], 401); |
|
| 44 | - } |
|
| 40 | + public function handle($request, Closure $next, $guard = null) |
|
| 41 | + { |
|
| 42 | + if ($this->auth->guard($guard)->guest()) { |
|
| 43 | + return response()->json(['message' => 'authentication-needed'], 401); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - if ($request->user()->isBanned == true) { |
|
| 47 | - return response('Unauthorized.', 401); |
|
| 48 | - } |
|
| 46 | + if ($request->user()->isBanned == true) { |
|
| 47 | + return response('Unauthorized.', 401); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return $next($request); |
|
| 51 | - } |
|
| 50 | + return $next($request); |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -40,166 +40,166 @@ |
||
| 40 | 40 | switch ($request->json()->get('roomIndex')): |
| 41 | 41 | case 1: |
| 42 | 42 | return $this->createBedRoom($request->user()); |
| 43 | - case 2: |
|
| 44 | - return $this->createPoolRoom($request->user()); |
|
| 45 | - case 3: |
|
| 46 | - return $this->createClubRoom($request->user()); |
|
| 47 | - default: |
|
| 48 | - return false; |
|
| 49 | - endswitch; |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - /** |
|
| 43 | + case 2: |
|
| 44 | + return $this->createPoolRoom($request->user()); |
|
| 45 | + case 3: |
|
| 46 | + return $this->createClubRoom($request->user()); |
|
| 47 | + default: |
|
| 48 | + return false; |
|
| 49 | + endswitch; |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | 53 | * Create the NUX Bed Room. |
| 54 | 54 | * |
| 55 | 55 | * @param User $user |
| 56 | 56 | * |
| 57 | 57 | * @return bool |
| 58 | 58 | */ |
| 59 | - protected function createBedRoom(User $user): bool |
|
| 60 | - { |
|
| 61 | - $room = (new Room())->store("{$user->name}'s room", "{$user->name} has entered the building", 'model_h', 25, 12, 610, 2403, 0.0, $user->uniqueId, $user->name); |
|
| 62 | - |
|
| 63 | - $user->update(['home_room' => $room->id]); |
|
| 64 | - |
|
| 65 | - // Floor Items |
|
| 66 | - (new RoomItem())->store($user->uniqueId, $room->id, 15542, 9, 9, '0.00000', 4, ''); |
|
| 67 | - (new RoomItem())->store($user->uniqueId, $room->id, 15542, 9, 12, '0.00000', 0, ''); |
|
| 68 | - (new RoomItem())->store($user->uniqueId, $room->id, 15542, 10, 9, '0.00000', 4, ''); |
|
| 69 | - (new RoomItem())->store($user->uniqueId, $room->id, 15542, 10, 12, '0.00000', 0, ''); |
|
| 70 | - (new RoomItem())->store($user->uniqueId, $room->id, 16412, 9, 5, '1.00000', 0, ''); |
|
| 71 | - (new RoomItem())->store($user->uniqueId, $room->id, 16435, 7, 5, '1.00000', 0, ''); |
|
| 72 | - (new RoomItem())->store($user->uniqueId, $room->id, 16486, 8, 5, '1.00000', 0, ''); |
|
| 73 | - (new RoomItem())->store($user->uniqueId, $room->id, 17816, 6, 2, '1.00000', 0, '4'); |
|
| 74 | - (new RoomItem())->store($user->uniqueId, $room->id, 17816, 9, 2, '1.00000', 0, '4'); |
|
| 75 | - (new RoomItem())->store($user->uniqueId, $room->id, 17824, 7, 2, '1.00000', 0, '1'); |
|
| 76 | - (new RoomItem())->store($user->uniqueId, $room->id, 17894, 9, 10, '0.00000', 0, ''); |
|
| 77 | - (new RoomItem())->store($user->uniqueId, $room->id, 18074, 8, 4, '1.00000', 0, '1'); |
|
| 78 | - (new RoomItem())->store($user->uniqueId, $room->id, 18817, 3, 10, '0.01000', 2, ''); |
|
| 79 | - (new RoomItem())->store($user->uniqueId, $room->id, 18835, 3, 9, '0.00000', 0, ''); |
|
| 80 | - (new RoomItem())->store($user->uniqueId, $room->id, 18835, 3, 11, '0.00000', 0, ''); |
|
| 81 | - (new RoomItem())->store($user->uniqueId, $room->id, 18835, 5, 9, '0.00000', 0, ''); |
|
| 82 | - (new RoomItem())->store($user->uniqueId, $room->id, 18835, 5, 11, '0.00000', 0, ''); |
|
| 83 | - |
|
| 84 | - // Wall Items |
|
| 85 | - (new RoomItem())->store($user->uniqueId, $room->id, 22988, 0, 0, '0', 0, '', ':w=4,2 l=0,35 l'); |
|
| 86 | - (new RoomItem())->store($user->uniqueId, $room->id, 23163, 0, 0, '0', 0, '1', ':w=4,8 l=0,43 r'); |
|
| 87 | - (new RoomItem())->store($user->uniqueId, $room->id, 23261, 0, 0, '0', 0, '', ':w=2,10 l=2,34 l'); |
|
| 88 | - (new RoomItem())->store($user->uniqueId, $room->id, 23331, 0, 0, '0', 0, '', ':w=2,10 l=2,29 l'); |
|
| 89 | - |
|
| 90 | - return true; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - /** |
|
| 59 | + protected function createBedRoom(User $user): bool |
|
| 60 | + { |
|
| 61 | + $room = (new Room())->store("{$user->name}'s room", "{$user->name} has entered the building", 'model_h', 25, 12, 610, 2403, 0.0, $user->uniqueId, $user->name); |
|
| 62 | + |
|
| 63 | + $user->update(['home_room' => $room->id]); |
|
| 64 | + |
|
| 65 | + // Floor Items |
|
| 66 | + (new RoomItem())->store($user->uniqueId, $room->id, 15542, 9, 9, '0.00000', 4, ''); |
|
| 67 | + (new RoomItem())->store($user->uniqueId, $room->id, 15542, 9, 12, '0.00000', 0, ''); |
|
| 68 | + (new RoomItem())->store($user->uniqueId, $room->id, 15542, 10, 9, '0.00000', 4, ''); |
|
| 69 | + (new RoomItem())->store($user->uniqueId, $room->id, 15542, 10, 12, '0.00000', 0, ''); |
|
| 70 | + (new RoomItem())->store($user->uniqueId, $room->id, 16412, 9, 5, '1.00000', 0, ''); |
|
| 71 | + (new RoomItem())->store($user->uniqueId, $room->id, 16435, 7, 5, '1.00000', 0, ''); |
|
| 72 | + (new RoomItem())->store($user->uniqueId, $room->id, 16486, 8, 5, '1.00000', 0, ''); |
|
| 73 | + (new RoomItem())->store($user->uniqueId, $room->id, 17816, 6, 2, '1.00000', 0, '4'); |
|
| 74 | + (new RoomItem())->store($user->uniqueId, $room->id, 17816, 9, 2, '1.00000', 0, '4'); |
|
| 75 | + (new RoomItem())->store($user->uniqueId, $room->id, 17824, 7, 2, '1.00000', 0, '1'); |
|
| 76 | + (new RoomItem())->store($user->uniqueId, $room->id, 17894, 9, 10, '0.00000', 0, ''); |
|
| 77 | + (new RoomItem())->store($user->uniqueId, $room->id, 18074, 8, 4, '1.00000', 0, '1'); |
|
| 78 | + (new RoomItem())->store($user->uniqueId, $room->id, 18817, 3, 10, '0.01000', 2, ''); |
|
| 79 | + (new RoomItem())->store($user->uniqueId, $room->id, 18835, 3, 9, '0.00000', 0, ''); |
|
| 80 | + (new RoomItem())->store($user->uniqueId, $room->id, 18835, 3, 11, '0.00000', 0, ''); |
|
| 81 | + (new RoomItem())->store($user->uniqueId, $room->id, 18835, 5, 9, '0.00000', 0, ''); |
|
| 82 | + (new RoomItem())->store($user->uniqueId, $room->id, 18835, 5, 11, '0.00000', 0, ''); |
|
| 83 | + |
|
| 84 | + // Wall Items |
|
| 85 | + (new RoomItem())->store($user->uniqueId, $room->id, 22988, 0, 0, '0', 0, '', ':w=4,2 l=0,35 l'); |
|
| 86 | + (new RoomItem())->store($user->uniqueId, $room->id, 23163, 0, 0, '0', 0, '1', ':w=4,8 l=0,43 r'); |
|
| 87 | + (new RoomItem())->store($user->uniqueId, $room->id, 23261, 0, 0, '0', 0, '', ':w=2,10 l=2,34 l'); |
|
| 88 | + (new RoomItem())->store($user->uniqueId, $room->id, 23331, 0, 0, '0', 0, '', ':w=2,10 l=2,29 l'); |
|
| 89 | + |
|
| 90 | + return true; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | 94 | * Create the Pool Room. |
| 95 | 95 | * |
| 96 | 96 | * @param User $user |
| 97 | 97 | * |
| 98 | 98 | * @return bool |
| 99 | 99 | */ |
| 100 | - protected function createPoolRoom(User $user): bool |
|
| 101 | - { |
|
| 102 | - $room = (new Room())->store("{$user->name}'s room", "{$user->name} has entered the building", 'model_h', 25, 12, 307, 3104, 1.10, $user->uniqueId, $user->name); |
|
| 103 | - |
|
| 104 | - $user->update(['home_room' => $room->id]); |
|
| 105 | - |
|
| 106 | - // Floor Items |
|
| 107 | - (new RoomItem())->store($user->uniqueId, $room->id, 16715, 5, 11, 1.30000, 0, ''); |
|
| 108 | - (new RoomItem())->store($user->uniqueId, $room->id, 16732, 3, 10, 0.40000, 0, ''); |
|
| 109 | - (new RoomItem())->store($user->uniqueId, $room->id, 17016, 3, 9, 0.00000, 2, '1'); |
|
| 110 | - (new RoomItem())->store($user->uniqueId, $room->id, 17016, 3, 11, 0.00000, 0, ''); |
|
| 111 | - (new RoomItem())->store($user->uniqueId, $room->id, 17016, 4, 9, 0.00000, 4, ''); |
|
| 112 | - (new RoomItem())->store($user->uniqueId, $room->id, 17090, 3, 9, 0.00000, 2, '1'); |
|
| 113 | - (new RoomItem())->store($user->uniqueId, $room->id, 17176, 3, 9, 0.00000, 0, ''); |
|
| 114 | - (new RoomItem())->store($user->uniqueId, $room->id, 17176, 3, 9, 0.40000, 0, ''); |
|
| 115 | - (new RoomItem())->store($user->uniqueId, $room->id, 17176, 3, 10, 0.00000, 0, ''); |
|
| 116 | - (new RoomItem())->store($user->uniqueId, $room->id, 17190, 3, 11, 0.00000, 2, ''); |
|
| 117 | - (new RoomItem())->store($user->uniqueId, $room->id, 17190, 4, 9, 0.00000, 4, ''); |
|
| 118 | - (new RoomItem())->store($user->uniqueId, $room->id, 17191, 3, 10, 0.40000, 2, ''); |
|
| 119 | - (new RoomItem())->store($user->uniqueId, $room->id, 17191, 3, 12, 0.00000, 2, ''); |
|
| 120 | - (new RoomItem())->store($user->uniqueId, $room->id, 17484, 8, 3, 1.00000, 0, '0', 0); |
|
| 121 | - (new RoomItem())->store($user->uniqueId, $room->id, 17499, 7, 3, 1.00000, 2, ''); |
|
| 122 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 7, 2, 1.00000, 0, ''); |
|
| 123 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 7, 4, 1.00000, 0, ''); |
|
| 124 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 7, 5, 1.00000, 0, ''); |
|
| 125 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 8, 2, 1.00000, 0, ''); |
|
| 126 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 8, 5, 1.00000, 0, ''); |
|
| 127 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 9, 2, 1.00000, 0, ''); |
|
| 128 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 9, 5, 1.00000, 0, ''); |
|
| 129 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 10, 2, 1.00000, 0, ''); |
|
| 130 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 10, 3, 1.00000, 0, ''); |
|
| 131 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 10, 4, 1.00000, 0, ''); |
|
| 132 | - (new RoomItem())->store($user->uniqueId, $room->id, 17520, 10, 5, 1.00000, 0, ''); |
|
| 133 | - (new RoomItem())->store($user->uniqueId, $room->id, 17987, 5, 11, 0.00000, 0, ''); |
|
| 134 | - (new RoomItem())->store($user->uniqueId, $room->id, 18051, 5, 2, 1.00000, 0, ''); |
|
| 135 | - (new RoomItem())->store($user->uniqueId, $room->id, 18051, 5, 4, 1.00000, 0, ''); |
|
| 136 | - (new RoomItem())->store($user->uniqueId, $room->id, 18051, 8, 9, 0.00000, 0, ''); |
|
| 137 | - (new RoomItem())->store($user->uniqueId, $room->id, 18051, 8, 11, 0.00000, 0, ''); |
|
| 138 | - (new RoomItem())->store($user->uniqueId, $room->id, 18051, 9, 9, 0.00000, 0, ''); |
|
| 139 | - (new RoomItem())->store($user->uniqueId, $room->id, 18051, 9, 11, 0.00000, 0, ''); |
|
| 140 | - (new RoomItem())->store($user->uniqueId, $room->id, 18061, 8, 8, 0.00000, 2, ''); |
|
| 141 | - (new RoomItem())->store($user->uniqueId, $room->id, 18061, 8, 9, 0.00000, 6, '1'); |
|
| 142 | - (new RoomItem())->store($user->uniqueId, $room->id, 18061, 10, 8, 0.00000, 4, '1'); |
|
| 143 | - (new RoomItem())->store($user->uniqueId, $room->id, 18070, 8, 2, 1.50000, 0, '1'); |
|
| 144 | - (new RoomItem())->store($user->uniqueId, $room->id, 18079, 9, 8, 0.00000, 0, '1'); |
|
| 145 | - (new RoomItem())->store($user->uniqueId, $room->id, 18363, 3, 9, 0.80000, 0, '2'); |
|
| 146 | - |
|
| 147 | - // Wall Items |
|
| 148 | - (new RoomItem())->store($user->uniqueId, $room->id, 22996, 0, 0, '0', 0, '', ':w=4,8 l=7,45 r'); |
|
| 149 | - (new RoomItem())->store($user->uniqueId, $room->id, 22996, 0, 0, '0', 0, '', ':w=4,8 l=9,45 l'); |
|
| 150 | - (new RoomItem())->store($user->uniqueId, $room->id, 23063, 0, 0, '0', 0, '', ':w=2,10 l=10,56 l'); |
|
| 151 | - (new RoomItem())->store($user->uniqueId, $room->id, 23063, 0, 0, '0', 0, '', ':w=2,11 l=6,58 l'); |
|
| 152 | - (new RoomItem())->store($user->uniqueId, $room->id, 23078, 0, 0, '0', 0, '1', ':w=6,1 l=0,26 r'); |
|
| 153 | - (new RoomItem())->store($user->uniqueId, $room->id, 23078, 0, 0, '0', 0, '3', ':w=7,1 l=4,28 r'); |
|
| 154 | - (new RoomItem())->store($user->uniqueId, $room->id, 23078, 0, 0, '0', 0, '1', ':w=8,1 l=13,33 r'); |
|
| 155 | - (new RoomItem())->store($user->uniqueId, $room->id, 23078, 0, 0, '0', 0, '3', ':w=10,1 l=0,26 r'); |
|
| 156 | - (new RoomItem())->store($user->uniqueId, $room->id, 23229, 0, 0, '0', 0, '1', ':w=4,3 l=6,49 l'); |
|
| 157 | - (new RoomItem())->store($user->uniqueId, $room->id, 23229, 0, 0, '0', 0, '1', ':w=4,5 l=11,45 l'); |
|
| 158 | - |
|
| 159 | - return true; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 100 | + protected function createPoolRoom(User $user): bool |
|
| 101 | + { |
|
| 102 | + $room = (new Room())->store("{$user->name}'s room", "{$user->name} has entered the building", 'model_h', 25, 12, 307, 3104, 1.10, $user->uniqueId, $user->name); |
|
| 103 | + |
|
| 104 | + $user->update(['home_room' => $room->id]); |
|
| 105 | + |
|
| 106 | + // Floor Items |
|
| 107 | + (new RoomItem())->store($user->uniqueId, $room->id, 16715, 5, 11, 1.30000, 0, ''); |
|
| 108 | + (new RoomItem())->store($user->uniqueId, $room->id, 16732, 3, 10, 0.40000, 0, ''); |
|
| 109 | + (new RoomItem())->store($user->uniqueId, $room->id, 17016, 3, 9, 0.00000, 2, '1'); |
|
| 110 | + (new RoomItem())->store($user->uniqueId, $room->id, 17016, 3, 11, 0.00000, 0, ''); |
|
| 111 | + (new RoomItem())->store($user->uniqueId, $room->id, 17016, 4, 9, 0.00000, 4, ''); |
|
| 112 | + (new RoomItem())->store($user->uniqueId, $room->id, 17090, 3, 9, 0.00000, 2, '1'); |
|
| 113 | + (new RoomItem())->store($user->uniqueId, $room->id, 17176, 3, 9, 0.00000, 0, ''); |
|
| 114 | + (new RoomItem())->store($user->uniqueId, $room->id, 17176, 3, 9, 0.40000, 0, ''); |
|
| 115 | + (new RoomItem())->store($user->uniqueId, $room->id, 17176, 3, 10, 0.00000, 0, ''); |
|
| 116 | + (new RoomItem())->store($user->uniqueId, $room->id, 17190, 3, 11, 0.00000, 2, ''); |
|
| 117 | + (new RoomItem())->store($user->uniqueId, $room->id, 17190, 4, 9, 0.00000, 4, ''); |
|
| 118 | + (new RoomItem())->store($user->uniqueId, $room->id, 17191, 3, 10, 0.40000, 2, ''); |
|
| 119 | + (new RoomItem())->store($user->uniqueId, $room->id, 17191, 3, 12, 0.00000, 2, ''); |
|
| 120 | + (new RoomItem())->store($user->uniqueId, $room->id, 17484, 8, 3, 1.00000, 0, '0', 0); |
|
| 121 | + (new RoomItem())->store($user->uniqueId, $room->id, 17499, 7, 3, 1.00000, 2, ''); |
|
| 122 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 7, 2, 1.00000, 0, ''); |
|
| 123 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 7, 4, 1.00000, 0, ''); |
|
| 124 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 7, 5, 1.00000, 0, ''); |
|
| 125 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 8, 2, 1.00000, 0, ''); |
|
| 126 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 8, 5, 1.00000, 0, ''); |
|
| 127 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 9, 2, 1.00000, 0, ''); |
|
| 128 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 9, 5, 1.00000, 0, ''); |
|
| 129 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 10, 2, 1.00000, 0, ''); |
|
| 130 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 10, 3, 1.00000, 0, ''); |
|
| 131 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 10, 4, 1.00000, 0, ''); |
|
| 132 | + (new RoomItem())->store($user->uniqueId, $room->id, 17520, 10, 5, 1.00000, 0, ''); |
|
| 133 | + (new RoomItem())->store($user->uniqueId, $room->id, 17987, 5, 11, 0.00000, 0, ''); |
|
| 134 | + (new RoomItem())->store($user->uniqueId, $room->id, 18051, 5, 2, 1.00000, 0, ''); |
|
| 135 | + (new RoomItem())->store($user->uniqueId, $room->id, 18051, 5, 4, 1.00000, 0, ''); |
|
| 136 | + (new RoomItem())->store($user->uniqueId, $room->id, 18051, 8, 9, 0.00000, 0, ''); |
|
| 137 | + (new RoomItem())->store($user->uniqueId, $room->id, 18051, 8, 11, 0.00000, 0, ''); |
|
| 138 | + (new RoomItem())->store($user->uniqueId, $room->id, 18051, 9, 9, 0.00000, 0, ''); |
|
| 139 | + (new RoomItem())->store($user->uniqueId, $room->id, 18051, 9, 11, 0.00000, 0, ''); |
|
| 140 | + (new RoomItem())->store($user->uniqueId, $room->id, 18061, 8, 8, 0.00000, 2, ''); |
|
| 141 | + (new RoomItem())->store($user->uniqueId, $room->id, 18061, 8, 9, 0.00000, 6, '1'); |
|
| 142 | + (new RoomItem())->store($user->uniqueId, $room->id, 18061, 10, 8, 0.00000, 4, '1'); |
|
| 143 | + (new RoomItem())->store($user->uniqueId, $room->id, 18070, 8, 2, 1.50000, 0, '1'); |
|
| 144 | + (new RoomItem())->store($user->uniqueId, $room->id, 18079, 9, 8, 0.00000, 0, '1'); |
|
| 145 | + (new RoomItem())->store($user->uniqueId, $room->id, 18363, 3, 9, 0.80000, 0, '2'); |
|
| 146 | + |
|
| 147 | + // Wall Items |
|
| 148 | + (new RoomItem())->store($user->uniqueId, $room->id, 22996, 0, 0, '0', 0, '', ':w=4,8 l=7,45 r'); |
|
| 149 | + (new RoomItem())->store($user->uniqueId, $room->id, 22996, 0, 0, '0', 0, '', ':w=4,8 l=9,45 l'); |
|
| 150 | + (new RoomItem())->store($user->uniqueId, $room->id, 23063, 0, 0, '0', 0, '', ':w=2,10 l=10,56 l'); |
|
| 151 | + (new RoomItem())->store($user->uniqueId, $room->id, 23063, 0, 0, '0', 0, '', ':w=2,11 l=6,58 l'); |
|
| 152 | + (new RoomItem())->store($user->uniqueId, $room->id, 23078, 0, 0, '0', 0, '1', ':w=6,1 l=0,26 r'); |
|
| 153 | + (new RoomItem())->store($user->uniqueId, $room->id, 23078, 0, 0, '0', 0, '3', ':w=7,1 l=4,28 r'); |
|
| 154 | + (new RoomItem())->store($user->uniqueId, $room->id, 23078, 0, 0, '0', 0, '1', ':w=8,1 l=13,33 r'); |
|
| 155 | + (new RoomItem())->store($user->uniqueId, $room->id, 23078, 0, 0, '0', 0, '3', ':w=10,1 l=0,26 r'); |
|
| 156 | + (new RoomItem())->store($user->uniqueId, $room->id, 23229, 0, 0, '0', 0, '1', ':w=4,3 l=6,49 l'); |
|
| 157 | + (new RoomItem())->store($user->uniqueId, $room->id, 23229, 0, 0, '0', 0, '1', ':w=4,5 l=11,45 l'); |
|
| 158 | + |
|
| 159 | + return true; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | 163 | * Create the NUX Club Room. |
| 164 | 164 | * |
| 165 | 165 | * @param User $user |
| 166 | 166 | * |
| 167 | 167 | * @return bool |
| 168 | 168 | */ |
| 169 | - protected function createClubRoom(User $user): bool |
|
| 170 | - { |
|
| 171 | - $room = (new Room())->store("{$user->name}'s room", "{$user->name} has entered the building", 'model_h', 25, 12, 409, 1902, 0.0, $user->uniqueId, $user->name); |
|
| 172 | - |
|
| 173 | - $user->update(['home_room' => $room->id]); |
|
| 174 | - |
|
| 175 | - // Floor Items |
|
| 176 | - (new RoomItem())->store($user->uniqueId, $room->id, 16904, 4, 11, '0.00000', 0, '1'); |
|
| 177 | - (new RoomItem())->store($user->uniqueId, $room->id, 16905, 6, 9, '0.00000', 0, '1'); |
|
| 178 | - (new RoomItem())->store($user->uniqueId, $room->id, 16905, 6, 10, '0.00000', 0, '1'); |
|
| 179 | - (new RoomItem())->store($user->uniqueId, $room->id, 16905, 8, 9, '0.00000', 0, '1'); |
|
| 180 | - (new RoomItem())->store($user->uniqueId, $room->id, 16905, 8, 10, '0.00000', 0, '1'); |
|
| 181 | - (new RoomItem())->store($user->uniqueId, $room->id, 16907, 5, 9, '0.00000', 6, ''); |
|
| 182 | - (new RoomItem())->store($user->uniqueId, $room->id, 16907, 5, 10, '0.00000', 6, ''); |
|
| 183 | - (new RoomItem())->store($user->uniqueId, $room->id, 16909, 4, 9, '0.00000', 2, '1'); |
|
| 184 | - (new RoomItem())->store($user->uniqueId, $room->id, 16909, 4, 10, '0.00000', 2, '1'); |
|
| 185 | - (new RoomItem())->store($user->uniqueId, $room->id, 16913, 6, 7, '1.30000', 0, '3'); |
|
| 186 | - (new RoomItem())->store($user->uniqueId, $room->id, 16913, 9, 7, '1.30000', 0, '3'); |
|
| 187 | - (new RoomItem())->store($user->uniqueId, $room->id, 17189, 10, 2, '1.00000', 0, ''); |
|
| 188 | - (new RoomItem())->store($user->uniqueId, $room->id, 17573, 6, 7, '0.00000', 0, '3'); |
|
| 189 | - (new RoomItem())->store($user->uniqueId, $room->id, 17573, 7, 7, '0.00000', 0, '3'); |
|
| 190 | - (new RoomItem())->store($user->uniqueId, $room->id, 17573, 8, 7, '0.00000', 0, '3'); |
|
| 191 | - (new RoomItem())->store($user->uniqueId, $room->id, 17573, 9, 7, '0.00000', 0, '3'); |
|
| 192 | - (new RoomItem())->store($user->uniqueId, $room->id, 18048, 7, 2, '1.00000', 4, ''); |
|
| 193 | - (new RoomItem())->store($user->uniqueId, $room->id, 18082, 6, 3, '1.00000', 2, ''); |
|
| 194 | - (new RoomItem())->store($user->uniqueId, $room->id, 18082, 9, 3, '1.00000', 6, ''); |
|
| 195 | - |
|
| 196 | - // Wall Items |
|
| 197 | - (new RoomItem())->store($user->uniqueId, $room->id, 23008, 0, 0, '0', 0, '2', ':w=4,8 l=0,27 r'); |
|
| 198 | - (new RoomItem())->store($user->uniqueId, $room->id, 23013, 0, 0, '0', 0, '', ':w=2,10 l=2,44 l'); |
|
| 199 | - (new RoomItem())->store($user->uniqueId, $room->id, 23014, 0, 0, '0', 0, '1', ':w=8,1 l=14,27 r'); |
|
| 200 | - (new RoomItem())->store($user->uniqueId, $room->id, 23236, 0, 0, '0', 0, '1', ':w=6,1 l=5,31 r'); |
|
| 201 | - (new RoomItem())->store($user->uniqueId, $room->id, 23239, 0, 0, '0', 0, '', ':w=4,7 l=4,29 l'); |
|
| 202 | - |
|
| 203 | - return true; |
|
| 204 | - } |
|
| 169 | + protected function createClubRoom(User $user): bool |
|
| 170 | + { |
|
| 171 | + $room = (new Room())->store("{$user->name}'s room", "{$user->name} has entered the building", 'model_h', 25, 12, 409, 1902, 0.0, $user->uniqueId, $user->name); |
|
| 172 | + |
|
| 173 | + $user->update(['home_room' => $room->id]); |
|
| 174 | + |
|
| 175 | + // Floor Items |
|
| 176 | + (new RoomItem())->store($user->uniqueId, $room->id, 16904, 4, 11, '0.00000', 0, '1'); |
|
| 177 | + (new RoomItem())->store($user->uniqueId, $room->id, 16905, 6, 9, '0.00000', 0, '1'); |
|
| 178 | + (new RoomItem())->store($user->uniqueId, $room->id, 16905, 6, 10, '0.00000', 0, '1'); |
|
| 179 | + (new RoomItem())->store($user->uniqueId, $room->id, 16905, 8, 9, '0.00000', 0, '1'); |
|
| 180 | + (new RoomItem())->store($user->uniqueId, $room->id, 16905, 8, 10, '0.00000', 0, '1'); |
|
| 181 | + (new RoomItem())->store($user->uniqueId, $room->id, 16907, 5, 9, '0.00000', 6, ''); |
|
| 182 | + (new RoomItem())->store($user->uniqueId, $room->id, 16907, 5, 10, '0.00000', 6, ''); |
|
| 183 | + (new RoomItem())->store($user->uniqueId, $room->id, 16909, 4, 9, '0.00000', 2, '1'); |
|
| 184 | + (new RoomItem())->store($user->uniqueId, $room->id, 16909, 4, 10, '0.00000', 2, '1'); |
|
| 185 | + (new RoomItem())->store($user->uniqueId, $room->id, 16913, 6, 7, '1.30000', 0, '3'); |
|
| 186 | + (new RoomItem())->store($user->uniqueId, $room->id, 16913, 9, 7, '1.30000', 0, '3'); |
|
| 187 | + (new RoomItem())->store($user->uniqueId, $room->id, 17189, 10, 2, '1.00000', 0, ''); |
|
| 188 | + (new RoomItem())->store($user->uniqueId, $room->id, 17573, 6, 7, '0.00000', 0, '3'); |
|
| 189 | + (new RoomItem())->store($user->uniqueId, $room->id, 17573, 7, 7, '0.00000', 0, '3'); |
|
| 190 | + (new RoomItem())->store($user->uniqueId, $room->id, 17573, 8, 7, '0.00000', 0, '3'); |
|
| 191 | + (new RoomItem())->store($user->uniqueId, $room->id, 17573, 9, 7, '0.00000', 0, '3'); |
|
| 192 | + (new RoomItem())->store($user->uniqueId, $room->id, 18048, 7, 2, '1.00000', 4, ''); |
|
| 193 | + (new RoomItem())->store($user->uniqueId, $room->id, 18082, 6, 3, '1.00000', 2, ''); |
|
| 194 | + (new RoomItem())->store($user->uniqueId, $room->id, 18082, 9, 3, '1.00000', 6, ''); |
|
| 195 | + |
|
| 196 | + // Wall Items |
|
| 197 | + (new RoomItem())->store($user->uniqueId, $room->id, 23008, 0, 0, '0', 0, '2', ':w=4,8 l=0,27 r'); |
|
| 198 | + (new RoomItem())->store($user->uniqueId, $room->id, 23013, 0, 0, '0', 0, '', ':w=2,10 l=2,44 l'); |
|
| 199 | + (new RoomItem())->store($user->uniqueId, $room->id, 23014, 0, 0, '0', 0, '1', ':w=8,1 l=14,27 r'); |
|
| 200 | + (new RoomItem())->store($user->uniqueId, $room->id, 23236, 0, 0, '0', 0, '1', ':w=6,1 l=5,31 r'); |
|
| 201 | + (new RoomItem())->store($user->uniqueId, $room->id, 23239, 0, 0, '0', 0, '', ':w=4,7 l=4,29 l'); |
|
| 202 | + |
|
| 203 | + return true; |
|
| 204 | + } |
|
| 205 | 205 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | 'block_friendrequests' => $request->json()->get('friendRequestEnabled') == false ? '1' : '0', |
| 79 | 79 | ]); |
| 80 | 80 | |
| 81 | - foreach ((array) $request->json()->all() as $setting => $value) { |
|
| 81 | + foreach ((array)$request->json()->all() as $setting => $value) { |
|
| 82 | 82 | UserPreferences::find(UserFacade::getUser()->uniqueId)->update([$setting => $value == true ? '1' : '0']); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $token = Mail::store($userInfo['email'], 'public/registration/activate'); |
| 146 | 146 | |
| 147 | - Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName')]); |
|
| 147 | + Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to ' . Config::get('chocolatey.hotelName')]); |
|
| 148 | 148 | |
| 149 | 149 | return UserFacade::setSession((new User())->store($userName, $userInfo['email'], $request->ip(), $newUser)); |
| 150 | 150 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | { |
| 163 | 163 | $partialName = explode(' ', (new Alliteration())->getName()); |
| 164 | 164 | |
| 165 | - return strtolower($partialName[0].strstr($userMail, '@', true).$partialName[1]); |
|
| 165 | + return strtolower($partialName[0] . strstr($userMail, '@', true) . $partialName[1]); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $token = Mail::store(UserFacade::getUser()->email, 'public/registration/activate'); |
| 212 | 212 | |
| 213 | 213 | Mail::send(['name' => UserFacade::getUser()->name, 'email' => $request->user()->email, |
| 214 | - 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName'), |
|
| 214 | + 'url' => "/activate/{$token}", 'subject' => 'Welcome to ' . Config::get('chocolatey.hotelName'), |
|
| 215 | 215 | ]); |
| 216 | 216 | |
| 217 | 217 | return response(null); |
@@ -1,41 +1,41 @@ discard block |
||
| 1 | -<?php |
|
| 2 | - |
|
| 3 | -namespace App\Http\Controllers; |
|
| 4 | - |
|
| 5 | -use App\Facades\Mail; |
|
| 6 | -use App\Facades\User as UserFacade; |
|
| 7 | -use App\Facades\Validation; |
|
| 8 | -use App\Models\ChocolateyId; |
|
| 9 | -use App\Models\User; |
|
| 10 | -use App\Models\UserPreferences; |
|
| 11 | -use App\Models\UserSettings; |
|
| 12 | -use Illuminate\Http\JsonResponse; |
|
| 13 | -use Illuminate\Http\Request; |
|
| 14 | -use Illuminate\Http\Response; |
|
| 15 | -use Illuminate\Support\Facades\Config; |
|
| 16 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 17 | -use Nubs\RandomNameGenerator\Alliteration; |
|
| 1 | + <?php |
|
| 2 | + |
|
| 3 | + namespace App\Http\Controllers; |
|
| 4 | + |
|
| 5 | + use App\Facades\Mail; |
|
| 6 | + use App\Facades\User as UserFacade; |
|
| 7 | + use App\Facades\Validation; |
|
| 8 | + use App\Models\ChocolateyId; |
|
| 9 | + use App\Models\User; |
|
| 10 | + use App\Models\UserPreferences; |
|
| 11 | + use App\Models\UserSettings; |
|
| 12 | + use Illuminate\Http\JsonResponse; |
|
| 13 | + use Illuminate\Http\Request; |
|
| 14 | + use Illuminate\Http\Response; |
|
| 15 | + use Illuminate\Support\Facades\Config; |
|
| 16 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 17 | + use Nubs\RandomNameGenerator\Alliteration; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * Class AccountController. |
| 21 | 21 | */ |
| 22 | -class AccountController extends BaseController |
|
| 23 | -{ |
|
| 24 | - /** |
|
| 22 | + class AccountController extends BaseController |
|
| 23 | + { |
|
| 24 | + /** |
|
| 25 | 25 | * Save User Look. |
| 26 | 26 | * |
| 27 | 27 | * @param Request $request |
| 28 | 28 | * |
| 29 | 29 | * @return JsonResponse |
| 30 | 30 | */ |
| 31 | - public function saveLook(Request $request): JsonResponse |
|
| 32 | - { |
|
| 33 | - UserFacade::updateSession(['look' => $request->json()->get('figure'), 'gender' => $request->json()->get('gender')]); |
|
| 31 | + public function saveLook(Request $request): JsonResponse |
|
| 32 | + { |
|
| 33 | + UserFacade::updateSession(['look' => $request->json()->get('figure'), 'gender' => $request->json()->get('gender')]); |
|
| 34 | 34 | |
| 35 | - return response()->json(UserFacade::getUser()); |
|
| 36 | - } |
|
| 35 | + return response()->json(UserFacade::getUser()); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | + /** |
|
| 39 | 39 | * Get User Non Read Messenger Discussions. |
| 40 | 40 | * |
| 41 | 41 | * @TODO: Code Integration with HabboMessenger |
@@ -43,59 +43,59 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return JsonResponse |
| 45 | 45 | */ |
| 46 | - public function getDiscussions(): JsonResponse |
|
| 47 | - { |
|
| 48 | - return response()->json([]); |
|
| 49 | - } |
|
| 46 | + public function getDiscussions(): JsonResponse |
|
| 47 | + { |
|
| 48 | + return response()->json([]); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 51 | + /** |
|
| 52 | 52 | * Get User Preferences. |
| 53 | 53 | * |
| 54 | 54 | * @return JsonResponse |
| 55 | 55 | */ |
| 56 | - public function getPreferences(): JsonResponse |
|
| 57 | - { |
|
| 58 | - $userPreferences = UserPreferences::find(UserFacade::getUser()->uniqueId); |
|
| 56 | + public function getPreferences(): JsonResponse |
|
| 57 | + { |
|
| 58 | + $userPreferences = UserPreferences::find(UserFacade::getUser()->uniqueId); |
|
| 59 | 59 | |
| 60 | - foreach ($userPreferences->getAttributes() as $attributeName => $attributeValue) { |
|
| 61 | - $userPreferences->{$attributeName} = $attributeValue == 1; |
|
| 62 | - } |
|
| 60 | + foreach ($userPreferences->getAttributes() as $attributeName => $attributeValue) { |
|
| 61 | + $userPreferences->{$attributeName} = $attributeValue == 1; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - return response()->json($userPreferences); |
|
| 65 | - } |
|
| 64 | + return response()->json($userPreferences); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 67 | + /** |
|
| 68 | 68 | * Save New User Preferences. |
| 69 | 69 | * |
| 70 | 70 | * @param Request $request |
| 71 | 71 | * |
| 72 | 72 | * @return Response |
| 73 | 73 | */ |
| 74 | - public function savePreferences(Request $request): Response |
|
| 75 | - { |
|
| 76 | - UserSettings::updateOrCreate(['user_id' => UserFacade::getUser()->uniqueId], [ |
|
| 77 | - 'block_following' => $request->json()->get('friendCanFollow') == false ? '1' : '0', |
|
| 78 | - 'block_friendrequests' => $request->json()->get('friendRequestEnabled') == false ? '1' : '0', |
|
| 79 | - ]); |
|
| 74 | + public function savePreferences(Request $request): Response |
|
| 75 | + { |
|
| 76 | + UserSettings::updateOrCreate(['user_id' => UserFacade::getUser()->uniqueId], [ |
|
| 77 | + 'block_following' => $request->json()->get('friendCanFollow') == false ? '1' : '0', |
|
| 78 | + 'block_friendrequests' => $request->json()->get('friendRequestEnabled') == false ? '1' : '0', |
|
| 79 | + ]); |
|
| 80 | 80 | |
| 81 | - foreach ((array) $request->json()->all() as $setting => $value) { |
|
| 82 | - UserPreferences::find(UserFacade::getUser()->uniqueId)->update([$setting => $value == true ? '1' : '0']); |
|
| 83 | - } |
|
| 81 | + foreach ((array) $request->json()->all() as $setting => $value) { |
|
| 82 | + UserPreferences::find(UserFacade::getUser()->uniqueId)->update([$setting => $value == true ? '1' : '0']); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - return response(null); |
|
| 86 | - } |
|
| 85 | + return response(null); |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 88 | + /** |
|
| 89 | 89 | * Get All E-Mail Accounts. |
| 90 | 90 | * |
| 91 | 91 | * @return JsonResponse |
| 92 | 92 | */ |
| 93 | - public function getAvatars(): JsonResponse |
|
| 94 | - { |
|
| 95 | - return response()->json(UserFacade::getUser()->getChocolateyId()->relatedAccounts); |
|
| 96 | - } |
|
| 93 | + public function getAvatars(): JsonResponse |
|
| 94 | + { |
|
| 95 | + return response()->json(UserFacade::getUser()->getChocolateyId()->relatedAccounts); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 98 | + /** |
|
| 99 | 99 | * Check if an Username is available |
| 100 | 100 | * for a new Avatar Account. |
| 101 | 101 | * |
@@ -103,33 +103,33 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @return JsonResponse |
| 105 | 105 | */ |
| 106 | - public function checkName(Request $request): JsonResponse |
|
| 107 | - { |
|
| 108 | - return response()->json(['isAvailable' => (User::where('username', $request->input('name'))->count() == 0 |
|
| 109 | - && Validation::filterUserName($request->input('name')) && !UserFacade::getUser()->isStaff)]); |
|
| 110 | - } |
|
| 106 | + public function checkName(Request $request): JsonResponse |
|
| 107 | + { |
|
| 108 | + return response()->json(['isAvailable' => (User::where('username', $request->input('name'))->count() == 0 |
|
| 109 | + && Validation::filterUserName($request->input('name')) && !UserFacade::getUser()->isStaff)]); |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - /** |
|
| 112 | + /** |
|
| 113 | 113 | * Create a New User Avatar. |
| 114 | 114 | * |
| 115 | 115 | * @param Request $request |
| 116 | 116 | * |
| 117 | 117 | * @return JsonResponse |
| 118 | 118 | */ |
| 119 | - public function createAvatar(Request $request): JsonResponse |
|
| 120 | - { |
|
| 121 | - if (User::where('username', $request->json()->get('name'))->count() == 0 && Validation::filterUserName($request->json()->get('name'))) { |
|
| 122 | - $user = $this->createUser($request, ['username' => $request->json()->get('name'), 'email' => UserFacade::getUser()->email]); |
|
| 119 | + public function createAvatar(Request $request): JsonResponse |
|
| 120 | + { |
|
| 121 | + if (User::where('username', $request->json()->get('name'))->count() == 0 && Validation::filterUserName($request->json()->get('name'))) { |
|
| 122 | + $user = $this->createUser($request, ['username' => $request->json()->get('name'), 'email' => UserFacade::getUser()->email]); |
|
| 123 | 123 | |
| 124 | - ChocolateyId::find(UserFacade::getUser()->email)->update(['last_logged_id' => $user->uniqueId]); |
|
| 124 | + ChocolateyId::find(UserFacade::getUser()->email)->update(['last_logged_id' => $user->uniqueId]); |
|
| 125 | 125 | |
| 126 | - return response()->json(''); |
|
| 127 | - } |
|
| 126 | + return response()->json(''); |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - return response()->json(''); |
|
| 130 | - } |
|
| 129 | + return response()->json(''); |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - /** |
|
| 132 | + /** |
|
| 133 | 133 | * Create a New User. |
| 134 | 134 | * |
| 135 | 135 | * @param Request $request |
@@ -138,18 +138,18 @@ discard block |
||
| 138 | 138 | * |
| 139 | 139 | * @return User |
| 140 | 140 | */ |
| 141 | - public function createUser(Request $request, array $userInfo, bool $newUser = false): User |
|
| 142 | - { |
|
| 143 | - $userName = $newUser ? $this->uniqueName($userInfo['email']) : $userInfo['username']; |
|
| 141 | + public function createUser(Request $request, array $userInfo, bool $newUser = false): User |
|
| 142 | + { |
|
| 143 | + $userName = $newUser ? $this->uniqueName($userInfo['email']) : $userInfo['username']; |
|
| 144 | 144 | |
| 145 | - $token = Mail::store($userInfo['email'], 'public/registration/activate'); |
|
| 145 | + $token = Mail::store($userInfo['email'], 'public/registration/activate'); |
|
| 146 | 146 | |
| 147 | - Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName')]); |
|
| 147 | + Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName')]); |
|
| 148 | 148 | |
| 149 | - return UserFacade::setSession((new User())->store($userName, $userInfo['email'], $request->ip(), $newUser)); |
|
| 150 | - } |
|
| 149 | + return UserFacade::setSession((new User())->store($userName, $userInfo['email'], $request->ip(), $newUser)); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - /** |
|
| 152 | + /** |
|
| 153 | 153 | * Create Random Unique Username. |
| 154 | 154 | * |
| 155 | 155 | * @WARNING: Doesn't create Like Habbo Way |
@@ -158,62 +158,62 @@ discard block |
||
| 158 | 158 | * |
| 159 | 159 | * @return string |
| 160 | 160 | */ |
| 161 | - protected function uniqueName(string $userMail): string |
|
| 162 | - { |
|
| 163 | - $partialName = explode(' ', (new Alliteration())->getName()); |
|
| 161 | + protected function uniqueName(string $userMail): string |
|
| 162 | + { |
|
| 163 | + $partialName = explode(' ', (new Alliteration())->getName()); |
|
| 164 | 164 | |
| 165 | - return strtolower($partialName[0].strstr($userMail, '@', true).$partialName[1]); |
|
| 166 | - } |
|
| 165 | + return strtolower($partialName[0].strstr($userMail, '@', true).$partialName[1]); |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - /** |
|
| 168 | + /** |
|
| 169 | 169 | * Change Logged In User. |
| 170 | 170 | * |
| 171 | 171 | * @param Request $request |
| 172 | 172 | */ |
| 173 | - public function selectAvatar(Request $request) |
|
| 174 | - { |
|
| 175 | - UserFacade::getUser()->getChocolateyId()->update(['last_logged_id' => $request->json()->get('uniqueId')]); |
|
| 173 | + public function selectAvatar(Request $request) |
|
| 174 | + { |
|
| 175 | + UserFacade::getUser()->getChocolateyId()->update(['last_logged_id' => $request->json()->get('uniqueId')]); |
|
| 176 | 176 | |
| 177 | - UserFacade::setSession(User::find($request->json()->get('uniqueId'))); |
|
| 178 | - } |
|
| 177 | + UserFacade::setSession(User::find($request->json()->get('uniqueId'))); |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - /** |
|
| 180 | + /** |
|
| 181 | 181 | * Send User Forgot E-Mail. |
| 182 | 182 | * |
| 183 | 183 | * @param Request $request |
| 184 | 184 | * |
| 185 | 185 | * @return JsonResponse |
| 186 | 186 | */ |
| 187 | - public function forgotPassword(Request $request): JsonResponse |
|
| 188 | - { |
|
| 189 | - if (($user = User::where('mail', $request->json()->get('email'))->first()) == null) { |
|
| 190 | - return response()->json(['email' => $request->json()->get('email')]); |
|
| 191 | - } |
|
| 187 | + public function forgotPassword(Request $request): JsonResponse |
|
| 188 | + { |
|
| 189 | + if (($user = User::where('mail', $request->json()->get('email'))->first()) == null) { |
|
| 190 | + return response()->json(['email' => $request->json()->get('email')]); |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - $token = Mail::store($user->email, 'public/forgotPassword'); |
|
| 193 | + $token = Mail::store($user->email, 'public/forgotPassword'); |
|
| 194 | 194 | |
| 195 | - Mail::send(['name' => $user->name, 'email' => $user->email, 'subject' => 'Password reset confirmation', |
|
| 196 | - 'url' => "/reset-password/{$token}", |
|
| 197 | - ], 'habbo-web-mail.password-reset'); |
|
| 195 | + Mail::send(['name' => $user->name, 'email' => $user->email, 'subject' => 'Password reset confirmation', |
|
| 196 | + 'url' => "/reset-password/{$token}", |
|
| 197 | + ], 'habbo-web-mail.password-reset'); |
|
| 198 | 198 | |
| 199 | - return response()->json(['email' => $user->email]); |
|
| 200 | - } |
|
| 199 | + return response()->json(['email' => $user->email]); |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | - /** |
|
| 202 | + /** |
|
| 203 | 203 | * Send an Account Confirmation E-Mail. |
| 204 | 204 | * |
| 205 | 205 | * @param Request $request |
| 206 | 206 | * |
| 207 | 207 | * @return Response |
| 208 | 208 | */ |
| 209 | - public function verifyAccount(Request $request): Response |
|
| 210 | - { |
|
| 211 | - $token = Mail::store(UserFacade::getUser()->email, 'public/registration/activate'); |
|
| 209 | + public function verifyAccount(Request $request): Response |
|
| 210 | + { |
|
| 211 | + $token = Mail::store(UserFacade::getUser()->email, 'public/registration/activate'); |
|
| 212 | 212 | |
| 213 | - Mail::send(['name' => UserFacade::getUser()->name, 'email' => $request->user()->email, |
|
| 214 | - 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName'), |
|
| 215 | - ]); |
|
| 213 | + Mail::send(['name' => UserFacade::getUser()->name, 'email' => $request->user()->email, |
|
| 214 | + 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName'), |
|
| 215 | + ]); |
|
| 216 | 216 | |
| 217 | - return response(null); |
|
| 218 | - } |
|
| 217 | + return response(null); |
|
| 218 | + } |
|
| 219 | 219 | } |