public void Handle(GameClient Session, ClientMessage Event)
        {
            Room Room = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
            if (Room != null && Room.CheckRights(Session, true))
            {

                        ServerMessage LoadUsersWithRights = new ServerMessage(Outgoing.FlatControllerAdded);
                        LoadUsersWithRights.AppendUInt(Room.Id);
                        LoadUsersWithRights.AppendInt32(Room.UsersWithRights.Count);
                        foreach (uint current2 in Room.UsersWithRights)
                        {

                            LoadUsersWithRights.AppendUInt(current2);
                            LoadUsersWithRights.AppendString(Essential.GetGame().GetClientManager().GetNameById(current2));
                        }
                        Session.SendMessage(LoadUsersWithRights);

                        foreach (uint current3 in Room.UsersWithRights)
                        {
                            ServerMessage serverMessage = new ServerMessage(Outgoing.GivePowers); // Updated
                            serverMessage.AppendUInt(Room.Id);
                            serverMessage.AppendUInt(current3);
                            serverMessage.AppendStringWithBreak(Essential.GetGame().GetClientManager().GetNameById(current3));
                            Session.SendMessage(serverMessage);
                        }
        
            }
        }
Example #2
0
		public Trade(uint uint_3, uint uint_4, uint uint_5)
		{
			this.uint_1 = uint_3;
			this.uint_2 = uint_4;
			this.class65_0 = new TradeUser[2];
			this.class65_0[0] = new TradeUser(uint_3, uint_5);
			this.class65_0[1] = new TradeUser(uint_4, uint_5);
			this.int_0 = 1;
			this.uint_0 = uint_5;
			TradeUser[] array = this.class65_0;
			for (int i = 0; i < array.Length; i++)
			{
				TradeUser @class = array[i];
				if ([email protected]_0().Statusses.ContainsKey("trd"))
				{
					@class.method_0().AddStatus("trd", "");
					@class.method_0().UpdateNeeded = true;
				}
			}
            ServerMessage Message = new ServerMessage(Outgoing.TradeStart); // Updated
			Message.AppendUInt(uint_3);
			Message.AppendInt32(1);
			Message.AppendUInt(uint_4);
            Message.AppendInt32(1);
			this.method_13(Message);
		}
 public void Handle(GameClient Session, ClientMessage Event)
 {
     ServerMessage Message = new ServerMessage(Outgoing.WardrobeData); //Rootkit
     Message.AppendInt32(Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") ? 1 : 0);
     if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
     {
         using (DatabaseClient @class = Essential.GetDatabase().GetClient())
         {
             @class.AddParamWithValue("userid", Session.GetHabbo().Id);
             DataTable dataTable = @class.ReadDataTable("SELECT slot_id, look, gender FROM user_wardrobe WHERE user_id = @userid;");
             if (dataTable == null)
             {
                 Message.AppendInt32(0);
             }
             else
             {
                 Message.AppendInt32(dataTable.Rows.Count);
                 foreach (DataRow dataRow in dataTable.Rows)
                 {
                     Message.AppendUInt((uint)dataRow["slot_id"]);
                     Message.AppendStringWithBreak((string)dataRow["look"]);
                     Message.AppendStringWithBreak((string)dataRow["gender"]);
                 }
             }
         }
         Session.SendMessage(Message);
     }
     else
     {
         using (DatabaseClient @class = Essential.GetDatabase().GetClient())
         {
             @class.AddParamWithValue("userid", Session.GetHabbo().Id);
             DataTable dataTable = @class.ReadDataTable("SELECT slot_id, look, gender FROM user_wardrobe WHERE user_id = @userid;");
             if (dataTable == null)
             {
                 Message.AppendInt32(0);
             }
             else
             {
                 Message.AppendInt32(dataTable.Rows.Count);
                 foreach (DataRow dataRow in dataTable.Rows)
                 {
                     Message.AppendUInt((uint)dataRow["slot_id"]);
                     Message.AppendStringWithBreak((string)dataRow["look"]);
                     Message.AppendStringWithBreak((string)dataRow["gender"]);
                 }
             }
         }
         Session.SendMessage(Message);
     }
 }
		public void Handle(GameClient Session, ClientMessage Event)
		{
			int num = Event.PopWiredInt32();
			List<uint> list = new List<uint>();
			for (int i = 0; i < num; i++)
			{
				list.Add(Event.PopWiredUInt());
			}
			string text = Event.PopFixedString();
			
				text = Essential.DoFilter(text, true, false);
				text = ChatCommandHandler.ApplyFilter(text);
                ServerMessage Message = new ServerMessage(Outgoing.InstantInvite); // Update
				Message.AppendUInt(Session.GetHabbo().Id);
				Message.AppendStringWithBreak(text);
				foreach (uint current in list)
				{
					if (Session.GetHabbo().GetMessenger().method_9(Session.GetHabbo().Id, current))
					{
						GameClient @class = Essential.GetGame().GetClientManager().GetClient(current);
						if (@class == null)
						{
							break;
						}
						@class.SendMessage(Message);
					}
				}
		}
		public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
		{
			if (bool_0)
			{
                ServerMessage Message = new ServerMessage(Outgoing.WiredCondition); // Updated
                Message.AppendBoolean(false);
                Message.AppendInt32(5);
                if (RoomItem_0.string_3 != "")
                {
                    Message.AppendInt32(RoomItem_0.string_3.Split(',').Length);

                    foreach (string ItemId in RoomItem_0.string_3.Split(','))
                    {
                        Message.AppendInt32(int.Parse(ItemId));
                    }
                }
                else
                {
                    Message.AppendInt32(0);
                }
                Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite);
                Message.AppendUInt(RoomItem_0.uint_0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(1);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
			}
		}
		public void Handle(GameClient Session, ClientMessage Event)
		{
			uint num = Event.PopWiredUInt();
            RoomData @class = Essential.GetGame().GetRoomManager().method_12(num);
			if (@class == null || Session.GetHabbo().list_1.Count >= 30 || Session.GetHabbo().list_1.Contains(num) || @class.Type == "public")
			{
			}
			else
			{
                ServerMessage Message2 = new ServerMessage(Outgoing.FavsUpdate); // Updated
				Message2.AppendUInt(num);
				Message2.AppendBoolean(true);
				Session.SendMessage(Message2);
				Session.GetHabbo().list_1.Add(num);
				using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
				{
					class2.ExecuteQuery(string.Concat(new object[]
					{
						"INSERT INTO user_favorites (user_id,room_id) VALUES ('",
						Session.GetHabbo().Id,
						"','",
						num,
						"')"
					}));
				}
			}
		}
 public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
 {
     if (bool_0)
     {
         ServerMessage Message = new ServerMessage(Outgoing.WiredCondition); // Updated
         Message.AppendBoolean(false);
         if (Session.GetHabbo().HasFuse("wired_unlimitedselects"))
             Message.AppendInt32(1000000);
         else
             Message.AppendInt32(5);
         Message.AppendInt32(0);
         Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite);
         Message.AppendUInt(RoomItem_0.uint_0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Session.SendMessage(Message);
     }
 }
		public void Handle(GameClient session, ClientMessage message)
		{
			if (session != null && session.GetHabbo() != null)
			{
				Room room = Essential.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId);

				if (room != null)
				{
					RoomUser targetUser = room.GetRoomUserByHabbo(message.PopWiredUInt());

					if (targetUser != null && !targetUser.IsBot && targetUser.GetClient() != null)
					{
                        ServerMessage Message = new ServerMessage(Outgoing.UpdateBadges); // Updated

						Message.AppendUInt(targetUser.GetClient().GetHabbo().Id);
						Message.AppendInt32(targetUser.GetClient().GetHabbo().GetBadgeComponent().VisibleBadges);

						using (TimedLock.Lock(targetUser.GetClient().GetHabbo().GetBadgeComponent().GetBadges()))
						{
							foreach (Badge current in targetUser.GetClient().GetHabbo().GetBadgeComponent().GetBadges())
							{
								if (current.Slot > 0)
								{
									Message.AppendInt32(current.Slot);
									Message.AppendStringWithBreak(current.Code);
								}
							}
						}

						session.SendMessage(Message);
					}
				}
			}
		}
 public void Handle(HabboHotel.GameClients.GameClient Session, global::Essential.Messages.ClientMessage Event)
 {
     using(DatabaseClient dbClient = Essential.GetDatabase().GetClient())
     {
         string username = Event.PopFixedString();
         string password = Event.PopFixedString(); //TODO: Hash undso..
         dbClient.AddParamWithValue("username", username);
         
         string currentpassword = "";
         try
         {
             currentpassword = dbClient.ReadString("SELECT password FROM users WHERE username=@username");
         }
         catch { }
         if (currentpassword == "")
         { Session.SendMessage(new ServerMessage(Outgoing.InvalidUsername)); return; }
         if (currentpassword != password)
         { Session.SendMessage(new ServerMessage(Outgoing.InvalidPassword)); return; }
         ServerMessage asdf = new ServerMessage(12345);
         asdf.AppendBoolean(true);
         asdf.AppendString("Hi");
         asdf.AppendInt32(1337);
         asdf.AppendUInt(12345);
         Session.SendMessage(asdf);
         Session.tryLogin(dbClient.ReadString("SELECT auth_ticket FROM users WHERE username=@username"));
     }
 }
		public void Handle(GameClient Session, ClientMessage Event)
		{
			uint num = Event.PopWiredUInt();
			string text = Essential.FilterString(Event.PopFixedString());
			if (Session != null && Session.GetHabbo() != null && Session.GetHabbo().GetMessenger() != null && Session.GetHabbo().PassedSafetyQuiz)
			{
                Session.GetHabbo().CheckForUnmute();
				if (num == 0u && Session.GetHabbo().HasFuse("cmd_sa"))
				{
                    ServerMessage Message = new ServerMessage(Outgoing.InstantChat);
					Message.AppendUInt(0u);
					Message.AppendString(Session.GetHabbo().Username + ": " + text);
                    Message.AppendString(Essential.GetUnixTimestamp() + string.Empty);
					Essential.GetGame().GetClientManager().SendToStaffs(Session, Message, false);
				}
				else
				{
					if (num == 0u)
					{
                       /* ServerMessage Message2 = new ServerMessage(1133);
						Message2.AppendInt32(4);
						Message2.AppendUInt(0u);
						Session.SendMessage(Message2);*/
					}
					else
					{
                        if (Session != null && Session.GetHabbo() != null)
                        {
                            Session.GetHabbo().GetMessenger().method_18(num, text);
                        }
					}
				}
			}
		}
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int GameId = Event.PopWiredInt32();


            ServerMessage InitGame = new ServerMessage(Outgoing.GameID);
            InitGame.AppendInt32(GameId);
            InitGame.AppendInt32(0);
            Session.SendMessage(InitGame);


           ServerMessage Game2WeeklyLeaderboardEvent = new ServerMessage(Outgoing.Game2WeeklyLeaderboard);
            Game2WeeklyLeaderboardEvent.AppendInt32(DateTime.Now.Year);
            Game2WeeklyLeaderboardEvent.AppendInt32(1); // ??
            Game2WeeklyLeaderboardEvent.AppendInt32(0); // ??
            Game2WeeklyLeaderboardEvent.AppendInt32(0); // ??
            Game2WeeklyLeaderboardEvent.AppendInt32(5231); // ??
            Game2WeeklyLeaderboardEvent.AppendInt32(1); // count:
            // foreach...
            Game2WeeklyLeaderboardEvent.AppendUInt(Session.GetHabbo().Id); // user id
            Game2WeeklyLeaderboardEvent.AppendInt32(DateTime.Now.Year); // time of clasification
            Game2WeeklyLeaderboardEvent.AppendInt32(1); // position
            Game2WeeklyLeaderboardEvent.AppendString(Session.GetHabbo().Username); // username
            Game2WeeklyLeaderboardEvent.AppendString(Session.GetHabbo().Figure);
            Game2WeeklyLeaderboardEvent.AppendString(Session.GetHabbo().Gender.ToLower());

            Game2WeeklyLeaderboardEvent.AppendInt32(3);
            Game2WeeklyLeaderboardEvent.AppendInt32(GameId);
            Session.SendMessage(Game2WeeklyLeaderboardEvent);


            ServerMessage Game2AccountGameStatusMessageEvent = new ServerMessage(Outgoing.Game2AccountGameStatus); 
            Game2AccountGameStatusMessageEvent.AppendInt32(GameId);
            Game2AccountGameStatusMessageEvent.AppendInt32(-1);
            Game2AccountGameStatusMessageEvent.AppendInt32(132);
            Session.SendMessage(Game2AccountGameStatusMessageEvent);

            ServerMessage InitGame2 = new ServerMessage(Outgoing.InitGame);
            InitGame2.AppendInt32(GameId);
            InitGame2.AppendInt32(0);
            Session.SendMessage(InitGame2);


            ServerMessage GameCenterLayoutBestOfWeek = new ServerMessage(Outgoing.BestOfWeek);
            GameCenterLayoutBestOfWeek.AppendInt32(GameId);
            GameCenterLayoutBestOfWeek.AppendInt32(0); // enabled 0 : 1
            // if enabled
            GameCenterLayoutBestOfWeek.AppendString("s");
            GameCenterLayoutBestOfWeek.AppendInt32(4313);
            GameCenterLayoutBestOfWeek.AppendString("200");
            GameCenterLayoutBestOfWeek.AppendInt32(1);
            GameCenterLayoutBestOfWeek.AppendInt32(-1);
            GameCenterLayoutBestOfWeek.AppendBoolean(false);
            //
            GameCenterLayoutBestOfWeek.AppendInt32(5231); // minutos que quedan.
            GameCenterLayoutBestOfWeek.AppendBoolean(false); // enabled??
            Session.SendMessage(GameCenterLayoutBestOfWeek);

        }
		public void Handle(GameClient Session, ClientMessage Event)
		{
			try
			{
				Room @class = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
                if (@class != null && @class.CheckRights(Session, true))
				{
					RoomItem class2 = @class.method_28(Event.PopWiredUInt());
					if (class2 != null)
					{
						DataRow dataRow = null;
						using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
						{
							dataRow = class3.ReadDataRow("SELECT base_id,amount,extra_data FROM user_presents WHERE item_id = '" + class2.uint_0 + "' LIMIT 1");
						}
						if (dataRow != null)
						{
							Item class4 = Essential.GetGame().GetItemManager().GetItemById((uint)dataRow["base_id"]);
							if (class4 != null)
							{
								@class.method_29(Session, class2.uint_0, true, true);
                                ServerMessage Message = new ServerMessage(Outgoing.UpdateInventary);
								Message.AppendUInt(class2.uint_0);
								Session.SendMessage(Message);
                                /*ServerMessage Message2 = new ServerMessage(Outgoing.Item2);
								Message2.AppendStringWithBreak(class4.Type.ToString());
								Message2.AppendInt32(class4.Sprite);
								Message2.AppendStringWithBreak(class4.Name);
                                Message2.AppendInt32(class2.uint_0);
                                Message2.AppendString(class2.GetBaseItem().Type.ToString());
                                Message2.AppendBoolean(true);
                                Message2.AppendString(class2.ExtraData);
								Session.SendMessage(Message2);*/
                                ServerMessage Message3 = new ServerMessage(Outgoing.OpenGift);
                                Message3.AppendString(class4.Type.ToString());
                                Message3.AppendInt32(class4.Sprite);
                                Message3.AppendString(class4.Name);
                                Message3.AppendInt32(class2.uint_0);
                                Message3.AppendString(class2.GetBaseItem().Type.ToString());
                                Message3.AppendBoolean(true);
                                Message3.AppendString(class2.ExtraData);
                                Session.SendMessage(Message3);
								using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
								{
									class3.ExecuteQuery("DELETE FROM user_presents WHERE item_id = '" + class2.uint_0 + "' LIMIT 1");
								}
								Essential.GetGame().GetCatalog().AddItemToInventory(Session, class4, (int)dataRow["amount"], (string)dataRow["extra_data"], true, 0u, 0, 0, "");
							}
						}
					}
				}
			}
			catch
			{
			}
		}
        public void Handle(GameClient Session, ClientMessage Event)
        {
            RoomData @class = Essential.GetGame().GetRoomManager().method_12(Session.GetHabbo().uint_2);

            ServerMessage Message = new ServerMessage(Outgoing.InitialRoomInformation); // P
            Message.AppendStringWithBreak(@class.ModelName);
            Message.AppendUInt(@class.Id);
            Session.SendMessage(Message);

        }
		public void Handle(GameClient Session, ClientMessage Event)
		{
			Session.GetHabbo().GetBadgeComponent().ResetBadgeSlots();
			using (DatabaseClient @class = Essential.GetDatabase().GetClient())
			{
				@class.ExecuteQuery("UPDATE user_badges SET badge_slot = '0' WHERE user_id = '" + Session.GetHabbo().Id + "'");
				goto IL_131;
			}
			IL_52:
			int num = Event.PopWiredInt32();
			string text = Event.PopFixedString();
			if (text.Length != 0)
			{
				if (!Session.GetHabbo().GetBadgeComponent().HasBadge(text) || num < 1 || num > 5)
				{
					return;
				}
                if (Session.GetHabbo().CurrentQuestId > 0 && Essential.GetGame().GetQuestManager().GetQuestAction(Session.GetHabbo().CurrentQuestId) == "WEARBADGE")
				{
                    Essential.GetGame().GetQuestManager().ProgressUserQuest(Session.GetHabbo().CurrentQuestId, Session);
				}
				Session.GetHabbo().GetBadgeComponent().GetBadgeByCode(text).Slot = num;
				using (DatabaseClient @class = Essential.GetDatabase().GetClient())
				{
					@class.AddParamWithValue("slotid", num);
					@class.AddParamWithValue("badge", text);
					@class.AddParamWithValue("userid", Session.GetHabbo().Id);
					@class.ExecuteQuery("UPDATE user_badges SET badge_slot = @slotid WHERE badge_id = @badge AND user_id = @userid LIMIT 1");
				}
			}
			IL_131:
			if (Event.RemainingLength > 0)
			{
				goto IL_52;
			}
            ServerMessage Message = new ServerMessage(Outgoing.UpdateBadges); // Updated
			Message.AppendUInt(Session.GetHabbo().Id);
			Message.AppendInt32(Session.GetHabbo().GetBadgeComponent().VisibleBadges);
			foreach (Badge current in Session.GetHabbo().GetBadgeComponent().GetBadges())
			{
				if (current.Slot > 0)
				{
					Message.AppendInt32(current.Slot);
					Message.AppendStringWithBreak(current.Code);
				}
			}
            if (Session.GetHabbo().InRoom && Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId) != null)
			{
				Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(Message, null);
			}
			else
			{
				Session.SendMessage(Message);
			}
		}
		public void Handle(GameClient Session, ClientMessage Event)
		{
			Room @class = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
            if (@class != null && @class.CheckRights(Session, true))
			{
				StringBuilder stringBuilder = new StringBuilder();
				int num = Event.PopWiredInt32();
				for (int i = 0; i < num; i++)
				{
					if (i > 0)
					{
						stringBuilder.Append(" OR ");
					}
					uint num2 = Event.PopWiredUInt();
					@class.UsersWithRights.Remove(num2);
					stringBuilder.Append(string.Concat(new object[]
					{
						"room_id = '",
						@class.Id,
						"' AND user_id = '",
						num2,
						"'"
					}));
					RoomUser class2 = @class.GetRoomUserByHabbo(num2);
					if (class2 != null && !class2.IsBot)
					{
                        ServerMessage Rights = new ServerMessage(Outgoing.QuitRights); // Updated
                        class2.GetClient().SendMessage(Rights);
						class2.RemoveStatus("flatctrl");
						class2.UpdateNeeded = true;
					}
                    ServerMessage Message = new ServerMessage(Outgoing.RemovePowers); // Updated
					Message.AppendUInt(@class.Id);
					Message.AppendUInt(num2);
					Session.SendMessage(Message);
				}
				using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
				{
					class3.ExecuteQuery("DELETE FROM room_rights WHERE " + stringBuilder.ToString());
				}
			}
		}
		public void Handle(GameClient Session, ClientMessage Event)
		{
			Room @class = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
            if (@class != null && @class.CheckRights(Session, true))
			{
				foreach (uint current in @class.UsersWithRights)
				{
					RoomUser class2 = @class.GetRoomUserByHabbo(current);
                    ServerMessage Message = new ServerMessage(Outgoing.RemovePowers); // Updated
					Message.AppendUInt(@class.Id);
					Message.AppendUInt(current);
					Session.SendMessage(Message);
				}
				using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
				{
					class3.ExecuteQuery("DELETE FROM room_rights WHERE room_id = '" + @class.Id + "'");
				}
				@class.UsersWithRights.Clear();
			}
		}
		public void Handle(GameClient Session, ClientMessage Event)
		{
			uint uint_ = Event.PopWiredUInt();
			bool bool_ = Event.PopWiredBoolean();
			bool flag = Event.PopWiredBoolean();

            if (uint_ == Session.GetHabbo().CurrentRoomId)
            {
                return;
            }
           
            RoomData @class = Essential.GetGame().GetRoomManager().method_12(uint_);
			if (@class != null)
			{
                ServerMessage Message = new ServerMessage(Outgoing.GetGuestRoomResult); // Updated
                Message.AppendBoolean(false);
                Message.AppendUInt(@class.Id);
                Message.AppendBoolean(false);
                Message.AppendString(@class.Name);
                Message.AppendBoolean(true);
                Message.AppendInt32(@class.OwnerId);
                Message.AppendStringWithBreak(@class.Owner);
                Message.AppendInt32(@class.State); // @class state
                Message.AppendInt32(@class.UsersNow);
                Message.AppendInt32(@class.UsersMax);
                Message.AppendStringWithBreak(@class.Description);
                Message.AppendInt32(0); // dunno!
                Message.AppendInt32((@class.Category == 9) ? 2 : 0); // can trade!
                Message.AppendInt32(@class.Score);
                Message.AppendInt32(@class.Category);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendStringWithBreak("");
                Message.AppendInt32(@class.TagCount);

                foreach (string Tag in @class.Tags)
                {
                    Message.AppendStringWithBreak(Tag);
                }
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendBoolean(true);
                Message.AppendBoolean(false);
                Message.AppendBoolean(true);
                Message.AppendString("");
                Message.AppendBoolean(false);
				Session.SendMessage(Message);
          
                Session.GetClientMessageHandler().method_5(@class.Id, "");

			}
		}
		public void Handle(GameClient Session, ClientMessage Event)
		{
            ServerMessage Message = new ServerMessage(Outgoing.SoundMachinePlaylist); // Updated
			Message.AppendUInt(Session.GetHabbo().CurrentRoomId);
			Message.AppendInt32(1);
			Message.AppendInt32(1);
			Message.AppendInt32(1);
			Message.AppendStringWithBreak("Meh");
			Message.AppendStringWithBreak("Idk");
			Message.AppendInt32(1);
			Session.SendMessage(Message);
		}
		public void Handle(GameClient Session, ClientMessage Event)
		{
			Dictionary<Room, int> dictionary = Essential.GetGame().GetRoomManager().method_21();
			Room @class = null;
			IEnumerable<Room> arg_35_0 = dictionary.Keys;
			if (FindNewFriendsMessageEvent.func_0 == null)
			{
				FindNewFriendsMessageEvent.func_0 = new Func<Room, int>(FindNewFriendsMessageEvent.smethod_0);
			}
			IOrderedEnumerable<Room> orderedEnumerable = arg_35_0.OrderByDescending(FindNewFriendsMessageEvent.func_0);
			int num = 0;
			foreach (Room current in orderedEnumerable)
			{
				num++;
				string a = Essential.smethod_5(1, 5).ToString();
				if (a == "2")
				{
					goto IL_83;
				}
				if (num == orderedEnumerable.Count<Room>())
				{
					goto IL_83;
				}
				bool arg_A2_0 = true;
				IL_A2:
				if (arg_A2_0)
				{
					continue;
				}
				@class = current;
				break;
				IL_83:
				arg_A2_0 = (Session == null ||Session.GetHabbo() == null || Session.GetHabbo().CurrentRoom == null || Session.GetHabbo().CurrentRoom == current);
				goto IL_A2;
			}
			if (@class == null)
			{
                ServerMessage Message = new ServerMessage(Outgoing.SearchFriendsMessage); // Updated
				Message.AppendBoolean(false);
				Session.SendMessage(Message);
			}
			else
			{
                ServerMessage Message2 = new ServerMessage(Outgoing.RoomForward); // Updated
				Message2.AppendBoolean(@class.IsPublic);
				Message2.AppendUInt(@class.Id);
				Session.SendMessage(Message2);
                ServerMessage Message3 = new ServerMessage(Outgoing.SearchFriendsMessage);
				Message3.AppendBoolean(true);
				Session.SendMessage(Message3);
			}
		}
		public void Handle(GameClient Session, ClientMessage Event)
		{
			//uint num = Event.PopWiredUInt();

            RoomData @class = Essential.GetGame().GetRoomManager().method_12(13);
			if (@class != null)
			{
				if (@class.Type == "private")
				{
                    ServerMessage Message = new ServerMessage(Outgoing.RoomForward); // Updated
					Message.AppendBoolean(@class.IsPublicRoom);
					Message.AppendUInt(13);
					Session.SendMessage(Message);
				}
				else
				{
                    ServerMessage Message2 = new ServerMessage(Outgoing.RoomVisits); // Updated
                    Message2.AppendUInt(@class.Id);
                    Message2.AppendStringWithBreak(@class.CCTs);
                    Message2.AppendUInt(@class.Id);
                    Session.SendMessage(Message2);
				}
			}
		}
		public void Handle(GameClient Session, ClientMessage Event)
		{
			uint num = Event.PopWiredUInt();
            RoomData @class = Essential.GetGame().GetRoomManager().method_12(num);
			if (num == 0u || (@class != null))
			{
				Session.GetHabbo().HomeRoomId = num;
				using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
				{
					class2.ExecuteQuery(string.Concat(new object[]
					{
						"UPDATE users SET home_room = '",
						num,
						"' WHERE Id = '",
						Session.GetHabbo().Id,
						"' LIMIT 1;"
					}));
				}
                ServerMessage Message = new ServerMessage(Outgoing.HomeRoom); // Updated
				Message.AppendUInt(num);
                Message.AppendUInt(0);
				Session.SendMessage(Message);
			}
		}
Example #22
0
		public void Serialize(ServerMessage Message, GameClient Session, bool Single)
		{
			Message.AppendStringWithBreak(this.Type);
			if (Session.GetHabbo().CompletedQuests.Contains(this.Id))
			{
				Message.AppendInt32(this.Level);
			}
			else
			{
				Message.AppendInt32(this.Level - 1);
			}
			Message.AppendInt32(Essential.GetGame().GetQuestManager().GetHighestLevelForType(this.Type));
			if (Essential.GetGame().GetQuestManager().GetHighestLevelForType(this.Type) == this.Level && Session.GetHabbo().CompletedQuests.Contains(this.Id) && !Single)
			{
				Message.AppendInt32(0);
				Message.AppendInt32(0);
                Message.AppendBoolean(false);
				Message.AppendStringWithBreak("");
				Message.AppendStringWithBreak("");
				Message.AppendInt32(0);
				Message.AppendStringWithBreak("");
				Message.AppendInt32(0);
				Message.AppendInt32(0);
				Message.AppendInt32(0);
                Message.AppendStringWithBreak("");
                Message.AppendStringWithBreak("");
                Message.AppendBoolean(true);
			}
			else
			{
                Message.AppendInt32(-1);
                Message.AppendUInt(this.Id);
				//Message.AppendBoolean(false);
			//	Message.AppendUInt(this.Id);
				Message.AppendBoolean(Session.GetHabbo().CurrentQuestId == this.Id);
				Message.AppendStringWithBreak(this.Action.StartsWith("FIND") ? "FIND_STUFF" : this.Action);
				Message.AppendStringWithBreak("_2");
				Message.AppendInt32(this.PixelReward);
				Message.AppendStringWithBreak(this.Action.Replace("_", ""));
				Message.AppendInt32(Session.GetHabbo().CurrentQuestProgress);
				Message.AppendInt32(this.NeedForLevel);
				Message.AppendInt32(Essential.GetGame().GetQuestManager().GetIntValue(this.Type));
                Message.AppendStringWithBreak("set_kuurna");
                Message.AppendStringWithBreak("MAIN_CHAIN");
                Message.AppendBoolean(true);
			}
		}
 public override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
 {
     if (UserHasRights && Session != null)
     {
         Item.CheckExtraData4();
         ServerMessage Message = new ServerMessage(Outgoing.WiredCondition); // Updated
         Message.AppendBoolean(false);
         if (Session.GetHabbo().HasFuse("wired_unlimitedselects"))
             Message.AppendInt32(1000000);
         else
             Message.AppendInt32(5);
         if (Item.string_2 != "")
         {
             Message.AppendInt32(Item.string_2.Split(';').Length);
             string ItemId = "";
             foreach (string condstring in Item.string_2.Split(';'))
             {
                 ItemId = condstring.Split(',')[0];
                 Message.AppendInt32(int.Parse(ItemId));
             }
         }
         else
         {
             Message.AppendInt32(0);
         }
         Message.AppendInt32(Item.GetBaseItem().Sprite);
         Message.AppendUInt(Item.uint_0);
         Message.AppendString("");
         Message.AppendInt32(3);
         if(Item.string_3.Length > 0)
         {
             Message.AppendInt32(Item.string_3[0] == 'I' ? 1 : 0);
             Message.AppendInt32(Item.string_3[1] == 'I' ? 1 : 0);
             Message.AppendInt32(Item.string_3[2] == 'I' ? 1 : 0);
         }else{
             Message.AppendInt32(0);
             Message.AppendInt32(0);
             Message.AppendInt32(0);
         }
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Message.AppendInt32(0);
         Session.SendMessage(Message);
     }
 }
		public void Handle(GameClient Session, ClientMessage Event)
		{
			if (Session.GetHabbo().OwnedRooms.Count <= ServerConfiguration.RoomUserLimit)
			{
				string Name = Essential.FilterString(Event.PopFixedString());
				string Model = Event.PopFixedString();
			//	Event.PopFixedString();
                RoomData NewRoom = Essential.GetGame().GetRoomManager().CreateRoom(Session, Name, Model);
                if (NewRoom != null)
				{
                    ServerMessage Message = new ServerMessage(Outgoing.OnCreateRoomInfo); // Update
                    Message.AppendUInt(NewRoom.Id);
                    Message.AppendStringWithBreak(NewRoom.Name);
					Session.SendMessage(Message);
				}
			}
		}
		public void Handle(GameClient Session, ClientMessage Event)
		{
			Room @class = Essential.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
            if([email protected])
            {
                Session.GetHabbo().Whisper("Loben ist im Raum deaktiviert!");
                return;
            }
			if (@class != null && Session.GetHabbo().RespectPoints > 0)
			{
				RoomUser class2 = @class.GetRoomUserByHabbo(Event.PopWiredUInt());
				if (class2 != null && class2.GetClient().GetHabbo().Id != Session.GetHabbo().Id && !class2.IsBot)
				{
					Session.GetHabbo().RespectPoints--;
					Session.GetHabbo().RespectGiven++;
					class2.GetClient().GetHabbo().Respect++;
					using (DatabaseClient class3 = Essential.GetDatabase().GetClient())
					{
						class3.ExecuteQuery("UPDATE user_stats SET Respect = respect + 1 WHERE Id = '" + class2.GetClient().GetHabbo().Id + "' LIMIT 1");
						class3.ExecuteQuery("UPDATE user_stats SET RespectGiven = RespectGiven + 1 WHERE Id = '" + Session.GetHabbo().Id + "' LIMIT 1");
						class3.ExecuteQuery("UPDATE user_stats SET dailyrespectpoints = dailyrespectpoints - 1 WHERE Id = '" + Session.GetHabbo().Id + "' LIMIT 1");
					}
                    ServerMessage ThumbUp = new ServerMessage(Outgoing.Action); // Updated
                    ThumbUp.AppendInt32(@class.GetRoomUserByHabbo(Session.GetHabbo().Id).VirtualId);
                    ThumbUp.AppendInt32(7);
                    @class.SendMessage(ThumbUp, null);

                    /*ServerMessage ThumbOnHead = new ServerMessage(Outgoing.Action); // Updated
                    ThumbOnHead.AppendInt32(class2.VirtualId);
                    ThumbOnHead.AppendInt32(2);
                    @class.SendMessage(ThumbOnHead, null);*/
                    ServerMessage Message = new ServerMessage(Outgoing.GiveRespect); // Updated
					Message.AppendUInt(class2.GetClient().GetHabbo().Id);
					Message.AppendInt32(class2.GetClient().GetHabbo().Respect);
					@class.SendMessage(Message, null);
                    Session.GetHabbo().CheckRespectGivedAchievements();
                    class2.GetClient().GetHabbo().CheckRespectReceivedAchievements();
                    if (Session.GetHabbo().CurrentQuestId > 0 && Essential.GetGame().GetQuestManager().GetQuestAction(Session.GetHabbo().CurrentQuestId) == "GIVE_RESPECT")
					{
                        Essential.GetGame().GetQuestManager().ProgressUserQuest(Session.GetHabbo().CurrentQuestId, Session);
					}
				}
			}
		}
        public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
        {
            if (bool_0 && Session != null)
            {
                RoomItem_0.CheckExtraData3();
                ServerMessage Message = new ServerMessage(Outgoing.WiredCondition); // Updated
                Message.AppendBoolean(false);
                if (Session.GetHabbo().HasFuse("wired_unlimitedselects"))
                    Message.AppendInt32(1000000);
                else
                    Message.AppendInt32(5);
                if (RoomItem_0.string_3 != "")
                {
                    Message.AppendInt32(RoomItem_0.string_3.Split(',').Length);

                    foreach (string ItemId in RoomItem_0.string_3.Split(','))
                    {
                        Message.AppendInt32(int.Parse(ItemId));
                    }
                }
                else
                {
                    Message.AppendInt32(0);
                }
                Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite);
                Message.AppendUInt(RoomItem_0.uint_0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(1);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                /*Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendBoolean(false);
                Message.AppendBoolean(true);*/
                Session.SendMessage(Message);
            }
        }
Example #27
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int GuildId = Event.PopWiredInt32();

            GroupsManager Guild = Groups.GetGroupById(GuildId);

            if (Guild == null)
            {
                return;
            }

            ServerMessage Message = new ServerMessage(Outgoing.Guild); // Updated
            Message.AppendInt32(Guild.Id);
            Message.AppendString(Guild.Name);
            Message.AppendUInt(Guild.RoomId);
            Message.AppendString(Guild.Badge);
            Message.AppendInt32(Guild.Members.Count);
            Message.AppendInt32((Guild.Members.Count > 13) ? 14 : Guild.Members.Count);
            foreach (int UserId in Guild.Members)
            {
                using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
            {
                dbClient.AddParamWithValue("uid", UserId);
                DataRow UserData = dbClient.ReadDataRow("SELECT username,look FROM users WHERE Id = @uid LIMIT 1");
                if (Guild.OwnerId != UserId)
                    Message.AppendInt32(0);
                else
                    Message.AppendInt32(2);
                Message.AppendInt32(UserId);
                Message.AppendString((string)UserData["username"]);
                Message.AppendString((string)UserData["look"]);
                Message.AppendString("");

                }
            }
            Message.AppendBoolean(false);
            Message.AppendInt32(14);
            Message.AppendInt32(0);
            Message.AppendInt32(0);
            Message.AppendString("");
            Session.SendMessage(Message);
        }
		public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
		{
			if (bool_0 && Session != null)
			{
				RoomItem_0.CheckExtraData3();
				ServerMessage Message = new ServerMessage(Outgoing.WiredEffect); // Update
                Message.AppendBoolean(false);
                if (Session.GetHabbo().HasFuse("wired_unlimitedselects"))
                {
                    Message.AppendInt32(1000000);
                }
                else
                {
                    Message.AppendInt32(5);
                }
                if (RoomItem_0.string_3 != "")
                {
                    Message.AppendInt32(RoomItem_0.string_3.Split(',').Length);
                    foreach (string ItemId in RoomItem_0.string_3.Split(','))
                    {
                        Message.AppendInt32(int.Parse(ItemId));
                    }
                }
                else
                {
                    Message.AppendInt32(0);
                }
				Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite);
				Message.AppendUInt(RoomItem_0.uint_0);
				Message.AppendStringWithBreak("");
				Message.AppendInt32(0);
				Message.AppendInt32(8);
				Message.AppendInt32(0);
                double value = 0;
                if (RoomItem_0.string_2 != "" && double.TryParse(RoomItem_0.string_2, out value))
                    Message.AppendInt32(Convert.ToInt32(value * 2));
                else
                    Message.AppendInt32(0);
				Message.AppendInt32(0);
				Session.SendMessage(Message);
			}
		}
		public void Handle(GameClient Session, ClientMessage Event)
		{
			uint num = Event.PopWiredUInt();
			Session.GetHabbo().list_1.Remove(num);
            ServerMessage Message = new ServerMessage(Outgoing.FavsUpdate);
			Message.AppendUInt(num);
			Message.AppendBoolean(false);
			Session.SendMessage(Message);
			using (DatabaseClient @class = Essential.GetDatabase().GetClient())
			{
				@class.ExecuteQuery(string.Concat(new object[]
				{
					"DELETE FROM user_favorites WHERE user_id = '",
					Session.GetHabbo().Id,
					"' AND room_id = '",
					num,
					"' LIMIT 1"
				}));
			}
		}
		public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
		{
			if (bool_0)
			{
                ServerMessage Message = new ServerMessage(Outgoing.WiredFurniTrigger); // Updated
                Message.AppendBoolean(false);
				Message.AppendInt32(0);
				Message.AppendInt32(0);
				Message.AppendInt32(RoomItem_0.GetBaseItem().Sprite);
				Message.AppendUInt(RoomItem_0.uint_0);
				Message.AppendStringWithBreak(RoomItem_0.string_2);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(7);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
				Session.SendMessage(Message);
			}
		}