Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. #region PREDESIGNED_ROOM BY KOMOK
  2. if (Item.PredesignedId > 0 && YezzEnvironment.GetGame().GetCatalog().GetPredesignedRooms().predesignedRoom.ContainsKey((uint)Item.PredesignedId))
  3. {
  4. #region SELECT ROOM AND CREATE NEW
  5. var predesigned = YezzEnvironment.GetGame().GetCatalog().GetPredesignedRooms().predesignedRoom[(uint)Item.PredesignedId];
  6. var decoration = predesigned.RoomDecoration;
  7.  
  8. var createRoom = YezzEnvironment.GetGame().GetRoomManager().CreateRoom(Session, Session.GetHabbo().Username + "'s room", "Una Sala pre-decorada :)", predesigned.RoomModel, 1, 25, 1);
  9.  
  10. Session.SendMessage(RoomNotificationComposer.SendBubble("predesignedroom", "" + Session.GetHabbo().Username + ", acabas de comprar una sala pre-decorada :).", ""));
  11.  
  12. createRoom.FloorThickness = int.Parse(decoration[0]);
  13. createRoom.WallThickness = int.Parse(decoration[1]);
  14. createRoom.Model.WallHeight = int.Parse(decoration[2]);
  15. createRoom.Hidewall = ((decoration[3] == "True") ? 1 : 0);
  16. createRoom.Wallpaper = decoration[4];
  17. createRoom.Landscape = decoration[5];
  18. createRoom.Floor = decoration[6];
  19. var newRoom = YezzEnvironment.GetGame().GetRoomManager().LoadRoom(createRoom.Id);
  20. #endregion
  21.  
  22. #region CREATE FLOOR ITEMS
  23. if (predesigned.FloorItems != null)
  24. foreach (var floorItems in predesigned.FloorItemData)
  25. using (var dbClient = YezzEnvironment.GetDatabaseManager().GetQueryReactor())
  26. dbClient.runFastQuery("INSERT INTO items VALUES (null, " + Session.GetHabbo().Id + ", " + newRoom.RoomId + ", " + floorItems.BaseItem + ", '" + floorItems.ExtraData + "', " +
  27. floorItems.X + ", " + floorItems.Y + ", " + TextHandling.GetString(floorItems.Z) + ", " + floorItems.Rot + ", '', 0, 0);");
  28. #endregion
  29.  
  30. #region CREATE WALL ITEMS
  31. if (predesigned.WallItems != null)
  32. foreach (var wallItems in predesigned.WallItemData)
  33. using (var dbClient = YezzEnvironment.GetDatabaseManager().GetQueryReactor())
  34. dbClient.runFastQuery("INSERT INTO items VALUES (null, " + Session.GetHabbo().Id + ", " + newRoom.RoomId + ", " + wallItems.BaseItem + ", '" + wallItems.ExtraData +
  35. "', 0, 0, 0, 0, '" + wallItems.WallCoord + "', 0, 0);");
  36. #endregion
  37.  
  38. #region VERIFY IF CONTAINS BADGE AND GIVE
  39. if (Item.Badge != string.Empty) Session.GetHabbo().GetBadgeComponent().GiveBadge(Item.Badge, true, Session);
  40. #endregion
  41.  
  42. #region GENERATE ROOM AND SEND PACKET
  43. Session.SendMessage(new PurchaseOKComposer());
  44. Session.GetHabbo().GetInventoryComponent().UpdateItems(false);
  45. YezzEnvironment.GetGame().GetRoomManager().LoadRoom(newRoom.Id).GetRoomItemHandler().LoadFurniture();
  46. var newFloorItems = newRoom.GetRoomItemHandler().GetFloor;
  47. foreach (var roomItem in newFloorItems) newRoom.GetRoomItemHandler().SetFloorItem(roomItem, roomItem.GetX, roomItem.GetY, roomItem.GetZ);
  48. var newWallItems = newRoom.GetRoomItemHandler().GetWall;
  49. foreach (var roomItem in newWallItems) newRoom.GetRoomItemHandler().SetWallItem(Session, roomItem);
  50. Session.SendMessage(new FlatCreatedComposer(newRoom.Id, newRoom.Name));
  51. #endregion
  52. return;
  53. }
  54. #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement