Example #1
0
		internal TeleUserData(GameClientMessageHandler pHandler, Habbo pUserRefference, uint RoomId, uint TeleId)
		{
			this.mHandler = pHandler;
			this.mUserRefference = pUserRefference;
			this.RoomId = RoomId;
			this.TeleId = TeleId;
		}
Example #2
0
		internal void Stop()
		{
			if (this.GetMessageHandler() != null)
			{
				this.MessageHandler.Destroy();
			}
			if (this.GetHabbo() != null)
			{
				this.Habbo.OnDisconnect();
			}
			this.CurrentRoomUserID = -1;
			this.MessageHandler = null;
			this.Habbo = null;
			this.Connection = null;
		}
Example #3
0
		internal bool tryLogin(string AuthTicket)
		{
			try
			{
				string ip = this.GetConnection().getIp();
				byte b = 0;
				UserData userData = UserDataFactory.GetUserData(AuthTicket, ip, out b);
				bool result;
				if (b == 1)
				{
					result = false;
					return result;
				}
				if (b == 2)
				{
					result = false;
					return result;
				}
				CyberEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
				this.Habbo = userData.user;
				userData.user.LoadData(userData);
				string banReason = CyberEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip, this.MachineId);
				if (!string.IsNullOrEmpty(banReason) || userData.user.Username == null)
				{
					this.SendNotifWithScroll(banReason);
					using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
					{
						queryreactor.setQuery("SELECT ip_last FROM users WHERE id=" + this.GetHabbo().Id + " LIMIT 1");
						string @string = queryreactor.getString();
						queryreactor.setQuery("SELECT COUNT(0) FROM bans_access WHERE user_id=" + this.Habbo.Id + " LIMIT 1");
						int integer = queryreactor.getInteger();
						if (integer > 0)
						{
							queryreactor.runFastQuery(string.Concat(new object[]
							{
								"UPDATE bans_access SET attempts = attempts + 1, ip='",
								@string,
								"' WHERE user_id=",
								this.GetHabbo().Id,
								" LIMIT 1"
							}));
						}
						else
						{
							queryreactor.runFastQuery(string.Concat(new object[]
							{
								"INSERT INTO bans_access (user_id, ip) VALUES (",
								this.GetHabbo().Id,
								", '",
								@string,
								"')"
							}));
						}
					}
					result = false;
					return result;
				}
				userData.user.Init(this, userData);
				QueuedServerMessage queuedServerMessage = new QueuedServerMessage(this.Connection);
				ServerMessage serverMessage = new ServerMessage(Outgoing.UniqueMachineIDMessageComposer);
				serverMessage.AppendString(this.MachineId);
				queuedServerMessage.appendResponse(serverMessage);
				queuedServerMessage.appendResponse(new ServerMessage(Outgoing.AuthenticationOKMessageComposer));
				if (this.Habbo != null)
				{
					ServerMessage serverMessage2 = new ServerMessage(Outgoing.HomeRoomMessageComposer);
					serverMessage2.AppendUInt(this.Habbo.HomeRoom);
					serverMessage2.AppendUInt(this.Habbo.HomeRoom);
					queuedServerMessage.appendResponse(serverMessage2);
				}
				ServerMessage serverMessage3 = new ServerMessage(Outgoing.MinimailCountMessageComposer);
				serverMessage3.AppendInt32(this.Habbo.MinimailUnreadMessages);
				queuedServerMessage.appendResponse(serverMessage3);

				ServerMessage serverMessage4 = new ServerMessage(Outgoing.FavouriteRoomsMessageComposer);
				serverMessage4.AppendInt32(30);
				serverMessage4.AppendInt32(userData.user.FavoriteRooms.Count);
				object[] array = userData.user.FavoriteRooms.ToArray();
				for (int i = 0; i < array.Length; i++)
				{
					uint i2 = (uint)array[i];
					serverMessage4.AppendUInt(i2);
				}
				queuedServerMessage.appendResponse(serverMessage4);
				

                ServerMessage rightsMessage = new ServerMessage(Outgoing.UserClubRightsMessageComposer);
                rightsMessage.AppendInt32(userData.user.GetSubscriptionManager().HasSubscription ? 2 : 0);
                rightsMessage.AppendUInt(userData.user.Rank);
                rightsMessage.AppendInt32(0);


                queuedServerMessage.appendResponse(rightsMessage);
				ServerMessage serverMessage5 = new ServerMessage(Outgoing.EnableNotificationsMessageComposer);
				serverMessage5.AppendBoolean(true);
				serverMessage5.AppendBoolean(false);
				queuedServerMessage.appendResponse(serverMessage5);
				ServerMessage serverMessage6 = new ServerMessage(Outgoing.EnableTradingMessageComposer);
				serverMessage6.AppendBoolean(true);
				queuedServerMessage.appendResponse(serverMessage6);
				userData.user.UpdateCreditsBalance();
				ServerMessage serverMessage7 = new ServerMessage(Outgoing.ActivityPointsMessageComposer);
				serverMessage7.AppendInt32(2);
				serverMessage7.AppendInt32(0);
				serverMessage7.AppendInt32(userData.user.ActivityPoints);
				serverMessage7.AppendInt32(5);
				serverMessage7.AppendInt32(userData.user.BelCredits);
				queuedServerMessage.appendResponse(serverMessage7);
				if (userData.user.HasFuse("fuse_mod"))
				{
					queuedServerMessage.appendResponse(CyberEnvironment.GetGame().GetModerationTool().SerializeTool());
				}
				if (!string.IsNullOrWhiteSpace(CyberEnvironment.GetDBConfig().DBData["welcome_message"]))
				{
					this.SendBroadcastMessage(CyberEnvironment.GetDBConfig().DBData["welcome_message"]);
				}

                ServerMessage AchievementData = new ServerMessage(Outgoing.SendAchievementsRequirementsMessageComposer);

                AchievementData.AppendInt32(CyberEnvironment.GetGame().GetAchievementManager().Achievements.Count);
                foreach (Achievement Ach in CyberEnvironment.GetGame().GetAchievementManager().Achievements.Values)
                {
                    AchievementData.AppendString(Ach.GroupName.Replace("ACH_", ""));
                    AchievementData.AppendInt32(Ach.Levels.Count);

                    for (int i = 1; i < Ach.Levels.Count + 1; i++)
                    {
                        AchievementData.AppendInt32(i);
                        AchievementData.AppendInt32(Ach.Levels[i].Requirement);
                    }
                }
                AchievementData.AppendInt32(0);
                queuedServerMessage.appendResponse(AchievementData);

                if (!GetHabbo().NUXPassed && ExtraSettings.NEW_USER_GIFTS_ENABLED)
                {
                    queuedServerMessage.appendResponse(new ServerMessage(Outgoing.NuxSuggestFreeGiftsMessageComposer));
                }

                queuedServerMessage.appendResponse(this.GetHabbo().GetAvatarEffectsInventoryComponent().GetPacket());

				queuedServerMessage.sendResponse();
				result = true;
				return result;
			}
			catch (Exception ex)
			{
				Logging.LogCriticalException("Bug during user login: " + ex.Message);
			}
			return false;
		}