public void Execute(GameClient session, Room room, string[] Params) { session.GetHabbo().AllowMimic = !session.GetHabbo().AllowMimic; session.SendWhisper("You're " + (session.GetHabbo().AllowMimic ? "now" : "no longer") + " able to be mimiced."); using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `allow_mimic` = @AllowMimic WHERE `id` = '" + session.GetHabbo().Id + "'"); dbClient.AddParameter("AllowMimic", PlusEnvironment.BoolToEnum(session.GetHabbo().AllowMimic)); dbClient.RunQuery(); } }
public void Execute(GameClient session, Room room, string[] Params) { session.GetHabbo().AllowGifts = !session.GetHabbo().AllowGifts; session.SendWhisper("You're " + (session.GetHabbo().AllowGifts ? "now" : "no longer") + " accepting gifts."); using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `allow_gifts` = @AllowGifts WHERE `id` = '" + session.GetHabbo().Id + "'"); dbClient.AddParameter("AllowGifts", PlusEnvironment.BoolToEnum(session.GetHabbo().AllowGifts)); dbClient.RunQuery(); } }
public void Parse(GameClient session, ClientPacket packet) { var chatPreference = packet.PopBoolean(); session.GetHabbo().ChatPreference = chatPreference; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `chat_preference` = @chatPreference WHERE `id` = '" + session.GetHabbo().Id + "' LIMIT 1"); dbClient.AddParameter("chatPreference", PlusEnvironment.BoolToEnum(chatPreference)); dbClient.RunQuery(); } }
public void UpdateData() { using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `room_items_rentable_space` SET `owner_id` = @ownerid, `time_left` = @timeleft, `enabled` = @enabled WHERE `item_id` = @itemid"); dbClient.AddParameter("itemid", this.ItemId); dbClient.AddParameter("ownerid", this.OwnerId); dbClient.AddParameter("timeleft", this.TimeLeft); dbClient.AddParameter("enabled", PlusEnvironment.BoolToEnum(this.Enabled)); dbClient.RunQuery(); } }
public void Execute(GameClients.GameClient Session, Room Room, string[] Params) { Session.Habbo.AllowMimic = !Session.Habbo.AllowMimic; Session.SendWhisper("You're " + (Session.Habbo.AllowMimic == true ? "now" : "no longer") + " able to be mimiced."); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `allow_mimic` = @AllowMimic WHERE `id` = '" + Session.Habbo.Id + "'"); dbClient.AddParameter("AllowMimic", PlusEnvironment.BoolToEnum(Session.Habbo.AllowMimic)); dbClient.RunQuery(); } }
public void Parse(GameClient session, ClientPacket packet) { bool focusPreference = packet.PopBoolean(); session.Habbo.FocusPreference = focusPreference; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `focus_preference` = @focusPreference WHERE `id` = '" + session.Habbo.Id + "' LIMIT 1"); dbClient.AddParameter("focusPreference", PlusEnvironment.BoolToEnum(focusPreference)); dbClient.RunQuery(); } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { Session.GetHabbo().AllowMimic = !Session.GetHabbo().AllowMimic; Session.SendWhisper("Você agora " + (Session.GetHabbo().AllowMimic == true ? "é" : "não é mais") + " capaz de ser imitado.", 1); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `allow_mimic` = @AllowMimic WHERE `id` = '" + Session.GetHabbo().Id + "'"); dbClient.AddParameter("AllowMimic", PlusEnvironment.BoolToEnum(Session.GetHabbo().AllowMimic)); dbClient.RunQuery(); } }
public void Parse(GameClient session, ClientPacket packet) { bool status = packet.PopBoolean(); session.GetHabbo().AllowMessengerInvites = status; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `ignore_invites` = @MessengerInvites WHERE `id` = '" + session.GetHabbo().Id + "' LIMIT 1"); dbClient.AddParameter("MessengerInvites", PlusEnvironment.BoolToEnum(status)); dbClient.RunQuery(); } }
public void UpdatePreset(int preset, string color, int intensity, bool bgOnly, bool hax = false) { if (!IsValidColor(color) || !IsValidIntensity(intensity) && !hax) { return; } string pr; switch (preset) { case 3: pr = "three"; break; case 2: pr = "two"; break; case 1: default: pr = "one"; break; } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE room_items_moodlight SET preset_" + pr + " = '@color," + intensity + "," + PlusEnvironment.BoolToEnum(bgOnly) + "' WHERE item_id = '" + ItemId + "' LIMIT 1"); dbClient.AddParameter("color", color); dbClient.RunQuery(); } GetPreset(preset).ColorCode = color; GetPreset(preset).ColorIntensity = intensity; GetPreset(preset).BackgroundOnly = bgOnly; }
public void BuyHouse(GameClient Session, int Cost) { if (!this.ForSale) { return; } if (this.OwnerId != 0 && Session.GetHabbo().Id != this.OwnerId) { GameClient Owner = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(this.OwnerId); if (Owner != null && Owner.GetHabbo() != null) { Owner.GetHabbo().Credits += Cost; Owner.GetHabbo().UpdateCreditsBalance(); Owner.SendNotification("Sua casa foi vendida para " + Session.GetHabbo().Username + " por R$" + Cost + "!"); } else { using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `credits` = (credits + @prize) WHERE `id` = @winner LIMIT 1"); dbClient.AddParameter("prize", Cost); dbClient.AddParameter("winner", this.OwnerId); dbClient.RunQuery(); } } } this.OwnerId = Session.GetHabbo().Id; this.ForSale = false; this.Cost = 5000; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_houses` SET `owner_id` = @owner, `for_sale` = @forsale, `cost` = @cost WHERE `room_id` = @room"); dbClient.AddParameter("owner", this.OwnerId); dbClient.AddParameter("forsale", PlusEnvironment.BoolToEnum(this.ForSale)); dbClient.AddParameter("cost", this.Cost); dbClient.AddParameter("room", this.RoomId); dbClient.RunQuery(); } }
public void SellHouse(GameClient Session) { if (this.ForSale) { return; } if (this.OwnerId != Session.GetHabbo().Id) { return; } this.ForSale = true; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_houses` SET `for_sale` = @forsale WHERE `owner_id` = @owner"); dbClient.AddParameter("forsale", PlusEnvironment.BoolToEnum(this.ForSale)); dbClient.AddParameter("owner", this.OwnerId); dbClient.RunQuery(); } }
/// <summary> /// Adds the farming parameters to the mysql command /// </summary> private void AddFarmingParameters(IQueryAdapter DB) { DB.AddParameter("userid", Client.GetHabbo().Id); DB.AddParameter("level", Client.GetRoleplay().FarmingStats.Level); DB.AddParameter("exp", Client.GetRoleplay().FarmingStats.Exp); DB.AddParameter("has_seed_satchel", PlusEnvironment.BoolToEnum(Client.GetRoleplay().FarmingStats.HasSeedSatchel)); DB.AddParameter("has_plant_satchel", PlusEnvironment.BoolToEnum(Client.GetRoleplay().FarmingStats.HasPlantSatchel)); DB.AddParameter("blue_starflower", Client.GetRoleplay().FarmingStats.SeedSatchel.BlueStarflowerSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.BlueStarflowers); DB.AddParameter("yellow_starflower", Client.GetRoleplay().FarmingStats.SeedSatchel.YellowStarflowerSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.YellowStarflowers); DB.AddParameter("pink_dahlia", Client.GetRoleplay().FarmingStats.SeedSatchel.PinkDahliaSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.PinkDahlias); DB.AddParameter("yellow_plumeria", Client.GetRoleplay().FarmingStats.SeedSatchel.YellowPlumeriaSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.YellowPlumerias); DB.AddParameter("pink_primrose", Client.GetRoleplay().FarmingStats.SeedSatchel.PinkPrimroseSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.PinkPrimroses); DB.AddParameter("blue_primrose", Client.GetRoleplay().FarmingStats.SeedSatchel.BluePrimroseSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.BluePrimroses); DB.AddParameter("yellow_primrose", Client.GetRoleplay().FarmingStats.SeedSatchel.YellowPrimroseSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.YellowPrimroses); DB.AddParameter("yellow_dahlia", Client.GetRoleplay().FarmingStats.SeedSatchel.YellowDahliaSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.YellowDahlias); DB.AddParameter("blue_plumeria", Client.GetRoleplay().FarmingStats.SeedSatchel.BluePlumeriaSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.BluePlumerias); DB.AddParameter("pink_plumeria", Client.GetRoleplay().FarmingStats.SeedSatchel.PinkPlumeriaSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.PinkPlumerias); DB.AddParameter("red_starflower", Client.GetRoleplay().FarmingStats.SeedSatchel.RedStarflowerSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.RedStarflowers); DB.AddParameter("blue_dahlia", Client.GetRoleplay().FarmingStats.SeedSatchel.BlueDahliaSeeds + ":" + Client.GetRoleplay().FarmingStats.PlantSatchel.BlueDahlias); }
public void Execute(GameClient Session, Room Room, string[] Params) { #region Variables bool RunQuery = false; #endregion #region Conditions if (Params.Length == 1) { Session.SendWhisper("Por favor, digite ':mudarclasse [tipo]' Os tipos são [Atirador] [Civil] [Lutador] ou [Lista] para ver informações de cada Classe!", 1); return; } if (Session.GetRoleplay().Level > 1) { Session.SendWhisper("Muito tarde, você não é mais nÃvel 1!", 1); return; } if (Session.GetRoleplay().PermanentClass) { Session.SendWhisper("Você já escolheu sua classe permanente, desculpe!", 1); return; } if (Session.GetRoleplay().Class.ToLower() == Params[1].ToLower()) { Session.SendWhisper("Você já é um " + Session.GetRoleplay().Class + "!", 1); return; } #endregion #region Execute switch (Params[1].ToLower()) { case "lista": case "list": { StringBuilder Message = new StringBuilder().Append("<----- HabboRPG Classes ----->\n\n"); Message.Append("Os civis recebem mais dinheiro quando concluem o tempo de trabalho!\n\n"); Message.Append("Os lutadores causam um pouco mais de dano com os punhos, :soco x!\n\n"); Message.Append("Os artilheiros causam um pouco mais de dano com armas, :atirar x!\n\n"); Message.Append("Escolha com sabedoria, pois você não pode mudar sua classe novamente!\n\n"); Session.SendNotification(Message.ToString()); break; } case "atirador": case "gunner": { if (Params.Length > 2) { if (Params[2].ToLower() == "sim") { Session.GetRoleplay().PermanentClass = true; Session.GetRoleplay().Class = "Atirador - [+Dano]"; Session.GetHabbo().Motto = "Classe: Atirador - [+Dano]"; Session.GetHabbo().Poof(true); RunQuery = true; } else { Session.SendWhisper("Tem certeza de que quer ser um Atirador? Se sim, digite ':mudarclasse Atirador sim'", 1); } } else { Session.SendWhisper("Tem certeza de que quer ser um Atirador? Se sim, digite ':mudarclasse Atirador sim'", 1); } break; } case "lutador": case "fighter": { if (Params.Length > 2) { if (Params[2].ToLower() == "sim") { Session.GetRoleplay().PermanentClass = true; Session.GetRoleplay().Class = "Lutador - [+Força]"; Session.GetHabbo().Motto = "Classe: Lutador - [+Força]"; Session.GetHabbo().Poof(true); RunQuery = true; } else { Session.SendWhisper("Você tem certeza de que quer ser um Lutador? Se sim, digite ':mudarclasse Lutador sim'", 1); } } else { Session.SendWhisper("Você tem certeza de que quer ser um Lutador? Se sim, digite ':mudarclasse Lutador sim'", 1); } break; } case "civil": case "cidadao": case "civilian": { if (Params.Length > 2) { if (Params[2].ToLower() == "sim") { Session.GetRoleplay().PermanentClass = true; Session.GetRoleplay().Class = "Civil - [+R$]"; Session.GetHabbo().Motto = "Classe: Civil - [+R$]"; Session.GetHabbo().Poof(true); RunQuery = true; } else { Session.SendWhisper("Você tem certeza de que quer ser um Civil? Se sim, digite ':mudarclasse Civil sim'", 1); } } else { Session.SendWhisper("Você tem certeza de que quer ser um Civil? Se sim, digite ':mudarclasse Civil sim'", 1); } break; } default: { Session.SendWhisper("Você não digitou uma classe válida! Por favor escolha [Atirador] [Lutador] [Civil] ou [Lista] para saber sobre as Classes!", 1); break; } } if (RunQuery) { using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` set `motto` = @class WHERE `id` = @userid LIMIT 1"); dbClient.AddParameter("class", Session.GetRoleplay().Class); dbClient.AddParameter("userid", Session.GetHabbo().Id); dbClient.RunQuery(); dbClient.SetQuery("UPDATE `rp_stats` set `class` = @class, `permanent_class` = @permanent_class WHERE `id` = @userid LIMIT 1"); dbClient.AddParameter("class", Session.GetRoleplay().Class); dbClient.AddParameter("permanent_class", PlusEnvironment.BoolToEnum(Session.GetRoleplay().PermanentClass)); dbClient.AddParameter("userid", Session.GetHabbo().Id); dbClient.RunQuery(); } Session.SendNotification("Você mudou sua classe com sucesso, você agora é um " + Session.GetRoleplay().Class + "!"); return; } #endregion }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } Room Room = PlusEnvironment.GetGame().GetRoomManager().LoadRoom(Packet.PopInt()); if (Room == null || !Room.CheckRights(Session, true)) { return; } string Name = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString()); string Description = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString()); RoomAccess Access = RoomAccessUtility.ToRoomAccess(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 formattedTags = new StringBuilder(); for (int i = 0; i < TagCount; i++) { if (i > 0) { formattedTags.Append(","); } string tag = Packet.PopString().ToLower(); Tags.Add(tag); formattedTags.Append(tag); } int TradeSettings = Packet.PopInt();//2 = All can trade, 1 = owner only, 0 = no trading. int AllowPets = Convert.ToInt32(PlusEnvironment.BoolToEnum(Packet.PopBoolean())); int AllowPetsEat = Convert.ToInt32(PlusEnvironment.BoolToEnum(Packet.PopBoolean())); int RoomBlockingEnabled = Convert.ToInt32(PlusEnvironment.BoolToEnum(Packet.PopBoolean())); int Hidewall = Convert.ToInt32(PlusEnvironment.BoolToEnum(Packet.PopBoolean())); int WallThickness = Packet.PopInt(); int FloorThickness = Packet.PopInt(); int WhoMute = Packet.PopInt(); // mute int WhoKick = Packet.PopInt(); // kick int WhoBan = Packet.PopInt(); // ban int chatMode = Packet.PopInt(); int chatSize = Packet.PopInt(); int chatSpeed = Packet.PopInt(); int chatDistance = Packet.PopInt(); int extraFlood = Packet.PopInt(); if (chatMode < 0 || chatMode > 1) { chatMode = 0; } if (chatSize < 0 || chatSize > 2) { chatSize = 0; } if (chatSpeed < 0 || chatSpeed > 2) { chatSpeed = 0; } if (chatDistance < 0) { chatDistance = 1; } if (chatDistance > 99) { chatDistance = 100; } if (extraFlood < 0 || extraFlood > 2) { extraFlood = 0; } if (TradeSettings < 0 || TradeSettings > 2) { TradeSettings = 0; } if (WhoMute < 0 || WhoMute > 1) { WhoMute = 0; } if (WhoKick < 0 || WhoKick > 1) { WhoKick = 0; } if (WhoBan < 0 || WhoBan > 1) { WhoBan = 0; } if (WallThickness < -2 || WallThickness > 1) { WallThickness = 0; } if (FloorThickness < -2 || FloorThickness > 1) { FloorThickness = 0; } if (Name.Length < 1) { return; } if (Name.Length > 60) { Name = Name.Substring(0, 60); } if (Access == RoomAccess.PASSWORD && Password.Length == 0) { Access = RoomAccess.OPEN; } if (MaxUsers < 0) { MaxUsers = 10; } if (MaxUsers > 50) { MaxUsers = 50; } SearchResultList SearchResultList = null; if (!PlusEnvironment.GetGame().GetNavigator().TryGetSearchResultList(CategoryId, out SearchResultList)) { CategoryId = 36; } if (SearchResultList.CategoryType != NavigatorCategoryType.CATEGORY || SearchResultList.RequiredRank > Session.GetHabbo().Rank || (Session.GetHabbo().Id != Room.OwnerId && Session.GetHabbo().Rank >= SearchResultList.RequiredRank)) { CategoryId = 36; } if (TagCount > 2) { return; } Room.AllowPets = AllowPets; Room.AllowPetsEating = AllowPetsEat; Room.RoomBlockingEnabled = RoomBlockingEnabled; Room.Hidewall = Hidewall; Room.RoomData.AllowPets = AllowPets; Room.RoomData.AllowPetsEating = AllowPetsEat; Room.RoomData.RoomBlockingEnabled = RoomBlockingEnabled; Room.RoomData.Hidewall = Hidewall; Room.Name = Name; Room.Access = Access; Room.Description = Description; Room.Category = CategoryId; Room.Password = Password; Room.RoomData.Name = Name; Room.RoomData.Access = Access; Room.RoomData.Description = Description; Room.RoomData.Category = CategoryId; Room.RoomData.Password = Password; Room.WhoCanBan = WhoBan; Room.WhoCanKick = WhoKick; Room.WhoCanMute = WhoMute; Room.RoomData.WhoCanBan = WhoBan; Room.RoomData.WhoCanKick = WhoKick; Room.RoomData.WhoCanMute = WhoMute; Room.ClearTags(); Room.AddTagRange(Tags); Room.UsersMax = MaxUsers; Room.RoomData.Tags.Clear(); Room.RoomData.Tags.AddRange(Tags); Room.RoomData.UsersMax = MaxUsers; Room.WallThickness = WallThickness; Room.FloorThickness = FloorThickness; Room.RoomData.WallThickness = WallThickness; Room.RoomData.FloorThickness = FloorThickness; Room.chatMode = chatMode; Room.chatSize = chatSize; Room.chatSpeed = chatSpeed; Room.chatDistance = chatDistance; Room.extraFlood = extraFlood; Room.TradeSettings = TradeSettings; Room.RoomData.chatMode = chatMode; Room.RoomData.chatSize = chatSize; Room.RoomData.chatSpeed = chatSpeed; Room.RoomData.chatDistance = chatDistance; Room.RoomData.extraFlood = extraFlood; Room.RoomData.TradeSettings = TradeSettings; string AccessStr = Password.Length > 0 ? "password" : "open"; switch (Access) { default: case RoomAccess.OPEN: AccessStr = "open"; break; case RoomAccess.PASSWORD: AccessStr = "password"; break; case RoomAccess.DOORBELL: AccessStr = "locked"; break; case RoomAccess.INVISIBLE: AccessStr = "invisible"; break; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE rooms SET caption = @caption, description = @description, password = @password, category = " + CategoryId + ", state = '" + AccessStr + "', tags = @tags, users_max = " + MaxUsers + ", allow_pets = '" + AllowPets + "', allow_pets_eat = '" + AllowPetsEat + "', room_blocking_disabled = '" + RoomBlockingEnabled + "', allow_hidewall = '" + Room.Hidewall + "', floorthick = " + Room.FloorThickness + ", wallthick = " + Room.WallThickness + ", mute_settings='" + Room.WhoCanMute + "', kick_settings='" + Room.WhoCanKick + "',ban_settings='" + Room.WhoCanBan + "', `chat_mode` = '" + Room.chatMode + "', `chat_size` = '" + Room.chatSize + "', `chat_speed` = '" + Room.chatSpeed + "', `chat_extra_flood` = '" + Room.extraFlood + "', `chat_hearing_distance` = '" + Room.chatDistance + "', `trade_settings` = '" + Room.TradeSettings + "' WHERE `id` = '" + Room.RoomId + "' LIMIT 1"); dbClient.AddParameter("caption", Room.Name); dbClient.AddParameter("description", Room.Description); dbClient.AddParameter("password", Room.Password); dbClient.AddParameter("tags", formattedTags.ToString()); dbClient.RunQuery(); } Room.GetGameMap().GenerateMaps(); if (Session.GetHabbo().CurrentRoom == null) { Session.SendMessage(new RoomSettingsSavedComposer(Room.RoomId)); Session.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId)); Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, PlusEnvironment.EnumToBool(Room.Hidewall.ToString()))); } else { Room.SendMessage(new RoomSettingsSavedComposer(Room.RoomId)); Room.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId)); Room.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, PlusEnvironment.EnumToBool(Room.Hidewall.ToString()))); } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModDoorModeSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModWalkthroughSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatScrollSpeedSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatFloodFilterSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatHearRangeSeen", 1); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } int BotId = Packet.PopInt(); int ActionId = Packet.PopInt(); string DataString = Packet.PopString(); if (ActionId < 1 || ActionId > 5) { return; } RoomUser Bot = null; if (!Room.GetRoomUserManager().TryGetBot(BotId, out Bot)) { return; } if ((Bot.BotData.ownerID != Session.GetHabbo().Id&& !Session.GetHabbo().GetPermissions().HasRight("bot_edit_any_override"))) { return; } RoomBot RoomBot = Bot.BotData; if (RoomBot == null) { return; } /* 1 = Copy looks * 2 = Setup Speech * 3 = Relax * 4 = Dance * 5 = Change Name */ switch (ActionId) { #region Copy Looks (1) case 1: { ServerPacket UserChangeComposer = new ServerPacket(ServerPacketHeader.UserChangeMessageComposer); UserChangeComposer.WriteInteger(Bot.VirtualId); UserChangeComposer.WriteString(Session.GetHabbo().Look); UserChangeComposer.WriteString(Session.GetHabbo().Gender); UserChangeComposer.WriteString(Bot.BotData.Motto); UserChangeComposer.WriteInteger(0); Room.SendMessage(UserChangeComposer); //Change the defaults Bot.BotData.Look = Session.GetHabbo().Look; Bot.BotData.Gender = Session.GetHabbo().Gender; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `look` = @look, `gender` = '" + Session.GetHabbo().Gender + "' WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1"); dbClient.AddParameter("look", Session.GetHabbo().Look); dbClient.RunQuery(); } //Room.SendMessage(new UserChangeComposer(BotUser.GetClient(), true)); break; } #endregion #region Setup Speech (2) case 2: { string[] ConfigData = DataString.Split(new string[] { ";#;" }, StringSplitOptions.None); string[] SpeechData = ConfigData[0].Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); string AutomaticChat = Convert.ToString(ConfigData[1]); string SpeakingInterval = Convert.ToString(ConfigData[2]); string MixChat = Convert.ToString(ConfigData[3]); if (String.IsNullOrEmpty(SpeakingInterval) || Convert.ToInt32(SpeakingInterval) <= 0 || Convert.ToInt32(SpeakingInterval) < 7) { SpeakingInterval = "7"; } RoomBot.AutomaticChat = Convert.ToBoolean(AutomaticChat); RoomBot.SpeakingInterval = Convert.ToInt32(SpeakingInterval); RoomBot.MixSentences = Convert.ToBoolean(MixChat); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `bots_speech` WHERE `bot_id` = '" + Bot.BotData.Id + "'"); } #region Save Data - TODO: MAKE METHODS FOR THIS. for (int i = 0; i <= SpeechData.Length - 1; i++) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO `bots_speech` (`bot_id`, `text`) VALUES (@id, @data)"); dbClient.AddParameter("id", BotId); dbClient.AddParameter("data", SpeechData[i]); dbClient.RunQuery(); dbClient.SetQuery("UPDATE `bots` SET `automatic_chat` = @AutomaticChat, `speaking_interval` = @SpeakingInterval, `mix_sentences` = @MixChat WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", BotId); dbClient.AddParameter("AutomaticChat", AutomaticChat.ToLower()); dbClient.AddParameter("SpeakingInterval", Convert.ToInt32(SpeakingInterval)); dbClient.AddParameter("MixChat", PlusEnvironment.BoolToEnum(Convert.ToBoolean(MixChat))); dbClient.RunQuery(); } } #endregion #region Handle Speech RoomBot.RandomSpeech.Clear(); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `text` FROM `bots_speech` WHERE `bot_id` = @id"); dbClient.AddParameter("id", BotId); DataTable BotSpeech = dbClient.getTable(); List <RandomSpeech> Speeches = new List <RandomSpeech>(); foreach (DataRow Speech in BotSpeech.Rows) { RoomBot.RandomSpeech.Add(new RandomSpeech(Convert.ToString(Speech["text"]), BotId)); } } #endregion break; } #endregion #region Relax (3) case 3: { if (Bot.BotData.WalkingMode == "stand") { Bot.BotData.WalkingMode = "freeroam"; } else { Bot.BotData.WalkingMode = "stand"; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots` SET `walk_mode` = '" + Bot.BotData.WalkingMode + "' WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1"); } break; } #endregion #region Dance (4) case 4: { if (Bot.BotData.DanceId > 0) { Bot.BotData.DanceId = 0; } else { Random RandomDance = new Random(); Bot.BotData.DanceId = RandomDance.Next(1, 4); } Room.SendMessage(new DanceComposer(Bot, Bot.BotData.DanceId)); break; } #endregion #region Change Name (5) case 5: { if (DataString.Length == 0) { Session.SendWhisper("Come on, atleast give the bot a name!"); return; } else if (DataString.Length >= 16) { Session.SendWhisper("Come on, the bot doesn't need a name that long!"); return; } if (DataString.Contains("<img src") || DataString.Contains("<font ") || DataString.Contains("</font>") || DataString.Contains("</a>") || DataString.Contains("<i>")) { Session.SendWhisper("No HTML, please :<"); return; } Bot.BotData.Name = DataString; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `name` = @name WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1"); dbClient.AddParameter("name", DataString); dbClient.RunQuery(); } Room.SendMessage(new UsersComposer(Bot)); break; } #endregion } }
public void UpdatePreset(int Preset, string Color, int Intensity, bool BgOnly, bool Hax = false) { if (!IsValidColor(Color) || !IsValidIntensity(Intensity) && !Hax) { return; } string Pr; switch (Preset) { case 3: Pr = "three"; break; case 2: Pr = "two"; break; case 1: default: Pr = "one"; break; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE room_items_moodlight SET preset_" + Pr + " = '@color," + Intensity + "," + PlusEnvironment.BoolToEnum(BgOnly) + "' WHERE item_id = '" + ItemId + "' LIMIT 1"); dbClient.AddParameter("color", Color); dbClient.RunQuery(); } GetPreset(Preset).ColorCode = Color; GetPreset(Preset).ColorIntensity = Intensity; GetPreset(Preset).BackgroundOnly = BgOnly; }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Opa, você deve escolher uma opção de sala para desativar.", 1); return; } string Option = Params[1]; switch (Option) { case "list": case "confs": case "lista": case "configuracoes": { StringBuilder List = new StringBuilder(); List.Append("---------- Configurações do Quarto ----------\n\n"); List.Append("[pets] Virar Pet: " + (Room.PetMorphsAllowed == true ? "ativado" : "desativado") + "\n"); List.Append("[puxar] Puxar: " + (Room.PullEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[empurrar] Empurrar: " + (Room.PushEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[puxao] Super puxar: " + (Room.SPullEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[empurrao] Super empurrar: " + (Room.SPushEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[respeito] Respeito: " + (Room.RespectNotificationsEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[efeitos] Efeitos: " + (Room.EnablesEnabled == true ? "ativado" : "desativado") + "\n\n"); List.Append("---------- Configurações de RolePlay ----------\n\n"); List.Append("[banco] Banco: " + (Room.BankEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[atirar] Atirar: " + (Room.ShootEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[bater] Bater: " + (Room.HitEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[seguro] Zona segura: " + (Room.SafeZoneEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[roubar] Roubar: " + (Room.RobEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[sexo] Comandos de Sexo: " + (Room.SexCommandsEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[territorio] Território: " + (Room.TurfEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[academia] Academia: " + (Room.GymEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[entrega] Entrega: " + (Room.DeliveryEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[tutorial] Tutorial: " + (Room.TutorialEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[dirigir] Dirigir: " + (Room.DriveEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[virtaxi] Vir de taxi: " + (Room.TaxiToEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[irtaxi] Ir de taxi: " + (Room.TaxiFromEnabled == true ? "ativado" : "desativado") + "\n"); List.Append("[mensagem] Mensagem de Entrada: " + Room.EnterRoomMessage + "\n"); Session.SendNotification(List.ToString()); break; } case "push": case "empurrar": { Room.PushEnabled = !Room.PushEnabled; Room.RoomData.PushEnabled = Room.PushEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `push_enabled` = @PushEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("PushEnabled", PlusEnvironment.BoolToEnum(Room.PushEnabled)); dbClient.RunQuery(); } Session.SendWhisper("O modo de empurrar agora está " + (Room.PushEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "spush": case "sempurrar": case "empurrao": { Room.SPushEnabled = !Room.SPushEnabled; Room.RoomData.SPushEnabled = Room.SPushEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `spush_enabled` = @PushEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("PushEnabled", PlusEnvironment.BoolToEnum(Room.SPushEnabled)); dbClient.RunQuery(); } Session.SendWhisper("O modo Super empurrar agora está " + (Room.SPushEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "spull": case "spuxar": case "puxao": { Room.SPullEnabled = !Room.SPullEnabled; Room.RoomData.SPullEnabled = Room.SPullEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `spull_enabled` = @PullEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("PullEnabled", PlusEnvironment.BoolToEnum(Room.SPullEnabled)); dbClient.RunQuery(); } Session.SendWhisper("O modo Super puxar agora está " + (Room.SPullEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "pull": case "puxar": { Room.PullEnabled = !Room.PullEnabled; Room.RoomData.PullEnabled = Room.PullEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `pull_enabled` = @PullEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("PullEnabled", PlusEnvironment.BoolToEnum(Room.PullEnabled)); dbClient.RunQuery(); } Session.SendWhisper("O modo puxar agora está" + (Room.PullEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "enable": case "enables": case "efeito": case "efeitos": { Room.EnablesEnabled = !Room.EnablesEnabled; Room.RoomData.EnablesEnabled = Room.EnablesEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `enables_enabled` = @EnablesEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("EnablesEnabled", PlusEnvironment.BoolToEnum(Room.EnablesEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Modo de enables agora está " + (Room.EnablesEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "respect": case "respeito": { Room.RespectNotificationsEnabled = !Room.RespectNotificationsEnabled; Room.RoomData.RespectNotificationsEnabled = Room.RespectNotificationsEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `respect_notifications_enabled` = @RespectNotificationsEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("RespectNotificationsEnabled", PlusEnvironment.BoolToEnum(Room.RespectNotificationsEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Notificações de respeito agora está " + (Room.RespectNotificationsEnabled == true ? "enabled!" : "disabled!"), 1); break; } case "bank": case "banco": { Room.BankEnabled = !Room.BankEnabled; Room.RoomData.BankEnabled = Room.BankEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `bank_enabled` = @BankEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("BankEnabled", PlusEnvironment.BoolToEnum(Room.BankEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Modo de Banco agora está " + (Room.BankEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "taxito": case "virtaxi": { Room.TaxiToEnabled = !Room.TaxiToEnabled; Room.RoomData.TaxiToEnabled = Room.TaxiToEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `taxi_to_enabled` = @TaxiToEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("TaxiToEnabled", PlusEnvironment.BoolToEnum(Room.TaxiToEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Taxi agora está " + (Room.TaxiToEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "taxifrom": case "irtaxi": { Room.TaxiFromEnabled = !Room.TaxiFromEnabled; Room.RoomData.TaxiFromEnabled = Room.TaxiFromEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `taxi_from_enabled` = @TaxiFromEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("TaxiFromEnabled", PlusEnvironment.BoolToEnum(Room.TaxiFromEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Taxi agora está " + (Room.TaxiFromEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "shoot": case "atirar": case "tiro": { Room.ShootEnabled = !Room.ShootEnabled; Room.RoomData.ShootEnabled = Room.ShootEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `shoot_enabled` = @ShootEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("ShootEnabled", PlusEnvironment.BoolToEnum(Room.ShootEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Tiro agora está " + (Room.ShootEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "hit": case "soco": case "bater": { Room.HitEnabled = !Room.HitEnabled; Room.RoomData.HitEnabled = Room.HitEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `hit_enabled` = @HitEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("HitEnabled", PlusEnvironment.BoolToEnum(Room.HitEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Soco agora está " + (Room.HitEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "drive": case "car": case "dirigir": { Room.DriveEnabled = !Room.DriveEnabled; Room.RoomData.DriveEnabled = Room.DriveEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `drive_enabled` = @DriveEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("DriveEnabled", PlusEnvironment.BoolToEnum(Room.DriveEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Dirigir agora está " + (Room.DriveEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "tutorial": { Room.TutorialEnabled = !Room.TutorialEnabled; Room.RoomData.TutorialEnabled = Room.TutorialEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `tutorial_enabled` = @TutorialEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("TutorialEnabled", PlusEnvironment.BoolToEnum(Room.TutorialEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Tutorial agora está " + (Room.TutorialEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "rob": case "roubar": { Room.RobEnabled = !Room.RobEnabled; Room.RoomData.RobEnabled = Room.RobEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `rob_enabled` = @RobEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("RobEnabled", PlusEnvironment.BoolToEnum(Room.RobEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Roubar agora está " + (Room.RobEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "sex": case "sexcommands": case "sexo": case "comandossexo": { Room.SexCommandsEnabled = !Room.SexCommandsEnabled; Room.RoomData.SexCommandsEnabled = Room.SexCommandsEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `sexcommands_enabled` = @SexCommandsEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("SexCommandsEnabled", PlusEnvironment.BoolToEnum(Room.SexCommandsEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Comandos de Sexo agora está " + (Room.SexCommandsEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "turf": case "territorio": { Room.TurfEnabled = !Room.TurfEnabled; Room.RoomData.TurfEnabled = Room.TurfEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `turf_enabled` = @TurfEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("TurfEnabled", PlusEnvironment.BoolToEnum(Room.TurfEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Território agora está " + (Room.TurfEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "gym": case "academia": case "malhar": { Room.GymEnabled = !Room.GymEnabled; Room.RoomData.GymEnabled = Room.GymEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `gym_enabled` = @GymEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("GymEnabled", PlusEnvironment.BoolToEnum(Room.GymEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Academia agora está " + (Room.GymEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "delivery": case "entrega": { Room.DeliveryEnabled = !Room.DeliveryEnabled; Room.RoomData.DeliveryEnabled = Room.DeliveryEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `delivery_enabled` = @DeliveryEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("DeliveryEnabled", PlusEnvironment.BoolToEnum(Room.DeliveryEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Entrega agora está " + (Room.DeliveryEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "message": case "mensagem": { if (Params.Length < 3) { Session.SendWhisper("Você precisa digitar uma mensagem de entrada do quarto!", 1); break; } string Message = CommandManager.MergeParams(Params, 2); Room.EnterRoomMessage = Message; Room.RoomData.EnterRoomMessage = Room.EnterRoomMessage; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `enter_message` = @EnterMessage WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("EnterMessage", Room.EnterRoomMessage); dbClient.RunQuery(); } Session.SendWhisper("A mensagem de entrada agora é: " + Room.EnterRoomMessage, 1); break; } case "safezone": case "seguro": { Room.SafeZoneEnabled = !Room.SafeZoneEnabled; Room.RoomData.SafeZoneEnabled = Room.SafeZoneEnabled; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rp_rooms` SET `safezone_enabled` = @SafeZoneEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("SafeZoneEnabled", PlusEnvironment.BoolToEnum(Room.SafeZoneEnabled)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de Zona Segura agora está " + (Room.SafeZoneEnabled == true ? "ativado!" : "desativado!"), 1); break; } case "pets": case "morphs": case "animais": { Room.PetMorphsAllowed = !Room.PetMorphsAllowed; Room.RoomData.PetMorphsAllowed = Room.PetMorphsAllowed; PlusEnvironment.GetGame().GetRoomManager().UpdateRoom(Room); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `pet_morphs_allowed` = @PetMorphsAllowed WHERE `id` = '" + Room.Id + "' LIMIT 1"); dbClient.AddParameter("PetMorphsAllowed", PlusEnvironment.BoolToEnum(Room.PetMorphsAllowed)); dbClient.RunQuery(); } Session.SendWhisper("Configurações de pet/transformações agora está " + (Room.PetMorphsAllowed == true ? "ativado!" : "desativado!"), 1); if (!Room.PetMorphsAllowed) { foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers()) { if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null) { continue; } User.GetClient().SendWhisper("O dono da sala desativou a habilidade de usar um animal de estimação em sua casa.", 1); if (User.GetClient().GetHabbo().PetId > 0) { // Tell the user what is going on. User.GetClient().SendWhisper("Opa, o dono da sala desativou a habilidade de usar um animal de estimação em sua casa.", 1); // Change the users Pet Id. User.GetClient().GetHabbo().PetId = 0; // Quickly remove the old user instance. Room.SendMessage(new UserRemoveComposer(User.VirtualId)); // Add the new one, they won't even notice a thing. Room.SendMessage(new UsersComposer(User)); } } } break; } } }
/// <summary> /// Save any chats that were created to the database /// </summary> public static void SaveNewChats() { foreach (WebSocketChatRoom ChatRoom in RunningChatRooms.Values) { if (ChatRoom == null) { continue; } if (ChatRoom.FromDB == true) { continue; } DataRow CheckRow = null; using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DB.SetQuery("SELECT NULL FROM rp_chat_rooms WHERE name = '" + ChatRoom.ChatName + "'"); CheckRow = DB.getRow(); if (CheckRow == null) { DB.RunQuery("INSERT INTO rp_chat_rooms(owner_id, name, password, locked, gang_id, admins) VALUES('" + ChatRoom.ChatOwner + "', '" + ChatRoom.ChatName + "', '" + ChatRoom.ChatValues["password"] + "', '" + PlusEnvironment.BoolToEnum(Convert.ToBoolean(ChatRoom.ChatValues["locked"])) + "', '" + ChatRoom.ChatValues["gang"] + "', '" + String.Join(":", ChatRoom.ChatAdmins) + "')"); ChatRoom.FromDB = false; } } } }
public void DownloadFurnis() { #region Variables XDocument xDoc = XDocument.Load(@"furnidata_updated.xml"); string ItemName = ""; string Type = "s"; int SpriteId = 1; int XDim = 0; int YDim = 0; string PublicName = ""; string Description = ""; string AdURL = ""; string CustomParams = ""; int SpecialType = 0; bool ExcludedDynamic = false; bool CanStandOn = false; bool CanSitOn = false; bool CanLayOn = false; string FurniLine = ""; #endregion #region Execute using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { var downloadRoomList = xDoc.Descendants("roomitemtypes").Descendants("furnitype"); var downloadWallList = xDoc.Descendants("wallitemtypes").Descendants("furnitype"); if (downloadRoomList.ToList().Count > 0) { foreach (var downloadRoomItem in downloadRoomList) { #region Set Variables try { ItemName = downloadRoomItem .Attribute("classname") .Value; SpriteId = Convert.ToInt32(downloadRoomItem .Attribute("id") .Value); PublicName = downloadRoomItem .Element("name") .Value; Description = downloadRoomItem .Element("description") .Value; SpecialType = Convert.ToInt32(downloadRoomItem .Element("specialtype") .Value); AdURL = downloadRoomItem .Element("adurl") .Value; CustomParams = downloadRoomItem .Element("customparams") .Value; XDim = Convert.ToInt32(downloadRoomItem .Element("xdim") .Value); YDim = Convert.ToInt32(downloadRoomItem .Element("ydim") .Value); ExcludedDynamic = PlusEnvironment.EnumToBool(downloadRoomItem .Element("excludeddynamic") .Value); CanLayOn = PlusEnvironment.EnumToBool(downloadRoomItem .Element("canlayon") .Value); CanSitOn = PlusEnvironment.EnumToBool(downloadRoomItem .Element("cansiton") .Value); CanStandOn = PlusEnvironment.EnumToBool(downloadRoomItem .Element("canstandon") .Value); FurniLine = downloadRoomItem .Element("furniline") .Value; } catch (Exception e) { Console.WriteLine(e.ToString()); } #endregion #region Insert Query try { dbClient.SetQuery("INSERT INTO `furniture_new`" + "(id,item_name,public_name,type,width,length,can_sit,can_lay,is_walkable,sprite_id,description,specialtype,customparams,excludeddynamic,adurl,furniline) VALUES " + "(@id,@item_name,@public_name,@type,@width,@length,@can_sit,@can_lay,@is_walkable,@sprite_id,@description,@specialtype,@customparams,@excludeddynamic,@adurl,@furniline) ON DUPLICATE KEY UPDATE " + "id = VALUES(id)," + "item_name = VALUES(item_name)," + "public_name = VALUES(public_name)," + "type = VALUES(type)," + "width = VALUES(width)," + "length = VALUES(length)," + "can_sit = VALUES(can_sit)," + "can_lay = VALUES(can_lay)," + "is_walkable = VALUES(is_walkable)," + "sprite_id = VALUES(sprite_id)," + "description = VALUES(description)," + "specialtype = VALUES(specialtype)," + "customparams = VALUES(customparams)," + "excludeddynamic = VALUES(excludeddynamic)," + "adurl = VALUES(adurl)," + "furniline = VALUES(furniline);"); dbClient.AddParameter("id", SpriteId); dbClient.AddParameter("item_name", ItemName); dbClient.AddParameter("public_name", PublicName); dbClient.AddParameter("type", Type); dbClient.AddParameter("width", XDim); dbClient.AddParameter("length", YDim); dbClient.AddParameter("can_sit", PlusEnvironment.BoolToEnum(CanSitOn)); dbClient.AddParameter("can_lay", PlusEnvironment.BoolToEnum(CanLayOn)); dbClient.AddParameter("is_walkable", PlusEnvironment.BoolToEnum(CanStandOn)); dbClient.AddParameter("sprite_id", SpriteId); dbClient.AddParameter("description", Description); dbClient.AddParameter("specialtype", SpecialType); dbClient.AddParameter("customparams", CustomParams); dbClient.AddParameter("excludeddynamic", PlusEnvironment.BoolToEnum(ExcludedDynamic)); dbClient.AddParameter("adurl", AdURL); dbClient.AddParameter("furniline", FurniLine); dbClient.RunQuery(); } catch (Exception e) { Console.WriteLine(e.ToString()); } #endregion } log.Info("Itens da sala baixados"); } if (downloadWallList.ToList().Count > 0) { foreach (var downloadWallItem in downloadWallList) { #region Set Variables try { ItemName = downloadWallItem .Attribute("classname") .Value; SpriteId = Convert.ToInt32(downloadWallItem .Attribute("id") .Value); PublicName = downloadWallItem .Element("name") .Value; Description = downloadWallItem .Element("description") .Value; SpecialType = Convert.ToInt32(downloadWallItem .Element("specialtype") .Value); FurniLine = downloadWallItem .Element("furniline") .Value; Type = "i"; } catch (Exception e) { Console.WriteLine(e.ToString()); } #endregion #region Insert Query try { dbClient.SetQuery("INSERT INTO `furniture_new`" + "(id,item_name,public_name,type,width,length,can_sit,can_lay,is_walkable,sprite_id,description,specialtype,customparams,excludeddynamic,adurl,furniline) VALUES " + "(@id,@item_name,@public_name,@type,@width,@length,@can_sit,@can_lay,@is_walkable,@sprite_id,@description,@specialtype,@customparams,@excludeddynamic,@adurl,@furniline) ON DUPLICATE KEY UPDATE " + "id = VALUES(id)," + "item_name = VALUES(item_name)," + "public_name = VALUES(public_name)," + "type = VALUES(type)," + "width = VALUES(width)," + "length = VALUES(length)," + "can_sit = VALUES(can_sit)," + "can_lay = VALUES(can_lay)," + "is_walkable = VALUES(is_walkable)," + "sprite_id = VALUES(sprite_id)," + "description = VALUES(description)," + "specialtype = VALUES(specialtype)," + "customparams = VALUES(customparams)," + "excludeddynamic = VALUES(excludeddynamic)," + "adurl = VALUES(adurl)," + "furniline = VALUES(furniline);"); dbClient.AddParameter("id", (100000 + SpriteId)); dbClient.AddParameter("item_name", ItemName); dbClient.AddParameter("public_name", PublicName); dbClient.AddParameter("type", Type); dbClient.AddParameter("width", 0); dbClient.AddParameter("length", 0); dbClient.AddParameter("can_sit", 0); dbClient.AddParameter("can_lay", 0); dbClient.AddParameter("is_walkable", 0); dbClient.AddParameter("sprite_id", SpriteId); dbClient.AddParameter("description", Description); dbClient.AddParameter("specialtype", SpecialType); dbClient.AddParameter("customparams", ""); dbClient.AddParameter("excludeddynamic", 0); dbClient.AddParameter("adurl", AdURL); dbClient.AddParameter("furniline", FurniLine); dbClient.RunQuery(); } catch (Exception e) { Console.WriteLine(e.ToString()); } #endregion } log.Info("Itens de parede baixados"); } } #endregion }
/// <summary> /// Saves the chat rooms data to database /// </summary> public void SaveChatRoomData() { try { #region Save owner, password, gang, locked using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DB.SetQuery("UPDATE `rp_chat_rooms` SET `owner_id` = @ownerid, `password` = @password, `gang_id` = @gangid, `locked` = @locked WHERE `name` = @chatname"); DB.AddParameter("ownerid", this.ChatOwner); DB.AddParameter("password", this.ChatValues["password"]); DB.AddParameter("gangid", this.ChatValues["gang"]); DB.AddParameter("locked", PlusEnvironment.BoolToEnum(Convert.ToBoolean(this.ChatValues["locked"]))); DB.AddParameter("chatname", this.ChatName); DB.RunQuery(); } #endregion #region Save admins string AdminString = ""; foreach (int ChatAdmin in this.ChatAdmins) { AdminString += ChatAdmin + ","; } if (AdminString.EndsWith(",")) { AdminString = AdminString.Remove(AdminString.Length - 1); } using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DB.SetQuery("UPDATE `rp_chat_rooms` SET `admins` = @admins WHERE `name` = @chatname"); DB.AddParameter("admins", AdminString); DB.AddParameter("chatname", this.ChatName); DB.RunQuery(); } #endregion #region Save banned users foreach (KeyValuePair <int, double> BannedUser in this.BannedUsers) { using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DataRow ExistingRow = null; DB.SetQuery("SELECT NULL FROM `rp_chat_rooms_data` WHERE `chat_name` = @chatname AND `data_type` = 'ban' AND `data_value` = @value"); DB.AddParameter("chatname", this.ChatName); DB.AddParameter("value", BannedUser.Key); ExistingRow = DB.getRow(); if (ExistingRow != null) { DB.SetQuery("UPDATE `rp_chat_rooms_data` SET `data_timestamp_expire` = @expire WHERE `chat_name` = @chatname AND `data_type` = 'ban' AND `data_value` = @value"); DB.AddParameter("chatname", this.ChatName); DB.AddParameter("expire", BannedUser.Value); DB.AddParameter("value", BannedUser.Key); DB.RunQuery(); continue; } DB.RunQuery("INSERT INTO `rp_chat_rooms_data` (`chat_name`,`data_type`,`data_value`,`data_timestamp_expire`) VALUES ('" + this.ChatName + "', 'ban', '" + BannedUser.Key + "', '" + BannedUser.Value + "')"); } } foreach (KeyValuePair <int, int> UnbannedUser in this.UnbannedUsers) { int UsersID = UnbannedUser.Key; using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DB.SetQuery("DELETE FROM `rp_chat_rooms_data` WHERE `chat_name` = @chatname AND `data_type` = 'ban' AND `data_value` = @data"); DB.AddParameter("chatname", this.ChatName); DB.AddParameter("data", UsersID); DB.RunQuery(); } } #endregion #region Save muted users foreach (KeyValuePair <int, double> MutedUser in this.MutedUsers) { using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DataRow ExistingRow = null; DB.SetQuery("SELECT NULL FROM `rp_chat_rooms_data` WHERE `chat_name` = @chatname AND `data_type` = 'mute' AND `data_value` = @value"); DB.AddParameter("chatname", this.ChatName); DB.AddParameter("value", MutedUser.Key); ExistingRow = DB.getRow(); if (ExistingRow != null) { DB.SetQuery("UPDATE `rp_chat_rooms_data` SET `data_timestamp_expire` = @expire WHERE `chat_name` = @chatname"); DB.AddParameter("chatname", this.ChatName); DB.AddParameter("expire", MutedUser.Value); DB.RunQuery(); continue; } DB.SetQuery("INSERT INTO `rp_chat_rooms_data` (`chat_name`, `data_type`, `data_value`, `data_timestamp_expire`) VALUES (@chatname, 'mute', @value, @expire)"); DB.AddParameter("chatname", this.ChatName); DB.AddParameter("value", MutedUser.Key); DB.AddParameter("expire", MutedUser.Value); DB.RunQuery(); } } foreach (KeyValuePair <int, int> UnmutedUser in this.UnmutedUsers) { int UsersID = UnmutedUser.Key; using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DB.SetQuery("DELETE FROM `rp_chat_rooms_data` WHERE `chat_name` = @chatname AND `data_type` = 'mute' AND `data_value` = @data"); DB.AddParameter("chatname", this.ChatName); DB.AddParameter("data", UsersID); DB.RunQuery(); } } #endregion this.SaveChatLogs(); } catch (Exception e) { } }
public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet) { if (session == null || session.GetHabbo() == null) { return; } int roomId = packet.PopInt(); if (!PlusEnvironment.GetGame().GetRoomManager().TryLoadRoom(roomId, out Room room)) { return; } string Name = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString()); string Description = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString()); RoomAccess Access = RoomAccessUtility.ToRoomAccess(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 formattedTags = new StringBuilder(); for (int i = 0; i < TagCount; i++) { if (i > 0) { formattedTags.Append(","); } string tag = packet.PopString().ToLower(); Tags.Add(tag); formattedTags.Append(tag); } int TradeSettings = packet.PopInt();//2 = All can trade, 1 = owner only, 0 = no trading. int AllowPets = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean())); int AllowPetsEat = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean())); int RoomBlockingEnabled = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean())); int Hidewall = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean())); int WallThickness = packet.PopInt(); int FloorThickness = packet.PopInt(); int WhoMute = packet.PopInt(); // mute int WhoKick = packet.PopInt(); // kick int WhoBan = packet.PopInt(); // ban int chatMode = packet.PopInt(); int chatSize = packet.PopInt(); int chatSpeed = packet.PopInt(); int chatDistance = packet.PopInt(); int extraFlood = packet.PopInt(); if (chatMode < 0 || chatMode > 1) { chatMode = 0; } if (chatSize < 0 || chatSize > 2) { chatSize = 0; } if (chatSpeed < 0 || chatSpeed > 2) { chatSpeed = 0; } if (chatDistance < 0) { chatDistance = 1; } if (chatDistance > 99) { chatDistance = 100; } if (extraFlood < 0 || extraFlood > 2) { extraFlood = 0; } if (TradeSettings < 0 || TradeSettings > 2) { TradeSettings = 0; } if (WhoMute < 0 || WhoMute > 1) { WhoMute = 0; } if (WhoKick < 0 || WhoKick > 1) { WhoKick = 0; } if (WhoBan < 0 || WhoBan > 1) { WhoBan = 0; } if (WallThickness < -2 || WallThickness > 1) { WallThickness = 0; } if (FloorThickness < -2 || FloorThickness > 1) { FloorThickness = 0; } if (Name.Length < 1) { return; } if (Name.Length > 60) { Name = Name.Substring(0, 60); } if (Access == RoomAccess.Password && Password.Length == 0) { Access = RoomAccess.Open; } if (MaxUsers < 0) { MaxUsers = 10; } if (MaxUsers > 50) { MaxUsers = 50; } SearchResultList SearchResultList = null; if (!PlusEnvironment.GetGame().GetNavigator().TryGetSearchResultList(CategoryId, out SearchResultList)) { CategoryId = 36; } if (SearchResultList.CategoryType != NavigatorCategoryType.Category || SearchResultList.RequiredRank > session.GetHabbo().Rank || (session.GetHabbo().Id != room.OwnerId && session.GetHabbo().Rank >= SearchResultList.RequiredRank)) { CategoryId = 36; } if (TagCount > 2) { return; } room.AllowPets = AllowPets; room.AllowPetsEating = AllowPetsEat; room.RoomBlockingEnabled = RoomBlockingEnabled; room.Hidewall = Hidewall; room.Name = Name; room.Access = Access; room.Description = Description; room.Category = CategoryId; room.Password = Password; room.WhoCanBan = WhoBan; room.WhoCanKick = WhoKick; room.WhoCanMute = WhoMute; room.ClearTags(); room.AddTagRange(Tags); room.UsersMax = MaxUsers; room.WallThickness = WallThickness; room.FloorThickness = FloorThickness; room.ChatMode = chatMode; room.ChatSize = chatSize; room.ChatSpeed = chatSpeed; room.ChatDistance = chatDistance; room.ExtraFlood = extraFlood; room.TradeSettings = TradeSettings; string AccessStr = Password.Length > 0 ? "password" : "open"; switch (Access) { default: case RoomAccess.Open: AccessStr = "open"; break; case RoomAccess.Password: AccessStr = "password"; break; case RoomAccess.Doorbell: AccessStr = "locked"; break; case RoomAccess.Invisible: AccessStr = "invisible"; break; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `caption` = @caption, `description` = @description, `password` = @password, `category` = @categoryId, `state` = @state, `tags` = @tags, `users_max` = @maxUsers, `allow_pets` = @allowPets, `allow_pets_eat` = @allowPetsEat, `room_blocking_disabled` = @roomBlockingDisabled, `allow_hidewall` = @allowHidewall, `floorthick` = @floorThick, `wallthick` = @wallThick, `mute_settings` = @muteSettings, `kick_settings` = @kickSettings, `ban_settings` = @banSettings, `chat_mode` = @chatMode, `chat_size` = @chatSize, `chat_speed` = @chatSpeed, `chat_extra_flood` = @extraFlood, `chat_hearing_distance` = @chatDistance, `trade_settings` = @tradeSettings WHERE `id` = @roomId LIMIT 1"); dbClient.AddParameter("categoryId", CategoryId); dbClient.AddParameter("maxUsers", MaxUsers); dbClient.AddParameter("allowPets", AllowPets); dbClient.AddParameter("allowPetsEat", AllowPetsEat); dbClient.AddParameter("roomBlockingDisabled", RoomBlockingEnabled); dbClient.AddParameter("allowHidewall", room.Hidewall); dbClient.AddParameter("floorThick", room.FloorThickness); dbClient.AddParameter("wallThick", room.WallThickness); dbClient.AddParameter("muteSettings", room.WhoCanMute); dbClient.AddParameter("kickSettings", room.WhoCanKick); dbClient.AddParameter("banSettings", room.WhoCanBan); dbClient.AddParameter("chatMode", room.ChatMode); dbClient.AddParameter("chatSize", room.ChatSize); dbClient.AddParameter("chatSpeed", room.ChatSpeed); dbClient.AddParameter("extraFlood", room.ExtraFlood); dbClient.AddParameter("chatDistance", room.ChatDistance); dbClient.AddParameter("tradeSettings", room.TradeSettings); dbClient.AddParameter("roomId", room.Id); dbClient.AddParameter("caption", room.Name); dbClient.AddParameter("description", room.Description); dbClient.AddParameter("password", room.Password); dbClient.AddParameter("state", AccessStr); dbClient.AddParameter("tags", formattedTags.ToString()); dbClient.RunQuery(); } room.GetGameMap().GenerateMaps(); if (session.GetHabbo().CurrentRoom == null) { session.SendPacket(new RoomSettingsSavedComposer(room.RoomId)); session.SendPacket(new RoomInfoUpdatedComposer(room.RoomId)); session.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString()))); } else { room.SendPacket(new RoomSettingsSavedComposer(room.RoomId)); room.SendPacket(new RoomInfoUpdatedComposer(room.RoomId)); room.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString()))); } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModDoorModeSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModWalkthroughSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatScrollSpeedSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatFloodFilterSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatHearRangeSeen", 1); }
/// <summary> /// Adds the parameters to the mysql command /// </summary> private void AddParameters(IQueryAdapter DB) { // User ID DB.AddParameter("userid", Client.GetHabbo().Id); // Basic Info DB.AddParameter("level", RoleplayUser.Level); DB.AddParameter("exp", RoleplayUser.LevelEXP); // Job Info DB.AddParameter("jobid", RoleplayUser.JobId); DB.AddParameter("jobrank", RoleplayUser.JobRank); DB.AddParameter("jobrequest", RoleplayUser.JobRequest); // Human Needs DB.AddParameter("maxhealth", RoleplayUser.MaxHealth); DB.AddParameter("curhealth", RoleplayUser.CurHealth); DB.AddParameter("maxenergy", RoleplayUser.MaxEnergy); DB.AddParameter("curenergy", RoleplayUser.CurEnergy); DB.AddParameter("hunger", RoleplayUser.Hunger); DB.AddParameter("hygiene", RoleplayUser.Hygiene); // Levelable Stats DB.AddParameter("intelligence", RoleplayUser.Intelligence); DB.AddParameter("strength", RoleplayUser.Strength); DB.AddParameter("stamina", RoleplayUser.Stamina); // Extra Variables for Levelable Stats DB.AddParameter("intelligence_exp", RoleplayUser.IntelligenceEXP); DB.AddParameter("strength_exp", RoleplayUser.StrengthEXP); DB.AddParameter("stamina_exp", RoleplayUser.StaminaEXP); // Jailed/Dead - Wanted/Probation - Sendhome DB.AddParameter("is_dead", PlusEnvironment.BoolToEnum(RoleplayUser.IsDead)); DB.AddParameter("dead_time_left", RoleplayUser.DeadTimeLeft); DB.AddParameter("is_jailed", PlusEnvironment.BoolToEnum(RoleplayUser.IsJailed)); DB.AddParameter("jailed_time_left", RoleplayUser.JailedTimeLeft); DB.AddParameter("is_wanted", PlusEnvironment.BoolToEnum(RoleplayUser.IsWanted)); DB.AddParameter("wanted_level", RoleplayUser.WantedLevel); DB.AddParameter("wanted_time_left", RoleplayUser.WantedTimeLeft); DB.AddParameter("on_probation", PlusEnvironment.BoolToEnum(RoleplayUser.OnProbation)); DB.AddParameter("probation_time_left", RoleplayUser.ProbationTimeLeft); DB.AddParameter("sendhome_time_left", RoleplayUser.SendHomeTimeLeft); DB.AddParameter("is_cuffed", PlusEnvironment.BoolToEnum(RoleplayUser.Cuffed)); DB.AddParameter("cuffed_time_left", RoleplayUser.CuffedTimeLeft); // Affiliations DB.AddParameter("last_killed", RoleplayUser.LastKilled); DB.AddParameter("married", RoleplayUser.MarriedTo); // Gang Info DB.AddParameter("gangid", RoleplayUser.GangId); DB.AddParameter("gangrank", RoleplayUser.GangRank); DB.AddParameter("gangrequest", RoleplayUser.GangRequest); // Statistics DB.AddParameter("punches", RoleplayUser.Punches); DB.AddParameter("kills", RoleplayUser.Kills); DB.AddParameter("hit_kills", RoleplayUser.HitKills); DB.AddParameter("gun_kills", RoleplayUser.GunKills); DB.AddParameter("deaths", RoleplayUser.Deaths); DB.AddParameter("cop_deaths", RoleplayUser.CopDeaths); DB.AddParameter("time_worked", RoleplayUser.TimeWorked); DB.AddParameter("arrests", RoleplayUser.Arrests); DB.AddParameter("arrested", RoleplayUser.Arrested); DB.AddParameter("evasions", RoleplayUser.Evasions); // Banking DB.AddParameter("bank_account", RoleplayUser.BankAccount); DB.AddParameter("bank_chequings", RoleplayUser.BankChequings); DB.AddParameter("bank_savings", RoleplayUser.BankSavings); // Inventory DB.AddParameter("phone", RoleplayUser.PhoneType); DB.AddParameter("phone_apps", (RoleplayUser.PhoneApps.Count > 1) ? String.Join(":", RoleplayUser.PhoneApps) : Convert.ToString(RoleplayUser.PhoneApps[0])); DB.AddParameter("car", RoleplayUser.CarType); DB.AddParameter("car_fuel", RoleplayUser.CarFuel); DB.AddParameter("weed", RoleplayUser.Weed); DB.AddParameter("cocaine", RoleplayUser.Cocaine); DB.AddParameter("cigarette", RoleplayUser.Cigarettes); DB.AddParameter("bullets", RoleplayUser.Bullets); DB.AddParameter("dynamite", RoleplayUser.Dynamite); // Minigames DB.AddParameter("brawl_wins", RoleplayUser.BrawlWins); DB.AddParameter("cw_wins", RoleplayUser.CwWins); DB.AddParameter("mw_wins", RoleplayUser.MwWins); DB.AddParameter("soloqueue_wins", RoleplayUser.SoloQueueWins); // Newcomer Misc DB.AddParameter("is_noob", PlusEnvironment.BoolToEnum(RoleplayUser.IsNoob)); DB.AddParameter("noob_time_left", RoleplayUser.NoobTimeLeft); // Uncategorized DB.AddParameter("vip_banned", RoleplayUser.VIPBanned); DB.AddParameter("wchat_banned", PlusEnvironment.BoolToEnum(RoleplayUser.BannedFromChatting)); DB.AddParameter("wchat_making_banned", PlusEnvironment.BoolToEnum(RoleplayUser.BannedFromMakingChat)); DB.AddParameter("last_coordinates", RoleplayUser.LastCoordinates); }
public void Execute(GameClient session, Room room, string[] Params) { if (Params.Length == 1) { session.SendWhisper("Oops, you must choose a room option to disable."); return; } if (!room.CheckRights(session, true)) { session.SendWhisper("Oops, only the room owner or staff can use this command."); return; } var option = Params[1]; switch (option) { case "list": { var list = new StringBuilder(""); list.AppendLine("Room Command List"); list.AppendLine("-------------------------"); list.AppendLine("Pet Morphs: " + (room.PetMorphsAllowed ? "enabled" : "disabled")); list.AppendLine("Pull: " + (room.PullEnabled ? "enabled" : "disabled")); list.AppendLine("Push: " + (room.PushEnabled ? "enabled" : "disabled")); list.AppendLine("Super Pull: " + (room.SPullEnabled ? "enabled" : "disabled")); list.AppendLine("Super Push: " + (room.SPushEnabled ? "enabled" : "disabled")); list.AppendLine("Respect: " + (room.RespectNotificationsEnabled ? "enabled" : "disabled")); list.AppendLine("Enables: " + (room.EnablesEnabled ? "enabled" : "disabled")); session.SendNotification(list.ToString()); break; } case "push": { room.PushEnabled = !room.PushEnabled; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `push_enabled` = @PushEnabled WHERE `id` = '" + room.Id + "' LIMIT 1"); dbClient.AddParameter("PushEnabled", PlusEnvironment.BoolToEnum(room.PushEnabled)); dbClient.RunQuery(); } session.SendWhisper("Push mode is now " + (room.PushEnabled ? "enabled!" : "disabled!")); break; } case "spush": { room.SPushEnabled = !room.SPushEnabled; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `spush_enabled` = @PushEnabled WHERE `id` = '" + room.Id + "' LIMIT 1"); dbClient.AddParameter("PushEnabled", PlusEnvironment.BoolToEnum(room.SPushEnabled)); dbClient.RunQuery(); } session.SendWhisper("Super Push mode is now " + (room.SPushEnabled ? "enabled!" : "disabled!")); break; } case "spull": { room.SPullEnabled = !room.SPullEnabled; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `spull_enabled` = @PullEnabled WHERE `id` = '" + room.Id + "' LIMIT 1"); dbClient.AddParameter("PullEnabled", PlusEnvironment.BoolToEnum(room.SPullEnabled)); dbClient.RunQuery(); } session.SendWhisper("Super Pull mode is now " + (room.SPullEnabled ? "enabled!" : "disabled!")); break; } case "pull": { room.PullEnabled = !room.PullEnabled; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `pull_enabled` = @PullEnabled WHERE `id` = '" + room.Id + "' LIMIT 1"); dbClient.AddParameter("PullEnabled", PlusEnvironment.BoolToEnum(room.PullEnabled)); dbClient.RunQuery(); } session.SendWhisper("Pull mode is now " + (room.PullEnabled ? "enabled!" : "disabled!")); break; } case "enable": case "enables": { room.EnablesEnabled = !room.EnablesEnabled; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `enables_enabled` = @EnablesEnabled WHERE `id` = '" + room.Id + "' LIMIT 1"); dbClient.AddParameter("EnablesEnabled", PlusEnvironment.BoolToEnum(room.EnablesEnabled)); dbClient.RunQuery(); } session.SendWhisper("Enables mode set to " + (room.EnablesEnabled ? "enabled!" : "disabled!")); break; } case "respect": { room.RespectNotificationsEnabled = !room.RespectNotificationsEnabled; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery( "UPDATE `rooms` SET `respect_notifications_enabled` = @RespectNotificationsEnabled WHERE `id` = '" + room.Id + "' LIMIT 1"); dbClient.AddParameter("RespectNotificationsEnabled", PlusEnvironment.BoolToEnum(room.RespectNotificationsEnabled)); dbClient.RunQuery(); } session.SendWhisper("Respect notifications mode set to " + (room.RespectNotificationsEnabled ? "enabled!" : "disabled!")); break; } case "pets": case "morphs": { room.PetMorphsAllowed = !room.PetMorphsAllowed; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `pet_morphs_allowed` = @PetMorphsAllowed WHERE `id` = '" + room.Id + "' LIMIT 1"); dbClient.AddParameter("PetMorphsAllowed", PlusEnvironment.BoolToEnum(room.PetMorphsAllowed)); dbClient.RunQuery(); } session.SendWhisper("Human pet morphs notifications mode set to " + (room.PetMorphsAllowed ? "enabled!" : "disabled!")); if (!room.PetMorphsAllowed) { foreach (var user in room.GetRoomUserManager().GetRoomUsers()) { if (user == null || user.GetClient() == null || user.GetClient().GetHabbo() == null) { continue; } user.GetClient() .SendWhisper("The room owner has disabled the ability to use a pet morph in this room."); if (user.GetClient().GetHabbo().PetId > 0) { //Tell the user what is going on. user.GetClient() .SendWhisper("Oops, the room owner has just disabled pet-morphs, un-morphing you."); //Change the users Pet Id. user.GetClient().GetHabbo().PetId = 0; //Quickly remove the old user instance. room.SendPacket(new UserRemoveComposer(user.VirtualId)); //Add the new one, they won't even notice a thing!!11 8-) room.SendPacket(new UsersComposer(user)); } } } break; } } }
public void Parse(GameClient session, ClientPacket packet) { if (!session.GetHabbo().InRoom) { return; } var room = session.GetHabbo().CurrentRoom; if (room == null) { return; } var botId = packet.PopInt(); var actionId = packet.PopInt(); var dataString = packet.PopString(); if (actionId < 1 || actionId > 5) { return; } RoomUser bot; if (!room.GetRoomUserManager().TryGetBot(botId, out bot)) { return; } if (bot.BotData.OwnerId != session.GetHabbo().Id&& !session.GetHabbo().GetPermissions().HasRight("bot_edit_any_override")) { return; } var roomBot = bot.BotData; if (roomBot == null) { return; } /* 1 = Copy looks * 2 = Setup Speech * 3 = Relax * 4 = Dance * 5 = Change Name */ switch (actionId) { #region Copy Looks (1) case 1: { var userChangeComposer = new ServerPacket(ServerPacketHeader.UserChangeMessageComposer); userChangeComposer.WriteInteger(bot.VirtualId); userChangeComposer.WriteString(session.GetHabbo().Look); userChangeComposer.WriteString(session.GetHabbo().Gender); userChangeComposer.WriteString(bot.BotData.Motto); userChangeComposer.WriteInteger(0); room.SendPacket(userChangeComposer); //Change the defaults bot.BotData.Look = session.GetHabbo().Look; bot.BotData.Gender = session.GetHabbo().Gender; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `look` = @look, `gender` = '" + session.GetHabbo().Gender + "' WHERE `id` = '" + bot.BotData.Id + "' LIMIT 1"); dbClient.AddParameter("look", session.GetHabbo().Look); dbClient.RunQuery(); } //Room.SendMessage(new UserChangeComposer(BotUser.GetClient(), true)); break; } #endregion #region Setup Speech (2) case 2: { var configData = dataString.Split(new[] { ";#;" }, StringSplitOptions.None); var speechData = configData[0].Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); var automaticChat = Convert.ToString(configData[1]); var speakingInterval = Convert.ToString(configData[2]); var mixChat = Convert.ToString(configData[3]); if (string.IsNullOrEmpty(speakingInterval) || Convert.ToInt32(speakingInterval) <= 0 || Convert.ToInt32(speakingInterval) < 7) { speakingInterval = "7"; } roomBot.AutomaticChat = Convert.ToBoolean(automaticChat); roomBot.SpeakingInterval = Convert.ToInt32(speakingInterval); roomBot.MixSentences = Convert.ToBoolean(mixChat); using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `bots_speech` WHERE `bot_id` = '" + bot.BotData.Id + "'"); #region Save Data - TODO: MAKE METHODS FOR THIS. for (var i = 0; i <= speechData.Length - 1; i++) { dbClient.SetQuery("INSERT INTO `bots_speech` (`bot_id`, `text`) VALUES (@id, @data)"); dbClient.AddParameter("id", botId); dbClient.AddParameter("data", speechData[i]); dbClient.RunQuery(); dbClient.SetQuery( "UPDATE `bots` SET `automatic_chat` = @AutomaticChat, `speaking_interval` = @SpeakingInterval, `mix_sentences` = @MixChat WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", botId); dbClient.AddParameter("AutomaticChat", automaticChat.ToLower()); dbClient.AddParameter("SpeakingInterval", Convert.ToInt32(speakingInterval)); dbClient.AddParameter("MixChat", PlusEnvironment.BoolToEnum(Convert.ToBoolean(mixChat))); dbClient.RunQuery(); } #endregion #region Handle Speech roomBot.RandomSpeech.Clear(); dbClient.SetQuery("SELECT `text` FROM `bots_speech` WHERE `bot_id` = @id"); dbClient.AddParameter("id", botId); var botSpeech = dbClient.GetTable(); var speeches = new List <RandomSpeech>(); foreach (DataRow speech in botSpeech.Rows) { roomBot.RandomSpeech.Add(new RandomSpeech(Convert.ToString(speech["text"]), botId)); } #endregion } break; } #endregion #region Relax (3) case 3: { if (bot.BotData.WalkingMode == "stand") { bot.BotData.WalkingMode = "freeroam"; } else { bot.BotData.WalkingMode = "stand"; } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots` SET `walk_mode` = '" + bot.BotData.WalkingMode + "' WHERE `id` = '" + bot.BotData.Id + "' LIMIT 1"); } break; } #endregion #region Dance (4) case 4: { if (bot.BotData.DanceId > 0) { bot.BotData.DanceId = 0; } else { var randomDance = new Random(); bot.BotData.DanceId = randomDance.Next(1, 4); } room.SendPacket(new DanceComposer(bot, bot.BotData.DanceId)); break; } #endregion #region Change Name (5) case 5: { if (dataString.Length == 0) { session.SendWhisper("Come on, atleast give the bot a name!"); return; } if (dataString.Length >= 16) { session.SendWhisper("Come on, the bot doesn't need a name that long!"); return; } if (dataString.Contains("<img src") || dataString.Contains("<font ") || dataString.Contains("</font>") || dataString.Contains("</a>") || dataString.Contains("<i>")) { session.SendWhisper("No HTML, please :<"); return; } bot.BotData.Name = dataString; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `name` = @name WHERE `id` = '" + bot.BotData.Id + "' LIMIT 1"); dbClient.AddParameter("name", dataString); dbClient.RunQuery(); } room.SendPacket(new UsersComposer(bot)); break; } #endregion } }
public void SaveNewChat() { DataRow CheckRow = null; using (IQueryAdapter DB = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { DB.SetQuery("SELECT NULL FROM rp_chat_rooms WHERE name = @chatname"); DB.AddParameter("chatname", this.ChatName); CheckRow = DB.getRow(); if (CheckRow == null) { DB.SetQuery("INSERT INTO rp_chat_rooms(owner_id, name, password, locked, gang_id, admins) VALUES('" + this.ChatOwner + "', @chatname, '" + this.ChatValues["password"] + "', '" + PlusEnvironment.BoolToEnum(Convert.ToBoolean(this.ChatValues["locked"])) + "', '" + this.ChatValues["gang"] + "', '" + String.Join(":", this.ChatAdmins) + "')"); DB.AddParameter("chatname", this.ChatName); DB.RunQuery(); this.FromDB = false; } } }
public void Parse(GameClient session, ClientPacket packet) { if (session?.GetHabbo() == null) { return; } var room = PlusEnvironment.GetGame().GetRoomManager().LoadRoom(packet.PopInt()); if (room == null || !room.CheckRights(session, true)) { return; } var name = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString()); var description = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(packet.PopString()); var access = RoomAccessUtility.ToRoomAccess(packet.PopInt()); var password = packet.PopString(); var maxUsers = packet.PopInt(); var categoryId = packet.PopInt(); var tagCount = packet.PopInt(); var tags = new List <string>(); var formattedTags = new StringBuilder(); for (var i = 0; i < tagCount; i++) { if (i > 0) { formattedTags.Append(","); } var tag = packet.PopString().ToLower(); tags.Add(tag); formattedTags.Append(tag); } var tradeSettings = packet.PopInt(); //2 = All can trade, 1 = owner only, 0 = no trading. var allowPets = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean())); var allowPetsEat = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean())); var roomBlockingEnabled = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean())); var hidewall = Convert.ToInt32(PlusEnvironment.BoolToEnum(packet.PopBoolean())); var wallThickness = packet.PopInt(); var floorThickness = packet.PopInt(); var whoMute = packet.PopInt(); // mute var whoKick = packet.PopInt(); // kick var whoBan = packet.PopInt(); // ban var chatMode = packet.PopInt(); var chatSize = packet.PopInt(); var chatSpeed = packet.PopInt(); var chatDistance = packet.PopInt(); var extraFlood = packet.PopInt(); if (chatMode < 0 || chatMode > 1) { chatMode = 0; } if (chatSize < 0 || chatSize > 2) { chatSize = 0; } if (chatSpeed < 0 || chatSpeed > 2) { chatSpeed = 0; } if (chatDistance < 0) { chatDistance = 1; } if (chatDistance > 99) { chatDistance = 100; } if (extraFlood < 0 || extraFlood > 2) { extraFlood = 0; } if (tradeSettings < 0 || tradeSettings > 2) { tradeSettings = 0; } if (whoMute < 0 || whoMute > 1) { whoMute = 0; } if (whoKick < 0 || whoKick > 1) { whoKick = 0; } if (whoBan < 0 || whoBan > 1) { whoBan = 0; } if (wallThickness < -2 || wallThickness > 1) { wallThickness = 0; } if (floorThickness < -2 || floorThickness > 1) { floorThickness = 0; } if (name.Length < 1) { return; } if (name.Length > 60) { name = name.Substring(0, 60); } if (access == RoomAccess.PASSWORD && password.Length == 0) { access = RoomAccess.OPEN; } if (maxUsers < 0) { maxUsers = 10; } if (maxUsers > 50) { maxUsers = 50; } SearchResultList searchResultList = null; if (!PlusEnvironment.GetGame().GetNavigator().TryGetSearchResultList(categoryId, out searchResultList)) { categoryId = 36; } if (searchResultList.CategoryType != NavigatorCategoryType.CATEGORY || searchResultList.RequiredRank > session.GetHabbo().Rank || session.GetHabbo().Id != room.OwnerId && session.GetHabbo().Rank >= searchResultList.RequiredRank) { categoryId = 36; } if (tagCount > 2) { return; } room.AllowPets = allowPets; room.AllowPetsEating = allowPetsEat; room.RoomBlockingEnabled = roomBlockingEnabled; room.Hidewall = hidewall; room.RoomData.AllowPets = allowPets; room.RoomData.AllowPetsEating = allowPetsEat; room.RoomData.RoomBlockingEnabled = roomBlockingEnabled; room.RoomData.Hidewall = hidewall; room.Name = name; room.Access = access; room.Description = description; room.Category = categoryId; room.Password = password; room.RoomData.Name = name; room.RoomData.Access = access; room.RoomData.Description = description; room.RoomData.Category = categoryId; room.RoomData.Password = password; room.WhoCanBan = whoBan; room.WhoCanKick = whoKick; room.WhoCanMute = whoMute; room.RoomData.WhoCanBan = whoBan; room.RoomData.WhoCanKick = whoKick; room.RoomData.WhoCanMute = whoMute; room.ClearTags(); room.AddTagRange(tags); room.UsersMax = maxUsers; room.RoomData.Tags.Clear(); room.RoomData.Tags.AddRange(tags); room.RoomData.UsersMax = maxUsers; room.WallThickness = wallThickness; room.FloorThickness = floorThickness; room.RoomData.WallThickness = wallThickness; room.RoomData.FloorThickness = floorThickness; room.chatMode = chatMode; room.chatSize = chatSize; room.chatSpeed = chatSpeed; room.chatDistance = chatDistance; room.extraFlood = extraFlood; room.TradeSettings = tradeSettings; room.RoomData.chatMode = chatMode; room.RoomData.chatSize = chatSize; room.RoomData.chatSpeed = chatSpeed; room.RoomData.chatDistance = chatDistance; room.RoomData.extraFlood = extraFlood; room.RoomData.TradeSettings = tradeSettings; var accessStr = password.Length > 0 ? "password" : "open"; switch (access) { default: case RoomAccess.OPEN: accessStr = "open"; break; case RoomAccess.PASSWORD: accessStr = "password"; break; case RoomAccess.DOORBELL: accessStr = "locked"; break; case RoomAccess.INVISIBLE: accessStr = "invisible"; break; } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery( "UPDATE `rooms` SET `caption` = @caption, `description` = @description, `password` = @password, `category` = @categoryId, `state` = @state, `tags` = @tags, `users_max` = @maxUsers, `allow_pets` = @allowPets, `allow_pets_eat` = @allowPetsEat, `room_blocking_disabled` = @roomBlockingDisabled, `allow_hidewall` = @allowHidewall, `floorthick` = @floorThick, `wallthick` = @wallThick, `mute_settings` = @muteSettings, `kick_settings` = @kickSettings, `ban_settings` = @banSettings, `chat_mode` = @chatMode, `chat_size` = @chatSize, `chat_speed` = @chatSpeed, `chat_extra_flood` = @extraFlood, `chat_hearing_distance` = @chatDistance, `trade_settings` = @tradeSettings WHERE `id` = @roomId LIMIT 1"); dbClient.AddParameter("categoryId", categoryId); dbClient.AddParameter("maxUsers", maxUsers); dbClient.AddParameter("allowPets", allowPets); dbClient.AddParameter("allowPetsEat", allowPetsEat); dbClient.AddParameter("roomBlockingDisabled", roomBlockingEnabled); dbClient.AddParameter("allowHidewall", room.Hidewall); dbClient.AddParameter("floorThick", room.FloorThickness); dbClient.AddParameter("wallThick", room.WallThickness); dbClient.AddParameter("muteSettings", room.WhoCanMute); dbClient.AddParameter("kickSettings", room.WhoCanKick); dbClient.AddParameter("banSettings", room.WhoCanBan); dbClient.AddParameter("chatMode", room.chatMode); dbClient.AddParameter("chatSize", room.chatSize); dbClient.AddParameter("chatSpeed", room.chatSpeed); dbClient.AddParameter("extraFlood", room.extraFlood); dbClient.AddParameter("chatDistance", room.chatDistance); dbClient.AddParameter("tradeSettings", room.TradeSettings); dbClient.AddParameter("roomId", room.Id); dbClient.AddParameter("caption", room.Name); dbClient.AddParameter("description", room.Description); dbClient.AddParameter("password", room.Password); dbClient.AddParameter("state", accessStr); dbClient.AddParameter("tags", formattedTags.ToString()); dbClient.RunQuery(); } room.GetGameMap().GenerateMaps(); if (session.GetHabbo().CurrentRoom == null) { session.SendPacket(new RoomSettingsSavedComposer(room.RoomId)); session.SendPacket(new RoomInfoUpdatedComposer(room.RoomId)); session.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString()))); } else { room.SendPacket(new RoomSettingsSavedComposer(room.RoomId)); room.SendPacket(new RoomInfoUpdatedComposer(room.RoomId)); room.SendPacket(new RoomVisualizationSettingsComposer(room.WallThickness, room.FloorThickness, PlusEnvironment.EnumToBool(room.Hidewall.ToString()))); } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModDoorModeSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModWalkthroughSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatScrollSpeedSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatFloodFilterSeen", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModChatHearRangeSeen", 1); }