2023-04-08 18:33:43 -04:00
|
|
|
if Engine.GetCurrentMap() ~= "core_frontend" then
|
2023-04-08 19:09:02 -04:00
|
|
|
return
|
2023-04-08 18:33:43 -04:00
|
|
|
end
|
|
|
|
|
2023-04-12 17:39:36 -04:00
|
|
|
local enableLobbyMapVote = true -- toggle map vote in public lobby
|
|
|
|
local enableLargeServerBrowserButton = true -- toggle large server browser button
|
2023-04-11 15:14:59 -04:00
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
local utils = require("utils")
|
2023-04-12 18:12:11 -04:00
|
|
|
require("datasources_start_menu_tabs")
|
|
|
|
require("datasources_change_map_categories")
|
2023-04-20 18:05:53 -04:00
|
|
|
require("datasources_gamesettingsflyout_buttons")
|
2023-04-08 18:33:43 -04:00
|
|
|
|
2023-04-11 14:25:30 -04:00
|
|
|
CoD.LobbyButtons.MP_PUBLIC_MATCH = {
|
|
|
|
stringRef = "MENU_PLAY_CAPS",
|
|
|
|
action = NavigateToLobby_SelectionList,
|
|
|
|
param = "MPLobbyOnline",
|
|
|
|
customId = "btnPublicMatch",
|
|
|
|
}
|
|
|
|
|
|
|
|
CoD.LobbyButtons.MP_FIND_MATCH = {
|
|
|
|
stringRef = "MPUI_BASICTRAINING_CAPS",
|
|
|
|
action = OpenFindMatch,
|
|
|
|
customId = "btnFindMatch",
|
|
|
|
}
|
|
|
|
|
2023-04-11 15:32:27 -04:00
|
|
|
CoD.LobbyButtons.STATS = {
|
2023-04-08 18:33:43 -04:00
|
|
|
stringRef = "STATS",
|
|
|
|
action = function(self, element, controller, param, menu)
|
|
|
|
SetPerControllerTableProperty(controller, "disableGameSettingsOptions", true)
|
|
|
|
OpenPopup(menu, "BoiiiStatsMenu", controller)
|
|
|
|
end,
|
|
|
|
customId = "btnMPStats"
|
|
|
|
}
|
|
|
|
|
|
|
|
CoD.LobbyButtons.MP_START_GAME = {
|
|
|
|
stringRef = "MENU_START_GAME_CAPS",
|
|
|
|
action = function(self, element, controller, param, menu)
|
|
|
|
Engine.SetDvar("party_minplayers", 1)
|
|
|
|
Engine.Exec(nil, "launchgame")
|
|
|
|
end,
|
|
|
|
customId = "btnStartGame"
|
|
|
|
}
|
|
|
|
|
|
|
|
CoD.LobbyButtons.SETTING_UP_BOTS = {
|
|
|
|
stringRef = "MENU_SETUP_BOTS_CAPS",
|
|
|
|
action = function(self, element, controller, param, menu)
|
|
|
|
SetPerControllerTableProperty(controller, "disableGameSettingsOptions", true)
|
|
|
|
OpenPopup(menu, "GameSettings_Bots", controller)
|
|
|
|
end,
|
|
|
|
customId = "btnSettingUpBots"
|
|
|
|
}
|
|
|
|
|
2023-04-11 15:19:56 -04:00
|
|
|
CoD.LobbyButtons.GameSettingsFlyoutArenas = {
|
|
|
|
stringRef = "MPUI_SETUP_GAME_CAPS",
|
2023-04-12 17:39:36 -04:00
|
|
|
action = function(self, element, controller, param, menu)
|
|
|
|
SetPerControllerTableProperty(controller, "disableGameSettingsOptions", true)
|
|
|
|
OpenPopup(menu, "GameSettingsFlyoutMP", controller)
|
2023-04-11 15:19:56 -04:00
|
|
|
end,
|
|
|
|
customId = "btnGameSettingsFlyoutMP"
|
|
|
|
}
|
|
|
|
|
|
|
|
CoD.LobbyButtons.GameSettingsFlyoutMP = {
|
|
|
|
stringRef = "MPUI_SETUP_GAME_CAPS",
|
2023-04-12 17:39:36 -04:00
|
|
|
action = function(self, element, controller, param, menu)
|
|
|
|
SetPerControllerTableProperty(controller, "disableGameSettingsOptions", true)
|
|
|
|
OpenPopup(menu, "GameSettingsFlyoutMPCustom", controller)
|
2023-04-11 15:19:56 -04:00
|
|
|
end,
|
|
|
|
customId = "btnGameSettingsFlyoutMPCustom"
|
|
|
|
}
|
|
|
|
|
2023-04-11 15:30:21 -04:00
|
|
|
CoD.LobbyButtons.SERVER_BROWSER = {
|
|
|
|
stringRef = "MENU_SERVER_BROWSER_CAPS",
|
2023-04-12 17:39:36 -04:00
|
|
|
action = function(self, element, controller, param, menu)
|
|
|
|
SetPerControllerTableProperty(controller, "disableGameSettingsOptions", true)
|
|
|
|
OpenPopup(menu, "LobbyServerBrowserOnline", controller)
|
2023-04-11 15:30:21 -04:00
|
|
|
end,
|
|
|
|
customId = "btnDedicated"
|
|
|
|
}
|
2023-04-08 18:33:43 -04:00
|
|
|
|
2023-04-20 18:05:53 -04:00
|
|
|
local shouldShowMapVote = enableLobbyMapVote
|
2023-04-12 17:39:36 -04:00
|
|
|
local lobbyMapVote = function(lobbyMapVoteIsEnabled)
|
|
|
|
if lobbyMapVoteIsEnabled == true then
|
|
|
|
Engine.Exec(nil, "LobbyStopDemo")
|
2023-04-11 15:14:59 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
|
2023-04-11 15:32:27 -04:00
|
|
|
if menuId == LobbyData.UITargets.UI_MPLOBBYMAIN.id then
|
|
|
|
utils.RemoveSpaces(buttonTable)
|
2023-04-23 09:38:54 -04:00
|
|
|
local theaterIndex = utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.THEATER_MP)
|
|
|
|
if theaterIndex ~= nil then
|
|
|
|
utils.AddSpacer(buttonTable, theaterIndex - 1)
|
|
|
|
end
|
2023-04-11 15:32:27 -04:00
|
|
|
end
|
|
|
|
|
2023-04-08 18:33:43 -04:00
|
|
|
if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id or menuId == LobbyData.UITargets.UI_ZMLOBBYONLINE.id then
|
2023-04-11 15:32:27 -04:00
|
|
|
utils.AddSmallButton(controller, buttonTable, CoD.LobbyButtons.STATS)
|
2023-04-08 18:33:43 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id or menuId == LobbyData.UITargets.UI_ZMLOBBYONLINE.id or menuId == LobbyData.UITargets.UI_MPLOBBYMAIN.id or menuId == LobbyData.UITargets.UI_MPLOBBYLANGAME.id then
|
|
|
|
Engine.Mods_Lists_UpdateUsermaps()
|
|
|
|
end
|
|
|
|
|
|
|
|
if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id then
|
2023-04-20 18:05:53 -04:00
|
|
|
shouldShowMapVote = enableLobbyMapVote
|
2023-04-12 17:39:36 -04:00
|
|
|
if enableLargeServerBrowserButton then
|
2023-04-11 15:30:21 -04:00
|
|
|
utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.SERVER_BROWSER, 1)
|
|
|
|
end
|
2023-04-08 18:33:43 -04:00
|
|
|
elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEPUBLICGAME.id then
|
2023-04-11 15:32:27 -04:00
|
|
|
utils.RemoveButton(buttonTable, CoD.LobbyButtons.MP_PUBLIC_LOBBY_LEADERBOARD)
|
|
|
|
|
|
|
|
utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.MP_START_GAME, 1)
|
|
|
|
utils.AddSmallButton(controller, buttonTable, CoD.LobbyButtons.GameSettingsFlyoutMP, 2)
|
|
|
|
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.GameSettingsFlyoutMP))
|
|
|
|
|
2023-04-20 18:05:53 -04:00
|
|
|
lobbyMapVote(shouldShowMapVote)
|
|
|
|
shouldShowMapVote = false
|
2023-04-08 18:33:43 -04:00
|
|
|
elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEARENAGAME.id then
|
2023-04-11 15:32:27 -04:00
|
|
|
utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.MP_START_GAME, 1)
|
|
|
|
utils.AddSmallButton(controller, buttonTable, CoD.LobbyButtons.GameSettingsFlyoutArenas, 2)
|
|
|
|
|
|
|
|
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.GameSettingsFlyoutArenas))
|
|
|
|
end
|
|
|
|
|
|
|
|
if menuId == LobbyData.UITargets.UI_ZMLOBBYONLINE.id then
|
|
|
|
utils.RemoveButton(buttonTable, CoD.LobbyButtons.THEATER_ZM)
|
2023-04-23 09:38:54 -04:00
|
|
|
utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.THEATER_ZM)
|
2023-04-11 15:32:27 -04:00
|
|
|
|
|
|
|
utils.RemoveSpaces(buttonTable)
|
|
|
|
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.SERVER_BROWSER))
|
2023-04-23 09:38:54 -04:00
|
|
|
local bgbIndex = utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.ZM_BUBBLEGUM_BUFFS)
|
|
|
|
if bgbIndex ~= nil then
|
|
|
|
utils.AddSpacer(buttonTable, bgbIndex - 1)
|
|
|
|
end
|
2023-04-11 15:32:27 -04:00
|
|
|
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.STATS))
|
2023-04-08 18:33:43 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-04-08 19:09:02 -04:00
|
|
|
local oldAddButtonsForTarget = CoD.LobbyMenus.AddButtonsForTarget
|
2023-04-08 18:33:43 -04:00
|
|
|
CoD.LobbyMenus.AddButtonsForTarget = function(controller, id)
|
|
|
|
local model = nil
|
|
|
|
if Engine.IsLobbyActive(Enum.LobbyType.LOBBY_TYPE_GAME) then
|
|
|
|
model = Engine.GetModel(DataSources.LobbyRoot.getModel(controller), "gameClient.isHost")
|
|
|
|
else
|
|
|
|
model = Engine.GetModel(DataSources.LobbyRoot.getModel(controller), "privateClient.isHost")
|
|
|
|
end
|
|
|
|
local isLeader = nil
|
|
|
|
if model ~= nil then
|
|
|
|
isLeader = Engine.GetModelValue(model)
|
|
|
|
else
|
|
|
|
isLeader = 1
|
|
|
|
end
|
2023-04-08 19:09:02 -04:00
|
|
|
local result = oldAddButtonsForTarget(controller, id)
|
2023-04-08 18:33:43 -04:00
|
|
|
addCustomButtons(controller, id, result, isLeader)
|
|
|
|
return result
|
|
|
|
end
|