{ self::$Rooms = []; } public static function GetRoom($id) { if (isset(self::$Rooms[$id])) { return self::$Rooms[$id]; } $query = DB::RunFastQuery("SELECT * FROM rooms_data WHERE id = '{$id}'"); if ($query->NumRows() == 0) { return null; } $roomdata = $query->UniqueRow(); $room = new Room($roomdata); self::$Rooms[$id] = $room; return $room; } public static function GetRoomsByOwnerName($name) { $array = []; $query = DB::RunFastQuery("SELECT * FROM rooms_data WHERE owner = '{$name}'"); foreach ($query->Rows as $row) { $room = new Room($row); $array[] = $room; self::$Rooms[$room->id] = $room; } return new RoomCollection($array); } } RoomManager::Init();
if ($userid == "" && $username == "") { do_error("NO_PARAMS"); } if ($userid == "") { $habbo = Habbo::GetHabboByName($username); } else { $habbo = Habbo::GetHabboById($userid); } if (!$habbo) { do_error("USER_NOT_FOUND"); } $jsondata = []; $userdata = ["username" => $habbo->username, "motto" => $habbo->motto, "look" => $habbo->look, "last_online" => $habbo->last_online, "account_created" => $habbo->account_created, "seasonal_currency" => $habbo->seasonal_currency, "credits" => $habbo->credits, "activity_points" => $habbo->activity_points]; $relations = []; $badges = []; $rooms = Rooms::GetRoomsByOwnerName($habbo->username)->ParseToPublicArray(); ### Get RelatioShips $query = DB::RunFastQuery("SELECT * FROM users_relationships WHERE user_id = '{$habbo->id}'"); foreach ($query->Rows as $row) { $ruser = Habbo::GetHabboById($row["target"]); if (!$ruser) { continue; } $relations[$row["type"]][] = ["username" => $ruser->username, "look" => $ruser->look, "motto" => $ruser->motto]; } ### Get Badges $query = DB::RunFastQuery("SELECT * FROM users_badges WHERE user_id = '{$habbo->id}'"); foreach ($query->Rows as $bad) { $badges[] = $bad["badge_id"]; } ##Get Rooms