Core
Member
- Nov 10, 2016
- 356
- 138
Alternative to this method you could always just save the users figure in the notifications folder and use that as a reference but it can also be done using a rewrite rule so that the image is updated when the user changes there looks.
How it works,
It will use a rewrite rule which filters for /fig/{data}.png in the notifications folder. In return meaning that you can use $"fig/{Session.GetHabbo().Look}" as the image argument for RoomNotificationComposer. To set it up, it's really easy.
Go to your c_images folder and create an .htaccess file (if using apachie, you will need a web.config for iis). The inside this file put;
The reason I have put the rule in c_images as I wrote several scripts for this is because released swfs are cluttered with things that aren't needed. So I just wiped the entire c_images and wrote a 404 handler which requests file from habbo if it doesn't exist; that way not using large swfs. However, you could alternatively put it in the notifications folder but just remove the notifications/ from the rule. This script was wrote for the notifications only but can easily be modified if you wish to do the same as me.
Now you have rule set up, you want to create a file called user.php in c_images/notifications. Inside the file put the following
And, finally. Sending the new image to the client (this just goes where ever you want to send it...);
You may need to add reference to the namespace for RoomNotificationComposer. Here is how;
Add the following to the top of the file...
How it works,
It will use a rewrite rule which filters for /fig/{data}.png in the notifications folder. In return meaning that you can use $"fig/{Session.GetHabbo().Look}" as the image argument for RoomNotificationComposer. To set it up, it's really easy.
Go to your c_images folder and create an .htaccess file (if using apachie, you will need a web.config for iis). The inside this file put;
Code:
RewriteEngine On
RewriteRule ^notifications/fig/([A-Za-z0-9-\.]+).png(|/)$ notifications/user.php?fig=$1
The reason I have put the rule in c_images as I wrote several scripts for this is because released swfs are cluttered with things that aren't needed. So I just wiped the entire c_images and wrote a 404 handler which requests file from habbo if it doesn't exist; that way not using large swfs. However, you could alternatively put it in the notifications folder but just remove the notifications/ from the rule. This script was wrote for the notifications only but can easily be modified if you wish to do the same as me.
Now you have rule set up, you want to create a file called user.php in c_images/notifications. Inside the file put the following
Code:
<?php
if(!isset($_GET["fig"]) || empty($_GET["fig"])) {
echo "No fig request";
exit;
}
$ch = curl_init("https://www.habbo.com.br/habbo-imaging/avatarimage?hb=img&figure={$_GET["fig"]}&action=wav&direction=2&head_direction=3&size=m");
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
CURLOPT_AUTOREFERER => true,
CURLOPT_SSL_VERIFYPEER => false
));
$content = curl_exec($ch);
$type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
curl_close($ch);
if(!isset($content) || empty($content) || strpos($content, 'Not Found') !== false) {
echo "Not found!";
exit;
}
header("Content-Type: {$type}");
echo $content;
?>
And, finally. Sending the new image to the client (this just goes where ever you want to send it...);
Code:
Session.SendMessage(new RoomNotificationComposer("Title Example", "Content Example", $"fig/{Session.GetHabbo().Look}");
You may need to add reference to the namespace for RoomNotificationComposer. Here is how;
Add the following to the top of the file...
Code:
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
Last edited: