Add game files and server configs

This commit is contained in:
Ahrimdon
2024-02-27 03:20:09 -05:00
parent d2e50ebd30
commit e8e3442ed0
31 changed files with 13231 additions and 0 deletions

View File

@ -0,0 +1,238 @@
if (game:issingleplayer() or Engine.InFrontend()) then
return
end
f0_local0 = function(f1_arg0, f1_arg1)
LUI.FlowManager.RequestLeaveMenu(f1_arg0)
end
f0_local1 = function(f2_arg0, f2_arg1)
f2_arg0:setText(f2_arg1.message_text)
f2_arg0:dispatchEventToRoot({
name = "resize_popup"
})
end
f0_local2 = function(f3_arg0)
Engine.ExecFirstClient("xpartybackout")
Engine.ExecFirstClient("disconnect")
end
local f0_local3 = function(f4_arg0)
if Engine.GetDvarBool("squad_match") then
Engine.ExecFirstClient("disconnect")
else
Engine.ExecFirstClient("xpartydisbandafterround")
Engine.ExecFirstClient("disconnect")
end
end
local f0_local4 = function(f5_arg0)
return Engine.GetOnlineGame()
end
local f0_local5 = function(f6_arg0)
if f0_local4(f6_arg0) then
Engine.ExecFirstClient("xstopprivateparty")
Engine.ExecFirstClient("disconnect")
Engine.ExecFirstClient("xblive_privatematch 0")
Engine.ExecFirstClient("onlinegame 1")
Engine.ExecFirstClient("xstartprivateparty")
else
Engine.ExecFirstClient("disconnect")
end
end
local f0_local6 = function(f7_arg0)
local f7_local0 = Engine.GetDvarBool("squad_match")
Engine.ExecFirstClient("xstopprivateparty")
Engine.ExecFirstClient("xpartydisbandafterround")
if f7_local0 then
Engine.ExecFirstClient("disconnect")
Engine.ExecFirstClient("xblive_privatematch 0")
Engine.ExecFirstClient("onlinegame 1")
Engine.ExecFirstClient("xstartprivateparty")
else
Engine.NotifyServer("end_game", 1)
Engine.ExecFirstClient("xstartprivateparty")
end
end
local f0_local7 = function(f8_arg0, f8_arg1)
local f8_local0 = Engine.GetDvarBool("sv_running")
Game.HandleLeavePauseMenu()
if f8_local0 then
Engine.NotifyServer("end_game", 1)
else
f0_local5(f8_arg0)
end
LUI.FlowManager.RequestCloseAllMenus(f8_arg0)
end
local f0_local8 = function(f9_arg0, f9_arg1)
LUI.FlowManager.RequestLeaveMenu(f9_arg0)
Game.HandleLeavePauseMenu()
Engine.Exec("onPlayerQuit")
local f9_local0 = Engine.GetDvarBool("sv_running")
if Engine.GetDvarBool("squad_match") then
Squad.PostMatch(0, 0, 0, 0, true)
end
if f9_local0 then
f0_local3(f9_arg0)
else
f0_local2(f9_arg0)
end
LUI.FlowManager.RequestCloseAllMenus(f9_arg0)
end
local f0_local9 = function(f10_arg0, f10_arg1)
LUI.FlowManager.RequestLeaveMenu(f10_arg0)
Game.HandleLeavePauseMenu()
Engine.Exec("onPlayerQuit")
local f10_local0 = Engine.GetDvarBool("sv_running")
if Engine.GetDvarBool("squad_match") then
Squad.PostMatch(0, 0, 0, 0, true)
end
if f10_local0 then
f0_local6(f10_arg0)
else
f0_local5(f10_arg0)
end
LUI.FlowManager.RequestCloseAllMenus(f10_arg0)
end
local f0_local10 = function(f11_arg0)
local f11_local0 = Lobby.IsInPrivateParty()
if f11_local0 then
f11_local0 = Lobby.IsPrivatePartyHost()
if f11_local0 then
f11_local0 = not Lobby.IsAloneInPrivateParty()
end
end
return f11_local0
end
local f0_local11 = function(f12_arg0, f12_arg1)
if f0_local10(f12_arg0) then
LUI.FlowManager.RequestLeaveMenu(f12_arg0, true)
LUI.FlowManager.RequestAddMenu(f12_arg0, "popup_pull_party", false)
else
Game.HandleLeavePauseMenu()
Engine.Exec("onPlayerQuit")
local f12_local0 = Engine.GetDvarBool("sv_running")
if Engine.GetDvarBool("squad_match") then
Squad.PostMatch(0, 0, 0, 0, true)
end
if f12_local0 then
f0_local6(f12_arg0)
else
f0_local5(f12_arg0)
end
LUI.FlowManager.RequestCloseAllMenus(f12_arg0)
end
end
local f0_local12 = function()
local self = LUI.UIElement.new()
self.id = "end_game_id"
self:registerAnimationState("default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
alpha = 1
})
self:animateToState("default", 0)
LUI.MenuBuilder.BuildAddChild(self, {
type = "generic_yesno_popup",
id = "privateGame_options_list_id",
properties = {
message_text_alignment = LUI.Alignment.Left,
message_text = Engine.Localize("@LUA_MENU_END_GAME_DESC"),
popup_title = Engine.Localize("@LUA_MENU_LEAVE_GAME_TITLE"),
padding_top = 12,
yes_action = f0_local7
}
})
local f13_local1 = LUI.UIBindButton.new()
f13_local1.id = "endBackToGameStartButton"
f13_local1:registerEventHandler("button_start", f0_local0)
self:addElement(f13_local1)
return self
end
local f0_local13 = function()
local self = LUI.UIElement.new()
self.id = "leave_game_id"
self:registerAnimationState("default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
alpha = 1
})
self:animateToState("default", 0)
LUI.MenuBuilder.BuildAddChild(self, {
type = "generic_yesno_popup",
id = "publicGame_options_list_id",
properties = {
message_text_alignment = LUI.Alignment.Left,
message_text = Engine.Localize("@LUA_MENU_LEAVE_GAME_DESC"),
popup_title = Engine.Localize("@LUA_MENU_LEAVE_GAME_TITLE"),
padding_top = 12,
yes_action = f0_local11
}
})
local f14_local1 = LUI.UIBindButton.new()
f14_local1.id = "leaveBackToGameStartButton"
f14_local1:registerEventHandler("button_start", f0_local0)
self:addElement(f14_local1)
return self
end
local f0_local14 = function()
local self = LUI.UIElement.new()
self.id = "pull_party_out_id"
self:registerAnimationState("default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
alpha = 1
})
self:animateToState("default", 0)
LUI.MenuBuilder.BuildAddChild(self, {
type = "generic_yesno_popup",
id = "party_pullout_list_id",
properties = {
message_text_alignment = LUI.Alignment.Left,
message_text = Engine.Localize("@LUA_MENU_PULL_PARTY_DESC"),
popup_title = Engine.Localize("@LUA_MENU_LEAVE_GAME_TITLE"),
padding_top = 12,
yes_action = f0_local8,
no_action = f0_local9,
cancel_means_no = false
}
})
local f15_local1 = LUI.UIBindButton.new()
f15_local1.id = "leavePullPartyButton"
f15_local1:registerEventHandler("button_start", f0_local0)
self:addElement(f15_local1)
return self
end
LUI.MenuBuilder.m_types_build["popup_end_game"] = f0_local12
LUI.MenuBuilder.m_types_build["popup_leave_game"] = f0_local13
LUI.MenuBuilder.m_types_build["popup_pull_party"] = f0_local14

View File

@ -0,0 +1,6 @@
if (game:issingleplayer()) then
return
end
require("settings")
require("hud")

View File

@ -0,0 +1,163 @@
local mphud = require("LUI.mp_hud.MPHud")
local barheight = 18
local textheight = 13
local textoffsety = barheight / 2 - textheight / 2
function createinfobar()
local infobar = LUI.UIElement.new({
left = 180,
top = 5,
height = barheight,
width = 70,
leftAnchor = true,
topAnchor = true
})
infobar:registerAnimationState("hud_on", {
alpha = 1
})
infobar:registerAnimationState("hud_off", {
alpha = 0
})
return infobar
end
function populateinfobar(infobar)
elementoffset = 0
if (Engine.GetDvarBool("cg_infobar_fps")) then
infobar:addElement(infoelement({
label = "FPS: ",
getvalue = function()
return game:getfps()
end,
width = 70,
interval = 100
}))
end
if (Engine.GetDvarBool("cg_infobar_ping")) then
infobar:addElement(infoelement({
label = "Latency: ",
getvalue = function()
return game:getping() .. " ms"
end,
width = 115,
interval = 100
}))
end
end
function infoelement(data)
local container = LUI.UIElement.new({
bottomAnchor = true,
leftAnchor = true,
topAnchor = true,
width = data.width,
left = elementoffset
})
elementoffset = elementoffset + data.width + 10
local background = LUI.UIImage.new({
bottomAnchor = true,
leftAnchor = true,
topAnchor = true,
rightAnchor = true,
color = {
r = 0.3,
g = 0.3,
b = 0.3,
},
material = RegisterMaterial("distort_hud_bkgnd_ui_blur")
})
local labelfont = RegisterFont("fonts/bodyFontBold", textheight)
local label = LUI.UIText.new({
left = 5,
top = textoffsety + 1,
font = labelfont,
height = textheight,
leftAnchor = true,
topAnchor = true,
color = {
r = 0.8,
g = 0.8,
b = 0.8,
}
})
label:setText(data.label)
local _, _, left = GetTextDimensions(data.label, labelfont, textheight)
local value = LUI.UIText.new({
left = left + 5,
top = textoffsety,
font = RegisterFont("fonts/bodyFont", textheight),
height = textheight + 1,
leftAnchor = true,
topAnchor = true,
color = {
r = 0.6,
g = 0.6,
b = 0.6,
}
})
value:addElement(LUI.UITimer.new(data.interval, "update"))
value:setText(data.getvalue())
value:addEventHandler("update", function()
value:setText(data.getvalue())
end)
container:addElement(background)
container:addElement(label)
container:addElement(value)
return container
end
local updatehudvisibility = mphud.updateHudVisibility
mphud.updateHudVisibility = function(a1, a2)
updatehudvisibility(a1, a2)
local root = Engine.GetLuiRoot()
local menus = root:AnyActiveMenusInStack()
local infobar = root.infobar
if (not infobar) then
return
end
if (menus) then
infobar:animateToState("hud_off")
else
infobar:animateToState("hud_on")
end
end
local mphud = LUI.MenuBuilder.m_types_build["mp_hud"]
LUI.MenuBuilder.m_types_build["mp_hud"] = function()
local hud = mphud()
if (Engine.InFrontend()) then
return hud
end
local infobar = createinfobar()
local root = Engine.GetLuiRoot()
root.infobar = infobar
populateinfobar(infobar)
root:registerEventHandler("update_hud_infobar_settings", function()
infobar:removeAllChildren()
populateinfobar(infobar)
end)
hud.static:addElement(infobar)
return hud
end

View File

@ -0,0 +1,156 @@
local pcoptions = require("LUI.PCOptions")
game:addlocalizedstring("LUA_MENU_FPS", "FPS Counter")
game:addlocalizedstring("LUA_MENU_FPS_DESC", "Show FPS Counter")
game:addlocalizedstring("LUA_MENU_LATENCY", "Server Latency")
game:addlocalizedstring("LUA_MENU_LATENCY_DESC", "Show server latency")
pcoptions.VideoOptionsFeeder = function()
local items = {
pcoptions.OptionFactory(
"ui_r_displayMode",
"@LUA_MENU_DISPLAY_MODE",
nil,
{
{
text = "@LUA_MENU_MODE_FULLSCREEN",
value = "fullscreen"
},
{
text = "@LUA_MENU_MODE_WINDOWED_NO_BORDER",
value = "windowed_no_border"
},
{
text = "@LUA_MENU_MODE_WINDOWED",
value = "windowed"
}
},
nil,
true
),
pcoptions.SliderOptionFactory(
"profileMenuOption_blacklevel",
"@MENU_BRIGHTNESS",
"@MENU_BRIGHTNESS_DESC1",
SliderBounds.PCBrightness.Min,
SliderBounds.PCBrightness.Max,
SliderBounds.PCBrightness.Step,
function(element)
element:processEvent({
name = "brightness_over",
immediate = true
})
end,
function(element)
element:processEvent({
name = "brightness_up",
immediate = true
})
end,
true,
nil,
"brightness_updated"
),
pcoptions.OptionFactoryProfileData(
"renderColorBlind",
"profile_toggleRenderColorBlind",
"@LUA_MENU_COLORBLIND_FILTER",
"@LUA_MENU_COLOR_BLIND_DESC",
{
{
text = "@LUA_MENU_ENABLED",
value = true
},
{
text = "@LUA_MENU_DISABLED",
value = false
}
},
nil,
false
)
}
if Engine.IsMultiplayer() and not Engine.IsZombiesMode() then
table.insert(items, pcoptions.OptionFactory(
"cg_paintballFx",
"@LUA_MENU_PAINTBALL",
"@LUA_MENU_PAINTBALL_DESC",
{
{
text = "@LUA_MENU_ENABLED",
value = true
},
{
text = "@LUA_MENU_DISABLED",
value = false
}
},
nil,
false,
false
))
end
table.insert(items, pcoptions.OptionFactory(
"cg_infobar_ping",
"@LUA_MENU_LATENCY",
"@LUA_MENU_LATENCY_DESC",
{
{
text = "@LUA_MENU_ENABLED",
value = true
},
{
text = "@LUA_MENU_DISABLED",
value = false
}
},
function()
Engine.GetLuiRoot():processEvent({
name = "update_hud_infobar_settings"
})
end,
false,
false
))
table.insert(items, pcoptions.OptionFactory(
"cg_infobar_fps",
"@LUA_MENU_FPS",
"@LUA_MENU_FPS_DESC",
{
{
text = "@LUA_MENU_ENABLED",
value = true
},
{
text = "@LUA_MENU_DISABLED",
value = false
}
},
function()
Engine.GetLuiRoot():processEvent({
name = "update_hud_infobar_settings"
})
end,
false,
false
))
table.insert(items, {
type = "UIGenericButton",
id = "option_advanced_video",
properties = {
style = GenericButtonSettings.Styles.GlassButton,
button_text = Engine.Localize("@LUA_MENU_ADVANCED_VIDEO"),
desc_text = "",
button_action_func = pcoptions.ButtonMenuAction,
text_align_without_content = LUI.Alignment.Left,
menu = "advanced_video"
}
})
return items
end

