• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[BC Storm/Swift Emu] Sellroom and buyroom command

Status
Not open for further replies.
Experienced Elementalist
Joined
Aug 26, 2012
Messages
248
Reaction score
49
Have you an idea on how we could ever duplicate a room? It seems quite hard but it would be really interesting for selling purposes (hard because we also need to duplicate the items inside, from different tables)

havent Tested but
PHP:
 internal void cloneroom()
    {
        Room currentRoom = this.Session.GetHabbo().CurrentRoom;
        currentRoom = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(this.Session.GetHabbo().CurrentRoomId);
        int Roomid;
        uint Roomid3;
        using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())

        
            {
                adapter.setQuery("SELECT MAX(id) FROM rooms");




                 Roomid = adapter.getInteger();
            }
            int RoomId2 = Roomid + 1;
            using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                adapter.setQuery("SELECT * FROM rooms WHERE id =" + currentRoom);
                DataTable table = adapter.getTable();
                foreach (DataRow row in table.Rows)
                {
                    adapter.setQuery(string.Concat(new object[] { "INSERT INTO rooms VALUES (", RoomId2, ",", row["roomtype"], ",", row["caption"], ",", row["owner"], ",", row["description"], ",", row["category"], ",", row["state"], ",", row["users_now"], ",", row["users_max"], ",", row["model_name"], ",", row["public_ccts"], ",", row["score"], ",", row["tags"], ",", row["icon_bg"], ",", row["icon_fg"], ",", row["icon_items"], ",", row["password"], ",", row["wallpaper"], ",", row["floor"], ",", row["landscape"], ",", row["allow_pets"], ",", row["allow_pets_eat"], ",", row["allow_walkthrough"], ",", row["allow_hidewall"], ",", row["allow_rightsoverride"], ",", row["floorthickness"], ",", row["wallthickness"], ",", row["groupId"], ",", row["room_sell"], ",", row["room_price"], ")" }));


                }
            }
            using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())

            {
            adapter.setQuery("SELECT * FROM item_rooms WHERE room_id =" + currentRoom);
            DataTable table = adapter.getTable();
            foreach (DataRow row in table.Rows)
            {
                adapter.setQuery(string.Concat(new object[] { "INSERT INTO items_rooms VALUES (", row["Item_id"], ",", RoomId2, ",", row["x"], ",", row["y"], ",", row["n"], ",", row["guids_data"], ")" }));
                     

            }
          Roomid3 = Convert.ToUInt32(RoomId2);
            RoomData item = ButterflyEnvironment.GetGame().GetRoomManager().GenerateRoomData(Roomid3);
            Session.GetHabbo().UsersRooms.Add(item);
        }        
    }
Not 100% it work but it worth a try also you need to add the command to commandhandelregister (think that what it called) and your emu command file and command regester (make sure the number are the same)

Nice :) Gonna wait first then add it. I have some testers so it will be great!

Sorry dude The command a dead end because you cant update the users items to the new owner xD ill keep working on it but it doesnt look likely
 
Last edited:
Status
Not open for further replies.
Back
Top