iw6-lui/lui/mp_menus/aarscoreboard.dec.lua
2024-09-12 17:25:45 +02:00

801 lines
19 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = function ( f1_arg0 )
local f1_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" )
local f1_local1 = Engine.GetPlayerDataEx( f1_local0.controller, CoD.StatsGroup.Common, "round", "scoreboardType" )
local f1_local2
if f1_local1 == "allies" or f1_local1 == "axis" then
f1_local2 = false
else
f1_local2 = true
end
local f1_local3 = {
default = {
"score",
"kills",
"deaths",
"assists"
},
war = {
"score",
"kills",
"deaths",
"assists"
},
dom = {
"score",
"kills",
"deaths",
"captures"
},
sd = {
"score",
"kills",
"deaths",
"plants"
},
conf = {
"score",
"kills",
"deaths",
"tags"
},
dm = {
"dm_score",
"kills",
"deaths",
"dm_streak"
},
sr = {
"score",
"kills",
"deaths",
"rescues"
},
blitz = {
"score",
"kills",
"deaths",
"captures"
},
cranked = {
"score",
"kills",
"deaths",
"assists"
},
cranked_ffa = {
"cranked_ffa_score",
"kills",
"deaths",
"assists"
},
sotf = {
"score",
"kills",
"deaths",
"assists"
},
sotf_ffa = {
"sotf_ffa_score",
"kills",
"deaths",
"dm_streak"
},
infect = {
"score",
"kills",
"deaths",
"time"
},
grind = {
"score",
"kills",
"deaths",
"scores"
},
horde = {
"kills",
"revives",
"crates"
},
gun = {
"score",
"kills",
"deaths",
"gun_knives"
},
siege = {
"score",
"kills",
"deaths",
"captures"
}
}
local f1_local4 = {
score = {
"LUA_MENU_SCORE",
"score"
},
kills = {
"LUA_MENU_KILLS",
"kills"
},
deaths = {
"LUA_MENU_DEATHS",
"deaths"
},
assists = {
"LUA_MENU_ASSISTS",
"assists"
},
cranked_ffa_score = {
"LUA_MENU_SCORE",
"extrascore0"
},
sotf_ffa_score = {
"LUA_MENU_SCORE",
"extrascore0"
},
dm_score = {
"LUA_MENU_SCORE",
"extrascore0"
},
rescues = {
"LUA_MENU_RESCUES",
"extrascore0"
},
captures = {
"LUA_MENU_CAPTURES",
"extrascore0"
},
tags = {
"LUA_MENU_TAGS",
"extrascore0"
},
time = {
"LUA_MENU_TIME",
"extrascore0"
},
scores = {
"LUA_MENU_SCORES",
"extrascore0"
},
plants = {
"LUA_MENU_PLANTS",
"extrascore0"
},
revives = {
"LUA_MENU_REVIVES",
"assists"
},
crates = {
"LUA_MENU_CRATES",
"extrascore0"
},
dm_streak = {
"MENU_STREAK",
"assists"
},
gun_knives = {
"PATCH_MENU_STABS",
"assists"
}
}
local f1_local5
if f1_local2 then
f1_local5 = f1_local3[f1_arg0 .. "_ffa"]
if not f1_local5 then
else
local f1_local6 = {}
for f1_local10, f1_local11 in ipairs( f1_local5 ) do
f1_local6[f1_local10] = {
Engine.Localize( f1_local4[f1_local11][1] ),
f1_local4[f1_local11][2]
}
end
return f1_local6
end
end
f1_local5 = f1_local3[f1_arg0] or f1_local3.default
end
function ScoreboardListRowFeeder( f2_arg0 )
local f2_local0 = {}
local f2_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" )
local f2_local2 = f2_local1.controller
local f2_local3 = Engine.GetPlayerDataEx( f2_local2, CoD.StatsGroup.Common, "round", "gameMode" )
local f2_local4 = f0_local0( f2_local3 )
f2_local0[#f2_local0 + 1] = {
type = "UIImage",
id = "small_spacer_id",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 20,
left = 0,
right = 0,
material = RegisterMaterial( "white" ),
red = 1,
green = 1,
blue = 1,
alpha = 0
}
}
}
local f2_local5 = {}
if Engine.IsAliensMode() then
table.insert( f2_local5, Engine.Localize( "@LUA_MENU_PLAYER_NAME_CAPS" ) )
table.insert( f2_local5, Engine.Localize( "@MPUI_SCORE" ) )
table.insert( f2_local5, Engine.Localize( "@MPUI_KILLS" ) )
if not isAliensSolo() then
table.insert( f2_local5, Engine.Localize( "@MPUI_ASSISTS" ) )
end
table.insert( f2_local5, Engine.Localize( "@ALIENS_REVIVES" ) )
if not AAR.AreChaosStats( f2_local3 ) then
table.insert( f2_local5, Engine.Localize( "@ALIENS_DRILL_RESTARTS" ) )
end
table.insert( f2_local5, Engine.Localize( "@MENU_DOWNS" ) )
else
local f2_local6 = {}
f2_local5 = Engine.Localize( "@LUA_MENU_PLAYER_NAME_CAPS" )
for f2_local9, f2_local10 in pairs( f2_local4 ) do
f2_local5[#f2_local5 + 1] = f2_local10[1]
end
end
local f2_local6 = {}
local f2_local7 = 788
local f2_local8 = 0
for f2_local9 = #f2_local5, 1, -1 do
if f2_local9 == 1 then
f2_local6[f2_local9] = f2_local7 - f2_local8
else
local f2_local12, f2_local13, f2_local14, f2_local15 = GetTextDimensions( f2_local5[f2_local9], CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height )
f2_local6[f2_local9] = f2_local14 - f2_local12 + 20
f2_local8 = f2_local8 + f2_local6[f2_local9]
end
end
local f2_local9 = {}
for f2_local10 = 1, #f2_local5, 1 do
f2_local9[#f2_local9 + 1] = CreateScoreBoardHeaderCell( "scoreboard_header_" .. f2_local10, f2_local5[f2_local10], f2_local6[f2_local10], f2_local10 % 2 == 1 )
end
f2_local0[#f2_local0 + 1] = {
type = "UIHorizontalList",
properties = {},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 25,
left = 0,
right = 0
}
},
children = f2_local9
}
local f2_local11 = Engine.GetClientMatchData( "scoreboardPlayerCount" )
local f2_local16 = ""
if Engine.GetUsernameByController then
f2_local16 = Engine.GetUsernameByController( f2_local2 )
end
local f2_local12 = "none"
if f2_local11 ~= nil and f2_local11 > 0 then
for f2_local13 = 1, f2_local11, 1 do
local f2_local17 = Engine.GetClientMatchData( "scoreboards", Engine.GetPlayerDataEx( f2_local2, CoD.StatsGroup.Common, "round", "scoreboardType" ), f2_local13 - 1 )
if f2_local17 >= 0 and Engine.GetClientMatchData( "players", f2_local17, "xuid" ) == f2_local16 then
f2_local12 = Engine.GetClientMatchData( "players", f2_local17, "team" )
break
end
end
end
local f2_local13 = LUI.mp_menus.Aliens
local f2_local14 = {}
if Engine.IsAliensMode() then
for f2_local15 = 0, 3, 1 do
if f2_local13.GetGamerTagFromClient( f2_local15 ) ~= "" then
table.insert( f2_local14, f2_local15 )
end
end
end
for f2_local15 = 1, AAR.Scoreboard.NumRows, 1 do
local f2_local17 = f2_local15
local f2_local20 = 0
if f2_local17 % 2 == 1 then
f2_local20 = 0.25
end
local f2_local21 = -1
local f2_local22 = ""
local f2_local23 = "none"
local f2_local24 = 0
local f2_local25 = 0
local f2_local26 = 0
local f2_local27 = 0
local f2_local28 = ""
local f2_local29 = ""
local f2_local30 = ""
local f2_local31 = ""
local f2_local32 = ""
local f2_local33 = ""
if Engine.IsAliensMode() then
if f2_local14[f2_local17] then
local f2_local34 = f2_local14[f2_local17]
f2_local22 = f2_local13.GetGamerTagFromClient( f2_local34 )
f2_local28 = f2_local13.GetScoreFromClient( f2_local34 )
f2_local29 = f2_local13.GetKillsFromClient( f2_local34 )
f2_local30 = f2_local13.GetAssistsFromClient( f2_local34 )
f2_local32 = f2_local13.GetRevivesFromClient( f2_local34 )
f2_local33 = f2_local13.GetDrillRestartsFromClient( f2_local34 )
f2_local31 = f2_local13.GetDownsFromClient( f2_local34 )
end
else
local f2_local34 = Engine.GetPlayerDataEx( f2_local2, CoD.StatsGroup.Common, "round", "scoreboardType" )
if f2_local34 ~= "none" and f2_local11 ~= nil and f2_local17 - 1 < f2_local11 then
f2_local21 = Engine.GetClientMatchData( "scoreboards", f2_local34, f2_local17 - 1 )
end
if f2_local21 >= 0 and (f2_local34 == "allies" or f2_local34 == "axis") then
f2_local23 = Engine.GetClientMatchData( "players", f2_local21, "team" )
if f2_local23 == "axis" or f2_local23 == "allies" then
if f2_local12 == "none" then
if f2_local23 == "axis" then
f2_local24 = AAR.Swatch.enemy.r
f2_local25 = AAR.Swatch.enemy.g
f2_local26 = AAR.Swatch.enemy.b
else
f2_local24 = AAR.Swatch.friendly.r
f2_local25 = AAR.Swatch.friendly.g
f2_local26 = AAR.Swatch.friendly.b
end
elseif f2_local23 == f2_local12 then
f2_local24 = AAR.Swatch.friendly.r
f2_local25 = AAR.Swatch.friendly.g
f2_local26 = AAR.Swatch.friendly.b
else
f2_local24 = AAR.Swatch.enemy.r
f2_local25 = AAR.Swatch.enemy.g
f2_local26 = AAR.Swatch.enemy.b
end
f2_local27 = 0.65
end
end
end
f2_local0[#f2_local0 + 1] = {
type = "UIElement",
properties = {},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 26,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
properties = {},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "white" ),
red = 0,
green = 0,
blue = 0,
alpha = f2_local20
}
}
},
{
type = "UIImage",
properties = {},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 1,
bottom = -1,
left = -3,
right = 0,
material = RegisterMaterial( "scoreboard_team_player" ),
red = f2_local24,
green = f2_local25,
blue = f2_local26,
alpha = f2_local27
}
}
},
{
type = "UIHorizontalList",
properties = {},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 3,
right = 0
}
},
childrenFeeder = function ( f3_arg0 )
local f3_local0 = {}
local f3_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" )
local f3_local2 = f3_local1.controller
local f3_local3 = Engine.GetPlayerDataEx( f3_local2, CoD.StatsGroup.Common, "round", "gameMode" )
if Engine.IsAliensMode() then
f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "player_name_" .. f2_local17, f2_local22, f2_local6[1], true, LUI.Alignment.Left, true )
f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "score_" .. f2_local17, f2_local28, f2_local6[2], false )
f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "kills_" .. f2_local17, f2_local29, f2_local6[3], true )
local f3_local4 = 4
if not isAliensSolo() then
f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "assists_" .. f2_local17, f2_local30, f2_local6[f3_local4], false )
f3_local4 = f3_local4 + 1
end
f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "revives_" .. f2_local17, f2_local32, f2_local6[f3_local4], true )
f3_local4 = f3_local4 + 1
if not AAR.AreChaosStats( f3_local3 ) then
f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "drills_" .. f2_local17, f2_local33, f2_local6[f3_local4], false )
f3_local4 = f3_local4 + 1
end
f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "deaths_" .. f2_local17, f2_local31, f2_local6[f3_local4], true )
else
local f3_local4 = -1
local f3_local5 = ""
local f3_local6 = Engine.GetPlayerDataEx( f3_local2, CoD.StatsGroup.Common, "round", "scoreboardType" )
if f3_local6 ~= "none" and f2_local11 ~= nil and f2_local17 - 1 < f2_local11 then
f3_local4 = Engine.GetClientMatchData( "scoreboards", f3_local6, f2_local17 - 1 )
end
if f3_local4 >= 0 then
f3_local5 = Engine.GetClientMatchData( "players", f3_local4, "xuid" )
end
f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "player_name_" .. f2_local17, f3_local5, f2_local6[1], true, LUI.Alignment.Left )
for f3_local11, f3_local12 in pairs( f0_local0( f3_local3 ) ) do
local f3_local10 = ""
if f3_local4 >= 0 then
f3_local10 = Engine.GetClientMatchData( "players", f3_local4, f3_local12[2] )
if f3_local3 == "infect" and f3_local12[2] == "extrascore0" then
f3_local10 = CoD.FormatInfectedTime( f3_local10, true )
elseif (f3_local3 == "dm" or f3_local3 == "sotf_ffa") and f3_local12[2] == "extrascore0" then
f3_local10 = f3_local10 * Engine.GetClientMatchData( "players", f3_local4, "score" )
end
end
f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( f3_local12[2] .. "_" .. f2_local17, f3_local10, f2_local6[f3_local11 + 1], false )
end
end
return f3_local0
end
}
},
id = "scoreboard_line_" .. f2_local17
}
end
return f2_local0
end
function CreateScoreBoardHeaderCell( f4_arg0, f4_arg1, f4_arg2, f4_arg3 )
local f4_local0 = {
type = "UIElement",
id = f4_arg0,
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = f4_arg2
}
}
}
local f4_local1 = {}
local f4_local2 = {
type = "UIImage",
id = "bkg_1",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = -1,
left = 0,
right = 0,
material = RegisterMaterial( "white" ),
red = 1,
green = 1,
blue = 1,
alpha = 0.15
}
}
}
local f4_local3 = {
type = "UIImage",
id = "bkg_2",
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -1,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "white" ),
red = 0,
green = 0,
blue = 0
}
}
}
local f4_local4 = {
type = "UIImage",
id = "bkg_3"
}
local f4_local5 = {}
local f4_local6 = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "white" ),
red = 0,
green = 0,
blue = 0
}
local f4_local7
if f4_arg3 then
f4_local7 = 0.1
if not f4_local7 then
else
f4_local6.alpha = f4_local7
f4_local5.default = f4_local6
f4_local4.states = f4_local5
f4_local5 = {
type = "UIText",
id = "label_text_id",
properties = {
text = f4_arg1
},
states = {
default = {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -CoD.TextSettings.NormalFont.Height,
bottom = 0,
left = 10,
right = 0,
alignment = LUI.Alignment.Left,
font = CoD.TextSettings.NormalFont.Font,
red = AAR.Swatch.header_text.r,
green = AAR.Swatch.header_text.g,
blue = AAR.Swatch.header_text.b
}
}
}
f4_local1[1] = f4_local2
f4_local1[2] = f4_local3
f4_local1[3] = f4_local4
f4_local1[4] = f4_local5
f4_local0.children = f4_local1
return f4_local0
end
end
f4_local7 = 0
end
function CreateScoreBoardEntryCell( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5 )
local f5_local0 = {
type = "UIElement",
id = f5_arg0,
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = f5_arg2
}
}
}
local f5_local1 = {}
local f5_local2 = {}
local f5_local3
if f5_arg5 then
f5_local3 = "UIMarqueeText"
if not f5_local3 then
else
f5_local2.type = f5_local3
f5_local2.properties = {
text = f5_arg1,
textStyle = CoD.TextStyle.Shadowed
}
f5_local3 = {}
local f5_local4 = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
height = CoD.TextSettings.NormalFont.Height
}
local f5_local5
if f5_arg4 == LUI.Alignment.Left then
f5_local5 = 5
if not f5_local5 then
else
f5_local4.left = f5_local5
f5_local4.right = -10
f5_local4.alignment = f5_arg4 or LUI.Alignment.Right
f5_local4.font = CoD.TextSettings.NormalFont.Font
f5_local4.red = Colors.white.r
f5_local4.green = Colors.white.g
f5_local4.blue = Colors.white.b
f5_local3.default = f5_local4
f5_local2.states = f5_local3
f5_local1[1] = f5_local2
f5_local0.children = f5_local1
return f5_local0
end
end
f5_local5 = 0
end
end
f5_local3 = "UIText"
end
function mp_scoreboard_page()
return {
type = "UIVerticalList",
id = "mp_scoreboard_page_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 1,
right = -1
}
},
childrenFeeder = ScoreboardListRowFeeder
}
end
function mp_scoreboard_main()
return {
type = "UIElement",
id = "mp_scoreboard_main_id",
properties = {
page_idx = 1,
num_pages = 3
},
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -AAR.Scoreboard.Layout.Height * 0.5,
bottom = AAR.Scoreboard.Layout.Height * 0.5,
left = -AAR.Layout.Width / 2,
right = AAR.Layout.Width / 2
}
},
children = {
{
type = "generic_drop_shadow",
id = "description_drop_shadow1",
properties = {
offset_shadow = 0
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
alpha = 0.35
}
}
},
{
type = "generic_menu_background",
id = "aar_match_summary_main_bkg",
properties = {
fill_alpha = 1
}
},
{
type = "aar_title_bar",
id = "aar_scoreboard_title_bar_id",
properties = {
title_text = Engine.Localize( "@LUA_MENU_GAME_SUMMARY_CAPS" ),
subtitle_text = Engine.Localize( "@LUA_MENU_SCOREBOARD_CAPS" )
}
},
{
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "mp_scoreboard_page",
id = "scoreboard_id"
},
{
type = "aar_footer_bar",
id = "oink_2"
}
}
},
{
type = "aar_dots",
id = "AARSummaryDotsID",
properties = {
num_dots = MBh.Property( "num_pages" ),
curr_dot = MBh.Property( "page_idx" )
}
}
}
}
end
LUI.MenuBuilder.registerDef( "mp_scoreboard_main", mp_scoreboard_main )
LUI.MenuBuilder.registerDef( "mp_scoreboard_page", mp_scoreboard_page )
LockTable( _M )