Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region PREDESIGNED_ROOM BY KOMOK
- if (Item.PredesignedId > 0 && YezzEnvironment.GetGame().GetCatalog().GetPredesignedRooms().predesignedRoom.ContainsKey((uint)Item.PredesignedId))
- {
- #region SELECT ROOM AND CREATE NEW
- var predesigned = YezzEnvironment.GetGame().GetCatalog().GetPredesignedRooms().predesignedRoom[(uint)Item.PredesignedId];
- var decoration = predesigned.RoomDecoration;
- var createRoom = YezzEnvironment.GetGame().GetRoomManager().CreateRoom(Session, Session.GetHabbo().Username + "'s room", "Una Sala pre-decorada :)", predesigned.RoomModel, 1, 25, 1);
- Session.SendMessage(RoomNotificationComposer.SendBubble("predesignedroom", "" + Session.GetHabbo().Username + ", acabas de comprar una sala pre-decorada :).", ""));
- createRoom.FloorThickness = int.Parse(decoration[0]);
- createRoom.WallThickness = int.Parse(decoration[1]);
- createRoom.Model.WallHeight = int.Parse(decoration[2]);
- createRoom.Hidewall = ((decoration[3] == "True") ? 1 : 0);
- createRoom.Wallpaper = decoration[4];
- createRoom.Landscape = decoration[5];
- createRoom.Floor = decoration[6];
- var newRoom = YezzEnvironment.GetGame().GetRoomManager().LoadRoom(createRoom.Id);
- #endregion
- #region CREATE FLOOR ITEMS
- if (predesigned.FloorItems != null)
- foreach (var floorItems in predesigned.FloorItemData)
- using (var dbClient = YezzEnvironment.GetDatabaseManager().GetQueryReactor())
- dbClient.runFastQuery("INSERT INTO items VALUES (null, " + Session.GetHabbo().Id + ", " + newRoom.RoomId + ", " + floorItems.BaseItem + ", '" + floorItems.ExtraData + "', " +
- floorItems.X + ", " + floorItems.Y + ", " + TextHandling.GetString(floorItems.Z) + ", " + floorItems.Rot + ", '', 0, 0);");
- #endregion
- #region CREATE WALL ITEMS
- if (predesigned.WallItems != null)
- foreach (var wallItems in predesigned.WallItemData)
- using (var dbClient = YezzEnvironment.GetDatabaseManager().GetQueryReactor())
- dbClient.runFastQuery("INSERT INTO items VALUES (null, " + Session.GetHabbo().Id + ", " + newRoom.RoomId + ", " + wallItems.BaseItem + ", '" + wallItems.ExtraData +
- "', 0, 0, 0, 0, '" + wallItems.WallCoord + "', 0, 0);");
- #endregion
- #region VERIFY IF CONTAINS BADGE AND GIVE
- if (Item.Badge != string.Empty) Session.GetHabbo().GetBadgeComponent().GiveBadge(Item.Badge, true, Session);
- #endregion
- #region GENERATE ROOM AND SEND PACKET
- Session.SendMessage(new PurchaseOKComposer());
- Session.GetHabbo().GetInventoryComponent().UpdateItems(false);
- YezzEnvironment.GetGame().GetRoomManager().LoadRoom(newRoom.Id).GetRoomItemHandler().LoadFurniture();
- var newFloorItems = newRoom.GetRoomItemHandler().GetFloor;
- foreach (var roomItem in newFloorItems) newRoom.GetRoomItemHandler().SetFloorItem(roomItem, roomItem.GetX, roomItem.GetY, roomItem.GetZ);
- var newWallItems = newRoom.GetRoomItemHandler().GetWall;
- foreach (var roomItem in newWallItems) newRoom.GetRoomItemHandler().SetWallItem(Session, roomItem);
- Session.SendMessage(new FlatCreatedComposer(newRoom.Id, newRoom.Name));
- #endregion
- return;
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement