Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d2c3898ad | ||
|
|
7cf39f94a1 | ||
|
|
02ba70198f | ||
|
|
f959f7dd91 | ||
|
|
7aa6c9476f | ||
|
|
0f0d89c9c3 | ||
|
|
d56b2878a2 | ||
|
|
5a5591d7b4 | ||
|
|
48c415c9ba | ||
|
|
11ae2bac90 | ||
|
|
f7e4588f80 | ||
|
|
b8879c3560 | ||
|
|
1c5ab1514b | ||
|
|
c538dd44f3 | ||
|
|
df4ee8fb0c | ||
|
|
ba0c4d11c7 | ||
|
|
c1cd3a6fc7 | ||
|
|
a8bbd9ea39 | ||
|
|
ff06daefae | ||
|
|
e1d5801d9a | ||
|
|
d4efc94e7d | ||
|
|
81b1b4f928 | ||
|
|
1d6b09537f |
@@ -1,3 +1,5 @@
|
|||||||
|
# SINCE 06.12.2023, PULSE IS **DEPRECATED** DUE TO THE CLOSING OF THE TONE API SERVICE. THANK YOU FOR USING THE MOD.
|
||||||
|
|
||||||
# pulse
|
# pulse
|
||||||
|
|
||||||
**pulse** is a clientside mod for [TF|2 + Northstar](https://github.com/R2Northstar/Northstar) letting you view killstats collected by [the Tone API](https://toneapi.github.io/ToneAPI_webclient/) using the otherwise non-functional `Stats` tab.
|
**pulse** is a clientside mod for [TF|2 + Northstar](https://github.com/R2Northstar/Northstar) letting you view killstats collected by [the Tone API](https://toneapi.github.io/ToneAPI_webclient/) using the otherwise non-functional `Stats` tab.
|
||||||
@@ -73,11 +75,13 @@ Found a bug? Make an issue on GitHub [here.](https://github.com/ToneAPI/pulse/is
|
|||||||
- Kills by Gamemode - piechart showing all kills (in percent) on chosen map by gamemode.
|
- Kills by Gamemode - piechart showing all kills (in percent) on chosen map by gamemode.
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## DISCLAIMER
|
## DISCLAIMERS
|
||||||
|
|
||||||
The Tone API is NOT used by every server, view a list of supported servers [here.](https://tone.sleepycat.date/v2/client/servers)
|
The Tone API is NOT used by every server, view a list of supported servers [here.](https://toneapi.ovh/v2/client/servers)
|
||||||
**pulse** is very much a W.I.P as of right now, features may be missing/nonfunctional.
|
**pulse** is very much a W.I.P as of right now, features may be missing/nonfunctional.
|
||||||
|
|
||||||
|
As of v2.1.0, **pulse** requires [loeb](https://github.com/okvdai/loeb)
|
||||||
|
|
||||||
## CHANGELOG
|
## CHANGELOG
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@@ -97,3 +101,11 @@ The Tone API is NOT used by every server, view a list of supported servers [here
|
|||||||
- Polish. (Northstar isn't translated into Polish, but the game supports it.)
|
- Polish. (Northstar isn't translated into Polish, but the game supports it.)
|
||||||
- Locking the Stats tab, avoiding situations where you could click too fast and see no stats. Also prevents the game from showing stats when the API is unreachable.
|
- Locking the Stats tab, avoiding situations where you could click too fast and see no stats. Also prevents the game from showing stats when the API is unreachable.
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary> pulse v2.1.0 </summary>
|
||||||
|
|
||||||
|
- Changed endpoint
|
||||||
|
- Lots of bug fixes
|
||||||
|
- Uses new experimental loeb library
|
||||||
|
</details>
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Pulse",
|
"name": "Pulse",
|
||||||
"description": "Adds stats (collected by the Tone API) back to the Stats tab.",
|
"description": "Adds stats (collected by the Tone API) back to the Stats tab.",
|
||||||
"version_number": "2.0.0",
|
"version_number": "2.1.1",
|
||||||
"website_url": "https://github.com/ToneAPI/pulse",
|
"website_url": "https://github.com/ToneAPI/pulse",
|
||||||
"dependencies": []
|
"dependencies": ["Okudai-loeb-1.0.1"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
{
|
{
|
||||||
"Name": "ToneAPI.pulse",
|
"Name": "ToneAPI.pulse",
|
||||||
"Description": "Displays Tone API kill data in the Stats tab.",
|
"Description": "Displays Tone API kill data in the Stats tab.",
|
||||||
"Version": "2.0.0",
|
"Version": "2.1.1",
|
||||||
"LoadPriority": 1,
|
"LoadPriority": 1,
|
||||||
"ConVars": [
|
"ConVars": [
|
||||||
{
|
{
|
||||||
"Name": "ToneURL",
|
"Name": "ToneURL",
|
||||||
"DefaultValue": "https://tone.sleepycat.date/v2/client"
|
"DefaultValue": "https://toneapi.ovh/v2/client"
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "VersionURL",
|
|
||||||
"DefaultValue": "https://raw.githubusercontent.com/ToneAPI/pulse/main/version.json"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Scripts": [
|
"Scripts": [
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -532,7 +532,7 @@ resource/ui/menus/viewstats_pve.menu
|
|||||||
visible 1
|
visible 1
|
||||||
font Default_23
|
font Default_23
|
||||||
labelText "--"
|
labelText "--"
|
||||||
allcaps 1
|
allcaps 0
|
||||||
textAlignment center
|
textAlignment center
|
||||||
fgcolor_override "255 255 255 255"
|
fgcolor_override "255 255 255 255"
|
||||||
//bgcolor_override "0 255 0 100"
|
//bgcolor_override "0 255 0 100"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ globalize_all_functions
|
|||||||
|
|
||||||
|
|
||||||
global string pulsePrefix
|
global string pulsePrefix
|
||||||
global bool pulseSuccessBool = true
|
|
||||||
table withMapName = {}
|
table withMapName = {}
|
||||||
void function pulsePrefixSet() //Sets our prefix
|
void function pulsePrefixSet() //Sets our prefix
|
||||||
{
|
{
|
||||||
@@ -18,7 +17,9 @@ void function pulsePrintt(string content) //Prints whatever we want printed with
|
|||||||
bool function pulseRequestData(string givenURL, table parameterTable, string tablepath) //Gets data from API (see ToneURL within mod.json) and puts it into one table for processing.
|
bool function pulseRequestData(string givenURL, table parameterTable, string tablepath) //Gets data from API (see ToneURL within mod.json) and puts it into one table for processing.
|
||||||
{
|
{
|
||||||
table<string, array<string> > requestTable
|
table<string, array<string> > requestTable
|
||||||
void functionref (HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) : (parameterTable, requestTable, tablepath)
|
void functionref (HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) : (givenURL, parameterTable, requestTable, tablepath)
|
||||||
|
{
|
||||||
|
if (NSIsSuccessHttpCode(response.statusCode))
|
||||||
{
|
{
|
||||||
table DecodedJSON = DecodeJSON(response.body)
|
table DecodedJSON = DecodeJSON(response.body)
|
||||||
if ("map" in parameterTable)
|
if ("map" in parameterTable)
|
||||||
@@ -29,12 +30,15 @@ bool function pulseRequestData(string givenURL, table parameterTable, string tab
|
|||||||
} else {
|
} else {
|
||||||
pulseData[tablepath] <- DecodedJSON
|
pulseData[tablepath] <- DecodedJSON
|
||||||
}
|
}
|
||||||
pulseSuccessBool = false
|
} else {
|
||||||
|
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
||||||
|
pulseLockStats()
|
||||||
}
|
}
|
||||||
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure)
|
}
|
||||||
|
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) : (givenURL)
|
||||||
{
|
{
|
||||||
pulsePrintt("Something went wrong while getting data.")
|
pulsePrintt(format("Something went wrong, %s is unreachable", givenURL))
|
||||||
pulseSuccessBool = true
|
pulseLockStats()
|
||||||
}
|
}
|
||||||
foreach (key, value in parameterTable)
|
foreach (key, value in parameterTable)
|
||||||
{
|
{
|
||||||
@@ -51,10 +55,20 @@ int function pulseParse(...) //Returns data from our pulseData table.
|
|||||||
if (i < expect int(vargc) - 1) {
|
if (i < expect int(vargc) - 1) {
|
||||||
if (expect string (vargv[i]) in parser) {
|
if (expect string (vargv[i]) in parser) {
|
||||||
parser = expect table(parser[expect string(vargv[i])])
|
parser = expect table(parser[expect string(vargv[i])])
|
||||||
} else {break}
|
} else break
|
||||||
} else {
|
} else {
|
||||||
result = expect int(parser[expect string(vargv[i])])
|
result = expect int(parser[expect string(vargv[i])])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void function pulseLockStats()
|
||||||
|
{
|
||||||
|
loebSetLockedButton(Localize("#MENU_TITLE_STATS"), true)
|
||||||
|
}
|
||||||
|
|
||||||
|
string function HammerToMeterString(float value)
|
||||||
|
{
|
||||||
|
return value > 0 && int((1.905 * value ))/100 > 0 ? string(int((1.905 * value ) )/100) + "m" : "0";
|
||||||
|
}
|
||||||
@@ -12,10 +12,12 @@ void function pulseInit()
|
|||||||
pulsePrefixSet()
|
pulsePrefixSet()
|
||||||
file.allMaps = GetPrivateMatchMaps()
|
file.allMaps = GetPrivateMatchMaps()
|
||||||
pulsePrintt("Initialized.")
|
pulsePrintt("Initialized.")
|
||||||
|
AddUICallback_OnLevelInit( pulseGetData )
|
||||||
}
|
}
|
||||||
|
|
||||||
void function pulseGetData()
|
void function pulseGetData()
|
||||||
{
|
{
|
||||||
|
print("data getter called")
|
||||||
string URL = GetConVarString("ToneURL")
|
string URL = GetConVarString("ToneURL")
|
||||||
array <string> URLpath = ["/weapons", "/weapons", "/gamemodes", "/gamemodes", "/maps"]
|
array <string> URLpath = ["/weapons", "/weapons", "/gamemodes", "/gamemodes", "/maps"]
|
||||||
array <string> tablepath = ["weaponsLocal", "weaponsGlobal", "gamemodesAll", "gamemodesSeparated", "maps"]
|
array <string> tablepath = ["weaponsLocal", "weaponsGlobal", "gamemodesAll", "gamemodesSeparated", "maps"]
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -159,13 +159,13 @@ void function UpdateStatsForMap( string mapName )
|
|||||||
SetStatsLabelValue( file.menu, "KillsValue1", pulseParse("maps", mapName.slice(3), "deaths") )
|
SetStatsLabelValue( file.menu, "KillsValue1", pulseParse("maps", mapName.slice(3), "deaths") )
|
||||||
|
|
||||||
SetStatsLabelValue( file.menu, "KillsLabel2", Localize("#MAPS_TSD") )
|
SetStatsLabelValue( file.menu, "KillsLabel2", Localize("#MAPS_TSD") )
|
||||||
SetStatsLabelValue( file.menu, "KillsValue2", string(int((1.905 * float(pulseParse("maps", mapName.slice(3), "total_distance") ) ) )/100) + "m" )
|
SetStatsLabelValue( file.menu, "KillsValue2", HammerToMeterString(float(pulseParse("maps", mapName.slice(3), "total_distance"))))
|
||||||
|
|
||||||
SetStatsLabelValue( file.menu, "KillsLabel3", Localize("#MAPS_MSD") )
|
SetStatsLabelValue( file.menu, "KillsLabel3", Localize("#MAPS_MSD") )
|
||||||
SetStatsLabelValue( file.menu, "KillsValue3", string(int((1.905 * float(pulseParse("maps", mapName.slice(3), "max_distance") ) ) )/100) + "m" )
|
SetStatsLabelValue( file.menu, "KillsValue3", HammerToMeterString(float(pulseParse("maps", mapName.slice(3), "max_distance"))))
|
||||||
|
|
||||||
SetStatsLabelValue( file.menu, "KillsLabel4", "--" )
|
SetStatsLabelValue( file.menu, "KillsLabel4", Localize("#MAPS_ASD") )
|
||||||
SetStatsLabelValue( file.menu, "KillsValue4", "--" )
|
SetStatsLabelValue( file.menu, "KillsValue4", HammerToMeterString(float(pulseParse("maps", mapName.slice(3), "max_distance")) / float(pulseParse("maps", mapName.slice(3), "kills"))))
|
||||||
|
|
||||||
//var anchorElem = Hud_GetChild( file.menu, "WeaponStatsBackground" )
|
//var anchorElem = Hud_GetChild( file.menu, "WeaponStatsBackground" )
|
||||||
//printt( Hud_GetX( anchorElem ) )
|
//printt( Hud_GetX( anchorElem ) )
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void function InitViewStatsOverviewMenu()
|
|||||||
AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
|
AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
|
||||||
}
|
}
|
||||||
|
|
||||||
void function GetTitanKills( string titanName )
|
void function GetTitanKills()
|
||||||
{
|
{
|
||||||
file.allTitans = GetVisibleItemsOfType( eItemTypes.TITAN )
|
file.allTitans = GetVisibleItemsOfType( eItemTypes.TITAN )
|
||||||
var dataTable = GetDataTable( $"datatable/titan_properties.rpak" )
|
var dataTable = GetDataTable( $"datatable/titan_properties.rpak" )
|
||||||
@@ -50,10 +50,13 @@ void function GetTitanKills( string titanName )
|
|||||||
file.titanStatLoadout[ titan.ref ].append( GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, "melee" ) ) )
|
file.titanStatLoadout[ titan.ref ].append( GetDataTableString( dataTable, row, GetDataTableColumnByName( dataTable, "melee" ) ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( weaponRef in file.titanStatLoadout[ titanName ])
|
foreach ( titan in file.allTitans)
|
||||||
|
{
|
||||||
|
foreach ( weaponRef in file.titanStatLoadout[ titan.ref ])
|
||||||
{
|
{
|
||||||
titanKillData[weaponRef] <- pulseParse("weaponsLocal", weaponRef, "kills")
|
titanKillData[weaponRef] <- pulseParse("weaponsLocal", weaponRef, "kills")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void function GetAllPilotWeapons()
|
void function GetAllPilotWeapons()
|
||||||
@@ -68,15 +71,7 @@ void function GetAllPilotWeapons()
|
|||||||
void function OnStatsOverview_Open()
|
void function OnStatsOverview_Open()
|
||||||
{
|
{
|
||||||
UI_SetPresentationType( ePresentationType.NO_MODELS )
|
UI_SetPresentationType( ePresentationType.NO_MODELS )
|
||||||
|
GetTitanKills()
|
||||||
GetTitanKills("ion")
|
|
||||||
GetTitanKills("scorch")
|
|
||||||
GetTitanKills("northstar")
|
|
||||||
GetTitanKills("ronin")
|
|
||||||
GetTitanKills("tone")
|
|
||||||
GetTitanKills("legion")
|
|
||||||
GetTitanKills("vanguard")
|
|
||||||
|
|
||||||
UpdateViewStatsOverviewMenu()
|
UpdateViewStatsOverviewMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,48 +296,35 @@ function UpdateViewStatsOverviewMenu()
|
|||||||
// Lifetime
|
// Lifetime
|
||||||
table playerweaponData = expect table(pulseData["weaponsLocal"])
|
table playerweaponData = expect table(pulseData["weaponsLocal"])
|
||||||
table globalweaponData = expect table(pulseData["weaponsGlobal"])
|
table globalweaponData = expect table(pulseData["weaponsGlobal"])
|
||||||
|
|
||||||
|
|
||||||
var totalPilotKills = 0
|
var totalPilotKills = 0
|
||||||
|
|
||||||
foreach (var key, var value in playerweaponData) {
|
|
||||||
table values = expect table(value)
|
|
||||||
totalPilotKills += values["kills"]
|
|
||||||
}
|
|
||||||
|
|
||||||
var totalGlobalKills = 0
|
|
||||||
foreach (var key, var value in globalweaponData) {
|
|
||||||
table values = expect table(value)
|
|
||||||
totalGlobalKills += values["kills"]
|
|
||||||
}
|
|
||||||
|
|
||||||
var totalPilotDeaths = 0
|
var totalPilotDeaths = 0
|
||||||
foreach (var key, var value in playerweaponData) {
|
foreach (var key, var value in playerweaponData) {
|
||||||
table values = expect table(value)
|
table values = expect table(value)
|
||||||
|
totalPilotKills += values["kills"]
|
||||||
totalPilotDeaths += values["deaths"]
|
totalPilotDeaths += values["deaths"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var totalGlobalKills = 0
|
||||||
var totalGlobalDeaths = 0
|
var totalGlobalDeaths = 0
|
||||||
foreach (var key, var value in globalweaponData) {
|
foreach (var key, var value in globalweaponData) {
|
||||||
table values = expect table(value)
|
table values = expect table(value)
|
||||||
|
totalGlobalKills += values["kills"]
|
||||||
totalGlobalDeaths += values["deaths"]
|
totalGlobalDeaths += values["deaths"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var killsAsTitan = 0
|
||||||
var killsAsPilot = 0
|
var killsAsPilot = 0
|
||||||
foreach (var key, var value in playerweaponData) {
|
foreach (var key, var value in playerweaponData) {
|
||||||
if (key in titanKillData) {
|
if (key in titanKillData) {
|
||||||
continue
|
killsAsTitan += titanKillData[string(key)]
|
||||||
} else {
|
} else {
|
||||||
killsAsPilot += pulseParse("weaponsLocal", string(key), "kills")
|
killsAsPilot += pulseParse("weaponsLocal", string(key), "kills")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var killsAsTitan = 0
|
|
||||||
foreach (var key, var value in playerweaponData) {
|
|
||||||
if (key in titanKillData) {
|
|
||||||
killsAsTitan += titanKillData[string(key)]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float kval = float(totalPilotKills)
|
float kval = float(totalPilotKills)
|
||||||
float dval = float(totalPilotDeaths)
|
float dval = float(totalPilotDeaths)
|
||||||
float kdval = float(int((kval / dval)*100))/100
|
float kdval = float(int((kval / dval)*100))/100
|
||||||
@@ -407,7 +389,7 @@ function UpdateViewStatsOverviewMenu()
|
|||||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue0" ), string( killsAsPilot ) )
|
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue0" ), string( killsAsPilot ) )
|
||||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue1" ), string( GetPlayerStatInt( player, "kills_stats", "titanKillsAsPilot" ) ) )
|
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, "KillsAsPilotValue2" ), string( GetPlayerStatInt( player, "kills_stats", "totalNPC" ) ) )
|
||||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue3" ), string( pulseParse("weaponsLocal", "pilot_emptyhanded", "kills") ) )
|
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue3" ), string( pulseParse("weaponsLocal", "pilot_emptyhanded", "kills") + pulseParse("weaponsLocal", "melee_pilot_kunai", "kills") ) )
|
||||||
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue4" ), string( pulseParse("weaponsLocal", "human_execution", "kills") ) )
|
Hud_SetText( GetElem( file.menu, "KillsAsPilotValue4" ), string( pulseParse("weaponsLocal", "human_execution", "kills") ) )
|
||||||
// Hud_SetText( GetElem( file.menu, "KillsAsPilotValue5" ), string( GetPlayerStatInt( player, "kills_stats", "titanFallKill" ) ) )
|
// Hud_SetText( GetElem( file.menu, "KillsAsPilotValue5" ), string( GetPlayerStatInt( player, "kills_stats", "titanFallKill" ) ) )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user