using Steamworks; namespace Sandbox; public partial struct Friend : IEquatable { internal Steamworks.Friend Internal; internal Friend( Steamworks.Friend value ) { Internal = value; } internal Friend( Steamworks.SteamId value ) { Internal = new Steamworks.Friend( value ); } public Friend( ulong steamid ) { Internal = new Steamworks.Friend( steamid ); } public Friend( long steamid ) { Internal = new Steamworks.Friend( (ulong)steamid ); } public override string ToString() => Name; /// /// Returns true if this friend is the local user /// public readonly bool IsMe => Internal.IsMe; /// /// The friend's Steam Id /// public readonly ulong Id => Internal.Id.Value; /// /// The friend's name /// public readonly string Name => Internal.Name; /// /// Returns true if your friend is online /// public readonly bool IsOnline => Internal.IsOnline; /// /// Returns true if this user is your friend /// public readonly bool IsFriend => Internal.IsFriend; /// /// Returns true if your friend is away /// public readonly bool IsAway => Internal.IsAway; /// /// Returns true if this friend is marked as busy /// public readonly bool IsBusy => Internal.IsBusy; /// /// Returns true if this friend is marked as snoozing /// public readonly bool IsSnoozing => Internal.IsSnoozing; /// /// Returns a string that was possibly set by rich presence /// public readonly string GetRichPresence( string key ) => Internal.GetRichPresence( key ); /// /// Returns true if they're playing this game /// public readonly bool IsPlayingThisGame => (Internal.GameInfo?.GameId ?? 0) == Application.AppId; /// /// Returns true if they're playing any game /// public readonly bool IsPlayingAGame => (Internal.GameInfo?.GameId ?? 0) != 0; /// /// Opens the Steam overlay web browser to their user profile. /// public void OpenInOverlay() { Internal.OpenInOverlay( "steamid" ); } /// /// Opens the Steam overlay with a popup that allows the local Steam user to confirm whether to add this user to their Steam friends list. /// public void OpenAddFriendOverlay() { SteamFriends.OpenUserOverlay( Internal.Id, "friendadd" ); } public override bool Equals( object obj ) => obj is Friend friend && Equals( friend ); public bool Equals( Friend other ) => Id == other.Id; public override int GetHashCode() => HashCode.Combine( Id ); public static bool operator ==( Friend friend1, Friend friend2 ) => friend1.Id == friend2.Id; public static bool operator !=( Friend friend1, Friend friend2 ) => friend1.Id != friend2.Id; }