Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47e4cd949c | ||
|
|
ca2ef84d55 | ||
|
|
02ba70198f | ||
|
|
f959f7dd91 | ||
|
|
7aa6c9476f | ||
|
|
0f0d89c9c3 | ||
|
|
d56b2878a2 | ||
|
|
5a5591d7b4 | ||
|
|
48c415c9ba | ||
|
|
11ae2bac90 | ||
|
|
f7e4588f80 | ||
|
|
b8879c3560 | ||
|
|
1c5ab1514b | ||
|
|
c538dd44f3 | ||
|
|
df4ee8fb0c | ||
|
|
ba0c4d11c7 | ||
|
|
c1cd3a6fc7 | ||
|
|
a8bbd9ea39 | ||
|
|
ff06daefae | ||
|
|
e1d5801d9a | ||
|
|
d4efc94e7d | ||
|
|
81b1b4f928 | ||
|
|
1d6b09537f | ||
|
|
4ce976cc88 | ||
|
|
687819e604 |
@@ -31,7 +31,7 @@ Found a bug? Make an issue on GitHub [here.](https://github.com/ToneAPI/pulse/is
|
||||
| AI kills |Non-functional, Tone API does not collect AI kill data.|
|
||||
| Pilot melee kills |Shows only melee kills accumulated by player as Pilot.|
|
||||
| Pilot executions |Shows only executions accumulated by player as Pilot.|
|
||||
|
||||
|
||||
- Kills as Titan - shows general kill data for player as Titan, visualised in the table below:
|
||||
|
||||
| Name | Description |
|
||||
@@ -73,16 +73,18 @@ 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)
|
||||
**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>
|
||||
<summary> pulse v2.0.0 "Demeter" </summary>
|
||||
|
||||
|
||||
- Switched to Thunderstore template on the GitHub site for easier development.
|
||||
- General code rewrite - lots of improvements for easier development. Rewrite includes:
|
||||
- common code file, for better code readability and ease of development,
|
||||
@@ -97,3 +99,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"
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
globalize_all_functions
|
||||
|
||||
global enum ePulseDataType
|
||||
{
|
||||
WEAPON,
|
||||
MAP,
|
||||
GAMEMODE,
|
||||
}
|
||||
|
||||
global struct pulseDataStruct
|
||||
{
|
||||
ePulseDataType dataType,
|
||||
string dataName,
|
||||
bool global,
|
||||
int kills,
|
||||
int deaths,
|
||||
int max_distance,
|
||||
int total_distance,
|
||||
int deaths_while_equipped
|
||||
}
|
||||
|
||||
global string pulsePrefix
|
||||
global bool pulseSuccessBool = true
|
||||
table withMapName = {}
|
||||
void function pulsePrefixSet() //Sets our prefix
|
||||
{
|
||||
pulsePrefix = format("\x1b[38;2;%i;%i;%im[PULSE]\x1b[0m", 255, 178, 102)
|
||||
@@ -18,23 +33,49 @@ 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)
|
||||
ePulseDataType requestedDataType
|
||||
|
||||
if ("weapon" in parameterTable)
|
||||
{
|
||||
table DecodedJSON = DecodeJSON(response.body)
|
||||
if ("map" in parameterTable)
|
||||
{
|
||||
string mapName = expect string(parameterTable["map"])
|
||||
withMapName[mapName] <- DecodedJSON
|
||||
pulseData[tablepath] <- withMapName
|
||||
} else {
|
||||
pulseData[tablepath] <- DecodedJSON
|
||||
}
|
||||
pulseSuccessBool = false
|
||||
requestedDataType = ePulseDataType.WEAPON
|
||||
}
|
||||
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure)
|
||||
else if ("map" in parameterTable)
|
||||
{
|
||||
pulsePrintt("Something went wrong while getting data.")
|
||||
pulseSuccessBool = true
|
||||
requestedDataType = ePulseDataType.MAP
|
||||
}
|
||||
else if ("gamemode" in parameterTable)
|
||||
{
|
||||
requestedDataType = ePulseDataType.GAMEMODE
|
||||
}
|
||||
|
||||
void functionref (HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) : (givenURL, parameterTable, requestTable, tablepath, requestedDataType)
|
||||
{
|
||||
if (NSIsSuccessHttpCode(respone.StatusCode))
|
||||
{
|
||||
table DecodedJSON = DecodeJSON(response.body)
|
||||
foreach (var key in DecodedJSON) {
|
||||
table dData = DecodedJSON[key]
|
||||
pulseDataStruct data = {
|
||||
dataType = requestedDataType,
|
||||
dataName = string(key),
|
||||
global = tablepath.find("Global") != null ? true : false;
|
||||
int kills = "kills" in dData ? dData["kills"] : 0
|
||||
int deaths = "deaths" in dData ? dData["deaths"] : 0
|
||||
int max_distance = "max_distance" in dData ? dData["max_distance"] : 0
|
||||
int total_distance = "total_distance" in dData ? dData["total_distance"] : 0
|
||||
int deaths_while_equipped = "deaths_while_equipped" in dData ? dData["deaths_while_equipped"] : 0
|
||||
}
|
||||
pulseData.append(data)
|
||||
}
|
||||
} else {
|
||||
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
||||
pulseLockStats()
|
||||
}
|
||||
}
|
||||
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) : (givenURL)
|
||||
{
|
||||
pulsePrintt(format("Something went wrong, %s is unreachable", givenURL))
|
||||
pulseLockStats()
|
||||
}
|
||||
foreach (key, value in parameterTable)
|
||||
{
|
||||
@@ -43,18 +84,12 @@ bool function pulseRequestData(string givenURL, table parameterTable, string tab
|
||||
return NSHttpGet(givenURL, requestTable, onSuccess, onFailure)
|
||||
}
|
||||
|
||||
int function pulseParse(...) //Returns data from our pulseData table.
|
||||
void function pulseLockStats()
|
||||
{
|
||||
table parser = pulseData
|
||||
int result = 0
|
||||
for (int i; i < vargc; i++) {
|
||||
if (i < expect int(vargc) - 1) {
|
||||
if (expect string (vargv[i]) in parser) {
|
||||
parser = expect table(parser[expect string(vargv[i])])
|
||||
} else {break}
|
||||
} else {
|
||||
result = expect int(parser[expect string(vargv[i])])
|
||||
}
|
||||
}
|
||||
return result
|
||||
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";
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
global function pulseInit
|
||||
global function pulseGetData
|
||||
|
||||
global table pulseData = {}
|
||||
global array<pulseDataStruct> pulseData = []
|
||||
|
||||
struct {
|
||||
array<string> allMaps
|
||||
@@ -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,9 +50,12 @@ 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)
|
||||
{
|
||||
titanKillData[weaponRef] <- pulseParse("weaponsLocal", weaponRef, "kills")
|
||||
foreach ( weaponRef in file.titanStatLoadout[ titan.ref ])
|
||||
{
|
||||
titanKillData[weaponRef] <- pulseParse("weaponsLocal", weaponRef, "kills")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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