local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) function MatchSummaryCreate( f1_arg0, f1_arg1 ) local f1_local0 = LUI.mp_menus.Aliens local f1_local1 = f1_arg0.properties.controller local f1_local2 = f1_arg0:getChildById( "aar_summary_playercard" ) if f1_local2 then local f1_local3 = {} if Engine.IsAliensMode() then local f1_local4 = Cac.GetSquadLoc() local f1_local5 = 0 f1_local3.gamertag = Engine.GetUsernameByController( f1_local1 ) f1_local3.clantag = Engine.GetCustomClanTag( f1_local1 ) or "" f1_local3.rank = Lobby.GetAlienRankForXP( f1_local0.getAliensExperience( f1_local1 ) ) f1_local3.prestige = f1_local0.getAliensPrestigeLevel( f1_local1 ) f1_local3.background = Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Coop, f1_local4, f1_local5, "background" ) f1_local3.patchEmblem = Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Coop, f1_local4, f1_local5, "patch" ) f1_local3.patchShape = Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Coop, f1_local4, f1_local5, "patchbacking" ) else local f1_local4 = Cac.GetSquadLoc() local f1_local5 = AAR.GetRoundSquadMember( f1_local1 ) local f1_local6 = "" local f1_local7 = Cac.GetSquadMemberName( f1_local1, f1_local4, f1_local5 ) if Engine.GetUsernameByController then f1_local6 = Engine.Localize( "@LUA_MENU_TAG_AND_MEMBER", Engine.MarkLocalized( Engine.GetUsernameByController( f1_local1 ) ), Engine.MarkLocalized( f1_local7 ) ) end local f1_local8 = Lobby.GetRankForXP( AAR.GetCareerExperienceForSquadMember( f1_local1, f1_local5 ) ) f1_local3.gamertag = f1_local6 f1_local3.clantag = Engine.GetCustomClanTag( f1_local1 ) or "" f1_local3.rank = f1_local8 f1_local3.prestige = Cac.GetPrestigeLevel( f1_local1, f1_local4 ) f1_local3.background = Cac.GetBackgroundIndex( f1_local1, f1_local4, f1_local5 ) f1_local3.patchEmblem = Cac.GetPatchIndex( f1_local1, f1_local4, f1_local5 ) f1_local3.patchShape = Cac.GetPatchbackingIndex( f1_local1, f1_local4, f1_local5 ) end f1_local3.name = "update_playercard" f1_local2:processEvent( f1_local3 ) end local f1_local3 = Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "gameMode" ) if Engine.IsAliensMode() then f1_arg0:processEvent( { name = "aar_set_subtitle_text", new_text = Engine.Localize( AAR.AreChaosStats( f1_local3 ) and "@ALIENS_CHAOS_MODE_CAPS" or "@LUA_MENU_ALIENS" ) } ) else local f1_local4 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f1_local3, GameTypesTable.Cols.Name ) local f1_local5 = Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "map" ) local f1_local6 = Squad.GetRealBaseNameFromLoadName( f1_local5 ) if f1_local5 ~= "" then f1_arg0:processEvent( { name = "aar_set_subtitle_text", new_text = Engine.Localize( "LUA_MENU_MODE_AND_MAP_FORMAT", f1_local4, Engine.MarkLocalized( f1_local6 ) ), dispatchChildren = true } ) end end end function aar_match_summary_main() return { type = "UIElement", id = "aar_match_summary_main_container", states = { default = { leftAnchor = false, rightAnchor = false, topAnchor = false, bottomAnchor = false, width = AAR.Layout.Width, height = AAR.Layout.Height } }, properties = { page_idx = 1, num_pages = 3, controller = Engine.GetFirstActiveController() }, handlers = { menu_create = MatchSummaryCreate, element_refresh = MatchSummaryCreate }, children = { { type = "generic_drop_shadow", id = "description_drop_shadow1", properties = { offset_shadow = 0 }, states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = 0, right = 0, top = 0, bottom = 0, alpha = 0.35 } } }, { type = "generic_menu_background", id = "aar_match_summary_main_bkg", properties = { fill_alpha = 1 } }, { type = "aar_title_bar", id = "aar_title_bar_id", properties = { title_bar_text = Engine.Localize( "@LUA_MENU_GAME_SUMMARY" ), subtitle_text = "", subtitle_banner_width = 300 } }, { type = "aar_dots", id = "AARSummaryDotsID", properties = { num_dots = MBh.Property( "num_pages" ), curr_dot = MBh.Property( "page_idx" ) } }, { type = "aar_xp_info_widget", properties = { controller = MBh.Property( "controller" ), animate_progress = false } }, { type = "aar_stats_list", id = "aar_stats_list_id" }, { type = "playercard", id = "aar_summary_playercard", properties = {}, states = { default = { leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = false, left = 157, right = 0, top = 90, bottom = 0 } } }, { type = "aar_footer_bar", id = "oink_4" }, { type = "aar_token_balance" } } } end function AARStatsListFeederAliens( f3_arg0 ) local f3_local0 = {} local f3_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" ) local f3_local2 = f3_local1.controller local f3_local3 = LUI.mp_menus.Aliens.GetSessionXP( f3_local2 ) local f3_local4 = LUI.mp_menus.Aliens.GetSessionTokens( f3_local2 ) if LUI.mp_menus.AliensPurchasables.UsingExtinctionTokens() and f3_local4 and f3_local4 > 0 then f3_local0[#f3_local0 + 1] = { type = "aar_stats_spacer", id = "aar_stats_widget_spacer_0" } local f3_local5 if f3_local4 == 1 then f3_local5 = Engine.Localize( "@ALIENS_TOKEN" ) if not f3_local5 then else f3_local0[#f3_local0 + 1] = { type = "aar_stats_widget", id = "aar_stats_widget_0", properties = { label_text = Engine.Localize( "@ALIENS_TOKENS" ), stat_text = tostring( f3_local4 ) .. " " .. f3_local5 } } end end f3_local5 = Engine.Localize( "@ALIENS_TOKENS" ) end f3_local0[#f3_local0 + 1] = { type = "aar_stats_spacer", id = "aar_stats_widget_spacer_1" } f3_local0[#f3_local0 + 1] = { type = "aar_stats_widget", id = "aar_stats_widget_5", properties = { label_text = Engine.Localize( "@LUA_MENU_TOTAL_EARNED" ), stat_text = f3_local3 .. " " .. Engine.Localize( "@LUA_MENU_XP" ), stat_text_r = Colors.alien_frontend_hilite.r, stat_text_g = Colors.alien_frontend_hilite.g, stat_text_b = Colors.alien_frontend_hilite.b, label_text_r = AAR.Swatch.title.r, label_text_g = AAR.Swatch.title.g, label_text_b = AAR.Swatch.title.b } } return f3_local0 end function AARStatsListFeeder( f4_arg0 ) local f4_local0 = {} local f4_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" ) local f4_local2 = f4_local1.controller local f4_local3 = AAR.GetRoundDoubleXP( f4_local2 ) local f4_local4 = AAR.GetRoundClanXP( f4_local2 ) local f4_local5 = AAR.GetRoundMatchXP( f4_local2 ) local f4_local6 = AAR.GetRoundMiscXP( f4_local2 ) local f4_local7 = AAR.GetRoundScoreXP( f4_local2 ) local f4_local8 = AAR.GetRoundChallengeXP( f4_local2 ) local f4_local9 = AAR.GetRoundOperationsXP( f4_local2 ) local f4_local10 = AAR.GetRoundTotalXP( f4_local2 ) local f4_local11 = f4_local8 + f4_local7 + f4_local6 local f4_local12 = AAR.GetTotalUnlockPoints( f4_local2 ) f4_local0[#f4_local0 + 1] = { type = "aar_stats_widget", id = "aar_stats_widget_1", properties = { label_text = Engine.Localize( "@LUA_MENU_XP" ), stat_text = f4_local11 .. " " .. Engine.Localize( "@LUA_MENU_XP" ) } } f4_local0[#f4_local0 + 1] = { type = "aar_stats_spacer", id = "aar_stats_widget_spacer_1" } if f4_local3 > 0 then f4_local0[#f4_local0 + 1] = { type = "aar_stats_widget", id = "aar_stats_widget_2", properties = { label_text = Engine.Localize( "@LUA_MENU_DOUBLE_XP" ), stat_text = f4_local3 .. " " .. Engine.Localize( "@LUA_MENU_XP" ) } } f4_local0[#f4_local0 + 1] = { type = "aar_stats_spacer", id = "aar_stats_widget_spacer_2" } end if f4_arg0 and f4_arg0.squadMode == 0 then f4_local0[#f4_local0 + 1] = { type = "aar_stats_widget", id = "aar_stats_widget_3", properties = { label_text = Engine.Localize( "@LUA_MENU_OPERATIONS" ), stat_text = f4_local9 .. " " .. Engine.Localize( "@LUA_MENU_XP" ) } } f4_local0[#f4_local0 + 1] = { type = "aar_stats_spacer", id = "aar_stats_widget_spacer_3" } end f4_local0[#f4_local0 + 1] = { type = "aar_stats_widget", id = "aar_stats_widget_4", properties = { label_text = Engine.Localize( "@LUA_MENU_MATCH_BONUS" ), stat_text = f4_local5 .. " " .. Engine.Localize( "@LUA_MENU_XP" ) } } f4_local0[#f4_local0 + 1] = { type = "aar_stats_spacer", id = "aar_stats_widget_spacer_4" } if f4_local4 > 0 then f4_local0[#f4_local0 + 1] = { type = "aar_stats_widget", id = "aar_stats_widget_5", properties = { label_text = Engine.Localize( "@LUA_MENU_CLAN_WARS_BONUS" ), stat_text = f4_local4 .. " " .. Engine.Localize( "@LUA_MENU_XP" ) } } f4_local0[#f4_local0 + 1] = { type = "aar_stats_spacer", id = "aar_stats_widget_spacer_5" } end f4_local0[#f4_local0 + 1] = { type = "aar_stats_widget", id = "aar_stats_widget_6", properties = { label_text = Engine.Localize( "@LUA_MENU_TOTAL_EARNED" ), stat_text = f4_local10 .. " " .. Engine.Localize( "@LUA_MENU_XP" ), stat_text_r = AAR.Swatch.colorpop.r, stat_text_g = AAR.Swatch.colorpop.g, stat_text_b = AAR.Swatch.colorpop.b, label_text_r = AAR.Swatch.title.r, label_text_g = AAR.Swatch.title.g, label_text_b = AAR.Swatch.title.b } } return f4_local0 end function aar_stats_list() local f5_local0 = 408 return { type = "UIVerticalList", states = { default = { leftAnchor = false, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = -f5_local0 / 2, right = f5_local0 / 2, top = 270, bottom = 0 } }, properties = { squadMode = MBh.Property( "squadMode" ) }, childrenFeeder = Engine.IsAliensMode() and AARStatsListFeederAliens or AARStatsListFeeder } end function aar_stats_spacer() return { type = "UIImage", id = "spacer_id", states = { default = { material = RegisterMaterial( "white" ), leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = false, left = 0, right = 0, top = 0, bottom = 3, red = AAR.Swatch.background_2.r, green = AAR.Swatch.background_2.g, blue = AAR.Swatch.background_2.b, alpha = 0 } } } end function aar_stats_widget() return { type = "UIElement", properties = { height = 24, label_text = "Label Text", stat_text = "Stat Text", stat_text_r = AAR.Swatch.title_2.r, stat_text_g = AAR.Swatch.title_2.g, stat_text_b = AAR.Swatch.title_2.b, label_text_r = AAR.Swatch.title_2.r, label_text_g = AAR.Swatch.title_2.g, label_text_b = AAR.Swatch.title_2.b, stat_text_indent = 275 }, states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = false, left = 0, right = 0, top = 0, bottom = MBh.Property( "height" ) } }, children = { { type = "UIImage", id = "stats_widget_bgk2_id", states = { default = CoD.ColorizeState( Colors.white, { leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = 0, right = 200, top = 0, bottom = 0, material = RegisterMaterial( "white" ), alpha = 0.05 } ) } }, { type = "UIImage", id = "stats_widget_diagnol_bgk2_id", states = { default = CoD.ColorizeState( Colors.white, { leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = 200, right = 220, top = 0, bottom = 0, material = RegisterMaterial( "box_stat_cap" ), alpha = 0.05, zRot = 180 } ) } }, { type = "UIImage", id = "stats_widget_diagnol_bgk_id", states = { default = CoD.ColorizeState( Colors.black, { leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = 200, right = 220, top = 0, bottom = 0, material = RegisterMaterial( "box_stat_cap" ), alpha = 0.15 } ) } }, { type = "UIImage", id = "stats_widget_bgk_id", states = { default = CoD.ColorizeState( Colors.black, { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = 220, right = 0, top = 0, bottom = 0, material = RegisterMaterial( "white" ), alpha = 0.15 } ) } }, { type = "UIText", id = "stats_widget_label_text_id", properties = { text = MBh.Property( "label_text" ), textStyle = CoD.TextStyle.Shadowed, label_text_indent = 15, label_text_r = MBh.Property( "label_text_r" ), label_text_g = MBh.Property( "label_text_g" ), label_text_b = MBh.Property( "label_text_b" ) }, states = { default = { font = CoD.TextSettings.SmallFont.Font, alignment = LUI.Alignment.Left, leftAnchor = true, rightAnchor = true, topAnchor = false, bottomAnchor = false, left = MBh.Property( "label_text_indent" ), right = 0, height = CoD.TextSettings.SmallFont.Height, red = MBh.Property( "label_text_r" ), green = MBh.Property( "label_text_g" ), blue = MBh.Property( "label_text_b" ) } } }, { type = "UIText", id = "stats_widget_stat_text_id", properties = { text = MBh.Property( "stat_text" ), textStyle = CoD.TextStyle.Shadowed, stat_text_indent = MBh.Property( "stat_text_indent" ), stat_text_r = MBh.Property( "stat_text_r" ), stat_text_g = MBh.Property( "stat_text_g" ), stat_text_b = MBh.Property( "stat_text_b" ) }, states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = false, bottomAnchor = false, left = MBh.Property( "stat_text_indent" ), right = 0, height = CoD.TextSettings.SmallFont.Height, font = CoD.TextSettings.SmallFont.Font, alignment = LUI.Alignment.Left, red = MBh.Property( "stat_text_r" ), blue = MBh.Property( "stat_text_b" ), green = MBh.Property( "stat_text_g" ) } }, handlers = { update_stat_text = function ( f8_arg0, f8_arg1 ) f8_arg0:setText( f8_arg1.newStatText ) end } } } } end function xpWidgetOnCreate( f9_arg0, f9_arg1 ) local f9_local0 = f9_arg0.properties.controller local f9_local1 = f9_arg0.properties.animate_progress local f9_local2 = LUI.mp_menus.Aliens local f9_local3, f9_local4, f9_local5, f9_local6, f9_local7, f9_local8, f9_local9, f9_local10, f9_local11, f9_local12, f9_local13, f9_local14, f9_local15, f9_local16 = nil local f9_local17 = 0 local f9_local18 = false local f9_local19 = false if Engine.IsAliensMode() then f9_local3 = f9_local2.GetAliensMaxRank() f9_local4 = f9_local2.getAliensExperience( f9_local0 ) f9_local5 = f9_local2.GetSessionXP( f9_local0 ) f9_local6 = f9_local4 - f9_local5 if f9_local6 < 0 then f9_local6 = 0 end f9_local8 = Lobby.GetAlienRankForXP( f9_local4 ) f9_local7 = Lobby.GetAlienRankForXP( f9_local6 ) f9_local9 = tonumber( Engine.TableLookup( f9_local2.AlienRanks.File, f9_local2.AlienRanks.Cols.Idx, f9_local8, f9_local2.AlienRanks.Cols.MinXP ) ) f9_local10 = f9_local9 + tonumber( Engine.TableLookup( f9_local2.AlienRanks.File, f9_local2.AlienRanks.Cols.Idx, f9_local8, f9_local2.AlienRanks.Cols.XPToNext ) ) f9_local11 = f9_local7 < f9_local8 f9_local12 = f9_local8 if f9_local8 < f9_local3 then f9_local12 = f9_local12 + 1 end f9_local13 = tonumber( Engine.TableLookup( f9_local2.AlienRanks.File, f9_local2.AlienRanks.Cols.Idx, f9_local12, f9_local2.AlienRanks.Cols.MinXP ) ) - f9_local4 f9_local14 = f9_local2.getAliensPrestigeLevel( f9_local0 ) if f9_local12 == f9_local3 and f9_local14 < f9_local2.AlienRanks.MaxPrestige then f9_local12 = 0 f9_local19 = true end if f9_local3 <= f9_local8 then f9_local18 = true end f9_local17 = f9_local14 else f9_local3 = Rank.GetMaxRank() local f9_local20 = Cac.GetSquadLoc() local f9_local21 = AAR.GetRoundSquadMember( f9_local0 ) f9_local4 = AAR.GetCareerExperienceForSquadMember( f9_local0, f9_local21 ) f9_local5 = AAR.GetRoundTotalXP( f9_local0 ) f9_local6 = f9_local4 - f9_local5 if f9_local6 >= 0 then f9_local7 = Lobby.GetRankForXP( f9_local6 ) f9_local8 = Lobby.GetRankForXP( f9_local4 ) f9_local9 = tonumber( Rank.GetRankMinXP( tostring( f9_local8 ) ) ) f9_local10 = f9_local9 + Rank.GetRankXPToNext( tostring( f9_local8 ) ) f9_local11 = f9_local7 < f9_local8 f9_local12 = f9_local8 if f9_local8 < f9_local3 then f9_local12 = f9_local12 + 1 end f9_local13 = Rank.GetRankMaxXP( tostring( f9_local8 ) ) f9_local17 = Cac.GetPrestigeLevel( f9_local0, f9_local20 ) if Cac.HasSquadMemberPrestiged( f9_local0, f9_local20, f9_local21 ) then f9_local18 = true end else f9_local6 = 0 f9_local4 = 0 f9_local7 = 0 f9_local8 = 0 f9_local9 = 0 f9_local10 = 1 f9_local11 = false f9_local12 = 1 f9_local13 = 1 end end local f9_local20 = 0 local f9_local21 = 0 local f9_local22 = 0 local f9_local23 = Engine.IsAliensMode() and CoD.PlayMode.Aliens or CoD.PlayMode.Core if f9_local18 then f9_local21 = 1 f9_local22 = 1 f9_local20 = 0 elseif f9_local11 == false then local f9_local24 = assert local f9_local25 if f9_local9 <= f9_local6 then if f9_local6 > f9_local10 then f9_local25 = Engine.IsAliensMode() else f9_local25 = true end else f9_local25 = false end f9_local24( f9_local25 ) f9_local21 = (f9_local6 - f9_local9) / Rank.GetRankXPToNext( tostring( f9_local8 ), f9_local23 ) f9_local22 = (f9_local4 - f9_local9) / Rank.GetRankXPToNext( tostring( f9_local8 ), f9_local23 ) if Engine.IsAliensMode() then f9_local20 = f9_local13 else f9_local20 = Rank.GetRankMaxXP( tostring( f9_local8 ), f9_local23 ) - f9_local4 end else f9_local21 = 0 f9_local22 = (f9_local4 - f9_local9) / Rank.GetRankXPToNext( tostring( f9_local8 ), f9_local23 ) f9_local20 = f9_local9 + Rank.GetRankXPToNext( tostring( f9_local8 ), f9_local23 ) - f9_local4 end local f9_local24 = Lobby.GetMaxPrestigeLevel() local f9_local25 = false if not (Engine.IsAliensMode() or f9_local8 ~= f9_local12 or f9_local18 or f9_local17 >= f9_local24) or f9_local19 then f9_local25 = true end local f9_local26 = Rank.GetRankDisplay( tostring( f9_local8 ), f9_local23 ) local f9_local27 = Rank.GetRankDisplay( tostring( f9_local12 ), f9_local23 ) f9_arg0.properties.curr_rank = f9_local26 f9_arg0.properties.next_rank = f9_local27 f9_arg0.properties.curr_xp = tostring( f9_local6 ) f9_arg0.properties.next_xp = tostring( f9_local20 ) f9_arg0.properties.earned_xp = tostring( f9_local5 ) local f9_local28 = Engine.IsAliensMode() and CoD.PlayMode.Aliens or CoD.PlayMode.Core local f9_local29 = RegisterMaterial( Rank.GetRankIcon( f9_local8, f9_local17, f9_local28 ) ) local f9_local30 = RegisterMaterial local f9_local31 = Rank.GetRankIcon local f9_local32 = f9_local12 local f9_local33 if f9_local25 then f9_local33 = f9_local17 + 1 if not f9_local33 then else f9_arg0:dispatchEventToChildren( { name = "xp_widget_update_progression_info", newCurrentRankText = f9_local26, newCurrentRankIcon = f9_local29, newNextRankText = f9_local27, newNextRankIcon = f9_local30( f9_local31( f9_local32, f9_local33, f9_local28 ) ), immediate = true } ) f9_arg0:dispatchEventToRoot( { name = "xp_widget_update_curr_xp", newVal = f9_arg0.properties.curr_xp, immediate = true } ) f9_arg0:dispatchEventToRoot( { name = "xp_widget_update_next_xp", newVal = f9_arg0.properties.next_xp, immediate = true } ) f9_arg0:dispatchEventToRoot( { name = "xp_widget_update_earned_xp", newVal = f9_arg0.properties.earned_xp, immediate = true } ) if Engine.IsAliensMode() then f9_arg0:processEvent( { name = "set_aliens_rank_text", text = f9_arg0.properties.next_rank } ) end f9_arg0:dispatchEventToRoot( { name = "update_xp_fill_meter", prevPercent = f9_local21, currPercent = f9_local22, animate_progress = f9_local1, immediate = true } ) end end f9_local33 = f9_local17 end function UpdateXPFillMeter( f10_arg0, f10_arg1 ) assert( f10_arg1.prevPercent ) assert( f10_arg1.currPercent ) local f10_local0 = 205 if f10_arg1.prevPercent > 1 then f10_arg1.prevPercent = 1 end if f10_arg1.currPercent > 1 then f10_arg1.prevPercent = 1 end local f10_local1 = { material = RegisterMaterial( "btn_cas_fill_f" ), leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = 0, right = f10_arg1.prevPercent * f10_local0, top = 1, bottom = -1, red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or AAR.Swatch.colorpop.r + 0.1, green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or AAR.Swatch.colorpop.g + 0.1, blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or AAR.Swatch.colorpop.b + 0.1 } local f10_local2 = { material = RegisterMaterial( "btn_cas_fill_f" ), leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = 0, right = f10_arg1.currPercent * f10_local0, top = 1, bottom = -1, red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or AAR.Swatch.colorpop.r + 0.1, green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or AAR.Swatch.colorpop.g + 0.1, blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or AAR.Swatch.colorpop.b + 0.1 } local f10_local3 = f10_arg0:getChildById( "xp_meter_curr_fill" ) f10_local3:registerAnimationState( "prev_state", f10_local1 ) f10_local3:registerAnimationState( "curr_state", f10_local2 ) if f10_arg1.animate_progress then local f10_local4 = MBh.AnimateSequence( { { "prev_state", 0 }, { "prev_state", 675 }, { "curr_state", 1250 } } ) f10_local4( f10_local3 ) if f10_arg1.prevPercent < f10_arg1.currPercent then f10_local3:registerEventHandler( "play_anim_sound", function ( element, event ) Engine.PlaySound( CoD.SFX.XPTick ) end ) f10_local3:addElement( LUI.UITimer.new( 800, "play_anim_sound", nil, true, nil, false, false ) ) end else f10_local3:animateToState( "curr_state", 0 ) end local f10_local4 = { material = RegisterMaterial( "btn_cas_fill_f" ), leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = 0, right = f10_arg1.prevPercent * f10_local0, top = 1, bottom = -1, red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b } local f10_local5 = f10_arg0:getChildById( "xp_meter_prev_fill" ) f10_local5:registerAnimationState( "prev_state_alt", f10_local4 ) f10_local5:animateToState( "prev_state_alt", 0 ) end function aar_xp_info_widget() local f12_local0 = 80 local f12_local1 = 408 return { type = "UIElement", id = "mainWidgetContainerID", properties = { curr_rank = 1, next_rank = 2, curr_xp = 0, next_xp = 0, earned_xp = 0, controller = Engine.GetFirstActiveController(), animate_progress = false }, states = { default = { material = RegisterMaterial( "white" ), leftAnchor = false, rightAnchor = false, topAnchor = true, bottomAnchor = false, left = -f12_local1 / 2, right = f12_local1 / 2, top = 200, height = 67 } }, handlers = { menu_create = xpWidgetOnCreate, element_refresh = xpWidgetOnCreate }, children = { { type = "UIElement", id = "RightContainerID", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = false, rightAnchor = true, top = 0, bottom = 0, left = -f12_local0, right = 0 } }, children = { { type = "UIImage", states = { default = CoD.ColorizeState( Colors.white, { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, material = RegisterMaterial( "white" ), alpha = 0.05 } ) } }, { type = "UIImage", id = "lockImage", states = { default = { material = RegisterMaterial( "icon_unlock_token_64" ), topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, width = 64, height = 64, alpha = Engine.IsAliensMode() and 0 or 1 } }, children = { { type = "UIText", id = "UnlockPointsTextID", properties = { text = "2", curr_rank = MBh.Property( "curr_rank" ) }, states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, left = 0, right = 0, height = CoD.TextSettings.ExtraBigFont.Height, font = CoD.TextSettings.ExtraBigFont.Font, alignment = LUI.Alignment.Center, red = AAR.Swatch.background_2.r, green = AAR.Swatch.background_2.g, blue = AAR.Swatch.background_2.b } }, handlers = { menu_create = function ( f13_arg0, f13_arg1 ) f13_arg0:setText( "2" ) end } } } } } }, { type = "UIText", id = "AliensRank", properties = { text = "" }, states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, right = 0, left = -f12_local0, top = -CoD.TextSettings.BigFont.Height, bottom = CoD.TextSettings.BigFont.Height, font = CoD.TextSettings.BigFont.Font, alpha = Engine.IsAliensMode() and 1 or 0, alignment = LUI.Alignment.Center } }, handlers = { set_aliens_rank_text = function ( f14_arg0, f14_arg1 ) f14_arg0:setText( f14_arg1.text ) end } }, { type = "UIElement", id = "LeftContainerID", states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = 0, right = -f12_local0, top = 0, bottom = 0 } }, children = { { type = "UIImage", states = { default = CoD.ColorizeState( Colors.white, { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, material = RegisterMaterial( "white" ), alpha = 0.05 } ) } }, { type = "UIElement", states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = 15, right = 0, top = 2, bottom = 0 } }, children = { { type = "UIText", id = "aar_summary_current_rank_text_id", properties = { text = "", textStyle = CoD.TextStyle.Shadowed }, states = { default = CoD.ColorizeState( Colors.md_grey, { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 5, left = 0, width = 26, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Left } ) }, handlers = { xp_widget_update_progression_info = function ( f15_arg0, f15_arg1 ) f15_arg0:setText( f15_arg1.newCurrentRankText ) end } }, { type = "UIImage", id = "aar_summary_current_rank_icon_id", states = { default = CoD.ColorizeState( Colors.md_grey, { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 2, left = 24, width = 24, height = 24 } ) }, handlers = { xp_widget_update_progression_info = function ( f16_arg0, f16_arg1 ) f16_arg0:setImage( f16_arg1.newCurrentRankIcon ) end } }, { type = "UIText", id = "aar_summary_next_rank_text_id", properties = { text = "", textStyle = CoD.TextStyle.Shadowed }, states = { default = CoD.ColorizeState( Colors.md_grey, { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = true, top = 5, right = 0, width = 26, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Right } ) }, handlers = { xp_widget_update_progression_info = function ( f17_arg0, f17_arg1 ) f17_arg0:setText( f17_arg1.newNextRankText ) end } }, { type = "UIImage", id = "aar_summary_next_rank_icon_id", states = { default = CoD.ColorizeState( Colors.md_grey, { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = true, top = 2, right = -24, width = 24, height = 24 } ) }, handlers = { xp_widget_update_progression_info = function ( f18_arg0, f18_arg1 ) f18_arg0:setImage( f18_arg1.newNextRankIcon ) end } }, { type = "UIElement", states = { default = { leftAnchor = false, rightAnchor = false, topAnchor = true, bottomAnchor = false, top = 7, width = 205, height = 15, red = 0, green = 0, blue = 0 } }, handlers = { update_xp_fill_meter = UpdateXPFillMeter }, children = { { type = "UIImage", id = "xp_fill_meter_id", states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = 0, right = 0, top = 0, bottom = 0, material = RegisterMaterial( "white" ), red = 0, green = 0, blue = 0, alpha = 0.5 } } }, { type = "UIImage", id = "xp_meter_curr_fill", states = { default = CoD.ColorizeState( Colors.white, { leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = 0, right = 0, top = 0, bottom = 0, material = RegisterMaterial( "btn_cas_fill_f" ) } ) } }, { type = "UIImage", id = "xp_meter_prev_fill", states = { default = CoD.ColorizeState( Colors.primary_text_color, { leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = 0, right = 0, top = 0, bottom = 0, material = RegisterMaterial( "btn_cas_fill_f" ) } ) } } } }, { type = "UIText", id = "earned_xp_lable", properties = { text = Engine.Localize( "@LUA_MENU_XP_EARNED" ), textStyle = CoD.TextStyle.Shadowed }, states = { default = CoD.ColorizeState( Colors.secondary_text_color, { leftAnchor = true, rightAnchor = true, topAnchor = false, bottomAnchor = true, left = 0, right = 0, bottom = -17, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Left } ) } }, { type = "UIText", id = "earned_xp_value", properties = { text = MBh.Property( "earned_xp" ), textStyle = CoD.TextStyle.Shadowed }, states = { default = CoD.ColorizeState( Colors.white, { leftAnchor = true, rightAnchor = true, topAnchor = false, bottomAnchor = true, left = 0, right = 0, bottom = 0, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Left } ) }, handlers = { xp_widget_update_earned_xp = function ( f19_arg0, f19_arg1 ) f19_arg0:setText( f19_arg1.newVal .. " " .. Engine.Localize( "@LUA_MENU_XP" ) ) end } }, { type = "UIText", id = "next_xp_lable", properties = { text = Engine.Localize( "@LUA_MENU_XP_NEEDED" ), textStyle = CoD.TextStyle.Shadowed }, states = { default = CoD.ColorizeState( Colors.secondary_text_color, { leftAnchor = true, rightAnchor = true, topAnchor = false, bottomAnchor = true, left = 0, right = 0, bottom = -17, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Right } ) } }, { type = "UIText", id = "next_xp_value", properties = { text = MBh.Property( "next_xp" ), textStyle = CoD.TextStyle.Shadowed }, states = { default = CoD.ColorizeState( Colors.primary_text_color, { leftAnchor = true, rightAnchor = true, topAnchor = false, bottomAnchor = true, left = 0, right = 0, bottom = 0, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Right } ) }, handlers = { xp_widget_update_next_xp = function ( f20_arg0, f20_arg1 ) f20_arg0:setText( f20_arg1.newVal .. " " .. Engine.Localize( "@LUA_MENU_XP" ) ) end } } } } } } } } end function UpdateTokenBalance( f21_arg0, f21_arg1 ) local f21_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" ) local f21_local1 = f21_local0.controller and AAR.GetTotalUnlockPoints( f21_local0.controller ) or 0 local f21_local2 = 3 local f21_local3, f21_local4, f21_local5, f21_local6 = GetTextDimensions( tostring( f21_local1 ), CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) local f21_local7 = f21_local5 - f21_local3 local f21_local8 = f21_arg0:getChildById( "unlockPointsValue" ) f21_local8:setText( tostring( f21_local1 ) ) f21_local8:registerAnimationState( "updated", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, height = CoD.TextSettings.NormalFont.Height, right = 0, width = f21_local7 + f21_local2 } ) f21_local8:animateToState( "updated", 0 ) local f21_local9 = f21_arg0:getChildById( "unlockPointsIcon" ) f21_local9:registerAnimationState( "updated", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, width = f21_arg0.properties.tokenWidth, height = f21_arg0.properties.tokenHeight, right = -1 * (f21_local7 + f21_local2) } ) f21_local9:animateToState( "updated", 0 ) local f21_local10 = f21_arg0:getChildById( "unlockPointsLabel" ) f21_local10:registerAnimationState( "updated", { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, height = CoD.TextSettings.NormalFont.Height, right = -1 * (f21_arg0.properties.tokenWidth + f21_local7 + f21_local2 * 2) } ) f21_local10:animateToState( "updated", 0 ) end function aar_token_balance() return { type = "UIElement", properties = { tokenWidth = 20, tokenHeight = 20 }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -AAR.Layout.FooterHeight, bottom = 0, left = 0, right = -10, alpha = Engine.IsAliensMode() and 0 or 1 } }, handlers = { menu_create = UpdateTokenBalance, element_refresh = UpdateTokenBalance }, children = { { type = "UIText", id = "unlockPointsLabel", properties = { text = Engine.Localize( "LUA_MENU_CURRENT_UNLOCK_TOKEN_BALANCE" ) }, states = { default = CoD.ColorizeState( AAR.Swatch.title, { leftAnchor = false, rightAnchor = false, topAnchor = false, bottomAnchor = false, right = -16, width = 300, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Right } ) } }, { type = "UIImage", id = "unlockPointsIcon", states = { default = { leftAnchor = false, rightAnchor = false, topAnchor = false, bottomAnchor = false, width = MBh.Property( "tokenWidth" ), height = MBh.Property( "tokenHeight" ), material = RegisterMaterial( "icon_unlock_token_32" ) } } }, { type = "UIText", id = "unlockPointsValue", properties = { text = tostring( unlockPts ) }, states = { default = CoD.ColorizeState( AAR.Swatch.title, { leftAnchor = false, rightAnchor = true, topAnchor = false, bottomAnchor = false, left = 16, width = 200, height = CoD.TextSettings.NormalFont.Height, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Right } ) } } } } end LUI.MenuBuilder.registerDef( "aar_match_summary_main", aar_match_summary_main ) LUI.MenuBuilder.registerDef( "aar_stats_list", aar_stats_list ) LUI.MenuBuilder.registerDef( "aar_stats_widget", aar_stats_widget ) LUI.MenuBuilder.registerDef( "aar_stats_spacer", aar_stats_spacer ) LUI.MenuBuilder.registerDef( "aar_xp_info_widget", aar_xp_info_widget ) LUI.MenuBuilder.registerDef( "aar_token_balance", aar_token_balance ) LockTable( _M )