View File

@ -0,0 +1,6 @@
if (game:issingleplayer() or not Engine.InFrontend()) then
return
end
require("menu_xboxlive")
require("menu_xboxlive_lobby")

View File

@ -0,0 +1,112 @@
local Lobby = Lobby
local MPLobbyOnline = LUI.mp_menus.MPLobbyOnline
local MenuData = LUI.mp_menus.MenuData
local MPLobbyUtils = LUI.mp_menus.MPLobbyUtils
game:addlocalizedstring("LUA_MENU_SERVERLIST", "Server List")
game:addlocalizedstring("LUA_MENU_SERVERLIST_DESC", "Browse available servers.");
LeaveXboxLive = function(f5_arg0)
local f73_local0 = Engine.GetFirstActiveController()
if f73_local0 ~= nil then
Engine.ExecNow("xstopprivateparty", f73_local0)
Cac.NotifyVirtualLobby("leave_lobby", Engine.GetXUIDByController(f73_local0))
Engine.SetSplitScreen(false)
Engine.ExecNow("forcesplitscreencontrol menu_xboxlive_CLOSE", f73_local0)
else
Engine.Exec("xstopprivateparty")
end
end
function LeaveLobby(a1)
LUI.MarketingPanel.ClearViewedMessages({ LUI.MarketingLocation.CaC, LUI.MarketingLocation.PlayOnline,
LUI.MarketingLocation.CaO })
LeaveXboxLive()
LUI.FlowManager.RequestLeaveMenuByName("menu_xboxlive_lobby", nil, true)
end
function menu_xboxlive(a1, a2)
Engine.SetDvarBool("ui_opensummary", false)
local menu = LUI.MPLobbyBase.new(a1, {
menu_title = "@PLATFORM_UI_HEADER_PLAY_MP_CAPS",
memberListState = Lobby.MemberListStates.Prelobby,
has_new_item_usage_widget = true
})
menu:setClass(LUI.MPLobbyOnline)
menu.handleGamepadButton = MPLobbyOnline.menu_xboxlive_handleGamepadButton
if Engine.IsCoreMode() then
menu:AddNewItemsWidget()
end
-- server list button
local serverListButton = menu:AddButton("@LUA_MENU_SERVERLIST", function(a1, a2)
LUI.FlowManager.RequestAddMenu(a1, "menu_systemlink_join", true, nil)
end)
serverListButton:setDisabledRefreshRate(500)
-- private match button
privateMatchButton = menu:AddButton("@MENU_PRIVATE_MATCH", MPLobbyOnline.OnPrivateMatch,
MPLobbyOnline.disablePrivateMatchButton)
privateMatchButton:rename("menu_xboxlive_private_match")
privateMatchButton:setDisabledRefreshRate(500)
-- combat training button
if Engine.IsCoreMode() then
game:addlocalizedstring("LUA_MENU_COMBAT", "Combat Training");
game:addlocalizedstring("LUA_MENU_COMBAT_DESC", "Rank up offline with bots.");
local FindGameButton = menu:AddButton("@LUA_MENU_COMBAT",
MPLobbyOnline.OnPublicMatch, MPLobbyOnline.disablePublicMatchButton)
FindGameButton:rename("menu_xboxlive_find_game")
FindGameButton:setDisabledRefreshRate(500)
end
if Engine.IsCoreMode() then
menu:AddCACButton()
menu:AddCAOButton()
menu:AddArmoryButton()
end
if not Engine.IsCoreMode() then
local leaderboardButton = menu:AddButton("@LUA_MENU_LEADERBOARD", "OpLeaderboardMain")
leaderboardButton:rename("OperatorMenu_leaderboard")
end
if Engine.IsZombiesMode() then
menu:AddButton("@ZOMBIES_MENU_MOVIES", "ZombiesMoviesMenu")
end
menu:AddOptionsButton()
local natType = Lobby.GetNATType()
if natType then
menu:AddHelp({
name = "add_button_helper_text",
button_ref = "nat",
helper_text = Engine.Localize("NETWORK_YOURNATTYPE", natType),
side = "left",
clickable = false
})
end
if Engine.IsZombiesMode() then
menu:AddZombiesStats(true)
end
menu.isSignInMenu = true
menu:registerEventHandler("gain_focus", LUI.MPLobbyOnline.OnGainFocus)
menu:registerEventHandler("player_joined", Cac.PlayerJoinedEvent)
menu:registerEventHandler("exit_live_lobby", LeaveLobby)
if PersistentBackground.IsCurrent(PersistentBackground.Variants.AARBackground) then
PersistentBackground.Hide(PersistentBackground.Duration)
end
if Engine.IsCoreMode() then
Engine.ExecNow("eliteclan_refresh", Engine.GetFirstActiveController())
end
return menu
end
LUI.MenuBuilder.m_types_build["menu_xboxlive"] = menu_xboxlive

