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

898 lines
21 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = Engine.Localize( "@LUA_MENU_OPPOSING_TEAM_CAPS" )
f0_local1 = Engine.Localize( "@LUA_MENU_EMPTY" )
f0_local2 = Engine.Localize( "@LUA_MENU_SCORE" )
local f0_local3 = Engine.Localize( "@LUA_MENU_KILLS" )
local f0_local4 = Engine.Localize( "@LUA_MENU_DEATHS" )
local f0_local5 = Engine.Localize( "@LUA_MENU_ASSISTS" )
local f0_local6 = Engine.Localize( "@LUA_MENU_CAPTURES" )
local f0_local7 = Engine.Localize( "@LUA_MENU_PLANTS" )
local f0_local8 = Engine.Localize( "@LUA_MENU_TAGS" )
local f0_local9 = Engine.Localize( "@LUA_MENU_RESCUES" )
local f0_local10 = function ()
local f1_local0 = Engine.GetDvarString( "ui_gametype" )
local f1_local1 = {
{
type = "optionsMenuScoreboardHeaderDef",
id = "scoreHeader"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow1"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow2"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow3"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow4"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow5"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow6"
},
{
type = "optionsMenuScoreboardHeaderOpForDef",
id = "scoreHeaderOpFor"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow7"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow8"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow9"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow10"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow11"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow12"
}
}
if f1_local0 == "dm" or f1_local0 == "adrn" or f1_local0 == "mugger" or f1_local0 == "assn" or f1_local0 == "fo" or f1_local0 == "sna" then
f1_local1 = {
{
type = "optionsMenuScoreboardHeaderDef"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow1"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow2"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow3"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow4"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow5"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow6"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow7"
},
{
type = "optionsMenuScoreboardRowDef",
id = "listRow8"
}
}
end
return f1_local1
end
local f0_local11 = function ( f2_arg0, f2_arg1 )
local f2_local0 = RegisterMaterial( "specialty_null" )
local f2_local1 = RegisterMaterial( "waypoint_dogtags_friendlys" )
local f2_local2 = RegisterMaterial( "waypoint_dogtags" )
local f2_local3 = RegisterMaterial( "killiconsuicide" )
local f2_local4 = f2_arg0:getChildById( "scoreboardRows" )
local f2_local5 = Engine.GetDvarString( "ui_gametype" )
local f2_local6 = 12
local f2_local7 = f2_local6 * 0.5
local f2_local8 = GameX.gameModeIsFFA()
if f2_local8 then
f2_local6 = 8
end
local f2_local9 = f2_local4:getChildById( "scoreHeader" )
local f2_local10 = f2_local9:getChildById( "scoreHeaderRowList" )
local f2_local11 = f2_local10:getChildById( "assistsText" )
local f2_local12 = Game.GetPlayerScoreRanking()
for f2_local13 = 1, f2_local6, 1 do
local f2_local16 = f2_local4:getChildById( "listRow" .. f2_local13 )
local f2_local17 = f2_local16:getChildById( "rowList" )
local f2_local18 = f2_local16:getChildById( "scoreRowBg" )
local f2_local19 = f2_local17:getChildById( "rankIcon" )
local f2_local20 = f2_local17:getChildById( "rankNumber" )
local f2_local21 = f2_local17:getChildById( "gamertag" )
local f2_local22 = f2_local17:getChildById( "score" )
local f2_local23 = f2_local17:getChildById( "kills" )
local f2_local24 = f2_local17:getChildById( "deaths" )
local f2_local25 = f2_local17:getChildById( "assists" )
local f2_local26 = "default"
local f2_local27 = Game.GetPlayerTeam()
if GameX.IsSpectatingNotOnTeam() then
f2_local27 = spectatorFakeTeam
end
local f2_local28 = f2_local13
if f2_local8 == false and f2_local7 < f2_local13 then
f2_local27 = GameX.GetPlayerOpposingTeam()
f2_local28 = f2_local13 - f2_local7
end
local f2_local29 = Game.GetPlayerScoreInfoAtRank( f2_local27, f2_local28 )
if f2_local29 ~= nil then
if f2_local16.current_state ~= "filled" then
f2_local16:animateToState( "filled", 250 )
f2_local16.current_state = "filled"
end
if f2_local13 % 2 == 0 then
f2_local26 = "bar_b"
end
if f2_local12 == f2_local13 then
f2_local26 = "highlight"
end
if f2_local5 == "sr" then
if f2_local29.extrascore1 == 1 then
f2_local26 = "downed"
elseif f2_local29.extrascore1 == 2 then
f2_local26 = "dead"
end
elseif f2_local29.isDead == true then
f2_local26 = "dead"
end
local f2_local30 = f2_local29.rankIcon
if f2_local5 == "sr" then
if f2_local26 == "downed" then
if f2_local27 == Game.GetPlayerTeam() then
f2_local30 = f2_local1
else
f2_local30 = f2_local2
end
elseif f2_local26 == "dead" then
f2_local30 = f2_local3
end
end
if f2_local4.rank_icon ~= f2_local30 then
CoD.SetMaterial( f2_local19, f2_local30 )
end
f2_local20:setText( f2_local29.rank + 1 )
f2_local21:setText( f2_local29.name )
if f2_local5 == "war" then
f2_local22:setText( f2_local29.score )
f2_local23:setText( f2_local29.kills )
f2_local24:setText( f2_local29.deaths )
f2_local25:setText( f2_local29.assists )
f2_local11:setText( f0_local5 )
elseif f2_local5 == "dom" then
f2_local22:setText( f2_local29.score )
f2_local23:setText( f2_local29.kills )
f2_local24:setText( f2_local29.deaths )
f2_local25:setText( f2_local29.extrascore0 )
f2_local11:setText( f0_local6 )
elseif f2_local5 == "sd" then
f2_local22:setText( f2_local29.score )
f2_local23:setText( f2_local29.kills )
f2_local24:setText( f2_local29.deaths )
f2_local25:setText( f2_local29.extrascore0 )
f2_local11:setText( f0_local7 )
elseif f2_local5 == "conf" then
f2_local22:setText( f2_local29.score )
f2_local23:setText( f2_local29.kills )
f2_local24:setText( f2_local29.deaths )
f2_local25:setText( f2_local29.extrascore0 )
f2_local11:setText( f0_local8 )
elseif f2_local5 == "dm" then
f2_local22:setText( f2_local29.score )
f2_local23:setText( f2_local29.kills )
f2_local24:setText( f2_local29.deaths )
f2_local25:setText( f2_local29.assists )
f2_local11:setText( f0_local5 )
elseif f2_local5 == "gun" then
f2_local22:setText( f2_local29.score )
f2_local23:setText( f2_local29.kills )
f2_local24:setText( f2_local29.deaths )
f2_local25:setText( f2_local29.assists )
f2_local11:setText( f0_local5 )
elseif f2_local5 == "mugger" then
f2_local22:setText( f2_local29.score )
f2_local23:setText( f2_local29.kills )
f2_local24:setText( f2_local29.deaths )
f2_local25:setText( f2_local29.assists )
f2_local11:setText( f0_local8 )
elseif f2_local5 == "sr" then
f2_local22:setText( f2_local29.score )
f2_local23:setText( f2_local29.kills )
f2_local24:setText( f2_local29.deaths )
f2_local25:setText( f2_local29.extrascore0 )
f2_local11:setText( f0_local9 )
elseif f2_local5 == "blitz" then
f2_local22:setText( f2_local29.score )
f2_local23:setText( f2_local29.kills )
f2_local24:setText( f2_local29.deaths )
f2_local25:setText( f2_local29.assists )
f2_local11:setText( f0_local5 )
end
else
if f2_local4.rank_icon ~= f2_local0 then
CoD.SetMaterial( f2_local19, f2_local0 )
end
if f2_local16.current_state ~= "default" then
f2_local16:animateToState( "default", 250 )
f2_local16.current_state = "default"
end
f2_local20:setText( "" )
f2_local21:setText( f0_local1 )
f2_local22:setText( "" )
f2_local23:setText( "" )
f2_local24:setText( "" )
f2_local25:setText( "" )
end
if f2_local18.current_state ~= f2_local26 then
f2_local18:animateToState( f2_local26, 250 )
f2_local18.current_state = f2_local26
if f2_local26 == "highlight" then
f2_local20:animateToState( "black_text", 0 )
f2_local21:animateToState( "black_text", 0 )
f2_local22:animateToState( "black_text", 0 )
f2_local23:animateToState( "black_text", 0 )
f2_local24:animateToState( "black_text", 0 )
f2_local25:animateToState( "black_text", 0 )
else
f2_local20:animateToState( "default", 0 )
f2_local21:animateToState( "default", 0 )
f2_local22:animateToState( "default", 0 )
f2_local23:animateToState( "default", 0 )
f2_local24:animateToState( "default", 0 )
f2_local25:animateToState( "default", 0 )
end
end
end
end
local f0_local12 = function ( f3_arg0, f3_arg1 )
end
local f0_local13 = 200
local f0_local14 = 650
local f0_local15 = 2
local f0_local16 = function ()
return {
type = "UIElement",
id = "optionsMenuScoreboardHud",
states = {
default = {
topAnchor = true,
rightAnchor = true,
top = 50,
height = f0_local13,
right = -10,
width = f0_local14,
alpha = 1
}
},
handlers = {
options_menu_scoreboard_refresh = f0_local11
},
children = {
{
type = "UITimer",
id = "optionsMenuScoreboardRefreshTimer",
properties = {
event = "options_menu_scoreboard_refresh",
group = "hud",
interval = 250
}
},
{
type = "UIVerticalList",
id = "scoreboardRows",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
alignment = LUI.Alignment.Left,
spacing = f0_local15,
alpha = 1
}
},
children = f0_local10()
}
}
}
end
local f0_local17 = 20
local f0_local18 = 20
local f0_local19 = 256
local f0_local20 = 50
local f0_local21 = 75
local f0_local22 = 75
local f0_local23 = 75
local f0_local24 = 7
local f0_local25 = function ()
return {
type = "UIElement",
id = "scoreHeader",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 0,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 5,
right = 0
}
},
children = {
{
type = "UIImage",
id = "scoreHeaderBg",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 5,
left = 0,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 10,
right = f0_local14,
material = RegisterMaterial( "hud_scoreboard_header" )
}
}
},
{
type = "UIHorizontalList",
id = "scoreHeaderRowList",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
spacing = f0_local24
}
},
children = {
{
type = "UIElement",
id = "spacer",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = f0_local17 + f0_local18 + f0_local19 + f0_local24 * 3
}
}
},
{
type = "UIText",
id = "scoreText",
properties = {
text = f0_local2
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 8,
left = 0,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 7,
right = 50,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right,
alpha = 0.75
}
}
},
{
type = "UIText",
id = "killsText",
properties = {
text = f0_local3
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 8,
left = 0,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 7,
right = 75,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right,
alpha = 0.75
}
}
},
{
type = "UIText",
id = "deathsText",
properties = {
text = f0_local4
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 8,
left = 0,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 7,
right = 75,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right,
alpha = 0.75
}
}
},
{
type = "UIText",
id = "assistsText",
properties = {
text = f0_local5
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 8,
left = 0,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 7,
right = 75,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right,
alpha = 0.75
}
}
}
}
}
}
}
end
local f0_local26 = function ()
local f6_local0 = RegisterMaterial( "hud_scoreboard_bar_a" )
return {
type = "UIButton",
id = "scoreRow",
properties = {
rankIcon = placeholder_material,
rankNumber = "",
gamertag = f0_local1,
score = "",
kills = "",
deaths = "",
assists = "",
current_state = "default"
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 0,
height = 20,
right = 0,
alpha = 0.25
},
filled = {
alpha = 1
}
},
handlers = {
button_action = f0_local12
},
children = {
{
type = "UIImage",
id = "scoreRowBg",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
material = f6_local0,
alpha = 0.75
},
bar_a = {
material = f6_local0,
alpha = 1
},
bar_b = {
material = RegisterMaterial( "hud_scoreboard_bar_b" ),
alpha = 0.4
},
downed = {
material = RegisterMaterial( "hud_scoreboard_dead_yellow" ),
alpha = 0.65
},
dead = {
material = RegisterMaterial( "hud_scoreboard_dead_red" ),
alpha = 0.65
},
highlight = {
material = RegisterMaterial( "hud_scoreboard_highlight_you" ),
alpha = 1
}
},
handlers = {
button_over = function ( f7_arg0, f7_arg1 )
f7_arg0:animateToState( "downed", 0 )
end
,
button_up = function ( f8_arg0, f8_arg1 )
f8_arg0:animateToState( f8_arg0.properties.current_state, 0 )
end
}
},
{
type = "UIHorizontalList",
id = "rowList",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
spacing = 0
}
},
properties = {
rankIcon = MBh.Property( "rankIcon" ),
rankNumber = MBh.Property( "rankNumber" ),
gamertag = MBh.Property( "gamertag" ),
score = MBh.Property( "score" ),
kills = MBh.Property( "kills" ),
deaths = MBh.Property( "deaths" ),
assists = MBh.Property( "assists" )
},
children = {
{
type = "UIImage",
id = "rankIcon",
properties = {
rankIcon = MBh.Property( "rankIcon" )
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = f0_local17,
material = MBh.Property( "rankIcon" )
}
}
},
{
type = "UIText",
id = "rankNumber",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 5,
left = 0,
bottom = 5 + CoD.TextSettings.HudEuroMedTinyFont.Height,
right = f0_local18 + 10,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Left,
red = 1,
green = 1,
blue = 1,
alpha = 1
},
black_text = {
red = 0,
green = 0,
blue = 0,
alpha = 1
}
},
properties = {
text = MBh.Property( "rankNumber" )
}
},
{
type = "UIText",
id = "gamertag",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = f0_local19 + 10,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = 1,
green = 1,
blue = 1,
alpha = 1
},
black_text = {
red = 0,
green = 0,
blue = 0,
alpha = 1
}
},
properties = {
text = MBh.Property( "gamertag" )
}
},
{
type = "UIText",
id = "score",
properties = {
text = MBh.Property( "score" )
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = f0_local20 + 10,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right,
red = 1,
green = 1,
blue = 1,
alpha = 1
},
black_text = {
red = 0,
green = 0,
blue = 0,
alpha = 1
}
}
},
{
type = "UIText",
id = "kills",
properties = {
text = MBh.Property( "kills" )
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = f0_local21 + 8,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right,
red = 1,
green = 1,
blue = 1,
alpha = 1
},
black_text = {
red = 0,
green = 0,
blue = 0,
alpha = 1
}
}
},
{
type = "UIText",
id = "deaths",
properties = {
text = MBh.Property( "deaths" )
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = f0_local22 + 6,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right,
red = 1,
green = 1,
blue = 1,
alpha = 1
},
black_text = {
red = 0,
green = 0,
blue = 0,
alpha = 1
}
}
},
{
type = "UIText",
id = "assists",
properties = {
text = MBh.Property( "assists" )
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = f0_local23 + 6,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right,
red = 1,
green = 1,
blue = 1,
alpha = 1
},
black_text = {
red = 0,
green = 0,
blue = 0,
alpha = 1
}
}
}
}
}
}
}
end
local f0_local27 = function ()
return {
type = "UIElement",
id = "scoreHeaderOpFor",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 0,
height = CoD.TextSettings.HudEuroMedSmallFont.Height + 5,
right = 0
}
},
children = {
{
type = "UIImage",
id = "scoreHeaderOpForBg",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 5,
left = 0,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 10,
right = f0_local14,
material = RegisterMaterial( "hud_scoreboard_header" )
}
}
},
{
type = "UIText",
id = "headerOpForText",
properties = {
text = f0_local0
},
states = {
default = {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 8,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
right = -5,
width = 200,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right,
alpha = 1
}
}
}
}
}
end
LUI.MenuBuilder.registerDef( "optionsMenuScoreboardHudDef", f0_local16 )
LUI.MenuBuilder.registerDef( "optionsMenuScoreboardRowDef", f0_local26 )
LUI.MenuBuilder.registerDef( "optionsMenuScoreboardHeaderDef", f0_local25 )
LUI.MenuBuilder.registerDef( "optionsMenuScoreboardHeaderOpForDef", f0_local27 )
LockTable( _M )