Beispiel #1
0
		internal ServerMessage SerializeUpdate(MessengerBuddy friend)
		{
			ServerMessage serverMessage = new ServerMessage(Outgoing.FriendUpdateMessageComposer);
			serverMessage.AppendInt32(0);
			serverMessage.AppendInt32(1);
			serverMessage.AppendInt32(0);
			friend.Serialize(serverMessage, this.GetClient());
			serverMessage.AppendBoolean(false);
			return serverMessage;
		}
Beispiel #2
0
		internal void OnNewFriendship(uint friendID)
		{
			GameClient clientByUserID = MercuryEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID);
			MessengerBuddy messengerBuddy;
			if (clientByUserID == null || clientByUserID.GetHabbo() == null)
			{
				DataRow row;
				using (IQueryAdapter queryreactor = MercuryEnvironment.GetDatabaseManager().getQueryreactor())
				{
					queryreactor.setQuery("SELECT id,username,motto,look,last_online,hide_inroom,hide_online FROM users WHERE id = " + friendID);
					row = queryreactor.getRow();
				}
				messengerBuddy = new MessengerBuddy(friendID, (string)row["username"], (string)row["look"], (string)row["motto"], (int)row["last_online"], MercuryEnvironment.EnumToBool(row["hide_online"].ToString()), MercuryEnvironment.EnumToBool(row["hide_inroom"].ToString()));
			}
			else
			{
				Habbo habbo = clientByUserID.GetHabbo();
				messengerBuddy = new MessengerBuddy(friendID, habbo.Username, habbo.Look, habbo.Motto, 0, habbo.AppearOffline, habbo.HideInRoom);
				messengerBuddy.UpdateUser(clientByUserID);
			}
			if (!this.friends.ContainsKey(friendID))
			{
				this.friends.Add(friendID, messengerBuddy);
			}
			this.GetClient().SendMessage(this.SerializeUpdate(messengerBuddy));
		}