public void Execute(GameClient Session, Room Room, RoomUser UserRoom, string[] Params) { Room currentRoom = Session.GetHabbo().CurrentRoom; if (currentRoom == null) { return; } currentRoom.RoomData.HideWireds = !currentRoom.RoomData.HideWireds; using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { queryreactor.RunQuery("UPDATE rooms SET allow_hidewireds = '" + TextHandling.BooleanToInt(currentRoom.RoomData.HideWireds) + "' WHERE id = " + currentRoom.Id); } if (currentRoom.RoomData.HideWireds) { UserRoom.SendWhisperChat(ButterflyEnvironment.GetLanguageManager().TryGetValue("cmd.hidewireds.true", Session.Langue)); } else { UserRoom.SendWhisperChat(ButterflyEnvironment.GetLanguageManager().TryGetValue("cmd.hidewireds.false", Session.Langue)); } }
public void OnTrigger(GameClient Session, int SpriteId) { ServerPacket Message15 = new ServerPacket(ServerPacketHeader.WiredEffectConfigMessageComposer); Message15.WriteBoolean(false); Message15.WriteInteger(0); Message15.WriteInteger(0); Message15.WriteInteger(SpriteId); Message15.WriteInteger(this.itemID); Message15.WriteString(this.NomBot + '\t' + this.message); Message15.WriteInteger(1); Message15.WriteInteger(TextHandling.BooleanToInt(this.IsMurmur)); Message15.WriteInteger(0); Message15.WriteInteger(27); //7 Message15.WriteInteger(0); Message15.WriteInteger(0); Session.SendPacket(Message15); }
internal void SaveRoomDataSettings() { if (roomNeedSqlUpdate) { string DisableCommands = ""; foreach (int CommandId in DisabledCommands) { DisableCommands += CommandId + ","; } if (!string.IsNullOrEmpty(DisableCommands)) { DisableCommands = DisableCommands.Substring(0, DisableCommands.Length - 1); } using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("UPDATE rooms SET model_name = @modelname, roomtype = @type, floor = @floor, wallpaper = @wall, landscape = @landscape," + " score = '" + Score + "', users_max = '" + UsersMax + "', state = '" + State + "', category = '" + Category + "', caption = @caption," + " description = @description, tags = @tags, password = @password, allow_pets = '" + TextHandling.BooleanToInt(AllowPets) + "'," + " allow_pets_eat = '" + TextHandling.BooleanToInt(AllowPetsEating) + "', allow_walkthrough = '" + TextHandling.BooleanToInt(AllowWalkthrough) + "'," + " allow_hidewall = '" + TextHandling.BooleanToInt(Hidewall) + "', allow_diagonals = '" + TextHandling.BooleanToInt(AllowDiagonalEnabled) + "', floorthickness = '" + FloorThickness + "', wallthickness = '" + WallThickness + "'," + " moderation_mute_fuse = '" + MuteFuse + "', moderation_kick_fuse = '" + KickFuse + "', moderation_ban_fuse = '" + BanFuse + "'," + " bubble_mode = '" + BubbleMode + "', bubble_type = '" + BubbleType + "', bubble_scroll = '" + BubbleScroll + "', trade_settings = '" + TradeSettings + "'," + " antiflood_settings = '" + AntiFloodSettings + "', chat_distance = '" + ChatDistance + "', wall_height = '" + WallHeight + "', roller_speed = '" + RollerSpeed + "'," + " disable_commands = '" + DisableCommands + "' WHERE id = " + Id); dbClient.addParameter("modelname", ModelName); dbClient.addParameter("type", Type); dbClient.addParameter("floor", Floor); dbClient.addParameter("wall", Wallpaper); dbClient.addParameter("landscape", Landscape); dbClient.addParameter("caption", Name); dbClient.addParameter("description", Description); dbClient.addParameter("tags", GenerateTags()); dbClient.addParameter("password", Password); dbClient.runQuery(); } roomNeedSqlUpdate = false; } }
public void Parse(GameClient Session, ClientPacket Packet) { Room room = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (room == null || !room.CheckRights(Session, true)) { return; } int RoomId = Packet.PopInt(); string Name = Packet.PopString(); string Description = Packet.PopString(); int State = Packet.PopInt(); string Password = Packet.PopString(); int MaxUsers = Packet.PopInt(); int CategoryId = Packet.PopInt(); int TagCount = Packet.PopInt(); List <string> tags = new List <string>(); StringBuilder stringBuilder = new StringBuilder(); for (int index = 0; index < TagCount; ++index) { if (index > 0) { stringBuilder.Append(","); } string tag = Packet.PopString().ToLower(); tags.Add(tag); stringBuilder.Append(tag); } int TrocStatus = Packet.PopInt(); bool AllowPets = Packet.PopBoolean(); bool AllowPetsEat = Packet.PopBoolean(); bool AllowWalkthrough = Packet.PopBoolean(); bool Hidewall = Packet.PopBoolean(); int WallThickness = Packet.PopInt(); int FloorThickness = Packet.PopInt(); int mutefuse = Packet.PopInt(); int kickfuse = Packet.PopInt(); int banfuse = Packet.PopInt(); int ChatType = Packet.PopInt(); int ChatBalloon = Packet.PopInt(); int ChatSpeed = Packet.PopInt(); int ChatMaxDistance = Packet.PopInt(); int ChatFloodProtection = Packet.PopInt(); if (WallThickness < -2 || WallThickness > 1) { WallThickness = 0; } if (FloorThickness < -2 || FloorThickness > 1) { FloorThickness = 0; } if (Name.Length < 1 || Name.Length > 100) { return; } if (State < 0 || State > 3) { return; } if (MaxUsers < 10 || MaxUsers > 75) { MaxUsers = 25; } if (TrocStatus < 0 || TrocStatus > 2) { TrocStatus = 0; } if (TagCount > 2 || mutefuse != 0 && mutefuse != 1 || kickfuse != 0 && kickfuse != 1 && kickfuse != 2 || banfuse != 0 && banfuse != 1) { return; } if (ChatMaxDistance > 99) { ChatMaxDistance = 99; } room.RoomData.AllowPets = AllowPets; room.RoomData.AllowPetsEating = AllowPetsEat; room.RoomData.AllowWalkthrough = AllowWalkthrough; room.RoomData.Hidewall = Hidewall; room.RoomData.Name = Name; room.RoomData.State = State; room.RoomData.Description = Description; room.RoomData.Category = CategoryId; if (!string.IsNullOrEmpty(Password)) { room.RoomData.Password = Password; } room.ClearTags(); room.AddTagRange(tags); room.RoomData.Tags.Clear(); room.RoomData.Tags.AddRange((IEnumerable <string>)tags); room.RoomData.UsersMax = MaxUsers; room.RoomData.WallThickness = WallThickness; room.RoomData.FloorThickness = FloorThickness; room.RoomData.MuteFuse = mutefuse; room.RoomData.WhoCanKick = kickfuse; room.RoomData.BanFuse = banfuse; room.RoomData.ChatType = ChatType; room.RoomData.ChatBalloon = ChatBalloon; room.RoomData.ChatSpeed = ChatSpeed; room.RoomData.ChatMaxDistance = ChatMaxDistance; room.RoomData.ChatFloodProtection = ChatFloodProtection; room.RoomData.TrocStatus = TrocStatus; string str5 = "open"; if (room.RoomData.State == 1) { str5 = "locked"; } else if (room.RoomData.State == 2) { str5 = "password"; } else if (room.RoomData.State == 3) { str5 = "hide"; } using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { queryreactor.SetQuery("UPDATE rooms SET caption = @caption, description = @description, password = @password, category = '" + CategoryId + "', state = '" + str5 + "', tags = @tags, users_max = '" + MaxUsers + "', allow_pets = '" + TextHandling.BooleanToInt(AllowPets) + "', allow_pets_eat = '" + TextHandling.BooleanToInt(AllowPetsEat) + "', allow_walkthrough = '" + TextHandling.BooleanToInt(AllowWalkthrough) + "', allow_hidewall = '" + TextHandling.BooleanToInt(room.RoomData.Hidewall) + "', floorthick = '" + room.RoomData.FloorThickness + "', wallthick = '" + room.RoomData.WallThickness + "', moderation_mute_fuse = '" + mutefuse + "', moderation_kick_fuse = '" + kickfuse + "', moderation_ban_fuse = '" + banfuse + "', chat_type = '" + ChatType + "', chat_balloon = '" + ChatBalloon + "', chat_speed = '" + ChatSpeed + "', chat_max_distance = '" + ChatMaxDistance + "', chat_flood_protection = '" + ChatFloodProtection + "', TrocStatus = '" + TrocStatus + "' WHERE id = " + room.Id); queryreactor.AddParameter("caption", room.RoomData.Name); queryreactor.AddParameter("description", room.RoomData.Description); queryreactor.AddParameter("password", room.RoomData.Password); queryreactor.AddParameter("tags", (stringBuilder).ToString()); queryreactor.RunQuery(); } ServerPacket Response = new ServerPacket(ServerPacketHeader.RoomSettingsSavedMessageComposer); Response.WriteInteger(room.Id); Session.SendPacket(Response); ServerPacket Response2 = new ServerPacket(ServerPacketHeader.RoomVisualizationSettingsMessageComposer); Response2.WriteBoolean(room.RoomData.Hidewall); Response2.WriteInteger(room.RoomData.WallThickness); Response2.WriteInteger(room.RoomData.FloorThickness); Session.GetHabbo().CurrentRoom.SendPacket(Response2); ServerPacket m = new ServerPacket(ServerPacketHeader.RoomChatSettingsComposer); Response.WriteInteger(room.RoomData.ChatType); Response.WriteInteger(room.RoomData.ChatBalloon); Response.WriteInteger(room.RoomData.ChatSpeed); Response.WriteInteger(room.RoomData.ChatMaxDistance); Response.WriteInteger(room.RoomData.ChatFloodProtection); Session.GetHabbo().CurrentRoom.SendPacket(Response); Session.SendPacket(new GetGuestRoomResultComposer(Session, room.RoomData, true, false)); }