local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) function HandlePrestigeDateCreate( f1_arg0, f1_arg1 ) local f1_local0 = f1_arg0.properties local f1_local1 = f1_local0.squad_location f1_arg0:setText( Engine.Localize( "@LUA_MENU_PRESTIGED_ON", Engine.GetFormattedDate( Engine.GetPlayerDataEx( f1_local0.exclusiveController, CoD.GetStatsGroupForGameMode(), "characterXP", f1_local0.squadMemberIndex ) ) ) ) end function HandlePrestigeTimeTakenCreate( f2_arg0, f2_arg1 ) local f2_local0 = f2_arg0.properties local f2_local1 = Engine.GetPlayerDataEx( f2_local0.exclusiveController, CoD.GetStatsGroupForGameMode(), f2_local0.squad_location, f2_local0.squadMemberIndex, "experienceToPrestige" ) local f2_local2 = string.format( "%02d", f2_local1 % 60 ) f2_local1 = f2_local1 / 60 local f2_local3 = string.format( "%02d", f2_local1 % 60 ) f2_local1 = f2_local1 / 60 f2_arg0:setText( Engine.Localize( "@LUA_MENU_TOTAL_TIME_TAKEN", Engine.Localize( "@LUA_MENU_DAYS_HOURS_MINUTES_SECONDS", string.format( "%d", f2_local1 / 24 ), string.format( "%02d", f2_local1 % 24 ), f2_local3, f2_local2 ) ) ) end function HandleSquadMemberWindowCreate( f3_arg0, f3_arg1 ) local f3_local0 = f3_arg0.properties local f3_local1 = f3_local0.squad_location local f3_local2 = f3_local0.squadMemberIndex local f3_local3 = f3_local0.exclusiveController local f3_local4 = Cac.GetSquadMemberName( f3_local3, f3_local1, f3_local2 ) local f3_local5 = Engine.TableLookup( "mp/cac/backgrounds.csv", 0, Cac.GetBackgroundIndex( f3_local3, f3_local1, f3_local2 ), 1 ) local f3_local6 = Cac.GetPatchIndex( f3_local3, f3_local1, f3_local2 ) local f3_local7 = Cac.GetPatchbackingIndex( f3_local3, f3_local1, f3_local2 ) local f3_local8 = Lobby.GetRankForXP( tonumber( Engine.GetPlayerDataEx( f3_local3, CoD.GetStatsGroupForGameMode(), f3_local1, f3_local2, "squadMemXP" ) ) ) local f3_local9 = Cac.GetPrestigeLevel( f3_local3, f3_local1 ) local f3_local10 = Engine.GetUsernameByController and Engine.GetUsernameByController( f3_local3 ) or f3_local4 local f3_local11 = Engine.GetProfileDataUseEliteClanTag( f3_local3 ) and Clan.GetTag( f3_local3 ) or Engine.GetCustomClanTag( f3_local3 ) f3_arg0:updateSquadMember( f3_local3, f3_local2 ) f3_arg0:processEvent( { name = "update_playercard", gamertag = f3_local10, clantag = f3_local11, background = Cac.GetBackgroundIndex( f3_local3, f3_local1, f3_local2 ), rank = f3_local8, prestige = f3_local9, patchShape = f3_local7, patchEmblem = f3_local6 } ) end function HandlePrestigeDetailsCreate( f4_arg0, f4_arg1 ) local f4_local0 = f4_arg0.properties local f4_local1 = f4_local0.squad_location local f4_local2 = f4_local0.squadMemberIndex local f4_local3 = f4_local0.exclusiveController f4_arg0:processEvent( { name = "update_header_text", string = Cac.GetSquadMemberName( f4_local3, f4_local1, f4_local2 ) } ) f4_arg0:processEvent( { name = "update_title", title_text = Engine.Localize( "@LUA_MENU_PRESTIGE_UNLOCKS_TITLE", Cac.GetSquadMemberPrestigeLevel( f4_local3, f4_local1, f4_local2 ) ) } ) f4_arg0:processEvent( { name = "add_button_helper_text", button_ref = "button_secondary", helper_text = Engine.Localize( "@LUA_MENU_BACK" ), side = "left", clickable = true } ) end function getUnlockItemsForPrestigeLevel( f5_arg0 ) local f5_local0 = {} local f5_local1 = 0 while true do local f5_local2 = Engine.TableLookupByRow( UnlockTable.File, f5_local1, UnlockTable.Cols.ItemId ) if f5_local2 == "" then return f5_local0 elseif f5_arg0 == tonumber( Engine.TableLookupByRow( UnlockTable.File, f5_local1, UnlockTable.Cols.Prestige ) ) then f5_local0[#f5_local0 + 1] = { row = f5_local1, id = f5_local2, type = Engine.TableLookupByRow( UnlockTable.File, f5_local1, UnlockTable.Cols.Type ) } end f5_local1 = f5_local1 + 1 end end function UnlockedItemsFeeder( f6_arg0 ) local f6_local0 = Cac.GetSquadMemberPrestigeLevel( f6_arg0.exclusiveController, f6_arg0.squad_location, f6_arg0.squadMemberIndex ) local f6_local1 = getUnlockItemsForPrestigeLevel( f6_local0 ) local f6_local2 = {} for f6_local8, f6_local9 in pairs( f6_local1 ) do local f6_local6 = "" local f6_local7 = RegisterMaterial( "white" ) local f6_local10 = "" if f6_local9.type == "Background" then f6_local6 = Engine.Localize( "@LUA_MENU_BACKGROUND" ) f6_local7 = Engine.TableLookup( BackgroundsTable.File, BackgroundsTable.Cols.Ref, f6_local9.id, BackgroundsTable.Cols.Image ) elseif f6_local9.type == "Prestige" then f6_local6 = Engine.Localize( "@LUA_MENU_ICON" ) f6_local7 = Rank.GetRankIcon( 1, f6_local0 ) end f6_local2[#f6_local2 + 1] = { type = "aar_unlocked_item", id = "item_" .. f6_local8, properties = { item_name = f6_local6, item_icon = RegisterMaterial( f6_local7 ), icon_width = 96, icon_height = 96, item_detail_1 = f6_local10 }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, bottom = 150, left = 0, right = 150 } } } end return f6_local2 end function prestige_details_main() return { type = "UIElement", id = "prestige_details_root", properties = { squad_location = Cac.GetSquadLoc(), squadMemberIndex = 0 }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } }, handlers = { menu_create = HandlePrestigeDetailsCreate }, children = { { type = "UIImage", id = "prestige_details_bg_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 = "prestige_details_title_id", properties = { menu_title = "" } }, { type = "generic_menu_titlebar", id = "prestige_details_titlebar_id", properties = { font = CoD.TextSettings.BoldFont, title_bar_text = "", title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, title_bar_alignment = LUI.Alignment.Left }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 120, bottom = 145, left = 100, right = 590 } } }, { type = "generic_menu_background_withfade", id = "prestige_details_background_id", properties = { fill_alpha = 0.5 }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 112, bottom = 512, left = 100, right = 590 } } }, { type = "UIText", id = "prestige_details_date_id", properties = { text = "", squad_location = MBh.Property( "squad_location" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 200, bottom = 200 + CoD.TextSettings.NormalFont.Height, left = 100, right = 590, alignment = LUI.Alignment.Center, font = CoD.TextSettings.NormalFont.Font } }, handlers = { menu_create = HandlePrestigeDateCreate } }, { type = "UIText", id = "prestige_details_time_taken_id", properties = { text = "", squad_location = MBh.Property( "squad_location" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 230, bottom = 230 + CoD.TextSettings.NormalFont.Height, left = 100, right = 590, alignment = LUI.Alignment.Center, font = CoD.TextSettings.NormalFont.Font } }, handlers = { menu_create = HandlePrestigeTimeTakenCreate } }, { type = "UIHorizontalList", id = "prestige_details_unlock_list_id", properties = { squad_location = MBh.Property( "squad_location" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 280, bottom = 480, left = 100, right = 590, alignment = LUI.Alignment.Center, spacing = 10 } }, childrenFeeder = UnlockedItemsFeeder }, Cac.GetEditCurrency( "prestige_details_currency_display_id" ), { type = "UISquadMemberWindow", id = "prestige_details_member_window_id", properties = { use_3d_model = true, use_2d_character_image = false, use_member_name = false, use_prestige_icon = false, use_playercard = true, use_background = true, use_border = false, card_props = {}, card_dims = { top = -130, bottom = -165, left = -725, right = -725 }, card_scale = -0.15, 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.MemberSelect.Position, controller = MBh.Property( "exclusiveController" ), squad_location = MBh.Property( "squad_location" ), squadMemberIndex = MBh.Property( "squadMemberIndex" ), 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 } }, handlers = { menu_create = HandleSquadMemberWindowCreate } }, { type = "button_helper_text_main", id = "prestige_details_helper_text_id" }, { type = "online_friends_widget", id = "prestige_details_friends_widget_id" }, { type = "generic_back_button" } } } end LUI.MenuBuilder.registerDef( "prestige_details_main", prestige_details_main ) LockTable( _M )