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; }
internal void OnNewFriendship(uint friendID) { GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(friendID); MessengerBuddy messengerBuddy; if (clientByUserID == null || clientByUserID.GetHabbo() == null) { DataRow row; using (IQueryAdapter queryreactor = CyberEnvironment.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"], CyberEnvironment.EnumToBool(row["hide_online"].ToString()), CyberEnvironment.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)); }