Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[BcStorm] Multi-Height fix

Status
Not open for further replies.
Developer
Joined
Nov 26, 2011
Messages
509
Reaction score
81
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:
<?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:
internal int Width;
This:
PHP:
internal string VariableHeight;



Replace this:
PHP:
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:
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:
this.VendingIds = new List<int>();
This:
PHP:
this.VariableHeight = VariableHeight;



Well done! We're done in the file Item.cs

Go to Butterfly -> HabboHotel -> Items -> ItemManager.cs

Add after this:
PHP:
string vendingIds = (string) row[0x13];
This:
PHP:
string variableheights = (string)row[20];



Replace this:
PHP:
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:
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:
Item.ExtraData = num2.ToString();
Item.UpdateState();
This:
PHP:
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:
return (this.mZ + this.GetBaseItem().Height);
With this:
PHP:
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:
if (item.TotalHeight > totalHeight)
With this:
PHP:
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!
 
Last edited:
Developer
Joined
Nov 26, 2011
Messages
509
Reaction score
81
Cool, i could just do it manually, haha, but Automatic Scripts ftw. + Thanks to Tdid :) ( i see his credits, very good )

Offtopic:
Do you still need help with that script on staffpage for different header color?
 
Initiate Mage
Joined
Jan 26, 2013
Messages
85
Reaction score
15
Glad to see a lot of people are helping develop r63b.

Thank's for this release
 
Experienced Elementalist
Joined
Jul 12, 2011
Messages
272
Reaction score
51
cheers homepre

offtopic you still doing a new version of homepre cms?
 
Developer
Joined
Nov 26, 2011
Messages
509
Reaction score
81
.. Come on..

$vSomeSpecialChars = array(".");
$vReplacementChars = array(",");

Create an array of just one value, and then define the variable twice? Why?
But good fix.

Never looked at that. Only looked for a fix.

cheers homepre

offtopic you still doing a new version of homepre cms?

No not anymore. I worked on it a long time ago. I finished it and fixed much things and added lots of function. I'm not doing anything with it. I'd release is maybe this week.
 
[̲̅$̲̅(̲̅1̲̅)̲̅$ ̲̅]
Joined
May 4, 2008
Messages
831
Reaction score
741
This was an issue with Phoenix a while back. Dutch language windows computers used a comma and English language use a period as a separator. That is why this works for some and it wont work for others....
 
Joined
May 8, 2010
Messages
1,902
Reaction score
669
Still doesnt help me with the items all being walkable, even though i followed EXACTLY. If you dont belive, download the link i gave (its a video) cant upload to youtube for some stupid reason.
 
Developer
Joined
Nov 26, 2011
Messages
509
Reaction score
81
Still doesnt help me with the items all being walkable, even though i followed EXACTLY. If you dont belive, download the link i gave (its a video) cant upload to youtube for some stupid reason.

And you're sure you converted the items_base table succesfull ?
 
Status
Not open for further replies.
Back
Top