fix map data gamemode
This commit is contained in:
@@ -17,7 +17,7 @@ global table globalToneAPIMapDeathData = {}
|
|||||||
global table globalToneAPIMapDistData = {}
|
global table globalToneAPIMapDistData = {}
|
||||||
global table globalToneAPIMapKillData = {}
|
global table globalToneAPIMapKillData = {}
|
||||||
global table globalToneAPIMapMDistData = {}
|
global table globalToneAPIMapMDistData = {}
|
||||||
global table globalToneAPIGamemodeData = {}
|
global table< table > globalToneAPIGamemodeMapData = {}
|
||||||
|
|
||||||
string prefix = "default"
|
string prefix = "default"
|
||||||
string HTTPrequestURL = "default"
|
string HTTPrequestURL = "default"
|
||||||
@@ -103,14 +103,18 @@ void function getGamemodeStatsFromToneAPI(string mapName)
|
|||||||
getMapGamemodeStats.url = HTTPrequestURL + "/gamemodes"
|
getMapGamemodeStats.url = HTTPrequestURL + "/gamemodes"
|
||||||
getMapGamemodeStats.queryParameters["map"] <- [mapNameSliced]
|
getMapGamemodeStats.queryParameters["map"] <- [mapNameSliced]
|
||||||
getMapGamemodeStats.queryParameters["player"] <- [NSGetLocalPlayerUID()]
|
getMapGamemodeStats.queryParameters["player"] <- [NSGetLocalPlayerUID()]
|
||||||
void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response)
|
void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response):(mapName)
|
||||||
{
|
{
|
||||||
table JSONForConversion = DecodeJSON(response.body)
|
table JSONForConversion = DecodeJSON(response.body)
|
||||||
foreach (var key, var value in JSONForConversion) {
|
table mapData = {}
|
||||||
|
foreach (var gamemode, var value in JSONForConversion) {
|
||||||
table test = expect table(value)
|
table test = expect table(value)
|
||||||
globalToneAPIGamemodeData[string(key)] <- test.kills
|
mapData[string(gamemode)] <- test.kills
|
||||||
mapGamemodeEntries += 1
|
mapGamemodeEntries += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalToneAPIGamemodeMapData[mapName] <- mapData
|
||||||
|
|
||||||
print(prefix + "Map gamemode data has been processed with a total of " + string(mapGamemodeEntries) + " entries.")
|
print(prefix + "Map gamemode data has been processed with a total of " + string(mapGamemodeEntries) + " entries.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ void function UpdateStatsForMap( string mapName )
|
|||||||
|
|
||||||
Hud_SetText( Hud_GetChild( file.menu, "WeaponName" ), GetMapDisplayName( mapName ) )
|
Hud_SetText( Hud_GetChild( file.menu, "WeaponName" ), GetMapDisplayName( mapName ) )
|
||||||
|
|
||||||
|
//Put this elsewhere, user needs to click twice for it to work
|
||||||
getGamemodeStatsFromToneAPI(mapName)
|
getGamemodeStatsFromToneAPI(mapName)
|
||||||
|
|
||||||
// Image
|
// Image
|
||||||
@@ -189,25 +190,23 @@ void function UpdateStatsForMap( string mapName )
|
|||||||
for ( int modeId = 0; modeId < enumCount; modeId++ )
|
for ( int modeId = 0; modeId < enumCount; modeId++ )
|
||||||
{
|
{
|
||||||
string modeName = PersistenceGetEnumItemNameForIndex( "gameModes", modeId )
|
string modeName = PersistenceGetEnumItemNameForIndex( "gameModes", modeId )
|
||||||
if ( modeName in globalToneAPIGamemodeData )
|
if ( mapName in globalToneAPIGamemodeMapData && modeName in globalToneAPIGamemodeMapData[mapName] )
|
||||||
{
|
{
|
||||||
float modePlayedTime = 0
|
float modePlayedTime = 0
|
||||||
modePlayedTime = float(globalToneAPIGamemodeData[modeName])
|
modePlayedTime = float(globalToneAPIGamemodeMapData[mapName][modeName])
|
||||||
print(modePlayedTime)
|
print("[PULSE] modePlayedTime " + modePlayedTime + " | modename " + modeName)
|
||||||
if ( modePlayedTime > 0 ) {
|
if ( modePlayedTime > 0 ) {
|
||||||
AddPieChartEntry( modes, GameMode_GetName( modeName ), modePlayedTime, GetGameModeDisplayColor( modeName ) )
|
AddPieChartEntry( modes, GameMode_GetName( modeName ), modePlayedTime, GetGameModeDisplayColor( modeName ) )
|
||||||
print (modes)
|
|
||||||
print (GameMode_GetName(modeName))
|
|
||||||
print (GetGameModeDisplayColor(modeName))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (string key, array<int> value in customGamemodeList)
|
foreach (string key, array<int> value in customGamemodeList)
|
||||||
{
|
{
|
||||||
if ( key in globalToneAPIGamemodeData)
|
if ( mapName in globalToneAPIGamemodeMapData && key in globalToneAPIGamemodeMapData[mapName])
|
||||||
{
|
{
|
||||||
float modePlayedTime = 0
|
float modePlayedTime = 0
|
||||||
modePlayedTime = float(globalToneAPIGamemodeData[key])
|
modePlayedTime = float(globalToneAPIGamemodeMapData[mapName][key])
|
||||||
|
print("[PULSE] modePlayedTime " + modePlayedTime + " | modename " + key)
|
||||||
if ( modePlayedTime > 0 ) {
|
if ( modePlayedTime > 0 ) {
|
||||||
AddPieChartEntry( modes, key, modePlayedTime, value)
|
AddPieChartEntry( modes, key, modePlayedTime, value)
|
||||||
print("CUSTOM GAMEMODE DATA FUNCTION CALLED")
|
print("CUSTOM GAMEMODE DATA FUNCTION CALLED")
|
||||||
|
|||||||
Reference in New Issue
Block a user