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);
}
}
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: