local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) f0_local0 = 3 f0_local1 = 4 f0_local2 = 100 local f0_local3 = 100 local f0_local4 = 999 local f0_local5 = "" local f0_local6 = "" local f0_local7 = {} local f0_local8 = 1 local f0_local9 = function ( f1_arg0, f1_arg1 ) end local f0_local10 = function ( f2_arg0 ) local f2_local0 = false end local f0_local11 = function ( f3_arg0 ) local f3_local0 = -1 for f3_local1 = 1, #f3_arg0, 1 do if f3_arg0[f3_local1].value == f0_local4 then f3_local0 = f3_local1 break end end return f3_local0 end local f0_local12 = function ( f4_arg0, f4_arg1 ) local f4_local0 = -1 for f4_local1 = 1, #f4_arg0, 1 do if f4_arg0[f4_local1].value == f4_arg1 then f4_local0 = f4_local1 break end end return f4_local0 end local f0_local13 = function ( f5_arg0, f5_arg1 ) local f5_local0 = f5_arg0:getParent() repeat f5_local0 = f5_local0:getParent() assert( f5_local0, "killstreak_selections_id was not found" ) until f5_local0.id == "killstreak_selections_id" local f5_local1 = f5_local0:getFirstDescendentById( "killstreak_selections_focused_text_vl_id" ) local f5_local2 = f5_local1:getChildById( "killstreak_selections_focused_text_1_id" ) local f5_local3 = f5_local1:getChildById( "killstreak_selections_focused_text_1_desc_id" ) local f5_local4 = "none" local f5_local5 = "" if f5_arg0.properties.killstreak_name then local f5_local6 = f5_arg0.properties.killstreak_name f5_local4 = Engine.Localize( "@" .. Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, f5_local6, KillstreakTable.Cols.Name ) ) f5_local5 = Engine.Localize( "@" .. Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, f5_local6, KillstreakTable.Cols.Desc ) ) end f5_local2:setText( f5_local4 ) f5_local3:setText( f5_local5 ) end local f0_local14 = function ( f6_arg0 ) local f6_local0 = f6_arg0:getParent() repeat f6_local0 = f6_local0:getParent() assert( f6_local0, "killstreak_selections_id was not found" ) until f6_local0.id == "killstreak_selections_id" local f6_local1 = f6_local0:getFirstDescendentById( "killstreak_selections_ks_already_selected_id" ) f6_local1:setText( Engine.Localize( "@LUA_MENU_N_KILLSTREAK_SELECTED", tonumber( f6_arg0.properties.kill_num ) ) ) f6_local0:dispatchEventToChildren( { name = "hideDescInfo" } ) f6_local0:dispatchEventToChildren( { name = "showSelectedMsg" } ) end local f0_local15 = function ( f7_arg0, f7_arg1 ) local f7_local0 = f7_arg0.properties.slot local f7_local1 = f7_arg0.properties.exclusiveController local f7_local2 = f7_arg0.properties.classLocation local f7_local3 = Cac.GetStreakTypeReference( f7_arg0.properties.streakType ) if f0_local11( f0_local7[f7_local0] ) > 0 then if not f7_arg0.selected then local f7_local4 = false for f7_local5 = 1, #f0_local7[f7_local0], 1 do if f7_arg0.properties.kill_num == f0_local7[f7_local0][f7_local5].value or f7_arg0.properties.killstreak_name == "none" then f7_local4 = true end end if f7_local4 then f7_arg0.blocked = true end f7_arg0.blocked = false end elseif not f7_arg0.selected then f7_arg0.blocked = true end if f7_arg1.reset then f7_arg0.selected = false f7_arg0.shouldHighlight = false local f7_local4 = f7_arg0:getParent() f7_local4:dispatchEventToChildren( { name = "button_update" } ) elseif f7_arg0.selected then f7_arg0:dispatchEventToChildren( { name = "button_tab_selected" } ) f7_arg0:dispatchEventToChildren( { name = "button_txt_selected" } ) f7_arg0:dispatchEventToChildren( { name = "updateBackgroundColor", alpha = 0 } ) if f7_arg0.shouldHighlight then f7_arg0:dispatchEventToChildren( { name = "updateBackgroundOutlineColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.outline_over.a } ) else f7_arg0:dispatchEventToChildren( { name = "updateBackgroundOutlineColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.outline_up.a } ) end elseif f7_arg0.blocked then f7_arg0:dispatchEventToChildren( { name = "updateBackgroundColor", alpha = 0 } ) if f7_arg0.shouldHighlight then f7_arg0:dispatchEventToChildren( { name = "button_tab_focused_disabled" } ) f7_arg0:dispatchEventToChildren( { name = "button_txt_focused_blocked" } ) f7_arg0:dispatchEventToChildren( { name = "button_icon_focused_blocked" } ) f7_arg0:dispatchEventToChildren( { name = "updateBackgroundOutlineColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.outline_over.a } ) else f7_arg0:dispatchEventToChildren( { name = "button_tab_unfocused_disabled" } ) f7_arg0:dispatchEventToChildren( { name = "button_txt_unfocused_blocked" } ) f7_arg0:dispatchEventToChildren( { name = "button_icon_unfocused_blocked" } ) f7_arg0:dispatchEventToChildren( { name = "updateBackgroundOutlineColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.outline_up.a } ) end elseif f7_arg0.shouldHighlight or f7_arg0.focused then f7_arg0:dispatchEventToChildren( { name = "button_tab_focused" } ) f7_arg0:dispatchEventToChildren( { name = "button_txt_focused" } ) f7_arg0:dispatchEventToChildren( { name = "button_icon_focused" } ) f7_arg0:dispatchEventToChildren( { name = "button_bg_focused" } ) f7_arg0:dispatchEventToChildren( { name = "updateBackgroundColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.background_over.a } ) f7_arg0:dispatchEventToChildren( { name = "updateBackgroundOutlineColor", alpha = 0 } ) else f7_arg0:dispatchEventToChildren( { name = "button_tab_unselected" } ) f7_arg0:dispatchEventToChildren( { name = "button_txt_unfocused" } ) f7_arg0:dispatchEventToChildren( { name = "button_icon_unfocused" } ) f7_arg0:dispatchEventToChildren( { name = "updateBackgroundColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.background_up.a } ) f7_arg0:dispatchEventToChildren( { name = "updateBackgroundOutlineColor", alpha = 0 } ) end if f7_arg0.shouldHighlight then f7_arg0.shouldHighlight = false end if not f7_arg0.properties.isUnlocked then if not Cac.IsItemUnlocked( f7_arg0.properties.exclusiveController, f7_arg0.properties.squadLocation, f7_arg0.properties.squadMemberIndex, f7_arg0.properties.killstreak_name ) then f7_arg0:dispatchEventToChildren( { name = "button_txt_locked" } ) else f7_arg0:dispatchEventToChildren( { name = "button_txt_unlocked" } ) f7_arg0.properties.isUnlocked = true end else f7_arg0:dispatchEventToChildren( { name = "button_txt_unlocked" } ) end end local f0_local16 = function ( f8_arg0, f8_arg1 ) local f8_local0 = f8_arg0.properties.slot local f8_local1 = f8_arg1.ks_array local f8_local2 = f8_arg1.button_display_array for f8_local3 = 1, #f8_local1, 1 do local f8_local6 = f8_local1[f8_local3] if f8_local6 ~= "none" and f8_local6 == f8_arg0.properties.killstreak_name then local f8_local7 = f8_local2[f8_local3]:getChildById( "button_text_id" ) f8_local7:setText( f8_arg0.properties.true_text ) f8_arg0.selected = true CoD.SetMaterial( f8_local2[f8_local3]:getChildById( "button_ks_image_id" ), RegisterMaterial( Cac.GetStreakIcon( Cac.KillstreakRefArray[f8_arg0.properties.killstreak_ref], f8_arg0.properties.exclusiveController ) ), 1, 0 ) f0_local7[f8_local0][f8_local3].value = f8_arg0.properties.kill_num f0_local7[f8_local0][f8_local3].name = f8_arg0.properties.killstreak_name f0_local7[f8_local0][f8_local3].ref = f8_arg0.properties.killstreak_ref end end end local f0_local17 = function ( f9_arg0, f9_arg1 ) LUI.FlowManager.RequestLeaveMenu( f9_arg0 ) end local f0_local18 = function ( f10_arg0, f10_arg1 ) local f10_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "killstreak_selections" ) unlockItem( f10_arg1.controller, f10_local0.cac_purchase.ks_name ) f10_arg0:dispatchEventToRoot( { name = "cac_update_currency_text" } ) f10_arg0:dispatchEventToRoot( { name = "update_cac_info_panel", controller = f10_arg1.controller, dispatchChildren = true } ) f10_local0.cac_purchase.ksMenu:processEvent( { name = "killstreak_selection_func", controller = f10_arg1.controller } ) LUI.FlowManager.RequestLeaveMenu( f10_arg0, true ) end function cac_cant_purchase_killstreak_popup() local f11_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "killstreak_selections" ) local f11_local1 = Cac.GetKillstreakName( f11_local0.cac_purchase.ks_name ) local f11_local2 = Cac.GetStreakIcon( f11_local0.cac_purchase.ks_name ) local f11_local3 = Engine.Localize( "@LUA_MENU_UNABLE_TO_PURCHASE_N", f11_local1 ) local f11_local4 = f11_local0.cac_purchase.ks_cost local f11_local5 = RegisterMaterial( "icon_unlock_token_active" ) return { type = "generic_yesno_with_image_popup", properties = { popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ), message_image = RegisterMaterial( f11_local2 ), message_image_top = -15, message_image_left = 35, message_cost_text = Engine.Localize( "@LUA_MENU_COST" ), message_cost_image = f11_local5, message_cost = f11_local4, message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ), message_squad_points_image = f11_local5, message_squad_points = f11_local0.cac_purchase.currentCurrency, no_text = f11_local3, no_action = f0_local17 } } end function cac_purchase_killstreak_popup() local f12_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "killstreak_selections" ) local f12_local1 = Cac.GetKillstreakName( f12_local0.cac_purchase.ks_name ) local f12_local2 = Cac.GetStreakIcon( f12_local0.cac_purchase.ks_name, f12_local0.exclusiveControllerIndex ) local f12_local3 = Engine.Localize( "@LUA_MENU_PURCHASE_N", f12_local1 ) local f12_local4 = f12_local0.cac_purchase.ks_cost local f12_local5 = RegisterMaterial( "icon_unlock_token_active" ) return { type = "generic_yesno_with_image_popup", properties = { popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ), message_image = RegisterMaterial( f12_local2 ), message_image_top = -15, message_image_left = 35, message_cost_text = Engine.Localize( "@LUA_MENU_COST" ), message_cost_image = f12_local5, message_cost = f12_local4, message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ), message_squad_points_image = f12_local5, message_squad_points = f12_local0.cac_purchase.currentCurrency, yes_text = f12_local3, no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), yes_action = f0_local18, no_action = f0_local17 } } end function UpdateSelectedKillstreakInfo( f13_arg0, f13_arg1, f13_arg2, f13_arg3, f13_arg4, f13_arg5, f13_arg6 ) local f13_local0 = f13_arg0:getFirstDescendentById( "killstreak_selections_selected_buttons_id" ) local f13_local1 = { f13_local0:getChildById( "killstreak_selections_button_display_1_id" ), f13_local0:getChildById( "killstreak_selections_button_display_2_id" ), f13_local0:getChildById( "killstreak_selections_button_display_3_id" ) } for f13_local2 = 1, #f13_local1, 1 do local f13_local5 = f13_local1[f13_local2]:getChildById( "button_text_id" ) local f13_local6 = f13_local1[f13_local2]:getChildById( "button_ks_image_id" ) local f13_local7 = f0_local7[f13_arg5][f13_local2] if f13_local7.value ~= f0_local4 then f13_local5:setText( Engine.Localize( "@LUA_MENU_N_POINTS", f13_local7.value ) ) CoD.SetMaterial( f13_local6, RegisterMaterial( Cac.GetStreakIcon( Cac.KillstreakRefArray[f13_local7.ref], f13_arg1 ) ), 1, 0 ) Cac.SetKillstreak( f13_arg1, f13_arg2, f13_arg3, f13_arg4, f13_arg5, f13_arg6, f13_local2 - 1, f13_local7.name ) else f13_local5:setText( "" ) CoD.SetMaterial( f13_local6, RegisterMaterial( "icon_weapon_ph_sp_diamond_64" ), 0.15, 0 ) Cac.SetKillstreak( f13_arg1, f13_arg2, f13_arg3, f13_arg4, f13_arg5, f13_arg6, f13_local2 - 1, "none" ) end end end local f0_local19 = function ( f14_arg0, f14_arg1 ) local f14_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f14_arg0 ) local f14_local1 = f14_arg0.properties.slot local f14_local2 = f14_arg0.properties.exclusiveController local f14_local3 = f14_arg0.properties.classLocation local f14_local4 = Cac.GetStreakTypeReference( f14_arg0.properties.streakType ) local f14_local5 = f14_arg0.properties.squadLocation local f14_local6 = f14_arg0.properties.squadMemberIndex local f14_local7 = Cac.IsItemUnlocked( f14_local2, f14_local5, f14_local6, f14_arg0.properties.killstreak_name ) local f14_local8 = tonumber( Cac.GetCurrency( f14_arg1.controller ) ) local f14_local9 = tonumber( f14_arg0.properties.cost ) f14_local0.cac_purchase = { ks_name = f14_arg0.properties.killstreak_name, ks_cost = f14_local9, currentCurrency = f14_local8, ksMenu = f14_arg0 } if not f14_local7 then if f14_local8 < f14_local9 then LUI.FlowManager.RequestPopupMenu( f14_arg0, "cac_cant_purchase_killstreak_popup", true, f14_arg1.controller, false, f14_arg0.properties ) else LUI.FlowManager.RequestPopupMenu( f14_arg0, "cac_purchase_killstreak_popup", true, f14_arg1.controller, false, f14_arg0.properties ) end return elseif f14_arg0.selected == nil or not f14_arg0.selected then local f14_local10 = f0_local11( f0_local7[f14_local1] ) if f14_local10 > 0 and not f14_arg0.blocked then Engine.PlaySound( CoD.SFX.CacSelectStrikePackage ) f14_arg0.selected = true f0_local7[f14_local1][f14_local10].value = f14_arg0.properties.kill_num f0_local7[f14_local1][f14_local10].name = f14_arg0.properties.killstreak_name f0_local7[f14_local1][f14_local10].ref = f14_arg0.properties.killstreak_ref f0_local7[f14_local1] = f0_local10( f0_local7[f14_local1] ) else Engine.PlaySound( CoD.SFX.DenySelect ) if f14_local10 > 0 and f14_arg0.blocked then f0_local14( f14_arg0 ) end end elseif f14_arg0.selected then f14_arg0.selected = false local f14_local10 = f0_local12( f0_local7[f14_local1], f14_arg0.properties.kill_num ) Engine.PlaySound( CoD.SFX.CacDeselectStrikePackage ) f0_local7[f14_local1][f14_local10].value = f0_local4 f0_local7[f14_local1][f14_local10].name = f0_local5 f0_local7[f14_local1][f14_local10].ref = f0_local6 f0_local7[f14_local1] = f0_local10( f0_local7[f14_local1] ) else assert( nil, "Why did it get here?" ) end f14_arg0.shouldHighlight = true local f14_local10 = f14_arg0:getParent() repeat f14_local10 = f14_local10:getParent() assert( f14_local10, "killstreak_selections_vl_id was not found" ) until f14_local10.id == "killstreak_selections_vl_id" f14_local10:dispatchEventToChildren( { name = "button_update" } ) UpdateSelectedKillstreakInfo( f14_local10, f14_local2, f14_local5, f14_local6, f14_local3, f14_local1, f14_local4 ) f14_arg0:dispatchEventToRoot( { name = "update_cac_info_panel", controller = f14_local2, dispatchChildren = true } ) end local f0_local20 = function ( f15_arg0, f15_arg1 ) local f15_local0 = f15_arg0.properties.slot local f15_local1 = f15_arg0.properties.exclusiveController local f15_local2 = f15_arg0.properties.classLocation local f15_local3 = f15_arg0.properties.squadLocation local f15_local4 = f15_arg0.properties.squadMemberIndex f0_local7[f15_local0] = { { value = f0_local4, name = f0_local5, ref = f0_local6 }, { value = f0_local4, name = f0_local5, ref = f0_local6 }, { value = f0_local4, name = f0_local5, ref = f0_local6 } } local f15_local5 = f15_arg0:getChildById( "killstreak_selections_vl_id" ) local f15_local6 = f15_local5:getFirstDescendentById( "killstreak_selections_selected_buttons_id" ) f15_local5:dispatchEventToChildren( { name = "button_check", ks_array = { Cac.GetStreak1( f15_local1, f15_local3, f15_local4, f15_local2, f15_local0 ), Cac.GetStreak2( f15_local1, f15_local3, f15_local4, f15_local2, f15_local0 ), Cac.GetStreak3( f15_local1, f15_local3, f15_local4, f15_local2, f15_local0 ) }, button_display_array = { f15_local6:getChildById( "killstreak_selections_button_display_1_id" ), f15_local6:getChildById( "killstreak_selections_button_display_2_id" ), f15_local6:getChildById( "killstreak_selections_button_display_3_id" ) } } ) f15_local5:dispatchEventToChildren( { name = "button_update" } ) end local f0_local21 = function ( f16_arg0, f16_arg1 ) local f16_local0 = f16_arg0.selected local f16_local1 = f16_arg0.blocked if not f16_local0 then if not f16_local1 then f16_arg0:dispatchEventToChildren( { name = "button_tab_focused" } ) f16_arg0:dispatchEventToChildren( { name = "button_txt_focused" } ) f16_arg0:dispatchEventToChildren( { name = "button_icon_focused" } ) f16_arg0:dispatchEventToChildren( { name = "button_bg_focused" } ) f16_arg0:dispatchEventToChildren( { name = "updateBackgroundColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.background_over.a } ) else f16_arg0:dispatchEventToChildren( { name = "button_tab_focused_disabled" } ) f16_arg0:dispatchEventToChildren( { name = "button_txt_focused_blocked" } ) f16_arg0:dispatchEventToChildren( { name = "button_icon_focused_blocked" } ) f16_arg0:dispatchEventToChildren( { name = "updateBackgroundOutlineColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.outline_over.a } ) end else f16_arg0:dispatchEventToChildren( { name = "updateBackgroundOutlineColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.outline_over.a } ) end if not f16_arg0.properties.isUnlocked then if not Cac.IsItemUnlocked( f16_arg0.properties.exclusiveController, f16_arg0.properties.squadLocation, f16_arg0.properties.squadMemberIndex, f16_arg0.properties.killstreak_name ) then f16_arg0:dispatchEventToChildren( { name = "button_txt_locked" } ) else f16_arg0:dispatchEventToChildren( { name = "button_txt_unlocked" } ) f16_arg0.properties.isUnlocked = true end end f16_arg0.focused = true if MatchRules.AllowCustomClasses( f16_arg0.properties.classLocation ) then if f16_arg0.restricted then f16_arg0:dispatchEventToRoot( { name = "show_class_restrictions_warning", immediate = true } ) else f16_arg0:dispatchEventToRoot( { name = "hide_class_restrictions_warning", immediate = true } ) end end end local f0_local22 = function ( f17_arg0, f17_arg1 ) local f17_local0 = f17_arg0.selected local f17_local1 = f17_arg0.blocked if not f17_local0 then if not f17_local1 then f17_arg0:dispatchEventToChildren( { name = "button_tab_unfocused" } ) f17_arg0:dispatchEventToChildren( { name = "button_txt_unfocused" } ) f17_arg0:dispatchEventToChildren( { name = "button_icon_unfocused" } ) f17_arg0:dispatchEventToChildren( { name = "button_bg_unfocused" } ) f17_arg0:dispatchEventToChildren( { name = "updateBackgroundColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.background_up.a } ) else f17_arg0:dispatchEventToChildren( { name = "button_tab_unfocused_disabled" } ) f17_arg0:dispatchEventToChildren( { name = "button_txt_unfocused_blocked" } ) f17_arg0:dispatchEventToChildren( { name = "button_icon_unfocused_blocked" } ) f17_arg0:dispatchEventToChildren( { name = "updateBackgroundOutlineColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.outline_up.a } ) end else f17_arg0:dispatchEventToChildren( { name = "updateBackgroundOutlineColor", red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = Cac.Selection.outline_up.a } ) end if not f17_arg0.properties.isUnlocked then if not Cac.IsItemUnlocked( f17_arg0.properties.exclusiveController, f17_arg0.properties.squadLocation, f17_arg0.properties.squadMemberIndex, f17_arg0.properties.killstreak_name ) then f17_arg0:dispatchEventToChildren( { name = "button_txt_locked" } ) else f17_arg0:dispatchEventToChildren( { name = "button_txt_unlocked" } ) f17_arg0.properties.isUnlocked = true end end f17_arg0.focused = false end local f0_local23 = function ( f18_arg0 ) local f18_local0 = 12 local f18_local1 = {} for f18_local2 = 1, f18_local0, 1 do f18_local1[#f18_local1 + 1] = { type = "killstreak_selection_button", id = "killstreak_selections_button_" .. f18_local2 .. "_id", properties = { slot = f18_arg0.slot, streakType = f18_arg0.streakType, classLocation = f18_arg0.classLocation, exclusiveController = f18_arg0.exclusiveController, squadLocation = f18_arg0.squadLocation, squadMemberIndex = f18_arg0.squadMemberIndex, muteAction = true, text = Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, Cac.KillstreakRefArray["ks_" .. f18_local2], KillstreakTable.Cols.Kills ), true_text = Engine.Localize( "@LUA_MENU_N_POINTS", tonumber( Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, Cac.KillstreakRefArray["ks_" .. f18_local2], KillstreakTable.Cols.Kills ) ) ), button_action_func = f0_local19, kill_num = tonumber( Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, Cac.KillstreakRefArray["ks_" .. f18_local2], KillstreakTable.Cols.Kills ) ), killstreak_ref = "ks_" .. f18_local2, killstreak_name = Cac.KillstreakRefArray["ks_" .. f18_local2], material_ks = RegisterMaterial( Cac.GetStreakIcon( Cac.KillstreakRefArray["ks_" .. f18_local2], f18_arg0.exclusiveController ) ), isUnlocked = Cac.IsItemUnlocked( f18_arg0.exclusiveController, f18_arg0.squadLocation, f18_arg0.squadMemberIndex, Cac.KillstreakRefArray["ks_" .. f18_local2] ), cost = Cac.GetItemCost( Cac.KillstreakRefArray["ks_" .. f18_local2] ), additional_handlers = { killstreak_selection_func = f0_local19 } } } end return f18_local1 end local f0_local24 = function () return { type = "UIElement", id = "killstreak_selections_id", states = { default = { topAnchor = true, leftAnchor = true, bottomAnchor = false, rightAnchor = false, top = Cac.Layout.KillstreakSelectionPanel.top, left = Cac.Layout.KillstreakSelectionPanel.left, bottom = Cac.Layout.KillstreakSelectionPanel.bottom, right = Cac.Layout.KillstreakSelectionPanel.right } }, handlers = { menu_create = function ( f20_arg0, f20_arg1 ) f20_arg0:dispatchEventToRoot( { name = "add_button_helper_text", button_ref = "button_alt1", helper_text = Engine.Localize( "@MENU_RESET" ), side = "left", clickable = true } ) f0_local20( f20_arg0, f20_arg1 ) f0_local8 = 1 end }, children = { { type = "UIVerticalList", id = "killstreak_selections_vl_id", focusable = true, properties = { slot = MBh.Property( "slot" ), streakType = MBh.Property( "streakType" ), classLocation = MBh.Property( "classLocation" ), exclusiveController = MBh.Property( "exclusiveController" ), squadLocation = MBh.Property( "squadLocation" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ) }, states = { default = { topAnchor = true, leftAnchor = true, bottomAnchor = false, rightAnchor = false, top = 0, left = 0, height = f0_local2 * f0_local0, width = f0_local3 * f0_local1, alignment = LUI.Alignment.Left, spacing = 16 } }, children = { { type = "UIElement", focusable = false, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, left = 0, width = 430, height = 200 } }, children = { { type = "generic_drop_shadow", properties = { offset_shadow = 0 }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = Cac.Swatches.Alphas.cac_panel_background_shadow } } }, { type = "generic_menu_background", properties = { top_offset = 0 } }, { type = "UIElement", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = -75, left = 0, right = 0 } }, children = { { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 1, bottom = 0, left = 1, right = -1, material = RegisterMaterial( "white" ), red = 0, green = 0, blue = 0, alpha = 0.25 } } }, { type = "UIHorizontalList", id = "killstreak_selections_selected_buttons_id", focusable = false, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = false, rightAnchor = false, top = 0, bottom = 0, left = -214, right = 214, alignment = LUI.Alignment.Center, spacing = 0 } }, children = { { type = "killstreak_display_selection_button", id = "killstreak_selections_button_display_1_id", properties = { slot = MBh.Property( "slot" ), streakType = MBh.Property( "streakType" ), classLocation = MBh.Property( "classLocation" ), exclusiveController = MBh.Property( "exclusiveController" ), squadLocation = MBh.Property( "squadLocation" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ), text = "" } }, { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 18, left = 0, height = 64, width = 64, alpha = 0.5, material = RegisterMaterial( "fluff_arrow_cas" ) } } }, { type = "killstreak_display_selection_button", id = "killstreak_selections_button_display_2_id", properties = { slot = MBh.Property( "slot" ), streakType = MBh.Property( "streakType" ), classLocation = MBh.Property( "classLocation" ), exclusiveController = MBh.Property( "exclusiveController" ), squadLocation = MBh.Property( "squadLocation" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ), text = "" } }, { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 18, left = 0, height = 64, width = 64, alpha = 0.5, material = RegisterMaterial( "fluff_arrow_cas" ) } } }, { type = "killstreak_display_selection_button", id = "killstreak_selections_button_display_3_id", properties = { slot = MBh.Property( "slot" ), streakType = MBh.Property( "streakType" ), classLocation = MBh.Property( "classLocation" ), exclusiveController = MBh.Property( "exclusiveController" ), squadLocation = MBh.Property( "squadLocation" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ), text = "" } } } } } }, { type = "UIElement", id = "killstreak_selections_description_info_id", states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -75, bottom = 0, left = 0, right = 0 } }, handlers = { showDescInfo = function ( f21_arg0, f21_arg1 ) f21_arg0:dispatchEventToChildren( { name = "showDescInfo" } ) end }, children = { { type = "UIText", id = "killstreak_selections_ks_already_selected_id", focusable = false, properties = { text = "killstreak already selected" }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 5, bottom = 5 + CoD.TextSettings.ExtraBigFont.Height, left = 0, right = 0, font = CoD.TextSettings.ExtraBigFont.Font, alignment = LUI.Alignment.Center, red = Colors.secondary_text_color.r, green = Colors.secondary_text_color.g, blue = Colors.secondary_text_color.b, alpha = 0 }, show = { alpha = 1 }, hide = { alpha = 0 } }, handlers = { showSelectedMsg = MBh.AnimateToStateWithEvent( "show", 150, false, false ), hideSelectedMsg = function ( f22_arg0, f22_arg1 ) f22_arg0:animateToState( "hide", 150, false, false ) f22_arg0:dispatchEventToParent( { name = "showDescInfo" } ) end , transition_complete_show = function ( f23_arg0, f23_arg1 ) if not f23_arg0:getChildById( "LUITimer" ) then f23_arg0:addElement( LUI.UITimer.new( 2000, "hideSelectedMsg", nil, f23_arg0 ) ) end end } }, { type = "UIVerticalList", id = "killstreak_selections_focused_text_vl_id", focusable = false, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 5, bottom = 0, left = 0, right = 0, alignment = LUI.Alignment.Left, spacing = 0, alpha = 1 }, show = { alpha = 1 }, hide = { alpha = 0 } }, handlers = { showDescInfo = MBh.AnimateToState( "show", 250 ), hideDescInfo = MBh.AnimateToState( "hide", 0 ) }, children = { { type = "UIText", id = "killstreak_selections_focused_text_1_id", focusable = false, properties = { text = "killstreak 1" }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, left = 10, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Left, red = 1, green = 1, blue = 1 } } }, { type = "UIText", id = "killstreak_selections_focused_text_1_desc_id", focusable = false, properties = { text = "killstreak 1 desc" }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, left = 10, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Left, red = Colors.secondary_text_color.r, green = Colors.secondary_text_color.g, blue = Colors.secondary_text_color.b } } } } } } } } }, { type = "UIGrid", id = "killstreak_selections_grid_id", focusable = true, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, left = 0, width = 430, height = 330 } }, properties = { elementsPerRow = 4, hSpacing = 10, rowHeight = 110, hAlign = LUI.Alignment.Left, vAlign = LUI.Alignment.Top, slot = MBh.Property( "slot" ), streakType = MBh.Property( "streakType" ), classLocation = MBh.Property( "classLocation" ), exclusiveController = MBh.Property( "exclusiveController" ), squadLocation = MBh.Property( "squadLocation" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ) }, childrenFeeder = f0_local23, handlers = { updateGrid = UpdateGridChildren } } } }, { type = "generic_back_button", id = "killstreak_selections_back_button_id", handlers = { button_secondary = function ( f24_arg0, f24_arg1 ) f24_arg0:dispatchEventToRoot( { name = "add_button_helper_text", button_ref = "button_alt1", helper_text = "", side = "left", clickable = true } ) f24_arg0:dispatchEventToRoot( { name = "show_character_image", immediate = true } ) f24_arg0:dispatchEventToRoot( { name = "unlock_edit_popup", immediate = true } ) LUI.FlowManager.RequestLeaveMenu( f24_arg0 ) end } }, { type = "UIBindButton", id = "reset_killstreaks", properties = { slot = MBh.Property( "slot" ), streakType = MBh.Property( "streakType" ), classLocation = MBh.Property( "classLocation" ), squadLocation = MBh.Property( "squadLocation" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ) }, handlers = { button_alt1 = function ( f25_arg0, f25_arg1 ) Cac.ResetKillstreak( f25_arg1.controller, f25_arg0.properties.squadLocation, f25_arg0.properties.squadMemberIndex, f25_arg0.properties.classLocation, f25_arg0.properties.slot, Cac.GetStreakTypeReference( f25_arg0.properties.streakType ) ) f0_local20( f25_arg0:getParent(), f25_arg1 ) UpdateSelectedKillstreakInfo( f25_arg0:getParent(), f25_arg1.controller, f25_arg0.properties.squadLocation, f25_arg0.properties.squadMemberIndex, f25_arg0.properties.classLocation, f25_arg0.properties.slot, Cac.GetStreakTypeReference( f25_arg0.properties.streakType ) ) local f25_local0 = f25_arg0:getParent() f25_local0:dispatchEventToChildren( { name = "button_update", reset = true, dispatchChildren = true } ) f25_arg0:dispatchEventToRoot( { name = "update_cac_info_panel", controller = f25_arg1.controller, dispatchChildren = true, immediate = true } ) end } } } } end local f0_local25 = function () return { type = "UIButton", focusable = true, audio = { button_over = CoD.SFX.SubMenuMouseOver }, properties = { text = "button", height = f0_local2, width = f0_local3, button_action_func = f0_local9, material_bg = RegisterMaterial( "ks_selection_bg" ), material_ks = RegisterMaterial( "icon_weapon_ph_sp_diamond_64" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, left = 0, height = MBh.Property( "height" ), width = MBh.Property( "width" ) } }, handlers = { button_action = MBh.Property( "button_action_func" ), button_over = MBh.DoMultiple( { f0_local21, f0_local13 } ), button_up = f0_local22, button_update = f0_local15, button_check = f0_local16, menu_create = function ( f27_arg0, f27_arg1 ) local f27_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f27_arg0 ) if MatchRules.AllowCustomClasses( f27_arg0.properties.classLocation ) then local f27_local1, f27_local2 = Cac.SafeGetMatchRule( "commonOption", "killstreakRestricted", f27_arg0.properties.killstreak_name ) local f27_local3 = f27_local1 and f27_local2 f27_local1, f27_local2 = Cac.SafeGetMatchRule( "commonOption", "killstreakClassRestricted", f27_arg0.properties.streakType ) if not f27_local3 then f27_local3 = f27_local1 and f27_local2 end if f27_local3 then local f27_local4 = Cac.GetRestrictIcon( -2, -2, 28 ) f27_local4.id = "restrict_icon" .. f27_arg0.properties.killstreak_name f27_arg0:addElement( f27_local4 ) f27_arg0.restricted = true else f27_arg0.restricted = false end end end }, children = { { type = "UIElement", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 1 }, dim = { alpha = 0.8 } }, handlers = { button_bg_focused = MBh.AnimateLoop( { { "dim", 750, true, true }, { "default", 750 } } ), button_bg_unfocused = MBh.AnimateToState( "default", 0 ) }, children = { { type = "cac_edit_choose_image_button_background", properties = { alpha = 0 } } } }, { type = "cac_edit_choose_image_button_background_outline", properties = { alpha = 0 } }, { type = "UIImage", id = "button_ks_image_id", states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = -32, bottom = 32, left = -32, right = 32, material = MBh.Property( "material_ks" ), alpha = 1 }, selected = MBh.BaseState( "default", {} ), focused = MBh.BaseState( "default", { scale = 0.1 } ), unfocused = MBh.BaseState( "default", { scale = 0 } ), focused_blocked = { alpha = 0.75 }, unfocused_blocked = { alpha = 0.25 } }, handlers = { button_icon_selected = MBh.AnimateToState( "selected", 0 ), button_icon_focused = MBh.AnimateSequence( { { "unfocused", 0 }, { "focused", 100 }, { "unfocused", 100 } } ), button_icon_unfocused = MBh.AnimateToState( "unfocused", 0 ), button_icon_focused_blocked = MBh.AnimateToState( "focused_blocked", 0 ), button_icon_unfocused_blocked = MBh.AnimateToState( "unfocused_blocked", 0 ) } }, { type = "UIImage", states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = false, material = RegisterMaterial( "icon_unlock_token_active" ), left = 3, width = 16, height = 16, bottom = -3 }, unlocked = { alpha = 0 }, locked = { alpha = 1 } }, handlers = { button_txt_locked = MBh.AnimateToState( "locked", 0 ), button_txt_unlocked = MBh.AnimateToState( "unlocked", 0 ) } }, { type = "UIText", properties = { text = MBh.Property( "cost" ) }, states = { default = CoD.ColorizeState( Colors.white, { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, left = 19, right = 0, height = CoD.TextSettings.TinyFont.Height, font = CoD.TextSettings.SmallFont.Font, alignment = LUI.Alignment.Left, bottom = -4 } ), unlocked = { alpha = 0 }, locked = { alpha = 1 } }, handlers = { button_txt_locked = MBh.AnimateToState( "locked", 0 ), button_txt_unlocked = MBh.AnimateToState( "unlocked", 0 ) } }, { type = "UIText", id = "button_text_id", properties = { text = MBh.Property( "text" ) }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = -1 * (2 + CoD.TextSettings.NormalFont.Height), bottom = -2, left = 8, right = 0, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Left, right = -4, red = Colors.secondary_text_color.r, green = Colors.secondary_text_color.g, blue = Colors.secondary_text_color.b, alpha = 1 }, selected = { red = Colors.frontend_hilite.r, green = Colors.frontend_hilite.g, blue = Colors.frontend_hilite.b, alpha = 1 }, locked = { alpha = 0 }, focused = { red = 1, green = 1, blue = 1, alpha = 1 }, focused_blocked = { red = Colors.generic_button_text_disabled_color.r, green = Colors.generic_button_text_disabled_color.g, blue = Colors.generic_button_text_disabled_color.b, alpha = 1 }, unselected = MBh.BaseState( "focused", {} ), unfocused = MBh.BaseState( "default", {} ), unfocused_blocked = { red = Colors.secondary_text_color.r, green = Colors.secondary_text_color.g, blue = Colors.secondary_text_color.b, alpha = 1 } }, handlers = { button_txt_selected = MBh.AnimateToState( "selected", 0 ), button_txt_unselected = MBh.AnimateToState( "unselected", 0 ), button_txt_focused = MBh.AnimateToState( "focused", 0 ), button_txt_unfocused = MBh.AnimateToState( "unfocused", 0 ), button_txt_focused_blocked = MBh.AnimateToState( "focused_blocked", 0 ), button_txt_unfocused_blocked = MBh.AnimateToState( "unfocused_blocked", 0 ), button_txt_locked = MBh.AnimateToState( "locked", 0 ) } }, { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, bottom = 16, left = 0, right = 16, material = RegisterMaterial( "widg_triangle" ), alpha = 0 }, focused = { material = RegisterMaterial( "widg_triangle" ), red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = 1 }, unfocused = { material = RegisterMaterial( "widg_triangle" ), red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = 0 }, selected = { red = Colors.frontend_hilite.r, green = Colors.frontend_hilite.g, blue = Colors.frontend_hilite.b, alpha = 1 }, unselected = { red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b, alpha = 0 }, focused_disabled = { material = RegisterMaterial( "widg_triangle_outline" ), alpha = Cac.Selection.outline_over.a }, unfocused_disabled = { material = RegisterMaterial( "widg_triangle" ), alpha = 0 } }, handlers = { button_tab_selected = MBh.AnimateToState( "selected", 0 ), button_tab_unselected = MBh.AnimateToState( "unselected", 0 ), button_tab_focused = MBh.AnimateToState( "focused", 0 ), button_tab_unfocused = MBh.AnimateToState( "unfocused", 0 ), button_tab_focused_disabled = MBh.AnimateToState( "focused_disabled", 0 ), button_tab_unfocused_disabled = MBh.AnimateToState( "unfocused_disabled", 0 ) } } } } end local f0_local26 = function () return { type = "UIElement", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } }, children = { { type = "UIImage", id = "selection_btn_bg_id", 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 = 0.5 }, focused = { red = 1, green = 1, blue = 1, alpha = 0.25 }, unfocused = MBh.BaseState( "default", {} ) }, handlers = {} }, { type = "generic_border", id = "selection_btn_border_id", properties = { thickness = 2, border_red = Colors.secondary_text_color.r, border_green = Colors.secondary_text_color.g, border_blue = Colors.secondary_text_color.b, border_alpha = 1 } }, { type = "UIImage", id = "selection_btn_check_box_id", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 5, bottom = 15, left = 5, right = 15, material = RegisterMaterial( "box_titlebar_angle_mid" ), alpha = 1 }, blocked = { alpha = 0 }, unblocked = { alpha = 1 } }, handlers = { buttonBlocked = MBh.AnimateToState( "blocked", 0 ), buttonUnblocked = MBh.AnimateToState( "unblocked", 0 ) }, children = { { type = "generic_border", properties = { border_red = Colors.secondary_text_color.r, border_green = Colors.secondary_text_color.g, border_blue = Colors.secondary_text_color.b } }, { type = "UIImage", id = "selection_btn_check_box_node_id", states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = -3, bottom = 3, left = -3, right = 3, material = RegisterMaterial( "white" ), red = Colors.frontend_hilite.r, green = Colors.frontend_hilite.g, blue = Colors.frontend_hilite.b, alpha = 0 }, selected = { alpha = 1 }, deselected = { alpha = 0 } }, handlers = { selected = MBh.AnimateToState( "selected", 0 ), deselected = MBh.AnimateToState( "deselected", 0 ) } } } } } } end local f0_local27 = function () return { type = "UIButton", focusable = false, properties = { text = "button", height = f0_local2 + 20, width = f0_local3, button_action_func = f0_local9, material_bg = RegisterMaterial( "ks_selection_display_bg" ), material_ks = RegisterMaterial( "icon_weapon_ph_sp_diamond_64" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, left = 0, height = MBh.Property( "height" ), width = MBh.Property( "width" ) } }, handlers = {}, children = { { type = "UIImage", id = "button_ks_image_id", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = 18, bottom = 82, left = -32, right = 32, material = MBh.Property( "material_ks" ), alpha = 0.15 } }, handlers = {} }, { type = "UIText", id = "button_text_id", properties = { text = MBh.Property( "text" ) }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -CoD.TextSettings.NormalFont.Height, bottom = 0, left = 0, right = 0, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Center, red = Colors.frontend_hilite.r, green = Colors.frontend_hilite.g, blue = Colors.frontend_hilite.b, alpha = 1 } }, handlers = {} } } } end LUI.MenuBuilder.registerDef( "killstreak_selections", f0_local24 ) LUI.MenuBuilder.registerDef( "killstreak_selection_button", f0_local25 ) LUI.MenuBuilder.registerDef( "killstreak_selection_button_bg", f0_local26 ) LUI.MenuBuilder.registerDef( "killstreak_display_selection_button", f0_local27 ) LUI.MenuBuilder.registerDef( "cac_cant_purchase_killstreak_popup", cac_cant_purchase_killstreak_popup ) LUI.MenuBuilder.registerDef( "cac_purchase_killstreak_popup", cac_purchase_killstreak_popup ) LockTable( _M )