public void OnNewFriendship(int friendID) { GameClient friend = BiosEmuThiago.GetGame().GetClientManager().GetClientByUserID(friendID); MessengerBuddy newFriend; if (friend == null || friend.GetHabbo() == null) { DataRow dRow; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT id,username,motto,look,last_online,hide_inroom,hide_online FROM users WHERE `id` = @friendid LIMIT 1"); dbClient.AddParameter("friendid", friendID); dRow = dbClient.getRow(); } newFriend = new MessengerBuddy(friendID, Convert.ToString(dRow["username"]), Convert.ToString(dRow["look"]), Convert.ToString(dRow["motto"]), Convert.ToInt32(dRow["last_online"]), BiosEmuThiago.EnumToBool(dRow["hide_online"].ToString()), BiosEmuThiago.EnumToBool(dRow["hide_inroom"].ToString())); } else { Habbo user = friend.GetHabbo(); newFriend = new MessengerBuddy(friendID, user.Username, user.Look, user.Motto, 0, user.AppearOffline, user.AllowPublicRoomStatus); newFriend.UpdateUser(friend); } if (!_friends.ContainsKey(friendID)) { _friends.Add(friendID, newFriend); } GetClient().SendMessage(SerializeUpdate(newFriend)); }
public ServerPacket SerializeUpdate(MessengerBuddy friend) { ServerPacket Packet = new ServerPacket(ServerPacketHeader.FriendListUpdateMessageComposer); Packet.WriteInteger(1); // category count Packet.WriteInteger(1); Packet.WriteString("Grupos"); Packet.WriteInteger(1); // number of updates Packet.WriteInteger(0); // don't know friend.Serialize(Packet, GetClient()); return(Packet); }
public bool TryGetFriend(int UserId, out MessengerBuddy Buddy) { return(this._friends.TryGetValue(UserId, out Buddy)); }