diff --git a/Facepunch.Steamworks/Client/Friends.cs b/Facepunch.Steamworks/Client/Friends.cs index 82354f2..d579837 100644 --- a/Facepunch.Steamworks/Client/Friends.cs +++ b/Facepunch.Steamworks/Client/Friends.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using SteamNative; namespace Facepunch.Steamworks { @@ -32,12 +33,12 @@ namespace Facepunch.Steamworks /// /// Return true if blocked /// - public bool IsBlocked { get; internal set; } + public bool IsBlocked => relationship == FriendRelationship.Blocked; /// /// Return true if is a friend. Returns false if blocked, request etc. /// - public bool IsFriend { get; internal set; } + public bool IsFriend => relationship == FriendRelationship.Friend; /// /// Their current display name @@ -47,17 +48,32 @@ namespace Facepunch.Steamworks /// /// Returns true if this friend is online /// - public bool IsOnline { get; internal set; } + public bool IsOnline => personaState != PersonaState.Offline; + + /// + /// Returns true if this friend is marked as away + /// + public bool IsAway => personaState == PersonaState.Away; + + /// + /// Returns true if this friend is marked as busy + /// + public bool IsBusy => personaState == PersonaState.Busy; + + /// + /// Returns true if this friend is marked as snoozing + /// + public bool IsSnoozing => personaState == PersonaState.Snooze; /// /// Returns true if this friend is online and playing this game /// - public bool IsPlayingThisGame { get { return CurrentAppId == Client.AppId; } } + public bool IsPlayingThisGame => CurrentAppId == Client.AppId; /// /// Returns true if this friend is online and playing this game /// - public bool IsPlaying { get { return CurrentAppId != 0; } } + public bool IsPlaying => CurrentAppId != 0; /// /// The AppId this guy is playing @@ -70,6 +86,8 @@ namespace Facepunch.Steamworks public ulong ServerLobbyId { get; internal set; } internal Client Client { get; set; } + private PersonaState personaState; + private FriendRelationship relationship; /// /// Returns null if the value doesn't exist @@ -88,10 +106,8 @@ namespace Facepunch.Steamworks { Name = Client.native.friends.GetFriendPersonaName( Id ); - SteamNative.FriendRelationship relationship = (SteamNative.FriendRelationship) Client.native.friends.GetFriendRelationship( Id ); - - IsBlocked = relationship == SteamNative.FriendRelationship.Blocked; - IsFriend = relationship == SteamNative.FriendRelationship.Friend; + relationship = Client.native.friends.GetFriendRelationship( Id ); + personaState = Client.native.friends.GetFriendPersonaState( Id ); CurrentAppId = 0; ServerIp = 0;