Beispiel #1
0
		public void InitMessenger()
		{
			if (GetMessenger() == null)
			{
				this.Messenger = new HabboMessenger(Id);
				this.Messenger.LoadBuddies(HabboData);
				this.Messenger.method_1(HabboData);

				GameClient client = GetClient();
				if (client != null)
				{
					client.SendMessage(this.Messenger.SerializeFriends());
					client.SendMessage(this.Messenger.SerializeRequests());
					this.Messenger.OnStatusChanged(true);
				}
			}
		}
Beispiel #2
0
		public void OnDisconnect()
		{
			if (!this.Disconnected)
			{
				this.Disconnected = true;
				PhoenixEnvironment.GetGame().GetClientManager().NullClientShit(this.Id, this.Username);
				if (!this.HabboInfoSaved)
				{
					this.HabboInfoSaved = true;
					using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
					{
						adapter.ExecuteQuery(string.Concat(new object[]
						{
							"UPDATE users SET last_online = UNIX_TIMESTAMP(), users.online = '0', activity_points = '",
							this.ActivityPoints,
							"', activity_points_lastupdate = '",
							this.LastActivityPointsUpdate,
							"', credits = '",
							this.Credits,
							"' WHERE Id = '",
							this.Id,
							"' LIMIT 1;"
						}));
						int num = (int)PhoenixEnvironment.GetUnixTimestamp() - this.Stat_LoginTime;
						adapter.ExecuteQuery(string.Concat(new object[]
						{
							"UPDATE user_stats SET RoomVisits = '",
							this.RoomVisits,
							"', OnlineTime = OnlineTime + ",
							num,
							", Respect = '",
							this.Respect,
							"', RespectGiven = '",
							this.RespectGiven,
							"', GiftsGiven = '",
							this.GiftsGiven,
							"', GiftsReceived = '",
							this.GiftsReceived,
							"' WHERE Id = '",
							this.Id,
							"' LIMIT 1; "
						}));
					}
				}
				if (this.InRoom && this.CurrentRoom != null)
				{
					this.CurrentRoom.RemoveUserFromRoom(this.Session, false, false);
				}
				if (this.Messenger != null)
				{
					this.Messenger.AppearOffline = true;
					this.Messenger.OnStatusChanged(true);
					this.Messenger = null;
				}
				if (this.SubscriptionManager != null)
				{
					this.SubscriptionManager.Clear();
					this.SubscriptionManager = null;
				}
				this.InventoryComponent.RunDBUpdate();
			}
		}