Merge pulse-loeb-component.nut into pulse-common-func.gnut
This commit is contained in:
@@ -20,13 +20,6 @@
|
|||||||
"UICallback": {
|
"UICallback": {
|
||||||
"After": "pulseInit"
|
"After": "pulseInit"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"Path": "pulse-loeb-component.nut",
|
|
||||||
"RunOn": "UI",
|
|
||||||
"UICallback": {
|
|
||||||
"After": "pulseRegisterWithLoeb"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Localisation": [
|
"Localisation": [
|
||||||
|
|||||||
@@ -32,11 +32,13 @@ bool function pulseRequestData(string givenURL, table parameterTable, string tab
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
||||||
|
pulseLockStats()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) : (givenURL)
|
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) : (givenURL)
|
||||||
{
|
{
|
||||||
pulsePrintt(format("Something went wrong, %s is unreachable", givenURL))
|
pulsePrintt(format("Something went wrong, %s is unreachable", givenURL))
|
||||||
|
pulseLockStats()
|
||||||
}
|
}
|
||||||
foreach (key, value in parameterTable)
|
foreach (key, value in parameterTable)
|
||||||
{
|
{
|
||||||
@@ -61,6 +63,11 @@ int function pulseParse(...) //Returns data from our pulseData table.
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void function pulseLockStats()
|
||||||
|
{
|
||||||
|
loebSetLockedButton(Localize("#MENU_TITLE_STATS"), true)
|
||||||
|
}
|
||||||
|
|
||||||
string function HammerToMeterString(float value)
|
string function HammerToMeterString(float value)
|
||||||
{
|
{
|
||||||
return value > 0 && int((1.905 * value ))/100 > 0 ? string(int((1.905 * value ) )/100) + "m" : "0";
|
return value > 0 && int((1.905 * value ))/100 > 0 ? string(int((1.905 * value ) )/100) + "m" : "0";
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
global function pulseRegisterWithLoeb
|
|
||||||
|
|
||||||
void function pulseRegisterWithLoeb()
|
|
||||||
{
|
|
||||||
bool success = pulseGetData()
|
|
||||||
loebSetLockedButton(Localize("#MENU_TITLE_STATS"), success)
|
|
||||||
}
|
|
||||||
@@ -12,36 +12,21 @@ void function pulseInit()
|
|||||||
pulsePrefixSet()
|
pulsePrefixSet()
|
||||||
file.allMaps = GetPrivateMatchMaps()
|
file.allMaps = GetPrivateMatchMaps()
|
||||||
pulsePrintt("Initialized.")
|
pulsePrintt("Initialized.")
|
||||||
|
pulseGetData()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool function pulseGetData()
|
void function pulseGetData()
|
||||||
{
|
{
|
||||||
print("data getter called")
|
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"]
|
||||||
if (!pulseRequestData(URL + URLpath[0], {["player"] = NSGetLocalPlayerUID()}, tablepath[0]))
|
pulseRequestData(URL + URLpath[0], {["player"] = NSGetLocalPlayerUID()}, tablepath[0])
|
||||||
{
|
pulseRequestData(URL + URLpath[1], {["player"] = "!" + NSGetLocalPlayerUID()}, tablepath[1])
|
||||||
return true
|
pulseRequestData(URL + URLpath[2], {["player"] = NSGetLocalPlayerUID()}, tablepath[2])
|
||||||
}
|
|
||||||
if (!pulseRequestData(URL + URLpath[1], {["player"] = "!" + NSGetLocalPlayerUID()}, tablepath[1]))
|
|
||||||
{
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if (!pulseRequestData(URL + URLpath[2], {["player"] = NSGetLocalPlayerUID()}, tablepath[2]))
|
|
||||||
{
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
foreach (map in file.allMaps)
|
foreach (map in file.allMaps)
|
||||||
{
|
{
|
||||||
if (!pulseRequestData(URL + URLpath[3], {["player"] = NSGetLocalPlayerUID(), ["map"] = map.slice(3)}, tablepath[3]))
|
pulseRequestData(URL + URLpath[3], {["player"] = NSGetLocalPlayerUID(), ["map"] = map.slice(3)}, tablepath[3])
|
||||||
{
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
}
|
pulseRequestData(URL + URLpath[4], {["player"] = NSGetLocalPlayerUID()}, tablepath[4])
|
||||||
if (!pulseRequestData(URL + URLpath[4], {["player"] = NSGetLocalPlayerUID()}, tablepath[4]))
|
|
||||||
{
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user