|
|
@@ -1,9 +1,25 @@
|
|
|
|
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)
|
|
|
@@ -17,18 +33,39 @@ 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) : (givenURL, parameterTable, requestTable, tablepath)
|
|
|
|
ePulseDataType requestedDataType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("weapon" in parameterTable)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (NSIsSuccessHttpCode(response.statusCode))
|
|
|
|
requestedDataType = ePulseDataType.WEAPON
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
if ("map" in parameterTable)
|
|
|
|
foreach (var key in DecodedJSON) {
|
|
|
|
{
|
|
|
|
table dData = DecodedJSON[key]
|
|
|
|
string mapName = expect string(parameterTable["map"])
|
|
|
|
pulseDataStruct data = {
|
|
|
|
withMapName[mapName] <- DecodedJSON
|
|
|
|
dataType = requestedDataType,
|
|
|
|
pulseData[tablepath] <- withMapName
|
|
|
|
dataName = string(key),
|
|
|
|
} else {
|
|
|
|
global = tablepath.find("Global") != null ? true : false;
|
|
|
|
pulseData[tablepath] <- DecodedJSON
|
|
|
|
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 {
|
|
|
|
} else {
|
|
|
|
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
|
|
|
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
|
|
@@ -47,22 +84,6 @@ 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)
|
|
|
|