Furniture, pets AND clothes with zoomout + automated script (last update: 04-07-2015)
Hello ragezone,
I've made a script which will make the zoomout images and codes automatically, so it will take me about 30 minutes (because I have to decompile, run my script, export) to fix the new released furniture, pets and clothes from habbo.
I will also release my script here, but I'm not going to help if you can't get it working.
I will post the zoomout furnitures, pets and clothes anyway, so you might not even need my script.
Here's are my scripts (these are for furniture and pets):
index.php
PHP Code:
<?php
#version 1.0.5
$start_time = microtime(TRUE);
include('SimpleImage.php');
function sortt($a,$b){
return strlen($a)-strlen($b);
}
function delendoor2($matches)
{
if($matches[2]%2 != 0)
{
$helft = $matches[2] / 2 - 0.5;
}
else
{
$helft = $matches[2] / 2;
}
return $matches[1] . $helft . $matches[3] ;
}
$daarna = "src";
$testing = 0;
echo'<pre>';
$tellen = 0;
$dirs = array_filter(glob('*'), 'is_dir');
foreach($dirs as $mapnaam)
{
if(strpos($mapnaam,'.swf.flex') !== false)
{
$tellen ++;
$map = $mapnaam .'/'. $daarna;
$bestanden = scandir($map);
unset($bestanden[0]);
unset($bestanden[1]);
usort($bestanden,'sortt');
$teltel = 0;
$basename = 'test';
while(strpos($basename,'.as') === false)
{
$basename = $bestanden[$teltel];
$teltel++;
}
$basename = substr($basename, 0, -3);
foreach($bestanden as $bestand)
{
$laatste3 = substr($bestand, -3);
if($laatste3 != 'png')
{
if($bestand == $basename .'.as' && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
fclose($myfile);
$regels = explode('<br />', nl2br($content));
foreach($regels as $key => $regel)
{
$newregels[] = $regel;
if(strpos($regel,'_64_') !== false)
{
$newregels[] = '';
$newregels[] = str_replace('_64_', '_32_', $regel);
}
}
$newregels[] = '';
$regels = implode('', $newregels);
file_put_contents($map .'/'. $bestand,$regels);
}
unset($newregels);
if(strpos($bestand,'_64_') !== false && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
$content = str_replace('_64_', '_32_', $content);
fclose($myfile);
$bestandsnaam = str_replace('_64_', '_32_', $bestand);
file_put_contents($map .'/'. $bestandsnaam,$content);
}
if($basename .'_'. $basename .'_assets.dat' == $bestand && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
fclose($myfile);
$regels = explode('<br />', nl2br($content));
foreach($regels as $key => $regel)
{
$newregels[] = $regel;
if(strpos($regel,'_64_') !== false)
{
$newregels[] = preg_replace_callback('/(x="-?)(\d+)(")/', 'delendoor2', preg_replace_callback('/(y="-?)(\d+)(")/', 'delendoor2', str_replace('_64_', '_32_', $regel)));
}
}
$newregels[] = '';
$regels = implode('', $newregels);
file_put_contents($map .'/'. $bestand,$regels);
}
unset($newregels);
if($basename .'_'. $basename .'_logic.dat' == $bestand && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
fclose($myfile);
$regels = explode('<br />', nl2br($content));
foreach($regels as $key => $regel)
{
$newregels[] = $regel;
if(strpos($regel,'size="64"') !== false)
{
$newregels[] = str_replace('size="64"', 'size="32"', $regel);
}
}
$newregels[] = '';
$regels = implode('', $newregels);
file_put_contents($map .'/'. $bestand,$regels);
}
unset($newregels);
if($basename .'_'. $basename .'_visualization.dat' == $bestand && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
$regels = explode('<br />', nl2br($content));
$regelaan = 0;
$regelsweg = 0;
foreach($regels as $key => $regel)
{
if((strpos($regel,'size="64"') !== false || $regelaan == 1) && strpos($regel,'</visualizationData>') === false)
{
$newregels[] = str_replace('size="64"', 'size="32"', $regel);
$regelaan = 1;
}
}
foreach($regels as $key => $regel)
{
if(strpos($regel,'</visualizationData>') !== false)
{
$sluitkey = $key;
}
}
if(count($newregels) > 0)
{
$newregels = array_reverse($newregels);
foreach($newregels as $newregel)
{
array_splice($regels, $sluitkey, 0, $newregel);
}
}
foreach($regels as $key => $regel)
{
if(strpos($regel,'size="32"') !== false && $regelsweg != 2)
{
$regelsweg = 1;
}
if(strpos($regel,'size="64"') !== false)
{
$regelsweg = 2;
}
if($regelsweg == 1)
{
unset($regels[$key]);
}
}
fclose($myfile);
$regels = implode('', $regels);
file_put_contents($map .'/'. $bestand,$regels);
}
unset($newregels);
if($basename .'_manifest.dat' == $bestand && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
fclose($myfile);
$regels = explode('<br />', nl2br($content));
foreach($regels as $key => $regel)
{
$newregels[] = $regel;
if(strpos($regel,'_64_') !== false)
{
$newregels[] = str_replace('_64_', '_32_', $regel);
}
}
$regels = implode('', $newregels);
file_put_contents($map .'/'. $bestand,$regels);
}
unset($newregels);
if($basename .'_index.dat' == $bestand && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
fclose($myfile);
$content = str_replace('furniture_purchasable_clothing', 'furniture_multistate', $content);
file_put_contents($map .'/'. $bestand,$content);
}
}
else if($laatste3 == 'png' && strpos($bestand,'icon') === false && $testing != 1)
{
$image = new SimpleImage();
$image->load($map . '/' . $bestand);
if($image->getWidth() > 1 && $image->getHeight() > 1)
{
if($image->getWidth()%2 != 0)
{
$image->resizeToWidth($image->getWidth() / 2 + 0.5);
}
else
{
$image->resizeToWidth($image->getWidth() / 2);
}
}
$nieuwenaam = str_replace('64', '32', $bestand);
$image->save($map . '/' . $nieuwenaam);
}
}
}
}
$end_time = microtime(TRUE);
$time_taken = $end_time - $start_time;
$time_taken = round($time_taken,5);
echo $tellen .' Furniture generated in '.$time_taken.' seconds.';
?>
SimpleImage.php
PHP Code:
<?php
/*
* File: SimpleImage.php
* Author: Simon Jarvis
* Copyright: 2006 Simon Jarvis
* Date: 08/11/06
* Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
* http://www.gnu.org/licenses/gpl.html
*
*/
class SimpleImage {
var $image;
var $image_type;
function load($filename) {
$image_info = getimagesize($filename);
$this->image_type = $image_info[2];
if( $this->image_type == IMAGETYPE_JPEG ) {
$this->image = imagecreatefromjpeg($filename);
} elseif( $this->image_type == IMAGETYPE_GIF ) {
$this->image = imagecreatefromgif($filename);
} elseif( $this->image_type == IMAGETYPE_PNG ) {
$this->image = imagecreatefrompng($filename);
}
}
function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) {
// do this or they'll all go to jpeg
$image_type=$this->image_type;
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image,$filename,$compression);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image,$filename);
} elseif( $image_type == IMAGETYPE_PNG ) {
// need this for transparent png to work
imagealphablending($this->image, false);
imagesavealpha($this->image,true);
imagepng($this->image,$filename);
}
if( $permissions != null) {
chmod($filename,$permissions);
}
}
function output($image_type=IMAGETYPE_JPEG) {
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image);
} elseif( $image_type == IMAGETYPE_PNG ) {
imagepng($this->image);
}
}
function getWidth() {
return imagesx($this->image);
}
function getHeight() {
return imagesy($this->image);
}
function resizeToHeight($height) {
$ratio = $height / $this->getHeight();
$width = $this->getWidth() * $ratio;
$this->resize($width,$height);
}
function resizeToWidth($width) {
$ratio = $width / $this->getWidth();
$height = $this->getheight() * $ratio;
$this->resize($width,$height);
}
function scale($scale) {
$width = $this->getWidth() * $scale/100;
$height = $this->getheight() * $scale/100;
$this->resize($width,$height);
}
function resize($width,$height, $xx = 0, $yy = 0, $ww = '', $hh = '') {
$new_image = imagecreatetruecolor($width, $height);
/* Check if this image is PNG or GIF, then set if Transparent*/
if(($this->image_type == IMAGETYPE_GIF) || ($this->image_type==IMAGETYPE_PNG)){
imagealphablending($new_image, false);
imagesavealpha($new_image,true);
$transparent = imagecolorallocatealpha($new_image, 255, 255, 255, 127);
imagefilledrectangle($new_image, 0, 0, $width, $height, $transparent);
}
if($ww != '') {
$widthh = $ww;
} else {
$widthh = $this->getWidth();
}
if($hh != '') {
$heighth = $hh;
} else {
$heighth = $this->getHeight();
}
imagecopyresampled($new_image, $this->image, 0, 0, $xx, $yy, $width, $height, $widthh, $heighth);
$this->image = $new_image;
}
}
?>
How to use these scripts:
- Put them in a directory of your choice.
- Decompile the furniture (without the graphic tags) with decompiler trillix (to get a .flex project).
- Copy all flex project directories to the same directory of your scripts.
- Run index.php.
- ???
Profit.
Now you can import them into flash builder 4.6 and export them right away, voila, you're done.
For the people wondering why I did this in php, I love php and I was sure I could make it with php.
Also, almost everyone runs php on their server, so everyone should be able to run this script (if you have the gd library extension turned on from php).
I've made a new script to rename custom furniture really fast.
- First you decompile (with trillix decompiler to a .flex project) an existing furniture, you want to recolor, or just remake, or whatever.
- Place it in the same directory as this code
- Edit the name in the script ($newname)
- Run the script
Done!
namechange.php
PHP Code:
<?php
#version 1.0.1
$start_time = microtime(TRUE);
$newname = "newfurniname"; //Edit this field to your new furni name
$daarna = "src";
$testing = 0;
echo'<pre>';
$tellen = 0;
$dirs = array_filter(glob('*'), 'is_dir');
foreach($dirs as $mapnaam)
{
if(strpos($mapnaam,'.swf.flex') !== false)
{
$tellen ++;
$map = $mapnaam .'/'. $daarna;
$meubel = substr($mapnaam, 0, -9);
$projecten = scandir($mapnaam);
$bestanden = scandir($map);
unset($bestanden[0]);
unset($bestanden[1]);
unset($projecten[0]);
unset($projecten[1]);
foreach($projecten as $project)
{
if($project != $daarna && $testing != 1)
{
$myfile = fopen($mapnaam .'/'. $project, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($mapnaam .'/'. $project));
$content = str_replace($meubel, $newname, $content);
file_put_contents($mapnaam .'/'. $project,$content);
}
}
foreach($bestanden as $bestand)
{
$laatste3 = substr($bestand, -3);
if($laatste3 != 'png' && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
$content = str_replace($meubel, $newname, $content);
fclose($myfile);
file_put_contents($map .'/'. $bestand,$content);
$newbestand = str_replace($meubel, $newname, $bestand);
rename($map .'/'. $bestand, $map .'/'. $newbestand);
}
else if($laatste3 == 'png' && $testing != 1)
{
$newbestand = str_replace($meubel, $newname, $bestand);
rename($map .'/'. $bestand, $map .'/'. $newbestand);
}
}
if($testing != 1)
{
$newmap = str_replace($meubel, $newname, $mapnaam);
rename($mapnaam, $newmap);
}
}
}
$end_time = microtime(TRUE);
$time_taken = $end_time - $start_time;
$time_taken = round($time_taken,5);
echo $tellen .' Files generated in '.$time_taken.' seconds.';
?>
Here's the script to get clothes with zoomout.
You'll need to add the SimpleImage.php script to the same directory to get it working as well (see above)
Instructions: The same as furniture.
clothes.php
PHP Code:
<?php
#version 1.0.1
$start_time = microtime(TRUE);
include('SimpleImage.php');
function sortt($a,$b){
return strlen($a)-strlen($b);
}
function delendoor2($matches)
{
if($matches[2]%2 != 0)
{
$helft = $matches[2] / 2 - 0.5;
}
else
{
$helft = $matches[2] / 2;
}
return $matches[1] . $helft . $matches[3] ;
}
function delendoor2value($matches)
{
if($matches[2]%2 != 0)
{
$helft = $matches[2] / 2 - 0.5;
}
else
{
$helft = $matches[2] / 2;
}
if($matches[4]%2 != 0)
{
$helft4 = $matches[4] / 2 - 0.5;
}
else
{
$helft4 = $matches[4] / 2;
}
return $matches[1] . $helft . $matches[3] . $helft4 . $matches[5] ;
}
$daarna = "src";
$testing = 0;
echo'<pre>';
$tellen = 0;
$dirs = array_filter(glob('*'), 'is_dir');
foreach($dirs as $mapnaam)
{
$tellen ++;
$map = $mapnaam .'/'. $daarna;
$bestanden = scandir($map);
unset($bestanden[0]);
unset($bestanden[1]);
usort($bestanden,'sortt');
$basename = substr($bestanden[0], 0, -3);
foreach($bestanden as $bestand)
{
$laatste3 = substr($bestand, -3);
if($laatste3 != 'png')
{
if($bestand == $basename .'.as' && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
$regels = explode('<br />', nl2br($content));
foreach($regels as $key => $regel)
{
if(strpos($regel,'_h_') !== false)
{
$newregels[] = '';
$newregels[] = str_replace('_h_', '_sh_', str_replace(' h_', ' sh_', $regel));
}
if($regel == '
}')
{
$sluitkey = $key;
}
}
$newregels[] = '';
foreach($newregels as $newregel)
{
array_splice($regels, $sluitkey, 0, $newregel);
}
fclose($myfile);
$regels = implode('', $regels);
file_put_contents($map .'/'. $bestand,$regels);
}
unset($newregels);
if(strpos($bestand,'_h_') !== false && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
$content = str_replace('_h_', '_sh_', $content);
fclose($myfile);
$bestandsnaam = str_replace('_h_', '_sh_', $bestand);
file_put_contents($map .'/'. $bestandsnaam,$content);
}
unset($newregels);
if($basename .'_manifest.dat' == $bestand && $testing != 1)
{
$myfile = fopen($map .'/'. $bestand, "r") or die("Unable to open file!");
$content = fread($myfile,filesize($map .'/'. $bestand));
$regels = explode('<br />', nl2br($content));
foreach($regels as $key => $regel)
{
if(strpos($regel,'name="h_') !== false)
{
$newregels[] = str_replace('name="h_', 'name="sh_', $regel);
}
if(strpos($regel,'<param') !== false)
{
$newregels[] = preg_replace_callback('/(value="-?)(\d+)(,-?)(\d+)(")/', 'delendoor2value', $regel);
}
if(strpos($regel,'</asset>') !== false)
{
$newregels[] = $regel;
}
if(strpos($regel,'</assets>') !== false)
{
$sluitkey = $key;
}
}
if(count($newregels) > 0)
{
$newregels = array_reverse($newregels);
foreach($newregels as $newregel)
{
array_splice($regels, $sluitkey, 0, $newregel);
}
}
fclose($myfile);
$regels = implode('', $regels);
file_put_contents($map .'/'. $bestand,$regels);
}
unset($newregels);
}
else if($laatste3 == 'png' && $testing != 1)
{
$image = new SimpleImage();
$image->load($map . '/' . $bestand);
if($image->getWidth() > 1 && $image->getHeight() > 1)
{
if($image->getWidth()%2 != 0)
{
$image->resizeToWidth($image->getWidth() / 2 + 0.5);
}
else
{
$image->resizeToWidth($image->getWidth() / 2);
}
}
$nieuwenaam = str_replace('_h_', '_sh_', $bestand);
$image->save($map . '/' . $nieuwenaam);
}
}
}
$end_time = microtime(TRUE);
$time_taken = $end_time - $start_time;
$time_taken = round($time_taken,5);
echo $tellen .' Furniture generated in '.$time_taken.' seconds.';
?>
Here are the zoomout furniture I have fixed for now:
Dino:
Download
Infobus:
Download
Army:
Download
Paris:
Download
Screenshot paris and dino:
Click here
Theatre and some more furni
Download
Screenshot Theatre and some more furni:
Click here
32+1 Clothes with zoomout, including new dino clothes:
Download
Download
Screenshot of pets and clothes with zoomout:
Click here
(dino clothes look better already in the new download)
Here's a screenshot of the other clothes:
Click here
2 new furni with zoomout, youtube logic changed to static furniture, no graphic tags:
Download
15 habbo15 furni with zoomout:
Download
12 furni with goth furni and stuff with zoomout:
Download
Well I hope you'll be happy with these.
Cya,
-Ricardo
edit:
p.s. I'm also working on a script for zoomout clothes, should be done soon™
edit2:
Confirmed working for pets, just not looking great..
edit3:
Added theatre and more furni
edit4:
Made a code to rename custom furniture really fast
Also finished the code for zoomout clothes, you can check my reply to test the, if they work I'll post the script in the thread.
edit5:
Finished the script for clothes with zoomout images and stuff, looks better than pets, but it's not perfect!
edit6:
For clothes, -0.5 seem to work better than + 0.5, if it's ugly with +0.5, try using -0.5. I've switched to default - 0.5 for now.
edit7:
Added 32 clothes with zoomout, with reworked dino clothes included
edit8:
forgot skulldino.swf, added it
edit9:
added 2 new furni
edit10:
Fixed 2 scripts, new versions added
edit11:
added 15 habbo15 furni with zoomout
edit12:
added 12 goth and more furni with zoomout
Re: Furniture with zoomout + automated script
Great release, this will help many people, I will try this out myself soon.
Re: Furniture with zoomout + automated script
awesome man! really really awesome!
How about pets? that would be a bit harder :D
Re: Furniture with zoomout + automated script
Quote:
Originally Posted by
Scresho
awesome man! really really awesome!
How about pets? that would be a bit harder :D
hmm I should be able to make those too, it's on my list of to-do things now, thanks!
Re: Furniture with zoomout + automated script
Thanks for this nice release! Like your way of programming. Hope you will release the zoomout images anyways here.
Re: Furniture with zoomout + automated script
Quote:
Originally Posted by
Scresho
awesome man! really really awesome!
How about pets? that would be a bit harder :D
Looks like my code even works for pets, I can't test them right now, but here are the 2 new dino pets with zoomout, could you test them and post a screenshot?
Download
Re: Furniture with zoomout + automated script
The pets zoomout are a little bit weird. Here is the screenshot: Screenshot by Lightshot
Re: Furniture with zoomout + automated script
Quote:
Originally Posted by
MovieGuy
Looks like my code even works for pets, I can't test them right now, but here are the 2 new dino pets with zoomout, could you test them and post a screenshot?
Download
http://puu.sh/iuT36/3df6d6e1a0.png
They do work, but they look terrible, but better as without zoomout! :D
Re: Furniture with zoomout + automated script
Quote:
Originally Posted by
Scresho
yeah, they don't look that good, but as you said, better than nothing..
I might try to fix them, but I don't think it's worth the trouble tbh..
Re: Furniture with zoomout + automated script
My god,
Finally a release that has an "awsome" title earned.
Very usefull for me, thanks.
Re: Furniture with zoomout + automated script
Awesome release, thank you very much for this release!
Re: Furniture with zoomout + automated script (last update: 20-06-2015)
Thanks for all the nice replies!
I've added more furnitures!
Re: Furniture with zoomout + automated script (last update: 20-06-2015)
Thank you for this awesome release, we will need to fix the terrible image quality though. Again appreciate the release!
Re: Furniture with zoomout + automated script (last update: 20-06-2015)
Quote:
Originally Posted by
XenoGFX
Thank you for this awesome release, we will need to fix the terrible image quality though. Again appreciate the release!
Thanks! Yeah the quality isn't that good, it's actually fine for normal furniture (IMO), but with pets, since there are so many small parts, it's really ugly..
Re: Furniture with zoomout + automated script (last update: 20-06-2015)
Great release Ricardo, I hope to see more useful and awesome releases from you in the future!
Greetz,