View File

@ -0,0 +1,95 @@
local MPLobbyPublic = LUI.mp_menus.MPLobbyPublic
function StartButtonAction(f2_arg0, f2_arg1)
Engine.SetDvarInt("party_minplayers", 1)
end
function StartButtonText(f5_arg0, f5_arg1)
f5_arg0:processEvent({
name = "refresh_disabled"
})
f5_arg0:setText(Engine.Localize("@LUA_MENU_START_GAME"))
end
function OnLeaveLobby(f6_arg0)
LUI.MarketingPanel.ClearViewedMessages({
LUI.MarketingLocation.Lobby
})
LUI.FlowManager.RequestLeaveMenu(f6_arg0)
end
function OnGameSetup(f10_arg0, f10_arg1)
LUI.FlowManager.RequestAddMenu(f10_arg0, "gamesetup_menu_main", true, f10_arg1.controller, false)
end
function menu_xboxlive_lobby(f7_arg0, f7_arg1)
local f7_local0 = false
if not Engine.IsZombiesMode() and Engine.GetDvarBool("ui_opensummary") then
f7_local0 = true
end
if Engine.IsZombiesMode() then
ZombiesUpdateMapBkg()
end
local f7_local1 = LUI.MPLobbyBase.new(f7_arg0, {
menu_title = "@PLATFORM_UI_HEADER_PLAY_MP_CAPS",
has_match_summary = true,
has_new_item_usage_widget = true
}, true)
f7_local1:setClass(LUI.MPLobbyPublic)
if Engine.IsMultiplayer() then
f7_local1:AddReadyUpButton("pt_AliensReadyUpPublicInUse", StartButtonAction, false, StartButtonText)
-- f7_local1:AddButton( "@LUA_MENU_GAME_SETUP", OnGameSetup ) -- WIP
end
if Engine.IsCoreMode() then
f7_local1:AddNewItemsWidget()
f7_local1:AddCACButton()
f7_local1:AddCAOButton()
f7_local1:AddArmoryButton()
end
f7_local1:AddOptionsButton()
if not f7_local1:CheckAddMapAndMarketingPanels(f7_local0) then
f7_local1:registerEventHandler("CheckAddMapAndMarketingPanels", function(element, event)
LUI.MPLobbyPublic.CheckAddMapAndMarketingPanels(element, f7_local0)
end)
local self = LUI.UITimer.new(100, "CheckAddMapAndMarketingPanels")
self.id = "MPLobbyPublic_add_map_timer"
f7_local1.mapTimer = self
f7_local1:addElement(self)
end
f7_local1:registerEventHandler("exit_public_lobby", OnLeaveLobby)
f7_local1:registerEventHandler("player_joined", Cac.PlayerJoinedEvent)
f7_local1:registerEventHandler("loadout_request", Cac.PlayerJoinedEvent)
Lobby.EnteredLobby()
if f7_local0 then
LUI.InventoryUtils.ProcessLootExpiration()
end
return f7_local1
end
LUI.MenuBuilder.m_types_build["menu_xboxlive_lobby"] = menu_xboxlive_lobby
LUI.FlowManager.RegisterMenuStack("menu_xboxlive_lobby", function()
if Engine.IsCoreMode() and Playlist.GetPreselectedCategoryClass() ~= 8 then
return {
"mp_main_menu",
"menu_xboxlive",
"FindGameMenu",
"FindGameSubMenu"
}
else
return {
"mp_main_menu",
"menu_xboxlive",
"FindGameMenu"
}
end
end)
VLobby.InitMenuMode("menu_xboxlive_lobby", VirtualLobbyModes.LUI_MODE_LOBBY, function()
if LUI.MPLobbyBase.UseReadyUp then
Lobby.ClearLocalReadyUpFlag()
end
local f10_local0 = PersistentBackground.StackFunc(nil)
f10_local0()
end, LUI.MPLobbyBase.CollectGarbage)
LUI.FlowManager.RegisterStackResumeBehaviour("menu_xboxlive_lobby", PersistentBackground.StackFunc(nil))

