Integrate with loeb #35
This commit is contained in:
@@ -3,7 +3,6 @@ globalize_all_functions
|
||||
|
||||
|
||||
global string pulsePrefix
|
||||
global bool pulseFailure = true
|
||||
table withMapName = {}
|
||||
void function pulsePrefixSet() //Sets our prefix
|
||||
{
|
||||
@@ -31,16 +30,13 @@ bool function pulseRequestData(string givenURL, table parameterTable, string tab
|
||||
} else {
|
||||
pulseData[tablepath] <- DecodedJSON
|
||||
}
|
||||
pulseFailure = false
|
||||
} else {
|
||||
pulseFailure = true
|
||||
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
||||
}
|
||||
}
|
||||
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) : (givenURL)
|
||||
{
|
||||
pulsePrintt(format("Something went wrong, %s is unreachable", givenURL))
|
||||
pulseFailure = true
|
||||
}
|
||||
foreach (key, value in parameterTable)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
global function pulseRegisterWithLoeb
|
||||
global function pulseLoebFunc
|
||||
|
||||
void function pulseRegisterWithLoeb()
|
||||
{
|
||||
loebLogMod(pulseLoebFunc())
|
||||
}
|
||||
|
||||
void function pulseLoebFunc()
|
||||
{
|
||||
print("func called")
|
||||
GetStats()
|
||||
}
|
||||
|
||||
void function GetStats()
|
||||
{
|
||||
loebSetLockedButton(Localize("#MENU_TITLE_STATS"), pulseGetData())
|
||||
}
|
||||
@@ -14,17 +14,34 @@ void function pulseInit()
|
||||
pulsePrintt("Initialized.")
|
||||
}
|
||||
|
||||
void function pulseGetData()
|
||||
bool 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"]
|
||||
pulseRequestData(URL + URLpath[0], {["player"] = NSGetLocalPlayerUID()}, tablepath[0])
|
||||
pulseRequestData(URL + URLpath[1], {["player"] = "!" + NSGetLocalPlayerUID()}, tablepath[1])
|
||||
pulseRequestData(URL + URLpath[2], {["player"] = NSGetLocalPlayerUID()}, tablepath[2])
|
||||
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
|
||||
}
|
||||
foreach (map in file.allMaps)
|
||||
{
|
||||
pulseRequestData(URL + URLpath[3], {["player"] = NSGetLocalPlayerUID(), ["map"] = map.slice(3)}, tablepath[3])
|
||||
if (!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
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user