Compare commits
23
Commits
v2.0.0-pre1
...
main
| 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** 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.
|
||||
</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.
|
||||
|
||||
As of v2.1.0, **pulse** requires [loeb](https://github.com/okvdai/loeb)
|
||||
|
||||
## CHANGELOG
|
||||
|
||||
<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.)
|
||||
- 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>
|
||||
<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",
|
||||
"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",
|
||||
"dependencies": []
|
||||
"dependencies": ["Okudai-loeb-1.0.1"]
|
||||
}
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
{
|
||||
"Name": "ToneAPI.pulse",
|
||||
"Description": "Displays Tone API kill data in the Stats tab.",
|
||||
"Version": "2.0.0",
|
||||
"Version": "2.1.1",
|
||||
"LoadPriority": 1,
|
||||
"ConVars": [
|
||||
{
|
||||
"Name": "ToneURL",
|
||||
"DefaultValue": "https://tone.sleepycat.date/v2/client"
|
||||
},
|
||||
{
|
||||
"Name": "VersionURL",
|
||||
"DefaultValue": "https://raw.githubusercontent.com/ToneAPI/pulse/main/version.json"
|
||||
"DefaultValue": "https://toneapi.ovh/v2/client"
|
||||
}
|
||||
],
|
||||
"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
|
||||
font Default_23
|
||||
labelText "--"
|
||||
allcaps 1
|
||||
allcaps 0
|
||||
textAlignment center
|
||||
fgcolor_override "255 255 255 255"
|
||||
//bgcolor_override "0 255 0 100"
|
||||
|
||||
@@ -3,7 +3,6 @@ globalize_all_functions
|
||||
|
||||
|
||||
global string pulsePrefix
|
||||
global bool pulseSuccessBool = true
|
||||
table withMapName = {}
|
||||
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.
|
||||
{
|
||||
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)
|
||||
if ("map" in parameterTable)
|
||||
@@ -29,12 +30,15 @@ bool function pulseRequestData(string givenURL, table parameterTable, string tab
|
||||
} else {
|
||||
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.")
|
||||
pulseSuccessBool = true
|
||||
pulsePrintt(format("Something went wrong, %s is unreachable", givenURL))
|
||||
pulseLockStats()
|
||||
}
|
||||
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 (expect string (vargv[i]) in parser) {
|
||||
parser = expect table(parser[expect string(vargv[i])])
|
||||
} else {break}
|
||||
} else break
|
||||
} else {
|
||||
result = expect int(parser[expect string(vargv[i])])
|
||||
}
|
||||
}
|
||||
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()
|
||||
file.allMaps = GetPrivateMatchMaps()
|
||||
pulsePrintt("Initialized.")
|
||||
AddUICallback_OnLevelInit( pulseGetData )
|
||||
}
|
||||
|
||||
void function pulseGetData()
|
||||
{
|
||||
print("data getter called")
|
||||
string URL = GetConVarString("ToneURL")
|
||||
array <string> URLpath = ["/weapons", "/weapons", "/gamemodes", "/gamemodes", "/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, "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, "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, "KillsValue4", "--" )
|
||||
SetStatsLabelValue( file.menu, "KillsLabel4", Localize("#MAPS_ASD") )
|
||||
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" )
|
||||
//printt( Hud_GetX( anchorElem ) )
|
||||
|
||||
@@ -32,7 +32,7 @@ void function InitViewStatsOverviewMenu()
|
||||
AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
|
||||
}
|
||||
|
||||
void function GetTitanKills( string titanName )
|
||||
void function GetTitanKills()
|
||||
{
|
||||
file.allTitans = GetVisibleItemsOfType( eItemTypes.TITAN )
|
||||
var dataTable = GetDataTable( $"datatable/titan_properties.rpak" )
|
||||
@@ -50,11 +50,14 @@ void function GetTitanKills( string titanName )
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void function GetAllPilotWeapons()
|
||||
{
|
||||
@@ -68,15 +71,7 @@ void function GetAllPilotWeapons()
|
||||
void function OnStatsOverview_Open()
|
||||
{
|
||||
UI_SetPresentationType( ePresentationType.NO_MODELS )
|
||||
|
||||
GetTitanKills("ion")
|
||||
GetTitanKills("scorch")
|
||||
GetTitanKills("northstar")
|
||||
GetTitanKills("ronin")
|
||||
GetTitanKills("tone")
|
||||
GetTitanKills("legion")
|
||||
GetTitanKills("vanguard")
|
||||
|
||||
GetTitanKills()
|
||||
UpdateViewStatsOverviewMenu()
|
||||
}
|
||||
|
||||
@@ -301,48 +296,35 @@ function UpdateViewStatsOverviewMenu()
|
||||
// Lifetime
|
||||
table playerweaponData = expect table(pulseData["weaponsLocal"])
|
||||
table globalweaponData = expect table(pulseData["weaponsGlobal"])
|
||||
|
||||
|
||||
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
|
||||
foreach (var key, var value in playerweaponData) {
|
||||
table values = expect table(value)
|
||||
totalPilotKills += values["kills"]
|
||||
totalPilotDeaths += values["deaths"]
|
||||
}
|
||||
|
||||
var totalGlobalKills = 0
|
||||
var totalGlobalDeaths = 0
|
||||
foreach (var key, var value in globalweaponData) {
|
||||
table values = expect table(value)
|
||||
totalGlobalKills += values["kills"]
|
||||
totalGlobalDeaths += values["deaths"]
|
||||
}
|
||||
|
||||
|
||||
var killsAsTitan = 0
|
||||
var killsAsPilot = 0
|
||||
foreach (var key, var value in playerweaponData) {
|
||||
if (key in titanKillData) {
|
||||
continue
|
||||
killsAsTitan += titanKillData[string(key)]
|
||||
} else {
|
||||
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 dval = float(totalPilotDeaths)
|
||||
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, "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( 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, "KillsAsPilotValue5" ), string( GetPlayerStatInt( player, "kills_stats", "titanFallKill" ) ) )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user