void OnCommunityLoaded(SK.SteamFriends.FriendsListCallback callback) { foreach (SteamFriend friend in callback.FriendList) { SteamUser friendUser = new SteamUser { AvatarHash = community.GetFriendAvatar(friend.SteamID), SteamId = new SteamUserId(friend.SteamID), Name = community.GetFriendPersonaName(friend.SteamID), IsOnline = community.GetFriendPersonaState(friend.SteamID) != 0, IsScammer = GetScammerStatus(friend.SteamID.ToString()) }; if (friendUser.Name == "[unknown]") { continue; } Friends.Add(friendUser); if (friend.Relationship == SK.EFriendRelationship.RequestRecipient) { Console.WriteLine($"Pending friend request: {friendUser.Name}"); } } int onlineFriendsCount = Friends.Count(f => f.IsOnline); CommunityLoaded?.Invoke(this, null); }
private Dish ComposeDish(bool type) { string name = Input.ReadString("Input name of dish"); int cost = Input.ReadInt("Input cost", min: 0, max: Int32.MaxValue); Total_cost = Total_cost + cost; if (type) { cost = cost / Friends.Count(); } return(new Dish(name, cost, type)); }
private void XmppOnOnRosterItem(object sender, RosterItem item) { //Friends.Add(item.); switch (item.Subscription) { case SubscriptionType.none: if (item.Jid.Server == "conference." + Host) { Chatting.GetRoom(new NewUser(item.Jid), true); } break; case SubscriptionType.to: if (item.Jid.User == Me.User.User) { break; } if (Friends.Count(x => x.User.User == item.Jid.User) == 0) { Friends.Add(new NewUser(item.Jid)); } break; case SubscriptionType.from: if (item.Jid.User == Me.User.User) { break; } if (Friends.Count(x => x.User.User == item.Jid.User) == 0) { Friends.Add(new NewUser(item.Jid)); } break; case SubscriptionType.both: if (item.Jid.User == Me.User.User) { break; } if (Friends.Count(x => x.User.User == item.Jid.User) == 0) { Friends.Add(new NewUser(item.Jid)); } break; case SubscriptionType.remove: if (Friends.Contains(new NewUser(item.Jid))) { Friends.Remove(new NewUser(item.Jid)); } break; } }
public override OutgoingMessage Send(IMessageable target) { if (InternalOutgoingMessage.ID == 0) { InternalOutgoingMessage.Initialize(12) .AppendInt32(UnknownA) .AppendInt32(UnknownB) .AppendInt32(UnknownC) .AppendInt32(Categories.Count() - 1); // -1 because the default category doesn't count foreach (Category category in Categories.Where(category => category.ID != 0)) { InternalOutgoingMessage .AppendInt32(category.ID) .AppendString(category.Name); } InternalOutgoingMessage .AppendInt32(Friends.Count()); foreach (Friend friend in Friends) { foreach (Category category in friend.GetCategories()) { InternalOutgoingMessage .AppendInt32(friend.Befriendable.GetID()) .AppendString(friend.Befriendable.GetDisplayName()) .AppendBoolean(true) // TODO: Find out what this does. .AppendBoolean(friend.Befriendable.IsLoggedIn()) .AppendBoolean(friend.Befriendable.IsStalkable()) .AppendString(friend.Befriendable.GetFigure().ToString()) .AppendInt32(category.ID) .AppendString(friend.Befriendable.GetMotto()) .AppendString(friend.Befriendable.GetLastAccess().ToString()); } } InternalOutgoingMessage .AppendInt32(MaximumFriends) .AppendBoolean(false); // TODO: Find out what this does. } target.SendMessage(InternalOutgoingMessage); return(this); }
public bool HasFriend(int userId) => Friends.Count(friend => friend.PlayerData.Id == userId) > 0;