View File

@ -0,0 +1,19 @@
if (game:issingleplayer()) then
return
end
function GetGameModeName()
return Engine.Localize(Engine.TableLookup(GameTypesTable.File, GameTypesTable.Cols.Ref, GameX.GetGameMode(), GameTypesTable.Cols.Name))
end
-- Allow players to change teams in game.
function CanChangeTeam()
local f9_local0 = GameX.GetGameMode()
local f9_local1
if f9_local0 ~= "aliens" and Engine.TableLookup(GameTypesTable.File, GameTypesTable.Cols.Ref, f9_local0, GameTypesTable.Cols.TeamChoice) == "1" then
f9_local1 = not MLG.IsMLGSpectator()
else
f9_local1 = false
end
return f9_local1
end

View File

@ -0,0 +1,30 @@
if (game:issingleplayer() or Engine.InFrontend()) then
return
end
function GetPartyMaxPlayers()
return Engine.GetDvarInt("sv_maxclients")
end
local scoreboard = LUI.mp_hud.Scoreboard
scoreboard.maxPlayersOnTeam = GetTeamLimitForMaxPlayers(GetPartyMaxPlayers())
scoreboard.scoreColumns.ping = {
width = Engine.IsZombiesMode() and 90 or 60,
title = "LUA_MENU_PING",
getter = function(scoreinfo)
return scoreinfo.ping == 0 and "BOT" or tostring(scoreinfo.ping)
end
}
local getcolumns = scoreboard.getColumnsForCurrentGameMode
scoreboard.getColumnsForCurrentGameMode = function(a1)
local columns = getcolumns(a1)
if (Engine.IsZombiesMode()) then
table.insert(columns, scoreboard.scoreColumns.ping)
end
return columns
end

View File

@ -0,0 +1,5 @@
if (game:issingleplayer() or not Engine.InFrontend()) then
return
end
require("serverlist")

View File

@ -0,0 +1,76 @@
if (game:issingleplayer() or not Engine.InFrontend()) then
return
end
local SystemLinkJoinMenu = LUI.mp_menus.SystemLinkJoinMenu
game:addlocalizedstring("PLATFORM_SYSTEM_LINK_TITLE", "SERVER LIST")
game:addlocalizedstring("MENU_NUMPLAYERS", "Players")
game:addlocalizedstring("MENU_PING", "Ping")
local offsets = {10, 400, 600, 900, 1075}
local columns = {"@MENU_HOST_NAME", "@MENU_MAP", "@MENU_TYPE1", "@MENU_NUMPLAYERS", "@MENU_PING"}
SystemLinkJoinMenu.AddServerButton = function(menu, controller, index)
local serverInformation = nil
local button = menu:AddButton("", SystemLinkJoinMenu.OnJoinGame)
if index == nil then
button:makeNotFocusable()
serverInformation = function(i)
return Engine.Localize(columns[i])
end
else
button:makeFocusable()
button.index = index
serverInformation = function(i)
return Lobby.GetServerData(controller, index, i - 1)
end
end
for size = 1, #offsets do
SystemLinkJoinMenu.MakeText(button, offsets[size], serverInformation(size))
end
return button
end
function menu_systemlink_join(f19_arg0, f19_arg1)
local menu = LUI.MenuTemplate.new(f19_arg0, {
menu_title = "@PLATFORM_SYSTEM_LINK_TITLE",
menu_width = CoD.DesignGridHelper(28)
})
Lobby.BuildServerList(Engine.GetFirstActiveController())
Lobby.RefreshServerList(Engine.GetFirstActiveController())
SystemLinkJoinMenu.UpdateGameList(menu)
menu:registerEventHandler("updateGameList", SystemLinkJoinMenu.UpdateGameList)
menu:addElement(LUI.UITimer.new(250, "updateGameList"))
menu:AddHelp({
name = "add_button_helper_text",
button_ref = "button_alt1",
helper_text = Engine.Localize("@MENU_SB_TOOLTIP_BTN_REFRESH"),
side = "right",
clickable = true,
priority = -1000
}, function(f10_arg0, f10_arg1)
SystemLinkJoinMenu.RefreshServers(f10_arg0, f10_arg1, menu)
end)
menu:AddHelp({
name = "add_button_helper_text",
button_ref = "button_action",
helper_text = Engine.Localize("@MENU_JOIN_GAME1"),
side = "right",
clickable = false,
priority = -1000
})
menu:AddBackButton()
return menu
end
LUI.MenuBuilder.m_types_build["menu_systemlink_join"] = menu_systemlink_join

