Merge pulse-loeb-component.nut into pulse-common-func.gnut
This commit is contained in:
@@ -20,13 +20,6 @@
|
||||
"UICallback": {
|
||||
"After": "pulseInit"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Path": "pulse-loeb-component.nut",
|
||||
"RunOn": "UI",
|
||||
"UICallback": {
|
||||
"After": "pulseRegisterWithLoeb"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Localisation": [
|
||||
|
||||
@@ -32,11 +32,13 @@ bool function pulseRequestData(string givenURL, table parameterTable, string tab
|
||||
}
|
||||
} 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)
|
||||
{
|
||||
@@ -61,6 +63,11 @@ int function pulseParse(...) //Returns data from our pulseData table.
|
||||
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";
|
||||
|
||||
@@ -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()
|
||||
file.allMaps = GetPrivateMatchMaps()
|
||||
pulsePrintt("Initialized.")
|
||||
pulseGetData()
|
||||
}
|
||||
|
||||
bool function 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"]
|
||||
if (!pulseRequestData(URL + URLpath[0], {["player"] = NSGetLocalPlayerUID()}, tablepath[0]))
|
||||
{
|
||||
return true
|
||||
}
|
||||
if (!pulseRequestData(URL + URLpath[1], {["player"] = "!" + NSGetLocalPlayerUID()}, tablepath[1]))
|
||||
{
|
||||
return true
|
||||
}
|
||||
if (!pulseRequestData(URL + URLpath[2], {["player"] = NSGetLocalPlayerUID()}, tablepath[2]))
|
||||
{
|
||||
return true
|
||||
}
|
||||
pulseRequestData(URL + URLpath[0], {["player"] = NSGetLocalPlayerUID()}, tablepath[0])
|
||||
pulseRequestData(URL + URLpath[1], {["player"] = "!" + NSGetLocalPlayerUID()}, tablepath[1])
|
||||
pulseRequestData(URL + URLpath[2], {["player"] = NSGetLocalPlayerUID()}, tablepath[2])
|
||||
foreach (map in file.allMaps)
|
||||
{
|
||||
if (!pulseRequestData(URL + URLpath[3], {["player"] = NSGetLocalPlayerUID(), ["map"] = map.slice(3)}, tablepath[3]))
|
||||
{
|
||||
return true
|
||||
}
|
||||
pulseRequestData(URL + URLpath[3], {["player"] = NSGetLocalPlayerUID(), ["map"] = map.slice(3)}, tablepath[3])
|
||||
}
|
||||
if (!pulseRequestData(URL + URLpath[4], {["player"] = NSGetLocalPlayerUID()}, tablepath[4]))
|
||||
{
|
||||
return true
|
||||
}
|
||||
return false
|
||||
pulseRequestData(URL + URLpath[4], {["player"] = NSGetLocalPlayerUID()}, tablepath[4])
|
||||
}
|
||||
Reference in New Issue
Block a user