##Close
foreach (Client.GameState aFriend in Kernel.GamePool.Values)
{
Console.WriteLine(client.Entity.UID + " " + client.Entity.Name + " <- Clients Info .. Friends info - > " + aFriend.Entity.UID + " " + aFriend.Entity.Name);
if (client.Entity.Friends.ContainsKey(afriend.Entity.UID))
{
Console.WriteLine("Has Friend Online");
}
}
Quote:
huh ? and no cant check the client u need to check every person in the game that has the client (wich is the one login in ) as a friend,
But anyways, tnx guys i got it
LoadFriends(caller);
caller.FriendManagement.SendCollection(caller);
Class:
public Friends
{
private Dictionary<uint, FriendPacket> friendsCollection;
public Friends()
{
friendsCollection = new Dictionary<uint, FriendPacket>();
}
public void Insert(uint friendID, FriendPacket friend)
{
if (!friendsCollection.Containskey(friendID))
friendsCollection.Add(friendID, friend);
else
friendsCollection[friendID] = friend;
}
public void Remove(uint friendID)
{
if (friendsCollection.Containskey(friendID))
friendsCollection.Remove(friendID);
}
public void SendCollection(ConquerClient caller)
{
foreach (KeyValuePair<uint, FriendPacket> entry in Collection)
{
entry.Value.Online = Kernel.GamePool.Containskey(entry.Key);
caller.WinsockClient.Send(&entry.Value, Marshal.SizeOf(entry.Value));
if (entry.Value.Online)
caller.WinsockClient[entry.Key].Send(&caller.FriendPacket, Marshal.SizeOf(caller.FriendPacket));
}
}
}