Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d2c3898ad | ||
|
|
7cf39f94a1 |
@@ -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.
|
||||||
@@ -75,7 +77,7 @@ Found a bug? Make an issue on GitHub [here.](https://github.com/ToneAPI/pulse/is
|
|||||||
|
|
||||||
## DISCLAIMERS
|
## 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)
|
As of v2.1.0, **pulse** requires [loeb](https://github.com/okvdai/loeb)
|
||||||
|
|||||||
@@ -1,25 +1,9 @@
|
|||||||
globalize_all_functions
|
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 string pulsePrefix
|
||||||
|
table withMapName = {}
|
||||||
void function pulsePrefixSet() //Sets our prefix
|
void function pulsePrefixSet() //Sets our prefix
|
||||||
{
|
{
|
||||||
pulsePrefix = format("\x1b[38;2;%i;%i;%im[PULSE]\x1b[0m", 255, 178, 102)
|
pulsePrefix = format("\x1b[38;2;%i;%i;%im[PULSE]\x1b[0m", 255, 178, 102)
|
||||||
@@ -33,39 +17,18 @@ 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
|
||||||
ePulseDataType requestedDataType
|
void functionref (HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) : (givenURL, parameterTable, requestTable, tablepath)
|
||||||
|
|
||||||
if ("weapon" in parameterTable)
|
|
||||||
{
|
{
|
||||||
requestedDataType = ePulseDataType.WEAPON
|
if (NSIsSuccessHttpCode(response.statusCode))
|
||||||
}
|
|
||||||
else if ("map" in parameterTable)
|
|
||||||
{
|
|
||||||
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)
|
table DecodedJSON = DecodeJSON(response.body)
|
||||||
foreach (var key in DecodedJSON) {
|
if ("map" in parameterTable)
|
||||||
table dData = DecodedJSON[key]
|
{
|
||||||
pulseDataStruct data = {
|
string mapName = expect string(parameterTable["map"])
|
||||||
dataType = requestedDataType,
|
withMapName[mapName] <- DecodedJSON
|
||||||
dataName = string(key),
|
pulseData[tablepath] <- withMapName
|
||||||
global = tablepath.find("Global") != null ? true : false;
|
} else {
|
||||||
int kills = "kills" in dData ? dData["kills"] : 0
|
pulseData[tablepath] <- DecodedJSON
|
||||||
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 {
|
} else {
|
||||||
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
||||||
@@ -84,6 +47,22 @@ bool function pulseRequestData(string givenURL, table parameterTable, string tab
|
|||||||
return NSHttpGet(givenURL, requestTable, onSuccess, onFailure)
|
return NSHttpGet(givenURL, requestTable, onSuccess, onFailure)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int function pulseParse(...) //Returns data from our pulseData table.
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
void function pulseLockStats()
|
void function pulseLockStats()
|
||||||
{
|
{
|
||||||
loebSetLockedButton(Localize("#MENU_TITLE_STATS"), true)
|
loebSetLockedButton(Localize("#MENU_TITLE_STATS"), true)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
global function pulseInit
|
global function pulseInit
|
||||||
global function pulseGetData
|
global function pulseGetData
|
||||||
|
|
||||||
global array<pulseDataStruct> pulseData = []
|
global table pulseData = {}
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
array<string> allMaps
|
array<string> allMaps
|
||||||
|
|||||||
Reference in New Issue
Block a user