local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) function chaos_main_score() local f1_local0 = 220 local f1_local1 = 64 local f1_local2 = 16 local f1_local3 = 16 local f1_local4 = 1.5 local self = LUI.UIElement.new( { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = true, top = 0, height = f1_local1, width = f1_local0, right = 4 } ) self.id = "chaos_main_score" local f1_local6 = LUI.UIHorizontalList.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } ) f1_local6.id = "background" self:addElement( f1_local6 ) local f1_local7 = LUI.UIImage.new( { material = RegisterMaterial( "hud_box_combo_score_ltcap" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = 0, bottom = 0, left = 0, right = f1_local2 } ) f1_local7.id = "bgLeft" f1_local6:addElement( f1_local7 ) local f1_local8 = LUI.UIImage.new( { material = RegisterMaterial( "hud_box_combo_score_mid" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = 0, bottom = 0, left = 0, right = f1_local0 - f1_local2 - f1_local3 } ) f1_local8.id = "bgMid" f1_local6:addElement( f1_local8 ) local f1_local9 = LUI.UIImage.new( { material = RegisterMaterial( "hud_box_combo_score_rtcap" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = 0, bottom = 0, left = 0, right = f1_local3 } ) f1_local9.id = "bgRight" f1_local6:addElement( f1_local9 ) local f1_local10 = LUI.UIText.new( CoD.ColorizeState( Colors.primary_text_color, { font = CoD.TextSettings.SmallFont.Font, alignment = LUI.Alignment.Center, topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, left = 0, top = 6, right = 0, height = CoD.TextSettings.SmallFont.Height } ) ) f1_local10.id = "title" f1_local10:setText( Engine.Localize( "ALIEN_CHAOS_SCORE" ) ) self:addElement( f1_local10 ) local f1_local11 = Game.GetOmnvar( "ui_alien_chaos_total_score" ) local f1_local12 = LUI.UIPrettyNumber.new( CoD.ColorizeState( Colors.alien_chaos_hilite, { font = CoD.TextSettings.ExtraBigFont.Font, alignment = LUI.Alignment.Center, topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, left = 0, bottom = -8, right = 0, height = CoD.TextSettings.ExtraBigFont.Height } ), { speed = 1000, initialValue = f1_local11, precision = 5 } ) f1_local12.id = "score" f1_local12:setTextStyle( CoD.TextStyle.Outlined ) self:addElement( f1_local12 ) local f1_local13 = function ( f2_arg0, f2_arg1 ) assert( f1_local4 > 0 ) local f2_local0 = 0 if f2_arg0.getDisplayValue then f2_local0 = f2_arg0:getDisplayValue() end f2_arg0:setSpeed( (f2_arg1.value - f2_local0) / f1_local4 ) f2_arg0:setValue( f2_arg1.value ) end f1_local12:registerOmnvarHandler( "ui_alien_chaos_total_score", f1_local13 ) f1_local13( f1_local12, { value = f1_local11 } ) return self end f0_local0 = 300 function chaos_combo_gauge() local f3_local0 = 256 local f3_local1 = 40 local f3_local2 = 18 local f3_local3 = 12 local f3_local4 = 32 local f3_local5 = 130 local f3_local6 = 12 local f3_local7 = -2 local self = LUI.UIElement.new( { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = 0, height = f3_local1, left = -f3_local0 / 2, right = f3_local0 / 2 } ) self.id = "chaos_combo_gauge" local f3_local9 = LUI.UIImage.new( { material = RegisterMaterial( "hud_combo_meter_bg" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } ) f3_local9.id = "background" self:addElement( f3_local9 ) local f3_local10 = LUI.UIHorizontalList.new( { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 3, height = f3_local4, left = 0, right = 0, alignment = LUI.Alignment.Center } ) f3_local10.id = "ticks" self:addElement( f3_local10 ) for f3_local11 = 1, f3_local2, 1 do local f3_local14 = f3_local11 local f3_local15 = LUI.UIElement.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = 0, bottom = 0, left = 0, right = f3_local3 } ) f3_local15.id = "tick_" .. f3_local14 f3_local10:addElement( f3_local15 ) local f3_local16 = LUI.UIImage.new( { material = RegisterMaterial( "hud_combo_meter_tic_empty" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 0.75 } ) f3_local16.id = "tickBorder" f3_local15:addElement( f3_local16 ) local f3_local17 = LUI.UIImage.new( { material = RegisterMaterial( "hud_combo_meter_tic_fill" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 1, bottom = 1, left = 0, right = 0, alpha = 0 } ) f3_local17:registerAnimationState( "frozen", CoD.ColorizeState( Colors.alien_chaos_freeze, { alpha = 1 } ) ) local f3_local18 = { r = 0.38, g = 0.65, b = 0.31 } local f3_local19 = { r = 0.9, g = 0.78, b = 0.1 } local f3_local20 = { r = 1, g = 0.24, b = 0.04 } local f3_local21 = { { threshold = 0, color = f3_local20 }, { threshold = 0.19, color = f3_local20 }, { threshold = 0.31, color = f3_local19 }, { threshold = 0.53, color = f3_local19 }, { threshold = 0.64, color = f3_local18 }, { threshold = 1, color = f3_local18 } } f3_local17.id = "tickFill" f3_local15:addElement( f3_local17 ) local f3_local22 = LUI.UIImage.new( { material = RegisterMaterial( "white" ), topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 14, height = 4, left = 1, right = -1, alpha = 0 } ) f3_local22:registerAnimationState( "visible", { alpha = 1 } ) f3_local22.id = "tickFlash" f3_local15:addElement( f3_local22 ) f3_local15.fill = f3_local17 f3_local15.flash = f3_local22 f3_local15.ticksLit = 0 f3_local15:registerEventHandler( "refresh_ticks", function ( element, event ) local f4_local0 = f3_local14 <= event.ticksLit if f4_local0 or event.frozen then if event.frozen then if not element.frozen then element.fill:animateToState( "frozen", 350 ) end elseif element.ticksLit ~= event.ticksLit then if not element.lit then local f4_local1 = MBh.AnimateSequence( { { "default", 0 }, { "default", 20 * math.max( 0, f3_local14 - element.ticksLit ) }, { "visible", 0 }, { "default", 200 } } ) f4_local1( element.flash, {} ) end element.fill:registerAnimationState( "current", CoD.ColorizeState( CoD.GradientMap( f3_local21, event.ticksLit / f3_local2 ) ) ) element.fill:animateToState( "current" ) end elseif element.lit then element.fill:animateToState( "default", 100 ) end element.frozen = event.frozen element.ticksLit = event.ticksLit element.lit = f4_local0 end ) end local f3_local11 = LUI.UIElement.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } ) f3_local11.id = "frozen" self:addElement( f3_local11 ) for f3_local12 = 1, f3_local5, 1 do local f3_local15 = f3_local12 local f3_local16 = LUI.UIImage.new( { material = RegisterMaterial( "alien_chaos_freeze_snowflake" ), topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = f3_local7 - math.random() * 10, height = f3_local6, left = 20 - f3_local6 / 2 + f3_local15 * (f3_local0 - 40) / f3_local5, width = f3_local6, scale = -1, alpha = 0 } ) f3_local16:registerAnimationState( "visible", { alpha = 1, scale = 0.75 - 1.5 * math.random(), zRot = 360 * math.random() } ) f3_local16.id = "iceCube_" .. f3_local15 f3_local11:addElement( f3_local16 ) f3_local16:registerEventHandler( "refresh_ice_cubes", function ( element, event ) if f3_local15 <= event.cubesLit then if not element.visible then local f5_local0 = MBh.AnimateSequence( { { "default", 0 }, { "default", f0_local0 * f3_local15 / f3_local5 }, { "visible", 200 } } ) f5_local0( element, {} ) element.visible = true end elseif element.visible then element:cancelAnimateToState() element:animateToState( "default", 100 ) element.visible = nil end end ) end local f3_local12 = LUI.UIElement.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 8, bottom = 8, left = 0, right = 0, alpha = 0 } ) f3_local12:registerAnimationState( "visible", { alpha = 1 } ) f3_local12.id = "icicles" f3_local11:addElement( f3_local12 ) f3_local12:registerOmnvarHandler( "ui_alien_chaos_meter_freeze_end", function ( f6_arg0, f6_arg1 ) if f6_arg1.value > 0 then f6_arg0:animateToState( "visible", f0_local0 ) else f6_arg0:animateToState( "default", 400 ) end end ) f3_local12:addElement( LUI.UIImage.new( { material = RegisterMaterial( "alien_chaos_freeze_icicles" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } ) ) f3_local12:addElement( LUI.UIImage.new( { material = RegisterMaterial( "alien_chaos_freeze_icicles" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 0.2 } ) ) local f3_local15 = Game.GetOmnvar( "ui_alien_chaos_combo_meter_start" ) self:registerOmnvarHandler( "ui_alien_chaos_combo_meter_end", function ( f7_arg0, f7_arg1 ) f3_local15 = Game.GetTime() end ) local f3_local16 = LUI.UITimer.new( 50, "combo_gauge_refresh" ) f3_local16.id = "refreshTimer" self:addElement( f3_local16 ) self:registerEventHandler( "combo_gauge_refresh", function ( element, event ) local f8_local0 = Game.GetTime() local f8_local1 = Game.GetOmnvar( "ui_alien_chaos_meter_freeze_start" ) local f8_local2 = Game.GetOmnvar( "ui_alien_chaos_meter_freeze_end" ) local f8_local3 if f8_local1 > f8_local0 or f8_local0 >= f8_local2 then f8_local3 = false else f8_local3 = true end local f8_local4 = Game.GetOmnvar( "ui_alien_chaos_combo_meter_end" ) local f8_local5 = (f8_local4 - f8_local0) / (f8_local4 - f3_local15) if f8_local3 then f8_local5 = (f8_local0 - f8_local1) / f0_local0 end f3_local10:processEvent( { name = "refresh_ticks", ticksLit = math.ceil( LUI.clamp( f8_local5, 0, 1 ) * f3_local2 ), frozen = f8_local3, duration = f8_local4 - f3_local15 } ) local f8_local6 = LUI.clamp( (f8_local2 - f8_local0) / (f8_local2 - f8_local1), 0, 1 ) if not f8_local3 then f8_local6 = 0 end f3_local11:processEvent( { name = "refresh_ice_cubes", cubesLit = math.ceil( f8_local6 * f3_local5 ) } ) end ) return self end function chaos_combo_score() local f9_local0 = 200 local f9_local1 = 15 local f9_local2 = 36 local f9_local3 = 1.5 local self = LUI.UIHorizontalList.new( { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 24, height = f9_local2, left = 0, right = 0, alignment = LUI.Alignment.Center } ) self.id = "chaos_combo_score" local f9_local5 = LUI.UIText.new( CoD.ColorizeState( Colors.alien_tech_tree_bright_grey, { font = CoD.TextSettings.ExtraBigFont.Font, alignment = LUI.Alignment.Right, topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = false, left = 0, bottom = 3, width = f9_local0, height = f9_local2, scale = 0 } ) ) f9_local5:registerAnimationState( "pulse", CoD.ColorizeState( Colors.white, { scale = 0.1 } ) ) f9_local5:registerAnimationState( "frozen", CoD.ColorizeState( Colors.alien_chaos_freeze, { scale = 0 } ) ) f9_local5:setTextStyle( CoD.TextStyle.OutlinedMore ) f9_local5.id = "comboMultiplier" self:addElement( f9_local5 ) local f9_local6 = 0 local f9_local7 = function ( f10_arg0, f10_arg1 ) local f10_local0 = MBh.AnimateSequence( { { "pulse", 50 }, { f10_arg0.frozen and "frozen" or "default", 200 } } ) f10_arg0:setText( f10_arg1.value .. "x" ) if f10_arg1.value > 0 then f10_local0( f10_arg0, {} ) end end f9_local5:registerOmnvarHandler( "ui_alien_chaos_combo_counter", f9_local7 ) f9_local5:registerOmnvarHandler( "ui_alien_chaos_meter_freeze_start", function ( f11_arg0, f11_arg1 ) if f11_arg1.value > 0 then f11_arg0:animateToState( "frozen", f0_local0 ) f11_arg0.frozen = true else f11_arg0:animateToState( "default", 100 ) f11_arg0.frozen = false end end ) f9_local7( f9_local5, { value = Game.GetOmnvar( "ui_alien_chaos_combo_counter" ) } ) local f9_local8 = LUI.UIElement.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = 0, bottom = 0, left = 0, width = f9_local1 } ) f9_local8.id = "padding" self:addElement( f9_local8 ) local f9_local9 = LUI.UIPrettyNumber.new( CoD.ColorizeState( Colors.alien_chaos_hilite, { font = CoD.TextSettings.HudIW6NormalFont.Font, alignment = LUI.Alignment.Left, topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = false, left = 0, bottom = 0, width = f9_local0, height = CoD.TextSettings.HudIW6NormalFont.Height } ), { speed = 150, initialValue = Game.GetOmnvar( "ui_alien_chaos_score_streak" ) } ) f9_local9:registerAnimationState( "frozen", CoD.ColorizeState( Colors.alien_chaos_freeze ) ) f9_local9:setTextStyle( CoD.TextStyle.OutlinedMore ) f9_local9.id = "comboPoints" self:addElement( f9_local9 ) local f9_local10 = function ( f12_arg0, f12_arg1 ) assert( f9_local3 > 0 ) local f12_local0 = 0 if f12_arg0.getDisplayValue then f12_local0 = f12_arg0:getDisplayValue() end f12_arg0:setSpeed( (f12_arg1.value - f12_local0) / f9_local3 ) f12_arg0:setValue( f12_arg1.value ) end f9_local9:registerOmnvarHandler( "ui_alien_chaos_score_streak", f9_local10 ) f9_local9:registerOmnvarHandler( "ui_alien_chaos_meter_freeze_start", function ( f13_arg0, f13_arg1 ) if f13_arg1.value > 0 then f13_arg0:animateToState( "frozen", f0_local0 ) else f13_arg0:animateToState( "default", 100 ) end end ) f9_local10( f9_local9, { value = Game.GetOmnvar( "ui_alien_chaos_score_streak" ) } ) return self end function chaos_combo_meter() local self = nil if Engine.UsingSplitscreenUpscaling() then self = LUI.UIElement.new( { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, bottom = -60, height = 0, left = 0, right = 0 } ) else self = LUI.UIElement.new( { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 50, height = 0, left = 0, right = 0 } ) end self.id = "chaos_combo_meter" self:addElement( chaos_combo_gauge() ) self:addElement( chaos_combo_score() ) return self end function chaos_clock() local f15_local0 = 256 local f15_local1 = 64 local f15_local2 = Game.GetOmnvar( "ui_alien_chaos_grace_period" ) local f15_local3 = { { time = 30000, alias = "ui_mp_suitcasebomb_timer" }, { time = 20000, alias = "ui_mp_suitcasebomb_timer" }, { time = 10000, alias = "ui_mp_timer_countdown" }, { time = 9000, alias = "ui_mp_timer_countdown" }, { time = 8000, alias = "ui_mp_timer_countdown" }, { time = 7000, alias = "ui_mp_timer_countdown" }, { time = 6000, alias = "ui_mp_timer_countdown" }, { time = 5000, alias = "ui_mp_timer_countdown" }, { time = 4000, alias = "ui_mp_timer_countdown" }, { time = 3000, alias = "ui_mp_timer_countdown" }, { time = 2000, alias = "ui_mp_timer_countdown" }, { time = 1000, alias = "ui_mp_timer_countdown" } } local self = LUI.UIElement.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } ) self.id = "chaos_clock" local f15_local5 = LUI.UIElement.new( { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = false, bottom = 0, height = f15_local1, left = -f15_local0 / 2, right = f15_local0 / 2, alpha = 0 } ) f15_local5:registerAnimationState( "visible", { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = 0, height = f15_local1, left = -f15_local0 / 2, right = f15_local0 / 2, alpha = 1 } ) f15_local5:registerAnimationState( "animating", { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = 20, height = f15_local1, left = -f15_local0 / 2, right = f15_local0 / 2, alpha = 1 } ) f15_local5.id = "chaos_clock" local f15_local6 = function ( f16_arg0, f16_arg1 ) local f16_local0 = nil if 0 < f16_arg1 then f16_local0 = MBh.AnimateSequence( { { "animating", 100 }, { "visible", 150 } } ) else f16_local0 = MBh.AnimateSequence( { { "animating", 150 }, { "default", 100 } } ) end f16_local0( f16_arg0, {} ) end f15_local5:registerOmnvarHandler( "ui_alien_chaos_grace_period", function ( f17_arg0, f17_arg1 ) f15_local6( f17_arg0, f17_arg1.value ) end ) if f15_local2 > 0 then f15_local6( f15_local5, f15_local2 ) end local f15_local7 = LUI.UIImage.new( { material = RegisterMaterial( "hud_box_combo_time" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } ) f15_local7.id = "background" f15_local5:addElement( f15_local7 ) local f15_local8 = LUI.UICountdown.new() f15_local8:registerAnimationState( "default", { font = CoD.TextSettings.ExtraBigFont.Font, alignment = LUI.Alignment.center, topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, left = 0, top = 15.5, right = 0, height = CoD.TextSettings.ExtraBigFont.Height, red = 1, green = 1, blue = 1, alpha = 1 } ) f15_local8:animateToState( "default" ) f15_local8.id = "value" f15_local8.isPulsing = false f15_local8:setTextStyle( CoD.TextStyle.Outlined ) f15_local8:setEndTime( f15_local2 ) f15_local8:registerOmnvarHandler( "ui_alien_chaos_grace_period", function ( f18_arg0, f18_arg1 ) f18_arg0:setEndTime( f18_arg1.value ) f18_arg0:animateToState( "default" ) f18_arg0.currentBeepIndex = 1 f18_arg0.isPulsing = false end ) f15_local8:registerAnimationState( "pulse", { red = 1, blue = 0, green = 0, alpha = 1 } ) f15_local5:addElement( f15_local8 ) f15_local8.currentBeepIndex = 1 f15_local8:registerEventHandler( "timer_pulse_check", function ( element, event ) local f19_local0 = Game.GetTime() local f19_local1 = Game.GetOmnvar( "ui_alien_chaos_grace_period" ) local f19_local2 = false if element.currentBeepIndex <= #f15_local3 and f19_local1 - f19_local0 <= f15_local3[element.currentBeepIndex].time and f19_local1 > 0 then Engine.PlaySound( f15_local3[element.currentBeepIndex].alias ) f19_local2 = true element.currentBeepIndex = element.currentBeepIndex + 1 end if not element.isPulsing == true then if f19_local2 == true then local f19_local3 = MBh.AnimateSequence( { { "pulse", 0 }, { "pulse", 450 }, { "default", 0 }, { "default", 450 } } ) f19_local3( element ) element:registerEventHandlerIfFree( LUI.FormatAnimStateFinishEvent( "default" ), function ( f20_arg0, f20_arg1 ) f20_arg0.isPulsing = false f19_local2 = false end ) end elseif element.isPulsing == true and f19_local2 == false then element:animateToState( "default" ) element.isPulsing = false end end ) local f15_local9 = LUI.UITimer.new( 50, "timer_pulse_check" ) f15_local9.id = "pulseTimer" f15_local8:addElement( f15_local9 ) self:addElement( f15_local5 ) return self end ChaosPerksLUT = { file = "mp/alien/chaos_perks.csv", index = 2, icon = 3 } function CountChaosPerks() local f21_local0 = 32 for f21_local1 = 1, f21_local0, 1 do if Engine.TableLookup( ChaosPerksLUT.file, ChaosPerksLUT.index, tostring( f21_local1 ), 0 ) == "" then return f21_local1 - 1 end end return f21_local0 end function GetChaosPerksIcon( f22_arg0 ) return Engine.TableLookup( ChaosPerksLUT.file, ChaosPerksLUT.index, tostring( f22_arg0 ), ChaosPerksLUT.icon ) end function chaos_perks() local f23_local0 = 8 local f23_local1 = 36 local f23_local2 = 8 local f23_local3 = CountChaosPerks() local f23_local4 = f23_local0 * f23_local1 + f23_local2 * (2 + math.max( 0, f23_local3 - 1 )) local f23_local5 = math.ceil( f23_local3 / f23_local0 ) * f23_local1 + f23_local2 * (2 + math.max( 0, f23_local3 - 1 )) local f23_local6 = 60 local self = LUI.UIElement.new( { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, bottom = f23_local5, left = 0, width = f23_local4 } ) self.id = "chaos_perks" self.perkElements = {} local f23_local8 = LUI.UIImage.new( { material = RegisterMaterial( "alien_health_bg_shadow" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -f23_local6, bottom = 0, left = -f23_local6, right = f23_local6, alpha = 0.8 } ) f23_local8.id = "background" self:addElement( f23_local8 ) local f23_local9 = LUI.UIGrid.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = f23_local2, bottom = -f23_local2, left = f23_local2, right = -f23_local2 }, { elementsPerRow = f23_local0, rowHeight = f23_local1, hSpacing = f23_local2, vSpacing = f23_local2 } ) f23_local9.id = "grid" self:addElement( f23_local9 ) for f23_local10 = 1, f23_local3, 1 do local f23_local13 = f23_local10 local f23_local14 = GetChaosPerksIcon( f23_local13 ) local f23_local15 = LUI.UIElement.new( { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, bottom = f23_local1, left = 0, right = f23_local1, scale = 0 } ) f23_local15:registerAnimationState( "smaller", { scale = -0.2 } ) f23_local15:registerAnimationState( "bigger", { scale = 0.2 } ) f23_local15.id = "perk_" .. f23_local13 f23_local9:addElement( f23_local15 ) self.perkElements[f23_local13] = f23_local15 local f23_local16 = LUI.UIImage.new( { material = RegisterMaterial( "hud_box_combo_perk" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 0.1 } ) f23_local16:registerAnimationState( "active", { alpha = 0.8 } ) f23_local16.id = "perkBG" f23_local15:addElement( f23_local16 ) local f23_local17 = LUI.UIImage.new( { material = RegisterMaterial( f23_local14 ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 0.2 } ) f23_local17:registerAnimationState( "active", { alpha = 1 } ) f23_local17.id = "perkIcon" f23_local15:addElement( f23_local17 ) f23_local15.bg = f23_local16 f23_local15.icon = f23_local17 f23_local15:registerEventHandler( "activate", function ( element, event ) if not element.active then local f24_local0 = MBh.AnimateSequence( { { "default", 0 }, { "smaller", 250 }, { "bigger", 100 }, { "default", 150 } } ) local f24_local1 = MBh.AnimateSequence( { { "default", 0 }, { "active", 100 } } ) local f24_local2 = MBh.AnimateSequence( { { "default", 0 }, { "active", 100 } } ) f24_local0( element, {} ) f24_local1( element.bg, {} ) f24_local2( element.icon, {} ) element.active = true end end ) f23_local15:registerEventHandler( "deactivate", function ( element, event ) if element.active then local f25_local0 = 80 * (f23_local3 - f23_local13) local f25_local1 = MBh.AnimateSequence( { { "default", f25_local0 }, { "bigger", 250 }, { "smaller", 100 }, { "default", 150 } } ) f25_local1( element, {} ) f25_local1 = MBh.AnimateSequence( { { "active", f25_local0 }, { "default", 200 } } ) f25_local1( element.bg, {} ) f25_local1 = MBh.AnimateSequence( { { "active", f25_local0 }, { "default", 200 } } ) f25_local1( element.icon, {} ) element.active = nil end end ) end self:registerOmnvarHandler( "ui_chaos_perk", function ( f26_arg0, f26_arg1 ) if f26_arg1.value == 0 then f23_local9:processEvent( { name = "deactivate" } ) end end ) self.getPerkElement = function ( f27_arg0, f27_arg1 ) return f27_arg0.perkElements[f27_arg1] end local f23_local10 = Game.GetOmnvar( "ui_chaos_perk" ) if f23_local10 > 0 then for f23_local11 = 1, f23_local10, 1 do local f23_local15 = self:getPerkElement( f23_local11 ) if f23_local15 then f23_local15:processEvent( { name = "activate" } ) end end end return self end f0_local1 = 2000 function chaos_perk_unlock_one( f28_arg0, f28_arg1 ) assert( f28_arg1 ) local f28_local0 = 48 local f28_local1 = f28_arg0:getPerkElement( f28_arg1 ) local self = LUI.UIElement.new( { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = 0, height = f28_local0, left = -80 - f28_local0 / 2, width = f28_local0, scale = 0, alpha = 1 } ) self:registerAnimationState( "centered", { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = 0, height = f28_local0, left = -f28_local0 / 2, width = f28_local0 } ) self:registerAnimationState( "wait", {} ) self:registerAnimationState( "hidden", { alpha = 0 } ) self.id = "chaos_perk_unlock_one_" .. f28_arg1 local f28_local3 = MBh.AnimateSequence( { { "default", 0 }, { "centered", 400 }, { "wait", f0_local1 } } ) self:registerEventHandler( LUI.FormatAnimStateFinishEvent( "wait" ), function ( element, event ) self:registerAnimationState( "flyover", LUI.MakeFlyOverAnimationState( element, f28_local1 ) ) element:animateToState( "flyover", 400 ) end ) self:registerEventHandler( LUI.FormatAnimStateFinishEvent( "flyover" ), function ( element, event ) element:animateToState( "hidden", 200 ) f28_local1:processEvent( { name = "activate" } ) end ) self:registerEventHandler( LUI.FormatAnimStateFinishEvent( "hidden" ), function ( element, event ) element:close() end ) f28_local3( self, {} ) local f28_local4 = LUI.UIElement.new( { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, bottom = 1, left = 0, right = 0 } ) f28_local4:registerAnimationState( "horizontal", { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = 1, left = 0, right = 0 } ) f28_local4:registerAnimationState( "full", { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } ) f28_local4.id = "stencil" f28_local4:setUseStencil( true ) self:addElement( f28_local4 ) local f28_local5 = MBh.AnimateSequence( { { "default", 0 }, { "horizontal", 100, false, false }, { "horizontal", 100, false, true }, { "full", 150 } } ) f28_local5( f28_local4, {} ) f28_local5 = LUI.UIElement.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, bottom = 0, top = 0, left = 0, right = 0 } ) f28_local5.id = "icon" f28_local4:addElement( f28_local5 ) local f28_local6 = LUI.UIImage.new( { material = RegisterMaterial( "hud_box_combo_perk" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 0.8 } ) f28_local6.id = "perkBG" f28_local5:addElement( f28_local6 ) local f28_local7 = LUI.UIImage.new( { material = RegisterMaterial( GetChaosPerksIcon( f28_arg1 ) ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } ) f28_local7.id = "perkIcon" f28_local5:addElement( f28_local7 ) return self end function chaos_perk_unlock( f32_arg0, f32_arg1 ) assert( f32_arg1.perksWidget ) local f32_local0 = {} local f32_local1 = 16 local self = LUI.UIElement.new( { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 114, height = 0, left = 0, right = 0 } ) self.id = "chaos_perk_unlock" self.lastUnlockTime = 0 self:registerOmnvarHandler( "ui_chaos_perk", function ( f33_arg0, f33_arg1 ) if f33_arg1.value > 0 and #f32_local0 < f32_local1 then table.insert( f32_local0, f33_arg1.value ) end end ) self:registerEventHandler( "refresh_unlock_perk", function ( element, event ) local f34_local0 = Game.GetTime() if #f32_local0 > 0 and f0_local1 + 400 < f34_local0 - element.lastUnlockTime then local f34_local1 = chaos_perk_unlock_one( f32_arg1.perksWidget, f32_local0[1] ) table.remove( f32_local0, 1 ) element:addElement( f34_local1 ) element.lastUnlockTime = f34_local0 Engine.PlaySound( "mp_intel_success" ) end end ) local f32_local3 = LUI.UITimer.new( 100, "refresh_unlock_perk" ) f32_local3.id = "refreshTimer" self:addElement( f32_local3 ) return self end maxVisibleChaosLogEvents = 5 ChaosEventLUT = { file = "mp/alien/chaos_events.csv", size = 256, index = 2, text = 3, points = 5, mp_alien_town = 6, mp_alien_armory = 7, mp_alien_beacon = 8, mp_alien_dlc3 = 9, mp_alien_last = 10 } function GetChaosEventInfo( f35_arg0 ) return Engine.Localize( Engine.TableLookup( ChaosEventLUT.file, ChaosEventLUT.index, tostring( f35_arg0 ), ChaosEventLUT.text ) ), Engine.TableLookup( ChaosEventLUT.file, ChaosEventLUT.index, tostring( f35_arg0 ), ChaosEventLUT.points ) end function ChaosEventFactory( f36_arg0, f36_arg1 ) local f36_local0 = 12000 local f36_local1, f36_local2 = GetChaosEventInfo( f36_arg0 ) local self = LUI.UIElement.new( { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = 1, left = -80, right = -80, alpha = 0 } ) self:registerAnimationState( "opening", { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, height = 20, left = 0, right = 0, scale = 0.05, alpha = 1 } ) self:registerAnimationState( "visible", { scale = 0, alpha = 1 } ) self:registerAnimationState( "closed", { alpha = 0 } ) self:setUseStencil( true ) self.id = "event_" .. f36_arg1 local f36_local4 = CoD.TextSettings.SmallFont local f36_local5, f36_local6, f36_local7, f36_local8 = GetTextDimensions( f36_local1, f36_local4.Font, f36_local4.Height ) local f36_local9 = f36_local7 - f36_local5 local f36_local10 = LUI.UIText.new( { alignment = LUI.Alignment.Left, font = f36_local4.Font, topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = true, width = f36_local9, top = 0, right = 0, height = f36_local4.Height } ) f36_local10.id = "eventText" f36_local10:setText( f36_local1 ) self:addElement( f36_local10 ) local f36_local11 = LUI.UIText.new( CoD.ColorizeState( Colors.alien_chaos_hilite, { alignment = LUI.Alignment.Right, font = CoD.TextSettings.SmallFont.Font, topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = true, right = -f36_local9 - 10, top = 0, width = 60, height = CoD.TextSettings.SmallFont.Height } ) ) f36_local11.id = "eventPoints" f36_local11:setText( f36_local2 ) self:addElement( f36_local11 ) local f36_local12 = MBh.AnimateSequence( { { "opening", 100 }, { "visible", 150 } } ) f36_local12( self, {} ) self:registerEventHandler( "close", function ( element, event ) if element.closing then return else element.closing = true element:animateToState( "closed", 250 ) end end ) self:registerEventHandler( LUI.FormatAnimStateFinishEvent( "closed" ), self.close ) self:registerEventHandler( "new_log_event", function ( element, event ) if element.closing then return else element.timesPushed = element.timesPushed and element.timesPushed + 1 or 1 element:registerAnimationState( "target", { scale = 0, alpha = LUI.clamp( 1 - element.timesPushed / math.max( 1, maxVisibleChaosLogEvents ), 0, 1 ) } ) element:animateToState( "target", 100 ) end end ) f36_local12 = LUI.UITimer.new( f36_local0, "close", nil, true ) f36_local12.id = "expirationTimer" self:addElement( f36_local12 ) return self end function chaos_event_log() local f39_local0 = 0 local self = LUI.UIElement.new( { topAnchor = true, bottomAnchor = true, leftAnchor = false, rightAnchor = true, top = 60, bottom = 0, width = 300, right = 0 } ) self.id = "chaos_event_log" local f39_local2 = LUI.UIVerticalList.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } ) f39_local2.id = "vlist" self:addElement( f39_local2 ) local f39_local3 = function () local f40_local0 = 0 local f40_local1 = f39_local2:getFirstChild() while f40_local1 do if not f40_local1.closing then f40_local0 = f40_local0 + 1 end f40_local1 = f40_local1:getNextSibling() end return f40_local0 end local f39_local4 = function ( f41_arg0 ) f39_local0 = f39_local0 + 1 f39_local2:processEvent( { name = "new_log_event" } ) local f41_local0 = ChaosEventFactory( f41_arg0, f39_local0 ) f41_local0:setPriority( -f39_local0 ) f39_local2:addElement( f41_local0 ) if f39_local3() > maxVisibleChaosLogEvents then local f41_local1 = f39_local2:getLastChild() f41_local1:processEvent( { name = "close" } ) end end self:registerOmnvarHandler( "ui_chaos_event", function ( f42_arg0, f42_arg1 ) f39_local4( f42_arg1.value ) end ) self:registerEventHandler( "fake_event", function () f39_local4( 1 + math.floor( 8 * math.random() ) ) end ) return self end function chaos_event_recap() local f44_local0 = LUI.mp_hud.AlienScoreboards local self = LUI.UIElement.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, scale = Engine.UsingSplitscreenUpscaling() and -0.25 or 0 } ) self.id = "chaos_event_recap" local f44_local2 = f44_local0.table_factory( 21, { 80, 350, 80 }, 4, LUI.Alignment.Middle ) f44_local2:registerAnimationState( "default", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = 0, left = -255, width = 510, bottom = 0 } ) f44_local2:animateToState( "default" ) self:addElement( f44_local2 ) f44_local2.addHeader( Engine.Localize( "ALIEN_CHAOS_RECAP_TITLE" ) ) local f44_local3 = { r = Colors.alien_tech_tree_bright_grey.r, g = Colors.alien_tech_tree_bright_grey.g, b = Colors.alien_tech_tree_bright_grey.b, a = 1 } f44_local2.addRow( f44_local0.bgPalette.Dark, { { text = Engine.Localize( "ALIEN_CHAOS_RECAP_VALUE" ), color = f44_local3, align = LUI.Alignment.Left }, { text = Engine.Localize( "ALIEN_CHAOS_RECAP_EVENT" ), color = f44_local3, align = LUI.Alignment.Center }, { text = Engine.Localize( "ALIEN_CHAOS_RECAP_COUNT" ), color = f44_local3, align = LUI.Alignment.Left } }, false ) local f44_local4 = 0 local f44_local5 = Engine.GetDvarString( "ui_mapname" ) repeat if Engine.TableLookupByRow( ChaosEventLUT.file, f44_local4, 0 ) == "" then break else local f44_local6 = Engine.TableLookupByRow( ChaosEventLUT.file, f44_local4, ChaosEventLUT.index ) local f44_local7 = true if ChaosEventLUT[f44_local5] then f44_local7 = tonumber( Engine.TableLookupByRow( ChaosEventLUT.file, f44_local4, ChaosEventLUT[f44_local5] ) ) == 1 end if f44_local6 and tonumber( f44_local6 ) and tonumber( f44_local6 ) > 0 and f44_local7 then local f44_local8 = Game.GetOmnvar( "ui_alien_eog_score_row_" .. f44_local6 ) if f44_local8 then local f44_local9, f44_local10 = GetChaosEventInfo( f44_local6 ) f44_local2.addRow( f44_local0.bgPalette.Dark, { { text = f44_local10, color = Colors.alien_scoreboard_dull_grey, align = LUI.Alignment.Right }, { text = f44_local9, color = Colors.alien_scoreboard_dull_grey, align = LUI.Alignment.Left }, { text = f44_local8, color = Colors.alien_chaos_hilite, align = LUI.Alignment.Left, pretty = { initialValue = 0, speed = math.max( 40, f44_local10 / 3 ) } } }, 40 ) end end f44_local4 = f44_local4 + 1 end until f44_local4 >= ChaosEventLUT.size return self end function quick_shop_freeze_item() local self = LUI.UIElement.new( { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 0 } ) self:registerAnimationState( "visible", { alpha = 1 } ) self.id = "element" local f45_local1 = function ( f46_arg0, f46_arg1 ) local f46_local0 = f46_arg0 local f46_local1 = f46_arg0.animateToState local f46_local2 if f46_arg1 then f46_local2 = "visible" if not f46_local2 then else f46_local1( f46_local0, f46_local2, 100 ) end end f46_local2 = "default" end self:registerOmnvarHandler( "ui_alien_chaos_has_meter_freeze", function ( f47_arg0, f47_arg1 ) f45_local1( f47_arg0, f47_arg1.value ) end ) f45_local1( self, Game.GetOmnvar( "ui_alien_chaos_has_meter_freeze" ) ) self:addElement( LUI.mp_hud.AlienHud.quick_shop_item( LUI.Alignment.Bottom, nil, function () return "alien_dpad_icon_freeze" end ) ) return self end function chaos_class_skill_item() local f49_local0 = 40 local f49_local1 = 8 local self = LUI.UIElement.new( { topAnchor = false, bottomAnchor = true, leftAnchor = false, rightAnchor = true, top = -210, bottom = -170, left = -100, right = -60, alpha = 1 } ) self.id = "chaos_class_skill_item" local f49_local3 = LUI.UIImage.new() f49_local3.id = "arrow" f49_local3:registerAnimationState( "default", { material = RegisterMaterial( "alien_dpad_arrow_up" ), topAnchor = false, bottomAnchor = true, leftAnchor = false, rightAnchor = true, top = -9, left = -30, width = 21, height = 11, red = 1, green = 1, blue = 1, alpha = 0 } ) f49_local3:registerAnimationState( "enabled", CoD.ColorizeState( Colors.white, { alpha = 0.8 } ) ) f49_local3:animateToState( "default" ) f49_local3:registerOmnvarHandler( "ui_alien_chaos_class_skill_bonus", function ( f50_arg0, f50_arg1 ) if f50_arg1.value == 0 then f50_arg0:animateToState( "default" ) else f50_arg0:animateToState( "enabled" ) end end ) local f49_local4 = LUI.UIImage.new( { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -50, bottom = -10, left = 0, right = 0, alpha = 1 } ) f49_local4:registerAnimationState( "hidden", { material = RegisterMaterial( "white" ), alpha = 0 } ) f49_local4:registerAnimationState( "specialist", { material = RegisterMaterial( "hud_alien_ammo_infinite" ), alpha = 1 } ) f49_local4:registerAnimationState( "tank", { material = RegisterMaterial( "alien_icon_tank" ), alpha = 1 } ) f49_local4:registerAnimationState( "engineer", { material = RegisterMaterial( "alien_icon_engineer" ), alpha = 1 } ) f49_local4:registerAnimationState( "medic", { material = RegisterMaterial( "alien_icon_medic" ), alpha = 1 } ) f49_local4:animateToState( "hidden" ) f49_local4:registerOmnvarHandler( "ui_alien_chaos_class_skill_bonus", function ( f51_arg0, f51_arg1 ) if f51_arg1.value == 0 then f51_arg0:animateToState( "hidden" ) elseif f51_arg1.value == 1 then f51_arg0:animateToState( "specialist" ) elseif f51_arg1.value == 2 then f51_arg0:animateToState( "tank" ) elseif f51_arg1.value == 3 then f51_arg0:animateToState( "engineer" ) elseif f51_arg1.value == 4 then f51_arg0:animateToState( "medic" ) end end ) self:addElement( f49_local4 ) self:addElement( f49_local3 ) return self end LUI.MenuBuilder.registerType( "chaos_main_score", chaos_main_score ) LUI.MenuBuilder.registerType( "chaos_combo_meter", chaos_combo_meter ) LUI.MenuBuilder.registerType( "chaos_clock", chaos_clock ) LUI.MenuBuilder.registerType( "chaos_perks", chaos_perks ) LUI.MenuBuilder.registerType( "chaos_perk_unlock", chaos_perk_unlock ) LUI.MenuBuilder.registerType( "chaos_event_log", chaos_event_log ) LUI.MenuBuilder.registerType( "chaos_event_recap", chaos_event_recap ) LUI.MenuBuilder.registerType( "quick_shop_freeze_item", quick_shop_freeze_item ) LUI.MenuBuilder.registerType( "chaos_class_skill_item", chaos_class_skill_item ) LockTable( _M )