local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) function CacEditRestoreFocusability( f1_arg0, f1_arg1 ) f1_arg0:enableTreeFocus() end function SetMenuTitleToSquadMemberName( f2_arg0 ) local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) f2_arg0:dispatchEventToRoot( { name = "update_header_text", string = Cac.GetSquadMemberName( f2_local0.exclusiveControllerIndex, f2_local0.squadLocation, f2_local0.squadMemberIndex ), immediate = true } ) end function SetMenuTitleToLoadoutName( f3_arg0 ) local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) f3_arg0:dispatchEventToRoot( { name = "update_header_text", string = Cac.GetLoadoutName( f3_local0.exclusiveControllerIndex, f3_local0.squadLocation, f3_local0.squadMemberIndex, f3_local0.classLocation, f3_local0.slot ) } ) end function SwitchToMemberSelect( f4_arg0, f4_arg1 ) LUI.FlowManager.RequestAddMenu( f4_arg0, "cac_member_select_main", true, f4_arg1.controller, true, { next_screen = "cac_edit_main", squadLocation = f4_arg0.properties.squadLocation, classLocation = f4_arg0.properties.classLocation, force_to_next_screen = true } ) LUI.FlowManager.RequestLeaveMenuByName( "cac_edit_main" ) end function CacEditCreateHandler( f5_arg0, f5_arg1 ) local f5_local0 = f5_arg0.properties local f5_local1 = f5_local0.exclusiveController if not f5_local1 then DebugPrint( "[WARNING] CAC: using controller index 0, this is only ok if you are editing a menu" ) f5_local1 = 0 end local f5_local2 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 ) f5_local2.controller = f5_local1 f5_local2.squadLocation = f5_local0.squadLocation f5_local2.squadMemberIndex = f5_local0.squadMemberIndex f5_local2.classLocation = Cac.GetCustomClassLoc( f5_local0.classLocation ) f5_local2.slot = f5_local0.slot SetMenuTitleToSquadMemberName( f5_arg0 ) if f5_arg1.stackRestore then f5_arg0:enableTreeFocus() f5_arg0:animateToState( "visible", 0 ) else f5_arg0:disableTreeFocus() if Engine.GetDvarBool( "cac_open_char_list" ) or f5_local0.open_char_list then f5_arg0:dispatchEventToRoot( { name = "open_char_select", controller = f5_local1, slot = f5_local0.slot, immediate = true } ) Engine.SetDvarBool( "cac_open_char_list", false ) f5_arg0:animateToState( "visible", 0 ) else local f5_local3 = Engine.GetDvarInt( "lui_remember_classIndex" ) f5_arg0:animateToState( "visible", 0 ) f5_arg0:processEvent( { name = "cac_set_slot", slot = f5_local3, controller = f5_local1, dispatchChildren = true, immediate = true } ) f5_arg0:processEvent( { name = "update_cac_info_panel", controller = f5_local1, dispatchChildren = true, immediate = true } ) self:dispatchEventToRoot( { name = "refresh_specialist_abilities_recap", controller = f5_local1, specialistType = Cac.GetPerk( f5_local1, f5_local2.squadLocation, f5_local2.squadMemberIndex, f5_local2.classLocation, f5_local2.slot, Cac.Indices.StreakType ) == "streaktype_specialist", selected = false } ) end end end function CacSetCurrentSlot( f6_arg0, f6_arg1 ) assert( f6_arg0.properties.slot, "there is no slot property, something went wrong" ) local f6_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f6_arg0 ) f6_local0.slot = f6_arg1.slot f6_local0.classLocation = f6_arg1.classLocation f6_arg0.properties.slot = f6_arg1.slot f6_arg0.properties.classLocation = f6_arg1.classLocation f6_arg0:processEvent( { name = "update_squad_member_window_weapon", weapon = Cac.BuildPrimaryWeaponName( f6_arg1.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot ) } ) f6_arg0:processEvent( { name = "update_squad_member_window_stowed_weapon", weapon = Cac.BuildSecondaryWeaponName( f6_arg1.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot ) } ) end function CacOpenCharSelectHandler( f7_arg0, f7_arg1 ) Engine.Exec( "uploadstats", f7_arg1.controller ) SetMenuTitleToSquadMemberName( f7_arg0 ) LUI.FlowManager.RequestPopupMenu( f7_arg0, "cac_main", true, f7_arg1.controller, false, { currSlot = f7_arg0.properties.slot, alternateCacMenus = f7_arg0.properties.alternateCacMenus, squadLocation = f7_arg0.properties.squadLocation, squadMemberIndex = f7_arg0.properties.squadMemberIndex, classLocation = f7_arg0.properties.classLocation, allowMemberSwap = f7_arg0.properties.allowMemberSwap }, true ) f7_arg0:dispatchEventToRoot( { name = "cac_update_currency_text" } ) end function cac_edit_back_button() return { type = "generic_back_button", properties = { slot = 0, classLocation = MBh.Property( "classLocation" ), squadLocation = MBh.Property( "squadLocation" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ), allowMemberSwap = MBh.Property( "allowMemberSwap" ) }, handlers = { button_secondary = function ( f9_arg0, f9_arg1 ) CacOpenCharSelectHandler( f9_arg0, f9_arg1 ) f9_arg0:dispatchEventToRoot( { name = "cac_recap_slide_right", immediate = true } ) f9_arg0:dispatchEventToRoot( { name = "close_info_column", immediate = true } ) end , cac_set_slot = CacSetCurrentSlot } } end f0_local0 = function ( f10_arg0, f10_arg1 ) f10_arg0:setText( f10_arg1.string ) end function cac_edit_currency() return { type = "UIElement", id = "cac_edit_currency", properties = { tokenWidth = 16, tokenHeight = 16, rankIconWidth = 24, rankIconHeight = 24 }, states = { default = { leftAnchor = false, rightAnchor = true, topAnchor = true, bottomAnchor = false, top = 58, right = -100, width = 500, height = CoD.TextSettings.NormalFont.Height } }, handlers = { menu_create = MBh.EmitEvent( "cac_update_currency_text" ), cac_update_currency_text = function ( f12_arg0, f12_arg1 ) local f12_local0 = 3 local f12_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) local f12_local2 = f12_arg0.properties.exclusiveController local f12_local3 = Cac.GetCurrency( f12_local2 ) local f12_local4, f12_local5, f12_local6, f12_local7 = GetTextDimensions( tostring( f12_local3 ), CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) local f12_local8 = f12_arg0:getChildById( "count" ) local f12_local9 = f12_local6 - f12_local4 f12_local8:setText( tostring( f12_local3 ) ) f12_local8:registerAnimationState( "updated", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, height = CoD.TextSettings.NormalFont.Height, right = 0, width = f12_local9 } ) f12_local8:animateToState( "updated", 0 ) local f12_local10 = f12_arg0:getChildById( "token" ) f12_local10:registerAnimationState( "updated", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, width = f12_arg0.properties.tokenWidth, height = f12_arg0.properties.tokenHeight, right = -(f12_local9 + f12_local0) } ) f12_local10:animateToState( "updated", 0 ) local f12_local11 = f12_arg0:getChildById( "title" ) f12_local11:registerAnimationState( "updated", { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, height = CoD.TextSettings.NormalFont.Height, right = -(f12_arg0.properties.tokenWidth + f12_local9 + f12_local0 * 2) } ) f12_local11:animateToState( "updated", 0 ) local f12_local12 = f12_arg0:getChildById( "rank" ) local f12_local13 = f12_arg0:getChildById( "rank_icon" ) local f12_local14 = f12_arg0:getChildById( "rank_title" ) local f12_local15 = Engine.GetLuiRoot() if not f12_local15:IsMenuOpenAndVisible( "cac_member_select_main" ) then f12_local15 = Engine.GetLuiRoot() if f12_local15:IsMenuOpenAndVisible( "prestige_details_main" ) then f12_local12:animateToState( "hidden" ) f12_local13:animateToState( "hidden" ) f12_local14:animateToState( "hidden" ) end f12_local15 = 250 local f12_local16 = Engine.GetPlayerDataEx local f12_local17 = f12_local2 local f12_local18 = CoD.StatsGroup.Ranked local f12_local19 = f12_local1.squadLocation if not f12_local19 then f12_local19 = Cac.GetSquadLoc() end local f12_local20 = f12_local1.squadMemberIndex if not f12_local20 then f12_local20 = Cac.GetActiveSquadMember( f12_local2 ) end f12_local17 = Rank.GetRankDisplay( Lobby.GetRankForXP( f12_local16( f12_local17, f12_local18, f12_local19, f12_local20, "squadMemXP" ) ) ) f12_local18 = Cac.GetPrestigeLevel f12_local19 = f12_local2 f12_local20 = f12_local1.squadLocation if not f12_local20 then f12_local20 = Cac.GetSquadLoc() end f12_local19 = RegisterMaterial( Rank.GetRankIcon( f12_local17 - 1, f12_local18( f12_local19, f12_local20 ) ) ) local f12_local20, f12_local21, f12_local22, f12_local23 = GetTextDimensions( tostring( f12_local17 ), CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) local f12_local24 = f12_local22 - f12_local20 f12_local12:setText( tostring( f12_local17 ) ) f12_local12:registerAnimationState( "updated", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, height = CoD.TextSettings.NormalFont.Height, right = 0 - f12_local15, width = rankIconWidth } ) f12_local12:animateToState( "updated", 0 ) local f12_local25 = -(f12_local24 + f12_local0) CoD.SetMaterial( f12_local13, f12_local19 ) f12_local13:registerAnimationState( "updated", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, width = f12_arg0.properties.rankIconWidth, height = f12_arg0.properties.rankIconHeight, right = f12_local25 - f12_local15 } ) f12_local13:animateToState( "updated", 0 ) f12_local14:registerAnimationState( "updated", { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, height = CoD.TextSettings.NormalFont.Height, right = -(f12_arg0.properties.rankIconWidth + f12_local24 + f12_local0 * 2) - f12_local15 } ) f12_local14:animateToState( "updated", 0 ) end f12_local12:animateToState( "hidden" ) f12_local13:animateToState( "hidden" ) f12_local14:animateToState( "hidden" ) end }, children = { { type = "UIText", id = "title", properties = { text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ) }, states = { default = CoD.ColorizeState( Colors.primary_text_color, { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, right = 0, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Right } ) } }, { type = "UIImage", id = "token", states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, material = RegisterMaterial( "icon_unlock_token_active" ), right = 0, width = MBh.Property( "tokenWidth" ), height = MBh.Property( "tokenHeight" ) } } }, { type = "UIText", id = "count", states = { default = CoD.ColorizeState( Colors.primary_text_color, { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, right = 0, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Right } ) }, handlers = { update_squad_points_count = function ( f13_arg0, f13_arg1 ) if f13_arg1.controller then f13_arg0:setText( tostring( Engine.GetPlayerDataEx( f13_arg1.controller, CoD.StatsGroup.Ranked, "unlockPoints" ) ) ) end end } }, { type = "UIText", id = "rank_title", properties = { text = Engine.Localize( "@MENU_RANK" ) }, states = { default = CoD.ColorizeState( Colors.primary_text_color, { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, right = 0, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Right, alpha = 1 } ), hidden = { alpha = 0 } } }, { type = "UIImage", id = "rank_icon", states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, material = RegisterMaterial( "white" ), right = 0, width = MBh.Property( "rankIconWidth" ), height = MBh.Property( "rankIconHeight" ), alpha = 1 }, hidden = { alpha = 0 } } }, { type = "UIText", id = "rank", states = { default = CoD.ColorizeState( Colors.primary_text_color, { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, right = 0, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Right, alpha = 1 } ), hidden = { alpha = 0 } } } } } end function cac_edit_main() return { type = "UIElement", id = "cac_edit_root", properties = { slot = 0, classLocation = "loadouts", alternateCacMenus = false, squadLocation = "privateMatchSquadMembers", squadMemberIndex = 0, allowMemberSwap = false }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, alpha = 0 }, visible = { alpha = 1 } }, children = { { type = "UIImage", id = "CAC_root_background_id", states = { default = { material = RegisterMaterial( "bkgd_cas" ), topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } } }, { type = "generic_menu_title", id = "edit_squad_header", properties = { menu_title = "Member" } }, { type = "button_helper_text_main", id = "cac_button_helper_text_id" }, { type = "cac_recap", properties = { exclusiveController = MBh.Property( "exclusiveController" ), squad_location = MBh.Property( "squadLocation" ), member_index = MBh.Property( "squadMemberIndex" ), class_location = MBh.Property( "classLocation" ), loadout_slot = MBh.Property( "slot" ) } }, { type = "UIElement", id = "class_restrictions_warning", states = { default = { leftAnchor = false, rightAnchor = true, topAnchor = false, bottomAnchor = true, top = -66, right = -100, width = 500, height = 28, alpha = 0 }, visible = { alpha = 1 } }, handlers = { show_class_restrictions_warning = MBh.AnimateToState( "visible" ), hide_class_restrictions_warning = MBh.AnimateToState( "default" ) }, children = { { type = "UIImage", id = "class_restrictions_warning_icon", states = { default = { leftAnchor = false, rightAnchor = true, topAnchor = true, bottomAnchor = false, right = 0, top = 2, width = 28, height = 28, material = RegisterMaterial( "icon_new_3" ), alpha = 1 } } }, { type = "UIText", id = "class_restrictions_warning_text", properties = { text = Engine.Localize( "PATCH_MENU_ITEM_RESTRICTED" ) }, states = { default = CoD.ColorizeState( Colors.orange, { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = false, font = CoD.TextSettings.NormalFont.Font, left = 0, right = -35, top = 5, bottom = 5 + CoD.TextSettings.NormalFont.Height, alignment = LUI.Alignment.Right } ) } } } }, { type = "UIVerticalList", id = "cac_edit_main_container_id", properties = { spacing = 5, slot = MBh.Property( "slot" ), classLocation = MBh.Property( "classLocation" ), squadLocation = MBh.Property( "squadLocation" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ), additional_handlers = { close_info_column = MBh.AnimateToState( "default", 100 ), collapse_info_column = MBh.AnimateToState( "collapsed", 100 ), expand_info_column = MBh.AnimateToState( "expanded", 100 ) } }, states = { default = { alignment = LUI.Alignment.Top, leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = Cac.Layout.CacEditPanel.left + 320, right = Cac.Layout.CacEditPanel.right + 320, top = Cac.Layout.CacEditPanel.top, bottom = 0, alpha = 0 }, expanded = MBh.BaseState( "default", { alpha = 1 } ), collapsed = { leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = Cac.Layout.CacEditPanel.left, right = Cac.Layout.CacEditPanel.right, top = Cac.Layout.CacEditPanel.top, bottom = 0, alpha = 1 } }, children = { { type = "selection_info_panel_main", id = "selection_info_panel_main_id" }, { type = "cac_basic_info_pane_container", id = "cac_basic_info_pane_container_id" } } }, { type = "UISquadMemberWindow", id = "character_not_so_temp", properties = { use_background = true, charHandle = "customize_char_handle", default_anim = Cac.Customization.Animations.default, char_window_dims = { top = 0, bottom = 610, left = -175, right = 435 }, uv_values = { 0, 0, 1, 1 }, character_pos = CharacterCameraPresets.LoadoutMenu.Position, controller = MBh.Property( "exclusiveController" ), squad_member_index = MBh.Property( "squadMemberIndex" ), squad_location = MBh.Property( "squadLocation" ), loadout_slot = MBh.Property( "slot" ), mask_pos_data = { top = 17, bottom = 0, left = 0, right = 0 } }, states = { default = { topAnchor = true, leftAnchor = false, bottomAnchor = false, rightAnchor = true, top = 70, left = 0 + Cac.Layout.CacEditPanel.shift_delta, bottom = 670, right = 746 + Cac.Layout.CacEditPanel.shift_delta, alpha = 1 }, hidden = { alpha = 0 } }, handlers = { show_character_image = MBh.AnimateToState( "default", 100 ), hide_character_image = MBh.AnimateToState( "hidden", 100 ), update_squad_member_window_weapon = function ( f15_arg0, f15_arg1 ) assert( f15_arg1.weapon ) f15_arg0:processEvent( { name = "weapon_change_start", new_weapon = f15_arg1.weapon, prev_weapon = f15_arg0.current_weapon } ) end , update_squad_member_window_stowed_weapon = function ( f16_arg0, f16_arg1 ) assert( f16_arg1.weapon ) f16_arg0:processEvent( { name = "weapon_changed_stowed", weapon = f16_arg1.weapon } ) end } }, Cac.GetEditCurrency( "currency_header" ), { type = "cac_edit_back_button", id = "cac_edit_back_button", properties = { classLocation = MBh.Property( "classLocation" ) } } }, handlers = { menu_create = CacEditCreateHandler, open_char_select = CacOpenCharSelectHandler, cac_exit = function ( f17_arg0, f17_arg1 ) LUI.FlowManager.RequestLeaveMenu( f17_arg0, true ) end , cac_set_slot = CacSetCurrentSlot, popup_active = CacEditRestoreFocusability, switch_to_member_select = SwitchToMemberSelect } } end LUI.MenuBuilder.registerDef( "cac_edit_main", cac_edit_main ) LUI.MenuBuilder.registerDef( "cac_edit_back_button", cac_edit_back_button ) LUI.MenuBuilder.registerDef( "cac_edit_currency", cac_edit_currency ) LockTable( _M )