[BcStorm] Multi-Height fix

Results 1 to 21 of 21
  1. #1
    Developer PremiumEye is offline
    MemberRank
    Nov 2011 Join Date
    NetherlandsLocation
    550Posts

    [BcStorm] Multi-Height fix

    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 Idint Spritestring PublicNamestring Namestring Typeint Widthint Lengthdouble Heightbool Stackablebool Walkablebool IsSeatbool AllowRecyclebool AllowTradebool AllowMarketplaceSellbool AllowGiftbool AllowInventoryStackbool AllowGroupItemButterfly.HabboHotel.Items.InteractionType InteractionTypeint Modesstring VendingIds
    To this:
    PHP Code:
    internal Item(uint Idint Spritestring PublicNamestring Namestring Typeint Widthint Lengthdouble Heightbool Stackablebool Walkablebool IsSeatbool AllowRecyclebool AllowTradebool AllowMarketplaceSellbool AllowGiftbool AllowInventoryStackbool AllowGroupItemButterfly.HabboHotel.Items.InteractionType InteractionTypeint Modesstring VendingIdsstring 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(idspritepublicNamenamestr3widthlengthheightstackablewalkableisSeatallowRecycleallowTradeallowMarketplaceSellallowGiftallowInventoryStackallowGroupItemtypeFromStringmodesvendingIds); 
    With this:
    PHP Code:
    Item item = new Item(idspritepublicNamenamestr3widthlengthheightstackablewalkableisSeatallowRecycleallowTradeallowMarketplaceSellallowGiftallowInventoryStackallowGroupItemtypeFromStringmodesvendingIdsvariableheights); 


    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).&& Item.GetY == Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username).Y)
                        {
                            
    Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username).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!
    Last edited by PremiumEye; 10-02-13 at 11:10 PM.


  2. #2
    Eye Eye Capt'n Spheral is offline
    MemberRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Re: [BcStorm] Multi-Height fix

    And the point of converting a table? I just dont see why

  3. #3
    Developer PremiumEye is offline
    MemberRank
    Nov 2011 Join Date
    NetherlandsLocation
    550Posts

    Re: [BcStorm] Multi-Height fix

    Quote Originally Posted by JohnHearfield View Post
    And the point of converting a table? I just dont see why
    It's converting the dot to a , :). It is neccesary for the variable_heights field

  4. #4
    Eye Eye Capt'n Spheral is offline
    MemberRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Re: [BcStorm] Multi-Height fix

    Quote Originally Posted by PremiumEye View Post
    It's converting the dot to a , :). It is neccesary for the variable_heights field
    Cool, i could just do it manually, haha, but Automatic Scripts ftw. + Thanks to Tdid :) ( i see his credits, very good )

  5. #5
    Developer PremiumEye is offline
    MemberRank
    Nov 2011 Join Date
    NetherlandsLocation
    550Posts

    Re: [BcStorm] Multi-Height fix

    Quote Originally Posted by JohnHearfield View Post
    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?

  6. #6
    Account Upgraded | Title Enabled! =dj.matias= is offline
    MemberRank
    Apr 2008 Join Date
    FinlandLocation
    381Posts

    Re: [BcStorm] Multi-Height fix

    My fix works when you change decimal char , -> . from windows.

  7. #7
    Developer PremiumEye is offline
    MemberRank
    Nov 2011 Join Date
    NetherlandsLocation
    550Posts

    Re: [BcStorm] Multi-Height fix

    Quote Originally Posted by =dj.matias= View Post
    My fix works when you change decimal char , -> . from windows.
    Doesn't seems to work for me.

  8. #8
    Alpha Member Emily is offline
    MemberRank
    Oct 2012 Join Date
    The NetherlandsLocation
    2,408Posts

    Re: [BcStorm] Multi-Height fix

    .. Come on..

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

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

  9. #9
    Member Dan822 is offline
    MemberRank
    Jan 2013 Join Date
    BirminghamLocation
    92Posts

    Re: [BcStorm] Multi-Height fix

    Glad to see a lot of people are helping develop r63b.

    Thank's for this release

  10. #10
    C# Developer neto737 is offline
    MemberRank
    Oct 2010 Join Date
    Environment.csLocation
    274Posts

    Re: [BcStorm] Multi-Height fix

    There are some errors to match the original in items_base for this fix!

  11. #11
    Account Upgraded | Title Enabled! Giles121 is offline
    MemberRank
    Jul 2011 Join Date
    EnglandLocation
    291Posts

    Re: [BcStorm] Multi-Height fix

    cheers homepre

    offtopic you still doing a new version of homepre cms?

  12. #12
    Developer PremiumEye is offline
    MemberRank
    Nov 2011 Join Date
    NetherlandsLocation
    550Posts

    Re: [BcStorm] Multi-Height fix

    Quote Originally Posted by Tha View Post
    .. 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.

    Quote Originally Posted by Giles121 View Post
    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.

  13. #13
    Eye Eye Capt'n Spheral is offline
    MemberRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Re: [BcStorm] Multi-Height fix

    Gotta say, my items are now walkable ;s

  14. #14
    Developer PremiumEye is offline
    MemberRank
    Nov 2011 Join Date
    NetherlandsLocation
    550Posts

    Re: [BcStorm] Multi-Height fix

    Quote Originally Posted by JohnHearfield View Post
    Gotta say, my items are now walkable ;s
    Than you did something wrong.

  15. #15
    Eye Eye Capt'n Spheral is offline
    MemberRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Re: [BcStorm] Multi-Height fix

    Oh sure, i followed everything in this thread, ill even make a video to prove it.

    // Edit - uploading video.
    Last edited by Spheral; 06-02-13 at 06:48 PM.

  16. #16
    Eye Eye Capt'n Spheral is offline
    MemberRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Re: [BcStorm] Multi-Height fix

    Since i cant upload to youtube for some odd reason, here is the dropbox link:
    http://dl.dropbox.com/u/74840249/201...8_1364x768.avi

  17. #17
    [̲̅$̲̅(̲̅1̲̅)̲̅$ ̲̅] leenster is offline
    MemberRank
    May 2008 Join Date
    KanaadaLocation
    992Posts

    Re: [BcStorm] Multi-Height fix

    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....

  18. #18
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,483Posts

    Re: [BcStorm] Multi-Height fix

    Sierra already has this but nice release ^_^

  19. #19
    Eye Eye Capt'n Spheral is offline
    MemberRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Re: [BcStorm] Multi-Height fix

    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.

  20. #20
    Developer PremiumEye is offline
    MemberRank
    Nov 2011 Join Date
    NetherlandsLocation
    550Posts

    Re: [BcStorm] Multi-Height fix

    Quote Originally Posted by JohnHearfield View Post
    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 ?

  21. #21
    Apprentice maxl28 is offline
    MemberRank
    Sep 2012 Join Date
    12Posts

    Re: [BcStorm] Multi-Height fix

    Ok, guys:

    first you make a file called fix.php

    Code:
    <?php
    
    class Config {
    
    	private static $db1 = array(
    					"host" => "YOUR_MYSQL_SERVER",
    					"port" => 3306,
    					"user" => "YOUR_MYSQL_USER",
    					"pass" => "YOUR_MYSQL_PASS",
    					"database" => "YOUR_PHOENIX_DB"
    				);
    
    	private static $db2 = array(
    					"host" => "YOUR_MYSQL_SERVER",
    					"port" => 3306,
    					"user" => "YOUR_MYSQL_USER",
    					"pass" => "YOUR_MYSQL_PASS",
    					"database" => "YOUR_BCSTORM_DB"
    				);
    			
    	public static function connectDB($db)
    	{
    		if ($db == 1) {
    			$link = mysql_connect(self::$db1["host"], self::$db1["user"], self::$db1["pass"]) or die("Verbindung fehlgeschlagen: ".mysql_error());
    			mysql_select_db(self::$db1["database"], $link);
    		} else if($db == 2) {
    			$link = mysql_connect(self::$db2["host"], self::$db2["user"], self::$db2["pass"]) or die("Verbindung fehlgeschlagen: ".mysql_error());
    			mysql_select_db(self::$db2["database"], $link);
    	}
    	
    }
    ?>
    And then a file called furniture.php:

    Code:
    <?php
    	require_once("config.php");
    	
    	Config::ConnectDB(1);
    	
    	$table = mysql_query("SELECT * FROM furniture");
    	$total = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS cnt FROM furniture"));
    	
    	if (mysql_num_rows($table) != $total['cnt'])
    		die("Count missmatch: SEL: " . mysql_num_rows($table) . "; TOTAL: " . $total['cnt']);
    	
    	$count = 0;
    	
    	Config::ConnectDB(2);
    	
    	mysql_query("TRUNCATE items_base");
    	
    	while ($row = mysql_fetch_assoc($table))
    	{	
    		
    		if ($stmt = mysql_query("INSERT INTO items_base VALUES ('".$row['id']."','".$row['sprite_id']."','".F($row['public_name'])."','".F($row['item_name'])."',
    				'".$row['type']."','".$row['width']."','".$row['length']."','".$row['stack_height']."',
    				'".$row['can_stack']."','".$row['is_walkable']."','".$row['can_sit']."','".$row['allow_recycle']."',
    				'".$row['allow_trade']."','".$row['allow_marketplace_sell']."','".$row['allow_gift']."','".$row['allow_inventory_stack']."','1',
    				'".$row['interaction_type']."','".$row['interaction_modes_count']."','".$row['vending_ids']."','1');")) {
    					$count++;
    				}
    			
    	}
    	
    	echo "<p>Migrated " . $count . "/" . $total['cnt'] . " rows of data from table furniture!</p><p>Error: ".mysql_error()."</p>";
    	
    	function F($string)
    	{
    		return mysql_real_escape_string($string);
    	}
    ?>
    This should convert your DB correctly from Phoenix to BcStorm eg. Butterfly / Habbolatino



Advertisement