Bug fixes
This commit is contained in:
@@ -15,17 +15,15 @@ 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> > params
|
table<string, array<string> > requestTable
|
||||||
foreach (parameter in paramTable)
|
void functionref (HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) : (parameterTable, requestTable, tablepath)
|
||||||
{
|
|
||||||
params[parameter] <- [paramTable(parameter)]
|
|
||||||
}
|
|
||||||
void functionref (HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) : (params, tablepath)
|
|
||||||
{
|
{
|
||||||
table DecodedJSON = DecodeJSON(response.body)
|
table DecodedJSON = DecodeJSON(response.body)
|
||||||
if (params["map"])
|
if ("map" in parameterTable)
|
||||||
{
|
{
|
||||||
table map[params["map"]] <- DecodedJSON
|
table map
|
||||||
|
map[expect string(parameterTable["map"])] <- DecodedJSON
|
||||||
|
pulsePrintt(tablepath)
|
||||||
pulseData[tablepath] <- map
|
pulseData[tablepath] <- map
|
||||||
} else {
|
} else {
|
||||||
pulseData[tablepath] <- DecodedJSON
|
pulseData[tablepath] <- DecodedJSON
|
||||||
@@ -35,7 +33,11 @@ bool function pulseRequestData(string givenURL, table parameterTable, string tab
|
|||||||
{
|
{
|
||||||
pulsePrintt("Something went wrong while getting data.")
|
pulsePrintt("Something went wrong while getting data.")
|
||||||
}
|
}
|
||||||
return NSHttpGet(givenURL, params, onSuccess, onFailure)
|
foreach (key, value in parameterTable)
|
||||||
|
{
|
||||||
|
requestTable[string(key)] <- [expect string(parameterTable[string(key)])]
|
||||||
|
}
|
||||||
|
return NSHttpGet(givenURL, requestTable, onSuccess, onFailure)
|
||||||
}
|
}
|
||||||
|
|
||||||
int function pulseParse(string parameter, string key, string value, string opt = "none")
|
int function pulseParse(string parameter, string key, string value, string opt = "none")
|
||||||
@@ -54,7 +56,7 @@ int function pulseParse(string parameter, string key, string value, string opt =
|
|||||||
{
|
{
|
||||||
return expect int(valTable[value])
|
return expect int(valTable[value])
|
||||||
} else {
|
} else {
|
||||||
actualValTable = expect table(valTable[value])
|
table actualValTable = expect table(valTable[value])
|
||||||
return expect int(actualValTable[opt])
|
return expect int(actualValTable[opt])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
global function pulseInit
|
global function pulseInit
|
||||||
|
global function pulseGetData
|
||||||
|
|
||||||
global table pulseData = {}
|
global table pulseData = {}
|
||||||
|
|
||||||
@@ -15,14 +16,14 @@ void function pulseInit()
|
|||||||
void function pulseGetData()
|
void function pulseGetData()
|
||||||
{
|
{
|
||||||
string URL = GetConVarString("ToneURL")
|
string URL = GetConVarString("ToneURL")
|
||||||
array URLpath = ["/weapons", "/weapons", "/gamemodes", "/gamemodes", "/maps"]
|
array <string> URLpath = ["/weapons", "/weapons", "/gamemodes", "/gamemodes", "/maps"]
|
||||||
array tablepath = ["weaponsLocal", "weaponsGlobal", "gamemodesAll", "gamemodesSeparated", "maps"]
|
array <string> tablepath = ["weaponsLocal", "weaponsGlobal", "gamemodesAll", "gamemodesSeparated", "maps"]
|
||||||
pulseRequestData(URL + URLpath[1], ["uid" = NSGetLocalPlayerUID()], tablepath[1])
|
pulseRequestData(URL + URLpath[0], {["player"] = NSGetLocalPlayerUID()}, tablepath[0])
|
||||||
pulseRequestData(URL + URLpath[2], ["uid" = "!" + NSGetLocalPlayerUID()], tablepath[2])
|
pulseRequestData(URL + URLpath[1], {["player"] = "!" + NSGetLocalPlayerUID()}, tablepath[1])
|
||||||
pulseRequestData(URL + URLpath[3], ["uid" = NSGetLocalPlayerUID()], tablepath[3])
|
pulseRequestData(URL + URLpath[2], {["player"] = NSGetLocalPlayerUID()}, tablepath[2])
|
||||||
foreach (map in file.allMaps)
|
foreach (map in file.allMaps)
|
||||||
{
|
{
|
||||||
pulseRequestData(URL + URLpath[4], ["uid" = NSGetLocalPlayerUID(), "map" = map.slice(3)], tablepath[4])
|
pulseRequestData(URL + URLpath[3], {["player"] = NSGetLocalPlayerUID(), ["map"] = map.slice(3)}, tablepath[3])
|
||||||
}
|
}
|
||||||
pulseRequestData(URL + URLpath[5], ["uid" = NSGetLocalPlayerUID()], tablepath[5])
|
pulseRequestData(URL + URLpath[4], {["player"] = NSGetLocalPlayerUID()}, tablepath[4])
|
||||||
}
|
}
|
||||||
@@ -124,6 +124,7 @@ void function MenuLobby_Init()
|
|||||||
PrecacheHUDMaterial( $"ui/menu/main_menu/motd_background_happyhour" )
|
PrecacheHUDMaterial( $"ui/menu/main_menu/motd_background_happyhour" )
|
||||||
|
|
||||||
AddUICallback_OnLevelInit( OnLobbyLevelInit )
|
AddUICallback_OnLevelInit( OnLobbyLevelInit )
|
||||||
|
pulseGetData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -234,16 +235,46 @@ void function SetupComboButtonTest( var menu )
|
|||||||
int headerIndex = 0
|
int headerIndex = 0
|
||||||
int buttonIndex = 0
|
int buttonIndex = 0
|
||||||
file.playHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_PLAY" )
|
file.playHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_PLAY" )
|
||||||
file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_FIND_GAME" )
|
|
||||||
file.lobbyButtons.append( file.findGameButton )
|
|
||||||
Hud_AddEventHandler( file.findGameButton, UIE_CLICK, BigPlayButton1_Activate )
|
|
||||||
|
|
||||||
file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_ROOM" )
|
bool isModded = IsNorthstarServer()
|
||||||
Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, DoRoomInviteIfAllowed )
|
|
||||||
|
|
||||||
|
// this will be the server browser
|
||||||
|
if ( isModded )
|
||||||
|
{
|
||||||
|
file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" )
|
||||||
|
file.lobbyButtons.append( file.findGameButton )
|
||||||
|
Hud_SetLocked( file.findGameButton, true )
|
||||||
|
Hud_AddEventHandler( file.findGameButton, UIE_CLICK, OpenServerBrowser )
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_FIND_GAME" )
|
||||||
|
file.lobbyButtons.append( file.findGameButton )
|
||||||
|
Hud_AddEventHandler( file.findGameButton, UIE_CLICK, BigPlayButton1_Activate )
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is used for launching private matches now
|
||||||
|
if ( isModded )
|
||||||
|
{
|
||||||
|
file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" )
|
||||||
|
Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, StartPrivateMatch )
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_ROOM" )
|
||||||
|
Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, DoRoomInviteIfAllowed )
|
||||||
|
}
|
||||||
|
|
||||||
file.inviteFriendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" )
|
file.inviteFriendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" )
|
||||||
Hud_AddEventHandler( file.inviteFriendsButton, UIE_CLICK, InviteFriendsIfAllowed )
|
Hud_AddEventHandler( file.inviteFriendsButton, UIE_CLICK, InviteFriendsIfAllowed )
|
||||||
|
|
||||||
|
if ( isModded )
|
||||||
|
{
|
||||||
|
Hud_SetEnabled( file.inviteFriendsButton, false )
|
||||||
|
Hud_SetVisible( file.inviteFriendsButton, false )
|
||||||
|
}
|
||||||
|
|
||||||
// file.toggleMenuModeButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LOBBY_SWITCH_FD" )
|
// file.toggleMenuModeButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LOBBY_SWITCH_FD" )
|
||||||
// Hud_AddEventHandler( file.toggleMenuModeButton, UIE_CLICK, ToggleLobbyMode )
|
// Hud_AddEventHandler( file.toggleMenuModeButton, UIE_CLICK, ToggleLobbyMode )
|
||||||
|
|
||||||
@@ -336,6 +367,16 @@ bool function MatchResultsExist()
|
|||||||
return true // TODO
|
return true // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void function StartPrivateMatch( var button )
|
||||||
|
{
|
||||||
|
if ( Hud_IsLocked( button ) )
|
||||||
|
return
|
||||||
|
|
||||||
|
ClientCommand( "StartPrivateMatchSearch" )
|
||||||
|
NSSetLoading(true)
|
||||||
|
NSUpdateListenServer()
|
||||||
|
}
|
||||||
|
|
||||||
void function DoRoomInviteIfAllowed( var button )
|
void function DoRoomInviteIfAllowed( var button )
|
||||||
{
|
{
|
||||||
if ( Hud_IsLocked( button ) )
|
if ( Hud_IsLocked( button ) )
|
||||||
@@ -1146,6 +1187,16 @@ void function SetUIPlayerCreditsInfo( var infoElement, int credits, int xp, int
|
|||||||
RuiSetImage( rui, "callsignIcon", callsignIcon.image )
|
RuiSetImage( rui, "callsignIcon", callsignIcon.image )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void function OpenServerBrowser( var button )
|
||||||
|
{
|
||||||
|
if ( Hud_IsLocked( button ) )
|
||||||
|
return
|
||||||
|
|
||||||
|
// nothing here yet lol
|
||||||
|
// look at OpenSelectedPlaylistMenu for advancing to server browser menu probably
|
||||||
|
AdvanceMenu( GetMenu( "ServerBrowserMenu" ) )
|
||||||
|
}
|
||||||
|
|
||||||
void function BigPlayButton1_Activate( var button )
|
void function BigPlayButton1_Activate( var button )
|
||||||
{
|
{
|
||||||
if ( Hud_IsLocked( button ) )
|
if ( Hud_IsLocked( button ) )
|
||||||
@@ -1189,7 +1240,7 @@ function UpdateLobbyUI()
|
|||||||
thread UpdateLobbyType()
|
thread UpdateLobbyType()
|
||||||
thread UpdateMatchmakingStatus()
|
thread UpdateMatchmakingStatus()
|
||||||
thread UpdateChatroomThread()
|
thread UpdateChatroomThread()
|
||||||
thread UpdateInviteJoinButton()
|
//thread UpdateInviteJoinButton()
|
||||||
thread UpdateInviteFriendsToNetworkButton()
|
thread UpdateInviteFriendsToNetworkButton()
|
||||||
thread UpdatePlayerInfo()
|
thread UpdatePlayerInfo()
|
||||||
|
|
||||||
@@ -1578,8 +1629,3 @@ void function Lobby_SetFDModeBasedOnSearching( string playlistToSearch )
|
|||||||
|
|
||||||
Lobby_SetFDMode( isFDMode )
|
Lobby_SetFDMode( isFDMode )
|
||||||
}
|
}
|
||||||
|
|
||||||
void function pulseRefresh
|
|
||||||
{
|
|
||||||
pulseGetData()
|
|
||||||
}
|
|
||||||
@@ -205,7 +205,7 @@ void function UpdateStatsForMap( string mapName )
|
|||||||
if ( mapName in pulseData && key in pulseData[mapName])
|
if ( mapName in pulseData && key in pulseData[mapName])
|
||||||
{
|
{
|
||||||
float modePlayedTime = 0
|
float modePlayedTime = 0
|
||||||
modePlayedTime = float(pulseParse(mapName, "gamemodesSeparated", modeName, "kills"))
|
modePlayedTime = float(pulseParse(mapName, "gamemodesSeparated", key, "kills"))
|
||||||
if ( modePlayedTime > 0 ) {
|
if ( modePlayedTime > 0 ) {
|
||||||
AddPieChartEntry( modes, customGamemodeNames[key], modePlayedTime, value)
|
AddPieChartEntry( modes, customGamemodeNames[key], modePlayedTime, value)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user