public RoomData(DataRow dataRow) { if (dataRow != null) { this.ID = (uint)dataRow["id"]; this.Name = (string)dataRow["name"]; this.Description = (string)dataRow["description"]; this.OwnerID = (uint)dataRow["ownerid"]; this.Type = (string)dataRow["type"]; this.Model = (string)dataRow["model"]; this.State = (string)dataRow["state"] == "password" ? RoomStateType.PASSWORD : (string)dataRow["state"] == "locked" ? RoomStateType.LOCKED : RoomStateType.OPEN; this.Category = (int)dataRow["category"]; this.UsersNow = (int)dataRow["users_now"]; //maybe we need this sometimes :3 this.UsersMax = (int)dataRow["users_max"]; this.PublicCCTs = (string)dataRow["public_ccts"]; this.Score = (int)dataRow["score"]; string tags = (string)dataRow["tags"]; if (!string.IsNullOrEmpty(tags)) { this.Tags = tags.Split(',').ToList(); } else { this.Tags = new List <string>(); } this.RoomIcon = new RoomIcon((int)dataRow["icon_bg"], (int)dataRow["icon_fg"], (string)dataRow["icon_items"]); this.Password = (string)dataRow["password"]; this.Wallpaper = (string)dataRow["wallpaper"]; this.Floor = (string)dataRow["floor"]; this.Landscape = (string)dataRow["landscape"]; this.AllowPets = TextUtilies.StringToBool((string)dataRow["allow_pets"]); this.AllowPetsEat = TextUtilies.StringToBool((string)dataRow["allow_pets_eat"]); this.AllowWalkthrough = TextUtilies.StringToBool((string)dataRow["allow_walkthrough"]); this.Hidewalls = TextUtilies.StringToBool((string)dataRow["hidewalls"]); this.Wallthick = (int)dataRow["wallthick"]; this.Floorthick = (int)dataRow["floorthick"]; this.AllowTrade = (RoomAllowTradeType)int.Parse((string)dataRow["trade"]); this.MuteOption = (RoomWhoCanType)int.Parse((string)dataRow["mute_option"]); this.KickOption = (RoomWhoCanType)int.Parse((string)dataRow["kick_option"]); this.BanOption = (RoomWhoCanType)int.Parse((string)dataRow["ban_option"]); this.ChatMode = (RoomChatModeType)int.Parse((string)dataRow["chat_mode"]); this.ChatWeight = (RoomChatWeightType)int.Parse((string)dataRow["chat_weight"]); this.ChatSpeed = (RoomChatSpeedType)int.Parse((string)dataRow["chat_speed"]); this.ChatProtection = (RoomChatProtectionType)int.Parse((string)dataRow["chat_protection"]); string data = (string)dataRow["data"]; if (!string.IsNullOrEmpty(data)) { this.ExtraData = JsonConvert.DeserializeObject <RoomExtraData>(data); } else { this.ExtraData = new RoomExtraData(); } } else { this.NullValues(); } }
public void Handle(GameClient session, ClientMessage message) { if (session != null && session.GetHabbo() != null) { if (session.GetHabbo().UserRooms.Count <= ServerConfiguration.MaxRoomsPerUser) { string[] data = message.PopStringUntilBreak(null).Split('/'); if (data[0] == "" && data[1] == "first floor") { string roomName = data[2]; string roomModel = data[3]; RoomStateType state = data[4] == "open" ? RoomStateType.OPEN : data[4] == "closed" ? RoomStateType.LOCKED : RoomStateType.PASSWORD; string showName = data[5]; RoomData roomData = Skylight.GetGame().GetRoomManager().CreateRoom(session, roomName, "", roomModel, 0, 25, 0, state); if (roomData != null) { ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.R26_20080915_0408_7984_61ccb5f8b8797a3aba62c1fa2ca80169); message_.Init(r26Outgoing.CreatedRoom); message_.AppendString(roomData.ID.ToString(), 13); message_.AppendString(roomData.Name); session.SendMessage(message_); } } } } }
public void NullValues() { this.ID = 0; this.Name = ""; this.Description = ""; this.OwnerID = 0; this.Type = "private"; this.Model = ""; this.State = RoomStateType.OPEN; this.Category = 0; this.UsersNow = 0; this.UsersMax = 25; this.PublicCCTs = ""; this.Score = 0; this.Tags = new List <string>(); this.RoomIcon = new RoomIcon(1, 0, ""); this.Password = ""; this.Wallpaper = "0.0"; this.Floor = "0.0"; this.Landscape = "0.0"; this.AllowPets = true; this.AllowPetsEat = false; this.AllowWalkthrough = false; this.Hidewalls = false; this.Wallthick = 0; this.Floorthick = 0; this.ExtraData = new RoomExtraData(); }
public RoomData CreateRoom(GameClient gameClient, string roomName, string roomDescription, string roomModel, int categoryId, int maxUsers, int tradeType, RoomStateType state) { roomName = TextUtilies.CheckBlacklistedWords(TextUtilies.FilterString(roomName)); if (this.RoomModels.ContainsKey(roomModel)) { string clubName = this.RoomModels[roomModel].ClubName; if (string.IsNullOrEmpty(clubName) || gameClient.GetHabbo().GetSubscriptionManager().HasSubscription(clubName)) //hc check { if (roomName.Length >= 1) { uint roomId = 0; using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("name", roomName); dbClient.AddParamWithValue("description", roomDescription); dbClient.AddParamWithValue("model", roomModel); dbClient.AddParamWithValue("category", categoryId); dbClient.AddParamWithValue("usersMax", maxUsers); dbClient.AddParamWithValue("ownerid", gameClient.GetHabbo().ID); dbClient.ExecuteQuery("INSERT INTO rooms(type, name, description, model, category, users_max, trade, ownerid, data, state) VALUES('private', @name, @description, @model, @category, @usersMax, '" + tradeType + "', @ownerid, '', '" + (state == RoomStateType.PASSWORD ? "password" : state == RoomStateType.LOCKED ? "locked" : "open") + "')"); roomId = (uint)dbClient.GetID(); } gameClient.GetHabbo().AddRoom(roomId); return(this.TryGetAndLoadRoomData(roomId)); } else { gameClient.SendNotif("Room name is too short!"); return(null); } } else { gameClient.SendNotif("You need HC/VIP to use this room model!"); return(null); } } else { gameClient.SendNotif("This room model havent yet added! Please try again later!"); return(null); } }