public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_mute")) return; int UserId = Packet.PopInt(); string Message = Packet.PopString(); double Length = (Packet.PopInt() * 60); string Unknown1 = Packet.PopString(); string Unknown2 = Packet.PopString(); Habbo Habbo = PlusEnvironment.GetHabboById(UserId); if (Habbo == null) { Session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (Habbo.GetPermissions().HasRight("mod_mute") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any")) { Session.SendWhisper("Oops, you cannot mute that user."); return; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + Length + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TimeMuted = Length; Habbo.GetClient().SendNotification("You have been muted by a moderator for " + Length + " seconds!"); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_soft_ban")) return; int UserId = Packet.PopInt(); string Message = Packet.PopString(); double Length = (Packet.PopInt() * 3600) + PlusEnvironment.GetUnixTimestamp(); string Unknown1 = Packet.PopString(); string Unknown2 = Packet.PopString(); bool IPBan = Packet.PopBoolean(); bool MachineBan = Packet.PopBoolean(); if (MachineBan) IPBan = false; Habbo Habbo = PlusEnvironment.GetHabboById(UserId); if (Habbo == null) { Session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Oops, you cannot ban that user."); return; } Message = (Message != null ? Message : "No reason specified."); string Username = Habbo.Username; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); } if (IPBan == false && MachineBan == false) PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length); else if (IPBan == true) PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length); else if (MachineBan == true) { PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length); PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length); PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.Username, Message, Length); } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Habbo.Username); if (TargetClient != null) TargetClient.Disconnect(); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) return; int PetId = Packet.PopInt(); RoomUser Pet = null; if (!Session.GetHabbo().CurrentRoom.GetRoomUserManager().TryGetPet(PetId, out Pet)) { //Okay so, we've established we have no pets in this room by this virtual Id, let us check out users, maybe they're creeping as a pet?! RoomUser User = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(PetId); if (User == null) return; //Check some values first, please! if (User.GetClient() == null || User.GetClient().GetHabbo() == null) return; //And boom! Let us send the training panel composer 8-). Session.SendWhisper("Maybe one day, boo boo."); return; } //Continue as a regular pet.. if (Pet.RoomId != Session.GetHabbo().CurrentRoomId || Pet.PetData == null) return; Session.SendMessage(new PetTrainingPanelComposer(Pet.PetData.PetId, Pet.PetData.Level)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) return; Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) return; int ItemId = Packet.PopInt(); Item Item = Room.GetRoomItemHandler().GetItem(ItemId); if (Item == null) return; if (Item.Data == null) return; if (Item.UserID != Session.GetHabbo().Id) return; if (Item.Data.InteractionType != InteractionType.PURCHASABLE_CLOTHING) { Session.SendNotification("Oops, this item isn't set as a sellable clothing item!"); return; } if (Item.Data.ClothingId == 0) { Session.SendNotification("Oops, this item doesn't have a linking clothing configuration, please report it!"); return; } ClothingItem Clothing = null; if (!PlusEnvironment.GetGame().GetCatalog().GetClothingManager().TryGetClothing(Item.Data.ClothingId, out Clothing)) { Session.SendNotification("Oops, we couldn't find this clothing part!"); return; } //Quickly delete it from the database. using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @ItemId LIMIT 1"); dbClient.AddParameter("ItemId", Item.Id); dbClient.RunQuery(); } //Remove the item. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id); Session.GetHabbo().GetClothing().AddClothing(Clothing.ClothingName, Clothing.PartIds); Session.SendMessage(new FigureSetIdsComposer(Session.GetHabbo().GetClothing().GetClothingAllParts)); Session.SendMessage(new RoomNotificationComposer("figureset.redeemed.success")); Session.SendWhisper("If for some reason cannot see your new clothing, reload the hotel!"); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock")) return; int UserId = Packet.PopInt(); string Message = Packet.PopString(); double Days = (Packet.PopInt() / 1440); string Unknown1 = Packet.PopString(); string Unknown2 = Packet.PopString(); double Length = (PlusEnvironment.GetUnixTimestamp() + (Days * 86400)); Habbo Habbo = PlusEnvironment.GetHabboById(UserId); if (Habbo == null) { Session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any")) { Session.SendWhisper("Oops, you cannot trade lock another user ranked 5 or higher."); return; } if (Days < 1) Days = 1; if (Days > 365) Days = 365; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TradingLockExpiry = Length; Habbo.GetClient().SendNotification("You have been trade banned for " + Days + " day(s)!\r\rReason:\r\r" + Message); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; int BotId = Packet.PopInt(); if (BotId == 0) return; Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) return; RoomUser BotUser = null; if (!Room.GetRoomUserManager().TryGetBot(BotId, out BotUser)) return; if (Session.GetHabbo().Id != BotUser.BotData.ownerID && !Session.GetHabbo().GetPermissions().HasRight("bot_place_any_override")) { Session.SendWhisper("You can only pick up your own bots!"); return; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `room_id` = '0' WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", BotId); dbClient.RunQuery(); } Room.GetGameMap().RemoveUserFromMap(BotUser, new System.Drawing.Point(BotUser.X, BotUser.Y)); Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender)); Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots())); Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false); }
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.RunQuery("UPDATE `bots` SET `look` = '" + Session.GetHabbo().Look + "', `gender` = '" + Session.GetHabbo().Gender + "' WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1"); } //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 Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom || Session.GetHabbo().GetStats() == null || Session.GetHabbo().GetStats().DailyPetRespectPoints == 0) return; Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (ThisUser == null) return; int PetId = Packet.PopInt(); RoomUser Pet = null; if (!Session.GetHabbo().CurrentRoom.GetRoomUserManager().TryGetPet(PetId, out Pet)) { //Okay so, we've established we have no pets in this room by this virtual Id, let us check out users, maybe they're creeping as a pet?! RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(PetId); if (TargetUser == null) return; //Check some values first, please! if (TargetUser.GetClient() == null || TargetUser.GetClient().GetHabbo() == null) return; if (TargetUser.GetClient().GetHabbo().Id == Session.GetHabbo().Id) { Session.SendWhisper("Oops, you cannot use this on yourself! (You haven't lost a point, simply reload!)"); return; } //And boom! Let us send some respect points. PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_RESPECT); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_RespectGiven", 1); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(TargetUser.GetClient(), "ACH_RespectEarned", 1); //Take away from pet respect points, just in-case users abuse this.. Session.GetHabbo().GetStats().DailyPetRespectPoints -= 1; Session.GetHabbo().GetStats().RespectGiven += 1; TargetUser.GetClient().GetHabbo().GetStats().Respect += 1; //Apply the effect. ThisUser.CarryItemID = 999999999; ThisUser.CarryTimer = 5; //Send the magic out. if (Room.RespectNotificationsEnabled) Room.SendMessage(new RespectPetNotificationMessageComposer(TargetUser.GetClient().GetHabbo(), TargetUser)); Room.SendMessage(new CarryObjectComposer(ThisUser.VirtualId, ThisUser.CarryItemID)); return; } if (Pet == null || Pet.PetData == null || Pet.RoomId != Session.GetHabbo().CurrentRoomId) return; Session.GetHabbo().GetStats().DailyPetRespectPoints -= 1; PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetRespectGiver", 1, false); ThisUser.CarryItemID = 999999999; ThisUser.CarryTimer = 5; Pet.PetData.OnRespect(); Room.SendMessage(new CarryObjectComposer(ThisUser.VirtualId, ThisUser.CarryItemID)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetInventoryComponent() == null) return; Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; int PetId = Packet.PopInt(); RoomUser Pet = null; if (!Room.GetRoomUserManager().TryGetPet(PetId, out Pet)) { //Check kick rights, just because it seems most appropriate. if ((!Room.CheckRights(Session) && Room.WhoCanKick != 2 && Room.Group == null) || (Room.Group != null && !Room.CheckRights(Session, false, true))) return; //Okay so, we've established we have no pets in this room by this virtual Id, let us check out users, maybe they're creeping as a pet?! RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(PetId); if (TargetUser == null) return; //Check some values first, please! if (TargetUser.GetClient() == null || TargetUser.GetClient().GetHabbo() == null) return; //Update the targets PetId. TargetUser.GetClient().GetHabbo().PetId = 0; //Quickly remove the old user instance. Room.SendMessage(new UserRemoveComposer(TargetUser.VirtualId)); //Add the new one, they won't even notice a thing!!11 8-) Room.SendMessage(new UsersComposer(TargetUser)); return; } if (Session.GetHabbo().Id != Pet.PetData.OwnerId && !Room.CheckRights(Session, true, false)) { Session.SendWhisper("You can only pickup your own pets, to kick a pet you must have room rights."); return; } if (Pet.RidingHorse) { RoomUser UserRiding = Room.GetRoomUserManager().GetRoomUserByVirtualId(Pet.HorseID); if (UserRiding != null) { UserRiding.RidingHorse = false; UserRiding.ApplyEffect(-1); UserRiding.MoveTo(new Point(UserRiding.X + 1, UserRiding.Y + 1)); } else Pet.RidingHorse = false; } Pet.PetData.RoomId = 0; Pet.PetData.PlacedInRoom = false; Pet pet = Pet.PetData; if (pet != null) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots` SET `room_id` = '0', `x` = '0', `Y` = '0', `Z` = '0' WHERE `id` = '" + pet.PetId + "' LIMIT 1"); dbClient.RunQuery("UPDATE `bots_petdata` SET `experience` = '" + pet.experience + "', `energy` = '" + pet.Energy + "', `nutrition` = '" + pet.Nutrition + "', `respect` = '" + pet.Respect + "' WHERE `id` = '" + pet.PetId + "' LIMIT 1"); } } if (pet.OwnerId != Session.GetHabbo().Id) { GameClient Target = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(pet.OwnerId); if (Target != null) { if (Target.GetHabbo().GetInventoryComponent().TryAddPet(Pet.PetData)) { Target.SendMessage(new PetInventoryComposer(Target.GetHabbo().GetInventoryComponent().GetPets())); } } Room.GetRoomUserManager().RemoveBot(Pet.VirtualId, false); return; } if (Session.GetHabbo().GetInventoryComponent().TryAddPet(Pet.PetData)) { Room.GetRoomUserManager().RemoveBot(Pet.VirtualId, false); Session.SendMessage(new PetInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetPets())); } }