public void parse(GameClient Session, ClientPacket Packet) { Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Room == null || !Room.CheckRights(Session, true) || Room.Event == null) { return; } int _category = Packet.PopWiredInt32(); string _name = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); string _description = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); int _count = Packet.PopWiredInt32(); Room.Event.Category = _category; Room.Event.Name = _name; Room.Event.Description = _description; Room.Event.Tags = new List<string>(); for (int i = 0; i < _count; i++) { Room.Event.Tags.Add(UberEnvironment.FilterInjectionChars(Packet.PopFixedString())); } Room.SendMessage(Room.Event.Serialize(Session)); }
public void parse(GameClient Session, ClientPacket Packet) { uint SlotId = Packet.PopWiredUInt(); string Look = Packet.PopFixedString(); string Gender = Packet.PopFixedString(); if (!AntiMutant.ValidateLook(Look, Gender)) { return; } using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient()) { dbClient.AddParamWithValue("userid", Session.GetHabbo().Id); dbClient.AddParamWithValue("slotid", SlotId); dbClient.AddParamWithValue("look", Look); dbClient.AddParamWithValue("gender", Gender.ToUpper()); if (dbClient.ReadDataRow("SELECT null FROM user_wardrobe WHERE user_id = @userid AND slot_id = @slotid LIMIT 1") != null) { dbClient.ExecuteQuery("UPDATE user_wardrobe SET look = @look, gender = @gender WHERE user_id = @userid AND slot_id = @slotid LIMIT 1"); } else { dbClient.ExecuteQuery("INSERT INTO user_wardrobe (user_id,slot_id,look,gender) VALUES (@userid,@slotid,@look,@gender)"); } } }
public void parse(GameClient Session, ClientPacket Packet) { if (Session.GetHabbo().MutantPenalty) { Session.SendNotif("Because of a penalty or restriction on your account, you are not allowed to change your look."); return; } string Gender = Packet.PopFixedString().ToUpper(); string Look = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); if (!AntiMutant.ValidateLook(Look, Gender)) { return; } Session.GetHabbo().Look = Look; Session.GetHabbo().Gender = Gender.ToLower(); using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient()) { dbClient.AddParamWithValue("look", Look); dbClient.AddParamWithValue("gender", Gender); dbClient.ExecuteQuery("UPDATE users SET look = @look, gender = @gender WHERE id = '" + Session.GetHabbo().Id + "' LIMIT 1"); } UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(Session, 1, 1); ServerPacket packet = new ServerPacket(266); packet.AppendInt32(-1); packet.AppendStringWithBreak(Session.GetHabbo().Look); packet.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); packet.AppendStringWithBreak(Session.GetHabbo().Motto); Session.SendPacket(packet); if (Session.GetHabbo().InRoom) { Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser User = Room.GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } ServerPacket RoomUpdate = new ServerPacket(266); RoomUpdate.AppendInt32(User.VirtualId); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto); Room.SendMessage(RoomUpdate); } }
public void parse(GameClient Session, ClientPacket Packet) { int PageId = Packet.PopWiredInt32(); uint ItemId = Packet.PopWiredUInt(); string ExtraData = Packet.PopFixedString(); string GiftUser = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); string GiftMessage = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); UberEnvironment.GetGame().GetCatalog().HandlePurchase(Session, PageId, ItemId, ExtraData, true, GiftUser, GiftMessage); }
public void parse(GameClient Session, ClientPacket Packet) { Session.GetHabbo().GetBadgeComponent().ResetSlots(); using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient()) { dbClient.ExecuteQuery("UPDATE user_badges SET badge_slot = '0' WHERE user_id = '" + Session.GetHabbo().Id + "'"); } while (Packet.RemainingLength > 0) { int Slot = Packet.PopWiredInt32(); string Badge = Packet.PopFixedString(); if (Badge.Length == 0) { continue; } if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Badge) || Slot < 1 || Slot > 5) { // zomg haxx0r return; } Session.GetHabbo().GetBadgeComponent().GetBadge(Badge).Slot = Slot; using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient()) { dbClient.AddParamWithValue("slotid", Slot); dbClient.AddParamWithValue("badge", Badge); dbClient.AddParamWithValue("userid", Session.GetHabbo().Id); dbClient.ExecuteQuery("UPDATE user_badges SET badge_slot = @slotid WHERE badge_id = @badge AND user_id = @userid LIMIT 1"); } } ServerPacket Message = new ServerPacket(228); Message.AppendUInt(Session.GetHabbo().Id); Message.AppendInt32(Session.GetHabbo().GetBadgeComponent().EquippedCount); foreach (Badge Badge in Session.GetHabbo().GetBadgeComponent().BadgeList) { if (Badge.Slot <= 0) { continue; } Message.AppendInt32(Badge.Slot); Message.AppendStringWithBreak(Badge.Code); } if (Session.GetHabbo().InRoom && UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId) != null) { UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(Message); } else { Session.SendPacket(Message); } }
public void parse(GameClient Session, ClientPacket Packet) { int count = Packet.PopWiredInt32(); List<uint> UserIds = new List<uint>(); for (int i = 0; i < count; i++) { UserIds.Add(Packet.PopWiredUInt()); } string message = UberEnvironment.FilterInjectionChars(Packet.PopFixedString(), true); ServerPacket Message = new ServerPacket(135); Message.AppendUInt(Session.GetHabbo().Id); Message.AppendStringWithBreak(message); foreach (uint Id in UserIds) { if (!Session.GetHabbo().GetMessenger().FriendshipExists(Session.GetHabbo().Id, Id)) { continue; } GameClient Client = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Id); if (Client == null) { return; } Client.SendPacket(Message); } }
public void parse(GameClient Session, ClientPacket Packet) { string RoomName = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); string ModelName = Packet.PopFixedString(); string RoomState = Packet.PopFixedString(); // unused, room open by default on creation. may be added in later build of Habbo? RoomData NewRoom = UberEnvironment.GetGame().GetRoomManager().CreateRoom(Session, RoomName, ModelName); if (NewRoom != null) { ServerPacket packet = new ServerPacket(59); packet.AppendUInt(NewRoom.Id); packet.AppendStringWithBreak(NewRoom.Name); Session.SendPacket(packet); } }
public void parse(GameClient Session, ClientPacket Packet) { Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Room == null || !Room.CheckRights(Session)) { return; } string Name = Packet.PopFixedString(); byte[] Result = Packet.ReadBytes(1); GameClient Client = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Name); if (Client == null) { return; } if (Result[0] == Convert.ToByte(65)) { Client.GetHabbo().LoadingChecksPassed = true; Session.SendPacket(new ServerPacket(41)); } else { Session.SendPacket(new ServerPacket(131)); } }
public void parse(GameClient Session, ClientPacket Packet) { int PageId = Packet.PopWiredInt32(); uint ItemId = Packet.PopWiredUInt(); string ExtraData = Packet.PopFixedString(); UberEnvironment.GetGame().GetCatalog().HandlePurchase(Session, PageId, ItemId, ExtraData, false, "", ""); }
public void parse(GameClient Session, ClientPacket Packet) { int _min = Packet.PopWiredInt32(); int _max = Packet.PopWiredInt32(); string _query = Packet.PopFixedString(); int _filter = Packet.PopWiredInt32(); Session.SendPacket(UberEnvironment.GetGame().GetCatalog().GetMarketplace().SerializeOffers(_min, _max, _query, _filter)); }
public void parse(GameClient Session, ClientPacket Packet) { if (Session.GetHabbo().GetMessenger() == null) { return; } Session.GetHabbo().GetMessenger().RequestBuddy(Packet.PopFixedString()); }
public void parse(GameClient Session, ClientPacket Packet) { if (Session.GetHabbo().GetMessenger() == null) { return; } Session.SendPacket(Session.GetHabbo().GetMessenger().PerformSearch(Packet.PopFixedString())); }
public void parse(GameClient Session, ClientPacket Packet) { if (Session.GetHabbo() == null) { Session.Login(Packet.PopFixedString()); } else { Session.SendNotif("You are already logged in!"); } }
public void parse(GameClient Session, ClientPacket Packet) { string SearchQuery = Packet.PopFixedString(); if (SearchQuery.Length < 3) { return; } Session.SendPacket(UberEnvironment.GetGame().GetHelpTool().SerializeSearchResults(SearchQuery)); }
public void parse(GameClient Session, ClientPacket Packet) { uint userId = Packet.PopWiredUInt(); string message = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); if (Session.GetHabbo().GetMessenger() == null) { return; } Session.GetHabbo().GetMessenger().SendInstantMessage(userId, message); }
public void parse(GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().HasFuse("fuse_alert")) { return; } uint UserId = Packet.PopWiredUInt(); string Message = Packet.PopFixedString(); UberEnvironment.GetGame().GetModerationTool().AlertUser(Session, UserId, Message, true); }
public void parse(GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().HasFuse("fuse_ban")) { return; } uint UserId = Packet.PopWiredUInt(); string Message = Packet.PopFixedString(); int Length = Packet.PopWiredInt32() * 3600; UberEnvironment.GetGame().GetModerationTool().BanUser(Session, UserId, Length, Message); }
public void parse(GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().HasFuse("fuse_alert")) { return; } int One = Packet.PopWiredInt32(); int Two = Packet.PopWiredInt32(); string Message = Packet.PopFixedString(); UberEnvironment.GetGame().GetModerationTool().RoomAlert(Session.GetHabbo().CurrentRoomId, !Two.Equals(3), Message); }
public void parse(GameClient Session, ClientPacket Packet) { uint Id = Packet.PopWiredUInt(); string Password = Packet.PopFixedString(); Packet.PopWiredInt32(); RoomData Data = UberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Id); if (Data == null || Data.Type != "private") { return; } Session.PrepareRoomForUser(Id, Password); }
public void parse(GameClient Session, ClientPacket Packet) { Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Room == null) { return; } RoomItem Item = Room.GetItem(Packet.PopWiredUInt()); if (Item == null || Item.GetBaseItem().InteractionType.ToLower() != "postit") { return; } string Data = Packet.PopFixedString(); string Color = Data.Split(' ')[0]; string Text = UberEnvironment.FilterInjectionChars(Data.Substring(Color.Length + 1), true); if (!Room.CheckRights(Session)) { if (!Data.StartsWith(Item.ExtraData)) { return; // we can only ADD stuff! older stuff changed, this is not allowed } } switch (Color) { case "FFFF33": case "FF9CFF": case "9CCEFF": case "9CFF9C": break; default: return; // invalid color } Item.ExtraData = Color + " " + Text; Item.UpdateState(true, true); }
public void parse(GameClient Session, ClientPacket Packet) { string Motto = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); if (Motto == Session.GetHabbo().Motto) // Prevents spam? { return; } Session.GetHabbo().Motto = Motto; using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient()) { dbClient.AddParamWithValue("motto", Motto); dbClient.ExecuteQuery("UPDATE users SET motto = @motto WHERE id = '" + Session.GetHabbo().Id + "' LIMIT 1"); } ServerPacket packet = new ServerPacket(484); packet.AppendInt32(-1); packet.AppendStringWithBreak(Session.GetHabbo().Motto); Session.SendPacket(packet); if (Session.GetHabbo().InRoom) { Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser User = Room.GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } ServerPacket RoomUpdate = new ServerPacket(266); RoomUpdate.AppendInt32(User.VirtualId); RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look); // Need this to reload User or they will be invisible RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); // Need this to reload User or they will be invisible RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto); // Update The User Motto Room.SendMessage(RoomUpdate); } }
public void parse(GameClient Session, ClientPacket Packet) { Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Room == null) { return; } RoomUser User = Room.GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } User.Chat(Session, UberEnvironment.FilterInjectionChars(Packet.PopFixedString()), false); }
public void parse(GameClient Session, ClientPacket Packet) { string SubscriptionId = Packet.PopFixedString(); ServerPacket packet = new ServerPacket(7); packet.AppendStringWithBreak(SubscriptionId.ToLower()); if (Session.GetHabbo().GetSubscriptionManager().HasSubscription(SubscriptionId)) { Double Expire = Session.GetHabbo().GetSubscriptionManager().GetSubscription(SubscriptionId).ExpireTime; Double TimeLeft = Expire - UberEnvironment.GetUnixTimestamp(); int TotalDaysLeft = (int)Math.Ceiling(TimeLeft / 86400); int MonthsLeft = TotalDaysLeft / 31; if (MonthsLeft >= 1) MonthsLeft--; packet.AppendInt32(TotalDaysLeft - (MonthsLeft * 31)); packet.AppendBoolean(true); packet.AppendInt32(MonthsLeft); packet.AppendInt32(1); packet.AppendInt32(1); if (Session.GetHabbo().HasFuse("fuse_use_vip_outfits")) { packet.AppendInt32(2); } else { packet.AppendInt32(1); } } else { for (int i = 0; i < 3; i++) { packet.AppendInt32(0); } } Session.SendPacket(packet); }
public void parse(GameClient Session, ClientPacket Packet) { Boolean errorOccured = false; if (UberEnvironment.GetGame().GetModerationTool().UsersHasPendingTicket(Session.GetHabbo().Id)) { errorOccured = true; } if (!errorOccured) { string Message = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); int Junk = Packet.PopWiredInt32(); int Type = Packet.PopWiredInt32(); uint ReportedUser = Packet.PopWiredUInt(); UberEnvironment.GetGame().GetModerationTool().SendNewTicket(Session, Type, ReportedUser, Message); } ServerPacket packet = new ServerPacket(321); packet.AppendBoolean(errorOccured); Session.SendPacket(packet); }
public void parse(GameClient Session, ClientPacket Packet) { Session.SendPacket(UberEnvironment.GetGame().GetNavigator().SerializeRoomListing(Session, int.Parse(Packet.PopFixedString()))); }
public void parse(GameClient Session, ClientPacket Packet) { int Category = int.Parse(Packet.PopFixedString()); Session.SendPacket(UberEnvironment.GetGame().GetNavigator().SerializeEventListing(Session, Category)); }
public void parse(GameClient Session, ClientPacket Packet) { Session.SendPacket(UberEnvironment.GetGame().GetNavigator().SerializeSearchResults(Packet.PopFixedString())); }
public void parse(GameClient Session, ClientPacket Packet) { Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Room == null || !Room.CheckRights(Session)) { return; } string PlacementData = Packet.PopFixedString(); string[] DataBits = PlacementData.Split(' '); uint ItemId = uint.Parse(DataBits[0]); UserItem Item = Session.GetHabbo().GetInventoryComponent().GetItem(ItemId); if (Item == null) { return; } switch (Item.GetBaseItem().InteractionType.ToLower()) { case "dimmer": if (Room.ItemCountByType("dimmer") >= 1) { Session.SendNotif("You can only have one moodlight in a room."); return; } break; } // Wall Item if (DataBits[1].StartsWith(":")) { string WallPos = Room.WallPositionCheck(":" + PlacementData.Split(':')[1]); if (WallPos == null) { ServerPacket packet = new ServerPacket(516); packet.AppendInt32(11); Session.SendPacket(packet); return; } RoomItem RoomItem = new RoomItem(Item.Id, Room.RoomId, Item.BaseItem, Item.ExtraData, 0, 0, 0.0, 0, WallPos); if (Room.SetWallItem(Session, RoomItem)) { Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId); } } // Floor Item else { int X = int.Parse(DataBits[1]); int Y = int.Parse(DataBits[2]); int Rot = int.Parse(DataBits[3]); RoomItem RoomItem = new RoomItem(Item.Id, Room.RoomId, Item.BaseItem, Item.ExtraData, 0, 0, 0, 0, ""); if (Room.SetFloorItem(Session, RoomItem, X, Y, Rot, true)) { Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId); } } }
public void parse(GameClient Session, ClientPacket Packet) { UberEnvironment.GetGame().GetCatalog().GetVoucherHandler().TryRedeemVoucher(Session, Packet.PopFixedString()); }
public void parse(GameClient Session, ClientPacket Packet) { Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Room == null || !Room.CheckRights(Session, true)) { return; } int Id = Packet.PopWiredInt32(); string Name = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); string Description = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); int State = Packet.PopWiredInt32(); string Password = UberEnvironment.FilterInjectionChars(Packet.PopFixedString()); int MaxUsers = Packet.PopWiredInt32(); int CategoryId = Packet.PopWiredInt32(); int TagCount = Packet.PopWiredInt32(); List<string> Tags = new List<string>(); StringBuilder formattedTags = new StringBuilder(); for (int i = 0; i < TagCount; i++) { if (i > 0) { formattedTags.Append(","); } string tag = UberEnvironment.FilterInjectionChars(Packet.PopFixedString().ToLower()); Tags.Add(tag); formattedTags.Append(tag); } int AllowPets = 0; int AllowPetsEat = 0; int AllowWalkthrough = 0; int Hidewall = 0; string _AllowPets = Packet.PlainReadBytes(1)[0].ToString(); Packet.AdvancePointer(1); string _AllowPetsEat = Packet.PlainReadBytes(1)[0].ToString(); Packet.AdvancePointer(1); string _AllowWalkthrough = Packet.PlainReadBytes(1)[0].ToString(); Packet.AdvancePointer(1); string _Hidewall = Packet.PlainReadBytes(1)[0].ToString(); Packet.AdvancePointer(1); if (Name.Length < 1) { return; } if (State < 0 || State > 2) { return; } if (MaxUsers != 10 && MaxUsers != 15 && MaxUsers != 20 && MaxUsers != 25) { return; } FlatCat FlatCat = UberEnvironment.GetGame().GetNavigator().GetFlatCat(CategoryId); if (FlatCat == null) { return; } if (FlatCat.MinRank > Session.GetHabbo().Rank) { Session.SendNotif("You are not allowed to use this category. Your room has been moved to no category instead."); CategoryId = 0; } if (TagCount > 2) { return; } if (State < 0 || State > 2) { return; } if (_AllowPets == "65") { AllowPets = 1; Room.AllowPets = true; } else { Room.AllowPets = false; } if (_AllowPetsEat == "65") { AllowPetsEat = 1; Room.AllowPetsEating = true; } else { Room.AllowPetsEating = false; } if (_AllowWalkthrough == "65") { AllowWalkthrough = 1; Room.AllowWalkthrough = true; } else { Room.AllowWalkthrough = false; } if (_Hidewall == "65") { Hidewall = 1; Room.Hidewall = true; } else { Room.Hidewall = false; } Room.Name = Name; Room.State = State; Room.Description = Description; Room.Category = CategoryId; Room.Password = Password; Room.Tags = Tags; Room.UsersMax = MaxUsers; string formattedState = "open"; if (Room.State == 1) { formattedState = "locked"; } else if (Room.State > 1) { formattedState = "password"; } using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient()) { dbClient.AddParamWithValue("caption", Room.Name); dbClient.AddParamWithValue("description", Room.Description); dbClient.AddParamWithValue("password", Room.Password); dbClient.AddParamWithValue("tags", formattedTags.ToString()); dbClient.ExecuteQuery("UPDATE rooms SET caption = @caption, description = @description, password = @password, category = '" + CategoryId + "', state = '" + formattedState + "', tags = @tags, users_max = '" + MaxUsers + "', allow_pets = '" + AllowPets + "', allow_pets_eat = '" + AllowPetsEat + "', allow_walkthrough = '" + AllowWalkthrough + "', allow_hidewall = '" + Hidewall + "' WHERE id = '" + Room.RoomId + "' LIMIT 1"); } ServerPacket packet = new ServerPacket(467); packet.AppendUInt(Room.RoomId); Session.SendPacket(packet); packet = new ServerPacket(456); packet.AppendUInt(Room.RoomId); Session.SendPacket(packet); packet = new ServerPacket(472); packet.AppendBoolean(Room.Hidewall); UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(packet); RoomData Data = new RoomData(); Data.Fill(Room); packet = new ServerPacket(454); packet.AppendBoolean(false); Data.Serialize(packet, false); packet.AppendBoolean(false); packet.AppendBoolean(false); Session.SendPacket(packet); }