Hey people!
This release is an edit of the release of =dj.matias=.
Much people can't get his fix work. Even I. So I decided to look at it and I found an other way and it's working now :).
What you have to do?
First, make an extra field in the table items_base called 'variable_heights'.
- type = varchar
- length = 20
- allow null = no
- default = nothing
- character set = latin1
- collation = latin1_swedish_c1
Well done. You have made the extra field for the multi-height function!
Now we're going to convert the hole table items_base.
Use this converter:
Don't delete the items_base table! First we need to convert it!
PHP Code:
<?php
/***********************************************/
/* */
/* Written By tdid for RaGEZONE Habbo Section */
/* */
/***********************************************/
/* Phoenix To bcstorm converter */
/* Version: Catalogue Pages Converter */
/* Need a converter? Request one */
/***********************************************/
$host = "localhost"; //Your host. EG: Localhost
$user = "root"; //Your username. EG: Root
$password = ""; //Your database password.
$database = ""; //The database where PHOENIX is located!
mysql_connect($host, $user, $password) or die(mysql_error()); //connecting to mysql
mysql_select_db($database) or die(mysql_error()); //Selecting Database
$sql = 'SELECT * FROM `items_base` ORDER BY `item_id` ASC';
$furni = mysql_query("$sql") or die(mysql_error());
echo "INSERT INTO `items_base`(`item_id`, `sprite_id`, `public_name`, `item_name`, `type`, `width`, `length`, `height`, `allow_stack`, `allow_walk`, `allow_sit`, `allow_recycle`, `allow_trade`, `allow_marketplace_sell`, `allow_gift`, `allow_inventory_stack`, `allow_group_item`, `interaction_type`, `cycle_count`, `vending_ids`, `variable_heights`) VALUES ";
while ($output = mysql_fetch_array($furni)){
$name = mysql_real_escape_string("$output[public_name]");
$vOriginalString = $output['height'];
$vSomeSpecialChars = array(".");
$vReplacementChars = array(",");
?>
('<?php echo "$output[item_id]"; ?>',
'<?php echo "$output[sprite_id]"; ?>',
'<?php echo $name; ?>',
'<?php echo "$output[item_name]"; ?>',
'<?php echo "$output[type]"; ?>',
'<?php echo "$output[width]"; ?>',
'<?php echo "$output[length]"; ?>',
'<?php if
("$output[height]" == 1)
{
echo"1,00";
}
elseif ("$output[height]" == 2)
{
echo"2,00";
}
elseif ("$output[height]" == 3)
{
echo"3,00";
}
elseif ("$output[height]" == 4)
{
echo"4,00";
}
elseif ("$output[height]" == 5)
{
echo"5,00";
}
elseif ("$output[height]" == 6)
{
echo"6,00";
}
elseif ("$output[height]" == 0)
{
echo"0,00";
}
else
{
$vOriginalString = $output['height'];
$vSomeSpecialChars = array(".");
$vReplacementChars = array(",");
$vReplacedString = str_replace($vSomeSpecialChars, $vReplacementChars, $vOriginalString);
echo $vReplacedString;
}
?>
',
'<?php echo "$output[allow_stack]"; ?>',
'<?php echo "$output[allow_walk]"; ?>',
'<?php echo "$output[allow_sit]"; ?>',
'<?php echo "$output[allow_recycle]"; ?>',
'<?php echo "$output[allow_trade]"; ?>',
'<?php echo "$output[allow_marketplace_sell]"; ?>',
'<?php echo "$output[allow_gift]"; ?>',
'<?php echo "$output[allow_inventory_stack]"; ?>',
'0',
'<?php echo "$output[interaction_type]"; ?>',
'<?php echo "$output[cycle_count]"; ?>',
'<?php echo "$output[vending_ids]"; ?>',
'<?php if
("$output[height]" == 1)
{
echo"1,00";
}
elseif ("$output[height]" == 2)
{
echo"2,00";
}
elseif ("$output[height]" == 3)
{
echo"3,00";
}
elseif ("$output[height]" == 4)
{
echo"4,00";
}
elseif ("$output[height]" == 5)
{
echo"5,00";
}
elseif ("$output[height]" == 6)
{
echo"6,00";
}
elseif ("$output[height]" == 0)
{
echo"0,00";
}
else
{
$vOriginalString = $output['height'];
$vSomeSpecialChars = array(".");
$vReplacementChars = array(",");
$vReplacedString = str_replace($vSomeSpecialChars, $vReplacementChars, $vOriginalString);
echo $vReplacedString;
}
?>
'),
<br />
<?php
}
?>
<?php
/* Dont forget to replace the last , with a ; for the last query */
/* Dont forget to like the post and give some positive reputation! */
/* Need a converter? Request one! */
/* More Coming Soon! */
?>
The result is your new items_base. Empty your items_base table and use the result of this script. Don't forget to change the last , to ;
Well done! Now your database is done. (Almost)
You have to add multi-heights by yourself.
It looks like this:
What is says: state 0;state 1;state 2;state 3;state 4;state 5; etc
What is looks: 0,80;1,44;2,08 etc
Don't forget this:
- to give a new stage add ;
- IT'S 0,64. NOT 0.64
Good! We're almost there. Now we're going to add the new emulator stuff.
If you already edited the emulator with the fix of =dj.matias= you can follow this thread but you have to search the edited code by yourself.
Go to Butterfly -> HabboHotel -> Items -> Item.cs
Add after this:
PHP Code:
internal int Width;
This:
PHP Code:
internal string VariableHeight;
Replace this:
PHP Code:
internal Item(uint Id, int Sprite, string PublicName, string Name, string Type, int Width, int Length, double Height, bool Stackable, bool Walkable, bool IsSeat, bool AllowRecycle, bool AllowTrade, bool AllowMarketplaceSell, bool AllowGift, bool AllowInventoryStack, bool AllowGroupItem, Butterfly.HabboHotel.Items.InteractionType InteractionType, int Modes, string VendingIds)
To this:
PHP Code:
internal Item(uint Id, int Sprite, string PublicName, string Name, string Type, int Width, int Length, double Height, bool Stackable, bool Walkable, bool IsSeat, bool AllowRecycle, bool AllowTrade, bool AllowMarketplaceSell, bool AllowGift, bool AllowInventoryStack, bool AllowGroupItem, Butterfly.HabboHotel.Items.InteractionType InteractionType, int Modes, string VendingIds, string VariableHeight)
Add after this:
PHP Code:
this.VendingIds = new List<int>();
This:
PHP Code:
this.VariableHeight = VariableHeight;
Well done! We're done in the file Item.cs
Go to Butterfly -> HabboHotel -> Items -> ItemManager.cs
Add after this:
PHP Code:
string vendingIds = (string) row[0x13];
This:
PHP Code:
string variableheights = (string)row[20];
Replace this:
PHP Code:
Item item = new Item(id, sprite, publicName, name, str3, width, length, height, stackable, walkable, isSeat, allowRecycle, allowTrade, allowMarketplaceSell, allowGift, allowInventoryStack, allowGroupItem, typeFromString, modes, vendingIds);
With this:
PHP Code:
Item item = new Item(id, sprite, publicName, name, str3, width, length, height, stackable, walkable, isSeat, allowRecycle, allowTrade, allowMarketplaceSell, allowGift, allowInventoryStack, allowGroupItem, typeFromString, modes, vendingIds, variableheights);
Good job! And yeah, we're done in the file ItemManager.cs
Go to Butterfly -> HabboHotel - > Items -> Interactors -> InteractorGenericSwitch.cs
Add after this:
PHP Code:
Item.ExtraData = num2.ToString();
Item.UpdateState();
This:
PHP Code:
if (Item.GetBaseItem().VariableHeight != "")
{
Item.GetRoom().GetGameMap().updateMapForItem(Item);
if (Item.GetX == Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username).X && Item.GetY == Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username).Y)
{
Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username).Z = Item.TotalHeight;
Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username).ClearMovement(true);
}
}
Done in the file InteractorGenericSwitch.cs
Go to Butterfly -> HabboHotel -> Items -> RoomItem.cs
Replace this:
PHP Code:
return (this.mZ + this.GetBaseItem().Height);
With this:
PHP Code:
if (this.GetBaseItem().VariableHeight != "")
{
string[] Heights = this.GetBaseItem().VariableHeight.Split(';');
if (this.ExtraData == "")
{
this.ExtraData = "0";
string str_heights;
str_heights = this.GetBaseItem().VariableHeight.Split(new char[] { Convert.ToChar(";") })[int.Parse(this.ExtraData)];
}
if (this.ExtraData == "0")
{
string str_heights;
str_heights = this.GetBaseItem().VariableHeight.Split(new char[] { Convert.ToChar(";") })[int.Parse(this.ExtraData)];
return (this.mZ + double.Parse(str_heights));
}
else
{
string str_heights;
str_heights = this.GetBaseItem().VariableHeight.Split(new char[] { Convert.ToChar(";") })[int.Parse(this.ExtraData)];
return (this.mZ + double.Parse(str_heights));
}
}
else
{
return (this.mZ + this.GetBaseItem().Height);
}
Almost there. We're done in the file RoomItem.cs
Go to Butterfly -> HabboHotel -> Rooms -> Gamemap.cs
Replace this hole if:
PHP Code:
if (item.TotalHeight > totalHeight)
With this:
PHP Code:
if (item.TotalHeight > totalHeight)
{
if (item.GetBaseItem().IsSeat || (item.GetBaseItem().InteractionType == InteractionType.bed))
{
flag = true;
height = item.GetBaseItem().Height;
}
else
{
flag = false;
}
if (item.GetBaseItem().VariableHeight != "")
{
string[] Heights = item.GetBaseItem().VariableHeight.Split(';');
if (item.ExtraData == "")
{
item.ExtraData = "0";
item.UpdateState();
}
string str_heights;
str_heights = item.GetBaseItem().VariableHeight.Split(new char[] { Convert.ToChar(";") })[int.Parse(item.ExtraData)];
if (int.Parse(item.ExtraData) != 0)
{
totalHeight = double.Parse(str_heights);
}
}
totalHeight = item.TotalHeight;
}
Yeah! You're done now! Change the variable_heights of a furniture who's having more states and check it out :)!
Like if you like this fix ! :).
Credits:
20% - tdid for his converter
45% - =dj.matias= for the first release of the fix
35% - Me for fixing the code for people who can't get it work.
Greets!