Prepare for v1.1.0
- Add viewstats_overview.menu - Add NEMESIS WEAPON to Overview tab - Add pilot melee kills, executions, roadkills and Titan executions to Overview tab
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"Name": "ToneAPI.pulse",
|
||||
"Description": "Displays Tone API kill data in the Stats tab.",
|
||||
"Version": "1.0.0",
|
||||
"Version": "1.1.0-prerelease",
|
||||
"LoadPriority": 1,
|
||||
"Scripts": [
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,9 @@
|
||||
global function GetStatsFromToneAPI
|
||||
global function getWeaponKillsFromToneApi
|
||||
global function getNemesisWeaponFromToneAPI
|
||||
|
||||
global table globalToneAPIKillData = {}
|
||||
global table globalToneAPIDeathData = {}
|
||||
|
||||
void function GetStatsFromToneAPI()
|
||||
{
|
||||
@@ -14,11 +16,12 @@ void function GetStatsFromToneAPI_threaded(){
|
||||
if(NSIsMasterServerAuthenticated()) break
|
||||
WaitFrame()
|
||||
}
|
||||
//SetConVarString("ToneURL", "https://toneapi.sleepycat.date/v1")
|
||||
|
||||
//SetConVarString("ToneURL", "https://toneapi.sleepycat.date/v2_test")
|
||||
print("[PULSE] Loaded, getting data...")
|
||||
HttpRequest getStats
|
||||
getStats.method = HttpRequestMethod.GET
|
||||
getStats.url = "https://tone.sleepycat.date/v1/client/weapons"
|
||||
getStats.url = "https://tone.sleepycat.date/v2_test/client/weapons"
|
||||
getStats.queryParameters["player"] <- [NSGetLocalPlayerUID().tostring()]
|
||||
void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response)
|
||||
{
|
||||
@@ -26,9 +29,8 @@ void function GetStatsFromToneAPI_threaded(){
|
||||
table JSONForConversion = DecodeJSON(response.body)
|
||||
foreach (var key, var value in JSONForConversion) {
|
||||
table test = expect table(value)
|
||||
//this won't work on v2 since kills will be an integer already
|
||||
string kills = expect string(test.kills)
|
||||
globalToneAPIKillData[string(key)] <- kills.tointeger()
|
||||
globalToneAPIKillData[string(key)] <- test.kills
|
||||
globalToneAPIDeathData[string(key)] <- test.deaths
|
||||
print("[PULSE] " + key + " has been added.")
|
||||
}
|
||||
print("[PULSE] Kill data has been processed.")
|
||||
@@ -45,8 +47,6 @@ void function GetStatsFromToneAPI_threaded(){
|
||||
|
||||
int function getWeaponKillsFromToneApi(string weaponRef){
|
||||
|
||||
//Sliced names are to be removed afterwards
|
||||
//print("[PULSE]" + weaponRef)
|
||||
if(weaponRef.find("mp_weapon") != null){
|
||||
weaponRef = weaponRef.slice(10)
|
||||
}
|
||||
@@ -57,3 +57,16 @@ int function getWeaponKillsFromToneApi(string weaponRef){
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
int function getNemesisWeaponFromToneAPI(string weaponRef){
|
||||
|
||||
if(weaponRef.find("mp_weapon") != null){
|
||||
weaponRef = weaponRef.slice(10)
|
||||
}
|
||||
|
||||
if(weaponRef in globalToneAPIKillData){
|
||||
print("[PULSE] Found matching weapon : " + weaponRef + " with " + globalToneAPIDeathData[weaponRef] + " deaths")
|
||||
return expect int(globalToneAPIDeathData[weaponRef])
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@@ -118,7 +118,7 @@ function UpdateViewStatsOverviewMenu()
|
||||
|
||||
table<string, table> weaponData = GetOverviewWeaponData()
|
||||
table mostKillsData = weaponData[ "most_kills" ]
|
||||
table mostUsedData = weaponData[ "most_used" ]
|
||||
table nemesisWeapon = weaponData[ "nemesis_weapon" ]
|
||||
table highestKPMData = weaponData[ "highest_kpm" ]
|
||||
|
||||
var weaponImageElem
|
||||
@@ -158,14 +158,14 @@ function UpdateViewStatsOverviewMenu()
|
||||
weaponNameElem = Hud_GetChild( file.menu, "WeaponName1" )
|
||||
weaponDescElem = Hud_GetChild( file.menu, "WeaponDesc1" )
|
||||
noDataElem = Hud_GetChild( file.menu, "WeaponImageTextOverlay1" )
|
||||
if ( mostUsedData.ref != "" )
|
||||
if ( nemesisWeapon.ref != "" )
|
||||
{
|
||||
SetItemImageWidth( weaponImageElem, expect string( mostUsedData.ref ) )
|
||||
RuiSetImage( weaponRui, "buttonImage", GetItemImage( expect string( mostUsedData.ref ) ) )
|
||||
SetItemImageWidth( weaponImageElem, expect string( nemesisWeapon.ref ) )
|
||||
RuiSetImage( weaponRui, "buttonImage", GetItemImage( expect string( nemesisWeapon.ref ) ) )
|
||||
Hud_Show( weaponImageElem )
|
||||
Hud_SetText( weaponNameElem, mostUsedData.printName )
|
||||
Hud_SetText( weaponNameElem, nemesisWeapon.printName )
|
||||
Hud_Show( weaponNameElem )
|
||||
SetStatsLabelValue( file.menu, "WeaponDesc1", HoursToTimeString( expect float( mostUsedData.val ) ) )
|
||||
Hud_SetText( weaponDescElem, "#STATS_MOST_KILLS_VALUE", nemesisWeapon.val )
|
||||
Hud_Show( weaponDescElem )
|
||||
Hud_Hide( noDataElem )
|
||||
}
|
||||
@@ -321,26 +321,25 @@ function UpdateViewStatsOverviewMenu()
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue0" ), string( totalPilotKills ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue1" ), string( GetPlayerStatInt( player, "kills_stats", "titanKillsAsPilot" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue2" ), string( GetPlayerStatInt( player, "kills_stats", "totalNPC" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue3" ), string( GetPlayerStatInt( player, "kills_stats", "pilotKickMeleePilot" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue4" ), string( GetPlayerStatInt( player, "kills_stats", "pilotExecutePilot" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue3" ), string( getWeaponKillsFromToneApi("pilot_emptyhanded") ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue4" ), string( getWeaponKillsFromToneApi("human_execution") ) )
|
||||
// Hud_SetText( GetElem( file.menu, "KillsAsPilotValue5" ), string( GetPlayerStatInt( player, "kills_stats", "titanFallKill" ) ) )
|
||||
|
||||
|
||||
|
||||
int totalTitanExecutions = 0
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionIon" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionScorch" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionNorthstar" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionRonin" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionTone" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionLegion" )
|
||||
totalTitanExecutions += GetPlayerStatInt( player, "kills_stats", "titanExocutionVanguard" )
|
||||
var titanMeleeKills = 0
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_ion")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_scorch")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_northstar")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_sword")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_tone")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_legion")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("titan_punch_vanguard")
|
||||
titanMeleeKills += getWeaponKillsFromToneApi("auto_titan_melee")
|
||||
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue0" ), string( GetPlayerStatInt( player, "kills_stats", "pilotKillsAsTitan" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue1" ), string( GetPlayerStatInt( player, "kills_stats", "titanKillsAsTitan" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue2" ), string( totalTitanExecutions ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue2" ), string( titanMeleeKills ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue3" ), string( GetPlayerStatInt( player, "kills_stats", "titanMeleePilot" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue4" ), string( GetPlayerStatInt( player, "kills_stats", "titanStepCrushPilot" ) ) )
|
||||
Hud_SetText( GetElem( file.menu, "KillsAsTitanValue4" ), string( getWeaponKillsFromToneApi("damagedef_titan_step") ) )
|
||||
}
|
||||
|
||||
function PlotKDPointsOnGraph( menu, graphIndex, values, dottedAverage )
|
||||
|
||||
@@ -306,10 +306,10 @@ table<string, table> function GetOverviewWeaponData()
|
||||
Table[ "most_kills" ].ref <- ""
|
||||
Table[ "most_kills" ].printName <- ""
|
||||
Table[ "most_kills" ].val <- 0
|
||||
Table[ "most_used" ] <- {}
|
||||
Table[ "most_used" ].ref <- ""
|
||||
Table[ "most_used" ].printName <- ""
|
||||
Table[ "most_used" ].val <- 0
|
||||
Table[ "nemesis_weapon" ] <- {}
|
||||
Table[ "nemesis_weapon" ].ref <- ""
|
||||
Table[ "nemesis_weapon" ].printName <- ""
|
||||
Table[ "nemesis_weapon" ].val <- 0
|
||||
Table[ "highest_kpm" ] <- {}
|
||||
Table[ "highest_kpm" ].ref <- ""
|
||||
Table[ "highest_kpm" ].printName <- ""
|
||||
@@ -346,12 +346,12 @@ table<string, table> function GetOverviewWeaponData()
|
||||
Table[ "most_kills" ].val = val
|
||||
}
|
||||
|
||||
float fVal = GetPlayerStatFloat( player, "weapon_stats", "hoursUsed", weaponName )
|
||||
if ( fVal > Table[ "most_used" ].val )
|
||||
int nval = getNemesisWeaponFromToneAPI(weaponName)
|
||||
if ( nval > Table[ "nemesis_weapon" ].val )
|
||||
{
|
||||
Table[ "most_used" ].ref = weaponName
|
||||
Table[ "most_used" ].printName = weaponDisplayName
|
||||
Table[ "most_used" ].val = fVal
|
||||
Table[ "nemesis_weapon" ].ref = weaponName
|
||||
Table[ "nemesis_weapon" ].printName = weaponDisplayName
|
||||
Table[ "nemesis_weapon" ].val = nval
|
||||
}
|
||||
|
||||
local killsPerMinute = 0
|
||||
|
||||
Reference in New Issue
Block a user