Fix sh_stats.gnut

We can now enter the lobby!
This commit is contained in:
okvdai
2023-04-19 18:22:56 +02:00
parent d20ec3a1ac
commit 9d5c9956ad
3 changed files with 4 additions and 10 deletions
-5
View File
@@ -11,10 +11,5 @@
"After": "GetStatsFromToneAPI" "After": "GetStatsFromToneAPI"
} }
} }
],
"ConVars": [
{
"ToneURL": "https://tone.sleepycat.date/v1"
}
] ]
} }
+1 -2
View File
@@ -6,7 +6,7 @@ void function GetStatsFromToneAPI()
{ {
HttpRequest getStats HttpRequest getStats
getStats.method = HttpRequestMethod.GET getStats.method = HttpRequestMethod.GET
getStats.url = GetConVarString("ToneURL") + "/client/weapons" getStats.url = "https://tone.sleepycat.date/v1/client/weapons"
getStats.queryParameters["player"] <- [NSGetLocalPlayerUID().tostring()] getStats.queryParameters["player"] <- [NSGetLocalPlayerUID().tostring()]
void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response)
{ {
@@ -16,5 +16,4 @@ void function GetStatsFromToneAPI()
} }
} }
bool result = NSHttpRequest(getStats, onSuccess) bool result = NSHttpRequest(getStats, onSuccess)
return result
} }
+3 -3
View File
@@ -458,9 +458,9 @@ int function GetPlayerStatInt( entity player, string category, string alias, str
{ {
Assert( IsUI() || IsValid( player ) ) Assert( IsUI() || IsValid( player ) )
string statString = GetStatVar( category, alias, subAlias ) string statString = GetStatVar( category, alias, subAlias )
foreach (string key, int value in globalToneAPIKillData) { foreach (string key, int value in globalToneAPIKillData) {
if(statString == "weaponKillStats[" + key + "].total") return value if(statString == "weaponKillStats[mp_weapon" + key + "].total") return value
} }
return player.GetPersistentVarAsInt( statString ) return player.GetPersistentVarAsInt( statString )
} }