From 7c20b57957a5e5aabb0495c349f20cf6bfa55897 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Mon, 24 Feb 2020 12:00:26 +0000 Subject: [PATCH] Added Friend.GetStatFloat --- Facepunch.Steamworks/Structs/Friend.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Facepunch.Steamworks/Structs/Friend.cs b/Facepunch.Steamworks/Structs/Friend.cs index f1b1a4c..cd3def7 100644 --- a/Facepunch.Steamworks/Structs/Friend.cs +++ b/Facepunch.Steamworks/Structs/Friend.cs @@ -195,5 +195,21 @@ namespace Steamworks return result.HasValue && result.Value.Result == Result.OK; } + /// + /// Gets a user stat. Must call RequestUserStats first. + /// + /// The name of the stat you want to get + /// Will return this value if not available + /// The value, or defult if not available + public float GetStatFloat( string statName, float defult = 0 ) + { + var val = defult; + + if ( !SteamUserStats.Internal.GetUserStat( Id, statName, ref val ) ) + return defult; + + return val; + } + } } \ No newline at end of file