Initial commit
Commit pulse.gnut for fixing.
This commit is contained in:
@@ -2,5 +2,19 @@
|
|||||||
"Name": "ToneAPI.pulse",
|
"Name": "ToneAPI.pulse",
|
||||||
"Description": "placeholder text",
|
"Description": "placeholder text",
|
||||||
"Version": "0.0.1",
|
"Version": "0.0.1",
|
||||||
"LoadPriority": 2
|
"LoadPriority": 1,
|
||||||
|
"Scripts": [
|
||||||
|
{
|
||||||
|
"Path": "pulse.gnut",
|
||||||
|
"RunOn": "CLIENT",
|
||||||
|
"ClientCallback": {
|
||||||
|
"After": "GetStatsFromToneAPI"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ConVars": [
|
||||||
|
{
|
||||||
|
"ToneURL": "https://tone.sleepycat.date/v1"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
global function GetStatsFromToneAPI
|
||||||
|
|
||||||
|
table JSONForConversion = {}
|
||||||
|
|
||||||
|
void function GetStatsFromToneAPI()
|
||||||
|
{
|
||||||
|
HttpRequest getStats
|
||||||
|
getStats.method = HttpRequestMethod.GET
|
||||||
|
getStats.url = GetConVarString("ToneURL") + "/client/weapons"
|
||||||
|
getStats.queryParameters["player"] <- [NSGetLocalPlayerUID().tostring()]
|
||||||
|
void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response)
|
||||||
|
{
|
||||||
|
JSONForConversion = DecodeJSON(response.body)
|
||||||
|
foreach (key, value in JSONForConversion) {
|
||||||
|
globalToneAPIKillData[string(key)] <- int(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool result = NSHttpRequest(getStats, onSuccess)
|
||||||
|
return result
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ global function GetStatVarType
|
|||||||
global function GetStatVarLocalizedUnlock
|
global function GetStatVarLocalizedUnlock
|
||||||
global function Stats_GetFixedSaveVar
|
global function Stats_GetFixedSaveVar
|
||||||
global function FD_GetHighestDifficultyForTitan
|
global function FD_GetHighestDifficultyForTitan
|
||||||
|
global table <string, int> globalToneAPIKillData = {}
|
||||||
|
|
||||||
/*void function AddItemsToStatsList( array<string> refs )
|
/*void function AddItemsToStatsList( array<string> refs )
|
||||||
{
|
{
|
||||||
@@ -456,8 +457,10 @@ string function GetStatVarLocalizedUnlock( string category, string alias, string
|
|||||||
int function GetPlayerStatInt( entity player, string category, string alias, string subAlias = "" )
|
int function GetPlayerStatInt( entity player, string category, string alias, string subAlias = "" )
|
||||||
{
|
{
|
||||||
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) {
|
||||||
|
if(statString == "weaponKillStats[" + key + "].total") return value
|
||||||
|
}
|
||||||
return player.GetPersistentVarAsInt( statString )
|
return player.GetPersistentVarAsInt( statString )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user