View File

@ -0,0 +1,204 @@
local isclasslocked = Cac.IsCustomClassLocked
Cac.IsCustomClassLocked = function(...)
if (Engine.GetDvarBool("cg_unlockall_classes")) then
return false
end
return isclasslocked(table.unpack({ ... }))
end
local isdlcclasslocked = Cac.IsCustomClassDlcLocked
Cac.IsCustomClassDlcLocked = function(...)
if (Engine.GetDvarBool("cg_unlockall_classes")) then
return false
end
return isdlcclasslocked(table.unpack({ ... }))
end
if (game:issingleplayer() or not Engine.InFrontend()) then
return
end
game:addlocalizedstring("LUA_MENU_STATS", "Stats")
game:addlocalizedstring("LUA_MENU_STATS_DESC", "Edit player stats settings.")
game:addlocalizedstring("LUA_MENU_UNLOCKALL_ITEMS", "Unlock All Items")
game:addlocalizedstring("LUA_MENU_UNLOCKALL_ITEMS_DESC", "Unlock items that are level-locked by the player's stats.")
game:addlocalizedstring("LUA_MENU_UNLOCKALL_LOOT", "Unlock All Loot")
game:addlocalizedstring("LUA_MENU_UNLOCKALL_LOOT_DESC", "Unlock supply drop loot.")
game:addlocalizedstring("LUA_MENU_UNLOCKALL_CLASSES", "Unlock All Classes")
game:addlocalizedstring("LUA_MENU_UNLOCKALL_CLASSES_DESC", "Unlock extra class slots.")
game:addlocalizedstring("LUA_MENU_PRESTIGE", "Prestige")
game:addlocalizedstring("LUA_MENU_PRESTIGE_DESC", "Edit prestige level.")
game:addlocalizedstring("LUA_MENU_RANK", "Rank")
game:addlocalizedstring("LUA_MENU_RANK_DESC", "Edit rank.")
local armorybutton = LUI.MPLobbyBase.AddArmoryButton
LUI.MPLobbyBase.AddArmoryButton = function(menu)
menu:AddButton("@LUA_MENU_STATS", function(a1, a2)
LUI.FlowManager.RequestAddMenu(a1, "menu_stats", true, nil)
end)
end
-- button stuff for configuring
function IsEnabled(dvar)
local enabled = Engine.GetDvarBool(dvar)
if enabled then
return Engine.Localize("@LUA_MENU_ENABLED")
end
return Engine.Localize("@LUA_MENU_DISABLED")
end
function ToggleEnable(dvar)
local enabled = Engine.GetDvarBool(dvar)
if enabled then
Engine.SetDvarBool(dvar, false)
else
Engine.SetDvarBool(dvar, true)
end
end
function GoDirection(dvar, direction, callback)
local value = Engine.GetDvarString(dvar)
value = tonumber(value)
-- get rank data
local max = nil
if (dvar == "ui_rank_level_") then
max = Rank.GetMaxRank(CoD.PlayMode.Core)
elseif (dvar == "ui_prestige_level") then
max = Lobby.GetMaxPrestigeLevel()
end
local new_value = nil
if (direction == "down") then
new_value = value - 1
elseif (direction == "up") then
new_value = value + 1
end
-- checking to make sure its < 0 or > max
if (new_value < 0) then
new_value = max
elseif (new_value > max) then
new_value = 0
end
callback(new_value)
Engine.SetDvarFromString(dvar, new_value .. "")
end
LUI.MenuBuilder.registerType("menu_stats", function(a1, a2)
local menu = LUI.MenuTemplate.new(a1, {
menu_title = Engine.ToUpperCase(Engine.Localize("@LUA_MENU_STATS")),
menu_width = GenericMenuDims.menu_right_wide - GenericMenuDims.menu_left,
menu_height = 548
})
menu:setClass(LUI.Options)
menu.controller = a2.exclusiveController
local itemsbutton = menu:AddButtonVariant(GenericButtonSettings.Variants.Select,
"@LUA_MENU_UNLOCKALL_ITEMS", "@LUA_MENU_UNLOCKALL_ITEMS_DESC", function()
return IsEnabled("cg_unlockall_items")
end, function()
ToggleEnable("cg_unlockall_items")
end, function()
ToggleEnable("cg_unlockall_items")
end)
local lootbutton = menu:AddButtonVariant(GenericButtonSettings.Variants.Select,
"@LUA_MENU_UNLOCKALL_LOOT", "@LUA_MENU_UNLOCKALL_LOOT_DESC", function()
return IsEnabled("cg_unlockall_loot")
end, function()
ToggleEnable("cg_unlockall_loot")
end, function()
ToggleEnable("cg_unlockall_loot")
end)
local classesbutton = menu:AddButtonVariant(GenericButtonSettings.Variants.Select,
"@LUA_MENU_UNLOCKALL_CLASSES", "@LUA_MENU_UNLOCKALL_CLASSES_DESC", function()
return IsEnabled("cg_unlockall_classes")
end, function()
ToggleEnable("cg_unlockall_classes")
end, function()
ToggleEnable("cg_unlockall_classes")
end)
local prestige = Engine.GetPlayerDataEx(0, CoD.StatsGroup.Ranked, "prestige") or 0
local experience = Engine.GetPlayerDataEx(0, CoD.StatsGroup.Ranked, "experience") or 0
local rank = AAR.GetRankForXP(experience, prestige)
local prestigevalue = prestige
local rankvalue = rank
-- save changes made
local save_changes = function()
Engine.SetPlayerDataEx(0, CoD.StatsGroup.Ranked, "prestige", tonumber(prestigevalue))
local rank = tonumber(rankvalue)
local prestige = Engine.GetPlayerDataEx(0, CoD.StatsGroup.Ranked, "prestige") or 0
local experience = rank == 0 and 0 or Rank.GetRankMaxXP(tonumber(rankvalue) - 1, prestige)
Engine.SetPlayerDataEx(0, CoD.StatsGroup.Ranked, "experience", experience)
end
-- back callback
local back = function()
save_changes()
LUI.common_menus.Options.HideOptionsBackground()
LUI.FlowManager.RequestLeaveMenu(menu)
end
-- create buttons and create callbacks
CreateEditButton(menu, "ui_prestige_level", "@LUA_MENU_PRESTIGE", "@LUA_MENU_PRESTIGE_DESC", function(value)
prestigevalue = value
end)
CreateEditButton(menu, "ui_rank_level_", "@LUA_MENU_RANK", "@LUA_MENU_RANK_DESC", function(value)
rankvalue = value
end)
menu:AddBottomDescription(menu:InitScrolling())
menu:AddBackButton(back)
LUI.common_menus.Options.ShowOptionsBackground()
return menu
end)
function CreateEditButton(menu, dvar, name, desc, callback)
local prestige = Engine.GetPlayerDataEx(0, CoD.StatsGroup.Ranked, "prestige") or 0
local experience = Engine.GetPlayerDataEx(0, CoD.StatsGroup.Ranked, "experience") or 0
local dvarValue = nil
local max = nil
if (dvar == "ui_rank_level_") then
dvarValue = AAR.GetRankForXP(experience, prestige)
max = Rank.GetMaxRank(CoD.PlayMode.Core)
elseif (dvar == "ui_prestige_level") then
dvarValue = prestige
max = Lobby.GetMaxPrestigeLevel()
end
Engine.SetDvarFromString(dvar, dvarValue .. "")
menu:AddButtonVariant(GenericButtonSettings.Variants.Select, name, desc, function()
local dvarString = Engine.GetDvarString(dvar)
if (dvar == "ui_rank_level_") then
dvarString = tonumber(dvarString) + 1
end
return tostring(dvarString)
end, function()
GoDirection(dvar, "down", callback)
end, function()
GoDirection(dvar, "up", callback)
end)
end