public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CheckRights(Session)) return; Item Item = Room.GetRoomItemHandler().GetItem(Packet.PopInt()); if (Item == null) return; if (Item.GetBaseItem().InteractionType == InteractionType.POSTIT || Item.GetBaseItem().InteractionType == InteractionType.CAMERA_PICTURE) { Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1"); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) return; if (!Session.GetHabbo().InRoom) return; int ItemId = Packet.PopInt(); Session.SendMessage(new HideWiredConfigComposer()); Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) return; Item SelectedItem = Room.GetRoomItemHandler().GetItem(ItemId); if (SelectedItem == null) return; IWiredItem Box = null; if (!Session.GetHabbo().CurrentRoom.GetWired().TryGet(ItemId, out Box)) return; if (Box.Type == WiredBoxType.EffectGiveUserBadge && !Session.GetHabbo().GetPermissions().HasRight("room_item_wired_rewards")) { Session.SendNotification("You don't have the correct permissions to do this."); return; } Box.HandleSave(Packet); Session.GetHabbo().CurrentRoom.GetWired().SaveBox(Box); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) return; Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CanTradeInRoom) return; Trade Trade = Room.GetUserTrade(Session.GetHabbo().Id); if (Trade == null) return; int Amount = Packet.PopInt(); Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(Packet.PopInt()); if (Item == null) return; List<Item> AllItems = Session.GetHabbo().GetInventoryComponent().GetItems.Where(x => x.Data.Id == Item.Data.Id).Take(Amount).ToList(); foreach (Item I in AllItems) { Trade.OfferItem(Session.GetHabbo().Id, I); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Room Room = Session.GetHabbo().CurrentRoom; if (Room == null || !Room.CheckRights(Session, true)) return; int ItemId = Packet.PopInt(); Item Item = Session.GetHabbo().CurrentRoom.GetRoomItemHandler().GetItem(ItemId); if (Item == null) return; string Gender = Session.GetHabbo().Gender.ToLower(); string Figure = ""; foreach (string Str in Session.GetHabbo().Look.Split('.')) { if (Str.Contains("hr") || Str.Contains("hd") || Str.Contains("he") || Str.Contains("ea") || Str.Contains("ha")) continue; Figure += Str + "."; } Figure = Figure.TrimEnd('.'); if (Item.ExtraData.Contains(Convert.ToChar(5))) { string[] Flags = Item.ExtraData.Split(Convert.ToChar(5)); Item.ExtraData = Gender + Convert.ToChar(5) + Figure + Convert.ToChar(5) + Flags[2]; } else Item.ExtraData = Gender + Convert.ToChar(5) + Figure + Convert.ToChar(5) + "Default"; Item.UpdateState(true, true); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Room Instance = PlusEnvironment.GetGame().GetRoomManager().TryGetRandomLoadedRoom(); if (Instance != null) Session.SendMessage(new RoomForwardComposer(Instance.Id)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int GroupId = Packet.PopInt(); string Name = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString()); string Desc = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString()); Group Group = null; if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group)) return; if (Group.CreatorId != Session.GetHabbo().Id) return; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `groups` SET `name`= @name, `desc` = @desc WHERE `id` = '" + GroupId + "' LIMIT 1"); dbClient.AddParameter("name", Name); dbClient.AddParameter("desc", Desc); dbClient.RunQuery(); } Group.Name = Name; Group.Description = Desc; Session.SendMessage(new GroupInfoComposer(Group, Session)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CheckRights(Session)) return; int itemID = Packet.PopInt(); string wallPositionData = Packet.PopString(); Item Item = Room.GetRoomItemHandler().GetItem(itemID); if (Item == null) return; try { string WallPos = Room.GetRoomItemHandler().WallPositionCheck(":" + wallPositionData.Split(':')[1]); Item.wallCoord = WallPos; } catch { return; } Room.GetRoomItemHandler().UpdateItem(Item); Room.SendMessage(new ItemUpdateComposer(Item, Room.OwnerId)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) return; if (PlusEnvironment.GetGame().GetModerationTool().UsersHasPendingTicket(Session.GetHabbo().Id)) { Session.SendMessage(new BroadcastMessageAlertComposer("You currently already have a pending ticket, please wait for a response from a moderator.")); return; } string Message = Packet.PopString(); int Type = Packet.PopInt(); int ReportedUser = Packet.PopInt(); int Room = Packet.PopInt(); int Messagecount = Packet.PopInt(); List<string> Chats = new List<string>(); for (int i = 0; i < Messagecount; i++) { Packet.PopInt(); Chats.Add(Packet.PopString()); } ModerationRoomChatLog Chat = new ModerationRoomChatLog(Packet.PopInt(), Chats); PlusEnvironment.GetGame().GetModerationTool().SendNewTicket(Session, Type, ReportedUser, Message, Chats); PlusEnvironment.GetGame().GetClientManager().ModAlert("A new support ticket has been submitted!"); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!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 information composer 8-). Session.SendMessage(new PetInformationComposer(User.GetClient().GetHabbo())); return; } //Continue as a regular pet.. if (Pet.RoomId != Session.GetHabbo().CurrentRoomId || Pet.PetData == null) return; Session.SendMessage(new PetInformationComposer(Pet.PetData)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; int UserId = Packet.PopInt(); int RoomId = Packet.PopInt(); int Time = Packet.PopInt(); Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) return; if (((Room.WhoCanMute == 0 && !Room.CheckRights(Session, true) && Room.Group == null) || (Room.WhoCanMute == 1 && !Room.CheckRights(Session)) && Room.Group == null) || (Room.Group != null && !Room.CheckRights(Session, false, true))) return; RoomUser Target = Room.GetRoomUserManager().GetRoomUserByHabbo(PlusEnvironment.GetUsernameById(UserId)); if (Target == null) return; else if (Target.GetClient().GetHabbo().GetPermissions().HasRight("mod_tool")) return; if (Room.MutedUsers.ContainsKey(UserId)) { if (Room.MutedUsers[UserId] < PlusEnvironment.GetUnixTimestamp()) Room.MutedUsers.Remove(UserId); else return; } Room.MutedUsers.Add(UserId, (PlusEnvironment.GetUnixTimestamp() + (Time * 60))); Target.GetClient().SendWhisper("The room owner has muted you for " + Time + " minutes!"); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModMuteSeen", 1); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int CreditsOwed = 0; DataTable Table = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `asking_price` FROM `catalog_marketplace_offers` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND state = '2'"); Table = dbClient.getTable(); } if (Table != null) { foreach (DataRow row in Table.Rows) { CreditsOwed += Convert.ToInt32(row["asking_price"]); } if (CreditsOwed >= 1) { Session.GetHabbo().Credits += CreditsOwed; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `catalog_marketplace_offers` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `state` = '2'"); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CheckRights(Session, true) || Room.MoodlightData == null) return; Item Item = Room.GetRoomItemHandler().GetItem(Room.MoodlightData.ItemId); if (Item == null || Item.GetBaseItem().InteractionType != InteractionType.MOODLIGHT) return; if (Room.MoodlightData.Enabled) Room.MoodlightData.Disable(); else Room.MoodlightData.Enable(); Item.ExtraData = Room.MoodlightData.GenerateExtraData(); Item.UpdateState(); }
public void Send() { ClientPacket clientPacket = new ClientPacket(PacketType.Telnet); clientPacket.telnet = new ClientPacket.Telnet(cmd.Text); handler.packetStream.Send(clientPacket); cmd.Text = ""; }
public void Receive(ClientPacket msg) { // обрабатываем полученное сообщение RealCharacter player = gameState.Players[msg.PlayerId]; if (msg.Moves.Count > 0) { Vector2 prevPos = player.Position; player.MoveBehavior.NewPosition = player.Position; foreach (var moves in msg.Moves) { // игнорируем передвижения, которые уже были обработаны if (moves.Key <= gameState.NetPlayers[msg.PlayerId].ServerPacket.Ack) { continue; } foreach (var move in moves.Value) { player.MoveBehavior.NewPosition += move.Direction * (float)(player.Speed * move.Time.TotalSeconds); } } _collisionsActor.CheckForCollisions(player); if (player.Position != prevPos) { NotifyPlayersCharacterMoved(player); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int SlotId = Packet.PopInt(); string Look = PlusEnvironment.GetGame().GetAntiMutant().RunLook(Packet.PopString()); string Gender = Packet.PopString(); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT null FROM `user_wardrobe` WHERE `user_id` = " + Session.GetHabbo().Id + " AND `slot_id` = @slot"); dbClient.AddParameter("slot", SlotId); if (dbClient.getRow() != null) { dbClient.SetQuery("UPDATE `user_wardrobe` SET `look` = @look, `gender` = @gender WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `slot_id` = @slot LIMIT 1"); dbClient.AddParameter("slot", SlotId); dbClient.AddParameter("look", Look); dbClient.AddParameter("gender", Gender.ToUpper()); dbClient.RunQuery(); } else { dbClient.SetQuery("INSERT INTO `user_wardrobe` (`user_id`,`slot_id`,`look`,`gender`) VALUES ('" + Session.GetHabbo().Id + "',@slot,@look,@gender)"); dbClient.AddParameter("slot", SlotId); dbClient.AddParameter("look", Look); dbClient.AddParameter("gender", Gender.ToUpper()); dbClient.RunQuery(); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null) return; int Amount = Packet.PopInt(); if (Amount > 50) Amount = 50; else if (Amount < 0) return; for (int i = 0; i < Amount; i++) { int RequestId = Packet.PopInt(); MessengerRequest Request = null; if (!Session.GetHabbo().GetMessenger().TryGetRequest(RequestId, out Request)) continue; if (Request.To != Session.GetHabbo().Id) return; if (!Session.GetHabbo().GetMessenger().FriendshipExists(Request.To)) Session.GetHabbo().GetMessenger().CreateFriendship(Request.From); Session.GetHabbo().GetMessenger().HandleRequest(RequestId); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; int BotId = Packet.PopInt(); int ActionId = Packet.PopInt(); Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) return; RoomUser BotUser = null; if (!Room.GetRoomUserManager().TryGetBot(BotId, out BotUser)) return; string BotSpeech = ""; foreach (RandomSpeech Speech in BotUser.BotData.RandomSpeech.ToList()) { BotSpeech += (Speech.Message + "\n"); } BotSpeech += ";#;"; BotSpeech += BotUser.BotData.AutomaticChat; BotSpeech += ";#;"; BotSpeech += BotUser.BotData.SpeakingInterval; BotSpeech += ";#;"; BotSpeech += BotUser.BotData.MixSentences; if (ActionId == 2 || ActionId == 5) Session.SendMessage(new OpenBotActionComposer(BotUser, ActionId, BotSpeech)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) return; Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) return; RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Packet.PopInt()); if (TargetUser == null) return; if (!((Math.Abs((User.X - TargetUser.X)) >= 3) || (Math.Abs((User.Y - TargetUser.Y)) >= 3)) || Session.GetHabbo().GetPermissions().HasRight("mod_tool")) { if (User.CarryItemID > 0 && User.CarryTimer > 0) { if (User.CarryItemID == 8) PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIVE_COFFEE); TargetUser.CarryItem(User.CarryItemID); User.CarryItem(0); TargetUser.DanceId = 0; } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int RoomId = Packet.PopInt(); string Name = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString()); string Desc = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString()); RoomData Data = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId); if (Data == null) return; if (Data.OwnerId != Session.GetHabbo().Id) return;//HAX if (Data.Promotion == null) { Session.SendNotification("Oops, it looks like there isn't a room promotion in this room?"); return; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `room_promotions` SET `title` = @title, `description` = @desc WHERE `room_id` = " + RoomId + " LIMIT 1"); dbClient.AddParameter("title", Name); dbClient.AddParameter("desc", Desc); dbClient.RunQuery(); } Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Convert.ToInt32(RoomId), out Room)) return; Data.Promotion.Name = Name; Data.Promotion.Description = Desc; Room.SendMessage(new RoomEventComposer(Data, Data.Promotion)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) return; Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; int itemID = Packet.PopInt(); Item Item = Room.GetRoomItemHandler().GetItem(itemID); if (Item == null) return; bool hasRights = false; if (Room.CheckRights(Session, false, true)) hasRights = true; string oldData = Item.ExtraData; int request = Packet.PopInt(); Item.Interactor.OnTrigger(Session, Item, request, hasRights); Item.GetRoom().GetWired().TriggerEvent(WiredBoxType.TriggerStateChanges, Session.GetHabbo(), Item); PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.EXPLORE_FIND_ITEM, Item.GetBaseItem().Id); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int itemId = Packet.PopInt(); string locationData = Packet.PopString(); if (!Session.GetHabbo().InRoom) return; Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CheckRights(Session)) return; Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(itemId); if (Item == null) return; try { string WallPossition = WallPositionCheck(":" + locationData.Split(':')[1]); Item RoomItem = new Item(Item.Id, Room.RoomId, Item.BaseItem, Item.ExtraData, 0, 0, 0, 0, Session.GetHabbo().Id, Item.GroupId, 0, 0, WallPossition, Room); if (Room.GetRoomItemHandler().SetWallItem(Session, RoomItem)) Session.GetHabbo().GetInventoryComponent().RemoveItem(itemId); } catch { //TODO: Send a packet return; } }
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.GetHabbo().InRoom) return; Room Room = null; 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)) return; if (Pet.PetData.AnyoneCanRide == 1) Pet.PetData.AnyoneCanRide = 0; else Pet.PetData.AnyoneCanRide = 1; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots_petdata` SET `anyone_ride` = '" + Pet.PetData.AnyoneCanRide + "' WHERE `id` = '" + PetId + "' LIMIT 1"); } Room.SendMessage(new PetInformationComposer(Pet.PetData)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { string Category = Packet.PopString(); string Unknown = Packet.PopString(); if (!string.IsNullOrEmpty(Unknown)) { Category = "hotel_view"; ICollection<SearchResultList> Test = new List<SearchResultList>(); SearchResultList Null = null; if (PlusEnvironment.GetGame().GetNavigator().TryGetSearchResultList(0, out Null)) { Test.Add(Null); Session.SendMessage(new NavigatorSearchResultSetComposer(Category, Unknown, Test, Session)); } } else { //Fetch the categorys. ICollection<SearchResultList> Test = PlusEnvironment.GetGame().GetNavigator().GetCategorysForSearch(Category); if (Test.Count == 0) { ICollection<SearchResultList> SecondTest = PlusEnvironment.GetGame().GetNavigator().GetResultByIdentifier(Category); if (SecondTest.Count > 0) { Session.SendMessage(new NavigatorSearchResultSetComposer(Category, Unknown, SecondTest, Session, 2, 100)); return; } } Session.SendMessage(new NavigatorSearchResultSetComposer(Category, Unknown, Test, Session)); } }
public static void Process(ClientPacket.Screen screen) { Screen.power = screen.Power; if (Screen.power != 0) { //屏幕 if (screen.Quality != 0) { ps = new EncoderParameters(1); ps.Param[0] = new EncoderParameter(Encoder.Quality, screen.Quality); } if (Screen.thread == null || !Screen.thread.IsAlive) { Screen.thread = new Thread(new ThreadStart(Work)); Screen.thread.Start(); } //鼠标 if (screen.mouse != null) NativeMethods.mouse_event(screen.mouse.dwFlags, screen.mouse.dx, screen.mouse.dy, 0, 0); //键盘 if (screen.keybd != null) NativeMethods.keybd_event(screen.keybd.bVk, screen.keybd.bScan, screen.keybd.dwFlags, 0); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int GroupId = Packet.PopInt(); int UserId = Packet.PopInt(); Group Group = null; if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group)) return; if ((Session.GetHabbo().Id != Group.CreatorId && !Group.IsAdmin(Session.GetHabbo().Id)) && !Session.GetHabbo().GetPermissions().HasRight("fuse_group_accept_any")) return; if (!Group.HasRequest(UserId)) return; Habbo Habbo = PlusEnvironment.GetHabboById(UserId); if (Habbo == null) { Session.SendNotification("Oops, an error occurred whilst finding this user."); return; } Group.HandleRequest(UserId, true); Session.SendMessage(new GroupMemberUpdatedComposer(GroupId, Habbo, 4)); }
public void Parse(GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CheckRights(Session, false)) return; if (Room.UsersWithRights.Contains(Session.GetHabbo().Id)) { RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User != null && !User.IsBot) { User.RemoveStatus("flatctrl 1"); User.UpdateNeeded = true; User.GetClient().SendMessage(new YouAreNotControllerComposer()); } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("DELETE FROM `room_rights` WHERE `user_id` = @uid AND `room_id` = @rid LIMIT 1"); dbClient.AddParameter("uid", Session.GetHabbo().Id); dbClient.AddParameter("rid", Room.Id); dbClient.RunQuery(); } if (Room.UsersWithRights.Contains(Session.GetHabbo().Id)) Room.UsersWithRights.Remove(Session.GetHabbo().Id); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null) return; int BuddyId = Packet.PopInt(); if (BuddyId == 0 || BuddyId == Session.GetHabbo().Id) return; GameClient Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(BuddyId); if (Client == null || Client.GetHabbo() == null) return; if (!Client.GetHabbo().InRoom) { Session.SendMessage(new FollowFriendFailedComposer(2)); Session.GetHabbo().GetMessenger().UpdateFriend(Client.GetHabbo().Id, Client, true); return; } else if (Session.GetHabbo().CurrentRoom != null && Client.GetHabbo().CurrentRoom != null) { if (Session.GetHabbo().CurrentRoom.RoomId == Client.GetHabbo().CurrentRoom.RoomId) return; } Session.SendMessage(new RoomForwardComposer(Client.GetHabbo().CurrentRoomId)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) return; User.UnIdle(); int DanceId = Packet.PopInt(); if (DanceId < 0 || DanceId > 4) DanceId = 0; if (DanceId > 0 && User.CarryItemID > 0) User.CarryItem(0); if (Session.GetHabbo().Effects().CurrentEffect > 0) Room.SendMessage(new AvatarEffectComposer(User.VirtualId, 0)); User.DanceId = DanceId; Room.SendMessage(new DanceComposer(User, DanceId)); PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_DANCE); if (Room.GetRoomUserManager().GetRoomUsers().Count > 19) PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.MASS_DANCE); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null) return; int GroupId = Packet.PopInt(); if (GroupId == 0) return; Group Group = null; if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group)) return; Session.GetHabbo().GetStats().FavouriteGroupId = Group.Id; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_stats` SET `groupid` = " + Session.GetHabbo().GetStats().FavouriteGroupId + " WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1"); } if (Session.GetHabbo().InRoom && Session.GetHabbo().CurrentRoom != null) { Session.GetHabbo().CurrentRoom.SendMessage(new RefreshFavouriteGroupComposer(Session.GetHabbo().Id)); if (Group != null) { Session.GetHabbo().CurrentRoom.SendMessage(new HabboGroupBadgesComposer(Group)); RoomUser User = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User != null) Session.GetHabbo().CurrentRoom.SendMessage(new UpdateFavouriteGroupComposer(Session.GetHabbo().Id, Group, User.VirtualId)); } } else Session.SendMessage(new RefreshFavouriteGroupComposer(Session.GetHabbo().Id)); }
public void Parse(Player session, ClientPacket packet) { packet.PopInt(); //unknown session.SendPacket(new RentableSpaceComposer()); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { PlusEnvironment.GetGame().GetQuestManager().CancelQuest(Session, Packet); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room; if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } if (!Room.CheckRights(Session, true)) { return; } int BotId = Packet.PopInt(); int X = Packet.PopInt(); int Y = Packet.PopInt(); if (!Room.GetGameMap().CanWalk(X, Y, false) || !Room.GetGameMap().ValidTile(X, Y)) { Session.SendNotification("You cannot place a bot here!"); return; } Bot Bot = null; if (!Session.GetHabbo().GetInventoryComponent().TryGetBot(BotId, out Bot)) { return; } int BotCount = 0; foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList()) { if (User == null || User.IsPet || !User.IsBot) { continue; } BotCount += 1; } if (BotCount >= 5 && !Session.GetHabbo().GetPermissions().HasRight("bot_place_any_override")) { Session.SendNotification("Sorry; 5 bots per room only!"); return; } //TODO: Hmm, maybe not???? using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `bots` SET `room_id` = '" + Room.RoomId + "', `x` = @CoordX, `y` = @CoordY WHERE `id` = @BotId LIMIT 1"); dbClient.AddParameter("BotId", Bot.Id); dbClient.AddParameter("CoordX", X); dbClient.AddParameter("CoordY", Y); dbClient.RunQuery(); } List <RandomSpeech> BotSpeechList = new List <RandomSpeech>(); //TODO: Grab data? DataRow GetData = null; using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `ai_type`,`rotation`,`walk_mode`,`automatic_chat`,`speaking_interval`,`mix_sentences`,`chat_bubble` FROM `bots` WHERE `id` = @BotId LIMIT 1"); dbClient.AddParameter("BotId", Bot.Id); GetData = dbClient.getRow(); dbClient.SetQuery("SELECT `text` FROM `bots_speech` WHERE `bot_id` = @BotId"); dbClient.AddParameter("BotId", Bot.Id); DataTable BotSpeech = dbClient.getTable(); foreach (DataRow Speech in BotSpeech.Rows) { BotSpeechList.Add(new RandomSpeech(Convert.ToString(Speech["text"]), Bot.Id)); } } RoomUser BotUser = Room.GetRoomUserManager().DeployBot(new RoomBot(Bot.Id, Session.GetHabbo().CurrentRoomId, Convert.ToString(GetData["ai_type"]), Convert.ToString(GetData["walk_mode"]), Bot.Name, "", Bot.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref BotSpeechList, "", 0, Bot.OwnerId, RocketEmulador.EnumToBool(GetData["automatic_chat"].ToString()), Convert.ToInt32(GetData["speaking_interval"]), RocketEmulador.EnumToBool(GetData["mix_sentences"].ToString()), Convert.ToInt32(GetData["chat_bubble"])), null); BotUser.Chat("Hello!", false, 0); Room.GetGameMap().UpdateUserMovement(new System.Drawing.Point(X, Y), new System.Drawing.Point(X, Y), BotUser); Bot ToRemove = null; if (!Session.GetHabbo().GetInventoryComponent().TryRemoveBot(BotId, out ToRemove)) { Console.WriteLine("Error whilst removing Bot: " + ToRemove.Id); return; } Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots())); }
public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet) { if (session == null || session.GetHabbo() == null) { return; } Room Room = session.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Username); if (User == null) { return; } string NewName = packet.PopString(); string OldName = session.GetHabbo().Username; if (NewName == OldName) { session.GetHabbo().ChangeName(OldName); session.SendPacket(new UpdateUsernameComposer(NewName)); return; } if (!CanChangeName(session.GetHabbo())) { session.SendNotification("Oops, it appears you currently cannot change your username!"); return; } bool InUse = false; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT COUNT(0) FROM `users` WHERE `username` = @name LIMIT 1"); dbClient.AddParameter("name", NewName); InUse = dbClient.GetInteger() == 1; } char[] Letters = NewName.ToLower().ToCharArray(); string AllowedCharacters = "abcdefghijklmnopqrstuvwxyz.,_-;:?!1234567890"; foreach (char Chr in Letters) { if (!AllowedCharacters.Contains(Chr)) { return; } } if (!session.GetHabbo().GetPermissions().HasRight("mod_tool") && NewName.ToLower().Contains("mod") || NewName.ToLower().Contains("adm") || NewName.ToLower().Contains("admin") || NewName.ToLower().Contains("m0d") || NewName.ToLower().Contains("mob") || NewName.ToLower().Contains("m0b")) { return; } else if (!NewName.ToLower().Contains("mod") && (session.GetHabbo().Rank == 2 || session.GetHabbo().Rank == 3)) { return; } else if (NewName.Length > 15) { return; } else if (NewName.Length < 3) { return; } else if (InUse) { return; } else { if (!PlusEnvironment.GetGame().GetClientManager().UpdateClientUsername(session, OldName, NewName)) { session.SendNotification("Oops! An issue occoured whilst updating your username."); return; } session.GetHabbo().ChangingName = false; Room.GetRoomUserManager().RemoveUserFromRoom(session, true, false); session.GetHabbo().ChangeName(NewName); session.GetHabbo().GetMessenger().OnStatusChanged(true); session.SendPacket(new UpdateUsernameComposer(NewName)); Room.SendPacket(new UserNameChangeComposer(Room.Id, User.VirtualId, NewName)); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO `logs_client_namechange` (`user_id`,`new_name`,`old_name`,`timestamp`) VALUES ('" + session.GetHabbo().Id + "', @name, '" + OldName + "', '" + PlusEnvironment.GetUnixTimestamp() + "')"); dbClient.AddParameter("name", NewName); dbClient.RunQuery(); } foreach (Room room in PlusEnvironment.GetGame().GetRoomManager().GetRooms().ToList()) { if (room == null || room.OwnerId != session.GetHabbo().Id || room.OwnerName == NewName) { continue; } room.OwnerName = NewName; room.SendPacket(new RoomInfoUpdatedComposer(room.Id)); } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_Name", 1); session.SendPacket(new RoomForwardComposer(Room.Id)); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) { return; } Room Room; if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } int itemID = Packet.PopInt(); Item Item = Room.GetRoomItemHandler().GetItem(itemID); if (Item == null) { return; } bool hasRights = false; if (Room.CheckRights(Session, false, true)) { hasRights = true; } if (Item.GetBaseItem().InteractionType == InteractionType.banzaitele) { return; } if (Item.GetBaseItem().InteractionType == InteractionType.TONER) { if (!Room.CheckRights(Session, true)) { return; } if (Room.TonerData.Enabled == 0) { Room.TonerData.Enabled = 1; } else { Room.TonerData.Enabled = 0; } Room.SendMessage(new ObjectUpdateComposer(Item, Room.OwnerId)); Item.UpdateState(); using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `room_items_toner` SET `enabled` = '" + Room.TonerData.Enabled + "' LIMIT 1"); } return; } if (Item.Data.InteractionType == InteractionType.GNOME_BOX && Item.UserID == Session.GetHabbo().Id) { Session.SendMessage(new GnomeBoxComposer(Item.Id)); } Boolean Toggle = true; if (Item.GetBaseItem().InteractionType == InteractionType.WF_FLOOR_SWITCH_1 || Item.GetBaseItem().InteractionType == InteractionType.WF_FLOOR_SWITCH_2) { RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } if (!Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y)) { Toggle = false; } } string oldData = Item.ExtraData; int request = Packet.PopInt(); Item.Interactor.OnTrigger(Session, Item, request, hasRights); if (Toggle) { Item.GetRoom().GetWired().TriggerEvent(WiredBoxType.TriggerStateChanges, Session.GetHabbo(), Item); } RocketEmulador.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.EXPLORE_FIND_ITEM, Item.GetBaseItem().Id); }
static void ClientRead(Server s, Client c, byte[] e) { try { //Anti-flood measures. if (c.Value.IsFlooding()) { c.Disconnect(); return; } object[] values = Packer.Deserialize(e); if (values == null) { return; } ClientPacket packet = (ClientPacket)values[0]; if (c.Value.Authenticated && c.Value.Verified) { switch (packet) { case ClientPacket.Channel: HandleWakeup(c, true); //Supress the packet send here since we are changing rooms anyways. HandleChannelPacket(c, (byte)values[1]); break; case ClientPacket.ChatMessage: HandleWakeup(c); HandleChatPacket(c, (string)values[1]); break; case ClientPacket.PM: HandleWakeup(c); HandlePMPacket(c, (string)values[1], (string)values[2], (string)values[3], values.Length == 5 ? (ushort)values[4] : default(ushort)); break; case ClientPacket.KeepAlive: HandleKeepAlivePacket(c); break; case ClientPacket.News: HandleNewsPacket(c); break; case ClientPacket.ViewProfile: HandleViewProfilePacket(c, (string)values[1]); break; case ClientPacket.EditProfile: HandleEditProfilePacket(c, (string)values[1], (string)values[2], (string)values[3]); break; case ClientPacket.AuthCode: HandleAuthCodePacket(c, (string)values[1]); break; } } else { switch (packet) { case ClientPacket.SignIn: HandleSignInPacket(c, (string)values[1], (string)values[2]); break; case ClientPacket.Register: HandleRegisterPacket(c, (string)values[1], (string)values[2], (string)values[3]); break; case ClientPacket.ResendVerification: HandleResendVerificationPacket(c); break; case ClientPacket.AuthCode: HandleAuthCodePacket(c, (string)values[1]); break; } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); c.Disconnect(); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Session.TimePingedReceived = DateTime.Now; }
public void Parse(GameClient session, ClientPacket packet) { //I am a very boring packet. }
public void Parse(GameClient Session, ClientPacket Packet) { Room Room = null; if (!ButterflyEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } if (!Room.CheckRights(Session, true)) { //Session.SendPacket(new RoomErrorNotifComposer(1)); return; } if (Room.GetRoomUserManager().BotCount >= 20) { Session.SendNotification(ButterflyEnvironment.GetLanguageManager().TryGetValue("notif.placepet.error", Session.Langue)); return; } Pet Pet = null; if (!Session.GetHabbo().GetInventoryComponent().TryGetPet(Packet.PopInt(), out Pet)) { return; } if (Pet == null) { return; } if (Pet.PlacedInRoom) { return; } int X = Packet.PopInt(); int Y = Packet.PopInt(); if (!Room.GetGameMap().CanWalk(X, Y, false)) { //Session.SendPacket(new RoomErrorNotifComposer(4)); return; } RoomUser OldPet = null; if (Room.GetRoomUserManager().TryGetPet(Pet.PetId, out OldPet)) { Room.GetRoomUserManager().RemoveBot(OldPet.VirtualId, false); } Pet.X = X; Pet.Y = Y; Pet.PlacedInRoom = true; Pet.RoomId = Room.Id; Room.GetRoomUserManager().DeployBot(new RoomBot(Pet.PetId, Pet.OwnerId, Pet.RoomId, AIType.Pet, true, Pet.Name, "", "", Pet.Look, X, Y, 0, 0, false, "", 0, false, 0, 0, 0), Pet); if (Pet.DBState != DatabaseUpdateState.NeedsInsert) { Pet.DBState = DatabaseUpdateState.NeedsUpdate; } using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { queryreactor.RunQuery("UPDATE user_pets SET room_id = '" + Pet.RoomId + "' WHERE id ='" + Pet.PetId + "' LIMIT 1"); } Pet ToRemove = null; if (!Session.GetHabbo().GetInventoryComponent().TryRemovePet(Pet.PetId, out ToRemove)) { Console.WriteLine("Error whilst removing pet: " + ToRemove.PetId); return; } Session.SendPacket(new PetInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetPets())); }
public void Parse(GameClient Session, ClientPacket Packet) { ICollection <SearchResultList> Categories = CloudServer.GetGame().GetNavigator().GetEventCategories(); Session.SendMessage(new NavigatorFlatCatsComposer(Categories, Session.GetHabbo().Rank)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int pId = Packet.PopInt(); bool isConfirmed = Packet.PopBoolean(); Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } Item Item = Room.GetRoomItemHandler().GetItem(pId); if (Item == null || Item.GetBaseItem() == null || Item.GetBaseItem().InteractionType != InteractionType.LOVELOCK) { return; } int UserOneId = Item.InteractingUser; int UserTwoId = Item.InteractingUser2; RoomUser UserOne = Room.GetRoomUserManager().GetRoomUserByHabbo(UserOneId); RoomUser UserTwo = Room.GetRoomUserManager().GetRoomUserByHabbo(UserTwoId); if (UserOne == null && UserTwo == null) { Item.InteractingUser = 0; Item.InteractingUser2 = 0; Session.SendNotification("Your partner has left the room or has cancelled the love lock."); return; } else if (UserOne.GetClient() == null || UserTwo.GetClient() == null) { Item.InteractingUser = 0; Item.InteractingUser2 = 0; Session.SendNotification("Your partner has left the room or has cancelled the love lock."); return; } else if (UserOne == null) { UserTwo.CanWalk = true; UserTwo.GetClient().SendNotification("Your partner has left the room or has cancelled the love lock."); UserTwo.LLPartner = 0; Item.InteractingUser = 0; Item.InteractingUser2 = 0; return; } else if (UserTwo == null) { UserOne.CanWalk = true; UserOne.GetClient().SendNotification("Your partner has left the room or has cancelled the love lock."); UserOne.LLPartner = 0; Item.InteractingUser = 0; Item.InteractingUser2 = 0; return; } else if (Item.ExtraData.Contains(Convert.ToChar(5).ToString())) { UserTwo.CanWalk = true; UserTwo.GetClient().SendNotification("It appears this love lock has already been locked."); UserTwo.LLPartner = 0; UserOne.CanWalk = true; UserOne.GetClient().SendNotification("It appears this love lock has already been locked."); UserOne.LLPartner = 0; Item.InteractingUser = 0; Item.InteractingUser2 = 0; return; } else if (!isConfirmed) { Item.InteractingUser = 0; Item.InteractingUser2 = 0; UserOne.LLPartner = 0; UserTwo.LLPartner = 0; UserOne.CanWalk = true; UserTwo.CanWalk = true; return; } else { if (UserOneId == Session.GetHabbo().Id) { Session.SendMessage(new LoveLockDialogueSetLockedMessageComposer(pId)); UserOne.LLPartner = UserTwoId; } else if (UserTwoId == Session.GetHabbo().Id) { Session.SendMessage(new LoveLockDialogueSetLockedMessageComposer(pId)); UserTwo.LLPartner = UserOneId; } if (UserOne.LLPartner == 0 || UserTwo.LLPartner == 0) { return; } else { Item.ExtraData = "1" + (char)5 + UserOne.GetUsername() + (char)5 + UserTwo.GetUsername() + (char)5 + UserOne.GetClient().GetHabbo().Look + (char)5 + UserTwo.GetClient().GetHabbo().Look + (char)5 + DateTime.Now.ToString("dd/MM/yyyy"); Item.InteractingUser = 0; Item.InteractingUser2 = 0; UserOne.LLPartner = 0; UserTwo.LLPartner = 0; Item.UpdateState(true, true); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE items SET extra_data = @extraData WHERE id = @ID LIMIT 1"); dbClient.AddParameter("extraData", Item.ExtraData); dbClient.AddParameter("ID", Item.Id); dbClient.RunQuery(); } UserOne.GetClient().SendMessage(new LoveLockDialogueCloseMessageComposer(pId)); UserTwo.GetClient().SendMessage(new LoveLockDialogueCloseMessageComposer(pId)); UserOne.CanWalk = true; UserTwo.CanWalk = true; UserOne = null; UserTwo = null; } } }
public void Parse(GameClient Session, ClientPacket Packet) { TimeSpan Span = DateTime.Now - Session.GetHabbo().LastForumMessageUpdateTime; if (Span.TotalSeconds < 20) { return; } int groupId = Packet.PopInt(); int threadId = Packet.PopInt(); string subject = Packet.PopString(); string content = Packet.PopString(); Group group = GroupManager.GetJob(groupId); if (group == null || !group.ForumEnabled) { return; } int timestamp = Convert.ToInt32(PlusEnvironment.GetUnixTimestamp()); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { if (threadId != 0) { dbClient.SetQuery(string.Format("SELECT * FROM groups_forums_posts WHERE id = {0}", threadId)); DataRow Row = dbClient.getRow(); var Post = new GroupForumPost(Row); if (Post.Locked || Post.Hidden) { Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("forums_cancel")); return; } } Session.GetHabbo().LastForumMessageUpdateTime = DateTime.Now; dbClient.SetQuery("INSERT INTO groups_forums_posts (group_id, parent_id, timestamp, poster_id, poster_name, poster_look, subject, post_content) VALUES (@gid, @pard, @ts, @pid, @pnm, @plk, @subjc, @content)"); dbClient.AddParameter("gid", groupId); dbClient.AddParameter("pard", threadId); dbClient.AddParameter("ts", timestamp); dbClient.AddParameter("pid", Session.GetHabbo().Id); dbClient.AddParameter("pnm", Session.GetHabbo().Username); dbClient.AddParameter("plk", Session.GetHabbo().Look); dbClient.AddParameter("subjc", subject); dbClient.AddParameter("content", content); threadId = dbClient.getInteger(); } group.ForumScore += 0.25; group.ForumLastPosterName = Session.GetHabbo().Username; group.ForumLastPosterId = Session.GetHabbo().Id; group.ForumLastPosterTimestamp = timestamp; group.ForumMessagesCount++; group.UpdateForum(); if (threadId == 0) { Session.SendMessage(new GroupForumNewThreadMessageComposer(Session, groupId, threadId, subject, content, timestamp)); } else { Session.SendMessage(new GroupForumNewResponseMessageComposer(Session, group, groupId, threadId, content, timestamp)); } Session.GetHabbo().GetStats().ForumPosts++; }
public void Parse(GameClient Session, ClientPacket Packet) { Session.SendMessage(new OnGuideSessionDetachedComposer(2)); }
public void Parse(Player session, ClientPacket packet) { if (!session.GetHabbo().InRoom) { return; } if (!Program.GameContext.GetRoomManager().TryGetRoom(session.GetHabbo().CurrentRoomId, out var room)) { return; } if (!room.CheckRights(session, true)) { return; } var item = session.GetHabbo().GetInventoryComponent().GetItem(packet.PopInt()); if (item == null) { return; } if (item.GetBaseItem() == null) { return; } var decorationKey = string.Empty; switch (item.GetBaseItem().InteractionType) { case InteractionType.FLOOR: decorationKey = "floor"; break; case InteractionType.WALLPAPER: decorationKey = "wallpaper"; break; case InteractionType.LANDSCAPE: decorationKey = "landscape"; break; } switch (decorationKey) { case "floor": room.Floor = item.ExtraData; Program.GameContext.GetQuestManager().ProgressUserQuest(session, QuestType.FurniDecoFloor); Program.GameContext.GetAchievementManager().ProgressAchievement(session, "ACH_RoomDecoFloor", 1); break; case "wallpaper": room.Wallpaper = item.ExtraData; Program.GameContext.GetQuestManager().ProgressUserQuest(session, QuestType.FurniDecoWall); Program.GameContext.GetAchievementManager().ProgressAchievement(session, "ACH_RoomDecoWallpaper", 1); break; case "landscape": room.Landscape = item.ExtraData; Program.GameContext.GetAchievementManager().ProgressAchievement(session, "ACH_RoomDecoLandscape", 1); break; } using (var dbClient = Program.DatabaseManager.GetQueryReactor()) { dbClient.SetQuery("UPDATE `rooms` SET `" + decorationKey + "` = @extradata WHERE `id` = '" + room.RoomId + "' LIMIT 1"); dbClient.AddParameter("extradata", item.ExtraData); dbClient.RunQuery(); dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + item.Id + "' LIMIT 1"); } session.GetHabbo().GetInventoryComponent().RemoveItem(item.Id); room.SendPacket(new RoomPropertyComposer(decorationKey, item.ExtraData)); }
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.SocialRespect); 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.SendPacket(new RespectPetNotificationMessageComposer(TargetUser.GetClient().GetHabbo(), TargetUser)); } Room.SendPacket(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.SendPacket(new CarryObjectComposer(ThisUser.VirtualId, ThisUser.CarryItemID)); }
public void Parse(Player session, ClientPacket packet) { bool inUse; var name = packet.PopString(); using (var dbClient = Program.DatabaseManager.GetQueryReactor()) { dbClient.SetQuery("SELECT COUNT(0) FROM `users` WHERE `username` = @name LIMIT 1"); dbClient.AddParameter("name", name); inUse = dbClient.GetInteger() == 1; } var letters = name.ToLower().ToCharArray(); const string allowedCharacters = "abcdefghijklmnopqrstuvwxyz.,_-;:?!1234567890"; if (letters.Any(chr => !allowedCharacters.Contains(chr))) { session.SendPacket(new NameChangeUpdateComposer(name, 4)); return; } if (Program.GameContext.GetChatManager().GetFilter().IsFiltered(name)) { session.SendPacket(new NameChangeUpdateComposer(name, 4)); return; } if (!session.GetHabbo().GetPermissions().HasRight("mod_tool") && name.ToLower().Contains("mod") || name.ToLower().Contains("adm") || name.ToLower().Contains("admin") || name.ToLower().Contains("m0d")) { session.SendPacket(new NameChangeUpdateComposer(name, 4)); return; } if (!name.ToLower().Contains("mod") && (session.GetHabbo().Rank == 2 || session.GetHabbo().Rank == 3)) { session.SendPacket(new NameChangeUpdateComposer(name, 4)); return; } if (name.Length > 15) { session.SendPacket(new NameChangeUpdateComposer(name, 3)); return; } if (name.Length < 3) { session.SendPacket(new NameChangeUpdateComposer(name, 2)); return; } if (inUse) { ICollection <string> suggestions = new List <string>(); for (var i = 100; i < 103; i++) { suggestions.Add(i.ToString()); } session.SendPacket(new NameChangeUpdateComposer(name, 5, suggestions)); return; } session.SendPacket(new NameChangeUpdateComposer(name, 0)); }
public void Parse(GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) { return; } Room Room = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Room == null || !Room.CheckRights(Session)) { Session.SendPacket(new RoomNotificationComposer("furni_placement_error", "message", "${room.error.cant_set_not_owner}")); return; } if (Room.RoomData.SellPrice > 0) { Session.SendNotification(ButterflyEnvironment.GetLanguageManager().TryGetValue("roomsell.error.7", Session.Langue)); return; } string RawData = Packet.PopString(); string[] Data = RawData.Split(new char[1] { ' ' }); int ItemId = 0; if (!int.TryParse(Data[0], out ItemId)) { return; } if (ItemId <= 0) { return; } Item userItem = Session.GetHabbo().GetInventoryComponent().GetItem(ItemId); if (userItem == null) { return; } if (userItem.GetBaseItem().InteractionType == InteractionType.BADGE_TROC) { if (Session.GetHabbo().GetBadgeComponent().HasBadge(userItem.ExtraData)) { Session.SendNotification("Vous posséder déjà ce badge !"); return; } using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) queryreactor.RunQuery("DELETE FROM items WHERE id = " + ItemId); Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId); Session.GetHabbo().GetBadgeComponent().GiveBadge(userItem.ExtraData, true); Session.SendPacket(new ReceiveBadgeComposer(userItem.ExtraData)); Session.SendNotification("Vous avez reçu le badge: " + userItem.ExtraData + " !"); return; } if (!userItem.IsWallItem) { if (Data.Length < 4) { return; } int X = 0; int Y = 0; int Rotation = 0; if (!int.TryParse(Data[1], out X)) { return; } if (!int.TryParse(Data[2], out Y)) { return; } if (!int.TryParse(Data[3], out Rotation)) { return; } if (Session.GetHabbo().forceRot > -1) { Rotation = Session.GetHabbo().forceRot; } Item roomItem = new Item(userItem.Id, Room.Id, userItem.BaseItem, userItem.ExtraData, userItem.LimitedNo, userItem.LimitedTot, X, Y, 0.0, Rotation, "", Room); if (Room.GetRoomItemHandler().SetFloorItem(Session, roomItem, X, Y, Rotation, true, false, true)) { using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) queryreactor.RunQuery("UPDATE items SET room_id = " + Room.Id + ", user_id = " + Room.RoomData.OwnerId + " WHERE id = " + ItemId); Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId); if (WiredUtillity.TypeIsWired(userItem.GetBaseItem().InteractionType)) { WiredSaver.HandleDefaultSave(userItem.Id, Room, roomItem); } ButterflyEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.FURNI_PLACE, 0); } else { Session.SendPacket(new RoomNotificationComposer("furni_placement_error", "message", "${room.error.cant_set_item}")); return; } } else if (userItem.IsWallItem) { string[] CorrectedData = new string[Data.Length - 1]; for (int i = 1; i < Data.Length; i++) { CorrectedData[i - 1] = Data[i]; } string WallPos = string.Empty; if (TrySetWallItem(CorrectedData, out WallPos)) { Item roomItem = new Item(userItem.Id, Room.Id, userItem.BaseItem, userItem.ExtraData, userItem.LimitedNo, userItem.LimitedTot, 0, 0, 0.0, 0, WallPos, Room); if (Room.GetRoomItemHandler().SetWallItem(Session, roomItem)) { using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) queryreactor.RunQuery("UPDATE items SET room_id = " + Room.Id + ", user_id = " + Room.RoomData.OwnerId + " WHERE id = " + ItemId); Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId); } } else { Session.SendPacket(new RoomNotificationComposer("furni_placement_error", "message", "${room.error.cant_set_item}")); return; } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Session.SendMessage(new BadgesComposer(Session)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int roomID = Packet.PopInt(); bool IsVip = Session.GetHabbo().VIPRank < 1 ? false : true; int Cost = IsVip ? 0 : 3; int Time = IsVip ? (5 + DayNightManager.GetTaxiTime()) : (10 + DayNightManager.GetTaxiTime()); string TaxiText = IsVip ? " VIP" : ""; bool RoomLoaded = false; bool OnDuty = false; if (Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Session.GetRoleplay().StaffOnDuty) { OnDuty = true; } if (Session.GetHabbo().VIPRank > 1) { OnDuty = true; } #region Conditions if (Session.GetRoleplay().IsJailed || Session.GetRoleplay().IsDead) { return; } if (Session.GetRoleplay().Cuffed) { Session.SendWhisper("Os taxistas não querem levar você, pois estão com medo de você algemado!", 1); return; } if (Session.GetRoomUser() != null) { if (Session.GetRoomUser().Frozen) { Session.SendWhisper("Você não pode pegar um taxi enquanto está atordoado!", 1); return; } } #endregion RoomData roomData = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(roomID); if (roomData == null) { return; } if (RoomLoaded) { return; } if (roomData.TutorialEnabled && !OnDuty) { Session.SendWhisper("[RPG Taxi] Você não pode ir para uma sala de Tutorial!", 1); return; } if (Session.GetRoomUser() != null && Session.GetRoomUser().GetRoom() != null) { if (Session.GetRoomUser().GetRoom().TutorialEnabled&& !OnDuty) { Session.SendWhisper("[RPG Taxi] Você não pode usar taxi em uma sala de tutorial, termine ele primeiro!", 1); return; } if (!Session.GetRoomUser().GetRoom().TaxiFromEnabled&& !OnDuty) { Session.SendWhisper("[RPG Taxi] Desculpe, não podemos pegar você neste quarto!", 1); return; } } if (roomID != Session.GetHabbo().CurrentRoomId) { if (Session.GetRoleplay().Game != null) { Session.SendWhisper("Você não pode pegar um texi no evento!", 1); return; } bool PoliceCost = false; if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking) { PoliceCost = true; } if (Session.GetHabbo().Credits < Cost && Cost > 0 && !OnDuty && !PoliceCost) { Session.SendWhisper("[RPG Taxi] Você não tem dinheiro suficiente para dar uma volta!", 1); return; } if (Session.GetRoleplay().InsideTaxi) { Session.SendWhisper("[RPG Taxi] Já estou indo pegar você! Digite ':ptaxi' se mudar de ideia!", 1); return; } bool PoliceTool = false; if (Session.GetRoleplay().GuideOtherUser != null) { if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide")) { if (Session.GetRoleplay().GuideOtherUser.GetHabbo() != null && Session.GetRoleplay().GuideOtherUser.GetRoomUser() != null) { if (roomID == Session.GetRoleplay().GuideOtherUser.GetRoomUser().RoomId) { PoliceTool = true; } } } } if (!roomData.TaxiToEnabled && !OnDuty && !PoliceTool) { Session.SendWhisper("[RPG Taxi] Desculpe, não podemos buscar você neste quarto!", 1); return; } bool Event = false; if (roomData.RoleplayEvent != null) { if (!roomData.RoleplayEvent.HasGameStarted()) { Event = true; } } Session.GetRoleplay().InsideTaxi = true; bool PoliceTaxi = false; if (!OnDuty && !PoliceTool && Session.GetHabbo().CurrentRoomId > 0 && !Event) { if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking) { Cost = 0; Time = 5; if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(EffectsList.PoliceTaxi); } Session.Shout("*Puxa o rádio da Polícia e vai rapidamente para " + roomData.Name + " [ID: " + roomID + "]*", 37); PoliceTaxi = true; } else { if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(EffectsList.Taxi); } Session.Shout("*Chama um Taxi" + TaxiText + " por " + roomData.Name + " [ID: " + roomID + "]*", 4); } new Thread(() => { for (int i = 0; i < (Time + 1) * 10; i++) { if (Session.GetRoleplay() == null) { break; } if (Session.GetRoleplay().InsideTaxi) { Thread.Sleep(100); } else { break; } } if (Session.GetRoleplay() != null) { if (Session.GetRoleplay().InsideTaxi) { if (Cost > 0) { Session.GetHabbo().Credits -= Cost; Session.GetHabbo().UpdateCreditsBalance(); } if (PoliceTaxi) { if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(EffectsList.CarPolice); } Session.Shout("*Entra no meu carro de polícia e vai para o local*", 37); } else { Session.Shout("*Pula dentro do meu Taxi" + TaxiText + " e vai rapidamente para o local*", 4); } RoleplayManager.SendUser(Session, roomData.Id); } } }).Start(); } else { if (PoliceTool) { if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(EffectsList.CarPolice); } Session.Shout("*Entra no meu carro de polícia e dirige para ajudar um cidadão em necessidade*", 4); } else if (OnDuty) { Session.Shout("*Pula dentro do meu Carro Staff*", 23); } RoleplayManager.SendUser(Session, roomData.Id); } } else { Session.SendMessage(new GetGuestRoomResultComposer(Session, roomData, true, false)); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { }
public void Parse(GameClient session, ClientPacket packet) { session.SendPacket(new FurnitureAliasesComposer()); }
public void Parse(GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Room.CheckMute(Session)) { Session.SendWhisper("Oeps! Je hebt een spreekverbod."); return; } if (QuasarEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0) { return; } string Params = Packet.PopString(); string ToUser = Params.Split(' ')[0]; string Message = Params.Substring(ToUser.Length + 1); int Colour = Packet.PopInt(); RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser); if (User2 == null) { return; } if (Session.GetHabbo().TimeMuted > 0) { Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted)); return; } ChatStyle Style = null; if (!QuasarEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight))) { Colour = 0; } User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId; if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool")) { int MuteTime; if (User.IncrementAndCheckFlood(out MuteTime)) { Session.SendMessage(new FloodControlComposer(MuteTime)); return; } } if (!User2.GetClient().GetHabbo().ReceiveWhispers&& !Session.GetHabbo().GetPermissions().HasRight("room_whisper_override")) { Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze actie uit te voeren."); return; } QuasarEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new Quasar.HabboHotel.Rooms.Chat.Logs.ChatlogEntry(Session.GetHabbo().Id, Room.Id, ": " + Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room)); Room.AddChatlog(Session.GetHabbo().Id, ": " + Message); string word; if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") && QuasarEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out word)) { Room _room = QuasarEnvironment.GetGame().GetRoomManager().LoadRoom(2); Session.GetHabbo().PrepareRoom(_room.Id, "2"); Session.SendMessage(new RoomCustomizedAlertComposer("Het woord '" + word + "' is verboden.")); QuasarEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("bubble_filter", "Filter bericht\n\nHabbis: " + Session.GetHabbo().Username + "\nWoord: " + word + "\nType: Chatconsole", "")); return; } QuasarEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT); User.UnIdle(); User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble)); if (User2 != null && !User2.IsBot && User2.UserId != User.UserId) { if (!User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id)) { User2.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble)); } } List <RoomUser> ToNotify = Room.GetRoomUserManager().GetRoomUserByRank(5); if (ToNotify.Count > 0) { foreach (RoomUser user in ToNotify) { if (user != null && user.HabboId != User2.HabboId && user.HabboId != User.HabboId) { if (user.GetClient() != null && user.GetClient().GetHabbo() != null && !user.GetClient().GetHabbo().IgnorePublicWhispers) { user.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "[Fluistert naar " + ToUser + "] " + Message, 0, User.LastBubble)); } } } } }
public void HandleSave(ClientPacket Packet) { int Unknown = Packet.PopInt(); string Unknown2 = Packet.PopString(); }
public void HandleSave(ClientPacket Packet) { }
public void Parse(GameClient session, ClientPacket packet) { if (!session.Habbo.InRoom) { return; } if (session.Habbo == null || session.Habbo.GetInventoryComponent() == null) { return; } if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(session.Habbo.CurrentRoomId, out Room room)) { return; } int petId = packet.PopInt(); if (!room.GetRoomUserManager().TryGetPet(petId, out RoomUser 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.Habbo.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(petId); if (targetUser == null) { return; } //Check some values first, please! if (targetUser.GetClient() == null || targetUser.GetClient().Habbo == null) { return; } //Update the targets PetId. targetUser.GetClient().Habbo.PetId = 0; //Quickly remove the old user instance. room.SendPacket(new UserRemoveComposer(targetUser.VirtualId)); //Add the new one, they won't even notice a thing!!11 8-) room.SendPacket(new UsersComposer(targetUser)); return; } if (session.Habbo.Id != pet.PetData.OwnerId && !room.CheckRights(session, true)) { 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 data = pet.PetData; if (data != null) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots` SET `room_id` = '0', `x` = '0', `Y` = '0', `Z` = '0' WHERE `id` = '" + data.PetId + "' LIMIT 1"); dbClient.RunQuery("UPDATE `bots_petdata` SET `experience` = '" + data.experience + "', `energy` = '" + data.Energy + "', `nutrition` = '" + data.Nutrition + "', `respect` = '" + data.Respect + "' WHERE `id` = '" + data.PetId + "' LIMIT 1"); } } if (data.OwnerId != session.Habbo.Id) { GameClient target = PlusEnvironment.GetGame().GetClientManager().GetClientByUserId(data.OwnerId); if (target != null) { target.Habbo.GetInventoryComponent().TryAddPet(pet.PetData); room.GetRoomUserManager().RemoveBot(pet.VirtualId, false); target.SendPacket(new PetInventoryComposer(target.Habbo.GetInventoryComponent().GetPets())); return; } } room.GetRoomUserManager().RemoveBot(pet.VirtualId, false); }
public void Parse(GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } if (!ButterflyEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room Room)) { return; } int ItemId = Packet.PopInt(); Item Item = Room.GetRoomItemHandler().GetItem(ItemId); if (Item == null) { return; } int PetId = Packet.PopInt(); RoomUser PetUser = null; if (!Room.GetRoomUserManager().TryGetPet(PetId, out PetUser)) { return; } if (PetUser.PetData == null || PetUser.PetData.OwnerId != Session.GetHabbo().Id || PetUser.PetData.Type != 13) { return; } if (Item.Data.InteractionType == InteractionType.HORSE_SADDLE_1) { PetUser.PetData.Saddle = 9; using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_pets` SET `have_saddle` = '1' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); dbClient.RunQuery("DELETE items, items_limited FROM items LEFT JOIN items_limited ON (items_limited.item_id = items.id) WHERE items.id = " + Item.Id + ""); } //We only want to use this if we're successful. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id); } else if (Item.Data.InteractionType == InteractionType.HORSE_SADDLE_2) { PetUser.PetData.Saddle = 10; using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_pets` SET `have_saddle` = '2' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); dbClient.RunQuery("DELETE items, items_limited FROM items LEFT JOIN items_limited ON (items_limited.item_id = items.id) WHERE items.id = " + Item.Id + ""); } //We only want to use this if we're successful. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id); } else if (Item.Data.InteractionType == InteractionType.HORSE_HAIRSTYLE) { int Parse = 100; string HairType = Item.GetBaseItem().ItemName.Split('_')[2]; Parse = Parse + int.Parse(HairType); PetUser.PetData.PetHair = Parse; using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_pets` SET `pethair` = '" + PetUser.PetData.PetHair + "' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); dbClient.RunQuery("DELETE items, items_limited FROM items LEFT JOIN items_limited ON (items_limited.item_id = items.id) WHERE items.id = " + Item.Id + ""); } //We only want to use this if we're successful. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id); } else if (Item.Data.InteractionType == InteractionType.HORSE_HAIR_DYE) { int HairDye = 48; string HairType = Item.GetBaseItem().ItemName.Split('_')[2]; HairDye = HairDye + int.Parse(HairType); PetUser.PetData.HairDye = HairDye; using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_pets` SET `hairdye` = '" + PetUser.PetData.HairDye + "' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); dbClient.RunQuery("DELETE items, items_limited FROM items LEFT JOIN items_limited ON (items_limited.item_id = items.id) WHERE items.id = " + Item.Id + ""); } //We only want to use this if we're successful. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id); } else if (Item.Data.InteractionType == InteractionType.HORSE_BODY_DYE) { string Race = Item.GetBaseItem().ItemName.Split('_')[2]; int Parse = int.Parse(Race); int RaceLast = 2 + (Parse * 4) - 4; if (Parse == 13) { RaceLast = 61; } else if (Parse == 14) { RaceLast = 65; } else if (Parse == 15) { RaceLast = 69; } else if (Parse == 16) { RaceLast = 73; } PetUser.PetData.Race = RaceLast.ToString(); using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_pets` SET `race` = '" + PetUser.PetData.Race + "' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); dbClient.RunQuery("DELETE items, items_limited FROM items LEFT JOIN items_limited ON (items_limited.item_id = items.id) WHERE items.id = " + Item.Id + ""); } //We only want to use this if we're successful. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id); } //Update the Pet and the Pet figure information. Room.SendPacket(new UsersComposer(PetUser)); Room.SendPacket(new PetHorseFigureInformationComposer(PetUser)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { string Username = Packet.PopString(); }
public static void ProcessPacket(ClientPacket packet, IPEndPoint endPoint, IPEndPoint listenerEndpoint) { if (listenerEndpoint.Port == ConfigManager.Config.Server.Network.Port + 1) { if (packet.Header.Flags.HasFlag(PacketHeaderFlags.ConnectResponse)) { PacketInboundConnectResponse connectResponse = new PacketInboundConnectResponse(packet); // This should be set on the second packet to the server from the client. // This completes the three-way handshake. sessionLock.EnterReadLock(); Session session = null; try { session = (from k in sessionMap where k != null && k.State == SessionState.AuthConnectResponse && k.Network.ConnectionData.ConnectionCookie == connectResponse.Check && k.EndPoint.Address.Equals(endPoint.Address) select k).FirstOrDefault(); } finally { sessionLock.ExitReadLock(); } if (session != null) { session.State = SessionState.AuthConnected; session.Network.sendResync = true; AuthenticationHandler.HandleConnectResponse(session); return; } else { return; } } else if (packet.Header.Id == 0 && packet.Header.HasFlag(PacketHeaderFlags.CICMDCommand)) { // TODO: Not sure what to do with these packets yet } else { log.ErrorFormat("Packet from {0} rejected. Packet sent to listener 1 and is not a ConnectResponse or CICMDCommand", endPoint); } } else if (packet.Header.HasFlag(PacketHeaderFlags.LoginRequest)) { if (!loggedInClients.Contains(endPoint) && loggedInClients.Count >= ConfigManager.Config.Server.Network.MaximumAllowedSessions) { log.InfoFormat("Login Request from {0} rejected. Server full.", endPoint); // TODO can we send a message back to the client indicating we're full? } else { log.DebugFormat("Login Request from {0}", endPoint); var session = FindOrCreateSession(endPoint); if (session != null) { session.ProcessPacket(packet); } } } else if (sessionMap.Length > packet.Header.Id && loggedInClients.Contains(endPoint)) { var session = sessionMap[packet.Header.Id]; if (session != null) { if (session.EndPoint.Equals(endPoint)) { session.ProcessPacket(packet); } else { log.WarnFormat("Session for Id {0} has IP {1} but packet has IP {2}", packet.Header.Id, session.EndPoint, endPoint); } } else { log.WarnFormat("Null Session for Id {0}", packet.Header.Id); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int ErrorCode = (Session.GetHabbo().TradingLockExpiry > 0 ? 6 : 1); Session.SendMessage(new MarketplaceCanMakeOfferResultComposer(ErrorCode)); }
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; } if (!room.GetRoomUserManager().TryGetBot(botId, out RoomUser 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.SendPacket(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[] { ";#;" }, StringSplitOptions.None); string[] speechData = configData[0].Split(new[] { '\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++) { 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); DataTable botSpeech = dbClient.GetTable(); 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.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; } 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.SendPacket(new UsersComposer(bot)); break; } #endregion } }