From b4b2350b888f49011940b61ab646088726dd5f3b Mon Sep 17 00:00:00 2001 From: diamante0018 Date: Thu, 12 Sep 2024 17:25:45 +0200 Subject: [PATCH] init --- .gitignore | 1 + README.md | 2 + lui/actionscontrols.dec.lua | 232 + lui/advancedvideo.dec.lua | 685 ++ lui/bootscreenmargins.dec.lua | 285 + lui/buttondesctext.dec.lua | 75 + lui/buttonhelpertext.dec.lua | 686 ++ lui/chatcontrols.dec.lua | 159 + lui/cod.dec.lua | 1558 ++++ lui/codedependence.dec.lua | 587 ++ lui/common_menus/caccustomizeutils.dec.lua | 1314 ++++ lui/common_menus/cacutils.dec.lua | 426 ++ lui/common_menus/commonpopups.dec.lua | 2095 ++++++ lui/common_menus/friendslist.dec.lua | 2760 +++++++ lui/common_menus/friendslistutils.dec.lua | 16 + lui/common_menus/friendswidget.dec.lua | 150 + lui/common_menus/gamemanual.dec.lua | 423 ++ lui/common_menus/kinectcontrolmenu.dec.lua | 782 ++ lui/common_menus/kinectutils.dec.lua | 1023 +++ lui/common_menus/options.dec.lua | 1142 +++ lui/common_menus/optionslayout.dec.lua | 3699 ++++++++++ lui/common_menus/playercard.dec.lua | 425 ++ lui/common_menus/profilepopup.dec.lua | 122 + lui/common_menus/rankutils.dec.lua | 123 + lui/common_menus/virtualkeyboard.dec.lua | 129 + lui/common_menus/whatcanisay.dec.lua | 372 + lui/default.dec.lua | 1 + lui/eventcatcher.dec.lua | 124 + lui/flowmanager.dec.lua | 1068 +++ lui/gamepadcontrols.dec.lua | 405 + lui/gamex.dec.lua | 288 + lui/hudmanager.dec.lua | 215 + lui/lookcontrols.dec.lua | 300 + lui/lui.dec.lua | 289 + lui/luianimnumber.dec.lua | 56 + lui/luibarrellist.dec.lua | 295 + lui/luibindbutton.dec.lua | 105 + lui/luibutton.dec.lua | 415 ++ lui/luibuttonrepeater.dec.lua | 165 + lui/luicharacterwindow.dec.lua | 19 + lui/luicountdown.dec.lua | 40 + lui/luielement.dec.lua | 730 ++ lui/luigrid.dec.lua | 289 + lui/luihorizontallist.dec.lua | 144 + lui/luiimage.dec.lua | 13 + lui/luilitimage.dec.lua | 13 + lui/luilongcountdown.dec.lua | 25 + lui/luimarqueetext.dec.lua | 284 + lui/luimousecursor.dec.lua | 59 + lui/luiprettynumber.dec.lua | 22 + lui/luiroot.dec.lua | 478 ++ lui/luisafeareaoverlay.dec.lua | 75 + lui/luiscrollable.dec.lua | 74 + lui/luiscrollingverticallist.dec.lua | 178 + lui/luitechydigits.dec.lua | 21 + lui/luitest.dec.lua | 369 + lui/luitext.dec.lua | 44 + lui/luitighttext.dec.lua | 7 + lui/luitimer.dec.lua | 134 + lui/luiverticallist.dec.lua | 185 + lui/luiverticalscrollbar.dec.lua | 261 + lui/menuautonav.dec.lua | 780 ++ lui/menubuilder.dec.lua | 1182 +++ lui/menugenericbuttons.dec.lua | 2027 +++++ lui/menugenerics.dec.lua | 2341 ++++++ lui/movementcontrols.dec.lua | 164 + lui/mp_hud/a10overlayhud.dec.lua | 801 ++ lui/mp_hud/ac130overlayhud.dec.lua | 1244 ++++ lui/mp_hud/aliencapturinghud.dec.lua | 449 ++ lui/mp_hud/alienchaos.dec.lua | 1720 +++++ lui/mp_hud/alienhud.dec.lua | 6534 +++++++++++++++++ lui/mp_hud/alienhudtechtree.dec.lua | 1452 ++++ lui/mp_hud/alienscoreboards.dec.lua | 1405 ++++ lui/mp_hud/alienvanguardoverlayhud.dec.lua | 624 ++ lui/mp_hud/capturinghud.dec.lua | 983 +++ lui/mp_hud/charselectmenu.dec.lua | 561 ++ lui/mp_hud/damagefeedbackhud.dec.lua | 630 ++ lui/mp_hud/dighud.dec.lua | 314 + lui/mp_hud/endgamemenu.dec.lua | 230 + lui/mp_hud/fireteamhud.dec.lua | 152 + lui/mp_hud/fireteammenu.dec.lua | 476 ++ lui/mp_hud/gamemessagehud.dec.lua | 97 + lui/mp_hud/helicopterpilotoverlayhud.dec.lua | 751 ++ lui/mp_hud/hints.dec.lua | 182 + lui/mp_hud/hordehud.dec.lua | 646 ++ lui/mp_hud/hordeperkshud.dec.lua | 437 ++ lui/mp_hud/hostmigration.dec.lua | 84 + lui/mp_hud/hud.dec.lua | 1434 ++++ lui/mp_hud/hudutils.dec.lua | 68 + lui/mp_hud/ingameactionscontrols.dec.lua | 271 + lui/mp_hud/ingameadvancedvideo.dec.lua | 732 ++ lui/mp_hud/ingamechatcontrols.dec.lua | 186 + lui/mp_hud/ingamecontrols.dec.lua | 1046 +++ lui/mp_hud/ingamegamepadcontrols.dec.lua | 432 ++ lui/mp_hud/ingamelookcontrols.dec.lua | 327 + lui/mp_hud/ingamemovementcontrols.dec.lua | 203 + lui/mp_hud/ingamepcoptions.dec.lua | 1186 +++ lui/mp_hud/intelchallenges.dec.lua | 219 + lui/mp_hud/jammereffecthud.dec.lua | 249 + lui/mp_hud/juggernautoverlayhud.dec.lua | 53 + lui/mp_hud/killcamhud.dec.lua | 948 +++ lui/mp_hud/killstreakhud.dec.lua | 847 +++ lui/mp_hud/matchstarthud.dec.lua | 734 ++ lui/mp_hud/minimaphud.dec.lua | 290 + lui/mp_hud/mlghud.dec.lua | 2227 ++++++ lui/mp_hud/muteplayers.dec.lua | 1080 +++ lui/mp_hud/obituaryhud.dec.lua | 522 ++ lui/mp_hud/odinoverlayhud.dec.lua | 807 ++ lui/mp_hud/optionsmenu.dec.lua | 677 ++ lui/mp_hud/optionsmenuscoreboard.dec.lua | 897 +++ lui/mp_hud/overlayhud.dec.lua | 277 + lui/mp_hud/perksonspawnhud.dec.lua | 197 + lui/mp_hud/playercardhud.dec.lua | 171 + lui/mp_hud/playerinfohud.dec.lua | 1047 +++ lui/mp_hud/pointspopuphud.dec.lua | 389 + lui/mp_hud/predatormissileoverlayhud.dec.lua | 274 + lui/mp_hud/predatoroverlayhud2.dec.lua | 519 ++ lui/mp_hud/roundendhud.dec.lua | 1287 ++++ lui/mp_hud/scoreboard.dec.lua | 1345 ++++ lui/mp_hud/scorelisthud.dec.lua | 1220 +++ lui/mp_hud/screeneffectshud.dec.lua | 184 + lui/mp_hud/spectatorhud.dec.lua | 140 + lui/mp_hud/splasheshud.dec.lua | 825 +++ lui/mp_hud/talkerhud.dec.lua | 235 + lui/mp_hud/teamscoreshud.dec.lua | 519 ++ lui/mp_hud/teamselect.dec.lua | 192 + lui/mp_hud/timershud.dec.lua | 581 ++ lui/mp_hud/vanguardoverlayhud.dec.lua | 545 ++ lui/mp_hud/weaponattachment.dec.lua | 242 + lui/mp_hud/weaponinfohud.dec.lua | 906 +++ lui/mp_menus/aarcommon.dec.lua | 449 ++ lui/mp_menus/aarmain.dec.lua | 314 + lui/mp_menus/aarmini.dec.lua | 607 ++ lui/mp_menus/aaroperationprogress.dec.lua | 396 + lui/mp_menus/aarscoreboard.dec.lua | 800 ++ lui/mp_menus/aarsquadsummary.dec.lua | 495 ++ lui/mp_menus/aarsummary.dec.lua | 1388 ++++ lui/mp_menus/aarunlockscreen.dec.lua | 860 +++ lui/mp_menus/aarutils.dec.lua | 153 + lui/mp_menus/aliens.dec.lua | 1237 ++++ lui/mp_menus/aliensintel.dec.lua | 990 +++ lui/mp_menus/aliensloadout.dec.lua | 2736 +++++++ lui/mp_menus/alienspurchasables.dec.lua | 1428 ++++ lui/mp_menus/archetypeselect.dec.lua | 954 +++ lui/mp_menus/cacabilitiesalt.dec.lua | 1922 +++++ lui/mp_menus/caccustomize.dec.lua | 2731 +++++++ lui/mp_menus/cacedit.dec.lua | 699 ++ lui/mp_menus/caceditchooseimagepopup.dec.lua | 1894 +++++ lui/mp_menus/caceditpopup.dec.lua | 213 + lui/mp_menus/caceditselectioninfo.dec.lua | 846 +++ .../caceditweaponattachchoose.dec.lua | 1341 ++++ .../caceditweaponperformanceinfopane.dec.lua | 468 ++ .../caceditweaponstatsinfopane.dec.lua | 602 ++ lui/mp_menus/cacinfopanes.dec.lua | 740 ++ lui/mp_menus/cacloadoututils.dec.lua | 3899 ++++++++++ lui/mp_menus/cacmain.dec.lua | 1355 ++++ lui/mp_menus/cacmemberselect.dec.lua | 1377 ++++ lui/mp_menus/cacprestigedetails.dec.lua | 369 + lui/mp_menus/cacrecap.dec.lua | 2487 +++++++ lui/mp_menus/casabilitybutton.dec.lua | 648 ++ .../choosecodanywhereplatform.dec.lua | 618 ++ lui/mp_menus/clandetails.dec.lua | 1348 ++++ lui/mp_menus/clanelements.dec.lua | 540 ++ lui/mp_menus/claninvites.dec.lua | 620 ++ lui/mp_menus/killstreakselections.dec.lua | 1680 +++++ lui/mp_menus/leaderboards.dec.lua | 1464 ++++ lui/mp_menus/leaderboardutils.dec.lua | 2206 ++++++ lui/mp_menus/loadoutbuilder.dec.lua | 2098 ++++++ lui/mp_menus/luisquadmemberwindow.dec.lua | 923 +++ lui/mp_menus/main.dec.lua | 217 + lui/mp_menus/menudata.dec.lua | 19 + lui/mp_menus/mlgutils.dec.lua | 140 + lui/mp_menus/motdutils.dec.lua | 318 + lui/mp_menus/motdwidgets.dec.lua | 891 +++ lui/mp_menus/mpbarracks.dec.lua | 456 ++ lui/mp_menus/mpcodanywhere.dec.lua | 2920 ++++++++ .../mpcustomclassrestrictions.dec.lua | 607 ++ lui/mp_menus/mpgamemodeselectmenu.dec.lua | 571 ++ lui/mp_menus/mpgamesetupmenu.dec.lua | 516 ++ lui/mp_menus/mpgamesetupmodemenu.dec.lua | 174 + lui/mp_menus/mpgamesetupoptionsmenu.dec.lua | 2439 ++++++ lui/mp_menus/mpleaderboard.dec.lua | 1516 ++++ lui/mp_menus/mpleaderboardpopups.dec.lua | 421 ++ lui/mp_menus/mpliveprivatelobby.dec.lua | 1097 +++ lui/mp_menus/mplivepubliclobby.dec.lua | 1455 ++++ lui/mp_menus/mplobbycharacterview.dec.lua | 324 + lui/mp_menus/mplobbynavigation.dec.lua | 725 ++ lui/mp_menus/mplobbyplayerstats.dec.lua | 828 +++ lui/mp_menus/mplobbysearchwidget.dec.lua | 644 ++ lui/mp_menus/mplobbyutils.dec.lua | 1408 ++++ lui/mp_menus/mplobbywidgets.dec.lua | 1853 +++++ lui/mp_menus/mpmainmenu.dec.lua | 702 ++ lui/mp_menus/mpmapsetupmenu.dec.lua | 550 ++ lui/mp_menus/mpmemberlist.dec.lua | 2453 +++++++ lui/mp_menus/mponlinevault.dec.lua | 1241 ++++ lui/mp_menus/mpplayerpopups.dec.lua | 524 ++ lui/mp_menus/mpplaylist.dec.lua | 1031 +++ lui/mp_menus/mppopups.dec.lua | 1685 +++++ lui/mp_menus/mpprestigereset.dec.lua | 147 + lui/mp_menus/mpsavedmodeselectmenu.dec.lua | 422 ++ lui/mp_menus/mpscreenshotviewer.dec.lua | 140 + lui/mp_menus/mpstatsreset.dec.lua | 54 + lui/mp_menus/mpvault.dec.lua | 136 + lui/mp_menus/mpxboxlivemenu.dec.lua | 1109 +++ lui/mp_menus/operations.dec.lua | 3389 +++++++++ lui/mp_menus/operationsutils.dec.lua | 1093 +++ lui/mp_menus/playerdatainit.dec.lua | 239 + lui/mp_menus/snselements.dec.lua | 1410 ++++ lui/mp_menus/snsutils.dec.lua | 333 + lui/mp_menus/socialfeed.dec.lua | 1337 ++++ lui/mp_menus/splitscreengamesetupmenu.dec.lua | 689 ++ lui/mp_menus/splitscreensignin.dec.lua | 622 ++ lui/mp_menus/squadprepartylobby.dec.lua | 77 + lui/mp_menus/squadreportdetail.dec.lua | 1247 ++++ lui/mp_menus/squadreports.dec.lua | 1140 +++ lui/mp_menus/squadsmodeselect.dec.lua | 1293 ++++ lui/mp_menus/store.dec.lua | 622 ++ lui/mp_menus/svsutils.dec.lua | 642 ++ lui/mp_menus/systemlinkgamesetupmenu.dec.lua | 512 ++ lui/mp_menus/systemlinkjoinmenu.dec.lua | 429 ++ lui/mp_menus/systemlinkmenu.dec.lua | 204 + lui/pcoptions.dec.lua | 1159 +++ lui/persistentbackground.dec.lua | 1055 +++ lui/speech.dec.lua | 188 + 224 files changed, 172565 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 lui/actionscontrols.dec.lua create mode 100644 lui/advancedvideo.dec.lua create mode 100644 lui/bootscreenmargins.dec.lua create mode 100644 lui/buttondesctext.dec.lua create mode 100644 lui/buttonhelpertext.dec.lua create mode 100644 lui/chatcontrols.dec.lua create mode 100644 lui/cod.dec.lua create mode 100644 lui/codedependence.dec.lua create mode 100644 lui/common_menus/caccustomizeutils.dec.lua create mode 100644 lui/common_menus/cacutils.dec.lua create mode 100644 lui/common_menus/commonpopups.dec.lua create mode 100644 lui/common_menus/friendslist.dec.lua create mode 100644 lui/common_menus/friendslistutils.dec.lua create mode 100644 lui/common_menus/friendswidget.dec.lua create mode 100644 lui/common_menus/gamemanual.dec.lua create mode 100644 lui/common_menus/kinectcontrolmenu.dec.lua create mode 100644 lui/common_menus/kinectutils.dec.lua create mode 100644 lui/common_menus/options.dec.lua create mode 100644 lui/common_menus/optionslayout.dec.lua create mode 100644 lui/common_menus/playercard.dec.lua create mode 100644 lui/common_menus/profilepopup.dec.lua create mode 100644 lui/common_menus/rankutils.dec.lua create mode 100644 lui/common_menus/virtualkeyboard.dec.lua create mode 100644 lui/common_menus/whatcanisay.dec.lua create mode 100644 lui/default.dec.lua create mode 100644 lui/eventcatcher.dec.lua create mode 100644 lui/flowmanager.dec.lua create mode 100644 lui/gamepadcontrols.dec.lua create mode 100644 lui/gamex.dec.lua create mode 100644 lui/hudmanager.dec.lua create mode 100644 lui/lookcontrols.dec.lua create mode 100644 lui/lui.dec.lua create mode 100644 lui/luianimnumber.dec.lua create mode 100644 lui/luibarrellist.dec.lua create mode 100644 lui/luibindbutton.dec.lua create mode 100644 lui/luibutton.dec.lua create mode 100644 lui/luibuttonrepeater.dec.lua create mode 100644 lui/luicharacterwindow.dec.lua create mode 100644 lui/luicountdown.dec.lua create mode 100644 lui/luielement.dec.lua create mode 100644 lui/luigrid.dec.lua create mode 100644 lui/luihorizontallist.dec.lua create mode 100644 lui/luiimage.dec.lua create mode 100644 lui/luilitimage.dec.lua create mode 100644 lui/luilongcountdown.dec.lua create mode 100644 lui/luimarqueetext.dec.lua create mode 100644 lui/luimousecursor.dec.lua create mode 100644 lui/luiprettynumber.dec.lua create mode 100644 lui/luiroot.dec.lua create mode 100644 lui/luisafeareaoverlay.dec.lua create mode 100644 lui/luiscrollable.dec.lua create mode 100644 lui/luiscrollingverticallist.dec.lua create mode 100644 lui/luitechydigits.dec.lua create mode 100644 lui/luitest.dec.lua create mode 100644 lui/luitext.dec.lua create mode 100644 lui/luitighttext.dec.lua create mode 100644 lui/luitimer.dec.lua create mode 100644 lui/luiverticallist.dec.lua create mode 100644 lui/luiverticalscrollbar.dec.lua create mode 100644 lui/menuautonav.dec.lua create mode 100644 lui/menubuilder.dec.lua create mode 100644 lui/menugenericbuttons.dec.lua create mode 100644 lui/menugenerics.dec.lua create mode 100644 lui/movementcontrols.dec.lua create mode 100644 lui/mp_hud/a10overlayhud.dec.lua create mode 100644 lui/mp_hud/ac130overlayhud.dec.lua create mode 100644 lui/mp_hud/aliencapturinghud.dec.lua create mode 100644 lui/mp_hud/alienchaos.dec.lua create mode 100644 lui/mp_hud/alienhud.dec.lua create mode 100644 lui/mp_hud/alienhudtechtree.dec.lua create mode 100644 lui/mp_hud/alienscoreboards.dec.lua create mode 100644 lui/mp_hud/alienvanguardoverlayhud.dec.lua create mode 100644 lui/mp_hud/capturinghud.dec.lua create mode 100644 lui/mp_hud/charselectmenu.dec.lua create mode 100644 lui/mp_hud/damagefeedbackhud.dec.lua create mode 100644 lui/mp_hud/dighud.dec.lua create mode 100644 lui/mp_hud/endgamemenu.dec.lua create mode 100644 lui/mp_hud/fireteamhud.dec.lua create mode 100644 lui/mp_hud/fireteammenu.dec.lua create mode 100644 lui/mp_hud/gamemessagehud.dec.lua create mode 100644 lui/mp_hud/helicopterpilotoverlayhud.dec.lua create mode 100644 lui/mp_hud/hints.dec.lua create mode 100644 lui/mp_hud/hordehud.dec.lua create mode 100644 lui/mp_hud/hordeperkshud.dec.lua create mode 100644 lui/mp_hud/hostmigration.dec.lua create mode 100644 lui/mp_hud/hud.dec.lua create mode 100644 lui/mp_hud/hudutils.dec.lua create mode 100644 lui/mp_hud/ingameactionscontrols.dec.lua create mode 100644 lui/mp_hud/ingameadvancedvideo.dec.lua create mode 100644 lui/mp_hud/ingamechatcontrols.dec.lua create mode 100644 lui/mp_hud/ingamecontrols.dec.lua create mode 100644 lui/mp_hud/ingamegamepadcontrols.dec.lua create mode 100644 lui/mp_hud/ingamelookcontrols.dec.lua create mode 100644 lui/mp_hud/ingamemovementcontrols.dec.lua create mode 100644 lui/mp_hud/ingamepcoptions.dec.lua create mode 100644 lui/mp_hud/intelchallenges.dec.lua create mode 100644 lui/mp_hud/jammereffecthud.dec.lua create mode 100644 lui/mp_hud/juggernautoverlayhud.dec.lua create mode 100644 lui/mp_hud/killcamhud.dec.lua create mode 100644 lui/mp_hud/killstreakhud.dec.lua create mode 100644 lui/mp_hud/matchstarthud.dec.lua create mode 100644 lui/mp_hud/minimaphud.dec.lua create mode 100644 lui/mp_hud/mlghud.dec.lua create mode 100644 lui/mp_hud/muteplayers.dec.lua create mode 100644 lui/mp_hud/obituaryhud.dec.lua create mode 100644 lui/mp_hud/odinoverlayhud.dec.lua create mode 100644 lui/mp_hud/optionsmenu.dec.lua create mode 100644 lui/mp_hud/optionsmenuscoreboard.dec.lua create mode 100644 lui/mp_hud/overlayhud.dec.lua create mode 100644 lui/mp_hud/perksonspawnhud.dec.lua create mode 100644 lui/mp_hud/playercardhud.dec.lua create mode 100644 lui/mp_hud/playerinfohud.dec.lua create mode 100644 lui/mp_hud/pointspopuphud.dec.lua create mode 100644 lui/mp_hud/predatormissileoverlayhud.dec.lua create mode 100644 lui/mp_hud/predatoroverlayhud2.dec.lua create mode 100644 lui/mp_hud/roundendhud.dec.lua create mode 100644 lui/mp_hud/scoreboard.dec.lua create mode 100644 lui/mp_hud/scorelisthud.dec.lua create mode 100644 lui/mp_hud/screeneffectshud.dec.lua create mode 100644 lui/mp_hud/spectatorhud.dec.lua create mode 100644 lui/mp_hud/splasheshud.dec.lua create mode 100644 lui/mp_hud/talkerhud.dec.lua create mode 100644 lui/mp_hud/teamscoreshud.dec.lua create mode 100644 lui/mp_hud/teamselect.dec.lua create mode 100644 lui/mp_hud/timershud.dec.lua create mode 100644 lui/mp_hud/vanguardoverlayhud.dec.lua create mode 100644 lui/mp_hud/weaponattachment.dec.lua create mode 100644 lui/mp_hud/weaponinfohud.dec.lua create mode 100644 lui/mp_menus/aarcommon.dec.lua create mode 100644 lui/mp_menus/aarmain.dec.lua create mode 100644 lui/mp_menus/aarmini.dec.lua create mode 100644 lui/mp_menus/aaroperationprogress.dec.lua create mode 100644 lui/mp_menus/aarscoreboard.dec.lua create mode 100644 lui/mp_menus/aarsquadsummary.dec.lua create mode 100644 lui/mp_menus/aarsummary.dec.lua create mode 100644 lui/mp_menus/aarunlockscreen.dec.lua create mode 100644 lui/mp_menus/aarutils.dec.lua create mode 100644 lui/mp_menus/aliens.dec.lua create mode 100644 lui/mp_menus/aliensintel.dec.lua create mode 100644 lui/mp_menus/aliensloadout.dec.lua create mode 100644 lui/mp_menus/alienspurchasables.dec.lua create mode 100644 lui/mp_menus/archetypeselect.dec.lua create mode 100644 lui/mp_menus/cacabilitiesalt.dec.lua create mode 100644 lui/mp_menus/caccustomize.dec.lua create mode 100644 lui/mp_menus/cacedit.dec.lua create mode 100644 lui/mp_menus/caceditchooseimagepopup.dec.lua create mode 100644 lui/mp_menus/caceditpopup.dec.lua create mode 100644 lui/mp_menus/caceditselectioninfo.dec.lua create mode 100644 lui/mp_menus/caceditweaponattachchoose.dec.lua create mode 100644 lui/mp_menus/caceditweaponperformanceinfopane.dec.lua create mode 100644 lui/mp_menus/caceditweaponstatsinfopane.dec.lua create mode 100644 lui/mp_menus/cacinfopanes.dec.lua create mode 100644 lui/mp_menus/cacloadoututils.dec.lua create mode 100644 lui/mp_menus/cacmain.dec.lua create mode 100644 lui/mp_menus/cacmemberselect.dec.lua create mode 100644 lui/mp_menus/cacprestigedetails.dec.lua create mode 100644 lui/mp_menus/cacrecap.dec.lua create mode 100644 lui/mp_menus/casabilitybutton.dec.lua create mode 100644 lui/mp_menus/choosecodanywhereplatform.dec.lua create mode 100644 lui/mp_menus/clandetails.dec.lua create mode 100644 lui/mp_menus/clanelements.dec.lua create mode 100644 lui/mp_menus/claninvites.dec.lua create mode 100644 lui/mp_menus/killstreakselections.dec.lua create mode 100644 lui/mp_menus/leaderboards.dec.lua create mode 100644 lui/mp_menus/leaderboardutils.dec.lua create mode 100644 lui/mp_menus/loadoutbuilder.dec.lua create mode 100644 lui/mp_menus/luisquadmemberwindow.dec.lua create mode 100644 lui/mp_menus/main.dec.lua create mode 100644 lui/mp_menus/menudata.dec.lua create mode 100644 lui/mp_menus/mlgutils.dec.lua create mode 100644 lui/mp_menus/motdutils.dec.lua create mode 100644 lui/mp_menus/motdwidgets.dec.lua create mode 100644 lui/mp_menus/mpbarracks.dec.lua create mode 100644 lui/mp_menus/mpcodanywhere.dec.lua create mode 100644 lui/mp_menus/mpcustomclassrestrictions.dec.lua create mode 100644 lui/mp_menus/mpgamemodeselectmenu.dec.lua create mode 100644 lui/mp_menus/mpgamesetupmenu.dec.lua create mode 100644 lui/mp_menus/mpgamesetupmodemenu.dec.lua create mode 100644 lui/mp_menus/mpgamesetupoptionsmenu.dec.lua create mode 100644 lui/mp_menus/mpleaderboard.dec.lua create mode 100644 lui/mp_menus/mpleaderboardpopups.dec.lua create mode 100644 lui/mp_menus/mpliveprivatelobby.dec.lua create mode 100644 lui/mp_menus/mplivepubliclobby.dec.lua create mode 100644 lui/mp_menus/mplobbycharacterview.dec.lua create mode 100644 lui/mp_menus/mplobbynavigation.dec.lua create mode 100644 lui/mp_menus/mplobbyplayerstats.dec.lua create mode 100644 lui/mp_menus/mplobbysearchwidget.dec.lua create mode 100644 lui/mp_menus/mplobbyutils.dec.lua create mode 100644 lui/mp_menus/mplobbywidgets.dec.lua create mode 100644 lui/mp_menus/mpmainmenu.dec.lua create mode 100644 lui/mp_menus/mpmapsetupmenu.dec.lua create mode 100644 lui/mp_menus/mpmemberlist.dec.lua create mode 100644 lui/mp_menus/mponlinevault.dec.lua create mode 100644 lui/mp_menus/mpplayerpopups.dec.lua create mode 100644 lui/mp_menus/mpplaylist.dec.lua create mode 100644 lui/mp_menus/mppopups.dec.lua create mode 100644 lui/mp_menus/mpprestigereset.dec.lua create mode 100644 lui/mp_menus/mpsavedmodeselectmenu.dec.lua create mode 100644 lui/mp_menus/mpscreenshotviewer.dec.lua create mode 100644 lui/mp_menus/mpstatsreset.dec.lua create mode 100644 lui/mp_menus/mpvault.dec.lua create mode 100644 lui/mp_menus/mpxboxlivemenu.dec.lua create mode 100644 lui/mp_menus/operations.dec.lua create mode 100644 lui/mp_menus/operationsutils.dec.lua create mode 100644 lui/mp_menus/playerdatainit.dec.lua create mode 100644 lui/mp_menus/snselements.dec.lua create mode 100644 lui/mp_menus/snsutils.dec.lua create mode 100644 lui/mp_menus/socialfeed.dec.lua create mode 100644 lui/mp_menus/splitscreengamesetupmenu.dec.lua create mode 100644 lui/mp_menus/splitscreensignin.dec.lua create mode 100644 lui/mp_menus/squadprepartylobby.dec.lua create mode 100644 lui/mp_menus/squadreportdetail.dec.lua create mode 100644 lui/mp_menus/squadreports.dec.lua create mode 100644 lui/mp_menus/squadsmodeselect.dec.lua create mode 100644 lui/mp_menus/store.dec.lua create mode 100644 lui/mp_menus/svsutils.dec.lua create mode 100644 lui/mp_menus/systemlinkgamesetupmenu.dec.lua create mode 100644 lui/mp_menus/systemlinkjoinmenu.dec.lua create mode 100644 lui/mp_menus/systemlinkmenu.dec.lua create mode 100644 lui/pcoptions.dec.lua create mode 100644 lui/persistentbackground.dec.lua create mode 100644 lui/speech.dec.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..31b688b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.luac diff --git a/README.md b/README.md new file mode 100644 index 0000000..6d63ab0 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# IW6 LUI +This repo contains the IW6 LUI dump. diff --git a/lui/actionscontrols.dec.lua b/lui/actionscontrols.dec.lua new file mode 100644 index 0000000..f99bd2d --- /dev/null +++ b/lui/actionscontrols.dec.lua @@ -0,0 +1,232 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetDisplay( f1_arg0 ) + return Engine.GetBinding( f1_arg0 ) +end + +function bindKey( f2_arg0 ) + Engine.BindKey( f2_arg0 ) +end + +function OptionsWindowRefresh( f3_arg0, f3_arg1 ) + if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then + f3_arg0:processEvent( { + name = "menu_refresh" + } ) + f3_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function SinglePlayerDisableFunction( f5_arg0, f5_arg1 ) + return not Engine.IsMultiplayer() +end + +function ControlBindFactory( f6_arg0, f6_arg1, f6_arg2 ) + return { + type = "UIGenericButton", + id = "bind_" .. f6_arg0, + disabledFunc = f6_arg2 or function () + return false + end + , + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f6_arg0 ), + button_display_func = function ( f8_arg0, f8_arg1 ) + return GetDisplay( f6_arg1 ) + end + , + button_action_func = function ( f9_arg0, f9_arg1 ) + Engine.BindKey( f6_arg1 ) + OptionsWindowTriggerRefresh( f9_arg0, f9_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionFactoryProfileData( f10_arg0, f10_arg1, f10_arg2, f10_arg3, f10_arg4, f10_arg5 ) + local f10_local0 = Engine.GetProfileData( f10_arg0 ) + local f10_local1 = 1 + for f10_local5, f10_local6 in pairs( f10_arg3 ) do + if f10_local6.value == f10_local0 then + f10_local1 = f10_local5 + break + end + end + f10_local2 = function ( f11_arg0, f11_arg1 ) + Engine.ExecNow( f10_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + OptionsWindowTriggerRefresh( f11_arg0, f11_arg1 ) + end + + f10_local3 = { + type = "UIGenericButton", + id = "option_" .. f10_arg0, + disabledFunc = f10_arg4 or function () + return false + end + + } + f10_local4 = { + variant = GenericButtonSettings.Variants.Select + } + if f10_arg5 then + local f10_local7 = f10_arg2 + end + f10_local4.button_text = f10_local7 or Engine.Localize( f10_arg2 ) + f10_local4.button_display_func = function ( f13_arg0, f13_arg1 ) + return Engine.Localize( f10_arg3[f10_local1].text ) + end + + f10_local4.button_left_func = function ( f14_arg0, f14_arg1 ) + f10_local1 = 1 + (#f10_arg3 + f10_local1 - 1 - 1) % #f10_arg3 + f10_local2( f14_arg0, f14_arg1 ) + end + + f10_local4.button_right_func = function ( f15_arg0, f15_arg1 ) + f10_local1 = 1 + (f10_local1 - 1 + 1) % #f10_arg3 + f10_local2( f15_arg0, f15_arg1 ) + end + + f10_local3.properties = f10_local4 + f10_local3.handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + return f10_local3 +end + +function OptionsFeeder( f16_arg0 ) + local f16_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f16_local0[#f16_local0 + 1] = OptionFactoryProfileData( "leanEnabled", "profile_toggleLean", "@LUA_MENU_LEAN_TOGGLE", { + { + text = "@LUA_MENU_ENABLED", + value = true + }, + { + text = "@LUA_MENU_DISABLED", + value = false + } + } ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_FIRE_WEAPON", "+attack" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_AIM_DOWN_THE_SIGHT", "+toggleads_throw" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_HOLD_AIM_DOWN_SIGHT", "+speed_throw" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_RELOAD_WEAPON", "+reload" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_SWITCH_WEAPON", "weapnext" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@PLATFORM_MELEEZOOM", "+melee_zoom" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_USE", "+activate" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_FRAG_EQUIPMENT", "+frag" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_THROW_SPECIAL_GRENADE", "+smoke" ) + if SinglePlayerDisableFunction() then + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_WEAPON_ATTACHMENT", "+actionslot 3" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_INVENTORY_KILLSTREAK", "+actionslot 4" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_NVG_WATCH", "+actionslot 1" ) + else + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_1", "+actionslot 4" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_2", "+actionslot 5" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_3", "+actionslot 6" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_4", "+actionslot 7" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( Engine.IsAliensMode() and "ALIENS_UPGRADE_ABILITIES" or "@PLATFORM_UI_SHOW_SCORES", "togglescores" ) + end + return f16_local0 +end + +function OptionsMainCreate( f17_arg0, f17_arg1 ) + f17_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function actions_controls_vlist() + return { + type = "UIScrollingVerticalList", + childrenFeeder = OptionsFeeder, + properties = { + use_arrows = true, + sendScrollEvents = true, + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = OptionsListDims.menu_top, + bottom = OptionsListDims.menu_bottom, + left = OptionsListDims.menu_left, + right = OptionsListDims.menu_right + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function actions_controls() + return { + type = "UIElement", + id = "actions_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = function ( f20_arg0, f20_arg1 ) + Engine.Exec( "updategamerprofile" ) + end + + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_ACTIONS" ) + } + }, + { + type = "actions_controls_vlist", + id = "actions_cotnrols_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "actions_controls_vlist", actions_controls_vlist ) +LUI.MenuBuilder.registerDef( "actions_controls", actions_controls ) +LockTable( _M ) diff --git a/lui/advancedvideo.dec.lua b/lui/advancedvideo.dec.lua new file mode 100644 index 0000000..8feb883 --- /dev/null +++ b/lui/advancedvideo.dec.lua @@ -0,0 +1,685 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function BackButtonAction( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + f1_arg0:dispatchEventToRoot( { + name = "check_show_apply", + immediate = true + } ) + if f1_local0.showApplySettings then + if Engine.ShowLowTextureResolutionWarning() then + if f1_local0.vidRestart then + LUI.FlowManager.RequestPopupMenu( f1_arg0, "show_low_texture_res_warning_restart_popmenu", false, f1_arg1.controller, false ) + else + LUI.FlowManager.RequestPopupMenu( f1_arg0, "show_low_texture_res_warning_popmenu", false, f1_arg1.controller, false ) + end + elseif f1_local0.vidRestart then + LUI.FlowManager.RequestPopupMenu( f1_arg0, "apply_settings_restart_popmenu", false, f1_arg1.controller, false ) + else + LUI.FlowManager.RequestPopupMenu( f1_arg0, "apply_settings_popmenu", false, f1_arg1.controller, false ) + end + end + LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) +end + +function PicmipDisabledFunc() + return Engine.GetDvarInt( "ui_r_picmip_manual" ) == 0 +end + +f0_local0 = nil +function NVidiaButtonOver( f3_arg0, f3_arg1 ) + f0_local0 = f3_arg0.id + f3_arg0:dispatchEventToRoot( { + name = "show_nvidia_subtitle", + immediate = true + } ) +end + +function NVidiaButtonUp( f4_arg0, f4_arg1 ) + if f0_local0 == f4_arg0.id then + f0_local0 = nil + f4_arg0:dispatchEventToRoot( { + name = "hide_nvidia_subtitle", + immediate = true + } ) + end +end + +function OptionsWindowRefresh( f5_arg0, f5_arg1 ) + if f5_arg1.source_input == "button_action" or f5_arg1.source_input == "key_bound" or f5_arg1.source_input == "button_right" or f5_arg1.source_input == "button_left" then + f5_arg0:processEvent( { + name = "menu_refresh" + } ) + f5_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f6_arg0, f6_arg1 ) + f6_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f6_arg1.name, + immediate = true + } ) +end + +function GetFOV( f7_arg0 ) + return (Engine.GetDvarFloat( "ui_cg_fov" ) - f7_arg0.Min) / (f7_arg0.Max - f7_arg0.Min) +end + +function SliderChange( f8_arg0, f8_arg1, f8_arg2, f8_arg3 ) + Engine.SetDvarFloat( f8_arg3, math.min( f8_arg1, math.max( f8_arg0, Engine.GetDvarFloat( f8_arg3 ) + f8_arg2 ) ) ) +end + +function OptionFactory( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_arg4, f9_arg5, f9_arg6, f9_arg7, f9_arg8, f9_arg9, f9_arg10, f9_arg11 ) + local f9_local0 = nil + local f9_local1 = 1 + local f9_local2 = Engine.GetDvarType( f9_arg0 ) + local f9_local3 = nil + if f9_arg9 then + f9_local3 = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( f9_arg1 ), + button_display_func = function ( f10_arg0, f10_arg1 ) + return f9_arg11( f9_arg10 ) + end, + button_left_func = function ( f11_arg0, f11_arg1 ) + SliderChange( f9_arg10.Min, f9_arg10.Max, -f9_arg10.Step, f9_arg0 ) + end, + button_right_func = function ( f12_arg0, f12_arg1 ) + SliderChange( f9_arg10.Min, f9_arg10.Max, f9_arg10.Step, f9_arg0 ) + end + } + else + if f9_local2 == DvarTypeTable.DvarString or f9_local2 == DvarTypeTable.DvarEnum then + f9_local0 = Engine.GetDvarString( f9_arg0 ) + elseif f9_local2 == DvarTypeTable.DvarInt then + f9_local0 = Engine.GetDvarInt( f9_arg0 ) + elseif f9_local2 == DvarTypeTable.DvarBool then + f9_local0 = Engine.GetDvarBool( f9_arg0 ) + end + for f9_local7, f9_local8 in pairs( f9_arg2 ) do + if f9_local8.value == f9_local0 then + f9_local1 = f9_local7 + break + end + end + f9_local4 = function ( f13_arg0, f13_arg1 ) + if f9_local2 == DvarTypeTable.DvarString or f9_local2 == DvarTypeTable.DvarEnum then + Engine.SetDvarString( f9_arg0, f9_arg2[f9_local1].value ) + elseif f9_local2 == DvarTypeTable.DvarInt then + Engine.SetDvarInt( f9_arg0, f9_arg2[f9_local1].value ) + elseif f9_local2 == DvarTypeTable.DvarBool then + Engine.SetDvarBool( f9_arg0, f9_arg2[f9_local1].value ) + end + OptionsWindowTriggerRefresh( f13_arg0, f13_arg1 ) + end + + f9_local3 = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f9_arg1 ), + button_display_func = function ( f14_arg0, f14_arg1 ) + return f9_arg6 and f9_arg2[f9_local1].text or Engine.Localize( f9_arg2[f9_local1].text ) + end, + button_left_func = function ( f15_arg0, f15_arg1 ) + f9_local1 = 1 + (#f9_arg2 + f9_local1 - 1 - 1) % #f9_arg2 + f9_local4( f15_arg0, f15_arg1 ) + end, + button_right_func = function ( f16_arg0, f16_arg1 ) + f9_local1 = 1 + (f9_local1 - 1 + 1) % #f9_arg2 + f9_local4( f16_arg0, f16_arg1 ) + end, + button_over_func = f9_arg7, + button_up_func = f9_arg8 + } + end + return { + type = "UIGenericButton", + id = "option_" .. f9_arg0, + disabledFunc = f9_arg4 or function () + return false + end + , + states = { + default = { + alpha = 1 + }, + invisible = { + alpha = 0 + } + }, + properties = f9_local3, + handlers = { + check_show_apply = function ( f18_arg0, f18_arg1 ) + if f9_arg3 then + if f9_arg9 then + local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0 ) + if Engine.GetDvarFloat( f9_arg3 ) ~= Engine.GetDvarFloat( f9_arg0 ) then + f18_local0.showApplySettings = true + if f9_arg5 then + f18_local0.vidRestart = true + end + end + else + local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0 ) + local f18_local1 = nil + local f18_local2 = Engine.GetDvarType( f9_arg3 ) + if f18_local2 == DvarTypeTable.DvarString or f18_local2 == DvarTypeTable.DvarEnum then + f18_local1 = Engine.GetDvarString( f9_arg3 ) + elseif f18_local2 == DvarTypeTable.DvarInt then + f18_local1 = tostring( Engine.GetDvarInt( f9_arg3 ) ) + elseif f18_local2 == DvarTypeTable.DvarBool then + if Engine.GetDvarBool( f9_arg3 ) then + local f18_local3 = "1" + end + f18_local1 = f18_local3 or "0" + elseif f18_local2 == DvarTypeTable.DvarFloat then + f18_local1 = tostring( Engine.GetDvarFloat( f9_arg3 ) ) + end + if f18_local1 ~= f9_arg2[f9_local1].value then + f18_local0.showApplySettings = true + if f9_arg5 then + f18_local0.vidRestart = true + end + end + end + end + end + + } + } +end + +function OptionsFeeder( f19_arg0 ) + local f19_local0 = { + [#f19_local0 + 1] = OptionFactory( "ui_r_aspectratio", "@MENU_ASPECT_RATIO", { + { + text = "@MENU_AUTO", + value = "auto" + }, + { + text = "@MENU_STANDARD_4_3", + value = "standard" + }, + { + text = "@MENU_WIDE_16_10", + value = "wide 16:10" + }, + { + text = "MENU_WIDE_16_9", + value = "wide 16:9" + } + }, "r_aspectratio", nil, true ) + } + local f19_local1 = {} + for f19_local5, f19_local6 in pairs( Engine.GetDvarEnumList( "r_displayRefresh" ) ) do + f19_local1[#f19_local1 + 1] = { + text = f19_local6, + value = f19_local6 + } + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_displayRefresh", "@MENU_SCREEN_REFRESH_RATE", f19_local1, "r_displayRefresh", nil, true, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_vsync", "@MENU_SYNC_EVERY_FRAME", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_vsync", nil, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_imageQuality", "@PLATFORM_UI_IMAGE_QUALITY", { + { + text = "@MENU_VERY_LOW", + value = "1" + }, + { + text = "@MENU_LOW", + value = "2" + }, + { + text = "@MENU_NORMAL", + value = "3" + }, + { + text = "@MENU_HIGH", + value = "4" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_imageQuality", nil, true ) + if Engine.IsMultiplayer() then + f19_local2 = {} + f19_local3 = SliderBounds.FOV.Max - SliderBounds.FOV.Min + for f19_local4 = 0, f19_local3, 1 do + local f19_local7 = tostring( SliderBounds.FOV.Min + f19_local4 ) + f19_local2[f19_local4 + 1] = { + text = Engine.MarkLocalized( f19_local7 ), + value = f19_local7 + } + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_cg_fov", "@MENU_FOV", f19_local2, "cg_fov", nil, false, true, function ( f20_arg0, f20_arg1 ) + f20_arg0:dispatchEventToRoot( { + name = "show_fov_subtitle", + immediate = true + } ) + end, function ( f21_arg0, f21_arg1 ) + f21_arg0:dispatchEventToRoot( { + name = "hide_fov_subtitle", + immediate = true + } ) + end, false, false, false ) + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_dof_enable", "@MENU_DOF", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_dof_enable", nil, false ) + if Engine.HBAOAvailable() then + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_ssao", "@PLATFORM_SSAO", { + { + text = "@MENU_OFF", + value = "0_Off" + }, + { + text = "@PLATFORM_LOW_QUALITY", + value = "1_Low" + }, + { + text = "@PLATFORM_HIGH_QUALITY", + value = "2_High" + }, + { + text = "@PLATFORM_HBAO", + value = "3_HBAO" + } + }, "r_ssao", nil, true ) + else + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_ssao", "@PLATFORM_SSAO", { + { + text = "@MENU_OFF", + value = "0_Off" + }, + { + text = "@PLATFORM_LOW_QUALITY", + value = "1_Low" + }, + { + text = "@PLATFORM_HIGH_QUALITY", + value = "2_High" + } + }, "r_ssao", nil, true ) + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_tessellation", "@MENU_TESSELLATION", { + { + text = "@MENU_OFF", + value = "0_Off" + }, + { + text = "@MENU_NORMAL", + value = "1_Near" + }, + { + text = "@MENU_EXTRA", + value = "2_All" + } + }, "r_tessellation", nil, false ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_texFilterAnisoMin", "@LUA_MENU_ANISOTROPIC_FILTERING", { + { + text = "@MENU_LOW", + value = "1" + }, + { + text = "@MENU_NORMAL", + value = "8" + }, + { + text = "@MENU_HIGH", + value = "16" + } + }, "r_texFilterAnisoMin", nil, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_mbEnableA", "@MENU_MOTION_BLUR", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_mbEnableA", nil, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_distortion", "@MENU_DISTORTION", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_distortion", nil, false ) + if Engine.TXAAAvailable() then + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_aaMode", "@MENU_ANTIALIASING", { + { + text = "@MENU_OFF", + value = "Off" + }, + { + text = "@MENU_FXAA", + value = "FXAA" + }, + { + text = "@MENU_2X_MSAA", + value = "2xMSAA" + }, + { + text = "@MENU_4X_MSAA", + value = "4xMSAA" + }, + { + text = "@MENU_SMAA", + value = "SMAA" + }, + { + text = "@MENU_2X_TXAA", + value = "2xTXAA" + }, + { + text = "@MENU_4X_TXAA", + value = "4xTXAA" + } + }, "r_aaMode", nil, true ) + else + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_aaMode", "@MENU_ANTIALIASING", { + { + text = "@MENU_OFF", + value = "Off" + }, + { + text = "@MENU_FXAA", + value = "FXAA" + }, + { + text = "@MENU_2X_MSAA", + value = "2xMSAA" + }, + { + text = "@MENU_4X_MSAA", + value = "4xMSAA" + }, + { + text = "@MENU_SMAA", + value = "SMAA" + } + }, "r_aaMode", nil, true ) + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_sm_enable", "@MENU_SHADOWS", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "sm_enable", nil, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_manual", "@MENU_TEXTURE_QUALITY", { + { + text = "@MENU_AUTOMATIC", + value = "0" + }, + { + text = "@MENU_MANUAL", + value = "1" + } + }, "r_picmip_manual", nil, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip", "@MENU_TEXTURE_RESOLUTION", { + { + text = "@MENU_LOW", + value = "3" + }, + { + text = "@MENU_NORMAL", + value = "2" + }, + { + text = "@MENU_HIGH", + value = "1" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_picmip", PicmipDisabledFunc, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_bump", "@MENU_NORMAL_MAP_RESOLUTION", { + { + text = "@MENU_LOW", + value = "3" + }, + { + text = "@MENU_NORMAL", + value = "2" + }, + { + text = "@MENU_HIGH", + value = "1" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_picmip_bump", PicmipDisabledFunc, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_spec", "@MENU_SPECULAR_MAP_RESOLUTION", { + { + text = "@MENU_LOW", + value = "3" + }, + { + text = "@MENU_NORMAL", + value = "2" + }, + { + text = "@MENU_HIGH", + value = "1" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_picmip_spec", PicmipDisabledFunc, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_water", "@MENU_WATER_MAP_RESOLUTION", { + { + text = "@MENU_LOW", + value = "1" + }, + { + text = "@MENU_HIGH", + value = "0" + } + }, "r_picmip_water", PicmipDisabledFunc, true ) + if Engine.FurShaderAvailable() then + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_fur_shader", "@MENU_FUR_SHADER", { + { + text = "@MENU_OFF", + value = "0" + }, + { + text = "@MENU_LOW", + value = "1" + }, + { + text = "@MENU_HIGH", + value = "2" + } + }, "r_fur_shader", nil, true, nil, NVidiaButtonOver, NVidiaButtonUp ) + end + if Engine.APEXTurbulenceAvailable() then + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_apex_turbulence", "@MENU_APEX_TURBULENCE", { + { + text = "@MENU_ON", + value = "1" + }, + { + text = "@MENU_OFF", + value = "0" + } + }, "r_apex_turbulence", nil, true, nil, NVidiaButtonOver, NVidiaButtonUp ) + end + return f19_local0 +end + +function OptionsMainCreate( f22_arg0, f22_arg1 ) + Engine.ExecNow( "profile_menuDvarsSetup" ) + f22_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function OptionsMainClose( f23_arg0, f23_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + if Engine.GetDvarString( "r_lodScaleRigid" ) == "2" then + Engine.SetDvarString( "r_lodScaleSkinned", "4" ) + Engine.SetDvarString( "r_lodBiasSkinned", "-200" ) + Engine.SetDvarString( "r_lodBiasRigid", "-100" ) + end + if Engine.GetDvarString( "r_lodScaleRigid" ) == "1" then + Engine.SetDvarString( "r_lodScaleSkinned", "1" ) + Engine.SetDvarString( "r_lodBiasSkinned", "0" ) + Engine.SetDvarString( "r_lodBiasRigid", "0" ) + end +end + +function advanced_video_vlist() + return { + type = "UIScrollingVerticalList", + childrenFeeder = OptionsFeeder, + properties = { + use_arrows = true, + sendScrollEvents = true, + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = OptionsListDims.menu_top, + bottom = OptionsListDims.menu_bottom, + left = OptionsListDims.menu_left, + right = OptionsListDims.menu_right + } + } + } +end + +function advanced_video() + return { + type = "UIElement", + id = "advanced_video_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose, + options_window_refresh = OptionsWindowRefresh + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_ADVANCED_VIDEO" ) + } + }, + { + type = "advanced_video_vlist", + id = "advanced_video_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIMarqueeText", + id = "nvidia_option_subtitle", + properties = { + text = Engine.Localize( "@MENU_NVIDIA_OPTION_SUB" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = OptionsListDims.menu_bottom - CoD.TextSettings.HudIW6NormalFont.Height, + bottom = OptionsListDims.menu_bottom - CoD.TextSettings.HudIW6NormalFont.Height + CoD.TextSettings.TinyFont.Height, + left = 10, + right = OptionsListDims.menu_right - 110, + font = CoD.TextSettings.TinyFont.Font, + alignment = LUI.Alignment.Right, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 0 + }, + show_me = { + alpha = 1 + }, + hide_me = { + alpha = 0 + } + }, + handlers = { + show_nvidia_subtitle = function ( f26_arg0, f26_arg1 ) + f26_arg0:setText( Engine.Localize( "@MENU_NVIDIA_OPTION_SUB" ) ) + f26_arg0:animateToState( "show_me", 0 ) + end + , + hide_nvidia_subtitle = function ( f27_arg0, f27_arg1 ) + f27_arg0:animateToState( "hide_me", 0 ) + end + , + show_fov_subtitle = function ( f28_arg0, f28_arg1 ) + f28_arg0:setText( Engine.Localize( "@LUA_MENU_MP_FOV_OPTION_SUB" ) ) + f28_arg0:animateToState( "show_me", 0 ) + end + , + hide_fov_subtitle = function ( f29_arg0, f29_arg1 ) + f29_arg0:animateToState( "hide_me", 0 ) + end + + } + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = BackButtonAction + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "advanced_video_vlist", advanced_video_vlist ) +LUI.MenuBuilder.registerDef( "advanced_video", advanced_video ) +LockTable( _M ) diff --git a/lui/bootscreenmargins.dec.lua b/lui/bootscreenmargins.dec.lua new file mode 100644 index 0000000..190003c --- /dev/null +++ b/lui/bootscreenmargins.dec.lua @@ -0,0 +1,285 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +DebugPrint( "Registering " .. _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + f1_local0.ContinueMessageVisible = false + if f1_arg0.properties.linkTo == "controls" then + f1_local0.ContinueMessageVisible = true + f1_arg0:dispatchEventToRoot( { + name = "continue_message_visible" + } ) + end + f1_local0.OriginalVertMargin = Engine.GetDvarFloat( "profileMenuOption_safeAreaVert" ) + f1_local0.OriginalHorzMargin = Engine.GetDvarFloat( "profileMenuOption_safeAreaHorz" ) + f1_local0.VertMarginMinAmount = SliderBounds.VertMargin.Min + f1_local0.VertMarginMaxAmount = SliderBounds.VertMargin.Max + f1_local0.VertMarginIncrement = SliderBounds.VertMargin.Step + f1_local0.HorzMarginMinAmount = SliderBounds.HorzMargin.Min + f1_local0.HorzMarginMaxAmount = SliderBounds.HorzMargin.Max + f1_local0.HorzMarginIncrement = SliderBounds.HorzMargin.Step + f1_arg0:dispatchEventToChildren( { + name = "vertical_margin_over" + } ) + f1_arg0:dispatchEventToChildren( { + name = "horizontal_margin_over" + } ) +end + +f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4, f2_arg5 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) + local f2_local1 = math.min( f2_arg2, math.max( f2_arg1, Engine.GetDvarFloat( f2_arg4 ) + f2_arg3 ) ) + Engine.SetDvarFloat( f2_arg4, f2_local1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + f2_arg0:dispatchEventToRoot( { + name = "margin_updated" + } ) + if f2_local1 <= f2_arg1 or f2_arg2 <= f2_local1 then + Engine.PlaySound( CoD.SFX.DenyAdjustSafeArea ) + else + Engine.PlaySound( CoD.SFX.AdjustSafeArea ) + end + if f2_local0.ContinueMessageVisible == false and f2_local1 ~= f2_arg5 then + f2_local0.ContinueMessageVisible = true + f2_arg0:dispatchEventToRoot( { + name = "continue_message_visible" + } ) + end +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + if f3_local0.ContinueMessageVisible then + local f3_local1 = LUI.FlowManager.RequestAddMenu + local f3_local2 = f3_arg0 + local f3_local3 = f3_arg0.properties.linkTo + local f3_local4 = f3_arg0:getParent() + f3_local1( f3_local2, f3_local3, f3_local4.properties.continueExclusive, f3_arg1.controller, true, { + focusSafeArea = true + } ) + end +end + +function boot_screen_margins() + return { + type = "UIElement", + id = "boot_screen_margins_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = f0_local0 + }, + properties = { + linkTo = "main_menu", + continueExclusive = false + }, + children = { + { + type = "margins_guide" + }, + { + type = "UIText", + id = "boot_screen_margins_title_txt_id", + properties = { + text = Engine.Localize( "@MENU_HUD_MARGINS_CAPS" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 60, + bottom = 60 + CoD.TextSettings.ExtraBigFont.Height, + left = 100, + right = 0, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "boot_screen_margins_instruction_txt1_id", + properties = { + text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 210, + bottom = 210 + CoD.TextSettings.NormalFont.Height, + left = 0, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + }, + { + type = "UIText", + id = "boot_screen_margins_instruction_txt2_id", + properties = { + text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS_DESC" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 210 + CoD.TextSettings.NormalFont.Height, + bottom = 210 + 2 * CoD.TextSettings.NormalFont.Height, + left = 0, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + }, + { + type = "UIText", + id = "boot_screen_margins_instruction_txt3_id", + properties = { + text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS_INST1" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -1.2 * CoD.TextSettings.BoldFont.Height, + bottom = 0, + left = 0, + right = 0, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + }, + { + type = "UIText", + id = "boot_screen_margins_instruction_txt4_id", + properties = { + text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS_INST2" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 1.2 * CoD.TextSettings.BoldFont.Height, + left = 0, + right = 0, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + }, + { + type = "UIButton", + id = "boot_screen_margins_continue_btn_id", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = -1 * (CoD.TextSettings.BoldFont.Height + 105), + bottom = -100, + left = -200, + right = 200, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + button_action = f0_local2, + continue_message_visible = MBh.AnimateToState( "visible", 0 ) + }, + children = { + { + type = "UIText", + properties = { + text = Engine.Localize( "@PLATFORM_UI_PRESS_TO_CONTINUE" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } + } + } + } + }, + { + type = "UIBindButton", + id = "boot_screen_margins_bind_btn_id", + handlers = { + button_up = function ( f5_arg0, f5_arg1 ) + local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 ) + f0_local1( f5_arg0, f5_local0.VertMarginMinAmount, f5_local0.VertMarginMaxAmount, f5_local0.VertMarginIncrement, "profileMenuOption_safeAreaVert", f5_local0.OriginalVertMargin ) + end + , + button_down = function ( f6_arg0, f6_arg1 ) + local f6_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f6_arg0 ) + f0_local1( f6_arg0, f6_local0.VertMarginMinAmount, f6_local0.VertMarginMaxAmount, -f6_local0.VertMarginIncrement, "profileMenuOption_safeAreaVert", f6_local0.OriginalVertMargin ) + end + , + button_left = function ( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + f0_local1( f7_arg0, f7_local0.HorzMarginMinAmount, f7_local0.HorzMarginMaxAmount, -f7_local0.HorzMarginIncrement, "profileMenuOption_safeAreaHorz", f7_local0.OriginalHorzMargin ) + end + , + button_right = function ( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + f0_local1( f8_arg0, f8_local0.HorzMarginMinAmount, f8_local0.HorzMarginMaxAmount, f8_local0.HorzMarginIncrement, "profileMenuOption_safeAreaHorz", f8_local0.OriginalHorzMargin ) + end + + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "boot_screen_margins", boot_screen_margins ) +LockTable( _M ) diff --git a/lui/buttondesctext.dec.lua b/lui/buttondesctext.dec.lua new file mode 100644 index 0000000..0bf4c95 --- /dev/null +++ b/lui/buttondesctext.dec.lua @@ -0,0 +1,75 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( "Registering " .. _NAME ) +LUI.ButtonDescText = {} +LUI.ButtonDescText.new = function ( f1_arg0, f1_arg1 ) + if not f1_arg1 then + f1_arg1 = {} + end + local f1_local0 = f1_arg1.lines or 2 + local self = LUI.UIElement.new() + self.id = "generic_button_desc_text_id" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f1_local0 * CoD.TextSettings.SmallFont.Height + } ) + self:animateToState( "default" ) + local f1_local2 = LUI.UIImage.new() + f1_local2.id = "left_bullet_point" + f1_local2:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 3, + left = 100, + height = 13, + width = 5, + alpha = 0.6 + } ) + f1_local2:animateToState( "default" ) + self:addElement( f1_local2 ) + local f1_local3 = LUI.UIMarqueeText.new() + f1_local3.id = "desc_text" + f1_local3:SetUseTextWrapping( true ) + f1_local3:SetTextHeight( CoD.TextSettings.SmallFont.Height ) + f1_local3:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.SmallFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f1_local0 * CoD.TextSettings.SmallFont.Height, + left = 111, + right = -23, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alpha = 1 + } ) + f1_local3:animateToState( "default" ) + f1_local3:registerEventHandler( "set_button_info_text", function ( element, event ) + if event.text then + element:setText( event.text ) + end + end ) + self:addElement( f1_local3 ) + return self +end + +LUI.ButtonDescText.build = function ( f3_arg0, f3_arg1, f3_arg2 ) + return LUI.ButtonDescText.new( f3_arg0, f3_arg1 ) +end + +LUI.MenuBuilder.registerType( "button_desc_text", LUI.ButtonDescText.build ) +LockTable( _M ) diff --git a/lui/buttonhelpertext.dec.lua b/lui/buttonhelpertext.dec.lua new file mode 100644 index 0000000..48ca165 --- /dev/null +++ b/lui/buttonhelpertext.dec.lua @@ -0,0 +1,686 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( "Registering " .. _NAME ) +CommonEvents = { + addBackButton = { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true, + priority = -1000 + }, + addActionButton = { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = Engine.Localize( "@MENU_CONTINUE" ), + side = "left", + clickable = true, + priority = -1000 + }, + addFriendsButton = { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@LUA_MENU_FRIENDS" ), + side = "right", + clickable = true, + width = 190, + priority = -1000 + }, + removeFriendsButton = { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "" + }, + addGameSummaryButton = { + name = "add_button_helper_text", + button_ref = "button_select", + helper_text = Engine.Localize( "@LUA_MENU_MATCH_SUMMARY" ), + side = "left", + clickable = true + }, + addAcceptButton = { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_ACCEPT" ), + side = "left", + clickable = true, + priority = -1000 + }, + addDeclineButton = { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_DECLINE" ), + side = "left", + clickable = true, + priority = -1000 + }, + addLeftButton = { + name = "add_button_helper_text", + button_ref = "button_shoulderl", + helper_text = Engine.Localize( "@LUA_MENU_PREV_PAGE" ), + side = "left", + clickable = true, + priority = -1000 + }, + addRightButton = { + name = "add_button_helper_text", + button_ref = "button_shoulderr", + helper_text = Engine.Localize( "@LUA_MENU_NEXT_PAGE" ), + side = "left", + clickable = true, + priority = -1000 + } +} +function AddHelperTextObject( f1_arg0, f1_arg1 ) + assert( f1_arg1.button_ref ) + assert( f1_arg1.helper_text ) + local f1_local0 = nil + if f1_arg1.side and f1_arg1.side == "left" then + f1_local0 = f1_arg0:getChildById( "left_button_helper_list_id" ) + else + f1_local0 = f1_arg0:getChildById( "right_button_helper_list_id" ) + end + assert( f1_local0 ) + local f1_local1 = f1_arg1.button_ref .. "_id" + local f1_local2 = f1_local0:getChildById( f1_local1 ) + if f1_local2 and f1_arg1.helper_text ~= f1_local2.currentText then + f1_local2:close() + f1_local2 = nil + end + if not f1_local2 and f1_arg1.helper_text ~= "" then + local f1_local3 = helper_text_item( ButtonMap[f1_arg1.button_ref], f1_arg1.helper_text, f1_arg1.button_ref2 and ButtonMap[f1_arg1.button_ref2] or nil, f1_arg1.width, f1_arg1.priority, f1_arg1.ignorePopups or false, f1_arg1.customEvent or nil, f1_arg1.customEventTarget or nil, f1_arg1.useAnimIntro or nil, f1_arg1.flash or nil ) + f1_local3.id = f1_local1 + if f1_arg1.clickable == true and ButtonMap[f1_arg1.button_ref] then + f1_local3.triggers_event = f1_arg1.button_ref + end + if Engine.IsConsoleGame() then + f1_local3:makeNotFocusable() + end + f1_local0:addElement( f1_local3 ) + end + return true +end + +function ClearHelperTextObjects( f2_arg0, f2_arg1 ) + if not f2_arg1.side then + DebugPrint( "WARNING: clear_button_helper_text event sent without specifying the desired side. Ignoring..." ) + return + end + local f2_local0 = nil + if f2_arg1.side == "left" then + f2_local0 = f2_arg0:getChildById( "left_button_helper_list_id" ) + else + f2_local0 = f2_arg0:getChildById( "right_button_helper_list_id" ) + end + assert( f2_local0 ) + f2_local0:closeChildren() + return true +end + +function sendButtonEvent( f3_arg0, f3_arg1 ) + if f3_arg0.triggers_event and f3_arg1.mouse == true then + local f3_local0 = { + name = "gamepad_button", + immediate = true, + down = true + } + assert( ButtonMap[f3_arg0.triggers_event].raw_button ) + f3_local0.button = ButtonMap[f3_arg0.triggers_event].raw_button + f3_local0.controller = f3_arg1.controller + f3_arg0:dispatchEventToRoot( f3_local0 ) + end +end + +function sendCustomEvent( f4_arg0, f4_arg1 ) + customEvent = f4_arg1.customEvent + eventTarget = f4_arg1.eventTarget + eventTarget:processEvent( customEvent ) +end + +function getButtonPosition( f5_arg0, f5_arg1, f5_arg2 ) + local f5_local0 = Engine.IsConsoleGame() + if not f5_local0 then + f5_local0 = Engine.IsGamepadEnabled() == 1 + end + local f5_local1 + if f5_local0 then + f5_local1 = 32 + if not f5_local1 then + + else + local f5_local2, f5_local3 = nil + if f5_arg0 then + if f5_local0 and f5_arg0.string then + f5_local2 = Engine.Localize( f5_arg0.string ) .. " " + if f5_arg1 and f5_arg1.string then + f5_local3 = " " .. Engine.Localize( f5_arg1.string ) + end + elseif f5_arg0.keyboard_string then + f5_local2 = Engine.Localize( f5_arg0.keyboard_string ) .. " " + if f5_arg1 and f5_arg1.keyboard_string then + f5_local3 = " " .. Engine.Localize( f5_arg1.keyboard_string ) + end + end + end + return f5_local2, f5_local3, f5_local1 + end + end + f5_local1 = f5_arg2.Height +end + +function getButtonWidth( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5, f6_arg6, f6_arg7 ) + local f6_local0 = f6_arg7 + local f6_local1 = 0 + local f6_local2 = 0 + local f6_local3 = 0 + local f6_local4, f6_local5, f6_local6, f6_local7 = nil + if f6_arg0 then + local f6_local8, f6_local9, f6_local10, f6_local11 = GetTextDimensions( f6_arg3, f6_arg6.Font, f6_arg5 ) + f6_local7 = f6_local11 + f6_local6 = f6_local10 + f6_local5 = f6_local9 + f6_local1 = f6_local6 - f6_local8 + end + local f6_local8, f6_local9, f6_local10, f6_local11 = GetTextDimensions( f6_arg2, f6_arg6.Font, f6_arg6.Height ) + f6_local7 = f6_local11 + f6_local6 = f6_local10 + f6_local5 = f6_local9 + f6_local3 = f6_local6 - f6_local8 + if f6_arg1 then + f6_local8, f6_local9, f6_local10, f6_local11 = GetTextDimensions( f6_arg4, f6_arg6.Font, f6_arg5 ) + f6_local7 = f6_local11 + f6_local6 = f6_local10 + f6_local5 = f6_local9 + f6_local2 = f6_local6 - f6_local8 + end + if not f6_arg7 then + f6_local0 = 20 + f6_local1 + f6_local3 + f6_local2 + end + return f6_local0, f6_local1, f6_local2, f6_local3 +end + +function helper_text_item( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_arg4, f7_arg5, f7_arg6, f7_arg7, f7_arg8, f7_arg9 ) + local f7_local0 = CoD.TextSettings.SmallFont + local f7_local1, f7_local2, f7_local3 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 ) + local f7_local4, f7_local5, f7_local6, f7_local7 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f7_local1, f7_local2, f7_local3, f7_local0, f7_arg3 ) + local self = LUI.UIButton.new() + self.id = "helper_text_item" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f7_local4, + top = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + self.m_disableNavigation = true + self.m_requireFocusType = FocusType.MouseOver + if f7_arg6 then + assert( f7_arg7 ) + self:registerEventHandler( "button_action", function ( element, event ) + f7_arg7:processEvent( f7_arg6 ) + end ) + else + self:registerEventHandler( "button_action", sendButtonEvent ) + end + self:registerEventHandler( "rebind", function ( element, event ) + if event.buttonLeft and event.buttonLeft == f7_arg0 then + element.m_ignoreMouseFocus = nil + end + end ) + self:registerEventHandler( "refresh_button_helper", function ( element, event ) + local f10_local0, f10_local1, f10_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 ) + local f10_local3 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f10_local0, f10_local1, f10_local2, f7_local0, f7_arg3 ) + element:registerAnimationState( "refreshed", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f7_local4, + top = 0, + bottom = 0 + } ) + element:animateToState( "refreshed" ) + end ) + if f7_arg5 then + self:registerEventHandler( "popup_active", nil ) + self:registerEventHandler( "popup_inactive", nil ) + end + if f7_local1 then + local f7_local9 = LUI.UIText.new() + f7_local9.id = "left" + f7_local9:setText( f7_local1 ) + f7_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + font = f7_local0.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -f7_local3 / 2, + bottom = f7_local3 / 2 + } ) ) + f7_local9:animateToState( "default" ) + f7_local9:registerEventHandler( "refresh_button_helper", function ( element, event ) + local f11_local0, f11_local1, f11_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 ) + element:setText( f11_local0 ) + element:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + font = f7_local0.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -f11_local2 / 2, + bottom = f11_local2 / 2 + } ) ) + element:animateToState( "default" ) + end ) + self:addElement( f7_local9 ) + end + local f7_local9 = LUI.UIText.new() + f7_local9.properties = {} + f7_local9.id = "helper_text_text" + f7_local9:setText( f7_arg1 ) + f7_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.cac_label_text, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f7_local5, + right = 0, + top = -f7_local0.Height / 2, + bottom = f7_local0.Height / 2, + font = f7_local0.Font, + alignment = LUI.Alignment.Left + } ) ) + f7_local9:registerAnimationState( "anim_intro", CoD.ColorizeState( Colors.cac_label_text, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 0, + font = f7_local0.Font, + alignment = LUI.Alignment.Left + } ) ) + f7_local9:registerAnimationState( "over", CoD.ColorizeState( Colors.white ) ) + f7_local9.properties.animLoop = MBh.AnimateLoop( { + { + "default", + 500 + }, + { + "flash", + 500 + } + } ) + if f7_arg8 then + f7_local9:animateToState( "anim_intro" ) + else + f7_local9:animateToState( "default" ) + end + if f7_arg9 then + f7_local9:registerAnimationState( "flash", CoD.ColorizeState( Colors.frontend_hilite ) ) + f7_local9.properties:animLoop() + end + local f7_local10 = f7_local9 + local f7_local11 = f7_local9.registerEventHandler + local f7_local12 = "button_up" + local f7_local13 + if f7_arg9 then + f7_local13 = f7_local9.properties.animLoop + if not f7_local13 then + + else + f7_local11( f7_local10, f7_local12, f7_local13 ) + f7_local9:registerEventHandler( "button_over", MBh.AnimateToState( "over" ) ) + f7_local9:registerEventHandler( "refresh_button_helper", function ( element, event ) + local f12_local0, f12_local1, f12_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 ) + local f12_local3, f12_local4 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f12_local0, f12_local1, f12_local2, f7_local0, f7_arg3 ) + element:registerAnimationState( "default", CoD.ColorizeState( Colors.cac_label_text, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f12_local4, + right = 0, + top = -f7_local0.Height / 2, + bottom = f7_local0.Height / 2, + font = f7_local0.Font, + alignment = LUI.Alignment.Left + } ) ) + element:animateToState( "default" ) + end ) + self.currentText = f7_arg1 + self:addElement( f7_local9 ) + if f7_local2 then + f7_local11 = LUI.UIText.new() + f7_local11.id = "right" + f7_local11:setText( f7_local2 ) + f7_local11:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + font = f7_local0.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f7_local5 + f7_local7, + right = 0, + top = -f7_local3 / 2, + bottom = f7_local3 / 2 + } ) ) + f7_local11:registerEventHandler( "refresh_button_helper", function ( element, event ) + local f13_local0, f13_local1, f13_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 ) + local f13_local3, f13_local4 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f13_local0, f13_local1, f13_local2, f7_local0, f7_arg3 ) + element:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + font = f7_local0.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f13_local4 + f7_local7, + right = 0, + top = -f13_local2 / 2, + bottom = f13_local2 / 2 + } ) ) + element:animateToState( "default" ) + end ) + f7_local11:animateToState( "default" ) + self:addElement( f7_local11 ) + end + if f7_arg4 then + self:setPriority( f7_arg4 ) + end + return self + end + end + f7_local13 = MBh.AnimateToState( "default" ) +end + +function button_helper_text_main() + return { + type = "UIElement", + id = "button_helper_text_main_id", + properties = { + left_inset = 100, + right_inset = -75, + top_margin = GenericFooterDims.TopMargin_WithBackground, + bottom_margin = -35, + height = GenericFooterDims.Height, + spacing = 12, + background_alpha = 1, + hideAlienBar = false + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = MBh.Property( "top_margin" ), + bottom = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + show_button_helper_text = MBh.AnimateToState( "default" ), + hide_button_helper_text = MBh.AnimateToState( "hidden" ) + }, + children = { + { + type = "UIImage", + id = "black_bar", + states = { + default = { + leftAnchor = true, + topAnchor = false, + rightAnchor = true, + bottomAnchor = true, + left = 0, + top = 0, + right = 0, + height = 300, + red = 0, + green = 0, + blue = 0, + alpha = MBh.Property( "background_alpha" ), + material = RegisterMaterial( "white" ) + } + } + }, + { + type = "UIImage", + id = "button_helper_background_id", + properties = { + background_alpha = MBh.Property( "background_alpha" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -25, + height = 128, + left = 0, + right = 0, + material = RegisterMaterial( "bkgd_title_bar" ), + zRot = 180, + alpha = MBh.Property( "background_alpha" ) + } + } + }, + { + type = "UIImage", + id = "button_helper_background_alien_id", + properties = { + hideAlienBar = MBh.Property( "hideAlienBar" ), + background_alpha = MBh.Property( "background_alpha" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -8, + bottom = 22, + left = 0, + right = 0, + material = Engine.IsAliensMode() and RegisterMaterial( "box_alien_header_footer" ) or RegisterMaterial( "white" ), + alpha = 0 + }, + show = { + alpha = MBh.Property( "background_alpha" ) + } + }, + handlers = { + menu_create = function ( f15_arg0, f15_arg1 ) + if Engine.IsAliensMode() and not f15_arg0.properties.hideAlienBar then + f15_arg0:animateToState( "show", 0 ) + end + end + + } + }, + { + type = "UIText", + id = "build_number_text", + properties = { + text = Engine.GetBuildNumber(), + background_alpha = MBh.Property( "background_alpha" ) + }, + states = { + default = CoD.ColorizeState( Colors.build_number, { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = -70, + bottom = -22, + height = CoD.TextSettings.TinyFont.Height, + font = CoD.TextSettings.TinyFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0 + } ), + visible = { + alpha = MBh.Property( "background_alpha" ) + } + }, + handlers = { + menu_create = function ( f16_arg0, f16_arg1 ) + if Engine.InFrontend() and Engine.IsMultiplayer() then + f16_arg0:animateToState( "visible" ) + end + end + + } + }, + { + type = "UIText", + id = "ds_text", + properties = { + text = "", + background_alpha = MBh.Property( "background_alpha" ) + }, + states = { + default = CoD.ColorizeState( Colors.build_number, { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = -70, + bottom = -10, + height = CoD.TextSettings.TinyFont.Height, + font = CoD.TextSettings.TinyFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0 + } ), + visible = { + alpha = MBh.Property( "background_alpha" ) + } + }, + handlers = { + menu_create = MBh.EmitEvent( "update_ds_text" ), + update_ds_text = function ( f17_arg0, f17_arg1 ) + if Engine.GetDvarBool( "ds_info_enable" ) then + f17_arg0:animateToState( "visible" ) + f17_arg0:setText( Engine.GetDvarString( "ds_info" ) or "" ) + else + f17_arg0:animateToState( "default" ) + end + end + + }, + children = { + { + type = "UITimer", + id = "ds_text_refresh_timer", + properties = { + event = { + name = "update_ds_text" + }, + interval = 1000 + } + } + } + }, + { + type = "UIElement", + id = "container", + properties = { + height = MBh.Property( "height" ), + spacing = MBh.Property( "spacing" ), + left_inset = MBh.Property( "left_inset" ), + right_inset = MBh.Property( "right_inset" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 10, + height = MBh.Property( "height" ) + } + }, + children = { + { + type = "UIHorizontalList", + id = "left_button_helper_list_id", + properties = { + spacing = MBh.Property( "spacing" ), + left_inset = MBh.Property( "left_inset" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = MBh.Property( "left_inset" ), + right = 0, + top = 0, + bottom = 0, + alignment = LUI.Alignment.Left, + spacing = MBh.Property( "spacing" ) + } + } + }, + { + type = "UIHorizontalList", + id = "right_button_helper_list_id", + properties = { + spacing = MBh.Property( "spacing" ), + right_inset = MBh.Property( "right_inset" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = MBh.Property( "right_inset" ), + top = 0, + bottom = 0, + alignment = LUI.Alignment.Right, + spacing = MBh.Property( "spacing" ) + } + } + } + }, + handlers = { + add_button_helper_text = AddHelperTextObject, + clear_button_helper_text = ClearHelperTextObjects + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "button_helper_text_main", button_helper_text_main ) +LockTable( _M ) diff --git a/lui/chatcontrols.dec.lua b/lui/chatcontrols.dec.lua new file mode 100644 index 0000000..8fda3f1 --- /dev/null +++ b/lui/chatcontrols.dec.lua @@ -0,0 +1,159 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetDisplay( f1_arg0 ) + return Engine.GetBinding( f1_arg0 ) +end + +function bindKey( f2_arg0 ) + Engine.BindKey( f2_arg0 ) +end + +function OptionsWindowRefresh( f3_arg0, f3_arg1 ) + if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then + f3_arg0:processEvent( { + name = "menu_refresh" + } ) + f3_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function ControlBindFactory( f5_arg0, f5_arg1 ) + return { + type = "UIGenericButton", + id = "bind_" .. f5_arg1, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f5_arg0 ), + button_display_func = function ( f6_arg0, f6_arg1 ) + return GetDisplay( f5_arg1 ) + end + , + button_action_func = function ( f7_arg0, f7_arg1 ) + Engine.BindKey( f5_arg1 ) + OptionsWindowTriggerRefresh( f7_arg0, f7_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionsFeeder( f8_arg0 ) + local f8_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_TEXT_CHAT", "chatmodepublic" ) + f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_TEXT_TEAM_CHAT", "chatmodeteam" ) + f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_VOICE_CHAT_BUTTON", "+talk" ) + return f8_local0 +end + +function OptionsMainCreate( f9_arg0, f9_arg1 ) + f9_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function chat_controls_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function chat_controls() + return { + type = "UIElement", + id = "chat_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = function ( f12_arg0, f12_arg1 ) + Engine.Exec( "updategamerprofile" ) + end + + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_CHAT" ) + } + }, + { + type = "chat_controls_vlist", + id = "chat_controls_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "chat_controls_vlist", chat_controls_vlist ) +LUI.MenuBuilder.registerDef( "chat_controls", chat_controls ) +LockTable( _M ) diff --git a/lui/cod.dec.lua b/lui/cod.dec.lua new file mode 100644 index 0000000..563b2ff --- /dev/null +++ b/lui/cod.dec.lua @@ -0,0 +1,1558 @@ +local f0_local0 = false +local f0_local1 = false +Memory = { + InGame = { + lowFreeBytes = 307200 + }, + Frontend = { + lowFreeBytes = 1048576 + }, + CheckLow = function () + local f1_local0 = Engine.GetBytesFree() + local f1_local1 = Memory.InGame.lowFreeBytes + if Engine.InFrontend() then + f1_local1 = Memory.Frontend.lowFreeBytes + end + if f1_local0 < f1_local1 then + DebugPrint( "LUI: Low on memory, running GC now. BytesFree = " .. Engine.GetBytesFree() ) + collectgarbage( "collect" ) + end + end +} +MaxLocalClients = 2 +ScreenResolution = { + HD = { + width = Engine.GetDisplayWidth() / Engine.GetDisplayHeight() * 720, + height = 720, + name = "HD" + } +} +currentScreenResolution = "HD" +Teams = { + free = 0, + axis = 1, + allies = 2, + spectator = 3 +} +otherTeamLookup = { + 2, + 1 +} +spectatorFakeTeam = 2 +font_smallFont = "fonts/smallFont" +font_normalFont = "fonts/normalFont" +font_bigFont = "fonts/bigFont" +font_extraBigFont = "fonts/extraBigFont" +font_boldFont = "fonts/boldFont" +font_consoleFont = "fonts/consoleFont" +font_objectiveFont = "fonts/objectiveFont" +font_hudIW6SmallFont = "fonts/hudSmallFont" +font_hudIW6NormalFont = "fonts/hudNormalFont" +font_hudIW6BigFont = "fonts/hudBigFont" +font_hudEuroSmallFont = "fonts/smallFont" +font_hudEuroNormalFont = "fonts/normalFont" +font_hudEuroBigFont = "fonts/bigFont" +font_hudDigitalFont20 = "fonts/hudDigitalFont20" +font_hudDigitalFont25 = "fonts/hudDigitalFont25" +font_hudDigitalFont30 = "fonts/hudDigitalFont30" +font_hudDigitalFont40 = "fonts/hudDigitalFont40" +odayaka = 0 +if Engine.GetCurrentLanguage() == 10 then + odayaka = 0 +end +CoD = { + TextSettings = { + TinyFont = { + Font = RegisterFont( font_smallFont ), + Height = 15 + odayaka + }, + SmallFont = { + Font = RegisterFont( font_normalFont ), + Height = 21 + odayaka + }, + NormalFont = { + Font = RegisterFont( font_normalFont ), + Height = 21 + odayaka + }, + BigFont = { + Font = RegisterFont( font_bigFont ), + Height = 28 + odayaka, + MaxHeight = 50 + }, + ExtraBigFont = { + Font = RegisterFont( font_extraBigFont ), + Height = 28 + odayaka + }, + BoldFont = { + Font = RegisterFont( font_boldFont ), + Height = 21 + odayaka + }, + HudIW6TinyFont = { + Font = RegisterFont( font_hudIW6SmallFont ), + Height = 15 + }, + HudIW6SmallFont = { + Font = RegisterFont( font_hudIW6SmallFont ), + Height = 20 + }, + HudIW6NormalFont = { + Font = RegisterFont( font_hudIW6NormalFont ), + Height = 25 + }, + HudIW6BigFont = { + Font = RegisterFont( font_hudIW6BigFont ), + Height = 30 + }, + HudIW6ExtraBigFont = { + Font = RegisterFont( font_hudIW6BigFont ), + Height = 40 + }, + HudEuroConRegTinyFont = { + Font = RegisterFont( font_hudEuroSmallFont ), + Height = 15 + }, + HudEuroMedTinyFont = { + Font = RegisterFont( font_hudEuroNormalFont ), + Height = 15 + }, + HudEuroConRegSmallFont = { + Font = RegisterFont( font_hudEuroSmallFont ), + Height = 20 + }, + HudEuroMedSmallFont = { + Font = RegisterFont( font_hudEuroNormalFont ), + Height = 20 + }, + HudEuroNormalFont = { + Font = RegisterFont( font_hudEuroNormalFont ), + Height = 25 + }, + HudEuroBigFont = { + Font = RegisterFont( font_hudEuroBigFont ), + Height = 30 + }, + HudEuroExtraBigFont = { + Font = RegisterFont( font_hudEuroBigFont ), + Height = 40 + }, + HudDigitalSmallFont = { + Font = RegisterFont( font_hudDigitalFont20 ), + Height = 20 + }, + HudDigitalNormalFont = { + Font = RegisterFont( font_hudDigitalFont25 ), + Height = 26 + }, + HudDigitalBigFont = { + Font = RegisterFont( font_hudDigitalFont30 ), + Height = 30 + }, + HudDigitalExtraBigFont = { + Font = RegisterFont( font_hudDigitalFont40 ), + Height = 40 + } + }, + TextStyle = { + None = 0, + Shadowed = 3, + ShadowedMore = 6, + Outlined = 7, + OutlinedMore = 8, + ForceUpperCase = 9, + ForceLowerCase = 10, + Monospace = 128, + MonospaceShadow = 132 + }, + MaxSafeguardPlayers = 4, + PlayMode = { + None = 0, + SP = 1, + Core = 2, + Aliens = 3, + SquadVsSquad = 4, + Count = 5 + }, + Ownerdraw = { + CGSpectatorControls = 61, + CGChangeZoomHint = 70, + CGHoldBreathHint = 71, + CGCursorHint = 72, + CGToggleThermalHint = 76, + CGToggleHybridHint = 77, + CGMantleHint = 80, + CGDeadQuote = 97, + CGMissionObjectiveHeader = 99, + CGMissionObjectiveList = 100, + CGMissionObjectiveBackdrop = 101, + CGSaving = 111, + CGLowHealthOverlay = 112, + CGInvalidCmdHint = 113, + CGVehicleReticle = 200, + CGHudTargetsVehicle = 201, + UIRecordLevel = 365, + UIIOTD = 387 + }, + OwnerdrawAlignment = { + None = 0, + TextCenter = 2, + TextTopLeft = 1 + } +} +if Engine.InFrontend() then + if not Engine.IsXbox360() then + CoD.Music = { + MainSPMusic = "music_mainmenu", + MainMPMusic = "music_mainmenu_mp", + MainSquadMusic = "music_mainmenu_squad", + MainExtinctMusic = "music_mainmenu_extinct", + MainExtinctMusic_DLC1 = "music_mainmenu_extinct_dlc1", + MainExtinctMusic_DLC2 = "music_mainmenu_extinct_dlc2", + MainExtinctMusic_DLC3 = "music_mainmenu_extinct_dlc3", + MainExtinctMusic_DLC4 = "music_mainmenu_extinct_dlc4", + MainExtinctIntelMusic = "music_mainmenu_extinct_intel", + MainRorkeMusic = "music_mainmenu_rorke_files" + } + else + CoD.Music = { + MainSPMusic = "music_mainmenu", + MainMPMusic = "music_mainmenu_mp", + MainSquadMusic = "music_mainmenu_squad", + MainExtinctMusic = "music_mainmenu_extinct", + MainExtinctMusic_DLC1 = "music_mainmenu_extinct_xenon", + MainExtinctMusic_DLC2 = "music_mainmenu_extinct_xenon", + MainExtinctMusic_DLC3 = "music_mainmenu_extinct_xenon", + MainExtinctMusic_DLC4 = "music_mainmenu_extinct_xenon", + MainExtinctIntelMusic = "music_mainmenu_extinct_intel", + MainRorkeMusic = "music_mainmenu_rorke_files" + } + end +end +CoD.SFX = { + OtherAdjust = "ui_other_adjust", + MouseOver = "ui_hilite", + MouseClick = "ui_select_confirm", + SelectBack = "ui_select_back", + AdjustSafeArea = "ui_screen_adjust", + DenyAdjustSafeArea = "ui_screen_edge_deny", + MPLobbyPlayerJoin = "ui_mp_player_join_lobby", + MPLobbyPlayerExit = "ui_mp_player_leave_lobby", + ChangeScreen = "ui_screen_change", + AdjustSlider = "ui_slide_adjust", + CharacterSlide = "ui_character_slide", + SPMinimap = "ui_sp_minimap", + SubMenuMouseOver = "ui_hilite_submenu", + CacSelectAbility = "ui_mp_ability_select", + CacDeselectAbility = "ui_mp_ability_deselect", + CacSelectStrikePackage = "ui_mp_package_select", + CacDeselectStrikePackage = "ui_mp_package_deselect", + CacSpendPoints = "ui_points_spent", + DenySelect = "ui_select_deny", + UIKinectCommandGood = "ui_kinect_command_good", + UIKinectCommandBad = "ui_kinect_command_bad", + CacSetAILoadout = "ui_mp_ability_select", + RestrictClass = "ui_select_confirm", + XPTick = "mp_experience_tick" +} +CoD.KeyboardInputTypes = { + Normal = 0, + Email = 1, + Password = 2 +} +if Engine.InFrontend() then + CoD.AntiCheat = { + Ban = { + FEATURE_BAN_LIVE_MP = 1, + FEATURE_BAN_LIVE_EXTINCTION = 2, + FEATURE_BAN_LEADERBOARD_WRITE_MP = 3, + FEATURE_BAN_LEADERBOARD_WRITE_EXTINCTION = 4, + FEATURE_BAN_MP_SPLITSCREEN = 5, + FEATURE_BAN_CLAN_TAGS = 6, + FEATURE_BAN_VOICE_CHAT = 7, + FEATURE_BAN_PRESTIGE = 8, + FEATURE_BAN_BOT_GAMES = 9, + FEATURE_BAN_SEARCH_DEDICATED_SERVER = 10, + FEATURE_BAN_ALLOCATE_DEDICATED_SERVER = 11, + FEATURE_BAN_HOSTING = 12, + FEATURE_BAN_PRESTIGE_EXTRAS = 13 + } + } +end +CoD.PlayOnlineFailure = { + OPFR_XBOXLIVE_MPNOTALLOWED = 8 +} +CoD.RequiredDLCError = { + COMPATIBILITY_ERROR_NONE = 0, + COMPATIBILITY_ERROR_DISK_FULL = 1, + COMPATIBILITY_ERROR_CORRUPTED = 2, + COMPATIBILITY_ERROR_CANCELED = 3, + COMPATIBILITY_ERROR_UNKNOWN = 4 +} +CoD.CompassType = { + Partial = 0, + Full = 1 +} +GenericMenuDims = { + menu_left = 0, + menu_right_narrow = 390, + menu_right = 490, + menu_right_med = 525, + menu_right_more = 565, + menu_right_wide = 640, + menu_top = 115, + menu_top_low = 215, + menu_top_scroll = 95, + menu_bottom = 600, + menu_bottom_scroll = 542, + menu_bottom_tall = 700 +} +GenericTitleBarDims = { + TitleBarHeight = 32, + TitleBarLCapWidth = 32, + TitleBarRCapWidth = 4 +} +GenericFooterDims = { + Height = 36, + BuildNumberHeight = 35, + TopMargin_WithBackground = -80, + TopMargin_WithoutBackground = -48 +} +DialogPopupDims = { + Width = 400, + Height = 85 +} +DialogWidgetDims = { + Width = 30, + Height = 30 +} +GenericButtonDims = { + button_height = 27, + button_width = 500, + pad_button_width = 35 +} +OptionsListDims = { + menu_top = 100, + menu_bottom = 609, + menu_left = 0, + menu_right = 600 +} +local f0_local2 = { + [0] = "LANGUAGE_ENGLISH" +} +local f0_local3 = "LANGUAGE_FRENCH" +local f0_local4 = "LANGUAGE_GERMAN" +local f0_local5 = "LANGUAGE_ITALIAN" +local f0_local6 = "LANGUAGE_SPANISH" +local f0_local7 = "LANGUAGE_BRITISH" +local f0_local8 = "LANGUAGE_RUSSIAN" +local f0_local9 = "LANGUAGE_POLISH" +local f0_local10 = "LANGUAGE_KOREAN" +local f0_local11 = "LANGUAGE_TAIWANESE" +local f0_local12 = "LANGUAGE_JAPANESE" +local f0_local13 = "LANGUAGE_CHINESE" +local f0_local14 = "LANGUAGE_THAI" +local f0_local15 = "LANGUAGE_CZECH" +local f0_local16 = "LANGUAGE_SPANISHNA" +local f0_local17 = "LANGUAGE_PORTUGUESE" +local f0_local18 = "MAX_LANGUAGES" +f0_local2[1] = f0_local3 +f0_local2[2] = f0_local4 +f0_local2[3] = f0_local5 +f0_local2[4] = f0_local6 +f0_local2[5] = f0_local7 +f0_local2[6] = f0_local8 +f0_local2[7] = f0_local9 +f0_local2[8] = f0_local10 +f0_local2[9] = f0_local11 +f0_local2[10] = f0_local12 +f0_local2[11] = f0_local13 +f0_local2[12] = f0_local14 +f0_local2[13] = f0_local15 +f0_local2[14] = f0_local16 +f0_local2[15] = f0_local17 +f0_local2[16] = f0_local18 +Languages = f0_local2 +ButtonMap = { + button_action = { + string = "@LUA_MENU_PAD_PRIMARY_BUTTON", + keyboard_string = "@PLATFORM_KB_PRIMARY_BUTTON", + raw_button = "primary" + }, + button_secondary = { + string = "@LUA_MENU_PAD_SECONDARY_BUTTON", + keyboard_string = "@PLATFORM_KB_SECONDARY_BUTTON", + raw_button = "secondary" + }, + button_alt1 = { + string = "@LUA_MENU_PAD_ALT1_BUTTON", + keyboard_string = "@PLATFORM_KB_ALT1_BUTTON", + raw_button = "alt1" + }, + button_alt2 = { + string = "@LUA_MENU_PAD_ALT2_BUTTON", + keyboard_string = "@PLATFORM_KB_ALT2_BUTTON", + raw_button = "alt2" + }, + button_right_trigger = { + string = "@LUA_MENU_PAD_RIGHT_TRIGGER_BUTTON", + keyboard_string = "@PLATFORM_KB_RIGHT_TRIGGER_BUTTON", + raw_button = "right_trigger" + }, + button_left_trigger = { + string = "@LUA_MENU_PAD_LEFT_TRIGGER_BUTTON", + keyboard_string = "@PLATFORM_KB_LEFT_TRIGGER_BUTTON", + raw_button = "left_trigger" + }, + button_shoulderr = { + string = "@LUA_MENU_PAD_RIGHT_SHOULDER_BUTTON", + keyboard_string = "@PLATFORM_KB_RIGHT_SHOULDER_BUTTON", + raw_button = "shoulderr" + }, + button_shoulderl = { + string = "@LUA_MENU_PAD_LEFT_SHOULDER_BUTTON", + keyboard_string = "@PLATFORM_KB_LEFT_SHOULDER_BUTTON", + raw_button = "shoulderl" + }, + button_select = { + string = "@LUA_MENU_PAD_BACK_BUTTON", + keyboard_string = "@PLATFORM_KB_BACK_BUTTON", + raw_button = "select" + }, + button_start = { + string = "@LUA_MENU_PAD_START_BUTTON", + keyboard_string = "@PLATFORM_KB_START_BUTTON", + raw_button = "start" + }, + button_dpad_up = { + string = "@LUA_MENU_PAD_DPAD_UP_BUTTON", + keyboard_string = "@PLATFORM_KB_DPAD_UP_BUTTON", + raw_button = "dpad_up" + }, + button_dpad_down = { + string = "@LUA_MENU_PAD_DPAD_DOWN_BUTTON", + keyboard_string = "@PLATFORM_KB_DPAD_DOWN_BUTTON", + raw_button = "dpad_down" + }, + button_dpad_left = { + string = "@LUA_MENU_MP_PAD_DPAD_LEFT_BUTTON", + keyboard_string = "@PLATFORM_KB_DPAD_LEFT_BUTTON", + raw_button = "dpad_left" + }, + button_dpad_right = { + string = "@LUA_MENU_MP_PAD_DPAD_RIGHT_BUTTON", + keyboard_string = "@PLATFORM_KB_DPAD_RIGHT_BUTTON", + raw_button = "dpad_right" + }, + button_l3 = { + string = "@LUA_MENU_PAD_L3_BUTTON", + keyboard_string = "@PLATFORM_KB_L3_BUTTON", + raw_button = "l3" + }, + button_page_up = { + string = "@PLATFORM_PAGE_UP", + keyboard_string = "@PLATFORM_KB_PAGE_UP_BUTTON", + raw_button = "page_up" + }, + button_page_down = { + string = "@PLATFORM_PAGE_DOWN", + keyboard_string = "@PLATFORM_KB_PAGE_DOWN_BUTTON", + raw_button = "page_down" + }, + button_home = { + string = "@PLATFORM_KB_HOME_BUTTON", + keyboard_string = "@PLATFORM_KB_HOME_BUTTON", + raw_button = "home" + }, + button_ins = { + string = "@PLATFORM_KB_INS_BUTTON", + keyboard_string = "@PLATFORM_KB_INS_BUTTON", + raw_button = "ins" + }, + button_del = { + string = "@PLATFORM_KB_DEL_BUTTON", + keyboard_string = "@PLATFORM_KB_DEL_BUTTON", + raw_button = "del" + } +} +ButtonQualifiers = { + Gamepad = "gamepad", + DPad = "dpad", + Keyboard = "keyboard", + Mousewheel = "mousewheel" +} +Colors = { + white = { + r = 1, + g = 1, + b = 1 + }, + black = { + r = 0, + g = 0, + b = 0 + }, + new_icon_green = { + r = 0.38, + g = 0.65, + b = 0.31 + }, + even_stripe = { + r = 0, + g = 0, + b = 0, + a = 0 + }, + frontend_hilite = { + r = 0.9, + g = 0.78, + b = 0.1 + }, + alien_frontend_hilite = { + r = 1, + g = 0.24, + b = 0.04 + }, + window_title_text_color = { + r = 0.8, + g = 0.8, + b = 0.8 + }, + window_border_color = { + r = 0.4, + g = 0.4, + b = 0.4 + }, + orange = { + r = 0.9, + g = 0.6, + b = 0 + }, + cyan = { + r = 0.35, + g = 0.7, + b = 0.9 + }, + blue = { + r = 0, + g = 0.45, + b = 0.7 + }, + seafoam_blue = { + r = 0.45, + g = 0.8, + b = 0.78 + }, + very_dark_cyan = { + r = 0.07, + g = 0.1, + b = 0.11 + }, + yellow = { + r = 0.9, + g = 0.78, + b = 0.1 + }, + red = { + r = 1, + g = 0, + b = 0 + }, + grey_14 = { + r = 0.14, + g = 0.14, + b = 0.14 + }, + grey_2 = { + r = 0.2, + g = 0.2, + b = 0.2 + }, + grey_22 = { + r = 0.22, + g = 0.22, + b = 0.22 + }, + grey_3 = { + r = 0.3, + g = 0.3, + b = 0.3 + }, + grey_4 = { + r = 0.4, + g = 0.4, + b = 0.4 + }, + grey_5 = { + r = 0.5, + g = 0.5, + b = 0.5 + }, + md_grey = { + r = 0.75, + g = 0.75, + b = 0.75 + }, + light_grey = { + r = 0.85, + g = 0.85, + b = 0.85 + }, + cac_label_text = { + r = 0.5, + g = 0.5, + b = 0.5 + }, + cac_ability_text = { + r = 0.8, + g = 0.8, + b = 0.8 + }, + cac_focus_text = { + r = 0, + g = 0, + b = 0 + }, + cac_button = { + r = 0.2, + g = 0.2, + b = 0.2 + }, + cac_border = { + r = 0.5, + g = 0.5, + b = 0.5 + }, + cac_weapon_meter_main = { + r = 0.8, + g = 0.8, + b = 0.8 + }, + cac_weapon_meter_better = { + r = 0.36, + g = 0.66, + b = 0.2 + }, + cac_weapon_meter_better_dark = { + r = 0.22, + g = 0.42, + b = 0.12 + }, + cac_weapon_meter_worse = { + r = 0.88, + g = 0.26, + b = 0.26 + }, + cac_weapon_meter_worse_dark = { + r = 0.55, + g = 0.16, + b = 0.16 + }, + build_number = { + r = 0.75, + g = 0.75, + b = 0.75 + }, + cac_sub_popup_text = { + r = 0.55, + g = 0.55, + b = 0.55 + }, + cac_ability = { + bg = { + r = 0.85, + g = 0.85, + b = 0.85 + }, + ability_speed = { + r = 0.76, + g = 0.25, + b = 0.13 + }, + ability_handling = { + r = 0.4, + g = 0.49, + b = 0.52 + }, + ability_stealth = { + r = 0.38, + g = 0.28, + b = 0.52 + }, + ability_awareness = { + r = 0.76, + g = 0.53, + b = 0.16 + }, + ability_resistance = { + r = 0.47, + g = 0.58, + b = 0.3 + }, + ability_equipment = { + r = 0.12, + g = 0.31, + b = 0.62 + }, + ability_elite = { + r = 0.5, + g = 0.5, + b = 0.5 + } + }, + cac_specialist_bonus = { + r = 0.35, + g = 0.7, + b = 0.9 + }, + cac_attach_shade = { + r = 0.1, + g = 0.1, + b = 0.1 + }, + cac_performance_header = { + r = 0.7, + g = 0.7, + b = 0.7 + }, + primary_text_color = { + r = 0.6, + g = 0.6, + b = 0.6 + }, + secondary_text_color = { + r = 0.35, + g = 0.35, + b = 0.35 + }, + generic_menu_bg_color = { + r = 0.13, + g = 0.13, + b = 0.13 + }, + generic_menu_frame_color = { + r = 0.5, + g = 0.5, + b = 0.5 + }, + generic_button_text_default_color = { + r = 0.65, + g = 0.65, + b = 0.65, + a = 1 + }, + generic_button_text_focus_color = { + r = 0, + g = 0, + b = 0, + a = 1 + }, + generic_button_content_focus_color = { + r = 1, + g = 1, + b = 1, + a = 1 + }, + generic_button_text_disabled_color = { + r = 0.5, + g = 0.5, + b = 0.5, + a = 0.5 + }, + generic_button_text_over_disabled_color = { + r = 1, + g = 1, + b = 1, + a = 1 + }, + generic_button_text_over_disabled_pulse_color = { + r = 1, + g = 1, + b = 1, + a = 0.65 + }, + generic_button_border_color = { + r = 0.22, + g = 0.22, + b = 0.22, + a = 1 + }, + alien_tech_tree_bright_grey = { + r = 0.8, + g = 0.8, + b = 0.8, + a = 1 + }, + alien_scoreboard_dull_grey = { + r = 0.54, + g = 0.54, + b = 0.54, + a = 1 + }, + alien_scoreboard_bright_grey = { + r = 0.76, + g = 0.76, + b = 0.76, + a = 1 + }, + alien_chaos_hilite = { + r = 0.96, + g = 0.56, + b = 0.34, + a = 1 + }, + alien_chaos_freeze = { + r = 0.43, + g = 0.81, + b = 0.96, + a = 1 + } +} +Swatches = { + GenericMenu = { + Background = Colors.very_dark_cyan, + Border = Colors.window_border_color, + BackgroundAlpha = 0.4, + BorderAlpha = 0.4 + }, + Overlay = { + Color = Colors.very_dark_cyan, + Alpha = 0.4, + AlphaMedium = 0.7, + AlphaMore = 0.85 + } +} +BrightnessGuideConstants = { + not_visible = { + item_id = "bg_not_visible", + color_default = 0.02 + }, + barely_visible = { + item_id = "bg_barely_visible", + color_default = 0.07 + }, + easily_visible = { + item_id = "bg_easily_visible", + color_default = 0.19 + } +} +GenericButtonSettings = { + Variants = { + Plain = "Plain", + Info = "Info", + Select = "Select", + Slider = "Slider", + Checkbox = "Checkbox", + Input = "Input" + }, + Common = { + force_enable_action_button = false, + force_disable_action_button = false, + y_offset = -3, + disable_height_guard = false, + disable_padlock = false, + use_locking = true, + text_align_without_content = LUI.Alignment.Right, + text_align_with_content = LUI.Alignment.Right, + text_padding_without_content = 60, + text_padding_with_content = 275, + label_align = LUI.Alignment.Center, + over_disabled_animation_duration = 300, + text_default_color = Colors.generic_button_text_default_color, + text_focus_color = Colors.generic_button_text_focus_color, + text_lock_color = Colors.generic_button_text_focus_color, + text_disabled_color = Colors.generic_button_text_disabled_color, + text_over_disabled_color = Colors.generic_button_text_over_disabled_color, + text_over_disabled_pulse_color = Colors.generic_button_text_over_disabled_pulse_color, + content_background_margin_top = 0, + content_background_margin_bottom = 0, + content_margin = 12, + content_width = 250, + content_arrows_margin = 18, + content_slider_height = 12, + content_slider_width = 143, + checkbox_margin = 35, + content_default_color = Colors.generic_button_text_default_color, + content_focus_color = Colors.generic_button_content_focus_color, + content_focus_color_without_bg = Colors.generic_button_text_focus_color, + content_lock_color = Colors.generic_button_content_focus_color, + newIconSize = 35, + newIconIndent = 90, + field_edited_func = function () + + end, + max_length = 20, + password_field = false, + filter_profanity = false, + keyboard_type = CoD.KeyboardInputTypes.Normal, + text_alignment = LUI.Alignment.Left, + field_name = "Placeholder Label" + }, + Styles = { + GradientButton = { + y_offset = -2, + height = 40.67, + lt_cap_width = 170.67, + rt_cap_width = 85.33, + content_margin = 26, + content_width = 236, + content_background_margin_top = 7, + content_background_margin_bottom = 12, + action_button_margin = 23, + slide_in_min_duration = 60, + slide_in_duration_step = 25, + focus_animation_distance = 40, + focus_animation_duration = 100, + focus_glow_animation_duration = 1200, + focus_alien_glow_animation_duration = 1800, + focus_action_button_glow_max_alpha = 0.35, + focus_alien_action_button_glow_max_alpha = 0.5, + focus_glow_max_alpha = 0.35 + }, + FlatButton = { + SubStyles = { + Default = {}, + SubMenu = { + y_offset = 0, + border_padding = 0, + border_height = 1, + submenu_substyle = true, + anim_interval = 750, + anim_1_alpha = 0.8, + anim_2_alpha = 0.5 + } + }, + height = 43, + submenu_substyle = false, + y_offset = -2, + text_align_without_content = LUI.Alignment.Left, + text_padding_with_content = 275, + text_padding_without_content = 10, + content_background_margin_top = 5, + content_background_margin_bottom = 10, + prompt_width = 36, + action_button_margin = 1, + disable_border = false, + border_color = Colors.generic_button_border_color, + border_padding = 4, + border_height = 1, + background_padding = 0 + }, + GlassButton = { + SubStyles = { + Default = { + y_offset = 2, + height = 26.67, + ghost_width = 8, + ghost_height = 10, + rt_cap_width = 85.33, + action_button_margin = 11, + border_padding = 7 + }, + Popup = { + y_offset = 2, + height = 26.67, + ghost_width = 8, + ghost_height = 10, + rt_cap_width = 85.33, + action_button_margin = 11, + popup_substyle = true, + force_disable_action_button = true, + anim_interval = 750, + anim_1_alpha = 0.8, + anim_2_alpha = 0.5, + text_over_disabled_color = Colors.generic_button_text_focus_color, + text_over_disabled_pulse_color = Colors.generic_button_text_focus_color, + border_padding = 7 + }, + YesNoPopup = { + y_offset = 2, + height = 26.67, + ghost_width = 8, + ghost_height = 10, + rt_cap_width = 85.33, + action_button_margin = 11, + popup_substyle = true, + force_disable_action_button = true, + anim_interval = 750, + anim_1_alpha = 0.8, + anim_2_alpha = 0.5, + text_over_disabled_color = Colors.generic_button_text_focus_color, + text_over_disabled_pulse_color = Colors.generic_button_text_focus_color, + border_padding = 35 + }, + SubMenu = { + y_offset = 2, + height = 26.67, + ghost_width = 8, + ghost_height = 10, + rt_cap_width = 85.33, + action_button_margin = 11, + submenu_substyle = true, + force_disable_action_button = true, + anim_interval = 750, + anim_1_alpha = 0.8, + anim_2_alpha = 0.5, + text_over_disabled_color = Colors.generic_button_text_focus_color, + text_over_disabled_pulse_color = Colors.generic_button_text_focus_color, + border_padding = 7 + } + }, + popup_substyle = false, + submenu_substyle = false, + text_align_without_content = LUI.Alignment.Center, + text_padding_without_content = 12, + content_background_margin_top = 5, + content_background_margin_bottom = 2, + lt_cap_width = 10.67, + padlock_width = 16, + padlock_height = 16, + padlock_margin = 17, + border_color = Colors.generic_button_border_color, + disable_border = false, + border_height = 1, + lock_padding = 7, + text_default_color = Colors.primary_text_color, + text_disabled_color = Colors.secondary_text_color, + newIconSize = 24, + newIconIndent = 4 + } + } +} +FocusType = { + MenuFlow = 0, + MouseOver = 1, + ListSelection = 2, + Gamepad = 3 +} +DvarTypeTable = { + DvarBool = 0, + DvarFloat = 1, + DvarInt = 5, + DvarEnum = 6, + DvarString = 7 +} +SliderBounds = { + Brightness = { + Min = -0.4, + Max = 0.2, + Step = -0.01 + }, + PCBrightness = { + Min = -0.4, + Max = 0.2, + Step = -0.01 + }, + HorzMargin = { + Min = 0.9, + Max = 1, + Step = 0 + }, + MouseSensitivity = { + Min = 1, + Max = 30, + Step = 1 + }, + VertMargin = { + Min = 0.9, + Max = 1, + Step = 0 + }, + Volume = { + Min = 0, + Max = 0.8, + Step = 0.02, + PCStep = 0.02 + }, + VoiceRecord = { + Min = 0, + Max = 65535, + Step = 655 + }, + VoiceThreshold = { + Min = 0, + Max = 65535, + Step = 655 + }, + FOV = { + Min = 65, + Max = 80, + Step = 1 + } +} +MousePitchTable = { + PitchFloat = 0.02 +} +PCOptionsMenuDimensions = { + Padding = 4, + Spacing = 2 +} +ActiveMenus = { + None = 0, + Main = 1, + InGame = 2, + PreGame = 3, + PostGame = 4 +} +CoD.SetMaterial = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3 ) + if f3_arg2 == nil then + f3_arg2 = 1 + end + if f3_arg3 == nil then + f3_arg3 = 0 + end + f3_arg0:registerAnimationState( "changeMaterial", { + material = f3_arg1, + alpha = f3_arg2 + } ) + f3_arg0:animateToState( "changeMaterial", f3_arg3 ) +end + +CoD.UsingController = function () + local f4_local0 = Engine.IsConsoleGame() + if not f4_local0 then + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() ~= 1 then + f4_local0 = false + else + f4_local0 = true + end + end + return f4_local0 +end + +CoD.MuteStrategies = { + MuteStrategyUnmute = 0, + MuteStrategyMuteAll = 1, + MuteStrategyMuteAllButParty = 2, + MuteStrategyMuteAllButFriends = 3 +} +CoD.WeaponListPrimary = { + iw6_cbjms = 1, + iw6_k7 = 1, + iw6_kriss = 1, + iw6_microtar = 1, + iw6_pdw = 1, + iw6_pdwauto = 1, + iw6_pp19 = 1, + iw6_vepr = 1, + iw6_ak12 = 1, + iw6_arx160 = 1, + iw6_bren = 1, + iw6_fads = 1, + iw6_honeybadger = 1, + iw6_msbs = 1, + iw6_r5rgp = 1, + iw6_sc2010 = 1, + iw6_gm6 = 1, + iw6_l115a3 = 1, + iw6_usr = 1, + iw6_vks = 1, + iw6_g28 = 1, + iw6_imbel = 1, + iw6_mk14 = 1, + iw6_svu = 1, + iw6_fp6 = 1, + iw6_maul = 1, + iw6_mts255 = 1, + iw6_uts15 = 1, + iw6_ameli = 1, + iw6_kac = 1, + iw6_lsat = 1, + iw6_m27 = 1, + iw6_minigun = 1, + iw6_dlcweap01 = 1, + iw6_dlcweap02 = 1, + iw6_dlcweap03 = 1, + iw6_maaws = 1, + iw6_minigunjugg = 1, + iw6_gm6helisnipe = 1, + iw6_mariachimagnum = 1, + venomxgun = 1 +} +CoD.WeaponListSecondary = { + iw6_m9a1 = 1, + iw6_magnum = 1, + iw6_mp443 = 1, + iw6_p226 = 1, + iw6_mk32 = 1, + iw6_panzerfaust3 = 1, + iw6_rgm = 1, + iw6_magnumjugg = 1, + iw6_p226jugg = 1, + iw6_magnumhorde = 1, + iw6_mk32horde = 1 +} +CoD.remoteKillstreakWeaponTable = { + killstreak_ac130_mp = true, + ac130_105mm_mp = true, + ac130_40mm_mp = true, + ac130_25mm_mp = true, + killstreak_remote_tank_laptop_mp = true, + killstreak_remote_tank_remote_mp = true, + killstreak_helicopter_minigun_mp = true, + killstreak_predator_missile_mp = true, + heli_remote_mp = true, + killstreak_remote_turret_remote_mp = true, + killstreak_remote_turret_laptop_mp = true, + mortar_remote_mp = true, + mortar_remote_zoom_mp = true, + uav_remote_mp = true, + killstreak_precision_airstrike_mp = true, + killstreak_heli_pilot_mp = true, + killstreak_odin_support_mp = true, + killstreak_odin_assault_mp = true, + killstreak_level_event_laptop_mp = true, + killstreak_vanguard_mp = true +} +CoD.UsingKillstreakRemote = function () + return CoD.remoteKillstreakWeaponTable[Game.GetPlayerWeaponName()] +end + +CoD.UsingOdinOrLoki = function () + local f6_local0 = Game.GetPlayerWeaponName() + local f6_local1 = false + if f6_local0 == "killstreak_odin_support_mp" or f6_local0 == "killstreak_odin_assault_mp" then + f6_local1 = true + end + return f6_local1 +end + +CoD.IsFireTeamMode = function () + return Lobby.GetBotsConnectType() == 2 +end + +CoD.ColorizeState = function ( f8_arg0, f8_arg1 ) + if not f8_arg1 then + f8_arg1 = {} + end + if not f8_arg0 then + DebugPrint( "Warning: Calling CoD.ColorizeState without specifying a color" ) + return f8_arg1 + end + f8_arg1.red = f8_arg0.r + f8_arg1.green = f8_arg0.g + f8_arg1.blue = f8_arg0.b + local f8_local0 = f8_arg0.a + if not f8_local0 then + f8_local0 = f8_arg1.alpha or 1 + end + f8_arg1.alpha = f8_local0 + return f8_arg1 +end + +CoD.PrintModuleLoad = function ( f9_arg0 ) + +end + +CoD.StatsGroup = { + Ranked = 0, + Private = 1, + Coop = 2, + Common = 3 +} +CoD.GetStatsGroupForGameMode = function () + return Engine.GetStatsGroupForGameMode() +end + +CoD.GetStatsGroupForSquadLocation = function ( f11_arg0 ) + local f11_local0 = CoD.GetStatsGroupForGameMode() + if f11_arg0 == "squadMembers" then + f11_local0 = CoD.StatsGroup.Ranked + elseif f11_arg0 == "privateMatchSquadMembers" then + f11_local0 = CoD.StatsGroup.Private + end + return f11_local0 +end + +if f0_local0 then + f0_local2 = profile.beginuserevent + f0_local3 = profile.enduserevent + profile.beginuserevent = function ( f12_arg0 ) + if type( f12_arg0 ) ~= "number" then + f12_arg0 = profile.lookupusereventid( f12_arg0 ) or profile.createuserevent( f12_arg0, "duration" ) + end + f0_local2( f12_arg0 ) + return f12_arg0 + end + + profile.enduserevent = function ( f13_arg0 ) + if type( f13_arg0 ) ~= "number" then + f13_arg0 = profile.lookupusereventid( f13_arg0 ) + end + f0_local3( f13_arg0 ) + end + +else + profile.beginuserevent = function () + + end + + profile.enduserevent = function () + + end + + profile.createuserevent = function () + + end + + profile.lookupusereventid = function () + + end + +end +if f0_local1 then + function run_gc( f18_arg0 ) + local f18_local0 + if f18_arg0 then + f18_local0 = " (" .. f18_arg0 .. ")" + if not f18_local0 then + + else + local f18_local1 = collectgarbage( "count" ) + collectgarbage( "collect" ) + local f18_local2 = collectgarbage( "count" ) + DebugPrint( "LUI - Ran GC cycle, cleared " .. f18_local1 - f18_local2 .. "kb. " .. f18_local2 .. "kb remaining." .. f18_local0 ) + end + end + f18_local0 = "" + end + +else + function run_gc() + collectgarbage( "collect" ) + end + +end +function hashset( f20_arg0 ) + local f20_local0 = {} + for f20_local4, f20_local5 in pairs( f20_arg0 ) do + f20_local0[f20_local5] = true + end + return f20_local0 +end + +function bit( f21_arg0 ) + return 2 ^ (f21_arg0 - 1) +end + +function hasbit( f22_arg0, f22_arg1 ) + return f22_arg1 <= f22_arg0 % (f22_arg1 + f22_arg1) +end + +function setbit( f23_arg0, f23_arg1 ) + if hasbit( f23_arg0, f23_arg1 ) then + local f23_local0 = f23_arg0 + end + return f23_local0 or f23_arg0 + f23_arg1 +end + +function clearbit( f24_arg0, f24_arg1 ) + return hasbit( f24_arg0, f24_arg1 ) and f24_arg0 - f24_arg1 or f24_arg0 +end + +function IsCurrentSticksLayoutSouthpaw() + return Engine.GetProfileData( "gpadSticksConfig" ) == "thumbstick_southpaw" +end + +function IsCurrentSticksLayoutLegacy() + return Engine.GetProfileData( "gpadSticksConfig" ) == "thumbstick_legacy" +end + +function IsCurrentSticksLayoutLegacySouthpaw() + return Engine.GetProfileData( "gpadSticksConfig" ) == "thumbstick_legacysouthpaw" +end + +CoD.CreateState = function ( f28_arg0, f28_arg1, f28_arg2, f28_arg3, f28_arg4 ) + return { + left = f28_arg0, + top = f28_arg1, + right = f28_arg2, + bottom = f28_arg3, + leftAnchor = f28_arg4.leftAnchor, + topAnchor = f28_arg4.topAnchor, + rightAnchor = f28_arg4.rightAnchor, + bottomAnchor = f28_arg4.bottomAnchor + } +end + +CoD.GradientMap = function ( f29_arg0, f29_arg1 ) + assert( f29_arg0 and #f29_arg0 >= 2 ) + local f29_local0 = assert + local f29_local1 + if f29_arg0[1].threshold ~= 0 or f29_arg0[#f29_arg0].threshold ~= 1 then + f29_local1 = false + else + f29_local1 = true + end + f29_local0( f29_local1 ) + if f29_arg1 <= 0 then + return f29_arg0[1].color + elseif f29_arg1 >= 1 then + return f29_arg0[#f29_arg0].color + end + f29_local0 = f29_arg0[1] + f29_local1 = f29_arg0[1] + for f29_local6, f29_local7 in ipairs( f29_arg0 ) do + if f29_arg1 < f29_local7.threshold then + local f29_local5 = (f29_arg1 - f29_local0.threshold) / (f29_local7.threshold - f29_local0.threshold) + return { + r = f29_local5 * f29_local7.color.r + (1 - f29_local5) * f29_local0.color.r, + g = f29_local5 * f29_local7.color.g + (1 - f29_local5) * f29_local0.color.g, + b = f29_local5 * f29_local7.color.b + (1 - f29_local5) * f29_local0.color.b + } + end + f29_local0 = f29_local7 + end + return f29_arg0[#f29_arg0].color +end + +CoD.AnchorTypes = { + All = { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true + }, + None = { + leftAnchor = false, + topAnchor = false, + rightAnchor = false, + bottomAnchor = false + }, + Top = { + leftAnchor = false, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false + }, + TopLeft = { + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false + }, + TopRight = { + leftAnchor = false, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false + }, + TopLeftRight = { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false + }, + Bottom = { + leftAnchor = false, + topAnchor = false, + rightAnchor = false, + bottomAnchor = true + }, + BottomLeft = { + leftAnchor = true, + topAnchor = false, + rightAnchor = false, + bottomAnchor = true + }, + BottomRight = { + leftAnchor = false, + topAnchor = false, + rightAnchor = true, + bottomAnchor = true + }, + BottomLeftRight = { + leftAnchor = true, + topAnchor = false, + rightAnchor = true, + bottomAnchor = true + }, + TopBottomLeft = { + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = true + }, + TopBottomRight = { + leftAnchor = false, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true + }, + Left = { + leftAnchor = true, + topAnchor = false, + rightAnchor = false, + bottomAnchor = false + }, + Right = { + leftAnchor = false, + topAnchor = false, + rightAnchor = true, + bottomAnchor = false + }, + LeftRight = { + leftAnchor = true, + topAnchor = false, + rightAnchor = true, + bottomAnchor = false + } +} +CoD.FormatInfectedTime = function ( f30_arg0, f30_arg1 ) + local f30_local0 = Engine.Localize( "@LUA_MENU_S_FOR_SECONDS" ) + local f30_local1 = Engine.Localize( "@LUA_MENU_M_FOR_MINUTES" ) + local f30_local2 = math.floor( f30_arg0 / 60 ) + local f30_local3 = "" + if not f30_arg1 then + if f30_local2 < 1 then + f30_local3 = f30_arg0 .. f30_local0 + else + f30_local3 = f30_local2 .. f30_local1 + if f30_local2 >= 16 then + f30_local3 = max_text + end + end + else + f30_arg0 = f30_arg0 - f30_local2 * 60 + if f30_arg0 >= 10 then + f30_local3 = f30_local2 .. ":" .. f30_arg0 + else + f30_local3 = f30_local2 .. ":0" .. f30_arg0 + end + end + return f30_local3 +end + +if Engine.UsingSplitscreenUpscaling() then + GenericMenuDims.menu_top = GenericMenuDims.menu_top - 10 + GenericMenuDims.menu_bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 6 +end +CoD.IsUsingAspectRatio = function ( f31_arg0 ) + return math.abs( f31_arg0 - Engine.GetAspectRatio() ) < 0.01 +end + +CoD.CoDAnywhere = { + COD_ANYWHERE_PLATFORM_TEXT_TYPE_LAST_PLAYED = 0, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_TIME_PLAYED = 1, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER1 = 2, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER2 = 3, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER3 = 4, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER4 = 5, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER5 = 6, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER6 = 7, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER7 = 8, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER8 = 9, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER9 = 10, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER10 = 11, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK1 = 12, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK2 = 13, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK3 = 14, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK4 = 15, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK5 = 16, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK6 = 17, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK7 = 18, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK8 = 19, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK9 = 20, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK10 = 21, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_TOKENS_EARNED = 22, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_TOKENS_AVAILABLE = 23, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_PLATFORM_NAME = 24 +} diff --git a/lui/codedependence.dec.lua b/lui/codedependence.dec.lua new file mode 100644 index 0000000..8061a30 --- /dev/null +++ b/lui/codedependence.dec.lua @@ -0,0 +1,587 @@ +function ModuleInaccessible( f1_arg0 ) + assert( not _G[f1_arg0] ) + _G[f1_arg0] = setmetatable( {}, { + __index = function ( f2_arg0, f2_arg1 ) + return function () + assert( false, "Functions from the " .. f1_arg0 .. " module are not allowed to be called from this scope." ) + end + + end + } ) +end + +if Engine then + Engine.UsingSplitscreenUpscaling = Engine.UsingSplitscreenUpscaling or function () + return false + end + + Engine.IsNetworkConnected = Engine.IsNetworkConnected or function () + return true + end + + Engine.HasAcceptedInvite = Engine.HasAcceptedInvite or function () + return false + end + + Engine.SetAndEnableCustomClanTag = Engine.SetAndEnableCustomClanTag or function () + + end + + Engine.CanViewClanTags = Engine.CanViewClanTags or function () + return true + end + + Engine.AllowOnline = Engine.AllowOnline or function () + return true + end + + Engine.IsSpecialRegion = Engine.IsSpecialRegion or function () + return false + end + + Engine.HasSnapshot = Engine.HasSnapshot or function () + return true + end + + Engine.APEXTurbulenceAvailable = Engine.APEXTurbulenceAvailable or function () + return false + end + + Engine.FurShaderAvailable = Engine.FurShaderAvailable or function () + return false + end + + Engine.HBAOAvailable = Engine.HBAOAvailable or function () + return false + end + + Engine.NVidiaGPUAvailable = Engine.NVidiaGPUAvailable or function () + return false + end + + local f0_local0 = Engine + local f0_local1 = Engine.TXAAAvailable + if not f0_local1 then + f0_local1 = Engine.NVidiaGPUAvailable + end + f0_local0.TXAAAvailable = f0_local1 + Engine.CanVidRestart = Engine.CanVidRestart or function () + return false + end + + Engine.FormatTimeHoursMinutesSeconds = Engine.FormatTimeHoursMinutesSeconds or function () + return "" + end + + Engine.UserIsGuest = Engine.UserIsGuest or function () + return false + end + + Engine.ClearCustomClanTag = Engine.ClearCustomClanTag or function () + + end + + Engine.GetCurrentDayMonthYear = Engine.GetCurrentDayMonthYear or function () + return 1, 1, 2100 + end + + Engine.GetCurrentYear = Engine.GetCurrentYear or function () + return 2100 + end + + Engine.UserCanAccessFriendsList = Engine.UserCanAccessFriendsList or function () + return false + end + + Engine.AnyoneHasSeasonPass = Engine.AnyoneHasSeasonPass or function () + return false + end + + Engine.AnyoneHasAliensDLC = Engine.AnyoneHasAliensDLC or function () + return false + end + + Engine.AnyoneHasAliensDLC1 = Engine.AnyoneHasAliensDLC1 or function () + return false + end + + Engine.AnyoneHasAliensDLC2 = Engine.AnyoneHasAliensDLC2 or function () + return false + end + + Engine.AnyoneHasAliensDLC3 = Engine.AnyoneHasAliensDLC3 or function () + return false + end + + Engine.AnyoneHasAliensDLC4 = Engine.AnyoneHasAliensDLC4 or function () + return false + end + + Engine.IsXenonDevTitle = Engine.IsXenonDevTitle or function () + return false + end + + Engine.GetRawMonthDayYear = Engine.GetRawMonthDayYear or function () + return nil + end + + Engine.GetClanTag = Engine.GetClanTag or function () + return "" + end + + Engine.LocalClientProfileCanSave = Engine.LocalClientProfileCanSave or function () + return true + end + + Engine.IsProfanity = Engine.IsProfanity or function () + return false + end + + Engine.GetAspectRatio = Engine.GetAspectRatio or function () + return 1.78 + end + + Engine.IsChatRestricted = Engine.IsChatRestricted or function () + return false + end + + Engine.UserCanAccessStore = Engine.UserCanAccessStore or function () + return false + end + + Engine.ShowXB3GoldUpsell = Engine.ShowXB3GoldUpsell or function () + return false + end + + Engine.ShowLowTextureResolutionWarning = Engine.ShowLowTextureResolutionWarning or function () + return false + end + + Engine.IsPC = Engine.IsPC or function () + return false + end + + Engine.ClearUnlockData = Engine.ClearUnlockData or function () + return false + end + + Engine.GetControllerForLocalClient = Engine.GetControllerForLocalClient or function () + return 0 + end + + Engine.PartyEveryoneHasMap = Engine.PartyEveryoneHasMap or function () + return true + end + + Engine.IsActiveLocalClientPrimary = Engine.IsActiveLocalClientPrimary or function () + return true + end + + Engine.PLMRefreshData = Engine.PLMRefreshData or function () + + end + + Engine.HasSaveDevice = Engine.HasSaveDevice or function () + return true + end + + Engine.AnyoneHasSpecificDLCPack = Engine.AnyoneHasSpecificDLCPack or function () + return true + end + + Engine.VoteForDLCItem = Engine.VoteForDLCItem or function () + + end + + Engine.GetVoteItemText = Engine.GetVoteItemText or function () + return "" + end + + Engine.GetVoteItemFileID = Engine.GetVoteItemFileID or function () + return -1 + end + + Engine.GetActiveVotes = Engine.GetActiveVotes or function () + return 0 + end + + Engine.GetNumberOfImagesForVote = Engine.GetNumberOfImagesForVote or function () + return 0 + end + + Engine.StartVoteImageDownload = Engine.StartVoteImageDownload or function () + + end + + Engine.IsVoteImageDownloaded = Engine.IsVoteImageDownloaded or function () + return false + end + + Engine.GetVoteImageHandle = Engine.GetVoteImageHandle or function () + return RegisterMaterial( "white" ) + end + + Engine.GetVotingID = Engine.GetVotingID or function () + return -1 + end + + Engine.GetPlayerDataReservedShort = Engine.GetPlayerDataReservedShort or function () + + end + + Engine.SetPlayerDataReservedShort = Engine.SetPlayerDataReservedShort or function () + + end + + Engine.GetVotingHeader = Engine.GetVotingHeader or function () + return "" + end + + Engine.HasPlayerData = Engine.HasPlayerData or function () + return true + end + + Engine.IsAnnouncerReleased = Engine.IsAnnouncerReleased or function () + return true + end + + Engine.IsAnnouncerUnlocked = Engine.IsAnnouncerUnlocked or function () + return true + end + + Engine.AnyoneHasBadReputation = Engine.AnyoneHasBadReputation or function () + return false + end + +end +if Game then + if not Engine.IsConsoleGame() then + local f0_local0 = Game.GetNumPlayersOnTeam + Game.GetNumPlayersOnTeam = function ( f63_arg0 ) + if Engine.GetDvarBool( "onlinegame" ) or Engine.GetDvarBool( "systemlink" ) then + return f0_local0( f63_arg0 ) + else + return 0 + end + end + + end + Game.IsKillCamEntityActive = Game.IsKillCamEntityActive or function () + return false + end + + Game.IsSpectatorCameraActive = Game.IsSpectatorCameraActive or function () + return false + end + + Game.StartBlur = Game.StartBlur or function () + + end + + Game.GetLastMLGSpectateTeam = Game.GetLastMLGSpectateTeam or function () + return Teams.allies + end + +else + ModuleInaccessible( "Game" ) +end +if Store then + Store.RequestContentServerImages = Store.RequestContentServerImages or function () + + end + + Store.GetCategoryForDLCName = Store.GetCategoryForDLCName or function () + return 0 + end + + Store.ShowSystemOffer = Store.ShowSystemOffer or function () + + end + +else + ModuleInaccessible( "Store" ) +end +if Friends then + Friends.HasPartyGameInvite = Friends.HasPartyGameInvite or function () + return false + end + + Friends.AcceptLivePartyInvitation = Friends.AcceptLivePartyInvitation or function () + + end + + Friends.CanShowFriendGamercard = Friends.CanShowFriendGamercard or function () + return true + end + + Friends.GetEliteClanFriendMemberStatus = Friends.GetEliteClanFriendMemberStatus or function ( f74_arg0, f74_arg1 ) + return "" + end + +else + ModuleInaccessible( "Friends" ) +end +if Squad then + Squad.PostMatch = Squad.PostMatch or function () + return "" + end + + Squad.GetHostSquadName = Squad.GetHostSquadName or function () + return "" + end + + Squad.UpdateReportPlayerCardCache = Squad.UpdateReportPlayerCardCache or function () + return "" + end + + Squad.GetReportPlayercard = Squad.GetReportPlayercard or function () + + end + + Squad.GetClanTagForReport = Squad.GetClanTagForReport or function () + return "" + end + + Squad.GetCompareInfoForLobby = Squad.GetCompareInfoForLobby or function () + return {} + end + + Squad.SetMinPlayersToHumanMax = Squad.SetMinPlayersToHumanMax or function () + + end + + Squad.GetSquadModePlaylist = Squad.GetSquadModePlaylist or function ( f82_arg0, f82_arg1 ) + if f82_arg1 == 1 then + return 5, 0 + elseif f82_arg1 == 2 then + return 5, 4 + elseif f82_arg1 == 3 then + return 5, 1 + elseif f82_arg1 == 4 then + return 5, 2 + elseif f82_arg1 == 5 then + return 5, 3 + elseif f82_arg1 == 6 then + return 5, 5 + else + return -1, -1 + end + end + +else + ModuleInaccessible( "Squad" ) +end +if Leaderboards then + Leaderboards.GetPlayerValue = Leaderboards.GetPlayerValue or function ( f83_arg0, f83_arg1 ) + return "" + end + + Leaderboards.GetValue = Leaderboards.GetValue or function ( f84_arg0, f84_arg1, f84_arg2 ) + return "" + end + + Leaderboards.GetOffset = Leaderboards.GetOffset or function ( f85_arg0 ) + return 0 + end + + Leaderboards.GetCurrentIndex = Leaderboards.GetCurrentIndex or function ( f86_arg0 ) + return 0 + end + + Leaderboards.UpdateLeaderboard = Leaderboards.UpdateLeaderboard or function ( f87_arg0, f87_arg1 ) + + end + + Leaderboards.UpdateCurrentIndex = Leaderboards.UpdateCurrentIndex or function ( f88_arg0, f88_arg1 ) + + end + + Leaderboards.OnSelect = Leaderboards.OnSelect or function ( f89_arg0 ) + + end + +else + ModuleInaccessible( "Leaderboards" ) +end +if Lobby then + Lobby.ShowMemberInfo = Lobby.ShowMemberInfo or function ( f90_arg0, f90_arg1, f90_arg2 ) + return true + end + + Lobby.UnsetAllMLGSpectators = Lobby.UnsetAllMLGSpectators or function () + + end + + Lobby.GetMemberWeaponSetup = Lobby.GetMemberWeaponSetup or function () + return {} + end + + Lobby.GetPartyPrivacy = Lobby.GetPartyPrivacy or function () + return -1 + end + + Lobby.SetPartyPrivacy = Lobby.SetPartyPrivacy or function () + + end + + Lobby.GetPlayerLimit = Lobby.GetPlayerLimit or function () + return -1 + end + + Lobby.SetPlayerLimit = Lobby.SetPlayerLimit or function () + + end + + Lobby.SetUsingMLGRules = Lobby.SetUsingMLGRules or function () + + end + + Lobby.IsUsingMLGRules = Lobby.IsUsingMLGRules or function () + return false + end + + Lobby.EnteringLobby = Lobby.EnteringLobby or function () + return false + end + + Lobby.EnteredLobby = Lobby.EnteredLobby or function () + + end + + Lobby.HowManyPlayersCanWeHost = Lobby.HowManyPlayersCanWeHost or function () + return 12 + end + + Lobby.IsUsingSecondScreen = Lobby.IsUsingSecondScreen or function () + return false + end + + Lobby.IsAlone = Lobby.IsAlone or function () + return false + end + + Lobby.IsChaosEnabled = Lobby.IsChaosEnabled or function () + return false + end + + Lobby.SetChaosEnabled = Lobby.SetChaosEnabled or function () + + end + + Lobby.SetExtinctionDifficulty = Lobby.SetExtinctionDifficulty or function () + + end + + Lobby.GetExtinctionDifficulty = Lobby.GetExtinctionDifficulty or function () + return 2 + end + +else + ModuleInaccessible( "Lobby" ) +end +if LobbyMember then + LobbyMember.SelectedMember_SetLocalMemberMLGSpectator = LobbyMember.SelectedMember_SetLocalMemberMLGSpectator or function () + + end + +end +Clan = Clan or {} +Clan.IsEnabled = Clan.IsEnabled or function () + return false +end + +Clan.IsDownloadingData = Clan.IsDownloadingData or function () + return false +end + +Clan.GetDCXPTime = Clan.GetDCXPTime or function () + return 0 +end + +Clan.GetClanDivision = Clan.GetClanDivision or function () + return 0 +end + +CoDAnywhere = CoDAnywhere or {} +CoDAnywhere.HasUCDSaveGame = CoDAnywhere.HasUCDSaveGame or function () + return false +end + +CoDAnywhere.ServiceAvailable = CoDAnywhere.ServiceAvailable or function () + return true +end + +if Playlist then + Playlist.GetCanShowItem = Playlist.GetCanShowItem or function () + return true + end + + Playlist.GetItemMaxParty = Playlist.GetItemMaxParty or function () + return 12 + end + + Playlist.WillCXPBeAwarded = Playlist.WillCXPBeAwarded or function () + return false + end + + Playlist.GetItemVideo = Playlist.GetItemVideo or function () + return "" + end + +else + ModuleInaccessible( "Playlist" ) +end +if CharacterScene then + +else + ModuleInaccessible( "CharacterScene" ) +end +MLG = MLG or {} +MLG.GetFollowedClientNum = MLG.GetFollowedClientNum or function () + +end + +MLG.HighlightClientNum = MLG.HighlightClientNum or function () + +end + +MLG.TogglePlayerOutlines = MLG.TogglePlayerOutlines or function () + +end + +Customization = Customization or {} +Customization.GetCompleteHeadModelName = Customization.GetCompleteHeadModelName or function ( f122_arg0, f122_arg1 ) + local f122_local0 = Engine.TableLookup( "mp/cac/heads.csv", 0, f122_arg0, 1 ) + local f122_local1 = "" + if f122_arg1 then + f122_local1 = Engine.TableLookup( "mp/cac/helmets.csv", 0, f122_arg1, 1 ) + end + return f122_local0 .. f122_local1 +end + +MatchRules = MatchRules or {} +MatchRules.SelectSaveDevice = MatchRules.SelectSaveDevice or function () + +end + +MatchRules.HasSelectedSaveDevice = MatchRules.HasSaveDevice or function () + return true +end + +SocialFeed = SocialFeed or {} +SocialFeed.GetNewsItemID = SocialFeed.GetNewsItemID or function () + return "" +end + +SocialFeed.HasIOTD = SocialFeed.HasIOTD or function () + return true +end + +SocialFeed.DowloadIOTD = SocialFeed.DowloadIOTD or function () + +end + +SocialFeed.SetNewsArticleImageJPEG = SocialFeed.SetNewsArticleImageJPEG or function () + +end + diff --git a/lui/common_menus/caccustomizeutils.dec.lua b/lui/common_menus/caccustomizeutils.dec.lua new file mode 100644 index 0000000..8d29e8b --- /dev/null +++ b/lui/common_menus/caccustomizeutils.dec.lua @@ -0,0 +1,1314 @@ +Cac = Cac or {} +CharacterCameraPresets = { + Lobby = { + Position = { + -25, + 0, + 156 + }, + Rotation = { + 0, + 0, + 0 + } + }, + CharSelectMenu = { + Position = { + -25, + 3, + 90 + }, + Rotation = { + 0, + 0, + 0 + } + }, + LoadoutMenu = { + Position = { + -25, + 0, + 156 + }, + Rotation = { + 0, + 0, + 0 + } + }, + MemberSelect = { + Position = { + -25, + 0, + 156 + }, + Rotation = { + 0, + 0, + 0 + } + }, + CustomizeMenu = { + Default = { + Position = { + -25, + 0, + 156 + }, + Rotation = { + 0, + 0, + 0 + } + }, + Head = { + Position = { + 0, + 0, + 60 + }, + Rotation = { + 0, + 0, + 0 + } + }, + Helmet = { + Position = { + 0, + 0, + -60 + }, + Rotation = { + 0, + 0, + 0 + } + }, + Patch = { + Position = { + 0, + 0, + 0 + }, + Rotation = { + 0, + 0, + 0 + } + } + }, + ClanDetails = { + Left = { + Position = { + -66, + 0, + 180 + }, + Rotation = { + 0, + 0, + 0 + } + }, + Center = { + Position = { + -19, + 0, + 180 + }, + Rotation = { + 0, + 0, + 0 + } + }, + Right = { + Position = { + 28, + 0, + 180 + }, + Rotation = { + 0, + 0, + 0 + } + } + } +} +local f0_local0 = Cac +local f0_local1 = { + Animations = { + default = "mp_menu_male_idle", + idles = { + normal = { + "mp_menu_male_idle", + "mp_menu_male_twitch_A", + "mp_menu_male_twitch_B" + }, + riotshield = { + "mp_menu_shield_idle", + "mp_menu_shield_twitch_A", + "mp_menu_shield_twitch_B" + }, + knifeonly = { + "jug_maniac_idle", + "jug_maniac_twitchA", + "jug_maniac_twitchB", + "jug_maniac_twitchC" + }, + pistol = { + "mp_alien_menu_male_idle", + "mp_alien_menu_male_twitch_A", + "mp_alien_menu_male_twitch_B" + } + }, + weapon_grabs = { + normal_1 = { + "mp_menu_male_grab_gun_1_A", + "mp_menu_male_grab_gun_2_A" + }, + normal_2 = { + "mp_menu_male_grab_gun_1_B", + "mp_menu_male_grab_gun_2_B" + }, + riotshield = { + "mp_menu_grab_shield_1_A", + "mp_menu_grab_shield_2_A" + }, + knifeonly = { + "mp_menu_male_grab_knife_1_A", + "mp_menu_male_grab_knife_2_A" + }, + pistol = {} + } + }, + FieldIndexes = { + Head = 1, + Helmet = 2, + Body = 3, + Patch = 4, + Patchbacking = 5, + Background = 6, + ClanTag = 7, + GuardDog = 8, + Announcer = 9 + }, + Gender = { + Male = "m", + Female = "f", + Special = "b" + } +} +local f0_local2 = {} +local f0_local3 = { + csv = "mp/cac/heads.csv", + LocName = "HEAD", + UnlockType = "Head", + PublicOnly = false, + ImpactsPlayercard = false, + SaveRef = function ( f1_arg0, f1_arg1, f1_arg2, f1_arg3 ) + local f1_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f1_local1 = Cac.IsCommonGender( Cac.GetGenderFromHeadRef( f1_arg3 ) ) + if f1_local1 then + f1_local1 = not Cac.IsCommonGender( Cac.GetCurrentGender( f1_arg0, f1_arg1, f1_arg2 ) ) + end + if f1_local1 then + Cac.SetBodyIndex( f1_arg0, f1_arg1, f1_arg2, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body].GetDefaultRef( f1_arg0, Cac.GetGenderFromHeadRef( f1_arg3 ) ) ) + end + Cac.SetHeadIndex( f1_arg0, f1_arg1, f1_arg2, f1_arg3 ) + if not Cac.DoesHeadUseHelmet( f1_arg3 ) then + f1_local0.SaveRef( f1_arg0, f1_arg1, f1_arg2, f1_local0.NoneRef ) + end + end, + GetSavedRef = function ( f2_arg0, f2_arg1, f2_arg2 ) + return Cac.GetHeadIndex( f2_arg0, f2_arg1, f2_arg2 ) + end, + GetSavedModel = function ( f3_arg0, f3_arg1, f3_arg2 ) + local f3_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + return f3_local0.MakeModelName( f3_local0.GetSavedRef( f3_arg0, f3_arg1, f3_arg2 ), Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet].GetSavedRef( f3_arg0, f3_arg1, f3_arg2 ) ) + end, + SelectionPopup = "cac_customize_buttons_popup" +} +local f0_local4 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local4 then + f0_local4 = LUI.mp_menus.CacCustomize.CustomizePopupGridGenericButton +end +f0_local3.SelectionButtonFactory = f0_local4 +f0_local3.GetName = function ( f4_arg0 ) + return Engine.TableLookup( "mp/cac/heads.csv", 0, f4_arg0, 2 ) +end + +f0_local3.PreviewFunction = function ( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5 ) + local f5_local0 = {} + local f5_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + local f5_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f5_local3 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f5_local4 = f5_local3.GetSavedRef( f5_arg0, Cac.GetSquadLoc(), f5_arg4 ) + if not Cac.DoesHeadUseHelmet( f5_arg3 ) or not f5_local4 then + f5_local4 = f5_local3.NoneRef + end + local f5_local5 = f5_local2.MakeModelName( f5_arg3, f5_local4, f5_arg5 ) + if Cac.GetGenderFromBodyRef( f5_local1.GetSavedRef( f5_arg0, Cac.GetSquadLoc(), f5_arg4 ) ) ~= Cac.GetGenderFromHeadRef( f5_arg3 ) then + local f5_local6 = f5_local1.GetDefaultRef( f5_arg0, Cac.GetGenderFromHeadRef( f5_arg3 ) ) + CharacterScene.ChangeBody( f5_arg2, f5_local1.MakeModelName( f5_local6, f5_arg5 ), Cac.GetPatchIndex( f5_arg0, Cac.GetSquadLoc(), f5_arg4 ) ) + f5_local0[f5_local1] = f5_local6 + end + CharacterScene.ChangeHead( f5_arg2, f5_local5 ) + f5_local0[f5_local3] = f5_local4 + f5_local0[f5_local2] = f5_arg3 + return f5_local0 +end + +f0_local3.MakeModelName = function ( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + if not f6_arg2 then + f6_arg2 = Cac.GetDefaultBodyCamoRef() + end + if not f6_arg1 then + f6_arg1 = f6_local0.NoneRef + end + return Customization.GetCompleteHeadModelName( f6_arg0, f6_arg1, Cac.GetHeadCamoSuffix( f6_arg2 ) ) +end + +f0_local3.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Head +f0_local3.GetUIMaterial = function ( f7_arg0 ) + return "icon_aar_head" +end + +f0_local3.GenderColumn = 3 +f0_local3.UseHelmetColumn = 4 +f0_local3.IsEntitlementColumn = 5 +f0_local3.HideUnlessUnlockedColumn = 6 +f0_local3.CustomUnlockText = 7 +f0_local3.DLCOffer = 9 +f0_local3.ReleaseKillswitch = 10 +f0_local3.SecondaryEntitlementColumn = 11 +f0_local3.GetDefaultRef = function ( f8_arg0, f8_arg1 ) + local f8_local0 = Cac.Customization.GetElementRefsForField( f8_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head], f8_arg1 ) + assert( #f8_local0 > 0 ) + return f8_local0[1] +end + +f0_local4 = { + csv = "mp/cac/helmets.csv", + LocName = "HELMET", + UnlockType = "Helmet", + PublicOnly = false, + ImpactsPlayercard = false, + NoneRef = 0, + SaveRef = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3 ) + local f9_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f9_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f9_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + if not Cac.IsCommonGender( Cac.GetCurrentGender( f9_arg0, f9_arg1, f9_arg2 ) ) then + Cac.SetBodyIndex( f9_arg0, f9_arg1, f9_arg2, f9_local2.GetDefaultRef( f9_arg0, Cac.Customization.Gender.Male ) ) + Cac.SetHeadIndex( f9_arg0, f9_arg1, f9_arg2, f9_local1.GetDefaultRef( f9_arg0, Cac.Customization.Gender.Male ) ) + end + Cac.SetHelmetIndex( f9_arg0, f9_arg1, f9_arg2, f9_arg3 ) + if not Cac.DoesHeadUseHelmet( f9_local1.GetSavedRef( f9_arg0, f9_arg1, f9_arg2 ) ) and f9_arg3 ~= f9_local0.NoneRef then + f9_local1.SaveRef( f9_arg0, f9_arg1, f9_arg2, f9_local1.GetDefaultRef( f9_arg0, Cac.GetCurrentGender( f9_arg0, f9_arg1, f9_arg2 ) ) ) + end + end, + GetSavedRef = function ( f10_arg0, f10_arg1, f10_arg2 ) + return Cac.GetHelmetIndex( f10_arg0, f10_arg1, f10_arg2 ) + end, + SelectionPopup = "cac_customize_buttons_popup" +} +local f0_local5 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local5 then + f0_local5 = LUI.mp_menus.CacCustomize.CustomizePopupGridGenericButton +end +f0_local4.SelectionButtonFactory = f0_local5 +f0_local4.GetName = function ( f11_arg0 ) + return Engine.TableLookup( "mp/cac/helmets.csv", 0, f11_arg0, 2 ) +end + +f0_local4.PreviewFunction = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4, f12_arg5 ) + local f12_local0 = {} + local f12_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + local f12_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f12_local3 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f12_local4 = Cac.GetHeadIndex( f12_arg0, Cac.GetSquadLoc(), f12_arg4 or Cac.GetEditSquadMember( f12_arg0 ) ) + if not Cac.IsCommonGender( Cac.GetGenderFromBodyRef( f12_local1.GetSavedRef( f12_arg0, Cac.GetSquadLoc(), f12_arg4 ) ) ) and f12_arg3 ~= f12_local3.NoneRef then + local f12_local5 = f12_local1.GetDefaultRef( f12_arg0, Cac.Customization.Gender.Male ) + CharacterScene.ChangeBody( f12_arg2, f12_local1.MakeModelName( f12_local5, f12_arg5 ), Cac.GetPatchIndex( f12_arg0, Cac.GetSquadLoc(), f12_arg4 ) ) + f12_local0[f12_local1] = f12_local5 + end + if f12_arg3 ~= f12_local3.NoneRef and not Cac.DoesHeadUseHelmet( f12_local4 ) then + local f12_local5 = Cac.GetCurrentGender( f12_arg0, Cac.GetSquadLoc(), f12_arg4 ) + if not Cac.IsCommonGender( f12_local5 ) then + f12_local5 = Cac.Customization.Gender.Male + end + f12_local4 = f12_local2.GetDefaultRef( f12_arg0, f12_local5 ) + end + CharacterScene.ChangeHead( f12_arg2, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head].MakeModelName( f12_local4, f12_arg3, f12_arg5 ) ) + f12_local0[f12_local3] = f12_arg3 + f12_local0[f12_local2] = f12_local4 + return f12_local0 +end + +f0_local4.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Helmet +f0_local4.GetUIMaterial = function ( f13_arg0 ) + return "icon_aar_helmet" +end + +f0_local4.IsEntitlementColumn = 4 +f0_local4.HideUnlessUnlockedColumn = 5 +f0_local4.CustomUnlockText = 6 +f0_local4.DLCOffer = 8 +f0_local4.ReleaseKillswitch = 9 +f0_local4.GetDefaultRef = function ( f14_arg0, f14_arg1 ) + local f14_local0 = Cac.Customization.GetElementRefsForField( f14_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet], f14_arg1 ) + assert( #f14_local0 > 0 ) + return f14_local0[1] +end + +f0_local5 = { + csv = "mp/cac/bodies.csv", + LocName = "BODY", + UnlockType = "Body", + PublicOnly = false, + ImpactsPlayercard = false, + SaveRef = function ( f15_arg0, f15_arg1, f15_arg2, f15_arg3 ) + local f15_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f15_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + Cac.SetBodyIndex( f15_arg0, f15_arg1, f15_arg2, f15_arg3 ) + local f15_local2 = Cac.GetGenderFromBodyRef( f15_arg3 ) + if f15_local2 == Cac.Customization.Gender.Special then + Cac.SetHelmetIndex( f15_arg0, f15_arg1, f15_arg2, f15_local1.NoneRef ) + Cac.SetHeadIndex( f15_arg0, f15_arg1, f15_arg2, f15_local0.GetDefaultRef( f15_arg0, f15_local2 ) ) + elseif not Cac.IsCommonGender( f15_local2 ) then + local f15_local3 = f15_local0.GetDefaultRef( f15_arg0, f15_local2 ) + Cac.SetHelmetIndex( f15_arg0, f15_arg1, f15_arg2, f15_local1.NoneRef ) + Cac.SetHeadIndex( f15_arg0, f15_arg1, f15_arg2, f15_local3 ) + elseif not Cac.IsCommonGender( Cac.GetGenderFromHeadRef( f15_local0.GetSavedRef( f15_arg0, f15_arg1, f15_arg2 ) ) ) then + Cac.SetHeadIndex( f15_arg0, f15_arg1, f15_arg2, f15_local0.GetDefaultRef( f15_arg0, f15_local2 ) ) + end + end, + GetSavedRef = function ( f16_arg0, f16_arg1, f16_arg2 ) + return Cac.GetBodyIndex( f16_arg0, f16_arg1, f16_arg2 ) + end, + GetSavedModel = function ( f17_arg0, f17_arg1, f17_arg2 ) + local f17_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + return f17_local0.MakeModelName( f17_local0.GetSavedRef( f17_arg0, f17_arg1, f17_arg2 ) ) + end, + SelectionPopup = "cac_customize_buttons_popup" +} +local f0_local6 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local6 then + f0_local6 = LUI.mp_menus.CacCustomize.CustomizePopupGridGenericButton +end +f0_local5.SelectionButtonFactory = f0_local6 +f0_local5.GetName = function ( f18_arg0 ) + return Engine.TableLookup( "mp/cac/bodies.csv", 0, f18_arg0, 2 ) +end + +f0_local5.PreviewFunction = function ( f19_arg0, f19_arg1, f19_arg2, f19_arg3, f19_arg4, f19_arg5 ) + local f19_local0 = {} + local f19_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + local f19_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f19_local3 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f19_local4 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body].MakeModelName( f19_arg3, f19_arg5 ) + local f19_local5 = Cac.GetGenderFromBodyRef( f19_arg3 ) + local f19_local6 = Cac.GetSquadLoc() + CharacterScene.ChangeBody( f19_arg2, f19_local4, Cac.GetPatchIndex( f19_arg0, f19_local6, f19_arg4 ) ) + if Cac.IsCommonGender( f19_local5 ) then + if not Cac.IsCommonGender( Cac.GetGenderFromHeadRef( f19_local2.GetSavedRef( f19_arg0, f19_local6, f19_arg4 ) ) ) then + local f19_local7 = f19_local2.GetDefaultRef( f19_arg0, f19_local5 ) + CharacterScene.ChangeHead( f19_arg2, f19_local2.MakeModelName( f19_local7 ) ) + f19_local0[f19_local2] = f19_local7 + end + elseif f19_local5 == Cac.Customization.Gender.Special then + + else + local f19_local7 = f19_local2.GetDefaultRef( f19_arg0, f19_local5 ) + CharacterScene.ChangeHead( f19_arg2, f19_local2.MakeModelName( f19_local7 ) ) + f19_local0[f19_local3] = f19_local3.NoneRef + f19_local0[f19_local2] = f19_local7 + end + f19_local0[f19_local1] = f19_arg3 + return f19_local0 +end + +f0_local5.MakeModelName = function ( f20_arg0, f20_arg1 ) + if not f20_arg1 then + f20_arg1 = Cac.GetDefaultBodyCamoRef() + end + return Engine.TableLookup( "mp/cac/bodies.csv", 0, f20_arg0, 1 ) .. Cac.GetBodyCamoSuffix( f20_arg1 ) +end + +f0_local5.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Default +f0_local5.GetUIMaterial = function ( f21_arg0 ) + return "icon_aar_uniform" +end + +f0_local5.GenderColumn = 4 +f0_local5.IsEntitlementColumn = 6 +f0_local5.HideUnlessUnlockedColumn = 7 +f0_local5.CustomUnlockText = 8 +f0_local5.DLCOffer = 10 +f0_local5.ReleaseKillswitch = 11 +f0_local5.GetDefaultRef = function ( f22_arg0, f22_arg1 ) + local f22_local0 = Cac.Customization.GetElementRefsForField( f22_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body], f22_arg1 ) + assert( #f22_local0 > 0 ) + return f22_local0[1] +end + +f0_local6 = { + csv = "mp/cac/patches.csv", + LocName = "PATCH", + UnlockType = "Patch", + PublicOnly = true, + ImpactsPlayercard = true, + SaveRef = function ( f23_arg0, f23_arg1, f23_arg2, f23_arg3 ) + Cac.SetPatchIndex( f23_arg0, f23_arg1, f23_arg2, f23_arg3 ) + end, + GetSavedRef = function ( f24_arg0, f24_arg1, f24_arg2 ) + return Cac.GetPatchIndex( f24_arg0, f24_arg1, f24_arg2 ) + end, + SelectionPopup = "cac_customize_grid_popup" +} +local f0_local7 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local7 then + f0_local7 = LUI.mp_menus.CacCustomize.CustomizePopupGridGraphicalButton +end +f0_local6.SelectionButtonFactory = f0_local7 +f0_local6.CategoryColumn = 5 +f0_local6.CategoryNameColumn = 6 +f0_local6.CategoryDLCName = "DLC" +f0_local6.GetName = function ( f25_arg0 ) + return Engine.TableLookup( "mp/cac/patches.csv", 0, f25_arg0, 2 ) +end + +f0_local6.GetQuip = function ( f26_arg0 ) + return Engine.TableLookup( "mp/cac/patches.csv", 0, f26_arg0, 3 ) +end + +f0_local6.PreviewFunction = function ( f27_arg0, f27_arg1, f27_arg2, f27_arg3, f27_arg4, f27_arg5 ) + CharacterScene.ChangeBody( f27_arg2, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body].MakeModelName( Cac.GetBodyIndex( f27_arg0, Cac.GetSquadLoc(), f27_arg4 ), f27_arg5 ), f27_arg3 ) + f27_arg1:processEvent( { + name = "update_playercard", + patchEmblem = f27_arg3 + } ) +end + +f0_local6.InitFunction = function ( f28_arg0, f28_arg1, f28_arg2, f28_arg3, f28_arg4 ) + f28_arg1:processEvent( { + name = "update_playercard", + patchEmblem = f28_arg3 + } ) +end + +f0_local6.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Patch +f0_local6.GetUIMaterial = function ( f29_arg0 ) + return Engine.TableLookup( "mp/cac/patches.csv", 0, f29_arg0, 4 ) +end + +f0_local6.IsEntitlementColumn = 7 +f0_local6.HideUnlessUnlockedColumn = 8 +f0_local6.CustomUnlockText = 9 +f0_local6.DLCOffer = 10 +f0_local6.ReleaseKillswitch = 11 +f0_local6.HideIfItemColumn = 12 +f0_local6.GetDefaultRef = function ( f30_arg0, f30_arg1 ) + local f30_local0 = Cac.Customization.GetElementRefsForField( f30_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch], f30_arg1 ) + assert( #f30_local0 > 0 ) + return f30_local0[1] +end + +f0_local7 = { + csv = "mp/cac/patchbackings.csv", + LocName = "PATCHBACKING", + UnlockType = "Patchbacking", + PublicOnly = true, + ImpactsPlayercard = true, + SaveRef = function ( f31_arg0, f31_arg1, f31_arg2, f31_arg3 ) + Cac.SetPatchbackingIndex( f31_arg0, f31_arg1, f31_arg2, f31_arg3 ) + end, + GetSavedRef = function ( f32_arg0, f32_arg1, f32_arg2 ) + return Cac.GetPatchbackingIndex( f32_arg0, f32_arg1, f32_arg2 ) + end, + SelectionPopup = "cac_customize_grid_popup" +} +local f0_local8 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local8 then + f0_local8 = LUI.mp_menus.CacCustomize.CustomizePopupGridGraphicalButton +end +f0_local7.SelectionButtonFactory = f0_local8 +f0_local7.CategoryColumn = 3 +f0_local7.CategoryNameColumn = 4 +f0_local7.GetName = function ( f33_arg0 ) + return Engine.TableLookup( "mp/cac/patchbackings.csv", 0, f33_arg0, 1 ) +end + +f0_local7.PreviewFunction = function ( f34_arg0, f34_arg1, f34_arg2, f34_arg3, f34_arg4 ) + f34_arg1:processEvent( { + name = "update_playercard", + patchShape = f34_arg3 + } ) +end + +f0_local7.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Patch +f0_local7.GetUIMaterial = function ( f35_arg0 ) + return Engine.TableLookup( "mp/cac/patchbackings.csv", 0, f35_arg0, 2 ) +end + +f0_local7.IsEntitlementColumn = 5 +f0_local7.HideUnlessUnlockedColumn = 6 +f0_local7.CustomUnlockText = 7 +f0_local8 = { + csv = "mp/cac/backgrounds.csv", + LocName = "BACKGROUND", + UnlockType = "Background", + PublicOnly = true, + ImpactsPlayercard = true, + SaveRef = function ( f36_arg0, f36_arg1, f36_arg2, f36_arg3 ) + Cac.SetBackgroundIndex( f36_arg0, f36_arg1, f36_arg2, f36_arg3 ) + end, + GetSavedRef = function ( f37_arg0, f37_arg1, f37_arg2 ) + return Cac.GetBackgroundIndex( f37_arg0, f37_arg1, f37_arg2 ) + end, + SelectionPopup = "cac_customize_vlist_popup" +} +local f0_local9 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local9 then + f0_local9 = LUI.mp_menus.CacCustomize.CustomizePopupGridGraphicalButton +end +f0_local8.SelectionButtonFactory = f0_local9 +f0_local8.CategoryColumn = 4 +f0_local8.CategoryNameColumn = 5 +f0_local8.CategoryDLCName = "DLC Backgrounds" +f0_local8.GetName = function ( f38_arg0 ) + return Engine.TableLookup( "mp/cac/backgrounds.csv", 0, f38_arg0, 2 ) +end + +f0_local8.PreviewFunction = function ( f39_arg0, f39_arg1, f39_arg2, f39_arg3, f39_arg4 ) + f39_arg1:processEvent( { + name = "update_character_bg", + material = RegisterMaterial( Engine.TableLookup( "mp/cac/backgrounds.csv", 0, f39_arg3, 1 ) ) + } ) + f39_arg1:processEvent( { + name = "update_playercard", + background = f39_arg3 + } ) +end + +f0_local8.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Default +f0_local8.GetUIMaterial = function ( f40_arg0 ) + return Engine.TableLookup( "mp/cac/backgrounds.csv", 0, f40_arg0, 3 ) +end + +f0_local8.IsEntitlementColumn = 6 +f0_local8.HideUnlessUnlockedColumn = 7 +f0_local8.CustomUnlockText = 8 +f0_local8.DLCOffer = 9 +f0_local8.ReleaseKillswitch = 10 +f0_local8.HideIfItemColumn = 11 +f0_local8.GetDefaultRef = function ( f41_arg0, f41_arg1 ) + local f41_local0 = Cac.Customization.GetElementRefsForField( f41_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Background], f41_arg1 ) + assert( #f41_local0 > 0 ) + return f41_local0[1] +end + +f0_local9 = { + LocName = "CLAN_TAG", + UnlockType = "ClanTag", + PublicOnly = false, + ImpactsPlayercard = true, + SaveRef = function () + + end, + GetSavedRef = function ( f43_arg0 ) + return Engine.GetProfileDataUseEliteClanTag( f43_arg0 ) and Engine.GetClanTag( f43_arg0 ) or Engine.GetCustomClanTag( f43_arg0 ) + end, + SelectionPopup = "cac_customize_clan_tag_popup", + PreviewFunction = function ( f44_arg0, f44_arg1, f44_arg2, f44_arg3, f44_arg4 ) + f44_arg1:processEvent( { + name = "update_playercard", + clantag = f44_arg3 + } ) + end +} +local f0_local10 = { + csv = "mp/cac/dogs.csv", + UnlockType = "GuardDog", + LocName = "GUARD_DOG", + PublicOnly = false, + ImpactsPlayercard = false, + SaveRef = function ( f45_arg0, f45_arg1, f45_arg2, f45_arg3 ) + Engine.SetPlayerDataReservedInt( f45_arg0, CoD.StatsGroup.Common, "mp_dog_type", f45_arg3 ) + end, + GetSavedRef = function ( f46_arg0 ) + return Engine.GetPlayerDataReservedInt( f46_arg0, CoD.StatsGroup.Common, "mp_dog_type" ) + end, + GetDefaultRef = function () + return 0 + end, + buttonVariant = GenericButtonSettings.Variants.Info, + SelectionPopup = "cac_customize_small_popup", + HelpText = "LUA_MENU_GUARD_DOG_CHOICE_MESSAGE", + GetName = function ( f48_arg0 ) + return Engine.TableLookup( "mp/cac/dogs.csv", 0, tostring( f48_arg0 ), 1 ) + end, + IsUnlocked = function ( f49_arg0, f49_arg1 ) + return Lobby.IsItemOfTypeUnlocked( f49_arg0, Engine.TableLookup( "mp/cac/dogs.csv", 0, tostring( f49_arg1 ), 2 ), "DLC" ) + end, + DLCOffer = 3, + GetUIMaterial = function ( f50_arg0 ) + return Engine.TableLookup( "mp/cac/dogs.csv", 0, f50_arg0, 4 ) + end, + IsEntitlementColumn = 5 +} +local f0_local11 = { + csv = "mp/cac/announcers.csv", + LocName = "ANNOUNCER", + UnlockType = "Announcer", + PublicOnly = false, + ImpactsPlayercard = false, + SaveRef = function ( f51_arg0, f51_arg1, f51_arg2, f51_arg3 ) + f51_arg3 = tonumber( f51_arg3 ) + assert( f51_arg3 and f51_arg3 < 128 ) + Engine.SetPlayerDataReservedInt( f51_arg0, CoD.StatsGroup.Common, "mp_announcer_type", f51_arg3 ) + end, + GetSavedRef = function ( f52_arg0 ) + return Engine.GetPlayerDataReservedInt( f52_arg0, CoD.StatsGroup.Common, "mp_announcer_type" ) + end, + IsReleased = function ( f53_arg0 ) + return Engine.IsAnnouncerReleased( f53_arg0 ) + end, + IsUnlocked = function ( f54_arg0, f54_arg1 ) + return Engine.IsAnnouncerUnlocked( f54_arg1 ) + end, + DLCOffer = 3, + SelectionPopup = "cac_customize_small_popup", + HelpText = "LUA_MENU_MP_CHOOSE_ANNOUNCER", + PreviewFunction = function ( f55_arg0, f55_arg1, f55_arg2, f55_arg3, f55_arg4 ) + local f55_local0 = Engine.TableLookup( "mp/cac/announcers.csv", 0, tostring( f55_arg3 ), 2 ) + if f55_local0 ~= "" then + return Engine.PlaySound( f55_local0 ) + else + + end + end, + GetDefaultRef = function () + return 0 + end, + GetName = function ( f57_arg0 ) + return Engine.TableLookup( "mp/cac/announcers.csv", 0, tostring( f57_arg0 ), 1 ) + end, + buttonVariant = GenericButtonSettings.Variants.Info, + IsEntitlementColumn = 4 +} +f0_local2[1] = f0_local3 +f0_local2[2] = f0_local4 +f0_local2[3] = f0_local5 +f0_local2[4] = f0_local6 +f0_local2[5] = f0_local7 +f0_local2[6] = f0_local8 +f0_local2[7] = f0_local9 +f0_local2[8] = f0_local10 +f0_local2[9] = f0_local11 +f0_local1.Fields = f0_local2 +f0_local1.Camos = { + File = "mp/cac/camos.csv", + Cols = { + Ref = 0, + Suffix = 1, + Name = 2, + HeadSuffix = 3 + } +} +f0_local0.Customization = f0_local1 +Cac.Customization.GetReqsStringForItem = function ( f58_arg0, f58_arg1, f58_arg2, f58_arg3, f58_arg4 ) + local f58_local0 = "" + local f58_local1 = "" + if SvS.IsSvS() then + if IsPublicMatch() then + f58_local1 = Engine.Localize( "LUA_MENU_PLAY_ONLINE_TO_UNLOCK" ) + end + return f58_local0, f58_local1 + elseif Cac.IsCustomizationItemDLC( f58_arg1, f58_arg0 ) and Cac.IsCustomizationItemUnlocked( f58_arg2, f58_arg1, f58_arg0 ) == true then + f58_local0 = "@DLC_ALREADY_PURCHASED" + else + f58_local0 = Engine.TableLookup( f58_arg1.csv, 0, f58_arg0, f58_arg1.CustomUnlockText ) + end + if f58_local0 ~= "" then + f58_local0 = Engine.Localize( f58_local0 ) + end + if f58_local0 == "" and (IsPublicMatch() or IsOnlineAliens()) then + local f58_local2 = getUnlockReqsForItemOfType( f58_arg0, f58_arg1.UnlockType ) + if f58_local2.chalAndTier ~= "" then + f58_local0, f58_local1 = getUnlockInfoStrings( f58_local2.chalAndTier, f58_arg2, f58_arg3, f58_arg4 ) + elseif f58_local2.rank ~= "" and tonumber( f58_local2.rank ) > 0 then + f58_local0 = Engine.Localize( "@LUA_MENU_UNLOCKED_AT_RANK", tonumber( f58_local2.rank ) + 1 ) + elseif f58_local2.rankExt ~= "" and tonumber( f58_local2.rankExt ) > 0 then + f58_local0 = Engine.Localize( "@LUA_MENU_UNLOCKED_EXT_RANK", tonumber( f58_local2.rankExt ) + 1 ) + elseif f58_local2.prestigeExt ~= "" and tonumber( f58_local2.prestigeExt ) > 0 then + f58_local0 = Engine.Localize( "@ALIENS_REQ_PRESTIGE", tonumber( f58_local2.prestigeExt ) ) + elseif f58_local2.prestige ~= "" and tonumber( f58_local2.prestige ) > 0 then + f58_local0 = Engine.Localize( "@LUA_MENU_REACH_PRESTIGE", tonumber( f58_local2.prestige ) ) + elseif f58_local2.escapesExt ~= "" and tonumber( f58_local2.escapesExt ) > 0 then + local f58_local3 = tonumber( f58_local2.escapesExt ) + if f58_local3 == 1 then + f58_local0 = Engine.Localize( "@ALIENS_REQ_ESCAPE" ) + else + f58_local0 = Engine.Localize( "@ALIENS_REQ_ESCAPE_N_TIMES", f58_local3 ) + end + elseif f58_local2.highestRelicEscapeExt ~= "" and tonumber( f58_local2.highestRelicEscapeExt ) > 0 then + f58_local0 = Engine.Localize( "@ALIENS_REQ_N_RELICS", tonumber( f58_local2.highestRelicEscapeExt ) ) + elseif f58_local2.killsExt ~= "" and tonumber( f58_local2.killsExt ) > 0 then + f58_local0 = Engine.Localize( "@ALIENS_REQ_N_KILLS", tonumber( f58_local2.killsExt ) ) + elseif f58_local2.revivesExt ~= "" and tonumber( f58_local2.revivesExt ) > 0 then + f58_local0 = Engine.Localize( "@ALIENS_REQ_N_REVIVES", tonumber( f58_local2.revivesExt ) ) + else + f58_local0 = Engine.Localize( "@LUA_MENU_UNLOCKED_BY_DEFAULT" ) + end + end + return f58_local0, f58_local1 +end + +function makeGenderFilter( f59_arg0 ) + if type( f59_arg0 ) == "string" then + return function ( f60_arg0 ) + return f60_arg0 == f59_arg0 + end + + else + return f59_arg0 + end +end + +Cac.Customization.GetElementRefsForField = function ( f61_arg0, f61_arg1, f61_arg2 ) + assert( f61_arg1.csv ) + local f61_local0 = {} + local f61_local1 = 0 + local f61_local2 = 1000 + local f61_local3 = f61_arg2 and f61_arg1.GenderColumn + f61_arg2 = makeGenderFilter( f61_arg2 ) + for f61_local4 = f61_local1, f61_local2, 1 do + if Engine.TableLookup( f61_arg1.csv, 0, tostring( f61_local4 ), 0 ) == "" then + break + elseif not Cac.ShouldConcealCacItem( f61_arg0, f61_arg1, tostring( f61_local4 ) ) and (not f61_local3 or f61_arg2( Engine.TableLookup( f61_arg1.csv, 0, tostring( f61_local4 ), f61_arg1.GenderColumn ) )) then + table.insert( f61_local0, tostring( f61_local4 ) ) + end + end + return f61_local0 +end + +Cac.Customization.GetElementCountForField = function ( f62_arg0 ) + local f62_local0 = 0 + local f62_local1 = Engine.TableLookup( f62_arg0.csv, 0, tostring( f62_local0 ), 2 ) + while f62_local1 ~= "" do + f62_local0 = f62_local0 + 1 + f62_local1 = Engine.TableLookup( f62_arg0.csv, 0, tostring( f62_local0 ), 2 ) + end + return f62_local0 +end + +Cac.Customization.GetCategorizedElementRefsForField = function ( f63_arg0, f63_arg1, f63_arg2 ) + local f63_local0 = {} + local f63_local1 = f63_arg2 and f63_arg1.GenderColumn + f63_arg2 = makeGenderFilter( f63_arg2 ) + if f63_arg1.CategoryColumn and f63_arg1.CategoryNameColumn then + local f63_local2 = 0 + local f63_local3 = 1000 + local f63_local4 = f63_arg1.unlockType + local f63_local5 = {} + local f63_local6 = "" + local f63_local7 = 0 + for f63_local8 = f63_local2, f63_local3, 1 do + if Engine.TableLookup( f63_arg1.csv, 0, tostring( f63_local8 ), 1 ) == "" then + break + elseif not Cac.ShouldConcealCacItem( f63_arg0, f63_arg1, tostring( f63_local8 ) ) then + local f63_local11 = Engine.TableLookup( f63_arg1.csv, 0, tostring( f63_local8 ), f63_arg1.CategoryColumn ) + if not f63_local5[f63_local11] then + table.insert( f63_local0, { + name = Engine.Localize( Engine.TableLookup( f63_arg1.csv, 0, tostring( f63_local8 ), f63_arg1.CategoryNameColumn ) ), + elements = {}, + dlc = f63_arg1.CategoryDLCName == f63_local11 + } ) + f63_local5[f63_local11] = #f63_local0 + end + if not f63_local1 or f63_arg2( Engine.TableLookup( f63_arg1.csv, 0, tostring( f63_local8 ), f63_arg1.GenderColumn ) ) then + f63_local7 = f63_local5[f63_local11] + table.insert( f63_local0[f63_local5[f63_local11]].elements, tostring( f63_local8 ) ) + end + end + end + if f63_arg1.CategoryDLCName then + for f63_local12, f63_local13 in ipairs( f63_local0 ) do + if f63_local13.dlc then + f63_local13.elements = LUI.ReverseTable( f63_local13.elements ) + end + end + end + else + f63_local0 = { + { + name = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_" .. f63_arg1.LocName .. "_CAPS" ), + elements = Cac.Customization.GetElementRefsForField( f63_arg0, f63_arg1, f63_arg2 ) + } + } + local f63_local2 = function ( f64_arg0, f64_arg1 ) + local f64_local0 = tonumber( f64_arg0 ) + local f64_local1 = tonumber( f64_arg1 ) + local f64_local2 = Cac.IsCustomizationItemDLC( f63_arg1, f64_local0 ) + local f64_local3 = Cac.IsCustomizationItemDLC( f63_arg1, f64_local1 ) + if f64_local2 ~= f64_local3 then + return f64_local3 + elseif f64_local2 then + return f64_local1 < f64_local0 + else + return f64_local0 < f64_local1 + end + end + + for f63_local6, f63_local7 in ipairs( f63_local0 ) do + table.sort( f63_local7.elements, f63_local2 ) + end + end + return f63_local0 +end + +Cac.GetDefaultBodyModel = function ( f65_arg0, f65_arg1 ) + local f65_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + return f65_local0.MakeModelName( f65_local0.GetDefaultRef( f65_arg0, f65_arg1 ) ) +end + +Cac.GetDefaultHeadModel = function ( f66_arg0, f66_arg1 ) + local f66_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + return f66_local0.MakeModelName( f66_local0.GetDefaultRef( f66_arg0, f66_arg1 ) ) +end + +Cac.GetDefaultBodyCamoRef = function () + return Engine.TableLookupByRow( Cac.Customization.Camos.File, 4, Cac.Customization.Camos.Cols.Ref ) +end + +Cac.GetCamoRefs = function () + local f68_local0 = {} + local f68_local1 = 0 + local f68_local2 = 1000 + for f68_local3 = f68_local1, f68_local2, 1 do + if Engine.TableLookup( Cac.Customization.Camos.File, Cac.Customization.Camos.Cols.Ref, tostring( f68_local3 ), Cac.Customization.Camos.Cols.Suffix ) == "" then + break + end + table.insert( f68_local0, tostring( f68_local3 ) ) + end + return f68_local0 +end + +Cac.GetBodyCamoSuffix = function ( f69_arg0 ) + return Engine.TableLookup( Cac.Customization.Camos.File, Cac.Customization.Camos.Cols.Ref, f69_arg0, Cac.Customization.Camos.Cols.Suffix ) +end + +Cac.GetHeadCamoSuffix = function ( f70_arg0 ) + return Engine.TableLookup( Cac.Customization.Camos.File, Cac.Customization.Camos.Cols.Ref, f70_arg0, Cac.Customization.Camos.Cols.HeadSuffix ) +end + +Cac.GetBodyCamoName = function ( f71_arg0 ) + return Engine.Localize( Engine.TableLookup( Cac.Customization.Camos.File, Cac.Customization.Camos.Cols.Ref, f71_arg0, Cac.Customization.Camos.Cols.Name ) ) +end + +Cac.GetHeadIndex = function ( f72_arg0, f72_arg1, f72_arg2 ) + return Cac.GetCacConfig( f72_arg0, f72_arg1, f72_arg2, "head" ) +end + +Cac.SetHeadIndex = function ( f73_arg0, f73_arg1, f73_arg2, f73_arg3 ) + Cac.SetCacConfig( f73_arg0, f73_arg1, f73_arg2, "head", f73_arg3 ) +end + +Cac.GetHelmetIndex = function ( f74_arg0, f74_arg1, f74_arg2 ) + return Cac.GetCacConfig( f74_arg0, f74_arg1, f74_arg2, "helmet" ) +end + +Cac.SetHelmetIndex = function ( f75_arg0, f75_arg1, f75_arg2, f75_arg3 ) + Cac.SetCacConfig( f75_arg0, f75_arg1, f75_arg2, "helmet", f75_arg3 ) +end + +Cac.GetBodyIndex = function ( f76_arg0, f76_arg1, f76_arg2 ) + return Cac.GetCacConfig( f76_arg0, f76_arg1, f76_arg2, "body" ) +end + +Cac.SetBodyIndex = function ( f77_arg0, f77_arg1, f77_arg2, f77_arg3 ) + Cac.SetCacConfig( f77_arg0, f77_arg1, f77_arg2, "body", f77_arg3 ) +end + +Cac.GetPatchIndex = function ( f78_arg0, f78_arg1, f78_arg2 ) + return Cac.GetCacConfig( f78_arg0, f78_arg1, f78_arg2, "patch" ) +end + +Cac.SetPatchIndex = function ( f79_arg0, f79_arg1, f79_arg2, f79_arg3 ) + Cac.SetCacConfig( f79_arg0, f79_arg1, f79_arg2, "patch", f79_arg3 ) +end + +Cac.GetPatchbackingIndex = function ( f80_arg0, f80_arg1, f80_arg2 ) + return Cac.GetCacConfig( f80_arg0, f80_arg1, f80_arg2, "patchbacking" ) +end + +Cac.SetPatchbackingIndex = function ( f81_arg0, f81_arg1, f81_arg2, f81_arg3 ) + Cac.SetCacConfig( f81_arg0, f81_arg1, f81_arg2, "patchbacking", f81_arg3 ) +end + +Cac.GetBackgroundIndex = function ( f82_arg0, f82_arg1, f82_arg2 ) + return Cac.GetCacConfig( f82_arg0, f82_arg1, f82_arg2, "background" ) +end + +Cac.SetBackgroundIndex = function ( f83_arg0, f83_arg1, f83_arg2, f83_arg3 ) + Cac.SetCacConfig( f83_arg0, f83_arg1, f83_arg2, "background", f83_arg3 ) +end + +Cac.SetDogIndex = function ( f84_arg0, f84_arg1 ) + Engine.SetPlayerDataEx( f84_arg0, CoD.StatsGroup.Ranked, "dogType", f84_arg1 ) +end + +Cac.GetGenderFromHeadRef = function ( f85_arg0 ) + local f85_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + return Engine.TableLookup( f85_local0.csv, 0, f85_arg0, f85_local0.GenderColumn ) +end + +Cac.GetGenderFromBodyRef = function ( f86_arg0 ) + local f86_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + return Engine.TableLookup( f86_local0.csv, 0, f86_arg0, f86_local0.GenderColumn ) +end + +Cac.GetCurrentGender = function ( f87_arg0, f87_arg1, f87_arg2 ) + return Cac.GetGenderFromBodyRef( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body].GetSavedRef( f87_arg0, f87_arg1, f87_arg2 ) ) +end + +Cac.IsCommonGender = function ( f88_arg0 ) + local f88_local0 + if f88_arg0 ~= Cac.Customization.Gender.Male and f88_arg0 ~= Cac.Customization.Gender.Female then + f88_local0 = false + else + f88_local0 = true + end + return f88_local0 +end + +Cac.ResetGenderDependantFields = function ( f89_arg0, f89_arg1, f89_arg2, f89_arg3 ) + assert( f89_arg3 ) + for f89_local7, f89_local8 in ipairs( Cac.Customization.Fields ) do + if f89_local8.GenderColumn then + for f89_local3 = 0, 1000, 1 do + local f89_local6 = tostring( f89_local3 ) + if Engine.TableLookup( f89_local8.csv, 0, f89_local6, 1 ) == "" then + DebugPrint( "WARNING: did not find a suitable value when resetting field " .. f89_local8.LocName .. " with gender restriction " .. f89_arg3 ) + end + if f89_arg3 == Engine.TableLookup( f89_local8.csv, 0, tostring( f89_local3 ), f89_local8.GenderColumn ) then + f89_local8.SaveRef( f89_arg0, f89_arg1, f89_arg2, f89_local6 ) + end + end + end + end +end + +Cac.IsCustomizationItemUnlocked = function ( f90_arg0, f90_arg1, f90_arg2, f90_arg3 ) + return Cac.IsLoadOutItemUnlocked( f90_arg0, f90_arg1, f90_arg2, f90_arg3 ) +end + +Cac.IsCamoReticleItemUnlocked = function ( f91_arg0, f91_arg1, f91_arg2, f91_arg3 ) + return Cac.IsLoadOutItemUnlocked( f91_arg0, f91_arg1, f91_arg2, f91_arg3 ) +end + +Cac.IsWeaponItemUnlocked = function ( f92_arg0, f92_arg1, f92_arg2, f92_arg3 ) + return Cac.IsLoadOutItemUnlocked( f92_arg0, f92_arg1, f92_arg2, f92_arg3 ) +end + +Cac.IsLoadOutItemUnlocked = function ( f93_arg0, f93_arg1, f93_arg2, f93_arg3 ) + if Engine.IsUserAGuest( f93_arg0 ) or not Engine.IsUserSignedInToLive( f93_arg0 ) then + f93_arg0 = Engine.GetFirstActiveController() + end + if f93_arg1.IsUnlocked then + return f93_arg1.IsUnlocked( f93_arg0, f93_arg2 ) + elseif IsPublicMatch() or f93_arg3 or IsOnlineAliens() then + return Lobby.IsItemOfTypeUnlocked( f93_arg0, f93_arg2, f93_arg1.UnlockType ) + else + return true + end +end + +Cac.IsCustomizationItemDLC = function ( f94_arg0, f94_arg1 ) + assert( f94_arg0.csv ) + if f94_arg0.DLCOffer and Engine.TableLookup( f94_arg0.csv, 0, f94_arg1, f94_arg0.DLCOffer ) ~= "" then + return true + elseif f94_arg0.IsEntitlementColumn and Engine.TableLookup( f94_arg0.csv, 0, f94_arg1, f94_arg0.IsEntitlementColumn ) == "2" then + return true + elseif f94_arg0.SecondaryEntitlementColumn and Engine.TableLookup( f94_arg0.csv, 0, f94_arg1, f94_arg0.SecondaryEntitlementColumn ) == "2" then + return true + else + return false + end +end + +Cac.ShouldConcealCacItem = function ( f95_arg0, f95_arg1, f95_arg2 ) + if f95_arg1.HideIfItemColumn then + local f95_local0 = Engine.TableLookup( f95_arg1.csv, 0, f95_arg2, f95_arg1.HideIfItemColumn ) + if f95_local0 ~= "" and Cac.IsLoadOutItemUnlocked( f95_arg0, f95_arg1, f95_local0 ) then + return true + end + end + if f95_arg1.IsReleased and not f95_arg1.IsReleased( f95_arg2 ) then + return true + end + local f95_local0 = f95_arg1.IsEntitlementColumn and Engine.TableLookup( f95_arg1.csv, 0, f95_arg2, f95_arg1.IsEntitlementColumn ) or nil + local f95_local1 = f95_arg1.SecondaryEntitlementColumn and Engine.TableLookup( f95_arg1.csv, 0, f95_arg2, f95_arg1.SecondaryEntitlementColumn ) or nil + local f95_local2 + if f95_local0 ~= "2" and f95_local1 ~= "2" then + f95_local2 = false + else + f95_local2 = true + end + local f95_local3 + if f95_local0 ~= "3" and f95_local1 ~= "3" then + f95_local3 = false + else + f95_local3 = true + end + if ((f95_arg1.HideUnlessUnlockedColumn and Engine.TableLookup( f95_arg1.csv, 0, f95_arg2, f95_arg1.HideUnlessUnlockedColumn ) or false) == "1" or (f95_local2 or f95_local3) and not IsPublicMatch() and not IsOnlineAliens()) and not Cac.IsLoadOutItemUnlocked( f95_arg0, f95_arg1, f95_arg2, true ) then + return true + elseif f95_arg1.ReleaseKillswitch and (f95_local0 ~= "1" or not Cac.IsLoadOutItemUnlocked( f95_arg0, f95_arg1, f95_arg2, true )) then + local f95_local4 = Engine.TableLookup( f95_arg1.csv, 0, f95_arg2, f95_arg1.ReleaseKillswitch ) + local f95_local5 + if f95_local4 ~= "" and Engine.GetDvarInt( f95_local4 ) ~= 1 then + f95_local5 = false + else + f95_local5 = true + end + if not f95_local5 then + return true + end + end + return false +end + +Cac.DoesHeadUseHelmet = function ( f96_arg0 ) + local f96_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + return Engine.TableLookup( f96_local0.csv, 0, f96_arg0, f96_local0.UseHelmetColumn ) == "1" +end + +Cac.GetRandomIdleAnim = function ( f97_arg0, f97_arg1 ) + local f97_local0 = Cac.Customization.Animations.idles.normal + if Engine.IsAliensMode() then + f97_local0 = Cac.Customization.Animations.idles.pistol + elseif string.find( f97_arg0, "riotshield" ) then + f97_local0 = Cac.Customization.Animations.idles.riotshield + elseif string.find( f97_arg0, "knifeonly" ) then + f97_local0 = Cac.Customization.Animations.idles.knifeonly + end + local f97_local1 = math.random( 1, #f97_local0 ) + if f97_arg1 and f97_local0[f97_local1] == f97_arg1 and #f97_local0 > 1 then + if #f97_local0 < f97_local1 + 1 then + f97_local1 = f97_local1 - 1 + else + f97_local1 = f97_local1 + 1 + end + end + return f97_local0[f97_local1] +end + +NewIconsTable = { + File = "mp/mDLCNewIcons.csv", + Cols = { + Idx = 0, + Item = 1, + Type = 2, + ReleaseKillswitch = 3 + }, + Size = 600, + CACItemTypes = { + "Weapon_Primary", + "Weapon_Secondary", + "Camo", + "Patch", + "Background", + "Head", + "Helmet", + "Body", + "Special", + "LoadoutSlot", + "Announcer" + } +} +Cac.TryGetFieldFromType = function ( f98_arg0 ) + for f98_local3, f98_local4 in ipairs( Cac.Customization.Fields ) do + if f98_local4.UnlockType then + if f98_local4.UnlockType == f98_arg0 then + return f98_local4 + elseif f98_arg0 == "Special" and f98_local4.UnlockType == "Body" then + return f98_local4 + end + end + end +end + +Cac.AnyUnseenMDLCItems = function ( f99_arg0, f99_arg1, f99_arg2 ) + if not Engine.InFrontend() or not IsPublicMatch() then + return false + elseif f99_arg2 then + f99_arg2 = makeGenderFilter( f99_arg2 ) + end + local f99_local0 = {} + local f99_local1 = 0 + local f99_local2 = 0 + repeat + local f99_local3 = Engine.TableLookupByRow( NewIconsTable.File, f99_local2, NewIconsTable.Cols.Item ) + local f99_local4 = Engine.TableLookupByRow( NewIconsTable.File, f99_local2, NewIconsTable.Cols.Type ) + local f99_local5 = Engine.TableLookupByRow( NewIconsTable.File, f99_local2, NewIconsTable.Cols.ReleaseKillswitch ) + if f99_local3 == "" then + break + else + if f99_local5 ~= "" and Engine.GetDvarInt( f99_local5 ) ~= 1 then + local f99_local6 = false + else + local f99_local6 = true + end + if f99_local5 == "AnnouncerCheck" then + local f99_local6 = Engine.IsAnnouncerReleased( f99_local3 ) + end + if f99_local6 and not Engine.GetPlayerDataEx( f99_arg0, CoD.StatsGroup.Common, "iconNew", f99_local2 ) then + local f99_local7 = false + if f99_local4 == "Camo" then + f99_local7 = Cac.ShouldHideCamoOrReticleEntitlement( f99_arg0, f99_local3 ) + else + local f99_local8 = Cac.TryGetFieldFromType( f99_local4 ) + if f99_local8 then + if Cac.ShouldConcealCacItem( f99_arg0, f99_local8, f99_local3 ) then + f99_local7 = true + elseif f99_arg2 and f99_local8.GenderColumn and not f99_arg2( Engine.TableLookup( f99_local8.csv, 0, tostring( f99_local3 ), f99_local8.GenderColumn ) ) then + f99_local7 = true + end + end + end + if not f99_local7 then + if not f99_local0[f99_local4] then + f99_local0[f99_local4] = {} + end + table.insert( f99_local0[f99_local4], f99_local3 ) + f99_local1 = f99_local1 + 1 + end + end + f99_local2 = f99_local2 + 1 + end + until f99_local2 >= NewIconsTable.Size + if f99_arg1 then + for f99_local6, f99_local7 in pairs( f99_arg1 ) do + if f99_local0[f99_local7] then + return true + end + end + return false + else + return f99_local1 > 0 + end +end + +Cac.GetRowForNewIconItem = function ( f100_arg0, f100_arg1 ) + local f100_local0 = 0 + repeat + local f100_local1 = Engine.TableLookupByRow( NewIconsTable.File, f100_local0, NewIconsTable.Cols.Item ) + local f100_local2 = Engine.TableLookupByRow( NewIconsTable.File, f100_local0, NewIconsTable.Cols.Type ) + if f100_local1 == "" then + return nil + elseif f100_local1 == f100_arg0 and f100_local2 == f100_arg1 then + return f100_local0 + end + f100_local0 = f100_local0 + 1 + until f100_local0 >= NewIconsTable.Size +end + +Cac.ItemHasNewIcon = function ( f101_arg0, f101_arg1, f101_arg2, f101_arg3 ) + local f101_local0 = false + if Engine.InFrontend() and IsPublicMatch() then + if f101_arg3 then + if not Cac.ShouldConcealCacItem( f101_arg0, f101_arg3, f101_arg1 ) then + local f101_local1 = Cac.GetRowForNewIconItem( f101_arg1, f101_arg2 or f101_arg3.UnlockType ) + if f101_local1 and not Engine.GetPlayerDataEx( f101_arg0, CoD.StatsGroup.Common, "iconNew", f101_local1 ) then + f101_local0 = true + end + end + else + local f101_local1 = Cac.GetRowForNewIconItem( f101_arg1, f101_arg2 ) + if f101_local1 and not Engine.GetPlayerDataEx( f101_arg0, CoD.StatsGroup.Common, "iconNew", f101_local1 ) then + f101_local0 = true + end + end + end + return f101_local0 +end + +Cac.MarkItemNoMoreNewIcon = function ( f102_arg0, f102_arg1, f102_arg2 ) + local f102_local0 = Cac.GetRowForNewIconItem( f102_arg1, f102_arg2 ) + if f102_local0 then + Engine.SetPlayerDataEx( f102_arg0, CoD.StatsGroup.Common, "iconNew", f102_local0, true ) + end +end + +Cac.ClearAllNewIconsForType = function ( f103_arg0, f103_arg1 ) + local f103_local0 = 0 + repeat + local f103_local1 = Engine.TableLookupByRow( NewIconsTable.File, f103_local0, NewIconsTable.Cols.Item ) + local f103_local2 = Engine.TableLookupByRow( NewIconsTable.File, f103_local0, NewIconsTable.Cols.Type ) + if f103_local1 == "" then + break + else + if f103_local2 == f103_arg1 then + Engine.SetPlayerDataEx( f103_arg0, CoD.StatsGroup.Common, "iconNew", f103_local0, true ) + end + f103_local0 = f103_local0 + 1 + end + until f103_local0 >= NewIconsTable.Size +end + +Cac.AnyNewIconsForWeaponsOfClass = function ( f104_arg0, f104_arg1 ) + if not Engine.InFrontend() or not IsPublicMatch() then + return false + end + local f104_local0 = 0 + repeat + local f104_local1 = Engine.TableLookupByRow( NewIconsTable.File, f104_local0, NewIconsTable.Cols.Item ) + local f104_local2 = Engine.TableLookupByRow( NewIconsTable.File, f104_local0, NewIconsTable.Cols.Type ) + if f104_local1 == "" then + break + else + if f104_local2 == "Weapon_Primary" or f104_local2 == "Weapon_Secondary" then + local f104_local3 = Engine.TableLookupByRow( NewIconsTable.File, f104_local0, NewIconsTable.Cols.ReleaseKillswitch ) + local f104_local4 + if f104_local3 ~= "" and Engine.GetDvarInt( f104_local3 ) ~= 1 then + f104_local4 = false + else + f104_local4 = true + end + if f104_local4 and Cac.GetWeaponClass( f104_local1 ) == f104_arg1 and not Engine.GetPlayerDataEx( f104_arg0, CoD.StatsGroup.Common, "iconNew", f104_local0 ) then + return true + end + end + f104_local0 = f104_local0 + 1 + end + until f104_local0 >= NewIconsTable.Size + return false +end + +Cac.ValidateCustomizationItems = function ( f105_arg0, f105_arg1, f105_arg2 ) + for f105_local6, f105_local7 in ipairs( Cac.Customization.Fields ) do + if f105_local7.GetSavedRef and f105_local7.GetDefaultRef and f105_local7.SaveRef then + local f105_local3 = f105_local7.GetSavedRef( f105_arg0, f105_arg1, f105_arg2 ) + local f105_local4 = true + if f105_arg1 == "privateMatchSquadMembers" and Cac.IsCustomizationItemDLC( f105_local7, f105_local3 ) then + f105_local4 = Cac.IsCustomizationItemUnlocked( f105_arg0, f105_local7, f105_local3, true ) + else + f105_local4 = Cac.IsCustomizationItemUnlocked( f105_arg0, f105_local7, f105_local3, false ) + end + if f105_local3 and not f105_local4 then + local f105_local5 = Cac.GetCurrentGender( f105_arg0, f105_arg1, f105_arg2 ) + if f105_local7.GenderColumn and not Cac.IsCommonGender( f105_local5 ) then + Cac.ResetGenderDependantFields( f105_arg0, f105_arg1, f105_arg2, Cac.Customization.Gender.Male ) + else + f105_local7.SaveRef( f105_arg0, f105_arg1, f105_arg2, f105_local7.GetDefaultRef( f105_arg0, f105_local5 ) ) + end + end + end + end +end + diff --git a/lui/common_menus/cacutils.dec.lua b/lui/common_menus/cacutils.dec.lua new file mode 100644 index 0000000..1c72f4c --- /dev/null +++ b/lui/common_menus/cacutils.dec.lua @@ -0,0 +1,426 @@ +Cac = { + Settings = { + DataLoc = { + squadMembers = { + maxClassSlots = 10 + }, + privateMatchSquadMembers = { + maxClassSlots = 6 + }, + coopSquadMembers = { + maxClassSlots = 1 + }, + loadouts = { + maxClassSlots = 10, + baseClassSlots = 6 + }, + defaultClassesTeam0 = { + maxClassSlots = 6, + teamName = "allies" + }, + defaultClassesTeam1 = { + maxClassSlots = 6, + baseClassSlots = 6, + teamName = "axis", + infectedString = Engine.Localize( "LUA_MENU_INFECT_CAPS" ), + string = Engine.Localize( "@LUA_MENU_AXIS_CAPS" ) + }, + defaultClassesTeam2 = { + maxClassSlots = 6, + baseClassSlots = 6, + teamName = "allies", + infectedString = Engine.Localize( "LUA_MENU_MP_SURVIVORS_CAPS" ), + string = Engine.Localize( "@LUA_MENU_ALLIES_CAPS" ) + }, + defaultClassesTeam3 = { + teamName = "spectator" + } + }, + minUsableSlots = 5 + }, + MemberCost = { + 0, + 3, + 3, + 3, + 3, + 3, + 200, + 300, + 400, + 500 + } +} +if MatchRules then + MatchRules.AllowCustomClasses = function ( f1_arg0 ) + if not MatchRules.IsUsingMatchRulesData() then + return false + else + local f1_local0 + if f1_arg0 then + f1_local0 = Cac.IsDefaultClass( f1_arg0 ) + if not f1_local0 then + + elseif not f1_local0 then + return MatchRules.GetData( "commonOption", "allowCustomClasses" ) + else + + end + end + end + f1_local0 = false + end + +end +Cac.GetCacConfig = function ( f2_arg0, f2_arg1, f2_arg2, ... ) + local f2_local0 = { + ... + } + for f2_local1 = 1, #f2_local0, 1 do + if type( f2_local0[f2_local1] ) == "string" and Cac.IsDefaultClass( f2_local0[f2_local1] ) then + local f2_local4 = Cac.Settings.DataLoc[f2_local0[f2_local1]].teamName + local f2_local5 = f2_local0[f2_local1 + 1] + table.remove( f2_local0, 1 ) + table.remove( f2_local0, 1 ) + return MatchRules.GetData( "defaultClasses", f2_local4, f2_local5, "class", unpack( f2_local0 ) ) + end + end + local f2_local1 = CoD.GetStatsGroupForSquadLocation( f2_arg1 ) + if f2_local0[1] == "loadouts" and type( f2_local0[2] ) == "number" then + local f2_local2 = f2_local0[1] + local f2_local3 = f2_local0[2] + if Cac.Settings.DataLoc[f2_local2].baseClassSlots <= f2_local3 then + table.remove( f2_local0, 1 ) + table.remove( f2_local0, 1 ) + return Engine.GetPlayerDataExtendedEx( f2_arg0, f2_local1, f2_arg1, f2_arg2, f2_local2, f2_local3 - Cac.Settings.DataLoc[f2_local2].baseClassSlots, unpack( f2_local0 ) ) + end + end + return Engine.GetPlayerDataEx( f2_arg0, f2_local1, f2_arg1, f2_arg2, ... ) +end + +Cac.SetCacConfig = function ( f3_arg0, f3_arg1, f3_arg2, ... ) + local f3_local0 = { + ... + } + for f3_local1 = 1, #f3_local0, 1 do + if type( f3_local0[f3_local1] ) == "string" and Cac.IsDefaultClass( f3_local0[f3_local1] ) then + local f3_local4 = Cac.Settings.DataLoc[f3_local0[f3_local1]].teamName + local f3_local5 = f3_local0[f3_local1 + 1] + table.remove( f3_local0, 1 ) + table.remove( f3_local0, 1 ) + return MatchRules.SetData( "defaultClasses", f3_local4, f3_local5, "class", unpack( f3_local0 ) ) + end + end + local f3_local1 = CoD.GetStatsGroupForSquadLocation( f3_arg1 ) + if f3_local0[1] == "loadouts" and type( f3_local0[2] ) == "number" then + local f3_local2 = f3_local0[1] + local f3_local3 = f3_local0[2] + if Cac.Settings.DataLoc[f3_local2].baseClassSlots <= f3_local3 then + table.remove( f3_local0, 1 ) + table.remove( f3_local0, 1 ) + return Engine.SetPlayerDataExtendedEx( f3_arg0, f3_local1, f3_arg1, f3_arg2, f3_local2, f3_local3 - Cac.Settings.DataLoc[f3_local2].baseClassSlots, unpack( f3_local0 ) ) + end + end + return Engine.SetPlayerDataEx( f3_arg0, f3_local1, f3_arg1, f3_arg2, ... ) +end + +Cac.GetNumCustomSlots = function ( f4_arg0, f4_arg1 ) + if not f4_arg1 then + f4_arg1 = Cac.GetCustomClassLoc() + end + if Cac.IsDefaultClass( f4_arg1 ) or IsOnlineMatch() and (Engine.HasExtendedLoadouts( f4_arg0 ) or not IsPrivateMatch()) and Engine.GetDvarInt( "extendedLoadoutsEnable" ) == 1 then + return Cac.Settings.DataLoc[f4_arg1].maxClassSlots + else + return Cac.Settings.DataLoc[f4_arg1].baseClassSlots + end +end + +Cac.IsClassInUse = function ( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4 ) + local f5_local0 = nil + local f5_local1 = Cac.IsDefaultClass( f5_arg3 ) + if f5_arg1 == "privateMatchSquadMembers" and not f5_local1 and f5_arg4 < Cac.Settings.DataLoc[f5_arg3].baseClassSlots then + f5_local0 = true + else + f5_local0 = Cac.GetCacConfig( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, "inUse" ) + if not f5_local1 and Engine.InFrontend() and f5_arg4 <= 2 and not f5_local0 then + Cac.SetClassInUse( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, true ) + end + end + return f5_local0 +end + +Cac.SetClassInUse = function ( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5 ) + if f6_arg5 == nil then + f6_arg5 = true + end + return Cac.SetCacConfig( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, "inUse", f6_arg5 ) +end + +Cac.IsSquadMemberInUse = function ( f7_arg0, f7_arg1, f7_arg2 ) + local f7_local0 = nil + if f7_arg1 == "privateMatchSquadMembers" then + f7_local0 = true + else + f7_local0 = Cac.GetCacConfig( f7_arg0, f7_arg1, f7_arg2, "inUse" ) + end + return f7_local0 +end + +Cac.SetSquadMemberInUse = function ( f8_arg0, f8_arg1, f8_arg2 ) + return Cac.SetCacConfig( f8_arg0, f8_arg1, f8_arg2, "inUse", true ) +end + +Cac.HasCustomClasses = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3 ) + local f9_local0 = false + for f9_local1 = 0, Cac.GetNumCustomSlots( f9_arg0, f9_arg3 ) - 1, 1 do + if Cac.IsClassInUse( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_local1 ) then + f9_local0 = true + break + end + end + return f9_local0 +end + +Cac.GetFirstCustomClass = function ( f10_arg0, f10_arg1, f10_arg2, f10_arg3 ) + for f10_local0 = 0, Cac.GetNumCustomSlots( f10_arg0, f10_arg3 ) - 1, 1 do + if Cac.IsClassInUse( f10_arg0, f10_arg1, f10_arg2, f10_arg3, f10_local0 ) then + return f10_local0 + end + end + assert( Cac.HasCustomClasses( f10_arg0, f10_arg1, f10_arg2, f10_arg3 ) ) + return 0 +end + +Cac.IsCaCSlotRestricted = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3, f11_arg4 ) + local f11_local0 = false + if MatchRules.AllowCustomClasses( f11_arg3 ) then + if not f11_arg3 then + f11_arg3 = Cac.GetCustomClassLoc() + end + if not Engine.InFrontend() and f11_arg3 == "loadouts" then + local f11_local1 = CoD.GetStatsGroupForGameMode() + if MatchRules.CustomClassIsRestricted( f11_arg0, CoD.GetStatsGroupForGameMode(), f11_arg1, f11_arg2, f11_arg3, f11_arg4 ) then + f11_local0 = true + end + end + end + return f11_local0 +end + +Cac.IsCaCSlotLocked = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + if not Cac.IsDefaultClass( f12_arg3 ) then + return not Cac.IsClassInUse( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + else + + end +end + +Cac.GetSquadLoc = function () + local f13_local0 + if not Engine.GetDvarBool( "onlinegame" ) or Engine.GetDvarBool( "xblive_privatematch" ) then + f13_local0 = Engine.GetDvarBool( "force_ranking" ) + else + f13_local0 = true + end + if Engine.IsAliensMode() then + return "coopSquadMembers" + elseif f13_local0 then + return "squadMembers" + else + return "privateMatchSquadMembers" + end +end + +Cac.GetEditSquadMember = function () + return Engine.GetDvarInt( "ui_editSquadMemberIndex" ) or 0 +end + +Cac.SetEditSquadMember = function ( f15_arg0 ) + Engine.SetDvarInt( "ui_editSquadMemberIndex", f15_arg0 ) +end + +Cac.GetActiveSquadMember = function ( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg1 or CoD.GetStatsGroupForGameMode() + if f16_local0 ~= CoD.StatsGroup.Ranked or not "activeSquadMember" then + local f16_local1 = "privateMatchActiveSquadMember" + end + if Engine.IsAliensMode() then + local f16_local1 = "coopActiveSquadMember" + end + return Engine.GetPlayerDataEx( f16_arg0, f16_local0, f16_local1 ) +end + +Cac.SetActiveSquadMember = function ( f17_arg0, f17_arg1 ) + local f17_local0 = CoD.GetStatsGroupForGameMode() + local f17_local1 + if f17_local0 == CoD.StatsGroup.Ranked then + f17_local1 = "activeSquadMember" + if not f17_local1 then + + else + Engine.SetPlayerDataEx( f17_arg0, f17_local0, f17_local1, f17_arg1 ) + if f17_local0 == CoD.StatsGroup.Ranked then + syncXP( f17_arg0, f17_arg1 ) + end + Cac.SyncPrivateDataFromPlayercard( f17_arg0 ) + end + end + f17_local1 = "privateMatchActiveSquadMember" +end + +Cac.SyncPrivateDataFromPlayercard = function ( f18_arg0 ) + local f18_local0 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "activeSquadMember" ) + local f18_local1 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "squadMembers", f18_local0, "patch" ) + local f18_local2 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "squadMembers", f18_local0, "patchbacking" ) + local f18_local3 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "squadMembers", f18_local0, "background" ) + for f18_local4 = 0, Cac.Settings.DataLoc.privateMatchSquadMembers.maxClassSlots - 1, 1 do + Engine.SetPlayerDataEx( f18_arg0, CoD.StatsGroup.Private, "privateMatchSquadMembers", f18_local4, "patch", f18_local1 ) + Engine.SetPlayerDataEx( f18_arg0, CoD.StatsGroup.Private, "privateMatchSquadMembers", f18_local4, "patchbacking", f18_local2 ) + Engine.SetPlayerDataEx( f18_arg0, CoD.StatsGroup.Private, "privateMatchSquadMembers", f18_local4, "background", f18_local3 ) + end +end + +Cac.GetCustomClassLoc = function ( f19_arg0 ) + local f19_local0 = "loadouts" + if f19_arg0 ~= nil then + f19_local0 = f19_arg0 + elseif not MatchRules.AllowCustomClasses( f19_arg0 ) then + if not Engine.InFrontend() then + f19_local0 = "defaultClassesTeam1" + else + f19_local0 = "defaultClassesTeam1" + end + end + return f19_local0 +end + +Cac.GetLoadoutName = function ( f20_arg0, f20_arg1, f20_arg2, f20_arg3, f20_arg4 ) + local f20_local0 = Cac.GetCacConfig( f20_arg0, f20_arg1, f20_arg2, f20_arg3, f20_arg4, "name" ) + if f20_local0 == "" then + f20_local0 = Engine.Localize( "@MP_LOADOUT_DEFAULT_NAME", f20_arg4 + 1 ) + end + return f20_local0 +end + +Cac.MaxSquadMemberCount = function ( f21_arg0 ) + return Cac.Settings.DataLoc[f21_arg0].maxClassSlots +end + +Cac.ActiveSquadMemberCount = function ( f22_arg0, f22_arg1 ) + local f22_local0 = 0 + for f22_local1 = 0, Cac.MaxSquadMemberCount( f22_arg1 ) - 1, 1 do + if Cac.IsSquadMemberInUse( f22_arg0, f22_arg1, f22_local1 ) then + f22_local0 = f22_local0 + 1 + end + end + return f22_local0 +end + +Cac.AddNewSquadMember = function ( f23_arg0, f23_arg1 ) + local f23_local0 = Cac.ActiveSquadMemberCount( f23_arg0, f23_arg1 ) + if f23_local0 + 1 <= Cac.MaxSquadMemberCount( f23_arg1 ) then + Cac.SetSquadMemberInUse( f23_arg0, f23_arg1, f23_local0 ) + return f23_local0 + else + DebugPrint( "WARNING: Attempting to add squad member when we are already at max. Ignoring..." ) + end +end + +Cac.UnlockSquadMember = function ( f24_arg0, f24_arg1, f24_arg2 ) + if f24_arg2 < Cac.MaxSquadMemberCount( f24_arg1 ) then + Cac.SetSquadMemberInUse( f24_arg0, f24_arg1, f24_arg2 ) + else + DebugPrint( "WARNING: Attempting to unlock squad member past the max index. Ignoring..." ) + end + local f24_local0 = Cac.ActiveSquadMemberCount( f24_arg0, f24_arg1 ) + for f24_local1 = 1, f24_local0, 1 do + Engine.SetPlayerDataEx( f24_arg0, CoD.GetStatsGroupForGameMode(), "challengeState", "ch_squad_member" .. f24_local1 .. "_purchase", 2 ) + end +end + +Cac.GetSquadMemberName = function ( f25_arg0, f25_arg1, f25_arg2 ) + return Engine.GetPlayerDataEx( f25_arg0, CoD.GetStatsGroupForGameMode(), f25_arg1, f25_arg2, "name" ) +end + +Cac.SetSquadMemberName = function ( f26_arg0, f26_arg1, f26_arg2, f26_arg3 ) + return Engine.SetPlayerDataEx( f26_arg0, CoD.GetStatsGroupForGameMode(), f26_arg1, f26_arg2, "name", f26_arg3 ) +end + +Cac.HasSquadMemberPrestiged = function ( f27_arg0, f27_arg1, f27_arg2 ) + return Engine.GetPlayerDataEx( f27_arg0, CoD.GetStatsGroupForGameMode(), f27_arg1, f27_arg2, "squadMemXP" ) >= Rank.GetRankMaxXP( Rank.GetMaxRank() ) +end + +Cac.GetSquadMemberPrestigeLevel = function ( f28_arg0, f28_arg1, f28_arg2 ) + if not Cac.HasSquadMemberPrestiged( f28_arg0, f28_arg1, f28_arg2 ) then + return 0 + end + local f28_local0 = 1 + local f28_local1 = Engine.GetPlayerDataEx( f28_arg0, CoD.GetStatsGroupForGameMode(), "characterXP", f28_arg2 ) + for f28_local2 = 0, Cac.MaxSquadMemberCount( f28_arg1 ) - 1, 1 do + if f28_local2 ~= f28_arg2 and Cac.IsSquadMemberInUse( f28_arg0, f28_arg1, f28_local2 ) and Cac.HasSquadMemberPrestiged( f28_arg0, f28_arg1, f28_local2 ) and Engine.GetPlayerDataEx( f28_arg0, CoD.GetStatsGroupForGameMode(), "characterXP", f28_local2 ) < f28_local1 then + f28_local0 = f28_local0 + 1 + end + end + return f28_local0 +end + +Cac.GetPrestigeLevel = function ( f29_arg0, f29_arg1 ) + local f29_local0 = 0 + for f29_local1 = 0, Cac.MaxSquadMemberCount( f29_arg1 ) - 1, 1 do + if Cac.IsSquadMemberInUse( f29_arg0, f29_arg1, f29_local1 ) and Cac.HasSquadMemberPrestiged( f29_arg0, f29_arg1, f29_local1 ) then + f29_local0 = f29_local0 + 1 + end + end + return f29_local0 +end + +Cac.SyncPrestigeLevel = function ( f30_arg0 ) + Engine.SetPlayerDataEx( f30_arg0, CoD.GetStatsGroupForGameMode(), "prestige", Cac.GetPrestigeLevel( f30_arg0, Cac.GetSquadLoc() ) ) +end + +Cac.GetSquadMemberLoadoutUnlockCost = function ( f31_arg0 ) + if Cac.Settings.DataLoc.loadouts.baseClassSlots <= f31_arg0 then + return 0 + else + return 20 + (f31_arg0 - 3) * 5 + end +end + +Cac.ValidateAllPlayersPrivateSquadMembers = function () + for f32_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.HasActiveLocalClient( f32_local0 ) and Engine.HasPlayerData( f32_local0 ) then + if not Lobby.IsItemOfTypeUnlocked( f32_local0, "wolf", "DLC" ) then + DebugPrint( "You are not Entitled to the Wolf. So removing." ) + Engine.SetPlayerDataReservedInt( f32_local0, CoD.StatsGroup.Common, "mp_dog_type", 0 ) + end + for f32_local3 = 0, Cac.MaxSquadMemberCount( "privateMatchSquadMembers" ) - 1, 1 do + Cac.ValidateCustomizationItems( f32_local0, "privateMatchSquadMembers", f32_local3 ) + if not Engine.IsAliensMode() then + Cac.ValidateLoadoutItems( f32_local0, "privateMatchSquadMembers", f32_local3, "loadouts" ) + end + end + if not Engine.IsAliensMode() then + Cac.ValidateCustomizationItems( f32_local0, "squadMembers", Cac.GetActiveSquadMember( f32_local0, CoD.StatsGroup.Ranked ) ) + end + end + end +end + +Cac.ValidateAllPlayersPublicSquadMembers = function () + local f33_local0 = Cac.GetSquadLoc() + assert( f33_local0 ~= "privateMatchSquadMembers", "Cac.GetSquadLoc() returned private match location in public lobby." ) + for f33_local1 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.HasActiveLocalClient( f33_local1 ) then + if not Lobby.IsItemOfTypeUnlocked( f33_local1, "wolf", "DLC" ) then + DebugPrint( "You are not Entitled to the Wolf. So removing." ) + Engine.SetPlayerDataReservedInt( f33_local1, CoD.StatsGroup.Common, "mp_dog_type", 0 ) + end + local f33_local4 = Cac.GetActiveSquadMember( f33_local1 ) + Cac.ValidateCustomizationItems( f33_local1, f33_local0, f33_local4 ) + if not Engine.IsAliensMode() then + Cac.ValidateLoadoutItems( f33_local1, "squadMembers", f33_local4, "loadouts" ) + end + end + end +end + diff --git a/lui/common_menus/commonpopups.dec.lua b/lui/common_menus/commonpopups.dec.lua new file mode 100644 index 0000000..18e0f16 --- /dev/null +++ b/lui/common_menus/commonpopups.dec.lua @@ -0,0 +1,2095 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function readingsavedevice() + return { + type = "generic_popup_message", + id = "readingsavedevice_id", + properties = { + message_text = Engine.Localize( "@PLATFORM_READING_SAVE_DEVICE" ) + }, + handlers = { + menu_close = MBh.EmitEventToRoot( { + name = "finish_read_device" + } ) + } + } +end + +f0_local0 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = Engine.GetDvarString( "com_errorTitle" ) + local f2_local1 = Engine.GetDvarString( "com_errorMessage" ) + local f2_local2 = { + name = "update_title", + title_text = f2_local0 + } + local f2_local3 = { + name = "update_message", + message_text = f2_local1 + } + f2_arg0:dispatchEventToChildren( f2_local2 ) + f2_arg0:dispatchEventToChildren( f2_local3 ) + local f2_local4 = Engine.GetLuiRoot() + if f2_local4:IsMenuOpenAndVisible( "menu_splitscreensignin" ) then + Engine.ExecNow( "incnosplitscreencontrol errorpopup" ) + end +end + +f0_local1 = function () + Engine.ClearError( Engine.GetFirstActiveController() ) + local f3_local0 = Engine.GetLuiRoot() + if f3_local0:IsMenuOpenAndVisible( "menu_splitscreensignin" ) then + Engine.ExecNow( "decnosplitscreencontrol errorpopup" ) + end +end + +function errorPopupClosePlus( f4_arg0, f4_arg1 ) + if Engine.ShowPSPlusUpsell then + Engine.ShowPSPlusUpsell( f4_arg1.controller ) + end +end + +function error_popmenu() + return { + type = "generic_confirmation_popup", + id = "error_popup_id", + handlers = { + menu_create = f0_local0 + } + } +end + +function error_popmenu_party() + return { + type = "generic_confirmation_popup", + id = "error_popmenu_party_id", + handlers = { + menu_create = f0_local0 + } + } +end + +function error_popmenu_psplus_party() + return { + type = "generic_confirmation_popup", + id = "error_popmenu_party_plus_id", + properties = { + confirmation_action = errorPopupClosePlus + }, + handlers = { + menu_create = f0_local0 + } + } +end + +f0_local2 = function ( f8_arg0, f8_arg1 ) + DebugPrint( "QUIT GAME NOW" ) + Engine.Quit() +end + +function quit_popmenu() + return { + type = "generic_yesno_popup", + id = "quit_confirmation_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_QUIT_WARNING" ), + yes_action = f0_local2 + } + } +end + +function error_popmenu_submenu() + return { + type = "generic_confirmation_popup", + id = "error_popmenu_submenu_id", + handlers = { + menu_create = f0_local0 + } + } +end + +local f0_local3 = function ( f11_arg0, f11_arg1 ) + DebugPrint( "Applying video settings with restart..." ) + if Engine.GetDvarString( "gameMode" ) == "sp" and not Engine.GetDvarBool( "sv_running" ) then + if Engine.GetDvarInt( "ui_zfeather" ) == 1 then + Engine.Exec( "set cg_laserLight 1" ) + else + Engine.Exec( "set cg_laserLight 0" ) + end + end + Engine.ExecNow( "exec options_graphics_set.cfg" ) + Engine.Exec( "wait; wait; r_applyPicmip" ) + Engine.Exec( "setfromdvar snd_outputConfiguration ui_OutputConfig" ) + Engine.Exec( "setfromdvar snd_enableEq ui_snd_enableEq" ) + Engine.Exec( "snd_restart" ) + Engine.Exec( "regeneratePlaylistPopulationImage" ) +end + +local f0_local4 = function ( f12_arg0, f12_arg1 ) + DebugPrint( "Applying video settings..." ) + if Engine.GetDvarString( "gameMode" ) == "sp" and not Engine.GetDvarBool( "sv_running" ) then + if Engine.GetDvarInt( "ui_zfeather" ) == 1 then + Engine.Exec( "set cg_laserLight 1" ) + else + Engine.Exec( "set cg_laserLight 0" ) + end + end + Engine.ExecNow( "exec options_graphics_set.cfg" ) +end + +local f0_local5 = function ( f13_arg0, f13_arg1 ) + DebugPrint( "No setting video settings..." ) + Engine.ExecNow( "exec options_graphics.cfg" ) + Engine.Exec( "setfromdvar ui_snd_enableEq\tsnd_enableEq" ) + Engine.Exec( "setfromdvar ui_outputConfig\tsnd_outputConfiguration" ) + Engine.SetOldLocalVarBool( f13_arg1.controller, "ui_showAudioApply", false ) + Engine.SetOldLocalVarBool( f13_arg1.controller, "ui_showApply", false ) +end + +local f0_local6 = function ( f14_arg0 ) + local f14_local0 = {} + if not Engine.InFrontend() then + f14_local0[#f14_local0 + 1] = { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_PAUSED_CAPS" ) + } + } + f14_local0[#f14_local0 + 1] = { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + } + end + return f14_local0 +end + +function apply_settings_restart_popmenu() + return { + type = "generic_yesno_popup", + id = "apply_video_restart_popmenu_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS" ), + message_text = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS_MESSAGE" ), + yes_action = f0_local3, + no_action = f0_local5 + }, + childrenFeeder = f0_local6 + } +end + +function apply_settings_popmenu() + return { + type = "generic_yesno_popup", + id = "apply_video_popmenu_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS" ), + message_text = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS_MESSAGE" ), + yes_action = f0_local4, + no_action = f0_local5 + }, + childrenFeeder = f0_local6 + } +end + +function show_low_texture_res_warning_restart_popmenu() + return { + type = "generic_yesno_popup", + id = "show_low_texture_res_warning_restart_popmenu_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS" ), + message_text = Engine.Localize( "@MENU_VIDEO_SETTINGS_TEXTURE_WARNING" ), + yes_action = f0_local3, + no_action = f0_local5 + }, + childrenFeeder = f0_local6 + } +end + +function show_low_texture_res_warning_popmenu() + return { + type = "generic_yesno_popup", + id = "show_low_texture_res_warning_popmenu_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS" ), + message_text = Engine.Localize( "@MENU_VIDEO_SETTINGS_TEXTURE_WARNING" ), + yes_action = f0_local4, + no_action = f0_local5 + }, + childrenFeeder = f0_local6 + } +end + +local f0_local7 = function ( f19_arg0, f19_arg1 ) + Engine.Exec( "xsignin", f19_arg1.controller ) +end + +local f0_local8 = function ( f20_arg0, f20_arg1 ) + LUI.FlowManager.RequestAddMenu( f20_arg0, "boot_brightness", false, f20_arg1.controller, true, {} ) +end + +function no_profile_warning_popmenu() + return { + type = "generic_yesno_popup", + id = "no_profile_warning_popmenu_id", + properties = { + popup_title = Engine.Localize( "@MENU_WARNING" ), + message_text = Engine.Localize( "@MENU_SP_PROFILE_WARNING_SP" ), + yes_action = f0_local7, + no_action = f0_local8 + } + } +end + +local f0_local9 = function ( f22_arg0, f22_arg1 ) + Engine.DeleteProfile( f22_arg1.controller ) + Engine.Exec( "xsignin", f22_arg1.controller ) + LUI.FlowManager.RequestAddMenu( f22_arg0, "boot_brightness", false, f22_arg1.controller, true, {} ) +end + +function error_corrupt_savedata() + return { + type = "generic_confirmation_popup", + id = "error_corrupt_savedata_id", + properties = { + cancel_will_close = false, + popup_title = Engine.Localize( "@MENU_CORRUPT_SAVEDATA_TITLE" ), + message_text = Engine.Localize( "@MENU_CORRUPT_SAVEDATA_MESSAGE" ), + button_text = Engine.Localize( "@MENU_OK" ), + confirmation_action = f0_local9 + } + } +end + +local f0_local10 = function ( f24_arg0, f24_arg1 ) + Engine.RetrySaveData( f24_arg1.controller ) +end + +local f0_local11 = function ( f25_arg0, f25_arg1 ) + Engine.ClearSaveDataErrors( f25_arg1.controller ) +end + +function savedata_failed_popmenu() + return { + type = "generic_yesno_popup", + id = "savedata_failed_popmenu_id", + properties = { + popup_title = Engine.Localize( "@MENU_SAVEDATA_FAILED_TITLE" ), + message_text = Engine.Localize( "@MENU_SAVEDATA_FAILED_MESSAGE" ), + yes_action = f0_local10, + no_action = f0_local11 + } + } +end + +function no_profile_force_popmenu() + return { + type = "generic_confirmation_popup", + id = "no_profile_force_popmenu_id", + properties = { + popup_title = Engine.Localize( "@MENU_WARNING" ), + message_text = Engine.Localize( "@LUA_MENU_PROFILE_FORCE_SP" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } +end + +function live_party_invite_popmenu() + return { + type = "generic_yesno_popup", + id = "live_party_invite_popmenu_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@XBOXLIVE_PARTY_INVITE" ), + yes_text = Engine.Localize( "@XBOXLIVE_PARTY_INVITE_ACCEPT_NOW" ), + yes_action = function ( f29_arg0, f29_arg1 ) + Friends.AcceptLivePartyInvitation( f29_arg1.controller ) + end + , + no_text = Engine.Localize( "@XBOXLIVE_PARTY_INVITE_ACCEPT_LATER" ), + no_action = function ( f30_arg0, f30_arg1 ) + + end + + } + } +end + +function sign_in_as_sub_or_guest() + return { + type = "generic_yesno_popup", + id = "sign_in_as_sub_or_guest_id", + properties = { + popup_title = Engine.Localize( "@MENU_SIGN_IN_GUEST_OR_SUB_TITLE" ), + message_text = Engine.Localize( "@MENU_SIGN_IN_GUEST_OR_SUB_TEXT" ), + yes_text = Engine.Localize( "@MENU_SIGN_IN_GUEST_OR_SUB_YES" ), + yes_action = function ( f32_arg0, f32_arg1 ) + Lobby.DoSubSignIn( f32_arg1.controller ) + end + , + no_text = Engine.Localize( "@MENU_SIGN_IN_GUEST_OR_SUB_NO" ), + no_action = function ( f33_arg0, f33_arg1 ) + Lobby.DoGuestSignIn( f33_arg1.controller ) + end + + } + } +end + +function TryDisplayingAliensUnlockedPopup( f34_arg0 ) + if Engine.IsAliensMode( f34_arg0 ) then + Engine.Exec( "profile_SetKnowsAboutAliens", f34_arg0 ) + return false + end + local f34_local0 = Engine.IsUserSignedIn( f34_arg0 ) and Engine.UnlockedAliens() and Engine.GetProfileData( "knowsAboutAliens", f34_arg0 ) == false + if f34_local0 then + LUI.FlowManager.RequestPopupMenu( self, "aliens_unlocked_popup", true, f34_arg0, nil, nil, nil, nil, false ) + Engine.Exec( "profile_SetKnowsAboutAliens", f34_arg0 ) + end + return f34_local0 +end + +function aliens_unlocked_popup() + return { + type = "generic_confirmation_popup", + id = "aliens_unlocked_popup", + properties = { + popup_title = Engine.Localize( "MENU_NOTICE" ), + message_text = Engine.Localize( "LUA_MENU_UNLOCKED_ALIENS" ) + } + } +end + +function CancelAcceptingInvite( f36_arg0, f36_arg1 ) + local f36_local0 = f36_arg1.controller + Engine.SetDvarBool( "onlinegame", false ) + Engine.SetDvarBool( "systemlink", false ) + Engine.SetDvarBool( "specialops", false ) + Engine.SetDvarBool( "so_survival", false ) + Engine.Exec( "stopPrivateListen", f36_local0 ) + Engine.Exec( "coopStopSearch", f36_local0 ) + Engine.Exec( "useonlinestats 0", f36_local0 ) + Engine.Exec( "statsdownloadcancel", f36_local0 ) + Engine.Exec( "xstopparty WAITING_POPUP_CANCELED_ACTION", f36_local0 ) + Engine.Exec( "xstopprivateparty", f36_local0 ) + Engine.Exec( "xcancelconnectingdialog", f36_local0 ) + Engine.Exec( "forcesplitscreencontrol WAITING_POPUP_CANCELED_ACTION", f36_local0 ) + LUI.FlowManager.RequestLeaveMenu( f36_arg0 ) +end + +function popup_acceptinginvite() + return { + type = "live_dialog_text_box_with_cancel", + id = "popup_acceptinginvite_id", + properties = { + message = Engine.Localize( "@MENU_POPUP_ACCEPTINVITE" ), + cancel_func = CancelAcceptingInvite + } + } +end + +function UpdateTextDots( f38_arg0, f38_arg1 ) + assert( f38_arg0.properties.numDots ) + assert( f38_arg0.properties.message ) + local f38_local0 = f38_arg0.properties.numDots + local f38_local1 = f38_arg0.properties.message + f38_local0 = (f38_local0 + 1) % 4 + for f38_local2 = 1, f38_local0, 1 do + local f38_local5 = f38_local2 + f38_local1 = f38_local1 .. ". " + end + f38_arg0:setText( f38_local1 ) + f38_arg0.properties.numDots = f38_local0 +end + +function live_dialog_processing_widget() + local f39_local0 = 1 + local f39_local1 = 300 / 1.8 + local f39_local2 = { + alpha = 1, + scale = -1 + } + local f39_local3 = { + alpha = 1, + scale = 0.4 + } + local f39_local4 = { + alpha = 1, + scale = 0 + } + local f39_local5 = { + alpha = 0.25, + scale = 0 + } + local f39_local6 = MBh.AnimateSequence( { + { + "state0", + 0 / f39_local0 + }, + { + "state1", + 150 / f39_local0, + true, + true + }, + { + "state2", + 100 / f39_local0, + true, + true + }, + { + "state3", + 300 / f39_local0, + true, + true + } + } ) + return { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -DialogWidgetDims.Width / 2, + bottom = DialogWidgetDims.Width / 2, + left = -DialogWidgetDims.Width / 2, + right = DialogWidgetDims.Width / 2 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -16, + bottom = 0, + left = -16, + right = 0, + material = RegisterMaterial( "widg_loading_triangle" ), + alpha = 0.25 + }, + state0 = f39_local2, + state1 = f39_local3, + state2 = f39_local4, + state3 = f39_local5 + }, + handlers = { + tick_0 = f39_local6 + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -16, + bottom = 0, + left = 16, + right = 0, + material = RegisterMaterial( "widg_loading_triangle" ), + alpha = 0.25 + }, + state0 = f39_local2, + state1 = f39_local3, + state2 = f39_local4, + state3 = f39_local5 + }, + handlers = { + tick_1 = f39_local6 + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 16, + bottom = 0, + left = 16, + right = 0, + material = RegisterMaterial( "widg_loading_triangle" ), + alpha = 0.25 + }, + state0 = f39_local2, + state1 = f39_local3, + state2 = f39_local4, + state3 = f39_local5 + }, + handlers = { + tick_2 = f39_local6 + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 16, + bottom = 0, + left = -16, + right = 0, + material = RegisterMaterial( "widg_loading_triangle" ), + alpha = 0.25 + }, + state0 = f39_local2, + state1 = f39_local3, + state2 = f39_local4, + state3 = f39_local5 + }, + handlers = { + tick_3 = f39_local6 + } + }, + { + type = "UITimer", + id = "spinner_timer", + properties = { + event = "anim_arrow", + interval = f39_local1, + disposable = false + } + }, + { + type = "UIElement", + handlers = { + anim_arrow = function ( f40_arg0, f40_arg1 ) + f40_arg0.tick = f40_arg0.tick or 0 + local f40_local0 = f40_arg0:getParent() + f40_local0:processEvent( { + name = "tick_" .. f40_arg0.tick + } ) + f40_arg0.tick = (f40_arg0.tick + 1) % 4 + f40_arg0.tick = f40_arg0.tick and 0 or f40_arg0.tick + end + + } + } + } + } +end + +function live_dialog_popup_background() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_background", + properties = { + top_offset = 0, + fill_alpha = 1 + } + } + }, + handlers = { + hide_popup_background = MBh.AnimateToState( "hidden", 0 ) + } + } +end + +function AddLiveDialogFooterHelperText( f42_arg0, f42_arg1 ) + local f42_local0 = LUI.ButtonHelperText.helper_text_item( ButtonMap.button_secondary, Engine.Localize( "@LUA_MENU_CANCEL" ), nil, nil, nil ) + f42_local0.triggers_event = "button_secondary" + f42_local0.id = "popup_cancel_text_id" + local f42_local1 = Engine.IsConsoleGame() + if not f42_local1 then + f42_local1 = Engine.IsGamepadEnabled() == 1 + end + local f42_local2 + if f42_local1 then + f42_local2 = 32 + if not f42_local2 then + + else + f42_local0:registerAnimationState( "default", { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = -50, + right = 50, + bottom = -4, + height = f42_local2 + } ) + f42_local0:animateToState( "default" ) + f42_local0:registerEventHandler( "virtual_keyboard_popup_active", MBh.EmitEvent( "popup_active" ) ) + f42_arg0:addElement( f42_local0 ) + end + end + f42_local2 = CoD.TextSettings.SmallFont.Height +end + +function live_dialog_text_box_with_cancel() + local f43_local0 = { + type = "UIElement", + properties = { + message = "", + indent = 15, + cancel_func = function () + + end + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + } + local f43_local1 = {} + local f43_local2 = { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = 0.85 + } + } + } + local f43_local3 = { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -75, + width = DialogPopupDims.Width, + height = DialogPopupDims.Height + } + } + } + local f43_local4 = {} + local f43_local5 = MBh.DoMultiple + local f43_local6 = {} + local f43_local7 = AddLiveDialogFooterHelperText + local f43_local8 = MBh.EmitEvent( "reposition_elements" ) + f43_local4.menu_create = f43_local5( f43_local7 ) + f43_local4.reposition_elements = function ( f45_arg0, f45_arg1 ) + local f45_local0 = 10 + local f45_local1, f45_local2, f45_local3, f45_local4 = GetTextDimensions( f45_arg0.properties.message, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f45_local5 = f45_local3 - f45_local1 + local f45_local6 = DialogWidgetDims.Width + f45_local0 + f45_local5 + local f45_local7 = f45_arg0:getChildById( "popup_text_id" ) + f45_local7:registerAnimationState( "updated", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -CoD.TextSettings.NormalFont.Height, + bottom = 0, + left = -1 * (f45_local6 * 0.5 - DialogWidgetDims.Width + f45_local0), + width = f45_local5 + f45_local0 + } ) + f45_local7:animateToState( "updated", 0 ) + local f45_local8 = f45_arg0:getChildById( "popup_diamond_id" ) + f45_local8:registerAnimationState( "updated", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -26, + left = -f45_local6 * 0.5, + height = DialogWidgetDims.Height, + width = DialogWidgetDims.Width + } ) + f45_local8:animateToState( "updated", 0 ) + end + + f43_local3.handlers = f43_local4 + f43_local3.children = { + { + type = "live_dialog_popup_background" + }, + { + type = "UIText", + id = "popup_text_id", + properties = { + message = MBh.Property( "message" ), + text = MBh.Property( "message" ), + indent = MBh.Property( "indent" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -CoD.TextSettings.NormalFont.Height, + bottom = 0, + left = 0, + right = 0, + 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 = "live_dialog_processing_widget", + id = "popup_diamond_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -26, + width = DialogWidgetDims.Width, + height = DialogWidgetDims.Height + } + } + } + } + f43_local4 = { + type = "UIBindButton", + handlers = { + button_secondary = function ( f46_arg0, f46_arg1 ) + if f46_arg0.properties.cancel_func then + f46_arg0.properties:cancel_func( f46_arg1 ) + end + end + } + } + f43_local1[1] = f43_local2 + f43_local1[2] = f43_local3 + f43_local1[3] = f43_local4 + f43_local0.children = f43_local1 + return f43_local0 +end + +function live_dialog_text_box() + return { + type = "UIElement", + properties = { + message = "", + indent = 15, + overlay_alpha = 0.85, + top = -75, + left = -DialogPopupDims.Width / 2 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = MBh.Property( "overlay_alpha" ) + } + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = MBh.Property( "top" ), + left = MBh.Property( "left" ), + width = DialogPopupDims.Width, + height = DialogPopupDims.Height + } + }, + handlers = { + menu_create = MBh.EmitEvent( "reposition_elements" ), + reposition_elements = function ( f48_arg0, f48_arg1 ) + local f48_local0 = 10 + local f48_local1, f48_local2, f48_local3, f48_local4 = GetTextDimensions( f48_arg0.properties.message, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f48_local5 = f48_local3 - f48_local1 + local f48_local6 = DialogWidgetDims.Width + f48_local0 + f48_local5 + local f48_local7 = f48_arg0:getChildById( "popup_text_id" ) + f48_local7:registerAnimationState( "updated", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + height = CoD.TextSettings.NormalFont.Height, + left = -1 * (f48_local6 * 0.5 - DialogWidgetDims.Width + f48_local0), + width = f48_local5 + f48_local0 + } ) + f48_local7:animateToState( "updated", 0 ) + local f48_local8 = f48_arg0:getChildById( "popup_diamond_id" ) + f48_local8:registerAnimationState( "updated", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -f48_local6 * 0.5, + height = DialogWidgetDims.Height, + width = DialogWidgetDims.Width + } ) + f48_local8:animateToState( "updated", 0 ) + end + + }, + children = { + { + type = "live_dialog_popup_background" + }, + { + type = "UIText", + id = "popup_text_id", + properties = { + message = MBh.Property( "message" ), + text = MBh.Property( "message" ), + indent = MBh.Property( "indent" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = 0, + right = 0, + 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 = "live_dialog_processing_widget", + id = "popup_diamond_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = DialogWidgetDims.Width, + height = DialogWidgetDims.Height + } + } + } + } + } + } + } +end + +function live_multi_line_text_box() + return { + type = "UIElement", + properties = { + message = "", + overlay_alpha = 0.85, + dialog_width = DialogPopupDims.Width, + dialog_height = DialogPopupDims.Height + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = MBh.Property( "overlay_alpha" ) + } + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = MBh.HalfOppositeProperty( "dialog_height" ), + left = MBh.HalfOppositeProperty( "dialog_width" ), + width = MBh.Property( "dialog_width" ), + height = MBh.Property( "dialog_height" ) + } + }, + children = { + { + type = "live_dialog_popup_background" + }, + { + type = "UIMarqueeText", + id = "popup_text_id", + properties = { + message = MBh.Property( "message" ), + text = MBh.Property( "message" ), + useTextWrapping = true, + textHeight = CoD.TextSettings.NormalFont.Height, + dialog_height = MBh.Property( "dialog_height" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 10, + left = DialogWidgetDims.Width + 20, + right = -10, + bottom = -10, + 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 = "live_dialog_processing_widget", + id = "popup_diamond_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 10, + width = DialogWidgetDims.Width, + height = DialogWidgetDims.Height + } + } + } + } + } + } + } +end + +function popup_connecting() + return { + type = "live_dialog_text_box_with_cancel", + id = "popup_connecting_id", + properties = { + message = Engine.Localize( "@XBOXLIVE_POPUP_CONNECTION" ), + cancel_func = LUI.common_menus.CommonPopups.CancelAcceptingInvite + } + } +end + +local f0_local12 = function ( f51_arg0, f51_arg1 ) + local f51_local0 = Engine.Localize( "@MENU_NOTICE" ) + local f51_local1 = Engine.GetDvarString( "online_end_reason" ) + f51_arg0:dispatchEventToChildren( { + name = "update_title", + title_text = f51_local0 + } ) + f51_arg0:dispatchEventToChildren( { + name = "update_message", + message_text = f51_local1 + } ) +end + +local f0_local13 = function ( f52_arg0, f52_arg1 ) + Engine.ResolveError( f52_arg1.controller ) +end + +function menu_online_ended() + return { + type = "generic_confirmation_popup", + id = "menu_online_ended", + properties = { + confirmation_action = f0_local13 + }, + handlers = { + menu_create = f0_local12 + } + } +end + +local f0_local14 = function ( f54_arg0, f54_arg1 ) + LUI.FlowManager.RequestCloseAllMenus( f54_arg0 ) + Engine.TogglePause() + f54_arg0:dispatchEventToRoot( { + name = "toggle_pause_off" + } ) +end + +local f0_local15 = function ( f55_arg0, f55_arg1 ) + LUI.FlowManager.RequestAddMenu( f55_arg0, "save_game_info_hud", true, f55_arg1.controller, false ) +end + +local f0_local16 = function ( f56_arg0, f56_arg1 ) + Engine.Exec( "disconnect" ) + Engine.AcceptInvite() +end + +function SaveGameErrorCreate( f57_arg0, f57_arg1 ) + LUI.FlowManager.RequestLeaveMenuByName( "save_game_info_hud" ) +end + +function SaveGameErrorFeeder( f58_arg0 ) + local f58_local0 = Engine.GetDvarBool( "sv_saveDeviceAvailable" ) + if not f58_local0 then + f58_local0 = Engine.IsPS4() + end + local f58_local1 = Engine.IsXbox360() + if f58_local1 then + f58_local1 = Engine.GetDvarBool( "sv_saveGameAvailable" ) + end + local f58_local2 = {} + local f58_local3 = "" + if f58_local0 then + if f58_local1 then + f58_local3 = Engine.Localize( "@MENU_WARNING_CHECKPOINT_RESET" ) + elseif Engine.IsPS4() then + f58_local3 = Engine.Localize( "@PLATFORM_SAVE_ERROR" ) + else + f58_local3 = Engine.Localize( "@MENU_NO_SAVE_DEVICE_WARNING_NOW_OKAY" ) + end + else + f58_local3 = Engine.Localize( "@MENU_NO_SAVE_DEVICE_WARNING" ) + end + f58_local2[#f58_local2 + 1] = { + type = "UIText", + id = "desc_text", + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1 + } + }, + properties = { + text = f58_local3 + } + } + local f58_local4 = "" + if f58_local0 then + if f58_local1 then + f58_local4 = Engine.Localize( "@MENU_OVERWRITE_SAVE" ) + else + f58_local4 = Engine.Localize( "@MENU_RETRY_SAVE" ) + end + else + f58_local4 = Engine.Localize( "@PLATFORM_SELECT_SAVE_DEVICE" ) + end + f58_local2[#f58_local2 + 1] = { + type = "UIGenericButton", + id = "first_button", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = f58_local4, + button_action_func = function ( f59_arg0, f59_arg1 ) + if f58_local0 then + f0_local15( f59_arg0, f59_arg1 ) + else + Engine.ForceSelectSaveDevice( f59_arg1.controller ) + if Engine.GetDvarBool( "sv_saveDeviceAvailable" ) then + LUI.FlowManager.RequestLeaveMenu( f59_arg0 ) + Engine.TogglePause() + end + end + end + } + } + f58_local2[#f58_local2 + 1] = { + type = "UIGenericButton", + id = "resume_game_nosave", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_RESUMEGAME_NOSAVE" ), + button_action_func = function ( f60_arg0, f60_arg1 ) + f0_local14( f60_arg0, f60_arg1 ) + Engine.SaveRevert() + end + } + } + f58_local2[#f58_local2 + 1] = { + type = "UIGenericButton", + id = "quit_nosave", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_QUIT_NO_SAVE" ), + button_action_func = function ( f61_arg0, f61_arg1 ) + Engine.SaveRevert() + LUI.FlowManager.RequestPopupMenu( f61_arg0, "quit_confirm_popup", false, f61_arg1.controller, false ) + end + } + } + if f58_local0 and not Engine.IsPS4() then + f58_local2[#f58_local2 + 1] = { + type = "UIGenericButton", + id = "reselect_save_device", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@PLATFORM_RESELECT_SAVE_DEVICE" ), + button_action_func = function ( f62_arg0, f62_arg1 ) + Engine.ForceSelectSaveDevice( f62_arg1.controller ) + end + } + } + end + return f58_local2 +end + +function save_game_error_popup() + local f63_local0 = Engine.GetDvarBool( "sv_saveDeviceAvailable" ) + local f63_local1 = { + type = "generic_selectionList_popup", + id = "save_game_error_popup_id" + } + local f63_local2 = { + cancel_will_close = false + } + local f63_local3 + if f63_local0 then + f63_local3 = Engine.Localize( "@PLATFORM_SAVE_ERROR_NOW_OKAY" ) + if not f63_local3 then + + else + f63_local2.popup_title = f63_local3 + f63_local2.popup_childfeeder = SaveGameErrorFeeder + f63_local1.properties = f63_local2 + f63_local1.handlers = { + menu_create = SaveGameErrorCreate + } + return f63_local1 + end + end + f63_local3 = Engine.Localize( "@PLATFORM_SAVE_ERROR" ) +end + +function LostSelectedSaveDevicePopupConfirm( f64_arg0, f64_arg1 ) + Engine.Exec( "select_save_device" ) +end + +function lost_selected_save_device_popup() + return { + type = "generic_confirmation_popup", + id = "lost_selected_save_device_popup_id", + properties = { + message_text = Engine.Localize( "@PLATFORM_SAVE_DEVICE_LOST" ) + }, + handlers = { + menu_close = LostSelectedSaveDevicePopupConfirm + } + } +end + +local f0_local17 = function ( f66_arg0, f66_arg1 ) + CoDAnywhere.IntegrateCACFile() +end + +local f0_local18 = function ( f67_arg0, f67_arg1 ) + CoDAnywhere.DeleteCACFile() +end + +function cac_elite_popup() + return { + type = "generic_yesno_popup", + id = "cac_elite_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_COD_MOBILE_APP_DATA_TITLE" ), + squadMembersChanged = 1, + loadoutsChanged = 2, + modifiedDay = 1, + modifiedMonth = 10, + modifiedYear = 2013, + message_text = Engine.GetDvarString( "mobile_app_data_available" ), + yes_action = f0_local17, + no_action = f0_local18, + yes_text = Engine.Localize( "@MENU_YES" ), + no_text = Engine.Localize( "@MENU_NO" ) + } + } +end + +local f0_local19 = function ( f69_arg0, f69_arg1 ) + Engine.Exec( "disconnect" ) +end + +function quit_no_save_confirm_popup() + return { + type = "generic_yesno_popup", + id = "quit_no_save_confirm_popup_id", + properties = { + popup_title = Engine.Localize( "@PLATFORM_QUIT" ), + message_text = Engine.Localize( "@MENU_QUIT_WARNING" ), + yes_action = f0_local19, + yes_text = Engine.Localize( "@MENU_QUIT" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function quit_confirm_popup() + return { + type = "generic_yesno_popup", + id = "quit_confirm_popup_id", + properties = { + popup_title = Engine.Localize( "@PLATFORM_QUIT" ), + message_text = Engine.Localize( "@MENU_ARE_YOU_SURE_QUIT" ), + yes_action = f0_local19, + yes_text = Engine.Localize( "@MENU_QUIT" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function save_and_quit_confirm_popup() + return { + type = "generic_yesno_popup", + id = "save_and_quit_confirm_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_QUIT_WARNING" ), + message_text = Engine.Localize( "@MENU_SAVEQUIT_TEXT_1" ) .. Engine.Localize( "@MENU_SAVEQUIT_TEXT_2" ) .. Engine.Localize( "@MENU_SAVEQUIT_TEXT_3" ), + yes_action = f0_local15, + yes_text = Engine.Localize( "@CGAME_CONTINUE_SAVING" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function save_and_quit_confirm_invited_popup() + return { + type = "generic_yesno_popup", + id = "save_and_quit_confirm_invited_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_CONTINUE_SAVING" ), + message_text = Engine.Localize( "@MENU_SAVEQUIT_TEXT_1" ) .. Engine.Localize( "@MENU_SAVEQUIT_TEXT_2" ) .. Engine.Localize( "@MENU_SAVEQUIT_TEXT_3" ), + yes_action = f0_local15, + no_action = f0_local16, + yes_text = Engine.Localize( "@CGAME_CONTINUE_SAVING" ), + no_text = Engine.Localize( "@MENU_CONTINUE_WITHOUT_SAVING" ) + } + } +end + +local f0_local20 = function () + return { + type = "UIText", + id = "save_game_loading_hud_id", + properties = { + text = Engine.Localize( "@CGAME_NOW_SAVING" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 80, + bottom = 120, + left = 0, + right = 0, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center, + red = 1, + green = 1, + blue = 1 + } + } + } +end + +local f0_local21 = function ( f75_arg0, f75_arg1 ) + Engine.SetSaveExecOnSuccess( "disconnect" ) + Engine.SetDvarBool( "ui_skipMainLockout", true ) + Engine.SaveDelay() + Engine.WriteSave() +end + +local f0_local22 = function ( f76_arg0, f76_arg1 ) + if f76_arg1.finished then + Engine.SaveComplete() + end +end + +local f0_local23 = function () + return { + type = "UIElement", + id = "save_game_info_hud_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + botomAnchor = true + } + }, + handlers = { + menu_create = f0_local21, + save_event = f0_local22 + }, + children = { + { + type = "UIOwnerdraw", + id = "save_game_info_background", + properties = { + ownerDraw = CoD.Ownerdraw.CGMissionObjectiveBackdrop + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + red = 0, + green = 0, + blue = 0, + alpha = 0.5 + } + } + }, + { + type = "UIText", + id = "save_game_info_text", + properties = { + text = Engine.Localize( "@CGAME_NOW_SAVING" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 80, + bottom = 120, + left = 150, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center, + red = 1, + green = 1, + blue = 1 + } + } + } + } + } +end + +local f0_local24 = function ( f78_arg0 ) + return Engine.MarkLocalized( string.format( "%02d", f78_arg0 ) ) +end + +local f0_local25 = function ( f79_arg0, f79_arg1 ) + local f79_local0, f79_local1 = Engine.StreamingCheckInstall() + if f79_local0 == nil then + f79_local0 = 0 + end + local f79_local2 = f79_arg0:getFirstDescendentById( "middle" ) + if f79_local2 ~= nil then + f79_local2:registerAnimationState( "move_bar", { + right = f79_local2.properties.m_maxWidth * f79_local0 + } ) + f79_local2:animateToState( "move_bar", 150 ) + end + if f79_local1 > 0 then + local f79_local3 = f79_arg0:getFirstDescendentById( "streaming_install_seconds_remaining" ) + if f79_local3 ~= nil then + local f79_local4 = nil + local f79_local5 = math.floor( f79_local1 / 3600 ) + local f79_local6 = math.floor( f79_local1 / 60 - f79_local5 * 60 ) + f79_local3:setText( Engine.Localize( "@MENU_SP_STREAMING_INSTALL_REMAINING", f0_local24( f79_local5 ), f0_local24( f79_local6 ), f0_local24( f79_local1 - f79_local6 * 60 - f79_local5 * 3600 ) ) ) + end + end +end + +local f0_local26 = 104 +local f0_local27 = 416 +local f0_local28 = 26 +local f0_local29 = 341 +local f0_local30 = 416 +local f0_local31 = 26 +local f0_local32 = 26 +local f0_local33 = function () + return { + type = "generic_selectionList_popup", + id = "streaming_install_base_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_SP_STREAMING_INSTALL" ), + button_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + confirmation_action = MBh.LeaveMenu(), + message_text_alignment = LUI.Alignment.Center, + callback_params = {}, + padding_top = 12, + popup_childfeeder = function () + return { + { + type = "UIText", + id = "message_text_id", + properties = { + text = MBh.Property( "message_text" ), + message_text_alignment = MBh.Property( "message_text_alignment" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + left = 12, + right = -12, + alignment = MBh.Property( "message_text_alignment" ), + font = CoD.TextSettings.NormalFont.Font, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + }, + handlers = { + update_message = setMessageText + } + }, + { + type = "UIElement", + id = "spacer1", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 40 + } + } + }, + { + type = "UIImage", + id = "bar_bg", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + width = f0_local27, + top = 0, + bottom = f0_local26, + red = 1, + green = 1, + blue = 1, + alpha = 1, + material = RegisterMaterial( "capturing_bg_mp" ) + } + }, + children = { + { + type = "UIHorizontalList", + id = "streaming_bar_hl", + states = { + default = { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -53, + left = 43, + height = f0_local28, + width = f0_local29, + alignment = LUI.Alignment.Left, + spacing = 0, + alpha = 1 + } + }, + children = { + { + type = "UIImage", + id = "start_cap", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f0_local28, + width = f0_local32, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b, + alpha = 1, + material = RegisterMaterial( "capturing_bar_start_mp" ) + } + } + }, + { + type = "UIImage", + id = "middle", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f0_local28, + width = 0, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b, + alpha = 1, + material = RegisterMaterial( "capturing_bar_mp" ) + } + }, + properties = { + m_maxWidth = f0_local29 - f0_local32 - f0_local32 + } + }, + { + type = "UIImage", + id = "end_cap", + states = { + default = { + topAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + height = f0_local28, + width = f0_local32, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b, + alpha = 1, + material = RegisterMaterial( "capturing_bar_end_mp" ) + } + } + } + } + } + } + }, + { + type = "UIText", + id = "streaming_install_seconds_remaining", + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1 + } + }, + properties = { + text = "" + } + }, + { + type = "UIGenericButton", + id = "exit_button_id", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = MBh.Property( "button_text" ), + confirmation_action = MBh.Property( "confirmation_action" ), + button_action_func = function ( f82_arg0, f82_arg1 ) + f82_arg0.properties:confirmation_action( f82_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f82_arg0 ) + end + , + callback_params = MBh.Property( "callback_params" ) + } + } + } + end + + }, + children = { + { + type = "UITimer", + id = "streaming_install_timer", + properties = { + event = "refresh_streaming_install_progress", + interval = 500, + disposable = false + } + } + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = SetupStreamingInstallRefreshTimer, + refresh_streaming_install_progress = f0_local25 + } + } +end + +local f0_local34 = function () + return { + type = "streaming_install_base", + properties = { + button_text = Engine.Localize( "@LUA_MENU_BACK" ), + confirmation_action = MBh.LeaveMenu() + } + } +end + +local f0_local35 = function () + return { + type = "streaming_install_base", + properties = { + cancel_will_close = false, + button_text = Engine.Localize( "@MENU_MAIN_MENU" ), + confirmation_action = function ( f85_arg0, f85_arg1 ) + if Engine.IsSaveAvailable() then + f0_local15( f85_arg0, f85_arg1 ) + else + f0_local19( f85_arg0, f85_arg1 ) + end + end + + } + } +end + +function menu_ps3_ui_bg() + return { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = 0.85 + } + } + } +end + +local f0_local36 = function ( f87_arg0, f87_arg1 ) + local f87_local0 = Engine.GetLuiRoot() + Engine.ExecNow( "profile_toggleEnableGamepad" ) + LUI.FlowManager.tryAddMouseCursor( f87_local0 ) + Engine.Exec( "updategamerprofile" ) +end + +if Engine.IsConsoleGame() then + function controllerremoved_popmenu() + return { + type = "generic_popup_message", + id = "controller_removed_id", + properties = { + message_text = Engine.Localize( "@PLATFORM_CONTROLLER_DISCONNECTED" ) + } + } + end + +else + function controllerremoved_popmenu() + return { + type = "generic_confirmation_popup", + id = "controller_removed_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@PLATFORM_CONTROLLER_DISCONNECTED" ), + button_text = Engine.Localize( "@MENU_SWITCH_TO_MOUSE" ), + confirmation_action = f0_local36 + } + } + end + +end +if not Engine.IsConsoleGame() then + function steam_overlay_required() + return { + type = "generic_confirmation_popup", + id = "steam_overlay_required_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@PLATFORM_UI_STEAM_OVERLAY_REQUIRED" ) + } + } + end + +end +function ConfirmProfileChange( f91_arg0, f91_arg1 ) + DebugPrint( "Confirm profile change" ) + Engine.ConfirmXB3UserProfileChange( f91_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f91_arg0 ) +end + +function IgnoreProfileChange( f92_arg0, f92_arg1 ) + DebugPrint( "Ignore profile change" ) + Engine.IgnoreXB3UserProfileChange( f92_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f92_arg0 ) +end + +function user_changed_confirm_mp() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@MENU_PROFILE_PAIRING_CONFIRM" ), + popup_title = Engine.Localize( "@MENU_WARNING" ), + yes_text = Engine.Localize( "@MENU_YES" ), + no_text = Engine.Localize( "@MENU_NO" ), + yes_action = IgnoreProfileChange, + no_action = ConfirmProfileChange, + default_focus_index = 1 + } + } +end + +function controller_changed_confirm_mp() + return { + type = "generic_confirmation_popup", + properties = { + message_text = Engine.Localize( "@MENU_CONTROLLER_PAIRING_CONFIRM" ), + popup_title = Engine.Localize( "@MENU_WARNING" ) + } + } +end + +function updating_squad_reports() + return { + type = "UIElement", + id = "updating_squad_reports_id", + handlers = { + finish_report_update = MBh.LeaveMenu() + }, + children = { + { + type = "live_dialog_text_box", + id = "live_dialog_text_box_id", + properties = { + message = Engine.Localize( "LUA_MENU_UPDATING_REPORTS" ) + } + }, + { + type = "UITimer", + id = "updating_squad_reports_timer", + properties = { + event = "finish_report_update", + interval = 1500 + } + } + } + } +end + +function recipe_load_failed_popup() + return { + type = "generic_confirmation_popup", + id = "recipe_load_failed_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MPUI_RECIPE_LOAD_FAILED" ) + } + } +end + +function recipe_save_failed_popup() + return { + type = "generic_confirmation_popup", + id = "recipe_save_failed_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MPUI_RECIPE_SAVE_FAILED" ) + } + } +end + +function recipe_save_failed_no_guests_popup() + return { + type = "generic_confirmation_popup", + id = "recipe_save_failed_no_guests_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MPUI_RULES_NOGUESTSAVE" ) + } + } +end + +function recipe_save_failed_no_device_popup() + return { + type = "generic_confirmation_popup", + id = "recipe_save_failed_no_device_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MPUI_RULES_NOSAVEDEVICE" ) + } + } +end + +function no_controller_initial_popup() + return { + type = "generic_yesno_popup", + id = "no_controller_initial_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_NO_CONTROLLER_INITIAL" ), + yes_action = f0_local36 + } + } +end + +local f0_local37 = function ( f101_arg0, f101_arg1 ) + Engine.ExecNow( "profile_toggleEnableGamepad 1" ) + Engine.ExecNow( "updategamerprofile" ) + f101_arg0:dispatchEventToRoot( { + name = "refresh_button_helper", + dispatchChildren = true + } ) + f101_arg0:dispatchEventToRoot( { + name = "refresh_button_background" + } ) +end + +local f0_local38 = function ( f102_arg0, f102_arg1 ) + Engine.ExecNow( "profile_toggleEnableGamepad 0" ) + Engine.ExecNow( "updategamerprofile" ) +end + +function controller_initial_popup() + return { + type = "generic_yesno_popup", + id = "controller_initial_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_CONTROLLER_INITIAL" ), + yes_action = f0_local37, + no_action = f0_local38 + } + } +end + +if Engine.IsXbox360() then + function required_dlc_download_initiated() + return { + type = "generic_confirmation_popup", + id = "required_dlc_download_initiated", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_REQUIRED_DLC_DOWNLOAD_INITIATED" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } + end + + function required_dlc_download_failed() + return { + type = "generic_confirmation_popup", + id = "required_dlc_download_failed", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_REQUIRED_DLC_DOWNLOAD_FAILED" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } + end + +end +LUI.MenuBuilder.registerDef( "live_dialog_text_box_with_cancel", live_dialog_text_box_with_cancel ) +LUI.MenuBuilder.registerDef( "live_dialog_text_box", live_dialog_text_box ) +LUI.MenuBuilder.registerDef( "live_multi_line_text_box", live_multi_line_text_box ) +LUI.MenuBuilder.registerDef( "live_dialog_processing_widget", live_dialog_processing_widget ) +LUI.MenuBuilder.registerDef( "live_dialog_popup_background", live_dialog_popup_background ) +LUI.MenuBuilder.registerDef( "error_popmenu_party", error_popmenu_party ) +LUI.MenuBuilder.registerDef( "error_popmenu_psplus_party", error_popmenu_psplus_party ) +LUI.MenuBuilder.registerDef( "live_party_invite_popmenu", live_party_invite_popmenu ) +LUI.MenuBuilder.registerDef( "sign_in_as_sub_or_guest", sign_in_as_sub_or_guest ) +LUI.MenuBuilder.registerDef( "aliens_unlocked_popup", aliens_unlocked_popup ) +LUI.MenuBuilder.registerDef( "popup_acceptinginvite", popup_acceptinginvite ) +LUI.MenuBuilder.registerDef( "popup_connecting", popup_connecting ) +LUI.MenuBuilder.registerDef( "error_popmenu_submenu", error_popmenu_submenu ) +LUI.MenuBuilder.registerDef( "readingsavedevice", readingsavedevice ) +LUI.MenuBuilder.registerDef( "error_corrupt_savedata", error_corrupt_savedata ) +LUI.MenuBuilder.registerDef( "savedata_failed_popmenu", savedata_failed_popmenu ) +LUI.MenuBuilder.registerDef( "error_popmenu", error_popmenu ) +LUI.MenuBuilder.registerDef( "quit_popmenu", quit_popmenu ) +LUI.MenuBuilder.registerDef( "apply_settings_popmenu", apply_settings_popmenu ) +LUI.MenuBuilder.registerDef( "apply_settings_restart_popmenu", apply_settings_restart_popmenu ) +LUI.MenuBuilder.registerDef( "show_low_texture_res_warning_restart_popmenu", show_low_texture_res_warning_restart_popmenu ) +LUI.MenuBuilder.registerDef( "show_low_texture_res_warning_popmenu", show_low_texture_res_warning_popmenu ) +LUI.MenuBuilder.registerDef( "no_profile_warning_popmenu", no_profile_warning_popmenu ) +LUI.MenuBuilder.registerDef( "no_profile_force_popmenu", no_profile_force_popmenu ) +LUI.MenuBuilder.registerDef( "quit_no_save_confirm_popup", quit_no_save_confirm_popup ) +LUI.MenuBuilder.registerDef( "quit_confirm_popup", quit_confirm_popup ) +LUI.MenuBuilder.registerDef( "save_and_quit_confirm_popup", save_and_quit_confirm_popup ) +LUI.MenuBuilder.registerDef( "save_and_quit_confirm_invited_popup", save_and_quit_confirm_invited_popup ) +LUI.MenuBuilder.registerDef( "save_game_error_popup", save_game_error_popup ) +LUI.MenuBuilder.registerDef( "lost_selected_save_device_popup", lost_selected_save_device_popup ) +LUI.MenuBuilder.registerDef( "save_game_loading_hud", f0_local20 ) +LUI.MenuBuilder.registerDef( "save_game_info_hud", f0_local23 ) +LUI.MenuBuilder.registerDef( "streaming_install_base", f0_local33 ) +LUI.MenuBuilder.registerDef( "streaming_install_frontend", f0_local34 ) +LUI.MenuBuilder.registerDef( "streaming_install_ingame", f0_local35 ) +LUI.MenuBuilder.registerDef( "menu_ps3_ui_bg", menu_ps3_ui_bg ) +LUI.MenuBuilder.registerDef( "menu_online_ended", menu_online_ended ) +LUI.MenuBuilder.registerDef( "controllerremoved_popmenu", controllerremoved_popmenu ) +LUI.MenuBuilder.registerDef( "user_changed_confirm_mp", user_changed_confirm_mp ) +LUI.MenuBuilder.registerDef( "controller_changed_confirm_mp", controller_changed_confirm_mp ) +LUI.MenuBuilder.registerDef( "cac_elite_popup", cac_elite_popup ) +LUI.MenuBuilder.registerDef( "updating_squad_reports", updating_squad_reports ) +LUI.MenuBuilder.registerDef( "recipe_load_failed_popup", recipe_load_failed_popup ) +LUI.MenuBuilder.registerDef( "recipe_save_failed_popup", recipe_save_failed_popup ) +LUI.MenuBuilder.registerDef( "recipe_save_failed_no_guests_popup", recipe_save_failed_no_guests_popup ) +LUI.MenuBuilder.registerDef( "recipe_save_failed_no_device_popup", recipe_save_failed_no_device_popup ) +LUI.MenuBuilder.registerDef( "no_controller_initial_popup", no_controller_initial_popup ) +LUI.MenuBuilder.registerDef( "controller_initial_popup", controller_initial_popup ) +if not Engine.IsConsoleGame() then + LUI.MenuBuilder.registerDef( "steam_overlay_required", steam_overlay_required ) +end +LUI.FlowManager.RegisterStackPopBehaviour( "error_popmenu", f0_local1 ) +LUI.FlowManager.RegisterStackPopBehaviour( "error_popmenu_party", f0_local1 ) +LUI.FlowManager.RegisterStackPopBehaviour( "error_popmenu_submenu", f0_local1 ) +LUI.FlowManager.RegisterStackPopBehaviour( "error_popmenu_psplus_party", f0_local1 ) +if Engine.IsXbox360() then + LUI.MenuBuilder.registerDef( "required_dlc_download_initiated", required_dlc_download_initiated ) + LUI.MenuBuilder.registerDef( "required_dlc_download_failed", required_dlc_download_failed ) +end +LockTable( _M ) diff --git a/lui/common_menus/friendslist.dec.lua b/lui/common_menus/friendslist.dec.lua new file mode 100644 index 0000000..11de9d7 --- /dev/null +++ b/lui/common_menus/friendslist.dec.lua @@ -0,0 +1,2760 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function StartChallenge( f1_arg0, f1_arg1 ) + local f1_local0, f1_local1 = f1_arg1( f1_arg0 ) + if f1_local0 ~= -1 and f1_local1 ~= -1 and Playlist.DoAction( f1_local0, f1_local1, false, false ) then + Squad.StartMatch( f1_arg0, false ) + Engine.SetDvarBool( "squad_find_match", true ) + LUI.FlowManager.RequestAddMenu( nil, "menu_xboxlive_lobby", false, f1_arg0, false, {} ) + end +end + +function ChallengeFriend( f2_arg0 ) + StartChallenge( f2_arg0, Squad.FightFriend ) +end + +function ChallengeRecentPlayer( f3_arg0 ) + StartChallenge( f3_arg0, Squad.FightRecentPlayer ) +end + +function ChallengeLivePartyPlayer( f4_arg0 ) + StartChallenge( f4_arg0, Squad.FightLivePartyPlayer ) +end + +function popup_elite_clan_updating() + return { + type = "live_dialog_text_box", + id = "popup_elite_clan_updating_id", + properties = { + message = Engine.Localize( "@MENU_FACEBOOK_UPLOADING" ) + } + } +end + +function popup_update_clan_finished() + local f6_local0 + if Engine.MarkLocalized( Engine.GetDvarString( "elite_clan_single_task_popup_text" ) ) == Engine.Localize( "MENU_CLAN_CREATED" ) then + f6_local0 = Engine.Localize( "PATCH_MENU_CONGRATULATIONS" ) + if not f6_local0 then + + else + return { + type = "generic_confirmation_popup", + id = "popup_update_clan_finished", + properties = { + popup_title = f6_local0, + message_text = Engine.GetDvarString( "elite_clan_single_task_popup_text" ), + confirmation_action = function ( f7_arg0, f7_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f7_arg0, true ) + end + + }, + handlers = { + menu_close = function ( f8_arg0, f8_arg1 ) + f8_arg0:dispatchEventToRoot( { + name = "close_actions", + immediate = true + } ) + f8_arg0:dispatchEventToRoot( { + name = "friends_refresh", + forceRefresh = true + } ) + end + + } + } + end + end + f6_local0 = Engine.Localize( "@MENU_NOTICE" ) +end + +function popup_friend_invite_sent() + return { + type = "generic_confirmation_popup", + properties = { + popup_title = Engine.Localize( "@MENU_POPUP_INVITE_SENT" ), + message_text = Engine.Localize( "@MENU_POPUP_INVITE_SENT" ), + dialog_top = -100, + dialog_bottom = 100 + } + } +end + +function popup_confirm_report() + return { + type = "generic_confirmation_popup", + id = "popup_confirm_report", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = "", + dialog_top = -100, + dialog_bottom = 100 + } + } +end + +function ReportPopupFeeder( f11_arg0 ) + local f11_local0 = { + { + text = "@MENU_REPORT_OFFENSIVE", + confirmationString = "@MENU_REPORT_OFFENSIVE_SUBMIT", + offense = Friends.Constants.reportOffensiveLobbyPlayer + }, + { + text = "@MENU_REPORT_EXPLOITING", + confirmationString = "@MENU_REPORT_EXPLOITING_SUBMIT", + offense = Friends.Constants.reportExploitingLobbyPlayer + }, + { + text = "@MENU_REPORT_CHEATING", + confirmationString = "@MENU_REPORT_CHEATING_SUBMIT", + offense = Friends.Constants.reportCheatingLobbyPlayer + }, + { + text = "@MENU_REPORT_BOOSTING", + confirmationString = "@MENU_REPORT_BOOSTING_SUBMIT", + offense = Friends.Constants.reportBoostingLobbyPlayer + } + } + local f11_local1 = {} + for f11_local5, f11_local6 in ipairs( f11_local0 ) do + f11_local1[#f11_local1 + 1] = { + type = "UIGenericButton", + id = "offense_" .. f11_local5, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( f11_local6.text ), + button_action_func = function ( f12_arg0, f12_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f12_arg0 ) + f11_arg0.reportFunction( f12_arg1.controller, f11_local6.offense ) + f11_arg0.confirmationAction( f12_arg0, f12_arg1, Engine.Localize( f11_local6.confirmationString ) ) + end + } + } + end + return f11_local1 +end + +function popup_friend_report() + return { + type = "generic_selectionList_popup", + id = "popup_friend_report", + properties = { + popup_title = Engine.Localize( "@MENU_REPORT_PLAYER" ), + popup_childfeeder = ReportPopupFeeder, + friendIndex = 0, + confirmationAction = function ( f14_arg0, f14_arg1, f14_arg2 ) + LUI.FlowManager.RequestPopupMenu( f14_arg0, "popup_confirm_report", true, controller, false, { + message_text = f14_arg2 + } ) + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + } + } +end + +function popup_kick_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_kick_are_you_sure", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_CLAN_KICK_ARE_YOU_SURE" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f16_arg0, f16_arg1 ) + Clan.KickMemberFromClan( f16_arg1.controller ) + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function ChangeStatusFeeder() + local f17_local0 = { + [#f17_local0 + 1] = { + type = "UIGenericButton", + id = "member_status_coleader", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@CLANS_STATUS_COLEADER" ), + button_action_func = function ( f18_arg0, f18_arg1 ) + Clan.SetToCoLeader( f18_arg1.controller ) + end, + button_over_func = function ( f19_arg0, f19_arg1 ) + f19_arg0:dispatchEventToRoot( { + name = "update_member_status_desc", + text = Engine.Localize( "@CLANS_STATUS_COLEADER_DESC" ) + } ) + end + } + }, + [#f17_local0 + 1] = { + type = "UIGenericButton", + id = "member_status_member", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@CLANS_STATUS_MEMBER" ), + button_action_func = function ( f20_arg0, f20_arg1 ) + Clan.SetToClanMember( f20_arg1.controller ) + end, + button_over_func = function ( f21_arg0, f21_arg1 ) + f21_arg0:dispatchEventToRoot( { + name = "update_member_status_desc", + text = Engine.Localize( "@CLANS_STATUS_MEMBER_DESC" ) + } ) + end + } + }, + [#f17_local0 + 1] = { + type = "UIElement", + id = "spacer", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 10 + } + } + }, + [#f17_local0 + 1] = { + type = "UIText", + id = "help_text", + properties = { + text = Engine.Localize( "@CLANS_STATUS_COLEADER_DESC" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1 + } + }, + handlers = { + update_member_status_desc = function ( f22_arg0, f22_arg1 ) + f22_arg0:setText( f22_arg1.text or "" ) + end + } + } + } + return f17_local0 +end + +function popup_change_status() + return { + type = "generic_selectionList_popup", + id = "popup_change_status_id", + properties = { + popup_title = Engine.Localize( "@CLANS_CHANGE_MEMBER_STATUS" ), + popup_childfeeder = ChangeStatusFeeder, + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function popup_transfer_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_transfer_are_you_sure_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@CLANS_TRANSFER_LEADERSHIP_CONFIRM" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f25_arg0, f25_arg1 ) + Clan.TransferLeadership( f25_arg1.controller ) + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function popup_leave_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_leave_are_you_sure_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@CLANS_LEAVE_CONFIRM" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f27_arg0, f27_arg1 ) + Clan.LeaveClan( f27_arg1.controller ) + if LUI.FlowManager.IsMenuInStack( f27_arg0:getRootParent(), "menu_barracks" ) then + LUI.FlowManager.RequestRestoreMenu( f27_arg0, "menu_barracks", true, f27_arg1.controller ) + end + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function popup_leave_leader_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_leave_leader_are_you_sure_id", + properties = { + popup_title = Engine.Localize( "@MENU_WARNING" ), + message_text = Engine.Localize( "@CLANS_LEADER_LEAVE_CONFIRM" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f29_arg0, f29_arg1 ) + Clan.LeaveClan( f29_arg1.controller ) + if LUI.FlowManager.IsMenuInStack( f29_arg0:getRootParent(), "menu_barracks" ) then + LUI.FlowManager.RequestRestoreMenu( f29_arg0, "menu_barracks", true, f29_arg1.controller ) + end + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function popup_leave_leader_with_members() + return { + type = "generic_confirmation_popup", + id = "popup_leave_leader_with_members_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@CLANS_LEADER_CANT_LEAVE" ), + button_text = Engine.Localize( "@MENU_OK" ), + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function GetFriendRequestLocString() + return Engine.Localize( Engine.IsXB3() and "LUA_MENU_FRIEND_FOLLOW" or "MENU_FRIEND_REQUEST" ) +end + +function LivePartyFriendActionsFeeder( f32_arg0, f32_arg1 ) + local f32_local0 = {} + local f32_local1 = Engine.IsXbox360() + if not f32_local1 then + f32_local1 = Engine.IsXB3() + if not f32_local1 then + f32_local1 = Engine.IsPS4() + end + end + local f32_local2 = not Engine.InFrontend() + local f32_local3 = Engine.InLobby() + if Engine.IsMultiplayer() then + local f32_local4 = #f32_local0 + 1 + local f32_local5 = { + type = "UIGenericButton", + id = "invite" + } + local f32_local6 = Friends.IsLivePartyLocal( f32_arg1.controller ) + if not f32_local6 then + if Engine.GetDvarBool( "onlinegame" ) then + f32_local6 = isAliensSolo() + else + f32_local6 = true + end + end + f32_local5.disabled = f32_local6 + f32_local6 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup + } + local f32_local7 + if f32_local2 or f32_local3 then + f32_local7 = Engine.Localize( "@MENU_INVITE_TO_GAME" ) + if not f32_local7 then + + else + f32_local6.button_text = f32_local7 + f32_local6.button_action_func = function ( f33_arg0, f33_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f33_arg0 ) + Friends.InviteLivePartyFriend( f33_arg1.controller ) + end + + f32_local5.properties = f32_local6 + f32_local0[f32_local4] = f32_local5 + end + end + f32_local7 = Engine.Localize( "@MENU_INVITE_TO_PARTY" ) + end + local f32_local4 = #f32_local0 + 1 + local f32_local5 = { + type = "UIGenericButton", + id = "join" + } + local f32_local6 = Friends.IsLivePartyLocal( f32_arg1.controller ) + if not f32_local6 then + f32_local6 = not Engine.UserCanPlayOnline( f32_arg1.controller ) + end + f32_local5.disabled = f32_local6 + f32_local5.properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_JOIN_GAME" ), + button_action_func = function ( f34_arg0, f34_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f34_arg0 ) + Friends.JoinLivePartyFriend( f34_arg1.controller ) + end + } + f32_local0[f32_local4] = f32_local5 + if Clan.IsEnabled() and Clan.CanISendInviteToLiveParty( f32_arg1.controller, f32_arg0.friendIndex ) and f32_local2 == false then + f32_local0[#f32_local0 + 1] = { + type = "UIGenericButton", + id = "clan_invite", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@LUA_MENU_CLAN_INVITE_TO_CLAN" ), + button_action_func = function ( f35_arg0, f35_arg1 ) + if Engine.IsChatRestricted() then + LUI.FlowManager.RequestPopupMenu( f35_arg0, "user_generated_content_restriction_popup", true, f35_arg1.controller ) + else + Clan.InviteLivePartyToClan( f35_arg1.controller ) + end + end + } + } + end + if f32_local1 then + f32_local0[#f32_local0 + 1] = { + type = "UIGenericButton", + id = "profile", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@XBOXLIVE_VIEW_PROFILE" ), + button_action_func = function ( f36_arg0, f36_arg1 ) + Friends.ShowLivePartyFriendGamercard( f36_arg1.controller ) + end + } + } + end + f32_local0[#f32_local0 + 1] = { + type = "UIGenericButton", + id = "report", + disabled = Friends.IsLivePartyFriendMe( f32_arg1.controller, f32_arg0.friendIndex ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_REPORT_PLAYER" ), + button_action_func = function ( f37_arg0, f37_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f37_arg0 ) + LUI.FlowManager.RequestPopupMenu( f37_arg0, "popup_friend_report", true, f37_arg1.controller, false, { + friendIndex = f32_arg0.friendIndex, + reportFunction = Friends.ReportLivePartyFriend + } ) + end + } + } + return f32_local0 +end + +function OnlineFriendActionsFeeder( f38_arg0, f38_arg1 ) + local f38_local0 = {} + local f38_local1 = Engine.IsXbox360() + if not f38_local1 then + f38_local1 = Engine.IsXB3() + if not f38_local1 then + f38_local1 = Engine.IsPS4() + end + end + local f38_local2 = not Engine.InFrontend() + local f38_local3 = Engine.InLobby() + local f38_local4 = function () + local f39_local0 + if IsOnlineMatch() and Friends.IsFriendInvitable( f38_arg1.controller ) then + f39_local0 = isAliensSolo() + else + f39_local0 = true + end + return f39_local0 + end + + if Engine.IsMultiplayer() then + local f38_local5 = #f38_local0 + 1 + local f38_local6 = { + type = "UIGenericButton", + id = "invite", + disabledFunc = f38_local4 + } + local f38_local7 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup + } + local f38_local8 + if f38_local2 or f38_local3 then + f38_local8 = Engine.Localize( "@MENU_INVITE_TO_GAME" ) + if not f38_local8 then + + else + f38_local7.button_text = f38_local8 + f38_local7.button_action_func = function ( f40_arg0, f40_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f40_arg0 ) + Friends.InviteOnlineFriend( f40_arg1.controller ) + end + + f38_local6.properties = f38_local7 + f38_local6.handlers = { + element_refresh = function ( f41_arg0, f41_arg1 ) + if f38_local4() then + f41_arg0:processEvent( { + name = "disable" + } ) + else + f41_arg0:processEvent( { + name = "enable" + } ) + end + end + } + f38_local0[f38_local5] = f38_local6 + end + end + f38_local8 = Engine.Localize( "@MENU_INVITE_TO_PARTY" ) + end + if Engine.IsMultiplayer() or not Engine.IsPS4() and not Engine.IsXB3() and Engine.IsConsoleGame() then + local f38_local5 = function () + local f42_local0 + if Engine.UserCanPlayOnline( f38_arg1.controller ) then + f42_local0 = not Friends.IsFriendJoinable( f38_arg1.controller ) + else + f42_local0 = true + end + return f42_local0 + end + + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "join", + disabledFunc = f38_local5, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_JOIN_GAME" ), + button_action_func = function ( f43_arg0, f43_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f43_arg0 ) + Friends.JoinOnlineFriend( f43_arg1.controller ) + end + }, + handlers = { + element_refresh = function ( f44_arg0, f44_arg1 ) + if f38_local5() then + f44_arg0:processEvent( { + name = "disable" + } ) + else + f44_arg0:processEvent( { + name = "enable" + } ) + end + end + } + } + end + if Clan.IsEnabled() and Clan.CanISendInviteToFriend( f38_arg1.controller, f38_arg0.friendIndex ) and f38_local2 == false then + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "clan_invite", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@LUA_MENU_CLAN_INVITE_TO_CLAN" ), + button_action_func = function ( f45_arg0, f45_arg1 ) + if Engine.IsChatRestricted() then + LUI.FlowManager.RequestPopupMenu( f45_arg0, "user_generated_content_restriction_popup", true, f45_arg1.controller ) + else + Clan.InviteFriendToClan( f45_arg1.controller ) + end + end + } + } + end + local f38_local5 = function () + return not Friends.CanShowFriendGamercard( f38_arg1.controller ) + end + + if f38_local1 then + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "profile", + disabledFunc = f38_local5, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@XBOXLIVE_VIEW_PROFILE" ), + button_action_func = function ( f47_arg0, f47_arg1 ) + Friends.ShowOnlineFriendGamercard( f47_arg1.controller ) + end + }, + handlers = { + element_refresh = function ( f48_arg0, f48_arg1 ) + if f38_local5() then + f48_arg0:processEvent( { + name = "disable" + } ) + else + f48_arg0:processEvent( { + name = "enable" + } ) + end + end + } + } + end + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "report", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_REPORT_PLAYER" ), + button_action_func = function ( f49_arg0, f49_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f49_arg0 ) + LUI.FlowManager.RequestPopupMenu( f49_arg0, "popup_friend_report", true, f49_arg1.controller, false, { + friendIndex = f38_arg0.friendIndex, + reportFunction = Friends.ReportOnlineFriend + } ) + end + } + } + return f38_local0 +end + +function popup_join_on_blocked_player_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_join_on_blocked_player_are_you_sure", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@XBOXLIVE_JOIN_ON_BLOCKED_USER_CONFIRM" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f51_arg0, f51_arg1 ) + Friends.JoinRecentPlayer( f51_arg1.controller ) + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function RecentPlayerActionsFeeder( f52_arg0, f52_arg1 ) + local f52_local0 = {} + local f52_local1 = Engine.IsXbox360() + if not f52_local1 then + f52_local1 = Engine.IsXB3() + if not f52_local1 then + f52_local1 = Engine.IsPS4() + end + end + local f52_local2 = not Engine.InFrontend() + local f52_local3 = Engine.InLobby() + if Engine.IsConsoleGame() then + if Engine.IsMultiplayer() then + local f52_local4 = #f52_local0 + 1 + local f52_local5 = { + type = "UIGenericButton", + id = "invite" + } + local f52_local6 + if Engine.GetDvarBool( "onlinegame" ) then + f52_local6 = isAliensSolo() + else + f52_local6 = true + end + f52_local5.disabled = f52_local6 + f52_local6 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup + } + local f52_local7 + if f52_local2 or f52_local3 then + f52_local7 = Engine.Localize( "@MENU_INVITE_TO_GAME" ) + if not f52_local7 then + + else + f52_local6.button_text = f52_local7 + f52_local6.button_action_func = function ( f53_arg0, f53_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f53_arg0 ) + Friends.InviteRecentPlayer( f53_arg1.controller ) + end + + f52_local5.properties = f52_local6 + f52_local0[f52_local4] = f52_local5 + end + end + f52_local7 = Engine.Localize( "@MENU_INVITE_TO_PARTY" ) + end + f52_local0[#f52_local0 + 1] = { + type = "UIGenericButton", + id = "join", + disabled = not Engine.UserCanPlayOnline( f52_arg1.controller ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_JOIN_GAME" ), + button_action_func = function ( f54_arg0, f54_arg1 ) + if Engine.IsXB3() and Friends.IsUserInBlockList( f54_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f54_arg0, "popup_join_on_blocked_player_are_you_sure", true, f54_arg1.controller, false, { + friendIndex = f52_arg0.friendIndex + } ) + else + LUI.FlowManager.RequestLeaveMenu( f54_arg0 ) + Friends.JoinRecentPlayer( f54_arg1.controller ) + end + end + } + } + end + if Clan.IsEnabled() and Clan.CanISendInviteToRecentPlayer( f52_arg1.controller, f52_arg0.friendIndex ) and f52_local2 == false then + f52_local0[#f52_local0 + 1] = { + type = "UIGenericButton", + id = "clan_invite", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@LUA_MENU_CLAN_INVITE_TO_CLAN" ), + button_action_func = function ( f55_arg0, f55_arg1 ) + if Engine.IsChatRestricted() then + LUI.FlowManager.RequestPopupMenu( f55_arg0, "user_generated_content_restriction_popup", true, f55_arg1.controller ) + else + Clan.InviteRecentPlayerToClan( f55_arg1.controller ) + end + end + } + } + end + if f52_local1 then + f52_local0[#f52_local0 + 1] = { + type = "UIGenericButton", + id = "profile", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@XBOXLIVE_VIEW_PROFILE" ), + button_action_func = function ( f56_arg0, f56_arg1 ) + Friends.ShowRecentPlayerGamercard( f56_arg1.controller ) + end + } + } + end + if not Engine.IsPS4() then + f52_local0[#f52_local0 + 1] = { + type = "UIGenericButton", + id = "add_friend_btn", + disabled = Friends.IsRecentPlayerAFriend( f52_arg1.controller ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = GetFriendRequestLocString(), + button_action_func = function ( f57_arg0, f57_arg1 ) + Friends.RequestRecentPlayerAsFriend( f57_arg1.controller ) + end + } + } + end + f52_local0[#f52_local0 + 1] = { + type = "UIGenericButton", + id = "report", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_REPORT_PLAYER" ), + button_action_func = function ( f58_arg0, f58_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f58_arg0 ) + LUI.FlowManager.RequestPopupMenu( f58_arg0, "popup_friend_report", true, f58_arg1.controller, false, { + friendIndex = f52_arg0.friendIndex, + reportFunction = Friends.ReportRecentPlayer + } ) + end + } + } + return f52_local0 +end + +function EliteClanFriendActionsFeeder( f59_arg0, f59_arg1 ) + local f59_local0 = {} + local f59_local1 = Engine.IsXbox360() + if not f59_local1 then + f59_local1 = Engine.IsXB3() + if not f59_local1 then + f59_local1 = Engine.IsPS4() + end + end + local f59_local2 = not Engine.InFrontend() + local f59_local3 = Engine.InLobby() + local f59_local4 = Friends.IsEliteClanFriendMe( f59_arg1.controller, f59_arg0.friendIndex ) + if Engine.IsMultiplayer() then + local f59_local5 = #f59_local0 + 1 + local f59_local6 = { + type = "UIGenericButton", + id = "invite" + } + local f59_local7 = f59_local4 + local f59_local8 + if Engine.GetDvarBool( "onlinegame" ) then + f59_local8 = isAliensSolo() + else + f59_local8 = f59_local7 or true + end + f59_local6.disabled = f59_local8 + f59_local8 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup + } + local f59_local9 + if f59_local2 or f59_local3 then + f59_local9 = Engine.Localize( "@MENU_INVITE_TO_GAME" ) + if not f59_local9 then + + else + f59_local8.button_text = f59_local9 + f59_local8.button_action_func = function ( f60_arg0, f60_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f60_arg0 ) + Friends.InviteEliteClanFriend( f60_arg1.controller ) + end + + f59_local6.properties = f59_local8 + f59_local0[f59_local5] = f59_local6 + end + end + f59_local9 = Engine.Localize( "@MENU_INVITE_TO_PARTY" ) + end + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "join", + disabled = f59_local4 or not Engine.UserCanPlayOnline( f59_arg1.controller ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_JOIN_GAME" ), + button_action_func = function ( f61_arg0, f61_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f61_arg0 ) + Friends.JoinEliteClanFriend( f61_arg1.controller ) + end + } + } + if f59_local2 == false then + if Clan.CanIChangeMemberStatus( f59_arg1.controller ) and f59_local4 == false then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "clan_change_status", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@CLANS_CHANGE_MEMBER_STATUS" ), + button_action_func = function ( f62_arg0, f62_arg1 ) + LUI.FlowManager.RequestPopupMenu( f62_arg0, "popup_change_status", true, f62_arg1.controller, false, { + friendIndex = f59_arg0.friendIndex + } ) + end + } + } + end + if Clan.CanIKickMember( f59_arg1.controller ) and f59_local4 == false then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "clan_kick", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@LUA_MENU_CLAN_KICK_FROM_CLAN" ), + button_action_func = function ( f63_arg0, f63_arg1 ) + LUI.FlowManager.RequestPopupMenu( f63_arg0, "popup_kick_are_you_sure", true, f63_arg1.controller, false, { + friendIndex = f59_arg0.friendIndex + } ) + end + } + } + end + if Clan.AmILeader( f59_arg1.controller ) and f59_local4 == false then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "clan_transfer_ownership", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@CLANS_TRANSFER_OWNERSHIP" ), + button_action_func = function ( f64_arg0, f64_arg1 ) + LUI.FlowManager.RequestPopupMenu( f64_arg0, "popup_transfer_are_you_sure", true, f64_arg1.controller, false, { + friendIndex = f59_arg0.friendIndex + } ) + end + } + } + end + if f59_local4 then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "clan_leave", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@CLANS_LEAVE_CLAN" ), + button_action_func = function ( f65_arg0, f65_arg1 ) + local f65_local0 = "popup_leave_are_you_sure" + if Clan.AmILeader( f59_arg1.controller ) then + if Clan.GetMemberCount( f59_arg1.controller ) > 1 then + local f65_local1 = "popup_leave_leader_with_members" + end + f65_local0 = f65_local1 or "popup_leave_leader_are_you_sure" + end + LUI.FlowManager.RequestPopupMenu( f65_arg0, f65_local0, true, f65_arg1.controller, false ) + end + } + } + end + end + if f59_local1 then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "profile", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@XBOXLIVE_VIEW_PROFILE" ), + button_action_func = function ( f66_arg0, f66_arg1 ) + Friends.ShowEliteClanFriendGamercard( f66_arg1.controller ) + end + } + } + end + if not Engine.IsPS4() then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "add_friend_btn", + disabled = f59_local4 or Friends.IsEliteClanPlayerAFriend( f59_arg1.controller ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = GetFriendRequestLocString(), + button_action_func = function ( f67_arg0, f67_arg1 ) + Friends.RequestEliteClanPlayerAsFriend( f67_arg1.controller ) + end + } + } + end + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "report", + disabled = f59_local4, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_REPORT_PLAYER" ), + button_action_func = function ( f68_arg0, f68_arg1 ) + LUI.FlowManager.RequestPopupMenu( f68_arg0, "popup_friend_report", true, f68_arg1.controller, false, { + friendIndex = f59_arg0.friendIndex, + reportFunction = Friends.ReportEliteClanFriend + } ) + end + } + } + return f59_local0 +end + +function ActionsFeeder( f69_arg0 ) + local f69_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "popup_friends" ) + if f69_local0.actionsFeeder then + return f69_local0.actionsFeeder( f69_arg0, f69_local0 ) + else + return {} + end +end + +function popup_friend_list_actions() + return { + type = "generic_selectionList_popup", + id = "popup_friend_list_actions", + handlers = { + close_actions = MBh.LeaveMenu() + }, + properties = { + popup_title = "", + popup_childfeeder = ActionsFeeder, + friendIndex = 0, + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UITimer", + id = "friends_actions_refresh_timer", + properties = { + event = { + name = "element_refresh" + }, + interval = 1000 + } + } + } + } +end + +function RefreshScrollbar( f71_arg0 ) + if f71_arg0.scrollbar then + f71_arg0.scrollbar:manualUpdate( f71_arg0.slot_offset, f71_arg0.maxButtonsOnPage, f71_arg0.total, Friends.Constants.FriendButtonHeight ) + end +end + +function ScrollBy( f72_arg0, f72_arg1, f72_arg2, f72_arg3 ) + local f72_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f72_arg0 ) + local f72_local1 = f72_local0.slot_offset + f72_local0.slot_offset = LUI.clamp( f72_local0.slot_offset + f72_arg3, 0, math.max( 0, f72_local0.total - f72_local0.maxButtonsOnPage ) ) + if f72_local1 ~= f72_local0.slot_offset then + local f72_local2 = f72_arg0:getParent() + if f72_arg1.qualifier ~= ButtonQualifiers.Mousewheel then + f72_arg0:processEvent( { + name = "lose_focus", + immediate = true + } ) + end + f72_local2:dispatchEventToRoot( { + name = "friends_refresh", + immediate = true + } ) + if f72_arg1.qualifier ~= ButtonQualifiers.Mousewheel then + local f72_local3 = f72_local2:getChildById( "friend_button_" .. f72_arg2 ) + f72_local3:processEvent( { + name = "gain_focus", + immediate = true + } ) + end + end + RefreshScrollbar( f72_local0 ) +end + +function FriendButtonGamepadButton( f73_arg0, f73_arg1, f73_arg2 ) + local f73_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f73_arg0 ) + if f73_arg1.down and f73_arg0:isInFocus() then + if f73_arg1.qualifier == ButtonQualifiers.Mousewheel then + if f73_arg1.button == "up" then + ScrollBy( f73_arg0, f73_arg1, f73_arg2, -1 ) + elseif f73_arg1.button == "down" then + ScrollBy( f73_arg0, f73_arg1, f73_arg2, 1 ) + end + return true + elseif f73_arg1.button == "up" and f73_arg2 == 0 then + ScrollBy( f73_arg0, f73_arg1, f73_arg2, -1 ) + return true + elseif f73_arg1.button == "down" and f73_arg2 == f73_local0.maxButtonsOnPage - 1 then + ScrollBy( f73_arg0, f73_arg1, f73_arg2, 1 ) + return true + end + end + return LUI.UIButton.GamepadButton( f73_arg0, f73_arg1 ) +end + +function FriendButtonOverAction( f74_arg0, f74_arg1, f74_arg2 ) + local f74_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f74_arg0 ) + if f74_arg0.properties.toTopAllowed then + f74_arg0:dispatchEventToRoot( { + name = "update_to_top_button_helper", + immediate = true + } ) + end + local f74_local1 = f74_local0.current_slot + f74_local0.current_slot = f74_arg0.properties.buttonNumber + if f74_local0.controller and f74_arg0.properties.friendIndex then + f74_arg2( f74_local0.controller, f74_arg0.properties.friendIndex ) + end + if Engine.IsConsoleGame() or f74_arg1.focusType ~= FocusType.MouseOver then + local f74_local2 + if f74_local0.current_slot > f74_local0.upScrollBoundary or f74_local0.current_slot >= f74_local1 then + f74_local2 = false + else + f74_local2 = true + end + local f74_local3 + if f74_local0.downScrollBoundary > f74_local0.current_slot or f74_local1 >= f74_local0.current_slot then + f74_local3 = false + else + f74_local3 = true + end + local f74_local4 = f74_local2 and f74_local0.slot_offset > 0 + local f74_local5 = f74_local3 and f74_local0.slot_offset < f74_local0.total - f74_local0.maxButtonsOnPage + if f74_local4 then + ScrollBy( f74_arg0, f74_arg1, f74_local1, -1 ) + elseif f74_local5 then + ScrollBy( f74_arg0, f74_arg1, f74_local1, 1 ) + else + f74_arg0:dispatchEventToRoot( { + name = "friends_refresh", + immediate = true + } ) + end + else + f74_arg0:dispatchEventToRoot( { + name = "friends_refresh", + immediate = true + } ) + end +end + +function OpenFriendsOptionPopup( f75_arg0, f75_arg1, f75_arg2, f75_arg3 ) + local f75_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f75_arg0 ) + LUI.FlowManager.RequestPopupMenu( f75_arg0, "popup_friend_list_actions", true, f75_arg3, false, { + popup_title = f75_arg1, + friendIndex = f75_arg2 + } ) +end + +function OpenChallengePopup( f76_arg0, f76_arg1, f76_arg2 ) + if not Engine.InFrontend() or not f76_arg0.properties.challengeFunc then + return + else + f76_arg0:dispatchEventToRoot( { + name = "kill_friends_list", + immediate = true + } ) + LUI.FlowManager.RequestLeaveMenu( f76_arg0 ) + f76_arg0.properties.challengeFunc( f76_arg2 ) + end +end + +function friend_button_children( f77_arg0, f77_arg1, f77_arg2, f77_arg3, f77_arg4, f77_arg5, f77_arg6, f77_arg7, f77_arg8, f77_arg9 ) + local f77_local0 = {} + local f77_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "popup_friends" ) + if Engine.InFrontend() then + f77_local0[#f77_local0 + 1] = { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.black, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = -1, + left = 0, + width = 100, + alpha = 0 + } ), + visible = { + alpha = 1 + } + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.black, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 30, + bottom = 0, + left = 0, + width = 342 + } ) + } + } + }, + handlers = { + button_over = MBh.AnimateToState( "visible" ), + button_up = MBh.AnimateToState( "default" ) + } + } + f77_local0[#f77_local0 + 1] = { + type = "playercard", + properties = { + force_show_rank = true, + patchScale = -0.15 + }, + states = { + default = { + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "visible" ), + button_up = MBh.AnimateToState( "default" ) + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIImage", + id = "small_rectangle_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 20, + height = 16, + left = 450, + width = 5, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + material = RegisterMaterial( "white" ) + }, + over = { + red = 0, + green = 0, + blue = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ) + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIText", + id = "friend_button_subtext", + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 469, + right = -15, + top = 60, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right + } ), + over = { + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + subtext_refresh = function ( f78_arg0, f78_arg1 ) + f78_arg0:setText( f78_arg1.text or "" ) + end + } + } + else + local f77_local2 = Engine.IsAliensMode() and CoD.PlayMode.Aliens or CoD.PlayMode.Core + f77_local0[#f77_local0 + 1] = { + type = "UIImage", + id = "rank_background_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + height = 49, + left = 0, + width = 60, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + alpha = 0.2, + material = RegisterMaterial( "white" ) + }, + over = { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ) + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIImage", + id = "rank_emblem_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 14, + height = 21, + left = 3, + width = 25, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + }, + over = { + red = 1, + green = 1, + blue = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + rank_refresh = function ( f79_arg0, f79_arg1 ) + f79_arg0:setImage( RegisterMaterial( Rank.GetRankIcon( f79_arg1.rank, f79_arg1.prestige, f77_local2 ) ) ) + end + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIText", + id = "rank_number_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 14, + height = 21, + left = 31, + width = 22, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Center + }, + over = { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + rank_refresh = function ( f80_arg0, f80_arg1 ) + f80_arg0:setText( Rank.GetRankDisplay( f80_arg1.rank, f77_local2 ) ) + end + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIImage", + id = "small_rectangle_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 14, + height = 21, + left = 470, + width = 5, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + material = RegisterMaterial( "white" ) + }, + over = { + red = 0, + green = 0, + blue = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ) + } + } + end + return f77_local0 +end + +function friend_button( f81_arg0, f81_arg1, f81_arg2, f81_arg3, f81_arg4, f81_arg5, f81_arg6, f81_arg7, f81_arg8, f81_arg9, f81_arg10, f81_arg11, f81_arg12, f81_arg13 ) + return { + type = "UIGenericButton", + id = "friend_button_" .. f81_arg1, + properties = { + style = GenericButtonSettings.Styles.FlatButton, + substyle = GenericButtonSettings.Styles.FlatButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Info, + buttonNumber = f81_arg1, + toTopAllowed = f81_arg12, + button_display_func = function ( f82_arg0, f82_arg1 ) + if f81_arg0.slot_offset and f81_arg1 then + return f81_arg9( f81_arg0.controller, f81_arg0.slot_offset + f81_arg1 ) + else + + end + end + , + height = Engine.InFrontend() and Friends.Constants.FriendButtonHeight or 49, + y_offset = Engine.InFrontend() and -17 or 0, + content_width = Engine.InFrontend() and 260 or 450, + content_margin = Engine.InFrontend() and 40 or 10, + text_padding_with_content = Engine.InFrontend() and 116 or 70, + label_align = LUI.Alignment.Left, + text_align_with_content = LUI.Alignment.Left, + text_default_color = { + r = 1, + g = 1, + b = 1, + a = 1 + }, + text_focus_color = Engine.InFrontend() and { + a = 0 + } or Colors.black, + content_focus_color_without_bg = Colors.black, + use_locking = false, + challengeFunc = f81_arg13 + }, + handlers = { + gamepad_button = function ( f83_arg0, f83_arg1 ) + return FriendButtonGamepadButton( f83_arg0, f83_arg1, f81_arg1 ) + end + , + button_over = function ( f84_arg0, f84_arg1 ) + FriendButtonOverAction( f84_arg0, f84_arg1, f81_arg11 ) + end + , + button_action = function ( f85_arg0, f85_arg1 ) + local f85_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f85_arg0 ) + if not f85_local0.challengeMode then + OpenFriendsOptionPopup( f85_arg0, f85_arg0.properties.friendName, f85_local0.slot_offset + f81_arg1, f85_arg1.controller ) + else + OpenChallengePopup( f85_arg0, f85_arg0.properties.friendIndex, f85_arg1.controller ) + end + end + , + element_refresh = function ( f86_arg0, f86_arg1 ) + local f86_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f86_arg0 ) + local f86_local1 = f86_local0.slot_offset + f81_arg1 + f86_arg0.properties.friendIndex = f86_local1 + if f86_arg0:isInFocus() then + f81_arg11( f86_local0.controller, f86_local1 ) + end + local f86_local2 = { + gamertag = f81_arg2( f86_local0.controller, f86_local1 ) + } + if not Engine.IsChatRestricted() then + f86_local2.clantag = f81_arg3( f86_local0.controller, f86_local1 ) + end + f86_local2.rank = f81_arg7( f86_local0.controller, f86_local1 ) + f86_local2.prestige = f81_arg8( f86_local0.controller, f86_local1 ) + f86_local2.background = f81_arg6 and f81_arg6( f86_local0.controller, f86_local1 ) or 0 + f86_local2.patchEmblem = f81_arg4 and f81_arg4( f86_local0.controller, f86_local1 ) or 0 + f86_local2.patchShape = f81_arg5 and f81_arg5( f86_local0.controller, f86_local1 ) or 0 + f86_local2.name = "update_playercard" + f86_arg0:processEvent( f86_local2 ) + f86_arg0.properties.friendName = f86_local2.gamertag + if not Engine.InFrontend() and f86_local2.clantag and f86_local2.clantag ~= "" then + f86_arg0:setText( "[" .. f86_local2.clantag .. "]" .. f86_local2.gamertag ) + else + f86_arg0:setText( f86_local2.gamertag ) + end + f86_arg0:processEvent( { + name = "content_refresh" + } ) + f86_arg0:processEvent( { + name = "subtext_refresh", + text = f81_arg10( f86_local0.controller, f86_local1 ) + } ) + if not Engine.InFrontend() then + f86_arg0:processEvent( { + name = "rank_refresh", + rank = f86_local2.rank, + prestige = f86_local2.prestige + } ) + end + end + + }, + children = friend_button_children( f81_arg1, f81_arg2, f81_arg3, f81_arg4, f81_arg5, f81_arg6, f81_arg7, f81_arg8, f81_arg9, f81_arg10 ) + } +end + +function no_friends( f87_arg0 ) + return { + type = "UIElement", + id = "no_friends_id", + properties = { + text = f87_arg0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = Friends.Constants.scrollbarWidth + } + }, + children = { + { + type = "UIElement", + id = "container", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 70, + bottom = -167 + } + }, + children = { + { + type = "UIText", + id = "no_friends_txt", + properties = { + text = MBh.Property( "text" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + height = CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Center + } ) + } + } + } + } + } + } +end + +function EmptySubTextGetter( f88_arg0, f88_arg1 ) + return "" +end + +function FriendFeederFactory( f89_arg0, f89_arg1, f89_arg2, f89_arg3, f89_arg4, f89_arg5, f89_arg6, f89_arg7, f89_arg8, f89_arg9, f89_arg10, f89_arg11, f89_arg12 ) + return function ( f90_arg0, f90_arg1 ) + local f90_local0 = {} + if f90_arg1.total > 0 then + for f90_local1 = 0, math.min( f90_arg1.maxButtonsOnPage - 1, f90_arg1.total - 1 ), 1 do + f90_local0[#f90_local0 + 1] = friend_button( f90_arg1, f90_local1, f89_arg0, f89_arg3, f89_arg4, f89_arg5, f89_arg6, f89_arg7, f89_arg8, f89_arg1, f89_arg2, f89_arg9, f89_arg11, f89_arg12 ) + end + else + f90_local0[#f90_local0 + 1] = f89_arg10() + end + return f90_local0 + end + +end + +function OnlineFriendsFeeder( f91_arg0, f91_arg1 ) + local f91_local0 = Engine.IsAliensMode() + local f91_local1 = FriendFeederFactory + local f91_local2 = Friends.GetOnlineFriendGamertag + local f91_local3 = Friends.GetOnlineFriendPresence + local f91_local4 = EmptySubTextGetter + local f91_local5 = Friends.GetOnlineFriendClanTag + local f91_local6 = Friends.GetOnlineFriendPatch + local f91_local7 = Friends.GetOnlineFriendPatchbacking + local f91_local8 = Friends.GetOnlineFriendBackground + local f91_local9 + if f91_local0 then + f91_local9 = Friends.GetOnlineFriendAlienRank + if not f91_local9 then + + else + local f91_local10 + if f91_local0 then + f91_local10 = Friends.GetOnlineFriendAlienPrestige + if not f91_local10 then + + else + f91_local1 = f91_local1( f91_local2, f91_local3, f91_local4, f91_local5, f91_local6, f91_local7, f91_local8, f91_local9, f91_local10, Friends.SetOnlineFriendStoredXUID, function () + return no_friends( Engine.Localize( "@PLATFORM_NO_FRIENDS" ) ) + end, true, ChallengeFriend ) + return f91_local1( f91_arg0, f91_arg1 ) + end + end + f91_local10 = Friends.GetOnlineFriendPrestige + end + end + f91_local9 = Friends.GetOnlineFriendRank +end + +function LivePartyFriendsFeeder( f93_arg0, f93_arg1 ) + local f93_local0 = Engine.IsAliensMode() + local f93_local1 = FriendFeederFactory + local f93_local2 = Friends.GetLivePartyFriendGamertag + local f93_local3 = Friends.GetLivePartyFriendPresence + local f93_local4 = EmptySubTextGetter + local f93_local5 = Friends.GetLivePartyFriendClanTag + local f93_local6 = Friends.GetLivePartyFriendPatch + local f93_local7 = Friends.GetLivePartyFriendPatchbacking + local f93_local8 = Friends.GetLivePartyFriendBackground + local f93_local9 + if f93_local0 then + f93_local9 = Friends.GetLivePartyFriendAlienRank + if not f93_local9 then + + else + local f93_local10 + if f93_local0 then + f93_local10 = Friends.GetLivePartyFriendAlienPrestige + if not f93_local10 then + + else + f93_local1 = f93_local1( f93_local2, f93_local3, f93_local4, f93_local5, f93_local6, f93_local7, f93_local8, f93_local9, f93_local10, Friends.SetLivePartyFriendStoredXUID, function () + return no_friends( Engine.Localize( "@PLATFORM_NOT_IN_PARTY" ) ) + end, false, ChallengeLivePartyPlayer ) + return f93_local1( f93_arg0, f93_arg1 ) + end + end + f93_local10 = Friends.GetLivePartyFriendPrestige + end + end + f93_local9 = Friends.GetLivePartyFriendRank +end + +function RecentPlayersFeeder( f95_arg0, f95_arg1 ) + local f95_local0 = Engine.IsAliensMode() + local f95_local1 = FriendFeederFactory + local f95_local2 = Friends.GetRecentPlayerGamertag + local f95_local3 = Friends.GetRecentPlayerPresence + local f95_local4 = EmptySubTextGetter + local f95_local5 = Friends.GetRecentPlayerClanTag + local f95_local6 = Friends.GetRecentPlayerPatch + local f95_local7 = Friends.GetRecentPlayerPatchbacking + local f95_local8 = Friends.GetRecentPlayerBackground + local f95_local9 + if f95_local0 then + f95_local9 = Friends.GetRecentPlayerAlienRank + if not f95_local9 then + + else + local f95_local10 + if f95_local0 then + f95_local10 = Friends.GetRecentPlayerAlienPrestige + if not f95_local10 then + + else + f95_local1 = f95_local1( f95_local2, f95_local3, f95_local4, f95_local5, f95_local6, f95_local7, f95_local8, f95_local9, f95_local10, Friends.SetRecentPlayerStoredXUID, function () + return no_friends( Engine.Localize( "@LUA_MENU_NO_RECENT_PLAYERS" ) ) + end, false, ChallengeRecentPlayer ) + return f95_local1( f95_arg0, f95_arg1 ) + end + end + f95_local10 = Friends.GetRecentPlayerPrestige + end + end + f95_local9 = Friends.GetRecentPlayerRank +end + +function EliteClanFriendsFeeder( f97_arg0, f97_arg1 ) + local f97_local0 = Engine.IsAliensMode() + local f97_local1 = FriendFeederFactory + local f97_local2 = Friends.GetEliteClanFriendGamertag + local f97_local3 = Friends.GetEliteClanFriendPresence + local f97_local4 = Friends.GetEliteClanFriendMemberStatus + local f97_local5 = Friends.GetEliteClanFriendClanTag + local f97_local6 = Friends.GetEliteClanFriendPatch + local f97_local7 = Friends.GetEliteClanFriendPatchbacking + local f97_local8 = Friends.GetEliteClanFriendBackground + local f97_local9 + if f97_local0 then + f97_local9 = Friends.GetEliteClanFriendAlienRank + if not f97_local9 then + + else + local f97_local10 + if f97_local0 then + f97_local10 = Friends.GetEliteClanFriendAlienPrestige + if not f97_local10 then + + else + f97_local1 = f97_local1( f97_local2, f97_local3, f97_local4, f97_local5, f97_local6, f97_local7, f97_local8, f97_local9, f97_local10, Friends.SetEliteClanFriendStoredXUID, function () + if not CoDAnywhere.ServiceAvailable( f97_arg1.controller ) then + return no_friends( Engine.Localize( "@LUA_MENU_COD_ANYWHERE_ERROR_SERVICE" ) ) + elseif Clan.IsDownloadingData( f97_arg1.controller ) then + return { + type = "generic_loading_widget", + properties = { + message = Engine.Localize( "@MENU_DOWNLOADING" ) + } + } + else + return no_friends( Engine.Localize( "@MENU_NO_CLAN_DESCRIPTION" ) ) + end + end, false, false ) + return f97_local1( f97_arg0, f97_arg1 ) + end + end + f97_local10 = Friends.GetEliteClanFriendPrestige + end + end + f97_local9 = Friends.GetEliteClanFriendRank +end + +function DebugFriendsFeeder( f99_arg0, f99_arg1 ) + local f99_local0 = FriendFeederFactory( function ( f100_arg0, f100_arg1 ) + return "Friend " .. f100_arg1 + end, function () + return "At the beach" + end, function () + return "h" + end, function () + return "OINK" + end, function () + return 0 + end, function () + return 0 + end, function () + return 0 + end, function () + return 10 + end, function () + return 1 + end, function () + + end, function () + return no_friends( "No debug friends" ) + end, false ) + return f99_local0( f99_arg0, f99_arg1 ) +end + +function WIPFeeder( f111_arg0, f111_arg1 ) + local f111_local0 = {} + return no_friends( "Work in Progress" ) +end + +function MainFriendFeeder( f112_arg0 ) + local f112_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "popup_friends" ) + if f112_local0.feeder then + return f112_local0.feeder( f112_arg0, f112_local0 ) + else + return {} + end +end + +function CursorToTop( f113_arg0, f113_arg1 ) + local f113_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f113_arg0 ) + if f113_local0.slot_offset == 0 and f113_local0.current_slot == 0 then + return + else + f113_local0.slot_offset = 0 + f113_local0.current_slot = 0 + RefreshPage( f113_arg0, f113_arg1 ) + f113_arg0:dispatchEventToChildren( { + name = "focus_vlist", + immediate = true + } ) + end +end + +function PlatformShouldShowGameInvites() + local f114_local0 = Engine.IsPS3() + if not f114_local0 then + f114_local0 = Engine.IsPS4() + end + return f114_local0 +end + +function PlatformShouldShowPartyGameInvites() + return Engine.IsXB3() +end + +function PlatformShouldShowPartyUI() + return Engine.IsXbox360() +end + +function UpdateToTopButtonHelper( f117_arg0 ) + local f117_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f117_arg0 ) + local f117_local1 + if f117_local0.slot_offset <= 0 and f117_local0.current_slot <= 0 then + f117_local1 = false + else + f117_local1 = true + end + local f117_local2 = f117_arg0 + local f117_local3 = f117_arg0.processEvent + local f117_local4 = { + name = "add_button_helper_text", + button_ref = "button_alt1" + } + local f117_local5 + if f117_local1 then + f117_local5 = Engine.Localize( "@LUA_MENU_TOP" ) + if not f117_local5 then + + else + f117_local4.helper_text = f117_local5 + f117_local4.side = "left" + f117_local4.clickable = true + f117_local3( f117_local2, f117_local4 ) + end + end + f117_local5 = "" +end + +function UpdateSelectButtonHelper( f118_arg0 ) + local f118_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f118_arg0 ) + if f118_local0.total then + local f118_local1 = f118_local0.total > 0 + end + local f118_local2 = "" + if not f118_local0.challengeMode then + f118_local2 = Engine.Localize( "@LUA_MENU_SELECT" ) + else + f118_local2 = Engine.Localize( "@LUA_MENU_CHALLENGE" ) + end + f118_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = f118_local2, + side = "left", + clickable = true + } ) +end + +function SetOnlineFriendsHelpers( f119_arg0 ) + local f119_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f119_arg0 ) + UpdateToTopButtonHelper( f119_arg0 ) + if PlatformShouldShowGameInvites() and Friends.CountPendingPlaystationInvites and Friends.CountPendingPlaystationInvites( f119_local0.controller ) > 0 then + f119_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@PLATFORM_VIEW_GAME_INVITES" ), + side = "left", + clickable = true + } ) + else + f119_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + clickable = true + } ) + end + f119_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + clickable = true + } ) +end + +function SetRecentPlayersHelpers( f120_arg0 ) + SetOnlineFriendsHelpers( f120_arg0 ) + f120_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + clickable = true + } ) +end + +function SetLivePartyHelpers( f121_arg0 ) + local f121_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f121_arg0 ) + local f121_local1 = f121_local0.total + if f121_local1 then + f121_local1 = f121_local0.total > 1 + end + local f121_local2 = Engine.GetDvarBool( "onlinegame" ) + local f121_local3 = Engine.Localize + local f121_local4 + if f121_local1 and f121_local2 then + f121_local4 = "@PLATFORM_INVITE_XBOX_LIVE_PARTY" + if not f121_local4 then + + else + f121_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = f121_local3( f121_local4 ), + side = "left", + clickable = true + } ) + if PlatformShouldShowPartyUI() then + f121_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@PLATFORM_PARTY_UI" ), + side = "left", + clickable = true + } ) + else + f121_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + clickable = true + } ) + end + if PlatformShouldShowPartyGameInvites() and Friends.HasPartyGameInvite() then + f121_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = Engine.Localize( "@XBOXLIVE_PARTY_INVITE_ACCEPT" ), + side = "left", + clickable = false + } ) + else + f121_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + clickable = true + } ) + end + end + end + f121_local4 = "@MENU_INVITE_FRIENDS" +end + +function SetClanFriendsHelpers( f122_arg0 ) + local f122_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f122_arg0 ) + UpdateToTopButtonHelper( f122_arg0 ) + f122_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + clickable = true + } ) + f122_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + clickable = true + } ) +end + +function ButtonAlt1Action( f123_arg0, f123_arg1 ) + local f123_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f123_arg0 ) + if f123_local0.CurrentAlt1Action and f123_arg1.controller == f123_local0.exclusiveController then + f123_local0.CurrentAlt1Action( f123_arg0, f123_arg1 ) + end +end + +function ButtonAlt2Action( f124_arg0, f124_arg1 ) + local f124_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f124_arg0 ) + if f124_local0.CurrentAlt2Action and f124_arg1.controller == f124_local0.exclusiveController then + f124_local0.CurrentAlt2Action( f124_arg0, f124_arg1 ) + end +end + +function ButtonStartAction( f125_arg0, f125_arg1 ) + local f125_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f125_arg0 ) + if f125_local0.CurrentStartAction and f125_arg1.controller == f125_local0.exclusiveController then + f125_local0.CurrentStartAction( f125_arg0, f125_arg1 ) + end +end + +function ChangePage( f126_arg0, f126_arg1, f126_arg2, f126_arg3 ) + local f126_local0 + if f126_arg2 == 0 then + f126_local0 = not f126_arg3 + else + f126_local0 = false + end + local f126_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f126_arg0 ) + local f126_local2 = {} + if not f126_local1.isClanRoster then + f126_local2[#f126_local2 + 1] = { + title = Engine.Localize( "@LUA_MENU_FRIENDS" ), + feeder = OnlineFriendsFeeder, + actionsFeeder = OnlineFriendActionsFeeder, + friendsCounter = Friends.GetOnlineFriendsCount, + helpers = SetOnlineFriendsHelpers, + alt1Action = function ( f127_arg0, f127_arg1 ) + f127_arg0:dispatchEventToRoot( { + name = "cursor_to_top_trigger", + immediate = true + } ) + end, + alt2Action = function ( f128_arg0, f128_arg1 ) + if PlatformShouldShowGameInvites() and Friends.CountPendingPlaystationInvites and Friends.CountPendingPlaystationInvites( f128_arg1.controller ) > 0 then + Engine.Exec( "gameInvitesReceived", f128_arg1.controller ) + end + end + } + end + if not f126_local1.isClanRoster then + f126_local2[#f126_local2 + 1] = { + title = Engine.Localize( "@MENU_RECENT_PLAYERS" ), + feeder = RecentPlayersFeeder, + actionsFeeder = RecentPlayerActionsFeeder, + friendsCounter = Friends.GetRecentPlayersCount, + helpers = SetRecentPlayersHelpers, + alt1Action = function ( f129_arg0, f129_arg1 ) + f129_arg0:dispatchEventToRoot( { + name = "cursor_to_top_trigger", + immediate = true + } ) + end + } + end + if not f126_local1.isClanRoster and (Engine.IsXbox360() or Engine.IsXB3()) and not f126_local1.challengeMode then + f126_local2[#f126_local2 + 1] = { + title = Engine.Localize( "@XBOXLIVE_LIVE_PARTY" ), + actionsFeeder = LivePartyFriendActionsFeeder, + feeder = LivePartyFriendsFeeder, + friendsCounter = Friends.GetLivePartyFriendsCount, + helpers = SetLivePartyHelpers, + alt1Action = function ( f130_arg0, f130_arg1 ) + local f130_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f130_arg0 ) + local f130_local1 = f130_local0.total + if f130_local1 then + f130_local1 = f130_local0.total > 1 + end + if Engine.GetDvarBool( "onlinegame" ) and f130_local1 then + Friends.InviteAllLiveParty( f130_arg1.controller ) + elseif Friends.OpenSystemFriendsList then + Friends.OpenSystemFriendsList( f130_arg1.controller ) + else + Engine.Exec( "xshowfriendslist" ) + end + end, + alt2Action = function ( f131_arg0, f131_arg1 ) + Friends.OpenLivePartyUI( f131_arg1.controller ) + end, + startAction = function ( f132_arg0, f132_arg1 ) + if Friends.HasPartyGameInvite() then + Friends.AcceptLivePartyInvitation( f132_arg1.controller ) + end + end + } + end + local f126_local3 = nil + if Clan.IsEnabled() and not f126_local1.challengeMode then + f126_local2[#f126_local2 + 1] = { + title = Friends.GetEliteClanName( f126_local1.controller ), + feeder = EliteClanFriendsFeeder, + actionsFeeder = EliteClanFriendActionsFeeder, + friendsCounter = Friends.GetEliteClanFriendsCount, + helpers = SetClanFriendsHelpers, + alt1Action = function ( f133_arg0, f133_arg1 ) + f133_arg0:dispatchEventToRoot( { + name = "cursor_to_top_trigger", + immediate = true + } ) + end + } + f126_local3 = #f126_local2 + end + if not f126_local1.total then + f126_local1.total = 0 + end + local f126_local4 = f126_local1.page_index + local f126_local5 = f126_local4 + f126_local4 = math.max( 1, math.min( f126_local4 + f126_arg2, #f126_local2 ) ) + if f126_arg2 ~= 0 and f126_local4 == f126_local5 then + return + end + f126_local1.page_index = f126_local4 + f126_local1.feeder = f126_local2[f126_local4].feeder + f126_local1.actionsFeeder = f126_local2[f126_local4].actionsFeeder + local f126_local6 = f126_local1.total + f126_local1.total = f126_local2[f126_local4].friendsCounter( f126_local1.controller ) + if f126_arg2 ~= 0 and f126_local1.total == 0 then + Engine.PlaySound( CoD.SFX.MouseOver ) + end + if f126_local0 then + f126_local0 = f126_local1.total == f126_local6 + end + if not f126_local0 and not f126_local1.isTopOfStack then + f126_local1.total = f126_local6 + return + end + local f126_local7 = Clan.IsDownloadingData( f126_local1.controller ) + if f126_local0 then + if f126_local1.page_index == f126_local3 and f126_local1.wasDownloadingClanData then + f126_local0 = f126_local7 + else + f126_local0 = true + end + end + f126_local1.wasDownloadingClanData = f126_local7 + if not f126_local0 then + f126_local1.current_slot = 0 + f126_local1.slot_offset = 0 + f126_arg0:processEvent( { + name = "wipe_vlist" + } ) + f126_local1.maxButtonsOnPage = Engine.InFrontend() and 5 or 9 + f126_local1.upScrollBoundary = 1 + f126_local1.downScrollBoundary = f126_local1.maxButtonsOnPage - 2 + end + if not f126_local0 then + f126_arg0:processEvent( { + name = "menu_refresh" + } ) + else + f126_arg0:processEvent( { + name = "element_refresh" + } ) + end + if not f126_local0 then + if f126_local1.isTopOfStack and not f126_arg1.mouse then + f126_arg0:processEvent( { + name = "focus_vlist" + } ) + end + if f126_local1.isClanRoster then + f126_arg0:processEvent( { + name = "hide_arrows" + } ) + else + if f126_local4 == 1 then + f126_arg0:processEvent( { + name = "disable_left_arrow" + } ) + else + f126_arg0:processEvent( { + name = "enable_left_arrow" + } ) + end + if f126_local4 == #f126_local2 then + f126_arg0:processEvent( { + name = "disable_right_arrow" + } ) + else + f126_arg0:processEvent( { + name = "enable_right_arrow" + } ) + end + end + f126_arg0:processEvent( { + name = "update_title", + title_text = f126_local2[f126_local4].title + } ) + f126_local1.CurrentAlt1Action = f126_local2[f126_local4].alt1Action + f126_local1.CurrentAlt2Action = f126_local2[f126_local4].alt2Action + f126_local1.CurrentStartAction = f126_local2[f126_local4].startAction + UpdateSelectButtonHelper( f126_arg0 ) + end + if f126_local1.total and 0 < f126_local1.total then + f126_arg0:processEvent( { + name = "show_scrollbar" + } ) + if f126_local1.scrollbar then + f126_local1.scrollbar:manualUpdate( f126_local1.slot_offset, f126_local1.maxButtonsOnPage, f126_local1.total, Friends.Constants.FriendButtonHeight ) + end + else + f126_arg0:processEvent( { + name = "hide_scrollbar" + } ) + end + if f126_local2[f126_local4].helpers then + f126_local2[f126_local4].helpers( f126_arg0 ) + end +end + +function NextPage( f134_arg0, f134_arg1 ) + local f134_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f134_arg0 ) + if f134_arg1.controller == f134_local0.exclusiveController then + ChangePage( f134_arg0, f134_arg1, 1, true ) + end +end + +function PreviousPage( f135_arg0, f135_arg1 ) + local f135_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f135_arg0 ) + if f135_arg1.controller == f135_local0.exclusiveController then + ChangePage( f135_arg0, f135_arg1, -1, true ) + end +end + +function RefreshPage( f136_arg0, f136_arg1 ) + ChangePage( f136_arg0, f136_arg1, 0, f136_arg1.forceRefresh or false ) +end + +function UpdatePopupTitle( f137_arg0, f137_arg1 ) + f137_arg0:setText( f137_arg1.title ) +end + +f0_local0 = function ( f138_arg0, f138_arg1 ) + local f138_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f138_arg0 ) + f138_local0.isTopOfStack = true + f138_local0.controller = f138_arg0.properties.exclusiveController + f138_local0.isClanRoster = f138_arg0.properties.isClanRoster + f138_local0.feeder = function () + return {} + end + + f138_local0.page_index = 1 + f138_local0.slot_offset = 0 + f138_local0.current_slot = 0 + f138_local0.scrollbar = f138_arg0:getFirstDescendentById( "scrollbar" ) + f138_local0.scrollbar:setList( f138_arg0:getFirstDescendentById( "friends_vlist" ) ) + if Friends.IsEliteClanAllowed( f138_local0.controller ) and Engine.InFrontend() and 0 > Engine.GetDvarInt( "elite_clan_delay" ) then + Engine.Exec( "starteliteclan" ) + end + if Engine.IsXB3() then + Engine.ExecNow( "friends_refresh", f138_local0.controller ) + end + Engine.ExecNow( "refreshfacebookfriends" ) + Engine.ExecNow( "eliteclan_refresh", f138_arg0.properties.exclusiveController ) + f138_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) + if Friends.HasPartyGameInvite() and not f138_local0.isClanRoster then + ChangePage( f138_arg0, f138_arg1, 2, true ) + else + ChangePage( f138_arg0, f138_arg1, 0, true ) + end +end + +function friends_list() + return { + type = "UIElement", + id = "friends_list_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = f0_local0, + popup_active = function ( f141_arg0, f141_arg1 ) + local f141_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f141_arg0 ) + f141_local0.isTopOfStack = false + end + , + popup_inactive = function ( f142_arg0, f142_arg1 ) + local f142_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f142_arg0 ) + f142_local0.isTopOfStack = true + end + , + previous_page = PreviousPage, + next_page = NextPage, + friends_refresh = RefreshPage, + cursor_to_top_trigger = CursorToTop, + update_to_top_button_helper = UpdateToTopButtonHelper, + live_connection = function ( f143_arg0, f143_arg1 ) + if f143_arg1.signed_in == nil then + f143_arg1.signed_in = Engine.IsUserSignedInToLive() + end + if not f143_arg1.signed_in then + f143_arg0:dispatchEventToRoot( { + name = "kill_friends_list", + immediate = true + } ) + LUI.FlowManager.RequestLeaveMenu( f143_arg0 ) + end + end + + }, + children = { + { + type = "UITimer", + id = "friends_refresh_timer", + properties = { + event = { + name = "friends_refresh", + dispatchChildren = true + }, + interval = 1000 + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIImage", + id = "black_bar_1", + states = { + default = { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false, + left = 0, + bottom = 0, + right = 0, + height = 300, + red = 0, + green = 0, + blue = 0, + alpha = Engine.InFrontend() and 0 or 1, + material = RegisterMaterial( "white" ) + } + } + }, + { + type = "UIImage", + id = "black_bar_2", + states = { + default = { + leftAnchor = true, + topAnchor = false, + rightAnchor = true, + bottomAnchor = true, + left = 0, + top = 0, + right = 0, + height = 300, + red = 0, + green = 0, + blue = 0, + alpha = Engine.InFrontend() and 0 or 1, + material = RegisterMaterial( "white" ) + } + } + }, + { + type = "UIElement", + id = "popup", + properties = { + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -275, + bottom = 275, + left = Engine.InFrontend() and -395 or -485, + right = Engine.InFrontend() and 395 or 485 + } + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + id = "popup_title", + properties = { + title_bar_text = "", + fill_alpha = 1 + } + }, + { + type = "UIWorldBlur", + id = "optionsWorldBlurOverlay", + states = { + default = { + worldBlur = Engine.InFrontend() and 0 or 5 + } + } + }, + { + type = "generic_menu_background", + id = "popup_background", + properties = { + fill_alpha = 1 + } + }, + { + type = "UIElement", + id = "help_padding", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 1, + right = -1, + top = 0, + bottom = -1 + } + }, + children = { + { + type = "button_helper_text_main", + id = "help_texts", + properties = { + left_inset = 10, + top_margin = GenericFooterDims.TopMargin_WithoutBackground, + background_alpha = 0 + } + } + } + }, + { + type = "UIButton", + id = "arrow_left_btn", + requireFocusType = FocusType.MouseOver, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 6, + bottom = 28, + left = 50, + right = 72, + alpha = 1 + }, + disabled = { + alpha = 0.3 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + button_action = function ( f144_arg0, f144_arg1 ) + f144_arg0:dispatchEventToRoot( { + name = "previous_page", + mouse = true, + controller = f144_arg1.controller + } ) + end + , + enable_left_arrow = MBh.AnimateToState( "default" ), + disable_left_arrow = MBh.AnimateToState( "disabled" ), + hide_arrows = MBh.AnimateToState( "hidden" ) + }, + children = { + { + type = "UIImage", + id = "arrow_left", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 22, + right = -22, + material = RegisterMaterial( "widg_lobby_arrow" ) + } + } + } + } + }, + { + type = "UIButton", + id = "arrow_right_btn", + requireFocusType = FocusType.MouseOver, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 6, + bottom = 28, + left = -72, + right = -50, + alpha = 1 + }, + disabled = { + alpha = 0.3 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + button_action = function ( f145_arg0, f145_arg1 ) + f145_arg0:dispatchEventToRoot( { + name = "next_page", + mouse = true, + controller = f145_arg1.controller + } ) + end + , + enable_right_arrow = MBh.AnimateToState( "default" ), + disable_right_arrow = MBh.AnimateToState( "disabled" ), + hide_arrows = MBh.AnimateToState( "hidden" ) + }, + children = { + { + type = "UIImage", + id = "arrow_right", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "widg_lobby_arrow" ) + } + } + } + } + }, + { + type = "UIElement", + id = "popup_content", + properties = { + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = GenericTitleBarDims.TitleBarHeight, + bottom = 0, + spacing = 0 + } + }, + children = { + { + type = "UIVerticalList", + id = "friends_vlist", + handlers = { + focus_vlist = function ( f146_arg0, f146_arg1 ) + f146_arg0:processEvent( { + name = "lose_focus" + } ) + f146_arg0:clearSavedState() + f146_arg0:processEvent( { + name = "gain_focus" + } ) + end + , + wipe_vlist = function ( f147_arg0, f147_arg1 ) + f147_arg0:closeChildren() + f147_arg0:processEvent( { + name = "lose_focus" + } ) + f147_arg0:clearSavedState() + end + + }, + properties = { + exclusiveController = MBh.Property( "exclusiveController" ), + noWrap = true, + sendScrollEvents = true + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 4, + right = -Friends.Constants.scrollbarWidth - 3, + top = 3, + bottom = -3, + spacing = 4, + alignment = LUI.Alignment.Center + } + }, + childrenFeeder = MainFriendFeeder + }, + { + type = "UIVerticalScrollbar", + id = "scrollbar", + properties = { + on_move_func = function ( f148_arg0, f148_arg1, f148_arg2, f148_arg3 ) + local f148_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f148_arg1 ) + if f148_local0.total then + f148_local0.slot_offset = math.floor( f148_arg2 * f148_local0.total ) + f148_local0.slot_offset = LUI.clamp( f148_local0.slot_offset, 0, math.max( 0, f148_local0.total - f148_local0.maxButtonsOnPage ) ) + f148_arg1:dispatchEventToRoot( { + name = "friends_refresh", + immediate = true + } ) + end + end + + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 3, + bottom = -41, + left = -Friends.Constants.scrollbarWidth, + right = -4, + alpha = 1 + }, + visible = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + hide_scrollbar = MBh.AnimateToState( "hidden", 0 ), + show_scrollbar = MBh.AnimateToState( "visible", 0 ), + init_scrollbar = function ( f149_arg0, f149_arg1 ) + local f149_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f149_arg0 ) + f149_arg0:manualUpdate( f149_local0.slot_offset, f149_local0.maxButtonsOnPage, f149_local0.total, Friends.Constants.FriendButtonHeight ) + end + + }, + children = { + { + type = "UITimer", + properties = { + event = "init_scrollbar", + interval = 1, + disposable = true, + deferNextFrame = true + } + } + } + } + } + } + } + }, + { + type = "generic_back_button" + }, + { + type = "UIBindButton", + handlers = { + button_left = function ( f150_arg0, f150_arg1 ) + f150_arg0:dispatchEventToRoot( { + name = "previous_page", + controller = f150_arg1.controller, + immediate = true + } ) + end + , + button_right = function ( f151_arg0, f151_arg1 ) + f151_arg0:dispatchEventToRoot( { + name = "next_page", + controller = f151_arg1.controller, + immediate = true + } ) + end + , + button_alt1 = ButtonAlt1Action, + button_alt2 = ButtonAlt2Action, + button_start = ButtonStartAction + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "popup_friends", friends_list ) +LUI.MenuBuilder.registerDef( "popup_friend_list_actions", popup_friend_list_actions ) +LUI.MenuBuilder.registerDef( "popup_friend_invite_sent", popup_friend_invite_sent ) +LUI.MenuBuilder.registerDef( "popup_friend_report", popup_friend_report ) +LUI.MenuBuilder.registerDef( "popup_confirm_report", popup_confirm_report ) +LUI.MenuBuilder.registerDef( "popup_elite_clan_updating", popup_elite_clan_updating ) +LUI.MenuBuilder.registerDef( "popup_update_clan_finished", popup_update_clan_finished ) +LUI.MenuBuilder.registerDef( "popup_kick_are_you_sure", popup_kick_are_you_sure ) +LUI.MenuBuilder.registerDef( "popup_transfer_are_you_sure", popup_transfer_are_you_sure ) +LUI.MenuBuilder.registerDef( "popup_leave_are_you_sure", popup_leave_are_you_sure ) +LUI.MenuBuilder.registerDef( "popup_leave_leader_are_you_sure", popup_leave_leader_are_you_sure ) +LUI.MenuBuilder.registerDef( "popup_leave_leader_with_members", popup_leave_leader_with_members ) +LUI.MenuBuilder.registerDef( "popup_change_status", popup_change_status ) +LUI.MenuBuilder.registerDef( "popup_join_on_blocked_player_are_you_sure", popup_join_on_blocked_player_are_you_sure ) +LockTable( _M ) diff --git a/lui/common_menus/friendslistutils.dec.lua b/lui/common_menus/friendslistutils.dec.lua new file mode 100644 index 0000000..fa46267 --- /dev/null +++ b/lui/common_menus/friendslistutils.dec.lua @@ -0,0 +1,16 @@ +if Friends then + Friends.Constants = { + scrollbarWidth = 14, + FriendButtonHeight = 90, + reportOffensiveLobbyPlayer = 4, + reportExploitingLobbyPlayer = 5, + reportCheatingLobbyPlayer = 6, + reportBoostingLobbyPlayer = 7 + } + Friends.FacebookAllowedFlags = { + Active = 1, + FriendsActive = 2, + UploadPhotoActive = 4, + UploadVideoActive = 8 + } +end diff --git a/lui/common_menus/friendswidget.dec.lua b/lui/common_menus/friendswidget.dec.lua new file mode 100644 index 0000000..3d0faea --- /dev/null +++ b/lui/common_menus/friendswidget.dec.lua @@ -0,0 +1,150 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function CanSomeoneAccessFriendslist() + for f1_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.HasActiveLocalClient( f1_local0 ) and Engine.UserCanAccessFriendsList( f1_local0 ) then + return true + end + end + return false +end + +function online_friends_widget( f2_arg0, f2_arg1 ) + if not f2_arg1 then + f2_arg1 = {} + end + local self = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + bottom = -35, + right = -100, + width = 50, + height = 36, + alpha = 1 + } ) + self:registerAnimationState( "disabled", { + alpha = 0 + } ) + self.id = "online_friends_widget" + self:registerEventHandler( "show_widget", function ( element, event ) + local f3_local0 = element:getParent() + if f3_local0 then + local f3_local1 = LUI.ButtonHelperText.CommonEvents.addFriendsButton + f3_local1.ignorePopups = f2_arg1.ignorePopups + f3_local0:processEvent( f3_local1 ) + element:animateToState( "default", 100 ) + if Engine.IsXB3() or not Engine.IsConsoleGame() then + Engine.ExecNow( "friends_widget_refresh" ) + end + end + end ) + self:registerEventHandler( "hide_widget", function ( element, event ) + local f4_local0 = element:getParent() + if f4_local0 then + local f4_local1 = LUI.ButtonHelperText.CommonEvents.removeFriendsButton + f4_local1.dispatchChildren = true + f4_local0:processEvent( f4_local1 ) + element:animateToState( "disabled", 0 ) + end + end ) + self:registerEventHandler( "live_connection", function ( element, event ) + if event.signed_in == nil then + local f5_local0 = Engine.IsNetworkConnected() + if f5_local0 then + f5_local0 = Engine.IsUserSignedInToLive() + end + event.signed_in = f5_local0 + end + if event.signed_in and CanSomeoneAccessFriendslist() then + element:processEvent( { + name = "show_widget" + } ) + else + element:processEvent( { + name = "hide_widget" + } ) + end + end ) + self:registerEventHandler( "network_connection", function ( element, event ) + if not event.plugged_in then + element:processEvent( { + name = "hide_widget" + } ) + elseif Engine.IsUserSignedInToLive() then + element:processEvent( { + name = "show_widget" + } ) + end + end ) + self:registerEventHandler( "menu_create", function ( element, event ) + element:processEvent( { + name = "live_connection" + } ) + end ) + local f2_local1 = LUI.UIBindButton.new() + f2_local1.id = "friends_bind_buttons_id" + f2_local1:registerEventHandler( "button_alt2", function ( element, event ) + if Engine.IsNetworkConnected() and Engine.IsUserSignedInToLive( event.controller ) then + local f8_local0 = Engine.UserCanAccessFriendsList( event.controller ) + local f8_local1 = Engine.IsUserAGuest( event.controller ) + if f8_local0 and not f8_local1 then + if Engine.InFrontend() then + LUI.FlowManager.RequestPopupMenu( element, "popup_friends", true, event.controller, false, {} ) + else + LUI.FlowManager.RequestAddMenu( element, "popup_friends", true, event.controller, false, {} ) + end + elseif f8_local1 then + LUI.FlowManager.RequestPopupMenu( element, "mp_no_guest_popup", false, event.controller, false ) + elseif Engine.IsPS3() and event.controller ~= 0 then + LUI.FlowManager.RequestPopupMenu( element, "mp_wrong_controller_popup", false, event.controller, false ) + end + end + return true + end ) + self:addElement( f2_local1 ) + local f2_local2 = LUI.UIImage.new + local f2_local3 = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -5, + bottom = 5, + left = 0, + right = 10, + material = RegisterMaterial( "widg_triangle" ) + } + if not Engine.InFrontend() then + local f2_local4 = Engine.GetDvarBool( "dedicated_dhclient" ) + local f2_local5 = 0.7 + end + f2_local3.alpha = f2_local4 and f2_local5 or 0.25 + f2_local3.zRot = -135 + f2_local2 = f2_local2( f2_local3 ) + f2_local2.id = "friends_triangle_id" + self:addElement( f2_local2 ) + if Friends then + f2_local3 = LUI.UIText.new( CoD.ColorizeState( Colors.frontend_hilite, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + left = 0, + right = 0, + height = CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Right + } ) ) + f2_local3.id = "friends_number_text" + f2_local3:setupUIBindText( "CountOnlineFriends" ) + self:addElement( f2_local3 ) + end + return self +end + +LUI.MenuBuilder.registerType( "online_friends_widget", online_friends_widget ) +LockTable( _M ) diff --git a/lui/common_menus/gamemanual.dec.lua b/lui/common_menus/gamemanual.dec.lua new file mode 100644 index 0000000..bf7354e --- /dev/null +++ b/lui/common_menus/gamemanual.dec.lua @@ -0,0 +1,423 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function () + local f1_local0 = nil + local f1_local1 = Languages[Engine.GetCurrentLanguage and Engine.GetCurrentLanguage() or 0] + assert( f1_local1 ) + local f1_local2 = "bkgd_manual_" + if Engine.IsSpecialRegion() then + if f1_local1 == "LANGUAGE_FRENCH" then + f1_local2 = "bkgd_manual_alt_language_" + f1_local1 = "LANGUAGE_FRENCHCA" + elseif f1_local1 == "LANGUAGE_ENGLISH" then + f1_local2 = "bkgd_manual_alt_language_" + f1_local1 = "LANGUAGE_ENGLISHUK" + end + end + local f1_local3 = { + X360 = { + LANGUAGE_BRITISH = 4, + LANGUAGE_ENGLISH = 5, + LANGUAGE_FRENCH = 5, + LANGUAGE_GERMAN = 5, + LANGUAGE_ITALIAN = 5, + LANGUAGE_SPANISH = 5, + LANGUAGE_RUSSIAN = 5, + LANGUAGE_POLISH = 5, + LANGUAGE_KOREAN = 5, + LANGUAGE_TAIWANESE = 5, + LANGUAGE_JAPANESE = 4, + LANGUAGE_CHINESE = 5, + LANGUAGE_THAI = 5, + LANGUAGE_CZECH = 5, + LANGUAGE_SPANISHNA = 5, + LANGUAGE_PORTUGUESE = 5, + LANGUAGE_FRENCHCA = 1, + LANGUAGE_ENGLISHUK = 5 + }, + XB3 = { + LANGUAGE_BRITISH = 5, + LANGUAGE_ENGLISH = 4, + LANGUAGE_FRENCH = 4, + LANGUAGE_GERMAN = 4, + LANGUAGE_ITALIAN = 4, + LANGUAGE_SPANISH = 4, + LANGUAGE_RUSSIAN = 4, + LANGUAGE_POLISH = 4, + LANGUAGE_KOREAN = 4, + LANGUAGE_TAIWANESE = 4, + LANGUAGE_JAPANESE = 5, + LANGUAGE_CHINESE = 4, + LANGUAGE_THAI = 4, + LANGUAGE_CZECH = 4, + LANGUAGE_SPANISHNA = 4, + LANGUAGE_PORTUGUESE = 4, + LANGUAGE_FRENCHCA = 4, + LANGUAGE_ENGLISHUK = 4 + }, + PS3 = { + LANGUAGE_BRITISH = 4, + LANGUAGE_ENGLISH = 6, + LANGUAGE_FRENCH = 7, + LANGUAGE_GERMAN = 7, + LANGUAGE_ITALIAN = 7, + LANGUAGE_SPANISH = 7, + LANGUAGE_RUSSIAN = 7, + LANGUAGE_POLISH = 7, + LANGUAGE_KOREAN = 6, + LANGUAGE_TAIWANESE = 6, + LANGUAGE_JAPANESE = 4, + LANGUAGE_CHINESE = 6, + LANGUAGE_THAI = 6, + LANGUAGE_CZECH = 6, + LANGUAGE_SPANISHNA = 6, + LANGUAGE_PORTUGUESE = 6, + LANGUAGE_FRENCHCA = 6, + LANGUAGE_ENGLISHUK = 7 + }, + PS4 = { + LANGUAGE_BRITISH = 4, + LANGUAGE_ENGLISH = 5, + LANGUAGE_FRENCH = 7, + LANGUAGE_GERMAN = 7, + LANGUAGE_ITALIAN = 7, + LANGUAGE_SPANISH = 7, + LANGUAGE_RUSSIAN = 7, + LANGUAGE_POLISH = 7, + LANGUAGE_KOREAN = 6, + LANGUAGE_TAIWANESE = 6, + LANGUAGE_JAPANESE = 4, + LANGUAGE_CHINESE = 6, + LANGUAGE_THAI = 6, + LANGUAGE_CZECH = 6, + LANGUAGE_SPANISHNA = 5, + LANGUAGE_PORTUGUESE = 5, + LANGUAGE_FRENCHCA = 5, + LANGUAGE_ENGLISHUK = 7 + }, + PC = { + LANGUAGE_BRITISH = 3, + LANGUAGE_ENGLISH = 5, + LANGUAGE_FRENCH = 5, + LANGUAGE_GERMAN = 5, + LANGUAGE_ITALIAN = 5, + LANGUAGE_SPANISH = 5, + LANGUAGE_RUSSIAN = 5, + LANGUAGE_POLISH = 5, + LANGUAGE_KOREAN = 5, + LANGUAGE_TAIWANESE = 5, + LANGUAGE_JAPANESE = 3, + LANGUAGE_CHINESE = 5, + LANGUAGE_THAI = 5, + LANGUAGE_CZECH = 5, + LANGUAGE_SPANISHNA = 5, + LANGUAGE_PORTUGUESE = 5, + LANGUAGE_FRENCHCA = 5, + LANGUAGE_ENGLISHUK = 5 + } + } + if Engine.IsXbox360() then + f1_local0 = f1_local3.X360[f1_local1] + elseif Engine.IsXB3() then + f1_local0 = f1_local3.XB3[f1_local1] + elseif Engine.IsPS3() then + f1_local0 = f1_local3.PS3[f1_local1] + elseif Engine.IsPS4() then + f1_local0 = f1_local3.PS4[f1_local1] + else + f1_local0 = f1_local3.PC[f1_local1] + end + assert( f1_local0 ) + local f1_local4 = {} + for f1_local5 = 1, f1_local0, 1 do + table.insert( f1_local4, f1_local2 .. f1_local5 ) + end + return f1_local4 +end + +function changePage( f2_arg0, f2_arg1 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) + local f2_local1 = f2_local0.currentPage + f2_local0.currentPage = LUI.clamp( f2_local0.currentPage + f2_arg1, 1, #f2_local0.manualPages ) + f2_arg0:dispatchEventToRoot( { + name = "change_page" + } ) + if f2_local1 ~= f2_local0.currentPage then + if f2_arg1 > 0 then + f2_arg0:dispatchEventToRoot( { + name = "next_page" + } ) + elseif f2_arg1 < 0 then + f2_arg0:dispatchEventToRoot( { + name = "previous_page" + } ) + end + end +end + +function game_manual() + local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "game_manual" ) + f3_local0.manualPages = f0_local0() + assert( #f3_local0.manualPages > 0 ) + local self = LUI.UIElement.new() + self.id = "game_manual" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f3_local2 = LUI.UIImage.new() + f3_local2.id = "centerPage" + f3_local2:registerAnimationState( "default", { + material = RegisterMaterial( f3_local0.manualPages[1] ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f3_local2:animateToState( "default" ) + f3_local2:registerEventHandler( "change_page", function ( element, event ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + element:setImage( RegisterMaterial( f4_local0.manualPages[f4_local0.currentPage] ) ) + end ) + self:addElement( f3_local2 ) + local f3_local3 = LUI.UIButton.new() + f3_local3.id = "leftArrow" + f3_local3:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -330, + left = 100, + width = 40, + height = 80, + alpha = 1 + } ) + f3_local3:registerAnimationState( "disabled", { + alpha = 0.5 + } ) + f3_local3:registerAnimationState( "bump", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -330, + left = 90, + width = 40, + height = 80 + } ) + f3_local3:registerEventHandler( "next_page", MBh.AnimateToState( "default", 0 ) ) + f3_local3:registerEventHandler( "previous_page", function ( element, event ) + local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + local f5_local1 = { + { + "default", + 0 + }, + { + "bump", + 40, + true, + true + }, + { + "default", + 100, + true, + true + } + } + if f5_local0.currentPage <= 1 then + table.insert( f5_local1, { + "disabled", + 80 + } ) + end + local f5_local2 = MBh.AnimateSequence( f5_local1 ) + f5_local2( element, event ) + end ) + f3_local3:registerEventHandler( "button_action", function ( element, event ) + changePage( element, -1 ) + end ) + f3_local3:registerEventHandler( "button_over", function ( element, event ) + if event.focusType == FocusType.MouseOver then + element:processEvent( { + name = "arrow_image_over", + immediate = true + } ) + end + end ) + f3_local3:registerEventHandler( "button_up", function ( element, event ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if f8_local0.currentPage > 1 then + element:animateToState( "default" ) + else + element:animateToState( "disabled" ) + end + element:processEvent( { + name = "arrow_image_up", + immediate = true + } ) + end ) + f3_local3:animateToState( "default" ) + f3_local3:animateToState( "disabled" ) + local f3_local4 = LUI.UIImage.new() + f3_local4.id = "leftArrowImage" + f3_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( "widg_margin_arrow_lt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) ) + f3_local4:registerAnimationState( "over", CoD.ColorizeState( Colors.frontend_hilite, {} ) ) + f3_local4:animateToState( "default" ) + f3_local4:registerEventHandler( "arrow_image_over", MBh.AnimateToState( "over" ) ) + f3_local4:registerEventHandler( "arrow_image_up", MBh.AnimateToState( "default" ) ) + f3_local3:addElement( f3_local4 ) + self:addElement( f3_local3 ) + local f3_local5 = LUI.UIButton.new() + f3_local5.id = "rightArrow" + f3_local5:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = -330, + right = -100, + width = 40, + height = 80, + alpha = 1 + } ) + f3_local5:registerAnimationState( "disabled", { + alpha = 0.5 + } ) + f3_local5:registerAnimationState( "bump", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = -330, + right = -90, + width = 40, + height = 80 + } ) + f3_local5:registerEventHandler( "previous_page", MBh.AnimateToState( "default", 0 ) ) + f3_local5:registerEventHandler( "next_page", function ( element, event ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + local f9_local1 = { + { + "default", + 0 + }, + { + "bump", + 40, + true, + true + }, + { + "default", + 100, + true, + true + } + } + if #f9_local0.manualPages <= f9_local0.currentPage then + table.insert( f9_local1, { + "disabled", + 80 + } ) + end + local f9_local2 = MBh.AnimateSequence( f9_local1 ) + f9_local2( element, event ) + end ) + f3_local5:animateToState( "default" ) + f3_local5:registerEventHandler( "button_action", function ( element, event ) + changePage( element, 1 ) + end ) + f3_local5:registerEventHandler( "button_over", function ( element, event ) + if event.focusType == FocusType.MouseOver then + element:processEvent( { + name = "arrow_image_over", + immediate = true + } ) + end + end ) + f3_local5:registerEventHandler( "button_up", function ( element, event ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if f12_local0.currentPage < #f12_local0.manualPages then + element:animateToState( "default" ) + else + element:animateToState( "disabled" ) + end + element:processEvent( { + name = "arrow_image_up", + immediate = true + } ) + end ) + local f3_local6 = LUI.UIImage.new() + f3_local6.id = "leftArrowImage" + f3_local6:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( "widg_margin_arrow_rt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) ) + f3_local6:registerAnimationState( "over", CoD.ColorizeState( Colors.frontend_hilite, {} ) ) + f3_local6:animateToState( "default" ) + f3_local6:registerEventHandler( "arrow_image_over", MBh.AnimateToState( "over" ) ) + f3_local6:registerEventHandler( "arrow_image_up", MBh.AnimateToState( "default" ) ) + f3_local5:addElement( f3_local6 ) + self:addElement( f3_local5 ) + local f3_local7 = LUI.MenuBuilder.BuildAddChild( self, { + type = "button_helper_text_main", + properties = { + background_alpha = 1 + } + } ) + f3_local7:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + local f3_local8 = LUI.UIBindButton.new() + f3_local8.id = "bind" + f3_local8:registerEventHandler( "button_secondary", function ( element, event ) + LUI.FlowManager.RequestLeaveMenu( element ) + end ) + f3_local8:registerEventHandler( "button_left", function ( element, event ) + changePage( element, -1 ) + end ) + f3_local8:registerEventHandler( "button_right", function ( element, event ) + changePage( element, 1 ) + end ) + self:addElement( f3_local8 ) + self:registerEventHandler( "menu_create", function ( element, event ) + local f16_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + f16_local0.currentPage = 1 + changePage( element, 0 ) + end ) + return self +end + +LUI.MenuBuilder.registerType( "game_manual", game_manual ) +LockTable( _M ) diff --git a/lui/common_menus/kinectcontrolmenu.dec.lua b/lui/common_menus/kinectcontrolmenu.dec.lua new file mode 100644 index 0000000..3dd57db --- /dev/null +++ b/lui/common_menus/kinectcontrolmenu.dec.lua @@ -0,0 +1,782 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function KinectGuideFeeder( f1_arg0 ) + local f1_local0 = {} + Kinect.BuildShortcutArray() + if Kinect.ShortcutArray ~= nil then + for f1_local1 = 1, #Kinect.ShortcutArray, 1 do + local f1_local4 = f1_local1 + table.insert( f1_local0, { + type = "UIButton", + id = "kinect_guide_grid_" .. f1_local4 .. "_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = Kinect.Layout.CellWidth, + height = Kinect.Layout.CellHeight + } + }, + handlers = { + button_action = function ( f2_arg0, f2_arg1 ) + Kinect.ExecShortcut( f2_arg0, f2_arg1, f1_local4 ) + 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_over = MBh.AnimateLoop( { + { + "dim", + 750, + true, + true + }, + { + "default", + 750 + } + } ), + button_up = MBh.AnimateToState( "default", 0 ) + }, + children = { + { + type = "kinect_button_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.05 + }, + focused = { + alpha = 0.4 + } + }, + handlers = { + button_over = MBh.AnimateToState( "focused" ), + button_up = MBh.AnimateToState( "default" ) + } + } + } + }, + { + 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 = { + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "focused" ), + button_up = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + width = 128, + height = 128, + material = RegisterMaterial( "icon_kinect_number_0" .. f1_local4 ), + alpha = 0.1 + } ), + focused = CoD.ColorizeState( Colors.black, { + scale = 0.1 + } ), + unfocused = CoD.ColorizeState( Colors.black, { + scale = 0 + } ) + }, + handlers = { + button_over = MBh.AnimateSequence( { + { + "unfocused", + 0 + }, + { + "focused", + 100 + }, + { + "unfocused", + 100 + } + } ), + button_up = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + left = 0, + right = 0, + height = 32 + } + }, + children = { + { + type = "kinect_btn_footer_bg", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5 + } + } + }, + { + type = "UIMarqueeText", + id = "kinect_guide_grid_desc_id", + properties = { + text = Engine.Localize( Kinect.ShortcutArray[f1_local4].TextLabel ), + textStyle = CoD.TextStyle.OutlinedMore + }, + states = { + default = CoD.ColorizeState( Kinect.Swatch.DescColor, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 3, + right = -3, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ), + focused = CoD.ColorizeState( Kinect.Swatch.DescColorInvert, {} ), + unfocused = CoD.ColorizeState( Kinect.Swatch.DescColor, {} ) + } + } + } + } + } + } ) + end + else + DebugPrint( "Kinect: Warning, Kinect.ShortcutArray is nil!" ) + end + return f1_local0 +end + +function kinect_btn_footer_bg() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 8, + material = RegisterMaterial( "box_kinect_name_lt" ) + } + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 8, + right = -8, + material = RegisterMaterial( "box_kinect_name_mid" ) + } + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -8, + right = 0, + material = RegisterMaterial( "box_kinect_name_rt" ) + } + } + } + } + } +end + +function HandleKinectGuideMenuAutoRefresh( f4_arg0, f4_arg1 ) + if Kinect.DoWeNeedToRebuildShortcutArray() == true then + LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) + end +end + +function kinect_guide_grid() + return { + type = "UIGrid", + id = "kinect_guide_grid_id", + handlers = { + autorefresh = HandleKinectGuideMenuAutoRefresh + }, + properties = { + elementsPerRow = Kinect.Layout.NumRows, + rowHeight = 150, + hSpacing = 6, + vSpacing = 6, + vAlign = LUI.Alignment.Center, + hAlign = LUI.Alignment.Center + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + childrenFeeder = KinectGuideFeeder + } +end + +function HandleKinectGuideMenuSpeechBack( f6_arg0, f6_arg1, f6_arg2 ) + if not Kinect.IsWhatCanISayMenuUp() and Kinect.IsKinectGuideUp() then + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) + LUI.Speech.PerformingSpeechAction() + end +end + +function HandleKinectGuideMenuSpeechCancel( f7_arg0, f7_arg1, f7_arg2 ) + LUI.FlowManager.RequestLeaveMenu( f7_arg0 ) + LUI.Speech.PerformingSpeechAction() +end + +function HandleKinectGuideMenuSpeechYes( f8_arg0, f8_arg1, f8_arg2 ) + +end + +function HandleKinectGuideMenuSpeechNo( f9_arg0, f9_arg1, f9_arg2 ) + +end + +function HandleKinectGuideMenuSpeechShortcut( f10_arg0, f10_arg1, f10_arg2 ) + assert( f10_arg2, "HandleKinectGuideMenuSpeechShortcut: Missing extradata param!" ) + assert( f10_arg2.shortcutNum, "HandleKinectGuideMenuSpeechShortcut: Missing extradata shortcutNum param!" ) + Kinect.ExecShortcut( f10_arg0, f10_arg1, f10_arg2.shortcutNum ) +end + +function HandleKinectGuideMenuSpeechReplaceShortcut( f11_arg0, f11_arg1, f11_arg2 ) + assert( f11_arg2, "HandleKinectGuideMenuSpeechReplaceShortcut: Missing extradata param!" ) + assert( f11_arg2.shortcutNum, "HandleKinectGuideMenuSpeechReplaceShortcut: Missing extradata shortcutNum param!" ) +end + +if Engine.HasSpeechFeature() then + KinectGuideMenuSpeechGrammarHandlersArray = { + { + action = "back", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechBack, + extradata = nil + }, + { + action = "cancel", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechCancel, + extradata = nil + }, + { + action = "yes", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechYes, + extradata = nil + }, + { + action = "no", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechNo, + extradata = nil + }, + { + action = "Shortcut 1", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 1 + } + }, + { + action = "Shortcut 2", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 2 + } + }, + { + action = "Shortcut 3", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 3 + } + }, + { + action = "Shortcut 4", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 4 + } + }, + { + action = "Shortcut 5", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 5 + } + }, + { + action = "Shortcut 6", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 6 + } + }, + { + action = "Shortcut 7", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 7 + } + }, + { + action = "Shortcut 8", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 8 + } + }, + { + action = "Shortcut 9", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 9 + } + }, + { + action = "Replace Shortcut 1", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 1 + } + }, + { + action = "Replace Shortcut 2", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 2 + } + }, + { + action = "Replace Shortcut 3", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 3 + } + }, + { + action = "Replace Shortcut 4", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 4 + } + }, + { + action = "Replace Shortcut 5", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 5 + } + }, + { + action = "Replace Shortcut 6", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 6 + } + }, + { + action = "Replace Shortcut 7", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 7 + } + }, + { + action = "Replace Shortcut 8", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 8 + } + }, + { + action = "Replace Shortcut 9", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 9 + } + } + } +else + KinectGuideMenuSpeechGrammarHandlersArray = {} +end +function HandleKinectGuideMenuSpeechHandler( f12_arg0, f12_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.ProcessActionEvent( f12_arg0, f12_arg1, KinectGuideMenuSpeechGrammarHandlersArray ) + end +end + +function HandleKinectGuideMenuCreate( f13_arg0, f13_arg1 ) + f13_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) +end + +function kinect_guide() + return { + type = "UIElement", + id = "kinect_guide_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = HandleKinectGuideMenuCreate, + speech_action = HandleKinectGuideMenuSpeechHandler + }, + children = { + { + type = "UIImage", + id = "kinect_menu_overlay_id", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIElement", + id = "kinect_menu_container_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = Kinect.Layout.Width, + height = Kinect.Layout.Height + } + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + id = "kinect_title_id", + properties = { + font = CoD.TextSettings.ExtraBigFont, + title_bar_text = Engine.Localize( "@SPEECH_SHORTCUTS_TITLE" ), + title_bar_alignment = LUI.Alignment.Center, + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + id = "kinect_background_id", + properties = { + fill_alpha = 1 + } + }, + { + type = "kinect_guide_grid", + id = "kinect_guide_grid_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 10, + bottom = -1 * (GenericFooterDims.Height + 5), + left = 5, + right = -5 + } + } + }, + { + type = "UITimer", + id = "kinect_guid_grid_autorefresh_timer", + properties = { + event = "autorefresh", + interval = 1000, + disposable = false, + broadcastToRoot = false + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = -40, + left = 1, + right = -1, + height = 1, + material = RegisterMaterial( "white" ), + alpha = Swatches.GenericMenu.BorderAlpha + } ) + } + }, + { + type = "button_helper_text_main", + id = "kinect_helper_text_id", + properties = { + left_inset = 10, + left_margin = 1, + right_margin = -1, + top_margin = GenericFooterDims.TopMargin_WithoutBackground, + spacing = 65, + background_alpha = 0 + } + }, + { + type = "UIBindButton", + id = "kinect_bind_buttons_id", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } + } + } +end + +function kinect_button_background( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg1.red or 1 + local f15_local1 = f15_arg1.green or 1 + local f15_local2 = f15_arg1.blue or 1 + local f15_local3 = f15_arg1.alpha or 1 + local f15_local4 = f15_arg1.colorLocked or false + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = top, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f15_local6 = LUI.UIImage.new() + f15_local6.id = "corner" + f15_local6:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 32, + left = 0, + right = 32, + material = RegisterMaterial( "btn_cas_item_topleft" ) + } ) + f15_local6:animateToState( "default" ) + self:addElement( f15_local6 ) + local f15_local7 = LUI.UIImage.new() + f15_local7.id = "top" + f15_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 32, + left = 32, + right = 0, + material = RegisterMaterial( "white" ) + } ) + f15_local7:animateToState( "default" ) + self:addElement( f15_local7 ) + local f15_local8 = LUI.UIImage.new() + f15_local8.id = "bottom" + f15_local8:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 32, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ) + } ) + f15_local8:animateToState( "default" ) + self:addElement( f15_local8 ) + self.colorize = function ( f16_arg0, f16_arg1, f16_arg2, f16_arg3 ) + for f16_local3, f16_local4 in ipairs( { + f15_local6, + f15_local7, + f15_local8 + } ) do + f16_local4:registerAnimationState( "current", { + red = f16_arg0, + green = f16_arg1, + blue = f16_arg2, + alpha = f16_arg3 + } ) + f16_local4:animateToState( "current" ) + end + end + + self.colorize( f15_local0, f15_local1, f15_local2, f15_local3 ) + if not f15_local4 then + self:registerEventHandler( "updateBackgroundColor", function ( element, event ) + element.colorize( event.red, event.green, event.blue, event.alpha ) + end ) + end + return self +end + +LUI.MenuBuilder.registerDef( "kinect_guide", kinect_guide ) +LUI.FlowManager.RegisterStackPopBehaviour( "kinect_guide", function () + Engine.ExecNow( "decnosplitscreencontrol kinect_guide_dec" ) +end ) +LUI.MenuBuilder.registerDef( "kinect_guide_grid", kinect_guide_grid ) +LUI.MenuBuilder.registerDef( "kinect_btn_footer_bg", kinect_btn_footer_bg ) +LUI.MenuBuilder.registerType( "kinect_button_background", kinect_button_background ) +LockTable( _M ) diff --git a/lui/common_menus/kinectutils.dec.lua b/lui/common_menus/kinectutils.dec.lua new file mode 100644 index 0000000..43d8f33 --- /dev/null +++ b/lui/common_menus/kinectutils.dec.lua @@ -0,0 +1,1023 @@ +local f0_local0 = { + "speech/iw6/grammars/global.cfg", + "speech/iw6/grammars/frontend.cfg", + "speech/iw6/grammars/shortcuts.cfg", + "speech/iw6/grammars/lobby.cfg" +} +local f0_local1 = { + "speech/iw6/grammars/global.cfg" +} +Kinect = { + DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS = true, + Layout = { + Height = 554, + Width = 780, + NumRows = 3, + CellHeight = 150, + CellWidth = 250 + }, + Swatch = { + Background = Colors.generic_menu_frame_color, + IndexColor = Colors.frontend_hilite, + DescColor = Colors.white, + DescColorInvert = Colors.black + }, + RightBits = { + None = 0, + CodPlayMode = { + SP = 1, + Core = 2, + Aliens = 4, + SquadVsSquad = 8 + }, + UnlockedAliens = 16, + CampaignResume = 32, + CanHostOrFindGame = 64 + }, + KinectShortcutMenuController = 0, + ShortcutRights = 0, + ShortcutArray = nil, + IsWhatCanISayMenuUp = function () + local f1_local0 = Engine.GetLuiRoot() + if f1_local0 and LUI.FlowManager.IsInStack( f1_local0.flowManager, "what_can_i_say" ) then + return true + else + return false + end + end, + IsKinectGuideUp = function () + local f2_local0 = Engine.GetLuiRoot() + if f2_local0 and LUI.FlowManager.IsInStack( f2_local0.flowManager, "kinect_guide" ) then + return true + else + return false + end + end, + IsAnyKinectMenuUp = function () + if Kinect.IsWhatCanISayMenuUp() then + return true + elseif Kinect.IsKinectGuideUp() then + return true + else + return false + end + end, + CanOpenWhatCanISayMenu = function () + if Engine.HasSpeechFeature() == false then + return false + elseif Kinect.IsWhatCanISayMenuUp() == true then + return false + elseif not Engine.InFrontend() and Engine.IsVideoPlaying and Engine.IsVideoPlaying() == true then + DebugPrint( "Speech: Ignoring What Can I Say menu request because we are in the game and a video is playing." ) + return false + elseif true == LUI.FlowManager.IsTopMenuModal() then + return false + elseif not Engine.InFrontend() and Engine.IsMultiplayer() then + DebugPrint( "Speech: Ignoring What Can I Say menu request because we are in the game that does not support any speech commands." ) + return false + else + return true + end + end, + OpenWhatCanISayMenu = function ( f5_arg0 ) + if Kinect.CanOpenWhatCanISayMenu() ~= true then + return + else + local f5_local0 = Engine.GetLuiRoot() + if not f5_local0 then + return + elseif not Engine.InFrontend() and not Engine.IsMultiplayer() and Engine.GetDvarInt( "cl_paused" ) == 0 then + Engine.TogglePause() + f5_local0.is_paused = true + f5_local0:processEvent( { + name = "hud_refresh" + } ) + f5_local0:dispatchEventToRoot( { + name = "toggle_pause", + open_kinect_what_can_i_say_menu_instead = true + } ) + return + else + Kinect.menu_under_what_can_i_say = LUI.FlowManager.GetTopOpenAndVisibleMenuName() + Kinect.what_can_i_say_unpause_when_close = false + LUI.FlowManager.RequestPopupMenu( self, "what_can_i_say", true, f5_arg0, false ) + end + end + end, + CloseWhatCanISayMenu = function ( f6_arg0, f6_arg1 ) + if Kinect.IsWhatCanISayMenuUp() ~= true then + return + end + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) + if not Engine.InFrontend() and not Engine.IsMultiplayer() and Kinect.what_can_i_say_unpause_when_close == true then + LUI.FlowManager.RequestCloseAllMenus( f6_arg0 ) + Engine.TogglePause() + f6_arg0:dispatchEventToRoot( { + name = "toggle_pause_off" + } ) + end + Kinect.what_can_i_say_unpause_when_close = false + end, + CanOpenKinectGuide = function () + if Engine.HasSpeechFeature() == false then + return false + elseif Engine.InFrontend() == false then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because we are not in the front end menus." ) + return false + elseif Kinect.IsAnyKinectMenuUp() == true then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because we already have one or more kinect menus up." ) + return false + elseif LUI.FlowManager.IsTopMenuModal() then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because we top menu is modal." ) + return false + elseif LUI.MenuAutoNav.IsRunning() then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because we are currently processing a menu autonavigation." ) + return false + end + local f7_local0 = LUI.FlowManager.GetTopOpenAndVisibleMenuName() + if f7_local0 then + if string.lower( f7_local0 ) == string.lower( "main_lockout" ) then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because main_lockout is up." ) + return false + elseif string.lower( f7_local0 ) == string.lower( "boot_brightness" ) then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because boot_brightness is up." ) + return false + elseif string.lower( f7_local0 ) == string.lower( "boot_screen_margins" ) then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because boot_screen_margins is up." ) + return false + elseif string.lower( f7_local0 ) == string.lower( "no_profile_warning_popmenu" ) then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because no_profile_warning_popmenu is up." ) + return false + elseif string.lower( f7_local0 ) == string.lower( "error_popmenu" ) then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because error_popmenu is up." ) + return false + end + end + return true + end, + OpenKinectGuide = function ( f8_arg0 ) + if Kinect.CanOpenKinectGuide() ~= true then + return + else + Engine.ExecNow( "incnosplitscreencontrol kinect_guide_inc " .. tostring( f8_arg0 ) ) + Kinect.KinectShortcutMenuController = f8_arg0 + LUI.FlowManager.RequestPopupMenu( self, "kinect_guide", true, f8_arg0, false ) + end + end, + EnableGlobalGrammars = function () + if Engine.HasSpeechFeature() then + if Engine.InFrontend() then + LUI.Speech.EnableGrammars( f0_local0 ) + else + LUI.Speech.EnableGrammars( f0_local1 ) + end + end + end, + RestartGlobalGrammars = function () + if Engine.HasSpeechFeature() then + if Engine.InFrontend() then + LUI.Speech.Restart( f0_local0 ) + else + LUI.Speech.Restart( f0_local1 ) + end + end + end, + CanHostOrFindGame = function () + local f11_local0 = Lobby.IsInPrivateParty() + local f11_local1 = Lobby.IsPrivatePartyHost() + local f11_local2 = Lobby.IsPartyHostWaitingOnMembers() + local f11_local3 + if not f11_local0 or f11_local1 then + f11_local3 = f11_local2 + else + f11_local3 = true + end + if f11_local3 ~= true then + return true + else + return false + end + end, + ActionSPResumeCampaign = function ( f12_arg0, f12_arg1 ) + if Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f12_arg0 ) + LUI.MenuAutoNav.Goto( "resume_campaign", f12_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSPMissionSelect = function ( f13_arg0, f13_arg1 ) + if Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f13_arg0 ) + LUI.MenuAutoNav.Goto( "mission_select", f13_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSPGoToMultiplayer = function ( f14_arg0, f14_arg1 ) + if Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f14_arg0 ) + LUI.MenuAutoNav.Goto( "mp", f14_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSPGoToExtinction = function ( f15_arg0, f15_arg1 ) + if Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f15_arg0 ) + LUI.MenuAutoNav.Goto( "aliens", f15_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSPGoToSquads = function ( f16_arg0, f16_arg1 ) + if Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f16_arg0 ) + LUI.MenuAutoNav.Goto( "squads", f16_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPGoToMainMenu = function ( f17_arg0, f17_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f17_arg0 ) + LUI.MenuAutoNav.Goto( "sp", f17_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPSwitchToMultiplayer = function ( f18_arg0, f18_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f18_arg0 ) + LUI.MenuAutoNav.Goto( "mp", f18_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPSwitchToExtinction = function ( f19_arg0, f19_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f19_arg0 ) + LUI.MenuAutoNav.Goto( "aliens", f19_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPSwitchToSquad = function ( f20_arg0, f20_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f20_arg0 ) + LUI.MenuAutoNav.Goto( "squads", f20_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPFindGame = function ( f21_arg0, f21_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f21_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_findmatch", f21_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPSplitScreen = function ( f22_arg0, f22_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f22_arg0 ) + LUI.MenuAutoNav.Goto( "splitscreen", f22_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPPrivateMatchGameSetup = function ( f23_arg0, f23_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f23_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_privatematch_gamesetup", f23_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPCreateASoldier = function ( f24_arg0, f24_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f24_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_create_squad", f24_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPLeaderboards = function ( f25_arg0, f25_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f25_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_barracks_leaderboards", f25_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionAliensLoadout = function ( f26_arg0, f26_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f26_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_aliens_loadout", f26_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionAliensLeaderboards = function ( f27_arg0, f27_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f27_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_aliens_leaderboards", f27_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSSquadAssault = function ( f28_arg0, f28_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f28_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_squad_assault", f28_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSSquadVsSquad = function ( f29_arg0, f29_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f29_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_squad_vs_squad", f29_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSSafeguard = function ( f30_arg0, f30_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f30_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_safeguard", f30_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSWargame = function ( f31_arg0, f31_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f31_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_wargame", f31_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSSquadReports = function ( f32_arg0, f32_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f32_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_squad_reports", f32_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSLocalPlay = function ( f33_arg0, f33_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f33_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_local_play", f33_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + GetShortcutRightsBits = function () + local f34_local0 = Kinect.RightBits.None + local f34_local1 = Engine.GetCurrentCoDPlayMode() + if f34_local1 == CoD.PlayMode.SP then + f34_local0 = f34_local0 + Kinect.RightBits.CodPlayMode.SP + elseif f34_local1 == CoD.PlayMode.Core then + f34_local0 = f34_local0 + Kinect.RightBits.CodPlayMode.Core + elseif f34_local1 == CoD.PlayMode.Aliens then + f34_local0 = f34_local0 + Kinect.RightBits.CodPlayMode.Aliens + elseif f34_local1 == CoD.PlayMode.SquadVsSquad then + f34_local0 = f34_local0 + Kinect.RightBits.CodPlayMode.SquadVsSquad + end + if Engine.UnlockedAliens() then + f34_local0 = f34_local0 + Kinect.RightBits.UnlockedAliens + end + if not Engine.IsMultiplayer() then + if not LUI.sp_menus.MainCampaignMenu.isResumeDisabled() then + f34_local0 = f34_local0 + Kinect.RightBits.CampaignResume + end + elseif Kinect.CanHostOrFindGame() then + f34_local0 = f34_local0 + Kinect.RightBits.CanHostOrFindGame + end + return f34_local0 + end, + DoWeNeedToRebuildShortcutArray = function () + local f35_local0 = false + if Kinect.ShortcutRights ~= Kinect.GetShortcutRightsBits() then + f35_local0 = true + end + return f35_local0 + end, + BuildShortcutArray = function () + Kinect.ShortcutRights = Kinect.GetShortcutRightsBits() + Kinect.ShortcutArray = {} + local f36_local0 = Engine.GetCurrentCoDPlayMode() + if f36_local0 == CoD.PlayMode.SP then + if not LUI.sp_menus.MainCampaignMenu.isResumeDisabled() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_RESUME_CAMPAIGN", + Action = Kinect.ActionSPResumeCampaign + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_MISSION_SELECT", + Action = Kinect.ActionSPMissionSelect + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_MULTIPLAYER", + Action = Kinect.ActionSPGoToMultiplayer + } + if Engine.UnlockedAliens() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_EXTINCTION", + Action = Kinect.ActionSPGoToExtinction + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_SQUADS", + Action = Kinect.ActionSPGoToSquads + } + elseif f36_local0 == CoD.PlayMode.Core then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_MAIN_MENU", + Action = Kinect.ActionMPGoToMainMenu + } + if Engine.UnlockedAliens() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_EXTINCTION", + Action = Kinect.ActionMPSwitchToExtinction + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_SQUADS", + Action = Kinect.ActionMPSwitchToSquad + } + if Kinect.CanHostOrFindGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_FIND_GAME", + Action = Kinect.ActionMPFindGame + } + end + if Engine.IsConsoleGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SPLIT_SCREEN", + Action = Kinect.ActionMPSplitScreen + } + end + if Kinect.CanHostOrFindGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_PRIVATE_MATCH_GAME_SETUP", + Action = Kinect.ActionMPPrivateMatchGameSetup + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_CUSTOMIZE_SQUAD", + Action = Kinect.ActionMPCreateASoldier + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_LEADERBOARDS", + Action = Kinect.ActionMPLeaderboards + } + elseif f36_local0 == CoD.PlayMode.Aliens then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_MAIN_MENU", + Action = Kinect.ActionMPGoToMainMenu + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_MULTIPLAYER", + Action = Kinect.ActionMPSwitchToMultiplayer + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_SQUADS", + Action = Kinect.ActionMPSwitchToSquad + } + if Kinect.CanHostOrFindGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_FIND_GAME", + Action = Kinect.ActionMPFindGame + } + end + if Engine.IsConsoleGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_LOCAL_PLAY", + Action = Kinect.ActionMPSplitScreen + } + end + if Kinect.CanHostOrFindGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_CUSTOM_MATCH_GAME_SETUP", + Action = Kinect.ActionMPPrivateMatchGameSetup + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_LOADOUT", + Action = Kinect.ActionAliensLoadout + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_LEADERBOARDS", + Action = Kinect.ActionAliensLeaderboards + } + elseif f36_local0 == CoD.PlayMode.SquadVsSquad then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_MAIN_MENU", + Action = Kinect.ActionMPGoToMainMenu + } + if Engine.UnlockedAliens() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_EXTINCTION", + Action = Kinect.ActionMPSwitchToExtinction + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_MULTIPLAYER", + Action = Kinect.ActionMPSwitchToMultiplayer + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SQUAD_ASSAULT", + Action = Kinect.ActionSvSSquadAssault + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SQUAD_VS_SQUAD", + Action = Kinect.ActionSvSSquadVsSquad + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SAFEGUARD", + Action = Kinect.ActionSvSSafeguard + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_WARGAME", + Action = Kinect.ActionSvSWargame + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SQUAD_REPORTS", + Action = Kinect.ActionSvSSquadReports + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_LOCAL_PLAY", + Action = Kinect.ActionSvSLocalPlay + } + end + end, + FindShortcut = function ( f37_arg0 ) + if Kinect.ShortcutArray ~= nil and f37_arg0 >= 1 and f37_arg0 <= #Kinect.ShortcutArray then + return Kinect.ShortcutArray[f37_arg0] + else + return nil + end + end, + ExecShortcut = function ( f38_arg0, f38_arg1, f38_arg2 ) + local f38_local0 = false + local f38_local1 = Kinect.FindShortcut( f38_arg2 ) + if f38_local1 then + if f38_local1.Action then + f38_local1.Action( f38_arg0, f38_arg1 ) + f38_local0 = true + else + DebugPrint( "Kinect: WARNING: Shortcut for \"" .. f38_local1.TextLabel .. "\" has a NIL Action!" ) + end + else + DebugPrint( "Kinect: WARNING: Unknown shortcut! " .. f38_arg2 ) + end + return f38_local0 + end, + PressMenuButton = function ( f39_arg0, f39_arg1 ) + assert( f39_arg0 ) + local f39_local0 = Engine.GetLuiRoot() + if f39_local0 == nil then + return false + else + local f39_local1 = f39_local0:getFirstDescendentById( f39_arg0 ) + if not f39_local1 then + return false + elseif f39_local1.disabled and not f39_local1.locked then + return false + else + f39_local1:processEvent( { + name = "button_action", + controller = f39_arg1 + } ) + f39_local1:processEvent( { + name = "button_down", + controller = f39_arg1 + } ) + return true + end + end + end +} +KinectLobbyMember = { + Next = function ( f40_arg0 ) + local f40_local0 = f40_arg0 + if not f40_local0 then + return nil + end + f40_local0.index = f40_local0.index + 1 + if f40_local0.maxSlots < f40_local0.index then + return nil + elseif Lobby.IsActiveMemberSlot( f40_local0.index - 1 ) then + f40_local0.isActiveMemberSlot = true + f40_local0.slot = LUI.mp_menus.MPMemberList.LobbyMemberGetSlot( f40_local0.memberListState, f40_local0.index ) + f40_local0.team = LUI.mp_menus.MPMemberList.LobbyMemberGetTeam( f40_local0.memberListState, f40_local0.index ) + f40_local0.gamerTag = Lobby.GetMemberName( f40_local0.memberListState, f40_local0.slot, f40_local0.team ) + f40_local0.muted = Lobby.IsMemberMuted( f40_local0.memberListState, f40_local0.slot, f40_local0.team ) + else + f40_local0.isActiveMemberSlot = false + f40_local0.slot = -1 + f40_local0.team = -1 + f40_local0.gamerTag = "" + f40_local0.muted = false + end + return f40_local0 + end, + Iter = function () + local f41_local0 = Engine.GetLuiRoot() + if not f41_local0 then + return nil + end + local f41_local1 = LUI.FlowManager.IsInStack( f41_local0.flowManager, "menu_xboxlive_lobby" ) + local f41_local2 = LUI.FlowManager.IsInStack( f41_local0.flowManager, "menu_xboxlive_privatelobby" ) + local f41_local3 = LUI.FlowManager.IsInStack( f41_local0.flowManager, "menu_gamesetup_systemlink" ) + local f41_local4 = LUI.FlowManager.IsInStack( f41_local0.flowManager, "menu_gamesetup_splitscreen" ) + local f41_local5 = f41_local1 + local f41_local6 = f41_local2 + local f41_local7 + if not f41_local3 then + f41_local7 = not f41_local4 + else + f41_local7 = false + end + if not f41_local7 then + return nil + end + local f41_local8 = {} + if f41_local1 or f41_local2 then + f41_local8.memberListState = Lobby.MemberListStates.Lobby + else + f41_local8.memberListState = Lobby.MemberListStates.Prelobby + end + f41_local8.memberListState = LobbyMemberListGetState( f41_local8.memberListState ) + f41_local8.count = Lobby.GetMemberCount( f41_local8.memberListState ) + if f41_local8.count <= 0 then + return nil + end + f41_local8.maxSlots = Engine.IsAliensMode() and 4 or Lobby.MaxMemberListSlots + f41_local8.index = 0 + f41_local8.Next = KinectLobbyMember.Next + return f41_local8.Next() + end, + FindCurrentSelected = function ( f42_arg0 ) + local f42_local0 = Engine.GetLuiRoot() + if not f42_local0 then + return nil, nil + end + local f42_local1 = Engine.IsAliensMode() and 4 or Lobby.MaxMemberListSlots + for f42_local2 = 1, f42_local1, 1 do + local f42_local5 = f42_local0:getFirstDescendentById( "member_" .. f42_local2 ) + if f42_local5 and f42_local5:isInFocus() and (not f42_local5.disabled or f42_local5.disabled == false) and Lobby.GetMemberControllerIndex( f42_local5.properties.memberListState, f42_local5.properties.memberSlot, f42_local5.properties.team ) == f42_arg0 then + local f42_local6 = f42_local5.properties.isActiveMemberSlot + local f42_local7 = { + memberListState = f42_local5.properties.memberListState, + count = Lobby.GetMemberCount( f42_local7.memberListState ), + maxSlots = f42_local1, + index = f42_local5.properties.memberIndex, + Next = KinectLobbyMember.Next + } + if f42_local6 then + f42_local7.isActiveMemberSlot = true + f42_local7.slot = f42_local5.properties.memberSlot + f42_local7.team = f42_local5.properties.team + f42_local7.gamerTag = f42_local5.properties.gamerTag + f42_local7.muted = Lobby.IsMemberMuted( f42_local7.memberListState, f42_local7.slot, f42_local7.team ) + else + f42_local7.isActiveMemberSlot = false + f42_local7.slot = -1 + f42_local7.team = -1 + f42_local7.gamerTag = "" + f42_local7.muted = false + end + return f42_local7, f42_local5 + end + end + return nil, nil + end +} +Kinect.DebugDumpPartyPlayers = function () + DebugPrint( "Current party members:" ) + local f43_local0 = KinectLobbyMember.Iter() + while f43_local0 ~= nil do + if f43_local0.isActiveMemberSlot == true then + DebugPrint( " #" .. f43_local0.index .. " : gamerTag = \"" .. tostring( f43_local0.gamerTag ) .. "\", muted = " .. tostring( f43_local0.muted ) ) + else + DebugPrint( " #" .. f43_local0.index .. " : ---" ) + end + f43_local0 = f43_local0.Next() + end + DebugPrint( " " ) +end + +Kinect.LobbyHandleSpeechCompare = function ( f44_arg0, f44_arg1, f44_arg2 ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + else + local f44_local0, f44_local1 = nil + f44_local0, f44_local1 = KinectLobbyMember.FindCurrentSelected( f44_arg1.controller ) + if not f44_local0 then + return + elseif not f44_local1 then + return + elseif f44_local0.isActiveMemberSlot ~= true then + return + else + local f44_local2 = LUI.FlowManager.GetMenuScopedDataFromElement( f44_local1 ) + if f44_local2.animating == true then + return + elseif f44_local2.focusedPage ~= 2 then + return + else + f44_local2.force_press_lobby_navigation_arrow_right_btn = true + Kinect.PressMenuButton( "lobby_navigation_arrow_right_btn" ) + LUI.Speech.PerformingSpeechAction() + end + end + end +end + +Kinect.LobbyHandleSpeechMute = function ( f45_arg0, f45_arg1, f45_arg2 ) + assert( f45_arg2 ~= nil, "Kinect.LobbyHandleSpeechMute: Missing extradata param!" ) + assert( f45_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMute: Missing extradata.mute param!" ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + end + local f45_local0, f45_local1 = nil + f45_local0, f45_local1 = KinectLobbyMember.FindCurrentSelected( f45_arg1.controller ) + if not f45_local0 then + return + elseif f45_local0.isActiveMemberSlot ~= true then + return + elseif Lobby.IsMemberALocalPlayer( f45_local0.memberListState, f45_local0.slot, f45_local0.team ) == false then + if Lobby.MemberToggleMute then + if f45_arg2.mute == true then + if Lobby.IsMemberMuted( f45_local0.memberListState, f45_local0.slot, f45_local0.team ) == false then + DebugPrint( "Kinect: Muting player \"" .. f45_local0.gamerTag .. "\"" ) + Lobby.MemberToggleMute( f45_local0.memberListState, f45_local0.slot, f45_local0.team ) + end + elseif Lobby.IsMemberMuted( f45_local0.memberListState, f45_local0.slot, f45_local0.team ) == true then + DebugPrint( "Kinect: Unmuting player \"" .. f45_local0.gamerTag .. "\"" ) + Lobby.MemberToggleMute( f45_local0.memberListState, f45_local0.slot, f45_local0.team ) + end + LUI.Speech.PerformingSpeechAction() + end + else + DebugPrint( "Kinect: Warning, cannot mute or unmute local player \"" .. tostring( f45_local0.gamerTag ) .. "\"" ) + end +end + +Kinect.LobbyHandleSpeechMuteAll = function ( f46_arg0, f46_arg1, f46_arg2 ) + assert( f46_arg2 ~= nil, "Kinect.LobbyHandleSpeechMuteAll: Missing extradata param!" ) + assert( f46_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMuteAll: Missing extradata.mute param!" ) + if f46_arg2.mute == true then + if Lobby.MuteAllPlayers then + DebugPrint( "Kinect: Muting all players." ) + Lobby.MuteAllPlayers() + LUI.Speech.PerformingSpeechAction() + end + elseif Lobby.UnmuteAllPlayers then + DebugPrint( "Kinect: Unmuting all players." ) + Lobby.UnmuteAllPlayers() + LUI.Speech.PerformingSpeechAction() + end +end + +Kinect.LobbyHandleSpeechMuteFriends = function ( f47_arg0, f47_arg1, f47_arg2 ) + assert( f47_arg2 ~= nil, "Kinect.LobbyHandleSpeechMuteFriends: Missing extradata param!" ) + assert( f47_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMuteFriends: Missing extradata.mute param!" ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + else + DebugPrint( "Kinect: Error, MUTE/UNMUTE FRIENDS not implemented!" ) + end +end + +Kinect.LobbyHandleSpeechMuteNonFriends = function ( f48_arg0, f48_arg1, f48_arg2 ) + assert( f48_arg2 ~= nil, "Kinect.LobbyHandleSpeechMuteNonFriends: Missing extradata param!" ) + assert( f48_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMuteNonFriends: Missing extradata.mute param!" ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + elseif f48_arg2.mute == true then + if Lobby.MuteAllPlayersButFriends then + Lobby.MuteAllPlayersButFriends() + LUI.Speech.PerformingSpeechAction() + end + else + DebugPrint( "Kinect: Error, UNMUTE NON FRIENDS not implemented!" ) + end +end + +Kinect.LobbyHandleSpeechMuteParty = function ( f49_arg0, f49_arg1, f49_arg2 ) + assert( f49_arg2 ~= nil, "Kinect.LobbyHandleSpeechMuteParty: Missing extradata param!" ) + assert( f49_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMuteParty: Missing extradata.mute param!" ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + else + DebugPrint( "Kinect: Error, MUTE/UNMUTE PARTY not implemented!" ) + end +end + +Kinect.LobbyHandleSpeechMuteNonParty = function ( f50_arg0, f50_arg1, f50_arg2 ) + assert( f50_arg2 ~= nil, "Kinect.LobbyHandleSpeechMuteNonParty: Missing extradata param!" ) + assert( f50_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMuteNonParty: Missing extradata.mute param!" ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + elseif f50_arg2.mute == true then + if Lobby.MuteAllPlayersButParty then + Lobby.MuteAllPlayersButParty() + LUI.Speech.PerformingSpeechAction() + end + else + DebugPrint( "Kinect: Error, UNMUTE NON PARTY not implemented!" ) + end +end + +if Engine.HasSpeechFeature() then + Kinect.LobbySpeechGrammarHandlersArray = { + { + action = "compare", + confidence = LUI.Speech.compareConfidence, + handler = Kinect.LobbyHandleSpeechCompare, + extradata = nil + }, + { + action = "mute", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMute, + extradata = { + mute = true + } + }, + { + action = "unmute", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMute, + extradata = { + mute = false + } + }, + { + action = "mute all", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteAll, + extradata = { + mute = true + } + }, + { + action = "unmute all", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteAll, + extradata = { + mute = false + } + }, + { + action = "mute friends", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteFriends, + extradata = { + mute = true + } + }, + { + action = "unmute friends", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteFriends, + extradata = { + mute = false + } + }, + { + action = "mute non friends", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteNonFriends, + extradata = { + mute = true + } + }, + { + action = "unmute non friends", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteNonFriends, + extradata = { + mute = false + } + }, + { + action = "mute party", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteParty, + extradata = { + mute = true + } + }, + { + action = "unmute party", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteParty, + extradata = { + mute = false + } + }, + { + action = "mute non party", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteNonParty, + extradata = { + mute = true + } + }, + { + action = "unmute non party", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteNonParty, + extradata = { + mute = false + } + } + } +else + Kinect.LobbySpeechGrammarHandlersArray = {} +end diff --git a/lui/common_menus/options.dec.lua b/lui/common_menus/options.dec.lua new file mode 100644 index 0000000..3af729a --- /dev/null +++ b/lui/common_menus/options.dec.lua @@ -0,0 +1,1142 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetToggleTextForProfileData( f1_arg0, f1_arg1 ) + return Engine.GetProfileData( f1_arg0, f1_arg1 ) and Engine.Localize( "@LUA_MENU_ENABLED" ) or Engine.Localize( "@LUA_MENU_DISABLED" ) +end + +function GetReverseToggleTextForProfileData( f2_arg0, f2_arg1 ) + return Engine.GetProfileData( f2_arg0, f2_arg1 ) and Engine.Localize( "@LUA_MENU_DISABLED" ) or Engine.Localize( "@LUA_MENU_ENABLED" ) +end + +function ProfileMenuOption( f3_arg0, f3_arg1, f3_arg2, f3_arg3, f3_arg4 ) + Engine.SetDvarFloat( f3_arg4, math.min( f3_arg2, math.max( f3_arg1, Engine.GetDvarFloat( f3_arg4 ) + f3_arg3 ) ) ) + Engine.MenuDvarsFinish( f3_arg0 ) +end + +function GetSticksLayoutName( f4_arg0 ) + local f4_local0 = Engine.GetProfileData( "gpadSticksConfig", f4_arg0 ) + if f4_local0 == "thumbstick_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f4_local0 == "thumbstick_southpaw" then + return Engine.Localize( "@MENU_SOUTHPAW" ) + elseif f4_local0 == "thumbstick_legacy" then + return Engine.Localize( "@MENU_LEGACY" ) + elseif f4_local0 == "thumbstick_southpaw_ns" then + return Engine.Localize( "@MENU_SOUTHPAW_NS" ) + elseif f4_local0 == "thumbstick_legacysouthpaw_ns" then + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW_NS" ) + else + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW" ) + end +end + +function SticksLayoutAction( f5_arg0, f5_arg1 ) + LUI.FlowManager.RequestAddMenu( f5_arg0, "thumbstick", true, f5_arg1.controller, false ) +end + +function GetButtonsLayoutName( f6_arg0 ) + local f6_local0 = Engine.GetProfileData( "gpadButtonsConfig", f6_arg0 ) + if f6_local0 == "buttons_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f6_local0 == "buttons_tactical" then + return Engine.Localize( "@MENU_TACTICAL" ) + elseif f6_local0 == "buttons_lefty" then + return Engine.Localize( "@MENU_LEFTY" ) + elseif f6_local0 == "buttons_nomad" then + return Engine.Localize( "@MENU_NOMAD" ) + elseif f6_local0 == "buttons_nomad_tactical" then + return Engine.Localize( "@MENU_NOMAD_TACTICAL" ) + elseif f6_local0 == "buttons_default_alt" then + return Engine.Localize( "@MENU_DEFAULT_ALT" ) + elseif f6_local0 == "buttons_tactical_alt" then + return Engine.Localize( "@MENU_TACTICAL_ALT" ) + elseif f6_local0 == "buttons_lefty_alt" then + return Engine.Localize( "@MENU_LEFTY_ALT" ) + elseif f6_local0 == "buttons_nomad_alt" then + return Engine.Localize( "@MENU_NOMAD_ALT" ) + else + return Engine.Localize( "@MENU_NOMAD_TACTICAL_ALT" ) + end +end + +function ButtonsLayoutAction( f7_arg0, f7_arg1 ) + LUI.FlowManager.RequestAddMenu( f7_arg0, "buttons", true, f7_arg1.controller, false ) +end + +function LookInversionToggle( f8_arg0 ) + Engine.ToggleInvertedPitch( f8_arg0 ) +end + +function GetLookInversionText( f9_arg0 ) + return GetToggleTextForProfileData( "invertedPitch", f9_arg0 ) +end + +function VibrationToggle( f10_arg0 ) + Engine.ToggleRumble( f10_arg0 ) +end + +function GetVibrationText( f11_arg0 ) + return GetToggleTextForProfileData( "rumble", f11_arg0 ) +end + +function GetSensitivityText() + local f12_local0 = Engine.GetDvarFloat( "profileMenuOption_sensitivity" ) + if f12_local0 == 1 then + return Engine.Localize( "@MENU_LOW" ) .. " " .. f12_local0 + elseif f12_local0 == 3 then + return Engine.Localize( "@MENU_MEDIUM" ) .. " " .. f12_local0 + elseif f12_local0 == 7 then + return Engine.Localize( "@MENU_HIGH" ) .. " " .. f12_local0 + elseif f12_local0 == 13 then + return Engine.Localize( "@MENU_VERY_HIGH" ) .. " " .. f12_local0 + elseif f12_local0 == 20 then + return Engine.Localize( "@MENU_INSANE" ) .. " " .. f12_local0 + else + return f12_local0 .. "" + end +end + +function SensitivityLess( f13_arg0 ) + ProfileMenuOption( f13_arg0, 1, 20, -1, "profileMenuOption_sensitivity" ) +end + +function SensitivityMore( f14_arg0 ) + ProfileMenuOption( f14_arg0, 1, 20, 1, "profileMenuOption_sensitivity" ) +end + +function LeanToggle( f15_arg0 ) + Engine.ToggleLean( f15_arg0 ) +end + +function GetLeanToggleText( f16_arg0 ) + return GetToggleTextForProfileData( "leanEnabled", f16_arg0 ) +end + +function RenderColorBlindToggle( f17_arg0 ) + if Engine.ToggleRenderColorBlind then + Engine.ToggleRenderColorBlind( f17_arg0 ) + end +end + +function GetRenderColorBlindText( f18_arg0 ) + if Engine.ToggleRenderColorBlind then + return GetToggleTextForProfileData( "renderColorBlind", f18_arg0 ) + else + return Engine.Localize( "@LUA_MENU_DISABLED" ) + end +end + +function SubtitlesToggle( f19_arg0 ) + Engine.SetSubtitlesEnabled( f19_arg0, not Engine.SubtitlesEnabled( f19_arg0 ) ) +end + +function GetSubtitlesText( f20_arg0 ) + return GetToggleTextForProfileData( "subtitles", f20_arg0 ) +end + +function AimAssistToggle( f21_arg0 ) + Engine.ToggleAutoAim( f21_arg0 ) +end + +function GetAimAssistText( f22_arg0 ) + return GetToggleTextForProfileData( "autoAim", f22_arg0 ) +end + +function SelectSaveDeviceAction( f23_arg0, f23_arg1 ) + if Engine.IsProfileSignedIn( f23_arg1.controller ) then + Engine.ForceSelectSaveDevice( f23_arg1.controller ) + else + Engine.Exec( "xsignin" ) + end +end + +function RedrawMarginGuide( f24_arg0, f24_arg1 ) + local f24_local0 = Engine.GetDvarFloat( "profileMenuOption_safeAreaHorz" ) + local f24_local1 = Engine.GetDvarFloat( "profileMenuOption_safeAreaVert" ) + local f24_local2 = math.ceil( (1 - (f24_local0 - SliderBounds.HorzMargin.Min) / (SliderBounds.HorzMargin.Max - SliderBounds.HorzMargin.Min)) * 1280 * (1 - SliderBounds.HorzMargin.Min) / 2 ) + local f24_local3 = math.ceil( (1 - (f24_local1 - SliderBounds.VertMargin.Min) / (SliderBounds.VertMargin.Max - SliderBounds.VertMargin.Min)) * 720 * (1 - SliderBounds.VertMargin.Min) / 2 ) + f24_arg0:registerAnimationState( "current", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = f24_local2, + right = -f24_local2, + top = f24_local3, + bottom = -f24_local3 + } ) + f24_arg0:animateToState( "current", 0 ) +end + +function margins_guide() + local f25_local0 = { + type = "UIElement", + id = "horizontal_margins_guide_id", + states = { + default = { + alpha = 0 + }, + visible = { + alpha = 1 + } + } + } + local f25_local1 = {} + local f25_local2 = MBh.DoMultiple + local f25_local3 = {} + local f25_local4 = MBh.AnimateToState( "visible", 0 ) + local f25_local5 = RedrawMarginGuide + local f25_local6 = MBh.EmitEvent( { + name = "horizontal_margin_over_children" + } ) + f25_local1.horizontal_margin_over = f25_local2( f25_local4 ) + f25_local2 = MBh.DoMultiple + f25_local3 = {} + f25_local4 = MBh.AnimateToState( "visible", 0 ) + f25_local5 = RedrawMarginGuide + f25_local6 = MBh.EmitEvent( { + name = "vertical_margin_over_children" + } ) + f25_local1.vertical_margin_over = f25_local2( f25_local4 ) + f25_local2 = MBh.DoMultiple + f25_local3 = {} + f25_local4 = MBh.AnimateToState( "default", 100, true, false ) + f25_local5 = MBh.EmitEvent( { + name = "horizontal_margin_up_children" + } ) + f25_local1.horizontal_margin_up = f25_local2( f25_local4 ) + f25_local2 = MBh.DoMultiple + f25_local3 = {} + f25_local4 = MBh.AnimateToState( "default", 100, true, false ) + f25_local5 = MBh.EmitEvent( { + name = "vertical_margin_up_children" + } ) + f25_local1.vertical_margin_up = f25_local2( f25_local4 ) + f25_local1.margin_updated = RedrawMarginGuide + f25_local0.handlers = f25_local1 + f25_local0.children = { + { + type = "UIImage", + id = "margins_guide_dim", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + red = 0.21, + green = 0.21, + blue = 0.21, + alpha = 0.5 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_lt", + handlers = { + horizontal_margin_over_children = MBh.AnimateToState( "visible", 0 ), + horizontal_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -3, + right = 29, + top = -32, + bottom = 32, + material = RegisterMaterial( "widg_margin_arrow_lt" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_rt", + handlers = { + horizontal_margin_over_children = MBh.AnimateToState( "visible", 0 ), + horizontal_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = -24, + right = 8, + top = -32, + bottom = 32, + material = RegisterMaterial( "widg_margin_arrow_rt" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_top", + handlers = { + vertical_margin_over_children = MBh.AnimateToState( "visible", 0 ), + vertical_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -32, + right = 32, + top = -3, + bottom = 29, + material = RegisterMaterial( "widg_margin_arrow_top" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_bot", + handlers = { + vertical_margin_over_children = MBh.AnimateToState( "visible", 0 ), + vertical_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = -32, + right = 32, + top = -24, + bottom = 8, + material = RegisterMaterial( "widg_margin_arrow_bot" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "generic_border" + } + } + return f25_local0 +end + +function GetVolume() + return (Engine.GetDvarFloat( "profileMenuOption_volume" ) - SliderBounds.Volume.Min) / (SliderBounds.Volume.Max - SliderBounds.Volume.Min) +end + +function VolumeLess( f27_arg0 ) + ProfileMenuOption( f27_arg0, SliderBounds.Volume.Min, SliderBounds.Volume.Max, -SliderBounds.Volume.Step, "profileMenuOption_volume" ) +end + +function VolumeMore( f28_arg0 ) + ProfileMenuOption( f28_arg0, SliderBounds.Volume.Min, SliderBounds.Volume.Max, SliderBounds.Volume.Step, "profileMenuOption_volume" ) +end + +function GetBrightness() + return 1 - (Engine.GetDvarFloat( "profileMenuOption_blacklevel" ) - SliderBounds.Brightness.Min) / (SliderBounds.Brightness.Max - SliderBounds.Brightness.Min) +end + +function BrightnessLess( f30_arg0, f30_arg1 ) + ProfileMenuOption( f30_arg0, SliderBounds.Brightness.Min, SliderBounds.Brightness.Max, -SliderBounds.Brightness.Step, "profileMenuOption_blacklevel" ) + f30_arg1:dispatchEventToRoot( { + name = "brightness_updated" + } ) +end + +function BrightnessMore( f31_arg0, f31_arg1 ) + ProfileMenuOption( f31_arg0, SliderBounds.Brightness.Min, SliderBounds.Brightness.Max, SliderBounds.Brightness.Step, "profileMenuOption_blacklevel" ) + f31_arg1:dispatchEventToRoot( { + name = "brightness_updated" + } ) +end + +function UpdateBrightnessGuide( f32_arg0, f32_arg1 ) + if Engine.IsXbox360() then + return + end + local f32_local0 = Engine.GetDvarFloat( "profileMenuOption_blacklevel" ) + local f32_local1 = nil + if f32_arg0.id == BrightnessGuideConstants.not_visible.item_id then + f32_local1 = BrightnessGuideConstants.not_visible.color_default + elseif f32_arg0.id == BrightnessGuideConstants.barely_visible.item_id then + f32_local1 = BrightnessGuideConstants.barely_visible.color_default + elseif f32_arg0.id == BrightnessGuideConstants.easily_visible.item_id then + f32_local1 = BrightnessGuideConstants.easily_visible.color_default + end + if f32_local1 ~= nil then + local f32_local2 = (f32_local1 - f32_local0) / (1 - f32_local0) + f32_arg0:registerAnimationState( "current", { + red = f32_local2, + green = f32_local2, + blue = f32_local2 + } ) + f32_arg0:animateToState( "current", 0 ) + end +end + +function brightness_guide() + local f33_local0 = { + type = "UIElement", + id = "brightness_guide_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 150, + bottom = 510, + left = 710, + right = 1070, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + properties = { + band_height = 120 + } + } + local f33_local1 = {} + local f33_local2 = MBh.DoMultiple + local f33_local3 = {} + local f33_local4 = MBh.AnimateToState( "visible", 0 ) + local f33_local5 = MBh.EmitEvent( { + name = "brightness_over_children" + } ) + f33_local1.brightness_over = f33_local2( f33_local4 ) + f33_local1.brightness_up = MBh.AnimateToState( "default", 0 ) + f33_local0.handlers = f33_local1 + f33_local0.children = { + { + type = "generic_border", + properties = { + thickness = 2, + border_red = Colors.generic_menu_frame_color.r, + border_green = Colors.generic_menu_frame_color.g, + border_blue = Colors.generic_menu_frame_color.b + } + }, + { + type = "UIVerticalList", + id = "brightness_guide_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = BrightnessGuideConstants.not_visible.item_id, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = MBh.Property( "band_height" ), + material = RegisterMaterial( "white" ), + red = BrightnessGuideConstants.not_visible.color_default, + green = BrightnessGuideConstants.not_visible.color_default, + blue = BrightnessGuideConstants.not_visible.color_default + } + }, + children = { + { + type = "UIText", + id = "text_not_visible", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_NOT_VISIBLE" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + font = CoD.TextSettings.ExtraBigFont.Font, + red = 0, + green = 0, + blue = 0, + alignment = LUI.Alignment.Center + } + } + } + }, + handlers = { + brightness_over_children = UpdateBrightnessGuide, + brightness_updated = UpdateBrightnessGuide + } + }, + { + type = "UIImage", + id = BrightnessGuideConstants.barely_visible.item_id, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = MBh.Property( "band_height" ), + material = RegisterMaterial( "white" ), + red = BrightnessGuideConstants.barely_visible.color_default, + green = BrightnessGuideConstants.barely_visible.color_default, + blue = BrightnessGuideConstants.barely_visible.color_default + } + }, + children = { + { + type = "UIText", + id = "text_barely_visible", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_BARELY_VISIBLE" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + font = CoD.TextSettings.ExtraBigFont.Font, + red = 0, + green = 0, + blue = 0, + alignment = LUI.Alignment.Center + } + } + } + }, + handlers = { + brightness_over_children = UpdateBrightnessGuide, + brightness_updated = UpdateBrightnessGuide + } + }, + { + type = "UIImage", + id = BrightnessGuideConstants.easily_visible.item_id, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = MBh.Property( "band_height" ), + material = RegisterMaterial( "white" ), + red = BrightnessGuideConstants.easily_visible.color_default, + green = BrightnessGuideConstants.easily_visible.color_default, + blue = BrightnessGuideConstants.easily_visible.color_default + } + }, + children = { + { + type = "UIText", + id = "text_barely_visible", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_EASILY_VISIBLE" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + font = CoD.TextSettings.ExtraBigFont.Font, + red = 0, + green = 0, + blue = 0, + alignment = LUI.Alignment.Center + } + } + } + }, + handlers = { + brightness_over_children = UpdateBrightnessGuide, + brightness_updated = UpdateBrightnessGuide + } + }, + { + type = "UIElement", + id = "spacing_element_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 15 + } + } + }, + { + type = "UIText", + id = "background_guide_help", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_DESC2" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + } + } + } + } + return f33_local0 +end + +function facebook_notice() + return { + type = "generic_yesno_popup", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_FACEBOOK_LEGAL" ), + yes_action = MBh.PopupMenu( "facebook_warning", true, false ), + no_action = function ( f35_arg0, f35_arg1 ) + DebugPrint( "Running generic_confirmation_popup no action" ) + end + , + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function facebook_warning() + return { + type = "generic_yesno_popup", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@PLATFORM_FACEBOOK_LEGAL2" ), + yes_action = MBh.PopupMenu( "facebook_login_form", true, false ), + no_action = function ( f37_arg0, f37_arg1 ) + DebugPrint( "Running generic_confirmation_popup no action" ) + end + , + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function facebook_login_form() + return { + type = "generic_selectionList_popup", + properties = { + popup_title = Engine.Localize( "LUA_MENU_FACEBOOK_LOGIN_POPUP" ), + popup_childfeeder = FacebookLoginListFeeder + } + } +end + +function UpdateFacebookLoginButton( f39_arg0, f39_arg1 ) + local f39_local0 = Engine.GetDvarString( "facebook_username" ) + local f39_local1 = Engine.GetDvarString( "facebook_password" ) + if f39_local0 and f39_local1 and #f39_local1 * #f39_local0 ~= 0 then + f39_arg0:enable() + else + f39_arg0:disable() + end +end + +function FacebookLoginListFeeder() + return { + { + type = "generic_input_field", + id = "user_login", + properties = { + dvar_hook = "facebook_username", + help_value = Engine.Localize( "@MENU_ENTER_USERNAME_EMAIL_CAPS" ), + field_name = Engine.Localize( "@MENU_ENTER_USERNAME_EMAIL_CAPS" ), + field_edited_func = MBh.EmitEventToRoot( "facebook_login_changed" ) + } + }, + { + type = "generic_input_field", + id = "user_password", + properties = { + dvar_hook = "facebook_password", + help_value = Engine.Localize( "@MENU_ENTER_PASSWORD_CAPS" ), + field_name = Engine.Localize( "@MENU_ENTER_PASSWORD_CAPS" ), + password_field = true, + field_edited_func = MBh.EmitEventToRoot( "facebook_password_changed" ) + } + }, + { + type = "UIGenericButton", + id = "facebook_login_button", + properties = { + text = Engine.Localize( "@MENU_FACEBOOK_LOGIN" ), + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_action_func = MBh.PopupMenu( "facebook_error_popup", true, false ) + }, + handlers = { + menu_create = UpdateFacebookLoginButton, + facebook_login_changed = UpdateFacebookLoginButton, + facebook_password_changed = UpdateFacebookLoginButton + } + }, + { + type = "UIGenericButton", + id = "facebook_cancel_login_button", + properties = { + text = Engine.Localize( "@LUA_MENU_CANCEL" ), + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_action_func = MBh.LeaveMenu() + } + } + } +end + +function facebook_error_popup() + return { + type = "generic_confirmation_popup", + id = "facebook_error_popup_id", + properties = { + popup_title = Engine.Localize( "Placeholder" ), + message_text = Engine.Localize( "@MENU_FACEBOOK_UNAVAILABLE" ) + } + } +end + +function options_vlist() + return { + type = "UIScrollingVerticalList", + properties = { + use_arrows = true, + sendScrollEvents = true, + exclusiveController = MBh.Property( "exclusiveController" ), + focusSafeArea = MBh.Property( "focusSafeArea" ) + }, + focusable = true, + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = OptionsListDims.menu_top, + bottom = OptionsListDims.menu_bottom, + left = OptionsListDims.menu_left, + right = OptionsListDims.menu_right + } + } + } +end + +function OptionsFeeder( f43_arg0 ) + local f43_local0 = nil + Engine.MenuDvarsSetup( f43_arg0.exclusiveController ) + f43_local0 = { + { + type = "UIGenericButton", + id = "stick_layout_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_THUMBSTICK_LAYOUT_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_STICK_LAYOUT_DESC" ), + button_display_func = function ( f44_arg0, f44_arg1 ) + return GetSticksLayoutName( f43_arg0.exclusiveController ) + end, + button_action_func = SticksLayoutAction + } + }, + { + type = "UIGenericButton", + id = "buttons_layout_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_BUTTON_LAYOUT_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_BUTTON_LAYOUT_DESC" ), + button_display_func = function ( f45_arg0, f45_arg1 ) + return GetButtonsLayoutName( f43_arg0.exclusiveController ) + end, + button_action_func = ButtonsLayoutAction + } + }, + { + type = "UIGenericButton", + id = "look_inversion_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_LOOK_INVERSION_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_LOOK_INVERSION_DESC" ), + button_display_func = function ( f46_arg0, f46_arg1 ) + return GetLookInversionText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f47_arg0, f47_arg1 ) + LookInversionToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f48_arg0, f48_arg1 ) + LookInversionToggle( f43_arg0.exclusiveController ) + end + } + }, + { + type = "UIGenericButton", + id = "vibration_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_CONTROLLER_VIBRATION_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_VIBRATION_DESC" ), + button_display_func = function ( f49_arg0, f49_arg1 ) + return GetVibrationText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f50_arg0, f50_arg1 ) + return VibrationToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f51_arg0, f51_arg1 ) + return VibrationToggle( f43_arg0.exclusiveController ) + end + } + }, + { + type = "UIGenericButton", + id = "sensitivity_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_LOOK_SENSITIVITY_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_SENSITIVITY_DESC" ), + button_display_func = GetSensitivityText, + button_left_func = function ( f52_arg0, f52_arg1 ) + return SensitivityLess( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f53_arg0, f53_arg1 ) + return SensitivityMore( f43_arg0.exclusiveController ) + end + } + }, + { + type = "UIGenericButton", + id = "safe_area_button_id", + listDefaultFocus = f43_arg0.focusSafeArea, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@LUA_MENU_SAFE_AREA_CAPS" ), + button_display_func = function () + return "" + end, + desc_text = Engine.Localize( "@LUA_MENU_SAFE_AREA_DESC" ), + button_action_func = function ( f55_arg0, f55_arg1 ) + LUI.FlowManager.RequestAddMenu( f55_arg0, "boot_screen_margins", false, f55_arg1.controller, true, { + linkTo = "controls", + continueExclusive = true + } ) + end + } + }, + { + type = "UIGenericButton", + id = "volume_button_id", + properties = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( "@MENU_VOLUME_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_GAME_VOLUME_DESC" ), + button_display_func = GetVolume, + button_left_func = function ( f56_arg0, f56_arg1 ) + VolumeLess( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f57_arg0, f57_arg1 ) + VolumeMore( f43_arg0.exclusiveController ) + end + } + }, + { + type = "UIGenericButton", + id = "brightness_button_id", + properties = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( "@MENU_BRIGHTNESS_CAPS" ), + desc_text = Engine.Localize( "@MENU_BRIGHTNESS_DESC1" ), + button_display_func = GetBrightness, + button_left_func = function ( f58_arg0, f58_arg1 ) + BrightnessLess( f43_arg0.exclusiveController, f58_arg0 ) + end, + button_right_func = function ( f59_arg0, f59_arg1 ) + BrightnessMore( f43_arg0.exclusiveController, f59_arg0 ) + end, + button_over_func = MBh.EmitEventToRoot( "brightness_over" ), + button_up_func = MBh.EmitEventToRoot( "brightness_up" ) + } + }, + { + type = "UIGenericButton", + id = "render_color_blind_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "LUA_MENU_COLORBLIND_FILTER_CAPS" ), + desc_text = Engine.Localize( "LUA_MENU_COLOR_BLIND_DESC" ), + button_display_func = function ( f60_arg0, f60_arg1 ) + return GetRenderColorBlindText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f61_arg0, f61_arg1 ) + RenderColorBlindToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f62_arg0, f62_arg1 ) + RenderColorBlindToggle( f43_arg0.exclusiveController ) + end + } + }, + { + type = "UIGenericButton", + id = "manual_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.IsXB3() and Engine.Localize( "@LUA_MENU_HELP_CAPS" ) or Engine.Localize( "@LUA_MENU_GAME_MANUAL_CAPS" ), + button_display_func = function () + return "" + end, + desc_text = Engine.Localize( "@LUA_MENU_GAME_MANUAL_DESC" ), + button_action_func = function ( f64_arg0, f64_arg1 ) + LUI.FlowManager.RequestAddMenu( f64_arg0, "game_manual", true, f64_arg1.controller, false ) + end + } + }, + { + type = "UIGenericButton", + id = "toggle_lean_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_LEAN_TOGGLE_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_LEAN_TOGGLE_DESC" ), + button_display_func = function ( f65_arg0, f65_arg1 ) + return GetLeanToggleText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f66_arg0, f66_arg1 ) + LeanToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f67_arg0, f67_arg1 ) + LeanToggle( f43_arg0.exclusiveController ) + end + } + } + } + if not Engine.IsMultiplayer() then + f43_local0[#f43_local0 + 1] = { + type = "UIGenericButton", + id = "aim_assist_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_AIM_ASSIST_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_AIM_ASSIST_DESC" ), + button_display_func = function ( f68_arg0, f68_arg1 ) + return GetAimAssistText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f69_arg0, f69_arg1 ) + AimAssistToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f70_arg0, f70_arg1 ) + AimAssistToggle( f43_arg0.exclusiveController ) + end + } + } + if Engine.GetCurrentLanguage() ~= 6 then + f43_local0[#f43_local0 + 1] = { + type = "UIGenericButton", + id = "subtitles_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_SUBTITLES_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_SUBTITLES_DESC" ), + button_display_func = function ( f71_arg0, f71_arg1 ) + return GetSubtitlesText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f72_arg0, f72_arg1 ) + SubtitlesToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f73_arg0, f73_arg1 ) + SubtitlesToggle( f43_arg0.exclusiveController ) + end + } + } + end + end + if not Engine.IsXB3() and not Engine.IsPS3() and not Engine.IsPS4() then + f43_local0[#f43_local0 + 1] = { + type = "UIGenericButton", + id = "save_device_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_SP_SELECT_SAVE_DEVICE_CAPS" ), + button_display_func = function () + return "" + end, + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_SAVE_DEVICE_DESC" ), + button_action_func = SelectSaveDeviceAction + } + } + end + return f43_local0 +end + +function OptionsMainCreate( f75_arg0, f75_arg1 ) + f75_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) +end + +function OptionsMainClose( f76_arg0, f76_arg1 ) + Engine.Exec( "updategamerprofile" ) +end + +function options() + local f77_local0 = { + type = "UIElement", + id = "options_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = { + focusSafeArea = false + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_OPTIONS_UPPER_CASE" ) + } + }, + { + type = "options_vlist", + id = "options_vlist_id" + }, + { + type = "button_desc_text", + id = "button_info_text", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 590, + bottom = 590 + CoD.TextSettings.SmallFont.Height, + left = 0, + right = OptionsListDims.menu_right - 80 + } + } + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "options_back_id", + handlers = { + button_secondary = function ( f78_arg0, f78_arg1 ) + local f78_local0 = Engine.GetLuiRoot() + if LUI.FlowManager.IsInStack( f78_local0.flowManager, "mp_main_menu" ) then + Engine.ExecNow( "forcesplitscreencontrol main_options_menu_CLOSE", f78_arg0.properties.exclusiveController ) + end + LUI.FlowManager.RequestLeaveMenu( f78_arg0 ) + end + } + } + } + } + table.insert( f77_local0.children, { + type = "brightness_guide" + } ) + return f77_local0 +end + +LUI.MenuBuilder.registerDef( "margins_guide", margins_guide ) +LUI.MenuBuilder.registerDef( "brightness_guide", brightness_guide ) +LUI.MenuBuilder.registerDef( "facebook_notice", facebook_notice ) +LUI.MenuBuilder.registerDef( "facebook_warning", facebook_warning ) +LUI.MenuBuilder.registerDef( "facebook_login_form", facebook_login_form ) +LUI.MenuBuilder.registerDef( "facebook_error_popup", facebook_error_popup ) +LUI.MenuBuilder.registerDef( "options_vlist", options_vlist ) +LUI.MenuBuilder.registerDef( "controls", options ) +LockTable( _M ) diff --git a/lui/common_menus/optionslayout.dec.lua b/lui/common_menus/optionslayout.dec.lua new file mode 100644 index 0000000..80be3dc --- /dev/null +++ b/lui/common_menus/optionslayout.dec.lua @@ -0,0 +1,3699 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +debugPlaystation = false +function GetSticksConfig() + return Engine.GetProfileData( "gpadSticksConfig" ) +end + +function SetSticksConfig( f2_arg0, f2_arg1 ) + Engine.ExecNow( "profile_setSticksConfig " .. f2_arg0.properties.layout_name, f2_arg1.controller ) +end + +function GetButtonsConfig() + return Engine.GetProfileData( "gpadButtonsConfig" ) +end + +function SetButtonsConfig( f4_arg0, f4_arg1 ) + Engine.ExecNow( "profile_setButtonsConfig " .. f4_arg0.properties.layout_name, f4_arg1.controller ) +end + +function layoutMenuClose( f5_arg0, f5_arg1 ) + if not Engine.InFrontend() and Engine.IsMultiplayer() and not f5_arg1.value then + LUI.FlowManager.RequestCloseAllMenus( f5_arg0 ) + end +end + +function layout_buttons_vlist( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = { + type = "UIStencil", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_narrow, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + children = {} + } + local f6_local1 = { + type = "UIVerticalList", + id = "layouts_vlist_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true + } + }, + children = {} + } + for f6_local5, f6_local6 in ipairs( f6_arg2 ) do + local f6_local7 = f6_local1.children + local f6_local8 = #f6_local1.children + 1 + local f6_local9 = { + type = "UIGenericButton", + id = f6_local6.name .. "_layout_button_id", + listDefaultFocus = f6_local6.name == f6_arg0() + } + local f6_local10 = { + layout_name = f6_local6.name, + button_text = Engine.Localize( f6_local6.display_name ) + } + local f6_local11 = MBh.DoMultiple + local f6_local12 = {} + local f6_local13 = f6_arg1 + local f6_local14 = MBh.LeaveMenu() + f6_local10.button_action_func = f6_local11( f6_local13 ) + f6_local11 = MBh.DoMultiple + f6_local12 = {} + f6_local13 = MBh.EmitEventToRoot( "hide_texts" ) + f6_local14 = MBh.EmitEventToRoot( "show_" .. f6_local6.name ) + f6_local10.button_over_func = f6_local11( f6_local13 ) + f6_local9.properties = f6_local10 + f6_local7[f6_local8] = f6_local9 + end + f6_local0.children[#f6_local0.children + 1] = f6_local1 + return f6_local0 +end + +stickBoxW = 190 +stickBoxH = 140 +function stick_box_line( f7_arg0, f7_arg1 ) + return { + type = "UIElement", + id = "stick_text_box_line" .. f7_arg1, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 32 + } + }, + children = { + { + type = "UIImage", + id = "arrow", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 32, + left = 0, + right = 32, + material = RegisterMaterial( f7_arg0 ) + } + } + }, + { + type = "UIText", + id = "text", + properties = { + text = Engine.Localize( f7_arg1 ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 37, + right = 0, + top = 4, + bottom = 4 + CoD.TextSettings.NormalFont.Height + } + } + } + } + } +end + +function stick_box_content( f8_arg0, f8_arg1 ) + local f8_local0 = { + type = "UIVerticalList", + id = "vlist_" .. f8_arg0, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 5, + right = 5, + top = 5, + bottom = 5, + alpha = 0, + spacing = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + hide_texts = MBh.AnimateToState( "default", 0 ) + }, + children = {}, + handlers = MBh.AnimateToState( "visible", 0 ) + } + local f8_local1 = { + "cont_arrow_up", + "cont_arrow_down", + "cont_arrow_rt", + "cont_arrow_lt" + } + for f8_local5, f8_local6 in ipairs( f8_arg1 ) do + f8_local0.children[#f8_local0.children + 1] = stick_box_line( f8_local1[f8_local5], f8_local6 ) + end + return f8_local0 +end + +function stick_box( f9_arg0, f9_arg1 ) + local f9_local0 = { + type = "UIElement", + id = f9_arg0, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UIImage", + id = "sticks_texts_bg", + states = { + default = { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0.5 + } + } + } + } + } + for f9_local4, f9_local5 in ipairs( f9_arg1 ) do + f9_local0.children[#f9_local0.children + 1] = stick_box_content( f9_local5.name, f9_local5.controls ) + end + return f9_local0 +end + +function left_stick_box( f10_arg0 ) + local f10_local0 = stick_box( "left_stick_box", f10_arg0 ) + f10_local0.states.default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false + } + if Engine.IsVita() then + f10_local0.states.default.top = 40 + f10_local0.states.default.left = -190 + elseif debugPlaystation then + f10_local0.states.default.top = 30 + f10_local0.states.default.left = -175 + elseif Engine.IsPS4() then + f10_local0.states.default.top = 30 + f10_local0.states.default.left = -175 + elseif Engine.IsPS3() then + f10_local0.states.default.top = 30 + f10_local0.states.default.left = -175 + elseif Engine.IsWiiU() then + f10_local0.states.default.top = -150 + f10_local0.states.default.left = -15 + elseif Engine.IsXB3() then + f10_local0.states.default.top = 15 + f10_local0.states.default.left = -195 + else + f10_local0.states.default.top = -15 + f10_local0.states.default.left = -195 + end + f10_local0.states.default.bottom = f10_local0.states.default.top + stickBoxH + f10_local0.states.default.right = f10_local0.states.default.left + stickBoxW + return f10_local0 +end + +function right_stick_box( f11_arg0 ) + local f11_local0 = stick_box( "right_stick_box", f11_arg0 ) + f11_local0.states.default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true + } + if Engine.IsVita() then + f11_local0.states.default.top = -96 + f11_local0.states.default.left = 0 + elseif debugPlaystation then + f11_local0.states.default.top = -150 + f11_local0.states.default.left = -15 + elseif Engine.IsPS4() then + f11_local0.states.default.top = -150 + f11_local0.states.default.left = -15 + elseif Engine.IsPS3() then + f11_local0.states.default.top = -150 + f11_local0.states.default.left = -15 + elseif Engine.IsWiiU() then + f11_local0.states.default.top = -150 + f11_local0.states.default.left = -15 + elseif Engine.IsXB3() then + f11_local0.states.default.top = -95 + f11_local0.states.default.left = 5 + else + f11_local0.states.default.top = -70 + f11_local0.states.default.left = 5 + end + f11_local0.states.default.bottom = f11_local0.states.default.top + stickBoxH + f11_local0.states.default.right = f11_local0.states.default.left + stickBoxW + return f11_local0 +end + +function sticks_texts_overlay() + local f12_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "thumbstick" ) + local f12_local1 = { + type = "UIElement", + id = "sticks_texts_overlay", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = {} + } + local f12_local2 = "@MENU_LOOK_UP" + local f12_local3 = "@MENU_LOOK_DOWN" + if not f12_local0.exclusiveControllerIndex then + DebugPrint( "WARNING: OptionsLayout opened without exclusiveControllerIndex, this should only happen on LUI Reload" ) + f12_local0.exclusiveControllerIndex = 0 + end + if Engine.IsPitchInverted and Engine.IsPitchInverted( f12_local0.exclusiveControllerIndex ) then + local f12_local4 = f12_local2 + f12_local2 = f12_local3 + f12_local3 = f12_local4 + end + f12_local1.children[#f12_local1.children + 1] = left_stick_box( { + { + name = "thumbstick_default", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + }, + { + name = "thumbstick_southpaw", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + }, + { + name = "thumbstick_legacy", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + }, + { + name = "thumbstick_legacysouthpaw", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + }, + { + name = "thumbstick_southpaw_ns", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + }, + { + name = "thumbstick_legacysouthpaw_ns", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + } + } ) + f12_local1.children[#f12_local1.children + 1] = right_stick_box( { + { + name = "thumbstick_default", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + }, + { + name = "thumbstick_southpaw", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + }, + { + name = "thumbstick_legacy", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + }, + { + name = "thumbstick_legacysouthpaw", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + }, + { + name = "thumbstick_southpaw_ns", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + }, + { + name = "thumbstick_legacysouthpaw_ns", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + } + } ) + return f12_local1 +end + +function sticks_overlay() + local f13_local0 = nil + if Engine.IsVita() then + f13_local0 = RegisterMaterial( "cont_lines_stick_vita" ) + else + f13_local0 = RegisterMaterial( "cont_lines_stick" ) + end + local f13_local1 = { + type = "UIImage", + id = "controller_lines", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + material = f13_local0 + } + } + } + local f13_local2 = {} + f13_local1.children = sticks_texts_overlay() + if Engine.IsVita() then + f13_local1.states.default.top = 240 + f13_local1.states.default.left = 24 + elseif debugPlaystation then + f13_local1.states.default.top = 280 + f13_local1.states.default.left = 25 + elseif Engine.IsPS4() then + f13_local1.states.default.top = 280 + f13_local1.states.default.left = 25 + elseif Engine.IsPS3() then + f13_local1.states.default.top = 280 + f13_local1.states.default.left = 25 + elseif Engine.IsWiiU() then + f13_local1.states.default.top = 280 + f13_local1.states.default.left = 25 + elseif Engine.IsXB3() then + f13_local1.states.default.top = 255 + f13_local1.states.default.left = 0 + else + f13_local1.states.default.top = 220 + f13_local1.states.default.left = 5 + end + if Engine.IsVita() then + f13_local1.states.default.bottom = f13_local1.states.default.top + 140 + f13_local1.states.default.right = f13_local1.states.default.left + 558 + else + f13_local1.states.default.bottom = f13_local1.states.default.top + 188 + f13_local1.states.default.right = f13_local1.states.default.left + 512 + end + return f13_local1 +end + +function button_text_overlay( f14_arg0, f14_arg1, f14_arg2 ) + if Engine.IsVita() then + f14_arg2 = f14_arg2.vita + elseif debugPlaystation then + f14_arg2 = f14_arg2.ps3 + elseif Engine.IsPS3() then + f14_arg2 = f14_arg2.ps3 + elseif Engine.IsPS4() then + f14_arg2 = f14_arg2.ps4 + elseif Engine.IsXB3() then + f14_arg2 = f14_arg2.xb3 + elseif Engine.IsWiiU() then + f14_arg2 = f14_arg2.wiiu + else + f14_arg2 = f14_arg2.xbox + end + local f14_local0 = { + type = "UIText", + id = f14_arg0, + properties = { + text = "" + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = f14_arg2.alignment, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f14_arg2.left, + right = f14_arg2.right, + top = f14_arg2.top, + bottom = f14_arg2.bottom, + red = 1, + green = 1, + blue = 1 + } + }, + handlers = {} + } + for f14_local4, f14_local5 in ipairs( f14_arg1 ) do + f14_local0.handlers["show_" .. f14_local5.name] = function ( f15_arg0, f15_arg1 ) + f15_arg0:setText( Engine.Localize( f14_local5.text ) ) + end + + end + return f14_local0 +end + +function buttons_texts_overlay() + local f16_local0 = not Engine.IsMultiplayer() + local f16_local1 = Engine.IsAliensMode() + local f16_local2 + if f16_local0 then + f16_local2 = "@MENU_THROW_FRAG_GRENADE" + if not f16_local2 then + + else + local f16_local3 + if f16_local0 then + f16_local3 = "@LUA_MENU_NOT_USED" + if not f16_local3 then + if f16_local1 then + f16_local3 = "@ALIENS_UPGRADE_ABILITIES" + if not f16_local3 then + + else + local f16_local4 + if f16_local1 then + f16_local4 = "@LUA_MENU_SCOREBOARD_MENU" + if not f16_local4 then + + else + local f16_local5 = { + type = "UIElement", + id = "buttons_texts_overlay", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = {} + } + local f16_local6 = { + { + name = "buttons_default", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_tactical", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_lefty", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SPRINT_CHANGE_ZOOM" + } + } + local f16_local7 = { + { + name = "buttons_default", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_lefty", + text = f16_local2 + }, + { + name = "buttons_nomad", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + } + } + local f16_local8 = { + { + name = "buttons_default", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_tactical", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_lefty", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad", + text = f16_local2 + }, + { + name = "buttons_nomad_tactical", + text = f16_local2 + } + } + local f16_local9 = { + { + name = "buttons_default", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_tactical", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_lefty", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_CROUCH_PRONE" + } + } + local f16_local10 = { + { + name = "buttons_default", + text = f16_local2 + }, + { + name = "buttons_tactical", + text = f16_local2 + }, + { + name = "buttons_lefty", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + } + } + local f16_local11 = { + { + name = "buttons_default", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_FIRE_WEAPON" + } + } + local f16_local12 = { + { + name = "buttons_default", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SWITCH_WEAPON" + } + } + local f16_local13 = { + { + name = "buttons_default", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_tactical", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_lefty", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_MELEE_HOLD_BREATH" + } + } + local f16_local14 = { + { + name = "buttons_default", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_tactical", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_lefty", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_USE_RELOAD" + } + } + local f16_local15 = { + { + name = "buttons_default", + text = "@MENU_JUMP" + }, + { + name = "buttons_tactical", + text = "@MENU_JUMP" + }, + { + name = "buttons_lefty", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_JUMP" + } + } + local f16_local16 = { + { + name = "buttons_default", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_tactical", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_lefty", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_INVENTORY" + } + } + local f16_local17 = { + { + name = "buttons_default", + text = f16_local3 + }, + { + name = "buttons_tactical", + text = f16_local3 + }, + { + name = "buttons_lefty", + text = f16_local3 + }, + { + name = "buttons_nomad", + text = f16_local3 + }, + { + name = "buttons_nomad_tactical", + text = f16_local3 + } + } + local f16_local18 = { + { + name = "buttons_default", + text = f16_local4 + }, + { + name = "buttons_tactical", + text = f16_local4 + }, + { + name = "buttons_lefty", + text = f16_local4 + }, + { + name = "buttons_nomad", + text = f16_local4 + }, + { + name = "buttons_nomad_tactical", + text = f16_local4 + } + } + for f16_local30, f16_local29 in ipairs( { + f16_local6, + f16_local7, + f16_local8, + f16_local9, + f16_local10, + f16_local11, + f16_local12, + f16_local13, + f16_local14, + f16_local15, + f16_local16, + f16_local17, + f16_local18 + } ) do + local f16_local22 = f16_local29 + if f16_local29 == f16_local8 then + f16_local22 = f16_local7 + elseif f16_local29 == f16_local11 then + f16_local22 = f16_local10 + elseif f16_local29 == f16_local7 then + f16_local22 = f16_local8 + elseif f16_local29 == f16_local10 then + f16_local22 = f16_local11 + end + local f16_local23 = {} + for f16_local27, f16_local28 in ipairs( f16_local22 ) do + table.insert( f16_local23, { + name = f16_local28.name .. "_alt", + text = f16_local28.text + } ) + end + f16_local29 = LUI.ConcatenateToTable( f16_local29, f16_local23 ) + end + if Engine.IsPS3() or debugPlaystation then + f16_local19 = f16_local11 + f16_local11 = f16_local10 + f16_local10 = f16_local19 + f16_local20 = f16_local8 + f16_local8 = f16_local7 + f16_local7 = f16_local20 + end + if IsCurrentSticksLayoutSouthpaw() or IsCurrentSticksLayoutLegacySouthpaw() then + f16_local19 = f16_local9 + f16_local9 = f16_local6 + f16_local6 = f16_local19 + end + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LS", f16_local6, { + xbox = { + left = -200, + right = -5, + top = 294, + bottom = 294 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -200, + right = -5, + top = 300, + bottom = 300 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 230, + right = 400, + top = 438, + bottom = 438 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LB", f16_local7, { + xbox = { + left = -23, + right = 87, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -10, + right = 100, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 360, + right = 470, + top = 282 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 282 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LT", f16_local8, { + xbox = { + left = -155, + right = 145, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -167, + right = 133, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + vita = { + left = -250, + right = 50, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RS", f16_local9, { + xbox = { + left = 223, + right = 523, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 223, + right = 523, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = -164, + right = 672, + top = 250, + bottom = 250 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RT", f16_local11, { + xbox = { + left = 437, + right = 737, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 456, + right = 756, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + vita = { + left = 520, + right = 820, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RB", f16_local10, { + xbox = { + left = 495, + right = 605, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 489, + right = 599, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = 360, + right = 470, + top = 230 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 230 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "Y", f16_local12, { + xbox = { + left = 578, + right = 733, + top = 260 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 260 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 270 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 270 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 114 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 114 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "B", f16_local13, { + xbox = { + left = 578, + right = 733, + top = 300 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 300 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 310 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 310 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 727, + top = 200 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 200 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "X", f16_local14, { + xbox = { + left = 578, + right = 733, + top = 344 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 344 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 354 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 354 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 254 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 254 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "A", f16_local15, { + xbox = { + left = 578, + right = 733, + top = 380 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 380 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 390 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 390 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 306 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 306 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "DPAD", f16_local16, { + xbox = { + left = 56, + right = 356, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 56, + right = 356, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = -278, + right = 22, + top = 340, + bottom = 340 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = -300, + right = 0, + top = 200, + bottom = 200 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "back", f16_local17, { + xbox = { + left = 84, + right = 384, + top = 75 - CoD.TextSettings.NormalFont.Height, + bottom = 75, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 92, + right = 392, + top = 80 - CoD.TextSettings.NormalFont.Height, + bottom = 80, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + vita = { + left = -164, + right = 672, + top = 154, + bottom = 154 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "start", f16_local18, { + xbox = { + left = 194, + right = 494, + top = 107 - CoD.TextSettings.NormalFont.Height, + bottom = 107, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 195, + right = 495, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + vita = { + left = 520, + right = 670, + top = 452 - CoD.TextSettings.NormalFont.Height, + bottom = 452, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + } + } ) + return f16_local5 + end + end + f16_local4 = "@MENU_OBJECTIVES_MENU" + end + end + f16_local3 = "@MENU_SCOREBOARD" + end + else + if f16_local1 then + f16_local3 = "@ALIENS_UPGRADE_ABILITIES" + if not f16_local3 then + + else + local f16_local4 + if f16_local1 then + f16_local4 = "@LUA_MENU_SCOREBOARD_MENU" + if not f16_local4 then + + else + local f16_local5 = { + type = "UIElement", + id = "buttons_texts_overlay", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = {} + } + local f16_local6 = { + { + name = "buttons_default", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_tactical", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_lefty", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SPRINT_CHANGE_ZOOM" + } + } + local f16_local7 = { + { + name = "buttons_default", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_lefty", + text = f16_local2 + }, + { + name = "buttons_nomad", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + } + } + local f16_local8 = { + { + name = "buttons_default", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_tactical", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_lefty", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad", + text = f16_local2 + }, + { + name = "buttons_nomad_tactical", + text = f16_local2 + } + } + local f16_local9 = { + { + name = "buttons_default", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_tactical", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_lefty", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_CROUCH_PRONE" + } + } + local f16_local10 = { + { + name = "buttons_default", + text = f16_local2 + }, + { + name = "buttons_tactical", + text = f16_local2 + }, + { + name = "buttons_lefty", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + } + } + local f16_local11 = { + { + name = "buttons_default", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_FIRE_WEAPON" + } + } + local f16_local12 = { + { + name = "buttons_default", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SWITCH_WEAPON" + } + } + local f16_local13 = { + { + name = "buttons_default", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_tactical", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_lefty", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_MELEE_HOLD_BREATH" + } + } + local f16_local14 = { + { + name = "buttons_default", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_tactical", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_lefty", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_USE_RELOAD" + } + } + local f16_local15 = { + { + name = "buttons_default", + text = "@MENU_JUMP" + }, + { + name = "buttons_tactical", + text = "@MENU_JUMP" + }, + { + name = "buttons_lefty", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_JUMP" + } + } + local f16_local16 = { + { + name = "buttons_default", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_tactical", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_lefty", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_INVENTORY" + } + } + local f16_local17 = { + { + name = "buttons_default", + text = f16_local3 + }, + { + name = "buttons_tactical", + text = f16_local3 + }, + { + name = "buttons_lefty", + text = f16_local3 + }, + { + name = "buttons_nomad", + text = f16_local3 + }, + { + name = "buttons_nomad_tactical", + text = f16_local3 + } + } + local f16_local18 = { + { + name = "buttons_default", + text = f16_local4 + }, + { + name = "buttons_tactical", + text = f16_local4 + }, + { + name = "buttons_lefty", + text = f16_local4 + }, + { + name = "buttons_nomad", + text = f16_local4 + }, + { + name = "buttons_nomad_tactical", + text = f16_local4 + } + } + for f16_local30, f16_local29 in ipairs( { + f16_local6, + f16_local7, + f16_local8, + f16_local9, + f16_local10, + f16_local11, + f16_local12, + f16_local13, + f16_local14, + f16_local15, + f16_local16, + f16_local17, + f16_local18 + } ) do + local f16_local22 = f16_local29 + if f16_local29 == f16_local8 then + f16_local22 = f16_local7 + elseif f16_local29 == f16_local11 then + f16_local22 = f16_local10 + elseif f16_local29 == f16_local7 then + f16_local22 = f16_local8 + elseif f16_local29 == f16_local10 then + f16_local22 = f16_local11 + end + local f16_local23 = {} + for f16_local27, f16_local28 in ipairs( f16_local22 ) do + table.insert( f16_local23, { + name = f16_local28.name .. "_alt", + text = f16_local28.text + } ) + end + f16_local29 = LUI.ConcatenateToTable( f16_local29, f16_local23 ) + end + if Engine.IsPS3() or debugPlaystation then + f16_local19 = f16_local11 + f16_local11 = f16_local10 + f16_local10 = f16_local19 + f16_local20 = f16_local8 + f16_local8 = f16_local7 + f16_local7 = f16_local20 + end + if IsCurrentSticksLayoutSouthpaw() or IsCurrentSticksLayoutLegacySouthpaw() then + f16_local19 = f16_local9 + f16_local9 = f16_local6 + f16_local6 = f16_local19 + end + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LS", f16_local6, { + xbox = { + left = -200, + right = -5, + top = 294, + bottom = 294 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -200, + right = -5, + top = 300, + bottom = 300 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 230, + right = 400, + top = 438, + bottom = 438 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LB", f16_local7, { + xbox = { + left = -23, + right = 87, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -10, + right = 100, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 360, + right = 470, + top = 282 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 282 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LT", f16_local8, { + xbox = { + left = -155, + right = 145, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -167, + right = 133, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + vita = { + left = -250, + right = 50, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RS", f16_local9, { + xbox = { + left = 223, + right = 523, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 223, + right = 523, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = -164, + right = 672, + top = 250, + bottom = 250 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RT", f16_local11, { + xbox = { + left = 437, + right = 737, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 456, + right = 756, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + vita = { + left = 520, + right = 820, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RB", f16_local10, { + xbox = { + left = 495, + right = 605, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 489, + right = 599, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = 360, + right = 470, + top = 230 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 230 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "Y", f16_local12, { + xbox = { + left = 578, + right = 733, + top = 260 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 260 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 270 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 270 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 114 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 114 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "B", f16_local13, { + xbox = { + left = 578, + right = 733, + top = 300 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 300 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 310 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 310 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 727, + top = 200 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 200 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "X", f16_local14, { + xbox = { + left = 578, + right = 733, + top = 344 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 344 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 354 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 354 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 254 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 254 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "A", f16_local15, { + xbox = { + left = 578, + right = 733, + top = 380 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 380 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 390 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 390 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 306 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 306 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "DPAD", f16_local16, { + xbox = { + left = 56, + right = 356, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 56, + right = 356, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = -278, + right = 22, + top = 340, + bottom = 340 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = -300, + right = 0, + top = 200, + bottom = 200 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "back", f16_local17, { + xbox = { + left = 84, + right = 384, + top = 75 - CoD.TextSettings.NormalFont.Height, + bottom = 75, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 92, + right = 392, + top = 80 - CoD.TextSettings.NormalFont.Height, + bottom = 80, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + vita = { + left = -164, + right = 672, + top = 154, + bottom = 154 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "start", f16_local18, { + xbox = { + left = 194, + right = 494, + top = 107 - CoD.TextSettings.NormalFont.Height, + bottom = 107, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 195, + right = 495, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + vita = { + left = 520, + right = 670, + top = 452 - CoD.TextSettings.NormalFont.Height, + bottom = 452, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + } + } ) + return f16_local5 + end + end + f16_local4 = "@MENU_OBJECTIVES_MENU" + end + end + f16_local3 = "@MENU_SCOREBOARD" + end + local f16_local4 + if f16_local1 then + f16_local4 = "@LUA_MENU_SCOREBOARD_MENU" + if not f16_local4 then + + else + local f16_local5 = { + type = "UIElement", + id = "buttons_texts_overlay", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = {} + } + local f16_local6 = { + { + name = "buttons_default", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_tactical", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_lefty", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SPRINT_CHANGE_ZOOM" + } + } + local f16_local7 = { + { + name = "buttons_default", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_lefty", + text = f16_local2 + }, + { + name = "buttons_nomad", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + } + } + local f16_local8 = { + { + name = "buttons_default", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_tactical", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_lefty", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad", + text = f16_local2 + }, + { + name = "buttons_nomad_tactical", + text = f16_local2 + } + } + local f16_local9 = { + { + name = "buttons_default", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_tactical", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_lefty", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_CROUCH_PRONE" + } + } + local f16_local10 = { + { + name = "buttons_default", + text = f16_local2 + }, + { + name = "buttons_tactical", + text = f16_local2 + }, + { + name = "buttons_lefty", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + } + } + local f16_local11 = { + { + name = "buttons_default", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_FIRE_WEAPON" + } + } + local f16_local12 = { + { + name = "buttons_default", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SWITCH_WEAPON" + } + } + local f16_local13 = { + { + name = "buttons_default", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_tactical", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_lefty", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_MELEE_HOLD_BREATH" + } + } + local f16_local14 = { + { + name = "buttons_default", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_tactical", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_lefty", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_USE_RELOAD" + } + } + local f16_local15 = { + { + name = "buttons_default", + text = "@MENU_JUMP" + }, + { + name = "buttons_tactical", + text = "@MENU_JUMP" + }, + { + name = "buttons_lefty", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_JUMP" + } + } + local f16_local16 = { + { + name = "buttons_default", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_tactical", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_lefty", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_INVENTORY" + } + } + local f16_local17 = { + { + name = "buttons_default", + text = f16_local3 + }, + { + name = "buttons_tactical", + text = f16_local3 + }, + { + name = "buttons_lefty", + text = f16_local3 + }, + { + name = "buttons_nomad", + text = f16_local3 + }, + { + name = "buttons_nomad_tactical", + text = f16_local3 + } + } + local f16_local18 = { + { + name = "buttons_default", + text = f16_local4 + }, + { + name = "buttons_tactical", + text = f16_local4 + }, + { + name = "buttons_lefty", + text = f16_local4 + }, + { + name = "buttons_nomad", + text = f16_local4 + }, + { + name = "buttons_nomad_tactical", + text = f16_local4 + } + } + for f16_local30, f16_local29 in ipairs( { + f16_local6, + f16_local7, + f16_local8, + f16_local9, + f16_local10, + f16_local11, + f16_local12, + f16_local13, + f16_local14, + f16_local15, + f16_local16, + f16_local17, + f16_local18 + } ) do + local f16_local22 = f16_local29 + if f16_local29 == f16_local8 then + f16_local22 = f16_local7 + elseif f16_local29 == f16_local11 then + f16_local22 = f16_local10 + elseif f16_local29 == f16_local7 then + f16_local22 = f16_local8 + elseif f16_local29 == f16_local10 then + f16_local22 = f16_local11 + end + local f16_local23 = {} + for f16_local27, f16_local28 in ipairs( f16_local22 ) do + table.insert( f16_local23, { + name = f16_local28.name .. "_alt", + text = f16_local28.text + } ) + end + f16_local29 = LUI.ConcatenateToTable( f16_local29, f16_local23 ) + end + if Engine.IsPS3() or debugPlaystation then + f16_local19 = f16_local11 + f16_local11 = f16_local10 + f16_local10 = f16_local19 + f16_local20 = f16_local8 + f16_local8 = f16_local7 + f16_local7 = f16_local20 + end + if IsCurrentSticksLayoutSouthpaw() or IsCurrentSticksLayoutLegacySouthpaw() then + f16_local19 = f16_local9 + f16_local9 = f16_local6 + f16_local6 = f16_local19 + end + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LS", f16_local6, { + xbox = { + left = -200, + right = -5, + top = 294, + bottom = 294 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -200, + right = -5, + top = 300, + bottom = 300 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 230, + right = 400, + top = 438, + bottom = 438 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LB", f16_local7, { + xbox = { + left = -23, + right = 87, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -10, + right = 100, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 360, + right = 470, + top = 282 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 282 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LT", f16_local8, { + xbox = { + left = -155, + right = 145, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -167, + right = 133, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + vita = { + left = -250, + right = 50, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RS", f16_local9, { + xbox = { + left = 223, + right = 523, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 223, + right = 523, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = -164, + right = 672, + top = 250, + bottom = 250 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RT", f16_local11, { + xbox = { + left = 437, + right = 737, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 456, + right = 756, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + vita = { + left = 520, + right = 820, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RB", f16_local10, { + xbox = { + left = 495, + right = 605, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 489, + right = 599, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = 360, + right = 470, + top = 230 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 230 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "Y", f16_local12, { + xbox = { + left = 578, + right = 733, + top = 260 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 260 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 270 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 270 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 114 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 114 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "B", f16_local13, { + xbox = { + left = 578, + right = 733, + top = 300 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 300 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 310 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 310 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 727, + top = 200 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 200 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "X", f16_local14, { + xbox = { + left = 578, + right = 733, + top = 344 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 344 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 354 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 354 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 254 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 254 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "A", f16_local15, { + xbox = { + left = 578, + right = 733, + top = 380 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 380 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 390 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 390 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 306 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 306 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "DPAD", f16_local16, { + xbox = { + left = 56, + right = 356, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 56, + right = 356, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = -278, + right = 22, + top = 340, + bottom = 340 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = -300, + right = 0, + top = 200, + bottom = 200 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "back", f16_local17, { + xbox = { + left = 84, + right = 384, + top = 75 - CoD.TextSettings.NormalFont.Height, + bottom = 75, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 92, + right = 392, + top = 80 - CoD.TextSettings.NormalFont.Height, + bottom = 80, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + vita = { + left = -164, + right = 672, + top = 154, + bottom = 154 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "start", f16_local18, { + xbox = { + left = 194, + right = 494, + top = 107 - CoD.TextSettings.NormalFont.Height, + bottom = 107, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 195, + right = 495, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + vita = { + left = 520, + right = 670, + top = 452 - CoD.TextSettings.NormalFont.Height, + bottom = 452, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + } + } ) + return f16_local5 + end + end + f16_local4 = "@MENU_OBJECTIVES_MENU" + end + end + f16_local2 = "@MENU_USE_EQUIPMENT" +end + +function buttons_overlay() + local f17_local0 = nil + if Engine.IsVita() then + f17_local0 = RegisterMaterial( "cont_lines_btn_vita" ) + else + f17_local0 = RegisterMaterial( "cont_lines_btn" ) + end + local f17_local1 = { + type = "UIImage", + id = "controller_lines", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + material = f17_local0 + } + } + } + local f17_local2 = {} + f17_local1.children = buttons_texts_overlay() + if Engine.IsVita() then + f17_local1.states.default.top = 0 + f17_local1.states.default.left = 13 + elseif debugPlaystation then + f17_local1.states.default.top = -38 + f17_local1.states.default.left = 13 + elseif Engine.IsPS4() then + f17_local1.states.default.top = -38 + f17_local1.states.default.left = 13 + elseif Engine.IsPS3() then + f17_local1.states.default.top = -38 + f17_local1.states.default.left = 13 + elseif Engine.IsWiiU() then + f17_local1.states.default.top = -38 + f17_local1.states.default.left = 55 + elseif Engine.IsXB3() then + f17_local1.states.default.top = -30 + f17_local1.states.default.left = 9 + else + f17_local1.states.default.top = -40 + f17_local1.states.default.left = 12 + end + f17_local1.states.default.bottom = f17_local1.states.default.top + 512 + f17_local1.states.default.right = f17_local1.states.default.left + 572 + return f17_local1 +end + +function menu_base( f18_arg0, f18_arg1, f18_arg2 ) + local f18_local0 = { + type = "UIElement", + id = f18_arg0 .. "_layout_root_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = MainCreate, + omnvar_update = { + ui_pause_menu_show = layoutMenuClose + } + }, + children = {} + } + if Engine.InFrontend() then + f18_local0.children[#f18_local0.children + 1] = { + type = "UIImage", + id = "stick_button_darken_overlay", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = Swatches.Overlay.AlphaMore, + material = RegisterMaterial( "white" ) + } ) + } + } + end + if not Engine.InFrontend() then + f18_local0.children[#f18_local0.children + 1] = { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + } + f18_local0.children[#f18_local0.children + 1] = { + type = "UIImage", + id = "pause_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5, + material = RegisterMaterial( "black" ) + } + } + } + end + f18_local0.children[#f18_local0.children + 1] = { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( f18_arg1 ) + } + } + f18_local0.children[#f18_local0.children + 1] = { + type = "button_helper_text_main", + id = "button_helper_text_id" + } + f18_local0.children[#f18_local0.children + 1] = { + type = "generic_back_button", + id = "back_button_id" + } + local f18_local1 = nil + if Engine.IsVita() then + f18_local1 = RegisterMaterial( "cont_vita" ) + else + f18_local1 = RegisterMaterial( "cont" ) + end + local f18_local2, f18_local3 = nil + if Engine.UsingSplitscreenUpscaling() then + f18_local3 = 0.65 + local f18_local4 = 606 * f18_local3 + local f18_local5 = {} + f18_local5 = GameX.GetSafeZoneSize() + f18_local2 = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + top = (f18_local5[4] + f18_local5[2]) / 2, + right = f18_local5[3] - f18_local4 / 2 - 130, + height = 0, + width = 0 + } + else + f18_local3 = 1 + f18_local2 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 728, + top = 406, + height = 0, + width = 0 + } + end + local f18_local6 = Engine.UsingSplitscreenUpscaling() + local f18_local7 = Engine.IsPS3() + local f18_local8 = f18_local0.children + f18_local8[#f18_local0.children + 1] = { + type = "UIElement", + states = { + default = f18_local2 + }, + children = { + { + type = "UIElement", + id = "controller_container", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + width = 606, + height = 512, + scale = f18_local3 - 1 + } + }, + children = { + { + type = "UIImage", + id = "controller", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 512, + left = 0, + width = 606, + material = f18_local1 + } + } + }, + f18_arg2 + } + } + } + } + local f18_local4 = f18_local6 and f18_local7 or f18_local8 + return f18_local0 +end + +function sticks_layout() + local f19_local0 = menu_base( "sticks", "@MENU_STICK_LAYOUT_CAP", sticks_overlay() ) + f19_local0.children[#f19_local0.children + 1] = layout_buttons_vlist( GetSticksConfig, SetSticksConfig, { + { + name = "thumbstick_default", + display_name = "MENU_DEFAULT" + }, + { + name = "thumbstick_southpaw", + display_name = "MENU_SOUTHPAW" + }, + { + name = "thumbstick_legacy", + display_name = "MENU_LEGACY" + }, + { + name = "thumbstick_legacysouthpaw", + display_name = "MENU_LEGACY_SOUTHPAW" + }, + { + name = "thumbstick_southpaw_ns", + display_name = "MENU_SOUTHPAW_NS" + }, + { + name = "thumbstick_legacysouthpaw_ns", + display_name = "MENU_LEGACY_SOUTHPAW_NS" + } + } ) + return f19_local0 +end + +function buttons_layout() + local f20_local0 = menu_base( "buttons", "@MENU_BUTTON_LAYOUT_CAP", buttons_overlay() ) + local f20_local1 = { + { + name = "buttons_default", + display_name = "MENU_DEFAULT" + }, + { + name = "buttons_tactical", + display_name = "MENU_TACTICAL" + }, + { + name = "buttons_lefty", + display_name = "MENU_LEFTY" + }, + { + name = "buttons_nomad", + display_name = "MENU_NOMAD" + }, + { + name = "buttons_nomad_tactical", + display_name = "MENU_NOMAD_TACTICAL" + } + } + if Engine.IsPS3() or Engine.IsPS4() or debugPlaystation then + f20_local1[#f20_local1 + 1] = { + name = "buttons_default_alt", + display_name = "MENU_DEFAULT_ALT" + } + f20_local1[#f20_local1 + 1] = { + name = "buttons_tactical_alt", + display_name = "MENU_TACTICAL_ALT" + } + f20_local1[#f20_local1 + 1] = { + name = "buttons_lefty_alt", + display_name = "MENU_LEFTY_ALT" + } + f20_local1[#f20_local1 + 1] = { + name = "buttons_nomad_alt", + display_name = "MENU_NOMAD_ALT" + } + f20_local1[#f20_local1 + 1] = { + name = "buttons_nomad_tactical_alt", + display_name = "MENU_NOMAD_TACTICAL_ALT" + } + end + f20_local0.children[#f20_local0.children + 1] = layout_buttons_vlist( GetButtonsConfig, SetButtonsConfig, f20_local1 ) + return f20_local0 +end + +function MainCreate( f21_arg0, f21_arg1 ) + f21_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) +end + +LUI.MenuBuilder.registerDef( "thumbstick", sticks_layout ) +LUI.MenuBuilder.registerDef( "buttons", buttons_layout ) +LockTable( _M ) diff --git a/lui/common_menus/playercard.dec.lua b/lui/common_menus/playercard.dec.lua new file mode 100644 index 0000000..b68e0ba --- /dev/null +++ b/lui/common_menus/playercard.dec.lua @@ -0,0 +1,425 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +LUI.Playercard = {} +XP_BAR_WIDTH = 212 +LUI.Playercard.new = function ( f1_arg0, f1_arg1, f1_arg2 ) + local f1_local0 = 130 + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + height = 128, + width = 512, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + self.card = LUI.UIElement.new() + local f1_local2 = self.card + self:addElement( f1_local2 ) + f1_local2.id = "playercard" .. (f1_arg1.gamertag and "_" .. f1_arg1.gamertag or "") + f1_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -18, + left = -12, + height = 128, + width = 512 + } ) + f1_local2:animateToState( "default" ) + local f1_local3 = LUI.UIImage.new() + f1_local3.id = "mainBG" + f1_local3:registerAnimationState( "default", { + material = RegisterMaterial( "card_bg" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f1_local3:animateToState( "default" ) + f1_local2:addElement( f1_local3 ) + f1_local2.playerBG = LUI.UIImage.new() + f1_local2.playerBG.id = "playerBG" + f1_local2.playerBG:animateToState( "default" ) + f1_local2:addElement( f1_local2.playerBG ) + f1_local2.playerBGdarken = LUI.UIImage.new() + f1_local2.playerBGdarken.id = "playerBGdarken" + f1_local2.playerBGdarken:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + width = 399, + height = 64, + bottom = -24, + left = 53, + alpha = 0.85 + } ) + f1_local2.playerBGdarken:animateToState( "default" ) + f1_local2.playerBGdarken:setImage( RegisterMaterial( "card_image_darken" ) ) + f1_local2:addElement( f1_local2.playerBGdarken ) + f1_local2.gamertag = LUI.UIMarqueeText.new() + f1_local2.gamertag.id = "gamertag" + f1_local2.gamertag:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f1_local0, + right = -60, + top = 18, + height = CoD.TextSettings.NormalFont.Height + } ) + f1_local2.gamertag:animateToState( "default" ) + f1_local2:addElement( f1_local2.gamertag ) + f1_local2.slogan = LUI.UIMarqueeText.new() + f1_local2.slogan.id = "slogan" + f1_local2.slogan:setTextStyle( CoD.TextStyle.OutlinedMore ) + f1_local2.slogan:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f1_local0, + right = -60, + top = 40, + height = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1 + } ) + f1_local2.slogan:animateToState( "default" ) + f1_local2:addElement( f1_local2.slogan ) + f1_local2.clantag = LUI.UIText.new() + f1_local2.clantag.id = "clantag" + f1_local2.clantag.m_textStyle = CoD.TextStyle.OutlinedMore + f1_local2.clantag:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f1_local0, + right = -60, + top = 80, + height = CoD.TextSettings.NormalFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f1_local2.clantag:animateToState( "default" ) + f1_local2:addElement( f1_local2.clantag ) + if not (not IsPublicMatch or not IsPublicMatch()) or Engine.IsAliensMode() or f1_arg1.force_show_rank then + f1_local2.rankIcon = LUI.UIImage.new() + f1_local2.rankIcon.id = "rankIcon" + f1_local2:addElement( f1_local2.rankIcon ) + f1_local2.rankNum = LUI.UIText.new() + f1_local2.rankNum.id = "rankNum" + f1_local2.rankNum.m_textStyle = CoD.TextStyle.ShadowedMore + f1_local2.rankNum:registerAnimationState( "default", { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.BigFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + left = -165, + right = -65, + top = 58, + height = CoD.TextSettings.BigFont.MaxHeight + } ) + f1_local2.rankNum:animateToState( "default" ) + f1_local2:addElement( f1_local2.rankNum ) + end + if f1_arg1.use_level_progress then + LUI.Playercard.AddLevelProgressBar( f1_local2 ) + end + f1_local2.patchShape = LUI.UIImage.new() + f1_local2.patchShape.id = "patchShape" + f1_local2:addElement( f1_local2.patchShape ) + f1_local2.patchEmblem = LUI.UIImage.new() + f1_local2.patchEmblem.id = "patchEmblem" + f1_local2.patchEmblem:animateToState( "default" ) + f1_local2.patchEmblem.scale = f1_arg1.patchScale or 0 + f1_local2:addElement( f1_local2.patchEmblem ) + self.feedContent = LUI.Playercard.FeedContent + self:registerEventHandler( "update_playercard", function ( element, event ) + element:feedContent( event ) + end ) + self:registerEventHandler( "hide_playercard", function ( element, event ) + element:animateToState( "hidden", event.fade or 0 ) + end ) + self:registerEventHandler( "show_playercard", function ( element, event ) + element:animateToState( "default", event.fade or 0 ) + end ) + self:feedContent( f1_arg1 ) + return self +end + +LUI.Playercard.AddLevelProgressBar = function ( f5_arg0 ) + local f5_local0 = 0 + local f5_local1 = 140 + local f5_local2 = -50 + local f5_local3 = 150 + local f5_local4 = CoD.TextSettings.SmallFont.Height + + local levelProgressContainer = LUI.UIElement.new( CoD.CreateState( 45, -22, -58, 0, CoD.AnchorTypes.BottomLeftRight ) ) + levelProgressContainer.id = "playercard_level_bar_container_id" + local f5_local6 = CoD.CreateState( 0, 0, f5_local3, 0, CoD.AnchorTypes.TopBottomLeft ) + CoD.ColorizeState( Colors.black, f5_local6 ) + f5_local6.material = RegisterMaterial( "box_white_gradient_fade_rt" ) + f5_arg0.bgFade = LUI.UIImage.new( f5_local6 ) + levelProgressContainer:addElement( f5_arg0.bgFade ) + f5_local6 = CoD.CreateState( f5_local3, 0, 0, 0, CoD.AnchorTypes.All ) + CoD.ColorizeState( Colors.black, f5_local6 ) + f5_local6.material = RegisterMaterial( "white" ) + f5_arg0.bgFill = LUI.UIImage.new( f5_local6 ) + levelProgressContainer:addElement( f5_arg0.bgFill ) + f5_local6 = CoD.CreateState( f5_local1, 6, f5_local1 + XP_BAR_WIDTH, -6, CoD.AnchorTypes.TopBottomLeft ) + CoD.ColorizeState( Colors.grey_2, f5_local6 ) + f5_arg0.xpBar = LUI.UIImage.new( f5_local6 ) + f5_arg0.xpBar.id = "playercard_level_bar_bg_id" + levelProgressContainer:addElement( f5_arg0.xpBar ) + f5_local6 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.TopBottomLeft ) + f5_local6.material = RegisterMaterial( "btn_cas_fill_f" ) + f5_arg0.xpFillBar = LUI.UIImage.new( { + f5_local6 + } ) + f5_arg0.xpFillBar.id = "playercard_level_bar_id" + f5_arg0.xpBar:addElement( f5_arg0.xpFillBar ) + f5_arg0.currentRankIcon = LUI.UIImage.new( CoD.CreateState( f5_local1 - 26, f5_local0, f5_local1 - 6, f5_local0 + f5_local4, CoD.AnchorTypes.TopLeft ) ) + f5_arg0.currentRankIcon.id = "playercard_current_rank_icon_id" + f5_local6 = CoD.CreateState( 0, f5_local0, f5_local1 - 32, f5_local0 + f5_local4, CoD.AnchorTypes.TopLeft ) + f5_local6.font = CoD.TextSettings.SmallFont.Font + f5_local6.alignment = LUI.Alignment.Right + CoD.ColorizeState( Colors.md_grey, f5_local6 ) + f5_arg0.currentRankText = LUI.UIText.new( f5_local6 ) + f5_arg0.currentRankText.id = "playercard_current_rank_id" + f5_arg0.nextRankIcon = LUI.UIImage.new( CoD.CreateState( f5_local2, f5_local0, f5_local2 + 20, f5_local0 + f5_local4, CoD.AnchorTypes.TopRight ) ) + f5_arg0.nextRankIcon.id = "playercard_next_rank_icon_id" + f5_local6 = CoD.CreateState( f5_local2 + 25, f5_local0, 0, f5_local0 + f5_local4, CoD.AnchorTypes.TopRight ) + f5_local6.font = CoD.TextSettings.SmallFont.Font + f5_local6.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.md_grey, f5_local6 ) + f5_arg0.nextRankText = LUI.UIText.new( f5_local6 ) + f5_arg0.nextRankText.id = "playercard_next_rank_id" + levelProgressContainer:addElement( f5_arg0.currentRankIcon ) + levelProgressContainer:addElement( f5_arg0.currentRankText ) + levelProgressContainer:addElement( f5_arg0.nextRankIcon ) + levelProgressContainer:addElement( f5_arg0.nextRankText ) + f5_arg0:addElement( levelProgressContainer ) + f5_arg0.levelProgressContainer = levelProgressContainer + +end + +LUI.Playercard.FeedContent = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0.card + if f6_arg1.gamertag then + f6_local0.gamertag:setText( f6_arg1.gamertag ) + end + if f6_arg1.clantag then + local f6_local1 = f6_arg1.clantag + if f6_arg1.clantag ~= "" then + if not string.find( f6_arg1.clantag, "[", nil, true ) then + f6_local1 = "[" .. f6_local1 + end + if not string.find( f6_arg1.clantag, "]", nil, true ) then + f6_local1 = f6_local1 .. "]" + end + end + f6_local0.clantag:setText( f6_local1 ) + end + if f6_arg1.background then + local f6_local1 = RegisterMaterial( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Background].GetUIMaterial( f6_arg1.background ) ) + if f6_local1 then + f6_local0.playerBG:setImage( f6_local1 ) + f6_local0.playerBG:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + width = 399, + height = 64, + bottom = -24, + left = 53 + } ) + f6_local0.playerBG:animateToState( "default" ) + end + end + if f6_local0.rankIcon and f6_local0.rankNum and f6_arg1.rank and f6_arg1.prestige then + local f6_local1 = Engine.IsAliensMode() and CoD.PlayMode.Aliens or CoD.PlayMode.Core + local f6_local2 = Rank.GetRankDisplay( f6_arg1.rank, f6_local1 ) + f6_local0.rankNum:setText( f6_local2 ) + local f6_local3 = RegisterMaterial( Rank.GetRankIcon( f6_arg1.rank, f6_arg1.prestige, f6_local1 ) ) + if f6_local3 then + local f6_local4 = f6_arg1.prestige > 0 + local f6_local5 + if f6_local4 then + f6_local5 = 46 + if not f6_local5 then + + else + local f6_local6 + if f6_local4 then + f6_local6 = 61 + if not f6_local6 then + + else + local f6_local7, f6_local8, f6_local9, f6_local10 = GetTextDimensions( f6_local2, CoD.TextSettings.BigFont.Font, CoD.TextSettings.BigFont.MaxHeight ) + local f6_local11 = f6_local9 - f6_local7 + f6_local0.rankIcon:setImage( f6_local3 ) + f6_local0.rankIcon:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = f6_local6, + right = -70 - f6_local11, + width = f6_local5, + height = f6_local5 + } ) + f6_local0.rankIcon:animateToState( "default" ) + end + end + f6_local6 = 63 + end + end + f6_local5 = 40 + end + end + if f6_arg1.patchShape then + local f6_local1 = RegisterMaterial( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patchbacking].GetUIMaterial( f6_arg1.patchShape ) ) + if f6_local1 then + f6_local0.patchShape:setImage( f6_local1 ) + f6_local0.patchShape:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = 128, + height = 128 + } ) + f6_local0.patchShape:animateToState( "default" ) + end + end + if f6_arg1.patchEmblem then + local f6_local1 = RegisterMaterial( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch].GetUIMaterial( f6_arg1.patchEmblem ) ) + if f6_local1 then + f6_local0.patchEmblem:setImage( f6_local1 ) + f6_local0.patchEmblem:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = 128, + height = 128, + red = 1, + green = 1, + blue = 1, + alpha = 1, + scale = f6_local0.patchEmblem.scale + } ) + f6_local0.patchEmblem:animateToState( "default" ) + end + local f6_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch] + if f6_local2 and f6_local2.GetQuip then + local f6_local3 = f6_local2.GetQuip( f6_arg1.patchEmblem ) + if f6_local3 then + f6_local0.slogan:setText( Engine.Localize( f6_local3 ) ) + end + end + end + if f6_arg1.experience and f6_arg1.prestige and f6_local0.levelProgressContainer then + local f6_local1 = Engine.GetCurrentCoDPlayMode() + local f6_local2 = Rank.GetMaxRank( f6_local1 ) + local f6_local3 = Engine.IsAliensMode() and Lobby.GetAlienRankForXP( f6_arg1.experience ) or Lobby.GetRankForXP( f6_arg1.experience ) + local f6_local4 + if f6_local3 < f6_local2 then + f6_local4 = f6_local3 + 1 + if not f6_local4 then + + else + local f6_local5 = Engine.IsAliensMode() and LUI.mp_menus.Aliens.AlienRanks.MaxPrestige or Lobby.GetMaxPrestigeLevel() + local f6_local6 = Rank.GetRankMaxXP( f6_local2 ) <= f6_arg1.experience + f6_local0.currentRankText:setText( Rank.GetRankDisplay( f6_local3 ) ) + local f6_local7 = RegisterMaterial( Rank.GetRankIcon( f6_local3, f6_arg1.prestige, f6_local1 ) ) + if f6_local7 then + f6_local0.currentRankIcon:setImage( f6_local7 ) + end + local f6_local8 = false + if not Engine.IsAliensMode() and f6_local3 == f6_local4 and not f6_local6 and f6_arg1.prestige < f6_local5 then + f6_local8 = true + end + if Engine.IsAliensMode() and f6_local3 == LUI.mp_menus.Aliens.AlienRanks.MaxLevel and f6_arg1.prestige < f6_local5 then + f6_local8 = true + f6_local4 = 0 + end + f6_local0.nextRankText:setText( Rank.GetRankDisplay( f6_local4, f6_local1 ) ) + local f6_local9 = RegisterMaterial + local f6_local10 = Rank.GetRankIcon + local f6_local11 = f6_local4 + local f6_local12 + if f6_local8 then + f6_local12 = f6_arg1.prestige + 1 + if not f6_local12 then + + else + f6_local7 = f6_local9( f6_local10( f6_local11, f6_local12, f6_local1 ) ) + if f6_local7 then + f6_local0.nextRankIcon:setImage( f6_local7 ) + end + f6_local9 = Rank.GetRankMinXP( f6_local3, f6_local1 ) + f6_local10 = Rank.GetRankMinXP( f6_local4, f6_local1 ) + f6_local11 = Rank.GetRankXPToNext( f6_local3, f6_local1 ) + if f6_local11 == nil or f6_local11 == 0 then + f6_local11 = 1 + end + f6_local12 = math.min( (f6_arg1.experience - f6_local9) / f6_local11, 1 ) + if Engine.IsAliensMode() and f6_local3 == LUI.mp_menus.Aliens.AlienRanks.SuperMaxLevel then + f6_local12 = 1 + end + f6_local0.xpFillBar:registerAnimationState( "default", { + top = 0, + bottom = 0, + left = 0, + right = f6_local12 * XP_BAR_WIDTH, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false + } ) + f6_local0.xpFillBar:animateToState( "default", 0 ) + end + end + f6_local12 = f6_arg1.prestige + end + end + f6_local4 = f6_local3 + end +end + +LUI.MenuBuilder.registerType( "playercard", LUI.Playercard.new ) +LockTable( _M ) diff --git a/lui/common_menus/profilepopup.dec.lua b/lui/common_menus/profilepopup.dec.lua new file mode 100644 index 0000000..fce0d75 --- /dev/null +++ b/lui/common_menus/profilepopup.dec.lua @@ -0,0 +1,122 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function profileMenuOptionsFeeder( f1_arg0 ) + return { + { + type = "UIGenericButton", + id = "offile_profile_create_btn", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_CREATE_NEW_OFFLINE_PROFILE" ), + button_action_func = function ( f2_arg0, f2_arg1 ) + DebugPrint( "button offile_profile_create_btn press" ) + Engine.Exec( "newOfflineProfile", f2_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f2_arg0 ) + end + + } + }, + { + type = "UIGenericButton", + id = "offile_profile_load_btn", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_LOAD_EXISTING_OFFLINE_PROFILE" ), + button_action_func = function ( f3_arg0, f3_arg1 ) + DebugPrint( "button offile_profile_load_btn press" ) + Engine.Exec( "loadOfflineProfile", f3_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f3_arg0 ) + end + + } + }, + { + type = "UIGenericButton", + id = "offile_profile_delete_btn", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_DELETE_OFFLINE_PROFILE" ), + button_action_func = function ( f4_arg0, f4_arg1 ) + DebugPrint( "button offile_profile_delete_btn press" ) + Engine.Exec( "deleteOfflineProfile", f4_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) + end + + } + } + } +end + +function OnCreatePS3ProfileMenu( f5_arg0, f5_arg1 ) + DebugPrint( "On Create PS3 profile menu" ) + Engine.ExecNow( "incnosplitscreencontrol menu_ps3_profile" ) +end + +function OnClosePS3ProfileMenu( f6_arg0, f6_arg1 ) + DebugPrint( "On Close PS3 profile menu" ) + Engine.ExecNow( "decnosplitscreencontrol menu_ps3_profile" ) + local f6_local0 = Engine.GetLuiRoot() + if f6_local0:IsMenuOpenAndVisible( "menu_splitscreensignin" ) and not f6_local0:IsMenuOpenAndVisible( "menu_resetstats_warning" ) and not f6_local0:IsMenuOpenAndVisible( "menu_ps3_savegame_warning" ) then + Engine.Exec( "startsplitscreensignin" ) + end +end + +function menu_ps3_profile() + return { + type = "generic_selectionList_popup", + id = "offline_profile_management_popup", + properties = { + popup_title = Engine.Localize( "@MENU_LOAD_OFFLINE_PROFILE" ), + popup_childfeeder = profileMenuOptionsFeeder + }, + handlers = { + menu_create = OnCreatePS3ProfileMenu, + menu_close = OnClosePS3ProfileMenu + } + } +end + +function SaveErrorContinue( f8_arg0, f8_arg1 ) + DebugPrint( "Save Error Continue" ) + if Engine.GetDvarBool( "splitscreen" ) then + Engine.Exec( "endsplitscreensignin" ) + LUI.FlowManager.RequestAddMenu( f8_arg0, "menu_gamesetup_splitscreen", false, f8_arg1.controller, false, {} ) + else + assert( f8_arg0.properties.callback_params.continue_to_menu ) + LUI.FlowManager.RequestOldMenu( f8_arg0, f8_arg0.properties.callback_params.continue_to_menu, false ) + end +end + +function SaveErrorReturn( f9_arg0, f9_arg1 ) + DebugPrint( "Save Error Cancel" ) + if Engine.GetDvarBool( "splitscreen" ) then + Engine.Exec( "startsplitscreensignin" ) + end +end + +function GetSomeText() + return "my cool text" +end + +function menu_ps3_savegame_error() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.UserWithoutOfflineProfile(), + popup_title = Engine.Localize( "@MENU_SAVE_ERROR_MP" ), + yes_text = Engine.Localize( "@MENU_RESUMEGAME_NOSAVE_MP" ), + no_text = Engine.Localize( "@MENU_RETURN_SIGNIN_MP" ), + yes_action = SaveErrorContinue, + no_action = SaveErrorReturn + } + } +end + +LUI.MenuBuilder.registerDef( "menu_ps3_profile", menu_ps3_profile ) +LUI.MenuBuilder.registerDef( "menu_ps3_savegame_error", menu_ps3_savegame_error ) +LockTable( _M ) diff --git a/lui/common_menus/rankutils.dec.lua b/lui/common_menus/rankutils.dec.lua new file mode 100644 index 0000000..f50174d --- /dev/null +++ b/lui/common_menus/rankutils.dec.lua @@ -0,0 +1,123 @@ +Rank = {} +RankTable = { + File = "mp/rankTable.csv", + AlienFile = "mp/alien/rankTable.csv", + Cols = { + RankId = 0, + Rank = 1, + MinXp = 2, + XpToNextLevel = 3, + ShortRankName = 4, + FullRankName = 5, + RankIcon = 6, + MaxXp = 7, + Level = 13, + DisplayLevel = 14, + InGameRank = 16, + UnlockString = 17 + } +} +RankIconTable = { + File = "mp/rankIconTable.csv", + AlienFile = "mp/alien/rankIconTable.csv", + Cols = { + RankId = 0, + Standard = 1, + Prestige1 = 2 + } +} +Rank.GetMaxRank = function ( f1_arg0 ) + local f1_local0 = nil + if not f1_arg0 or f1_arg0 == CoD.PlayMode.Core or f1_arg0 == CoD.PlayMode.SquadVsSquad then + f1_local0 = tonumber( Engine.TableLookup( RankTable.File, 0, "maxrank", 1 ) ) + assert( f1_local0 ~= nil, "Rank.GetMaxRank() : Could not read max rank (MP)" ) + elseif f1_arg0 == CoD.PlayMode.Aliens then + f1_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, 0, "maxrank", 1 ) ) + assert( f1_local0 ~= nil, "Rank.GetMaxRank() : Could not read max rank (ALIENS)" ) + else + DebugPrint( "[WARNING] Rank.GetMaxRank() : Unsupported CodPlayMode [" .. f1_arg0 .. "]!" ) + f1_local0 = 0 + end + return f1_local0 +end + +Rank.GetRankDisplay = function ( f2_arg0, f2_arg1 ) + local f2_local0 = nil + if not f2_arg1 or f2_arg1 == CoD.PlayMode.Core or f2_arg1 == CoD.PlayMode.SquadVsSquad then + f2_local0 = Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f2_arg0, RankTable.Cols.DisplayLevel ) + elseif f2_arg1 == CoD.PlayMode.Aliens then + f2_local0 = Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f2_arg0, RankTable.Cols.DisplayLevel ) + else + DebugPrint( "[WARNING] Rank.GetRankDisplay() : Unsupported CodPlayMode [" .. f2_arg1 .. "]!" ) + f2_local0 = "" + end + return f2_local0 +end + +Rank.GetRankMinXP = function ( f3_arg0, f3_arg1 ) + local f3_local0 = nil + if not f3_arg1 or f3_arg1 == CoD.PlayMode.Core or f3_arg1 == CoD.PlayMode.SquadVsSquad then + f3_local0 = tonumber( Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f3_arg0, RankTable.Cols.MinXp ) ) + elseif f3_arg1 == CoD.PlayMode.Aliens then + f3_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f3_arg0, RankTable.Cols.MinXp ) ) + else + DebugPrint( "[WARNING] Rank.GetRankMinXP() : Unsupported CodPlayMode [" .. f3_arg1 .. "]!" ) + f3_local0 = 0 + end + return f3_local0 +end + +Rank.GetRankMaxXP = function ( f4_arg0, f4_arg1 ) + local f4_local0 = nil + if not f4_arg1 or f4_arg1 == CoD.PlayMode.Core or f4_arg1 == CoD.PlayMode.SquadVsSquad then + f4_local0 = tonumber( Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f4_arg0, RankTable.Cols.MaxXp ) ) + assert( f4_local0 ~= nil, "Rank.GetRankMaxXP() : Could not read max XP for rank (MP)" ) + elseif f4_arg1 == CoD.PlayMode.Aliens then + f4_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f4_arg0, RankTable.Cols.MaxXp ) ) + assert( f4_local0 ~= nil, "Rank.GetRankMaxXP() : Could not read max XP for rank (ALIENS)" ) + else + DebugPrint( "[WARNING] Rank.GetRankMaxXP() : Unsupported CodPlayMode [" .. f4_arg1 .. "]!" ) + f4_local0 = 0 + end + return f4_local0 +end + +Rank.GetRankXPToNext = function ( f5_arg0, f5_arg1 ) + local f5_local0 = nil + if not f5_arg1 or f5_arg1 == CoD.PlayMode.Core or f5_arg1 == CoD.PlayMode.SquadVsSquad then + f5_local0 = tonumber( Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f5_arg0, RankTable.Cols.XpToNextLevel ) ) + elseif f5_arg1 == CoD.PlayMode.Aliens then + f5_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f5_arg0, RankTable.Cols.XpToNextLevel ) ) + else + DebugPrint( "[WARNING] Rank.GetRankXPToNext() : Unsupported CodPlayMode [" .. f5_arg1 .. "]!" ) + f5_local0 = 0 + end + return f5_local0 +end + +Rank.GetRankIcon = function ( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = nil + if not f6_arg2 or f6_arg2 == CoD.PlayMode.Core or f6_arg2 == CoD.PlayMode.SquadVsSquad then + f6_local0 = Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f6_arg0, RankIconTable.Cols.Standard + f6_arg1 ) + elseif f6_arg2 == CoD.PlayMode.Aliens then + f6_local0 = Engine.TableLookup( RankIconTable.AlienFile, RankIconTable.Cols.RankId, f6_arg0, RankIconTable.Cols.Standard + f6_arg1 ) + else + DebugPrint( "[WARNING] Rank.GetRankIcon() : Unsupported CodPlayMode [" .. f6_arg2 .. "]!" ) + f6_local0 = "" + end + return f6_local0 +end + +Rank.GetFullRank = function ( f7_arg0, f7_arg1 ) + local f7_local0 = nil + if not f7_arg1 or f7_arg1 == CoD.PlayMode.Core or f7_arg1 == CoD.PlayMode.SquadVsSquad then + f7_local0 = Engine.Localize( "@" .. Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f7_arg0, RankTable.Cols.FullRankName ) ) + elseif f7_arg1 == CoD.PlayMode.Aliens then + f7_local0 = Engine.Localize( "@" .. Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f7_arg0, RankTable.Cols.FullRankName ) ) + else + DebugPrint( "[WARNING] Rank.GetFullRank() : Unsupported CodPlayMode [" .. f7_arg1 .. "]!" ) + f7_local0 = "" + end + return f7_local0 +end + diff --git a/lui/common_menus/virtualkeyboard.dec.lua b/lui/common_menus/virtualkeyboard.dec.lua new file mode 100644 index 0000000..260b8c3 --- /dev/null +++ b/lui/common_menus/virtualkeyboard.dec.lua @@ -0,0 +1,129 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function ExitVirtualKeyboard( f1_arg0, f1_arg1, f1_arg2 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + if f1_local0.exiting then + return + end + f1_local0.exiting = true + f1_arg0:dispatchEventToRoot( { + name = "exit_virtual_keyboard", + immediate = true + } ) + if Engine.TriggerVirtualKeyboardCallback then + local f1_local1 = Engine.TriggerVirtualKeyboardCallback + local f1_local2 = f1_arg1.controller + local f1_local3 = f1_arg2 + local f1_local4 + if not f1_arg2 then + f1_local4 = f1_local0.input + if not f1_local4 then + + else + f1_local1( f1_local2, f1_local3, f1_local4, f1_local0.verifyString or false ) + end + end + f1_local4 = "" + end +end + +function input_popup( f2_arg0, f2_arg1 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "virtual_keyboard" ) + local f2_local1 = f2_arg1.keyboardType + if not f2_local1 then + f2_local1 = CoD.KeyboardInputTypes.Normal + end + local f2_local2 + if f2_local1 == CoD.KeyboardInputTypes.Email then + f2_local2 = 1000 + if not f2_local2 then + + else + local f2_local3 = f2_local1 == CoD.KeyboardInputTypes.Password + local f2_local4 = f2_arg1.use_auto_align or false + local f2_local5 = LUI.MenuGenerics.generic_selectionList_popup( {}, { + popup_title = f2_arg1.title, + popup_width = f2_local2, + popup_childfeeder = function () + return { + { + type = "generic_input_field", + id = "not_so_virtual_input", + requireFocusType = FocusType.MouseOver, + properties = { + keyboard_type = f2_local1, + password_field = f2_local3, + use_auto_align = f2_local4, + max_length = f2_local0.maxLength, + help_value = f2_local0.input, + field_edited_func = function ( f4_arg0, f4_arg1 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + f4_local0.input = f4_arg1.text or "" + if f4_local0.exiting then + return + else + f4_arg1.controller = f4_local0.exclusiveController + ExitVirtualKeyboard( f4_arg0, f4_arg1, f4_arg1.cancelled ) + LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) + end + end + , + additional_handlers = { + menu_create = MBh.EmitEvent( { + name = "button_action", + mouse = true + } ), + exit_virtual_keyboard = function ( f5_arg0, f5_arg1 ) + f5_arg0:processEvent( { + name = "finish_editing" + } ) + end + + } + } + }, + { + type = "UIGenericButton", + id = "input_ok", + audio = { + button_over = CoD.SFX.SubMenuMouseOver + }, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "MENU_OK" ), + button_action_func = function ( f6_arg0, f6_arg1 ) + ExitVirtualKeyboard( f6_arg0, f6_arg1, false ) + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) + end + + } + } + } + end + } ) + f2_local5:registerEventHandler( "popup_back", function ( element, event ) + ExitVirtualKeyboard( element, event, true ) + end ) + f2_local5:dispatchEventToRoot( { + name = "virtual_keyboard_popup_active", + immediate = true + } ) + return f2_local5 + end + end + f2_local2 = nil +end + +function virtual_keyboard( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "virtual_keyboard" ) + f8_local0.input = f8_arg1.defaultText or "" + f8_local0.maxLength = f8_arg1.maxLength or 12 + f8_local0.verifyString = f8_arg1.verifyString or false + return input_popup( f8_arg0, f8_arg1 ) +end + +LUI.MenuBuilder.registerType( "virtual_keyboard", virtual_keyboard ) +LockTable( _M ) diff --git a/lui/common_menus/whatcanisay.dec.lua b/lui/common_menus/whatcanisay.dec.lua new file mode 100644 index 0000000..59a949d --- /dev/null +++ b/lui/common_menus/whatcanisay.dec.lua @@ -0,0 +1,372 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + Kinect.CloseWhatCanISayMenu( f1_arg0, f1_arg1 ) +end + +function TitleFactory( f2_arg0, f2_arg1 ) + return { + type = "UIText", + id = "text_whatcanisay_" .. tostring( f2_arg0 ), + properties = { + text = Engine.Localize( f2_arg1 ) + }, + states = { + default = { + height = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left, + width = 600, + r = 1, + g = 1, + b = 1 + } + } + } +end + +function BlankFactory( f3_arg0 ) + return { + type = "UIText", + id = "text_whatcanisay_" .. tostring( f3_arg0 ), + properties = { + text = "" + }, + states = { + default = { + height = 20, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left, + width = 600, + r = 1, + g = 1, + b = 1 + } + } + } +end + +function TextFactory( f4_arg0, f4_arg1, f4_arg2 ) + local f4_local0 + if f4_arg2 then + f4_local0 = 200 + if not f4_local0 then + + else + return { + type = "UIText", + id = "text_whatcanisay_" .. tostring( f4_arg0 ), + properties = { + text = Engine.Localize( f4_arg1 ) + }, + states = { + default = { + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + width = f4_local0 + } + } + } + end + end + f4_local0 = 370 +end + +function BigTextFactory( f5_arg0, f5_arg1 ) + return { + type = "UIText", + id = "text_whatcanisay_" .. tostring( f5_arg0 ), + properties = { + text = Engine.Localize( f5_arg1 ) + }, + states = { + default = { + height = CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Left, + width = 600 + } + } + } +end + +function DescFactory( f6_arg0, f6_arg1 ) + return { + type = "UIText", + id = "text_whatcanisay_" .. tostring( f6_arg0 ), + properties = { + text = Engine.Localize( f6_arg1 ) + }, + states = { + default = { + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + width = 600, + red = 0.75, + green = 0.75, + blue = 0.75 + } + } + } +end + +function GrammarFeeder( f7_arg0 ) + local f7_local0 = {} + if Engine.InFrontend() then + local f7_local1 = false + if Kinect.menu_under_what_can_i_say then + if string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "main_lockout" ) then + f7_local1 = true + elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "boot_brightness" ) then + f7_local1 = true + elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "boot_screen_margins" ) then + f7_local1 = true + elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "no_profile_warning_popmenu" ) then + f7_local1 = true + end + end + if f7_local1 == true then + + elseif Kinect.IsKinectGuideUp() then + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_SAY_GHOSTS_AND_ONE_OF_THE_FOLLOWING" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_KINECT_GUIDE_COMMANDS_CAPS" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_SHORTCUT_1_TO_9", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_SHORTCUT_1_TO_9_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_CANCEL_BACK", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_CANCEL_BACK_COMMAND" ) + else + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_SAY_GHOSTS_AND_ONE_OF_THE_FOLLOWING" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_GENERAL_COMMANDS_CAPS" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_SHORTCUTS_1", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_SHORTCUTS_COMMAND" ) + local f7_local2 = false + if Kinect.menu_under_what_can_i_say then + if string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "menu_xboxlive_lobby" ) then + f7_local2 = true + elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "menu_xboxlive_privatelobby" ) then + f7_local2 = true + elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "menu_xboxlive" ) then + f7_local2 = true + end + end + if f7_local2 == true then + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_LOBBY_COMMANDS_CAPS" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL_COMMAND" ) + else + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_UNMUTE", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_UNMUTE_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_NON_FRIENDS", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_NON_FRIENDS_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_NON_PARTY", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_NON_PARTY_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_COMPARE", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_COMPARE_COMMAND" ) + end + end + end + elseif not Engine.IsMultiplayer() then + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_GENERAL_COMMANDS_CAPS" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_GHOST_PAUSE_GHOST_PLAY", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_PAUSE_PLAY_COMMAND" ) + local f7_local1 = Engine.GetDvarString( "mapname" ) + if f7_local1 == "enemyhq" or f7_local1 == "nml" then + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_ATTACK_1", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_ATTACK_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_CANCEL_1", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_CANCEL_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BARK_1", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_BARK_COMMAND" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_SPECIFIC_COMMMAND_CAPS" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_LOCATION_COMMAND" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_DOOR" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_WINDOW" ) + if f7_local1 == "enemyhq" then + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_COUNTER" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_STAIRS" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_STATUE" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_WALKWAY" ) + elseif f7_local1 == "nml" then + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BALCONY" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BRIDGE" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BUILDING" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_CAR" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_GARAGE" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_TRAILER" ) + end + end + end + if #f7_local0 == 0 then + if Engine.InFrontend() then + f7_local0[#f7_local0 + 1] = BigTextFactory( #f7_local0, "@SPEECH_NO_VOICE_COMMANDS_FRONT_END" ) + else + f7_local0[#f7_local0 + 1] = BigTextFactory( #f7_local0, "@SPEECH_NO_VOICE_COMMANDS_IN_GAME" ) + end + end + return f7_local0 +end + +function OptionsMainCreate( f8_arg0, f8_arg1 ) + f8_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function what_can_i_say_vlist() + return { + type = "UIGrid", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 120, + right = -120, + top = 110, + bottom = -60 + } + }, + properties = { + elementsPerRow = 2, + hSpacing = 10, + rowHeight = 33, + hAlign = LUI.Alignment.Left, + vAlign = LUI.Alignment.Top + }, + childrenFeeder = GrammarFeeder + } +end + +function WhatCanISayHandleSpeechActionBack( f10_arg0, f10_arg1, f10_arg2 ) + if Kinect.IsWhatCanISayMenuUp() then + f0_local0( f10_arg0, f10_arg1 ) + LUI.Speech.PerformingSpeechAction() + end +end + +if Engine.HasSpeechFeature() then + WhatCanISaySpeechGrammarHandlersArray = { + { + action = "back", + confidence = LUI.Speech.defaultConfidence, + handler = WhatCanISayHandleSpeechActionBack, + extradata = nil + }, + { + action = "cancel", + confidence = LUI.Speech.defaultConfidence, + handler = WhatCanISayHandleSpeechActionBack, + extradata = nil + } + } +else + WhatCanISaySpeechGrammarHandlersArray = {} +end +function WhatCanISayHandleSpeechAction( f11_arg0, f11_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.ProcessActionEvent( f11_arg0, f11_arg1, WhatCanISaySpeechGrammarHandlersArray ) + end +end + +function what_can_i_say() + return { + type = "UIElement", + id = "what_can_i_say_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + speech_action = WhatCanISayHandleSpeechAction + }, + children = { + { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIImage", + id = "options_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.95, + material = RegisterMaterial( "black" ) + } + } + }, + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@SPEECH_WHATCANISAY_CAPS" ) + } + }, + { + type = "what_can_i_say_vlist", + id = "what_can_i_say_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_start = f0_local0, + button_select = f0_local0, + button_secondary = f0_local0 + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "what_can_i_say_vlist", what_can_i_say_vlist ) +LUI.MenuBuilder.registerDef( "what_can_i_say", what_can_i_say ) +LockTable( _M ) diff --git a/lui/default.dec.lua b/lui/default.dec.lua new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lui/default.dec.lua @@ -0,0 +1 @@ + diff --git a/lui/eventcatcher.dec.lua b/lui/eventcatcher.dec.lua new file mode 100644 index 0000000..5b5640b --- /dev/null +++ b/lui/eventcatcher.dec.lua @@ -0,0 +1,124 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +require( "LUI.CoD" ) +f0_local0 = hashset( { + "keybind", + "action_slot_pressed", + "game_message", + "hide_host_migration", + "obituary", + "show_host_migration_triggered", + "toggle_pause", + "weapon_change", + "show_hud_menu", + "hide_hud_menu", + "playerstate_client_changed", + "close_rival_info", + "open_rival_info", + "camera_client_changed", + "refresh_options_button", + "update_mlg_prev_next", + "spectate_team_change" +} ) +function isDirectDispatchEventType( f1_arg0 ) + return f0_local0[f1_arg0] +end + +function new() + local f2_local0 = {} + setmetatable( f2_local0, { + __index = _M + } ) + f2_local0.direct_dispatch = {} + f2_local0.omnvar_update = {} + f2_local0.dvar_update = {} + return f2_local0 +end + +function setupRoot( f3_arg0, f3_arg1 ) + f3_arg1:registerEventHandler( "omnvar_update", omnvarUpdateDispatcher ) + f3_arg1:registerEventHandler( "dvar_update", dvarUpdateDispatcher ) + for f3_local3, f3_local4 in pairs( f0_local0 ) do + f3_arg1:registerEventHandler( f3_local3, directDispatcher ) + end +end + +function registerOmnvarHandler( f4_arg0, f4_arg1, f4_arg2, f4_arg3 ) + assert( type( f4_arg1 ) == "userdata" ) + assert( type( f4_arg2 ) == "string" ) + assert( type( f4_arg3 ) == "function" ) + local f4_local0 = f4_arg0.omnvar_update + local f4_local1 = f4_arg0.omnvar_update[f4_arg2] + if not f4_local1 then + f4_local1 = setmetatable( {}, { + __mode = "k" + } ) + end + f4_local0[f4_arg2] = f4_local1 + f4_arg0.omnvar_update[f4_arg2][f4_arg1] = f4_arg3 +end + +function omnvarUpdateDispatcher( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0.eventCatcher.omnvar_update[f5_arg1.omnvar] + if f5_local0 then + for f5_local4, f5_local5 in pairs( f5_local0 ) do + if not f5_local4:isClosed() then + f5_local5( f5_local4, f5_arg1 ) + end + end + end +end + +function registerDvarHandler( f6_arg0, f6_arg1, f6_arg2, f6_arg3 ) + assert( type( f6_arg1 ) == "userdata" ) + assert( type( f6_arg2 ) == "string" ) + assert( type( f6_arg3 ) == "function" ) + if not f6_arg0.dvar_update[f6_arg2] then + assert( Engine.WatchDvar( f6_arg2 ), "failed to watch dvar" ) + f6_arg0.dvar_update[f6_arg2] = setmetatable( {}, { + __mode = "k" + } ) + end + f6_arg0.dvar_update[f6_arg2][f6_arg1] = f6_arg3 +end + +function dvarUpdateDispatcher( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0.eventCatcher.dvar_update[f7_arg1.dvar] + if f7_local0 then + for f7_local4, f7_local5 in pairs( f7_local0 ) do + if not f7_local4:isClosed() then + f7_local5( f7_local4, f7_arg1 ) + end + end + end +end + +function registerDirectDispatchHandler( f8_arg0, f8_arg1, f8_arg2, f8_arg3 ) + assert( type( f8_arg1 ) == "userdata" ) + assert( type( f8_arg2 ) == "string" ) + assert( type( f8_arg3 ) == "function" ) + local f8_local0 = f8_arg0.direct_dispatch + local f8_local1 = f8_arg0.direct_dispatch[f8_arg2] + if not f8_local1 then + f8_local1 = setmetatable( {}, { + __mode = "k" + } ) + end + f8_local0[f8_arg2] = f8_local1 + f8_arg0.direct_dispatch[f8_arg2][f8_arg1] = f8_arg3 +end + +function directDispatcher( f9_arg0, f9_arg1 ) + local f9_local0 = f9_arg0.eventCatcher.direct_dispatch[f9_arg1.name] + if f9_local0 then + for f9_local4, f9_local5 in pairs( f9_local0 ) do + if not f9_local4:isClosed() then + assert( f9_local4.m_eventHandlers[f9_arg1.name] == f9_local5 ) + f9_local5( f9_local4, f9_arg1 ) + end + end + end +end + +LockTable( _M ) diff --git a/lui/flowmanager.dec.lua b/lui/flowmanager.dec.lua new file mode 100644 index 0000000..737a423 --- /dev/null +++ b/lui/flowmanager.dec.lua @@ -0,0 +1,1068 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +LUI.FlowManager.modal_priority = 500 +PushAndPopsTable = {} +function new() + local f1_local0 = {} + setmetatable( f1_local0, { + __index = _M + } ) + f1_local0.menuInfoStack = {} + f1_local0.debug = true + f1_local0.flowEvents = {} + f1_local0.menuInfoData = {} + f1_local0.antiSpam = { + lastOpenedMenu = 0, + countOpenedMenusRecently = 0, + openMenuDelay = 0 + } + setmetatable( f1_local0.menuInfoData, { + __mode = "k" + } ) + return f1_local0 +end + +function RegisterStackPushBehaviour( f2_arg0, f2_arg1 ) + PushAndPopsTable[f2_arg0] = PushAndPopsTable[f2_arg0] or {} + PushAndPopsTable[f2_arg0].pushFunc = f2_arg1 or PushAndPopsTable[f2_arg0].pushFunc +end + +function RegisterStackPopBehaviour( f3_arg0, f3_arg1 ) + PushAndPopsTable[f3_arg0] = PushAndPopsTable[f3_arg0] or {} + PushAndPopsTable[f3_arg0].popFunc = f3_arg1 or PushAndPopsTable[f3_arg0].popFunc +end + +function ResetAntiSpam( f4_arg0 ) + f4_arg0.antiSpam = { + lastOpenedMenu = 0, + countOpenedMenusRecently = 0, + openMenuDelay = 0 + } +end + +function ShouldDelayAgainstSpam( f5_arg0 ) + if Engine.InFrontend() or not Engine.IsMultiplayer() then + return false + end + local f5_local0 = f5_arg0.flowManager.antiSpam + local f5_local1 = Engine.GetMilliseconds() + if f5_local1 - f5_local0.lastOpenedMenu > 1000 then + f5_local0.countOpenedMenusRecently = 0 + f5_local0.openMenuDelay = 0 + elseif f5_local0.countOpenedMenusRecently <= 3 then + f5_local0.openMenuDelay = 200 + else + f5_local0.openMenuDelay = 750 + end + return f5_local1 - f5_local0.lastOpenedMenu < f5_local0.openMenuDelay +end + +function tryAddMouseCursor( f6_arg0 ) + if Engine.UsesMouseCursor() and not f6_arg0:getChildById( "mouse_cursor" ) then + f6_arg0:addElement( LUI.UIMouseCursor.new( { + material = RegisterMaterial( "ui_cursor" ) + } ) ) + end +end + +function GetMenuBuildProps( f7_arg0, f7_arg1 ) + local f7_local0 = {} + if f7_arg0.menuInfoData[f7_arg1] and f7_arg0.menuInfoData[f7_arg1].buildData then + f7_local0 = f7_arg0.menuInfoData[f7_arg1].buildData + end + f7_local0.exclusiveController = f7_arg1.exclusiveControllerIndex + return f7_local0 +end + +function SetMenuBuildProps( f8_arg0, f8_arg1, f8_arg2 ) + f8_arg0.menuInfoData[f8_arg1] = f8_arg0.menuInfoData[f8_arg1] or {} + f8_arg0.menuInfoData[f8_arg1].buildData = f8_arg2 +end + +function GetMenuScopedData( f9_arg0, f9_arg1 ) + if not f9_arg0.menuInfoData[f9_arg1] then + f9_arg0.menuInfoData[f9_arg1] = {} + end + if not f9_arg0.menuInfoData[f9_arg1].scopedData then + f9_arg0.menuInfoData[f9_arg1].scopedData = {} + end + return f9_arg0.menuInfoData[f9_arg1].scopedData +end + +function GetMenuScopedDataFromElement( f10_arg0 ) + if f10_arg0._scoped then + return f10_arg0._scoped + else + local f10_local0 = f10_arg0:getParent() + if f10_local0 then + return GetMenuScopedDataFromElement( f10_local0 ) + else + DebugPrint( "WARNING: could not find scoped data for supplied menu element. This is expected if you've just hit LUI Reload, otherwise not so much." ) + return {} + end + end +end + +function GetMenuScopedDataByMenuName( f11_arg0 ) + local f11_local0 = Engine.GetLuiRoot() + f11_local0 = f11_local0.flowManager + for f11_local1 = #f11_local0.menuInfoStack, 1, -1 do + local f11_local4 = f11_local0.menuInfoStack[f11_local1] + if f11_local4.name == f11_arg0 then + return f11_local0:GetMenuScopedData( f11_local4 ) + end + end + if f11_arg0 then + DebugPrint( "WARNING: could not find scoped data for menu named " .. f11_arg0 .. ". This is expected if you've just hit LUI Reload, otherwise not so much." ) + end + return {} +end + +function IsTopSignInMenu( f12_arg0 ) + local f12_local0 = false + if not LUI.UIRoot.IsButtonInputBlocked( f12_arg0 ) then + local f12_local1 = f12_arg0.flowManager + if f12_local1.menuInfoStack then + local f12_local2 = f12_local1.menuInfoStack[#f12_local1.menuInfoStack] + if f12_local2 and f12_local2.menu and f12_local2.menu.isSignInMenu then + local f12_local3 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_local2.menu ) + if f12_local3 and f12_local3.focusedPage and f12_local3.focusedPage > 2 then + + else + f12_local0 = true + end + end + end + end + return f12_local0 +end + +function PushMenuInfo( f13_arg0, f13_arg1, f13_arg2 ) + if f13_arg1.isModal or #f13_arg0.menuInfoStack == 0 then + table.insert( f13_arg0.menuInfoStack, f13_arg1 ) + else + local f13_local0 = #f13_arg0.menuInfoStack + 1 + while f13_local0 > 1 and f13_arg0.menuInfoStack[f13_local0 - 1].isModal do + f13_local0 = f13_local0 - 1 + end + if f13_arg2 then + f13_local0 = math.max( 1, f13_local0 - 1 ) + end + table.insert( f13_arg0.menuInfoStack, f13_local0, f13_arg1 ) + end + if Engine.InFrontend() and #f13_arg0.menuInfoStack == 1 then + PersistentBackground.Init() + end + if PushAndPopsTable[f13_arg1.name] and PushAndPopsTable[f13_arg1.name].pushFunc then + PushAndPopsTable[f13_arg1.name].pushFunc() + end + if f13_arg0.debug then + f13_arg0:printStack() + end +end + +function PopMenuInfo( f14_arg0, f14_arg1 ) + local f14_local0 = nil + local f14_local1 = #f14_arg0.menuInfoStack + while f14_local1 >= 1 and (not (f14_arg1 or not f14_arg0.menuInfoStack[f14_local1].isModal) or f14_arg1 and f14_arg0.menuInfoStack[f14_local1] ~= f14_arg1) do + f14_local1 = f14_local1 - 1 + end + if f14_local1 >= 1 then + f14_local0 = f14_arg0.menuInfoStack[f14_local1] + if f14_local0 then + if PushAndPopsTable[f14_local0.name] and PushAndPopsTable[f14_local0.name].popFunc then + PushAndPopsTable[f14_local0.name].popFunc() + end + table.remove( f14_arg0.menuInfoStack, f14_local1 ) + end + end + if f14_local0 and #f14_arg0.menuInfoStack == 0 then + local f14_local2 = Engine.GetLuiRoot() + f14_local2:processEvent( { + name = "empty_menu_stack" + } ) + if Engine.IsAliensMode() then + ResetAntiSpam( f14_arg0 ) + else + f14_arg0.antiSpam.lastOpenedMenu = Engine.GetMilliseconds() + end + end + if f14_arg0.debug then + f14_arg0:printStack() + end + return f14_local0 +end + +function GetTopMenuInfo( f15_arg0 ) + local f15_local0 = nil + local f15_local1 = #f15_arg0 + while 1 <= f15_local1 and f15_arg0[f15_local1].isModal do + f15_local1 = f15_local1 - 1 + end + if 1 <= f15_local1 then + f15_local0 = f15_arg0[f15_local1] + end + return f15_local0 +end + +f0_local0 = function ( f16_arg0 ) + local f16_local0 = false + local f16_local1 = f16_arg0[#f16_arg0] + if f16_local1 and f16_local1.isModal then + f16_local0 = true + end + return f16_local0 +end + +function IsTopMenuModal() + local f17_local0 = Engine.GetLuiRoot() + if not f17_local0 then + return false + else + return f0_local0( f17_local0.flowManager.menuInfoStack ) + end +end + +function IsElementAChildOf( f18_arg0, f18_arg1 ) + if not f18_arg0 or not f18_arg1 then + return false + end + while f18_arg0 do + if f18_arg0 == f18_arg1 then + return true + end + f18_arg0 = f18_arg0:getParent() + end + return false +end + +function CloseMenuInfo( f19_arg0, f19_arg1, f19_arg2 ) + if f19_arg1.menu then + if not f19_arg2 then + f19_arg1.menu:processEvent( { + name = "lose_focus" + } ) + f19_arg1.menu:processEvent( { + name = "menu_close", + dispatchChildren = true, + controller = f19_arg1.exclusiveControllerIndex + } ) + end + f19_arg1.menu:clearSavedState() + f19_arg1.menu:closeTree() + f19_arg1.menu:close() + f19_arg1.menu = nil + end +end + +function RestoreMenuInfo( f20_arg0, f20_arg1, f20_arg2, f20_arg3 ) + local f20_local0 = false + if not f20_arg1.menu then + LUI.ActiveScoped = f20_arg0:GetMenuScopedData( f20_arg1 ) + f20_arg1.menu = LUI.MenuBuilder.buildMenu( f20_arg1.name, f20_arg0:GetMenuBuildProps( f20_arg1 ) ) + tryAddMouseCursor( f20_arg2 ) + f20_arg0.menuRoot:addElement( f20_arg1.menu ) + f20_arg1.menu:processEvent( { + name = "menu_create", + dispatchChildren = true, + controller = f20_arg1.exclusiveControllerIndex + } ) + f20_local0 = true + LUI.ActiveScoped = nil + end + if not f0_local0( f20_arg0.menuInfoStack ) then + if f20_arg3 then + f20_arg1.menu:processEvent( { + name = "popup_inactive", + dispatchChildren = true + } ) + end + local f20_local1, f20_local2 = f20_arg1.menu:restoreState() + if not f20_local1 or f20_local2 == 0 then + DebugPrint( "LUI Warning: no saved state found for menu " .. f20_arg1.name ) + f20_arg1.menu:processEvent( { + name = "gain_focus" + } ) + end + elseif f20_local0 then + f20_arg1.menu:processEvent( { + name = "popup_active", + dispatchChildren = true + } ) + end + return f20_arg1.menu +end + +function CloseAllModalMenus( f21_arg0 ) + for f21_local0 = #f21_arg0.menuInfoStack, 1, -1 do + local f21_local3 = f21_arg0.menuInfoStack[f21_local0] + if f21_local3.menu and f21_local3.isModal then + f21_arg0:CloseMenuInfo( f21_local3 ) + f21_arg0:PopMenuInfo( f21_local3 ) + end + end +end + +function CloseVisibleInStack( f22_arg0, f22_arg1 ) + local f22_local0 = true + for f22_local1 = #f22_arg0.menuInfoStack, 1, -1 do + local f22_local4 = f22_arg0.menuInfoStack[f22_local1] + if f22_local4.menu and not f22_local4.isModal then + if f22_local0 then + if f22_arg1 then + f22_local4.menu:clearSavedState() + else + f22_local4.menu:saveState() + end + f22_local4.menu:processEvent( { + name = "lose_focus" + } ) + end + f22_local4.menu:processEvent( { + name = "menu_close", + dispatchChildren = true, + controller = f22_local4.exclusiveControllerIndex + } ) + f22_local4.menu:closeTree() + f22_local4.menu:close() + f22_local4.menu = nil + f22_local0 = false + end + end +end + +f0_local1 = function ( f23_arg0, f23_arg1, f23_arg2 ) + local f23_local0 = { + name = f23_arg0, + menu = f23_arg1, + isOldMenu = f23_arg2 + } + setmetatable( f23_local0, { + __mode = "v" + } ) + return f23_local0 +end + +function printStack( f24_arg0 ) + DebugPrint( "----MENU STACK TOP----" ) + for f24_local0 = #f24_arg0.menuInfoStack, 1, -1 do + local f24_local3 = f24_arg0.menuInfoStack[f24_local0] + DebugPrint( f24_local0 .. ") " .. f24_local3.name .. " (" .. (f24_local3.menu and "Built" or "Not built") .. (f24_local3.isOldMenu and ", old menu" or "") .. ")" ) + end + DebugPrint( "---MENU STACK BOTTOM---" ) +end + +function setupRoot( f25_arg0, f25_arg1 ) + f25_arg0.menuRoot = f25_arg1 + f25_arg0.menuRoot = LUI.UIElement.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true, + left = 0, + top = 0, + right = 0, + bottom = 0 + } ) + if not Engine.UsingSplitscreenUpscaling() then + f25_arg0.menuRoot:setupLetterboxElement() + end + if f25_arg1 == LUI.primaryRoot then + f25_arg0.menuRoot:setUseStencil( true ) + end + f25_arg0.menuRoot:setPriority( LUI.UIRoot.childPriorities.menuRoot ) + f25_arg1:addElement( f25_arg0.menuRoot ) + for f25_local3, f25_local4 in pairs( m_flowEvents ) do + f25_arg1:registerEventHandler( f25_local3, f25_local4 ) + end +end + +function RequestOldMenu( f26_arg0, f26_arg1, f26_arg2, f26_arg3 ) + local f26_local0 = { + name = "openOldMenu", + menu = f26_arg1, + replaceTop = f26_arg2, + controller = f26_arg3 + } + local f26_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f26_local1, true, "RequestOldMenu" ) + LUI.UIRoot.ProcessEvent( f26_local1, f26_local0 ) +end + +function RequestAddMenu( f27_arg0, f27_arg1, f27_arg2, f27_arg3, f27_arg4, f27_arg5 ) + local f27_local0 = { + name = "addmenu", + menu = f27_arg1, + exclusiveController = f27_arg2, + controller = f27_arg3, + replaceTop = f27_arg4, + data = f27_arg5 + } + local f27_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f27_local1, true, "RequestAddMenu" ) + LUI.UIRoot.ProcessEvent( f27_local1, f27_local0 ) +end + +function RequestPopupMenu( f28_arg0, f28_arg1, f28_arg2, f28_arg3, f28_arg4, f28_arg5, f28_arg6, f28_arg7, f28_arg8 ) + local f28_local0 = { + name = "popupmenu", + menu = f28_arg1, + exclusiveController = f28_arg2, + controller = f28_arg3, + replaceTop = f28_arg4, + data = f28_arg5 + } + if f28_arg8 ~= nil then + f28_local0.immediate = f28_arg8 + else + f28_local0.immediate = true + end + f28_local0.isModal = f28_arg7 + local f28_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f28_local1, true, "RequestPopupMenu " .. f28_arg1 ) + LUI.UIRoot.ProcessEvent( f28_local1, f28_local0 ) +end + +function RequestLeaveMenu( f29_arg0, f29_arg1 ) + local f29_local0 = { + name = "leavemenu", + element = f29_arg0, + immediate = f29_arg1 + } + local f29_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f29_local1, true, "RequestLeaveMenu" ) + LUI.UIRoot.ProcessEvent( f29_local1, f29_local0 ) +end + +function RequestLeaveMenuByName( f30_arg0 ) + local f30_local0 = { + name = "leavemenu", + menu = f30_arg0 + } + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), true, "RequestLeaveMenuByName" ) + local f30_local1 = Engine.GetLuiRoot() + f30_local1:processEvent( f30_local0 ) +end + +function RequestRestoreMenu( f31_arg0, f31_arg1, f31_arg2, f31_arg3, f31_arg4 ) + local f31_local0 = { + name = "restoreMenu", + menu = f31_arg1, + immediate = true, + replaceTop = f31_arg4, + exclusiveController = f31_arg2, + controller = f31_arg3 + } + local f31_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f31_local1, true, "RequestRestoreMenu" ) + LUI.UIRoot.ProcessEvent( f31_local1, f31_local0 ) +end + +function RequestCloseAllMenus( f32_arg0, f32_arg1 ) + LUI.UIRoot.ProcessEvent( Engine.GetLuiRoot(), { + name = "closeallmenus", + menu = f32_arg1 + } ) +end + +function RequestSetStack( f33_arg0, f33_arg1 ) + LUI.UIRoot.ProcessEvent( Engine.GetLuiRoot(), { + name = "setStack", + stackData = f33_arg1, + immediate = true + } ) +end + +function RequestAddMenuAndSetStack( f34_arg0, f34_arg1, f34_arg2, f34_arg3, f34_arg4, f34_arg5, f34_arg6 ) + local f34_local0 = { + name = "addmenu_setstack", + menu = f34_arg1, + exclusiveController = f34_arg2, + controller = f34_arg3, + replaceTop = f34_arg4, + data = f34_arg5, + stackData = f34_arg6 + } + local f34_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f34_local1, true, "RequestAddMenuAndSetStack" ) + LUI.UIRoot.ProcessEvent( f34_local1, f34_local0 ) +end + +function openOldMenuHandler( f35_arg0, f35_arg1 ) + f35_arg0.flowManager:openOldMenu( f35_arg1, f35_arg0 ) + LUI.UIRoot.BlockButtonInput( f35_arg0, false, "openOldMenu" ) +end + +function openOldMenu( f36_arg0, f36_arg1, f36_arg2 ) + local f36_local0 = f36_arg1.menu + f36_arg0:CloseAllModalMenus() + local f36_local1 = GetTopMenuInfo( f36_arg0.menuInfoStack ) + local self = LUI.UIElement.new() + local f36_local3 = f0_local1( f36_local0, self, true ) + f36_arg0:CloseVisibleInStack( f36_arg1.replaceTop ) + local f36_local4 = f36_arg2:getChildById( "mouse_cursor" ) + if f36_local4 then + f36_local4:close() + end + f36_arg0.menuRoot:addElement( self ) + if f36_arg1.replaceTop then + f36_arg0:PopMenuInfo() + end + f36_arg0:PushMenuInfo( f36_local3 ) + Engine.SetLuiInUse( false ) + Engine.OpenOldMenu( f36_local0, f36_arg1.controller, f36_arg1.ignorePriority ) + return f36_local3.menu +end + +function closeAllMenusHandler( f37_arg0, f37_arg1 ) + f37_arg0.flowManager:closeAllMenus( f37_arg0, f37_arg1 ) +end + +function closeAllMenus( f38_arg0, f38_arg1, f38_arg2 ) + Engine.SetLuiInUse( false ) + for f38_local0 = #f38_arg0.menuInfoStack, 1, -1 do + local f38_local3 = f38_arg0.menuInfoStack[f38_local0] + f38_arg0:CloseMenuInfo( f38_local3, true ) + f38_arg0:PopMenuInfo( f38_local3 ) + end + local f38_local0 = f38_arg1:getChildById( "mouse_cursor" ) + if f38_local0 then + f38_local0:close() + end + f38_arg0.menuInfoStack = {} +end + +function IsInStack( f39_arg0, f39_arg1 ) + local f39_local0 = false + for f39_local4, f39_local5 in ipairs( f39_arg0.menuInfoStack ) do + if f39_local5.name == f39_arg1 and not f39_local5.isOldMenu then + f39_local0 = true + break + end + end + return f39_local0 +end + +function AnyActiveMenusInStack( f40_arg0 ) + local f40_local0 = f40_arg0.flowManager + if f40_local0.menuInfoStack then + for f40_local4, f40_local5 in ipairs( f40_local0.menuInfoStack ) do + if f40_local5.menu ~= nil then + return true + end + end + end + return false +end + +function IsMenuOpenAndVisible( f41_arg0, f41_arg1 ) + local f41_local0 = f41_arg0.flowManager + if f41_local0.menuInfoStack then + for f41_local4, f41_local5 in ipairs( f41_local0.menuInfoStack ) do + if f41_local5.name == f41_arg1 and f41_local5.menu ~= nil then + return true + end + end + end + return false +end + +function IsMenuInStack( f42_arg0, f42_arg1 ) + local f42_local0 = f42_arg0.flowManager + if f42_local0.menuInfoStack then + for f42_local4, f42_local5 in ipairs( f42_local0.menuInfoStack ) do + if f42_local5.name == f42_arg1 then + return true + end + end + end + return false +end + +function IsMenuTopmost( f43_arg0, f43_arg1 ) + local f43_local0 = f43_arg0.flowManager + if f43_local0.menuInfoStack then + local f43_local1 = f43_local0.menuInfoStack[#f43_local0.menuInfoStack] + if f43_local1 ~= nil and f43_local1.name == f43_arg1 then + return true + end + end + return false +end + +function GetTopOpenAndVisibleMenuName() + local f44_local0 = nil + local f44_local1 = Engine.GetLuiRoot() + if f44_local1 then + local f44_local2 = f44_local1.flowManager + if f44_local2.menuInfoStack then + for f44_local6, f44_local7 in ipairs( f44_local2.menuInfoStack ) do + if f44_local7.name and f44_local7.menu and not f44_local7.isModal then + f44_local0 = f44_local7.name + end + end + end + end + return f44_local0 +end + +function restoreMenuHandler( f45_arg0, f45_arg1 ) + f45_arg0.flowManager:restoreMenu( f45_arg1, f45_arg0 ) + LUI.UIRoot.BlockButtonInput( f45_arg0, false, "restoreMenu" ) +end + +function restoreMenu( f46_arg0, f46_arg1, f46_arg2 ) + local f46_local0 = f46_arg1.menu + Engine.SetLuiInUse( true ) + local f46_local1 = nil + if not IsInStack( f46_arg0, f46_local0 ) then + return addMenu( f46_arg0, f46_arg1, f46_arg2 ) + end + local f46_local2 = GetTopMenuInfo( f46_arg0.menuInfoStack ) + if f46_local2.name == f46_local0 then + return f46_local2.menu + end + local f46_local3 = nil + local f46_local4 = false + for f46_local5 = #f46_arg0.menuInfoStack, 1, -1 do + local f46_local8 = f46_arg0.menuInfoStack[f46_local5] + if f46_local8.name ~= f46_local0 then + + else + f46_local3 = f46_local8 + break + end + if not f46_local8.isModal then + if f46_local8.isPopup then + f46_local4 = true + end + f46_arg0:CloseMenuInfo( f46_local8 ) + f46_arg0:PopMenuInfo( f46_arg0.menuInfoStack[f46_local5] ) + end + end + assert( f46_local3 ) + return f46_arg0:RestoreMenuInfo( f46_local3, f46_arg2, f46_local4 ) +end + +function addMenuHandler( f47_arg0, f47_arg1 ) + if ShouldDelayAgainstSpam( f47_arg0 ) and f47_arg1.menu ~= "mp_pause_menu" then + LUI.UIRoot.ProcessEvent( f47_arg0, f47_arg1 ) + else + local f47_local0 = f47_arg0.flowManager.antiSpam + f47_local0.lastOpenedMenu = Engine.GetMilliseconds() + f47_local0.countOpenedMenusRecently = f47_local0.countOpenedMenusRecently + 1 + f47_arg0.flowManager:addMenu( f47_arg1, f47_arg0 ) + LUI.UIRoot.BlockButtonInput( f47_arg0, false, "addMenu" ) + end +end + +function addMenuAndSetStackHandler( f48_arg0, f48_arg1 ) + f48_arg0.flowManager:addMenu( f48_arg1, f48_arg0 ) + f48_arg0.flowManager:setStack( f48_arg0, f48_arg1 ) + LUI.UIRoot.BlockButtonInput( f48_arg0, false, "addMenu_setStack" ) +end + +function addMenu( f49_arg0, f49_arg1, f49_arg2 ) + local f49_local0 = f49_arg1.menu + if IsMenuOpenAndVisible( f49_arg2, f49_local0 ) then + return + end + Engine.SetLuiInUse( true ) + local f49_local1 = Engine.GetBytesFree() + local f49_local2 = nil + if f49_arg1.exclusiveController then + DebugPrint( "Setting exclusiveControllerIndex to " .. tostring( f49_arg1.controller ) ) + f49_local2 = f49_arg1.controller + end + f49_arg0:CloseVisibleInStack( f49_arg1.replaceTop ) + local f49_local3 = f0_local1( f49_local0 ) + f49_arg0:SetMenuBuildProps( f49_local3, f49_arg1.data ) + f49_local3.exclusiveControllerIndex = f49_local2 + if f49_arg1.replaceTop then + f49_arg0:PopMenuInfo() + end + local f49_local4 = f49_arg0:GetMenuScopedData( f49_local3 ) + local f49_local5 = f49_arg0:GetMenuBuildProps( f49_local3 ) + if f49_local2 then + f49_local4.exclusiveControllerIndex = f49_local2 + end + for f49_local9, f49_local10 in pairs( f49_local5 ) do + f49_local4[f49_local9] = f49_local10 + end + LUI.ActiveScoped = f49_local4 + f49_arg0:PushMenuInfo( f49_local3 ) + f49_local6 = LUI.MenuBuilder.buildMenu( f49_local0, f49_local5 ) + assert( f49_local6, "Could not build " .. f49_local0 ) + f49_local3.menu = f49_local6 + f49_arg0.menuRoot:addElement( f49_local6 ) + tryAddMouseCursor( f49_arg2 ) + f49_local6:processEvent( { + name = "update_navigation", + dispatchChildren = true + } ) + f49_local6:processEvent( { + name = "menu_create", + dispatchChildren = true, + controller = f49_local2 + } ) + if not f0_local0( f49_arg0.menuInfoStack ) then + if GetTopMenuInfo( f49_arg0.menuInfoStack ) == f49_local3 then + f49_local6:processEvent( { + name = "gain_focus", + focusType = FocusType.MenuFlow + } ) + end + elseif not f49_local3.isModal then + f49_local6:processEvent( { + name = "popup_active", + dispatchChildren = true + } ) + end + f49_local7 = Engine.GetBytesFree() + if not Engine.BBPrint( "lua_menu_info", "menu_name %s memory_delta_bytes %d init_free_bytes %d post_free_bytes %d in_game %d completed_menu %d", f49_local0, f49_local7 - f49_local1, f49_local1, f49_local7, Engine.InFrontend(), true ) then + DebugPrint( "Failed to write to blackbox" ) + end + LUI.ActiveScoped = nil + return f49_local3.menu +end + +function popupMenuHandler( f50_arg0, f50_arg1 ) + f50_arg0.flowManager:popupMenu( f50_arg1, f50_arg0 ) + LUI.UIRoot.BlockButtonInput( f50_arg0, false, "popupMenu " .. f50_arg1.menu ) +end + +function popupMenu( f51_arg0, f51_arg1, f51_arg2 ) + local f51_local0 = f51_arg1.menu + if IsMenuOpenAndVisible( f51_arg2, f51_local0 ) then + return + end + Engine.SetLuiInUse( true ) + local f51_local1 = Engine.GetBytesFree() + local f51_local2 = f51_arg0.menuInfoStack[#f51_arg0.menuInfoStack] + local f51_local3 = nil + if f51_arg1.exclusiveController then + f51_local3 = f51_arg1.controller + end + local f51_local4 = f0_local1( f51_local0 ) + f51_arg0:SetMenuBuildProps( f51_local4, f51_arg1.data ) + f51_local4.exclusiveControllerIndex = f51_local3 + if f51_arg1.isModal then + f51_local4.isModal = true + end + f51_local4.isPopup = true + local f51_local5 = f51_arg0:GetMenuScopedData( f51_local4 ) + local f51_local6 = f51_arg0:GetMenuBuildProps( f51_local4 ) + if f51_local3 then + f51_local5.exclusiveControllerIndex = f51_local3 + end + for f51_local10, f51_local11 in pairs( f51_local6 ) do + f51_local5[f51_local10] = f51_local11 + end + LUI.ActiveScoped = f51_local5 + if f51_local2 then + if f51_arg1.replaceTop then + assert( f51_local4.isModal ~= true, "Replacing top with a modal dialog is not supported!" ) + f51_arg0:CloseMenuInfo( f51_local2 ) + elseif not f51_local2.isModal then + if f51_local2.menu ~= nil then + f51_local2.menu:saveState() + f51_local2.menu:processEvent( { + name = "lose_focus" + } ) + f51_local2.menu:processEvent( { + name = "popup_active", + dispatchChildren = true, + popup_name = f51_local0 + } ) + end + else + for f51_local7 = #f51_arg0.menuInfoStack, 1, -1 do + if not f51_arg0.menuInfoStack[f51_local7].isPopup and f51_arg0.menuInfoStack[f51_local7].menu ~= nil then + f51_arg0.menuInfoStack[f51_local7].menu:processEvent( { + name = "popup_active", + dispatchChildren = true, + popup_name = f51_local0 + } ) + break + end + end + end + end + if f51_arg1.replaceTop then + assert( f51_local4.isModal ~= true, "Replacing top with a modal dialog is not supported!" ) + f51_arg0.menuInfoStack[#f51_arg0.menuInfoStack] = nil + end + f51_arg0:PushMenuInfo( f51_local4 ) + f51_local7 = LUI.MenuBuilder.buildMenu( f51_local0, f51_local6 ) + assert( f51_local7, "Could not build " .. f51_local0 ) + if f51_arg1.isModal then + f51_local7:setPriority( LUI.FlowManager.modal_priority ) + end + f51_local4.menu = f51_local7 + f51_arg0.menuRoot:addElement( f51_local7 ) + f51_local7:processEvent( { + name = "update_navigation", + dispatchChildren = true + } ) + f51_local7:processEvent( { + name = "menu_create", + dispatchChildren = true, + controller = f51_local3 + } ) + if not f0_local0( f51_arg0.menuInfoStack ) then + if GetTopMenuInfo( f51_arg0.menuInfoStack ) == f51_local4 then + f51_local7:processEvent( { + name = "gain_focus" + } ) + end + elseif not f51_local4.isModal then + f51_local7:processEvent( { + name = "popup_active", + dispatchChildren = true + } ) + end + f51_local8 = Engine.GetBytesFree() + if not Engine.BBPrint( "lua_menu_info", "menu_name %s memory_delta_bytes %d init_free_bytes %d post_free_bytes %d in_game %d completed_menu %d", f51_local0, f51_local8 - f51_local1, f51_local1, f51_local8, Engine.InFrontend(), true ) then + DebugPrint( "Failed to write to blackbox" ) + end + LUI.ActiveScoped = nil + return f51_local4.menu +end + +function leaveMenuHandler( f52_arg0, f52_arg1 ) + if ShouldDelayAgainstSpam( f52_arg0 ) then + LUI.UIRoot.ProcessEvent( f52_arg0, f52_arg1 ) + else + local f52_local0 = f52_arg0.flowManager.antiSpam + f52_local0.lastOpenedMenu = Engine.GetMilliseconds() + f52_local0.countOpenedMenusRecently = f52_local0.countOpenedMenusRecently + 1 + f52_arg0.flowManager:leaveMenu( f52_arg0, f52_arg1 ) + LUI.UIRoot.BlockButtonInput( f52_arg0, false, "leaveMenu" ) + end +end + +function leaveMenuByNameHandler( f53_arg0, f53_arg1 ) + RequestLeaveMenuByName( f53_arg1.menu ) + LUI.UIRoot.BlockButtonInput( f53_arg0, false, "leaveMenuByName" ) +end + +function leaveMenu( f54_arg0, f54_arg1, f54_arg2 ) + local f54_local0 = nil + if f54_arg2.element then + for f54_local1 = #f54_arg0.menuInfoStack, 1, -1 do + local f54_local4 = f54_arg0.menuInfoStack[f54_local1] + if f54_local4.menu and IsElementAChildOf( f54_arg2.element, f54_local4.menu ) then + f54_local0 = f54_local4 + break + end + end + if not f54_local0 then + DebugPrint( "Warning: LeaveMenu was called with an element ref, but that element was not found, it is likely the menu was already closed." ) + return nil + end + end + if not f54_local0 and f54_arg2.menu then + for f54_local1 = #f54_arg0.menuInfoStack, 1, -1 do + local f54_local4 = f54_arg0.menuInfoStack[f54_local1] + if f54_local4.name == f54_arg2.menu then + f54_local0 = f54_local4 + break + end + end + if not f54_local0 then + DebugPrint( "Warning: LeaveMenu was called with a menu name, but that menu was not found in the stack, it is likely the menu was already closed: " .. f54_arg2.menu ) + return nil + end + end + if not f54_local0 and not f54_arg2.menu and not f54_arg2.element then + f54_local0 = GetTopMenuInfo( f54_arg0.menuInfoStack ) + end + if not f54_local0 then + DebugPrint( "WARNING: LeaveMenu failed because the requested menu could not be found or the menu stack is empty." ) + return + elseif f54_local0.menu then + f54_arg0:CloseMenuInfo( f54_local0 ) + end + f54_arg0:PopMenuInfo( f54_local0 ) + if not f54_local0.isModal then + Engine.PlaySound( CoD.SFX.SelectBack ) + end + local f54_local1 = GetTopMenuInfo( f54_arg0.menuInfoStack ) + if Engine.InFrontend and Engine.InFrontend() then + assert( f54_local1, "LUI Error: No menu to back out to, stack is empty" ) + end + local f54_local2 = Engine.SetLuiInUse + local f54_local3 + if f54_local1 ~= nil then + f54_local3 = not f54_local1.isOldMenu + else + f54_local3 = false + end + f54_local2( f54_local3 ) + if f54_local1 then + if f54_local1.isOldMenu then + f54_local2 = f54_arg1:getChildById( "mouse_cursor" ) + if f54_local2 then + f54_local2:close() + end + else + return f54_arg0:RestoreMenuInfo( f54_local1, f54_arg1, f54_local0.isPopup ) + end + end + f54_local2 = f54_arg1:getChildById( "mouse_cursor" ) + if f54_local2 then + f54_local2:close() + end + return nil +end + +function setStackHandler( f55_arg0, f55_arg1 ) + f55_arg0.flowManager:setStack( f55_arg0, f55_arg1 ) +end + +function setStack( f56_arg0, f56_arg1, f56_arg2 ) + DebugPrint( "FlowManager: Rewriting menu stack " ) + local f56_local0 = GetTopMenuInfo( f56_arg0.menuInfoStack ) + if f56_arg0.debug then + local f56_local1 = "" + for f56_local6, f56_local7 in ipairs( f56_arg0.menuInfoStack ) do + local f56_local8 = f56_local1 + local f56_local5 + if f56_local6 > 1 then + f56_local5 = " > " + if not f56_local5 then + + else + f56_local1 = f56_local8 .. f56_local5 .. f56_local7.name + end + end + f56_local5 = "" + end + DebugPrint( " Current stack: " .. f56_local1 ) + f56_local2 = "" + for f56_local7, f56_local8 in ipairs( f56_arg2.stackData ) do + local f56_local5 = f56_local2 + local f56_local9 + if f56_local7 > 1 then + f56_local9 = " > " + if not f56_local9 then + + else + f56_local2 = f56_local5 .. f56_local9 .. f56_local8.name + end + end + f56_local9 = "" + end + DebugPrint( " Requesting: " .. f56_local2 .. " > " .. f56_local0.name ) + end + local f56_local1 = 0 + for f56_local6, f56_local7 in ipairs( f56_arg0.menuInfoStack ) do + if not (not f56_arg2.stackData[f56_local6] or f56_arg2.stackData[f56_local6].name ~= f56_local7.name) or f56_local6 == #f56_arg2.stackData + 1 and f56_local0.name == f56_local7.name then + f56_local1 = f56_local6 + end + end + for f56_local2 = #f56_arg0.menuInfoStack - 1, f56_local1 + 1, -1 do + if not f56_arg0.menuInfoStack[f56_local2 + 1] or not f56_arg0.menuInfoStack[f56_local2 + 1].isModal then + f56_arg0:CloseMenuInfo( f56_arg0.menuInfoStack[f56_local2] ) + f56_arg0:PopMenuInfo( f56_arg0.menuInfoStack[f56_local2] ) + end + end + for f56_local2 = f56_local1 + 1, #f56_arg2.stackData, 1 do + f56_local7 = f0_local1( f56_arg2.stackData[f56_local2].name ) + f56_arg0:SetMenuBuildProps( f56_local7, f56_arg2.stackData[f56_local2].data ) + f56_arg0:PushMenuInfo( f56_local7, true ) + end +end + +function CheckRestoreFocus( f57_arg0 ) + if f57_arg0.menuInfoStack[#f57_arg0.menuInfoStack] and f57_arg0.menuInfoStack[#f57_arg0.menuInfoStack].menu and not f57_arg0.menuInfoStack[#f57_arg0.menuInfoStack].menu:getFirstInFocus() then + DebugPrint( "FLowManager: No child in focus, trying to restore focus. This should probably only happen when using a mouse" ) + f57_arg0.menuInfoStack[#f57_arg0.menuInfoStack].menu:processEvent( { + name = "gain_focus" + } ) + end +end + +function SaveMenuStack( f58_arg0 ) + local f58_local0 = f58_arg0.flowManager + local f58_local1 = {} + if f58_local0.menuInfoStack then + for f58_local8, f58_local9 in ipairs( f58_local0.menuInfoStack ) do + local f58_local10 = {} + for f58_local5, f58_local6 in pairs( f58_local9 ) do + if f58_local5 == "menu" then + if f58_local6 then + f58_local10.menu = true + else + f58_local10.menu = false + goto basicblock_9: + end + end + f58_local10[f58_local5] = f58_local6 + end + if f58_local0.menuInfoData[f58_local9] and f58_local0.menuInfoData[f58_local9].scopedData then + DebugPrint( "WARNING: Menu scoped data lost during the debug luiReload process, UI may act inconsistent" ) + end + f58_local1[#f58_local1 + 1] = f58_local10 + end + end + return serialize.persist( {}, f58_local1 ) +end + +function RestoreMenuStack( f59_arg0, f59_arg1 ) + if f59_arg1 then + local f59_local0 = f59_arg0.flowManager + for f59_local7, f59_local8 in ipairs( serialize.unpersist( {}, f59_arg1 ) ) do + local f59_local9 = f0_local1() + for f59_local4, f59_local5 in pairs( f59_local8 ) do + if f59_local4 ~= "menu" then + f59_local9[f59_local4] = f59_local5 + end + end + f59_local0:PushMenuInfo( f59_local9, false ) + if f59_local8.menu then + if not f59_local8.isOldMenu then + LUI.ActiveScoped = f59_local0:GetMenuScopedData( f59_local9 ) + f59_local9.menu = LUI.MenuBuilder.buildMenu( f59_local8.name, f59_local0:GetMenuBuildProps( f59_local9 ) ) + f59_local0.menuRoot:addElement( f59_local9.menu ) + f59_local9.menu:processEvent( { + name = "update_navigation", + dispatchChildren = true + } ) + f59_local9.menu:processEvent( { + name = "menu_create", + dispatchChildren = true, + stackRestore = true, + controller = f59_local9.exclusiveControllerIndex + } ) + LUI.ActiveScoped = nil + else + Engine.SetLuiInUse( false ) + Engine.OpenOldMenu( f59_local8.name ) + end + end + end + f59_local1 = f59_local0.menuInfoStack[#f59_local0.menuInfoStack] + if f59_local1 and f59_local1.menu then + Engine.SetLuiInUse( true ) + f59_local1.menu:processEvent( { + name = "gain_focus" + } ) + tryAddMouseCursor( f59_arg0 ) + end + end +end + +m_flowEvents = { + addmenu = addMenuHandler, + addmenu_setstack = addMenuAndSetStackHandler, + openOldMenu = openOldMenuHandler, + popupmenu = popupMenuHandler, + leavemenu = leaveMenuHandler, + leavemenubyname = leaveMenuByNameHandler, + restoreMenu = restoreMenuHandler, + closeallmenus = closeAllMenusHandler, + setStack = setStackHandler +} +LockTable( _M ) diff --git a/lui/gamepadcontrols.dec.lua b/lui/gamepadcontrols.dec.lua new file mode 100644 index 0000000..69360cf --- /dev/null +++ b/lui/gamepadcontrols.dec.lua @@ -0,0 +1,405 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GamepadDisabledFunc( f1_arg0, f1_arg1 ) + return not Engine.GetProfileData( "gpadEnabled" ) +end + +function OptionsWindowRefresh( f2_arg0, f2_arg1 ) + if f2_arg1.source_input == "button_action" or f2_arg1.source_input == "key_bound" or f2_arg1.source_input == "button_right" or f2_arg1.source_input == "button_left" then + f2_arg0:processEvent( { + name = "menu_refresh" + } ) + f2_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function SinglePlayerDisableFunction( f3_arg0, f3_arg1 ) + return not Engine.IsMultiplayer() +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function OptionFactoryProfileData( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5, f5_arg6 ) + local f5_local0 = Engine.GetProfileData( f5_arg0 ) + local f5_local1 = 1 + for f5_local5, f5_local6 in pairs( f5_arg3 ) do + if f5_local6.value == f5_local0 then + f5_local1 = f5_local5 + break + end + end + f5_local2 = function ( f6_arg0, f6_arg1 ) + Engine.ExecNow( f5_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + OptionsWindowTriggerRefresh( f6_arg0, f6_arg1 ) + if f5_arg6 and type( f5_arg6 ) == "function" then + f5_arg6( f6_arg0 ) + end + end + + f5_local3 = { + type = "UIGenericButton", + id = "option_" .. f5_arg0, + disabledFunc = f5_arg4 or function () + return false + end + + } + f5_local4 = { + variant = GenericButtonSettings.Variants.Select + } + if f5_arg5 then + local f5_local7 = f5_arg2 + end + f5_local4.button_text = f5_local7 or Engine.Localize( f5_arg2 ) + f5_local4.button_display_func = function ( f8_arg0, f8_arg1 ) + return Engine.Localize( f5_arg3[f5_local1].text ) + end + + f5_local4.button_left_func = function ( f9_arg0, f9_arg1 ) + f5_local1 = 1 + (#f5_arg3 + f5_local1 - 1 - 1) % #f5_arg3 + f5_local2( f9_arg0, f9_arg1 ) + end + + f5_local4.button_right_func = function ( f10_arg0, f10_arg1 ) + f5_local1 = 1 + (f5_local1 - 1 + 1) % #f5_arg3 + f5_local2( f10_arg0, f10_arg1 ) + end + + f5_local3.properties = f5_local4 + f5_local3.handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + return f5_local3 +end + +function SliderOptionFactory( f11_arg0, f11_arg1, f11_arg2, f11_arg3, f11_arg4, f11_arg5 ) + local f11_local0 = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + Engine.SetDvarFloat( f11_arg0, math.min( f12_arg1, math.max( f12_arg0, Engine.GetDvarFloat( f11_arg0 ) + f12_arg2 ) ) ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + OptionsWindowTriggerRefresh( f12_arg3, f12_arg4 ) + end + + return { + type = "UIGenericButton", + id = "options_" .. f11_arg0, + disabledFunc = f11_arg5 or function () + return false + end + , + properties = { + button_text = Engine.Localize( f11_arg1 ), + variant = GenericButtonSettings.Variants.Slider, + button_display_func = function ( f14_arg0, f14_arg1 ) + return (Engine.GetDvarFloat( f11_arg0 ) - f11_arg2) / (f11_arg3 - f11_arg2) + end + , + button_left_func = function ( f15_arg0, f15_arg1 ) + f11_local0( f11_arg2, f11_arg3, -f11_arg4, f15_arg0, f15_arg1 ) + end + , + button_right_func = function ( f16_arg0, f16_arg1 ) + f11_local0( f11_arg2, f11_arg3, f11_arg4, f16_arg0, f16_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + } +end + +function GetButtonsLayoutName() + local f17_local0 = Engine.GetProfileData( "gpadButtonsConfig" ) + if f17_local0 == "buttons_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f17_local0 == "buttons_tactical" then + return Engine.Localize( "@MENU_TACTICAL" ) + elseif f17_local0 == "buttons_lefty" then + return Engine.Localize( "@MENU_LEFTY" ) + elseif f17_local0 == "buttons_nomad" then + return Engine.Localize( "@MENU_NOMAD" ) + elseif f17_local0 == "buttons_nomad_tactical" then + return Engine.Localize( "@MENU_NOMAD_TACTICAL" ) + elseif f17_local0 == "buttons_default_alt" then + return Engine.Localize( "@MENU_DEFAULT_ALT" ) + elseif f17_local0 == "buttons_tactical_alt" then + return Engine.Localize( "@MENU_TACTICAL_ALT" ) + elseif f17_local0 == "buttons_lefty_alt" then + return Engine.Localize( "@MENU_LEFTY_ALT" ) + elseif f17_local0 == "buttons_nomad_alt" then + return Engine.Localize( "@MENU_NOMAD_ALT" ) + else + return Engine.Localize( "@MENU_NOMAD_TACTICAL_ALT" ) + end +end + +function ButtonsLayoutAction( f18_arg0, f18_arg1 ) + LUI.FlowManager.RequestAddMenu( f18_arg0, "buttons", true, f18_arg1.controller, false ) +end + +function GetSticksLayoutName() + local f19_local0 = Engine.GetProfileData( "gpadSticksConfig" ) + if f19_local0 == "thumbstick_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f19_local0 == "thumbstick_southpaw" then + return Engine.Localize( "@MENU_SOUTHPAW" ) + elseif f19_local0 == "thumbstick_legacy" then + return Engine.Localize( "@MENU_LEGACY" ) + elseif f19_local0 == "thumbstick_southpaw_ns" then + return Engine.Localize( "@MENU_SOUTHPAW_NS" ) + elseif f19_local0 == "thumbstick_legacysouthpaw_ns" then + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW_NS" ) + else + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW" ) + end +end + +function SticksLayoutAction( f20_arg0, f20_arg1 ) + LUI.FlowManager.RequestAddMenu( f20_arg0, "thumbstick", true, f20_arg1.controller, false ) +end + +function GetSensitivityText() + local f21_local0 = Engine.GetDvarFloat( "profileMenuOption_sensitivity" ) + if f21_local0 == 1 then + return Engine.Localize( "@MENU_LOW" ) .. " " .. f21_local0 + elseif f21_local0 == 3 then + return Engine.Localize( "@MENU_MEDIUM" ) .. " " .. f21_local0 + elseif f21_local0 == 7 then + return Engine.Localize( "@MENU_HIGH" ) .. " " .. f21_local0 + elseif f21_local0 == 13 then + return Engine.Localize( "@MENU_VERY_HIGH" ) .. " " .. f21_local0 + elseif f21_local0 == 20 then + return Engine.Localize( "@MENU_INSANE" ) .. " " .. f21_local0 + else + return f21_local0 .. "" + end +end + +function SensitivityChange( f22_arg0, f22_arg1 ) + Engine.SetDvarFloat( "profileMenuOption_sensitivity", math.min( 20, math.max( 1, Engine.GetDvarFloat( "profileMenuOption_sensitivity" ) + f22_arg1 ) ) ) + Engine.MenuDvarsFinish( f22_arg0 ) +end + +function OnToggleGPadEnabled( f23_arg0 ) + LUI.FlowManager.tryAddMouseCursor( Engine.GetLuiRoot() ) + Engine.Exec( "updategamerprofile" ) + f23_arg0:dispatchEventToRoot( { + name = "refresh_button_helper", + dispatchChildren = true + } ) +end + +function OptionsFeeder( f24_arg0 ) + local f24_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "gpadEnabled", "profile_toggleEnableGamepad", "LUA_MENU_GAMEPAD", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, nil, nil, OnToggleGPadEnabled ) + f24_local0[#f24_local0 + 1] = { + type = "UIGenericButton", + id = "stick_layout_button_id", + disabledFunc = GamepadDisabledFunc, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "MENU_THUMBSTICK_LAYOUT" ), + button_display_func = GetSticksLayoutName, + button_action_func = SticksLayoutAction + } + } + f24_local0[#f24_local0 + 1] = { + type = "UIGenericButton", + id = "buttons_layout_button_id", + disabledFunc = GamepadDisabledFunc, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "MENU_BUTTON_LAYOUT" ), + button_display_func = GetButtonsLayoutName, + button_action_func = ButtonsLayoutAction + } + } + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "invertedPitch", "profile_toggleInvertedPitch", "MENU_LOOK_INVERSION", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc ) + f24_local0[#f24_local0 + 1] = { + type = "UIGenericButton", + id = "sensitivity_button_id", + disabledFunc = GamepadDisabledFunc, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "MENU_LOOK_SENSITIVITY" ), + button_display_func = GetSensitivityText, + button_left_func = function ( f25_arg0, f25_arg1 ) + return SensitivityChange( f24_arg0.exclusiveController, -1 ) + end, + button_right_func = function ( f26_arg0, f26_arg1 ) + return SensitivityChange( f24_arg0.exclusiveController, 1 ) + end + } + } + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "rumble", "profile_toggleRumble", "MENU_CONTROLLER_VIBRATION", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc ) + if SinglePlayerDisableFunction() then + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "autoAim", "profile_toggleAutoAim", "MENU_AIM_ASSIST", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc ) + end + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "leanEnabled", "profile_toggleLean", "LUA_MENU_LEAN_TOGGLE", { + { + text = "@LUA_MENU_ENABLED", + value = true + }, + { + text = "@LUA_MENU_DISABLED", + value = false + } + }, GamepadDisabledFunc ) + if Engine.IsDevelopmentBuild() then + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "useDevKeyboard", "profile_toggleDevKeyboard", "DEBUG_KEYBOARD", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc, true ) + end + return f24_local0 +end + +function OptionsMainCreate( f27_arg0, f27_arg1 ) + f27_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function OptionsMainClose( f28_arg0, f28_arg1 ) + Engine.Exec( "updategamerprofile" ) +end + +function gamepad_controls_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = {} + } +end + +function gamepad_controls() + return { + type = "UIElement", + id = "gamepad_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose, + options_window_refresh = OptionsWindowRefresh + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_GAMEPAD" ) + } + }, + { + type = "gamepad_controls_vlist", + id = "gamepad_controls_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "gamepad_controls_vlist", gamepad_controls_vlist ) +LUI.MenuBuilder.registerDef( "gamepad_controls", gamepad_controls ) +LockTable( _M ) diff --git a/lui/gamex.dec.lua b/lui/gamex.dec.lua new file mode 100644 index 0000000..3c886e7 --- /dev/null +++ b/lui/gamex.dec.lua @@ -0,0 +1,288 @@ +if not GameX then + GameX = {} +end +GameX.GetPlayerOpposingTeam = function ( f1_arg0 ) + local f1_local0 = f1_arg0 + if not f1_local0 then + f1_local0 = Game.GetPlayerTeam() + if GameX.IsSpectatingNotOnTeam( f1_local0 ) then + f1_local0 = spectatorFakeTeam + end + end + local f1_local1 = otherTeamLookup[f1_local0] + if not f1_local1 then + f1_local1 = 0 + end + return f1_local1 +end + +GameX.gameModeIsFFA = function ( f2_arg0 ) + local f2_local0 = f2_arg0 or Engine.GetDvarString( "ui_gametype" ) + if f2_local0 == "dm" or f2_local0 == "sotf_ffa" or f2_local0 == "gun" or f2_local0 == "mugger" or f2_local0 == "adrn" or f2_local0 == "assn" or f2_local0 == "fo" or f2_local0 == "sna" then + return true + elseif f2_local0 == "cranked" then + return Engine.GetDvarInt( "scr_cranked_teambased" ) == 0 + else + return false + end +end + +GameX.GetTeamName = function ( f3_arg0 ) + local f3_local0 = { + "free", + "axis", + "allies" + } + return f3_local0[f3_arg0 + 1] +end + +GameX.GetFactionName = function ( f4_arg0 ) + local f4_local0 = { + "free", + "federation", + "ghosts" + } + return f4_local0[f4_arg0 + 1] +end + +GameX.IsSpectatingNotOnTeam = function ( f5_arg0 ) + local f5_local0 + if not (Game.IsSpectating() or Game.GetOmnvar( "ui_session_state" ) == "spectator") or (f5_arg0 or Game.GetPlayerTeam()) ~= Teams.spectator then + f5_local0 = false + else + f5_local0 = true + end + return f5_local0 +end + +GameX.IsHardcoreMode = function () + return Engine.GetDvarBool( "g_hardcore" ) +end + +GameX.IsRankedMatch = function () + return Engine.GetDvarBool( "onlinegame" ) and not Engine.GetDvarBool( "xblive_privatematch" ) +end + +GameX.IsOnlineMatch = function () + local f8_local0 = Engine.GetDvarBool( "onlinegame" ) + if not f8_local0 then + f8_local0 = Engine.GetDvarBool( "xblive_privatematch" ) + end + return f8_local0 +end + +GameX.GetGameMode = function () + return Engine.GetDvarString( "ui_gametype" ) +end + +GameX.GetNumPlayerSlotsForFinalScoreboard = function ( f10_arg0, f10_arg1 ) + local f10_local0 = GameX.IsRankedMatch() and Engine.GetDvarInt( "party_maxplayers" ) or 0 + local f10_local1 = Game.GetNumPlayersOnTeam( f10_arg0 ) + if GameX.gameModeIsFFA( f10_arg1 ) then + assert( f10_arg0 == Teams.free ) + return math.max( 1, math.max( f10_local1, f10_local0 ) ) + elseif f10_arg1 == "infect" then + if f10_arg0 == Teams.allies then + return math.max( 0, f10_local1 ) + else + local f10_local2 = Game.GetNumPlayersOnTeam( GameX.GetPlayerOpposingTeam( f10_arg0 ) ) + local f10_local3 = f10_local0 - f10_local2 + if f10_local1 + f10_local2 == 0 then + return 1 + else + return math.max( 0, math.max( f10_local1, f10_local3 ) ) + end + end + elseif f10_arg1 == "horde" then + if f10_arg0 == Teams.allies then + return math.max( 4, math.max( f10_local1, f10_local0 ) ) + else + return math.max( 0, f10_local1 ) + end + end + local f10_local2 = assert + local f10_local3 + if f10_arg0 ~= Teams.axis and f10_arg0 ~= Teams.allies then + f10_local3 = false + else + f10_local3 = true + end + f10_local2( f10_local3 ) + return math.max( 1, math.max( f10_local1, f10_local0 / 2 ) ) +end + +GameX.GetPlayerScoreInfoAtRankForGameMode = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3 ) + local f11_local0 = Game.GetPlayerScoreInfoAtRank( f11_arg0, f11_arg1 ) + if not f11_local0 then + return nil + end + local f11_local1 = 99 + local f11_local2 = 99 + if f11_arg2 == "horde" then + f11_local1 = 999 + f11_local2 = 999 + end + f11_local0.score = math.min( 9999, f11_local0.score ) + f11_local0.kills = math.min( f11_local1, f11_local0.kills ) + f11_local0.deaths = math.min( 99, f11_local0.deaths ) + f11_local0.assists = math.min( f11_local2, f11_local0.assists ) + f11_local0.prestige = f11_local0.prestige or 0 + if not (f11_arg2 ~= "dm" and (f11_arg2 ~= "cranked" or not GameX.gameModeIsFFA( f11_arg2 ))) or f11_arg2 == "sotf_ffa" then + local f11_local3 = Game.GetOmnvar( "ui_game_type_kill_value" ) + if not f11_local3 then + f11_local0.extrascore0 = 0 + else + f11_local0.extrascore0 = math.min( 9999, f11_local0.score * f11_local3 ) + end + elseif f11_arg2 == "horde" then + f11_local0.extrascore0 = math.min( 999, f11_local0.extrascore0 ) + elseif f11_arg2 == "infect" then + f11_local0.time = CoD.FormatInfectedTime( f11_local0.extrascore0, f11_arg3 ) + else + f11_local0.extrascore0 = math.min( 99, f11_local0.extrascore0 ) + end + return f11_local0 +end + +GameX.GetScreenDims = function () + local f12_local0 = {} + local f12_local1 = Engine.GetLuiRoot() + f12_local0 = f12_local1:getCurrentGlobalRect() + return f12_local0[3], f12_local0[4] +end + +GameX.GetScreenWidth = function () + local f13_local0 = {} + local f13_local1 = Engine.GetLuiRoot() + f13_local0 = f13_local1:getCurrentGlobalRect() + return f13_local0[3] +end + +GameX.GetScreenHeight = function () + local f14_local0 = {} + local f14_local1 = Engine.GetLuiRoot() + f14_local0 = f14_local1:getCurrentGlobalRect() + return f14_local0[4] +end + +GameX.GetSafeZoneSize = function ( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg0 or SliderBounds.HorzMargin.Min + local f15_local1 = f15_arg1 or SliderBounds.VertMargin.Min + local f15_local2, f15_local3 = GameX.GetScreenDims() + local f15_local4 = f15_local2 * (1 - f15_local0) / 2 + local f15_local5 = f15_local3 * (1 - f15_local1) / 2 + local f15_local6 = Engine.SplitscreenPlayerCount() + assert( f15_local6 <= MaxLocalClients ) + local f15_local7 = assert + local f15_local8 + if f15_local6 ~= 1 and f15_local6 ~= 2 then + f15_local8 = false + else + f15_local8 = true + end + f15_local7( f15_local8 ) + if f15_local6 == 2 then + f15_local5 = f15_local5 * 2 + f15_local7 = Engine.GetCurrentLocalClient() + assert( f15_local7 and f15_local7 < MaxLocalClients ) + if f15_local7 == 0 then + return f15_local4, f15_local5, -f15_local4, 0 + else + return f15_local4, 0, -f15_local4, -f15_local5 + end + else + return f15_local4, f15_local5, -f15_local4, -f15_local5 + end +end + +GameX.GetAdjustedSafeZoneSize = function () + return GameX.GetSafeZoneSize( Engine.GetDvarFloat( "safeArea_adjusted_horizontal" ), Engine.GetDvarFloat( "safeArea_adjusted_vertical" ) ) +end + +GameX.IsSplitscreen = function () + local f17_local0 = Engine.SplitscreenPlayerCount() + local f17_local1 = assert + local f17_local2 + if f17_local0 and f17_local0 > MaxLocalClients then + f17_local2 = false + else + f17_local2 = true + end + f17_local1( f17_local2 ) + return f17_local0 > 1 +end + +OptionState = { + Locked = false +} +GameX.IsOptionStateLocked = function () + return OptionState.Locked +end + +GameX.SetOptionState = function ( f19_arg0 ) + OptionState.Locked = f19_arg0 +end + +GameX.GetTeamNameOverride = function ( f20_arg0 ) + if not MLG.IsMLGSpectator() then + return nil + elseif MatchRules.IsUsingMatchRulesData() then + local f20_local0 = nil + if f20_arg0 == Teams.allies then + f20_local0 = "ghostsTeamName" + elseif f20_arg0 == Teams.axis then + f20_local0 = "fedTeamName" + end + local f20_local1 = MatchRules.GetData( "commonOption", f20_local0 ) + if f20_local1 and f20_local1 ~= "" then + return f20_local1 + end + end + return nil +end + +GameX.GetLocalizedTeamName = function ( f21_arg0 ) + if f21_arg0 ~= Teams.allies and f21_arg0 ~= Teams.axis then + return nil + else + local f21_local0 = GameX.GetTeamNameOverride( f21_arg0 ) + if f21_local0 and f21_local0 ~= "" then + return f21_local0 + elseif f21_arg0 == Teams.allies then + return Engine.Localize( "LUA_MENU_ALLIES_CAPS" ) + elseif f21_arg0 == Teams.axis then + return Engine.Localize( "LUA_MENU_AXIS_CAPS" ) + else + + end + end +end + +GameX.GetLocalizedTeamNameMixedCase = function ( f22_arg0 ) + if f22_arg0 ~= Teams.allies and f22_arg0 ~= Teams.axis then + return nil + else + local f22_local0 = GameX.GetTeamNameOverride( f22_arg0 ) + if f22_local0 and f22_local0 ~= "" then + return f22_local0 + elseif f22_arg0 == Teams.allies then + return Engine.Localize( "MP_GHOSTS_NAME" ) + elseif f22_arg0 == Teams.axis then + return Engine.Localize( "MP_FEDERATION_NAME" ) + else + + end + end +end + +GameX.UsesFakeLoadout = function () + local f23_local0 = GameX.GetGameMode() + local f23_local1 + if f23_local0 ~= "sotf" and f23_local0 ~= "sotf_ffa" and f23_local0 ~= "infect" and f23_local0 ~= "gun" and f23_local0 ~= "horde" then + f23_local1 = false + else + f23_local1 = true + end + return f23_local1 +end + diff --git a/lui/hudmanager.dec.lua b/lui/hudmanager.dec.lua new file mode 100644 index 0000000..8127502 --- /dev/null +++ b/lui/hudmanager.dec.lua @@ -0,0 +1,215 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +require( "LUI.CoD" ) +if Engine.HasSpeechFeature() then + require( "LUI.Speech" ) +end +f0_local0 = nil +function new() + local f1_local0 = {} + setmetatable( f1_local0, { + __index = _M + } ) + return f1_local0 +end + +function setupRoot( f2_arg0, f2_arg1 ) + f2_arg1:registerEventHandler( "init_hud", hudRootEventHandler( initHud ) ) + f2_arg1:registerEventHandler( "close_hud", closeHudHandler ) + f2_arg1:registerEventHandler( "intermission_began", hudRootEventHandler( beginIntermission ) ) + f2_arg1:registerEventHandler( "post_game_begin", hudRootEventHandler( openRoundEndScreen ) ) + f2_arg1:registerEventHandler( "round_end_show", hudRootEventHandler( openRoundEndScreen ) ) + f2_arg1:registerEventHandler( "show_host_migration", showHostMigrationHandler ) +end + +function registerHud( f3_arg0 ) + f0_local0 = f3_arg0 +end + +function initHud( f4_arg0, f4_arg1, f4_arg2 ) + if not f0_local0 then + return + elseif not f4_arg0.hudContainer then + f4_arg0.hudContainer = LUI.UIElement.new( { + left = 0, + right = 0, + top = 0, + bottom = 0, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true + } ) + f4_arg0.hudContainer.id = "hudContainer" + local f4_local0 = function () + + end + + f4_arg0.hudContainer:registerEventHandler( "mousemove", f4_local0 ) + f4_arg0.hudContainer:registerEventHandler( "mousedown", f4_local0 ) + f4_arg0.hudContainer:registerEventHandler( "mouseup", f4_local0 ) + f4_arg0.hudContainer:registerEventHandler( "gamepad_button", f4_local0 ) + f4_arg0.hudContainer:registerEventHandler( "gamepad_sticks", f4_local0 ) + f4_arg0.hudContainer:registerEventHandler( "keybind", f4_local0 ) + f4_arg0.hudContainer:setPriority( LUI.UIRoot.childPriorities.hudContainer ) + f4_arg2:addElement( f4_arg0.hudContainer ) + if not f4_arg2.m_hudElemLayer then + local f4_local1 = LUI.UIElement.new( { + left = 0, + right = 0, + top = 0, + bottom = 0, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true + } ) + f4_local1:setHudElemLayer() + f4_local1:setPriority( LUI.UIRoot.childPriorities.hudElems ) + f4_arg2:addElement( f4_local1 ) + f4_arg2.m_hudElemLayer = f4_local1 + end + end + if not GameX.GetScreenWidth() then + LUI.UIRoot.ProcessEvent( f4_arg2, { + name = "init_hud" + } ) + return + end + if Engine.IsMultiplayer() and not Engine.HasSnapshot() then + LUI.UIRoot.ProcessEvent( f4_arg2, { + name = "init_hud" + } ) + return + elseif not f4_arg0.hud then + run_gc() + profile.beginuserevent( "hud_create" ) + local f4_local1 = LUI.MenuBuilder.buildMenu( f0_local0 ) + profile.enduserevent( "hud_create" ) + run_gc() + f4_arg0.hud = f4_local1 + f4_arg0.hudContainer.hud = f4_local1 + f4_arg0.hudContainer:addElement( f4_local1 ) + f4_local1:processEvent( { + name = "menu_create", + dispatchChildren = true + } ) + if Engine.HasSpeechFeature() then + Kinect.EnableGlobalGrammars() + end + collectgarbage( "collect" ) + end + local f4_local1 = Engine.IsMultiplayer() + if f4_local1 then + f4_local1 = MLG.IsMLGSpectator() + end + if f4_local1 then + if not f4_arg0.MLGHud then + f4_arg0.MLGHud = LUI.mp_hud.MLGHud.MLGHud( f4_arg0.hudContainer ) + f4_arg0.MLGHud:setPriority( LUI.UIRoot.childPriorities.MLGHud ) + f4_arg2:addElement( f4_arg0.MLGHud ) + f4_arg0.MLGHud:processEvent( { + name = "menu_create", + dispatchChildren = true + } ) + f4_arg0.hudContainer:registerEventHandler( "gamepad_button", LUI.UIElement.GamepadButton ) + end + MLG.SetMLGActiveMenu() + f4_arg0.MLGHud:processEvent( { + name = "init_hud", + dispatchChildren = true + } ) + end +end + +function closeHud( f6_arg0, f6_arg1, f6_arg2 ) + if f6_arg0.hud then + f6_arg0.hud:processEvent( { + name = "menu_close", + dispatchChildren = true + } ) + f6_arg0.hud:close() + f6_arg0.hud = nil + if f6_arg0.hudContainer then + f6_arg0.hudContainer.hud = nil + end + end + if f6_arg0.MLGHud then + f6_arg0.MLGHud:processEvent( { + name = "menu_close", + dispatchChildren = true + } ) + f6_arg0.MLGHud:close() + f6_arg0.MLGHud = nil + end +end + +function closeRoundEndScreen( f7_arg0, f7_arg1, f7_arg2 ) + if f7_arg0.roundEndScreen then + f7_arg0.roundEndScreen:processEvent( { + name = "menu_close" + } ) + f7_arg0.roundEndScreen:close() + f7_arg0.roundEndScreen = nil + end +end + +function endIntermission( f8_arg0, f8_arg1, f8_arg2 ) + if f8_arg0.finalScoresScreen then + f8_arg0.finalScoresScreen:processEvent( { + name = "menu_close" + } ) + f8_arg0.finalScoresScreen:close() + f8_arg0.finalScoresScreen = nil + end +end + +function beginIntermission( f9_arg0, f9_arg1, f9_arg2 ) + f9_arg0:closeHud( f9_arg1, f9_arg2 ) + f9_arg0:closeRoundEndScreen( f9_arg1, f9_arg2 ) + if Engine.GetDvarBool( "squad_match" ) then + Engine.SetDvarBool( "squad_find_match", true ) + Engine.SetDvarBool( "squad_send_results", true ) + Squad.PostMatch( Engine.GetClientMatchData( "alliesScore" ), Engine.GetClientMatchData( "axisScore" ), Engine.GetClientMatchData( "alliesKills" ), Engine.GetClientMatchData( "alliesDeaths" ), false ) + end + if not f9_arg0.finalScoresScreen then + f9_arg0.finalScoresScreen = LUI.MenuBuilder.BuildAddChild( f9_arg2, { + type = "scoreboard" + } ) + f9_arg0.finalScoresScreen:setPriority( LUI.UIRoot.childPriorities.finalScoresScreen ) + end +end + +function openRoundEndScreen( f10_arg0, f10_arg1, f10_arg2 ) + if not f10_arg0.roundEndScreen then + f10_arg0.roundEndScreen = LUI.MenuBuilder.BuildAddChild( f10_arg2, { + type = "roundEndHudDef" + } ) + f10_arg0.roundEndScreen:setPriority( LUI.UIRoot.childPriorities.roundEndHud ) + end +end + +function hudRootEventHandler( f11_arg0 ) + return function ( f12_arg0, f12_arg1 ) + f11_arg0( f12_arg0.hudManager, f12_arg1, f12_arg0 ) + end + +end + +function closeHudHandler( f13_arg0, f13_arg1 ) + local f13_local0 = f13_arg0.hudManager + if f13_local0 then + f13_local0:closeHud( f13_arg1, f13_arg0 ) + f13_local0:endIntermission( f13_arg1, f13_arg0 ) + end +end + +function showHostMigrationHandler( f14_arg0, f14_arg1 ) + LUI.FlowManager.RequestAddMenu( nil, "host_migration_main" ) + f14_arg0:dispatchEventToRoot( { + name = "show_host_migration_triggered" + } ) +end + +LockTable( _M ) diff --git a/lui/lookcontrols.dec.lua b/lui/lookcontrols.dec.lua new file mode 100644 index 0000000..7811f75 --- /dev/null +++ b/lui/lookcontrols.dec.lua @@ -0,0 +1,300 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function SinglePlayerDisableFunction( f1_arg0, f1_arg1 ) + return not Engine.IsMultiplayer() +end + +function GetDisplay( f2_arg0 ) + return Engine.GetBinding( f2_arg0 ) +end + +function bindKey( f3_arg0 ) + Engine.BindKey( f3_arg0 ) +end + +function OptionsWindowRefresh( f4_arg0, f4_arg1 ) + if f4_arg1.source_input == "button_action" or f4_arg1.source_input == "key_bound" then + f4_arg0:processEvent( { + name = "menu_refresh" + } ) + f4_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f5_arg0, f5_arg1 ) + f5_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f5_arg1.name, + immediate = true + } ) +end + +function ControlBindFactory( f6_arg0, f6_arg1 ) + return { + type = "UIGenericButton", + id = "bind_" .. f6_arg1, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f6_arg0 ), + button_display_func = function ( f7_arg0, f7_arg1 ) + return GetDisplay( f6_arg1 ) + end + , + button_action_func = function ( f8_arg0, f8_arg1 ) + Engine.BindKey( f6_arg1 ) + OptionsWindowTriggerRefresh( f8_arg0, f8_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionFactory( f9_arg0, f9_arg1, f9_arg2 ) + local f9_local0 = nil + local f9_local1 = 1 + local f9_local2 = Engine.GetDvarType( f9_arg0 ) + if f9_local2 == DvarTypeTable.DvarString then + f9_local0 = Engine.GetDvarString( f9_arg0 ) + elseif f9_local2 == DvarTypeTable.DvarInt then + f9_local0 = Engine.GetDvarInt( f9_arg0 ) + elseif f9_local2 == DvarTypeTable.DvarBool then + f9_local0 = Engine.GetDvarBool( f9_arg0 ) + end + for f9_local6, f9_local7 in pairs( f9_arg2 ) do + if f9_local7.value == f9_local0 then + f9_local1 = f9_local6 + break + end + end + f9_local3 = function ( f10_arg0, f10_arg1 ) + if f9_arg0 == "ui_mousePitch" then + if Engine.GetDvarBool( f9_arg0 ) then + Engine.SetDvarFloat( "m_pitch", MousePitchTable.PitchFloat ) + else + Engine.SetDvarFloat( "m_pitch", -MousePitchTable.PitchFloat ) + end + end + if f9_local2 == DvarTypeTable.DvarString then + Engine.SetDvarString( f9_arg0, f9_arg2[f9_local1].value ) + elseif f9_local2 == DvarTypeTable.DvarInt then + Engine.SetDvarInt( f9_arg0, f9_arg2[f9_local1].value ) + elseif f9_local2 == DvarTypeTable.DvarBool then + Engine.SetDvarBool( f9_arg0, f9_arg2[f9_local1].value ) + end + end + + return { + type = "UIGenericButton", + id = "option_" .. f9_arg0, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f9_arg1 ), + button_display_func = function ( f11_arg0, f11_arg1 ) + return Engine.Localize( f9_arg2[f9_local1].text ) + end + , + button_left_func = function ( f12_arg0, f12_arg1 ) + f9_local1 = 1 + (#f9_arg2 + f9_local1 - 1 - 1) % #f9_arg2 + f9_local3( f12_arg0, f12_arg1 ) + end + , + button_right_func = function ( f13_arg0, f13_arg1 ) + f9_local1 = 1 + (f9_local1 - 1 + 1) % #f9_arg2 + f9_local3( f13_arg0, f13_arg1 ) + end + + } + } +end + +function SliderOptionFactory( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5, f14_arg6 ) + local f14_local0 = function ( f15_arg0, f15_arg1, f15_arg2 ) + Engine.SetDvarFloat( f14_arg0, math.min( f15_arg1, math.max( f15_arg0, Engine.GetDvarFloat( f14_arg0 ) + f15_arg2 ) ) ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + end + + return { + type = "UIGenericButton", + id = "options_" .. f14_arg0, + properties = { + button_text = Engine.Localize( f14_arg1 ), + variant = GenericButtonSettings.Variants.Slider, + button_display_func = function ( f16_arg0, f16_arg1 ) + return (Engine.GetDvarFloat( f14_arg0 ) - f14_arg2) / (f14_arg3 - f14_arg2) + end + , + button_left_func = function ( f17_arg0, f17_arg1 ) + f14_local0( f14_arg2, f14_arg3, -f14_arg4 ) + end + , + button_right_func = function ( f18_arg0, f18_arg1 ) + f14_local0( f14_arg2, f14_arg3, f14_arg4 ) + end + , + button_over_func = MBh.EmitEventToRoot( "brightness_over" ), + button_up_func = MBh.EmitEventToRoot( "brightness_up" ) + } + } +end + +function OptionsFeeder( f19_arg0 ) + local f19_local0 = {} + local f19_local1 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f19_local0[#f19_local0 + 1] = SliderOptionFactory( "sensitivity", "@MENU_MOUSE_SENSITIVITY", SliderBounds.MouseSensitivity.Min, SliderBounds.MouseSensitivity.Max, SliderBounds.MouseSensitivity.Step ) + if SinglePlayerDisableFunction() then + f19_local1 = { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } + else + f19_local1 = { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + } + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_mousePitch", "@MENU_INVERT_MOUSE", f19_local1 ) + f19_local0[#f19_local0 + 1] = OptionFactory( "m_filter", "@MENU_SMOOTH_MOUSE", { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } ) + f19_local0[#f19_local0 + 1] = OptionFactory( "cl_freelook", "@MENU_FREE_LOOK", { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_LOOK_UP", "+lookup" ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_LOOK_DOWN", "+lookdown" ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_HOLD_MOUSE_LOOK", "+mlook" ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_CENTER_VIEW", "centerview" ) + return f19_local0 +end + +function OptionsMainCreate( f20_arg0, f20_arg1 ) + f20_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function OptionsMainClose( f21_arg0, f21_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + Engine.Exec( "updategamerprofile" ) +end + +function look_controls_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function look_controls() + return { + type = "UIElement", + id = "look_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_LOOK" ) + } + }, + { + type = "look_controls_vlist", + id = "look_controls_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "look_controls_vlist", look_controls_vlist ) +LUI.MenuBuilder.registerDef( "look_controls", look_controls ) +LockTable( _M ) diff --git a/lui/lui.dec.lua b/lui/lui.dec.lua new file mode 100644 index 0000000..55228dd --- /dev/null +++ b/lui/lui.dec.lua @@ -0,0 +1,289 @@ +LUI = { + roots = {}, + Alignment = { + None = 0, + Left = 1, + Center = 2, + Right = 3, + Top = 4, + Middle = 5, + Bottom = 6 + }, + savedMenuStates = {}, + ActiveScoped = nil +} +if not Engine.IsDevelopmentBuild() then + function print() + + end + + function printf() + + end + +end +LUI.CachedEvents = { + process_events = { + name = "process_events", + immediate = true + }, + transition_complete = { + name = "transistion_complete_default", + lateness = 0 + }, + gamepad_button = { + name = "gamepad_button", + controller = 0, + button = "primary", + down = true, + immediate = true + } +} +function DisableGlobals() + local f3_local0 = getmetatable( _G ) + if not f3_local0 then + f3_local0 = {} + setmetatable( _G, f3_local0 ) + end + f3_local0.__newindex = function ( f4_arg0, f4_arg1, f4_arg2 ) + error( "LUI Error: Tried to create global variable " .. f4_arg1, 2 ) + end + +end + +function LockTable( f5_arg0 ) + local f5_local0 = getmetatable( f5_arg0 ) + if not f5_local0 then + f5_local0 = {} + setmetatable( f5_arg0, f5_local0 ) + end + f5_local0.__newindex = function ( f6_arg0, f6_arg1, f6_arg2 ) + error( "LUI Error: Tried to create module variable " .. f6_arg1, 2 ) + end + +end + +function InheritFrom( f7_arg0 ) + if not f7_arg0 then + error( "LUI Error: Did not specify base class in InheritFrom!" ) + end + local f7_local0 = {} + setmetatable( f7_local0, { + __index = f7_arg0 + } ) + f7_local0.m_eventHandlers = {} + setmetatable( f7_local0.m_eventHandlers, { + __index = f7_arg0.m_eventHandlers + } ) + return f7_local0 +end + +if nil ~= hpairs then + pairs = hpairs +end +LUI.ShallowCopy = function ( f8_arg0 ) + local f8_local0 = {} + for f8_local4, f8_local5 in pairs( f8_arg0 ) do + f8_local0[f8_local4] = f8_local5 + end + return f8_local0 +end + +LUI.ConcatenateToTable = function ( f9_arg0, f9_arg1 ) + if f9_arg1 == nil then + return + end + for f9_local3, f9_local4 in ipairs( f9_arg1 ) do + table.insert( f9_arg0, f9_local4 ) + end +end + +LUI.RemoveSingleItemFromArray = function ( f10_arg0, f10_arg1 ) + for f10_local0 = 1, #f10_arg0, 1 do + if f10_arg0[f10_local0] == f10_arg1 then + table.remove( f10_arg0, f10_local0 ) + break + end + end +end + +LUI.IsItemInArray = function ( f11_arg0, f11_arg1 ) + for f11_local0 = 1, #f11_arg0, 1 do + if f11_arg0[f11_local0] == f11_arg1 then + return true + end + end + return false +end + +LUI.ReverseTable = function ( f12_arg0 ) + local f12_local0 = #f12_arg0 + local f12_local1 = {} + for f12_local5, f12_local6 in ipairs( f12_arg0 ) do + f12_local1[f12_local0 - f12_local5 + 1] = f12_local6 + end + return f12_local1 +end + +LUI.clamp = function ( f13_arg0, f13_arg1, f13_arg2 ) + if f13_arg0 < f13_arg1 then + return f13_arg1 + elseif f13_arg2 < f13_arg0 then + return f13_arg2 + else + return f13_arg0 + end +end + +LUI.FormatAnimStateFinishEvent = function ( f14_arg0 ) + return "transition_complete_" .. f14_arg0 +end + +LUI.MakeFlyOverAnimationState = function ( f15_arg0, f15_arg1 ) + assert( f15_arg0 ) + assert( f15_arg1 ) + local f15_local0, f15_local1, f15_local2, f15_local3 = f15_arg0:getCurrentGlobalRect() + local f15_local4, f15_local5, f15_local6, f15_local7 = f15_arg1:getCurrentGlobalRect() + local f15_local8 = f15_local4 - f15_local0 + local f15_local9 = f15_local6 - f15_local2 + local f15_local10 = f15_local5 - f15_local1 + local f15_local11 = f15_local7 - f15_local3 + local f15_local12, f15_local13, f15_local14, f15_local15 = f15_arg0:getLocalRect() + local f15_local16, f15_local17, f15_local18, f15_local19 = f15_arg0:GetAnchorData() + return { + topAnchor = f15_local17, + bottomAnchor = f15_local19, + leftAnchor = f15_local16, + rightAnchor = f15_local18, + top = f15_local13 + f15_local10, + bottom = f15_local15 + f15_local11, + left = f15_local12 + f15_local8, + right = f15_local14 + f15_local9 + } +end + +LUI.Debug = {} +LargestElements = {} +LargestElementsSize = {} +LargestElementsCount = {} +if debug then + debug.postdeploymentfunction = function () + for f16_local3, f16_local4 in pairs( LUI.roots ) do + f16_local4.debugReload = true + end + end + +end +function LUITestFunction() + DebugPrint( "Running LUITestFunction()" ) +end + +function CountFieldsHelper( f18_arg0, f18_arg1 ) + if f18_arg1[f18_arg0] then + return + end + f18_arg1[f18_arg0] = true + local f18_local0 = 0 + for f18_local4, f18_local5 in pairs( f18_arg0 ) do + if type( f18_local4 ) == "table" then + f18_local0 = f18_local0 + CountFieldsHelper( f18_local4, f18_arg1 ) + end + f18_local0 = f18_local0 + 1 + end + return f18_local0 +end + +function CountFields( f19_arg0 ) + return CountFieldsHelper( f19_arg0, {} ) +end + +function CountReferencesHelper( f20_arg0, f20_arg1 ) + if f20_arg1[f20_arg0] then + return + end + f20_arg1[f20_arg0] = true + if type( f20_arg0 ) == "userdata" then + local f20_local0 = getmetatable( f20_arg0 ) + if not f20_local0 then + return + end + f20_arg0 = f20_local0.__index + if not f20_arg0 then + return + elseif type( f20_arg0 ) == "table" and f20_arg0.id then + local f20_local1 = CountFields( f20_arg0 ) + if not LargestElementsSize[f20_arg0.id] or LargestElementsSize[f20_arg0.id] < f20_local1 then + LargestElements[f20_arg0.id] = f20_arg0 + LargestElementsSize[f20_arg0.id] = f20_local1 + end + if not LargestElementsCount[f20_arg0.id] then + LargestElementsCount[f20_arg0.id] = 0 + end + LargestElementsCount[f20_arg0.id] = LargestElementsCount[f20_arg0.id] + 1 + end + end + if type( f20_arg0 ) ~= "table" then + return + end + for f20_local3, f20_local4 in pairs( f20_arg0 ) do + CountReferencesHelper( f20_local4, f20_arg1 ) + end +end + +function CountReferences( f21_arg0 ) + local f21_local0 = { + [f21_arg0] = true + } + if type( f21_arg0 ) == "userdata" then + local f21_local1 = getmetatable( f21_arg0 ) + if not f21_local1 then + return 0 + end + f21_arg0 = f21_local1.__index + if not f21_arg0 then + return 0 + end + end + if type( f21_arg0 ) ~= "table" then + return 0 + end + for f21_local4, f21_local5 in pairs( f21_arg0 ) do + CountReferencesHelper( f21_local5, f21_local0 ) + end + f21_local1 = 0 + for f21_local5, f21_local6 in pairs( f21_local0 ) do + f21_local1 = f21_local1 + 1 + end + return f21_local1 +end + +require( "LUI.LUIElement" ) +require( "LUI.LUIRoot" ) +require( "LUI.LUITimer" ) +require( "LUI.LUIButtonRepeater" ) +require( "LUI.LUIImage" ) +require( "LUI.LUILitImage" ) +require( "LUI.LUIText" ) +require( "LUI.LUIAnimNumber" ) +require( "LUI.LUITightText" ) +require( "LUI.LUIButton" ) +require( "LUI.LUIBindButton" ) +require( "LUI.LUIMouseCursor" ) +require( "LUI.LUIVerticalList" ) +require( "LUI.LUIScrollingVerticalList" ) +require( "LUI.LUIHorizontalList" ) +require( "LUI.LUIBarrelList" ) +require( "LUI.LUIGrid" ) +require( "LUI.LUIScrollable" ) +require( "LUI.LUIVerticalScrollbar" ) +require( "LUI.LUISafeAreaOverlay" ) +require( "LUI.LUICountdown" ) +require( "LUI.LUILongCountdown" ) +require( "LUI.LUITechyDigits" ) +require( "LUI.LUIPrettyNumber" ) +require( "LUI.LUICharacterWindow" ) +require( "LUI.FlowManager" ) +require( "LUI.HudManager" ) +require( "LUI.MenuBuilder" ) +require( "LUI.LUIMarqueeText" ) +MBh = LUI.MenuBuilder.helpers diff --git a/lui/luianimnumber.dec.lua b/lui/luianimnumber.dec.lua new file mode 100644 index 0000000..5307f4f --- /dev/null +++ b/lui/luianimnumber.dec.lua @@ -0,0 +1,56 @@ +LUI.UIAnimNumber = {} +LUI.UIAnimNumber.new = function ( f1_arg0 ) + local self = LUI.UIText.new( f1_arg0 ) + self.setNumber = LUI.UIAnimNumber.SetNumber + self.setLocalizedString = LUI.UIAnimNumber.SetLocalizedString + self.layout = LUI.UIAnimNumber.Layout + return self +end + +LUI.UIAnimNumber.SetNumber = function ( f2_arg0, f2_arg1, f2_arg2 ) + if f2_arg2 == nil or f2_arg0.currentNumber == nil then + f2_arg0.currentNumber = f2_arg1 + f2_arg0:setText( f2_arg1 ) + return + else + f2_arg0.startingNumber = f2_arg0.currentNumber + f2_arg0.numberChange = f2_arg1 - f2_arg0.startingNumber + f2_arg0.timeLeft = f2_arg2 + f2_arg0.duration = f2_arg2 + f2_arg0:setLayoutCached( false ) + end +end + +LUI.UIAnimNumber.SetLocalizedString = function ( f3_arg0, f3_arg1 ) + f3_arg0.localizedString = f3_arg1 +end + +LUI.UIAnimNumber.Layout = function ( f4_arg0, f4_arg1 ) + local f4_local0 = true + if f4_arg0.timeLeft ~= nil then + local f4_local1 = f4_arg0.timeLeft - f4_arg1.deltaTime + local f4_local2 = nil + if f4_local1 < 0 then + f4_local2 = f4_arg0.startingNumber + f4_arg0.numberChange + f4_arg0.startingNumber = nil + f4_arg0.numberChange = nil + f4_arg0.timeLeft = nil + f4_arg0.duration = nil + else + f4_arg0.timeLeft = f4_local1 + f4_local2 = math.floor( f4_arg0.startingNumber + f4_arg0.numberChange * (1 - f4_local1 / f4_arg0.duration) + 0.5 ) + end + local f4_local3 = f4_arg0.localizedString + if f4_local3 ~= nil then + f4_arg0:setText( Engine.Localize( f4_local3, f4_local2 ) ) + else + f4_arg0:setText( f4_local2 ) + end + f4_arg0.currentNumber = f4_local2 + f4_local0 = false + end + f4_local0 = f4_arg0:updateElementLayout( f4_arg1 ) and f4_local0 + f4_arg0:layoutChildren( f4_arg1 ) + f4_arg0:setLayoutCached( f4_local0 ) +end + diff --git a/lui/luibarrellist.dec.lua b/lui/luibarrellist.dec.lua new file mode 100644 index 0000000..0871d94 --- /dev/null +++ b/lui/luibarrellist.dec.lua @@ -0,0 +1,295 @@ +LUI.UIBarrelList = {} +LUI.UIBarrelList.build = function ( f1_arg0, f1_arg1 ) + return LUI.UIBarrelList.new( nil, f1_arg1 ) +end + +LUI.UIBarrelList.new = function ( menu, controller ) + local self = LUI.UIElement.new( menu ) + self.id = "UIBarrelList" + if not controller then + controller = {} + end + self.animSpeed = controller.anim_speed or 60 + self.listOffset = controller.list_offset or 0 + self.onUpdateFunc = controller.on_update_func + self.onScrollFunc = controller.on_scroll_func + + local hList = LUI.UIHorizontalList.new( menu ) + hList:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = self.listOffset, + spacing = controller.spacing or 0 + } ) + hList:animateToState( "default" ) + self:addElement( hList ) + self.hList = hList + + self:registerEventHandler( "gain_focus", LUI.UIBarrelList.gainFocus ) + self.addElement = LUI.UIBarrelList.AddElement + self.removeElement = LUI.UIBarrelList.RemoveElement + self.increment = LUI.UIBarrelList.IncrementIndex + self.decrement = LUI.UIBarrelList.DecrementIndex + self.getCurrentIndex = LUI.UIBarrelList.GetCurrentIndex + self.handleGamepadButton = LUI.UIBarrelList.handleGamepadButton + self.setupForAnimation = LUI.UIBarrelList.SetupForAnimation + self.manualUpdate = LUI.UIBarrelList.UpdateList + self:makeFocusable() + self.currentIndex = 0 + return self +end + +LUI.UIBarrelList.AddElement = function ( f3_arg0, f3_arg1 ) + if f3_arg0.usingAnimation then + DebugPrint( "WARNING: Adding an element after the BarrelList has been setup for animation! Cap positions will be wrong and animation will look broken!" ) + end + f3_arg0.hList:addElement( f3_arg1 ) + LUI.UIBarrelList.UpdateList( f3_arg0 ) +end + +LUI.UIBarrelList.RemoveElement = function ( f4_arg0, f4_arg1 ) + if f4_arg0.usingAnimation then + DebugPrint( "WARNING: Removing an element after the BarrelList has been setup for animation! Cap positions will be wrong and animation will look broken!" ) + end + f4_arg0.hList:removeElement( f4_arg1 ) + LUI.UIBarrelList.UpdateList( f4_arg0 ) +end + +LUI.UIBarrelList.UpdateList = function ( f5_arg0 ) + local f5_local0 = f5_arg0.hList:getNumChildren() + local f5_local1 = f5_arg0.hList:getFirstChild() + local f5_local2 = math.floor( f5_local0 / 2 ) + for f5_local3 = 0, f5_local0 - 1, 1 do + f5_local1:processEvent( { + name = "barrel_index_update", + index = f5_arg0.currentIndex - f5_local2 - f5_local3 + } ) + f5_local1 = f5_local1:getNextSibling() + end + if f5_arg0.onUpdateFunc then + f5_arg0:onUpdateFunc( f5_arg0.currentIndex ) + end + return false +end + +LUI.UIBarrelList.gainFocus = function ( f6_arg0 ) + f6_arg0:setFocus( true ) + local f6_local0 = f6_arg0.hList:getNumChildren() + local f6_local1 = f6_arg0.hList:getFirstChild() + local f6_local2 = math.floor( f6_local0 / 2 ) + for f6_local3 = 1, f6_local2, 1 do + local f6_local6 = f6_local3 + f6_local1 = f6_local1:getNextSibling() + end + f6_arg0.focusedChild = f6_local1 + f6_local1:processEvent( { + name = "barrel_list_focus" + } ) + return true +end + +LUI.UIBarrelList.handleGamepadButton = function ( f7_arg0, f7_arg1 ) + if not f7_arg0:isInFocus() or not f7_arg1.down then + return false + end + local f7_local0 = false + if f7_arg1.button == "primary" then + if not f7_arg0.isAnimating then + f7_arg0.focusedChild:processEvent( { + name = "barrel_list_action", + index = f7_arg0.currentIndex, + controller = f7_arg1.controller + } ) + end + f7_local0 = true + elseif f7_arg1.button == "left" then + if not f7_arg0.isAnimating then + LUI.UIBarrelList.DecrementIndex( f7_arg0 ) + end + f7_local0 = true + elseif f7_arg1.button == "right" then + if not f7_arg0.isAnimating then + LUI.UIBarrelList.IncrementIndex( f7_arg0 ) + end + f7_local0 = true + elseif f7_arg1.button == "alt1" then + if not f7_arg0.isAnimating then + f7_arg0.focusedChild:processEvent( { + name = "barrel_list_button_alt1", + index = f7_arg0.currentIndex, + controller = f7_arg1.controller + } ) + end + f7_local0 = true + end + return f7_local0 +end + +LUI.UIBarrelList.IncrementIndex = function ( f8_arg0 ) + f8_arg0.currentIndex = f8_arg0.currentIndex + 1 + if f8_arg0.usingAnimation then + f8_arg0:animateToState( "shift_left", f8_arg0.animSpeed, true, true ) + f8_arg0.rightCap:processEvent( { + name = "barrel_index_update", + index = f8_arg0.currentIndex + math.floor( f8_arg0.hList:getNumChildren() / 2 ), + barrelList = f8_arg0 + } ) + f8_arg0:dispatchEventToChildren( { + name = "barrel_anim_start", + barrelList = f8_arg0, + movingLeft = true + } ) + if f8_arg0.onScrollFunc then + f8_arg0:onScrollFunc() + end + f8_arg0:dispatchEventToChildren( { + name = "barrel_list_unfocus" + } ) + f8_arg0.isAnimating = true + else + LUI.UIBarrelList.UpdateList( f8_arg0 ) + end +end + +LUI.UIBarrelList.DecrementIndex = function ( f9_arg0 ) + f9_arg0.currentIndex = f9_arg0.currentIndex - 1 + if f9_arg0.usingAnimation then + f9_arg0:animateToState( "shift_right", f9_arg0.animSpeed, true, true ) + f9_arg0.leftCap:processEvent( { + name = "barrel_index_update", + index = f9_arg0.currentIndex - math.floor( f9_arg0.hList:getNumChildren() / 2 ), + barrelList = f9_arg0 + } ) + f9_arg0:dispatchEventToChildren( { + name = "barrel_anim_start", + barrelList = f9_arg0, + movingRight = true + } ) + if f9_arg0.onScrollFunc then + f9_arg0:onScrollFunc() + end + f9_arg0:dispatchEventToChildren( { + name = "barrel_list_unfocus" + } ) + f9_arg0.isAnimating = true + else + LUI.UIBarrelList.UpdateList( f9_arg0 ) + end +end + +LUI.UIBarrelList.GetCurrentIndex = function ( f10_arg0 ) + return f10_arg0.currentIndex +end + +LUI.UIBarrelList.ScrollFinished = function ( f11_arg0, f11_arg1 ) + f11_arg0:animateToState( "default", 0 ) + f11_arg0.isAnimating = false +end + +LUI.UIBarrelList.OnDefaultState = function ( f12_arg0, f12_arg1 ) + local f12_local0 = f12_arg0.hList:getNumChildren() + local f12_local1 = f12_arg0.hList:getFirstChild() + local f12_local2 = math.floor( f12_local0 / 2 ) + for f12_local3 = 0, f12_local0 - 1, 1 do + if f12_local3 == f12_local2 then + f12_local1:processEvent( { + name = "barrel_list_focus" + } ) + end + f12_local1 = f12_local1:getNextSibling() + end + LUI.UIBarrelList.UpdateList( f12_arg0 ) + f12_arg0:dispatchEventToChildren( { + name = "barrel_default_state" + } ) +end + +LUI.UIBarrelList.CreateCap = function ( f13_arg0, f13_arg1, f13_arg2, f13_arg3, f13_arg4, f13_arg5, f13_arg6, f13_arg7, f13_arg8 ) + local f13_local0 = f13_arg0( f13_arg2 ) + f13_local0.id = f13_arg1 + f13_local0:registerAnimationState( "default", { + topAnchor = f13_arg7.topAnchor, + bottomAnchor = f13_arg7.bottomAnchor, + leftAnchor = f13_arg7.leftAnchor, + rightAnchor = f13_arg7.rightAnchor, + top = f13_arg3, + bottom = f13_arg4, + left = f13_arg5, + right = f13_arg6 + } ) + f13_local0:animateToState( "default", 0 ) + for f13_local4, f13_local5 in pairs( f13_arg8 ) do + f13_local0:registerEventHandler( f13_local4, f13_local5 ) + end + return f13_local0 +end + +LUI.UIBarrelList.SetupForAnimation = function ( f14_arg0, f14_arg1, f14_arg2, f14_arg3 ) + local f14_local0 = f14_arg0.hList:getNumChildren() + local f14_local1 = f14_arg0.hList:getFirstChild() + local f14_local2 = f14_local1.properties + if f14_arg3 then + f14_arg0:setUseStencil( false ) + else + f14_arg0:setUseStencil( true ) + end + if f14_arg2 then + for f14_local6, f14_local7 in pairs( f14_arg2 ) do + f14_local2[f14_local6] = f14_local7 + end + end + local f14_local3, f14_local4, f14_local5, f14_local6 = f14_local1:getLocalRect() + local f14_local7, f14_local8, f14_local9, f14_local10 = f14_local1:GetAnchorData() + local f14_local11 = { + leftAnchor = f14_local7, + topAnchor = f14_local8, + rightAnchor = f14_local9, + bottomAnchor = f14_local10 + } + local f14_local12 = f14_local5 - f14_local3 + local f14_local13 = -(f14_local12 + f14_arg0.properties.spacing + f14_arg0.listOffset) + f14_arg0.leftCap = LUI.UIBarrelList.CreateCap( f14_arg1, "barrel_left_cap_id", f14_local2, f14_local4, f14_local6, f14_local13, f14_local13 + f14_local12, f14_local11, f14_local1.m_eventHandlers ) + f14_local13 = (f14_local12 + f14_arg0.properties.spacing) * f14_local0 + f14_arg0.listOffset + f14_arg0.rightCap = LUI.UIBarrelList.CreateCap( f14_arg1, "barrel_right_cap_id", f14_local2, f14_local4, f14_local6, f14_local13, f14_local13 + f14_local12, f14_local11, f14_local1.m_eventHandlers ) + LUI.UIElement.addElement( f14_arg0, f14_arg0.leftCap ) + LUI.UIElement.addElement( f14_arg0, f14_arg0.rightCap ) + f14_local3, f14_local4, f14_local5, f14_local6 = f14_arg0:getLocalRect() + f14_local7, f14_local8, f14_local9, f14_local10 = f14_arg0:GetAnchorData() + local f14_local14 = f14_arg0 + local f14_local15 = f14_arg0.registerAnimationState + local f14_local16 = "shift_right" + local f14_local17 = { + topAnchor = f14_local8, + bottomAnchor = f14_local10, + leftAnchor = f14_local7 + } + local f14_local18 = f14_local9 + f14_local17.top = f14_local4 + f14_local17.bottom = f14_local6 + f14_local17.left = f14_local3 + f14_local12 + f14_arg0.properties.spacing + f14_local17.right = 0 + f14_local17[1] = f14_local18 + f14_local15( f14_local14, f14_local16, f14_local17 ) + f14_local14 = f14_arg0 + f14_local15 = f14_arg0.registerAnimationState + f14_local16 = "shift_left" + f14_local17 = { + topAnchor = f14_local8, + bottomAnchor = f14_local10, + leftAnchor = f14_local7 + } + f14_local18 = f14_local9 + f14_local17.top = f14_local4 + f14_local17.bottom = f14_local6 + f14_local17.left = f14_local3 - f14_local12 - f14_arg0.properties.spacing + f14_local17.right = 0 + f14_local17[1] = f14_local18 + f14_local15( f14_local14, f14_local16, f14_local17 ) + f14_arg0:registerEventHandler( "transition_complete_shift_left", LUI.UIBarrelList.ScrollFinished ) + f14_arg0:registerEventHandler( "transition_complete_shift_right", LUI.UIBarrelList.ScrollFinished ) + f14_arg0:registerEventHandler( "transition_complete_default", LUI.UIBarrelList.OnDefaultState ) + f14_arg0.usingAnimation = true +end + diff --git a/lui/luibindbutton.dec.lua b/lui/luibindbutton.dec.lua new file mode 100644 index 0000000..63512f8 --- /dev/null +++ b/lui/luibindbutton.dec.lua @@ -0,0 +1,105 @@ +LUI.UIBindButton = {} +LUI.UIBindButton.GamepadButton = function ( f1_arg0, f1_arg1 ) + if f1_arg0:handleGamepadButton( f1_arg1 ) then + return true + elseif f1_arg0.m_ownerController ~= nil and f1_arg0.m_ownerController ~= f1_arg1.controller then + DebugPrint( "Item Exclusive to controller " .. f1_arg1.controller ) + return false + elseif f1_arg1.down == true then + local f1_local0 = false + local f1_local1 = { + controller = f1_arg1.controller, + qualifier = f1_arg1.qualifier + } + if not f1_arg0.disabled then + f1_local0 = true + if f1_arg1.button == "secondary" then + f1_local1.name = "button_secondary" + elseif f1_arg1.button == "alt1" then + f1_local1.name = "button_alt1" + elseif f1_arg1.button == "alt2" then + f1_local1.name = "button_alt2" + elseif f1_arg1.button == "right_trigger" then + f1_local1.name = "button_right_trigger" + elseif f1_arg1.button == "left_trigger" then + f1_local1.name = "button_left_trigger" + elseif f1_arg1.button == "shoulderr" then + f1_local1.name = "button_shoulderr" + elseif f1_arg1.button == "shoulderl" then + f1_local1.name = "button_shoulderl" + elseif f1_arg1.button == "right_stick" then + f1_local1.name = "button_right_stick" + elseif f1_arg1.button == "left_stick" then + f1_local1.name = "button_left_stick" + elseif f1_arg1.button == "left" then + f1_local1.name = "button_left" + elseif f1_arg1.button == "right" then + f1_local1.name = "button_right" + elseif f1_arg1.button == "up" then + f1_local1.name = "button_up" + elseif f1_arg1.button == "down" then + f1_local1.name = "button_down" + elseif f1_arg1.button == "start" then + f1_local1.name = "button_start" + elseif f1_arg1.button == "select" then + f1_local1.name = "button_select" + elseif f1_arg1.button == "options" then + f1_local1.name = "button_options" + else + f1_local0 = false + end + end + if f1_local0 and f1_arg0:processEvent( f1_local1 ) then + if f1_arg0.actionSFX then + Engine.PlaySound( f1_arg0.actionSFX ) + end + return true + end + end + return f1_arg0:dispatchEventToChildren( f1_arg1 ) +end + +LUI.UIBindButton.ElementEnable = function ( f2_arg0, f2_arg1 ) + f2_arg0.disabled = nil +end + +LUI.UIBindButton.ElementDisable = function ( f3_arg0, f3_arg1 ) + f3_arg0.disabled = true +end + +LUI.UIBindButton.Enable = function ( f4_arg0 ) + f4_arg0:processEvent( { + name = "enable", + dispatchChildren = true + } ) +end + +LUI.UIBindButton.Disable = function ( f5_arg0 ) + f5_arg0:processEvent( { + name = "disable", + dispatchChildren = true + } ) +end + +LUI.UIBindButton.SetActionSFX = function ( f6_arg0, f6_arg1 ) + f6_arg0.actionSFX = f6_arg1 +end + +LUI.UIBindButton.build = function ( f7_arg0, f7_arg1 ) + return LUI.UIBindButton.new() +end + +LUI.UIBindButton.new = function ( menu, controller ) + local self = LUI.UIElement.new( menu ) + self.id = "LUIBindButton" + self.enable = LUI.UIBindButton.Enable + self.disable = LUI.UIBindButton.Disable + self.setActionSFX = LUI.UIBindButton.SetActionSFX + self:registerEventHandlerIfFree( "enable", LUI.UIBindButton.ElementEnable ) + self:registerEventHandlerIfFree( "disable", LUI.UIBindButton.ElementDisable ) + self:registerEventHandlerIfFree( "popup_active", LUI.UIBindButton.ElementDisable ) + self:registerEventHandlerIfFree( "popup_inactive", LUI.UIBindButton.ElementEnable ) + self:registerEventHandler( "gamepad_button", LUI.UIBindButton.GamepadButton ) + return self +end + diff --git a/lui/luibutton.dec.lua b/lui/luibutton.dec.lua new file mode 100644 index 0000000..3313ff0 --- /dev/null +++ b/lui/luibutton.dec.lua @@ -0,0 +1,415 @@ +LUI.UIButton = {} +LUI.UIButton.popupActive = function ( f1_arg0, f1_arg1 ) + f1_arg0.m_ignoreMouseFocus = true +end + +LUI.UIButton.popupInactive = function ( f2_arg0, f2_arg1 ) + f2_arg0.m_ignoreMouseFocus = nil +end + +LUI.UIButton.MouseEnter = function ( f3_arg0, f3_arg1 ) + if f3_arg0.m_leftMouseDown == nil then + if f3_arg0:canFocus( FocusType.MouseOver ) and not f3_arg0:isInFocus() then + if f3_arg0.disabled then + f3_arg0:processEvent( { + name = "button_over_disable" + } ) + else + f3_arg0:processEvent( { + name = "button_over", + controller = f3_arg1.controller + } ) + end + end + elseif f3_arg0.m_leftMouseDown ~= nil then + f3_arg0:processEvent( { + name = "button_over_down" + } ) + end +end + +LUI.UIButton.MouseLeave = function ( f4_arg0, f4_arg1 ) + if f4_arg0.m_leftMouseDown == nil then + if f4_arg0.m_focusable and not f4_arg0:isInFocus() then + if f4_arg0.disabled then + f4_arg0:processEvent( { + name = "button_disable" + } ) + else + f4_arg0:processEvent( { + name = "button_up" + } ) + end + end + else + f4_arg0:processEvent( { + name = "button_down" + } ) + end +end + +LUI.UIButton.LeftMouseDown = function ( f5_arg0, f5_arg1 ) + f5_arg0:processEvent( { + name = "button_over_down" + } ) +end + +LUI.UIButton.RightMouseDown = function ( f6_arg0, f6_arg1 ) + f6_arg0:processEvent( { + name = "button_over_down" + } ) +end + +LUI.UIButton.LeftMouseUp = function ( f7_arg0, f7_arg1 ) + if f7_arg1.inside then + if f7_arg0.disabled then + f7_arg0:processEvent( { + name = "button_over_disable" + } ) + else + f7_arg0:processEvent( { + name = "button_over", + controller = f7_arg1.controller, + focusType = FocusType.MouseOver + } ) + end + if not f7_arg0.disabled then + if not f7_arg0.properties or not f7_arg0.properties.muteAction then + Engine.PlaySound( f7_arg0.actionSFX ) + end + local f7_local0 = f7_arg0:processEvent( { + name = "button_action", + controller = f7_arg1.controller, + mouse = true + } ) + f7_arg0:processEvent( { + name = "button_down", + controller = f7_arg1.controller, + mouse = true + } ) + if f7_local0 then + return f7_local0 + end + elseif f7_arg0.properties and f7_arg0.properties.disableSound then + Engine.PlaySound( f7_arg0.properties.disableSound ) + end + if f7_arg0.properties and f7_arg0.properties.allowDisabledAction then + f7_arg0:processEvent( { + name = "button_action_disable", + controller = f7_arg1.controller + } ) + end + elseif not f7_arg0.disabled then + f7_arg0:processEvent( { + name = "button_up" + } ) + end +end + +LUI.UIButton.RightMouseUp = function ( f8_arg0, f8_arg1 ) + if f8_arg1.inside then + if f8_arg0.disabled then + f8_arg0:processEvent( { + name = "button_over_disable", + controller = f8_arg1.controller + } ) + else + f8_arg0:processEvent( { + name = "button_over", + controller = f8_arg1.controller + } ) + end + if not f8_arg0.disabled then + local f8_local0 = f8_arg0:processEvent( { + name = "button_actionsecondary", + controller = f8_arg1.controller, + mouse = true + } ) + if f8_local0 then + return f8_local0 + end + end + else + f8_arg0:processEvent( { + name = "button_up" + } ) + end +end + +LUI.UIButton.excludeButtons = { + secondary = true, + alt1 = true, + alt2 = true, + right_trigger = true, + left_trigger = true, + shoulderl = true, + shoulderr = true, + start = true +} +LUI.UIButton.GamepadButton = function ( f9_arg0, f9_arg1 ) + if f9_arg0:handleGamepadButton( f9_arg1 ) then + return true + elseif f9_arg0:isInFocus() and f9_arg1.down == true then + if f9_arg1.button == "primary" then + if not f9_arg0.properties or not f9_arg0.properties.muteAction then + Engine.PlaySound( f9_arg0.actionSFX ) + end + if not f9_arg0.disabled then + local f9_local0 + if not f9_arg1.qualifier or f9_arg1.qualifier ~= ButtonQualifiers.Keyboard then + f9_local0 = false + else + f9_local0 = true + end + f9_arg0:processEvent( { + name = "button_action", + controller = f9_arg1.controller, + keyboard = f9_local0 + } ) + f9_arg0:processEvent( { + name = "button_down", + controller = f9_arg1.controller, + keyboard = f9_local0 + } ) + else + if f9_arg0.properties and f9_arg0.properties.disableSound then + Engine.PlaySound( f9_arg0.properties.disableSound ) + end + if f9_arg0.properties and f9_arg0.properties.allowDisabledAction then + f9_arg0:processEvent( { + name = "button_action_disable", + controller = f9_arg1.controller + } ) + end + end + if f9_arg0.m_eventHandlers.button_action ~= nil then + return true + end + elseif f9_arg1.button == "left" then + if not f9_arg0.disabled then + f9_arg0:processEvent( { + name = "button_left", + controller = f9_arg1.controller + } ) + end + if f9_arg0.m_eventHandlers.button_left ~= nil then + return true + end + elseif f9_arg1.button == "right" then + if not f9_arg0.disabled then + f9_arg0:processEvent( { + name = "button_right", + controller = f9_arg1.controller + } ) + end + if f9_arg0.m_eventHandlers.button_right ~= nil then + return true + end + elseif LUI.UIButton.excludeButtons[f9_arg1.button] and f9_arg0.m_eventHandlers["button_" .. f9_arg1.button] ~= nil then + DebugPrint( "Warning: event handler specified for button_" .. f9_arg1.button .. " on a UIButton id = " .. f9_arg0.id .. ", this won't work anymore, use a UIBindButton" ) + end + end + return f9_arg0:dispatchEventToChildren( f9_arg1 ) +end + +LUI.UIButton.gainFocus = function ( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0:isInFocus() + LUI.UIElement.gainFocus( f10_arg0, f10_arg1 ) + if not f10_local0 and f10_arg0:isInFocus() and f10_arg0.gainFocusSFX ~= nil and f10_arg1.focusType ~= FocusType.MenuFlow then + Engine.PlaySound( f10_arg0.gainFocusSFX ) + end + if f10_arg0.disabled then + f10_arg0:processEvent( { + name = "button_over_disable", + dispatchChildren = true, + focusType = f10_arg1.focusType + } ) + else + f10_arg0:processEvent( { + name = "button_over", + controller = f10_arg1.controller, + dispatchChildren = true, + focusType = f10_arg1.focusType + } ) + end +end + +LUI.UIButton.loseFocus = function ( f11_arg0, f11_arg1 ) + LUI.UIElement.loseFocus( f11_arg0, f11_arg1 ) + if f11_arg0.disabled then + f11_arg0:processEvent( { + name = "button_disable", + dispatchChildren = true + } ) + else + f11_arg0:processEvent( { + name = "button_up", + dispatchChildren = true + } ) + end +end + +LUI.UIButton.Up = function ( f12_arg0, f12_arg1 ) + f12_arg0:dispatchEventToChildren( f12_arg1 ) + if f12_arg0:isInFocus() then + f12_arg0:processEvent( { + name = "gain_focus" + } ) + end +end + +LUI.UIButton.Over = function ( f13_arg0, f13_arg1 ) + if f13_arg0.disabled and f13_arg0:hasAnimationState( "button_over_disabled" ) then + f13_arg0:animateToState( "button_over_disabled", f13_arg0.disableDuration ) + elseif f13_arg0:hasAnimationState( "button_over" ) then + f13_arg0:animateToState( "button_over", f13_arg0.overDuration, f13_arg0.overEaseIn, f13_arg0.overEaseOut ) + end +end + +LUI.UIButton.ElementUp = function ( f14_arg0, f14_arg1 ) + +end + +LUI.UIButton.ElementDown = function ( f15_arg0, f15_arg1 ) + if f15_arg0:hasAnimationState( "button_down" ) then + f15_arg0:animateToState( "button_down", f15_arg0.downDuration ) + else + LUI.UIButton.ElementUp( f15_arg0, f15_arg1 ) + end + f15_arg0:dispatchEventToChildren( f15_arg1 ) +end + +LUI.UIButton.ElementOverDown = function ( f16_arg0, f16_arg1 ) + if f16_arg0:hasAnimationState( "button_over_down" ) then + f16_arg0:animateToState( "button_over_down", f16_arg0.overDownDuration ) + else + LUI.UIButton.Over( f16_arg0, f16_arg1 ) + end + f16_arg0:dispatchEventToChildren( f16_arg1 ) +end + +LUI.UIButton.ElementEnable = function ( f17_arg0, f17_arg1 ) + f17_arg0.disabled = nil + f17_arg0:dispatchEventToChildren( f17_arg1 ) + if f17_arg0:isInFocus() then + f17_arg0:processEvent( { + name = "button_over", + dispatchChildren = true, + controller = f17_arg1.controller + } ) + else + f17_arg0:processEvent( { + name = "button_up", + dispatchChildren = true + } ) + end +end + +LUI.UIButton.ElementDisable = function ( f18_arg0, f18_arg1 ) + f18_arg0.disabled = true + f18_arg0:dispatchEventToChildren( f18_arg1 ) + if f18_arg0:isInFocus() then + f18_arg0:processEvent( { + name = "button_over_disable", + dispatchChildren = true + } ) + else + f18_arg0:processEvent( { + name = "button_disable", + dispatchChildren = true + } ) + end +end + +LUI.UIButton.UpdateOutsideList = function ( f19_arg0, f19_arg1 ) + f19_arg0.m_outsideParentList = f19_arg1.outside_list +end + +LUI.UIButton.Enable = function ( f20_arg0, f20_arg1 ) + f20_arg0:processEvent( { + name = "enable", + dispatchChildren = true + } ) + if f20_arg0:isInFocus() then + f20_arg0:processEvent( { + name = "button_over", + dispatchChildren = true, + controller = f20_arg1.controller + } ) + else + f20_arg0:processEvent( { + name = "button_up", + dispatchChildren = true + } ) + end +end + +LUI.UIButton.Disable = function ( f21_arg0 ) + f21_arg0:processEvent( { + name = "disable", + dispatchChildren = true + } ) + if f21_arg0:isInFocus() then + f21_arg0:processEvent( { + name = "button_over_disable", + dispatchChildren = true + } ) + else + f21_arg0:processEvent( { + name = "button_disable", + dispatchChildren = true + } ) + end +end + +LUI.UIButton.SetupElement = function ( f22_arg0 ) + f22_arg0:registerEventHandlerIfFree( "enable", LUI.UIButton.ElementEnable ) + f22_arg0:registerEventHandlerIfFree( "disable", LUI.UIButton.ElementDisable ) + f22_arg0:registerEventHandlerIfFree( "button_up", LUI.UIButton.Up ) + f22_arg0:registerEventHandlerIfFree( "button_over", LUI.UIButton.Over ) + f22_arg0:registerEventHandlerIfFree( "button_down", LUI.UIButton.ElementDown ) + f22_arg0:registerEventHandlerIfFree( "button_over_down", LUI.UIButton.ElementOverDown ) +end + +LUI.UIButton.SetGainFocusSFX = function ( f23_arg0, f23_arg1 ) + f23_arg0.gainFocusSFX = f23_arg1 +end + +LUI.UIButton.SetActionSFX = function ( f24_arg0, f24_arg1 ) + f24_arg0.actionSFX = f24_arg1 +end + +LUI.UIButton.build = function ( f25_arg0, f25_arg1 ) + return LUI.UIButton.new() +end + +LUI.UIButton.new = function ( menu, controller ) + local self = LUI.UIElement.new( menu ) + self.id = "LUIButton" + self:makeFocusable() + self:setHandleMouse( true ) + self.enable = LUI.UIButton.Enable + self.disable = LUI.UIButton.Disable + self.lock = LUI.UIButton.Disable + self.actionEventName = controller + self.setActionEventName = LUI.UIButton.setActionEventName + self.setGainFocusSFX = LUI.UIButton.SetGainFocusSFX + self.setActionSFX = LUI.UIButton.SetActionSFX + self.gainFocusSFX = CoD.SFX.MouseOver + self.actionSFX = CoD.SFX.MouseClick + self:registerEventHandler( "mouseenter", LUI.UIButton.MouseEnter ) + self:registerEventHandler( "mouseleave", LUI.UIButton.MouseLeave ) + self:registerEventHandler( "leftmousedown", LUI.UIButton.LeftMouseDown ) + self:registerEventHandler( "leftmouseup", LUI.UIButton.LeftMouseUp ) + self:registerEventHandler( "rightmousedown", LUI.UIButton.RightMouseDown ) + self:registerEventHandler( "rightmouseup", LUI.UIButton.RightMouseUp ) + self:registerEventHandler( "gamepad_button", LUI.UIButton.GamepadButton ) + self:registerEventHandler( "gain_focus", LUI.UIButton.gainFocus ) + self:registerEventHandler( "lose_focus", LUI.UIButton.loseFocus ) + self:registerEventHandler( "popup_active", LUI.UIButton.popupActive ) + self:registerEventHandler( "popup_inactive", LUI.UIButton.popupInactive ) + self:registerEventHandler( "update_outside_list", LUI.UIButton.UpdateOutsideList ) + LUI.UIButton.SetupElement( self ) + return self +end + diff --git a/lui/luibuttonrepeater.dec.lua b/lui/luibuttonrepeater.dec.lua new file mode 100644 index 0000000..ed8f40f --- /dev/null +++ b/lui/luibuttonrepeater.dec.lua @@ -0,0 +1,165 @@ +require( "LUI.LUITimer" ) + +LUI.UIButtonRepeater = {} +LUI.UIButtonRepeater.FirstDelay = 420 +LUI.UIButtonRepeater.Delay = 210 +LUI.UIButtonRepeater.DelayReduction = 25 +LUI.UIButtonRepeater.AccelInterval = 100 +LUI.UIButtonRepeater.MinDelay = 33 +LUI.UIButtonRepeater.new = function ( f1_arg0, f1_arg1, f1_arg2 ) + local self = LUI.UIElement.new() + self.id = "LUIButtonRepeater" + self:setPriority( -1000 ) + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + self.buttonName = f1_arg0 + if type( f1_arg1 ) == "string" then + self.event = { + name = f1_arg1, + buttonRepeat = true + } + else + f1_arg1.buttonRepeat = true + self.event = f1_arg1 + end + self.eventTarget = f1_arg2 + self.firstDelay = LUI.UIButtonRepeater.FirstDelay + self.delay = LUI.UIButtonRepeater.Delay + self.delayReduction = LUI.UIButtonRepeater.DelayReduction + self.accelInterval = LUI.UIButtonRepeater.AccelInterval + self.minDelay = LUI.UIButtonRepeater.MinDelay + self.handleGamepadButton = LUI.UIButtonRepeater.HandleGamepadButton + self.cancelRepetition = LUI.UIButtonRepeater.CancelRepetition + self.sendButtonRepeat = LUI.UIButtonRepeater.SendButtonRepeat + self.setMinDelay = LUI.UIButtonRepeater.SetMinDelay + self.enable = LUI.UIButtonRepeater.Enable + self.disable = LUI.UIButtonRepeater.Disable + if not Engine.IsConsoleGame() then + self:addEventHandler( "leftmousedown", LUI.UIButtonRepeater.LeftMouseDown ) + self:addEventHandler( "leftmouseup", LUI.UIButtonRepeater.LeftMouseUp ) + self:setHandleMouseButton( true ) + end + self:registerEventHandler( "repeat", LUI.UIButtonRepeater.Repeat ) + self:registerEventHandler( "accelerate", LUI.UIButtonRepeater.Accelerate ) + return self +end + +LUI.UIButtonRepeater.Enable = function ( f2_arg0 ) + f2_arg0.m_disabled = false +end + +LUI.UIButtonRepeater.Disable = function ( f3_arg0 ) + f3_arg0.m_disabled = true + f3_arg0:cancelRepetition() +end + +LUI.UIButtonRepeater.SetMinDelay = function ( f4_arg0, f4_arg1 ) + f4_arg0.minDelay = math.max( 1, f4_arg1 ) +end + +LUI.UIButtonRepeater.LeftMouseDown = function ( f5_arg0, f5_arg1 ) + if "leftmouse" == f5_arg0.buttonName and not f5_arg1.buttonRepeat then + f5_arg0:cancelRepetition() + if f5_arg0.m_disabled then + return false + end + f5_arg0.controller = f5_arg1.controller + local self = LUI.UITimer.new( f5_arg0.firstDelay, { + name = "repeat", + numRepeats = 1 + } ) + f5_arg0:addElement( self ) + f5_arg0.repeatTimer = self + end +end + +LUI.UIButtonRepeater.LeftMouseUp = function ( f6_arg0, f6_arg1 ) + if "leftmouse" == f6_arg0.buttonName and not f6_arg1.buttonRepeat then + f6_arg0:cancelRepetition() + end +end + +LUI.UIButtonRepeater.HandleGamepadButton = function ( f7_arg0, f7_arg1 ) + if LUI.UIElement.handleGamepadButton( f7_arg0, f7_arg1 ) then + return true + elseif f7_arg1.button == f7_arg0.buttonName and not f7_arg1.buttonRepeat then + f7_arg0:cancelRepetition() + if f7_arg0.m_disabled then + return false + elseif f7_arg1.down == true then + f7_arg0.controller = f7_arg1.controller + local self = LUI.UITimer.new( f7_arg0.firstDelay, { + name = "repeat", + numRepeats = 1 + } ) + f7_arg0:addElement( self ) + f7_arg0.repeatTimer = self + end + end +end + +LUI.UIButtonRepeater.CancelRepetition = function ( f8_arg0 ) + local f8_local0 = f8_arg0.repeatTimer + if f8_local0 ~= nil then + f8_local0:close() + f8_arg0.repeatTimer = nil + end + local f8_local1 = f8_arg0.accelTimer + if f8_local1 ~= nil then + f8_local1:close() + f8_arg0.accelTimer = nil + end + f8_arg0.currentDelay = nil +end + +LUI.UIButtonRepeater.SendButtonRepeat = function ( f9_arg0 ) + local f9_local0 = f9_arg0.eventTarget + if f9_local0 == nil then + f9_local0 = f9_arg0:getParent() + end + local f9_local1 = f9_arg0.event + f9_local1.controller = f9_arg0.controller + return f9_local0:processEvent( f9_local1 ) +end + +LUI.UIButtonRepeater.Repeat = function ( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0.repeatTimer + local f10_local1 = f10_arg1.numRepeats + if f10_arg0.currentDelay == nil then + f10_local0.interval = f10_arg0.delay + if f10_arg0.accelTimer == nil then + local accelTimer = LUI.UITimer.new( f10_arg0.accelInterval, "accelerate" ) + accelTimer.id = "accelTimer" + f10_arg0:addElement( accelTimer ) + f10_arg0.accelTimer = accelTimer + + end + else + f10_local0.interval = f10_arg0.currentDelay + end + f10_arg0:sendButtonRepeat() + f10_arg1.numRepeats = f10_local1 + 1 +end + +LUI.UIButtonRepeater.Accelerate = function ( f11_arg0, f11_arg1 ) + local f11_local0 = f11_arg0.currentDelay + if f11_local0 == nil then + f11_local0 = f11_arg0.delay + else + f11_local0 = f11_local0 - f11_arg0.delayReduction + if f11_local0 < f11_arg0.minDelay then + f11_local0 = f11_arg0.minDelay + end + end + f11_arg0.currentDelay = f11_local0 +end + diff --git a/lui/luicharacterwindow.dec.lua b/lui/luicharacterwindow.dec.lua new file mode 100644 index 0000000..a8381b9 --- /dev/null +++ b/lui/luicharacterwindow.dec.lua @@ -0,0 +1,19 @@ +LUI.UICharacterWindow = InheritFrom( LUI.UIElement ) +LUI.UICharacterWindow.build = function ( f1_arg0, f1_arg1 ) + return LUI.UICharacterWindow.new( f1_arg1 ) +end + +LUI.UICharacterWindow.new = function ( f2_arg0 ) + local self = LUI.UIElement.new() + self:setupCharacterWindow() + self:setClass( LUI.UICharacterWindow ) + return self +end + +LUI.UICharacterWindow.setCharacterHandle = function ( f3_arg0, f3_arg1 ) + if LUI.UIElement.setCharacterHandleInC ~= nil then + f3_arg0:setCharacterHandleInC( f3_arg1 ) + end +end + +LUI.UICharacterWindow.id = "LUICharacterWindow" diff --git a/lui/luicountdown.dec.lua b/lui/luicountdown.dec.lua new file mode 100644 index 0000000..e43dd38 --- /dev/null +++ b/lui/luicountdown.dec.lua @@ -0,0 +1,40 @@ +LUI.UICountdown = InheritFrom( LUI.UIElement ) +LUI.UICountdown.build = function ( f1_arg0, f1_arg1 ) + return LUI.UICountdown.new( f1_arg1 ) +end + +LUI.UICountdown.new = function ( f2_arg0 ) + local self = LUI.UIElement.new() + if not f2_arg0 then + f2_arg0 = {} + end + if LUI.UIElement.setupUICountdown ~= nil then + if f2_arg0.endTime == "round_end" then + self:setupUICountdown() + else + self:setupUICountdown( f2_arg0.endTime or 0 ) + end + end + self:setClass( LUI.UICountdown ) + return self +end + +LUI.UICountdown.freeze = function ( f3_arg0 ) + f3_arg0.m_frozen = true +end + +LUI.UICountdown.unfreeze = function ( f4_arg0 ) + f4_arg0.m_frozen = false +end + +LUI.UICountdown.setEndTime = function ( f5_arg0, f5_arg1 ) + if LUI.UIElement.setEndTimeInC ~= nil then + f5_arg0:setEndTimeInC( f5_arg1 ) + end +end + +LUI.UICountdown.setTextStyle = function ( f6_arg0, f6_arg1 ) + f6_arg0.m_textStyle = f6_arg1 +end + +LUI.UICountdown.id = "LUICountdown" diff --git a/lui/luielement.dec.lua b/lui/luielement.dec.lua new file mode 100644 index 0000000..40cc431 --- /dev/null +++ b/lui/luielement.dec.lua @@ -0,0 +1,730 @@ +LUI.UIElement = { + id = "LUIElement", + m_defaultAnimationState = { + left = 0, + top = 0, + right = 0, + bottom = 0, + leftAnchor = false, + topAnchor = false, + bottomAnchor = false, + rightAnchor = false, + red = 1, + green = 1, + blue = 1, + alpha = 1, + alphaMultiplier = 1 + } +} +LUI.UIElement.addChildRecord = function ( f1_arg0, f1_arg1 ) + local f1_local0 = rawget + local f1_local1 = getmetatable( f1_arg1 ) + f1_local0 = f1_local0( f1_local1.__newindex, "id" ) + if f1_local0 ~= nil then + if not f1_arg0.childRecord then + f1_arg0.childRecord = {} + end + if f1_arg0.childRecord[f1_local0] ~= nil then + DebugPrint( "LUI Warning: Element has duplicate raw id \"" .. f1_local0 .. "\" id .. \"" .. f1_arg1.id .. "\", closing it" ) + f1_arg0.childRecord[f1_local0]:close() + end + f1_arg0.childRecord[f1_local0] = f1_arg1 + end +end + +LUI.UIElement.removeChildRecord = function ( f2_arg0, f2_arg1 ) + local f2_local0 = rawget + local f2_local1 = getmetatable( f2_arg1 ) + f2_local0 = f2_local0( f2_local1.__newindex, "id" ) + if f2_local0 ~= nil then + if f2_arg0.childRecord and f2_arg0.childRecord[f2_local0] then + f2_arg0.childRecord[f2_local0] = nil + else + DebugPrint( "LUI Warning: Removing element from an element which does not contain it: \"" .. f2_local0 .. "\"" ) + end + end +end + +LUI.UIElement.addElement = function ( f3_arg0, f3_arg1 ) + if f3_arg0:canAddElement( f3_arg1 ) then + f3_arg0:addElementToC( f3_arg1 ) + f3_arg0:addChildRecord( f3_arg1 ) + end +end + +LUI.UIElement.addElementBefore = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg1:getParent() + if not f4_local0 then + error( "LUI Error: Element has no parent!" ) + return + elseif f4_local0:canAddElement( f4_arg0 ) then + f4_arg0:addElementBeforeInC( f4_arg1 ) + f4_local0:addChildRecord( f4_arg0 ) + end +end + +LUI.UIElement.addElementAfter = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg1:getParent() + if not f5_local0 then + error( "LUI Error: Element has no parent!" ) + return + elseif f5_local0:canAddElement( f5_arg0 ) then + f5_arg0:addElementAfterInC( f5_arg1 ) + f5_local0:addChildRecord( f5_arg0 ) + end +end + +LUI.UIElement.removeElement = function ( f6_arg0, f6_arg1 ) + if f6_arg0.removeElementInC then + f6_arg0:removeElementInC( f6_arg1 ) + f6_arg0:removeChildRecord( f6_arg1 ) + end +end + +LUI.UIElement.canAddElement = function ( f7_arg0, f7_arg1 ) + if f7_arg1 == nil then + error( "LUI Error: Tried to add nil element!" ) + return false + elseif f7_arg1:getParent() == f7_arg0 then + return false + else + return true + end +end + +LUI.UIElement.isClosed = function ( f8_arg0 ) + return f8_arg0:getParent() == nil +end + +LUI.UIElement.close = function ( f9_arg0 ) + local f9_local0 = f9_arg0:getParent() + if f9_local0 ~= nil then + f9_local0:removeElement( f9_arg0 ) + end +end + +LUI.UIElement.closeChildren = function ( f10_arg0 ) + local f10_local0 = f10_arg0:getFirstChild() + if not f10_local0 then + return + end + while f10_local0 do + local f10_local1 = f10_local0:getNextSibling() + f10_local0:close() + f10_local0 = f10_local1 + end +end + +LUI.UIElement.closeTree = function ( f11_arg0 ) + local f11_local0 = f11_arg0:getFirstChild() + while f11_local0 do + local f11_local1 = f11_local0:getNextSibling() + f11_local0:closeTree() + f11_local0 = f11_local1 + end + local f11_local1 = f11_arg0:getParent() + if f11_local1 ~= nil then + f11_local1:removeElementInC( f11_arg0 ) + f11_local1:removeChildRecord( f11_arg0 ) + end +end + +LUI.UIElement.getFullID = function ( f12_arg0 ) + local f12_local0 = f12_arg0.id + local f12_local1 = f12_arg0:getParent() + while f12_local1 do + f12_local0 = f12_local1.id .. "/" .. f12_local0 + f12_local1 = f12_local1:getParent() + end + return f12_local0 +end + +LUI.UIElement.getChildById = function ( f13_arg0, f13_arg1 ) + return f13_arg0.childRecord and f13_arg0.childRecord[f13_arg1] +end + +LUI.UIElement.getFirstDescendentById = function ( f14_arg0, f14_arg1 ) + local f14_local0 = f14_arg0.childRecord + if f14_local0 then + f14_local0 = f14_arg0.childRecord[f14_arg1] + end + if f14_local0 ~= nil then + return f14_local0 + end + f14_local0 = f14_arg0:getFirstChild() + while f14_local0 ~= nil do + local f14_local1 = f14_local0:getFirstDescendentById( f14_arg1 ) + if f14_local1 ~= nil then + return f14_local1 + end + f14_local0 = f14_local0:getNextSibling() + end + return nil +end + +LUI.UIElement.setHandleMouse = function ( f15_arg0, f15_arg1 ) + f15_arg0.handleMouseMove = f15_arg1 + f15_arg0.handleMouseButton = f15_arg1 +end + +LUI.UIElement.setHandleMouseMove = function ( f16_arg0, f16_arg1 ) + f16_arg0.handleMouseMove = f16_arg1 +end + +LUI.UIElement.setHandleMouseButton = function ( f17_arg0, f17_arg1 ) + f17_arg0.handleMouseButton = f17_arg1 +end + +LUI.UIElement.MouseMoveEvent = function ( f18_arg0, f18_arg1 ) + if f18_arg0.m_ignoreMouseFocus or f18_arg0.m_outsideParentList or f18_arg0.m_focusLockedByScrolling then + return + elseif not Engine.UsesMouseCursor() then + return + elseif not Engine.InFrontend() and not LUI.UIRoot.mouseInitialized then + LUI.UIRoot.mouseInitialized = true + return true + end + local f18_local0 = false + f18_arg0:applyElementTransform() + if f18_arg0.handleMouseMove and not f18_arg1.waitingForKeyBind then + local f18_local1, f18_local2 = ProjectRootCoordinate( f18_arg1.rootName, f18_arg1.x, f18_arg1.y ) + if f18_local1 == nil or f18_local2 == nil then + f18_arg0:undoElementTransform() + return + end + local f18_local3 = false + local f18_local4, f18_local5, f18_local6, f18_local7 = f18_arg0:getRect() + if f18_arg1.mouse_outside == nil and f18_local4 ~= nil and f18_local5 <= f18_local2 and f18_local2 <= f18_local7 and f18_local4 <= f18_local1 and f18_local1 <= f18_local6 then + f18_local3 = true + end + if f18_local3 then + if f18_arg0:canFocus( FocusType.MouseOver ) and not f18_arg0:isInFocus() then + f18_arg0:processEvent( { + name = "gain_focus", + focusType = FocusType.MouseOver + } ) + local f18_local8 = f18_arg0:getParent() + if f18_local8:isIDNamed() then + f18_local8.shouldSaveState = true + end + end + if f18_arg0.m_mouseOver == nil then + f18_arg0.m_mouseOver = true + if f18_arg0.m_eventHandlers.mouseenter ~= nil then + f18_arg0.m_eventHandlers:mouseenter( { + name = "mouseenter", + controller = f18_arg1.controller, + root = f18_arg1.root, + x = f18_local1, + y = f18_local2 + } ) + end + end + if f18_arg0.m_eventHandlers.mouseover ~= nil then + f18_arg0.m_eventHandlers:mouseover( { + name = "mouseover", + controller = f18_arg1.controller, + root = f18_arg1.root, + x = f18_local1, + y = f18_local2 + } ) + end + else + if f18_arg0:isInFocus() then + f18_arg0:processEvent( { + name = "lose_focus" + } ) + end + if f18_arg0.m_mouseOver ~= nil then + f18_arg0.m_mouseOver = nil + if f18_arg0.m_eventHandlers.mouseleave ~= nil then + f18_arg0.m_eventHandlers:mouseleave( { + name = "mouseleave", + controller = f18_arg1.controller, + root = f18_arg1.root + } ) + end + end + end + if not f18_local3 and f18_arg1.mouse_outside == nil then + f18_arg1.mouse_outside = true + f18_local0 = true + end + end + f18_arg0:dispatchEventToChildren( f18_arg1 ) + if f18_arg0.shouldSaveState then + f18_arg0:saveState() + f18_arg0.shouldSaveState = nil + end + if f18_local0 then + f18_arg1.mouse_outside = nil + end + f18_arg0:undoElementTransform() +end + +LUI.UIElement.MouseButtonEvent = function ( f19_arg0, f19_arg1 ) + if f19_arg0.m_ignoreMouseFocus or f19_arg0.m_outsideParentList or f19_arg0.m_focusLockedByScrolling then + return + end + f19_arg0:applyElementTransform() + if f19_arg0.handleMouseButton then + local f19_local0, f19_local1 = ProjectRootCoordinate( f19_arg1.rootName, f19_arg1.x, f19_arg1.y ) + if f19_local0 == nil or f19_local1 == nil then + f19_arg0:undoElementTransform() + return + end + local f19_local2 = false + local f19_local3, f19_local4, f19_local5, f19_local6 = f19_arg0:getRect() + if f19_arg1.mouse_outside == nil and f19_local3 ~= nil and f19_local4 <= f19_local1 and f19_local1 <= f19_local6 and f19_local3 <= f19_local0 and f19_local0 <= f19_local5 then + f19_local2 = true + end + if f19_arg1.name == "mouseup" then + if f19_arg1.button == "left" and f19_arg0.m_leftMouseDown ~= nil then + f19_arg0.m_leftMouseDown = nil + if f19_arg0.m_eventHandlers.leftmouseup ~= nil then + local f19_local7 = f19_arg0.m_eventHandlers:leftmouseup( { + name = "leftmouseup", + controller = f19_arg1.controller, + root = f19_arg1.root, + x = f19_local0, + y = f19_local1, + inside = f19_local2 + } ) + if f19_local7 then + f19_arg0:undoElementTransform() + return f19_local7 + end + end + end + if f19_arg1.button == "right" and f19_arg0.m_rightMouseDown ~= nil then + f19_arg0.m_rightMouseDown = nil + if f19_arg0.m_eventHandlers.rightmouseup ~= nil then + local f19_local7 = f19_arg0.m_eventHandlers:rightmouseup( { + name = "rightmouseup", + controller = f19_arg1.controller, + root = f19_arg1.root, + x = f19_local0, + y = f19_local1, + inside = f19_local2 + } ) + if f19_local7 then + f19_arg0:undoElementTransform() + return f19_local7 + end + end + end + end + if f19_local2 and f19_arg1.name == "mousedown" then + if f19_arg1.button == "left" and f19_arg0.m_eventHandlers.leftmousedown ~= nil and f19_arg0.m_leftMouseDown == nil then + f19_arg0.m_leftMouseDown = true + f19_arg0.m_eventHandlers:leftmousedown( { + name = "leftmousedown", + controller = f19_arg1.controller, + root = f19_arg1.root, + x = f19_local0, + y = f19_local1, + inside = f19_local2 + } ) + end + if f19_arg1.button == "right" and f19_arg0.m_eventHandlers.rightmousedown ~= nil and f19_arg0.m_rightMouseDown == nil then + f19_arg0.m_rightMouseDown = true + f19_arg0.m_eventHandlers:rightmousedown( { + name = "rightmousedown", + controller = f19_arg1.controller, + root = f19_arg1.root, + x = f19_local0, + y = f19_local1, + inside = f19_local2 + } ) + end + end + if f19_arg0.m_eventHandlers.mousedrag ~= nil and f19_arg0.m_leftMouseDown ~= nil then + f19_arg0.m_eventHandlers:mousedrag( { + name = "mousedrag", + controller = f19_arg1.controller, + root = f19_arg1.root, + x = f19_local0, + y = f19_local1 + } ) + end + end + f19_arg0:dispatchEventToChildren( f19_arg1 ) + f19_arg0:undoElementTransform() +end + +LUI.UIElement.GamepadButton = function ( f20_arg0, f20_arg1 ) + if not f20_arg0:handleGamepadButton( f20_arg1 ) then + if f20_arg0.m_ownerController == nil or f20_arg0.m_ownerController == f20_arg1.controller then + return f20_arg0:dispatchEventToChildren( f20_arg1 ) + else + DebugPrint( "Item Exclusive to controller " .. f20_arg1.controller ) + + end + else + return true + end +end + +LUI.UIElement.handleGamepadButton = function ( f21_arg0, f21_arg1 ) + if f21_arg0:isInFocus() and f21_arg1.down == true and f21_arg0.m_disableNavigation ~= true and f21_arg0.navigation[f21_arg1.button] and f21_arg0.navigation[f21_arg1.button]:canFocus( FocusType.Gamepad ) then + local f21_local0 = f21_arg0:getParent() + if f21_local0:isIDNamed() then + f21_local0:saveState() + end + f21_arg0:processEvent( { + name = "lose_focus", + controller = f21_arg1.controller + } ) + f21_arg0.navigation[f21_arg1.button]:processEvent( { + name = "gain_focus", + controller = f21_arg1.controller + } ) + if f21_local0:isIDNamed() and f21_local0 == f21_arg0.navigation[f21_arg1.button]:getParent() then + f21_local0:saveState() + end + return true + else + + end +end + +LUI.UIElement.disableTreeFocus = function ( f22_arg0, f22_arg1 ) + f22_arg0.m_disableTreeFocus = true +end + +LUI.UIElement.enableTreeFocus = function ( f23_arg0, f23_arg1 ) + f23_arg0.m_disableTreeFocus = nil +end + +LUI.UIElement.canFocus = function ( f24_arg0, f24_arg1 ) + local f24_local0 = f24_arg0.m_focusable + if f24_local0 and f24_arg0.m_requireFocusType then + f24_local0 = f24_arg1 == f24_arg0.m_requireFocusType + end + return f24_local0 +end + +LUI.UIElement.gainFocus = function ( f25_arg0, f25_arg1 ) + if f25_arg0:canFocus( f25_arg1.focusType ) then + f25_arg0:setFocus( true ) + end + if not f25_arg0.m_disableTreeFocus then + f25_arg0:dispatchEventToChildren( f25_arg1 ) + end +end + +LUI.UIElement.loseFocus = function ( f26_arg0, f26_arg1 ) + if f26_arg0.m_focusable and f26_arg0:isInFocus() then + f26_arg0:setFocus( false ) + end + f26_arg0:dispatchEventToChildren( f26_arg1 ) +end + +LUI.UIElement.processEvent = function ( f27_arg0, f27_arg1 ) + local f27_local0 = f27_arg0.m_eventHandlers[f27_arg1.name] + if f27_local0 ~= nil then + if f27_arg1.dispatchChildren then + f27_arg0:dispatchEventToChildren( f27_arg1 ) + end + return f27_local0( f27_arg0, f27_arg1 ) + else + return f27_arg0:dispatchEventToChildren( f27_arg1 ) + end +end + +LUI.UIElement.dispatchEventToParent = function ( f28_arg0, f28_arg1 ) + local f28_local0 = f28_arg0:getParent() + while f28_local0 do + local f28_local1 = f28_local0.m_eventHandlers[f28_arg1.name] + if f28_local1 then + if f28_arg1.dispatchChildren then + f28_local0:dispatchEventToChildren( f28_arg1 ) + end + return f28_local1( f28_local0, f28_arg1 ) + end + f28_local0 = f28_local0:getParent() + end +end + +LUI.UIElement.dispatchEventToMenuRoot = function ( f29_arg0, f29_arg1 ) + local f29_local0 = f29_arg0 + local f29_local1 = f29_arg0:getParent() + local f29_local2 = f29_arg0:getRootParent() + if f29_local2.flowManager and f29_local2.flowManager.menuRoot then + local f29_local3 = f29_local2.flowManager.menuRoot + while f29_local1 do + if f29_local1 == f29_local3 then + return f29_local0:processEvent( f29_arg1 ) + end + f29_local0 = f29_local1 + f29_local1 = f29_local1:getParent() + end + end + DebugPrint( "LUI Warning: Could not find the Menu Root for " .. f29_arg1.name .. " called on elemment id " .. (f29_arg0.id or "anonymous element") ) +end + +LUI.UIElement.dispatchEventToChildren = function ( f30_arg0, f30_arg1 ) + local f30_local0 = f30_arg0:getFirstChild() + while f30_local0 do + local f30_local1 = f30_local0:getNextSibling() + local f30_local2 = f30_local0:processEvent( f30_arg1 ) + if f30_local2 then + return f30_local2 + end + f30_local0 = f30_local1 + end +end + +LUI.UIElement.getRootParent = function ( f31_arg0 ) + return Engine.GetLuiRoot() +end + +LUI.UIElement.dispatchEventToRoot = function ( f32_arg0, f32_arg1 ) + LUI.UIRoot.ProcessEvent( f32_arg0:getRootParent(), f32_arg1 ) +end + +LUI.UIElement.dispatchEventToAllOtherRoots = function ( f33_arg0, f33_arg1 ) + local f33_local0 = f33_arg0:getRootParent() + for f33_local4, f33_local5 in pairs( LUI.roots ) do + if f33_local0 ~= f33_local5 and f33_local5 ~= LUI.primaryRoot then + f33_local5:processEvent( f33_arg1 ) + end + end +end + +LUI.UIElement.getRootController = function ( f34_arg0 ) + local f34_local0 = f34_arg0:getRootParent() + return f34_local0.m_controllerIndex +end + +LUI.UIElement.registerEventHandler = function ( f35_arg0, f35_arg1, f35_arg2 ) + f35_arg0.m_eventHandlers[f35_arg1] = f35_arg2 + if not f35_arg0.isaroot and LUI.EventCatcher.isDirectDispatchEventType( f35_arg1 ) then + local f35_local0 = f35_arg0:getRootParent() + f35_local0.eventCatcher:registerDirectDispatchHandler( f35_arg0, f35_arg1, f35_arg2 ) + end +end + +LUI.UIElement.registerOmnvarHandler = function ( f36_arg0, f36_arg1, f36_arg2 ) + assert( not f36_arg0.isaroot ) + local f36_local0 = f36_arg0:getRootParent() + f36_local0.eventCatcher:registerOmnvarHandler( f36_arg0, f36_arg1, f36_arg2 ) +end + +LUI.UIElement.registerDvarHandler = function ( f37_arg0, f37_arg1, f37_arg2 ) + assert( not f37_arg0.isaroot ) + local f37_local0 = f37_arg0:getRootParent() + f37_local0.eventCatcher:registerDvarHandler( f37_arg0, f37_arg1, f37_arg2 ) +end + +LUI.UIElement.registerEventHandlerIfFree = function ( f38_arg0, f38_arg1, f38_arg2 ) + if f38_arg0.m_eventHandlers[f38_arg1] == nil then + f38_arg0:registerEventHandler( f38_arg1, f38_arg2 ) + end +end + +local f0_local0 = function ( f39_arg0, f39_arg1 ) + local f39_local0 = f39_arg0 + local f39_local1 = f39_arg1 + return function ( f40_arg0, f40_arg1 ) + local f40_local0, f40_local1 = nil + return f39_local0( f40_arg0, f40_arg1 ) or f39_local1( f40_arg0, f40_arg1 ) + end + +end + +LUI.UIElement.addEventHandler = function ( f41_arg0, f41_arg1, f41_arg2 ) + if f41_arg0.m_eventHandlers[f41_arg1] then + f41_arg0:registerEventHandler( f41_arg1, f0_local0( f41_arg2, f41_arg0.m_eventHandlers[f41_arg1] ) ) + else + f41_arg0:registerEventHandler( f41_arg1, f41_arg2 ) + end +end + +LUI.UIElement.makeFocusable = function ( f42_arg0 ) + f42_arg0.m_focusable = true + f42_arg0.navigation = {} +end + +LUI.UIElement.makeNotFocusable = function ( f43_arg0 ) + f43_arg0.m_focusable = false +end + +LUI.UIElement.isIDNamed = function ( f44_arg0 ) + local f44_local0 + if type( f44_arg0.id ) ~= "string" or f44_arg0.id == "" then + f44_local0 = false + else + f44_local0 = true + end + return f44_local0 +end + +LUI.UIElement.getFirstInFocus = function ( f45_arg0 ) + if f45_arg0:isInFocus() then + return f45_arg0 + end + local f45_local0 = f45_arg0:getFirstChild() + while f45_local0 do + local f45_local1 = f45_local0:getFirstInFocus() + if f45_local1 then + return f45_local1 + end + f45_local0 = f45_local0:getNextSibling() + end +end + +LUI.UIElement.getAllFocusedChildren = function ( f46_arg0, f46_arg1 ) + if not f46_arg1 then + f46_arg1 = {} + end + local f46_local0 = f46_arg0:getFirstChild() + while f46_local0 do + local f46_local1 = f46_local0:getNextSibling() + if f46_local0:isInFocus() then + f46_arg1[#f46_arg1 + 1] = f46_local0 + else + f46_arg1 = f46_local0:getAllFocusedChildren( f46_arg1 ) + end + f46_local0 = f46_local1 + end + return f46_arg1 +end + +LUI.UIElement.isParentInFocus = function ( f47_arg0 ) + local f47_local0 = f47_arg0:getParent() + if f47_local0 and f47_local0:isInFocus() then + return true + else + return false + end +end + +LUI.UIElement.saveState = function ( f48_arg0 ) + if not f48_arg0:isIDNamed() then + error( "LUI Error: Tried to save menu state, but element has no name: " .. f48_arg0:getFullID() ) + return + end + LUI.savedMenuStates[f48_arg0.id] = {} + for f48_local3, f48_local4 in ipairs( f48_arg0:getAllFocusedChildren() ) do + if not f48_local4:isIDNamed() then + error( "LUI Error: Tried to save menu state, but focused element has no name: " .. f48_local4:getFullID() ) + return + end + LUI.savedMenuStates[f48_arg0.id][#LUI.savedMenuStates[f48_arg0.id] + 1] = { + id = f48_local4.id, + data = f48_local4.saveData + } + end +end + +LUI.UIElement.clearSavedState = function ( f49_arg0 ) + if not f49_arg0:isIDNamed() then + error( "LUI Error: Tried to save menu state, but element has no name: " .. f49_arg0:getFullID() ) + return + end + local f49_local0 = f49_arg0:getFirstChild() + while f49_local0 do + local f49_local1 = f49_local0:getNextSibling() + f49_local0:clearSavedState() + f49_local0 = f49_local1 + end + LUI.savedMenuStates[f49_arg0.id] = nil +end + +LUI.UIElement.restoreState = function ( f50_arg0, f50_arg1 ) + if not f50_arg0:isIDNamed() then + error( "LUI Error: Tried to restore menu state, but element has no name: " .. f50_arg0:getFullID() ) + return + end + local f50_local0 = false + local f50_local1 = 0 + if LUI.savedMenuStates[f50_arg0.id] ~= nil then + f50_local0 = true + for f50_local5, f50_local6 in ipairs( LUI.savedMenuStates[f50_arg0.id] ) do + if f50_local6.id and f50_arg0:processEvent( { + name = "restore_focus", + id = f50_local6.id, + data = f50_local6.data, + isRefresh = f50_arg1 + } ) then + f50_local1 = f50_local1 + 1 + end + end + end + return f50_local0, f50_local1 +end + +LUI.UIElement.restoreFocus = function ( f51_arg0, f51_arg1 ) + if f51_arg0.id == f51_arg1.id and f51_arg0:canFocus( FocusType.MenuFlow ) then + if not f51_arg1.isRefresh or f51_arg1.isRefresh and not f51_arg0._isRefresh then + f51_arg0:processEvent( { + name = "gain_focus", + focusType = FocusType.MenuFlow + } ) + end + return true + else + return f51_arg0:dispatchEventToChildren( f51_arg1 ) + end +end + +if not LUI.UIElement.hasAnimationState then + LUI.UIElement.hasAnimationState = function ( f52_arg0, f52_arg1 ) + if not f52_arg0.hasAnimationStateInC then + return f52_arg0.m_animationStates[f52_arg1] + else + return f52_arg0:hasAnimationStateInC( f52_arg1 ) + end + end + +end +LUI.UIElement.setClass = function ( f53_arg0, f53_arg1 ) + local f53_local0 = getmetatable( f53_arg0 ) + local f53_local1 = f53_local0.__newindex + local f53_local2 = getmetatable( f53_local1 ) + if not f53_local2 then + setmetatable( f53_local1, { + __index = f53_arg1 + } ) + else + f53_local2.__index = f53_arg1 + end + local f53_local3 = getmetatable( f53_local1.m_eventHandlers ) + if not f53_local3 then + setmetatable( f53_local1.m_eventHandlers, { + __index = f53_arg1.m_eventHandlers + } ) + else + f53_local3.__index = f53_arg1.m_eventHandlers + end +end + +LUI.UIElement.m_eventHandlers = { + mousemove = LUI.UIElement.MouseMoveEvent, + mousedown = LUI.UIElement.MouseButtonEvent, + mouseup = LUI.UIElement.MouseButtonEvent, + gamepad_button = LUI.UIElement.GamepadButton, + gain_focus = LUI.UIElement.gainFocus, + lose_focus = LUI.UIElement.loseFocus, + restore_focus = LUI.UIElement.restoreFocus, + close = LUI.UIElement.close +} +LUI.UIElement.build = function ( f54_arg0, f54_arg1 ) + return LUI.UIElement.new() +end + +LUI.UIElement.new = function ( f55_arg0 ) + local f55_local0 = ConstructLUIElement() + LUI.UIElement.setClass( f55_local0, LUI.UIElement ) + f55_local0._scoped = LUI.ActiveScoped + f55_local0:setLayoutCached( false ) + if not f55_arg0 then + f55_local0:registerAnimationState( "default", LUI.UIElement.m_defaultAnimationState ) + else + f55_local0:registerAnimationState( "default", f55_arg0 ) + end + f55_local0:animateToState( "default" ) + return f55_local0 +end + diff --git a/lui/luigrid.dec.lua b/lui/luigrid.dec.lua new file mode 100644 index 0000000..674d40f --- /dev/null +++ b/lui/luigrid.dec.lua @@ -0,0 +1,289 @@ +LUI.UIGrid = {} +LUI.UIGrid.build = function ( f1_arg0, f1_arg1 ) + return LUI.UIGrid.new( nil, f1_arg1 ) +end + +LUI.UIGrid.new = function ( menu, controller ) + local self = LUI.UIElement.new( menu ) + self.id = "LUIGrid" + if not controller then + controller = {} + end + self.width = math.max( 1, controller.elementsPerRow or 5 ) + self.rowHeight = controller.rowHeight or 80 + self.disableHWrap = controller.disableHWrap or false + self.hSpacing = controller.hSpacing or 0 + local f2_local1 = controller.hAlign + if not f2_local1 then + f2_local1 = LUI.Alignment.Left + end + self.hAlign = f2_local1 + self.vlist = LUI.UIVerticalList.new( nil, controller.scrollByChildHeight, nil, controller.sendScrollEvents ) + LUI.UIVerticalList.SetNoWrap( self.vlist, controller.disableVWrap ) + f2_local1 = self.vlist + local f2_local2 = f2_local1 + f2_local1 = f2_local1.registerAnimationState + local f2_local3 = "default" + local f2_local4 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + spacing = controller.vSpacing or 0 + } + local f2_local5 = controller.vAlign + if not f2_local5 then + f2_local5 = LUI.Alignment.Top + end + f2_local4.alignment = f2_local5 + f2_local1( f2_local2, f2_local3, f2_local4 ) + self.vlist:animateToState( "default" ) + self:addElement( self.vlist ) + if controller.sendScrollEvents then + self:registerEventHandler( "list_scroll", function ( element, event ) + if not event.repeatCatch then + event.repeatCatch = true + local f3_local0 = element:getParent() + f3_local0:processEvent( event ) + end + end ) + end + self.addRow = LUI.UIGrid.AddRow + self.addElement = LUI.UIGrid.AddElement + self.removeElement = LUI.UIGrid.RemoveElement + self.shiftFirstElementFromNextRow = LUI.UIGrid.ShiftFirstElementFromNextRow + self.rowEmptinessCheck = LUI.UIGrid.RowEmptinessCheck + self.updateNavigation = LUI.UIGrid.UpdateNavigation + self.updateRowFocusability = LUI.UIGrid.UpdateRowFocusability + self.getChildById = LUI.UIGrid.GetChildById + self.getAllFocusedChildren = LUI.UIGrid.GetAllFocusedChildren + self.clearSavedState = LUI.UIGrid.ClearSavedState + self:registerEventHandler( "update_navigation", self.updateNavigation ) + return self +end + +LUI.UIGrid.GetAllFocusedChildren = function ( f4_arg0 ) + local f4_local0 = {} + local f4_local1 = f4_arg0.vlist:getFirstChild() + while f4_local1 do + for f4_local5, f4_local6 in ipairs( f4_local1:getAllFocusedChildren() ) do + table.insert( f4_local0, f4_local6 ) + end + f4_local1 = f4_local1:getNextSibling() + end + return f4_local0 +end + +LUI.UIGrid.ClearSavedState = function ( f5_arg0 ) + LUI.UIElement.clearSavedState( f5_arg0 ) + local f5_local0 = f5_arg0.vlist:getFirstChild() + while f5_local0 do + f5_local0.listDefaultFocus = nil + local f5_local1 = f5_local0:getFirstChild() + while f5_local1 do + f5_local1.listDefaultFocus = nil + f5_local1 = f5_local1:getNextSibling() + end + f5_local0 = f5_local0:getNextSibling() + end +end + +LUI.UIGrid.GetChildById = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0.vlist:getFirstChild() + while f6_local0 do + local f6_local1 = f6_local0:getChildById( f6_arg1 ) + if f6_local1 then + return f6_local1 + end + f6_local0 = f6_local0:getNextSibling() + end +end + +LUI.UIGrid.AddRow = function ( f7_arg0 ) + local f7_local0 = f7_arg0.vlist:getLastChild() + local f7_local1 = f7_arg0 + local self = LUI.UIHorizontalList.new() + LUI.UIHorizontalList.SetNoWrap( self, f7_local1.disableHWrap ) + self.id = "row_" .. f7_arg0.vlist:getNumChildren() + self.removeElement = function ( f8_arg0, f8_arg1 ) + f7_local1:removeElement( f8_arg1 ) + end + + self:makeNotFocusable() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f7_arg0.rowHeight, + left = 0, + right = 0, + spacing = f7_arg0.hSpacing, + alignment = f7_arg0.hAlign + } ) + self:registerEventHandler( "menu_refresh", function ( element, event ) + f7_local1:processEvent( event ) + end ) + self:animateToState( "default" ) + f7_arg0.vlist:addElement( self ) + if f7_local0 then + LUI.UIHorizontalList.UpdateNavigation( f7_local0 ) + end + local f7_local3 = f7_arg0.vlist:getFirstChild() + if f7_local3 then + LUI.UIHorizontalList.UpdateNavigation( f7_local3 ) + end +end + +LUI.UIGrid.AddElement = function ( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0 + local f10_local1 = f10_local0.vlist:getLastChild() + local f10_local2 + if f10_local1 ~= nil and f10_arg0.width > f10_local1:getNumChildren() then + f10_local2 = false + else + f10_local2 = true + end + if f10_local2 then + f10_arg0:addRow() + end + f10_local1 = f10_local0.vlist:getLastChild() + f10_local1:addElement( f10_arg1 ) + if f10_arg1.listDefaultFocus then + f10_local1.listDefaultFocus = true + end + f10_arg0:updateNavigation() + local f10_local3 = function ( f11_arg0, f11_arg1 ) + local f11_local0 = 1 + local f11_local1 = f11_arg0:getParent() + f11_local1 = f11_local1:getFirstChild() + while f11_local1 do + if f11_local1 == f11_arg0 then + break + end + f11_local0 = f11_local0 + 1 + f11_local1 = f11_local1:getNextSibling() + end + local f11_local2 = { + name = "grid_navigation_update", + column = f11_local0 + } + f10_local0:clearSavedState() + f10_local0:processEvent( f11_local2 ) + local f11_local3 = f11_arg0:getParent() + f11_local3:setFocus( true ) + end + + if not f10_arg1.hasGridHandlers then + f10_arg1.hasGridHandlers = true + f10_arg1:addEventHandler( "element_refresh", function ( f12_arg0, f12_arg1 ) + if f12_arg0:isInFocus() then + f10_local3( f12_arg0, f12_arg1 ) + end + end ) + f10_arg1:addEventHandler( "button_over", f10_local3 ) + f10_arg1:addEventHandler( "button_over_disable", f10_local3 ) + end + f10_arg1:registerEventHandler( "grid_navigation_update", function ( element, event ) + local f13_local0 = 1 + local f13_local1 = element:getParent() + local f13_local2 = f13_local1:getFirstChild() + while f13_local2 do + if f13_local2 == element then + break + end + f13_local0 = f13_local0 + 1 + f13_local2 = f13_local2:getNextSibling() + end + f13_local1:setFocus( false ) + local f13_local3 = event.column == f13_local0 + local f13_local4 = false + local f13_local5 = true + local f13_local6 = 0 + local f13_local7 = f13_local1:getFirstChild() + while f13_local7 do + if f13_local7.m_focusable then + f13_local6 = f13_local6 + 1 + f13_local5 = f13_local7 == element + f13_local4 = f13_local6 < event.column + end + f13_local7 = f13_local7:getNextSibling() + end + element.listDefaultFocus = f13_local4 and (f13_local3 or f13_local5) + end ) +end + +LUI.UIGrid.RemoveElement = function ( f14_arg0, f14_arg1 ) + local f14_local0 = nil + local f14_local1 = f14_arg0.vlist:getFirstChild() + while f14_local1 do + if f14_arg1:getParent() == f14_local1 then + LUI.UIHorizontalList.RemoveElement( f14_local1, f14_arg1 ) + f14_arg0:shiftFirstElementFromNextRow( f14_local1 ) + f14_arg0:rowEmptinessCheck( f14_local1, f14_local0 ) + break + end + f14_local0 = f14_local1 + f14_local1 = f14_local1:getNextSibling() + end + f14_arg0:updateNavigation() +end + +LUI.UIGrid.UpdateNavigation = function ( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg0.vlist:getFirstChild() + while f15_local0 do + f15_arg0:updateRowFocusability( f15_local0 ) + f15_local0 = f15_local0:getNextSibling() + end + LUI.UIVerticalList.UpdateNavigation( f15_arg0.vlist ) + f15_local0 = f15_arg0.vlist:getFirstChild() + while f15_local0 do + LUI.UIHorizontalList.UpdateNavigation( f15_local0 ) + f15_local0 = f15_local0:getNextSibling() + end +end + +LUI.UIGrid.UpdateRowFocusability = function ( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg1:canFocus() + local f16_local1 = false + local f16_local2 = f16_arg1:getFirstChild() + while f16_local2 do + if f16_local2:canFocus() then + f16_local1 = true + break + end + f16_local2 = f16_local2:getNextSibling() + end + if f16_local1 ~= f16_local0 then + if f16_local1 then + f16_arg1:makeFocusable() + else + f16_arg1:makeNotFocusable() + end + end +end + +LUI.UIGrid.RowEmptinessCheck = function ( f17_arg0, f17_arg1, f17_arg2 ) + if f17_arg1:getNumChildren() == 0 then + f17_arg0.vlist:removeElement( f17_arg1 ) + end +end + +LUI.UIGrid.ShiftFirstElementFromNextRow = function ( f18_arg0, f18_arg1 ) + local f18_local0 = f18_arg1:getNextSibling() + if f18_local0 then + local f18_local1 = f18_local0:getFirstChild() + if f18_local1 then + LUI.UIHorizontalList.RemoveElement( f18_local0, f18_local1 ) + f18_arg0:rowEmptinessCheck( f18_local0, f18_arg1 ) + f18_arg1:addElement( f18_local1 ) + f18_arg0:shiftFirstElementFromNextRow( f18_local0 ) + end + end +end + diff --git a/lui/luihorizontallist.dec.lua b/lui/luihorizontallist.dec.lua new file mode 100644 index 0000000..0ce0ce7 --- /dev/null +++ b/lui/luihorizontallist.dec.lua @@ -0,0 +1,144 @@ +LUI.UIHorizontalList = {} +LUI.UIHorizontalNavigator = {} +local f0_local0 = function ( f1_arg0, f1_arg1, f1_arg2 ) + local self = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = false, + left = 0, + right = f1_arg1, + topAnchor = true, + bottomAnchor = true, + top = 0, + bottom = 0 + } ) + self:setPriority( f1_arg2 ) + f1_arg0:addElement( self ) + return self +end + +LUI.UIHorizontalList.build = function ( menu, controller ) + local self = LUI.UIHorizontalList.new( {} ) + LUI.UIHorizontalList.SetNoWrap( self, controller.noWrap ) + return self +end + +LUI.UIHorizontalList.new = function ( f3_arg0 ) + local self = LUI.UIElement.new( f3_arg0 ) + self.id = "LUIHorizontalList" + self:setupUIHorizontalList() + self.addSpacer = f0_local0 + self.addElement = LUI.UIHorizontalList.AddElement + self.removeElement = LUI.UIHorizontalList.RemoveElement + self.updateNavigation = LUI.UIHorizontalList.UpdateNavigation + self:registerEventHandler( "gain_focus", LUI.UIHorizontalList.gainFocus ) + self:registerEventHandler( "update_navigation", function ( element, event ) + element:updateNavigation() + end ) + return self +end + +LUI.UIHorizontalNavigator.build = function ( menu, controller ) + local self = LUI.UIHorizontalNavigator.new( {}, controller.noWrap ) + LUI.UIHorizontalList.SetNoWrap( self, controller.noWrap ) + return self +end + +LUI.UIHorizontalNavigator.new = function ( f6_arg0 ) + local self = LUI.UIElement.new( f6_arg0 ) + self.id = "LUIHorizontalList" + self.addSpacer = f0_local0 + self.addElement = LUI.UIHorizontalList.AddElement + self.removeElement = LUI.UIHorizontalList.RemoveElement + self.updateNavigation = LUI.UIHorizontalList.UpdateNavigation + self:registerEventHandler( "gain_focus", LUI.UIHorizontalList.gainFocus ) + self:registerEventHandler( "update_navigation", function ( element, event ) + element:updateNavigation() + end ) + return self +end + +LUI.UIHorizontalList.SetNoWrap = function ( f8_arg0, f8_arg1 ) + f8_arg0.noWrap = f8_arg1 +end + +LUI.UIHorizontalList.AddElement = function ( f9_arg0, f9_arg1 ) + LUI.UIElement.addElement( f9_arg0, f9_arg1 ) + f9_arg1.navigation = {} + f9_arg0:setLayoutCached( false ) + f9_arg0:updateNavigation() +end + +LUI.UIHorizontalList.RemoveElement = function ( f10_arg0, f10_arg1 ) + LUI.UIElement.removeElement( f10_arg0, f10_arg1 ) + f10_arg0:setLayoutCached( false ) + f10_arg0:updateNavigation() +end + +LUI.UIHorizontalList.UpdateNavigation = function ( f11_arg0 ) + local f11_local0, f11_local1 = nil + local f11_local2 = f11_arg0:getFirstChild() + while f11_local2 ~= nil do + if f11_local2:canFocus( FocusType.ListSelection ) then + if f11_local0 == nil then + f11_local0 = f11_local2 + end + if f11_local1 ~= nil then + f11_local1.navigation.right = f11_local2 + f11_local2.navigation.left = f11_local1 + else + f11_local2.navigation.left = nil + end + if f11_local2.navigation ~= nil and f11_arg0.navigation ~= nil then + f11_local2.navigation.down = f11_arg0.navigation.down + f11_local2.navigation.up = f11_arg0.navigation.up + end + f11_local1 = f11_local2 + end + f11_local2 = f11_local2:getNextSibling() + end + if f11_local1 ~= nil then + if f11_arg0.navigation ~= nil and f11_arg0.navigation.right ~= nil and f11_arg0.navigation.right:canFocus( FocusType.ListSelection ) == true then + f11_local1.navigation.right = f11_arg0.navigation.right + f11_arg0.navigation.right.navigation.left = f11_local1 + elseif f11_local1 ~= f11_local0 and not f11_arg0.noWrap then + f11_local1.navigation.right = f11_local0 + else + f11_local1.navigation.right = nil + end + if f11_arg0.navigation ~= nil and f11_arg0.navigation.left ~= nil and f11_arg0.navigation.left:canFocus( FocusType.ListSelection ) == true then + f11_local0.navigation.left = f11_arg0.navigation.left + f11_arg0.navigation.left.navigation.right = f11_local0 + elseif f11_local1 ~= f11_local0 and not f11_arg0.noWrap then + f11_local0.navigation.left = f11_local1 + else + f11_local0.navigation.left = nil + end + end +end + +LUI.UIHorizontalList.gainFocus = function ( f12_arg0, f12_arg1 ) + local f12_local0, f12_local1 = f12_arg0:restoreState() + if f12_local1 == 0 then + local f12_local2, f12_local3 = nil + local f12_local4 = f12_arg0:getFirstChild() + while f12_local4 ~= nil do + if f12_local4:canFocus( FocusType.ListSelection ) then + if f12_local2 == nil then + f12_local2 = f12_local4 + end + if f12_local3 == nil and f12_local4.listDefaultFocus then + f12_local3 = f12_local4 + end + end + end + if f12_local3 ~= nil then + f12_local3:processEvent( f12_arg1 ) + elseif f12_local2 ~= nil then + f12_local2:processEvent( f12_arg1 ) + else + + end + f12_local4 = f12_local4:getNextSibling() + end +end + diff --git a/lui/luiimage.dec.lua b/lui/luiimage.dec.lua new file mode 100644 index 0000000..bb8b975 --- /dev/null +++ b/lui/luiimage.dec.lua @@ -0,0 +1,13 @@ +LUI.UIImage = InheritFrom( LUI.UIElement ) +LUI.UIImage.build = function ( f1_arg0, f1_arg1 ) + return LUI.UIImage.new() +end + +LUI.UIImage.new = function ( f2_arg0 ) + local self = LUI.UIElement.new( f2_arg0 ) + self:setClass( LUI.UIImage ) + self:setupUIImage() + return self +end + +LUI.UIImage.id = "LUIImage" diff --git a/lui/luilitimage.dec.lua b/lui/luilitimage.dec.lua new file mode 100644 index 0000000..8c6e14d --- /dev/null +++ b/lui/luilitimage.dec.lua @@ -0,0 +1,13 @@ +LUI.UILitImage = InheritFrom( LUI.UIElement ) +LUI.UILitImage.build = function ( f1_arg0, f1_arg1 ) + return LUI.UILitImage.new() +end + +LUI.UILitImage.new = function ( f2_arg0 ) + local self = LUI.UIElement.new( f2_arg0 ) + self:setClass( LUI.UILitImage ) + self:setupUILitImage() + return self +end + +LUI.UILitImage.id = "LUILitImage" diff --git a/lui/luilongcountdown.dec.lua b/lui/luilongcountdown.dec.lua new file mode 100644 index 0000000..ab75d83 --- /dev/null +++ b/lui/luilongcountdown.dec.lua @@ -0,0 +1,25 @@ +LUI.UILongCountdown = InheritFrom( LUI.UIElement ) +LUI.UILongCountdown.build = function ( f1_arg0, f1_arg1 ) + return LUI.UILongCountdown.new( f1_arg1.end_time ) +end + +LUI.UILongCountdown.new = function ( f2_arg0 ) + local self = LUI.UIElement.new() + if LUI.UIElement.setupUILongCountdown ~= nil then + self:setupUILongCountdown( f2_arg0 ) + end + self:setClass( LUI.UILongCountdown ) + self.setEndTime = LUI.UILongCountdown.setEndTime + if f2_arg0 then + self:setEndTime( f2_arg0 ) + end + return self +end + +LUI.UILongCountdown.setEndTime = function ( f3_arg0, f3_arg1 ) + if LUI.UIElement.setEndTimeInC ~= nil then + f3_arg0:setEndTimeInC( f3_arg1 ) + end +end + +LUI.UILongCountdown.id = "LUICountdown" diff --git a/lui/luimarqueetext.dec.lua b/lui/luimarqueetext.dec.lua new file mode 100644 index 0000000..f8aaa49 --- /dev/null +++ b/lui/luimarqueetext.dec.lua @@ -0,0 +1,284 @@ +LUI.UIMarqueeText = InheritFrom( LUI.UIElement ) +LUI.UIMarqueeText.build = function ( f1_arg0, f1_arg1 ) + if not f1_arg1 then + f1_arg1 = {} + end + local self = LUI.UIMarqueeText.new( f1_arg1.defaultAnimationState ) + if f1_arg1.textHeight then + LUI.UIMarqueeText.SetTextHeight( self, f1_arg1.textHeight ) + end + if f1_arg1.useTextWrapping then + LUI.UIMarqueeText.SetUseTextWrapping( self, f1_arg1.useTextWrapping ) + end + if f1_arg1.scrollSpeed then + LUI.UIMarqueeText.SetSpeed( self, f1_arg1.scrollSpeed ) + end + return self +end + +LUI.UIMarqueeText.SetColor = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3 ) + f2_arg0:registerAnimationState( "default", { + red = f2_arg1, + green = f2_arg2, + blue = f2_arg3, + alpha = 1 + } ) + f2_arg0:animateToState( "default" ) + LUI.UIMarqueeText.RestartScroll( f2_arg0 ) +end + +LUI.UIMarqueeText.new = function ( f3_arg0 ) + local self = LUI.UIElement.new( f3_arg0 ) + self:setClass( LUI.UIMarqueeText ) + self:setUseStencil( true ) + local f3_local1 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + local f3_local2 + if f3_arg0 then + f3_local2 = f3_arg0.font + if not f3_local2 then + + else + f3_local1.font = f3_local2 + f3_local1.red = 1 + f3_local1.green = 1 + f3_local1.blue = 1 + f3_local1.alpha = 1 + f3_local2 = LUI.UIText.new( f3_local1 ) + self.text = f3_local2 + self:addElement( f3_local2 ) + self.text:registerAnimationState( "default", f3_local1 ) + self.text:animateToState( "default" ) + self.text:registerAnimationState( "start", f3_local1 ) + self.text:registerAnimationState( "alphaOut", { + alpha = 0 + } ) + self.text:registerEventHandler( "transition_complete_start", LUI.UIMarqueeText.HandleStartScroll ) + self.text:animateToState( "start", 1 ) + self.text.scrollSpeed = 90 + return self + end + end + f3_local2 = CoD.TextSettings.NormalFont.Font +end + +LUI.UIMarqueeText.RestartScroll = function ( f4_arg0 ) + f4_arg0.text:animateToState( "start", 1 ) +end + +LUI.UIMarqueeText.SetUseTextWrapping = function ( f5_arg0, f5_arg1 ) + f5_arg0.text.useTextWrapping = f5_arg1 + LUI.UIMarqueeText.RestartScroll( f5_arg0 ) +end + +LUI.UIMarqueeText.SetTextHeight = function ( f6_arg0, f6_arg1 ) + local f6_local0 = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f6_arg1, + left = 0, + right = 0 + } + f6_arg0.text.textHeight = f6_arg1 + f6_arg0.text:registerAnimationState( "default", f6_local0 ) + f6_arg0.text:registerAnimationState( "start", f6_local0 ) + LUI.UIMarqueeText.RestartScroll( f6_arg0 ) +end + +LUI.UIMarqueeText.SetSpeed = function ( f7_arg0, f7_arg1 ) + f7_arg0.text.scrollSpeed = f7_arg1 +end + +LUI.UIMarqueeText.HandleStartScroll = function ( f8_arg0 ) + local f8_local0 = f8_arg0:getParent() + local f8_local1, f8_local2, f8_local3, f8_local4 = f8_local0:getCurrentGlobalRect() + local f8_local5 = f8_arg0:getCurrentGlobalRect() + local f8_local6 = f8_local0:getCurrentAlignment() + local f8_local7 = LUI.Alignment.None + if f8_arg0.useTextWrapping then + if f8_local6 == LUI.Alignment.None then + local f8_local8 = LUI.Alignment.Left + end + f8_local7 = f8_local8 or f8_local6 + end + f8_arg0:registerAnimationState( "setup", { + alignment = f8_local7 + } ) + f8_arg0:animateToState( "setup" ) + if f8_local1 and f8_local5 then + local f8_local9, f8_local10 = f8_arg0:getElementTextDims() + local f8_local11 = f8_local0:getCurrentFont() + local f8_local12, f8_local13, f8_local14, f8_local15 = f8_local0:getCurrentRGBA() + local f8_local16 = nil + local f8_local17 = false + local f8_local18 = { + red = f8_local12, + green = f8_local13, + blue = f8_local14, + alpha = f8_local15 + } + local f8_local19 = 0.01 + if f8_local3 - f8_local1 + f8_local19 < f8_local9 and not f8_arg0.textHeight then + f8_local16 = (f8_local9 - f8_local3 - f8_local1) / f8_arg0.scrollSpeed * 1000 + f8_local17 = true + f8_local18.alignment = LUI.Alignment.None + f8_arg0:registerAnimationState( "alphaIn", f8_local18 ) + f8_arg0:registerAnimationState( "one", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = f8_local10, + left = 0, + right = f8_local9, + font = f8_local11 + } ) + f8_arg0:registerAnimationState( "two", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = f8_local10, + left = -f8_local9, + right = 0, + font = f8_local11 + } ) + local f8_local20 = MBh.AnimateLoop( { + { + "alphaIn", + 0 + }, + { + "one", + 0 + }, + { + "one", + 500 + }, + { + "two", + f8_local16 + }, + { + "two", + 500 + }, + { + "alphaOut", + 250 + }, + { + "one", + 0 + }, + { + "alphaIn", + 250 + } + } ) + f8_local20( f8_arg0 ) + elseif f8_local4 - f8_local2 + f8_local19 < f8_local10 and f8_arg0.textHeight then + local f8_local21 = f8_local10 - f8_local4 - f8_local2 + local f8_local22 = f8_local10 / f8_arg0.textHeight + f8_local16 = f8_local21 / f8_arg0.scrollSpeed * 1000 + f8_local17 = true + local f8_local20 + if f8_local6 == LUI.Alignment.None then + f8_local20 = LUI.Alignment.Center + if not f8_local20 then + + else + f8_local18.alignment = f8_local20 + f8_arg0:registerAnimationState( "alphaIn", f8_local18 ) + f8_local20 = { + { + "alphaOut", + 0 + }, + { + "line_0", + 0 + }, + { + "alphaIn", + 250 + } + } + for f8_local23 = 0, f8_local22 - math.floor( (f8_local4 - f8_local2) / f8_arg0.textHeight ), 1 do + local f8_local26 = "line_" .. f8_local23 + f8_arg0:registerAnimationState( f8_local26, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -f8_local23 * f8_arg0.textHeight, + bottom = (1 - f8_local23) * f8_arg0.textHeight, + left = 0, + right = 0, + font = f8_local11 + } ) + table.insert( f8_local20, { + f8_local26, + f8_arg0.textHeight / f8_arg0.scrollSpeed * 1000, + true, + true + } ) + table.insert( f8_local20, { + f8_local26, + 2000 + } ) + end + table.insert( f8_local20, { + "alphaOut", + 250 + } ) + table.insert( f8_local20, { + "line_0", + 0 + } ) + local f8_local23 = MBh.AnimateLoop( f8_local20 ) + f8_local23( f8_arg0 ) + end + end + f8_local20 = f8_local6 + end + if not f8_local17 then + f8_local18.alignment = f8_local6 + f8_arg0:registerEventHandler( LUI.FormatAnimStateFinishEvent( "alphaIn" ), nil ) + f8_arg0:registerAnimationState( "alphaIn", f8_local18 ) + f8_arg0:animateToState( "alphaIn", 0 ) + end + else + f8_arg0:animateToState( "alphaOut" ) + f8_arg0:animateToState( "start", 1 ) + end +end + +LUI.UIMarqueeText.setText = function ( f9_arg0, f9_arg1 ) + f9_arg0.text:setTextInC( f9_arg1 ) + if f9_arg0.text.currText ~= f9_arg1 then + LUI.UIMarqueeText.RestartScroll( f9_arg0 ) + end + f9_arg0.text.currText = f9_arg1 +end + +LUI.UIMarqueeText.setTextStyle = function ( f10_arg0, f10_arg1 ) + f10_arg0.text.m_textStyle = f10_arg1 +end + +LUI.UIMarqueeText.id = "LUIMarqueeText" +LUI.MenuBuilder.registerType( "UIMarqueeText", LUI.UIMarqueeText.build ) diff --git a/lui/luimousecursor.dec.lua b/lui/luimousecursor.dec.lua new file mode 100644 index 0000000..b8ccbf6 --- /dev/null +++ b/lui/luimousecursor.dec.lua @@ -0,0 +1,59 @@ +LUI.UIMouseCursor = {} +LUI.UIMouseCursor.priority = 1000 +LUI.UIMouseCursor.mouseTimeout = 3000 +LUI.UIMouseCursor.MouseActivity = function ( f1_arg0, f1_arg1 ) + f1_arg0:applyElementTransform() + f1_arg0.id = "mouse_cursor" + local f1_local0, f1_local1 = ProjectRootCoordinate( f1_arg1.rootName, f1_arg1.x, f1_arg1.y ) + if f1_local0 ~= nil and f1_local1 ~= nil then + f1_local0, f1_local1 = f1_arg1.root:pixelsToUnits( f1_local0, f1_local1 ) + if f1_local0 ~= nil and f1_local1 ~= nil then + f1_arg0:registerAnimationState( "default", { + left = f1_local0 - 32, + right = f1_local0 + 32, + top = f1_local1 - 32, + bottom = f1_local1 + 32, + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false, + alpha = 1 + } ) + f1_arg0:animateToState( "default" ) + end + end + f1_arg0:dispatchEventToChildren( f1_arg1 ) + f1_arg0:undoElementTransform() + f1_arg0.lastMoveTime = Engine.GetMilliseconds() +end + +LUI.UIMouseCursor.Hide = function ( f2_arg0, f2_arg1 ) + f2_arg0:animateToState( "hidden", 400 ) +end + +LUI.UIMouseCursor.new = function ( f3_arg0 ) + local self = LUI.UIImage.new( f3_arg0 ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:setPriority( LUI.UIMouseCursor.priority ) + self.lastMoveTime = Engine.GetMilliseconds() + self.id = "mouse_cursor" + self.hide = LUI.UIMouseCursor.Hide + self:registerEventHandler( "mousemove", LUI.UIMouseCursor.MouseActivity ) + self:registerEventHandler( "mousedown", LUI.UIMouseCursor.MouseActivity ) + local f3_local1 = LUI.UITimer.new( 1000, { + name = "update_mouse" + }, nil, false, element, false ) + f3_local1.id = "mouse_update_timer" + self:addElement( f3_local1 ) + self:registerEventHandler( "update_mouse", function ( element, event ) + if not CoD.UsingController() then + return + elseif Engine.GetMilliseconds() - element.lastMoveTime > LUI.UIMouseCursor.mouseTimeout then + element:hide() + end + end ) + return self +end + diff --git a/lui/luiprettynumber.dec.lua b/lui/luiprettynumber.dec.lua new file mode 100644 index 0000000..c5e90c3 --- /dev/null +++ b/lui/luiprettynumber.dec.lua @@ -0,0 +1,22 @@ +LUI.UIPrettyNumber = {} +LUI.UIPrettyNumber.new = function ( f1_arg0, f1_arg1 ) + assert( f1_arg1 ) + assert( type( f1_arg1.speed ) == "number" ) + assert( type( f1_arg1.initialValue ) == "number" ) + local self = assert + local f1_local1 + if f1_arg1.precision and type( f1_arg1.precision ) ~= "number" then + f1_local1 = false + else + f1_local1 = true + end + self( f1_local1 ) + f1_arg1.precision = f1_arg1.precision or 1 + self = LUI.UIText.new( f1_arg0 ) + self.id = "UIPrettyNumber" + if self.setupPrettyNumber then + self:setupPrettyNumber( f1_arg1.speed, f1_arg1.initialValue, f1_arg1.precision ) + end + return self +end + diff --git a/lui/luiroot.dec.lua b/lui/luiroot.dec.lua new file mode 100644 index 0000000..1bdbe80 --- /dev/null +++ b/lui/luiroot.dec.lua @@ -0,0 +1,478 @@ +require( "LUI.CodeDependence" ) + +if not Engine.InFrontend() then + require( "LUI.GameX" ) +end +require( "LUI.FlowManager" ) +require( "LUI.HudManager" ) +require( "LUI.EventCatcher" ) +if Engine.HasSpeechFeature() then + require( "LUI.MenuAutoNav" ) + require( "LUI.Speech" ) + require( "LUI.common_menus.KinectUtils" ) +end +LUI.UIRoot = {} +LUI.UIRoot.childPriorities = { + menuRoot = 10, + default = 0, + MLGHud = -4, + hudElems = -5, + roundEndScreen = -7, + finalScoresScreen = -7, + hudContainer = -10 +} +function LUI_UIRoot_HandleSpeechWhatCanISay( f1_arg0, f1_arg1, f1_arg2 ) + if Engine.HasSpeechFeature() and Kinect.CanOpenWhatCanISayMenu() == true then + Kinect.OpenWhatCanISayMenu( f1_arg1.controler ) + LUI.Speech.PerformingSpeechAction() + end +end + +function LUI_UIRoot_HandleSpeechPause( f2_arg0, f2_arg1, f2_arg2 ) + if Engine.HasSpeechFeature() then + local f2_local0 = false + if not Engine.InFrontend() and not Engine.IsMultiplayer() and Engine.GetDvarInt( "cl_paused" ) == 0 then + local f2_local1 = Engine.GetLuiRoot() + if f2_local1 then + Engine.TogglePause() + f2_local1.is_paused = true + f2_local1:processEvent( { + name = "hud_refresh" + } ) + f2_local1:dispatchEventToRoot( { + name = "toggle_pause" + } ) + f2_local0 = true + end + end + if f2_local0 == false then + LUI.Speech.SquelchSpeechAction() + else + LUI.Speech.PerformingSpeechAction() + end + end +end + +function LUI_UIRoot_HandleSpeechChangeView( f3_arg0, f3_arg1, f3_arg2 ) + if Engine.HasSpeechFeature() and Engine.SpeechEmitKeyPressAndRelease then + DebugPrint( "Kinect: Issuing a GPAD_BACK button press in response to VIEW voice command." ) + Engine.SpeechEmitKeyPressAndRelease( "GPAD_BACK", f3_arg1.controller ) + end +end + +function LUI_UIRoot_HandleSpeechShowMenu( f4_arg0, f4_arg1, f4_arg2 ) + if Engine.HasSpeechFeature() and Engine.SpeechEmitKeyPressAndRelease then + DebugPrint( "Kinect: Issuing a GPAD_START button press in response to MENU voice command." ) + Engine.SpeechEmitKeyPressAndRelease( "GPAD_START", f4_arg1.controller ) + end +end + +function LUI_UIRoot_HandleSpeechBack( f5_arg0, f5_arg1, f5_arg2 ) + if Engine.HasSpeechFeature() and Engine.GetLuiInUse() and Engine.SpeechEmitKeyPressAndRelease then + DebugPrint( "Kinect: Issuing a GPAD_B button press in response to XBOX GO BACK voice command." ) + Engine.SpeechEmitKeyPressAndRelease( "GPAD_B", f5_arg1.controller ) + end +end + +function LUI_UIRoot_HandleSpeechShortcuts( f6_arg0, f6_arg1, f6_arg2 ) + if Engine.HasSpeechFeature() and Kinect.CanOpenKinectGuide() == true then + Kinect.OpenKinectGuide( f6_arg1.controler ) + LUI.Speech.PerformingSpeechAction() + end +end + +if Engine.HasSpeechFeature() then + luiRootSpeechGrammarFrontEndHandlersArray = { + { + action = "what can i say", + confidence = LUI.Speech.whatCanISayConfidence, + handler = LUI_UIRoot_HandleSpeechWhatCanISay, + extradata = nil + }, + { + action = "pause", + confidence = LUI.Speech.pauseConfidence, + handler = LUI_UIRoot_HandleSpeechPause, + extradata = nil + }, + { + action = "show view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "show menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "shortcuts", + confidence = LUI.Speech.defaultConfidence, + handler = LUI_UIRoot_HandleSpeechShortcuts, + extradata = nil + }, + { + action = "xbox pause", + confidence = LUI.Speech.pauseConfidence, + handler = LUI_UIRoot_HandleSpeechPause, + extradata = nil + }, + { + action = "xbox view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "xbox menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "xbox back", + confidence = LUI.Speech.goBackConfidence, + handler = LUI_UIRoot_HandleSpeechBack, + extradata = nil + } + } + luiRootSpeechGrammarInGameHandlersArray = { + { + action = "what can i say", + confidence = LUI.Speech.whatCanISayConfidence, + handler = LUI_UIRoot_HandleSpeechWhatCanISay, + extradata = nil + }, + { + action = "pause", + confidence = LUI.Speech.pauseConfidence, + handler = LUI_UIRoot_HandleSpeechPause, + extradata = nil + }, + { + action = "show view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "show menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "xbox pause", + confidence = LUI.Speech.pauseConfidence, + handler = LUI_UIRoot_HandleSpeechPause, + extradata = nil + }, + { + action = "xbox view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "xbox menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "xbox back", + confidence = LUI.Speech.goBackConfidence, + handler = LUI_UIRoot_HandleSpeechBack, + extradata = nil + } + } +else + luiRootSpeechGrammarFrontEndHandlersArray = {} + luiRootSpeechGrammarInGameHandlersArray = {} +end +function LUI_UIRoot_SpeechRestart( f7_arg0, f7_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.CancelSpeechFailTimer() + Kinect.RestartGlobalGrammars() + end +end + +function LUI_UIRoot_SpeechHandler( f8_arg0, f8_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.LaunchSpeechFailTimer() + if Engine.InFrontend() then + LUI.Speech.ProcessActionEvent( f8_arg0, f8_arg1, luiRootSpeechGrammarFrontEndHandlersArray ) + else + LUI.Speech.ProcessActionEvent( f8_arg0, f8_arg1, luiRootSpeechGrammarInGameHandlersArray ) + end + end +end + +function LUI_UIRoot_SpeechFailTimerHandler( f9_arg0, f9_arg1 ) + if Engine.HasSpeechFeature() then + if LUI.Speech.waitingForOutstandingCommandConfirmation == true then + LUI.Speech.waitingForOutstandingCommandConfirmation = false + LUI.Speech.PlayBadSound() + end + LUI.Speech.CancelSpeechFailTimer() + end +end + +local f0_local0 = function ( f10_arg0, f10_arg1 ) + f10_arg0:registerAnimationState( "default", { + left = -f10_arg1.width / 2, + top = -f10_arg1.height / 2, + right = f10_arg1.width / 2, + bottom = f10_arg1.height / 2, + leftAnchor = false, + topAnchor = false, + rightAnchor = false, + bottomAnchor = false + } ) + f10_arg0:animateToState( "default" ) +end + +local f0_local1 = function ( f11_arg0, f11_arg1 ) + f11_arg1.root = f11_arg0 + f11_arg0:dispatchEventToChildren( f11_arg1 ) +end + +local f0_local2 = function ( f12_arg0, f12_arg1 ) + local f12_local0 = f12_arg0.m_currentAnimationState + local f12_local1 = f12_local0.unitsToPixels + return f12_local0.left + f12_arg1.left * f12_local1, f12_local0.top + f12_arg1.top * f12_local1, f12_local0.left + f12_arg1.right * f12_local1, f12_local0.top + f12_arg1.bottom * f12_local1 +end + +local f0_local3 = function ( f13_arg0, f13_arg1, f13_arg2 ) + local f13_local0 = f13_arg0.m_currentAnimationState + local f13_local1 = f13_local0.unitsToPixels + local f13_local2 = f13_local0.left + local f13_local3 = f13_local0.top + f13_arg2:setRectInC( f13_local2 + f13_arg1.left * f13_local1, f13_local3 + f13_arg1.top * f13_local1, f13_local2 + f13_arg1.right * f13_local1, f13_local3 + f13_arg1.bottom * f13_local1 ) +end + +local f0_local4 = function ( f14_arg0, f14_arg1 ) + return f14_arg1 * f14_arg0.m_currentAnimationState.unitsToPixels +end + +local f0_local5 = function ( f15_arg0, f15_arg1, f15_arg2 ) + return f15_arg0:RootPixelsToUnits( f15_arg1, f15_arg2 ) +end + +LUI.UIRoot.DebugPrint_IgnoreEventsSetup = function ( f16_arg0 ) + f16_arg0.debugPrintIgnoreEvents = { + process_events = true, + gamepad_sticks = true, + mousemove = true + } +end + +local f0_local6 = function ( f17_arg0, f17_arg1 ) + InitPlayerData( f17_arg0, f17_arg1 ) +end + +local f0_local7 = function ( f18_arg0, f18_arg1 ) + InitPlayerDataExtended( f18_arg0, f18_arg1 ) +end + +local f0_local8 = function ( f19_arg0, f19_arg1 ) + +end + +function LUI_UIRoot_TryOpenMOTD( f20_arg0, f20_arg1 ) + TryForceOpenMOTD() +end + +function LUI_UIRoot_OnValidatePlayerData( f21_arg0, f21_arg1 ) + local f21_local0 = f21_arg1.controller + if f21_local0 then + ValidateOperations( f21_local0 ) + end +end + +LUI.UIRoot.new = function ( f22_arg0 ) + local self = LUI.UIElement.new( { + left = 0, + top = 0, + right = 0, + bottom = 0, + leftAnchor = false, + topAnchor = false, + rightAnchor = false, + bottomAnchor = false + } ) + self.id = "LUIRoot" + self.isaroot = true + self.unitsToPixelsRect = f0_local2 + self.pixelsToUnits = f0_local5 + self.unitsToPixels = f0_local4 + self.setDimensionsForElement = f0_local3 + self:registerEventHandler( "resize", f0_local0 ) + self:registerEventHandler( "mousemove", f0_local1 ) + self:registerEventHandler( "mousedown", f0_local1 ) + self:registerEventHandler( "mouseup", f0_local1 ) + self:registerEventHandler( "process_events", LUI.UIRoot.ProcessEvents ) + if Engine.HasSpeechFeature() then + self:registerEventHandler( "menu_auto_nav_timer", LUI.MenuAutoNav.HandleTimerEvent ) + self:registerEventHandler( "speech_grammar_changed", LUI_UIRoot_SpeechRestart ) + self:registerEventHandler( "speech_action", LUI_UIRoot_SpeechHandler ) + self:registerEventHandler( "speech_fail_timer", LUI_UIRoot_SpeechFailTimerHandler ) + end + if Engine.IsMultiplayer() then + self:registerEventHandler( "init_player_data", f0_local6 ) + self:registerEventHandler( "init_player_data_extended", f0_local7 ) + self:registerEventHandler( "get_next_round_of_operations", f0_local8 ) + self:registerEventHandler( "open_motd", LUI_UIRoot_TryOpenMOTD ) + self:registerEventHandler( "validate_player_data", LUI_UIRoot_OnValidatePlayerData ) + end + LUI.roots[f22_arg0] = self + if LUI.primaryRoot == nil then + LUI.primaryRoot = self + end + self.flowManager = LUI.FlowManager.new() + self.flowManager:setupRoot( self ) + if not Engine.InFrontend() then + self.hudManager = LUI.HudManager.new() + self.hudManager:setupRoot( self ) + end + self.eventCatcher = LUI.EventCatcher.new() + self.eventCatcher:setupRoot( self ) + self.timerGroupQueues = {} + self.name = f22_arg0 + self.eventQueue = {} + self.debugEvents = true + LUI.UIRoot.DebugPrint_IgnoreEventsSetup( self ) + self.processEvent = LUI.UIRoot.ProcessEvent + self.SaveMenuStack = self.flowManager.SaveMenuStack + self.RestoreMenuStack = self.flowManager.RestoreMenuStack + self.AnyActiveMenusInStack = self.flowManager.AnyActiveMenusInStack + self.IsMenuOpenAndVisible = self.flowManager.IsMenuOpenAndVisible + self.IsMenuInStack = self.flowManager.IsMenuInStack + self.IsMenuTopmost = self.flowManager.IsMenuTopmost + self.IsTopSignInMenu = self.flowManager.IsTopSignInMenu + self.GetFirstButtonActionInFocusId = LUI.UIRoot.GetFirstButtonActionInFocusId + if Engine.HasSpeechFeature() then + Kinect.EnableGlobalGrammars() + end + return self +end + +LUI.UIRoot.GetFirstButtonActionInFocus = function ( f23_arg0 ) + if f23_arg0:isInFocus() and f23_arg0.m_eventHandlers.button_action then + return f23_arg0 + end + local f23_local0 = f23_arg0:getFirstChild() + while f23_local0 do + local f23_local1 = LUI.UIRoot.GetFirstButtonActionInFocus( f23_local0 ) + if f23_local1 then + return f23_local1 + end + f23_local0 = f23_local0:getNextSibling() + end +end + +LUI.UIRoot.GetFirstButtonActionInFocusId = function ( f24_arg0 ) + local f24_local0 = LUI.UIRoot.GetFirstButtonActionInFocus( f24_arg0 ) + return f24_local0.id +end + +LUI.UIRoot.BlockButtonInput = function ( f25_arg0, f25_arg1, f25_arg2 ) + if f25_arg1 then + f25_arg0.m_blockButtonInput = true + else + f25_arg0.m_blockButtonInput = false + end +end + +LUI.UIRoot.IsButtonInputBlocked = function ( f26_arg0 ) + return f26_arg0.m_blockButtonInput +end + +LUI.UIRoot.ProcessEvent = function ( f27_arg0, f27_arg1 ) + if f27_arg1.immediate == true then + local f27_local0 = profile.beginuserevent( "IE_" .. f27_arg1.name ) + LUI.UIRoot.ProcessEventNow( f27_arg0, f27_arg1 ) + profile.enduserevent( f27_local0 ) + else + local f27_local0 = f27_arg0.eventQueue + table.insert( f27_local0, f27_arg1 ) + if #f27_local0 > 20 then + DebugPrint( "LUI WARNING: Event queue exceeded 20 events! " .. f27_arg1.name ) + if f27_arg1.name == "omnvar_update" then + DebugPrint( "LUI WARNING: omnvar = " .. f27_arg1.omnvar ) + end + end + end +end + +LUI.UIRoot.ProcessEvents = function ( f28_arg0, f28_arg1 ) + LUI.UITimer.DispatchEventsFromQueue( f28_arg0 ) + local f28_local0 = f28_arg0.eventQueue + local f28_local1 = f28_local0[1] + if f28_local1 ~= nil then + table.remove( f28_local0, 1 ) + local f28_local2 = profile.beginuserevent( "RE_" .. f28_local1.name ) + LUI.UIRoot.ProcessEventNow( f28_arg0, f28_local1 ) + profile.enduserevent( f28_local2 ) + end +end + +LUI.UIRoot.IsNavigationEvent = function ( f29_arg0 ) + if not handled and f29_arg0.name == "gamepad_button" and f29_arg0.down and (f29_arg0.button == "up" or f29_arg0.button == "down" or f29_arg0.button == "left" or f29_arg0.button == "right") then + return true + else + return false + end +end + +LUI.UIRoot.ProcessEventNow = function ( f30_arg0, f30_arg1 ) + if not f30_arg0.debugPrintIgnoreEvents[f30_arg1.name] and Engine.GetDvarBool( "lui_print_events" ) then + DebugPrint( "Processed Event " .. f30_arg1.name ) + if f30_arg1.name == "gamepad_button" then + DebugPrint( "button " .. f30_arg1.button ) + end + if f30_arg1.name == "keybind" then + DebugPrint( "keybind " .. f30_arg1.command ) + end + end + if f30_arg0.m_blockButtonInput and (f30_arg1.name == "gamepad_button" or f30_arg1.name == "mouseup") then + DebugPrint( "Blocking Button input for " .. f30_arg1.button .. " because m_ignoreButtonInput is true" ) + return false + end + local f30_local0 = f30_arg0 + if f30_arg1.target then + f30_local0 = f30_arg1.target + end + local f30_local1 = LUI.UIElement.processEvent( f30_local0, f30_arg1 ) + if not f30_local1 and LUI.UIRoot.IsNavigationEvent( f30_arg1 ) then + f30_arg0.flowManager:CheckRestoreFocus() + end + return f30_local1 +end + diff --git a/lui/luisafeareaoverlay.dec.lua b/lui/luisafeareaoverlay.dec.lua new file mode 100644 index 0000000..2c93ce9 --- /dev/null +++ b/lui/luisafeareaoverlay.dec.lua @@ -0,0 +1,75 @@ +LUI.UISafeAreaOverlay = {} +LUI.UISafeAreaOverlay.new = function () + local self = LUI.UIElement.new( { + left = 0, + top = 0, + right = 0, + bottom = 0, + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true + } ) + self.leftBorder = LUI.UIImage.new( { + left = 0, + top = 36, + right = 48, + bottom = -36, + topAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottomAnchor = true, + red = 0, + green = 0, + blue = 1, + alpha = 0.5 + } ) + self:addElement( self.leftBorder ) + self.rightBorder = LUI.UIImage.new( { + left = -48, + top = 36, + right = 0, + bottom = -36, + topAnchor = true, + leftAnchor = false, + rightAnchor = true, + bottomAnchor = true, + red = 0, + green = 0, + blue = 1, + alpha = 0.5 + } ) + self:addElement( self.rightBorder ) + self.topBorder = LUI.UIImage.new( { + left = 0, + top = 0, + right = 0, + bottom = 36, + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottomAnchor = false, + red = 0, + green = 0, + blue = 1, + alpha = 0.5 + } ) + self:addElement( self.topBorder ) + self.bottomBorder = LUI.UIImage.new( { + left = 0, + top = -36, + right = 0, + bottom = 0, + topAnchor = false, + leftAnchor = true, + rightAnchor = true, + bottomAnchor = true, + red = 0, + green = 0, + blue = 1, + alpha = 0.5 + } ) + self:addElement( self.bottomBorder ) + return self +end + diff --git a/lui/luiscrollable.dec.lua b/lui/luiscrollable.dec.lua new file mode 100644 index 0000000..0687ba4 --- /dev/null +++ b/lui/luiscrollable.dec.lua @@ -0,0 +1,74 @@ +LUI.UIScrollable = {} +local f0_local0 = function ( f1_arg0, f1_arg1 ) + f1_arg0.container:addElement( f1_arg1 ) +end + +local f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4 ) + f2_arg0.container:registerAnimationState( "scroll_target", { + left = f2_arg1, + right = f2_arg1 + f2_arg0.containerWidth, + leftAnchor = true + } ) + f2_arg0.container:animateToState( "scroll_target", f2_arg2, f2_arg3, f2_arg4 ) +end + +local f0_local2 = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3, f3_arg4 ) + local f3_local0 = f3_arg0:getHeight() + if f3_arg1 > 0 then + f3_arg1 = 0 + elseif f3_arg1 < -f3_arg0.containerHeight + f3_local0 then + f3_arg1 = -f3_arg0.containerHeight + f3_local0 + end + f3_arg0.container:registerAnimationState( "scroll_target", { + top = f3_arg1, + bottom = f3_arg1 + f3_arg0.containerHeight, + topAnchor = true, + bottomAnchor = false + } ) + f3_arg0.container:animateToState( "scroll_target", f3_arg2, f3_arg3, f3_arg4 ) +end + +LUI.UIScrollable.new = function ( f4_arg0, f4_arg1, f4_arg2, f4_arg3 ) + if f4_arg1 == nil or f4_arg2 == nil then + error( "Cannot create scrollable component without valid dimensions!" ) + return + end + local self = LUI.UIElement.new( f4_arg0 ) + self.id = "LUIScrollable" + self:setHandleMouse( true ) + if f4_arg3 == true then + self.container = LUI.UIElement.new( { + left = -f4_arg1 / 2, + top = -f4_arg2 / 2, + right = f4_arg1 / 2, + bottom = f4_arg2 / 2, + leftAnchor = false, + topAnchor = false, + rightAnchor = false, + bottomAnchor = false, + zoom = 0 + } ) + else + self.container = LUI.UIElement.new( { + left = 0, + top = 0, + right = f4_arg1, + bottom = f4_arg2, + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false, + zoom = 0 + } ) + end + self.container.id = "LUIScrollable_Container" + self:setUseStencil( true ) + self.containerWidth = f4_arg1 + self.containerHeight = f4_arg2 + self:addElement( self.container ) + self.addElement = f0_local0 + self.scrollX = f0_local1 + self.scrollY = f0_local2 + return self +end + diff --git a/lui/luiscrollingverticallist.dec.lua b/lui/luiscrollingverticallist.dec.lua new file mode 100644 index 0000000..dbab350 --- /dev/null +++ b/lui/luiscrollingverticallist.dec.lua @@ -0,0 +1,178 @@ +LUI.UIScrollingVerticalList = {} +function RefreshScrollList( f1_arg0, f1_arg1 ) + f1_arg0:closeChildren() + f1_arg0:clearSavedState() + f1_arg0:processEvent( { + name = "menu_refresh" + } ) +end + +function CreateArrowButton( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4, f2_arg5, f2_arg6, f2_arg7, f2_arg8 ) + local self = LUI.UIButton.new( { + leftAnchor = false, + rightAnchor = true, + topAnchor = f2_arg3, + bottomAnchor = f2_arg5, + left = -90, + right = -75, + top = f2_arg2, + bottom = f2_arg4, + alpha = 1, + zRot = f2_arg6 + } ) + self.id = f2_arg0 + self.m_requireFocusType = FocusType.MouseOver + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "hidden" ) + self:addEventHandler( "button_action", function ( f3_arg0, f3_arg1 ) + f3_arg0:dispatchEventToRoot( { + name = f2_arg7, + dispatchChildren = true + } ) + end ) + self:addEventHandler( "list_scroll", f2_arg8 ) + local f2_local1 = LUI.UIImage.new() + f2_local1.id = f2_arg0 .. "_image" + f2_local1:registerAnimationState( "default", { + material = RegisterMaterial( "widg_lobby_arrow" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b + } ) + f2_local1:animateToState( "default" ) + self:addElement( f2_local1 ) + return self +end + +function CreateListDef( f4_arg0, f4_arg1, f4_arg2, f4_arg3 ) + f4_arg0.scrollByChildHeight = true + f4_arg0.disableOutsideChildren = true + f4_arg0.sendScrollEvents = true + return { + type = "UIVerticalList", + id = "scroll_list_vlist", + focusable = true, + properties = f4_arg0, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = f4_arg2, + bottom = -f4_arg3 + } + }, + handlers = { + refresh_scroll_list = RefreshScrollList, + scroll_up = function ( f5_arg0, f5_arg1 ) + f5_arg0:SetVerticalListScrollUp() + end + , + scroll_down = function ( f6_arg0, f6_arg1 ) + f6_arg0:SetVerticalListScrollDown() + end + + }, + childrenFeeder = f4_arg1 + } +end + +function SetChildrenIgnoreMouse( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0:getNumChildren() + local f7_local1 = f7_arg0:getFirstChild() + for f7_local2 = 1, f7_local0, 1 do + local f7_local5 = f7_local2 + f7_local1.m_focusLockedByScrolling = f7_arg1.ignore + f7_local1 = f7_local1:getNextSibling() + end +end + +LUI.UIScrollingVerticalList.build = function ( f8_arg0, f8_arg1 ) + return LUI.UIScrollingVerticalList.new( f8_arg0, f8_arg1 ) +end + +LUI.UIScrollingVerticalList.new = function ( menu, controller ) + local self = LUI.UIElement.new() + if not controller then + controller = {} + end + self.id = "UIScrollingVList" + local f9_local1 = menu.childrenFeeder + if menu.childrenFeeder then + menu.childrenFeeder = nil + end + local f9_local2 = 0 + local f9_local3 = 0 + if controller.use_arrows then + local f9_local4 = function ( f10_arg0, f10_arg1 ) + if f10_arg1.show_up_arrow then + f10_arg0:animateToState( "default", 0 ) + f10_arg0:processEvent( { + name = "enable" + } ) + else + f10_arg0:animateToState( "hidden", 0 ) + f10_arg0:processEvent( { + name = "disable" + } ) + end + end + + f9_local2 = 30 + self:addElement( CreateArrowButton( "scroll_list_up_arrow", self, 0, true, 30, false, 90, "scroll_up", f9_local4 ) ) + local f9_local5 = function ( f11_arg0, f11_arg1 ) + if f11_arg1.show_down_arrow then + f11_arg0:animateToState( "default", 0 ) + f11_arg0:processEvent( { + name = "enable" + } ) + else + f11_arg0:animateToState( "hidden", 0 ) + f11_arg0:processEvent( { + name = "disable" + } ) + end + end + + f9_local3 = 30 + self:addElement( CreateArrowButton( "scroll_list_down_arrow", self, -30, false, 0, true, -90, "scroll_down", f9_local5 ) ) + end + local f9_local6 = LUI.MenuBuilder.buildItems( CreateListDef( controller, f9_local1, f9_local2, f9_local3 ), controller, stencil ) + f9_local6:setUseStencil( true ) + self:addElement( f9_local6 ) + f9_local6:registerEventHandler( "set_children_ignore_mouse", SetChildrenIgnoreMouse ) + if controller.use_scrollbar then + self:addElement( LUI.UIVerticalScrollbar.new( f9_local6, controller.bar_width, 1, 1, controller.scrollbar_move_func, controller.bar_color, controller.bar_bg_color, controller.bar_material, controller.bar_bg_material ) ) + end + self.vlist = f9_local6 + self.addElement = LUI.UIScrollingVerticalList.AddElement + self.removeElement = LUI.UIScrollingVerticalList.RemoveElement + self.closeChildren = LUI.UIScrollingVerticalList.CloseChildren + return self +end + +LUI.UIScrollingVerticalList.AddElement = function ( f12_arg0, f12_arg1 ) + f12_arg0.vlist:addElement( f12_arg1 ) +end + +LUI.UIScrollingVerticalList.RemoveElement = function ( f13_arg0, f13_arg1 ) + f13_arg0.vlist:removeElement( f13_arg1 ) +end + +LUI.UIScrollingVerticalList.CloseChildren = function ( f14_arg0 ) + f14_arg0.vlist:closeChildren() +end + diff --git a/lui/luitechydigits.dec.lua b/lui/luitechydigits.dec.lua new file mode 100644 index 0000000..a937b4d --- /dev/null +++ b/lui/luitechydigits.dec.lua @@ -0,0 +1,21 @@ +LUI.UITechyDigits = InheritFrom( LUI.UIText ) +LUI.UITechyDigits.build = function ( f1_arg0, f1_arg1 ) + return LUI.UITechyDigits.new() +end + +LUI.UITechyDigits.new = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4, f2_arg5 ) + local self = LUI.UIText.new() + if LUI.UIElement.setupTechyDigits then + self:setupTechyDigits() + end + self.digits = f2_arg0 or 10 + self.longWait = f2_arg1 or 340 + self.shortWaitMin = f2_arg2 or 20 + self.shortWaitMax = f2_arg3 or 60 + self.pulsesMin = f2_arg4 or 3 + self.pulsesMax = f2_arg5 or 7 + self:setClass( LUI.UITechyDigits ) + return self +end + +LUI.UITechyDigits.id = "LUITechyDigits" diff --git a/lui/luitest.dec.lua b/lui/luitest.dec.lua new file mode 100644 index 0000000..599eca1 --- /dev/null +++ b/lui/luitest.dec.lua @@ -0,0 +1,369 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +DebugPrint( "Registering luitest menu" ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + DebugPrint( "Got event " .. f1_arg1.name ) +end + +f0_local1 = function ( f2_arg0 ) + DebugPrint( "push func!" ) +end + +f0_local2 = function ( f3_arg0 ) + DebugPrint( "pop func!" ) +end + +local f0_local3 = function () + return { + table1 = { + key = "value", + key2 = 2 + }, + item = 5 + } +end + +local f0_local4 = function () + DebugPrint( "test function!!!!!!!!!!!!!!!!!!!!" ) + local f5_local0 = f0_local3() + f5_local0.item = 6 + f5_local0.table1.key2 = 5 + local f5_local1 = f0_local3() + DebugPrint( f5_local1.item ) + DebugPrint( f5_local1.table1.key2 ) +end + +local f0_local5 = function () + return { + type = "UIText", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 25, + alignment = LUI.Alignment.Left + } + } + } +end + +local f0_local6 = function () + return { + type = "debugText" + } +end + +debugFocus = true +local f0_local7 = function ( f8_arg0 ) + debugFocus = not debugFocus + return debugFocus +end + +local f0_local8 = function ( f9_arg0 ) + return { + { + type = "debugButton", + id = "button1", + properties = { + text = "Open This Menu", + additional_handlers = { + button_action = MBh.OpenMenu( "luitest", true ) + } + } + }, + { + type = "debugButton", + id = "button2", + properties = { + text = "Open Popup", + defaultDuration = 3000, + additional_handlers = { + button_action = MBh.PopupMenu( "testPopup", true ) + } + } + }, + { + type = "debugButton", + id = "button3", + properties = { + text = "Handles Alt 1 As Well", + additional_handlers = { + button_action = function () + crash = me + end + , + button_alt1 = MBh.HandlePrint( "Button 3 Alt 1" ) + } + }, + disabledFunc = f0_local7 + }, + { + type = "derivedDebugText", + properties = { + text = "Hello" + } + }, + { + type = "derivedDebugText", + properties = { + text = "world" + } + } + } +end + +function debugList() + return { + type = "UIVerticalList", + id = "testMenu", + focusable = true, + states = { + default = { + left = 0, + top = 0, + right = 0, + bottom = 0, + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true + } + } + } +end + +function debugButton() + return { + type = "UIButton", + id = "debugButtonDefaultId", + properties = { + text = "button", + width = 400, + height = 35, + defaultDuration = 500 + }, + focusable = true, + children = { + { + type = "UIImage", + id = "image", + properties = { + defaultDuration = MBh.Property( "defaultDuration" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + scale = 1 + }, + button_over = MBh.BaseState( "default", { + scale = 0.8 + } ), + pulse_1 = MBh.BaseState( "default" ), + pulse_2 = MBh.BaseState( "default", { + scale = 0.8 + } ) + }, + handlers = { + button_over = MBh.AnimateLoop( { + { + "pulse_1", + 200, + true, + true + }, + { + "pulse_2", + 200, + true, + true + } + } ), + button_up = MBh.AnimateToState( "default", 1000, true, true ), + button_disable = MBh.AnimateToState( "default", 1000, true, true ) + } + }, + { + type = "derivedDebugText", + id = "theText", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 25, + alignment = LUI.Alignment.Left + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = MBh.Property( "width" ), + top = 0, + bottom = 35, + scale = 1, + alpha = 1 + }, + disabled = { + alpha = 0.5, + scale = 1 + }, + button_over = MBh.BaseState( "default", { + scale = 1.2 + } ) + }, + handlers = { + button_over = MBh.DoMultiple( { + MBh.AnimateToState( "button_over", MBh.Property( "defaultDuration" ), true, true ), + f0_local0 + } ), + button_up = MBh.AnimateToState( "default", 1000, true, true ), + button_disable = MBh.AnimateToState( "disabled", 1000, true, true ) + } + } +end + +local f0_local9 = function () + return { + type = "UIElement", + id = "testDef", + focusable = true, + pushFunc = f0_local1, + popFunc = f0_local2, + properties = { + menu_feeder = MBh.Function( f0_local8 ) + }, + children = { + { + type = "debugList", + id = "debugList", + properties = { + menu_feeder = MBh.Property( "menu_feeder" ) + }, + childrenFeeder = MBh.Property( "menu_feeder" ) + }, + { + type = "backButton", + id = "backButton" + }, + { + type = "UITimer", + properties = { + event = "menu_refresh", + interval = 3000, + disposable = false, + broadcastToRoot = true + } + } + }, + states = { + default = { + left = 100, + top = 100, + right = 0, + bottom = 0, + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true + } + }, + handlers = { + menu_create = f0_local4, + menu_close = function () + DebugPrint( "menu closed!" ) + end + + } + } +end + +local f0_local10 = function () + return { + type = "UIBindButton", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } +end + +LUI.MenuBuilder.registerDef( "testPopup", function () + return { + type = "UIElement", + focusable = true, + id = "testPopup", + properties = { + text = "Popup text" + }, + children = { + { + type = "derivedDebugText", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "backButton", + id = "popupBackButton" + } + }, + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -100, + right = 100, + top = -20, + bottom = 20 + } + } + } +end ) +LUI.MenuBuilder.registerDef( "backButton", f0_local10 ) +LUI.MenuBuilder.registerDef( "debugText", f0_local5 ) +LUI.MenuBuilder.registerDef( "derivedDebugText", f0_local6 ) +LUI.MenuBuilder.registerDef( "debugList", debugList ) +LUI.MenuBuilder.registerDef( "debugButton", debugButton ) +LUI.MenuBuilder.registerDef( "luitest", f0_local9 ) +LockTable( _M ) diff --git a/lui/luitext.dec.lua b/lui/luitext.dec.lua new file mode 100644 index 0000000..94179a5 --- /dev/null +++ b/lui/luitext.dec.lua @@ -0,0 +1,44 @@ +LUI.UIText = InheritFrom( LUI.UIElement ) +LUI.UIText.build = function ( f1_arg0, f1_arg1 ) + return LUI.UIText.new() +end + +LUI.UIText.new = function ( f2_arg0 ) + local self = LUI.UIElement.new( f2_arg0 ) + self:setClass( LUI.UIText ) + self:setupUIText() + return self +end + +LUI.UIText.TransitionComplete_OutState = function ( f3_arg0, f3_arg1 ) + f3_arg0:setText( f3_arg0.replaceContentData.text ) + f3_arg0:registerEventHandler( "transition_complete_" .. f3_arg0.replaceContentData.outState, nil ) + f3_arg0:animateToState( f3_arg0.replaceContentData.inState, f3_arg0.replaceContentData.inDuration ) + f3_arg0.replaceContentData = nil +end + +LUI.UIText.setText = function ( f4_arg0, f4_arg1, f4_arg2, f4_arg3, f4_arg4, f4_arg5 ) + if f4_arg2 ~= nil and f4_arg3 ~= nil then + f4_arg0.replaceContentData = {} + f4_arg0.replaceContentData.outState = f4_arg2 + f4_arg0.replaceContentData.inState = f4_arg3 + f4_arg0.replaceContentData.outDuration = f4_arg4 + f4_arg0.replaceContentData.inDuration = f4_arg5 + f4_arg0.replaceContentData.text = f4_arg1 + f4_arg0:registerEventHandler( "transition_complete_" .. f4_arg2, LUI.UIText.TransitionComplete_OutState ) + f4_arg0:animateToState( f4_arg2, f4_arg4 ) + return + else + f4_arg0:setTextInC( f4_arg1 ) + end +end + +LUI.UIText.setTextStyle = function ( f5_arg0, f5_arg1 ) + f5_arg0.m_textStyle = f5_arg1 +end + +LUI.UIText.setForceLineBreaks = function ( f6_arg0, f6_arg1 ) + f6_arg0.m_forceLineBreaks = f6_arg1 +end + +LUI.UIText.id = "LUIText" diff --git a/lui/luitighttext.dec.lua b/lui/luitighttext.dec.lua new file mode 100644 index 0000000..5acbbd3 --- /dev/null +++ b/lui/luitighttext.dec.lua @@ -0,0 +1,7 @@ +LUI.UITightText = {} +LUI.UITightText.new = function ( f1_arg0 ) + local self = LUI.UIText.new( f1_arg0 ) + self:setupUITightText() + return self +end + diff --git a/lui/luitimer.dec.lua b/lui/luitimer.dec.lua new file mode 100644 index 0000000..87d3779 --- /dev/null +++ b/lui/luitimer.dec.lua @@ -0,0 +1,134 @@ +LUI.UITimer = {} +local f0_local0 = {} +LUI.UITimer.priority = 10000 +Queue = { + new = function () + local f1_local0 = { + first = 0, + last = -1 + } + setmetatable( f1_local0, Queue ) + Queue.__index = Queue + return f1_local0 + end, + push = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0.last + 1 + f2_arg0.last = f2_local0 + f2_arg0[f2_local0] = f2_arg1 + end, + pop = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0.first + if f3_arg0.last < f3_local0 then + return nil + else + local f3_local1 = f3_arg0[f3_local0] + f3_arg0[f3_local0] = nil + f3_arg0.first = f3_local0 + 1 + return f3_local1 + end + end +} +LUI.UITimer.build = function ( f4_arg0, f4_arg1 ) + assert( f4_arg1.interval, "No property for interval set for timer" ) + assert( f4_arg1.event, "No property for event set for timer" ) + return LUI.UITimer.new( f4_arg1.interval, f4_arg1.event, f4_arg1.group, f4_arg1.disposable, f4_arg1.eventTarget, f4_arg1.broadcastToRoot, f4_arg1.stopped ) +end + +LUI.UITimer.new = function ( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5, f5_arg6 ) + local self = LUI.UIElement.new( { + left = 0, + top = 0, + right = 1, + bottom = 1, + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false + } ) + self.id = "LUITimer" + self:setPriority( LUI.UITimer.priority ) + self.reset = LUI.UITimer.Reset + self.interval = math.max( 1, f5_arg0 ) + self.disposable = f5_arg3 + self.deferNextFrame = f5_arg5 + if type( f5_arg1 ) == "string" then + self.timerEvent = { + name = f5_arg1, + timer = self + } + else + f5_arg1.timer = self + self.timerEvent = f5_arg1 + end + self.timerEventTarget = f5_arg4 + self.timerGroup = f5_arg2 + local f5_local1 = "TE_" .. (self.timerGroup and self.timerGroup .. "_" or "") .. self.timerEvent.name + self.profileID = profile.lookupusereventid( f5_local1 ) or profile.createuserevent( f5_local1, "duration" ) + if not f5_arg6 then + self:reset() + end + return self +end + +LUI.UITimer.Reset = function ( f6_arg0 ) + f6_arg0:registerEventHandler( "transition_complete_default", nil ) + f6_arg0:animateToState( "default", f6_arg0.interval ) + f6_arg0:registerEventHandler( "transition_complete_default", LUI.UITimer.Tick ) +end + +LUI.UITimer.Stop = function ( f7_arg0 ) + f7_arg0:registerEventHandler( "transition_complete_default", nil ) + f7_arg0:animateToState( "default", 0 ) +end + +LUI.UITimer.Tick = function ( f8_arg0, f8_arg1 ) + local f8_local0 = nil + if f8_arg0.timerEventTarget ~= nil then + f8_local0 = f8_arg0.timerEventTarget + else + f8_local0 = f8_arg0:getParent() + end + local f8_local1 = f8_arg0.timerEvent + f8_local1.timeElapsed = f8_arg0.interval + f8_arg1.lateness + if f8_arg0.timerGroup then + f8_local1.target = f8_local0 + local f8_local2 = f8_arg0:getRootParent() + local f8_local3 = f8_arg0.timerGroup + if not f8_local2.timerGroupQueues[f8_local3] then + f8_local2.timerGroupQueues[f8_local3] = Queue.new() + end + f8_local2.timerGroupQueues[f8_local3]:push( f8_local1 ) + else + if not f8_arg0.deferNextFrame then + profile.beginuserevent( f8_arg0.profileID ) + f8_local0:processEvent( f8_local1 ) + profile.enduserevent( f8_arg0.profileID ) + else + f8_local1.target = f8_local0 + f8_arg0:dispatchEventToRoot( f8_local1 ) + end + if f8_arg0.disposable then + f8_arg0:close() + else + f8_arg0:reset() + end + end +end + +LUI.UITimer.DispatchEventsFromQueue = function ( f9_arg0 ) + for f9_local4, f9_local5 in pairs( f9_arg0.timerGroupQueues ) do + local f9_local6 = f9_local5:pop() + if f9_local6 then + profile.beginuserevent( f9_local6.timer.profileID ) + f9_local6.target:processEvent( f9_local6 ) + profile.enduserevent( f9_local6.timer.profileID ) + local f9_local3 = f9_local6.timer + if f9_local3.disposable then + f9_local3:close() + else + f9_local3:reset() + end + end + end +end + diff --git a/lui/luiverticallist.dec.lua b/lui/luiverticallist.dec.lua new file mode 100644 index 0000000..aa7ce7d --- /dev/null +++ b/lui/luiverticallist.dec.lua @@ -0,0 +1,185 @@ +LUI.UIVerticalList = {} +LUI.UIVerticalNavigator = {} +LUI.UIVerticalList.AddSpacer = function ( f1_arg0, f1_arg1, f1_arg2 ) + local self = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + topAnchor = true, + bottomAnchor = false, + top = 0, + bottom = f1_arg1 + } ) + self:setPriority( f1_arg2 ) + f1_arg0:addElement( self ) + return self +end + +LUI.UIVerticalList.build = function ( menu, controller ) + local self = LUI.UIVerticalList.new( nil, controller.scrollByChildHeight, controller.disableOutsideChildren, controller.sendScrollEvents ) + LUI.UIVerticalList.SetNoWrap( self, controller.noWrap ) + return self +end + +LUI.UIVerticalList.new = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3 ) + local self = LUI.UIElement.new( f3_arg0 ) + self.id = "LUIVerticalList" + self:setupUIVerticalList( f3_arg1, f3_arg2, f3_arg3 ) + self.addSpacer = LUI.UIVerticalList.AddSpacer + self.addElement = LUI.UIVerticalList.AddElement + self.removeElement = LUI.UIVerticalList.RemoveElement + self.updateNavigation = LUI.UIVerticalList.UpdateNavigation + self:registerEventHandler( "gain_focus", LUI.UIVerticalList.gainFocus ) + self:registerEventHandler( "update_navigation", function ( element, event ) + element:updateNavigation() + end ) + return self +end + +LUI.UIVerticalList.SetNoWrap = function ( f5_arg0, f5_arg1 ) + f5_arg0.noWrap = f5_arg1 +end + +LUI.UIVerticalNavigator.build = function ( f6_arg0, f6_arg1 ) + return LUI.UIVerticalNavigator.new() +end + +LUI.UIVerticalNavigator.new = function ( f7_arg0 ) + local self = LUI.UIElement.new( f7_arg0 ) + self.id = "LUIVerticalNavigator" + self.addSpacer = LUI.UIVerticalList.AddSpacer + self.addElement = LUI.UIVerticalList.AddElement + self.removeElement = LUI.UIVerticalList.RemoveElement + self.updateNavigation = LUI.UIVerticalList.UpdateNavigation + self:registerEventHandler( "gain_focus", LUI.UIVerticalList.gainFocus ) + self:registerEventHandler( "update_navigation", function ( element, event ) + element:updateNavigation() + end ) + return self +end + +LUI.UIVerticalList.AddElement = function ( f9_arg0, f9_arg1 ) + LUI.UIElement.addElement( f9_arg0, f9_arg1 ) + f9_arg1.navigation = {} + f9_arg0:setLayoutCached( false ) + f9_arg0:updateNavigation() +end + +LUI.UIVerticalList.RemoveElement = function ( f10_arg0, f10_arg1 ) + LUI.UIElement.removeElement( f10_arg0, f10_arg1 ) + f10_arg0:setLayoutCached( false ) + f10_arg0:updateNavigation() +end + +LUI.UIVerticalList.UpdateNavigation = function ( f11_arg0 ) + local f11_local0, f11_local1 = nil + local f11_local2 = f11_arg0:getFirstChild() + while f11_local2 ~= nil do + if f11_local2:canFocus( FocusType.ListSelection ) then + if f11_local0 == nil then + f11_local0 = f11_local2 + end + if f11_local1 ~= nil then + f11_local1.navigation.down = f11_local2 + f11_local2.navigation.up = f11_local1 + else + f11_local2.navigation.up = nil + end + if f11_local2.navigation ~= nil and f11_arg0.navigation ~= nil then + f11_local2.navigation.left = f11_arg0.navigation.left + f11_local2.navigation.right = f11_arg0.navigation.right + end + f11_local1 = f11_local2 + end + f11_local2 = f11_local2:getNextSibling() + end + if f11_local1 ~= nil then + if f11_arg0.navigation ~= nil and f11_arg0.navigation.down ~= nil and f11_arg0.navigation.down:canFocus( FocusType.ListSelection ) == true then + f11_local1.navigation.down = f11_arg0.navigation.down + f11_arg0.navigation.down.navigation.up = f11_local1 + elseif f11_local1 ~= f11_local0 and not f11_arg0.noWrap then + f11_local1.navigation.down = f11_local0 + else + f11_local1.navigation.down = nil + end + if f11_arg0.navigation ~= nil and f11_arg0.navigation.up ~= nil and f11_arg0.navigation.up:canFocus( FocusType.ListSelection ) == true then + f11_local0.navigation.up = f11_arg0.navigation.up + f11_arg0.navigation.up.navigation.down = f11_local0 + elseif f11_local1 ~= f11_local0 and not f11_arg0.noWrap then + f11_local0.navigation.up = f11_local1 + else + f11_local0.navigation.up = nil + end + end +end + +LUI.UIVerticalList.gainFocus = function ( f12_arg0, f12_arg1 ) + local f12_local0, f12_local1 = f12_arg0:restoreState() + if f12_local1 == 0 then + local f12_local2, f12_local3 = nil + local f12_local4 = f12_arg0:getFirstChild() + while f12_local4 ~= nil do + if f12_local4:canFocus( FocusType.ListSelection ) then + if f12_local2 == nil then + f12_local2 = f12_local4 + end + if f12_local3 == nil and f12_local4.listDefaultFocus then + f12_local3 = f12_local4 + end + end + end + if f12_local3 ~= nil then + f12_local3:processEvent( f12_arg1 ) + elseif f12_local2 ~= nil then + f12_local2:processEvent( f12_arg1 ) + else + + end + f12_local4 = f12_local4:getNextSibling() + end +end + +LUI.UIVerticalList.getHeightOfChildren = function ( f13_arg0, f13_arg1 ) + local f13_local0 = f13_arg0:getRect() + local f13_local1 = f13_arg1 or 0 + if f13_local0 then + local f13_local2 = f13_arg0:getFirstChild() + local f13_local3 + if f13_local2 then + f13_local3 = -f13_local1 + if not f13_local3 then + f13_local3 = 0 + while f13_local2 do + local f13_local4 = nil + if f13_local2.getText and f13_local2:getText() then + local f13_local5 = nil + f13_local5, f13_local4 = f13_local2:getElementTextDims() + else + f13_local4 = f13_local2:getHeight() + end + f13_local3 = f13_local3 + f13_local1 + f13_local4 + f13_local2 = f13_local2:getNextSibling() + end + return f13_local3 + end + else + f13_local3 = 0 + while f13_local2 do + local f13_local4 = nil + if f13_local2.getText and f13_local2:getText() then + local f13_local5 = nil + f13_local5, f13_local4 = f13_local2:getElementTextDims() + else + f13_local4 = f13_local2:getHeight() + end + f13_local3 = f13_local3 + f13_local1 + f13_local4 + f13_local2 = f13_local2:getNextSibling() + end + return f13_local3 + end + else + + end +end + diff --git a/lui/luiverticalscrollbar.dec.lua b/lui/luiverticalscrollbar.dec.lua new file mode 100644 index 0000000..6d94df7 --- /dev/null +++ b/lui/luiverticalscrollbar.dec.lua @@ -0,0 +1,261 @@ +LUI.UIVerticalScrollbar = {} +LUI.UIVerticalScrollbar.InactiveDelay = 500 +LUI.UIVerticalScrollbar.InactiveDuration = 250 +function OnMouseMove( f1_arg0, f1_arg1 ) + if f1_arg0.scrolling then + local f1_local0 = f1_arg0:getParent() + local f1_local1 = f1_local0:getHeight() + local f1_local2, f1_local3, f1_local4, f1_local5 = f1_local0:getRect() + local f1_local6, f1_local7 = f1_arg1.root:pixelsToUnits( f1_arg1.x, f1_arg1.y ) + f1_local2, f1_local3 = f1_arg1.root:pixelsToUnits( f1_local2, f1_local3 ) + local f1_local8 = (f1_local7 - f1_local3) / f1_local1 + if f1_local8 < 0 then + f1_local8 = 0 + elseif f1_local8 > 1 then + f1_local8 = 1 + end + if f1_arg0.onMoveFunc then + f1_arg0.onMoveFunc( f1_local0, f1_local0.verticalList, f1_local8, f1_local0.properties ) + end + end +end + +function MouseMoveEvent( f2_arg0, f2_arg1 ) + f2_arg0:applyElementTransform() + local f2_local0, f2_local1 = ProjectRootCoordinate( f2_arg1.rootName, f2_arg1.x, f2_arg1.y ) + OnMouseMove( f2_arg0, { + controller = f2_arg1.controller, + root = f2_arg1.root, + x = f2_local0, + y = f2_local1 + } ) + f2_arg0:undoElementTransform() +end + +function ScrollbarMoved( f3_arg0, f3_arg1, f3_arg2 ) + if not f3_arg1 then + DebugPrint( "Warning: Tried to scroll a scrollbar without a vertical list. Make sure the vertical list was manually added. E.G. scrollBar:setList( )." ) + return + elseif not f3_arg2 then + DebugPrint( "Warning: Tried to scroll a scrollbar without a scroll percentage. This is very bad." ) + return + end + local f3_local0 = f3_arg1:getNumChildren() + local f3_local1 = math.min( math.floor( f3_arg2 * f3_local0 ), f3_local0 - 1 ) + if f3_local1 == f3_arg1.lastFocusIndex then + return + end + f3_arg1.lastFocusIndex = f3_local1 + local f3_local2 = f3_arg1:getFirstChild() + local f3_local3 = nil + for f3_local4 = 0, f3_local0 - 1, 1 do + if f3_local4 == f3_local1 then + f3_local3 = f3_local2 + end + f3_local2:processEvent( { + name = "lose_focus", + immediate = true + } ) + f3_local2 = f3_local2:getNextSibling() + end + if f3_local3 then + f3_local3:processEvent( { + name = "gain_focus", + immediate = true + } ) + end +end + +function OnMouseDown( f4_arg0, f4_arg1 ) + f4_arg0.scrolling = true + local f4_local0 = Engine.SetUsingScrollbar + local f4_local1 = f4_arg1.controller + if not f4_local1 then + f4_local1 = Engine.GetFirstActiveController() + end + f4_local0( f4_local1, true ) + OnMouseMove( f4_arg0, f4_arg1 ) + f4_local0 = f4_arg0:getParent() + if f4_local0.verticalList then + f4_local0.verticalList:processEvent( { + name = "set_children_ignore_mouse", + ignore = true, + immediate = true + } ) + end +end + +function StopScrolling( f5_arg0, f5_arg1 ) + f5_arg0.scrolling = false + local f5_local0 = Engine.SetUsingScrollbar + local f5_local1 = f5_arg1.controller + if not f5_local1 then + f5_local1 = Engine.GetFirstActiveController() + end + f5_local0( f5_local1, false ) + f5_local0 = f5_arg0:getParent() + if f5_local0.verticalList then + f5_local0.verticalList:processEvent( { + name = "set_children_ignore_mouse", + ignore = false, + immediate = true + } ) + end +end + +LUI.UIVerticalScrollbar.build = function ( f6_arg0, f6_arg1 ) + return LUI.UIVerticalScrollbar.new( f6_arg1.vlist, f6_arg1.bar_width, f6_arg1.active_alpha, f6_arg1.inactive_alpha, f6_arg1.on_move_func, f6_arg1.bar_color, f6_arg1.bg_color, f6_arg1.bar_material, f6_arg1.bg_material ) +end + +LUI.UIVerticalScrollbar.new = function ( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_arg4, f7_arg5, f7_arg6, f7_arg7, f7_arg8 ) + if not f7_arg1 then + f7_arg1 = 20 + end + if not f7_arg2 then + f7_arg2 = 1 + end + if not f7_arg3 then + f7_arg3 = 1 + end + if not f7_arg4 then + f7_arg4 = ScrollbarMoved + end + if not f7_arg5 then + f7_arg5 = { + red = 0.3, + green = 0.3, + blue = 0.3, + alpha = 1 + } + end + if not f7_arg6 then + f7_arg6 = { + red = 0.05, + green = 0.05, + blue = 0.05, + alpha = 0.6 + } + end + if not f7_arg7 then + f7_arg7 = "white" + end + if not f7_arg8 then + f7_arg8 = "white" + end + local self = LUI.UIElement.new( { + left = 0, + top = 0, + right = f7_arg1, + bottom = 0, + leftAnchor = false, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true, + alpha = f7_arg2 + } ) + self.id = "LUIVerticalScrollbar" + self:registerAnimationState( "inactive", { + left = 0, + right = f7_arg1, + leftAnchor = false, + rightAnchor = true, + alpha = f7_arg3 + } ) + self:registerEventHandler( "list_scroll", LUI.UIVerticalScrollbar.UpdateScrollbar ) + self:registerEventHandler( "focus_changed", LUI.UIVerticalScrollbar.FocusChanged ) + self:registerEventHandler( "inactive", LUI.UIVerticalScrollbar.Inactive ) + self.bgImage = LUI.UIImage.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true, + red = f7_arg6.red, + green = f7_arg6.green, + blue = f7_arg6.blue, + alpha = f7_arg6.alpha, + material = RegisterMaterial( f7_arg8 ) + } ) + self.bgImage:animateToState( "default" ) + self:addElement( self.bgImage ) + self.scrollButton = LUI.UIButton.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true + } ) + self.buttonImage = LUI.UIImage.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false, + red = f7_arg5.red, + green = f7_arg5.green, + blue = f7_arg5.blue, + alpha = f7_arg5.alpha, + material = RegisterMaterial( f7_arg7 ) + } ) + self.scrollButton.onMoveFunc = f7_arg4 + self.scrollButton:registerEventHandler( "leftmousedown", OnMouseDown ) + self.scrollButton:registerEventHandler( "leftmouseup", StopScrolling ) + self.scrollButton:addEventHandler( "popup_active", StopScrolling ) + self.scrollButton:addEventHandler( "mousemove", MouseMoveEvent ) + self.scrollButton:addElement( self.buttonImage ) + self:addElement( self.scrollButton ) + self.setList = LUI.UIVerticalScrollbar.SetVerticalList + self.manualUpdate = LUI.UIVerticalScrollbar.ManualUpdate + self:setList( f7_arg0 ) + return self +end + +LUI.UIVerticalScrollbar.UpdateScrollbar = function ( f8_arg0, f8_arg1 ) + if f8_arg0.verticalList and f8_arg1.list == f8_arg0.verticalList then + f8_arg0.buttonImage:registerAnimationState( "default", { + top = f8_arg1.scrollHandlePosition, + bottom = f8_arg1.scrollHandlePosition + f8_arg1.scrollHandleSize, + topAnchor = true, + bottomAnchor = false + } ) + f8_arg0.buttonImage:animateToState( "default" ) + end + f8_arg0:dispatchEventToChildren( f8_arg1 ) +end + +LUI.UIVerticalScrollbar.FocusChanged = function ( f9_arg0, f9_arg1 ) + f9_arg0:animateToState( "default" ) + if f9_arg0.inactiveTimer then + f9_arg0.inactiveTimer:close() + f9_arg0.inactiveTimer:reset() + f9_arg0:addElement( f9_arg0.inactiveTimer ) + else + f9_arg0.inactiveTimer = LUI.UITimer.new( LUI.UIVerticalScrollbar.InactiveDelay, "inactive", true ) + f9_arg0:addElement( f9_arg0.inactiveTimer ) + end +end + +LUI.UIVerticalScrollbar.Inactive = function ( f10_arg0, f10_arg1 ) + f10_arg0:animateToState( "inactive", LUI.UIVerticalScrollbar.InactiveDuration ) +end + +LUI.UIVerticalScrollbar.SetVerticalList = function ( f11_arg0, f11_arg1 ) + f11_arg0.verticalList = f11_arg1 +end + +LUI.UIVerticalScrollbar.ManualUpdate = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + local f12_local0 = f12_arg0:getHeight() + local f12_local1 = f12_local0 + local f12_local2 = 0 + if f12_arg3 ~= 0 then + f12_local1 = math.min( f12_local0, f12_local0 * f12_arg2 / f12_arg3 ) + if f12_arg3 ~= f12_arg2 then + f12_local2 = LUI.clamp( f12_arg1 / (f12_arg3 - f12_arg2) * (f12_local0 - f12_local1), 0, f12_local0 - f12_local1 ) + end + end + f12_arg0.buttonImage:registerAnimationState( "default", { + top = f12_local2, + bottom = f12_local2 + f12_local1, + topAnchor = true, + bottomAnchor = false + } ) + f12_arg0.buttonImage:animateToState( "default" ) +end + diff --git a/lui/menuautonav.dec.lua b/lui/menuautonav.dec.lua new file mode 100644 index 0000000..edcd6b9 --- /dev/null +++ b/lui/menuautonav.dec.lua @@ -0,0 +1,780 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +INTERVAL_MS = 25 +MAX_COUNTER = 200 +MAX_COUNTER_GOBACK = 20 +MAX_DURATION_COUNTER = 400 +DISABLE_NAVIGATING_OVERLAY = 0 +STATE = { + IDLE = 0, + WORKING_DROPBACK = 1, + WORKING_MOVEFORWARD = 2 +} +LUI.MenuAutoNav.m_menuAutoNav = 0 +s_navTableSP = { + { + destScreen = "resume_campaign", + route = { + { + topScreen = "main_menu", + action = "sp_button" + }, + { + topScreen = "main_campaign", + action = "btn_resume_id" + }, + { + topScreen = "resume_game_menu", + action = "" + } + } + }, + { + destScreen = "mission_select", + route = { + { + topScreen = "main_menu", + action = "sp_button" + }, + { + topScreen = "main_campaign", + action = "btn_mission_select_id" + }, + { + topScreen = "level_select_iw6", + action = "" + } + } + }, + { + destScreen = "mp", + route = { + { + topScreen = "main_menu", + action = "mp_button" + } + }, + routeOverlayDelay = 5000 + }, + { + destScreen = "aliens", + route = { + { + topScreen = "main_menu", + action = "extinction_button" + } + }, + routeOverlayDelay = 5000 + }, + { + destScreen = "squads", + route = { + { + topScreen = "main_menu", + action = "squadvssquad_button" + } + }, + routeOverlayDelay = 5000 + } +} +s_navTableMP = { + { + destScreen = "sp", + route = { + { + topScreen = "mp_main_menu", + action = "button_secondary" + }, + { + topScreen = "main_choose_exe_popup_menu", + action = "main_choose_sp_button" + } + }, + routeOverlayDelay = 5000 + }, + { + destScreen = "mp", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_7" + } + } + }, + { + destScreen = "aliens", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_9" + } + } + }, + { + destScreen = "squads", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_8" + } + } + }, + { + destScreen = "xboxlive", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "" + } + } + }, + { + destScreen = "splitscreen", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_1" + }, + { + topScreen = "menu_splitscreensignin", + action = "" + } + } + }, + { + destScreen = "systemlink", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_2" + }, + { + topScreen = "menu_systemlink", + action = "" + } + } + }, + { + destScreen = "options", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_6" + } + } + }, + { + destScreen = "xboxlive_findmatch", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "find_match_button_id" + }, + { + topScreen = "playlist_main", + action = "" + } + } + }, + { + destScreen = "xboxlive_privatematch", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "private_match_button_id" + }, + { + topScreen = "menu_xboxlive_privatelobby", + action = "" + } + } + }, + { + destScreen = "xboxlive_privatematch_gamesetup", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "private_match_button_id" + }, + { + topScreen = "menu_xboxlive_privatelobby", + action = "setup_match_button_id" + }, + { + topScreen = "menu_systemlink_gamesetup_root", + action = "" + } + } + }, + { + destScreen = "xboxlive_create_squad", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "create_squad_button_id" + }, + { + topScreen = "cac_edit_main", + action = "" + } + } + }, + { + destScreen = "xboxlive_barracks_leaderboards", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "barracks_button_id" + }, + { + topScreen = "menu_barracks", + action = "leaderboard_button_id" + }, + { + topScreen = "leaderboards", + action = "" + } + } + }, + { + destScreen = "xboxlive_aliens_loadout", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "aliens_loadout_btn_id" + }, + { + topScreen = "aliens_cac_menu", + action = "" + } + } + }, + { + destScreen = "xboxlive_aliens_leaderboards", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "leaderboards_button_id" + }, + { + topScreen = "mp_leaderboard_main", + action = "" + } + } + }, + { + destScreen = "squadvssquad_squad_assault", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive*", + action = "squads_mode_button_squad_assault" + } + } + }, + { + destScreen = "squadvssquad_squad_vs_squad", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive*", + action = "squads_mode_button_squad_vs_squad" + } + } + }, + { + destScreen = "squadvssquad_safeguard", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive*", + action = "squads_mode_button_safeguard" + } + } + }, + { + destScreen = "squadvssquad_wargame", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive*", + action = "squads_mode_button_wargame" + } + } + }, + { + destScreen = "squadvssquad_squad_reports", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive*", + action = "squads_mode_button_squad_reports" + }, + { + topScreen = "squads_hq_menu*", + action = "squads_mode_button_squad_reports" + } + } + }, + { + destScreen = "squadvssquad_local_play", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_1" + }, + { + topScreen = "menu_splitscreensignin", + action = "" + } + } + } +} +function new() + local f1_local0 = {} + setmetatable( f1_local0, { + __index = _M + } ) + f1_local0.m_state = STATE.IDLE + f1_local0.m_controller = -1 + f1_local0.m_counter = 0 + f1_local0.m_durationCounter = 0 + f1_local0.m_currentRoute = {} + f1_local0.m_root = 0 + f1_local0.m_timerElement = 0 + return f1_local0 +end + +function Reset() + if LUI.MenuAutoNav.ShouldCloseOverlay() then + LUI.MenuAutoNav.CloseOverlay() + end + local f2_local0 = LUI.MenuAutoNav.GetInstance() + if f2_local0.m_timerElement and f2_local0.m_timerElement ~= 0 and f2_local0.m_root and f2_local0.m_root ~= 0 then + f2_local0.m_root:removeElement( f2_local0.m_timerElement ) + f2_local0.m_timerElement:close() + end + f2_local0.m_state = STATE.IDLE + f2_local0.m_controller = -1 + f2_local0.m_counter = 0 + f2_local0.m_durationCounter = 0 + f2_local0.m_currentRoute = {} + f2_local0.m_root = 0 + f2_local0.m_timerElement = 0 +end + +function GetInstance() + if LUI.MenuAutoNav.m_menuAutoNav == 0 then + LUI.MenuAutoNav.m_menuAutoNav = LUI.MenuAutoNav.new() + end + return LUI.MenuAutoNav.m_menuAutoNav +end + +function IsRunning() + local f4_local0 = LUI.MenuAutoNav.GetInstance() + if f4_local0.m_state ~= STATE.IDLE then + return true + else + return false + end +end + +function Stop() + if IsRunning() then + Reset() + end +end + +function SendButtonPress( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = { + name = "gamepad_button", + immediate = true, + down = true, + button = f6_arg0, + qualifier = f6_arg1, + controller = f6_arg2 + } + local f6_local1 = Engine.GetLuiRoot() + if not f6_local1 then + return false + else + f6_local1:dispatchEventToRoot( f6_local0 ) + return true + end +end + +function FindRouteEntry( f7_arg0 ) + local f7_local0 = LUI.MenuAutoNav.GetInstance() + assert( f7_arg0 ) + local f7_local1 = nil + if Engine.IsMultiplayer() then + f7_local1 = s_navTableMP + else + f7_local1 = s_navTableSP + end + if f7_local1 then + for f7_local5, f7_local6 in ipairs( f7_local1 ) do + if f7_local6.route and string.lower( f7_arg0 ) == string.lower( f7_local6.destScreen ) then + return f7_local6 + end + end + end + return nil +end + +function Yield() + local f8_local0 = LUI.MenuAutoNav.GetInstance() + f8_local0.m_counter = f8_local0.m_counter + 1 + if f8_local0.m_counter > MAX_COUNTER then + DebugPrint( "MenuAutoNav: Timeout!" ) + LUI.MenuAutoNav.Stop() + return + else + + end +end + +function IsMenuInCurrentRoute( f9_arg0 ) + local f9_local0 = LUI.MenuAutoNav.GetInstance() + assert( f9_arg0 ) + local f9_local1 = LUI.MenuAutoNav.GetInstance() + if f9_local1.m_currentRoute then + for f9_local5, f9_local6 in ipairs( f9_local1.m_currentRoute ) do + if string.lower( f9_local6.topScreen ) == string.lower( f9_arg0 ) then + return true, f9_local5 + end + end + end + return false, -1 +end + +function HandleMenuAutoNavOverlayRefresh( f10_arg0, f10_arg1 ) + if LUI.MenuAutoNav.ShouldCloseOverlay() then + LUI.MenuAutoNav.CloseOverlay() + end +end + +function menu_auto_nav_overlay() + return { + type = "UIElement", + id = "menu_auto_nav_overlay_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_auto_nav_overlay_refresh = HandleMenuAutoNavOverlayRefresh + }, + children = { + { + type = "UIImage", + id = "menu_auto_nav_background_id", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = 1 + } ) + }, + children = { + { + type = "generic_loading_widget", + properties = { + message = Engine.Localize( "@SPEECH_NAVIGATING" ) + } + } + } + }, + { + type = "UITimer", + id = "menu_auto_nav_overlay_timer", + properties = { + event = "menu_auto_nav_overlay_refresh", + interval = 25, + disposable = false, + broadcastToRoot = false + } + } + } + } +end + +function OpenOverlay( f12_arg0 ) + if DISABLE_NAVIGATING_OVERLAY ~= 0 then + return + end + local f12_local0 = Engine.GetLuiRoot() + if not f12_local0 then + DebugPrint( "MenuAutoNavOverlay: Error, no root found. Cannot open overlay." ) + return + elseif f12_local0.m_menuAutoNavOverlay then + DebugPrint( "MenuAutoNavOverlay: Ignoring open request because we are already open." ) + return + end + local m_menuAutoNavOverlay = LUI.MenuBuilder.buildItems( menu_auto_nav_overlay(), {}, f12_local0 ) + m_menuAutoNavOverlay:animateToState( "default" ) + m_menuAutoNavOverlay:setPriority( 400 ) + f12_local0:addElement( m_menuAutoNavOverlay ) + f12_local0.m_menuAutoNavOverlay = m_menuAutoNavOverlay + + if f12_arg0 and f12_arg0 > 0 then + f12_local0.m_menuAutoNavOverlayDelay = f12_arg0 + f12_local0.m_menuAutoNavOverlayTimeStamp = 0 + else + f12_local0.m_menuAutoNavOverlayDelay = 0 + f12_local0.m_menuAutoNavOverlayTimeStamp = 0 + end +end + +function CloseOverlay() + local f13_local0 = Engine.GetLuiRoot() + if not f13_local0 then + DebugPrint( "MenuAutoNavOverlay: Error, no root found, therefore we cannot close overlay." ) + return + elseif not f13_local0.m_menuAutoNavOverlay then + DebugPrint( "MenuAutoNavOverlay: Warning, ignoring attempt to close overlay because it is already closed." ) + return + else + f13_local0:removeElement( f13_local0.m_menuAutoNavOverlay ) + f13_local0.m_menuAutoNavOverlay = nil + f13_local0.m_menuAutoNavOverlayDelay = nil + f13_local0.m_menuAutoNavOverlayTimeStamp = nil + end +end + +function ShouldCloseOverlay() + if LUI.MenuAutoNav.IsRunning() then + return false + end + local f14_local0 = Engine.GetLuiRoot() + if not f14_local0 then + return false + elseif not f14_local0.m_menuAutoNavOverlay then + return false + elseif f14_local0.m_menuAutoNavOverlayDelay and f14_local0.m_menuAutoNavOverlayTimeStamp and f14_local0.m_menuAutoNavOverlayDelay > 0 then + local f14_local1 = Engine.GetMilliseconds() + if f14_local0.m_menuAutoNavOverlayTimeStamp == 0 then + f14_local0.m_menuAutoNavOverlayTimeStamp = f14_local1 + f14_local0.m_menuAutoNavOverlayDelay + return false + elseif f14_local1 < f14_local0.m_menuAutoNavOverlayTimeStamp then + return false + end + end + return true +end + +function HandleTimerEvent( f15_arg0, f15_arg1 ) + local f15_local0 = LUI.MenuAutoNav.GetInstance() + if not f15_local0.m_currentRoute then + DebugPrint( "MenuAutoNav: Current route is empty. Bailing" ) + Stop() + return + elseif #f15_local0.m_currentRoute < 1 then + DebugPrint( "MenuAutoNav: Current route is empty. Bailing" ) + Stop() + return + end + f15_local0.m_durationCounter = f15_local0.m_durationCounter + 1 + if f15_local0.m_durationCounter > MAX_DURATION_COUNTER then + DebugPrint( "MenuAutoNav: Max duration counter exceeded. Bailing" ) + Stop() + return + elseif f15_local0.m_state == STATE.WORKING_DROPBACK then + if LUI.FlowManager.IsTopMenuModal() then + DebugPrint( "MenuAutoNav: A modal menu popped up while attempting to find a starting point. We are stopping here." ) + LUI.MenuAutoNav.Stop() + return + end + local f15_local1 = LUI.FlowManager.GetTopOpenAndVisibleMenuName() + if not f15_local1 then + Yield() + return + end + local f15_local2, f15_local3 = nil + f15_local2, f15_local3 = IsMenuInCurrentRoute( f15_local1 ) + if not f15_local2 or f15_local2 ~= true then + f15_local0.m_counter = f15_local0.m_counter + 1 + if f15_local0.m_counter <= MAX_COUNTER_GOBACK then + return + elseif string.lower( f15_local1 ) == string.lower( "main_menu" ) or string.lower( f15_local1 ) == string.lower( "mp_main_menu" ) then + DebugPrint( "MenuAutoNav: Menu we are looking for not found, and we cannot move back any more. Stopping!" ) + LUI.MenuAutoNav.Stop() + return + elseif string.lower( f15_local1 ) == string.lower( "menu_splitscreensignin" ) then + LUI.FlowManager.RequestLeaveMenuByName( "menu_splitscreensignin" ) + f15_local0.m_counter = 0 + elseif LUI.MenuAutoNav.SendButtonPress( "secondary", nil, f15_local0.m_controller ) == true then + f15_local0.m_counter = 0 + end + return + elseif f15_local3 > 1 then + + else + f15_local0.m_state = STATE.WORKING_MOVEFORWARD + f15_local0.m_counter = 0 + end + while f15_local3 > 1 do + table.remove( f15_local0.m_currentRoute, 1 ) + f15_local3 = f15_local3 - 1 + end + f15_local0.m_state = STATE.WORKING_MOVEFORWARD + f15_local0.m_counter = 0 + end + if f15_local0.m_state == STATE.WORKING_MOVEFORWARD then + local f15_local1 = Engine.GetLuiRoot() + if f15_local1 == nil then + DebugPrint( "MenuAutoNav: Error, we have no root! Stopping" ) + Stop() + return + end + local f15_local2 = f15_local0.m_currentRoute[1] + if string.lower( f15_local2.action ) == string.lower( "" ) then + DebugPrint( "MenuAutoNav: Our current route action is empty, therefore we should be at our destination. Done." ) + Stop() + return + elseif string.lower( f15_local2.action ) == string.lower( "button_secondary" ) then + if LUI.MenuAutoNav.SendButtonPress( "secondary", nil, f15_local0.m_controller ) ~= true then + Yield() + return + end + else + local f15_local3 = f15_local1:getFirstDescendentById( f15_local2.action ) + if not f15_local3 then + Yield() + return + elseif f15_local3.disabled and not f15_local3.locked then + Yield() + return + end + f15_local3:processEvent( { + name = "button_action", + controller = f15_local0.m_controller + } ) + f15_local3:processEvent( { + name = "button_down", + controller = f15_local0.m_controller + } ) + end + table.remove( f15_local0.m_currentRoute, 1 ) + if #f15_local0.m_currentRoute >= 1 then + f15_local0.m_counter = 0 + return + end + DebugPrint( "MenuAutoNav: Done!" ) + end + Stop() +end + +function DebugDumpRoute( f16_arg0 ) + local f16_local0 = LUI.MenuAutoNav.GetInstance() + DebugPrint( "----------------------------------------------------------------" ) + DebugPrint( "MenuAutoNav: Route:" ) + for f16_local4, f16_local5 in ipairs( f16_arg0 ) do + DebugPrint( " #" .. tostring( f16_local4 ) .. " : topScreen=\"" .. tostring( f16_local5.topScreen ) .. "\", action=\"" .. tostring( f16_local5.action ) .. "\"" ) + end + DebugPrint( "----------------------------------------------------------------" ) +end + +function Goto( f17_arg0, f17_arg1 ) + assert( f17_arg0 ) + local f17_local0 = LUI.MenuAutoNav.GetInstance() + if IsRunning() then + DebugPrint( "MenuAutoNav: Error, an outstanding auto navigation is still working. Unable to navigate to \"" .. f17_arg0 .. "\"!" ) + return false + end + local f17_local1 = FindRouteEntry( f17_arg0 ) + if not f17_local1 then + DebugPrint( "MenuAutoNav: Error, unable to find a route to \"" .. f17_arg0 .. "\"!" ) + return false + end + local f17_local2 = f17_local1.route + local f17_local3 = f17_local1.routeOverlayDelay or 0 + local f17_local4 = Engine.GetLuiRoot() + if f17_local4 == nil then + DebugPrint( "MenuAutoNav: Error, we do not appear to have a root! Unable to create timer for autonav process!" ) + return false + end + f17_local0.m_controller = f17_arg1 + f17_local0.m_counter = 0 + f17_local0.m_currentRoute = {} + for f17_local8, f17_local9 in ipairs( f17_local2 ) do + table.insert( f17_local0.m_currentRoute, f17_local9 ) + end + f17_local0.m_state = STATE.WORKING_DROPBACK + self = LUI.UITimer.new( INTERVAL_MS, { + name = "menu_auto_nav_timer" + } ) + self.id = "MenuAutoNavTimer" + f17_local4:addElement( self ) + f17_local0.m_root = f17_local4 + f17_local0.m_timerElement = self + DebugPrint( "MenuAutoNav: Goto( \"" .. f17_arg0 .. "\") started" ) + LUI.MenuAutoNav.OpenOverlay( f17_local3 ) + return true +end + +LockTable( _M ) diff --git a/lui/menubuilder.dec.lua b/lui/menubuilder.dec.lua new file mode 100644 index 0000000..171f1da --- /dev/null +++ b/lui/menubuilder.dec.lua @@ -0,0 +1,1182 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +function Property( f1_arg0 ) + local f1_local0 = {} + assert( f1_arg0, "No property name given" ) + f1_local0.propName = f1_arg0 + f1_local0.isProperty = true + f1_local0.func = function ( f2_arg0 ) + assert( f2_arg0[f1_local0.propName] ~= nil, "Could not find property named " .. f1_local0.propName ) + return f2_arg0[f1_local0.propName] + end + + return f1_local0 +end + +function OppositeProperty( f3_arg0 ) + local f3_local0 = {} + assert( f3_arg0, "No property name given" ) + f3_local0.propName = f3_arg0 + f3_local0.isProperty = true + f3_local0.func = function ( f4_arg0 ) + assert( f4_arg0[f3_local0.propName] ~= nil, "Could not find property named " .. f3_local0.propName ) + if type( f4_arg0[f3_local0.propName] ) == "number" then + return -f4_arg0[f3_local0.propName] + elseif type( f4_arg0[f3_local0.propName] ) == "boolean" then + return not f4_arg0[f3_local0.propName] + else + assert( false, "Property " .. f3_local0.propName .. " should be a number or a boolean for use with the OppositeProperty helper" ) + end + end + + return f3_local0 +end + +function HalfProperty( f5_arg0 ) + local f5_local0 = {} + assert( f5_arg0, "No property name given" ) + f5_local0.propName = f5_arg0 + f5_local0.isProperty = true + f5_local0.func = function ( f6_arg0 ) + assert( f6_arg0[f5_local0.propName] ~= nil, "Could not find property named " .. f5_local0.propName ) + if type( f6_arg0[f5_local0.propName] ) == "number" then + return 0.5 * f6_arg0[f5_local0.propName] + else + assert( false, "Property " .. f5_local0.propName .. " should be a number for use with the HalfProperty helper" ) + end + end + + return f5_local0 +end + +function HalfOppositeProperty( f7_arg0 ) + local f7_local0 = {} + assert( f7_arg0, "No property name given" ) + f7_local0.propName = f7_arg0 + f7_local0.isProperty = true + f7_local0.func = function ( f8_arg0 ) + assert( f8_arg0[f7_local0.propName] ~= nil, "Could not find property named " .. f7_local0.propName ) + if type( f8_arg0[f7_local0.propName] ) == "number" then + return -0.5 * f8_arg0[f7_local0.propName] + else + assert( false, "Property " .. f7_local0.propName .. " should be a number for use with the HalfOppositeProperty helper" ) + end + end + + return f7_local0 +end + +function RunPropertyFunc( f9_arg0 ) + return function ( f10_arg0, f10_arg1 ) + if f10_arg0.properties[f9_arg0] and type( f10_arg0.properties[f9_arg0] ) == "function" then + f10_arg0.properties[f9_arg0]( f10_arg0, f10_arg1 ) + end + end + +end + +function ParentProperty( f11_arg0 ) + local f11_local0 = f11_arg0 + return function ( f12_arg0, f12_arg1 ) + assert( f12_arg1, "ParentProperty can only be included inside the property section" ) + return f12_arg1[f11_local0] + end + +end + +function TryProperty( f13_arg0 ) + local f13_local0 = f13_arg0 + return function ( f14_arg0 ) + return f14_arg0[f13_local0] + end + +end + +function Function( f15_arg0 ) + local f15_local0 = f15_arg0 + return function ( f16_arg0 ) + return f15_local0( f16_arg0 ) + end + +end + +function BaseState( f17_arg0, f17_arg1 ) + local f17_local0 = f17_arg0 + local f17_local1 = f17_arg1 + if not f17_local1 then + f17_local1 = {} + end + return function ( f18_arg0 ) + assert( f18_arg0 ) + assert( f18_arg0.states ) + assert( f18_arg0.states[f17_local0], "Could not find base state " .. f17_local0 ) + assert( type( f18_arg0.states[f17_local0] ) == "table", "Must only use BaseState on non-derived states! state = " .. f17_local0 ) + local f18_local0 = {} + for f18_local4, f18_local5 in pairs( f18_arg0.states[f17_local0] ) do + f18_local0[f18_local4] = f18_local5 + end + for f18_local4, f18_local5 in pairs( f17_local1 ) do + f18_local0[f18_local4] = f18_local5 + end + return f18_local0 + end + +end + +function OpenMenu( f19_arg0, f19_arg1, f19_arg2, f19_arg3 ) + local f19_local0 = f19_arg0 + local f19_local1 = f19_arg1 + local f19_local2 = f19_arg2 + local f19_local3 = f19_arg3 + return function ( f20_arg0, f20_arg1 ) + LUI.FlowManager.RequestAddMenu( f20_arg0, f19_local0, f19_local1, f20_arg1.controller, f19_local2, f19_local3 ) + end + +end + +function PopupMenu( f21_arg0, f21_arg1, f21_arg2, f21_arg3 ) + local f21_local0 = f21_arg0 + local f21_local1 = f21_arg1 + local f21_local2 = f21_arg2 + local f21_local3 = f21_arg3 + return function ( f22_arg0, f22_arg1 ) + LUI.FlowManager.RequestPopupMenu( f22_arg0, f21_local0, f21_local1, f22_arg1.controller, f21_local2, f21_local3 ) + end + +end + +function LeaveMenu() + return function ( f24_arg0, f24_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f24_arg0 ) + end + +end + +function RestoreMenu( f25_arg0, f25_arg1, f25_arg2 ) + return function ( f26_arg0, f26_arg1 ) + LUI.FlowManager.RequestRestoreMenu( f26_arg0, f25_arg0, f25_arg1, f26_arg1.controller, f25_arg2 ) + end + +end + +function CloseAllMenus() + return function ( f28_arg0, f28_arg1 ) + LUI.FlowManager.RequestCloseAllMenus( f28_arg0, nil ) + end + +end + +function OpenOldMenu( f29_arg0 ) + local f29_local0 = f29_arg0 + return function ( f30_arg0, f30_arg1 ) + LUI.FlowManager.RequestOldMenu( f30_arg0, f29_local0 ) + end + +end + +function EmitEvent( f31_arg0 ) + local f31_local0 = f31_arg0 + if type( f31_local0 ) == "string" then + f31_local0 = { + name = f31_local0 + } + end + return function ( f32_arg0, f32_arg1 ) + f32_arg0:processEvent( f31_local0 ) + end + +end + +function EmitEventToParent( f33_arg0, f33_arg1 ) + local f33_local0 + if f33_arg1 then + f33_local0 = f33_arg1.saveOriginal + if not f33_local0 then + + else + local f33_local1 = f33_arg0 + if not f33_local0 and type( f33_local1 ) == "string" then + f33_local1 = { + name = f33_local1 + } + end + return function ( f34_arg0, f34_arg1 ) + if f33_local0 then + local f34_local0 = {} + if type( f33_local1 ) == "string" then + f34_local0.name = f33_local1 + else + for f34_local4, f34_local5 in pairs( f33_local1 ) do + f34_local0[f34_local4] = f34_local5 + end + end + f34_local0.original = f34_arg1 + return f34_arg0:dispatchEventToParent( f34_local0 ) + else + return f34_arg0:dispatchEventToParent( f33_local1 ) + end + end + + end + end + f33_local0 = false +end + +function EmitEventToRoot( f35_arg0 ) + local f35_local0 = f35_arg0 + if type( f35_local0 ) == "string" then + f35_local0 = { + name = f35_local0 + } + end + return function ( f36_arg0, f36_arg1 ) + f36_arg0:dispatchEventToRoot( f35_local0 ) + end + +end + +function EmitOmnvarUpdateEventToRoot( f37_arg0 ) + return function ( f38_arg0 ) + f38_arg0:dispatchEventToRoot( { + name = "omnvar_update", + omnvar = f37_arg0, + value = Game.GetOmnvar( f37_arg0 ) + } ) + end + +end + +f0_local0 = function ( f39_arg0, f39_arg1 ) + local f39_local0 = type( f39_arg0 ) + if f39_local0 == "function" then + assert( f39_arg1.properties, "Item built that didn't get it's properties set!" ) + DebugPrint( "defaultDuration is " .. f39_arg0( f39_arg1.properties ) ) + return f39_arg0( f39_arg1.properties ) + elseif f39_local0 == "table" and f39_arg0.isProperty then + assert( f39_arg1.properties, "Item built that didn't get it's properties set!" ) + DebugPrint( "defaultDuration is " .. f39_arg0.func( f39_arg1.properties ) ) + return f39_arg0.func( f39_arg1.properties ) + else + return f39_arg0 + end +end + +function AnimateToStateWithEvent( f40_arg0, f40_arg1, f40_arg2, f40_arg3 ) + local f40_local0 = f40_arg0 + local f40_local1 = f40_arg1 + local f40_local2 = f40_arg2 + local f40_local3 = f40_arg3 + return function ( f41_arg0, f41_arg1 ) + local f41_local0 = f0_local0( f40_local1, f41_arg0 ) + local f41_local1 = f0_local0( f40_local2, f41_arg0 ) + local f41_local2 = f0_local0( f40_local3, f41_arg0 ) + if f41_arg0:hasAnimationState( f40_local0 ) then + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f41_local3 = "None" + if f41_arg0.id ~= nil then + f41_local3 = f41_arg0.id + end + DebugPrint( "LUI: AnimateToStateWithEvent: id: " .. f41_local3 .. " state: " .. f40_local0 ) + end + f41_arg0:animateToState( f40_local0, f41_local0, f41_local1, f41_local2 ) + end + end + +end + +function AnimateToState( f42_arg0, f42_arg1, f42_arg2, f42_arg3 ) + local f42_local0 = f42_arg0 + local f42_local1 = f42_arg1 + local f42_local2 = f42_arg2 + local f42_local3 = f42_arg3 + return function ( f43_arg0, f43_arg1 ) + f43_arg0:registerEventHandler( LUI.FormatAnimStateFinishEvent( f42_local0 ), nil ) + local f43_local0 = f0_local0( f42_local1, f43_arg0 ) + local f43_local1 = f0_local0( f42_local2, f43_arg0 ) + local f43_local2 = f0_local0( f42_local3, f43_arg0 ) + if f43_arg0:hasAnimationState( f42_local0 ) then + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f43_local3 = "None" + if f43_arg0.id ~= nil then + f43_local3 = f43_arg0.id + end + DebugPrint( "LUI: AnimateToState: id: " .. f43_local3 .. " state: " .. f42_local0 ) + end + f43_arg0:animateToState( f42_local0, f43_local0, f43_local1, f43_local2 ) + end + end + +end + +function ChooseAnimateToState( f44_arg0, f44_arg1, f44_arg2 ) + local f44_local0 = f44_arg0 + local f44_local1 = f44_arg1 + local f44_local2 = f44_arg2 + return function ( f45_arg0, f45_arg1 ) + local f45_local0 = f44_local2[1] + local f45_local1 = f0_local0( f44_local2[2], f45_arg0 ) + local f45_local2 = f0_local0( f44_local2[3], f45_arg0 ) + local f45_local3 = f0_local0( f44_local2[4], f45_arg0 ) + if f44_local0( f45_arg0, f45_arg1 ) then + f45_local0 = f44_local1[1] + f45_local1 = f0_local0( f44_local1[2], f45_arg0 ) + f45_local2 = f0_local0( f44_local1[3], f45_arg0 ) + f45_local3 = f0_local0( f44_local1[4], f45_arg0 ) + end + if f45_arg0:hasAnimationState( f45_local0 ) then + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f45_local4 = "None" + if f45_arg0.id ~= nil then + f45_local4 = f45_arg0.id + end + DebugPrint( "LUI: ChooseAnimateToState: id: " .. f45_local4 .. " state: " .. f45_local0 ) + end + f45_arg0:animateToState( f45_local0, f45_local1, f45_local2, f45_local3 ) + end + end + +end + +f0_local1 = function ( f46_arg0, f46_arg1, f46_arg2, f46_arg3 ) + local f46_local0 = f46_arg0 + local f46_local1 = 2 + local f46_local2 = f46_arg1 + local f46_local3 = f46_arg2 + local f46_local4 = f46_arg3 + return function ( f47_arg0, f47_arg1 ) + if #f46_local0 < f46_local1 then + f46_local1 = 1 + if not f46_local3 then + return + end + end + local f47_local0 = f46_local0[f46_local1] + f47_arg0:registerEventHandler( f47_arg1.name, nil ) + if f46_local2 and not f47_arg0:isInFocus() and not f47_arg0:isParentInFocus() then + return + elseif f47_arg1.interrupted then + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f47_local1 = "None" + if f47_arg0.id ~= nil then + f47_local1 = f47_arg0.id + end + DebugPrint( "LUI: Animation to state '" .. f47_local0[1] .. "' interrupted! id: " .. f47_local1 ) + end + return + end + local f47_local1 = LUI.FormatAnimStateFinishEvent( f47_local0[1] ) + f47_arg0:animateToState( f47_local0[1], f47_local0[2], f47_local0[3], f47_local0[4] ) + if f46_local3 or f46_local1 ~= #f46_local0 and not f46_local3 then + f47_arg0:registerEventHandler( f47_local1, REG9 ) + end + if f46_local1 == #f46_local0 and not f46_local3 and f46_local4 then + f47_arg0:registerEventHandler( f47_local1, function ( element, event ) + element:close() + end ) + end + f46_local1 = f46_local1 + 1 + end + +end + +function AnimateLoop( f49_arg0, f49_arg1 ) + local f49_local0 = f49_arg0 + local f49_local1 = f49_arg1 + return function ( f50_arg0, f50_arg1 ) + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f50_local0 = "None" + if f50_arg0.id ~= nil then + f50_local0 = f50_arg0.id + end + DebugPrint( "LUI: AnimateLoop: id: " .. f50_local0 ) + end + if Engine.GetDvarBool( "lui_print_anim_states" ) then + for f50_local3, f50_local4 in ipairs( f49_local0 ) do + DebugPrint( "\t->" .. f50_local4[1] ) + end + end + local f50_local0 = assert + local f50_local1 = f49_local0 + if f50_local1 then + f50_local1 = #f49_local0 + end + f50_local0( f50_local1, "AnimateLoop does not have animation states!" ) + f50_local0 = f49_local0[1] + f50_local1 = LUI.FormatAnimStateFinishEvent( f50_local0[1] ) + if #f49_local0 == 1 then + DebugPrint( "LUI Warning: AnimateLoop only has one animation state! " .. f49_local0[1][1] ) + else + f50_arg0:registerEventHandler( f50_local1, f0_local1( f49_local0, f49_local1, true ) ) + end + f50_arg0:animateToState( f50_local0[1], f50_local0[2], f50_local0[3], f50_local0[4] ) + end + +end + +function AnimateSequence( f51_arg0 ) + local f51_local0 = f51_arg0 + local f51_local1 = requireFocus + return function ( f52_arg0, f52_arg1 ) + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f52_local0 = "None" + if f52_arg0.id ~= nil then + f52_local0 = f52_arg0.id + end + DebugPrint( "LUI: AnimateSequence: id: " .. f52_local0 ) + end + if Engine.GetDvarBool( "lui_print_anim_states" ) then + for f52_local3, f52_local4 in ipairs( f51_local0 ) do + DebugPrint( "\t->" .. f52_local4[1] ) + end + end + local f52_local0 = assert + local f52_local1 = f51_local0 + if f52_local1 then + f52_local1 = #f51_local0 + end + f52_local0( f52_local1, "AnimateSequence does not have animation states!" ) + f52_local0 = f51_local0[1] + f52_local1 = LUI.FormatAnimStateFinishEvent( f52_local0[1] ) + if #f51_local0 == 1 then + DebugPrint( "LUI Warning: AnimateSequence only has one animation state! " .. f51_local0[1][1] ) + else + f52_arg0:registerEventHandler( f52_local1, f0_local1( f51_local0, f51_local1, false ) ) + end + f52_arg0:animateToState( f52_local0[1], f52_local0[2], f52_local0[3], f52_local0[4] ) + end + +end + +function AnimateSequenceAndClose( f53_arg0 ) + local f53_local0 = f53_arg0 + local f53_local1 = requireFocus + return function ( f54_arg0, f54_arg1 ) + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f54_local0 = "None" + if f54_arg0.id ~= nil then + f54_local0 = f54_arg0.id + end + DebugPrint( "LUI: AnimateSequence: id: " .. f54_local0 ) + end + for f54_local3, f54_local4 in ipairs( f53_local0 ) do + local f54_local5 = LUI.FormatAnimStateFinishEvent( f54_local4[1] ) + if Engine.GetDvarBool( "lui_print_anim_states" ) then + DebugPrint( "\t->" .. f54_local4[1] ) + end + f54_arg0:registerEventHandler( f54_local5, nil ) + end + f54_local0 = assert + f54_local1 = f53_local0 + if f54_local1 then + f54_local1 = #f53_local0 + end + f54_local0( f54_local1, "AnimateSequence does not have animation states!" ) + f54_local0 = f53_local0[1] + f54_local1 = f53_local0[#f53_local0] + f54_local2 = LUI.FormatAnimStateFinishEvent( f54_local0[1] ) + if #f53_local0 == 1 then + DebugPrint( "LUI Warning: AnimateSequence only has one animation state! " .. f53_local0[1][1] ) + else + f54_arg0:registerEventHandler( f54_local2, f0_local1( f53_local0, f53_local1, false, true ) ) + end + f54_arg0:animateToState( f54_local0[1], f54_local0[2], f54_local0[3], f54_local0[4] ) + end + +end + +function DoMultiple( f55_arg0 ) + local f55_local0 = f55_arg0 + return function ( f56_arg0, f56_arg1 ) + for f56_local3, f56_local4 in ipairs( f55_local0 ) do + assert( type( f56_local4 ) == "function" ) + f56_local4( f56_arg0, f56_arg1 ) + end + end + +end + +function HandleSilently( f57_arg0 ) + return function ( f58_arg0, f58_arg1 ) + if not f58_arg1.dispatchChildren then + f58_arg0:dispatchEventToChildren( f58_arg1 ) + end + return f57_arg0( f58_arg0, f58_arg1 ) + end + +end + +function OmnvarUpdateFilter( f59_arg0, f59_arg1 ) + return { + [f59_arg0] = f59_arg1 + } +end + +function HandlePrint( f60_arg0 ) + local f60_local0 = f60_arg0 + return function ( f61_arg0, f61_arg1 ) + DebugPrint( f60_local0 ) + end + +end + +function UpdateTextWithCall( f62_arg0, ... ) + local f62_local0 = { + ... + } + return function ( f63_arg0, f63_arg1 ) + if f62_arg0 ~= nil then + local f63_local0 = f62_arg0( unpack( f62_local0 ) ) + if f63_local0 ~= nil then + f63_arg0:setText( f63_local0 ) + end + end + end + +end + +helpers = { + Property = Property, + OppositeProperty = OppositeProperty, + HalfProperty = HalfProperty, + HalfOppositeProperty = HalfOppositeProperty, + RunPropertyFunc = RunPropertyFunc, + Function = Function, + BaseState = BaseState, + AnimateToState = AnimateToState, + AnimateToStateWithEvent = AnimateToStateWithEvent, + DoMultiple = DoMultiple, + HandleSilently = HandleSilently, + OmnvarUpdateFilter = OmnvarUpdateFilter, + AnimateLoop = AnimateLoop, + AnimateSequence = AnimateSequence, + TryProperty = TryProperty, + ParentProperty = ParentProperty, + OpenMenu = OpenMenu, + PopupMenu = PopupMenu, + LeaveMenu = LeaveMenu, + RestoreMenu = RestoreMenu, + CloseAllMenus = CloseAllMenus, + OpenOldMenu = OpenOldMenu, + HandlePrint = HandlePrint, + UpdateTextWithCall = UpdateTextWithCall, + EmitEvent = EmitEvent, + EmitEventToParent = EmitEventToParent, + EmitEventToRoot = EmitEventToRoot, + EmitOmnvarUpdateEventToRoot = EmitOmnvarUpdateEventToRoot, + ChooseAnimateToState = ChooseAnimateToState, + AnimateSequenceAndClose = AnimateSequenceAndClose +} +f0_local2 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setUseStencil( true ) + return self +end + +local f0_local3 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupPopulationMap() + return self +end + +local f0_local4 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupLeakyWatermark() + return self +end + +local f0_local5 = function ( menu, controller ) + local self = LUI.UIElement.new() + local f67_local1 = nil + if controller then + f67_local1 = controller.compassType + end + self:setupMinimap( f67_local1 ) + return self +end + +local f0_local6 = function ( menu, controller ) + local self = LUI.UIElement.new() + local f68_local1 = nil + if controller then + f68_local1 = controller.compassType + end + self:setupMinimapIcons( f68_local1 ) + return self +end + +local f0_local7 = function ( f69_arg0, f69_arg1 ) + if not LUI.UIElement.setupCompass then + return LUI.UIImage.new( f69_arg0, f69_arg1 ) + else + local self = LUI.UIElement.new() + self:setupCompass() + return self + end +end + +local f0_local8 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupUIBindText( controller.dataSource, controller.textFormat, controller.param1 or 0 ) + self:setClass( LUI.UIText ) + return self +end + +local f0_local9 = function ( menu, controller ) + local self = LUI.UIImage.new() + self:setupUIBindImage( controller.dataSource, controller.param1 or 0 ) + return self +end + +local f0_local10 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupUIIntWatch( controller.dataSource, controller.param1 or 0 ) + return self +end + +local f0_local11 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupUIScorebar( controller.dataSource ) + self.m_maxWidth = controller.maxWidth + self.m_maxScore = controller.maxScore + return self +end + +local f0_local12 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupWorldBlur() + return self +end + +local f0_local13 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupScreenshotViewer() + return self +end + +local f0_local14 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupScreenshotViewer() + return self +end + +function buildOwnerDraw( menu, controller ) + local self = LUI.UIElement.new() + self:setupOwnerdraw( controller.ownerDraw, controller.ownerDrawTextScale, controller.ownerDrawTextStyle ) + return self +end + +function buildTextEdit( menu, controller ) + local self = LUI.UIElement.new() + self:setupTextEdit( controller.max_length, controller.password_field, controller.use_auto_align ) + if controller.use_auto_align then + self:setUseStencil( true ) + end + return self +end + +function buildLoadingDots( menu, controller ) + local self = LUI.UIElement.new() + if self.setLoadingDots then + self:setLoadingDots() + end + return self +end + +function buildContentServerImage( menu, controller ) + local self = LUI.UIElement.new() + self:setupContentServerImage() + self.setFileId = function ( f81_arg0, f81_arg1, f81_arg2 ) + f81_arg0.m_fileId = f81_arg1 or "" + f81_arg0.m_waitingForDownload = true + f81_arg0.m_thumbName = f81_arg2 or "" + end + + self:setFileId( controller.file_id, controller.thumbName ) + return self +end + +m_types = { + UIElement = LUI.UIElement.build, + UIText = LUI.UIText.build, + UIBindText = f0_local8, + UIBindImage = f0_local9, + UIIntWatch = f0_local10, + UIImage = LUI.UIImage.build, + UILitImage = LUI.UILitImage.build, + UIButton = LUI.UIButton.build, + UITimer = LUI.UITimer.build, + UIStencil = f0_local2, + UIVerticalList = LUI.UIVerticalList.build, + UIScrollingVerticalList = LUI.UIScrollingVerticalList.build, + UIVerticalScrollbar = LUI.UIVerticalScrollbar.build, + UIHorizontalList = LUI.UIHorizontalList.build, + UIBarrelList = LUI.UIBarrelList.build, + UIGrid = LUI.UIGrid.build, + UIVerticalNavigator = LUI.UIVerticalNavigator.build, + UIHorizontalNavigator = LUI.UIHorizontalNavigator.build, + UICountdown = LUI.UICountdown.build, + UILongCountdown = LUI.UILongCountdown.build, + UITechyDigits = LUI.UITechyDigits.build, + UIBindButton = LUI.UIBindButton.build, + UILoadingDots = buildLoadingDots, + UIPopulationMap = f0_local3, + UILeakyWatermark = f0_local4, + UIMinimap = f0_local5, + UIMinimapIcons = f0_local6, + UICompass = f0_local7, + UIScorebar = f0_local11, + UIWorldBlur = f0_local12, + UIScreenshotViewer = f0_local13, + UICharacterWindow = LUI.UICharacterWindow.build, + UIOwnerdraw = buildOwnerDraw, + UITextEdit = buildTextEdit, + ContentServerImage = buildContentServerImage +} +m_definitions = {} +m_debugData = { + requstedMenu = "", + currentDef = {}, + definitionStack = {} +} +baseAssert = assert +local f0_local15 = function ( f82_arg0, f82_arg1 ) + m_debugData.currentDef = f82_arg0 + m_debugData.definitionStack[#m_debugData.definitionStack + 1] = { + type = f82_arg0.type, + id = f82_arg0.id, + childNum = f82_arg1 + } +end + +local f0_local16 = function () + m_debugData.definitionStack[#m_debugData.definitionStack] = nil +end + +local f0_local17 = function () + for f84_local4, f84_local5 in ipairs( m_debugData.definitionStack ) do + local f84_local3 = f84_local4 .. ") type: " .. f84_local5.type + if f84_local5.id then + f84_local3 = f84_local3 .. " id: " .. f84_local5.id + end + if f84_local5.childNum then + f84_local3 = f84_local3 .. " childNum: " .. f84_local5.childNum + end + DebugPrint( f84_local3 ) + end + DebugPrint( "Current itemDef: " ) + defPrint( m_debugData.currentDef ) +end + +local f0_local18 = function ( f85_arg0, f85_arg1, ... ) + if not f85_arg0 then + if type( f85_arg1 ) == "string" then + DebugPrint( "Error: " .. string.format( f85_arg1, ... ) ) + end + DebugPrint( "Error Making Menu: " .. m_debugData.requstedMenu ) + f0_local17() + baseAssert( f85_arg0, ... ) + end +end + +function defPrint( f86_arg0, f86_arg1 ) + if not f86_arg1 then + f86_arg1 = 0 + end + for f86_local4, f86_local5 in pairs( f86_arg0 ) do + local f86_local6 = string.rep( " ", f86_arg1 ) .. f86_local4 .. ": " + if type( f86_local5 ) == "table" then + DebugPrint( f86_local6 ) + defPrint( f86_local5, f86_arg1 + 1 ) + else + DebugPrint( f86_local6 .. tostring( f86_local5 ) ) + end + local f86_local3 = getmetatable( f86_arg0 ) + if f86_local3 and f86_local3.__index then + DebugPrint( f86_local6 .. "__index" ) + defPrint( f86_local3.__index, f86_arg1 + 1 ) + end + end +end + +assert = f0_local18 +function registerDef( f87_arg0, f87_arg1 ) + assert( m_definitions[f87_arg0] == nil, "This type has already been registered! " .. f87_arg0 ) + assert( m_types[f87_arg0] == nil, "This type is a basic element type that has been registered! " .. f87_arg0 ) + assert( type( f87_arg1 ) == "function", "Attempting to register old style type definition! See wiki for info on how to update your def. def = " .. f87_arg0 ) + m_definitions[f87_arg0] = f87_arg1 +end + +function registerType( f88_arg0, f88_arg1 ) + assert( m_definitions[f88_arg0] == nil, "This type has already been registered! " .. f88_arg0 ) + assert( m_types[f88_arg0] == nil, "This type is a basic element type that has been registered! " .. f88_arg0 ) + assert( type( f88_arg1 ) == "function", "The buildFunction for this type is not a function! typeName = " .. f88_arg0 ) + m_types[f88_arg0] = f88_arg1 +end + +g_keyWordList = hashset( { + "properties", + "children", + "childrenFeeder", + "states", + "id", + "type", + "handlers" +} ) +local f0_local19 = function ( f89_arg0 ) + if g_keyWordList[f89_arg0] then + assert( false, "It appears that you are using the keyword '" .. f89_arg0 .. "' as a member name, are you sure this is set up correctly?" ) + end +end + +validateName = f0_local19 +f0_local19 = function ( f90_arg0, f90_arg1, f90_arg2 ) + local f90_local0 = type( f90_arg0 ) + if f90_local0 == "function" then + return f0_local19( f90_arg0( f90_arg1, f90_arg2 ), f90_arg1, f90_arg2 ) + end + assert( f90_local0 == "table", "Current state is not a table, did you forget {}?" ) + for f90_local5, f90_local6 in pairs( f90_arg0 ) do + validateName( f90_local5 ) + if f90_arg1.type ~= "UIImage" and f90_arg1.type ~= "UILitImage" and f90_arg1.type ~= "UIScorebar" and f90_arg1.type ~= "UICompass" and f90_local5 == "material" then + DebugPrint( "LUI Warning: It appears that you are assigning material as a state member in an element that is not of type UIImage, is this intentional?" ) + end + local f90_local4 = type( f90_local6 ) + if f90_local4 == "function" then + f90_arg0[f90_local5] = f90_local6( f90_arg2 ) + end + if f90_local4 == "table" and f90_local6.isProperty then + f90_arg0[f90_local5] = f90_local6.func( f90_arg2 ) + else + f90_arg0[f90_local5] = f90_local6 + end + end + return f90_arg0 +end + +local f0_local20 = function ( f91_arg0, f91_arg1, f91_arg2, f91_arg3 ) + if f91_arg1.states then + assert( f91_arg1.states.default, "No default state provided for element definition" ) + for f91_local3, f91_local4 in pairs( f91_arg1.states ) do + validateName( f91_local3 ) + f91_local4 = f0_local19( f91_local4, f91_arg1, f91_arg2 ) + if f91_arg1.debug or f91_arg2 and f91_arg2.debug then + DebugPrint( "Printing out formatted state:" ) + defPrint( builtState ) + end + f91_arg0:registerAnimationState( f91_local3, f91_local4 ) + if not (f91_local3 ~= "default" or f91_arg3) or f91_local4.animateOnRefresh then + f91_arg0:animateToState( f91_local3 ) + end + end + end +end + +function buildChildren( f92_arg0, f92_arg1, f92_arg2 ) + assert( not f92_arg2.type, "It appears that the children list is not a list but instead is a single element definition." ) + for f92_local3, f92_local4 in ipairs( f92_arg2 ) do + local f92_local5 = buildItems( f92_local4, f92_arg1, f92_arg0, f92_local3 ) + f92_local5:close() + f92_arg0:addElement( f92_local5 ) + end +end + +local f0_local21 = function ( f93_arg0, f93_arg1 ) + if type( f93_arg0 ) == "table" and f93_arg0.isProperty then + return f93_arg0.func( f93_arg1 ) + else + return f93_arg0 + end +end + +function buildItems( f94_arg0, f94_arg1, f94_arg2, f94_arg3 ) + assert( f94_arg0.type, "No type in itemDef!" ) + f0_local15( f94_arg0, f94_arg3 ) + Memory.CheckLow() + if m_definitions[f94_arg0.type] then + local f94_local0 = nil + if type( m_definitions[f94_arg0.type] ) == "function" then + f94_local0 = m_definitions[f94_arg0.type]() + else + f94_local0 = m_definitions[f94_arg0.type] + end + f94_arg0.type = nil + if not f94_local0.properties then + f94_local0.properties = {} + end + if f94_arg0.properties and f94_local0.properties then + for f94_local4, f94_local5 in pairs( f94_arg0.properties ) do + validateName( f94_local4 ) + f94_local0.properties[f94_local4] = f94_local5 + end + f94_arg0.properties = nil + end + for f94_local4, f94_local5 in pairs( f94_arg0 ) do + f94_local0[f94_local4] = f94_local5 + end + f94_local1 = buildItems( f94_local0, f94_arg1, f94_arg2 ) + if f94_local1 and f94_local1.properties then + f94_local1.m_ownerController = f94_local1.properties.exclusiveController + end + f0_local16() + return f94_local1 + else + assert( m_types[f94_arg0.type], "Unknown type for element definition: " .. f94_arg0.type ) + local f94_local0 = f94_arg0.properties or f94_arg1 + if f94_local0 then + for f94_local4, f94_local5 in pairs( f94_local0 ) do + validateName( f94_local4 ) + if type( f94_local5 ) == "table" and f94_local5.isProperty then + f94_local0[f94_local4] = f94_local5.func( f94_arg1 ) + end + end + end + local f94_local1 = nil + local f94_local2 = true + if f94_arg2 and f94_arg0.id then + f94_local1 = f94_arg2:getChildById( f94_arg0.id ) + end + if not f94_local1 then + f94_local2 = false + f94_local1 = m_types[f94_arg0.type]( f94_arg0, f94_local0, f94_arg3 ) + end + f94_local1._marked = true + f94_local1._fromMenuBuilder = true + f94_local1._isRefresh = f94_local2 + if f94_arg1 and f94_arg1.exclusiveController then + f94_local1.m_ownerController = f94_arg1.exclusiveController + f94_local0.exclusiveController = f94_arg1.exclusiveController + end + if not (not f94_local0 or not f94_local0.debug) or f94_arg0.debug then + DebugPrint( "Printing out item Props:" ) + defPrint( f94_local0 ) + DebugPrint( "Printing out item Def:" ) + defPrint( f94_arg0 ) + f94_local0.debug = nil + f94_arg0.debug = nil + end + if f94_arg0.focusable == true then + f94_local1:makeFocusable() + elseif f94_arg0.focusable == false then + f94_local1:makeNotFocusable() + end + if f94_arg0.ignoreMouseFocus then + f94_local1:makeFocusable() + f94_local1.m_ignoreMouseFocus = true + end + f94_local1.m_outsideParentList = f94_local1.m_outsideParentList or false + f94_local1.m_requireFocusType = f94_arg0.requireFocusType + if f94_arg0.disableNavigation then + f94_local1.m_disableNavigation = true + end + if f94_local1.setText and f94_local0 and f94_local0.text then + f94_local1:setText( f94_local0.text ) + end + if f94_local1.setTextStyle and f94_local0 and f94_local0.textStyle then + f94_local1:setTextStyle( f94_local0.textStyle ) + end + local f94_local3 = f94_local1.disabled + if not f94_local3 then + f94_local3 = false + end + f94_local1.disabled = false + if f94_arg0.disabledFunc then + f94_local1.disabled = f94_arg0.disabledFunc( f94_local1, f94_local0 ) + end + if f94_arg0.disabled then + f94_local1.disabled = true + end + if f94_local3 ~= f94_local1.disabled then + f94_local1.disabledStateChange = true + else + f94_local1.disabledStateChange = false + end + if f94_arg0.audio then + if f94_local1.setGainFocusSFX and f94_arg0.audio.button_over then + f94_local1:setGainFocusSFX( f94_arg0.audio.button_over ) + end + if f94_local1.setActionSFX and f94_arg0.audio.button_action then + f94_local1:setActionSFX( f94_arg0.audio.button_action ) + end + end + if f94_arg0.childrenFeeder then + local f94_local4 = f94_arg0.childrenFeeder + if type( f94_local4 ) == "table" and f94_local4.isProperty then + f94_local4 = f94_arg0.childrenFeeder.func( f94_local0 ) + end + assert( type( f94_local4 ) == "function", "Feeders must be a function or referenced by the MBh.Property helper" ) + f94_arg0.children = f94_local4( f94_local0 ) + f94_local1.childrenFeeder = f94_local4 + f94_local1:registerEventHandler( "menu_refresh", HandleMenuRefresh ) + end + if f94_arg0.children then + for f94_local7, f94_local8 in ipairs( f94_arg0.children ) do + if f94_local8.disabledFunc then + f94_local1:registerEventHandler( "menu_refresh", HandleMenuRefresh ) + f94_local1.children = f94_arg0.children + break + end + end + end + if f94_arg0.id then + f94_local1.id = f94_arg0.id + end + if f94_arg0.listDefaultFocus then + f94_local1.listDefaultFocus = true + end + assert( not f94_arg0.additionalHandlers, "The additional_handlers must be specified inside the 'properties' tables, not in the main definition" ) + f0_local20( f94_local1, f94_arg0, f94_local0, f94_local2 ) + if f94_arg0.handlers then + for f94_local7, f94_local8 in pairs( f94_arg0.handlers ) do + if f94_local7 == "omnvar_update" then + assert( type( f94_local8 ) == "table", "omnvar_update should be a table of handlers for specific omnvars" ) + local f94_local9 = f94_local1:getRootParent() + f94_local9 = f94_local9.eventCatcher + for f94_local13, f94_local14 in pairs( f94_local8 ) do + f94_local9:registerOmnvarHandler( f94_local1, f94_local13, f0_local21( f94_local14, f94_local0 ) ) + end + end + if f94_local7 == "dvar_update" then + assert( type( f94_local8 ) == "table", "dvar_update should be a table of handlers for specific dvars" ) + local f94_local9 = f94_local1:getRootParent() + f94_local9 = f94_local9.eventCatcher + for f94_local13, f94_local14 in pairs( f94_local8 ) do + f94_local9:registerDvarHandler( f94_local1, f94_local13, f0_local21( f94_local14, f94_local0 ) ) + end + end + f94_local1:registerEventHandler( f94_local7, f0_local21( f94_local8, f94_local0 ) ) + end + else + f94_arg0.handlers = {} + end + if f94_local0 and f94_local0.additional_handlers then + assert( not f94_local0.additional_handlers.omnvar_update, "Omnvar_update events don't support being an 'additional_handler'" ) + assert( not f94_local0.additional_handlers.dvar_update, "Dvar_update events don't support being an 'additional_handler'" ) + for f94_local7, f94_local8 in pairs( f94_local0.additional_handlers ) do + if not (not f94_local2 or not f94_arg0.handlers[f94_local7]) or not f94_local2 then + f94_local1:addEventHandler( f94_local7, f94_local8 ) + end + end + f94_local0.additional_handlers = nil + end + f94_local1.properties = f94_local0 + if f94_arg0.children then + buildChildren( f94_local1, f94_local0, f94_arg0.children ) + end + if f94_local1.disabledStateChange then + if f94_local1.disabled then + f94_local1:processEvent( { + name = "disable" + } ) + else + f94_local1:processEvent( { + name = "enable" + } ) + end + end + if f94_arg0.isSignInMenu then + f94_local1.isSignInMenu = f94_arg0.isSignInMenu + end + f0_local16() + return f94_local1 + end +end + +function buildMenu( f95_arg0, f95_arg1 ) + m_debugData.requstedMenu = f95_arg0 + m_debugData.definitionStack = {} + if not f95_arg1 then + f95_arg1 = {} + end + local f95_local0 = buildItems( { + type = f95_arg0, + properties = f95_arg1 + }, {}, nil ) + m_debugData.requstedMenu = nil + m_debugData.definitionStack = {} + m_debugData.currentDef = {} + return f95_local0 +end + +function unmarkChildren( f96_arg0 ) + local f96_local0 = f96_arg0:getFirstChild() + while f96_local0 ~= nil do + local f96_local1 = f96_local0:getNextSibling() + f96_local0._marked = false + unmarkChildren( f96_local0 ) + f96_local0 = f96_local1 + end +end + +function closeUnmarkedChildren( f97_arg0 ) + local f97_local0 = f97_arg0:getFirstChild() + while f97_local0 ~= nil do + local f97_local1 = f97_local0:getNextSibling() + if f97_local0._fromMenuBuilder and not f97_local0._marked then + f97_local0:close() + else + closeUnmarkedChildren( f97_local0 ) + end + f97_local0 = f97_local1 + end +end + +function HandleMenuRefresh( f98_arg0, f98_arg1 ) + unmarkChildren( f98_arg0 ) + local f98_local0 = f98_arg0.children + if f98_arg0.childrenFeeder then + f98_local0 = f98_arg0.childrenFeeder( f98_arg0.properties ) + end + local f98_local1 = f98_arg0:getAllFocusedChildren() + if #f98_local1 > 0 then + f98_arg0:saveState() + end + m_debugData.requstedMenu = "menuRefreshEvent" + m_debugData.definitionStack = {} + buildChildren( f98_arg0, f98_arg0.properties, f98_local0 ) + m_debugData.requstedMenu = nil + m_debugData.definitionStack = {} + m_debugData.currentDef = {} + closeUnmarkedChildren( f98_arg0 ) + if #f98_local1 > 0 then + local f98_local2, f98_local3 = f98_arg0:restoreState( true ) + if f98_local3 == 0 then + f98_arg0:clearSavedState() + f98_arg0:processEvent( { + name = "gain_focus" + } ) + end + end + f98_arg0:processEvent( { + name = "element_refresh", + dispatchChildren = true + } ) +end + +function BuildAddChild( f99_arg0, f99_arg1 ) + local f99_local0 = nil + if type( f99_arg1 ) == "table" then + f99_local0 = buildItems( f99_arg1, f99_arg0.properties, f99_arg0 ) + else + f99_local0 = f99_arg1 + end + m_debugData.requstedMenu = nil + m_debugData.definitionStack = {} + m_debugData.currentDef = {} + f99_arg0:addElement( f99_local0 ) + return f99_local0 +end + +function BuildRegisteredType( f100_arg0, f100_arg1 ) + assert( type( f100_arg0 ) == "string" ) + assert( m_types[f100_arg0], "Could not find a constructor for " .. f100_arg0 .. "." .. (m_definitions[f100_arg0] and " Use 'LUI.MenuBuilder.BuildAddChild' to build elements registered using the deprecated MenuBuilder" or "") ) + return m_types[f100_arg0]( nil, f100_arg1 ) +end + +function AnimStateBasedOn( f101_arg0, f101_arg1 ) + return setmetatable( f101_arg1, { + __index = f101_arg0 + } ) +end + +LockTable( _M ) diff --git a/lui/menugenericbuttons.dec.lua b/lui/menugenericbuttons.dec.lua new file mode 100644 index 0000000..448bba8 --- /dev/null +++ b/lui/menugenericbuttons.dec.lua @@ -0,0 +1,2027 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +DebugPrint( "Registering " .. _NAME ) +LUI.UIGenericButton = {} +f0_local0 = function ( f1_arg0, f1_arg1 ) + if f1_arg1 then + if f1_arg1.itemProps and f1_arg1.itemProps[f1_arg0] ~= nil then + return f1_arg1.itemProps[f1_arg0] + elseif f1_arg1.substyle and f1_arg1.substyle[f1_arg0] ~= nil then + return f1_arg1.substyle[f1_arg0] + elseif f1_arg1.style and f1_arg1.style[f1_arg0] ~= nil then + return f1_arg1.style[f1_arg0] + elseif GenericButtonSettings.Common[f1_arg0] ~= nil then + return GenericButtonSettings.Common[f1_arg0] + end + end + DebugPrint( "WARNING: MenuGenericButtons tried to read a setting that does not exist (" .. f1_arg0 .. "). You should be worried." ) +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0.align + if not f2_local0 then + f2_local0 = LUI.Alignment.Right + end + local f2_local1 = f2_arg0.padding or 0 + local f2_local2 = f2_arg0.yOffset or 0 + local f2_local3 = f2_local0 == LUI.Alignment.Right + local f2_local4 = f2_local0 == LUI.Alignment.Left + local f2_local5 = LUI.UIText.new + local f2_local6 = CoD.ColorizeState + local f2_local7 = f2_arg0.text_default_color + local f2_local8 = { + alignment = f2_local0, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = not f2_local4 + } + if f2_local4 then + local f2_local9 = f2_local1 + end + f2_local8.left = f2_local9 or 0 + local f2_local10 + if f2_local3 then + f2_local10 = -f2_local1 + if not f2_local10 then + + else + f2_local8.right = f2_local10 + f2_local8.top = f2_local2 - CoD.TextSettings.NormalFont.Height / 2 + f2_local8.bottom = f2_local2 + CoD.TextSettings.NormalFont.Height / 2 + f2_local5 = f2_local5( f2_local6( f2_local7, f2_local8 ) ) + f2_local5.id = "text_label" + f2_local5:registerAnimationState( "focus", CoD.ColorizeState( f2_arg0.text_focus_color ) ) + f2_local5:registerAnimationState( "locked", CoD.ColorizeState( f2_arg0.text_lock_color ) ) + f2_local5:registerAnimationState( "disabled", CoD.ColorizeState( f2_arg0.text_disabled_color ) ) + f2_local5:registerAnimationState( "over_disabled", CoD.ColorizeState( f2_arg0.text_over_disabled_color ) ) + f2_local5:registerAnimationState( "over_disabled_pulse", CoD.ColorizeState( f2_arg0.text_over_disabled_pulse_color ) ) + f2_local5:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f2_local5:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f2_local5:registerEventHandler( "button_over_disable", MBh.AnimateLoop( { + { + "over_disabled", + 0 + }, + { + "over_disabled_pulse", + f2_arg0.overDisabledAnimationDuration + }, + { + "over_disabled", + f2_arg0.overDisabledAnimationDuration + } + } ) ) + f2_local5:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled" ) ) + f2_local5:registerEventHandler( "change_text_default_color", function ( element, event ) + element:registerAnimationState( "default", CoD.ColorizeState( event.color ) ) + end ) + if f2_arg0.additional_handlers then + for f2_local10, f2_local11 in pairs( f2_arg0.additional_handlers ) do + f2_local5:addEventHandler( f2_local10, f2_local11 ) + end + end + if f2_arg1 then + f2_local5:setText( f2_arg1 ) + end + return f2_local5 + end + end + f2_local10 = 0 +end + +f0_local2 = function ( f4_arg0, f4_arg1 ) + if f4_arg0.properties and f4_arg0.properties.button_display_func then + local f4_local0 = f4_arg0.properties:button_display_func( f4_arg1 ) + if f4_local0 then + f4_arg0:setText( f4_local0 ) + end + end +end + +local f0_local3 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0.width or 160 + local f5_local1 = f5_arg0.margin or 0 + local f5_local2 = f5_arg0.useText + local f5_local3 = f5_arg0.yOffset or 0 + local f5_local4 = f5_arg0.useBackground + local f5_local5 = f5_arg0.backgroundMarginTop or 0 + local f5_local6 = f5_arg0.backgroundMarginBottom or 0 + local f5_local7 = f5_arg0.useArrows + local f5_local8 = f5_arg0.arrowsMargin + local f5_local9 = f5_arg0.useSlider + local f5_local10 = f5_arg0.sliderWidth + local f5_local11 = f5_arg0.sliderHeight + local f5_local12 = f5_arg0.useInput + local f5_local13 = f5_arg0.field_edited_func or nil + local f5_local14 = f5_arg0.max_length or 20 + local f5_local15 = f5_arg0.password_field or false + local f5_local16 = f5_arg0.text_alignment + if not f5_local16 then + f5_local16 = LUI.Alignment.Left + end + local f5_local17 = f5_arg0.filter_profanity or false + local f5_local18 = f5_arg0.keyboard_type + if not f5_local18 then + f5_local18 = CoD.KeyboardInputTypes.Normal + end + local f5_local19 = f5_arg0.field_name or "Placeholder Field Name" + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -f5_local1 - f5_local0, + right = -f5_local1 + } ) + self.id = "button_value" + self.properties = f5_arg1 or {} + if f5_local4 then + local f5_local21 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + red = 0, + green = 0, + blue = 0, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f5_local5, + bottom = -f5_local6, + left = 0, + right = 0, + alpha = 0 + } ) + f5_local21.id = "background" + f5_local21:registerAnimationState( "focus", { + alpha = 1 + } ) + f5_local21:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f5_local21:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f5_local21:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + self:addElement( f5_local21 ) + end + local f5_local21 = function ( f6_arg0, f6_arg1 ) + if self.properties.button_left_func then + self.properties:button_left_func( f6_arg1 ) + end + f6_arg0:processEvent( { + name = "content_arrow_left" + } ) + self:processEvent( { + name = "content_refresh" + } ) + end + + local f5_local22 = function ( f7_arg0, f7_arg1 ) + if self.properties.button_right_func then + self.properties:button_right_func( f7_arg1 ) + end + self:processEvent( { + name = "content_refresh" + } ) + f7_arg0:processEvent( { + name = "content_arrow_right" + } ) + end + + if f5_local7 then + local f5_local23 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.UIImage.new + local f8_local1 = { + material = RegisterMaterial( "widg_lobby_arrow" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 9, + bottom = -9 + } + local f8_local2 + if f8_arg1 then + f8_local2 = 17 + if not f8_local2 then + + else + f8_local1.left = f8_local2 + if f8_arg1 then + f8_local2 = 5 + if not f8_local2 then + + else + f8_local1.right = f8_local2 + f8_local1.alpha = 0 + f8_local0 = f8_local0( f8_local1 ) + f8_local0.id = "arrow_gfx" + f8_local0:registerAnimationState( "focus", CoD.ColorizeState( Engine.IsAliensMode() and Colors.alien_frontend_hilite or Colors.frontend_hilite ) ) + f8_local0:registerAnimationState( "pulse", { + red = 1, + green = 1, + blue = 1 + } ) + f8_local2 = f8_local0 + f8_local1 = f8_local0.registerEventHandler + local f8_local3 = "content_arrow_" + local self + if f8_arg1 then + self = "left" + if not self then + + else + f8_local1( f8_local2, f8_local3 .. self, function ( f9_arg0, f9_arg1 ) + if f5_local9 then + Engine.PlaySound( CoD.SFX.AdjustSlider ) + else + Engine.PlaySound( CoD.SFX.OtherAdjust ) + end + local f9_local0 = MBh.AnimateSequence( { + { + "pulse", + 100 + }, + { + "focus", + 200 + } + } ) + f9_local0( f9_arg0, f9_arg1 ) + end ) + f8_local1 = LUI.UIButton.new + f8_local2 = { + material = RegisterMaterial( "widg_lobby_arrow" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = f8_arg1, + rightAnchor = not f8_arg1, + top = f5_local3 - 15, + bottom = f5_local3 + 15 + } + f8_local3 = f5_local8 + if f8_arg1 then + self = 1 + if not self then + + else + f8_local3 = f8_local3 * self + if f8_arg1 then + self = 0 + if not self then + + else + f8_local2.left = f8_local3 + 12 * self - 5 + f8_local3 = f5_local8 + if f8_arg1 then + self = 1 + if not self then + + else + f8_local3 = f8_local3 * self + if f8_arg1 then + self = 1 + if not self then + + else + f8_local2.right = f8_local3 + 12 * self + 5 + f8_local1 = f8_local1( f8_local2 ) + f8_local1.id = "arrow_" .. f8_arg0 + f8_local1.m_requireFocusType = FocusType.MouseOver + f8_local1:registerEventHandler( "hide_arrows", function ( element, event ) + f8_local0:animateToState( "default" ) + element.gainFocusSFX = nil + end ) + f8_local1:registerEventHandler( "show_arrows", function ( element, event ) + f8_local0:animateToState( "focus" ) + element.gainFocusSFX = CoD.SFX.MouseOver + end ) + f8_local1:processEvent( { + name = "hide_arrows" + } ) + f8_local1:addElement( f8_local0 ) + if f8_arg1 then + f8_local2 = "left" + if not f8_local2 then + + else + if f8_arg1 then + f8_local3 = f5_local21 + if not f8_local3 then + + else + self:registerEventHandler( "button_" .. f8_local2, f8_local3 ) + if not Engine.IsConsoleGame() then + f8_local1:registerEventHandler( "button_action", f8_local3 ) + self = LUI.UIButtonRepeater.new( "leftmouse", "button_action", f8_local1 ) + self:disable() + self:registerEventHandler( "button_up", self.disable ) + self:registerEventHandler( "button_over", self.enable ) + self:registerEventHandler( "button_over_disable", self.disable ) + f8_local1:addElement( self ) + local f8_local5 = LUI.UIButtonRepeater.new( f8_local2, "button_" .. f8_local2, self ) + f8_local5.id = f8_local2 .. "_repeater" + f8_local5:disable() + f8_local5:registerEventHandler( "button_up", f8_local5.disable ) + f8_local5:registerEventHandler( "button_over", f8_local5.enable ) + f8_local5:registerEventHandler( "button_over_disable", f8_local5.disable ) + self:addElement( f8_local5 ) + if f5_local2 then + self:setMinDelay( 240 ) + f8_local5:setMinDelay( 240 ) + end + end + return f8_local1 + end + end + f8_local3 = f5_local22 + end + end + f8_local2 = "right" + end + end + self = 0 + end + end + self = -1 + end + end + self = -1 + end + end + self = -1 + end + end + self = "right" + end + end + f8_local2 = 17 + end + end + f8_local2 = 5 + end + + self:addElement( f5_local23( "left", true ) ) + self:addElement( f5_local23( "right", false ) ) + if f5_arg1.button_left_func then + self.properties.button_left_func = f5_arg1.button_left_func + end + if f5_arg1.button_right_func then + self.properties.button_right_func = f5_arg1.button_right_func + end + end + if f5_local2 then + local f5_local23 = LUI.UIText.new + local f5_local24 = CoD.ColorizeState + local f5_local25 = f5_arg0.content_default_color + local f5_local26 = {} + local f5_local27 = f5_arg0.labelAlign + if not f5_local27 then + f5_local27 = LUI.Alignment.Center + end + f5_local26.alignment = f5_local27 + f5_local26.font = CoD.TextSettings.NormalFont.Font + f5_local26.topAnchor = false + f5_local26.bottomAnchor = false + f5_local26.leftAnchor = false + f5_local26.rightAnchor = false + f5_local26.left = -f5_local0 / 2 + f5_local26.right = f5_local0 / 2 + f5_local26.top = f5_local3 - CoD.TextSettings.NormalFont.Height / 2 + f5_local26.bottom = f5_local3 + CoD.TextSettings.NormalFont.Height / 2 + f5_local23 = f5_local23( f5_local24( f5_local25, f5_local26 ) ) + f5_local23.id = "content_text_label" + f5_local23:setText( "Placeholder" ) + if f5_local4 then + f5_local24 = f5_arg0.content_focus_color + if not f5_local24 then + + else + f5_local23:registerAnimationState( "focus", CoD.ColorizeState( f5_local24 ) ) + f5_local23:registerAnimationState( "locked", CoD.ColorizeState( f5_arg0.content_lock_color ) ) + f5_local23:registerAnimationState( "disabled", CoD.ColorizeState( f5_arg0.text_disabled_color ) ) + f5_local23:registerAnimationState( "over_disabled", CoD.ColorizeState( f5_arg0.text_over_disabled_pulse_color ) ) + f5_local23:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f5_local23:registerEventHandler( "button_lock", MBh.AnimateToState( "locked" ) ) + f5_local23:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f5_local23:registerEventHandler( "button_over_disable", MBh.AnimateToState( "disabled" ) ) + f5_local23:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled" ) ) + if not f5_local4 then + f5_local23:registerEventHandler( "button_over_disable", MBh.AnimateToState( "over_disabled" ) ) + end + f5_local23:registerEventHandler( "content_refresh", f0_local2 ) + f5_local23:registerEventHandler( "menu_create", f0_local2 ) + if f5_arg1.button_display_func then + f5_local23.properties = f5_arg1 or {} + f5_local23.properties.button_display_func = f5_arg1.button_display_func + f0_local2( f5_local23, {} ) + end + self:addElement( f5_local23 ) + end + end + f5_local24 = f5_arg0.content_focus_color_without_bg + end + if f5_local9 then + local f5_local23 = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f5_local3 - f5_local11 / 2, + bottom = f5_local3 + f5_local11 / 2, + left = -f5_local10 / 2, + right = f5_local10 / 2 + } ) + f5_local23.id = "slider" + local f5_local24 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + red = Colors.generic_menu_frame_color.r, + green = Colors.generic_menu_frame_color.g, + blue = Colors.generic_menu_frame_color.b, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -1, + bottom = 1, + left = -2, + right = 2 + } ) + f5_local24.id = "border" + f5_local23:addElement( f5_local24 ) + local f5_local25 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = -1, + right = 1, + red = 0, + green = 0, + blue = 0 + } ) + f5_local25.id = "background" + f5_local25:setHandleMouseButton( not Engine.IsConsoleGame() ) + f5_local23:addElement( f5_local25 ) + local f5_local26 = LUI.UIImage.new( { + material = RegisterMaterial( "widg_weapon_slider_mid" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f5_local10 + } ) + f5_local26.id = "fill" + f5_local23:addElement( f5_local26 ) + local f5_local27 = function ( f12_arg0, f12_arg1 ) + if f12_arg0.properties and f12_arg0.properties.button_display_func and f12_arg0.properties.slider_width then + local f12_local0 = f12_arg0.properties.button_display_func() + if f12_local0 == nil then + f12_local0 = 0 + end + f5_local26:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -1 * f12_arg0.properties.slider_width * (1 - f12_local0), + top = 0, + bottom = 0, + material = RegisterMaterial( "widg_weapon_slider_mid" ) + } ) + f5_local26:animateToState( "default", 0 ) + end + end + + if not Engine.IsConsoleGame() and f5_arg1.button_display_func then + f5_local25:registerEventHandler( "leftmousedown", function ( element, event ) + if not element.disabled then + local f13_local0 = element:getWidth() + local f13_local1, f13_local2, f13_local3, f13_local4 = element:getRect() + f13_local1, f13_local2 = event.root:pixelsToUnits( f13_local1, f13_local2 ) + local f13_local5, f13_local6 = event.root:pixelsToUnits( event.x, event.y ) + local f13_local7 = (f13_local5 - f13_local1) / f13_local0 + local f13_local8 = f5_arg1.button_display_func() + local f13_local9 + if f13_local8 < f13_local7 then + f13_local9 = self.properties.button_right_func + if not f13_local9 then + + else + local f13_local10 = f13_local8 + local f13_local11 = nil + while (f13_local7 - f13_local8) * (f13_local7 - f13_local10) > 0 do + f13_local9( self, event ) + f13_local11 = f13_local10 + f13_local10 = f5_arg1.button_display_func() + if f13_local11 == f13_local10 then + break + end + end + self:processEvent( { + name = "content_refresh" + }, event ) + end + end + f13_local9 = self.properties.button_left_func + end + end ) + f5_local25:registerEventHandler( "button_disable", function ( element, event ) + element.disabled = true + end ) + f5_local25:registerEventHandler( "button_up", function ( element, event ) + element.disabled = false + end ) + end + f5_local23:registerEventHandler( "content_refresh", f5_local27 ) + f5_local23:registerEventHandler( "menu_create", f5_local27 ) + if f5_arg1.button_display_func then + f5_local23.properties = f5_arg1 or {} + f5_local23.properties.slider_width = f5_local10 + f5_local23.properties.button_display_func = f5_arg1.button_display_func + f5_local27( f5_local23, {} ) + end + self:addElement( f5_local23 ) + end + if f5_local12 then + local f5_local24 = LUI.MenuBuilder.buildItems( { + type = "generic_input_field", + properties = { + textLeft = 0, + textAlign = LUI.Alignment.Center, + field_edited_func = f5_local13, + max_length = f5_local14, + password_field = f5_local15, + verify_string = false, + filter_profanity = f5_local17, + help_value = "", + field_name = f5_local19, + keyboard_type = f5_local18, + text_alignment = f5_local16 + } + }, {} ) + f5_local24.id = "input" + local f5_local26 = f5_local24 + local f5_local25 = f5_local24.registerAnimationState + local f5_local27 = "default" + local f5_local28 = {} + local f5_local29 = f5_arg0.labelAlign + if not f5_local29 then + f5_local29 = LUI.Alignment.Center + end + f5_local28.alignment = f5_local29 + f5_local28.font = CoD.TextSettings.NormalFont.Font + f5_local28.topAnchor = false + f5_local28.bottomAnchor = false + f5_local28.leftAnchor = false + f5_local28.rightAnchor = false + f5_local28.left = -f5_local0 / 2 + f5_local28.right = f5_local0 / 2 + f5_local28.top = f5_local3 - CoD.TextSettings.NormalFont.Height / 2 + f5_local28.bottom = f5_local3 + CoD.TextSettings.NormalFont.Height / 2 + f5_local28.alpha = 1 + f5_local25( f5_local26, f5_local27, f5_local28 ) + f5_local24:animateToState( "default" ) + f5_local24:registerEventHandler( "button_over", function ( element, event ) + MBh.AnimateToState( "focus" ) + element:processEvent( { + name = "colorize", + red = f5_arg0.content_focus_color.r, + green = f5_arg0.content_focus_color.g, + blue = f5_arg0.content_focus_color.b + } ) + end ) + f5_local24:registerEventHandler( "button_up", function ( element, event ) + MBh.AnimateToState( "default" ) + element:processEvent( { + name = "colorize", + red = f5_arg0.content_default_color.r, + green = f5_arg0.content_default_color.g, + blue = f5_arg0.content_default_color.b + } ) + element:processEvent( { + name = "edit_unfocus" + } ) + end ) + self:addElement( f5_local24 ) + end + return self +end + +local f0_local4 = function ( f18_arg0, f18_arg1 ) + local f18_local0 = f18_arg0.checkboxMargin or 0 + local f18_local1 = f18_arg0.yOffset or 0 + local self = LUI.UIImage.new( { + material = RegisterMaterial( "box_empty" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = f18_local1 - 6, + bottom = f18_local1 + 6, + left = -f18_local0 - 10, + right = -f18_local0, + alpha = 1 + } ) + self.id = "checkbox" + self.properties = { + isVisible = true + } + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerEventHandler( "show_checkbox", function ( element, event ) + element.properties.isVisible = true + if event.showBox ~= nil then + element.properties.isVisible = event.showBox + end + element:animateToState( element.properties.isVisible and "default" or "hidden", 0 ) + end ) + local f18_local3 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 2, + bottom = -2, + left = 2, + right = -2, + alpha = 0 + } ) + f18_local3.id = "checkmark" + f18_local3.properties = { + isChecked = false + } + f18_local3:registerAnimationState( "checked", { + alpha = 1 + } ) + f18_local3:registerEventHandler( "toggle_checked", function ( element, event ) + event.name = "set_checked" + event.checkBox = not element.properties.isChecked + element:processEvent( event ) + end ) + f18_local3:registerEventHandler( "set_checked", function ( element, event ) + element.properties.isChecked = true + if event.checkBox ~= nil then + element.properties.isChecked = event.checkBox + end + element:animateToState( element.properties.isChecked and "checked" or "default", 0 ) + end ) + self:addElement( f18_local3 ) + return self +end + +local f0_local5 = function ( f22_arg0 ) + local f22_local0 = f22_arg0.useActionButton + local self = LUI.UIImage.new( { + material = RegisterMaterial( "btn_00a_ltcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f0_local0( "lt_cap_width", f22_arg0 ) + } ) + self.id = "bgLeftCap" + self:registerAnimationState( "focus", { + material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_ltcap_f" ) or RegisterMaterial( "btn_00a_ltcap_f" ) + } ) + self:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + self:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + self:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + self:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + local f22_local2 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_00a_rtcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -f0_local0( "rt_cap_width", f22_arg0 ), + right = 0 + } ) + f22_local2.id = "bgRightCap" + f22_local2:registerAnimationState( "disabled", { + material = RegisterMaterial( f22_arg0.disablePadlock and "btn_00a_rtcap" or "btn_00a_rtcap_d" ) + } ) + if f22_local0 then + f22_local2:registerAnimationState( "focus", { + material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_rtcap_f" ) or RegisterMaterial( "btn_00a_rtcap_f" ) + } ) + f22_local2:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + else + f22_local2:registerAnimationState( "focus", { + material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_rtcap_f_pc" ) or RegisterMaterial( "btn_00a_rtcap_f_pc" ) + } ) + f22_local2:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + end + f22_local2:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local2:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled" ) ) + f22_local2:registerEventHandler( "button_over_disable", MBh.AnimateToState( "disabled" ) ) + if Engine.IsAliensMode() then + local f22_local3 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_alien_overlay" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -44, + bottom = 16, + left = -208, + right = -48, + alpha = 0 + } ) + f22_local3.id = "blood_splat_glow" + f22_local3:registerAnimationState( "glow", { + alpha = f0_local0( "focus_action_button_glow_max_alpha", f22_arg0 ) + } ) + f22_local3:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + local f22_local4 = f22_local3 + local f22_local5 = f22_local3.registerEventHandler + local f22_local6 = "button_over" + local f22_local7 = MBh.AnimateLoop + local f22_local8 = {} + local f22_local9 = {} + local f22_local10 = "glow" + local f22_local11 = f0_local0( "focus_glow_animation_duration", f22_arg0 ) + f22_local9 = f22_local10 + f22_local10 = {} + f22_local11 = "default" + local f22_local12 = f0_local0( "focus_glow_animation_duration", f22_arg0 ) + f22_local10 = f22_local11 + f22_local8[1] = f22_local9 + f22_local8[2] = f22_local10 + f22_local5( f22_local4, f22_local6, f22_local7( f22_local8 ) ) + f22_local2:addElement( f22_local3 ) + f22_local5 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_alien_overlay_02" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -28, + bottom = 32, + left = -208, + right = -48, + alpha = 0 + } ) + f22_local5.id = "blood_splat_glow_02" + f22_local5:registerAnimationState( "glow", { + alpha = f0_local0( "focus_alien_action_button_glow_max_alpha", f22_arg0 ) + } ) + f22_local5:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local5:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f22_local5:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f22_local6 = f22_local5 + f22_local4 = f22_local5.registerEventHandler + f22_local7 = "button_over" + f22_local8 = MBh.AnimateLoop + f22_local9 = {} + f22_local10 = {} + f22_local11 = "glow" + f22_local12 = f0_local0( "focus_alien_glow_animation_duration", f22_arg0 ) + f22_local10 = f22_local11 + f22_local11 = {} + f22_local12 = "default" + local f22_local13 = f0_local0( "focus_alien_glow_animation_duration", f22_arg0 ) + f22_local11 = f22_local12 + f22_local9[1] = f22_local10 + f22_local9[2] = f22_local11 + f22_local4( f22_local6, f22_local7, f22_local8( f22_local9 ) ) + f22_local2:addElement( f22_local5 ) + end + if f22_local0 then + local f22_local3 = LUI.UIText.new( { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = -f22_arg0.actionButtonMargin, + top = f0_local0( "y_offset", f22_arg0 ) - 16, + bottom = f0_local0( "y_offset", f22_arg0 ) + 16, + alpha = 0 + } ) + f22_local3.id = "action_button" + f22_local3:setText( Engine.Localize( ButtonMap.button_action.string ) ) + f22_local3:registerAnimationState( "focus", { + alpha = 1 + } ) + f22_local3:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f22_local2:addElement( f22_local3 ) + end + local f22_local3 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_00a_mid" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = f0_local0( "lt_cap_width", f22_arg0 ), + right = -f0_local0( "rt_cap_width", f22_arg0 ) + } ) + f22_local3.id = "bgMid" + f22_local3:registerAnimationState( "focus", { + material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_mid_f" ) or RegisterMaterial( "btn_00a_mid_f" ) + } ) + f22_local3:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f22_local3:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + local f22_local5 = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + f22_local5.id = "hlist" + if f22_arg0.extendOnFocus then + f22_local5:registerAnimationState( "extended", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f0_local0( "focus_animation_distance", f22_arg0 ), + top = 0, + bottom = 0 + } ) + f22_local5:registerEventHandler( "button_over", MBh.AnimateToState( "extended", f0_local0( "focus_animation_duration", f22_arg0 ) ) ) + f22_local5:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local5:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f22_local5:registerEventHandler( "button_over_disable", MBh.AnimateToState( "extended", f0_local0( "focus_animation_duration", f22_arg0 ) ) ) + end + f22_local5:addElement( self ) + f22_local5:addElement( f22_local3 ) + f22_local5:addElement( f22_local2 ) + local f22_local4 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_00a_glow" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0 + } ) + f22_local4.id = "selection_glow" + f22_local4:registerAnimationState( "glow", { + alpha = f0_local0( "focus_glow_max_alpha", f22_arg0 ) + } ) + f22_local4:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + local f22_local7 = f22_local4 + local f22_local6 = f22_local4.registerEventHandler + local f22_local8 = "button_over" + local f22_local9 = MBh.AnimateLoop + local f22_local10 = {} + local f22_local11 = {} + local f22_local12 = "default" + local f22_local13 = f0_local0( "focus_glow_animation_duration", f22_arg0 ) + f22_local11 = f22_local12 + f22_local12 = {} + f22_local13 = "glow" + local f22_local14 = f0_local0( "focus_glow_animation_duration", f22_arg0 ) + f22_local12 = f22_local13 + f22_local10[1] = f22_local11 + f22_local10[2] = f22_local12 + f22_local6( f22_local7, f22_local8, f22_local9( f22_local10 ) ) + f22_local6 = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + f22_local6.id = "background" + f22_local6:addElement( f22_local5 ) + f22_local6:addElement( f22_local4 ) + return f22_local6 +end + +local f0_local6 = function ( f23_arg0 ) + local f23_local0 = f23_arg0.useActionButton + local f23_local1 = f0_local0( "submenu_substyle", f23_arg0 ) + local f23_local2 = f0_local0( "border_height", f23_arg0 ) + local f23_local3 = f0_local0( "border_padding", f23_arg0 ) + local f23_local4 = not f0_local0( "disable_border", f23_arg0 ) + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self.id = "container" + if not f23_local4 or not f23_local2 then + f23_local2 = 0 + end + if not f23_local4 or not f23_local3 then + f23_local3 = 0 + end + if f23_local4 then + local f23_local6 = LUI.UIImage.new( CoD.ColorizeState( f0_local0( "border_color", f23_arg0 ), { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -f23_local2, + bottom = 0, + left = 0, + right = 0 + } ) ) + f23_local6.id = "border" + self:addElement( f23_local6 ) + end + local f23_local6 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f0_local0( "background_padding", f23_arg0 ), + bottom = -f23_local3 - f23_local2, + left = 0, + right = 0 + } ) + f23_local6.id = "background" + self:addElement( f23_local6 ) + local f23_local7 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + } ) + f23_local7.id = "flat" + if f23_local1 then + local f23_local8 = f0_local0( "anim_interval", f23_arg0 ) + local f23_local9 = f0_local0( "anim_1_alpha", f23_arg0 ) + local f23_local10 = f0_local0( "anim_2_alpha", f23_arg0 ) + f23_local7:registerAnimationState( "anim_1", { + alpha = f23_local9 + } ) + f23_local7:registerAnimationState( "anim_2", { + alpha = f23_local10 + } ) + f23_local7:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f23_local8, + true, + true + }, + { + "anim_1", + f23_local8, + true, + true + } + } ) ) + else + f23_local7:registerAnimationState( "focus", { + red = 1, + green = 1, + blue = 1, + alpha = 0.5 + } ) + f23_local7:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + end + f23_local7:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f23_local7:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f23_local6:addElement( f23_local7 ) + if not f23_arg0.disablePadlock then + local f23_local8 = LUI.UIImage.new( CoD.ColorizeState( Colors.frontend_hilite, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + } ) ) + f23_local8.id = "lock" + f23_local8:registerAnimationState( "visible", { + alpha = 1 + } ) + f23_local8:registerEventHandler( "button_lock", MBh.AnimateToState( "visible" ) ) + f23_local8:registerEventHandler( "button_unlock", MBh.AnimateToState( "default" ) ) + f23_local6:addElement( f23_local8 ) + end + if f23_local0 and not f23_local1 then + local f23_local8 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_cas_end_f" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -f0_local0( "prompt_width", f23_arg0 ), + right = 0, + alpha = 0 + } ) + f23_local8.id = "promptBG" + f23_local8:registerAnimationState( "focus", { + alpha = 1 + } ) + f23_local8:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f23_local8:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f23_local8:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f23_local8:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f23_local6:addElement( f23_local8 ) + if Engine.IsConsoleGame() or 1 == Engine.IsGamepadEnabled() then + local f23_local9 = LUI.UIText.new( { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = -f23_arg0.actionButtonMargin, + top = -16, + bottom = 16, + alpha = 0 + } ) + f23_local9.id = "action_button" + f23_local9:setText( Engine.Localize( ButtonMap.button_action.string ) ) + f23_local9:registerAnimationState( "focus", { + alpha = 1 + } ) + f23_local9:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f23_local9:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f23_local9:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f23_local9:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f23_local6:addElement( f23_local9 ) + end + end + return self +end + +local f0_local7 = function ( f24_arg0 ) + local f24_local0 = f24_arg0.useActionButton + local f24_local1 = f0_local0( "popup_substyle", f24_arg0 ) + local f24_local2 = f0_local0( "submenu_substyle", f24_arg0 ) + local f24_local3 = f0_local0( "border_height", f24_arg0 ) + local f24_local4 = f0_local0( "border_padding", f24_arg0 ) + local f24_local5 = not f0_local0( "disable_border", f24_arg0 ) + local self = LUI.UIElement.new() + self.id = "container" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f0_local0( "ghost_height", f24_arg0 ), + left = 0, + right = f0_local0( "ghost_width", f24_arg0 ) + } ) + self:animateToState( "default" ) + if not f24_local5 or not f24_local3 then + f24_local3 = 0 + end + if not f24_local5 or not f24_local4 then + f24_local4 = 0 + end + if f24_local5 then + local f24_local7 = LUI.UIImage.new() + f24_local7.id = "border" + f24_local7:registerAnimationState( "default", CoD.ColorizeState( f0_local0( "border_color", f24_arg0 ), { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + height = f24_local3, + bottom = -f24_local4, + left = 0, + right = -f0_local0( "ghost_width", f24_arg0 ), + alpha = 1 + } ) ) + f24_local7:registerAnimationState( "focus", { + alpha = 0 + } ) + f24_local7:animateToState( "default" ) + f24_local7:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local7:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f24_local7:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f24_local7:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + self:addElement( f24_local7 ) + end + local f24_local7 = LUI.UIImage.new() + f24_local7.id = "bgLeftCap" + f24_local7:registerAnimationState( "default", { + material = RegisterMaterial( "btn_00d_ltcap_f" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f0_local0( "lt_cap_width", f24_arg0 ), + alpha = 0 + } ) + f24_local7:animateToState( "default" ) + if f24_local1 or f24_local2 then + f24_local7:registerAnimationState( "anim_1", { + alpha = f0_local0( "anim_1_alpha", f24_arg0 ) + } ) + f24_local7:registerAnimationState( "anim_2", { + alpha = f0_local0( "anim_2_alpha", f24_arg0 ) + } ) + f24_local7:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + f24_local7:registerEventHandler( "button_over_disable", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + else + f24_local7:registerAnimationState( "focus", { + alpha = 1 + } ) + f24_local7:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f24_local7:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + end + f24_local7:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local7:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + self:addElement( f24_local7 ) + local f24_local8 = LUI.UIImage.new() + f24_local8.id = "bgMid" + local f24_local9 = f24_local8 + local f24_local10 = f24_local8.registerAnimationState + local f24_local11 = "default" + local f24_local12 = { + material = RegisterMaterial( "btn_00d_mid_f" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = f0_local0( "lt_cap_width", f24_arg0 ) + } + local f24_local13 + if f24_local1 or f24_local2 then + f24_local13 = -1 * (f0_local0( "lt_cap_width", f24_arg0 ) + f0_local0( "ghost_width", f24_arg0 )) + if not f24_local13 then + + else + f24_local12.right = f24_local13 + f24_local12.alpha = 0 + f24_local10( f24_local9, f24_local11, f24_local12 ) + f24_local8:animateToState( "default" ) + if f24_local1 or f24_local2 then + f24_local8:registerAnimationState( "anim_1", { + alpha = f0_local0( "anim_1_alpha", f24_arg0 ) + } ) + f24_local8:registerAnimationState( "anim_2", { + alpha = f0_local0( "anim_2_alpha", f24_arg0 ) + } ) + f24_local8:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + f24_local8:registerEventHandler( "button_over_disable", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + else + f24_local8:registerAnimationState( "focus", { + alpha = 1 + } ) + f24_local8:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f24_local8:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + end + f24_local8:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local8:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + self:addElement( f24_local8 ) + f24_local10 = LUI.UIImage.new() + f24_local10.id = "bgRightCap" + if f24_local1 or f24_local2 then + f24_local10:registerAnimationState( "default", { + material = RegisterMaterial( "btn_00d_rtcap_f_alt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -1 * (f0_local0( "lt_cap_width", f24_arg0 ) + f0_local0( "ghost_width", f24_arg0 )), + right = -f0_local0( "ghost_width", f24_arg0 ), + alpha = 0 + } ) + f24_local10:animateToState( "default" ) + f24_local10:registerAnimationState( "anim_1", { + alpha = f0_local0( "anim_1_alpha", f24_arg0 ) + } ) + f24_local10:registerAnimationState( "anim_2", { + alpha = f0_local0( "anim_2_alpha", f24_arg0 ) + } ) + f24_local10:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + f24_local10:registerEventHandler( "button_over_disable", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + else + f24_local11 = f24_local10 + f24_local9 = f24_local10.registerAnimationState + f24_local12 = "default" + f24_local13 = {} + local f24_local14 = RegisterMaterial + local f24_local15 + if f24_local0 then + f24_local15 = "btn_00d_rtcap_f" + if not f24_local15 then + + else + f24_local13.material = f24_local14( f24_local15 ) + f24_local13.topAnchor = true + f24_local13.bottomAnchor = true + f24_local13.leftAnchor = false + f24_local13.rightAnchor = true + f24_local13.top = 0 + f24_local13.bottom = 0 + f24_local13.left = -f0_local0( "rt_cap_width", f24_arg0 ) + f24_local13.right = 0 + f24_local13.alpha = 0 + f24_local9( f24_local11, f24_local12, f24_local13 ) + f24_local10:animateToState( "default" ) + f24_local10:registerAnimationState( "focus", { + alpha = 1 + } ) + f24_local10:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f24_local10:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + end + end + f24_local15 = "btn_00d_rtcap_f_pc" + end + f24_local10:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local10:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + self:addElement( f24_local10 ) + f24_local9 = LUI.UIImage.new() + f24_local9.id = "lock" + f24_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -f0_local0( "lock_padding", f24_arg0 ), + left = 0, + right = -f0_local0( "ghost_width", f24_arg0 ), + alpha = 0 + } ) ) + f24_local9:registerAnimationState( "visible", { + alpha = 1 + } ) + f24_local9:animateToState( "default" ) + f24_local9:registerEventHandler( "button_lock", MBh.AnimateToState( "visible" ) ) + f24_local9:registerEventHandler( "button_unlock", MBh.AnimateToState( "default" ) ) + self:addElement( f24_local9 ) + if f24_local0 then + f24_local11 = LUI.UIText.new() + f24_local11.id = "action_button" + f24_local11:setText( Engine.Localize( ButtonMap.button_action.string ) ) + f24_local11:registerAnimationState( "default", { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = -f24_arg0.actionButtonMargin, + top = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) - 16, + bottom = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) + 16, + alpha = 0 + } ) + f24_local11:animateToState( "default" ) + f24_local11:registerAnimationState( "focus", { + alpha = 1 + } ) + f24_local11:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local11:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f24_local11:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f24_local11:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f24_local10:addElement( f24_local11 ) + end + if not f24_arg0.disablePadlock then + f24_local11 = LUI.UIImage.new() + f24_local11.id = "padlock" + f24_local11:registerAnimationState( "default", { + material = RegisterMaterial( "icon_lock_mini" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + left = -f0_local0( "padlock_margin", f24_arg0 ) - f0_local0( "padlock_width", f24_arg0 ), + right = -f0_local0( "padlock_margin", f24_arg0 ), + top = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) - f0_local0( "padlock_height", f24_arg0 ) / 2, + bottom = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) + f0_local0( "padlock_height", f24_arg0 ) / 2, + alpha = 0 + } ) + f24_local11:animateToState( "default" ) + f24_local11:registerAnimationState( "visible", { + alpha = 1, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + f24_local11:registerAnimationState( "visible_over", { + alpha = 1, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b + } ) + f24_local11:registerEventHandler( "button_over", MBh.AnimateToState( "default" ) ) + f24_local11:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local11:registerEventHandler( "button_disable", MBh.AnimateToState( "visible" ) ) + f24_local11:registerEventHandler( "button_over_disable", MBh.AnimateToState( "visible_over" ) ) + self:addElement( f24_local11 ) + end + return self + end + end + f24_local13 = -f0_local0( "rt_cap_width", f24_arg0 ) +end + +function CreateGenericButtonBackground( f25_arg0, f25_arg1, f25_arg2, f25_arg3, f25_arg4, f25_arg5, f25_arg6 ) + local f25_local0 = { + style = f25_arg0, + substyle = f25_arg1, + itemProps = f25_arg2 + } + local f25_local1 = nil + f25_local0.useActionButton = f25_arg4 or f25_arg3 or f25_arg5 + local f25_local2 = assert + local f25_local3 + if f0_local0( "force_disable_action_button", f25_arg6 ) then + f25_local3 = not f0_local0( "force_enable_action_button", f25_arg6 ) + else + f25_local3 = true + end + f25_local2( f25_local3, "Trying to force enable and force disable the button prompt." ) + f25_local2 = f25_local0.useActionButton + if f25_local2 then + f25_local2 = not f0_local0( "force_disable_action_button", f25_arg6 ) + end + f25_local0.useActionButton = f25_local2 + f25_local2 = f25_local0.useActionButton + if not f25_local2 then + f25_local2 = f0_local0( "force_enable_action_button", f25_arg6 ) + end + f25_local0.useActionButton = f25_local2 + f25_local2 = f25_local0.useActionButton + if f25_local2 then + f25_local2 = Engine.IsConsoleGame() + if not f25_local2 then + f25_local2 = Engine.IsGamepadEnabled() == 1 + end + end + f25_local0.useActionButton = f25_local2 + if not f25_arg3 and not f25_arg4 and not f25_arg5 then + f25_local2 = f0_local0( "force_enable_action_button", f25_arg6 ) + if f25_local2 then + + else + f25_local0.extendOnFocus = f25_local2 + f25_local0.disablePadlock = f0_local0( "disable_padlock", f25_arg6 ) + f25_local0.actionButtonMargin = f0_local0( "action_button_margin", f25_arg6 ) + if f25_arg0 == GenericButtonSettings.Styles.GradientButton then + f25_local1 = f0_local5( f25_local0 ) + elseif f25_arg0 == GenericButtonSettings.Styles.FlatButton then + f25_local1 = f0_local6( f25_local0 ) + elseif f25_arg0 == GenericButtonSettings.Styles.GlassButton then + f25_local1 = f0_local7( f25_local0 ) + end + if f25_local1 then + f25_local1:setPriority( -1000 ) + end + return f25_local1 + end + end + f25_local2 = not f0_local0( "force_disable_action_button", f25_arg6 ) +end + +function UpdateButtonText( f26_arg0, f26_arg1 ) + f26_arg0.textLabel:setText( f26_arg1 ) +end + +function UpdateDescText( f27_arg0, f27_arg1 ) + if f27_arg0.properties.desc_text then + local f27_local0 = "" + if type( f27_arg0.properties.desc_text ) == "string" then + f27_local0 = f27_arg0.properties.desc_text + elseif type( f27_arg0.properties.desc_text ) == "function" then + f27_local0 = f27_arg0.properties:desc_text( f27_arg1 ) + assert( type( f27_local0 ) == "string" ) + end + f27_arg0:dispatchEventToRoot( { + name = "set_button_info_text", + text = f27_local0 + } ) + end +end + +LUI.UIGenericButton.new = function ( f28_arg0, f28_arg1, f28_arg2 ) + if not f28_arg1 then + f28_arg1 = {} + end + local f28_local0 = f28_arg1.childNum + if not f28_arg2 then + f28_arg2 = f28_local0 or 0 + end + local f28_local1 = nil + local f28_local2 = f28_arg1.style + if not f28_local2 then + f28_local2 = GenericButtonSettings.Styles.GradientButton + end + local f28_local3 = f28_arg1.variant + if not f28_local3 then + f28_local3 = GenericButtonSettings.Variants.Plain + end + local f28_local4 = f28_local3 == GenericButtonSettings.Variants.Checkbox + local f28_local5 = f28_local3 == GenericButtonSettings.Variants.Plain + local f28_local6 = f28_local3 == GenericButtonSettings.Variants.Info + local f28_local7 = f28_local3 == GenericButtonSettings.Variants.Select + local f28_local8 = f28_local3 == GenericButtonSettings.Variants.Slider + local f28_local9 = f28_local3 == GenericButtonSettings.Variants.Input + local f28_local10 = f28_local8 or f28_local7 or f28_local6 or f28_local9 + local f28_local11 + if f28_local2 == GenericButtonSettings.Styles.GradientButton then + f28_local11 = not f28_arg1.disableAnimation + else + f28_local11 = false + end + if f28_local2 == GenericButtonSettings.Styles.FlatButton then + f28_local1 = f28_arg1.substyle or GenericButtonSettings.Styles.FlatButton.SubStyles.Default + elseif f28_local2 == GenericButtonSettings.Styles.GlassButton then + f28_local1 = f28_arg1.substyle or GenericButtonSettings.Styles.GlassButton.SubStyles.Default + end + if not f28_local1 then + f28_local1 = {} + end + local f28_local12 = { + style = f28_local2, + substyle = f28_local1, + itemProps = f28_arg1 + } + local f28_local13 = LUI.UIButton.new + local self = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + top = 0, + bottom = f0_local0( "height", f28_local12 ) + } + local f28_local15 + if f28_local2 == GenericButtonSettings.Styles.GradientButton then + f28_local15 = -f0_local0( "focus_animation_distance", f28_local12 ) + if not f28_local15 then + + else + self.right = f28_local15 + self.left = 0 + f28_local13 = f28_local13( self ) + f28_local13.id = "UIGenericButton" + f28_local13.properties = f28_local13.properties or {} + self = LUI.UIElement.new() + self.id = "button" + f28_local13:addElement( self ) + f28_local15 = not f0_local0( "disable_height_guard", f28_local12 ) + if f28_local11 then + local f28_local16 = self + local f28_local17 = self.registerAnimationState + local f28_local18 = "default" + local f28_local19 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = not f28_local15, + top = 0 + } + local f28_local20 + if f28_local15 then + f28_local20 = f0_local0( "height", f28_local12 ) + if not f28_local20 then + + else + f28_local19.bottom = f28_local20 + f28_local19.left = -f0_local0( "lt_cap_width", f28_local12 ) - f0_local0( "rt_cap_width", f28_local12 ) + f28_local19.right = 0 + f28_local17( f28_local16, f28_local18, f28_local19 ) + f28_local16 = self + f28_local17 = self.registerAnimationState + f28_local18 = "ready" + f28_local19 = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = not f28_local15, + left = 0, + right = 0, + top = 0 + } + if f28_local15 then + f28_local20 = f0_local0( "height", f28_local12 ) + if not f28_local20 then + + else + f28_local19.bottom = f28_local20 + f28_local17( f28_local16, f28_local18, f28_local19 ) + f28_local16 = MBh.AnimateSequence( { + { + "default", + 0, + false, + false + }, + { + "ready", + f0_local0( "slide_in_min_duration", f28_local12 ) + f0_local0( "slide_in_duration_step", f28_local12 ) * f28_arg2, + false, + true + } + } ) + f28_local16( self, {} ) + if f28_arg2 == 1 then + Engine.PlaySound( CoD.SFX.ChangeScreen ) + end + end + end + f28_local20 = 0 + end + end + f28_local20 = 0 + else + local f28_local16 = self + local f28_local17 = self.registerAnimationState + local f28_local18 = "default" + local f28_local19 = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = not f28_local15, + left = 0, + right = 0, + top = 0 + } + local f28_local20 + if f28_local15 then + f28_local20 = f0_local0( "height", f28_local12 ) + if not f28_local20 then + + else + f28_local19.bottom = f28_local20 + f28_local17( f28_local16, f28_local18, f28_local19 ) + self:animateToState( "default" ) + end + end + f28_local20 = 0 + end + self.background = CreateGenericButtonBackground( f28_local2, f28_local1, f28_arg1, f28_local5, f28_local6, f28_local9, f28_local12 ) + self:addElement( self.background ) + self:registerEventHandler( "refresh_button_background", function ( element, event ) + element.background:close() + element.background = CreateGenericButtonBackground( f28_local2, f28_local1, f28_arg1, f28_local5, f28_local6, f28_local9, f28_local12 ) + self:addElement( self.background ) + end ) + local f28_local17 = { + yOffset = f0_local0( "y_offset", f28_local12 ), + text_focus_color = f0_local0( "text_focus_color", f28_local12 ), + text_lock_color = f0_local0( "text_lock_color", f28_local12 ), + text_default_color = f0_local0( "text_default_color", f28_local12 ), + text_disabled_color = f0_local0( "text_disabled_color", f28_local12 ), + text_over_disabled_color = f0_local0( "text_over_disabled_color", f28_local12 ), + text_over_disabled_pulse_color = f0_local0( "text_over_disabled_pulse_color", f28_local12 ), + overDisabledAnimationDuration = f0_local0( "over_disabled_animation_duration", f28_local12 ) + } + if f28_local10 then + f28_local17.padding = f0_local0( "text_padding_with_content", f28_local12 ) + f28_local17.align = f0_local0( "text_align_with_content", f28_local12 ) + else + f28_local17.padding = f0_local0( "text_padding_without_content", f28_local12 ) + f28_local17.align = f0_local0( "text_align_without_content", f28_local12 ) + end + if f28_local2 == GenericButtonSettings.Styles.FlatButton or f28_local2 == GenericButtonSettings.Styles.GlassButton then + f28_local17.additional_handlers = { + button_lock = function ( f30_arg0, f30_arg1 ) + if not Engine.IsConsoleGame() then + f28_local13.m_ignoreMouseFocus = true + if Engine.IsGamepadEnabled() ~= 1 then + f28_local13:processEvent( { + name = "lose_focus", + immediate = true + } ) + f28_local13.m_ignoreMouseFocus = true + f28_local13.m_mouseOver = nil + end + end + f30_arg0:animateToState( "locked" ) + end, + button_unlock = function ( f31_arg0, f31_arg1 ) + if not f31_arg1.graphicsOnly then + f31_arg0:animateToState( "default" ) + if not Engine.IsConsoleGame() then + f28_local13.m_ignoreMouseFocus = false + if Engine.IsGamepadEnabled() ~= 1 then + f28_local13.m_focusable = true + end + end + f28_local13:processEvent( { + name = "button_up", + immediate = true, + dispatchChildren = true + } ) + end + end + } + end + f28_local13.textLabel = f0_local1( f28_local17, f28_arg1.button_text ) + f28_local13.setText = UpdateButtonText + self:addElement( f28_local13.textLabel ) + if f28_local10 then + local f28_local16 = {} + local f28_local18 + if not f28_local8 then + f28_local18 = not f28_local9 + else + f28_local18 = false + end + f28_local16.useText = f28_local18 + f28_local16.useInput = f28_local9 + f28_local16.field_edited_func = f0_local0( "field_edited_func", f28_local12 ) + f28_local16.max_length = f0_local0( "max_length", f28_local12 ) + f28_local16.password_field = f0_local0( "password_field", f28_local12 ) + f28_local16.filter_profanity = f0_local0( "filter_profanity", f28_local12 ) + f28_local16.keyboard_type = f0_local0( "keyboard_type", f28_local12 ) + f28_local16.field_name = f0_local0( "field_name", f28_local12 ) + f28_local16.text_alignment = f0_local0( "text_alignment", f28_local12 ) + f28_local16.useBackground = not f28_local6 + if not f28_local6 then + f28_local18 = not f28_local9 + else + f28_local18 = false + end + f28_local16.useArrows = f28_local18 + f28_local16.arrowsMargin = f0_local0( "content_arrows_margin", f28_local12 ) + f28_local16.useSlider = f28_local8 + f28_local16.sliderWidth = f0_local0( "content_slider_width", f28_local12 ) + f28_local16.sliderHeight = f0_local0( "content_slider_height", f28_local12 ) + f28_local16.margin = f0_local0( "content_margin", f28_local12 ) + f28_local16.width = f0_local0( "content_width", f28_local12 ) + f28_local16.yOffset = f0_local0( "y_offset", f28_local12 ) + f28_local16.backgroundMarginTop = f0_local0( "content_background_margin_top", f28_local12 ) + f28_local16.backgroundMarginBottom = f0_local0( "content_background_margin_bottom", f28_local12 ) + f28_local16.labelAlign = f0_local0( "label_align", f28_local12 ) + f28_local16.text_focus_color = f0_local0( "text_focus_color", f28_local12 ) + f28_local16.content_default_color = f0_local0( "content_default_color", f28_local12 ) + f28_local16.content_lock_color = f0_local0( "content_lock_color", f28_local12 ) + f28_local16.content_focus_color = f0_local0( "content_focus_color", f28_local12 ) + f28_local16.content_focus_color_without_bg = f0_local0( "content_focus_color_without_bg", f28_local12 ) + f28_local16.text_disabled_color = f0_local0( "text_disabled_color", f28_local12 ) + f28_local16.text_over_disabled_color = f0_local0( "text_over_disabled_color", f28_local12 ) + f28_local16.text_over_disabled_pulse_color = f0_local0( "text_over_disabled_pulse_color", f28_local12 ) + self:addElement( f0_local3( f28_local16, f28_arg1 ) ) + elseif f28_local4 then + self:addElement( f0_local4( { + checkboxMargin = f0_local0( "checkbox_margin", f28_local12 ), + yOffset = f0_local0( "y_offset", f28_local12 ) + }, f28_arg1 ) ) + end + if Engine.InFrontend() then + local f28_local16 = f0_local0( "newIconSize", f28_local12 ) + local f28_local20 = LUI.UIImage.new( { + material = RegisterMaterial( "icon_new_2" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f0_local0( "y_offset", f28_local12 ) - f28_local16 / 2, + height = f28_local16, + left = f0_local0( "newIconIndent", f28_local12 ), + width = f28_local16, + alpha = 0 + } ) + f28_local20.id = "newIcon" + f28_local20:registerAnimationState( "visible", { + alpha = 1 + } ) + f28_local20:registerAnimationState( "darker", { + alpha = 0.5 + } ) + f28_local20:registerEventHandler( "show_new_icon", MBh.AnimateToState( "visible" ) ) + f28_local20:registerEventHandler( "hide_new_icon", MBh.AnimateToState( "default", 50 ) ) + f28_local20:registerEventHandler( "flash_new_icon", MBh.AnimateLoop( { + { + "visible", + 0 + }, + { + "darker", + 300 + }, + { + "visible", + 300 + } + } ) ) + self:addElement( f28_local20 ) + end + f28_local13.properties.desc_text = f28_arg1.desc_text + f28_local13.properties.button_over_func = f28_arg1.button_over_func + f28_local13:registerEventHandler( "button_over", function ( element, event ) + UpdateDescText( element, event ) + if element.properties.button_over_func then + element.properties:button_over_func( event ) + end + if f28_local10 and not f28_local6 then + element:processEvent( { + name = "show_arrows" + } ) + end + end ) + f28_local13.properties.button_up_func = f28_arg1.button_up_func + f28_local13:registerEventHandler( "button_up", function ( element, event ) + if element.properties.button_up_func then + element.properties:button_up_func( event ) + end + if f28_local10 and not f28_local6 then + element:processEvent( { + name = "hide_arrows" + } ) + end + end ) + f28_local13.properties.button_action_func = f28_arg1.button_action_func + f28_local13:registerEventHandler( "button_action", function ( element, event ) + if f28_local4 then + element:processEvent( { + name = "toggle_checked" + } ) + end + if f28_local9 and not event.mouse then + element:dispatchEventToChildren( event ) + end + if element.properties.button_action_func then + element.properties:button_action_func( event ) + if f28_local2 == GenericButtonSettings.Styles.FlatButton and f0_local0( "use_locking", f28_local12 ) then + element:processEvent( { + name = "button_lock", + dispatchChildren = true + } ) + end + end + end ) + if f28_arg1.button_disable_func then + f28_local13.properties.button_disable_func = f28_arg1.button_disable_func + f28_local13:registerEventHandler( "button_disable", function ( element, event ) + if element.properties.button_disable_func then + element.properties:button_disable_func( event ) + end + end ) + end + if f28_arg1.button_action_disable_func then + f28_local13.properties.button_action_disable_func = f28_arg1.button_action_disable_func + f28_local13:registerEventHandler( "button_action_disable", function ( element, event ) + if element.properties.button_action_disable_func then + element.properties:button_action_disable_func( event ) + end + end ) + end + f28_local13.properties.button_over_disable_func = f28_arg1.button_over_disable_func + f28_local13:registerEventHandler( "button_over_disable", function ( element, event ) + UpdateDescText( element, event ) + if element.properties.button_over_disable_func then + element.properties:button_over_disable_func( event ) + end + if f28_local10 and not f28_local6 then + element:processEvent( { + name = "hide_arrows" + } ) + end + end ) + if f28_local2 == GenericButtonSettings.Styles.FlatButton and f0_local0( "use_locking", f28_local12 ) then + f28_local13:registerEventHandler( "restore_focus", function ( element, event ) + element:processEvent( { + name = "button_unlock", + dispatchChildren = true + } ) + return LUI.UIElement.restoreFocus( element, event ) + end ) + end + if f28_arg1.additional_children_func then + assert( type( f28_arg1.additional_children_func ) == "function" ) + local f28_local16 = f28_arg1:additional_children_func() + assert( istable( f28_local16 ) ) + for f28_local21, f28_local22 in ipairs( f28_local16 ) do + assert( istable( f28_local22 ) ) + LUI.MenuBuilder.BuildAddChild( self, f28_local22 ) + end + end + return f28_local13 + end + end + f28_local15 = 0 +end + +LUI.MenuBuilder.registerType( "UIGenericButton", LUI.UIGenericButton.new ) +LockTable( _M ) diff --git a/lui/menugenerics.dec.lua b/lui/menugenerics.dec.lua new file mode 100644 index 0000000..bfa089e --- /dev/null +++ b/lui/menugenerics.dec.lua @@ -0,0 +1,2341 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( "Registering " .. _NAME ) +if Engine.InFrontend() then + function InputFieldOpensVirtualKeyboard( f1_arg0 ) + return Engine.IsConsoleGame() or f1_arg0 + end + + function InputFieldAction( f2_arg0, f2_arg1 ) + local f2_local0 = Engine.GetDvarString( f2_arg0.properties.dvar_hook ) + local f2_local1 + if not Engine.IsConsoleGame() and not f2_arg1.mouse then + f2_local1 = not f2_arg1.keyboard + else + f2_local1 = false + end + f2_arg0.properties.isPCGamepad = f2_local1 + if InputFieldOpensVirtualKeyboard( f2_local1 ) then + f2_arg0.properties.active = true + local f2_local2 = Engine.OpenScreenKeyboard + local f2_local3 = f2_arg1.controller + if not f2_local3 then + f2_local3 = Engine.GetFirstActiveController() + end + local f2_local4 = f2_arg0.properties.field_name + if f2_local0 then + local f2_local5 = f2_local0 + end + f2_local2( f2_local3, f2_local4, f2_local5 or "", f2_arg0.properties.max_length, f2_arg0.properties.verify_string, f2_arg0.properties.filter_profanity, f2_arg0.properties.keyboard_type ) + elseif f2_arg0.properties.active then + f2_arg0:processEvent( { + name = "finish_editing" + } ) + f2_arg0.properties.active = false + else + local f2_local2 = f2_arg0:getChildById( "input_text" ) + f2_local2:setTextEditActive() + f2_arg0.properties.active = true + end + end + + function InputFieldUpdateText( f3_arg0, f3_arg1 ) + if f3_arg1.text then + local f3_local0 = f3_arg0.properties.password_field and string.rep( "*", #f3_arg1.text ) or f3_arg1.text + local f3_local1 = f3_arg0:getChildById( "input_text" ) + f3_local1:setTextEditText( f3_local0 ) + Engine.SetDvarString( f3_arg0.properties.dvar_hook, f3_arg1.text ) + end + end + + function InitField( f4_arg0, f4_arg1 ) + f4_arg0:setTextEditText( f4_arg0.properties.text ) + local f4_local0 = Engine.GetDvarString( f4_arg0.properties.dvar_hook ) + if f4_local0 ~= nil and f4_local0 ~= "" then + f4_arg0:setTextEditText( f4_arg0.properties.password_field and string.rep( "*", #f4_local0 ) or f4_local0 ) + end + end + + function DefaultFieldEditedAction() + + end + + function generic_input_field() + return { + type = "UIButton", + id = "generic_input_field_id", + focusable = true, + properties = { + help_value = "Placeholder field help", + field_name = "Placeholder Field name", + dvar_hook = "override_this_with_a_DVarString_name", + max_length = 16, + password_field = false, + use_auto_align = false, + active = false, + isPCGamepad = false, + field_edited_func = DefaultFieldEditedAction, + verify_string = false, + filter_profanity = false, + keyboard_type = CoD.KeyboardInputTypes.Normal, + text_alignment = LUI.Alignment.Left + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = GenericButtonDims.button_height, + alpha = 0.5 + }, + over = { + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over", 0 ), + button_up = MBh.AnimateToState( "default", 0 ), + button_action = InputFieldAction, + text_edit_complete = function ( f7_arg0, f7_arg1 ) + if not InputFieldOpensVirtualKeyboard( f7_arg0.properties.isPCGamepad ) and f7_arg0.properties.active then + f7_arg1.text = f7_arg0.properties:field_edited_func( f7_arg1 ) or f7_arg1.text + InputFieldUpdateText( f7_arg0, f7_arg1 ) + end + end + , + text_input_complete = function ( f8_arg0, f8_arg1 ) + if InputFieldOpensVirtualKeyboard( f8_arg0.properties.isPCGamepad ) and f8_arg0.properties.active then + f8_arg1.text = f8_arg0.properties:field_edited_func( f8_arg1 ) or f8_arg1.text + InputFieldUpdateText( f8_arg0, f8_arg1 ) + f8_arg0.properties.active = false + end + end + , + edit_unfocus = function ( f9_arg0, f9_arg1 ) + if not InputFieldOpensVirtualKeyboard( f9_arg0.properties.isPCGamepad ) and f9_arg0.properties.active then + f9_arg0:processEvent( { + name = "finish_editing" + } ) + f9_arg0.properties.active = false + end + end + + }, + children = { + { + type = "UITextEdit", + id = "input_text", + properties = { + text = MBh.Property( "help_value" ), + max_length = MBh.Property( "max_length" ), + dvar_hook = MBh.Property( "dvar_hook" ), + password_field = MBh.Property( "password_field" ), + use_auto_align = MBh.Property( "use_auto_align" ), + text_alignment = MBh.Property( "text_alignment" ) + }, + handlers = { + menu_create = InitField, + finish_editing = function ( f10_arg0, f10_arg1 ) + f10_arg0:setTextEditActive( false ) + end + , + colorize = function ( f11_arg0, f11_arg1 ) + f11_arg0:registerAnimationState( "colorized", { + red = f11_arg1.red, + green = f11_arg1.green, + blue = f11_arg1.blue + } ) + f11_arg0:animateToState( "colorized" ) + end + + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.SmallFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alignment = MBh.Property( "text_alignment" ) + } + } + } + } + } + end + + function AutoUpdateDescText( f12_arg0, f12_arg1 ) + if f12_arg0.properties.desc_text then + local f12_local0 = "" + if type( f12_arg0.properties.desc_text ) == "string" then + f12_local0 = f12_arg0.properties.desc_text + elseif type( f12_arg0.properties.desc_text ) == "function" then + f12_local0 = f12_arg0.properties:desc_text( f12_arg1 ) + assert( type( f12_local0 ) == "string" ) + end + f12_arg0:dispatchEventToRoot( { + name = "set_button_info_text", + text = f12_local0, + [1] = immediate + } ) + end + end + +end +function generic_back_button() + local self = LUI.UIBindButton.new() + self.id = "generic_back_button" + self:registerEventHandler( "button_secondary", MBh.LeaveMenu() ) + return self +end + +f0_local0 = function ( f14_arg0, f14_arg1 ) + if f14_arg1.string then + f14_arg0:setText( f14_arg1.string ) + end +end + +function HandleMenuTitleShow( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg1.preAnimTime or 0 + local f15_local1 = f15_arg1.animTime or 0 + if f15_arg0.properties.isHidden then + local f15_local2 = MBh.AnimateSequence( { + { + "hidden", + f15_local0 + }, + { + "shown", + f15_local1 + } + } ) + f15_local2( f15_arg0 ) + f15_arg0.properties.isHidden = false + end +end + +function HandleMenuTitleHide( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg1.preAnimTime or 0 + local f16_local1 = f16_arg1.animTime or 0 + if not f16_arg0.properties.isHidden then + local f16_local2 = MBh.AnimateSequence( { + { + "shown", + f16_local0 + }, + { + "hidden", + f16_local1 + } + } ) + f16_local2( f16_arg0 ) + f16_arg0.properties.isHidden = true + end +end + +function generic_menu_title( f17_arg0, f17_arg1 ) + local f17_local0 = 100 + local f17_local1 = 52 + if not f17_arg1 then + f17_arg1 = {} + end + local self = LUI.UIElement.new() + self.id = "generic_menu_title_container_id" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 128 + } ) + self:registerAnimationState( "hidden", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = -128, + bottom = 0 + } ) + self:animateToState( "default" ) + local f17_local3 = LUI.UIImage.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + bottom = 0, + height = 300, + red = 0, + green = 0, + blue = 0, + alpha = 1, + material = RegisterMaterial( "white" ) + } ) + f17_local3.id = "black_bar" + f17_local3:setPriority( 10 ) + self:addElement( f17_local3 ) + local f17_local4 = LUI.UIImage.new() + f17_local4.id = "generic_menu_title_background_id" + f17_local4:registerAnimationState( "default", { + material = RegisterMaterial( "bkgd_title_bar" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -10, + bottom = 118, + left = 0, + right = 0, + alpha = 0.75 + } ) + f17_local4:animateToState( "default" ) + self:addElement( f17_local4 ) + if Engine.IsAliensMode() then + local f17_local5 = LUI.UIImage.new() + f17_local5.id = "generic_menu_title_flare_id" + f17_local5:registerAnimationState( "default", { + material = RegisterMaterial( "box_alien_header_footer" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 72, + bottom = 102, + left = 0, + right = 0, + alpha = 1 + } ) + f17_local5:animateToState( "default" ) + self:addElement( f17_local5 ) + end + local f17_local5 = LUI.UIElement.new() + f17_local5.id = "generic_menu_title_id" + f17_local5.properties = { + isHidden = false + } + f17_local5:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = f17_local1, + bottom = f17_local1 + CoD.TextSettings.ExtraBigFont.Height, + left = f17_local0, + right = 1280 - f17_local0 + } ) + f17_local5:registerAnimationState( "hidden", { + alpha = 0 + } ) + f17_local5:registerAnimationState( "shown", { + alpha = 1 + } ) + f17_local5:animateToState( "default" ) + f17_local5:registerEventHandler( "menu_title_show", HandleMenuTitleShow ) + f17_local5:registerEventHandler( "menu_title_hide", HandleMenuTitleHide ) + self:addElement( f17_local5 ) + local f17_local6 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 16, + right = 530, + top = 0, + bottom = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left + } + local f17_local7 = LUI.UIMarqueeText.new( f17_local6 ) + f17_local7.id = "header_text" + f17_local7:setText( f17_arg1.menu_title or "TITLE" ) + f17_local7:registerAnimationState( "default", f17_local6 ) + f17_local7:registerEventHandler( "update_header_text", f0_local0 ) + f17_local7:animateToState( "default" ) + f17_local5:addElement( f17_local7 ) + local f17_local8 = LUI.UIImage.new() + f17_local8.id = "header_left_box" + f17_local8:registerAnimationState( "default", CoD.ColorizeState( Engine.IsAliensMode() and Colors.alien_frontend_hilite or Colors.frontend_hilite, { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 6, + top = 5, + bottom = 22, + material = RegisterMaterial( "white" ) + } ) ) + f17_local8:animateToState( "default" ) + f17_local5:addElement( f17_local8 ) + if IsPublicMatch and IsPublicMatch() and not f17_arg1.disableLobbyStatus and package.loaded["LUI.mp_menus.mpLobbyWidgets"] and LUI.mp_menus.mpLobbyWidgets.lobby_status then + self:addElement( LUI.mp_menus.mpLobbyWidgets.lobby_status( {}, {} ) ) + end + local f17_local9 = MLG + if f17_local9 then + f17_local9 = MLG.IsFeatureAvailable + if f17_local9 then + f17_local9 = MLG.IsFeatureAvailable() + end + end + if not f17_arg1.disableMLGRulesVersionNumber and Engine.InFrontend() and f17_local9 then + local f17_local10 = LUI.UIText.new() + f17_local10.id = "codEsportText" + f17_local10:setText( Engine.Localize( "PATCH_MENU_MLG_RULES_VERSION", MLG.GetRulesVersionNumber() ) ) + f17_local10:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = 0, + right = 0, + height = CoD.TextSettings.SmallFont.Height, + alpha = 0 + } ) ) + f17_local10:registerAnimationState( "visible", { + alpha = 1 + } ) + f17_local10:registerEventHandler( "mlg_disabled", MBh.AnimateToState( "default" ) ) + f17_local10:registerEventHandler( "mlg_enabled", function ( element, event ) + element:setText( Engine.Localize( "PATCH_MENU_MLG_RULES_VERSION", MLG.GetRulesVersionNumber() ) ) + element:animateToState( "visible", 0 ) + end ) + f17_local10:registerEventHandler( "menu_create", function ( element, event ) + if MLG.AreMLGRulesEnabled() then + element:processEvent( { + name = "mlg_enabled" + } ) + else + element:processEvent( { + name = "mlg_disabled" + } ) + end + end ) + f17_local10:animateToState( "default" ) + f17_local5:addElement( f17_local10 ) + end + return self +end + +function left_header() + local f20_local0 = 35 + return { + type = "UIElement", + id = "left_header_id", + properties = { + text = "Placement Text" + }, + children = { + { + type = "UIText", + id = "header_text", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = -GenericButtonDims.pad_button_width, + top = 0, + bottom = CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Right + } + }, + handlers = { + update_header_text = f0_local0 + } + }, + { + type = "UIImage", + id = "sep_image", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = f20_local0 - GenericButtonDims.button_height / 4, + bottom = f20_local0 + GenericButtonDims.button_height / 4, + material = RegisterMaterial( "navbar_tick" ) + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 60, + left = 0, + bottom = 60 + f20_local0, + right = 450, + font = CoD.TextSettings.NormalFont.Font + } + } + } +end + +function generic_border( f21_arg0, f21_arg1 ) + local f21_local0 = false + if f21_arg1.inner ~= nil then + f21_local0 = f21_arg1.inner + end + local f21_local1 = f21_arg1.thickness + if not f21_local1 then + f21_local1 = 1 + end + local f21_local2 = f21_arg1.border_red + if not f21_local2 then + f21_local2 = 1 + end + local f21_local3 = f21_arg1.border_green + if not f21_local3 then + f21_local3 = 1 + end + local f21_local4 = f21_arg1.border_blue + if not f21_local4 then + f21_local4 = 1 + end + local f21_local5 = f21_arg1.border_alpha + if not f21_local5 then + f21_local5 = 1 + end + local f21_local6 = f21_arg1.hide_bottom + if not f21_local6 then + f21_local6 = false + end + local self = LUI.UIElement.new() + local f21_local8 = self + local f21_local9 = self.registerAnimationState + local f21_local10 = "default" + local f21_local11 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true + } + if f21_local0 then + local f21_local12 = f21_local1 + end + f21_local11.top = f21_local12 or 0 + local f21_local13 + if f21_local0 then + f21_local13 = -f21_local1 + if not f21_local13 then + + else + f21_local11.bottom = f21_local13 + if f21_local0 then + local f21_local14 = f21_local1 + end + f21_local11.left = f21_local14 or 0 + if f21_local0 then + f21_local13 = -f21_local1 + if not f21_local13 then + + else + f21_local11.right = f21_local13 + f21_local9( f21_local8, f21_local10, f21_local11 ) + self:animateToState( "default" ) + f21_local9 = LUI.UIImage.new() + f21_local9.id = "top" + f21_local9:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -f21_local1, + bottom = 0, + left = 0, + right = 0 + } ) + f21_local9:animateToState( "default" ) + self:addElement( f21_local9 ) + f21_local8 = nil + if not f21_local6 then + f21_local8 = LUI.UIImage.new() + f21_local8.id = "bottom" + f21_local8:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f21_local1 or 0, + left = 0, + right = 0 + } ) + f21_local8:animateToState( "default" ) + self:addElement( f21_local8 ) + end + f21_local10 = LUI.UIImage.new() + f21_local10.id = "left" + f21_local13 = f21_local10 + f21_local11 = f21_local10.registerAnimationState + local f21_local15 = "default" + local f21_local16 = { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -f21_local1 + } + if not f21_local6 then + local f21_local17 = f21_local1 + end + f21_local16.bottom = f21_local17 or 0 + f21_local16.left = -f21_local1 + f21_local16.right = 0 + f21_local11( f21_local13, f21_local15, f21_local16 ) + f21_local10:animateToState( "default" ) + self:addElement( f21_local10 ) + f21_local11 = LUI.UIImage.new() + f21_local11.id = "right" + f21_local15 = f21_local11 + f21_local13 = f21_local11.registerAnimationState + f21_local16 = "default" + local f21_local18 = { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -f21_local1 + } + if not f21_local6 then + local f21_local19 = f21_local1 + end + f21_local18.bottom = f21_local19 or 0 + f21_local18.left = 0 + f21_local18.right = f21_local1 + f21_local13( f21_local15, f21_local16, f21_local18 ) + f21_local11:animateToState( "default" ) + self:addElement( f21_local11 ) + self.colorize = function ( f22_arg0, f22_arg1, f22_arg2, f22_arg3 ) + for f22_local3, f22_local4 in ipairs( { + f21_local9, + f21_local11, + f21_local10, + f21_local8 + } ) do + f22_local4:registerAnimationState( "current", { + red = f22_arg0, + green = f22_arg1, + blue = f22_arg2, + alpha = f22_arg3 + } ) + f22_local4:animateToState( "current" ) + end + end + + self.colorize( f21_local2, f21_local3, f21_local4, f21_local5 ) + self:registerEventHandler( "updateBorderColor", function ( element, event ) + element.colorize( event.red, event.green, event.blue, event.alpha ) + end ) + return self + end + end + f21_local13 = 0 + end + end + f21_local13 = 0 +end + +function generic_drop_shadow( f24_arg0, f24_arg1 ) + local f24_local0 = f24_arg1.alpha or 0.75 + local f24_local1 = f24_arg1.offset_shadow or -8 + local self = LUI.UIElement.new() + self.id = "generic_drop_shadow" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = f24_local0 + } ) + self:animateToState( "default" ) + local f24_local3 = LUI.UIElement.new() + f24_local3.id = "container" + f24_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f24_local1, + left = 0, + right = f24_local1 + } ) + f24_local3:animateToState( "default" ) + local f24_local4 = LUI.UIImage.new() + f24_local4:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -12, + bottom = 20, + left = 0, + right = 32, + material = RegisterMaterial( "box_dropshadow_ltcap" ) + } ) + f24_local4:animateToState( "default" ) + f24_local3:addElement( f24_local4 ) + local f24_local5 = LUI.UIImage.new() + f24_local5:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -12, + bottom = 20, + left = 32, + right = -11, + material = RegisterMaterial( "box_dropshadow_hori_spacer" ) + } ) + f24_local5:animateToState( "default" ) + f24_local3:addElement( f24_local5 ) + local f24_local6 = LUI.UIImage.new() + f24_local6:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -12, + bottom = 20, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_midcap" ) + } ) + f24_local6:animateToState( "default" ) + f24_local3:addElement( f24_local6 ) + local f24_local7 = LUI.UIImage.new() + f24_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 32, + bottom = -12, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_vert_spacer" ) + } ) + f24_local7:animateToState( "default" ) + f24_local3:addElement( f24_local7 ) + local f24_local8 = LUI.UIImage.new() + f24_local8:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 32, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_rtcap" ) + } ) + f24_local8:animateToState( "default" ) + f24_local3:addElement( f24_local8 ) + self:addElement( f24_local3 ) + return self +end + +function generic_drop_shadow_withfade( f25_arg0, f25_arg1 ) + local f25_local0 = f25_arg1.alpha or 0.75 + local f25_local1 = f25_arg1.fade_height or 150 + local f25_local2 = f25_arg1.top_offset or 0 + local self = LUI.UIElement.new() + self.id = "generic_drop_shadow_withfade" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f25_local2, + bottom = 0, + left = 0, + right = 0, + alpha = f25_local0 + } ) + self:animateToState( "default" ) + local f25_local4 = LUI.UIImage.new() + f25_local4:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 32, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_rtcap" ) + } ) + f25_local4:animateToState( "default" ) + self:addElement( f25_local4 ) + local f25_local5 = LUI.UIImage.new() + f25_local5:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 32, + bottom = -f25_local1, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_vert_spacer" ) + } ) + f25_local5:animateToState( "default" ) + self:addElement( f25_local5 ) + local f25_local6 = LUI.UIImage.new() + f25_local6:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -f25_local1, + bottom = 0, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_vert_footer" ) + } ) + f25_local6:animateToState( "default" ) + self:addElement( f25_local6 ) + return self +end + +function generic_popup_message() + return { + type = "UIElement", + id = "generic_test_id", + properties = { + message_text = "message text" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = 0.85 + } + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -75, + left = -200, + right = 200, + height = 85 + } + }, + children = { + { + type = "live_dialog_popup_background" + }, + { + type = "UIText", + properties = { + text = MBh.Property( "message_text" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + } + } + } + } + } + } + } +end + +f0_local1 = function () + return { + type = "UIElement", + id = "spacer", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 12 + } + } + } +end + +f0_local2 = function ( f28_arg0, f28_arg1 ) + f28_arg0:setText( f28_arg1.message_text ) + f28_arg0:dispatchEventToRoot( { + name = "resize_popup" + } ) +end + +function generic_confirmation_popup() + return { + type = "generic_selectionList_popup", + id = "confirmation_popup_id", + properties = { + message_text_alignment = LUI.Alignment.Center, + popup_title = "", + message_text = "", + button_text = Engine.Localize( "@MENU_EXIT" ), + confirmation_action = function ( f30_arg0, f30_arg1 ) + DebugPrint( "Running generic_confirmation_popup default action" ) + end + , + callback_params = {}, + padding_top = 12, + cancel_will_close = true, + popup_childfeeder = function () + return { + { + type = "UIText", + id = "message_text_id", + properties = { + text = MBh.Property( "message_text" ), + message_text_alignment = MBh.Property( "message_text_alignment" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + left = 12, + right = -12, + alignment = MBh.Property( "message_text_alignment" ), + font = CoD.TextSettings.NormalFont.Font, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + }, + handlers = { + update_message = f0_local2 + } + }, + f0_local1(), + { + type = "UIGenericButton", + id = "exit_button_id", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = MBh.Property( "button_text" ), + confirmation_action = MBh.Property( "confirmation_action" ), + button_action_func = function ( f32_arg0, f32_arg1 ) + f32_arg0.properties:confirmation_action( f32_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f32_arg0 ) + end + , + callback_params = MBh.Property( "callback_params" ) + } + } + } + end + + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + } + } +end + +function CreatePurchasePopupRow( f33_arg0, f33_arg1, f33_arg2, f33_arg3, f33_arg4 ) + local f33_local0 = 15 + local f33_local1 = 16 + return { + type = "UIHorizontalList", + id = "yesno_message_" .. f33_arg0 .. "_hl_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 12 + f33_arg1, + right = -32, + height = CoD.TextSettings.NormalFont.Height + } + }, + children = { + { + type = "UIText", + id = "yesno_message_" .. f33_arg0 .. "_text_id", + properties = { + text = MBh.Property( f33_arg2 ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + right = -(f33_local1 + 32 + f33_local0), + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + }, + { + type = "UIElement", + id = "yesno_message_" .. f33_arg0 .. "_spacer", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = f33_local0 + } + } + }, + { + type = "UIImage", + id = "yesno_message_" .. f33_arg0 .. "_image_id", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f33_local1 * 0.5, + left = -f33_local1 * 0.5, + bottom = f33_local1 * 0.5, + right = f33_local1 * 0.5, + material = f33_arg3 + } + } + }, + { + type = "UIText", + id = "yesno_message_" .. f33_arg0 .. "_id", + properties = { + text = MBh.Property( f33_arg4 ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + right = -12, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } + } + } + } + } +end + +function YesNoFeeder( f34_arg0 ) + local f34_local0 = {} + if not f34_arg0.message_image then + f34_local0[#f34_local0 + 1] = { + type = "UIText", + id = "yesno_message_text_id", + properties = { + text = MBh.Property( "message_text" ), + message_text_alignment = MBh.Property( "message_text_alignment" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + left = 12, + right = -12, + font = CoD.TextSettings.NormalFont.Font, + alignment = MBh.Property( "message_text_alignment" ), + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + }, + handlers = { + update_message = f0_local2 + } + } + else + f34_local0[#f34_local0 + 1] = { + type = "UIElement", + id = "yesno_message_container_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 12, + right = -12, + height = 0 + } + }, + children = { + { + type = "UIImage", + id = "yesno_message_image_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = f34_arg0.message_image_top, + left = f34_arg0.message_image_left, + height = f34_arg0.message_image_height, + width = f34_arg0.message_image_width, + material = f34_arg0.message_image + } + } + } + } + } + if f34_arg0.message_text then + f34_local0[#f34_local0 + 1] = { + type = "UIText", + id = "yesno_message_text_id", + properties = { + text = MBh.Property( "message_text" ), + message_text_alignment = MBh.Property( "message_text_alignment" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 12 + f34_arg0.message_image_width + 20, + right = -12, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = MBh.Property( "message_text_alignment" ), + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + } + else + if f34_arg0.message_required_rank_image then + f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "required_rank", f34_arg0.message_image_width, "message_required_rank_text", f34_arg0.message_required_rank_image, "message_required_rank" ) + f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "current_rank", f34_arg0.message_image_width, "message_current_rank_text", f34_arg0.message_current_rank_image, "message_current_rank" ) + f34_local0[#f34_local0 + 1] = { + type = "UIElement", + id = "yesno_message_separator_container_id", + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + height = 5, + width = 300 + } + }, + children = { + { + type = "UIImage", + id = "yesno_message_separator_image_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 2, + left = 0, + height = 1, + material = RegisterMaterial( "white" ), + alpha = 0.1 + } + } + } + } + } + end + if f34_arg0.message_cost_image then + f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "cost", f34_arg0.message_image_width, "message_cost_text", f34_arg0.message_cost_image, "message_cost" ) + f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "squad_points", f34_arg0.message_image_width, "message_squad_points_text", f34_arg0.message_squad_points_image, "message_squad_points" ) + end + end + end + f34_local0[#f34_local0 + 1] = f0_local1() + if f34_arg0.yes_text then + local f34_local1 = #f34_local0 + 1 + local f34_local2 = { + type = "UIGenericButton", + id = "yes_button_id", + audio = { + button_over = CoD.SFX.SubMenuMouseOver + } + } + local f34_local3 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.YesNoPopup, + text = MBh.Property( "yes_text" ), + action = MBh.Property( "yes_action" ) + } + local f34_local4 = MBh.DoMultiple + local f34_local5 = {} + local f34_local6 = MBh.RunPropertyFunc( "action" ) + local f34_local7 = MBh.LeaveMenu() + f34_local3.button_action_func = f34_local4( f34_local6 ) + f34_local3.callback_params = MBh.Property( "callback_params" ) + f34_local2.properties = f34_local3 + f34_local0[f34_local1] = f34_local2 + end + local f34_local1 = #f34_local0 + 1 + local f34_local2 = { + type = "UIGenericButton", + id = "no_button_id", + audio = { + button_over = CoD.SFX.SubMenuMouseOver + } + } + local f34_local3 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.YesNoPopup, + text = MBh.Property( "no_text" ), + action = MBh.Property( "no_action" ) + } + local f34_local4 = MBh.DoMultiple + local f34_local5 = {} + local f34_local6 = MBh.RunPropertyFunc( "action" ) + local f34_local7 = MBh.LeaveMenu() + f34_local3.button_action_func = f34_local4( f34_local6 ) + f34_local3.callback_params = MBh.Property( "callback_params" ) + f34_local2.properties = f34_local3 + f34_local0[f34_local1] = f34_local2 + if f34_arg0.default_focus_index then + f34_local1 = assert + if f34_arg0.default_focus_index <= 0 or f34_arg0.default_focus_index > #f34_local0 then + f34_local2 = false + else + f34_local2 = true + end + f34_local1( f34_local2 ) + f34_local1 = #f34_local0 - 2 + f34_local0[#f34_local0 - 2 + f34_arg0.default_focus_index].listDefaultFocus = true + end + return f34_local0 +end + +function generic_yesno_popup() + return { + type = "generic_selectionList_popup", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + properties = { + message_text_alignment = LUI.Alignment.Center, + popup_title = "", + message_text = "", + padding_top = 12, + cancel_means_no = true, + yes_action = function ( f36_arg0, f36_arg1 ) + DebugPrint( "Running generic_confirmation_popup yes action" ) + end + , + no_action = function ( f37_arg0, f37_arg1 ) + DebugPrint( "Running generic_confirmation_popup no action" ) + end + , + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_NO" ), + callback_params = {}, + default_focus_index = 2, + popup_childfeeder = YesNoFeeder + }, + handlers = { + popup_back = function ( f38_arg0, f38_arg1 ) + if f38_arg0.properties.cancel_means_no then + f38_arg0.properties:no_action( f38_arg1 ) + end + end + , + menu_create = function ( f39_arg0, f39_arg1 ) + f39_arg0:clearSavedState() + end + + } + } +end + +function generic_yesno_with_image_popup() + return { + type = "generic_selectionList_popup", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + properties = { + message_text_alignment = LUI.Alignment.Left, + popup_title = "", + message_image = nil, + message_text = nil, + message_required_rank_text = nil, + message_required_rank_image = nil, + message_required_rank = nil, + message_current_rank_text = nil, + message_current_rank_image = nil, + message_current_rank = nil, + message_cost_text = nil, + message_cost_image = nil, + message_cost = nil, + message_squad_points_text = nil, + message_squad_points_image = nil, + message_squad_points = nil, + message_image_top = 0, + message_image_left = 5, + message_image_height = 64, + message_image_width = 64, + purchase_cost = 0, + padding_top = 20, + cancel_means_no = true, + yes_action = function ( f41_arg0, f41_arg1 ) + DebugPrint( "Running generic_confirmation_popup yes action" ) + end + , + no_action = function ( f42_arg0, f42_arg1 ) + DebugPrint( "Running generic_confirmation_popup no action" ) + end + , + yes_text = nil, + no_text = nil, + callback_params = {}, + default_focus_index = 2, + popup_childfeeder = YesNoFeeder + }, + handlers = { + popup_back = function ( f43_arg0, f43_arg1 ) + if f43_arg0.properties.cancel_means_no then + f43_arg0.properties:no_action( f43_arg1 ) + end + end + , + menu_create = function ( f44_arg0, f44_arg1 ) + f44_arg0:clearSavedState() + end + + } + } +end + +local f0_local3 = function ( f45_arg0 ) + return { + { + type = "UIGenericButton", + id = "selection_button_confirm", + properties = { + text = Engine.Localize( "@LUA_MENU_YES" ), + button_action_func = function ( f46_arg0, f46_arg1 ) + DebugPrint( "Running generic_selectionList_popup confirm/yes action" ) + LUI.FlowManager.RequestLeaveMenu( f46_arg0 ) + end + + } + }, + { + type = "UIGenericButton", + id = "selection_button_cancel", + properties = { + text = Engine.Localize( "@LUA_MENU_NO" ), + button_action_func = function ( f47_arg0, f47_arg1 ) + DebugPrint( "Running generic_selectionList_popup cancel/no action" ) + LUI.FlowManager.RequestLeaveMenu( f47_arg0 ) + end + + } + } + } +end + +local f0_local4 = function ( f48_arg0, f48_arg1, f48_arg2, f48_arg3, f48_arg4 ) + local f48_local0 = 30 + if f48_arg0:getRect() then + local f48_local1 = f48_arg1:getNumChildren() + local f48_local2 = GenericTitleBarDims.TitleBarHeight + f48_arg3 + f48_arg4 + local f48_local3 = f48_arg1:getFirstChild() + while f48_local3 do + local f48_local4 = nil + if f48_local3.getText and f48_local3:getText() then + local f48_local5 = nil + f48_local5, f48_local4 = f48_local3:getElementTextDims() + else + f48_local4 = f48_local3:getHeight() + end + end + if f48_arg0.animateIn then + f48_arg0:registerAnimationState( "initState", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -f48_arg2 / 2 - 500, + right = f48_arg2 / 2 - 500, + top = -(f48_local2 / 2 + f48_local0), + bottom = f48_local2 / 2 - f48_local0, + alpha = 0 + } ) + f48_arg0:animateToState( "initState" ) + end + f48_arg0:registerAnimationState( "newState", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -f48_arg2 / 2, + right = f48_arg2 / 2, + top = -(f48_local2 / 2 + f48_local0), + bottom = f48_local2 / 2 - f48_local0, + alpha = 1 + } ) + if f48_arg0.animateIn then + f48_arg0:animateToState( "newState", 75, false, true ) + f48_arg0.animateIn = false + else + f48_arg0:animateToState( "newState" ) + end + f48_local2 = f48_local2 + f48_local4 + f48_local3 = f48_local3:getNextSibling() + else + f48_arg0:animateToState( "start", 1 ) + end +end + +function generic_selectionList_popup( f49_arg0, f49_arg1 ) + if not f49_arg1 then + f49_arg1 = {} + end + local f49_local0 = f49_arg1.padding_bottom or 8 + local f49_local1 = f49_arg1.padding_right or 5 + local f49_local2 = f49_arg1.padding_left or 5 + local f49_local3 = f49_arg1.padding_top or 5 + local f49_local4 = f49_arg1.popup_title_alignment + if not f49_local4 then + f49_local4 = LUI.Alignment.Center + end + local f49_local5 = f49_arg1.popup_title or "popup_title property" + local f49_local6 + if f49_arg1.cancel_will_close ~= nil then + f49_local6 = f49_arg1.cancel_will_close + else + f49_local6 = true + end + local f49_local7 = CoD.TextSettings.ExtraBigFont + local f49_local8 = f49_arg1.popup_list_spacing or 0 + local f49_local9 = f49_arg1.popup_stop_background_fade_in or false + local f49_local10, f49_local11, f49_local12, f49_local13 = GetTextDimensions( f49_local5, f49_local7.Font, f49_local7.Height ) + local f49_local14 = f49_arg1.popup_width + if not f49_local14 then + f49_local14 = LUI.clamp( f49_local12 - f49_local10 + 60, 430, 1200 ) + end + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f49_local16 = LUI.UIImage.new() + f49_local16.id = "generic_selectionList_background" + local f49_local17 = f49_local16 + local f49_local18 = f49_local16.registerAnimationState + local f49_local19 = "init" + local f49_local20 = CoD.ColorizeState + local f49_local21 = Swatches.Overlay.Color + local f49_local22 = { + material = Engine.IsAliensMode() and RegisterMaterial( "box_alien_color_tint" ) or RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -200, + bottom = 200, + left = 0, + right = 0 + } + local f49_local23 + if f49_local9 then + f49_local23 = Swatches.Overlay.AlphaMore + if not f49_local23 then + + else + f49_local22.alpha = f49_local23 + f49_local18( f49_local17, f49_local19, f49_local20( f49_local21, f49_local22 ) ) + if not f49_local9 then + f49_local16:registerAnimationState( "default", CoD.ColorizeState( Swatches.Overlay.Color, { + alpha = Swatches.Overlay.AlphaMore + } ) ) + end + f49_local16:animateToState( "init" ) + if not f49_local9 then + f49_local16:animateToState( "default", 100 ) + end + self:addElement( f49_local16 ) + f49_local18 = LUI.UIElement.new() + f49_local18.id = "generic_selectionList_window_id" + f49_local18:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + left = -f49_local14 / 2, + right = f49_local14 / 2, + top = 0, + bottom = 0, + alpha = 0 + } ) + f49_local18:registerAnimationState( "start", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + left = -f49_local14 / 2, + right = f49_local14 / 2, + top = 0, + bottom = 0, + alpha = 0 + } ) + f49_local18:animateToState( "default" ) + f49_local18:animateToState( "start", 1 ) + self:addElement( f49_local18 ) + f49_local18:addElement( generic_drop_shadow( {}, { + offset_shadow = 0 + } ) ) + f49_local19 = generic_menu_background( nil, { + fill_alpha = 1 + } ) + f49_local19:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = GenericTitleBarDims.TitleBarHeight, + bottom = 0 + } ) + f49_local19:animateToState( "default" ) + f49_local18:addElement( f49_local19 ) + f49_local18:addElement( generic_menu_titlebar( nil, { + font = f49_local7, + title_bar_text = f49_local5, + title_bar_alignment = f49_local4, + fill_alpha = 1 + } ) ) + f49_local21 = LUI.UIVerticalList.new() + f49_local21.id = "generic_selectionList_content_id" + f49_local21:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = f49_local2, + right = -f49_local1, + top = GenericTitleBarDims.TitleBarHeight + f49_local3, + bottom = -f49_local0, + spacing = f49_local8 + } ) + f49_local21:animateToState( "default" ) + f49_local18:addElement( f49_local21 ) + f49_local22 = function ( f50_arg0, f50_arg1 ) + if f50_arg1.name == "menu_create" then + f50_arg0.animateIn = true + end + f0_local4( f50_arg0, f49_local21, f49_local14, f49_local3, f49_local0 ) + end + + f49_local18:addEventHandler( "menu_create", f49_local22 ) + f49_local18:addEventHandler( "resize_popup", f49_local22 ) + f49_local18:addEventHandler( "transition_complete_start", f49_local22 ) + f49_local23 = f49_arg1.popup_childfeeder or function () + return {} + end + + if type( f49_local23 ) == "table" and f49_local23.isProperty then + f49_local23 = f49_local23.func( f49_arg1 ) + end + assert( type( f49_local23 ) == "function", "Feeders must be a function or referenced by the MBh.Property helper" ) + local f49_local24 = f49_local23( f49_arg1 ) + f49_local21.childrenFeeder = f49_local23 + if f49_local24 then + LUI.MenuBuilder.buildChildren( f49_local21, f49_arg1, f49_local24 ) + end + self.addListElement = function ( f52_arg0 ) + assert( f52_arg0 ) + f49_local21:addElement( f52_arg0 ) + end + + local f49_local25 = LUI.UIBindButton.new() + f49_local25.id = "generic_selectionList_back_id" + f49_local25:registerEventHandler( "button_secondary", function ( element, event ) + self:processEvent( { + name = "popup_back", + controller = event.controller + } ) + if f49_local6 then + LUI.FlowManager.RequestLeaveMenu( element ) + end + end ) + self:addElement( f49_local25 ) + return self + end + end + f49_local23 = 0 +end + +function DebugMessageBox( f54_arg0, f54_arg1, f54_arg2, f54_arg3 ) + if not f54_arg1 or f54_arg1 == -1 then + f54_arg1 = Engine.GetFirstActiveController() + end + if not f54_arg2 then + f54_arg2 = "" + end + if not f54_arg3 then + f54_arg3 = "" + end + Engine.ExecNow( "set LUIDebugMessageBoxTitle " .. f54_arg2 ) + Engine.ExecNow( "set LUIDebugMessageBoxMessage " .. f54_arg3 ) + LUI.FlowManager.RequestPopupMenu( f54_arg0, "generic_debugMessageBox_popup", true, f54_arg1, false ) +end + +function generic_debugMessageBox_popup() + return { + type = "generic_confirmation_popup", + id = "debug_message_box_popup_id", + properties = { + popup_title = Engine.GetDvarString( "LUIDebugMessageBoxTitle" ), + message_text = Engine.GetDvarString( "LUIDebugMessageBoxMessage" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } +end + +function generic_menu_background( f56_arg0, f56_arg1 ) + if not f56_arg1 then + f56_arg1 = {} + end + local f56_local0 = f56_arg1.bottom_offset or 0 + local f56_local1 = f56_arg1.top_offset + if not f56_local1 then + f56_local1 = GenericTitleBarDims.TitleBarHeight + end + local f56_local2 = f56_arg1.fill_color + if not f56_local2 then + f56_local2 = Swatches.GenericMenu.Background + end + local f56_local3 = f56_arg1.border_color + if not f56_local3 then + f56_local3 = Swatches.GenericMenu.Border + end + local f56_local4 = f56_arg1.fill_alpha + if not f56_local4 then + f56_local4 = Swatches.GenericMenu.BackgroundAlpha + end + local f56_local5 = f56_arg1.border_alpha + if not f56_local5 then + f56_local5 = Swatches.GenericMenu.BorderAlpha + end + local f56_local6 = f56_arg1.background_image or "white" + local f56_local7 = f56_arg1.hide_bottom or false + local self = LUI.UIElement.new() + self.id = "generic_menu_background" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f56_local1, + bottom = -f56_local0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f56_local9 = LUI.UIImage.new() + f56_local9.id = "generic_menu_background_inner" + f56_local9:registerAnimationState( "default", CoD.ColorizeState( f56_local2, { + material = RegisterMaterial( f56_local6 ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 1, + bottom = -1, + left = 1, + right = -1, + alpha = f56_local4 + } ) ) + f56_local9:animateToState( "default" ) + self:addElement( f56_local9 ) + local f56_local10 = generic_border( {}, { + inner = true, + border_red = f56_local3.r, + border_green = f56_local3.g, + border_blue = f56_local3.b, + border_alpha = f56_local5, + hide_bottom = f56_local7 + } ) + f56_local10.id = "generic_menu_background_border" + self:addElement( f56_local10 ) + return self +end + +function generic_menu_background_withfade( f57_arg0, f57_arg1 ) + if not f57_arg1 then + f57_arg1 = {} + end + local f57_local0 = f57_arg1.top_offset + if not f57_local0 then + f57_local0 = GenericTitleBarDims.TitleBarHeight + end + local f57_local1 = f57_arg1.fill_color + if not f57_local1 then + f57_local1 = Swatches.GenericMenu.Background + end + local f57_local2 = f57_arg1.border_color + if not f57_local2 then + f57_local2 = Swatches.GenericMenu.Border + end + local f57_local3 = f57_arg1.fill_alpha + if not f57_local3 then + f57_local3 = Swatches.GenericMenu.BackgroundAlpha + end + local f57_local4 = f57_arg1.border_alpha + if not f57_local4 then + f57_local4 = Swatches.GenericMenu.BorderAlpha + end + local f57_local5 = f57_arg1.shadow_top_offset or 0 + local f57_local6 = f57_arg1.shadow_alpha or 0.75 + local f57_local7 = f57_arg1.hide_shadow or false + local f57_local8 = f57_arg1.fade_height or 150 + local self = LUI.UIElement.new() + self.id = "generic_menu_background_withfade" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + self:addElement( generic_menu_background( {}, { + top_offset = f57_local0, + bottom_offset = f57_local8, + fill_color = f57_local1, + border_color = f57_local2, + fill_alpha = f57_local3, + border_alpha = f57_local4, + hide_bottom = true + } ) ) + local f57_local10 = LUI.UIElement.new() + f57_local10:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -1 * (1 + f57_local8), + bottom = 0, + left = 0, + right = 0 + } ) + f57_local10:animateToState( "default" ) + local f57_local11 = LUI.UIImage.new() + f57_local11:registerAnimationState( "default", CoD.ColorizeState( f57_local2, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 1, + material = RegisterMaterial( "box_white_gradient_top" ), + alpha = f57_local4 + } ) ) + f57_local11:animateToState( "default" ) + f57_local10:addElement( f57_local11 ) + local f57_local12 = LUI.UIImage.new() + f57_local12:registerAnimationState( "default", CoD.ColorizeState( f57_local1, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 1, + right = -1, + material = RegisterMaterial( "box_white_gradient_top" ), + alpha = f57_local3 + } ) ) + f57_local12:animateToState( "default" ) + f57_local10:addElement( f57_local12 ) + local f57_local13 = LUI.UIImage.new() + f57_local13:registerAnimationState( "default", CoD.ColorizeState( f57_local2, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -1, + right = 0, + material = RegisterMaterial( "box_white_gradient_top" ), + alpha = f57_local4 + } ) ) + f57_local13:animateToState( "default" ) + f57_local10:addElement( f57_local13 ) + if not f57_local7 then + self:addElement( generic_drop_shadow_withfade( {}, { + alpha = f57_local6, + fade_height = f57_local8, + top_offset = f57_local5 + } ) ) + end + self:addElement( f57_local10 ) + return self +end + +function generic_menu_titlebar_background( f58_arg0, f58_arg1 ) + if not f58_arg1 then + f58_arg1 = {} + end + local f58_local0 = f58_arg1.fill_color + if not f58_local0 then + f58_local0 = Swatches.GenericMenu.Background + end + local f58_local1 = f58_arg1.border_color + if not f58_local1 then + f58_local1 = Swatches.GenericMenu.Border + end + local f58_local2 = f58_arg1.fill_alpha + if not f58_local2 then + f58_local2 = Swatches.GenericMenu.BackgroundAlpha + end + local f58_local3 = f58_arg1.border_alpha + if not f58_local3 then + f58_local3 = Swatches.GenericMenu.BorderAlpha + end + local f58_local4 = f58_arg1.reversed or false + local self = LUI.UIElement.new() + self.id = "generic_menu_titlebar_background_id" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = GenericTitleBarDims.TitleBarHeight, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f58_local6 = LUI.UIImage.new() + f58_local6.id = "cap_fill" + local f58_local7 = f58_local6 + local f58_local8 = f58_local6.registerAnimationState + local f58_local9 = "default" + local f58_local10 = CoD.ColorizeState + local f58_local11 = f58_local0 + local f58_local12 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = not f58_local4, + rightAnchor = f58_local4, + top = 0, + bottom = 0 + } + local f58_local13 + if f58_local4 then + f58_local13 = -GenericTitleBarDims.TitleBarLCapWidth + if not f58_local13 then + + else + f58_local12.left = f58_local13 + if f58_local4 then + f58_local13 = 0 + if not f58_local13 then + + else + f58_local12.right = f58_local13 + if f58_local4 then + f58_local13 = RegisterMaterial( "box_titlebar_rightcap" ) + if not f58_local13 then + + else + f58_local12.material = f58_local13 + f58_local12.alpha = f58_local2 + f58_local8( f58_local7, f58_local9, f58_local10( f58_local11, f58_local12 ) ) + f58_local6:animateToState( "default" ) + self:addElement( f58_local6 ) + f58_local8 = LUI.UIImage.new() + f58_local8.id = "body_fill" + f58_local9 = f58_local8 + f58_local7 = f58_local8.registerAnimationState + f58_local10 = "default" + f58_local11 = CoD.ColorizeState + f58_local12 = f58_local0 + f58_local13 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 1, + bottom = 0 + } + local f58_local14 + if f58_local4 then + f58_local14 = -1 + if not f58_local14 then + + else + f58_local13.left = f58_local14 + if f58_local4 then + f58_local14 = -GenericTitleBarDims.TitleBarLCapWidth + if not f58_local14 then + + else + f58_local13.right = f58_local14 + f58_local13.material = RegisterMaterial( "white" ) + f58_local13.alpha = f58_local2 + f58_local7( f58_local9, f58_local10, f58_local11( f58_local12, f58_local13 ) ) + f58_local8:animateToState( "default" ) + self:addElement( f58_local8 ) + f58_local7 = LUI.UIImage.new() + f58_local7.id = "cap_border" + f58_local10 = f58_local7 + f58_local9 = f58_local7.registerAnimationState + f58_local11 = "default" + f58_local12 = CoD.ColorizeState + f58_local13 = f58_local1 + f58_local14 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = not f58_local4, + rightAnchor = f58_local4, + top = 0, + bottom = 0 + } + local f58_local15 + if f58_local4 then + f58_local15 = -GenericTitleBarDims.TitleBarLCapWidth + if not f58_local15 then + + else + f58_local14.left = f58_local15 + if f58_local4 then + f58_local15 = 0 + if not f58_local15 then + + else + f58_local14.right = f58_local15 + if f58_local4 then + f58_local15 = RegisterMaterial( "box_titlebar_rightcap_border" ) + if not f58_local15 then + + else + f58_local14.material = f58_local15 + f58_local14.alpha = f58_local3 + f58_local9( f58_local10, f58_local11, f58_local12( f58_local13, f58_local14 ) ) + f58_local7:animateToState( "default" ) + self:addElement( f58_local7 ) + f58_local9 = LUI.UIImage.new() + f58_local9.id = "end_border" + f58_local11 = f58_local9 + f58_local10 = f58_local9.registerAnimationState + f58_local12 = "default" + f58_local13 = CoD.ColorizeState + f58_local14 = f58_local1 + f58_local15 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = f58_local4, + rightAnchor = not f58_local4, + top = 0, + bottom = 0 + } + local f58_local16 + if f58_local4 then + f58_local16 = 0 + if not f58_local16 then + + else + f58_local15.left = f58_local16 + if f58_local4 then + f58_local16 = 1 + if not f58_local16 then + + else + f58_local15.right = f58_local16 + f58_local15.material = RegisterMaterial( "white" ) + f58_local15.alpha = f58_local3 + f58_local10( f58_local11, f58_local12, f58_local13( f58_local14, f58_local15 ) ) + f58_local9:animateToState( "default" ) + self:addElement( f58_local9 ) + f58_local10 = LUI.UIImage.new() + f58_local10.id = "top_border" + f58_local12 = f58_local10 + f58_local11 = f58_local10.registerAnimationState + f58_local13 = "default" + f58_local14 = CoD.ColorizeState + f58_local15 = f58_local1 + f58_local16 = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 1 + } + local f58_local17 + if f58_local4 then + f58_local17 = 1 + if not f58_local17 then + + else + f58_local16.left = f58_local17 + if f58_local4 then + f58_local17 = -GenericTitleBarDims.TitleBarLCapWidth + if not f58_local17 then + + else + f58_local16.right = f58_local17 + f58_local16.material = RegisterMaterial( "white" ) + f58_local16.alpha = f58_local3 + f58_local11( f58_local12, f58_local13, f58_local14( f58_local15, f58_local16 ) ) + f58_local10:animateToState( "default" ) + self:addElement( f58_local10 ) + return self + end + end + f58_local17 = -1 + end + end + f58_local17 = GenericTitleBarDims.TitleBarLCapWidth + end + end + f58_local16 = 0 + end + end + f58_local16 = -1 + end + end + f58_local15 = RegisterMaterial( "box_titlebar_leftcap_border" ) + end + end + f58_local15 = GenericTitleBarDims.TitleBarLCapWidth + end + end + f58_local15 = 0 + end + end + f58_local14 = -1 + end + end + f58_local14 = GenericTitleBarDims.TitleBarLCapWidth + end + end + f58_local13 = RegisterMaterial( "box_titlebar_leftcap" ) + end + end + f58_local13 = GenericTitleBarDims.TitleBarLCapWidth + end + end + f58_local13 = 0 +end + +local f0_local5 = function ( f59_arg0, f59_arg1 ) + f59_arg0:setText( f59_arg1.title_text ) +end + +function generic_menu_titlebar( f60_arg0, f60_arg1 ) + local f60_local0 = f60_arg1.title_bar_text_indent or 0 + local f60_local1 = f60_arg1.title_bar_alignment + if not f60_local1 then + f60_local1 = LUI.Alignment.Center + end + local f60_local2 = f60_arg1.title_bar_text or "" + local f60_local3 = generic_menu_titlebar_background( nil, f60_arg1 ) + local f60_local4 = f60_arg1.font + if not f60_local4 then + f60_local4 = CoD.TextSettings.ExtraBigFont + end + local f60_local5 = f60_arg1.vertOffset or 1 + local f60_local6 = f60_arg1.marquee and LUI.UIMarqueeText.new() or LUI.UIText.new() + f60_local6.id = "title" + f60_local6:setText( f60_local2 ) + f60_local6:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -f60_local4.Height / 2 + f60_local5, + height = f60_local4.Height, + left = f60_local0, + right = 0, + font = f60_local4.Font, + alignment = f60_local1 + } ) + f60_local6:animateToState( "default" ) + f60_local6:registerEventHandler( "update_title", f0_local5 ) + f60_local3:addElement( f60_local6 ) + return f60_local3 +end + +function RefreshScrollList( f61_arg0, f61_arg1 ) + f61_arg0:closeChildren() + f61_arg0:clearSavedState() + f61_arg0:processEvent( { + name = "menu_refresh" + } ) +end + +function generic_loading_widget( f62_arg0, f62_arg1 ) + if not f62_arg1 then + f62_arg1 = {} + end + local f62_local0 = f62_arg1.indent or 15 + local f62_local1 = f62_arg1.message or "" + local self = LUI.UIElement.new() + self.id = "generic_loading_widget" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f62_local3 = LUI.UIHorizontalList.new() + f62_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alignment = LUI.Alignment.Center, + spacing = f62_local0 + } ) + f62_local3:animateToState( "default" ) + self:addElement( f62_local3 ) + local f62_local4 = LUI.MenuBuilder.BuildAddChild( f62_local3, { + type = "live_dialog_processing_widget" + } ) + if #f62_local1 > 0 then + local f62_local5, f62_local6, f62_local7, f62_local8 = GetTextDimensions( f62_local1, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f62_local9 = LUI.UIText.new() + f62_local9:setText( f62_local1 ) + f62_local9:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -CoD.TextSettings.NormalFont.Height / 2, + bottom = CoD.TextSettings.NormalFont.Height / 2, + left = 0, + right = f62_local7 - f62_local5 + } ) + f62_local9:animateToState( "default" ) + f62_local3:addElement( f62_local9 ) + end + return self +end + +function generic_separator( menu, controller ) + local self = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = 12 + } ) + self.id = "generic_spacer_id" + local f63_local1 = LUI.UIImage.new( { + material = RegisterMaterial( "box_white_gradient_fade_rt" ), + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + right = -GenericButtonSettings.Styles.GradientButton.focus_animation_distance - 7, + top = 2, + left = 0, + height = 2, + alpha = 0.15 + } ) + f63_local1.id = "generic_spacer_image_id" + self:addElement( f63_local1 ) + return self +end + +if Engine.InFrontend() then + LUI.MenuBuilder.registerDef( "generic_input_field", generic_input_field ) +end +LUI.MenuBuilder.registerDef( "generic_debugMessageBox_popup", generic_debugMessageBox_popup ) +LUI.MenuBuilder.registerDef( "generic_header", left_header ) +LUI.MenuBuilder.registerType( "generic_menu_title", generic_menu_title ) +LUI.MenuBuilder.registerType( "generic_border", generic_border ) +LUI.MenuBuilder.registerType( "generic_drop_shadow", generic_drop_shadow ) +LUI.MenuBuilder.registerType( "generic_drop_shadow_withfade", generic_drop_shadow_withfade ) +LUI.MenuBuilder.registerType( "generic_back_button", generic_back_button ) +LUI.MenuBuilder.registerDef( "left_header", left_header ) +LUI.MenuBuilder.registerDef( "generic_popup_message", generic_popup_message ) +LUI.MenuBuilder.registerDef( "generic_confirmation_popup", generic_confirmation_popup ) +LUI.MenuBuilder.registerDef( "generic_yesno_popup", generic_yesno_popup ) +LUI.MenuBuilder.registerDef( "generic_yesno_with_image_popup", generic_yesno_with_image_popup ) +LUI.MenuBuilder.registerType( "generic_menu_background", generic_menu_background ) +LUI.MenuBuilder.registerType( "generic_menu_background_withfade", generic_menu_background_withfade ) +LUI.MenuBuilder.registerType( "generic_menu_titlebar", generic_menu_titlebar ) +LUI.MenuBuilder.registerType( "generic_selectionList_popup", generic_selectionList_popup ) +LUI.MenuBuilder.registerType( "generic_loading_widget", generic_loading_widget ) +LUI.MenuBuilder.registerType( "generic_separator", generic_separator ) +LockTable( _M ) diff --git a/lui/movementcontrols.dec.lua b/lui/movementcontrols.dec.lua new file mode 100644 index 0000000..78b42ec --- /dev/null +++ b/lui/movementcontrols.dec.lua @@ -0,0 +1,164 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetDisplay( f1_arg0 ) + return Engine.GetBinding( f1_arg0 ) +end + +function bindKey( f2_arg0 ) + Engine.BindKey( f2_arg0 ) +end + +function OptionsWindowRefresh( f3_arg0, f3_arg1 ) + if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then + f3_arg0:processEvent( { + name = "menu_refresh" + } ) + f3_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function ControlBindFactory( f5_arg0, f5_arg1 ) + return { + type = "UIGenericButton", + id = "bind_" .. f5_arg1, + disabledFunc = shouldBeDisabledFunc or function () + return false + end + , + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f5_arg0 ), + button_display_func = function ( f7_arg0, f7_arg1 ) + return GetDisplay( f5_arg1 ) + end + , + button_action_func = function ( f8_arg0, f8_arg1 ) + Engine.BindKey( f5_arg1 ) + OptionsWindowTriggerRefresh( f8_arg0, f8_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionsFeeder( f9_arg0 ) + local f9_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_FORWARD", "+forward" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_BACK", "+back" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_LEFT", "+moveleft" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_RIGHT", "+moveright" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_STANDJUMP", "+gostand" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_CROUCH", "+togglecrouch" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_PRONE", "toggleprone" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_SPRINT_HOLD_BREATH", "+breath_sprint" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_DOWN_CROUCH", "+movedown" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_DOWN_PRONE", "+prone" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_CHANGE_STANCE", "+stance" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_SPRINT", "+sprint" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_BREATH", "+holdbreath" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_TURN_LEFT", "+left" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_TURN_RIGHT", "+right" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_STRAFE", "+strafe" ) + return f9_local0 +end + +function OptionsMainCreate( f10_arg0, f10_arg1 ) + f10_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function movement_vlist() + return { + type = "UIScrollingVerticalList", + childrenFeeder = OptionsFeeder, + properties = { + use_arrows = true, + sendScrollEvents = true, + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = OptionsListDims.menu_top, + bottom = OptionsListDims.menu_bottom, + left = OptionsListDims.menu_left, + right = OptionsListDims.menu_right + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function movement_controls() + return { + type = "UIElement", + id = "movement_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = function ( f13_arg0, f13_arg1 ) + Engine.Exec( "updategamerprofile" ) + end + + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_MOVEMENT" ) + } + }, + { + type = "movement_vlist", + id = "movement_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "movement_vlist", movement_vlist ) +LUI.MenuBuilder.registerDef( "movement_controls", movement_controls ) +LockTable( _M ) diff --git a/lui/mp_hud/a10overlayhud.dec.lua b/lui/mp_hud/a10overlayhud.dec.lua new file mode 100644 index 0000000..1599c2e --- /dev/null +++ b/lui/mp_hud/a10overlayhud.dec.lua @@ -0,0 +1,801 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = Engine.Localize( "@LUA_MENU_A10_ALT_LABEL" ) +f0_local1 = Engine.Localize( "@LUA_MENU_A10_CANNON_LABEL" ) +f0_local2 = Engine.Localize( "@LUA_MENU_A10_ROCKET_LABEL" ) +local f0_local3 = "@PLATFORM_A10_CANNON_FIRE" +local f0_local4 = "@PLATFORM_A10_ROCKET_FIRE" +local f0_local5 = function ( f1_arg0, f1_arg1 ) + if f1_arg1.value then + f1_arg0:animateToState( "active", 0 ) + local f1_local0 = f1_arg0:getChildById( "reticleImageId" ) + local f1_local1 = f1_arg0:getChildById( "altitudeBackID" ) + local f1_local2 = f1_arg0:getChildById( "speedBackID" ) + local f1_local3 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 0 + } + } ) + f1_local3( f1_local0 ) + f1_local3( f1_local1 ) + f1_local3( f1_local2 ) + else + f1_arg0:animateToState( "default", 0 ) + end +end + +local f0_local6 = function ( f2_arg0, f2_arg1, f2_arg2 ) + if f2_arg2 then + if f2_arg0.current_state ~= "flashing" then + f2_arg0.current_state = "flashing" + f2_arg0:processEvent( { + name = "flashing" + } ) + end + elseif f2_arg0.current_state ~= nil then + f2_arg0.current_state = nil + f2_arg0:animateToState( "default", 0 ) + end +end + +local f0_local7 = function ( f3_arg0, f3_arg1 ) + f3_arg0:setText( f3_arg1.value ) + f0_local6( f3_arg0, f3_arg1, f3_arg1.value <= 0 ) +end + +local f0_local8 = function ( f4_arg0, f4_arg1 ) + f4_arg0:setText( f4_arg1.value ) +end + +local f0_local9 = function ( f5_arg0, f5_arg1 ) + f0_local6( f5_arg0, f5_arg1, f5_arg1.value ) +end + +local f0_local10 = function ( f6_arg0, f6_arg1 ) + if f6_arg1.value then + f6_arg0:animateToState( "locked", 0 ) + else + f6_arg0:animateToState( "active", 0 ) + end +end + +local f0_local11 = function () + return { + type = "UIElement", + id = "a10OverlayContainer", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + }, + active = { + alpha = 1 + } + }, + handlers = { + init_overlay = f0_local5, + omnvar_update = { + ui_a10 = f0_local5 + } + }, + children = { + { + type = "reticleImageDef" + }, + { + type = "a10CannonAmmoDef" + }, + { + type = "a10RocketAmmoDef" + }, + { + type = "a10AltimeterDef" + }, + { + type = "altitudeBackDef" + }, + { + type = "speedBackDef" + }, + { + type = "a10MissileHintDef" + }, + { + type = "a10CannonHintDef" + } + } + } +end + +local f0_local12 = function () + local f8_local0 = RegisterMaterial( "ca_a10_altitude_back_mp" ) + local f8_local1 = 512 + local f8_local2 = 128 + local f8_local3 = -320 + local f8_local4 = -448 + return { + type = "UIImage", + id = "altitudeBackID", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f8_local3 * 0.25, + left = f8_local4 * 0.25, + bottom = (f8_local3 + f8_local1) * 0.25, + right = (f8_local4 + f8_local2) * 0.25, + material = f8_local0, + alpha = 0 + }, + opening = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f8_local3 * 0.5, + left = f8_local4 * 0.5, + bottom = (f8_local3 + f8_local1) * 0.5, + right = (f8_local4 + f8_local2) * 0.5, + alpha = 0.5 + }, + active = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f8_local3, + left = f8_local4, + bottom = f8_local3 + f8_local1, + right = f8_local4 + f8_local2, + red = 0, + green = 1, + blue = 0, + alpha = 1 + } + }, + handlers = {} + } +end + +local f0_local13 = function () + local f9_local0 = RegisterMaterial( "ca_a10_speed_back_mp" ) + local f9_local1 = 512 + local f9_local2 = 128 + local f9_local3 = -320 + local f9_local4 = 448 + return { + type = "UIImage", + id = "speedBackID", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f9_local3 * 0.25, + left = (f9_local4 - f9_local2) * 0.25, + bottom = (f9_local3 + f9_local1) * 0.25, + right = f9_local4 * 0.25, + material = f9_local0, + alpha = 0 + }, + opening = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f9_local3 * 0.5, + left = (f9_local4 - f9_local2) * 0.5, + bottom = (f9_local3 + f9_local1) * 0.5, + right = f9_local4 * 0.5, + alpha = 0.5 + }, + active = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f9_local3, + left = f9_local4 - f9_local2, + bottom = f9_local3 + f9_local1, + right = f9_local4, + red = 0, + green = 1, + blue = 0, + alpha = 1 + } + }, + handlers = {} + } +end + +local f0_local14 = function () + local f10_local0 = RegisterMaterial( "ca_a10_left_strip_mp" ) + local f10_local1 = 256 + local f10_local2 = 64 + local f10_local3 = -128 + local f10_local4 = -128 + return { + type = "UIImage", + id = "leftHashMarksID", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f10_local3 * 0.25, + left = f10_local4 * 0.25, + bottom = (f10_local3 + f10_local1) * 0.25, + right = (f10_local4 + f10_local2) * 0.25, + material = f10_local0, + alpha = 0 + }, + opening = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f10_local3 * 0.5, + left = f10_local4 * 0.5, + bottom = (f10_local3 + f10_local1) * 0.5, + right = (f10_local4 + f10_local2) * 0.5, + alpha = 0.5 + }, + active = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f10_local3, + left = f10_local4, + bottom = f10_local3 + f10_local1, + right = f10_local4 + f10_local2, + red = 0, + green = 1, + blue = 0, + alpha = 1 + } + }, + handlers = {} + } +end + +local f0_local15 = function () + local f11_local0 = RegisterMaterial( "ca_a10_right_strip_mp" ) + local f11_local1 = 256 + local f11_local2 = 64 + local f11_local3 = -128 + local f11_local4 = 128 + return { + type = "UIImage", + id = "rightHashMarksID", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f11_local3 * 0.25, + left = (f11_local4 - f11_local2) * 0.25, + bottom = (f11_local3 + f11_local1) * 0.25, + right = f11_local4 * 0.25, + material = f11_local0, + alpha = 0 + }, + opening = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f11_local3 * 0.5, + left = (f11_local4 - f11_local2) * 0.5, + bottom = (f11_local3 + f11_local1) * 0.5, + right = f11_local4 * 0.5, + alpha = 0.5 + }, + active = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f11_local3, + left = f11_local4 - f11_local2, + bottom = f11_local3 + f11_local1, + right = f11_local4, + red = 0, + green = 1, + blue = 0, + alpha = 1 + } + }, + handlers = {} + } +end + +local f0_local16 = function () + local f12_local0 = RegisterMaterial( "ca_a10_reticle_mp" ) + local f12_local1 = 64 + local f12_local2 = 64 + local f12_local3 = -64 + local f12_local4 = -32 + return { + type = "UIImage", + id = "reticleImageId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f12_local3 + f12_local1 * 0.5, + left = f12_local4 + f12_local2 * 0.5, + bottom = f12_local4 + f12_local2 * 0.5, + right = f12_local3 + f12_local1 * 0.5, + material = f12_local0, + alpha = 0 + }, + opening = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f12_local3 + f12_local1 * 0.5 - 20, + left = f12_local4 + f12_local2 * 0.5 - 20, + bottom = f12_local3 + f12_local1 * 0.5 + 20, + right = f12_local4 + f12_local2 * 0.5 + 20, + alpha = 0.5 + }, + active = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f12_local3, + left = f12_local4, + bottom = f12_local3 + f12_local1, + right = f12_local4 + f12_local2, + red = 0, + green = 1, + blue = 0, + alpha = 1 + }, + locked = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f12_local3, + left = f12_local4, + bottom = f12_local3 + f12_local1, + right = f12_local4 + f12_local2, + red = 1, + green = 0, + blue = 0, + alpha = 1 + } + }, + handlers = { + omnvar_update = { + ui_a10_rocket_lock = f0_local10 + } + } + } +end + +local f0_local17 = function () + return { + type = "UIVerticalList", + id = "a10CannonAmmoId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 64, + right = 488, + height = 128, + width = 128, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "a10CannonLabelId", + properties = { + text = f0_local1, + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "a10CannonCounterId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 0, + blue = 0, + alpha = 0.25 + } + }, + handlers = { + omnvar_update = { + ui_a10_cannon = f0_local7 + }, + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) + } + } + } + } +end + +local f0_local18 = function () + local f14_local0 = 0 + local f14_local1 = 100 + return { + type = "UIText", + id = "a10CannonHelpTextId", + properties = { + text = Engine.Localize( f0_local3 ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f14_local0, + left = f14_local1, + bottom = f14_local0 + CoD.TextSettings.HudEuroMedSmallFont.Height, + right = f14_local1 + 200, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + } +end + +local f0_local19 = function () + local f15_local0 = 0 + local f15_local1 = -100 + return { + type = "UIText", + id = "a10RocketHelpTextId", + properties = { + text = Engine.Localize( f0_local4 ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f15_local0, + left = f15_local1 - 200, + bottom = f15_local0 + CoD.TextSettings.HudEuroMedSmallFont.Height, + right = f15_local1, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 1, + alignment = LUI.Alignment.Right + } + } + } +end + +local f0_local20 = function () + return { + type = "UIVerticalList", + id = "a10RocketAmmoId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 64, + left = -488, + height = 128, + width = 128, + spacing = 0, + alignment = LUI.Alignment.Right + } + }, + children = { + { + type = "UIText", + id = "a10RocketLabelId", + properties = { + text = f0_local2, + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Right + } + } + }, + { + type = "UIText", + id = "a10RocketCounterId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Right + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 0, + blue = 0, + alpha = 0.25 + } + }, + handlers = { + omnvar_update = { + ui_a10_rocket = f0_local7 + }, + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) + } + } + } + } +end + +local f0_local21 = function () + return { + type = "UIVerticalList", + id = "a10AltimeterId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -128, + right = 488, + height = 128, + width = 128, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "a10AltimeterLabelId", + properties = { + text = f0_local0, + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 0, + blue = 0, + alpha = 0.25 + } + }, + handlers = { + omnvar_update = { + ui_a10_alt_warn = f0_local9 + }, + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) + } + }, + { + type = "UIText", + id = "a10AltimeterCounterId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 0, + blue = 0, + alpha = 0.25 + } + }, + handlers = { + omnvar_update = { + ui_a10_alt = f0_local8, + ui_a10_alt_warn = f0_local9 + }, + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "a10OverlayDef", f0_local11 ) +LUI.MenuBuilder.registerDef( "reticleImageDef", f0_local16 ) +LUI.MenuBuilder.registerDef( "altitudeBackDef", f0_local12 ) +LUI.MenuBuilder.registerDef( "speedBackDef", f0_local13 ) +LUI.MenuBuilder.registerDef( "leftHashMarksDef", f0_local14 ) +LUI.MenuBuilder.registerDef( "rightHashMarksDef", f0_local15 ) +LUI.MenuBuilder.registerDef( "a10CannonAmmoDef", f0_local17 ) +LUI.MenuBuilder.registerDef( "a10RocketAmmoDef", f0_local20 ) +LUI.MenuBuilder.registerDef( "a10AltimeterDef", f0_local21 ) +LUI.MenuBuilder.registerDef( "a10CannonHintDef", f0_local18 ) +LUI.MenuBuilder.registerDef( "a10MissileHintDef", f0_local19 ) +LockTable( _M ) diff --git a/lui/mp_hud/ac130overlayhud.dec.lua b/lui/mp_hud/ac130overlayhud.dec.lua new file mode 100644 index 0000000..f3df264 --- /dev/null +++ b/lui/mp_hud/ac130overlayhud.dec.lua @@ -0,0 +1,1244 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = f1_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f1_local1 = f1_local0:getChildById( "ac130OverlaysContainerId" ) + local f1_local2 = f1_local1:getChildById( "ac130Overlay105mmId" ) + local f1_local3 = f1_local1:getChildById( "ac130Overlay40mmId" ) + local f1_local4 = f1_local1:getChildById( "ac130Overlay25mmId" ) + local f1_local5 = f1_local0:getChildById( "ac130OverlayReloadingTextId" ) + local f1_local6 = f1_local0:getChildById( "ac130OverlayWeaponTextListId" ) + local f1_local7 = f1_local6:getChildById( "ac130Overlay105mmTextId" ) + local f1_local8 = f1_local6:getChildById( "ac130Overlay40mmTextId" ) + local f1_local9 = f1_local6:getChildById( "ac130Overlay25mmTextId" ) + if f1_arg1.value == 0 then + f1_local2:animateToState( "active", 0 ) + f1_local3:animateToState( "default", 0 ) + f1_local4:animateToState( "default", 0 ) + f1_local7:processEvent( { + name = "flashing" + } ) + f1_local8:processEvent( { + name = "stop_flashing" + } ) + f1_local9:processEvent( { + name = "stop_flashing" + } ) + if 0 < Game.GetOmnvar( "ui_ac130_105mm_ammo" ) then + f1_local5:processEvent( { + name = "stop_flashing" + } ) + else + f1_local5:processEvent( { + name = "flashing" + } ) + end + elseif f1_arg1.value == 1 then + f1_local2:animateToState( "default", 0 ) + f1_local3:animateToState( "active", 0 ) + f1_local4:animateToState( "default", 0 ) + f1_local7:processEvent( { + name = "stop_flashing" + } ) + f1_local8:processEvent( { + name = "flashing" + } ) + f1_local9:processEvent( { + name = "stop_flashing" + } ) + if 0 < Game.GetOmnvar( "ui_ac130_40mm_ammo" ) then + f1_local5:processEvent( { + name = "stop_flashing" + } ) + else + f1_local5:processEvent( { + name = "flashing" + } ) + end + elseif f1_arg1.value == 2 then + f1_local2:animateToState( "default", 0 ) + f1_local3:animateToState( "default", 0 ) + f1_local4:animateToState( "active", 0 ) + f1_local7:processEvent( { + name = "stop_flashing" + } ) + f1_local8:processEvent( { + name = "stop_flashing" + } ) + f1_local9:processEvent( { + name = "flashing" + } ) + if 0 < Game.GetOmnvar( "ui_ac130_25mm_ammo" ) then + f1_local5:processEvent( { + name = "stop_flashing" + } ) + else + f1_local5:processEvent( { + name = "flashing" + } ) + end + end +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f2_local1 = f2_local0:getChildById( "ac130OverlayWeaponTextListId" ) + local f2_local2 = f2_local0:getChildById( "ac130OverlayAmmoTextListId" ) + local f2_local3 = f2_local2:getChildById( "ac130Overlay105mmAmmoTextId" ) + local f2_local4 = f2_local0:getChildById( "ac130OverlayReloadingTextId" ) + local f2_local5 = f2_arg1.value + f2_local3:setText( f2_local5 .. ":1" ) + if f2_local5 > 0 then + if f2_local3.current_state ~= "default" then + f2_local3.current_state = "default" + f2_local3:processEvent( { + name = "stop_flashing" + } ) + f2_local4:processEvent( { + name = "stop_flashing" + } ) + end + elseif f2_local3.current_state ~= "flashing" then + f2_local3.current_state = "flashing" + f2_local3:processEvent( { + name = "flashing" + } ) + f2_local4:processEvent( { + name = "flashing" + } ) + end +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f3_local1 = f3_local0:getChildById( "ac130OverlayWeaponTextListId" ) + local f3_local2 = f3_local0:getChildById( "ac130OverlayAmmoTextListId" ) + local f3_local3 = f3_local2:getChildById( "ac130Overlay40mmAmmoTextId" ) + local f3_local4 = f3_local0:getChildById( "ac130OverlayReloadingTextId" ) + local f3_local5 = f3_arg1.value + f3_local3:setText( f3_local5 .. ":4" ) + if f3_local5 > 0 then + if f3_local3.current_state ~= "default" then + f3_local3.current_state = "default" + f3_local3:processEvent( { + name = "stop_flashing" + } ) + f3_local4:processEvent( { + name = "stop_flashing" + } ) + end + elseif f3_local3.current_state ~= "flashing" then + f3_local3.current_state = "flashing" + f3_local3:processEvent( { + name = "flashing" + } ) + f3_local4:processEvent( { + name = "flashing" + } ) + end +end + +local f0_local3 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f4_local1 = f4_local0:getChildById( "ac130OverlayWeaponTextListId" ) + local f4_local2 = f4_local0:getChildById( "ac130OverlayAmmoTextListId" ) + local f4_local3 = f4_local2:getChildById( "ac130Overlay25mmAmmoTextId" ) + local f4_local4 = f4_local0:getChildById( "ac130OverlayReloadingTextId" ) + local f4_local5 = f4_arg1.value + f4_local3:setText( f4_local5 .. ":20" ) + if f4_local5 > 0 then + if f4_local3.current_state ~= "default" then + f4_local3.current_state = "default" + f4_local3:processEvent( { + name = "stop_flashing" + } ) + f4_local4:processEvent( { + name = "stop_flashing" + } ) + end + elseif f4_local3.current_state ~= "flashing" then + f4_local3.current_state = "flashing" + f4_local3:processEvent( { + name = "flashing" + } ) + f4_local4:processEvent( { + name = "flashing" + } ) + end +end + +local f0_local4 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f5_local1 = f5_local0:getChildById( "ac130OverlayToggleTextListId" ) + local f5_local2 = f5_local1:getChildById( "ac130OverlayTimerTextId" ) + f5_local2:setEndTime( f5_arg1.value ) +end + +local f0_local5 = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f6_local1 = f6_local0:getChildById( "ac130OverlayOpticsTextId" ) + local f6_local2 = f6_local0:getChildById( "ac130OverlayFLIRTextId" ) + if f6_arg1.value == 0 then + f6_local1:animateToState( "active", 250 ) + f6_local2:animateToState( "inactive", 250 ) + else + f6_local1:animateToState( "inactive", 250 ) + f6_local2:animateToState( "active", 250 ) + end +end + +local f0_local6 = function ( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f7_local1 = f7_local0:getChildById( "ac130OverlayPlaneModelCoordsListId" ) + local f7_local2 = f7_local1:getChildById( "ac130OverlayPlaneModelCoordsXId" ) + local f7_local3 = f7_local1:getChildById( "ac130OverlayPlaneModelCoordsYId" ) + local f7_local4 = f7_local1:getChildById( "ac130OverlayPlaneModelCoordsZId" ) + local f7_local5 = Game.GetOmnvar( "ui_ac130_coord1_posx" ) + local f7_local6 = Game.GetOmnvar( "ui_ac130_coord1_posy" ) + local f7_local7 = Game.GetOmnvar( "ui_ac130_coord1_posz" ) + f7_local2:setText( f7_local5 ) + f7_local3:setText( f7_local6 ) + f7_local4:setText( f7_local7 ) +end + +local f0_local7 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = f8_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f8_local1 = f8_local0:getChildById( "ac130OverlayPlayerPositionCoordsListId" ) + local f8_local2 = f8_local1:getChildById( "ac130OverlayPlayerPositionCoordsXId" ) + local f8_local3 = f8_local1:getChildById( "ac130OverlayPlayerPositionCoordsYId" ) + local f8_local4 = f8_local1:getChildById( "ac130OverlayPlayerPositionCoordsZId" ) + local f8_local5 = Game.GetOmnvar( "ui_ac130_coord2_posx" ) + local f8_local6 = Game.GetOmnvar( "ui_ac130_coord2_posy" ) + local f8_local7 = Game.GetOmnvar( "ui_ac130_coord2_posz" ) + f8_local2:setText( f8_local5 ) + f8_local3:setText( f8_local6 ) + f8_local4:setText( f8_local7 ) +end + +local f0_local8 = function ( f9_arg0, f9_arg1 ) + local f9_local0 = f9_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f9_local1 = f9_local0:getChildById( "ac130OverlayAimingCoordsListId" ) + local f9_local2 = f9_local1:getChildById( "ac130OverlayAimingCoordsXId" ) + local f9_local3 = f9_local1:getChildById( "ac130OverlayAimingCoordsYId" ) + local f9_local4 = f9_local1:getChildById( "ac130OverlayAimingCoordsZId" ) + local f9_local5 = Game.GetOmnvar( "ui_ac130_coord3_posx" ) + local f9_local6 = Game.GetOmnvar( "ui_ac130_coord3_posy" ) + local f9_local7 = Game.GetOmnvar( "ui_ac130_coord3_posz" ) + f9_local2:setText( f9_local5 ) + f9_local3:setText( f9_local6 ) + f9_local4:setText( f9_local7 ) +end + +local f0_local9 = function ( f10_arg0, f10_arg1 ) + if f10_arg1.value then + local f10_local0 = f10_arg0:getChildById( "ac130OverlayDarkenImageId" ) + f10_local0:processEvent( { + name = "darken" + } ) + end +end + +local f0_local10 = function () + return { + type = "UIElement", + id = "ac130OverlayContainerId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } + }, + handlers = { + dvar_update = { + ui_ac130_thermal = f0_local5 + }, + omnvar_update = { + ui_ac130_weapon = f0_local0, + ui_ac130_105mm_ammo = f0_local1, + ui_ac130_40mm_ammo = f0_local2, + ui_ac130_25mm_ammo = f0_local3, + ui_ac130_use_time = f0_local4, + ui_ac130_coord1_posx = f0_local6, + ui_ac130_coord2_posx = f0_local7, + ui_ac130_coord3_posx = f0_local8, + ui_ac130_darken = f0_local9 + } + }, + children = { + { + type = "ac130OverlayDarkenImageDef" + }, + { + type = "ac130OverlayImageDef" + }, + { + type = "ac130OverlayWeaponsDef" + } + } + } +end + +local f0_local11 = function () + return { + type = "UIImage", + id = "ac130OverlayImageId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "ac130_overlay_grain" ), + red = 0.9, + green = 1, + blue = 1, + alpha = 0.3 + } + } + } +end + +local f0_local12 = function () + return { + type = "UIImage", + id = "ac130OverlayDarkenImageId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "black" ), + alpha = 0 + }, + fadein = { + alpha = 0.6 + } + }, + handlers = { + darken = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "fadein", + 200 + }, + { + "fadein", + 400 + }, + { + "default", + 800 + } + } ) + } + } +end + +local f0_local13 = function () + return { + type = "UIElement", + id = "ac130OverlayWeaponsId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } + }, + children = { + { + type = "ac130OverlaysDef" + }, + { + type = "ac130OverlayWeaponTextListDef" + }, + { + type = "ac130OverlayAmmoTextListDef" + }, + { + type = "ac130OverlayToggleTextListDef" + }, + { + type = "ac130OverlayPlaneModelCoordsListDef" + }, + { + type = "ac130OverlayPlayerPositionCoordsListDef" + }, + { + type = "ac130OverlayAimingCoordsListDef" + }, + { + type = "UIText", + id = "ac130OverlayReloadingTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_RELOADING" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = -230, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alpha = 0 + }, + flash1 = { + alpha = 1 + }, + flash2 = { + alpha = 0.25 + } + }, + handlers = { + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ), + stop_flashing = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIText", + id = "ac130OverlayOpticsTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_HUD_OPTICS" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 200, + height = CoD.TextSettings.HudEuroExtraBigFont.Height, + width = 128, + font = CoD.TextSettings.HudEuroExtraBigFont.Font, + alpha = 1 + }, + active = { + alpha = 1 + }, + inactive = { + alpha = 0.25 + } + } + }, + { + type = "UIText", + id = "ac130OverlayFLIRTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_HUD_FLIR" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = -200, + height = CoD.TextSettings.HudEuroExtraBigFont.Height, + width = 128, + font = CoD.TextSettings.HudEuroExtraBigFont.Font, + alpha = 0.25 + }, + active = { + alpha = 1 + }, + inactive = { + alpha = 0.25 + } + } + } + } + } +end + +local f0_local14 = function () + return { + type = "UIElement", + id = "ac130OverlaysContainerId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "ac130Overlay105mmId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "ac130_overlay_105mm" ), + alpha = 0 + }, + active = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "ac130Overlay40mmId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "ac130_overlay_40mm" ), + alpha = 0 + }, + active = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "ac130Overlay25mmId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "ac130_overlay_25mm" ), + alpha = 0 + }, + active = { + alpha = 1 + } + } + } + } + } +end + +local f0_local15 = function () + return { + type = "UIVerticalList", + id = "ac130OverlayWeaponTextListId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 150, + left = 310, + height = 128, + width = 128, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "ac130Overlay105mmTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_HUD_WEAPON_105MM" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + alpha = 1 + }, + flash2 = { + alpha = 0.25 + } + }, + handlers = { + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ), + stop_flashing = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIText", + id = "ac130Overlay40mmTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_HUD_WEAPON_40MM" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + alpha = 1 + }, + flash2 = { + alpha = 0.25 + } + }, + handlers = { + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ), + stop_flashing = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIText", + id = "ac130Overlay25mmTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_HUD_WEAPON_25MM" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + alpha = 1 + }, + flash2 = { + alpha = 0.25 + } + }, + handlers = { + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ), + stop_flashing = MBh.AnimateToState( "default", 0 ) + } + } + } + } +end + +local f0_local16 = function () + return { + type = "UIVerticalList", + id = "ac130OverlayAmmoTextListId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 150, + left = 380, + height = 128, + width = 128, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "ac130Overlay105mmAmmoTextId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + red = 1, + green = 1, + blue = 1, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + } + }, + handlers = { + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ), + stop_flashing = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIText", + id = "ac130Overlay40mmAmmoTextId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + red = 1, + green = 1, + blue = 1, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + } + }, + handlers = { + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ), + stop_flashing = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIText", + id = "ac130Overlay25mmAmmoTextId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + red = 1, + green = 1, + blue = 1, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + } + }, + handlers = { + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ), + stop_flashing = MBh.AnimateToState( "default", 0 ) + } + } + } + } +end + +local f0_local17 = function () + return { + type = "UIVerticalList", + id = "ac130OverlayToggleTextListId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -60, + right = -40, + height = 128, + width = 256, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "ac130OverlayChangeWeaponTextId", + properties = { + text = Engine.Localize( "@LUA_MENU_AC130_CHANGE_WEAPON" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UICountdown", + id = "ac130OverlayTimerTextId", + properties = { + text = "", + endTime = Game.GetOmnvar( "ui_ac130_use_time" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + } + } + } +end + +local f0_local18 = function () + return { + type = "UIHorizontalList", + id = "ac130OverlayPlaneModelCoordsListId", + states = { + default = { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -200, + left = 320, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = 100, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "ac130OverlayPlaneModelCoordsXId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "ac130OverlayPlaneModelCoordsYId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "ac130OverlayPlaneModelCoordsZId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + } + } + } +end + +local f0_local19 = function () + return { + type = "UIHorizontalList", + id = "ac130OverlayPlayerPositionCoordsListId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -200, + right = -500, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = 100, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "ac130OverlayPlayerPositionCoordsXId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "ac130OverlayPlayerPositionCoordsYId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "ac130OverlayPlayerPositionCoordsZId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + } + } + } +end + +local f0_local20 = function () + return { + type = "UIHorizontalList", + id = "ac130OverlayAimingCoordsListId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -200, + right = -500, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = 100, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "ac130OverlayAimingCoordsXId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "ac130OverlayAimingCoordsYId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "ac130OverlayAimingCoordsZId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "ac130OverlayDef", f0_local10 ) +LUI.MenuBuilder.registerDef( "ac130OverlayImageDef", f0_local11 ) +LUI.MenuBuilder.registerDef( "ac130OverlayDarkenImageDef", f0_local12 ) +LUI.MenuBuilder.registerDef( "ac130OverlayWeaponsDef", f0_local13 ) +LUI.MenuBuilder.registerDef( "ac130OverlaysDef", f0_local14 ) +LUI.MenuBuilder.registerDef( "ac130OverlayWeaponTextListDef", f0_local15 ) +LUI.MenuBuilder.registerDef( "ac130OverlayAmmoTextListDef", f0_local16 ) +LUI.MenuBuilder.registerDef( "ac130OverlayToggleTextListDef", f0_local17 ) +LUI.MenuBuilder.registerDef( "ac130OverlayPlaneModelCoordsListDef", f0_local18 ) +LUI.MenuBuilder.registerDef( "ac130OverlayPlayerPositionCoordsListDef", f0_local19 ) +LUI.MenuBuilder.registerDef( "ac130OverlayAimingCoordsListDef", f0_local20 ) +LockTable( _M ) diff --git a/lui/mp_hud/aliencapturinghud.dec.lua b/lui/mp_hud/aliencapturinghud.dec.lua new file mode 100644 index 0000000..e0da262 --- /dev/null +++ b/lui/mp_hud/aliencapturinghud.dec.lua @@ -0,0 +1,449 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 1 +f0_local1 = 64 * f0_local0 +f0_local2 = 256 * f0_local0 +local f0_local3 = 16 * f0_local0 +local f0_local4 = 210 * f0_local0 +local f0_local5 = 256 * f0_local0 +local f0_local6 = 16 * f0_local0 +local f0_local7 = 16 * f0_local0 +local f0_local8 = false +local f0_local9 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = f1_arg0 + local f1_local1 = f1_arg0:getFirstDescendentById( "capturing_bar" ) + local f1_local2 = f1_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + local f1_local3 = f1_arg0:getFirstDescendentById( "capturing_text" ) + local f1_local4 = f1_arg0:getFirstDescendentById( "capturing_bar_bg" ) + local f1_local5 = f1_arg0:getFirstDescendentById( "capturing_bar_hl" ) + local f1_local6 = f1_local5:getFirstDescendentById( "start_cap" ) + local f1_local7 = f1_local5:getFirstDescendentById( "middle" ) + local f1_local8 = f1_local5:getFirstDescendentById( "end_cap" ) + f0_local8 = false + if Game.GetOmnvar( "ui_securing_progress" ) > 0.9 and not f0_local8 then + f0_local8 = true + end + if f1_local4.current_state ~= "default" then + f1_local4:animateToState( "default", 0 ) + f1_local4.current_state = "default" + end + if f0_local8 then + if f1_local1.current_state ~= "secured" then + local f1_local9 = MBh.AnimateSequence( { + { + "active", + 500 + }, + { + "blink_off", + 150 + } + } ) + f1_local9( f1_local1 ) + f1_local1.current_state = "secured" + end + if f1_local3.current_state ~= "secured" then + local f1_local9 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "secured", + 0 + } + } ) + f1_local9( f1_local3 ) + f1_local3.current_state = "secured" + end + if f1_local6.current_state ~= "secured" then + f1_local6:animateToState( "secured" ) + f1_local6.current_state = "secured" + end + if f1_local7.current_state ~= "secured" then + f1_local7:animateToState( "secured" ) + f1_local7.current_state = "secured" + end + if f1_local8.current_state ~= "secured" then + f1_local8:animateToState( "secured" ) + f1_local8.current_state = "secured" + end + else + if f1_local1.current_state ~= "default" then + f1_local1:animateToState( "default", 0 ) + f1_local1.current_state = "default" + end + if f1_local5.current_state ~= "default" then + f1_local5:animateToState( "default", 0 ) + f1_local5.current_state = "default" + end + if f1_local3.current_state ~= "default" then + f1_local3:animateToState( "default", 0 ) + f1_local3.current_state = "default" + end + if f1_local7.current_state ~= "default" then + f1_local7:animateToState( "default", 0 ) + f1_local7.current_state = "default" + end + end +end + +local f0_local10 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0 + local f2_local1 = f2_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + local f2_local2 = f2_arg0:getFirstDescendentById( "capturing_text" ) + local f2_local3 = f2_arg0:getFirstDescendentById( "capturing_bar_bg" ) + local f2_local4 = f2_arg0:getFirstDescendentById( "capturing_bar_hl" ) + local f2_local5 = f2_local4:getFirstDescendentById( "start_cap" ) + local f2_local6 = f2_local4:getFirstDescendentById( "middle" ) + local f2_local7 = f2_local4:getFirstDescendentById( "end_cap" ) + local f2_local8 = f2_local1.value + local f2_local9 = "" + if f2_local8 == 0 then + LUI.UITimer.Stop( f2_local1 ) + return + elseif f2_local8 == 1 then + f2_local9 = Engine.Localize( "@ALIEN_COLLECTIBLES_SEARCHING" ) + elseif f2_local8 == 2 then + f2_local9 = Engine.Localize( "@ALIEN_COLLECTIBLES_REPAIR_DRILL" ) + elseif f2_local8 == 3 then + f2_local9 = Engine.Localize( "@MPUI_REVIVING" ) + elseif f2_local8 == 4 then + f2_local9 = Engine.Localize( "@MPUI_BEING_REVIVED" ) + elseif f2_local8 == 5 then + f2_local9 = Engine.Localize( "@MP_ALIEN_DESCENT_REPAIR_TERMINAL" ) + elseif f2_local8 == 6 then + f2_local9 = Engine.Localize( "@MP_ALIEN_DESCENT_ACTIVATE_CORTEX" ) + elseif f2_local8 == 7 then + f2_local9 = Engine.Localize( "@MP_ALIEN_LAST_CONDUIT_REPAIR" ) + end + if f2_local0.current_state ~= "active" then + f2_local0:animateToState( "active", 250 ) + f2_local0.current_state = "active" + end + if f2_local3.current_state ~= "active" then + f2_local3:animateToState( "active", 250 ) + f2_local3.current_state = "active" + end + if f2_local4.current_state ~= "active" then + f2_local4:animateToState( "active", 250 ) + f2_local4.current_state = "active" + end + if f2_local5.current_state ~= "default" then + f2_local5:animateToState( "default" ) + f2_local5.current_state = "default" + end + if f2_local6.current_state ~= "default" then + f2_local6:animateToState( "default" ) + f2_local6.current_state = "default" + end + if f2_local7.current_state ~= "default" then + f2_local7:animateToState( "default" ) + f2_local7.current_state = "default" + end + if f2_local2.current_state ~= "securing" then + f2_local2:setText( f2_local9 ) + local f2_local10 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 0 + } + } ) + f2_local10( f2_local2 ) + f2_local2.current_state = "securing" + end + f2_local6:registerAnimationState( "move_bar", { + right = f2_local6.m_maxWidth * Game.GetOmnvar( "ui_securing_progress" ) + } ) + f2_local6:animateToState( "move_bar", 150 ) +end + +local f0_local11 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + if f3_arg1.value > 0 then + LUI.UITimer.Reset( f3_local0 ) + else + LUI.UITimer.Stop( f3_local0 ) + f0_local9( f3_arg0, f3_arg1 ) + end + f3_local0.value = f3_arg1.value +end + +local f0_local12 = function ( f4_arg0 ) + local f4_local0 = RegisterMaterial( "capturing_bg_mp" ) + local f4_local1 = RegisterMaterial( "capturing_bar_end_mp" ) + local f4_local2 = RegisterMaterial( "capturing_bar_mp" ) + local f4_local3 = RegisterMaterial( "capturing_bar_start_mp" ) + local self = LUI.UIElement.new() + self.id = "capturing_bar" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(f0_local1 / 2), + left = -(f0_local2 / 2), + height = f0_local1, + width = f0_local2, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerAnimationState( "blink_on", { + alpha = 1 + } ) + self:registerAnimationState( "blink_off", { + alpha = 0 + } ) + self:registerEventHandler( "capture_refresh", f4_arg0 ) + local f4_local5 = LUI.UITimer.new( 100, "capture_refresh", nil, false, false, false, true ) + f4_local5.id = "capturing_refresh_timer" + f4_local5.value = 0 + local f4_local6 = LUI.UIImage.new() + f4_local6.id = "capturing_bar_bg" + f4_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f4_local0 + } ) + f4_local6:animateToState( "default", 0 ) + local f4_local7 = LUI.UIHorizontalList.new() + f4_local7.id = "capturing_bar_hl" + f4_local7:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -33, + left = 27, + height = f0_local3, + width = f0_local4, + alignment = LUI.Alignment.Left, + spacing = 0, + alpha = 0 + } ) + f4_local7:animateToState( "default", 0 ) + f4_local7:registerAnimationState( "active", { + alpha = 1 + } ) + local f4_local8 = LUI.UIImage.new() + f4_local8.id = "start_cap" + f4_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f0_local3, + width = f0_local7, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + material = f4_local3 + } ) + f4_local8:animateToState( "default", 0 ) + f4_local8:registerAnimationState( "secured", { + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f4_local8:registerAnimationState( "contested", { + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b + } ) + local f4_local9 = LUI.UIImage.new() + f4_local9.id = "middle" + f4_local9.m_maxWidth = f0_local4 - f0_local7 - f0_local7 + f4_local9:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f0_local3, + width = 0, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + material = f4_local2 + } ) + f4_local9:animateToState( "default", 0 ) + f4_local9:registerAnimationState( "secured", { + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f4_local9:registerAnimationState( "contested", { + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b + } ) + local f4_local10 = LUI.UIImage.new() + f4_local10.id = "end_cap" + f4_local10:registerAnimationState( "default", { + topAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + height = f0_local3, + width = f0_local7, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + material = f4_local1 + } ) + f4_local10:animateToState( "default", 0 ) + f4_local10:registerAnimationState( "secured", { + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f4_local10:registerAnimationState( "contested", { + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b + } ) + f4_local7:addElement( f4_local8 ) + f4_local7:addElement( f4_local9 ) + f4_local7:addElement( f4_local10 ) + local f4_local11 = LUI.UIText.new() + f4_local11.id = "capturing_text" + f4_local11:setText( "" ) + f4_local11:setTextStyle( CoD.TextStyle.Shadowed ) + f4_local11:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -400, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f4_local11:animateToState( "default", 0 ) + local f4_local12 = -50 + f4_local11:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f4_local12, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f4_local11:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f4_local12, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f4_local11:registerAnimationState( "secured", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f4_local12, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b, + alpha = 1 + } ) + f4_local11:registerAnimationState( "contested", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f4_local12, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 1 + } ) + f4_local11:registerAnimationState( "contested_off_for_loop", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f4_local12, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 0 + } ) + f4_local6:addElement( f4_local7 ) + f4_local6:addElement( f4_local11 ) + self:addElement( f4_local5 ) + self:addElement( f4_local6 ) + return self +end + +function captureHudDef() + local self = LUI.UIElement.new() + self.id = "capture_hud" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + bottom = 250, + left = -(f0_local2 / 2), + height = f0_local1, + width = f0_local2 + } ) + self:animateToState( "default", 0 ) + self:registerOmnvarHandler( "ui_securing", f0_local11 ) + self:addElement( f0_local12( f0_local10 ) ) + return self +end + +LUI.MenuBuilder.registerType( "captureHudDef", captureHudDef ) +LockTable( _M ) diff --git a/lui/mp_hud/alienchaos.dec.lua b/lui/mp_hud/alienchaos.dec.lua new file mode 100644 index 0000000..85c3b89 --- /dev/null +++ b/lui/mp_hud/alienchaos.dec.lua @@ -0,0 +1,1720 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function chaos_main_score() + local f1_local0 = 220 + local f1_local1 = 64 + local f1_local2 = 16 + local f1_local3 = 16 + local f1_local4 = 1.5 + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + height = f1_local1, + width = f1_local0, + right = 4 + } ) + self.id = "chaos_main_score" + local f1_local6 = LUI.UIHorizontalList.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f1_local6.id = "background" + self:addElement( f1_local6 ) + local f1_local7 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_box_combo_score_ltcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f1_local2 + } ) + f1_local7.id = "bgLeft" + f1_local6:addElement( f1_local7 ) + local f1_local8 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_box_combo_score_mid" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f1_local0 - f1_local2 - f1_local3 + } ) + f1_local8.id = "bgMid" + f1_local6:addElement( f1_local8 ) + local f1_local9 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_box_combo_score_rtcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f1_local3 + } ) + f1_local9.id = "bgRight" + f1_local6:addElement( f1_local9 ) + local f1_local10 = LUI.UIText.new( CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 6, + right = 0, + height = CoD.TextSettings.SmallFont.Height + } ) ) + f1_local10.id = "title" + f1_local10:setText( Engine.Localize( "ALIEN_CHAOS_SCORE" ) ) + self:addElement( f1_local10 ) + local f1_local11 = Game.GetOmnvar( "ui_alien_chaos_total_score" ) + local f1_local12 = LUI.UIPrettyNumber.new( CoD.ColorizeState( Colors.alien_chaos_hilite, { + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = -8, + right = 0, + height = CoD.TextSettings.ExtraBigFont.Height + } ), { + speed = 1000, + initialValue = f1_local11, + precision = 5 + } ) + f1_local12.id = "score" + f1_local12:setTextStyle( CoD.TextStyle.Outlined ) + self:addElement( f1_local12 ) + local f1_local13 = function ( f2_arg0, f2_arg1 ) + assert( f1_local4 > 0 ) + local f2_local0 = 0 + if f2_arg0.getDisplayValue then + f2_local0 = f2_arg0:getDisplayValue() + end + f2_arg0:setSpeed( (f2_arg1.value - f2_local0) / f1_local4 ) + f2_arg0:setValue( f2_arg1.value ) + end + + f1_local12:registerOmnvarHandler( "ui_alien_chaos_total_score", f1_local13 ) + f1_local13( f1_local12, { + value = f1_local11 + } ) + return self +end + +f0_local0 = 300 +function chaos_combo_gauge() + local f3_local0 = 256 + local f3_local1 = 40 + local f3_local2 = 18 + local f3_local3 = 12 + local f3_local4 = 32 + local f3_local5 = 130 + local f3_local6 = 12 + local f3_local7 = -2 + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + height = f3_local1, + left = -f3_local0 / 2, + right = f3_local0 / 2 + } ) + self.id = "chaos_combo_gauge" + local f3_local9 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_combo_meter_bg" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f3_local9.id = "background" + self:addElement( f3_local9 ) + local f3_local10 = LUI.UIHorizontalList.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 3, + height = f3_local4, + left = 0, + right = 0, + alignment = LUI.Alignment.Center + } ) + f3_local10.id = "ticks" + self:addElement( f3_local10 ) + for f3_local11 = 1, f3_local2, 1 do + local f3_local14 = f3_local11 + local f3_local15 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f3_local3 + } ) + f3_local15.id = "tick_" .. f3_local14 + f3_local10:addElement( f3_local15 ) + local f3_local16 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_combo_meter_tic_empty" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.75 + } ) + f3_local16.id = "tickBorder" + f3_local15:addElement( f3_local16 ) + local f3_local17 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_combo_meter_tic_fill" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 1, + bottom = 1, + left = 0, + right = 0, + alpha = 0 + } ) + f3_local17:registerAnimationState( "frozen", CoD.ColorizeState( Colors.alien_chaos_freeze, { + alpha = 1 + } ) ) + local f3_local18 = { + r = 0.38, + g = 0.65, + b = 0.31 + } + local f3_local19 = { + r = 0.9, + g = 0.78, + b = 0.1 + } + local f3_local20 = { + r = 1, + g = 0.24, + b = 0.04 + } + local f3_local21 = { + { + threshold = 0, + color = f3_local20 + }, + { + threshold = 0.19, + color = f3_local20 + }, + { + threshold = 0.31, + color = f3_local19 + }, + { + threshold = 0.53, + color = f3_local19 + }, + { + threshold = 0.64, + color = f3_local18 + }, + { + threshold = 1, + color = f3_local18 + } + } + f3_local17.id = "tickFill" + f3_local15:addElement( f3_local17 ) + local f3_local22 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 14, + height = 4, + left = 1, + right = -1, + alpha = 0 + } ) + f3_local22:registerAnimationState( "visible", { + alpha = 1 + } ) + f3_local22.id = "tickFlash" + f3_local15:addElement( f3_local22 ) + f3_local15.fill = f3_local17 + f3_local15.flash = f3_local22 + f3_local15.ticksLit = 0 + f3_local15:registerEventHandler( "refresh_ticks", function ( element, event ) + local f4_local0 = f3_local14 <= event.ticksLit + if f4_local0 or event.frozen then + if event.frozen then + if not element.frozen then + element.fill:animateToState( "frozen", 350 ) + end + elseif element.ticksLit ~= event.ticksLit then + if not element.lit then + local f4_local1 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 20 * math.max( 0, f3_local14 - element.ticksLit ) + }, + { + "visible", + 0 + }, + { + "default", + 200 + } + } ) + f4_local1( element.flash, {} ) + end + element.fill:registerAnimationState( "current", CoD.ColorizeState( CoD.GradientMap( f3_local21, event.ticksLit / f3_local2 ) ) ) + element.fill:animateToState( "current" ) + end + elseif element.lit then + element.fill:animateToState( "default", 100 ) + end + element.frozen = event.frozen + element.ticksLit = event.ticksLit + element.lit = f4_local0 + end ) + end + local f3_local11 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f3_local11.id = "frozen" + self:addElement( f3_local11 ) + for f3_local12 = 1, f3_local5, 1 do + local f3_local15 = f3_local12 + local f3_local16 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_chaos_freeze_snowflake" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f3_local7 - math.random() * 10, + height = f3_local6, + left = 20 - f3_local6 / 2 + f3_local15 * (f3_local0 - 40) / f3_local5, + width = f3_local6, + scale = -1, + alpha = 0 + } ) + f3_local16:registerAnimationState( "visible", { + alpha = 1, + scale = 0.75 - 1.5 * math.random(), + zRot = 360 * math.random() + } ) + f3_local16.id = "iceCube_" .. f3_local15 + f3_local11:addElement( f3_local16 ) + f3_local16:registerEventHandler( "refresh_ice_cubes", function ( element, event ) + if f3_local15 <= event.cubesLit then + if not element.visible then + local f5_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + f0_local0 * f3_local15 / f3_local5 + }, + { + "visible", + 200 + } + } ) + f5_local0( element, {} ) + element.visible = true + end + elseif element.visible then + element:cancelAnimateToState() + element:animateToState( "default", 100 ) + element.visible = nil + end + end ) + end + local f3_local12 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 8, + bottom = 8, + left = 0, + right = 0, + alpha = 0 + } ) + f3_local12:registerAnimationState( "visible", { + alpha = 1 + } ) + f3_local12.id = "icicles" + f3_local11:addElement( f3_local12 ) + f3_local12:registerOmnvarHandler( "ui_alien_chaos_meter_freeze_end", function ( f6_arg0, f6_arg1 ) + if f6_arg1.value > 0 then + f6_arg0:animateToState( "visible", f0_local0 ) + else + f6_arg0:animateToState( "default", 400 ) + end + end ) + f3_local12:addElement( LUI.UIImage.new( { + material = RegisterMaterial( "alien_chaos_freeze_icicles" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) ) + f3_local12:addElement( LUI.UIImage.new( { + material = RegisterMaterial( "alien_chaos_freeze_icicles" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.2 + } ) ) + local f3_local15 = Game.GetOmnvar( "ui_alien_chaos_combo_meter_start" ) + self:registerOmnvarHandler( "ui_alien_chaos_combo_meter_end", function ( f7_arg0, f7_arg1 ) + f3_local15 = Game.GetTime() + end ) + local f3_local16 = LUI.UITimer.new( 50, "combo_gauge_refresh" ) + f3_local16.id = "refreshTimer" + self:addElement( f3_local16 ) + self:registerEventHandler( "combo_gauge_refresh", function ( element, event ) + local f8_local0 = Game.GetTime() + local f8_local1 = Game.GetOmnvar( "ui_alien_chaos_meter_freeze_start" ) + local f8_local2 = Game.GetOmnvar( "ui_alien_chaos_meter_freeze_end" ) + local f8_local3 + if f8_local1 > f8_local0 or f8_local0 >= f8_local2 then + f8_local3 = false + else + f8_local3 = true + end + local f8_local4 = Game.GetOmnvar( "ui_alien_chaos_combo_meter_end" ) + local f8_local5 = (f8_local4 - f8_local0) / (f8_local4 - f3_local15) + if f8_local3 then + f8_local5 = (f8_local0 - f8_local1) / f0_local0 + end + f3_local10:processEvent( { + name = "refresh_ticks", + ticksLit = math.ceil( LUI.clamp( f8_local5, 0, 1 ) * f3_local2 ), + frozen = f8_local3, + duration = f8_local4 - f3_local15 + } ) + local f8_local6 = LUI.clamp( (f8_local2 - f8_local0) / (f8_local2 - f8_local1), 0, 1 ) + if not f8_local3 then + f8_local6 = 0 + end + f3_local11:processEvent( { + name = "refresh_ice_cubes", + cubesLit = math.ceil( f8_local6 * f3_local5 ) + } ) + end ) + return self +end + +function chaos_combo_score() + local f9_local0 = 200 + local f9_local1 = 15 + local f9_local2 = 36 + local f9_local3 = 1.5 + local self = LUI.UIHorizontalList.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 24, + height = f9_local2, + left = 0, + right = 0, + alignment = LUI.Alignment.Center + } ) + self.id = "chaos_combo_score" + local f9_local5 = LUI.UIText.new( CoD.ColorizeState( Colors.alien_tech_tree_bright_grey, { + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Right, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + left = 0, + bottom = 3, + width = f9_local0, + height = f9_local2, + scale = 0 + } ) ) + f9_local5:registerAnimationState( "pulse", CoD.ColorizeState( Colors.white, { + scale = 0.1 + } ) ) + f9_local5:registerAnimationState( "frozen", CoD.ColorizeState( Colors.alien_chaos_freeze, { + scale = 0 + } ) ) + f9_local5:setTextStyle( CoD.TextStyle.OutlinedMore ) + f9_local5.id = "comboMultiplier" + self:addElement( f9_local5 ) + local f9_local6 = 0 + local f9_local7 = function ( f10_arg0, f10_arg1 ) + local f10_local0 = MBh.AnimateSequence( { + { + "pulse", + 50 + }, + { + f10_arg0.frozen and "frozen" or "default", + 200 + } + } ) + f10_arg0:setText( f10_arg1.value .. "x" ) + if f10_arg1.value > 0 then + f10_local0( f10_arg0, {} ) + end + end + + f9_local5:registerOmnvarHandler( "ui_alien_chaos_combo_counter", f9_local7 ) + f9_local5:registerOmnvarHandler( "ui_alien_chaos_meter_freeze_start", function ( f11_arg0, f11_arg1 ) + if f11_arg1.value > 0 then + f11_arg0:animateToState( "frozen", f0_local0 ) + f11_arg0.frozen = true + else + f11_arg0:animateToState( "default", 100 ) + f11_arg0.frozen = false + end + end ) + f9_local7( f9_local5, { + value = Game.GetOmnvar( "ui_alien_chaos_combo_counter" ) + } ) + local f9_local8 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + width = f9_local1 + } ) + f9_local8.id = "padding" + self:addElement( f9_local8 ) + local f9_local9 = LUI.UIPrettyNumber.new( CoD.ColorizeState( Colors.alien_chaos_hilite, { + font = CoD.TextSettings.HudIW6NormalFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + left = 0, + bottom = 0, + width = f9_local0, + height = CoD.TextSettings.HudIW6NormalFont.Height + } ), { + speed = 150, + initialValue = Game.GetOmnvar( "ui_alien_chaos_score_streak" ) + } ) + f9_local9:registerAnimationState( "frozen", CoD.ColorizeState( Colors.alien_chaos_freeze ) ) + f9_local9:setTextStyle( CoD.TextStyle.OutlinedMore ) + f9_local9.id = "comboPoints" + self:addElement( f9_local9 ) + local f9_local10 = function ( f12_arg0, f12_arg1 ) + assert( f9_local3 > 0 ) + local f12_local0 = 0 + if f12_arg0.getDisplayValue then + f12_local0 = f12_arg0:getDisplayValue() + end + f12_arg0:setSpeed( (f12_arg1.value - f12_local0) / f9_local3 ) + f12_arg0:setValue( f12_arg1.value ) + end + + f9_local9:registerOmnvarHandler( "ui_alien_chaos_score_streak", f9_local10 ) + f9_local9:registerOmnvarHandler( "ui_alien_chaos_meter_freeze_start", function ( f13_arg0, f13_arg1 ) + if f13_arg1.value > 0 then + f13_arg0:animateToState( "frozen", f0_local0 ) + else + f13_arg0:animateToState( "default", 100 ) + end + end ) + f9_local10( f9_local9, { + value = Game.GetOmnvar( "ui_alien_chaos_score_streak" ) + } ) + return self +end + +function chaos_combo_meter() + local self = nil + if Engine.UsingSplitscreenUpscaling() then + self = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = -60, + height = 0, + left = 0, + right = 0 + } ) + else + self = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 50, + height = 0, + left = 0, + right = 0 + } ) + end + self.id = "chaos_combo_meter" + self:addElement( chaos_combo_gauge() ) + self:addElement( chaos_combo_score() ) + return self +end + +function chaos_clock() + local f15_local0 = 256 + local f15_local1 = 64 + local f15_local2 = Game.GetOmnvar( "ui_alien_chaos_grace_period" ) + local f15_local3 = { + { + time = 30000, + alias = "ui_mp_suitcasebomb_timer" + }, + { + time = 20000, + alias = "ui_mp_suitcasebomb_timer" + }, + { + time = 10000, + alias = "ui_mp_timer_countdown" + }, + { + time = 9000, + alias = "ui_mp_timer_countdown" + }, + { + time = 8000, + alias = "ui_mp_timer_countdown" + }, + { + time = 7000, + alias = "ui_mp_timer_countdown" + }, + { + time = 6000, + alias = "ui_mp_timer_countdown" + }, + { + time = 5000, + alias = "ui_mp_timer_countdown" + }, + { + time = 4000, + alias = "ui_mp_timer_countdown" + }, + { + time = 3000, + alias = "ui_mp_timer_countdown" + }, + { + time = 2000, + alias = "ui_mp_timer_countdown" + }, + { + time = 1000, + alias = "ui_mp_timer_countdown" + } + } + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self.id = "chaos_clock" + local f15_local5 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + bottom = 0, + height = f15_local1, + left = -f15_local0 / 2, + right = f15_local0 / 2, + alpha = 0 + } ) + f15_local5:registerAnimationState( "visible", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + height = f15_local1, + left = -f15_local0 / 2, + right = f15_local0 / 2, + alpha = 1 + } ) + f15_local5:registerAnimationState( "animating", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 20, + height = f15_local1, + left = -f15_local0 / 2, + right = f15_local0 / 2, + alpha = 1 + } ) + f15_local5.id = "chaos_clock" + local f15_local6 = function ( f16_arg0, f16_arg1 ) + local f16_local0 = nil + if 0 < f16_arg1 then + f16_local0 = MBh.AnimateSequence( { + { + "animating", + 100 + }, + { + "visible", + 150 + } + } ) + else + f16_local0 = MBh.AnimateSequence( { + { + "animating", + 150 + }, + { + "default", + 100 + } + } ) + end + f16_local0( f16_arg0, {} ) + end + + f15_local5:registerOmnvarHandler( "ui_alien_chaos_grace_period", function ( f17_arg0, f17_arg1 ) + f15_local6( f17_arg0, f17_arg1.value ) + end ) + if f15_local2 > 0 then + f15_local6( f15_local5, f15_local2 ) + end + local f15_local7 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_box_combo_time" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f15_local7.id = "background" + f15_local5:addElement( f15_local7 ) + local f15_local8 = LUI.UICountdown.new() + f15_local8:registerAnimationState( "default", { + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 15.5, + right = 0, + height = CoD.TextSettings.ExtraBigFont.Height, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f15_local8:animateToState( "default" ) + f15_local8.id = "value" + f15_local8.isPulsing = false + f15_local8:setTextStyle( CoD.TextStyle.Outlined ) + f15_local8:setEndTime( f15_local2 ) + f15_local8:registerOmnvarHandler( "ui_alien_chaos_grace_period", function ( f18_arg0, f18_arg1 ) + f18_arg0:setEndTime( f18_arg1.value ) + f18_arg0:animateToState( "default" ) + f18_arg0.currentBeepIndex = 1 + f18_arg0.isPulsing = false + end ) + f15_local8:registerAnimationState( "pulse", { + red = 1, + blue = 0, + green = 0, + alpha = 1 + } ) + f15_local5:addElement( f15_local8 ) + f15_local8.currentBeepIndex = 1 + f15_local8:registerEventHandler( "timer_pulse_check", function ( element, event ) + local f19_local0 = Game.GetTime() + local f19_local1 = Game.GetOmnvar( "ui_alien_chaos_grace_period" ) + local f19_local2 = false + if element.currentBeepIndex <= #f15_local3 and f19_local1 - f19_local0 <= f15_local3[element.currentBeepIndex].time and f19_local1 > 0 then + Engine.PlaySound( f15_local3[element.currentBeepIndex].alias ) + f19_local2 = true + element.currentBeepIndex = element.currentBeepIndex + 1 + end + if not element.isPulsing == true then + if f19_local2 == true then + local f19_local3 = MBh.AnimateSequence( { + { + "pulse", + 0 + }, + { + "pulse", + 450 + }, + { + "default", + 0 + }, + { + "default", + 450 + } + } ) + f19_local3( element ) + element:registerEventHandlerIfFree( LUI.FormatAnimStateFinishEvent( "default" ), function ( f20_arg0, f20_arg1 ) + f20_arg0.isPulsing = false + f19_local2 = false + end ) + end + elseif element.isPulsing == true and f19_local2 == false then + element:animateToState( "default" ) + element.isPulsing = false + end + end ) + local f15_local9 = LUI.UITimer.new( 50, "timer_pulse_check" ) + f15_local9.id = "pulseTimer" + f15_local8:addElement( f15_local9 ) + self:addElement( f15_local5 ) + return self +end + +ChaosPerksLUT = { + file = "mp/alien/chaos_perks.csv", + index = 2, + icon = 3 +} +function CountChaosPerks() + local f21_local0 = 32 + for f21_local1 = 1, f21_local0, 1 do + if Engine.TableLookup( ChaosPerksLUT.file, ChaosPerksLUT.index, tostring( f21_local1 ), 0 ) == "" then + return f21_local1 - 1 + end + end + return f21_local0 +end + +function GetChaosPerksIcon( f22_arg0 ) + return Engine.TableLookup( ChaosPerksLUT.file, ChaosPerksLUT.index, tostring( f22_arg0 ), ChaosPerksLUT.icon ) +end + +function chaos_perks() + local f23_local0 = 8 + local f23_local1 = 36 + local f23_local2 = 8 + local f23_local3 = CountChaosPerks() + local f23_local4 = f23_local0 * f23_local1 + f23_local2 * (2 + math.max( 0, f23_local3 - 1 )) + local f23_local5 = math.ceil( f23_local3 / f23_local0 ) * f23_local1 + f23_local2 * (2 + math.max( 0, f23_local3 - 1 )) + local f23_local6 = 60 + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = f23_local5, + left = 0, + width = f23_local4 + } ) + self.id = "chaos_perks" + self.perkElements = {} + local f23_local8 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_health_bg_shadow" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -f23_local6, + bottom = 0, + left = -f23_local6, + right = f23_local6, + alpha = 0.8 + } ) + f23_local8.id = "background" + self:addElement( f23_local8 ) + local f23_local9 = LUI.UIGrid.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f23_local2, + bottom = -f23_local2, + left = f23_local2, + right = -f23_local2 + }, { + elementsPerRow = f23_local0, + rowHeight = f23_local1, + hSpacing = f23_local2, + vSpacing = f23_local2 + } ) + f23_local9.id = "grid" + self:addElement( f23_local9 ) + for f23_local10 = 1, f23_local3, 1 do + local f23_local13 = f23_local10 + local f23_local14 = GetChaosPerksIcon( f23_local13 ) + local f23_local15 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = f23_local1, + left = 0, + right = f23_local1, + scale = 0 + } ) + f23_local15:registerAnimationState( "smaller", { + scale = -0.2 + } ) + f23_local15:registerAnimationState( "bigger", { + scale = 0.2 + } ) + f23_local15.id = "perk_" .. f23_local13 + f23_local9:addElement( f23_local15 ) + self.perkElements[f23_local13] = f23_local15 + local f23_local16 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_box_combo_perk" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.1 + } ) + f23_local16:registerAnimationState( "active", { + alpha = 0.8 + } ) + f23_local16.id = "perkBG" + f23_local15:addElement( f23_local16 ) + local f23_local17 = LUI.UIImage.new( { + material = RegisterMaterial( f23_local14 ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.2 + } ) + f23_local17:registerAnimationState( "active", { + alpha = 1 + } ) + f23_local17.id = "perkIcon" + f23_local15:addElement( f23_local17 ) + f23_local15.bg = f23_local16 + f23_local15.icon = f23_local17 + f23_local15:registerEventHandler( "activate", function ( element, event ) + if not element.active then + local f24_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "smaller", + 250 + }, + { + "bigger", + 100 + }, + { + "default", + 150 + } + } ) + local f24_local1 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 100 + } + } ) + local f24_local2 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 100 + } + } ) + f24_local0( element, {} ) + f24_local1( element.bg, {} ) + f24_local2( element.icon, {} ) + element.active = true + end + end ) + f23_local15:registerEventHandler( "deactivate", function ( element, event ) + if element.active then + local f25_local0 = 80 * (f23_local3 - f23_local13) + local f25_local1 = MBh.AnimateSequence( { + { + "default", + f25_local0 + }, + { + "bigger", + 250 + }, + { + "smaller", + 100 + }, + { + "default", + 150 + } + } ) + f25_local1( element, {} ) + f25_local1 = MBh.AnimateSequence( { + { + "active", + f25_local0 + }, + { + "default", + 200 + } + } ) + f25_local1( element.bg, {} ) + f25_local1 = MBh.AnimateSequence( { + { + "active", + f25_local0 + }, + { + "default", + 200 + } + } ) + f25_local1( element.icon, {} ) + element.active = nil + end + end ) + end + self:registerOmnvarHandler( "ui_chaos_perk", function ( f26_arg0, f26_arg1 ) + if f26_arg1.value == 0 then + f23_local9:processEvent( { + name = "deactivate" + } ) + end + end ) + self.getPerkElement = function ( f27_arg0, f27_arg1 ) + return f27_arg0.perkElements[f27_arg1] + end + + local f23_local10 = Game.GetOmnvar( "ui_chaos_perk" ) + if f23_local10 > 0 then + for f23_local11 = 1, f23_local10, 1 do + local f23_local15 = self:getPerkElement( f23_local11 ) + if f23_local15 then + f23_local15:processEvent( { + name = "activate" + } ) + end + end + end + return self +end + +f0_local1 = 2000 +function chaos_perk_unlock_one( f28_arg0, f28_arg1 ) + assert( f28_arg1 ) + local f28_local0 = 48 + local f28_local1 = f28_arg0:getPerkElement( f28_arg1 ) + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + height = f28_local0, + left = -80 - f28_local0 / 2, + width = f28_local0, + scale = 0, + alpha = 1 + } ) + self:registerAnimationState( "centered", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + height = f28_local0, + left = -f28_local0 / 2, + width = f28_local0 + } ) + self:registerAnimationState( "wait", {} ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self.id = "chaos_perk_unlock_one_" .. f28_arg1 + local f28_local3 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "centered", + 400 + }, + { + "wait", + f0_local1 + } + } ) + self:registerEventHandler( LUI.FormatAnimStateFinishEvent( "wait" ), function ( element, event ) + self:registerAnimationState( "flyover", LUI.MakeFlyOverAnimationState( element, f28_local1 ) ) + element:animateToState( "flyover", 400 ) + end ) + self:registerEventHandler( LUI.FormatAnimStateFinishEvent( "flyover" ), function ( element, event ) + element:animateToState( "hidden", 200 ) + f28_local1:processEvent( { + name = "activate" + } ) + end ) + self:registerEventHandler( LUI.FormatAnimStateFinishEvent( "hidden" ), function ( element, event ) + element:close() + end ) + f28_local3( self, {} ) + local f28_local4 = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 1, + left = 0, + right = 0 + } ) + f28_local4:registerAnimationState( "horizontal", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 1, + left = 0, + right = 0 + } ) + f28_local4:registerAnimationState( "full", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f28_local4.id = "stencil" + f28_local4:setUseStencil( true ) + self:addElement( f28_local4 ) + local f28_local5 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "horizontal", + 100, + false, + false + }, + { + "horizontal", + 100, + false, + true + }, + { + "full", + 150 + } + } ) + f28_local5( f28_local4, {} ) + f28_local5 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + top = 0, + left = 0, + right = 0 + } ) + f28_local5.id = "icon" + f28_local4:addElement( f28_local5 ) + local f28_local6 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_box_combo_perk" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.8 + } ) + f28_local6.id = "perkBG" + f28_local5:addElement( f28_local6 ) + local f28_local7 = LUI.UIImage.new( { + material = RegisterMaterial( GetChaosPerksIcon( f28_arg1 ) ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f28_local7.id = "perkIcon" + f28_local5:addElement( f28_local7 ) + return self +end + +function chaos_perk_unlock( f32_arg0, f32_arg1 ) + assert( f32_arg1.perksWidget ) + local f32_local0 = {} + local f32_local1 = 16 + local self = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 114, + height = 0, + left = 0, + right = 0 + } ) + self.id = "chaos_perk_unlock" + self.lastUnlockTime = 0 + self:registerOmnvarHandler( "ui_chaos_perk", function ( f33_arg0, f33_arg1 ) + if f33_arg1.value > 0 and #f32_local0 < f32_local1 then + table.insert( f32_local0, f33_arg1.value ) + end + end ) + self:registerEventHandler( "refresh_unlock_perk", function ( element, event ) + local f34_local0 = Game.GetTime() + if #f32_local0 > 0 and f0_local1 + 400 < f34_local0 - element.lastUnlockTime then + local f34_local1 = chaos_perk_unlock_one( f32_arg1.perksWidget, f32_local0[1] ) + table.remove( f32_local0, 1 ) + element:addElement( f34_local1 ) + element.lastUnlockTime = f34_local0 + Engine.PlaySound( "mp_intel_success" ) + end + end ) + local f32_local3 = LUI.UITimer.new( 100, "refresh_unlock_perk" ) + f32_local3.id = "refreshTimer" + self:addElement( f32_local3 ) + return self +end + +maxVisibleChaosLogEvents = 5 +ChaosEventLUT = { + file = "mp/alien/chaos_events.csv", + size = 256, + index = 2, + text = 3, + points = 5, + mp_alien_town = 6, + mp_alien_armory = 7, + mp_alien_beacon = 8, + mp_alien_dlc3 = 9, + mp_alien_last = 10 +} +function GetChaosEventInfo( f35_arg0 ) + return Engine.Localize( Engine.TableLookup( ChaosEventLUT.file, ChaosEventLUT.index, tostring( f35_arg0 ), ChaosEventLUT.text ) ), Engine.TableLookup( ChaosEventLUT.file, ChaosEventLUT.index, tostring( f35_arg0 ), ChaosEventLUT.points ) +end + +function ChaosEventFactory( f36_arg0, f36_arg1 ) + local f36_local0 = 12000 + local f36_local1, f36_local2 = GetChaosEventInfo( f36_arg0 ) + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 1, + left = -80, + right = -80, + alpha = 0 + } ) + self:registerAnimationState( "opening", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + height = 20, + left = 0, + right = 0, + scale = 0.05, + alpha = 1 + } ) + self:registerAnimationState( "visible", { + scale = 0, + alpha = 1 + } ) + self:registerAnimationState( "closed", { + alpha = 0 + } ) + self:setUseStencil( true ) + self.id = "event_" .. f36_arg1 + local f36_local4 = CoD.TextSettings.SmallFont + local f36_local5, f36_local6, f36_local7, f36_local8 = GetTextDimensions( f36_local1, f36_local4.Font, f36_local4.Height ) + local f36_local9 = f36_local7 - f36_local5 + local f36_local10 = LUI.UIText.new( { + alignment = LUI.Alignment.Left, + font = f36_local4.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + width = f36_local9, + top = 0, + right = 0, + height = f36_local4.Height + } ) + f36_local10.id = "eventText" + f36_local10:setText( f36_local1 ) + self:addElement( f36_local10 ) + local f36_local11 = LUI.UIText.new( CoD.ColorizeState( Colors.alien_chaos_hilite, { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.SmallFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + right = -f36_local9 - 10, + top = 0, + width = 60, + height = CoD.TextSettings.SmallFont.Height + } ) ) + f36_local11.id = "eventPoints" + f36_local11:setText( f36_local2 ) + self:addElement( f36_local11 ) + local f36_local12 = MBh.AnimateSequence( { + { + "opening", + 100 + }, + { + "visible", + 150 + } + } ) + f36_local12( self, {} ) + self:registerEventHandler( "close", function ( element, event ) + if element.closing then + return + else + element.closing = true + element:animateToState( "closed", 250 ) + end + end ) + self:registerEventHandler( LUI.FormatAnimStateFinishEvent( "closed" ), self.close ) + self:registerEventHandler( "new_log_event", function ( element, event ) + if element.closing then + return + else + element.timesPushed = element.timesPushed and element.timesPushed + 1 or 1 + element:registerAnimationState( "target", { + scale = 0, + alpha = LUI.clamp( 1 - element.timesPushed / math.max( 1, maxVisibleChaosLogEvents ), 0, 1 ) + } ) + element:animateToState( "target", 100 ) + end + end ) + f36_local12 = LUI.UITimer.new( f36_local0, "close", nil, true ) + f36_local12.id = "expirationTimer" + self:addElement( f36_local12 ) + return self +end + +function chaos_event_log() + local f39_local0 = 0 + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 60, + bottom = 0, + width = 300, + right = 0 + } ) + self.id = "chaos_event_log" + local f39_local2 = LUI.UIVerticalList.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f39_local2.id = "vlist" + self:addElement( f39_local2 ) + local f39_local3 = function () + local f40_local0 = 0 + local f40_local1 = f39_local2:getFirstChild() + while f40_local1 do + if not f40_local1.closing then + f40_local0 = f40_local0 + 1 + end + f40_local1 = f40_local1:getNextSibling() + end + return f40_local0 + end + + local f39_local4 = function ( f41_arg0 ) + f39_local0 = f39_local0 + 1 + f39_local2:processEvent( { + name = "new_log_event" + } ) + local f41_local0 = ChaosEventFactory( f41_arg0, f39_local0 ) + f41_local0:setPriority( -f39_local0 ) + f39_local2:addElement( f41_local0 ) + if f39_local3() > maxVisibleChaosLogEvents then + local f41_local1 = f39_local2:getLastChild() + f41_local1:processEvent( { + name = "close" + } ) + end + end + + self:registerOmnvarHandler( "ui_chaos_event", function ( f42_arg0, f42_arg1 ) + f39_local4( f42_arg1.value ) + end ) + self:registerEventHandler( "fake_event", function () + f39_local4( 1 + math.floor( 8 * math.random() ) ) + end ) + return self +end + +function chaos_event_recap() + local f44_local0 = LUI.mp_hud.AlienScoreboards + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + scale = Engine.UsingSplitscreenUpscaling() and -0.25 or 0 + } ) + self.id = "chaos_event_recap" + local f44_local2 = f44_local0.table_factory( 21, { + 80, + 350, + 80 + }, 4, LUI.Alignment.Middle ) + f44_local2:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + left = -255, + width = 510, + bottom = 0 + } ) + f44_local2:animateToState( "default" ) + self:addElement( f44_local2 ) + f44_local2.addHeader( Engine.Localize( "ALIEN_CHAOS_RECAP_TITLE" ) ) + local f44_local3 = { + r = Colors.alien_tech_tree_bright_grey.r, + g = Colors.alien_tech_tree_bright_grey.g, + b = Colors.alien_tech_tree_bright_grey.b, + a = 1 + } + f44_local2.addRow( f44_local0.bgPalette.Dark, { + { + text = Engine.Localize( "ALIEN_CHAOS_RECAP_VALUE" ), + color = f44_local3, + align = LUI.Alignment.Left + }, + { + text = Engine.Localize( "ALIEN_CHAOS_RECAP_EVENT" ), + color = f44_local3, + align = LUI.Alignment.Center + }, + { + text = Engine.Localize( "ALIEN_CHAOS_RECAP_COUNT" ), + color = f44_local3, + align = LUI.Alignment.Left + } + }, false ) + local f44_local4 = 0 + local f44_local5 = Engine.GetDvarString( "ui_mapname" ) + repeat + if Engine.TableLookupByRow( ChaosEventLUT.file, f44_local4, 0 ) == "" then + break + else + local f44_local6 = Engine.TableLookupByRow( ChaosEventLUT.file, f44_local4, ChaosEventLUT.index ) + local f44_local7 = true + if ChaosEventLUT[f44_local5] then + f44_local7 = tonumber( Engine.TableLookupByRow( ChaosEventLUT.file, f44_local4, ChaosEventLUT[f44_local5] ) ) == 1 + end + if f44_local6 and tonumber( f44_local6 ) and tonumber( f44_local6 ) > 0 and f44_local7 then + local f44_local8 = Game.GetOmnvar( "ui_alien_eog_score_row_" .. f44_local6 ) + if f44_local8 then + local f44_local9, f44_local10 = GetChaosEventInfo( f44_local6 ) + f44_local2.addRow( f44_local0.bgPalette.Dark, { + { + text = f44_local10, + color = Colors.alien_scoreboard_dull_grey, + align = LUI.Alignment.Right + }, + { + text = f44_local9, + color = Colors.alien_scoreboard_dull_grey, + align = LUI.Alignment.Left + }, + { + text = f44_local8, + color = Colors.alien_chaos_hilite, + align = LUI.Alignment.Left, + pretty = { + initialValue = 0, + speed = math.max( 40, f44_local10 / 3 ) + } + } + }, 40 ) + end + end + f44_local4 = f44_local4 + 1 + end + until f44_local4 >= ChaosEventLUT.size + return self +end + +function quick_shop_freeze_item() + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + } ) + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self.id = "element" + local f45_local1 = function ( f46_arg0, f46_arg1 ) + local f46_local0 = f46_arg0 + local f46_local1 = f46_arg0.animateToState + local f46_local2 + if f46_arg1 then + f46_local2 = "visible" + if not f46_local2 then + + else + f46_local1( f46_local0, f46_local2, 100 ) + end + end + f46_local2 = "default" + end + + self:registerOmnvarHandler( "ui_alien_chaos_has_meter_freeze", function ( f47_arg0, f47_arg1 ) + f45_local1( f47_arg0, f47_arg1.value ) + end ) + f45_local1( self, Game.GetOmnvar( "ui_alien_chaos_has_meter_freeze" ) ) + self:addElement( LUI.mp_hud.AlienHud.quick_shop_item( LUI.Alignment.Bottom, nil, function () + return "alien_dpad_icon_freeze" + end ) ) + return self +end + +function chaos_class_skill_item() + local f49_local0 = 40 + local f49_local1 = 8 + local self = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -210, + bottom = -170, + left = -100, + right = -60, + alpha = 1 + } ) + self.id = "chaos_class_skill_item" + local f49_local3 = LUI.UIImage.new() + f49_local3.id = "arrow" + f49_local3:registerAnimationState( "default", { + material = RegisterMaterial( "alien_dpad_arrow_up" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -9, + left = -30, + width = 21, + height = 11, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f49_local3:registerAnimationState( "enabled", CoD.ColorizeState( Colors.white, { + alpha = 0.8 + } ) ) + f49_local3:animateToState( "default" ) + f49_local3:registerOmnvarHandler( "ui_alien_chaos_class_skill_bonus", function ( f50_arg0, f50_arg1 ) + if f50_arg1.value == 0 then + f50_arg0:animateToState( "default" ) + else + f50_arg0:animateToState( "enabled" ) + end + end ) + local f49_local4 = LUI.UIImage.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -50, + bottom = -10, + left = 0, + right = 0, + alpha = 1 + } ) + f49_local4:registerAnimationState( "hidden", { + material = RegisterMaterial( "white" ), + alpha = 0 + } ) + f49_local4:registerAnimationState( "specialist", { + material = RegisterMaterial( "hud_alien_ammo_infinite" ), + alpha = 1 + } ) + f49_local4:registerAnimationState( "tank", { + material = RegisterMaterial( "alien_icon_tank" ), + alpha = 1 + } ) + f49_local4:registerAnimationState( "engineer", { + material = RegisterMaterial( "alien_icon_engineer" ), + alpha = 1 + } ) + f49_local4:registerAnimationState( "medic", { + material = RegisterMaterial( "alien_icon_medic" ), + alpha = 1 + } ) + f49_local4:animateToState( "hidden" ) + f49_local4:registerOmnvarHandler( "ui_alien_chaos_class_skill_bonus", function ( f51_arg0, f51_arg1 ) + if f51_arg1.value == 0 then + f51_arg0:animateToState( "hidden" ) + elseif f51_arg1.value == 1 then + f51_arg0:animateToState( "specialist" ) + elseif f51_arg1.value == 2 then + f51_arg0:animateToState( "tank" ) + elseif f51_arg1.value == 3 then + f51_arg0:animateToState( "engineer" ) + elseif f51_arg1.value == 4 then + f51_arg0:animateToState( "medic" ) + end + end ) + self:addElement( f49_local4 ) + self:addElement( f49_local3 ) + return self +end + +LUI.MenuBuilder.registerType( "chaos_main_score", chaos_main_score ) +LUI.MenuBuilder.registerType( "chaos_combo_meter", chaos_combo_meter ) +LUI.MenuBuilder.registerType( "chaos_clock", chaos_clock ) +LUI.MenuBuilder.registerType( "chaos_perks", chaos_perks ) +LUI.MenuBuilder.registerType( "chaos_perk_unlock", chaos_perk_unlock ) +LUI.MenuBuilder.registerType( "chaos_event_log", chaos_event_log ) +LUI.MenuBuilder.registerType( "chaos_event_recap", chaos_event_recap ) +LUI.MenuBuilder.registerType( "quick_shop_freeze_item", quick_shop_freeze_item ) +LUI.MenuBuilder.registerType( "chaos_class_skill_item", chaos_class_skill_item ) +LockTable( _M ) diff --git a/lui/mp_hud/alienhud.dec.lua b/lui/mp_hud/alienhud.dec.lua new file mode 100644 index 0000000..5932689 --- /dev/null +++ b/lui/mp_hud/alienhud.dec.lua @@ -0,0 +1,6534 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function gradient_bar_factory( f1_arg0, f1_arg1, f1_arg2, f1_arg3, f1_arg4, f1_arg5, f1_arg6, f1_arg7, f1_arg8 ) + local self = LUI.UIImage.new() + self.id = "cap" + local f1_local1 = self + local f1_local2 = self.registerAnimationState + local f1_local3 = "default" + local f1_local4 = { + material = RegisterMaterial( "hud_health_bar_ltcap" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false + } + if f1_arg5 then + local f1_local5 = f1_arg8 + end + f1_local4.left = f1_local5 or 0 + local f1_local6 + if f1_arg5 then + f1_local6 = 0 + if not f1_local6 then + + else + f1_local4.right = f1_local6 + if f1_arg6 then + local f1_local7 = f1_arg3 + end + f1_local4.top = f1_local7 or 0 + if f1_arg6 then + f1_local6 = 0 + if not f1_local6 then + + else + f1_local4.bottom = f1_local6 + f1_local2( f1_local1, f1_local3, f1_local4 ) + self:animateToState( "default" ) + f1_local2 = LUI.UIImage.new() + f1_local2.id = "fill" + f1_local2:setupUIScorebar( f1_arg1 ) + f1_local3 = f1_local2 + f1_local1 = f1_local2.registerAnimationState + f1_local4 = "default" + f1_local6 = { + material = RegisterMaterial( "hud_health_bar_mid" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 0, + right = 0 + } + if f1_arg6 then + local f1_local8 = f1_arg3 + end + f1_local6.top = f1_local8 or 0 + local f1_local9 + if f1_arg6 then + f1_local9 = 0 + if not f1_local9 then + + else + f1_local6.bottom = f1_local9 + f1_local1( f1_local3, f1_local4, f1_local6 ) + f1_local2:animateToState( "default" ) + f1_local1 = LUI.UIHorizontalList.new() + f1_local1.id = "bar" + f1_local4 = f1_local1 + f1_local3 = f1_local1.registerAnimationState + f1_local6 = "default" + f1_local9 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0 + } + local f1_local10 + if f1_arg7 then + f1_local10 = 0 + if not f1_local10 then + if f1_arg5 then + f1_local10 = -f1_arg8 * 0.6 + if not f1_local10 then + + else + f1_local9.left = f1_local10 + if f1_arg7 then + f1_local10 = 0 + if not f1_local10 then + if f1_arg5 then + f1_local10 = 0 + if not f1_local10 then + + else + f1_local9.right = f1_local10 + if f1_arg5 then + f1_local10 = LUI.Alignment.Left + if not f1_local10 then + + else + f1_local9.alignment = f1_local10 + f1_local3( f1_local4, f1_local6, f1_local9 ) + f1_local1:animateToState( "default" ) + f1_local1:addElement( f1_local2 ) + f1_local1:addElement( self ) + f1_local3 = LUI.UIElement.new() + f1_local3:setUseStencil( true ) + f1_local3.id = f1_arg0 .. "_bar" + f1_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f1_local3:animateToState( "default" ) + f1_local3:addElement( f1_local1 ) + f1_local3.colorize = function ( f2_arg0 ) + local f2_local0 = f2_arg0.r * 100 + f2_arg0.g * 10 + f2_arg0.b + if f1_local3.currentColor ~= f2_local0 then + f1_local3.currentColor = f2_local0 + f1_local2:registerAnimationState( "current", CoD.ColorizeState( f2_arg0 ) ) + f1_local2:animateToState( "current" ) + self:registerAnimationState( "current", CoD.ColorizeState( f2_arg0 ) ) + self:animateToState( "current" ) + end + end + + f1_local3.setMax = function ( f3_arg0, f3_arg1 ) + f1_local2.m_maxScore = f3_arg0 + f1_local2.m_maxWidth = f3_arg1 - f1_arg8 * (f1_arg7 and 1 or 0.4) + end + + f1_local3.setMax( f1_arg4, f1_arg2 ) + return f1_local3 + end + end + f1_local10 = LUI.Alignment.Right + end + end + f1_local10 = f1_arg8 * 0.6 + end + else + if f1_arg5 then + f1_local10 = 0 + if not f1_local10 then + + else + f1_local9.right = f1_local10 + if f1_arg5 then + f1_local10 = LUI.Alignment.Left + if not f1_local10 then + + else + f1_local9.alignment = f1_local10 + f1_local3( f1_local4, f1_local6, f1_local9 ) + f1_local1:animateToState( "default" ) + f1_local1:addElement( f1_local2 ) + f1_local1:addElement( self ) + f1_local3 = LUI.UIElement.new() + f1_local3:setUseStencil( true ) + f1_local3.id = f1_arg0 .. "_bar" + f1_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f1_local3:animateToState( "default" ) + f1_local3:addElement( f1_local1 ) + f1_local3.colorize = function ( f2_arg0 ) + local f2_local0 = f2_arg0.r * 100 + f2_arg0.g * 10 + f2_arg0.b + if f1_local3.currentColor ~= f2_local0 then + f1_local3.currentColor = f2_local0 + f1_local2:registerAnimationState( "current", CoD.ColorizeState( f2_arg0 ) ) + f1_local2:animateToState( "current" ) + self:registerAnimationState( "current", CoD.ColorizeState( f2_arg0 ) ) + self:animateToState( "current" ) + end + end + + f1_local3.setMax = function ( f3_arg0, f3_arg1 ) + f1_local2.m_maxScore = f3_arg0 + f1_local2.m_maxWidth = f3_arg1 - f1_arg8 * (f1_arg7 and 1 or 0.4) + end + + f1_local3.setMax( f1_arg4, f1_arg2 ) + return f1_local3 + end + end + f1_local10 = LUI.Alignment.Right + end + end + f1_local10 = f1_arg8 * 0.6 + end + f1_local9.right = f1_local10 + if f1_arg5 then + f1_local10 = LUI.Alignment.Left + if not f1_local10 then + + else + f1_local9.alignment = f1_local10 + f1_local3( f1_local4, f1_local6, f1_local9 ) + f1_local1:animateToState( "default" ) + f1_local1:addElement( f1_local2 ) + f1_local1:addElement( self ) + f1_local3 = LUI.UIElement.new() + f1_local3:setUseStencil( true ) + f1_local3.id = f1_arg0 .. "_bar" + f1_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f1_local3:animateToState( "default" ) + f1_local3:addElement( f1_local1 ) + f1_local3.colorize = function ( f2_arg0 ) + local f2_local0 = f2_arg0.r * 100 + f2_arg0.g * 10 + f2_arg0.b + if f1_local3.currentColor ~= f2_local0 then + f1_local3.currentColor = f2_local0 + f1_local2:registerAnimationState( "current", CoD.ColorizeState( f2_arg0 ) ) + f1_local2:animateToState( "current" ) + self:registerAnimationState( "current", CoD.ColorizeState( f2_arg0 ) ) + self:animateToState( "current" ) + end + end + + f1_local3.setMax = function ( f3_arg0, f3_arg1 ) + f1_local2.m_maxScore = f3_arg0 + f1_local2.m_maxWidth = f3_arg1 - f1_arg8 * (f1_arg7 and 1 or 0.4) + end + + f1_local3.setMax( f1_arg4, f1_arg2 ) + return f1_local3 + end + end + f1_local10 = LUI.Alignment.Right + end + end + f1_local10 = 0 + end + else + if f1_arg5 then + f1_local10 = -f1_arg8 * 0.6 + if not f1_local10 then + + else + f1_local9.left = f1_local10 + if f1_arg7 then + f1_local10 = 0 + if not f1_local10 then + if f1_arg5 then + f1_local10 = 0 + if not f1_local10 then + + else + f1_local9.right = f1_local10 + if f1_arg5 then + f1_local10 = LUI.Alignment.Left + if not f1_local10 then + + else + f1_local9.alignment = f1_local10 + f1_local3( f1_local4, f1_local6, f1_local9 ) + f1_local1:animateToState( "default" ) + f1_local1:addElement( f1_local2 ) + f1_local1:addElement( self ) + f1_local3 = LUI.UIElement.new() + f1_local3:setUseStencil( true ) + f1_local3.id = f1_arg0 .. "_bar" + f1_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f1_local3:animateToState( "default" ) + f1_local3:addElement( f1_local1 ) + f1_local3.colorize = function ( f2_arg0 ) + local f2_local0 = f2_arg0.r * 100 + f2_arg0.g * 10 + f2_arg0.b + if f1_local3.currentColor ~= f2_local0 then + f1_local3.currentColor = f2_local0 + f1_local2:registerAnimationState( "current", CoD.ColorizeState( f2_arg0 ) ) + f1_local2:animateToState( "current" ) + self:registerAnimationState( "current", CoD.ColorizeState( f2_arg0 ) ) + self:animateToState( "current" ) + end + end + + f1_local3.setMax = function ( f3_arg0, f3_arg1 ) + f1_local2.m_maxScore = f3_arg0 + f1_local2.m_maxWidth = f3_arg1 - f1_arg8 * (f1_arg7 and 1 or 0.4) + end + + f1_local3.setMax( f1_arg4, f1_arg2 ) + return f1_local3 + end + end + f1_local10 = LUI.Alignment.Right + end + end + f1_local10 = f1_arg8 * 0.6 + end + else + if f1_arg5 then + f1_local10 = 0 + if not f1_local10 then + + else + f1_local9.right = f1_local10 + if f1_arg5 then + f1_local10 = LUI.Alignment.Left + if not f1_local10 then + + else + f1_local9.alignment = f1_local10 + f1_local3( f1_local4, f1_local6, f1_local9 ) + f1_local1:animateToState( "default" ) + f1_local1:addElement( f1_local2 ) + f1_local1:addElement( self ) + f1_local3 = LUI.UIElement.new() + f1_local3:setUseStencil( true ) + f1_local3.id = f1_arg0 .. "_bar" + f1_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f1_local3:animateToState( "default" ) + f1_local3:addElement( f1_local1 ) + f1_local3.colorize = function ( f2_arg0 ) + local f2_local0 = f2_arg0.r * 100 + f2_arg0.g * 10 + f2_arg0.b + if f1_local3.currentColor ~= f2_local0 then + f1_local3.currentColor = f2_local0 + f1_local2:registerAnimationState( "current", CoD.ColorizeState( f2_arg0 ) ) + f1_local2:animateToState( "current" ) + self:registerAnimationState( "current", CoD.ColorizeState( f2_arg0 ) ) + self:animateToState( "current" ) + end + end + + f1_local3.setMax = function ( f3_arg0, f3_arg1 ) + f1_local2.m_maxScore = f3_arg0 + f1_local2.m_maxWidth = f3_arg1 - f1_arg8 * (f1_arg7 and 1 or 0.4) + end + + f1_local3.setMax( f1_arg4, f1_arg2 ) + return f1_local3 + end + end + f1_local10 = LUI.Alignment.Right + end + end + f1_local10 = f1_arg8 * 0.6 + end + -- ERROR: Infinite loop detected + end + end + f1_local10 = 0 + end + f1_local9.left = f1_local10 + if f1_arg7 then + f1_local10 = 0 + if not f1_local10 then + if f1_arg5 then + f1_local10 = 0 + if not f1_local10 then + + else + -- ERROR: Infinite loop detected + end + end + f1_local10 = f1_arg8 * 0.6 + end + else + -- ERROR: Infinite loop detected + end + -- ERROR: Infinite loop detected + end + end + f1_local9 = f1_arg3 + end + end + f1_local6 = f1_arg3 + end + end + f1_local6 = f1_arg8 +end + +function PauseAction( f4_arg0, f4_arg1 ) + if Engine.GetDvarString( "ui_game_state" ) == "postgame" == false then + f4_arg0.is_paused = true + LUI.FlowManager.RequestAddMenu( f4_arg0, "mp_pause_menu", true, f4_arg1.controller, false ) + end + UpdateHUDVisibility( f4_arg0 ) +end + +function UnpauseAction( f5_arg0, f5_arg1 ) + f5_arg0.is_paused = false + UpdateHUDVisibility( f5_arg0 ) +end + +function PushTechTreeAction( f6_arg0, f6_arg1 ) + f6_arg0.is_tech_tree_open = true + UpdateHUDVisibility( f6_arg0 ) +end + +function PopTechTreeAction( f7_arg0, f7_arg1 ) + f7_arg0.is_tech_tree_open = false + UpdateHUDVisibility( f7_arg0 ) +end + +function OpenTechTree( f8_arg0, f8_arg1 ) + if LUI.FlowManager.AnyActiveMenusInStack( f8_arg0:getRootParent() ) then + return + elseif Game.IsSpectating() then + return + elseif Engine.GetDvarString( "ui_game_state" ) == "postgame" then + return + elseif Game.GetOmnvar( "ui_alien_player_in_laststand" ) then + return + elseif not isPostGame then + LUI.FlowManager.RequestAddMenu( f8_arg0, "alien_tech_tree", true, f8_arg1.controller, false ) + end +end + +function CloseTechTree( f9_arg0, f9_arg1 ) + LUI.FlowManager.RequestLeaveMenuByName( "alien_tech_tree" ) +end + +function ToggleTechTree( f10_arg0, f10_arg1 ) + local f10_local0 = LUI.FlowManager.IsInStack + local f10_local1 = f10_arg0:getRootParent() + if f10_local0( f10_local1.flowManager, "alien_tech_tree" ) then + CloseTechTree( f10_arg0, f10_arg1 ) + else + OpenTechTree( f10_arg0, f10_arg1 ) + end +end + +function spectating() + local self = LUI.UIElement.new() + self.id = "spectating" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f11_local1 = LUI.UIText.new() + f11_local1.id = "spectating" + f11_local1:setText( Engine.Localize( "@LUA_MENU_SPECTATING_CAPS" ) ) + f11_local1:setTextStyle( CoD.TextStyle.Shadowed ) + f11_local1:registerAnimationState( "default", { + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = 0, + right = 0, + height = CoD.TextSettings.HudEuroBigFont.Height, + alpha = 0 + } ) + f11_local1:registerAnimationState( "visible", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 60, + right = 0, + height = CoD.TextSettings.HudEuroBigFont.Height, + alpha = 0.6 + } ) + f11_local1:registerOmnvarHandler( "ui_session_state", function ( f12_arg0, f12_arg1 ) + if f12_arg1.value == "spectator" then + f12_arg0:animateToState( "visible", 150 ) + else + f12_arg0:animateToState( "default", 150 ) + end + end ) + f11_local1:animateToState( "default" ) + self:addElement( f11_local1 ) + self:addElement( LUI.mp_hud.Hints.spectatorControlsDef() ) + return self +end + +function clips_and_ammo() + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -33, + left = 0, + right = -45, + alpha = 1 + } ) + self:registerAnimationState( "animateIn", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -33, + left = 0, + right = 55, + alpha = 0 + } ) + self:registerAnimationState( "animateOut", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -33, + bottom = -66, + left = 0, + right = -45, + alpha = 0 + } ) + self.id = "clips_and_ammo" + local f13_local1 = LUI.UIText.new( { + font = CoD.TextSettings.HudDigitalNormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = -105, + right = -105, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + bottom = 0, + alpha = 0 + } ) + f13_local1:registerAnimationState( "visible", { + alpha = 1 + } ) + f13_local1.id = "clipAmmoLeft" + f13_local1:setupUIBindText( "ClipAmmoLeft" ) + self:addElement( f13_local1 ) + local f13_local2 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_alien_ammo_bg_line" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + right = -76, + bottom = -2, + width = 2, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + alpha = 0 + } ) + f13_local2:registerAnimationState( "visible", { + alpha = 1 + } ) + f13_local2.id = "hud_alien_ammo_bg_line" + self:addElement( f13_local2 ) + local f13_local3 = LUI.UIText.new( { + font = CoD.TextSettings.HudDigitalNormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = -60, + right = -60, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + bottom = 0 + } ) + f13_local3.id = "clipAmmoRight" + f13_local3:setupUIBindText( "ClipAmmoRight" ) + self:addElement( f13_local3 ) + local f13_local4 = LUI.UIText.new( { + font = CoD.TextSettings.HudDigitalNormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = -21, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + bottom = 0, + alpha = 0.8 + } ) + f13_local4.id = "slash" + f13_local4:setText( "/" ) + self:addElement( f13_local4 ) + local f13_local5 = LUI.UIText.new( { + font = CoD.TextSettings.HudDigitalNormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + bottom = 0, + right = 0, + left = 0 + } ) + f13_local5.id = "stockAmmo" + f13_local5:setupUIBindText( "StockAmmo" ) + self:addElement( f13_local5 ) + self:registerEventHandler( "weapon_change", function ( element, event ) + if string.find( event.weapon_name, "akimbo" ) then + f13_local1:animateToState( "visible" ) + f13_local2:animateToState( "visible" ) + else + f13_local1:animateToState( "default" ) + f13_local2:animateToState( "default" ) + end + end ) + return self +end + +function weapon_info() + local self = LUI.UIImage.new() + self.id = "hud_alien_ammo_bg" + self:registerAnimationState( "default", { + material = RegisterMaterial( "hud_alien_ammo_bg" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + right = 0, + bottom = 0, + width = 184, + height = 97, + alpha = 0.25 + } ) + self:animateToState( "default" ) + local f15_local1 = LUI.UIImage.new() + f15_local1.id = "specialammo_icon" + f15_local1:registerAnimationState( "hidden", { + material = RegisterMaterial( "alien_dpad_icon_ammo_stun" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + right = -174, + bottom = -20, + height = 40, + width = 40, + alpha = 0 + } ) + f15_local1:registerAnimationState( "stun", { + material = RegisterMaterial( "alien_dpad_icon_ammo_stun" ), + alpha = 1 + } ) + f15_local1:registerAnimationState( "incendiary", { + material = RegisterMaterial( "alien_dpad_icon_ammo_incendiary" ), + alpha = 1 + } ) + f15_local1:registerAnimationState( "explosive", { + material = RegisterMaterial( "alien_dpad_icon_ammo_explosive" ), + alpha = 1 + } ) + f15_local1:registerAnimationState( "piercing", { + material = RegisterMaterial( "alien_dpad_icon_ammo_piercing" ), + alpha = 1 + } ) + f15_local1:registerAnimationState( "combined", { + material = RegisterMaterial( "alien_dpad_icon_ammo_combined" ), + alpha = 1 + } ) + f15_local1:animateToState( "hidden" ) + f15_local1:registerOmnvarHandler( "ui_alien_specialammo", function ( f16_arg0, f16_arg1 ) + if f16_arg1.value < 0 then + f16_arg0:animateToState( "hidden" ) + elseif f16_arg1.value == 1 then + f16_arg0:animateToState( "stun" ) + elseif f16_arg1.value == 2 then + f16_arg0:animateToState( "incendiary" ) + elseif f16_arg1.value == 3 then + f16_arg0:animateToState( "explosive" ) + elseif f16_arg1.value == 4 then + f16_arg0:animateToState( "piercing" ) + elseif f16_arg1.value == 5 then + f16_arg0:animateToState( "combined" ) + end + end ) + local f15_local2 = LUI.UIImage.new() + f15_local2.id = "turretAmmoIcon" + f15_local2:registerAnimationState( "default", { + material = RegisterMaterial( "alien_icon_sentry" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + right = -300, + bottom = -32, + height = 40, + width = 40, + alpha = 0 + } ) + f15_local2:registerAnimationState( "sentry", { + material = RegisterMaterial( "alien_icon_sentry" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + right = -300, + bottom = -32, + height = 40, + alpha = 1, + width = 40 + } ) + f15_local2:registerAnimationState( "minigun", { + material = RegisterMaterial( "hud_icon_minigun" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + right = -300, + bottom = -32, + height = 40, + width = 70, + alpha = 1 + } ) + local f15_local3 = LUI.UIText.new() + f15_local3.id = "turretAmmoCount" + f15_local3:registerAnimationState( "default", { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.HudDigitalNormalFont.Font, + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + right = -218, + bottom = -26, + height = 40, + width = 40, + alpha = 0 + } ) + f15_local3:registerAnimationState( "visible", { + alpha = 1 + } ) + f15_local3:animateToState( "default" ) + f15_local2:animateToState( "default" ) + f15_local2:registerOmnvarHandler( "ui_alien_turret", function ( f17_arg0, f17_arg1 ) + if f17_arg1.value == 1 then + f17_arg0:animateToState( "sentry" ) + elseif f17_arg1.value == 2 then + f17_arg0:animateToState( "minigun" ) + else + f17_arg0:animateToState( "default" ) + end + end ) + f15_local3:registerOmnvarHandler( "ui_alien_turret_ammo", function ( f18_arg0, f18_arg1 ) + if f18_arg1.value > 0 then + f18_arg0:animateToState( "visible" ) + f18_arg0:setText( f18_arg1.value ) + else + f18_arg0:animateToState( "default" ) + end + end ) + local f15_local4 = 118 + local f15_local5 = 2 + local f15_local6 = LUI.UIImage.new() + f15_local6.id = "fillBG" + f15_local6:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + font = CoD.TextSettings.HudDigitalNormalFont.Font, + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + right = -220, + bottom = -24, + height = 8, + width = f15_local4, + red = 0, + green = 0, + blue = 0, + alpha = 0 + } ) + f15_local6:animateToState( "default" ) + f15_local6:registerAnimationState( "visible", { + alpha = 1 + } ) + local f15_local7 = LUI.UIImage.new() + f15_local7.id = "OverheatBar" + f15_local7:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + left = -220 - f15_local4 + f15_local5, + bottom = -26, + height = 4, + width = 0, + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + alpha = 0 + } ) + f15_local7:animateToState( "default" ) + f15_local7:registerAnimationState( "visible", { + alpha = 1 + } ) + f15_local7:registerOmnvarHandler( "ui_alien_turret_overheat", function ( f19_arg0, f19_arg1 ) + if f19_arg1.value > -1 then + f15_local6:animateToState( "visible" ) + f19_arg0:animateToState( "visible" ) + elseif f19_arg1.value < 0 then + f15_local6:animateToState( "default" ) + f19_arg0:animateToState( "default" ) + end + local f19_local0 = LUI.clamp( f19_arg1.value, 0, 100 ) / 100 + local f19_local1 = CoD.GradientMap( { + { + threshold = 0, + color = { + r = 1, + g = 1, + b = 1 + } + }, + { + threshold = 0.5, + color = { + r = 1, + g = 1, + b = 0 + } + }, + { + threshold = 1, + color = { + r = 1, + g = 0, + b = 0 + } + } + }, f19_local0 ) + f19_arg0:registerAnimationState( "updated", { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + left = -220 - f15_local4 + f15_local5, + bottom = -26, + height = 4, + width = (f15_local4 - 2 * f15_local5) * f19_local0, + alpha = 1 + } ) + f19_arg0:animateToState( "updated" ) + f19_arg0:registerAnimationState( "current", CoD.ColorizeState( f19_local1 ) ) + f19_arg0:animateToState( "current" ) + end ) + local f15_local8 = LUI.UIText.new() + f15_local8.id = "weapon" + f15_local8:setTextStyle( CoD.TextStyle.Shadowed ) + f15_local8:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = -22, + height = CoD.TextSettings.NormalFont.Height, + bottom = -58 + } ) ) + f15_local8:animateToState( "default" ) + local f15_local9 = clips_and_ammo() + local f15_local10 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_alien_ammo_infinite" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + height = 32, + bottom = -33, + width = 64, + right = -25, + alpha = 1 + } ) + f15_local10:registerAnimationState( "animateIn", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + height = 32, + bottom = -33, + width = 64, + right = 50, + alpha = 0 + } ) + f15_local10:registerAnimationState( "animateOut", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + height = 32, + bottom = -66, + width = 64, + right = -25, + alpha = 0 + } ) + f15_local10:animateToState( "animateIn" ) + f15_local10.id = "infiniteAmmo" + local f15_local11 = LUI.UIElement.new() + f15_local11.id = "grenades" + f15_local11:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = -14, + height = 16, + right = -20, + left = 0 + } ) + f15_local11:animateToState( "default" ) + for f15_local12 = 1, 5, 1 do + local f15_local15 = f15_local12 + local f15_local16 = LUI.UIImage.new() + f15_local16:setupUIBindImage( "FragMaterial" ) + f15_local16.id = "grenade_" .. f15_local15 + f15_local16:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + right = (1 - f15_local15) * 12, + width = 16, + height = 16, + alpha = 0 + } ) + f15_local16:registerAnimationState( "visible", { + alpha = 1 + } ) + f15_local16:animateToState( "default" ) + f15_local16:registerEventHandler( "grenade_count_update", function ( element, event ) + if event.oldValue < f15_local15 and f15_local15 <= event.newValue then + f15_local16:animateToState( "visible" ) + elseif f15_local15 <= event.oldValue and event.newValue < f15_local15 then + f15_local16:animateToState( "default" ) + end + end ) + f15_local11:addElement( f15_local16 ) + end + local f15_local12 = LUI.UIElement.new() + f15_local12:setupUIIntWatch( "FragAmmo" ) + f15_local12.id = "grenade_ammo_watch" + f15_local12:registerEventHandler( "int_watch_alert", function ( element, event ) + event.name = "grenade_count_update" + f15_local11:processEvent( event ) + end ) + local f15_local13 = LUI.UIElement.new() + f15_local13.id = "tacticals" + f15_local13:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = -14, + height = 16, + right = -110, + left = 0 + } ) + f15_local13:animateToState( "default" ) + local f15_local14 = LUI.UIText.new() + f15_local14.id = "tactical_divider" + f15_local14:setText( "|" ) + f15_local14:registerAnimationState( "default", { + font = CoD.TextSettings.HudDigitalNormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + bottom = -12, + right = 30, + left = 0, + alpha = 0.35, + left = 0, + right = -80, + height = CoD.TextSettings.HudDigitalNormalFont.Height + } ) + f15_local14:animateToState( "default" ) + for f15_local15 = 1, 5, 1 do + local f15_local18 = f15_local15 + local f15_local19 = LUI.UIImage.new() + f15_local19:setupUIBindImage( "FlashMaterial" ) + f15_local19.id = "tactical" .. f15_local18 + f15_local19:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + left = (1 - f15_local18) * 10, + width = 16, + height = 16, + alpha = 0 + } ) + f15_local19:registerAnimationState( "visible", { + alpha = 1 + } ) + f15_local19:animateToState( "default" ) + f15_local19:registerEventHandler( "tactical_count_update", function ( element, event ) + if event.oldValue < f15_local18 and f15_local18 <= event.newValue then + f15_local19:animateToState( "visible" ) + elseif f15_local18 <= event.oldValue and event.newValue < f15_local18 then + f15_local19:animateToState( "default" ) + end + end ) + f15_local13:addElement( f15_local19 ) + end + local f15_local15 = LUI.UIElement.new() + f15_local15:setupUIIntWatch( "FlashAmmo" ) + f15_local15.id = "tactical_ammo_watch" + f15_local15:registerEventHandler( "int_watch_alert", function ( element, event ) + event.name = "tactical_count_update" + f15_local13:processEvent( event ) + end ) + local f15_local16 = LUI.UIElement.new() + f15_local16.id = "weapon_info" + f15_local16:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 13, + left = 0, + right = 17 + } ) + f15_local16:animateToState( "default" ) + f15_local16:addElement( self ) + f15_local16:addElement( f15_local9 ) + f15_local16:addElement( f15_local10 ) + f15_local16:addElement( f15_local8 ) + f15_local16:addElement( f15_local11 ) + f15_local16:addElement( f15_local13 ) + f15_local16:addElement( f15_local12 ) + f15_local16:addElement( f15_local15 ) + f15_local16:addElement( f15_local14 ) + f15_local16:addElement( f15_local1 ) + f15_local16:addElement( f15_local2 ) + f15_local16:addElement( f15_local3 ) + f15_local16:addElement( f15_local6 ) + f15_local16:addElement( f15_local7 ) + f15_local16:registerEventHandler( "weapon_change", function ( element, event ) + if event.display_name then + f15_local8:setText( event.display_name ) + end + end ) + f15_local16:registerOmnvarHandler( "ui_alien_unlimited_ammo", function ( f25_arg0, f25_arg1 ) + if f25_arg1.value then + local f25_local0 = MBh.AnimateSequence( { + { + "animateOut", + 200 + }, + { + "animateIn", + 0 + } + } ) + f25_local0( f15_local9 ) + f15_local10:animateToState( "default", 150 ) + else + local f25_local0 = MBh.AnimateSequence( { + { + "animateOut", + 200 + }, + { + "animateIn", + 0 + } + } ) + f25_local0( f15_local10 ) + f15_local9:animateToState( "default", 150 ) + end + end ) + return f15_local16 +end + +function nx1_custom_reticle() + local f26_local0 = Engine.GetLuiRoot() + local f26_local1 = f26_local0.m_controllerIndex + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self.id = "reticle_hud_root" + local f26_local3 = function ( f27_arg0, f27_arg1 ) + if f27_arg1 and 0 <= f27_arg1 then + f27_arg0:animateToState( "visible", 0 ) + f27_arg0:processEvent( { + name = "update_base_color" + } ) + f27_arg0:processEvent( { + name = "set_reticle_charges", + num_charges = f27_arg1 + } ) + else + f27_arg0:animateToState( "default", 0 ) + end + end + + local f26_local4 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + } ) + f26_local4:registerAnimationState( "visible", { + alpha = 1 + } ) + f26_local4.id = "nx1_custom_ret" + f26_local4:registerOmnvarHandler( "ui_custom_reticle_state", function ( f28_arg0, f28_arg1 ) + f26_local3( f28_arg0, f28_arg1.value ) + end ) + f26_local4:registerEventHandler( "custom_reticle_timer", function ( element, event ) + f26_local3( element, Game.GetOmnvar( "ui_custom_reticle_state" ) ) + end ) + f26_local4:addElement( LUI.UITimer.new( 50, "custom_reticle_timer", nil, false, false, false, false ) ) + local f26_local5 = LUI.UIImage.new( { + material = RegisterMaterial( "reticle_center_cook_white" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -20, + bottom = 20, + left = -20, + right = 20, + alpha = 0.5, + red = 1, + green = 1, + blue = 1 + } ) + f26_local5.id = "main_ret_image_id" + f26_local5:registerAnimationState( "charged", { + red = 0.9, + green = 0.6, + blue = 0 + } ) + f26_local5:registerEventHandler( "update_base_color", function ( element, event ) + local f30_local0 = 10 + if Engine.AliensCheckIsRelicEnabled( f26_local1, "nerf_min_ammo" ) then + f30_local0 = 5 + end + if f30_local0 <= Game.GetPlayerClipAmmo( 1 ) then + element:animateToState( "charged", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + local f26_local6 = LUI.UIImage.new( { + material = RegisterMaterial( "reticle_nx1_cook" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + red = 0.9, + green = 0.6, + blue = 0, + top = -20, + bottom = 0, + left = -20, + right = 0, + alpha = 0 + } ) + f26_local6:registerAnimationState( "visible", { + alpha = 1 + } ) + f26_local6.id = "main_ret_image_tl_id" + f26_local6:registerEventHandler( "set_reticle_charges", function ( element, event ) + if event.num_charges and event.num_charges >= 1 then + element:animateToState( "visible", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + local f26_local7 = LUI.UIImage.new( { + material = RegisterMaterial( "reticle_nx1_cook" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + red = 0.9, + green = 0.6, + blue = 0, + top = -20, + bottom = 0, + left = 20, + right = 0, + alpha = 0 + } ) + f26_local7:registerAnimationState( "visible", { + alpha = 1 + } ) + f26_local7.id = "main_ret_image_tr_id" + f26_local7:registerEventHandler( "set_reticle_charges", function ( element, event ) + if event.num_charges and event.num_charges >= 2 then + element:animateToState( "visible", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + local f26_local8 = LUI.UIImage.new( { + material = RegisterMaterial( "reticle_nx1_cook" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + red = 0.9, + green = 0.6, + blue = 0, + top = 20, + bottom = 0, + left = 20, + right = 0, + alpha = 0 + } ) + f26_local8:registerAnimationState( "visible", { + alpha = 1 + } ) + f26_local8.id = "main_ret_image_br_id" + f26_local8:registerEventHandler( "set_reticle_charges", function ( element, event ) + if event.num_charges and event.num_charges >= 3 then + element:animateToState( "visible", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + local f26_local9 = LUI.UIImage.new( { + material = RegisterMaterial( "reticle_nx1_cook" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + red = 0.9, + green = 0.6, + blue = 0, + top = 20, + bottom = 0, + left = -20, + right = 0, + alpha = 0 + } ) + f26_local9:registerAnimationState( "visible", { + alpha = 1 + } ) + f26_local9.id = "main_ret_image_bl_id" + f26_local9:registerEventHandler( "set_reticle_charges", function ( element, event ) + if event.num_charges and event.num_charges >= 4 then + element:animateToState( "visible", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + self:addElement( f26_local4 ) + f26_local4:addElement( f26_local5 ) + f26_local4:addElement( f26_local6 ) + f26_local4:addElement( f26_local7 ) + f26_local4:addElement( f26_local8 ) + f26_local4:addElement( f26_local9 ) + f26_local3( f26_local4, Game.GetOmnvar( "ui_custom_reticle_state" ) ) + return self +end + +f0_local0 = 140 +f0_local1 = 64 +function health_only() + local f35_local0 = 5 + local f35_local1 = 16 + local self = LUI.UIElement.new() + self.id = "health" + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -49, + left = 0, + right = 0, + height = 16 + } ) + self:animateToState( "default" ) + local f35_local3 = LUI.UIHorizontalList.new() + f35_local3.id = "healthBarBG" + f35_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alignment = LUI.Alignment.Left, + alpha = 0.5 + } ) + f35_local3:animateToState( "default" ) + local f35_local4 = LUI.UIImage.new() + f35_local4.id = "healthBarBGLeftCap" + f35_local4:registerAnimationState( "default", { + material = RegisterMaterial( "alien_health_bg_ltcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = f0_local1, + bottom = 0 + } ) + f35_local4:animateToState( "default" ) + f35_local3:addElement( f35_local4 ) + local f35_local5 = LUI.UIImage.new() + f35_local5.id = "healthBarBGFill" + f35_local5:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 5, + left = 0, + right = 0, + height = 11, + red = 0, + green = 0, + blue = 0 + } ) + f35_local5:animateToState( "default" ) + f35_local3:addElement( f35_local5 ) + local f35_local6 = LUI.UIImage.new() + f35_local6.id = "healthBarBGRightCap" + f35_local6:registerAnimationState( "default", { + material = RegisterMaterial( "alien_health_bg_rtcap" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 3, + left = 0, + width = f35_local1, + height = 16 + } ) + f35_local6:animateToState( "default" ) + f35_local3:addElement( f35_local6 ) + local f35_local7 = LUI.UIElement.new() + f35_local7.id = "healthBarContainer" + f35_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 7, + left = f0_local1, + right = 0, + height = 12 + } ) + f35_local7:animateToState( "default" ) + local f35_local8 = LUI.UIElement.new() + f35_local8.id = "healthBarTicks" + f35_local8:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 4, + left = 0, + right = 0, + height = 12 + } ) + f35_local8:animateToState( "default" ) + for f35_local9 = 0, f35_local0 - 1, 1 do + local f35_local12 = LUI.UIImage.new() + f35_local12.id = "tick_" .. f35_local9 + f35_local12:registerAnimationState( "default", { + material = RegisterMaterial( "alien_health_bg_tic" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = f0_local1 + f0_local0 * (1 + f35_local9 / 4) - 14, + width = 12, + height = 12, + alpha = 0 + } ) + f35_local12:registerAnimationState( "visible", { + alpha = 1 + } ) + f35_local12:animateToState( "default" ) + f35_local8:addElement( f35_local12 ) + f35_local8["tick_" .. f35_local9] = f35_local12 + end + local f35_local9 = LUI.UIImage.new() + f35_local9.id = "healthIcon" + f35_local9:registerAnimationState( "default", { + material = RegisterMaterial( "hud_health_plus_icon" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 2, + left = 42, + width = 13, + height = 13, + red = 0.55, + green = 0.78, + blue = 0.25 + } ) + f35_local9:animateToState( "default" ) + local f35_local10 = LUI.UIImage.new() + f35_local10.id = "riotshield" + f35_local10:registerAnimationState( "hidden", { + material = RegisterMaterial( "alien_icon_riot_shield" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -37, + left = 27, + width = 32, + height = 32, + alpha = 0 + } ) + f35_local10:registerAnimationState( "equipped", { + material = RegisterMaterial( "alien_icon_riot_shield" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -35, + left = 27, + width = 32, + height = 32, + alpha = 1 + } ) + f35_local10:animateToState( "hidden" ) + f35_local10:registerOmnvarHandler( "ui_alien_riotshield_equipped", function ( f36_arg0, f36_arg1 ) + if f36_arg1.value > 0 then + f36_arg0:animateToState( "equipped" ) + else + f36_arg0:animateToState( "hidden" ) + end + end ) + local f35_local11 = LUI.UIText.new() + f35_local11.id = "counter" + f35_local11:setTextStyle( CoD.TextStyle.Outlined ) + f35_local11:registerAnimationState( "default", { + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 55, + right = 0, + top = -5 - CoD.TextSettings.HudEuroMedTinyFont.Height / 2, + bottom = -5 + CoD.TextSettings.HudEuroMedTinyFont.Height / 2, + alpha = 1 + } ) + f35_local11:animateToState( "default" ) + f35_local11:registerAnimationState( "hidden", { + alpha = 0 + } ) + f35_local11:registerOmnvarHandler( "ui_alien_riotshield_equipped", function ( f37_arg0, f37_arg1 ) + if f37_arg1.value > 1 then + f35_local11:animateToState( "default", 250 ) + else + f35_local11:animateToState( "hidden", 250 ) + end + end ) + f35_local11:registerOmnvarHandler( "ui_alien_stowed_riotshield_ammo", function ( f38_arg0, f38_arg1 ) + f35_local11:setText( f38_arg1.value ) + end ) + local f35_local13 = nil + local f35_local12 = LUI.UIElement.new() + f35_local12:setupUIIntWatch( "PlayerHealth" ) + f35_local12.id = "health_watch" + local f35_local14 = function ( f39_arg0, f39_arg1 ) + local f39_local0 = 25 + if f35_local13 then + if f39_arg1.newValue <= f39_local0 then + f35_local13.colorize( { + r = 0.94, + g = 0.25, + b = 0 + } ) + elseif f39_local0 < f39_arg1.newValue then + f35_local13.colorize( { + r = 0.55, + g = 0.78, + b = 0.25 + } ) + end + end + end + + f35_local12:registerEventHandler( "int_watch_alert", f35_local14 ) + local f35_local15 = LUI.UIElement.new() + f35_local15:setupUIIntWatch( "PlayerMaxHealth" ) + f35_local15.id = "maxHealthWatch" + f35_local15:registerEventHandler( "int_watch_alert", function ( element, event ) + if event.newValue > 0 then + if not f35_local13 then + f35_local13 = gradient_bar_factory( "health", "PlayerHealth", 0, 12, event.newValue, true, false, false, 12 ) + f35_local7:addElement( f35_local13 ) + f35_local14( element, { + name = "int_watch_alert", + newValue = Game.GetPlayerHealth() + } ) + end + local f40_local0 = f0_local0 * event.newValue / 100 + self:registerAnimationState( "current", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -48, + left = 0, + right = f40_local0 + f0_local1, + height = 16 + } ) + f35_local13.setMax( event.newValue, f40_local0 ) + f35_local5:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 5, + left = 0, + right = f40_local0 - f35_local1, + height = 11 + } ) + self:animateToState( "current" ) + f35_local5:animateToState( "current" ) + for f40_local1 = 0, f35_local0 - 1, 1 do + if 100 + f40_local1 * 25 <= event.newValue then + f35_local8["tick_" .. f40_local1].animateToState( REG7["tick_" .. f40_local1], "visible" ) + else + f35_local8["tick_" .. f40_local1].animateToState( REG7["tick_" .. f40_local1], "default" ) + end + end + end + end ) + self:addElement( f35_local3 ) + self:addElement( f35_local9 ) + self:addElement( f35_local7 ) + self:addElement( f35_local8 ) + self:addElement( f35_local12 ) + self:addElement( f35_local15 ) + self:addElement( f35_local10 ) + self:addElement( f35_local11 ) + return self +end + +function shield_only() + local f41_local0 = 8 + local f41_local1 = f0_local0 * 1.25 + local self = LUI.UIElement.new() + self.id = "shield" + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -31, + left = 0, + right = f41_local1 + f0_local1, + height = 16 + } ) + self:animateToState( "default" ) + local f41_local3 = LUI.UIHorizontalList.new() + f41_local3.id = "shieldBarBG" + f41_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alignment = LUI.Alignment.Left, + alpha = 0.5 + } ) + f41_local3:animateToState( "default" ) + local f41_local4 = LUI.UIImage.new() + f41_local4.id = "shieldBarBGLeftCap" + f41_local4:registerAnimationState( "default", { + material = RegisterMaterial( "alien_shield_bg_ltcap" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = f0_local1, + bottom = 16 + } ) + f41_local4:animateToState( "default" ) + f41_local3:addElement( f41_local4 ) + local f41_local5 = LUI.UIImage.new() + f41_local5.id = "shieldBarBGFill" + f41_local5:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + right = f41_local1 - f41_local0, + height = 4, + red = 0, + green = 0, + blue = 0 + } ) + f41_local5:animateToState( "default" ) + f41_local3:addElement( f41_local5 ) + local f41_local6 = LUI.UIImage.new() + f41_local6.id = "shieldBarBGRightCap" + f41_local6:registerAnimationState( "default", { + material = RegisterMaterial( "alien_shield_bg_rtcap" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -6, + left = 0, + width = f41_local0, + height = 16 + } ) + f41_local6:animateToState( "default" ) + f41_local3:addElement( f41_local6 ) + local f41_local7 = LUI.UIImage.new() + f41_local7.id = "shieldBarTick" + f41_local7:registerAnimationState( "default", { + material = RegisterMaterial( "alien_shield_tic" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -9, + left = f0_local1 + f41_local1 - 10, + width = f41_local0, + bottom = 16 + } ) + f41_local7:animateToState( "default" ) + self:addElement( f41_local7 ) + local f41_local8 = LUI.UIElement.new() + f41_local8.id = "shieldBarContainer" + f41_local8:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -1, + left = f0_local1, + right = 0, + height = 4 + } ) + f41_local8:animateToState( "default" ) + local f41_local9 = LUI.UIImage.new() + f41_local9.id = "shieldIcon" + f41_local9:registerAnimationState( "default", { + material = RegisterMaterial( "hud_health_shield_icon" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 2, + left = 42, + width = 13, + height = 13, + red = 0, + green = 0.68, + blue = 0.94 + } ) + f41_local9:animateToState( "default" ) + local f41_local10 = gradient_bar_factory( "shield", "PlayerArmor", f0_local0, 4, 100, true, true, false, 8 ) + f41_local10.colorize( { + r = 0, + g = 0.68, + b = 0.94 + } ) + f41_local8:addElement( f41_local10 ) + self:addElement( f41_local3 ) + self:addElement( f41_local9 ) + self:addElement( f41_local8 ) + self:addElement( f41_local7 ) + return self +end + +function health_meter() + local self = LUI.UIElement.new() + self.id = "health_meter" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f42_local1 = LUI.UIImage.new() + f42_local1.id = "background" + f42_local1:registerAnimationState( "default", { + material = RegisterMaterial( "alien_health_bg_shadow" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -64, + bottom = 0, + left = 0, + right = 286, + alpha = 0.35 + } ) + f42_local1:animateToState( "default" ) + local f42_local2 + if Game.GetOmnvar( "ui_alien_is_solo" ) or LUI.mp_menus.Aliens.IsChaosMode() then + f42_local2 = 30 + if not f42_local2 then + + else + local f42_local3 = LUI.UIElement.new() + f42_local3.id = "health_meter" + f42_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 16, + left = -25 + f42_local2, + right = 0, + alpha = 1 + } ) + f42_local3:registerAnimationState( "animating", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 16, + left = -5 + f42_local2, + right = 0, + alpha = 1 + } ) + f42_local3:registerAnimationState( "hidden", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 16, + left = -345 + f42_local2, + right = 0, + alpha = 0 + } ) + f42_local3:animateToState( "default" ) + f42_local3:addElement( f42_local1 ) + f42_local3:addElement( health_only() ) + f42_local3:addElement( shield_only() ) + local f42_local4 = function ( f43_arg0, f43_arg1 ) + if f43_arg1.value then + local f43_local0 = MBh.AnimateSequence( { + { + "animating", + 125, + true, + true + }, + { + "hidden", + 250, + true, + true + } + } ) + f43_local0( f43_arg0, {} ) + else + local f43_local0 = MBh.AnimateSequence( { + { + "animating", + 250, + true, + true + }, + { + "default", + 125, + true, + true + } + } ) + f43_local0( f43_arg0, {} ) + end + end + + f42_local3:registerOmnvarHandler( "ui_alien_player_in_laststand", f42_local4 ) + local f42_local5 = Game.GetOmnvar( "ui_alien_player_in_laststand" ) + if f42_local5 then + f42_local4( f42_local3, { + value = f42_local5 + } ) + end + self:addElement( f42_local3 ) + if Engine.GetDvarString( "ui_mapname" ) == "mp_alien_beacon" or Engine.GetDvarString( "ui_mapname" ) == "mp_alien_dlc3" or Engine.GetDvarString( "ui_mapname" ) == "mp_alien_last" then + self:addElement( crafting_items( self ) ) + end + return self + end + end + f42_local2 = 0 +end + +function laststand_timer() + local self = LUI.UIElement.new() + self.id = "laststand_timer" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f44_local1 = LUI.UIElement.new() + if LUI.mp_menus.Aliens.IsChaosMode() and Engine.UsingSplitscreenUpscaling() then + f44_local1:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = -13, + left = 60, + width = 32, + height = 40, + alpha = 0 + } ) + else + f44_local1:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = -14, + left = -16, + right = 16, + height = 32, + alpha = 0 + } ) + end + f44_local1:registerAnimationState( "visible", { + alpha = 1 + } ) + f44_local1:animateToState( "default" ) + local f44_local2 = LUI.UIImage.new() + f44_local2.id = "laststand_icon" + f44_local2:registerAnimationState( "default", { + material = RegisterMaterial( "alien_icon_laststand" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + bottom = 0, + height = 32 + } ) + f44_local2:animateToState( "default" ) + f44_local1:addElement( f44_local2 ) + local f44_local3 = LUI.UICountdown.new( {} ) + f44_local3.id = "laststand_countdown" + f44_local3:registerAnimationState( "default", { + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudDigitalNormalFont.Font, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 20, + left = 0, + right = 0, + height = CoD.TextSettings.HudDigitalNormalFont.Height + } ) + f44_local3:animateToState( "default" ) + f44_local1:addElement( f44_local3 ) + local f44_local4 = function ( f45_arg0, f45_arg1 ) + if f45_arg1.value > 0 then + f44_local3:setEndTime( f45_arg1.value ) + if f45_arg0.current_state ~= "visible" then + f45_arg0:animateToState( "visible", 250 ) + f45_arg0.current_state = "visible" + end + elseif f45_arg0.current_state ~= "default" then + f45_arg0:animateToState( "default", 250 ) + f45_arg0.current_state = "default" + end + end + + f44_local1:registerOmnvarHandler( "ui_laststand_end_milliseconds", f44_local4 ) + local f44_local5 = Game.GetOmnvar( "ui_laststand_end_milliseconds" ) + if f44_local5 and f44_local5 > 0 then + f44_local4( f44_local1, { + value = f44_local5 + } ) + end + self:addElement( f44_local1 ) + return self +end + +function nuke_countdown_timer() + local self = LUI.UIElement.new() + self.id = "nuke_timer" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f46_local1 = Engine.UsingSplitscreenUpscaling() and 10 or 0 + local f46_local2 = LUI.UIElement.new() + local f46_local3 = Engine.GetDvarString( "ui_mapname" ) == "mp_alien_dlc3" + local f46_local4 = Engine.GetDvarString( "ui_mapname" ) == "mp_alien_last" + local f46_local5 = 0 + if f46_local3 then + f46_local5 = 48 + end + f46_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 31 + f46_local1, + left = 0 + f46_local5, + width = 74, + height = 32, + alpha = 0 + } ) + f46_local2:registerAnimationState( "visible", { + alpha = 1 + } ) + f46_local2:animateToState( "default" ) + local f46_local6 = "alien_icon_nuke" + if f46_local3 or f46_local4 then + f46_local6 = "alien_chaos_waypoint_time" + end + local f46_local7 = LUI.UIImage.new() + f46_local7.id = "nuke_icon" + f46_local7:registerAnimationState( "default", { + material = RegisterMaterial( f46_local6 ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -24 + f46_local5, + top = -15, + height = 48, + width = 48 + } ) + f46_local7:animateToState( "default" ) + f46_local2:addElement( f46_local7 ) + local f46_local8 = LUI.UICountdown.new( {} ) + f46_local8.id = "nuke_countdown" + f46_local8:registerAnimationState( "default", { + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudDigitalNormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 30, + left = 0, + right = f46_local5 * 2, + height = CoD.TextSettings.HudDigitalNormalFont.Height + } ) + f46_local8:animateToState( "default" ) + f46_local2:addElement( f46_local8 ) + f46_local2:registerOmnvarHandler( "ui_alien_nuke_timer", function ( f47_arg0, f47_arg1 ) + if f47_arg1.value > 0 then + f46_local8:setEndTime( f47_arg1.value ) + if f47_arg0.current_state ~= "visible" then + f47_arg0:animateToState( "visible", 250 ) + f47_arg0.current_state = "visible" + end + elseif f47_arg0.current_state ~= "default" then + f47_arg0:animateToState( "default", 250 ) + f47_arg0.current_state = "default" + end + end ) + self:addElement( f46_local2 ) + return self +end + +function self_revives() + local self = LUI.UIElement.new() + self.id = "self_revives" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f48_local1 = LUI.UIElement.new() + f48_local1:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = -10, + left = 0, + width = 32, + height = 3, + alpha = 0 + } ) + f48_local1:registerAnimationState( "visible", { + alpha = 1 + } ) + f48_local1:animateToState( "default" ) + local f48_local2 = function ( f49_arg0, f49_arg1 ) + f49_arg0:setText( f49_arg1 ) + if f49_arg1 > 1 then + f49_arg0:animateToState( "default", 250 ) + else + f49_arg0:animateToState( "hidden", 250 ) + end + end + + local f48_local3 = LUI.UIText.new() + f48_local3.id = "counter" + f48_local3:setTextStyle( CoD.TextStyle.OutlinedMore ) + f48_local3:registerAnimationState( "default", { + font = CoD.TextSettings.HudIW6SmallFont.Font, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 6 - CoD.TextSettings.HudIW6SmallFont.Height / 2, + bottom = 6 + CoD.TextSettings.HudIW6SmallFont.Height / 2, + alpha = 1 + } ) + f48_local3:animateToState( "default" ) + f48_local3:registerAnimationState( "hidden", { + alpha = 0 + } ) + f48_local1:addElement( f48_local3 ) + f48_local3:registerOmnvarHandler( "ui_alien_selfrevive", function ( f50_arg0, f50_arg1 ) + f48_local2( f50_arg0, f50_arg1.value ) + end ) + f48_local2( f48_local3, Game.GetOmnvar( "ui_alien_selfrevive" ) ) + local f48_local4 = function ( f51_arg0, f51_arg1 ) + if 0 < f51_arg1 then + f51_arg0:animateToState( "visible", 250 ) + else + f51_arg0:animateToState( "default", 250 ) + end + end + + local f48_local5 = LUI.UIImage.new() + f48_local5.id = "self_revives_icon" + f48_local5:registerAnimationState( "default", { + material = RegisterMaterial( "alien_icon_laststand" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + bottom = 0, + height = 32 + } ) + f48_local5:animateToState( "default" ) + f48_local1:addElement( f48_local5 ) + f48_local1:registerOmnvarHandler( "ui_alien_selfrevive", function ( f52_arg0, f52_arg1 ) + f48_local4( f52_arg0, f52_arg1.value ) + end ) + f48_local4( f48_local1, Game.GetOmnvar( "ui_alien_selfrevive" ) ) + self:addElement( f48_local1 ) + return self +end + +function craftSlotCornerElems( f53_arg0, f53_arg1, f53_arg2 ) + local f53_local0 = function ( f54_arg0, f54_arg1 ) + if f54_arg1.value < 1 then + f54_arg0:animateToState( "default", 100 ) + else + f54_arg0:animateToState( "visible", 100 ) + end + end + + local f53_local1 = function ( f55_arg0, f55_arg1 ) + if f55_arg1.value >= 0 then + f55_arg0:animateToState( "recipe_complete", 100 ) + end + end + + local f53_local2 = function ( f56_arg0, f56_arg1 ) + if f56_arg1.value <= 0 then + f56_arg0:animateToState( "default", 100 ) + else + local f56_local0 = MBh.AnimateSequence( { + { + "bigger", + 250 + }, + { + "bright", + 250 + } + } ) + f56_local0( f56_arg0 ) + Engine.PlaySound( "ui_craft_pickup_part" ) + end + end + + local f53_local3 = RegisterMaterial( "alien_crafting_glow1" ) + local f53_local4 = -8 + local f53_local5 = -12 + local f53_local6 = 48 + local f53_local7 = 28 + local self = LUI.UIImage.new( { + material = f53_local3, + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false, + left = f53_arg1 + f53_local5, + top = f53_arg2 + f53_local4, + width = f53_local6, + height = f53_local6, + alpha = 0 + } ) + self.id = "crafting_slot_glow_" .. tostring( f53_arg0 ) + self:registerAnimationState( "visible", { + alpha = 0.5 + } ) + self:registerAnimationState( "recipe_complete", { + alpha = 0.25 + } ) + self:registerOmnvarHandler( "ui_alien_craft_slot_" .. tostring( f53_arg0 ), f53_local0 ) + self:registerOmnvarHandler( "ui_alien_hudcraftinginfo", f53_local1 ) + local f53_local9 = LUI.UIImage.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false, + left = f53_arg1, + top = f53_arg2, + width = f53_local7, + height = f53_local7, + red = 0.65, + green = 0.65, + blue = 0.65, + alpha = 1 + } ) + f53_local9.id = "crafting_slot_icon_" .. tostring( f53_arg0 ) + f53_local9:registerAnimationState( "bigger", { + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false, + left = f53_arg1 - 3, + top = f53_arg2 - 3, + width = f53_local7 + 6, + height = f53_local7 + 6, + red = 0.65, + green = 0.65, + blue = 0.65, + alpha = 1 + } ) + f53_local9:registerAnimationState( "bright", { + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false, + left = f53_arg1, + top = f53_arg2, + width = f53_local7, + height = f53_local7, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f53_local9:registerAnimationState( "recipe_complete", { + alpha = 0.5 + } ) + f53_local9:registerOmnvarHandler( "ui_alien_craft_slot_" .. tostring( f53_arg0 ), f53_local2 ) + f53_local9:registerOmnvarHandler( "ui_alien_hudcraftinginfo", f53_local1 ) + f53_local9:registerEventHandler( "refresh_crafting_ingredients", function ( element, event ) + local f57_local0 = "slot" .. tostring( f53_arg0 ) .. "Material" + if event[f57_local0] and event[f57_local0] ~= "" then + element:setImage( RegisterMaterial( event[f57_local0] ) ) + else + element:animateToState( "default" ) + end + end ) + f53_local0( self, { + value = Game.GetOmnvar( "ui_alien_craft_slot_" .. tostring( f53_arg0 ) ) + } ) + f53_local1( self, { + value = Game.GetOmnvar( "ui_alien_hudcraftinginfo" ) + } ) + f53_local2( f53_local9, { + value = Game.GetOmnvar( "ui_alien_craft_slot_" .. tostring( f53_arg0 ) ) + } ) + f53_local1( f53_local9, { + value = Game.GetOmnvar( "ui_alien_hudcraftinginfo" ) + } ) + return f53_local9, self +end + +function craftSlotCenterElems( f58_arg0, f58_arg1, f58_arg2 ) + local f58_local0 = function ( f59_arg0, f59_arg1 ) + if f59_arg1.value < 0 then + f59_arg0:animateToState( "default", 100 ) + else + local f59_local0 = MBh.AnimateLoop( { + { + "default", + 0 + }, + { + "visible", + 750 + }, + { + "default", + 750 + } + } ) + f59_local0( f59_arg0 ) + end + end + + local f58_local1 = function ( f60_arg0, f60_arg1 ) + if f60_arg1.value < 0 then + f60_arg0:animateToState( "default", 100 ) + else + local f60_local0 = MBh.AnimateLoop( { + { + "bigger", + 350 + }, + { + "visible", + 350 + }, + { + "visible", + 5000 + } + } ) + f60_local0( f60_arg0 ) + end + end + + local self = LUI.UIImage.new( { + material = RegisterMaterial( "alien_crafting_glow2" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f58_arg2 - 26, + left = f58_arg1 - 18, + height = 128, + width = 100, + alpha = 0 + } ) + self.id = "crafting_slot_glow_" .. tostring( f58_arg0 ) + self:registerAnimationState( "visible", { + alpha = 0.6 + } ) + self:registerOmnvarHandler( "ui_alien_hudcraftinginfo", f58_local0 ) + self:registerEventHandler( "reset", MBh.AnimateToState( "default" ) ) + local f58_local3 = LUI.UIImage.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f58_arg2, + left = f58_arg1, + height = 64, + width = 64, + alpha = 0.35 + } ) + f58_local3.id = "crafting_slot_icon" .. tostring( f58_arg0 ) + f58_local3:registerAnimationState( "visible", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f58_arg2, + left = f58_arg1, + height = 64, + width = 64, + alpha = 1 + } ) + f58_local3:registerAnimationState( "bigger", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f58_arg2 - 6, + left = f58_arg1 - 6, + height = 70, + width = 70, + alpha = 1 + } ) + f58_local3:registerOmnvarHandler( "ui_alien_hudcraftinginfo", f58_local1 ) + f58_local3:registerEventHandler( "refresh_crafting_ingredients", function ( element, event ) + local f61_local0 = "slot" .. tostring( f58_arg0 ) .. "Material" + if event[f61_local0] and event[f61_local0] ~= "" then + element:setImage( RegisterMaterial( event[f61_local0] ) ) + else + element:animateToState( "default" ) + end + end ) + f58_local0( self, { + value = Game.GetOmnvar( "ui_alien_hudcraftinginfo" ) + } ) + f58_local1( f58_local3, { + value = Game.GetOmnvar( "ui_alien_hudcraftinginfo" ) + } ) + return f58_local3, self +end + +function crafting_items( f62_arg0 ) + local f62_local0 = function ( f63_arg0, f63_arg1 ) + local f63_local0 = LUI.mp_menus.Aliens + f63_arg0:processEvent( { + name = "refresh_crafting_ingredients", + slot1Material = Engine.TableLookup( f63_local0.AlienCraftingRecipes.File, f63_local0.AlienCraftingRecipes.Cols.Idx, f63_arg1.value, f63_local0.AlienCraftingRecipes.Cols.Slot1Material ), + slot2Material = Engine.TableLookup( f63_local0.AlienCraftingRecipes.File, f63_local0.AlienCraftingRecipes.Cols.Idx, f63_arg1.value, f63_local0.AlienCraftingRecipes.Cols.Slot2Material ), + slot3Material = Engine.TableLookup( f63_local0.AlienCraftingRecipes.File, f63_local0.AlienCraftingRecipes.Cols.Idx, f63_arg1.value, f63_local0.AlienCraftingRecipes.Cols.Slot3Material ), + slot4Material = Engine.TableLookup( f63_local0.AlienCraftingRecipes.File, f63_local0.AlienCraftingRecipes.Cols.Idx, f63_arg1.value, f63_local0.AlienCraftingRecipes.Cols.Slot4Material ) + } ) + end + + local f62_local1 = 128 + local self = LUI.UIImage.new( { + material = RegisterMaterial( "alien_icon_craft_widget" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = 240, + bottom = 16, + height = f62_local1, + width = f62_local1, + alpha = 0 + } ) + self.id = "crafting_container" + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self:registerAnimationState( "invisible", { + alpha = 0 + } ) + self:registerAnimationState( "tank1", { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + bottom = 16, + left = 240, + height = f62_local1, + width = f62_local1 + } ) + self:registerAnimationState( "tank2", { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + bottom = 16, + left = 270, + height = f62_local1, + width = f62_local1 + } ) + self:registerAnimationState( "tank3", { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + bottom = 16, + left = 300, + height = f62_local1, + width = f62_local1 + } ) + self:registerAnimationState( "tank4", { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + bottom = 16, + left = 330, + height = f62_local1, + width = f62_local1 + } ) + self:setupUIIntWatch( "PlayerMaxHealth" ) + self:registerEventHandler( "int_watch_alert", function ( element, event ) + if event.newValue == 125 then + element:animateToState( "tank1", 250 ) + elseif event.newValue == 150 then + element:animateToState( "tank2", 250 ) + elseif event.newValue == 175 then + element:animateToState( "tank3", 250 ) + elseif event.newValue == 200 then + element:animateToState( "tank4", 250 ) + end + end ) + local f62_local3, f62_local4 = craftSlotCornerElems( 1, 10, 84 ) + local f62_local5, f62_local6 = craftSlotCornerElems( 2, 90, 84 ) + local f62_local7, f62_local8 = craftSlotCornerElems( 3, 50, 14 ) + local f62_local9, f62_local10 = craftSlotCenterElems( 4, 32, 44 ) + self:addElement( f62_local4 ) + self:addElement( f62_local3 ) + self:addElement( f62_local6 ) + self:addElement( f62_local5 ) + self:addElement( f62_local8 ) + self:addElement( f62_local7 ) + self:addElement( f62_local10 ) + self:addElement( f62_local9 ) + local f62_local11 = Game.GetOmnvar( "ui_alien_craft_recipe" ) + f62_local0( self, { + value = f62_local11 + } ) + if f62_local11 ~= 200 and f62_local11 > 0 then + self:animateToState( "visible" ) + end + local f62_local12 = Engine.UsingSplitscreenUpscaling() and -50 or 0 + local f62_local13 = 1.75 + local f62_local14 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_icon_craft_widget" ), + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -f62_local1 / 2, + right = f62_local1 / 2, + top = -f62_local1 / 2 + f62_local12, + bottom = f62_local1 / 2 + f62_local12, + alpha = 1 + } ) + f62_local14:registerAnimationState( "enlarged", { + left = -f62_local1 / 2 * f62_local13, + right = f62_local1 / 2 * f62_local13, + top = -f62_local1 / 2 * f62_local13 + f62_local12, + bottom = f62_local1 / 2 * f62_local13 + f62_local12 + } ) + f62_local14:registerAnimationState( "standard", { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -f62_local1 / 2, + right = f62_local1 / 2, + top = -f62_local1 / 2 + f62_local12, + bottom = f62_local1 / 2 + f62_local12, + alpha = 1 + } ) + f62_local14:registerAnimationState( "wait", {} ) + f62_local14:registerAnimationState( "hidden", { + alpha = 0 + } ) + f62_local14.id = "test_fly_over" + f62_local14:animateToState( "hidden" ) + f62_arg0:addElement( f62_local14 ) + f62_local14:registerOmnvarHandler( "ui_alien_craft_recipe", function ( f65_arg0, f65_arg1 ) + self:animateToState( "invisible" ) + if f65_arg1.value ~= 200 and f65_arg1.value > 0 then + f65_arg0:closeChildren() + self:processEvent( { + name = "reset" + } ) + f62_local14:registerAnimationState( "flyover", LUI.MakeFlyOverAnimationState( f65_arg0, self ) ) + local f65_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "enlarged", + 75 + }, + { + "standard", + 75 + } + } ) + f65_local0( f65_arg0, f65_arg1 ) + Engine.PlaySound( "ui_craft_pickup_schematic" ) + end + end ) + f62_local14:registerEventHandler( LUI.FormatAnimStateFinishEvent( "standard" ), function ( element, event ) + local f66_local0 = craftSlotCornerElems( 1, 10, 84 ) + local f66_local1 = craftSlotCornerElems( 2, 90, 84 ) + local f66_local2 = craftSlotCornerElems( 3, 50, 14 ) + local f66_local3 = craftSlotCenterElems( 4, 32, 44 ) + f62_local14:addElement( f66_local0 ) + f62_local14:addElement( f66_local1 ) + f62_local14:addElement( f66_local2 ) + f62_local14:addElement( f66_local3 ) + f62_local0( element, { + value = Game.GetOmnvar( "ui_alien_craft_recipe" ) + } ) + local f66_local4 = MBh.AnimateSequence( { + { + "wait", + 2250 + }, + { + "flyover", + 200 + }, + { + "hidden", + 0 + } + } ) + f66_local4( element, event ) + end ) + f62_local14:registerEventHandler( LUI.FormatAnimStateFinishEvent( "hidden" ), function ( element, event ) + self:animateToState( "visible" ) + f62_local0( self, { + value = Game.GetOmnvar( "ui_alien_craft_recipe" ) + } ) + end ) + return self +end + +function locker_key() + local self = LUI.UIElement.new() + self.id = "locker_key" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = 0, + top = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f68_local1 = LUI.UIElement.new() + f68_local1:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = -35, + left = 80, + width = 32, + height = 0, + alpha = 0 + } ) + f68_local1:registerAnimationState( "visible", { + alpha = 1 + } ) + f68_local1:animateToState( "default" ) + local f68_local2 = LUI.UIImage.new() + f68_local2.id = "locker_key_icon" + f68_local2:registerAnimationState( "default", { + material = RegisterMaterial( "alien_icon_locker_key" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + bottom = 0, + height = 32 + } ) + f68_local2:animateToState( "default" ) + f68_local1:addElement( f68_local2 ) + local f68_local3 = function ( f69_arg0, f69_arg1 ) + if 0 < f69_arg1 then + f68_local1:animateToState( "visible", 250 ) + else + f68_local1:animateToState( "default", 250 ) + end + end + + f68_local1:registerOmnvarHandler( "ui_alien_locker_key", function ( f70_arg0, f70_arg1 ) + f68_local3( f70_arg0, f70_arg1.value ) + end ) + f68_local3( f68_local1, Game.GetOmnvar( "ui_alien_locker_key" ) ) + self:addElement( f68_local1 ) + return self +end + +function quick_shop_class_skill( f71_arg0 ) + local f71_local0 = 26 + local f71_local1 = 10 + local f71_local2 = 20 + local f71_local3 = 4 + local f71_local4 = 20 + local f71_local5 = 0 + local f71_local6 = 21 + local f71_local7 = { + "alien_icon_weapon_specialist", + "alien_icon_tank", + "alien_icon_engineer", + "alien_icon_medic" + } + local f71_local8 = function ( f72_arg0 ) + local f72_local0 + if 0 >= f72_arg0 or f72_arg0 > #f71_local7 then + f72_local0 = false + else + f72_local0 = true + end + return f72_local0 + end + + f71_arg0.alpha = 0 + local self = LUI.UIElement.new( f71_arg0 ) + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self.id = "quick_shop_class_skill" + local f71_local10 = function ( f73_arg0 ) + local f73_local0 = Game.GetOmnvar( "ui_alien_class_skill_active" ) + local f73_local1 = Game.GetOmnvar( "ui_alien_class_skill_timer" ) > 0 + local f73_local2 = Game.GetOmnvar( "ui_alien_class_skill_blocked" ) + local f73_local3 + if not f73_local0 and not f73_local1 then + f73_local3 = not f73_local2 + else + f73_local3 = false + end + local f73_local4 = f73_arg0 + local f73_local5 = f73_arg0.animateToState + local f73_local6 + if f73_local3 then + f73_local6 = "default" + if not f73_local6 then + + else + f73_local5( f73_local4, f73_local6, 250 ) + end + end + f73_local6 = "dimmed" + end + + local f71_local11 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_dpad_arrow_up" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + height = f71_local1, + bottom = 0, + left = -f71_local2 / 2, + width = f71_local2, + alpha = 0.6 + } ) + f71_local11:registerAnimationState( "dimmed", { + alpha = 0.2 + } ) + f71_local11:registerOmnvarHandler( "ui_alien_class_skill_active", f71_local10 ) + f71_local11:registerOmnvarHandler( "ui_alien_class_skill_timer", f71_local10 ) + f71_local11:registerOmnvarHandler( "ui_alien_class_skill_blocked", f71_local10 ) + f71_local10( f71_local11 ) + f71_local11.id = "arrow" + self:addElement( f71_local11 ) + local f71_local12 = function ( f74_arg0, f74_arg1 ) + if f71_local8( f74_arg1 ) then + f74_arg0:setImage( RegisterMaterial( f71_local7[f74_arg1] ) ) + end + end + + local f71_local13 = function ( f75_arg0 ) + local f75_local0 = Game.GetOmnvar( "ui_alien_class_skill_active" ) + local f75_local1 = Game.GetOmnvar( "ui_alien_class_skill_timer" ) > 0 + if Game.GetOmnvar( "ui_alien_class_skill_blocked" ) then + f75_arg0:animateToState( "dimmed", 200 ) + elseif f75_local0 then + local f75_local2 = MBh.AnimateLoop( { + { + "active", + 150 + }, + { + "default", + 400 + } + } ) + f75_local2( f75_arg0, {} ) + else + local f75_local2 = f75_arg0 + local f75_local3 = f75_arg0.animateToState + local f75_local4 + if f75_local1 then + f75_local4 = "dimmed" + if not f75_local4 then + + else + f75_local3( f75_local2, f75_local4, 500 ) + end + end + f75_local4 = "default" + end + end + + local f71_local14 = LUI.UIImage.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = -f71_local1 - f71_local3, + width = f71_local0, + left = -f71_local0 / 2, + height = f71_local0, + alpha = 0.8, + scale = 0 + } ) + f71_local14:registerAnimationState( "dimmed", { + alpha = 0.2, + scale = 0 + } ) + f71_local14:registerAnimationState( "active", { + alpha = 1, + scale = 0.2 + } ) + f71_local14:registerOmnvarHandler( "ui_alien_class_skill_active", f71_local13 ) + f71_local14:registerOmnvarHandler( "ui_alien_class_skill_timer", f71_local13 ) + f71_local14:registerOmnvarHandler( "ui_alien_class_skill_blocked", f71_local13 ) + f71_local14:registerOmnvarHandler( "ui_alien_class_skill", function ( f76_arg0, f76_arg1 ) + f71_local12( f76_arg0, f76_arg1.value ) + end ) + f71_local12( f71_local14, Game.GetOmnvar( "ui_alien_class_skill" ) ) + f71_local13( f71_local14 ) + f71_local14.id = "icon" + self:addElement( f71_local14 ) + local f71_local15 = function ( f77_arg0 ) + local f77_local0 = Game.GetOmnvar( "ui_alien_class_skill_timer" ) > 0 + local f77_local1 = f77_arg0 + local f77_local2 = f77_arg0.animateToState + local f77_local3 + if f77_local0 then + f77_local3 = "visible" + if not f77_local3 then + + else + f77_local2( f77_local1, f77_local3 ) + end + end + f77_local3 = "default" + end + + local f71_local16 = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = -f71_local1 - f71_local3 + f71_local5, + height = f71_local6, + left = f71_local4, + width = 2, + alpha = 0 + } ) + f71_local16:registerAnimationState( "visible", { + alpha = 0.6 + } ) + f71_local16:registerOmnvarHandler( "ui_alien_class_skill_timer", f71_local15 ) + f71_local15( f71_local16 ) + f71_local16.id = "cooldown" + self:addElement( f71_local16 ) + local f71_local17 = LUI.UIImage.new( CoD.ColorizeState( Colors.black, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) ) + f71_local17.id = "cooldownBG" + f71_local16:addElement( f71_local17 ) + local f71_local18 = function ( f78_arg0, f78_arg1 ) + if 0 < f78_arg1 then + if not Game.GetOmnvar( "ui_alien_class_skill_blocked" ) then + f78_arg0:animateToState( "full", f78_arg1 - Game.GetTime() ) + end + else + f78_arg0:animateToState( "default" ) + end + end + + local f71_local19 = function ( f79_arg0, f79_arg1 ) + if f79_arg1.value then + f79_arg0:cancelAnimateToState() + end + end + + local f71_local20 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f71_local20:registerAnimationState( "full", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f71_local20:registerOmnvarHandler( "ui_alien_class_skill_timer", function ( f80_arg0, f80_arg1 ) + f71_local18( f80_arg0, f80_arg1.value ) + end ) + f71_local20:registerOmnvarHandler( "ui_alien_class_skill_blocked", f71_local19 ) + f71_local18( f71_local20, Game.GetOmnvar( "ui_alien_class_skill_timer" ) ) + f71_local20.id = "cooldownFG" + f71_local16:addElement( f71_local20 ) + local f71_local21 = function ( f81_arg0, f81_arg1 ) + f81_arg0:animateToState( f71_local8( f81_arg1 ) and "visible" or "default", 150 ) + end + + self:registerOmnvarHandler( "ui_alien_class_skill", function ( f82_arg0, f82_arg1 ) + f71_local21( f82_arg0, f82_arg1.value ) + end ) + f71_local21( self, Game.GetOmnvar( "ui_alien_class_skill" ) ) + return self +end + +function quick_shop_class_skill_secondary( f83_arg0 ) + local f83_local0 = 26 + local f83_local1 = 10 + local f83_local2 = 20 + local f83_local3 = 4 + local f83_local4 = 20 + local f83_local5 = -2 + local f83_local6 = 21 + local f83_local7 = { + "alien_icon_weapon_specialist", + "alien_icon_tank", + "alien_icon_engineer", + "alien_icon_medic" + } + local f83_local8 = function ( f84_arg0 ) + local f84_local0 + if 0 >= f84_arg0 or f84_arg0 > #f83_local7 then + f84_local0 = false + else + f84_local0 = true + end + return f84_local0 + end + + f83_arg0.alpha = 0 + local self = LUI.UIElement.new( f83_arg0 ) + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self.id = "quick_shop_class_skill_secondary" + local f83_local10 = function ( f85_arg0 ) + local f85_local0 = Game.GetOmnvar( "ui_alien_class_skill_active_secondary" ) + local f85_local1 = Game.GetOmnvar( "ui_alien_class_skill_timer_secondary" ) > 0 + local f85_local2 = Game.GetOmnvar( "ui_alien_class_skill_blocked" ) + local f85_local3 + if not f85_local0 and not f85_local1 then + f85_local3 = not f85_local2 + else + f85_local3 = false + end + local f85_local4 = f85_arg0 + local f85_local5 = f85_arg0.animateToState + local f85_local6 + if f85_local3 then + f85_local6 = "default" + if not f85_local6 then + + else + f85_local5( f85_local4, f85_local6, 250 ) + end + end + f85_local6 = "dimmed" + end + + local f83_local11 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_dpad_arrow_up" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + height = f83_local1, + bottom = 0, + left = -f83_local2 / 2, + width = f83_local2, + alpha = 0.6, + zRot = 90 + } ) + f83_local11:registerAnimationState( "dimmed", { + alpha = 0.2 + } ) + f83_local11:registerOmnvarHandler( "ui_alien_class_skill_active_secondary", f83_local10 ) + f83_local11:registerOmnvarHandler( "ui_alien_class_skill_timer_secondary", f83_local10 ) + f83_local11:registerOmnvarHandler( "ui_alien_class_skill_blocked", f83_local10 ) + f83_local10( f83_local11 ) + f83_local11.id = "arrow" + self:addElement( f83_local11 ) + local f83_local12 = function ( f86_arg0, f86_arg1 ) + if f83_local8( f86_arg1 ) then + f86_arg0:setImage( RegisterMaterial( f83_local7[f86_arg1] ) ) + end + end + + local f83_local13 = function ( f87_arg0 ) + local f87_local0 = Game.GetOmnvar( "ui_alien_class_skill_active_secondary" ) + local f87_local1 = Game.GetOmnvar( "ui_alien_class_skill_timer_secondary" ) > 0 + if Game.GetOmnvar( "ui_alien_class_skill_blocked" ) then + f87_arg0:animateToState( "dimmed", 200 ) + elseif f87_local0 then + local f87_local2 = MBh.AnimateLoop( { + { + "active", + 150 + }, + { + "default", + 400 + } + } ) + f87_local2( f87_arg0, {} ) + else + local f87_local2 = f87_arg0 + local f87_local3 = f87_arg0.animateToState + local f87_local4 + if f87_local1 then + f87_local4 = "dimmed" + if not f87_local4 then + + else + f87_local3( f87_local2, f87_local4, 500 ) + end + end + f87_local4 = "default" + end + end + + local f83_local14 = LUI.UIImage.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = 7, + width = f83_local0, + left = -35, + height = f83_local0, + alpha = 0.8, + scale = 0 + } ) + f83_local14:registerAnimationState( "dimmed", { + alpha = 0.2, + scale = 0 + } ) + f83_local14:registerAnimationState( "active", { + alpha = 1, + scale = 0.2 + } ) + f83_local14:registerOmnvarHandler( "ui_alien_class_skill_active_secondary", f83_local13 ) + f83_local14:registerOmnvarHandler( "ui_alien_class_skill_timer_secondary", f83_local13 ) + f83_local14:registerOmnvarHandler( "ui_alien_class_skill_blocked", f83_local13 ) + f83_local14:registerOmnvarHandler( "ui_alien_class_skill_secondary", function ( f88_arg0, f88_arg1 ) + f83_local12( f88_arg0, f88_arg1.value ) + end ) + f83_local12( f83_local14, Game.GetOmnvar( "ui_alien_class_skill_secondary" ) ) + f83_local13( f83_local14 ) + f83_local14.id = "icon" + self:addElement( f83_local14 ) + local f83_local15 = function ( f89_arg0 ) + local f89_local0 = Game.GetOmnvar( "ui_alien_class_skill_timer_secondary" ) > 0 + local f89_local1 = f89_arg0 + local f89_local2 = f89_arg0.animateToState + local f89_local3 + if f89_local0 then + f89_local3 = "visible" + if not f89_local3 then + + else + f89_local2( f89_local1, f89_local3 ) + end + end + f89_local3 = "default" + end + + local f83_local16 = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = 6 + f83_local5, + height = f83_local6, + left = -40, + width = 2, + alpha = 0 + } ) + f83_local16:registerAnimationState( "visible", { + alpha = 0.6 + } ) + f83_local16:registerOmnvarHandler( "ui_alien_class_skill_timer_secondary", f83_local15 ) + f83_local15( f83_local16 ) + f83_local16.id = "cooldown" + self:addElement( f83_local16 ) + local f83_local17 = LUI.UIImage.new( CoD.ColorizeState( Colors.black, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) ) + f83_local17.id = "cooldownBG" + f83_local16:addElement( f83_local17 ) + local f83_local18 = function ( f90_arg0, f90_arg1 ) + if 0 < f90_arg1 then + if not Game.GetOmnvar( "ui_alien_class_skill_blocked" ) then + f90_arg0:animateToState( "full", f90_arg1 - Game.GetTime() ) + end + else + f90_arg0:animateToState( "default" ) + end + end + + local f83_local19 = function ( f91_arg0, f91_arg1 ) + if f91_arg1.value then + f91_arg0:cancelAnimateToState() + end + end + + local f83_local20 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f83_local20:registerAnimationState( "full", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f83_local20:registerOmnvarHandler( "ui_alien_class_skill_timer_secondary", function ( f92_arg0, f92_arg1 ) + f83_local18( f92_arg0, f92_arg1.value ) + end ) + f83_local20:registerOmnvarHandler( "ui_alien_class_skill_blocked", f83_local19 ) + f83_local18( f83_local20, Game.GetOmnvar( "ui_alien_class_skill_timer_secondary" ) ) + f83_local20.id = "cooldownFG" + f83_local16:addElement( f83_local20 ) + local f83_local21 = function ( f93_arg0, f93_arg1 ) + f93_arg0:animateToState( f83_local8( f93_arg1 ) and "visible" or "default", 150 ) + end + + self:registerOmnvarHandler( "ui_alien_class_skill_secondary", function ( f94_arg0, f94_arg1 ) + f83_local21( f94_arg0, f94_arg1.value ) + end ) + f83_local21( self, Game.GetOmnvar( "ui_alien_class_skill_secondary" ) ) + return self +end + +function quick_shop_item( f95_arg0, f95_arg1, f95_arg2 ) + local f95_local0 = 40 + local f95_local1 = 8 + local f95_local2 = -3 + local f95_local3 = 100 + local f95_local4 = 20 + local f95_local5 = CoD.TextSettings.HudEuroMedTinyFont + local f95_local6 = f95_arg2() + local self = LUI.UIElement.new() + self.id = f95_local6 .. "_" .. f95_arg0 + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f95_local8 = LUI.UIImage.new() + f95_local8.id = "icon" + local f95_local9 = f95_arg0 == LUI.Alignment.Top + local f95_local10 = f95_arg0 == LUI.Alignment.Bottom + local f95_local11 = f95_arg0 == LUI.Alignment.Left + local f95_local12 = f95_arg0 == LUI.Alignment.Right + local f95_local13 = -f95_local0 / 2 + if f95_local9 then + f95_local13 = -f95_local0 + f95_local1 + if f95_arg1 then + f95_local13 = f95_local13 - f95_local5.Height + else + f95_local13 = f95_local13 - 4 + end + elseif f95_local10 then + f95_local13 = 0 - f95_local1 + end + local f95_local14 = -f95_local0 / 2 + if f95_local11 then + f95_local14 = -f95_local0 + f95_local1 + elseif f95_local12 then + f95_local14 = 0 - f95_local1 + end + f95_local8:registerAnimationState( "default", { + topAnchor = f95_local9, + bottomAnchor = f95_local10, + leftAnchor = f95_local11, + rightAnchor = f95_local12, + top = f95_local13, + bottom = f95_local13 + f95_local0, + left = f95_local14, + right = f95_local14 + f95_local0, + alpha = 0.2 + } ) + f95_local8:registerAnimationState( "enabled", { + alpha = 0.8 + } ) + f95_local8:animateToState( "default" ) + self:addElement( f95_local8 ) + local f95_local15 = LUI.Alignment.Center + local f95_local16 = 0 + if f95_local11 then + f95_local16 = f95_local1 + -f95_local0 / 2 + elseif f95_local12 then + f95_local16 = -f95_local1 + f95_local0 / 2 + end + local f95_local17 = nil + if f95_arg1 then + f95_local17 = LUI.UIText.new() + f95_local17.id = "priceTag" + f95_local17:setText( tostring( f95_arg1() ) ) + f95_local17:setTextStyle( CoD.TextStyle.Outlined ) + f95_local17:registerAnimationState( "default", { + font = f95_local5.Font, + alignment = f95_local15, + topAnchor = f95_local9, + bottomAnchor = f95_local10, + leftAnchor = f95_local11, + rightAnchor = f95_local12, + top = f95_local13 + f95_local0 + f95_local2, + bottom = f95_local13 + f95_local0 + f95_local2 + f95_local5.Height, + left = f95_local16 - 40, + right = f95_local16 + 40, + red = Colors.cac_ability_text.r, + green = Colors.cac_ability_text.g, + blue = Colors.cac_ability_text.b, + alpha = 0.4 + } ) + f95_local17:registerAnimationState( "enabled", { + red = Colors.cac_ability_text.r, + green = Colors.cac_ability_text.g, + blue = Colors.cac_ability_text.b, + alpha = 0.7 + } ) + f95_local17:animateToState( "default" ) + self:addElement( f95_local17 ) + end + local f95_local18 + if f95_local9 then + f95_local18 = 6 + if not f95_local18 then + if f95_local10 then + f95_local18 = -6 - f95_local4 / 2 + if not f95_local18 then + + else + local f95_local19 + if f95_local11 then + f95_local19 = 6 + if not f95_local19 then + if f95_local12 then + f95_local19 = -6 - f95_local4 / 2 + if not f95_local19 then + + else + local f95_local20 + if f95_local11 or f95_local12 then + f95_local20 = f95_local4 / 2 + if not f95_local20 then + + else + f95_local20 = f95_local19 + f95_local20 + local f95_local21 + if f95_local9 or f95_local10 then + f95_local21 = f95_local4 / 2 + if not f95_local21 then + + else + f95_local21 = f95_local18 + f95_local21 + local f95_local22 = "" + if f95_local11 then + f95_local22 = "alien_dpad_arrow_left" + elseif f95_local12 then + f95_local22 = "alien_dpad_arrow_right" + elseif f95_local9 then + f95_local22 = "alien_dpad_arrow_up" + elseif f95_local10 then + f95_local22 = "alien_dpad_arrow_down" + end + local f95_local23 = LUI.UIImage.new() + f95_local23.id = "arrow" + f95_local23:registerAnimationState( "default", { + material = RegisterMaterial( f95_local22 ), + topAnchor = f95_local9, + bottomAnchor = f95_local10, + leftAnchor = f95_local11, + rightAnchor = f95_local12, + top = f95_local18, + bottom = f95_local21, + left = f95_local19, + right = f95_local20, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 0.2 + } ) + f95_local23:registerAnimationState( "enabled", CoD.ColorizeState( Colors.white, { + alpha = 0.8 + } ) ) + f95_local23:animateToState( "default" ) + self:addElement( f95_local23 ) + local f95_local24 = function ( f96_arg0 ) + if f96_arg0.cachedCash then + if not f95_arg1 or f95_arg1() <= f96_arg0.cachedCash then + f95_local8:animateToState( "enabled" ) + f95_local23:animateToState( "enabled" ) + if f95_local17 then + f95_local17:animateToState( "enabled" ) + end + else + f95_local8:animateToState( "default" ) + f95_local23:animateToState( "default" ) + if f95_local17 then + f95_local17:animateToState( "default" ) + end + end + end + end + + self:registerEventHandler( "cash_change", function ( element, event ) + element.cachedCash = event.newValue + f95_local24( element ) + end ) + self:registerEventHandler( "ability_levels_change", function ( element, event ) + if f95_local17 and f95_arg1 then + f95_local17:setText( tostring( f95_arg1() ) ) + end + f95_local8:setImage( RegisterMaterial( f95_arg2() ) ) + f95_local24( element ) + end ) + return self + end + end + f95_local21 = f95_local4 + end + end + f95_local20 = f95_local4 + end + end + f95_local19 = -f95_local4 / 2 + end + else + if f95_local12 then + f95_local19 = -6 - f95_local4 / 2 + if not f95_local19 then + + else + local f95_local20 + if f95_local11 or f95_local12 then + f95_local20 = f95_local4 / 2 + if not f95_local20 then + + else + f95_local20 = f95_local19 + f95_local20 + local f95_local21 + if f95_local9 or f95_local10 then + f95_local21 = f95_local4 / 2 + if not f95_local21 then + + else + f95_local21 = f95_local18 + f95_local21 + local f95_local22 = "" + if f95_local11 then + f95_local22 = "alien_dpad_arrow_left" + elseif f95_local12 then + f95_local22 = "alien_dpad_arrow_right" + elseif f95_local9 then + f95_local22 = "alien_dpad_arrow_up" + elseif f95_local10 then + f95_local22 = "alien_dpad_arrow_down" + end + local f95_local23 = LUI.UIImage.new() + f95_local23.id = "arrow" + f95_local23:registerAnimationState( "default", { + material = RegisterMaterial( f95_local22 ), + topAnchor = f95_local9, + bottomAnchor = f95_local10, + leftAnchor = f95_local11, + rightAnchor = f95_local12, + top = f95_local18, + bottom = f95_local21, + left = f95_local19, + right = f95_local20, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 0.2 + } ) + f95_local23:registerAnimationState( "enabled", CoD.ColorizeState( Colors.white, { + alpha = 0.8 + } ) ) + f95_local23:animateToState( "default" ) + self:addElement( f95_local23 ) + local f95_local24 = function ( f96_arg0 ) + if f96_arg0.cachedCash then + if not f95_arg1 or f95_arg1() <= f96_arg0.cachedCash then + f95_local8:animateToState( "enabled" ) + f95_local23:animateToState( "enabled" ) + if f95_local17 then + f95_local17:animateToState( "enabled" ) + end + else + f95_local8:animateToState( "default" ) + f95_local23:animateToState( "default" ) + if f95_local17 then + f95_local17:animateToState( "default" ) + end + end + end + end + + self:registerEventHandler( "cash_change", function ( element, event ) + element.cachedCash = event.newValue + f95_local24( element ) + end ) + self:registerEventHandler( "ability_levels_change", function ( element, event ) + if f95_local17 and f95_arg1 then + f95_local17:setText( tostring( f95_arg1() ) ) + end + f95_local8:setImage( RegisterMaterial( f95_arg2() ) ) + f95_local24( element ) + end ) + return self + end + end + f95_local21 = f95_local4 + end + end + f95_local20 = f95_local4 + end + end + f95_local19 = -f95_local4 / 2 + end + local f95_local20 + if f95_local11 or f95_local12 then + f95_local20 = f95_local4 / 2 + if not f95_local20 then + + else + f95_local20 = f95_local19 + f95_local20 + local f95_local21 + if f95_local9 or f95_local10 then + f95_local21 = f95_local4 / 2 + if not f95_local21 then + + else + f95_local21 = f95_local18 + f95_local21 + local f95_local22 = "" + if f95_local11 then + f95_local22 = "alien_dpad_arrow_left" + elseif f95_local12 then + f95_local22 = "alien_dpad_arrow_right" + elseif f95_local9 then + f95_local22 = "alien_dpad_arrow_up" + elseif f95_local10 then + f95_local22 = "alien_dpad_arrow_down" + end + local f95_local23 = LUI.UIImage.new() + f95_local23.id = "arrow" + f95_local23:registerAnimationState( "default", { + material = RegisterMaterial( f95_local22 ), + topAnchor = f95_local9, + bottomAnchor = f95_local10, + leftAnchor = f95_local11, + rightAnchor = f95_local12, + top = f95_local18, + bottom = f95_local21, + left = f95_local19, + right = f95_local20, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 0.2 + } ) + f95_local23:registerAnimationState( "enabled", CoD.ColorizeState( Colors.white, { + alpha = 0.8 + } ) ) + f95_local23:animateToState( "default" ) + self:addElement( f95_local23 ) + local f95_local24 = function ( f96_arg0 ) + if f96_arg0.cachedCash then + if not f95_arg1 or f95_arg1() <= f96_arg0.cachedCash then + f95_local8:animateToState( "enabled" ) + f95_local23:animateToState( "enabled" ) + if f95_local17 then + f95_local17:animateToState( "enabled" ) + end + else + f95_local8:animateToState( "default" ) + f95_local23:animateToState( "default" ) + if f95_local17 then + f95_local17:animateToState( "default" ) + end + end + end + end + + self:registerEventHandler( "cash_change", function ( element, event ) + element.cachedCash = event.newValue + f95_local24( element ) + end ) + self:registerEventHandler( "ability_levels_change", function ( element, event ) + if f95_local17 and f95_arg1 then + f95_local17:setText( tostring( f95_arg1() ) ) + end + f95_local8:setImage( RegisterMaterial( f95_arg2() ) ) + f95_local24( element ) + end ) + return self + end + end + f95_local21 = f95_local4 + end + end + f95_local20 = f95_local4 + end + end + f95_local18 = -f95_local4 / 2 + end + else + if f95_local10 then + f95_local18 = -6 - f95_local4 / 2 + if not f95_local18 then + + else + local f95_local19 + if f95_local11 then + f95_local19 = 6 + if not f95_local19 then + if f95_local12 then + f95_local19 = -6 - f95_local4 / 2 + if not f95_local19 then + + else + local f95_local20 + if f95_local11 or f95_local12 then + f95_local20 = f95_local4 / 2 + if not f95_local20 then + + else + f95_local20 = f95_local19 + f95_local20 + local f95_local21 + if f95_local9 or f95_local10 then + f95_local21 = f95_local4 / 2 + if not f95_local21 then + + else + f95_local21 = f95_local18 + f95_local21 + local f95_local22 = "" + if f95_local11 then + f95_local22 = "alien_dpad_arrow_left" + elseif f95_local12 then + f95_local22 = "alien_dpad_arrow_right" + elseif f95_local9 then + f95_local22 = "alien_dpad_arrow_up" + elseif f95_local10 then + f95_local22 = "alien_dpad_arrow_down" + end + local f95_local23 = LUI.UIImage.new() + f95_local23.id = "arrow" + f95_local23:registerAnimationState( "default", { + material = RegisterMaterial( f95_local22 ), + topAnchor = f95_local9, + bottomAnchor = f95_local10, + leftAnchor = f95_local11, + rightAnchor = f95_local12, + top = f95_local18, + bottom = f95_local21, + left = f95_local19, + right = f95_local20, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 0.2 + } ) + f95_local23:registerAnimationState( "enabled", CoD.ColorizeState( Colors.white, { + alpha = 0.8 + } ) ) + f95_local23:animateToState( "default" ) + self:addElement( f95_local23 ) + local f95_local24 = function ( f96_arg0 ) + if f96_arg0.cachedCash then + if not f95_arg1 or f95_arg1() <= f96_arg0.cachedCash then + f95_local8:animateToState( "enabled" ) + f95_local23:animateToState( "enabled" ) + if f95_local17 then + f95_local17:animateToState( "enabled" ) + end + else + f95_local8:animateToState( "default" ) + f95_local23:animateToState( "default" ) + if f95_local17 then + f95_local17:animateToState( "default" ) + end + end + end + end + + self:registerEventHandler( "cash_change", function ( element, event ) + element.cachedCash = event.newValue + f95_local24( element ) + end ) + self:registerEventHandler( "ability_levels_change", function ( element, event ) + if f95_local17 and f95_arg1 then + f95_local17:setText( tostring( f95_arg1() ) ) + end + f95_local8:setImage( RegisterMaterial( f95_arg2() ) ) + f95_local24( element ) + end ) + return self + end + end + f95_local21 = f95_local4 + end + end + f95_local20 = f95_local4 + end + end + f95_local19 = -f95_local4 / 2 + end + else + if f95_local12 then + f95_local19 = -6 - f95_local4 / 2 + if not f95_local19 then + + else + local f95_local20 + if f95_local11 or f95_local12 then + f95_local20 = f95_local4 / 2 + if not f95_local20 then + + else + f95_local20 = f95_local19 + f95_local20 + local f95_local21 + if f95_local9 or f95_local10 then + f95_local21 = f95_local4 / 2 + if not f95_local21 then + + else + f95_local21 = f95_local18 + f95_local21 + local f95_local22 = "" + if f95_local11 then + f95_local22 = "alien_dpad_arrow_left" + elseif f95_local12 then + f95_local22 = "alien_dpad_arrow_right" + elseif f95_local9 then + f95_local22 = "alien_dpad_arrow_up" + elseif f95_local10 then + f95_local22 = "alien_dpad_arrow_down" + end + local f95_local23 = LUI.UIImage.new() + f95_local23.id = "arrow" + f95_local23:registerAnimationState( "default", { + material = RegisterMaterial( f95_local22 ), + topAnchor = f95_local9, + bottomAnchor = f95_local10, + leftAnchor = f95_local11, + rightAnchor = f95_local12, + top = f95_local18, + bottom = f95_local21, + left = f95_local19, + right = f95_local20, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 0.2 + } ) + f95_local23:registerAnimationState( "enabled", CoD.ColorizeState( Colors.white, { + alpha = 0.8 + } ) ) + f95_local23:animateToState( "default" ) + self:addElement( f95_local23 ) + local f95_local24 = function ( f96_arg0 ) + if f96_arg0.cachedCash then + if not f95_arg1 or f95_arg1() <= f96_arg0.cachedCash then + f95_local8:animateToState( "enabled" ) + f95_local23:animateToState( "enabled" ) + if f95_local17 then + f95_local17:animateToState( "enabled" ) + end + else + f95_local8:animateToState( "default" ) + f95_local23:animateToState( "default" ) + if f95_local17 then + f95_local17:animateToState( "default" ) + end + end + end + end + + self:registerEventHandler( "cash_change", function ( element, event ) + element.cachedCash = event.newValue + f95_local24( element ) + end ) + self:registerEventHandler( "ability_levels_change", function ( element, event ) + if f95_local17 and f95_arg1 then + f95_local17:setText( tostring( f95_arg1() ) ) + end + f95_local8:setImage( RegisterMaterial( f95_arg2() ) ) + f95_local24( element ) + end ) + return self + end + end + f95_local21 = f95_local4 + end + end + f95_local20 = f95_local4 + end + end + f95_local19 = -f95_local4 / 2 + end + -- ERROR: Infinite loop detected + end + end + f95_local18 = -f95_local4 / 2 + end + local f95_local19 + if f95_local11 then + f95_local19 = 6 + if not f95_local19 then + if f95_local12 then + f95_local19 = -6 - f95_local4 / 2 + if not f95_local19 then + + else + -- ERROR: Infinite loop detected + end + end + f95_local19 = -f95_local4 / 2 + end + else + -- ERROR: Infinite loop detected + end + -- ERROR: Infinite loop detected +end + +function quick_shop() + local f99_local0 = Engine.GetLuiRoot() + local f99_local1 = f99_local0.m_controllerIndex + local f99_local2 = function ( f100_arg0 ) + return function () + local f101_local0 = LUI.mp_menus.Aliens + return f101_local0.GetFieldForAbility( f101_local0.GetAlienSessionAbility( -1, f100_arg0 ), f101_local0.AlienAbilities.Cols.DpadIcon ) + end + + end + + local f99_local3 = function ( f102_arg0 ) + return function () + local f103_local0 = LUI.mp_menus.Aliens + return tonumber( f103_local0.GetFieldForAbility( f103_local0.GetAlienSessionAbility( -1, f102_arg0 ), f103_local0.AlienAbilities.Cols.CurrencyCost ) ) + end + + end + + local self = LUI.UIElement.new() + self.id = "dpad" + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -54, + bottom = 14, + left = -54, + right = 44 + } ) + self:animateToState( "default" ) + local f99_local5 = 180 + local f99_local6 = 180 + local f99_local7 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_dpad_darken" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + height = f99_local6, + bottom = f99_local6 / 2, + width = f99_local5, + right = f99_local5 / 2, + alpha = 0.4 + } ) + f99_local7.id = "circle" + self:addElement( f99_local7 ) + local f99_local8 = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -13, + bottom = 13, + left = -32, + right = 32 + } ) + f99_local8.id = "frame" + local f99_local9 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0.1 + } ) + f99_local9.id = "frameImage" + local f99_local10 = LUI.MenuBuilder.BuildRegisteredType( "generic_border", { + border_red = 0, + border_green = 0, + border_blue = 0, + border_alpha = 0.2 + } ) + f99_local8:addElement( f99_local9 ) + f99_local8:addElement( f99_local10 ) + self:addElement( f99_local8 ) + local f99_local11 = quick_shop_item( LUI.Alignment.Right, f99_local3( "offense" ), f99_local2( "offense" ) ) + local f99_local12 = quick_shop_item( LUI.Alignment.Left, f99_local3( "defense" ), f99_local2( "defense" ) ) + if LUI.mp_menus.Aliens.IsChaosMode() then + self:addElement( LUI.MenuBuilder.BuildRegisteredType( "quick_shop_freeze_item" ) ) + elseif not Engine.AliensCheckIsRelicEnabled( f99_local1, "nerf_no_deployables" ) then + local f99_local13 = quick_shop_item( LUI.Alignment.Top, f99_local3( "munition" ), f99_local2( "munition" ) ) + local f99_local14 = quick_shop_item( LUI.Alignment.Bottom, f99_local3( "support" ), f99_local2( "support" ) ) + self:addElement( f99_local13 ) + self:addElement( f99_local14 ) + end + if LUI.mp_menus.Aliens.IsChaosMode() or not Engine.AliensCheckIsRelicEnabled( f99_local1, "nerf_no_abilities" ) then + self:addElement( f99_local11 ) + self:addElement( f99_local12 ) + end + local f99_local13 = LUI.UIText.new() + f99_local13.id = "value" + f99_local13:setupUIBindText( "AlienCash", Engine.Localize( "@ALIENS_DOLLARS" ) ) + f99_local13:registerAnimationState( "default", { + font = CoD.TextSettings.HudIW6SmallFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.HudIW6SmallFont.Height / 2, + bottom = CoD.TextSettings.HudIW6SmallFont.Height / 2, + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b + } ) + f99_local13:registerAnimationState( "pulse_orange", { + font = CoD.TextSettings.HudIW6SmallFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -1.5 * CoD.TextSettings.HudIW6SmallFont.Height / 2, + bottom = 1.5 * CoD.TextSettings.HudIW6SmallFont.Height / 2, + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b + } ) + f99_local13:registerAnimationState( "pulse_cyan", { + font = CoD.TextSettings.HudIW6SmallFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -1.5 * CoD.TextSettings.HudIW6SmallFont.Height / 2, + bottom = 1.5 * CoD.TextSettings.HudIW6SmallFont.Height / 2, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f99_local13:registerEventHandler( "cash_change", function ( element, event ) + local f104_local0 = 1 + local f104_local1 = "pulse_orange" + local f104_local2 = Colors.orange + local f104_local3 = "" + if event.oldValue < event.newValue then + f104_local0 = -1 + f104_local1 = "pulse_cyan" + f104_local2 = Colors.cyan + f104_local3 = "+" + end + local self = MBh.AnimateSequence( { + { + f104_local1, + 150 + }, + { + "default", + 150 + } + } ) + self( element, {} ) + self = LUI.UIText.new() + self:setTextStyle( CoD.TextStyle.Shadowed ) + self:setText( f104_local3 .. event.newValue - event.oldValue ) + self:registerAnimationState( "default", { + font = CoD.TextSettings.HudIW6SmallFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.HudIW6SmallFont.Height / 2, + bottom = CoD.TextSettings.HudIW6SmallFont.Height / 2, + red = f104_local2.r, + green = f104_local2.g, + blue = f104_local2.b, + alpha = 0.8 + } ) + local f104_local5 = math.random( -40, 40 ) + self:registerAnimationState( "drift", { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = f104_local5, + right = f104_local5, + top = f104_local0 * 50 - CoD.TextSettings.HudIW6SmallFont.Height / 2, + bottom = f104_local0 * 50 + CoD.TextSettings.HudIW6SmallFont.Height / 2 + } ) + self:animateToState( "default" ) + self:animateToState( "drift", 500 ) + self:registerEventHandler( LUI.FormatAnimStateFinishEvent( "drift" ), function ( element, event ) + element:close() + end ) + element:addElement( self ) + end ) + f99_local13:animateToState( "default" ) + self:addElement( f99_local13 ) + local f99_local14 = quick_shop_class_skill( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 26, + bottom = 26, + left = -5, + right = -5 + } ) + local f99_local15 = quick_shop_class_skill_secondary( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 126, + bottom = 126, + left = -95, + right = -95 + } ) + local f99_local16 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f99_local16.id = "quick_shop_root" + local f99_local17 = function ( f106_arg0, f106_arg1 ) + if f106_arg1.value then + f106_arg0:animateToState( "lowAlpha", 0 ) + else + f106_arg0:animateToState( "default", 0 ) + end + end + + local f99_local18 = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -130 + (Engine.UsingSplitscreenUpscaling() and 6 or 0) - 128, + height = 256, + left = -203, + right = 53, + alpha = 1 + } ) + f99_local18:registerAnimationState( "lowAlpha", { + alpha = 0.3 + } ) + f99_local18.id = "quick_shop" + f99_local18:registerOmnvarHandler( "ui_alien_quick_shop_disabled", f99_local17 ) + f99_local17( f99_local18, { + value = Game.GetOmnvar( "ui_alien_quick_shop_disabled" ) + } ) + f99_local16:addElement( f99_local18 ) + f99_local18:addElement( self ) + f99_local18:addElement( f99_local14 ) + f99_local18:addElement( f99_local15 ) + return f99_local16 +end + +function cash_notification( f107_arg0, f107_arg1 ) + assert( f107_arg1 ) + local f107_local0 = 600 + local f107_local1 = 8 + local f107_local2 = 0.75 + local f107_local3 = 80 + local f107_local4 = -140 + local f107_local5 = 50 + local f107_local6 = CoD.TextSettings.HudIW6BigFont + local self = LUI.UIText.new( CoD.ColorizeState( Colors.frontend_hilite, { + alignment = LUI.Alignment.Center, + font = f107_local6.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = f107_local4 - f107_local3 / 2, + top = f107_local5, + width = f107_local3, + height = f107_local6.Height + } ) ) + self.id = "cash_get_" .. f107_arg0 + self:setTextStyle( CoD.TextStyle.Shadowed ) + self:setText( Engine.Localize( "ALIEN_SPLASHES_MONEY", f107_arg1 ) ) + local f107_local8 = nil + local f107_local9 = f107_local0 / f107_local1 / 1000 + local f107_local10 = 0 + local f107_local11 = 0 + local f107_local12 = -250 - 150 * math.random() + local f107_local13 = -100 + 200 * math.random() + local f107_local14 = 800 + local f107_local15 = {} + local f107_local16 = nil + local f107_local17 = f107_local2 * f107_local1 + for f107_local18 = 1, f107_local1, 1 do + f107_local12 = f107_local12 + f107_local14 * f107_local9 + f107_local10 = f107_local10 + f107_local13 * f107_local9 + f107_local11 = f107_local11 + f107_local12 * f107_local9 + f107_local16 = 1 + if f107_local17 <= f107_local18 then + f107_local16 = 1 - (f107_local18 - f107_local17) / (f107_local1 - f107_local2 * f107_local1) + end + f107_local8 = "anim_" .. f107_local18 + self:registerAnimationState( f107_local8, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = f107_local4 - f107_local10 - f107_local3 / 2, + top = f107_local5 + f107_local11, + width = f107_local3, + height = f107_local6.Height, + alpha = f107_local16 + } ) + table.insert( f107_local15, { + f107_local8, + f107_local9 * 1000 + } ) + end + local f107_local18 = MBh.AnimateSequence( f107_local15 ) + f107_local18( self, {} ) + self:registerEventHandler( LUI.FormatAnimStateFinishEvent( f107_local8 ), function ( element, event ) + element:close() + end ) + return self +end + +function cash_widget() + local f109_local0 = 0 + local f109_local1 = 8 + local self = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self.id = "cash_notifications" + local f109_local3 = function ( f110_arg0, f110_arg1 ) + if f109_local1 <= f110_arg0:getNumChildren() then + return + else + f109_local0 = f109_local0 + 1 + f110_arg0:addElement( cash_notification( f109_local0, f110_arg1 ) ) + end + end + + self:registerEventHandler( "cash_change", function ( element, event ) + local f111_local0 = event.newValue - event.oldValue + if f111_local0 <= 0 then + return + else + f109_local3( element, f111_local0 ) + end + end ) + self:registerOmnvarHandler( "ui_alien_cash_overflow", function ( f112_arg0, f112_arg1 ) + f109_local3( f112_arg0, 0 ) + end ) + return self +end + +function DrillStateUpdateHandler( f113_arg0, f113_arg1 ) + if f113_arg1.value == 0 then + f113_arg0:animateToState( "default", 200 ) + f113_arg0.progression.started = false + f113_arg0.progression:animateToState( "default" ) + else + f113_arg0:animateToState( "visible", 200 ) + end + if f113_arg1.value ~= 1 and f113_arg0.progression.started then + f113_arg0.countdown:freeze() + f113_arg0.progression:cancelAnimateToState() + end +end + +function DrillTimerUpdateHandler( f114_arg0, f114_arg1 ) + f114_arg0.countdown:setEndTime( f114_arg1.value ) + if f114_arg1.value > 0 then + f114_arg0.progression.started = true + f114_arg0.progression.endTime = f114_arg1.value + f114_arg0.countdown:unfreeze() + local f114_local0 = (Game.GetTime() - Game.GetOmnvar( "ui_alien_drill_start_milliseconds" )) / (f114_arg1.value - Game.GetOmnvar( "ui_alien_drill_start_milliseconds" )) + if f114_arg0.isGenerator then + f114_arg0.progression:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = 172 - 166 * f114_local0, + left = -4, + width = 6, + bottom = -12 + } ) + else + f114_arg0.progression:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 6, + left = -4, + width = 6, + height = 166 * f114_local0 + } ) + end + f114_arg0.progression:animateToState( "current", 0 ) + f114_arg0.progression:animateToState( "full", math.max( 0, f114_arg1.value - Game.GetTime() ), false, false ) + else + f114_arg0.progression.endTime = nil + end +end + +function DrillHealthTextUpdateHandler( f115_arg0, f115_arg1 ) + f115_arg0.health:setText( Engine.Localize( f115_arg0.isGenerator and "@ALIENS_GENERATOR_HEALTH" or "@ALIENS_DRILL_HEALTH", f115_arg1.value ) ) +end + +function DrillHealthUpdateHandler( f116_arg0, f116_arg1 ) + if f116_arg0.progression.endTime and f116_arg0.progression.started then + f116_arg0.progression:cancelAnimateToState() + end + local f116_local0 = CoD.GradientMap( { + { + threshold = 0, + color = { + r = 0.9, + g = 0.6, + b = 0 + } + }, + { + threshold = 0.33, + color = { + r = 0.9, + g = 0.78, + b = 0.1 + } + }, + { + threshold = 0.67, + color = { + r = 0.35, + g = 0.7, + b = 0.9 + } + }, + { + threshold = 1, + color = { + r = 0.35, + g = 0.7, + b = 0.9 + } + } + }, LUI.clamp( f116_arg1.value, 0, 150 ) / 150 ) + f116_arg0.health:registerAnimationState( "current", CoD.ColorizeState( f116_local0 ) ) + f116_arg0.health:animateToState( "current" ) + f116_arg0.icon:registerAnimationState( "current", CoD.ColorizeState( f116_local0 ) ) + f116_arg0.icon:animateToState( "current" ) + f116_arg0.progression:registerAnimationState( "current", CoD.ColorizeState( f116_local0, { + alpha = 0.75 + } ) ) + f116_arg0.progression:animateToState( "current" ) + if f116_arg0.progression.endTime and f116_arg0.progression.started then + f116_arg0.progression:animateToState( "full", math.max( 0, f116_arg0.progression.endTime - Game.GetTime() ), false, false ) + end +end + +function DrillMarkersUpdateHandler( f117_arg0, f117_arg1 ) + f117_arg0.gradations:closeChildren() + f117_arg0.gradations.ticks = {} + local f117_local0 = string.format( "([^%s]+)", " " ) + local f117_local1 = Engine.TableLookup( "mp/alien/default_cycle_spawn.csv", 0, f117_arg1.value, 2 ) + local f117_local2 = {} + f117_local1:gsub( f117_local0, function ( f118_arg0 ) + f117_local2[#f117_local2 + 1] = f118_arg0 + end ) + if #f117_local2 == 0 then + return + end + local f117_local3 = tonumber( table.remove( f117_local2, #f117_local2 ) ) + for f117_local7, f117_local8 in ipairs( f117_local2 ) do + local f117_local9 = tonumber( f117_local8 ) + local self = LUI.UIImage.new() + self.id = "marker_" .. f117_local9 + self:registerAnimationState( "default", { + material = RegisterMaterial( "alien_meter_mark" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 160 * f117_local9 / f117_local3 - 4, + left = 0, + width = 14, + height = 8 + } ) + self:animateToState( "default" ) + f117_arg0.gradations:addElement( self ) + local f117_local11 = LUI.UIImage.new() + f117_local11.id = "markerHL" + f117_local11:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 3, + left = 2, + width = 5, + height = 1, + red = 0.9, + green = 0.6, + blue = 0 + } ) + f117_local11:animateToState( "default" ) + self:addElement( f117_local11 ) + local f117_local12 = LUI.UIImage.new() + f117_local12.id = "markerTick" + f117_local12:registerAnimationState( "default", { + material = RegisterMaterial( "alien_meter_fill_tic" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -28, + left = -2, + width = 0, + height = 0, + alpha = 0 + } ) + f117_local12:registerAnimationState( "ticked", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -8, + left = -10, + width = 16, + height = 16, + alpha = 1 + } ) + f117_local12:animateToState( "default" ) + f117_local12:registerEventHandler( "tick_layer", function ( element, event ) + if event.layer == f117_local7 then + element:animateToState( "ticked", 400 ) + end + end ) + self:addElement( f117_local12 ) + end +end + +function DrillLayersUpdateHandler( f120_arg0, f120_arg1 ) + f120_arg0:processEvent( { + name = "tick_layer", + layer = f120_arg1.value + } ) +end + +function drill_meter( f121_arg0 ) + local self = LUI.UIElement.new() + self.id = "drill_meter" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f121_local1 = Engine.UsingSplitscreenUpscaling() and 10 or 0 + local f121_local2 = LUI.UIElement.new() + f121_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 25 + f121_local1, + left = 15, + width = 256, + height = 256, + alpha = 0 + } ) + f121_local2.isGenerator = f121_arg0 + f121_local2:registerAnimationState( "visible", { + alpha = 1 + } ) + f121_local2:animateToState( "default" ) + local f121_local3 = LUI.UIImage.new() + f121_local3.id = "background" + f121_local3:registerAnimationState( "default", { + material = RegisterMaterial( "alien_drill_meter_bg" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + f121_local3:animateToState( "default" ) + f121_local2:addElement( f121_local3 ) + local f121_local4 = f121_local2.isGenerator and 24 or 20 + local f121_local5 = LUI.UIText.new() + f121_local5.id = "title" + f121_local5:setText( Engine.Localize( f121_local2.isGenerator and "@ALIENS_GENERATOR_PROGRESS" or "@ALIENS_DRILL_PROGRESS" ) ) + f121_local5:setTextStyle( CoD.TextStyle.OutlinedMore ) + f121_local5:registerAnimationState( "default", { + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f121_local4, + top = 0, + right = 0, + height = CoD.TextSettings.BigFont.Height + } ) + f121_local5:animateToState( "default" ) + f121_local2:addElement( f121_local5 ) + local f121_local6 = LUI.UIImage.new() + f121_local6.id = "fillBG" + f121_local6:registerAnimationState( "default", { + material = RegisterMaterial( "alien_meter_fill_bg" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 20, + left = -5, + width = 16, + height = 178 + } ) + f121_local6:animateToState( "default" ) + f121_local2:addElement( f121_local6 ) + local f121_local7 = 20 + local f121_local8 = 850 + for f121_local9 = 0, 7, 1 do + local f121_local12 = LUI.UIImage.new() + f121_local12.id = "arrow_" .. f121_local9 + local f121_local13 = 16.67 * f121_local7 / f121_local8 + local f121_local14 = f121_local2.isGenerator and -5 or 5 + local f121_local15 = f121_local2.isGenerator and f121_local7 * (f121_local9 + 1) - f121_local13 or f121_local9 * f121_local7 + local f121_local16 = f121_local2.isGenerator and f121_local9 * f121_local7 or f121_local7 * (f121_local9 + 1) - f121_local13 + f121_local12:registerAnimationState( "default", { + material = RegisterMaterial( "alien_drill_meter_arrow_anim" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 3, + width = 9, + height = f121_local14, + top = f121_local15 + } ) + f121_local12:registerAnimationState( "next", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 3, + width = 9, + height = f121_local14, + top = f121_local16 + } ) + f121_local12:animateToState( "default" ) + local f121_local17 = MBh.AnimateLoop( { + { + "default", + 0 + }, + { + "next", + f121_local8 + } + } ) + f121_local17( f121_local12, nil ) + f121_local6:addElement( f121_local12 ) + end + f121_local2.progression = LUI.UIImage.new() + f121_local2.progression.id = "progression" + f121_local2.progression:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 6, + left = -4, + width = 6, + height = 0, + alpha = 0.75 + } ) + f121_local2.progression:registerAnimationState( "full", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = 6, + left = -4, + width = 6, + bottom = -12 + } ) + f121_local2.progression:animateToState( "default" ) + f121_local6:addElement( f121_local2.progression ) + f121_local2.gradations = LUI.UIElement.new() + f121_local2.gradations.id = "gradations" + f121_local2.gradations:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = 6, + bottom = -12, + left = -5, + width = 6 + } ) + f121_local2.gradations:animateToState( "default" ) + f121_local6:addElement( f121_local2.gradations ) + local f121_local9 = LUI.UIImage.new() + f121_local9.id = "endCap" + f121_local9:registerAnimationState( "default", { + material = RegisterMaterial( "alien_meter_mark_end" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = -3, + left = -7, + width = 32, + height = 16 + } ) + f121_local9:animateToState( "default" ) + local f121_local10 = LUI.UIImage.new() + f121_local10.id = "endCapHL" + f121_local10:registerAnimationState( "default", { + material = RegisterMaterial( "alien_meter_mark_end_highlight" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -3.5, + left = -5.5, + width = 8, + height = 8, + red = 0.75, + green = 0.22, + blue = 0.16 + } ) + f121_local10:animateToState( "default" ) + f121_local9:addElement( f121_local10 ) + f121_local6:addElement( f121_local9 ) + local f121_local11 = LUI.UIElement.new() + f121_local11.id = "countdownContainer" + f121_local11:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 20, + left = 0, + width = 160, + height = 30 + } ) + f121_local11:animateToState( "default" ) + local f121_local18 = LUI.UIImage.new() + f121_local18.id = "countdownBG" + f121_local18:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0.25 + } ) + f121_local18:animateToState( "default" ) + f121_local2.countdown = LUI.UICountdown.new( {} ) + f121_local2.countdown.id = "countdown" + f121_local2.countdown:registerAnimationState( "default", { + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.ExtraBigFont.Font, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + height = CoD.TextSettings.ExtraBigFont.Height, + left = 0, + right = 0, + alpha = 0 + } ) + f121_local2.countdown:animateToState( "default" ) + local f121_local12 = f121_local2.isGenerator and 24 or 20 + f121_local2.health = LUI.UIText.new( {} ) + f121_local2.health.id = "health" + f121_local2.health:setTextStyle( CoD.TextStyle.OutlinedMore ) + f121_local2.health:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -5, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + left = f121_local12, + right = 120 + } ) + f121_local2.health:animateToState( "default" ) + f121_local11:addElement( f121_local2.health ) + f121_local2:addElement( f121_local11 ) + local f121_local13 = f121_local2.isGenerator and "alien_icon_conduit" or "alien_drill_icon" + local f121_local14 = f121_local2.isGenerator and 44 or 32 + f121_local2.icon = LUI.UIImage.new() + f121_local2.icon.id = "drill_icon" + f121_local2.icon:registerAnimationState( "default", { + material = RegisterMaterial( f121_local13 ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -17, + left = -20, + width = f121_local14, + height = 64 + } ) + f121_local2.icon:animateToState( "default" ) + f121_local2:addElement( f121_local2.icon ) + f121_local2:registerOmnvarHandler( "ui_alien_drill_state", DrillStateUpdateHandler ) + f121_local2:registerOmnvarHandler( "ui_alien_drill_end_milliseconds", DrillTimerUpdateHandler ) + f121_local2:registerOmnvarHandler( "ui_alien_drill_layers_table_line", DrillMarkersUpdateHandler ) + f121_local2:registerOmnvarHandler( "ui_alien_drill_layer_completed", DrillLayersUpdateHandler ) + f121_local2:registerOmnvarHandler( "ui_alien_drill_health_text", function ( f122_arg0, f122_arg1 ) + DrillHealthUpdateHandler( f122_arg0, f122_arg1 ) + DrillHealthTextUpdateHandler( f122_arg0, f122_arg1 ) + end ) + if 0 < Game.GetOmnvar( "ui_alien_drill_state" ) then + DrillStateUpdateHandler( f121_local2, { + value = Game.GetOmnvar( "ui_alien_drill_state" ) + } ) + DrillMarkersUpdateHandler( f121_local2, { + value = Game.GetOmnvar( "ui_alien_drill_layers_table_line" ) + } ) + DrillLayersUpdateHandler( f121_local2, { + value = Game.GetOmnvar( "ui_alien_drill_layer_completed" ) + } ) + DrillHealthUpdateHandler( f121_local2, { + value = Game.GetOmnvar( "ui_alien_drill_health_text" ) + } ) + DrillHealthTextUpdateHandler( f121_local2, { + value = Game.GetOmnvar( "ui_alien_drill_health_text" ) + } ) + DrillTimerUpdateHandler( f121_local2, { + value = Game.GetOmnvar( "ui_alien_drill_end_milliseconds" ) + } ) + end + self:addElement( f121_local2 ) + return self +end + +function attack_chopper() + local f123_local0 = { + AWAY = 0, + EVADING = 1, + ATTACKING = 2, + INCOMING = 3 + } + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self.id = "attack_chopper" + local f123_local2 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 14, + left = 50, + width = 64, + height = 90, + alpha = 0 + } ) + f123_local2:registerAnimationState( "visible", { + alpha = 1 + } ) + f123_local2.id = "attack_chopper_elt" + self:addElement( f123_local2 ) + local f123_local3 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_icon_chopper" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = 64, + height = 64, + zRot = -25, + alpha = 0.8 + } ) + f123_local3.id = "icon" + f123_local2:addElement( f123_local3 ) + local f123_local4 = LUI.UIText.new( { + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 50, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + left = 0, + right = 0 + } ) + f123_local4.id = "status" + f123_local4:setTextStyle( CoD.TextStyle.OutlinedMore ) + f123_local2:addElement( f123_local4 ) + local f123_local5 = function ( f124_arg0, f124_arg1 ) + if f124_arg1.value == f123_local0.EVADING then + f123_local4:setText( Engine.Localize( "@ALIENS_CHOPPER_STATE_EVADING" ) ) + f123_local2:animateToState( "visible", 200 ) + elseif f124_arg1.value == f123_local0.ATTACKING then + f123_local4:setText( Engine.Localize( "@ALIENS_CHOPPER_STATE_ATTACKING" ) ) + f123_local2:animateToState( "visible", 200 ) + elseif f124_arg1.value == f123_local0.INCOMING then + f123_local4:setText( Engine.Localize( "@ALIENS_CHOPPER_STATE_INCOMING" ) ) + f123_local2:animateToState( "visible", 200 ) + else + f123_local2:animateToState( "default", 200 ) + end + end + + f123_local2:registerOmnvarHandler( "ui_alien_chopper_state", f123_local5 ) + local f123_local6 = Game.GetOmnvar( "ui_alien_chopper_state" ) + if f123_local6 ~= f123_local0.AWAY then + f123_local5( f123_local2, { + value = f123_local6 + } ) + end + return self +end + +f0_local2 = { + AWAY = 0, + EARLY_ENCOUNTER = 1, + FINAL_ENCOUNTER = 2 +} +local f0_local3 = { + HIVE = { + id = 0, + material = "alien_icon_blockerhive" + }, + BREEDER = { + id = 1, + material = "alien_icon_breeder" + }, + KRAKEN = { + id = 2, + material = "alien_icon_kraken" + }, + BIOHAZARD = { + id = 3, + material = "alien_icon_biohazard" + }, + ARK_CONSOLE = { + id = 4, + material = "alien_icon_console" + }, + CORTEX = { + id = 5, + material = "alien_icon_cortex" + } +} +function GetCurrentBossIcon() + local f125_local0 = Engine.GetDvarString( "ui_mapname" ) == "mp_alien_town" + local f125_local1 = Engine.GetDvarString( "ui_mapname" ) == "mp_alien_armory" + if f125_local0 then + return f0_local3.HIVE.id + elseif f125_local1 then + return f0_local3.BREEDER.id + else + return Game.GetOmnvar( "ui_alien_boss_icon" ) + end +end + +function GetBossIconMaterial( f126_arg0 ) + local f126_local0 = "white" + for f126_local4, f126_local5 in pairs( f0_local3 ) do + if f126_arg0 == f126_local5.id then + f126_local0 = f126_local5.material + break + end + end + return RegisterMaterial( f126_local0 ) +end + +function BossStatusUpdateHandler( f127_arg0, f127_arg1 ) + if f127_arg1.value == f0_local2.EARLY_ENCOUNTER then + f127_arg0:animateToState( "visible", 200 ) + f127_arg0.extraHealth:animateToState( "visible", 0 ) + elseif f127_arg1.value == f0_local2.FINAL_ENCOUNTER then + f127_arg0:animateToState( "visible", 200 ) + f127_arg0.extraHealth:animateToState( "default", 0 ) + else + f127_arg0:animateToState( "default", 200 ) + end +end + +function BossProgressionUpdateHandler( f128_arg0, f128_arg1 ) + local f128_local0 = 160 + f128_arg0.progression:registerAnimationState( "updated", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = -10, + left = -3, + width = 4, + height = f128_local0 - f128_local0 * f128_arg1.value / 100 + } ) + f128_arg0.progression:animateToState( "updated", 100 ) + if not f128_arg0.bossIcon.pulsating then + f128_arg0.bossIcon.pulsating = true + local f128_local1 = MBh.AnimateSequence( { + { + "pulse", + 150 + }, + { + "default", + 150 + } + } ) + f128_local1( f128_arg0.bossIcon, {} ) + f128_arg0.bossIcon:registerEventHandler( LUI.FormatAnimStateFinishEvent( "default" ), function ( element, event ) + element.pulsating = false + end ) + end +end + +function boss_meter() + local f130_local0 = Engine.GetDvarString( "ui_mapname" ) == "mp_alien_armory" + local self = LUI.UIElement.new() + self.id = "boss_meter" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f130_local2 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 48 + (Engine.UsingSplitscreenUpscaling() and 10 or 0), + left = 10, + width = 256, + height = 256, + alpha = 0 + } ) + f130_local2:registerAnimationState( "visible", { + alpha = 1 + } ) + f130_local2:animateToState( "default" ) + if Engine.GetDvarString( "ui_mapname" ) == "mp_alien_last" then + f130_local2.bossIconBG = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -25, + left = -16, + width = 42, + height = 42, + red = 0, + green = 0, + blue = 0, + alpha = 0.75, + zRot = 45 + } ) + f130_local2.bossIconBG.id = "bossIconBG" + f130_local2:addElement( f130_local2.bossIconBG ) + end + local f130_local3 = function ( f131_arg0, f131_arg1 ) + f131_arg0:setImage( GetBossIconMaterial( f131_arg1 ) ) + end + + f130_local2.bossIcon = LUI.UIImage.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -25, + left = -16, + width = 42, + height = 42, + alpha = 0.8 + } ) + f130_local2.bossIcon:registerAnimationState( "pulse", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -31, + left = -19, + width = 48, + height = 48 + } ) + f130_local2.bossIcon.id = "boss_icon" + f130_local3( f130_local2.bossIcon, GetCurrentBossIcon() ) + f130_local2.bossIcon:registerOmnvarHandler( "ui_alien_boss_icon", function ( f132_arg0, f132_arg1 ) + f130_local3( f132_arg0, f132_arg1.value ) + end ) + f130_local2:addElement( f130_local2.bossIcon ) + f130_local2.fillBG = LUI.UIImage.new( { + material = RegisterMaterial( "alien_meter_fill_bg" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 15, + left = -2, + width = 16, + height = 178 + } ) + f130_local2.fillBG.id = "fillBG" + f130_local2:addElement( f130_local2.fillBG ) + if Engine.GetDvarString( "ui_mapname" ) == "mp_alien_last" then + f130_local2.quarter_tic_100 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_meter_mark" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 20, + left = 2, + width = 12, + height = 8 + } ) + f130_local2.quarter_tic_100.id = "quarter_tic_100" + f130_local2:addElement( f130_local2.quarter_tic_100 ) + f130_local2.quarter_tic_75 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_meter_mark" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 60, + left = 2, + width = 12, + height = 8 + } ) + f130_local2.quarter_tic_75.id = "quarter_tic_75" + f130_local2:addElement( f130_local2.quarter_tic_75 ) + f130_local2.quarter_tic_50 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_meter_mark" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 100, + left = 2, + width = 12, + height = 8 + } ) + f130_local2.quarter_tic_50.id = "quarter_tic_50" + f130_local2:addElement( f130_local2.quarter_tic_50 ) + f130_local2.quarter_tic_25 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_meter_mark" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 140, + left = 2, + width = 12, + height = 8 + } ) + f130_local2.quarter_tic_25.id = "quarter_tic_25" + f130_local2:addElement( f130_local2.quarter_tic_25 ) + end + f130_local2.extraHealth = LUI.UIImage.new( CoD.ColorizeState( Colors.blue, { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = -10, + left = -3, + width = 4, + height = 158, + alpha = 0 + } ) ) + f130_local2.extraHealth.id = "extraHealth" + f130_local2.extraHealth:registerAnimationState( "visible", { + alpha = 1 + } ) + f130_local2.fillBG:addElement( f130_local2.extraHealth ) + f130_local2.progression = LUI.UIImage.new( CoD.ColorizeState( Colors.orange, { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = -10, + left = -3, + width = 4, + height = 0, + alpha = 0.75 + } ) ) + f130_local2.progression.id = "progression" + f130_local2.fillBG:addElement( f130_local2.progression ) + local f130_local4 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_meter_mark_end" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = -3, + left = -7, + width = 32, + height = 16 + } ) + f130_local4.id = "endCap" + f130_local2.fillBG:addElement( f130_local4 ) + local f130_local5 = LUI.UIImage.new( CoD.ColorizeState( Colors.orange, { + material = RegisterMaterial( "alien_meter_mark_end_highlight" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -3.5, + left = -5.5, + width = 8, + height = 8 + } ) ) + f130_local5.id = "endCapHL" + f130_local4:addElement( f130_local5 ) + f130_local2:registerOmnvarHandler( "ui_alien_boss_progression", BossProgressionUpdateHandler ) + f130_local2:registerOmnvarHandler( "ui_alien_boss_status", BossStatusUpdateHandler ) + if f0_local2.AWAY ~= Game.GetOmnvar( "ui_alien_boss_status" ) then + BossProgressionUpdateHandler( f130_local2, { + value = Game.GetOmnvar( "ui_alien_boss_progression" ) + } ) + BossStatusUpdateHandler( f130_local2, { + value = Game.GetOmnvar( "ui_alien_boss_status" ) + } ) + end + self:addElement( f130_local2 ) + return self +end + +function juiced_timer() + local self = LUI.UIElement.new() + self.id = "juiced_timer" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f133_local1 = LUI.UIElement.new() + f133_local1:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = -14, + left = -16, + right = 16, + height = 32, + alpha = 0 + } ) + f133_local1:registerAnimationState( "visible", { + alpha = 1 + } ) + f133_local1:animateToState( "default" ) + local f133_local2 = LUI.UIImage.new() + f133_local2.id = "icon" + f133_local2:registerAnimationState( "default", { + material = RegisterMaterial( "specialty_juiced" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + bottom = 0, + height = 32 + } ) + f133_local2:animateToState( "default" ) + f133_local1:addElement( f133_local2 ) + local f133_local3 = LUI.UICountdown.new( {} ) + f133_local3.id = "countdown" + f133_local3:registerAnimationState( "default", { + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudDigitalNormalFont.Font, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 20, + left = 0, + right = 0, + height = CoD.TextSettings.HudDigitalNormalFont.Height + } ) + f133_local3:animateToState( "default" ) + f133_local1:addElement( f133_local3 ) + f133_local1:registerDvarHandler( "ui_juiced_end_milliseconds", function ( f134_arg0, f134_arg1 ) + if f134_arg1.value > 0 then + f133_local3:setEndTime( f134_arg1.value ) + if f134_arg0.current_state ~= "visible" then + f134_arg0:animateToState( "visible", 250 ) + f134_arg0.current_state = "visible" + end + elseif f134_arg0.current_state ~= "default" then + f134_arg0:animateToState( "default", 250 ) + f134_arg0.current_state = "default" + end + end ) + self:addElement( f133_local1 ) + return self +end + +function ChallengeUpdate( f135_arg0, f135_arg1, f135_arg2 ) + local f135_local0 = { + File = "mp/alien/" .. Engine.GetDvarString( "ui_mapname" ) .. "_challenges.csv", + Index = 0, + Ref = 1, + Cycle = 2, + StrActivate = 3, + StrComplete = 4, + StrFail = 5, + preChallengeText = 7 + } + if Game.GetOmnvar( "ui_aliens_hardcore" ) then + f135_local0.File = "mp/alien/" .. Engine.GetDvarString( "ui_mapname" ) .. "_hardcore_challenges.csv" + end + f135_arg0.activeIntel = f135_arg0.activeIntel or -1 + local f135_local1 = Game.GetOmnvar( "ui_intel_challenge_scalar" ) + local f135_local2 = Game.GetOmnvar( "ui_intel_target_player" ) + local f135_local3, f135_local4, f135_local5 = nil + if f135_local2 ~= -1 then + f135_local3 = Game.GetPlayerName( f135_local2 ) + end + if f135_arg0.activeIntel >= 0 then + f135_local5 = Engine.TableLookup( f135_local0.File, f135_local0.Index, f135_arg0.activeIntel, f135_local0.preChallengeText ) + end + if f135_arg0.activeIntel >= 0 and f135_arg0.preChallenge and f135_local5 ~= "" then + f135_local4 = Engine.Localize( "@" .. f135_local5 ) + elseif f135_arg0.activeIntel >= 0 and f135_local2 ~= -1 then + f135_local4 = Engine.Localize( "@" .. Engine.TableLookup( f135_local0.File, f135_local0.Index, f135_arg0.activeIntel, f135_local0.StrActivate ), f135_local3 ) + elseif f135_arg0.activeIntel >= 0 and f135_local1 ~= -1 then + f135_local4 = Engine.Localize( "@" .. Engine.TableLookup( f135_local0.File, f135_local0.Index, f135_arg0.activeIntel, f135_local0.StrActivate ), f135_local1 ) + elseif f135_arg0.activeIntel >= 0 then + f135_local4 = Engine.Localize( "@" .. Engine.TableLookup( f135_local0.File, f135_local0.Index, f135_arg0.activeIntel, f135_local0.StrActivate ) ) + else + f135_local4 = nil + f135_arg0:processEvent( { + name = "message_off" + } ) + end + if f135_local4 then + f135_arg2:setText( f135_local4 ) + f135_arg0:processEvent( { + name = "message_on" + } ) + end +end + +function challenges() + local f136_local0 = 300 + local self = LUI.UIElement.new() + self.id = "intelInfoHudId" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f136_local2 = Engine.UsingSplitscreenUpscaling() and 45 or 0 + local f136_local3 = LUI.UIElement.new() + f136_local3:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -236, + left = -7 + f136_local2, + width = 0, + height = 128, + alpha = 0 + } ) + f136_local3:registerAnimationState( "active", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -236, + left = -7 + f136_local2, + width = 512, + height = 128, + alpha = 1 + } ) + f136_local3:registerAnimationState( "opening", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -236, + left = -7 + f136_local2, + width = 592, + height = 128, + alpha = 1 + } ) + f136_local3:registerAnimationState( "closing", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -236, + left = -7 + f136_local2, + width = 552, + height = 128, + alpha = 1 + } ) + f136_local3:animateToState( "default" ) + f136_local3:registerEventHandler( "message_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + f136_local0 / 2, + false, + true + }, + { + "active", + f136_local0 / 2, + true, + true + } + } ) ) + f136_local3:registerEventHandler( "message_off", MBh.AnimateSequence( { + { + "active", + 0 + }, + { + "closing", + f136_local0 / 2, + true, + true + }, + { + "default", + f136_local0 / 2, + true, + false + } + } ) ) + local f136_local4 = LUI.UIImage.new() + f136_local4.id = "background" + f136_local4:registerAnimationState( "default", { + material = RegisterMaterial( "hud_message_bg" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + f136_local4:animateToState( "default" ) + f136_local3:addElement( f136_local4 ) + local f136_local5 = LUI.UIImage.new() + f136_local5.id = "challenge_icon" + f136_local5:registerAnimationState( "default", { + material = RegisterMaterial( "hud_icon_pl_extinction" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 28, + left = 0, + width = 72, + height = 72, + alpha = 0.7 + } ) + f136_local5:animateToState( "default" ) + f136_local3:addElement( f136_local5 ) + local f136_local6 = function ( f137_arg0, f137_arg1 ) + local f137_local0 = f137_arg1.value + if not f137_local0 or f137_local0 < 0 then + f137_arg0:setText( Engine.Localize( "@ALIENS_CHALLENGE_CAPS" ) ) + elseif f137_local0 == 1 then + f137_arg0:setText( Engine.Localize( "@ALIEN_COLLECTIBLES_CHALLENGE_NEW" ) ) + elseif f137_local0 == 2 then + f137_arg0:setText( Engine.Localize( "@ALIEN_COLLECTIBLES_CHALLENGE_BARRIER_HIVE_TITLE" ) ) + end + end + + local f136_local7 = LUI.UIText.new() + f136_local7.id = "header" + f136_local7:setTextStyle( CoD.TextStyle.Shadowed ) + f136_local7:registerAnimationState( "default", CoD.ColorizeState( Colors.cyan, { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 25, + left = 20, + width = 280, + height = CoD.TextSettings.HudEuroMedSmallFont.Height + } ) ) + f136_local7:animateToState( "default" ) + f136_local7:registerOmnvarHandler( "ui_intel_title", f136_local6 ) + f136_local3:addElement( f136_local7 ) + local f136_local8 = LUI.UIText.new() + f136_local8.id = "text" + f136_local8:setTextStyle( CoD.TextStyle.Shadowed ) + f136_local8:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 45, + left = 72, + width = 305, + height = CoD.TextSettings.HudEuroMedSmallFont.Height + } ) + f136_local8:animateToState( "default" ) + f136_local3:addElement( f136_local8 ) + local f136_local9 = LUI.UIText.new() + f136_local9.id = "progress" + f136_local9:setTextStyle( CoD.TextStyle.Shadowed ) + f136_local9:registerAnimationState( "default", { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 25, + right = 250, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + alpha = 0 + } ) + f136_local9:registerAnimationState( "visible", { + alpha = 1 + } ) + f136_local9:animateToState( "default" ) + f136_local3:addElement( f136_local9 ) + local f136_local10 = function ( f138_arg0, f138_arg1 ) + local f138_local0 = Game.GetOmnvar( "ui_intel_progress_current" ) + local f138_local1 = Game.GetOmnvar( "ui_intel_progress_max" ) + if not f138_local0 or not f138_local1 or f138_local0 < 0 or f138_local1 < 0 then + f136_local9:animateToState( "default" ) + else + f136_local9:setText( f138_local0 .. "/" .. f138_local1 ) + f136_local9:animateToState( "visible" ) + end + end + + local f136_local11 = function ( f139_arg0, f139_arg1 ) + local f139_local0 = Game.GetOmnvar( "ui_intel_percent" ) + if not f139_local0 or f139_local0 < 0 then + f136_local9:animateToState( "default" ) + else + f136_local9:setText( string.format( "%05.2f", f139_local0 / 100 .. "" ) .. "%" ) + f136_local9:animateToState( "visible" ) + end + end + + local f136_local12 = LUI.UICountdown.new( {} ) + f136_local12.id = "countdown" + f136_local12:registerAnimationState( "default", { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 25, + right = 330, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + alpha = 0 + } ) + f136_local12:registerAnimationState( "visible", { + alpha = 1 + } ) + f136_local12:animateToState( "default" ) + local f136_local13 = function ( f140_arg0, f140_arg1 ) + if f140_arg1.value > 0 then + f136_local12:setEndTime( f140_arg1.value ) + if f140_arg0.current_state ~= "visible" then + f140_arg0:animateToState( "visible", 0 ) + f140_arg0.current_state = "visible" + end + elseif f140_arg0.current_state ~= "default" then + f140_arg0:animateToState( "default", 0 ) + f140_arg0.current_state = "default" + end + end + + f136_local12:registerOmnvarHandler( "ui_intel_timer", f136_local13 ) + f136_local3:addElement( f136_local12 ) + f136_local3:registerOmnvarHandler( "ui_intel_active_index", function ( f141_arg0, f141_arg1 ) + f141_arg0.activeIntel = f141_arg1.value + ChallengeUpdate( f141_arg0, f141_arg1, f136_local8 ) + end ) + f136_local3:registerOmnvarHandler( "ui_intel_progress_current", f136_local10 ) + f136_local3:registerOmnvarHandler( "ui_intel_progress_max", f136_local10 ) + f136_local3:registerOmnvarHandler( "ui_intel_percent", f136_local11 ) + f136_local3:registerOmnvarHandler( "ui_intel_prechallenge", function ( f142_arg0, f142_arg1 ) + f142_arg0.preChallenge = f142_arg1.value == 1 + ChallengeUpdate( f142_arg0, f142_arg1, f136_local8 ) + end ) + if 0 <= Game.GetOmnvar( "ui_intel_active_index" ) then + f136_local3.activeIntel = Game.GetOmnvar( "ui_intel_active_index" ) + f136_local3.preChallenge = 1 == Game.GetOmnvar( "ui_intel_prechallenge" ) + f136_local6( f136_local7, { + value = Game.GetOmnvar( "ui_intel_title" ) + } ) + f136_local13( f136_local12, { + value = Game.GetOmnvar( "ui_intel_timer" ) + } ) + f136_local11( f136_local3, {} ) + f136_local10( f136_local3, {} ) + ChallengeUpdate( f136_local3, {}, f136_local8 ) + end + self:addElement( f136_local3 ) + return self +end + +function skill_points_reminder() + local self = LUI.UIElement.new() + self.id = "reminder" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f143_local1 = function () + return Engine.Localize( "@ALIENS_SPEND_POINTS_REMINDER", Engine.MarkLocalized( "[{togglescores}]" ) ) + end + + local f143_local2 = LUI.UIText.new() + f143_local2:setText( f143_local1() ) + f143_local2:setTextStyle( CoD.TextStyle.Shadowed ) + f143_local2:registerAnimationState( "default", { + font = CoD.TextSettings.HudIW6SmallFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = CoD.TextSettings.SmallFont.Height, + alpha = 1 + } ) + f143_local2:registerAnimationState( "hidden", { + font = CoD.TextSettings.HudIW6SmallFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + bottom = 0, + height = CoD.TextSettings.SmallFont.Height, + alpha = 0 + } ) + f143_local2:animateToState( "hidden" ) + f143_local2:registerEventHandler( "empty_menu_stack", function ( element, event ) + element:setText( f143_local1() ) + end ) + f143_local2:registerEventHandler( "show_reminder", MBh.AnimateSequence( { + { + "hidden", + 0, + true, + true + }, + { + "default", + 150, + true, + true + } + } ) ) + f143_local2:registerEventHandler( "hide_reminder", MBh.AnimateToState( "hidden", 150 ) ) + f143_local2:registerEventHandler( "ability_points_change", function ( element, event ) + element.storedValue = event.newValue + if not Game.GetOmnvar( "ui_alien_player_in_laststand" ) and event.oldValue < event.newValue and event.oldValue == 0 then + element:processEvent( { + name = "show_reminder" + } ) + elseif event.newValue == 0 then + element:processEvent( { + name = "hide_reminder" + } ) + end + end ) + f143_local2:registerOmnvarHandler( "ui_alien_player_in_laststand", function ( f147_arg0, f147_arg1 ) + if f147_arg1.value then + f147_arg0:processEvent( { + name = "hide_reminder" + } ) + elseif f147_arg0.storedValue and f147_arg0.storedValue >= 1 then + f147_arg0:processEvent( { + name = "show_reminder" + } ) + end + end ) + self:addElement( f143_local2 ) + return self +end + +function flash_message() + local self = LUI.UIElement.new() + self.id = "flash_message" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = -256, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f148_local1 = 110 + local f148_local2 = -32 + local f148_local3 = LUI.UIElement.new() + f148_local3.id = "splashId" + f148_local3.properties = { + busy = false, + queue = {} + } + f148_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f148_local1, + left = f148_local2 - 500, + height = 64, + right = -468, + alpha = 0, + scale = -0.15 + } ) + f148_local3:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f148_local1, + left = f148_local2 + 20, + height = 64, + right = 52, + alpha = 1 + } ) + f148_local3:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f148_local1, + left = f148_local2, + height = 64, + right = 32, + alpha = 1 + } ) + f148_local3:registerAnimationState( "leave", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f148_local1, + left = f148_local2 + 500, + height = 64, + right = 532, + alpha = 0 + } ) + f148_local3:animateToState( "default" ) + self:addElement( f148_local3 ) + local f148_local4 = LUI.UIImage.new() + f148_local4.id = "splashBackingImageId" + f148_local4:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f148_local2, + height = 128, + width = 512, + material = RegisterMaterial( "box_alien_intel_hud" ) + } ) + f148_local4:animateToState( "default" ) + local f148_local5 = LUI.UIImage.new() + f148_local5.id = "splashImageId" + f148_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -44, + left = -86 + f148_local2, + height = 176, + width = 176, + material = RegisterMaterial( "hud_icon_pl_extinction" ) + } ) + f148_local5:registerAnimationState( "nightfall", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -4, + left = -64 + f148_local2, + height = 128, + width = 128, + material = RegisterMaterial( "alien_icon_intel_hud_nightfall" ) + } ) + f148_local5:registerAnimationState( "intercept", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -4, + left = -64 + f148_local2, + height = 128, + width = 128, + material = RegisterMaterial( "alien_icon_intel_hud_intercept" ) + } ) + f148_local5:animateToState( "default" ) + local f148_local6 = LUI.UIImage.new() + f148_local6.id = "overlayImageId" + f148_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = -64, + left = 256, + height = 256, + width = 256, + alpha = 0, + material = RegisterMaterial( "box_alien_intel_hud_overlay" ) + } ) + f148_local6:registerAnimationState( "active", { + alpha = 1 + } ) + f148_local6:registerAnimationState( "glow_high", { + alpha = 1 + } ) + f148_local6:registerAnimationState( "glow_low", { + alpha = 0.1 + } ) + f148_local6:animateToState( "default" ) + local f148_local7 = LUI.UIText.new() + f148_local7.id = "splashNameId" + f148_local7:setTextStyle( CoD.TextStyle.OutlinedMore ) + f148_local7:registerAnimationState( "default", CoD.ColorizeState( Colors.alien_frontend_hilite, { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.BoldFont.Font, + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 20, + height = CoD.TextSettings.BoldFont.Height, + left = 32, + width = 432 + } ) ) + f148_local7:animateToState( "default" ) + local f148_local8 = LUI.UIText.new() + f148_local8.id = "splashDescId" + f148_local8:setTextStyle( CoD.TextStyle.OutlinedMore ) + f148_local8:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 24 + CoD.TextSettings.BoldFont.Height, + height = CoD.TextSettings.NormalFont.Height, + left = 32, + width = 432 + } ) ) + f148_local8:animateToState( "default", 0 ) + local f148_local9 = LUI.UIText.new() + f148_local9.id = "splashCollectedTextId" + f148_local9:setTextStyle( CoD.TextStyle.OutlinedMore ) + f148_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 35 + CoD.TextSettings.BoldFont.Height + CoD.TextSettings.NormalFont.Height, + height = CoD.TextSettings.NormalFont.Height, + left = 32, + width = 432 + } ) ) + f148_local9:animateToState( "default", 0 ) + f148_local3:addElement( f148_local4 ) + f148_local3:addElement( f148_local5 ) + f148_local3:addElement( f148_local6 ) + f148_local3:addElement( f148_local7 ) + f148_local3:addElement( f148_local8 ) + f148_local3:addElement( f148_local9 ) + local f148_local10 = function ( f149_arg0, f149_arg1, f149_arg2, f149_arg3 ) + if f148_local3.properties.busy == true then + table.insert( f148_local3.properties.queue, { + title = f149_arg0, + description = f149_arg1, + state = f149_arg2, + collected_text = f149_arg3 + } ) + else + f148_local3.properties.busy = true + f148_local7:setText( f149_arg0 ) + f148_local8:setText( f149_arg1 ) + f148_local5:animateToState( f149_arg2 ) + f148_local9:setText( f149_arg3 ) + local f149_local0 = MBh.AnimateSequence( { + { + "default", + 150 + }, + { + "active", + 50 + }, + { + "glow_high", + 60 + }, + { + "glow_low", + 1000 + }, + { + "glow_high", + 50 + }, + { + "glow_high", + 150 + }, + { + "glow_low", + 850 + }, + { + "glow_high", + 50 + }, + { + "glow_high", + 150 + }, + { + "glow_low", + 850 + }, + { + "glow_high", + 50 + }, + { + "glow_high", + 150 + }, + { + "glow_low", + 850 + } + } ) + f149_local0( f148_local6 ) + f149_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 150 + }, + { + "active", + 4000 + }, + { + "leave", + 150 + } + } ) + f149_local0( f148_local3 ) + end + end + + f148_local3:registerEventHandler( "transition_complete_leave", function ( element, event ) + element.properties.busy = false + if #element.properties.queue > 0 then + local f150_local0 = table.remove( element.properties.queue, 1 ) + f148_local10( f150_local0.title, f150_local0.description, f150_local0.state, f150_local0.collected_text ) + end + end ) + f148_local3:registerOmnvarHandler( "ui_alien_rankup", function ( f151_arg0, f151_arg1 ) + f148_local10( Engine.Localize( "@ALIENS_PATCH_RANKED_UP" ), Engine.Localize( "@ALIENS_PATCH_RANKED_UP_DESC" ), "default", Engine.Localize( "@ALIENS_PATCH_NEW_RANK", f151_arg1.value ) ) + Engine.PlaySound( "mp_level_up" ) + end ) + f148_local3:registerOmnvarHandler( "ui_alien_award_token", function ( f152_arg0, f152_arg1 ) + if f152_arg1.value > 1 then + f148_local10( Engine.Localize( "@ALIENS_FOUND_TOKENS", f152_arg1.value ), Engine.Localize( "@ALIENS_TOKEN_DESC" ), "default", "" ) + else + f148_local10( Engine.Localize( "@ALIENS_FOUND_TOKEN" ), Engine.Localize( "@ALIENS_TOKEN_DESC" ), "default", "" ) + end + Engine.PlaySound( "mp_level_up" ) + end ) + f148_local3:registerOmnvarHandler( "ui_alien_eggstra_xp", function ( f153_arg0, f153_arg1 ) + if Engine.GetDvarString( "ui_mapname" ) == "mp_alien_armory" then + f148_local10( Engine.Localize( "@ALIEN_PICKUPS_ARMORY_EGGSTRA_XP" ), Engine.Localize( "@ALIEN_PICKUPS_ARMORY_EGGSTRA_XP_DESC" ), "default", "" ) + elseif Engine.GetDvarString( "ui_mapname" ) == "mp_alien_dlc3" then + f148_local10( Engine.Localize( "@ALIEN_PICKUPS_DESCENT_EGGSTRA_XP" ), Engine.Localize( "@ALIEN_PICKUPS_DESCENT_EGGSTRA_XP_DESC" ), "default", "" ) + elseif Engine.GetDvarString( "ui_mapname" ) == "mp_alien_last" then + f148_local10( Engine.Localize( "@MP_ALIEN_LAST_EGGSTRA_XP" ), Engine.Localize( "@MP_ALIEN_LAST_EGGSTRA_XP_DESC" ), "default", "" ) + else + f148_local10( Engine.Localize( "@ALIEN_PICKUPS_BEACON_EGGSTRA_XP" ), Engine.Localize( "@ALIEN_PICKUPS_BEACON_EGGSTRA_XP_DESC" ), "default", "" ) + end + Engine.PlaySound( "mp_level_up" ) + end ) + if Engine.GetDvarString( "ui_mapname" ) ~= "mp_alien_town" then + local f148_local11 = { + File = "mp/alien/alien_armory_intel.csv", + Index = 0, + Title_string_index = 16 + } + local f148_local12 = Engine.Localize( "@ALIEN_PILLAGE_INTEL_INTERCEPT_FILE_FOUND" ) + local f148_local13 = Engine.Localize( "@ALIEN_PILLAGE_INTEL_NIGHTFALL_FILE_FOUND" ) + if Engine.GetDvarString( "ui_mapname" ) == "mp_alien_beacon" then + f148_local11.File = "mp/alien/alien_beacon_intel.csv" + f148_local12 = Engine.Localize( "@ALIEN_PILLAGE_INTEL_MEDUSA_FILE_FOUND" ) + f148_local13 = Engine.Localize( "@ALIEN_PILLAGE_INTEL_ARCHER_LOG_FOUND" ) + elseif Engine.GetDvarString( "ui_mapname" ) == "mp_alien_dlc3" then + f148_local11.File = "mp/alien/alien_dlc3_intel.csv" + f148_local12 = Engine.Localize( "@ALIEN_PILLAGE_INTEL_ANCESTOR_INTEL_FOUND" ) + f148_local13 = Engine.Localize( "@ALIEN_PILLAGE_INTEL_ARCHER_LOG_FOUND" ) + elseif Engine.GetDvarString( "ui_mapname" ) == "mp_alien_last" then + f148_local11.File = "mp/alien/alien_last_intel.csv" + f148_local12 = Engine.Localize( "@ALIEN_PILLAGE_INTEL_EXODUS_FILE_FOUND" ) + f148_local13 = Engine.Localize( "@ALIEN_PILLAGE_INTEL_EXODUS_FILE_FOUND" ) + end + f148_local3:registerOmnvarHandler( "ui_alien_intercept_pickup", function ( f154_arg0, f154_arg1 ) + f148_local10( f148_local12, Engine.Localize( "@" .. Engine.TableLookup( f148_local11.File, f148_local11.Index, f154_arg1.value, f148_local11.Title_string_index ) ), "intercept", Engine.Localize( "@ALIEN_PILLAGE_INTEL_EXTINCTION_INTEL_COLLECTED", Game.GetOmnvar( "ui_alien_intel_num_collected" ), LUI.mp_menus.Aliens.GetNumIntelsForCurrentMap() ) ) + end ) + f148_local3:registerOmnvarHandler( "ui_alien_nightfall_pickup", function ( f155_arg0, f155_arg1 ) + f148_local10( f148_local13, Engine.Localize( "@" .. Engine.TableLookup( f148_local11.File, f148_local11.Index, f155_arg1.value, f148_local11.Title_string_index ) ), "nightfall", Engine.Localize( "@ALIEN_PILLAGE_INTEL_EXTINCTION_INTEL_COLLECTED", Game.GetOmnvar( "ui_alien_intel_num_collected" ), LUI.mp_menus.Aliens.GetNumIntelsForCurrentMap() ) ) + end ) + end + return self +end + +function splashes() + local f156_local0 = { + File = "mp/alien/splashTable.csv", + Ref = 0, + Name = 1, + Desc = 2, + Duration = 4 + } + local self = LUI.UIElement.new() + self.id = "splashes" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f156_local2 = LUI.UIElement.new() + f156_local2.id = "content" + f156_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 23, + left = 0, + width = 280, + height = 80 + } ) + f156_local2:animateToState( "default" ) + local f156_local3 = LUI.UIImage.new() + f156_local3.id = "background" + f156_local3:registerAnimationState( "default", { + material = RegisterMaterial( "hud_message_bg" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f156_local3:animateToState( "default" ) + local f156_local4 = LUI.UIImage.new() + f156_local4.id = "splashImageId" + f156_local4:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 18, + left = 12, + height = 64, + width = 64, + material = RegisterMaterial( "hud_icon_pl_extinction" ) + } ) + f156_local4:animateToState( "default" ) + local f156_local5 = LUI.UIText.new() + f156_local5.id = "title" + f156_local5:registerAnimationState( "default", CoD.ColorizeState( Colors.yellow, { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 85, + width = 447, + top = -3, + height = CoD.TextSettings.SmallFont.Height + } ) ) + f156_local5:animateToState( "default" ) + f156_local2:addElement( f156_local5 ) + local f156_local6 = LUI.UIText.new() + f156_local6.id = "desc" + f156_local6:registerAnimationState( "default", { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 85, + width = 447, + top = 35, + height = CoD.TextSettings.SmallFont.Height + } ) + f156_local6:animateToState( "default" ) + f156_local2:addElement( f156_local6 ) + local f156_local7 = LUI.UIElement.new() + f156_local7.id = "splashes" + f156_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -13, + left = -200, + width = 512, + height = 110, + alpha = 1 + } ) + f156_local7:registerAnimationState( "hidden", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -128, + left = -200, + width = 512, + height = 110, + alpha = 0 + } ) + f156_local7:animateToState( "hidden" ) + local f156_local8 = function ( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, f157_arg5 ) + local f157_local0 = f157_arg1.value + if not f157_local0 or f157_local0 == -1 then + f157_arg0:animateToState( "hidden", 0 ) + return + else + local f157_local1 = Engine.Localize( Engine.TableLookupByRow( f156_local0.File, f157_local0, f156_local0.Desc ), f157_arg3, f157_arg4 ) + if not f157_local1 then + DebugPrint( "WARNING: Missing splash description for row " .. f157_local0 .. " in " .. f156_local0.File ) + return + else + local f157_local2 = tonumber( Engine.TableLookupByRow( f156_local0.File, f157_local0, f156_local0.Duration ) ) * 1000 + f156_local5:setText( f157_arg2 ) + f156_local6:setText( f157_local1 ) + f156_local4:setImage( RegisterMaterial( f157_arg5 ) ) + local f157_local3 = MBh.AnimateSequence( { + { + "hidden", + 0, + true, + true + }, + { + "default", + 200, + false, + true + }, + { + "default", + f157_local2, + true, + true + }, + { + "hidden", + 200, + true, + false + } + } ) + f157_local3( f157_arg0, {} ) + end + end + end + + f156_local7:registerOmnvarHandler( "ui_splash_idx", function ( f158_arg0, f158_arg1 ) + local f158_local0 = f158_arg1.value + local f158_local1 = Game.GetOmnvar( "ui_splash_optional_number" ) + f156_local8( f158_arg0, f158_arg1, Engine.Localize( Engine.TableLookupByRow( f156_local0.File, f158_local0, f156_local0.Name ), f158_local1 ), f158_local1 ) + end ) + f156_local7:registerOmnvarHandler( "ui_splash_playercard_idx", function ( f159_arg0, f159_arg1 ) + local f159_local0 = Game.GetOmnvar( "ui_splash_playercard_optional_number" ) + local f159_local1 = Game.GetOmnvar( "ui_splash_playercard_clientnum" ) + local f159_local2 = Game.GetPlayerName( f159_local1 ) + local f159_local3 = Game.GetPlayerCard( f159_local1 ) + f156_local8( f159_arg0, f159_arg1, f159_local2, f159_local0, f159_local2, Engine.TableLookup( PatchesTable.File, PatchesTable.Cols.Ref, f159_local3.patch, PatchesTable.Cols.CardImage ) ) + end ) + f156_local7:addElement( f156_local3 ) + f156_local7:addElement( f156_local2 ) + f156_local7:addElement( f156_local4 ) + self:addElement( f156_local7 ) + return self +end + +function game_messages() + local self = LUI.UIElement.new() + self.id = "gameMessagesID" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 200, + bottom = 32, + left = -32, + right = 32 + } ) + self:animateToState( "default" ) + local f160_local1 = LUI.UIText.new() + f160_local1.id = "text" + f160_local1:setTextStyle( CoD.TextStyle.Shadowed ) + f160_local1:registerAnimationState( "default", { + font = CoD.TextSettings.HudEuroNormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + } ) + f160_local1:registerAnimationState( "opening", { + font = CoD.TextSettings.HudEuroNormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 80 + CoD.TextSettings.HudEuroNormalFont.Height, + left = -256, + right = 256, + alpha = 1 + } ) + f160_local1:registerAnimationState( "active", { + font = CoD.TextSettings.HudEuroNormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = CoD.TextSettings.HudEuroNormalFont.Height, + left = -256, + right = 256, + alpha = 1 + } ) + f160_local1:animateToState( "default" ) + f160_local1:registerEventHandler( "game_message", function ( element, event ) + if event then + element:setText( event.message ) + local f161_local0 = MBh.AnimateSequence( { + { + "opening", + 0 + }, + { + "active", + 100 + }, + { + "active", + 2500 + }, + { + "default", + 100 + } + } ) + f161_local0( element, event ) + end + end ) + self:addElement( f160_local1 ) + return self +end + +function talker_hud() + return LUI.MenuBuilder.buildItems( { + type = "talkerHudDef", + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = Engine.UsingSplitscreenUpscaling() and 0 or 200, + right = -20, + height = 0, + width = 0 + } + } + } ) +end + +function cursor_hints() + local self = LUI.UIElement.new() + self.id = "cursorHints" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f163_local1 = LUI.mp_hud.Hints.cursorHintDef() + f163_local1:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -93, + left = -32, + right = 32, + height = 64 + } ) + f163_local1:animateToState( "default" ) + self:addElement( f163_local1 ) + return self +end + +function hybrid_scope_hints() + local self = LUI.UIElement.new() + self.id = "hybridScopeHints" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 40, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + self:addElement( LUI.mp_hud.Hints.toggleHybridHintDef() ) + return self +end + +function mantle_hints() + local self = LUI.UIElement.new() + self.id = "mantleHints" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f165_local1 = LUI.mp_hud.Hints.mantleHintDef() + f165_local1:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -20, + left = -32, + right = 32, + height = 64 + } ) + f165_local1:animateToState( "default" ) + self:addElement( f165_local1 ) + return self +end + +function match_countdown() + local self = LUI.UIElement.new() + self.id = "match_countdown" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + self:addElement( LUI.mp_hud.MatchStartHud.matchStartHudDef() ) + return self +end + +function UpdateHUDVisibility( f167_arg0 ) + local f167_local0 = Game.GetOmnvar( "ui_predator_missile" ) > 0 + local f167_local1 + if Engine.GetDvarString( "ui_mapname" ) ~= "mp_alien_dlc3" or Game.GetOmnvar( "ui_vanguard" ) <= 0 then + f167_local1 = false + else + f167_local1 = true + end + local f167_local2 = f167_arg0.is_paused + local f167_local3 = f167_arg0.is_tech_tree_open + local f167_local4 = Game.GetOmnvar( "ui_session_state" ) == "spectator" + local f167_local5 = {} + local f167_local6 = nil + if f167_local2 or f167_local3 then + f167_local6 = true + elseif f167_local0 then + f167_local6 = true + f167_local5 = { + f167_arg0.spectating, + f167_arg0.predator + } + elseif f167_local1 then + f167_local6 = true + f167_local5 = { + f167_arg0.spectating, + f167_arg0.vanguardHUD, + f167_arg0.damageFeedback, + f167_arg0.cashWidget + } + elseif f167_local4 then + f167_local6 = true + f167_local5 = { + f167_arg0.spectating + } + else + f167_local6 = false + f167_local5 = { + f167_arg0.predator, + f167_arg0.vanguardHUD + } + end + local f167_local7 = {} + for f167_local11, f167_local12 in pairs( f167_local5 ) do + assert( f167_local12.id ) + f167_local7[f167_local12.id] = true + end + for f167_local11, f167_local12 in pairs( f167_arg0.allWidgets ) do + assert( f167_local12.id ) + local f167_local13 = not f167_local6 + if f167_local7[f167_local12.id] then + f167_local13 = f167_local6 + end + local f167_local14 + if f167_local13 then + f167_local14 = "hud_on" + if not f167_local14 then + + elseif f167_local12.current_state ~= f167_local14 then + f167_local12:processEvent( { + name = f167_local14 + } ) + f167_local12:animateToState( f167_local14, 100 ) + f167_local12.current_state = f167_local14 + end + end + f167_local14 = "hud_off" + end +end + +function addWidget( f168_arg0, f168_arg1, f168_arg2 ) + assert( f168_arg2 ) + f168_arg2:registerAnimationState( "hud_on", { + alpha = 1, + scale = 0 + } ) + f168_arg2:registerAnimationState( "hud_off", { + alpha = 0, + scale = 0.2 + } ) + if f168_arg1 then + f168_arg0.fullscreen:addElement( f168_arg2 ) + else + f168_arg0.scalable:addElement( f168_arg2 ) + end + table.insert( f168_arg0.allWidgets, f168_arg2 ) + return f168_arg2 +end + +function alien_hud() + local self = LUI.UIElement.new() + self.id = "alien_hud" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + self.allWidgets = {} + self.scalable = LUI.UIElement.new() + self.scalable.id = "scalable" + self:addElement( self.scalable ) + local f169_local1 = function () + local f170_local0, f170_local1, f170_local2, f170_local3 = GameX.GetAdjustedSafeZoneSize() + local f170_local4 = Engine.UsingSplitscreenUpscaling() and 5 or 15 + self.scalable:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = f170_local0 + f170_local4, + top = f170_local1 + f170_local4, + right = f170_local2 - f170_local4, + bottom = f170_local3 - f170_local4 + } ) + self.scalable:animateToState( "current" ) + end + + self:registerEventHandler( "update_hud_margins", f169_local1 ) + f169_local1() + self.fullscreen = LUI.UIElement.new() + self.fullscreen.id = "fullscreen" + self.fullscreen:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self.fullscreen:animateToState( "default" ) + self:addElement( self.fullscreen ) + self.addWidget = addWidget + local f169_local2 = false + local f169_local3 = Engine.GetDvarString( "ui_mapname" ) + if f169_local3 == "mp_alien_dlc3" then + self.vanguardHUD = self:addWidget( true, LUI.mp_hud.AlienVanguardOverlayHud.alienVanguardOverlayDef() ) + elseif f169_local3 == "mp_alien_last" then + f169_local2 = true + self.nx1CustomReticle = self:addWidget( false, nx1_custom_reticle() ) + end + self.weaponInfoWidget = self:addWidget( false, weapon_info() ) + self.challenges = self:addWidget( false, challenges() ) + self.cursorHint = self:addWidget( false, cursor_hints() ) + self.hybridScopeHints = self:addWidget( false, hybrid_scope_hints() ) + self.damageFeedback = self:addWidget( true, LUI.mp_hud.DamageFeedbackHud.damageFeedbackHudDef() ) + self.gameMessages = self:addWidget( false, game_messages() ) + self.healthMeter = self:addWidget( false, health_meter() ) + self.juicedTimer = self:addWidget( false, juiced_timer() ) + self.mantleHint = self:addWidget( false, mantle_hints() ) + self.predator = self:addWidget( true, LUI.mp_hud.PredatorMissileOverlayHud.predatorMissileOverlayDef() ) + self.quickShopWidget = self:addWidget( false, quick_shop() ) + self.lastStandTimer = self:addWidget( false, laststand_timer() ) + self.attackChopper = self:addWidget( false, attack_chopper() ) + self.capturingHud = self:addWidget( false, LUI.mp_hud.AlienCapturingHud.captureHudDef() ) + self.selfRevives = self:addWidget( false, self_revives() ) + self.lockerKey = self:addWidget( false, locker_key() ) + self.cashWidget = self:addWidget( false, cash_widget() ) + if LUI.mp_menus.Aliens.IsChaosMode() then + self.chaosMainScore = self:addWidget( false, LUI.MenuBuilder.BuildRegisteredType( "chaos_main_score" ) ) + self.chaosComboMeter = self:addWidget( false, LUI.MenuBuilder.BuildRegisteredType( "chaos_combo_meter" ) ) + self.chaosClock = self:addWidget( false, LUI.MenuBuilder.BuildRegisteredType( "chaos_clock" ) ) + self.chaosPerks = self:addWidget( false, LUI.MenuBuilder.BuildRegisteredType( "chaos_perks" ) ) + self.chaosPerkUnlock = self:addWidget( false, LUI.MenuBuilder.BuildRegisteredType( "chaos_perk_unlock", { + perksWidget = self.chaosPerks + } ) ) + self.chaosEventLog = self:addWidget( false, LUI.MenuBuilder.BuildRegisteredType( "chaos_event_log" ) ) + self.chaosSkillIcon = self:addWidget( false, LUI.MenuBuilder.BuildRegisteredType( "chaos_class_skill_item" ) ) + else + self.splashes = self:addWidget( false, splashes() ) + self.drillMeterWidget = self:addWidget( false, drill_meter( f169_local2 ) ) + self.skillPointsReminder = self:addWidget( false, skill_points_reminder() ) + self.hiveBattle = self:addWidget( false, boss_meter() ) + end + self.weaponAttachments = self:addWidget( false, LUI.MenuBuilder.buildItems( { + type = "weaponAttachmentProcessing" + }, {} ) ) + self.blurUpdate = self:addWidget( false, LUI.MenuBuilder.buildItems( { + type = "blurProcessing" + }, {} ) ) + self.spectating = self:addWidget( false, spectating() ) + self.flashMessage = self:addWidget( false, flash_message() ) + self.talkerHud = self:addWidget( false, talker_hud() ) + self.nukeTimer = self:addWidget( false, nuke_countdown_timer() ) + self.hiveBonus = self:addWidget( false, LUI.mp_hud.AlienScoreboards.hive_bonus_scoreboard() ) + self.matchCountdown = self:addWidget( false, match_countdown() ) + self:registerEventHandler( "toggle_pause", PauseAction ) + self:registerEventHandler( "toggle_pause_off", UnpauseAction ) + if not LUI.mp_menus.Aliens.IsChaosMode() then + self:registerEventHandler( "push_tech_tree", PushTechTreeAction ) + self:registerEventHandler( "pop_tech_tree", PopTechTreeAction ) + self:registerEventHandler( "keybind", function ( element, event ) + if event.command == "+scores" or event.command == "togglescores" then + ToggleTechTree( element, event ) + end + end ) + end + self:registerOmnvarHandler( "ui_alien_show_eog_score", function ( f172_arg0, f172_arg1 ) + self:animateToState( "hidden", 600 ) + f172_arg0:dispatchEventToRoot( { + name = "round_end_show" + } ) + end ) + local f169_local4 = function () + UpdateHUDVisibility( self ) + end + + self:registerOmnvarHandler( "ui_predator_missile", f169_local4 ) + self:registerOmnvarHandler( "ui_session_state", f169_local4 ) + if Engine.GetDvarString( "ui_mapname" ) == "mp_alien_dlc3" then + self:registerOmnvarHandler( "ui_vanguard", f169_local4 ) + end + f169_local4() + local f169_local5 = LUI.UIElement.new() + f169_local5:setupUIIntWatch( "AlienCash" ) + f169_local5.id = "cashWatch" + f169_local5:registerEventHandler( "int_watch_alert", function ( element, event ) + event.name = "cash_change" + self.quickShopWidget:processEvent( event ) + self.cashWidget:processEvent( event ) + end ) + local f169_local6 = LUI.UIElement.new() + f169_local6:setupUIIntWatch( "AlienSkillPoints" ) + f169_local6.id = "points_watch" + f169_local6:registerEventHandler( "int_watch_alert", function ( element, event ) + event.name = "ability_points_change" + if self.skillPointsReminder then + self.skillPointsReminder:processEvent( event ) + end + self.quickShopWidget:processEvent( event ) + end ) + local f169_local7 = LUI.UIElement.new() + f169_local7:setupUIIntWatch( "AlienCumulatedSkillsLevel" ) + f169_local7.id = "levels_watch" + f169_local7:registerEventHandler( "int_watch_alert", function ( element, event ) + event.name = "ability_levels_change" + self.quickShopWidget:processEvent( event ) + end ) + self:addElement( f169_local5 ) + if not LUI.mp_menus.Aliens.IsChaosMode() then + self:addElement( f169_local6 ) + end + self:addElement( f169_local7 ) + return self +end + +LUI.MenuBuilder.registerType( "alien_hud", alien_hud ) +LUI.HudManager.registerHud( "alien_hud" ) +LockTable( _M ) diff --git a/lui/mp_hud/alienhudtechtree.dec.lua b/lui/mp_hud/alienhudtechtree.dec.lua new file mode 100644 index 0000000..a04bb97 --- /dev/null +++ b/lui/mp_hud/alienhudtechtree.dec.lua @@ -0,0 +1,1452 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function PushTechTree() + local f1_local0 = Engine.GetLuiRoot() + f1_local0:processEvent( { + name = "push_tech_tree" + } ) +end + +function PopTechTree() + local f2_local0 = Engine.GetLuiRoot() + f2_local0:processEvent( { + name = "pop_tech_tree" + } ) +end + +function UtilitiesFactory( f3_arg0, f3_arg1 ) + local f3_local0 = {} + local f3_local1 = LUI.mp_menus.Aliens + f3_local0.upgradeString = "_try_upgrade" + f3_local0.baseRefGetter = function ( f4_arg0 ) + return "" + end + + f3_local0.currentLevelRefGetter = function ( f5_arg0 ) + return "" + end + + f3_local0.currentLevelGetter = function ( f6_arg0 ) + return 0 + end + + f3_local0.fieldGetter = function ( f7_arg0, f7_arg1 ) + return "" + end + + f3_local0.fieldColumns = {} + f3_local0.secondaryClassGetter = function ( f8_arg0 ) + return nil + end + + if f3_arg1 then + f3_local0.upgradeString = f3_local1.GetDataLabelForSlot( f3_arg1 ) .. f3_local0.upgradeString + f3_local0.fieldGetter = f3_local1.GetFieldForAbility + f3_local0.fieldColumns = f3_local1.AlienAbilities.Cols + local f3_local2 = f3_local1.GetDataLabelForSlot( f3_arg1 ) + f3_local0.baseRefGetter = function ( f9_arg0 ) + return f3_local1.GetAlienAbility( f9_arg0, f3_local2 ) + end + + f3_local0.currentLevelGetter = function ( f10_arg0 ) + return f3_local1.GetAlienAbilityLevel( f10_arg0, f3_local2 ) + end + + f3_local0.specificLevelRefGetter = function ( f11_arg0, f11_arg1 ) + return f3_local1.GetAbilityRefFromBaseAndLevel( f3_local0.baseRefGetter( f11_arg0 ), f11_arg1 ) + end + + f3_local0.currentLevelRefGetter = function ( f12_arg0 ) + return f3_local0.specificLevelRefGetter( f12_arg0, f3_local0.currentLevelGetter( f12_arg0 ) ) + end + + else + f3_local0.upgradeString = f3_local1.GetDataLabelForPerk( f3_arg0 ) .. f3_local0.upgradeString + f3_local0.fieldGetter = f3_local1.GetFieldForPerk + f3_local0.fieldColumns = f3_local1.AlienPerks.Cols + f3_local0.baseRefGetter = function ( f13_arg0 ) + return f3_local1.GetAlienPerk( f13_arg0, f3_arg0 ) + end + + f3_local0.currentLevelGetter = function ( f14_arg0 ) + return f3_local1.GetAlienPerkLevel( f14_arg0, f3_arg0 ) + end + + f3_local0.specificLevelRefGetter = function ( f15_arg0, f15_arg1 ) + return f3_local1.GetPerkRefFromBaseAndLevel( f3_local0.baseRefGetter( f15_arg0 ), f15_arg1 ) + end + + f3_local0.currentLevelRefGetter = function ( f16_arg0 ) + return f3_local0.specificLevelRefGetter( f16_arg0, f3_local0.currentLevelGetter( f16_arg0 ) ) + end + + f3_local0.secondaryClassGetter = function ( f17_arg0 ) + if f3_arg0 == 0 and Engine.AliensCheckIsUpgradeEnabled( f17_arg0, "multi_class" ) then + return f3_local1.GetSecondaryClassRef( f17_arg0 ) + else + return nil + end + end + + end + return f3_local0 +end + +function purchase_row_head( f18_arg0, f18_arg1, f18_arg2 ) + local f18_local0 = f18_arg1 == LUI.mp_menus.Aliens.AlienAbilities.Up + local f18_local1 = f18_arg1 == LUI.mp_menus.Aliens.AlienAbilities.Down + local f18_local2 = f18_arg1 == LUI.mp_menus.Aliens.AlienAbilities.Right + local f18_local3 = f18_arg1 == LUI.mp_menus.Aliens.AlienAbilities.Left + local f18_local4 = LUI.FlowManager.GetMenuScopedDataByMenuName( "alien_tech_tree" ) + local self = LUI.UIButton.new() + self.id = "element" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 495 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "button_up", function ( element, event ) + local f19_local0 = math.min( 1 + f18_arg2.currentLevelGetter( f18_local4.controller ), 4 ) + local f19_local1 = element:getParent() + f19_local1:processEvent( { + name = "unfocus_elem_" .. f19_local0 + } ) + end ) + self:registerEventHandler( "skill_points_update", function ( element, event ) + if element:isInFocus() then + element:processEvent( { + name = "button_over" + } ) + end + end ) + self:registerEventHandler( "button_over", function ( element, event ) + local f21_local0 = math.min( 1 + f18_arg2.currentLevelGetter( f18_local4.controller ), 4 ) + local f21_local1 = element:getParent() + f21_local1:processEvent( { + name = "focus_elem_" .. f21_local0 + } ) + end ) + self:registerEventHandler( "button_action", function ( element, event ) + local f22_local0 = tonumber( f18_arg2.fieldGetter( f18_arg2.specificLevelRefGetter( f18_local4.controller, f18_arg2.currentLevelGetter( f18_local4.controller ) + 1 ), f18_arg2.fieldColumns.PointCost ) ) + if f22_local0 and f22_local0 <= Game.GetAlienSkillPoints() then + Engine.NotifyServer( f18_arg2.upgradeString, 0 ) + end + end ) + local f18_local6 = LUI.UIImage.new() + f18_local6.id = "focus_bar" + f18_local6:registerAnimationState( "default", { + material = RegisterMaterial( "btn_alien_loadout_rtcap_f" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 22, + left = 0, + right = -10, + red = 0, + green = 0, + blue = 0, + alpha = 0 + } ) + f18_local6:registerAnimationState( "visible", { + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f18_local6:registerEventHandler( "button_over", MBh.AnimateToState( "visible" ) ) + f18_local6:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f18_local6:animateToState( "default" ) + self:addElement( f18_local6 ) + local f18_local7 = LUI.UIImage.new() + f18_local7.id = "bg" + f18_local7:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = -10, + red = 0, + green = 0, + blue = 0, + alpha = 0.3 + } ) + f18_local7:animateToState( "default" ) + self:addElement( f18_local7 ) + if f18_arg1 then + local f18_local8 = "" + if f18_local0 then + f18_local8 = "alien_cash_dpad_up" + elseif f18_local1 then + f18_local8 = "alien_cash_dpad_dn" + elseif f18_local2 then + f18_local8 = "alien_cash_dpad_rt" + elseif f18_local3 then + f18_local8 = "alien_cash_dpad_lt" + end + local f18_local9 = nil + if 1 == Engine.IsGamepadEnabled() then + f18_local9 = 1 + else + f18_local9 = 0 + end + local f18_local10 = LUI.UIImage.new() + f18_local10.id = "dpad" + f18_local10:registerAnimationState( "default", { + material = RegisterMaterial( f18_local8 ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -22, + bottom = 22, + left = 10.5, + width = 44, + alpha = f18_local9 + } ) + f18_local10:animateToState( "default" ) + self:addElement( f18_local10 ) + end + local f18_local8 = LUI.UIImage.new() + f18_local8.id = "icon" + f18_local8:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -18, + bottom = 26, + left = 65, + width = 44, + red = 1, + green = 1, + blue = 1, + alpha = 0.8 + } ) + f18_local8:registerAnimationState( "focused", { + red = 0, + green = 0, + blue = 0 + } ) + f18_local8:registerEventHandler( "button_over", MBh.AnimateToState( "focused" ) ) + f18_local8:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f18_local8:registerEventHandler( "skill_points_update", function ( element, event ) + element:setImage( RegisterMaterial( f18_arg2.fieldGetter( f18_arg2.currentLevelRefGetter( f18_local4.controller ), f18_arg2.fieldColumns.Icon ) ) ) + end ) + f18_local8:animateToState( "default" ) + self:addElement( f18_local8 ) + local f18_local9 = LUI.UIImage.new() + f18_local9.id = "secondary_icon" + f18_local9:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -8, + bottom = 26, + left = 30, + width = 34, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f18_local9:registerAnimationState( "visible", { + alpha = 0.8 + } ) + f18_local9:registerAnimationState( "focused", { + red = 0, + green = 0, + blue = 0 + } ) + f18_local9:registerAnimationState( "unfocused", { + red = 1, + green = 1, + blue = 1 + } ) + f18_local9:registerEventHandler( "button_over", MBh.AnimateToState( "focused" ) ) + f18_local9:registerEventHandler( "button_up", MBh.AnimateToState( "unfocused" ) ) + f18_local9:registerEventHandler( "skill_points_update", function ( element, event ) + local f24_local0 = f18_arg2.secondaryClassGetter( f18_local4.controller ) + if f24_local0 then + f18_local9:animateToState( "visible" ) + element:setImage( RegisterMaterial( f18_arg2.fieldGetter( f24_local0, f18_arg2.fieldColumns.Icon ) ) ) + end + end ) + f18_local9:animateToState( "default" ) + self:addElement( f18_local9 ) + local f18_local10 = LUI.UIText.new() + f18_local10.id = "level" + f18_local10:registerAnimationState( "default", CoD.ColorizeState( Colors.alien_tech_tree_bright_grey, { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Right, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = 6, + right = 0, + height = CoD.TextSettings.BoldFont.Height + } ) ) + f18_local10:registerAnimationState( "focused", { + red = 0, + green = 0, + blue = 0 + } ) + f18_local10:registerEventHandler( "button_over", MBh.AnimateToState( "focused" ) ) + f18_local10:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f18_local10:registerEventHandler( "skill_points_update", function ( element, event ) + local f25_local0 = f18_arg2.currentLevelGetter( f18_local4.controller ) + local f25_local1 = element + local f25_local2 = element.setText + local f25_local3 + if f25_local0 > 0 then + f25_local3 = "+" .. f25_local0 + if not f25_local3 then + + else + f25_local2( f25_local1, f25_local3 ) + end + end + f25_local3 = "" + end ) + f18_local10:animateToState( "default" ) + f18_local8:addElement( f18_local10 ) + local f18_local11 = LUI.UIText.new() + f18_local11.id = "name" + f18_local11:registerAnimationState( "default", { + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 1, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 120, + top = 0, + right = -10, + height = CoD.TextSettings.BoldFont.Height, + alpha = 1 + } ) + f18_local11:setTextStyle( CoD.TextStyle.ShadowedMore ) + f18_local11:registerAnimationState( "focused", { + red = 0, + green = 0, + blue = 0 + } ) + f18_local11:registerEventHandler( "button_over", function ( element, event ) + element:animateToState( "focused" ) + element:setTextStyle( CoD.TextStyle.None ) + end ) + f18_local11:registerEventHandler( "button_up", function ( element, event ) + element:animateToState( "default" ) + element:setTextStyle( CoD.TextStyle.ShadowedMore ) + end ) + f18_local11:registerEventHandler( "skill_points_update", function ( element, event ) + element:setText( Engine.Localize( f18_arg2.fieldGetter( f18_arg2.specificLevelRefGetter( f18_local4.controller, 0 ), f18_arg2.fieldColumns.Name ) ) ) + end ) + f18_local11:animateToState( "default" ) + self:addElement( f18_local11 ) + local f18_local12 = LUI.UIText.new() + f18_local12.id = "currentDesc" + f18_local12:registerAnimationState( "default", { + red = 0.45, + green = 0.45, + blue = 0.45, + alpha = 1, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 120, + top = -11, + right = -10, + height = CoD.TextSettings.NormalFont.Height + } ) + f18_local12:setTextStyle( CoD.TextStyle.ShadowedMore ) + f18_local12:registerAnimationState( "focused", { + red = 0, + green = 0, + blue = 0 + } ) + f18_local12:registerEventHandler( "button_over", function ( element, event ) + element:animateToState( "focused" ) + element:setTextStyle( CoD.TextStyle.None ) + end ) + f18_local12:registerEventHandler( "button_up", function ( element, event ) + element:animateToState( "default" ) + element:setTextStyle( CoD.TextStyle.ShadowedMore ) + end ) + f18_local12:registerEventHandler( "skill_points_update", function ( element, event ) + element:setText( Engine.Localize( f18_arg2.fieldGetter( f18_arg2.currentLevelRefGetter( f18_local4.controller ), f18_arg2.fieldColumns.Desc ) ) ) + end ) + f18_local12:animateToState( "default" ) + self:addElement( f18_local12 ) + return self +end + +function purchase_row_item( f32_arg0, f32_arg1, f32_arg2, f32_arg3 ) + Memory.CheckLow() + local f32_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "alien_tech_tree" ) + local self = LUI.UIElement.new() + self.id = "element_" .. f32_arg2 + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + width = 65, + alpha = 1 + } ) + self:registerAnimationState( "transparent", { + alpha = 0.5 + } ) + self:registerEventHandler( "skill_points_update", function ( element, event ) + local f33_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if f32_arg2 < f32_arg3.currentLevelGetter( f33_local0.controller ) + 1 then + self:animateToState( "transparent" ) + else + self:animateToState( "default" ) + end + end ) + self:animateToState( "default" ) + self:animateToState( "transparent" ) + local f32_local2 = LUI.UIImage.new() + f32_local2.id = "icon" + f32_local2:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + left = -22, + bottom = -10, + width = 44, + height = 44, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f32_local2:registerAnimationState( "visible", { + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f32_local2:registerAnimationState( "dim", { + red = 1, + green = 1, + blue = 1, + alpha = 0.1 + } ) + f32_local2:registerAnimationState( "red", { + red = 1, + green = 0.3, + blue = 0.3, + alpha = 0.75 + } ) + f32_local2:registerAnimationState( "focused", CoD.ColorizeState( Colors.white, { + alpha = 0.75 + } ) ) + f32_local2:animateToState( "default", 0 ) + f32_local2:animateToState( "dim" ) + f32_local2:registerEventHandler( "skill_points_update", function ( element, event ) + local f34_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + local f34_local1 = f32_arg3.currentLevelGetter( f34_local0.controller ) + f32_local2:setImage( RegisterMaterial( f32_arg3.fieldGetter( f32_arg3.specificLevelRefGetter( f34_local0.controller, f32_arg2 ), f32_arg3.fieldColumns.Icon ) ) ) + if f34_local1 + 1 < f32_arg2 then + f32_local2:animateToState( "default" ) + end + end ) + self:addElement( f32_local2 ) + local f32_local3 = function ( f35_arg0, f35_arg1 ) + f35_arg0:animateToState( "hidden" ) + local f35_local0 = f32_arg3.currentLevelGetter( f32_local0.controller ) + if f32_arg2 < f35_local0 + 1 then + f32_local2:animateToState( "visible" ) + elseif f32_arg2 == f35_local0 + 1 then + f32_local2:animateToState( "dim" ) + elseif f35_local0 + 1 < f32_arg2 then + f32_local2:animateToState( "default" ) + end + end + + local f32_local4 = LUI.MenuGenerics.generic_border( {}, { + inner = true, + thickness = 3, + border_red = Colors.white.r, + border_green = Colors.white.g, + border_blue = Colors.white.b + } ) + f32_local4.id = "selectedBorder" + f32_local4:registerAnimationState( "hidden", { + alpha = 0 + } ) + f32_local4:registerAnimationState( "visible", { + alpha = 0.75 + } ) + f32_local4:registerEventHandler( "unfocus_elem_" .. f32_arg2, f32_local3 ) + f32_local4:registerEventHandler( "focus_elem_" .. f32_arg2, function ( element, event ) + local f36_local0 = f32_arg3.specificLevelRefGetter( f32_local0.controller, f32_arg2 ) + local f36_local1 = f32_arg3.fieldGetter( f36_local0, f32_arg3.fieldColumns.PointCost ) + local f36_local2 = f32_arg3.currentLevelGetter( f32_local0.controller ) + if f36_local2 == f32_arg2 then + element:animateToState( "visible" ) + f32_local2:animateToState( "visible", 175 ) + elseif f36_local1 and tonumber( f36_local1 ) > Game.GetAlienSkillPoints() then + element:animateToState( "visible" ) + f32_local2:animateToState( "red", 175 ) + else + element:animateToState( "visible" ) + f32_local2:animateToState( "focused", 175 ) + end + element:dispatchEventToRoot( { + name = "update_selection_helper", + dispatchChildren = true, + title = f32_arg3.fieldGetter( f36_local0, f32_arg3.fieldColumns.Name ), + desc = f32_arg3.fieldGetter( f36_local0, f32_arg3.fieldColumns.Desc ), + price = f32_arg1 and f32_arg3.fieldGetter( f36_local0, f32_arg3.fieldColumns.CurrencyCost ) or "", + upgradeCost = f36_local1, + icon = f32_arg3.fieldGetter( f36_local0, f32_arg3.fieldColumns.Icon ), + level = f32_arg2, + curLevel = f36_local2, + reference = f36_local0 + } ) + end ) + f32_local4:registerEventHandler( "skill_points_update", function ( element, event ) + local f37_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if f32_arg2 ~= f32_arg3.currentLevelGetter( f37_local0.controller ) + 1 then + f32_local3( element, event ) + end + end ) + f32_local4:animateToState( "hidden" ) + self:addElement( f32_local4 ) + return self +end + +function purchase_row( f38_arg0, f38_arg1, f38_arg2 ) + local f38_local0 = UtilitiesFactory( f38_arg1, f38_arg2 ) + local self = LUI.UIElement.new() + self.id = "row_" .. f38_arg0 + self:makeFocusable() + self:setHandleMouseMove( true ) + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 65, + left = -80, + right = 0, + alpha = 0 + } ) + self:registerAnimationState( "visible", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 65, + left = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default" ) + self:animateToState( "visible", 120, false, true ) + local f38_local2 = LUI.UIImage.new() + f38_local2.id = "bg" + f38_local2:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 485, + right = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0.45 + } ) + f38_local2:animateToState( "default" ) + self:addElement( f38_local2 ) + if tonumber( f38_arg0 ) < 5 then + local f38_local3 = LUI.UIImage.new() + f38_local3.id = "divider_" .. f38_arg0 + f38_local3:registerAnimationState( "default", { + material = RegisterMaterial( "box_alien_header_footer" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = -10, + bottom = 16, + alpha = 1 + } ) + f38_local3:animateToState( "default" ) + self:addElement( f38_local3 ) + end + local f38_local3 = LUI.UIHorizontalList.new() + f38_local3.id = "content" + f38_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + spacing = 20 + } ) + f38_local3:animateToState( "default" ) + f38_local3:addElement( purchase_row_head( f38_arg1, f38_arg2, f38_local0 ) ) + for f38_local4 = 0, 4, 1 do + f38_local3:addElement( purchase_row_item( f38_arg1, f38_arg2, f38_local4, f38_local0 ) ) + end + self:addElement( f38_local3 ) + return self +end + +function points_counter() + local self = LUI.UIElement.new() + self.id = "points_counter" + local f39_local1 = LUI.UIHorizontalList.new() + f39_local1.id = "list" + f39_local1:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 260, + right = 0 + } ) + f39_local1:animateToState( "default" ) + self:addElement( f39_local1 ) + local f39_local2 = Engine.Localize( "@ALIENS_POINT_BALANCE" ) + local f39_local3, f39_local4, f39_local5, f39_local6 = GetTextDimensions( f39_local2, CoD.TextSettings.BoldFont.Font, CoD.TextSettings.BoldFont.Height ) + local f39_local7 = f39_local5 - f39_local3 + local f39_local8 = LUI.UIText.new() + f39_local8.id = "balance" + f39_local8:setText( f39_local2 ) + f39_local8:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.BoldFont.Font, + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + width = f39_local7, + top = 0, + bottom = 0 + } ) ) + f39_local8:animateToState( "default" ) + f39_local1:addElement( f39_local8 ) + local f39_local9 = LUI.UIText.new() + f39_local8.id = "balance" + f39_local9:setupUIBindText( "AlienSkillPoints" ) + f39_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.BoldFont.Font, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + left = 0, + right = 20, + top = 0, + bottom = 0 + } ) ) + f39_local9:animateToState( "default" ) + f39_local1:addElement( f39_local9 ) + return self +end + +function selection_help() + local f40_local0 = LUI.mp_menus.Aliens + local self = LUI.UIElement.new() + self.id = "selection_help" + local f40_local2 = LUI.UIImage.new() + f40_local2.id = "background" + f40_local2:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0.25, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = 0, + right = 0, + height = 140 + } ) + f40_local2:animateToState( "default" ) + self:addElement( f40_local2 ) + local f40_local3 = LUI.UIImage.new() + f40_local3.id = "icon" + f40_local3:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 38, + bottom = 84, + left = 0, + width = 44, + alpha = 0 + } ) ) + f40_local3:registerAnimationState( "visible", { + alpha = 1 + } ) + f40_local3:registerEventHandler( "update_selection_helper", function ( element, event ) + element:setImage( RegisterMaterial( event.icon ) ) + if event.curLevel == 4 then + element:animateToState( "default" ) + else + element:animateToState( "visible" ) + end + end ) + f40_local3:animateToState( "default" ) + local f40_local4 = LUI.UIText.new() + f40_local4.id = "level" + f40_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + left = 0, + width = 30, + bottom = 60, + height = CoD.TextSettings.BoldFont.Height, + alpha = 0 + } ) ) + f40_local4:registerAnimationState( "visible", { + alpha = 1 + } ) + f40_local4:registerEventHandler( "update_selection_helper", function ( element, event ) + element:setText( "+" .. event.level ) + element:setTextStyle( CoD.TextStyle.ShadowedMore ) + if event.curLevel == 4 or event.upgradeCost and tonumber( event.upgradeCost ) >= 9999 then + element:animateToState( "default" ) + else + element:animateToState( "visible" ) + end + end ) + f40_local4:animateToState( "default" ) + local f40_local5 = Engine.Localize( "@ALIENS_NEXT_UPGRADE" ) + local f40_local6, f40_local7, f40_local8, f40_local9 = GetTextDimensions( f40_local5, CoD.TextSettings.BoldFont.Font, CoD.TextSettings.BoldFont.Height ) + local f40_local10 = f40_local8 - f40_local6 + local f40_local11 = LUI.UIText.new() + f40_local11.id = "upgrade" + f40_local11:setText( f40_local5 ) + f40_local11:setTextStyle( CoD.TextStyle.ShadowedMore ) + f40_local11:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 0, + top = 47, + width = 0, + height = CoD.TextSettings.BoldFont.Height, + alpha = 0 + } ) ) + f40_local11:registerAnimationState( "visible", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 0, + top = 47, + width = f40_local10, + height = CoD.TextSettings.BoldFont.Height, + alpha = 1 + } ) + f40_local11:registerEventHandler( "update_selection_helper", function ( element, event ) + if event.curLevel == 4 or event.upgradeCost and tonumber( event.upgradeCost ) >= 9999 then + element:animateToState( "default" ) + else + element:animateToState( "visible" ) + end + end ) + f40_local11:animateToState( "default" ) + local f40_local12 = LUI.UIHorizontalList.new() + f40_local12.id = "content" + f40_local12:registerAnimationState( "default", { + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0, + spacing = 1 + } ) + f40_local12:registerAnimationState( "visible", { + alpha = 1 + } ) + f40_local12:registerEventHandler( "update_selection_helper", function ( element, event ) + if event.curLevel == 4 then + element:animateToState( "default" ) + else + element:animateToState( "visible" ) + end + end ) + f40_local12:animateToState( "default" ) + f40_local12:addElement( f40_local3 ) + f40_local12:addElement( f40_local4 ) + f40_local12:addElement( f40_local11 ) + self:addElement( f40_local12 ) + local f40_local13 = LUI.UIText.new() + f40_local13.id = "desc" + f40_local13:registerAnimationState( "default", { + red = 1, + green = 1, + blue = 1, + alpha = 1, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 10, + top = 90, + right = -10, + height = CoD.TextSettings.BoldFont.Height + } ) + f40_local13:animateToState( "default" ) + f40_local13:registerEventHandler( "update_selection_helper", function ( element, event ) + if event.curLevel == 4 then + element:setText( Engine.Localize( "@ALIENS_MAX_LEVEL" ) ) + element:setTextStyle( CoD.TextStyle.ShadowedMore ) + else + element:setText( Engine.Localize( event.desc ) ) + element:setTextStyle( CoD.TextStyle.ShadowedMore ) + end + end ) + self:addElement( f40_local13 ) + local f40_local14 = LUI.UIImage.new() + f40_local14.id = "bottomStrip" + f40_local14:registerAnimationState( "current", { + material = RegisterMaterial( "white" ), + red = 0, + green = 0, + blue = 0, + alpha = 1, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = 0, + right = 0, + height = CoD.TextSettings.BoldFont.Height + 3 + } ) + f40_local14:animateToState( "current" ) + self:addElement( f40_local14 ) + local f40_local15 = LUI.UIText.new() + f40_local15.id = "cost" + f40_local15:registerAnimationState( "default", CoD.ColorizeState( Colors.alien_tech_tree_bright_grey, { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 10, + bottom = 0, + right = -10, + height = CoD.TextSettings.BoldFont.Height + } ) ) + f40_local15:registerAnimationState( "yellow", CoD.ColorizeState( Colors.frontend_hilite, {} ) ) + f40_local15:registerAnimationState( "hidden", { + alpha = 0 + } ) + f40_local15:registerAnimationState( "red", { + red = 1, + green = 0.3, + blue = 0.3, + alpha = 1 + } ) + f40_local15:registerEventHandler( "update_selection_helper", function ( element, event ) + element:setText( Engine.Localize( "@ALIENS_UPGRADE_COST", event.upgradeCost ) ) + if event.curLevel == 4 or event.upgradeCost and tonumber( event.upgradeCost ) >= 9999 then + element:animateToState( "hidden" ) + elseif not event.upgradeCost or tonumber( event.upgradeCost ) > Game.GetAlienSkillPoints() then + element:animateToState( "red" ) + else + element:animateToState( "yellow" ) + end + end ) + f40_local15:animateToState( "default" ) + self:addElement( f40_local15 ) + local f40_local16 = Engine.IsConsoleGame() + if not f40_local16 then + f40_local16 = 1 == Engine.IsGamepadEnabled() + end + if f40_local16 then + local f40_local17 = Engine.Localize( "@ALIENS_PURCHASE" ) + local f40_local18 = LUI.UIText.new() + f40_local18.id = "purchase" + f40_local18:setText( f40_local17 ) + f40_local18:registerAnimationState( "default", { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + left = 0, + bottom = 0, + right = -20, + height = CoD.TextSettings.SmallFont.Height, + alpha = 0 + } ) + f40_local18:registerAnimationState( "visible", { + alpha = 1 + } ) + f40_local18:registerEventHandler( "update_selection_helper", function ( element, event ) + if not event.upgradeCost or tonumber( event.upgradeCost ) > Game.GetAlienSkillPoints() then + element:animateToState( "default" ) + else + element:animateToState( "visible" ) + end + end ) + f40_local18:animateToState( "default" ) + self:addElement( f40_local18 ) + local f40_local19, f40_local20, f40_local21, f40_local22 = GetTextDimensions( f40_local17, CoD.TextSettings.SmallFont.Font, CoD.TextSettings.SmallFont.Height ) + local f40_local23 = LUI.UIText.new() + f40_local23.id = "A" + f40_local23:setText( Engine.Localize( ButtonMap.button_action.string ) ) + f40_local23:registerAnimationState( "default", { + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + left = 10, + bottom = (CoD.TextSettings.ExtraBigFont.Height - CoD.TextSettings.SmallFont.Height) / 2, + right = -10 - f40_local21 - f40_local19 - 10, + height = CoD.TextSettings.ExtraBigFont.Height, + alpha = 0 + } ) + f40_local23:registerAnimationState( "visible", { + alpha = 1 + } ) + f40_local23:registerEventHandler( "update_selection_helper", function ( element, event ) + local f48_local0 = event.upgradeCost + if f48_local0 then + f48_local0 = tonumber( event.upgradeCost ) <= Game.GetAlienSkillPoints() + end + if f48_local0 then + element:animateToState( "visible" ) + else + element:animateToState( "default" ) + end + end ) + f40_local23:animateToState( "default" ) + self:addElement( f40_local23 ) + end + return self +end + +function nerfs_active( f49_arg0 ) + local f49_local0 = LUI.mp_menus.Aliens + local self = LUI.UIElement.new() + local f49_local2 = LUI.mp_menus.Aliens.GetBaseNerfList() + self.id = "active_nerfs" + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f49_local3 = LUI.UIImage.new() + f49_local3.id = "background" + f49_local3:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + red = 0, + green = 0, + blue = 0, + alpha = 0.2, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = 0, + right = 0, + top = 0 + } ) + f49_local3:registerEventHandler( "menu_create", function ( element, event ) + for f50_local0 = 1, #f49_local2, 1 do + if Engine.AliensCheckIsRelicEnabled( event.controller, f49_local2[f50_local0] ) then + element:animateToState( "default" ) + break + end + end + end ) + self:addElement( f49_local3 ) + local f49_local4 = LUI.UIHorizontalList.new( { + alignment = LUI.Alignment.Center, + spacing = 10, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -5, + left = 11, + right = 0 + } ) + f49_local4.id = "nerf_container" + self:addElement( f49_local4 ) + for f49_local5 = 1, #f49_local2, 1 do + if Engine.AliensCheckIsRelicEnabled( f49_arg0, f49_local2[f49_local5] ) then + local f49_local8 = LUI.UIImage.new( { + material = RegisterMaterial( LUI.mp_menus.Aliens.GetFieldForNerf( f49_local2[f49_local5], LUI.mp_menus.Aliens.AlienNerfs.Cols.Icon ) ), + red = 1, + green = 1, + blue = 1, + alpha = 0.8, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 11, + height = 38, + left = -10, + width = 38, + alpha = 0.5 + } ) + f49_local8.id = "nerfIcon_" .. f49_local5 + f49_local4:addElement( f49_local8 ) + end + end + return self +end + +function crafting_active( f51_arg0, f51_arg1, f51_arg2 ) + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f51_arg2, + height = 65, + right = f51_arg1, + width = 486 + } ) + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self.id = "active_crafting" + local f51_local1 = function ( f52_arg0, f52_arg1 ) + if f52_arg1.value < 0 then + f52_arg0:animateToState( "default", 100 ) + else + local f52_local0 = MBh.AnimateLoop( { + { + "bigger", + 750 + }, + { + "default", + 750 + } + } ) + f52_local0( f52_arg0 ) + end + end + + local f51_local2 = LUI.UIImage.new() + f51_local2.id = "craft_background" + f51_local2:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + red = 0, + green = 0, + blue = 0, + alpha = 0.2, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = 0, + right = 0, + top = 0 + } ) + f51_local2:animateToState( "default" ) + self:addElement( f51_local2 ) + local f51_local3 = Game.GetOmnvar( "ui_alien_hudcraftinginfo" ) + local f51_local4 = { + File = "mp/alien/crafting_traps.csv", + Index = 0, + trapText = 18, + trapIcon = 19 + } + local f51_local5 = Engine.TableLookup( f51_local4.File, f51_local4.Index, f51_local3, f51_local4.trapText ) + local f51_local6 = Engine.TableLookup( f51_local4.File, f51_local4.Index, f51_local3, f51_local4.trapIcon ) + local f51_local7 = LUI.UIImage.new() + f51_local7:registerAnimationState( "default", { + material = RegisterMaterial( "alien_crafting_glow1" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -12, + height = 96, + left = -48, + width = 96, + alpha = 0.25 + } ) + f51_local7:registerAnimationState( "bigger", { + top = -60, + height = 128, + left = -64, + width = 128, + alpha = 0.5 + } ) + f51_local7:registerOmnvarHandler( "ui_alien_hudcraftinginfo", f51_local1 ) + f51_local7:animateToState( "default" ) + f51_local1( f51_local7, { + value = Game.GetOmnvar( "ui_alien_hudcraftinginfo" ) + } ) + local f51_local8 = LUI.UIImage.new() + f51_local8:registerAnimationState( "default", { + material = RegisterMaterial( f51_local6 ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + height = 64, + left = 0, + width = 64, + alpha = 0.8 + } ) + f51_local8:animateToState( "default", 0 ) + f51_local8:addElement( f51_local7 ) + local f51_local9 = LUI.UIText.new() + f51_local9:registerAnimationState( "default", { + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 1, + font = CoD.TextSettings.BoldFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 20, + height = CoD.TextSettings.BoldFont.Height, + right = 48, + width = 365 + } ) + f51_local9:animateToState( "default" ) + f51_local9:registerAnimationState( "bigger", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 19, + height = CoD.TextSettings.BoldFont.Height - 1, + right = 48, + width = 365 + } ) + f51_local9:setText( Engine.Localize( "@ALIEN_CRAFTING_PRESSTOCRAFT", Engine.Localize( f51_local5 ) ) ) + local f51_local10 = LUI.UIHorizontalList.new() + f51_local10.id = "craft_container" + f51_local10:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + spacing = 30, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 25, + bottom = -5, + right = 0 + } ) + f51_local10:animateToState( "default" ) + f51_local10:addElement( f51_local8 ) + f51_local10:addElement( f51_local9 ) + if f51_local3 > -1 then + f51_arg0:registerEventHandler( "keybind", function ( element, event ) + local f53_local0 = Engine.IsConsoleGame() + if not f53_local0 then + f53_local0 = Engine.IsGamepadEnabled() == 1 + end + local f53_local1 + if f53_local0 then + f53_local1 = "+usereload" + if not f53_local1 then + + else + if event.command == f53_local1 then + CraftItem() + end + end + end + f53_local1 = "+activate" + end ) + end + self:addElement( f51_local10 ) + return self +end + +function MainCreate( f54_arg0, f54_arg1 ) + if not f54_arg0.properties.exclusiveController then + DebugPrint( "WARNING: Alien upgrade screen opened without exclusive controller. This should only happen while debugging, a default value will be use." ) + f54_arg0.properties.exclusiveController = 0 + end + local f54_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f54_arg0 ) + f54_local0.controller = f54_arg0.properties.exclusiveController +end + +function alien_tech_tree() + local f55_local0, f55_local1, f55_local2, f55_local3 = GameX.GetAdjustedSafeZoneSize() + local f55_local4 = LUI.FlowManager.GetMenuScopedDataByMenuName( "alien_tech_tree" ) + local self = LUI.UIElement.new() + self.id = "alien_tech_tree" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "menu_create", MainCreate ) + local f55_local6 = LUI.UIImage.new() + f55_local6.id = "fade" + f55_local6:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0.3 + } ) + f55_local6:animateToState( "default" ) + self:addElement( f55_local6 ) + local f55_local7 = LUI.UIVerticalList.new() + f55_local7.id = "mainTable" + f55_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = Engine.UsingSplitscreenUpscaling() and f55_local1 - 25 or 85, + bottom = 100, + left = Engine.UsingSplitscreenUpscaling() and -690 or -460, + width = 920, + spacing = 5, + scale = Engine.UsingSplitscreenUpscaling() and -0.13 or 0 + } ) + self:addElement( f55_local7 ) + f55_local7:addElement( purchase_row( 0, 0, nil ) ) + f55_local7:animateToState( "default" ) + local f55_local8 = LUI.UITimer.new( 60, { + name = "build_tech_tree" + }, nil, false, f55_local7, false ) + f55_local8.id = "buildTimer" + self:addElement( f55_local8 ) + f55_local7:registerEventHandler( "skill_points_update", function ( element, event ) + element.skillPoints = event.newValue + end ) + f55_local7:registerEventHandler( "build_tech_tree", function ( element, event ) + element.next = element.next and element.next + 1 or 1 + local f57_local0 = nil + if element.next == 1 then + f57_local0 = purchase_row( "1", 1, nil ) + elseif element.next == 2 then + f57_local0 = purchase_row( "2", nil, LUI.mp_menus.Aliens.AlienAbilities.Up ) + elseif element.next == 3 then + f57_local0 = purchase_row( "3", nil, LUI.mp_menus.Aliens.AlienAbilities.Down ) + elseif element.next == 4 then + f57_local0 = purchase_row( "4", nil, LUI.mp_menus.Aliens.AlienAbilities.Left ) + elseif element.next == 5 then + f57_local0 = purchase_row( "5", nil, LUI.mp_menus.Aliens.AlienAbilities.Right ) + else + f55_local8:close() + end + if f57_local0 and element.skillPoints then + element:addElement( f57_local0 ) + f57_local0:processEvent( { + name = "skill_points_update", + dispatchChildren = true, + newValue = element.skillPoints + } ) + end + end ) + local f55_local9 = Engine.UsingSplitscreenUpscaling() and f55_local1 + 20 or f55_local1 + 50 + if Engine.UsingSplitscreenUpscaling() then + local f55_local10 = f55_local9 + end + local f55_local11 = f55_local10 or 470 + local f55_local12 = Engine.UsingSplitscreenUpscaling() and 650 or 460 + local f55_local13 = Engine.UsingSplitscreenUpscaling() and f55_local1 + 192 or 505 + local f55_local14 = Engine.UsingSplitscreenUpscaling() and 680 or 26 + local f55_local15 + if LUI.mp_menus.Aliens.getNumEnabledNerfs( f55_local4.exclusiveController ) > 0 then + f55_local15 = 75 + if not f55_local15 then + + else + local f55_local16 = Engine.UsingSplitscreenUpscaling() and f55_local1 + 192 + f55_local15 or 505 + f55_local15 + local f55_local17 = points_counter() + f55_local17:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f55_local9, + right = f55_local12, + width = 432, + height = CoD.TextSettings.BoldFont.Height + } ) + f55_local17:animateToState( "default" ) + self:addElement( f55_local17 ) + local f55_local18 = selection_help() + f55_local18:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f55_local11, + right = f55_local12, + width = 432, + height = 175 + } ) + f55_local18:animateToState( "default" ) + self:addElement( f55_local18 ) + local f55_local19 = nerfs_active( f55_local4.exclusiveController ) + f55_local19:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f55_local13, + height = 65, + right = f55_local14, + width = 486 + } ) + f55_local19:animateToState( "default" ) + self:addElement( f55_local19 ) + local f55_local20 = LUI.UIBindButton.new() + f55_local20.id = "back" + f55_local20:registerEventHandler( "button_secondary", MBh.LeaveMenu() ) + self:addElement( f55_local20 ) + if Engine.GetDvarString( "ui_mapname" ) == "mp_alien_beacon" or Engine.GetDvarString( "ui_mapname" ) == "mp_alien_dlc3" or Engine.GetDvarString( "ui_mapname" ) == "mp_alien_last" then + local f55_local21 = crafting_active( f55_local20, f55_local14, f55_local16 ) + self:addElement( f55_local21 ) + if Game.GetOmnvar( "ui_alien_hudcraftinginfo" ) > -1 then + f55_local21:animateToState( "visible" ) + else + f55_local21:animateToState( "hidden" ) + end + end + local f55_local21 = LUI.UIElement.new() + f55_local21:setupUIIntWatch( "AlienSkillPoints" ) + f55_local21.id = "pointsWatch" + f55_local21:registerEventHandler( "int_watch_alert", function ( element, event ) + event.name = "skill_points_update" + event.dispatchChildren = true + self:processEvent( event ) + end ) + self:addElement( f55_local21 ) + if LUI.mp_menus.AliensPurchasables.UsingExtinctionTokens() then + local f55_local22 = Engine.UsingSplitscreenUpscaling() and 1035 or 150 + local f55_local23 = LUI.FlowManager.GetMenuScopedDataByMenuName( "alien_tech_tree" ) + self:addElement( LUI.MenuBuilder.BuildRegisteredType( "alien_tokens_widget", { + controller = f55_local23.exclusiveController, + xPos = f55_local22, + yPos = f55_local9 + } ) ) + end + self:registerOmnvarHandler( "ui_alien_player_in_laststand", function ( f59_arg0, f59_arg1 ) + if f59_arg1.value then + LUI.FlowManager.RequestLeaveMenu( f59_arg0 ) + end + end ) + self:registerOmnvarHandler( "ui_alien_eog_score_total", function ( f60_arg0, f60_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f60_arg0 ) + end ) + return self + end + end + f55_local15 = 0 +end + +function CraftItem() + Engine.NotifyServer( "craft_current_item", 1 ) + LUI.FlowManager.RequestLeaveMenu() + Engine.PlaySound( "ui_craft_select" ) +end + +LUI.MenuBuilder.registerType( "alien_tech_tree", alien_tech_tree ) +LUI.FlowManager.RegisterStackPushBehaviour( "alien_tech_tree", PushTechTree ) +LUI.FlowManager.RegisterStackPopBehaviour( "alien_tech_tree", PopTechTree ) +LockTable( _M ) diff --git a/lui/mp_hud/alienscoreboards.dec.lua b/lui/mp_hud/alienscoreboards.dec.lua new file mode 100644 index 0000000..7f3c5f2 --- /dev/null +++ b/lui/mp_hud/alienscoreboards.dec.lua @@ -0,0 +1,1405 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +ScoreboardLUT = { + File = "mp/alien/scoreboard_string_lookup.csv", + Cols = { + Ref = 0, + String = 1 + } +} +bgPalette = { + Dark = { + EvenRow = { + EvenCol = { + r = 0.2, + g = 0.2, + b = 0.2, + a = 0.8 + }, + OddCol = { + r = 0.1, + g = 0.1, + b = 0.1, + a = 0.8 + } + }, + OddRow = { + EvenCol = { + r = 0.14, + g = 0.14, + b = 0.14, + a = 0.8 + }, + OddCol = { + r = 0.07, + g = 0.07, + b = 0.07, + a = 0.8 + } + } + }, + DarkUniform = { + EvenRow = { + EvenCol = { + r = 0.14, + g = 0.14, + b = 0.14, + a = 0.8 + }, + OddCol = { + r = 0.14, + g = 0.14, + b = 0.14, + a = 0.8 + } + }, + OddRow = { + EvenCol = { + r = 0.14, + g = 0.14, + b = 0.14, + a = 0.8 + }, + OddCol = { + r = 0.14, + g = 0.14, + b = 0.14, + a = 0.8 + } + } + }, + Bright = { + EvenRow = { + EvenCol = { + r = 1, + g = 1, + b = 1, + a = 0.5 + }, + OddCol = { + r = 0.75, + g = 0.75, + b = 0.75, + a = 0.5 + } + }, + OddRow = { + EvenCol = { + r = 1, + g = 1, + b = 1, + a = 0.5 + }, + OddCol = { + r = 0.75, + g = 0.75, + b = 0.75, + a = 0.5 + } + } + }, + BrightUniform = { + EvenRow = { + EvenCol = { + r = 1, + g = 1, + b = 1, + a = 0.5 + }, + OddCol = { + r = 1, + g = 1, + b = 1, + a = 0.5 + } + }, + OddRow = { + EvenCol = { + r = 1, + g = 1, + b = 1, + a = 0.5 + }, + OddCol = { + r = 1, + g = 1, + b = 1, + a = 0.5 + } + } + } +} +function table_row_factory( f1_arg0 ) + local self = LUI.UIHorizontalList.new() + self.id = "row" + local f1_local1 = {} + for f1_local16, f1_local17 in ipairs( f1_arg0 ) do + if f1_local16 == 1 then + local f1_local5 = LUI.UIElement.new() + f1_local5.id = "cap" + f1_local5:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 20 + } ) + f1_local5:animateToState( "default" ) + local f1_local6 = LUI.UIImage.new() + f1_local6.id = "cap_img" + f1_local6:registerAnimationState( "default", CoD.ColorizeState( f1_local17.bgColor, { + material = RegisterMaterial( "box_scoreboard_ltcap" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -2, + left = -4, + width = 24, + height = 24 + } ) ) + f1_local6:animateToState( "default" ) + f1_local5:addElement( f1_local6 ) + local f1_local7 = LUI.UIImage.new() + f1_local7.id = "cap_fill" + f1_local7:registerAnimationState( "default", CoD.ColorizeState( f1_local17.bgColor, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 19, + left = 0, + right = 0, + bottom = 0 + } ) ) + f1_local7:animateToState( "default" ) + f1_local5:addElement( f1_local7 ) + self:addElement( f1_local5 ) + f1_local17.width = f1_local17.width - 20 + end + local f1_local5 = LUI.UIElement.new() + f1_local5.id = "col_" .. f1_local16 + f1_local5:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f1_local17.width + } ) + f1_local5:animateToState( "default" ) + self:addElement( f1_local5 ) + local f1_local6 = LUI.UIImage.new() + f1_local6.id = "bg" + f1_local6:registerAnimationState( "default", CoD.ColorizeState( f1_local17.bgColor, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) ) + f1_local6:animateToState( "default" ) + f1_local5:addElement( f1_local6 ) + if f1_local17.text then + local f1_local7 = CoD.TextSettings.SmallFont + if f1_local17.pretty then + f1_local5.text = LUI.UIPrettyNumber.new( nil, f1_local17.pretty ) + f1_local5.text:setValue( f1_local17.text ) + else + if f1_local17.marquee then + f1_local5.text = LUI.UIMarqueeText.new() + else + f1_local5.text = LUI.UIText.new() + end + f1_local5.text:setText( f1_local17.text ) + end + f1_local5.text.id = "text" + local f1_local8 = f1_local5.text + local f1_local9 = f1_local8 + f1_local8 = f1_local8.registerAnimationState + local f1_local10 = "default" + local f1_local11 = CoD.ColorizeState + local f1_local12 = f1_local17.fgColor + local f1_local13 = { + font = f1_local7.Font, + alignment = f1_local17.align, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true + } + local f1_local14 = f1_local17.textOffset or 0 + local f1_local15 + if f1_local16 == 1 then + f1_local15 = -10 + if not f1_local15 then + + else + f1_local13.left = f1_local14 + f1_local15 + f1_local13.top = -f1_local7.Height / 2 + f1_local13.right = -10 + f1_local13.height = f1_local7.Height + f1_local8( f1_local9, f1_local10, f1_local11( f1_local12, f1_local13 ) ) + f1_local5.text:animateToState( "default" ) + f1_local5:addElement( f1_local5.text ) + end + end + f1_local15 = 10 + end + table.insert( f1_local1, f1_local5 ) + end + self.getColumn = function ( f2_arg0 ) + return f1_local1[f2_arg0] + end + + return self +end + +function table_factory( f3_arg0, f3_arg1, f3_arg2, f3_arg3 ) + local f3_local0 = 0 + for f3_local4, f3_local5 in ipairs( f3_arg1 ) do + f3_local0 = f3_local0 + f3_local5 + end + assert( 0 < f3_local0, "Invalid table width" ) + assert( 0 < f3_arg0, "Invalid table row height" ) + self = LUI.UIElement.new() + self.id = "table_widget" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + f3_local2 = LUI.UIVerticalList.new() + f3_local2.headers = 0 + f3_local2.rows = 0 + f3_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + width = f3_local0, + spacing = f3_arg2 or 6, + alignment = f3_arg3 + } ) + f3_local2:animateToState( "default" ) + self:addElement( f3_local2 ) + self.addHeader = function ( f4_arg0, f4_arg1 ) + f3_local2.headers = f3_local2.headers + 1 + local f4_local0 = table_row_factory( { + { + width = f3_local0, + text = f4_arg0, + align = f4_arg1 or LUI.Alignment.Center, + bgColor = bgPalette.Bright.EvenRow.EvenCol, + fgColor = { + r = 0, + g = 0, + b = 0, + a = 1 + }, + marquee = false + } + } ) + f4_local0.id = "header_" .. f3_local2.headers + f4_local0:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = f3_arg0 + } ) + f4_local0:animateToState( "default" ) + f3_local2:addElement( f4_local0 ) + return f4_local0 + end + + self.addRow = function ( f5_arg0, f5_arg1, f5_arg2 ) + f3_local2.rows = f3_local2.rows + 1 + local f5_local0 = {} + assert( #f5_arg1 == #f3_arg1, "Wrong number of columns in dataset" ) + for f5_local6, f5_local7 in ipairs( f5_arg1 ) do + local f5_local8 = table.insert + local f5_local9 = f5_local0 + local f5_local10 = { + text = f5_local7.text, + textOffset = f5_local7.textOffset or 0, + width = f3_arg1[f5_local6] + } + local f5_local4 = f5_local7.color + if not f5_local4 then + f5_local4 = { + r = 0, + g = 0, + b = 0, + a = 1 + } + end + f5_local10.fgColor = f5_local4 + f5_local4 = f3_local2.rows % 2 and "EvenRow" or "OddRow" + local f5_local5 = f5_arg0[f5_local4] + f5_local10.bgColor = f5_local4[f5_local6 % 2 and "EvenCol" or "OddCol"] + f5_local4 = f5_local7.align + if not f5_local4 then + if f5_local6 == 1 then + f5_local4 = LUI.Alignment.Left + if not f5_local4 then + + else + f5_local10.align = f5_local4 + f5_local10.marquee = f5_local7.marquee or false + f5_local10.pretty = f5_local7.pretty or nil + f5_local8( f5_local9, f5_local10 ) + end + end + f5_local4 = LUI.Alignment.Right + end + f5_local10.align = f5_local4 + f5_local10.marquee = f5_local7.marquee or false + f5_local10.pretty = f5_local7.pretty or nil + f5_local8( f5_local9, f5_local10 ) + end + f5_local1 = table_row_factory( f5_local0 ) + f5_local1.id = "row_" .. f3_local2.rows + f3_local2:addElement( f5_local1 ) + f5_local1:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = f3_arg0, + alpha = 1 + } ) + f5_local1:animateToState( "default" ) + if f5_arg2 then + if type( f5_arg2 ) == "number" then + local f5_local11 = f5_arg2 + end + f5_local2 = f5_local11 or 300 + f5_local1:registerAnimationState( "intro", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + right = 0, + height = f3_arg0, + alpha = 0 + } ) + f5_local1:animateToState( "intro" ) + f5_local3 = MBh.AnimateSequence( { + { + "intro", + f5_local2 * f3_local2:getNumChildren(), + false, + false + }, + { + "default", + 200, + true, + true + } + } ) + f5_local3( f5_local1, {} ) + end + return f5_local1 + end + + self.popRow = function () + local f6_local0 = f3_local2:getLastChild() + f6_local0:close() + f3_local2.rows = f3_local2.rows - 1 + end + + return self +end + +function pause_menu_scoreboard() + local f7_local0 = { + name = 1, + loadout = 2, + cash = 3, + score = 4 + } + local f7_local1 = LUI.mp_menus.Aliens.IsChaosMode() + local f7_local2 = nil + if f7_local1 then + f7_local2 = table_factory( 28, { + 330, + 150, + 68 + } ) + else + f7_local2 = table_factory( 28, { + 330, + 150, + 68, + 102 + } ) + end + f7_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericMenuDims.menu_top, + left = 540, + width = 0, + height = 0 + } ) + f7_local2:animateToState( "default" ) + f7_local2.player_rows = 0 + local self = LUI.UITimer.new( 250, { + name = "refresh_scoreboard", + dispatchChildren = true + }, nil, false, f7_local2, false ) + self.id = "refreshTimer" + f7_local2:addElement( self ) + local f7_local4 = { + { + text = Engine.Localize( "@ALIENS_PLAYER_CAPS" ), + align = LUI.Alignment.Center, + color = { + r = 0, + g = 0, + b = 0, + a = 1 + } + }, + { + text = Engine.Localize( "@ALIENS_ABILITIES_CAPS" ), + align = LUI.Alignment.Center, + color = { + r = 0, + g = 0, + b = 0, + a = 1 + } + }, + { + text = Engine.Localize( "@ALIENS_CASH_CAPS" ), + align = LUI.Alignment.Center, + color = { + r = 0, + g = 0, + b = 0, + a = 1 + } + } + } + if not f7_local1 then + table.insert( f7_local4, { + text = Engine.Localize( "@ALIENS_SCORE_CAPS" ), + align = LUI.Alignment.Center, + color = { + r = 0, + g = 0, + b = 0, + a = 1 + } + } ) + end + f7_local2.addRow( bgPalette.Bright, f7_local4 ) + local f7_local5 = function ( f8_arg0, f8_arg1 ) + assert( f8_arg1.data, "Missing scoreboard data" ) + local f8_local0 = LUI.mp_menus.Aliens + local f8_local1 = Game.GetPlayerScoreRanking() + local f8_local2 = f8_arg1.data.ranks[f8_arg0.rank] + local f8_local3 = f8_arg0.getColumn( f7_local0.name ) + f8_local3.text:setText( f8_local2.name ) + if f8_local2.client then + f8_local3 = f8_local0.GetPlayerCash( f8_local2.client ) + local f8_local4 = f8_local0.GetScoreFromClient( f8_local2.client ) + local f8_local5 = f8_arg0.getColumn( f7_local0.cash ) + f8_local5.text:setText( f8_local3 ) + if not f7_local1 then + f8_local5 = f8_arg0.getColumn( f7_local0.score ) + f8_local5.text:setText( f8_local4 ) + end + end + if f8_arg0.rank == f8_local1 then + f8_local3 = f8_arg0.getColumn( f7_local0.name ) + f8_local3.text:registerAnimationState( "current", CoD.ColorizeState( Colors.alien_frontend_hilite, {} ) ) + f8_local3 = f8_arg0.getColumn( f7_local0.name ) + f8_local3.text:animateToState( "current" ) + f8_local3 = f8_arg0.getColumn( f7_local0.cash ) + f8_local3.text:registerAnimationState( "current", CoD.ColorizeState( Colors.alien_frontend_hilite, {} ) ) + f8_local3 = f8_arg0.getColumn( f7_local0.cash ) + f8_local3.text:animateToState( "current" ) + if not f7_local1 then + f8_local3 = f8_arg0.getColumn( f7_local0.score ) + f8_local3.text:registerAnimationState( "current", CoD.ColorizeState( Colors.alien_frontend_hilite, {} ) ) + f8_local3 = f8_arg0.getColumn( f7_local0.score ) + f8_local3.text:animateToState( "current" ) + end + else + f8_local3 = f8_arg0.getColumn( f7_local0.name ) + f8_local3.text:registerAnimationState( "current", CoD.ColorizeState( Colors.alien_scoreboard_bright_grey, {} ) ) + f8_local3 = f8_arg0.getColumn( f7_local0.name ) + f8_local3.text:animateToState( "current" ) + f8_local3 = f8_arg0.getColumn( f7_local0.cash ) + f8_local3.text:registerAnimationState( "current", CoD.ColorizeState( Colors.alien_scoreboard_dull_grey, {} ) ) + f8_local3 = f8_arg0.getColumn( f7_local0.cash ) + f8_local3.text:animateToState( "current" ) + if not f7_local1 then + f8_local3 = f8_arg0.getColumn( f7_local0.score ) + f8_local3.text:registerAnimationState( "current", CoD.ColorizeState( Colors.alien_scoreboard_bright_grey, {} ) ) + f8_local3 = f8_arg0.getColumn( f7_local0.score ) + f8_local3.text:animateToState( "current" ) + end + end + if f8_local2.rankIcon and f8_local2.rank then + f8_local3 = f8_arg0.getColumn( f7_local0.name ) + assert( f8_local3.rankIcon ) + f8_local3.rankIcon:setImage( f8_local2.rankIcon ) + assert( f8_local3.rankText ) + f8_local3.rankText:setText( Rank.GetRankDisplay( f8_local2.rank, CoD.PlayMode.Aliens ) ) + end + if f8_local2.client then + f8_local3 = f8_arg0.getColumn( f7_local0.loadout ) + for f8_local4 = 1, 2, 1 do + f8_local3.children[f8_local4]:setImage( RegisterMaterial( f8_local0.GetFieldForPerk( f8_local0.GetPerkFromClient( f8_local2.client, f8_local4 - 1 ), f8_local0.AlienPerks.Cols.Icon ) ) ) + end + for f8_local4 = 3, 6, 1 do + f8_local3.children[f8_local4]:setImage( RegisterMaterial( f8_local0.GetFieldForAbility( f8_local0.GetAbilityFromClient( f8_local2.client, f8_local0.AlienAbilities.Types[f8_local4 - 2] ), f8_local0.AlienAbilities.Cols.Icon ) ) ) + end + end + end + + f7_local2:registerEventHandler( "refresh_scoreboard", function ( element, event ) + local f9_local0 = Game.GetPlayerTeam() + if GameX.IsSpectatingNotOnTeam() then + f9_local0 = spectatorFakeTeam + end + local f9_local1 = Game.GetNumPlayersOnTeam( f9_local0 ) + for f9_local2 = f9_local1 + 1, f7_local2.player_rows, 1 do + local f9_local5 = f9_local2 + f7_local2.popRow() + f7_local2.player_rows = f7_local2.player_rows - 1 + end + for f9_local2 = f7_local2.player_rows + 1, f9_local1, 1 do + f7_local2.player_rows = f7_local2.player_rows + 1 + local f9_local6 = { + { + text = "", + textOffset = 55, + align = LUI.Alignment.Left, + marquee = true + }, + {}, + { + text = "" + } + } + if not f7_local1 then + table.insert( f9_local6, { + text = "" + } ) + end + local f9_local7 = f7_local2.addRow( bgPalette.Dark, f9_local6 ) + f9_local7.rank = f9_local2 + f9_local7:registerEventHandler( "refresh_scoreboard_row", f7_local5 ) + local f9_local8 = f9_local7.getColumn( f7_local0.name ) + + local rankText = LUI.UIText.new() + rankText.id = "rankText" + rankText:registerAnimationState( "default", { + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 4, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + left = 0, + width = 20 + } ) + rankText:animateToState( "default" ) + f9_local8:addElement( rankText ) + f9_local8.rankText = rankText + + local f9_local10 = 23 + + local rankIcon = LUI.UIImage.new() + rankIcon.id = "rankIcon" + rankIcon:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 2, + height = f9_local10, + left = 20, + width = f9_local10 + } ) + rankIcon:animateToState( "default" ) + f9_local8:addElement( rankIcon ) + f9_local8.rankIcon = rankIcon + + local f9_local12 = f9_local7.getColumn( f7_local0.loadout ) + local f9_local13 = 23 + f9_local12.children = {} + for f9_local14 = 1, 6, 1 do + local f9_local17 = LUI.UIImage.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 2, + height = f9_local13, + left = 4 + (f9_local13 + 1) * (f9_local14 - 1), + width = f9_local13 + } ) + f9_local17.id = "icon_" .. f9_local14 + f9_local17:registerAnimationState( "hidden", { + alpha = 0 + } ) + if f7_local1 and f9_local14 < 5 then + f9_local17:animateToState( "hidden" ) + end + f9_local12:addElement( f9_local17 ) + table.insert( f9_local12.children, f9_local17 ) + end + end + local f9_local2 = { + ranks = {} + } + for f9_local3 = 1, f7_local2.player_rows, 1 do + f9_local2.ranks[f9_local3] = Game.GetPlayerScoreInfoAtRank( f9_local0, f9_local3 ) + end + element:processEvent( { + name = "refresh_scoreboard_row", + data = f9_local2 + } ) + end ) + f7_local2:processEvent( { + name = "refresh_scoreboard" + } ) + return f7_local2 +end + +function hive_bonus_scoreboard_internal() + local f10_local0 = table_factory( 21, { + 240, + 110 + }, 4 ) + f10_local0.id = "hive_bonus_scoreboard_internal" + f10_local0:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + width = 350, + height = 0, + alpha = 0 + } ) + f10_local0:registerAnimationState( "animating", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + right = -20, + width = 350, + height = 0, + alpha = 1 + } ) + f10_local0:registerAnimationState( "open", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + width = 350, + height = 0 + } ) + f10_local0:animateToState( "open" ) + if not Engine.UsingSplitscreenUpscaling() then + f10_local0.addHeader( Engine.Localize( "@ALIENS_ROUND_SCORE_CAPS" ) ) + end + local f10_local1 = 8 + local f10_local2, f10_local3 = nil + for f10_local4 = 1, f10_local1, 1 do + local f10_local7 = Game.GetOmnvar( "ui_alien_encounter_title_row_" .. f10_local4 ) + local f10_local8 = Game.GetOmnvar( "ui_alien_encounter_score_row_" .. f10_local4 ) + if f10_local7 then + if f10_local7 <= 0 then + break + end + f10_local7 = Engine.TableLookup( ScoreboardLUT.File, ScoreboardLUT.Cols.Ref, f10_local7, ScoreboardLUT.Cols.String ) + local f10_local9 = bgPalette.Dark + local f10_local10 = Colors.alien_scoreboard_dull_grey + local f10_local11 = Colors.alien_scoreboard_dull_grey + if f10_local4 == f10_local1 or Game.GetOmnvar( "ui_alien_encounter_title_row_" .. f10_local4 + 1 ) <= 0 then + f10_local9 = bgPalette.DarkUniform + f10_local10 = Colors.white + f10_local11 = Colors.frontend_hilite + elseif f10_local4 == f10_local1 - 1 or Game.GetOmnvar( "ui_alien_encounter_title_row_" .. f10_local4 + 2 ) <= 0 then + f10_local9 = bgPalette.BrightUniform + f10_local10 = Colors.black + f10_local11 = Colors.black + end + local f10_local12 = f10_local0.addRow( f10_local9, { + { + text = Engine.Localize( f10_local7 ), + color = f10_local10 + }, + { + text = f10_local8, + color = f10_local11 + } + }, true ) + if f10_local7 == "ALIEN_COLLECTIBLES_BONUS_MONEY_EARNED" then + f10_local2 = f10_local12 + f10_local3 = f10_local8 + end + end + end + if f10_local2 and f10_local3 then + local f10_local4 = f10_local2.getColumn( 2 ) + local self = LUI.UIText.new() + self.id = "animatedMoney" + self:setText( f10_local3 ) + self:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Right, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 10, + top = 0, + right = -10, + height = CoD.TextSettings.SmallFont.Height + } ) ) + self:animateToState( "default" ) + self:registerAnimationState( "moved", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = -90, + top = 300, + right = -110, + height = 0 + } ) + f10_local4:addElement( self ) + local f10_local6 = MBh.AnimateSequence( { + { + "default", + 4000 + }, + { + "moved", + 1200, + true, + true + } + } ) + f10_local6( self, {} ) + end + f10_local4 = LUI.UITimer.new( 11000, { + name = "kill_hive_scoreboard", + dispatchChildren = true + }, nil, true, f10_local0, false ) + f10_local0:addElement( f10_local4 ) + f10_local4.id = "exitTimer" + f10_local0:registerEventHandler( "kill_hive_scoreboard", function ( element, event ) + local f11_local0 = MBh.AnimateSequence( { + { + "animating", + 200, + true, + true + }, + { + "default", + 200, + true, + false + } + } ) + f11_local0( element, {} ) + element:addEventHandler( LUI.FormatAnimStateFinishEvent( "default" ), function ( f12_arg0, f12_arg1 ) + f12_arg0:close() + end ) + end ) + return f10_local0 +end + +function hive_bonus_scoreboard() + local self = LUI.UIElement.new() + self.id = "hive_bonus_scoreboard" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + self:registerOmnvarHandler( "ui_alien_show_encounter_score", function ( f14_arg0, f14_arg1 ) + if f14_arg1.value then + f14_arg0:closeChildren() + f14_arg0.board = hive_bonus_scoreboard_internal() + f14_arg0:addElement( f14_arg0.board ) + end + end ) + return self +end + +function end_game_tally() + if LUI.mp_menus.Aliens.IsChaosMode() then + return LUI.MenuBuilder.BuildRegisteredType( "chaos_event_recap" ) + end + local f15_local0 = { + "ALIEN_COLLECTIBLES_MISSION_WIN", + "ALIEN_COLLECTIBLES_MISSION_FAIL" + } + local f15_local1 = { + "ALIEN_COLLECTIBLES_MISSION_WIN_ALL_ESCAPE", + "ALIEN_COLLECTIBLES_MISSION_WIN_CASUALTY", + "ALIEN_COLLECTIBLES_MISSION_FAIL_ESCAPE", + "ALIEN_COLLECTIBLES_MISSION_FAIL_DRILL_DESTROYED", + "ALIEN_COLLECTIBLES_MISSION_FAIL_KILLED_IN_ACTION", + "ALIEN_COLLECTIBLES_MISSION_FAIL_HOST_END", + "ALIEN_PICKUPS_BEACON_GAS_FAIL", + "MP_ALIEN_LAST_GENERATOR_DESTROYED" + } + local self = LUI.UIElement.new() + self.id = "end_game_tally" + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -200, + top = -140, + width = 400, + height = 0 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + local f15_local3 = f15_local0[Game.GetOmnvar( "ui_round_end_title" )] + local f15_local4 = LUI.UIText.new() + f15_local4.id = "game_outcome" + f15_local4:setTextStyle( CoD.TextStyle.OutlinedMore ) + f15_local4:registerAnimationState( "default", { + font = CoD.TextSettings.HudIW6ExtraBigFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = -200, + top = 0, + right = 0, + height = CoD.TextSettings.HudIW6ExtraBigFont.Height, + alpha = 0 + } ) + f15_local4:registerAnimationState( "open", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 0, + right = 0, + height = CoD.TextSettings.HudIW6ExtraBigFont.Height, + alpha = 1 + } ) + f15_local4:animateToState( "default" ) + f15_local4:animateToState( "open", 200, false, true ) + if f15_local3 then + f15_local4:setText( Engine.Localize( f15_local3 ) ) + end + self:addElement( f15_local4 ) + local f15_local5 = f15_local1[Game.GetOmnvar( "ui_round_end_reason" )] + local f15_local6 = LUI.UIText.new() + f15_local6.id = "reason" + f15_local6:setTextStyle( CoD.TextStyle.Outlined ) + f15_local6:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 40, + right = 200, + height = CoD.TextSettings.BoldFont.Height, + alpha = 0 + } ) ) + f15_local6:registerAnimationState( "open", CoD.ColorizeState( Colors.frontend_hilite, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 40, + right = 0, + height = CoD.TextSettings.BoldFont.Height, + alpha = 1 + } ) ) + f15_local6:animateToState( "default" ) + f15_local6:animateToState( "open", 200, false, true ) + if f15_local5 then + f15_local6:setText( Engine.Localize( f15_local5 ) ) + end + self:addElement( f15_local6 ) + local f15_local7 = table_factory( 21, { + 300, + 100 + }, 4 ) + f15_local7.id = "stats" + f15_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 100, + left = 0, + right = 0, + height = 0 + } ) + f15_local7:animateToState( "default" ) + self:addElement( f15_local7 ) + local f15_local8 = 7 + for f15_local9 = 1, f15_local8, 1 do + local f15_local12 = Game.GetOmnvar( "ui_alien_eog_title_row_" .. f15_local9 ) + local f15_local13 = Game.GetOmnvar( "ui_alien_eog_score_row_" .. f15_local9 ) + if f15_local12 then + if f15_local12 <= 0 then + break + end + f15_local12 = Engine.TableLookup( ScoreboardLUT.File, ScoreboardLUT.Cols.Ref, f15_local12, ScoreboardLUT.Cols.String ) + local f15_local14 = bgPalette.Dark + local f15_local15 = Colors.alien_scoreboard_dull_grey + local f15_local16 = Colors.alien_scoreboard_dull_grey + if f15_local9 == f15_local8 or Game.GetOmnvar( "ui_alien_eog_title_row_" .. f15_local9 + 1 ) <= 0 then + f15_local14 = bgPalette.BrightUniform + f15_local15 = Colors.black + f15_local16 = Colors.black + end + else + self:registerDvarHandler( "ui_game_state", function ( f16_arg0, f16_arg1 ) + if f16_arg1.value ~= "postgame" then + f16_arg0:animateToState( "hidden", 400 ) + end + end ) + return self + end + f15_local7.addRow( f15_local14, { + { + text = Engine.Localize( f15_local12 ), + color = f15_local15 + }, + { + text = f15_local13, + color = f15_local16 + } + }, true ) + end + self:registerDvarHandler( "ui_game_state", function ( f16_arg0, f16_arg1 ) + if f16_arg1.value ~= "postgame" then + f16_arg0:animateToState( "hidden", 400 ) + end + end ) + return self +end + +function end_game_scoreboard() + local f17_local0 = Engine.GetDvarString( "ui_mapname" ) + local f17_local1 = Game.GetOmnvar( "ui_alien_is_solo" ) + local f17_local2 = LUI.mp_menus.Aliens.IsChaosMode() + local f17_local3 = f17_local1 and f17_local2 + local self = LUI.UIElement.new() + self.id = "end_game_scoreboard" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f17_local5 = LUI.UIImage.new() + f17_local5.id = "bg_image_tint_id" + f17_local5:registerAnimationState( "default", CoD.ColorizeState( Colors.alien_frontend_hilite, { + material = RegisterMaterial( "box_alien_color_tint" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -200, + bottom = 200, + left = 0, + right = 0, + alpha = 0.2 + } ) ) + f17_local5:animateToState( "default" ) + self:addElement( f17_local5 ) + local f17_local6 = LUI.UIElement.new() + f17_local6.id = "letterbox" + f17_local6:setupLetterboxElement() + f17_local6:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f17_local6:animateToState( "default" ) + self:addElement( f17_local6 ) + local f17_local7 = Engine.UsingSplitscreenUpscaling() and 50 or 0 + local f17_local8 = LUI.UIElement.new() + f17_local8.id = "end_game_scoreboard" + f17_local8:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -512, + top = -160 + f17_local7, + width = 1024, + height = 256 + } ) + f17_local8:animateToState( "default" ) + f17_local6:addElement( f17_local8 ) + local f17_local9 = LUI.UIImage.new() + f17_local9.id = "background" + f17_local9:registerAnimationState( "default", { + material = RegisterMaterial( "box_white_gradient_bot" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 256, + bottom = -256, + left = 0, + right = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0.5 + } ) + f17_local9:animateToState( "default" ) + f17_local8:addElement( f17_local9 ) + local f17_local10 = table_row_factory( { + { + width = 1024, + text = Engine.Localize( "ALIENS_SCOREBOARD" ), + align = LUI.Alignment.Center, + fgColor = { + b = 0, + g = 0, + r = 0 + }, + bgColor = bgPalette.Bright.EvenRow.EvenCol + } + } ) + f17_local10:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + bottom = 0, + height = 24, + left = -512, + width = 1024 + } ) + f17_local10:animateToState( "default" ) + f17_local8:addElement( f17_local10 ) + local f17_local11 = "@ALIENS_END_GAME_A" + if f17_local2 then + f17_local11 = "@ALIENS_END_GAME_CHAOS" + elseif f17_local0 == "mp_alien_dlc3" then + f17_local11 = "@LUA_MENU_MP_END_GAME_DESCENT_A" + elseif f17_local0 == "mp_alien_last" then + f17_local11 = "@LUA_MENU_MP_END_GAME_EXODUS_A" + end + local f17_local12 + if f17_local2 then + f17_local12 = "hits" + if not f17_local12 then + + else + local f17_local13 = Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "alienSession", f17_local12 ) + local f17_local14 = LUI.UIText.new() + f17_local14.id = "titleMessage" + f17_local14:setText( Engine.Localize( f17_local11, f17_local13 ) ) + f17_local14:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 10, + right = 0, + height = CoD.TextSettings.ExtraBigFont.Height + } ) ) + f17_local14:animateToState( "default" ) + f17_local8:addElement( f17_local14 ) + local f17_local15 = LUI.UIText.new() + f17_local15.id = "statsMessage" + f17_local15:setText( Engine.Localize( "@ALIENS_END_GAME_B", Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "alienSession", "team_kills" ), Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "alienSession", "team_shots" ) ) ) + f17_local15:registerAnimationState( "default", CoD.ColorizeState( Colors.alien_frontend_hilite, { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 40, + right = 0, + height = CoD.TextSettings.SmallFont.Height + } ) ) + f17_local15:animateToState( "default" ) + f17_local8:addElement( f17_local15 ) + local f17_local16 = nil + if f17_local3 then + f17_local16 = table_factory( 28, { + 541, + 150, + 111, + 111, + 111 + } ) + elseif f17_local2 then + f17_local16 = table_factory( 28, { + 430, + 150, + 111, + 111, + 111, + 111 + } ) + elseif f17_local1 then + f17_local16 = table_factory( 28, { + 430, + 120, + 99, + 110, + 165, + 100 + } ) + else + f17_local16 = table_factory( 28, { + 430, + 100, + 79, + 90, + 90, + 145, + 90 + } ) + end + f17_local16:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 80, + left = 0, + right = 0, + height = 0 + } ) + f17_local16:animateToState( "default" ) + f17_local8:addElement( f17_local16 ) + local f17_local17 = { + r = Colors.alien_tech_tree_bright_grey.r, + g = Colors.alien_tech_tree_bright_grey.g, + b = Colors.alien_tech_tree_bright_grey.b, + a = 0.5 + } + local f17_local18 = { + { + text = Engine.Localize( "@ALIENS_PLAYER_CAPS" ), + color = f17_local17 + }, + { + text = Engine.Localize( "@ALIENS_SCORE_CAPS" ), + color = f17_local17 + }, + { + text = Engine.Localize( "@ALIENS_KILLS_CAPS" ), + color = f17_local17 + } + } + if not f17_local1 then + table.insert( f17_local18, { + text = Engine.Localize( "@ALIENS_ASSISTS_CAPS" ), + color = f17_local17 + } ) + end + table.insert( f17_local18, { + text = Engine.Localize( "@ALIENS_REVIVES_CAPS" ), + color = f17_local17 + } ) + if not f17_local2 then + table.insert( f17_local18, { + text = Engine.Localize( "@ALIENS_DRILL_REPAIRS_CAPS" ), + color = f17_local17 + } ) + end + table.insert( f17_local18, { + text = Engine.Localize( "@ALIENS_DOWNS_CAPS" ), + color = f17_local17 + } ) + f17_local16.addRow( bgPalette.Dark, f17_local18 ) + local f17_local19 = Game.GetPlayerTeam() + if GameX.IsSpectatingNotOnTeam() then + f17_local19 = spectatorFakeTeam + end + local f17_local20 = Game.GetNumPlayersOnTeam( f17_local19 ) + local f17_local21 = Game.GetPlayerScoreRanking() + local f17_local22 = LUI.mp_menus.Aliens + for f17_local23 = 1, f17_local20, 1 do + local f17_local26 = Game.GetPlayerScoreInfoAtRank( f17_local19, f17_local23 ) + local f17_local27 + if f17_local23 == f17_local21 then + f17_local27 = Colors.white + if not f17_local27 then + + else + local f17_local28 = {} + local f17_local29 = { + text = f17_local26.name, + textOffset = 50 + } + local f17_local30 + if f17_local23 == f17_local21 then + f17_local30 = Colors.alien_frontend_hilite + if not f17_local30 then + + else + f17_local29.color = f17_local30 + f17_local30 = { + text = f17_local22.GetScoreFromClient( f17_local26.client ), + color = f17_local27 + } + local f17_local31 = { + text = f17_local22.GetKillsFromClient( f17_local26.client ), + color = f17_local27 + } + f17_local28[1] = f17_local29 + f17_local28[2] = f17_local30 + f17_local28[3] = f17_local31 + if not f17_local1 then + table.insert( f17_local28, { + text = f17_local22.GetAssistsFromClient( f17_local26.client ), + color = f17_local27 + } ) + end + table.insert( f17_local28, { + text = f17_local22.GetRevivesFromClient( f17_local26.client ), + color = f17_local27 + } ) + if not f17_local2 then + table.insert( f17_local28, { + text = f17_local22.GetDrillRestartsFromClient( f17_local26.client ), + color = f17_local27 + } ) + end + table.insert( f17_local28, { + text = f17_local22.GetDownsFromClient( f17_local26.client ), + color = f17_local27 + } ) + f17_local29 = f17_local16.addRow( bgPalette.Dark, f17_local28 ) + if f17_local26.rankIcon and f17_local26.rank then + f17_local30 = f17_local29.getColumn( 1 ) + f17_local31 = LUI.UIText.new() + f17_local31.id = "rankText" + f17_local31:registerAnimationState( "default", { + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 4, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + left = -5, + width = 20 + } ) + f17_local31:animateToState( "default" ) + f17_local30:addElement( f17_local31 ) + local f17_local32 = 23 + local f17_local33 = LUI.UIImage.new() + f17_local33.id = "rankIcon" + f17_local33:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 2, + height = f17_local32, + left = 15, + width = f17_local32 + } ) + f17_local33:animateToState( "default" ) + f17_local30:addElement( f17_local33 ) + f17_local33:setImage( f17_local26.rankIcon ) + f17_local31:setText( Rank.GetRankDisplay( f17_local26.rank, CoD.PlayMode.Aliens ) ) + end + end + end + f17_local30 = Colors.alien_scoreboard_bright_grey + end + end + f17_local27 = Colors.alien_scoreboard_dull_grey + end + return self + end + end + f17_local12 = "team_hives" +end + +LUI.MenuBuilder.registerType( "roundEndHudDef", end_game_tally ) +LUI.MenuBuilder.registerType( "scoreboard", end_game_scoreboard ) +LockTable( _M ) diff --git a/lui/mp_hud/alienvanguardoverlayhud.dec.lua b/lui/mp_hud/alienvanguardoverlayhud.dec.lua new file mode 100644 index 0000000..b730bf7 --- /dev/null +++ b/lui/mp_hud/alienvanguardoverlayhud.dec.lua @@ -0,0 +1,624 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + if f1_arg1.value == 1 then + local f1_local0 = f1_arg0:getChildById( "vanguardWarning" ) + f1_local0:animateToState( "default", 0 ) + f1_local0.isBlinking = nil + f1_arg0:animateToState( "active", 100 ) + local f1_local1 = f1_arg0:getChildById( "vanguardReticleImageId" ) + f1_local1:animateToState( "active", 100 ) + local f1_local2 = f1_arg0:getChildById( "vanguardStaticId" ) + f1_local2:animateToState( "default", 100 ) + local f1_local3 = f1_arg0:getChildById( "bar1" ) + if not f1_local3.spinning then + local f1_local4 = MBh.AnimateLoop( { + { + "blink_on", + 1000 + }, + { + "blink_off", + 500 + }, + { + "blink_off", + 500 + } + } ) + f1_local4( f1_local3 ) + f1_local3.spinning = true + end + elseif f1_arg1.value >= 2 then + local f1_local0 = f1_arg0:getChildById( "vanguardStaticId" ) + local f1_local1 = f1_arg0:getChildById( "vanguardReticleImageId" ) + local f1_local2 = f1_arg0:getChildById( "vanguardWarning" ) + if f1_arg1.value >= 10 then + f1_local0:animateToState( "active10", 200 ) + f1_local1:animateToState( "default", 0 ) + elseif f1_arg1.value >= 9 then + f1_local0:animateToState( "active9", 200 ) + f1_local1:animateToState( "default", 0 ) + elseif f1_arg1.value >= 8 then + f1_local0:animateToState( "active8", 200 ) + f1_local1:animateToState( "default", 0 ) + elseif f1_arg1.value >= 7 then + f1_local0:animateToState( "active7", 200 ) + f1_local1:animateToState( "default", 0 ) + elseif f1_arg1.value >= 6 then + f1_local0:animateToState( "active6", 200 ) + f1_local1:animateToState( "active", 0 ) + elseif f1_arg1.value >= 5 then + f1_local0:animateToState( "active5", 200 ) + f1_local1:animateToState( "active", 0 ) + elseif f1_arg1.value >= 4 then + f1_local0:animateToState( "active4", 200 ) + f1_local1:animateToState( "active", 0 ) + elseif f1_arg1.value >= 3 then + f1_local0:animateToState( "active3", 200 ) + f1_local1:animateToState( "active", 0 ) + else + f1_local0:animateToState( "active2", 200 ) + f1_local1:animateToState( "active", 0 ) + if not f1_local2.isBlinking then + f1_local2.isBlinking = true + local f1_local3 = MBh.AnimateLoop( { + { + "showing", + 500 + }, + { + "blink", + 500 + } + } ) + f1_local3( f1_local2 ) + end + end + else + f1_arg0:animateToState( "default", 0 ) + local f1_local0 = f1_arg0:getChildById( "vanguardStaticId" ) + f1_local0:animateToState( "default", 0 ) + end +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0:getChildById( "vanguardHeadingId" ) + f2_local0:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_HEADING_LABEL", Game.GetOmnvar( "ui_vanguard_heading" ) ) ) + local f2_local1 = f2_arg0:getChildById( "vanguardAltitudeId" ) + f2_local1:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_ALT_LABEL", Game.GetOmnvar( "ui_vanguard_altitude" ) ) ) + local f2_local2 = f2_arg0:getChildById( "vanguardRangeId" ) + f2_local2:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_RANGE", Game.GetOmnvar( "ui_vanguard_range" ) ) ) +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0:getChildById( "vanguardWeaponId" ) + local f3_local1 = "@MP_ALIEN_DESCENT_VANGUARD_WEAPON_STATUS_READY" + if f3_arg1.value < 0 then + f3_local1 = "@MP_ALIEN_DESCENT_VANGUARD_WEAPON_STATUS_RELOAD" + local f3_local2 = f3_arg0:getChildById( "vanguardOverlayImageId" ) + local f3_local3 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 100 + }, + { + "default", + 500 + } + } ) + f3_local3( f3_local2 ) + f3_local0:animateToState( "reload", 0 ) + else + f3_local0:animateToState( "default", 0 ) + end + f3_local0:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_WEAPON_STATUS_LABEL", Engine.Localize( f3_local1 ) ) ) +end + +local f0_local3 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0:getChildById( "vanguardHealthId" ) + f4_local0:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_HEALTH", f4_arg1.value ) ) + if f4_arg1.value < 25 then + f4_local0:animateToState( "near_death", 0 ) + elseif f4_arg1.value < 50 then + f4_local0:animateToState( "damaged", 0 ) + else + f4_local0:animateToState( "default", 0 ) + end +end + +local f0_local4 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0:getChildById( "vanguardControlsVLId" ) + local f5_local1 = f5_local0:getChildById( "steeringTextId" ) + local f5_local2 = f5_local0:getChildById( "steeringText2Id" ) + local f5_local3 = f5_local0:getChildById( "fireTextId" ) + if CoD.UsingController() then + f5_local1:setText( Engine.Localize( "@MP_ALIEN_DESCENT_REMOTE_UAV_ASCEND" ) ) + f5_local2:setText( Engine.Localize( "@MP_ALIEN_DESCENT_REMOTE_UAV_DESCEND" ) ) + else + f5_local1:setText( Engine.Localize( "@PLATFORM_REMOTE_UAV_ASCEND" ) ) + f5_local2:setText( Engine.Localize( "@PLATFORM_REMOTE_UAV_DESCEND" ) ) + end + f5_local3:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_FIRE" ) ) +end + +function alienVanguardOverlayDef() + local f6_local0 = RegisterMaterial( "ac130_overlay_grain" ) + local f6_local1 = RegisterMaterial( "gryphon_hud_mp_alien" ) + local f6_local2 = RegisterMaterial( "white" ) + local f6_local3, f6_local4 = GameX.GetScreenDims() + local f6_local5, f6_local6 = nil + local self = LUI.UIElement.new() + self.id = "vanguardOverlayContainerId" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f6_local8 = LUI.UIElement.new() + f6_local8.id = "vanguardOverlayMainElemId" + f6_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + } ) + f6_local8:animateToState( "default", 0 ) + f6_local8:registerAnimationState( "active", { + alpha = 1 + } ) + f6_local8:registerOmnvarHandler( "ui_vanguard", f0_local0 ) + f6_local8:registerEventHandler( "init_overlay", f0_local0 ) + f6_local8:registerEventHandler( "refresh_controls", f0_local4 ) + f6_local8:registerOmnvarHandler( "ui_vanguard_heading", f0_local1 ) + f6_local8:registerOmnvarHandler( "ui_vanguard_ammo", f0_local2 ) + f6_local8:registerOmnvarHandler( "ui_vanguard_health", f0_local3 ) + local f6_local9 = LUI.UIImage.new() + f6_local9.id = "vanguardOverlayImageId" + f6_local9:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f6_local0, + red = 0.9, + green = 1, + blue = 1, + alpha = 0.45 + } ) + f6_local9:animateToState( "default", 0 ) + f6_local9:registerAnimationState( "active", { + alpha = 1 + } ) + f6_local8:addElement( f6_local9 ) + local f6_local10 = LUI.UIImage.new() + f6_local10.id = "vanguardReticleImageId" + f6_local10:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f6_local1, + alpha = 0 + } ) + f6_local10:animateToState( "default", 0 ) + f6_local10:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f6_local1, + alpha = 1 + } ) + f6_local8:addElement( f6_local10 ) + local f6_local11 = LUI.UIText.new() + f6_local11.id = "vanguardWarning" + f6_local11:setText( Engine.Localize( "@MP_ALIEN_DESCENT_REMOTE_UAV_OUT_OF_RANGE" ) ) + f6_local11:setTextStyle( CoD.TextStyle.None ) + f6_local11:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 256, + height = CoD.TextSettings.HudEuroBigFont.Height, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.red.r, + green = Colors.red.g, + blue = Colors.red.b, + alpha = 0 + } ) + f6_local11:animateToState( "default", 0 ) + f6_local11:registerAnimationState( "showing", { + red = Colors.red.r, + alpha = 1 + } ) + f6_local11:registerAnimationState( "blink", { + red = 0.5, + alpha = 0.5 + } ) + if not MLG.IsMLGSpectator() then + f6_local6 = LUI.UIHorizontalList.new() + f6_local6.id = "vanguardControlsVLId" + f6_local6:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -66, + left = -384, + right = 384, + height = 64, + alpha = 1, + spacing = 0 + } ) + f6_local6:animateToState( "default", 0 ) + local f6_local12 = LUI.UIText.new() + f6_local12.id = "steeringTextId" + local f6_local13 = nil + if CoD.UsingController() then + f6_local13 = "@MP_ALIEN_DESCENT_REMOTE_UAV_ASCEND" + else + f6_local13 = "@PLATFORM_REMOTE_UAV_ASCEND" + end + f6_local12:setText( Engine.Localize( f6_local13 ) ) + f6_local12:setTextStyle( CoD.TextStyle.Shadowed ) + f6_local12:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + width = 192, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center + } ) + f6_local12:animateToState( "default", 0 ) + local f6_local14 = LUI.UIText.new() + f6_local14.id = "steeringText2Id" + if CoD.UsingController() then + f6_local13 = "@MP_ALIEN_DESCENT_REMOTE_UAV_DESCEND" + else + f6_local13 = "@PLATFORM_REMOTE_UAV_DESCEND" + end + f6_local14:setText( Engine.Localize( f6_local13 ) ) + f6_local14:setTextStyle( CoD.TextStyle.Shadowed ) + f6_local14:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + width = 192, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center + } ) + f6_local14:animateToState( "default", 0 ) + local f6_local15 = LUI.UIText.new() + f6_local15.id = "fireTextId" + if Engine.IsConsoleGame() then + f6_local15:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_ALT_FIRE" ) ) + else + f6_local15:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_ALT_FIRE_PC" ) ) + end + f6_local15:setTextStyle( CoD.TextStyle.Shadowed ) + f6_local15:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + width = 192, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center + } ) + f6_local15:animateToState( "default", 0 ) + local f6_local16 = LUI.UIText.new() + f6_local16.id = "missileTextId" + f6_local16:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_LAUNCH_MISSILE" ) ) + f6_local16:setTextStyle( CoD.TextStyle.Shadowed ) + f6_local16:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + width = 192, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center + } ) + f6_local16:animateToState( "default", 0 ) + f6_local6:addElement( f6_local14 ) + f6_local6:addElement( f6_local15 ) + f6_local6:addElement( f6_local16 ) + f6_local6:addElement( f6_local12 ) + end + if not MLG.IsMLGSpectator() then + f6_local5 = LUI.UIText.new() + f6_local5.id = "vanguardTitleId" + f6_local5:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_TITLE" ) ) + f6_local5:setTextStyle( CoD.TextStyle.None ) + f6_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 72, + left = 130, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f6_local5:animateToState( "default", 0 ) + f6_local8:addElement( f6_local5 ) + end + local f6_local12 = RegisterMaterial( "apache_ammo_mp" ) + local f6_local13 = LUI.UIImage.new() + f6_local13.id = "bar1" + f6_local13:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 72, + right = 128, + height = 16, + width = 16, + material = f6_local12, + alpha = 1, + zRot = 90 + } ) + f6_local13:animateToState( "default", 0 ) + f6_local13:registerAnimationState( "blink_on", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f6_local13:registerAnimationState( "blink_off", { + red = Colors.grey_2.r, + green = Colors.grey_2.g, + blue = Colors.grey_2.b, + alpha = 0.25 + } ) + f6_local8:addElement( f6_local13 ) + f6_local5 = LUI.UIText.new() + f6_local5.id = "vanguardFlightModeId" + f6_local5:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_FLIGHT_MODE" ) ) + f6_local5:setTextStyle( CoD.TextStyle.None ) + f6_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -144, + left = 160, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f6_local5:animateToState( "default", 0 ) + f6_local8:addElement( f6_local5 ) + f6_local5 = LUI.UIText.new() + f6_local5.id = "vanguardHeadingId" + f6_local5:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_HEADING_LABEL" ) ) + f6_local5:setTextStyle( CoD.TextStyle.None ) + f6_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -122, + left = 160, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f6_local5:animateToState( "default", 0 ) + f6_local8:addElement( f6_local5 ) + f6_local5 = LUI.UIText.new() + f6_local5.id = "vanguardAltitudeId" + f6_local5:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_ALT_LABEL" ) ) + f6_local5:setTextStyle( CoD.TextStyle.None ) + f6_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -100, + left = 160, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f6_local5:animateToState( "default", 0 ) + f6_local8:addElement( f6_local5 ) + f6_local5 = LUI.UIText.new() + f6_local5.id = "vanguardWeaponId" + f6_local5:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_WEAPON_STATUS_LABEL", Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_WEAPON_STATUS_READY" ) ) ) + f6_local5:setTextStyle( CoD.TextStyle.None ) + f6_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -144, + right = -165, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 1, + blue = 0, + alpha = 1 + } ) + f6_local5:animateToState( "default", 0 ) + f6_local5:registerAnimationState( "reload", { + red = 1, + green = 0, + blue = 0 + } ) + f6_local8:addElement( f6_local5 ) + f6_local5 = LUI.UIText.new() + f6_local5.id = "vanguardRangeId" + f6_local5:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_RANGE", 0 ) ) + f6_local5:setTextStyle( CoD.TextStyle.None ) + f6_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -122, + right = -165, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f6_local5:animateToState( "default", 0 ) + f6_local8:addElement( f6_local5 ) + f6_local5 = LUI.UIText.new() + f6_local5.id = "vanguardHealthId" + f6_local5:setText( Engine.Localize( "@MP_ALIEN_DESCENT_VANGUARD_HEALTH", 100 ) ) + f6_local5:setTextStyle( CoD.TextStyle.None ) + f6_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -100, + right = -165, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 1, + blue = 0, + alpha = 1 + } ) + f6_local5:animateToState( "default", 0 ) + f6_local5:registerAnimationState( "damaged", { + red = 1, + green = 1, + blue = 0 + } ) + f6_local5:registerAnimationState( "near_death", { + red = 1, + green = 0, + blue = 0 + } ) + f6_local8:addElement( f6_local5 ) + local f6_local14 = LUI.UIElement.new() + f6_local14.id = "vanguardStaticId" + f6_local14:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + } ) + f6_local14:animateToState( "default", 0 ) + f6_local14:registerAnimationState( "active", { + alpha = 0.1 + } ) + f6_local14:registerAnimationState( "active2", { + alpha = 0.2 + } ) + f6_local14:registerAnimationState( "active3", { + alpha = 0.3 + } ) + f6_local14:registerAnimationState( "active4", { + alpha = 0.4 + } ) + f6_local14:registerAnimationState( "active5", { + alpha = 0.5 + } ) + f6_local14:registerAnimationState( "active6", { + alpha = 0.6 + } ) + f6_local14:registerAnimationState( "active7", { + alpha = 0.7 + } ) + f6_local14:registerAnimationState( "active8", { + alpha = 0.8 + } ) + f6_local14:registerAnimationState( "active9", { + alpha = 0.9 + } ) + f6_local14:registerAnimationState( "active10", { + alpha = 1 + } ) + local f6_local15 = LUI.UIImage.new() + f6_local15.id = "vanguardWhiteImageId" + f6_local15:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f6_local2 + } ) + f6_local15:animateToState( "default", 0 ) + local f6_local16 = LUI.UIImage.new() + f6_local16.id = "vanguardStaticImageId" + f6_local16:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f6_local0 + } ) + f6_local16:animateToState( "default", 0 ) + f6_local14:addElement( f6_local15 ) + f6_local14:addElement( f6_local16 ) + if not MLG.IsMLGSpectator() then + f6_local8:addElement( f6_local6 ) + end + f6_local8:addElement( f6_local14 ) + f6_local8:addElement( f6_local11 ) + self:addElement( f6_local8 ) + return self +end + +LUI.MenuBuilder.registerType( "alienVanguardOverlayDef", alienVanguardOverlayDef ) +LockTable( _M ) diff --git a/lui/mp_hud/capturinghud.dec.lua b/lui/mp_hud/capturinghud.dec.lua new file mode 100644 index 0000000..e12c1d3 --- /dev/null +++ b/lui/mp_hud/capturinghud.dec.lua @@ -0,0 +1,983 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 1 +f0_local1 = 64 * f0_local0 +f0_local2 = 256 * f0_local0 +local f0_local3 = 16 * f0_local0 +local f0_local4 = 210 * f0_local0 +local f0_local5 = 256 * f0_local0 +local f0_local6 = 16 * f0_local0 +local f0_local7 = 16 * f0_local0 +local f0_local8 = false +local f0_local9 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = f1_arg0 + local f1_local1 = f1_arg0:getFirstDescendentById( "capturing_bar" ) + local f1_local2 = f1_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + local f1_local3 = f1_arg0:getFirstDescendentById( "capturing_text" ) + local f1_local4 = f1_arg0:getFirstDescendentById( "capturing_bar_bg" ) + local f1_local5 = f1_arg0:getFirstDescendentById( "capturing_bar_hl" ) + local f1_local6 = f1_local5:getFirstDescendentById( "start_cap" ) + local f1_local7 = f1_local5:getFirstDescendentById( "middle" ) + local f1_local8 = f1_local5:getFirstDescendentById( "end_cap" ) + f0_local8 = false + if Game.GetOmnvar( "ui_securing_progress" ) >= 1 and not f0_local8 then + f0_local8 = true + end + if f1_local4.current_state ~= "default" then + f1_local4:animateToState( "default", 0 ) + f1_local4.current_state = "default" + end + if f0_local8 then + if f1_local1.current_state ~= "secured" then + local f1_local9 = MBh.AnimateSequence( { + { + "active", + 500 + }, + { + "blink_off", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_on", + 0 + }, + { + "blink_on", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_on", + 0 + }, + { + "blink_on", + 50 + }, + { + "blink_off", + 150 + } + } ) + f1_local9( f1_local1 ) + f1_local1.current_state = "secured" + end + if f1_local3.current_state ~= "secured" then + local f1_local9 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "secured", + 0 + } + } ) + f1_local9( f1_local3 ) + f1_local3.current_state = "secured" + end + if f1_local6.current_state ~= "secured" then + f1_local6:animateToState( "secured" ) + f1_local6.current_state = "secured" + end + if f1_local7.current_state ~= "secured" then + f1_local7:animateToState( "secured" ) + f1_local7.current_state = "secured" + end + if f1_local8.current_state ~= "secured" then + f1_local8:animateToState( "secured" ) + f1_local8.current_state = "secured" + end + else + if f1_local1.current_state ~= "default" then + f1_local1:animateToState( "default", 0 ) + f1_local1.current_state = "default" + end + if f1_local5.current_state ~= "default" then + f1_local5:animateToState( "default", 0 ) + f1_local5.current_state = "default" + end + if f1_local3.current_state ~= "default" then + f1_local3:animateToState( "default", 0 ) + f1_local3.current_state = "default" + end + if f1_local7.current_state ~= "default" then + f1_local7:animateToState( "default", 0 ) + f1_local7.current_state = "default" + end + end +end + +local f0_local10 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0 + local f2_local1 = f2_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + local f2_local2 = f2_arg0:getFirstDescendentById( "capturing_text" ) + local f2_local3 = f2_arg0:getFirstDescendentById( "capturing_bar_bg" ) + local f2_local4 = f2_arg0:getFirstDescendentById( "capturing_bar_hl" ) + local f2_local5 = f2_local4:getFirstDescendentById( "start_cap" ) + local f2_local6 = f2_local4:getFirstDescendentById( "middle" ) + local f2_local7 = f2_local4:getFirstDescendentById( "end_cap" ) + local f2_local8 = f2_local1.value + local f2_local9 = "" + if f2_local8 == 0 then + LUI.UITimer.Stop( f2_local1 ) + return + elseif f2_local8 == 1 then + f2_local9 = Engine.Localize( "@KILLSTREAKS_CAPTURING_CRATE" ) + elseif f2_local8 == 2 then + f2_local9 = Engine.Localize( "@LUA_MENU_ACQUIRING_INTEL" ) + elseif f2_local8 == 3 then + f2_local9 = Engine.Localize( "@KILLSTREAKS_BOX_GETTING_VEST" ) + elseif f2_local8 == 4 then + f2_local9 = Engine.Localize( "@KILLSTREAKS_DEPLOYABLE_AMMO_TAKING" ) + elseif f2_local8 == 5 then + f2_local9 = Engine.Localize( "@MPUI_REVIVING" ) + elseif f2_local8 == 6 then + f2_local9 = Engine.Localize( "@MPUI_BEING_REVIVED" ) + elseif f2_local8 == 7 then + f2_local9 = Engine.Localize( "@MP_BREACHING" ) + elseif f2_local8 == 8 then + f2_local9 = Engine.Localize( "@MP_PATCH_USING" ) + end + if f2_local0.current_state ~= "active" then + f2_local0:animateToState( "active", 250 ) + f2_local0.current_state = "active" + end + if f2_local3.current_state ~= "active" then + f2_local3:animateToState( "active", 250 ) + f2_local3.current_state = "active" + end + if f2_local4.current_state ~= "active" then + f2_local4:animateToState( "active", 250 ) + f2_local4.current_state = "active" + end + if f2_local5.current_state ~= "default" then + f2_local5:animateToState( "default" ) + f2_local5.current_state = "default" + end + if f2_local6.current_state ~= "default" then + f2_local6:animateToState( "default" ) + f2_local6.current_state = "default" + end + if f2_local7.current_state ~= "default" then + f2_local7:animateToState( "default" ) + f2_local7.current_state = "default" + end + if f2_local2.current_state ~= "securing" then + f2_local2:setText( f2_local9 ) + local f2_local10 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 0 + } + } ) + f2_local10( f2_local2 ) + f2_local2.current_state = "securing" + end + f2_local6:registerAnimationState( "move_bar", { + right = f2_local6.m_maxWidth * Game.GetOmnvar( "ui_securing_progress" ) + } ) + f2_local6:animateToState( "move_bar", 150 ) +end + +local f0_local11 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + if f3_arg1.value > 0 then + LUI.UITimer.Reset( f3_local0 ) + else + LUI.UITimer.Stop( f3_local0 ) + f0_local9( f3_arg0, f3_arg1 ) + end + f3_local0.value = f3_arg1.value +end + +local f0_local12 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0 + local f4_local1 = f4_arg0:getFirstDescendentById( "capturing_bar" ) + local f4_local2 = f4_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + local f4_local3 = f4_arg0:getFirstDescendentById( "capturing_text" ) + local f4_local4 = f4_arg0:getFirstDescendentById( "capturing_bar_bg" ) + local f4_local5 = f4_arg0:getFirstDescendentById( "capturing_bar_hl" ) + local f4_local6 = f4_local5:getFirstDescendentById( "start_cap" ) + local f4_local7 = f4_local5:getFirstDescendentById( "middle" ) + local f4_local8 = f4_local5:getFirstDescendentById( "end_cap" ) + local f4_local9 = f4_local2.value + local f4_local10 = "" + if f4_local9 == 1 then + f4_local10 = Engine.Localize( "@LUA_MENU_SECURED_A" ) + elseif f4_local9 == 2 then + f4_local10 = Engine.Localize( "@LUA_MENU_SECURED_B" ) + elseif f4_local9 == 3 then + f4_local10 = Engine.Localize( "@LUA_MENU_SECURED_C" ) + end + f0_local8 = false + if 1 <= Game.GetOmnvar( "ui_dom_progress" ) and not f0_local8 then + f0_local8 = true + end + if f4_local4.current_state ~= "default" then + f4_local4:animateToState( "default", 0 ) + f4_local4.current_state = "default" + end + if f0_local8 and f4_arg1.name ~= "playerstate_client_changed" then + if f4_local1.current_state ~= "secured" then + local f4_local11 = MBh.AnimateSequence( { + { + "active", + 500 + }, + { + "blink_off", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_on", + 0 + }, + { + "blink_on", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_on", + 0 + }, + { + "blink_on", + 50 + }, + { + "blink_off", + 150 + } + } ) + f4_local11( f4_local1 ) + f4_local1.current_state = "secured" + end + if f4_local3.current_text ~= f4_local10 and f4_local10 ~= "" then + f4_local3:setText( f4_local10 ) + f4_local3.current_text = f4_local10 + end + if f4_local3.current_state ~= "secured" then + local f4_local11 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "secured", + 0 + } + } ) + f4_local11( f4_local3 ) + f4_local3.current_state = "secured" + end + if f4_local6.current_state ~= "secured" then + f4_local6:animateToState( "secured" ) + f4_local6.current_state = "secured" + end + if f4_local7.current_state ~= "secured" then + f4_local7:animateToState( "secured" ) + f4_local7.current_state = "secured" + end + if f4_local8.current_state ~= "secured" then + f4_local8:animateToState( "secured" ) + f4_local8.current_state = "secured" + end + else + if f4_local1.current_state ~= "default" then + f4_local1:animateToState( "default", 0 ) + f4_local1.current_state = "default" + end + if f4_local5.current_state ~= "default" then + f4_local5:animateToState( "default", 0 ) + f4_local5.current_state = "default" + end + if f4_local3.current_state ~= "default" then + f4_local3:animateToState( "default", 0 ) + f4_local3.current_state = "default" + end + if f4_local7.current_state ~= "default" then + f4_local7:animateToState( "default", 0 ) + f4_local7.current_state = "default" + end + end +end + +local f0_local13 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0 + local f5_local1 = f5_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + local f5_local2 = f5_arg0:getFirstDescendentById( "capturing_text" ) + local f5_local3 = f5_arg0:getFirstDescendentById( "capturing_bar_bg" ) + local f5_local4 = f5_arg0:getFirstDescendentById( "capturing_bar_hl" ) + local f5_local5 = f5_local4:getFirstDescendentById( "start_cap" ) + local f5_local6 = f5_local4:getFirstDescendentById( "middle" ) + local f5_local7 = f5_local4:getFirstDescendentById( "end_cap" ) + local f5_local8 = f5_local1.value + local f5_local9 = "" + if f5_local8 == 0 then + LUI.UITimer.Stop( f5_local1 ) + return + elseif f5_local8 == 1 then + f5_local9 = Engine.Localize( "@LUA_MENU_SECURING_A" ) + elseif f5_local8 == 2 then + f5_local9 = Engine.Localize( "@LUA_MENU_SECURING_B" ) + elseif f5_local8 == 3 then + f5_local9 = Engine.Localize( "@LUA_MENU_SECURING_C" ) + end + if 0 < Game.GetOmnvar( "ui_dom_stalemate" ) then + if f5_local0.current_state ~= "active" then + f5_local0:animateToState( "active", 0 ) + f5_local0.current_state = "active" + end + if f5_local2.current_state ~= "contested" then + local f5_local10 = Engine.Localize( "@LUA_MENU_CONTESTED" ) + f5_local2:setText( f5_local10 ) + local f5_local11 = MBh.AnimateLoop( { + { + "contested", + 0 + }, + { + "contested_off_for_loop", + 500 + } + } ) + f5_local11( f5_local2 ) + f5_local2.current_state = "contested" + f5_local2.current_text = f5_local10 + end + if f5_local5.current_state ~= "contested" then + f5_local5:animateToState( "contested" ) + f5_local5.current_state = "contested" + end + if f5_local6.current_state ~= "contested" then + f5_local6:animateToState( "contested" ) + f5_local6.current_state = "contested" + end + if f5_local7.current_state ~= "contested" then + f5_local7:animateToState( "contested" ) + f5_local7.current_state = "contested" + end + else + if f5_local0.current_state ~= "active" then + f5_local0:animateToState( "active", 250 ) + f5_local0.current_state = "active" + end + if f5_local3.current_state ~= "active" then + f5_local3:animateToState( "active", 250 ) + f5_local3.current_state = "active" + end + if f5_local4.current_state ~= "active" then + f5_local4:animateToState( "active", 250 ) + f5_local4.current_state = "active" + end + if f5_local5.current_state ~= "default" then + f5_local5:animateToState( "default" ) + f5_local5.current_state = "default" + end + if f5_local6.current_state ~= "default" then + f5_local6:animateToState( "default" ) + f5_local6.current_state = "default" + end + if f5_local7.current_state ~= "default" then + f5_local7:animateToState( "default" ) + f5_local7.current_state = "default" + end + if f5_local2.current_text ~= f5_local9 then + f5_local2:setText( f5_local9 ) + f5_local2.current_text = f5_local9 + end + if f5_local2.current_state ~= "securing" then + local f5_local10 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 0 + } + } ) + f5_local10( f5_local2 ) + f5_local2.current_state = "securing" + end + f5_local6:registerAnimationState( "move_bar", { + right = f5_local6.m_maxWidth * Game.GetOmnvar( "ui_dom_progress" ) + } ) + f5_local6:animateToState( "move_bar", 150 ) + end +end + +local f0_local14 = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + if f6_arg1.value > 0 then + LUI.UITimer.Reset( f6_local0 ) + else + LUI.UITimer.Stop( f6_local0 ) + f0_local12( f6_arg0, f6_arg1 ) + end + f6_local0.value = f6_arg1.value +end + +local f0_local15 = function ( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0 + local f7_local1 = f7_arg0:getFirstDescendentById( "capturing_bar" ) + local f7_local2 = f7_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + local f7_local3 = f7_arg0:getFirstDescendentById( "capturing_text" ) + local f7_local4 = f7_arg0:getFirstDescendentById( "capturing_bar_bg" ) + local f7_local5 = f7_arg0:getFirstDescendentById( "capturing_bar_hl" ) + local f7_local6 = f7_local5:getFirstDescendentById( "start_cap" ) + local f7_local7 = f7_local5:getFirstDescendentById( "middle" ) + local f7_local8 = f7_local5:getFirstDescendentById( "end_cap" ) + local f7_local9 = f7_local2.value + local f7_local10 = "" + if f7_local9 == 1 then + f7_local10 = Engine.Localize( "@SPLASHES_PLANT" ) + elseif f7_local9 == 2 then + f7_local10 = Engine.Localize( "@SPLASHES_DEFUSE" ) + end + f0_local8 = false + if 1 <= Game.GetOmnvar( "ui_planting_defusing_progress" ) and not f0_local8 then + f0_local8 = true + end + if f7_local4.current_state ~= "default" then + f7_local4:animateToState( "default", 0 ) + f7_local4.current_state = "default" + end + if f0_local8 and f7_arg1.name ~= "playerstate_client_changed" then + if f7_local1.current_state ~= "secured" then + local f7_local11 = MBh.AnimateSequence( { + { + "active", + 500 + }, + { + "blink_off", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_on", + 0 + }, + { + "blink_on", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_on", + 0 + }, + { + "blink_on", + 50 + }, + { + "blink_off", + 150 + } + } ) + f7_local11( f7_local1 ) + f7_local1.current_state = "secured" + end + if f7_local3.current_state ~= "secured" then + f7_local3:setText( f7_local10 ) + local f7_local11 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "secured", + 0 + } + } ) + f7_local11( f7_local3 ) + f7_local3.current_state = "secured" + end + if f7_local6.current_state ~= "secured" then + f7_local6:animateToState( "secured" ) + f7_local6.current_state = "secured" + end + if f7_local7.current_state ~= "secured" then + f7_local7:animateToState( "secured" ) + f7_local7.current_state = "secured" + end + if f7_local8.current_state ~= "secured" then + f7_local8:animateToState( "secured" ) + f7_local8.current_state = "secured" + end + else + if f7_local1.current_state ~= "default" then + f7_local1:animateToState( "default", 0 ) + f7_local1.current_state = "default" + end + if f7_local5.current_state ~= "default" then + f7_local5:animateToState( "default", 0 ) + f7_local5.current_state = "default" + end + if f7_local3.current_state ~= "default" then + f7_local3:animateToState( "default", 0 ) + f7_local3.current_state = "default" + end + f7_local7:animateToState( "default", 0 ) + f7_local7.current_state = "default" + end +end + +local f0_local16 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = f8_arg0 + local f8_local1 = f8_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + local f8_local2 = f8_arg0:getFirstDescendentById( "capturing_text" ) + local f8_local3 = f8_arg0:getFirstDescendentById( "capturing_bar_bg" ) + local f8_local4 = f8_arg0:getFirstDescendentById( "capturing_bar_hl" ) + local f8_local5 = f8_local4:getFirstDescendentById( "start_cap" ) + local f8_local6 = f8_local4:getFirstDescendentById( "middle" ) + local f8_local7 = f8_local4:getFirstDescendentById( "end_cap" ) + local f8_local8 = f8_local1.value + local f8_local9 = "" + if isSecuring == 0 then + LUI.UITimer.Stop( f8_local1 ) + return + elseif f8_local8 == 1 then + f8_local9 = Engine.Localize( "@MP_PLANTING_EXPLOSIVE" ) + elseif f8_local8 == 2 then + f8_local9 = Engine.Localize( "@MP_DEFUSING_EXPLOSIVE" ) + end + if f8_local0.current_state ~= "active" then + f8_local0:animateToState( "active", 250 ) + f8_local0.current_state = "active" + end + if f8_local3.current_state ~= "active" then + f8_local3:animateToState( "active", 250 ) + f8_local3.current_state = "active" + end + if f8_local4.current_state ~= "active" then + f8_local4:animateToState( "active", 250 ) + f8_local4.current_state = "active" + end + if f8_local5.current_state ~= "default" then + f8_local5:animateToState( "default" ) + f8_local5.current_state = "default" + end + if f8_local6.current_state ~= "default" then + f8_local6:animateToState( "default" ) + f8_local6.current_state = "default" + end + if f8_local7.current_state ~= "default" then + f8_local7:animateToState( "default" ) + f8_local7.current_state = "default" + end + if f8_local2.current_state ~= "securing" then + f8_local2:setText( f8_local9 ) + local f8_local10 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 0 + } + } ) + f8_local10( f8_local2 ) + f8_local2.current_state = "securing" + end + f8_local6:registerAnimationState( "move_bar", { + width = f8_local6.m_maxWidth * Game.GetOmnvar( "ui_planting_defusing_progress" ) + } ) + f8_local6:animateToState( "move_bar", 150 ) +end + +local f0_local17 = function ( f9_arg0, f9_arg1 ) + local f9_local0 = f9_arg0:getFirstDescendentById( "capturing_refresh_timer" ) + if f9_arg1.value > 0 then + LUI.UITimer.Reset( f9_local0 ) + else + LUI.UITimer.Stop( f9_local0 ) + f0_local15( f9_arg0, f9_arg1 ) + end + f9_local0.value = f9_arg1.value +end + +local f0_local18 = function ( f10_arg0 ) + local f10_local0 = RegisterMaterial( "capturing_bg_mp" ) + local f10_local1 = RegisterMaterial( "capturing_bar_end_mp" ) + local f10_local2 = RegisterMaterial( "capturing_bar_mp" ) + local f10_local3 = RegisterMaterial( "capturing_bar_start_mp" ) + local self = LUI.UIElement.new() + self.id = "capturing_bar" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(f0_local1 / 2), + left = -(f0_local2 / 2), + height = f0_local1, + width = f0_local2, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerAnimationState( "blink_on", { + alpha = 1 + } ) + self:registerAnimationState( "blink_off", { + alpha = 0 + } ) + self:registerEventHandler( "capture_refresh", f10_arg0 ) + local f10_local5 = LUI.UITimer.new( 100, "capture_refresh", nil, false, false, false, true ) + f10_local5.id = "capturing_refresh_timer" + f10_local5.value = 0 + local f10_local6 = LUI.UIImage.new() + f10_local6.id = "capturing_bar_bg" + f10_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f10_local0 + } ) + f10_local6:animateToState( "default", 0 ) + local f10_local7 = LUI.UIHorizontalList.new() + f10_local7.id = "capturing_bar_hl" + f10_local7:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -33, + left = 27, + height = f0_local3, + width = f0_local4, + alignment = LUI.Alignment.Left, + spacing = 0, + alpha = 0 + } ) + f10_local7:animateToState( "default", 0 ) + f10_local7:registerAnimationState( "active", { + alpha = 1 + } ) + local f10_local8 = LUI.UIImage.new() + f10_local8.id = "start_cap" + f10_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f0_local3, + width = f0_local7, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + material = f10_local3 + } ) + f10_local8:animateToState( "default", 0 ) + f10_local8:registerAnimationState( "secured", { + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f10_local8:registerAnimationState( "contested", { + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b + } ) + local f10_local9 = LUI.UIImage.new() + f10_local9.id = "middle" + f10_local9.m_maxWidth = f0_local4 - f0_local7 - f0_local7 + f10_local9:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f0_local3, + width = 0, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + material = f10_local2 + } ) + f10_local9:animateToState( "default", 0 ) + f10_local9:registerAnimationState( "secured", { + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f10_local9:registerAnimationState( "contested", { + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b + } ) + local f10_local10 = LUI.UIImage.new() + f10_local10.id = "end_cap" + f10_local10:registerAnimationState( "default", { + topAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + height = f0_local3, + width = f0_local7, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + material = f10_local1 + } ) + f10_local10:animateToState( "default", 0 ) + f10_local10:registerAnimationState( "secured", { + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f10_local10:registerAnimationState( "contested", { + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b + } ) + f10_local7:addElement( f10_local8 ) + f10_local7:addElement( f10_local9 ) + f10_local7:addElement( f10_local10 ) + local f10_local11 = LUI.UIText.new() + f10_local11.id = "capturing_text" + f10_local11:setText( "" ) + f10_local11:setTextStyle( CoD.TextStyle.Shadowed ) + f10_local11:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -400, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f10_local11:animateToState( "default", 0 ) + local f10_local12 = -50 + f10_local11:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f10_local12, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f10_local11:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f10_local12, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f10_local11:registerAnimationState( "secured", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f10_local12, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b, + alpha = 1 + } ) + f10_local11:registerAnimationState( "contested", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f10_local12, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 1 + } ) + f10_local11:registerAnimationState( "contested_off_for_loop", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = f10_local12, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = f0_local5, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 0 + } ) + f10_local6:addElement( f10_local7 ) + f10_local6:addElement( f10_local11 ) + self:addElement( f10_local5 ) + self:addElement( f10_local6 ) + return self +end + +local f0_local19 = function () + local self = LUI.UIElement.new() + self.id = "capture_hud" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 250, + left = -(f0_local2 / 2), + height = f0_local1, + width = f0_local2 + } ) + self:animateToState( "default", 0 ) + self:registerOmnvarHandler( "ui_securing", f0_local11 ) + self:addElement( f0_local18( f0_local10 ) ) + return self +end + +local f0_local20 = function () + local self = LUI.UIElement.new() + self.id = "capture_dom_hud" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = GameX.IsSplitscreen() and 100 or 200, + left = -(f0_local2 / 2), + height = f0_local1, + width = f0_local2 + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "playerstate_client_changed", function ( element, event ) + f0_local14( element, { + name = event.name, + value = Game.GetOmnvar( "ui_dom_securing" ) + } ) + end ) + self:registerOmnvarHandler( "ui_dom_securing", f0_local14 ) + self:addElement( f0_local18( f0_local13 ) ) + return self +end + +local f0_local21 = function () + local self = LUI.UIElement.new() + self.id = "bomb_plant_defuse_hud" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 200, + left = -(f0_local2 / 2), + height = f0_local1, + width = f0_local2 + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "playerstate_client_changed", function ( element, event ) + f0_local17( element, { + name = event.name, + value = Game.GetOmnvar( "ui_bomb_planting_defusing" ) + } ) + end ) + self:registerOmnvarHandler( "ui_bomb_planting_defusing", f0_local17 ) + self:addElement( f0_local18( f0_local16 ) ) + return self +end + +LUI.MenuBuilder.registerType( "captureHudDef", f0_local19 ) +LUI.MenuBuilder.registerType( "captureDomHudDef", f0_local20 ) +LUI.MenuBuilder.registerType( "bombPlantDefuseHudDef", f0_local21 ) +LockTable( _M ) diff --git a/lui/mp_hud/charselectmenu.dec.lua b/lui/mp_hud/charselectmenu.dec.lua new file mode 100644 index 0000000..b1dc9b8 --- /dev/null +++ b/lui/mp_hud/charselectmenu.dec.lua @@ -0,0 +1,561 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2 ) + Engine.NotifyServer( "class_select", f2_arg2 ) + LUI.FlowManager.RequestLeaveMenu( f2_arg0 ) +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + if f3_local0.defaultLoadouts then + f3_arg0:dispatchEventToMenuRoot( { + name = "refresh_char_select_list", + defaultLoadouts = false + } ) + else + LUI.FlowManager.RequestLeaveMenu( f3_arg0 ) + end +end + +local f0_local3 = function ( f4_arg0, f4_arg1, f4_arg2 ) + local f4_local0 = GameX.GetGameMode() + if f4_local0 == "infect" and not Cac.IsClassInUse( f4_arg0, f4_arg1, f4_arg2, "defaultClassesTeam" .. Game.GetPlayerTeam(), 0 ) then + return true + elseif f4_local0 ~= "infect" and GameX.UsesFakeLoadout() then + return true + else + return false + end +end + +local f0_local4 = function ( f5_arg0 ) + if f5_arg0 == "infect" then + return true + else + + end +end + +local f0_local5 = function ( f6_arg0 ) + local f6_local0 = "" + if GameX.GetGameMode() == "infect" then + if f6_arg0 == Teams.allies then + f6_local0 = Engine.Localize( Engine.Localize( "LUA_MENU_MP_SURVIVOR_LOADOUT" ) ) + elseif f6_arg0 == Teams.axis then + f6_local0 = Engine.Localize( Engine.Localize( "LUA_MENU_MP_INFECTED_LOADOUT" ) ) + end + else + f6_local0 = Engine.Localize( "@LUA_MENU_DEFAULT_LOADOUT" ) + end + return f6_local0 +end + +local f0_local6 = function ( f7_arg0, f7_arg1 ) + if f7_arg1.value > -1 then + return + else + f7_arg0:dispatchEventToRoot( { + name = "toggle_pause_off" + } ) + LUI.FlowManager.RequestCloseAllMenus( f7_arg0 ) + end +end + +local f0_local7 = function ( f8_arg0, f8_arg1 ) + f8_arg0:dispatchEventToMenuRoot( { + name = "cac_set_slot", + slot = f8_arg0.properties.slot, + controller = f8_arg0.properties.controller, + classLocation = f8_arg0.properties.classLocation, + immediate = true + } ) + f8_arg0:processEvent( { + name = "hide_restrictions_icon" + } ) + f8_arg0:dispatchEventToMenuRoot( { + name = "refresh_specialist_abilities_recap", + controller = f8_arg0.properties.controller, + specialistType = Cac.GetPerk( f8_arg0.properties.controller, f8_arg0.properties.squadLocation, f8_arg0.properties.squadMemberIndex, f8_arg0.properties.classLocation, f8_arg0.properties.slot, Cac.Indices.StreakType ) == "streaktype_specialist", + selected = false, + immediate = true + } ) +end + +local f0_local8 = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3 ) + if GameX.GetGameMode() == "sd" or GameX.GetGameMode() == "sr" then + for f9_local0 = 0, Cac.GetNumCustomSlots( f9_arg0, f9_arg3 ) - 1, 1 do + if f9_local0 ~= 5 and Cac.IsClassInUse( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_local0 ) then + return false + end + end + return true + else + + end +end + +function UpdateRestrictionsIcon( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0:getParent() + if MatchRules.AllowCustomClasses( f10_arg0.properties.classLocation ) and MatchRules.CustomClassIsRestricted( f10_arg0.properties.controller, CoD.GetStatsGroupForGameMode(), f10_arg0.properties.squadLocation, f10_arg0.properties.squadMemberIndex, f10_arg0.properties.classLocation, f10_arg0.properties.slot ) then + f10_arg0:animateToState( "visible" ) + else + f10_arg0:animateToState( "default" ) + end +end + +function HideRestrictionsIcon( f11_arg0, f11_arg1 ) + if MatchRules.AllowCustomClasses( f11_arg0.properties.classLocation ) and MatchRules.CustomClassIsRestricted( f11_arg0.properties.controller, CoD.GetStatsGroupForGameMode(), f11_arg0.properties.squadLocation, f11_arg0.properties.squadMemberIndex, f11_arg0.properties.classLocation, f11_arg0.properties.slot ) then + f11_arg0:dispatchEventToMenuRoot( { + name = "show_class_restrictions_warning" + } ) + else + f11_arg0:dispatchEventToMenuRoot( { + name = "hide_class_restrictions_warning" + } ) + end + f11_arg0:animateToState( "default" ) +end + +local f0_local9 = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4, f12_arg5, f12_arg6, f12_arg7 ) + local f12_local0 = Game.GetPlayerTeam() + if f12_local0 == Teams.free then + f12_local0 = Teams.allies + end + if Cac.IsDefaultClass( f12_arg3 ) then + f12_arg6 = f12_arg6 - Cac.Settings.DataLoc[f12_arg7].maxClassSlots + Cac.Settings.DataLoc[f12_arg3].maxClassSlots * (f12_local0 - 1) + end + local f12_local1 = { + type = "UIGenericButton", + id = "btn_MPLoadout_" .. f12_arg3 .. f12_arg4, + disabledFunc = function ( f13_arg0, f13_arg1 ) + local f13_local0 = Cac.IsCaCSlotLocked( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + if not f13_local0 then + f13_local0 = Cac.IsCaCSlotRestricted( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + end + return f13_local0 + end + } + local f12_local2 = { + childNum = f12_arg4 + 1, + squadLocation = f12_arg1, + squadMemberIndex = f12_arg2, + classLocation = f12_arg3, + slot = f12_arg4, + controller = f12_arg0, + button_text = f12_arg5, + button_action_func = function ( f14_arg0, f14_arg1 ) + local f14_local0 = f12_arg4 + if Cac.IsDefaultClass( f14_arg0.properties.classLocation ) and f12_arg7 then + f14_local0 = f14_local0 + Cac.Settings.DataLoc[f12_arg7].maxClassSlots + Cac.Settings.DataLoc[f12_arg3].maxClassSlots * (f12_local0 - 1) + end + Engine.ExecNow( "set current_class_location " .. f12_arg3 ) + Engine.NotifyServer( "class_select", f14_local0 ) + local f14_local1 = MBh.EmitEventToRoot( "toggle_pause_off" ) + f14_local1( f14_arg0 ) + LUI.FlowManager.RequestCloseAllMenus( f14_arg0 ) + end, + button_over_func = f0_local7, + button_over_disable_func = f0_local7, + button_up_func = MBh.EmitEvent( { + name = "show_restrictions_icon" + } ) + } + if f12_arg6 == f12_arg4 then + local f12_local3 = Engine.GetDvarString( "current_class_location" ) + local f12_local4 = Colors.yellow + end + f12_local2.text_default_color = f12_local3 and f12_local4 or Colors.generic_button_text_default_color + f12_local1.properties = f12_local2 + f12_local1.handlers = { + menu_create = function ( f15_arg0, f15_arg1 ) + f15_arg0.listDefaultFocus = f12_arg6 == f12_arg4 + end, + button_disable = MBh.EmitEvent( { + name = "show_restrictions_icon" + } ) + } + f12_local1.children = { + { + type = "UIImage", + id = "weapon_restriction_icon", + states = { + default = { + rightAnchor = true, + leftAnchor = false, + topAnchor = false, + bottomAnchor = true, + right = 32, + bottom = -7, + width = 32, + height = 32, + material = RegisterMaterial( "icon_new_3" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + properties = { + controller = MBh.Property( "controller" ), + squadLocation = MBh.Property( "squadLocation" ), + squadMemberIndex = MBh.Property( "squadMemberIndex" ), + classLocation = MBh.Property( "classLocation" ), + slot = MBh.Property( "slot" ) + }, + handlers = { + hide_restrictions_icon = HideRestrictionsIcon, + show_restrictions_icon = UpdateRestrictionsIcon, + menu_create = UpdateRestrictionsIcon + } + } + } + return f12_local1 +end + +local f0_local10 = function ( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg0.exclusiveController + if not f16_local0 then + DebugPrint( "[WARNING] CAC: using controller index 0, this is only ok if you are editing a menu" ) + f16_local0 = 0 + end + local f16_local1 = Cac.Settings.DataLoc.privateMatchSquadMembers.maxClassSlots + if Engine.UsingSplitscreenUpscaling() then + local f16_local2 = f16_local1 + end + local self = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = GenericMenuDims.menu_top, + left = GenericMenuDims.menu_left, + height = GenericButtonSettings.Styles.GradientButton.height * (f16_local2 or f16_local1 * 2 + 1), + right = GenericMenuDims.menu_right, + alignment = LUI.Alignment.Top + } ) + self:setUseStencil( true ) + local f16_local4 = LUI.UIVerticalList.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + alignment = LUI.Alignment.Top + }, true ) + f16_local4.id = "change_loadout_selections_id" + f16_local4:makeFocusable() + local f16_local5 = Cac.GetCustomClassLoc( "loadouts" ) + local f16_local6 = Cac.GetSquadLoc() + local f16_local7 = Cac.GetActiveSquadMember( f16_local0 ) + local f16_local8 = Game.GetOmnvar( "ui_loadout_selected" ) + local f16_local9 = Game.GetPlayerTeam() + local f16_local10 = f0_local5( f16_local9 ) + if f0_local3( f16_local0, f16_local6, f16_local7 ) then + LUI.MenuBuilder.BuildAddChild( f16_local4, { + type = "UIGenericButton", + id = "btn_fakeLoadout", + properties = { + childNum = 1, + button_text = f16_local10, + button_action_func = function ( f17_arg0, f17_arg1 ) + Engine.NotifyServer( "class_select", 0 ) + local f17_local0 = MBh.EmitEventToRoot( "toggle_pause_off" ) + f17_local0( f17_arg0 ) + LUI.FlowManager.RequestCloseAllMenus( f17_arg0 ) + end, + text_default_color = Colors.yellow + } + } ) + else + if not f16_arg1 and GameX.GetGameMode() ~= "infect" then + for f16_local11 = 0, Cac.GetNumCustomSlots( f16_local0, "loadouts" ) - 1, 1 do + LUI.MenuBuilder.BuildAddChild( f16_local4, f0_local9( f16_local0, f16_local6, f16_local7, f16_local5, f16_local11, Cac.GetLoadoutName( f16_local0, f16_local6, f16_local7, f16_local5, f16_local11 ), f16_local8 ) ) + end + end + local f16_local11 = "defaultClassesTeam" .. Game.GetPlayerTeam() + if f16_local11 == "defaultClassesTeam0" then + f16_local11 = "defaultClassesTeam2" + end + if Cac.HasCustomClasses( f16_local0, f16_local6, f16_local7, f16_local11 ) and not f0_local8( f16_local0, f16_local6, f16_local7, f16_local11 ) then + if not f16_arg1 and GameX.GetGameMode() ~= "infect" then + LUI.MenuBuilder.BuildAddChild( f16_local4, { + type = "UIImage", + id = "dividing_line", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 8, + right = 450, + top = 0, + bottom = 2, + material = RegisterMaterial( "white" ), + alpha = 0.3 + } + } + } ) + LUI.MenuBuilder.BuildAddChild( f16_local4, { + type = "UIImage", + id = "dividing_spacer", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = 5, + alpha = 0 + } + } + } ) + LUI.MenuBuilder.BuildAddChild( f16_local4, { + type = "UIGenericButton", + id = "default_loadouts_btn", + properties = { + squadLocation = f16_local6, + squadMemberIndex = f16_local7, + classLocation = f16_local11, + slot = Cac.GetFirstCustomClass( f16_local0, f16_local6, f16_local7, f16_local11 ), + controller = f16_local0, + button_text = Engine.Localize( "@LUA_MENU_DEFAULT_CLASSES" ), + button_action_func = function ( f18_arg0, f18_arg1 ) + f18_arg0:dispatchEventToMenuRoot( { + name = "refresh_char_select_list", + defaultLoadouts = true + } ) + end, + text_default_color = Cac.Settings.DataLoc[f16_local5].maxClassSlots and Colors.yellow or Colors.generic_button_text_default_color, + button_over_func = f0_local7 + } + } ) + else + for f16_local12 = 0, Cac.GetNumCustomSlots( f16_local0, f16_local11 ) - 1, 1 do + if Cac.IsClassInUse( f16_local0, f16_local6, f16_local7, f16_local11, f16_local12 ) then + if (GameX.GetGameMode() == "sd" or GameX.GetGameMode() == "sr") and f16_local12 == 5 then + break + end + local f16_local15 = Cac.GetLoadoutName( f16_local0, f16_local6, f16_local7, f16_local11, f16_local12 ) + if GameX.GetGameMode() == "infect" then + if f16_local9 == Teams.allies and f16_local12 == 0 then + f16_local15 = Engine.Localize( "LUA_MENU_MP_SURVIVOR_LOADOUT" ) + elseif f16_local9 == Teams.axis and f16_local12 == 0 then + f16_local15 = Engine.Localize( "LUA_MENU_MP_INFECTED_LOADOUT" ) + elseif f16_local9 == Teams.axis and f16_local12 == 1 then + break + end + end + LUI.MenuBuilder.BuildAddChild( f16_local4, f0_local9( f16_local0, f16_local6, f16_local7, f16_local11, f16_local12, f16_local15, f16_local8, f16_local5 ) ) + end + end + end + end + end + self:addElement( f16_local4 ) + return self +end + +local f0_local11 = function () + local self = LUI.UIElement.new() + self.id = "class_restrictions_warning" + self:registerAnimationState( "default", { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + top = 54, + right = -100, + width = 500, + height = 28, + alpha = 0 + } ) + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "show_class_restrictions_warning", function ( element, event ) + element:animateToState( "visible" ) + return true + end ) + self:registerEventHandler( "hide_class_restrictions_warning", function ( element, event ) + element:animateToState( "default" ) + return true + end ) + local f19_local1 = LUI.UIImage.new() + f19_local1.id = "class_restrictions_warning_icon" + f19_local1:registerAnimationState( "default", { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + right = 0, + top = 2, + width = 28, + height = 28, + material = RegisterMaterial( "icon_new_3" ), + alpha = 1 + } ) + f19_local1:animateToState( "default" ) + self:addElement( f19_local1 ) + local f19_local2 = LUI.UIText.new() + f19_local2.id = "class_restrictions_warning_text" + f19_local2:setText( Engine.Localize( "PATCH_MENU_ITEM_RESTRICTED" ) ) + f19_local2:registerAnimationState( "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 + } ) ) + f19_local2:animateToState( "default" ) + self:addElement( f19_local2 ) + return self +end + +local f0_local12 = function ( f22_arg0 ) + local self = LUI.UIElement.new() + self.id = "change_loadout_display_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 130, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "menu_create", function ( element, event ) + element:disableTreeFocus() + end ) + local f22_local1 = "defaultClassesTeam" .. Game.GetPlayerTeam() + local f22_local2 = GameX.GetGameMode() + local f22_local3 = LUI.MenuBuilder.BuildRegisteredType + local f22_local4 = "cac_recap" + local f22_local5 = { + exclusiveController = f22_arg0.exclusiveController, + squad_location = Cac.GetSquadLoc(), + member_index = Cac.GetActiveSquadMember( f22_arg0.exclusiveController ) + } + if f0_local4( f22_local2 ) then + local f22_local6 = f22_local1 + end + f22_local5.class_location = f22_local6 or Cac.GetCustomClassLoc( "loadouts" ) + f22_local5.loadout_slot = 0 + f22_local3 = f22_local3( f22_local4, f22_local5 ) + f22_local3.id = "change_loadout_recap_id" + self:addElement( f22_local3 ) + if Engine.UsingSplitscreenUpscaling() then + f22_local4 = {} + f22_local4 = GameX.GetSafeZoneSize() + f22_local5 = {} + f22_local5 = f22_local3:getLocalRect() + f22_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + rightAnchor = true, + leftAnchor = false, + top = f22_local5[2], + bottom = f22_local5[4], + right = f22_local4[3], + width = f22_local5[3] - f22_local5[1] + } ) + f22_local3:animateToState( "default", 0 ) + end + return self +end + +LUI.MenuBuilder.registerType( "class_select_main", function ( f24_arg0, f24_arg1, f24_arg2 ) + local f24_local0 = Engine.Localize( "@LUA_MENU_CHOOSE_CLASS_CAPS" ) + local self = LUI.UIElement.new() + self.id = "mp_change_loadout_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "menu_create", f0_local0 ) + self:registerOmnvarHandler( "ui_pause_menu_show", LUI.mp_hud.OptionsMenu.pauseMenuUpdate ) + self:registerOmnvarHandler( "ui_options_menu", f0_local6 ) + local f24_local2 = LUI.UIElement.new( { + worldBlur = 5 + } ) + f24_local2:setupWorldBlur() + f24_local2.id = "csWorldBlurOverlay" + self:addElement( f24_local2 ) + self:addElement( LUI.mp_hud.OptionsMenu.mp_pause_menu_background_def() ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "button_helper_text_main", + id = "cshelper_text_id" + } ) + if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then + local f24_local3 = LUI.MenuBuilder.BuildRegisteredType( "online_friends_widget" ) + f24_local3.id = "csfriends_widget_id" + self:addElement( f24_local3 ) + end + local f24_local3 = LUI.UIBindButton.new() + f24_local3.id = "clBackToGameStartButton" + f24_local3:registerEventHandler( "button_start", f0_local2 ) + f24_local3:registerEventHandler( "button_secondary", f0_local2 ) + self:addElement( f0_local11() ) + self:addElement( LUI.mp_hud.OptionsMenu.mp_pause_menu_title_def( f24_local0 ) ) + self:addElement( f24_local3 ) + self:addElement( f0_local12( f24_arg1 ) ) + local f24_local4 = LUI.UITimer.new( 250, { + name = "menuCreationTimer" + }, nil, true, self, false ) + f24_local4.id = "updateTimer" + self:addElement( f24_local4 ) + self:registerEventHandler( "menuCreationTimer", function ( element, event ) + element.listOfLoadouts = f0_local10( f24_arg1 ) + self:addElement( element.listOfLoadouts ) + element.listOfLoadouts:processEvent( { + name = "gain_focus" + } ) + end ) + self:registerEventHandler( "refresh_char_select_list", function ( element, event ) + local f26_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + f26_local0.defaultLoadouts = event.defaultLoadouts + local f26_local1 = nil + if event.defaultLoadouts then + f26_local1 = Engine.Localize( "@PATCH_MENU_DEFAULT_CLASSES_CAPS" ) + else + f26_local1 = Engine.Localize( "@LUA_MENU_CHOOSE_CLASS_CAPS" ) + end + element:dispatchEventToMenuRoot( { + name = "update_header_text", + string = f26_local1 + } ) + element.listOfLoadouts:close() + element.listOfLoadouts = f0_local10( f24_arg1, event.defaultLoadouts ) + self:addElement( element.listOfLoadouts ) + element.listOfLoadouts:processEvent( { + name = "gain_focus" + } ) + end ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/damagefeedbackhud.dec.lua b/lui/mp_hud/damagefeedbackhud.dec.lua new file mode 100644 index 0000000..012dec4 --- /dev/null +++ b/lui/mp_hud/damagefeedbackhud.dec.lua @@ -0,0 +1,630 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + Engine.NotifyServer( "gambler_anim_complete", 1 ) +end + +f0_local1 = function ( f2_arg0 ) + if Game.GetOmnvar( f2_arg0 ) >= 0 then + return true + else + return false + end +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg1.value + if f3_local0 ~= nil then + if Game.IsCinematicCameraActive() then + return + end + local f3_local1 = 500 + local f3_local2 = f3_arg0:getChildById( "damageFeedbackImageId" ) + if f3_local0 == "hitblastshield" then + f3_local2:animateToState( "blastshield", 0 ) + elseif f3_local0 == "thermobaric_debuff" then + f3_local2:animateToState( "thermoDebuff", 0 ) + f3_local1 = 1000 + elseif f3_local0 == "hitlightarmor" then + f3_local2:animateToState( "light_armor", 0 ) + elseif f3_local0 == "hitmorehealth" then + f3_local2:animateToState( "more_health", 0 ) + elseif f3_local0 == "hitmotionsensor" then + f3_local2:animateToState( "motion_sensor", 0 ) + f3_local1 = 2500 + elseif f3_local0 == "hitalienarmor" then + f3_local2:animateToState( "alienarmor", 0 ) + elseif f3_local0 == "hitaliensoft" then + f3_local2:animateToState( "aliensoft", 0 ) + elseif f3_local0 == "hitjuggernaut" then + f3_local2:animateToState( "juggernaut", 0 ) + elseif f3_local0 == "hitkill" then + f3_local2:animateToState( "hitkill", 0 ) + elseif f3_local0 == "hitkilljugg" then + f3_local2:animateToState( "hitkilljugg", 0 ) + elseif f3_local0 == "hitdeadeyekill" then + f3_local2:animateToState( "hitdeadeyekill", 0 ) + elseif f3_local0 == "hitkillblast" then + f3_local2:animateToState( "hitkillblast", 0 ) + elseif f3_local0 == "thermodebuff_kill" then + f3_local2:animateToState( "thermodebuff_kill", 0 ) + else + f3_local2:animateToState( "default", 0 ) + end + local f3_local3 = MBh.AnimateSequence( { + { + "active", + 0 + }, + { + "default", + f3_local1 + } + } ) + f3_local3( f3_arg0 ) + end +end + +local f0_local3 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg1.value + if f4_local0 ~= nil then + if Game.IsCinematicCameraActive() then + return + end + local f4_local1 = f4_arg0:getChildById( "deadeyeBaseContainer" ) + local f4_local2 = f4_arg0:getChildById( "deadeyePulseContainer" ) + if f4_local0 == "hitcritical" or f4_local0 == "hitdeadeyekill" then + local f4_local3 = MBh.AnimateSequence( { + { + "default", + 100 + }, + { + "active", + 20 + }, + { + "close", + 50 + } + } ) + f4_local3( f4_local1 ) + f4_local3 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 50 + }, + { + "close", + 90 + } + } ) + f4_local3( f4_local2 ) + end + end +end + +local f0_local4 = function ( f5_arg0, f5_arg1 ) + if f5_arg1.value ~= -1 then + local f5_local0 = f5_arg0:getChildById( "gamblerIconId" ) + local f5_local1 = f5_arg0:getChildById( "gamblerTextId" ) + local f5_local2 = Engine.TableLookupByRow( PerkTable.File, f5_arg1.value, PerkTable.Cols.Image ) + local f5_local3 = Engine.TableLookupByRow( PerkTable.File, f5_arg1.value, PerkTable.Cols.Name ) + local f5_local4 = RegisterMaterial( f5_local2 ) + f5_local1:setText( Engine.Localize( f5_local3 ) ) + CoD.SetMaterial( f5_local0, f5_local4 ) + local f5_local5 = MBh.AnimateSequence( { + { + "active", + 0 + }, + { + "inactive", + 2500 + } + } ) + f5_local5( f5_arg0 ) + end +end + +local f0_local5 = function () + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -16, + bottom = 16, + left = -16, + right = 16, + alpha = 1 + } ) + self:animateToState( "default" ) + self:registerOmnvarHandler( "damage_feedback", f0_local3 ) + local f6_local1 = LUI.UIElement.new() + f6_local1.id = "deadeyeBaseContainer" + f6_local1:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -16, + left = -16, + right = 16, + height = 64, + alpha = 0 + } ) + f6_local1:registerAnimationState( "active", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -20, + left = -20, + right = 20, + height = 70, + alpha = 0.5 + } ) + f6_local1:registerAnimationState( "close", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -22, + left = -22, + right = 22, + height = 72, + alpha = 0 + } ) + f6_local1:animateToState( "default" ) + local f6_local2 = LUI.UIImage.new() + f6_local2.id = "deadeyeBaseImage" + f6_local2:registerAnimationState( "default", { + material = RegisterMaterial( "damage_feedback_deadeye" ), + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottomAnchor = true, + alpha = 1 + } ) + f6_local2:animateToState( "default" ) + f6_local1:addElement( f6_local2 ) + local f6_local3 = LUI.UIElement.new() + f6_local3.id = "deadeyePulseContainer" + f6_local3:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -16, + left = -16, + right = 16, + height = 64, + alpha = 0 + } ) + f6_local3:registerAnimationState( "active", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -32, + left = -32, + right = 32, + height = 128, + alpha = 1 + } ) + f6_local3:registerAnimationState( "close", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -64, + left = -64, + right = 64, + height = 256, + alpha = 0 + } ) + f6_local3:animateToState( "default" ) + local f6_local4 = LUI.UIImage.new() + f6_local4.id = "deadeyePulseImage" + f6_local4:registerAnimationState( "default", { + material = RegisterMaterial( "damage_feedback_deadeye" ), + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottomAnchor = true, + alpha = 1 + } ) + f6_local4:animateToState( "default" ) + f6_local3:addElement( f6_local4 ) + self:addElement( f6_local1 ) + self:addElement( f6_local3 ) + return self +end + +local f0_local6 = function () + local self = LUI.UIElement.new() + self.id = "gamblerHudId" + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -16, + bottom = 16, + left = -16, + right = 16, + alpha = 0 + } ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerAnimationState( "inactive", { + alpha = 0 + } ) + self:animateToState( "default" ) + self:registerOmnvarHandler( "ui_gambler_show", f0_local4 ) + self:registerEventHandler( "transition_complete_inactive", f0_local0 ) + local f7_local1 = LUI.UIImage.new() + f7_local1.id = "gamblerIconId" + f7_local1:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 95, + left = -20, + right = 20, + height = 40 + } ) + f7_local1:animateToState( "default" ) + local f7_local2 = LUI.UIText.new() + f7_local2.id = "gamblerTextId" + f7_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + bottom = 160, + left = -100, + right = 100, + height = CoD.TextSettings.SmallFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f7_local2:animateToState( "default" ) + f7_local2:setText( "Enter Ability Name Here" ) + f7_local2:setTextStyle( CoD.TextStyle.Shadowed ) + self:addElement( f7_local1 ) + self:addElement( f7_local2 ) + return self +end + +function damageFeedbackHudDef() + local f8_local0 = RegisterMaterial( "damage_feedback" ) + local self = LUI.UIElement.new() + self.id = "damageFeedbackHud" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f8_local2 = LUI.UIElement.new() + f8_local2:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -16, + bottom = 16, + left = -16, + right = 16, + alpha = 0 + } ) + f8_local2:registerAnimationState( "active", { + alpha = 1 + } ) + f8_local2:animateToState( "default" ) + f8_local2:registerOmnvarHandler( "damage_feedback", f0_local2 ) + local f8_local3 = { + { + name = "default", + material = f8_local0 + } + } + if not Engine.IsAliensMode() then + local f8_local4 = Engine.UsingSplitscreenUpscaling() and 137 or 100 + local f8_local5 = RegisterMaterial( "damage_feedback_blastshield" ) + local f8_local6 = RegisterMaterial( "damage_feedback_thermodebuff" ) + local f8_local7 = RegisterMaterial( "damage_feedback_juggernaut" ) + LUI.ConcatenateToTable( f8_local3, { + { + name = "blastshield", + material = f8_local5 + }, + { + name = "thermoDebuff", + material = f8_local6 + }, + { + name = "juggernaut", + material = f8_local7 + }, + { + name = "light_armor", + material = RegisterMaterial( "damage_feedback_lightarmor" ) + }, + { + name = "more_health", + material = RegisterMaterial( "damage_feedback_morehealth" ) + }, + { + name = "motion_sensor", + material = RegisterMaterial( "damage_feedback_motionsensor" ) + }, + { + name = "hitkill", + material = f8_local0, + red = 0.9, + green = 0.63, + blue = 0 + }, + { + name = "hitkilljugg", + material = f8_local7, + red = 0.9, + green = 0.63, + blue = 0 + }, + { + name = "hitkillblast", + material = f8_local5, + red = 0.9, + green = 0.63, + blue = 0 + }, + { + name = "hitdeadeyekill", + material = f8_local0, + red = 0.9, + green = 0.63, + blue = 0 + }, + { + name = "thermodebuff_kill", + material = f8_local6, + red = 0.9, + green = 0.63, + blue = 0 + } + } ) + else + LUI.ConcatenateToTable( f8_local3, { + { + name = "alienarmor", + material = RegisterMaterial( "damage_feedback_alienarmor" ) + }, + { + name = "aliensoft", + material = RegisterMaterial( "damage_feedback_aliensoft" ) + } + } ) + end + local f8_local4 = LUI.UIImage.new() + f8_local4.id = "damageFeedbackImageId" + for f8_local9, f8_local10 in ipairs( f8_local3 ) do + local f8_local11 = f8_local4 + local f8_local12 = f8_local4.registerAnimationState + local f8_local13 = f8_local10.name + local f8_local14 = { + material = f8_local10.material, + topAnchor = true, + bottomAnchor = false + } + local f8_local8 + if f8_local10.leftAnchor ~= nil then + f8_local8 = f8_local10.leftAnchor + else + f8_local8 = true + end + f8_local14.leftAnchor = f8_local8 + if f8_local10.rightAnchor ~= nil then + f8_local8 = f8_local10.rightAnchor + else + f8_local8 = true + end + f8_local14.rightAnchor = f8_local8 + f8_local14.top = f8_local10.top or 0 + f8_local14.height = f8_local10.height or 64 + f8_local14.left = f8_local10.left + f8_local14.right = f8_local10.right + f8_local14.red = f8_local10.red or 1 + f8_local14.blue = f8_local10.blue or 1 + f8_local14.green = f8_local10.green or 1 + f8_local12( f8_local11, f8_local13, f8_local14 ) + end + f8_local4:animateToState( "default" ) + f8_local2:addElement( f8_local4 ) + self:addElement( f8_local2 ) + self:addElement( f0_local5() ) + self:addElement( f0_local6() ) + return self +end + +local f0_local7 = function ( f9_arg0, f9_arg1 ) + local f9_local0 = f9_arg1.value + if f9_local0 ~= nil then + if Game.IsCinematicCameraActive() then + return + end + local f9_local1 = 500 + local f9_local2 = f9_arg0:getChildById( "hudIconTypeImageId" ) + if f9_local0 == "scavenger" and f0_local1( "ui_gambler_show" ) == false then + f9_local2:animateToState( "scavenger", 0 ) + f9_local1 = 2500 + elseif f9_local0 == "boxofguns" and f0_local1( "ui_gambler_show" ) == false then + f9_local2:animateToState( "boxofguns", 0 ) + f9_local1 = 2500 + elseif f9_local0 == "throwingknife" and f0_local1( "ui_gambler_show" ) == false then + f9_local2:animateToState( "throwingknife", 0 ) + f9_local1 = 2500 + elseif f9_local0 == "oracle" and f0_local1( "ui_gambler_show" ) == false then + f9_local2:animateToState( "oracle", 0 ) + f9_local1 = 2500 + else + f9_local2:animateToState( "default", 0 ) + end + local f9_local3 = MBh.AnimateSequence( { + { + "active", + 0 + }, + { + "default", + f9_local1 + } + } ) + f9_local3( f9_arg0 ) + end +end + +function hudIconTypeHudDef() + local self = LUI.UIElement.new() + self.id = "hudIconTypeHud" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f10_local1 = LUI.UIElement.new() + f10_local1:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -16, + bottom = 16, + left = -16, + right = 16, + alpha = 0 + } ) + f10_local1:registerAnimationState( "active", { + alpha = 1 + } ) + f10_local1:animateToState( "default" ) + f10_local1:registerOmnvarHandler( "damage_feedback_other", f0_local7 ) + local f10_local2 = {} + if not Engine.IsAliensMode() then + local f10_local3 = Engine.UsingSplitscreenUpscaling() and 137 or 100 + LUI.ConcatenateToTable( f10_local2, { + { + name = "scavenger", + material = RegisterMaterial( "scavenger_pickup" ), + leftAnchor = false, + rightAnchor = false, + top = f10_local3, + left = -36, + right = 36, + height = 36 + }, + { + name = "boxofguns", + material = RegisterMaterial( "boxofguns_pickup" ), + leftAnchor = false, + rightAnchor = false, + top = f10_local3, + left = -36, + right = 36, + height = 36 + }, + { + name = "throwingknife", + material = RegisterMaterial( "throwingknife_pickup" ), + leftAnchor = false, + rightAnchor = false, + top = f10_local3, + left = -36, + right = 36, + height = 36 + }, + { + name = "oracle", + material = RegisterMaterial( "icon_ks_skylark_uav_hud" ), + leftAnchor = true, + rightAnchor = false, + top = f10_local3, + left = 0, + height = 36, + width = 36, + red = 0.9, + green = 0.63, + blue = 0 + } + } ) + end + local f10_local3 = LUI.UIImage.new() + f10_local3.id = "hudIconTypeImageId" + for f10_local8, f10_local9 in ipairs( f10_local2 ) do + local f10_local10 = f10_local3 + local f10_local11 = f10_local3.registerAnimationState + local f10_local12 = f10_local9.name + local f10_local13 = { + material = f10_local9.material, + topAnchor = true, + bottomAnchor = false + } + local f10_local7 + if f10_local9.leftAnchor ~= nil then + f10_local7 = f10_local9.leftAnchor + else + f10_local7 = true + end + f10_local13.leftAnchor = f10_local7 + if f10_local9.rightAnchor ~= nil then + f10_local7 = f10_local9.rightAnchor + else + f10_local7 = true + end + f10_local13.rightAnchor = f10_local7 + f10_local13.top = f10_local9.top or 0 + f10_local13.height = f10_local9.height or 64 + f10_local13.width = f10_local9.width + f10_local13.left = f10_local9.left + f10_local13.right = f10_local9.right + f10_local13.red = f10_local9.red or 1 + f10_local13.blue = f10_local9.blue or 1 + f10_local13.green = f10_local9.green or 1 + f10_local11( f10_local10, f10_local12, f10_local13 ) + end + f10_local3:animateToState( "default" ) + f10_local1:addElement( f10_local3 ) + self:addElement( f10_local1 ) + return self +end + +LUI.MenuBuilder.registerType( "damageFeedbackHudDef", damageFeedbackHudDef ) +LUI.MenuBuilder.registerType( "hudIconTypeHudDef", hudIconTypeHudDef ) +LockTable( _M ) diff --git a/lui/mp_hud/dighud.dec.lua b/lui/mp_hud/dighud.dec.lua new file mode 100644 index 0000000..2d238e8 --- /dev/null +++ b/lui/mp_hud/dighud.dec.lua @@ -0,0 +1,314 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = { + "icon_perks_ready_up", + "icon_perks_sleight_of_hand", + "icon_perks_agility", + "icon_perks_marathon", + "icon_perks_stalker", + "icon_perks_strong_arm", + "icon_perks_on_the_go", + "icon_perks_reflex", + "icon_perks_steady_aim", + "icon_perks_quickdraw", + "icon_perks_takedown", + "icon_perks_blind_eye", + "icon_perks_dead_silence", + "icon_perks_incog", + "icon_perks_assassin", + "icon_perks_recon", + "icon_perks_scavenger", + "icon_perks_sitrep", + "icon_perks_amplifier", + "icon_perks_com_link", + "icon_perks_resiliance", + "icon_perks_icu", + "icon_perks_focus", + "icon_perks_tac_resist", + "icon_perks_blast_shield", + "icon_perks_danger_close", + "icon_perks_ping", + "icon_perks_deadeye" +} +f0_local1 = function ( f1_arg0, f1_arg1 ) + if f1_arg1.value == -1 then + f1_arg0:animateToState( "finished", 0 ) + elseif f1_arg1.value == 1 then + local f1_local0 = f1_arg0:getChildById( "digHudPerkTextContainer" ) + local f1_local1 = f1_arg0:getChildById( "digHudPerkRow" ) + local f1_local2 = MBh.AnimateSequence( { + { + "active", + 0 + }, + { + "active", + 3500 + }, + { + "finished", + 500 + } + } ) + f1_local2( f1_arg0 ) + local f1_local3 = MBh.AnimateSequence( { + { + "opening", + 50 + }, + { + "active", + 100 + }, + { + "active", + 3850 + }, + { + "default", + 0 + } + } ) + f1_local3( f1_local0 ) + f1_local1:processEvent( { + name = "start_scroll", + slowScrollCount = 7, + slowScrollTime = 175, + fastScrollTime = 60, + immediate = true + } ) + end +end + +LUI.MenuBuilder.registerType( "digKillstreakHudDef", function () + local f2_local0 = 64 + local f2_local1 = 64 + local f2_local2 = 8 + local f2_local3 = f2_local1 * f2_local2 + local self = LUI.UIElement.new() + self.id = "digHud" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f2_local5 = LUI.UIElement.new() + f2_local5.id = "digHudContainer" + f2_local5:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 40, + bottom = 80, + left = -200, + right = 200, + alpha = 0 + } ) + f2_local5:registerAnimationState( "active", { + alpha = 1 + } ) + f2_local5:registerAnimationState( "inactive", { + alpha = 0 + } ) + f2_local5:registerAnimationState( "finished", { + alpha = 0 + } ) + f2_local5:animateToState( "default" ) + f2_local5:registerOmnvarHandler( "ui_dig_killstreak_show", f0_local1 ) + f2_local5:registerEventHandler( "transition_complete_finished", function ( element, event ) + element:dispatchEventToChildren( { + name = "request_stop_scroll" + } ) + end ) + local f2_local6 = LUI.UIHorizontalList.new() + f2_local6.id = "digHudPerkRow" + f2_local6:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 0, + left = -f2_local3 * 0.5 + f2_local1 * 0.5, + width = f2_local3, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) + f2_local6:registerAnimationState( "scrolled", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 0, + left = -f2_local3 * 0.5 - f2_local1 * 0.5, + width = f2_local3, + alpha = 1 + } ) + f2_local6:animateToState( "default" ) + f2_local6:registerEventHandler( "start_scroll", function ( element, event ) + element:animateToState( "default", 0 ) + element.scrollCount = 0 + element.slowScrollCount = event.slowScrollCount + element.slowScrollTime = event.slowScrollTime + element.fastScrollTime = event.fastScrollTime + element:processEvent( { + name = "next_scroll", + immediate = true + } ) + end ) + f2_local6:registerEventHandler( "next_scroll", function ( element, event ) + local f5_local0 = element.scrollCount + local f5_local1 = element.slowScrollCount + f5_local0 = REG7 and element.slowScrollTime or element.fastScrollTime + element:animateToState( "scrolled", f5_local0 ) + element:dispatchEventToChildren( { + name = "start_scroll", + scrollTime = f5_local0, + immediate = true + } ) + end ) + f2_local6:registerEventHandler( "transition_complete_scrolled", function ( element, event ) + if element.requestStopScroll then + element.requestStopScroll = nil + element.scrollCount = nil + else + element.scrollCount = element.scrollCount + 1 + element:animateToState( "default", 0 ) + element:dispatchEventToChildren( { + name = "cycle_material", + immediate = true + } ) + element:processEvent( { + name = "next_scroll", + immediate = true + } ) + end + end ) + f2_local6:registerEventHandler( "request_stop_scroll", function ( element, event ) + if element.scrollCount then + element.requestStopScroll = true + end + end ) + for f2_local7 = 1, f2_local2, 1 do + local f2_local10 = f2_local7 + local f2_local11 = LUI.UIElement.new() + f2_local11.id = "digHudPerkIconContainer" .. f2_local10 + f2_local11:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f2_local0 / 2, + left = -f2_local1 / 2, + bottom = f2_local0 / 2, + right = f2_local1 / 2, + alpha = 1 + } ) + f2_local11:registerAnimationState( "hidden", { + alpha = 0 + } ) + f2_local11:animateToState( "default" ) + f2_local11:registerEventHandler( "start_scroll", function ( element, event ) + if f2_local10 == 1 then + element:animateToState( "default", 0 ) + element:animateToState( "hidden", event.scrollTime ) + elseif f2_local10 == f2_local2 then + element:animateToState( "hidden", 0 ) + element:animateToState( "default", event.scrollTime ) + end + end ) + f2_local6:addElement( f2_local11 ) + local f2_local12 = LUI.UIImage.new() + f2_local12.id = "digHudPerkIcon" .. f2_local10 + f2_local12.materialID = f2_local10 + f2_local12:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( f0_local0[f2_local12.materialID] ) + } ) + f2_local12:animateToState( "default" ) + f2_local12:registerEventHandler( "cycle_material", function ( element, event ) + element.materialID = element.materialID + 1 + if #f0_local0 < element.materialID then + element.materialID = 1 + end + element:registerAnimationState( "updatedMaterial", { + material = RegisterMaterial( f0_local0[element.materialID] ) + } ) + element:animateToState( "updatedMaterial", 0 ) + end ) + f2_local11:addElement( f2_local12 ) + end + local f2_local7 = LUI.UIElement.new() + f2_local7.id = "digHudPerkTextContainer" + f2_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + bottom = 80, + height = 20, + width = 200, + alpha = 0 + } ) + f2_local7:registerAnimationState( "opening", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + bottom = 80, + height = 40, + width = 400, + alpha = 1 + } ) + f2_local7:registerAnimationState( "active", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + bottom = 80, + height = 20, + width = 200, + alpha = 1 + } ) + f2_local7:animateToState( "default" ) + local f2_local8 = LUI.UIText.new() + f2_local8.id = "digHudPerkText" + f2_local8:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f2_local8:animateToState( "default" ) + f2_local8:setText( Engine.Localize( "@MP_DIG_LEVEL_KILLSTREAK_ACTIVATED" ) ) + f2_local8:setTextStyle( CoD.TextStyle.Shadowed ) + f2_local7:addElement( f2_local8 ) + f2_local5:addElement( f2_local6 ) + f2_local5:addElement( f2_local7 ) + self:addElement( f2_local5 ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/endgamemenu.dec.lua b/lui/mp_hud/endgamemenu.dec.lua new file mode 100644 index 0000000..e0a98c9 --- /dev/null +++ b/lui/mp_hud/endgamemenu.dec.lua @@ -0,0 +1,230 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + f2_arg0:setText( f2_arg1.message_text ) + f2_arg0:dispatchEventToRoot( { + name = "resize_popup" + } ) +end + +f0_local2 = function ( f3_arg0 ) + Engine.ExecFirstClient( "xpartybackout" ) + Engine.ExecFirstClient( "disconnect" ) +end + +local f0_local3 = function ( f4_arg0 ) + Engine.ExecFirstClient( "xpartydisbandafterround" ) + Engine.ExecFirstClient( "hostmigration_start_backout" ) +end + +local f0_local4 = function ( f5_arg0 ) + return Engine.GetDvarBool( "onlinegame" ) +end + +local f0_local5 = function ( f6_arg0 ) + if f0_local4( f6_arg0 ) then + Engine.ExecFirstClient( "xstopprivateparty" ) + Engine.ExecFirstClient( "disconnect" ) + Engine.ExecFirstClient( "xblive_privatematch 0" ) + Engine.ExecFirstClient( "onlinegame 1" ) + Engine.ExecFirstClient( "xstartprivateparty" ) + else + Engine.ExecFirstClient( "disconnect" ) + end +end + +local f0_local6 = function ( f7_arg0 ) + local f7_local0 = Engine.GetDvarBool( "squad_match" ) + Engine.ExecFirstClient( "xstopprivateparty" ) + Engine.ExecFirstClient( "xpartydisbandafterround" ) + if f7_local0 then + Engine.ExecFirstClient( "disconnect" ) + Engine.ExecFirstClient( "xblive_privatematch 0" ) + Engine.ExecFirstClient( "onlinegame 1" ) + Engine.ExecFirstClient( "xstartprivateparty" ) + else + Engine.ExecFirstClient( "hostmigration_start" ) + end +end + +local f0_local7 = function ( f8_arg0, f8_arg1 ) + if Engine.GetDvarBool( "sv_running" ) then + Engine.NotifyServer( "end_game", 1 ) + else + f0_local5( f8_arg0 ) + end + LUI.FlowManager.RequestCloseAllMenus( f8_arg0 ) +end + +local f0_local8 = function ( f9_arg0, f9_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f9_arg0 ) + Engine.Exec( "onPlayerQuit" ) + if Engine.GetDvarBool( "sv_running" ) then + f0_local3( f9_arg0 ) + else + f0_local2( f9_arg0 ) + end + LUI.FlowManager.RequestCloseAllMenus( f9_arg0 ) +end + +local f0_local9 = function ( f10_arg0, f10_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f10_arg0 ) + Engine.Exec( "onPlayerQuit" ) + if Engine.GetDvarBool( "sv_running" ) then + f0_local6( f10_arg0 ) + else + f0_local5( f10_arg0 ) + end + LUI.FlowManager.RequestCloseAllMenus( f10_arg0 ) +end + +local f0_local10 = function ( f11_arg0 ) + local f11_local0 = Lobby.IsInPrivateParty() + if f11_local0 then + f11_local0 = Lobby.IsPrivatePartyHost() + if f11_local0 then + f11_local0 = not Lobby.IsAloneInPrivateParty() + end + end + return f11_local0 +end + +local f0_local11 = function ( f12_arg0, f12_arg1 ) + local f12_local0 = Engine.GetDvarBool( "squad_match" ) + local f12_local1 = Engine.GetDvarBool( "squad_use_hosts_squad" ) + if f12_local0 and Lobby.IsInPrivateParty() and Lobby.IsPrivatePartyHost() then + Squad.PostMatch( 0, 0, 0, 0, true ) + Engine.NotifyServer( "end_game", 2 ) + elseif f12_local1 and Lobby.IsPrivatePartyHost() and Lobby.IsAloneInPrivateParty() and Lobby.IsAlone() then + Engine.NotifyServer( "end_game", 2 ) + elseif f0_local10( f12_arg0 ) then + LUI.FlowManager.RequestLeaveMenu( f12_arg0, true ) + LUI.FlowManager.RequestPopupMenu( f12_arg0, "popup_pull_party", false ) + else + Engine.Exec( "onPlayerQuit" ) + if Engine.GetDvarBool( "sv_running" ) then + f0_local6( f12_arg0 ) + else + f0_local5( f12_arg0 ) + end + LUI.FlowManager.RequestCloseAllMenus( f12_arg0 ) + end +end + +local f0_local12 = function () + local self = LUI.UIElement.new() + self.id = "end_game_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = -50, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + local f13_local1 = Engine.Localize( "@LUA_MENU_END_GAME_DESC" ) + local f13_local2 = Engine.Localize( "@LUA_MENU_LEAVE_GAME_TITLE" ) + if Engine.IsAliensMode() and Game.GetOmnvar( "ui_alien_is_solo" ) then + f13_local1 = Engine.Localize( "@ALIENS_LEAVE_GAME_DESC" ) + f13_local2 = Engine.Localize( "@MENU_NOTICE" ) + end + LUI.MenuBuilder.BuildAddChild( self, { + type = "generic_yesno_popup", + id = "privateGame_options_list_id", + properties = { + message_text_alignment = LUI.Alignment.Center, + message_text = f13_local1, + popup_title = f13_local2, + padding_top = 12, + yes_action = f0_local7 + } + } ) + local f13_local3 = LUI.UIBindButton.new() + f13_local3.id = "endBackToGameStartButton" + f13_local3:registerEventHandler( "button_start", f0_local0 ) + self:addElement( f13_local3 ) + return self +end + +local f0_local13 = function () + local self = LUI.UIElement.new() + self.id = "leave_game_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = -50, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "generic_yesno_popup", + id = "publicGame_options_list_id", + properties = { + message_text_alignment = LUI.Alignment.Center, + message_text = Engine.IsAliensMode() and Engine.Localize( "@ALIENS_LEAVE_GAME_DESC" ) or Engine.Localize( "@LUA_MENU_LEAVE_GAME_DESC" ), + popup_title = Engine.IsAliensMode() and Engine.Localize( "@MENU_NOTICE" ) or Engine.Localize( "@LUA_MENU_LEAVE_GAME_TITLE" ), + padding_top = 12, + yes_action = f0_local11 + } + } ) + local f14_local1 = LUI.UIBindButton.new() + f14_local1.id = "leaveBackToGameStartButton" + f14_local1:registerEventHandler( "button_start", f0_local0 ) + self:addElement( f14_local1 ) + return self +end + +local f0_local14 = function () + local self = LUI.UIElement.new() + self.id = "pull_party_out_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = -50, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "generic_yesno_popup", + id = "party_pullout_list_id", + properties = { + message_text_alignment = LUI.Alignment.Center, + message_text = Engine.Localize( "@LUA_MENU_PULL_PARTY_DESC" ), + popup_title = Engine.Localize( "@LUA_MENU_LEAVE_GAME_TITLE" ), + padding_top = 12, + yes_action = f0_local8, + no_action = f0_local9, + cancel_means_no = false + } + } ) + local f15_local1 = LUI.UIBindButton.new() + f15_local1.id = "leavePullPartyButton" + f15_local1:registerEventHandler( "button_start", f0_local0 ) + self:addElement( f15_local1 ) + return self +end + +LUI.MenuBuilder.registerType( "popup_end_game", f0_local12 ) +LUI.MenuBuilder.registerType( "popup_leave_game", f0_local13 ) +LUI.MenuBuilder.registerType( "popup_pull_party", f0_local14 ) +LockTable( _M ) diff --git a/lui/mp_hud/fireteamhud.dec.lua b/lui/mp_hud/fireteamhud.dec.lua new file mode 100644 index 0000000..a0a36ee --- /dev/null +++ b/lui/mp_hud/fireteamhud.dec.lua @@ -0,0 +1,152 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + if CoD.IsFireTeamMode() then + if Game.InKillCam() then + return + end + local f1_local0 = f1_arg0:getChildById( "tacticNameDef" ) + if f1_arg0.current_state ~= "active" then + f1_arg0.current_state = "active" + f1_local0:animateToState( "default", 0 ) + if Engine.GetDvarString( "ui_gametype" ) == "war" then + LUI.FlowManager.RequestAddMenu( f1_arg0, "mp_fire_team_menu_war", true, f1_arg1.controller, false ) + else + LUI.FlowManager.RequestAddMenu( f1_arg0, "mp_fire_team_menu", true, f1_arg1.controller, false ) + end + elseif f1_arg0.current_state ~= "default" then + f1_arg0.current_state = "default" + f1_local0:animateToState( "active", 0 ) + end + end +end + +f0_local1 = function () + return { + type = "UITimer", + id = "fireTeamHudTimerId", + properties = { + event = "update_tickables", + group = "hud", + interval = 200 + } + } +end + +f0_local2 = function () + return { + type = "UIText", + id = "botNameDef", + properties = { + text = "" + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + height = CoD.TextSettings.HudEuroBigFont.Height, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Center, + red = 1, + green = 1, + blue = 1, + alpha = 0 + }, + active = MBh.BaseState( "default", { + alpha = 1 + } ) + } + } +end + +local f0_local3 = function () + return { + type = "UIText", + id = "tacticNameDef", + properties = { + text = Engine.Localize( FireTeam.tactic_name ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 200, + height = CoD.TextSettings.HudEuroBigFont.Height, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Left, + red = 1, + green = 1, + blue = 1, + alpha = 0 + }, + active = MBh.BaseState( "default", { + alpha = 1 + } ) + } + } +end + +local f0_local4 = function ( f5_arg0, f5_arg1 ) + if CoD.IsFireTeamMode() then + local f5_local0 = f5_arg0:getChildById( "tacticNameDef" ) + if f5_local0.properties.text ~= FireTeam.tactic_name then + f5_local0:setText( Engine.Localize( FireTeam.tactic_name ) ) + f5_local0.properties.text = FireTeam.tactic_name + end + local f5_local1 = Game.GetPlayerstateClientnum() + if f5_arg0.client_num ~= f5_local1 and f5_local1 > 0 then + f5_arg0.client_num = f5_local1 + local f5_local2 = Game.GetPlayerScoreInfo( f5_local1 ) + local f5_local3 = f5_arg0:getChildById( "botNameDef" ) + f5_local3:setText( f5_local2.name or "" ) + end + end +end + +local f0_local5 = function ( f6_arg0, f6_arg1 ) + if CoD.IsFireTeamMode() then + local f6_local0 = f6_arg0:getChildById( "botNameDef" ) + f6_local0:animateToState( "active", 0 ) + end +end + +LUI.MenuBuilder.registerDef( "fireTeamHudDef", function () + local f7_local0 = { + type = "UIElement", + id = "fireTeamHud", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } + }, + properties = { + client_num = -1 + }, + handlers = { + menu_create = f0_local5, + toggle_scoreboard = f0_local0, + update_tickables = f0_local4 + } + } + local f7_local1 = {} + local f7_local2 = f0_local1() + local f7_local3 = f0_local2() + local f7_local4 = f0_local3() + f7_local0.children = f7_local2 + return f7_local0 +end ) +LockTable( _M ) diff --git a/lui/mp_hud/fireteammenu.dec.lua b/lui/mp_hud/fireteammenu.dec.lua new file mode 100644 index 0000000..61ba3e8 --- /dev/null +++ b/lui/mp_hud/fireteammenu.dec.lua @@ -0,0 +1,476 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 0 +f0_local1 = 0 +f0_local2 = 0 +local f0_local3 = 1 +local f0_local4 = 30 +local f0_local5 = f0_local4 / 2 +local f0_local6 = 40 / 2 +local f0_local7 = 0 +local f0_local8 = 80 +local f0_local9 = 60 +local f0_local10 = f0_local9 / 2 +local f0_local11 = 160 +local f0_local12 = function ( f1_arg0, f1_arg1, f1_arg2 ) + local f1_local0 = f1_arg0:getChildById( "fire_team_bg_" .. f1_arg1 ) + if f1_local0 ~= nil then + if f1_arg2 ~= nil then + f1_local0.properties.toggle_state = f1_arg2 + elseif f1_local0.properties.toggle_state == 1 then + f1_local0.properties.toggle_state = 0 + else + f1_local0.properties.toggle_state = 1 + end + if f1_local0.properties.toggle_state == 1 then + f1_local0:animateToState( "active", 0 ) + else + f1_local0:animateToState( "default", 0 ) + end + end +end + +local f0_local13 = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3 ) + return { + type = "UIImage", + id = "fire_team_bg_" .. f2_arg0, + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f2_arg3 - f0_local10, + left = f2_arg2 - f0_local10, + width = f0_local9, + height = f0_local9, + material = RegisterMaterial( "waypoint_captureneutral_" .. f2_arg1 ), + alpha = 1 + }, + active = MBh.BaseState( "default", { + material = RegisterMaterial( "waypoint_capture_" .. f2_arg1 ) + } ) + }, + properties = { + toggle_state = 0 + } + } +end + +local f0_local14 = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3 ) + return { + type = "UIText", + id = "fire_team_image_" .. f3_arg0, + properties = { + text = Engine.Localize( f3_arg1 ) + }, + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f3_arg3 - f0_local5, + left = f3_arg2 - f0_local5, + width = f0_local4, + height = f0_local4, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1 + } + } + } +end + +local f0_local15 = function ( f4_arg0, f4_arg1, f4_arg2, f4_arg3, f4_arg4 ) + return { + type = "UIText", + id = "fire_team_bg_" .. f4_arg0, + properties = { + text = Engine.Localize( f4_arg1 ), + toggle_state = 0 + }, + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f4_arg3 - 8, + left = f4_arg2, + width = 1, + height = 16, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = f4_arg4, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + active = MBh.BaseState( "default", { + red = 0.88, + green = 0.65, + blue = 0.17 + } ) + } + } +end + +local f0_local16 = function ( f5_arg0, f5_arg1 ) + Engine.NotifyServer( "tactics_menu", 1 ) + f0_local12( f5_arg0, "a", f0_local0 ) + f0_local12( f5_arg0, "b", f0_local1 ) + f0_local12( f5_arg0, "x", f0_local2 ) + f0_local12( f5_arg0, "y", f0_local3 ) + f5_arg0:processEvent( { + name = "mp_fire_team_on" + } ) +end + +local f0_local17 = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0:getChildById( "fire_team_bg_a" ) + local f6_local1 = f6_arg0:getChildById( "fire_team_bg_b" ) + local f6_local2 = f6_arg0:getChildById( "fire_team_bg_x" ) + local f6_local3 = f6_arg0:getChildById( "fire_team_bg_y" ) + f0_local0 = f6_local0.properties.toggle_state + f0_local1 = f6_local1.properties.toggle_state + f0_local2 = f6_local2.properties.toggle_state + f0_local3 = f6_local3.properties.toggle_state +end + +local f0_local18 = function ( f7_arg0 ) + local f7_local0 = f7_arg0:getChildById( "fire_team_bg_a" ) + local f7_local1 = f7_arg0:getChildById( "fire_team_bg_b" ) + local f7_local2 = f7_arg0:getChildById( "fire_team_bg_x" ) + if f7_local0.properties.toggle_state == 0 and f7_local1.properties.toggle_state == 0 and f7_local2.properties.toggle_state == 0 then + f0_local12( f7_arg0, "y", 1 ) + else + f0_local12( f7_arg0, "y", 0 ) + end +end + +local f0_local19 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = f8_arg0:getChildById( "fire_team_bg_a" ) + local f8_local1 = f8_arg0:getChildById( "fire_team_bg_b" ) + local f8_local2 = f8_arg0:getChildById( "fire_team_bg_x" ) + local f8_local3 = "" + if f8_local0.properties.toggle_state == 1 then + f8_local3 = f8_local3 .. "a" + end + if f8_local1.properties.toggle_state == 1 then + f8_local3 = f8_local3 .. "b" + end + if f8_local2.properties.toggle_state == 1 then + f8_local3 = f8_local3 .. "c" + end + local f8_local4 = { + = 1, + a = 2, + b = 3, + c = 4, + ab = 5, + ac = 6, + bc = 7, + abc = 8 + } + local f8_local5 = { + = "@MPUI_FT_TACTIC_NONE", + a = Engine.Localize( "@MPUI_FT_HOLD_1", "A" ), + b = Engine.Localize( "@MPUI_FT_HOLD_1", "B" ), + c = Engine.Localize( "@MPUI_FT_HOLD_1", "C" ), + ab = Engine.Localize( "@MPUI_FT_HOLD_2", "A", "B" ), + ac = Engine.Localize( "@MPUI_FT_HOLD_2", "A", "C" ), + bc = Engine.Localize( "@MPUI_FT_HOLD_2", "B", "C" ), + abc = Engine.Localize( "@MPUI_FT_HOLD_3" ) + } + FireTeam.tactic_name = f8_local5[f8_local3] + Engine.NotifyServer( "tactic_select", f8_local4[f8_local3] ) +end + +local f0_local20 = function ( f9_arg0, f9_arg1 ) + if f9_arg1.down then + if f9_arg1.button == "shoulderl" then + Engine.NotifyServer( "bot_select", -1 ) + elseif f9_arg1.button == "shoulderr" then + Engine.NotifyServer( "bot_select", 1 ) + elseif f9_arg1.button == "primary" then + f0_local12( f9_arg0, "a" ) + f0_local18( f9_arg0 ) + f0_local19( f9_arg0, f9_arg1 ) + elseif f9_arg1.button == "secondary" then + f0_local12( f9_arg0, "b" ) + f0_local18( f9_arg0 ) + f0_local19( f9_arg0, f9_arg1 ) + elseif f9_arg1.button == "alt1" then + f0_local12( f9_arg0, "x" ) + f0_local18( f9_arg0 ) + f0_local19( f9_arg0, f9_arg1 ) + elseif f9_arg1.button == "alt2" then + f0_local12( f9_arg0, "a", 0 ) + f0_local12( f9_arg0, "b", 0 ) + f0_local12( f9_arg0, "x", 0 ) + f0_local12( f9_arg0, "y", 1 ) + f0_local19( f9_arg0, f9_arg1 ) + elseif f9_arg1.button == "select" then + f9_arg0:dispatchEventToRoot( { + name = "toggle_scoreboard" + } ) + end + end +end + +local f0_local21 = function ( f10_arg0, f10_arg1 ) + if f10_arg1.down then + if f10_arg1.button == "shoulderl" then + Engine.NotifyServer( "bot_select", -1 ) + elseif f10_arg1.button == "shoulderr" then + Engine.NotifyServer( "bot_select", 1 ) + elseif f10_arg1.button == "primary" then + f0_local12( f10_arg0, "a", 1 ) + f0_local12( f10_arg0, "b", 0 ) + f0_local12( f10_arg0, "x", 0 ) + f0_local12( f10_arg0, "y", 0 ) + FireTeam.tactic_name = "@MPUI_FT_TACTIC_AMBUSH" + Engine.NotifyServer( "tactic_select", 2 ) + elseif f10_arg1.button == "secondary" then + f0_local12( f10_arg0, "a", 0 ) + f0_local12( f10_arg0, "b", 1 ) + f0_local12( f10_arg0, "x", 0 ) + f0_local12( f10_arg0, "y", 0 ) + FireTeam.tactic_name = "@MPUI_FT_TACTIC_BUDDY" + Engine.NotifyServer( "tactic_select", 3 ) + elseif f10_arg1.button == "alt1" then + f0_local12( f10_arg0, "a", 0 ) + f0_local12( f10_arg0, "b", 0 ) + f0_local12( f10_arg0, "x", 1 ) + f0_local12( f10_arg0, "y", 0 ) + FireTeam.tactic_name = "@MPUI_FT_TACTIC_HUNT" + Engine.NotifyServer( "tactic_select", 4 ) + elseif f10_arg1.button == "alt2" then + f0_local12( f10_arg0, "a", 0 ) + f0_local12( f10_arg0, "b", 0 ) + f0_local12( f10_arg0, "x", 0 ) + f0_local12( f10_arg0, "y", 1 ) + FireTeam.tactic_name = "@MPUI_FT_TACTIC_NONE" + Engine.NotifyServer( "tactic_select", 1 ) + elseif f10_arg1.button == "select" then + f10_arg0:dispatchEventToRoot( { + name = "toggle_scoreboard" + } ) + end + end +end + +local f0_local22 = function ( f11_arg0, f11_arg1 ) + Engine.NotifyServer( "tactics_menu", 0 ) + f0_local17( f11_arg0, nil ) + LUI.FlowManager.RequestCloseAllMenus( f11_arg0, nil ) +end + +local f0_local23 = function () + return { + type = "UIText", + id = "mp_fire_team_title", + properties = { + text = Engine.Localize( "@MPUI_FT_TACTICS" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + height = 30, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1 + } + } + } +end + +local f0_local24 = function () + return { + type = "UIImage", + id = "mp_fire_team_bg", + states = { + default = { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true, + top = 0, + left = 0, + material = RegisterMaterial( "black" ), + alpha = 0.7 + } + } + } +end + +local f0_local25 = function () + return { + type = "UIImage", + id = "mp_fire_team_title_line", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + top = 30, + height = 2, + material = RegisterMaterial( "white" ), + alpha = 0.3 + } + } + } +end + +local f0_local26 = 0 +local f0_local27 = 0 +local f0_local28 = 24 +local f0_local29 = 68 +local f0_local30 = 80 +local f0_local31 = 20 +local f0_local32 = function () + local f15_local0 = { + type = "UIElement", + id = "mp_fire_team_menu_id", + states = { + default = { + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false, + left = 110, + top = 210, + width = 0, + height = 200, + alpha = 0 + }, + opening = MBh.BaseState( "default", { + width = 300, + alpha = 0.25 + } ), + active = MBh.BaseState( "default", { + width = 280, + alpha = 1 + } ) + } + } + local f15_local1 = {} + local f15_local2 = f0_local24() + local f15_local3 = f0_local25() + local f15_local4 = f0_local23() + local f15_local5 = f0_local14( "a", "@PLATFORM_UI_SELECTBUTTON", f0_local26, f0_local27 + f0_local28 ) + local f15_local6 = f0_local13( "a", "a", f0_local26, f0_local27 + f0_local29 ) + local f15_local7 = f0_local14( "b", "@PLATFORM_BACK_BUTTON", f0_local26 + f0_local28, f0_local27 ) + local f15_local8 = f0_local13( "b", "b", f0_local26 + f0_local29, f0_local27 ) + local f15_local9 = f0_local14( "x", "@PLATFORM_CHALLENGE_BLADE_BUTTON", f0_local26 - f0_local28, f0_local27 ) + local f15_local10 = f0_local13( "x", "c", f0_local26 - f0_local29, f0_local27 ) + local f15_local11 = f0_local14( "y", "@PLATFORM_Y_BUTTON", f0_local26, f0_local27 - f0_local28 ) + local f15_local12 = f0_local15( "y", "@MPUI_FT_TACTIC_NONE", f0_local26, f0_local27 - f0_local28 - f0_local31 - 8, LUI.Alignment.Center ) + local f15_local13 = f0_local14( "lb", "@PLATFORM_FB_PREV_PAGE_BUTTON", f0_local26 - f0_local30, f0_local27 - 50 ) + local f15_local14 = f0_local15( "lb", "@MPUI_FT_PREV", f0_local26 - f0_local30 - f0_local31, f0_local27 - 50, LUI.Alignment.Right ) + local f15_local15 = f0_local14( "rb", "@PLATFORM_FB_NEXT_PAGE_BUTTON", f0_local26 + f0_local30, f0_local27 - 50 ) + local f15_local16 = f0_local15( "rb", "@MPUI_FT_NEXT", f0_local26 + f0_local30 + f0_local31, f0_local27 - 50, LUI.Alignment.Left ) + f15_local0.children = f15_local2 + f15_local0.handlers = { + menu_create = f0_local16, + gamepad_button = f0_local20, + toggle_scoreboard = f0_local22, + mp_fire_team_on = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 125 + }, + { + "active", + 125 + } + } ) + } + return f15_local0 +end + +local f0_local33 = 0 +local f0_local34 = 15 +local f0_local35 = 24 +local f0_local36 = 80 +local f0_local37 = 20 +local f0_local38 = function () + local f16_local0 = { + type = "UIElement", + id = "mp_fire_team_menu_id", + states = { + default = { + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false, + left = 110, + top = 210, + width = 0, + height = 150, + alpha = 0 + }, + opening = MBh.BaseState( "default", { + width = 300, + alpha = 0.25 + } ), + active = MBh.BaseState( "default", { + width = 280, + alpha = 1 + } ) + } + } + local f16_local1 = {} + local f16_local2 = f0_local24() + local f16_local3 = f0_local25() + local f16_local4 = f0_local23() + local f16_local5 = f0_local14( "a", "@PLATFORM_UI_SELECTBUTTON", f0_local33, f0_local34 + f0_local35 ) + local f16_local6 = f0_local15( "a", "@MPUI_FT_TACTIC_AMBUSH", f0_local33, f0_local34 + f0_local35 + f0_local37 + 2, LUI.Alignment.Center ) + local f16_local7 = f0_local14( "b", "@PLATFORM_BACK_BUTTON", f0_local33 + f0_local35, f0_local34 ) + local f16_local8 = f0_local15( "b", "@MPUI_FT_TACTIC_BUDDY", f0_local33 + f0_local35 + f0_local37, f0_local34 - 8, LUI.Alignment.Left ) + local f16_local9 = f0_local14( "x", "@PLATFORM_CHALLENGE_BLADE_BUTTON", f0_local33 - f0_local35, f0_local34 ) + local f16_local10 = f0_local15( "x", "@MPUI_FT_TACTIC_HUNT", f0_local33 - f0_local35 - f0_local37, f0_local34 - 8, LUI.Alignment.Right ) + local f16_local11 = f0_local14( "y", "@PLATFORM_Y_BUTTON", f0_local33, f0_local34 - f0_local35 ) + local f16_local12 = f0_local15( "y", "@MPUI_FT_TACTIC_NONE", f0_local33, f0_local34 - f0_local35 - f0_local37 - 2, LUI.Alignment.Center ) + local f16_local13 = f0_local14( "lb", "@PLATFORM_FB_PREV_PAGE_BUTTON", f0_local33 - f0_local36, f0_local34 - 40 ) + local f16_local14 = f0_local15( "lb", "@MPUI_FT_PREV", f0_local33 - f0_local36 - f0_local37, f0_local34 - 40, LUI.Alignment.Right ) + local f16_local15 = f0_local14( "rb", "@PLATFORM_FB_NEXT_PAGE_BUTTON", f0_local33 + f0_local36, f0_local34 - 40 ) + local f16_local16 = f0_local15( "rb", "@MPUI_FT_NEXT", f0_local33 + f0_local36 + f0_local37, f0_local34 - 40, LUI.Alignment.Left ) + f16_local0.children = f16_local2 + f16_local0.handlers = { + menu_create = f0_local16, + gamepad_button = f0_local21, + toggle_scoreboard = f0_local22, + mp_fire_team_on = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 125 + }, + { + "active", + 125 + } + } ) + } + return f16_local0 +end + +LUI.MenuBuilder.registerDef( "mp_fire_team_menu", f0_local32 ) +LUI.MenuBuilder.registerDef( "mp_fire_team_menu_war", f0_local38 ) +LockTable( _M ) diff --git a/lui/mp_hud/gamemessagehud.dec.lua b/lui/mp_hud/gamemessagehud.dec.lua new file mode 100644 index 0000000..d3494f3 --- /dev/null +++ b/lui/mp_hud/gamemessagehud.dec.lua @@ -0,0 +1,97 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + if f1_arg1 ~= nil and f1_arg1.bold ~= nil and f1_arg1.bold == true and f1_arg1.message ~= nil then + f1_arg0:setText( f1_arg1.message ) + local f1_local0 = MBh.AnimateSequence( { + { + "opening", + 0 + }, + { + "active", + 100 + }, + { + "active", + 2500 + }, + { + "default", + 100 + } + } ) + f1_local0( f1_arg0 ) + end +end + +LUI.MenuBuilder.registerDef( "gameMessageHudDef", function () + return { + type = "UIElement", + id = "gameMessageHudId", + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 200, + left = -32, + bottom = 32, + right = 32 + } + }, + children = { + { + type = "UIText", + id = "gameMessageTextId", + properties = { + text = "", + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = 0, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alpha = 0 + }, + opening = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -256, + bottom = CoD.TextSettings.HudEuroNormalFont.Height + 80, + right = 256, + alpha = 1 + }, + active = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -256, + bottom = CoD.TextSettings.HudEuroNormalFont.Height, + right = 256, + alpha = 1 + } + }, + handlers = { + game_message = f0_local0 + } + } + } + } +end ) +LockTable( _M ) diff --git a/lui/mp_hud/helicopterpilotoverlayhud.dec.lua b/lui/mp_hud/helicopterpilotoverlayhud.dec.lua new file mode 100644 index 0000000..f01da55 --- /dev/null +++ b/lui/mp_hud/helicopterpilotoverlayhud.dec.lua @@ -0,0 +1,751 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 512 +f0_local1 = 128 +f0_local2 = 512 +local f0_local3 = 128 +local f0_local4 = 64 +local f0_local5 = 64 +local f0_local6 = 32 +local f0_local7 = 64 +local f0_local8 = 32 +local f0_local9 = 64 +local f0_local10 = 192 +local f0_local11 = 192 +local f0_local12 = 16 +local f0_local13 = 16 +local f0_local14 = 256 +local f0_local15 = 256 +local f0_local16 = 192 +local f0_local17 = 192 +local f0_local18 = 192 +local f0_local19 = 192 +local f0_local20 = function ( f1_arg0, f1_arg1 ) + if f1_arg1.value > 0 then + f1_arg0:animateToState( "active", 0 ) + if not f1_arg0.played_flash then + local f1_local0 = f1_arg0:getFirstDescendentById( "heli_pilot_flash_image_id" ) + local f1_local1 = MBh.AnimateSequence( { + { + "active", + 0 + }, + { + "closing", + 500 + } + } ) + f1_local1( f1_local0 ) + f1_arg0.played_flash = true + end + local f1_local0 = f1_arg0:getFirstDescendentById( "heli_pilot_reticle_image_id" ) + local f1_local1 = f1_arg0:getFirstDescendentById( "heli_pilot_altitude_back_image_id" ) + local f1_local2 = f1_arg0:getFirstDescendentById( "heli_pilot_speed_back_image_id" ) + local f1_local3 = f1_arg0:getFirstDescendentById( "heli_pilot_reticle_zoomed_image_id" ) + local f1_local4 = f1_arg0:getFirstDescendentById( "heli_pilot_flare_back_image_id" ) + local f1_local5 = f1_arg0:getFirstDescendentById( "heli_pilot_mg_back_image_id" ) + if f1_arg1.value == 1 then + f1_local3:animateToState( "default", 0 ) + local f1_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 250 + } + } ) + f1_local6( f1_local0 ) + f1_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 400 + }, + { + "active", + 250 + } + } ) + f1_local6( f1_local1 ) + f1_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 350 + }, + { + "active", + 250 + } + } ) + f1_local6( f1_local2 ) + f1_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 250 + } + } ) + f1_local6( f1_local4 ) + f1_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 250 + } + } ) + f1_local6( f1_local5 ) + elseif f1_arg1.value == 2 then + f1_local0:animateToState( "default", 350 ) + f1_local1:animateToState( "default", 350 ) + f1_local2:animateToState( "default", 350 ) + f1_local4:animateToState( "default", 0 ) + f1_local5:animateToState( "default", 0 ) + local f1_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 250 + } + } ) + f1_local6( f1_local3 ) + end + else + f1_arg0.played_flash = false + f1_arg0:animateToState( "default", 0 ) + end +end + +local f0_local21 = function () + local f2_local0 = RegisterMaterial( "apache_ammo_mp" ) + local self = LUI.UIElement.new() + self.id = "flare_ammo_container" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = -5, + height = f0_local12 * 2, + width = f0_local13, + spacing = 0 + } ) + self:animateToState( "default", 0 ) + local f2_local2 = LUI.UIImage.new() + f2_local2.id = "flare_ammo1" + f2_local2:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 2, + right = 0, + height = f0_local12, + width = f0_local13, + material = f2_local0, + alpha = 1 + } ) + f2_local2:animateToState( "default", 0 ) + f2_local2:registerAnimationState( "inactive", { + alpha = 0 + } ) + local f2_local3 = LUI.UIImage.new() + f2_local3.id = "flare_ammo2" + f2_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 12, + right = 0, + height = f0_local12, + width = f0_local13, + material = f2_local0, + alpha = 1 + } ) + f2_local3:animateToState( "default", 0 ) + f2_local3:registerAnimationState( "inactive", { + alpha = 0 + } ) + self:addElement( f2_local2 ) + self:addElement( f2_local3 ) + return self +end + +local f0_local22 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0:getChildById( "flare_ammo_container" ) + if f3_arg1.value < 2 then + local f3_local1 = f3_local0:getChildById( "flare_ammo" .. f3_arg1.value + 1 ) + local f3_local2 = MBh.AnimateSequence( { + { + "inactive", + 50 + }, + { + "inactive", + 50 + }, + { + "default", + 0 + }, + { + "default", + 50 + }, + { + "inactive", + 50 + }, + { + "inactive", + 50 + }, + { + "default", + 0 + }, + { + "default", + 50 + }, + { + "inactive", + 150 + } + } ) + f3_local2( f3_local1 ) + f3_local1:animateToState( "inactive", 250 ) + else + local f3_local1 = f3_local0:getChildById( "flare_ammo1" ) + f3_local1:animateToState( "default", 0 ) + local f3_local2 = f3_local0:getChildById( "flare_ammo2" ) + f3_local2:animateToState( "default", 0 ) + end +end + +local f0_local23 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0:getChildById( "heli_pilot_warn_left_image_id" ) + local f4_local1 = f4_arg0:getChildById( "heli_pilot_warn_right_image_id" ) + local f4_local2 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 250 + }, + { + "default", + 250 + }, + { + "active", + 250 + }, + { + "default", + 250 + }, + { + "active", + 250 + }, + { + "default", + 250 + } + } ) + if f4_arg1.value == 1 then + f4_local2( f4_local0 ) + f4_local2( f4_local1 ) + elseif f4_arg1.value == 2 then + f4_local2( f4_local1 ) + elseif f4_arg1.value == 3 then + f4_local2( f4_local0 ) + end +end + +local f0_local24 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0:getChildById( "heli_pilot_flare_back_image_id" ) + local f5_local1 = f5_local0:getChildById( "heli_pilot_flare_text_id" ) + local f5_local2 = f5_local0:getChildById( "heli_pilot_zoom_text_id" ) + local f5_local3 = f5_arg0:getChildById( "heli_pilot_mg_back_image_id" ) + local f5_local4 = f5_local3:getChildById( "heli_pilot_mg_text_id" ) + f5_local1:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_POP_FLARE" ) ) + f5_local2:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_ZOOM" ) ) + f5_local4:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_FIRE" ) ) +end + +LUI.MenuBuilder.registerType( "heliPilotOverlayDef", function () + local f6_local0 = RegisterMaterial( "apache_altitude_back_mp" ) + local f6_local1 = RegisterMaterial( "apache_speed_back_mp" ) + local f6_local2 = RegisterMaterial( "apache_reticle_mp" ) + local f6_local3 = RegisterMaterial( "apache_flare_back_mp" ) + local f6_local4 = RegisterMaterial( "apache_mg_back_mp" ) + local f6_local5 = RegisterMaterial( "apache_zoom_overlay_mp" ) + local f6_local6 = RegisterMaterial( "apache_warn_lock_left_mp" ) + local f6_local7 = RegisterMaterial( "apache_warn_lock_right_mp" ) + local f6_local8 = RegisterMaterial( "apache_visor_mp" ) + local f6_local9 = RegisterMaterial( "pointflash" ) + local self = LUI.UIElement.new() + self.id = "heli_pilot_overlay_container_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_heli_pilot", f0_local20 ) + self:registerEventHandler( "init_overlay", f0_local20 ) + self:registerEventHandler( "refresh_controls", f0_local24 ) + local f6_local11 = LUI.UIImage.new() + f6_local11.id = "heli_pilot_visor_image_id" + f6_local11:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f6_local8, + alpha = 1 + } ) + f6_local11:animateToState( "default", 0 ) + local f6_local12 = LUI.UIImage.new() + f6_local12.id = "heli_pilot_flash_image_id" + f6_local12:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f0_local14, + left = -f0_local15, + bottom = f0_local14, + right = f0_local15, + material = f6_local9, + alpha = 0 + } ) + f6_local12:animateToState( "default", 0 ) + f6_local12:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f0_local14, + left = -f0_local15, + bottom = f0_local14, + right = f0_local15, + alpha = 1 + } ) + f6_local12:registerAnimationState( "closing", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f0_local14 * -2, + left = -f0_local15 * 100, + bottom = f0_local14 * -2, + right = f0_local15 * 100, + alpha = 0 + } ) + local f6_local13 = LUI.UIImage.new() + f6_local13.id = "heli_pilot_reticle_image_id" + f6_local13:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f6_local2, + alpha = 0 + } ) + f6_local13:animateToState( "default", 0 ) + f6_local13:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(f0_local4 * 0.5) - 40, + left = -(f0_local5 * 0.5) - 40, + bottom = f0_local4 * 0.5 + 40, + right = f0_local5 * 0.5 + 40, + alpha = 0 + } ) + f6_local13:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f0_local4 * 0.5, + left = -f0_local5 * 0.5, + bottom = f0_local4 * 0.5, + right = f0_local5 * 0.5, + alpha = 1 + } ) + local f6_local14 = LUI.UIImage.new() + f6_local14.id = "heli_pilot_reticle_zoomed_image_id" + f6_local14:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f6_local5, + alpha = 0 + } ) + f6_local14:animateToState( "default", 0 ) + f6_local14:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(f0_local10 * 0.5) - 40, + left = -(f0_local11 * 0.5) - 40, + bottom = f0_local10 * 0.5 + 40, + right = f0_local11 * 0.5 + 40, + zRot = 180, + alpha = 0 + } ) + f6_local14:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f0_local10 * 0.5, + left = -f0_local11 * 0.5, + bottom = f0_local10 * 0.5, + right = f0_local11 * 0.5, + zRot = 0, + alpha = 1 + } ) + local f6_local15 = LUI.UIImage.new() + f6_local15.id = "heli_pilot_altitude_back_image_id" + f6_local15:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -(f0_local0 * 0.5) + 500, + left = -500, + bottom = f0_local0 * 0.5 - 500, + width = f0_local1, + material = f6_local0, + alpha = 0 + } ) + f6_local15:animateToState( "default", 0 ) + f6_local15:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -(f0_local0 * 0.5) - 10, + left = 110, + bottom = f0_local0 * 0.5 + 10, + width = f0_local1, + alpha = 1 + } ) + f6_local15:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -(f0_local0 * 0.5), + left = 100, + bottom = f0_local0 * 0.5, + width = f0_local1, + alpha = 1 + } ) + local f6_local16 = LUI.UIImage.new() + f6_local16.id = "heli_pilot_speed_back_image_id" + f6_local16:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = -(f0_local2 * 0.5) + 500, + right = 500, + bottom = f0_local2 * 0.5 - 500, + width = f0_local3, + material = f6_local1, + alpha = 0 + } ) + f6_local16:animateToState( "default", 0 ) + f6_local16:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = -(f0_local2 * 0.5) - 10, + right = -110, + bottom = f0_local2 * 0.5 + 10, + width = f0_local3, + alpha = 1 + } ) + f6_local16:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = -(f0_local2 * 0.5), + right = -100, + bottom = f0_local2 * 0.5, + width = f0_local3, + alpha = 1 + } ) + local f6_local17 = LUI.UIImage.new() + f6_local17.id = "heli_pilot_flare_back_image_id" + f6_local17:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 100, + left = 250, + bottom = 100, + width = f0_local7, + material = f6_local3, + alpha = 0 + } ) + f6_local17:animateToState( "default", 0 ) + f6_local17:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 100 - f0_local6 * 0.5 - 40, + left = 210, + bottom = 100 + f0_local6 * 0.5 + 40, + width = f0_local7, + alpha = 0 + } ) + f6_local17:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 100 - f0_local6 * 0.5, + left = 250, + bottom = 100 + f0_local6 * 0.5, + width = f0_local7, + alpha = 1 + } ) + f6_local17:registerOmnvarHandler( "ui_heli_pilot_flare_ammo", f0_local22 ) + local f6_local18 = LUI.UIText.new() + f6_local18.id = "heli_pilot_flare_text_id" + f6_local18:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_POP_FLARE" ) ) + f6_local18:setTextStyle( CoD.TextStyle.Shadowed ) + f6_local18:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 30, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 256, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f6_local18:animateToState( "default", 0 ) + local f6_local19 = LUI.UIText.new() + f6_local19.id = "heli_pilot_zoom_text_id" + f6_local19:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_ZOOM" ) ) + f6_local19:setTextStyle( CoD.TextStyle.Shadowed ) + f6_local19:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 50, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 256, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f6_local19:animateToState( "default", 0 ) + f6_local17:addElement( f0_local21() ) + f6_local17:addElement( f6_local18 ) + f6_local17:addElement( f6_local19 ) + local f6_local20 = LUI.UIImage.new() + f6_local20.id = "heli_pilot_mg_back_image_id" + f6_local20:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 100, + right = -250, + bottom = 100, + width = f0_local9, + material = f6_local4, + alpha = 0 + } ) + f6_local20:animateToState( "default", 0 ) + f6_local20:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 100 - f0_local8 * 0.5 - 40, + right = -210, + bottom = 100 + f0_local8 * 0.5 + 40, + width = f0_local9, + alpha = 0 + } ) + f6_local20:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 100 - f0_local8 * 0.5, + right = -250, + bottom = 100 + f0_local8 * 0.5, + width = f0_local9, + alpha = 1 + } ) + local f6_local21 = LUI.UIText.new() + f6_local21.id = "heli_pilot_mg_text_id" + f6_local21:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_FIRE" ) ) + f6_local21:setTextStyle( CoD.TextStyle.Shadowed ) + f6_local21:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = 30, + right = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 256, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right + } ) + f6_local21:animateToState( "default", 0 ) + f6_local20:addElement( f6_local21 ) + local f6_local22 = LUI.UIElement.new() + f6_local22.id = "heli_pilot_warn_container" + f6_local22:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f0_local16 / 2, + left = -440, + bottom = f0_local16 / 2, + right = 440 + } ) + f6_local22:animateToState( "default", 0 ) + f6_local22:registerOmnvarHandler( "ui_heli_pilot_warn", f0_local23 ) + local f6_local23 = LUI.UIImage.new() + f6_local23.id = "heli_pilot_warn_left_image_id" + f6_local23:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f0_local16, + width = f0_local17, + material = f6_local6, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f6_local23:animateToState( "default", 0 ) + f6_local23:registerAnimationState( "active", { + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b, + alpha = 1 + } ) + local f6_local24 = LUI.UIImage.new() + f6_local24.id = "heli_pilot_warn_right_image_id" + f6_local24:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + height = f0_local18, + width = f0_local19, + material = f6_local7, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f6_local24:animateToState( "default", 0 ) + f6_local24:registerAnimationState( "active", { + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b, + alpha = 1 + } ) + f6_local22:addElement( f6_local23 ) + f6_local22:addElement( f6_local24 ) + self:addElement( f6_local11 ) + self:addElement( f6_local12 ) + self:addElement( f6_local13 ) + self:addElement( f6_local14 ) + self:addElement( f6_local15 ) + self:addElement( f6_local16 ) + self:addElement( f6_local17 ) + self:addElement( f6_local20 ) + self:addElement( f6_local22 ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/hints.dec.lua b/lui/mp_hud/hints.dec.lua new file mode 100644 index 0000000..4b555f5 --- /dev/null +++ b/lui/mp_hud/hints.dec.lua @@ -0,0 +1,182 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 0.65 +function mantleHintDef() + local self = LUI.UIElement.new() + self.id = "mantleHintId" + self:setupOwnerdraw( CoD.Ownerdraw.CGMantleHint, f0_local0, CoD.TextStyle.Shadowed ) + local f1_local1 = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -80, + left = -32, + right = 32, + height = 64, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 0.6 + } + if Engine.UsingSplitscreenUpscaling() then + f1_local1.bottom = -20 + end + self:registerAnimationState( "default", f1_local1 ) + self:animateToState( "default", 0 ) + return self +end + +function cursorHintDef() + local self = LUI.UIElement.new() + self.id = "cursorHintId" + self:setupOwnerdraw( CoD.Ownerdraw.CGCursorHint, f0_local0, CoD.TextStyle.Shadowed ) + local f2_local1 = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -160, + left = -32, + right = 32, + height = 64, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 0.6 + } + if Engine.UsingSplitscreenUpscaling() then + f2_local1.bottom = -60 + end + self:registerAnimationState( "default", f2_local1 ) + self:animateToState( "default", 0 ) + return self +end + +function invalidCmdHintDef() + local self = LUI.UIElement.new() + self.id = "invalidCmdHintId" + self:setupOwnerdraw( CoD.Ownerdraw.CGInvalidCmdHint, f0_local0, CoD.TextStyle.Shadowed ) + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 162, + left = -32, + right = 32, + height = 64, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 0.6 + } ) + self:animateToState( "default", 0 ) + return self +end + +function spectatorControlsDef() + local self = LUI.UIElement.new() + self.id = "spectatorControlsId" + self:setupOwnerdraw( CoD.Ownerdraw.CGSpectatorControls, f0_local0, CoD.TextStyle.Shadowed ) + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -5, + left = 10, + height = 5, + width = 512, + alignment = CoD.OwnerdrawAlignment.TextTopLeft, + font = CoD.TextSettings.HudEuroConRegTinyFont.Font, + alpha = 0.6 + } ) + self:animateToState( "default", 0 ) + return self +end + +function breathHintDef() + local self = LUI.UIElement.new() + self.id = "breathHintId" + self:setupOwnerdraw( CoD.Ownerdraw.CGHoldBreathHint, f0_local0, CoD.TextStyle.Shadowed ) + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 40, + left = -32, + right = 32, + height = 64, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 0.6 + } ) + self:animateToState( "default", 0 ) + return self +end + +function zoomHintDef() + local self = LUI.UIElement.new() + self.id = "zoomHintId" + self:setupOwnerdraw( CoD.Ownerdraw.CGChangeZoomHint, f0_local0, CoD.TextStyle.Shadowed ) + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 70, + left = -32, + right = 32, + height = 64, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 0.6 + } ) + self:animateToState( "default", 0 ) + return self +end + +function toggleHybridHintDef() + local self = LUI.UIElement.new() + self.id = "toggleHybridHintId" + self:setupOwnerdraw( CoD.Ownerdraw.CGToggleHybridHint, f0_local0, CoD.TextStyle.Shadowed ) + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 40, + left = -32, + right = 32, + height = 64, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 0.6 + } ) + self:animateToState( "default", 0 ) + return self +end + +function toggleThermalHintDef() + local self = LUI.UIElement.new() + self.id = "toggleThermalHintId" + self:setupOwnerdraw( CoD.Ownerdraw.CGToggleThermalHint, f0_local0, CoD.TextStyle.Shadowed ) + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 40, + left = -32, + right = 32, + height = 64, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 0.6 + } ) + self:animateToState( "default", 0 ) + return self +end + +LockTable( _M ) diff --git a/lui/mp_hud/hordehud.dec.lua b/lui/mp_hud/hordehud.dec.lua new file mode 100644 index 0000000..759a729 --- /dev/null +++ b/lui/mp_hud/hordehud.dec.lua @@ -0,0 +1,646 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = "" +f0_local1 = 0 +f0_local2 = 5 +local f0_local3 = function ( f1_arg0, f1_arg1 ) + if f1_arg1.value < 1 then + return + else + local f1_local0 = MBh.AnimateSequence( { + { + "active", + 50 + }, + { + "default", + 1000 + } + } ) + f1_local0( f1_arg0 ) + end +end + +local f0_local4 = function () + local f2_local0 = Game.GetPlayerWeaponName() + if f2_local0 == "none" then + return f2_local0 + end + local f2_local1 = string.find( f2_local0, "_" ) + local f2_local2 = string.sub( f2_local0, 1, f2_local1 - 1 ) + if f2_local2 == "iw5" or f2_local2 == "iw6" then + f2_local2 = string.sub( f2_local0, 1, string.find( f2_local0, "_", f2_local1 + 1 ) - 1 ) + end + return f2_local2 +end + +local f0_local5 = function ( menu, controller ) + local self = LUI.UIElement.new() + self.id = "killstreak_limit" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = -445 + } ) + self:animateToState( "default", 0 ) + local f3_local1 = LUI.UIText.new() + f3_local1.id = "killstreak_limit_text" + f3_local1:setText( Engine.Localize( "@HORDE_KILLSTREAK_LIMIT" ) ) + f3_local1:setTextStyle( CoD.TextStyle.Shadowed ) + f3_local1:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + height = CoD.TextSettings.HudIW6BigFont.Height, + font = CoD.TextSettings.HudIW6BigFont.Font, + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b, + alignment = LUI.Alignment.Center, + alpha = 0 + } ) + f3_local1:registerAnimationState( "active", { + alpha = 1 + } ) + f3_local1:animateToState( "default", 0 ) + f3_local1:registerOmnvarHandler( "ui_killstreak_limit", f0_local3 ) + self:addElement( f3_local1 ) + return self +end + +local f0_local6 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0:getChildById( "point" .. f0_local1 ) + if f4_local0 ~= nil then + local f4_local1 = f4_local0:getFirstChild() + if f4_local1 ~= nil then + f4_local1:setText( "+" .. f4_arg1.value ) + f4_local0:registerAnimationState( "large", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + left = math.random( 140, 290 ), + top = math.random( 40, 190 ), + width = 102, + height = CoD.TextSettings.HudEuroMedSmallFont.Height * 1.5, + alpha = 1 + } ) + local f4_local2 = MBh.AnimateSequence( { + { + "large", + 0 + }, + { + "default", + 1000 + } + } ) + f4_local2( f4_local0, nil ) + end + end + f0_local1 = (f0_local1 + 1) % f0_local2 +end + +local f0_local7 = function ( f5_arg0 ) + local self = LUI.UIElement.new() + self.id = "point" .. f5_arg0 + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + left = 180, + top = 60, + width = 128, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + local f5_local1 = LUI.UIText.new() + f5_local1.id = "point_text" + f5_local1:setText( "+" .. math.random( 10, 60 ) ) + f5_local1:setTextStyle( CoD.TextStyle.Shadowed ) + f5_local1:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alignment = LUI.Alignment.Center + } ) + f5_local1:animateToState( "default", 0 ) + self:addElement( f5_local1 ) + return self +end + +local f0_local8 = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f0_local4() + local f6_local1 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Ref, f6_local0, HordeIconsTable.Cols.Image ) + local f6_local2 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Ref, f6_local0, HordeIconsTable.Cols.Misc ) + local f6_local3 = RegisterMaterial( f6_local1 ) + local f6_local4 = f6_arg0:getChildById( "weaponImage" ) + if f6_local1 ~= "" then + CoD.SetMaterial( f6_local4, f6_local3 ) + if f6_local2 == "weapon_pistol" then + if f6_local0 == "iw6_magnumhorde" then + f6_local4:animateToState( "magnum", 0 ) + else + f6_local4:animateToState( "pistol", 0 ) + end + elseif f6_local2 == "weapon_sniper" or f6_local2 == "weapon_shotgun" then + f6_local4:animateToState( "sniper_shot", 0 ) + elseif f6_local2 == "weapon_lmg" then + f6_local4:animateToState( "lmg", 0 ) + else + f6_local4:animateToState( "other", 0 ) + end + end +end + +local f0_local9 = function ( f7_arg0, f7_arg1 ) + f0_local8( f7_arg0, f7_arg1 ) +end + +local f0_local10 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = f8_arg0:getFirstDescendentById( "middle" ) + f8_local0:registerAnimationState( "move_bar", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + width = f8_arg1.value / 100 * f8_local0.m_width, + height = f8_local0.m_height + } ) + f8_local0:animateToState( "move_bar", 150 ) +end + +local f0_local11 = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_arg4, f9_arg5, f9_arg6, f9_arg7, f9_arg8 ) + local f9_local0 = RegisterMaterial( f9_arg6 ) + local f9_local1 = RegisterMaterial( f9_arg7 ) + local self = LUI.UIHorizontalList.new() + self.id = f9_arg0 + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = f9_arg2, + left = f9_arg1, + height = f9_arg5, + width = f9_arg4, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerOmnvarHandler( f9_arg8, f0_local10 ) + local f9_local3 = LUI.UIImage.new() + f9_local3.id = "middle" + f9_local3.m_width = f9_arg4 + f9_local3.m_height = f9_arg5 + f9_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f9_arg5, + width = 0, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + material = f9_local0, + alpha = 1 + } ) + f9_local3:registerAnimationState( "full", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f9_arg5, + width = f9_arg4, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + material = f9_local0, + alpha = 1 + } ) + f9_local3:animateToState( "default", 0 ) + local f9_local4 = LUI.UIImage.new() + f9_local4.id = "end" + f9_local4:registerAnimationState( "default", { + topAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + height = f9_arg5, + width = f9_arg3, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + material = f9_local1, + alpha = 1 + } ) + f9_local4:animateToState( "default", 0 ) + self:addElement( f9_local3 ) + self:addElement( f9_local4 ) + return self +end + +local f0_local12 = function ( f10_arg0, f10_arg1 ) + f10_arg0:setText( f10_arg1.value ) +end + +local f0_local13 = function ( f11_arg0, f11_arg1 ) + f11_arg0:setText( f11_arg1.value ) +end + +local f0_local14 = function () + local f12_local0 = 56 + local f12_local1 = 206 + local f12_local2 = CoD.TextSettings.HudEuroMedSmallFont + local f12_local3 = CoD.TextSettings.HudDigitalExtraBigFont + local f12_local4 = 250 + local f12_local5 = RegisterMaterial( "hud_safeguard_roundback" ) + local self = LUI.UIElement.new() + self.id = "horde_hud_round" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + left = 10, + bottom = -10, + height = f12_local0, + width = f12_local1 + } ) + self:animateToState( "default", 0 ) + local f12_local7 = LUI.UIImage.new() + f12_local7.id = "round_bg" + f12_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f12_local0, + width = f12_local1, + material = f12_local5, + alpha = 0.7 + } ) + f12_local7:animateToState( "default", 0 ) + local f12_local8 = LUI.UIText.new() + f12_local8.id = "round_text" + f12_local8:setTextStyle( CoD.TextStyle.Shadowed ) + f12_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 6, + left = 10, + width = 64, + height = f12_local2.Height, + font = f12_local2.Font, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f12_local8:registerAnimationState( "active", { + alpha = 1 + } ) + f12_local8:animateToState( "default", 0 ) + f12_local8:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 500 + } + } ) ) + f12_local8:setText( Engine.Localize( "@MP_HORDE_ROUND_NUM" ) ) + local f12_local9 = LUI.UIText.new() + f12_local9.id = "round_number_bg" + f12_local9:setText( "888" ) + f12_local9:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + left = 79, + bottom = -6, + height = f12_local3.Height, + width = 80, + font = f12_local3.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0, + alpha = 0 + } ) + f12_local9:registerAnimationState( "active", { + alpha = 0.25 + } ) + f12_local9:animateToState( "default", 0 ) + f12_local9:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 500 + } + } ) ) + local f12_local10 = LUI.UIText.new() + f12_local10.id = "round_number" + f12_local10:setText( "1" ) + f12_local10:setTextStyle( CoD.TextStyle.Shadowed ) + f12_local10:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + left = 79, + bottom = -6, + height = f12_local3.Height, + width = 80, + font = f12_local3.Font, + alignment = LUI.Alignment.Right, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f12_local10:registerAnimationState( "active", { + alpha = 1 + } ) + f12_local10:animateToState( "default", 0 ) + f12_local10:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 500 + } + } ) ) + f12_local10:registerOmnvarHandler( "ui_horde_round_number", f0_local13 ) + self:addElement( f12_local7 ) + self:addElement( f12_local8 ) + self:addElement( f12_local9 ) + self:addElement( f12_local10 ) + return self +end + +LUI.MenuBuilder.registerType( "hordeHudDef", function () + local f13_local0 = 64 + local f13_local1 = 500 + local f13_local2 = CoD.TextSettings.HudDigitalExtraBigFont + local f13_local3 = 250 + local f13_local4 = RegisterMaterial( "hud_safeguard_levelback" ) + local self = LUI.UIElement.new() + self.id = "horde_hud" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } ) + self:animateToState( "default", 0 ) + local f13_local6 = LUI.UIElement.new() + f13_local6.id = "horde_hud_weapon_support" + f13_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 20, + left = 10, + height = 400, + width = 400 + } ) + f13_local6:animateToState( "default", 0 ) + f13_local6:registerEventHandler( "weapon_change", f0_local8 ) + f13_local6:registerOmnvarHandler( "ui_horde_award_points", f0_local6 ) + f13_local6:registerEventHandler( "menu_create", f0_local9 ) + local f13_local7 = LUI.UIImage.new() + f13_local7.id = "bar_bg" + f13_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f13_local0, + width = f13_local1, + red = 1, + blue = 1, + green = 1, + material = f13_local4, + alpha = 0.7 + } ) + f13_local7:animateToState( "default", 0 ) + local f13_local8 = LUI.UIText.new() + f13_local8.id = "supportDropText" + f13_local8:setText( Engine.Localize( "@MP_HORDE_NEXT_AIR_DROP" ) ) + f13_local8:setTextStyle( CoD.TextStyle.Shadowed ) + f13_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 64, + left = 0, + width = 128, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f13_local8:registerAnimationState( "active", { + alpha = 1 + } ) + f13_local8:animateToState( "default", 0 ) + f13_local8:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 500 + } + } ) ) + local f13_local9 = LUI.UIText.new() + f13_local9.id = "weaponLevelTextBG" + f13_local9:setText( "888" ) + f13_local9:setTextStyle( CoD.TextStyle.Shadowed ) + f13_local9:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 3, + left = 3, + width = 75, + height = f13_local2.Height, + font = f13_local2.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0, + alpha = 0 + } ) + f13_local9:registerAnimationState( "active", { + alpha = 0.1 + } ) + f13_local9:animateToState( "default", 0 ) + f13_local9:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 500 + } + } ) ) + local f13_local10 = LUI.UIText.new() + f13_local10.id = "weaponLevelText" + f13_local10:setText( "1" ) + f13_local10:setTextStyle( CoD.TextStyle.Shadowed ) + f13_local10:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 3, + left = 3, + width = 75, + height = f13_local2.Height, + font = f13_local2.Font, + alignment = LUI.Alignment.Right, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f13_local10:registerAnimationState( "active", { + alpha = 1 + } ) + f13_local10:animateToState( "default", 0 ) + f13_local10:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 500 + } + } ) ) + f13_local10:registerOmnvarHandler( "ui_horde_weapon_level", f0_local12 ) + local f13_local11 = LUI.UIImage.new() + f13_local11.id = "weaponImage" + f13_local11:registerAnimationState( "pistol", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -10, + left = 175, + height = 64, + width = -128, + alpha = 1 + } ) + f13_local11:registerAnimationState( "magnum", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -10, + left = 195, + height = 64, + width = -128, + alpha = 1 + } ) + f13_local11:registerAnimationState( "sniper_shot", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -16, + left = 210, + height = 64, + width = -128, + alpha = 1 + } ) + f13_local11:registerAnimationState( "lmg", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -15, + left = 210, + height = 64, + width = -128, + alpha = 1 + } ) + f13_local11:registerAnimationState( "other", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -12, + left = 210, + height = 64, + width = -128, + alpha = 1 + } ) + f13_local11:animateToState( "pistol", 0 ) + f13_local6:addElement( f13_local7 ) + f13_local6:addElement( f0_local11( "weaponLevel", 105, 24, 26, 168, 25, "hud_safeguard_weapon_bar", "hud_safeguard_weapon_end", "ui_horde_weapon_progress" ) ) + f13_local6:addElement( f0_local11( "supportDrop", 9, 50, 16, 268, 12, "hud_safeguard_support_bar", "hud_safeguard_support_end", "ui_horde_support_drop_progress" ) ) + for f13_local12 = 0, f0_local2 - 1, 1 do + f13_local6:addElement( f0_local7( f13_local12 ) ) + end + f13_local6:addElement( f13_local8 ) + f13_local6:addElement( f13_local9 ) + f13_local6:addElement( f13_local10 ) + f13_local6:addElement( f13_local11 ) + f13_local6:addElement( LUI.MenuBuilder.buildItems( { + type = "talkerHudDef" + }, f13_local6.properties, f13_local6 ) ) + self:addElement( f13_local6 ) + self:addElement( f0_local5() ) + return self +end ) +LUI.MenuBuilder.registerType( "hordeRoundHudDef", f0_local14 ) +LockTable( _M ) diff --git a/lui/mp_hud/hordeperkshud.dec.lua b/lui/mp_hud/hordeperkshud.dec.lua new file mode 100644 index 0000000..83839b8 --- /dev/null +++ b/lui/mp_hud/hordeperkshud.dec.lua @@ -0,0 +1,437 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = 32 + local f1_local1 = 32 + local f1_local2, f1_local3, f1_local4, f1_local5, f1_local6, f1_local7 = nil + if f1_arg1.value > 0 then + f1_local3 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Index, f1_arg1.value, HordeIconsTable.Cols.Image ) + f1_local4 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Index, f1_arg1.value, HordeIconsTable.Cols.Name ) + f1_local5 = f1_arg0:getChildById( "horde_hud_perk_container_" .. f1_local4 ) + if f1_local5 then + f1_local6 = f1_local5:getChildById( "horde_hud_perk_image_bg" .. f1_local4 ) + f1_local7 = f1_local5:getChildById( "horde_hud_perk_image_" .. f1_local4 ) + end + f1_local2 = RegisterMaterial( f1_local3 ) + elseif f1_arg1.value < 0 then + f1_local4 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Index, f1_arg1.value * -1, HordeIconsTable.Cols.Name ) + f1_local5 = f1_arg0:getChildById( "horde_hud_perk_container_" .. f1_local4 ) + if f1_local5 then + f1_local6 = f1_local5:getChildById( "horde_hud_perk_image_bg" .. f1_local4 ) + f1_local7 = f1_local5:getChildById( "horde_hud_perk_image_" .. f1_local4 ) + end + end + if f1_arg1.value > 0 and not f1_local7 then + local self = LUI.UIElement.new() + self.id = "horde_hud_perk_container_" .. f1_local4 + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + left = 0, + height = f1_local0, + width = f1_local1, + material = f1_local2, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + local f1_local9 = LUI.UIImage.new() + f1_local9.id = "horde_hud_perk_image_bg" .. f1_local4 + f1_local9:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f1_local0 / 2.1, + left = -f1_local1 / 2.1, + bottom = f1_local0 / 1.9, + right = f1_local1 / 1.9, + material = f1_local2, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 0 + } ) + f1_local9:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f1_local0 / 1.4, + left = -f1_local1 / 1.4, + bottom = f1_local0 / 1.2, + right = f1_local1 / 1.2, + material = f1_local2, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 0.1 + } ) + f1_local9:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f1_local0 / 2.1, + left = -f1_local1 / 2.1, + bottom = f1_local0 / 1.9, + right = f1_local1 / 1.9, + material = f1_local2, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 0.5 + } ) + f1_local9:registerAnimationState( "flash", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f1_local0 / 1.6, + left = -f1_local1 / 1.6, + bottom = f1_local0 / 1.4, + right = f1_local1 / 1.4, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 0.3 + } ) + f1_local9:animateToState( "default", 0 ) + local f1_local10 = LUI.UIImage.new() + f1_local10.id = "horde_hud_perk_image_" .. f1_local4 + f1_local10:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f1_local0 / 2, + left = -f1_local1 / 2, + bottom = f1_local0 / 2, + right = f1_local1 / 2, + material = f1_local2, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f1_local10:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f1_local0 / 1.3, + left = -f1_local1 / 1.3, + bottom = f1_local0 / 1.3, + right = f1_local1 / 1.3, + material = f1_local2, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0.5 + } ) + f1_local10:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f1_local0 / 2, + left = -f1_local1 / 2, + bottom = f1_local0 / 2, + right = f1_local1 / 2, + material = f1_local2, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f1_local10:registerAnimationState( "flash", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f1_local0 / 1.5, + left = -f1_local1 / 1.5, + bottom = f1_local0 / 1.5, + right = f1_local1 / 1.5, + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b, + alpha = 0.8 + } ) + f1_local10:animateToState( "default", 0 ) + self:addElement( f1_local9 ) + self:addElement( f1_local10 ) + f1_arg0:addElement( self ) + local f1_local11 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 100 + }, + { + "active", + 50 + } + } ) + f1_local11( f1_local9 ) + f1_local11 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 100 + }, + { + "active", + 50 + } + } ) + f1_local11( f1_local10 ) + elseif f1_local7 then + if f1_arg1.value > 0 and not f1_local7.isFlashing then + local self = MBh.AnimateLoop( { + { + "flash", + 300 + }, + { + "active", + 700 + } + } ) + self( f1_local6 ) + self = MBh.AnimateLoop( { + { + "flash", + 300 + }, + { + "active", + 700 + } + } ) + self( f1_local7 ) + f1_local7.isFlashing = true + elseif f1_arg1.value > 0 and f1_local7.isFlashing == true then + local self = MBh.AnimateToState( "active" ) + self( f1_local6 ) + self = MBh.AnimateToState( "active" ) + self( f1_local7 ) + f1_local7.isFlashing = false + elseif f1_arg1.value < 0 then + f1_local5:close() + end + else + f1_local5 = f1_arg0:getFirstChild() + while f1_local5 ~= nil do + local self = f1_local5:getNextSibling() + f1_local5:close() + f1_local5 = self + end + end +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0:getChildById( "horde_hud_exp_ammo_image" ) + if f2_arg1.value > 0 and not f2_local0.shown then + local f2_local1 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 100 + }, + { + "active", + 50 + } + } ) + f2_local1( f2_arg0 ) + f2_local0.shown = true + elseif f2_arg1.value > 0 and not f2_local0.flashing then + local f2_local1 = MBh.AnimateLoop( { + { + "flash", + 300 + }, + { + "default", + 700 + } + } ) + f2_local1( f2_local0 ) + f2_local0.flashing = true + else + f2_local0.shown = false + f2_local0.flashing = false + local f2_local1 = MBh.AnimateToState( "default" ) + f2_local1( f2_local0 ) + f2_arg0:animateToState( "default", 0 ) + end +end + +f0_local2 = function () + local self = LUI.UIHorizontalList.new() + self.id = "horde_hud_perks" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + spacing = 0 + } ) + self:animateToState( "default", 0 ) + self:registerOmnvarHandler( "ui_horde_update_perk", f0_local0 ) + return self +end + +local f0_local3 = function () + local f4_local0 = 250 + local f4_local1 = 32 + local f4_local2 = 416 + local f4_local3 = 12 + local f4_local4 = 205 + local self = LUI.UIElement.new() + self.id = "horde_hud_perks_container" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -f4_local3, + left = f4_local3 + f4_local4, + height = f4_local1, + width = 0 + } ) + self:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -f4_local3, + left = f4_local3 + f4_local4, + height = f4_local1, + width = f4_local2, + alpha = 1 + } ) + self:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -f4_local3, + left = f4_local3 + f4_local4, + height = f4_local1, + width = f4_local2 + 40, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + f4_local0 / 2 + }, + { + "active", + f4_local0 / 2 + } + } ) ) + self:addElement( f0_local2() ) + return self +end + +local f0_local4 = function () + local f5_local0 = 40 + local f5_local1 = 40 + local f5_local2 = 250 + local f5_local3 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Ref, "specialty_explosivebullets", HordeIconsTable.Cols.Image ) + local self = LUI.UIElement.new() + self.id = "horde_hud_exp_ammo_container" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -65, + right = -175, + height = f5_local0, + width = f5_local1, + alpha = 0 + } ) + self:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -65, + right = -175, + height = f5_local0, + width = f5_local1, + alpha = 1 + } ) + self:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -25, + right = -135, + height = f5_local0 * 3, + width = f5_local1 * 3, + alpha = 0.5 + } ) + self:animateToState( "default", 0 ) + self:registerOmnvarHandler( "ui_horde_update_explosive", f0_local1 ) + local f5_local5 = LUI.UIImage.new() + f5_local5.id = "horde_hud_exp_ammo_image" + f5_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = RegisterMaterial( f5_local3 ), + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f5_local5:registerAnimationState( "flash", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local0 / 1.5, + left = -f5_local0 / 1.5, + bottom = f5_local0 / 1.5, + right = f5_local0 / 1.5, + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b, + alpha = 0.8 + } ) + f5_local5:animateToState( "default", 0 ) + self:addElement( f5_local5 ) + return self +end + +LUI.MenuBuilder.registerType( "hordePerksHudDef", f0_local3 ) +LUI.MenuBuilder.registerType( "hordeExpAmmoHudDef", f0_local4 ) +LockTable( _M ) diff --git a/lui/mp_hud/hostmigration.dec.lua b/lui/mp_hud/hostmigration.dec.lua new file mode 100644 index 0000000..aee17a5 --- /dev/null +++ b/lui/mp_hud/hostmigration.dec.lua @@ -0,0 +1,84 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + f2_arg0:setText( Game.GetMigrationStatus() ) +end + +f0_local2 = function () + local self = LUI.UIElement.new() + self.id = "percentage_display_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + top = 100, + left = 100, + height = 65, + width = 512 + } ) + self:animateToState( "default", 0 ) + local f3_local1 = LUI.UIText.new() + f3_local1.id = "hm_description_id" + f3_local1:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.BoldFont.Height, + width = 512, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.left + } ) + f3_local1:animateToState( "default", 0 ) + f3_local1:setText( "" ) + f3_local1:setTextStyle( CoD.TextStyle.Shadowed ) + f3_local1:registerEventHandler( "host_migration_update", f0_local1 ) + LUI.MenuBuilder.BuildAddChild( f3_local1, { + type = "UITimer", + id = "hm_description_refresh_id", + properties = { + event = "host_migration_update", + interval = 250 + } + } ) + self:addElement( f3_local1 ) + return self +end + +LUI.MenuBuilder.registerType( "host_migration_main", function () + local f4_local0 = Engine.Localize( "@LUA_MENU_HOST_MIGRATION_CAPS" ) + local self = LUI.UIElement.new() + self.id = "host_migration_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "hide_host_migration", f0_local0 ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIWorldBlur", + id = "hmWorldBlurOverlay", + states = { + default = { + worldBlur = 5 + } + } + } ) + self:addElement( LUI.mp_hud.OptionsMenu.mp_pause_menu_background_def() ) + self:addElement( LUI.mp_hud.OptionsMenu.mp_pause_menu_title_def( f4_local0 ) ) + self:addElement( f0_local2() ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/hud.dec.lua b/lui/mp_hud/hud.dec.lua new file mode 100644 index 0000000..fd16365 --- /dev/null +++ b/lui/mp_hud/hud.dec.lua @@ -0,0 +1,1434 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = Engine.GetDvarFloat( "safeArea_adjusted_horizontal" ) +f0_local1 = Engine.GetDvarFloat( "safeArea_adjusted_vertical" ) +f0_local2 = "" +local f0_local3 = function ( f1_arg0 ) + local f1_local0 = "mlg" + if MLG.IsFollowing then + local f1_local1 = MLG.IsFollowing() + local f1_local2 = "_following" + end + return f1_local0 .. (f1_local1 and f1_local2 or "") .. (f1_arg0.noMap and "_nomap" or "") +end + +local f0_local4 = false +local f0_local5 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = MLG.IsMLGSpectator() + local f2_local1 = Game.InKillCam() + local f2_local2 = Game.IsEmpJammed() + local f2_local3 = CoD.UsingKillstreakRemote() + local f2_local4 = GameX.IsHardcoreMode() + local f2_local5 = Engine.GetDvarString( "ui_game_state" ) == "postgame" + local f2_local6 = Game.GetOmnvar( "ui_session_state" ) + local f2_local7 = f2_local6 ~= "playing" + local f2_local8 = not Engine.GetDvarBool( "cg_draw2D" ) + local f2_local9 = Engine.GetDvarString( "createfx" ) == "on" + local f2_local10 = Engine.GetDvarString( "ui_gametype" ) + local f2_local11 = GameX.IsSplitscreen() + local f2_local12 = Game.IsSpectating() or f2_local6 == "spectator" + local f2_local13 = Game.GetOmnvar( "ui_match_start_countdown" ) > 0 + local f2_local14 = f2_arg0.is_paused + local f2_local15 = f2_arg0.is_migrating + local f2_local16 = Game.GetOmnvar( "ui_satcom_active" ) + local f2_local17 = f2_arg0:getChildById( "cornersHudId" ) + local f2_local18 = f2_arg0:getChildById( "spectatorHudId" ) + local f2_local19 = f2_arg0:getChildById( "fireTeamHudId" ) + local f2_local20 = f2_arg0:getChildById( "gameMessageHudId" ) + local f2_local21 = f2_arg0:getChildById( "hintsHudId" ) + local f2_local22 = f2_arg0:getChildById( "lowHealthHudId" ) + local f2_local23 = f2_arg0:getChildById( "pointsPopupHudId" ) + local f2_local24 = f2_arg0:getChildById( "matchStartHudId" ) + local f2_local25 = f2_arg0:getChildById( "matchStartObjectiveHudId" ) + local f2_local26 = f2_arg0:getChildById( "vitaHudId" ) + local f2_local27 = f2_arg0:getChildById( "shakeContainerHudId" ) + local f2_local28 = f2_arg0:getChildById( "damageFeedbackHudId" ) + local f2_local29 = f2_arg0:getChildById( "hudIconTypeHudId" ) + local f2_local30 = f2_arg0:getChildById( "killCamHudId" ) + local f2_local31 = f2_local27:getChildById( "weaponInfoHudId" ) + local f2_local32 = f2_local27:getChildById( "playerInfoHudId" ) + local f2_local33 = f2_local27:getChildById( "minimapHudId" ) + local f2_local34 = f2_local27:getChildById( "lowAmmoWarningHudId" ) + local f2_local35 = f2_local27:getChildById( "captureDomHudId" ) + local f2_local36 = f2_local27:getChildById( "captureHudId" ) + local f2_local37 = f2_local27:getChildById( "hordeHudId" ) + local f2_local38 = f2_local27:getChildById( "hordeRoundHudId" ) + local f2_local39 = f2_local27:getChildById( "hordePerksHudId" ) + local f2_local40 = f2_local27:getChildById( "hordeExpAmmoHudId" ) + local f2_local41 = f2_local27:getChildById( "bombPlantDefuseHudId" ) + local f2_local42 = f2_local27:getChildById( "scorelistHudId" ) + local f2_local43 = f2_local27:getChildById( "teamScoresHudId" ) + local f2_local44 = f2_local27:getChildById( "intelInfoHudId" ) + local f2_local45 = f2_local27:getChildById( "splashesHudId" ) + local f2_local46 = f2_local27:getChildById( "perksOnSpawnHudId" ) + local f2_local47 = f2_local27:getChildById( "killstreakVisHandlerId" ) + local f2_local48 = f2_local27:getChildById( "digKillstreakHudId" ) + local f2_local49 = Game.GetPlayerWeaponName() + local f2_local50 = { + f2_local31, + f2_local32, + f2_local33, + f2_local34, + f2_local35, + f2_local36, + f2_local37, + f2_local38, + f2_local39, + f2_local40, + f2_local41, + f2_local43, + f2_local42, + f2_local44, + f2_local17, + f2_local28, + f2_local29, + f2_local45, + f2_local18, + f2_local19, + f2_local20, + f2_local21, + f2_local26, + f2_local24, + f2_local25, + f2_local22, + f2_local23, + f2_local46, + f2_local30, + f2_local47, + f2_local48 + } + local f2_local51 = { + weaponInfoHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating_player", + "spectating_player_hardcore", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "default_horde_match_countdown", + "default_infect_mode", + "default_infect_match_countdown" + } ), + playerInfoHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating_player", + "spectating_player_hardcore", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "default_horde_spectating", + "default_infect_mode", + "default_infect_match_countdown" + } ), + minimapHudId = hashset( { + "default", + "default_match_countdown", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating_player", + "spectating_fireteam", + "spectating_odin", + "mlg", + "mlg_following", + "hardcore_mode_satcom", + "in_odin", + "default_infect_mode", + "default_infect_match_countdown" + } ), + lowAmmoWarningHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "default_horde_match_countdown", + "default_infect_mode", + "default_infect_match_countdown" + } ), + captureDomHudId = hashset( { + "default", + "default_match_countdown", + "emp_jammed", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom" + } ), + captureHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "default_horde_match_countdown", + "default_infect_mode", + "default_infect_match_countdown" + } ), + hordeHudId = hashset( { + "default_horde_mode", + "default_horde_match_countdown" + } ), + hordeRoundHudId = hashset( { + "default_horde_mode", + "default_horde_match_countdown", + "default_horde_spectating" + } ), + hordePerksHudId = hashset( { + "default_horde_mode" + } ), + hordeExpAmmoHudId = hashset( { + "default_horde_mode" + } ), + bombPlantDefuseHudId = hashset( { + "default", + "default_match_countdown", + "emp_jammed", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom" + } ), + teamScoresHudId = hashset( { + "default", + "default_match_countdown", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating_player", + "spectating_player_hardcore", + "spectating_fireteam", + "hardcore_mode", + "hardcore_mode_satcom", + "default_infect_mode", + "default_infect_match_countdown" + } ), + scorelistHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "killcam", + "spectating", + "spectating_player", + "spectating_player_hardcore", + "spectating_fireteam", + "spectating_killstreak", + "spectating_odin", + "mlg", + "mlg_following", + "mlg_nomap", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "session_invalid", + "killstreak_remote", + "in_odin", + "default_horde_spectating", + "postgame", + "default_infect_mode", + "default_infect_match_countdown" + } ), + intelInfoHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "default_horde_match_countdown" + } ), + cornersHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "default_horde_match_countdown", + "default_infect_mode", + "default_infect_match_countdown" + } ), + damageFeedbackHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "killcam", + "spectating_fireteam", + "spectating_killstreak", + "spectating_odin", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "killstreak_remote", + "in_odin", + "default_horde_match_countdown", + "postgame", + "default_infect_mode", + "default_infect_match_countdown" + } ), + hudIconTypeHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "killcam", + "spectating_fireteam", + "spectating_killstreak", + "spectating_odin", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "killstreak_remote", + "in_odin", + "default_horde_match_countdown", + "postgame", + "default_infect_mode", + "default_infect_match_countdown" + } ), + splashesHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating_fireteam", + "spectating_killstreak", + "spectating_odin", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "killstreak_remote", + "in_odin", + "default_horde_match_countdown", + "default_infect_mode", + "default_infect_match_countdown" + } ), + spectatorHudId = hashset( { + "spectating", + "spectating_player", + "spectating_player_hardcore", + "spectating_killstreak", + "spectating_odin", + "default_horde_spectating" + } ), + fireTeamHudId = hashset( { + "default", + "default_match_countdown", + "killcam", + "spectating", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "session_invalid" + } ), + gameMessageHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "default_horde_match_countdown", + "default_infect_mode", + "default_infect_match_countdown" + } ), + hintsHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "default_horde_match_countdown", + "default_infect_mode", + "default_infect_match_countdown" + } ), + vitaHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating", + "spectating_player", + "spectating_player_hardcore", + "spectating_fireteam", + "default_horde_match_countdown", + "default_horde_spectating", + "default_infect_mode", + "default_infect_match_countdown" + } ), + matchStartHudId = hashset( { + "default_match_countdown", + "default_sotf_match_countdown", + "emp_jammed", + "spectating", + "spectating_killstreak", + "spectating_odin", + "mlg", + "mlg_following", + "mlg_nomap", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "killstreak_remote", + "in_odin", + "paused_match_countdown", + "default_horde_match_countdown", + "default_infect_match_countdown" + } ), + matchStartObjectiveHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "spectating", + "hardcore_mode", + "hardcore_mode_satcom", + "paused_match_countdown", + "default_horde_match_countdown", + "default_infect_mode", + "default_infect_match_countdown" + } ), + lowHealthHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "killcam", + "spectating", + "spectating_player", + "spectating_player_hardcore", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap", + "default_horde_match_countdown", + "default_horde_spectating", + "default_infect_mode", + "default_infect_match_countdown" + } ), + pointsPopupHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "killcam", + "spectating_fireteam", + "spectating_killstreak", + "spectating_odin", + "mlg_following", + "mlg_following_nomap", + "killstreak_remote", + "in_odin", + "default_horde_match_countdown", + "default_infect_mode", + "default_infect_match_countdown" + } ), + perksOnSpawnHudId = hashset( { + "default", + "default_match_countdown", + "emp_jammed", + "spectating_fireteam", + "mlg_following", + "mlg_following_nomap" + } ), + killCamHudId = hashset( { + "killcam" + } ), + killstreakVisHandlerId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "spectating_fireteam", + "hardcore_mode", + "hardcore_mode_satcom", + "default_horde_match_countdown", + "default_infect_mode", + "default_infect_match_countdown" + } ), + digKillstreakHudId = hashset( { + "default", + "default_match_countdown", + "default_horde_mode", + "default_sotf_mode", + "default_sotf_match_countdown", + "emp_jammed", + "killcam", + "spectating_fireteam", + "spectating_killstreak", + "spectating_odin", + "mlg_following", + "mlg_following_nomap", + "hardcore_mode", + "hardcore_mode_satcom", + "killstreak_remote", + "in_odin", + "default_horde_match_countdown", + "postgame", + "default_infect_mode", + "default_infect_match_countdown" + } ) + } + local f2_local52 = nil + if f2_local15 then + f2_local52 = "migrating" + elseif f2_local5 then + if f2_local1 then + f2_local52 = "killcam" + else + f2_local52 = "postgame" + end + elseif f2_local8 then + f2_local52 = "dont_draw_hud" + elseif f2_local9 then + f2_local52 = "create_fx_enabled" + elseif f2_local14 then + if f2_local13 then + f2_local52 = "paused_match_countdown" + else + f2_local52 = "paused" + end + elseif f2_local1 and not f2_local0 then + f2_local52 = "killcam" + elseif f2_local12 then + if f2_local0 then + f2_local52 = f0_local3( f2_arg0 ) + elseif CoD.IsFireTeamMode() then + f2_local52 = "spectating_fireteam" + elseif not GameX.IsSpectatingNotOnTeam() then + if f2_local10 == "horde" then + f2_local52 = "default_horde_spectating" + elseif f2_local4 then + f2_local52 = "spectating_player_hardcore" + elseif f2_local3 then + if CoD.UsingOdinOrLoki() then + f2_local52 = "spectating_odin" + else + f2_local52 = "spectating_killstreak" + end + else + f2_local52 = "spectating_player" + end + else + f2_local52 = "spectating" + end + elseif f2_local4 then + if f2_local16 then + f2_local52 = "hardcore_mode_satcom" + else + f2_local52 = "hardcore_mode" + end + elseif f2_local7 then + f2_local52 = "session_invalid" + elseif f2_local3 then + if CoD.UsingOdinOrLoki() then + f2_local52 = "in_odin" + else + f2_local52 = "killstreak_remote" + end + elseif f2_local2 and not f2_local14 then + f2_local52 = "emp_jammed" + elseif f2_local10 == "horde" then + if f2_local13 then + f2_local52 = "default_horde_match_countdown" + else + f2_local52 = "default_horde_mode" + end + elseif f2_local10 == "sotf" or f2_local10 == "sotf_ffa" then + if f2_local13 then + f2_local52 = "default_sotf_match_countdown" + else + f2_local52 = "default_sotf_mode" + end + elseif f2_local10 == "infect" then + if f2_local13 then + f2_local52 = "default_infect_match_countdown" + else + f2_local52 = "default_infect_mode" + end + elseif f2_local13 then + f2_local52 = "default_match_countdown" + else + f2_local52 = "default" + end + for f2_local56, f2_local57 in pairs( f2_local50 ) do + if f2_local51[f2_local57.id][f2_local52] then + if f2_arg0.current_state ~= "hud_on" then + f2_arg0:animateToState( "hud_on", 0 ) + f2_arg0.current_state = "hud_on" + end + if f2_local57.current_state ~= "hud_on" then + f2_local57:animateToState( "hud_on", 100 ) + f2_local57.current_state = "hud_on" + f2_local57:processEvent( { + name = "hud_on" + } ) + end + end + if f2_local57.current_state ~= "hud_off" then + f2_local57:animateToState( "hud_off", 0 ) + f2_local57.current_state = "hud_off" + f2_local57:processEvent( { + name = "hud_off" + } ) + end + end + if f2_local9 and not f2_arg0.is_createFXEnabled then + Engine.Exec( "ufo" ) + f2_arg0.is_createFXEnabled = true + end + if not f2_arg0.is_paused and (f0_local0 ~= Engine.GetDvarFloat( "safeArea_adjusted_horizontal" ) or f0_local1 ~= Engine.GetDvarFloat( "safeArea_adjusted_vertical" )) then + f0_local0 = Engine.GetDvarFloat( "safeArea_adjusted_horizontal" ) + f0_local1 = Engine.GetDvarFloat( "safeArea_adjusted_vertical" ) + f2_local53 = {} + f2_local53 = GameX.GetSafeZoneSize( f0_local0, f0_local1 ) + f2_arg0:registerAnimationState( "new_margins", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + left = f2_local53[1], + top = f2_local53[2], + right = f2_local53[3], + bottom = f2_local53[4], + alpha = 1 + } ) + f2_arg0:animateToState( "new_margins", 0 ) + f2_arg0:registerAnimationState( "default_on", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + left = f2_local53[1], + top = f2_local53[2], + right = f2_local53[3], + bottom = f2_local53[4], + alpha = 1 + } ) + end + if Engine.IsVita() and f2_local26 then + f2_local53 = Engine.GetProfileData( "gpadButtonsConfig" ) + if f0_local2 ~= f2_local53 then + f0_local2 = f2_local53 + f2_local26:processEvent( { + name = "vita_hud_button_update" + } ) + end + end + if not f0_local4 and f2_local5 then + f2_arg0:dispatchEventToRoot( { + name = "post_game_begin" + } ) + elseif f0_local4 and not f2_local5 then + f2_arg0:dispatchEventToRoot( { + name = "post_game_end" + } ) + end + f0_local4 = f2_local5 +end + +local f0_local6 = function ( f3_arg0, f3_arg1 ) + LUI.FlowManager.RequestAddMenu( f3_arg0, "mp_pause_menu", true, f3_arg1.controller, false ) +end + +local f0_local7 = function ( f4_arg0, f4_arg1 ) + if Engine.GetDvarString( "ui_game_state" ) == "postgame" == false then + f4_arg0.is_paused = false + f4_arg0:processEvent( { + name = "hud_refresh" + } ) + end +end + +local f0_local8 = function ( f5_arg0, f5_arg1 ) + if Engine.GetDvarString( "ui_game_state" ) == "postgame" == false and f5_arg0.is_migrating == true == false then + f5_arg0.is_paused = true + f5_arg0:processEvent( { + name = "hud_refresh" + } ) + f0_local6( f5_arg0, f5_arg1 ) + end +end + +local f0_local9 = function ( f6_arg0, f6_arg1 ) + f6_arg0.is_migrating = true +end + +local f0_local10 = function ( f7_arg0, f7_arg1 ) + local f7_local0 = Engine.GetDvarString( "ui_game_state" ) == "postgame" + f7_arg0.is_migrating = false + if f7_local0 == false then + f7_arg0.is_paused = false + f7_arg0:processEvent( { + name = "hud_refresh" + } ) + end +end + +local f0_local11 = function ( f8_arg0, f8_arg1 ) + if f8_arg1.value == true and Game.GetOmnvar( "ui_hud_static" ) == 0 then + f8_arg0:processEvent( { + name = "hud_shake" + } ) + f8_arg0.minimapHud:processEvent( { + name = "hud_shake" + } ) + end +end + +local f0_local12 = function ( f9_arg0, f9_arg1 ) + if f9_arg1.value then + f9_arg0.empArtifact:processEvent( { + name = "hud_static_on" + } ) + else + f9_arg0.empArtifact:processEvent( { + name = "hud_static_off" + } ) + end +end + +local f0_local13 = { + "one", + "two", + "three", + "four" +} +local f0_local14 = { + 53, + 61, + 73, + 83, + 97, + 113, + 127 +} +local f0_local15 = function ( f10_arg0 ) + return f10_arg0[math.random( 1, #f10_arg0 )] +end + +function GetStaticSequence( f11_arg0 ) + local f11_local0 = {} + table.insert( f11_local0, { + f0_local15( f0_local13 ), + 0 + } ) + for f11_local1 = 1, f11_arg0, 1 do + local f11_local4 = f11_local1 + local f11_local5 = table.insert + local f11_local6 = f11_local0 + local f11_local7 = {} + local f11_local8 = f0_local15( f0_local13 ) + local f11_local9 = f0_local15( f0_local14 ) + f11_local5( f11_local6, f11_local8 ) + end + return f11_local0 +end + +local f0_local16 = function ( f12_arg0, f12_arg1 ) + local f12_local0 = f12_arg1 - f12_arg0 + local f12_local1 = math.random( -f12_local0, f12_local0 ) + if f12_local1 >= 0 then + f12_local1 = f12_local1 + f12_arg0 + else + f12_local1 = f12_local1 - f12_arg0 + end + return f12_local1 +end + +local f0_local17 = 3 +local f0_local18 = 6 +local f0_local19 = function ( f13_arg0, f13_arg1 ) + local f13_local0 = math.random( f0_local17, f0_local18 ) + local f13_local1 = GetStaticSequence( f13_local0 ) + local f13_local2 = MBh.AnimateSequence( f13_local1 ) + f13_local2( f13_arg0.empStatic:getFirstDescendentById( "jammerStaticId" ) ) + local f13_local3 = f13_arg0:getChildById( "shakeContainerHudId" ) + local f13_local4 = {} + for f13_local5 = 1, f13_local0, 1 do + local f13_local8 = f13_local5 % 2 == 0 + local f13_local9 = 0 + local f13_local10 = nil + local f13_local11 = 0 + local f13_local12 = nil + if f13_local8 then + f13_local9 = 20 + f13_local10 = 40 + f13_local11 = 4 + f13_local12 = 6 + else + f13_local9 = 60 + f13_local10 = 80 + f13_local11 = 1 + f13_local12 = 2 + end + local f13_local13 = "shake_loop_" .. f13_local5 + f13_local3:registerAnimationState( f13_local13, { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + alpha = math.random( f13_local9, f13_local10 ) * 0.01, + top = 0.5 * f0_local16( f13_local11, f13_local12 ), + left = f0_local16( f13_local11, f13_local12 ), + bottom = 0.5 * f0_local16( f13_local11, f13_local12 ), + right = f0_local16( f13_local11, f13_local12 ) + } ) + f13_local4[f13_local5] = { + f13_local13, + f13_local1[f13_local5][2] + } + end + local f13_local5 = MBh.AnimateSequence( f13_local4 ) + f13_local5( f13_local3 ) +end + +local f0_local20 = function ( f14_arg0, f14_arg1 ) + if f14_arg0.is_paused then + return + elseif f14_arg1.value == 0 then + f14_arg0.minimapHud:dispatchEventToChildren( { + name = "hud_nosignal_off" + } ) + f14_arg0.empStatic:processEvent( { + name = "hud_static_off" + } ) + f14_arg0.empNoSignal:processEvent( { + name = "hud_nosignal_off" + } ) + local f14_local0 = f14_arg0:getChildById( "shakeContainerHudId" ) + f14_local0:animateToState( "default" ) + elseif f14_arg1.value == 3 then + f14_arg0.minimapHud:dispatchEventToChildren( { + name = "hud_nosignal_on" + } ) + f14_arg0.empStatic:processEvent( { + name = "hud_static_off" + } ) + f14_arg0.empNoSignal:processEvent( { + name = "hud_nosignal_on" + } ) + local f14_local0 = f14_arg0:getChildById( "shakeContainerHudId" ) + f14_local0:animateToState( "default" ) + else + f14_arg0.minimapHud:dispatchEventToChildren( { + name = "hud_static" + } ) + f0_local19( f14_arg0, f14_arg1 ) + f14_arg0.empNoSignal:processEvent( { + name = "hud_nosignal_off" + } ) + end +end + +local f0_local21 = function ( f15_arg0, f15_arg1 ) + f15_arg0.doRandomShake = true + f0_local0 = Engine.GetDvarFloat( "safeArea_adjusted_horizontal" ) + f0_local1 = Engine.GetDvarFloat( "safeArea_adjusted_vertical" ) + local f15_local0 = f15_arg0:getChildById( "shakeContainerHudId" ) + local f15_local1 = {} + f15_local1 = GameX.GetScreenDims() + for f15_local2 = 1, 4, 1 do + f15_local0:registerAnimationState( "shake" .. f15_local2, { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = f15_local1[2] * (1 - f0_local1) / 2 + math.random( 10, 20 ), + left = f15_local1[1] * (1 - f0_local0) / 2 + math.random( 10, 20 ), + bottom = -(f15_local1[2] * (1 - f0_local1)) / 2 - math.random( 10, 20 ), + right = -(f15_local1[1] * (1 - f0_local0)) / 2 - math.random( 10, 20 ), + alpha = math.random( 0, 50 ) / 100 + } ) + end + local f15_local2 = MBh.AnimateSequence + local f15_local3 = {} + local f15_local4 = { + "default", + 0 + } + local f15_local5 = {} + local f15_local6 = "shake1" + local f15_local7 = math.random( 10, 50 ) + f15_local5 = f15_local6 + f15_local6 = {} + f15_local7 = "shake2" + local f15_local8 = math.random( 10, 50 ) + f15_local6 = f15_local7 + f15_local7 = {} + f15_local8 = "shake3" + local f15_local9 = math.random( 10, 50 ) + f15_local7 = f15_local8 + f15_local8 = {} + f15_local9 = "shake4" + local f15_local10 = math.random( 10, 50 ) + f15_local8 = f15_local9 + f15_local9 = {} + f15_local10 = "hud_off" + local f15_local11 = math.random( 50, 100 ) + f15_local9 = f15_local10 + f15_local10 = { + "default", + 250 + } + f15_local3[1] = f15_local4 + f15_local3[2] = f15_local5 + f15_local3[3] = f15_local6 + f15_local3[4] = f15_local7 + f15_local3[5] = f15_local8 + f15_local3[6] = f15_local9 + f15_local3[7] = f15_local10 + f15_local3 = f15_local2( f15_local3 ) + f15_local3( f15_local0 ) + f15_arg0.doRandomShake = undefined +end + +local f0_local22 = function ( f16_arg0, f16_arg1 ) + local f16_local0 = Game.GetOmnvar( "ui_light_armor" ) + local f16_local1 = Engine.GetDvarInt( "ui_juiced_end_milliseconds" ) + local f16_local2 = Game.GetOmnvar( "ui_cranked_bomb_timer_end_milliseconds" ) + local f16_local3 = Game.GetOmnvar( "ui_trigger_happy" ) + if f16_local1 > 0 then + if f16_arg0.current_state ~= "juiced" then + local f16_local4 = f16_arg0:getChildById( "bottomLeftCornerId" ) + local f16_local5 = f16_arg0:getChildById( "bottomRightCornerId" ) + f16_local4:animateToState( "juiced", 250 ) + f16_local5:animateToState( "juiced", 250 ) + f16_arg0.current_state = "juiced" + end + elseif f16_local2 > 0 then + if f16_arg0.current_state ~= "cranked" then + local f16_local4 = f16_arg0:getChildById( "bottomLeftCornerId" ) + local f16_local5 = f16_arg0:getChildById( "bottomRightCornerId" ) + f16_local4:animateToState( "cranked", 250 ) + f16_local5:animateToState( "cranked", 250 ) + f16_arg0.current_state = "cranked" + end + elseif f16_local0 then + if f16_arg0.current_state ~= "light_armor" then + local f16_local4 = f16_arg0:getChildById( "bottomLeftCornerId" ) + local f16_local5 = f16_arg0:getChildById( "bottomRightCornerId" ) + f16_local4:animateToState( "light_armor", 250 ) + f16_local5:animateToState( "light_armor", 250 ) + f16_arg0.current_state = "light_armor" + end + elseif f16_local3 then + if f16_arg0.current_state ~= "trigger_happy" then + local f16_local4 = f16_arg0:getChildById( "bottomLeftCornerId" ) + local f16_local5 = f16_arg0:getChildById( "bottomRightCornerId" ) + f16_local4:animateToState( "trigger_happy", 250 ) + f16_local5:animateToState( "trigger_happy", 250 ) + f16_arg0.current_state = "trigger_happy" + end + elseif f16_arg0.current_state ~= "default" then + local f16_local4 = f16_arg0:getChildById( "topLeftCornerId" ) + local f16_local5 = f16_arg0:getChildById( "bottomLeftCornerId" ) + local f16_local6 = f16_arg0:getChildById( "topRightCornerId" ) + local f16_local7 = f16_arg0:getChildById( "bottomRightCornerId" ) + local f16_local8 = MBh.AnimateSequence( { + { + "inactive", + 500 + }, + { + "default", + 500 + } + } ) + f16_local8( f16_local4 ) + f16_local8( f16_local5 ) + f16_local8( f16_local6 ) + f16_local8( f16_local7 ) + f16_arg0.current_state = "default" + end +end + +local f0_local23 = { + alpha = 1 +} +local f0_local24 = { + alpha = 0 +} +local f0_local25 = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 +} +local f0_local26 = function ( f17_arg0 ) + local f17_local0 = { + alpha = 1 + } + local f17_local1 = { + alpha = 0 + } + local f17_local2 = {} + f17_local2 = GameX.GetAdjustedSafeZoneSize() + local f17_local3 = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + left = f17_local2[1], + top = f17_local2[2], + right = f17_local2[3], + bottom = f17_local2[4], + alpha = 1 + } + f17_arg0:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + left = f17_local2[1], + top = f17_local2[2], + right = f17_local2[3], + bottom = f17_local2[4], + alpha = 0 + } ) + f17_arg0:registerAnimationState( "default_on", f17_local3 ) + f17_arg0:registerAnimationState( "hud_on", f17_local0 ) + f17_arg0:registerAnimationState( "hud_off", f17_local1 ) + f17_arg0:animateToState( "default" ) +end + +local f0_local27 = LUI.MenuBuilder.BuildAddChild +local f0_local28 = function ( menu, controller ) + local self = LUI.UIElement.new() + self.id = menu + if Engine.IsConsoleGame() then + local f18_local1 = {} + f18_local1 = GameX.GetAdjustedSafeZoneSize() + local f18_local2 = {} + f18_local2 = GameX.GetScreenDims() + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(f18_local2[2] / 2) - (f18_local1[2] + f18_local1[4]) / 2, + width = f18_local2[1], + height = f18_local2[2], + alpha = 1 + } ) + else + self:registerAnimationState( "default", f0_local25 ) + end + self:registerAnimationState( "hud_on", f0_local23 ) + self:registerAnimationState( "hud_off", f0_local24 ) + self:animateToState( "default" ) + f0_local27( self, { + type = controller + } ) + return self +end + +local f0_local29 = function ( menu, controller ) + local self = LUI.UIElement.new() + self.id = menu + self:registerAnimationState( "default", f0_local25 ) + self:registerAnimationState( "hud_on", f0_local23 ) + self:registerAnimationState( "hud_off", f0_local24 ) + self:animateToState( "default" ) + f0_local27( self, { + type = controller + } ) + return self +end + +local f0_local30 = function ( f20_arg0, f20_arg1 ) + local f20_local0 = RegisterMaterial( "hud_corner_blue" ) + local f20_local1 = RegisterMaterial( "hud_corner_green" ) + local f20_local2 = RegisterMaterial( "hud_corner_red" ) + local self = LUI.UIImage.new() + self.id = f20_arg0 + self:registerAnimationState( "default", f20_arg1 ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "inactive", { + alpha = 0 + } ) + self:registerAnimationState( "light_armor", { + material = f20_local1, + alpha = 1 + } ) + self:registerAnimationState( "juiced", { + material = f20_local0, + alpha = 1 + } ) + self:registerAnimationState( "cranked", { + material = f20_local2, + alpha = 1 + } ) + self:registerAnimationState( "trigger_happy", { + material = f20_local0, + alpha = 1 + } ) + return self +end + +local f0_local31 = function ( f21_arg0, f21_arg1 ) + if not MLG.IsMLGSpectator() then + local f21_local0 = { + "team_select_main", + "class_select_main" + } + local f21_local1 = f21_local0[f21_arg1.value] + if f21_local1 then + f21_arg0.is_paused = true + LUI.FlowManager.RequestAddMenuAndSetStack( f21_arg0, f21_local1, true, f21_arg1.controller, false, false, { + { + name = "mp_pause_menu" + } + } ) + f21_arg0:dispatchEventToRoot( { + name = "hud_refresh", + target = f21_arg0 + } ) + end + elseif f21_arg1.value == 2 then + local f21_local0 = Engine.GetLuiRoot() + if not f21_local0.hudManager.MLGHud then + f21_arg0:dispatchEventToRoot( { + name = "close_hud" + } ) + f21_arg0:dispatchEventToRoot( { + name = "init_hud" + } ) + Engine.NotifyServer( "class_select", 0 ) + end + end +end + +local f0_local32 = function () + local self = LUI.UIElement.new() + self.id = "hud_id" + f0_local26( self ) + self:registerOmnvarHandler( "ui_round_end", function ( f23_arg0, f23_arg1 ) + if f23_arg1.value > 0 then + f23_arg0:dispatchEventToRoot( { + name = "round_end_show" + } ) + end + end ) + self:registerOmnvarHandler( "ui_options_menu", f0_local31 ) + local f22_local1 = Engine.GetLuiRoot() + local f22_local2 = tonumber( string.sub( f22_local1.name, 7 ) ) + if not f22_local1.hudManager.hudPreviouslyOpened then + self:dispatchEventToRoot( { + name = "omnvar_update", + omnvar = "ui_options_menu", + value = Game.GetOmnvar( "ui_options_menu" ), + controller = f22_local2 + } ) + end + self:registerEventHandler( "hud_refresh", function ( element, event ) + f0_local5( element, event ) + local f24_local0 = element:getChildById( "shakeContainerHudId" ) + local f24_local1 = f24_local0:getChildById( "lowAmmoWarningHudId" ) + f24_local1:processEvent( event ) + f24_local1 = f24_local0:getChildById( "weaponInfoHudId" ) + local f24_local2 = f24_local1:getChildById( "weaponInfoHud" ) + local f24_local3 = f24_local2:getChildById( "killstreakInfoHud" ) + f24_local3:processEvent( event ) + local f24_local4 = element:getChildById( "cornersHudId" ) + f24_local4:processEvent( event ) + f24_local4 = element:getChildById( "spectatorHudId" ) + f24_local4:processEvent( event ) + end ) + self:registerEventHandler( "hud_shake", f0_local21 ) + self:registerEventHandler( "toggle_pause", f0_local8 ) + self:registerEventHandler( "toggle_pause_off", f0_local7 ) + self:registerEventHandler( "show_host_migration_triggered", f0_local9 ) + self:registerEventHandler( "hide_host_migration", f0_local10 ) + self:registerOmnvarHandler( "ui_pause_menu_show", f0_local7 ) + self:registerOmnvarHandler( "ui_hud_shake", f0_local11 ) + self:registerOmnvarHandler( "ui_hud_emp_artifact", f0_local12 ) + self:registerOmnvarHandler( "ui_hud_static", f0_local20 ) + f0_local27( self, { + type = "weaponAttachmentProcessing", + id = "weapAttachment" + } ) + f0_local27( self, { + type = "blurProcessing", + id = "blurProcessing" + } ) + f0_local27( self, { + type = "UITimer", + id = "hudRefreshTimer", + properties = { + event = "hud_refresh", + group = "hud", + interval = 200 + } + } ) + f0_local27( self, f0_local28( "cornersHudId", "fourCornersHudDef" ) ) + f0_local27( self, f0_local28( "overlayHudId", "overlayHudDef" ) ) + f0_local27( self, f0_local28( "gameMessageHudId", "gameMessageHudDef" ) ) + f0_local27( self, f0_local28( "hintsHudId", "hintsHudDef" ) ) + f0_local27( self, f0_local28( "killCamHudId", "killCamHudDef" ) ) + f0_local27( self, f0_local28( "lowHealthHudId", "lowHealthHudDef" ) ) + f0_local27( self, f0_local28( "pointsPopupHudId", "pointsPopupHudDef" ) ) + run_gc() + f0_local27( self, f0_local28( "screenEffectsHudDef", "screenEffectsHudDef" ) ) + f0_local27( self, f0_local28( "matchStartHudId", "matchStartHudDef" ) ) + f0_local27( self, f0_local29( "matchStartObjectiveHudId", "matchStartObjectiveHudDef" ) ) + f0_local27( self, f0_local29( "spectatorHudId", "spectatorHudDef" ) ) + f0_local27( self, f0_local28( "damageFeedbackHudId", "damageFeedbackHudDef" ) ) + f0_local27( self, f0_local28( "hudIconTypeHudId", "hudIconTypeHudDef" ) ) + if Engine.IsPS4() then + f0_local27( self, f0_local29( "vitaHudId", "vitaHudDef" ) ) + end + f22_local1 = LUI.UIElement.new() + f22_local1.id = "shakeContainerHudId" + f22_local1:registerAnimationState( "default", f0_local25 ) + f22_local1:registerAnimationState( "hud_on", f0_local23 ) + f22_local1:registerAnimationState( "hud_off", f0_local24 ) + f22_local1:animateToState( "default" ) + f22_local1.properties = { + shakeLooping = 0, + shakeVersion = 0 + } + self:addElement( f22_local1 ) + f0_local27( f22_local1, f0_local29( "weaponInfoHudId", "weaponInfoHudDef" ) ) + f0_local27( f22_local1, { + type = "UIElement", + id = "killstreakVisHandlerId", + handlers = { + hud_on = function ( f25_arg0 ) + local f25_local0 = f25_arg0:getParent() + f25_local0 = f25_local0:getChildById( "weaponInfoHudId" ) + f25_local0:processEvent( { + name = "show_ks_info" + } ) + end, + hud_off = function ( f26_arg0 ) + local f26_local0 = f26_arg0:getParent() + f26_local0 = f26_local0:getChildById( "weaponInfoHudId" ) + f26_local0:processEvent( { + name = "hide_ks_info" + } ) + end + } + } ) + run_gc() + f0_local27( f22_local1, f0_local29( "playerInfoHudId", "playerInfoHudDef" ) ) + self.minimapHud = f0_local27( f22_local1, f0_local29( "minimapHudId", "minimapHudDef" ) ) + self.empNoSignal = self.minimapHud:getFirstDescendentById( "minimapNoSignal" ) + self.empArtifact = self.minimapHud:getFirstDescendentById( "minimapArtifact" ) + self.empStatic = self.minimapHud:getFirstDescendentById( "minimapStatic" ) + f0_local27( f22_local1, f0_local29( "lowAmmoWarningHudId", "lowAmmoWarningHudDef" ) ) + f0_local27( f22_local1, f0_local29( "captureHudId", "captureHudDef" ) ) + f0_local27( f22_local1, f0_local29( "teamScoresHudId", "teamScoresHudDef" ) ) + run_gc() + f0_local27( f22_local1, f0_local29( "scorelistHudId", "scorelistHudDef" ) ) + f0_local27( f22_local1, f0_local29( "intelInfoHudId", "intelInfoHudDef" ) ) + f0_local27( f22_local1, f0_local29( "splashesHudId", "splashesHudDef" ) ) + if not Engine.UsingSplitscreenUpscaling() then + f0_local27( f22_local1, f0_local29( "perksOnSpawnHudId", "perksOnSpawnHudDef" ) ) + end + f22_local2 = Engine.GetDvarString( "ui_gametype" ) + local f22_local3 = Engine.GetDvarString( "ui_mapname" ) + if f22_local2 == "fireteam" then + f0_local27( f22_local1, f0_local28( "fireTeamHudId", "fireTeamHudDef" ) ) + end + if f22_local2 == "horde" then + f0_local27( f22_local1, f0_local29( "hordeHudId", "hordeHudDef" ) ) + f0_local27( f22_local1, f0_local29( "hordeRoundHudId", "hordeRoundHudDef" ) ) + f0_local27( f22_local1, f0_local29( "hordePerksHudId", "hordePerksHudDef" ) ) + f0_local27( f22_local1, f0_local29( "hordeExpAmmoHudId", "hordeExpAmmoHudDef" ) ) + end + if f22_local2 == "sd" or f22_local2 == "sr" then + f0_local27( f22_local1, f0_local29( "bombPlantDefuseHudId", "bombPlantDefuseHudDef" ) ) + end + if f22_local2 == "dom" or f22_local2 == "siege" then + f0_local27( f22_local1, f0_local29( "captureDomHudId", "captureDomHudDef" ) ) + end + if f22_local2 == "cranked" or f22_local2 == "horde" then + f0_local27( f22_local1, f0_local29( "crankedBombTimerHudId", "crankedBombTimerHudDef" ) ) + end + if f22_local3 == "mp_dig" then + f0_local27( f22_local1, f0_local29( "digKillstreakHudId", "digKillstreakHudDef" ) ) + end + return self +end + +local f0_local33 = function () + local f27_local0 = RegisterMaterial( "hud_corner" ) + local self = LUI.UIElement.new() + self.id = "fourCornersHudId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "hud_refresh", f0_local22 ) + local f27_local2 = f0_local30( "topLeftCornerId", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = 512, + width = 512, + material = f27_local0, + alpha = 1, + zRot = 180 + } ) + local f27_local3 = f0_local30( "bottomLeftCornerId", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + left = 0, + height = 512, + width = 512, + material = f27_local0, + alpha = 1, + zRot = 270 + } ) + local f27_local4 = f0_local30( "bottomRightCornerId", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = 512, + width = 512, + material = f27_local0, + alpha = 1, + zRot = 0 + } ) + local f27_local5 = f0_local30( "topRightCornerId", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + height = 512, + width = 512, + material = f27_local0, + alpha = 1, + zRot = 90 + } ) + self:addElement( f27_local2 ) + self:addElement( f27_local3 ) + self:addElement( f27_local4 ) + self:addElement( f27_local5 ) + return self +end + +local f0_local34 = function () + local self = LUI.UIElement.new() + self.id = "hintsContainerHudId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true + } ) + self:animateToState( "default", 0 ) + local f28_local1 = LUI.mp_hud.Hints.mantleHintDef() + local f28_local2 = LUI.mp_hud.Hints.cursorHintDef() + local f28_local3 = LUI.mp_hud.Hints.invalidCmdHintDef() + local f28_local4 = LUI.mp_hud.Hints.breathHintDef() + local f28_local5 = LUI.mp_hud.Hints.zoomHintDef() + local f28_local6 = LUI.mp_hud.Hints.toggleHybridHintDef() + local f28_local7 = LUI.mp_hud.Hints.toggleThermalHintDef() + self:addElement( f28_local1 ) + self:addElement( f28_local2 ) + self:addElement( f28_local3 ) + self:addElement( f28_local4 ) + self:addElement( f28_local5 ) + self:addElement( f28_local6 ) + self:addElement( f28_local7 ) + return self +end + +local f0_local35 = function () + return { + type = "hud", + id = "hud_720_id" + } +end + +LUI.MenuBuilder.registerType( "fourCornersHudDef", f0_local33 ) +LUI.MenuBuilder.registerType( "hintsHudDef", f0_local34 ) +LUI.MenuBuilder.registerType( "hud", f0_local32 ) +LUI.MenuBuilder.registerDef( "hud_720", f0_local35 ) +LUI.HudManager.registerHud( "hud_720" ) +LockTable( _M ) diff --git a/lui/mp_hud/hudutils.dec.lua b/lui/mp_hud/hudutils.dec.lua new file mode 100644 index 0000000..5526101 --- /dev/null +++ b/lui/mp_hud/hudutils.dec.lua @@ -0,0 +1,68 @@ +SplashTable = { + File = "mp/splashTable.csv", + Cols = { + Ref = 0, + Name = 1, + Desc = 2, + Image = 3, + Duration = 4, + Red = 5, + Green = 6, + Blue = 7, + Alpha = 8, + Sound = 9, + DontKnow = 10, + SplashType = 11 + } +} +IntelChallengesTable = { + File = "mp/intelChallenges.csv", + Cols = { + Ref = 0, + Name = 1, + Reward = 2, + Target = 3, + Available = 4 + } +} +KillCamAbilitiesBitMaskTable = { + File = "mp/killCamAbilitiesBitMaskTable.csv", + Cols = { + Index = 0, + Ref = 1, + BitMask = 2 + } +} +XPEventTable = { + File = "mp/xp_event_table.csv", + Cols = { + Ref = 0, + Name = 1, + Sound = 2, + XPValueDM = 3, + XPValueWar = 4, + XPValueSD = 5, + XPValueDom = 6, + XPValueConf = 7, + XPValueSR = 8, + XPValueBnty = 9, + XPValueGrind = 10, + XPValueBlitz = 11, + XPValueCranked = 12, + XPValueInfect = 13, + XPValueSOTF = 14, + XPValueHorde = 15, + XPValueMugger = 16, + XPValueAliens = 17 + } +} +HordeIconsTable = { + File = "mp/hordeIcons.csv", + Cols = { + Index = 0, + Ref = 1, + Name = 2, + Image = 3, + Misc = 4 + } +} diff --git a/lui/mp_hud/ingameactionscontrols.dec.lua b/lui/mp_hud/ingameactionscontrols.dec.lua new file mode 100644 index 0000000..450adf9 --- /dev/null +++ b/lui/mp_hud/ingameactionscontrols.dec.lua @@ -0,0 +1,271 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetDisplay( f1_arg0 ) + return Engine.GetBinding( f1_arg0 ) +end + +function bindKey( f2_arg0 ) + Engine.BindKey( f2_arg0 ) +end + +function OptionsWindowRefresh( f3_arg0, f3_arg1 ) + if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then + f3_arg0:processEvent( { + name = "menu_refresh" + } ) + f3_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function SinglePlayerDisableFunction( f5_arg0, f5_arg1 ) + return not Engine.IsMultiplayer() +end + +function ControlBindFactory( f6_arg0, f6_arg1, f6_arg2 ) + return { + type = "UIGenericButton", + id = "bind_" .. f6_arg0, + disabledFunc = f6_arg2 or function () + return false + end + , + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f6_arg0 ), + button_display_func = function ( f8_arg0, f8_arg1 ) + return GetDisplay( f6_arg1 ) + end + , + button_action_func = function ( f9_arg0, f9_arg1 ) + Engine.BindKey( f6_arg1 ) + OptionsWindowTriggerRefresh( f9_arg0, f9_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionFactoryProfileData( f10_arg0, f10_arg1, f10_arg2, f10_arg3, f10_arg4, f10_arg5 ) + local f10_local0 = Engine.GetProfileData( f10_arg0 ) + local f10_local1 = 1 + for f10_local5, f10_local6 in pairs( f10_arg3 ) do + if f10_local6.value == f10_local0 then + f10_local1 = f10_local5 + break + end + end + f10_local2 = function ( f11_arg0, f11_arg1 ) + Engine.ExecNow( f10_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + OptionsWindowTriggerRefresh( f11_arg0, f11_arg1 ) + end + + f10_local3 = { + type = "UIGenericButton", + id = "option_" .. f10_arg0, + disabledFunc = f10_arg4 or function () + return false + end + + } + f10_local4 = { + variant = GenericButtonSettings.Variants.Select + } + if f10_arg5 then + local f10_local7 = f10_arg2 + end + f10_local4.button_text = f10_local7 or Engine.Localize( f10_arg2 ) + f10_local4.button_display_func = function ( f13_arg0, f13_arg1 ) + return Engine.Localize( f10_arg3[f10_local1].text ) + end + + f10_local4.button_left_func = function ( f14_arg0, f14_arg1 ) + f10_local1 = 1 + (#f10_arg3 + f10_local1 - 1 - 1) % #f10_arg3 + f10_local2( f14_arg0, f14_arg1 ) + end + + f10_local4.button_right_func = function ( f15_arg0, f15_arg1 ) + f10_local1 = 1 + (f10_local1 - 1 + 1) % #f10_arg3 + f10_local2( f15_arg0, f15_arg1 ) + end + + f10_local3.properties = f10_local4 + f10_local3.handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + return f10_local3 +end + +function OptionsFeeder( f16_arg0 ) + local f16_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f16_local0[#f16_local0 + 1] = OptionFactoryProfileData( "leanEnabled", "profile_toggleLean", "@LUA_MENU_LEAN_TOGGLE", { + { + text = "@LUA_MENU_ENABLED", + value = true + }, + { + text = "@LUA_MENU_DISABLED", + value = false + } + } ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_FIRE_WEAPON", "+attack" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_AIM_DOWN_THE_SIGHT", "+toggleads_throw" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_HOLD_AIM_DOWN_SIGHT", "+speed_throw" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_RELOAD_WEAPON", "+reload" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_SWITCH_WEAPON", "weapnext" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@PLATFORM_MELEEZOOM", "+melee_zoom" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_USE", "+activate" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_FRAG_EQUIPMENT", "+frag" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_THROW_SPECIAL_GRENADE", "+smoke" ) + if SinglePlayerDisableFunction() then + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_INVENTORY_KILLSTREAK", "+actionslot 4" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_SECONDARY_INVENTORY", "+actionslot 2" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_NVG_WATCH", "+actionslot 1" ) + else + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_1", "+actionslot 4" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_2", "+actionslot 5" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_3", "+actionslot 6" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_4", "+actionslot 7" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( Engine.IsAliensMode() and "ALIENS_UPGRADE_ABILITIES" or "@PLATFORM_UI_SHOW_SCORES", "togglescores" ) + end + return f16_local0 +end + +function OptionsMainCreate( f17_arg0, f17_arg1 ) + f17_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function actions_controls_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function actions_controls() + return { + type = "UIElement", + id = "actions_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = function ( f20_arg0, f20_arg1 ) + Engine.Exec( "updategamerprofile" ) + end + + }, + children = { + { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIImage", + id = "options_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5, + material = RegisterMaterial( "black" ) + } + } + }, + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_ACTIONS" ) + } + }, + { + type = "actions_controls_vlist", + id = "actions_cotnrols_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "actions_controls_vlist", actions_controls_vlist ) +LUI.MenuBuilder.registerDef( "actions_controls", actions_controls ) +LockTable( _M ) diff --git a/lui/mp_hud/ingameadvancedvideo.dec.lua b/lui/mp_hud/ingameadvancedvideo.dec.lua new file mode 100644 index 0000000..4816e03 --- /dev/null +++ b/lui/mp_hud/ingameadvancedvideo.dec.lua @@ -0,0 +1,732 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function BackButtonAction( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + f1_arg0:dispatchEventToRoot( { + name = "check_show_apply", + immediate = true + } ) + if f1_local0.showApplySettings then + if Engine.ShowLowTextureResolutionWarning() then + if f1_local0.vidRestart then + LUI.FlowManager.RequestPopupMenu( f1_arg0, "show_low_texture_res_warning_restart_popmenu", false, f1_arg1.controller, false ) + else + LUI.FlowManager.RequestPopupMenu( f1_arg0, "show_low_texture_res_warning_popmenu", false, f1_arg1.controller, false ) + end + elseif f1_local0.vidRestart then + LUI.FlowManager.RequestPopupMenu( f1_arg0, "apply_settings_restart_popmenu", false, f1_arg1.controller, false ) + else + LUI.FlowManager.RequestPopupMenu( f1_arg0, "apply_settings_popmenu", false, f1_arg1.controller, false ) + end + end + LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) +end + +function InGameDisabledFunc( f2_arg0, f2_arg1 ) + return not Engine.CanVidRestart() +end + +function PicmipDisabledFunc() + local f3_local0 = InGameDisabledFunc() + if not f3_local0 then + f3_local0 = Engine.GetDvarInt( "ui_r_picmip_manual" ) == 0 + end + return f3_local0 +end + +f0_local0 = nil +function NVidiaButtonOver( f4_arg0, f4_arg1 ) + f0_local0 = f4_arg0.id + f4_arg0:dispatchEventToRoot( { + name = "show_nvidia_subtitle", + immediate = true + } ) +end + +function NVidiaButtonUp( f5_arg0, f5_arg1 ) + if f0_local0 == f5_arg0.id then + f0_local0 = nil + f5_arg0:dispatchEventToRoot( { + name = "hide_nvidia_subtitle", + immediate = true + } ) + end +end + +function OptionsWindowRefresh( f6_arg0, f6_arg1 ) + if f6_arg1.source_input == "button_action" or f6_arg1.source_input == "key_bound" or f6_arg1.source_input == "button_right" or f6_arg1.source_input == "button_left" then + f6_arg0:processEvent( { + name = "menu_refresh" + } ) + f6_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f7_arg0, f7_arg1 ) + f7_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f7_arg1.name, + immediate = true + } ) +end + +function GetFOV( f8_arg0 ) + return (Engine.GetDvarFloat( "ui_cg_fov" ) - f8_arg0.Min) / (f8_arg0.Max - f8_arg0.Min) +end + +function SliderChange( f9_arg0, f9_arg1, f9_arg2, f9_arg3 ) + Engine.SetDvarFloat( f9_arg3, math.min( f9_arg1, math.max( f9_arg0, Engine.GetDvarFloat( f9_arg3 ) + f9_arg2 ) ) ) +end + +function OptionFactory( f10_arg0, f10_arg1, f10_arg2, f10_arg3, f10_arg4, f10_arg5, f10_arg6, f10_arg7, f10_arg8, f10_arg9, f10_arg10, f10_arg11 ) + local f10_local0 = nil + local f10_local1 = 1 + local f10_local2 = Engine.GetDvarType( f10_arg0 ) + local f10_local3 = nil + if f10_arg9 then + f10_local3 = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( f10_arg1 ), + button_display_func = function ( f11_arg0, f11_arg1 ) + return f10_arg11( f10_arg10 ) + end, + button_left_func = function ( f12_arg0, f12_arg1 ) + SliderChange( f10_arg10.Min, f10_arg10.Max, -f10_arg10.Step, f10_arg0 ) + end, + button_right_func = function ( f13_arg0, f13_arg1 ) + SliderChange( f10_arg10.Min, f10_arg10.Max, f10_arg10.Step, f10_arg0 ) + end + } + else + if f10_local2 == DvarTypeTable.DvarString or f10_local2 == DvarTypeTable.DvarEnum then + f10_local0 = Engine.GetDvarString( f10_arg0 ) + elseif f10_local2 == DvarTypeTable.DvarInt then + f10_local0 = Engine.GetDvarInt( f10_arg0 ) + elseif f10_local2 == DvarTypeTable.DvarBool then + f10_local0 = Engine.GetDvarBool( f10_arg0 ) + end + for f10_local7, f10_local8 in pairs( f10_arg2 ) do + if f10_local8.value == f10_local0 then + f10_local1 = f10_local7 + break + end + end + f10_local4 = function ( f14_arg0, f14_arg1 ) + if f10_local2 == DvarTypeTable.DvarString or f10_local2 == DvarTypeTable.DvarEnum then + Engine.SetDvarString( f10_arg0, f10_arg2[f10_local1].value ) + elseif f10_local2 == DvarTypeTable.DvarInt then + Engine.SetDvarInt( f10_arg0, f10_arg2[f10_local1].value ) + elseif f10_local2 == DvarTypeTable.DvarBool then + Engine.SetDvarBool( f10_arg0, f10_arg2[f10_local1].value ) + end + OptionsWindowTriggerRefresh( f14_arg0, f14_arg1 ) + end + + f10_local3 = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f10_arg1 ), + button_display_func = function ( f15_arg0, f15_arg1 ) + return f10_arg6 and f10_arg2[f10_local1].text or Engine.Localize( f10_arg2[f10_local1].text ) + end, + button_left_func = function ( f16_arg0, f16_arg1 ) + f10_local1 = 1 + (#f10_arg2 + f10_local1 - 1 - 1) % #f10_arg2 + f10_local4( f16_arg0, f16_arg1 ) + end, + button_right_func = function ( f17_arg0, f17_arg1 ) + f10_local1 = 1 + (f10_local1 - 1 + 1) % #f10_arg2 + f10_local4( f17_arg0, f17_arg1 ) + end, + button_over_func = f10_arg7, + button_up_func = f10_arg8 + } + end + return { + type = "UIGenericButton", + id = "option_" .. f10_arg0, + disabledFunc = f10_arg4 or function () + return false + end + , + states = { + default = { + alpha = 1 + }, + invisible = { + alpha = 0 + } + }, + properties = f10_local3, + handlers = { + check_show_apply = function ( f19_arg0, f19_arg1 ) + if f10_arg3 then + if f10_arg9 then + local f19_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f19_arg0 ) + if Engine.GetDvarFloat( f10_arg3 ) ~= Engine.GetDvarFloat( f10_arg0 ) then + f19_local0.showApplySettings = true + if f10_arg5 then + f19_local0.vidRestart = true + end + end + else + local f19_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f19_arg0 ) + local f19_local1 = nil + local f19_local2 = Engine.GetDvarType( f10_arg3 ) + if f19_local2 == DvarTypeTable.DvarString or f19_local2 == DvarTypeTable.DvarEnum then + f19_local1 = Engine.GetDvarString( f10_arg3 ) + elseif f19_local2 == DvarTypeTable.DvarInt then + f19_local1 = tostring( Engine.GetDvarInt( f10_arg3 ) ) + elseif f19_local2 == DvarTypeTable.DvarBool then + if Engine.GetDvarBool( f10_arg3 ) then + local f19_local3 = "1" + end + f19_local1 = f19_local3 or "0" + elseif f19_local2 == DvarTypeTable.DvarFloat then + f19_local1 = tostring( Engine.GetDvarFloat( f10_arg3 ) ) + end + if f19_local1 ~= f10_arg2[f10_local1].value then + f19_local0.showApplySettings = true + if f10_arg5 then + f19_local0.vidRestart = true + end + end + end + end + end + + } + } +end + +function OptionsFeeder( f20_arg0 ) + local f20_local0 = { + [#f20_local0 + 1] = OptionFactory( "ui_r_aspectratio", "@MENU_ASPECT_RATIO", { + { + text = "@MENU_AUTO", + value = "auto" + }, + { + text = "@MENU_STANDARD_4_3", + value = "standard" + }, + { + text = "@MENU_WIDE_16_10", + value = "wide 16:10" + }, + { + text = "MENU_WIDE_16_9", + value = "wide 16:9" + } + }, "r_aspectratio", InGameDisabledFunc, true ) + } + local f20_local1 = {} + for f20_local5, f20_local6 in pairs( Engine.GetDvarEnumList( "r_displayRefresh" ) ) do + f20_local1[#f20_local1 + 1] = { + text = f20_local6, + value = f20_local6 + } + end + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_displayRefresh", "@MENU_SCREEN_REFRESH_RATE", f20_local1, "r_displayRefresh", InGameDisabledFunc, true ) + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_vsync", "@MENU_SYNC_EVERY_FRAME", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_vsync", InGameDisabledFunc, true ) + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_imageQuality", "@PLATFORM_UI_IMAGE_QUALITY", { + { + text = "@MENU_VERY_LOW", + value = "1" + }, + { + text = "@MENU_LOW", + value = "2" + }, + { + text = "@MENU_NORMAL", + value = "3" + }, + { + text = "@MENU_HIGH", + value = "4" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_imageQuality", InGameDisabledFunc, true ) + if Engine.IsMultiplayer() then + f20_local2 = {} + f20_local3 = SliderBounds.FOV.Max - SliderBounds.FOV.Min + for f20_local4 = 0, f20_local3, 1 do + local f20_local7 = tostring( SliderBounds.FOV.Min + f20_local4 ) + f20_local2[f20_local4 + 1] = { + text = Engine.MarkLocalized( f20_local7 ), + value = f20_local7 + } + end + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_cg_fov", "@MENU_FOV", f20_local2, "cg_fov", nil, false, true, function ( f21_arg0, f21_arg1 ) + f21_arg0:dispatchEventToRoot( { + name = "show_fov_subtitle", + immediate = true + } ) + end, function ( f22_arg0, f22_arg1 ) + f22_arg0:dispatchEventToRoot( { + name = "hide_fov_subtitle", + immediate = true + } ) + end, false, false, false ) + end + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_dof_enable", "@MENU_DOF", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_dof_enable", nil, false ) + if Engine.HBAOAvailable() then + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_ssao", "@PLATFORM_SSAO", { + { + text = "@MENU_OFF", + value = "0_Off" + }, + { + text = "@PLATFORM_LOW_QUALITY", + value = "1_Low" + }, + { + text = "@PLATFORM_HIGH_QUALITY", + value = "2_High" + }, + { + text = "@PLATFORM_HBAO", + value = "3_HBAO" + } + }, "r_ssao", InGameDisabledFunc, true ) + else + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_ssao", "@PLATFORM_SSAO", { + { + text = "@MENU_OFF", + value = "0_Off" + }, + { + text = "@PLATFORM_LOW_QUALITY", + value = "1_Low" + }, + { + text = "@PLATFORM_HIGH_QUALITY", + value = "2_High" + } + }, "r_ssao", InGameDisabledFunc, true ) + end + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_tessellation", "@MENU_TESSELLATION", { + { + text = "@MENU_OFF", + value = "0_Off" + }, + { + text = "@MENU_NORMAL", + value = "1_Near" + }, + { + text = "@MENU_EXTRA", + value = "2_All" + } + }, "r_tessellation", nil, false ) + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_texFilterAnisoMin", "@LUA_MENU_ANISOTROPIC_FILTERING", { + { + text = "@MENU_LOW", + value = "1" + }, + { + text = "@MENU_NORMAL", + value = "8" + }, + { + text = "@MENU_HIGH", + value = "16" + } + }, "r_texFilterAnisoMin", InGameDisabledFunc, true ) + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_mbEnableA", "@MENU_MOTION_BLUR", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_mbEnableA", InGameDisabledFunc, true ) + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_distortion", "@MENU_DISTORTION", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_distortion", nil, false ) + if Engine.TXAAAvailable() then + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_aaMode", "@MENU_ANTIALIASING", { + { + text = "@MENU_OFF", + value = "Off" + }, + { + text = "@MENU_FXAA", + value = "FXAA" + }, + { + text = "@MENU_2X_MSAA", + value = "2xMSAA" + }, + { + text = "@MENU_4X_MSAA", + value = "4xMSAA" + }, + { + text = "@MENU_SMAA", + value = "SMAA" + }, + { + text = "@MENU_2X_TXAA", + value = "2xTXAA" + }, + { + text = "@MENU_4X_TXAA", + value = "4xTXAA" + } + }, "r_aaMode", InGameDisabledFunc, true ) + else + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_aaMode", "@MENU_ANTIALIASING", { + { + text = "@MENU_OFF", + value = "Off" + }, + { + text = "@MENU_FXAA", + value = "FXAA" + }, + { + text = "@MENU_2X_MSAA", + value = "2xMSAA" + }, + { + text = "@MENU_4X_MSAA", + value = "4xMSAA" + }, + { + text = "@MENU_SMAA", + value = "SMAA" + } + }, "r_aaMode", InGameDisabledFunc, true ) + end + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_sm_enable", "@MENU_SHADOWS", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "sm_enable", InGameDisabledFunc, true ) + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_picmip_manual", "@MENU_TEXTURE_QUALITY", { + { + text = "@MENU_AUTOMATIC", + value = "0" + }, + { + text = "@MENU_MANUAL", + value = "1" + } + }, "r_picmip_manual", InGameDisabledFunc, true ) + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_picmip", "@MENU_TEXTURE_RESOLUTION", { + { + text = "@MENU_LOW", + value = "3" + }, + { + text = "@MENU_NORMAL", + value = "2" + }, + { + text = "@MENU_HIGH", + value = "1" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_picmip", PicmipDisabledFunc, true ) + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_picmip_bump", "@MENU_NORMAL_MAP_RESOLUTION", { + { + text = "@MENU_LOW", + value = "3" + }, + { + text = "@MENU_NORMAL", + value = "2" + }, + { + text = "@MENU_HIGH", + value = "1" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_picmip_bump", PicmipDisabledFunc, true ) + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_picmip_spec", "@MENU_SPECULAR_MAP_RESOLUTION", { + { + text = "@MENU_LOW", + value = "3" + }, + { + text = "@MENU_NORMAL", + value = "2" + }, + { + text = "@MENU_HIGH", + value = "1" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_picmip_spec", PicmipDisabledFunc, true ) + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_picmip_water", "@MENU_WATER_MAP_RESOLUTION", { + { + text = "@MENU_LOW", + value = "1" + }, + { + text = "@MENU_HIGH", + value = "0" + } + }, "r_picmip_water", PicmipDisabledFunc, true ) + if Engine.FurShaderAvailable() then + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_fur_shader", "@MENU_FUR_SHADER", { + { + text = "@MENU_OFF", + value = "0" + }, + { + text = "@MENU_LOW", + value = "1" + }, + { + text = "@MENU_HIGH", + value = "2" + } + }, "r_fur_shader", InGameDisabledFunc, true, nil, NVidiaButtonOver, NVidiaButtonUp ) + end + if Engine.APEXTurbulenceAvailable() then + f20_local0[#f20_local0 + 1] = OptionFactory( "ui_r_apex_turbulence", "@MENU_APEX_TURBULENCE", { + { + text = "@MENU_ON", + value = "1" + }, + { + text = "@MENU_OFF", + value = "0" + } + }, "r_apex_turbulence", InGameDisabledFunc, true, nil, NVidiaButtonOver, NVidiaButtonUp ) + end + return f20_local0 +end + +function OptionsMainCreate( f23_arg0, f23_arg1 ) + Engine.ExecNow( "profile_menuDvarsSetup" ) + f23_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function OptionsMainClose( f24_arg0, f24_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + if Engine.GetDvarString( "r_lodScaleRigid" ) == "2" then + Engine.SetDvarString( "r_lodScaleSkinned", "4" ) + Engine.SetDvarString( "r_lodBiasSkinned", "-200" ) + Engine.SetDvarString( "r_lodBiasRigid", "-100" ) + end + if Engine.GetDvarString( "r_lodScaleRigid" ) == "1" then + Engine.SetDvarString( "r_lodScaleSkinned", "1" ) + Engine.SetDvarString( "r_lodBiasSkinned", "0" ) + Engine.SetDvarString( "r_lodBiasRigid", "0" ) + end +end + +function advanced_video_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + } + } +end + +function advanced_video() + return { + type = "UIElement", + id = "advanced_video_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose, + options_window_refresh = OptionsWindowRefresh + }, + children = { + { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIImage", + id = "options_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5, + material = RegisterMaterial( "black" ) + } + } + }, + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_ADVANCED_VIDEO" ) + } + }, + { + type = "advanced_video_vlist", + id = "advanced_video_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIMarqueeText", + id = "nvidia_option_subtitle", + properties = { + text = Engine.Localize( "@MENU_NVIDIA_OPTION_SUB" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = OptionsListDims.menu_bottom, + bottom = OptionsListDims.menu_bottom + CoD.TextSettings.TinyFont.Height, + left = 10, + right = OptionsListDims.menu_right - 110, + font = CoD.TextSettings.TinyFont.Font, + alignment = LUI.Alignment.Right, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 0 + }, + show_me = { + alpha = 1 + }, + hide_me = { + alpha = 0 + } + }, + handlers = { + show_nvidia_subtitle = function ( f27_arg0, f27_arg1 ) + f27_arg0:setText( Engine.Localize( "@MENU_NVIDIA_OPTION_SUB" ) ) + f27_arg0:animateToState( "show_me", 0 ) + end + , + hide_nvidia_subtitle = function ( f28_arg0, f28_arg1 ) + f28_arg0:animateToState( "hide_me", 0 ) + end + , + show_fov_subtitle = function ( f29_arg0, f29_arg1 ) + f29_arg0:setText( Engine.Localize( "@LUA_MENU_MP_FOV_OPTION_SUB" ) ) + f29_arg0:animateToState( "show_me", 0 ) + end + , + hide_fov_subtitle = function ( f30_arg0, f30_arg1 ) + f30_arg0:animateToState( "hide_me", 0 ) + end + + } + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = BackButtonAction + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "advanced_video_vlist", advanced_video_vlist ) +LUI.MenuBuilder.registerDef( "advanced_video", advanced_video ) +LockTable( _M ) diff --git a/lui/mp_hud/ingamechatcontrols.dec.lua b/lui/mp_hud/ingamechatcontrols.dec.lua new file mode 100644 index 0000000..6d29659 --- /dev/null +++ b/lui/mp_hud/ingamechatcontrols.dec.lua @@ -0,0 +1,186 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetDisplay( f1_arg0 ) + return Engine.GetBinding( f1_arg0 ) +end + +function bindKey( f2_arg0 ) + Engine.BindKey( f2_arg0 ) +end + +function OptionsWindowRefresh( f3_arg0, f3_arg1 ) + if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then + f3_arg0:processEvent( { + name = "menu_refresh" + } ) + f3_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function ControlBindFactory( f5_arg0, f5_arg1 ) + return { + type = "UIGenericButton", + id = "bind_" .. f5_arg1, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f5_arg0 ), + button_display_func = function ( f6_arg0, f6_arg1 ) + return GetDisplay( f5_arg1 ) + end + , + button_action_func = function ( f7_arg0, f7_arg1 ) + Engine.BindKey( f5_arg1 ) + OptionsWindowTriggerRefresh( f7_arg0, f7_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionsFeeder( f8_arg0 ) + local f8_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_TEXT_CHAT", "chatmodepublic" ) + f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_TEXT_TEAM_CHAT", "chatmodeteam" ) + f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_VOICE_CHAT_BUTTON", "+talk" ) + return f8_local0 +end + +function OptionsMainCreate( f9_arg0, f9_arg1 ) + f9_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function chat_controls_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function chat_controls() + return { + type = "UIElement", + id = "chat_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = function ( f12_arg0, f12_arg1 ) + Engine.Exec( "updategamerprofile" ) + end + + }, + children = { + { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIImage", + id = "options_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5, + material = RegisterMaterial( "black" ) + } + } + }, + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_CHAT" ) + } + }, + { + type = "chat_controls_vlist", + id = "chat_controls_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "chat_controls_vlist", chat_controls_vlist ) +LUI.MenuBuilder.registerDef( "chat_controls", chat_controls ) +LockTable( _M ) diff --git a/lui/mp_hud/ingamecontrols.dec.lua b/lui/mp_hud/ingamecontrols.dec.lua new file mode 100644 index 0000000..1bd83ff --- /dev/null +++ b/lui/mp_hud/ingamecontrols.dec.lua @@ -0,0 +1,1046 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetToggleTextForProfileData( f1_arg0, f1_arg1 ) + return Engine.GetProfileData( f1_arg0, f1_arg1 ) and Engine.Localize( "@LUA_MENU_ENABLED" ) or Engine.Localize( "@LUA_MENU_DISABLED" ) +end + +function GetReverseToggleTextForProfileData( f2_arg0, f2_arg1 ) + return Engine.GetProfileData( f2_arg0, f2_arg1 ) and Engine.Localize( "@LUA_MENU_DISABLED" ) or Engine.Localize( "@LUA_MENU_ENABLED" ) +end + +function ProfileMenuOption( f3_arg0, f3_arg1, f3_arg2, f3_arg3, f3_arg4 ) + Engine.SetDvarFloat( f3_arg4, math.min( f3_arg2, math.max( f3_arg1, Engine.GetDvarFloat( f3_arg4 ) + f3_arg3 ) ) ) + Engine.MenuDvarsFinish( f3_arg0 ) +end + +f0_local0 = function () + local f4_local0 = Engine.GetLuiRoot() + if GameX.IsSplitscreen() then + GameX.SetOptionState( false ) + f4_local0:dispatchEventToAllOtherRoots( { + name = "refresh_options_button", + immediate = true + } ) + end +end + +f0_local1 = function ( f5_arg0, f5_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f5_arg0 ) +end + +function GetSticksLayoutName( f6_arg0 ) + local f6_local0 = Engine.GetProfileData( "gpadSticksConfig", f6_arg0 ) + if f6_local0 == "thumbstick_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f6_local0 == "thumbstick_southpaw" then + return Engine.Localize( "@MENU_SOUTHPAW" ) + elseif f6_local0 == "thumbstick_legacy" then + return Engine.Localize( "@MENU_LEGACY" ) + elseif f6_local0 == "thumbstick_southpaw_ns" then + return Engine.Localize( "@MENU_SOUTHPAW_NS" ) + elseif f6_local0 == "thumbstick_legacysouthpaw_ns" then + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW_NS" ) + else + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW" ) + end +end + +function SticksLayoutAction( f7_arg0, f7_arg1 ) + LUI.FlowManager.RequestAddMenu( f7_arg0, "thumbstick", true, f7_arg1.controller, false ) +end + +function GetButtonsLayoutName( f8_arg0 ) + local f8_local0 = Engine.GetProfileData( "gpadButtonsConfig", f8_arg0 ) + if f8_local0 == "buttons_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f8_local0 == "buttons_tactical" then + return Engine.Localize( "@MENU_TACTICAL" ) + elseif f8_local0 == "buttons_lefty" then + return Engine.Localize( "@MENU_LEFTY" ) + elseif f8_local0 == "buttons_nomad" then + return Engine.Localize( "@MENU_NOMAD" ) + elseif f8_local0 == "buttons_nomad_tactical" then + return Engine.Localize( "@MENU_NOMAD_TACTICAL" ) + elseif f8_local0 == "buttons_default_alt" then + return Engine.Localize( "@MENU_DEFAULT_ALT" ) + elseif f8_local0 == "buttons_tactical_alt" then + return Engine.Localize( "@MENU_TACTICAL_ALT" ) + elseif f8_local0 == "buttons_lefty_alt" then + return Engine.Localize( "@MENU_LEFTY_ALT" ) + elseif f8_local0 == "buttons_nomad_alt" then + return Engine.Localize( "@MENU_NOMAD_ALT" ) + else + return Engine.Localize( "@MENU_NOMAD_TACTICAL_ALT" ) + end +end + +function ButtonsLayoutAction( f9_arg0, f9_arg1 ) + LUI.FlowManager.RequestAddMenu( f9_arg0, "buttons", true, f9_arg1.controller, false ) +end + +function LookInversionToggle( f10_arg0 ) + Engine.ToggleInvertedPitch( f10_arg0 ) +end + +function GetLookInversionText( f11_arg0 ) + return GetToggleTextForProfileData( "invertedPitch", f11_arg0 ) +end + +function VibrationToggle( f12_arg0 ) + Engine.ToggleRumble( f12_arg0 ) +end + +function GetVibrationText( f13_arg0 ) + return GetToggleTextForProfileData( "rumble", f13_arg0 ) +end + +function GetSensitivityText() + local f14_local0 = Engine.GetDvarFloat( "profileMenuOption_sensitivity" ) + if f14_local0 == 1 then + return Engine.Localize( "@MENU_LOW" ) .. " " .. f14_local0 + elseif f14_local0 == 3 then + return Engine.Localize( "@MENU_MEDIUM" ) .. " " .. f14_local0 + elseif f14_local0 == 7 then + return Engine.Localize( "@MENU_HIGH" ) .. " " .. f14_local0 + elseif f14_local0 == 13 then + return Engine.Localize( "@MENU_VERY_HIGH" ) .. " " .. f14_local0 + elseif f14_local0 == 20 then + return Engine.Localize( "@MENU_INSANE" ) .. " " .. f14_local0 + else + return f14_local0 .. "" + end +end + +function SensitivityLess( f15_arg0 ) + ProfileMenuOption( f15_arg0, 1, 20, -1, "profileMenuOption_sensitivity" ) +end + +function SensitivityMore( f16_arg0 ) + ProfileMenuOption( f16_arg0, 1, 20, 1, "profileMenuOption_sensitivity" ) +end + +function LeanToggle( f17_arg0 ) + Engine.ToggleLean( f17_arg0 ) +end + +function GetLeanToggleText( f18_arg0 ) + return GetToggleTextForProfileData( "leanEnabled", f18_arg0 ) +end + +function RenderColorBlindToggle( f19_arg0 ) + if Engine.ToggleRenderColorBlind then + Engine.ToggleRenderColorBlind( f19_arg0 ) + end +end + +function GetRenderColorBlindText( f20_arg0 ) + if Engine.ToggleRenderColorBlind then + return GetToggleTextForProfileData( "renderColorBlind", f20_arg0 ) + else + return Engine.Localize( "LUA_MENU_DISABLED" ) + end +end + +function GetHorizontalMargin() + return (Engine.GetDvarFloat( "profileMenuOption_safeAreaHorz" ) - SliderBounds.HorzMargin.Min) / (SliderBounds.HorzMargin.Max - SliderBounds.HorzMargin.Min) +end + +function HorizontalMarginLess( f22_arg0 ) + ProfileMenuOption( f22_arg0, SliderBounds.HorzMargin.Min, SliderBounds.HorzMargin.Max, -SliderBounds.HorzMargin.Step, "profileMenuOption_safeAreaHorz" ) + local f22_local0 = Engine.GetLuiRoot() + f22_local0:processEvent( { + name = "update_hud_margins" + } ) +end + +function HorizontalMarginMore( f23_arg0 ) + ProfileMenuOption( f23_arg0, SliderBounds.HorzMargin.Min, SliderBounds.HorzMargin.Max, SliderBounds.HorzMargin.Step, "profileMenuOption_safeAreaHorz" ) + local f23_local0 = Engine.GetLuiRoot() + f23_local0:processEvent( { + name = "update_hud_margins" + } ) +end + +function RedrawMarginGuide( f24_arg0, f24_arg1 ) + local f24_local0 = Engine.GetDvarFloat( "profileMenuOption_safeAreaHorz" ) + local f24_local1 = Engine.GetDvarFloat( "profileMenuOption_safeAreaVert" ) + local f24_local2 = (1 - (f24_local0 - SliderBounds.HorzMargin.Min) / (SliderBounds.HorzMargin.Max - SliderBounds.HorzMargin.Min)) * 1280 * (1 - SliderBounds.HorzMargin.Min) / 2 + local f24_local3 = (1 - (f24_local1 - SliderBounds.VertMargin.Min) / (SliderBounds.VertMargin.Max - SliderBounds.VertMargin.Min)) * 720 * (1 - SliderBounds.VertMargin.Min) / 2 + f24_arg0:registerAnimationState( "current", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = f24_local2, + right = -f24_local2, + top = f24_local3, + bottom = -f24_local3 + } ) + f24_arg0:animateToState( "current", 0 ) +end + +function in_game_margins_guide() + local f25_local0 = { + type = "UIElement", + id = "in_game_horizontal_margins_guide_id", + states = { + default = { + alpha = 0 + }, + visible = { + alpha = 1 + } + } + } + local f25_local1 = {} + local f25_local2 = MBh.DoMultiple + local f25_local3 = {} + local f25_local4 = MBh.AnimateToState( "visible", 0 ) + local f25_local5 = RedrawMarginGuide + local f25_local6 = MBh.EmitEvent( { + name = "horizontal_margin_over_children" + } ) + f25_local1.horizontal_margin_over = f25_local2( f25_local4 ) + f25_local2 = MBh.DoMultiple + f25_local3 = {} + f25_local4 = MBh.AnimateToState( "visible", 0 ) + f25_local5 = RedrawMarginGuide + f25_local6 = MBh.EmitEvent( { + name = "vertical_margin_over_children" + } ) + f25_local1.vertical_margin_over = f25_local2( f25_local4 ) + f25_local2 = MBh.DoMultiple + f25_local3 = {} + f25_local4 = MBh.AnimateToState( "default", 100, true, false ) + f25_local5 = MBh.EmitEvent( { + name = "horizontal_margin_up_children" + } ) + f25_local1.horizontal_margin_up = f25_local2( f25_local4 ) + f25_local2 = MBh.DoMultiple + f25_local3 = {} + f25_local4 = MBh.AnimateToState( "default", 100, true, false ) + f25_local5 = MBh.EmitEvent( { + name = "vertical_margin_up_children" + } ) + f25_local1.vertical_margin_up = f25_local2( f25_local4 ) + f25_local1.horizontal_margin_update = RedrawMarginGuide + f25_local1.vertical_margin_update = RedrawMarginGuide + f25_local0.handlers = f25_local1 + f25_local0.children = { + { + type = "UIImage", + id = "margins_guide_dim", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + red = 0.21, + green = 0.21, + blue = 0.21, + alpha = 0.5 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_lt", + handlers = { + horizontal_margin_over_children = MBh.AnimateToState( "visible", 0 ), + horizontal_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -7, + right = 57, + top = -64, + bottom = 64, + material = RegisterMaterial( "widg_margin_arrow_lt" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_rt", + handlers = { + horizontal_margin_over_children = MBh.AnimateToState( "visible", 0 ), + horizontal_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = -47, + right = 17, + top = -64, + bottom = 64, + material = RegisterMaterial( "widg_margin_arrow_rt" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_top", + handlers = { + vertical_margin_over_children = MBh.AnimateToState( "visible", 0 ), + vertical_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -64, + right = 64, + top = -7, + bottom = 57, + material = RegisterMaterial( "widg_margin_arrow_top" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_bot", + handlers = { + vertical_margin_over_children = MBh.AnimateToState( "visible", 0 ), + vertical_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = -64, + right = 64, + top = -47, + bottom = 17, + material = RegisterMaterial( "widg_margin_arrow_bot" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "generic_border" + } + } + return f25_local0 +end + +function GetVerticalMargin() + return (Engine.GetDvarFloat( "profileMenuOption_safeAreaVert" ) - SliderBounds.VertMargin.Min) / (SliderBounds.VertMargin.Max - SliderBounds.VertMargin.Min) +end + +function VerticalMarginLess( f27_arg0 ) + ProfileMenuOption( f27_arg0, SliderBounds.VertMargin.Min, SliderBounds.VertMargin.Max, -SliderBounds.VertMargin.Step, "profileMenuOption_safeAreaVert" ) + local f27_local0 = Engine.GetLuiRoot() + f27_local0:processEvent( { + name = "update_hud_margins" + } ) +end + +function VerticalMarginMore( f28_arg0 ) + ProfileMenuOption( f28_arg0, SliderBounds.VertMargin.Min, SliderBounds.VertMargin.Max, SliderBounds.VertMargin.Step, "profileMenuOption_safeAreaVert" ) + local f28_local0 = Engine.GetLuiRoot() + f28_local0:processEvent( { + name = "update_hud_margins" + } ) +end + +function GetVolume() + return (Engine.GetDvarFloat( "profileMenuOption_volume" ) - SliderBounds.Volume.Min) / (SliderBounds.Volume.Max - SliderBounds.Volume.Min) +end + +function VolumeLess( f30_arg0 ) + ProfileMenuOption( f30_arg0, SliderBounds.Volume.Min, SliderBounds.Volume.Max, -SliderBounds.Volume.Step, "profileMenuOption_volume" ) +end + +function VolumeMore( f31_arg0 ) + ProfileMenuOption( f31_arg0, SliderBounds.Volume.Min, SliderBounds.Volume.Max, SliderBounds.Volume.Step, "profileMenuOption_volume" ) +end + +function GetBrightness() + return 1 - (Engine.GetDvarFloat( "profileMenuOption_blacklevel" ) - SliderBounds.Brightness.Min) / (SliderBounds.Brightness.Max - SliderBounds.Brightness.Min) +end + +function BrightnessLess( f33_arg0, f33_arg1 ) + ProfileMenuOption( f33_arg0, SliderBounds.Brightness.Min, SliderBounds.Brightness.Max, -SliderBounds.Brightness.Step, "profileMenuOption_blacklevel" ) + f33_arg1:dispatchEventToRoot( { + name = "brightness_updated" + } ) +end + +function BrightnessMore( f34_arg0, f34_arg1 ) + ProfileMenuOption( f34_arg0, SliderBounds.Brightness.Min, SliderBounds.Brightness.Max, SliderBounds.Brightness.Step, "profileMenuOption_blacklevel" ) + f34_arg1:dispatchEventToRoot( { + name = "brightness_updated" + } ) +end + +function UpdateBrightnessGuide( f35_arg0, f35_arg1 ) + if Engine.IsXbox360() then + return + end + local f35_local0 = Engine.GetDvarFloat( "profileMenuOption_blacklevel" ) + local f35_local1 = nil + if f35_arg0.id == BrightnessGuideConstants.not_visible.item_id then + f35_local1 = BrightnessGuideConstants.not_visible.color_default + elseif f35_arg0.id == BrightnessGuideConstants.barely_visible.item_id then + f35_local1 = BrightnessGuideConstants.barely_visible.color_default + elseif f35_arg0.id == BrightnessGuideConstants.easily_visible.item_id then + f35_local1 = BrightnessGuideConstants.easily_visible.color_default + end + if f35_local1 ~= nil then + local f35_local2 = (f35_local1 - f35_local0) / (1 - f35_local0) + f35_arg0:registerAnimationState( "current", { + red = f35_local2, + green = f35_local2, + blue = f35_local2 + } ) + f35_arg0:animateToState( "current", 0 ) + end +end + +function in_game_brightness_guide() + local f36_local0 = { + type = "UIElement", + id = "in_game_brightness_guide_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 150, + bottom = 510, + left = 710, + right = 1070, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + properties = { + band_height = 120 + } + } + local f36_local1 = {} + local f36_local2 = MBh.DoMultiple + local f36_local3 = {} + local f36_local4 = MBh.AnimateToState( "visible", 0 ) + local f36_local5 = MBh.EmitEvent( { + name = "brightness_over_children" + } ) + f36_local1.brightness_over = f36_local2( f36_local4 ) + f36_local1.brightness_up = MBh.AnimateToState( "default", 0 ) + f36_local0.handlers = f36_local1 + f36_local0.children = { + { + type = "generic_border", + properties = { + thickness = 2, + border_red = Colors.generic_menu_frame_color.r, + border_green = Colors.generic_menu_frame_color.g, + border_blue = Colors.generic_menu_frame_color.b + } + }, + { + type = "UIVerticalList", + id = "brightness_guide_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = BrightnessGuideConstants.not_visible.item_id, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = MBh.Property( "band_height" ), + material = RegisterMaterial( "white" ), + red = BrightnessGuideConstants.not_visible.color_default, + green = BrightnessGuideConstants.not_visible.color_default, + blue = BrightnessGuideConstants.not_visible.color_default + } + }, + children = { + { + type = "UIText", + id = "text_not_visible", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_NOT_VISIBLE" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + font = CoD.TextSettings.ExtraBigFont.Font, + red = 0, + green = 0, + blue = 0, + alignment = LUI.Alignment.Center + } + } + } + }, + handlers = { + brightness_over_children = UpdateBrightnessGuide, + brightness_updated = UpdateBrightnessGuide + } + }, + { + type = "UIImage", + id = BrightnessGuideConstants.barely_visible.item_id, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = MBh.Property( "band_height" ), + material = RegisterMaterial( "white" ), + red = BrightnessGuideConstants.barely_visible.color_default, + green = BrightnessGuideConstants.barely_visible.color_default, + blue = BrightnessGuideConstants.barely_visible.color_default + } + }, + children = { + { + type = "UIText", + id = "text_barely_visible", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_BARELY_VISIBLE" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + font = CoD.TextSettings.ExtraBigFont.Font, + red = 0, + green = 0, + blue = 0, + alignment = LUI.Alignment.Center + } + } + } + }, + handlers = { + brightness_over_children = UpdateBrightnessGuide, + brightness_updated = UpdateBrightnessGuide + } + }, + { + type = "UIImage", + id = BrightnessGuideConstants.easily_visible.item_id, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = MBh.Property( "band_height" ), + material = RegisterMaterial( "white" ), + red = BrightnessGuideConstants.easily_visible.color_default, + green = BrightnessGuideConstants.easily_visible.color_default, + blue = BrightnessGuideConstants.easily_visible.color_default + } + }, + children = { + { + type = "UIText", + id = "text_barely_visible", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_EASILY_VISIBLE" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + font = CoD.TextSettings.ExtraBigFont.Font, + red = 0, + green = 0, + blue = 0, + alignment = LUI.Alignment.Center + } + } + } + }, + handlers = { + brightness_over_children = UpdateBrightnessGuide, + brightness_updated = UpdateBrightnessGuide + } + }, + { + type = "UIElement", + id = "spacing_element_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 15 + } + } + }, + { + type = "UIText", + id = "background_guide_help", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_DESC2" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + } + } + } + } + return f36_local0 +end + +function OptionsFeeder( f37_arg0 ) + Engine.MenuDvarsSetup( f37_arg0.exclusiveController ) + local f37_local0 = GameX.IsSplitscreen() + local f37_local1 = { + [#f37_local1 + 1] = { + type = "UIGenericButton", + id = "stick_layout_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_THUMBSTICK_LAYOUT_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_STICK_LAYOUT_DESC" ), + button_display_func = function ( f38_arg0, f38_arg1 ) + return GetSticksLayoutName( f37_arg0.exclusiveController ) + end, + button_action_func = SticksLayoutAction + } + }, + [#f37_local1 + 1] = { + type = "UIGenericButton", + id = "buttons_layout_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_BUTTON_LAYOUT_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_BUTTON_LAYOUT_DESC" ), + button_display_func = function ( f39_arg0, f39_arg1 ) + return GetButtonsLayoutName( f37_arg0.exclusiveController ) + end, + button_action_func = ButtonsLayoutAction + } + }, + [#f37_local1 + 1] = { + type = "UIGenericButton", + id = "look_inversion_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_LOOK_INVERSION_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_LOOK_INVERSION_DESC" ), + button_display_func = function ( f40_arg0, f40_arg1 ) + return GetLookInversionText( f37_arg0.exclusiveController ) + end, + button_left_func = function ( f41_arg0, f41_arg1 ) + LookInversionToggle( f37_arg0.exclusiveController ) + end, + button_right_func = function ( f42_arg0, f42_arg1 ) + LookInversionToggle( f37_arg0.exclusiveController ) + end + } + }, + [#f37_local1 + 1] = { + type = "UIGenericButton", + id = "vibration_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_CONTROLLER_VIBRATION_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_VIBRATION_DESC" ), + button_display_func = function ( f43_arg0, f43_arg1 ) + return GetVibrationText( f37_arg0.exclusiveController ) + end, + button_left_func = function ( f44_arg0, f44_arg1 ) + return VibrationToggle( f37_arg0.exclusiveController ) + end, + button_right_func = function ( f45_arg0, f45_arg1 ) + return VibrationToggle( f37_arg0.exclusiveController ) + end + } + }, + [#f37_local1 + 1] = { + type = "UIGenericButton", + id = "sensitivity_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_LOOK_SENSITIVITY_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_SENSITIVITY_DESC" ), + button_display_func = GetSensitivityText, + button_left_func = function ( f46_arg0, f46_arg1 ) + return SensitivityLess( f37_arg0.exclusiveController ) + end, + button_right_func = function ( f47_arg0, f47_arg1 ) + return SensitivityMore( f37_arg0.exclusiveController ) + end + } + } + } + if not f37_local0 then + f37_local1[#f37_local1 + 1] = { + type = "UIGenericButton", + id = "horizontal_margin_button_id", + properties = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( "@MENU_HUD_MARGIN_HORIZONTAL_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_HORIZONTAL_MARGIN_DESC" ), + button_display_func = GetHorizontalMargin, + button_left_func = function ( f48_arg0, f48_arg1 ) + HorizontalMarginLess( f37_arg0.exclusiveController ) + f48_arg0:dispatchEventToRoot( { + name = "horizontal_margin_update" + } ) + end, + button_right_func = function ( f49_arg0, f49_arg1 ) + HorizontalMarginMore( f37_arg0.exclusiveController ) + f49_arg0:dispatchEventToRoot( { + name = "horizontal_margin_update" + } ) + end, + button_over_func = MBh.EmitEventToRoot( "horizontal_margin_over" ), + button_up_func = MBh.EmitEventToRoot( "horizontal_margin_up" ) + } + } + f37_local1[#f37_local1 + 1] = { + type = "UIGenericButton", + id = "vertical_margin_button_id", + properties = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( "@MENU_HUD_MARGIN_VERTICAL_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_VERTICAL_MARGIN_DESC" ), + button_display_func = GetVerticalMargin, + button_left_func = function ( f50_arg0, f50_arg1 ) + VerticalMarginLess( f37_arg0.exclusiveController ) + f50_arg0:dispatchEventToRoot( { + name = "vertical_margin_update" + } ) + end, + button_right_func = function ( f51_arg0, f51_arg1 ) + VerticalMarginMore( f37_arg0.exclusiveController ) + f51_arg0:dispatchEventToRoot( { + name = "vertical_margin_update" + } ) + end, + button_over_func = MBh.EmitEventToRoot( "vertical_margin_over" ), + button_up_func = MBh.EmitEventToRoot( "vertical_margin_up" ) + } + } + end + if not f37_local0 then + f37_local1[#f37_local1 + 1] = { + type = "UIGenericButton", + id = "volume_button_id", + properties = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( "@MENU_VOLUME_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_GAME_VOLUME_DESC" ), + button_display_func = GetVolume, + button_left_func = function ( f52_arg0, f52_arg1 ) + VolumeLess( f37_arg0.exclusiveController ) + end, + button_right_func = function ( f53_arg0, f53_arg1 ) + VolumeMore( f37_arg0.exclusiveController ) + end + } + } + f37_local1[#f37_local1 + 1] = { + type = "UIGenericButton", + id = "brightness_button_id", + properties = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( "@MENU_BRIGHTNESS_CAPS" ), + desc_text = Engine.Localize( "@MENU_BRIGHTNESS_DESC1" ), + button_display_func = GetBrightness, + button_left_func = function ( f54_arg0, f54_arg1 ) + BrightnessLess( f37_arg0.exclusiveController, f54_arg0 ) + end, + button_right_func = function ( f55_arg0, f55_arg1 ) + BrightnessMore( f37_arg0.exclusiveController, f55_arg0 ) + end, + button_over_func = MBh.EmitEventToRoot( "brightness_over" ), + button_up_func = MBh.EmitEventToRoot( "brightness_up" ) + } + } + end + f37_local1[#f37_local1 + 1] = { + type = "UIGenericButton", + id = "render_color_blind_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "LUA_MENU_COLORBLIND_FILTER_CAPS" ), + desc_text = Engine.Localize( "LUA_MENU_COLOR_BLIND_DESC" ), + button_display_func = function ( f56_arg0, f56_arg1 ) + return GetRenderColorBlindText( f37_arg0.exclusiveController ) + end, + button_left_func = function ( f57_arg0, f57_arg1 ) + RenderColorBlindToggle( f37_arg0.exclusiveController ) + end, + button_right_func = function ( f58_arg0, f58_arg1 ) + RenderColorBlindToggle( f37_arg0.exclusiveController ) + end + } + } + f37_local1[#f37_local1 + 1] = { + type = "UIGenericButton", + id = "toggle_lean_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_LEAN_TOGGLE_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_LEAN_TOGGLE_DESC" ), + button_display_func = function ( f59_arg0, f59_arg1 ) + return GetLeanToggleText( f37_arg0.exclusiveController ) + end, + button_left_func = function ( f60_arg0, f60_arg1 ) + LeanToggle( f37_arg0.exclusiveController ) + end, + button_right_func = function ( f61_arg0, f61_arg1 ) + LeanToggle( f37_arg0.exclusiveController ) + end + } + } + return f37_local1 +end + +function in_game_options_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + focusable = true, + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + }, + properties = { + scrollByChildHeight = true + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + } + } +end + +function OptionsMainCreate( f63_arg0, f63_arg1 ) + f63_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then + f63_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addFriendsButton ) + end +end + +function OptionsMainClose( f64_arg0, f64_arg1 ) + Engine.Exec( "updategamerprofile" ) + f64_arg0:dispatchEventToRoot( { + name = "refresh_controls" + } ) +end + +function mp_in_game_controls_menu() + local f65_local0 = { + type = "UIElement", + id = "mp_in_game_controls_menu_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose, + omnvar_update = { + ui_pause_menu_show = LUI.mp_hud.OptionsMenu.pauseMenuUpdate + } + }, + children = { + { + type = "UIWorldBlur", + id = "optionsWorldBlurOverlay", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIImage", + id = "options_background2", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5, + material = RegisterMaterial( "black" ) + } + } + }, + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_OPTIONS_UPPER_CASE" ) + } + }, + { + type = "in_game_options_vlist", + id = "in_game_options_vlist_id" + }, + { + type = "button_helper_text_main", + id = "in_game_options_helper_bar_id" + }, + { + type = "UIBindButton", + id = "options_back_id", + handlers = { + button_start = f0_local1, + button_secondary = f0_local1 + } + } + } + } + if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then + table.insert( f65_local0.children, { + type = "online_friends_widget" + } ) + end + table.insert( f65_local0.children, { + type = "in_game_brightness_guide" + } ) + table.insert( f65_local0.children, { + type = "in_game_margins_guide" + } ) + return f65_local0 +end + +LUI.MenuBuilder.registerDef( "in_game_margins_guide", in_game_margins_guide ) +LUI.MenuBuilder.registerDef( "in_game_brightness_guide", in_game_brightness_guide ) +LUI.MenuBuilder.registerDef( "in_game_options_vlist", in_game_options_vlist ) +LUI.MenuBuilder.registerDef( "mp_in_game_controls_menu", mp_in_game_controls_menu ) +LUI.FlowManager.RegisterStackPopBehaviour( "mp_in_game_controls_menu", f0_local0 ) +LockTable( _M ) diff --git a/lui/mp_hud/ingamegamepadcontrols.dec.lua b/lui/mp_hud/ingamegamepadcontrols.dec.lua new file mode 100644 index 0000000..e578ff4 --- /dev/null +++ b/lui/mp_hud/ingamegamepadcontrols.dec.lua @@ -0,0 +1,432 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GamepadDisabledFunc( f1_arg0, f1_arg1 ) + return not Engine.GetProfileData( "gpadEnabled" ) +end + +function OptionsWindowRefresh( f2_arg0, f2_arg1 ) + if f2_arg1.source_input == "button_action" or f2_arg1.source_input == "key_bound" or f2_arg1.source_input == "button_right" or f2_arg1.source_input == "button_left" then + f2_arg0:processEvent( { + name = "menu_refresh" + } ) + f2_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function SinglePlayerDisableFunction( f3_arg0, f3_arg1 ) + return not Engine.IsMultiplayer() +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function OptionFactoryProfileData( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5, f5_arg6 ) + local f5_local0 = Engine.GetProfileData( f5_arg0 ) + local f5_local1 = 1 + for f5_local5, f5_local6 in pairs( f5_arg3 ) do + if f5_local6.value == f5_local0 then + f5_local1 = f5_local5 + break + end + end + f5_local2 = function ( f6_arg0, f6_arg1 ) + Engine.ExecNow( f5_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + OptionsWindowTriggerRefresh( f6_arg0, f6_arg1 ) + if f5_arg6 and type( f5_arg6 ) == "function" then + f5_arg6( f6_arg0 ) + end + end + + f5_local3 = { + type = "UIGenericButton", + id = "option_" .. f5_arg0, + disabledFunc = f5_arg4 or function () + return false + end + + } + f5_local4 = { + variant = GenericButtonSettings.Variants.Select + } + if f5_arg5 then + local f5_local7 = f5_arg2 + end + f5_local4.button_text = f5_local7 or Engine.Localize( f5_arg2 ) + f5_local4.button_display_func = function ( f8_arg0, f8_arg1 ) + return Engine.Localize( f5_arg3[f5_local1].text ) + end + + f5_local4.button_left_func = function ( f9_arg0, f9_arg1 ) + f5_local1 = 1 + (#f5_arg3 + f5_local1 - 1 - 1) % #f5_arg3 + f5_local2( f9_arg0, f9_arg1 ) + end + + f5_local4.button_right_func = function ( f10_arg0, f10_arg1 ) + f5_local1 = 1 + (f5_local1 - 1 + 1) % #f5_arg3 + f5_local2( f10_arg0, f10_arg1 ) + end + + f5_local3.properties = f5_local4 + f5_local3.handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + return f5_local3 +end + +function SliderOptionFactory( f11_arg0, f11_arg1, f11_arg2, f11_arg3, f11_arg4, f11_arg5 ) + local f11_local0 = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + Engine.SetDvarFloat( f11_arg0, math.min( f12_arg1, math.max( f12_arg0, Engine.GetDvarFloat( f11_arg0 ) + f12_arg2 ) ) ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + OptionsWindowTriggerRefresh( f12_arg3, f12_arg4 ) + end + + return { + type = "UIGenericButton", + id = "options_" .. f11_arg0, + disabledFunc = f11_arg5 or function () + return false + end + , + properties = { + button_text = Engine.Localize( f11_arg1 ), + variant = GenericButtonSettings.Variants.Slider, + button_display_func = function ( f14_arg0, f14_arg1 ) + return (Engine.GetDvarFloat( f11_arg0 ) - f11_arg2) / (f11_arg3 - f11_arg2) + end + , + button_left_func = function ( f15_arg0, f15_arg1 ) + f11_local0( f11_arg2, f11_arg3, -f11_arg4, f15_arg0, f15_arg1 ) + end + , + button_right_func = function ( f16_arg0, f16_arg1 ) + f11_local0( f11_arg2, f11_arg3, f11_arg4, f16_arg0, f16_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + } +end + +function GetButtonsLayoutName() + local f17_local0 = Engine.GetProfileData( "gpadButtonsConfig" ) + if f17_local0 == "buttons_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f17_local0 == "buttons_tactical" then + return Engine.Localize( "@MENU_TACTICAL" ) + elseif f17_local0 == "buttons_lefty" then + return Engine.Localize( "@MENU_LEFTY" ) + elseif f17_local0 == "buttons_nomad" then + return Engine.Localize( "@MENU_NOMAD" ) + elseif f17_local0 == "buttons_nomad_tactical" then + return Engine.Localize( "@MENU_NOMAD_TACTICAL" ) + elseif f17_local0 == "buttons_default_alt" then + return Engine.Localize( "@MENU_DEFAULT_ALT" ) + elseif f17_local0 == "buttons_tactical_alt" then + return Engine.Localize( "@MENU_TACTICAL_ALT" ) + elseif f17_local0 == "buttons_lefty_alt" then + return Engine.Localize( "@MENU_LEFTY_ALT" ) + elseif f17_local0 == "buttons_nomad_alt" then + return Engine.Localize( "@MENU_NOMAD_ALT" ) + else + return Engine.Localize( "@MENU_NOMAD_TACTICAL_ALT" ) + end +end + +function ButtonsLayoutAction( f18_arg0, f18_arg1 ) + LUI.FlowManager.RequestAddMenu( f18_arg0, "buttons", true, f18_arg1.controller, false ) +end + +function GetSticksLayoutName() + local f19_local0 = Engine.GetProfileData( "gpadSticksConfig" ) + if f19_local0 == "thumbstick_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f19_local0 == "thumbstick_southpaw" then + return Engine.Localize( "@MENU_SOUTHPAW" ) + elseif f19_local0 == "thumbstick_legacy" then + return Engine.Localize( "@MENU_LEGACY" ) + elseif f19_local0 == "thumbstick_southpaw_ns" then + return Engine.Localize( "@MENU_SOUTHPAW_NS" ) + elseif f19_local0 == "thumbstick_legacysouthpaw_ns" then + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW_NS" ) + else + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW" ) + end +end + +function SticksLayoutAction( f20_arg0, f20_arg1 ) + LUI.FlowManager.RequestAddMenu( f20_arg0, "thumbstick", true, f20_arg1.controller, false ) +end + +function GetSensitivityText() + local f21_local0 = Engine.GetDvarFloat( "profileMenuOption_sensitivity" ) + if f21_local0 == 1 then + return Engine.Localize( "@MENU_LOW" ) .. " " .. f21_local0 + elseif f21_local0 == 3 then + return Engine.Localize( "@MENU_MEDIUM" ) .. " " .. f21_local0 + elseif f21_local0 == 7 then + return Engine.Localize( "@MENU_HIGH" ) .. " " .. f21_local0 + elseif f21_local0 == 13 then + return Engine.Localize( "@MENU_VERY_HIGH" ) .. " " .. f21_local0 + elseif f21_local0 == 20 then + return Engine.Localize( "@MENU_INSANE" ) .. " " .. f21_local0 + else + return f21_local0 .. "" + end +end + +function SensitivityChange( f22_arg0, f22_arg1 ) + Engine.SetDvarFloat( "profileMenuOption_sensitivity", math.min( 20, math.max( 1, Engine.GetDvarFloat( "profileMenuOption_sensitivity" ) + f22_arg1 ) ) ) + Engine.MenuDvarsFinish( f22_arg0 ) +end + +function OnToggleGPadEnabled( f23_arg0 ) + LUI.FlowManager.tryAddMouseCursor( Engine.GetLuiRoot() ) + Engine.Exec( "updategamerprofile" ) + f23_arg0:dispatchEventToRoot( { + name = "refresh_button_helper", + dispatchChildren = true + } ) +end + +function OptionsFeeder( f24_arg0 ) + local f24_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "gpadEnabled", "profile_toggleEnableGamepad", "LUA_MENU_GAMEPAD", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, nil, nil, OnToggleGPadEnabled ) + f24_local0[#f24_local0 + 1] = { + type = "UIGenericButton", + id = "stick_layout_button_id", + disabledFunc = GamepadDisabledFunc, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "MENU_THUMBSTICK_LAYOUT" ), + button_display_func = GetSticksLayoutName, + button_action_func = SticksLayoutAction + } + } + f24_local0[#f24_local0 + 1] = { + type = "UIGenericButton", + id = "buttons_layout_button_id", + disabledFunc = GamepadDisabledFunc, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "MENU_BUTTON_LAYOUT" ), + button_display_func = GetButtonsLayoutName, + button_action_func = ButtonsLayoutAction + } + } + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "invertedPitch", "profile_toggleInvertedPitch", "MENU_LOOK_INVERSION", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc ) + f24_local0[#f24_local0 + 1] = { + type = "UIGenericButton", + id = "sensitivity_button_id", + disabledFunc = GamepadDisabledFunc, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "MENU_LOOK_SENSITIVITY" ), + button_display_func = GetSensitivityText, + button_left_func = function ( f25_arg0, f25_arg1 ) + return SensitivityChange( f24_arg0.exclusiveController, -1 ) + end, + button_right_func = function ( f26_arg0, f26_arg1 ) + return SensitivityChange( f24_arg0.exclusiveController, 1 ) + end + } + } + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "rumble", "profile_toggleRumble", "MENU_CONTROLLER_VIBRATION", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc ) + if SinglePlayerDisableFunction() then + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "autoAim", "profile_toggleAutoAim", "MENU_AIM_ASSIST", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc ) + end + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "leanEnabled", "profile_toggleLean", "LUA_MENU_LEAN_TOGGLE", { + { + text = "@LUA_MENU_ENABLED", + value = true + }, + { + text = "@LUA_MENU_DISABLED", + value = false + } + }, GamepadDisabledFunc ) + if Engine.IsDevelopmentBuild() then + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "useDevKeyboard", "profile_toggleDevKeyboard", "DEBUG_KEYBOARD", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc, true ) + end + return f24_local0 +end + +function OptionsMainCreate( f27_arg0, f27_arg1 ) + f27_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function OptionsMainClose( f28_arg0, f28_arg1 ) + Engine.Exec( "updategamerprofile" ) +end + +function gamepad_controls_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = {} + } +end + +function gamepad_controls() + return { + type = "UIElement", + id = "gamepad_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose, + options_window_refresh = OptionsWindowRefresh + }, + children = { + { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIImage", + id = "options_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5, + material = RegisterMaterial( "black" ) + } + } + }, + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_GAMEPAD" ) + } + }, + { + type = "gamepad_controls_vlist", + id = "gamepad_controls_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "gamepad_controls_vlist", gamepad_controls_vlist ) +LUI.MenuBuilder.registerDef( "gamepad_controls", gamepad_controls ) +LockTable( _M ) diff --git a/lui/mp_hud/ingamelookcontrols.dec.lua b/lui/mp_hud/ingamelookcontrols.dec.lua new file mode 100644 index 0000000..f06fbaf --- /dev/null +++ b/lui/mp_hud/ingamelookcontrols.dec.lua @@ -0,0 +1,327 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function SinglePlayerDisableFunction( f1_arg0, f1_arg1 ) + return not Engine.IsMultiplayer() +end + +function GetDisplay( f2_arg0 ) + return Engine.GetBinding( f2_arg0 ) +end + +function bindKey( f3_arg0 ) + Engine.BindKey( f3_arg0 ) +end + +function OptionsWindowRefresh( f4_arg0, f4_arg1 ) + if f4_arg1.source_input == "button_action" or f4_arg1.source_input == "key_bound" then + f4_arg0:processEvent( { + name = "menu_refresh" + } ) + f4_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f5_arg0, f5_arg1 ) + f5_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f5_arg1.name, + immediate = true + } ) +end + +function ControlBindFactory( f6_arg0, f6_arg1 ) + return { + type = "UIGenericButton", + id = "bind_" .. f6_arg1, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f6_arg0 ), + button_display_func = function ( f7_arg0, f7_arg1 ) + return GetDisplay( f6_arg1 ) + end + , + button_action_func = function ( f8_arg0, f8_arg1 ) + Engine.BindKey( f6_arg1 ) + OptionsWindowTriggerRefresh( f8_arg0, f8_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionFactory( f9_arg0, f9_arg1, f9_arg2 ) + local f9_local0 = nil + local f9_local1 = 1 + local f9_local2 = Engine.GetDvarType( f9_arg0 ) + if f9_local2 == DvarTypeTable.DvarString then + f9_local0 = Engine.GetDvarString( f9_arg0 ) + elseif f9_local2 == DvarTypeTable.DvarInt then + f9_local0 = Engine.GetDvarInt( f9_arg0 ) + elseif f9_local2 == DvarTypeTable.DvarBool then + f9_local0 = Engine.GetDvarBool( f9_arg0 ) + end + for f9_local6, f9_local7 in pairs( f9_arg2 ) do + if f9_local7.value == f9_local0 then + f9_local1 = f9_local6 + break + end + end + f9_local3 = function ( f10_arg0, f10_arg1 ) + if f9_arg0 == "ui_mousePitch" then + if Engine.GetDvarBool( f9_arg0 ) then + Engine.SetDvarFloat( "m_pitch", MousePitchTable.PitchFloat ) + else + Engine.SetDvarFloat( "m_pitch", -MousePitchTable.PitchFloat ) + end + end + if f9_local2 == DvarTypeTable.DvarString then + Engine.SetDvarString( f9_arg0, f9_arg2[f9_local1].value ) + elseif f9_local2 == DvarTypeTable.DvarInt then + Engine.SetDvarInt( f9_arg0, f9_arg2[f9_local1].value ) + elseif f9_local2 == DvarTypeTable.DvarBool then + Engine.SetDvarBool( f9_arg0, f9_arg2[f9_local1].value ) + end + end + + return { + type = "UIGenericButton", + id = "option_" .. f9_arg0, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f9_arg1 ), + button_display_func = function ( f11_arg0, f11_arg1 ) + return Engine.Localize( f9_arg2[f9_local1].text ) + end + , + button_left_func = function ( f12_arg0, f12_arg1 ) + f9_local1 = 1 + (#f9_arg2 + f9_local1 - 1 - 1) % #f9_arg2 + f9_local3( f12_arg0, f12_arg1 ) + end + , + button_right_func = function ( f13_arg0, f13_arg1 ) + f9_local1 = 1 + (f9_local1 - 1 + 1) % #f9_arg2 + f9_local3( f13_arg0, f13_arg1 ) + end + + } + } +end + +function SliderOptionFactory( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5, f14_arg6 ) + local f14_local0 = function ( f15_arg0, f15_arg1, f15_arg2 ) + Engine.SetDvarFloat( f14_arg0, math.min( f15_arg1, math.max( f15_arg0, Engine.GetDvarFloat( f14_arg0 ) + f15_arg2 ) ) ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + end + + return { + type = "UIGenericButton", + id = "options_" .. f14_arg0, + properties = { + button_text = Engine.Localize( f14_arg1 ), + variant = GenericButtonSettings.Variants.Slider, + button_display_func = function ( f16_arg0, f16_arg1 ) + return (Engine.GetDvarFloat( f14_arg0 ) - f14_arg2) / (f14_arg3 - f14_arg2) + end + , + button_left_func = function ( f17_arg0, f17_arg1 ) + f14_local0( f14_arg2, f14_arg3, -f14_arg4 ) + end + , + button_right_func = function ( f18_arg0, f18_arg1 ) + f14_local0( f14_arg2, f14_arg3, f14_arg4 ) + end + , + button_over_func = MBh.EmitEventToRoot( "brightness_over" ), + button_up_func = MBh.EmitEventToRoot( "brightness_up" ) + } + } +end + +function OptionsFeeder( f19_arg0 ) + local f19_local0 = {} + local f19_local1 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f19_local0[#f19_local0 + 1] = SliderOptionFactory( "sensitivity", "@MENU_MOUSE_SENSITIVITY", SliderBounds.MouseSensitivity.Min, SliderBounds.MouseSensitivity.Max, SliderBounds.MouseSensitivity.Step ) + if SinglePlayerDisableFunction() then + f19_local1 = { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } + else + f19_local1 = { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + } + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_mousePitch", "@MENU_INVERT_MOUSE", f19_local1 ) + f19_local0[#f19_local0 + 1] = OptionFactory( "m_filter", "@MENU_SMOOTH_MOUSE", { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } ) + f19_local0[#f19_local0 + 1] = OptionFactory( "cl_freelook", "@MENU_FREE_LOOK", { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_LOOK_UP", "+lookup" ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_LOOK_DOWN", "+lookdown" ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_HOLD_MOUSE_LOOK", "+mlook" ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_CENTER_VIEW", "centerview" ) + return f19_local0 +end + +function OptionsMainCreate( f20_arg0, f20_arg1 ) + f20_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function OptionsMainClose( f21_arg0, f21_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + Engine.Exec( "updategamerprofile" ) +end + +function look_controls_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function look_controls() + return { + type = "UIElement", + id = "look_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose + }, + children = { + { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIImage", + id = "options_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5, + material = RegisterMaterial( "black" ) + } + } + }, + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_LOOK" ) + } + }, + { + type = "look_controls_vlist", + id = "look_controls_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "look_controls_vlist", look_controls_vlist ) +LUI.MenuBuilder.registerDef( "look_controls", look_controls ) +LockTable( _M ) diff --git a/lui/mp_hud/ingamemovementcontrols.dec.lua b/lui/mp_hud/ingamemovementcontrols.dec.lua new file mode 100644 index 0000000..a0851ab --- /dev/null +++ b/lui/mp_hud/ingamemovementcontrols.dec.lua @@ -0,0 +1,203 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetDisplay( f1_arg0 ) + return Engine.GetBinding( f1_arg0 ) +end + +function bindKey( f2_arg0 ) + Engine.BindKey( f2_arg0 ) +end + +function OptionsWindowRefresh( f3_arg0, f3_arg1 ) + if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then + f3_arg0:processEvent( { + name = "menu_refresh" + } ) + f3_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function ControlBindFactory( f5_arg0, f5_arg1 ) + return { + type = "UIGenericButton", + id = "bind_" .. f5_arg1, + disabledFunc = shouldBeDisabledFunc or function () + return false + end + , + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f5_arg0 ), + button_display_func = function ( f7_arg0, f7_arg1 ) + return GetDisplay( f5_arg1 ) + end + , + button_action_func = function ( f8_arg0, f8_arg1 ) + Engine.BindKey( f5_arg1 ) + OptionsWindowTriggerRefresh( f8_arg0, f8_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionsFeeder( f9_arg0 ) + local f9_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_FORWARD", "+forward" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_BACK", "+back" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_LEFT", "+moveleft" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_RIGHT", "+moveright" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_STANDJUMP", "+gostand" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_CROUCH", "+togglecrouch" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_PRONE", "toggleprone" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_SPRINT_HOLD_BREATH", "+breath_sprint" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_DOWN_CROUCH", "+movedown" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_DOWN_PRONE", "+prone" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_CHANGE_STANCE", "+stance" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_SPRINT", "+sprint" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_BREATH", "+holdbreath" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_TURN_LEFT", "+left" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_TURN_RIGHT", "+right" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_STRAFE", "+strafe" ) + return f9_local0 +end + +function OptionsMainCreate( f10_arg0, f10_arg1 ) + f10_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function movement_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function movement_controls() + return { + type = "UIElement", + id = "movement_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = function ( f13_arg0, f13_arg1 ) + Engine.Exec( "updategamerprofile" ) + end + + }, + children = { + { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIImage", + id = "options_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5, + material = RegisterMaterial( "black" ) + } + } + }, + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_MOVEMENT" ) + } + }, + { + type = "movement_vlist", + id = "movement_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "movement_vlist", movement_vlist ) +LUI.MenuBuilder.registerDef( "movement_controls", movement_controls ) +LockTable( _M ) diff --git a/lui/mp_hud/ingamepcoptions.dec.lua b/lui/mp_hud/ingamepcoptions.dec.lua new file mode 100644 index 0000000..ef6c65f --- /dev/null +++ b/lui/mp_hud/ingamepcoptions.dec.lua @@ -0,0 +1,1186 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function ButtonMenuAction( f1_arg0, f1_arg1 ) + local f1_local0 = false + local f1_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "pc_controls" ) + LUI.FlowManager.RequestAddMenu( f1_arg0, f1_arg0.properties.menu, true, f1_arg1.controller, f1_local0 ) +end + +function ChatDisableFunc( f2_arg0, f2_arg1 ) + local f2_local0 = SinglePlayerDisabled( f2_arg0, f2_arg1 ) + if not f2_local0 then + f2_local0 = GamepadDisabledFunc( f2_arg0, f2_arg1 ) + end + return f2_local0 +end + +function GamepadDisabledFunc( f3_arg0, f3_arg1 ) + return Engine.IsGamepadEnabled() == 1 +end + +function LeaveGameSetupOptionsMenu( f4_arg0, f4_arg1 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + if Engine.GetDvarString( "r_mode" ) ~= Engine.GetDvarString( "ui_r_mode" ) or Engine.GetDvarString( "r_displayMode" ) ~= Engine.GetDvarString( "ui_r_displayMode" ) then + LUI.FlowManager.RequestPopupMenu( f4_arg0, "apply_settings_restart_popmenu", false, f4_arg1.controller, false ) + end + LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) +end + +function GetLeaveOptionsWindowFunctionForButton( f5_arg0 ) + return function ( f6_arg0, f6_arg1 ) + local f6_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "pc_controls" ) + f6_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + Engine.PlaySound( CoD.SFX.SelectBack ) + f6_arg0:dispatchEventToRoot( { + name = "button_unlock", + immediate = true + } ) + f6_arg0:dispatchEventToRoot( { + name = "options_window_unfocus", + immediate = true + } ) + f6_arg0:dispatchEventToRoot( { + name = "options_categories_window_focus", + immediate = true + } ) + if f5_arg0 then + f5_arg0:processEvent( { + name = "gain_focus", + immediate = true + } ) + end + end + +end + +function BackButtonAction( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + if not f7_local0.currentBackButtonAction then + f7_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + end + f7_local0.currentBackButtonAction( f7_arg0, f7_arg1 ) +end + +function LockCurrentButton( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + local f8_local1 = f8_arg0:getChildById( f8_local0.currentOptionsCategory ) + if f8_local1 then + f8_local1:processEvent( { + name = "button_lock", + immediate = true + } ) + f8_local0.unlocked = true + end +end + +function optimal_notice() + return { + type = "generic_yesno_popup", + properties = { + popup_title = Engine.Localize( "@MENU_RESET_SYSTEM_DEFAULTS" ), + message_text = Engine.Localize( "@MENU_RESTORE_DEFAULTS" ), + yes_action = function ( f10_arg0, f10_arg1 ) + Engine.SetRecommended() + Engine.Exec( "wait; wait; r_applyPicmip;" ) + end + , + no_action = function ( f11_arg0, f11_arg1 ) + DebugPrint( "Running generic_onfirmation_popup no action" ) + end + , + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_NO" ) + } + } +end + +function OptionCategoryButtonAction( f12_arg0, f12_arg1 ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + OptionsWindowTriggerRefresh( f12_arg0, f12_arg1 ) + local f12_local1 = f12_arg0:getParent() + f12_local1:dispatchEventToChildren( { + name = "button_unlock", + immediate = true + } ) + if not f12_arg1.mouse then + f12_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + f12_local1.currentBackButtonAction = GetLeaveOptionsWindowFunctionForButton( f12_arg0 ) + f12_arg0:dispatchEventToRoot( { + name = "options_window_focus", + immediate = true + } ) + f12_arg0:dispatchEventToRoot( { + name = "options_categories_window_unfocus", + immediate = true + } ) + end + f12_arg0:processEvent( { + name = "button_lock", + immediate = true + } ) + f12_local0.unlocked = false + f12_local1 = f12_arg0:getParent() + f12_local1:dispatchEventToChildren( { + name = "sp_voice_disable", + immediate = true + } ) +end + +function OptionCategoryButtonOver( f13_arg0, f13_arg1 ) + local f13_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f13_arg0 ) + if f13_arg1.focusType ~= FocusType.MenuFlow then + f13_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + end + local f13_local1 = OptionsWindowTriggerRefresh + local f13_local2 = f13_arg0 + local f13_local3 = f13_arg1 + local f13_local4 + if f13_arg1.focusType ~= FocusType.MenuFlow or Engine.IsGamepadEnabled() ~= 0 then + f13_local4 = false + else + f13_local4 = true + end + f13_local1( f13_local2, f13_local3, f13_local4 ) +end + +function OptionFactory( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5 ) + local f14_local0 = nil + local f14_local1 = 1 + local f14_local2 = Engine.GetDvarType( f14_arg0 ) + if f14_local2 == DvarTypeTable.DvarString then + f14_local0 = Engine.GetDvarString( f14_arg0 ) + elseif f14_local2 == DvarTypeTable.DvarInt then + f14_local0 = Engine.GetDvarInt( f14_arg0 ) + elseif f14_local2 == DvarTypeTable.DvarBool then + f14_local0 = Engine.GetDvarBool( f14_arg0 ) + end + for f14_local6, f14_local7 in pairs( f14_arg2 ) do + if f14_local7.value == f14_local0 then + f14_local1 = f14_local6 + break + end + end + f14_local3 = function ( f15_arg0, f15_arg1 ) + if f14_local2 == DvarTypeTable.DvarString then + Engine.SetDvarString( f14_arg0, f14_arg2[f14_local1].value ) + elseif f14_local2 == DvarTypeTable.DvarInt then + Engine.SetDvarInt( f14_arg0, f14_arg2[f14_local1].value ) + elseif f14_local2 == DvarTypeTable.DvarBool then + Engine.SetDvarBool( f14_arg0, f14_arg2[f14_local1].value ) + end + if f14_arg4 then + local f15_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f15_arg0 ) + f15_local0.showApplySettings = true + end + OptionsWindowTriggerPartialRefresh( f15_arg0, f15_arg1 ) + end + + return { + type = "UIGenericButton", + id = "option_" .. f14_arg0, + disabledFunc = f14_arg3 or function () + return false + end + , + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f14_arg1 ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function ( f17_arg0, f17_arg1 ) + local f17_local0 + if not f14_arg5 then + f17_local0 = Engine.Localize( f14_arg2[f14_local1].text ) + if not f17_local0 then + + else + return f17_local0 + end + end + f17_local0 = f14_arg2[f14_local1].text + end + , + button_left_func = function ( f18_arg0, f18_arg1 ) + f14_local1 = 1 + (#f14_arg2 + f14_local1 - 1 - 1) % #f14_arg2 + f14_local3( f18_arg0, f18_arg1 ) + end + , + button_right_func = function ( f19_arg0, f19_arg1 ) + f14_local1 = 1 + (f14_local1 - 1 + 1) % #f14_arg2 + f14_local3( f19_arg0, f19_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + } +end + +function OptionFactoryProfileData( f20_arg0, f20_arg1, f20_arg2, f20_arg3, f20_arg4 ) + local f20_local0 = Engine.GetProfileData( f20_arg0 ) + local f20_local1 = 1 + for f20_local5, f20_local6 in pairs( f20_arg3 ) do + if f20_local6.value == f20_local0 then + f20_local1 = f20_local5 + break + end + end + f20_local2 = function ( f21_arg0, f21_arg1 ) + Engine.Exec( f20_arg1 ) + OptionsWindowTriggerPartialRefresh( f21_arg0, f21_arg1 ) + end + + return { + type = "UIGenericButton", + id = "option_" .. f20_arg0, + disabledFunc = f20_arg4 or function () + return false + end + , + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f20_arg2 ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function ( f23_arg0, f23_arg1 ) + return Engine.Localize( f20_arg3[f20_local1].text ) + end + , + button_left_func = function ( f24_arg0, f24_arg1 ) + f20_local1 = 1 + (#f20_arg3 + f20_local1 - 1 - 1) % #f20_arg3 + f20_local2( f24_arg0, f24_arg1 ) + end + , + button_right_func = function ( f25_arg0, f25_arg1 ) + f20_local1 = 1 + (f20_local1 - 1 + 1) % #f20_arg3 + f20_local2( f25_arg0, f25_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + } +end + +function PCOptionsMainCreate( f26_arg0, f26_arg1 ) + local f26_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f26_arg0 ) + if not f26_local0.currentBackButtonAction or Engine.IsGamepadEnabled() == 0 then + f26_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + end + Engine.ExecNow( "profile_menuDvarsSetup" ) + f26_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + if GameX.IsOnlineMatch() then + f26_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addFriendsButton ) + end + if not f26_local0.showApplySettings and not f26_local0.picmipApplySettings then + Engine.ExecNow( "exec options_graphics.cfg" ) + end + if Engine.IsGamepadEnabled() == 1 and f26_local0.currentOptionsCategory then + f26_local0.currentBackButtonAction = GetLeaveOptionsWindowFunctionForButton( f26_arg0:getFirstDescendentById( f26_local0.currentOptionsCategory ) ) + end + if f26_local0.currentOptionsCategory then + local f26_local1 = f26_arg0:getFirstDescendentById( f26_local0.currentOptionsCategory .. "_id" ) + if f26_local1 then + f26_local1:processEvent( { + name = "button_lock", + immediate = false + } ) + f26_local0.unlocked = false + end + end + if not f26_local0.currentOptionsCategory then + f26_local0.currentOptionsCategory = "video_options" + end + OptionsWindowTriggerRefresh( f26_arg0, f26_arg1, true ) +end + +function SliderOptionFactory( f27_arg0, f27_arg1, f27_arg2, f27_arg3, f27_arg4, f27_arg5, f27_arg6, f27_arg7, f27_arg8, f27_arg9 ) + local f27_local0 = function ( f28_arg0, f28_arg1, f28_arg2, f28_arg3, f28_arg4 ) + local f28_local0 = Engine.GetDvarFloat( f27_arg0 ) + if f28_local0 then + Engine.SetDvarFloat( f27_arg0, math.min( f28_arg3, math.max( f28_arg2, f28_local0 + f28_arg4 ) ) ) + if f27_arg9 ~= nil then + f28_arg0:dispatchEventToRoot( { + name = f27_arg9, + immediate = true + } ) + end + end + Engine.MenuDvarsFinish( f28_arg1.controller ) + end + + return { + type = "UIGenericButton", + id = "options_" .. f27_arg0, + disabledFunc = f27_arg8 or function () + return false + end + , + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( f27_arg1 ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function ( f30_arg0, f30_arg1 ) + local f30_local0 = Engine.GetDvarFloat( f27_arg0 ) + if f30_local0 then + local f30_local1 = (f30_local0 - f27_arg2) / (f27_arg3 - f27_arg2) + if f27_arg7 then + f30_local1 = 1 - f30_local1 + end + return f30_local1 + else + + end + end + , + button_left_func = function ( f31_arg0, f31_arg1 ) + f27_local0( f31_arg0, f31_arg1, f27_arg2, f27_arg3, -f27_arg4 ) + end + , + button_right_func = function ( f32_arg0, f32_arg1 ) + f27_local0( f32_arg0, f32_arg1, f27_arg2, f27_arg3, f27_arg4 ) + end + , + button_over_func = f27_arg5, + button_up_func = f27_arg6 + } + } +end + +function OptionsFeeder() + local f33_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "pc_controls" ) + local f33_local1 = f33_local0.currentOptionsCategory + if f33_local1 == "video_options" then + return VideoOptionsFeeder() + elseif f33_local1 == "audio_options" then + return AudioOptionsFeeder() + elseif f33_local1 == "voice_options" then + return VoiceOptionsFeeder() + elseif f33_local1 == "control_options" then + return ControlOptionsFeeder() + else + return VideoOptionsFeeder() + end +end + +function PCOptionsMainClose( f34_arg0, f34_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + if Engine.GetDvarString( "r_lodScaleRigid" ) == "2" then + Engine.SetDvarString( "r_lodScaleSkinned", "4" ) + Engine.SetDvarString( "r_lodBiasSkinned", "-200" ) + Engine.SetDvarString( "r_lodBiasRigid", "-100" ) + end + if Engine.GetDvarString( "r_lodScaleRigid" ) == "1" then + Engine.SetDvarString( "r_lodScaleSkinned", "1" ) + Engine.SetDvarString( "r_lodBiasSkinned", "0" ) + Engine.SetDvarString( "r_lodBiasRigid", "0" ) + end + Engine.Exec( "updategamerprofile" ) +end + +function OptionsWindowBGResize( f35_arg0, f35_arg1 ) + f35_arg0:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight, + bottom = GenericTitleBarDims.TitleBarHeight + CountFields( f35_arg1.options ) * (GenericButtonSettings.Styles.GlassButton.SubStyles.Default.height + PCOptionsMenuDimensions.Spacing) + 2 * PCOptionsMenuDimensions.Padding, + left = 0, + right = 0 + } ) + f35_arg0:animateToState( "current", 0 ) +end + +function OptionsWindowRefresh( f36_arg0, f36_arg1 ) + if f36_arg1.source_input == "button_action" or f36_arg1.source_input == "menu_create" or f36_arg1.source_input == "button_over" and f36_arg1.focusType ~= FocusType.MouseOver then + local f36_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f36_arg0 ) + local f36_local1 = f36_arg0 + local f36_local2 = f36_arg0.processEvent + local f36_local3 = { + name = "pre_menu_refresh" + } + local f36_local4 + if not f36_arg1.noCategoryChange then + f36_local4 = f36_arg1.options_category + if not f36_local4 then + + else + f36_local3.options_category = f36_local4 + f36_local2( f36_local1, f36_local3 ) + f36_arg0:processEvent( { + name = "menu_refresh" + } ) + OptionsWindowResize( f36_arg0, f36_arg1 ) + OptionsWindowTitleUpdate( f36_arg0, f36_arg1 ) + if not f36_local0.unlocked and f36_arg1.source_input ~= "menu_create" then + f36_local0.unlocked = true + f36_arg0:dispatchEventToRoot( { + name = "button_unlock", + immediate = true + } ) + f36_arg1.source_button:processEvent( { + name = "gain_focus", + immediate = true + } ) + end + end + end + f36_local4 = nil + end +end + +function OptionsWindowPartialRefresh( f37_arg0, f37_arg1 ) + if not Engine.IsConsoleGame() and (f37_arg1.source_input == "button_action" or f37_arg1.source_input == "button_left" or f37_arg1.source_input == "button_right") then + f37_arg0:processEvent( { + name = "menu_refresh" + } ) + end +end + +function OptionsWindowResize( f38_arg0, f38_arg1 ) + local f38_local0 = f38_arg0 + local f38_local1 = f38_arg0.processEvent + local f38_local2 = { + name = "window_resize" + } + local f38_local3 = f38_arg0:getChildById( "pc_controls_window_content" ) + f38_local2.options = f38_local3.childRecord + f38_local1( f38_local0, f38_local2 ) +end + +function OptionsWindowShadowResize( f39_arg0, f39_arg1 ) + f39_arg0:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = GenericTitleBarDims.TitleBarHeight + CountFields( f39_arg1.options ) * (GenericButtonSettings.Styles.GlassButton.SubStyles.Default.height + PCOptionsMenuDimensions.Spacing) + 2 * PCOptionsMenuDimensions.Padding + } ) + f39_arg0:animateToState( "current", 0 ) +end + +function OptionsWindowTitleUpdate( f40_arg0, f40_arg1 ) + local f40_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f40_arg0 ) + local f40_local1 = f40_local0.currentOptionsCategory + local f40_local2 = "" + if f40_local1 then + if f40_local1 == "video_options" then + f40_local2 = Engine.Localize( "@LUA_MENU_VIDEO_OPTIONS_CAPS" ) + elseif f40_local1 == "audio_options" then + f40_local2 = Engine.Localize( "@LUA_MENU_AUDIO_OPTIONS_CAPS" ) + elseif f40_local1 == "control_options" then + f40_local2 = Engine.Localize( "@LUA_MENU_CONTROL_OPTIONS_CAPS" ) + elseif f40_local1 == "voice_options" then + f40_local2 = Engine.Localize( "@LUA_MENU_VOICE_OPTIONS_CAPS" ) + else + f40_local2 = Engine.Localize( "@LUA_MENU_VIDEO_OPTIONS_CAPS" ) + end + else + f40_local2 = Engine.Localize( "@LUA_MENU_VIDEO_OPTIONS_CAPS" ) + end + f40_arg0:processEvent( { + name = "update_title", + title_text = f40_local2 + } ) +end + +function OptionsWindowTriggerRefresh( f41_arg0, f41_arg1, f41_arg2 ) + local f41_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f41_arg0 ) + f41_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f41_arg1.name, + options_category = f41_arg0.properties.options_category, + focusType = f41_arg1.focusType, + noCategoryChange = f41_arg2, + source_button = f41_arg0, + immediate = true + } ) +end + +function OptionsWindowTriggerPartialRefresh( f42_arg0, f42_arg1 ) + f42_arg0:dispatchEventToRoot( { + name = "options_window_partial_refresh", + source_input = f42_arg1.name, + options_category = f42_arg0.properties.options_category, + immediate = true + } ) +end + +function PrepareMenuRefresh( f43_arg0, f43_arg1 ) + f43_arg0:closeChildren() + f43_arg0:clearSavedState() + local f43_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f43_arg0 ) + if f43_arg1.options_category then + f43_local0.currentOptionsCategory = f43_arg1.options_category + end +end + +function PrepareMenuPartialRefresh( f44_arg0, f44_arg1 ) + f44_arg0:closeChildren() + f44_arg0:clearSavedState() +end + +function InGameDisabledFunc( f45_arg0, f45_arg1 ) + return not Engine.CanVidRestart() +end + +function ResolutionDisabledFunc( f46_arg0, f46_arg1 ) + return Engine.GetDvarString( "ui_r_displayMode" ) == "windowed (no border)" +end + +function BrightnessOverFunc( f47_arg0, f47_arg1 ) + if f47_arg1.focusType ~= FocusType.MenuFlow then + f47_arg0:dispatchEventToRoot( { + name = "brightness_over" + } ) + end +end + +function VideoOptionsFeeder() + local f48_local0 = {} + local f48_local1 = {} + for f48_local5, f48_local6 in pairs( Engine.GetDvarEnumList( "r_mode" ) ) do + f48_local1[#f48_local1 + 1] = { + text = f48_local6, + value = f48_local6 + } + end + f48_local0[#f48_local0 + 1] = OptionFactory( "ui_r_mode", "@LUA_MENU_VIDEO_MODE", f48_local1, InGameDisabledFunc, true, true ) + f48_local0[#f48_local0 + 1] = OptionFactory( "ui_r_displayMode", "@LUA_MENU_DISPLAY_MODE", { + { + text = "@LUA_MENU_MODE_FULLSCREEN", + value = "fullscreen" + }, + { + text = "@LUA_MENU_MODE_WINDOWED_NO_BORDER", + value = "windowed (no border)" + }, + { + text = "@LUA_MENU_MODE_WINDOWED", + value = "windowed" + } + }, InGameDisabledFunc, true ) + f48_local0[#f48_local0 + 1] = SliderOptionFactory( "profileMenuOption_blacklevel", "@MENU_BRIGHTNESS", SliderBounds.PCBrightness.Min, SliderBounds.PCBrightness.Max, SliderBounds.PCBrightness.Step, BrightnessOverFunc, MBh.EmitEventToRoot( "brightness_up" ), true, nil, "brightness_updated" ) + f48_local0[#f48_local0 + 1] = OptionFactoryProfileData( "renderColorBlind", "profile_toggleRenderColorBlind", "@LUA_MENU_COLORBLIND_FILTER", { + { + text = "@LUA_MENU_ENABLED", + value = true + }, + { + text = "@LUA_MENU_DISABLED", + value = false + } + } ) + f48_local0[#f48_local0 + 1] = { + type = "UIGenericButton", + id = "option_advanced_video", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + button_text = Engine.Localize( "@LUA_MENU_ADVANCED_VIDEO" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "advanced_video" + } + } + return f48_local0 +end + +function AudioOptionsFeeder() + local f49_local0 = { + [#f49_local0 + 1] = SliderOptionFactory( "profileMenuOption_volume", "@MENU_MASTER_VOLUME", SliderBounds.Volume.Min, SliderBounds.Volume.Max, SliderBounds.Volume.PCStep ) + } + if SinglePlayerDisabled() then + f49_local0[#f49_local0 + 1] = OptionFactoryProfileData( "subtitles", "profile_toggleSubtitles", "@LUA_MENU_SUBTITLES", { + { + text = "@LUA_MENU_ENABLED", + value = true + }, + { + text = "@LUA_MENU_DISABLED", + value = false + } + } ) + end + return f49_local0 +end + +function ControlOptionsFeeder() + local f50_local0 = { + [#f50_local0 + 1] = { + type = "UIGenericButton", + id = "option_movement_controls", + disabledFunc = GamepadDisabledFunc, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_MOVEMENT" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "movement_controls" + } + }, + [#f50_local0 + 1] = { + type = "UIGenericButton", + id = "option_actions_controls", + disabledFunc = GamepadDisabledFunc, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_ACTIONS" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "actions_controls" + } + }, + [#f50_local0 + 1] = { + type = "UIGenericButton", + id = "option_look_controls", + disabledFunc = GamepadDisabledFunc, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_LOOK" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "look_controls" + } + }, + [#f50_local0 + 1] = { + type = "UIGenericButton", + id = "option_chat_controls", + disabledFunc = ChatDisableFunc, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_CHAT" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "chat_controls" + } + }, + [#f50_local0 + 1] = { + type = "UIGenericButton", + id = "option_gamepad_controls", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_GAMEPAD" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "gamepad_controls" + } + }, + [#f50_local0 + 1] = { + type = "UIGenericButton", + id = "option_restore_controls", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_RESTORE_DEFAULT_CONTROLS" ), + button_action_func = MBh.PopupMenu( "reset_controls", false, false ), + text_align_without_content = LUI.Alignment.Left + } + } + } + return f50_local0 +end + +function SinglePlayerDisabled( f51_arg0, f51_arg1 ) + return not Engine.IsMultiplayer() +end + +function SinglePlayerVoiceDisable( f52_arg0, f52_arg1 ) + if SinglePlayerDisabled( f52_arg0, f52_arg1 ) then + f52_arg0:processEvent( { + name = "disable" + } ) + end +end + +function MicThreshDisable() + return Engine.GetDvarBool( "cl_pushToTalk" ) +end + +function VoiceOptionsFeeder() + local f54_local0 = { + [#f54_local0 + 1] = SliderOptionFactory( "winvoice_mic_reclevel", "@LUA_MENU_VOICECHAT_RECORD_LEVEL", SliderBounds.VoiceRecord.Min, SliderBounds.VoiceRecord.Max, SliderBounds.VoiceRecord.Step ), + [#f54_local0 + 1] = { + type = "UIGenericButton", + id = "option_voice_indicator_button", + focusable = false, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@LUA_MENU_VOICECHAT_LEVEL_INDICATOR" ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function () + return "" + end + }, + children = { + { + type = "UIOwnerdraw", + id = "indicator_owner_draw", + properties = { + ownerDraw = CoD.Ownerdraw.UIRecordLevel + }, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = -212, + right = -64, + top = 8, + bottom = -5, + alpha = 1 + } + } + } + } + }, + [#f54_local0 + 1] = SliderOptionFactory( "winvoice_mic_threshold", "@LUA_MENU_PICKUP_THRESHOLD", SliderBounds.VoiceThreshold.Min, SliderBounds.VoiceThreshold.Max, SliderBounds.VoiceThreshold.Step, nil, nil, nil, MicThreshDisable ), + [#f54_local0 + 1] = OptionFactory( "cl_pushToTalk", "@LUA_MENU_PUSH_TO_TALK", { + { + text = "@LUA_MENU_NO", + value = false + }, + { + text = "@LUA_MENU_YES", + value = true + } + } ), + [#f54_local0 + 1] = OptionFactory( "cl_voice", "@LUA_MENU_USE_VOICE_COMMUNICATIONS", { + { + text = "@LUA_MENU_NO", + value = false + }, + { + text = "@LUA_MENU_YES", + value = true + } + } ), + [#f54_local0 + 1] = OptionFactory( "cl_textChatEnabled", "@LUA_MENU_TEXTCHATENABLED", { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } ) + } + return f54_local0 +end + +function ResetControlsYesAction( f56_arg0, f56_arg1 ) + Engine.ExecNow( "profile_toggleLean 1", f56_arg1.controller ) + if Engine.IsGamepadEnabled() == 1 then + Engine.ExecNow( "profile_setSticksConfig thumbstick_default", f56_arg1.controller ) + Engine.ExecNow( "profile_setButtonsConfig buttons_default", f56_arg1.controller ) + Engine.ExecNow( "profile_toggleInvertedPitch 0", f56_arg1.controller ) + Engine.ExecNow( "profile_toggleRumble 1", f56_arg1.controller ) + Engine.ExecNow( "profile_toggleAutoAim 1", f56_arg1.controller ) + Engine.SetDvarFloat( "profileMenuOption_sensitivity", 3 ) + else + Engine.Exec( "exec default_smp_controls.cfg" ) + end +end + +function reset_controls() + return { + type = "generic_yesno_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_SET_DEFAULT_CONTROLS" ), + message_text = Engine.Localize( "@LUA_MENU_RESTORE_EACH_SETTING" ), + yes_action = ResetControlsYesAction, + no_action = function ( f58_arg0, f58_arg1 ) + DebugPrint( "Running generic_confirmation_popup no action" ) + end + , + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function OptionsWindowClose( f59_arg0, f59_arg1 ) + f59_arg0:dispatchEventToRoot( { + name = "refresh_controls" + } ) +end + +function pc_controls_window() + return { + type = "UIElement", + id = "pc_controls_window_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 120, + bottom = 219, + left = 460, + right = 940 + } + }, + handlers = { + options_window_force_resize = OptionsWindowResize, + menu_create = OptionsWindowResize, + menu_close = OptionsWindowClose, + options_window_title_update = OptionsWindowTitleUpdate, + options_window_refresh = OptionsWindowRefresh, + options_window_partial_refresh = OptionsWindowPartialRefresh, + options_window_focus = MBh.EmitEvent( "gain_focus" ), + options_window_unfocus = MBh.EmitEvent( "lose_focus" ) + }, + children = { + { + type = "generic_drop_shadow", + id = "pc_controls_window_shadow_id", + properties = { + offset_shadow = 0 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0.75 + } + }, + handlers = { + window_resize = OptionsWindowShadowResize + } + }, + { + type = "generic_menu_titlebar", + id = "pc_controls_window_title_id", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = "", + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left, + fill_alpha = 1, + border_alpha = 1 + }, + handlers = { + menu_create = MBh.EmitEventToParent( "options_window_title_update" ) + } + }, + { + type = "generic_menu_background", + id = "pc_controls_window_background_id", + properties = { + fill_alpha = 1, + border_alpha = 1 + }, + handlers = { + window_resize = OptionsWindowBGResize + } + }, + { + type = "UIVerticalList", + id = "pc_controls_window_content", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + PCOptionsMenuDimensions.Padding, + bottom = 600, + left = PCOptionsMenuDimensions.Padding, + right = -PCOptionsMenuDimensions.Padding, + spacing = PCOptionsMenuDimensions.Spacing + } + }, + handlers = { + pre_menu_refresh = PrepareMenuRefresh, + pre_menu_partial_refresh = PrepareMenuPartialRefresh + }, + childrenFeeder = OptionsFeeder + } + } + } +end + +function pc_controls_categories() + return { + type = "generic_menu_background_withfade", + id = "pc_controls_categories_id", + properties = { + top_offset = 0, + fill_alpha = 1, + border_alpha = 1 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 120, + bottom = 620, + left = 134, + right = 420 + } + }, + handlers = { + options_categories_window_focus = MBh.EmitEvent( { + name = "gain_focus" + } ), + options_categories_window_unfocus = MBh.EmitEvent( "lose_focus" ) + }, + children = { + { + type = "UIElement", + id = "padding_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + top = 6, + bottom = -6, + left = 6, + right = -6 + } + }, + children = { + { + type = "UIVerticalList", + id = "options_categories_vlist_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + spacing = 6 + } + }, + handlers = { + menu_create = LockCurrentButton + }, + children = { + { + type = "UIGenericButton", + id = "video_options_id", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_VIDEO_OPTIONS_CAPS" ), + options_category = "video_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction + } + }, + { + type = "UIGenericButton", + id = "audio_options_id", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_AUDIO_OPTIONS_CAPS" ), + options_category = "audio_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction + } + }, + { + type = "UIGenericButton", + id = "control_options_id", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_CONTROL_OPTIONS_CAPS" ), + options_category = "control_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction + } + }, + { + type = "UIGenericButton", + id = "voice_options_id", + disabledFunc = SinglePlayerDisabled, + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_VOICE_OPTIONS_CAPS" ), + options_category = "voice_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction, + sp_voice_disable = SinglePlayerVoiceDisable + } + }, + { + type = "UIGenericButton", + id = "optimal_video_and_audio_button_id", + disabledFunc = InGameDisabledFunc, + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_OPTIMAL_VIDEO_AUDIO_CAPS" ), + options_category = "optimal_video_and_audio_button", + text_default_color = Colors.generic_button_text_disabled_color + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = MBh.PopupMenu( "optimal_notice", false, false ) + } + } + } + } + } + } + } + } +end + +function pc_controls() + local f62_local0 = { + type = "UIElement", + id = "pc_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = PCOptionsMainCreate, + menu_close = PCOptionsMainClose + }, + children = { + { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIImage", + id = "options_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5, + material = RegisterMaterial( "black" ) + } + } + }, + { + type = "generic_menu_title", + id = "options_menu_title_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ) + } + }, + { + type = "pc_controls_window", + id = "pc_controls_window_id" + }, + { + type = "pc_controls_categories", + id = "pc_controls_categories_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "brightness_guide", + id = "brightness_guide_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 330, + left = 575, + width = 255, + height = 255, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + properties = { + band_height = 85 + } + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = BackButtonAction + } + } + } + } + if GameX.IsOnlineMatch() then + table.insert( f62_local0.children, { + type = "online_friends_widget" + } ) + end + return f62_local0 +end + +LUI.MenuBuilder.registerDef( "optimal_notice", optimal_notice ) +LUI.MenuBuilder.registerDef( "reset_controls", reset_controls ) +LUI.MenuBuilder.registerDef( "pc_controls", pc_controls ) +LUI.MenuBuilder.registerDef( "pc_controls_categories", pc_controls_categories ) +LUI.MenuBuilder.registerDef( "pc_controls_window", pc_controls_window ) +LockTable( _M ) diff --git a/lui/mp_hud/intelchallenges.dec.lua b/lui/mp_hud/intelchallenges.dec.lua new file mode 100644 index 0000000..9f77788 --- /dev/null +++ b/lui/mp_hud/intelchallenges.dec.lua @@ -0,0 +1,219 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 250 +f0_local1 = -1 +f0_local2 = 89.6 +local f0_local3 = 358.4 +local f0_local4 = function ( f1_arg0, f1_arg1 ) + f0_local1 = f1_arg1.value + local f1_local0 = Game.GetOmnvar( "ui_splash_optional_number" ) + local f1_local1 = nil + if f1_arg0.prev_activeIntel ~= f0_local1 then + f1_arg0.prev_activeIntel = f0_local1 + if f0_local1 >= 0 then + f1_local1 = Engine.Localize( "@" .. Engine.TableLookupByRow( IntelChallengesTable.File, f0_local1, IntelChallengesTable.Cols.Name ), f1_local0 ) + else + f1_arg0:processEvent( { + name = "message_off" + } ) + end + if f1_local1 ~= nil then + local f1_local2 = f1_arg0:getChildById( "intelChallengeBgId" ) + local f1_local3 = f1_arg0:getChildById( "intelChallengeTextId" ) + f1_local3:setText( f1_local1 ) + f1_arg0:processEvent( { + name = "message_on", + value = 500 + 1000 * tonumber( Engine.TableLookup( SplashTable.File, SplashTable.Cols.Ref, Engine.TableLookupByRow( IntelChallengesTable.File, f0_local1, IntelChallengesTable.Cols.Ref ), SplashTable.Cols.Duration ) ) + } ) + end + end +end + +local f0_local5 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg1.value + local f2_local1 = nil + if f2_local0 ~= -1 then + f2_local1 = Engine.Localize( "@" .. Engine.TableLookupByRow( IntelChallengesTable.File, f0_local1, IntelChallengesTable.Cols.Name ), f2_local0 ) + end + if f2_local1 ~= nil then + local f2_local2 = f2_arg0:getChildById( "intelChallengeTextId" ) + f2_local2:setText( f2_local1 ) + end +end + +LUI.MenuBuilder.registerType( "intelInfoHudDef", function () + local f3_local0 = RegisterMaterial( "hud_message_bg" ) + local f3_local1 = RegisterMaterial( "popup_icon_intel" ) + local self = LUI.UIElement.new() + self.id = "intelInfoHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -80, + left = 5, + height = f0_local2, + width = 0, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -80, + left = 5, + height = f0_local2, + width = f0_local3, + alpha = 1 + } ) + self:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -80, + left = 5, + height = f0_local2, + width = f0_local3 + 40, + alpha = 1 + } ) + self:registerAnimationState( "closing", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -80, + left = 5, + height = f0_local2, + width = f0_local3, + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_intel_active_index", f0_local4 ) + self:registerOmnvarHandler( "ui_intel_progress_current", f0_local5 ) + self:registerEventHandler( "hud_on", function ( element, event ) + if element.prev_activeIntel == f0_local1 and f0_local1 ~= -1 then + local f4_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + f0_local0 / 2 + }, + { + "active", + f0_local0 / 2 + } + } ) + f4_local0( element ) + end + end ) + self:registerEventHandler( "message_on", function ( element, event ) + local f5_local0 = event.value + if not event.value then + f5_local0 = 0 + end + local f5_local1 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + f5_local0 + }, + { + "opening", + f0_local0 / 2 + }, + { + "active", + f0_local0 / 2 + } + } ) + f5_local1( element ) + end ) + self:registerEventHandler( "message_off", MBh.AnimateSequence( { + { + "active", + 0 + }, + { + "closing", + f0_local0 / 2 + }, + { + "default", + f0_local0 / 2 + } + } ) ) + local f3_local3 = LUI.UIImage.new() + f3_local3.id = "intelChallengeBgId" + f3_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f3_local0 + } ) + f3_local3:animateToState( "default", 0 ) + local f3_local4 = LUI.UIImage.new() + f3_local4.id = "intelChallengeIconId" + f3_local4:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 15, + left = 0, + height = 64, + width = 64, + material = f3_local1 + } ) + f3_local4:animateToState( "default", 0 ) + local f3_local5 = LUI.UIText.new() + f3_local5.id = "intelChallengeHeaderTextId" + f3_local5:setText( Engine.Localize( "@LUA_MENU_INTEL_CHALLENGE_CAPS" ) ) + f3_local5:setTextStyle( CoD.TextStyle.Shadowed ) + f3_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + top = 15, + left = 64, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = f0_local3 * 0.8, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b + } ) + f3_local5:animateToState( "default", 0 ) + local f3_local6 = LUI.UIText.new() + f3_local6.id = "intelChallengeTextId" + f3_local6:setText( "" ) + f3_local6:setTextStyle( CoD.TextStyle.Shadowed ) + f3_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + top = 35, + left = 64, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = f0_local3 * 0.6, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f3_local6:animateToState( "default", 0 ) + self:addElement( f3_local3 ) + self:addElement( f3_local4 ) + self:addElement( f3_local5 ) + self:addElement( f3_local6 ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/jammereffecthud.dec.lua b/lui/mp_hud/jammereffecthud.dec.lua new file mode 100644 index 0000000..3c5416c --- /dev/null +++ b/lui/mp_hud/jammereffecthud.dec.lua @@ -0,0 +1,249 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = { + "one", + "two", + "three", + "four" +} +f0_local1 = 500 +f0_local2 = 1000 +local f0_local3 = { + 101, + 127, + 139, + 149, + 167, + 191, + 241 +} +local f0_local4 = 20 +local f0_local5 = function ( f1_arg0, f1_arg1 ) + if f1_arg0.current_state ~= "default" then + f1_arg0:animateToState( "default", 0 ) + f1_arg0.current_state = "default" + end +end + +local f0_local6 = function ( f2_arg0 ) + return f2_arg0[math.random( 1, #f2_arg0 )] +end + +local f0_local7 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = {} + local f3_local1 = math.random( 0, 2 ) + for f3_local2 = 0, f3_local1, 1 do + local f3_local5 = f3_local2 + local f3_local6 = table.insert + local f3_local7 = f3_local0 + local f3_local8 = {} + local f3_local9 = f0_local6( f0_local0 ) + local f3_local10 = f0_local6( f0_local3 ) + f3_local6( f3_local7, f3_local9 ) + end + local f3_local2 = table.insert + local f3_local3 = f3_local0 + local f3_local4 = {} + local f3_local5 = f0_local6( f0_local0 ) + local f3_local6 = math.random( f0_local1, f0_local2 ) + f3_local2( f3_local3, f3_local5 ) + f3_local1 = math.random( 2, 4 ) + for f3_local2 = 0, f3_local1, 1 do + f3_local5 = f3_local2 + f3_local6 = table.insert + local f3_local7 = f3_local0 + local f3_local8 = {} + local f3_local9 = f0_local6( f0_local0 ) + local f3_local10 = f0_local6( f0_local3 ) + f3_local6( f3_local7, f3_local9 ) + end + f3_local3 = MBh.AnimateSequence( f3_local0 ) + f3_local3( f3_arg0 ) +end + +function GetStaticSequence( f4_arg0 ) + local f4_local0 = {} + for f4_local1 = 0, f4_arg0, 1 do + local f4_local4 = f4_local1 + local f4_local5 = table.insert + local f4_local6 = f4_local0 + local f4_local7 = {} + local f4_local8 = f0_local6( f0_local0 ) + local f4_local9 = f0_local6( kVeryShortFlickerTimes ) + f4_local5( f4_local6, f4_local8 ) + end + return f4_local0 +end + +local f0_local8 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = MBh.AnimateSequence( GetStaticSequence( math.random( 3, 6 ) ) ) + f5_local0( f5_arg0 ) +end + +local f0_local9 = function () + return { + type = "UIElement", + id = "jammerEffectArtifact", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + alpha = f0_local4 + } + }, + children = { + { + type = "UIImage", + id = "jammerArtifactId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "digidam_artifacts_1" ), + alpha = 0 + }, + active = { + alpha = 1 + }, + one = { + material = RegisterMaterial( "digidam_artifacts_1" ), + alpha = 1 + }, + two = { + material = RegisterMaterial( "digidam_artifacts_2" ), + alpha = 1 + }, + three = { + material = RegisterMaterial( "digidam_artifacts_3" ), + alpha = 1 + }, + four = { + material = RegisterMaterial( "digidam_artifacts_6" ), + alpha = 1 + } + }, + handlers = { + hud_static_on = f0_local7, + hud_static_off = MBh.AnimateToState( "default" ), + hud_off = MBh.AnimateToState( "default" ) + } + } + } + } +end + +local f0_local10 = function () + return { + type = "UIElement", + id = "jammerEffectStatic", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + alpha = f0_local4 + } + }, + children = { + { + type = "UIImage", + id = "jammerStaticId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "white" ), + alpha = 0 + }, + base = { + material = RegisterMaterial( "digidam_static_1" ), + alpha = 0 + }, + one = { + material = RegisterMaterial( "digidam_static_1" ), + alpha = 1 + }, + two = { + material = RegisterMaterial( "digidam_static_2" ), + alpha = 1 + }, + three = { + material = RegisterMaterial( "digidam_static_3" ), + alpha = 1 + }, + four = { + material = RegisterMaterial( "digidam_static_4" ), + alpha = 1 + } + }, + handlers = { + hud_static_on = f0_local8, + hud_static_off = MBh.AnimateToState( "default" ), + hud_off = MBh.AnimateToState( "default" ) + } + } + } + } +end + +local f0_local11 = function () + return { + type = "UIElement", + id = "jammerEffectNoSignal", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + alpha = 0 + }, + active = { + alpha = f0_local4 + } + }, + handlers = { + hud_nosignal_on = MBh.AnimateToState( "active", 0.5 ), + hud_nosignal_off = MBh.AnimateToState( "default", 0.25 ), + hud_off = MBh.AnimateToState( "default" ), + hud_on = function ( f9_arg0, f9_arg1 ) + if Game.GetOmnvar( "ui_hud_static" ) == 3 then + f9_arg0:processEvent( { + name = "hud_nosignal_on" + } ) + end + end + + }, + children = { + { + type = "UIImage", + id = "noSignalBgId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "digidam_nosignal_1" ), + alpha = 1 + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "jammerEffectArtifactDef", f0_local9 ) +LUI.MenuBuilder.registerDef( "jammerEffectStaticDef", f0_local10 ) +LUI.MenuBuilder.registerDef( "jammerEffectNoSignalDef", f0_local11 ) +LockTable( _M ) diff --git a/lui/mp_hud/juggernautoverlayhud.dec.lua b/lui/mp_hud/juggernautoverlayhud.dec.lua new file mode 100644 index 0000000..0e31a57 --- /dev/null +++ b/lui/mp_hud/juggernautoverlayhud.dec.lua @@ -0,0 +1,53 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + if f1_arg1.value == 1 and f1_arg0.current_state ~= "active" then + f1_arg0:animateToState( "active", 0 ) + f1_arg0.current_state = "active" + elseif f1_arg1.value == 0 and f1_arg0.current_state ~= "default" then + f1_arg0:animateToState( "default", 0 ) + f1_arg0.current_state = "default" + end +end + +LUI.MenuBuilder.registerType( "juggernautOverlayDef", function () + local f2_local0 = RegisterMaterial( "juggernaut_overlay_half" ) + local self = LUI.UIElement.new() + self.id = "juggernautOverlayContainerId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_juggernaut", f0_local0 ) + self:registerEventHandler( "init_overlay", f0_local0 ) + local f2_local2 = LUI.UILitImage.new() + f2_local2.id = "odinOverlayImageId" + f2_local2:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f2_local0 + } ) + f2_local2:animateToState( "default", 0 ) + self:addElement( f2_local2 ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/killcamhud.dec.lua b/lui/mp_hud/killcamhud.dec.lua new file mode 100644 index 0000000..e330054 --- /dev/null +++ b/lui/mp_hud/killcamhud.dec.lua @@ -0,0 +1,948 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = Engine.Localize( "@LUA_MENU_KILLCAM_CAPS" ) +f0_local1 = Engine.Localize( "@LUA_MENU_KILLED_BY_CAPS" ) +f0_local2 = RegisterMaterial( "white" ) +local f0_local3 = 4 +local f0_local4 = 12 +local f0_local5 = 0 +local f0_local6 = 1 +local f0_local7 = function ( f1_arg0, f1_arg1 ) + if not f1_arg0.kcElems then + f1_arg0.kcElems = {} + local f1_local0 = {} + if GameX.GetGameMode() ~= "horde" then + f1_local0 = { + "killCamRespawnText", + "killCamWeaponImage", + "killCamWeaponHL", + "killCamWeaponNameText", + "killCamAbilitiesHL", + "killCamPlayerCard", + "playerCardBg", + "playerCardPatchBg", + "playerCardPatch", + "playerCardQuipText", + "playerCardClanTagText", + "playerCardRankIcon", + "playerCardRankText", + "playerCardNameText", + "killCamVictimAttacker", + "killCamVictimAttackerText", + "killCamCountDownBar", + "killCamCorners", + "killCamBottom", + "killCamTitleText" + } + else + f1_local0 = { + "killCamCorners" + } + end + for f1_local1 = 1, #f1_local0, 1 do + f1_arg0.kcElems[f1_local0[f1_local1]] = f1_arg0:getFirstDescendentById( f1_local0[f1_local1] ) + end + end +end + +local f0_local8 = function ( f2_arg0 ) + local f2_local0 = f2_arg0.kcElems.killCamRespawnText + local f2_local1 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 250 + } + } ) + f2_local1( f2_local0 ) + f2_local1 = Game.GetOmnvar( "ui_killcam_text" ) + if f2_local1 == "skip" then + f2_local0:setText( Engine.Localize( "@PLATFORM_PRESS_TO_SKIP" ) ) + elseif f2_local1 == "respawn" then + f2_local0:setText( Engine.Localize( "@PLATFORM_PRESS_TO_RESPAWN" ) ) + else + f2_local0:setText( "" ) + end +end + +local f0_local9 = function ( f3_arg0 ) + local f3_local0 = f3_arg0.kcElems.killCamWeaponImage + local f3_local1 = f3_arg0.kcElems.killCamWeaponNameText + local f3_local2 = {} + for f3_local3 = 1, f0_local3, 1 do + f3_local2[f3_local3] = f3_arg0.kcElems.killCamWeaponHL:getChildById( "killCamAttachment" .. f3_local3 ) + end + local f3_local3 = Game.GetOmnvar( "ui_killcam_killedby_killstreak" ) + local f3_local4 = Game.GetOmnvar( "ui_killcam_killedby_weapon" ) + local f3_local5 = "" + local f3_local6 = "" + local f3_local7 = "" + if f3_local4 ~= -1 then + f3_local7 = Engine.TableLookupByRow( StatsTable.File, f3_local4, StatsTable.Cols.WeaponImage ) + f3_local6 = Engine.TableLookupByRow( StatsTable.File, f3_local4, StatsTable.Cols.WeaponName ) + f3_local5 = Engine.TableLookupByRow( StatsTable.File, f3_local4, StatsTable.Cols.WeaponRef ) + elseif f3_local3 ~= -1 then + f3_local7 = Engine.TableLookupByRow( KillstreakTable.File, f3_local3, KillstreakTable.Cols.UnearnedIcon ) + f3_local6 = Engine.TableLookupByRow( KillstreakTable.File, f3_local3, KillstreakTable.Cols.Name ) + end + if f3_local7 == nil or f3_local7 == "" then + f3_local0:animateToState( "inactive", 0 ) + else + if CoD.WeaponListPrimary[f3_local5] ~= nil or CoD.WeaponListSecondary[f3_local5] ~= nil or string.find( f3_local5, "knifeonly" ) then + f3_local0:animateToState( "primaryWeapon", 0 ) + else + f3_local0:animateToState( "otherWeapon", 0 ) + end + CoD.SetMaterial( f3_local0, RegisterMaterial( f3_local7 ) ) + end + local f3_local8 = f3_local1 + local f3_local9 = f3_local1.setText + local f3_local10 + if f3_local6 and f3_local6 ~= "" then + f3_local10 = Engine.Localize( f3_local6 ) + if not f3_local10 then + + else + f3_local9( f3_local8, f3_local10 ) + for f3_local9 = 1, #f3_local2, 1 do + local f3_local11 = Game.GetOmnvar( "ui_killcam_killedby_attachment" .. f3_local9 ) + local f3_local12 = "" + if f3_local11 ~= -1 then + f3_local12 = Engine.TableLookupByRow( AttachmentTable.File, f3_local11, AttachmentTable.Cols.Image ) + end + if f3_local12 == nil or f3_local12 == "" then + f3_local2[f3_local9]:animateToState( "default", 0 ) + else + CoD.SetMaterial( f3_local2[f3_local9], RegisterMaterial( f3_local12 ) ) + f3_local2[f3_local9]:animateToState( "active", 0 ) + end + end + end + end + f3_local10 = "" +end + +local f0_local10 = function ( f4_arg0 ) + local f4_local0 = f4_arg0.kcElems.killCamAbilitiesHL:getFirstChild() + while f4_local0 ~= nil do + local f4_local1 = f4_local0:getNextSibling() + f4_local0:close() + f4_local0 = f4_local1 + end + if Game.GetOmnvar( "ui_killcam_killedby_killstreak" ) ~= -1 then + return + elseif GameX.UsesFakeLoadout() then + return + end + local f4_local2 = {} + local f4_local3 = Game.GetOmnvar( "ui_killcam_killedby_abilities1" ) + local f4_local4 = Game.GetOmnvar( "ui_killcam_killedby_abilities2" ) + for f4_local5 = 1, 24, 1 do + f4_local2[f4_local5] = hasbit( f4_local3, bit( f4_local5 ) ) + f4_local2[f4_local5 + 24] = hasbit( f4_local4, bit( f4_local5 ) ) + end + for f4_local5 = 1, #f4_local2, 1 do + if f4_local2[f4_local5] then + local f4_local8 = Engine.TableLookup( KillCamAbilitiesBitMaskTable.File, KillCamAbilitiesBitMaskTable.Cols.Index, f4_local5, KillCamAbilitiesBitMaskTable.Cols.Ref ) + local f4_local9 = Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f4_local8, PerkTable.Cols.Cost ) + local f4_local10 = RegisterMaterial( Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f4_local8, PerkTable.Cols.Image ) ) + local self = LUI.UIImage.new() + self.id = "killCamAbility" .. f4_local5 + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + left = 0, + height = 32, + width = 32, + material = f4_local10 + } ) + self:animateToState( "default", 0 ) + f4_arg0.kcElems.killCamAbilitiesHL:addElement( self ) + end + end +end + +local f0_local11 = function ( f5_arg0 ) + local f5_local0 = f5_arg0.kcElems.playerCardBg + local f5_local1 = f5_arg0.kcElems.playerCardPatchBg + local f5_local2 = f5_arg0.kcElems.playerCardPatch + local f5_local3 = f5_arg0.kcElems.playerCardQuipText + local f5_local4 = f5_arg0.kcElems.playerCardClanTagText + local f5_local5 = f5_arg0.kcElems.playerCardRankIcon + local f5_local6 = f5_arg0.kcElems.playerCardRankText + local f5_local7 = f5_arg0.kcElems.playerCardNameText + local f5_local8 = Game.GetOmnvar( "ui_killcam_killedby_id" ) + if f5_local8 == -1 then + f5_arg0.kcElems.killCamPlayerCard:animateToState( "default", 0 ) + return + end + f5_arg0.kcElems.killCamPlayerCard:animateToState( "default_regular_killcam", 0 ) + local f5_local9 = Game.GetPlayerScoreInfo( f5_local8 ) + f5_local6:setText( "" ) + if f5_local9 and f5_local9.rank then + f5_local6:setText( f5_local9.rank + 1 ) + end + local f5_local10 + if f5_local9 then + f5_local10 = f5_local9.name + if not f5_local10 then + + else + f5_local4:setText( "" ) + if Engine.IsConsoleGame() and string.sub( f5_local10, 1, 1 ) == "[" then + local f5_local11 = string.find( f5_local10, "]" ) + if f5_local11 then + f5_local4:setText( string.sub( f5_local10, 1, f5_local11 ) ) + f5_local10 = string.sub( f5_local10, f5_local11 + 1 ) + end + end + f5_local7:setText( f5_local10 ) + if f5_local9 then + if f5_local9.rank and f5_local9.prestige and f5_local9.prestige > 0 then + CoD.SetMaterial( f5_local5, RegisterMaterial( Rank.GetRankIcon( f5_local9.rank, f5_local9.prestige or 0 ) ) ) + elseif f5_local9.rankIcon then + CoD.SetMaterial( f5_local5, f5_local9.rankIcon ) + end + end + local f5_local11 = Game.GetPlayerCard( f5_local8 ) + CoD.SetMaterial( f5_local0, RegisterMaterial( Engine.TableLookup( BackgroundsTable.File, BackgroundsTable.Cols.Ref, f5_local11.background, BackgroundsTable.Cols.CardImage ) ) ) + CoD.SetMaterial( f5_local1, RegisterMaterial( Engine.TableLookup( PatchBackingsTable.File, PatchBackingsTable.Cols.Ref, f5_local11.patchBacking, PatchBackingsTable.Cols.CardImage ) ) ) + CoD.SetMaterial( f5_local2, RegisterMaterial( Engine.TableLookup( PatchesTable.File, PatchesTable.Cols.Ref, f5_local11.patch, PatchesTable.Cols.CardImage ) ) ) + f5_local3:setText( Engine.Localize( Engine.TableLookup( PatchesTable.File, PatchesTable.Cols.Ref, f5_local11.patch, PatchesTable.Cols.Quip ) ) ) + end + end + f5_local10 = "" +end + +local f0_local12 = function ( f6_arg0 ) + local f6_local0 = f6_arg0.kcElems.playerCardBg + local f6_local1 = f6_arg0.kcElems.playerCardPatchBg + local f6_local2 = f6_arg0.kcElems.playerCardPatch + local f6_local3 = f6_arg0.kcElems.playerCardQuipText + local f6_local4 = f6_arg0.kcElems.playerCardRankIcon + local f6_local5 = f6_arg0.kcElems.playerCardRankText + local f6_local6 = f6_arg0.kcElems.playerCardNameText + local f6_local7 = Game.GetOmnvar( "ui_killcam_victim_id" ) + if f6_local7 == -1 then + f6_arg0.kcElems.killCamPlayerCard:animateToState( "default", 0 ) + return + end + f6_arg0.kcElems.killCamPlayerCard:animateToState( "default_regular_killcam", 0 ) + local f6_local8 = Game.GetPlayerScoreInfo( f6_local7 ) + f6_local5:setText( "" ) + if f6_local8 and f6_local8.rank then + f6_local5:setText( f6_local8.rank + 1 ) + end + local f6_local9 + if f6_local8 then + f6_local9 = f6_local8.name + if not f6_local9 then + + else + f6_local6:setText( f6_local9 ) + if f6_local8 then + if f6_local8.rank and f6_local8.prestige and f6_local8.prestige > 0 then + CoD.SetMaterial( f6_local4, RegisterMaterial( Rank.GetRankIcon( f6_local8.rank, f6_local8.prestige or 0 ) ) ) + elseif f6_local8.rankIcon then + CoD.SetMaterial( f6_local4, f6_local8.rankIcon ) + end + end + local f6_local10 = Game.GetPlayerCard( f6_local7 ) + CoD.SetMaterial( f6_local0, RegisterMaterial( Engine.TableLookup( BackgroundsTable.File, BackgroundsTable.Cols.Ref, f6_local10.background, BackgroundsTable.Cols.CardImage ) ) ) + CoD.SetMaterial( f6_local1, RegisterMaterial( Engine.TableLookup( PatchBackingsTable.File, PatchBackingsTable.Cols.Ref, f6_local10.patchBacking, PatchBackingsTable.Cols.CardImage ) ) ) + CoD.SetMaterial( f6_local2, RegisterMaterial( Engine.TableLookup( PatchesTable.File, PatchesTable.Cols.Ref, f6_local10.patch, PatchesTable.Cols.CardImage ) ) ) + end + end + f6_local9 = "" +end + +local f0_local13 = function ( f7_arg0, f7_arg1 ) + if f7_arg1.value <= 0 then + f7_arg0:processEvent( { + name = "killcam_off" + } ) + return + elseif GameX.GetGameMode() ~= "horde" then + f0_local8( f7_arg0 ) + f0_local9( f7_arg0 ) + f0_local10( f7_arg0 ) + f0_local11( f7_arg0 ) + f7_arg0.kcElems.killCamBottom:animateToState( "active", 0 ) + f7_arg0.kcElems.killCamCountDownBar:animateToState( "active", 0 ) + f7_arg0.kcElems.killCamTitleText:animateToState( "active", 0 ) + f7_arg0:dispatchEventToChildren( { + name = "killcam_on" + } ) + end + f7_arg0:processEvent( { + name = "killcam_on" + } ) + f7_arg0:animateToState( "active", 0 ) +end + +local f0_local14 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = f8_arg0.kcElems.killCamCountDownBar + local f8_local1 = f8_arg0.kcElems.killCamVictimAttacker + local f8_local2 = f8_arg0.kcElems.killCamVictimAttackerText + local f8_local3 = f8_arg0.kcElems.killCamPlayerCard + local f8_local4 = f8_arg0.kcElems.killCamBottom + local f8_local5 = f8_arg0.kcElems.killCamTitleText + f8_local0:animateToState( "inactive", 0 ) + if f8_arg1.value == f0_local5 then + f0_local12( f8_arg0 ) + f8_arg0:animateToState( "active", 0 ) + f8_local4:animateToState( "default", 0 ) + local f8_local6 = MBh.AnimateSequence( { + { + "default_final_killcam", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 1250 + }, + { + "leaving", + 250 + } + } ) + f8_local6( f8_local3 ) + f8_local2:setText( "" ) + f8_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 1250 + }, + { + "leaving", + 250 + } + } ) + f8_local6( f8_local1 ) + elseif f8_arg1.value == f0_local6 then + f0_local11( f8_arg0 ) + f8_arg0:animateToState( "active", 0 ) + f8_local5:animateToState( "inactive", 0 ) + local f8_local6 = MBh.AnimateSequence( { + { + "default_final_killcam", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 4500 + } + } ) + f8_local6( f8_local3 ) + f8_local2:setText( "" ) + f8_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 2000 + }, + { + "leaving", + 250 + } + } ) + f8_local6( f8_local1 ) + f8_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 0 + } + } ) + f8_local6( f8_local4 ) + else + f8_arg0:animateToState( "default", 0 ) + end +end + +local f0_local15 = function () + local f9_local0 = RegisterMaterial( "hud_killcam_corner" ) + local self = LUI.UIElement.new() + self.id = "killCamCorners" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "inactive", { + alpha = 0 + } ) + local f9_local2 = LUI.UIImage.new() + f9_local2.id = "topLeftCorner" + f9_local2:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = 512, + width = 512, + material = f9_local0, + alpha = 1, + zRot = 0 + } ) + f9_local2:animateToState( "default", 0 ) + local f9_local3 = LUI.UIImage.new() + f9_local3.id = "bottomLeftCorner" + f9_local3:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + left = 0, + height = 512, + width = 512, + material = f9_local0, + alpha = 1, + zRot = 90 + } ) + f9_local3:animateToState( "default", 0 ) + local f9_local4 = LUI.UIImage.new() + f9_local4.id = "bottomRightCorner" + f9_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = 512, + width = 512, + material = f9_local0, + alpha = 1, + zRot = 180 + } ) + f9_local4:animateToState( "default", 0 ) + local f9_local5 = LUI.UIImage.new() + f9_local5.id = "topRightCorner" + f9_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + height = 512, + width = 512, + material = f9_local0, + alpha = 1, + zRot = 270 + } ) + f9_local5:animateToState( "default", 0 ) + self:addElement( f9_local2 ) + self:addElement( f9_local3 ) + self:addElement( f9_local4 ) + self:addElement( f9_local5 ) + return self +end + +local f0_local16 = function () + local self = LUI.UIElement.new() + self.id = "killCamPlayerCard" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 96, + left = 95, + height = 64, + width = 256, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "default_regular_killcam", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 96, + left = 95, + height = 64, + width = 256, + alpha = 1 + } ) + self:registerAnimationState( "default_final_killcam", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 50, + left = 0, + height = 64, + width = 256, + alpha = 0 + } ) + self:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 50, + left = 470, + height = 64, + width = 256, + alpha = 1 + } ) + self:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 50, + left = 500, + height = 64, + width = 256, + alpha = 1 + } ) + self:registerAnimationState( "leaving", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 50, + left = 1000, + height = 64, + width = 256, + alpha = 0 + } ) + self:addElement( LUI.mp_hud.PlayerCardHud.playerCardHudDef() ) + return self +end + +local f0_local17 = function () + local f11_local0 = RegisterMaterial( "kk_label_orange" ) + local self = LUI.UIElement.new() + self.id = "killCamCountDownBar" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = 200, + width = 634, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "inactive", { + alpha = 0 + } ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + local f11_local2 = LUI.UIImage.new() + f11_local2.id = "killCamCountDownBarImage" + f11_local2:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + height = 32, + material = f11_local0 + } ) + f11_local2:animateToState( "default", 0 ) + local f11_local3 = LUI.UICountdown.new( {} ) + f11_local3.id = "killCamCounterDownTimer" + f11_local3:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -5, + left = 180, + height = CoD.TextSettings.HudDigitalBigFont.Height, + width = 100, + font = CoD.TextSettings.HudDigitalBigFont.Font, + alignment = LUI.Alignment.Right + } ) + f11_local3:animateToState( "default", 0 ) + f11_local3:registerEventHandler( "killcam_on", function ( element, event ) + element:setEndTime( Game.GetOmnvar( "ui_killcam_end_milliseconds" ) ) + end ) + local f11_local4 = LUI.UIText.new() + f11_local4.id = "killCamKilledByText" + f11_local4:setText( f0_local1 ) + f11_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -8, + left = 300, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 200, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f11_local4:animateToState( "default", 0 ) + f11_local2:addElement( f11_local3 ) + f11_local2:addElement( f11_local4 ) + self:addElement( f11_local2 ) + return self +end + +local f0_local18 = function () + local f13_local0 = RegisterMaterial( "kk_lowbar" ) + local self = LUI.UIElement.new() + self.id = "killCamBottom" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 500, + height = 128, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = -20, + height = 128, + alpha = 1 + } ) + self:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = -20, + height = 128, + alpha = 1 + } ) + local f13_local2 = LUI.UIImage.new() + f13_local2.id = "killCamBottomBg" + f13_local2:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f13_local0 + } ) + f13_local2:animateToState( "default", 0 ) + local f13_local3 = LUI.UIText.new() + f13_local3.id = "killCamTitleText" + f13_local3:setText( f0_local0 ) + f13_local3:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -60, + right = -120, + height = CoD.TextSettings.HudEuroExtraBigFont.Height, + width = 512, + font = CoD.TextSettings.HudEuroExtraBigFont.Font, + alignment = LUI.Alignment.Right, + alpha = 1 + } ) + f13_local3:animateToState( "default", 0 ) + f13_local3:registerAnimationState( "inactive", { + alpha = 0 + } ) + f13_local3:registerAnimationState( "active", { + alpha = 1 + } ) + local f13_local4 = LUI.UIText.new() + f13_local4.id = "killCamRespawnText" + f13_local4:setText( "" ) + f13_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -35, + right = -120, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 512, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right + } ) + f13_local4:animateToState( "default", 0 ) + local f13_local5 = LUI.UIHorizontalList.new() + f13_local5.id = "killCamWeaponHL" + f13_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -80, + left = 100, + height = 32, + width = 512, + alignment = LUI.Alignment.Left, + spacing = 15 + } ) + f13_local5:animateToState( "default", 0 ) + local f13_local6 = LUI.UIText.new() + f13_local6.id = "killCamWeaponNameText" + f13_local6:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -60, + left = 90, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 256, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f13_local6:animateToState( "default", 0 ) + local f13_local7 = LUI.UIImage.new() + f13_local7.id = "killCamWeaponImage" + f13_local7:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + left = 0, + height = 76, + width = 150, + material = f0_local2, + alpha = 1 + } ) + f13_local7:animateToState( "default", 0 ) + f13_local7:registerAnimationState( "primaryWeapon", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + left = 0, + height = 76, + width = 150, + alpha = 1 + } ) + f13_local7:registerAnimationState( "killstreakWeapon", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + left = 0, + height = 64, + width = 64, + alpha = 1 + } ) + f13_local7:registerAnimationState( "otherWeapon", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + left = 0, + height = 64, + width = 64, + alpha = 1 + } ) + f13_local7:registerAnimationState( "inactive", { + alpha = 0 + } ) + f13_local5:addElement( f13_local7 ) + for f13_local8 = 1, f0_local3, 1 do + local f13_local11 = LUI.UIImage.new() + f13_local11.id = "killCamAttachment" .. f13_local8 + f13_local11:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + left = 0, + height = 32, + width = 32, + material = f0_local2, + alpha = 0 + } ) + f13_local11:animateToState( "default", 0 ) + f13_local11:registerAnimationState( "active", { + alpha = 1 + } ) + f13_local5:addElement( f13_local11 ) + end + local f13_local8 = LUI.UIHorizontalList.new() + f13_local8.id = "killCamAbilitiesHL" + f13_local8:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -26, + left = 90, + height = 32, + width = 512, + alignment = LUI.Alignment.Left, + spacing = 0 + } ) + f13_local8:animateToState( "default", 0 ) + self:addElement( f13_local2 ) + self:addElement( f13_local3 ) + self:addElement( f13_local4 ) + self:addElement( f13_local5 ) + self:addElement( f13_local8 ) + self:addElement( f13_local6 ) + return self +end + +local f0_local19 = function () + local self = LUI.UIElement.new() + self.id = "killCamVictimAttacker" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnhor = false, + bottomAnchor = false, + rightAnchor = true, + top = 110, + right = 0, + height = CoD.TextSettings.HudEuroExtraBigFont.Height, + width = 512, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "opening", { + topAnchor = true, + leftAnhor = false, + bottomAnchor = false, + rightAnchor = true, + top = 110, + right = -470, + height = CoD.TextSettings.HudEuroExtraBigFont.Height, + width = 512, + alpha = 1 + } ) + self:registerAnimationState( "active", { + topAnchor = true, + leftAnhor = false, + bottomAnchor = false, + rightAnchor = true, + top = 110, + right = -500, + height = CoD.TextSettings.HudEuroExtraBigFont.Height, + width = 512, + alpha = 1 + } ) + self:registerAnimationState( "leaving", { + topAnchor = true, + leftAnhor = false, + bottomAnchor = false, + rightAnchor = true, + top = 110, + right = -1000, + height = CoD.TextSettings.HudEuroExtraBigFont.Height, + width = 512, + alpha = 0 + } ) + local f14_local1 = LUI.UIText.new() + f14_local1.id = "killCamVictimAttackerText" + f14_local1:setText( "" ) + f14_local1:setTextStyle( CoD.TextStyle.Shadowed ) + f14_local1:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + font = CoD.TextSettings.HudEuroExtraBigFont.Font, + alignment = LUI.Alignment.Right + } ) + f14_local1:animateToState( "default", 0 ) + self:addElement( f14_local1 ) + return self +end + +LUI.MenuBuilder.registerType( "killCamHudDef", function () + local self = LUI.UIElement.new() + self.id = "killCamHudId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerEventHandler( "menu_create", f0_local7 ) + self:registerOmnvarHandler( "ui_killcam_end_milliseconds", f0_local13 ) + if GameX.GetGameMode() ~= "horde" then + self:registerOmnvarHandler( "ui_killcam_victim_or_attacker", f0_local14 ) + end + self:registerEventHandler( "killcam_on", MBh.AnimateToState( "active", 0 ) ) + self:registerEventHandler( "killcam_off", function ( element, event ) + local f16_local0 = MBh.DoMultiple + local f16_local1 = {} + local f16_local2 = MBh.AnimateToState( "default", 0 ) + local f16_local3 = MBh.EmitOmnvarUpdateEventToRoot( "ui_predator_missile" ) + f16_local0 = f16_local0( f16_local2 ) + f16_local0( element, event ) + end ) + self:addElement( f0_local15() ) + if GameX.GetGameMode() ~= "horde" then + self:addElement( f0_local17() ) + self:addElement( f0_local16() ) + self:addElement( f0_local18() ) + self:addElement( f0_local19() ) + end + self:addElement( LUI.MenuBuilder.buildItems( { + type = "talkerHudDef" + }, self.properties, self ) ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/killstreakhud.dec.lua b/lui/mp_hud/killstreakhud.dec.lua new file mode 100644 index 0000000..19db1ba --- /dev/null +++ b/lui/mp_hud/killstreakhud.dec.lua @@ -0,0 +1,847 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 30 +f0_local1 = 4 +f0_local2 = KillstreakTable.Cols.UnearnedIcon +local f0_local3 = KillstreakTable.Cols.DPadIcon +local f0_local4 = 25.6 +local f0_local5 = 25.6 +local f0_local6 = 32 +local f0_local7 = 32 +local f0_local8 = 32 +local f0_local9 = 32 +local f0_local10 = 0 +local f0_local11 = -23 +local f0_local12 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = 0 + for f1_local1 = 0, f0_local1 - 1, 1 do + if Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "hasStreak", f1_local1 ) then + f1_local0 = f1_local0 + 1 + end + end + if f1_local0 > 1 and (Engine.IsConsoleGame() == true or 1 == Engine.IsGamepadEnabled()) and Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "isSpecialist" ) == false then + if f1_arg0.current_state ~= "active" then + f1_arg0:animateToState( "active", 250 ) + f1_arg0.current_state = "active" + end + elseif f1_arg0.current_state ~= "default" then + f1_arg0:animateToState( "default", 0 ) + f1_arg0.current_state = "default" + end +end + +local f0_local13 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = 0 + local f2_local1 = 0 + local f2_local2 = Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "count" ) or 0 + local f2_local3 = Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "countToNext" ) or 0 + local f2_local4 = Game.GetOmnvar( "ui_half_tick" ) + if f2_local3 <= f2_local2 then + f2_local2 = f2_local3 + f2_local4 = false + end + if 0 < f2_local2 then + f2_local0 = 1 + f2_local1 = math.min( f2_local2, f2_local3 ) + for f2_local5 = f2_local0, f2_local1, 1 do + local f2_local8 = f2_arg0:getChildById( f2_local5 ) + if f2_local8.current_state ~= "filled" then + f2_local8:animateToState( "filled", 250 ) + f2_local8.current_state = "filled" + end + end + end + if f2_local4 == true then + f2_local1 = f2_local2 + 1 + local f2_local5 = f2_arg0:getChildById( f2_local1 ) + if f2_local5.current_state ~= "half" then + f2_local5:animateToState( "half", 250 ) + f2_local5.current_state = "half" + end + end + if f2_local2 < f2_local3 then + f2_local0 = f2_local1 + 1 + f2_local1 = f2_local3 + for f2_local5 = f2_local0, f2_local1, 1 do + local f2_local8 = f2_arg0:getChildById( f2_local5 ) + if f2_local8.current_state ~= "empty" then + f2_local8:animateToState( "empty", 250 ) + f2_local8.current_state = "empty" + end + end + end + f2_local0 = f2_local1 + 1 + f2_local1 = f0_local0 + for f2_local5 = f2_local0, f2_local1, 1 do + local f2_local8 = f2_arg0:getChildById( f2_local5 ) + if f2_local8.current_state ~= "default" then + f2_local8:animateToState( "default", 100 ) + f2_local8.current_state = "default" + end + end +end + +local f0_local14 = function ( f3_arg0, f3_arg1 ) + for f3_local0 = 0, f0_local1 - 1, 1 do + local f3_local3 = f3_arg0:getChildById( "icon" .. f3_local0 + 1 ) + local f3_local4 = Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "isSpecialist" ) + local f3_local5 = Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "hasStreak", f3_local0 ) + local f3_local6 = Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "icons", f3_local0 ) + local f3_local7 = f0_local2 + local f3_local8 = "specialty_null" + if f3_local6 ~= 0 then + if f3_local5 then + f3_local7 = f0_local3 + end + f3_local8 = Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Index, f3_local6, f3_local7 ) + end + local f3_local9 = 0 + if f3_local7 == f0_local3 then + f3_local9 = 1 + elseif f3_local7 == f0_local2 and f3_local0 ~= 0 and f3_local8 ~= "specialty_null" then + f3_local9 = 0.5 + end + if f3_local3.current_state ~= f3_local8 or f3_local3.current_alpha ~= f3_local9 then + CoD.SetMaterial( f3_local3, RegisterMaterial( f3_local8 ), f3_local9 ) + f3_local3.current_state = f3_local8 + f3_local3.current_alpha = f3_local9 + end + end + local f3_local0 = f3_arg0:getChildById( "bonusIcon" ) + local f3_local1 = Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "hasStreak", 4 ) + if f3_local1 and f3_local0.current_state ~= "active" then + f3_local0:animateToState( "active", 250 ) + f3_local0.current_state = "active" + end + if not f3_local1 and f3_local0.current_state ~= "default" then + f3_local0:animateToState( "default", 0 ) + f3_local0.current_state = "default" + end +end + +local f0_local15 = function ( f4_arg0, f4_arg1 ) + for f4_local0 = 0, f0_local1 - 1, 1 do + local f4_local3 = f4_arg0:getChildById( "available" .. f4_local0 + 1 ) + if Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "hasStreak", f4_local0 ) then + if f4_local3.current_state ~= "available" then + f4_local3:animateToState( "ks_slot_available", 250 ) + f4_local3.current_state = "available" + if Engine.IsConsoleGame() == false and 0 == Engine.IsGamepadEnabled() then + local f4_local4 = f4_local3:getChildById( "keybindTextId" ) + f4_local4:setText( Engine.GetKeyBindingLocalizedString( 0, f4_local4.keybinding ) ) + end + end + end + if f4_local3.current_state ~= "default" then + f4_local3:animateToState( "default", 0 ) + f4_local3.current_state = "default" + end + end +end + +local f0_local16 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "selectedIndex" ) + local f5_local1 = "default" + if f5_local0 == 0 then + f5_local1 = "ks_slot_0_selected" + elseif f5_local0 == 1 then + f5_local1 = "ks_slot_1_selected" + elseif f5_local0 == 2 then + f5_local1 = "ks_slot_2_selected" + elseif f5_local0 == 3 then + f5_local1 = "ks_slot_3_selected" + end + if Engine.IsConsoleGame() == false and Engine.IsGamepadEnabled() == 0 then + f5_local1 = "default" + end + if f5_arg0.current_state ~= f5_local1 then + f5_arg0:animateToState( f5_local1, 250 ) + f5_arg0.current_state = f5_local1 + local f5_local2 = f5_arg0:getChildById( "killstreakSelectedHighlight" ) + local f5_local3 = f5_local2:getChildById( "killstreakSelectedRightArrow" ) + if f5_local1 == "ks_slot_0_selected" then + f5_local3:animateToState( f5_local1, 250 ) + else + f5_local3:animateToState( "default", 250 ) + end + end +end + +local f0_local17 = function ( f6_arg0, f6_arg1 ) + local f6_local0 = 2 + local f6_local1 = Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "selectedIndex" ) + if f6_local1 >= 0 then + local f6_local2 = Engine.Localize( "@" .. Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Index, Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "icons", f6_local1 ), f6_local0 ) ) + if f6_local2 ~= nil and f6_local2 ~= f6_arg0.previous_killstreak_name then + f6_arg0:setText( f6_local2 ) + local f6_local3 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "slide_in", + 150 + }, + { + "slide_in", + 1200 + }, + { + "blink_off", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_on", + 0 + }, + { + "blink_on", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_on", + 0 + }, + { + "blink_on", + 50 + }, + { + "blink_off", + 150 + } + } ) + f6_local3( f6_arg0 ) + f6_arg0.previous_killstreak_name = f6_local2 + f6_arg0.current_state = "slide_in" + end + end +end + +local f0_local18 = function ( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0:getChildById( "killstreakInfoHudId" ) + local f7_local1 = f7_local0:getChildById( "killstreakAvailableHud" ) + for f7_local2 = 0, f0_local1 - 1, 1 do + local f7_local5 = f7_local1:getChildById( "available" .. f7_local2 + 1 ) + local f7_local6 = Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "hasStreak", f7_local2 ) + local f7_local7 = f7_local5:getChildById( "keybindTextId" ) + if f7_local6 then + f7_local7:setText( Engine.GetKeyBindingLocalizedString( 0, f7_local7.keybinding ) ) + end + if 0 == Engine.IsGamepadEnabled() then + if not Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "isSpecialist" ) or f7_local2 == 0 then + f7_local7:animateToState( "default", 0 ) + else + f7_local7:animateToState( "inactive", 0 ) + end + end + f7_local7:animateToState( "inactive", 0 ) + end +end + +local f0_local19 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = GameX.GetGameMode() + local f8_local1 + if f8_local0 ~= "sotf" and f8_local0 ~= "infect" and Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "countToNext" ) ~= 0 then + f8_local1 = false + else + f8_local1 = true + end + if f8_local1 then + if f8_arg0.current_state ~= "inactive" then + f8_arg0:animateToState( "inactive", 0 ) + f8_arg0.current_state = "inactive" + end + elseif f8_arg0.current_state ~= "default" then + f8_arg0:animateToState( "default", 0 ) + f8_arg0.current_state = "default" + end +end + +local f0_local20 = function ( f9_arg0, f9_arg1 ) + local f9_local0 = RegisterMaterial( "specialty_null" ) + local self = LUI.UIImage.new() + self.id = f9_arg0 + local f9_local2 = 0 + if f9_arg1 then + f9_local2 = f9_arg1 + end + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = f9_local2, + height = f0_local4, + width = f0_local5, + material = f9_local0, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + material = f9_local0, + alpha = 1 + } ) + self:registerAnimationState( "inactive", { + material = f9_local0, + alpha = 0.5 + } ) + return self +end + +local f0_local21 = function ( f10_arg0, f10_arg1, f10_arg2 ) + local self = LUI.UIElement.new() + self.id = f10_arg0 + self:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = f10_arg1, + width = f10_arg2 + } ) + self:animateToState( "default", 0 ) + return self +end + +local f0_local22 = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3, f11_arg4, f11_arg5 ) + local f11_local0 = RegisterMaterial( "hud_killstreak_available" ) + local self = LUI.UIImage.new() + self.id = f11_arg0 + local f11_local2 = 0 + if f11_arg3 then + f11_local2 = f11_arg3 + end + local f11_local3 = 0 + if f11_arg4 then + f11_local3 = f11_arg4 + end + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = f11_local2, + height = f11_arg1, + width = f11_arg2, + alpha = 0, + material = f11_local0, + zRot = f11_local3 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "ks_slot_available", { + material = f11_local0, + alpha = 1 + } ) + if false == Engine.IsConsoleGame() then + local f11_local4 = LUI.UIText.new() + f11_local4.id = "keybindTextId" + f11_local4.keybinding = f11_arg5 + f11_local4:setText( Engine.GetKeyBindingLocalizedString( 0, f11_arg5 ) ) + if f11_arg4 then + f11_local3 = f11_local3 * -1 + end + f11_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 17, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = f0_local7, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + zRot = f11_local3, + alpha = 1 + } ) + f11_local4:registerAnimationState( "inactive", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 17, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = f0_local7, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + zRot = f11_local3, + alpha = 0 + } ) + if 0 == Engine.IsGamepadEnabled() then + if not Engine.GetPlayerData( CoD.StatsGroup.Common, "killstreaksState", "isSpecialist" ) or f11_arg0 == "available1" then + f11_local4:animateToState( "default", 0 ) + else + f11_local4:animateToState( "inactive", 0 ) + end + else + f11_local4:animateToState( "inactive", 0 ) + end + self:addElement( f11_local4 ) + end + return self +end + +local f0_local23 = function () + local f12_local0 = RegisterMaterial( "hud_killstreak_dpad_arrow_up" ) + local f12_local1 = RegisterMaterial( "hud_killstreak_dpad_arrow_down" ) + local self = LUI.UIElement.new() + self.id = "killstreakScrollArrowsHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -52, + right = -33, + height = 117, + width = 19.2, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerEventHandler( "killstreak_info_refresh", f0_local12 ) + local f12_local3 = LUI.UIImage.new() + f12_local3.id = "killstreakSelectedUpArrow" + f12_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 2, + height = 12.8, + width = 19.2, + material = f12_local0 + } ) + f12_local3:animateToState( "default", 0 ) + local f12_local4 = LUI.UIImage.new() + f12_local4.id = "killstreakSelectedDownArrow" + f12_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + height = 12.8, + material = f12_local1 + } ) + f12_local4:animateToState( "default", 0 ) + self:addElement( f12_local3 ) + self:addElement( f12_local4 ) + return self +end + +local f0_local24 = function () + local f13_local0 = RegisterMaterial( "hud_killstreak_bar_full" ) + local f13_local1 = RegisterMaterial( "hud_killstreak_bar_empty" ) + local f13_local2 = RegisterMaterial( "hud_killstreak_bar_half" ) + local self = LUI.UIElement.new() + self.id = "killstreakTicksHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -62, + right = -55, + height = 275, + width = 50 + } ) + self:animateToState( "default", 0 ) + local f13_local4 = LUI.UIVerticalList.new() + f13_local4.id = "columnKillstreakTicks" + f13_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + spacing = -4, + alignment = LUI.Alignment.Bottom + } ) + f13_local4:animateToState( "default", 0 ) + f13_local4:registerEventHandler( "killstreak_info_refresh", f0_local13 ) + for f13_local5 = 1, f0_local0, 1 do + local f13_local8 = LUI.UIImage.new() + f13_local8.id = f13_local5 + f13_local8:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + height = 9.6, + right = 0, + width = 25.6, + material = f13_local0, + alpha = 0 + } ) + f13_local8:animateToState( "default", 0 ) + f13_local8:registerAnimationState( "filled", { + material = f13_local0, + alpha = 1 + } ) + f13_local8:registerAnimationState( "half", { + material = f13_local2, + alpha = 1 + } ) + f13_local8:registerAnimationState( "empty", { + material = f13_local1, + alpha = 1 + } ) + f13_local4:addElement( f13_local8 ) + end + self:addElement( f13_local4 ) + return self +end + +local f0_local25 = function () + local f14_local0 = RegisterMaterial( "specialty_perks_all" ) + local self = LUI.UIVerticalList.new() + self.id = "killstreakIconsHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -20, + right = -26, + height = 310, + width = 90, + spacing = 0, + alignment = LUI.Alignment.Bottom + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "killstreak_info_refresh", f0_local14 ) + local f14_local2 = f0_local20( "icon1", 7 ) + local f14_local3 = f0_local20( "icon2" ) + local f14_local4 = f0_local20( "icon3" ) + local f14_local5 = f0_local20( "icon4" ) + local f14_local6 = LUI.UIImage.new() + f14_local6.id = "bonusIcon" + f14_local6:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = f0_local4, + width = f0_local5, + material = f14_local0, + alpha = 0 + } ) + f14_local6:animateToState( "default", 0 ) + f14_local6:registerAnimationState( "active", { + material = f14_local0, + alpha = 1 + } ) + local f14_local7 = f0_local21( "spacer1", 4, f0_local5 ) + local f14_local8 = f0_local21( "spacer2", 16, f0_local5 ) + local f14_local9 = f0_local21( "spacer3", 7, f0_local5 ) + local f14_local10 = f0_local21( "spacer4", 6, f0_local5 ) + local f14_local11 = f0_local21( "spacer5", 15, f0_local5 ) + self:addElement( f14_local7 ) + self:addElement( f14_local2 ) + self:addElement( f14_local8 ) + self:addElement( f14_local3 ) + self:addElement( f14_local9 ) + self:addElement( f14_local4 ) + self:addElement( f14_local10 ) + self:addElement( f14_local5 ) + self:addElement( f14_local11 ) + self:addElement( f14_local6 ) + return self +end + +local f0_local26 = function () + local self = LUI.UIVerticalList.new() + self.id = "killstreakAvailableHud" + self:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = -20, + right = -23, + height = 310, + width = 90, + spacing = 0, + alignment = LUI.Alignment.Bottom + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "killstreak_info_refresh", f0_local15 ) + local f15_local1 = f0_local22( "available1", f0_local6, f0_local7, 8, -45, "+actionslot 4" ) + local f15_local2 = f0_local22( "available2", f0_local6, f0_local7, nil, nil, "+actionslot 5" ) + local f15_local3 = f0_local22( "available3", f0_local6, f0_local7, nil, nil, "+actionslot 6" ) + local f15_local4 = f0_local22( "available4", f0_local6, f0_local7, nil, nil, "+actionslot 7" ) + local f15_local5 = f0_local21( "spacer", 10, f0_local7 ) + self:addElement( f15_local1 ) + self:addElement( f15_local5 ) + self:addElement( f15_local2 ) + self:addElement( f15_local3 ) + self:addElement( f15_local4 ) + return self +end + +local f0_local27 = function () + local f16_local0 = RegisterMaterial( "hud_killstreak_highlight" ) + local f16_local1 = RegisterMaterial( "hud_killstreak_dpad_arrow_right" ) + local self = LUI.UIElement.new() + self.id = "killstreakSelectedHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = f0_local10, + right = f0_local11, + height = f0_local8, + width = f0_local9, + zRot = 0, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "ks_slot_0_selected", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = f0_local10 - 20, + right = f0_local11 + 7, + height = f0_local8, + width = f0_local9, + zRot = -45, + alpha = 1 + } ) + self:registerAnimationState( "ks_slot_1_selected", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = f0_local10 - 63, + right = f0_local11, + height = f0_local8, + width = f0_local9, + zRot = 0, + alpha = 1 + } ) + self:registerAnimationState( "ks_slot_2_selected", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = f0_local10 - 95, + right = f0_local11, + height = f0_local8, + width = f0_local9, + zRot = 0, + alpha = 1 + } ) + self:registerAnimationState( "ks_slot_3_selected", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = f0_local10 - 127, + right = f0_local11, + height = f0_local8, + width = f0_local9, + zRot = 0, + alpha = 1 + } ) + self:registerEventHandler( "killstreak_info_refresh", f0_local16 ) + local f16_local3 = LUI.UIImage.new() + f16_local3.id = "killstreakSelectedHighlight" + f16_local3:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = f0_local8, + width = f0_local9, + material = f16_local0 + } ) + f16_local3:animateToState( "default", 0 ) + local f16_local4 = LUI.UIImage.new() + f16_local4.id = "killstreakSelectedRightArrow" + f16_local4:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = -5, + right = 12, + height = 19.2, + width = 12.8, + material = f16_local1, + zRot = 0 + } ) + f16_local4:animateToState( "default", 0 ) + f16_local4:registerAnimationState( "ks_slot_0_selected", { + bottomAnchor = true, + rightAnchor = true, + bottom = -19, + right = 5, + height = 19.2, + width = 12.8, + material = f16_local1, + zRot = 45 + } ) + f16_local3:addElement( f16_local4 ) + self:addElement( f16_local3 ) + return self +end + +local f0_local28 = function () + local f17_local0 = RegisterMaterial( "hud_ks_back" ) + local self = LUI.UIElement.new() + self.id = "killstreakBgHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -45, + right = -15, + height = 128, + width = 64, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "inactive", { + alpha = 0 + } ) + self:registerEventHandler( "killstreak_info_refresh", f0_local19 ) + local f17_local2 = LUI.UIImage.new() + f17_local2.id = "killstreakBg" + f17_local2:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f17_local0 + } ) + f17_local2:animateToState( "default", 0 ) + self:addElement( f17_local2 ) + return self +end + +LUI.MenuBuilder.registerType( "killstreakInfoHudDef", function () + local f18_local0 = Engine.IsConsoleGame() == true + local self = LUI.UIElement.new() + self.id = "killstreakInfoHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + height = 380, + right = 0, + width = 150, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "inactive", { + alpha = 0 + } ) + self:registerEventHandler( "show_ks_info", MBh.AnimateToState( "default", 0 ) ) + self:registerEventHandler( "hide_ks_info", MBh.AnimateToState( "inactive", 0 ) ) + if f18_local0 == false and not GameX.IsHardcoreMode() then + self:registerEventHandler( "hud_on", f0_local18 ) + end + local f18_local2 = { + event = "killstreak_info_refresh", + group = "hud", + interval = 150 + } + local f18_local3 = LUI.UITimer.new( f18_local2.interval, f18_local2.event, f18_local2.group ) + f18_local3.id = "killstreakRefreshTimer" + local f18_local4 = LUI.UIText.new() + f18_local4.id = "killstreakInfoKillstreakName" + f18_local4:setText( "" ) + f18_local4:setTextStyle( CoD.TextStyle.Shadowed ) + f18_local4:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = -15, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + right = -500, + width = 400, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0 + } ) + f18_local4:animateToState( "default", 0 ) + f18_local4:registerAnimationState( "slide_in", { + bottomAnchor = true, + rightAnchor = true, + bottom = -15, + right = -258, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 400, + alpha = 1 + } ) + f18_local4:registerAnimationState( "blink_off", { + bottomAnchor = true, + rightAnchor = true, + bottom = -15, + right = -258, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 400, + alpha = 0 + } ) + f18_local4:registerAnimationState( "blink_on", { + bottomAnchor = true, + rightAnchor = true, + bottom = -15, + right = -258, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 400, + alpha = 1 + } ) + f18_local4:registerOmnvarHandler( "ui_killstreak_scroll", f0_local17 ) + local f18_local5 = LUI.UIElement.new() + f18_local5.id = "killstreakInfoHudId" + f18_local5:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = 256, + width = 64 + } ) + f18_local5:animateToState( "default", 0 ) + f18_local5:addElement( f0_local28() ) + f18_local5:addElement( f0_local24() ) + f18_local5:addElement( f0_local26() ) + f18_local5:addElement( f0_local23() ) + f18_local5:addElement( f0_local27() ) + f18_local5:addElement( f0_local25() ) + if not GameX.IsHardcoreMode() then + self:addElement( f18_local3 ) + self:addElement( f18_local4 ) + self:addElement( f18_local5 ) + else + self:addElement( f18_local4 ) + end + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/matchstarthud.dec.lua b/lui/mp_hud/matchstarthud.dec.lua new file mode 100644 index 0000000..57dfe37 --- /dev/null +++ b/lui/mp_hud/matchstarthud.dec.lua @@ -0,0 +1,734 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 750 +f0_local1 = 100 +f0_local2 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = "" + if f1_arg1.value == "waiting_for_teams" then + if not GameX.gameModeIsFFA() then + f1_local0 = Engine.Localize( "@MP_WAITING_FOR_TEAMS" ) + else + f1_local0 = Engine.Localize( "@MP_WAITING_FOR_MORE_PLAYERS" ) + end + elseif f1_arg1.value == "opponent_forfeiting_in" then + f1_local0 = Engine.Localize( "@MP_OPPONENT_FORFEITING_IN" ) + elseif f1_arg1.value == "match_starting_in" then + f1_local0 = Engine.Localize( "@MP_MATCH_STARTING_IN" ) + elseif f1_arg1.value == "match_resuming_in" then + f1_local0 = Engine.Localize( "@MP_MATCH_RESUMING_IN" ) + elseif f1_arg1.value == "first_infected_in" then + f1_local0 = Engine.Localize( "@SPLASHES_INFECTED_STARTS_IN" ) + end + f1_arg0:setText( f1_local0 ) +end + +local f0_local3 = function ( f2_arg0, f2_arg1 ) + if f2_arg1.value > 0 then + if f2_arg0.current_state ~= "active" then + f2_arg0:animateToState( "active", 0 ) + f2_arg0.current_state = "active" + f0_local2( f2_arg0:getChildById( "matchStartDesc" ), { + name = "ui_match_start_text", + value = Game.GetOmnvar( "ui_match_start_text" ) + } ) + end + elseif f2_arg0.current_state ~= "default" then + f2_arg0:animateToState( "default", 0 ) + f2_arg0.current_state = "default" + return + end + local f2_local0 = f2_arg0:getChildById( "countdownContainer" ) + local f2_local1 = f2_local0:getChildById( "countdownValueText" ) + local f2_local2 = f2_arg0:getChildById( "ghostedCountdownContainer" ) + local f2_local3 = f2_local2:getChildById( "ghostedCountdownValueText" ) + f2_local1:setText( f2_arg1.value ) + f2_local3:setText( f2_arg1.value ) + local f2_local4 = MBh.AnimateSequence( { + { + "opening", + 0 + }, + { + "active", + f0_local1 + }, + { + "active", + f0_local0 + }, + { + "default", + 150 + } + } ) + f2_local4( f2_local0 ) + f2_local4 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + f0_local1 + }, + { + "active", + 0 + }, + { + "closing", + 350 + } + } ) + f2_local4( f2_local2 ) +end + +local f0_local4 = function ( f3_arg0, f3_arg1 ) + if f3_arg1.value == -1 then + return + end + local f3_local0 = Game.GetPlayerTeam() + local f3_local1 = 0 + if f3_local0 > 0 then + local f3_local2 = GameX.GetFactionName( f3_local0 ) + local f3_local3 = f3_arg0:getChildById( "faction_icon_container" ) + local f3_local4 = f3_local3:getChildById( "faction_icon" ) + local f3_local5 = f3_arg0:getChildById( "faction_name_parent_container" ) + local f3_local6 = f3_local5:getChildById( "faction_name_container" ) + local f3_local7 = f3_local5:getChildById( "ghosted_faction_name_container" ) + local f3_local8 = f3_local5:getChildById( "faction_name_glint" ) + local f3_local9 = f3_local6:getChildById( "faction_name" ) + local f3_local10 = f3_local7:getChildById( "ghosted_faction_name" ) + CoD.SetMaterial( f3_local4, RegisterMaterial( Engine.TableLookup( FactionTable.File, FactionTable.Cols.Ref, f3_local2, FactionTable.Cols.FactionHudIcon ) ) ) + local f3_local11 = Engine.Localize( "@" .. Engine.TableLookup( FactionTable.File, FactionTable.Cols.Ref, f3_local2, FactionTable.Cols.Name ) ) + f3_local9:setText( f3_local11 ) + f3_local10:setText( f3_local11 ) + local f3_local12 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 125 + }, + { + "active", + 0 + }, + { + "active", + 2500 + }, + { + "leaving", + 150 + } + } ) + f3_local12( f3_local3 ) + f3_local12 = 1250 + local f3_local13 = 150 + local f3_local14 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 500 + }, + { + "opening", + 0 + }, + { + "active", + f3_local13 + }, + { + "active", + f3_local12 + }, + { + "default", + 50 + }, + { + "default", + 50 + }, + { + "active", + 0 + }, + { + "active", + 50 + }, + { + "default", + 50 + }, + { + "default", + 50 + }, + { + "active", + 0 + }, + { + "active", + 50 + }, + { + "default", + 150 + } + } ) + f3_local14( f3_local6 ) + f3_local14 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 500 + }, + { + "default", + f3_local13 + }, + { + "active", + 0 + }, + { + "closing", + 350 + } + } ) + f3_local14( f3_local7 ) + f3_local14 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 500 + }, + { + "default", + f3_local13 + }, + { + "active", + 0 + }, + { + "closing", + 250 + } + } ) + f3_local14( f3_local8 ) + f3_local1 = 2750 + end + local f3_local2 = GameX.GetGameMode() + local f3_local3 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f3_local2, GameTypesTable.Cols.ObjectiveHintAttackers ) + if f3_arg1.value == 1 then + f3_local3 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f3_local2, GameTypesTable.Cols.ObjectiveHintDefenders ) + end + local f3_local4 = Engine.Localize( "@" .. f3_local3 ) + local f3_local5 = f3_arg0:getChildById( "objective_container" ) + local f3_local6 = f3_local5:getChildById( "objective_bg" ) + local f3_local7 = f3_local5:getChildById( "objective_text" ) + f3_local7:setText( f3_local4 ) + local f3_local8 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + f3_local1 + }, + { + "opening", + 150 + }, + { + "active", + 150 + }, + { + "active", + 2000 + }, + { + "default", + 250 + } + } ) + f3_local8( f3_local5 ) + f3_arg0:animateToState( "active", 0 ) +end + +function matchStartHudDef() + local self = LUI.UIElement.new() + self.id = "matchStartHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = -32, + bottom = 32, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_match_start_countdown", f0_local3 ) + local f4_local1 = LUI.UIText.new() + f4_local1.id = "matchStartDesc" + f4_local1:setText( "" ) + f4_local1:setTextStyle( CoD.TextStyle.Shadowed ) + f4_local1:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = -20, + height = CoD.TextSettings.HudEuroBigFont.Height, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudEuroBigFont.Font, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b + } ) + f4_local1:animateToState( "default", 0 ) + local f4_local2 = CoD.TextSettings.HudDigitalExtraBigFont.Height * 0.5 + local f4_local3 = 128 + local f4_local4 = LUI.UIElement.new() + f4_local4.id = "countdownContainer" + f4_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f4_local2, + left = -f4_local3, + bottom = f4_local2, + right = f4_local3, + alpha = 0 + } ) + f4_local4:animateToState( "default", 0 ) + f4_local4:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f4_local2 * 10, + left = -f4_local3 * 10, + bottom = f4_local2 * 10, + right = f4_local3 * 10, + alpha = 0 + } ) + f4_local4:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f4_local2, + left = -f4_local3, + bottom = f4_local2, + right = f4_local3, + alpha = 1 + } ) + local f4_local5 = LUI.UIText.new() + f4_local5.id = "countdownValueText" + f4_local5:setText( "" ) + f4_local5:setTextStyle( CoD.TextStyle.Shadowed ) + f4_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + font = CoD.TextSettings.HudDigitalExtraBigFont.Font, + alignment = LUI.Alignment.Center + } ) + f4_local5:animateToState( "default", 0 ) + f4_local4:addElement( f4_local5 ) + local f4_local6 = LUI.UIElement.new() + f4_local6.id = "ghostedCountdownContainer" + f4_local6:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f4_local2, + left = -f4_local3, + bottom = f4_local2, + right = f4_local3, + alpha = 0 + } ) + f4_local6:animateToState( "default", 0 ) + f4_local6:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f4_local2, + left = -f4_local3, + bottom = f4_local2, + right = f4_local3, + alpha = 0.75 + } ) + f4_local6:registerAnimationState( "closing", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f4_local2 * 2, + left = -f4_local3 * 2, + bottom = f4_local2 * 2, + right = f4_local3 * 2, + alpha = 0 + } ) + local f4_local7 = LUI.UIText.new() + f4_local7.id = "ghostedCountdownValueText" + f4_local7:setText( "" ) + f4_local7:setTextStyle( CoD.TextStyle.Shadowed ) + f4_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + font = CoD.TextSettings.HudDigitalExtraBigFont.Font, + alignment = LUI.Alignment.Center + } ) + f4_local7:animateToState( "default", 0 ) + f4_local6:addElement( f4_local7 ) + self:addElement( f4_local1 ) + self:addElement( f4_local6 ) + self:addElement( f4_local4 ) + return self +end + +local f0_local5 = function () + local f5_local0 = RegisterMaterial( "white" ) + local f5_local1 = RegisterMaterial( "pointflash" ) + local f5_local2 = RegisterMaterial( "kk_lowbar" ) + local self = LUI.UIElement.new() + self.id = "matchStartObjectiveHud" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + height = 128, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_objective_text", f0_local4 ) + local f5_local4 = -30 + local f5_local5 = LUI.UIElement.new() + f5_local5.id = "faction_icon_container" + f5_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -640 - f5_local4, + left = -640, + bottom = 640 - f5_local4, + right = 640, + alpha = 0 + } ) + f5_local5:animateToState( "default", 0 ) + f5_local5:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -6.4 - f5_local4, + left = -6.4, + bottom = 6.4 - f5_local4, + right = 6.4, + alpha = 1 + } ) + f5_local5:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -64 - f5_local4, + left = -64, + bottom = 64 - f5_local4, + right = 64, + alpha = 1 + } ) + f5_local5:registerAnimationState( "leaving", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0 - f5_local4, + left = 0, + bottom = 0 - f5_local4, + right = 0, + alpha = 0 + } ) + local f5_local6 = LUI.UIImage.new() + f5_local6.id = "faction_icon" + f5_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f5_local0 + } ) + f5_local6:animateToState( "default", 0 ) + f5_local5:addElement( f5_local6 ) + local f5_local7 = LUI.UIElement.new() + f5_local7.id = "faction_name_parent_container" + f5_local7:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -CoD.TextSettings.HudEuroBigFont.Height - f5_local4 + 30, + left = -128, + height = CoD.TextSettings.HudEuroBigFont.Height, + width = 256 + } ) + f5_local7:animateToState( "default", 0 ) + local f5_local8 = LUI.UIImage.new() + f5_local8.id = "faction_name_glint" + f5_local8:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -128, + left = -128, + bottom = 128, + right = 128, + material = f5_local1, + alpha = 0 + } ) + f5_local8:animateToState( "default", 0 ) + f5_local8:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -128, + left = -128, + bottom = 128, + right = 128, + material = f5_local1, + alpha = 1 + } ) + f5_local8:registerAnimationState( "closing", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 256, + left = -640, + bottom = -256, + right = 640, + material = f5_local1, + alpha = 0 + } ) + local f5_local9 = CoD.TextSettings.HudEuroBigFont.Height * 0.5 + local f5_local10 = 128 + local f5_local11 = LUI.UIElement.new() + f5_local11.id = "faction_name_container" + f5_local11:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local9, + left = -f5_local10, + bottom = f5_local9, + right = f5_local10, + alpha = 0 + } ) + f5_local11:animateToState( "default", 0 ) + f5_local11:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local9 * 10, + left = -f5_local10 * 10, + bottom = f5_local9 * 10, + right = f5_local10 * 10, + alpha = 0 + } ) + f5_local11:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local9, + left = -f5_local10, + bottom = f5_local9, + right = f5_local10, + alpha = 1 + } ) + local f5_local12 = LUI.UIText.new() + f5_local12.id = "faction_name" + f5_local12:setText( "" ) + f5_local12:setTextStyle( CoD.TextStyle.Shadowed ) + f5_local12:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + f5_local12:animateToState( "default", 0 ) + f5_local11:addElement( f5_local12 ) + local f5_local13 = LUI.UIElement.new() + f5_local13.id = "ghosted_faction_name_container" + f5_local13:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local9, + left = -f5_local10, + bottom = f5_local9, + right = f5_local10, + alpha = 0 + } ) + f5_local13:animateToState( "default", 0 ) + f5_local13:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local9, + left = -f5_local10, + bottom = f5_local9, + right = f5_local10, + alpha = 0.75 + } ) + f5_local13:registerAnimationState( "closing", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local9 * 2, + left = -f5_local10 * 2, + bottom = f5_local9 * 2, + right = f5_local10 * 2, + alpha = 0 + } ) + local f5_local14 = LUI.UIText.new() + f5_local14.id = "ghosted_faction_name" + f5_local14:setText( "" ) + f5_local14:setTextStyle( CoD.TextStyle.Shadowed ) + f5_local14:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center + } ) + f5_local14:animateToState( "default", 0 ) + f5_local13:addElement( f5_local14 ) + f5_local7:addElement( f5_local8 ) + f5_local7:addElement( f5_local13 ) + f5_local7:addElement( f5_local11 ) + local f5_local15 = LUI.UIElement.new() + f5_local15.id = "objective_container" + f5_local15:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = -128, + height = 128, + alpha = 0 + } ) + f5_local15:animateToState( "default", 0 ) + f5_local15:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = -15, + height = 153.6, + alpha = 1 + } ) + f5_local15:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = -15, + height = 128, + alpha = 1 + } ) + local f5_local16 = LUI.UIImage.new() + f5_local16.id = "objective_bg" + f5_local16:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = -128, + height = -128, + material = f5_local2, + alpha = 0.5 + } ) + f5_local16:animateToState( "default", 0 ) + local f5_local17 = 40 + local f5_local18 = LUI.UIText.new() + f5_local18.id = "objective_text" + f5_local18:setText( "" ) + f5_local18:setTextStyle( CoD.TextStyle.Shadowed ) + f5_local18:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = -CoD.TextSettings.HudEuroBigFont.Height - f5_local17, + height = CoD.TextSettings.HudEuroBigFont.Height, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + f5_local18:animateToState( "default", 0 ) + f5_local15:addElement( f5_local16 ) + f5_local15:addElement( f5_local18 ) + self:addElement( f5_local5 ) + self:addElement( f5_local7 ) + self:addElement( f5_local15 ) + return self +end + +LUI.MenuBuilder.registerType( "matchStartHudDef", matchStartHudDef ) +LUI.MenuBuilder.registerType( "matchStartObjectiveHudDef", f0_local5 ) +LockTable( _M ) diff --git a/lui/mp_hud/minimaphud.dec.lua b/lui/mp_hud/minimaphud.dec.lua new file mode 100644 index 0000000..b040163 --- /dev/null +++ b/lui/mp_hud/minimaphud.dec.lua @@ -0,0 +1,290 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 250 +f0_local1 = 250 +f0_local2 = 250 +local f0_local3 = 1000 +local f0_local4 = 750 +local f0_local5 = 250 +local f0_local6 = 230.4 +local f0_local7 = 460.8 +local f0_local8 = function ( f1_arg0, f1_arg1 ) + if f1_arg0.current_state ~= "active" then + f1_arg0:animateToState( "active", f0_local0 ) + f1_arg0.current_state = "active" + end +end + +local f0_local9 = function ( f2_arg0, f2_arg1 ) + if f2_arg0.current_state ~= "default" then + f2_arg0:animateToState( "default", 0 ) + f2_arg0.current_state = "default" + end +end + +LUI.MenuBuilder.registerType( "minimapHudDef", function () + local f3_local0 = RegisterMaterial( "hud_minimap_border" ) + local f3_local1 = 140 + local f3_local2 = 268 + local f3_local3 = 15 + local f3_local4 = 13 + local self = LUI.UIElement.new() + self.id = "minimapHud" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f0_local6, + width = f0_local7 + } ) + self:animateToState( "default", 0 ) + local f3_local6 = LUI.UIImage.new() + f3_local6.id = "minimapBorder" + f3_local6:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + height = 0, + material = f3_local0, + alpha = 1 + } ) + f3_local6:animateToState( "default", 0 ) + f3_local6:registerAnimationState( "active", { + height = f0_local6 + } ) + f3_local6:registerAnimationState( "opening", { + height = f0_local6 + 40 + } ) + f3_local6:registerEventHandler( "hud_off", f0_local9 ) + f3_local6:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + f0_local0 / 2 + }, + { + "active", + f0_local0 / 2 + } + } ) ) + self:addElement( f3_local6 ) + local f3_local7 = LUI.MenuBuilder.BuildAddChild + local f3_local8 = self + local f3_local9 = { + type = "UIMinimap", + id = "minimap", + states = { + default = { + topAnchor = true, + leftAnchor = true, + top = f3_local3, + left = f3_local4, + height = f3_local1, + width = f3_local2, + alpha = 0 + }, + active = { + alpha = 0.5 + }, + nosignal = { + alpha = 0.05 + } + } + } + local f3_local10 = { + hud_off = function ( f4_arg0, f4_arg1 ) + f0_local9( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToChildren( f4_arg1 ) + end, + hud_on = function ( f5_arg0, f5_arg1 ) + f5_arg0:dispatchEventToChildren( f5_arg1 ) + local f5_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + f0_local0 + }, + { + "active", + f0_local1 + } + } ) + f5_local0( f5_arg0 ) + end + } + local f3_local11 = MBh.AnimateSequence + local f3_local12 = {} + local f3_local13 = { + "active", + 0 + } + local f3_local14 = {} + local f3_local15 = "default" + local f3_local16 = math.random( 10, 50 ) + f3_local14 = f3_local15 + f3_local15 = {} + f3_local16 = "active" + local f3_local17 = math.random( 10, 50 ) + f3_local15 = f3_local16 + f3_local16 = {} + f3_local17 = "default" + local f3_local18 = math.random( 10, 50 ) + f3_local16 = f3_local17 + f3_local17 = {} + f3_local18 = "active" + local f3_local19 = math.random( 10, 50 ) + f3_local17 = f3_local18 + f3_local18 = {} + f3_local19 = "default" + local f3_local20 = math.random( 10, 50 ) + f3_local18 = f3_local19 + f3_local19 = {} + f3_local20 = "active" + local f3_local21 = math.random( 10, 50 ) + f3_local19 = f3_local20 + f3_local20 = {} + f3_local21 = "default" + local f3_local22 = math.random( 50, 100 ) + f3_local20 = f3_local21 + f3_local21 = { + "active", + 250 + } + f3_local12[1] = f3_local13 + f3_local12[2] = f3_local14 + f3_local12[3] = f3_local15 + f3_local12[4] = f3_local16 + f3_local12[5] = f3_local17 + f3_local12[6] = f3_local18 + f3_local12[7] = f3_local19 + f3_local12[8] = f3_local20 + f3_local12[9] = f3_local21 + f3_local10.hud_shake = f3_local11( f3_local12 ) + f3_local10.hud_nosignal_on = MBh.AnimateToState( "nosignal", 0.25 ) + f3_local10.hud_nosignal_off = MBh.AnimateToState( "active", 0.25 ) + f3_local9.handlers = f3_local10 + f3_local9.children = { + { + type = "jammerEffectStaticDef", + id = "minimapStatic" + }, + { + type = "jammerEffectArtifactDef", + id = "minimapArtifact" + }, + { + type = "jammerEffectNoSignalDef", + id = "minimapNoSignal" + } + } + f3_local7( f3_local8, f3_local9 ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIMinimapIcons", + id = "minimapIcons", + properties = { + drawPlayer = true + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = f3_local3, + left = f3_local4, + height = f3_local1, + width = f3_local2, + alpha = 0 + }, + active = { + alpha = 1 + }, + nosignal = { + alpha = 0 + }, + static = { + alpha = 0.25 + } + }, + handlers = { + hud_off = f0_local9, + hud_on = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + f0_local0 + f0_local1 + }, + { + "active", + f0_local2 + } + } ), + hud_nosignal_on = MBh.AnimateToState( "nosignal", 0.25 ), + hud_nosignal_off = MBh.AnimateToState( "active", 0.25 ), + hud_static = MBh.AnimateToState( "static", 0.25 ) + } + } ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "UICompass", + id = "minimapCompass", + states = { + default = { + topAnchor = true, + leftAnchor = true, + top = 15, + left = 17, + height = 10, + width = f3_local2 - 7, + material = RegisterMaterial( "minimap_tickertape_mp" ), + alpha = 0 + }, + active = { + alpha = 1 + }, + nosignal = { + alpha = 0.05 + } + }, + handlers = { + hud_off = f0_local9, + hud_on = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + f0_local0 + f0_local1 + f0_local2 + }, + { + "active", + f0_local3, + true, + true + } + } ), + hud_nosignal_on = MBh.AnimateToState( "nosignal", 0.25 ), + hud_nosignal_off = MBh.AnimateToState( "active", 0.25 ) + } + } ) + self:addElement( LUI.MenuBuilder.buildItems( { + type = "talkerHudDef" + }, self.properties, self ) ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/mlghud.dec.lua b/lui/mp_hud/mlghud.dec.lua new file mode 100644 index 0000000..cb599a1 --- /dev/null +++ b/lui/mp_hud/mlghud.dec.lua @@ -0,0 +1,2227 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function IsPostGame() + return Engine.GetDvarString( "ui_game_state" ) == "postgame" +end + +Views = { + FirstPerson = 1, + ThirdPerson = 2, + Free = 3, + Max = 3 +} +currentView = Views.Free +MLG.StartFollow = function () + if lastValidFollowedClientNum and lastValidFollowedClientNum >= 0 then + MLG.FollowClientnum( lastValidFollowedClientNum ) + else + MLG.FollowNext() + MLG.FollowPrev() + end +end + +function ChangeView( f3_arg0, f3_arg1 ) + if IsPostGame() then + return + elseif mapZoomMode == MapZoomModes.FullScreen then + return + end + f3_arg0:dispatchEventToRoot( { + name = "view_change", + immediate = true + } ) + local f3_local0 = currentView + if f3_arg1 then + currentView = f3_arg1 + else + currentView = 1 + currentView % Views.Max + end + knownState.userPreferences.view = currentView + if currentView == Views.FirstPerson then + MLG.SetThirdPerson( false ) + elseif currentView == Views.ThirdPerson then + MLG.SetThirdPerson( true ) + elseif currentView == Views.Free then + MLG.StopFollow() + if f3_local0 ~= currentView then + Engine.NotifyServer( "mlg_view_change", currentView ) + end + end + if f3_local0 == Views.Free and currentView ~= Views.Free then + MLG.StartFollow() + end + if currentView == Views.Free then + f3_arg0:dispatchEventToRoot( { + name = "highlight_scoreboard_row_by_clientnum", + clientNum = nil, + immediate = true + } ) + f3_arg0:dispatchEventToRoot( { + name = "cod_caster_view_free", + immediate = true + } ) + else + f3_arg0:dispatchEventToRoot( { + name = "cod_caster_view_player", + immediate = true + } ) + end + f3_arg0:dispatchEventToRoot( { + name = "update_button_helpers", + immediate = true + } ) + f3_arg0:dispatchEventToRoot( { + name = "update_mlg_hud_visibility", + immediate = true + } ) +end + +f0_local0 = function ( f4_arg0, f4_arg1 ) + if f4_arg0:getParent() == nil or not f4_arg0.clientNum then + return nil + end + local f4_local0 = f4_arg0.navigation[f4_arg1] + while f4_local0 ~= f4_arg0 do + local f4_local1 = f4_local0.clientNum + if f4_local1 then + local f4_local2 = GameX.GetGameMode() + local f4_local3 = Game.GetPlayerScoreInfo( f4_local1 ) + if f4_local3 then + local f4_local4 = LUI.mp_hud.ScorelistHud.GetRowState( nil, nil, f4_local3, f4_local2 ) + if f4_local4 == "dead" or f4_local4 == "downed" or f4_local1 == f4_arg0.clientNum then + f4_local0 = f4_local0.navigation[f4_arg1] + end + end + f4_local0 = f4_local0.navigation[f4_arg1] + end + f4_local0 = f4_local0.navigation[f4_arg1] + end + return f4_local0.clientNum +end + +function FollowPrev( f5_arg0, f5_arg1 ) + if IsPostGame() then + return + elseif not f5_arg0.followRow then + MLG.FollowPrev() + else + local f5_local0 = f0_local0( f5_arg0.followRow, "up" ) + if f5_local0 then + MLG.FollowClientnum( f5_local0 ) + else + f5_arg0.followRow = nil + end + end + if currentView == Views.Free then + ChangeView( f5_arg0, Views.FirstPerson ) + end +end + +function FollowNext( f6_arg0, f6_arg1 ) + if IsPostGame() then + return + elseif not f6_arg0.followRow then + MLG.FollowNext() + else + local f6_local0 = f0_local0( f6_arg0.followRow, "down" ) + if f6_local0 then + MLG.FollowClientnum( f6_local0 ) + else + f6_arg0.followRow = nil + end + end + if currentView == Views.Free then + ChangeView( f6_arg0, Views.FirstPerson ) + end +end + +function FollowClientNum( f7_arg0, f7_arg1 ) + if IsPostGame() then + return + end + assert( f7_arg1.clientNum ) + MLG.FollowClientnum( f7_arg1.clientNum ) + if currentView == Views.Free then + ChangeView( f7_arg0, Views.FirstPerson ) + end +end + +function PresetCameraHandlerFactory( f8_arg0 ) + return function ( f9_arg0, f9_arg1 ) + if IsPostGame() then + return + end + ChangeView( f9_arg0, Views.Free ) + if f9_arg1.qualifier ~= ButtonQualifiers.Keyboard and focusMode ~= FocusModes.Cameras then + return + elseif f9_arg1.qualifier ~= ButtonQualifiers.DPad and f9_arg1.qualifier ~= ButtonQualifiers.Keyboard then + return + end + local f9_local0 = assert + local f9_local1 + if f8_arg0 < 0 or f8_arg0 > 3 then + f9_local1 = false + else + f9_local1 = true + end + f9_local0( f9_local1, "Invalid camera preset requested" ) + MLG.SetCamera( f8_arg0 ) + f9_arg0:dispatchEventToRoot( { + name = "select_camera_preset_" .. f8_arg0, + immediate = true + } ) + end + +end + +function dpad_helper() + local f10_local0 = { + "up", + "right", + "down", + "left" + } + local self = nil + if CoD.UsingController() then + self = LUI.UIImage.new() + else + self = LUI.UIElement.new() + end + self.id = "DPadHelper" + self:registerAnimationState( "default", { + material = CoD.UsingController() and RegisterMaterial( "icon_hud_dpad" ) or nil, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = -50, + height = 150, + left = 50, + width = 150 + } ) + self:animateToState( "default" ) + for f10_local2 = 0, 3, 1 do + local f10_local5 = f10_local2 + local f10_local6 = f10_local5 == 0 + local f10_local7 = f10_local5 == 1 + local f10_local8 = f10_local5 == 2 + local f10_local9 = f10_local5 == 3 + local f10_local10 = 60 + local f10_local11 = 50 + local f10_local12 = 48 + local f10_local13 = 24 + local f10_local14 + if f10_local6 then + f10_local14 = f10_local11 - f10_local13 + if not f10_local14 then + if f10_local8 then + f10_local14 = -f10_local11 + if not f10_local14 then + + else + local f10_local15 + if f10_local9 then + f10_local15 = f10_local10 - f10_local12 + if not f10_local15 then + if f10_local7 then + f10_local15 = -f10_local10 + if not f10_local15 then + + else + local f10_local16 = LUI.UIImage.new() + f10_local16.id = "camera_" .. f10_local5 + f10_local16:registerAnimationState( "default", { + material = RegisterMaterial( "icon_mlg_cam" .. f10_local5 + 1 ), + topAnchor = f10_local6, + bottomAnchor = f10_local8, + leftAnchor = f10_local9, + rightAnchor = f10_local7, + top = f10_local14, + left = 3 + f10_local15, + width = f10_local12, + height = f10_local13, + alpha = 0.5 + } ) + f10_local16:registerAnimationState( "hilite", { + alpha = 1 + } ) + f10_local16:animateToState( "default" ) + f10_local16:registerEventHandler( "init_hud", MBh.AnimateToState( "default" ) ) + f10_local16:registerEventHandler( "view_change", MBh.AnimateToState( "default" ) ) + for f10_local17 = 0, 3, 1 do + local f10_local20 = f10_local17 + f10_local16:registerEventHandler( "select_camera_preset_" .. f10_local20, function ( element, event ) + if f10_local5 == f10_local20 then + element:animateToState( "hilite" ) + else + element:animateToState( "default" ) + end + end ) + end + self:addElement( f10_local16 ) + if not CoD.UsingController() then + local f10_local17 = 80 + local f10_local18 = 80 + local f10_local19 = 26 + local f10_local20 = 26 + local f10_local21 + if f10_local6 then + f10_local21 = f10_local18 - f10_local20 + if not f10_local21 then + if f10_local8 then + f10_local21 = -f10_local18 + if not f10_local21 then + + else + local f10_local22 + if f10_local9 then + f10_local22 = f10_local17 - f10_local19 + if not f10_local22 then + if f10_local7 then + f10_local22 = -f10_local17 + if not f10_local22 then + + else + local f10_local23 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_arrow_" .. f10_local0[f10_local5 + 1] ), + topAnchor = f10_local6, + bottomAnchor = f10_local8, + leftAnchor = f10_local9, + rightAnchor = f10_local7, + top = f10_local21 - 2, + left = 3 + f10_local22, + width = f10_local19, + height = f10_local20 + } ) + f10_local23.id = "arrow" .. f10_local5 + self:addElement( f10_local23 ) + end + end + f10_local22 = -f10_local19 / 2 + end + else + if f10_local7 then + f10_local22 = -f10_local17 + if not f10_local22 then + + else + local f10_local23 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_arrow_" .. f10_local0[f10_local5 + 1] ), + topAnchor = f10_local6, + bottomAnchor = f10_local8, + leftAnchor = f10_local9, + rightAnchor = f10_local7, + top = f10_local21 - 2, + left = 3 + f10_local22, + width = f10_local19, + height = f10_local20 + } ) + f10_local23.id = "arrow" .. f10_local5 + self:addElement( f10_local23 ) + end + end + f10_local22 = -f10_local19 / 2 + end + local f10_local23 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_arrow_" .. f10_local0[f10_local5 + 1] ), + topAnchor = f10_local6, + bottomAnchor = f10_local8, + leftAnchor = f10_local9, + rightAnchor = f10_local7, + top = f10_local21 - 2, + left = 3 + f10_local22, + width = f10_local19, + height = f10_local20 + } ) + f10_local23.id = "arrow" .. f10_local5 + self:addElement( f10_local23 ) + end + end + f10_local21 = -f10_local20 / 2 + end + else + if f10_local8 then + f10_local21 = -f10_local18 + if not f10_local21 then + + else + local f10_local22 + if f10_local9 then + f10_local22 = f10_local17 - f10_local19 + if not f10_local22 then + if f10_local7 then + f10_local22 = -f10_local17 + if not f10_local22 then + + else + local f10_local23 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_arrow_" .. f10_local0[f10_local5 + 1] ), + topAnchor = f10_local6, + bottomAnchor = f10_local8, + leftAnchor = f10_local9, + rightAnchor = f10_local7, + top = f10_local21 - 2, + left = 3 + f10_local22, + width = f10_local19, + height = f10_local20 + } ) + f10_local23.id = "arrow" .. f10_local5 + self:addElement( f10_local23 ) + end + end + f10_local22 = -f10_local19 / 2 + end + else + if f10_local7 then + f10_local22 = -f10_local17 + if not f10_local22 then + + else + local f10_local23 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_arrow_" .. f10_local0[f10_local5 + 1] ), + topAnchor = f10_local6, + bottomAnchor = f10_local8, + leftAnchor = f10_local9, + rightAnchor = f10_local7, + top = f10_local21 - 2, + left = 3 + f10_local22, + width = f10_local19, + height = f10_local20 + } ) + f10_local23.id = "arrow" .. f10_local5 + self:addElement( f10_local23 ) + end + end + f10_local22 = -f10_local19 / 2 + end + -- ERROR: Infinite loop detected + end + end + f10_local21 = -f10_local20 / 2 + end + local f10_local22 + if f10_local9 then + f10_local22 = f10_local17 - f10_local19 + if not f10_local22 then + if f10_local7 then + f10_local22 = -f10_local17 + if not f10_local22 then + + else + -- ERROR: Infinite loop detected + end + end + f10_local22 = -f10_local19 / 2 + end + else + -- ERROR: Infinite loop detected + end + -- ERROR: Infinite loop detected + end + end + end + f10_local15 = -f10_local12 / 2 + end + else + if f10_local7 then + f10_local15 = -f10_local10 + if not f10_local15 then + + else + local f10_local16 = LUI.UIImage.new() + f10_local16.id = "camera_" .. f10_local5 + f10_local16:registerAnimationState( "default", { + material = RegisterMaterial( "icon_mlg_cam" .. f10_local5 + 1 ), + topAnchor = f10_local6, + bottomAnchor = f10_local8, + leftAnchor = f10_local9, + rightAnchor = f10_local7, + top = f10_local14, + left = 3 + f10_local15, + width = f10_local12, + height = f10_local13, + alpha = 0.5 + } ) + f10_local16:registerAnimationState( "hilite", { + alpha = 1 + } ) + f10_local16:animateToState( "default" ) + f10_local16:registerEventHandler( "init_hud", MBh.AnimateToState( "default" ) ) + f10_local16:registerEventHandler( "view_change", MBh.AnimateToState( "default" ) ) + for f10_local17 = 0, 3, 1 do + local f10_local20 = f10_local17 + f10_local16:registerEventHandler( "select_camera_preset_" .. f10_local20, function ( element, event ) + if f10_local5 == f10_local20 then + element:animateToState( "hilite" ) + else + element:animateToState( "default" ) + end + end ) + end + self:addElement( f10_local16 ) + if not CoD.UsingController() then + local f10_local17 = 80 + local f10_local18 = 80 + local f10_local19 = 26 + local f10_local20 = 26 + local f10_local21 + if f10_local6 then + f10_local21 = f10_local18 - f10_local20 + if not f10_local21 then + if f10_local8 then + f10_local21 = -f10_local18 + if not f10_local21 then + + else + local f10_local22 + if f10_local9 then + f10_local22 = f10_local17 - f10_local19 + if not f10_local22 then + -- ERROR: Infinite loop detected + end + else + -- ERROR: Infinite loop detected + end + -- ERROR: Infinite loop detected + end + end + f10_local21 = -f10_local20 / 2 + end + else + if f10_local8 then + f10_local21 = -f10_local18 + if not f10_local21 then + + else + local f10_local22 + if f10_local9 then + f10_local22 = f10_local17 - f10_local19 + if not f10_local22 then + -- ERROR: Infinite loop detected + end + else + -- ERROR: Infinite loop detected + end + -- ERROR: Infinite loop detected + end + end + f10_local21 = -f10_local20 / 2 + end + -- ERROR: Infinite loop detected + end + end + end + f10_local15 = -f10_local12 / 2 + end + local f10_local16 = LUI.UIImage.new() + f10_local16.id = "camera_" .. f10_local5 + f10_local16:registerAnimationState( "default", { + material = RegisterMaterial( "icon_mlg_cam" .. f10_local5 + 1 ), + topAnchor = f10_local6, + bottomAnchor = f10_local8, + leftAnchor = f10_local9, + rightAnchor = f10_local7, + top = f10_local14, + left = 3 + f10_local15, + width = f10_local12, + height = f10_local13, + alpha = 0.5 + } ) + f10_local16:registerAnimationState( "hilite", { + alpha = 1 + } ) + f10_local16:animateToState( "default" ) + f10_local16:registerEventHandler( "init_hud", MBh.AnimateToState( "default" ) ) + f10_local16:registerEventHandler( "view_change", MBh.AnimateToState( "default" ) ) + for f10_local17 = 0, 3, 1 do + local f10_local20 = f10_local17 + f10_local16:registerEventHandler( "select_camera_preset_" .. f10_local20, function ( element, event ) + if f10_local5 == f10_local20 then + element:animateToState( "hilite" ) + else + element:animateToState( "default" ) + end + end ) + end + self:addElement( f10_local16 ) + if not CoD.UsingController() then + local f10_local17 = 80 + local f10_local18 = 80 + local f10_local19 = 26 + local f10_local20 = 26 + local f10_local21 + if f10_local6 then + f10_local21 = f10_local18 - f10_local20 + if not f10_local21 then + if f10_local8 then + f10_local21 = -f10_local18 + if not f10_local21 then + + else + -- ERROR: Infinite loop detected + end + end + f10_local21 = -f10_local20 / 2 + end + else + -- ERROR: Infinite loop detected + end + -- ERROR: Infinite loop detected + end + end + end + f10_local14 = -f10_local13 / 2 + end + else + if f10_local8 then + f10_local14 = -f10_local11 + if not f10_local14 then + + else + local f10_local15 + if f10_local9 then + f10_local15 = f10_local10 - f10_local12 + if not f10_local15 then + if f10_local7 then + f10_local15 = -f10_local10 + if not f10_local15 then + + else + local f10_local16 = LUI.UIImage.new() + f10_local16.id = "camera_" .. f10_local5 + f10_local16:registerAnimationState( "default", { + material = RegisterMaterial( "icon_mlg_cam" .. f10_local5 + 1 ), + topAnchor = f10_local6, + bottomAnchor = f10_local8, + leftAnchor = f10_local9, + rightAnchor = f10_local7, + top = f10_local14, + left = 3 + f10_local15, + width = f10_local12, + height = f10_local13, + alpha = 0.5 + } ) + f10_local16:registerAnimationState( "hilite", { + alpha = 1 + } ) + f10_local16:animateToState( "default" ) + f10_local16:registerEventHandler( "init_hud", MBh.AnimateToState( "default" ) ) + f10_local16:registerEventHandler( "view_change", MBh.AnimateToState( "default" ) ) + for f10_local17 = 0, 3, 1 do + local f10_local20 = f10_local17 + f10_local16:registerEventHandler( "select_camera_preset_" .. f10_local20, function ( element, event ) + if f10_local5 == f10_local20 then + element:animateToState( "hilite" ) + else + element:animateToState( "default" ) + end + end ) + end + self:addElement( f10_local16 ) + if not CoD.UsingController() then + local f10_local17 = 80 + local f10_local18 = 80 + local f10_local19 = 26 + local f10_local20 = 26 + local f10_local21 + if f10_local6 then + f10_local21 = f10_local18 - f10_local20 + if not f10_local21 then + -- ERROR: Infinite loop detected + end + else + -- ERROR: Infinite loop detected + end + -- ERROR: Infinite loop detected + end + end + end + f10_local15 = -f10_local12 / 2 + end + else + if f10_local7 then + f10_local15 = -f10_local10 + if not f10_local15 then + + else + local f10_local16 = LUI.UIImage.new() + f10_local16.id = "camera_" .. f10_local5 + f10_local16:registerAnimationState( "default", { + material = RegisterMaterial( "icon_mlg_cam" .. f10_local5 + 1 ), + topAnchor = f10_local6, + bottomAnchor = f10_local8, + leftAnchor = f10_local9, + rightAnchor = f10_local7, + top = f10_local14, + left = 3 + f10_local15, + width = f10_local12, + height = f10_local13, + alpha = 0.5 + } ) + f10_local16:registerAnimationState( "hilite", { + alpha = 1 + } ) + f10_local16:animateToState( "default" ) + f10_local16:registerEventHandler( "init_hud", MBh.AnimateToState( "default" ) ) + f10_local16:registerEventHandler( "view_change", MBh.AnimateToState( "default" ) ) + for f10_local17 = 0, 3, 1 do + local f10_local20 = f10_local17 + f10_local16:registerEventHandler( "select_camera_preset_" .. f10_local20, function ( element, event ) + if f10_local5 == f10_local20 then + element:animateToState( "hilite" ) + else + element:animateToState( "default" ) + end + end ) + end + self:addElement( f10_local16 ) + if not CoD.UsingController() then + local f10_local17 = 80 + local f10_local18 = 80 + local f10_local19 = 26 + local f10_local20 = 26 + local f10_local21 + if f10_local6 then + f10_local21 = f10_local18 - f10_local20 + if not f10_local21 then + -- ERROR: Infinite loop detected + end + else + -- ERROR: Infinite loop detected + end + -- ERROR: Infinite loop detected + end + end + end + f10_local15 = -f10_local12 / 2 + end + -- ERROR: Infinite loop detected + end + end + f10_local14 = -f10_local13 / 2 + end + local f10_local15 + if f10_local9 then + f10_local15 = f10_local10 - f10_local12 + if not f10_local15 then + if f10_local7 then + f10_local15 = -f10_local10 + if not f10_local15 then + + else + -- ERROR: Infinite loop detected + end + end + f10_local15 = -f10_local12 / 2 + end + else + -- ERROR: Infinite loop detected + end + -- ERROR: Infinite loop detected + end + return self +end + +ScoreModes = { + LargeBoard = 1, + LargeBoardAllPlayers = 2, + Max = 2 +} +scoreMode = ScoreModes.LargeBoard +function CycleScoreModes( f12_arg0 ) + SetScoreMode( f12_arg0, 1 + scoreMode % ScoreModes.Max ) + f12_arg0:dispatchEventToRoot( { + name = "update_button_helpers", + immediate = true + } ) +end + +function SetScoreMode( f13_arg0, f13_arg1 ) + local f13_local0 = f13_arg1 == ScoreModes.LargeBoardAllPlayers + scoreMode = f13_arg1 + if not f13_local0 then + SetFocusMode( f13_arg0, FocusModes.Cameras ) + end + f13_arg0:dispatchEventToRoot( { + name = "update_mlg_hud_visibility" + } ) +end + +function IsGameModeTeamBased() + return not GameX.gameModeIsFFA( GameX.GetGameMode() ) +end + +function UpdateLargeScoreboard( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg0:getChildById( "teamAImage" ) + local f15_local1 = f15_arg0:getChildById( "teamBImage" ) + if f15_arg0.oldTeam ~= Game.GetLastMLGSpectateTeam() then + if Game.GetLastMLGSpectateTeam() ~= Teams.axis then + local f15_local2 = MBh.AnimateLoop( { + { + "visible", + 1000 + }, + { + "visible1", + 1000 + } + } ) + f15_local2( f15_local0, {} ) + f15_local1:animateToState( "default" ) + else + f15_local0:animateToState( "default" ) + local f15_local2 = MBh.AnimateLoop( { + { + "visible", + 1000 + }, + { + "visible1", + 1000 + } + } ) + f15_local2( f15_local1, {} ) + end + f15_arg0.oldTeam = Game.GetLastMLGSpectateTeam() + end +end + +function large_scoreboard() + local self = LUI.UIElement.new() + self.id = "large_scoreboard" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -10, + height = 60, + left = -160, + right = 160 + } ) + self:animateToState( "default" ) + local f16_local1 = 360 + local f16_local2 = 32 + local f16_local3 = LUI.UIHorizontalList.new() + f16_local3.id = "modeBG" + f16_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 8, + height = f16_local2, + left = -f16_local1 / 2, + right = f16_local1 / 2 + } ) + f16_local3:animateToState( "default" ) + self:addElement( f16_local3 ) + local f16_local4 = LUI.UIImage.new() + f16_local4.id = "leftCap" + f16_local4:registerAnimationState( "default", { + material = RegisterMaterial( "box_white_gradient_fade_rt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f16_local2 * 2, + red = 0, + green = 0, + blue = 0, + alpha = 0.5 + } ) + f16_local4:animateToState( "default" ) + f16_local3:addElement( f16_local4 ) + local f16_local5 = LUI.UIImage.new() + f16_local5.id = "middle" + f16_local5:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f16_local1 - 4 * f16_local2, + red = 0, + green = 0, + blue = 0, + alpha = 0.5 + } ) + f16_local5:animateToState( "default" ) + f16_local3:addElement( f16_local5 ) + local f16_local6 = LUI.UIImage.new() + f16_local6.id = "rightCap" + f16_local6:registerAnimationState( "default", { + material = RegisterMaterial( "box_white_gradient_fade" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f16_local2 * 2, + red = 0, + green = 0, + blue = 0, + alpha = 0.5 + } ) + f16_local6:animateToState( "default" ) + f16_local3:addElement( f16_local6 ) + local f16_local7 = LUI.UIImage.new() + f16_local7.id = "scoreBG" + f16_local7:registerAnimationState( "default", { + material = RegisterMaterial( "box_mlg_bg" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 34, + height = 128, + left = -256, + right = 256 + } ) + f16_local7:animateToState( "default" ) + self:addElement( f16_local7 ) + local f16_local8 = nil + if IsGameModeTeamBased() then + f16_local8 = LUI.UIImage.new() + f16_local8.id = "countdownBG" + f16_local8:registerAnimationState( "default", CoD.ColorizeState( Colors.black, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 47, + height = 27, + left = -48, + right = 48 + } ) ) + f16_local8:animateToState( "default" ) + self:addElement( f16_local8 ) + else + f16_local8 = LUI.UIElement.new() + f16_local8.id = "countdownBG" + f16_local8:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 11, + height = 27, + width = 96, + right = 0 + } ) + end + f16_local8:animateToState( "default" ) + self:addElement( f16_local8 ) + local f16_local9 = LUI.UICountdown.new() + f16_local9.id = "countdown" + f16_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.HudDigitalNormalFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 1, + right = 0, + height = CoD.TextSettings.HudDigitalNormalFont.Height + } ) ) + f16_local9:animateToState( "default" ) + f16_local8:addElement( f16_local9 ) + local f16_local10 = Engine.Localize( "@" .. Engine.TableLookup( "mp/mapNames.csv", 0, Engine.GetDvarString( "ui_mapname" ), 1 ) ) + local f16_local11 = Engine.Localize( "@" .. Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, GameX.GetGameMode(), GameTypesTable.Cols.Name ) ) + local f16_local12 = "%04d" + local f16_local13 = LUI.UIText.new() + f16_local13.id = "mode" + f16_local13:setText( f16_local11 .. "-" .. f16_local10 ) + if IsGameModeTeamBased() then + local f16_local14 = function ( f17_arg0 ) + local self = LUI.UIImage.new() + self.id = "teamImageLogo_" .. f17_arg0 + self:registerAnimationState( "default", { + material = RegisterMaterial( f17_arg0 ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + return self + end + + f16_local13:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 14, + right = 0, + height = CoD.TextSettings.SmallFont.Height + } ) ) + f16_local13:animateToState( "default" ) + self:addElement( f16_local13 ) + local f16_local15 = LUI.UIImage.new() + f16_local15.id = "teamAImage" + f16_local15:registerAnimationState( "default", { + material = RegisterMaterial( "hud_round_end_orange" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 36, + height = 84, + left = 15, + width = 84, + alpha = 1, + red = 0.4, + green = 0.4, + blue = 0.4 + } ) + f16_local15:animateToState( "default" ) + f16_local15:registerAnimationState( "visible", { + material = RegisterMaterial( "hud_round_end_blue" ), + red = 1, + green = 1, + blue = 1 + } ) + f16_local15:registerAnimationState( "visible1", { + material = RegisterMaterial( "hud_round_end_blue" ), + red = 0.6, + green = 0.6, + blue = 0.6 + } ) + self:addElement( f16_local15 ) + f16_local15:addElement( f16_local14( "hud_round_end_ghost" ) ) + local f16_local16 = LUI.UIImage.new() + f16_local16.id = "teamBImage" + f16_local16:registerAnimationState( "default", { + material = RegisterMaterial( "hud_round_end_orange" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 36, + height = 84, + width = 84, + right = -15, + alpha = 1, + red = 0.4, + green = 0.4, + blue = 0.4 + } ) + f16_local16:animateToState( "default" ) + f16_local16:registerAnimationState( "visible", { + material = RegisterMaterial( "hud_round_end_blue" ), + red = 1, + green = 1, + blue = 1 + } ) + f16_local16:registerAnimationState( "visible1", { + material = RegisterMaterial( "hud_round_end_blue" ), + red = 0.6, + green = 0.6, + blue = 0.6 + } ) + self:addElement( f16_local16 ) + f16_local16:addElement( f16_local14( "hud_round_end_fed" ) ) + local f16_local17 = "%04d" + local f16_local18 = LUI.UIText.new() + f16_local18.id = "teamAScore" + f16_local18:setTextStyle( CoD.TextStyle.ShadowedMore ) + f16_local18:setupUIBindText( "TeamScoreFriendly", f16_local17 ) + f16_local18:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.HudDigitalBigFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = -45, + top = 44, + right = 0, + height = CoD.TextSettings.HudDigitalBigFont.Height + } ) ) + f16_local18:animateToState( "default" ) + self:addElement( f16_local18 ) + local f16_local19 = LUI.UIText.new() + f16_local19.id = "teamBScore" + f16_local19:setTextStyle( CoD.TextStyle.ShadowedMore ) + f16_local19:setupUIBindText( "TeamScoreEnemy", f16_local17 ) + f16_local19:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.HudDigitalBigFont.Font, + alignment = LUI.Alignment.Right, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 44, + right = 45, + height = CoD.TextSettings.HudDigitalBigFont.Height + } ) ) + f16_local19:animateToState( "default" ) + self:addElement( f16_local19 ) + self:registerEventHandler( "spectate_team_change", UpdateLargeScoreboard ) + UpdateLargeScoreboard( self, {} ) + else + local f16_local14 = function ( menu, controller ) + local self = LUI.UIText.new() + self.id = "imageText_" .. menu + self:registerAnimationState( "default", CoD.ColorizeState( controller, { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 32, + bottom = 32 + CoD.TextSettings.BoldFont.Height, + left = -2, + right = 0 + } ) ) + self:animateToState( "default" ) + self:setText( Engine.Localize( menu ) ) + return self + end + + f16_local13:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 14, + right = 0, + height = CoD.TextSettings.SmallFont.Height + } ) ) + f16_local13:animateToState( "default" ) + self:addElement( f16_local13 ) + local f16_local15 = LUI.UIImage.new() + f16_local15.id = "firstPlaceImage" + f16_local15:registerAnimationState( "default", { + material = RegisterMaterial( "hud_round_end_blue" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 36, + height = 84, + left = -60, + width = 84 + } ) + f16_local15:animateToState( "default" ) + self:addElement( f16_local15 ) + f16_local15:addElement( f16_local14( "LUA_MENU_1ST", Colors.white ) ) + local f16_local16 = LUI.UIImage.new() + f16_local16.id = "secondPlaceImage" + f16_local16:registerAnimationState( "default", { + material = RegisterMaterial( "hud_round_end_blue" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 36, + height = 84, + left = 89, + width = 84 + } ) + f16_local16:animateToState( "default" ) + self:addElement( f16_local16 ) + f16_local16:addElement( f16_local14( "LUA_MENU_2ND", Colors.md_grey ) ) + local f16_local17 = LUI.UIImage.new() + f16_local17.id = "thirdPlaceImage" + f16_local17:registerAnimationState( "default", { + material = RegisterMaterial( "hud_round_end_blue" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 36, + height = 84, + width = 84, + right = 0 + } ) + f16_local17:animateToState( "default" ) + self:addElement( f16_local17 ) + f16_local17:addElement( f16_local14( "LUA_MENU_3RD", Colors.grey_5 ) ) + local f16_local18 = LUI.UIText.new() + f16_local18.id = "firstPlaceScore" + f16_local18:setTextStyle( CoD.TextStyle.ShadowedMore ) + f16_local18:registerAnimationState( "default", CoD.ColorizeState( Colors.cyan, { + font = CoD.TextSettings.HudDigitalBigFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 17, + top = 44, + width = 45, + height = CoD.TextSettings.HudDigitalBigFont.Height + } ) ) + f16_local18:animateToState( "default" ) + f16_local18:setText( string.format( f16_local12, 0 ) ) + f16_local18:registerEventHandler( "timer_update", function ( element, event ) + local f19_local0 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.free, 1, GameX.GetGameMode(), false ) + if f19_local0 then + element:setText( string.format( f16_local12, f19_local0.score ) ) + end + end ) + self:addElement( f16_local18 ) + local f16_local19 = LUI.UIText.new() + f16_local19.id = "secondPlaceScore" + f16_local19:setTextStyle( CoD.TextStyle.ShadowedMore ) + f16_local19:registerAnimationState( "default", CoD.ColorizeState( Colors.md_grey, { + font = CoD.TextSettings.HudDigitalBigFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 166, + top = 44, + width = 45, + height = CoD.TextSettings.HudDigitalBigFont.Height + } ) ) + f16_local19:animateToState( "default" ) + f16_local19:setText( string.format( f16_local12, 0 ) ) + f16_local19:registerEventHandler( "timer_update", function ( element, event ) + local f20_local0 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.free, 2, GameX.GetGameMode(), false ) + if f20_local0 then + element:setText( string.format( f16_local12, f20_local0.score ) ) + end + end ) + self:addElement( f16_local19 ) + local f16_local20 = LUI.UIText.new() + f16_local20.id = "thirdPlaceScore" + f16_local20:setTextStyle( CoD.TextStyle.ShadowedMore ) + f16_local20:registerAnimationState( "default", CoD.ColorizeState( Colors.grey_5, { + font = CoD.TextSettings.HudDigitalBigFont.Font, + alignment = LUI.Alignment.Right, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 44, + right = 60, + height = CoD.TextSettings.HudDigitalBigFont.Height + } ) ) + f16_local20:animateToState( "default" ) + f16_local20:setText( string.format( f16_local12, 0 ) ) + f16_local20:registerEventHandler( "timer_update", function ( element, event ) + local f21_local0 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.free, 3, GameX.GetGameMode(), false ) + if f21_local0 then + element:setText( string.format( f16_local12, f21_local0.score ) ) + end + end ) + self:addElement( f16_local20 ) + end + return self +end + +function playercard() + local self = LUI.UIElement.new() + self.id = "playercard" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -90, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f22_local1 = LUI.UIElement.new() + local f22_local2 = -235 + local f22_local3 = LUI.UIImage.new( CoD.ColorizeState( Colors.black, { + material = RegisterMaterial( "box_white_gradient_fade" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = 9, + left = f22_local2 - 312, + height = 61, + width = 70, + alpha = 0 + } ) ) + f22_local3:registerAnimationState( "opening", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = 9, + left = f22_local2 + 10, + height = 61, + width = 70, + alpha = 1 + } ) + f22_local3:registerAnimationState( "active", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = 9, + left = f22_local2, + height = 61, + width = 70, + alpha = 1 + } ) + f22_local3:registerAnimationState( "closing", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = 9, + left = f22_local2 - 20, + height = 61, + width = 70, + alpha = 1 + } ) + f22_local3:registerAnimationState( "closed", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = 9, + left = f22_local2 + 85, + height = 61, + width = 70, + alpha = 0 + } ) + f22_local3.id = "teamIcon" + f22_local3:registerEventHandler( "refresh_playercard", function ( element, event ) + local f23_local0 = Game.GetPlayerstateClientnum() + if f23_local0 ~= -1 and f22_local1.current_client_num ~= f23_local0 and Game.GetPlayerClientnum() ~= f23_local0 then + local f23_local1 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 150 + }, + { + "active", + 4000 + }, + { + "closing", + 150, + true, + true + }, + { + "closed", + 100, + true + } + } ) + f23_local1( f22_local3, {} ) + else + element:animateToState( "default" ) + end + end ) + self:addElement( f22_local3 ) + local f22_local4 = LUI.UIImage.new( { + material = RegisterMaterial( "finalscore_icon_back_gray" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = 7, + height = 75, + left = -36, + width = 75 + } ) + f22_local4.id = "teamIconSquare" + f22_local3:addElement( f22_local4 ) + local f22_local5 = LUI.UIImage.new( { + material = RegisterMaterial( "hud_round_end_ghost" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f22_local5:registerAnimationState( "federation", { + material = RegisterMaterial( "hud_round_end_fed" ) + } ) + f22_local5.id = "teamIconEmblem" + f22_local5:registerEventHandler( "refresh_playercard", function ( element, event ) + if Game.GetLastMLGSpectateTeam() == Teams.axis then + element:animateToState( "federation" ) + else + element:animateToState( "default" ) + end + end ) + f22_local4:addElement( f22_local5 ) + local f22_local6 = LUI.UIImage.new() + f22_local6.id = "spectatorTeamNameBGId" + f22_local6:registerAnimationState( "default", { + material = RegisterMaterial( "gradient_bottom" ), + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = -68, + left = 40, + height = 17, + right = 76, + alpha = 0.7 + } ) + f22_local6:animateToState( "default", 0 ) + f22_local1:addElement( f22_local6 ) + local f22_local7 = LUI.UIText.new() + f22_local7.id = "spectatorTeamNameId" + f22_local7:setTextStyle( CoD.TextStyle.Shadowed ) + f22_local7:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + top = -70, + left = 40, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + right = 60, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 1 + } ) + f22_local7:animateToState( "default", 0 ) + f22_local7:registerEventHandler( "refresh_playercard", function ( element, event ) + f22_local7:setText( GameX.GetLocalizedTeamName( Game.GetLastMLGSpectateTeam() ) ) + end ) + f22_local1:addElement( f22_local7 ) + f22_local1.id = "spectatorPlayerCard" + f22_local1:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = 0, + left = -512, + height = 64, + width = 256, + alpha = 0 + } ) + f22_local1:registerAnimationState( "opening", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = 0, + left = -190, + height = 64, + width = 256, + alpha = 1 + } ) + f22_local1:registerAnimationState( "active", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = 0, + left = -200, + height = 64, + width = 256, + alpha = 1 + } ) + f22_local1:animateToState( "default", 0 ) + f22_local1:addElement( LUI.mp_hud.PlayerCardHud.playerCardHudDef() ) + self:addElement( f22_local1 ) + self:registerEventHandler( "refresh_playercard", LUI.mp_hud.SpectatorHud.UpdateSpectator ) + return self +end + +FocusModes = { + Cameras = 1, + Scoreboard = 2, + Max = 2 +} +focusMode = FocusModes.Cameras +followedClientNum = -1 +lastValidFollowedClientNum = -1 +function CycleFocus( f26_arg0, f26_arg1 ) + SetFocusMode( f26_arg0, 1 + focusMode % FocusModes.Max ) + f26_arg0:dispatchEventToRoot( { + name = "update_button_helpers", + immediate = true + } ) +end + +function SetFocusMode( f27_arg0, f27_arg1 ) + if f27_arg1 == focusMode then + return + end + focusMode = f27_arg1 + if f27_arg1 ~= FocusModes.Scoreboard then + f27_arg0:dispatchEventToRoot( { + name = "unfocus_scoreboard", + immediate = true + } ) + else + if scoreMode == ScoreModes.LargeBoard then + SetScoreMode( f27_arg0, ScoreModes.LargeBoardAllPlayers ) + f27_arg0:dispatchEventToRoot( { + name = "toggle_scoreboard", + immediate = true + } ) + end + f27_arg0:dispatchEventToRoot( { + name = "focus_scoreboard", + immediate = true + } ) + end +end + +function large_map() + local self = LUI.UIElement.new() + self.id = "largeMap" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f28_local1 = LUI.UIElement.new() + f28_local1:setupWorldBlur() + f28_local1.id = "blur" + f28_local1:registerAnimationState( "default", { + worldBlur = 0 + } ) + f28_local1:registerAnimationState( "visible", { + worldBlur = 10 + } ) + f28_local1:registerEventHandler( "hide_large_map", MBh.AnimateToState( "default", 150 ) ) + f28_local1:registerEventHandler( "show_bigger_map", MBh.AnimateToState( "default", 150 ) ) + f28_local1:registerEventHandler( "show_fullscreen_map", MBh.AnimateToState( "visible", 150 ) ) + f28_local1:animateToState( "default" ) + self:addElement( f28_local1 ) + local f28_local2 = LUI.UIElement.new() + f28_local2:setupMinimap( CoD.CompassType.Full ) + f28_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + width = 536, + height = 280, + top = 0, + left = 0, + alpha = 0, + scale = -1 + } ) + f28_local2:registerAnimationState( "bigger", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + width = 320, + height = 320, + top = 10, + left = 20, + scale = 0, + alpha = 1 + } ) + f28_local2:registerAnimationState( "fullscreen", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = 1072, + height = 500, + scale = 0, + alpha = 1 + } ) + f28_local2:animateToState( "default" ) + f28_local2:registerEventHandler( "hide_large_map", MBh.AnimateToState( "default", 150 ) ) + f28_local2:registerEventHandler( "show_bigger_map", MBh.AnimateToState( "bigger", 150 ) ) + f28_local2:registerEventHandler( "show_fullscreen_map", MBh.AnimateToState( "fullscreen", 150 ) ) + f28_local2:registerEventHandler( "killcam_change", function ( element, event ) + if event.value then + knownState.userPreferences.mapZoomMode = mapZoomMode + SetMapZoomMode( element, MapZoomModes.Standard ) + end + end ) + self:addElement( f28_local2 ) + local f28_local3 = LUI.UIElement.new() + f28_local3:setupMinimapIcons( CoD.CompassType.Full ) + f28_local3.properties = { + drawPlayer = true + } + f28_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + left = 0 + } ) + f28_local3:animateToState( "default" ) + f28_local2:addElement( f28_local3 ) + return self +end + +MapZoomModes = { + Standard = 1, + Bigger = 2, + FullScreen = 3, + Max = 3 +} +mapZoomMode = MapZoomModes.Standard +function CycleMapZoom( f30_arg0, f30_arg1 ) + SetMapZoomMode( f30_arg0, 1 + mapZoomMode % MapZoomModes.Max ) + f30_arg0:dispatchEventToRoot( { + name = "update_button_helpers", + immediate = true + } ) +end + +function SetMapZoomMode( f31_arg0, f31_arg1 ) + mapZoomMode = f31_arg1 + if mapZoomMode == MapZoomModes.Standard then + f31_arg0:dispatchEventToRoot( { + name = "show_standard_map", + immediate = true + } ) + f31_arg0:dispatchEventToRoot( { + name = "hide_large_map", + immediate = true + } ) + else + f31_arg0:dispatchEventToRoot( { + name = "show_non_standard_map", + immediate = true + } ) + if mapZoomMode == MapZoomModes.Bigger then + f31_arg0:dispatchEventToRoot( { + name = "show_bigger_map", + immediate = true + } ) + elseif mapZoomMode == MapZoomModes.FullScreen then + f31_arg0:dispatchEventToRoot( { + name = "show_fullscreen_map", + immediate = true + } ) + end + end + f31_arg0:dispatchEventToRoot( { + name = "update_mlg_hud_visibility" + } ) +end + +Overlays = { + All = 1, + ToolbarOff = 2, + None = 3, + Max = 3 +} +currentOverlay = Overlays.All +function ToggleOverlays( f32_arg0 ) + currentOverlay = 1 + currentOverlay % Overlays.Max + f32_arg0:dispatchEventToRoot( { + name = "update_mlg_hud_visibility" + } ) + if currentOverlay ~= Overlays.ToolbarOff and currentOverlay ~= Overlays.None then + f32_arg0:dispatchEventToRoot( { + name = "update_button_helpers", + immediate = true + } ) + end +end + +function obituary() + local f33_local0 = LUI.mp_hud.ObituaryHud.obituaryHudDef() + f33_local0:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -44, + right = 20, + width = 256, + height = 256, + alpha = 1 + } ) + f33_local0.id = "mlg_obituary" + f33_local0:animateToState( "default" ) + return f33_local0 +end + +function OpenPauseMenu( f34_arg0, f34_arg1 ) + f34_arg0:dispatchEventToRoot( { + name = "toggle_pause" + } ) + f34_arg0:dispatchEventToRoot( { + name = "update_mlg_hud_visibility" + } ) +end + +function UpdateButtonHelpers( f35_arg0 ) + local f35_local0 = 1 + currentOverlay % Overlays.Max + local f35_local1 = nil + if f35_local0 == Overlays.All then + f35_local1 = "PATCH_MENU_MLG_SPECT_SHOW_ALL_HELP" + elseif f35_local0 == Overlays.ToolbarOff then + f35_local1 = "PATCH_MENU_MLG_SPECT_CAMERAS_ONLY" + else + f35_local1 = "PATCH_MENU_MLG_SPECT_HIDE_HELP" + end + if 1 == Engine.IsGamepadEnabled() then + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 0, + button_ref = "button_secondary", + helper_text = Engine.Localize( f35_local1 ), + side = "left" + } ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 6, + button_ref = "button_start", + helper_text = "", + side = "left" + } ) + else + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 0, + button_ref = "button_start", + helper_text = Engine.Localize( f35_local1 ), + side = "left" + } ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 6, + button_ref = "button_secondary", + helper_text = "", + side = "left" + } ) + end + local f35_local2 = Engine.Localize( "MENU_PLAYER" ) + if 1 == Engine.IsGamepadEnabled() then + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 1, + button_ref = "button_ins", + helper_text = "", + side = "left" + } ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 1, + button_ref = "button_page_up", + helper_text = "", + side = "left" + } ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 1, + button_ref = "button_shoulderl", + helper_text = f35_local2, + button_ref2 = "button_shoulderr", + side = "left" + } ) + else + local f35_local3 = Engine.Localize( "LUA_MENU_MLG_SPECT_HIGHLIGHT_PLAYER" ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 1, + button_ref = "button_shoulderl", + helper_text = "", + side = "left" + } ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 1, + button_ref = "button_ins", + button_ref2 = "button_del", + helper_text = f35_local3, + side = "left" + } ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 1, + button_ref = "button_page_up", + button_ref2 = "button_page_down", + helper_text = f35_local2, + side = "left" + } ) + end + local f35_local3 = "" + if mapZoomMode ~= MapZoomModes.FullScreen then + local f35_local4 = 1 + currentView % Views.Max + if f35_local4 == Views.FirstPerson then + f35_local3 = Engine.Localize( "PATCH_MENU_MLG_SPECT_FIRST_PERSON" ) + elseif f35_local4 == Views.ThirdPerson then + f35_local3 = Engine.Localize( "PATCH_MENU_MLG_SPECT_THIRD_PERSON" ) + else + f35_local3 = Engine.Localize( "PATCH_MENU_MLG_SPECT_FREE_CAM" ) + end + end + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 2, + button_ref = "button_alt2", + helper_text = "", + side = "left" + } ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 2, + button_ref = "button_alt2", + helper_text = f35_local3, + side = "left" + } ) + local f35_local4 = "" + local f35_local5 = 1 + mapZoomMode % MapZoomModes.Max + if f35_local5 == MapZoomModes.Standard then + f35_local4 = "PATCH_MENU_MLG_SPECT_MINIMAP" + elseif f35_local5 == MapZoomModes.Bigger then + f35_local4 = "PATCH_MENU_MLG_SPECT_LARGE_MAP" + else + f35_local4 = "PATCH_MENU_MLG_SPECT_FULLSCREEN_MAP" + end + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 3, + button_ref = "button_left_trigger", + helper_text = "", + side = "left" + } ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 3, + button_ref = "button_left_trigger", + helper_text = Engine.Localize( f35_local4 ), + side = "left" + } ) + local f35_local6 = Engine.Localize( "PATCH_MENU_MLG_SPECT_SCOREBOARD" ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 4, + button_ref = "button_select", + helper_text = "", + side = "left" + } ) + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 4, + button_ref = "button_select", + helper_text = f35_local6, + side = "left" + } ) + if 1 == Engine.IsGamepadEnabled() then + local f35_local7 = 1 + focusMode % FocusModes.Max + local f35_local8 = nil + if f35_local7 == FocusModes.Cameras then + f35_local8 = Engine.Localize( "PATCH_MENU_MLG_SPECT_UNFOCUS_SCOREBOARD" ) + else + f35_local8 = Engine.Localize( "PATCH_MENU_MLG_SPECT_FOCUS_SCOREBOARD" ) + end + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 5, + button_ref = "button_right_trigger", + helper_text = f35_local8, + side = "left" + } ) + else + f35_arg0:processEvent( { + name = "add_button_helper_text", + priority = 5, + button_ref = "button_right_trigger", + helper_text = "", + side = "left" + } ) + end + f35_arg0:dispatchEventToRoot( { + name = "refresh_button_helper" + } ) +end + +knownState = { + isKillCam = nil, + userPreferences = {} +} +function OnRoundStart( f36_arg0, f36_arg1 ) + SetFocusMode( f36_arg0, FocusModes.Cameras ) + currentView = Views.Free + local f36_local0 = knownState.userPreferences + if f36_local0.mapZoomMode then + SetMapZoomMode( f36_arg0, f36_local0.mapZoomMode ) + end + if f36_local0.view then + ChangeView( f36_arg0, f36_local0.view ) + end +end + +function UpdateTimer( f37_arg0, f37_arg1 ) + if Game.InKillCam() ~= knownState.isKillCam then + knownState.isKillCam = Game.InKillCam() + UpdateHUDVisibility( f37_arg0 ) + f37_arg0:processEvent( { + name = "killcam_change", + value = knownState.isKillCam + } ) + end + local f37_local0 = MLG.GetFollowedClientNum() or -1 + if f37_local0 ~= followedClientNum then + followedClientNum = f37_local0 + f37_arg0:dispatchEventToRoot( { + name = "refresh_playercard", + dispatchChildren = true + } ) + if followedClientNum >= 0 then + f37_arg0:dispatchEventToRoot( { + name = "spectate_team_change", + immediate = true + } ) + if not knownState.isKillCam then + lastValidFollowedClientNum = f37_local0 + end + end + end + if followedClientNum >= 0 and currentView ~= Views.Free then + f37_arg0:dispatchEventToRoot( { + name = "highlight_scoreboard_row_by_clientnum", + clientNum = followedClientNum, + immediate = true + } ) + else + f37_arg0:dispatchEventToRoot( { + name = "highlight_scoreboard_row_by_clientnum", + clientNum = nil, + immediate = true + } ) + end +end + +function UpdateHUDVisibility( f38_arg0 ) + local f38_local0 = f38_arg0.hudContainer.hud.is_paused or knownState.isKillCam + local f38_local1 = {} + local f38_local2 = f38_arg0.largeScoreboard + local f38_local3 + if f38_local0 then + f38_local3 = "hidden" + if not f38_local3 then + + else + f38_local1[f38_local2] = f38_local3 + f38_local2 = f38_arg0.playercard + if f38_local0 or currentOverlay == Overlays.None or mapZoomMode == MapZoomModes.FullScreen then + f38_local3 = "hidden" + if not f38_local3 then + + else + f38_local1[f38_local2] = f38_local3 + f38_local2 = f38_arg0.dpadHelper + if f38_local0 or currentOverlay == Overlays.None or currentView ~= Views.Free then + f38_local3 = "hidden" + if not f38_local3 then + + else + f38_local1[f38_local2] = f38_local3 + f38_local2 = f38_arg0.buttonHelper + if f38_local0 or currentOverlay == Overlays.ToolbarOff or currentOverlay == Overlays.None then + f38_local3 = "hidden" + if not f38_local3 then + + else + f38_local1[f38_local2] = f38_local3 + f38_local2 = f38_arg0.largeMap + if f38_local0 or mapZoomMode == MapZoomModes.Standard then + f38_local3 = "hidden" + if not f38_local3 then + + else + f38_local1[f38_local2] = f38_local3 + f38_local2 = f38_arg0.obituary + if f38_local0 then + f38_local3 = "hidden" + if not f38_local3 then + + else + f38_local1[f38_local2] = f38_local3 + for f38_local9, f38_local10 in pairs( f38_local1 ) do + if f38_local9.currentState ~= f38_local10 then + local f38_local5 = f38_local9 + local f38_local6 = f38_local9.animateToState + local f38_local7 = f38_local10 + local f38_local8 + if f38_local9 == f38_arg0.largeMap then + f38_local8 = 0 + if not f38_local8 then + + else + f38_local6( f38_local5, f38_local7, f38_local8 ) + f38_local9.currentState = f38_local10 + end + end + f38_local8 = 150 + end + end + end + end + f38_local3 = "default" + end + end + f38_local3 = "default" + end + end + f38_local3 = "default" + end + end + f38_local3 = "default" + end + end + f38_local3 = "default" + end + end + f38_local3 = "default" +end + +function addWidget( f39_arg0, f39_arg1, f39_arg2 ) + local self = LUI.UIElement.new() + self.id = "wrapper_for_" .. f39_arg2.id + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default" ) + self:addElement( f39_arg2 ) + if f39_arg1 then + f39_arg0.static:addElement( self ) + else + f39_arg0.scalable:addElement( self ) + end + return self +end + +function MLGHud( f40_arg0 ) + MLG.SetMLGActiveMenu() + local self = LUI.UIElement.new() + self.hudContainer = f40_arg0 + self.id = "MLGHud" + self.addWidget = addWidget + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "init_hud", OnRoundStart ) + self:registerEventHandler( "update_mlg_hud_visibility", UpdateHUDVisibility ) + self:registerEventHandler( "toggle_pause", function () + self:dispatchEventToRoot( { + name = "update_mlg_hud_visibility" + } ) + end ) + self:registerEventHandler( "empty_menu_stack", function ( element, event ) + MLG.SetMLGActiveMenu() + UpdateHUDVisibility( element, event ) + UpdateButtonHelpers( self.buttonHelper ) + end ) + self:registerOmnvarHandler( "ui_pause_menu_show", UpdateHUDVisibility ) + self:registerEventHandler( "show_non_standard_map", function () + self.hudContainer.hud.noMap = true + end ) + self:registerEventHandler( "show_standard_map", function () + self.hudContainer.hud.noMap = nil + end ) + self.scalable = LUI.UIElement.new() + self.scalable.id = "scalable" + self:addElement( self.scalable ) + local f40_local1 = function () + local f45_local0, f45_local1, f45_local2, f45_local3 = GameX.GetAdjustedSafeZoneSize() + local f45_local4 = 15 + self.scalable:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = f45_local0 + f45_local4, + top = f45_local1 + f45_local4, + right = f45_local2 - f45_local4, + bottom = f45_local3 - f45_local4 + } ) + self.scalable:animateToState( "current" ) + end + + self:registerEventHandler( "update_hud_margins", f40_local1 ) + f40_local1() + self.static = LUI.UIElement.new() + self.static.id = "static" + self.static:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self.static:animateToState( "default" ) + self:addElement( self.static ) + self.playercard = self:addWidget( true, playercard() ) + self.largeMap = self:addWidget( false, large_map() ) + self.dpadHelper = self:addWidget( true, dpad_helper() ) + self.largeScoreboard = self:addWidget( false, large_scoreboard() ) + self.obituary = self:addWidget( false, obituary() ) + self.timersHud = self:addWidget( true, LUI.MenuBuilder.buildItems( { + type = "timersHudDef" + }, {}, self ) ) + self.buttonHelper = self:addWidget( true, LUI.MenuBuilder.buildItems( { + type = "button_helper_text_main", + properties = { + left_inset = 67, + spacing = 5 + }, + handlers = { + update_button_helpers = UpdateButtonHelpers + } + }, {}, self ) ) + UpdateButtonHelpers( self.buttonHelper ) + local f40_local2 = LUI.UIBindButton.new() + f40_local2:registerEventHandler( "gamepad_button", function ( element, event ) + if Engine.GetLuiInUse() or knownState.isKillCam then + return false + end + LUI.UIBindButton.GamepadButton( element, event ) + if event.down and (event.button == "page_up" or event.button == "page_down" or event.button == "ins" or event.button == "del") then + element:processEvent( { + name = event.button + } ) + end + end ) + f40_local2.id = "bind" + f40_local2:registerEventHandler( "button_up", PresetCameraHandlerFactory( 0 ) ) + f40_local2:registerEventHandler( "button_right", PresetCameraHandlerFactory( 1 ) ) + f40_local2:registerEventHandler( "button_down", PresetCameraHandlerFactory( 2 ) ) + f40_local2:registerEventHandler( "button_left", PresetCameraHandlerFactory( 3 ) ) + f40_local2:registerEventHandler( "button_secondary", ToggleOverlays ) + f40_local2:registerEventHandler( "button_shoulderl", function ( element, event ) + if event.qualifier == ButtonQualifiers.Gamepad then + FollowPrev( element, event ) + end + end ) + f40_local2:registerEventHandler( "button_shoulderr", function ( element, event ) + if event.qualifier == ButtonQualifiers.Gamepad then + FollowNext( element, event ) + end + end ) + f40_local2:registerEventHandler( "button_right_stick", function ( element, event ) + MLG.TogglePlayerOutlines() + end ) + f40_local2:registerEventHandler( "page_up", FollowPrev ) + f40_local2:registerEventHandler( "page_down", FollowNext ) + f40_local2:registerEventHandler( "button_left_trigger", CycleMapZoom ) + f40_local2:registerEventHandler( "button_right_trigger", CycleFocus ) + f40_local2:registerEventHandler( "button_alt2", function ( element, event ) + ChangeView( element, nil ) + end ) + f40_local2:registerEventHandler( "button_start", function ( element, event ) + if event.qualifier == ButtonQualifiers.Gamepad then + OpenPauseMenu( element, event ) + else + ToggleOverlays( element, event ) + end + end ) + f40_local2:registerEventHandler( "ins", function ( element, event ) + if focusMode == FocusModes.Cameras then + SetFocusMode( self, FocusModes.Scoreboard ) + end + self.hudContainer:processEvent( { + name = "gamepad_button", + button = "up", + down = true, + qualifier = "dpad" + } ) + end ) + f40_local2:registerEventHandler( "del", function ( element, event ) + if focusMode == FocusModes.Cameras then + SetFocusMode( self, FocusModes.Scoreboard ) + end + self.hudContainer:processEvent( { + name = "gamepad_button", + button = "down", + down = true, + qualifier = "dpad" + } ) + end ) + f40_local2:registerEventHandler( "scoreboard_player_action", FollowClientNum ) + f40_local2:registerEventHandler( "keybind", function ( element, event ) + if event.command == "togglescores" or event.command == "+scores" then + CycleScoreModes( element, event ) + end + end ) + f40_local2:registerEventHandler( "update_mlg_prev_next", function ( element, event ) + element.followRow = event.followRow + end ) + self:addElement( f40_local2 ) + local f40_local3 = LUI.UITimer.new( 60, { + name = "timer_update", + dispatchChildren = true + }, nil, false, element, false ) + f40_local3.id = "updateTimer" + self:addElement( f40_local3 ) + self:registerEventHandler( "timer_update", UpdateTimer ) + return self +end + +LUI.MenuBuilder.registerType( "mlg_hud", MLGHud ) +LockTable( _M ) diff --git a/lui/mp_hud/muteplayers.dec.lua b/lui/mp_hud/muteplayers.dec.lua new file mode 100644 index 0000000..01f7f91 --- /dev/null +++ b/lui/mp_hud/muteplayers.dec.lua @@ -0,0 +1,1080 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 32 +f0_local1 = function ( f1_arg0 ) + local f1_local0 + if f1_arg0 ~= Game.GetPlayerClientnum() then + f1_local0 = Game.CanChangePlayerMute( f1_arg0 ) + else + f1_local0 = false + end + return f1_local0 +end + +f0_local2 = function ( f2_arg0 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) + f2_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = "", + side = "left", + clickable = true + } ) + f2_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = "", + side = "left", + clickable = true + } ) + f2_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + clickable = true + } ) + if f2_local0.activeClientNum and f0_local1( f2_local0.activeClientNum ) and (Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1) then + f2_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = Engine.Localize( "XBOXLIVE_PLAYER_MUTE" ), + side = "left", + clickable = true + } ) + end + f2_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "LUA_MENU_UNMUTE_ALL" ), + side = "left", + clickable = true + } ) + f2_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "PATCH_MENU_MUTE_GROUPS" ), + side = "left", + clickable = true + } ) +end + +local f0_local3 = function ( f3_arg0, f3_arg1 ) + f3_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + f0_local2( f3_arg0 ) +end + +local f0_local4 = function ( f4_arg0, f4_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) +end + +local f0_local5 = function ( f5_arg0, f5_arg1 ) + Game.MuteAllPlayers() + LUI.FlowManager.RequestLeaveMenu( f5_arg0 ) +end + +local f0_local6 = function ( f6_arg0, f6_arg1 ) + Game.UnmuteAllPlayers() + Game.MuteAllPlayersButParty() + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) +end + +local f0_local7 = function ( f7_arg0, f7_arg1 ) + Game.UnmuteAllPlayers() + Game.MuteAllPlayersButFriends() + LUI.FlowManager.RequestLeaveMenu( f7_arg0 ) +end + +local f0_local8 = function ( f8_arg0, f8_arg1 ) + Game.UnmuteAllPlayers() + LUI.FlowManager.RequestLeaveMenu( f8_arg0 ) +end + +local f0_local9 = function ( f9_arg0, f9_arg1 ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 ) + if f9_local0.activeClientNum then + Game.TogglePlayerMute( f9_local0.activeClientNum ) + f9_arg0:dispatchEventToRoot( { + name = "refresh_mute_status" + } ) + f9_arg0:dispatchEventToAllOtherRoots( { + name = "refresh_mute_status" + } ) + else + Engine.PlaySound( CoD.SFX.DenySelect ) + end +end + +local f0_local10 = function ( f10_arg0, f10_arg1 ) + local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 ) + if f0_local1( f10_arg0.properties.clientNum ) then + f10_local0.activeClientNum = f10_arg0.properties.clientNum + else + f10_local0.activeClientNum = nil + end + f10_arg0:dispatchEventToRoot( { + name = "update_arrows", + firstItem = f10_arg0.properties.firstItem, + lastItem = f10_arg0.properties.lastItem + } ) + f10_arg0:dispatchEventToRoot( { + name = "update_mute_button_helpers" + } ) +end + +local f0_local11 = function ( f11_arg0, f11_arg1 ) + local f11_local0 = f11_arg0.properties + if f11_local0 then + f11_local0 = f11_arg0.properties.shouldHideArrowFunc + if f11_local0 then + f11_local0 = f11_arg0.properties:shouldHideArrowFunc( f11_arg1 ) + end + end + if f11_local0 then + if not f11_arg0.arrowHidden then + f11_arg0:animateToState( "default", 0 ) + f11_arg0.arrowHidden = true + end + elseif f11_arg0.arrowHidden then + local f11_local1 = MBh.AnimateLoop( { + { + "shifted", + 500, + true, + true + }, + { + "visible", + 500, + true, + true + } + } ) + f11_local1( f11_arg0, f11_arg1 ) + f11_arg0.arrowHidden = false + end +end + +local f0_local12 = function ( f12_arg0, f12_arg1 ) + local f12_local0 = f12_arg0.properties.clientNum + local f12_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + local f12_local2 + if f12_arg1.name == "button_up" or f12_local1.activeClientNum ~= f12_local0 and f12_arg1.name ~= "button_over" then + f12_local2 = false + else + f12_local2 = true + end + local f12_local3 + if f12_local2 then + f12_local3 = "_button_over" + if not f12_local3 then + + else + if f0_local1( f12_local0 ) then + f12_arg0:animateToState( (Game.IsPlayerMuted( f12_local0 ) and "muted" or "enabled") .. f12_local3, 0 ) + else + f12_arg0:animateToState( "default", 0 ) + end + end + end + f12_local3 = "_button_off" +end + +local f0_local13 = function ( menu, controller ) + local self = LUI.UIButton.new() + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + bottom = f0_local0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self.properties = controller + self:registerEventHandler( "button_over", f0_local10 ) + local f13_local1 = LUI.UIImage.new() + f13_local1:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + red = controller.isLight and 0.1 or 0.24, + green = controller.isLight and 0.1 or 0.24, + blue = controller.isLight and 0.1 or 0.24, + material = RegisterMaterial( "white" ) + } ) + f13_local1:registerAnimationState( "button_over", { + red = 0.75, + green = 0.75, + blue = 0.75 + } ) + f13_local1:animateToState( "default", 0 ) + f13_local1:registerEventHandler( "button_over", MBh.AnimateToState( "button_over", 0 ) ) + f13_local1:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + f13_local1:registerEventHandler( "button_action", f0_local9 ) + local f13_local2 = LUI.UIHorizontalList.new() + f13_local2:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + bottom = 32, + right = 0, + alpha = 1 + } ) + f13_local2:animateToState( "default", 0 ) + local f13_local3 = LUI.UIElement.new() + f13_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + width = 65, + alpha = 1 + } ) + f13_local3:animateToState( "default", 0 ) + local f13_local4 = LUI.UIImage.new() + f13_local4:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 5, + bottom = 0, + width = 32, + red = 1, + green = 1, + blue = 1, + material = controller.rankIcon or "" + } ) + f13_local4:animateToState( "default", 0 ) + f13_local4:registerEventHandler( "button_over", MBh.AnimateToState( "button_over", 0 ) ) + f13_local4:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + local f13_local5 = LUI.UIText.new() + f13_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 6, + left = 35, + height = CoD.TextSettings.NormalFont.Height, + width = 30, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alpha = 1, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) + f13_local5:registerAnimationState( "button_over", { + red = Colors.generic_button_text_focus_color.r, + green = Colors.generic_button_text_focus_color.g, + blue = Colors.generic_button_text_focus_color.b + } ) + f13_local5:setText( controller.rankNumber or 0 ) + f13_local5:animateToState( "default", 0 ) + f13_local5:registerEventHandler( "button_over", MBh.AnimateToState( "button_over", 0 ) ) + f13_local5:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + local f13_local6 = LUI.UIText.new() + local f13_local7 = controller.isPlayer and Colors.frontend_hilite or Colors.primary_text_color + f13_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 6, + left = 0, + height = CoD.TextSettings.NormalFont.Height, + width = 600, + red = f13_local7.r, + green = f13_local7.g, + blue = f13_local7.b, + alpha = 1, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + f13_local6:registerAnimationState( "button_over", { + red = Colors.generic_button_text_focus_color.r, + green = Colors.generic_button_text_focus_color.g, + blue = Colors.generic_button_text_focus_color.b + } ) + f13_local6:setText( controller.name or "" ) + f13_local6:animateToState( "default", 0 ) + f13_local6:registerEventHandler( "button_over", MBh.AnimateToState( "button_over", 0 ) ) + f13_local6:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + local f13_local8 = LUI.UIImage.new() + f13_local8.properties = f13_local8.properties or {} + f13_local8.properties.clientNum = controller.clientNum + f13_local8.properties.listIndex = controller.listIndex + f13_local8.properties.isPlayer = controller.isPlayer + f13_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 4, + left = 4, + width = 24, + height = 24, + red = 1, + green = 1, + blue = 1, + alpha = 0, + material = RegisterMaterial( "white" ) + } ) + f13_local8:registerAnimationState( "enabled_button_off", { + material = RegisterMaterial( "scoreboard_mic_talk_wht" ), + alpha = 1 + } ) + f13_local8:registerAnimationState( "muted_button_off", { + material = RegisterMaterial( "scoreboard_mic_mute_wht" ), + alpha = 1 + } ) + f13_local8:registerAnimationState( "enabled_button_over", { + material = RegisterMaterial( "scoreboard_mic_talk_blk" ), + alpha = 1 + } ) + f13_local8:registerAnimationState( "muted_button_over", { + material = RegisterMaterial( "scoreboard_mic_mute_blk" ), + alpha = 1 + } ) + f13_local8:animateToState( "default", 0 ) + f13_local8:registerEventHandler( "refresh_mute_status", f0_local12 ) + f13_local8:registerEventHandler( "button_over", f0_local12 ) + f13_local8:registerEventHandler( "button_up", f0_local12 ) + f13_local8:processEvent( { + name = "refresh_mute_status" + } ) + f13_local3:addElement( f13_local4 ) + f13_local3:addElement( f13_local5 ) + f13_local2:addElement( f13_local3 ) + f13_local2:addSpacer( 10 ) + f13_local2:addElement( f13_local6 ) + f13_local2:addSpacer( 10 ) + f13_local2:addElement( f13_local8 ) + self:addElement( f13_local1 ) + self:addElement( f13_local2 ) + return self +end + +function buildTeamLists() + local f14_local0 = {} + local f14_local1 = Engine.GetDvarInt( "party_maxplayers" ) + local f14_local2 = Game.GetPlayerClientnum() + local f14_local3 = Game.GetPlayerTeam() + local f14_local4 = assert + local f14_local5 + if f14_local3 ~= Teams.allies and f14_local3 ~= Teams.axis then + f14_local5 = false + else + f14_local5 = true + end + f14_local4( f14_local5 ) + for f14_local13, f14_local14 in ipairs( { + f14_local3, + otherTeamLookup[f14_local3] + } ) do + local f14_local15 = {} + for f14_local8 = 1, f14_local1, 1 do + f14_local15[f14_local8] = {} + f14_local15[f14_local8].isActive = false + end + for f14_local8 = 1, f14_local1, 1 do + local f14_local11 = Game.GetPlayerScoreInfoAtRank( f14_local14, f14_local8 ) + if f14_local11 then + local f14_local12 = f14_local15[f14_local11.client + 1] + f14_local12.isActive = true + f14_local12.scoreInfo = f14_local11 + f14_local12.isPlayer = f14_local11.client == f14_local2 + end + end + f14_local0[f14_local13] = f14_local15 + end + return f14_local0 +end + +function buildFFAList() + local f15_local0 = {} + local f15_local1 = { + f15_local0 + } + local f15_local2 = Engine.GetDvarInt( "party_maxplayers" ) + local f15_local3 = Game.GetPlayerClientnum() + for f15_local4 = 1, f15_local2, 1 do + f15_local0[f15_local4] = {} + f15_local0[f15_local4].isActive = false + end + for f15_local11, f15_local12 in pairs( { + Teams.free, + Teams.allies, + Teams.axis + } ) do + for f15_local10 = 1, f15_local2, 1 do + local f15_local8 = Game.GetPlayerScoreInfoAtRank( f15_local12, f15_local10 ) + if f15_local8 then + local f15_local9 = f15_local0[f15_local8.client + 1] + f15_local9.scoreInfo = f15_local8 + f15_local9.isActive = true + f15_local9.isPlayer = f15_local8.client == f15_local3 + end + end + end + return f15_local1 +end + +function buildPlayerLists() + local f16_local0 = Engine.GetDvarString( "ui_gametype" ) + if GameX.gameModeIsFFA( f16_local0 ) or f16_local0 == "horde" or f16_local0 == "infect" or Game.GetPlayerTeam() == Teams.spectator or Engine.IsAliensMode() then + return buildFFAList() + else + return buildTeamLists() + end +end + +function countListEntries() + local f17_local0 = 0 + local f17_local1 = buildPlayerLists() + for f17_local2 = 1, #f17_local1, 1 do + local f17_local5 = f17_local1[f17_local2] + for f17_local6 = 1, #f17_local5, 1 do + if f17_local5[f17_local6].isActive then + f17_local0 = f17_local0 + 1 + end + end + end + if #f17_local1 > 1 then + f17_local0 = f17_local0 + #f17_local1 - 1 + end + return f17_local0 +end + +function buildListRow( f18_arg0, f18_arg1, f18_arg2, f18_arg3, f18_arg4, f18_arg5 ) + local f18_local0 = f18_arg3.rankIcon + if not Engine.IsAliensMode() and f18_arg3.rank and f18_arg3.prestige and f18_arg3.prestige > 0 then + f18_local0 = RegisterMaterial( Rank.GetRankIcon( f18_arg3.rank, f18_arg3.prestige ) ) + end + return { + type = "mute_players_button", + id = "mute_player_button_" .. f18_arg2, + properties = { + isLight = f18_arg4, + name = f18_arg3.name, + rankNumber = Rank.GetRankDisplay( f18_arg3.rank ), + rankIcon = f18_local0, + clientNum = f18_arg3.client, + listIndex = f18_arg2, + firstItem = f18_arg2 == 1, + isPlayer = f18_arg5 + } + } +end + +function mutePlayersListFeeder( f19_arg0 ) + local f19_local0 = buildPlayerLists() + local f19_local1 = assert + local f19_local2 + if #f19_local0 <= 0 or #f19_local0 >= 3 then + f19_local2 = false + else + f19_local2 = true + end + f19_local1( f19_local2 ) + f19_local1 = {} + f19_local2 = true + local f19_local3 = f19_local0[1] + for f19_local4 = 1, #f19_local3, 1 do + local f19_local7 = f19_local3[f19_local4] + if f19_local7.isActive then + f19_local1[#f19_local1 + 1] = buildListRow( f19_arg0, scoped, #f19_local1 + 1, f19_local7.scoreInfo, not f19_local2, f19_local7.isPlayer ) + end + end + f19_local3 = f19_local0[2] + if f19_local3 then + f19_local2 = not f19_local2 + local f19_local4 = #f19_local1 + 1 + local f19_local5 = { + type = "UIImage", + id = "mute_players_enemy_banner" + } + local f19_local6 = {} + local f19_local8 = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + bottom = 32, + right = 0 + } + local f19_local7 + if f19_local2 then + f19_local7 = 0.1 + if not f19_local7 then + + else + f19_local8.red = f19_local7 + if f19_local2 then + f19_local7 = 0.1 + if not f19_local7 then + + else + f19_local8.green = f19_local7 + if f19_local2 then + f19_local7 = 0.1 + if not f19_local7 then + + else + f19_local8.blue = f19_local7 + f19_local8.material = RegisterMaterial( "white" ) + f19_local6.default = f19_local8 + f19_local5.states = f19_local6 + f19_local5.children = { + { + type = "UIText", + id = "mute_players_enemy_banner_text", + properties = { + text = Engine.Localize( "LUA_MENU_OPPOSING_TEAM_CAPS" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 6, + left = 0, + height = CoD.TextSettings.NormalFont.Height, + right = -10, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right + } + } + } + } + f19_local1[f19_local4] = f19_local5 + for f19_local4 = 1, #f19_local3, 1 do + f19_local7 = f19_local3[f19_local4] + if f19_local7.isActive then + f19_local1[#f19_local1 + 1] = buildListRow( f19_arg0, scoped, #f19_local1 + 1, f19_local7.scoreInfo, not f19_local2, f19_local7.isPlayer ) + end + end + end + end + f19_local7 = 0.24 + end + end + f19_local7 = 0.24 + end + end + f19_local7 = 0.24 + end + if #f19_local1 > 0 and f19_local1[#f19_local1].properties then + f19_local1[#f19_local1].properties.lastItem = true + end + return f19_local1 +end + +function ListElementsFeeder( f20_arg0, f20_arg1 ) + local f20_local0 = 24 + local f20_local1 = 48 + local f20_local2 = {} + if f20_arg0.useCompactWindow then + f20_local2[#f20_local2 + 1] = { + type = "UIImage", + id = "mute_options_popup_up_arrow_id", + properties = { + shouldHideArrowFunc = function ( f21_arg0, f21_arg1 ) + return f21_arg1.firstItem + end + }, + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + height = f20_local0, + width = f20_local1, + material = RegisterMaterial( "widg_margin_arrow_top" ), + alpha = 0 + }, + visible = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + height = f20_local0, + width = f20_local1, + material = RegisterMaterial( "widg_margin_arrow_top" ), + alpha = 1 + }, + shifted = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -5, + height = f20_local0, + width = f20_local1, + material = RegisterMaterial( "widg_margin_arrow_top" ), + alpha = 1 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "shifted", + 500, + true, + true + }, + { + "visible", + 500, + true, + true + } + } ), + update_arrows = f0_local11 + } + } + end + local f20_local3 = #f20_local2 + 1 + local f20_local4 = { + type = "UIStencil", + id = "mute_options_popup_content_stencil_id" + } + local f20_local5 = {} + local f20_local6 = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true + } + if f20_arg0.useCompactWindow then + local f20_local7 = f20_local0 + end + f20_local6.top = f20_local7 or 0 + f20_local6.bottom = f20_arg0.useCompactWindow and -f20_local0 or 0 + f20_local6.left = 0 + f20_local6.right = 0 + f20_local5.default = f20_local6 + f20_local4.states = f20_local5 + f20_local4.children = { + { + type = "UIVerticalList", + id = "mute_options_popup_content_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + childrenFeeder = mutePlayersListFeeder + } + } + f20_local2[f20_local3] = f20_local4 + if f20_arg0.useCompactWindow then + f20_local2[#f20_local2 + 1] = { + type = "UIImage", + id = "mute_options_popup_down_arrow_id", + properties = { + shouldHideArrowFunc = function ( f22_arg0, f22_arg1 ) + return f22_arg1.lastItem + end + }, + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + top = -f20_local0, + height = f20_local0, + width = f20_local1, + material = RegisterMaterial( "widg_margin_arrow_bot" ), + alpha = 0 + }, + visible = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + top = -f20_local0, + height = f20_local0, + width = f20_local1, + material = RegisterMaterial( "widg_margin_arrow_bot" ), + alpha = 1 + }, + shifted = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + top = -f20_local0 + 5, + height = f20_local0, + width = f20_local1, + material = RegisterMaterial( "widg_margin_arrow_bot" ), + alpha = 1 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "shifted", + 500, + true, + true + }, + { + "visible", + 500, + true, + true + } + } ), + update_arrows = f0_local11 + } + } + end + return f20_local2 +end + +function popup_mute_players() + local f23_local0 = 760 + local f23_local1 = 90 + local f23_local2 = 0 + local f23_local3 = GameX.IsSplitscreen() and 250 or 600 + local f23_local4 = f0_local0 * countListEntries() + local f23_local5 = f23_local3 < f23_local4 + f23_local4 = math.min( f23_local4, f23_local3 ) + local f23_local6 = f23_local4 + f23_local1 + return { + type = "UIElement", + id = "mute_options_popup_container_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = f0_local3, + update_mute_button_helpers = f0_local2 + }, + children = { + { + type = "UIImage", + id = "mute_options_popup_overlay_id", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIImage", + id = "black_bar_1", + states = { + default = { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false, + left = 0, + bottom = 0, + right = 0, + height = 300, + red = 0, + green = 0, + blue = 0, + alpha = 1, + material = RegisterMaterial( "white" ) + } + } + }, + { + type = "UIImage", + id = "black_bar_2", + states = { + default = { + leftAnchor = true, + topAnchor = false, + rightAnchor = true, + bottomAnchor = true, + left = 0, + top = 0, + right = 0, + height = 300, + red = 0, + green = 0, + blue = 0, + alpha = 1, + material = RegisterMaterial( "white" ) + } + } + }, + { + type = "UIWorldBlur", + id = "optionsWorldBlurOverlay", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIElement", + id = "mute_options_popup_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + bottom = f23_local6 / 2 - f23_local2, + top = -(f23_local6 / 2 + f23_local2), + width = f23_local0 + } + }, + children = { + { + type = "generic_drop_shadow", + id = "mute_options_popup_dropshadow_id", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + id = "mute_options_popup_titlebar_id", + properties = { + title_bar_text = Engine.Localize( "LUA_MENU_MUTE_PLAYERS_CAPS" ), + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + id = "mute_options_background_id", + properties = { + fill_alpha = 1 + }, + children = { + { + type = "UIElement", + id = "mute_options_popup_content_container_id", + properties = { + useCompactWindow = f23_local5 + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 5, + height = f23_local4, + left = 5, + right = -5 + } + }, + childrenFeeder = ListElementsFeeder + }, + { + type = "button_helper_text_main", + id = "mute_players_button_helpers", + states = { + default = { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = -50, + bottom = 0, + left = 5, + right = -5, + alpha = 1 + } + }, + properties = { + height = 40, + spacing = 0, + right_inset = 0, + left_inset = 0, + background_alpha = 0, + bottom_margin = 0, + top_margin = -40 + } + } + } + } + } + }, + { + type = "UIBindButton", + handlers = { + button_secondary = function ( f24_arg0, f24_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f24_arg0 ) + end + , + button_alt1 = function ( f25_arg0, f25_arg1 ) + Game.UnmuteAllPlayers() + f25_arg0:dispatchEventToRoot( { + name = "refresh_mute_status" + } ) + end + , + button_alt2 = function ( f26_arg0, f26_arg1 ) + LUI.FlowManager.RequestAddMenu( f26_arg0, "popup_mute_groups", true, f26_arg1.controller ) + end + + } + } + } + } +end + +function muteGroupsListFeeder( f27_arg0, f27_arg1 ) + local f27_local0 = {} + local f27_local1 = { + type = "UIGenericButton", + id = "mute_all_button_id" + } + local f27_local2 = { + style = GenericButtonSettings.Styles.GlassButton, + text = Engine.Localize( "@LUA_MENU_MUTE_ALL" ), + button_action_func = f0_local5 + } + local f27_local3 = Game.GetMuteStrategy() + local f27_local4 = CoD.MuteStrategies.MuteStrategyMuteAll + f27_local2.text_default_color = REG10 and Colors.yellow or Colors.generic_button_text_default_color + f27_local1.properties = f27_local2 + f27_local2 = { + type = "UIGenericButton", + id = "mute_all_but_friends_id" + } + f27_local3 = { + style = GenericButtonSettings.Styles.GlassButton, + text = Engine.Localize( "@LUA_MENU_MUTE_ALL_BUT_FRIENDS" ), + button_action_func = f0_local7 + } + f27_local4 = Game.GetMuteStrategy() + local f27_local5 = CoD.MuteStrategies.MuteStrategyMuteAllButFriends + f27_local3.text_default_color = REG13 and Colors.yellow or Colors.generic_button_text_default_color + f27_local2.properties = f27_local3 + f27_local3 = { + type = "UIGenericButton", + id = "mute_all_but_party_id" + } + f27_local4 = { + style = GenericButtonSettings.Styles.GlassButton, + text = Engine.Localize( "@MENU_MUTE_ALL_BUT_PARTY" ), + button_action_func = f0_local6 + } + f27_local5 = Game.GetMuteStrategy() + local f27_local6 = CoD.MuteStrategies.MuteStrategyMuteAllButParty + f27_local4.text_default_color = REG16 and Colors.yellow or Colors.generic_button_text_default_color + f27_local3.properties = f27_local4 + f27_local4 = { + type = "UIGenericButton", + id = "unmute_all_button_id", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + text = Engine.Localize( "@LUA_MENU_TURN_OFF_MUTE" ), + button_action_func = f0_local8 + } + } + f27_local0[1] = f27_local1 + f27_local0[2] = f27_local2 + f27_local0[3] = f27_local3 + f27_local0[4] = f27_local4 + return f27_local0 +end + +function popup_mute_groups() + local self = LUI.UIElement.new() + self.id = "mute_options_popup_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "generic_selectionList_popup", + id = "mute_options_list_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_MUTE_PLAYERS_CAPS" ), + padding_top = 10, + default_focus_index = 1, + popup_childfeeder = muteGroupsListFeeder, + popup_width = 400, + popup_stop_background_fade_in = true + } + } ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIWorldBlur", + id = "optionsWorldBlurOverlay", + states = { + default = { + worldBlur = 5 + } + } + } ) + return self +end + +LUI.MenuBuilder.registerDef( "popup_mute_players", popup_mute_players ) +LUI.MenuBuilder.registerType( "mute_players_button", f0_local13 ) +LUI.MenuBuilder.registerType( "popup_mute_groups", popup_mute_groups ) +LockTable( _M ) diff --git a/lui/mp_hud/obituaryhud.dec.lua b/lui/mp_hud/obituaryhud.dec.lua new file mode 100644 index 0000000..3ad247a --- /dev/null +++ b/lui/mp_hud/obituaryhud.dec.lua @@ -0,0 +1,522 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 0 +f0_local1 = function ( f1_arg0 ) + local self = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = -20, + height = 0, + width = 512, + alpha = 0, + alignment = LUI.Alignment.Right, + spacing = 0 + } ) + self.id = "obitItemElemId" + self:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = -20, + height = CoD.TextSettings.HudEuroMedSmallFont.Height + 10, + width = 512, + alpha = 1 + } ) + self:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = -20, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 512, + alpha = 0.5 + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "menu_create", MBh.AnimateSequenceAndClose( { + { + "default", + 0 + }, + { + "opening", + 75 + }, + { + "active", + 75 + }, + { + "active", + 5000 + }, + { + "default", + 250 + } + } ) ) + self:registerEventHandler( "menu_close", MBh.AnimateSequenceAndClose( { + { + "active", + 0 + }, + { + "default", + 250 + } + } ) ) + return self +end + +f0_local2 = function ( f2_arg0 ) + local self = LUI.UIHorizontalList.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alignment = LUI.Alignment.Right, + spacing = 0 + } ) + self.id = "obitItemHLId" + self:animateToState( "default", 0 ) + return self +end + +local f0_local3 = function ( f3_arg0 ) + local f3_local0 = Game.GetPlayerName( f3_arg0.victim ) + local self = LUI.UIText.new( { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + right = 0, + width = 200, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + self.id = "obitVictimTextId" + self:setText( f3_local0 ) + self:setTextStyle( CoD.TextStyle.Shadowed ) + self:animateToState( "default", 0 ) + local f3_local2, f3_local3, f3_local4, f3_local5 = GetTextDimensions( f3_local0, CoD.TextSettings.HudEuroMedSmallFont.Font, CoD.TextSettings.HudEuroMedSmallFont.Height ) + local f3_local6 = f3_local4 - f3_local2 + self:registerAnimationState( "me", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + right = 0, + width = f3_local6, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + self:registerAnimationState( "friendly", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + right = 0, + width = f3_local6, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + self:registerAnimationState( "enemy", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + right = 0, + width = f3_local6, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b + } ) + local f3_local7 = Game.GetPlayerTeam() + if MLG.IsMLGSpectator() then + f3_local7 = Game.GetLastMLGSpectateTeam() + elseif f3_local7 == Teams.spectator then + f3_local7 = Game.GetPlayerTeam( Game.GetPlayerstateClientnum() ) + end + if Game.GetPlayerTeam( f3_arg0.victim ) == f3_local7 then + if Game.GetPlayerClientnum() == f3_arg0.victim then + self:animateToState( "me", 0 ) + elseif GameX.gameModeIsFFA() then + self:animateToState( "enemy", 0 ) + else + self:animateToState( "friendly", 0 ) + end + else + self:animateToState( "enemy", 0 ) + end + return self +end + +local f0_local4 = function ( f4_arg0 ) + local f4_local0 = Game.GetPlayerName( f4_arg0.attacker ) + local self = LUI.UIText.new( { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + right = 0, + width = 200, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + self.id = "obitAttackerTextId" + self:setText( f4_local0 ) + self:setTextStyle( CoD.TextStyle.Shadowed ) + self:animateToState( "default", 0 ) + local f4_local2, f4_local3, f4_local4, f4_local5 = GetTextDimensions( f4_local0, CoD.TextSettings.HudEuroMedSmallFont.Font, CoD.TextSettings.HudEuroMedSmallFont.Height ) + local f4_local6 = f4_local4 - f4_local2 + self:registerAnimationState( "friendly", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + right = 0, + width = f4_local6, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + self:registerAnimationState( "enemy", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + right = 0, + width = f4_local6, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b + } ) + local f4_local7 = Game.GetPlayerTeam() + if MLG.IsMLGSpectator() then + f4_local7 = Game.GetLastMLGSpectateTeam() + elseif f4_local7 == Teams.spectator then + f4_local7 = Game.GetPlayerTeam( Game.GetPlayerstateClientnum() ) + end + if Game.GetPlayerTeam( f4_arg0.attacker ) == f4_local7 then + if Game.GetPlayerClientnum() == f4_arg0.attacker then + self:animateToState( "default", 0 ) + elseif GameX.gameModeIsFFA() then + self:animateToState( "enemy", 0 ) + else + self:animateToState( "friendly", 0 ) + end + else + self:animateToState( "enemy", 0 ) + end + return self +end + +local f0_local5 = function ( menu, controller ) + local self = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + width = 5 + } ) + self.id = "obitSpacer" .. controller + self:animateToState( "default", 0 ) + return self +end + +local f0_local6 = function ( f6_arg0 ) + local f6_local0 = CoD.TextSettings.HudEuroBigFont.Height * Engine.GetMaterialAspectRatio( f6_arg0.icon ) + local self = LUI.UIImage.new( { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = -CoD.TextSettings.HudEuroBigFont.Height / 2, + bottom = CoD.TextSettings.HudEuroBigFont.Height / 2, + right = 0, + width = f6_local0, + material = f6_arg0.icon + } ) + self.id = "obitWeaponImageId" + if f6_arg0.flip then + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = -CoD.TextSettings.HudEuroBigFont.Height / 2, + bottom = CoD.TextSettings.HudEuroBigFont.Height / 2, + right = 0, + width = -f6_local0, + material = f6_arg0.icon + } ) + end + self:animateToState( "default", 0 ) + return self +end + +local f0_local7 = function ( f7_arg0 ) + local self = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + height = 0, + width = 512, + alpha = 0, + alignment = LUI.Alignment.Right, + spacing = 0 + } ) + self.id = "connectTextElemId" + self:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height + 10, + width = 512, + alpha = 1 + } ) + self:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 512, + alpha = 0.5 + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "menu_create", MBh.AnimateSequenceAndClose( { + { + "default", + 0 + }, + { + "opening", + 75 + }, + { + "active", + 75 + }, + { + "active", + 5000 + }, + { + "default", + 250 + } + } ) ) + self:registerEventHandler( "menu_close", MBh.AnimateSequenceAndClose( { + { + "active", + 0 + }, + { + "default", + 250 + } + } ) ) + local f7_local1 = LUI.UIText.new( { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + right = -20, + width = 512, + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + f7_local1.id = "connectTextId" + f7_local1:setText( f7_arg0.message ) + f7_local1:setTextStyle( CoD.TextStyle.Shadowed ) + self:addElement( f7_local1 ) + return self +end + +local f0_local8 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = nil + if f8_arg1.name == "obituary" then + local f8_local1 + if f8_arg1.attacker == nil or f8_arg1.attacker == f8_arg1.victim then + f8_local1 = false + else + f8_local1 = true + end + local f8_local2 = "" + if f8_local1 then + f8_local2 = Game.GetPlayerName( f8_arg1.attacker ) + end + local f8_local3 = Game.GetPlayerName( f8_arg1.victim ) + f8_local0 = f0_local1( f8_arg1 ) + local f8_local4 = f0_local2( f8_arg1 ) + f8_local0:addElement( f8_local4 ) + f8_local4:addElement( f0_local3( f8_arg1 ) ) + f8_local4:addElement( f0_local5( f8_arg1, 1 ) ) + f8_local4:addElement( f0_local6( f8_arg1 ) ) + f8_local4:addElement( f0_local5( f8_arg1, 2 ) ) + if f8_local1 then + f8_local4:addElement( f0_local4( f8_arg1 ) ) + end + elseif f8_arg1.bold ~= nil and f8_arg1.bold == false and f8_arg1.message ~= nil then + f8_local0 = f0_local7( f8_arg1 ) + end + if f8_local0 ~= nil then + f8_local0:processEvent( { + name = "menu_create" + } ) + f8_local0.id = "obitElemId" .. f0_local0 + f0_local0 = f0_local0 + 1 + local f8_local1 = f8_arg0:getFirstChild() + if f8_local1 then + LUI.UIElement.addElementBefore( f8_local0, f8_local1 ) + else + LUI.UIElement.addElement( f8_arg0, f8_local0 ) + end + end + local f8_local1 = f8_arg0:getNumChildren() + local f8_local2 = f8_arg0:getLastChild() + if f8_local2 and f8_local1 > 4 then + f8_local2:processEvent( { + name = "menu_close" + } ) + f8_local1 = f8_local1 - 1 + while f8_local1 > 4 do + local f8_local3 = f8_local2:getPreviousSibling() + if f8_local3 then + f8_local3:processEvent( { + name = "menu_close" + } ) + end + f8_local1 = f8_local1 - 1 + end + end +end + +function obituaryHudDef() + local self = LUI.UIElement.new() + self.id = "obituaryHudId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 60, + right = 0, + height = 256, + width = 256, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "inactive", { + alpha = 0 + } ) + local f9_local1 = LUI.UIVerticalList.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + spacing = 3, + alignment = MLG.IsMLGSpectator() and LUI.Alignment.Bottom or nil + } ) + f9_local1.id = "obituaryVLId" + f9_local1:registerAnimationState( "showrival", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 15, + left = 0, + bottom = 0, + right = 0, + spacing = 3 + } ) + f9_local1:animateToState( "default", 0 ) + f9_local1:registerEventHandler( "obituary", f0_local8 ) + f9_local1:registerEventHandler( "game_message", f0_local8 ) + f9_local1:registerEventHandler( "open_rival_info", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "showrival", + 62.5 + } + } ) ) + f9_local1:registerEventHandler( "close_rival_info", MBh.AnimateSequence( { + { + "showrival", + 0 + }, + { + "showrival", + 187.5 + }, + { + "default", + 62.5 + } + } ) ) + self:addElement( f9_local1 ) + return self +end + +LUI.MenuBuilder.registerType( "obituaryHudDef", obituaryHudDef ) +LockTable( _M ) diff --git a/lui/mp_hud/odinoverlayhud.dec.lua b/lui/mp_hud/odinoverlayhud.dec.lua new file mode 100644 index 0000000..0c62735 --- /dev/null +++ b/lui/mp_hud/odinoverlayhud.dec.lua @@ -0,0 +1,807 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 512 +f0_local1 = 512 +f0_local2 = 1 +local f0_local3 = 2 +local f0_local4 = -1 +local f0_local5 = -2 +local f0_local6 = -2 +local f0_local7 = -3 +local f0_local8 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = "@KILLSTREAKS_ODIN_SUPPORT" + local f1_local1 = "@KILLSTREAKS_ODIN_ASSAULT" + local f1_local2 = "@PLATFORM_ODIN_SMOKE" + local f1_local3 = "@PLATFORM_ODIN_AIRDROP" + local f1_local4 = "@PLATFORM_ODIN_MARKING" + local f1_local5 = "@PLATFORM_ODIN_JUGGERNAUT" + local f1_local6 = "@PLATFORM_ODIN_LARGE_ROD" + local f1_local7 = "@PLATFORM_ODIN_SMALL_ROD" + local f1_local8 = "@LUA_MENU_RECHARGING" + if f1_arg1.value == f0_local2 or f1_arg1.value == f0_local3 then + f1_arg0:animateToState( "active", 0 ) + if f1_arg1.value == f0_local2 then + local f1_local9 = f1_arg0:getChildById( "odin_text_bits" ) + f1_local9 = f1_local9:getChildById( "name_text" ) + f1_local9:setText( Engine.Localize( f1_local0 ) ) + elseif f1_arg1.value == f0_local3 then + local f1_local9 = f1_arg0:getChildById( "odin_text_bits" ) + f1_local9 = f1_local9:getChildById( "name_text" ) + f1_local9:setText( Engine.Localize( f1_local1 ) ) + end + local f1_local9 = f1_arg0:getChildById( "odinControlsLeftId" ) + local f1_local10 = f1_local9:getChildById( "odinControlsLeftVLId" ) + local f1_local11 = f1_arg0:getChildById( "odinControlsRightId" ) + local f1_local12 = f1_local11:getChildById( "odinControlsRightVLId" ) + local f1_local13 = f1_local10:getChildById( "smokeTextId" ) + local f1_local14 = f1_local10:getChildById( "airdropTextId" ) + local f1_local15 = f1_local12:getChildById( "markingTextId" ) + local f1_local16 = f1_local12:getChildById( "juggernautTextId" ) + local f1_local17 = Game.GetOmnvar( "ui_odin_smoke_ammo" ) + local f1_local18 = Game.GetOmnvar( "ui_odin_airdrop_ammo" ) + local f1_local19 = Game.GetOmnvar( "ui_odin_marking_ammo" ) + local f1_local20 = Game.GetOmnvar( "ui_odin_juggernaut_ammo" ) + if f1_arg1.value == f0_local2 then + f1_local13:setText( Engine.Localize( f1_local2 ) ) + f1_local13.current_state = "smoke" + f1_local14:setText( Engine.Localize( f1_local3 ) ) + f1_local14.current_state = "airdrop" + f1_local15:setText( Engine.Localize( f1_local4 ) ) + f1_local15.current_state = "marking" + f1_local16:setText( Engine.Localize( f1_local5 ) ) + f1_local16.current_state = "juggernaut" + if f1_arg1.name == "init_overlay" then + if f1_local17 == f0_local4 then + f1_local13:setText( Engine.Localize( f1_local8 ) ) + f1_local13:processEvent( { + name = "flashing" + } ) + f1_local13.current_state = "recharging" + end + if f1_local18 == f0_local4 then + f1_local14:setText( Engine.Localize( f1_local8 ) ) + f1_local14:processEvent( { + name = "flashing" + } ) + f1_local14.current_state = "recharging" + end + if f1_local19 == f0_local4 then + f1_local15:setText( Engine.Localize( f1_local8 ) ) + f1_local15:processEvent( { + name = "flashing" + } ) + f1_local15.current_state = "recharging" + end + if f1_local20 == f0_local4 then + f1_local16:setText( Engine.Localize( f1_local8 ) ) + f1_local16:processEvent( { + name = "flashing" + } ) + f1_local16.current_state = "recharging" + end + end + elseif f1_arg1.value == f0_local3 then + f1_local13:setText( Engine.Localize( f1_local7 ) ) + f1_local13.current_state = "small_rod" + f1_local14:setText( Engine.Localize( f1_local3 ) ) + f1_local14.current_state = "airdrop" + f1_local15:setText( Engine.Localize( f1_local6 ) ) + f1_local15.current_state = "large_rod" + f1_local16:setText( Engine.Localize( f1_local5 ) ) + f1_local16.current_state = "juggernaut" + if f1_arg1.name == "init_overlay" then + if f1_local17 == f0_local5 then + f1_local13:setText( Engine.Localize( f1_local8 ) ) + f1_local13:processEvent( { + name = "flashing" + } ) + f1_local13.current_state = "recharging" + end + if f1_local18 == f0_local4 then + f1_local14:setText( Engine.Localize( f1_local8 ) ) + f1_local14:processEvent( { + name = "flashing" + } ) + f1_local14.current_state = "recharging" + end + if f1_local19 == f0_local5 then + f1_local15:setText( Engine.Localize( f1_local8 ) ) + f1_local15:processEvent( { + name = "flashing" + } ) + f1_local15.current_state = "recharging" + end + if f1_local20 == f0_local4 then + f1_local16:setText( Engine.Localize( f1_local8 ) ) + f1_local16:processEvent( { + name = "flashing" + } ) + f1_local16.current_state = "recharging" + end + end + end + local f1_local21 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 150 + } + } ) + f1_local21( f1_local9 ) + f1_local21 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 150 + } + } ) + f1_local21( f1_local11 ) + f1_local21 = f1_arg0:getChildById( "odinOverlayGrainId" ) + local f1_local22 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 1000 + } + } ) + f1_local22( f1_local21 ) + else + f1_arg0:animateToState( "default", 0 ) + end +end + +local f0_local9 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = "@PLATFORM_ODIN_SMOKE" + local f2_local1 = "@PLATFORM_ODIN_SMALL_ROD" + local f2_local2 = "@LUA_MENU_RECHARGING" + local f2_local3 = f2_arg0:getChildById( "odinControlsLeftId" ) + local f2_local4 = f2_local3:getChildById( "odinControlsLeftVLId" ) + local f2_local5 = f2_local4:getChildById( "smokeTextId" ) + if f2_arg1.value == f0_local2 then + f2_local5:setText( Engine.Localize( f2_local0 ) ) + f2_local5:processEvent( { + name = "stop_flashing" + } ) + f2_local5.current_state = "smoke" + elseif f2_arg1.value == f0_local3 then + f2_local5:setText( Engine.Localize( f2_local1 ) ) + f2_local5:processEvent( { + name = "stop_flashing" + } ) + f2_local5.current_state = "small_rod" + else + f2_local5:setText( Engine.Localize( f2_local2 ) ) + f2_local5:processEvent( { + name = "flashing" + } ) + if f2_arg1.value == f0_local5 then + local f2_local6 = f2_arg0:getChildById( "odinOverlayGrainId" ) + local f2_local7 = MBh.AnimateSequence( { + { + "fired", + 0 + }, + { + "active", + 250 + } + } ) + f2_local7( f2_local6 ) + end + f2_local5.current_state = "recharging" + end +end + +local f0_local10 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = "@PLATFORM_ODIN_AIRDROP" + local f3_local1 = "@LUA_MENU_RECHARGING" + local f3_local2 = f3_arg0:getChildById( "odinControlsLeftId" ) + local f3_local3 = f3_local2:getChildById( "odinControlsLeftVLId" ) + local f3_local4 = f3_local3:getChildById( "airdropTextId" ) + if f3_arg1.value == f0_local2 or f3_arg1.value == f0_local3 then + f3_local4:setText( Engine.Localize( f3_local0 ) ) + f3_local4:processEvent( { + name = "stop_flashing" + } ) + f3_local4.current_state = "airdrop" + else + f3_local4:setText( Engine.Localize( f3_local1 ) ) + f3_local4:processEvent( { + name = "flashing" + } ) + f3_local4.current_state = "recharging" + end +end + +local f0_local11 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = "@PLATFORM_ODIN_MARKING" + local f4_local1 = "@PLATFORM_ODIN_LARGE_ROD" + local f4_local2 = "@LUA_MENU_RECHARGING" + local f4_local3 = f4_arg0:getChildById( "odinControlsRightId" ) + local f4_local4 = f4_local3:getChildById( "odinControlsRightVLId" ) + local f4_local5 = f4_local4:getChildById( "markingTextId" ) + if f4_arg1.value == f0_local2 then + f4_local5:setText( Engine.Localize( f4_local0 ) ) + f4_local5:processEvent( { + name = "stop_flashing" + } ) + f4_local5.current_state = "marking" + elseif f4_arg1.value == f0_local3 then + f4_local5:setText( Engine.Localize( f4_local1 ) ) + f4_local5:processEvent( { + name = "stop_flashing" + } ) + f4_local5.current_state = "large_rod" + else + f4_local5:setText( Engine.Localize( f4_local2 ) ) + f4_local5:processEvent( { + name = "flashing" + } ) + if f4_arg1.value == f0_local5 then + local f4_local6 = f4_arg0:getChildById( "odinOverlayGrainId" ) + local f4_local7 = MBh.AnimateSequence( { + { + "fired", + 0 + }, + { + "active", + 250 + } + } ) + f4_local7( f4_local6 ) + end + f4_local5.current_state = "recharging" + end +end + +local f0_local12 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = "@PLATFORM_ODIN_JUGGERNAUT" + local f5_local1 = "@PLATFORM_ODIN_JUGGERNAUT_MOVE" + local f5_local2 = "@LUA_MENU_ODIN_JUGGERNAUT_DEAD" + local f5_local3 = "@LUA_MENU_RECHARGING" + local f5_local4 = f5_arg0:getChildById( "odinControlsRightId" ) + local f5_local5 = f5_local4:getChildById( "odinControlsRightVLId" ) + local f5_local6 = f5_local5:getChildById( "juggernautTextId" ) + if f5_arg1.value == f0_local6 then + f5_local6:setText( Engine.Localize( f5_local1 ) ) + f5_local6:processEvent( { + name = "stop_flashing" + } ) + f5_local6.current_state = "move" + elseif f5_arg1.value == f0_local7 then + f5_local6:setText( Engine.Localize( f5_local2 ) ) + f5_local6:processEvent( { + name = "stop_flashing" + } ) + f5_local6.current_state = "dead" + elseif f5_arg1.value == f0_local2 or f5_arg1.value == f0_local3 then + f5_local6:setText( Engine.Localize( f5_local0 ) ) + f5_local6:processEvent( { + name = "stop_flashing" + } ) + f5_local6.current_state = "juggernaut" + else + f5_local6:setText( Engine.Localize( f5_local3 ) ) + f5_local6:processEvent( { + name = "flashing" + } ) + f5_local6.current_state = "recharging" + end +end + +local f0_local13 = function ( f6_arg0, f6_arg1 ) + local f6_local0 = 364.77 + local f6_local1 = 397.52 + if not f6_arg0.current_alt_dir then + f6_arg0.current_alt_dir = 0.01 + end + if not f6_arg0.current_alt then + f6_arg0.current_alt = math.random( f6_local0, f6_local1 ) + end + if f6_arg0.current_alt < f6_local1 then + f6_arg0.current_alt_dir = math.random( 1, 100 ) * 0.01 + else + f6_arg0.current_alt_dir = -math.random( 1, 100 ) * 0.01 + end + f6_arg0.current_alt = f6_arg0.current_alt + f6_arg0.current_alt_dir + local f6_local2 = f6_arg0:getChildById( "altitude_text" ) + f6_local2:setText( string.format( "%.2f", f6_arg0.current_alt ) ) +end + +local f0_local14 = function ( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0:getChildById( "position_text" ) + f7_local0:setText( "61911." .. Game.GetTime() ) +end + +local f0_local15 = function () + local f8_local0 = "@PLATFORM_ODIN_AIRDROP" + local f8_local1 = "@PLATFORM_ODIN_SMOKE" + local self = LUI.UIElement.new() + self.id = "odinControlsLeftId" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + left = -750, + top = -32, + bottom = 32, + width = 512, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + local f8_local3 = LUI.UIVerticalList.new() + f8_local3.id = "odinControlsLeftVLId" + f8_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + spacing = 20 + } ) + f8_local3:animateToState( "default", 0 ) + local f8_local4 = LUI.UIText.new() + f8_local4.id = "airdropTextId" + f8_local4:setText( f8_local0 ) + f8_local4:setTextStyle( CoD.TextStyle.Shadowed ) + f8_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + left = 0, + right = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 1, + green = 1, + blue = 1, + alignment = LUI.Alignment.Right, + alpha = 1 + } ) + f8_local4:animateToState( "default", 0 ) + f8_local4:registerAnimationState( "flash1", { + red = 1, + green = 0, + blue = 0, + alpha = 0.5 + } ) + f8_local4:registerAnimationState( "flash2", { + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + } ) + f8_local4:registerEventHandler( "flashing", MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) ) + f8_local4:registerEventHandler( "stop_flashing", MBh.AnimateToState( "default", 0 ) ) + local f8_local5 = LUI.UIText.new() + f8_local5.id = "smokeTextId" + f8_local5:setText( f8_local1 ) + f8_local5:setTextStyle( CoD.TextStyle.Shadowed ) + f8_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + left = 0, + right = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 1, + green = 1, + blue = 1, + alignment = LUI.Alignment.Right, + alpha = 1 + } ) + f8_local5:animateToState( "default", 0 ) + f8_local5:registerAnimationState( "flash1", { + red = 1, + green = 0, + blue = 0, + alpha = 0.5 + } ) + f8_local5:registerAnimationState( "flash2", { + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + } ) + f8_local5:registerEventHandler( "flashing", MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) ) + f8_local5:registerEventHandler( "stop_flashing", MBh.AnimateToState( "default", 0 ) ) + if Engine.IsPS3() then + f8_local3:addElement( f8_local5 ) + f8_local3:addElement( f8_local4 ) + else + f8_local3:addElement( f8_local4 ) + f8_local3:addElement( f8_local5 ) + end + self:addElement( f8_local3 ) + return self +end + +local f0_local16 = function () + local f9_local0 = "@PLATFORM_ODIN_JUGGERNAUT" + local f9_local1 = "@PLATFORM_ODIN_MARKING" + local self = LUI.UIElement.new() + self.id = "odinControlsRightId" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + right = 750, + top = -32, + bottom = 32, + width = 512, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + local f9_local3 = LUI.UIVerticalList.new() + f9_local3.id = "odinControlsRightVLId" + f9_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + spacing = 20 + } ) + f9_local3:animateToState( "default", 0 ) + local f9_local4 = LUI.UIText.new() + f9_local4.id = "juggernautTextId" + f9_local4:setText( f9_local0 ) + f9_local4:setTextStyle( CoD.TextStyle.Shadowed ) + f9_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + left = 0, + right = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 1, + green = 1, + blue = 1, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) + f9_local4:animateToState( "default", 0 ) + f9_local4:registerAnimationState( "flash1", { + red = 1, + green = 0, + blue = 0, + alpha = 0.5 + } ) + f9_local4:registerAnimationState( "flash2", { + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + } ) + f9_local4:registerEventHandler( "flashing", MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) ) + f9_local4:registerEventHandler( "stop_flashing", MBh.AnimateToState( "default", 0 ) ) + local f9_local5 = LUI.UIText.new() + f9_local5.id = "markingTextId" + f9_local5:setText( f9_local1 ) + f9_local5:setTextStyle( CoD.TextStyle.Shadowed ) + f9_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + left = 0, + right = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 1, + green = 1, + blue = 1, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) + f9_local5:animateToState( "default", 0 ) + f9_local5:registerAnimationState( "flash1", { + red = 1, + green = 0, + blue = 0, + alpha = 0.5 + } ) + f9_local5:registerAnimationState( "flash2", { + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + } ) + f9_local5:registerEventHandler( "flashing", MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) ) + f9_local5:registerEventHandler( "stop_flashing", MBh.AnimateToState( "default", 0 ) ) + if Engine.IsPS3() then + f9_local3:addElement( f9_local5 ) + f9_local3:addElement( f9_local4 ) + else + f9_local3:addElement( f9_local4 ) + f9_local3:addElement( f9_local5 ) + end + self:addElement( f9_local3 ) + return self +end + +local f0_local17 = function () + local self = LUI.UIElement.new() + self.id = "odin_text_bits" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "altitude_refresh", f0_local13 ) + self:registerEventHandler( "position_refresh", f0_local14 ) + local f10_local1 = LUI.UITimer.new( 1000, "altitude_refresh" ) + f10_local1.id = "altitude_timer" + local f10_local2 = LUI.UITimer.new( 500, "position_refresh" ) + f10_local2.id = "position_timer" + local f10_local3 = LUI.UIText.new() + f10_local3.id = "name_text" + f10_local3:setText( "" ) + f10_local3:setTextStyle( CoD.TextStyle.Shadowed ) + f10_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 80, + right = -225, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 256, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 1, + green = 1, + blue = 1, + alignment = LUI.Alignment.Right, + alpha = 1 + } ) + f10_local3:animateToState( "default", 0 ) + local f10_local4 = LUI.UIText.new() + f10_local4.id = "location_text" + f10_local4:setText( Engine.Localize( "@MENU_LOCATION" ) .. Engine.Localize( "@" .. Engine.TableLookup( "mp/mapNames.csv", 0, Engine.GetDvarString( "ui_mapname" ), 1 ) ) ) + f10_local4:setTextStyle( CoD.TextStyle.Shadowed ) + f10_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -82, + left = 225, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 256, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 1, + green = 1, + blue = 1, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) + f10_local4:animateToState( "default", 0 ) + local f10_local5 = LUI.UIText.new() + f10_local5.id = "altitude_text" + f10_local5:setText( "" ) + f10_local5:setTextStyle( CoD.TextStyle.Shadowed ) + f10_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -97, + right = -225, + height = CoD.TextSettings.HudDigitalSmallFont.Height, + width = 256, + font = CoD.TextSettings.HudDigitalSmallFont.Font, + red = 1, + green = 1, + blue = 1, + alignment = LUI.Alignment.Right, + alpha = 1 + } ) + f10_local5:animateToState( "default", 0 ) + local f10_local6 = LUI.UIText.new() + f10_local6.id = "position_text" + f10_local6:setText( "8041.5679" ) + f10_local6:setTextStyle( CoD.TextStyle.Shadowed ) + f10_local6:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -82, + right = -225, + height = CoD.TextSettings.HudDigitalSmallFont.Height, + width = 256, + font = CoD.TextSettings.HudDigitalSmallFont.Font, + red = 1, + green = 1, + blue = 1, + alignment = LUI.Alignment.Right, + alpha = 1 + } ) + f10_local6:animateToState( "default", 0 ) + self:addElement( f10_local1 ) + self:addElement( f10_local2 ) + self:addElement( f10_local3 ) + self:addElement( f10_local5 ) + self:addElement( f10_local4 ) + self:addElement( f10_local6 ) + return self +end + +local f0_local18 = function () + local f11_local0 = RegisterMaterial( "odin_overlay_grain" ) + local self = LUI.UIElement.new() + self.id = "odinOverlayGrainId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 0.1 + } ) + self:registerAnimationState( "fired", { + alpha = 0.5 + } ) + local f11_local2 = LUI.UIImage.new() + f11_local2.id = "odinOverlayGrainImageId" + f11_local2:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f11_local0, + red = 0.9, + green = 1, + blue = 1 + } ) + f11_local2:animateToState( "default", 0 ) + self:addElement( f11_local2 ) + return self +end + +local f0_local19 = function ( f12_arg0, f12_arg1 ) + local f12_local0 = "@PLATFORM_ODIN_SMOKE" + local f12_local1 = "@PLATFORM_ODIN_AIRDROP" + local f12_local2 = "@PLATFORM_ODIN_MARKING" + local f12_local3 = "@PLATFORM_ODIN_JUGGERNAUT" + local f12_local4 = "@PLATFORM_ODIN_JUGGERNAUT_MOVE" + local f12_local5 = "@PLATFORM_ODIN_LARGE_ROD" + local f12_local6 = "@PLATFORM_ODIN_SMALL_ROD" + local f12_local7 = f12_arg0:getChildById( "odinControlsLeftId" ) + local f12_local8 = f12_local7:getChildById( "odinControlsLeftVLId" ) + local f12_local9 = f12_local8:getChildById( "airdropTextId" ) + local f12_local10 = f12_local8:getChildById( "smokeTextId" ) + if f12_local9.current_state and f12_local9.current_state == "airdrop" then + f12_local9:setText( Engine.Localize( f12_local1 ) ) + end + if f12_local10.current_state then + if f12_local10.current_state == "smoke" then + f12_local10:setText( Engine.Localize( f12_local0 ) ) + elseif f12_local10.current_state == "small_rod" then + f12_local10:setText( Engine.Localize( f12_local6 ) ) + end + end + local f12_local11 = f12_arg0:getChildById( "odinControlsRightId" ) + local f12_local12 = f12_local11:getChildById( "odinControlsRightVLId" ) + local f12_local13 = f12_local12:getChildById( "juggernautTextId" ) + local f12_local14 = f12_local12:getChildById( "markingTextId" ) + if f12_local13.current_state then + if f12_local13.current_state == "juggernaut" then + f12_local13:setText( Engine.Localize( f12_local3 ) ) + elseif f12_local13.current_state == "move" then + f12_local13:setText( Engine.Localize( f12_local4 ) ) + end + end + if f12_local14.current_state then + if f12_local14.current_state == "marking" then + f12_local14:setText( Engine.Localize( f12_local2 ) ) + elseif f12_local14.current_state == "large_rod" then + f12_local14:setText( Engine.Localize( f12_local5 ) ) + end + end +end + +LUI.MenuBuilder.registerType( "odinOverlayDef", function () + local self = LUI.UIElement.new() + self.id = "odinOverlayContainerId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerEventHandler( "init_overlay", f0_local8 ) + self:registerEventHandler( "refresh_controls", f0_local19 ) + self:registerOmnvarHandler( "ui_odin", f0_local8 ) + self:registerOmnvarHandler( "ui_odin_smoke_ammo", f0_local9 ) + self:registerOmnvarHandler( "ui_odin_airdrop_ammo", f0_local10 ) + self:registerOmnvarHandler( "ui_odin_marking_ammo", f0_local11 ) + self:registerOmnvarHandler( "ui_odin_juggernaut_ammo", f0_local12 ) + self:addElement( f0_local15() ) + self:addElement( f0_local16() ) + self:addElement( f0_local17() ) + self:addElement( f0_local18() ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/optionsmenu.dec.lua b/lui/mp_hud/optionsmenu.dec.lua new file mode 100644 index 0000000..1980635 --- /dev/null +++ b/lui/mp_hud/optionsmenu.dec.lua @@ -0,0 +1,677 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function mpPauseMenuCreateHandler( f1_arg0, f1_arg1 ) + f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then + f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addFriendsButton ) + end +end + +function chooseClassButtonAction( f2_arg0, f2_arg1 ) + LUI.FlowManager.RequestAddMenu( f2_arg0, "class_select_main", true, f2_arg1.controller ) +end + +function updateDescText( f3_arg0, f3_arg1 ) + f3_arg0:setText( Engine.Localize( f3_arg1.string ) ) +end + +function mpMapHandler( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0:getChildById( "map_mini_id" ) + local f4_local1 = f4_arg0:getChildById( "map_mini_icons_id" ) + if GameX.IsHardcoreMode() or Game.IsEmpJammed() or Game.GetOmnvar( "ui_hud_static" ) > 0 or Game.GetOmnvar( "ui_hud_emp_artifact" ) or Game.InKillCam() or Game.GetOmnvar( "ui_session_state" ) == "dead" then + f4_local0:animateToState( "inactive", 0 ) + f4_local1:animateToState( "inactive", 0 ) + else + f4_local0:animateToState( "default", 0 ) + f4_local1:animateToState( "default", 0 ) + end +end + +function changeTeamButtonAction( f5_arg0, f5_arg1 ) + LUI.FlowManager.RequestAddMenu( f5_arg0, "team_select_main", true, f5_arg1.controller ) +end + +function mutePlayersButtonAction( f6_arg0, f6_arg1 ) + LUI.FlowManager.RequestAddMenu( f6_arg0, "popup_mute_players", true, f6_arg1.controller ) +end + +function optionsButtonAction( f7_arg0, f7_arg1 ) + if Engine.IsConsoleGame() then + LUI.FlowManager.RequestAddMenu( f7_arg0, "mp_in_game_controls_menu", true, f7_arg1.controller ) + if GameX.IsSplitscreen() then + GameX.SetOptionState( true ) + f7_arg0:dispatchEventToAllOtherRoots( { + name = "refresh_options_button", + immediate = true + } ) + end + else + LUI.FlowManager.RequestAddMenu( f7_arg0, "pc_controls", true, f7_arg1.controller ) + end +end + +function endGameButtonAction( f8_arg0, f8_arg1 ) + local f8_local0 = Engine.GetDvarBool( "isMatchMakingGame" ) + local f8_local1 = Engine.GetDvarBool( "sv_running" ) + if f8_local0 then + LUI.FlowManager.RequestPopupMenu( f8_arg0, "popup_leave_game", true, f8_arg1.controller ) + else + LUI.FlowManager.RequestPopupMenu( f8_arg0, "popup_end_game", true, f8_arg1.controller ) + end +end + +function checkTeamChoice( f9_arg0 ) + if Engine.IsSquadVsSquadMode() then + return false + else + return Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f9_arg0, GameTypesTable.Cols.TeamChoice ) == "1" + end +end + +function chooseClassCheck( f10_arg0, f10_arg1, f10_arg2 ) + local f10_local0 = Game.GetPlayerTeam() + if GameX.UsesFakeLoadout() then + return true + elseif f10_arg0 == true then + return true + elseif f10_arg0 == false then + if f10_arg2 == true and (f10_local0 == Teams.allies or f10_local0 == Teams.axis) then + return true + elseif f10_arg2 == false then + return true + end + end + return false +end + +function pauseMenuUpdate( f11_arg0, f11_arg1 ) + if f11_arg1.value ~= true then + local f11_local0 = MBh.CloseAllMenus() + f11_local0( f11_arg0, f11_arg1 ) + end +end + +function optionsLockedUpdate( f12_arg0, f12_arg1 ) + return GameX.IsOptionStateLocked() +end + +function refreshOptionDisable( f13_arg0, f13_arg1 ) + if not f13_arg0.disabled then + f13_arg0:processEvent( { + name = "disable" + } ) + elseif f13_arg0.disabled then + f13_arg0:processEvent( { + name = "enable" + } ) + end +end + +function options_def() + local f14_local0 = GameX.GetGameMode() + local f14_local1 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f14_local0, GameTypesTable.Cols.ClassChoice ) == "1" + if not f14_local1 then + f14_local1 = GameX.UsesFakeLoadout() + end + local f14_local2 = checkTeamChoice( f14_local0 ) + local f14_local3 = GameX.IsRankedMatch() + local f14_local4 = Engine.GetDvarBool( "splitscreen_ingame" ) + local f14_local5 = Game.GetOmnvar( "ui_team_selected" ) + local f14_local6 = Game.GetOmnvar( "ui_loadout_selected" ) + local f14_local7 = chooseClassCheck( f14_local3, f14_local5, f14_local2 ) + local self = LUI.UIVerticalList.new() + self.id = "pause_selections_Id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = GenericMenuDims.menu_top, + left = GenericMenuDims.menu_left, + bottom = GenericMenuDims.menu_bottom, + right = GenericMenuDims.menu_right, + alignment = LUI.Alignment.Top + } ) + self:animateToState( "default", 0 ) + self:makeFocusable() + if f14_local0 ~= "aliens" and false == CoD.IsFireTeamMode() and f14_local1 == true and f14_local7 == true and not MLG.IsMLGSpectator() then + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIGenericButton", + id = "btn_MPPause_0", + properties = { + childNum = 1, + button_text = Engine.Localize( "@LUA_MENU_CHOOSE_CLASS_CAPS" ), + button_action_func = chooseClassButtonAction + } + } ) + end + if f14_local0 ~= "aliens" and false == CoD.IsFireTeamMode() and f14_local2 == true and f14_local3 == false and not MLG.IsMLGSpectator() then + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIGenericButton", + id = "btn_MPPause_1", + properties = { + childNum = 2, + button_text = Engine.Localize( "@LUA_MENU_CHANGE_TEAM_CAPS" ), + button_action_func = changeTeamButtonAction + } + } ) + end + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIGenericButton", + id = "btn_MPPause_2", + disabledFunc = optionsLockedUpdate, + properties = { + childNum = 3, + button_text = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ), + button_action_func = optionsButtonAction + }, + handlers = { + refresh_options_button = refreshOptionDisable + } + } ) + if GameX.IsOnlineMatch() and (not Engine.IsAliensMode() or not Game.GetOmnvar( "ui_alien_is_solo" )) and not MLG.IsMLGSpectator() then + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIGenericButton", + id = "btn_MPPause_3", + properties = { + childNum = 4, + button_text = Engine.Localize( "@LUA_MENU_MUTE_PLAYERS_CAPS" ), + button_action_func = mutePlayersButtonAction + } + } ) + end + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIGenericButton", + id = "btn_MPPause_5", + properties = { + childNum = 6, + button_text = Engine.Localize( "@LUA_MENU_END_GAME_CAPS" ), + button_action_func = endGameButtonAction + } + } ) + return self +end + +function game_mode_def() + local f15_local0 = GameX.GetGameMode() + local f15_local1 = Engine.Localize( "@" .. Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f15_local0, GameTypesTable.Cols.Name ) .. "_CAPS" ) + local f15_local2, f15_local3, f15_local4 = nil + if MatchRules.IsUsingMatchRulesData() then + f15_local4 = MatchRules.GetData( "commonOption", "scoreLimit" ) + else + f15_local3 = Engine.GetDvarInt( "scr_" .. f15_local0 .. "_winlimit" ) + if f15_local3 <= 1 then + f15_local4 = Engine.GetDvarInt( "scr_" .. f15_local0 .. "_scorelimit" ) + else + f15_local4 = f15_local3 + end + end + if f15_local4 == 0 then + f15_local2 = Engine.Localize( "@OBJECTIVES_" .. f15_local0 .. "" ) + else + f15_local2 = Engine.Localize( "@OBJECTIVES_" .. f15_local0 .. "_SCORE", f15_local4 ) + end + local f15_local5 = nil + if Engine.UsingSplitscreenUpscaling() then + f15_local5 = { + topAnchor = true, + leftAnchor = false, + top = GenericMenuDims.menu_top, + height = 65, + width = 350 + } + else + f15_local5 = { + topAnchor = true, + leftAnchor = true, + top = 135, + left = 690, + height = 65, + width = 350 + } + end + local self = LUI.UIElement.new( f15_local5 ) + self.id = "gamemode_Id" + local f15_local7 = LUI.UIText.new() + f15_local7.id = "gamemode_title_Id" + f15_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.BoldFont.Height, + width = 256, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left + } ) + f15_local7:animateToState( "default", 0 ) + f15_local7:setText( f15_local1 ) + f15_local7:setTextStyle( CoD.TextStyle.Shadowed ) + local f15_local8 = LUI.UIText.new() + f15_local8.id = "gamemode_desc_Id" + f15_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + top = CoD.TextSettings.BoldFont.Height, + left = 0, + height = CoD.TextSettings.NormalFont.Height, + width = 350, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f15_local8:animateToState( "default", 0 ) + f15_local8:setText( f15_local2 ) + f15_local8:setTextStyle( CoD.TextStyle.Shadowed ) + self:addElement( f15_local7 ) + self:addElement( f15_local8 ) + return self +end + +function map_display_def() + local f16_local0 = Engine.Localize( "@" .. Engine.TableLookup( "mp/mapNames.csv", 0, Engine.GetDvarString( "ui_mapname" ), 2 ) ) + local f16_local1 = RegisterMaterial( "hud_minimap_border" ) + local f16_local2 = math.min( GenericMenuDims.menu_bottom - GenericMenuDims.menu_top - CoD.TextSettings.BoldFont.Height - 5, 350 ) + local f16_local3 = f16_local2 + local f16_local4 = nil + if Engine.UsingSplitscreenUpscaling() then + local self = {} + self = GameX.GetSafeZoneSize() + f16_local4 = { + topAnchor = true, + rightAnchor = true, + right = self[3], + top = GenericMenuDims.menu_top, + height = f16_local2 + 30, + width = f16_local3 + } + else + f16_local4 = { + topAnchor = true, + leftAnchor = true, + top = 235, + left = 690, + height = f16_local2 + 30, + width = f16_local3 + } + end + local self = LUI.UIElement.new( f16_local4 ) + self.id = "map_Id" + self:registerEventHandler( "menu_create", mpMapHandler ) + self:registerOmnvarHandler( "ui_session_state", mpMapHandler ) + local f16_local6 = LUI.UIText.new() + f16_local6.id = "map_title_Id" + f16_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.BoldFont.Height, + width = 256, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left + } ) + f16_local6:animateToState( "default", 0 ) + f16_local6:setText( f16_local0 ) + f16_local6:setTextStyle( CoD.TextStyle.Shadowed ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIMinimap", + id = "map_mini_id", + properties = { + compassType = CoD.CompassType.Full + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + top = CoD.TextSettings.BoldFont.Height + 5, + left = 0, + height = f16_local2, + width = f16_local3, + alpha = 0.5 + }, + inactive = { + alpha = 0 + } + } + } ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIMinimapIcons", + id = "map_mini_icons_id", + properties = { + compassType = CoD.CompassType.Full + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + top = CoD.TextSettings.BoldFont.Height + 5, + left = 0, + height = f16_local2, + width = f16_local3, + alpha = 1 + }, + inactive = { + alpha = 0 + } + } + } ) + self:addElement( f16_local6 ) + return self +end + +function mp_pause_menu_background_def() + local self = LUI.UIImage.new() + self.id = "pmOptionsScreenOverlay" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "black" ), + red = Colors.window_border_color.r, + green = Colors.window_border_color.g, + blue = Colors.window_border_color.b, + alpha = 0.5 + } ) + self:animateToState( "default", 0 ) + return self +end + +function mp_pause_menu_title_def( f18_arg0 ) + local self = LUI.UIElement.new() + self.id = "mp_pause_title" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } ) + self:animateToState( "default", 0 ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "generic_menu_title", + id = "mp_pause_title_text", + properties = { + menu_title = f18_arg0 + } + } ) + return self +end + +function mp_pause_menu() + local f19_local0 = Engine.IsAliensMode() + local f19_local1 = Engine.IsSquadVsSquadMode() + local f19_local2 = Engine.Localize + local self + if f19_local0 then + self = "@ALIENS_PAUSE_CAPS" + if not self then + if f19_local1 then + self = "@LUA_MENU_PAUSE_SQUADS_CAPS" + if not self then + + else + f19_local2 = f19_local2( self ) + self = LUI.UIElement.new() + self.id = "mp_pause_menu_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerEventHandler( "menu_create", mpPauseMenuCreateHandler ) + self:registerEventHandler( "popup_inactive", MBh.AnimateToState( "default", 0 ) ) + self:registerEventHandler( "gain_focus", MBh.HandleSilently( MBh.AnimateToState( "default", 0 ) ) ) + self:registerOmnvarHandler( "ui_pause_menu_show", pauseMenuUpdate ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIWorldBlur", + id = "pmWorldBlurOverlay", + states = { + default = { + worldBlur = 5 + } + } + } ) + self:addElement( mp_pause_menu_background_def() ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "button_helper_text_main", + id = "pmhelper_text_id" + } ) + if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then + LUI.MenuBuilder.BuildAddChild( self, { + type = "online_friends_widget", + id = "pmfriends_widget_id" + } ) + end + local f19_local4 = LUI.UIBindButton.new() + f19_local4.id = "pmBackToGameStartButton" + local f19_local5 = f19_local4 + local f19_local6 = f19_local4.registerEventHandler + local f19_local7 = "button_start" + local f19_local8 = MBh.DoMultiple + local f19_local9 = {} + local f19_local10 = MBh.EmitEventToRoot( "toggle_pause_off" ) + local f19_local11 = MBh.CloseAllMenus() + f19_local6( f19_local5, f19_local7, f19_local8( f19_local10 ) ) + f19_local5 = f19_local4 + f19_local6 = f19_local4.registerEventHandler + f19_local7 = "button_select" + f19_local8 = MBh.DoMultiple + f19_local9 = {} + f19_local10 = MBh.EmitEventToRoot( "toggle_pause_off" ) + f19_local11 = MBh.CloseAllMenus() + f19_local6( f19_local5, f19_local7, f19_local8( f19_local10 ) ) + f19_local5 = f19_local4 + f19_local6 = f19_local4.registerEventHandler + f19_local7 = "button_secondary" + f19_local8 = MBh.DoMultiple + f19_local9 = {} + f19_local10 = MBh.EmitEventToRoot( "toggle_pause_off" ) + f19_local11 = MBh.CloseAllMenus() + f19_local6( f19_local5, f19_local7, f19_local8( f19_local10 ) ) + self:addElement( mp_pause_menu_title_def( f19_local2 ) ) + self:addElement( options_def() ) + self:addElement( f19_local4 ) + if not Engine.IsAliensMode() then + self:addElement( game_mode_def() ) + self:addElement( map_display_def() ) + else + self:addElement( LUI.mp_hud.AlienScoreboards.pause_menu_scoreboard() ) + end + return self + end + end + self = "@LUA_MENU_PAUSE_CAPS" + end + else + if f19_local1 then + self = "@LUA_MENU_PAUSE_SQUADS_CAPS" + if not self then + + else + f19_local2 = f19_local2( self ) + self = LUI.UIElement.new() + self.id = "mp_pause_menu_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerEventHandler( "menu_create", mpPauseMenuCreateHandler ) + self:registerEventHandler( "popup_inactive", MBh.AnimateToState( "default", 0 ) ) + self:registerEventHandler( "gain_focus", MBh.HandleSilently( MBh.AnimateToState( "default", 0 ) ) ) + self:registerOmnvarHandler( "ui_pause_menu_show", pauseMenuUpdate ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIWorldBlur", + id = "pmWorldBlurOverlay", + states = { + default = { + worldBlur = 5 + } + } + } ) + self:addElement( mp_pause_menu_background_def() ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "button_helper_text_main", + id = "pmhelper_text_id" + } ) + if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then + LUI.MenuBuilder.BuildAddChild( self, { + type = "online_friends_widget", + id = "pmfriends_widget_id" + } ) + end + local f19_local4 = LUI.UIBindButton.new() + f19_local4.id = "pmBackToGameStartButton" + local f19_local5 = f19_local4 + local f19_local6 = f19_local4.registerEventHandler + local f19_local7 = "button_start" + local f19_local8 = MBh.DoMultiple + local f19_local9 = {} + local f19_local10 = MBh.EmitEventToRoot( "toggle_pause_off" ) + local f19_local11 = MBh.CloseAllMenus() + f19_local6( f19_local5, f19_local7, f19_local8( f19_local10 ) ) + f19_local5 = f19_local4 + f19_local6 = f19_local4.registerEventHandler + f19_local7 = "button_select" + f19_local8 = MBh.DoMultiple + f19_local9 = {} + f19_local10 = MBh.EmitEventToRoot( "toggle_pause_off" ) + f19_local11 = MBh.CloseAllMenus() + f19_local6( f19_local5, f19_local7, f19_local8( f19_local10 ) ) + f19_local5 = f19_local4 + f19_local6 = f19_local4.registerEventHandler + f19_local7 = "button_secondary" + f19_local8 = MBh.DoMultiple + f19_local9 = {} + f19_local10 = MBh.EmitEventToRoot( "toggle_pause_off" ) + f19_local11 = MBh.CloseAllMenus() + f19_local6( f19_local5, f19_local7, f19_local8( f19_local10 ) ) + self:addElement( mp_pause_menu_title_def( f19_local2 ) ) + self:addElement( options_def() ) + self:addElement( f19_local4 ) + if not Engine.IsAliensMode() then + self:addElement( game_mode_def() ) + self:addElement( map_display_def() ) + else + self:addElement( LUI.mp_hud.AlienScoreboards.pause_menu_scoreboard() ) + end + return self + end + end + self = "@LUA_MENU_PAUSE_CAPS" + end + f19_local2 = f19_local2( self ) + self = LUI.UIElement.new() + self.id = "mp_pause_menu_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerEventHandler( "menu_create", mpPauseMenuCreateHandler ) + self:registerEventHandler( "popup_inactive", MBh.AnimateToState( "default", 0 ) ) + self:registerEventHandler( "gain_focus", MBh.HandleSilently( MBh.AnimateToState( "default", 0 ) ) ) + self:registerOmnvarHandler( "ui_pause_menu_show", pauseMenuUpdate ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIWorldBlur", + id = "pmWorldBlurOverlay", + states = { + default = { + worldBlur = 5 + } + } + } ) + self:addElement( mp_pause_menu_background_def() ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "button_helper_text_main", + id = "pmhelper_text_id" + } ) + if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then + LUI.MenuBuilder.BuildAddChild( self, { + type = "online_friends_widget", + id = "pmfriends_widget_id" + } ) + end + local f19_local4 = LUI.UIBindButton.new() + f19_local4.id = "pmBackToGameStartButton" + local f19_local5 = f19_local4 + local f19_local6 = f19_local4.registerEventHandler + local f19_local7 = "button_start" + local f19_local8 = MBh.DoMultiple + local f19_local9 = {} + local f19_local10 = MBh.EmitEventToRoot( "toggle_pause_off" ) + local f19_local11 = MBh.CloseAllMenus() + f19_local6( f19_local5, f19_local7, f19_local8( f19_local10 ) ) + f19_local5 = f19_local4 + f19_local6 = f19_local4.registerEventHandler + f19_local7 = "button_select" + f19_local8 = MBh.DoMultiple + f19_local9 = {} + f19_local10 = MBh.EmitEventToRoot( "toggle_pause_off" ) + f19_local11 = MBh.CloseAllMenus() + f19_local6( f19_local5, f19_local7, f19_local8( f19_local10 ) ) + f19_local5 = f19_local4 + f19_local6 = f19_local4.registerEventHandler + f19_local7 = "button_secondary" + f19_local8 = MBh.DoMultiple + f19_local9 = {} + f19_local10 = MBh.EmitEventToRoot( "toggle_pause_off" ) + f19_local11 = MBh.CloseAllMenus() + f19_local6( f19_local5, f19_local7, f19_local8( f19_local10 ) ) + self:addElement( mp_pause_menu_title_def( f19_local2 ) ) + self:addElement( options_def() ) + self:addElement( f19_local4 ) + if not Engine.IsAliensMode() then + self:addElement( game_mode_def() ) + self:addElement( map_display_def() ) + else + self:addElement( LUI.mp_hud.AlienScoreboards.pause_menu_scoreboard() ) + end + return self +end + +LUI.MenuBuilder.registerType( "mp_pause_menu", mp_pause_menu ) +LockTable( _M ) diff --git a/lui/mp_hud/optionsmenuscoreboard.dec.lua b/lui/mp_hud/optionsmenuscoreboard.dec.lua new file mode 100644 index 0000000..5922327 --- /dev/null +++ b/lui/mp_hud/optionsmenuscoreboard.dec.lua @@ -0,0 +1,897 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = Engine.Localize( "@LUA_MENU_OPPOSING_TEAM_CAPS" ) +f0_local1 = Engine.Localize( "@LUA_MENU_EMPTY" ) +f0_local2 = Engine.Localize( "@LUA_MENU_SCORE" ) +local f0_local3 = Engine.Localize( "@LUA_MENU_KILLS" ) +local f0_local4 = Engine.Localize( "@LUA_MENU_DEATHS" ) +local f0_local5 = Engine.Localize( "@LUA_MENU_ASSISTS" ) +local f0_local6 = Engine.Localize( "@LUA_MENU_CAPTURES" ) +local f0_local7 = Engine.Localize( "@LUA_MENU_PLANTS" ) +local f0_local8 = Engine.Localize( "@LUA_MENU_TAGS" ) +local f0_local9 = Engine.Localize( "@LUA_MENU_RESCUES" ) +local f0_local10 = function () + local f1_local0 = Engine.GetDvarString( "ui_gametype" ) + local f1_local1 = { + { + type = "optionsMenuScoreboardHeaderDef", + id = "scoreHeader" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow1" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow2" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow3" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow4" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow5" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow6" + }, + { + type = "optionsMenuScoreboardHeaderOpForDef", + id = "scoreHeaderOpFor" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow7" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow8" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow9" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow10" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow11" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow12" + } + } + if f1_local0 == "dm" or f1_local0 == "adrn" or f1_local0 == "mugger" or f1_local0 == "assn" or f1_local0 == "fo" or f1_local0 == "sna" then + f1_local1 = { + { + type = "optionsMenuScoreboardHeaderDef" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow1" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow2" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow3" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow4" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow5" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow6" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow7" + }, + { + type = "optionsMenuScoreboardRowDef", + id = "listRow8" + } + } + end + return f1_local1 +end + +local f0_local11 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = RegisterMaterial( "specialty_null" ) + local f2_local1 = RegisterMaterial( "waypoint_dogtags_friendlys" ) + local f2_local2 = RegisterMaterial( "waypoint_dogtags" ) + local f2_local3 = RegisterMaterial( "killiconsuicide" ) + local f2_local4 = f2_arg0:getChildById( "scoreboardRows" ) + local f2_local5 = Engine.GetDvarString( "ui_gametype" ) + local f2_local6 = 12 + local f2_local7 = f2_local6 * 0.5 + local f2_local8 = GameX.gameModeIsFFA() + if f2_local8 then + f2_local6 = 8 + end + local f2_local9 = f2_local4:getChildById( "scoreHeader" ) + local f2_local10 = f2_local9:getChildById( "scoreHeaderRowList" ) + local f2_local11 = f2_local10:getChildById( "assistsText" ) + local f2_local12 = Game.GetPlayerScoreRanking() + for f2_local13 = 1, f2_local6, 1 do + local f2_local16 = f2_local4:getChildById( "listRow" .. f2_local13 ) + local f2_local17 = f2_local16:getChildById( "rowList" ) + local f2_local18 = f2_local16:getChildById( "scoreRowBg" ) + local f2_local19 = f2_local17:getChildById( "rankIcon" ) + local f2_local20 = f2_local17:getChildById( "rankNumber" ) + local f2_local21 = f2_local17:getChildById( "gamertag" ) + local f2_local22 = f2_local17:getChildById( "score" ) + local f2_local23 = f2_local17:getChildById( "kills" ) + local f2_local24 = f2_local17:getChildById( "deaths" ) + local f2_local25 = f2_local17:getChildById( "assists" ) + local f2_local26 = "default" + local f2_local27 = Game.GetPlayerTeam() + if GameX.IsSpectatingNotOnTeam() then + f2_local27 = spectatorFakeTeam + end + local f2_local28 = f2_local13 + if f2_local8 == false and f2_local7 < f2_local13 then + f2_local27 = GameX.GetPlayerOpposingTeam() + f2_local28 = f2_local13 - f2_local7 + end + local f2_local29 = Game.GetPlayerScoreInfoAtRank( f2_local27, f2_local28 ) + if f2_local29 ~= nil then + if f2_local16.current_state ~= "filled" then + f2_local16:animateToState( "filled", 250 ) + f2_local16.current_state = "filled" + end + if f2_local13 % 2 == 0 then + f2_local26 = "bar_b" + end + if f2_local12 == f2_local13 then + f2_local26 = "highlight" + end + if f2_local5 == "sr" then + if f2_local29.extrascore1 == 1 then + f2_local26 = "downed" + elseif f2_local29.extrascore1 == 2 then + f2_local26 = "dead" + end + elseif f2_local29.isDead == true then + f2_local26 = "dead" + end + local f2_local30 = f2_local29.rankIcon + if f2_local5 == "sr" then + if f2_local26 == "downed" then + if f2_local27 == Game.GetPlayerTeam() then + f2_local30 = f2_local1 + else + f2_local30 = f2_local2 + end + elseif f2_local26 == "dead" then + f2_local30 = f2_local3 + end + end + if f2_local4.rank_icon ~= f2_local30 then + CoD.SetMaterial( f2_local19, f2_local30 ) + end + f2_local20:setText( f2_local29.rank + 1 ) + f2_local21:setText( f2_local29.name ) + if f2_local5 == "war" then + f2_local22:setText( f2_local29.score ) + f2_local23:setText( f2_local29.kills ) + f2_local24:setText( f2_local29.deaths ) + f2_local25:setText( f2_local29.assists ) + f2_local11:setText( f0_local5 ) + elseif f2_local5 == "dom" then + f2_local22:setText( f2_local29.score ) + f2_local23:setText( f2_local29.kills ) + f2_local24:setText( f2_local29.deaths ) + f2_local25:setText( f2_local29.extrascore0 ) + f2_local11:setText( f0_local6 ) + elseif f2_local5 == "sd" then + f2_local22:setText( f2_local29.score ) + f2_local23:setText( f2_local29.kills ) + f2_local24:setText( f2_local29.deaths ) + f2_local25:setText( f2_local29.extrascore0 ) + f2_local11:setText( f0_local7 ) + elseif f2_local5 == "conf" then + f2_local22:setText( f2_local29.score ) + f2_local23:setText( f2_local29.kills ) + f2_local24:setText( f2_local29.deaths ) + f2_local25:setText( f2_local29.extrascore0 ) + f2_local11:setText( f0_local8 ) + elseif f2_local5 == "dm" then + f2_local22:setText( f2_local29.score ) + f2_local23:setText( f2_local29.kills ) + f2_local24:setText( f2_local29.deaths ) + f2_local25:setText( f2_local29.assists ) + f2_local11:setText( f0_local5 ) + elseif f2_local5 == "gun" then + f2_local22:setText( f2_local29.score ) + f2_local23:setText( f2_local29.kills ) + f2_local24:setText( f2_local29.deaths ) + f2_local25:setText( f2_local29.assists ) + f2_local11:setText( f0_local5 ) + elseif f2_local5 == "mugger" then + f2_local22:setText( f2_local29.score ) + f2_local23:setText( f2_local29.kills ) + f2_local24:setText( f2_local29.deaths ) + f2_local25:setText( f2_local29.assists ) + f2_local11:setText( f0_local8 ) + elseif f2_local5 == "sr" then + f2_local22:setText( f2_local29.score ) + f2_local23:setText( f2_local29.kills ) + f2_local24:setText( f2_local29.deaths ) + f2_local25:setText( f2_local29.extrascore0 ) + f2_local11:setText( f0_local9 ) + elseif f2_local5 == "blitz" then + f2_local22:setText( f2_local29.score ) + f2_local23:setText( f2_local29.kills ) + f2_local24:setText( f2_local29.deaths ) + f2_local25:setText( f2_local29.assists ) + f2_local11:setText( f0_local5 ) + end + else + if f2_local4.rank_icon ~= f2_local0 then + CoD.SetMaterial( f2_local19, f2_local0 ) + end + if f2_local16.current_state ~= "default" then + f2_local16:animateToState( "default", 250 ) + f2_local16.current_state = "default" + end + f2_local20:setText( "" ) + f2_local21:setText( f0_local1 ) + f2_local22:setText( "" ) + f2_local23:setText( "" ) + f2_local24:setText( "" ) + f2_local25:setText( "" ) + end + if f2_local18.current_state ~= f2_local26 then + f2_local18:animateToState( f2_local26, 250 ) + f2_local18.current_state = f2_local26 + if f2_local26 == "highlight" then + f2_local20:animateToState( "black_text", 0 ) + f2_local21:animateToState( "black_text", 0 ) + f2_local22:animateToState( "black_text", 0 ) + f2_local23:animateToState( "black_text", 0 ) + f2_local24:animateToState( "black_text", 0 ) + f2_local25:animateToState( "black_text", 0 ) + else + f2_local20:animateToState( "default", 0 ) + f2_local21:animateToState( "default", 0 ) + f2_local22:animateToState( "default", 0 ) + f2_local23:animateToState( "default", 0 ) + f2_local24:animateToState( "default", 0 ) + f2_local25:animateToState( "default", 0 ) + end + end + end +end + +local f0_local12 = function ( f3_arg0, f3_arg1 ) + +end + +local f0_local13 = 200 +local f0_local14 = 650 +local f0_local15 = 2 +local f0_local16 = function () + return { + type = "UIElement", + id = "optionsMenuScoreboardHud", + states = { + default = { + topAnchor = true, + rightAnchor = true, + top = 50, + height = f0_local13, + right = -10, + width = f0_local14, + alpha = 1 + } + }, + handlers = { + options_menu_scoreboard_refresh = f0_local11 + }, + children = { + { + type = "UITimer", + id = "optionsMenuScoreboardRefreshTimer", + properties = { + event = "options_menu_scoreboard_refresh", + group = "hud", + interval = 250 + } + }, + { + type = "UIVerticalList", + id = "scoreboardRows", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alignment = LUI.Alignment.Left, + spacing = f0_local15, + alpha = 1 + } + }, + children = f0_local10() + } + } + } +end + +local f0_local17 = 20 +local f0_local18 = 20 +local f0_local19 = 256 +local f0_local20 = 50 +local f0_local21 = 75 +local f0_local22 = 75 +local f0_local23 = 75 +local f0_local24 = 7 +local f0_local25 = function () + return { + type = "UIElement", + id = "scoreHeader", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 5, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "scoreHeaderBg", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 5, + left = 0, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 10, + right = f0_local14, + material = RegisterMaterial( "hud_scoreboard_header" ) + } + } + }, + { + type = "UIHorizontalList", + id = "scoreHeaderRowList", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + spacing = f0_local24 + } + }, + children = { + { + type = "UIElement", + id = "spacer", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f0_local17 + f0_local18 + f0_local19 + f0_local24 * 3 + } + } + }, + { + type = "UIText", + id = "scoreText", + properties = { + text = f0_local2 + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 8, + left = 0, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 7, + right = 50, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0.75 + } + } + }, + { + type = "UIText", + id = "killsText", + properties = { + text = f0_local3 + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 8, + left = 0, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 7, + right = 75, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0.75 + } + } + }, + { + type = "UIText", + id = "deathsText", + properties = { + text = f0_local4 + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 8, + left = 0, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 7, + right = 75, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0.75 + } + } + }, + { + type = "UIText", + id = "assistsText", + properties = { + text = f0_local5 + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 8, + left = 0, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 7, + right = 75, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0.75 + } + } + } + } + } + } + } +end + +local f0_local26 = function () + local f6_local0 = RegisterMaterial( "hud_scoreboard_bar_a" ) + return { + type = "UIButton", + id = "scoreRow", + properties = { + rankIcon = placeholder_material, + rankNumber = "", + gamertag = f0_local1, + score = "", + kills = "", + deaths = "", + assists = "", + current_state = "default" + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = 20, + right = 0, + alpha = 0.25 + }, + filled = { + alpha = 1 + } + }, + handlers = { + button_action = f0_local12 + }, + children = { + { + type = "UIImage", + id = "scoreRowBg", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f6_local0, + alpha = 0.75 + }, + bar_a = { + material = f6_local0, + alpha = 1 + }, + bar_b = { + material = RegisterMaterial( "hud_scoreboard_bar_b" ), + alpha = 0.4 + }, + downed = { + material = RegisterMaterial( "hud_scoreboard_dead_yellow" ), + alpha = 0.65 + }, + dead = { + material = RegisterMaterial( "hud_scoreboard_dead_red" ), + alpha = 0.65 + }, + highlight = { + material = RegisterMaterial( "hud_scoreboard_highlight_you" ), + alpha = 1 + } + }, + handlers = { + button_over = function ( f7_arg0, f7_arg1 ) + f7_arg0:animateToState( "downed", 0 ) + end + , + button_up = function ( f8_arg0, f8_arg1 ) + f8_arg0:animateToState( f8_arg0.properties.current_state, 0 ) + end + + } + }, + { + type = "UIHorizontalList", + id = "rowList", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + spacing = 0 + } + }, + properties = { + rankIcon = MBh.Property( "rankIcon" ), + rankNumber = MBh.Property( "rankNumber" ), + gamertag = MBh.Property( "gamertag" ), + score = MBh.Property( "score" ), + kills = MBh.Property( "kills" ), + deaths = MBh.Property( "deaths" ), + assists = MBh.Property( "assists" ) + }, + children = { + { + type = "UIImage", + id = "rankIcon", + properties = { + rankIcon = MBh.Property( "rankIcon" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f0_local17, + material = MBh.Property( "rankIcon" ) + } + } + }, + { + type = "UIText", + id = "rankNumber", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 5, + left = 0, + bottom = 5 + CoD.TextSettings.HudEuroMedTinyFont.Height, + right = f0_local18 + 10, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + black_text = { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } + }, + properties = { + text = MBh.Property( "rankNumber" ) + } + }, + { + type = "UIText", + id = "gamertag", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f0_local19 + 10, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + black_text = { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } + }, + properties = { + text = MBh.Property( "gamertag" ) + } + }, + { + type = "UIText", + id = "score", + properties = { + text = MBh.Property( "score" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f0_local20 + 10, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + black_text = { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } + } + }, + { + type = "UIText", + id = "kills", + properties = { + text = MBh.Property( "kills" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f0_local21 + 8, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + black_text = { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } + } + }, + { + type = "UIText", + id = "deaths", + properties = { + text = MBh.Property( "deaths" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f0_local22 + 6, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + black_text = { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } + } + }, + { + type = "UIText", + id = "assists", + properties = { + text = MBh.Property( "assists" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f0_local23 + 6, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + black_text = { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } + } + } + } + } + } + } +end + +local f0_local27 = function () + return { + type = "UIElement", + id = "scoreHeaderOpFor", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height + 5, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "scoreHeaderOpForBg", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 5, + left = 0, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 10, + right = f0_local14, + material = RegisterMaterial( "hud_scoreboard_header" ) + } + } + }, + { + type = "UIText", + id = "headerOpForText", + properties = { + text = f0_local0 + }, + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 8, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + right = -5, + width = 200, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + alpha = 1 + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "optionsMenuScoreboardHudDef", f0_local16 ) +LUI.MenuBuilder.registerDef( "optionsMenuScoreboardRowDef", f0_local26 ) +LUI.MenuBuilder.registerDef( "optionsMenuScoreboardHeaderDef", f0_local25 ) +LUI.MenuBuilder.registerDef( "optionsMenuScoreboardHeaderOpForDef", f0_local27 ) +LockTable( _M ) diff --git a/lui/mp_hud/overlayhud.dec.lua b/lui/mp_hud/overlayhud.dec.lua new file mode 100644 index 0000000..2141359 --- /dev/null +++ b/lui/mp_hud/overlayhud.dec.lua @@ -0,0 +1,277 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function () + if Game.InKillCam() then + if Game.IsCinematicCameraActive() then + return false + elseif Game.IsKillCamEntityActive() then + return false + end + elseif Game.IsSpectatorCameraActive() then + return false + end + return true +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + if not f0_local0() then + f2_arg0:dispatchEventToChildren( { + name = "heliPilotOverlayDef_ended" + } ) + f2_arg0:dispatchEventToChildren( { + name = "predatorMissileOverlayDef_ended" + } ) + f2_arg0:dispatchEventToChildren( { + name = "odinOverlayDef_ended" + } ) + f2_arg0:dispatchEventToChildren( { + name = "juggernautOverlayDef_ended" + } ) + f2_arg0:dispatchEventToChildren( { + name = "a10OverlayDef_ended" + } ) + f2_arg0:dispatchEventToChildren( { + name = "vanguardOverlayDef_ended" + } ) + f2_arg0:dispatchEventToChildren( { + name = "juggPredatorOverlayDef_ended" + } ) + f2_arg0:dispatchEventToChildren( { + name = "ac130OverlayDef_ended" + } ) + end +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg1.killstreak + if f3_arg0.openOverlays[f3_local0] then + return + elseif not f0_local0() then + return + else + local f3_local1 = LUI.MenuBuilder.buildItems( { + type = f3_local0 + }, f3_arg0.properties, f3_arg0 ) + f3_local1:registerEventHandler( f3_local0 .. "_ended", function ( element, event ) + element:close() + f3_arg0.openOverlays[f3_local0] = false + end ) + f3_arg0.openOverlays[f3_local0] = true + f3_arg0:addElement( f3_local1 ) + f3_local1:processEvent( { + name = "init_overlay", + omnvar = f3_arg1.omnvar, + value = f3_arg1.value + } ) + end +end + +local f0_local3 = function ( f5_arg0, f5_arg1 ) + if f5_arg1.value == 1 then + f5_arg0:dispatchEventToRoot( { + name = "add_overlay", + target = f5_arg0, + killstreak = "heliPilotOverlayDef", + omnvar = f5_arg1.omnvar, + value = f5_arg1.value + } ) + elseif f5_arg1.value == 0 then + f5_arg0:dispatchEventToChildren( { + name = "heliPilotOverlayDef_ended" + } ) + end +end + +local f0_local4 = function ( f6_arg0, f6_arg1 ) + if f6_arg1.value == 1 then + f6_arg0:dispatchEventToRoot( { + name = "add_overlay", + target = f6_arg0, + killstreak = "predatorMissileOverlayDef", + omnvar = f6_arg1.omnvar, + value = f6_arg1.value + } ) + elseif f6_arg1.value == 0 then + f6_arg0:dispatchEventToChildren( { + name = "predatorMissileOverlayDef_ended" + } ) + end +end + +local f0_local5 = function ( f7_arg0, f7_arg1 ) + if f7_arg1.value == 1 or f7_arg1.value == 2 then + f7_arg0:dispatchEventToRoot( { + name = "add_overlay", + target = f7_arg0, + killstreak = "odinOverlayDef", + omnvar = f7_arg1.omnvar, + value = f7_arg1.value + } ) + elseif f7_arg1.value == -1 then + f7_arg0:dispatchEventToChildren( { + name = "odinOverlayDef_ended" + } ) + end +end + +local f0_local6 = function ( f8_arg0, f8_arg1 ) + if f8_arg1.value == 1 then + f8_arg0:dispatchEventToRoot( { + name = "add_overlay", + target = f8_arg0, + killstreak = "juggernautOverlayDef", + omnvar = f8_arg1.omnvar, + value = f8_arg1.value + } ) + elseif f8_arg1.value == 0 then + f8_arg0:dispatchEventToChildren( { + name = "juggernautOverlayDef_ended" + } ) + end +end + +local f0_local7 = function ( f9_arg0, f9_arg1 ) + if f9_arg1.value == true then + f9_arg0:dispatchEventToRoot( { + name = "add_overlay", + target = f9_arg0, + killstreak = "a10OverlayDef", + omnvar = f9_arg1.omnvar, + value = f9_arg1.value + } ) + elseif f9_arg1.value == false then + f9_arg0:dispatchEventToChildren( { + name = "a10OverlayDef_ended" + } ) + end +end + +local f0_local8 = function ( f10_arg0, f10_arg1 ) + if f10_arg1.value == 1 then + f10_arg0:dispatchEventToRoot( { + name = "add_overlay", + target = f10_arg0, + killstreak = "vanguardOverlayDef", + omnvar = f10_arg1.omnvar, + value = f10_arg1.value + } ) + elseif f10_arg1.value == 0 then + f10_arg0:dispatchEventToChildren( { + name = "vanguardOverlayDef_ended" + } ) + end +end + +local f0_local9 = function ( f11_arg0, f11_arg1 ) + if f11_arg1.value then + f11_arg0:dispatchEventToRoot( { + name = "add_overlay", + target = f11_arg0, + killstreak = "juggPredatorOverlayDef", + omnvar = f11_arg1.omnvar, + value = f11_arg1.value + } ) + elseif not f11_arg1.value then + f11_arg0:dispatchEventToChildren( { + name = "juggPredatorOverlayDef_ended" + } ) + end +end + +local f0_local10 = function ( f12_arg0, f12_arg1 ) + if f12_arg1.value then + f12_arg0:dispatchEventToRoot( { + name = "add_overlay", + target = f12_arg0, + killstreak = "ac130OverlayDef", + omnvar = f12_arg1.omnvar, + value = f12_arg1.value + } ) + elseif not f12_arg1.value then + f12_arg0:dispatchEventToChildren( { + name = "ac130OverlayDef_ended" + } ) + end +end + +local f0_local11 = function ( f13_arg0, f13_arg1 ) + local f13_local0 = Game.GetOmnvar( "ui_heli_pilot" ) + local f13_local1 = Game.GetOmnvar( "ui_predator_missile" ) + local f13_local2 = Game.GetOmnvar( "ui_odin" ) + local f13_local3 = Game.GetOmnvar( "ui_juggernaut" ) + local f13_local4 = Game.GetOmnvar( "ui_a10" ) + local f13_local5 = Game.GetOmnvar( "ui_vanguard" ) + local f13_local6 = Game.GetOmnvar( "ui_predator_hud" ) + local f13_local7 = Game.GetOmnvar( "ui_ac130_hud" ) + f0_local3( f13_arg0, { + name = "ui_heli_pilot", + value = f13_local0 + } ) + f0_local4( f13_arg0, { + name = "ui_predator_missile", + value = f13_local1 + } ) + f0_local5( f13_arg0, { + name = "ui_odin", + value = f13_local2 + } ) + f0_local6( f13_arg0, { + name = "ui_juggernaut", + value = f13_local3 + } ) + f0_local7( f13_arg0, { + name = "ui_a10", + value = f13_local4 + } ) + f0_local8( f13_arg0, { + name = "ui_vanguard", + value = f13_local5 + } ) + f0_local9( f13_arg0, { + name = "ui_predator_hud", + value = f13_local6 + } ) + f0_local10( f13_arg0, { + name = "ui_ac130_hud", + value = f13_local7 + } ) +end + +local f0_local12 = function ( f14_arg0, f14_arg1 ) + local f14_local0 = f14_arg0:getFirstChild() + while f14_local0 do + f14_local0:processEvent( f14_arg1 ) + f14_local0 = f14_local0:getNextSibling() + end +end + +LUI.MenuBuilder.registerType( "overlayHudDef", function () + local self = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } ) + self.id = "overlayId" + self.openOverlays = {} + self:registerOmnvarHandler( "ui_heli_pilot", f0_local3 ) + self:registerOmnvarHandler( "ui_predator_missile", f0_local4 ) + self:registerOmnvarHandler( "ui_odin", f0_local5 ) + self:registerOmnvarHandler( "ui_juggernaut", f0_local6 ) + self:registerOmnvarHandler( "ui_a10", f0_local7 ) + self:registerOmnvarHandler( "ui_vanguard", f0_local8 ) + self:registerOmnvarHandler( "ui_predator_hud", f0_local9 ) + self:registerOmnvarHandler( "ui_ac130_hud", f0_local10 ) + self:registerEventHandler( "add_overlay", f0_local2 ) + self:registerEventHandler( "playerstate_client_changed", f0_local11 ) + self:registerEventHandler( "refresh_controls", f0_local12 ) + self:registerEventHandler( "camera_client_changed", f0_local1 ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/perksonspawnhud.dec.lua b/lui/mp_hud/perksonspawnhud.dec.lua new file mode 100644 index 0000000..f667f57 --- /dev/null +++ b/lui/mp_hud/perksonspawnhud.dec.lua @@ -0,0 +1,197 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 250 + }, + { + "active", + 0 + }, + { + "active", + 3000 + }, + { + "default", + 250 + } + } ) + f1_local0( f1_arg0 ) +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + if f2_arg1.value == 1 then + f2_arg0:closeChildren() + local f2_local0 = {} + local f2_local1 = Game.GetOmnvar( "ui_spawn_abilities1" ) + local f2_local2 = Game.GetOmnvar( "ui_spawn_abilities2" ) + for f2_local3 = 1, 24, 1 do + f2_local0[f2_local3] = hasbit( f2_local1, bit( f2_local3 ) ) + f2_local0[f2_local3 + 24] = hasbit( f2_local2, bit( f2_local3 ) ) + end + for f2_local3 = 1, #f2_local0, 1 do + if f2_local0[f2_local3] then + local f2_local6 = Engine.TableLookup( KillCamAbilitiesBitMaskTable.File, KillCamAbilitiesBitMaskTable.Cols.Index, f2_local3, KillCamAbilitiesBitMaskTable.Cols.Ref ) + local f2_local7 = Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f2_local6, PerkTable.Cols.Cost ) + local f2_local8 = Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f2_local6, PerkTable.Cols.Image ) + local f2_local9 = RegisterMaterial( "white" ) + local f2_local10 = RegisterMaterial( f2_local8 ) + local f2_local11 = Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f2_local6, PerkTable.Cols.Name ) + local f2_local12 = nil + local f2_local13 = false + for self = 1, Cac.Abilities.Settings.AbilitiesNumCategories, 1 do + for f2_local17 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.GetAbilitySlotRef( Cac.GetAbilityRef( self - 1 ), f2_local17 ) == f2_local6 then + f2_local13 = true + break + end + end + if f2_local13 == true then + + end + end + local self = LUI.UIElement.new() + self.id = "perk_container" .. f2_local3 + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -16, + left = 0, + bottom = 18, + width = 32 + } ) + self:animateToState( "default", 0 ) + local f2_local15 = LUI.UIImage.new() + f2_local15.id = "perk_bg" .. f2_local3 + f2_local15:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + red = 1, + green = 1, + blue = 1, + material = f2_local9 + } ) + f2_local15:animateToState( "default", 0 ) + local f2_local16 = LUI.UIImage.new() + f2_local16.id = "perk_bar" .. f2_local3 + f2_local16:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 31, + height = 3, + red = Colors.cac_ability[f2_local12].r, + green = Colors.cac_ability[f2_local12].g, + blue = Colors.cac_ability[f2_local12].b, + material = f2_local9 + } ) + f2_local16:animateToState( "default", 0 ) + local f2_local20 = LUI.UIImage.new() + f2_local20.id = "perk_image" .. f2_local3 + f2_local20:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + height = 32, + red = 0, + green = 0, + blue = 0, + material = f2_local10 + } ) + f2_local20:animateToState( "default", 0 ) + local f2_local17 = LUI.UIText.new() + f2_local17.id = "perk_text" .. f2_local3 + f2_local17:setText( Engine.Localize( "@" .. f2_local11 ) ) + f2_local17:setTextStyle( CoD.TextStyle.Shadowed ) + f2_local17:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -CoD.TextSettings.HudEuroMedSmallFont.Height / 2, + left = 35, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height / 2, + right = 547, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f2_local17:animateToState( "default", 0 ) + self:addElement( f2_local15 ) + self:addElement( f2_local16 ) + self:addElement( f2_local20 ) + self:addElement( f2_local17 ) + f2_arg0:addElement( self ) + end + end + f0_local0( f2_arg0:getParent(), f2_arg1 ) + end +end + +LUI.MenuBuilder.registerType( "perksOnSpawnHudDef", function () + local self = LUI.UIElement.new() + self.id = "perks_on_spawn_hud" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 250, + left = -500, + height = 456, + width = 512, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 250, + left = 30, + height = 456, + width = 512, + alpha = 1 + } ) + self:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 250, + left = 10, + height = 456, + width = 512, + alpha = 1 + } ) + local f3_local1 = LUI.UIVerticalList.new() + f3_local1.id = "perks_on_spawn_vl" + f3_local1:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + spacing = 1 + } ) + f3_local1:animateToState( "default", 0 ) + f3_local1:registerOmnvarHandler( "ui_spawn_abilities_show", f0_local1 ) + self:addElement( f3_local1 ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/playercardhud.dec.lua b/lui/mp_hud/playercardhud.dec.lua new file mode 100644 index 0000000..77f8bee --- /dev/null +++ b/lui/mp_hud/playercardhud.dec.lua @@ -0,0 +1,171 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 1.2 +function playerCardHudDef() + local f1_local0 = RegisterMaterial( "white" ) + local f1_local1 = RegisterMaterial( "card_bg" ) + local self = LUI.UIElement.new() + self.id = "playerCard" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true + } ) + self:animateToState( "default", 0 ) + local f1_local3 = LUI.UIImage.new() + f1_local3.id = "playerCard" + f1_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = 64 * f0_local0 + 10, + width = 256 * f0_local0 + 75, + material = f1_local1 + } ) + f1_local3:animateToState( "default", 0 ) + local f1_local4 = LUI.UIImage.new() + f1_local4.id = "playerCardBg" + f1_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -15, + right = -43, + height = 32 * f0_local0, + width = 256 * f0_local0, + material = f1_local1 + } ) + f1_local4:animateToState( "default", 0 ) + local f1_local5 = LUI.UIImage.new() + f1_local5.id = "playerCardPatchBg" + f1_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = 64 * f0_local0, + width = 64 * f0_local0, + material = f1_local0 + } ) + f1_local5:animateToState( "default", 0 ) + local f1_local6 = LUI.UIImage.new() + f1_local6.id = "playerCardPatch" + f1_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = 64 * f0_local0, + width = 64 * f0_local0, + material = f1_local0 + } ) + f1_local6:animateToState( "default", 0 ) + local f1_local7 = LUI.UIMarqueeText.new() + f1_local7.id = "playerCardNameText" + f1_local7:setText( "" ) + f1_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 13, + left = 75, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 255, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f1_local7:animateToState( "default", 0 ) + local f1_local8 = LUI.UIText.new() + f1_local8.id = "playerCardQuipText" + f1_local8:setText( "" ) + f1_local8:setTextStyle( CoD.TextStyle.Shadowed ) + f1_local8:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -38, + left = 75, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = 512, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alignment = LUI.Alignment.Left + } ) + f1_local8:animateToState( "default", 0 ) + local f1_local9 = LUI.UIText.new() + f1_local9.id = "playerCardClanTagText" + f1_local9:setText( "" ) + f1_local9:setTextStyle( CoD.TextStyle.Shadowed ) + f1_local9:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -15, + left = 75, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + width = 512, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alignment = LUI.Alignment.Left + } ) + f1_local9:animateToState( "default", 0 ) + local f1_local10 = LUI.UIImage.new() + f1_local10.id = "playerCardRankIcon" + f1_local10:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -13, + right = -90, + height = 32, + width = 32, + material = f1_local0 + } ) + f1_local10:animateToState( "default", 0 ) + local f1_local11 = LUI.UIText.new() + f1_local11.id = "playerCardRankText" + f1_local11:setText( "" ) + f1_local11:setTextStyle( CoD.TextStyle.Outlined ) + f1_local11:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -9, + right = -47, + height = CoD.TextSettings.HudEuroBigFont.Height + 10, + width = 64, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Right, + red = 1, + green = 1, + blue = 1 + } ) + f1_local11:animateToState( "default", 0 ) + f1_local3:addElement( f1_local4 ) + f1_local3:addElement( f1_local5 ) + f1_local3:addElement( f1_local6 ) + f1_local3:addElement( f1_local7 ) + f1_local3:addElement( f1_local8 ) + f1_local3:addElement( f1_local9 ) + f1_local3:addElement( f1_local10 ) + f1_local3:addElement( f1_local11 ) + self:addElement( f1_local3 ) + return self +end + +LUI.MenuBuilder.registerType( "playerCardHudDef", playerCardHudDef ) +LockTable( _M ) diff --git a/lui/mp_hud/playerinfohud.dec.lua b/lui/mp_hud/playerinfohud.dec.lua new file mode 100644 index 0000000..baac748 --- /dev/null +++ b/lui/mp_hud/playerinfohud.dec.lua @@ -0,0 +1,1047 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 64 +f0_local1 = 410 +f0_local2 = 25 +local f0_local3 = 250 +local f0_local4 = Engine.Localize( "@LUA_MENU_MAX" ) +local f0_local5 = Engine.Localize( "@LUA_MENU_SCORE" ) +local f0_local6 = Engine.Localize( "@LUA_MENU_K_FOR_KILLS_CAPS" ) +local f0_local7 = Engine.Localize( "@LUA_MENU_D_FOR_DEATHS_CAPS" ) +local f0_local8 = Engine.Localize( "@LUA_MENU_A_FOR_ASSISTS_CAPS" ) +local f0_local9 = Engine.Localize( "@LUA_MENU_C_FOR_CAPTURES_CAPS" ) +local f0_local10 = Engine.Localize( "@LUA_MENU_P_FOR_PLANTS_CAPS" ) +local f0_local11 = Engine.Localize( "@LUA_MENU_T_FOR_TAGS_CAPS" ) +local f0_local12 = Engine.Localize( "@LUA_MENU_R_FOR_RESCUES_CAPS" ) +local f0_local13 = Engine.Localize( "@LUA_MENU_T_FOR_TIME_CAPS" ) +local f0_local14 = Engine.Localize( "@LUA_MENU_S_FOR_SECONDS" ) +local f0_local15 = Engine.Localize( "@LUA_MENU_M_FOR_MINUTES" ) +local f0_local16 = Engine.Localize( "@LUA_MENU_S_FOR_SCORES_CAPS" ) +local f0_local17 = Engine.Localize( "@LUA_MENU_C_FOR_CRATES_CAPS" ) +local f0_local18 = Engine.Localize( "@LUA_MENU_R_FOR_REVIVES_CAPS" ) +local f0_local19 = Engine.Localize( "@PATCH_MENU_S_FOR_STREAK_CAPS" ) +local f0_local20 = Engine.Localize( "@PATCH_MENU_S_FOR_STABS_CAPS" ) +local f0_local21 = {} +local f0_local22 = Engine.Localize( "@LUA_MENU_1ST" ) +local f0_local23 = Engine.Localize( "@LUA_MENU_2ND" ) +local f0_local24 = Engine.Localize( "@LUA_MENU_3RD" ) +local f0_local25 = Engine.Localize( "@LUA_MENU_4TH" ) +local f0_local26 = Engine.Localize( "@LUA_MENU_5TH" ) +local f0_local27 = Engine.Localize( "@LUA_MENU_6TH" ) +local f0_local28 = Engine.Localize( "@LUA_MENU_7TH" ) +local f0_local29 = Engine.Localize( "@LUA_MENU_8TH" ) +local f0_local30 = Engine.Localize( "@LUA_MENU_9TH" ) +local f0_local31 = Engine.Localize( "@LUA_MENU_10TH" ) +local f0_local32 = Engine.Localize( "@LUA_MENU_11TH" ) +local f0_local33 = Engine.Localize( "@LUA_MENU_12TH" ) +local f0_local34 = Engine.Localize( "@LUA_MENU_13TH" ) +local f0_local35 = Engine.Localize( "@LUA_MENU_14TH" ) +local f0_local36 = Engine.Localize( "@LUA_MENU_15TH" ) +local f0_local37 = Engine.Localize( "@LUA_MENU_16TH" ) +local f0_local38 = Engine.Localize( "@LUA_MENU_17TH" ) +local f0_local39 = Engine.Localize( "@LUA_MENU_18TH" ) +f0_local21 = f0_local22 +f0_local22 = function ( f1_arg0, f1_arg1 ) + if f1_arg0.current_state ~= "inactive" then + f1_arg0:animateToState( "inactive", 0 ) + f1_arg0.current_state = "inactive" + elseif f1_arg0.current_state ~= "default" then + f1_arg0:animateToState( "default", 0 ) + f1_arg0.current_state = "default" + f1_arg0:processEvent( { + name = "hud_on" + } ) + end +end + +f0_local23 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0.score + if f2_local0 >= 10000 then + f2_local0 = 9999 + end + local f2_local1 = f2_arg0.kills + if f2_arg1 ~= "horde" then + if f2_local1 >= 100 then + f2_local1 = 99 + end + elseif f2_local1 >= 1000 then + f2_local1 = 999 + end + local f2_local2 = f2_arg0.deaths + if f2_local2 >= 100 then + f2_local2 = 99 + end + local f2_local3 = f2_arg0.assists + if f2_arg1 ~= "horde" then + if f2_local3 >= 100 then + f2_local3 = 99 + end + elseif f2_local3 >= 1000 then + f2_local3 = 999 + end + local f2_local4 = f2_arg0.extrascore0 + if f2_arg1 ~= "infect" then + if not (f2_arg1 ~= "dm" and (f2_arg1 ~= "cranked" or not GameX.gameModeIsFFA())) or f2_arg1 == "sotf_ffa" then + f2_local4 = Game.GetOmnvar( "ui_game_type_kill_value" ) + if not f2_local4 then + f2_local4 = 0 + end + f2_local4 = f2_local4 * f2_local0 + if f2_local4 >= 10000 then + f2_local4 = 9999 + end + elseif f2_local4 >= 100 then + f2_local4 = 99 + end + end + return f2_local0, f2_local1, f2_local2, f2_local3, f2_local4 +end + +f0_local24 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0:getParent() + if f3_local0.current_state == "inactive" then + return + end + local f3_local1 = Engine.GetDvarString( "ui_gametype" ) + local f3_local2 = Game.GetPlayerScoreRanking() or 1 + local f3_local3 = Game.GetPlayerScoreInfoAtRank( Game.GetPlayerTeam(), f3_local2 ) + if f3_local3 ~= nil then + local f3_local4 = f3_arg0:getChildById( "playerInfoPlaceTextId" ) + f3_local4:setText( f3_local2 ) + local f3_local5 = f3_arg0:getChildById( "playerInfoHeaderRowId" ) + local f3_local6 = f3_local5:getChildById( "playerInfoDeathsTextId" ) + local f3_local7 = f3_local5:getChildById( "playerInfoAssistsTextId" ) + local f3_local8 = f3_arg0:getChildById( "playerInfoRowId" ) + local f3_local9 = f3_local8:getChildById( "playerInfoScoreValueId" ) + local f3_local10 = f3_local8:getChildById( "playerInfoKillsValueId" ) + local f3_local11 = f3_local8:getChildById( "playerInfoDeathsValueId" ) + local f3_local12 = f3_local8:getChildById( "playerInfoAssistsValueId" ) + local f3_local13, f3_local14, f3_local15, f3_local16, f3_local17 = f0_local23( f3_local3, f3_local1 ) + if f3_local1 == "war" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local16 ) + f3_local7:setText( f0_local8 ) + elseif f3_local1 == "dom" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local17 ) + f3_local7:setText( f0_local9 ) + elseif f3_local1 == "sd" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local17 ) + f3_local7:setText( f0_local10 ) + elseif f3_local1 == "conf" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local17 ) + f3_local7:setText( f0_local11 ) + elseif f3_local1 == "dm" then + f3_local9:setText( f3_local17 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local16 ) + f3_local7:setText( f0_local19 ) + elseif f3_local1 == "mugger" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local16 ) + f3_local7:setText( f0_local11 ) + elseif f3_local1 == "sr" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local17 ) + f3_local7:setText( f0_local12 ) + elseif f3_local1 == "blitz" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local17 ) + f3_local7:setText( f0_local9 ) + elseif f3_local1 == "cranked" then + if GameX.gameModeIsFFA() then + f3_local9:setText( f3_local17 ) + else + f3_local9:setText( f3_local13 ) + end + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local16 ) + f3_local7:setText( f0_local8 ) + elseif f3_local1 == "sotf" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local16 ) + f3_local7:setText( f0_local8 ) + elseif f3_local1 == "sotf_ffa" then + f3_local9:setText( f3_local17 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local16 ) + f3_local7:setText( f0_local19 ) + elseif f3_local1 == "gun" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local7:setText( f0_local20 ) + f3_local12:setText( f3_local16 ) + elseif f3_local1 == "infect" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( CoD.FormatInfectedTime( f3_local17 ) ) + f3_local7:setText( f0_local13 ) + elseif f3_local1 == "grind" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local17 ) + f3_local7:setText( f0_local16 ) + elseif f3_local1 == "horde" then + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local16 ) + f3_local6:setText( f0_local18 ) + f3_local12:setText( f3_local17 ) + f3_local7:setText( f0_local17 ) + elseif f3_local1 == "siege" then + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local17 ) + f3_local7:setText( f0_local9 ) + else + f3_local9:setText( f3_local13 ) + f3_local10:setText( f3_local14 ) + f3_local11:setText( f3_local15 ) + f3_local12:setText( f3_local16 ) + f3_local7:setText( f0_local8 ) + end + end +end + +f0_local25 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = Game.GetPlayerScoreRanking() + if not f4_local0 then + return + end + local f4_local1 = f4_arg0.last_rank ~= 1 + local f4_local2 = f4_local0 ~= 1 + if f4_local1 ~= f4_local2 then + if f4_local2 then + f4_arg0:dispatchEventToRoot( { + name = "open_rival_info", + immediate = true + } ) + else + f4_arg0:dispatchEventToRoot( { + name = "close_rival_info", + immediate = true + } ) + end + end + f4_arg0.last_rank = f4_local0 + if f4_local0 > 1 then + local f4_local3 = Game.GetPlayerScoreInfoAtRank( Game.GetPlayerTeam(), f4_local0 - 1 ) + if not f4_local3 then + return + end + local f4_local4 = f4_arg0:getChildById( "rivalInfoRowId" ) + if f4_local3 ~= nil then + local f4_local5 = f4_arg0:getChildById( "rivalInfoPlaceTextId" ) + f4_local5:setText( f0_local21[f4_local0 - 1] ) + f4_local5 = f4_local4:getChildById( "rivalInfoScoreValueId" ) + local f4_local6 = f4_local4:getChildById( "rivalInfoKillsValueId" ) + local f4_local7 = f4_local4:getChildById( "rivalInfoDeathsValueId" ) + local f4_local8 = f4_local4:getChildById( "rivalInfoAssistsValueId" ) + local f4_local9 = Engine.GetDvarString( "ui_gametype" ) + local f4_local10, f4_local11, f4_local12, f4_local13, f4_local14 = f0_local23( f4_local3, f4_local9 ) + if f4_local9 == "war" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local13 ) + elseif f4_local9 == "dom" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local14 ) + elseif f4_local9 == "sd" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local14 ) + elseif f4_local9 == "conf" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local14 ) + elseif f4_local9 == "dm" then + f4_local5:setText( f4_local14 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local13 ) + elseif f4_local9 == "mugger" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local13 ) + elseif f4_local9 == "sr" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local14 ) + elseif f4_local9 == "blitz" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local14 ) + elseif f4_local9 == "cranked" then + if GameX.gameModeIsFFA() then + f4_local5:setText( f4_local14 ) + else + f4_local5:setText( f4_local10 ) + end + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local13 ) + elseif f4_local9 == "sotf" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local13 ) + elseif f4_local9 == "sotf_ffa" then + f4_local5:setText( f4_local14 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local13 ) + elseif f4_local9 == "gun" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local13 ) + elseif f4_local9 == "infect" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( CoD.FormatInfectedTime( f4_local14 ) ) + elseif f4_local9 == "grind" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local14 ) + elseif f4_local9 == "siege" then + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local14 ) + else + f4_local5:setText( f4_local10 ) + f4_local6:setText( f4_local11 ) + f4_local7:setText( f4_local12 ) + f4_local8:setText( f4_local13 ) + end + local f4_local15 = f4_local3.name + local f4_local16 = f4_arg0:getChildById( "rivalInfoNameId" ) + f4_local16:setText( f4_local15 ) + if f4_arg1.name == "hud_on" then + f4_arg0:dispatchEventToRoot( { + name = "open_rival_info", + immediate = true + } ) + end + end + end +end + +f0_local26 = function () + local f5_local0 = Engine.GetDvarString( "ui_gametype" ) == "horde" + local f5_local1 = RegisterMaterial( "hud_player_info_bg" ) + local f5_local2 = 50 + local f5_local3 + if f5_local0 then + f5_local3 = 42 + if not f5_local3 then + + else + local f5_local4 + if f5_local0 then + f5_local4 = 42 + if not f5_local4 then + + else + local f5_local5 + if f5_local0 then + f5_local5 = 42 + if not f5_local5 then + + else + local f5_local6 = 11 + local f5_local7 = 250 + local self = LUI.UIElement.new( { + topAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + height = 64, + width = 256, + alpha = 1 + } ) + self.id = "playerInfoId" + self:registerAnimationState( "showrival", { + topAnchor = true, + rightAnchor = true, + top = 15 + } ) + self:registerEventHandler( "player_info_refresh", f0_local24 ) + self:registerEventHandler( "open_rival_info", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "showrival", + f0_local3 / 4 + } + } ) ) + self:registerEventHandler( "close_rival_info", MBh.AnimateSequence( { + { + "showrival", + 0 + }, + { + "showrival", + f0_local3 * 3 / 4 + }, + { + "default", + f0_local3 / 4 + } + } ) ) + local f5_local9 = LUI.UIImage.new() + f5_local9.id = "playerInfoBgId" + f5_local9:registerAnimationState( "default", { + topAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + height = 64, + width = 0, + material = f5_local1, + alpha = 0 + } ) + f5_local9:animateToState( "default", 0 ) + f5_local9:registerAnimationState( "active", { + topAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + height = 64, + width = 256, + material = f5_local1, + alpha = 1 + } ) + f5_local9:registerAnimationState( "opening", { + topAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + height = 64, + width = 296, + material = f5_local1, + alpha = 1 + } ) + f5_local9:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + f5_local7 / 2 + }, + { + "active", + f5_local7 / 2 + } + } ) ) + local f5_local10 = LUI.UIText.new() + f5_local10.id = "player_info_place_text_bg" + f5_local10:setText( "8" ) + f5_local10:registerAnimationState( "default", { + topAnchor = true, + rightAnchor = true, + top = 15, + right = -186, + height = CoD.TextSettings.HudDigitalExtraBigFont.Height, + width = 40, + font = CoD.TextSettings.HudDigitalExtraBigFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + blue = 0, + green = 0, + alpha = 0.25 + } ) + f5_local10:animateToState( "default", 0 ) + local f5_local11 = LUI.UIText.new() + f5_local11.id = "playerInfoPlaceTextId" + f5_local11:setText( "" ) + f5_local11:registerAnimationState( "default", { + topAnchor = true, + rightAnchor = true, + top = 15, + right = -186, + height = CoD.TextSettings.HudDigitalExtraBigFont.Height, + width = 40, + font = CoD.TextSettings.HudDigitalExtraBigFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0 + } ) + f5_local11:animateToState( "default", 0 ) + f5_local11:registerAnimationState( "active", { + alpha = 1 + } ) + f5_local11:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 500 + } + } ) ) + local f5_local12 = LUI.UIHorizontalList.new() + f5_local12.id = "playerInfoHeaderRowId" + f5_local12:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 15, + right = 0, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + spacing = f5_local6, + alignment = LUI.Alignment.Right, + alpha = 0 + } ) + f5_local12:animateToState( "default", 0 ) + f5_local12:registerAnimationState( "active", { + alpha = 1 + } ) + f5_local12:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 500 + } + } ) ) + local f5_local13 = LUI.UIElement.new() + f5_local13.id = "player_header_hl_spacer1" + f5_local13:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = 7 + } ) + f5_local13:animateToState( "default", 0 ) + local f5_local14 = LUI.UIText.new() + f5_local14.id = "playerInfoAssistsTextId" + f5_local14:setText( f0_local8 ) + f5_local14:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f5_local5, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right + } ) + f5_local14:animateToState( "default", 0 ) + local f5_local15 = LUI.UIText.new() + f5_local15.id = "playerInfoDeathsTextId" + f5_local15:setText( f0_local7 ) + f5_local15:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f5_local4, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right + } ) + f5_local15:animateToState( "default", 0 ) + local f5_local16 = LUI.UIText.new() + f5_local16.id = "playerInfoKillsTextId" + f5_local16:setText( f0_local6 ) + f5_local16:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f5_local3, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right + } ) + f5_local16:animateToState( "default", 0 ) + local f5_local17 = LUI.UIText.new() + f5_local17.id = "playerInfoScoreTextId" + f5_local17:setText( f0_local5 ) + f5_local17:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f5_local2, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right + } ) + f5_local17:animateToState( "default", 0 ) + f5_local12:addElement( f5_local13 ) + f5_local12:addElement( f5_local14 ) + f5_local12:addElement( f5_local15 ) + f5_local12:addElement( f5_local16 ) + if not f5_local0 then + f5_local12:addElement( f5_local17 ) + end + local f5_local18 = LUI.UIHorizontalList.new() + f5_local18.id = "playerInfoRowId" + f5_local18:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 32, + left = 0, + bottom = 25 + CoD.TextSettings.HudEuroConRegSmallFont.Height, + right = 0, + spacing = f5_local6, + alignment = LUI.Alignment.Right, + alpha = 0 + } ) + f5_local18:animateToState( "default", 0 ) + f5_local18:registerAnimationState( "active", { + alpha = 1 + } ) + f5_local18:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 750 + } + } ) ) + local f5_local19 = LUI.UIElement.new() + f5_local19.id = "player_info_hl_spacer1" + f5_local19:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = 7 + } ) + f5_local19:animateToState( "default", 0 ) + local f5_local20 = LUI.UIText.new() + f5_local20.id = "playerInfoAssistsValueId" + f5_local20:setText( "" ) + f5_local20:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = CoD.TextSettings.HudEuroConRegSmallFont.Height, + right = f5_local5, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0, + alpha = 1 + } ) + f5_local20:animateToState( "default", 0 ) + local f5_local21 = LUI.UIText.new() + f5_local21.id = "playerInfoDeathsValueId" + f5_local21:setText( "" ) + f5_local21:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = CoD.TextSettings.HudEuroConRegSmallFont.Height, + right = f5_local4, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0, + alpha = 1 + } ) + f5_local21:animateToState( "default", 0 ) + local f5_local22 = LUI.UIText.new() + f5_local22.id = "playerInfoKillsValueId" + f5_local22:setText( "" ) + f5_local22:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = CoD.TextSettings.HudEuroConRegSmallFont.Height, + right = f5_local3, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0, + alpha = 1 + } ) + f5_local22:animateToState( "default", 0 ) + local f5_local23 = LUI.UIText.new() + f5_local23.id = "playerInfoScoreValueId" + f5_local23:setText( "" ) + f5_local23:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = CoD.TextSettings.HudEuroConRegSmallFont.Height, + right = f5_local2, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0, + alpha = 1 + } ) + f5_local23:animateToState( "default", 0 ) + f5_local18:addElement( f5_local19 ) + f5_local18:addElement( f5_local20 ) + f5_local18:addElement( f5_local21 ) + f5_local18:addElement( f5_local22 ) + if not f5_local0 then + f5_local18:addElement( f5_local23 ) + end + self:addElement( f5_local9 ) + self:addElement( f5_local10 ) + self:addElement( f5_local11 ) + self:addElement( f5_local12 ) + self:addElement( f5_local18 ) + return self + end + end + f5_local5 = 25 + end + end + f5_local4 = 25 + end + end + f5_local3 = 25 +end + +f0_local27 = function () + local f6_local0 = RegisterMaterial( "hud_rival_info_bg" ) + local f6_local1 = 50 + local f6_local2 = 25 + local f6_local3 = 25 + local f6_local4 = 25 + local f6_local5 = 13 + local self = LUI.UIElement.new() + self.id = "rivalInfoId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 10, + height = f0_local2, + right = 0, + width = 0, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 10, + height = f0_local2, + right = 0, + width = 410, + alpha = 1 + } ) + self:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 10, + height = f0_local2, + right = 0, + width = 450, + alpha = 1 + } ) + self:registerEventHandler( "menu_create", f0_local25 ) + self:registerEventHandler( "player_info_refresh", f0_local25 ) + self:registerEventHandler( "hud_on", f0_local25 ) + self:registerEventHandler( "hud_off", MBh.AnimateToState( "default", 0 ) ) + self:registerEventHandler( "open_rival_info", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + f0_local3 / 4 + }, + { + "opening", + f0_local3 / 2 + }, + { + "active", + f0_local3 / 4 + } + } ) ) + self:registerEventHandler( "close_rival_info", MBh.AnimateSequence( { + { + "active", + 0 + }, + { + "default", + f0_local3 * 3 / 4 + } + } ) ) + local f6_local7 = LUI.UIImage.new() + f6_local7.id = "rivalInfoBgId" + f6_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f6_local0 + } ) + f6_local7:animateToState( "default", 0 ) + local f6_local8 = LUI.UIText.new() + f6_local8.id = "rivalInfoPlaceTextId" + f6_local8:setText( "" ) + f6_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 3, + right = -379, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 40, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0 + } ) + f6_local8:animateToState( "default", 0 ) + local f6_local9 = LUI.UIMarqueeText.new() + f6_local9.id = "rivalInfoNameId" + f6_local9:setText( "" ) + f6_local9:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 3, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + right = -215, + width = 150, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f6_local9:animateToState( "default", 0 ) + local f6_local10 = LUI.UIHorizontalList.new() + f6_local10.id = "rivalInfoRowId" + f6_local10:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 3, + left = 0, + right = 0, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + spacing = f6_local5, + alignment = LUI.Alignment.Right + } ) + f6_local10:animateToState( "default", 0 ) + local f6_local11 = LUI.UIElement.new() + f6_local11.id = "rival_info_hl_spacer1" + f6_local11:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = 15 + } ) + f6_local11:animateToState( "default", 0 ) + local f6_local12 = LUI.UIText.new() + f6_local12.id = "rivalInfoAssistsValueId" + f6_local12:setText( "" ) + f6_local12:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = CoD.TextSettings.HudEuroConRegSmallFont.Height, + right = f6_local4, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right + } ) + f6_local12:animateToState( "default", 0 ) + local f6_local13 = LUI.UIText.new() + f6_local13.id = "rivalInfoDeathsValueId" + f6_local13:setText( "" ) + f6_local13:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = CoD.TextSettings.HudEuroConRegSmallFont.Height, + right = f6_local3, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right + } ) + f6_local13:animateToState( "default", 0 ) + local f6_local14 = LUI.UIText.new() + f6_local14.id = "rivalInfoKillsValueId" + f6_local14:setText( "" ) + f6_local14:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = CoD.TextSettings.HudEuroConRegSmallFont.Height, + right = f6_local2, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right + } ) + f6_local14:animateToState( "default", 0 ) + local f6_local15 = LUI.UIText.new() + f6_local15.id = "rivalInfoScoreValueId" + f6_local15:setText( "" ) + f6_local15:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = CoD.TextSettings.HudEuroConRegSmallFont.Height, + right = f6_local1, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right + } ) + f6_local15:animateToState( "default", 0 ) + f6_local10:addElement( f6_local11 ) + f6_local10:addElement( f6_local12 ) + f6_local10:addElement( f6_local13 ) + f6_local10:addElement( f6_local14 ) + f6_local10:addElement( f6_local15 ) + self:addElement( f6_local7 ) + self:addElement( f6_local8 ) + self:addElement( f6_local9 ) + self:addElement( f6_local10 ) + return self +end + +LUI.MenuBuilder.registerType( "playerInfoHudDef", function () + local self = LUI.UIElement.new() + self.id = "playerInfoHud" + self:registerAnimationState( "default", { + topAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + height = f0_local0, + width = f0_local1, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "inactive", { + alpha = 0 + } ) + self:registerEventHandler( "toggle_scoreboard", f0_local22 ) + self:registerEventHandler( "keybind", function ( element, event ) + if event.command == "togglescores" or event.command == "+scores" then + f0_local22( element, event ) + end + end ) + if not GameX.IsHardcoreMode() then + local f7_local1 = LUI.UITimer.new( 200, "player_info_refresh", "hud" ) + f7_local1.id = "playerInfoRefreshTimer" + local f7_local2 = Engine.GetDvarString( "ui_gametype" ) + self:addElement( f7_local1 ) + self:addElement( f0_local26() ) + if f7_local2 ~= "horde" then + self:addElement( f0_local27() ) + end + end + if not MLG.IsMLGSpectator() then + self:addElement( LUI.MenuBuilder.buildItems( { + type = "obituaryHudDef" + }, self.properties, self ) ) + end + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/pointspopuphud.dec.lua b/lui/mp_hud/pointspopuphud.dec.lua new file mode 100644 index 0000000..810830c --- /dev/null +++ b/lui/mp_hud/pointspopuphud.dec.lua @@ -0,0 +1,389 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 1250 +f0_local1 = 100 +f0_local2 = function ( f1_arg0, f1_arg1 ) + if f1_arg1.value == -1 then + return + elseif Game.InKillCam() and not MLG.IsMLGSpectator() then + return + end + local f1_local0 = f1_arg0:getChildById( "pointsBgImage" ) + local f1_local1 = f1_arg0:getChildById( "pointsContainer" ) + local f1_local2 = f1_local1:getChildById( "pointsValueText" ) + local f1_local3 = f1_arg0:getChildById( "ghostedPointsContainer" ) + local f1_local4 = f1_local3:getChildById( "ghostedPointsValueText" ) + if f1_arg1.value >= 0 then + f1_local2:setText( "+" .. f1_arg1.value ) + f1_local4:setText( "+" .. f1_arg1.value ) + else + f1_local2:setText( "-" .. f1_arg1.value ) + f1_local4:setText( "-" .. f1_arg1.value ) + end + local f1_local5 = MBh.AnimateSequence( { + { + "opening", + 0 + }, + { + "active", + f0_local1 + }, + { + "active", + f0_local0 + }, + { + "default", + 50 + }, + { + "default", + 50 + }, + { + "active", + 0 + }, + { + "active", + 50 + }, + { + "default", + 50 + }, + { + "default", + 50 + }, + { + "active", + 0 + }, + { + "active", + 50 + }, + { + "default", + 150 + } + } ) + f1_local5( f1_local1 ) + f1_local5 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + f0_local1 + }, + { + "active", + 0 + }, + { + "closing", + 350 + } + } ) + f1_local5( f1_local3 ) + f1_local5 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + f0_local1 + }, + { + "active", + 0 + }, + { + "closing", + 250 + } + } ) + f1_local5( f1_local0 ) +end + +local f0_local3 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0:getChildById( "pointsBgImage" ) + local f2_local1 = f2_arg0:getChildById( "pointsContainer" ) + local f2_local2 = f2_arg0:getChildById( "ghostedPointsContainer" ) + f2_local1:animateToState( "default" ) + f2_local2:animateToState( "closing" ) + f2_local0:animateToState( "closing" ) +end + +local f0_local4 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0:getChildById( "pointsDescText" ) + if Game.InKillCam() and not MLG.IsMLGSpectator() then + return + end + f3_local0:setText( Engine.Localize( "@" .. Engine.TableLookupByRow( XPEventTable.File, f3_arg1.value, XPEventTable.Cols.Name ) ) ) + local f3_local1 = MBh.AnimateSequence( { + { + "opening", + 0 + }, + { + "opening", + f0_local1 + }, + { + "active", + 150 + }, + { + "active", + f0_local0 + }, + { + "closing", + 100 + } + } ) + f3_local1( f3_local0 ) + f3_local1 = Engine.TableLookupByRow( XPEventTable.File, f3_arg1.value, XPEventTable.Cols.Sound ) + if f3_local1 and f3_local1 ~= "null" then + Engine.PlaySound( f3_local1 ) + end +end + +local f0_local5 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0:getChildById( "pointsDescText" ) + f4_local0:animateToState( "closing" ) +end + +LUI.MenuBuilder.registerType( "pointsPopupHudDef", function () + local f5_local0 = RegisterMaterial( "pointflash" ) + local self = LUI.UIElement.new() + self.id = "pointsPopupHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -85, + left = 25, + bottom = CoD.TextSettings.HudEuroNormalFont.Height - 85, + right = 57 + } ) + self:animateToState( "default", 0 ) + self:registerOmnvarHandler( "ui_points_popup", f0_local2 ) + self:registerOmnvarHandler( "ui_points_popup_desc", f0_local4 ) + if MLG.IsMLGSpectator() then + self:registerEventHandler( "playerstate_client_changed", function ( element, event ) + f0_local3( element, event ) + f0_local5( element, event ) + end ) + end + local f5_local2 = LUI.UIImage.new() + f5_local2.id = "pointsBgImage" + f5_local2:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -128, + left = -128, + bottom = 128, + right = 128, + material = f5_local0, + alpha = 0 + } ) + f5_local2:animateToState( "default", 0 ) + f5_local2:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -128, + left = -128, + bottom = 128, + right = 128, + material = f5_local0, + alpha = 1 + } ) + f5_local2:registerAnimationState( "closing", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 256, + left = -640, + bottom = -256, + right = 640, + material = f5_local0, + alpha = 0 + } ) + local f5_local3 = CoD.TextSettings.HudEuroNormalFont.Height * 0.5 + local f5_local4 = 128 + local f5_local5 = LUI.UIElement.new() + f5_local5.id = "pointsContainer" + f5_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local3, + left = -f5_local4, + bottom = f5_local3, + right = f5_local4, + alpha = 0 + } ) + f5_local5:animateToState( "default", 0 ) + f5_local5:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local3 * 10, + left = -f5_local4 * 10, + bottom = f5_local3 * 10, + right = f5_local4 * 10, + alpha = 0 + } ) + f5_local5:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local3, + left = -f5_local4, + bottom = f5_local3, + right = f5_local4, + alpha = 1 + } ) + local f5_local6 = LUI.UIText.new() + f5_local6.id = "pointsValueText" + f5_local6:setText( "" ) + f5_local6:setTextStyle( CoD.TextStyle.Shadowed ) + f5_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + f5_local6:animateToState( "default", 0 ) + f5_local5:addElement( f5_local6 ) + local f5_local7 = LUI.UIElement.new() + f5_local7.id = "ghostedPointsContainer" + f5_local7:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local3, + left = -f5_local4, + bottom = f5_local3, + right = f5_local4, + alpha = 0 + } ) + f5_local7:animateToState( "default", 0 ) + f5_local7:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local3, + left = -f5_local4, + bottom = f5_local3, + right = f5_local4, + alpha = 0.75 + } ) + f5_local7:registerAnimationState( "closing", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local3 * 2, + left = -f5_local4 * 2, + bottom = f5_local3 * 2, + right = f5_local4 * 2, + alpha = 0 + } ) + local f5_local8 = LUI.UIText.new() + f5_local8.id = "ghostedPointsValueText" + f5_local8:setText( "" ) + f5_local8:setTextStyle( CoD.TextStyle.Shadowed ) + f5_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center + } ) + f5_local8:animateToState( "default", 0 ) + f5_local7:addElement( f5_local8 ) + local f5_local9 = LUI.UIText.new() + f5_local9.id = "pointsDescText" + f5_local9:setText( "" ) + f5_local9:setTextStyle( CoD.TextStyle.Shadowed ) + f5_local9:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local3 + 20, + left = -f5_local4, + bottom = f5_local3 + 20, + right = f5_local4, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 0 + } ) + f5_local9:animateToState( "default", 0 ) + f5_local9:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local3 + 20, + left = -f5_local4 - 100, + bottom = f5_local3 + 20, + right = f5_local4 - 100, + alpha = 0 + } ) + f5_local9:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local3 + 20, + left = -f5_local4, + bottom = f5_local3 + 20, + right = f5_local4, + alpha = 1 + } ) + f5_local9:registerAnimationState( "closing", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f5_local3 + 20, + left = -f5_local4 + 100, + bottom = f5_local3 + 20, + right = f5_local4 + 100, + alpha = 0 + } ) + self:addElement( f5_local2 ) + self:addElement( f5_local7 ) + self:addElement( f5_local5 ) + self:addElement( f5_local9 ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/predatormissileoverlayhud.dec.lua b/lui/mp_hud/predatormissileoverlayhud.dec.lua new file mode 100644 index 0000000..fb42639 --- /dev/null +++ b/lui/mp_hud/predatormissileoverlayhud.dec.lua @@ -0,0 +1,274 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + if Engine.IsConsoleGame() then + local f1_local0 = f1_arg0:getChildById( "predatorMissileControlsVLId" ) + local f1_local1 = f1_local0:getChildById( "steeringTextId" ) + if IsCurrentSticksLayoutSouthpaw() then + f1_local1:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_AIM_SOUTHPAW" ) ) + elseif IsCurrentSticksLayoutLegacy() or IsCurrentSticksLayoutLegacySouthpaw() then + f1_local1:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_AIM_LEGACY" ) ) + else + f1_local1:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_AIM" ) ) + end + end + if f1_arg1.value == 1 then + f1_arg0:animateToState( "active", 0 ) + local f1_local0 = f1_arg0:getChildById( "predatorMissileReticleImageId" ) + local f1_local2 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 0 + } + } ) + f1_local2( f1_local0 ) + f1_local2 = f1_arg0:getChildById( "predatorMissileControlsVLId" ) + local f1_local3 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 150 + } + } ) + f1_local3( f1_local2 ) + elseif f1_arg1.value == 2 then + local f1_local0 = f1_arg0:getChildById( "predatorMissileStaticId" ) + f1_local0:animateToState( "active", 0 ) + local f1_local1 = f1_arg0:getChildById( "predatorMissileReticleImageId" ) + f1_local1:animateToState( "default", 0 ) + local f1_local2 = f1_arg0:getChildById( "predatorMissileControlsVLId" ) + f1_local2:animateToState( "default", 0 ) + else + f1_arg0:animateToState( "default", 0 ) + local f1_local0 = f1_arg0:getChildById( "predatorMissileStaticId" ) + f1_local0:animateToState( "default", 0 ) + end +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0:getChildById( "predatorMissileControlsVLId" ) + local f2_local1 = f2_local0:getChildById( "steeringTextId" ) + local f2_local2 = f2_local0:getChildById( "boostTextId" ) + f2_local1:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_AIM" ) ) + if Game.GetOmnvar( "ui_predator_missiles_left" ) > 0 then + f2_local2:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_FIRE" ) ) + end + f2_local2:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_BOOST" ) ) +end + +function predatorMissileOverlayDef() + local f3_local0 = RegisterMaterial( "white" ) + local f3_local1 = RegisterMaterial( "ac130_overlay_grain" ) + local f3_local2 = RegisterMaterial( "missilecam_reticle" ) + local f3_local3, f3_local4 = GameX.GetScreenDims() + local self = LUI.UIElement.new() + self.id = "predatorMissileOverlayContainerId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_predator_missile", f0_local0 ) + self:registerEventHandler( "init_overlay", f0_local0 ) + self:registerEventHandler( "refresh_controls", f0_local1 ) + local f3_local6 = LUI.UIImage.new() + f3_local6.id = "predatorMissileOverlayImageId" + f3_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f3_local1, + red = 0.9, + green = 1, + blue = 1, + alpha = 0.3 + } ) + f3_local6:animateToState( "default", 0 ) + local f3_local7 = LUI.UIImage.new() + f3_local7.id = "predatorMissileReticleImageId" + f3_local7:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f3_local2, + alpha = 0 + } ) + f3_local7:animateToState( "default", 0 ) + f3_local7:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(f3_local4 * 0.5) - 80, + left = -(f3_local3 * 0.5) - 80, + bottom = f3_local4 * 0.5 + 80, + right = f3_local3 * 0.5 + 80, + material = f3_local2, + alpha = 0.5 + } ) + f3_local7:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f3_local4 * 0.5, + left = -f3_local3 * 0.5, + bottom = f3_local4 * 0.5, + right = f3_local3 * 0.5, + material = f3_local2, + alpha = 1 + } ) + local f3_local8 = LUI.UIVerticalList.new() + f3_local8.id = "predatorMissileControlsVLId" + f3_local8:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -80, + left = -256, + right = 256, + height = 64, + alpha = 0, + spacing = 0 + } ) + f3_local8:animateToState( "default", 0 ) + f3_local8:registerAnimationState( "active", { + alpha = 1 + } ) + local f3_local9 = LUI.UIText.new() + f3_local9.id = "steeringTextId" + f3_local9:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_AIM" ) ) + f3_local9:setTextStyle( CoD.TextStyle.Shadowed ) + f3_local9:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + left = 0, + right = 0, + height = CoD.TextSettings.HudEuroBigFont.Height, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Center + } ) + f3_local9:animateToState( "default", 0 ) + local f3_local10 = function () + if Game.GetOmnvar( "ui_predator_missiles_left" ) > 0 then + return Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_FIRE" ) + else + return Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_BOOST" ) + end + end + + local f3_local11 = LUI.UIText.new() + f3_local11.id = "boostTextId" + f3_local11:setText( f3_local10() ) + f3_local11:setTextStyle( CoD.TextStyle.Shadowed ) + f3_local11:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + left = 0, + right = 0, + height = CoD.TextSettings.HudEuroBigFont.Height, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Center + } ) + f3_local11:animateToState( "default", 0 ) + f3_local11:registerOmnvarHandler( "ui_predator_missiles_left", function ( f5_arg0, f5_arg1 ) + f5_arg0:setText( f3_local10() ) + end ) + f3_local8:addElement( f3_local9 ) + f3_local8:addElement( f3_local11 ) + local f3_local12 = LUI.UIElement.new() + f3_local12.id = "predatorMissileStaticId" + f3_local12:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + } ) + f3_local12:animateToState( "default", 0 ) + f3_local12:registerAnimationState( "active", { + alpha = 1 + } ) + local f3_local13 = LUI.UIImage.new() + f3_local13.id = "predatorMissileWhiteImageId" + f3_local13:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f3_local0 + } ) + f3_local13:animateToState( "default", 0 ) + local f3_local14 = LUI.UIImage.new() + f3_local14.id = "predatorMissileStaticImageId" + f3_local14:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f3_local1 + } ) + f3_local14:animateToState( "default", 0 ) + f3_local12:addElement( f3_local13 ) + f3_local12:addElement( f3_local14 ) + self:addElement( f3_local6 ) + self:addElement( f3_local7 ) + self:addElement( f3_local8 ) + self:addElement( f3_local12 ) + return self +end + +LUI.MenuBuilder.registerType( "predatorMissileOverlayDef", predatorMissileOverlayDef ) +LockTable( _M ) diff --git a/lui/mp_hud/predatoroverlayhud2.dec.lua b/lui/mp_hud/predatoroverlayhud2.dec.lua new file mode 100644 index 0000000..c6c0c05 --- /dev/null +++ b/lui/mp_hud/predatoroverlayhud2.dec.lua @@ -0,0 +1,519 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + if f1_arg1.value and f1_arg0.current_state ~= "active" then + f1_arg0:animateToState( "active", 0 ) + f1_arg0.current_state = "active" + elseif not f1_arg1.value and f1_arg0.current_state ~= "default" then + f1_arg0:animateToState( "default", 0 ) + f1_arg0.current_state = "default" + end +end + +f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3 ) + local f2_local0 = 128 + local self = LUI.UIImage.new() + self.id = "predText" .. tostring( f2_arg0 ) .. "id" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = f2_arg2 - f2_local0 / 2, + right = f2_arg1, + zRot = f2_arg3, + width = f2_local0, + height = f2_local0, + material = RegisterMaterial( "ui_predator_text01" ), + alpha = 1 + } ) + self:registerAnimationState( "1", { + material = RegisterMaterial( "ui_predator_text01" ) + } ) + self:registerAnimationState( "2", { + material = RegisterMaterial( "ui_predator_text02" ) + } ) + self:registerAnimationState( "3", { + material = RegisterMaterial( "ui_predator_text03" ) + } ) + self:registerAnimationState( "4", { + material = RegisterMaterial( "ui_predator_text04" ) + } ) + self:animateToState( "default", 0 ) + local f2_local2 = 250 + local f2_local3 = 750 + local f2_local4 = 4 + local f2_local5 = 11 + 2 * (f2_arg0 - 1) + local f2_local6 = {} + for f2_local7 = 1, f2_local5, 1 do + local f2_local10 = f2_local7 + table.insert( f2_local6, { + tostring( math.random( f2_local4 ) ), + math.random( f2_local2, f2_local3 ) + } ) + end + local f2_local8 = MBh.AnimateLoop( f2_local6 ) + f2_local8( self ) + return self +end + +f0_local2 = function () + local f3_local0 = GameX.IsSplitscreen() and 192 or 384 + local self = LUI.UIImage.new() + self.id = "predatorGraphId" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -0.5 * f3_local0, + left = 0, + width = 0.5 * f3_local0, + height = f3_local0, + material = RegisterMaterial( "ui_predator_graph_01" ), + alpha = 1 + } ) + self:registerAnimationState( "1", { + material = RegisterMaterial( "ui_predator_graph_02" ) + } ) + self:registerAnimationState( "2", { + material = RegisterMaterial( "ui_predator_graph_03" ) + } ) + self:registerAnimationState( "3", { + material = RegisterMaterial( "ui_predator_graph_04" ) + } ) + self:animateToState( "default", 0 ) + local f3_local2 = MBh.AnimateLoop( { + { + "3", + 100 + }, + { + "1", + 100 + }, + { + "2", + 50 + }, + { + "3", + 50 + }, + { + "2", + 100 + }, + { + "default", + 3000 + } + } ) + f3_local2( self ) + return self +end + +local f0_local3 = function () + local f4_local0 = 192 + local self = LUI.UIImage.new() + self.id = "predatorScanlineId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = -f4_local0, + right = undefined, + width = f4_local0, + material = RegisterMaterial( "ui_predator_wipe" ), + alpha = 1 + } ) + self:registerAnimationState( "swipe", { + leftAnchor = false, + rightAnchor = true, + left = undefined, + right = f4_local0 + } ) + self:registerOmnvarHandler( "ui_predator_hud_scanline", function ( f5_arg0, f5_arg1 ) + if f5_arg1.value then + self:animateToState( "default", 0 ) + self:animateToState( "swipe", 125 ) + else + self:animateToState( "default", 0 ) + end + end ) + self:animateToState( "default", 0 ) + return self +end + +local f0_local4 = function ( f6_arg0, f6_arg1 ) + if f6_arg1.value == 0 then + f6_arg0:animateToState( "default", 0 ) + LUI.UITimer.Stop( f6_arg0.positionTimer ) + elseif f6_arg1.value == 2 then + f6_arg0:dispatchEventToChildren( { + name = "reticleLocked" + } ) + elseif f6_arg1.value == 1 then + f6_arg0:animateToState( "active", 0 ) + LUI.UITimer.Reset( f6_arg0.positionTimer ) + f6_arg0:dispatchEventToChildren( { + name = "reticleZoom" + } ) + end +end + +local f0_local5 = function ( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_arg4, f7_arg5, f7_arg6, f7_arg7 ) + local self = LUI.UIImage.new() + self.id = f7_arg0 + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f7_arg2, + left = f7_arg3, + height = 128, + width = 128, + material = RegisterMaterial( f7_arg1 ), + zRot = f7_arg4, + alpha = 0 + } ) + self:registerAnimationState( "on", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f7_arg2, + left = f7_arg3, + height = 128, + width = 128, + zRot = f7_arg4, + alpha = 1 + } ) + self:registerAnimationState( "dim", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f7_arg2, + left = f7_arg3, + height = 128, + width = 128, + zRot = f7_arg4, + alpha = 0.25 + } ) + self:registerAnimationState( "large", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f7_arg6, + left = f7_arg7, + height = 500, + width = 500, + zRot = f7_arg4, + alpha = 1 + } ) + local f7_local1 = 50 + self:animateToState( "default", 0 ) + self:registerEventHandler( "reticleLocked", MBh.AnimateSequence( { + { + "dim", + f7_local1 + }, + { + "on", + f7_local1 + }, + { + "dim", + f7_local1 + }, + { + "on", + f7_local1 + }, + { + "dim", + f7_local1 + }, + { + "on", + f7_local1 + } + } ) ) + self:registerEventHandler( "reticleZoom", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "large", + 0 + }, + { + "on", + f7_arg5 + } + } ) ) + return self +end + +local f0_local6 = function () + local self = LUI.UIElement.new() + self.id = "predatorReticleConainterId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + width = 1, + height = 1, + alpha = 0 + } ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:animateToState( "default", 0 ) + local f8_local1 = LUI.UITimer.new( 16, "updateTargetPos", nil, false, false, false, true ) + f8_local1.id = "predatorReticleTimerId" + self.positionTimer = f8_local1 + self:addElement( f8_local1 ) + self:registerEventHandler( "updateTargetPos", function ( element, event ) + local f9_local0 = Game.GetOmnvar( "ui_predator_target_ent" ) + if f9_local0 > -1 then + local f9_local1, f9_local2 = Game.GetScreenLocation( f9_local0, "j_spineupper" ) + if f9_local1 and f9_local2 then + local f9_local3, f9_local4 = nil + local f9_local5 = ScreenResolution[currentScreenResolution] + element:registerAnimationState( "position", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = LUI.clamp( f9_local2, 0, f9_local5.height ), + left = LUI.clamp( f9_local1, 0, f9_local5.width ), + width = 0, + height = 0, + alpha = 1 + } ) + element:animateToState( "position", 0 ) + end + end + end ) + self:registerOmnvarHandler( "ui_predator_hud_reticle", f0_local4 ) + for f8_local5, f8_local6 in pairs( { + { + elementName = "predatorReticleBottomId", + imageName = "ui_predator_reticle_bottom", + vertOffset = -50, + horizOffset = -60, + zRot = 0, + zoomInTime = 375, + zoomInVert = 500, + zoomInHoriz = -60 + }, + { + elementName = "predatorReticleRightId", + imageName = "ui_predator_reticle_side", + vertOffset = -82, + horizOffset = -46, + zRot = 0, + zoomInTime = 375, + zoomInVert = -800, + zoomInHoriz = 800 + }, + { + elementName = "predatorReticleLeftId", + imageName = "ui_predator_reticle_side", + vertOffset = -76, + horizOffset = -84, + zRot = 122, + zoomInTime = 375, + zoomInVert = -800, + zoomInHoriz = -800 + } + } ) do + self:addElement( f0_local5( f8_local6.elementName, f8_local6.imageName, f8_local6.vertOffset, f8_local6.horizOffset, f8_local6.zRot, f8_local6.zoomInTime, f8_local6.zoomInVert, f8_local6.zoomInHoriz ) ) + end + return self +end + +local f0_local7 = function ( f10_arg0, f10_arg1, f10_arg2 ) + local self = LUI.UIText.new() + self.id = f10_arg0 + self:setText( Engine.Localize( f10_arg1 ) ) + self:setTextStyle( CoD.TextStyle.Shadowed ) + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + left = 0, + right = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 1, + green = 1, + blue = 1, + alignment = f10_arg2, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "flash1", { + red = 1, + green = 0, + blue = 0, + alpha = 0.5 + } ) + self:registerAnimationState( "flash2", { + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + } ) + self:registerEventHandler( "flashing", MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) ) + self:registerEventHandler( "stop_flashing", MBh.AnimateToState( "default", 0 ) ) + return self +end + +local f0_local8 = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3, f11_arg4 ) + local f11_local0 = "Right" + local f11_local1 = LUI.Alignment.Left + local f11_local2 = 600 + local f11_local3 = undefined + local f11_local4 = f11_local2 + if f11_arg3 then + f11_local0 = "Left" + f11_local1 = LUI.Alignment.Right + f11_local3 = -f11_local2 + f11_local4 = undefined + end + local f11_local5 = f11_arg0 .. f11_local0 + local self = LUI.UIElement.new() + self.id = f11_local5 + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + left = f11_local3, + right = f11_local4, + top = f11_arg4, + bottom = f11_arg4 + 64, + width = 512, + alpha = 0 + } ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerAnimationState( "blink", { + alpha = 0.5 + } ) + self:animateToState( "default", 0 ) + local f11_local7 = LUI.UIVerticalList.new() + f11_local7.id = f11_local5 .. "vList" + f11_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + spacing = 20 + } ) + f11_local7:animateToState( "default", 0 ) + f11_local7:addElement( f0_local7( f11_local5 .. "Trigger", f11_arg2, f11_local1 ) ) + self:addElement( f11_local7 ) + return self +end + +LUI.MenuBuilder.registerType( "juggPredatorOverlayDef", function () + local self = LUI.UIElement.new() + self.id = "juggPredatorOverlayContainerId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_predator_hud_graph", f0_local0 ) + self:registerEventHandler( "init_overlay", f0_local0 ) + local f12_local1 = LUI.UIImage.new() + f12_local1.id = "juggPredatorOverlayImgId" + f12_local1:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + material = RegisterMaterial( "ui_predator_overlay" ), + alpha = 1 + } ) + f12_local1:animateToState( "default", 0 ) + self:addElement( f12_local1 ) + local f12_local2 = 128 + if GameX.IsSplitscreen() then + f12_local2 = 36 + end + local f12_local3 = f0_local8( "predatorControls", "@MP_JUGG_PREDATOR_UI_CLOAK", "@MP_JUGG_PREDATOR_UI_VISION", true, f12_local2 ) + self:addElement( f12_local3 ) + f12_local3:animateToState( "active" ) + local f12_local4 = f0_local8( "predatorControls", "@MP_JUGG_PREDATOR_UI_VISION", "@MP_JUGG_PREDATOR_UI_FIRE", false, f12_local2 ) + f12_local4:registerOmnvarHandler( "ui_predator_hud_reticle", function ( f13_arg0, f13_arg1 ) + if f13_arg1.value == 0 then + f13_arg0:animateToState( "default", 0 ) + elseif f13_arg1.value == 2 then + f13_arg0:animateToState( "active", 1 ) + elseif f13_arg1.value == 3 then + local f13_local0 = MBh.AnimateLoop( { + { + "blink", + 250 + }, + { + "active", + 250 + } + } ) + f13_local0( f13_arg0, f13_arg1 ) + end + end ) + self:addElement( f12_local4 ) + self:addElement( f0_local2() ) + local f12_local5 = nil + if not GameX.IsSplitscreen() then + self:addElement( f0_local1( 0, -45, -120, 25 ) ) + self:addElement( f0_local1( 3, -45, 110, -50 ) ) + end + self:addElement( f0_local1( 1, -20, -50, 0 ) ) + self:addElement( f0_local1( 2, -20, 30, 0 ) ) + self:addElement( f0_local6() ) + self:addElement( f0_local3() ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/roundendhud.dec.lua b/lui/mp_hud/roundendhud.dec.lua new file mode 100644 index 0000000..0a009c7 --- /dev/null +++ b/lui/mp_hud/roundendhud.dec.lua @@ -0,0 +1,1287 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetTeamBasedReasonString( f1_arg0, f1_arg1 ) + return Engine.Localize( f1_arg1, GameX.GetLocalizedTeamNameMixedCase( f1_arg0 ) ) +end + +f0_local0 = { + "@MP_DRAW", + "@MP_ROUND_DRAW", + "@MP_ROUND_WIN", + "@MP_ROUND_LOSS", + "@MP_VICTORY", + "@MP_DEFEAT", + "@MP_HALFTIME", + "@MP_OVERTIME", + "@MP_ROUNDEND", + "@MP_INTERMISSION", + "@MP_SWITCHING_SIDES", + "@MP_MATCH_BONUS_IS", + "@MP_MATCH_TIE", + "@MP_ROUNDEND" +} +f0_local1 = { + "@MP_SCORE_LIMIT_REACHED", + "@MP_TIME_LIMIT_REACHED", + "@MP_PLAYERS_FORFEITED", + "@MP_TARGET_DESTROYED", + "@MP_BOMB_DEFUSED", + function () + return GetTeamBasedReasonString( Teams.allies, "@LUA_MENU_MP_TEAM_ELIMINATED" ) + end, + function () + return GetTeamBasedReasonString( Teams.axis, "@LUA_MENU_MP_TEAM_ELIMINATED" ) + end, + function () + return GetTeamBasedReasonString( Teams.allies, "@LUA_MENU_MP_TEAM_FORFEITED" ) + end, + function () + return GetTeamBasedReasonString( Teams.axis, "@LUA_MENU_MP_TEAM_FORFEITED" ) + end, + "@MP_ENEMIES_ELIMINATED", + "@MP_MATCH_TIE", + "@GAME_OBJECTIVECOMPLETED", + "@GAME_OBJECTIVEFAILED", + "@MP_SWITCHING_SIDES", + "@MP_ROUND_LIMIT_REACHED", + "@MP_ENDED_GAME", + "@MP_HOST_ENDED_GAME" +} +f0_local2 = { + "@MP_FIRSTPLACE_NAME", + "@MP_SECONDPLACE_NAME", + "@MP_THIRDPLACE_NAME" +} +local f0_local3 = function ( f6_arg0 ) + local f6_local0 = f0_local1[f6_arg0] + if type( f6_local0 ) == "function" then + return f6_local0() + else + return Engine.Localize( f6_local0 ) + end +end + +local f0_local4 = function ( f7_arg0 ) + local f7_local0 = f7_arg0 or 0 + if not Engine.UsingSplitscreenUpscaling() then + return { + top = -225 + f7_local0, + height = 128, + width = 512, + alpha = 0 + } + else + local f7_local1 = {} + f7_local1 = GameX.GetSafeZoneSize() + return { + topAnchor = true, + top = f7_local1[2] + 10 + f7_local0, + height = 128, + width = 512, + alpha = 0 + } + end +end + +local f0_local5 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = Engine.GetLuiRoot() + f8_local0.hudManager:closeRoundEndScreen() +end + +local f0_local6 = function ( f9_arg0, f9_arg1 ) + if f9_arg1.value == 0 then + return + end + local f9_local0 = RegisterMaterial( "hud_round_end_fed" ) + local f9_local1 = RegisterMaterial( "hud_round_end_ghost" ) + local f9_local2 = f9_arg0:getChildById( "round_end_center" ) + local f9_local3 = f9_local2:getChildById( "round_end_text" ) + local f9_local4 = f9_local2:getChildById( "round_end_reason_text" ) + local f9_local5 = f9_local2:getChildById( "round_end_match_bonus_text" ) + local f9_local6 = f9_arg0:getChildById( "round_end_left_icon" ) + local f9_local7 = f9_local6:getChildById( "round_end_left_icon_faction" ) + local f9_local8 = f9_arg0:getChildById( "round_end_right_icon" ) + local f9_local9 = f9_local8:getChildById( "round_end_right_icon_faction" ) + local f9_local10 = f9_arg0:getChildById( "left_score_bg" ) + local f9_local11 = f9_local10:getChildById( "left_score" ) + local f9_local12 = f9_arg0:getChildById( "right_score_bg" ) + local f9_local13 = f9_local12:getChildById( "right_score" ) + local f9_local14 = Game.GetOmnvar( "ui_round_end_title" ) + local f9_local15 = Game.GetOmnvar( "ui_round_end_reason" ) + f9_local3:setText( Engine.Localize( f0_local0[f9_local14] ) ) + local f9_local16 = "" + if f9_local15 > 0 then + f9_local16 = f0_local3( f9_local15 ) + end + f9_local4:setText( f9_local16 ) + if 0 < Game.GetOmnvar( "ui_round_end_match_bonus" ) then + f9_local5:setText( Engine.Localize( "@MP_MATCH_BONUS_IS", Game.GetOmnvar( "ui_round_end_match_bonus" ) ) ) + else + f9_local5:setText( "" ) + end + local f9_local17 = Game.GetPlayerTeam() + if MLG.IsMLGSpectator() then + f9_local17 = Game.GetLastMLGSpectateTeam() + end + if GameX.GetTeamName( f9_local17 ) == "allies" or f9_local17 == Teams.spectator then + CoD.SetMaterial( f9_local7, f9_local1 ) + CoD.SetMaterial( f9_local9, f9_local0 ) + else + CoD.SetMaterial( f9_local7, f9_local0 ) + CoD.SetMaterial( f9_local9, f9_local1 ) + end + f9_local11:setText( Game.GetOmnvar( "ui_round_end_friendly_score" ) ) + f9_local13:setText( Game.GetOmnvar( "ui_round_end_enemy_score" ) ) + f9_arg0:animateToState( "active", 0 ) + local f9_local18 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f9_local18( f9_local6 ) + f9_local18 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 150 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f9_local18( f9_local8 ) + f9_local18 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 300 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f9_local18( f9_local10 ) + f9_local18 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 500 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f9_local18( f9_local12 ) + f9_local18 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 750 + }, + { + "active", + 150 + } + } ) + f9_local18( f9_local3 ) + f9_local18 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 950 + }, + { + "active", + 150 + } + } ) + f9_local18( f9_local4 ) + f9_local18 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 1050 + }, + { + "active", + 150 + } + } ) + f9_local18( f9_local5 ) +end + +local f0_local7 = function ( f10_arg0, f10_arg1 ) + if f10_arg1.value == 0 then + return + end + local f10_local0 = f10_arg0:getChildById( "round_end_center" ) + local f10_local1 = f10_local0:getChildById( "round_end_text" ) + local f10_local2 = f10_local0:getChildById( "round_end_reason_text" ) + local f10_local3 = f10_local0:getChildById( "round_end_match_bonus_text" ) + local f10_local4 = f10_arg0:getChildById( "first_place_image" ) + local f10_local5 = f10_arg0:getChildById( "second_place_image" ) + local f10_local6 = f10_arg0:getChildById( "third_place_image" ) + local f10_local7 = f10_local4:getChildById( "first_place_name" ) + local f10_local8 = f10_local5:getChildById( "second_place_name" ) + local f10_local9 = f10_local6:getChildById( "third_place_name" ) + local f10_local10 = Game.GetOmnvar( "ui_round_end_title" ) + local f10_local11 = Game.GetOmnvar( "ui_round_end_reason" ) + f10_local1:setText( Engine.Localize( f0_local0[f10_local10] ) ) + f10_local2:setText( f0_local3( f10_local11 ) ) + if 0 < Game.GetOmnvar( "ui_round_end_match_bonus" ) then + f10_local3:setText( Engine.Localize( "@MP_MATCH_BONUS_IS", Game.GetOmnvar( "ui_round_end_match_bonus" ) ) ) + else + f10_local3:setText( "" ) + end + local f10_local12 = Game.GetPlayerTeam() + local f10_local13 = Game.GetPlayerScoreInfoAtRank( f10_local12, 1 ) + local f10_local14 = Game.GetPlayerScoreInfoAtRank( f10_local12, 2 ) + local f10_local15 = Game.GetPlayerScoreInfoAtRank( f10_local12, 3 ) + if f10_local13 then + f10_local7:setText( f10_local13.name ) + end + if f10_local14 then + f10_local8:setText( f10_local14.name ) + end + if f10_local15 then + f10_local9:setText( f10_local15.name ) + end + f10_arg0:animateToState( "active", 0 ) + local f10_local16 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f10_local16( f10_local0 ) + if f10_local13 then + f10_local16 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 150 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f10_local16( f10_local4 ) + end + if f10_local14 then + f10_local16 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 300 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f10_local16( f10_local5 ) + end + if f10_local15 then + f10_local16 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 500 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f10_local16( f10_local6 ) + end + f10_local16 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 750 + }, + { + "active", + 150 + } + } ) + f10_local16( f10_local1 ) + f10_local16 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 950 + }, + { + "active", + 150 + } + } ) + f10_local16( f10_local2 ) + f10_local16 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 1050 + }, + { + "active", + 150 + } + } ) + f10_local16( f10_local3 ) +end + +local f0_local8 = function ( f11_arg0, f11_arg1 ) + if f11_arg1.value == 0 then + return + end + local f11_local0 = f11_arg0:getChildById( "round_end_center" ) + local f11_local1 = f11_local0:getChildById( "round_end_text" ) + local f11_local2 = f11_local0:getChildById( "round_end_reason_text" ) + local f11_local3 = f11_local0:getChildById( "round_end_match_bonus_text" ) + local f11_local4 = Game.GetOmnvar( "ui_round_end_title" ) + local f11_local5 = Game.GetOmnvar( "ui_round_end_reason" ) + f11_local1:setText( Engine.Localize( f0_local0[f11_local4] ) ) + f11_local2:setText( f0_local3( f11_local5 ) ) + if 0 < Game.GetOmnvar( "ui_round_end_match_bonus" ) then + f11_local3:setText( Engine.Localize( "@MP_MATCH_BONUS_IS", Game.GetOmnvar( "ui_round_end_match_bonus" ) ) ) + else + f11_local3:setText( "" ) + end + f11_arg0:animateToState( "active", 0 ) + local f11_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f11_local6( f11_local0 ) + f11_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 750 + }, + { + "active", + 150 + } + } ) + f11_local6( f11_local1 ) + f11_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 950 + }, + { + "active", + 150 + } + } ) + f11_local6( f11_local2 ) + f11_local6 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 1050 + }, + { + "active", + 150 + } + } ) + f11_local6( f11_local3 ) +end + +local f0_local9 = function () + local f12_local0 = RegisterMaterial( "white" ) + local f12_local1 = RegisterMaterial( "hud_round_end_center" ) + local f12_local2 = RegisterMaterial( "hud_round_end_score_bg" ) + local f12_local3 = RegisterMaterial( "hud_round_end_blue" ) + local f12_local4 = RegisterMaterial( "hud_round_end_orange" ) + local self = LUI.UIElement.new( f0_local4() ) + self.id = "round_end_hud" + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_round_end_update_data", f0_local6 ) + self:registerEventHandler( "post_game_end", f0_local5 ) + self:registerEventHandler( "intermission_began", f0_local5 ) + self:registerOmnvarHandler( "ui_killcam_end_milliseconds", f0_local5 ) + local f12_local6 = LUI.UIImage.new() + f12_local6.id = "round_end_center" + f12_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f12_local1 + } ) + f12_local6:animateToState( "default", 0 ) + local f12_local7 = LUI.UIText.new() + f12_local7.id = "round_end_text" + f12_local7:setText( "" ) + f12_local7:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.ExtraBigFont.Height / 2) + 25, + left = -256, + height = CoD.TextSettings.ExtraBigFont.Height, + width = 512, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.ExtraBigFont.Font, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f12_local7:animateToState( "default", 0 ) + f12_local7:registerAnimationState( "active", { + alpha = 1 + } ) + local f12_local8 = LUI.UIText.new() + f12_local8.id = "round_end_reason_text" + f12_local8:setText( "" ) + f12_local8:setTextStyle( CoD.TextStyle.Outlined ) + f12_local8:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.BigFont.Height / 2) + 70, + left = -256, + height = CoD.TextSettings.BigFont.Height, + width = 512, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.BigFont.Font, + alpha = 0 + } ) + f12_local8:animateToState( "default", 0 ) + f12_local8:registerAnimationState( "active", { + alpha = 1 + } ) + local f12_local9 = LUI.UIText.new() + f12_local9.id = "round_end_match_bonus_text" + f12_local9:setText( "" ) + f12_local9:setTextStyle( CoD.TextStyle.Shadowed ) + f12_local9:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.BigFont.Height / 2) - 60, + left = -256, + height = CoD.TextSettings.BigFont.Height, + width = 512, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.BigFont.Font, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 0 + } ) + f12_local9:animateToState( "default", 0 ) + f12_local9:registerAnimationState( "active", { + alpha = 1 + } ) + f12_local6:addElement( f12_local7 ) + f12_local6:addElement( f12_local8 ) + f12_local6:addElement( f12_local9 ) + local f12_local10 = LUI.UIImage.new() + f12_local10.id = "round_end_left_icon" + f12_local10:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -564, + left = -564, + height = 256, + width = 256, + material = f12_local3, + alpha = 0 + } ) + f12_local10:animateToState( "default", 0 ) + f12_local10:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -54, + left = -237, + height = 128, + width = 128, + alpha = 1 + } ) + f12_local10:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -64, + left = -247, + height = 128, + width = 128, + alpha = 1 + } ) + local f12_local11 = LUI.UIImage.new() + f12_local11.id = "round_end_left_icon_faction" + f12_local11:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -64, + left = -64, + height = 128, + width = 128, + material = f12_local0 + } ) + f12_local11:animateToState( "default", 0 ) + f12_local10:addElement( f12_local11 ) + local f12_local12 = LUI.UIImage.new() + f12_local12.id = "round_end_right_icon" + f12_local12:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 436, + left = 436, + height = 256, + width = 256, + material = f12_local4, + alpha = 0 + } ) + f12_local12:animateToState( "default", 0 ) + f12_local12:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -74, + left = 109, + height = 128, + width = 128, + alpha = 1 + } ) + f12_local12:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -64, + left = 119, + height = 128, + width = 128, + alpha = 1 + } ) + local f12_local13 = LUI.UIImage.new() + f12_local13.id = "round_end_right_icon_faction" + f12_local13:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -64, + left = -64, + height = 128, + width = 128, + material = f12_local0 + } ) + f12_local13:animateToState( "default", 0 ) + f12_local12:addElement( f12_local13 ) + local f12_local14 = LUI.UIImage.new() + f12_local14.id = "left_score_bg" + f12_local14:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -728, + height = 64, + width = 256, + material = f12_local2, + alpha = 0 + } ) + f12_local14:animateToState( "default", 0 ) + f12_local14:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -421, + height = 64, + width = 256, + alpha = 1 + } ) + f12_local14:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -431, + height = 64, + width = 256, + alpha = 1 + } ) + local f12_local15 = LUI.UIText.new() + f12_local15.id = "left_score" + f12_local15:setText( "" ) + f12_local15:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.HudDigitalExtraBigFont.Height / 2) - 5, + left = -64, + height = CoD.TextSettings.HudDigitalExtraBigFont.Height, + width = 128, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudDigitalExtraBigFont.Font, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f12_local15:animateToState( "default", 0 ) + f12_local14:addElement( f12_local15 ) + local f12_local16 = LUI.UIImage.new() + f12_local16.id = "right_score_bg" + f12_local16:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 728, + height = 64, + width = -256, + material = f12_local2, + alpha = 0 + } ) + f12_local16:animateToState( "default", 0 ) + f12_local16:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 421, + height = 64, + width = -256, + alpha = 1 + } ) + f12_local16:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 431, + height = 64, + width = -256, + alpha = 1 + } ) + local f12_local17 = LUI.UIText.new() + f12_local17.id = "right_score" + f12_local17:setText( "" ) + f12_local17:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.HudDigitalExtraBigFont.Height / 2) - 5, + left = -64, + height = CoD.TextSettings.HudDigitalExtraBigFont.Height, + width = 128, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.HudDigitalExtraBigFont.Font, + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b + } ) + f12_local17:animateToState( "default", 0 ) + f12_local16:addElement( f12_local17 ) + self:addElement( f12_local6 ) + self:addElement( f12_local10 ) + self:addElement( f12_local12 ) + self:addElement( f12_local14 ) + self:addElement( f12_local16 ) + return self +end + +local f0_local10 = function () + local f13_local0 = RegisterMaterial( "hud_round_end_ffa_top" ) + local f13_local1 = RegisterMaterial( "hud_round_end_ffa_first" ) + local f13_local2 = RegisterMaterial( "hud_round_end_ffa_second" ) + local f13_local3 = RegisterMaterial( "hud_round_end_ffa_third" ) + local self = LUI.UIElement.new( f0_local4( 25 ) ) + self.id = "round_end_hud" + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_round_end_update_data", f0_local7 ) + self:registerEventHandler( "post_game_end", f0_local5 ) + self:registerEventHandler( "intermission_began", f0_local5 ) + self:registerOmnvarHandler( "ui_killcam_end_milliseconds", f0_local5 ) + local f13_local5 = LUI.UIImage.new() + f13_local5.id = "round_end_center" + f13_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -70, + left = -856, + height = 128, + width = 512, + material = f13_local0, + alpha = 0 + } ) + f13_local5:animateToState( "default", 0 ) + f13_local5:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -70, + left = -246, + height = 128, + width = 512, + alpha = 1 + } ) + f13_local5:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -70, + left = -256, + height = 128, + width = 512, + alpha = 1 + } ) + local f13_local6 = LUI.UIText.new() + f13_local6.id = "round_end_text" + f13_local6:setText( "" ) + f13_local6:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.ExtraBigFont.Height / 2) - 20, + left = -256, + height = CoD.TextSettings.ExtraBigFont.Height, + width = 512, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.ExtraBigFont.Font, + alpha = 0 + } ) + f13_local6:animateToState( "default", 0 ) + f13_local6:registerAnimationState( "active", { + alpha = 1 + } ) + local f13_local7 = LUI.UIText.new() + f13_local7.id = "round_end_reason_text" + f13_local7:setText( "" ) + f13_local7:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.BigFont.Height / 2) + 20, + left = -256, + height = CoD.TextSettings.BigFont.Height, + width = 512, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.BigFont.Font, + alpha = 0 + } ) + f13_local7:animateToState( "default", 0 ) + f13_local7:registerAnimationState( "active", { + alpha = 0.5 + } ) + local f13_local8 = LUI.UIText.new() + f13_local8.id = "round_end_match_bonus_text" + f13_local8:setText( "" ) + f13_local8:setTextStyle( CoD.TextStyle.Shadowed ) + f13_local8:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.BigFont.Height / 2) - 60, + left = -256, + height = CoD.TextSettings.BigFont.Height, + width = 512, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.BigFont.Font, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 0 + } ) + f13_local8:animateToState( "default", 0 ) + f13_local8:registerAnimationState( "active", { + alpha = 1 + } ) + f13_local5:addElement( f13_local6 ) + f13_local5:addElement( f13_local7 ) + f13_local5:addElement( f13_local8 ) + local f13_local9 = LUI.UIImage.new() + f13_local9.id = "first_place_image" + f13_local9:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 15, + left = 370, + height = 128, + width = 512, + material = f13_local1, + alpha = 0 + } ) + f13_local9:animateToState( "default", 0 ) + f13_local9:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 15, + left = -240, + height = 128, + width = 512, + alpha = 1 + } ) + f13_local9:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 15, + left = -230, + height = 128, + width = 512, + alpha = 1 + } ) + local f13_local10 = LUI.UIText.new() + f13_local10.id = "first_place_text" + f13_local10:setText( Engine.Localize( "@LUA_MENU_1ST" ) ) + f13_local10:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.BigFont.Height / 2), + left = 100, + height = CoD.TextSettings.BigFont.Height, + width = 256, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.BigFont.Font + } ) + f13_local10:animateToState( "default", 0 ) + local f13_local11 = LUI.UIText.new() + f13_local11.id = "first_place_name" + f13_local11:setText( "" ) + f13_local11:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.BigFont.Height / 2), + left = 170, + height = CoD.TextSettings.BigFont.Height, + width = 256, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.BigFont.Font + } ) + f13_local11:animateToState( "default", 0 ) + f13_local9:addElement( f13_local10 ) + f13_local9:addElement( f13_local11 ) + local f13_local12 = LUI.UIImage.new() + f13_local12.id = "second_place_image" + f13_local12:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 80, + left = 390, + height = 128, + width = 512, + material = f13_local2, + alpha = 0 + } ) + f13_local12:animateToState( "default", 0 ) + f13_local12:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 80, + left = -220, + height = 128, + width = 512, + alpha = 1 + } ) + f13_local12:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 80, + left = -210, + height = 128, + width = 512, + alpha = 1 + } ) + local f13_local13 = LUI.UIText.new() + f13_local13.id = "second_place_text" + f13_local13:setText( Engine.Localize( "@LUA_MENU_2ND" ) ) + f13_local13:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.NormalFont.Height / 2), + left = 90, + height = CoD.TextSettings.NormalFont.Height, + width = 256, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font + } ) + f13_local13:animateToState( "default", 0 ) + local f13_local14 = LUI.UIText.new() + f13_local14.id = "second_place_name" + f13_local14:setText( "" ) + f13_local14:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.NormalFont.Height / 2), + left = 155, + height = CoD.TextSettings.NormalFont.Height, + width = 256, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font + } ) + f13_local14:animateToState( "default", 0 ) + f13_local12:addElement( f13_local13 ) + f13_local12:addElement( f13_local14 ) + local f13_local15 = LUI.UIImage.new() + f13_local15.id = "third_place_image" + f13_local15:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 138, + left = 423, + height = 128, + width = 512, + material = f13_local3, + alpha = 0 + } ) + f13_local15:animateToState( "default", 0 ) + f13_local15:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 138, + left = -187, + height = 128, + width = 512, + alpha = 1 + } ) + f13_local15:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 138, + left = -177, + height = 128, + width = 512, + alpha = 1 + } ) + local f13_local16 = LUI.UIText.new() + f13_local16.id = "third_place_text" + f13_local16:setText( Engine.Localize( "@LUA_MENU_3RD" ) ) + f13_local16:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.NormalFont.Height / 2), + left = 80, + height = CoD.TextSettings.NormalFont.Height, + width = 256, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font + } ) + f13_local16:animateToState( "default", 0 ) + local f13_local17 = LUI.UIText.new() + f13_local17.id = "third_place_name" + f13_local17:setText( "" ) + f13_local17:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.NormalFont.Height / 2), + left = 145, + height = CoD.TextSettings.NormalFont.Height, + width = 256, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font + } ) + f13_local17:animateToState( "default", 0 ) + f13_local15:addElement( f13_local16 ) + f13_local15:addElement( f13_local17 ) + self:addElement( f13_local5 ) + self:addElement( f13_local15 ) + self:addElement( f13_local12 ) + self:addElement( f13_local9 ) + return self +end + +local f0_local11 = function () + local f14_local0 = RegisterMaterial( "hud_round_end_ffa_top" ) + local self = LUI.UIElement.new( f0_local4( 25 ) ) + self.id = "round_end_hud" + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_round_end_update_data", f0_local8 ) + self:registerEventHandler( "post_game_end", f0_local5 ) + self:registerEventHandler( "intermission_began", f0_local5 ) + self:registerOmnvarHandler( "ui_killcam_end_milliseconds", f0_local5 ) + local f14_local2 = LUI.UIImage.new() + f14_local2.id = "round_end_center" + f14_local2:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -70, + left = -856, + height = 128, + width = 512, + material = f14_local0, + alpha = 0 + } ) + f14_local2:animateToState( "default", 0 ) + f14_local2:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -70, + left = -246, + height = 128, + width = 512, + alpha = 1 + } ) + f14_local2:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -70, + left = -256, + height = 128, + width = 512, + alpha = 1 + } ) + local f14_local3 = LUI.UIText.new() + f14_local3.id = "round_end_text" + f14_local3:setText( "" ) + f14_local3:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.ExtraBigFont.Height / 2) - 20, + left = -256, + height = CoD.TextSettings.ExtraBigFont.Height, + width = 512, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.ExtraBigFont.Font, + alpha = 0 + } ) + f14_local3:animateToState( "default", 0 ) + f14_local3:registerAnimationState( "active", { + alpha = 1 + } ) + local f14_local4 = LUI.UIText.new() + f14_local4.id = "round_end_reason_text" + f14_local4:setText( "" ) + f14_local4:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.BigFont.Height / 2) + 20, + left = -256, + height = CoD.TextSettings.BigFont.Height, + width = 512, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.BigFont.Font, + alpha = 0 + } ) + f14_local4:animateToState( "default", 0 ) + f14_local4:registerAnimationState( "active", { + alpha = 0.5 + } ) + local f14_local5 = LUI.UIText.new() + f14_local5.id = "round_end_match_bonus_text" + f14_local5:setText( "" ) + f14_local5:setTextStyle( CoD.TextStyle.Shadowed ) + f14_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -(CoD.TextSettings.BigFont.Height / 2) - 60, + left = -256, + height = CoD.TextSettings.BigFont.Height, + width = 512, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.BigFont.Font, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 0 + } ) + f14_local5:animateToState( "default", 0 ) + f14_local5:registerAnimationState( "active", { + alpha = 1 + } ) + f14_local2:addElement( f14_local3 ) + f14_local2:addElement( f14_local4 ) + f14_local2:addElement( f14_local5 ) + self:addElement( f14_local2 ) + return self +end + +LUI.MenuBuilder.registerType( "roundEndHudDef", function () + if GameX.GetGameMode() == "horde" then + return f0_local11() + elseif GameX.gameModeIsFFA() then + return f0_local10() + else + return f0_local9() + end +end ) +LockTable( _M ) diff --git a/lui/mp_hud/scoreboard.dec.lua b/lui/mp_hud/scoreboard.dec.lua new file mode 100644 index 0000000..3774e2e --- /dev/null +++ b/lui/mp_hud/scoreboard.dec.lua @@ -0,0 +1,1345 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = { + white = { + 1, + 1, + 1, + 1 + }, + gray = { + 0.5, + 0.5, + 0.5, + 1 + }, + black = { + 0, + 0, + 0, + 1 + } +} +f0_local1 = function ( f1_arg0 ) + local f1_local0 = GameX.gameModeIsFFA( f1_arg0 ) + local f1_local1 = { + default = { + "score", + "kills", + "deaths", + "assists" + }, + war = { + "score", + "kills", + "deaths", + "assists" + }, + dom = { + "score", + "kills", + "deaths", + "captures" + }, + sd = { + "score", + "kills", + "deaths", + "plants" + }, + conf = { + "score", + "kills", + "deaths", + "tags" + }, + dm = { + "dm_score", + "kills", + "deaths", + "dm_streak" + }, + sr = { + "score", + "kills", + "deaths", + "rescues" + }, + blitz = { + "score", + "kills", + "deaths", + "captures" + }, + cranked = { + "score", + "kills", + "deaths", + "assists" + }, + cranked_ffa = { + "cranked_ffa_score", + "kills", + "deaths", + "assists" + }, + sotf = { + "score", + "kills", + "deaths", + "assists" + }, + sotf_ffa = { + "sotf_ffa_score", + "kills", + "deaths", + "dm_streak" + }, + infect = { + "score", + "kills", + "deaths", + "time" + }, + grind = { + "score", + "kills", + "deaths", + "scores" + }, + horde = { + "kills", + "revives", + "crates" + }, + gun = { + "score", + "kills", + "deaths", + "gun_knives" + }, + siege = { + "score", + "kills", + "deaths", + "captures" + } + } + local f1_local2 = { + score = { + "LUA_MENU_SCORE", + "score" + }, + kills = { + "LUA_MENU_KILLS", + "kills" + }, + deaths = { + "LUA_MENU_DEATHS", + "deaths" + }, + assists = { + "LUA_MENU_ASSISTS", + "assists" + }, + cranked_ffa_score = { + "LUA_MENU_SCORE", + "extrascore0" + }, + sotf_ffa_score = { + "LUA_MENU_SCORE", + "extrascore0" + }, + dm_score = { + "LUA_MENU_SCORE", + "extrascore0" + }, + rescues = { + "LUA_MENU_RESCUES", + "extrascore0" + }, + captures = { + "LUA_MENU_CAPTURES", + "extrascore0" + }, + tags = { + "LUA_MENU_TAGS", + "extrascore0" + }, + time = { + "LUA_MENU_TIME", + "extrascore0" + }, + scores = { + "LUA_MENU_SCORES", + "extrascore0" + }, + plants = { + "LUA_MENU_PLANTS", + "extrascore0" + }, + revives = { + "LUA_MENU_REVIVES", + "assists" + }, + crates = { + "LUA_MENU_CRATES", + "extrascore0" + }, + dm_streak = { + "MENU_STREAK", + "assists" + }, + gun_knives = { + "PATCH_MENU_STABS", + "assists" + } + } + local f1_local3 + if f1_local0 then + f1_local3 = f1_local1[f1_arg0 .. "_ffa"] + if not f1_local3 then + + else + local f1_local4 = {} + for f1_local8, f1_local9 in ipairs( f1_local3 ) do + f1_local4[f1_local8] = { + Engine.Localize( f1_local2[f1_local9][1] ), + f1_local2[f1_local9][2] + } + end + return f1_local4 + end + end + f1_local3 = f1_local1[f1_arg0] or f1_local1.default +end + +f0_local2 = function () + return { + blueBacking = RegisterMaterial( "scoreboard_team_blue" ), + orngBacking = RegisterMaterial( "scoreboard_team_orng" ), + emptyBacking = RegisterMaterial( "scoreboard_team_empty" ), + talkingIcon = RegisterMaterial( "scoreboard_mic_talk_wht" ), + mutedIcon = RegisterMaterial( "scoreboard_mic_mute_wht" ) + } +end + +local f0_local3 = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3 ) + local f3_local0 = LUI.UIImage.new + local f3_local1 = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + width = f3_arg0, + height = f3_arg1, + material = f3_arg2 + } + local f3_local2 + if f3_arg3 then + f3_local2 = f3_arg3[1] + if not f3_local2 then + + else + f3_local1.red = f3_local2 + if f3_arg3 then + f3_local2 = f3_arg3[2] + if not f3_local2 then + + else + f3_local1.green = f3_local2 + if f3_arg3 then + f3_local2 = f3_arg3[3] + if not f3_local2 then + + else + f3_local1.blue = f3_local2 + if f3_arg3 then + f3_local2 = f3_arg3[4] + if not f3_local2 then + + else + f3_local1.alpha = f3_local2 + f3_local1.alpha = 1 + f3_local0 = f3_local0( f3_local1 ) + f3_local0:animateToState( "default", 0 ) + return f3_local0 + end + end + f3_local2 = 1 + end + end + f3_local2 = 1 + end + end + f3_local2 = 1 + end + end + f3_local2 = 1 +end + +local f0_local4 = function ( f4_arg0, f4_arg1, f4_arg2 ) + local self = LUI.UIImage.new( { + topAnchor = false, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + left = 8, + width = 28, + height = 28, + bottom = 10, + material = f4_arg1, + alpha = 0 + } ) + self:registerAnimationState( "talking", { + material = f4_arg1, + alpha = 1 + } ) + self:registerAnimationState( "muted", { + material = f4_arg2, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + local f4_local1 = LUI.UIElement.new() + f4_local1:setupUIIntWatch( "ClientVoiceStatus", f4_arg0 ) + f4_local1:registerEventHandler( "int_watch_alert", function ( element, event ) + if event.newValue == 2 then + local f5_local0 = element:getParent() + f5_local0:animateToState( "muted", 0 ) + elseif event.newValue == 1 then + local f5_local0 = element:getParent() + f5_local0:animateToState( "talking", 0 ) + else + local f5_local0 = element:getParent() + f5_local0:animateToState( "default", 0 ) + end + end ) + self:addElement( f4_local1 ) + return self +end + +local f0_local5 = function ( f6_arg0, f6_arg1, f6_arg2, f6_arg3 ) + local f6_local0 = LUI.UIImage.new + local f6_local1 = { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + left = 0, + width = f6_arg0, + height = f6_arg1, + material = f6_arg2 + } + local f6_local2 + if f6_arg3 then + f6_local2 = f6_arg3[1] + if not f6_local2 then + + else + f6_local1.red = f6_local2 + if f6_arg3 then + f6_local2 = f6_arg3[2] + if not f6_local2 then + + else + f6_local1.green = f6_local2 + if f6_arg3 then + f6_local2 = f6_arg3[3] + if not f6_local2 then + + else + f6_local1.blue = f6_local2 + if f6_arg3 then + f6_local2 = f6_arg3[4] + if not f6_local2 then + + else + f6_local1.alpha = f6_local2 + f6_local1.alpha = 1 + f6_local0 = f6_local0( f6_local1 ) + f6_local0:animateToState( "default", 0 ) + return f6_local0 + end + end + f6_local2 = 1 + end + end + f6_local2 = 1 + end + end + f6_local2 = 1 + end + end + f6_local2 = 1 +end + +local f0_local6 = function ( menu, controller ) + local self = LUI.UIImage.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = 0, + left = -37, + width = 78, + height = 78, + material = menu, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + local f7_local1 = LUI.UIImage.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + material = controller, + alpha = 1 + } ) + f7_local1:animateToState( "default", 0 ) + self:addElement( f7_local1 ) + return self +end + +local f0_local7 = function () + local f8_local0 = 5 + if Engine.GetDvarString( "ui_mapname" ) == "mp_shipment_ns" then + f8_local0 = 0 + end + local self = LUI.UIElement.new( { + worldBlur = f8_local0 + } ) + self:setupWorldBlur() + return self +end + +local f0_local8 = function ( f9_arg0, f9_arg1, f9_arg2 ) + local f9_local0 = { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + left = 0, + width = f9_arg2, + bottom = 0, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font + } + local f9_local1 + if f9_arg1 then + f9_local1 = f9_arg1[1] + if not f9_local1 then + + else + f9_local0.red = f9_local1 + if f9_arg1 then + f9_local1 = f9_arg1[2] + if not f9_local1 then + + else + f9_local0.green = f9_local1 + if f9_arg1 then + f9_local1 = f9_arg1[3] + if not f9_local1 then + + else + f9_local0.blue = f9_local1 + if f9_arg1 then + f9_local1 = f9_arg1[4] + if not f9_local1 then + + else + f9_local0.alpha = f9_local1 + f9_arg0:registerAnimationState( "default", f9_local0 ) + f9_arg0:animateToState( "default" ) + end + end + f9_local1 = 1 + end + end + f9_local1 = 1 + end + end + f9_local1 = 1 + end + end + f9_local1 = 1 +end + +local f0_local9 = function ( f10_arg0, f10_arg1, f10_arg2 ) + local f10_local0, f10_local1, f10_local2, f10_local3 = GetTextDimensions( f10_arg0, f10_arg1.Font, f10_arg1.Height ) + local f10_local4 = f10_local2 - f10_local0 + local f10_local5 = LUI.UIText.new + local f10_local6 = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + width = f10_local4, + height = f10_arg1.Height, + font = f10_arg1.Font + } + local f10_local7 + if f10_arg2 then + f10_local7 = f10_arg2[1] + if not f10_local7 then + + else + f10_local6.red = f10_local7 + if f10_arg2 then + f10_local7 = f10_arg2[2] + if not f10_local7 then + + else + f10_local6.green = f10_local7 + if f10_arg2 then + f10_local7 = f10_arg2[3] + if not f10_local7 then + + else + f10_local6.blue = f10_local7 + if f10_arg2 then + f10_local7 = f10_arg2[4] + if not f10_local7 then + + else + f10_local6.alpha = f10_local7 + f10_local6.alignment = LUI.Alignment.None + f10_local5 = f10_local5( f10_local6 ) + f10_local5.m_textStyle = CoD.TextStyle.ShadowedMore + f10_local5:setText( f10_arg0 ) + return f10_local5 + end + end + f10_local7 = 1 + end + end + f10_local7 = 1 + end + end + f10_local7 = 1 + end + end + f10_local7 = 1 +end + +local f0_local10 = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3 ) + if not f11_arg3 then + f11_arg3 = {} + end + local f11_local0 = f11_arg3 and f11_arg3.width + if not f11_local0 then + local f11_local1, f11_local2, f11_local3, f11_local4 = GetTextDimensions( f11_arg0, f11_arg1.Font, f11_arg1.Height ) + f11_local0 = f11_local3 - f11_local1 + end + local f11_local1 = nil + if f11_arg3.marquee then + f11_local1 = LUI.UIMarqueeText.new + else + f11_local1 = LUI.UIText.new + end + local f11_local2 = f11_local1 + local f11_local3 = { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false + } + local f11_local4 + if f11_arg3 then + f11_local4 = f11_arg3.x + if not f11_local4 then + + else + f11_local3.left = f11_local4 + f11_local3.width = f11_local0 + if f11_arg3 then + f11_local4 = f11_arg3.y + if not f11_local4 then + + else + f11_local3.bottom = f11_local4 + f11_local3.height = f11_arg1.Height + f11_local3.font = f11_arg1.Font + if f11_arg2 then + f11_local4 = f11_arg2[1] + if not f11_local4 then + + else + f11_local3.red = f11_local4 + if f11_arg2 then + f11_local4 = f11_arg2[2] + if not f11_local4 then + + else + f11_local3.green = f11_local4 + if f11_arg2 then + f11_local4 = f11_arg2[3] + if not f11_local4 then + + else + f11_local3.blue = f11_local4 + if f11_arg2 then + f11_local4 = f11_arg2[4] + if not f11_local4 then + + else + f11_local3.alpha = f11_local4 + if f11_arg3 then + f11_local4 = f11_arg3.alignment + if not f11_local4 then + + else + f11_local3.alignment = f11_local4 + f11_local2 = f11_local2( f11_local3 ) + f11_local2:setText( f11_arg0 ) + f11_local2:animateToState( "default", 0 ) + return f11_local2 + end + end + f11_local4 = LUI.Alignment.None + end + end + f11_local4 = 1 + end + end + f11_local4 = 1 + end + end + f11_local4 = 1 + end + end + f11_local4 = 1 + end + end + f11_local4 = -3 + end + end + f11_local4 = 0 +end + +local f0_local11 = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3 ) + local self = LUI.UIHorizontalList.new( { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + left = 0, + width = f12_arg2, + bottom = 0, + height = CoD.TextSettings.HudEuroNormalFont.Height + 3, + spacing = 32 + } ) + self:animateToState( "default", 0 ) + local f12_local1 = LUI.UIElement.new() + f0_local8( f12_local1, nil, 15 ) + self:addElement( f12_local1 ) + if f12_arg3 == "horde" then + self:addElement( f0_local10( Engine.Localize( "@LUA_MENU_SAFEGUARD_SCOREBOARD_HEADER", Game.GetOmnvar( "ui_horde_round_number" ) ), CoD.TextSettings.HudEuroNormalFont, f0_local0.white ) ) + else + if f12_arg0 then + self:addElement( f0_local10( f12_arg0, CoD.TextSettings.HudEuroNormalFont, f0_local0.white ) ) + else + self:addElement( LUI.UIElement.new( { + bottomAnchor = true, + leftAnchor = true, + bottom = 0, + left = 0, + width = 32 + } ) ) + end + self:addElement( f0_local10( "[" .. f12_arg1 .. "]", CoD.TextSettings.HudEuroNormalFont, f0_local0.gray ) ) + end + return self +end + +local f0_local12 = function ( f13_arg0, f13_arg1, f13_arg2, f13_arg3, f13_arg4 ) + local f13_local0 = nil + if f13_arg0 == Teams.allies then + f13_local0 = { + iconMat = RegisterMaterial( "scoreboard_heading_icons_ghost" ), + name = GameX.GetLocalizedTeamName( Teams.allies ) + } + elseif f13_arg0 == Teams.axis then + f13_local0 = { + iconMat = RegisterMaterial( "scoreboard_heading_icons_fed" ), + name = GameX.GetLocalizedTeamName( Teams.axis ) + } + else + assert( f13_arg0 == Teams.free ) + f13_local0 = { + iconMat = nil, + name = nil + } + end + if f13_arg4 then + if f13_arg4 == f13_arg0 then + f13_local0.name = Engine.Localize( "LUA_MENU_TEAM_WON", f13_local0.name ) + else + f13_local0.name = Engine.Localize( "LUA_MENU_TEAM_LOST", f13_local0.name ) + end + end + if f13_arg0 == f13_arg1 then + f13_local0.highlightMat = RegisterMaterial( "scoreboard_heading_icons_blue_hlt" ) + else + f13_local0.highlightMat = RegisterMaterial( "scoreboard_heading_icons_orng_hlt" ) + end + local f13_local1 = Game.GetNumPlayersOnTeam( f13_arg0 ) + local self = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = 891, + height = 78, + alpha = 1 + } ) + self:addElement( f0_local5( 891, 38, RegisterMaterial( "scoreboard_heading" ) ) ) + if f13_local0.iconMat then + self:addElement( f0_local6( f13_local0.iconMat, f13_local0.highlightMat ) ) + end + local f13_local3 = LUI.UIHorizontalList.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + width = 891, + spacing = 0, + alpha = 1 + } ) + f13_local3:animateToState( "default", 0 ) + self:addElement( f13_local3 ) + f13_local3:addElement( f0_local11( f13_local0.name, f13_local1, 445.5, f13_arg2 ) ) + local f13_local4 = { + width = 445.5 / #f13_arg3, + alignment = LUI.Alignment.Center + } + for f13_local8, f13_local9 in ipairs( f13_arg3 ) do + f13_local3:addElement( f0_local10( f13_local9[1] or "FAIL", CoD.TextSettings.HudEuroNormalFont, f0_local0.gray, f13_local4 ) ) + end + return self +end + +local f0_local13 = function ( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5, f14_arg6 ) + local f14_local0, f14_local1, f14_local2 = nil + local f14_local3 = GameX.GetPlayerScoreInfoAtRankForGameMode( f14_arg0, f14_arg2, f14_arg6, true ) + if not f14_local3 then + f14_local0 = f0_local3( 891, 34, f14_arg5.emptyBacking ) + else + local f14_local4, f14_local5 = nil + f14_local0 = f0_local3( 891, 34, f14_arg4 ) + if f14_arg3 == f14_arg2 then + f14_local0:addElement( f0_local3( 891, 34, RegisterMaterial( "scoreboard_team_player" ) ) ) + f14_local1 = RegisterMaterial( "scoreboard_mic_talk_blk" ) + f14_local2 = RegisterMaterial( "scoreboard_mic_mute_blk" ) + f14_local4 = f0_local0.black + f14_local5 = f0_local0.black + if f14_local3.prestige and f14_local3.prestige > 0 then + f14_local5 = f0_local0.white + end + else + f14_local1 = f14_arg5.talkingIcon + f14_local2 = f14_arg5.mutedIcon + f14_local4 = f0_local0.white + f14_local5 = f0_local0.white + end + local self = LUI.UIHorizontalList.new( { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + width = 891, + spacing = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + f14_local0:addElement( self ) + local f14_local7 = 445.5 + local f14_local8 = { + 45, + 65, + f14_local7, + [3] = f14_local8[3] - f14_local8[1] - f14_local8[2] + } + local f14_local9 = LUI.UIElement.new() + f0_local8( f14_local9, nil, f14_local8[1] ) + f14_local9:addElement( f0_local4( f14_local3.client, f14_local1, f14_local2 ) ) + self:addElement( f14_local9 ) + local f14_local10 = LUI.UIElement.new() + f0_local8( f14_local10, nil, f14_local8[2] ) + local f14_local11 = f14_local3.rankIcon + if f14_local3.rank and f14_local3.prestige and f14_local3.prestige > 0 then + f14_local11 = RegisterMaterial( Rank.GetRankIcon( f14_local3.rank, f14_local3.prestige or 0 ) ) + end + f14_local10:addElement( LUI.UIImage.new( { + leftAnchor = true, + bottomAnchor = true, + topAnchor = false, + rightAnchor = false, + left = 0, + bottom = -3, + width = 25, + height = 25, + material = f14_local11, + red = f14_local5[1], + green = f14_local5[2], + blue = f14_local5[3], + alpha = f14_local5[4] + } ) ) + f14_local10:addElement( f0_local10( f14_local3.rank + 1, CoD.TextSettings.HudEuroMedSmallFont, f14_local4, { + x = 28, + y = -1 + } ) ) + self:addElement( f14_local10 ) + self:addElement( f0_local10( f14_local3.name, CoD.TextSettings.HudEuroNormalFont, f14_local4, { + width = f14_local8[3], + marquee = true, + alignment = LUI.Alignment.Left + } ) ) + local f14_local12 = { + width = f14_local7 / #f14_arg1, + alignment = LUI.Alignment.Center + } + for f14_local17, f14_local18 in ipairs( f14_arg1 ) do + local f14_local16 = f14_local3[f14_local18[2]] + if f14_arg6 == "infect" and f14_local18[2] == "extrascore0" then + f14_local16 = CoD.FormatInfectedTime( f14_local16, true ) + end + self:addElement( f0_local10( f14_local16 or "FAIL", CoD.TextSettings.HudEuroNormalFont, f14_local4, f14_local12 ) ) + end + end + return f14_local0 +end + +local f0_local14 = function () + local f15_local0 = MBh.AnimateLoop( { + { + "shifted", + 500, + true, + true + }, + { + "default", + 500, + true, + true + } + } ) + return function ( f16_arg0, f16_arg1 ) + if f16_arg0.animstate ~= "show" then + f15_local0( f16_arg0, f16_arg1 ) + f16_arg0.animstate = "show" + end + end + +end + +local f0_local15 = function () + local f17_local0 = MBh.AnimateToState( "hidden", 100 ) + return function ( f18_arg0, f18_arg1 ) + if f18_arg0.animstate ~= "hide" then + f17_local0( f18_arg0, f18_arg1 ) + f18_arg0.animstate = "hide" + end + end + +end + +local f0_local16 = function ( f19_arg0 ) + local f19_local0 = { + material = RegisterMaterial( "widg_margin_arrow_top" ), + topAnchor = true, + top = f19_arg0, + width = 64, + height = 32, + alpha = 1 + } + local self = LUI.UIImage.new() + self:registerAnimationState( "default", f19_local0 ) + self:registerAnimationState( "shifted", LUI.MenuBuilder.AnimStateBasedOn( f19_local0, { + topAnchor = true, + top = f19_local0.top + 5 + } ) ) + self:registerAnimationState( "hidden", LUI.MenuBuilder.AnimStateBasedOn( f19_local0, { + alpha = 0 + } ) ) + self:animateToState( "hidden", 0 ) + self:registerEventHandler( "show_up_scroll_arrow", f0_local14() ) + self:registerEventHandler( "hide_up_scroll_arrow", f0_local15() ) + self:setPriority( 10 ) + self.id = "arrow_up" + return self +end + +local f0_local17 = function ( f20_arg0 ) + local f20_local0 = { + material = RegisterMaterial( "widg_margin_arrow_bot" ), + bottomAnchor = true, + bottom = f20_arg0 + 4, + width = 64, + height = 32, + alpha = 1 + } + local self = LUI.UIImage.new() + self:registerAnimationState( "default", f20_local0 ) + self:registerAnimationState( "shifted", LUI.MenuBuilder.AnimStateBasedOn( f20_local0, { + bottomAnchor = true, + bottom = f20_local0.bottom - 5 + } ) ) + self:registerAnimationState( "hidden", LUI.MenuBuilder.AnimStateBasedOn( f20_local0, { + alpha = 0 + } ) ) + self:animateToState( "hidden", 0 ) + self:registerEventHandler( "show_down_scroll_arrow", f0_local14() ) + self:registerEventHandler( "hide_down_scroll_arrow", f0_local15() ) + self:setPriority( 10 ) + self.id = "arrow_down" + return self +end + +local f0_local18 = function ( f21_arg0, f21_arg1 ) + local f21_local0 = { + name = "gamepad_button", + button = f21_arg0, + down = f21_arg1 + } + return function ( f22_arg0, f22_arg1 ) + if f21_arg1 ~= f22_arg0.down then + local f22_local0 = f22_arg0:getParent() + f22_local0:dispatchEventToRoot( f21_local0 ) + f22_arg0.down = f21_arg1 + end + end + +end + +local f0_local19 = function ( f23_arg0, f23_arg1 ) + if not f23_arg1.interrupted then + local f23_local0 = f23_arg0:getParent() + f23_local0 = f23_local0:getChildById( "main_vlist_wrapper" ) + if f23_local0.isWaitingOnDelayedStop then + f23_local0:cancelAnimateToState() + end + end + f23_arg0.isAnimating = false +end + +local f0_local20 = function ( f24_arg0, f24_arg1 ) + if not f24_arg0.scrollEnabled then + return + elseif f24_arg1.button ~= "down" and f24_arg1.button ~= "up" then + return + end + local f24_local0 = f24_arg0:getChildById( "main_vlist_wrapper" ) + local f24_local1 = f24_arg0:getChildById( "pc_delayed_stop" ) + if not f24_arg1.down then + if f24_local1.isAnimating then + f24_local0.isWaitingOnDelayedStop = true + else + f24_local0:cancelAnimateToState() + end + else + if f24_local1.isAnimating then + f24_local1:cancelAnimateToState() + f24_local1:animateToState( "delay", 100 ) + f24_local1.isAnimating = true + f24_local0.isWaitingOnDelayedStop = false + return + end + local f24_local2, f24_local3, f24_local4, f24_local5 = f24_local0:getCurrentGlobalRect() + local f24_local6, f24_local7, f24_local8, f24_local9 = f24_arg0:getCurrentGlobalRect() + local f24_local10 = f24_arg1.button and -1 or 1 + local f24_local11 = 1 + f24_local0:cancelAnimateToState() + if f24_local11 > 0 then + local f24_local12, f24_local13 = nil + if f24_local10 > 0 then + f24_local12 = f24_arg0.properties.upperY + f24_local7 - f24_local3 + f24_local13 = "top" + f24_arg0:dispatchEventToChildren( { + name = "show_down_scroll_arrow" + } ) + if f24_local12 == 0 then + f24_arg0:dispatchEventToChildren( { + name = "hide_up_scroll_arrow" + } ) + return + end + else + f24_local12 = f24_arg0.properties.lowerY + f24_local7 - f24_local3 + f24_local13 = "bottom" + f24_arg0:dispatchEventToChildren( { + name = "show_up_scroll_arrow" + } ) + if f24_local12 == 0 then + f24_arg0:dispatchEventToChildren( { + name = "hide_down_scroll_arrow" + } ) + return + end + end + f24_local0:animateToState( f24_local13, math.abs( f24_local12 ) * 1000 / 600 * f24_local11 ) + f24_local1:cancelAnimateToState() + f24_local1:animateToState( "delay", 50 ) + f24_local1.isAnimating = true + f24_local0.isWaitingOnDelayedStop = false + end + end +end + +local f0_local21 = function ( f25_arg0, f25_arg1 ) + if not f25_arg0.scrollEnabled then + return + end + local f25_local0 = f25_arg0:getChildById( "main_vlist_wrapper" ) + local f25_local1, f25_local2, f25_local3, f25_local4 = f25_local0:getCurrentGlobalRect() + local f25_local5, f25_local6, f25_local7, f25_local8 = f25_arg0:getCurrentGlobalRect() + local f25_local9 = math.sin( math.rad( f25_arg1.leftStickDirection ) ) * f25_arg1.leftStickMagnitude + math.sin( math.rad( f25_arg1.rightStickDirection ) ) * f25_arg1.rightStickMagnitude + local f25_local10 = LUI.clamp( (math.abs( f25_local9 ) - 0.3) / 0.7, 0, 1 ) + f25_local0:cancelAnimateToState() + if f25_local10 > 0 then + local f25_local11, f25_local12 = nil + if f25_local9 > 0 then + f25_local11 = f25_arg0.properties.upperY + f25_local6 - f25_local2 + f25_local12 = "top" + f25_arg0:dispatchEventToChildren( { + name = "show_down_scroll_arrow" + } ) + if f25_local11 == 0 then + f25_arg0:dispatchEventToChildren( { + name = "hide_up_scroll_arrow" + } ) + return + end + else + f25_local11 = f25_arg0.properties.lowerY + f25_local6 - f25_local2 + f25_local12 = "bottom" + f25_arg0:dispatchEventToChildren( { + name = "show_up_scroll_arrow" + } ) + if f25_local11 == 0 then + f25_arg0:dispatchEventToChildren( { + name = "hide_down_scroll_arrow" + } ) + return + end + end + f25_local0:animateToState( f25_local12, math.abs( f25_local11 ) * 1000 / 600 * f25_local10 ) + end +end + +local f0_local22 = function ( f26_arg0, f26_arg1 ) + local f26_local0 = f26_arg0:getChildById( "main_vlist_wrapper" ) + local f26_local1, f26_local2, f26_local3, f26_local4 = f26_local0:getCurrentGlobalRect() + local f26_local5, f26_local6, f26_local7, f26_local8 = f26_arg0:getCurrentGlobalRect() + local f26_local9 = f26_local8 - f26_local6 + local f26_local10 = f26_local4 - f26_local2 + if f26_local10 <= f26_local9 then + return + else + f26_arg0:dispatchEventToChildren( { + name = "show_down_scroll_arrow" + } ) + local f26_local11 = { + topAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottomAnchor = false, + width = f26_local3 - f26_local1, + height = f26_local10 + } + f26_arg0.properties = f26_arg0.properties or {} + f26_arg0.properties.upperY = 0 + f26_arg0.properties.lowerY = f26_local9 - f26_local10 + f26_local0:registerAnimationState( "top", LUI.MenuBuilder.AnimStateBasedOn( f26_local11, { + top = f26_arg0.properties.upperY + } ) ) + f26_local0:registerAnimationState( "bottom", LUI.MenuBuilder.AnimStateBasedOn( f26_local11, { + top = f26_arg0.properties.lowerY + } ) ) + f26_local0:registerEventHandler( "transition_complete_top", function ( element, event ) + if not event.interrupted then + f26_arg0:dispatchEventToChildren( { + name = "hide_up_scroll_arrow" + } ) + end + end ) + f26_local0:registerEventHandler( "transition_complete_bottom", function ( element, event ) + if not event.interrupted then + f26_arg0:dispatchEventToChildren( { + name = "hide_down_scroll_arrow" + } ) + end + end ) + f26_arg0.scrollEnabled = true + end +end + +local f0_local23 = function ( f29_arg0, f29_arg1 ) + local f29_local0, f29_local1, f29_local2, f29_local3 = f29_arg0:getCurrentGlobalRect() + if f29_local0 then + local f29_local4 = f29_arg0:getParent() + f29_local4:animateToState( "visible", 200 ) + else + f29_arg0:animateToState( "resized", 1 ) + end +end + +local f0_local24 = function ( f30_arg0, f30_arg1 ) + local f30_local0, f30_local1, f30_local2, f30_local3 = f30_arg0:getCurrentGlobalRect() + if f30_local0 then + local f30_local4 = f30_arg0:getParent() + f30_local4:registerAnimationState( "resized", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + width = (f30_local2 - f30_local0) * f30_arg0.scaleRatio, + height = (f30_local3 - f30_local1) * f30_arg0.scaleRatio + } ) + f30_local4:animateToState( "resized", 0 ) + f30_local4:animateToState( "resized", 1 ) + f30_local4:registerEventHandler( "transition_complete_resized", f0_local23 ) + else + f30_arg0:animateToState( "resized", 1 ) + end +end + +local f0_local25 = function ( f31_arg0, f31_arg1 ) + local f31_local0, f31_local1, f31_local2, f31_local3 = f31_arg0:getCurrentGlobalRect() + if f31_local0 then + local f31_local4 = LUI.UIVerticalList.getHeightOfChildren( f31_arg0, 1 ) + local f31_local5 = 1033 + local f31_local6 = GameX.GetScreenWidth() * SliderBounds.HorzMargin.Min + if f31_local6 < f31_local5 then + f31_arg0.scaleRatio = f31_local6 / f31_local5 + else + f31_arg0.scaleRatio = 1 + end + f31_arg0:registerAnimationState( "resized", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + width = 891, + height = f31_local4, + scale = f31_arg0.scaleRatio - 1, + spacing = 1 + } ) + f31_arg0:animateToState( "resized", 0 ) + f31_arg0:animateToState( "resized", 1 ) + f31_arg0:registerEventHandler( "transition_complete_resized", f0_local24 ) + else + f31_arg0:animateToState( "start", 1 ) + end +end + +LUI.MenuBuilder.registerType( "scoreboard", function () + Engine.SetLuiInUse( true ) + local self = LUI.UIElement.new() + self.id = "scoreboard_id" + local f32_local1 = {} + f32_local1 = GameX.GetSafeZoneSize() + local f32_local2 = {} + f32_local2 = GameX.GetAdjustedSafeZoneSize() + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + left = f32_local1[1], + top = f32_local1[2], + right = f32_local1[3], + bottom = f32_local1[4], + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self:registerEventHandler( "transition_complete_visible", f0_local22 ) + if Engine.IsConsoleGame() then + self:registerEventHandler( "gamepad_sticks", f0_local21 ) + else + LUI.FlowManager.tryAddMouseCursor( Engine.GetLuiRoot() ) + self:registerEventHandler( "gamepad_button", f0_local20 ) + local f32_local3 = LUI.UIElement.new() + f32_local3.id = "pc_delayed_stop" + f32_local3:registerAnimationState( "delay", {} ) + f32_local3:registerEventHandler( "transition_complete_delay", f0_local19 ) + self:addElement( f32_local3 ) + local f32_local4 = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = -f32_local1[1], + top = -f32_local1[2], + right = -f32_local1[3], + height = 75 + } ) + f32_local4.handleMouseMove = true + f32_local4:registerEventHandler( "mouseenter", f0_local18( "up", true ) ) + f32_local4:registerEventHandler( "mouseleave", f0_local18( "up", false ) ) + self:addElement( f32_local4 ) + local f32_local5 = LUI.UIElement.new( { + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = -f32_local1[1], + right = -f32_local1[3], + bottom = -f32_local1[4], + height = 75 + } ) + f32_local5.handleMouseMove = true + f32_local5:registerEventHandler( "mouseenter", f0_local18( "down", true ) ) + f32_local5:registerEventHandler( "mouseleave", f0_local18( "down", false ) ) + self:addElement( f32_local5 ) + end + self:addElement( f0_local7() ) + self:addElement( f0_local16( f32_local2[2] - f32_local1[2] ) ) + self:addElement( f0_local17( f32_local2[4] - f32_local1[4] ) ) + local f32_local6 = LUI.UIElement.new( { + topAnchor = true, + top = 0 + } ) + f32_local6.id = "main_vlist_wrapper" + self:addElement( f32_local6 ) + local f32_local3 = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + width = 891, + height = 1000, + spacing = 1 + } + local f32_local4 = LUI.UIVerticalList.new( f32_local3 ) + f32_local4:registerAnimationState( "start", f32_local3 ) + f32_local4:registerEventHandler( "transition_complete_start", f0_local25 ) + f32_local4:animateToState( "start", 1 ) + f32_local4.id = "main_vlist" + f32_local6:addElement( f32_local4 ) + local f32_local5 = GameX.GetGameMode() + local f32_local7 = f0_local1( f32_local5 ) + local f32_local8 = GameX.gameModeIsFFA( f32_local5 ) + local f32_local9 = Game.GetPlayerTeam() + local f32_local10 = Game.GetPlayerScoreRanking() + local f32_local11 = f0_local2() + local f32_local12 = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + height = 10 + } ) + f32_local4:addElement( f32_local12 ) + f32_local12:addElement( f0_local9( Engine.Localize( "@" .. Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f32_local5, GameTypesTable.Cols.Name ) ), CoD.TextSettings.ExtraBigFont, f0_local0.white ) ) + if f32_local5 == "infect" then + if f32_local9 ~= Teams.axis and f32_local9 ~= Teams.allies then + f32_local9 = Teams.allies + f32_local10 = nil + end + local f32_local13 = GameX.GetPlayerOpposingTeam( f32_local9 ) + f32_local4:addElement( f0_local12( Teams.free, nil, f32_local5, f32_local7 ) ) + local f32_local14 = {} + if f32_local9 == Teams.allies then + f32_local14.allies = { + backing = f32_local11.blueBacking, + rank = f32_local10 + } + f32_local14.axis = { + backing = f32_local11.orngBacking + } + else + f32_local14.allies = { + backing = f32_local11.orngBacking + } + f32_local14.axis = { + backing = f32_local11.blueBacking, + rank = f32_local10 + } + end + local f32_local15 = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.allies, f32_local5 ) + if f32_local15 > 0 then + for f32_local16 = 1, f32_local15, 1 do + f32_local4:addElement( f0_local13( Teams.allies, f32_local7, f32_local16, f32_local14.allies.rank, f32_local14.allies.backing, f32_local11, f32_local5 ) ) + end + end + local f32_local16 = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.axis, f32_local5 ) + if f32_local16 > 0 then + for f32_local17 = 1, f32_local16, 1 do + f32_local4:addElement( f0_local13( Teams.axis, f32_local7, f32_local17, f32_local14.axis.rank, f32_local14.axis.backing, f32_local11, f32_local5 ) ) + end + end + elseif not f32_local8 then + if f32_local9 ~= Teams.axis and f32_local9 ~= Teams.allies then + f32_local9 = Teams.allies + f32_local10 = nil + end + local f32_local13 = Game.GetTeamScore( Teams.allies ) or 0 + local f32_local20 = Game.GetTeamScore( Teams.axis ) or 0 + local f32_local14 = nil + if f32_local20 < f32_local13 then + f32_local14 = Teams.allies + elseif f32_local13 < f32_local20 then + f32_local14 = Teams.axis + end + local f32_local15 = GameX.GetPlayerOpposingTeam( f32_local9 ) + local f32_local16 = GameX.GetNumPlayerSlotsForFinalScoreboard( f32_local9, f32_local5 ) + if f32_local16 > 0 then + f32_local4:addElement( f0_local12( f32_local9, f32_local9, f32_local5, f32_local7, f32_local14 ) ) + for f32_local18 = 1, f32_local16, 1 do + f32_local4:addElement( f0_local13( f32_local9, f32_local7, f32_local18, f32_local10, f32_local11.blueBacking, f32_local11, f32_local5 ) ) + end + end + local f32_local17 = GameX.GetNumPlayerSlotsForFinalScoreboard( f32_local15, f32_local5 ) + if f32_local16 > 0 and f32_local17 > 0 then + f32_local4:addElement( LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + height = 5 + } ) ) + end + if f32_local17 > 0 then + f32_local4:addElement( f0_local12( f32_local15, f32_local9, f32_local5, f32_local7, f32_local14 ) ) + for f32_local19 = 1, f32_local17, 1 do + f32_local4:addElement( f0_local13( f32_local15, f32_local7, f32_local19, nil, f32_local11.orngBacking, f32_local11, f32_local5 ) ) + end + end + else + if f32_local9 ~= Teams.free then + f32_local10 = nil + end + f32_local4:addElement( f0_local12( Teams.free, nil, f32_local5, f32_local7 ) ) + local f32_local20 = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.free, f32_local5 ) + for f32_local14 = 1, f32_local20, 1 do + local f32_local18 + if f32_local14 == f32_local10 then + f32_local18 = f32_local11.blueBacking + if not f32_local18 then + + else + f32_local4:addElement( f0_local13( Teams.free, f32_local7, f32_local14, f32_local10, f32_local18, f32_local11, f32_local5 ) ) + end + end + f32_local18 = f32_local11.orngBacking + end + end + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/scorelisthud.dec.lua b/lui/mp_hud/scorelisthud.dec.lua new file mode 100644 index 0000000..aa80540 --- /dev/null +++ b/lui/mp_hud/scorelisthud.dec.lua @@ -0,0 +1,1220 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 250 +f0_local1 = 500 +f0_local2 = 325 +local f0_local3 = 2 +local f0_local4 = 20 +local f0_local5 = 20 +local f0_local6 = 100 +local f0_local7 = 7 +local f0_local8 = f0_local4 + f0_local5 +local f0_local9 = Engine.Localize( "@LUA_MENU_EMPTY" ) +local f0_local10 = Engine.Localize( "@LUA_MENU_MAX" ) +local f0_local11 = Engine.Localize( "@LUA_MENU_S_FOR_SECONDS" ) +local f0_local12 = Engine.Localize( "@LUA_MENU_M_FOR_MINUTES" ) +local f0_local13 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = { + default = { + "score", + "kills", + "deaths", + "assists" + }, + war = { + "score", + "kills", + "deaths", + "assists" + }, + dom = { + "score", + "kills", + "deaths", + "captures" + }, + sd = { + "score", + "kills", + "deaths", + "plants" + }, + conf = { + "score", + "kills", + "deaths", + "tags" + }, + dm = { + "dm_score", + "kills", + "deaths", + "dm_streak" + }, + sr = { + "score", + "kills", + "deaths", + "rescues" + }, + blitz = { + "score", + "kills", + "deaths", + "captures" + }, + cranked = { + "score", + "kills", + "deaths", + "assists" + }, + cranked_ffa = { + "cranked_ffa_score", + "kills", + "deaths", + "assists" + }, + sotf = { + "score", + "kills", + "deaths", + "assists" + }, + sotf_ffa = { + "sotf_ffa_score", + "kills", + "deaths", + "dm_streak" + }, + infect = { + "score", + "kills", + "deaths", + "time" + }, + grind = { + "score", + "kills", + "deaths", + "scores" + }, + horde = { + "kills", + "revives", + "crates" + }, + gun = { + "score", + "kills", + "deaths", + "gun_knives" + }, + siege = { + "score", + "kills", + "deaths", + "captures" + } + } + local f1_local1 = { + score = { + "LUA_MENU_SCORE", + "score" + }, + dm_score = { + "LUA_MENU_SCORE", + "extrascore0" + }, + cranked_ffa_score = { + "LUA_MENU_SCORE", + "extrascore0" + }, + sotf_ffa_score = { + "LUA_MENU_SCORE", + "extrascore0" + }, + kills = { + "LUA_MENU_K_FOR_KILLS_CAPS", + "kills" + }, + deaths = { + "LUA_MENU_D_FOR_DEATHS_CAPS", + "deaths" + }, + revives = { + "LUA_MENU_R_FOR_REVIVES_CAPS", + "assists" + }, + assists = { + "LUA_MENU_A_FOR_ASSISTS_CAPS", + "assists" + }, + rescues = { + "LUA_MENU_R_FOR_RESCUES_CAPS", + "extrascore0" + }, + captures = { + "LUA_MENU_C_FOR_CAPTURES_CAPS", + "extrascore0" + }, + tags = { + "LUA_MENU_T_FOR_TAGS_CAPS", + "extrascore0" + }, + time = { + "LUA_MENU_T_FOR_TIME_CAPS", + "time" + }, + scores = { + "LUA_MENU_S_FOR_SCORES_CAPS", + "extrascore0" + }, + plants = { + "LUA_MENU_P_FOR_PLANTS_CAPS", + "extrascore0" + }, + crates = { + "LUA_MENU_C_FOR_CRATES_CAPS", + "extrascore0" + }, + dm_streak = { + "PATCH_MENU_S_FOR_STREAK_CAPS", + "assists" + }, + gun_knives = { + "PATCH_MENU_S_FOR_STABS_CAPS", + "assists" + } + } + local f1_local2 = { + default = { + { + 50, + 60 + }, + { + 25, + 33 + }, + { + 25, + 31 + }, + { + 32, + 40 + } + }, + horde = { + { + 42, + 60 + }, + { + 42, + 49 + }, + { + 42, + 49 + } + } + } + local f1_local3 + if f1_arg1 then + f1_local3 = f1_local0[f1_arg0 .. "_ffa"] + if not f1_local3 then + + else + local f1_local4 + if f1_arg1 then + f1_local4 = f1_local2[f1_arg0 .. "_ffa"] + if not f1_local4 then + + else + local f1_local5 = {} + for f1_local9, f1_local10 in ipairs( f1_local3 ) do + f1_local5[f1_local9] = { + Engine.Localize( f1_local1[f1_local10][1] ), + f1_local1[f1_local10][2], + f1_local4[f1_local9][1], + f1_local4[f1_local9][2] + } + end + return f1_local5 + end + end + f1_local4 = f1_local2[f1_arg0] or f1_local2.default + end + end + f1_local3 = f1_local0[f1_arg0] or f1_local0.default +end + +local f0_local14 = function ( f2_arg0, f2_arg1, f2_arg2 ) + local f2_local0 = f2_arg1 or GameX.GetGameMode() + if f2_arg2 or GameX.gameModeIsFFA( f2_local0 ) then + f2_arg0.slots[Teams.free] = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.free, f2_local0 ) + else + f2_arg0.slots[Teams.allies] = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.allies, f2_local0 ) + f2_arg0.slots[Teams.axis] = GameX.GetNumPlayerSlotsForFinalScoreboard( Teams.axis, f2_local0 ) + end +end + +local f0_local15 = function ( f3_arg0, f3_arg1 ) + if f3_arg0.current_state ~= "active" then + f3_arg0:animateToState( "active", 0 ) + f3_arg0:processEvent( { + name = "scorelist_turn_on" + } ) + f3_arg0.current_state = "active" + elseif f3_arg0.current_state ~= "default" then + f3_arg0:animateToState( "default", 0 ) + f3_arg0.current_state = "default" + end +end + +local f0_local16 = function ( f4_arg0, f4_arg1, f4_arg2 ) + if f4_arg0 and f4_arg0.current_state ~= f4_arg1 then + f4_arg0:animateToState( f4_arg1, f4_arg2 ) + f4_arg0.current_state = f4_arg1 + return true + else + return false + end +end + +function GetRowState( f5_arg0, f5_arg1, f5_arg2, f5_arg3 ) + if f5_arg3 == "sr" then + if f5_arg2.extrascore1 == 1 then + return "downed" + elseif f5_arg2.extrascore1 == 2 then + return "dead" + end + elseif f5_arg3 == "infect" and f5_arg2.extrascore1 == 1 then + if f5_arg0 == f5_arg1 then + return "highlight" + else + return "downed" + end + end + if f5_arg2.isDead == true then + return "dead" + elseif f5_arg0 == f5_arg1 then + return "highlight" + elseif f5_arg0 % 2 == 0 then + return "bar_b" + end + return "default" +end + +local f0_local17 = function ( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4 ) + local f6_local0 = RegisterMaterial( "waypoint_dogtags_friendlys" ) + local f6_local1 = RegisterMaterial( "waypoint_dogtags" ) + local f6_local2 = RegisterMaterial( "killiconsuicide" ) + if f6_arg0 == "dead" then + return f6_local2 + elseif f6_arg4 == "sr" and f6_arg0 == "downed" then + if f6_arg2 then + return f6_local1 + else + return f6_local0 + end + end + local f6_local3 = f6_arg3.rankIcon + if f6_arg3.rank and f6_arg3.prestige and f6_arg3.prestige > 0 then + f6_local3 = RegisterMaterial( Rank.GetRankIcon( f6_arg3.rank, f6_arg3.prestige or 0 ) ) + end + return f6_local3 +end + +local f0_local18 = function ( f7_arg0 ) + local f7_local0 = f7_arg0.name + if Engine.IsConsoleGame() and string.sub( f7_local0, 1, 1 ) == "[" then + local f7_local1 = string.find( f7_local0, "]" ) + if f7_local1 and f7_local1 < 7 then + local f7_local2 = string.sub( f7_local0, 1, f7_local1 ) + f7_local0 = string.sub( f7_local0, f7_local1 + 1 ) + end + end + return f7_local0 +end + +local f0_local19 = function ( f8_arg0, f8_arg1, f8_arg2, f8_arg3, f8_arg4, f8_arg5, f8_arg6 ) + local f8_local0 = f8_arg1:getChildById( "scoreRowBg" ) + local f8_local1 = f8_arg1:getChildById( "rowList" ) + local f8_local2 = f8_arg1.properties + local f8_local3 = "default" + if f8_arg5 ~= nil then + f8_arg1.clientNum = f8_arg5.client + f0_local16( f8_arg1, "filled", 250 ) + f8_local3 = GetRowState( f8_arg2, f8_arg3, f8_arg5, f8_arg6 ) + local f8_local4 = f0_local17( f8_local3, f8_arg3, f8_arg4, f8_arg5, f8_arg6 ) + if f8_local2.rankIcon ~= f8_local4 then + local f8_local5 = f8_local1:getChildById( "rankIcon" ) + local f8_local6 = 1 + if MLG.IsMLGSpectator() then + f8_local6 = 0 + end + CoD.SetMaterial( f8_local5, f8_local4, f8_local6 ) + f8_local2.rankIcon = f8_local4 + end + local f8_local5 = f8_arg5.rank + 1 .. "" + if MLG.IsMLGSpectator() then + f8_local5 = "" + end + if f8_local2.rankNumber ~= f8_local5 then + local f8_local6 = f8_local1:getChildById( "rankNumber" ) + f8_local6:setText( f8_local5 ) + f8_local2.rankNumber = f8_local5 + end + if MLG.IsMLGSpectator() and f8_local2.adrenaline ~= f8_arg5.adrenaline then + local f8_local6 = f8_local1:getChildById( "adrenaline" ) + if f8_local6 then + f8_local6:setText( f8_arg5.adrenaline ) + end + f8_local2.adrenaline = f8_arg5.adrenaline + end + local f8_local6 = f0_local18( f8_arg5 ) + if f8_local2.gamertag ~= f8_local6 then + local f8_local7 = f8_local1:getChildById( "gamertag" ) + f8_local7:setText( f8_local6 ) + f8_local2.gamertag = f8_local6 + end + for f8_local11, f8_local12 in ipairs( f8_arg0.cols ) do + local f8_local13 = f8_arg5[f8_local12[2]] .. "" + if f8_local2[f8_local12[2]] ~= f8_local13 then + local f8_local10 = f8_local1:getChildById( f8_local12[2] ) + f8_local10:setText( f8_local13 ) + f8_local2[f8_local12[2]] = f8_local13 + end + end + if MLG.IsMLGSpectator() then + f8_local7 = Game.GetOmnvar( "ui_bomb_carrier" ) + f8_local8 = f8_arg5.client + if f8_local8 then + f8_local8 = f8_arg5.client == f8_local7 + end + f8_local9 = f8_arg1:getFirstDescendentById( "bombIcon" ) + if f8_local9 then + f8_local12 = f8_local9 + f8_local11 = f8_local9.animateToState + local f8_local13 + if f8_local8 then + f8_local13 = "visible" + if not f8_local13 then + + else + f8_local11( f8_local12, f8_local13 ) + end + end + f8_local13 = "default" + end + end + elseif f0_local16( f8_arg1, "default", 250 ) then + f8_arg1.clientNum = nil + local f8_local4 = f8_local1:getChildById( "rankIcon" ) + local f8_local5 = RegisterMaterial( "specialty_null" ) + CoD.SetMaterial( f8_local4, f8_local5 ) + f8_local2.rankIcon = f8_local5 + local f8_local6 = f8_local1:getChildById( "rankNumber" ) + f8_local6:setText( "" ) + f8_local2.rankNumber = "" + local f8_local7 = f8_local1:getChildById( "gamertag" ) + f8_local7:setText( f0_local9 ) + f8_local2.gamertag = f0_local9 + for f8_local12, f8_local13 in ipairs( f8_arg0.cols ) do + local f8_local10 = f8_local1:getChildById( f8_local13[2] ) + f8_local10:setText( "" ) + f8_local2[f8_local13[2]] = "" + end + if MLG.IsMLGSpectator() then + f8_local8 = f8_local1:getFirstDescendentById( "bombIcon" ) + if f8_local8 then + f8_local8:animateToState( "default" ) + end + end + end + local f8_local4 = f8_local2.isMe + local f8_local5 = f8_arg2 == f8_arg3 + local f8_local6 = f8_local2.isInFocus + if not f8_local6 then + f8_local6 = false + end + local f8_local7 = f8_arg1:isInFocus() + if f8_local4 ~= f8_local5 or f8_local6 ~= f8_local7 then + if f8_local5 or f8_local7 then + f8_local1:processEvent( { + name = "go_black" + } ) + else + f8_local1:processEvent( { + name = "go_white" + } ) + end + f8_local2.isMe = f8_local5 + f8_local2.isInFocus = f8_local7 + end + if f8_local7 and f8_local3 ~= "dead" then + f0_local16( f8_local0, "focus", 0 ) + else + f0_local16( f8_local0, f8_local3, 250 ) + end +end + +local f0_local20 = nil +local f0_local21 = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3 ) + local f9_local0 = f9_arg0.slots[f9_arg2] + if f9_arg3 < f9_local0 then + for f9_local1 = f9_local0, f9_arg3 + 1, -1 do + f9_arg1:removeElement( f9_arg1:getChildById( f9_arg2 .. f9_local1 ) ) + end + if f9_arg2 == "listRowOpFor" and f9_arg3 == 0 then + f0_local16( f9_arg1:getChildById( "scoreHeaderOpFor" ), "hidden", 0 ) + end + elseif f9_local0 < f9_arg3 then + if not f9_arg1:getChildById( f9_arg2 .. f9_local0 ) and f9_arg2 == "listRow" then + local f9_local1 = f9_arg1:getChildById( "scoreHeader" ) + end + if f9_arg2 == "listRowOpFor" and f9_local0 == 0 then + f0_local16( f9_arg1:getChildById( "scoreHeaderOpFor" ), "default", 0 ) + end + local f9_local2 = MLG.IsMLGSpectator() + for f9_local3 = f9_arg3, f9_local0 + 1, -1 do + local f9_local6 = f0_local20( f9_arg0 ) + f9_local6.id = f9_arg2 .. f9_local3 + if not f9_local1 and f9_arg2 == "listRowOpFor" then + f9_arg1:addElement( f9_local6 ) + local f9_local1 = f9_local6 + end + f9_local6:addElementAfter( f9_local1 ) + if f9_local2 then + f9_arg1:updateNavigation() + end + end + end + f9_arg0.slots[f9_arg2] = f9_arg3 +end + +local f0_local22 = function ( f10_arg0, f10_arg1 ) + if f10_arg0.current_state ~= "active" and not MLG.IsMLGSpectator() then + return + end + local f10_local0 = f10_arg0:getChildById( "scorelistRows" ) + local f10_local1 = GameX.GetGameMode() + local f10_local2 = GameX.gameModeIsFFA( f10_local1 ) + f0_local14( f10_arg0, f10_local1, f10_local2 ) + f10_arg0:processEvent( { + name = "update_player_team", + immediate = true + } ) + if f10_local2 then + local f10_local3 = Game.GetPlayerTeam() + local f10_local4 = Game.GetPlayerScoreRanking() + if f10_local3 ~= Teams.free then + f10_local4 = nil + end + f0_local21( f10_arg0, f10_local0, "listRow", f10_arg0.slots[Teams.free] ) + for f10_local5 = 1, f10_arg0.slots.listRow, 1 do + f0_local19( f10_arg0, f10_local0:getChildById( "listRow" .. f10_local5 ), f10_local5, f10_local4, f10_local4 ~= f10_local5, GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.free, f10_local5, f10_local1, false ), f10_local1 ) + end + else + local f10_local3 = Game.GetPlayerTeam() + local f10_local4 = Game.GetPlayerScoreRanking() + if f10_local3 ~= Teams.axis and f10_local3 ~= Teams.allies then + f10_local3 = Teams.allies + f10_local4 = nil + end + local f10_local5 = GameX.GetPlayerOpposingTeam( f10_local3 ) + if f10_local1 == "infect" then + f0_local21( f10_arg0, f10_local0, "listRow", f10_arg0.slots[Teams.allies] ) + f0_local21( f10_arg0, f10_local0, "listRowOpFor", f10_arg0.slots[Teams.axis] ) + for f10_local6 = 1, f10_arg0.slots.listRow, 1 do + local f10_local9 = f10_local0:getChildById( "listRow" .. f10_local6 ) + local f10_local10 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.allies, f10_local6, f10_local1, false ) + local f10_local11 = f10_local3 ~= Teams.allies + if not f10_local11 then + local f10_local12 = f10_local4 + end + f0_local19( f10_arg0, f10_local9, f10_local6, f10_local12 or nil, f10_local11, f10_local10, f10_local1 ) + end + for f10_local6 = 1, f10_arg0.slots.listRowOpFor, 1 do + local f10_local9 = f10_local0:getChildById( "listRowOpFor" .. f10_local6 ) + local f10_local10 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.axis, f10_local6, f10_local1, false ) + local f10_local11 = f10_local3 ~= Teams.axis + if not f10_local11 then + local f10_local13 = f10_local4 + end + f0_local19( f10_arg0, f10_local9, f10_local6, f10_local13 or nil, f10_local11, f10_local10, f10_local1 ) + end + else + f0_local21( f10_arg0, f10_local0, "listRow", f10_arg0.slots[f10_local3] ) + f0_local21( f10_arg0, f10_local0, "listRowOpFor", f10_arg0.slots[f10_local5] ) + for f10_local6 = 1, f10_arg0.slots.listRow, 1 do + f0_local19( f10_arg0, f10_local0:getChildById( "listRow" .. f10_local6 ), f10_local6, f10_local4, false, GameX.GetPlayerScoreInfoAtRankForGameMode( f10_local3, f10_local6, f10_local1, false ), f10_local1 ) + end + for f10_local6 = 1, f10_arg0.slots.listRowOpFor, 1 do + f0_local19( f10_arg0, f10_local0:getChildById( "listRowOpFor" .. f10_local6 ), f10_local6, nil, true, GameX.GetPlayerScoreInfoAtRankForGameMode( f10_local5, f10_local6, f10_local1, false ), f10_local1 ) + end + end + end +end + +local f0_local23 = function ( f11_arg0, f11_arg1 ) + if f11_arg0.current_state ~= "default" and f11_arg0.current_state ~= nil then + f11_arg0:processEvent( { + name = "scorelist_turn_on" + } ) + end +end + +local f0_local24 = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + local self = LUI.UIText.new( { + topAnchor = true, + leftAnchor = true, + top = f12_arg4 or 0, + left = 0, + width = f12_arg2, + height = f12_arg3.Height, + font = f12_arg3.Font, + alignment = LUI.Alignment.Right, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + self.id = f12_arg1 + self:setText( f12_arg0 ) + self:registerAnimationState( "black_text", { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } ) + self:registerEventHandler( "go_black", MBh.AnimateToState( "black_text", 0 ) ) + self:registerEventHandler( "go_white", MBh.AnimateToState( "default", 0 ) ) + return self +end + +local f0_local25 = function ( f13_arg0, f13_arg1, f13_arg2, f13_arg3 ) + local self = LUI.UIText.new( { + topAnchor = true, + leftAnchor = true, + top = 8, + left = 0, + width = f13_arg2, + height = f13_arg3.Height - 1, + font = f13_arg3.Font, + alignment = LUI.Alignment.Right, + alpha = 0.75, + [1] = color + } ) + self.id = f13_arg1 + self:setText( f13_arg0 ) + return self +end + +local f0_local26 = function ( f14_arg0 ) + return LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + left = 0, + width = f14_arg0 + } ) +end + +f0_local20 = function ( f15_arg0, f15_arg1 ) + local f15_local0 = RegisterMaterial( "hud_scoreboard_bar" ) + local f15_local1 = RegisterMaterial( "hud_scoreboard_bar_a" ) + local f15_local2 = RegisterMaterial( "hud_scoreboard_bar_b" ) + local f15_local3 = RegisterMaterial( "hud_scoreboard_dead_yellow" ) + local f15_local4 = RegisterMaterial( "hud_scoreboard_dead_red" ) + local f15_local5 = RegisterMaterial( "hud_scoreboard_highlight_you" ) + local f15_local6 = f15_arg1 or { + rankIcon = RegisterMaterial( "specialty_null" ), + rankNumber = "", + gamertag = f0_local9, + current_state = "default" + } + local f15_local7 = LUI.UIElement.new + if MLG.IsMLGSpectator() then + f15_local7 = LUI.UIButton.new + end + local f15_local8 = f15_local7( { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + height = 20, + alpha = 0.25 + } ) + f15_local8.id = "scoreRow" + f15_local8.properties = f15_local6 + f15_local8:registerAnimationState( "filled", { + alpha = 1 + } ) + local self = LUI.UIImage.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f15_local1, + alpha = 0.75 + } ) + self.id = "scoreRowBg" + self:registerAnimationState( "bar_a", { + material = f15_local1, + alpha = 1 + } ) + self:registerAnimationState( "bar_b", { + material = f15_local2, + alpha = 0.4 + } ) + self:registerAnimationState( "downed", { + material = f15_local3, + alpha = 0.65 + } ) + self:registerAnimationState( "dead", { + material = f15_local4, + alpha = 0.65 + } ) + self:registerAnimationState( "highlight", { + material = f15_local5, + alpha = 1 + } ) + if MLG.IsMLGSpectator() then + self:registerAnimationState( "focus", CoD.ColorizeState( Colors.frontend_hilite, { + material = f15_local0, + alpha = 1 + } ) ) + self:registerEventHandler( "button_over", function ( element, event ) + f0_local16( element, "focus", 0 ) + f15_local8:processEvent( { + name = "go_black" + } ) + f15_local8.properties.isInFocus = true + MLG.HighlightClientNum( f15_local8.clientNum or -1 ) + end ) + self:registerEventHandler( "button_up", function ( element, event ) + f0_local22( f15_arg0, {} ) + f15_local8.properties.isInFocus = false + MLG.HighlightClientNum( -1 ) + end ) + self:registerEventHandler( "button_action", function ( element, event ) + if not f15_local8.clientNum then + return + else + f15_arg0:dispatchEventToRoot( { + name = "scoreboard_player_action", + clientNum = f15_local8.clientNum + } ) + end + end ) + local f15_local10 = LUI.UIHorizontalList.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + right = -2, + top = 4, + width = 64, + height = 16, + alignment = LUI.Alignment.Right + } ) + f15_local8:addElement( f15_local10 ) + local f15_local11 = LUI.UIImage.new( CoD.ColorizeState( Colors.frontend_hilite, { + material = RegisterMaterial( "alien_dpad_arrow_right" ), + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + right = 0, + top = 0, + width = 0, + height = 16 + } ) ) + f15_local11.id = "MLGCursor" + f15_local11:registerAnimationState( "visible", { + width = 8 + } ) + f15_local11:registerEventHandler( "button_over", MBh.AnimateToState( "visible" ) ) + f15_local11:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f15_local10:addElement( f15_local11 ) + local f15_local12 = LUI.UIImage.new() + f15_local12.id = "MLGTag" + f15_local12:registerAnimationState( "default", { + material = RegisterMaterial( "icon_mlg_cam" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + right = 0, + top = 0, + width = 0, + height = 16 + } ) + f15_local12:animateToState( "default" ) + f15_local12:registerAnimationState( "visible", { + width = 32 + } ) + f15_local12:registerEventHandler( "highlight_scoreboard_row_by_clientnum", function ( element, event ) + if not f15_local8.clientNum then + return + end + local f19_local0 = element + local f19_local1 = element.animateToState + local f19_local2 = f15_local8.clientNum + local f19_local3 = event.clientNum + f19_local1( f19_local0, REG6 and "visible" or "default" ) + if f15_local8.clientNum == event.clientNum then + element:dispatchEventToRoot( { + name = "update_mlg_prev_next", + followRow = f15_local8 + } ) + end + end ) + f15_local10:addElement( f15_local12 ) + local f15_local13 = LUI.UIImage.new() + f15_local13.id = "bombIcon" + f15_local13:registerAnimationState( "default", { + material = RegisterMaterial( "hud_suitcase_bomb" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + right = 0, + top = 0, + width = 0, + height = 16 + } ) + f15_local13:animateToState( "default" ) + f15_local13:registerAnimationState( "visible", { + width = 16 + } ) + f15_local13:registerOmnvarHandler( "ui_bomb_carrier", function ( f20_arg0, f20_arg1 ) + local f20_local0 = f20_arg0:getParent() + local f20_local1 = f20_arg0 + local f20_local2 = f20_arg0.animateToState + local f20_local3 = f20_local0.clientNum + local f20_local4 = f20_arg1.value + f20_local2( f20_local1, REG7 and "visible" or "default" ) + end ) + f15_local10:addElement( f15_local13 ) + end + f15_local8:addElement( self ) + local f15_local10 = LUI.UIHorizontalList.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + spacing = 0 + } ) + f15_local10.id = "rowList" + f15_local8:addElement( f15_local10 ) + local f15_local11 = { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } + if MLG.IsMLGSpectator() then + local f15_local12 = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = 7 + } ) + f15_local12.id = "mlgSpacer" + f15_local10:addElement( f15_local12 ) + local f15_local13 = LUI.UIText.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f0_local8, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f15_local13.id = "adrenaline" + f15_local13:setText( 0 ) + f15_local13:registerAnimationState( "black_text", f15_local11 ) + f15_local13:registerEventHandler( "go_black", MBh.AnimateToState( "black_text", 0 ) ) + f15_local13:registerEventHandler( "go_white", MBh.AnimateToState( "default", 0 ) ) + f15_local10:addElement( f15_local13 ) + end + local f15_local12 = f0_local4 + if MLG.IsMLGSpectator() then + f15_local12 = 0 + end + local f15_local13 = LUI.UIImage.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + right = f15_local12, + material = f15_local6.rankIcon + } ) + f15_local13.id = "rankIcon" + f15_local10:addElement( f15_local13 ) + f15_local12 = f0_local5 + 7 + if MLG.IsMLGSpectator() then + f15_local12 = 0 + end + local f15_local14 = LUI.UIText.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 7, + left = 0, + bottom = 7 + CoD.TextSettings.HudEuroMedTinyFont.Height, + right = f15_local12, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f15_local14.id = "rankNumber" + f15_local14:setText( f15_local6.rankNumber ) + f15_local14:registerAnimationState( "black_text", f15_local11 ) + f15_local14:registerEventHandler( "go_black", MBh.AnimateToState( "black_text", 0 ) ) + f15_local14:registerEventHandler( "go_white", MBh.AnimateToState( "default", 0 ) ) + f15_local10:addElement( f15_local14 ) + local f15_local15 = LUI.UIMarqueeText.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f0_local6 + 10, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f15_local15.id = "gamertag" + f15_local15:setText( f15_local6.gamertag ) + f15_local15:registerEventHandler( "go_black", function ( element, event ) + element:SetColor( 0, 0, 0, 1 ) + end ) + f15_local15:registerEventHandler( "go_white", function ( element, event ) + element:SetColor( 1, 1, 1, 1 ) + end ) + f15_local10:addElement( f15_local15 ) + for f15_local20, f15_local21 in ipairs( f15_arg0.cols ) do + local f15_local22 = f15_local21[2] + local f15_local19 = f15_local6[f15_local21[2]] + if not f15_local19 then + f15_local19 = "" + end + f15_local6[f15_local22] = f15_local19 + f15_local10:addElement( f0_local24( f15_local6[f15_local21[2]], f15_local21[2], f15_local21[4], CoD.TextSettings.HudEuroMedSmallFont ) ) + end + return f15_local8 +end + +local f0_local27 = function ( f23_arg0, f23_arg1 ) + local f23_local0 = RegisterMaterial( "hud_scoreboard_header" ) + local self = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 5 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:addElement( LUI.UIImage.new( { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 5, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 10, + material = f23_local0 + } ) ) + if MLG.IsMLGSpectator() then + if f23_arg1 then + local f23_local2 = LUI.UIText.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 8, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + left = 15, + width = 220, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f23_local2:registerAnimationState( "orange_text", { + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b, + alpha = 1 + } ) + f23_local2:setText( GameX.GetLocalizedTeamName( f23_arg1 ) ) + f23_local2:registerEventHandler( "update_player_team", function ( element, event ) + local f24_local0 = Game.GetLastMLGSpectateTeam() + if f24_local0 ~= Teams.axis and f24_local0 ~= Teams.allies then + f24_local0 = Teams.allies + end + if element.activeMLGTeam ~= f24_local0 then + if f24_local0 == Teams.allies then + element:animateToState( "orange_text" ) + else + element:animateToState( "default" ) + end + element.activeMLGTeam = f24_local0 + end + end ) + self:addElement( f23_local2 ) + end + else + local f23_local2 = LUI.UIText.new( { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 8, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + right = -5, + width = 200, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + alpha = 1 + } ) + f23_local2:setText( Engine.Localize( "@LUA_MENU_OPPOSING_TEAM_CAPS" ) ) + self:addElement( f23_local2 ) + end + return self +end + +local f0_local28 = function ( f25_arg0, f25_arg1 ) + local f25_local0 = RegisterMaterial( "hud_scoreboard_header" ) + local self = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 5 + } ) + self:addElement( LUI.UIImage.new( { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 5, + bottom = CoD.TextSettings.HudEuroMedSmallFont.Height + 10, + material = f25_local0 + } ) ) + local f25_local2 = LUI.UIHorizontalList.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + spacing = f0_local7 + } ) + f25_local2.id = "scoreHeaderRowList" + self:addElement( f25_local2 ) + local f25_local3 = 0 + if MLG.IsMLGSpectator() and f25_arg1 then + local f25_local4 = 135 + f25_local3 = f25_local4 + 8 + f0_local7 * 2 + f25_local2:addElement( f0_local26( 8 ) ) + local f25_local5 = LUI.UIMarqueeText.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 8, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + left = 0, + width = f25_local4, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b, + alpha = 1 + } ) + f25_local5:setText( GameX.GetLocalizedTeamName( f25_arg1 ) ) + f25_local5:registerEventHandler( "update_player_team", function ( element, event ) + local f26_local0 = Game.GetLastMLGSpectateTeam() + if f26_local0 ~= Teams.axis and f26_local0 ~= Teams.allies then + f26_local0 = Teams.allies + end + if element.activeMLGTeam ~= f26_local0 then + if f26_local0 == Teams.allies then + element:SetColor( Colors.cyan.r, Colors.cyan.g, Colors.cyan.b ) + else + element:SetColor( Colors.orange.r, Colors.orange.g, Colors.orange.b ) + end + element.activeMLGTeam = f26_local0 + end + end ) + f25_local2:addElement( f25_local5 ) + end + f25_local2:addElement( f0_local26( f0_local4 + f0_local5 + f0_local6 + f0_local7 * 3 - f25_local3 ) ) + for f25_local8, f25_local9 in ipairs( f25_arg0.cols ) do + f25_local2:addElement( f0_local25( f25_local9[1], f25_local9[2], f25_local9[3], CoD.TextSettings.HudEuroMedSmallFont ) ) + end + return self +end + +LUI.MenuBuilder.registerType( "scorelistHudDef", function () + local f27_local0 = { + topAnchor = true, + rightAnchor = true, + top = 0, + height = f0_local1, + right = -10, + width = 0, + alpha = 0 + } + local self = LUI.UIElement.new( f27_local0 ) + self.id = "scorelistHud" + self:registerAnimationState( "active", LUI.MenuBuilder.AnimStateBasedOn( f27_local0, { + width = f0_local2, + alpha = 1 + } ) ) + self:registerAnimationState( "opening", LUI.MenuBuilder.AnimStateBasedOn( f27_local0, { + width = f0_local2 + 40, + alpha = 0.25 + } ) ) + self:registerEventHandler( "toggle_scoreboard", f0_local15 ) + self:registerEventHandler( "keybind", function ( element, event ) + if event.command == "togglescores" or event.command == "+scores" then + f0_local15( element, event ) + end + end ) + self:registerEventHandler( "scorelist_refresh", f0_local22 ) + self:registerEventHandler( "hud_on", f0_local23 ) + self:registerEventHandler( "scorelist_turn_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + f0_local0 / 2 + }, + { + "active", + f0_local0 / 2 + } + } ) ) + local f27_local2 = LUI.UITimer.new( 250, "scorelist_refresh", "hud" ) + f27_local2.id = "scoreRefreshTimer" + self:addElement( f27_local2 ) + local f27_local3 = LUI.UIVerticalList.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + spacing = f0_local3, + alpha = 1 + } ) + f27_local3.id = "scorelistRows" + if MLG.IsMLGSpectator() then + f27_local3:registerEventHandler( "gamepad_button", function ( element, event ) + if event.button ~= "primary" and event.qualifier ~= ButtonQualifiers.DPad then + return + elseif not LUI.FlowManager.AnyActiveMenusInStack( Engine.GetLuiRoot() ) then + return LUI.UIElement.GamepadButton( element, event ) + else + + end + end ) + f27_local3:registerEventHandler( "focus_scoreboard", function ( element, event ) + element:processEvent( { + name = "gain_focus" + } ) + end ) + f27_local3:registerEventHandler( "unfocus_scoreboard", function ( element, event ) + element:processEvent( { + name = "lose_focus" + } ) + end ) + end + self:addElement( f27_local3 ) + local f27_local4 = GameX.GetGameMode() + local f27_local5 = GameX.gameModeIsFFA( f27_local4 ) + local f27_local6 = self + f27_local6.slots = {} + f0_local14( f27_local6, f27_local4, f27_local5 ) + f27_local6.cols = f0_local13( f27_local4, f27_local5 ) + if f27_local5 then + local f27_local7 = f0_local28( self ) + f27_local7.id = "scoreHeader" + f27_local3:addElement( f27_local7 ) + for f27_local8 = 1, f27_local6.slots[Teams.free], 1 do + local f27_local11 = f0_local20( self ) + f27_local11.id = "listRow" .. f27_local8 + f27_local3:addElement( f27_local11 ) + end + f27_local6.slots.listRow = f27_local6.slots[Teams.free] + elseif f27_local4 == "infect" then + local f27_local7 = f0_local28( self ) + f27_local7.id = "scoreHeader" + f27_local3:addElement( f27_local7 ) + for f27_local8 = 1, f27_local6.slots[Teams.allies], 1 do + local f27_local11 = f0_local20( self ) + f27_local11.id = "listRow" .. f27_local8 + f27_local3:addElement( f27_local11 ) + end + f27_local6.slots.listRow = f27_local6.slots[Teams.allies] + for f27_local8 = 1, f27_local6.slots[Teams.axis], 1 do + local f27_local11 = f0_local20( self ) + f27_local11.id = "listRowOpFor" .. f27_local8 + f27_local3:addElement( f27_local11 ) + end + f27_local6.slots.listRowOpFor = f27_local6.slots[Teams.axis] + else + local f27_local7 = Game.GetPlayerTeam() + if f27_local7 ~= Teams.axis and f27_local7 ~= Teams.allies then + f27_local7 = Teams.allies + end + local f27_local8 = GameX.GetPlayerOpposingTeam( f27_local7 ) + local f27_local9 = f0_local28( self, f27_local7 ) + f27_local9.id = "scoreHeader" + f27_local3:addElement( f27_local9, f27_local7 ) + for f27_local10 = 1, f27_local6.slots[f27_local7], 1 do + local f27_local13 = f0_local20( self ) + f27_local13.id = "listRow" .. f27_local10 + f27_local3:addElement( f27_local13 ) + end + f27_local6.slots.listRow = f27_local6.slots[f27_local7] + local f27_local10 = f0_local27( self, f27_local8 ) + f27_local10.id = "scoreHeaderOpFor" + f27_local3:addElement( f27_local10 ) + if f27_local6.slots[f27_local8] == 0 then + f0_local16( f27_local10, "hidden", 0 ) + end + for f27_local12 = 1, f27_local6.slots[f27_local8], 1 do + local f27_local15 = f0_local20( self ) + f27_local15.id = "listRowOpFor" .. f27_local12 + f27_local3:addElement( f27_local15 ) + end + f27_local6.slots.listRowOpFor = f27_local6.slots[f27_local8] + end + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/screeneffectshud.dec.lua b/lui/mp_hud/screeneffectshud.dec.lua new file mode 100644 index 0000000..e4b75a2 --- /dev/null +++ b/lui/mp_hud/screeneffectshud.dec.lua @@ -0,0 +1,184 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 + if type( nil ) ~= "boolean" then + f1_local0 = f1_arg1.value + else + f1_local0 = f1_arg1.value ~= 0 + end + if f1_local0 then + local f1_local1 = MBh.AnimateSequence( { + { + "opening", + 0 + }, + { + "active", + f1_arg0.properties.open_time or 100 + }, + { + "default", + f1_arg0.properties.fade_time or 2000 + } + } ) + f1_local1( f1_arg0 ) + else + f1_arg0:animateToState( "default", 0 ) + end +end + +f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4 ) + local f2_local0, f2_local1 = GameX.GetScreenDims() + f2_local0 = f2_local0 / 2 + f2_local1 = f2_local1 / 2 + local f2_local2 = f2_arg2 == LUI.Alignment.Left + local f2_local3 = f2_arg2 == LUI.Alignment.Center + local f2_local4 = f2_arg2 == LUI.Alignment.Right + local self = LUI.UIImage.new() + self.id = "screen_effect_" .. f2_arg0 + local f2_local6 = self + local f2_local7 = self.registerAnimationState + local f2_local8 = "default" + local f2_local9 = { + material = RegisterMaterial( f2_arg0 ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = not f2_local4, + rightAnchor = not f2_local2, + bottom = f2_local1 + } + local f2_local10 + if f2_arg3 then + f2_local10 = 0 + if not f2_local10 then + + else + f2_local9.top = f2_local10 + if f2_local4 then + f2_local10 = -2 * f2_local0 + if not f2_local10 then + + else + f2_local9.left = f2_local10 + if f2_local2 then + f2_local10 = 2 * f2_local0 + if not f2_local10 then + + else + f2_local9.right = f2_local10 + f2_local9.alpha = 0 + f2_local7( f2_local6, f2_local8, f2_local9 ) + self:animateToState( "default" ) + f2_local6 = self + f2_local7 = self.registerAnimationState + f2_local8 = "active" + f2_local9 = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = not f2_local4, + rightAnchor = not f2_local2, + bottom = f2_local1 + } + if f2_arg3 then + f2_local10 = 0 + if not f2_local10 then + + else + f2_local9.top = f2_local10 + if f2_local4 then + f2_local10 = -2 * f2_local0 + if not f2_local10 then + + else + f2_local9.left = f2_local10 + if f2_local2 then + f2_local10 = 2 * f2_local0 + if not f2_local10 then + + else + f2_local9.right = f2_local10 + f2_local9.alpha = f2_arg1 + f2_local7( f2_local6, f2_local8, f2_local9 ) + f2_local6 = self + f2_local7 = self.registerAnimationState + f2_local8 = "opening" + f2_local9 = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = not f2_local4, + rightAnchor = not f2_local2, + bottom = f2_local1 + } + if f2_arg3 then + f2_local10 = 0 + if not f2_local10 then + + else + f2_local9.top = f2_local10 + f2_local9.left = 0 + f2_local9.right = 0 + f2_local9.alpha = 0 + f2_local7( f2_local6, f2_local8, f2_local9 ) + self:registerOmnvarHandler( f2_arg4, f0_local0 ) + return self + end + end + f2_local10 = -f2_local1 + end + end + f2_local10 = 0 + end + end + f2_local10 = 0 + end + end + f2_local10 = -f2_local1 + end + end + f2_local10 = 0 + end + end + f2_local10 = 0 + end + end + f2_local10 = -f2_local1 +end + +function screenEffectsHudDef() + local self = LUI.UIElement.new() + self.id = "screenEffectsHudId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } ) + self:animateToState( "default" ) + return self +end + +function lowHealthHudDef() + local self = LUI.UILitImage.new() + self.id = "lowHealthHudDefId" + self:setupOwnerdraw( CoD.Ownerdraw.CGLowHealthOverlay ) + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "vfx_blood_screen_overlay" ) + } ) + self:animateToState( "default", 0 ) + return self +end + +LUI.MenuBuilder.registerType( "lowHealthHudDef", lowHealthHudDef ) +LUI.MenuBuilder.registerType( "screenEffectsHudDef", screenEffectsHudDef ) +LockTable( _M ) diff --git a/lui/mp_hud/spectatorhud.dec.lua b/lui/mp_hud/spectatorhud.dec.lua new file mode 100644 index 0000000..0513c6b --- /dev/null +++ b/lui/mp_hud/spectatorhud.dec.lua @@ -0,0 +1,140 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function UpdateSpectator( f1_arg0, f1_arg1 ) + local f1_local0 = f1_arg0:getChildById( "spectatorPlayerCard" ) + local f1_local1 = Game.GetPlayerstateClientnum() + if f1_local0.current_client_num ~= f1_local1 then + local f1_local2 = f1_local0:getFirstDescendentById( "playerCardBg" ) + local f1_local3 = f1_local0:getFirstDescendentById( "playerCardPatchBg" ) + local f1_local4 = f1_local0:getFirstDescendentById( "playerCardPatch" ) + local f1_local5 = f1_local0:getFirstDescendentById( "playerCardQuipText" ) + local f1_local6 = f1_local0:getFirstDescendentById( "playerCardClanTagText" ) + local f1_local7 = f1_local0:getFirstDescendentById( "playerCardRankIcon" ) + local f1_local8 = f1_local0:getFirstDescendentById( "playerCardRankText" ) + local f1_local9 = f1_local0:getFirstDescendentById( "playerCardNameText" ) + local f1_local10 = nil + if f1_local1 ~= -1 then + f1_local10 = Game.GetPlayerScoreInfo( f1_local1 ) + end + if f1_local10 and f1_local1 ~= Game.GetPlayerClientnum() then + f1_local8:setText( "" ) + if f1_local10.rank then + f1_local8:setText( f1_local10.rank + 1 ) + end + local f1_local11 = f1_local10.name or "" + f1_local6:setText( "" ) + if Engine.IsConsoleGame() and string.sub( f1_local11, 1, 1 ) == "[" then + local f1_local12 = string.find( f1_local11, "]" ) + if f1_local12 then + f1_local6:setText( string.sub( f1_local11, 1, f1_local12 ) ) + f1_local11 = string.sub( f1_local11, f1_local12 + 1 ) + end + end + f1_local9:setText( f1_local11 ) + if f1_local10.rankIcon then + CoD.SetMaterial( f1_local7, f1_local10.rankIcon ) + end + local f1_local12 = Game.GetPlayerCard( f1_local1 ) + CoD.SetMaterial( f1_local2, RegisterMaterial( Engine.TableLookup( BackgroundsTable.File, BackgroundsTable.Cols.Ref, f1_local12.background, BackgroundsTable.Cols.CardImage ) ) ) + CoD.SetMaterial( f1_local3, RegisterMaterial( Engine.TableLookup( PatchBackingsTable.File, PatchBackingsTable.Cols.Ref, f1_local12.patchBacking, PatchBackingsTable.Cols.CardImage ) ) ) + CoD.SetMaterial( f1_local4, RegisterMaterial( Engine.TableLookup( PatchesTable.File, PatchesTable.Cols.Ref, f1_local12.patch, PatchesTable.Cols.CardImage ) ) ) + f1_local5:setText( Engine.Localize( Engine.TableLookup( PatchesTable.File, PatchesTable.Cols.Ref, f1_local12.patch, PatchesTable.Cols.Quip ) ) ) + local f1_local13 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f1_local13( f1_local0 ) + else + f1_local0:animateToState( "default", 0 ) + end + f1_local0.current_client_num = f1_local1 + end +end + +LUI.MenuBuilder.registerType( "spectatorHudDef", function () + local self = LUI.UIElement.new() + self.id = "spectatorHud" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "hud_refresh", UpdateSpectator ) + local f2_local1 = LUI.UIText.new() + f2_local1.id = "spectatorTextId" + f2_local1:setText( Engine.Localize( "@LUA_MENU_SPECTATING_CAPS" ) ) + f2_local1:setTextStyle( CoD.TextStyle.Shadowed ) + f2_local1:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 60, + left = -512, + height = CoD.TextSettings.HudEuroBigFont.Height, + right = 512, + font = CoD.TextSettings.HudEuroBigFont.Font, + alpha = 0.6 + } ) + f2_local1:animateToState( "default", 0 ) + local f2_local2 = LUI.UIElement.new() + f2_local2.id = "spectatorPlayerCard" + f2_local2:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -60, + left = -512, + height = 64, + width = 256, + alpha = 0 + } ) + f2_local2:animateToState( "default", 0 ) + f2_local2:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -60, + left = -128, + height = 64, + width = 256, + alpha = 1 + } ) + f2_local2:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -60, + left = -118, + height = 64, + width = 256, + alpha = 1 + } ) + f2_local2:addElement( LUI.mp_hud.PlayerCardHud.playerCardHudDef() ) + self:addElement( f2_local1 ) + self:addElement( f2_local2 ) + self:addElement( LUI.mp_hud.Hints.spectatorControlsDef() ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/splasheshud.dec.lua b/lui/mp_hud/splasheshud.dec.lua new file mode 100644 index 0000000..57edc2d --- /dev/null +++ b/lui/mp_hud/splasheshud.dec.lua @@ -0,0 +1,825 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = 89.6 +f0_local1 = 358.4 +f0_local2 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = tonumber( Engine.TableLookupByRow( SplashTable.File, f1_arg0, SplashTable.Cols.Duration ) ) * 1000 + local f1_local1 = Engine.TableLookupByRow( SplashTable.File, f1_arg0, SplashTable.Cols.Image ) + local f1_local2 = Engine.Localize( Engine.TableLookupByRow( SplashTable.File, f1_arg0, SplashTable.Cols.Name ), f1_arg1 ) + local f1_local3 = "" + if f1_arg0 == 37 then + f1_local3 = Engine.Localize( Engine.TableLookupByRow( SplashTable.File, f1_arg0, SplashTable.Cols.Desc ), Engine.Localize( "@" .. Engine.TableLookup( "mp/rankTable.csv", 0, f1_arg1, 5 ) ) ) + else + f1_local3 = Engine.Localize( Engine.TableLookupByRow( SplashTable.File, f1_arg0, SplashTable.Cols.Desc ), f1_arg1 ) + end + return f1_local0, f1_local1, f1_local2, f1_local3 +end + +local f0_local3 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg1.value + if f2_local0 == -1 then + f2_arg0:animateToState( "default", 0 ) + return + end + local f2_local1, f2_local2, f2_local3, f2_local4 = f0_local2( f2_local0, Game.GetOmnvar( "ui_splash_optional_number" ) ) + local f2_local5 = f2_arg0:getChildById( "splashBackingImageId" ) + local f2_local6 = f2_arg0:getChildById( "splashImageId" ) + if f2_local2 and string.len( f2_local2 ) ~= 0 then + CoD.SetMaterial( f2_local6, RegisterMaterial( f2_local2 ) ) + f2_local5:animateToState( "active", 0 ) + f2_local6:animateToState( "active", 0 ) + else + f2_local5:animateToState( "default", 0 ) + f2_local6:animateToState( "default", 0 ) + end + local f2_local7 = f2_arg0:getChildById( "splashNameId" ) + f2_local7:setText( f2_local3 ) + local f2_local8 = f2_arg0:getChildById( "splashDescId" ) + f2_local8:setText( f2_local4 ) + local f2_local9 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 150 + }, + { + "active", + f2_local1 + }, + { + "leave", + 150 + } + } ) + f2_local9( f2_arg0 ) +end + +local f0_local4 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg1.value + if f3_local0 == -1 then + f3_arg0:animateToState( "default", 0 ) + return + end + local f3_local1 = Engine.TableLookupByRow( SplashTable.File, f3_local0, SplashTable.Cols.Ref ) + local f3_local2 = tonumber( Engine.TableLookupByRow( SplashTable.File, f3_local0, SplashTable.Cols.Duration ) ) * 1000 + local f3_local3 = Game.GetOmnvar( "ui_splash_killstreak_optional_number" ) + local f3_local4 = "" + local f3_local5 = Game.GetOmnvar( "ui_splash_killstreak_clientnum" ) + if f3_local5 >= 0 then + f3_local4 = Game.GetPlayerName( f3_local5 ) + end + local f3_local6 = RegisterMaterial( Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, f3_local1, KillstreakTable.Cols.DPadIcon ) ) + local f3_local7 = f3_arg0:getChildById( "earnedKillstreakImageId" ) + CoD.SetMaterial( f3_local7, f3_local6 ) + local f3_local8 = f3_arg0:getChildById( "earnedKillstreakBackingImageId" ) + local f3_local9 = f3_arg0:getChildById( "earnedKillstreakPlayerNameId" ) + f3_local9:setText( f3_local4 ) + local f3_local10 = Engine.Localize( Engine.TableLookupByRow( SplashTable.File, f3_local0, SplashTable.Cols.Desc ) ) + local f3_local11 = f3_arg0:getChildById( "earnedKillstreakNameId" ) + f3_local11:setText( f3_local10 ) + local f3_local12 = Engine.Localize( Engine.TableLookupByRow( SplashTable.File, f3_local0, SplashTable.Cols.Name ), f3_local3 ) + local f3_local13 = f3_arg0:getChildById( "earnedKillstreakDescId" ) + f3_local13:setText( f3_local12 ) + local f3_local14 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 0 + }, + { + "active", + f3_local2 + }, + { + "leave", + 250 + } + } ) + f3_local14( f3_arg0 ) + f3_local14 = MBh.AnimateSequence( { + { + "start", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f3_local14( f3_local8 ) + f3_local14 = MBh.AnimateSequence( { + { + "start", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 150 + } + } ) + f3_local14( f3_local7 ) + f3_local14 = MBh.AnimateSequence( { + { + "start", + 0 + }, + { + "start", + 500 + }, + { + "opening", + 100 + }, + { + "active", + 100 + } + } ) + f3_local14( f3_local11 ) + if f3_local3 ~= 0 then + f3_local14 = MBh.AnimateSequence( { + { + "start", + 0 + }, + { + "start", + 750 + }, + { + "opening", + 100 + }, + { + "active", + 100 + } + } ) + f3_local14( f3_local13 ) + else + f3_local13:animateToState( "default", 0 ) + end +end + +local f0_local5 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg1.value + if f4_local0 == -1 then + f4_arg0:animateToState( "default", 0 ) + return + end + local f4_local1 = tonumber( Engine.TableLookupByRow( SplashTable.File, f4_local0, SplashTable.Cols.Duration ) ) * 1000 + local f4_local2 = Game.GetOmnvar( "ui_splash_playercard_optional_number" ) + local f4_local3 = Game.GetOmnvar( "ui_splash_playercard_clientnum" ) + local f4_local4 = Game.GetPlayerTeam( f4_local3 ) + local f4_local5 = Game.GetPlayerName( f4_local3 ) + local f4_local6 = Game.GetPlayerCard( f4_local3 ) + if Engine.IsConsoleGame() and string.sub( f4_local5, 1, 1 ) == "[" then + local f4_local7 = string.find( f4_local5, "]" ) + if f4_local7 then + local f4_local8 = string.sub( f4_local5, 1, f4_local7 ) + f4_local5 = string.sub( f4_local5, f4_local7 + 1 ) + end + end + f4_arg0:setSplashCardData( Engine.TableLookup( PatchesTable.File, PatchesTable.Cols.Ref, f4_local6.patch, PatchesTable.Cols.CardImage ), f4_local5, Engine.Localize( Engine.TableLookupByRow( SplashTable.File, f4_local0, SplashTable.Cols.Name ), f4_local2 ) ) + f4_arg0:showSplashCard( f4_local1 ) + local f4_local9 = Game.GetPlayerTeam() + local f4_local10 = GameX.gameModeIsFFA() + local f4_local11 = true + if f4_local10 then + local f4_local12 = Game.GetPlayerScoreInfoAtRank( f4_local9, Game.GetPlayerScoreRanking() ) + f4_local11 = f4_local5 ~= f4_local12.name + else + f4_local11 = f4_local9 ~= f4_local4 + end + local f4_local13 = f4_arg0:getChildById( "cardSplashTitleId" ) + if f4_local11 then + f4_local13:SetColor( Colors.orange.r, Colors.orange.g, Colors.orange.b ) + else + f4_local13:SetColor( Colors.cyan.r, Colors.cyan.g, Colors.cyan.b ) + end +end + +local f0_local6 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg1.value + if f5_local0 == -1 then + f5_arg0:animateToState( "default", 0 ) + return + else + local f5_local1, f5_local2, f5_local3, f5_local4 = f0_local2( f5_local0, Game.GetOmnvar( "ui_challenge_splash_optional_number" ) ) + f5_arg0:setSplashCardData( f5_local2, f5_local3, f5_local4 ) + local f5_local5 = f5_arg0:getChildById( "cardSplashTitleId" ) + f5_local5:animateToState( "default", 0 ) + f5_arg0:showSplashCard( f5_local1 ) + end +end + +local f0_local7 = function ( menu, controller ) + local self = LUI.UIElement.new() + self.id = menu + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 155, + left = -f0_local1, + height = f0_local0, + width = f0_local1, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 155, + left = 5, + height = f0_local0, + width = f0_local1, + alpha = 1 + } ) + self:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 155, + left = 25, + height = f0_local0, + width = f0_local1, + alpha = 1 + } ) + self:registerAnimationState( "leave", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 155, + left = -f0_local1, + height = f0_local0, + width = f0_local1, + alpha = 0 + } ) + local f6_local1 = LUI.UIImage.new() + f6_local1.id = "cardSplashBgId" + f6_local1:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = controller + } ) + f6_local1:animateToState( "default", 0 ) + local f6_local2 = LUI.UIImage.new() + f6_local2.id = "cardSplashIconId" + f6_local2:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 15, + left = 0, + height = 64, + width = 64, + material = default_material + } ) + f6_local2:animateToState( "default", 0 ) + local f6_local3 = 0.58 + local f6_local4 = LUI.UIMarqueeText.new() + f6_local4.id = "cardSplashTitleId" + f6_local4:setText( "" ) + f6_local4:setTextStyle( CoD.TextStyle.Shadowed ) + f6_local4:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 15, + left = 64, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = f0_local1 * f6_local3, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b + } ) + f6_local4:animateToState( "default", 0 ) + local f6_local5 = LUI.UIMarqueeText.new() + f6_local5.id = "cardSplashDescId" + f6_local5:setText( "" ) + f6_local5:setTextStyle( CoD.TextStyle.Shadowed ) + f6_local5:SetUseTextWrapping( true ) + f6_local5:SetTextHeight( CoD.TextSettings.HudEuroMedSmallFont.Height ) + f6_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 35, + left = 64, + height = 0, + width = f0_local1 * f6_local3, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f6_local5:animateToState( "default", 0 ) + f6_local5:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 35, + left = 64, + height = CoD.TextSettings.HudEuroMedSmallFont.Height * 2, + width = f0_local1 * f6_local3 + } ) + self:addElement( f6_local1 ) + self:addElement( f6_local2 ) + self:addElement( f6_local4 ) + self:addElement( f6_local5 ) + self.setSplashCardData = function ( f7_arg0, f7_arg1, f7_arg2, f7_arg3 ) + local f7_local0 = f7_arg0:getChildById( "cardSplashIconId" ) + if f7_arg1 and string.len( f7_arg1 ) ~= 0 then + CoD.SetMaterial( f7_local0, RegisterMaterial( f7_arg1 ) ) + f7_local0:animateToState( "active", 0 ) + end + local f7_local1 = f7_arg0:getChildById( "cardSplashTitleId" ) + f7_local1:setText( f7_arg2 ) + local f7_local2 = f7_arg0:getChildById( "cardSplashDescId" ) + f7_local2:setText( f7_arg3 ) + f7_local2:animateToState( "active", 0 ) + end + + self.showSplashCard = function ( f8_arg0, f8_arg1 ) + local f8_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 150 + }, + { + "active", + f8_arg1 + }, + { + "leave", + 150 + } + } ) + f8_local0( f8_arg0 ) + end + + return self +end + +LUI.MenuBuilder.registerType( "splashesHudDef", function () + local f9_local0 = RegisterMaterial( "white" ) + local f9_local1 = RegisterMaterial( "hud_message_bg" ) + local f9_local2 = RegisterMaterial( "popup_backing" ) + local self = LUI.UIElement.new() + self.id = "splashesHud" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } ) + self:animateToState( "default", 0 ) + local f9_local4 = nil + if not Engine.UsingSplitscreenUpscaling() then + f9_local4 = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -250, + height = 64, + width = 64 + } + else + f9_local4 = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 10, + height = 64, + width = 64 + } + end + local f9_local5 = LUI.UIElement.new( LUI.MenuBuilder.AnimStateBasedOn( f9_local4, { + left = -532, + alpha = 0 + } ) ) + f9_local5.id = "splashId" + f9_local5:registerAnimationState( "opening", LUI.MenuBuilder.AnimStateBasedOn( f9_local4, { + left = -12, + alpha = 1 + } ) ) + f9_local5:registerAnimationState( "active", LUI.MenuBuilder.AnimStateBasedOn( f9_local4, { + alpha = 1 + } ) ) + f9_local5:registerAnimationState( "leave", LUI.MenuBuilder.AnimStateBasedOn( f9_local4, { + left = 468, + alpha = 0 + } ) ) + f9_local5:registerOmnvarHandler( "ui_splash_idx", f0_local3 ) + local f9_local6 = LUI.UIImage.new() + f9_local6.id = "splashBackingImageId" + f9_local6:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -64, + height = 64, + width = 64, + material = f9_local2, + alpha = 0 + } ) + f9_local6:animateToState( "default", 0 ) + f9_local6:registerAnimationState( "active", { + alpha = 1 + } ) + local f9_local7 = LUI.UIImage.new() + f9_local7.id = "splashImageId" + f9_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -64, + height = 64, + width = 64, + material = f9_local0, + alpha = 0 + } ) + f9_local7:animateToState( "default", 0 ) + f9_local7:registerAnimationState( "active", { + alpha = 1 + } ) + local f9_local8 = LUI.UIText.new() + f9_local8.id = "splashNameId" + f9_local8:setText( "" ) + f9_local8:setTextStyle( CoD.TextStyle.Shadowed ) + f9_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 10, + left = 0, + height = CoD.TextSettings.HudEuroBigFont.Height, + width = 1024, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b + } ) + f9_local8:animateToState( "default", 0 ) + local f9_local9 = LUI.UIText.new() + f9_local9.id = "splashDescId" + f9_local9:setText( "" ) + f9_local9:setTextStyle( CoD.TextStyle.Shadowed ) + f9_local9:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 35, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 350, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f9_local9:animateToState( "default", 0 ) + f9_local5:addElement( f9_local6 ) + f9_local5:addElement( f9_local7 ) + f9_local5:addElement( f9_local8 ) + f9_local5:addElement( f9_local9 ) + local f9_local10, f9_local11 = nil + if not Engine.UsingSplitscreenUpscaling() then + f9_local10 = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -250, + width = 64, + height = 64, + scale = 0, + alpha = 0 + } + local f9_local12 = {} + f9_local12 = GameX.GetScreenDims() + f9_local11 = LUI.MenuBuilder.AnimStateBasedOn( f9_local10, { + left = f9_local12[1] / 2, + top = f9_local12[2] / 2, + scale = -1 + } ) + else + f9_local10 = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 10, + width = 64, + height = 64, + scale = 0, + alpha = 0 + } + local f9_local12 = {} + f9_local12 = GameX.GetScreenDims() + f9_local11 = LUI.MenuBuilder.AnimStateBasedOn( f9_local10, { + left = f9_local12[1] / 2, + top = f9_local12[2], + scale = -1 + } ) + end + local f9_local12 = LUI.UIElement.new( f9_local10 ) + f9_local12.id = "earnedKillstreakSplashId" + f9_local12:registerAnimationState( "active", LUI.MenuBuilder.AnimStateBasedOn( f9_local10, { + alpha = 1 + } ) ) + f9_local12:registerAnimationState( "leave", f9_local11 ) + f9_local12:registerOmnvarHandler( "ui_splash_killstreak_idx", f0_local4 ) + local f9_local13 = LUI.UIImage.new() + f9_local13.id = "earnedKillstreakBackingImageId" + f9_local13:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -64, + height = 64, + width = 64, + material = f9_local2, + alpha = 0 + } ) + f9_local13:animateToState( "default", 0 ) + f9_local13:registerAnimationState( "start", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -256, + left = -320, + bottom = 320, + right = 320, + alpha = 0 + } ) + f9_local13:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -64, + height = 64, + width = 64, + alpha = 1 + } ) + f9_local13:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -64, + height = 64, + width = 64, + alpha = 1 + } ) + local f9_local14 = LUI.UIImage.new() + f9_local14.id = "earnedKillstreakImageId" + f9_local14:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -64, + height = 64, + width = 64, + material = f9_local0, + alpha = 0 + } ) + f9_local14:animateToState( "default", 0 ) + f9_local14:registerAnimationState( "start", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -256, + left = -320, + bottom = 320, + right = 320, + alpha = 0 + } ) + f9_local14:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -64, + height = 32, + width = 32, + alpha = 1 + } ) + f9_local14:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -64, + height = 64, + width = 64, + alpha = 1 + } ) + local f9_local15 = LUI.UIText.new() + f9_local15.id = "earnedKillstreakPlayerNameId" + f9_local15:setText( "" ) + f9_local15:setTextStyle( CoD.TextStyle.Shadowed ) + f9_local15:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -25, + left = 0, + right = 1024, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f9_local15:animateToState( "default", 0 ) + local f9_local16 = LUI.UIText.new() + f9_local16.id = "earnedKillstreakNameId" + f9_local16:setText( "" ) + f9_local16:setTextStyle( CoD.TextStyle.Shadowed ) + f9_local16:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 10, + left = 0, + height = CoD.TextSettings.HudEuroNormalFont.Height, + width = 1024, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 0 + } ) + f9_local16:animateToState( "default", 0 ) + f9_local16:registerAnimationState( "start", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 10, + left = -64, + height = CoD.TextSettings.HudEuroNormalFont.Height, + width = 1024, + alpha = 0 + } ) + f9_local16:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 10, + left = 40, + height = CoD.TextSettings.HudEuroNormalFont.Height, + width = 1024, + alpha = 1 + } ) + f9_local16:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 10, + left = 0, + height = CoD.TextSettings.HudEuroNormalFont.Height, + width = 1024, + alpha = 1 + } ) + local f9_local17 = LUI.UIText.new() + f9_local17.id = "earnedKillstreakDescId" + f9_local17:setText( "" ) + f9_local17:setTextStyle( CoD.TextStyle.Shadowed ) + f9_local17:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 35, + left = 0, + height = CoD.TextSettings.HudEuroNormalFont.Height, + width = 1024, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Left, + alpha = 0 + } ) + f9_local17:animateToState( "default", 0 ) + f9_local17:registerAnimationState( "start", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 35, + left = -64, + height = CoD.TextSettings.HudEuroNormalFont.Height, + width = 1024, + alpha = 0 + } ) + f9_local17:registerAnimationState( "opening", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 35, + left = 40, + height = CoD.TextSettings.HudEuroNormalFont.Height, + width = 1024, + alpha = 1 + } ) + f9_local17:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 35, + left = 0, + height = CoD.TextSettings.HudEuroNormalFont.Height, + width = 1024, + alpha = 1 + } ) + f9_local12:addElement( f9_local15 ) + f9_local12:addElement( f9_local16 ) + f9_local12:addElement( f9_local17 ) + f9_local12:addElement( f9_local13 ) + f9_local12:addElement( f9_local14 ) + local f9_local18 = f0_local7( "playerCardId", f9_local1 ) + f9_local18:registerOmnvarHandler( "ui_splash_playercard_idx", f0_local5 ) + local f9_local19 = f0_local7( "challengeSplashId", f9_local1 ) + f9_local19:registerOmnvarHandler( "ui_challenge_splash_idx", f0_local6 ) + self:addElement( f9_local5 ) + self:addElement( f9_local12 ) + self:addElement( f9_local18 ) + self:addElement( f9_local19 ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/talkerhud.dec.lua b/lui/mp_hud/talkerhud.dec.lua new file mode 100644 index 0000000..37995b3 --- /dev/null +++ b/lui/mp_hud/talkerhud.dec.lua @@ -0,0 +1,235 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = RegisterMaterial( "voice_on" ) +f0_local1 = function () + local f1_local0 = { + type = "UIVerticalList", + id = "talkersVLId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 32, + left = 0, + height = 256, + width = 256, + alignment = LUI.Alignment.Left, + spacing = 0 + } + }, + children = {} + } + for f1_local1 = 1, 4, 1 do + local f1_local4 = f1_local0.children + local f1_local5 = { + type = "UIElement", + id = "talkersChildrenContainerId" .. f1_local1, + states = { + default = { + topAnchor = true, + leftAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 256, + alpha = 0 + }, + active = { + alpha = 1 + } + }, + handlers = { + talker_refresh = function ( f2_arg0, f2_arg1 ) + assert( f2_arg1.original ) + local f2_local0 = f2_arg1.original.newValue + if f2_local0 ~= -1 then + local f2_local1 = f2_arg0:getFirstChild() + f2_local1:setText( Game.GetPlayerName( f2_local0 ) ) + if f2_arg0.current_state ~= "active" then + f2_arg0:animateToState( "active", 0 ) + f2_arg0.current_state = "active" + end + elseif f2_arg0.current_state ~= "default" then + f2_arg0:animateToState( "default", 250 ) + f2_arg0.current_state = "default" + end + end + } + } + local f1_local6 = {} + local f1_local7 = { + type = "UIText", + id = "talkersNameTextId" .. f1_local1, + properties = { + text = "", + textStyle = CoD.TextStyle.Shadowed + } + } + local f1_local8 = {} + local f1_local9 = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0 + } + local f1_local10 + if not Engine.IsAliensMode() then + f1_local10 = CoD.TextSettings.HudEuroMedSmallFont.Height + if not f1_local10 then + + else + f1_local9.left = f1_local10 + f1_local9.right = Engine.IsAliensMode() and -5 or nil + f1_local9.width = 200 + f1_local9.height = CoD.TextSettings.HudEuroMedSmallFont.Height + f1_local9.font = CoD.TextSettings.HudEuroMedSmallFont.Font + f1_local9.alignment = Engine.IsAliensMode() and LUI.Alignment.Right or LUI.Alignment.Left + f1_local8.default = f1_local9 + f1_local7.states = f1_local8 + f1_local8 = { + type = "UIImage", + id = "talkersIconImageId" .. f1_local1 + } + f1_local9 = {} + f1_local10 = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0 + } + local f1_local11 + if not Engine.IsAliensMode() then + f1_local11 = 0 + if not f1_local11 then + + else + f1_local10.left = f1_local11 + f1_local10.right = Engine.IsAliensMode() and 0 or nil + f1_local10.height = CoD.TextSettings.HudEuroMedSmallFont.Height + f1_local10.width = CoD.TextSettings.HudEuroMedSmallFont.Height * (Engine.IsAliensMode() and -1 or 1) + f1_local10.material = f0_local0 + f1_local9.default = f1_local10 + f1_local8.states = f1_local9 + f1_local9 = { + type = "UIIntWatch", + properties = { + dataSource = "Talker", + param1 = f1_local1 - 1 + }, + handlers = { + int_watch_alert = MBh.EmitEventToParent( "talker_refresh", { + saveOriginal = true + } ) + } + } + f1_local6[1] = f1_local7 + f1_local6[2] = f1_local8 + f1_local6[3] = f1_local9 + f1_local5.children = f1_local6 + f1_local4[f1_local1] = f1_local5 + end + end + f1_local11 = nil + end + end + f1_local10 = nil + end + return f1_local0 +end + +LUI.MenuBuilder.registerDef( "talkerHudDef", function () + local f3_local0 = { + type = "UIElement", + id = "talkerHudId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 10, + left = 295, + height = 256, + width = 256, + alpha = 1 + }, + inactive = { + alpha = 0 + } + }, + handlers = { + hud_off = MBh.AnimateToState( "inactive", 0 ), + hud_on = MBh.AnimateToState( "default", 0 ) + } + } + local f3_local1 = {} + local f3_local2 = { + type = "UIImage", + id = "talkerPlayerImageId" + } + local f3_local3 = {} + local f3_local4 = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0 + } + local f3_local5 + if not Engine.IsAliensMode() then + f3_local5 = 0 + if not f3_local5 then + + else + f3_local4.left = f3_local5 + f3_local4.right = Engine.IsAliensMode() and -11 or nil + f3_local4.height = 32 + f3_local5 = Engine.IsAliensMode() and -1 or 1 + local f3_local6 = 32 * f3_local5 + f3_local4.width = f3_local5 + f3_local4.material = f0_local0 + f3_local4.alpha = 0 + f3_local3.default = f3_local4 + f3_local3.talking = { + alpha = 1 + } + f3_local2.states = f3_local3 + f3_local2.handlers = { + talking_refresh = function ( f4_arg0, f4_arg1 ) + assert( f4_arg1.original ) + if f4_arg1.original.newValue ~= 0 and f4_arg0.current_state ~= "talking" then + f4_arg0:animateToState( "talking", 0 ) + f4_arg0.current_state = "talking" + elseif f4_arg1.original.newValue == 0 and f4_arg0.current_state ~= "default" then + f4_arg0:animateToState( "default", 150 ) + f4_arg0.current_state = "default" + end + end + } + f3_local2.children = { + { + type = "UIIntWatch", + properties = { + dataSource = "Talking" + }, + handlers = { + int_watch_alert = MBh.EmitEventToParent( "talking_refresh", { + saveOriginal = true + } ) + } + } + } + f3_local3 = f0_local1() + f3_local0.children = f3_local2 + return f3_local0 + end + end + f3_local5 = nil +end ) +LockTable( _M ) diff --git a/lui/mp_hud/teamscoreshud.dec.lua b/lui/mp_hud/teamscoreshud.dec.lua new file mode 100644 index 0000000..65f0b27 --- /dev/null +++ b/lui/mp_hud/teamscoreshud.dec.lua @@ -0,0 +1,519 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = Engine.Localize( "@LUA_MENU_WINNING" ) +f0_local1 = Engine.Localize( "@LUA_MENU_LOSING" ) +f0_local2 = Engine.Localize( "@LUA_MENU_TIED" ) +local f0_local3 = Engine.Localize( "@" .. Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, Engine.GetDvarString( "ui_gametype" ), GameTypesTable.Cols.Name ) ) +local f0_local4 = 215 +local f0_local5 = 10 +local f0_local6 = 22 +local f0_local7 = 22 +local f0_local8 = 250 +local f0_local9 = 10000 +function SetTextAndAnimateSequenceIfChanged( f1_arg0, f1_arg1, f1_arg2, f1_arg3 ) + if f1_arg0.current_state ~= f1_arg2 then + f1_arg0:setText( f1_arg1 ) + local f1_local0 = MBh.AnimateSequence( f1_arg3 ) + f1_local0( f1_arg0 ) + f1_arg0.current_state = f1_arg2 + end +end + +local f0_local10 = { + { + "default", + 0 + }, + { + "slide_in", + 250 + } +} +local f0_local11 = { + winning = { + text = f0_local0, + status = "winning", + anim = { + { + "default", + 0 + }, + { + "slide_in", + 250 + }, + { + "winning", + 250 + } + } + }, + losing = { + text = f0_local1, + status = "losing", + anim = { + { + "default", + 0 + }, + { + "slide_in", + 250 + }, + { + "losing", + 250 + } + } + }, + tied = { + text = f0_local2, + status = "tied", + anim = { + { + "default", + 0 + }, + { + "slide_in", + 250 + }, + { + "tied", + 250 + } + } + } +} +local f0_local12 = function ( f2_arg0 ) + local self = LUI.UIText.new() + self.id = f2_arg0.id or nil + self:setupUIBindText( f2_arg0.dataSource ) + self:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = f2_arg0.bottom, + height = f2_arg0.height, + font = f2_arg0.font, + alignment = f2_arg0.alignment + } ) + self:animateToState( "default", 0 ) + return self +end + +local f0_local13 = function ( f3_arg0 ) + local self = LUI.UIHorizontalList.new() + self.id = f3_arg0.id or nil + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = f3_arg0.bottom or 0, + left = f3_arg0.left or 0, + height = f3_arg0.height + } ) + self:animateToState( "default", 0 ) + if f3_arg0.startcap ~= nil then + local f3_local1 = LUI.UIImage.new() + f3_local1.id = "start_cap" + f3_local1:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + bottom = 0, + left = 0, + width = f3_arg0.startcap.width, + height = f3_arg0.imageHeight, + material = RegisterMaterial( f3_arg0.startcap.material ) + } ) + f3_local1:animateToState( "default", 0 ) + self:addElement( f3_local1 ) + end + local f3_local1 = LUI.UIImage.new() + f3_local1.id = "middle" + f3_local1:setupUIScorebar( f3_arg0.dataSource ) + f3_local1.m_maxScore = f3_arg0.maxScore + f3_local1.m_maxWidth = f3_arg0.maxWidth - (f3_arg0.startcap and f3_arg0.startcap.width or 0) - (f3_arg0.endcap and f3_arg0.endcap.width or 0) + f3_local1:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + bottom = 0, + height = f3_arg0.imageHeight, + material = RegisterMaterial( f3_arg0.material ) + } ) + f3_local1:animateToState( "default", 0 ) + self:addElement( f3_local1 ) + if f3_arg0.endcap ~= nil then + local f3_local2 = LUI.UIImage.new() + f3_local2.id = "end_cap" + f3_local2:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + bottom = 0, + left = 0, + width = f3_arg0.endcap.width, + height = f3_arg0.imageHeight, + material = RegisterMaterial( f3_arg0.endcap.material ) + } ) + f3_local2:animateToState( "default", 0 ) + self:addElement( f3_local2 ) + end + return self +end + +local f0_local14 = function () + if GameX.gameModeIsFFA() then + local f4_local0 = Game.GetPlayerScoreRanking() or 0 + if f4_local0 > 1 then + local f4_local1 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.free, 1, GameX.GetGameMode() ) + local f4_local2 = GameX.GetPlayerScoreInfoAtRankForGameMode( Teams.free, f4_local0, GameX.GetGameMode() ) + if f4_local1.score == f4_local2.score then + return "tied" + else + return "losing" + end + end + local f4_local1 = Game.GetPlayerName() + local f4_local2 = Game.GetPlayerScore() + local f4_local3 = Game.GetPlayerTeam() + local f4_local4 = Game.GetNumPlayersOnTeam( f4_local3 ) + local f4_local5 = false + for f4_local6 = 1, f4_local4, 1 do + local f4_local9 = Game.GetPlayerScoreInfoAtRank( f4_local3, f4_local6 ) + if f4_local9 and f4_local9.name ~= f4_local1 then + f4_local5 = f4_local9.score == f4_local2 + if f4_local5 then + break + end + end + end + if f4_local5 then + return "tied" + end + return "winning" + else + local f4_local0 = Game.GetPlayerTeam() + local f4_local1 = GameX.GetPlayerOpposingTeam() + local f4_local2 = Game.GetTeamScore( f4_local0 ) or 0 + local f4_local3 = Game.GetTeamScore( f4_local1 ) or 0 + if f4_local3 < f4_local2 then + return "winning" + elseif f4_local2 < f4_local3 then + return "losing" + elseif f4_local2 == f4_local3 then + return "tied" + else + return nil + end + end +end + +local f0_local15 = function ( f5_arg0, f5_arg1 ) + if f5_arg0.current_match_status ~= f5_arg1 then + local f5_local0 = f5_arg0:getChildById( "cycle_text_timer" ) + f5_local0:reset() + end +end + +local f0_local16 = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0 + if f6_arg0.id ~= "score_info_text" then + local f6_local1 = f6_arg0:getParent() + f6_local0 = f6_local1:getChildById( "score_info_text" ) + end + if f6_local0.current_score_info == nil then + f6_local0.current_score_info = "game_mode" + f6_local0.current_match_status = "tied" + SetTextAndAnimateSequenceIfChanged( f6_local0, f0_local3, "game_mode", f0_local10 ) + return + elseif f6_arg1.name == "cycle_text" then + if f6_local0.current_score_info ~= "game_mode" then + f6_local0.current_score_info = "game_mode" + else + f6_local0.current_score_info = "win_lose_tie" + end + end + if f6_local0.current_score_info == "game_mode" then + if f6_arg1.name == "cycle_text" then + SetTextAndAnimateSequenceIfChanged( f6_local0, f0_local3, "game_mode", f0_local10 ) + else + local f6_local1 = f0_local14() + if f6_local1 ~= f6_local0.current_match_status then + SetTextAndAnimateSequenceIfChanged( f6_local0, f0_local11[f6_local1].text, f0_local11[f6_local1].status, f0_local11[f6_local1].anim ) + f6_local0.current_match_status = f0_local11[f6_local1].status + end + end + else + local f6_local1 = f0_local14() + SetTextAndAnimateSequenceIfChanged( f6_local0, f0_local11[f6_local1].text, f0_local11[f6_local1].status, f0_local11[f6_local1].anim ) + f0_local15( f6_local0, f0_local11[f6_local1].status ) + f6_local0.current_match_status = f0_local11[f6_local1].status + end +end + +LUI.MenuBuilder.registerType( "teamScoresHudDef", function () + local f7_local0 = RegisterMaterial( "hud_scorebar_bg" ) + local f7_local1 = Engine.GetDvarInt( "ui_scorelimit" ) + local self = LUI.UIElement.new() + self.id = "teamScoresId" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -10, + left = -18, + height = 128, + width = 0, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -10, + left = -18, + height = 128, + width = 512, + alpha = 1 + } ) + self:registerAnimationState( "opening", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -10, + left = -18, + height = 128, + width = 552, + alpha = 1 + } ) + self:registerEventHandler( "hud_on", MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + f0_local8 / 2 + }, + { + "active", + f0_local8 / 2 + } + } ) ) + local f7_local3 = LUI.UIImage.new() + f7_local3.id = "teamScoresBgId" + f7_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f7_local0 + } ) + f7_local3:animateToState( "default", 0 ) + local f7_local4 = LUI.UIElement.new() + f7_local4.id = "teamScoresFriendlyScore" + f7_local4:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + bottom = -27, + left = 58, + height = CoD.TextSettings.HudDigitalBigFont.Height, + width = 40 + } ) + f7_local4:animateToState( "default", 0 ) + local f7_local5 = LUI.UIText.new() + f7_local5.id = "teamScoresFriendlyScoreBg" + f7_local5:setText( "8888" ) + f7_local5:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + height = CoD.TextSettings.HudDigitalBigFont.Height, + font = CoD.TextSettings.HudDigitalBigFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0, + alpha = 0.25 + } ) + f7_local5:animateToState( "default", 0 ) + f7_local4:addElement( f7_local5 ) + f7_local4:addElement( f0_local12( { + id = "friendlyTeamScoreNum", + dataSource = "TeamScoreFriendly", + bottom = 0, + height = CoD.TextSettings.HudDigitalBigFont.Height, + font = CoD.TextSettings.HudDigitalBigFont.Font, + alignment = LUI.Alignment.Right + } ) ) + local f7_local6 = LUI.UIElement.new() + f7_local6.id = "teamScoresEnemyScore" + f7_local6:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + bottom = -3, + left = 58, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + width = 40 + } ) + f7_local6:animateToState( "default", 0 ) + local f7_local7 = LUI.UIText.new() + f7_local7.id = "teamScoresEnemyScoreBg" + f7_local7:setText( "8888" ) + f7_local7:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + font = CoD.TextSettings.HudDigitalNormalFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0, + alpha = 0.25 + } ) + f7_local7:animateToState( "default", 0 ) + f7_local6:addElement( f7_local7 ) + f7_local6:addElement( f0_local12( { + id = "enemyTeamScoreNum", + dataSource = "TeamScoreEnemy", + bottom = 0, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + font = CoD.TextSettings.HudDigitalNormalFont.Font, + alignment = LUI.Alignment.Right + } ) ) + local f7_local8 = LUI.UIVerticalList.new() + f7_local8.id = "teamScoreBars" + f7_local8:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + bottom = 10, + left = 101, + height = 50, + width = 200, + spacing = 5 + } ) + f7_local8:animateToState( "default", 0 ) + f7_local8:addElement( f0_local13( { + id = "friendlyTeamScorebar", + dataSource = "TeamScoreFriendly", + bottom = 0, + left = 0, + height = 17, + maxScore = f7_local1, + material = "hud_scorebar_min_cyan", + maxWidth = f0_local4, + imageHeight = f0_local7, + endcap = { + material = "hud_scorebar_cap_cyan", + width = f0_local6 + } + } ) ) + f7_local8:addElement( f0_local13( { + id = "enemyTeamScorebar", + dataSource = "TeamScoreEnemy", + bottom = 0, + left = 0, + height = 17, + maxScore = f7_local1, + material = "hud_scorebar_min_orange", + maxWidth = f0_local4 - 12, + imageHeight = f0_local7, + endcap = { + material = "hud_scorebar_cap_orange", + width = f0_local6 + } + } ) ) + local f7_local9 = LUI.UIText.new() + f7_local9.id = "score_info_text" + f7_local9:setText( "" ) + f7_local9:setTextStyle( CoD.TextStyle.Shadowed ) + f7_local9:registerAnimationState( "default", { + leftAnchor = true, + bottomAnchor = true, + bottom = -10, + left = 500, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f7_local9:animateToState( "default", 0 ) + f7_local9:registerAnimationState( "slide_in", { + leftAnchor = true, + bottomAnchor = true, + bottom = -10, + left = 315, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f7_local9:registerAnimationState( "winning", { + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b + } ) + f7_local9:registerAnimationState( "losing", { + red = Colors.orange.r, + green = Colors.orange.g, + blue = Colors.orange.b + } ) + f7_local9:registerAnimationState( "tied", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + f7_local9:registerAnimationState( "blink_off", { + alpha = 0 + } ) + f7_local9:registerAnimationState( "blink_on", { + alpha = 1 + } ) + f7_local9:registerEventHandler( "cycle_text", f0_local16 ) + local f7_local10 = { + event = "cycle_text", + group = "hud", + interval = f0_local9 + } + local f7_local11 = LUI.UITimer.new( f7_local10.interval, f7_local10.event, f7_local10.group ) + f7_local11.id = "cycle_text_timer" + f7_local9:addElement( f7_local11 ) + local f7_local12 = LUI.UIElement.new() + f7_local12:setupUIIntWatch( "TeamScoreFriendly" ) + f7_local12.id = "friendly_score_watch" + f7_local12:registerEventHandler( "int_watch_alert", f0_local16 ) + local f7_local13 = LUI.UIElement.new() + f7_local13:setupUIIntWatch( "TeamScoreEnemy" ) + f7_local13.id = "enemy_score_watch" + f7_local13:registerEventHandler( "int_watch_alert", f0_local16 ) + f7_local3:addElement( f7_local4 ) + f7_local3:addElement( f7_local6 ) + f7_local3:addElement( f7_local8 ) + f7_local3:addElement( f7_local9 ) + f7_local3:addElement( f7_local12 ) + f7_local3:addElement( f7_local13 ) + f7_local3:addElement( LUI.MenuBuilder.buildItems( { + type = "timersHudDef" + }, f7_local3.properties, f7_local3 ) ) + self:addElement( f7_local3 ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/teamselect.dec.lua b/lui/mp_hud/teamselect.dec.lua new file mode 100644 index 0000000..f2e5434 --- /dev/null +++ b/lui/mp_hud/teamselect.dec.lua @@ -0,0 +1,192 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then + f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addFriendsButton ) + end +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f2_arg0 ) +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + Engine.NotifyServer( "team_select", 0 ) + local f3_local0 = Engine.GetDvarString( "g_gametype" ) +end + +local f0_local3 = function ( f4_arg0, f4_arg1 ) + Engine.NotifyServer( "team_select", 1 ) + local f4_local0 = Engine.GetDvarString( "g_gametype" ) +end + +local f0_local4 = function ( f5_arg0, f5_arg1 ) + Engine.NotifyServer( "team_select", 2 ) + local f5_local0 = Engine.GetDvarString( "g_gametype" ) +end + +local f0_local5 = function ( f6_arg0, f6_arg1 ) + Engine.NotifyServer( "team_select", 3 ) + local f6_local0 = MBh.EmitEventToRoot( "toggle_pause_off" ) + f6_local0( f6_arg0 ) + LUI.FlowManager.RequestCloseAllMenus( f6_arg0 ) +end + +local f0_local6 = function () + local f7_local0 = MatchRules.GetData( "commonOption", "spectateModeAllowed" ) + local f7_local1 = Game.GetPlayerTeam() + if Engine.GetDvarBool( "xblive_competitionmatch" ) and Engine.GetDvarBool( "xblive_privatematch" ) then + f7_local0 = 0 + end + local self = LUI.UIVerticalList.new() + self.id = "team_select_selections_Id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = GenericMenuDims.menu_top, + left = GenericMenuDims.menu_left, + bottom = GenericMenuDims.menu_bottom, + right = GenericMenuDims.menu_right, + alignment = LUI.Alignment.Top + } ) + self:animateToState( "default", 0 ) + self:makeFocusable() + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIGenericButton", + id = "btn_MPTeamChange_0", + properties = { + childNum = 1, + button_text = Engine.Localize( "@LUA_MENU_AUTOASSIGN_CAPS" ), + button_action_func = f0_local4 + } + } ) + local f7_local3 = LUI.MenuBuilder.BuildAddChild + local f7_local4 = self + local f7_local5 = { + type = "UIGenericButton", + id = "btn_MPTeamChange_1" + } + local f7_local6 = { + childNum = 2, + button_text = GameX.GetLocalizedTeamName( Teams.allies ), + button_action_func = f0_local3 + } + local f7_local7 + if f7_local1 == Teams.allies then + f7_local7 = Colors.yellow + if not f7_local7 then + + else + f7_local6.text_default_color = f7_local7 + f7_local5.properties = f7_local6 + f7_local5.handlers = { + menu_create = function ( f8_arg0, f8_arg1 ) + f8_arg0.listDefaultFocus = f7_local1 == Teams.allies + end + } + f7_local3( f7_local4, f7_local5 ) + f7_local3 = LUI.MenuBuilder.BuildAddChild + f7_local4 = self + f7_local5 = { + type = "UIGenericButton", + id = "btn_MPTeamChange_2" + } + f7_local6 = { + childNum = 3, + button_text = GameX.GetLocalizedTeamName( Teams.axis ), + button_action_func = f0_local2 + } + if f7_local1 == Teams.axis then + f7_local7 = Colors.yellow + if not f7_local7 then + + else + f7_local6.text_default_color = f7_local7 + f7_local5.properties = f7_local6 + f7_local5.handlers = { + menu_create = function ( f9_arg0, f9_arg1 ) + f9_arg0.listDefaultFocus = f7_local1 == Teams.axis + end + } + f7_local3( f7_local4, f7_local5 ) + if f7_local0 ~= 0 then + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIGenericButton", + id = "btn_MPTeamChange_3", + properties = { + childNum = 4, + button_text = Engine.Localize( "@LUA_MENU_SPECTATOR_CAPS" ), + button_action_func = f0_local5, + text_default_color = Game.GetOmnvar( "ui_spectator_selected" ) and Colors.yellow or Colors.generic_button_text_default_color + }, + handlers = { + menu_create = function ( f10_arg0, f10_arg1 ) + f10_arg0.listDefaultFocus = Game.GetOmnvar( "ui_spectator_selected" ) == 1 + end + } + } ) + end + return self + end + end + f7_local7 = Colors.generic_button_text_default_color + end + end + f7_local7 = Colors.generic_button_text_default_color +end + +LUI.MenuBuilder.registerType( "team_select_main", function () + local f11_local0 = Engine.Localize( "@LUA_MENU_CHANGE_TEAM_CAPS" ) + local self = LUI.UIElement.new() + self.id = "mp_team_select_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerEventHandler( "menu_create", f0_local0 ) + self:registerOmnvarHandler( "ui_pause_menu_show", LUI.mp_hud.OptionsMenu.pauseMenuUpdate ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "UIWorldBlur", + id = "tsWorldBlurOverlay", + states = { + default = { + worldBlur = 5 + } + } + } ) + self:addElement( LUI.mp_hud.OptionsMenu.mp_pause_menu_background_def() ) + LUI.MenuBuilder.BuildAddChild( self, { + type = "button_helper_text_main", + id = "tshelper_text_id" + } ) + if GameX.IsOnlineMatch() and not GameX.IsSplitscreen() then + LUI.MenuBuilder.BuildAddChild( self, { + type = "online_friends_widget", + id = "tsfriends_widget_id" + } ) + end + local f11_local2 = LUI.UIBindButton.new() + f11_local2.id = "tsBackToGameStartButton" + f11_local2:registerEventHandler( "button_start", f0_local1 ) + f11_local2:registerEventHandler( "button_secondary", f0_local1 ) + self:addElement( LUI.mp_hud.OptionsMenu.mp_pause_menu_title_def( f11_local0 ) ) + self:addElement( f0_local6() ) + self:addElement( LUI.mp_hud.OptionsMenu.game_mode_def() ) + self:addElement( LUI.mp_hud.OptionsMenu.map_display_def() ) + self:addElement( f11_local2 ) + return self +end ) +LockTable( _M ) diff --git a/lui/mp_hud/timershud.dec.lua b/lui/mp_hud/timershud.dec.lua new file mode 100644 index 0000000..427ead3 --- /dev/null +++ b/lui/mp_hud/timershud.dec.lua @@ -0,0 +1,581 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function SendEventIfChanged( f1_arg0, f1_arg1 ) + if f1_arg0.current_state ~= f1_arg1 then + f1_arg0:processEvent( { + name = f1_arg1 + } ) + f1_arg0.current_state = f1_arg1 + end +end + +function AnimateToStateIfChanged( f2_arg0, f2_arg1, f2_arg2 ) + if f2_arg0.current_state ~= f2_arg1 then + local f2_local0 = MBh.AnimateToState( f2_arg1, f2_arg2 ) + f2_local0( f2_arg0 ) + f2_arg0.current_state = f2_arg1 + end +end + +f0_local0 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = Game.GetOmnvar( "ui_bomb_timer" ) + local f3_local1 = Game.GetOmnvar( "ui_carrying_bomb" ) + local f3_local2 = nil + if f3_local0 == 0 and f3_local1 then + f3_local2 = "matchTimerBomber" + elseif f3_local0 == 0 and not f3_local1 then + f3_local2 = "matchTimer" + elseif f3_local0 == 4 then + f3_local2 = "nukeTimer" + else + f3_local2 = "bombTimer" + end + if f3_local0 == 0 then + local f3_local3 = f3_arg0:getChildById( "match_timer" ) + if f3_local3 then + local f3_local4 = Game.GetTimeLeft() + if f3_local4 <= 0 then + AnimateToStateIfChanged( f3_local3, "inactive", 0 ) + elseif f3_local4 <= 30000 then + SendEventIfChanged( f3_local3, "flash" ) + else + AnimateToStateIfChanged( f3_local3, "default", 0 ) + end + end + local f3_local4 = f3_arg0:getChildById( "bomb_timer" ) + if f3_local4 then + AnimateToStateIfChanged( f3_local4, "inactive", 0 ) + local f3_local5 = f3_arg0:getChildById( "bomb_timer_image" ) + if f3_local1 then + AnimateToStateIfChanged( f3_local5, "bomb", 0 ) + else + AnimateToStateIfChanged( f3_local5, "inactive", 0 ) + end + end + local f3_local5 = f3_arg0:getChildById( "paused_timer" ) + if f3_local5 then + AnimateToStateIfChanged( f3_local5, "inactive", 0 ) + end + elseif f3_local0 == 5 then + local f3_local3 = f3_arg0:getChildById( "match_timer" ) + if f3_local3 then + AnimateToStateIfChanged( f3_local3, "inactive", 0 ) + end + local f3_local4 = f3_arg0:getChildById( "bomb_timer" ) + if f3_local4 then + AnimateToStateIfChanged( f3_local4, "inactive", 0 ) + local f3_local5 = f3_arg0:getChildById( "bomb_timer_image" ) + if f3_local1 then + AnimateToStateIfChanged( f3_local5, "bomb", 0 ) + else + AnimateToStateIfChanged( f3_local5, "inactive", 0 ) + end + end + local f3_local5 = f3_arg0:getChildById( "paused_timer" ) + if f3_local5 then + SendEventIfChanged( f3_local5, "flash" ) + end + else + local f3_local3 = f3_arg0:getChildById( "match_timer" ) + if f3_local3 then + AnimateToStateIfChanged( f3_local3, "inactive", 0 ) + end + local f3_local4 = f3_arg0:getChildById( "paused_timer" ) + if f3_local4 then + AnimateToStateIfChanged( f3_local4, "inactive", 0 ) + end + local f3_local5 + if f3_local0 == 4 then + f3_local5 = Game.GetOmnvar( "ui_nuke_end_milliseconds" ) + if not f3_local5 then + + else + local f3_local6 = f3_local5 - Game.GetTime() + local f3_local7 = f3_arg0:getChildById( "bomb_timer" ) + if f3_local6 > 0 then + f3_local7:setEndTime( f3_local5 ) + end + SendEventIfChanged( f3_local7, "flash" ) + local f3_local8 = f3_arg0:getChildById( "bomb_timer_image" ) + local f3_local9 = AnimateToStateIfChanged + local f3_local10 = f3_local8 + local f3_local11 + if f3_local0 == 4 then + f3_local11 = "nuke" + if not f3_local11 then + + else + f3_local9( f3_local10, f3_local11, 0 ) + end + end + f3_local11 = "bomb" + end + end + f3_local5 = Game.GetOmnvar( "ui_bomb_timer_endtime" ) + end +end + +f0_local1 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = Game.GetOmnvar( "ui_bomb_timer" ) + local f4_local1 = f4_arg0:getChildById( "bomb_timer_image" ) + if f4_arg1.name == "playerstate_client_changed" then + f4_arg1.value = Game.GetOmnvar( "ui_carrying_bomb" ) + end + if f4_arg1.value == true then + AnimateToStateIfChanged( f4_local1, "bomb", 250 ) + elseif f4_local0 == 0 or f4_local0 == 5 then + AnimateToStateIfChanged( f4_local1, "inactive", 0 ) + else + local f4_local2 = AnimateToStateIfChanged + local f4_local3 = f4_local1 + local f4_local4 + if f4_local0 == 4 then + f4_local4 = "nuke" + if not f4_local4 then + + else + f4_local2( f4_local3, f4_local4, 0 ) + end + end + f4_local4 = "bomb" + end +end + +f0_local2 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0:getChildById( "match_timer" ) + local f5_local1 = f5_arg0:getChildById( "bomb_timer" ) + local f5_local2 = f5_arg0:getChildById( "bomb_timer_image" ) + f5_local0.current_state = nil + f5_local1.current_state = nil + f5_local2.current_state = nil + f0_local0( f5_arg0, f5_arg1 ) +end + +local f0_local3 = function ( f6_arg0, f6_arg1 ) + if Game.GetOmnvar( "ui_bomb_timer" ) == 0 then + f0_local2( f6_arg0, f6_arg1 ) + end +end + +local f0_local4 = function ( f7_arg0, f7_arg1 ) + if Game.GetOmnvar( "ui_bomb_timer" ) == 0 then + local f7_local0 = f7_arg0:getChildById( "match_timer" ) + SendEventIfChanged( f7_arg0, "flash" ) + end +end + +local f0_local5 = function ( f8_arg0 ) + local f8_local0 = f8_arg0:getChildById( "cranked_warning_bg" ) + local f8_local1 = MBh.AnimateToState( "default", 0 ) + f8_local1( f8_local0 ) + f8_local1 = f8_arg0:getChildById( "cranked_text" ) + local f8_local2 = MBh.AnimateToState( "default", 0 ) + f8_local2( f8_local1 ) + f8_local2 = f8_arg0:getChildById( "cranked_countdown_bg" ) + local f8_local3 = MBh.AnimateToState( "default", 0 ) + f8_local3( f8_local2 ) + f8_local3 = f8_arg0:getChildById( "cranked_countdown" ) + local f8_local4 = MBh.AnimateToState( "default", 0 ) + f8_local4( f8_local3 ) +end + +local f0_local6 = function ( f9_arg0, f9_arg1 ) + if f9_arg1.value > 0 then + f9_arg0:animateToState( "active", 250 ) + local f9_local0 = f9_arg0:getChildById( "cranked_countdown" ) + f9_local0:setEndTime( f9_arg1.value ) + f9_local0:animateToState( "default", 0 ) + elseif f9_arg0.current_state ~= "default" then + f9_arg0:animateToState( "default", 250 ) + end + f0_local5( f9_arg0 ) +end + +local f0_local7 = function ( f10_arg0 ) + local f10_local0 = MBh.AnimateLoop( { + { + "default", + 350 + }, + { + "flashing", + 350 + } + } ) + f10_local0( f10_arg0 ) +end + +local f0_local8 = function ( f11_arg0, f11_arg1 ) + f0_local7( f11_arg0:getChildById( "cranked_warning_bg" ) ) + f0_local7( f11_arg0:getChildById( "cranked_text" ) ) + f0_local7( f11_arg0:getChildById( "cranked_countdown_bg" ) ) + f0_local7( f11_arg0:getChildById( "cranked_countdown" ) ) +end + +local f0_local9 = function ( f12_arg0, f12_arg1 ) + if f12_arg1.value == "round_time" then + f12_arg0:setText( Engine.Localize( "@MP_HORDE_SPECIAL_ROUND_TIME" ) ) + elseif f12_arg1.value == "start_time" then + f12_arg0:setText( Engine.Localize( "@MP_HORDE_ROUND_START_TIMER" ) ) + else + f12_arg0:setText( Engine.Localize( "@LUA_MENU_CRANKED_CAPS" ) ) + end +end + +local f0_local10 = function ( f13_arg0, f13_arg1 ) + local f13_local0 = Game.GetOmnvar( "ui_cranked_bomb_timer_end_milliseconds" ) + f0_local6( f13_arg0, { + name = "ui_cranked_bomb_timer_end_milliseconds", + value = f13_local0 + } ) + if f13_local0 <= 5000 + Game.GetTime() then + f0_local8( f13_arg0 ) + end +end + +local f0_local11 = function () + local f14_local0 = RegisterMaterial( "hud_suitcase_bomb" ) + local f14_local1 = RegisterMaterial( "icon_ks_level_hud" ) + local self = LUI.UIElement.new() + self.id = "timersHud" + self:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + bottom = MLG.IsMLGSpectator() and -75 or -30, + left = MLG.IsMLGSpectator() and 195 or 320, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "inactive", { + alpha = 0 + } ) + self:registerEventHandler( "menu_create", f0_local0 ) + self:registerOmnvarHandler( "ui_bomb_timer", f0_local0 ) + self:registerEventHandler( "timeBeingReset", f0_local3 ) + self:registerOmnvarHandler( "ui_carrying_bomb", f0_local1 ) + self:registerEventHandler( "playerstate_client_changed", f0_local1 ) + local f14_local3 = LUI.UICountdown.new( { + endTime = "round_end" + } ) + f14_local3.id = "match_timer" + f14_local3:setTextStyle( CoD.TextStyle.Shadowed ) + f14_local3:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + bottom = 0, + left = 0, + width = 60, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + font = CoD.TextSettings.HudDigitalNormalFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f14_local3:animateToState( "default", 0 ) + f14_local3:registerAnimationState( "white", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f14_local3:registerAnimationState( "red", { + red = Colors.red.r, + green = Colors.red.g, + blue = Colors.red.b, + alpha = 1 + } ) + f14_local3:registerAnimationState( "inactive", { + alpha = 0 + } ) + f14_local3:registerEventHandler( "flash", MBh.AnimateLoop( { + { + "red", + 1000 + }, + { + "white", + 0 + } + } ) ) + f14_local3:registerEventHandler( "timeout", MBh.AnimateToState( "inactive", 0 ) ) + f14_local3:registerEventHandler( "time30sec", f0_local4 ) + f14_local3:registerEventHandler( "timeReset", MBh.EmitEventToParent( "timeBeingReset" ) ) + local f14_local4 = LUI.UICountdown.new( {} ) + f14_local4.id = "bomb_timer" + f14_local4:setTextStyle( CoD.TextStyle.Shadowed ) + f14_local4:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + bottom = 0, + left = 0, + width = 60, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + font = CoD.TextSettings.HudDigitalNormalFont.Font, + alignment = LUI.Alignment.Right, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f14_local4:animateToState( "default", 0 ) + f14_local4:registerAnimationState( "white", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f14_local4:registerAnimationState( "red", { + red = Colors.red.r, + green = Colors.red.g, + blue = Colors.red.b, + alpha = 1 + } ) + f14_local4:registerAnimationState( "inactive", { + alpha = 0 + } ) + f14_local4:registerEventHandler( "flash", MBh.AnimateLoop( { + { + "red", + 1000 + }, + { + "white", + 0 + } + } ) ) + local f14_local5 = LUI.UIImage.new() + f14_local5.id = "bomb_timer_image" + f14_local5:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + bottom = -22, + left = 0, + height = 64, + width = 64, + material = f14_local0, + alpha = 0 + } ) + f14_local5:animateToState( "default", 0 ) + f14_local5:registerAnimationState( "bomb", { + material = f14_local0, + alpha = 1 + } ) + f14_local5:registerAnimationState( "nuke", { + material = f14_local1, + alpha = 1 + } ) + f14_local5:registerAnimationState( "inactive", { + alpha = 0 + } ) + local f14_local6 = LUI.UIText.new() + f14_local6.id = "paused_timer" + f14_local6:setTextStyle( CoD.TextStyle.Shadowed ) + f14_local6:setText( Engine.Localize( "@LUA_MENU_MP_COUNTDOWN_PAUSED" ) ) + f14_local6:registerAnimationState( "default", { + bottomAnchor = true, + leftAnchor = true, + bottom = 0, + left = -10, + width = 200, + height = CoD.TextSettings.HudDigitalSmallFont.Height, + font = CoD.TextSettings.HudDigitalSmallFont.Font, + alignment = LUI.Alignment.Left, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f14_local6:animateToState( "default", 0 ) + f14_local6:registerAnimationState( "white", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f14_local6:registerAnimationState( "red", { + red = Colors.red.r, + green = Colors.red.g, + blue = Colors.red.b, + alpha = 1 + } ) + f14_local6:registerAnimationState( "inactive", { + alpha = 0 + } ) + f14_local6:registerEventHandler( "flash", MBh.AnimateLoop( { + { + "red", + 500 + }, + { + "white", + 0 + } + } ) ) + if not MLG.IsMLGSpectator() then + self:addElement( f14_local3 ) + end + self:addElement( f14_local4 ) + self:addElement( f14_local5 ) + self:addElement( f14_local6 ) + return self +end + +local f0_local12 = { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -200, + left = 250, + height = 128, + width = 256, + alpha = 0 +} +if Engine.UsingSplitscreenUpscaling() then + f0_local12.bottom = -100 + f0_local12.left = 350 +end +local f0_local13 = { + alpha = 1 +} +local f0_local14 = function () + local f15_local0 = RegisterMaterial( "cranked_back_1" ) + local f15_local1 = RegisterMaterial( "cranked_back_2" ) + local self = LUI.UIElement.new() + self.id = "crankedBombTimerHudIdContainerWrapper" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerEventHandler( "cod_caster_view_free", MBh.AnimateToState( "hidden", 250 ) ) + self:registerEventHandler( "cod_caster_view_player", MBh.AnimateToState( "default", 0 ) ) + local f15_local3 = LUI.UIElement.new() + f15_local3.id = "crankedBombTimerHudId" + f15_local3:registerAnimationState( "default", f0_local12 ) + f15_local3:animateToState( "default", 0 ) + f15_local3:registerAnimationState( "active", f0_local13 ) + f15_local3:registerOmnvarHandler( "ui_cranked_bomb_timer_end_milliseconds", f0_local6 ) + f15_local3:registerOmnvarHandler( "ui_cranked_bomb_timer_final_seconds", f0_local8 ) + f15_local3:registerEventHandler( "playerstate_client_changed", f0_local10 ) + local f15_local4 = LUI.UIImage.new() + f15_local4.id = "cranked_bg" + f15_local4:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f15_local0, + alpha = 1 + } ) + f15_local4:animateToState( "default", 0 ) + local f15_local5 = LUI.UIImage.new() + f15_local5.id = "cranked_warning_bg" + f15_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f15_local1, + alpha = 0 + } ) + f15_local5:animateToState( "default", 0 ) + f15_local5:registerAnimationState( "flashing", { + alpha = 1 + } ) + local f15_local6 = LUI.UIText.new() + f15_local6.id = "cranked_text" + f15_local6:setText( Engine.Localize( "@LUA_MENU_CRANKED_CAPS" ) ) + f15_local6:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -35, + right = -38, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + width = 256, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 1 + } ) + f15_local6:animateToState( "default", 0 ) + f15_local6:registerOmnvarHandler( "ui_cranked_bomb_timer_text", f0_local9 ) + local f15_local7 = LUI.UIText.new() + f15_local7.id = "cranked_countdown_bg" + f15_local7:setText( "8:88.8" ) + f15_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 33, + left = 30, + height = CoD.TextSettings.HudDigitalExtraBigFont.Height, + width = 128, + font = CoD.TextSettings.HudDigitalExtraBigFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0.15 + } ) + f15_local7:animateToState( "default", 0 ) + f15_local7:registerAnimationState( "flashing", { + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b + } ) + local f15_local8 = LUI.UICountdown.new( {} ) + f15_local8.id = "cranked_countdown" + f15_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 33, + left = 30, + height = CoD.TextSettings.HudDigitalExtraBigFont.Height, + width = 128, + font = CoD.TextSettings.HudDigitalExtraBigFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f15_local8:animateToState( "default", 0 ) + f15_local8:registerAnimationState( "flashing", { + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b + } ) + self:addElement( f15_local3 ) + f15_local3:addElement( f15_local4 ) + f15_local3:addElement( f15_local5 ) + f15_local3:addElement( f15_local6 ) + f15_local3:addElement( f15_local7 ) + f15_local3:addElement( f15_local8 ) + return self +end + +LUI.MenuBuilder.registerType( "timersHudDef", f0_local11 ) +LUI.MenuBuilder.registerType( "crankedBombTimerHudDef", f0_local14 ) +LockTable( _M ) diff --git a/lui/mp_hud/vanguardoverlayhud.dec.lua b/lui/mp_hud/vanguardoverlayhud.dec.lua new file mode 100644 index 0000000..5924d83 --- /dev/null +++ b/lui/mp_hud/vanguardoverlayhud.dec.lua @@ -0,0 +1,545 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + if f1_arg1.value == 1 then + local f1_local0 = f1_arg0:getChildById( "vanguardWarning" ) + f1_local0:animateToState( "default", 0 ) + f1_local0.isBlinking = nil + f1_arg0:animateToState( "active", 100 ) + local f1_local1 = f1_arg0:getChildById( "vanguardReticleImageId" ) + f1_local1:animateToState( "active", 100 ) + local f1_local2 = f1_arg0:getChildById( "vanguardStaticId" ) + f1_local2:animateToState( "default", 100 ) + local f1_local3 = f1_arg0:getChildById( "bar1" ) + if not f1_local3.spinning then + local f1_local4 = MBh.AnimateLoop( { + { + "blink_on", + 1000 + }, + { + "blink_off", + 500 + }, + { + "blink_off", + 500 + } + } ) + f1_local4( f1_local3 ) + f1_local3.spinning = true + end + elseif f1_arg1.value >= 2 then + local f1_local0 = f1_arg0:getChildById( "vanguardStaticId" ) + local f1_local1 = f1_arg0:getChildById( "vanguardReticleImageId" ) + local f1_local2 = f1_arg0:getChildById( "vanguardWarning" ) + if f1_arg1.value >= 10 then + f1_local0:animateToState( "active10", 200 ) + f1_local1:animateToState( "default", 0 ) + elseif f1_arg1.value >= 9 then + f1_local0:animateToState( "active9", 200 ) + f1_local1:animateToState( "default", 0 ) + elseif f1_arg1.value >= 8 then + f1_local0:animateToState( "active8", 200 ) + f1_local1:animateToState( "default", 0 ) + elseif f1_arg1.value >= 7 then + f1_local0:animateToState( "active7", 200 ) + f1_local1:animateToState( "default", 0 ) + elseif f1_arg1.value >= 6 then + f1_local0:animateToState( "active6", 200 ) + f1_local1:animateToState( "active", 0 ) + elseif f1_arg1.value >= 5 then + f1_local0:animateToState( "active5", 200 ) + f1_local1:animateToState( "active", 0 ) + elseif f1_arg1.value >= 4 then + f1_local0:animateToState( "active4", 200 ) + f1_local1:animateToState( "active", 0 ) + elseif f1_arg1.value >= 3 then + f1_local0:animateToState( "active3", 200 ) + f1_local1:animateToState( "active", 0 ) + else + f1_local0:animateToState( "active2", 200 ) + f1_local1:animateToState( "active", 0 ) + if not f1_local2.isBlinking then + f1_local2.isBlinking = true + local f1_local3 = MBh.AnimateLoop( { + { + "showing", + 500 + }, + { + "blink", + 500 + } + } ) + f1_local3( f1_local2 ) + end + end + else + f1_arg0:animateToState( "default", 0 ) + local f1_local0 = f1_arg0:getChildById( "vanguardStaticId" ) + f1_local0:animateToState( "default", 0 ) + end +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0:getChildById( "vanguardHeadingId" ) + f2_local0:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_HEADING_LABEL", Game.GetOmnvar( "ui_vanguard_heading" ) ) ) + local f2_local1 = f2_arg0:getChildById( "vanguardAltitudeId" ) + f2_local1:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_ALT_LABEL", Game.GetOmnvar( "ui_vanguard_altitude" ) ) ) + local f2_local2 = f2_arg0:getChildById( "vanguardRangeId" ) + f2_local2:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_RANGE", Game.GetOmnvar( "ui_vanguard_range" ) ) ) +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0:getChildById( "vanguardWeaponId" ) + local f3_local1 = "@KILLSTREAKS_VANGUARD_WEAPON_STATUS_READY" + if f3_arg1.value < 0 then + f3_local1 = "@KILLSTREAKS_VANGUARD_WEAPON_STATUS_RELOAD" + local f3_local2 = f3_arg0:getChildById( "vanguardOverlayImageId" ) + local f3_local3 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "active", + 100 + }, + { + "default", + 500 + } + } ) + f3_local3( f3_local2 ) + f3_local0:animateToState( "reload", 0 ) + else + f3_local0:animateToState( "default", 0 ) + end + f3_local0:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_WEAPON_STATUS_LABEL", Engine.Localize( f3_local1 ) ) ) +end + +local f0_local3 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0:getChildById( "vanguardControlsVLId" ) + local f4_local1 = f4_local0:getChildById( "steeringTextId" ) + local f4_local2 = f4_local0:getChildById( "steeringText2Id" ) + local f4_local3 = f4_local0:getChildById( "fireTextId" ) + if CoD.UsingController() then + f4_local1:setText( Engine.Localize( "@KILLSTREAKS_REMOTE_UAV_ASCEND" ) ) + f4_local2:setText( Engine.Localize( "@KILLSTREAKS_REMOTE_UAV_DESCEND" ) ) + else + f4_local1:setText( Engine.Localize( "@PLATFORM_REMOTE_UAV_ASCEND" ) ) + f4_local2:setText( Engine.Localize( "@PLATFORM_REMOTE_UAV_DESCEND" ) ) + end + f4_local3:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_FIRE" ) ) +end + +function vanguardOverlayDef() + local f5_local0 = RegisterMaterial( "ac130_overlay_grain" ) + local f5_local1 = RegisterMaterial( "gryphon_hud_mp" ) + local f5_local2 = RegisterMaterial( "white" ) + local f5_local3, f5_local4 = GameX.GetScreenDims() + local f5_local5, f5_local6 = nil + local self = LUI.UIElement.new() + self.id = "vanguardOverlayContainerId" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerOmnvarHandler( "ui_vanguard", f0_local0 ) + self:registerEventHandler( "init_overlay", f0_local0 ) + self:registerEventHandler( "refresh_controls", f0_local3 ) + self:registerOmnvarHandler( "ui_vanguard_heading", f0_local1 ) + self:registerOmnvarHandler( "ui_vanguard_ammo", f0_local2 ) + local f5_local8 = LUI.UIImage.new() + f5_local8.id = "vanguardOverlayImageId" + f5_local8:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f5_local0, + red = 0.9, + green = 1, + blue = 1, + alpha = 0.45 + } ) + f5_local8:animateToState( "default", 0 ) + f5_local8:registerAnimationState( "active", { + alpha = 1 + } ) + self:addElement( f5_local8 ) + local f5_local9 = LUI.UIImage.new() + f5_local9.id = "vanguardReticleImageId" + f5_local9:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f5_local1, + alpha = 0 + } ) + f5_local9:animateToState( "default", 0 ) + f5_local9:registerAnimationState( "active", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f5_local1, + alpha = 1 + } ) + self:addElement( f5_local9 ) + local f5_local10 = LUI.UIText.new() + f5_local10.id = "vanguardWarning" + f5_local10:setText( Engine.Localize( "@KILLSTREAKS_REMOTE_UAV_OUT_OF_RANGE" ) ) + f5_local10:setTextStyle( CoD.TextStyle.None ) + f5_local10:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 256, + height = CoD.TextSettings.HudEuroBigFont.Height, + font = CoD.TextSettings.HudEuroBigFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.red.r, + green = Colors.red.g, + blue = Colors.red.b, + alpha = 0 + } ) + f5_local10:animateToState( "default", 0 ) + f5_local10:registerAnimationState( "showing", { + red = Colors.red.r, + alpha = 1 + } ) + f5_local10:registerAnimationState( "blink", { + red = 0.5, + alpha = 0.5 + } ) + if not MLG.IsMLGSpectator() then + f5_local6 = LUI.UIHorizontalList.new() + f5_local6.id = "vanguardControlsVLId" + f5_local6:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = -66, + left = -384, + right = 384, + height = 64, + alpha = 1, + spacing = 0 + } ) + f5_local6:animateToState( "default", 0 ) + local f5_local11 = LUI.UIText.new() + f5_local11.id = "steeringTextId" + local f5_local12 = nil + if CoD.UsingController() then + f5_local12 = "@KILLSTREAKS_REMOTE_UAV_ASCEND" + else + f5_local12 = "@PLATFORM_REMOTE_UAV_ASCEND" + end + f5_local11:setText( Engine.Localize( f5_local12 ) ) + f5_local11:setTextStyle( CoD.TextStyle.Shadowed ) + f5_local11:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + width = 256, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center + } ) + f5_local11:animateToState( "default", 0 ) + local f5_local13 = LUI.UIText.new() + f5_local13.id = "steeringText2Id" + if CoD.UsingController() then + f5_local12 = "@KILLSTREAKS_REMOTE_UAV_DESCEND" + else + f5_local12 = "@PLATFORM_REMOTE_UAV_DESCEND" + end + f5_local13:setText( Engine.Localize( f5_local12 ) ) + f5_local13:setTextStyle( CoD.TextStyle.Shadowed ) + f5_local13:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + width = 256, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center + } ) + f5_local13:animateToState( "default", 0 ) + local f5_local14 = LUI.UIText.new() + f5_local14.id = "fireTextId" + f5_local14:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_FIRE" ) ) + f5_local14:setTextStyle( CoD.TextStyle.Shadowed ) + f5_local14:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = false, + bottom = 0, + width = 256, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center + } ) + f5_local14:animateToState( "default", 0 ) + f5_local6:addElement( f5_local13 ) + f5_local6:addElement( f5_local14 ) + f5_local6:addElement( f5_local11 ) + end + if not MLG.IsMLGSpectator() then + f5_local5 = LUI.UIText.new() + f5_local5.id = "vanguardTitleId" + f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_TITLE" ) ) + f5_local5:setTextStyle( CoD.TextStyle.None ) + f5_local5:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 72, + left = 130, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f5_local5:animateToState( "default", 0 ) + self:addElement( f5_local5 ) + end + local f5_local11 = RegisterMaterial( "apache_ammo_mp" ) + local f5_local12 = LUI.UIImage.new() + f5_local12.id = "bar1" + f5_local12:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 72, + right = 128, + height = 16, + width = 16, + material = f5_local11, + alpha = 1, + zRot = 90 + } ) + f5_local12:animateToState( "default", 0 ) + f5_local12:registerAnimationState( "blink_on", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f5_local12:registerAnimationState( "blink_off", { + red = Colors.grey_2.r, + green = Colors.grey_2.g, + blue = Colors.grey_2.b, + alpha = 0.25 + } ) + self:addElement( f5_local12 ) + f5_local5 = LUI.UIText.new() + f5_local5.id = "vanguardFlightModeId" + f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_FLIGHT_MODE" ) ) + f5_local5:setTextStyle( CoD.TextStyle.None ) + f5_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -144, + left = 160, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f5_local5:animateToState( "default", 0 ) + self:addElement( f5_local5 ) + f5_local5 = LUI.UIText.new() + f5_local5.id = "vanguardHeadingId" + f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_HEADING_LABEL" ) ) + f5_local5:setTextStyle( CoD.TextStyle.None ) + f5_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -122, + left = 160, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f5_local5:animateToState( "default", 0 ) + self:addElement( f5_local5 ) + f5_local5 = LUI.UIText.new() + f5_local5.id = "vanguardAltitudeId" + f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_ALT_LABEL" ) ) + f5_local5:setTextStyle( CoD.TextStyle.None ) + f5_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -100, + left = 160, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Left + } ) + f5_local5:animateToState( "default", 0 ) + self:addElement( f5_local5 ) + f5_local5 = LUI.UIText.new() + f5_local5.id = "vanguardWeaponId" + f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_WEAPON_STATUS_LABEL", Engine.Localize( "@KILLSTREAKS_VANGUARD_WEAPON_STATUS_READY" ) ) ) + f5_local5:setTextStyle( CoD.TextStyle.None ) + f5_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -144, + right = -165, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f5_local5:animateToState( "default", 0 ) + f5_local5:registerAnimationState( "reload", { + red = Colors.md_grey.r, + green = Colors.md_grey.g, + blue = Colors.md_grey.b + } ) + self:addElement( f5_local5 ) + f5_local5 = LUI.UIText.new() + f5_local5.id = "vanguardRangeId" + f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_RANGE", 0 ) ) + f5_local5:setTextStyle( CoD.TextStyle.None ) + f5_local5:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -122, + right = -165, + height = CoD.TextSettings.HudEuroConRegSmallFont.Height, + font = CoD.TextSettings.HudEuroConRegSmallFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f5_local5:animateToState( "default", 0 ) + self:addElement( f5_local5 ) + local f5_local13 = LUI.UIElement.new() + f5_local13.id = "vanguardStaticId" + f5_local13:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + } ) + f5_local13:animateToState( "default", 0 ) + f5_local13:registerAnimationState( "active", { + alpha = 0.1 + } ) + f5_local13:registerAnimationState( "active2", { + alpha = 0.2 + } ) + f5_local13:registerAnimationState( "active3", { + alpha = 0.3 + } ) + f5_local13:registerAnimationState( "active4", { + alpha = 0.4 + } ) + f5_local13:registerAnimationState( "active5", { + alpha = 0.5 + } ) + f5_local13:registerAnimationState( "active6", { + alpha = 0.6 + } ) + f5_local13:registerAnimationState( "active7", { + alpha = 0.7 + } ) + f5_local13:registerAnimationState( "active8", { + alpha = 0.8 + } ) + f5_local13:registerAnimationState( "active9", { + alpha = 0.9 + } ) + f5_local13:registerAnimationState( "active10", { + alpha = 1 + } ) + local f5_local14 = LUI.UIImage.new() + f5_local14.id = "vanguardWhiteImageId" + f5_local14:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f5_local2 + } ) + f5_local14:animateToState( "default", 0 ) + local f5_local15 = LUI.UIImage.new() + f5_local15.id = "vanguardStaticImageId" + f5_local15:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f5_local0 + } ) + f5_local15:animateToState( "default", 0 ) + f5_local13:addElement( f5_local14 ) + f5_local13:addElement( f5_local15 ) + if not MLG.IsMLGSpectator() then + self:addElement( f5_local6 ) + end + self:addElement( f5_local13 ) + self:addElement( f5_local10 ) + return self +end + +LUI.MenuBuilder.registerType( "vanguardOverlayDef", vanguardOverlayDef ) +LockTable( _M ) diff --git a/lui/mp_hud/weaponattachment.dec.lua b/lui/mp_hud/weaponattachment.dec.lua new file mode 100644 index 0000000..92bf35e --- /dev/null +++ b/lui/mp_hud/weaponattachment.dec.lua @@ -0,0 +1,242 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function deriveUVType() + local f1_local0 = 0 + local f1_local1 = Game.GetPlayerWeaponName() + if string.find( f1_local1, "eotech" ) ~= nil then + f1_local0 = 1 + elseif string.find( f1_local1, "l115a3scope" ) ~= nil or string.find( f1_local1, "l115a3vzscope" ) ~= nil or string.find( f1_local1, "usrscope" ) ~= nil or string.find( f1_local1, "usrvzscope" ) ~= nil then + f1_local0 = 2 + end + return f1_local0 +end + +function weaponChange_updateWeaponUVType( f2_arg0, f2_arg1 ) + local f2_local0 = deriveUVType() + if f2_local0 ~= f2_arg0.WEAPON_UV_TYPE then + if f2_arg0.WEAPON_UV_TYPE == 0 then + + elseif f2_arg0.WEAPON_UV_TYPE == 1 then + weaponAttachUpdate_eotechReset( f2_arg0 ) + elseif f2_arg0.WEAPON_UV_TYPE == 2 then + + else + + end + if f2_local0 == 0 then + Game.EnableViewModelUVAnimTimeOverride( false ) + else + Game.EnableViewModelUVAnimTimeOverride( true ) + Game.SetViewModelUVAnimTimeOverride( 0 ) + end + f2_arg0.WEAPON_UV_TYPE = f2_local0 + end +end + +function timer_updateWeaponAttachment( f3_arg0, f3_arg1 ) + if f3_arg0.WEAPON_UV_TYPE == -1 then + weaponChange_updateWeaponUVType( f3_arg0, f3_arg1 ) + end + if isEMPed() then + if f3_arg0.WEAPON_UV_TYPE == 1 then + weaponAttachUpdate_eotechEMP() + elseif f3_arg0.WEAPON_UV_TYPE == 2 then + weaponAttachUpdate_scopeKillsEMP() + end + elseif f3_arg0.WEAPON_UV_TYPE == 1 then + weaponAttachUpdate_eotech( f3_arg0, f3_arg1 ) + elseif f3_arg0.WEAPON_UV_TYPE == 2 then + weaponAttachUpdate_scopeKills( f3_arg0, f3_arg1 ) + end +end + +function isEMPed() + return Game.GetOmnvar( "ui_hud_emp_artifact" ) or Game.GetOmnvar( "ui_hud_static" ) > 0 +end + +f0_local0 = 24 +f0_local1 = 31.25 +function weaponAttachUpdate_eotech( f5_arg0, f5_arg1 ) + local f5_local0 = Game.GetWeaponDamageStats() + local f5_local1 = Game.GetCrosshairTraceDistance() + if f5_local1 == 0 then + f5_local1 = f5_local0.minDamageRange + end + local f5_local2 = 0 + local f5_local3 = f5_local0.minDamageRange - f5_local0.maxDamageRange + if f5_local3 ~= 0 then + f5_local2 = 1 - LUI.clamp( (f5_local1 - f5_local0.maxDamageRange) / f5_local3, 0, 1 ) + end + if f5_arg0.EOTECH_BAR_DISPLAY_PREV == nil then + f5_arg0.EOTECH_BAR_DISPLAY_PREV = 0 + end + local f5_local4 = (f5_local2 - f5_arg0.EOTECH_BAR_DISPLAY_PREV) * 0.25 + f5_arg0.EOTECH_BAR_DISPLAY_PREV + Game.SetViewModelUVAnimTimeOverride( LUI.clamp( math.floor( f5_local4 * f0_local0 ) * f0_local1, f0_local1, f0_local1 * (f0_local0 - 1) ) ) + f5_arg0.EOTECH_BAR_DISPLAY_PREV = f5_local4 +end + +function weaponAttachUpdate_eotechReset( f6_arg0 ) + f6_arg0.EOTECH_BAR_DISPLAY_PREV = 0 +end + +function weaponAttachUpdate_eotechNewClient( f7_arg0 ) + weaponAttachUpdate_eotechReset( f7_arg0, event ) +end + +function weaponAttachUpdate_eotechEMP() + Game.SetViewModelUVAnimTimeOverride( (f0_local0 + 1) * f0_local1 ) +end + +f0_local2 = 0 +local f0_local3 = 1 +local f0_local4 = 2 +local f0_local5 = 3 +local f0_local6 = 4 +local f0_local7 = 5 +local f0_local8 = 6 +local f0_local9 = 7 +local f0_local10 = 125 +function omnvarScope_updateSniperScopeState( f9_arg0, f9_arg1 ) + f9_arg0.SCOPE_DISPLAY_STATE_NEW = f9_arg1.value +end + +function weaponAttachUpdate_scopeKills( f10_arg0, f10_arg1 ) + if f10_arg0.SCOPE_DISPLAY_STATE == -1 then + initScopeDisplayState( f10_arg0, 0, f0_local2, f0_local3, -1, 10 ) + end + if f10_arg0.SCOPE_DISPLAY_STATE_NEW ~= -1 then + initScopeDisplayStateByNum( f10_arg0, f10_arg0.SCOPE_DISPLAY_STATE_NEW ) + f10_arg0.SCOPE_DISPLAY_STATE_NEW = -1 + end + if f10_arg0.SCOPE_STATE_FLASH_COUNT == -1 or f10_arg0.SCOPE_STATE_FLASH_COUNT > 0 then + f10_arg0.SCOPE_STATE_UPDATES = f10_arg0.SCOPE_STATE_UPDATES + 1 + if f10_arg0.SCOPE_STATE_FLASH_PER <= f10_arg0.SCOPE_STATE_UPDATES then + local f10_local0 = f10_arg0.SCOPE_STATE_FRAME_CURRENT + local f10_local1 = f10_arg0.SCOPE_STATE_FRAME_A + f10_arg0.SCOPE_STATE_FRAME_CURRENT = REG9 and f10_arg0.SCOPE_STATE_FRAME_B or f10_arg0.SCOPE_STATE_FRAME_A + if f10_arg0.SCOPE_STATE_FLASH_COUNT ~= -1 then + f10_arg0.SCOPE_STATE_FLASH_COUNT = f10_arg0.SCOPE_STATE_FLASH_COUNT - 1 + end + f10_arg0.SCOPE_STATE_UPDATES = 0 + end + elseif f10_arg0.SCOPE_STATE_FRAME_CURRENT ~= f10_arg0.SCOPE_STATE_FRAME_A then + f10_arg0.SCOPE_STATE_FRAME_CURRENT = f10_arg0.SCOPE_STATE_FRAME_A + end + Game.SetViewModelUVAnimTimeOverride( f0_local10 * f10_arg0.SCOPE_STATE_FRAME_CURRENT ) +end + +function weaponAttachUpdate_scopeNewClient( f11_arg0 ) + forceScopeDisplayStateByNum( f11_arg0, Game.GetOmnvar( "weap_sniper_display_state" ) ) +end + +function forceScopeDisplayStateByNum( f12_arg0, f12_arg1 ) + initScopeDisplayStateByNum( f12_arg0, f12_arg1 ) + if f12_arg0.SCOPE_STATE_FLASH_COUNT ~= -1 then + f12_arg0.SCOPE_STATE_FLASH_COUNT = 0 + end +end + +function initScopeDisplayStateByNum( f13_arg0, f13_arg1 ) + if f13_arg1 == 0 then + initScopeDisplayState( f13_arg0, f13_arg1, f0_local2, f0_local3, -1, 10 ) + elseif f13_arg1 == 1 then + initScopeDisplayState( f13_arg0, f13_arg1, f0_local4, f0_local3, 10, 5 ) + elseif f13_arg1 == 2 then + initScopeDisplayState( f13_arg0, f13_arg1, f0_local5, f0_local3, 10, 5 ) + elseif f13_arg1 == 3 then + initScopeDisplayState( f13_arg0, f13_arg1, f0_local6, f0_local3, 10, 5 ) + elseif f13_arg1 == 4 then + initScopeDisplayState( f13_arg0, f13_arg1, f0_local8, f0_local3, 10, 5 ) + end +end + +function initScopeDisplayState( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5 ) + f14_arg0.SCOPE_DISPLAY_STATE = f14_arg1 + f14_arg0.SCOPE_STATE_FRAME_A = f14_arg2 + f14_arg0.SCOPE_STATE_FRAME_B = f14_arg3 + f14_arg0.SCOPE_STATE_FLASH_COUNT = f14_arg4 + f14_arg0.SCOPE_STATE_FLASH_PER = f14_arg5 + f14_arg0.SCOPE_STATE_FRAME_CURRENT = f14_arg2 + f14_arg0.SCOPE_STATE_UPDATES = 0 + Game.SetViewModelUVAnimTimeOverride( f0_local10 * f14_arg0.SCOPE_STATE_FRAME_CURRENT ) +end + +function weaponAttachUpdate_scopeKillsEMP() + Game.SetViewModelUVAnimTimeOverride( f0_local9 * f0_local10 ) +end + +function weaponAttachmentProcessing_init( f16_arg0 ) + f16_arg0.WEAPON_UV_TYPE = -1 + f16_arg0.EOTECH_BAR_DISPLAY_PREV = nil + f16_arg0.SCOPE_DISPLAY_STATE = -1 + f16_arg0.SCOPE_STATE_FRAME_A = f0_local2 + f16_arg0.SCOPE_STATE_FRAME_B = f0_local3 + f16_arg0.SCOPE_STATE_FRAME_CURRENT = f16_arg0.SCOPE_STATE_FRAME_A + f16_arg0.SCOPE_STATE_FLASH_COUNT = -1 + f16_arg0.SCOPE_STATE_FLASH_PER = 10 + f16_arg0.SCOPE_STATE_UPDATES = 0 + f16_arg0.SCOPE_DISPLAY_STATE_NEW = -1 +end + +function clientChanged_updateAttachmentState( f17_arg0, f17_arg1 ) + weaponAttachmentProcessing_init( f17_arg0 ) + weaponAttachUpdate_eotechNewClient( f17_arg0 ) + weaponAttachUpdate_scopeNewClient( f17_arg0 ) + weaponChange_updateWeaponUVType( f17_arg0, f17_arg1 ) +end + +function weaponAttachmentProcessing() + local self = LUI.UIElement.new() + self.id = "weapAttachment" + self:registerEventHandler( "update_weapon_attachment", timer_updateWeaponAttachment ) + self:addElement( LUI.UITimer.new( 50, "update_weapon_attachment" ) ) + self:registerEventHandler( "weapon_change", weaponChange_updateWeaponUVType ) + self:registerOmnvarHandler( "weap_sniper_display_state", omnvarScope_updateSniperScopeState ) + self:registerEventHandler( "playerstate_client_changed", clientChanged_updateAttachmentState ) + weaponAttachmentProcessing_init( self ) + return self +end + +local f0_local11 = function () + if Game.InKillCam() then + if Game.IsCinematicCameraActive() then + return false + elseif Game.IsKillCamEntityActive() then + return false + end + elseif Game.IsSpectatorCameraActive() then + return false + end + return true +end + +function blurTargetChanged( f20_arg0, f20_arg1 ) + if f0_local11() then + Game.StartBlur( Game.GetOmnvar( "blur_target" ), Game.GetOmnvar( "blur_duration_ms" ) ) + else + Game.StartBlur( 0, 0 ) + end +end + +function blurClientChanged( f21_arg0, f21_arg1 ) + if f0_local11() then + Game.StartBlur( Game.GetOmnvar( "blur_target" ), 0 ) + else + Game.StartBlur( 0, 0 ) + end +end + +function blurProcessing() + local self = LUI.UIElement.new() + self.id = "blurUpdater" + self:registerOmnvarHandler( "blur_target", blurTargetChanged ) + self:registerEventHandler( "playerstate_client_changed", blurClientChanged ) + self:registerEventHandler( "camera_client_changed", blurClientChanged ) + return self +end + +LUI.MenuBuilder.registerType( "weaponAttachmentProcessing", weaponAttachmentProcessing ) +LUI.MenuBuilder.registerType( "blurProcessing", blurProcessing ) +LockTable( _M ) diff --git a/lui/mp_hud/weaponinfohud.dec.lua b/lui/mp_hud/weaponinfohud.dec.lua new file mode 100644 index 0000000..edbd920 --- /dev/null +++ b/lui/mp_hud/weaponinfohud.dec.lua @@ -0,0 +1,906 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + if not f1_arg1 then + f1_arg1 = Game.GetPlayerWeaponName() + end + if f1_arg0.current_weaponName ~= f1_arg1 then + f1_arg0.current_weaponName = f1_arg1 + f1_arg0.current_showAmmo = false + if f1_arg1 == "none" then + f1_arg0.current_showAmmo = false + return false + end + local f1_local0 = string.find( f1_arg1, "_" ) + local f1_local1 = string.sub( f1_arg1, 1, f1_local0 - 1 ) + if f1_local1 == "iw5" or f1_local1 == "iw6" then + f1_local1 = string.sub( f1_arg1, 1, string.find( f1_arg1, "_", f1_local0 + 1 ) - 1 ) + end + if CoD.WeaponListPrimary[f1_local1] ~= nil or CoD.WeaponListSecondary[f1_local1] ~= nil then + f1_arg0.current_showAmmo = true + return true + else + f1_arg0.current_showAmmo = false + return false + end + else + return f1_arg0.current_showAmmo + end +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + if f2_arg1.weapon_name ~= nil and f2_arg1.weapon_name ~= f2_arg0.previous_weapon_name then + if f2_arg1.display_name then + f2_arg0:setText( f2_arg1.display_name ) + end + local f2_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "slide_in", + 250 + }, + { + "slide_in", + 1200 + }, + { + "blink_off", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_on", + 0 + }, + { + "blink_on", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_off", + 50 + }, + { + "blink_on", + 0 + }, + { + "blink_on", + 50 + }, + { + "blink_off", + 150 + } + } ) + f2_local0( f2_arg0 ) + f2_arg0.previous_weapon_name = f2_arg1.weapon_name + end +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg1.weapon_name + if not f3_local0 then + f3_local0 = Game.GetPlayerWeaponName() + end + if f3_arg0.weaponNameRight ~= f3_local0 then + f3_arg0.weaponNameRight = f3_local0 + if f0_local0( f3_arg0, f3_local0 ) then + if f3_arg0.current_state ~= "active" then + f3_arg0:animateToState( "active", 0 ) + f3_arg0.current_state = "active" + end + elseif f3_arg0.current_state ~= "default" then + f3_arg0:animateToState( "default", 0 ) + f3_arg0.current_state = "default" + end + end +end + +local f0_local3 = function ( f4_arg0, f4_arg1 ) + if GameX.GetGameMode() == "horde" then + f0_local2( f4_arg0, f4_arg1 ) + end +end + +local f0_local4 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg1.weapon_name + if not f5_local0 then + f5_local0 = Game.GetPlayerWeaponName() + if not string.find( f5_local0, "akimbo" ) then + return + end + end + if f5_arg0.weaponNameLeft ~= f5_local0 then + f5_arg0.weaponNameLeft = f5_local0 + if string.find( f5_local0, "akimbo" ) ~= nil then + if f5_arg0.current_state ~= "active" then + f5_arg0:animateToState( "active", 0 ) + f5_arg0.current_state = "active" + end + elseif f5_arg0.current_state ~= "default" then + f5_arg0:animateToState( "default", 0 ) + f5_arg0.current_state = "default" + end + end +end + +local f0_local5 = function ( f6_arg0, f6_arg1 ) + local f6_local0 + if Game.IsWeaponAltModeUsable() == 0 or f6_arg1.weapon_name == "none" then + f6_local0 = false + else + f6_local0 = true + end + if f6_local0 then + local f6_local1 = Game.GetWeaponAltModeMaterial() + if not f6_local1 then + return + end + f6_arg0:registerAnimationState( "alt_mode_on", { + topAnchor = f6_arg0.properties.tAnchor, + leftAnchor = f6_arg0.properties.lAnchor, + bottomAnchor = f6_arg0.properties.bAnchor, + rightAnchor = f6_arg0.properties.rAnchor, + bottom = f6_arg0.properties.b or 0, + height = f6_arg0.properties.h or 0, + right = f6_arg0.properties.r or 0, + width = f6_arg0.properties.w or 0, + red = f6_arg0.properties.color and f6_arg0.properties.color[1] or 1, + green = f6_arg0.properties.color and f6_arg0.properties.color[2] or 1, + blue = f6_arg0.properties.color and f6_arg0.properties.color[3] or 1, + alpha = 1, + material = RegisterMaterial( f6_local1 ) + } ) + f6_arg0:animateToState( "alt_mode_on", 100 ) + else + f6_arg0:animateToState( "default", 0 ) + end +end + +local f0_local6 = function ( f7_arg0, f7_arg1 ) + local f7_local0 = Game.GetPlayerWeaponName() + if f0_local0( f7_arg0, f7_local0 ) then + local f7_local1 = Game.GetPlayerStockAmmo() + local f7_local2 = Game.GetPlayerMaxClipAmmo() + local f7_local3 = Game.GetPlayerClipAmmo( 1 ) + local f7_local4 = Game.GetPlayerClipAmmo( 2 ) + local f7_local5 = 0.33 + local f7_local6 = "" + local f7_local7 = "default" + local f7_local8 = string.find( f7_local0, "akimbo" ) ~= nil + if not (f7_local8 ~= false or f7_local3 ~= 0 or f7_local1 ~= 0) or f7_local8 == true and f7_local3 == 0 and f7_local4 == 0 and f7_local1 == 0 then + f7_local6 = Engine.Localize( "@WEAPON_NO_AMMO" ) + f7_local7 = "no_ammo" + elseif f7_local3 <= f7_local2 * f7_local5 or f7_local8 and f7_local4 <= f7_local2 * f7_local5 then + if f7_local1 == 0 then + f7_local6 = Engine.Localize( "@PLATFORM_LOW_AMMO_NO_RELOAD" ) + f7_local7 = "low_ammo" + elseif f7_local3 ~= 0 or f7_local8 and f7_local4 ~= 0 then + if false == Engine.IsConsoleGame() and 1 == Engine.IsGamepadEnabled() then + f7_local6 = Engine.Localize( "@PLATFORM_RELOAD_GAMEPAD" ) + else + f7_local6 = Engine.Localize( "@PLATFORM_RELOAD" ) + end + f7_local7 = "reload" + end + end + if f7_local7 == "default" and f7_arg0.current_state ~= f7_local7 then + f7_arg0:animateToState( f7_local7, 0 ) + f7_arg0:setText( f7_local6 ) + elseif f7_local7 == "reload" and f7_arg0.current_state ~= f7_local7 then + f7_arg0:animateToState( f7_local7, 250 ) + f7_arg0:setText( f7_local6 ) + elseif f7_local7 == "low_ammo" and f7_arg0.current_state ~= f7_local7 then + f7_arg0:processEvent( { + name = "low_ammo_flashing_red" + } ) + f7_arg0:setText( f7_local6 ) + elseif f7_local7 == "no_ammo" and f7_arg0.current_state ~= f7_local7 then + f7_arg0:animateToState( f7_local7, 250 ) + f7_arg0:setText( f7_local6 ) + end + f7_arg0.current_state = f7_local7 + elseif f7_arg0.current_state ~= "default" then + f7_arg0:animateToState( "default", 0 ) + f7_arg0:setText( "" ) + f7_arg0.current_state = "default" + end +end + +local f0_local7 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = f8_arg0:getChildById( "weapon_info_grind_text" ) + f8_local0:setText( f8_arg1.value ) +end + +local f0_local8 = function ( f9_arg0, f9_arg1 ) + f0_local7( f9_arg0, { + value = Game.GetOmnvar( "ui_grind_tags" ) + } ) +end + +local f0_local9 = function ( f10_arg0 ) + local self = LUI.UIElement.new() + self.id = f10_arg0.id + self:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = f10_arg0.bottom, + right = f10_arg0.right, + height = f10_arg0.height, + width = f10_arg0.width, + alpha = 0 + } ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "active", { + alpha = 1 + } ) + self:registerEventHandler( "weapon_change", f10_arg0.eventFunc ) + self:registerEventHandler( "playerstate_client_changed", f10_arg0.eventFunc ) + local f10_local1 = LUI.UIImage.new() + f10_local1.id = f10_arg0.bg.id + f10_local1:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = f10_arg0.bg.bottom or 0, + right = f10_arg0.bg.right or 0, + height = f10_arg0.bg.height or 0, + width = f10_arg0.bg.width or 0, + material = f10_arg0.bg.material + } ) + f10_local1:animateToState( "default", 0 ) + local f10_local2 = LUI.UIHorizontalList.new() + f10_local2.id = f10_arg0.hl.id or nil + f10_local2:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = f10_arg0.hl.bottom or 0, + right = f10_arg0.hl.right or 0, + height = f10_arg0.hl.height or 0, + alignment = LUI.Alignment.Right + } ) + f10_local2:animateToState( "default", 0 ) + if f10_arg0.startcap ~= nil then + local f10_local3 = LUI.UIImage.new() + f10_local3.id = "start_cap" + f10_local3:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = f10_arg0.imageHeight, + width = f10_arg0.startcap.width, + material = RegisterMaterial( f10_arg0.startcap.material ) + } ) + f10_local3:animateToState( "default", 0 ) + f10_local2:addElement( f10_local3 ) + end + local f10_local3 = LUI.UIImage.new() + f10_local3.id = "middle" + f10_local3:setupUIScorebar( f10_arg0.dataSource ) + f10_local3.m_maxWidth = f10_arg0.maxWidth - (f10_arg0.startcap and f10_arg0.startcap.width or 0) - (f10_arg0.endcap and f10_arg0.endcap.width or 0) + f10_local3:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = f10_arg0.imageHeight, + material = RegisterMaterial( f10_arg0.material ) + } ) + f10_local3:animateToState( "default", 0 ) + f10_local2:addElement( f10_local3 ) + if f10_arg0.endcap ~= nil then + local f10_local4 = LUI.UIImage.new() + f10_local4.id = "end_cap" + f10_local4:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = f10_arg0.imageHeight, + width = f10_arg0.endcap.width, + material = RegisterMaterial( f10_arg0.endcap.material ) + } ) + f10_local4:animateToState( "default", 0 ) + f10_local2:addElement( f10_local4 ) + end + local f10_local4 = LUI.UIText.new() + f10_local4.id = f10_arg0.text.id + f10_local4:setupUIBindText( f10_arg0.dataSource ) + f10_local4:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = f10_arg0.text.bottom or 0, + right = f10_arg0.text.right or 0, + height = CoD.TextSettings.HudDigitalSmallFont.Height, + font = CoD.TextSettings.HudDigitalSmallFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0, + alpha = 1 + } ) + f10_local4:animateToState( "default", 0 ) + self:addElement( f10_local1 ) + self:addElement( f10_local2 ) + self:addElement( f10_local4 ) + return self +end + +local f0_local10 = function () + local f11_local0 = RegisterMaterial( "hud_ammo_line" ) + local f11_local1 = RegisterMaterial( "hud_ammobar_back" ) + local f11_local2 = 128 + local f11_local3 = 24 + local f11_local4 = 24 + local self = LUI.UIElement.new() + self.id = "weaaponHudId" + self:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = -31, + right = -20, + height = 100, + width = 400 + } ) + self:animateToState( "default", 0 ) + local f11_local6 = LUI.UIText.new() + f11_local6.id = "weaponInfoWeaponName" + f11_local6:setText( "" ) + f11_local6:setTextStyle( CoD.TextStyle.Shadowed ) + f11_local6:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = -500, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 400, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0 + } ) + f11_local6:animateToState( "default", 0 ) + f11_local6:registerAnimationState( "slide_in", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = -240, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 400, + alpha = 1 + } ) + f11_local6:registerAnimationState( "blink_off", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = -240, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 400, + alpha = 0 + } ) + f11_local6:registerAnimationState( "blink_on", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = -240, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + width = 400, + alpha = 1 + } ) + f11_local6:registerEventHandler( "weapon_change", f0_local1 ) + f11_local6:registerEventHandler( "playerstate_client_changed", f0_local1 ) + local f11_local7 = LUI.UIElement.new() + f11_local7.id = "weaponInfoClipAmmo" + f11_local7:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = CoD.TextSettings.HudDigitalSmallFont.Height, + width = 256 + } ) + f11_local7:animateToState( "default", 0 ) + local f11_local8 = LUI.UIImage.new() + f11_local8.id = "clip_ammo_line" + f11_local8:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = 32, + width = 256, + material = f11_local0 + } ) + f11_local8:animateToState( "default", 0 ) + local f11_local9 = LUI.UIVerticalList.new() + f11_local9.id = "weaponInfoClipAmmoList" + f11_local9:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = -1, + right = 0, + height = 32, + width = 256, + spacing = 0, + alignment = LUI.Alignment.Bottom + } ) + f11_local9:animateToState( "default", 0 ) + local f11_local10 = f0_local9( { + id = "clipAmmoRightContainer", + dataSource = "ClipAmmoRight", + material = "hud_clip_bar", + maxWidth = f11_local2, + bottom = 0, + right = 0, + height = f11_local4, + width = f11_local2, + imageHeight = f11_local4, + eventFunc = f0_local2, + bg = { + id = "clipAmmoBgRight", + bottom = 1, + right = 0, + height = 32, + width = 256, + material = f11_local1 + }, + hl = { + id = "clipAmmoBarRight", + bottom = 0, + right = -90, + height = f11_local4, + width = f11_local2 + }, + endcap = { + material = "hud_clip_bar_cap", + width = f11_local3 + }, + text = { + id = "clipAmmoTextRight", + bottom = -5, + right = -90 + } + } ) + local f11_local11 = 20 + local f11_local12 = f0_local9( { + id = "clipAmmoLeftContainer", + dataSource = "ClipAmmoLeft", + material = "hud_clip_bar", + maxWidth = f11_local2 - f11_local11, + bottom = 0, + right = f11_local11, + height = f11_local4, + width = f11_local2 - f11_local11, + imageHeight = f11_local4, + eventFunc = f0_local4, + bg = { + id = "clipAmmoBgLeft", + bottom = 1, + right = 0, + height = 32, + width = 256, + material = f11_local1 + }, + hl = { + id = "clipAmmoBarLeft", + bottom = 0, + right = -90 - f11_local11, + height = f11_local4, + width = f11_local2 - f11_local11 + }, + endcap = { + material = "hud_clip_bar_cap", + width = f11_local3 + }, + text = { + id = "clipAmmoTextLeft", + bottom = -5, + right = -90 - f11_local11 + } + } ) + f11_local10:registerEventHandler( "menu_create", f0_local3 ) + f11_local9:addElement( f11_local10 ) + f11_local9:addElement( f11_local12 ) + f11_local7:addElement( f11_local8 ) + f11_local7:addElement( f11_local9 ) + local f11_local13 = LUI.UIElement.new() + f11_local13.id = "weaponInfoStockAmmo" + f11_local13:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = -2, + right = -35, + height = CoD.TextSettings.HudDigitalBigFont.Height, + width = 50, + alpha = 0 + } ) + f11_local13:animateToState( "default", 0 ) + f11_local13:registerAnimationState( "active", { + alpha = 1 + } ) + f11_local13:registerEventHandler( "weapon_change", f0_local2 ) + f11_local13:registerEventHandler( "playerstate_client_changed", f0_local2 ) + f11_local13:registerEventHandler( "menu_create", f0_local3 ) + local f11_local14 = LUI.UIText.new() + f11_local14.id = "weaponInfoStockAmmoBg" + f11_local14:setText( "888" ) + f11_local14:registerAnimationState( "default", { + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + height = CoD.TextSettings.HudDigitalBigFont.Height, + font = CoD.TextSettings.HudDigitalBigFont.Font, + alignment = LUI.Alignment.Right, + red = 0, + green = 0, + blue = 0, + alpha = 0.25 + } ) + f11_local14:animateToState( "default", 0 ) + local f11_local15 = LUI.UIText.new() + f11_local15.id = "weaponInfoStockAmmoText" + f11_local15:setupUIBindText( "StockAmmo" ) + f11_local15:registerAnimationState( "default", { + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + height = CoD.TextSettings.HudDigitalBigFont.Height, + font = CoD.TextSettings.HudDigitalBigFont.Font, + alignment = LUI.Alignment.Right, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f11_local15:animateToState( "default", 0 ) + f11_local13:addElement( f11_local14 ) + f11_local13:addElement( f11_local15 ) + self:addElement( f11_local6 ) + self:addElement( f11_local7 ) + self:addElement( f11_local13 ) + return self +end + +local f0_local11 = function () + local f12_local0 = RegisterMaterial( "white" ) + local self = LUI.UIHorizontalList.new() + self.id = "primaryGrenadeHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -10, + right = -60, + height = 20, + width = 20, + spacing = -10, + alignment = LUI.Alignment.Right + } ) + self:animateToState( "default", 0 ) + local f12_local2 = LUI.UIElement.new() + f12_local2:setupUIIntWatch( "FragAmmo" ) + f12_local2.id = "grenade_ammo_watch" + f12_local2:registerEventHandler( "int_watch_alert", function ( element, event ) + event.name = "grenade_count_update" + self:processEvent( event ) + end ) + for f12_local3 = 1, 5, 1 do + local f12_local6 = f12_local3 + local f12_local7 = LUI.UIImage.new() + f12_local7:setupUIBindImage( "FragMaterial" ) + f12_local7.id = "grenade_" .. f12_local6 + f12_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottomAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f12_local0, + alpha = 0 + } ) + f12_local7:animateToState( "default", 0 ) + f12_local7:registerAnimationState( "active", { + alpha = 1 + } ) + f12_local7:registerEventHandler( "grenade_count_update", function ( element, event ) + if event.oldValue < f12_local6 and f12_local6 <= event.newValue then + f12_local7:animateToState( "active", 250 ) + elseif f12_local6 <= event.oldValue and event.newValue < f12_local6 then + f12_local7:animateToState( "default", 0 ) + end + end ) + self:addElement( f12_local7 ) + end + self:addElement( f12_local2 ) + return self +end + +local f0_local12 = function () + local f15_local0 = RegisterMaterial( "white" ) + local self = LUI.UIHorizontalList.new() + self.id = "secondaryGrenadeHud" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -10, + right = -120, + height = 20, + width = 20, + spacing = -12, + alignment = LUI.Alignment.Right + } ) + self:animateToState( "default", 0 ) + local f15_local2 = LUI.UIElement.new() + f15_local2:setupUIIntWatch( "FlashAmmo" ) + f15_local2.id = "tactical_ammo_watch" + f15_local2:registerEventHandler( "int_watch_alert", function ( element, event ) + event.name = "tactical_count_update" + self:processEvent( event ) + end ) + for f15_local3 = 1, 5, 1 do + local f15_local6 = f15_local3 + local f15_local7 = LUI.UIImage.new() + f15_local7:setupUIBindImage( "FlashMaterial" ) + f15_local7.id = "tactical_" .. f15_local6 + f15_local7:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottomAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = f15_local0, + alpha = 0 + } ) + f15_local7:animateToState( "default", 0 ) + f15_local7:registerAnimationState( "active", { + alpha = 1 + } ) + f15_local7:registerEventHandler( "tactical_count_update", function ( element, event ) + if event.oldValue < f15_local6 and f15_local6 <= event.newValue then + f15_local7:animateToState( "active", 250 ) + elseif f15_local6 <= event.oldValue and event.newValue < f15_local6 then + f15_local7:animateToState( "default", 0 ) + end + end ) + self:addElement( f15_local7 ) + end + self:addElement( f15_local2 ) + return self +end + +local f0_local13 = function () + local f18_local0 = RegisterMaterial( "white" ) + local f18_local1 = RegisterMaterial( "hud_dpad_arrow_left" ) + local self = LUI.UIHorizontalList.new() + self.id = "weaponInfoAltMode" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -10, + right = -150, + height = 25, + width = 100, + spacing = 0, + alignment = LUI.Alignment.Left + } ) + self:animateToState( "default", 0 ) + local f18_local3 = LUI.UIImage.new() + f18_local3.id = "weaponInfoAltModeIcon" + f18_local3.properties = { + tAnchor = false, + lAnchor = false, + bAnchor = true, + rAnchor = true, + b = 0, + h = 25, + r = 0, + w = 25 + } + f18_local3:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + height = 25, + right = 0, + width = 25, + alpha = 0, + material = f18_local0 + } ) + f18_local3:animateToState( "default", 0 ) + f18_local3:registerEventHandler( "weapon_change", f0_local5 ) + f18_local3:registerEventHandler( "playerstate_client_changed", f0_local5 ) + local f18_local4 = LUI.UIText.new() + f18_local4.id = "weaponInfoAltModeNum" + f18_local4:setupUIBindText( "AltModeAmmo" ) + f18_local4:setTextStyle( CoD.TextStyle.Shadowed ) + f18_local4:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + height = CoD.TextSettings.HudDigitalSmallFont.Height, + right = 0, + width = 15, + font = CoD.TextSettings.HudDigitalSmallFont.Font, + alpha = 1 + } ) + f18_local4:animateToState( "default", 0 ) + self:addElement( f18_local3 ) + self:addElement( f18_local4 ) + return self +end + +local f0_local14 = function () + local self = LUI.UIText.new() + self.id = "lowAmmoWarningHud" + self:setText( "" ) + self:setTextStyle( CoD.TextStyle.Shadowed ) + local f19_local1 = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + bottom = 140, + left = -200, + height = CoD.TextSettings.HudEuroNormalFont.Height, + width = 400, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } + if Engine.UsingSplitscreenUpscaling() then + f19_local1.bottom = 90 + end + self:registerAnimationState( "default", f19_local1 ) + self:animateToState( "default", 0 ) + self:registerAnimationState( "reload", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + self:registerAnimationState( "low_ammo_on", { + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 1 + } ) + self:registerAnimationState( "low_ammo_off", { + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 1 + } ) + self:registerAnimationState( "no_ammo", { + red = Colors.red.r, + green = Colors.red.g, + blue = Colors.red.b, + alpha = 1 + } ) + self:registerEventHandler( "hud_refresh", f0_local6 ) + self:registerEventHandler( "low_ammo_flashing_red", MBh.AnimateLoop( { + { + "low_ammo_on", + 500 + }, + { + "low_ammo_off", + 0 + } + } ) ) + return self +end + +local f0_local15 = function () + local f20_local0 = RegisterMaterial( "tags_hud_icon_1" ) + local self = LUI.UIElement.new() + self.id = "weapon_info_grind_element" + self:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + bottom = -90, + right = -100, + height = 64, + width = 64 + } ) + self:animateToState( "default", 0 ) + self:registerOmnvarHandler( "ui_grind_tags", f0_local7 ) + self:registerEventHandler( "playerstate_client_changed", f0_local8 ) + local f20_local2 = LUI.UIImage.new() + f20_local2.id = "weapon_info_grind_icon" + f20_local2:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + material = f20_local0 + } ) + f20_local2:animateToState( "default", 0 ) + local f20_local3 = LUI.UIText.new() + f20_local3.id = "weapon_info_grind_text" + f20_local3:setText( "999" ) + f20_local3:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 20, + height = CoD.TextSettings.HudDigitalNormalFont.Height, + font = CoD.TextSettings.HudDigitalNormalFont.Font, + red = 0, + green = 0, + blue = 0 + } ) + f20_local3:animateToState( "default", 0 ) + self:addElement( f20_local2 ) + self:addElement( f20_local3 ) + return self +end + +LUI.MenuBuilder.registerType( "weaponInfoHudDef", function () + local self = LUI.UIElement.new() + self.id = "weaponInfoHud" + self:registerAnimationState( "default", { + bottomAnchor = true, + rightAnchor = true, + bottom = 0, + right = 0, + height = 300, + width = 600 + } ) + self:animateToState( "default", 0 ) + if not GameX.IsHardcoreMode() then + self:addElement( f0_local10() ) + self:addElement( f0_local11() ) + self:addElement( f0_local12() ) + self:addElement( f0_local13() ) + self:addElement( LUI.MenuBuilder.buildItems( { + type = "killstreakInfoHudDef" + }, self.properties, self ) ) + if GameX.GetGameMode() == "grind" then + self:addElement( f0_local15() ) + end + else + self:addElement( LUI.MenuBuilder.buildItems( { + type = "killstreakInfoHudDef" + }, self.properties, self ) ) + end + return self +end ) +LUI.MenuBuilder.registerType( "lowAmmoWarningHudDef", f0_local14 ) +LockTable( _M ) diff --git a/lui/mp_menus/aarcommon.dec.lua b/lui/mp_menus/aarcommon.dec.lua new file mode 100644 index 0000000..27cef26 --- /dev/null +++ b/lui/mp_menus/aarcommon.dec.lua @@ -0,0 +1,449 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function aar_title_bar() + return { + type = "UIElement", + id = "aar_title_bar_id", + properties = { + title_text = Engine.Localize( "@LUA_MENU_GAME_SUMMARY_CAPS" ), + subtitle_text = "GAMETYPE - Map Name", + subtitle_banner_width = AAR.Layout.SubTitleBannerWidth, + fill_alpha = 1, + border_alpha = Swatches.GenericMenu.BorderAlpha + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIVerticalList", + id = "title_vert_list", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "generic_menu_titlebar", + id = "top_title_bar_id", + properties = { + title_bar_text = MBh.Property( "title_text" ), + fill_alpha = MBh.Property( "fill_alpha" ), + border_alpha = MBh.Property( "border_alpha" ) + } + }, + { + type = "aar_subtitle_bar", + id = "bottom_title_bar_id", + properties = { + subtitle_text = MBh.Property( "subtitle_text" ), + banner_width = MBh.Property( "subtitle_banner_width" ) + } + } + } + } + } + } +end + +function aar_title_bar_top() + return { + type = "UIElement", + properties = { + title_text = "TITLE TEXT" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = AAR.Layout.TitleBarHeight, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "bar_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 33, + right = -5, + material = RegisterMaterial( "box_popup_titlebar_mid" ) + } + } + }, + { + type = "UIImage", + id = "bar_corner_left", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 33, + material = RegisterMaterial( "box_popup_titlebar_lt" ) + } + } + }, + { + type = "UIImage", + id = "bar_corner_right", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -5, + right = 0, + material = RegisterMaterial( "box_popup_titlebar_rt" ) + } + } + }, + { + type = "UIText", + id = "bar_title", + properties = { + text = MBh.Property( "title_text" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 2, + bottom = 2 + CoD.TextSettings.ExtraBigFont.Height, + left = 0, + right = 0, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + }, + handlers = { + aar_set_title_text = function ( f3_arg0, f3_arg1 ) + assert( f3_arg1.new_text ) + f3_arg0:setText( f3_arg1.new_text ) + end + + } + } + } + } +end + +function aar_subtitle_bar() + return { + type = "UIElement", + properties = { + subtitle_text = "GAMETYPE - Map Name", + banner_width = AAR.Layout.SubTitleBannerWidth + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = AAR.Layout.SubTitleBarHeight, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "text_bkg_center", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = 1, + bottom = -6, + left = MBh.HalfOppositeProperty( "banner_width" ), + right = MBh.HalfProperty( "banner_width" ), + alpha = Swatches.GenericMenu.BorderAlpha + } ) + }, + children = { + { + type = "UIImage", + id = "text_bkg_left", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + material = RegisterMaterial( "box_angle_ltcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = -1 * AAR.Layout.SubTitleCapWidth, + right = 0 + } ) + } + }, + { + type = "UIImage", + id = "text_bkg_right", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + material = RegisterMaterial( "box_angle_rtcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = AAR.Layout.SubTitleCapWidth + } ) + } + } + } + }, + { + type = "UIText", + id = "bar_title", + properties = { + text = MBh.Property( "subtitle_text" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 2, + left = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = 0, + green = 0, + blue = 0, + alpha = 1 + } + }, + handlers = { + aar_set_subtitle_text = function ( f5_arg0, f5_arg1 ) + assert( f5_arg1.new_text ) + f5_arg0:setText( f5_arg1.new_text ) + end + + } + } + } + } +end + +function ExitAAR( f6_arg0, f6_arg1 ) + f6_arg0:dispatchEventToRoot( { + name = "lobby_slide_enable", + dispatchChildren = true + } ) + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) +end + +function aar_footer_bar() + local self = nil + if Engine.IsConsoleGame() then + self = LUI.UIButton.new() + self:registerEventHandler( "button_action", ExitAAR ) + else + self = LUI.UIElement.new() + end + self.id = "aar_footer_bar_id" + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -AAR.Layout.FooterHeight, + bottom = 0, + left = 0, + right = 0, + red = 0, + green = 0, + blue = 0 + } ) + self:animateToState( "default" ) + local f7_local1 = LUI.UIImage.new() + f7_local1.id = "aar_footer_bkg" + f7_local1:registerAnimationState( "default", CoD.ColorizeState( Swatches.GenericMenu.Border, { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 1, + right = -1, + top = 0, + bottom = 1, + alpha = Swatches.GenericMenu.BorderAlpha + } ) ) + f7_local1:animateToState( "default" ) + self:addElement( f7_local1 ) + local f7_local2 = LUI.UIBindButton.new() + f7_local2.id = "aar_buttons_handler_id" + f7_local2:registerEventHandler( "button_secondary", ExitAAR ) + f7_local2:registerEventHandler( "button_select", ExitAAR ) + self:addElement( f7_local2 ) + if Engine.IsConsoleGame() then + local f7_local3 = LUI.UIText.new() + f7_local3.id = "aar_footer_text" + f7_local3:setText( Engine.Localize( "@LUA_MENU_AAR_FOOTER_TEXT" ) ) + local f7_local4 = CoD.TextSettings.BoldFont.Height + 5 + f7_local3:registerAnimationState( "default", CoD.ColorizeState( Colors.cac_label_text, { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + top = -f7_local4 / 2, + bottom = f7_local4 / 2, + left = 10, + right = 0 + } ) ) + f7_local3:animateToState( "default" ) + self:addElement( f7_local3 ) + else + local f7_local3 = LUI.ButtonHelperText.helper_text_item( ButtonMap.button_secondary, Engine.Localize( "@LUA_MENU_CLOSE" ), nil, nil, nil ) + f7_local3.triggers_event = "button_secondary" + f7_local3.id = "aar_helper_text_id" + local f7_local4 = LUI.UIHorizontalList.new() + f7_local4.id = "aar_footer_hlist" + f7_local4:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 10, + right = 0, + top = 0, + bottom = 0, + alignment = LUI.Alignment.Left + } ) + f7_local4:animateToState( "default" ) + f7_local4:addElement( f7_local3 ) + self:addElement( f7_local4 ) + end + return self +end + +function aar_dots() + return { + type = "UIHorizontalList", + id = "page_dots", + focusable = false, + properties = { + num_dots = 3, + curr_dot = 1 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 67, + bottom = 79, + left = -100, + right = 100, + alignment = LUI.Alignment.Center, + alpha = 1, + spacing = 4 + } + }, + childrenFeeder = function ( f9_arg0 ) + local f9_local0 = f9_arg0.num_dots + local f9_local1 = f9_arg0.curr_dot + local f9_local2 = {} + for f9_local3 = 1, f9_local0, 1 do + local f9_local6 = #f9_local2 + 1 + local f9_local7 = { + type = "UIImage", + id = "nav_dot_" .. f9_local3 + } + local f9_local8 = {} + local f9_local9 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 12, + top = 0, + bottom = 12 + } + local f9_local10 + if f9_local3 == f9_local1 then + f9_local10 = RegisterMaterial( "widg_circle_fill" ) + if not f9_local10 then + + else + f9_local9.material = f9_local10 + f9_local8.default = f9_local9 + f9_local7.states = f9_local8 + f9_local2[f9_local6] = f9_local7 + end + end + f9_local10 = RegisterMaterial( "widg_circle_empty" ) + end + return f9_local2 + end + + } +end + +LUI.MenuBuilder.registerDef( "aar_title_bar", aar_title_bar ) +LUI.MenuBuilder.registerDef( "aar_title_bar_top", aar_title_bar_top ) +LUI.MenuBuilder.registerDef( "aar_subtitle_bar", aar_subtitle_bar ) +LUI.MenuBuilder.registerType( "aar_footer_bar", aar_footer_bar ) +LUI.MenuBuilder.registerDef( "aar_dots", aar_dots ) +LockTable( _M ) diff --git a/lui/mp_menus/aarmain.dec.lua b/lui/mp_menus/aarmain.dec.lua new file mode 100644 index 0000000..8c51d76 --- /dev/null +++ b/lui/mp_menus/aarmain.dec.lua @@ -0,0 +1,314 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function AARSummaryMainCreate( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + local f1_local1 = f1_local0.controller + if IsPublicMatch() or Engine.IsAliensMode() then + TryForceOpenUnlocksScreens( f1_arg0, f1_arg1, f1_local1 ) + end + f1_arg0:dispatchEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true + } ) +end + +function toggleScreen( f2_arg0, f2_arg1, f2_arg2 ) + if #f2_arg0.properties.screens > 1 then + if f2_arg2 == "right" then + if f2_arg0.properties.screen_idx < #f2_arg0.properties.screens then + f2_arg0.properties.screen_idx = f2_arg0.properties.screen_idx + 1 + f2_arg0:dispatchEventToRoot( { + name = "toggle_next_aar_screen" + } ) + end + elseif f2_arg2 == "left" and f2_arg0.properties.screen_idx > 1 then + f2_arg0.properties.screen_idx = f2_arg0.properties.screen_idx - 1 + f2_arg0:dispatchEventToRoot( { + name = "toggle_next_aar_screen" + } ) + end + if #f2_arg0.properties.screens <= f2_arg0.properties.screen_idx then + f2_arg0:dispatchEventToRoot( { + name = "disable_right_arrow" + } ) + else + f2_arg0:dispatchEventToRoot( { + name = "enable_right_arrow" + } ) + end + if f2_arg0.properties.screen_idx <= 1 then + f2_arg0:dispatchEventToRoot( { + name = "disable_left_arrow" + } ) + else + f2_arg0:dispatchEventToRoot( { + name = "enable_left_arrow" + } ) + end + end +end + +function aarMainChildFeeder( f3_arg0 ) + local f3_local0 = { + "mp_scoreboard_main" + } + local f3_local1 = 0 + if IsPublicMatch() then + local f3_local2 = Engine.GetPlayerDataEx + local f3_local3 = f3_arg0.exclusiveController + if not f3_local3 then + f3_local3 = Engine.GetFirstActiveController() + end + f3_local1 = f3_local2( f3_local3, CoD.StatsGroup.Common, "round", "squadMode" ) + if f3_local1 == 0 then + f3_local0 = { + "aar_match_summary_main", + "mp_opprogress_main", + "mp_scoreboard_main" + } + else + f3_local0 = { + "aar_match_summary_main", + "mp_scoreboard_main" + } + end + end + if Engine.IsAliensMode() then + f3_local0 = { + "aar_match_summary_main", + "mp_scoreboard_main" + } + end + f3_arg0.screens = f3_local0 + local f3_local2 = { + { + type = "UIImage", + id = "darken_behind_popup_id", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = 0.85 + } + } + } + } + local f3_local3 = f3_arg0.screen_idx + local f3_local4 = f3_arg0.screens + if f3_local3 > 0 then + assert( f3_local4[f3_local3] ) + f3_local2[#f3_local2 + 1] = { + type = f3_local4[f3_local3], + id = "aar_screen_" .. f3_local4[f3_local3] .. "_id", + properties = { + page_idx = f3_local3, + num_pages = #f3_local4, + controller = f3_arg0.exclusiveController, + squadMode = f3_local1 + } + } + end + if #f3_local4 > 1 then + f3_local2[#f3_local2 + 1] = { + type = "aar_nav_arrows", + id = "aar_nav_arrows_id" + } + f3_local2[#f3_local2 + 1] = { + type = "UIBindButton", + id = "aar_summary_main_bind_btn_id", + handlers = { + button_right = function ( f4_arg0, f4_arg1 ) + toggleScreen( f4_arg0, f4_arg1, "right" ) + end, + button_left = function ( f5_arg0, f5_arg1 ) + toggleScreen( f5_arg0, f5_arg1, "left" ) + end, + toggle_aar_right = function ( f6_arg0, f6_arg1 ) + toggleScreen( f6_arg0, f6_arg1, "right" ) + end, + toggle_aar_left = function ( f7_arg0, f7_arg1 ) + toggleScreen( f7_arg0, f7_arg1, "left" ) + end + } + } + end + return f3_local2 +end + +function aar_summary_main() + return { + type = "UIElement", + id = "aar_main_container_id", + properties = { + screen_idx = 1 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + childrenFeeder = aarMainChildFeeder, + handlers = { + toggle_next_aar_screen = MBh.EmitEvent( "menu_refresh" ), + menu_create = AARSummaryMainCreate, + open_after_action_report_unlocks = OpenUnlockScreens + } + } +end + +function aar_nav_arrows() + return { + type = "UIElement", + focusable = true, + requireFocusType = FocusType.MouseOver, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -30, + bottom = 30, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + popup_active = MBh.AnimateToState( "hidden" ), + popup_inactive = MBh.AnimateToState( "default" ) + }, + children = { + { + type = "UIButton", + id = "left_nav_arrow_button_id", + requireFocusType = FocusType.MouseOver, + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = AAR.Layout.Width / -2 - 10 - 30, + right = AAR.Layout.Width / -2 - 10, + top = 0, + bottom = 0 + } + }, + handlers = { + button_action = MBh.EmitEventToRoot( { + name = "toggle_aar_left" + } ) + }, + children = { + { + type = "UIImage", + id = "left_nav_arrow_image_id", + states = { + default = { + material = RegisterMaterial( "widg_margin_arrow_lt" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b, + alpha = 0 + }, + bright = { + alpha = 1 + } + }, + handlers = { + disable_left_arrow = MBh.AnimateToState( "default", 0 ), + enable_left_arrow = MBh.AnimateToState( "bright", 0 ) + } + } + } + }, + { + type = "UIButton", + id = "right_nav_arrow_button_id", + requireFocusType = FocusType.MouseOver, + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = AAR.Layout.Width / 2 + 10, + right = AAR.Layout.Width / 2 + 10 + 30, + top = 0, + bottom = 0 + } + }, + handlers = { + button_action = MBh.EmitEventToRoot( { + name = "toggle_aar_right" + } ) + }, + children = { + { + type = "UIImage", + id = "right_nav_arrow_image_id", + states = { + default = { + material = RegisterMaterial( "widg_margin_arrow_rt" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b, + alpha = 1 + }, + dim = { + alpha = 0 + } + }, + handlers = { + disable_right_arrow = MBh.AnimateToState( "dim", 0 ), + enable_right_arrow = MBh.AnimateToState( "default", 0 ) + } + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "aar_nav_arrows", aar_nav_arrows ) +LUI.MenuBuilder.registerDef( "aar_summary_main", aar_summary_main ) +LockTable( _M ) diff --git a/lui/mp_menus/aarmini.dec.lua b/lui/mp_menus/aarmini.dec.lua new file mode 100644 index 0000000..a0d43b3 --- /dev/null +++ b/lui/mp_menus/aarmini.dec.lua @@ -0,0 +1,607 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg1.controller + local f2_local1 = nil + local f2_local2 = -1 + local f2_local3, f2_local4 = nil + for f2_local5 = 1, MaxTrackedOperations, 1 do + local f2_local8 = GetTrackedOp( f2_local0, f2_local5 - 1 ) + if f2_local8 ~= "" then + local f2_local9 = GetOperationData( f2_local0, f2_local8 ) + local f2_local10 = f2_local9.PercentProgress + local f2_local11 = f2_local10 >= 1 + local f2_local12 = f2_local10 <= 0 + if not f2_local11 and not f2_local12 and f2_local2 < f2_local10 then + f2_local1 = f2_local9 + if f2_local11 then + local f2_local13 = 0 + end + f2_local2 = f2_local13 or f2_local10 + end + if f2_local11 and not f2_local3 then + f2_local3 = f2_local9 + end + if f2_local12 and not f2_local4 then + f2_local4 = f2_local9 + end + end + DebugPrint( "Cannot Access Current Active Op" ) + end + local f2_local5 = nil + if f2_local1 then + f2_local5 = f2_local1 + elseif f2_local3 then + f2_local5 = f2_local3 + else + f2_local5 = f2_local4 + end + local f2_local6 = nil + if f2_local5 then + f2_local6 = getGroupRefForOperation( f2_local5.Ref ) + end + if not f2_local6 or not f2_local5 then + DebugPrint( "Error getting most-progressed operation." ) + f2_arg0:processEvent( { + name = "hide_mini_aar_op_progress" + } ) + return + end + local f2_local7 = Engine.Localize( GetFieldForOperationsGroup( f2_local6, OperationGroups.Cols.Name ) ) + local f2_local14 = f2_local5.Name + local f2_local8 = f2_local5.ProgressText + local f2_local9 = 0 + local f2_local10 = f2_local5.MaxProgress + local f2_local11 = 0 + local f2_local12 = f2_local5.Progress + local f2_local15 = 0 + local f2_local16 = 0 + if f2_local10 - f2_local9 > 0 then + f2_local15 = (f2_local11 - f2_local9) / (f2_local10 - f2_local9) + f2_local16 = (f2_local12 - f2_local9) / (f2_local10 - f2_local9) + end + f2_arg0:processEvent( { + name = "update_operation_progress", + title_text = f2_local7, + desc_text = f2_local14, + progress_text = f2_local8, + prevPercent = math.min( f2_local15, 1 ), + currPercent = math.min( f2_local16, 1 ) + } ) +end + +f0_local2 = function () + local f3_local0 = 244 + local f3_local1 = 7 + local f3_local2 = { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 55, + left = 0, + right = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + expand_mini_aar = f0_local1, + hide_mini_aar_op_progress = MBh.AnimateToState( "hidden" ) + } + } + local f3_local3 = {} + local f3_local4 = { + type = "UIText", + id = "progress_item_title_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 5, + bottom = CoD.TextSettings.NormalFont.Height + 5, + left = 6, + right = 400, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + red = AAR.Swatch.subtext.r, + green = AAR.Swatch.subtext.g, + blue = AAR.Swatch.subtext.b + } + }, + handlers = { + update_operation_progress = function ( f4_arg0, f4_arg1 ) + f4_arg0:setText( f4_arg1.title_text ) + end + } + } + local f3_local5 = { + type = "UIMarqueeText", + id = "progress_item_desc_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 28, + bottom = CoD.TextSettings.NormalFont.Height + 28, + left = 6, + right = 275, + font = CoD.TextSettings.NormalFont.Font, + red = AAR.Swatch.title.r, + green = AAR.Swatch.title.g, + blue = AAR.Swatch.title.b, + alignment = LUI.Alignment.Left + } + }, + handlers = { + update_operation_progress = function ( f5_arg0, f5_arg1 ) + f5_arg0:setText( f5_arg1.desc_text ) + end + } + } + local f3_local6 = { + type = "UIText", + id = "progress_item_max_val_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 5, + bottom = CoD.TextSettings.NormalFont.Height + 5, + left = 400, + right = 544, + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + red = AAR.Swatch.subtext.r, + green = AAR.Swatch.subtext.g, + blue = AAR.Swatch.subtext.b + } + }, + handlers = { + update_operation_progress = function ( f6_arg0, f6_arg1 ) + f6_arg0:setText( f6_arg1.progress_text ) + end + } + } + local f3_local7 = { + type = "UIImage", + id = "progress_fill_meter_id", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 300, + right = 300 + f3_local0, + top = 34, + bottom = 34 + f3_local1, + red = 0, + green = 0, + blue = 0 + } + } + } + local f3_local8 = {} + local f3_local9 = { + type = "UIImage", + id = "progress_meter_curr_fill", + states = { + default = { + material = RegisterMaterial( "btn_cas_fill_f" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = AAR.Swatch.colorpop.r + 0.1, + green = AAR.Swatch.colorpop.g + 0.1, + blue = AAR.Swatch.colorpop.b + 0.1 + } + }, + handlers = { + update_operation_progress = function ( f7_arg0, f7_arg1 ) + f7_arg0:registerAnimationState( "fill", { + material = RegisterMaterial( "btn_cas_fill_f" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f7_arg1.currPercent * f3_local0, + top = 0, + bottom = 0, + red = AAR.Swatch.colorpop.r + 0.1, + green = AAR.Swatch.colorpop.g + 0.1, + blue = AAR.Swatch.colorpop.b + 0.1 + } ) + local f7_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 250 + }, + { + "fill", + 250 + } + } ) + f7_local0( f7_arg0 ) + end + } + } + local f3_local10 = { + type = "UIImage", + id = "progress_meter_prev_fill", + states = { + default = { + material = RegisterMaterial( "btn_cas_fill_f" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = AAR.Swatch.progressborder.r, + green = AAR.Swatch.progressborder.g, + blue = AAR.Swatch.progressborder.b + } + }, + handlers = { + update_operation_progress = function ( f8_arg0, f8_arg1 ) + f8_arg0:registerAnimationState( "fill", { + material = RegisterMaterial( "btn_cas_fill_f" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f8_arg1.prevPercent * f3_local0, + top = 0, + bottom = 0, + red = AAR.Swatch.progressborder.r, + green = AAR.Swatch.progressborder.g, + blue = AAR.Swatch.progressborder.b + } ) + f8_arg0:animateToState( "fill", 0 ) + end + } + } + local f3_local11 = LUI.mp_menus.Operations.HairlineBorder( "top", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 ) + local f3_local12 = LUI.mp_menus.Operations.HairlineBorder( "bottom", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 ) + local f3_local13 = LUI.mp_menus.Operations.HairlineBorder( "left", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 ) + local f3_local14 = LUI.mp_menus.Operations.HairlineBorder( "right", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 ) + f3_local7.children = f3_local9 + f3_local8 = LUI.mp_menus.Operations.HairlineBorder( "top", AAR.Swatch.trim.r, AAR.Swatch.trim.g, AAR.Swatch.trim.b, 0.6 ) + f3_local9 = LUI.mp_menus.Operations.HairlineBorder( "bottom", AAR.Swatch.trim.r, AAR.Swatch.trim.g, AAR.Swatch.trim.b, 0.6 ) + f3_local2.children = f3_local4 + return f3_local2 +end + +local f0_local3 = function ( f9_arg0 ) + assert( f9_arg0 ) + local f9_local0 = "" + local f9_local1 = Engine.Localize( "@LUA_MENU_AAR_NEW_UNLOCKS" ) + if f9_arg0 and f9_arg0 > 0 then + f9_local0 = f9_local1 .. " " .. f9_arg0 + end + return f9_local0 +end + +function aar_mini_background() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Background, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 0, + width = 200, + material = RegisterMaterial( "white" ) + } ) + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Background, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 0, + right = -100, + width = 500, + material = RegisterMaterial( "box_white_gradient_fade_rt" ) + } ) + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Background, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 0, + left = 100, + right = 500, + material = RegisterMaterial( "box_white_gradient_fade" ) + } ) + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 1, + right = 0, + width = 500, + material = RegisterMaterial( "box_white_gradient_fade_rt" ) + } ) + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 1, + left = 0, + width = 500, + material = RegisterMaterial( "box_white_gradient_fade" ) + } ) + } + } + } + } +end + +function AARMiniChildrenFeeder( f11_arg0 ) + local f11_local0 = { + [#f11_local0 + 1] = { + type = "aar_mini_background", + id = "aar_mini_background_id" + }, + [#f11_local0 + 1] = { + type = "UIText", + id = "aar_mini_title_id", + properties = { + text = MBh.Property( "title_text" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 10, + bottom = 10 + CoD.TextSettings.ExtraBigFont.Height, + left = 0, + right = 0, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center + } + } + } + } + local f11_local1 = #f11_local0 + 1 + local f11_local2 = { + type = "aar_xp_info_widget", + id = "aar_mini_xp_info_widget_id" + } + local f11_local3 = {} + local f11_local4 + if Engine.GetDvarBool( "ui_opensummary" ) then + f11_local4 = true + else + f11_local4 = false + end + f11_local3.animate_progress = f11_local4 + f11_local2.properties = f11_local3 + f11_local2.states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 42, + left = -213, + right = 213, + height = 67, + material = RegisterMaterial( "white" ), + red = AAR.Swatch.background_2.r, + green = AAR.Swatch.background_2.g, + blue = AAR.Swatch.background_2.b + } + } + f11_local0[f11_local1] = f11_local2 + f11_local0[#f11_local0 + 1] = { + type = "UIText", + id = "aar_mini_unlocks_message_id", + states = { + default = CoD.ColorizeState( Colors.frontend_hilite, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 112, + left = -213, + right = 213, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + handlers = { + expand_mini_aar = function ( f12_arg0, f12_arg1 ) + if f12_arg1.num_unlocks and f12_arg1.num_unlocks > 0 then + f12_arg0:setText( f0_local3( f12_arg1.num_unlocks ) ) + else + f12_arg0:setText( "" ) + end + end + } + } + if not SvS.IsSvS() then + f11_local1 = #f11_local0 + 1 + f11_local2 = { + type = "UIElement", + id = "aar_mini_operation_progress_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = 112 + CoD.TextSettings.NormalFont.Height, + bottom = 0, + left = -275, + right = 275 + } + } + } + f11_local3 = {} + f11_local2.children = f0_local2() + f11_local0[f11_local1] = f11_local2 + end + return f11_local0 +end + +function aar_mini() + return { + type = "UIElement", + id = "aar_mini_main", + properties = { + title_text = Engine.Localize( "@MENU_GAME_SUMMARY_CAPS" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 220, + left = 0, + right = 0 + }, + anim_in = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = SvS.IsSvS() and -240 or -310, + bottom = 0, + left = 0, + right = 0 + }, + anim_in_hold = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = SvS.IsSvS() and -240 or -290, + bottom = 0, + left = 0, + right = 0 + }, + anim_out = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 220, + left = 0, + right = 0 + } + }, + handlers = { + expand_mini_aar = MBh.AnimateSequence( { + { + "default", + 500 + }, + { + "anim_in", + 175 + }, + { + "anim_in_hold", + 75 + }, + { + "anim_in_hold", + 5000 + }, + { + "anim_out", + 175 + } + } ) + }, + childrenFeeder = AARMiniChildrenFeeder + } +end + +LUI.MenuBuilder.registerDef( "aar_mini", aar_mini ) +LUI.MenuBuilder.registerDef( "aar_mini_background", aar_mini_background ) +LockTable( _M ) diff --git a/lui/mp_menus/aaroperationprogress.dec.lua b/lui/mp_menus/aaroperationprogress.dec.lua new file mode 100644 index 0000000..6243acd --- /dev/null +++ b/lui/mp_menus/aaroperationprogress.dec.lua @@ -0,0 +1,396 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function OperationProgressListRowFeeder( f1_arg0 ) + local f1_local0 = {} + local f1_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" ) + local f1_local2 = f1_local1.controller + local f1_local3 = GetAllOpGroupRefs() + local f1_local4 = 250 + local f1_local5 = 7 + local f1_local6 = 30 + for f1_local7 = 1, MaxTrackedOperations, 1 do + local f1_local10 = GetTrackedOp( f1_local2, f1_local7 - 1 ) + if f1_local10 == "" then + DebugPrint( "Cannot Access Current Tracked Op" ) + return {} + end + local f1_local11 = GetOperationData( f1_local2, f1_local10 ) + local f1_local12 = f1_local11.Name + local f1_local13 = f1_local11.ProgressText + local f1_local14 = 0 + local f1_local15 = f1_local11.MaxProgress + local f1_local16 = 0 + local f1_local17 = f1_local11.Progress + local f1_local18 = 0 + local f1_local19 = 0 + if f1_local15 - f1_local14 > 0 then + f1_local18 = (f1_local16 - f1_local14) / (f1_local15 - f1_local14) + f1_local19 = (f1_local17 - f1_local14) / (f1_local15 - f1_local14) + end + f1_local19 = math.min( f1_local19, 1 ) + f1_local18 = math.min( f1_local18, 1 ) + local f1_local20 = { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f1_local6, + left = 0, + right = 0 + } + } + } + local f1_local21 = {} + local f1_local22 = { + type = "UIMarqueeText", + id = "progress_item_desc_id", + properties = { + text = f1_local12 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 5, + bottom = CoD.TextSettings.NormalFont.Height + 5, + left = 6, + right = 275, + font = CoD.TextSettings.NormalFont.Font, + red = AAR.Swatch.title.r, + green = AAR.Swatch.title.g, + blue = AAR.Swatch.title.b, + alignment = LUI.Alignment.Left + } + } + } + local f1_local23 = { + type = "UIText", + id = "progress_item_max_val_id", + properties = { + text = f1_local13 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 5, + bottom = CoD.TextSettings.NormalFont.Height + 5, + left = 500, + right = 656, + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + red = AAR.Swatch.subtext.r, + green = AAR.Swatch.subtext.g, + blue = AAR.Swatch.subtext.b + } + } + } + local f1_local24 = { + type = "UIImage", + id = "progress_fill_meter_id", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 300, + right = 300 + f1_local4, + top = 11, + bottom = 11 + f1_local5, + red = 0, + green = 0, + blue = 0 + } + } + } + local f1_local25 = {} + local f1_local26 = { + type = "UIImage", + id = "progress_meter_curr_fill", + states = { + default = { + material = RegisterMaterial( "btn_cas_fill_f" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = AAR.Swatch.colorpop.r + 0.1, + green = AAR.Swatch.colorpop.g + 0.1, + blue = AAR.Swatch.colorpop.b + 0.1 + }, + fill = { + material = RegisterMaterial( "btn_cas_fill_f" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f1_local19 * f1_local4, + top = 0, + bottom = 0, + red = AAR.Swatch.colorpop.r + 0.1, + green = AAR.Swatch.colorpop.g + 0.1, + blue = AAR.Swatch.colorpop.b + 0.1 + } + }, + handlers = { + element_refresh = function ( f2_arg0, f2_arg1 ) + local f2_local0 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "default", + 250 + }, + { + "fill", + 250 + } + } ) + f2_local0( f2_arg0 ) + end + } + } + local f1_local27 = { + type = "UIImage", + id = "progress_meter_prev_fill", + states = { + default = { + material = RegisterMaterial( "btn_cas_fill_f" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f1_local18 * f1_local4, + top = 0, + bottom = 0, + red = AAR.Swatch.progressborder.r, + green = AAR.Swatch.progressborder.g, + blue = AAR.Swatch.progressborder.b + } + } + } + local f1_local28 = LUI.mp_menus.Operations.HairlineBorder( "top", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 ) + local f1_local29 = LUI.mp_menus.Operations.HairlineBorder( "bottom", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 ) + local f1_local30 = LUI.mp_menus.Operations.HairlineBorder( "left", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 ) + local f1_local31 = LUI.mp_menus.Operations.HairlineBorder( "right", AAR.Swatch.progressborder.r, AAR.Swatch.progressborder.g, AAR.Swatch.progressborder.b, 0.6 ) + f1_local24.children = f1_local26 + f1_local25 = LUI.mp_menus.Operations.HairlineBorder( "top", AAR.Swatch.trim.r, AAR.Swatch.trim.g, AAR.Swatch.trim.b, 0.6 ) + if f1_local7 == MaxTrackedOperations then + f1_local26 = LUI.mp_menus.Operations.HairlineBorder( "bottom", AAR.Swatch.trim.r, AAR.Swatch.trim.g, AAR.Swatch.trim.b, 0.6 ) + if not f1_local26 then + + else + f1_local21[1] = f1_local22 + f1_local21[2] = f1_local23 + f1_local21[3] = f1_local24 + f1_local21[4] = f1_local25 + f1_local21[5] = f1_local26 + f1_local20.children = f1_local21 + f1_local20.id = "progress_item_" .. f1_local7 + f1_local0[#f1_local0 + 1] = f1_local20 + end + end + f1_local26 = nil + end + return f1_local0 +end + +function mp_opprogress_vlist() + return { + type = "UIVerticalList", + id = "mp_opprogress_vlist_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = CoD.TextSettings.ExtraBigFont.Height + 40, + bottom = 0, + left = -331, + right = 331 + } + }, + childrenFeeder = OperationProgressListRowFeeder + } +end + +function mp_opprogress_page() + return { + type = "UIElement", + id = "mp_opprogress_page_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIText", + id = "mp_opprogress_title", + properties = { + text = Engine.Localize( "@LUA_MENU_OPERATION_PROGRESS_CAPS" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 30, + bottom = CoD.TextSettings.ExtraBigFont.Height + 30, + left = -200, + right = 200, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.ExtraBigFont.Font, + red = AAR.Swatch.title.r, + green = AAR.Swatch.title.g, + blue = AAR.Swatch.title.b + } + } + }, + { + type = "mp_opprogress_vlist" + } + } + } +end + +function mp_opprogress_main() + return { + type = "UIElement", + id = "mp_opprogress_main_id", + properties = { + page_idx = 1, + num_pages = 3 + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = AAR.Layout.Width, + height = AAR.Layout.Height + } + }, + handlers = { + element_refresh = function ( f6_arg0, f6_arg1 ) + local f6_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" ) + local f6_local1 = f6_local0.controller + local f6_local2 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, Engine.GetPlayerDataEx( f6_local1, CoD.StatsGroup.Common, "round", "gameMode" ), GameTypesTable.Cols.Name ) + local f6_local3 = Engine.GetPlayerDataEx( f6_local1, CoD.StatsGroup.Common, "round", "map" ) + local f6_local4 = Squad.GetRealBaseNameFromLoadName( f6_local3 ) + if f6_local3 ~= "" then + f6_arg0:processEvent( { + name = "aar_set_subtitle_text", + new_text = Engine.Localize( "LUA_MENU_MODE_AND_MAP_FORMAT", f6_local2, Engine.MarkLocalized( f6_local4 ) ), + dispatchChildren = true + } ) + end + end + + }, + 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", + properties = { + title_text = Engine.Localize( "@LUA_MENU_GAME_SUMMARY" ), + subtitle_text = Engine.Localize( "@LUA_MENU_OPERATIONS_TITLE" ), + subtitle_banner_width = 300 + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "mp_opprogress_page" + }, + { + type = "aar_footer_bar", + id = "oink_1" + } + } + }, + { + type = "aar_dots", + id = "AARSummaryDotsID", + properties = { + num_dots = MBh.Property( "num_pages" ), + curr_dot = MBh.Property( "page_idx" ) + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "mp_opprogress_main", mp_opprogress_main ) +LUI.MenuBuilder.registerDef( "mp_opprogress_page", mp_opprogress_page ) +LUI.MenuBuilder.registerDef( "mp_opprogress_vlist", mp_opprogress_vlist ) +LockTable( _M ) diff --git a/lui/mp_menus/aarscoreboard.dec.lua b/lui/mp_menus/aarscoreboard.dec.lua new file mode 100644 index 0000000..6dab7f9 --- /dev/null +++ b/lui/mp_menus/aarscoreboard.dec.lua @@ -0,0 +1,800 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" ) + local f1_local1 = Engine.GetPlayerDataEx( f1_local0.controller, CoD.StatsGroup.Common, "round", "scoreboardType" ) + local f1_local2 + if f1_local1 == "allies" or f1_local1 == "axis" then + f1_local2 = false + else + f1_local2 = true + end + local f1_local3 = { + default = { + "score", + "kills", + "deaths", + "assists" + }, + war = { + "score", + "kills", + "deaths", + "assists" + }, + dom = { + "score", + "kills", + "deaths", + "captures" + }, + sd = { + "score", + "kills", + "deaths", + "plants" + }, + conf = { + "score", + "kills", + "deaths", + "tags" + }, + dm = { + "dm_score", + "kills", + "deaths", + "dm_streak" + }, + sr = { + "score", + "kills", + "deaths", + "rescues" + }, + blitz = { + "score", + "kills", + "deaths", + "captures" + }, + cranked = { + "score", + "kills", + "deaths", + "assists" + }, + cranked_ffa = { + "cranked_ffa_score", + "kills", + "deaths", + "assists" + }, + sotf = { + "score", + "kills", + "deaths", + "assists" + }, + sotf_ffa = { + "sotf_ffa_score", + "kills", + "deaths", + "dm_streak" + }, + infect = { + "score", + "kills", + "deaths", + "time" + }, + grind = { + "score", + "kills", + "deaths", + "scores" + }, + horde = { + "kills", + "revives", + "crates" + }, + gun = { + "score", + "kills", + "deaths", + "gun_knives" + }, + siege = { + "score", + "kills", + "deaths", + "captures" + } + } + local f1_local4 = { + score = { + "LUA_MENU_SCORE", + "score" + }, + kills = { + "LUA_MENU_KILLS", + "kills" + }, + deaths = { + "LUA_MENU_DEATHS", + "deaths" + }, + assists = { + "LUA_MENU_ASSISTS", + "assists" + }, + cranked_ffa_score = { + "LUA_MENU_SCORE", + "extrascore0" + }, + sotf_ffa_score = { + "LUA_MENU_SCORE", + "extrascore0" + }, + dm_score = { + "LUA_MENU_SCORE", + "extrascore0" + }, + rescues = { + "LUA_MENU_RESCUES", + "extrascore0" + }, + captures = { + "LUA_MENU_CAPTURES", + "extrascore0" + }, + tags = { + "LUA_MENU_TAGS", + "extrascore0" + }, + time = { + "LUA_MENU_TIME", + "extrascore0" + }, + scores = { + "LUA_MENU_SCORES", + "extrascore0" + }, + plants = { + "LUA_MENU_PLANTS", + "extrascore0" + }, + revives = { + "LUA_MENU_REVIVES", + "assists" + }, + crates = { + "LUA_MENU_CRATES", + "extrascore0" + }, + dm_streak = { + "MENU_STREAK", + "assists" + }, + gun_knives = { + "PATCH_MENU_STABS", + "assists" + } + } + local f1_local5 + if f1_local2 then + f1_local5 = f1_local3[f1_arg0 .. "_ffa"] + if not f1_local5 then + + else + local f1_local6 = {} + for f1_local10, f1_local11 in ipairs( f1_local5 ) do + f1_local6[f1_local10] = { + Engine.Localize( f1_local4[f1_local11][1] ), + f1_local4[f1_local11][2] + } + end + return f1_local6 + end + end + f1_local5 = f1_local3[f1_arg0] or f1_local3.default +end + +function ScoreboardListRowFeeder( f2_arg0 ) + local f2_local0 = {} + local f2_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" ) + local f2_local2 = f2_local1.controller + local f2_local3 = Engine.GetPlayerDataEx( f2_local2, CoD.StatsGroup.Common, "round", "gameMode" ) + local f2_local4 = f0_local0( f2_local3 ) + f2_local0[#f2_local0 + 1] = { + type = "UIImage", + id = "small_spacer_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 20, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 1, + green = 1, + blue = 1, + alpha = 0 + } + } + } + local f2_local5 = {} + if Engine.IsAliensMode() then + table.insert( f2_local5, Engine.Localize( "@LUA_MENU_PLAYER_NAME_CAPS" ) ) + table.insert( f2_local5, Engine.Localize( "@MPUI_SCORE" ) ) + table.insert( f2_local5, Engine.Localize( "@MPUI_KILLS" ) ) + if not isAliensSolo() then + table.insert( f2_local5, Engine.Localize( "@MPUI_ASSISTS" ) ) + end + table.insert( f2_local5, Engine.Localize( "@ALIENS_REVIVES" ) ) + if not AAR.AreChaosStats( f2_local3 ) then + table.insert( f2_local5, Engine.Localize( "@ALIENS_DRILL_RESTARTS" ) ) + end + table.insert( f2_local5, Engine.Localize( "@MENU_DOWNS" ) ) + else + local f2_local6 = {} + f2_local5 = Engine.Localize( "@LUA_MENU_PLAYER_NAME_CAPS" ) + for f2_local9, f2_local10 in pairs( f2_local4 ) do + f2_local5[#f2_local5 + 1] = f2_local10[1] + end + end + local f2_local6 = {} + local f2_local7 = 788 + local f2_local8 = 0 + for f2_local9 = #f2_local5, 1, -1 do + if f2_local9 == 1 then + f2_local6[f2_local9] = f2_local7 - f2_local8 + else + local f2_local12, f2_local13, f2_local14, f2_local15 = GetTextDimensions( f2_local5[f2_local9], CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + f2_local6[f2_local9] = f2_local14 - f2_local12 + 20 + f2_local8 = f2_local8 + f2_local6[f2_local9] + end + end + local f2_local9 = {} + for f2_local10 = 1, #f2_local5, 1 do + f2_local9[#f2_local9 + 1] = CreateScoreBoardHeaderCell( "scoreboard_header_" .. f2_local10, f2_local5[f2_local10], f2_local6[f2_local10], f2_local10 % 2 == 1 ) + end + f2_local0[#f2_local0 + 1] = { + type = "UIHorizontalList", + properties = {}, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 25, + left = 0, + right = 0 + } + }, + children = f2_local9 + } + local f2_local11 = Engine.GetClientMatchData( "scoreboardPlayerCount" ) + local f2_local16 = "" + if Engine.GetUsernameByController then + f2_local16 = Engine.GetUsernameByController( f2_local2 ) + end + local f2_local12 = "none" + if f2_local11 ~= nil and f2_local11 > 0 then + for f2_local13 = 1, f2_local11, 1 do + local f2_local17 = Engine.GetClientMatchData( "scoreboards", Engine.GetPlayerDataEx( f2_local2, CoD.StatsGroup.Common, "round", "scoreboardType" ), f2_local13 - 1 ) + if f2_local17 >= 0 and Engine.GetClientMatchData( "players", f2_local17, "xuid" ) == f2_local16 then + f2_local12 = Engine.GetClientMatchData( "players", f2_local17, "team" ) + break + end + end + end + local f2_local13 = LUI.mp_menus.Aliens + local f2_local14 = {} + if Engine.IsAliensMode() then + for f2_local15 = 0, 3, 1 do + if f2_local13.GetGamerTagFromClient( f2_local15 ) ~= "" then + table.insert( f2_local14, f2_local15 ) + end + end + end + for f2_local15 = 1, AAR.Scoreboard.NumRows, 1 do + local f2_local17 = f2_local15 + local f2_local20 = 0 + if f2_local17 % 2 == 1 then + f2_local20 = 0.25 + end + local f2_local21 = -1 + local f2_local22 = "" + local f2_local23 = "none" + local f2_local24 = 0 + local f2_local25 = 0 + local f2_local26 = 0 + local f2_local27 = 0 + local f2_local28 = "" + local f2_local29 = "" + local f2_local30 = "" + local f2_local31 = "" + local f2_local32 = "" + local f2_local33 = "" + if Engine.IsAliensMode() then + if f2_local14[f2_local17] then + local f2_local34 = f2_local14[f2_local17] + f2_local22 = f2_local13.GetGamerTagFromClient( f2_local34 ) + f2_local28 = f2_local13.GetScoreFromClient( f2_local34 ) + f2_local29 = f2_local13.GetKillsFromClient( f2_local34 ) + f2_local30 = f2_local13.GetAssistsFromClient( f2_local34 ) + f2_local32 = f2_local13.GetRevivesFromClient( f2_local34 ) + f2_local33 = f2_local13.GetDrillRestartsFromClient( f2_local34 ) + f2_local31 = f2_local13.GetDownsFromClient( f2_local34 ) + end + else + local f2_local34 = Engine.GetPlayerDataEx( f2_local2, CoD.StatsGroup.Common, "round", "scoreboardType" ) + if f2_local34 ~= "none" and f2_local11 ~= nil and f2_local17 - 1 < f2_local11 then + f2_local21 = Engine.GetClientMatchData( "scoreboards", f2_local34, f2_local17 - 1 ) + end + if f2_local21 >= 0 and (f2_local34 == "allies" or f2_local34 == "axis") then + f2_local23 = Engine.GetClientMatchData( "players", f2_local21, "team" ) + if f2_local23 == "axis" or f2_local23 == "allies" then + if f2_local12 == "none" then + if f2_local23 == "axis" then + f2_local24 = AAR.Swatch.enemy.r + f2_local25 = AAR.Swatch.enemy.g + f2_local26 = AAR.Swatch.enemy.b + else + f2_local24 = AAR.Swatch.friendly.r + f2_local25 = AAR.Swatch.friendly.g + f2_local26 = AAR.Swatch.friendly.b + end + elseif f2_local23 == f2_local12 then + f2_local24 = AAR.Swatch.friendly.r + f2_local25 = AAR.Swatch.friendly.g + f2_local26 = AAR.Swatch.friendly.b + else + f2_local24 = AAR.Swatch.enemy.r + f2_local25 = AAR.Swatch.enemy.g + f2_local26 = AAR.Swatch.enemy.b + end + f2_local27 = 0.65 + end + end + end + f2_local0[#f2_local0 + 1] = { + type = "UIElement", + properties = {}, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 26, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + properties = {}, + 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 = f2_local20 + } + } + }, + { + type = "UIImage", + properties = {}, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 1, + bottom = -1, + left = -3, + right = 0, + material = RegisterMaterial( "scoreboard_team_player" ), + red = f2_local24, + green = f2_local25, + blue = f2_local26, + alpha = f2_local27 + } + } + }, + { + type = "UIHorizontalList", + properties = {}, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 3, + right = 0 + } + }, + childrenFeeder = function ( f3_arg0 ) + local f3_local0 = {} + local f3_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" ) + local f3_local2 = f3_local1.controller + local f3_local3 = Engine.GetPlayerDataEx( f3_local2, CoD.StatsGroup.Common, "round", "gameMode" ) + if Engine.IsAliensMode() then + f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "player_name_" .. f2_local17, f2_local22, f2_local6[1], true, LUI.Alignment.Left, true ) + f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "score_" .. f2_local17, f2_local28, f2_local6[2], false ) + f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "kills_" .. f2_local17, f2_local29, f2_local6[3], true ) + local f3_local4 = 4 + if not isAliensSolo() then + f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "assists_" .. f2_local17, f2_local30, f2_local6[f3_local4], false ) + f3_local4 = f3_local4 + 1 + end + f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "revives_" .. f2_local17, f2_local32, f2_local6[f3_local4], true ) + f3_local4 = f3_local4 + 1 + if not AAR.AreChaosStats( f3_local3 ) then + f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "drills_" .. f2_local17, f2_local33, f2_local6[f3_local4], false ) + f3_local4 = f3_local4 + 1 + end + f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "deaths_" .. f2_local17, f2_local31, f2_local6[f3_local4], true ) + else + local f3_local4 = -1 + local f3_local5 = "" + local f3_local6 = Engine.GetPlayerDataEx( f3_local2, CoD.StatsGroup.Common, "round", "scoreboardType" ) + if f3_local6 ~= "none" and f2_local11 ~= nil and f2_local17 - 1 < f2_local11 then + f3_local4 = Engine.GetClientMatchData( "scoreboards", f3_local6, f2_local17 - 1 ) + end + if f3_local4 >= 0 then + f3_local5 = Engine.GetClientMatchData( "players", f3_local4, "xuid" ) + end + f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( "player_name_" .. f2_local17, f3_local5, f2_local6[1], true, LUI.Alignment.Left ) + for f3_local11, f3_local12 in pairs( f0_local0( f3_local3 ) ) do + local f3_local10 = "" + if f3_local4 >= 0 then + f3_local10 = Engine.GetClientMatchData( "players", f3_local4, f3_local12[2] ) + if f3_local3 == "infect" and f3_local12[2] == "extrascore0" then + f3_local10 = CoD.FormatInfectedTime( f3_local10, true ) + elseif (f3_local3 == "dm" or f3_local3 == "sotf_ffa") and f3_local12[2] == "extrascore0" then + f3_local10 = f3_local10 * Engine.GetClientMatchData( "players", f3_local4, "score" ) + end + end + f3_local0[#f3_local0 + 1] = CreateScoreBoardEntryCell( f3_local12[2] .. "_" .. f2_local17, f3_local10, f2_local6[f3_local11 + 1], false ) + end + end + return f3_local0 + end + } + }, + id = "scoreboard_line_" .. f2_local17 + } + end + return f2_local0 +end + +function CreateScoreBoardHeaderCell( f4_arg0, f4_arg1, f4_arg2, f4_arg3 ) + local f4_local0 = { + type = "UIElement", + id = f4_arg0, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f4_arg2 + } + } + } + local f4_local1 = {} + local f4_local2 = { + type = "UIImage", + id = "bkg_1", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -1, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.15 + } + } + } + local f4_local3 = { + type = "UIImage", + id = "bkg_2", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -1, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0, + green = 0, + blue = 0 + } + } + } + local f4_local4 = { + type = "UIImage", + id = "bkg_3" + } + local f4_local5 = {} + local f4_local6 = { + 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 + } + local f4_local7 + if f4_arg3 then + f4_local7 = 0.1 + if not f4_local7 then + + else + f4_local6.alpha = f4_local7 + f4_local5.default = f4_local6 + f4_local4.states = f4_local5 + f4_local5 = { + type = "UIText", + id = "label_text_id", + properties = { + text = f4_arg1 + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -CoD.TextSettings.NormalFont.Height, + bottom = 0, + left = 10, + right = 0, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + red = AAR.Swatch.header_text.r, + green = AAR.Swatch.header_text.g, + blue = AAR.Swatch.header_text.b + } + } + } + f4_local1[1] = f4_local2 + f4_local1[2] = f4_local3 + f4_local1[3] = f4_local4 + f4_local1[4] = f4_local5 + f4_local0.children = f4_local1 + return f4_local0 + end + end + f4_local7 = 0 +end + +function CreateScoreBoardEntryCell( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5 ) + local f5_local0 = { + type = "UIElement", + id = f5_arg0, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f5_arg2 + } + } + } + local f5_local1 = {} + local f5_local2 = {} + local f5_local3 + if f5_arg5 then + f5_local3 = "UIMarqueeText" + if not f5_local3 then + + else + f5_local2.type = f5_local3 + f5_local2.properties = { + text = f5_arg1, + textStyle = CoD.TextStyle.Shadowed + } + f5_local3 = {} + local f5_local4 = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + height = CoD.TextSettings.NormalFont.Height + } + local f5_local5 + if f5_arg4 == LUI.Alignment.Left then + f5_local5 = 5 + if not f5_local5 then + + else + f5_local4.left = f5_local5 + f5_local4.right = -10 + f5_local4.alignment = f5_arg4 or LUI.Alignment.Right + f5_local4.font = CoD.TextSettings.NormalFont.Font + f5_local4.red = Colors.white.r + f5_local4.green = Colors.white.g + f5_local4.blue = Colors.white.b + f5_local3.default = f5_local4 + f5_local2.states = f5_local3 + f5_local1[1] = f5_local2 + f5_local0.children = f5_local1 + return f5_local0 + end + end + f5_local5 = 0 + end + end + f5_local3 = "UIText" +end + +function mp_scoreboard_page() + return { + type = "UIVerticalList", + id = "mp_scoreboard_page_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 1, + right = -1 + } + }, + childrenFeeder = ScoreboardListRowFeeder + } +end + +function mp_scoreboard_main() + return { + type = "UIElement", + id = "mp_scoreboard_main_id", + properties = { + page_idx = 1, + num_pages = 3 + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -AAR.Scoreboard.Layout.Height * 0.5, + bottom = AAR.Scoreboard.Layout.Height * 0.5, + left = -AAR.Layout.Width / 2, + right = AAR.Layout.Width / 2 + } + }, + 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_scoreboard_title_bar_id", + properties = { + title_text = Engine.Localize( "@LUA_MENU_GAME_SUMMARY_CAPS" ), + subtitle_text = Engine.Localize( "@LUA_MENU_SCOREBOARD_CAPS" ) + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "mp_scoreboard_page", + id = "scoreboard_id" + }, + { + type = "aar_footer_bar", + id = "oink_2" + } + } + }, + { + type = "aar_dots", + id = "AARSummaryDotsID", + properties = { + num_dots = MBh.Property( "num_pages" ), + curr_dot = MBh.Property( "page_idx" ) + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "mp_scoreboard_main", mp_scoreboard_main ) +LUI.MenuBuilder.registerDef( "mp_scoreboard_page", mp_scoreboard_page ) +LockTable( _M ) diff --git a/lui/mp_menus/aarsquadsummary.dec.lua b/lui/mp_menus/aarsquadsummary.dec.lua new file mode 100644 index 0000000..73a0b5a --- /dev/null +++ b/lui/mp_menus/aarsquadsummary.dec.lua @@ -0,0 +1,495 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = { + OutcomeTextTop = 90, + TeamInfoMargin = 5, + SeparatorTop = 280, + SeparatorHeight = 1, + SeparatorAlpha = 0.15, + VersusTextTop = 126 +} +f0_local1 = { + Top = 125, + Height = 164, + Width = 360, + Spacing = 10, + TitleBGColor = { + r = 0.1, + g = 0.1, + b = 0.1 + }, + TitleBGHeight = 25, + TitleBGTextMargin = 2 +} +f0_local2 = { + Height = 25, + HorizontalTextMargin = 15, + VerticalTextMargin = 2, + ValueAreaWidth = 125, + SplitImageWidth = 32, + ValueAreaBorder = 2, + PrimaryColor = { + r = 0.1, + g = 0.1, + b = 0.1 + }, + ValueAreaColor = { + r = 0.4, + g = 0.4, + b = 0.4 + } +} +function MatchSummaryCreate( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + local f1_local1 = f1_arg1.controller or f1_local0.exclusiveController + local f1_local2 = SvS.GetCachedPostMatchData() + f1_arg0:processEvent( { + name = "aar_set_subtitle_text", + new_text = Engine.Localize( "LUA_MENU_MODE_AND_MAP_FORMAT", Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "gameMode" ), GameTypesTable.Cols.Name ), Engine.MarkLocalized( Squad.GetRealBaseNameFromLoadName( Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "map" ) ) ) ) + } ) + local f1_local3 = SvS.GetReportOutcomeKeyFromWinLoss( Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "win" ), Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "loss" ) ) + f1_arg0:processEvent( { + name = "set_outcome_text", + text = SvS.GetReportOutcomeText( f1_local3, Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "endReasonTextIndex" ) ), + outcomeKey = f1_local3 + } ) + local f1_local4 = Engine.GetClientMatchData( "alliesScore" ) or 0 + local f1_local5 = Engine.GetClientMatchData( "axisScore" ) or 0 + local f1_local6 = Engine.GetPlayerDataEx( f1_local1, CoD.StatsGroup.Common, "round", "clientMatchIndex" ) or -1 + local f1_local7, f1_local8 = nil + if f1_local6 ~= -1 then + if (Engine.GetClientMatchData( "players", f1_local6, "team" ) or "allies") == "allies" then + f1_local7 = f1_local4 + f1_local8 = f1_local5 + else + f1_local7 = f1_local5 + f1_local8 = f1_local4 + end + else + f1_local7 = 0 + f1_local8 = 0 + DebugPrint( "[WARNING] AARSquadSummary: Attempting to view scoreboard, but clientMatchIndex value is invalid" ) + end + local f1_local9 = f1_arg0:getFirstDescendentById( "aar_squad_summary_your_team_info" ) + local f1_local10 = f1_arg0:getFirstDescendentById( "aar_squad_summary_enemy_team_info" ) + f1_local9:processEvent( { + name = "set_team_score_text", + text = f1_local7 + } ) + f1_local10:processEvent( { + name = "set_team_score_text", + text = f1_local8 + } ) + f1_local10:processEvent( { + name = "update_playercard", + gamertag = f1_local2.enemyName, + clantag = f1_local2.enemyPlayercard.clantag, + rank = f1_local2.enemyPlayercard.rank, + prestige = f1_local2.enemyPlayercard.prestige, + background = f1_local2.enemyPlayercard.background, + patchEmblem = f1_local2.enemyPlayercard.patch + } ) + local f1_local11 = Cac.GetLocalRankedPlayercardInfo( f1_local1 ) + f1_local11.name = "update_playercard" + f1_local11.patchEmblem = f1_local11.patch + f1_local9:processEvent( f1_local11 ) +end + +function CreateScoreBar( f2_arg0 ) + local f2_local0, f2_local1, f2_local2, f2_local3, f2_local4, f2_local5 = nil + if not f2_arg0 then + f2_local0 = LUI.Alignment.Left + f2_local1 = LUI.Alignment.Right + f2_local2 = f0_local1.Width - f0_local2.ValueAreaWidth - f0_local2.SplitImageWidth + f2_local3 = f0_local1.Width - f0_local2.ValueAreaWidth + f2_local4 = f2_local3 + f2_local5 = f2_local4 + f0_local2.ValueAreaWidth - f0_local2.ValueAreaBorder + else + f2_local0 = LUI.Alignment.Right + f2_local1 = LUI.Alignment.Left + f2_local2 = f0_local2.ValueAreaWidth + f0_local2.SplitImageWidth + f2_local3 = f0_local2.ValueAreaWidth + f2_local4 = f0_local2.ValueAreaBorder + f2_local5 = f2_local4 + f0_local2.ValueAreaWidth + f0_local2.ValueAreaBorder + end + return { + type = "UIImage", + id = "team_info_score_bar_bg", + states = { + default = CoD.ColorizeState( f0_local2.PrimaryColor, { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f0_local2.Height + } ) + }, + children = { + { + type = "UIImage", + id = "team_info_score_bar_value_bg", + states = { + default = CoD.ColorizeState( f0_local2.ValueAreaColor, { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f2_local4, + right = f2_local4 + f0_local2.ValueAreaWidth, + top = f0_local2.ValueAreaBorder, + bottom = f0_local2.Height - f0_local2.ValueAreaBorder + } ) + } + }, + { + type = "UIImage", + id = "team_info_score_bar_split_image", + states = { + default = CoD.ColorizeState( f0_local2.ValueAreaColor, { + material = RegisterMaterial( "box_stat_cap" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f2_local2, + right = f2_local3, + top = f0_local2.ValueAreaBorder, + bottom = f0_local2.Height - f0_local2.ValueAreaBorder + } ) + } + }, + { + type = "UIText", + id = "team_info_score_bar_label_text", + properties = { + text = Engine.Localize( "LUA_MENU_SCORE_CAPS" ) + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f0_local2.HorizontalTextMargin, + right = -f0_local2.HorizontalTextMargin, + top = f0_local2.VerticalTextMargin, + bottom = f0_local2.VerticalTextMargin + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = f2_local0 + } ) + } + }, + { + type = "UIText", + id = "team_info_score_bar_value_text", + handlers = { + set_team_score_text = function ( f3_arg0, f3_arg1 ) + f3_arg0:setText( f3_arg1.text ) + end + + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f0_local2.HorizontalTextMargin, + right = -f0_local2.HorizontalTextMargin, + top = f0_local2.VerticalTextMargin, + bottom = f0_local2.VerticalTextMargin + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = f2_local1 + } ) + } + } + } + } +end + +function aar_squad_summary_main() + return { + type = "UIElement", + id = "aar_squad_summary_main_container", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -395, + right = 395, + top = -170, + bottom = 170 + } + }, + properties = { + page_idx = 1, + num_pages = 3 + }, + 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 = "UIText", + id = "aar_squad_summary_outcome_text", + properties = { + textStyle = CoD.TextStyle.Outlined + }, + handlers = { + set_outcome_text = function ( f5_arg0, f5_arg1 ) + f5_arg0:setText( f5_arg1.text ) + f5_arg0:animateToState( f5_arg1.outcomeKey ) + end + + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = f0_local0.OutcomeTextTop, + bottom = f0_local0.OutcomeTextTop + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center + }, + Victory = CoD.ColorizeState( SvS.Reports.MatchOutcomeColors.Victory.textColor, {} ), + Defeat = CoD.ColorizeState( SvS.Reports.MatchOutcomeColors.Defeat.textColor, {} ), + Draw = CoD.ColorizeState( SvS.Reports.MatchOutcomeColors.Draw.textColor, {} ) + } + }, + { + type = "aar_squad_summary_team_info", + id = "aar_squad_summary_your_team_info", + handlers = { + set_your_team_info = function ( f6_arg0, f6_arg1 ) + + end + + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f0_local0.TeamInfoMargin, + right = f0_local0.TeamInfoMargin + f0_local1.Width, + top = f0_local1.Top, + bottom = f0_local1.Top + f0_local1.Height, + spacing = f0_local1.Spacing + } + } + }, + { + type = "aar_squad_summary_team_info", + id = "aar_squad_summary_enemy_team_info", + properties = { + isEnemy = true + }, + handlers = { + set_your_team_info = function ( f7_arg0, f7_arg1 ) + + end + + }, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -f0_local0.TeamInfoMargin - f0_local1.Width, + right = -f0_local0.TeamInfoMargin, + top = f0_local1.Top, + bottom = f0_local1.Top + f0_local1.Height, + spacing = f0_local1.Spacing + } + } + }, + { + type = "UIText", + id = "aar_squad_summary_vs_text", + properties = { + text = Engine.Localize( "LUA_MENU_VERSUS" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = f0_local0.VersusTextTop, + bottom = f0_local0.VersusTextTop + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center + } + } + }, + { + type = "aar_footer_bar", + id = "oink_3" + } + } + } +end + +function TeamInfoChildrenFeeder( f8_arg0 ) + local f8_local0 = f8_arg0.exclusiveController + local f8_local1 = SvS.GetCachedPostMatchData() + local f8_local2 = f8_arg0.isEnemy + if not f8_local0 then + f8_local0 = Engine.GetFirstActiveController() + DebugPrint( "[WARNING] AARSquadSummary: using controller index 0, this is only ok if you are editing a menu" ) + end + local f8_local3, f8_local4 = nil + if f8_local2 then + f8_local3 = f8_local1.enemySquadName or "" + else + f8_local3 = Squad.GetPlayerSquadName( f8_local0 ) or "" + end + local f8_local5 = { + [#f8_local5 + 1] = { + type = "UIImage", + id = "team_info_title_bg", + states = { + default = CoD.ColorizeState( f0_local1.TitleBGColor, { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f0_local1.TitleBGHeight + } ) + }, + children = { + { + type = "UIText", + id = "team_info_title_text", + properties = { + text = Engine.Localize( "LUA_MENU_SQUAD_LABEL", Engine.MarkLocalized( f8_local3 ) ) + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = f0_local1.TitleBGTextMargin, + bottom = f0_local1.TitleBGTextMargin + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center + } ) + } + } + } + }, + [#f8_local5 + 1] = { + type = "playercard", + id = "team_info_playercard", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -13, + left = -13, + height = 90, + width = 100, + scale = -0.17 + } + } + }, + [#f8_local5 + 1] = CreateScoreBar( f8_arg0.isEnemy ) + } + return f8_local5 +end + +function aar_squad_summary_team_info() + return { + type = "UIVerticalList", + id = "team_info_list", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + spacing = 10 + } + }, + childrenFeeder = TeamInfoChildrenFeeder + } +end + +LUI.MenuBuilder.registerDef( "aar_squad_summary_main", aar_squad_summary_main ) +LUI.MenuBuilder.registerDef( "aar_squad_summary_team_info", aar_squad_summary_team_info ) +LockTable( _M ) diff --git a/lui/mp_menus/aarsummary.dec.lua b/lui/mp_menus/aarsummary.dec.lua new file mode 100644 index 0000000..4470be8 --- /dev/null +++ b/lui/mp_menus/aarsummary.dec.lua @@ -0,0 +1,1388 @@ +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 ) diff --git a/lui/mp_menus/aarunlockscreen.dec.lua b/lui/mp_menus/aarunlockscreen.dec.lua new file mode 100644 index 0000000..6f7b123 --- /dev/null +++ b/lui/mp_menus/aarunlockscreen.dec.lua @@ -0,0 +1,860 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +UnlockIconSizesByType = { + Patch = { + height = 128, + width = 128 + }, + Patchbacking = { + height = 128, + width = 128 + }, + Background = { + height = 35, + width = 220 + }, + Head = { + height = 128, + width = 128 + }, + Helmet = { + height = 128, + width = 128 + }, + Body = { + height = 128, + width = 128 + }, + AlienPerk = { + height = 64, + width = 64 + }, + AlienAbility = { + height = 64, + width = 64 + }, + AlienPrestige = { + height = 128, + width = 128 + }, + Prestige = { + height = 128, + width = 128 + }, + perk = { + height = 64, + width = 64 + }, + camo = { + height = 128, + width = 128 + }, + reticle = { + height = 128, + width = 128 + } +} +function UnlockedItemsFeeder( f1_arg0 ) + local f1_local0 = f1_arg0.unlockData + local f1_local1 = f1_arg0.curr_page + local f1_local2 = AAR.NumUnlocksPerPage + local f1_local3 = 1 + (f1_local1 - 1) * f1_local2 + local f1_local4 = f1_local3 + f1_local2 - 1 + local f1_local5 = {} + for f1_local6 = f1_local3, f1_local4, 1 do + if f1_local0[f1_local6] and UnlockIconSizesByType[f1_local0[f1_local6].type] then + local f1_local9 = nil + local f1_local10 = "" + local f1_local11 = "" + local f1_local12 = 0 + local f1_local13 = "" + local f1_local14 = "" + local f1_local15, f1_local16, f1_local17 = nil + local f1_local18 = false + if isUnlockItem( f1_local0[f1_local6].type ) then + if f1_local0[f1_local6].type == "Patch" then + f1_local10 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch].GetQuip( f1_local0[f1_local6].item ) + else + f1_local10 = getNameForUnlockItem( f1_local0[f1_local6].type, f1_local0[f1_local6].item ) + end + f1_local9 = getMaterialForUnlockItem( f1_local0[f1_local6].type, f1_local0[f1_local6].item ) + f1_local11 = f1_local0[f1_local6].ch_desc + elseif f1_local0[f1_local6].type == "AlienPerk" then + local f1_local19 = LUI.mp_menus.Aliens.GetFieldForPerk( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienPerks.Cols.Category ) + f1_local15 = Colors.alien_frontend_hilite.r + f1_local16 = Colors.alien_frontend_hilite.g + f1_local17 = Colors.alien_frontend_hilite.b + f1_local10 = LUI.mp_menus.Aliens.GetFieldForPerk( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienPerks.Cols.Name ) + f1_local9 = LUI.mp_menus.Aliens.GetFieldForPerk( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienPerks.Cols.Icon ) + f1_local11 = Engine.Localize( LUI.mp_menus.Aliens.GetFieldForPerk( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienPerks.Cols.Desc ) ) + f1_local13 = Engine.Localize( "@" .. tostring( f1_local19 ) ) + f1_local12 = 1 + elseif f1_local0[f1_local6].type == "AlienAbility" then + local f1_local19 = LUI.mp_menus.Aliens.GetFieldForAbility( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienAbilities.Cols.Category ) + f1_local15 = Colors.alien_frontend_hilite.r + f1_local16 = Colors.alien_frontend_hilite.g + f1_local17 = Colors.alien_frontend_hilite.b + f1_local10 = LUI.mp_menus.Aliens.GetFieldForAbility( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienAbilities.Cols.Name ) + f1_local9 = LUI.mp_menus.Aliens.GetFieldForAbility( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienAbilities.Cols.Icon ) + f1_local11 = Engine.Localize( LUI.mp_menus.Aliens.GetFieldForAbility( f1_local0[f1_local6].item, LUI.mp_menus.Aliens.AlienAbilities.Cols.Desc ) ) + f1_local13 = Engine.Localize( "@" .. tostring( f1_local19 ) ) + f1_local12 = 1 + elseif f1_local0[f1_local6].type == "perk" then + local f1_local19 = Cac.GetPerkGroup( f1_local0[f1_local6].item ) + local f1_local20 = tonumber( Engine.TableLookup( "mp/squadUnlockTable.csv", 0, f1_local0[f1_local6].item, 2 ) ) + f1_local14 = tostring( Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f1_local0[f1_local6].item, PerkTable.Cols.Cost ) ) + f1_local15 = Colors.cac_ability[f1_local19].r + f1_local16 = Colors.cac_ability[f1_local19].g + f1_local17 = Colors.cac_ability[f1_local19].b + f1_local10 = Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f1_local0[f1_local6].item, PerkTable.Cols.Name ) + f1_local9 = Cac.GetPerkImage( f1_local0[f1_local6].item ) + f1_local11 = Engine.Localize( "@LUA_MENU_AAR_NEW_PERK_UNLOCKS", f1_local20 ) + f1_local13 = Cac.GetAbilityName( f1_local19 ) + f1_local12 = 1 + elseif f1_local0[f1_local6].type == "AlienPrestige" then + f1_local10 = Engine.Localize( "@ALIENS_RELIC_SLOT" ) + f1_local18 = true + f1_local9 = "alien_icon_nerf_1" + f1_local11 = Engine.Localize( "@ALIENS_NEW_RELIC_SLOT_DESC" ) + elseif f1_local0[f1_local6].type == "Prestige" then + f1_local10 = Engine.Localize( "@LUA_MENU_PRESTIGE_ICON" ) + f1_local18 = true + f1_local9 = Rank.GetRankIcon( Rank.GetMaxRank(), f1_local0[f1_local6].item ) + elseif f1_local0[f1_local6].type == "camo" then + f1_local10 = Cac.GetWeaponName( f1_local0[f1_local6].weapon ) + f1_local18 = true + f1_local11 = f1_local0[f1_local6].ch_desc + f1_local9 = Cac.GetCamoImage( f1_local0[f1_local6].item ) + elseif f1_local0[f1_local6].type == "reticle" then + f1_local10 = Cac.GetAttachmentName( f1_local0[f1_local6].sight ) + f1_local18 = true + f1_local11 = f1_local0[f1_local6].ch_desc + f1_local9 = Cac.GetReticleImage( f1_local0[f1_local6].item ) + end + local f1_local19 = #f1_local5 + 1 + local f1_local20 = { + type = "aar_unlocked_item" + } + local f1_local21 = {} + if f1_local18 then + local f1_local22 = f1_local10 + end + f1_local21.item_name = f1_local22 or Engine.Localize( f1_local10 ) + f1_local21.item_icon = RegisterMaterial( f1_local9 ) + f1_local21.icon_width = UnlockIconSizesByType[f1_local0[f1_local6].type].width + f1_local21.icon_height = UnlockIconSizesByType[f1_local0[f1_local6].type].height + f1_local21.item_detail_1 = f1_local11 + f1_local21.perk_container_alpha = f1_local12 + f1_local21.perk_category = f1_local13 + f1_local21.perk_cost = f1_local14 + f1_local21.perk_tint_r = f1_local15 + f1_local21.perk_tint_g = f1_local16 + f1_local21.perk_tint_b = f1_local17 + f1_local20.properties = f1_local21 + f1_local5[f1_local19] = f1_local20 + end + end + return f1_local5 +end + +f0_local0 = function ( f2_arg0 ) + local f2_local0 = 0 + if f2_arg0.detail_text ~= "" then + f2_local0 = 1 + end + return f2_local0 +end + +function aar_unlocked_item() + return { + type = "UIElement", + properties = { + item_name = "", + item_icon = RegisterMaterial( "white" ), + item_detail_1 = "", + icon_width = 256, + icon_height = 128, + perk_container_alpha = 0, + perk_category = "", + perk_cost = "", + perk_tint_r = Colors.white.r, + perk_tint_g = Colors.white.g, + perk_tint_b = Colors.white.b + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 226, + left = 0, + right = 226 + } + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = -5 + } + }, + { + type = "cac_edit_choose_image_button_background", + properties = { + red = AAR.Swatch.background_5.r, + green = AAR.Swatch.background_5.g, + blue = AAR.Swatch.background_5.b, + alpha = 1 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + }, + { + type = "cac_edit_choose_image_button_background_outline", + properties = { + red = AAR.Swatch.border.r, + green = AAR.Swatch.border.g, + blue = AAR.Swatch.border.b, + alpha = 0.4 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -32, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = 150, + height = 130, + alpha = MBh.Property( "perk_container_alpha" ) + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "box_white_gradient_top" ), + red = MBh.Property( "perk_tint_r" ), + green = MBh.Property( "perk_tint_g" ), + blue = MBh.Property( "perk_tint_b" ), + alpha = 0.15 + } + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = 16, + height = 16, + material = RegisterMaterial( "widg_triangle" ), + red = MBh.Property( "perk_tint_r" ), + green = MBh.Property( "perk_tint_g" ), + blue = MBh.Property( "perk_tint_b" ), + alpha = 0.5 + } + } + }, + { + type = "UIMarqueeText", + properties = { + text = MBh.Property( "perk_category" ) + }, + states = { + default = CoD.ColorizeState( AAR.Swatch.title, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 10, + right = -10, + top = 5, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) + } + }, + { + type = "UIText", + properties = { + text = MBh.Property( "perk_cost" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = CoD.ColorizeState( AAR.Swatch.title_2, { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 5, + right = 0, + bottom = 0, + height = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left + } ) + } + } + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = MBh.HalfOppositeProperty( "icon_width" ), + right = MBh.HalfProperty( "icon_width" ), + top = MBh.HalfOppositeProperty( "icon_height" ), + bottom = MBh.HalfProperty( "icon_height" ), + material = MBh.Property( "item_icon" ) + } + } + } + } + }, + { + type = "UIElement", + id = "HeaderBarId", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + left = 0, + right = 0, + height = 32 + } + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( AAR.Swatch.border, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -2, + left = 2, + right = -2, + alpha = 0.4 + } ) + } + }, + { + type = "UIMarqueeText", + properties = { + text = MBh.Property( "item_name" ) + }, + states = { + default = CoD.ColorizeState( AAR.Swatch.header_text, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 5, + right = -5, + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center + } ) + } + } + } + }, + { + type = "UIMarqueeText", + id = "desc_text_id", + properties = { + text = MBh.Property( "item_detail_1" ), + useTextWrapping = true, + textHeight = CoD.TextSettings.NormalFont.Height + }, + states = { + default = CoD.ColorizeState( AAR.Swatch.trim, { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 5, + right = -5, + top = 5, + height = 3 * CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) + } + } + } + } +end + +function changeUnlocksScreen( f4_arg0, f4_arg1, f4_arg2 ) + local f4_local0 = f4_arg0.properties.curr_page + local f4_local1 = f4_arg0.properties.num_pages + local f4_local2 = f4_local0 + if f4_local0 > 1 and f4_arg2 == "left" then + f4_local2 = f4_local0 - 1 + elseif f4_local0 < f4_local1 and f4_arg2 == "right" then + f4_local2 = f4_local0 + 1 + end + if f4_local2 ~= f4_local0 then + f4_arg0.properties.curr_page = f4_local2 + local f4_local3 = f4_arg0:getParent() + f4_local3:processEvent( { + name = "refresh_unlocks_page" + } ) + end + if f4_local1 <= f4_local2 then + f4_arg0:dispatchEventToRoot( { + name = "disable_unlock_right_arrow" + } ) + else + f4_arg0:dispatchEventToRoot( { + name = "enable_unlock_right_arrow" + } ) + end + if f4_local2 <= 1 then + f4_arg0:dispatchEventToRoot( { + name = "disable_unlock_left_arrow" + } ) + else + f4_arg0:dispatchEventToRoot( { + name = "enable_unlock_left_arrow" + } ) + end +end + +function dotsFeeder( f5_arg0 ) + local f5_local0 = f5_arg0.curr_page + local f5_local1 = f5_arg0.num_pages + if f5_local1 <= 1 then + return {} + end + local f5_local2 = {} + for f5_local3 = 1, f5_local1, 1 do + local f5_local6 = #f5_local2 + 1 + local f5_local7 = { + type = "UIImage", + id = "nav_dot_" .. f5_local3 + } + local f5_local8 = {} + local f5_local9 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 12, + top = 0, + bottom = 12 + } + local f5_local10 + if f5_local3 == f5_local0 then + f5_local10 = RegisterMaterial( "widg_circle_fill" ) + if not f5_local10 then + + else + f5_local9.material = f5_local10 + f5_local8.default = f5_local9 + f5_local7.states = f5_local8 + f5_local2[f5_local6] = f5_local7 + end + end + f5_local10 = RegisterMaterial( "widg_circle_empty" ) + end + return f5_local2 +end + +function UnlockMainHandleCreate( f6_arg0, f6_arg1 ) + assert( f6_arg0.properties.unlockData ) + local f6_local0 = f6_arg0.properties.unlockData + local f6_local1 = f6_arg0:getChildById( "num_items_unlocked" ) + if f6_local1 then + if #f6_local0 > 1 then + f6_local1:setText( Engine.Localize( "@LUA_MENU_NUM_ITEMS_UNLOCKED", #f6_local0 ) ) + else + f6_local1:setText( Engine.Localize( "@LUA_MENU_NUM_ITEM_UNLOCKED", #f6_local0 ) ) + end + end + changeUnlocksScreen( f6_arg0, f6_arg1, "left" ) + local f6_local2 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aar_summary_main" ) + local f6_local3 = f6_local2.controller + local f6_local4 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, Engine.GetPlayerDataEx( f6_local3, CoD.StatsGroup.Common, "round", "gameMode" ), GameTypesTable.Cols.Name ) + local f6_local5 = Engine.GetPlayerDataEx( f6_local3, CoD.StatsGroup.Common, "round", "map" ) + local f6_local6 = Squad.GetRealBaseNameFromLoadName( f6_local5 ) + if Engine.IsAliensMode() then + f6_arg0:processEvent( { + name = "aar_set_subtitle_text", + new_text = Engine.Localize( "LUA_MENU_ALIENS" ) + } ) + elseif f6_local5 ~= "" then + f6_arg0:processEvent( { + name = "aar_set_subtitle_text", + new_text = Engine.Localize( "LUA_MENU_MODE_AND_MAP_FORMAT", f6_local4, Engine.MarkLocalized( f6_local6 ) ), + dispatchChildren = true + } ) + end +end + +function aar_unlock_main() + return { + type = "UIElement", + id = "main_container", + properties = { + curr_page = 1, + num_pages = 1 + }, + handlers = { + menu_create = UnlockMainHandleCreate, + nav_right = function ( f8_arg0, f8_arg1 ) + changeUnlocksScreen( f8_arg0, f8_arg1, "right" ) + end + , + nav_left = function ( f9_arg0, f9_arg1 ) + changeUnlocksScreen( f9_arg0, f9_arg1, "left" ) + end + + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = AAR.Layout.Width, + height = AAR.Layout.Height + } + }, + children = { + { + type = "generic_menu_background", + id = "kinect_background_id", + properties = { + fill_alpha = 1, + border_alpha = 0 + } + }, + { + type = "aar_title_bar", + properties = { + title_text = Engine.Localize( "@LUA_MENU_UNLOCKS_CAPS" ), + subtitle_text = "", + subtitle_banner_width = 300, + border_alpha = 0 + } + }, + { + type = "UIText", + id = "num_items_unlocked", + properties = { + text = Engine.Localize( "@LUA_MENU_NEW_ITEMS" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 95, + left = 0, + right = 0, + height = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or AAR.Swatch.colorpop.r, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or AAR.Swatch.colorpop.g, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or AAR.Swatch.colorpop.b + } + } + }, + { + type = "UIHorizontalList", + id = "unlock_items_row", + focusable = false, + childrenFeeder = UnlockedItemsFeeder, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -100, + left = 0, + right = 0, + height = 260, + alignment = LUI.Alignment.Center, + spacing = 30 + } + }, + handlers = { + refresh_unlocks_page = function ( f10_arg0, f10_arg1 ) + f10_arg0:closeChildren() + f10_arg0:processEvent( { + name = "menu_refresh" + } ) + end + + } + }, + { + type = "UIHorizontalList", + id = "page_dots", + focusable = false, + childrenFeeder = dotsFeeder, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 67, + left = -100, + right = 100, + height = 12, + alignment = LUI.Alignment.Center, + alpha = 1, + spacing = 4 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + refresh_unlocks_page = function ( f11_arg0, f11_arg1 ) + f11_arg0:closeChildren() + f11_arg0:processEvent( { + name = "menu_refresh" + } ) + end + + } + }, + { + type = "aar_footer_bar", + id = "oink_5" + }, + { + type = "UIBindButton", + id = "aar_summary_main_bind_btn_id", + handlers = { + button_right = aar_unlock_right, + button_left = aar_unlock_left + } + }, + { + type = "aar_unlock_nav_arrows", + id = "aar_unlock_nav_arrows_id" + } + } + } +end + +function aar_unlock_left( f12_arg0, f12_arg1 ) + f12_arg0:dispatchEventToRoot( { + name = "nav_left" + } ) +end + +function aar_unlock_right( f13_arg0, f13_arg1 ) + f13_arg0:dispatchEventToRoot( { + name = "nav_right" + } ) +end + +function aar_unlock_nav_arrows() + return { + type = "UIElement", + focusable = true, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -30, + bottom = 30, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + popup_active = MBh.AnimateToState( "hidden" ), + popup_inactive = MBh.AnimateToState( "default" ) + }, + children = { + { + type = "UIButton", + id = "left_nav_arrow_button_id", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = AAR.Layout.Width / -2 - 10 - 30, + right = AAR.Layout.Width / -2 - 10, + top = 0, + bottom = 0 + } + }, + handlers = { + button_action = aar_unlock_left + }, + children = { + { + type = "UIImage", + id = "left_nav_arrow_image_id", + states = { + default = { + material = RegisterMaterial( "widg_margin_arrow_lt" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b, + alpha = 0 + }, + bright = { + alpha = 1 + } + }, + handlers = { + disable_unlock_left_arrow = MBh.AnimateToState( "default", 0 ), + enable_unlock_left_arrow = MBh.AnimateToState( "bright", 0 ) + } + } + } + }, + { + type = "UIButton", + id = "right_nav_arrow_button_id", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = AAR.Layout.Width / 2 + 10, + right = AAR.Layout.Width / 2 + 10 + 30, + top = 0, + bottom = 0 + } + }, + handlers = { + button_action = aar_unlock_right + }, + children = { + { + type = "UIImage", + id = "right_nav_arrow_image_id", + states = { + default = { + material = RegisterMaterial( "widg_margin_arrow_rt" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b, + alpha = 0 + }, + bright = { + alpha = 1 + } + }, + handlers = { + disable_unlock_right_arrow = MBh.AnimateToState( "default", 0 ), + enable_unlock_right_arrow = MBh.AnimateToState( "bright", 0 ) + } + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "aar_unlock_nav_arrows", aar_unlock_nav_arrows ) +LUI.MenuBuilder.registerDef( "aar_unlock_main", aar_unlock_main ) +LUI.MenuBuilder.registerDef( "aar_unlocked_item", aar_unlocked_item ) +LockTable( _M ) diff --git a/lui/mp_menus/aarutils.dec.lua b/lui/mp_menus/aarutils.dec.lua new file mode 100644 index 0000000..85be75c --- /dev/null +++ b/lui/mp_menus/aarutils.dec.lua @@ -0,0 +1,153 @@ +AAR = { + Layout = { + TitleBarHeight = 33, + SubTitleBarHeight = 31, + SubTitleBannerWidth = 180, + SubTitleCapWidth = 20, + FooterHeight = 38, + Width = 800, + Height = 490 + }, + Scoreboard = { + Layout = { + Height = 614 + }, + NumRows = 18 + }, + Arrow = { + Width = 32, + Height = 64 + }, + Progress = { + Layout = { + Height = 453 + } + }, + NumUnlocksPerPage = 3, + Swatch = { + title = Colors.primary_text_color, + title_2 = Colors.secondary_text_color, + background = Colors.grey_14, + background_2 = Colors.grey_22, + background_3 = Colors.grey_4, + background_4 = { + r = 0.12, + g = 0.12, + b = 0.12 + }, + background_5 = Colors.very_dark_cyan, + trim = Colors.grey_4, + subtext = Colors.grey_4, + colorpop = Colors.frontend_hilite, + progressborder = Colors.white, + header_text = Colors.white, + spacer_1 = Colors.grey_2, + friendly = Colors.cyan, + enemy = Colors.orange, + border = Colors.window_border_color + } +} +AwardsTable = { + File = "mp/awardTable.csv", + Cols = { + Ref = 1, + Icon = 2, + Name = 3, + Desc = 4 + } +} +FactionTable = { + File = "mp/factionTable.csv", + Cols = { + Ref = 0, + ColorRed = 14, + ColorGreen = 15, + ColorBlue = 16 + } +} +AAR.GetFactionColorRed = function ( f1_arg0 ) + return Engine.TableLookup( FactionTable.File, FactionTable.Cols.Ref, f1_arg0, FactionTable.Cols.ColorRed ) +end + +AAR.GetFactionColorGreen = function ( f2_arg0 ) + return Engine.TableLookup( FactionTable.File, FactionTable.Cols.Ref, f2_arg0, FactionTable.Cols.ColorGreen ) +end + +AAR.GetFactionColorBlue = function ( f3_arg0 ) + return Engine.TableLookup( FactionTable.File, FactionTable.Cols.Ref, f3_arg0, FactionTable.Cols.ColorBlue ) +end + +AAR.GetRoundSquadMember = function ( f4_arg0 ) + return Engine.GetPlayerDataEx( f4_arg0, CoD.StatsGroup.Common, "round", "squadMemberIndex" ) +end + +AAR.GetRoundOperationsXP = function ( f5_arg0 ) + return Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Common, "round", "operationXp" ) or 0 +end + +AAR.GetRoundMatchXP = function ( f6_arg0 ) + return Engine.GetPlayerDataEx( f6_arg0, CoD.StatsGroup.Common, "round", "matchXp" ) or 0 +end + +AAR.GetRoundMiscXP = function ( f7_arg0 ) + return Engine.GetPlayerDataEx( f7_arg0, CoD.StatsGroup.Common, "round", "miscXp" ) or 0 +end + +AAR.GetRoundScoreXP = function ( f8_arg0 ) + return Engine.GetPlayerDataEx( f8_arg0, CoD.StatsGroup.Common, "round", "scoreXp" ) or 0 +end + +AAR.GetRoundChallengeXP = function ( f9_arg0 ) + return Engine.GetPlayerDataEx( f9_arg0, CoD.StatsGroup.Common, "round", "challengeXp" ) or 0 +end + +AAR.GetRoundDoubleXP = function ( f10_arg0 ) + return Engine.GetPlayerDataReservedInt( f10_arg0, CoD.StatsGroup.Common, "common_entitlement_xp" ) or 0 +end + +AAR.GetRoundClanXP = function ( f11_arg0 ) + return Engine.GetPlayerDataReservedInt( f11_arg0, CoD.StatsGroup.Common, "common_clan_wars_xp" ) or 0 +end + +AAR.GetTotalUnlockPoints = function ( f12_arg0 ) + return Engine.GetPlayerDataEx( f12_arg0, CoD.StatsGroup.Ranked, "unlockPoints" ) or 0 +end + +AAR.GetRoundTotalXP = function ( f13_arg0 ) + return Engine.GetPlayerDataEx( f13_arg0, CoD.StatsGroup.Common, "round", "totalXp" ) or 0 +end + +AAR.GetCareerExperienceForSquadMember = function ( f14_arg0, f14_arg1 ) + return Engine.GetPlayerDataEx( f14_arg0, CoD.StatsGroup.Ranked, "squadMembers", f14_arg1, "squadMemXP" ) or 0 +end + +AAR.GetNumAwards = function ( f15_arg0 ) + return Engine.GetPlayerDataEx( f15_arg0, CoD.StatsGroup.Common, "round", "awardCount" ) +end + +AAR.GetAccolade = function ( f16_arg0, f16_arg1 ) + return Engine.GetPlayerDataEx( f16_arg0, CoD.StatsGroup.Common, "round", "awards", f16_arg1, "award" ) +end + +AAR.GetAwardIcon = function ( f17_arg0 ) + return Engine.TableLookup( AwardsTable.File, AwardsTable.Cols.Ref, f17_arg0, AwardsTable.Cols.Icon ) +end + +AAR.GetAwardName = function ( f18_arg0 ) + return Engine.TableLookup( AwardsTable.File, AwardsTable.Cols.Ref, f18_arg0, AwardsTable.Cols.Name ) +end + +AAR.GetAwardDesc = function ( f19_arg0 ) + return Engine.TableLookup( AwardsTable.File, AwardsTable.Cols.Ref, f19_arg0, AwardsTable.Cols.Desc ) +end + +AAR.AreChaosStats = function ( f20_arg0 ) + if not Engine.IsAliensMode() then + return false + elseif f20_arg0 == "mugger" then + return true + else + return false + end +end + diff --git a/lui/mp_menus/aliens.dec.lua b/lui/mp_menus/aliens.dec.lua new file mode 100644 index 0000000..4a57dce --- /dev/null +++ b/lui/mp_menus/aliens.dec.lua @@ -0,0 +1,1237 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +DebugPrint( "Registering " .. _NAME ) +function InitGameTypeToAliens() + MatchRules.SetData( "gametype", "aliens" ) + MatchRules.LoadMatchRulesDataDefault() +end + +function AliensRunConfig( f2_arg0 ) + assert( Engine.IsAliensMode(), "Running Aliens Config when not in aliens mode\n" ) + if Engine.IsAliensMode() then + Engine.Exec( MPConfig.default_aliens, f2_arg0 ) + end +end + +function IsChaosMode() + assert( not Engine.InFrontend() ) + return Game.GetOmnvar( "ui_alien_chaos" ) +end + +function FixGameModeTextForChaos( f4_arg0 ) + if Engine.IsAliensMode() and LUI.mp_menus.Aliens.IsChaosEnabled() then + f4_arg0 = Engine.Localize( "@ALIENS_CHAOS_MODE" ) + end + return f4_arg0 +end + +AliensMemberListSpacing = 34 +AlienPerks = { + File = "mp/alien/perks_tree.csv", + Cols = { + Idx = 0, + Ref = 1, + UnlockedAtRank = 2, + PointCost = 3, + Name = 4, + Desc = 5, + Icon = 6, + IsUpgrade = 7, + Category = 8, + TokenUpgradeName = 9 + }, + MaxPerks = 100 +} +AlienNerfs = { + File = "mp/alien/prestige_nerf.csv", + Cols = { + Idx = 0, + Ref = 1, + UnlockedAtRank = 2, + Name = 3, + Desc = 4, + Icon = 5, + IsUpgrade = 6 + }, + MaxNerfs = 100, + AlienNerfSlots = 5 +} +AlienAbilities = { + File = "mp/alien/dpad_tree.csv", + FileAlt = "mp/alien/dpad_tree_beacon.csv", + Cols = { + Idx = 0, + Ref = 1, + UnlockedAtRank = 2, + PointCost = 3, + CurrencyCost = 4, + Name = 5, + Desc = 6, + Icon = 7, + DpadIcon = 8, + IsUpgrade = 9, + Category = 10 + }, + MaxAbilities = 100, + Up = 0, + Down = 100, + Left = 200, + Right = 300, + Types = { + "munition", + "support", + "offense", + "defense" + } +} +AlienCraftingItems = { + File = "mp/alien/crafting_items.csv", + Cols = { + Idx = 0, + Ref = 1, + Name = 2, + Icon = 3 + }, + MaxItems = 100 +} +AlienCraftingRecipes = { + File = "mp/alien/crafting_items.csv", + Cols = { + Idx = 0, + Ref = 1, + Slot1Material = 2, + Slot2Material = 3, + Slot3Material = 4, + Slot4Material = 5 + }, + MaxItems = 100 +} +AlienRanks = { + File = "mp/alien/rankTable.csv", + Cols = { + Idx = 0, + Rank = 1, + MinXP = 2, + XPToNext = 3, + ShortRank = 4, + FullRank = 5, + Icon = 6, + MaxXP = 7, + WeaponUnlock = 8, + PerkUnlock = 9, + Challenge = 10, + Camo = 11, + Attachment = 12, + Level = 13, + DisplayLevel = 14, + FeatureUnlock = 15, + IngameRank = 16, + UnlockString = 17 + }, + MaxLevel = 29, + MaxPrestige = 25, + SuperMaxLevel = 30 +} +AlienRankIcons = { + File = "mp/alien/rankIconTable.csv", + Cols = { + PrestigeItems = 0, + PrestigeValues = 1 + }, + Rows = { + MaxPrestige = "maxprestige", + PrestigeDiscount = "prestigediscount" + } +} +function GetDataLabelForSlot( f5_arg0 ) + if f5_arg0 == AlienAbilities.Up then + return "munition" + elseif f5_arg0 == AlienAbilities.Down then + return "support" + elseif f5_arg0 == AlienAbilities.Left then + return "defense" + elseif f5_arg0 == AlienAbilities.Right then + return "offense" + else + assert( false, "Invalid Action Slot: Valid options are AlienAbilities.Up, AlienAbilities.Down, AlienAbilities.Left, AlienAbilities.Right" ) + end +end + +function GetDataLabelForPerk( f6_arg0 ) + return "perk_" .. f6_arg0 +end + +function GetBasePerkList( f7_arg0 ) + local f7_local0 = assert + local f7_local1 + if f7_arg0 ~= 0 and f7_arg0 ~= 1 then + f7_local1 = false + else + f7_local1 = true + end + f7_local0( f7_local1, "Invalid Perk Slot" ) + if f7_arg0 == 0 then + f7_local0 = 0 + if not f7_local0 then + + else + f7_local1 = f7_local0 + AlienPerks.MaxPerks - 1 + local f7_local2 = {} + for f7_local3 = f7_local0, f7_local1, 1 do + local f7_local6 = Engine.TableLookup( AlienPerks.File, AlienPerks.Cols.Idx, tostring( f7_local3 ), AlienPerks.Cols.Ref ) + if f7_local6 == "" then + break + elseif GetFieldForPerk( f7_local6, AlienPerks.Cols.IsUpgrade ) == "0" then + f7_local2[#f7_local2 + 1] = f7_local6 + end + end + return f7_local2 + end + end + f7_local0 = 100 +end + +function GetBaseNerfList() + local f8_local0 = 0 + local f8_local1 = 50 + local f8_local2 = {} + for f8_local3 = f8_local0, f8_local1, 1 do + local f8_local6 = Engine.TableLookup( AlienNerfs.File, AlienNerfs.Cols.Idx, tostring( f8_local3 ), AlienNerfs.Cols.Ref ) + if f8_local6 == "" then + break + end + f8_local2[#f8_local2 + 1] = f8_local6 + end + return f8_local2 +end + +function GetBaseAbilityListForActionSlot( f9_arg0 ) + local f9_local0 = assert + local f9_local1 + if f9_arg0 ~= AlienAbilities.Up and f9_arg0 ~= AlienAbilities.Down and f9_arg0 ~= AlienAbilities.Left and f9_arg0 ~= AlienAbilities.Right then + f9_local1 = false + else + f9_local1 = true + end + f9_local0( f9_local1, "Invalid Action Slot: Valid options are AlienAbilities.Up, AlienAbilities.Down, AlienAbilities.Left, AlienAbilities.Right" ) + f9_local0 = {} + f9_local1 = f9_arg0 + local f9_local2 = f9_arg0 + AlienAbilities.MaxAbilities - 1 + local f9_local3 = Engine.GetDvarString( "ui_mapname" ) + for f9_local4 = f9_local1, f9_local2, 1 do + local f9_local7 = "" + if f9_local3 == "mp_alien_beacon" or f9_local3 == "mp_alien_dlc3" or f9_local3 == "mp_alien_last" then + f9_local7 = Engine.TableLookup( AlienAbilities.FileAlt, AlienAbilities.Cols.Idx, tostring( f9_local4 ), AlienAbilities.Cols.Ref ) + else + f9_local7 = Engine.TableLookup( AlienAbilities.File, AlienAbilities.Cols.Idx, tostring( f9_local4 ), AlienAbilities.Cols.Ref ) + end + if f9_local7 == "" then + break + elseif GetFieldForAbility( f9_local7, AlienAbilities.Cols.IsUpgrade ) == "0" then + f9_local0[#f9_local0 + 1] = f9_local7 + end + end + return f9_local0 +end + +function GetFieldForPerk( f10_arg0, f10_arg1 ) + local f10_local0 = assert + local f10_local1 + if f10_arg1 < AlienPerks.Cols.Idx or f10_arg1 > AlienPerks.Cols.TokenUpgradeName then + f10_local1 = false + else + f10_local1 = true + end + f10_local0( f10_local1, "Invalid field_ref in GetFieldForPerk( perk_ref, field_ref )" ) + return Engine.TableLookup( AlienPerks.File, AlienPerks.Cols.Ref, f10_arg0, f10_arg1 ) +end + +function GetFieldForNerf( f11_arg0, f11_arg1 ) + local f11_local0 = assert + local f11_local1 + if f11_arg1 < AlienNerfs.Cols.Idx or f11_arg1 > AlienNerfs.Cols.IsUpgrade then + f11_local1 = false + else + f11_local1 = true + end + f11_local0( f11_local1, "Invalid field_ref in GetFieldForNerf( nerf_ref, field_ref )" ) + return Engine.TableLookup( AlienNerfs.File, AlienNerfs.Cols.Ref, f11_arg0, f11_arg1 ) +end + +function GetFieldForNerfFromIndex( f12_arg0, f12_arg1 ) + local f12_local0 = assert + local f12_local1 + if f12_arg1 < AlienNerfs.Cols.Idx or f12_arg1 > AlienNerfs.Cols.IsUpgrade then + f12_local1 = false + else + f12_local1 = true + end + f12_local0( f12_local1, "Invalid field_ref in GetFieldForNerf( nerf_ref, field_ref )" ) + return Engine.TableLookup( AlienNerfs.File, AlienNerfs.Cols.Idx, f12_arg0, f12_arg1 ) +end + +function GetFieldForAbility( f13_arg0, f13_arg1 ) + local f13_local0 = assert + local f13_local1 + if f13_arg1 < AlienAbilities.Cols.Idx or f13_arg1 > AlienAbilities.Cols.Category then + f13_local1 = false + else + f13_local1 = true + end + f13_local0( f13_local1, "Invalid field_ref in GetFieldForAbility( ability_ref, field_ref )" ) + f13_local0 = Engine.GetDvarString( "ui_mapname" ) + if f13_local0 == "mp_alien_beacon" or f13_local0 == "mp_alien_dlc3" or f13_local0 == "mp_alien_last" then + return Engine.TableLookup( AlienAbilities.FileAlt, AlienAbilities.Cols.Ref, f13_arg0, f13_arg1 ) + else + return Engine.TableLookup( AlienAbilities.File, AlienAbilities.Cols.Ref, f13_arg0, f13_arg1 ) + end +end + +function GetFieldForCraftingItemFromIndex( f14_arg0, f14_arg1 ) + return Engine.TableLookup( AlienCraftingItems.File, AlienCraftingItems.Cols.Idx, f14_arg0, f14_arg1 ) +end + +function GetPerkRefFromBaseAndLevel( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg0 + local f15_local1 + if 0 < f15_arg1 then + f15_local1 = "_" .. f15_arg1 + if not f15_local1 then + + else + return f15_local0 .. f15_local1 + end + end + f15_local1 = "" +end + +function GetAbilityRefFromBaseAndLevel( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg0 + local f16_local1 + if 0 < f16_arg1 then + f16_local1 = "_" .. f16_arg1 + if not f16_local1 then + + else + return f16_local0 .. f16_local1 + end + end + f16_local1 = "" +end + +function SetRelicEnabled( f17_arg0, f17_arg1, f17_arg2 ) + Engine.AliensSetIsRelicEnabled( f17_arg0, f17_arg1, f17_arg2 ) + if f17_arg1 == "nerf_no_class" then + if f17_arg2 then + Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "perks", 0, "perk_none" ) + else + Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "perks", 0, "perk_bullet_damage" ) + end + setDefaultSecondaryClass( f17_arg0 ) + end + if f17_arg1 == "nerf_no_abilities" then + if f17_arg2 then + Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "defense", "dpad_placeholder_def_1" ) + Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "offense", "dpad_placeholder_off_1" ) + else + Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "defense", "dpad_minigun_turret" ) + Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "offense", "dpad_ims" ) + end + end + if f17_arg1 == "nerf_no_deployables" then + if f17_arg2 then + Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "munition", "dpad_placeholder_ammo_1" ) + Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "support", "dpad_placeholder_sup_1" ) + else + Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "munition", "dpad_team_ammo_reg" ) + Engine.SetPlayerDataEx( f17_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "support", "dpad_team_explosives" ) + end + end +end + +function GetAlienPerk( f18_arg0, f18_arg1 ) + local f18_local0 = assert + local f18_local1 + if f18_arg1 < 0 or f18_arg1 > 1 then + f18_local1 = false + else + f18_local1 = true + end + f18_local0( f18_local1, "Invalid Perk Slot" ) + return Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "perks", f18_arg1 ) +end + +function SetAlienPerk( f19_arg0, f19_arg1, f19_arg2 ) + local f19_local0 = assert + local f19_local1 + if f19_arg1 < 0 or f19_arg1 > 1 then + f19_local1 = false + else + f19_local1 = true + end + f19_local0( f19_local1, "Invalid Perk Slot" ) + if f19_arg1 == 0 and Engine.AliensCheckIsRelicEnabled( f19_arg0, "nerf_no_class" ) then + SetRelicEnabled( f19_arg0, "nerf_no_class", false ) + setDefaultSecondaryClass( f19_arg0 ) + end + return Engine.SetPlayerDataEx( f19_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", "perks", f19_arg1, f19_arg2 ) +end + +function GetAlienPerkLevel( f20_arg0, f20_arg1 ) + local f20_local0 = assert + local f20_local1 + if f20_arg1 < 0 or f20_arg1 > 1 then + f20_local1 = false + else + f20_local1 = true + end + f20_local0( f20_local1, "Invalid Perk Slot" ) + return Engine.GetPlayerDataEx( f20_arg0, CoD.StatsGroup.Coop, "alienSession", "perk_" .. f20_arg1 .. "_level" ) +end + +function ClearSecondaryClass( f21_arg0 ) + SetSecondaryClass( f21_arg0, "perk_none" ) +end + +function setDefaultSecondaryClass( f22_arg0 ) + if Engine.AliensCheckIsUpgradeEnabled( f22_arg0, "multi_class" ) then + local f22_local0 = GetAlienPerk( f22_arg0, 0 ) + if f22_local0 == "perk_none" then + SetSecondaryClass( f22_arg0, "perk_none" ) + elseif f22_local0 == "perk_bullet_damage" then + SetSecondaryClass( f22_arg0, "perk_health" ) + else + SetSecondaryClass( f22_arg0, "perk_bullet_damage" ) + end + else + SetSecondaryClass( f22_arg0, "perk_none" ) + end +end + +function SetSecondaryClass( f23_arg0, f23_arg1 ) + DebugPrint( "Setting Secondary Class to " .. f23_arg1 ) + Engine.SetPlayerDataReservedInt( f23_arg0, CoD.StatsGroup.Coop, "secondary_class", GetFieldForPerk( f23_arg1, AlienPerks.Cols.Idx ) ) +end + +function GetSecondaryClassRef( f24_arg0 ) + return Engine.TableLookup( AlienPerks.File, AlienPerks.Cols.Idx, Engine.GetPlayerDataReservedInt( f24_arg0, CoD.StatsGroup.Coop, "secondary_class" ), AlienPerks.Cols.Ref ) +end + +function GetAlienSessionAbility( f25_arg0, f25_arg1 ) + return GetAbilityRefFromBaseAndLevel( GetAlienAbility( f25_arg0, f25_arg1 ), GetAlienAbilityLevel( f25_arg0, f25_arg1 ) ) +end + +function GetAlienAbility( f26_arg0, f26_arg1 ) + local f26_local0 = assert + local f26_local1 + if f26_arg1 ~= "munition" and f26_arg1 ~= "support" and f26_arg1 ~= "offense" and f26_arg1 ~= "defense" then + f26_local1 = false + else + f26_local1 = true + end + f26_local0( f26_local1, "ability_type must be munition, support, offense, or, defense" ) + return Engine.GetPlayerDataEx( f26_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", f26_arg1 ) +end + +function SetAlienAbility( f27_arg0, f27_arg1, f27_arg2 ) + local f27_local0 = assert + local f27_local1 + if f27_arg1 ~= "munition" and f27_arg1 ~= "support" and f27_arg1 ~= "offense" and f27_arg1 ~= "defense" then + f27_local1 = false + else + f27_local1 = true + end + f27_local0( f27_local1, "ability_type must be munition, support, offense, or, defense" ) + if (f27_arg1 == "offense" or f27_arg1 == "defense") and Engine.AliensCheckIsRelicEnabled( f27_arg0, "nerf_no_abilities" ) then + SetRelicEnabled( f27_arg0, "nerf_no_abilities", false ) + end + if (f27_arg1 == "munition" or f27_arg1 == "support") and Engine.AliensCheckIsRelicEnabled( f27_arg0, "nerf_no_deployables" ) then + SetRelicEnabled( f27_arg0, "nerf_no_deployables", false ) + end + if f27_arg1 == "munition" and f27_arg2 ~= "dpad_placeholder_ammo_2" and Engine.AliensCheckIsUpgradeEnabled( f27_arg0, "combined_ammo_upgrade" ) then + LUI.mp_menus.AliensPurchasables.AliensSetIsUpgradeEnabledWrapper( f27_arg0, "combined_ammo_upgrade", false ) + end + Engine.SetPlayerDataEx( f27_arg0, CoD.StatsGroup.Coop, "alienPlayerLoadout", f27_arg1, f27_arg2 ) +end + +function GetAlienAbilityLevel( f28_arg0, f28_arg1 ) + local f28_local0 = assert + local f28_local1 + if f28_arg1 ~= "munition" and f28_arg1 ~= "support" and f28_arg1 ~= "offense" and f28_arg1 ~= "defense" then + f28_local1 = false + else + f28_local1 = true + end + f28_local0( f28_local1, "ability_type must be munition, support, offense, or, defense" ) + return Engine.GetPlayerDataEx( f28_arg0, CoD.StatsGroup.Coop, "alienSession", f28_arg1 .. "_level" ) +end + +function GetAliensRankMaxXP( f29_arg0 ) + return tonumber( Engine.TableLookup( AlienRanks.File, AlienRanks.Cols.Idx, f29_arg0, AlienRanks.Cols.MaxXP ) ) +end + +function GetAliensMaxRank() + return tonumber( Engine.TableLookup( AlienRanks.File, 0, "maxrank", 1 ) ) +end + +function getAliensNextRank( f31_arg0, f31_arg1 ) + if AlienRanks.SuperMaxLevel <= f31_arg0 or f31_arg0 == AlienRanks.MaxLevel and AlienRanks.MaxPrestige <= f31_arg1 then + return AlienRanks.SuperMaxLevel + elseif f31_arg0 == AlienRanks.MaxLevel then + return 0 + else + return f31_arg0 + 1 + end +end + +function getAliensRankData( f32_arg0 ) + local f32_local0 = getAliensExperience( f32_arg0 ) + local f32_local1 = Lobby.GetAlienRankForXP( f32_local0 ) + local f32_local2 = getAliensPrestigeLevel( f32_arg0 ) + local f32_local3 + if f32_local1 < AlienRanks.SuperMaxLevel or f32_local2 < AlienRanks.MaxPrestige then + f32_local3 = false + else + f32_local3 = true + end + local f32_local4 = getAliensNextRank( f32_local1, f32_local2 ) + local f32_local5 = f32_local0 - Engine.TableLookup( AlienRanks.File, AlienRanks.Cols.Idx, f32_local1, AlienRanks.Cols.MinXP ) + local f32_local6 = Engine.TableLookup( AlienRanks.File, AlienRanks.Cols.Idx, f32_local1, AlienRanks.Cols.XPToNext ) + local f32_local7 + if f32_local3 then + f32_local7 = 1 + if not f32_local7 then + + else + local f32_local8 = Rank.GetRankDisplay( f32_local1, CoD.PlayMode.Aliens ) + local f32_local9 = Rank.GetRankDisplay( f32_local4, CoD.PlayMode.Aliens ) + local f32_local10 + if f32_local2 >= AlienRanks.MaxPrestige or f32_local1 ~= AlienRanks.MaxLevel then + f32_local10 = false + else + f32_local10 = true + end + local f32_local11 = RegisterMaterial( Rank.GetRankIcon( f32_local1, f32_local2, Engine.GetCurrentCoDPlayMode() ) ) + local f32_local12 = RegisterMaterial + local f32_local13 = Rank.GetRankIcon + local f32_local14 = f32_local4 + local f32_local15 + if f32_local10 then + f32_local15 = f32_local2 + 1 + if not f32_local15 then + + else + return f32_local8, f32_local11, f32_local9, f32_local12( f32_local13( f32_local14, f32_local15, Engine.GetCurrentCoDPlayMode() ) ), f32_local7, f32_local3 + end + end + f32_local15 = f32_local2 + end + end + f32_local7 = f32_local5 / f32_local6 +end + +function getAliensRank( f33_arg0 ) + return Engine.GetPlayerDataEx( f33_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "rank" ) +end + +function getAliensCareerWeaponKills( f34_arg0 ) + return Engine.GetPlayerDataEx( f34_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "kills" ) +end + +function getAliensCareerEscapes( f35_arg0 ) + return Engine.GetPlayerDataEx( f35_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "escaped" ) +end + +function getAliensCareerRevives( f36_arg0 ) + return Engine.GetPlayerDataEx( f36_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "revives" ) +end + +function getAliensExperience( f37_arg0 ) + return Engine.GetPlayerDataEx( f37_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "experience" ) +end + +function getAliensPrestigeLevel( f38_arg0 ) + return Engine.GetPlayerDataEx( f38_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "prestige" ) +end + +function getAliensDiscount() + return 1 - 0.01 * Engine.TableLookup( AlienRankIcons.File, AlienRankIcons.Cols.PrestigeItems, AlienRankIcons.Rows.PrestigeDiscount, AlienRankIcons.Cols.PrestigeValues ) +end + +function getAliensHasPlayerPrestiged( f40_arg0 ) + if Engine.GetPlayerDataEx( f40_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "prestige" ) >= 1 then + return true + else + return false + end +end + +function getAliensPrestigeLevel( f41_arg0 ) + return Engine.GetPlayerDataEx( f41_arg0, CoD.StatsGroup.Coop, "alienPlayerStats", "prestige" ) +end + +function getNumEnabledNerfs( f42_arg0 ) + local f42_local0 = 0 + for f42_local4, f42_local5 in ipairs( GetBaseNerfList() ) do + if Engine.AliensCheckIsRelicEnabled( f42_arg0, f42_local5 ) then + f42_local0 = f42_local0 + 1 + end + end + return f42_local0 +end + +function syncEggXP() + for f43_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.HasActiveLocalClient( f43_local0 ) then + local f43_local3 = Engine.GetPlayerDataReservedInt( f43_local0, CoD.StatsGroup.Ranked, "dlcEggStatus" ) + if f43_local3 then + Engine.SetPlayerDataReservedInt( f43_local0, CoD.StatsGroup.Coop, "eggstra_state_flags", f43_local3 ) + end + end + end +end + +function GetSessionXP( f44_arg0 ) + return Engine.GetPlayerDataEx( f44_arg0, CoD.StatsGroup.Coop, "alienSession", "experience" ) +end + +function GetSessionTokens( f45_arg0 ) + return Engine.GetPlayerDataEx( f45_arg0, CoD.StatsGroup.Coop, "alienSession", "shots" ) +end + +function GetPlayerCash( f46_arg0 ) + local f46_local0 = assert + local f46_local1 + if f46_arg0 < 0 or f46_arg0 >= 4 then + f46_local1 = false + else + f46_local1 = true + end + f46_local0( f46_local1, "Invalid player num" ) + return Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "EoGPlayer" .. f46_arg0, "currency" ) +end + +function GetAbilityFromClient( f47_arg0, f47_arg1 ) + local f47_local0 = assert + local f47_local1 + if f47_arg0 < 0 or f47_arg0 >= 4 then + f47_local1 = false + else + f47_local1 = true + end + f47_local0( f47_local1, "Invalid player num" ) + f47_local0 = assert + if f47_arg1 ~= "munition" and f47_arg1 ~= "support" and f47_arg1 ~= "offense" and f47_arg1 ~= "defense" then + f47_local1 = false + else + f47_local1 = true + end + f47_local0( f47_local1, "ability_type must be munition, support, offense, or, defense" ) + return Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "LoadoutPlayer" .. f47_arg0, f47_arg1 ) +end + +function GetPerkFromClient( f48_arg0, f48_arg1 ) + local f48_local0 = assert + local f48_local1 + if f48_arg0 < 0 or f48_arg0 >= 4 then + f48_local1 = false + else + f48_local1 = true + end + f48_local0( f48_local1, "Invalid player num" ) + f48_local0 = assert + if f48_arg1 < 0 or f48_arg1 > 1 then + f48_local1 = false + else + f48_local1 = true + end + f48_local0( f48_local1, "Invalid Perk Slot" ) + return Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "LoadoutPlayer" .. f48_arg0, "perks", f48_arg1 ) +end + +function GetEoGDataFromClient( f49_arg0, f49_arg1 ) + local f49_local0 = assert + local f49_local1 + if f49_arg0 < 0 or f49_arg0 >= 4 then + f49_local1 = false + else + f49_local1 = true + end + f49_local0( f49_local1, "Invalid player num" ) + return Engine.GetPlayerDataEx( -1, CoD.StatsGroup.Coop, "EoGPlayer" .. f49_arg0, f49_arg1 ) +end + +function GetGamerTagFromClient( f50_arg0 ) + return GetEoGDataFromClient( f50_arg0, "name" ) +end + +function GetScoreFromClient( f51_arg0 ) + return string.format( "%.0f", GetEoGDataFromClient( f51_arg0, "score" ) ) +end + +function GetKillsFromClient( f52_arg0 ) + return GetEoGDataFromClient( f52_arg0, "kills" ) +end + +function GetAssistsFromClient( f53_arg0 ) + return GetEoGDataFromClient( f53_arg0, "assists" ) +end + +function GetRevivesFromClient( f54_arg0 ) + return GetEoGDataFromClient( f54_arg0, "revives" ) +end + +function GetDrillRestartsFromClient( f55_arg0 ) + return GetEoGDataFromClient( f55_arg0, "drillrestarts" ) +end + +function GetDeathsFromClient( f56_arg0 ) + return GetEoGDataFromClient( f56_arg0, "deaths" ) +end + +function GetDownsFromClient( f57_arg0 ) + return GetEoGDataFromClient( f57_arg0, "downs" ) +end + +function ExtinctionHasMapSelection() + if Engine.GetDvarInt( "extinction_map_selection_enabled" ) == 1 and Engine.IsAliensMode() then + return true + elseif Engine.AnyoneHasAliensDLC() and Engine.IsAliensMode() then + return true + else + return false + end +end + +function MapSelectionButton() + return { + type = "UIGenericButton", + id = "maps_button_id", + properties = { + button_text = Engine.Localize( "@MENU_CHOOSE_MAP_CAP" ), + button_action_func = function ( f60_arg0, f60_arg1 ) + LUI.FlowManager.RequestAddMenu( f60_arg0, "mapsetup_menu_main", true, f60_arg1.controller, false, { + rotationAllowed = false + } ) + end + , + desc_text = Engine.Localize( "@MENU_DESC_CHANGE_MAP" ) + } + } +end + +ExtinctionDifficluty = { + Regular = 0, + Easy = 1, + Hard = 2 +} +function ExtinctionHasDifficultySelection() + if Engine.GetDvarInt( "extinction_hardcore_enabled" ) == 1 and Engine.IsAliensMode() then + return true + else + return false + end +end + +function ExtinctionSetDifficlutyDvars( f62_arg0 ) + if f62_arg0 == ExtinctionDifficluty.Easy then + Engine.ExecNow( "set scr_aliens_hardcore 0" ) + Engine.ExecNow( "set scr_aliens_ricochet 0" ) + Engine.ExecNow( "set scr_aliens_casual 1" ) + elseif f62_arg0 == ExtinctionDifficluty.Hard then + Engine.ExecNow( "set scr_aliens_hardcore 1" ) + Engine.ExecNow( "set scr_aliens_ricochet 1" ) + Engine.ExecNow( "set scr_aliens_casual 0" ) + else + Engine.ExecNow( "set scr_aliens_hardcore 0" ) + Engine.ExecNow( "set scr_aliens_ricochet 0" ) + Engine.ExecNow( "set scr_aliens_casual 0" ) + end + if IsPrivateMatch() then + Lobby.SetExtinctionDifficulty( f62_arg0 ) + end +end + +function ExtinctionDetermineDifficulty() + local f63_local0 = ExtinctionDifficluty.Regular + if IsPrivateMatch() then + f63_local0 = Lobby.GetExtinctionDifficulty() + elseif Engine.GetDvarInt( "scr_aliens_hardcore" ) == 1 then + f63_local0 = ExtinctionDifficluty.Hard + elseif Engine.GetDvarInt( "scr_aliens_casual" ) == 1 then + f63_local0 = ExtinctionDifficluty.Easy + end + return f63_local0 +end + +function ExtinctionDifficultyDisplayText( f64_arg0 ) + local f64_local0 = "" + if f64_arg0 == ExtinctionDifficluty.Easy then + f64_local0 = Engine.Localize( "LUA_MENU_MP_ALIENS_DIFF_CASUAL" ) + elseif f64_arg0 == ExtinctionDifficluty.Hard then + f64_local0 = Engine.Localize( "LUA_MENU_MP_ALIENS_DIFF_HARD" ) + else + f64_local0 = Engine.Localize( "LUA_MENU_MP_ALIENS_DIFF_NORMAL" ) + end + return f64_local0 +end + +function extinctionDifficlutyFeeder( f65_arg0 ) + local f65_local0 = {} + local f65_local1 = ExtinctionDetermineDifficulty() + local f65_local2 = { + [#f65_local2 + 1] = { + difficulty_val = ExtinctionDifficluty.Easy, + text = ExtinctionDifficultyDisplayText( ExtinctionDifficluty.Easy ) + }, + [#f65_local2 + 1] = { + difficulty_val = ExtinctionDifficluty.Regular, + text = ExtinctionDifficultyDisplayText( ExtinctionDifficluty.Regular ) + }, + [#f65_local2 + 1] = { + difficulty_val = ExtinctionDifficluty.Hard, + text = ExtinctionDifficultyDisplayText( ExtinctionDifficluty.Hard ) + } + } + for f65_local3 = 1, #f65_local2, 1 do + local f65_local6 = f65_local3 + f65_local0[#f65_local0 + 1] = { + type = "UIGenericButton", + listDefaultFocus = f65_local2[f65_local6].difficulty_val == f65_local1, + id = "difficulty_button_" .. f65_local6, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = f65_local2[f65_local6].text, + button_action_func = function ( f66_arg0, f66_arg1 ) + ExtinctionSetDifficlutyDvars( f65_local2[f65_local6].difficulty_val ) + LUI.FlowManager.RequestLeaveMenu( f66_arg0, true ) + if f65_local2[f65_local6].difficulty_val == ExtinctionDifficluty.Easy and IsOnlineMatch() then + LUI.FlowManager.RequestPopupMenu( f66_arg0, "extinction_casual_notice", true, f66_arg1.controller ) + end + end + } + } + end + return f65_local0 +end + +function extinction_difficulty_menu() + return { + type = "generic_selectionList_popup", + id = "extinction_difficulty_menu_popup", + properties = { + popup_title = Engine.Localize( "@MENU_SELECT_DIFFICULTY" ), + popup_childfeeder = extinctionDifficlutyFeeder + } + } +end + +function extinction_casual_notice() + return { + type = "generic_confirmation_popup", + id = "extinciont_casual_notice_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@PLATFORM_EXTINCTION_CASUAL_NOTICE" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } +end + +function getDifficultySetupButtonDescText( f69_arg0, f69_arg1 ) + local f69_local0 = "" + if IsChaosEnabled() then + f69_local0 = Engine.Localize( "@ALIENS_CHAOS_DIFF_DESC" ) + else + f69_local0 = Engine.Localize( "@LUA_MENU_MP_DIFFICULTY_DESC" ) + end + return f69_local0 +end + +function DifficultySelectionButton() + local f70_local0 = { + type = "UIGenericButton", + id = "difficulty_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_DIFFICULTY_CAPS" ), + button_action_func = function ( f71_arg0, f71_arg1 ) + LUI.FlowManager.RequestPopupMenu( f71_arg0, "extinction_difficulty_menu", true, f71_arg1.controller ) + end, + desc_text = getDifficultySetupButtonDescText + } + } + if not IsOnlineMatch() then + local f70_local1 = function ( f72_arg0, f72_arg1 ) + local f72_local0 = IsChaosEnabled() + if f72_local0 and not f72_arg0.disabled then + f72_arg0:processEvent( { + name = "disable" + } ) + elseif not f72_local0 and f72_arg0.disabled then + f72_arg0:processEvent( { + name = "enable" + } ) + end + end + + f70_local0.disabledFunc = function () + return IsChaosEnabled() + end + + f70_local0.properties.additional_handlers = { + update_chaos_enabled = f70_local1 + } + end + return f70_local0 +end + +function ExtinctionHasModeSelection() + return true +end + +function IsChaosEnabled() + local f75_local0 = false + if IsPrivateMatch() then + f75_local0 = Lobby.IsChaosEnabled() + else + f75_local0 = Engine.GetDvarInt( "scr_chaos_mode" ) == 1 + end + return f75_local0 +end + +function SetEnableChaosMode( f76_arg0 ) + if f76_arg0 then + if IsPrivateMatch() then + Lobby.SetChaosEnabled( true ) + end + Engine.SetDvarInt( "scr_chaos_mode", 1 ) + ExtinctionSetDifficlutyDvars( ExtinctionDifficluty.Regular ) + else + if IsPrivateMatch() then + Lobby.SetChaosEnabled( false ) + end + Engine.SetDvarInt( "scr_chaos_mode", 0 ) + end +end + +function extinctionModeFeeder( f77_arg0 ) + local f77_local0 = {} + local f77_local1 = IsChaosEnabled() + f77_local0[#f77_local0 + 1] = { + type = "UIGenericButton", + listDefaultFocus = f77_local1 == false, + id = "mode_button_standard", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MPUI_ALIENS" ), + button_action_func = function ( f78_arg0, f78_arg1 ) + SetEnableChaosMode( false ) + UpdateChaosEnabled( f78_arg0 ) + LUI.FlowManager.RequestLeaveMenu( f78_arg0, true ) + end + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIGenericButton", + listDefaultFocus = f77_local1 == true, + id = "mode_button_chaos", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@ALIENS_CHAOS_MODE" ), + button_action_func = function ( f79_arg0, f79_arg1 ) + SetEnableChaosMode( true ) + UpdateChaosEnabled( f79_arg0 ) + LUI.FlowManager.RequestLeaveMenu( f79_arg0, true ) + end + } + } + return f77_local0 +end + +function extinction_mode_menu() + return { + type = "generic_selectionList_popup", + id = "extinction_mode_menu_popup", + properties = { + popup_title = Engine.Localize( "@ALIENS_SELECT_MODE" ), + popup_childfeeder = extinctionModeFeeder + } + } +end + +function UpdateChaosEnabled( f81_arg0 ) + f81_arg0:dispatchEventToRoot( { + name = "update_chaos_enabled", + immediate = true + } ) +end + +function ModeSelectionButton() + return { + type = "UIGenericButton", + id = "extinction_mode_button_id", + properties = { + button_text = Engine.Localize( "@MPUI_EVENT_PATCH_CATEGORY_NAME2" ), + button_action_func = function ( f83_arg0, f83_arg1 ) + LUI.FlowManager.RequestPopupMenu( f83_arg0, "extinction_mode_menu", true, f83_arg1.controller ) + end + , + desc_text = Engine.Localize( "@ALIENS_GAME_MODE_DESC" ) + } + } +end + +function GetNumIntelsForCurrentMap() + local f84_local0 = 0 + local f84_local1 = Engine.GetDvarString( "ui_mapname" ) + if f84_local1 == "mp_alien_armory" then + f84_local0 = 13 + elseif f84_local1 == "mp_alien_beacon" then + f84_local0 = 9 + elseif f84_local1 == "mp_alien_dlc3" then + f84_local0 = 6 + elseif f84_local1 == "mp_alien_last" then + f84_local0 = 8 + end + return f84_local0 +end + +function ExtinctionLobbyGetOutroVideo( f85_arg0 ) + if not Engine.IsAliensMode() or IsChaosEnabled() then + return nil + elseif Engine.GetPlayerDataEx( f85_arg0, CoD.StatsGroup.Coop, "alienSession", "escapedRank0" ) + Engine.GetPlayerDataEx( f85_arg0, CoD.StatsGroup.Coop, "alienSession", "escapedRank1" ) + Engine.GetPlayerDataEx( f85_arg0, CoD.StatsGroup.Coop, "alienSession", "escapedRank2" ) + Engine.GetPlayerDataEx( f85_arg0, CoD.StatsGroup.Coop, "alienSession", "escapedRank3" ) > 0 then + local f85_local0 = Engine.GetPlayerDataEx( f85_arg0, CoD.StatsGroup.Common, "round", "map" ) + if f85_local0 == "mp_alien_armory" or f85_local0 == "mp_alien_beacon" or f85_local0 == "mp_alien_dlc3" or f85_local0 == "mp_alien_last" then + return f85_local0 .. "_outro" + end + end + return nil +end + +function LobbyGetIntroVideo() + local f86_local0 = Engine.GetDvarString( "ui_mapname" ) + if not IsChaosEnabled() and (f86_local0 == "mp_alien_armory" or f86_local0 == "mp_alien_beacon" or f86_local0 == "mp_alien_dlc3" or f86_local0 == "mp_alien_last") then + return f86_local0 .. "_intro" + else + return nil + end +end + +function HasSeenVideo( f87_arg0, f87_arg1 ) + if f87_arg1 == "mp_alien_armory_intro" then + return HasSeenIntroVideo( f87_arg0, 1 ) + elseif f87_arg1 == "mp_alien_armory_outro" then + return HasSeenOutroVideo( f87_arg0, 1 ) + elseif f87_arg1 == "mp_alien_beacon_intro" then + return HasSeenIntroVideo( f87_arg0, 2 ) + elseif f87_arg1 == "mp_alien_beacon_outro" then + return HasSeenOutroVideo( f87_arg0, 2 ) + elseif f87_arg1 == "mp_alien_dlc3_intro" then + return HasSeenIntroVideo( f87_arg0, 3 ) + elseif f87_arg1 == "mp_alien_dlc3_outro" then + return HasSeenOutroVideo( f87_arg0, 3 ) + elseif f87_arg1 == "mp_alien_last_intro" then + return HasSeenIntroVideo( f87_arg0, 4 ) + elseif f87_arg1 == "mp_alien_last_outro" then + return HasSeenOutroVideo( f87_arg0, 4 ) + else + return true + end +end + +function SetHasSeenVideo( f88_arg0, f88_arg1 ) + if f88_arg1 == "mp_alien_armory_intro" then + return SetHasSeenIntroVideo( f88_arg0, 1 ) + elseif f88_arg1 == "mp_alien_armory_outro" then + return SetHasSeenOutroVideo( f88_arg0, 1 ) + elseif f88_arg1 == "mp_alien_beacon_intro" then + return SetHasSeenIntroVideo( f88_arg0, 2 ) + elseif f88_arg1 == "mp_alien_beacon_outro" then + return SetHasSeenOutroVideo( f88_arg0, 2 ) + elseif f88_arg1 == "mp_alien_dlc3_intro" then + return SetHasSeenIntroVideo( f88_arg0, 3 ) + elseif f88_arg1 == "mp_alien_dlc3_outro" then + return SetHasSeenOutroVideo( f88_arg0, 3 ) + elseif f88_arg1 == "mp_alien_last_intro" then + return SetHasSeenIntroVideo( f88_arg0, 4 ) + elseif f88_arg1 == "mp_alien_last_outro" then + return SetHasSeenOutroVideo( f88_arg0, 4 ) + else + + end +end + +function AliensPlayVideo( f89_arg0, f89_arg1, f89_arg2 ) + LUI.FlowManager.RequestPopupMenu( nil, "AliensVideoOverlay", true, f89_arg0, false, { + videoRef = f89_arg1, + endEvent = f89_arg2 + } ) +end + +function HasSeenIntroVideo( f90_arg0, f90_arg1 ) + return 1 == Engine.GetPlayerDataReservedInt( f90_arg0, CoD.StatsGroup.Coop, "has_seen_episode_" .. f90_arg1 .. "_intro" ) +end + +function HasSeenOutroVideo( f91_arg0, f91_arg1 ) + return 1 == Engine.GetPlayerDataReservedInt( f91_arg0, CoD.StatsGroup.Coop, "has_seen_episode_" .. f91_arg1 .. "_outro" ) +end + +function SetHasSeenIntroVideo( f92_arg0, f92_arg1 ) + Engine.SetPlayerDataReservedInt( f92_arg0, CoD.StatsGroup.Coop, "has_seen_episode_" .. f92_arg1 .. "_intro", 1 ) + Engine.ExecNow( "uploadstats", f92_arg0 ) +end + +function SetHasSeenOutroVideo( f93_arg0, f93_arg1 ) + Engine.SetPlayerDataReservedInt( f93_arg0, CoD.StatsGroup.Coop, "has_seen_episode_" .. f93_arg1 .. "_outro", 1 ) + Engine.ExecNow( "uploadstats", f93_arg0 ) +end + +function IntroVideoUnlocked( f94_arg0, f94_arg1 ) + return HasSeenIntroVideo( f94_arg0, f94_arg1 ) +end + +function OutroVideoUnlocked( f95_arg0, f95_arg1 ) + return HasSeenOutroVideo( f95_arg0, f95_arg1 ) +end + +function CanAccessIntelMenu() + if Engine.GetDvarBool( "extinction_intel_enabled" ) and Engine.AnyoneHasAliensDLC() then + return true + elseif Engine.IsXbox360() and Engine.IsXenonDevTitle() then + return true + else + return false + end +end + +function AliensVideoOverlay( f97_arg0, f97_arg1, f97_arg2 ) + local f97_local0 = f97_arg1 or {} + local f97_local1 = f97_local0.videoRef or "mp_alien_armory_intro" + local f97_local2 = true + local f97_local3 = 4000 + local f97_local4 = f97_local0.endEvent or nil + local self = LUI.UIImage.new() + self.id = "video_root_id" + self:registerAnimationState( "default", { + material = RegisterMaterial( "cinematic" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "exit_extinction_video", function ( element, event ) + Engine.StopMenuVideo() + LUI.FlowManager.RequestLeaveMenu( element, true ) + if f97_local4 then + if f97_local4.target then + f97_local4.target:processEvent( f97_local4 ) + else + element:dispatchEventToRoot( f97_local4 ) + end + end + end ) + self:registerEventHandler( "check_exit_extinction_video", function ( element, event ) + if Engine.IsVideoFinished() then + element:processEvent( { + name = "exit_extinction_video" + } ) + end + end ) + self:registerEventHandler( "menu_create", function ( element, event ) + Engine.StopMusic( 200 ) + Engine.PlayMenuVideo( f97_local1, 0, true ) + local self = LUI.UITimer.new( 66, { + name = "check_exit_extinction_video" + }, nil, false, self, false ) + self.id = "check_exit_timer_id" + element:addElement( self ) + if f97_local2 == true then + local f100_local1 = LUI.UITimer.new( f97_local3, { + name = "allow_skip", + dispatchChildren = true + }, nil, true, self, false ) + f100_local1.id = "add_skip_handler_id" + element:addElement( f100_local1 ) + end + end ) + local f97_local6 = LUI.UIButton.new() + f97_local6.id = "video_continue_button" + f97_local6.properties = { + allowSkip = false + } + f97_local6:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + f97_local6:animateToState( "default", 0 ) + f97_local6:registerEventHandler( "allow_skip", function ( element, event ) + element.properties.allowSkip = true + end ) + f97_local6:registerEventHandler( "button_action", function ( element, event ) + if element.properties.allowSkip then + self:processEvent( { + name = "exit_extinction_video" + } ) + end + end ) + self:addElement( f97_local6 ) + return self +end + +function AliensVideoOverlayPop() + Engine.StopMenuVideo() + LUI.mp_menus.Aliens.SwapExtinctionMapMusic( LUI.mp_menus.Aliens.GetExtinctionMapMusic() ) +end + +function IsInLobby() + local f104_local0 = Engine.GetLuiRoot() + return LUI.FlowManager.IsInStack( f104_local0.flowManager, "menu_gamesetup_systemlink" ) or LUI.FlowManager.IsInStack( f104_local0.flowManager, "menu_xboxlive_privatelobby" ) or LUI.FlowManager.IsInStack( f104_local0.flowManager, "menu_xboxlive_lobby" ) or LUI.FlowManager.IsInStack( f104_local0.flowManager, "menu_gamesetup_splitscreen" ) +end + +function GetExtinctionMapMusic() + assert( Engine.IsAliensMode() ) + local f105_local0 = CoD.Music.MainExtinctMusic + if LUI.mp_menus.Aliens.IsInLobby() then + local f105_local1 = Engine.GetDvarString( "ui_mapname" ) + if f105_local1 ~= "mp_alien_town" then + if f105_local1 == "mp_alien_armory" then + f105_local0 = CoD.Music.MainExtinctMusic_DLC1 + elseif f105_local1 == "mp_alien_beacon" then + f105_local0 = CoD.Music.MainExtinctMusic_DLC2 + elseif f105_local1 == "mp_alien_dlc3" then + f105_local0 = CoD.Music.MainExtinctMusic_DLC3 + else + f105_local0 = CoD.Music.MainExtinctMusic_DLC4 + end + end + end + return f105_local0 +end + +function SwapExtinctionMapMusic( f106_arg0 ) + assert( Engine.IsAliensMode() ) + Engine.StopMusic( 200 ) + Engine.PlayMusic( f106_arg0 ) +end + +LUI.MenuBuilder.registerType( "AliensVideoOverlay", AliensVideoOverlay ) +LUI.FlowManager.RegisterStackPopBehaviour( "AliensVideoOverlay", AliensVideoOverlayPop ) +LUI.MenuBuilder.registerDef( "extinction_difficulty_menu", extinction_difficulty_menu ) +LUI.MenuBuilder.registerDef( "extinction_casual_notice", extinction_casual_notice ) +LUI.MenuBuilder.registerDef( "extinction_mode_menu", extinction_mode_menu ) +LockTable( _M ) diff --git a/lui/mp_menus/aliensintel.dec.lua b/lui/mp_menus/aliensintel.dec.lua new file mode 100644 index 0000000..0c8b436 --- /dev/null +++ b/lui/mp_menus/aliensintel.dec.lua @@ -0,0 +1,990 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +IntelTable = { + File = "mp/alien/alien_armory_intel.csv", + Size = 13, + Cols = { + index = 0, + menu_order = 1, + type = 2, + audio_caption = 3, + map_name = 4, + locked_text = 5, + intel_name = 6, + audio = 7, + img2 = 8, + bink3 = 9, + subject = 10, + file_num = 11, + red_text1 = 12, + red_text2 = 13, + red_text3 = 14, + audio_snip = 15, + ingame_splash_title = 16, + custom_audio_track = 17 + }, + Unlocked = {} +} +g_available_episodes = {} +g_episode_array_index = 1 +g_episode = 1 +g_map = "mp_alien_armory" +function aliens_intel_update_episode( f1_arg0 ) + g_episode_array_index = g_episode_array_index + f1_arg0 + if g_episode_array_index < 1 then + g_episode_array_index = #g_available_episodes + elseif g_episode_array_index > #g_available_episodes then + g_episode_array_index = 1 + end + aliens_intel_update_globals( g_available_episodes[g_episode_array_index] ) + IntelTable.Unlocked = {} + set_unlocked_table() +end + +function aliens_intel_generate_available_episodes() + if Engine.IsXbox360() and Engine.IsXenonDevTitle() then + g_available_episodes[#g_available_episodes + 1] = 1 + g_available_episodes[#g_available_episodes + 1] = 2 + g_available_episodes[#g_available_episodes + 1] = 3 + g_available_episodes[#g_available_episodes + 1] = 4 + else + if Engine.AnyoneHasAliensDLC1() then + g_available_episodes[#g_available_episodes + 1] = 1 + end + if Engine.AnyoneHasAliensDLC2() then + g_available_episodes[#g_available_episodes + 1] = 2 + end + if Engine.AnyoneHasAliensDLC3() then + g_available_episodes[#g_available_episodes + 1] = 3 + end + if Engine.AnyoneHasAliensDLC4() then + g_available_episodes[#g_available_episodes + 1] = 4 + end + end +end + +function aliens_intel_menu_initialize() + IntelTable.Unlocked = {} + g_available_episodes = {} + g_episode_array_index = 1 + aliens_intel_generate_available_episodes() + local f3_local0 = Engine.GetDvarString( "ui_mapname" ) + local f3_local1 = 0 + if f3_local0 == "mp_alien_town" then + f3_local1 = g_available_episodes[1] + elseif f3_local0 == "mp_alien_armory" then + if Engine.AnyoneHasAliensDLC1() then + f3_local1 = 1 + else + f3_local1 = g_available_episodes[1] + end + elseif f3_local0 == "mp_alien_beacon" then + if Engine.AnyoneHasAliensDLC2() then + f3_local1 = 2 + else + f3_local1 = g_available_episodes[1] + end + elseif f3_local0 == "mp_alien_dlc3" then + if Engine.AnyoneHasAliensDLC3() then + f3_local1 = 3 + else + f3_local1 = g_available_episodes[1] + end + elseif f3_local0 == "mp_alien_last" then + if Engine.AnyoneHasAliensDLC4() then + f3_local1 = 4 + else + f3_local1 = g_available_episodes[1] + end + end + if f3_local1 == 0 then + f3_local1 = 1 + end + aliens_intel_update_globals( f3_local1 ) + for f3_local5, f3_local6 in ipairs( g_available_episodes ) do + if f3_local6 == f3_local1 then + g_episode_array_index = f3_local5 + end + end + set_unlocked_table() +end + +function aliens_intel_update_globals( f4_arg0 ) + if f4_arg0 == 1 then + g_episode = 1 + g_map = "mp_alien_armory" + IntelTable.File = "mp/alien/alien_armory_intel.csv" + IntelTable.Size = 13 + elseif f4_arg0 == 2 then + g_episode = 2 + g_map = "mp_alien_beacon" + IntelTable.File = "mp/alien/alien_beacon_intel.csv" + IntelTable.Size = 9 + elseif f4_arg0 == 3 then + g_episode = 3 + g_map = "mp_alien_dlc3" + IntelTable.File = "mp/alien/alien_dlc3_intel.csv" + IntelTable.Size = 6 + elseif f4_arg0 == 4 then + g_episode = 4 + g_map = "mp_alien_last" + IntelTable.File = "mp/alien/alien_last_intel.csv" + IntelTable.Size = 8 + end +end + +function set_unlocked_table() + local f5_local0 = 1 + local f5_local1 = 0 + local f5_local2 = LUI.FlowManager.GetMenuScopedDataByMenuName( "aliens_intel_main" ) + local f5_local3 = f5_local2.exclusiveController + local f5_local4 = Engine.GetPlayerDataReservedInt( f5_local3, CoD.StatsGroup.Coop, "intel_episode_" .. g_episode .. "_sequenced_count" ) + for f5_local5 = 1, IntelTable.Size, 1 do + local f5_local8 = Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, f5_local5, IntelTable.Cols.type ) + if f5_local8 == "dossier" then + IntelTable.Unlocked[f5_local5] = 1 + end + if f5_local8 == "intercept" then + if Engine.GetPlayerDataReservedInt( f5_local3, CoD.StatsGroup.Coop, "intel_episode_" .. g_episode .. "_location_" .. f5_local0 ) == 1 then + IntelTable.Unlocked[f5_local5] = 1 + else + IntelTable.Unlocked[f5_local5] = 0 + end + f5_local0 = f5_local0 + 1 + end + if f5_local8 == "nightfall" then + if f5_local1 < f5_local4 then + IntelTable.Unlocked[f5_local5] = 1 + f5_local1 = f5_local1 + 1 + else + IntelTable.Unlocked[f5_local5] = 0 + end + end + end +end + +function aliens_calculate_intel_num_collected( f6_arg0, f6_arg1 ) + local f6_local0 = 0 + if f6_arg0 then + f6_local0 = 1 + end + for f6_local4, f6_local5 in ipairs( IntelTable.Unlocked ) do + if f6_local5 == 1 then + f6_local0 = f6_local0 + 1 + end + end + if f6_arg0 and LUI.mp_menus.Aliens.OutroVideoUnlocked( f6_arg1, g_episode ) then + f6_local0 = f6_local0 + 1 + end + return f6_local0 +end + +function HandleAliensIntel( f7_arg0, f7_arg1 ) + LUI.FlowManager.RequestAddMenu( f7_arg0, "aliens_intel_main", true, f7_arg1.controller, false ) +end + +function GetAliensIntelButton() + return { + type = "UIGenericButton", + id = "aliens_intel_main_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_INTEL_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_CLASSIFIED_DESC" ), + button_action_func = HandleAliensIntel + } + } +end + +function exit_aliens_intel_main( f9_arg0 ) + Engine.StopMenuVideo() + PersistentBackground.Show() + LUI.mp_menus.Aliens.SwapExtinctionMapMusic( LUI.mp_menus.Aliens.GetExtinctionMapMusic() ) +end + +function AliensIntelSwapBink( f10_arg0, f10_arg1, f10_arg2 ) + if f10_arg1 then + local f10_local0 = 1 + if Engine.IsPS3() then + f10_local0 = 0 + end + if f10_arg0 == 0 then + Engine.PlayMenuVideo( g_map .. "_" .. f10_arg2, f10_local0 ) + Engine.StopMusic( 200 ) + else + Engine.PlayMenuVideo( Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, f10_arg0, IntelTable.Cols.bink3 ), f10_local0 ) + if tonumber( Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, f10_arg0, IntelTable.Cols.custom_audio_track ) ) == 1 then + Engine.StopMusic( 200 ) + else + Engine.PlayMusic( CoD.Music.MainExtinctIntelMusic ) + end + end + end +end + +function aliens_intel_menu_button( f11_arg0, f11_arg1 ) + local f11_local0 = 42 + local f11_local1 = (f11_local0 - f11_arg1.intel_icon_dims) * 0.5 + local self = LUI.UIButton.new() + self.id = "aliens_intel_button_id" + self.properties = {} + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f11_local0 + } ) + self:animateToState( "default" ) + local f11_local3 = LUI.UIImage.new() + f11_local3.id = "btn_divider_id" + f11_local3:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 1, + red = 1, + green = 1, + blue = 1, + alpha = 0.1 + } ) + f11_local3:animateToState( "default" ) + self:addElement( f11_local3 ) + local f11_local4 = LUI.UIImage.new() + f11_local4.id = "btn_bkg_id" + f11_local4:registerAnimationState( "default", { + material = RegisterMaterial( "btn_alien_loadout_rtcap_f" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 16, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f11_local4:registerAnimationState( "dimmed", { + red = 1, + green = 1, + blue = 1, + alpha = 0.5 + } ) + f11_local4:registerAnimationState( "focus", { + red = 1, + green = 1, + blue = 1, + alpha = 0.8 + } ) + f11_local4:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "focus", + 0 + }, + { + "dimmed", + 750 + }, + { + "focus", + 750 + } + } ) ) + f11_local4:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + f11_local4:registerEventHandler( "button_locked", MBh.AnimateToState( "focus", 0 ) ) + f11_local4:animateToState( "default" ) + self:addElement( f11_local4 ) + local f11_local5 = LUI.UIImage.new() + f11_local5.id = "now_playing_id" + f11_local5:registerAnimationState( "default", { + material = RegisterMaterial( "alien_icon_intel_now_playing" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 5, + width = 32, + height = 32, + alpha = f11_arg1.intel_now_playing + } ) + f11_local5:registerAnimationState( "visible", { + alpha = 1 + } ) + f11_local5:registerAnimationState( "invisible", { + alpha = 0 + } ) + f11_local5:registerEventHandler( "now_playing", MBh.AnimateToState( "visible", 0 ) ) + f11_local5:registerEventHandler( "not_playing", MBh.AnimateToState( "invisible", 0 ) ) + f11_local5:animateToState( "default" ) + self:addElement( f11_local5 ) + if f11_arg1.intel_icon_dims > 0 then + local f11_local6 = LUI.UIImage.new() + f11_local6.id = "btn_img_id" + f11_local6:registerAnimationState( "default", { + material = RegisterMaterial( f11_arg1.intel_icon ), + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = f11_local1, + width = f11_arg1.intel_icon_dims, + height = f11_arg1.intel_icon_dims, + alpha = f11_arg1.intel_alpha + } ) + f11_local6:registerAnimationState( "visible", { + alpha = f11_arg1.intel_alpha + } ) + f11_local6:registerAnimationState( "invisible", { + alpha = 0 + } ) + f11_local6:registerEventHandler( "now_playing", MBh.AnimateToState( "invisible", 0 ) ) + f11_local6:registerEventHandler( "not_playing", MBh.AnimateToState( "visible", 0 ) ) + f11_local6:animateToState( "default" ) + self:addElement( f11_local6 ) + end + local f11_local6 = LUI.UIText.new() + f11_local6.id = "btn_name_text_id" + f11_local6:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = f11_arg1.intel_icon_dims + f11_local1 * 2, + right = 0, + top = -CoD.TextSettings.NormalFont.Height * 0.5, + bottom = CoD.TextSettings.NormalFont.Height * 0.5, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = f11_arg1.intel_alpha + } ) + f11_local6:registerAnimationState( "focus", { + red = 0, + green = 0, + blue = 0 + } ) + f11_local6:registerEventHandler( "button_over", MBh.AnimateToState( "focus", 0 ) ) + f11_local6:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + f11_local6:registerEventHandler( "button_locked", MBh.AnimateToState( "focus", 0 ) ) + f11_local6:setText( f11_arg1.intel_name ) + f11_local6:animateToState( "default" ) + self:addElement( f11_local6 ) + return self +end + +function AliensIntelListFeeder( f12_arg0 ) + assert( f12_arg0.exclusiveController, "No Exclusive controller found when opening Extinction Intel Menu." ) + local f12_local0 = {} + local f12_local1 = "vf_lock" + local f12_local2 = 48 + local f12_local3 = "Locked" + local f12_local4 = 1 + f12_local0[1] = { + type = "aliens_intel_menu_button", + id = "aliens_intel_btn_id_" .. g_episode .. "_intro", + properties = { + intel_name = Engine.Localize( "@ALIEN_INTEL_FRONTEND_EXTINCTION_INTEL_INTRO" ), + intel_icon_dims = 0, + intel_now_playing = 1 + }, + handlers = { + button_action = function ( f13_arg0, f13_arg1 ) + AliensIntelSwapBink( 0, true, "intro" ) + f13_arg0:dispatchEventToRoot( { + name = "turn_off_now_playing", + immediate = true + } ) + f13_arg0:dispatchEventToRoot( { + name = "invis_text", + immediate = true + } ) + f13_arg0:dispatchEventToChildren( { + name = "now_playing", + immediate = true + } ) + end + } + } + for f12_local9, f12_local10 in ipairs( IntelTable.Unlocked ) do + if g_map == "mp_alien_last" and f12_local9 == 8 then + break + elseif f12_local10 == 1 then + f12_local1 = "alien_icon_intel_" .. Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, f12_local9, IntelTable.Cols.type ) + f12_local3 = Engine.Localize( "@ALIEN_INTEL_FRONTEND_" .. Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, f12_local9, IntelTable.Cols.intel_name ) ) + f12_local2 = 32 + f12_local4 = 1 + else + f12_local1 = "vf_lock" + local f12_local8 = Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, f12_local9, IntelTable.Cols.type ) + if f12_local8 == "nightfall" then + f12_local3 = Engine.Localize( "@ALIEN_INTEL_FRONTEND_EXTINCTION_CLASSIFIED_INTEL" ) + elseif f12_local8 == "intercept" then + f12_local3 = Engine.Localize( "@ALIEN_INTEL_FRONTEND_EXTINCTION_ENCRYPTED" ) + end + f12_local2 = 48 + f12_local4 = 0.5 + end + f12_local0[#f12_local0 + 1] = { + type = "aliens_intel_menu_button", + id = "aliens_intel_btn_id_" .. g_episode .. "_" .. f12_local9, + properties = { + intel_icon = f12_local1, + intel_name = f12_local3, + intel_icon_dims = f12_local2, + intel_alpha = f12_local4, + intel_now_playing = 0 + }, + handlers = { + button_action = function ( f14_arg0, f14_arg1 ) + if f12_local10 == 1 then + AliensIntelSwapBink( f12_local9, f12_local10 ) + f14_arg0:dispatchEventToRoot( { + name = "turn_off_now_playing", + immediate = true + } ) + f14_arg0:dispatchEventToRoot( { + name = "update_intel", + immediate = true, + new_index = f12_local9 + } ) + f14_arg0:dispatchEventToChildren( { + name = "now_playing", + immediate = true + } ) + end + end + } + } + end + f12_local5 = LUI.mp_menus.Aliens.OutroVideoUnlocked( f12_arg0.exclusiveController, g_episode ) + if f12_local5 then + f12_local1 = "none" + f12_local3 = Engine.Localize( "@ALIEN_INTEL_FRONTEND_EXTINCTION_INTEL_OUTRO" ) + f12_local2 = 0 + f12_local4 = 1 + else + f12_local1 = "vf_lock" + f12_local3 = Engine.Localize( "@ALIEN_INTEL_FRONTEND_EF_OUTRO_LOCKED" ) + f12_local2 = 48 + f12_local4 = 0.5 + end + f12_local0[#f12_local0 + 1] = { + type = "aliens_intel_menu_button", + id = "aliens_intel_btn_id_" .. g_episode .. "_outro", + properties = { + intel_icon = f12_local1, + intel_name = f12_local3, + intel_icon_dims = f12_local2, + intel_alpha = f12_local4, + intel_now_playing = 0 + }, + handlers = { + button_action = function ( f15_arg0, f15_arg1 ) + if f12_local5 then + AliensIntelSwapBink( 0, true, "outro" ) + f15_arg0:dispatchEventToRoot( { + name = "turn_off_now_playing", + immediate = true + } ) + f15_arg0:dispatchEventToRoot( { + name = "invis_text", + immediate = true + } ) + f15_arg0:dispatchEventToChildren( { + name = "now_playing", + immediate = true + } ) + end + end + } + } + if g_map == "mp_alien_last" then + if 1 == IntelTable.Unlocked[8] then + f12_local1 = "alien_icon_intel_" .. Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, 8, IntelTable.Cols.type ) + f12_local3 = Engine.Localize( "@ALIEN_INTEL_FRONTEND_" .. Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, 8, IntelTable.Cols.intel_name ) ) + f12_local2 = 32 + f12_local4 = 1 + else + f12_local1 = "vf_lock" + f12_local3 = Engine.Localize( "@ALIEN_INTEL_FRONTEND_EXTINCTION_TOP_SECRET" ) + f12_local2 = 48 + f12_local4 = 0.5 + end + f12_local0[#f12_local0 + 1] = { + type = "aliens_intel_menu_button", + id = "aliens_intel_btn_id_" .. g_episode .. "_" .. 8, + properties = { + intel_icon = f12_local1, + intel_name = f12_local3, + intel_icon_dims = f12_local2, + intel_alpha = f12_local4, + intel_now_playing = 0 + }, + handlers = { + button_action = function ( f16_arg0, f16_arg1 ) + if IntelTable.Unlocked[8] == 1 then + AliensIntelSwapBink( 8, 1 ) + f16_arg0:dispatchEventToRoot( { + name = "turn_off_now_playing", + immediate = true + } ) + f16_arg0:dispatchEventToRoot( { + name = "update_intel", + immediate = true, + new_index = 8 + } ) + f16_arg0:dispatchEventToChildren( { + name = "now_playing", + immediate = true + } ) + end + end + } + } + end + return f12_local0 +end + +function aliens_intel_main() + local f17_local0 = Engine.Localize( ButtonMap.button_shoulderr.string ) + local f17_local1 = Engine.Localize( ButtonMap.button_shoulderl.string ) + local f17_local2 = 1 + if 1 == #g_available_episodes then + f17_local2 = 0 + end + local f17_local3 = Engine.IsConsoleGame() + if not f17_local3 then + f17_local3 = Engine.IsGamepadEnabled() == 1 + end + if not f17_local3 then + f17_local0 = Engine.Localize( ButtonMap.button_shoulderr.keyboard_string ) + f17_local1 = Engine.Localize( ButtonMap.button_shoulderl.keyboard_string ) + end + local f17_local4 = { + type = "UIElement", + id = "aliens_intel_id", + properties = {}, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = function ( f18_arg0, f18_arg1 ) + PersistentBackground.Hide() + Engine.Exec( "uploadstats", f18_arg0.properties.exclusiveController ) + Engine.StopMusic( 200 ) + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then + f18_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = Engine.Localize( "@ALIENS_SELECT" ), + side = "left", + clickable = false + } ) + end + end + }, + children = { + { + type = "generic_menu_title", + id = "aliens_intel_main_title_text_id", + properties = { + menu_title = Engine.Localize( "@ALIEN_INTEL_FRONTEND_EXTINCTION_INTEL_CAPS" ) + } + }, + { + type = "UIText", + id = "aliens_intel_main_bumper_l_id", + properties = { + text = f17_local1 + }, + states = { + default = { + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + top = -CoD.TextSettings.ExtraBigFont.Height / 2 - 246, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2 - 246, + left = 106, + right = 0, + alpha = f17_local2 + } + } + }, + { + type = "UIText", + id = "aliens_intel_main_bumper_r_id", + properties = { + text = f17_local0 + }, + states = { + default = { + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + top = -CoD.TextSettings.ExtraBigFont.Height / 2 - 246, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2 - 246, + left = 282, + right = 0, + alpha = f17_local2 + } + } + }, + { + type = "UIText", + id = "aliens_intel_main_episode_text_id", + properties = { + text = Engine.Localize( "@ALIEN_INTEL_FRONTEND_EXTINCTION_INTEL_EPISODE_CAPS", g_episode ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 134, + right = -998, + top = 102, + bottom = 102 + CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + }, + handlers = { + change_episode = function ( f19_arg0, f19_arg1 ) + f19_arg0:setText( Engine.Localize( "@ALIEN_INTEL_FRONTEND_EXTINCTION_INTEL_EPISODE_CAPS", g_episode ) ) + end + } + }, + { + type = "UIText", + id = "aliens_intel_collected_text_id", + properties = { + text = Engine.Localize( "@ALIEN_INTEL_FRONTEND_EXTINCTION_INTEL_COLLECTED", 0, 0 ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = -120, + top = 60, + bottom = 60 + CoD.TextSettings.NormalFont.Height, + red = Colors.grey_4.r, + green = Colors.grey_4.g, + blue = Colors.grey_4.b, + alpha = 1 + } + }, + handlers = { + menu_create = function ( f20_arg0, f20_arg1 ) + f20_arg0:setText( Engine.Localize( "@ALIEN_INTEL_FRONTEND_EXTINCTION_INTEL_COLLECTED", aliens_calculate_intel_num_collected( true, f20_arg1.controller ), IntelTable.Size + 2 ) ) + end, + change_episode = function ( f21_arg0, f21_arg1 ) + f21_arg0:processEvent( { + name = "menu_create", + immediate = true, + controller = f21_arg1.controller + } ) + end + } + }, + { + type = "generic_menu_background_withfade", + id = "aliens_intel_menu_fade_id", + properties = { + fill_alpha = 0, + top_offset = 0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 96, + right = 322, + top = 100, + bottom = GenericMenuDims.menu_bottom + } + } + }, + { + type = "generic_menu_background", + id = " aliens_intel_menu_title_bar", + properties = { + hide_bottom = true + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 96, + right = 322, + top = 104 + CoD.TextSettings.NormalFont.Height + } + } + }, + { + type = "UIScrollingVerticalList", + id = "aliens_intel_list_id", + properties = { + use_scrollbar = true, + bar_width = 8, + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 100, + right = 310, + top = 136, + bottom = GenericMenuDims.menu_bottom, + spacing = 1, + alpha = 1 + } + }, + handlers = { + turn_off_now_playing = function ( f22_arg0, f22_arg1 ) + local f22_local0 = f22_arg0:getFirstChild() + while f22_local0 do + f22_local0:dispatchEventToChildren( { + name = "not_playing", + immediate = true + } ) + f22_local0 = f22_local0:getNextSibling() + end + end, + change_episode = function ( f23_arg0, f23_arg1 ) + f23_arg0:processEvent( { + name = "menu_refresh", + immediate = true + } ) + f23_arg0:dispatchEventToRoot( { + name = "invis_text", + immediate = true + } ) + AliensIntelSwapBink( 0, true, "intro" ) + end + }, + childrenFeeder = AliensIntelListFeeder + }, + { + type = "UIImage", + id = "cinematic_image_id", + states = { + default = { + material = RegisterMaterial( "cinematic" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 324, + right = 1190, + top = 100, + bottom = 630 + } + } + }, + { + type = "UIText", + id = "subject_name_id", + properties = { + text = Engine.Localize( "@ALIEN_INTEL_FRONTEND_" .. Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, 1, IntelTable.Cols.subject ) ) + }, + states = { + default = { + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 522, + right = 0, + top = 112, + bottom = 112 + CoD.TextSettings.ExtraBigFont.Height, + red = 0, + green = 0, + blue = 0, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + invis_text = function ( f24_arg0, f24_arg1 ) + f24_arg0:animateToState( "default" ) + end, + update_intel = function ( f25_arg0, f25_arg1 ) + if g_episode == 1 then + f25_arg0:animateToState( "visible" ) + f25_arg0:setText( Engine.Localize( "@ALIEN_INTEL_FRONTEND_" .. Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, f25_arg1.new_index, IntelTable.Cols.subject ) ) ) + end + end + } + }, + { + type = "UIText", + id = "file_num_text_id", + properties = { + text = Engine.Localize( "@ALIEN_INTEL_FRONTEND_" .. Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, 1, IntelTable.Cols.file_num ) ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 482, + right = 0, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + red = Colors.grey_4.r, + green = Colors.grey_4.g, + blue = Colors.grey_4.b, + alpha = 0 + }, + visible = { + alpha = 1 + }, + invisible = { + alpha = 0 + } + }, + handlers = { + invis_text = function ( f26_arg0, f26_arg1 ) + f26_arg0:animateToState( "default" ) + end, + update_intel = function ( f27_arg0, f27_arg1 ) + if g_episode == 1 then + f27_arg0:setText( Engine.Localize( "@ALIEN_INTEL_FRONTEND_" .. Engine.TableLookup( IntelTable.File, IntelTable.Cols.menu_order, f27_arg1.new_index, IntelTable.Cols.file_num ) ) ) + local f27_local0 = MBh.AnimateSequence( { + { + "invisible", + 0 + }, + { + "invisible", + 100 + }, + { + "visible", + 1000 + } + } ) + f27_local0( f27_arg0, {} ) + end + end + } + }, + { + type = "generic_back_button", + id = "aliens_intel_main_back_id" + }, + { + type = "UIBindButton", + id = "aliens_intel_main_back_id", + handlers = { + button_shoulderr = function ( f28_arg0, f28_arg1 ) + if #g_available_episodes > 1 then + aliens_intel_update_episode( 1 ) + f28_arg0:dispatchEventToRoot( { + name = "change_episode", + immediate = true, + controller = f28_arg1.controller + } ) + end + end, + button_shoulderl = function ( f29_arg0, f29_arg1 ) + if #g_available_episodes > 1 then + aliens_intel_update_episode( -1 ) + f29_arg0:dispatchEventToRoot( { + name = "change_episode", + immediate = true, + controller = f29_arg1.controller + } ) + end + end + } + }, + { + type = "button_helper_text_main", + id = "aliens_intel_helper_text_id", + handlers = { + menu_create = function ( f30_arg0, f30_arg1 ) + f30_arg0:dispatchEventToRoot( LUI.ButtonHelperText.CommonEvents.addBackButton ) + if #g_available_episodes > 1 then + f30_arg0:processEvent( { + name = "add_button_helper_text", + priority = 1, + button_ref = "button_shoulderl", + button_ref2 = "button_shoulderr", + helper_text = Engine.Localize( "ALIEN_INTEL_FRONTEND_EXTINCTION_INTEL_TOGGLE_EPISODE" ), + side = "left", + clickable = true, + immediate = true + } ) + end + end + } + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + } + return AliensIntelSwapBink( 0, true, "intro" ) +end + +LUI.FlowManager.RegisterStackPushBehaviour( "aliens_intel_main", aliens_intel_menu_initialize ) +LUI.MenuBuilder.registerDef( "aliens_intel_main", aliens_intel_main ) +LUI.MenuBuilder.registerType( "aliens_intel_menu_button", aliens_intel_menu_button ) +LUI.FlowManager.RegisterStackPopBehaviour( "aliens_intel_main", exit_aliens_intel_main ) +LockTable( _M ) diff --git a/lui/mp_menus/aliensloadout.dec.lua b/lui/mp_menus/aliensloadout.dec.lua new file mode 100644 index 0000000..89f94c5 --- /dev/null +++ b/lui/mp_menus/aliensloadout.dec.lua @@ -0,0 +1,2736 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function HandleAliensLoadout( f1_arg0, f1_arg1 ) + LUI.FlowManager.RequestAddMenu( f1_arg0, "aliens_cac_menu", true, f1_arg1.controller, false ) +end + +function GetAliensLoadoutButton() + return { + type = "UIGenericButton", + id = "aliens_loadout_btn_id", + properties = { + button_text = Engine.Localize( "@ALIENS_LOADOUT" ), + desc_text = Engine.Localize( "@ALIENS_LOADOUT_DESC" ), + button_action_func = HandleAliensLoadout + } + } +end + +function aliensCacFeeder( f3_arg0 ) + assert( f3_arg0.exclusiveController, "The Alien Loadout setup menu should NEVER be opened with out and exclusive controller\n" ) + local f3_local0 = LUI.mp_menus.Aliens + local f3_local1 = f3_arg0.exclusiveController + local f3_local2 = f3_local0.IsChaosEnabled() + local f3_local3 = {} + local f3_local4 = f3_local0.GetAlienPerk( f3_local1, 0 ) + local f3_local5 = f3_local0.GetFieldForPerk( f3_local4, f3_local0.AlienPerks.Cols.Name ) + local f3_local6 = f3_local0.GetFieldForPerk( f3_local4, f3_local0.AlienPerks.Cols.Desc ) + local f3_local7 = f3_local0.GetFieldForPerk( f3_local4, f3_local0.AlienPerks.Cols.Icon ) + local f3_local8 = Engine.Localize( "@ALIENS_SOLDIER_CLASS" ) + local f3_local9, f3_local10, f3_local11, f3_local12 = GetTextDimensions( f3_local8, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f3_local13 = f3_local0.GetAlienPerk( f3_local1, 1 ) + local f3_local14 = f3_local0.GetFieldForPerk( f3_local13, f3_local0.AlienPerks.Cols.Name ) + local f3_local15 = f3_local0.GetFieldForPerk( f3_local13, f3_local0.AlienPerks.Cols.Desc ) + local f3_local16 = f3_local0.GetFieldForPerk( f3_local13, f3_local0.AlienPerks.Cols.Icon ) + local f3_local17 = Engine.Localize( "@ALIENS_PISTOL_TYPE" ) + local f3_local18, f3_local19, f3_local20, f3_local21 = GetTextDimensions( f3_local17, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f3_local22 = f3_local0.GetAlienAbility( f3_local1, "munition" ) + local f3_local23 = f3_local0.GetFieldForAbility( f3_local22, f3_local0.AlienAbilities.Cols.Name ) + local f3_local24 = f3_local0.GetFieldForAbility( f3_local22, f3_local0.AlienAbilities.Cols.Desc ) + local f3_local25 = f3_local0.GetFieldForAbility( f3_local22, f3_local0.AlienAbilities.Cols.Icon ) + local f3_local26 = Engine.Localize( "@ALIENS_AMMO_TYPE" ) + local f3_local27, f3_local28, f3_local29, f3_local30 = GetTextDimensions( f3_local26, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f3_local31 = f3_local0.GetAlienAbility( f3_local1, "support" ) + local f3_local32 = f3_local0.GetFieldForAbility( f3_local31, f3_local0.AlienAbilities.Cols.Name ) + local f3_local33 = f3_local0.GetFieldForAbility( f3_local31, f3_local0.AlienAbilities.Cols.Desc ) + local f3_local34 = f3_local0.GetFieldForAbility( f3_local31, f3_local0.AlienAbilities.Cols.Icon ) + local f3_local35 = Engine.Localize( "@ALIENS_TEAM_SUPPORT" ) + local f3_local36, f3_local37, f3_local38, f3_local39 = GetTextDimensions( f3_local35, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f3_local40 = f3_local0.GetAlienAbility( f3_local1, "offense" ) + local f3_local41 = f3_local0.GetFieldForAbility( f3_local40, f3_local0.AlienAbilities.Cols.Name ) + local f3_local42 = f3_local0.GetFieldForAbility( f3_local40, f3_local0.AlienAbilities.Cols.Desc ) + local f3_local43 = f3_local0.GetFieldForAbility( f3_local40, f3_local0.AlienAbilities.Cols.Icon ) + local f3_local44 = Engine.Localize( "@ALIENS_STRIKE_PACKAGE" ) + local f3_local45, f3_local46, f3_local47, f3_local48 = GetTextDimensions( f3_local44, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f3_local49 = f3_local0.GetAlienAbility( f3_local1, "defense" ) + local f3_local50 = f3_local0.GetFieldForAbility( f3_local49, f3_local0.AlienAbilities.Cols.Name ) + local f3_local51 = f3_local0.GetFieldForAbility( f3_local49, f3_local0.AlienAbilities.Cols.Desc ) + local f3_local52 = f3_local0.GetFieldForAbility( f3_local49, f3_local0.AlienAbilities.Cols.Icon ) + local f3_local53 = Engine.Localize( "@ALIENS_EQUALIZER" ) + local f3_local54, f3_local55, f3_local56, f3_local57 = GetTextDimensions( f3_local53, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f3_local58 = nil + if Engine.IsGamepadEnabled() == 1 then + f3_local58 = 1 + else + f3_local58 = 0 + end + if LUI.mp_menus.AliensPurchasables.UsingExtinctionTokens() and not f3_local2 then + f3_local3[#f3_local3 + 1] = { + type = "aliens_cac_armory_button" + } + end + if not f3_local2 then + f3_local3[#f3_local3 + 1] = { + type = "aliens_cac_menu_button", + id = "perk_1_id", + properties = { + ability_text = f3_local8, + ability_text_width = f3_local11 - f3_local9 + 130, + selected_ability_text = Engine.Localize( f3_local5 ), + selected_ability_desc_text = Engine.Localize( f3_local6 ), + icon = RegisterMaterial( f3_local7 ), + isPerkSlot = 1, + perkSlot = 0 + }, + handlers = { + button_action = function ( f4_arg0, f4_arg1 ) + OpenSelectionMenu( f4_arg0, f4_arg1, 1, 0, 0, 0, 0 ) + f4_arg0:dispatchEventToRoot( { + name = "hide_tip", + immediate = true + } ) + f4_arg0:dispatchEventToRoot( { + name = "dim_all", + immediate = true + } ) + f4_arg0:dispatchEventToChildren( { + name = "button_locked", + immediate = true + } ) + end, + button_over = function ( f5_arg0, f5_arg1 ) + f5_arg0:dispatchEventToRoot( { + name = "show_all", + immediate = true + } ) + f5_arg0:dispatchEventToRoot( { + name = "update_tip", + immediate = true, + new_Text = Engine.Localize( "@ALIENS_SOLDIER_TYPE_DESC" ) + } ) + f5_arg0:dispatchEventToRoot( { + name = "show_tip", + immediate = true + } ) + f5_arg0:dispatchEventToRoot( { + name = "selection_info_set_header_text", + newText = Engine.Localize( "@ALIENS_SOLDIER_CLASS" ), + disabled_in_chaos = true + } ) + end + } + } + end + if not f3_local2 then + f3_local3[#f3_local3 + 1] = { + type = "aliens_cac_menu_button", + id = "perk_2_id", + properties = { + ability_text = f3_local17, + ability_text_width = f3_local20 - f3_local18 + 130, + selected_ability_text = Engine.Localize( f3_local14 ), + selected_ability_desc_text = Engine.Localize( f3_local15 ), + icon = RegisterMaterial( f3_local16 ), + isPerkSlot = 1, + perkSlot = 1 + }, + handlers = { + button_action = function ( f6_arg0, f6_arg1 ) + OpenSelectionMenu( f6_arg0, f6_arg1, 1, 1, 0, 0, 0 ) + f6_arg0:dispatchEventToRoot( { + name = "hide_tip", + immediate = true + } ) + f6_arg0:dispatchEventToRoot( { + name = "dim_all", + immediate = true + } ) + f6_arg0:dispatchEventToChildren( { + name = "button_locked", + immediate = true + } ) + end, + button_over = function ( f7_arg0, f7_arg1 ) + f7_arg0:dispatchEventToRoot( { + name = "show_all", + immediate = true + } ) + f7_arg0:dispatchEventToRoot( { + name = "update_tip", + immediate = true, + new_Text = Engine.Localize( "@ALIENS_PISTOL_TYPE_DESC" ) + } ) + f7_arg0:dispatchEventToRoot( { + name = "show_tip", + immediate = true + } ) + f7_arg0:dispatchEventToRoot( { + name = "selection_info_set_header_text", + immediate = true, + newText = Engine.Localize( "@ALIENS_PISTOL_TYPE" ), + disabled_in_chaos = true + } ) + end + } + } + end + if not f3_local2 then + f3_local3[#f3_local3 + 1] = { + type = "aliens_cac_menu_button", + id = "munition_id", + properties = { + ability_text = f3_local26, + ability_text_width = f3_local29 - f3_local27 + 130, + selected_ability_text = Engine.Localize( f3_local23 ), + selected_ability_desc_text = Engine.Localize( f3_local24 ), + icon = RegisterMaterial( f3_local25 ), + isPerkSlot = 0, + isActionSlot = 1, + isNerfSlot = 0, + actionSlot = f3_local0.AlienAbilities.Up, + dpadAlpha = f3_local58, + upArrowAlpha = 1 + }, + handlers = { + button_action = function ( f8_arg0, f8_arg1 ) + OpenSelectionMenu( f8_arg0, f8_arg1, 0, 0, 1, f3_local0.AlienAbilities.Up, 0 ) + f8_arg0:dispatchEventToRoot( { + name = "hide_tip", + immediate = true + } ) + f8_arg0:dispatchEventToRoot( { + name = "dim_all", + immediate = true + } ) + f8_arg0:dispatchEventToChildren( { + name = "button_locked", + immediate = true + } ) + end, + button_over = function ( f9_arg0, f9_arg1 ) + f9_arg0:dispatchEventToRoot( { + name = "show_all", + immediate = true + } ) + f9_arg0:dispatchEventToRoot( { + name = "update_tip", + immediate = true, + new_Text = Engine.Localize( "@ALIENS_AMMO_TYPE_DESC" ) + } ) + f9_arg0:dispatchEventToRoot( { + name = "show_tip", + immediate = true + } ) + f9_arg0:dispatchEventToRoot( { + name = "selection_info_set_header_text", + immediate = true, + newText = Engine.Localize( "@ALIENS_AMMO_TYPE" ), + disabled_in_chaos = true + } ) + end + } + } + end + if not f3_local2 then + f3_local3[#f3_local3 + 1] = { + type = "aliens_cac_menu_button", + id = "support_id", + properties = { + ability_text = f3_local35, + ability_text_width = f3_local38 - f3_local36 + 130, + selected_ability_text = Engine.Localize( f3_local32 ), + selected_ability_desc_text = Engine.Localize( f3_local33 ), + icon = RegisterMaterial( f3_local34 ), + isPerkSlot = 0, + isActionSlot = 1, + isNerfSlot = 0, + actionSlot = f3_local0.AlienAbilities.Down, + dpadAlpha = f3_local58, + downArrowAlpha = 1 + }, + handlers = { + button_action = function ( f10_arg0, f10_arg1 ) + OpenSelectionMenu( f10_arg0, f10_arg1, 0, 0, 1, f3_local0.AlienAbilities.Down, 0 ) + f10_arg0:dispatchEventToRoot( { + name = "hide_tip", + immediate = true + } ) + f10_arg0:dispatchEventToRoot( { + name = "dim_all", + immediate = true + } ) + f10_arg0:dispatchEventToChildren( { + name = "button_locked", + immediate = true + } ) + end, + button_over = function ( f11_arg0, f11_arg1 ) + f11_arg0:dispatchEventToRoot( { + name = "show_all", + immediate = true + } ) + f11_arg0:dispatchEventToRoot( { + name = "update_tip", + immediate = true, + new_Text = Engine.Localize( "@ALIENS_TEAM_SUPPORT_DESC" ) + } ) + f11_arg0:dispatchEventToRoot( { + name = "show_tip", + immediate = true + } ) + f11_arg0:dispatchEventToRoot( { + name = "selection_info_set_header_text", + immediate = true, + newText = Engine.Localize( "@ALIENS_TEAM_SUPPORT" ), + disabled_in_chaos = true + } ) + end + } + } + end + f3_local3[#f3_local3 + 1] = { + type = "aliens_cac_menu_button", + id = "offnese_id", + properties = { + ability_text = f3_local44, + ability_text_width = f3_local47 - f3_local45 + 130, + selected_ability_text = Engine.Localize( f3_local41 ), + selected_ability_desc_text = Engine.Localize( f3_local42 ), + icon = RegisterMaterial( f3_local43 ), + isPerkSlot = 0, + isActionSlot = 1, + isNerfSlot = 0, + actionSlot = f3_local0.AlienAbilities.Right, + dpadAlpha = f3_local58, + rightArrowAlpha = 1 + }, + handlers = { + button_action = function ( f12_arg0, f12_arg1 ) + OpenSelectionMenu( f12_arg0, f12_arg1, 0, 0, 1, f3_local0.AlienAbilities.Right, 0 ) + f12_arg0:dispatchEventToRoot( { + name = "hide_tip", + immediate = true + } ) + f12_arg0:dispatchEventToRoot( { + name = "dim_all", + immediate = true + } ) + f12_arg0:dispatchEventToChildren( { + name = "button_locked", + immediate = true + } ) + end, + button_over = function ( f13_arg0, f13_arg1 ) + f13_arg0:dispatchEventToRoot( { + name = "show_all", + immediate = true + } ) + f13_arg0:dispatchEventToRoot( { + name = "update_tip", + immediate = true, + new_Text = Engine.Localize( "@ALIENS_STRIKE_PACKAGE_DESC" ) + } ) + f13_arg0:dispatchEventToRoot( { + name = "show_tip", + immediate = true + } ) + f13_arg0:dispatchEventToRoot( { + name = "selection_info_set_header_text", + immediate = true, + newText = Engine.Localize( "@ALIENS_STRIKE_PACKAGE" ) + } ) + end + } + } + f3_local3[#f3_local3 + 1] = { + type = "aliens_cac_menu_button", + id = "defense_id", + properties = { + ability_text = f3_local53, + ability_text_width = f3_local56 - f3_local54 + 130, + selected_ability_text = Engine.Localize( f3_local50 ), + selected_ability_desc_text = Engine.Localize( f3_local51 ), + icon = RegisterMaterial( f3_local52 ), + isPerkSlot = 0, + isActionSlot = 1, + isNerfSlot = 0, + actionSlot = f3_local0.AlienAbilities.Left, + dpadAlpha = f3_local58, + leftArrowAlpha = 1 + }, + handlers = { + button_action = function ( f14_arg0, f14_arg1 ) + OpenSelectionMenu( f14_arg0, f14_arg1, 0, 0, 1, f3_local0.AlienAbilities.Left, 0 ) + f14_arg0:dispatchEventToRoot( { + name = "hide_tip", + immediate = true + } ) + f14_arg0:dispatchEventToRoot( { + name = "dim_all", + immediate = true + } ) + f14_arg0:dispatchEventToChildren( { + name = "button_locked", + immediate = true + } ) + end, + button_over = function ( f15_arg0, f15_arg1 ) + f15_arg0:dispatchEventToRoot( { + name = "show_all", + immediate = true + } ) + f15_arg0:dispatchEventToRoot( { + name = "update_tip", + immediate = true, + new_Text = Engine.Localize( "@ALIENS_EQUALIZER_DESC" ) + } ) + f15_arg0:dispatchEventToRoot( { + name = "show_tip", + immediate = true + } ) + f15_arg0:dispatchEventToRoot( { + name = "selection_info_set_header_text", + immediate = true, + newText = Engine.Localize( "@ALIENS_EQUALIZER" ) + } ) + end + } + } + if f3_local0.getAliensHasPlayerPrestiged( f3_arg0.exclusiveController ) and not f3_local2 then + f3_local3[#f3_local3 + 1] = { + type = "aliens_cac_menu_nerf_button", + id = "nerf_id", + properties = {}, + handlers = { + button_action = function ( f16_arg0, f16_arg1 ) + f16_arg0:dispatchEventToRoot( { + name = "hide_details_btn" + } ) + OpenSelectionMenu( f16_arg0, f16_arg1, 0, 0, 0, 0, 1 ) + f16_arg0:dispatchEventToRoot( { + name = "hide_tip", + immediate = true + } ) + f16_arg0:dispatchEventToRoot( { + name = "dim_all", + immediate = true + } ) + f16_arg0:dispatchEventToChildren( { + name = "button_locked", + immediate = true + } ) + end, + button_over = function ( f17_arg0, f17_arg1 ) + f17_arg0:dispatchEventToRoot( { + name = "show_all", + immediate = true + } ) + f17_arg0:dispatchEventToRoot( { + name = "update_tip", + immediate = true, + new_Text = Engine.Localize( "@ALIENS_NERF_DESC" ) + } ) + f17_arg0:dispatchEventToRoot( { + name = "show_tip", + immediate = true + } ) + f17_arg0:dispatchEventToRoot( { + name = "selection_info_set_header_text", + immediate = true, + newText = Engine.Localize( "@ALIENS_NERF" ), + disabled_in_chaos = true + } ) + end + } + } + end + return f3_local3 +end + +function AltButtonAction( f18_arg0, f18_arg1 ) + if Engine.GetDvarBool( "extinction_cac_enabled" ) then + Engine.PlaySound( CoD.SFX.MouseClick ) + LUI.FlowManager.RequestAddMenu( f18_arg0, "cac_customize_main", true, f18_arg1.controller, false ) + end +end + +function aliens_cac_menu() + local f19_local0 = LUI.mp_menus.AliensPurchasables.UsingExtinctionTokens() and -30 or 0 + return { + type = "UIElement", + id = "aliens_cac_main_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = function ( f20_arg0, f20_arg1 ) + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then + f20_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = Engine.Localize( "@ALIENS_SELECT" ), + side = "left", + clickable = false + } ) + end + if Engine.GetDvarBool( "extinction_cac_enabled" ) then + f20_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_CUSTOMIZE_CHAR" ), + side = "left", + clickable = true + } ) + end + Engine.SetDvarBool( "ui_onlineRequired", false ) + end + , + menu_close = function ( f21_arg0, f21_arg1 ) + f21_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = "", + side = "left", + clickable = false + } ) + Engine.Exec( "uploadstats" ) + end + + }, + children = { + { + type = "generic_menu_title", + id = "menu_title_text", + properties = { + menu_title = Engine.Localize( "@ALIENS_ABILITY_SETUP" ) + } + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id", + handlers = { + menu_create = function ( f22_arg0, f22_arg1 ) + f22_arg0:dispatchEventToRoot( LUI.ButtonHelperText.CommonEvents.addBackButton ) + end + , + rebind_back_button = MBh.EmitEvent( { + name = "rebind", + buttonLeft = ButtonMap.button_secondary + } ) + } + }, + { + type = "UIImage", + id = "bg_top", + states = { + default = { + material = RegisterMaterial( "box_white_gradient_top" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 100, + right = 550, + top = 145 + f19_local0, + bottom = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0.25 + } + } + }, + { + type = "UIVerticalList", + id = "menu_options_continer", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 100, + right = 550, + top = 145 + f19_local0, + bottom = 0, + alignment = LUI.Alignment.Top, + spacing = 1, + alpha = 1 + }, + dim_in = { + alpha = 0.3 + }, + dimmed = { + alpha = 0.3 + } + }, + childrenFeeder = aliensCacFeeder, + handlers = { + dim_all = MBh.AnimateSequence( { + { + "dim_in", + 0 + }, + { + "dimmed", + 100 + } + } ), + show_all = MBh.AnimateToState( "default", 100 ) + } + }, + { + type = "alien_root_info_panel", + id = "alien_root_info_panel" + }, + { + type = "alien_xp_widget", + id = "alien_xp_widget_id", + properties = { + exclusiveController = MBh.Property( "exclusiveController" ) + } + }, + { + type = "alien_tokens_widget", + id = "alien_tokens_widget_id", + properties = { + controller = MBh.Property( "exclusiveController" ), + xPos = 652, + yPos = 115 + } + }, + { + type = "weekly_bonus_widget", + id = "weekly_bonus_widget", + properties = { + controller = MBh.Property( "exclusiveController" ), + xPos = 625, + yPos = 535 + } + }, + { + type = "UIBindButton", + id = "bind_button_id", + handlers = { + button_secondary = MBh.LeaveMenu(), + button_alt1 = AltButtonAction + } + } + } + } +end + +function OpenSelectionMenu( f23_arg0, f23_arg1, f23_arg2, f23_arg3, f23_arg4, f23_arg5, f23_arg6 ) + LUI.FlowManager.RequestPopupMenu( f23_arg0, "aliens_cac_select_ability_menu", true, f23_arg1.controller, false, { + isPerkSlot = f23_arg2, + perkSlot = f23_arg3, + isActionSlot = f23_arg4, + actionSlot = f23_arg5, + isNerfSlot = f23_arg6 + } ) +end + +function RefreshInfoPane( f24_arg0, f24_arg1 ) + f24_arg0:dispatchEventToRoot( { + name = "selection_info_set_message_text", + newText = f24_arg0.properties.button_desc, + immediate = true + } ) + f24_arg0:dispatchEventToRoot( { + name = "selection_info_set_header_text", + newText = f24_arg0.properties.button_text, + immediate = true + } ) + f24_arg0:dispatchEventToRoot( { + name = "update_selection", + ref = f24_arg0.properties.ref, + immediate = true + } ) +end + +function ActionSlotFeeder( f25_arg0 ) + assert( f25_arg0.exclusiveController, "No Exclusive controller found when opening Action Slot Selection Menu." ) + local f25_local0 = assert + local f25_local1 + if f25_arg0.isPerkSlot ~= 1 and f25_arg0.isActionSlot ~= 1 and f25_arg0.isNerfSlot ~= 1 then + f25_local1 = false + else + f25_local1 = true + end + f25_local0( f25_local1 ) + f25_local0 = LUI.mp_menus.Aliens + f25_local1 = 5 + local f25_local2 = {} + local f25_local3 = f25_arg0.exclusiveController + local f25_local4 = nil + local f25_local5 = Lobby.GetAlienRankForXP( f25_local0.getAliensExperience( f25_local3 ) ) + if f25_arg0.isPerkSlot == 1 then + f25_local1 = 4 + assert( f25_arg0.perkSlot ) + f25_local2 = f25_local0.GetBasePerkList( f25_arg0.perkSlot ) + f25_local4 = f25_local0.GetAlienPerk( f25_local3, f25_arg0.perkSlot ) + elseif f25_arg0.isActionSlot == 1 then + assert( f25_arg0.actionSlot ) + f25_local2 = f25_local0.GetBaseAbilityListForActionSlot( f25_arg0.actionSlot ) + f25_local4 = f25_local0.GetAlienAbility( f25_local3, f25_local0.GetDataLabelForSlot( f25_arg0.actionSlot ) ) + elseif f25_arg0.isNerfSlot == 1 then + f25_local2 = f25_local0.GetBaseNerfList() + f25_local1 = #f25_local2 + else + assert( true, "something bad happened, this is not feeding for an action slot of a perk slot, how is that possible?" ) + end + local f25_local6 = {} + for f25_local7 = 1, f25_local1, 1 do + local f25_local10 = "" + local f25_local11 = "" + local f25_local12 = nil + local f25_local13 = "" + local f25_local14 = RegisterMaterial( "white" ) + local f25_local15 = 0 + local f25_local16 = 0 + local f25_local17 = false + if f25_local2[f25_local7] then + local f25_local18 = f25_local2[f25_local7] + f25_local13 = f25_local18 + if f25_arg0.isPerkSlot == 1 then + f25_local10 = Engine.Localize( f25_local0.GetFieldForPerk( f25_local18, f25_local0.AlienPerks.Cols.Name ) ) + f25_local14 = RegisterMaterial( f25_local0.GetFieldForPerk( f25_local18, f25_local0.AlienPerks.Cols.Icon ) ) + f25_local11 = Engine.Localize( f25_local0.GetFieldForPerk( f25_local18, f25_local0.AlienPerks.Cols.Desc ) ) + f25_local15 = tonumber( f25_local0.GetFieldForPerk( f25_local18, f25_local0.AlienPerks.Cols.UnlockedAtRank ) ) + if LUI.mp_menus.AliensPurchasables.UsingExtinctionTokens() then + local f25_local19 = f25_local0.GetFieldForPerk( f25_local18, f25_local0.AlienPerks.Cols.TokenUpgradeName ) + if f25_local19 and f25_local19 ~= "" then + f25_local17 = Engine.AliensCheckIsItemPurchased( f25_arg0.exclusiveController, f25_local19 ) + end + end + if f25_local0.getAliensHasPlayerPrestiged( f25_arg0.exclusiveController ) then + f25_local15 = 0 + end + if f25_local4 == f25_local13 then + local f25_local20 = 1 + end + f25_local16 = f25_local20 or 0 + f25_local12 = function ( f26_arg0, f26_arg1 ) + if f25_local5 < f25_local15 then + return + end + f25_local0.SetAlienPerk( f26_arg1.controller, f25_arg0.perkSlot, f25_local18 ) + LUI.FlowManager.RequestLeaveMenu( f26_arg0 ) + if f25_arg0.perkSlot == 0 and Engine.AliensCheckIsUpgradeEnabled( f25_local3, "multi_class" ) then + LUI.mp_menus.Aliens.setDefaultSecondaryClass( f26_arg1.controller ) + OpenSecondaryClassSelection( f26_arg1.controller ) + end + f26_arg0:dispatchEventToRoot( { + name = "refresh_cac_menu_buttons", + controller = f26_arg1.controller, + immediate = true + } ) + end + + elseif f25_arg0.isActionSlot == 1 then + f25_local10 = Engine.Localize( f25_local0.GetFieldForAbility( f25_local18, f25_local0.AlienAbilities.Cols.Name ) ) + f25_local14 = RegisterMaterial( f25_local0.GetFieldForAbility( f25_local18, f25_local0.AlienAbilities.Cols.Icon ) ) + f25_local11 = Engine.Localize( f25_local0.GetFieldForAbility( f25_local18, f25_local0.AlienAbilities.Cols.Desc ) ) + f25_local15 = tonumber( f25_local0.GetFieldForAbility( f25_local18, f25_local0.AlienAbilities.Cols.UnlockedAtRank ) ) + if f25_local0.getAliensHasPlayerPrestiged( f25_arg0.exclusiveController ) then + f25_local15 = 0 + end + if f25_local4 == f25_local13 then + local f25_local21 = 1 + end + f25_local16 = f25_local21 or 0 + f25_local12 = function ( f27_arg0, f27_arg1 ) + if f25_local5 < f25_local15 then + return + else + f25_local0.SetAlienAbility( f27_arg1.controller, f25_local0.GetDataLabelForSlot( f25_arg0.actionSlot ), f25_local18 ) + f27_arg0:dispatchEventToRoot( { + name = "refresh_cac_menu_buttons", + controller = f27_arg1.controller, + immediate = true + } ) + LUI.FlowManager.RequestLeaveMenu( f27_arg0 ) + end + end + + elseif f25_arg0.isNerfSlot == 1 then + f25_local10 = Engine.Localize( f25_local0.GetFieldForNerf( f25_local18, f25_local0.AlienNerfs.Cols.Name ) ) + f25_local14 = RegisterMaterial( f25_local0.GetFieldForNerf( f25_local18, f25_local0.AlienNerfs.Cols.Icon ) ) + f25_local11 = Engine.Localize( f25_local0.GetFieldForNerf( f25_local18, f25_local0.AlienNerfs.Cols.Desc ) ) + if Engine.AliensCheckIsRelicEnabled( f25_local3, f25_local18 ) then + local f25_local22 = 1 + end + f25_local16 = f25_local22 or 0 + f25_local12 = function ( f28_arg0, f28_arg1 ) + local f28_local0 = f28_arg0.properties.ref + local f28_local1 = Engine.AliensCheckIsRelicEnabled( f28_arg1.controller, f28_local0 ) + local f28_local2 = 0 + if f28_local1 then + LUI.mp_menus.Aliens.SetRelicEnabled( f28_arg1.controller, f28_local0, false ) + elseif f25_local0.getNumEnabledNerfs( f28_arg1.controller ) < f25_local0.getAliensPrestigeLevel( f28_arg1.controller ) then + LUI.mp_menus.Aliens.SetRelicEnabled( f28_arg1.controller, f28_local0, true ) + f28_local2 = 1 + end + f28_arg0:dispatchEventToRoot( { + name = "refresh_cac_menu_buttons", + controller = f28_arg1.controller, + immediate = true + } ) + f28_arg0:processEvent( { + name = "refresh_cac_is_checked", + showAsChecked = f28_local2, + dispatchChildren = true, + immediate = true + } ) + end + + end + end + local f25_local18 = #f25_local6 + 1 + local f25_local19 = { + type = "aliens_cac_ability_button", + id = "selection_at_index" .. f25_local7, + listDefaultFocus = f25_local4 == f25_local13 + } + local f25_local23 = { + button_text = f25_local10, + button_desc = f25_local11, + ref = f25_local13, + icon = f25_local14 + } + local f25_local24 + if f25_local5 < f25_local15 then + f25_local24 = 1 + if not f25_local24 then + + else + f25_local23.LockedOverlayAlpha = f25_local24 + f25_local23.unlockLevel = Rank.GetRankDisplay( tostring( f25_local15 ), CoD.PlayMode.Aliens ) + if f25_local15 <= f25_local5 then + f25_local24 = 1 + if not f25_local24 then + + else + f25_local23.checkBoxAlpha = f25_local24 + f25_local23.showAsChecked = f25_local16 + if f25_local13 ~= "" then + f25_local24 = 1 + if not f25_local24 then + + else + f25_local23.show_icon = f25_local24 + f25_local23.isUpgraded = f25_local17 + f25_local19.properties = f25_local23 + f25_local19.handlers = { + button_action = f25_local12, + button_over = RefreshInfoPane + } + f25_local6[f25_local18] = f25_local19 + end + end + f25_local24 = 0 + end + end + f25_local24 = 0 + end + end + f25_local24 = 0 + end + return f25_local6 +end + +function aliens_cac_select_ability_menu() + return { + type = "UIElement", + id = "aliens_cac_select_ability_menu_id", + properties = { + isPerkSlot = 0, + perkSlot = -1, + isActionSlot = 0, + actionSlot = -1, + isNerfSlot = 0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + hide_select_ability_menu = MBh.AnimateToState( "hidden", 0 ), + show_select_ability_menu = MBh.AnimateToState( "default", 0 ), + update_selection = function ( f30_arg0, f30_arg1 ) + f30_arg0:processEvent( { + name = "updateInfoPanel", + ref = f30_arg1.ref, + isPerk = f30_arg0.properties.isPerkSlot, + isAction = f30_arg0.properties.isActionSlot, + isNerf = f30_arg0.properties.isNerfSlot, + dispatchChildren = true + } ) + end + , + menu_create = function ( f31_arg0, f31_arg1 ) + f31_arg0:dispatchEventToRoot( { + name = "rebind_back_button", + immediate = true + } ) + if Engine.GetDvarBool( "extinction_cac_enabled" ) then + f31_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = "", + side = "left", + clickable = true + } ) + end + end + , + menu_close = function ( f32_arg0, f32_arg1 ) + if Engine.GetDvarBool( "extinction_cac_enabled" ) then + f32_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_CUSTOMIZE_CHAR" ), + side = "left", + clickable = true + } ) + end + end + + }, + children = { + { + type = "alien_info_panel", + id = "info_panel_id" + }, + { + type = "UIGrid", + id = "selection_options_list", + properties = { + isPerkSlot = MBh.Property( "isPerkSlot" ), + perkSlot = MBh.Property( "perkSlot" ), + isActionSlot = MBh.Property( "isActionSlot" ), + actionSlot = MBh.Property( "actionSlot" ), + isNerfSlot = MBh.Property( "isNerfSlot" ), + exclusiveController = MBh.Property( "exclusiveController" ), + hSpacing = 15, + vSpacing = 22 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 600, + width = 555, + top = 150, + bottom = 0 + } + }, + childrenFeeder = ActionSlotFeeder + }, + { + type = "UIBindButton", + id = "bind_button_id", + properties = { + current_selected_ref = "", + isPerk = MBh.Property( "isPerkSlot" ), + isAction = MBh.Property( "isActionSlot" ), + isNerf = MBh.Property( "isNerfSlot" ), + exclusiveController = MBh.Property( "exclusiveController" ) + }, + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +function RefreshButtonTitleText( f33_arg0, f33_arg1 ) + if f33_arg0.properties.isPerkSlot == 1 then + f33_arg0.properties.text = Engine.Localize( LUI.mp_menus.Aliens.GetFieldForPerk( LUI.mp_menus.Aliens.GetAlienPerk( f33_arg1.controller, f33_arg0.properties.perkSlot ), LUI.mp_menus.Aliens.AlienPerks.Cols.Name ) ) + elseif f33_arg0.properties.isActionSlot == 1 then + f33_arg0.properties.text = Engine.Localize( LUI.mp_menus.Aliens.GetFieldForAbility( LUI.mp_menus.Aliens.GetAlienAbility( f33_arg1.controller, LUI.mp_menus.Aliens.GetDataLabelForSlot( f33_arg0.properties.actionSlot ) ), LUI.mp_menus.Aliens.AlienAbilities.Cols.Name ) ) + end + f33_arg0:setText( f33_arg0.properties.text ) +end + +function aliens_cac_menu_button() + return { + type = "UIButton", + id = "loadoutbutton_id", + properties = { + isPerkSlot = 0, + perkSlot = -1, + isActionSlot = 0, + actionSlot = -1, + isNerfSlot = 0, + nerfSlot = -1, + ability_text = "", + ability_text_width = 0, + selected_ability_text = "", + selected_ability_desc_text = "", + icon = "white", + dpadAlpha = 0, + leftArrowAlpha = 0, + rightArrowAlpha = 0, + upArrowAlpha = 0, + downArrowAlpha = 0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 70 + } + }, + children = { + { + type = "UIImage", + id = "btn_divider", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 1, + red = 1, + green = 1, + blue = 1, + alpha = 0.1 + } + } + }, + { + type = "UIImage", + id = "btn_bkg", + states = { + default = { + material = RegisterMaterial( "btn_alien_loadout_rtcap_f" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 25, + red = 1, + green = 1, + blue = 1, + alpha = 0 + }, + dim = { + red = 1, + green = 1, + blue = 1, + alpha = 0.5 + }, + focus = { + red = 1, + green = 1, + blue = 1, + alpha = 0.8 + }, + locked = { + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b, + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateLoop( { + { + "focus", + 0 + }, + { + "dim", + 750 + }, + { + "focus", + 750 + } + } ), + button_up = MBh.AnimateToState( "default", 0 ), + button_locked = MBh.AnimateToState( "focus", 0 ) + } + }, + { + type = "UIImage", + id = "SecondaryClassIcon", + properties = { + isPerkSlot = MBh.Property( "isPerkSlot" ), + perkSlot = MBh.Property( "perkSlot" ) + }, + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 23, + right = 55, + top = 28, + bottom = -10, + red = 1, + green = 1, + blue = 1, + alpha = 0 + }, + invisible = { + alpha = 0 + }, + visible = { + alpha = 1 + }, + focused = { + red = 0, + green = 0, + blue = 0 + }, + unfocused = { + red = 1, + green = 1, + blue = 1 + } + }, + handlers = { + refresh_cac_menu_buttons = function ( f35_arg0, f35_arg1 ) + local f35_local0 = f35_arg0.properties.isPerkSlot + local f35_local1 = f35_arg0.properties.perkSlot + local f35_local2 = f35_arg1.controller + local f35_local3 = LUI.mp_menus.Aliens.GetSecondaryClassRef( f35_local2 ) + if Engine.AliensCheckIsUpgradeEnabled( f35_local2, "multi_class" ) and f35_local3 and f35_local0 == 1 and f35_local1 == 0 then + f35_arg0:setImage( RegisterMaterial( LUI.mp_menus.Aliens.GetFieldForPerk( f35_local3, LUI.mp_menus.Aliens.AlienPerks.Cols.Icon ) ) ) + f35_arg0:animateToState( "visible" ) + else + f35_arg0:animateToState( "invisible" ) + end + end + , + menu_create = function ( f36_arg0, f36_arg1 ) + local f36_local0 = f36_arg0.properties.exclusiveController + if Engine.AliensCheckIsUpgradeEnabled( f36_local0, "multi_class" ) then + local f36_local1 = LUI.mp_menus.Aliens.GetSecondaryClassRef( f36_local0 ) + f36_arg0:processEvent( { + name = "refresh_cac_menu_buttons", + controller = f36_local0 + } ) + end + end + , + button_over = MBh.AnimateToState( "focused", 0 ), + button_up = MBh.AnimateToState( "unfocused", 0 ), + button_locked = MBh.AnimateToState( "focused", 0 ) + } + }, + { + type = "UIElement", + id = "dpad_icon_id", + properties = { + dpadAlpha = MBh.Property( "dpadAlpha" ), + leftArrowAlpha = MBh.Property( "leftArrowAlpha" ), + rightArrowAlpha = MBh.Property( "rightArrowAlpha" ), + upArrowAlpha = MBh.Property( "upArrowAlpha" ), + downArrowAlpha = MBh.Property( "downArrowAlpha" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 50, + top = 10, + bottom = -10, + alpha = MBh.Property( "dpadAlpha" ) + } + }, + children = { + { + type = "UIImage", + id = "up_id", + states = { + default = { + material = RegisterMaterial( "alien_cash_dpad_up" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = MBh.Property( "upArrowAlpha" ) + } + } + }, + { + type = "UIImage", + id = "down_id", + states = { + default = { + material = RegisterMaterial( "alien_cash_dpad_dn" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = MBh.Property( "downArrowAlpha" ) + } + } + }, + { + type = "UIImage", + id = "left_id", + states = { + default = { + material = RegisterMaterial( "alien_cash_dpad_lt" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = MBh.Property( "leftArrowAlpha" ) + } + } + }, + { + type = "UIImage", + id = "right_id", + states = { + default = { + material = RegisterMaterial( "alien_cash_dpad_rt" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = MBh.Property( "rightArrowAlpha" ) + } + } + } + } + }, + { + type = "UIImage", + id = "ability_icon", + properties = { + isPerkSlot = MBh.Property( "isPerkSlot" ), + perkSlot = MBh.Property( "perkSlot" ), + isActionSlot = MBh.Property( "isActionSlot" ), + actionSlot = MBh.Property( "actionSlot" ), + isNerfSlot = MBh.Property( "isNerfSlot" ), + nerfSlot = MBh.Property( "nerfSlot" ), + icon = MBh.Property( "icon" ) + }, + states = { + default = CoD.ColorizeState( Colors.white, { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 58, + width = 48, + height = 48 + } ), + focused = CoD.ColorizeState( Colors.black, { + scale = 0.1 + } ), + unfocused = CoD.ColorizeState( Colors.black, { + scale = 0 + } ) + }, + handlers = { + refresh_cac_menu_buttons = function ( f37_arg0, f37_arg1 ) + if f37_arg0.properties.isPerkSlot == 1 then + f37_arg0.properties.icon = LUI.mp_menus.Aliens.GetFieldForPerk( LUI.mp_menus.Aliens.GetAlienPerk( f37_arg1.controller, f37_arg0.properties.perkSlot ), LUI.mp_menus.Aliens.AlienPerks.Cols.Icon ) + elseif f37_arg0.properties.isActionSlot == 1 then + f37_arg0.properties.icon = LUI.mp_menus.Aliens.GetFieldForAbility( LUI.mp_menus.Aliens.GetAlienAbility( f37_arg1.controller, LUI.mp_menus.Aliens.GetDataLabelForSlot( f37_arg0.properties.actionSlot ) ), LUI.mp_menus.Aliens.AlienAbilities.Cols.Icon ) + end + f37_arg0:setImage( RegisterMaterial( f37_arg0.properties.icon ) ) + end + , + button_over = MBh.AnimateSequence( { + { + "unfocused", + 0 + }, + { + "focused", + 100 + }, + { + "unfocused", + 100 + } + } ), + button_up = MBh.AnimateToState( "default", 0 ), + button_locked = MBh.AnimateToState( "unfocused", 0 ), + menu_create = function ( f38_arg0, f38_arg1 ) + f38_arg0:setImage( f38_arg0.properties.icon ) + end + + } + }, + { + type = "UIText", + id = "ability_text_id", + properties = { + text = MBh.Property( "ability_text" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 120, + right = 0, + top = 5, + bottom = 5 + CoD.TextSettings.NormalFont.Height, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 1 + }, + focus = { + red = 0, + green = 0, + blue = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "focus", 0 ), + button_up = MBh.AnimateToState( "default", 0 ), + button_locked = MBh.AnimateToState( "focus", 0 ) + } + }, + { + type = "UIText", + id = "selected_ability_text_id", + properties = { + isPerkSlot = MBh.Property( "isPerkSlot" ), + perkSlot = MBh.Property( "perkSlot" ), + isActionSlot = MBh.Property( "isActionSlot" ), + actionSlot = MBh.Property( "actionSlot" ), + isNerfSlot = MBh.Property( "isNerfSlot" ), + nerfSlot = MBh.Property( "nerfSlot" ), + text = "", + text_selected = MBh.Property( "selected_ability_text" ), + w = MBh.Property( "ability_text_width" ) + }, + states = { + default = { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = MBh.Property( "w" ), + right = 0, + top = 5, + bottom = 5 + CoD.TextSettings.BoldFont.Height, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + focus = { + red = 0, + green = 0, + blue = 0 + }, + highlight = { + red = 0, + green = 0, + blue = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "highlight", 0 ), + button_up = MBh.AnimateToState( "default", 0 ), + button_locked = MBh.AnimateToState( "focus", 0 ), + refresh_cac_menu_buttons = RefreshButtonTitleText, + menu_create = RefreshButtonTitleText + } + }, + { + type = "UIText", + id = "action_slot_selection_desc", + properties = { + isPerkSlot = MBh.Property( "isPerkSlot" ), + perkSlot = MBh.Property( "perkSlot" ), + isActionSlot = MBh.Property( "isActionSlot" ), + actionSlot = MBh.Property( "actionSlot" ), + isNerfSlot = MBh.Property( "isNerfSlot" ), + nerfSlot = MBh.Property( "nerfSlot" ), + text = MBh.Property( "selected_ability_desc_text" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 120, + right = -5, + top = 25, + bottom = 25 + CoD.TextSettings.NormalFont.Height, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 1 + }, + focus = { + red = 0, + green = 0, + blue = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "focus", 0 ), + button_up = MBh.AnimateToState( "default", 0 ), + button_locked = MBh.AnimateToState( "focus", 0 ), + refresh_cac_menu_buttons = function ( f39_arg0, f39_arg1 ) + if f39_arg0.properties.isPerkSlot == 1 then + f39_arg0.properties.text = Engine.Localize( LUI.mp_menus.Aliens.GetFieldForPerk( LUI.mp_menus.Aliens.GetAlienPerk( f39_arg1.controller, f39_arg0.properties.perkSlot ), LUI.mp_menus.Aliens.AlienPerks.Cols.Desc ) ) + elseif f39_arg0.properties.isActionSlot == 1 then + f39_arg0.properties.text = Engine.Localize( LUI.mp_menus.Aliens.GetFieldForAbility( LUI.mp_menus.Aliens.GetAlienAbility( f39_arg1.controller, LUI.mp_menus.Aliens.GetDataLabelForSlot( f39_arg0.properties.actionSlot ) ), LUI.mp_menus.Aliens.AlienAbilities.Cols.Desc ) ) + end + f39_arg0:setText( f39_arg0.properties.text ) + end + + } + } + } + } +end + +function RelicImagesFeeder() + local f40_local0 = function ( f41_arg0, f41_arg1 ) + if Engine.AliensCheckIsRelicEnabled( f41_arg1.controller, f41_arg0.properties.nerfRef ) then + f41_arg0:animateToState( "visible" ) + else + f41_arg0:animateToState( "dim" ) + end + end + + local f40_local1 = {} + local f40_local2 = LUI.mp_menus.Aliens.GetBaseNerfList() + local f40_local3 = 350 / #f40_local2 + for f40_local4 = 1, #f40_local2, 1 do + local f40_local7 = f40_local2[f40_local4] + f40_local1[#f40_local1 + 1] = { + type = "UIImage", + id = "nerf_icon_" .. f40_local4, + properties = { + nerfRef = f40_local7 + }, + states = { + default = { + material = RegisterMaterial( LUI.mp_menus.Aliens.GetFieldForNerf( f40_local7, LUI.mp_menus.Aliens.AlienNerfs.Cols.Icon ) ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + width = f40_local3, + height = f40_local3, + top = 5, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + focus = { + red = 0, + green = 0, + blue = 0 + }, + unfocus = { + red = 1, + green = 1, + blue = 1 + }, + visible = { + alpha = 1 + }, + dim = { + alpha = 0.15 + } + }, + handlers = { + button_over = MBh.AnimateToState( "focus", 70 ), + button_up = MBh.AnimateToState( "unfocus", 70 ), + button_locked = MBh.AnimateToState( "focus", 0 ), + menu_create = f40_local0, + refresh_cac_menu_buttons = f40_local0 + } + } + end + return f40_local1 +end + +function aliens_cac_menu_nerf_button() + local f42_local0 = 70 + local f42_local1 = LUI.mp_menus.Aliens.GetBaseNerfList() + if #f42_local1 > 5 then + f42_local0 = 350 / #f42_local1 + 10 + end + return { + type = "UIButton", + id = "loadoutbutton_id", + properties = {}, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f42_local0 + } + }, + children = { + { + type = "UIImage", + id = "btn_divider", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = -1, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 0.1 + } + } + }, + { + type = "UIImage", + id = "btn_bkg", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 0 + }, + dim = { + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + }, + focus = { + red = 1, + green = 1, + blue = 1, + alpha = 0.5 + }, + locked = { + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b, + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateLoop( { + { + "focus", + 0 + }, + { + "dim", + 750 + }, + { + "focus", + 750 + } + } ), + button_up = MBh.AnimateToState( "default", 0 ), + button_locked = MBh.AnimateToState( "focus", 0 ) + } + }, + { + type = "UIHorizontalList", + id = "nerf_icons", + properties = {}, + states = { + default = { + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -f42_local0 / 2, + bottom = f42_local0 / 2, + spacing = 10 + }, + focus = { + red = 0, + green = 0, + blue = 0 + }, + unfocus = { + red = 1, + green = 1, + blue = 1 + } + }, + childrenFeeder = RelicImagesFeeder, + handlers = { + button_over = MBh.AnimateToState( "focus", 70 ), + button_up = MBh.AnimateToState( "unfocus", 70 ) + } + } + } + } +end + +function aliens_cac_ability_button( f43_arg0, f43_arg1, f43_arg2 ) + local f43_local0 = 90 + local f43_local1 = 90 + local f43_local2 = f43_arg1 or {} + local f43_local3 = f43_local2.checkBoxAlpha or 1 + local f43_local4 = f43_local2.LockedOverlayAlpha or 0 + local f43_local5 = f43_local2.unlockLevel or 0 + local f43_local6 = f43_local2.showAsChecked or 0 + local f43_local7 = f43_local2.show_icon or 0 + local f43_local8 = f43_local2.isUpgraded or false + local f43_local9 = f43_local2.ref or "" + local f43_local10 = f43_local2.button_text or "" + local f43_local11 = f43_local2.name or "" + local f43_local12 = f43_local2.desc or "" + local f43_local13 = f43_local2.icon + if not f43_local13 then + f43_local13 = RegisterMaterial( "white" ) + end + local self = LUI.UIButton.new() + self.id = "generic_id" + self.properties = { + checkBoxAlpha = f43_local3, + LockedOverlayAlpha = f43_local4, + unlockLevel = f43_local5, + showAsChecked = f43_local6, + show_icon = f43_local7, + isUpgraded = f43_local8, + ref = f43_local9, + button_text = f43_local10, + name = f43_local11, + desc = f43_local12, + icon = f43_local13 + } + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = f43_local0, + top = 0, + bottom = f43_local1 + } ) + self:animateToState( "default" ) + local f43_local15 = LUI.UIElement.new() + f43_local15.id = "bkg_root_id" + f43_local15:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.05 + } ) + f43_local15:registerAnimationState( "over", { + alpha = 0.8 + } ) + f43_local15:registerAnimationState( "over_dim", { + alpha = 0.5 + } ) + f43_local15:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "over", + 0 + }, + { + "over_dim", + 750, + true, + true + }, + { + "over", + 750 + } + } ) ) + f43_local15:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + f43_local15:animateToState( "default" ) + self:addElement( f43_local15 ) + f43_local15:addElement( LUI.mp_menus.CacEditChooseImagePopup.cac_edit_choose_image_button_background( nil, {} ) ) + if f43_local8 then + local f43_local16 = math.random( -50, 50 ) + local f43_local17 = math.random( -20, 10 ) + local f43_local18 = LUI.UIElement.new() + f43_local18:setUseStencil( true ) + f43_local18.id = "stencil_id" + f43_local18:registerAnimationState( "default", { + material = RegisterMaterial( "btn_alien_overlay" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f43_local18:animateToState( "default" ) + self:addElement( f43_local18 ) + local f43_local19 = LUI.UIImage.new() + f43_local19.id = "blood_splat_glow" + f43_local19:registerAnimationState( "default", { + material = RegisterMaterial( "btn_alien_overlay" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -50 + f43_local17, + bottom = 50 + f43_local17, + left = -100 + f43_local16, + right = 100 + f43_local16, + alpha = 0 + } ) + f43_local19:animateToState( "default" ) + f43_local19:registerAnimationState( "glow", { + alpha = 0.2 + } ) + f43_local19:animateToState( "glow" ) + f43_local18:addElement( f43_local19 ) + end + local f43_local16 = LUI.UIImage.new() + f43_local16.id = "selection_tab_id" + f43_local16.properties = { + showAsChecked = f43_local6 + } + f43_local16:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 16, + left = 0, + right = 16, + material = RegisterMaterial( "widg_triangle" ), + alpha = 0 + } ) + f43_local16:registerAnimationState( "focused", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f43_local16:registerAnimationState( "unfocused", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f43_local16:registerAnimationState( "selected", { + red = Colors.alien_frontend_hilite.r, + green = Colors.alien_frontend_hilite.g, + blue = Colors.alien_frontend_hilite.b, + alpha = 1 + } ) + f43_local16:registerEventHandler( "button_over", function ( element, event ) + element:animateToState( element.properties.showAsChecked and "selected" or "focused", 0 ) + end ) + f43_local16:registerEventHandler( "button_up", function ( element, event ) + element:animateToState( element.properties.showAsChecked and "selected" or "unfocused", 0 ) + end ) + f43_local16:registerEventHandler( "menu_create", function ( element, event ) + element:animateToState( element.properties.showAsChecked and "selected" or "unfocused", 0 ) + end ) + f43_local16:registerEventHandler( "refresh_cac_is_checked", function ( element, event ) + local f47_local0 = event.showAsChecked and "selected" or "focused" + element.properties.showAsChecked = event.showAsChecked + element:animateToState( f47_local0, 0 ) + end ) + f43_local16:animateToState( "default" ) + self:addElement( f43_local16 ) + local f43_local17 = LUI.UIImage.new() + f43_local17.id = "ability_icon" + f43_local17:registerAnimationState( "default", { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + width = 64, + height = 64, + scale = 0, + material = f43_local13, + alpha = f43_local7, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f43_local17:registerAnimationState( "focused", { + scale = 0.1, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 1 + } ) + f43_local17:registerAnimationState( "unfocused", { + scale = 0, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 1 + } ) + f43_local17:registerEventHandler( "button_over", MBh.AnimateSequence( { + { + "unfocused", + 0 + }, + { + "focused", + 100 + }, + { + "unfocused", + 100 + } + } ) ) + f43_local17:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + f43_local17:animateToState( "default" ) + self:addElement( f43_local17 ) + local f43_local18 = LUI.UIElement.new() + f43_local18.id = "locked_overlay" + f43_local18:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = f43_local4 + } ) + f43_local18:animateToState( "default" ) + self:addElement( f43_local18 ) + local f43_local19 = LUI.UIImage.new() + f43_local19.id = "lock_img" + f43_local19:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = 0, + bottom = 0, + width = 16, + height = 16, + material = RegisterMaterial( "icon_unlock_active" ) + } ) + f43_local19:animateToState( "default" ) + f43_local18:addElement( f43_local19 ) + local f43_local20 = LUI.UIText.new() + f43_local20.id = "level_req_text" + f43_local20:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + left = 16, + right = 0, + height = CoD.TextSettings.TinyFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + f43_local20:setTextStyle( CoD.TextStyle.Outlined ) + f43_local20:setText( tostring( f43_local5 ) ) + f43_local20:animateToState( "default" ) + f43_local18:addElement( f43_local20 ) + return self +end + +function OpenDescList( f48_arg0, f48_arg1, f48_arg2, f48_arg3, f48_arg4 ) + LUI.FlowManager.RequestPopupMenu( f48_arg0, "alien_description_list", true, f48_arg1.controller, false, { + ref = f48_arg2, + isPerk = f48_arg3, + isAction = f48_arg4, + isNerf = isNerf + } ) +end + +function GetSeperator( f49_arg0 ) + return { + type = "UIImage", + id = f49_arg0, + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = isBold and 0 or 2, + right = isBold and 0 or -2, + top = 0, + bottom = 1, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 0.2 + } + } + } +end + +function DescListFeeder( f50_arg0 ) + assert( f50_arg0.ref ) + local f50_local0 = assert + local f50_local1 = f50_arg0.isPerk + if not f50_local1 then + f50_local1 = f50_arg0.isAction or f50_arg0.isNerf + end + f50_local0( f50_local1 ) + f50_local0 = LUI.mp_menus.Aliens + local f50_local1, f50_local2, f50_local3, f50_local4 = nil + local f50_local5 = { + [#f50_local5 + 1] = GetSeperator( "sep" ) + } + for f50_local6 = 1, 4, 1 do + local f50_local9 = f50_arg0.ref + if f50_local6 > 0 then + f50_local9 = f50_local9 .. "_" .. f50_local6 + end + if f50_arg0.isPerk == 1 then + f50_local1 = f50_local0.GetFieldForPerk( f50_local9, f50_local0.AlienPerks.Cols.Desc ) + f50_local2 = f50_local0.GetFieldForPerk( f50_local9, f50_local0.AlienPerks.Cols.Icon ) + f50_local4 = "" + elseif f50_arg0.isAction then + local f50_local10 = LUI.mp_menus.Aliens + f50_local1 = f50_local0.GetFieldForAbility( f50_local9, f50_local0.AlienAbilities.Cols.Desc ) + f50_local2 = f50_local0.GetFieldForAbility( f50_local9, f50_local0.AlienAbilities.Cols.Icon ) + f50_local4 = "$" .. f50_local0.GetFieldForAbility( f50_local9, f50_local0.AlienAbilities.Cols.CurrencyCost ) + else + f50_local1 = f50_local0.GetFieldForNerf( f50_local9, f50_local0.AlienNerfs.Cols.Desc ) + f50_local2 = f50_local0.GetFieldForNerf( f50_local9, f50_local0.AlienNerfs.Cols.Icon ) + f50_local4 = "" + end + local f50_local10 = #f50_local5 + 1 + local f50_local11 = { + type = "alien_description_item", + id = "desc_item_" .. f50_local6, + focusable = false + } + local f50_local12 = { + descText = Engine.Localize( f50_local1 ) + } + local f50_local13 + if f50_local6 == 0 then + f50_local13 = "" + if not f50_local13 then + + else + f50_local12.upgradeText = f50_local13 + f50_local12.icon = RegisterMaterial( f50_local2 ) + f50_local12.costText = f50_local4 + f50_local12.background_alpha = f50_local6 % 2 and 0.05 or 0 + f50_local11.properties = f50_local12 + f50_local5[f50_local10] = f50_local11 + end + end + f50_local13 = "+" .. f50_local6 + end + return f50_local5 +end + +function DescListCreate( f51_arg0, f51_arg1 ) + +end + +function DescListClose( f52_arg0, f52_arg1 ) + f52_arg0:dispatchEventToRoot( { + name = "show_details_btn" + } ) +end + +function alien_description_list() + return { + type = "UIElement", + id = "desc_list_id", + properties = { + ref = "perk_health", + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 600, + width = 555, + top = 325, + height = 375 + } + }, + handlers = { + menu_create = DescListCreate, + menu_close = DescListClose + }, + children = { + { + type = "UIVerticalList", + id = "descriptions_list_vlist", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + spacing = 1 + } + }, + childrenFeeder = DescListFeeder + }, + { + type = "UIBindButton", + id = "exit_button_handler_id", + handlers = { + button_secondary = MBh.LeaveMenu(), + button_alt1 = MBh.LeaveMenu() + } + } + } + } +end + +function alien_description_item() + local f54_local0 = 68 + local f54_local1 = 48 + local f54_local2 = 48 + return { + type = "UIButton", + id = "desc_item_id", + properties = { + descText = "descText", + upgradeText = "+1", + icon = RegisterMaterial( "specialty_armorvest" ), + costText = "$1111", + background_alpha = 0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f54_local0 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 2, + right = -2, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = MBh.Property( "background_alpha" ) + } + } + }, + { + type = "UIImage", + id = "icon_image_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 10, + right = 10 + f54_local1, + height = f54_local1, + material = MBh.Property( "icon" ), + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + } + }, + { + type = "UIText", + id = "plus_text_id", + properties = { + text = MBh.Property( "upgradeText" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f54_local1 + 8, + right = f54_local1 + 60, + top = 2, + bottom = 2 + CoD.TextSettings.NormalFont.Height, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 1 + } + } + }, + { + type = "UIText", + id = "desc_text_id", + properties = { + text = MBh.Property( "descText" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 115, + right = -55, + top = 12, + bottom = 12 + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + } + } + } + } +end + +function getDetailsButtonPromptText() + return Engine.Localize( "@LUA_MENU_PROMPT_WITH_TEXT", Engine.IsGamepadEnabled() and "LUA_MENU_PAD_ALT1_BUTTON" or "PLATFORM_KB_ALT1_BUTTON", "ALIENS_DETAILS" ) +end + +function getDetailsExpandedButtonPromptText() + return Engine.Localize( "@LUA_MENU_PROMPT_WITH_TEXT", Engine.IsGamepadEnabled() and "LUA_MENU_PAD_ALT1_BUTTON" or "PLATFORM_KB_ALT1_BUTTON", "ALIENS_DETAILS_EXPANDED" ) +end + +function alien_info_panel() + return { + type = "UIElement", + id = "basic_info_panel_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 600, + width = 555, + top = 250, + height = 375 + }, + two_rows_pos = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 600, + width = 555, + top = 350, + height = 275 + } + }, + handlers = { + updateInfoPanel = function ( f58_arg0, f58_arg1 ) + if f58_arg1.isNerf == 1 and 5 < #LUI.mp_menus.Aliens.GetBaseNerfList() then + f58_arg0:animateToState( "two_rows_pos", 0 ) + end + end + + }, + children = { + { + type = "aliens_info_panel_header", + id = "info_panel_header_id" + }, + { + type = "generic_menu_background_withfade", + id = "window_body_id", + children = { + { + type = "UIText", + id = "desc_text_id", + properties = { + text = "", + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 25, + right = -10, + top = 40, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + handlers = { + selection_info_set_message_text = function ( f59_arg0, f59_arg1 ) + f59_arg0:setText( f59_arg1.newText ) + end + + } + }, + { + type = "UIVerticalList", + properties = { + ref = "", + isPerk = 1, + isAction = 0, + isNerf = 0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 90, + bottom = 0, + spacing = 1 + } + }, + childrenFeeder = DescListFeeder, + handlers = { + updateInfoPanel = function ( f60_arg0, f60_arg1 ) + f60_arg0.properties.ref = f60_arg1.ref + f60_arg0.properties.isPerk = f60_arg1.isPerk + f60_arg0.properties.isAction = f60_arg1.isAction + f60_arg0.properties.isNerf = f60_arg1.isNerf + f60_arg0:closeChildren() + if f60_arg1.isNerf ~= 1 then + f60_arg0:processEvent( { + name = "menu_refresh", + immediate = true + } ) + end + end + + } + } + } + } + } + } +end + +function getDetailsSelectPromptText() + return Engine.Localize( "@LUA_MENU_PROMPT_WITH_TEXT", Engine.IsGamepadEnabled() and "LUA_MENU_PAD_PRIMARY_BUTTON" or "PLATFORM_KB_PRIMARY_BUTTON", "ALIENS_SELECT" ) +end + +function alien_root_info_panel() + return { + type = "UIElement", + id = "basic_info_tip_id", + states = { + default = { + alpha = 1, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 600, + width = 555, + top = 145, + height = 475 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + hide_tip = function ( f63_arg0, f63_arg1 ) + f63_arg0:animateToState( "hidden", 100 ) + end + , + show_tip = function ( f64_arg0, f64_arg1 ) + f64_arg0:animateToState( "default", 100 ) + end + + }, + children = { + { + type = "aliens_info_panel_header", + id = "info_panel_tip_header_id" + }, + { + type = "generic_menu_background_withfade", + id = "window_body_id", + children = { + { + type = "UIText", + id = "desc_text_id", + properties = { + text = "", + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 25, + right = -10, + top = 50, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + handlers = { + update_tip = function ( f65_arg0, f65_arg1 ) + f65_arg0:setText( f65_arg1.new_Text ) + end + + } + } + } + } + } + } +end + +function alien_xp_widget( f66_arg0, f66_arg1, f66_arg2 ) + local f66_local0 = LUI.mp_menus.Aliens + local f66_local1 = LUI.mp_menus.Operations + local f66_local2, f66_local3, f66_local4, f66_local5, f66_local6, f66_local7 = f66_local0.getAliensRankData( f66_arg1.exclusiveController ) + local f66_local8 = 0.7 + local f66_local9 = 0.7 + local f66_local10 = 0.7 + local f66_local11 = 360 + local f66_local12 = 23 + local f66_local13 = 25 + local self = LUI.UIElement.new() + self.id = "xp_widget_aliens" + self.properties = { + rank_currLevel = f66_local2, + rank_nextLevel = f66_local4, + rank_percent = f66_local6 + } + self:registerAnimationState( "default", { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + right = -135, + top = 100, + width = f66_local11, + height = 25 + } ) + self:animateToState( "default" ) + if not f66_local7 then + local f66_local15 = f66_local1.operation_progress_bar( nil, { + width = f66_local11, + progress = f66_local6 + } ) + f66_local15:registerAnimationState( "positioned", { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = 1, + bottom = 7 + } ) + f66_local15:animateToState( "positioned" ) + self:addElement( f66_local15 ) + local f66_local16 = LUI.UIImage.new() + f66_local16.id = "curr_bkg_id" + f66_local16:registerAnimationState( "default", { + material = f66_local3, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f66_local13, + right = f66_local13 + f66_local12, + top = 3, + bottom = f66_local12 + } ) + f66_local16:animateToState( "default", 0 ) + self:addElement( f66_local16 ) + local f66_local17 = LUI.UIText.new() + f66_local17.id = "curr_rank_block_id" + f66_local17:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = f66_local13, + top = -CoD.TextSettings.SmallFont.Height / 2 + 3, + bottom = CoD.TextSettings.SmallFont.Height / 2 + 3, + red = f66_local8, + green = f66_local9, + blue = f66_local10, + alpha = 0.7 + } ) + f66_local17:setText( f66_local2 ) + f66_local17:animateToState( "default", 0 ) + self:addElement( f66_local17 ) + local f66_local18 = LUI.UIText.new() + f66_local18.id = "curr_rank_label_id" + f66_local18:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = f66_local13 + f66_local12 + 5, + right = 0, + top = -CoD.TextSettings.SmallFont.Height / 2 + 3, + bottom = CoD.TextSettings.SmallFont.Height / 2 + 3, + red = f66_local8, + green = f66_local9, + blue = f66_local10, + alpha = 0.7 + } ) + f66_local18:setText( Engine.Localize( "@LUA_MENU_CURRENT_RANK" ) ) + f66_local18:animateToState( "default", 0 ) + self:addElement( f66_local18 ) + end + local f66_local15 = LUI.UIImage.new() + f66_local15.id = "next_bkg_id" + f66_local15:registerAnimationState( "default", { + material = f66_local5, + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -f66_local13 - f66_local12, + right = -f66_local13, + top = 3, + bottom = f66_local12 + } ) + f66_local15:animateToState( "default", 0 ) + self:addElement( f66_local15 ) + local f66_local16 = LUI.UIText.new() + f66_local16.id = "next_rank_block_id" + f66_local16:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = -f66_local13, + right = 0, + top = -CoD.TextSettings.SmallFont.Height / 2 + 3, + bottom = CoD.TextSettings.SmallFont.Height / 2 + 3, + red = Colors.alien_frontend_hilite.r, + green = Colors.alien_frontend_hilite.g, + blue = Colors.alien_frontend_hilite.b + } ) + f66_local16:setText( f66_local4 ) + f66_local16:animateToState( "default", 0 ) + self:addElement( f66_local16 ) + local f66_local17 = LUI.UIText.new() + f66_local17.id = "next_rank_label_id" + f66_local17:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = -f66_local13 - f66_local12 - 5, + top = -CoD.TextSettings.SmallFont.Height / 2 + 3, + bottom = CoD.TextSettings.SmallFont.Height / 2 + 3, + red = f66_local8, + green = f66_local9, + blue = f66_local10, + alpha = "0.65" + } ) + local f66_local18 + if f66_local7 then + f66_local18 = Engine.Localize( "@LUA_MENU_MAX_RANK" ) + if not f66_local18 then + + else + f66_local17:setText( f66_local18 ) + f66_local17:animateToState( "default", 0 ) + self:addElement( f66_local17 ) + return self + end + end + f66_local18 = Engine.Localize( "@LUA_MENU_NEXT_RANK" ) +end + +function SetAliensInfoHeaderText( f67_arg0, f67_arg1 ) + assert( f67_arg1.newText ) + f67_arg0.properties.header_text = f67_arg1.newText + local f67_local0 = f67_arg0:getChildById( "button_label_text" ) + f67_local0:setText( f67_arg1.newText ) +end + +function aliens_info_panel_header( f68_arg0, f68_arg1 ) + local f68_local0 = function ( f69_arg0, f69_arg1 ) + f69_arg0:setText( f69_arg1.newText ) + end + + local f68_local1 = function ( f70_arg0, f70_arg1 ) + if LUI.mp_menus.Aliens.IsChaosEnabled() and f70_arg1.disabled_in_chaos then + f70_arg0:animateToState( "visible" ) + else + f70_arg0:animateToState( "default" ) + end + end + + local f68_local2 = 25 + local f68_local3 = -25 + local f68_local4 = LUI.Alignment.Left + local f68_local5 = LUI.Alignment.Right + local f68_local6 = "" + local f68_local7 = LUI.MenuGenerics.generic_menu_titlebar_background( nil, f68_arg1 ) + local f68_local8 = CoD.TextSettings.BoldFont + local f68_local9 = 1 + local self = LUI.UIText.new() + self.id = "title" + self:setText( f68_local6 ) + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -f68_local8.Height / 2 + f68_local9, + height = f68_local8.Height, + left = f68_local2, + right = 0, + font = f68_local8.Font, + alignment = f68_local4 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "selection_info_set_header_text", f68_local0 ) + f68_local7:addElement( self ) + f68_local8 = CoD.TextSettings.NormalFont + local f68_local11 = LUI.UIText.new() + f68_local11.id = "subTitle" + f68_local11:setText( Engine.Localize( "@ALIENS_DISABLED_IN_CHAOS" ) ) + f68_local11:registerAnimationState( "default", { + font = f68_local8.Font, + alignment = f68_local5, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -f68_local8.Height / 2 + f68_local9, + height = f68_local8.Height, + left = 0, + right = f68_local3, + red = Colors.alien_frontend_hilite.r, + green = Colors.alien_frontend_hilite.g, + blue = Colors.alien_frontend_hilite.b, + alpha = 0 + } ) + f68_local11:registerAnimationState( "visible", { + alpha = 1 + } ) + f68_local11:animateToState( "default" ) + f68_local11:registerEventHandler( "selection_info_set_header_text", f68_local1 ) + f68_local7:addElement( f68_local11 ) + return f68_local7 +end + +function secondaryClassOptionsFeeder( f71_arg0 ) + local f71_local0 = LUI.mp_menus.Aliens + local f71_local1 = 0 + local f71_local2 = f71_arg0.exclusiveController + local f71_local3 = f71_local0.GetAlienPerk( f71_local2, f71_local1 ) + local f71_local4 = {} + local f71_local5 = f71_local0.GetBasePerkList( f71_local1 ) + for f71_local6 = 1, #f71_local5, 1 do + local f71_local9 = f71_local6 + if f71_local5[f71_local9] ~= f71_local3 and f71_local5[f71_local9] ~= "perk_none" then + f71_local4[#f71_local4 + 1] = { + type = "UIGenericButton", + id = "class_button_" .. f71_local9, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( f71_local0.GetFieldForPerk( f71_local5[f71_local9], f71_local0.AlienPerks.Cols.Name ) ), + button_action_func = function ( f72_arg0, f72_arg1 ) + f71_local0.SetSecondaryClass( f71_local2, f71_local5[f71_local9] ) + f72_arg0:dispatchEventToRoot( { + name = "refresh_cac_menu_buttons", + controller = f72_arg1.controller + } ) + LUI.FlowManager.RequestLeaveMenu( f72_arg0, true ) + end + } + } + end + end + return f71_local4 +end + +function extinction_secondary_class_popup() + return { + type = "generic_selectionList_popup", + id = "extinction_secondary_class_popup", + properties = { + popup_title = "Choose a secondary class", + popup_childfeeder = secondaryClassOptionsFeeder, + additional_handlers = { + popup_back = function ( f74_arg0, f74_arg1 ) + DebugPrint( "YO BITCHES" ) + local f74_local0 = LUI.mp_menus.Aliens + if f74_local0.GetAlienPerk( f74_arg1.controller, 0 ) == f74_local0.GetSecondaryClassRef( f74_arg1.controller ) then + f74_local0.setDefaultSecondaryClass( f74_arg1.controller ) + f74_arg0:dispatchEventToRoot( { + name = "refresh_cac_menu_buttons", + controller = f74_arg1.controller + } ) + end + end + + } + } + } +end + +function OpenSecondaryClassSelection( f75_arg0 ) + LUI.FlowManager.RequestPopupMenu( nil, "extinction_secondary_class_popup", true, f75_arg0 ) +end + +LUI.MenuBuilder.registerDef( "aliens_cac_menu", aliens_cac_menu ) +LUI.MenuBuilder.registerDef( "aliens_cac_menu_button", aliens_cac_menu_button ) +LUI.MenuBuilder.registerDef( "aliens_cac_menu_nerf_button", aliens_cac_menu_nerf_button ) +LUI.MenuBuilder.registerDef( "aliens_cac_select_ability_menu", aliens_cac_select_ability_menu ) +LUI.MenuBuilder.registerType( "aliens_cac_ability_button", aliens_cac_ability_button ) +LUI.MenuBuilder.registerDef( "extinction_secondary_class_popup", extinction_secondary_class_popup ) +LUI.MenuBuilder.registerDef( "alien_description_list", alien_description_list ) +LUI.MenuBuilder.registerDef( "alien_description_item", alien_description_item ) +LUI.MenuBuilder.registerDef( "alien_info_panel", alien_info_panel ) +LUI.MenuBuilder.registerType( "aliens_info_panel_header", aliens_info_panel_header ) +LUI.MenuBuilder.registerDef( "alien_root_info_panel", alien_root_info_panel ) +LUI.MenuBuilder.registerType( "alien_xp_widget", alien_xp_widget ) +LockTable( _M ) diff --git a/lui/mp_menus/alienspurchasables.dec.lua b/lui/mp_menus/alienspurchasables.dec.lua new file mode 100644 index 0000000..fec03ef --- /dev/null +++ b/lui/mp_menus/alienspurchasables.dec.lua @@ -0,0 +1,1428 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +DebugPrint( "Registering " .. _NAME ) +AlienPurchasableItems = { + File = "mp/alien/alien_purchasable_items.csv", + Cols = { + Idx = 0, + Ref = 1, + Name = 2, + Desc = 3, + Cost = 4, + ReqiredMapPack = 5, + AltDesc = 6 + }, + MaxItems = 32 +} +CLASSIFIED_PACK_THRESHOLD = 4 +SHOW_CLASSIFIED_UPGRADES = true +function UsingExtinctionTokens() + local f1_local0 = Engine.GetDvarInt( "extinction_tokens_enabled" ) + return f1_local0 and f1_local0 > 0 +end + +function PurchasableItem_GetRef( f2_arg0 ) + return Engine.TableLookup( AlienPurchasableItems.File, AlienPurchasableItems.Cols.Idx, tostring( f2_arg0 ), AlienPurchasableItems.Cols.Ref ) +end + +function PurchasableItem_GetIdx( f3_arg0 ) + return Engine.TableLookup( AlienPurchasableItems.File, AlienPurchasableItems.Cols.Ref, f3_arg0, AlienPurchasableItems.Cols.Idx ) +end + +function PurchasableItem_GetCost( f4_arg0 ) + return Engine.TableLookup( AlienPurchasableItems.File, AlienPurchasableItems.Cols.Ref, f4_arg0, AlienPurchasableItems.Cols.Cost ) +end + +function PurchasableItem_GetName( f5_arg0 ) + return Engine.TableLookup( AlienPurchasableItems.File, AlienPurchasableItems.Cols.Ref, f5_arg0, AlienPurchasableItems.Cols.Name ) +end + +function PurchasableItem_GetDesc( f6_arg0 ) + return Engine.TableLookup( AlienPurchasableItems.File, AlienPurchasableItems.Cols.Ref, f6_arg0, AlienPurchasableItems.Cols.Desc ) +end + +function PurchasableItem_GetAltDesc( f7_arg0 ) + return Engine.TableLookup( AlienPurchasableItems.File, AlienPurchasableItems.Cols.Ref, f7_arg0, AlienPurchasableItems.Cols.AltDesc ) +end + +function PurchasableItem_GetRequiredMapPack( f8_arg0 ) + return Engine.TableLookup( AlienPurchasableItems.File, AlienPurchasableItems.Cols.Ref, f8_arg0, AlienPurchasableItems.Cols.ReqiredMapPack ) +end + +function PurchasableItems_IsRestricted( f9_arg0 ) + local f9_local0 = tonumber( PurchasableItem_GetRequiredMapPack( f9_arg0 ) ) + if f9_local0 and f9_local0 >= 1 and f9_local0 <= 4 then + if f9_local0 == 1 and Engine.AnyoneHasAliensDLC1() then + return false + elseif f9_local0 == 2 and Engine.AnyoneHasAliensDLC2() then + return false + elseif f9_local0 == 3 and Engine.AnyoneHasAliensDLC3() then + return false + elseif f9_local0 == 4 and Engine.AnyoneHasAliensDLC4() then + return false + else + return true + end + elseif f9_local0 and f9_local0 > CLASSIFIED_PACK_THRESHOLD then + return true + else + return false + end +end + +function PurchasableItems_IsClassified( f10_arg0 ) + if PurchasableItems_IsRestricted( f10_arg0 ) and tonumber( PurchasableItem_GetRequiredMapPack( f10_arg0 ) ) > CLASSIFIED_PACK_THRESHOLD then + return true + else + return false + end +end + +function GetPlayerTokens( f11_arg0 ) + return Engine.GetPlayerDataReservedInt( f11_arg0, CoD.StatsGroup.Coop, "extinction_tokens" ) or 0 +end + +function SetPlayerTokens( f12_arg0, f12_arg1 ) + Engine.SetPlayerDataReservedInt( f12_arg0, CoD.StatsGroup.Coop, "extinction_tokens", f12_arg1 ) +end + +function CheckCanAfford( f13_arg0, f13_arg1 ) + return f13_arg1 <= GetPlayerTokens( f13_arg0 ) +end + +function AliensSetIsUpgradeEnabledWrapper( f14_arg0, f14_arg1, f14_arg2 ) + Engine.AliensSetIsUpgradeEnabled( f14_arg0, f14_arg1, f14_arg2 ) + if f14_arg1 == "multi_class" and f14_arg2 then + LUI.mp_menus.Aliens.setDefaultSecondaryClass( f14_arg0 ) + end + if f14_arg1 == "combined_ammo_upgrade" and not f14_arg2 then + if LUI.mp_menus.Aliens.GetAlienAbility( f14_arg0, "munition" ) == "dpad_placeholder_ammo_2" then + LUI.mp_menus.Aliens.SetAlienAbility( f14_arg0, "munition", "dpad_team_ammo_reg" ) + end + elseif f14_arg1 == "combined_ammo_upgrade" and f14_arg2 then + LUI.mp_menus.Aliens.SetAlienAbility( f14_arg0, "munition", "dpad_placeholder_ammo_2" ) + end +end + +if Engine.InFrontend() then + function OpenTokenStore( f15_arg0, f15_arg1 ) + if UsingExtinctionTokens() then + LUI.FlowManager.RequestPopupMenu( f15_arg0, "alien_purchasables_main", true, f15_arg1.controller, false, {} ) + end + end + + function TryOneTimePrestigeAward( f16_arg0 ) + if not UsingExtinctionTokens() then + return + elseif Engine.GetPlayerDataReservedInt( f16_arg0, CoD.StatsGroup.Coop, "awarded_prestige_tokens" ) == 0 then + Engine.SetPlayerDataReservedInt( f16_arg0, CoD.StatsGroup.Coop, "awarded_prestige_tokens", 1 ) + local f16_local0 = LUI.mp_menus.Aliens.getAliensPrestigeLevel( f16_arg0 ) + if f16_local0 and f16_local0 > 0 then + local f16_local1 = f16_local0 + SetPlayerTokens( f16_arg0, GetPlayerTokens( f16_arg0 ) + f16_local1 ) + local f16_local2 = {} + if f16_local1 > 1 then + f16_local2.message_text = Engine.Localize( "ALIENS_PRESTIGE_TOKENS_AWARD", tostring( f16_local1 ), tostring( f16_local0 ) ) + else + f16_local2.message_text = Engine.Localize( "ALIENS_PRESTIGE_TOKEN_AWARD", tostring( f16_local1 ), tostring( f16_local0 ) ) + end + LUI.FlowManager.RequestPopupMenu( nil, "aliens_gift_tokens_popup", true, f16_arg0, false, f16_local2 ) + end + end + end + + function PurchasablesFeeder( f17_arg0 ) + local f17_local0 = f17_arg0.exclusiveController + if not f17_local0 then + f17_local0 = Engine.GetFirstActiveController() + end + local f17_local1 = {} + for f17_local2 = 0, AlienPurchasableItems.MaxItems - 1, 1 do + local f17_local5 = Engine.TableLookup( AlienPurchasableItems.File, AlienPurchasableItems.Cols.Idx, tostring( f17_local2 ), AlienPurchasableItems.Cols.Ref ) + if f17_local5 == "" then + break + end + local f17_local6 = { + type = "alien_purchasable_button", + id = "purchase_btn_" .. tostring( f17_local2 ), + properties = { + controller = f17_local0, + itemRef = f17_local5 + } + } + local f17_local7 = PurchasableItems_IsClassified( f17_local5 ) + if not f17_local7 then + f17_local1[#f17_local1 + 1] = f17_local6 + end + if f17_local7 and SHOW_CLASSIFIED_UPGRADES then + f17_local1[#f17_local1 + 1] = f17_local6 + end + end + table.sort( f17_local1, function ( f18_arg0, f18_arg1 ) + if PurchasableItem_GetRequiredMapPack( f18_arg0.properties.itemRef ) < PurchasableItem_GetRequiredMapPack( f18_arg1.properties.itemRef ) then + return true + else + return false + end + end ) + return f17_local1 + end + + function alien_purchasables_main( f19_arg0, f19_arg1, f19_arg2 ) + local self = LUI.UIElement.new() + self.id = "alien_purchasables_root_menu" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + self:registerEventHandler( "menu_create", function ( element, event ) + element:dispatchEventToRoot( { + name = "hide_tip", + immediate = true + } ) + element:dispatchEventToRoot( { + name = "dim_all", + immediate = true + } ) + if Engine.GetDvarBool( "extinction_cac_enabled" ) then + element:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = "", + side = "left", + clickable = true + } ) + end + TryOneTimePrestigeAward( element.properties.exclusiveController ) + end ) + self:registerEventHandler( "menu_close", function ( element, event ) + element:dispatchEventToRoot( { + name = "show_all", + immediate = true + } ) + element:dispatchEventToRoot( { + name = "show_tip", + immediate = true + } ) + if Engine.GetDvarBool( "extinction_cac_enabled" ) then + element:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_CUSTOMIZE_CHAR" ), + side = "left", + clickable = true + } ) + end + end ) + self:animateToState( "default" ) + local f19_local1 = LUI.UIElement.new() + f19_local1.id = "scrolling_menu_group" + f19_local1:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 600, + width = 555, + top = 145, + height = 276 + } ) + f19_local1:animateToState( "default" ) + self:addElement( f19_local1 ) + f19_local1:addElement( LUI.MenuGenerics.generic_menu_titlebar( nil, { + title_bar_text = Engine.Localize( "@LUA_MENU_MP_ARMORY_CAPS" ), + font = CoD.TextSettings.BoldFont, + title_bar_text_indent = 25, + title_bar_alignment = LUI.Alignment.Left + } ) ) + f19_local1:addElement( LUI.MenuGenerics.generic_menu_background_withfade( {}, {} ) ) + local f19_local2 = { + use_arrows = false, + use_scrollbar = true, + bar_width = 7 + } + local f19_local3 + if f19_arg1 then + f19_local3 = f19_arg1.exclusiveController + if not f19_local3 then + + else + f19_local2.exclusiveController = f19_local3 + f19_local3 = LUI.UIScrollingVerticalList.new( { + childrenFeeder = PurchasablesFeeder + }, f19_local2 ) + f19_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 4, + bottom = 0, + left = 4, + right = -7, + spacing = 4 + } ) + f19_local3:animateToState( "default" ) + f19_local1:addElement( f19_local3 ) + local f19_local4 = LUI.MenuGenerics.generic_menu_background_withfade( {}, { + top_offset = 0 + } ) + f19_local4.id = "alien_purchasables_desc_window" + f19_local4:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 600, + width = 555, + top = 429, + height = 200 + } ) + f19_local4:animateToState( "default" ) + self:addElement( f19_local4 ) + local f19_local5 = LUI.UIText.new() + f19_local5.id = "nameLabelId" + f19_local5:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 100, + top = 15, + height = CoD.TextSettings.NormalFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f19_local5:setText( Engine.Localize( "@LUA_MENU_MP_PURCHASABLE_NAME" ) ) + f19_local5:animateToState( "default" ) + f19_local4:addElement( f19_local5 ) + local f19_local6 = LUI.UIText.new() + f19_local6.id = "nameTextId" + f19_local6:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 5, + right = 430, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1 + } ) + f19_local6:registerAnimationState( "classified", { + red = Colors.alien_frontend_hilite.r, + green = Colors.alien_frontend_hilite.g, + blue = Colors.alien_frontend_hilite.b + } ) + f19_local6:registerEventHandler( "update_purchasable_item_desc", function ( element, event ) + element:setText( event.newName ) + if event.isClassified then + element:animateToState( "classified" ) + element:setTextStyle( CoD.TextStyle.Outlined ) + else + element:animateToState( "default" ) + element:setTextStyle( CoD.TextStyle.None ) + end + end ) + f19_local6:animateToState( "default" ) + f19_local5:addElement( f19_local6 ) + local f19_local7 = LUI.UIText.new() + f19_local7.id = "costLabelId" + f19_local7:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 100, + top = 15 + CoD.TextSettings.NormalFont.Height + 2, + height = CoD.TextSettings.NormalFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f19_local7:setText( Engine.Localize( "@LUA_MENU_MP_PURCHASABLE_COST" ) ) + f19_local7:animateToState( "default" ) + f19_local4:addElement( f19_local7 ) + local f19_local8 = LUI.UIImage.new( { + material = RegisterMaterial( "alien_icon_tooth" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 5, + right = 22, + top = 0, + bottom = 0, + alpha = 1 + } ) + f19_local8:registerAnimationState( "hidden", { + alpha = 0 + } ) + f19_local8.id = "tokens_icon_id" + f19_local8:registerEventHandler( "update_purchasable_item_desc", function ( element, event ) + if event.isClassified or event.isRestricted then + element:animateToState( "hidden" ) + else + element:animateToState( "default" ) + end + end ) + f19_local7:addElement( f19_local8 ) + local f19_local9 = LUI.UIText.new() + f19_local9.id = "costTextId" + f19_local9:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 25, + right = 430, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1 + } ) + f19_local9:registerAnimationState( "classified", { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 5, + right = 430, + top = 0, + bottom = 0, + red = Colors.alien_frontend_hilite.r, + green = Colors.alien_frontend_hilite.g, + blue = Colors.alien_frontend_hilite.b + } ) + f19_local9:registerEventHandler( "update_purchasable_item_desc", function ( element, event ) + element:setText( event.newCost ) + if event.isClassified or event.isRestricted then + element:animateToState( "classified" ) + element:setTextStyle( CoD.TextStyle.Outlined ) + else + element:animateToState( "default" ) + element:setTextStyle( CoD.TextStyle.None ) + end + end ) + f19_local9:animateToState( "default" ) + f19_local7:addElement( f19_local9 ) + local f19_local10 = LUI.UIText.new() + f19_local10.id = "descLabelId" + f19_local10:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 100, + top = 15 + 2 * CoD.TextSettings.NormalFont.Height + 4, + height = CoD.TextSettings.NormalFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f19_local10:setText( Engine.Localize( "@LUA_MENU_MP_PURCHASABLE_UPGRADE" ) ) + f19_local10:animateToState( "default" ) + f19_local4:addElement( f19_local10 ) + local f19_local11 = LUI.UIText.new() + f19_local11.id = "descTextId" + f19_local11:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 5, + right = 430, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1 + } ) + f19_local11:registerAnimationState( "classified", { + red = Colors.alien_frontend_hilite.r, + green = Colors.alien_frontend_hilite.g, + blue = Colors.alien_frontend_hilite.b + } ) + f19_local11:registerEventHandler( "update_purchasable_item_desc", function ( element, event ) + element:setText( event.newDesc ) + if event.isClassified then + element:animateToState( "classified" ) + element:setTextStyle( CoD.TextStyle.Outlined ) + else + element:animateToState( "default" ) + element:setTextStyle( CoD.TextStyle.None ) + end + end ) + f19_local11:animateToState( "default" ) + f19_local10:addElement( f19_local11 ) + local f19_local12 = LUI.UIBindButton.new() + f19_local12.id = "purchase_menu_bind_button_id" + f19_local12.m_ownerController = f19_arg1.exclusiveController + f19_local12:registerEventHandler( "button_secondary", MBh.LeaveMenu() ) + self:addElement( f19_local12 ) + return self + end + end + f19_local3 = Engine.GetFirstActiveController() + end + + function alien_purchasable_button( f26_arg0, f26_arg1, f26_arg2 ) + local f26_local0 = 30 + local f26_local1 = 7 + local f26_local2 = 35 + local f26_local3 = f26_arg1.controller + if not f26_local3 then + f26_local3 = Engine.GetFirstActiveController() + end + local f26_local4 = f26_arg1.itemRef or nil + local f26_local5 = tonumber( PurchasableItem_GetCost( f26_local4 ) ) + local f26_local6 = Engine.Localize( PurchasableItem_GetName( f26_local4 ) ) + local f26_local7 = nil + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then + f26_local7 = Engine.Localize( PurchasableItem_GetDesc( f26_local4 ) ) + else + local f26_local8 = PurchasableItem_GetAltDesc( f26_local4 ) + if f26_local8 ~= "" then + f26_local7 = Engine.Localize( f26_local8 ) + else + f26_local7 = Engine.Localize( PurchasableItem_GetDesc( f26_local4 ) ) + end + end + local f26_local8 = Engine.AliensCheckIsItemPurchased( f26_local3, f26_local4 ) + local f26_local9 = Engine.AliensCheckIsUpgradeEnabled( f26_local3, f26_local4 ) + local f26_local10 = PurchasableItems_IsRestricted( f26_local4 ) + local f26_local11 = PurchasableItems_IsClassified( f26_local4 ) + if f26_local11 then + local self = PurchasableItem_GetRequiredMapPack( f26_local4 ) + f26_local5 = Engine.Localize( "@ALIENS_UPGRADE_CLASSIFIED_CAPS" ) + f26_local6 = Engine.Localize( "@ALIENS_UPGRADE_CLASSIFIED_CAPS" ) + f26_local7 = Engine.Localize( "@ALIENS_NEXT_EPISODE" ) + elseif f26_local10 then + f26_local5 = Engine.Localize( "@ALIENS_UPGRADE_REQ_DLC", Engine.Localize( "DLC_MAP_PACK_" .. PurchasableItem_GetRequiredMapPack( f26_local4 ) ) ) + end + local self = LUI.UIButton.new() + self.id = "alien_purchasable_id" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f26_local0 + } ) + self:registerEventHandler( "button_action", function ( element, event ) + local f27_local0 = Engine.AliensCheckIsItemPurchased( f26_local3, f26_local4 ) + if f26_local11 then + + elseif f26_local10 then + if Engine.UserCanAccessStore( event.controller ) then + OpenStorePrompt( event.controller, Engine.Localize( "DLC_MAP_PACK_" .. PurchasableItem_GetRequiredMapPack( f26_local4 ) ) ) + end + elseif f27_local0 then + AliensSetIsUpgradeEnabledWrapper( f26_local3, f26_local4, not Engine.AliensCheckIsUpgradeEnabled( f26_local3, f26_local4 ) ) + element:processEvent( { + name = "refresh_enabled_state" + } ) + element:dispatchEventToRoot( { + name = "refresh_cac_menu_buttons", + controller = event.controller, + immediate = true + } ) + else + TryConfirmPurchase( element, f26_local3, f26_local4, f26_local5 ) + end + end ) + self:registerEventHandler( "menu_create", function ( element, event ) + element:processEvent( { + name = "refresh_purchased_state" + } ) + end ) + self:registerEventHandler( "button_over", function ( element, event ) + element:dispatchEventToRoot( { + name = "update_purchasable_item_desc", + newDesc = f26_local7, + newCost = tostring( f26_local5 ), + newName = f26_local6, + isClassified = f26_local11, + isRestricted = f26_local10 + } ) + end ) + self:animateToState( "default" ) + local f26_local13 = LUI.UIImage.new() + f26_local13.id = "btn_background_id" + f26_local13:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0 + } ) + f26_local13:registerAnimationState( "dimmed", { + alpha = 0.5 + } ) + f26_local13:registerAnimationState( "focus", { + alpha = 0.8 + } ) + f26_local13:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "focus", + 0, + true, + true + }, + { + "focus", + 350, + true, + true + }, + { + "dimmed", + 750, + true, + true + }, + { + "focus", + 750, + true, + true + } + } ) ) + f26_local13:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + f26_local13:animateToState( "default" ) + self:addElement( f26_local13 ) + local f26_local14 = LUI.UIText.new() + f26_local14.id = "main_text" + local f26_local15 = f26_local14 + local f26_local16 = f26_local14.registerAnimationState + local f26_local17 = "default" + local f26_local18 = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = f26_local1, + right = 0, + top = -CoD.TextSettings.NormalFont.Height / 2, + bottom = CoD.TextSettings.NormalFont.Height / 2 + } + local f26_local19 + if f26_local11 then + f26_local19 = Colors.alien_frontend_hilite.r + if not f26_local19 then + + else + f26_local18.red = f26_local19 + if f26_local11 then + f26_local19 = Colors.alien_frontend_hilite.g + if not f26_local19 then + + else + f26_local18.green = f26_local19 + if f26_local11 then + f26_local19 = Colors.alien_frontend_hilite.b + if not f26_local19 then + + else + f26_local18.blue = f26_local19 + f26_local18.alpha = 1 + f26_local16( f26_local15, f26_local17, f26_local18 ) + f26_local15 = f26_local14 + f26_local16 = f26_local14.registerAnimationState + f26_local17 = "focus" + f26_local18 = {} + if f26_local11 then + f26_local19 = Colors.alien_frontend_hilite.r + if not f26_local19 then + + else + f26_local18.red = f26_local19 + if f26_local11 then + f26_local19 = Colors.alien_frontend_hilite.g + if not f26_local19 then + + else + f26_local18.green = f26_local19 + if f26_local11 then + f26_local19 = Colors.alien_frontend_hilite.b + if not f26_local19 then + + else + f26_local18.blue = f26_local19 + f26_local16( f26_local15, f26_local17, f26_local18 ) + f26_local14:registerEventHandler( "button_over", MBh.AnimateToState( "focus", 0 ) ) + f26_local14:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + f26_local14:setText( f26_local6 ) + if f26_local11 then + f26_local14:setTextStyle( CoD.TextStyle.Outlined ) + end + f26_local14:animateToState( "default" ) + self:addElement( f26_local14 ) + f26_local16 = 8 + f26_local15 = LUI.UIImage.new() + f26_local15.id = "restricted_icon" + f26_local15:registerAnimationState( "default", { + material = RegisterMaterial( "icon_unlock_active" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = -8, + bottom = 8, + left = -f26_local16 - 16, + right = -f26_local16, + alpha = 1 + } ) + f26_local15:registerAnimationState( "hidden", { + material = RegisterMaterial( "icon_unlock_active" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = -8, + bottom = 8, + left = -f26_local16 - 16, + right = -f26_local16, + alpha = 0 + } ) + f26_local15:registerEventHandler( "refresh_purchased_state", function ( element, event ) + local f30_local0 = Engine.AliensCheckIsItemPurchased( f26_local3, f26_local4 ) + local f30_local1 = element + local f30_local2 = element.animateToState + local f30_local3 + if f30_local0 then + f30_local3 = "hidden" + if not f30_local3 then + + else + f30_local2( f30_local1, f30_local3, 0 ) + end + end + f30_local3 = "default" + end ) + self:addElement( f26_local15 ) + f26_local17 = 10 + f26_local18 = LUI.UIImage.new() + f26_local18.id = "checkbox" + f26_local18:registerAnimationState( "default", { + material = RegisterMaterial( "box_empty" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = -6, + bottom = 6, + left = -f26_local17 - 12, + right = -f26_local17, + alpha = 1 + } ) + f26_local18:registerAnimationState( "hidden", { + material = RegisterMaterial( "box_empty" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = -6, + bottom = 6, + left = -f26_local17 - 12, + right = -f26_local17, + alpha = 0 + } ) + f26_local18:registerEventHandler( "refresh_purchased_state", function ( element, event ) + local f31_local0 = Engine.AliensCheckIsItemPurchased( f26_local3, f26_local4 ) + local f31_local1 = element + local f31_local2 = element.animateToState + local f31_local3 + if f31_local0 then + f31_local3 = "default" + if not f31_local3 then + + else + f31_local2( f31_local1, f31_local3, 0 ) + end + end + f31_local3 = "hidden" + end ) + self:addElement( f26_local18 ) + f26_local19 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + red = Colors.alien_frontend_hilite.r, + green = Colors.alien_frontend_hilite.g, + blue = Colors.alien_frontend_hilite.b, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 2, + bottom = -2, + left = 2, + right = -2, + alpha = 0 + } ) + f26_local19.id = "checkmark" + f26_local19:registerAnimationState( "checked", { + alpha = 1 + } ) + f26_local19:registerEventHandler( "refresh_enabled_state", function ( element, event ) + local f32_local0 = Engine.AliensCheckIsUpgradeEnabled( f26_local3, f26_local4 ) + local f32_local1 = element + local f32_local2 = element.animateToState + local f32_local3 + if f32_local0 then + f32_local3 = "checked" + if not f32_local3 then + + else + f32_local2( f32_local1, f32_local3, 0 ) + end + end + f32_local3 = "default" + end ) + f26_local18:addElement( f26_local19 ) + if f26_local9 then + f26_local19:animateToState( "checked" ) + else + f26_local19:animateToState( "default" ) + end + if f26_local11 or f26_local10 or not f26_local8 then + f26_local15:animateToState( "default" ) + f26_local18:animateToState( "hidden" ) + else + f26_local15:animateToState( "hidden" ) + f26_local18:animateToState( "default" ) + end + return self + end + end + f26_local19 = 0.2 + end + end + f26_local19 = 0.2 + end + end + f26_local19 = 0.2 + end + end + f26_local19 = Colors.primary_text_color.b + end + end + f26_local19 = Colors.primary_text_color.g + end + end + f26_local19 = Colors.primary_text_color.r + end + + function TryConfirmPurchase( f33_arg0, f33_arg1, f33_arg2, f33_arg3 ) + local f33_local0 = {} + if CheckCanAfford( f33_arg1, f33_arg3 ) then + f33_local0.yes_action = function ( f34_arg0, f34_arg1 ) + ConfirmPurchase( f33_arg0, f33_arg1, f33_arg2, f33_arg3 ) + end + + f33_local0.message_text = Engine.Localize( "LUA_MENU_MP_PURCHASE_CONFIRM", Engine.Localize( PurchasableItem_GetName( f33_arg2 ) ), tostring( f33_arg3 ) ) + LUI.FlowManager.RequestPopupMenu( self, "aliens_confirm_purchase_popup", true, f33_arg1, false, f33_local0 ) + else + f33_local0.message_text = Engine.Localize( "LUA_MENU_MP_PUCRCHASE_DENIED", tostring( f33_arg3 ) ) + LUI.FlowManager.RequestPopupMenu( self, "aliens_cannot_purchase_popup", true, f33_arg1, false, f33_local0 ) + end + end + + function ConfirmPurchase( f35_arg0, f35_arg1, f35_arg2, f35_arg3 ) + if CheckCanAfford( f35_arg1, f35_arg3 ) then + SetPlayerTokens( f35_arg1, GetPlayerTokens( f35_arg1 ) - f35_arg3 ) + Engine.AliensSetIsItemPurchased( f35_arg1, f35_arg2, true ) + AliensSetIsUpgradeEnabledWrapper( f35_arg1, f35_arg2, true ) + f35_arg0:processEvent( { + name = "refresh_purchased_state", + immediate = true + } ) + f35_arg0:processEvent( { + name = "refresh_enabled_state", + immediate = true + } ) + f35_arg0:dispatchEventToRoot( { + name = "refresh_cac_menu_buttons", + controller = f35_arg1, + immediate = true + } ) + end + end + + function aliens_confirm_purchase_popup() + return { + type = "generic_yesno_popup", + id = "confirm_purchase_popup_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ), + yes_text = Engine.Localize( "@MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } + end + + function aliens_cannot_purchase_popup() + return { + type = "generic_confirmation_popup", + id = "aliens_cannot_purchase_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_ERROR" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } + end + + function aliens_gift_tokens_popup() + return { + type = "generic_confirmation_popup", + id = "aliens_cannot_purchase_popup_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_ALIENS" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } + end + + function OpenStorePrompt( f39_arg0, f39_arg1 ) + if Engine.UserCanAccessStore( f39_arg0 ) then + LUI.FlowManager.RequestPopupMenu( self, "aliens_prompt_to_real_money_store", true, f39_arg0, false, { + message_text = Engine.Localize( "@ALIENS_UPGRADE_REQ_DLC_PROMPT", f39_arg1 ) + } ) + end + end + + function GoToStore( f40_arg0, f40_arg1 ) + if Engine.UserCanAccessStore( f40_arg1.controller ) then + LUI.FlowManager.RequestLeaveMenu( f40_arg0 ) + Engine.SetDvarBool( "ui_onlineRequired", true ) + if not Sns.OpenStoreMenu( f40_arg1.controller, "extinction_armory", false, "dlc3" ) then + Engine.SetDvarBool( "ui_onlineRequired", false ) + else + LUI.FlowManager.RequestLeaveMenuByName( "alien_purchasables_main" ) + end + end + end + + function aliens_prompt_to_real_money_store() + return { + type = "generic_yesno_popup", + id = "aliens_prompt_to_real_money_store", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_ALIENS" ), + yes_text = Engine.Localize( "@MENU_YES" ), + yes_action = GoToStore, + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } + end + + function aliens_cac_armory_button() + local f42_local0 = CoD.TextSettings.NormalFont.Height + 10 + local f42_local1 = 120 + local f42_local2 = 110 + local f42_local3 = CoD.TextSettings.NormalFont + local f42_local4 = Engine.Localize( "@LUA_MENU_MP_ARMORY_CAPS" ) + local f42_local5, f42_local6, f42_local7, f42_local8 = GetTextDimensions( f42_local4, f42_local3.Font, f42_local3.Height ) + local f42_local9 = f42_local7 - f42_local5 + f42_local1 + 10 + local self = LUI.UIButton.new() + self.id = "armory_button_id" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f42_local0 + } ) + self:registerEventHandler( "button_action", function ( element, event ) + element:dispatchEventToRoot( { + name = "hide_tip", + immediate = true + } ) + element:dispatchEventToRoot( { + name = "dim_all", + immediate = true + } ) + element:dispatchEventToChildren( { + name = "button_locked", + immediate = true + } ) + OpenTokenStore( element, event ) + end ) + self:registerEventHandler( "button_over", function ( element, event ) + element:dispatchEventToRoot( { + name = "show_all", + immediate = true + } ) + element:dispatchEventToRoot( { + name = "update_tip", + immediate = true, + new_Text = Engine.Localize( "@LUA_MENU_MP_ARMORY_DESC" ) + } ) + element:dispatchEventToRoot( { + name = "show_tip", + immediate = true + } ) + element:dispatchEventToRoot( { + name = "selection_info_set_header_text", + newText = Engine.Localize( "@LUA_MENU_MP_ARMORY_CAPS" ), + disabled_in_chaos = true + } ) + element:dispatchEventToRoot( { + name = "show_bonus_pool", + immediate = true + } ) + end ) + self:registerEventHandler( "button_up", function ( element, event ) + element:dispatchEventToRoot( { + name = "hide_bonus_pool", + immediate = true + } ) + end ) + self:animateToState( "default", 0 ) + local f42_local11 = LUI.UIImage.new() + f42_local11.id = "btn_divider_id" + f42_local11:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 1, + alpha = 0.1 + } ) + f42_local11:animateToState( "default" ) + self:addElement( f42_local11 ) + local f42_local12 = LUI.UIImage.new() + f42_local12.id = "armory_button_background" + f42_local12:registerAnimationState( "default", { + material = RegisterMaterial( "btn_alien_loadout_rtcap_f" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 10, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f42_local12:registerAnimationState( "dim", { + red = 1, + green = 1, + blue = 1, + alpha = 0.5 + } ) + f42_local12:registerAnimationState( "focus", { + red = 1, + green = 1, + blue = 1, + alpha = 0.8 + } ) + f42_local12:registerAnimationState( "locked", { + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b, + alpha = 1 + } ) + f42_local12:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "focus", + 0 + }, + { + "dim", + 750 + }, + { + "focus", + 750 + } + } ) ) + f42_local12:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + f42_local12:registerEventHandler( "button_locked", MBh.AnimateToState( "focus", 0 ) ) + f42_local12:animateToState( "default" ) + self:addElement( f42_local12 ) + local f42_local13 = LUI.UIText.new() + f42_local13.id = "button_lable" + f42_local13:registerAnimationState( "default", { + font = f42_local3.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f42_local1, + right = 0, + top = 5, + bottom = 5 + f42_local3.Height, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 1 + } ) + f42_local13:registerAnimationState( "focus", { + red = 0, + green = 0, + blue = 0 + } ) + f42_local13:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f42_local13:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f42_local13:registerEventHandler( "button_locked", MBh.AnimateToState( "focus" ) ) + f42_local13:animateToState( "default" ) + f42_local13:setText( f42_local4 ) + self:addElement( f42_local13 ) + local f42_local14 = LUI.UIText.new() + f42_local14.id = "button_subtext" + f42_local14:registerAnimationState( "default", { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f42_local9, + right = 0, + top = 5, + bottom = 5 + CoD.TextSettings.BoldFont.Height, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f42_local14:registerAnimationState( "focus", { + red = 0, + green = 0, + blue = 0 + } ) + f42_local14:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f42_local14:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f42_local14:registerEventHandler( "button_locked", MBh.AnimateToState( "focus" ) ) + f42_local14:animateToState( "default" ) + f42_local14:setText( Engine.Localize( "@LUA_MENU_MP_ARMORY_SUBTEXT" ) ) + self:addElement( f42_local14 ) + return self + end + + function weekly_bonus_widget( f46_arg0, f46_arg1, f46_arg2 ) + local f46_local0 = f46_arg1 or {} + local f46_local1 = f46_local0.controller + if not f46_local1 then + f46_local1 = Engine.GetFirstActiveController() + end + local f46_local2 = f46_local0.xPos or 0 + local f46_local3 = f46_local0.yPos or 0 + local self = LUI.UIElement.new() + self.id = "weekly_bonus_widget" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = f46_local2, + right = 0, + top = f46_local3, + bottom = 0, + alpha = 0 + } ) + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self:registerEventHandler( "show_bonus_pool", MBh.AnimateToState( "visible" ) ) + self:registerEventHandler( "hide_bonus_pool", MBh.AnimateToState( "default" ) ) + self:animateToState( "default" ) + if UsingExtinctionTokens() and IsOnlineMatch() then + local f46_local5 = LUI.UIHorizontalList.new() + f46_local5.id = "TextLineOneId" + f46_local5:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height + } ) + f46_local5:animateToState( "default" ) + self:addElement( f46_local5 ) + local f46_local6 = Engine.Localize( "@ALIENS_BONUS_POOL" ) + local f46_local7, f46_local8, f46_local9, f46_local10 = GetTextDimensions( f46_local6, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f46_local11 = f46_local9 - f46_local7 + 5 + local f46_local12 = LUI.UIText.new() + f46_local12.id = "title_text" + f46_local12:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f46_local11, + top = 0, + bottom = 0, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f46_local12:setText( f46_local6 ) + f46_local12:animateToState( "default" ) + f46_local5:addElement( f46_local12 ) + local f46_local13 = tostring( Engine.GetPlayerDataReservedInt( f46_local1, CoD.StatsGroup.Coop, "bonus_pool_size" ) or 0 ) + local f46_local14, f46_local15, f46_local16, f46_local17 = GetTextDimensions( f46_local13, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + f46_local10 = f46_local17 + f46_local9 = f46_local16 + f46_local8 = f46_local15 + f46_local14 = f46_local9 - f46_local14 + 2 + f46_local15 = LUI.UIText.new() + f46_local15.id = "pool_text" + f46_local15:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f46_local14, + top = 0, + bottom = 0, + red = Colors.alien_frontend_hilite.r, + green = Colors.alien_frontend_hilite.g, + blue = Colors.alien_frontend_hilite.b + } ) + f46_local15:setTextStyle( CoD.TextStyle.Outlined ) + f46_local15:setText( f46_local13 ) + f46_local15:animateToState( "default" ) + f46_local5:addElement( f46_local15 ) + f46_local16 = LUI.UIImage.new() + f46_local16.id = "tokens_icon_id" + f46_local16:registerAnimationState( "default", { + material = RegisterMaterial( "alien_icon_tooth" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = CoD.TextSettings.NormalFont.Height, + top = 0, + bottom = 0 + } ) + f46_local16:animateToState( "default" ) + f46_local5:addElement( f46_local16 ) + f46_local17 = LUI.UIText.new() + f46_local17.id = "timer_text" + f46_local17:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = CoD.TextSettings.NormalFont.Height, + bottom = 2 * CoD.TextSettings.NormalFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + local f46_local18, f46_local19, f46_local20, f46_local21 = Engine.GetExtinctionBonusDeadline( f46_local1 ) + f46_local17:setText( Engine.Localize( "LUA_MENU_DAYS_HOURS_MINUTES_SECONDS", f46_local18, f46_local19, f46_local20, f46_local21 ) ) + f46_local17:registerEventHandler( "set_countdown_time", function ( element, event ) + local f47_local0, f47_local1, f47_local2, f47_local3 = Engine.GetExtinctionBonusDeadline( f46_local1 ) + element:setText( Engine.Localize( "LUA_MENU_DAYS_HOURS_MINUTES_SECONDS", f47_local0, f47_local1, f47_local2, f47_local3 ) ) + Engine.UpdateExtinctionBonusDeadline( f46_local1 ) + end ) + f46_local17:animateToState( "default" ) + self:addElement( f46_local17 ) + local f46_local22 = LUI.UITimer.new( 500, "set_countdown_time", nil, false, false, false, false ) + f46_local22.id = "bonus_countdown_timer" + f46_local17:addElement( f46_local22 ) + local f46_local23 = LUI.UIText.new() + f46_local23.id = "subText1" + f46_local23:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 2 * CoD.TextSettings.NormalFont.Height, + bottom = 3 * CoD.TextSettings.NormalFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f46_local23:setText( Engine.Localize( "@ALIENS_BONUS_POOL_TIP" ) ) + f46_local23:animateToState( "default" ) + self:addElement( f46_local23 ) + local f46_local24 = LUI.UIText.new() + f46_local24.id = "subText2" + f46_local24:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 3 * CoD.TextSettings.NormalFont.Height, + bottom = 4 * CoD.TextSettings.NormalFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f46_local24:setText( Engine.Localize( "@ALIENS_BONUS_POOL_DESC" ) ) + f46_local24:animateToState( "default" ) + self:addElement( f46_local24 ) + end + return self + end + + LUI.MenuBuilder.registerType( "alien_purchasables_main", alien_purchasables_main ) + LUI.MenuBuilder.registerType( "alien_purchasable_button", alien_purchasable_button ) + LUI.MenuBuilder.registerType( "aliens_cac_armory_button", aliens_cac_armory_button ) + LUI.MenuBuilder.registerDef( "aliens_confirm_purchase_popup", aliens_confirm_purchase_popup ) + LUI.MenuBuilder.registerDef( "aliens_cannot_purchase_popup", aliens_cannot_purchase_popup ) + LUI.MenuBuilder.registerDef( "aliens_gift_tokens_popup", aliens_gift_tokens_popup ) + LUI.MenuBuilder.registerDef( "aliens_prompt_to_real_money_store", aliens_prompt_to_real_money_store ) + LUI.MenuBuilder.registerType( "weekly_bonus_widget", weekly_bonus_widget ) +end +function alien_tokens_widget( f48_arg0, f48_arg1, f48_arg2 ) + local f48_local0 = f48_arg1.controller + if not f48_local0 then + f48_local0 = Engine.GetFirstActiveController() + end + local f48_local1 = GetPlayerTokens( f48_local0 ) + local f48_local2 = f48_arg1.xPos or 300 + local f48_local3 = f48_arg1.yPos or 100 + local f48_local4 = CoD.TextSettings.NormalFont + local f48_local5 = f48_local4.Height + local f48_local6 = 44 + local f48_local7 = 6 + local f48_local8 = 100 + local self = LUI.UIElement.new() + self.id = "tokens_widget_id" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f48_local2, + top = f48_local3, + height = f48_local5, + width = f48_local8 + } ) + self:animateToState( "default" ) + if UsingExtinctionTokens() then + local f48_local10 = LUI.UIImage.new() + f48_local10.id = "bgIcon_id" + f48_local10:registerAnimationState( "default", { + material = RegisterMaterial( "alien_icon_tooth_bg" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + right = 58, + bottom = 50, + width = 128, + height = 128 + } ) + f48_local10:animateToState( "default" ) + self:addElement( f48_local10 ) + local f48_local11 = LUI.UIText.new() + f48_local11.id = "cost_text" + f48_local11:registerAnimationState( "default", { + font = f48_local4.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = -3, + right = -3, + top = -f48_local4.Height / 2 - 3, + bottom = f48_local4.Height / 2 - 3, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f48_local11:setTextStyle( CoD.TextStyle.Outlined ) + f48_local11:registerEventHandler( "refresh_bank", function ( element, event ) + element:setText( tostring( GetPlayerTokens( f48_local0 ) ) ) + end ) + f48_local11:setText( tostring( f48_local1 ) ) + f48_local11:animateToState( "default" ) + self:addElement( f48_local11 ) + local f48_local12 = LUI.UIImage.new() + f48_local12.id = "tokens_icon_id" + f48_local12:registerAnimationState( "default", { + material = RegisterMaterial( "alien_icon_tooth" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + right = 0, + bottom = 10, + width = 32, + height = 44 + } ) + f48_local12:animateToState( "default" ) + self:addElement( f48_local12 ) + self:addElement( LUI.UITimer.new( 200, "refresh_bank", nil, false, false, false, false ) ) + end + return self +end + +LUI.MenuBuilder.registerType( "alien_tokens_widget", alien_tokens_widget ) +LockTable( _M ) diff --git a/lui/mp_menus/archetypeselect.dec.lua b/lui/mp_menus/archetypeselect.dec.lua new file mode 100644 index 0000000..a39ddf6 --- /dev/null +++ b/lui/mp_menus/archetypeselect.dec.lua @@ -0,0 +1,954 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1, f1_arg2, f1_arg3, f1_arg4 ) + if f1_arg4 == nil or f1_arg4 == "" then + return + else + Engine.SetPlayerDataEx( f1_arg0, f1_arg1, f1_arg2, f1_arg3, "challengeState", "ch_" .. string.sub( f1_arg4, 5 ) .. "_purchase", 2 ) + end +end + +f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4 ) + if f2_arg4 == nil or f2_arg4 == "" then + return + else + Engine.SetPlayerDataEx( f2_arg0, f2_arg1, f2_arg2, f2_arg3, "challengeState", "ch_" .. f2_arg4 .. "_purchase", 2 ) + end +end + +f0_local2 = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3, f3_arg4, f3_arg5 ) + if f3_arg4 == nil or f3_arg4 == "" or f3_arg4 == "none" or f3_arg5 == nil or f3_arg5 == "" or f3_arg5 == "none" then + return + else + Engine.SetPlayerDataEx( f3_arg0, f3_arg1, f3_arg2, f3_arg3, "challengeState", "ch_" .. string.sub( f3_arg4, 5 ) .. "_" .. f3_arg5 .. "_purchase", 2 ) + end +end + +local f0_local3 = function ( f4_arg0, f4_arg1, f4_arg2, f4_arg3, f4_arg4 ) + if f4_arg4 == nil or f4_arg4 == "" or f4_arg4 == "specialty_null" then + return + else + Engine.SetPlayerDataEx( f4_arg0, f4_arg1, f4_arg2, f4_arg3, "challengeState", "ch_" .. f4_arg4 .. "_purchase", 2 ) + end +end + +local f0_local4 = function ( f5_arg0, f5_arg1, f5_arg2 ) + return Engine.TableLookup( f5_arg0, 0, f5_arg2, f5_arg1 % 10 + 1 ) +end + +local f0_local5 = function ( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5 ) + local f6_local0 = f0_local4( f6_arg5, f6_arg4, "loadoutEquipment" ) + Cac.SetCacConfig( f6_arg0, f6_arg2, f6_arg3, "loadouts", f6_arg4, "perks", Cac.Indices.Grenade.Primary, f6_local0 ) + f0_local3( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_local0 ) + f6_local0 = f0_local4( f6_arg5, f6_arg4, "loadoutOffhand" ) + Cac.SetCacConfig( f6_arg0, f6_arg2, f6_arg3, "loadouts", f6_arg4, "perks", Cac.Indices.Grenade.Secondary, f6_local0 ) + f0_local3( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_local0 ) +end + +local f0_local6 = function ( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_arg4, f7_arg5, f7_arg6, f7_arg7 ) + local f7_local0 = f0_local4( f7_arg7, f7_arg4, "loadout" .. f7_arg6 ) + local f7_local1 = f0_local4( f7_arg7, f7_arg4, "loadout" .. f7_arg6 .. "Attachment" ) + local f7_local2 = f0_local4( f7_arg7, f7_arg4, "loadout" .. f7_arg6 .. "Attachment2" ) + local f7_local3 = f0_local4( f7_arg7, f7_arg4, "loadout" .. f7_arg6 .. "Attachment3" ) + local f7_local4 = f0_local4( f7_arg7, f7_arg4, "loadout" .. f7_arg6 .. "Camo" ) + Cac.SetCacConfig( f7_arg0, f7_arg2, f7_arg3, "loadouts", f7_arg4, "weaponSetups", f7_arg5, "weapon", f7_local0 ) + Cac.SetCacConfig( f7_arg0, f7_arg2, f7_arg3, "loadouts", f7_arg4, "weaponSetups", f7_arg5, "attachment", 0, f7_local1 ) + Cac.SetCacConfig( f7_arg0, f7_arg2, f7_arg3, "loadouts", f7_arg4, "weaponSetups", f7_arg5, "attachment", 1, f7_local2 ) + Cac.SetCacConfig( f7_arg0, f7_arg2, f7_arg3, "loadouts", f7_arg4, "weaponSetups", f7_arg5, "attachment", 2, f7_local3 ) + f0_local0( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_local0 ) + f0_local2( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_local0, f7_local1 ) + f0_local2( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_local0, f7_local2 ) + f0_local2( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_local0, f7_local3 ) + local f7_local5 = { + f7_local1, + f7_local2, + f7_local3 + } + local f7_local6 = "none" + for f7_local10, f7_local11 in ipairs( f7_local5 ) do + if f7_local11 and f7_local11 ~= "" and Cac.AttachmentHasReticles( f7_local11 ) then + f7_local6 = Cac.GetReticleDefault( f7_local11 ) + break + end + end + Cac.SetCacConfig( f7_arg0, f7_arg2, f7_arg3, "loadouts", f7_arg4, "weaponSetups", f7_arg5, "reticle", f7_local6 ) +end + +local f0_local7 = function ( f8_arg0, f8_arg1, f8_arg2, f8_arg3, f8_arg4, f8_arg5 ) + for f8_local0 = 1, 7, 1 do + for f8_local3 = 1, 5, 1 do + Cac.SetCacConfig( f8_arg0, f8_arg2, f8_arg3, "loadouts", f8_arg4, "abilitiesPicked", f8_local0 - 1, f8_local3 - 1, false ) + end + end + for f8_local0 = 1, 8, 1 do + local f8_local3 = f0_local4( f8_arg5, f8_arg4, "loadoutPerk" .. f8_local0 ) + if f8_local3 == "" then + break + end + local f8_local4 = string.sub( f8_local3, 1, 1 ) + local f8_local5 = string.sub( f8_local3, 2, 2 ) + f8_local4 = f8_local4 + 0 + f8_local5 = f8_local5 + 0 + Cac.SetCacConfig( f8_arg0, f8_arg2, f8_arg3, "loadouts", f8_arg4, "abilitiesPicked", f8_local4 - 1, f8_local5 - 1, true ) + f0_local1( f8_arg0, f8_arg1, f8_arg2, f8_arg3, Engine.TableLookupByRow( "mp/cacAbilityTable.csv", f8_local4 + 1, f8_local5 + 3 ) ) + end +end + +local f0_local8 = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_arg4, f9_arg5 ) + for f9_local0 = 0, 5, 1 do + local f9_local3 = f0_local4( f9_arg5, f9_arg4, "loadoutStreak" .. f9_local0 ) + local f9_local4 = "assaultStreaks" + local f9_local5 = f9_local0 + if f9_local0 > 2 then + f9_local4 = "supportStreaks" + f9_local5 = f9_local0 - 3 + end + Cac.SetCacConfig( f9_arg0, f9_arg2, f9_arg3, "loadouts", f9_arg4, f9_local4, f9_local5, f9_local3 ) + end +end + +local f0_local9 = function ( f10_arg0 ) + local f10_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "menu_archetype_select" ) + local f10_local1 = f10_local0.csvTable + local f10_local2 = CoD.GetStatsGroupForGameMode() + local f10_local3 = f10_local0.exclusiveController + local f10_local4 = Cac.GetSquadLoc() + local f10_local5 = Cac.GetEditSquadMember() + for f10_local6 = 0, Cac.Settings.DataLoc.loadouts.baseClassSlots - 1, 1 do + Cac.SetCacConfig( f10_local3, f10_local4, f10_local5, "loadouts", f10_local6, "name", Engine.Localize( f0_local4( f10_local1, f10_local6, "loadoutName" ) ) ) + f0_local6( f10_local3, f10_local2, f10_local4, f10_local5, f10_local6, 0, "Primary", f10_local1 ) + f0_local6( f10_local3, f10_local2, f10_local4, f10_local5, f10_local6, 1, "Secondary", f10_local1 ) + f0_local5( f10_local3, f10_local2, f10_local4, f10_local5, f10_local6, f10_local1 ) + f0_local7( f10_local3, f10_local2, f10_local4, f10_local5, f10_local6, f10_local1 ) + f0_local8( f10_local3, f10_local2, f10_local4, f10_local5, f10_local6, f10_local1 ) + local f10_local9 = false + if f10_local6 <= 2 then + f10_local9 = true + end + Cac.SetClassInUse( f10_local3, f10_local4, f10_local5, "loadouts", f10_local6, f10_local9 ) + end + Engine.SetPlayerDataEx( f10_local3, f10_local2, f10_local4, f10_local5, "defaultSet", true ) + LUI.FlowManager.RequestLeaveMenu( self, true ) + if f10_local5 == 0 and f10_local0.findMatch then + LUI.FlowManager.RequestAddMenu( f10_arg0, "menu_xboxlive", false, f10_local3, true ) + if SvS.IsSvS() then + LUI.FlowManager.RequestSetStack( self, { + { + name = "mp_main_menu" + }, + { + name = "squads_mode_select_menu" + } + } ) + else + LUI.FlowManager.RequestSetStack( self, { + { + name = "mp_main_menu" + } + } ) + end + else + LUI.FlowManager.RequestLeaveMenu( self, true ) + end +end + +function confirmation_popup() + local f11_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "menu_archetype_select" ) + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@LUA_MENU_STARTING_UNLOCKS_DESC", f11_local0.loadoutType, Engine.MarkLocalized( Cac.GetSquadMemberName( f11_local0.exclusiveController, Cac.GetSquadLoc(), Cac.GetEditSquadMember() ) ) ), + popup_title = Engine.Localize( "@LUA_MENU_CONFIRM" ), + yes_action = f0_local9 + } + } +end + +local f0_local10 = function ( f12_arg0 ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "menu_archetype_select" ) + f12_local0.csvTable = f12_arg0.properties.csvTable + f12_local0.loadoutType = f12_arg0.properties.button_text + LUI.FlowManager.RequestPopupMenu( f12_arg0, "confirmation_popup", true, f12_arg0.properties.exclusiveController, false, f12_local0 ) +end + +function updateArchetypeDetailsInfo( f13_arg0, f13_arg1 ) + local f13_local0 = f13_arg0.properties.csvTable + local f13_local1 = Engine.TableLookup( f13_local0, 0, "loadoutPrimary", 1 ) + local f13_local2 = Engine.TableLookup( f13_local0, 0, "loadoutPrimaryAttachment", 1 ) + local f13_local3 = Engine.TableLookup( f13_local0, 0, "loadoutPrimaryAttachment2", 1 ) + local f13_local4 = Engine.TableLookup( f13_local0, 0, "loadoutPrimaryAttachment3", 1 ) + local f13_local5 = Engine.TableLookup( "mp/statsTable.csv", 4, Engine.TableLookup( f13_local0, 0, "loadoutPrimary", 1 ), 6 ) .. "_360" + local f13_local6 = Engine.Localize( f13_arg0.properties.archetype_primary_desc, Engine.Localize( "@" .. Engine.TableLookup( "mp/statsTable.csv", 4, f13_local1, 3 ) ) ) + local f13_local7 = Engine.TableLookup( f13_local0, 0, "loadoutSecondary", 1 ) + local f13_local8 = Engine.TableLookup( f13_local0, 0, "loadoutSecondaryAttachment", 1 ) + local f13_local9 = Engine.TableLookup( f13_local0, 0, "loadoutSecondaryAttachment2", 1 ) + local f13_local10 = Engine.TableLookup( "mp/statsTable.csv", 4, Engine.TableLookup( f13_local0, 0, "loadoutSecondary", 1 ), 6 ) .. "_360" + local f13_local11 = Engine.Localize( f13_arg0.properties.archetype_secondary_desc, Engine.Localize( "@" .. Engine.TableLookup( "mp/statsTable.csv", 4, f13_local7, 3 ) ) ) + f13_local1 = Cac.BuildWeaponName( f13_local1, f13_local2, f13_local3, nil, nil, f13_local4 ) + f13_local7 = Cac.BuildWeaponName( f13_local7, f13_local8, f13_local9 ) + local f13_local12 = {} + for f13_local13 = 1, 4, 1 do + f13_local12[f13_local13] = { + newArchetypePerkIcon = Engine.TableLookup( "mp/perkTable.csv", 11, Engine.TableLookup( f13_local0, 0, "loadoutPerk" .. f13_local13, 1 ), 3 ), + newArchetypePerkTitle = Engine.Localize( Engine.TableLookup( "mp/perkTable.csv", 11, Engine.TableLookup( f13_local0, 0, "loadoutPerk" .. f13_local13, 1 ), 2 ) ), + newArchetypePerkDesc = Engine.Localize( Engine.TableLookup( "mp/perkTable.csv", 11, Engine.TableLookup( f13_local0, 0, "loadoutPerk" .. f13_local13, 1 ), 4 ) ) + } + end + f13_arg0:dispatchEventToRoot( { + name = "updateArchetypeLoadoutInfo", + newArchetypeIcon = f13_arg0.properties.archetype_icon, + newArchetypeTitle = f13_arg0.properties.archetype_title, + newArchetypeDesc = f13_arg0.properties.archetype_desc, + newArchetypePrimaryIcon = f13_local5, + newArchetypeSecondaryIcon = f13_local10, + newArchetypePrimaryDesc = f13_local6, + newArchetypeSecondaryDesc = f13_local11, + newArchetypePerkData = f13_local12, + immediate = true + } ) + f13_arg0:dispatchEventToRoot( { + name = "update_squad_member_window_weapon", + weapon = f13_local1 + } ) + f13_arg0:dispatchEventToRoot( { + name = "update_squad_member_window_stowed_weapon", + weapon = f13_local7 + } ) +end + +function ArchetypeSelectOptionsFeeder( f14_arg0 ) + local f14_local0 = { + [#f14_local0 + 1] = { + type = "UIGenericButton", + id = "assaultSetButtonID", + properties = { + button_text = Engine.Localize( "@LUA_MENU_ASSAULT" ), + button_action_func = f0_local10, + button_over_func = updateArchetypeDetailsInfo, + csvTable = "mp/classTableAssault.csv", + archetype_icon = "icon_loadout_assault", + archetype_title = "@LUA_MENU_ASSAULT", + archetype_desc = "@LUA_MENU_ASSAULT_DESC", + archetype_primary_desc = "@LUA_MENU_ASSAULT_WEAPON_DESC", + archetype_secondary_desc = "@LUA_MENU_HANDGUN_WEAPON_DESC" + } + }, + [#f14_local0 + 1] = { + type = "UIGenericButton", + id = "cqbSetButtonID", + properties = { + button_text = Engine.Localize( "@LUA_MENU_CQB" ), + button_action_func = f0_local10, + button_over_func = updateArchetypeDetailsInfo, + csvTable = "mp/classTableCQB.csv", + archetype_icon = "icon_loadout_cqb", + archetype_title = "@LUA_MENU_CQB", + archetype_desc = "@LUA_MENU_CQB_DESC", + archetype_primary_desc = "@LUA_MENU_CQB_WEAPON_DESC", + archetype_secondary_desc = "@LUA_MENU_HANDGUN_WEAPON_DESC" + } + }, + [#f14_local0 + 1] = { + type = "UIGenericButton", + id = "covertOpsSetButtonID", + properties = { + button_text = Engine.Localize( "@LUA_MENU_COVERT_OPS" ), + button_action_func = f0_local10, + button_over_func = updateArchetypeDetailsInfo, + csvTable = "mp/classTableAssassin.csv", + archetype_icon = "icon_loadout_covertops", + archetype_title = "@LUA_MENU_COVERT_OPS", + archetype_desc = "@LUA_MENU_COVERT_OPS_DESC", + archetype_primary_desc = "@LUA_MENU_COVERT_DESC", + archetype_secondary_desc = "@LUA_MENU_HANDGUN_WEAPON_DESC" + } + }, + [#f14_local0 + 1] = { + type = "UIGenericButton", + id = "heavyGunnerSetButtonID", + properties = { + button_text = Engine.Localize( "@LUA_MENU_HEAVY_GUNNER" ), + button_action_func = f0_local10, + button_over_func = updateArchetypeDetailsInfo, + csvTable = "mp/classTableHeavyGunner.csv", + archetype_icon = "icon_loadout_heavygunner", + archetype_title = "@LUA_MENU_HEAVY_GUNNER", + archetype_desc = "@LUA_MENU_HEAVY_GUNNER_DESC", + archetype_primary_desc = "@LUA_MENU_HEAVY_GUNNER_WEAPON_DESC", + archetype_secondary_desc = "@LUA_MENU_GL_WEAPON_DESC" + } + }, + [#f14_local0 + 1] = { + type = "UIGenericButton", + id = "marksmanSetButtonID", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MARKSMAN" ), + button_action_func = f0_local10, + button_over_func = updateArchetypeDetailsInfo, + csvTable = "mp/classTableSniper.csv", + archetype_icon = "icon_loadout_marksman", + archetype_title = "@LUA_MENU_MARKSMAN", + archetype_desc = "@LUA_MENU_MARKSMAN_DESC", + archetype_primary_desc = "@LUA_MENU_MARKSMAN_RIFLE_DESC", + archetype_secondary_desc = "@LUA_MENU_HANDGUN_BURST_WEAPON_DESC" + } + } + } + return f14_local0 +end + +function ArchetypePerkFeeder( f15_arg0 ) + local f15_local0 = { + [#f15_local0 + 1] = { + type = "archetype_loadout_perk_widget", + properties = { + perkNum = 1 + } + }, + [#f15_local0 + 1] = { + type = "archetype_loadout_perk_widget", + properties = { + perkNum = 2 + } + }, + [#f15_local0 + 1] = { + type = "archetype_loadout_perk_widget", + properties = { + perkNum = 3 + } + }, + [#f15_local0 + 1] = { + type = "archetype_loadout_perk_widget", + properties = { + perkNum = 4 + } + } + } + return f15_local0 +end + +function archetype_loadout_header() + return { + type = "UIElement", + properties = { + topOffset = 0, + titleText = "", + decText = "", + isForPrimary = false + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = MBh.Property( "topOffset" ), + left = 1, + right = -1, + height = 30 + } + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.GenericMenu.BorderAlpha + } ) + } + }, + { + type = "UIText", + id = "archetype_loadout_header_title_id", + properties = { + text = MBh.Property( "titleText" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 4, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + } + }, + { + type = "UIMarqueeText", + id = "archetype_loadout_header_desc_id", + properties = { + text = MBh.Property( "decText" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = -4, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + } + } + }, + handlers = { + updateArchetypeLoadoutInfo = function ( f17_arg0, f17_arg1 ) + local f17_local0 = 8 + local f17_local1, f17_local2, f17_local3, f17_local4 = GetTextDimensions( f17_arg0.properties.titleText, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f17_local5 = f17_local3 - f17_local1 + local f17_local6 = f17_arg0.properties.isForPrimary and f17_arg1.newArchetypePrimaryDesc or f17_arg1.newArchetypeSecondaryDesc + local f17_local7 = f17_arg0:getChildById( "archetype_loadout_header_desc_id" ) + f17_local7:registerAnimationState( "updated", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f17_local5 + f17_local0, + right = -3, + height = CoD.TextSettings.NormalFont.Height + } ) + f17_local7:animateToState( "updated", 0 ) + f17_local7:setText( f17_local6 ) + end + + } + } +end + +function archetype_loadout_perk_widget() + return { + type = "UIElement", + properties = { + topOffset = 0, + perkNum = 1 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = MBh.Property( "topOffset" ), + left = 0, + right = 0, + height = 50 + } + }, + children = { + { + type = "UIImage", + id = "archetype_loadout_perk_icon_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 0, + width = 48, + height = 48 + } + } + }, + { + type = "UIText", + id = "archetype_loadout_perk_title_id", + properties = { + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + bottom = 2, + left = 50, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + } + }, + { + type = "UIMarqueeText", + id = "archetype_loadout_per_desc_id", + properties = { + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -2, + left = 50, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + } + } + }, + handlers = { + updateArchetypeLoadoutInfo = function ( f19_arg0, f19_arg1 ) + local f19_local0 = f19_arg1.newArchetypePerkData[f19_arg0.properties.perkNum] + local f19_local1 = f19_arg0:getChildById( "archetype_loadout_perk_icon_id" ) + local f19_local2 = f19_arg0:getChildById( "archetype_loadout_perk_title_id" ) + local f19_local3 = f19_arg0:getChildById( "archetype_loadout_per_desc_id" ) + f19_local1:setImage( RegisterMaterial( f19_local0.newArchetypePerkIcon ) ) + f19_local2:setText( f19_local0.newArchetypePerkTitle ) + f19_local3:setText( f19_local0.newArchetypePerkDesc ) + end + + } + } +end + +function archetype_details_panel() + return { + type = "UIElement", + id = "archetype_deatails_container_id", + properties = { + topOffset = 0, + leftOffset = 0 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = MBh.Property( "topOffset" ), + left = MBh.Property( "leftOffset" ), + width = 370, + height = 330 + } + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 3, + left = 0, + width = 5, + height = 13, + alpha = 0.5 + } ) + } + }, + { + type = "UIText", + properties = { + text = Engine.Localize( "@LUA_MENU_ASSAULT" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 10, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + handlers = { + updateArchetypeLoadoutInfo = function ( f21_arg0, f21_arg1 ) + f21_arg0:setText( Engine.Localize( f21_arg1.newArchetypeTitle ) ) + end + + } + }, + { + type = "UIText", + properties = { + text = Engine.Localize( "@LUA_MENU_ASSAULT_DESC" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = CoD.TextSettings.NormalFont.Height, + left = 10, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + handlers = { + updateArchetypeLoadoutInfo = function ( f22_arg0, f22_arg1 ) + f22_arg0:setText( Engine.Localize( f22_arg1.newArchetypeDesc ) ) + end + + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + bottom = 0, + width = 300, + height = 300, + material = RegisterMaterial( "icon_loadout_assault" ) + } + }, + handlers = { + updateArchetypeLoadoutInfo = function ( f23_arg0, f23_arg1 ) + f23_arg0:setImage( RegisterMaterial( f23_arg1.newArchetypeIcon ) ) + end + + } + } + } + } +end + +function archetype_loadout_panel() + return { + type = "UIElement", + id = "loadout_deatails_container_id", + properties = { + topOffset = 0, + leftOffset = 0 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = MBh.Property( "topOffset" ), + left = MBh.Property( "leftOffset" ), + width = 380, + height = 530 + } + }, + children = { + { + type = "generic_menu_background_withfade", + properties = { + top_offset = 0 + } + }, + { + type = "archetype_loadout_header", + properties = { + topOffset = 1, + titleText = Engine.Localize( "@LUA_MENU_PRIMARY_CAPS" ), + isForPrimary = true + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 45, + width = 192, + height = 96 + } + }, + handlers = { + updateArchetypeLoadoutInfo = function ( f25_arg0, f25_arg1 ) + f25_arg0:setImage( RegisterMaterial( f25_arg1.newArchetypePrimaryIcon ) ) + end + + } + }, + { + type = "archetype_loadout_header", + properties = { + topOffset = 150, + titleText = Engine.Localize( "@LUA_MENU_SECONDARY_CAPS" ) + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 200, + width = 192, + height = 96 + } + }, + handlers = { + updateArchetypeLoadoutInfo = function ( f26_arg0, f26_arg1 ) + f26_arg0:setImage( RegisterMaterial( f26_arg1.newArchetypeSecondaryIcon ) ) + end + + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 310, + left = 1, + right = -1, + height = 1, + material = RegisterMaterial( "white" ), + alpha = Swatches.GenericMenu.BorderAlpha + } ) + } + }, + { + type = "UIVerticalList", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 315, + left = 3, + right = -10, + height = 220, + spacing = 4, + alignment = LUI.Alignment.Center + } + }, + childrenFeeder = ArchetypePerkFeeder + } + } + } +end + +function menu_archetype_select() + return { + type = "UIElement", + id = "menu_archetype_select_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + } + }, + handlers = { + menu_create = function ( f28_arg0, f28_arg1 ) + local f28_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_member_select_main" ) + f28_local0.alreadyWelcomed = true + f28_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) + f28_arg0:dispatchEventToChildren( { + name = "update_header_text", + string = Engine.Localize( "@LUA_MENU_LOADOUT_SELECT", Engine.MarkLocalized( Cac.GetSquadMemberName( f28_local0.exclusiveController, Cac.GetSquadLoc(), Cac.GetEditSquadMember() ) ) ), + immediate = true + } ) + end + + }, + children = { + { + type = "UIImage", + id = "member_select_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "bkgd_cas" ) + } + } + }, + { + type = "generic_menu_title" + }, + { + type = "archetype_details_panel", + properties = { + topOffset = 330, + leftOffset = 80 + } + }, + { + type = "archetype_loadout_panel", + properties = { + topOffset = 100, + leftOffset = 500 + } + }, + { + type = "archetype_select_vlist", + id = "archetype_select_vlist_id", + childrenFeeder = ArchetypeSelectOptionsFeeder + }, + { + type = "UISquadMemberWindow", + id = "member_select_member_window_id", + properties = { + use_3d_model = true, + use_2d_character_image = false, + use_member_name = false, + use_prestige_icon = false, + use_playercard = false, + use_background = true, + use_border = false, + 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 = Cac.GetSquadLoc(), + mask_pos_data = { + top = 17, + bottom = 0, + left = 0, + right = 0 + }, + squad_member_index = MBh.Property( "squadMemberIndex" ) + }, + 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_close = function ( f29_arg0, f29_arg1 ) + LUI.UISquadMemberWindow.Shutdown( f29_arg0 ) + end + , + update_squad_member_window_weapon = function ( f30_arg0, f30_arg1 ) + assert( f30_arg1.weapon ) + f30_arg0:processEvent( { + name = "weapon_change_start", + offline_weapon = f30_arg1.weapon, + prev_weapon = f30_arg0.current_weapon + } ) + end + , + update_squad_member_window_stowed_weapon = function ( f31_arg0, f31_arg1 ) + assert( f31_arg1.weapon ) + f31_arg0:processEvent( { + name = "weapon_changed_stowed", + weapon = f31_arg1.weapon + } ) + end + + } + }, + { + type = "button_helper_text_main", + id = "cac_button_helper_text_id" + }, + { + type = "generic_back_button" + } + } + } +end + +function archetype_select_vlist() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom, + alpha = 1 + } + } + } +end + +LUI.MenuBuilder.registerDef( "menu_archetype_select", menu_archetype_select ) +LUI.MenuBuilder.registerDef( "archetype_select_vlist", archetype_select_vlist ) +LUI.MenuBuilder.registerDef( "archetype_loadout_header", archetype_loadout_header ) +LUI.MenuBuilder.registerDef( "archetype_loadout_perk_widget", archetype_loadout_perk_widget ) +LUI.MenuBuilder.registerDef( "archetype_loadout_panel", archetype_loadout_panel ) +LUI.MenuBuilder.registerDef( "archetype_details_panel", archetype_details_panel ) +LUI.MenuBuilder.registerDef( "confirmation_popup", confirmation_popup ) +LockTable( _M ) diff --git a/lui/mp_menus/cacabilitiesalt.dec.lua b/lui/mp_menus/cacabilitiesalt.dec.lua new file mode 100644 index 0000000..94ae96d --- /dev/null +++ b/lui/mp_menus/cacabilitiesalt.dec.lua @@ -0,0 +1,1922 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +abilityTypes = Cac.GetAbilityTypes() +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" ) + unlockItem( f1_arg1.controller, f1_local0.slotRef ) + f1_arg0:dispatchEventToRoot( { + name = "button_update", + controller = f1_arg1.controller, + immediate = true + } ) + f1_arg0:dispatchEventToRoot( { + name = "button_purchased", + slotRef = f1_local0.slotRef, + controller = f1_arg1.controller, + immediate = true + } ) + f1_arg0:dispatchEventToRoot( { + name = "cac_update_currency_text" + } ) + Engine.PlaySound( CoD.SFX.CacSpendPoints ) + LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f2_arg0 ) +end + +function cac_cant_purchase_ability_popup() + local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" ) + local f3_local1 = Rank.GetRankDisplay( Lobby.GetRankForXP( Engine.GetPlayerDataEx( f3_local0.controller, CoD.StatsGroup.Ranked, "squadMembers", Cac.GetEditSquadMember(), "squadMemXP" ) ) ) + local f3_local2 = RegisterMaterial( Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f3_local1 - 1, RankIconTable.Cols.Standard ) ) + local f3_local3 = f3_local0.currency + local f3_local4 = f3_local0.unlockLevelReq + local f3_local5 = RegisterMaterial( Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f3_local4 - 1, RankIconTable.Cols.Standard ) ) + local f3_local6 = Cac.GetItemCost( f3_local0.slotRef ) + local f3_local7 = Engine.Localize( "@LUA_MENU_UNABLE_TO_PURCHASE_N", Cac.GetPerkName( f3_local0.slotRef ) ) + local f3_local8 = RegisterMaterial( "icon_unlock_token_active" ) + return { + type = "generic_yesno_with_image_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_UNLOCK_EARLY_CAPS" ), + message_image = RegisterMaterial( Cac.GetPerkImage( f3_local0.slotRef ) ), + message_image_top = 10, + message_image_left = 35, + message_required_rank_text = Engine.Localize( "@LUA_MENU_UNLOCK_RANK" ), + message_required_rank_image = f3_local5, + message_required_rank = f3_local4, + message_current_rank_text = Engine.Localize( "@LUA_MENU_CURRENT_RANK" ), + message_current_rank_image = f3_local2, + message_current_rank = f3_local1, + message_cost_text = Engine.Localize( "@LUA_MENU_COST" ), + message_cost_image = f3_local8, + message_cost = f3_local6, + message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ), + message_squad_points_image = f3_local8, + message_squad_points = f3_local3, + no_text = f3_local7, + no_action = f0_local1 + } + } +end + +function cac_purchase_ability_popup() + local f4_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" ) + local f4_local1 = Rank.GetRankDisplay( Lobby.GetRankForXP( Engine.GetPlayerDataEx( f4_local0.controller, CoD.StatsGroup.Ranked, "squadMembers", Cac.GetEditSquadMember(), "squadMemXP" ) ) ) + local f4_local2 = RegisterMaterial( Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f4_local1 - 1, RankIconTable.Cols.Standard ) ) + local f4_local3 = f4_local0.currency + local f4_local4 = f4_local0.unlockLevelReq + local f4_local5 = RegisterMaterial( Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f4_local4 - 1, RankIconTable.Cols.Standard ) ) + local f4_local6 = Cac.GetItemCost( f4_local0.slotRef ) + local f4_local7 = Engine.Localize( "@LUA_MENU_PURCHASE_N", Cac.GetPerkName( f4_local0.slotRef ) ) + local f4_local8 = RegisterMaterial( "icon_unlock_token_active" ) + return { + type = "generic_yesno_with_image_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_UNLOCK_EARLY_CAPS" ), + message_image = RegisterMaterial( Cac.GetPerkImage( f4_local0.slotRef ) ), + message_image_top = 10, + message_image_left = 35, + message_required_rank_text = Engine.Localize( "@LUA_MENU_UNLOCK_RANK" ), + message_required_rank_image = f4_local5, + message_required_rank = f4_local4, + message_current_rank_text = Engine.Localize( "@LUA_MENU_CURRENT_RANK" ), + message_current_rank_image = f4_local2, + message_current_rank = f4_local1, + message_cost_text = Engine.Localize( "@LUA_MENU_COST" ), + message_cost_image = f4_local8, + message_cost = f4_local6, + message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ), + message_squad_points_image = f4_local8, + message_squad_points = f4_local3, + yes_text = f4_local7, + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = f0_local0, + no_action = f0_local1 + }, + additional_handlers = { + menu_create = function ( f5_arg0, f5_arg1 ) + f5_arg0:setText( f4_local0.abilityName ) + end + + } + } +end + +f0_local2 = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0.selected + local f6_local1 = f6_arg0.streakSelected + local f6_local2 = f6_arg0.blocked + local f6_local3 = f6_arg0.buttonLocked + local f6_local4 = f6_arg0.is_unlocked + local f6_local5 = f6_arg0._scoped + if f6_local0 or f6_local1 then + local f6_local6 + if f6_local5.strikePackage and not f6_local1 then + f6_local6 = Colors.cac_specialist_bonus + if not f6_local6 then + + else + f6_arg0:dispatchEventToChildren( { + name = "button_txt_selected", + streak_selected = f6_local1 + } ) + f6_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused" + } ) + f6_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = f6_local6.r, + green = f6_local6.g, + blue = f6_local6.b, + alpha = Cac.Selection.outline_over.attach + } ) + f6_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.attach + } ) + end + end + f6_local6 = Colors.yellow + elseif f6_local2 or f6_local3 then + if not f6_local3 then + f6_arg0:dispatchEventToChildren( { + name = "button_txt_unfocused_blocked" + } ) + end + f6_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused_disabled" + } ) + if f6_local4 then + if f6_local5.strikePackage and f6_arg0.blockedSpecialist then + f6_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused_blocked" + } ) + else + f6_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused" + } ) + end + else + f6_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused_blocked" + } ) + f6_arg0:dispatchEventToChildren( { + name = "locked" + } ) + f6_arg0:dispatchEventToChildren( { + name = "unfocused_locked" + } ) + f6_arg0:dispatchEventToChildren( { + name = "button_lock_unfocused" + } ) + end + f6_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f6_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + alpha = 0 + } ) + else + f6_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused" + } ) + f6_arg0:dispatchEventToChildren( { + name = "button_txt_unfocused" + } ) + f6_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused" + } ) + f6_arg0:dispatchEventToChildren( { + name = "button_bg_unfocused" + } ) + f6_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.attach + } ) + f6_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + alpha = 0 + } ) + end + f6_arg0.focused = false +end + +local f0_local3 = function ( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0.streakSelected + local f7_local1 = f7_arg0.selected + local f7_local2 = f7_arg0.blocked + local f7_local3 = f7_arg0.buttonLocked + local f7_local4 = f7_arg0._scoped + if f7_local1 or f7_local0 then + local f7_local5 + if f7_local4.strikePackage and not f7_local0 then + f7_local5 = Colors.cac_specialist_bonus + if not f7_local5 then + + else + f7_arg0:dispatchEventToChildren( { + name = "button_txt_focused" + } ) + f7_arg0:dispatchEventToChildren( { + name = "button_icon_focused" + } ) + f7_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = f7_local5.r, + green = f7_local5.g, + blue = f7_local5.b, + alpha = Cac.Selection.outline_over.attach + } ) + f7_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_over.attach + 0.1 + } ) + end + end + f7_local5 = Colors.yellow + elseif f7_local2 or f7_local3 then + if not f7_local3 then + f7_arg0:dispatchEventToChildren( { + name = "button_txt_focused_blocked" + } ) + else + f7_arg0:dispatchEventToChildren( { + name = "locked" + } ) + f7_arg0:dispatchEventToChildren( { + name = "button_txt_focused_locked" + } ) + f7_arg0:dispatchEventToChildren( { + name = "button_lock_focused" + } ) + end + f7_arg0:dispatchEventToChildren( { + name = "button_tab_focused_disabled" + } ) + 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.attach + } ) + f7_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_over.attach + 0.1 + } ) + else + f7_arg0:dispatchEventToChildren( { + name = "button_tab_focused_enabled" + } ) + 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.attach + } ) + f7_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_over.attach + 0.1 + } ) + end + f7_arg0.focused = true + if MatchRules.AllowCustomClasses( f7_local4.classLocation ) then + if f7_arg0.restricted or f7_arg0.classRestricted then + f7_arg0:dispatchEventToRoot( { + name = "show_class_restrictions_warning", + immediate = true + } ) + else + f7_arg0:dispatchEventToRoot( { + name = "hide_class_restrictions_warning", + immediate = true + } ) + end + end +end + +local f0_local4 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" ) + local f8_local1 = Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f8_arg0.properties.abilityCategoryNumber ), f8_arg0.properties.columnNumber ) + f8_arg0.blockedSpecialist = false + local f8_local2 = Cac.IsAbilityPicked( f8_arg1.controller, f8_local0.squadLocation, f8_local0.squadMemberIndex, f8_local0.classLocation, f8_local0.slot, f8_arg0.properties.abilityCategoryNumber, f8_arg0.properties.columnNumber - 1, "abilitiesPicked" ) + local f8_local3 = Cac.IsPerkUnlocked( f8_arg1.controller, f8_local0.squadLocation, f8_local0.squadMemberIndex, f8_local1 ) + f8_arg0.is_unlocked = f8_local3 + if not f8_local3 then + f8_arg0.blocked = true + f8_arg0.buttonLocked = true + elseif f8_local0.strikePackage and f8_local2 then + f8_arg0.blockedSpecialist = true + f8_arg0.blocked = true + elseif tonumber( f8_arg0.properties.ability_cost ) <= f8_local0.sparePoints then + if not f8_arg0.selected and not f8_arg0.streakSelected then + f8_arg0.blocked = false + end + elseif not f8_arg0.selected and not f8_arg0.streakSelected then + if f8_local0.strikePackage and f8_local0.firstKsNone <= #f8_local0.ks then + f8_arg0.blocked = false + else + f8_arg0.blockedSpecialist = true + f8_arg0.blocked = true + end + end + if f8_arg0.buttonLocked and f8_local3 then + f8_arg0.buttonLocked = false + f8_arg0:dispatchEventToChildren( { + name = "unlocked", + dispatchChildren = true + } ) + end + if f8_local0.strikePackage then + for f8_local4 = 1, #Cac.Abilities.BlockedSpecialist, 1 do + if f8_local1 == Cac.Abilities.BlockedSpecialist[f8_local4] then + f8_arg0.blocked = true + f8_arg0.blockedSpecialist = true + break + end + end + end + if f8_arg1.reset then + f8_arg0.selected = false + if not f8_arg0.blockedSpecialist then + f8_arg0.blocked = false + end + f8_arg0.shouldHighlight = false + if f8_arg0.focused then + f8_arg0:dispatchEventToChildren( { + name = "reset", + dispatchChildren = true + } ) + f0_local3( f8_arg0, f8_arg1 ) + else + f8_arg0:dispatchEventToChildren( { + name = "reset", + dispatchChildren = true + } ) + f0_local2( f8_arg0, f8_arg1 ) + end + elseif f8_arg0.streakSelected then + f8_arg0:processEvent( { + name = "streakSelected", + dispatchChildren = true + } ) + f8_arg0:dispatchEventToChildren( { + name = "button_icon_selected" + } ) + if f8_arg0.focused then + f8_arg0:dispatchEventToChildren( { + name = "button_txt_focused" + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = Cac.Selection.outline_over.attach + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_over.attach + } ) + else + f8_arg0:dispatchEventToChildren( { + name = "button_txt_selected", + streak_selected = f8_arg0.streakSelected + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = Cac.Selection.outline_over.attach + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.attach + } ) + end + elseif f8_arg0.selected then + local f8_local4 = f8_local0.strikePackage and Colors.cac_specialist_bonus or Colors.yellow + f8_arg0:dispatchEventToChildren( { + name = "button_tab_selected" + } ) + f8_arg0:dispatchEventToChildren( { + name = "button_icon_selected" + } ) + if f8_arg0.focused then + f8_arg0:dispatchEventToChildren( { + name = "button_txt_focused" + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = f8_local4.r, + green = f8_local4.g, + blue = f8_local4.b, + alpha = Cac.Selection.outline_over.attach + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_over.attach + } ) + else + f8_arg0:dispatchEventToChildren( { + name = "button_txt_selected", + streak_selected = f8_arg0.streakSelected + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = f8_local4.r, + green = f8_local4.g, + blue = f8_local4.b, + alpha = Cac.Selection.outline_over.attach + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.attach + } ) + end + elseif f8_arg0.blocked or f8_arg0.buttonLocked then + f8_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused" + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + alpha = 0 + } ) + if not f8_arg0.shouldHighlight then + f8_arg0:dispatchEventToChildren( { + name = "button_txt_unfocused_blocked" + } ) + if f8_local3 then + if f8_local0.strikePackage and f8_arg0.blockedSpecialist then + f8_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused_blocked" + } ) + else + f8_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused" + } ) + end + else + f8_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused_blocked" + } ) + end + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + else + f8_arg0:dispatchEventToChildren( { + name = "button_txt_focused_blocked" + } ) + f8_arg0:dispatchEventToChildren( { + name = "button_txt_focused_locked" + } ) + f8_arg0:dispatchEventToChildren( { + name = "button_icon_focused_blocked" + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_over.attach + } ) + f8_arg0.shouldHighlight = false + end + if f8_arg0.buttonLocked then + f8_arg0:dispatchEventToChildren( { + name = "locked", + dispatchChildren = true + } ) + end + elseif f8_arg0.shouldHighlight then + f8_arg0:dispatchEventToChildren( { + name = "button_tab_focused" + } ) + f8_arg0:dispatchEventToChildren( { + name = "button_txt_focused" + } ) + f8_arg0:dispatchEventToChildren( { + name = "button_icon_focused" + } ) + f8_arg0:dispatchEventToChildren( { + name = "button_bg_focused" + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_over.attach + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + alpha = 0 + } ) + f8_arg0.shouldHighlight = false + else + f8_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused" + } ) + f8_arg0:dispatchEventToChildren( { + name = "button_txt_unfocused" + } ) + f8_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused" + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.attach + } ) + f8_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + alpha = 0 + } ) + end +end + +local f0_local5 = function ( f9_arg0, f9_arg1 ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" ) + local f9_local1 = f9_arg0.properties + f9_arg0.selected = Cac.IsAbilityPicked( f9_arg1.controller, f9_local0.squadLocation, f9_local0.squadMemberIndex, f9_local0.classLocation, f9_local0.slot, f9_arg0.properties.abilityCategoryNumber, f9_arg0.properties.columnNumber - 1, f9_local0.strikePackage and "specialistBonusStreaks" or "abilitiesPicked" ) + if f9_local0.strikePackage then + f9_arg0.streakSelected = false + local f9_local2 = Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f9_arg0.properties.abilityCategoryNumber ), f9_local1.columnNumber ) .. "_ks" + for f9_local3 = 1, #f9_local0.ks, 1 do + if f9_local2 == f9_local0.ks[f9_local3] then + f9_arg0.streakSelected = true + break + end + end + end +end + +function AbilityButtonOver( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0.properties + local f10_local1 = f10_arg0:getParent() + f10_local0.is_unlocked = f10_local1.is_unlocked + f10_arg0:dispatchEventToRoot( { + name = "current_ability_changed", + columnNumber = f10_arg0.properties.columnNumber, + description = f10_arg0.properties.description, + material = f10_arg0.properties.material, + title = f10_arg0.properties.name, + ability_cost = f10_arg0.properties.ability_cost, + purchase_cost = f10_arg0.properties.purchase_cost, + item_level = f10_arg0.properties.item_level, + is_unlocked = f10_arg0.properties.is_unlocked, + immediate = true + } ) +end + +function AdjustSpecialistStreaks( f11_arg0, f11_arg1, f11_arg2, f11_arg3 ) + local f11_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" ) + for f11_local1 = f11_arg3, f11_local0.firstKsNone - 1, 1 do + local f11_local4 + if f11_local1 == #f11_arg2 then + f11_local4 = "none" + if not f11_local4 then + + else + Cac.SetKillstreak( f11_arg1.controller, f11_local0.squadLocation, f11_local0.squadMemberIndex, f11_local0.classLocation, f11_local0.slot, "specialistStreaks", f11_local1 - 1, f11_local4 ) + f11_arg2[f11_local1] = f11_local4 + end + end + f11_local4 = f11_arg2[f11_local1 + 1] + end + for f11_local1 = f11_arg3, #f11_arg2, 1 do + local f11_local4 = 0 + if f11_local1 < f11_local0.firstKsNone - 1 then + for f11_local5 = 1, f11_local1, 1 do + local f11_local8 = Cac.GetPerkCost( f11_arg2[f11_local5] and "specialty_null" or Cac.StripSuffix( f11_arg2[f11_local5], "_ks" ) ) + if f11_local8 ~= "" and f11_local8 and f11_local8 ~= "0" then + f11_local4 = f11_local4 + f11_local8 + 1 + end + end + end + Cac.SetSpecialistKills( f11_arg1.controller, f11_local0.squadLocation, f11_local0.squadMemberIndex, f11_local0.classLocation, f11_local0.slot, f11_local1 - 1, f11_local4 ) + end + f11_local0.firstKsNone = f11_local0.firstKsNone - 1 +end + +function cac_ability_alt_button( f12_arg0, f12_arg1 ) + local f12_local0 = Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f12_arg1.abilityCategoryNumber ), f12_arg1.columnNumber ) + local f12_local1 = Cac.GetPerkName( f12_local0 ) + local f12_local2 = Cac.GetPerkDesc( f12_local0 ) + local f12_local3 = Cac.GetPerkImage( f12_local0 ) + local f12_local4 = tonumber( f12_arg1.ability_cost ) + if f12_local3 == "" or f12_local3 == nil then + f12_local3 = "specialty_ks_null" + end + local self = LUI.UIButton.new() + self.id = "cac_ability_alt_button_" .. f12_arg1.columnNumber + self:registerEventHandler( "current_ability_changed", function ( element, event ) + element.listDefaultFocus = element.properties.columnNumber == event.columnNumber + end ) + self:addEventHandler( "lose_focus", function ( f14_arg0, f14_arg1 ) + local f14_local0 = f14_arg0:getParent() + if f14_local0 then + f14_local0:clearSavedState() + end + end ) + self:registerEventHandler( "button_action", function ( element, event ) + local f15_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" ) + local f15_local1 = f15_local0.strikePackage and "specialistBonusStreaks" or "abilitiesPicked" + local f15_local2 = f12_local0 .. "_ks" + local f15_local3 = Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, "abilitiesPicked" ) + local f15_local4 = Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, "specialistBonusStreaks" ) + local f15_local5 = Cac.IsPerkUnlocked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f12_local0 ) + local f15_local6 = false + if f15_local0.strikePackage then + for f15_local7 = 1, #Cac.Abilities.BlockedSpecialist, 1 do + if f12_local0 == Cac.Abilities.BlockedSpecialist[f15_local7] then + f15_local6 = true + end + end + end + f15_local0.purchase_cost = tonumber( Cac.GetItemCost( f12_local0 ) ) + f15_local0.currency = tonumber( Cac.GetCurrency( event.controller ) ) + f15_local0.unlockLevelReq = Cac.GetPerkUnlockReq( f12_local0 ) + if not f15_local5 then + f15_local0.slotRef = f12_local0 + if f15_local0.currency < f15_local0.purchase_cost then + LUI.FlowManager.RequestPopupMenu( element, "cac_cant_purchase_ability_popup", true, event.controller, false, f12_arg1 ) + else + LUI.FlowManager.RequestPopupMenu( element, "cac_purchase_ability_popup", true, event.controller, false, f12_arg1 ) + end + elseif (not f15_local0.strikePackage or not f15_local3) and not f15_local6 then + if f15_local0.strikePackage and f15_local0.firstKsNone == #f15_local0.ks + 1 then + if f15_local2 ~= f15_local0.ks[1] and f15_local2 ~= f15_local0.ks[2] and f15_local2 ~= f15_local0.ks[3] then + if not f15_local4 and f15_local0.sparePoints < f12_local4 then + Engine.PlaySound( CoD.SFX.DenySelect ) + return + end + Cac.ToggleAbility( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1, true, f15_local0.strikePackage ) + element.selected = Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1 ) + else + for f15_local7 = 1, #f15_local0.ks, 1 do + if f15_local0.ks[f15_local7] == f15_local2 then + AdjustSpecialistStreaks( element, event, f15_local0.ks, f15_local7 ) + element.streakSelected = false + end + end + end + elseif f15_local0.strikePackage then + for f15_local7 = 1, f15_local0.firstKsNone, 1 do + if f15_local0.ks[f15_local7] == f15_local2 then + AdjustSpecialistStreaks( element, event, f15_local0.ks, f15_local7 ) + element.streakSelected = false + elseif f15_local7 == f15_local0.firstKsNone then + Cac.SetKillstreak( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, "specialistStreaks", f15_local7 - 1, f15_local2 ) + f15_local0.ks[f15_local7] = f15_local2 + local f15_local10 = 0 + for f15_local11 = 1, f15_local7, 1 do + local f15_local14 = Cac.GetPerkCost( Cac.StripSuffix( f15_local0.ks[f15_local11], "_ks" ) ) + if f15_local14 ~= "" and f15_local14 then + f15_local10 = f15_local10 + f15_local14 + 1 + end + end + Cac.SetSpecialistKills( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, f15_local7 - 1, f15_local10 ) + f15_local0.firstKsNone = f15_local0.firstKsNone + 1 + element.streakSelected = true + if Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1 ) then + Cac.ToggleAbility( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1, true, f15_local0.strikePackage ) + element.selected = false + end + end + end + else + Cac.ToggleAbility( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1, true, f15_local0.strikePackage ) + element.selected = Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, f15_local1 ) + if not element.blocked then + if Cac.IsAbilityPicked( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, "specialistBonusStreaks" ) then + Cac.ToggleAbility( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, element.properties.abilityCategoryNumber, element.properties.columnNumber - 1, "specialistBonusStreaks", true, f15_local0.strikePackage ) + else + local f15_local8 = { + Cac.GetStreak( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak1 ), + Cac.GetStreak( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak2 ), + Cac.GetStreak( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak3 ) + } + f15_local0.firstKsNone = #f15_local8 + 1 + for f15_local9 = #f15_local8, 1, -1 do + if f15_local8[f15_local9] == "none" then + f15_local0.firstKsNone = f15_local9 + end + end + for f15_local9 = 1, f15_local0.firstKsNone, 1 do + if f15_local8[f15_local9] == f15_local2 then + AdjustSpecialistStreaks( element, event, f15_local8, f15_local9 ) + end + end + end + else + Engine.PlaySound( CoD.SFX.DenySelect ) + return + end + end + element.shouldHighlight = true + f15_local0.sparePoints = (f15_local0.strikePackage and Cac.Abilities.Settings.GrabBagCapacity or Cac.CalculateAbilityCapacity( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot )) - Cac.CountSpentPoints( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, f15_local1 ) + if element.selected or element.streakSelected then + Engine.PlaySound( CoD.SFX.CacSelectAbility ) + elseif not element.blocked then + Engine.PlaySound( CoD.SFX.CacDeselectAbility ) + end + element:dispatchEventToRoot( { + name = "button_update", + dispatchChildren = true, + controller = event.controller, + immediate = true + } ) + element:dispatchEventToRoot( { + name = "refresh_specialist_abilities_recap", + controller = event.controller, + specialistType = Cac.GetPerk( event.controller, f15_local0.squadLocation, f15_local0.squadMemberIndex, f15_local0.classLocation, f15_local0.slot, Cac.Indices.StreakType ) == "streaktype_specialist", + selected = f15_local0.strikePackage, + immediate = true + } ) + if not f15_local0.strikePackage then + element:dispatchEventToRoot( { + name = "refresh_abilities_recap", + controller = event.controller, + selected = true, + immediate = true + } ) + end + element:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = cac_controllerId, + dispatchChildren = true + } ) + else + Engine.PlaySound( CoD.SFX.DenySelect ) + return + end + end ) + self:registerEventHandler( "button_over", f0_local3 ) + self:registerEventHandler( "button_up", f0_local2 ) + self:registerEventHandler( "button_update", f0_local4 ) + self:registerEventHandler( "button_check", f0_local5 ) + self:registerEventHandler( "button_purchased", function ( element, event ) + if event.slotRef and event.slotRef == element.properties.slotRef then + element:processEvent( { + name = "button_action", + controller = event.controller, + immediate = true + } ) + end + end ) + self:registerEventHandler( "menu_create", function ( element, event ) + local f17_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if MatchRules.AllowCustomClasses( f17_local0.classLocation ) then + local f17_local1, f17_local2 = Cac.SafeGetMatchRule( "commonOption", "perkRestricted", f12_local0 ) + if f17_local1 and f17_local2 then + local f17_local3 = Cac.GetRestrictIcon( -2, -2, 28 ) + f17_local3.id = "restrict_icon" .. f12_local0 + element:addElement( f17_local3 ) + element.restricted = true + else + element.restricted = false + end + local f17_local3, f17_local4 = Cac.SafeGetMatchRule( "commonOption", "perkClassRestricted", Cac.GetPerkGroup( f12_local0 ) ) + element.classRestricted = f17_local3 and f17_local4 + end + end ) + self:registerAnimationState( "default", { + leftAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + width = 76, + top = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + local f12_local6 = LUI.mp_menus.CacEditChooseImagePopup.cac_edit_choose_image_button_background( {}, { + red = 0, + green = 0, + blue = 0, + alpha = 0.25, + colorLocked = true + } ) + local f12_local7 = LUI.UIElement.new() + f12_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + } ) + f12_local7:animateToState( "default" ) + f12_local7:registerAnimationState( "dim", { + alpha = 0.8 + } ) + f12_local7:registerEventHandler( "button_bg_focused", MBh.AnimateLoop( { + { + "dim", + 750, + true, + true + }, + { + "default", + 750, + true, + true + } + } ) ) + f12_local7:registerEventHandler( "button_bg_unfocused", MBh.AnimateToState( "default", 0 ) ) + self:addElement( f12_local7 ) + f12_local7:addElement( LUI.mp_menus.CacEditChooseImagePopup.cac_edit_choose_image_button_background( {}, { + alpha = 0 + } ) ) + self:addElement( LUI.mp_menus.CacEditChooseImagePopup.cac_edit_choose_image_button_background_outline( {}, { + alpha = 0 + } ) ) + local f12_local8 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" ) + local f12_local9 = f12_local8.strikePackage and Colors.cac_specialist_bonus or Colors.yellow + local f12_local10 = LUI.UIImage.new() + f12_local10:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 16, + left = 0, + right = 16, + material = RegisterMaterial( "widg_triangle" ), + alpha = 0 + } ) + f12_local10:animateToState( "default" ) + f12_local10:registerAnimationState( "focused", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f12_local10:registerAnimationState( "focused_enabled", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1, + material = RegisterMaterial( "widg_triangle" ) + } ) + f12_local10:registerAnimationState( "unfocused", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f12_local10:registerAnimationState( "focused_disabled", { + alpha = 1 + } ) + f12_local10:registerAnimationState( "unfocused_disabled", { + alpha = 0 + } ) + f12_local10:registerAnimationState( "selected", { + red = f12_local9.r, + green = f12_local9.g, + blue = f12_local9.b, + alpha = 1 + } ) + f12_local10:registerAnimationState( "streakSelected", { + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 1 + } ) + f12_local10:registerEventHandler( "streakSelected", MBh.AnimateToState( "streakSelected", 0 ) ) + f12_local10:registerEventHandler( "button_tab_selected", MBh.AnimateToState( "selected", 0 ) ) + f12_local10:registerEventHandler( "button_tab_focused", MBh.AnimateToState( "focused", 0 ) ) + f12_local10:registerEventHandler( "button_tab_unfocused", MBh.AnimateToState( "unfocused", 0 ) ) + f12_local10:registerEventHandler( "button_tab_focused_enabled", MBh.AnimateToState( "focused_enabled", 0 ) ) + f12_local10:registerEventHandler( "button_tab_focused_disabled", MBh.AnimateToState( "focused_disabled", 0 ) ) + f12_local10:registerEventHandler( "button_tab_unfocused_disabled", MBh.AnimateToState( "unfocused_disabled", 0 ) ) + self:addElement( f12_local10 ) + local f12_local11 = LUI.UIImage.new() + f12_local11.id = "ability_icon_id" + f12_local11.properties = { + columnNumber = f12_arg1.columnNumber, + name = f12_local1, + description = f12_local2, + material = f12_local3, + ability_cost = f12_local4, + purchase_cost = f12_arg1.purchase_cost, + item_level = Cac.GetItemLevel( f12_local0 ), + is_unlocked = Cac.IsPerkUnlocked( f12_local8.controller, f12_local8.squadLocation, f12_local8.squadMemberIndex, f12_local0 ) + } + f12_local11:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + right = -3, + width = 48, + height = 48, + material = RegisterMaterial( f12_local3 ), + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f12_local11:animateToState( "default" ) + f12_local11:registerAnimationState( "selected", { + alpha = 1 + } ) + f12_local11:registerAnimationState( "focused_up", { + scale = 0.1, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 1 + } ) + f12_local11:registerAnimationState( "focused", { + scale = 0, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 1 + } ) + f12_local11:registerAnimationState( "unfocused", { + scale = 0, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f12_local11:registerAnimationState( "focused_blocked_up", { + scale = 0.1, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 0.6 + } ) + f12_local11:registerAnimationState( "focused_blocked", { + scale = 0, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 0.6 + } ) + f12_local11:registerAnimationState( "unfocused_blocked", { + scale = 0, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0.2 + } ) + f12_local11:registerEventHandler( "button_over", AbilityButtonOver ) + f12_local11:registerEventHandler( "button_icon_selected", MBh.AnimateToState( "selected", 0 ) ) + f12_local11:registerEventHandler( "button_icon_focused", MBh.AnimateSequence( { + { + "focused", + 0 + }, + { + "focused_up", + 100 + }, + { + "focused", + 100 + } + } ) ) + f12_local11:registerEventHandler( "button_icon_unfocused", MBh.AnimateToState( "unfocused", 0 ) ) + f12_local11:registerEventHandler( "button_icon_focused_blocked", MBh.AnimateSequence( { + { + "focused_blocked", + 0 + }, + { + "focused_blocked_up", + 100 + }, + { + "focused_blocked", + 100 + } + } ) ) + f12_local11:registerEventHandler( "button_icon_unfocused_blocked", MBh.AnimateToState( "unfocused_blocked", 0 ) ) + self:addElement( f12_local11 ) + local f12_local12 = LUI.UIText.new() + f12_local12.id = "ability_cost_id" + local f12_local13 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_ability_alt_main" ) + f12_local12:setText( f12_local4 ) + f12_local12:registerAnimationState( "default", CoD.ColorizeState( Colors.secondary_text_color, { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + left = 5, + right = 0, + height = CoD.TextSettings.SmallFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) ) + f12_local12:animateToState( "default" ) + f12_local12:registerAnimationState( "streakSelected", CoD.ColorizeState( Colors.yellow, {} ) ) + f12_local12:registerAnimationState( "selected", CoD.ColorizeState( f12_local9, {} ) ) + f12_local12:registerAnimationState( "unselected", CoD.ColorizeState( Colors.white, {} ) ) + f12_local12:registerAnimationState( "focused", CoD.ColorizeState( Colors.black, {} ) ) + f12_local12:registerAnimationState( "unfocused", CoD.ColorizeState( Colors.secondary_text_color, {} ) ) + f12_local12:registerAnimationState( "focused_blocked", CoD.ColorizeState( { + r = Colors.black.r, + g = Colors.black.g, + b = Colors.black.b, + a = 1 + }, {} ) ) + f12_local12:registerAnimationState( "unfocused_blocked", CoD.ColorizeState( { + r = Colors.secondary_text_color.r, + g = Colors.secondary_text_color.g, + b = Colors.secondary_text_color.b, + a = 0.5 + }, {} ) ) + f12_local12:registerAnimationState( "locked", CoD.ColorizeState( { + r = Colors.secondary_text_color.r, + g = Colors.secondary_text_color.g, + b = Colors.secondary_text_color.b, + a = 0.75 + }, {} ) ) + f12_local12:registerEventHandler( "streakSelected", MBh.AnimateToState( "streakSelected", 0 ) ) + f12_local12:registerEventHandler( "button_txt_selected", function ( element, event ) + if not event.streak_selected then + local f18_local0 = MBh.AnimateToState( "selected", 0 ) + f18_local0( element ) + else + local f18_local0 = MBh.AnimateToState( "streakSelected", 0 ) + f18_local0( element ) + end + end ) + f12_local12:registerEventHandler( "button_txt_unselected", MBh.AnimateToState( "unselected", 0 ) ) + f12_local12:registerEventHandler( "button_txt_focused", MBh.AnimateToState( "focused", 0 ) ) + f12_local12:registerEventHandler( "button_txt_unfocused", MBh.AnimateToState( "unfocused", 0 ) ) + f12_local12:registerEventHandler( "button_txt_focused_blocked", MBh.AnimateToState( "focused_blocked", 0 ) ) + f12_local12:registerEventHandler( "button_txt_unfocused_blocked", MBh.AnimateToState( "unfocused_blocked", 0 ) ) + f12_local12:registerEventHandler( "button_txt_focused_locked", MBh.AnimateToState( "focused_blocked", 0 ) ) + f12_local12:registerEventHandler( "button_txt_unfocused_locked", MBh.AnimateToState( "locked", 0 ) ) + f12_local12:registerEventHandler( "reset", function ( element, event ) + if element.blocked or element.buttonLocked then + MBh.AnimateToState( "locked", 0 ) + else + MBh.AnimateToState( "default", 0 ) + end + end ) + f12_local12:registerEventHandler( "locked", MBh.AnimateToState( "locked", 0 ) ) + self:addElement( f12_local12 ) + local f12_local14 = LUI.UIElement.new() + f12_local14:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + left = 17, + right = 0, + height = CoD.TextSettings.SmallFont.Height, + alpha = 0 + } ) + f12_local14:animateToState( "default" ) + f12_local14:registerAnimationState( "locked", { + alpha = 0.15 + } ) + f12_local14:registerAnimationState( "locked_focused", { + alpha = 0.5 + } ) + f12_local14:registerAnimationState( "locked_unfocused", { + alpha = 0.15 + } ) + f12_local14:registerEventHandler( "locked", MBh.AnimateToState( "locked", 0 ) ) + f12_local14:registerEventHandler( "unlocked", MBh.AnimateToState( "default", 0 ) ) + f12_local14:registerEventHandler( "button_lock_focused", function ( element, event ) + element:animateToState( "locked_focused" ) + local f20_local0 = element:getFirstChild() + f20_local0:processEvent( event ) + end ) + f12_local14:registerEventHandler( "button_lock_unfocused", function ( element, event ) + element:animateToState( "locked_unfocused" ) + local f21_local0 = element:getFirstChild() + f21_local0:processEvent( event ) + end ) + self:addElement( f12_local14 ) + local f12_local15 = LUI.UIImage.new() + f12_local15:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 0, + width = 16, + height = 16, + material = RegisterMaterial( "icon_unlock_active" ) + } ) + f12_local15:animateToState( "default" ) + f12_local15:registerAnimationState( "focused_locked", CoD.ColorizeState( { + r = Colors.black.r, + g = Colors.black.g, + b = Colors.black.b, + a = 1 + }, {} ) ) + f12_local15:registerAnimationState( "unfocused_locked", CoD.ColorizeState( { + r = Colors.white.r, + g = Colors.white.g, + b = Colors.white.b, + a = 1 + }, {} ) ) + f12_local15:registerEventHandler( "button_lock_focused", function ( element, event ) + local f22_local0 = MBh.AnimateToState( "focused_locked", 0 ) + f22_local0( element ) + end ) + f12_local15:registerEventHandler( "button_lock_unfocused", function ( element, event ) + local f23_local0 = MBh.AnimateToState( "unfocused_locked", 0 ) + f23_local0( element ) + end ) + f12_local14:addElement( f12_local15 ) + return self +end + +function abilities_row( f24_arg0 ) + local f24_local0 = Cac.GetAbilityRef( f24_arg0 ) + local f24_local1 = { + type = "UIImage", + id = "ability_gradient", + states = { + default = CoD.ColorizeState( Colors.cac_ability[f24_local0], { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + height = 30, + material = RegisterMaterial( "box_white_gradient_top" ), + alpha = 0.15 + } ) + } + } + local f24_local2 = { + type = "UIImage", + id = "ability_triangle", + states = { + default = CoD.ColorizeState( Colors.cac_ability[f24_local0], { + material = RegisterMaterial( "widg_triangle" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + height = 20, + width = 20, + alpha = 0.5 + } ) + } + } + local f24_local3 = { + type = "UIText", + id = "row_name", + properties = { + text = Cac.GetAbilityName( f24_local0 ) + }, + states = { + default = CoD.ColorizeState( Colors.white, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 40, + right = 0, + top = -CoD.TextSettings.NormalFont.Height / 2, + bottom = CoD.TextSettings.NormalFont.Height / 2, + alpha = 0.5 + } ) + }, + handlers = { + menu_create = function ( f25_arg0, f25_arg1 ) + local f25_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f25_arg0 ) + if MatchRules.AllowCustomClasses( f25_local0.classLocation ) then + local f25_local1, f25_local2 = Cac.SafeGetMatchRule( "commonOption", "perkClassRestricted", f24_local0 ) + if f25_local1 and f25_local2 then + local self = LUI.UIImage.new() + self.id = "restrict_icon" .. f24_local0 + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = -32, + bottom = 2, + width = 28, + height = 28, + material = RegisterMaterial( "icon_new_3" ), + alpha = 1 + } ) + self:animateToState( "default" ) + f25_arg0:addElement( self ) + end + end + end + } + } + local f24_local4 = { + type = "UIHorizontalList", + id = "row_buttons", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 195, + right = 0, + top = 3, + bottom = -4, + spacing = 30 + } + }, + children = {} + } + for f24_local5 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + local f24_local8 = Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f24_arg0 ), f24_local5 ) + local f24_local9 = Cac.GetPerkCost( f24_local8 ) + if f24_local9 == "" or f24_local9 == nil then + f24_local9 = "1" + end + f24_local4.children[#f24_local4.children + 1] = { + type = "cac_ability_alt_button", + id = "cac_ability_alt_button_" .. f24_arg0 .. "_" .. f24_local5, + audio = { + button_over = CoD.SFX.SubMenuMouseOver + }, + properties = { + muteAction = true, + abilityCategoryNumber = f24_arg0, + columnNumber = f24_local5, + ability_cost = f24_local9, + purchase_cost = Cac.GetItemCost( f24_local8 ), + slotRef = f24_local8 + } + } + end + return { + type = "UIElement", + id = "abilities_row_" .. f24_arg0, + focusable = true, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 63 + } + }, + children = { + f24_local1, + f24_local2, + f24_local3, + f24_local4 + }, + handlers = { + menu_create = function ( f26_arg0, f26_arg1 ) + f26_arg0:setHandleMouse( true ) + end + , + popup_active = function ( f27_arg0, f27_arg1 ) + f27_arg0:setHandleMouse( false ) + end + , + popup_inactive = function ( f28_arg0, f28_arg1 ) + f28_arg0:setHandleMouse( true ) + end + + } + } +end + +function abilities_grid() + local f29_local0 = { + type = "UIVerticalList", + id = "abilities_grid", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 2, + right = -2, + top = GenericTitleBarDims.TitleBarHeight + 2, + bottom = 0 + } + }, + children = {} + } + for f29_local4, f29_local5 in ipairs( abilityTypes ) do + f29_local0.children[#f29_local0.children + 1] = abilities_row( f29_local5 ) + end + return { + type = "UIElement", + id = "abilities_grid_container", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 450, + top = 100, + width = 730, + height = 476 + } + }, + 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_titlebar", + id = "window_title", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = Engine.Localize( "@MENU_ABILITIES_CAPS" ), + title_bar_alignment = LUI.Alignment.Left, + title_bar_text_indent = 36 + } + }, + { + type = "generic_menu_background", + id = "window_background" + }, + f29_local0 + } + } +end + +local f0_local6 = function () + local f30_local0 = 740 + local f30_local1 = 16 + local f30_local2 = 16 + local f30_local3 = 32 + local f30_local4 = Engine.Localize( "@LUA_MENU_UNLOCK_COLON" ) + local f30_local5, f30_local6, f30_local7, f30_local8 = GetTextDimensions( f30_local4, CoD.TextSettings.BoldFont.Font, CoD.TextSettings.BoldFont.Height ) + local f30_local9 = f30_local7 - f30_local5 + local f30_local10 = 16 + local f30_local11 = 16 + local f30_local12 = 32 + local f30_local13 = Engine.Localize( "@LUA_MENU_PURCHASE_COLON" ) + local f30_local14, f30_local15, f30_local16, f30_local17 = GetTextDimensions( f30_local13, CoD.TextSettings.BoldFont.Font, CoD.TextSettings.BoldFont.Height ) + local f30_local18 = f30_local16 - f30_local14 + local f30_local19 = 30 + local f30_local20 = 12 + local f30_local21 = 19 + local f30_local22 = f30_local0 - f30_local2 - f30_local3 - f30_local9 - f30_local11 - f30_local12 - f30_local18 - f30_local19 - f30_local21 + local self = LUI.UIElement.new() + self.id = "ability_description_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 570, + left = 450, + height = 65, + width = f30_local0 + } ) + self:animateToState( "default" ) + local f30_local24 = LUI.UIHorizontalList.new() + f30_local24.id = "perk_title_row_hl" + f30_local24:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = f30_local20, + left = f30_local21, + height = CoD.TextSettings.BoldFont.Height, + alignment = LUI.Alignment.Left + } ) + f30_local24:animateToState( "default" ) + local f30_local25 = LUI.UIText.new() + f30_local25.id = "perk_name" + f30_local25:setText( "" ) + f30_local25:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = CoD.TextSettings.BoldFont.Height, + width = f30_local22, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.BoldFont.Font + } ) + f30_local25:animateToState( "default" ) + f30_local25:registerEventHandler( "current_ability_changed", function ( element, event ) + element:setText( event.title ) + end ) + local f30_local26 = LUI.UIText.new() + f30_local26.id = "rank_unlock_text" + f30_local26:setText( f30_local4 ) + f30_local26:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = CoD.TextSettings.BoldFont.Height, + width = f30_local9, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.BoldFont.Font, + alpha = 0, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + } ) + f30_local26:registerAnimationState( "locked", { + alpha = 1 + } ) + f30_local26:animateToState( "default" ) + f30_local26:registerEventHandler( "current_ability_changed", function ( element, event ) + if event.is_unlocked == false then + element:animateToState( "locked", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + local f30_local27 = LUI.UIImage.new() + f30_local27.id = "rank_unlock_image" + f30_local27:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f30_local1 * 0.5, + left = -f30_local2 * 0.5, + height = f30_local1, + width = f30_local2, + material = RegisterMaterial( "white" ), + alpha = 0 + } ) + f30_local27:registerAnimationState( "locked", { + alpha = 1 + } ) + f30_local27:animateToState( "default" ) + f30_local27:registerEventHandler( "current_ability_changed", function ( element, event ) + if event.is_unlocked == false then + CoD.SetMaterial( element, RegisterMaterial( Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, event.item_level - 1, RankIconTable.Cols.Standard ) ) ) + element:animateToState( "locked", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + local f30_local28 = LUI.UIText.new() + f30_local28.id = "rank_unlock_num" + f30_local28:setText( "" ) + f30_local28:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = CoD.TextSettings.BoldFont.Height, + width = f30_local3, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.BoldFont.Font, + alpha = 0 + } ) + f30_local28:registerAnimationState( "locked", { + alpha = 1 + } ) + f30_local28:animateToState( "default" ) + f30_local28:registerEventHandler( "current_ability_changed", function ( element, event ) + if event.is_unlocked == false then + element:setText( event.item_level ) + element:animateToState( "locked", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + local f30_local29 = LUI.UIElement.new() + f30_local29.id = "spacer" + f30_local29:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = f30_local19 + } ) + f30_local29:animateToState( "default" ) + local f30_local30 = LUI.UIText.new() + f30_local30.id = "purchase_unlock_text" + f30_local30:setText( f30_local13 ) + f30_local30:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = CoD.TextSettings.BoldFont.Height, + width = f30_local18, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.BoldFont.Font, + alpha = 0, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + } ) + f30_local30:registerAnimationState( "locked", { + alpha = 1 + } ) + f30_local30:animateToState( "default" ) + f30_local30:registerEventHandler( "current_ability_changed", function ( element, event ) + if event.is_unlocked == false then + element:animateToState( "locked", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + local f30_local31 = LUI.UIImage.new() + f30_local31.id = "purchase_unlock_image" + f30_local31:registerAnimationState( "default", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f30_local10 * 0.5, + left = -f30_local11 * 0.5, + height = f30_local10, + width = f30_local11, + material = RegisterMaterial( "icon_unlock_token_active" ), + alpha = 0 + } ) + f30_local31:registerAnimationState( "locked", { + alpha = 1 + } ) + f30_local31:animateToState( "default" ) + f30_local31:registerEventHandler( "current_ability_changed", function ( element, event ) + if event.is_unlocked == false then + element:animateToState( "locked", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + local f30_local32 = LUI.UIText.new() + f30_local32.id = "purchase_unlock_num" + f30_local32:setText( "" ) + f30_local32:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = CoD.TextSettings.BoldFont.Height, + width = f30_local12, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.BoldFont.Font, + alpha = 0 + } ) + f30_local32:registerAnimationState( "locked", { + alpha = 1 + } ) + f30_local32:animateToState( "default" ) + f30_local32:registerEventHandler( "current_ability_changed", function ( element, event ) + if event.is_unlocked == false then + element:setText( event.purchase_cost ) + element:animateToState( "locked", 0 ) + else + element:animateToState( "default", 0 ) + end + end ) + f30_local24:addElement( f30_local25 ) + f30_local24:addElement( f30_local26 ) + f30_local24:addElement( f30_local27 ) + f30_local24:addElement( f30_local28 ) + f30_local24:addElement( f30_local29 ) + f30_local24:addElement( f30_local30 ) + f30_local24:addElement( f30_local31 ) + f30_local24:addElement( f30_local32 ) + local f30_local33 = LUI.UIText.new() + f30_local33.id = "perk_desc" + f30_local33:setText( "" ) + f30_local33:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 34, + left = 19, + height = CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + } ) + f30_local33:animateToState( "default" ) + f30_local33:registerEventHandler( "current_ability_changed", function ( element, event ) + if event.description then + element:setText( event.description ) + end + end ) + self:addElement( f30_local24 ) + self:addElement( f30_local33 ) + return self +end + +function ResetAbilities( f39_arg0, f39_arg1 ) + Engine.PlaySound( CoD.SFX.MouseClick ) + local f39_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f39_arg0 ) + local f39_local1 = f39_local0.strikePackage and "specialistBonusStreaks" or "abilitiesPicked" + Cac.ResetAbilities( f39_arg1.controller, f39_local0.squadLocation, f39_local0.squadMemberIndex, f39_local0.classLocation, f39_local0.slot, f39_local1, f39_local0.strikePackage ) + if f39_local0.strikePackage then + f39_local0.ks[1] = "none" + f39_local0.ks[2] = "none" + f39_local0.ks[3] = "none" + f39_local0.firstKsNone = 1 + Cac.ResetKillstreak( f39_arg1.controller, f39_local0.squadLocation, f39_local0.squadMemberIndex, f39_local0.classLocation, f39_local0.slot, "specialistStreaks" ) + end + f39_local0.sparePoints = (f39_local0.strikePackage and Cac.Abilities.Settings.GrabBagCapacity or Cac.CalculateAbilityCapacity( f39_arg1.controller, f39_local0.squadLocation, f39_local0.squadMemberIndex, f39_local0.classLocation, f39_local0.slot )) - Cac.CountSpentPoints( f39_arg1.controller, f39_local0.squadLocation, f39_local0.squadMemberIndex, f39_local0.classLocation, f39_local0.slot, f39_local1 ) + local f39_local2 = f39_arg0:getParent() + f39_local2:processEvent( { + name = "button_check", + controller = f39_arg1.controller + } ) + f39_local2 = f39_arg0:getParent() + f39_local2:processEvent( { + name = "button_update", + reset = true, + controller = f39_arg1.controller + } ) + f39_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f39_arg1.controller, + dispatchChildren = true, + immediate = true + } ) + f39_arg0:dispatchEventToRoot( { + name = f39_local0.strikePackage and "refresh_specialist_abilities_recap" or "refresh_abilities_recap", + controller = f39_arg1.controller, + specialistType = f39_local0.strikePackage, + selected = true, + immediate = true + } ) +end + +function AddResetHelper( f40_arg0, f40_arg1 ) + local f40_local0 = f40_arg0:getParent() + f40_local0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_RESET" ), + side = "left", + clickable = true + } ) +end + +function MainClose( f41_arg0, f41_arg1 ) + local f41_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f41_arg0 ) + local f41_local1 = f41_local0.strikePackage and "" or Engine.Localize( "@LUA_MENU_CLEAR" ) + local f41_local2 = f41_arg0:getParent() + f41_local2:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = f41_local1, + side = "left", + clickable = true + } ) +end + +function MainCreate( f42_arg0, f42_arg1 ) + local f42_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f42_arg0 ) + local f42_local1 = f42_local0.strikePackage + if not f42_local1 then + f42_local1 = f42_arg0.properties.strikePackage + end + f42_local0.strikePackage = f42_local1 + if f42_local0.strikePackage then + f42_local0.ks = {} + f42_local0.ks[1] = Cac.GetStreak( f42_arg1.controller, f42_local0.squadLocation, f42_local0.squadMemberIndex, f42_local0.classLocation, f42_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak1 ) + f42_local0.ks[2] = Cac.GetStreak( f42_arg1.controller, f42_local0.squadLocation, f42_local0.squadMemberIndex, f42_local0.classLocation, f42_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak2 ) + f42_local0.ks[3] = Cac.GetStreak( f42_arg1.controller, f42_local0.squadLocation, f42_local0.squadMemberIndex, f42_local0.classLocation, f42_local0.slot, "specialistStreaks", Cac.Indices.Killstreaks.Streak3 ) + f42_local0.firstKsNone = #f42_local0.ks + 1 + for f42_local1 = #f42_local0.ks, 1, -1 do + if f42_local0.ks[f42_local1] == "none" then + f42_local0.firstKsNone = f42_local1 + end + end + end + AddResetHelper( f42_arg0, f42_arg1 ) + f42_local1 = f42_local0.strikePackage and "specialistBonusStreaks" or "abilitiesPicked" + f42_arg0:processEvent( { + name = "button_check", + controller = f42_arg1.controller + } ) + f42_local0.sparePoints = (f42_local0.strikePackage and Cac.Abilities.Settings.GrabBagCapacity or Cac.CalculateAbilityCapacity( f42_arg1.controller, f42_local0.squadLocation, f42_local0.squadMemberIndex, f42_local0.classLocation, f42_local0.slot )) - Cac.CountSpentPoints( f42_arg1.controller, f42_local0.squadLocation, f42_local0.squadMemberIndex, f42_local0.classLocation, f42_local0.slot, f42_local1 ) + f42_arg0:processEvent( { + name = "button_update", + controller = f42_arg1.controller + } ) + f42_arg0:dispatchEventToRoot( { + name = f42_local0.strikePackage and "refresh_specialist_abilities_recap" or "refresh_abilities_recap", + dispatchChildren = true, + controller = f42_arg1.controller, + specialistType = f42_local0.strikePackage, + selected = true, + immediate = true + } ) +end + +function cac_ability_alt_main() + return { + type = "UIElement", + id = "cac_ability_alt_main", + properties = { + squadLocation = "privateMatchSquadMembers", + squadMemberIndex = 0, + slot = 0, + classLocation = "loadouts", + strikePackage = false + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = MainCreate, + menu_close = MainClose + }, + children = { + abilities_grid(), + { + type = "cac_ability_description", + id = "cac_ability_description_id" + }, + { + type = "generic_back_button", + handlers = { + button_secondary = function ( f44_arg0, f44_arg1 ) + local f44_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f44_arg0 ) + if f44_local0.strikePackage then + f44_arg0:dispatchEventToRoot( { + name = "show_character_image", + immediate = true + } ) + end + if f44_local0.openMenuOnClose then + LUI.FlowManager.RequestPopupMenu( f44_arg0, f44_local0.openMenuOnClose.menu, true, f44_arg1.controller, true, f44_local0.openMenuOnClose ) + else + LUI.FlowManager.RequestLeaveMenu( f44_arg0, true ) + if Cac.IsAbilityPickedBySlotName( f44_arg1.controller, f44_local0.squadLocation, f44_local0.squadMemberIndex, f44_local0.classLocation, f44_local0.slot, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) and Cac.GetAttachment( f44_arg1.controller, f44_local0.squadLocation, f44_local0.squadMemberIndex, f44_local0.classLocation, f44_local0.slot, 0, 2 ) == "none" and not f44_local0.strikePackage then + f44_arg0:dispatchEventToRoot( { + name = "update_selection_info", + selection_id = "edit_weapon_primary_attach3", + controller = f44_arg1.controller, + squadLocation = f44_local0.squadLocation, + squadMemberIndex = f44_local0.squadMemberIndex, + classLocation = f44_local0.classLocation, + slot = f44_local0.slot + } ) + f44_arg0:dispatchEventToRoot( { + name = "third_attach_focus", + immediate = true + } ) + elseif Cac.IsAbilityPickedBySlotName( f44_arg1.controller, f44_local0.squadLocation, f44_local0.squadMemberIndex, f44_local0.classLocation, f44_local0.slot, "Elite", "specialty_twoprimaries", "abilitiesPicked" ) and Cac.IsWeaponClassSecondary( Cac.GetWeaponClass( Cac.GetWeapon( f44_arg1.controller, f44_local0.squadLocation, f44_local0.squadMemberIndex, f44_local0.classLocation, f44_local0.slot, 1 ) ), true ) and not f44_local0.strikePackage then + f44_arg0:dispatchEventToRoot( { + name = "update_selection_info", + selection_id = "edit_weapon_secondary", + controller = f44_arg1.controller, + squadLocation = f44_local0.squadLocation, + squadMemberIndex = f44_local0.squadMemberIndex, + classLocation = f44_local0.classLocation, + slot = f44_local0.slot + } ) + f44_arg0:dispatchEventToRoot( { + name = "second_primary_focus", + immediate = true + } ) + end + end + end + + } + }, + { + type = "UIBindButton", + id = "reset_abilities", + handlers = { + button_alt1 = ResetAbilities + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "cac_ability_alt_main", cac_ability_alt_main ) +LUI.MenuBuilder.registerType( "cac_ability_alt_button", cac_ability_alt_button ) +LUI.MenuBuilder.registerDef( "cac_purchase_ability_popup", cac_purchase_ability_popup ) +LUI.MenuBuilder.registerDef( "cac_cant_purchase_ability_popup", cac_cant_purchase_ability_popup ) +LUI.MenuBuilder.registerType( "cac_ability_description", f0_local6 ) +LockTable( _M ) diff --git a/lui/mp_menus/caccustomize.dec.lua b/lui/mp_menus/caccustomize.dec.lua new file mode 100644 index 0000000..aae5e2f --- /dev/null +++ b/lui/mp_menus/caccustomize.dec.lua @@ -0,0 +1,2731 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetInterMenuData( f1_arg0 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + return { + open_char_list = true, + squadLocation = f1_local0.squadLocation, + squadMemberIndex = f1_local0.squadMemberIndex, + slot = f1_local0.loadout_slot, + alternateCacMenus = f1_local0.alternateCacMenus, + allowMemberSwap = f1_local0.allowMemberSwap + } +end + +function RebindShoulderButtons( f2_arg0, f2_arg1 ) + f2_arg0:dispatchEventToRoot( { + name = "rebind_shoulder_buttons", + immediate = true + } ) +end + +function UnbindShoulderButtons( f3_arg0, f3_arg1 ) + f3_arg0:dispatchEventToRoot( { + name = "unbind_shoulder_buttons", + immediate = true + } ) +end + +function ChangeGender( f4_arg0, f4_arg1, f4_arg2 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + local f4_local1 = Cac.ResetGenderDependantFields + local f4_local2 = f4_local0.exclusiveControllerIndex + local f4_local3 = f4_local0.squadLocation + local f4_local4 = f4_local0.squadMemberIndex + local f4_local5 + if f4_arg2 then + f4_local5 = Cac.Customization.Gender.Female + if not f4_local5 then + + else + f4_local1( f4_local2, f4_local3, f4_local4, f4_local5 ) + f4_arg0:processEvent( { + name = "content_refresh" + } ) + f4_arg0:dispatchEventToRoot( { + name = "character_full_refresh" + } ) + f4_arg0:dispatchEventToRoot( { + name = "refresh_new_icons" + } ) + end + end + f4_local5 = Cac.Customization.Gender.Male +end + +function cac_customize_gender_popup() + local f5_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + local f5_local1 = Cac.GetCurrentGender( f5_local0.exclusiveControllerIndex, f5_local0.squadLocation, f5_local0.squadMemberIndex ) == Cac.Customization.Gender.Female + local f5_local2 = { + type = "generic_yesno_popup" + } + local f5_local3 = { + cancel_means_no = false, + popup_title = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_GENDER_CAPS" ), + message_text = Engine.Localize( "@LUA_MENU_CHOOSE_GENDER" ), + yes_action = function ( f6_arg0, f6_arg1 ) + ChangeGender( f6_arg0, f6_arg1, true ) + end, + no_action = function ( f7_arg0, f7_arg1 ) + ChangeGender( f7_arg0, f7_arg1, false ) + end, + yes_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FEMALE_CAPS" ), + no_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_MALE_CAPS" ) + } + local f5_local4 + if f5_local1 then + f5_local4 = 1 + if not f5_local4 then + + else + f5_local3.default_focus_index = f5_local4 + f5_local2.properties = f5_local3 + return f5_local2 + end + end + f5_local4 = 2 +end + +function InputClanTagComplete( f8_arg0, f8_arg1 ) + if f8_arg1.text then + local f8_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + Engine.SetAndEnableCustomClanTag( f8_local0.exclusiveControllerIndex, f8_arg1.text ) + RefreshClanTag( f8_arg0 ) + end +end + +function RefreshClanTag( f9_arg0 ) + local f9_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.ClanTag] + local f9_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + f9_arg0:dispatchEventToRoot( { + name = "preview_element", + field = f9_local0, + elementRef = f9_local0.GetSavedRef( f9_local1.exclusiveControllerIndex ) + } ) +end + +function cac_customize_clan_tag_popup() + local f10_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + Engine.AntiCheatBanCheck( f10_local0.exclusiveControllerIndex, CoD.AntiCheat.Ban.FEATURE_BAN_CLAN_TAGS ) + if not f10_local0.currentField or not f10_local0.exclusiveControllerIndex then + DebugPrint( "WARNING: Opening cac_customize_clan_tag_popup while no field is currently selected, this should only happen on LUI reload. Closing popup." ) + return { + type = "UIElement", + handlers = { + menu_create = MBh.LeaveMenu() + } + } + end + local f10_local1 = Clan.AlreadyMember( f10_local0.exclusiveControllerIndex ) and Clan.GetName( f10_local0.exclusiveControllerIndex ) or nil + local f10_local2 = Engine.IsXbox360() + if not f10_local2 then + f10_local2 = Engine.IsXB3() + end + return { + type = "generic_selectionList_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_CHOOSE_" .. f10_local0.currentField.LocName ), + popup_width = 700, + popup_childfeeder = function () + local f11_local0 = {} + local f11_local1 = #f11_local0 + 1 + local f11_local2 = { + type = "UIGenericButton", + id = "use_custom_tag" + } + local f11_local3 = f10_local2 + if f11_local3 then + f11_local3 = not Engine.IsUserSignedInToLive( f10_local0.exclusiveControllerIndex ) + end + f11_local2.disabled = f11_local3 + f11_local2.properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@LUA_MENU_CUSTOM_CLAN_TAG" ), + button_action_func = function ( f12_arg0, f12_arg1 ) + Engine.OpenScreenKeyboard( f10_local0.exclusiveControllerIndex, Engine.Localize( "@LUA_MENU_CUSTOM_CLAN_TAG" ), Engine.GetCustomClanTag( f10_local0.exclusiveControllerIndex ) or "", 4, true, true ) + LUI.FlowManager.RequestLeaveMenu( f12_arg0 ) + end, + button_over_disable_func = function ( f13_arg0, f13_arg1 ) + f13_arg0:dispatchEventToRoot( { + name = "update_clan_tag_help", + text = Engine.Localize( "@PLATFORM_REQUIRE_ONLINE_FOR_CLAN_TAG" ) + } ) + end, + button_over_func = function ( f14_arg0, f14_arg1 ) + f14_arg0:dispatchEventToRoot( { + name = "update_clan_tag_help", + text = Engine.Localize( "@LUA_MENU_CUSTOM_CLAN_TAG_DESC" ) + } ) + end + } + f11_local0[f11_local1] = f11_local2 + if Clan.IsEnabled() then + f11_local0[#f11_local0 + 1] = { + type = "UIGenericButton", + id = "use_tag_from_clan", + disabled = not Clan.AlreadyMember( f10_local0.exclusiveControllerIndex ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = f10_local1 and Engine.Localize( "@LUA_MENU_USE_TAG_FROM_NAMED_ELITE_CLAN", Engine.MarkLocalized( f10_local1 ) ) or Engine.Localize( "@LUA_MENU_USE_TAG_FROM_ELITE_CLAN" ), + button_action_func = function ( f15_arg0, f15_arg1 ) + Engine.SetProfileDataUseEliteClanTag( f10_local0.exclusiveControllerIndex, true ) + LUI.FlowManager.RequestLeaveMenu( f15_arg0 ) + RefreshClanTag( f15_arg0 ) + end, + button_over_disable_func = function ( f16_arg0, f16_arg1 ) + f16_arg0:dispatchEventToRoot( { + name = "update_clan_tag_help", + text = Engine.Localize( "@LUA_MENU_USE_TAG_FROM_ELITE_CLAN_DESC" ) + } ) + end, + button_over_func = function ( f17_arg0, f17_arg1 ) + f17_arg0:dispatchEventToRoot( { + name = "update_clan_tag_help", + text = Engine.Localize( "@LUA_MENU_USE_TAG_FROM_NAMED_ELITE_CLAN_DESC" ) + } ) + end + } + } + end + f11_local1 = #f11_local0 + 1 + f11_local2 = { + type = "UIGenericButton", + id = "clear_tag" + } + f11_local3 = f10_local2 + if f11_local3 then + f11_local3 = not Engine.IsUserSignedInToLive( f10_local0.exclusiveControllerIndex ) + end + f11_local2.disabled = f11_local3 + f11_local2.properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@LUA_MENU_CLEAR_YOUR_CLAN_TAG" ), + button_action_func = function ( f18_arg0, f18_arg1 ) + Engine.ClearCustomClanTag( f10_local0.exclusiveControllerIndex ) + Engine.SetProfileDataUseEliteClanTag( f10_local0.exclusiveControllerIndex, false ) + RefreshClanTag( f18_arg0 ) + LUI.FlowManager.RequestLeaveMenu( f18_arg0 ) + end, + button_over_disable_func = function ( f19_arg0, f19_arg1 ) + f19_arg0:dispatchEventToRoot( { + name = "update_clan_tag_help", + text = Engine.Localize( "@PLATFORM_REQUIRE_ONLINE_FOR_CLAN_TAG" ) + } ) + end, + button_over_func = function ( f20_arg0, f20_arg1 ) + f20_arg0:dispatchEventToRoot( { + name = "update_clan_tag_help", + text = Engine.Localize( "@LUA_MENU_CLEAR_CLAN_TAG_DESC" ) + } ) + end + } + f11_local0[f11_local1] = f11_local2 + f11_local0[#f11_local0 + 1] = { + type = "UIElement", + id = "spacer", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 10 + } + } + } + f11_local0[#f11_local0 + 1] = { + type = "UIText", + id = "help_text", + properties = { + text = Engine.Localize( "@LUA_MENU_CUSTOM_CLAN_TAG_DESC" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1 + } + }, + handlers = { + update_clan_tag_help = function ( f21_arg0, f21_arg1 ) + if f21_arg1.text then + f21_arg0:setText( f21_arg1.text ) + end + end + } + } + return f11_local0 + end + + } + } +end + +function CustomizeSmallPopupButton( f22_arg0, f22_arg1 ) + assert( f22_arg0.currentField ) + local f22_local0 = Cac.IsCustomizationItemDLC( f22_arg0.currentField, f22_arg1 ) + local f22_local1 = function ( f23_arg0, f23_arg1 ) + if f22_arg0.currentField.PreviewFunction then + f23_arg0.previewOutput = f22_arg0.currentField.PreviewFunction( nil, nil, nil, f22_arg1, nil, nil ) + end + assert( f22_arg0.currentField.UnlockType ) + Cac.MarkItemNoMoreNewIcon( f22_arg0.exclusiveControllerIndex, f22_arg1, f22_arg0.currentField.UnlockType ) + f23_arg0:dispatchEventToRoot( { + name = "refresh_new_icons", + immediate = true + } ) + f23_arg0:processEvent( { + name = "hide_new_icon" + } ) + end + + local f22_local2 = function ( f24_arg0, f24_arg1 ) + if f24_arg0.previewOutput then + Engine.StopSound( f24_arg0.previewOutput ) + f24_arg0.previewOutput = nil + end + end + + local self = LUI.UIGenericButton.new( nil, { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( f22_arg0.currentField.GetName( f22_arg1 ) ), + button_over_func = f22_local1, + button_over_disable_func = f22_local1, + button_up_func = f22_local2, + button_disable_func = f22_local2, + button_action_func = function ( f25_arg0, f25_arg1 ) + f22_arg0.currentField.SaveRef( f25_arg1.controller, f22_arg0.squadLocation, f22_arg0.squadMemberIndex, f22_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f25_arg0 ) + end, + button_action_disable_func = function ( f26_arg0, f26_arg1 ) + if f22_local0 and not Cac.IsCustomizationItemUnlocked( f22_arg0.exclusiveControllerIndex, f22_arg0.currentField, f22_arg1 ) and not IsOfflineMatch() then + if Engine.IsPC() then + Sns.OpenStoreMenu( f22_arg0.exclusiveControllerIndex ) + else + assert( f22_arg0.currentField.DLCOffer ) + Sns.OpenStoreLinkConfirmPopup( f22_arg0.exclusiveControllerIndex, Engine.TableLookup( f22_arg0.currentField.csv, 0, f22_arg1, f22_arg0.currentField.DLCOffer ) ) + end + end + end + } ) + self.id = "button_" .. f22_arg1 + self.properties = self.properties or {} + self.properties.allowDisabledAction = true + local f22_local4 = function ( f27_arg0, f27_arg1 ) + local f27_local0 = Cac.IsCustomizationItemUnlocked( f22_arg0.exclusiveControllerIndex, f22_arg0.currentField, f22_arg1 ) + local f27_local1 = f27_arg0 + local f27_local2 = f27_arg0.processEvent + local f27_local3 = {} + local f27_local4 + if f27_local0 then + f27_local4 = "enable" + if not f27_local4 then + + else + f27_local3.name = f27_local4 + f27_local2( f27_local1, f27_local3 ) + f27_arg0:processEvent( { + name = "update_dlc_icon" + } ) + end + end + f27_local4 = "disable" + end + + self:registerEventHandler( "refresh_lock", f22_local4 ) + self:registerEventHandler( "menu_create", f22_local4 ) + if f22_local0 then + self:registerEventHandler( "dlc_mount_complete", f22_local4 ) + end + if f22_local0 then + local f22_local5 = 24 + local f22_local6 = LUI.UIImage.new( { + material = RegisterMaterial( "icon_dlc" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 5, + right = -f22_local5, + width = f22_local5, + height = f22_local5, + alpha = 0 + } ) + f22_local6:registerAnimationState( "visible", { + alpha = 1 + } ) + f22_local6.id = "icon_dlc" + self:addElement( f22_local6 ) + f22_local6:registerEventHandler( "menu_create", function ( element, event ) + element:processEvent( { + name = "update_dlc_icon" + } ) + end ) + f22_local6:registerEventHandler( "update_dlc_icon", function ( element, event ) + local f29_local0 = Cac.IsCustomizationItemUnlocked( f22_arg0.exclusiveControllerIndex, f22_arg0.currentField, f22_arg1 ) + local f29_local1 = element + local f29_local2 = element.animateToState + local f29_local3 + if f29_local0 then + f29_local3 = "default" + if not f29_local3 then + + else + f29_local2( f29_local1, f29_local3 ) + end + end + f29_local3 = "visible" + end ) + end + assert( f22_arg0.currentField.UnlockType ) + if Cac.ItemHasNewIcon( f22_arg0.exclusiveControllerIndex, f22_arg1, f22_arg0.currentField.UnlockType ) then + self:processEvent( { + name = "show_new_icon" + } ) + end + return self +end + +function cac_customize_small_popup() + local f30_local0 = 430 + local f30_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + if not f30_local1.currentField then + DebugPrint( "WARNING: Opening cac_customize_small_popup while no field is currently selected, this should only happen on LUI reload. Closing popup." ) + local self = LUI.UIElement.new() + self:registerEventHandler( "menu_create", MBh.LeaveMenu() ) + return self + end + assert( f30_local1.categories ) + assert( f30_local1.categories[1] ) + f30_local1.elements = f30_local1.categories[1].elements + assert( f30_local1.elements ) + local self = LUI.MenuBuilder.BuildRegisteredType( "generic_selectionList_popup", { + popup_title = f30_local1.categories[1].name + } ) + if f30_local1.currentField.HelpText then + local f30_local3 = LUI.UIText.new( CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + left = 12, + right = -12, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) ) + f30_local3.id = "help_text" + f30_local3:setText( Engine.Localize( f30_local1.currentField.HelpText ) ) + self.addListElement( f30_local3 ) + local f30_local4 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + height = 12, + left = 0, + right = 0 + } ) + f30_local4.id = "separator" + self.addListElement( f30_local4 ) + end + for f30_local6, f30_local7 in ipairs( f30_local1.elements ) do + self.addListElement( CustomizeSmallPopupButton( f30_local1, f30_local7 ) ) + end + return self +end + +function cac_customize_navigation_dots() + local f31_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + local f31_local1 = 12 + local f31_local2 = { + type = "UIHorizontalList", + id = "cac_customize_navigation_dots", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 43, + bottom = 0, + alignment = LUI.Alignment.Center, + spacing = 3, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + menu_create = function ( f32_arg0, f32_arg1 ) + local f32_local0 = f32_arg0 + local f32_local1 = f32_arg0.animateToState + local f32_local2 + if #f31_local0.categories > 1 then + f32_local2 = "default" + if not f32_local2 then + + else + f32_local1( f32_local0, f32_local2 ) + end + end + f32_local2 = "hidden" + end + }, + children = {} + } + for f31_local3 = 1, #f31_local0.categories, 1 do + local f31_local6 = f31_local3 + local f31_local7 = { + type = "UIImage", + id = "nav_dot_" .. f31_local6, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = f31_local1, + top = 0, + bottom = f31_local1, + material = RegisterMaterial( "widg_circle_empty" ) + }, + focused = { + material = RegisterMaterial( "widg_circle_fill" ) + } + } + } + local f31_local8 = {} + local f31_local9 = MBh.AnimateToState + local f31_local10 + if f31_local6 == f31_local0.currentPage then + f31_local10 = "focused" + if not f31_local10 then + + else + f31_local8.menu_create = f31_local9( f31_local10 ) + f31_local8.element_refresh = function ( f33_arg0, f33_arg1 ) + if f33_arg1.page_change then + local f33_local0 = f33_arg0 + local f33_local1 = f33_arg0.animateToState + local f33_local2 = f31_local6 + local f33_local3 = f31_local0.currentPage + f33_local1( f33_local0, REG6 and "focused" or "default" ) + end + end + + f31_local7.handlers = f31_local8 + table.insert( f31_local2.children, f31_local7 ) + end + end + f31_local10 = "default" + end + return f31_local2 +end + +function CloseCustomizeGrid( f34_arg0, f34_arg1 ) + f34_arg0:dispatchEventToRoot( { + name = "close_customize_popup", + immediate = true + } ) + local f34_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + f34_local0.currentPage = nil + f34_local0.rowsOffset = nil + f34_local0.categories = nil + f34_local0.elements = nil + f34_local0.popup = nil +end + +function cac_customize_element_description() + return { + type = "UIElement", + id = "desc_container_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 10, + right = -5, + top = -5 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = -5 - CoD.TextSettings.NormalFont.Height + } + }, + handlers = { + popup_focus_changed = function ( f36_arg0, f36_arg1 ) + local f36_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + if f36_local0.currentElementRef then + local f36_local1, f36_local2 = Cac.Customization.GetReqsStringForItem( f36_local0.currentElementRef, f36_local0.currentField, f36_local0.exclusiveControllerIndex, true, true ) + if f36_local1 then + local f36_local3 = f36_arg0:getChildById( "element_description_main" ) + if f36_local3 then + f36_local3:setText( f36_local1 ) + end + end + if f36_local2 then + local f36_local3 = f36_arg0:getChildById( "element_description_sub" ) + if f36_local3 then + f36_local3:setText( f36_local2 ) + end + end + end + end + + }, + children = { + { + type = "UIMarqueeText", + id = "element_description_main", + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -120, + top = 0, + bottom = 0 + } ) + } + }, + { + type = "UIMarqueeText", + id = "element_description_sub", + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -10, + top = CoD.TextSettings.NormalFont.Height, + bottom = CoD.TextSettings.NormalFont.Height + } ) + } + } + } + } +end + +function cac_customize_element_counter() + return { + type = "UIText", + id = "element_counter", + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = -5, + top = -5 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = -5 - CoD.TextSettings.NormalFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + }, + handlers = { + popup_focus_changed = function ( f38_arg0, f38_arg1 ) + local f38_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + local f38_local1 = "" + if not SvS.IsSvS() and (IsPublicMatch() or IsOnlineAliens()) and f38_local0.currentElementRef then + local f38_local2 = getUnlockReqsForItemOfType( f38_local0.currentElementRef, f38_local0.currentField.UnlockType ) + if f38_local2.chalAndTier and f38_local2.chalAndTier ~= "" then + local f38_local3, f38_local4 = parseChallengeName( f38_local2.chalAndTier ) + local f38_local5 = getGroupRefForOperation( f38_local3 ) + local f38_local6 = f38_local5 + local f38_local7 + if f38_local5 ~= "" then + f38_local7 = isOpActive( f38_local0.exclusiveControllerIndex, f38_local3 ) + else + f38_local7 = false + end + if f38_local7 then + local f38_local8 = getOperationState( f38_local0.exclusiveControllerIndex, f38_local3 ) + if f38_local8 <= f38_local4 then + local f38_local9 = operationGetTargetForTier( f38_local3, f38_local4, true ) + local f38_local10 = operationGetProgress( f38_local0.exclusiveControllerIndex, f38_local3 ) + if f38_local8 > 1 then + f38_local10 = f38_local10 + operationGetTargetForTier( f38_local3, f38_local8 - 1, true ) + end + if f38_local3 == "ch_longersprint_pro" then + local f38_local11 = 528 + f38_local9 = math.floor( tonumber( f38_local9 ) / f38_local11 ) + f38_local10 = math.floor( f38_local10 / f38_local11 ) + end + f38_local1 = f38_local10 .. "/" .. f38_local9 + end + end + elseif f38_local2.killsExt and f38_local2.killsExt ~= "" then + local f38_local3 = tonumber( f38_local2.killsExt ) + local f38_local4 = LUI.mp_menus.Aliens.getAliensCareerWeaponKills( f38_local0.exclusiveControllerIndex ) + if f38_local4 < f38_local3 then + f38_local1 = f38_local4 .. "/" .. f38_local3 + end + elseif f38_local2.escapesExt and f38_local2.escapesExt ~= "" then + local f38_local3 = tonumber( f38_local2.escapesExt ) + local f38_local4 = LUI.mp_menus.Aliens.getAliensCareerEscapes( f38_local0.exclusiveControllerIndex ) + if f38_local4 < f38_local3 then + f38_local1 = f38_local4 .. "/" .. f38_local3 + end + elseif f38_local2.revivesExt and f38_local2.revivesExt ~= "" then + local f38_local3 = tonumber( f38_local2.revivesExt ) + local f38_local4 = LUI.mp_menus.Aliens.getAliensCareerRevives( f38_local0.exclusiveControllerIndex ) + if f38_local4 < f38_local3 then + f38_local1 = f38_local4 .. "/" .. f38_local3 + end + end + end + f38_arg0:setText( f38_local1 ) + end + + } + } +end + +function PreviewElement( f39_arg0, f39_arg1 ) + local f39_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + if f39_local0.currentField then + f39_arg0:dispatchEventToRoot( { + name = "preview_element", + immediate = true, + field = f39_local0.currentField, + elementRef = f39_arg1 + } ) + end +end + +function RefreshScrollbar( f40_arg0, f40_arg1 ) + if f40_arg1.scrollbar and f40_arg0.properties and f40_arg0.properties.elementsPerRow then + f40_arg1.scrollbar:manualUpdate( f40_arg1.rowsOffset, f40_arg0.properties.maxRows, math.ceil( #f40_arg1.elements / f40_arg0.properties.elementsPerRow ), f40_arg0.properties.rowHeight ) + end +end + +function ScrollBy( f41_arg0, f41_arg1, f41_arg2, f41_arg3 ) + local f41_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + local f41_local1 = math.ceil( #f41_local0.elements / f41_arg0.properties.elementsPerRow ) + local f41_local2 = f41_local0.rowsOffset + f41_local0.rowsOffset = LUI.clamp( f41_local0.rowsOffset + f41_arg3, 0, math.max( 0, f41_local1 - f41_arg0.properties.maxRows ) ) + if f41_local2 ~= f41_local0.rowsOffset then + if f41_arg1.qualifier ~= ButtonQualifiers.Mousewheel then + f41_local0.popup:processEvent( { + name = "lose_focus" + } ) + end + f41_local0.popup:processEvent( { + name = "element_refresh", + dispatchChildren = true + } ) + if f41_arg1.qualifier ~= ButtonQualifiers.Mousewheel then + assert( f41_arg2 ) + local f41_local3 = "button" .. f41_arg2 + local f41_local4 = f41_local0.popup:getFirstDescendentById( f41_local3 ) + assert( f41_local4, "Element not found " .. f41_local3 ) + f41_local4:processEvent( { + name = "gain_focus" + } ) + end + RefreshScrollbar( f41_arg0, f41_local0 ) + end +end + +function CustomizePopupGamepadButton( f42_arg0, f42_arg1 ) + local f42_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + if not f42_local0.elements then + return + elseif f42_arg1.down and not f42_arg0.m_ignoreMouseFocus and f42_arg1.qualifier == ButtonQualifiers.Mousewheel then + if f42_arg1.button == "down" then + ScrollBy( f42_arg0, f42_arg1, nil, 1 ) + elseif f42_arg1.button == "up" then + ScrollBy( f42_arg0, f42_arg1, nil, -1 ) + end + return true + else + return LUI.UIElement.GamepadButton( f42_arg0, f42_arg1 ) + end +end + +function CustomizePopupButtonGamepadButton( f43_arg0, f43_arg1, f43_arg2 ) + local f43_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + if f43_arg1.down and f43_arg0:isInFocus() then + local f43_local1 = f43_arg2 <= f43_arg0.properties.elementsPerRow + if f43_arg1.button == "down" and f43_arg0.properties.elementsPerRow * (f43_arg0.properties.maxRows - 1) < f43_arg2 then + ScrollBy( f43_arg0, f43_arg1, f43_arg2, 1 ) + return true + elseif f43_arg1.button == "up" and f43_local1 then + ScrollBy( f43_arg0, f43_arg1, f43_arg2, -1 ) + return true + end + end + return LUI.UIButton.GamepadButton( f43_arg0, f43_arg1 ) +end + +function PropagateFocusChange( f44_arg0, f44_arg1, f44_arg2 ) + f44_arg1.popup:processEvent( { + name = "popup_focus_changed" + } ) + PreviewElement( f44_arg0, f44_arg2 ) +end + +function CustomizePopupGridButtonOver( f45_arg0, f45_arg1, f45_arg2 ) + local f45_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + if not f45_local0.elements or not f45_local0.popup then + return + end + local f45_local1 = math.ceil( f45_local0.currentButtonSlot / f45_arg0.properties.elementsPerRow ) + local f45_local2 = math.ceil( f45_arg2 / f45_arg0.properties.elementsPerRow ) + local f45_local3 = f45_local0.currentButtonSlot or f45_arg2 + local f45_local4 = f45_local0.elements[f45_local0.rowsOffset * f45_arg0.properties.elementsPerRow + f45_arg2] + f45_local0.currentElementRef = f45_local4 + f45_local0.currentButtonSlot = f45_arg2 + if f45_local0.autoFocusButtonNumber == nil then + if f45_local1 ~= f45_local2 and (Engine.IsConsoleGame() or f45_arg1.focusType ~= FocusType.MouseOver) then + if f45_local2 == 1 then + ScrollBy( f45_arg0, f45_arg1, f45_local3, -1 ) + elseif f45_local2 == f45_arg0.properties.maxRows then + ScrollBy( f45_arg0, f45_arg1, f45_local3, 1 ) + end + end + else + f45_arg0.listDefaultFocus = nil + f45_local0.autoFocusButtonNumber = nil + end + PropagateFocusChange( f45_arg0, f45_local0, f45_local4 ) +end + +function CustomizePopupGridButtonActionFactory( f46_arg0, f46_arg1 ) + return function ( f47_arg0, f47_arg1 ) + if f46_arg1.rowsOffset then + f46_arg1.currentField.SaveRef( f47_arg1.controller, f46_arg1.squadLocation, f46_arg1.squadMemberIndex, f46_arg1.elements[f46_arg1.rowsOffset * f47_arg0.properties.elementsPerRow + f46_arg0] ) + CloseCustomizeGrid( f47_arg0, f47_arg1 ) + end + end + +end + +function CustomizePopupGridButtonActionDisableFactory( f48_arg0, f48_arg1 ) + return function ( f49_arg0, f49_arg1 ) + if f48_arg1.rowsOffset and f48_arg1.currentField.DLCOffer then + local f49_local0 = Engine.TableLookup( f48_arg1.currentField.csv, 0, f48_arg1.elements[f48_arg1.rowsOffset * f49_arg0.properties.elementsPerRow + f48_arg0], f48_arg1.currentField.DLCOffer ) + if string.len( f49_local0 ) > 0 then + if Engine.IsPC() then + Sns.OpenStoreMenu( f49_arg1.controller ) + else + Sns.OpenStoreLinkConfirmPopup( f49_arg1.controller, f49_local0 ) + end + end + end + end + +end + +function CustomizePopupGridGenericButtonUpdateLock( f50_arg0, f50_arg1, f50_arg2 ) + local f50_local0 = Cac.IsCustomizationItemUnlocked( f50_arg1.exclusiveControllerIndex, f50_arg1.currentField, f50_arg2 ) + if f50_arg0:isInFocus() then + if f50_arg1.currentElementRef ~= f50_arg2 then + f50_arg1.currentElementRef = f50_arg2 + PropagateFocusChange( f50_arg0, f50_arg1, f50_arg2 ) + end + local f50_local1 = f50_arg0 + local f50_local2 = f50_arg0.dispatchEventToChildren + local f50_local3 = {} + local f50_local4 + if f50_local0 then + f50_local4 = "button_over" + if not f50_local4 then + + else + f50_local3.name = f50_local4 + f50_local3.dispatchChildren = true + f50_local2( f50_local1, f50_local3 ) + end + end + f50_local4 = "button_over_disable" + else + local f50_local1 = f50_arg0 + local f50_local2 = f50_arg0.processEvent + local f50_local3 = {} + local f50_local4 + if f50_local0 then + f50_local4 = "button_up" + if not f50_local4 then + + else + f50_local3.name = f50_local4 + f50_local3.dispatchChildren = true + f50_local2( f50_local1, f50_local3 ) + end + end + f50_local4 = "button_disable" + end + if not f50_local0 and Cac.IsCustomizationItemDLC( f50_arg1.currentField, f50_arg2 ) == true then + f50_arg0:processEvent( { + name = "button_dlc" + } ) + else + f50_arg0:processEvent( { + name = "button_no_dlc" + } ) + end + f50_arg0.disabled = true + if f50_local0 then + f50_arg0.disabled = false + end +end + +function CustomizePopupNewIconCheckFactory( f51_arg0, f51_arg1, f51_arg2, f51_arg3 ) + return function ( f52_arg0, f52_arg1 ) + if f51_arg1.elements and f51_arg1.rowsOffset and f51_arg1.exclusiveControllerIndex and f51_arg1.currentField and f51_arg1.currentField.UnlockType then + local f52_local0 = f51_arg1.elements[f51_arg1.rowsOffset * f52_arg0.properties.elementsPerRow + f51_arg0] + local f52_local1 = Cac.ItemHasNewIcon + local f52_local2 = f51_arg1.exclusiveControllerIndex + local f52_local3 = f52_local0 + local f52_local4 = f51_arg3 + if not f52_local4 then + f52_local4 = f51_arg1.currentField.UnlockType + end + if f52_local1( f52_local2, f52_local3, f52_local4 ) then + f52_arg0:addElement( LUI.UITimer.new( 500, "clear_new_icon", nil, true ) ) + end + end + end + +end + +function CustomizePopupNewIconFactory( f53_arg0, f53_arg1, f53_arg2, f53_arg3 ) + return { + type = "UIImage", + id = "newIcon", + states = { + default = { + material = RegisterMaterial( "icon_new_2" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f53_arg2, + height = 32, + left = 2, + width = 32, + alpha = 0, + scale = 0 + }, + visible = { + alpha = 1, + scale = 0 + }, + darker = { + alpha = 0.5, + scale = -0.1 + } + }, + handlers = { + element_refresh = function ( f54_arg0, f54_arg1 ) + local f54_local0 = f53_arg1.elements[f53_arg1.rowsOffset * f54_arg0.properties.elementsPerRow + f53_arg0] + if f54_local0 and Cac.ItemHasNewIcon( f53_arg1.exclusiveControllerIndex, f54_local0, f53_arg3 or nil, f53_arg1.currentField ) then + local f54_local1 = MBh.AnimateLoop( { + { + "visible", + 0 + }, + { + "darker", + 300 + }, + { + "visible", + 300 + } + } ) + f54_local1( f54_arg0, f54_arg1 ) + else + f54_arg0:animateToState( "default" ) + end + end + , + button_over = CustomizePopupNewIconCheckFactory( f53_arg0, f53_arg1, f53_arg2, f53_arg3 ), + button_over_disable = CustomizePopupNewIconCheckFactory( f53_arg0, f53_arg1, f53_arg2, f53_arg3 ), + clear_new_icon = function ( f55_arg0, f55_arg1 ) + if f53_arg1.elements and f53_arg1.rowsOffset and f53_arg1.exclusiveControllerIndex and f53_arg1.currentField and f53_arg1.currentField.UnlockType then + local f55_local0 = f53_arg1.elements[f53_arg1.rowsOffset * f55_arg0.properties.elementsPerRow + f53_arg0] + local f55_local1 = Cac.ItemHasNewIcon + local f55_local2 = f53_arg1.exclusiveControllerIndex + local f55_local3 = f55_local0 + local f55_local4 = f53_arg3 + if not f55_local4 then + f55_local4 = f53_arg1.currentField.UnlockType + end + if f55_local1( f55_local2, f55_local3, f55_local4 ) then + f55_local1 = Cac.MarkItemNoMoreNewIcon + f55_local2 = f53_arg1.exclusiveControllerIndex + f55_local3 = f55_local0 + f55_local4 = f53_arg3 + if not f55_local4 then + f55_local4 = f53_arg1.currentField.UnlockType + end + f55_local1( f55_local2, f55_local3, f55_local4 ) + f55_arg0:animateToState( "default", 400 ) + f55_arg0:dispatchEventToRoot( { + name = "refresh_new_icons" + } ) + end + end + end + + } + } +end + +function CustomizePopupGridGenericButton( f56_arg0, f56_arg1 ) + local f56_local0 = function ( f57_arg0, f57_arg1 ) + local f57_local0 = 0 + local f57_local1 = 1 + if f56_arg1.rowsOffset and f57_arg0.properties.elementsPerRow then + f57_local1 = f56_arg1.elements[f56_arg1.rowsOffset * f57_arg0.properties.elementsPerRow + f56_arg0] + f57_local0 = tostring( f56_arg1.currentField.GetSavedRef( f56_arg1.exclusiveControllerIndex, f56_arg1.squadLocation, f56_arg1.squadMemberIndex ) ) + end + if f57_local1 == f57_local0 then + f57_arg0:animateToState( "visible" ) + else + f57_arg0:animateToState( "default" ) + end + end + + local f56_local1 = { + type = "UIGenericButton", + id = "button" .. f56_arg0, + listDefaultFocus = f56_arg0 == f56_arg1.autoFocusButtonNumber, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + maxRows = MBh.Property( "maxRows" ), + rowHeight = MBh.Property( "rowHeight" ), + elementWidth = MBh.Property( "elementWidth" ), + elementsPerRow = MBh.Property( "elementsPerRow" ), + allowDisabledAction = true, + button_over_func = function ( f58_arg0, f58_arg1 ) + CustomizePopupGridButtonOver( f58_arg0, f58_arg1, f56_arg0 ) + end, + button_over_disable_func = function ( f59_arg0, f59_arg1 ) + CustomizePopupGridButtonOver( f59_arg0, f59_arg1, f56_arg0 ) + end, + button_action_func = CustomizePopupGridButtonActionFactory( f56_arg0, f56_arg1 ), + button_action_disable_func = CustomizePopupGridButtonActionDisableFactory( f56_arg0, f56_arg1 ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = MBh.Property( "elementWidth" ), + top = 0, + bottom = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + gamepad_button = function ( f60_arg0, f60_arg1 ) + return CustomizePopupButtonGamepadButton( f60_arg0, f60_arg1, f56_arg0 ) + end, + element_refresh = function ( f61_arg0, f61_arg1 ) + local f61_local0 = f56_arg1.elements[f56_arg1.rowsOffset * f61_arg0.properties.elementsPerRow + f56_arg0] + if f61_local0 then + f61_arg0.m_focusable = true + local f61_local1 = f56_arg1.currentField.GetName( f61_local0 ) + if f61_local1 then + f61_arg0:setText( Engine.Localize( f61_local1 ) ) + end + CustomizePopupGridGenericButtonUpdateLock( f61_arg0, f56_arg1, f61_local0 ) + else + f61_arg0:makeNotFocusable() + f61_arg0:animateToState( "hidden" ) + end + end + } + } + local f56_local2 = {} + local f56_local3 = { + type = "UIImage", + id = "selection_triangle", + properties = { + elementsPerRow = MBh.Property( "elementsPerRow" ) + }, + states = { + default = CoD.ColorizeState( Colors.frontend_hilite, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + material = RegisterMaterial( "widg_triangle" ), + top = 3, + left = 3, + width = 12, + height = 12, + alpha = 0 + } ), + visible = { + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "default" ), + button_up = f56_local0, + element_refresh = f56_local0 + } + } + local f56_local4 = { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 4, + right = -24, + width = 24, + height = 24, + material = RegisterMaterial( "icon_dlc" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + button_no_dlc = MBh.AnimateToState( "default" ), + button_dlc = MBh.AnimateToState( "visible" ) + } + } + local f56_local5 = CustomizePopupNewIconFactory( f56_arg0, f56_arg1, 0, f56_arg1.specialField and "Special" or nil ) + f56_local1.children = f56_local3 + return f56_local1 +end + +function CustomizePopupGridGraphicalButton( f62_arg0, f62_arg1 ) + return { + type = "UIButton", + id = "button" .. f62_arg0, + listDefaultFocus = f62_arg0 == f62_arg1.autoFocusButtonNumber, + properties = { + elementsPerRow = MBh.Property( "elementsPerRow" ), + elementWidth = MBh.Property( "elementWidth" ), + rowHeight = MBh.Property( "rowHeight" ), + maxRows = MBh.Property( "maxRows" ), + allowDisabledAction = true + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = MBh.Property( "elementWidth" ), + top = 0, + bottom = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + gamepad_button = function ( f63_arg0, f63_arg1 ) + return CustomizePopupButtonGamepadButton( f63_arg0, f63_arg1, f62_arg0 ) + end + , + element_refresh = function ( f64_arg0, f64_arg1 ) + local f64_local0 = f62_arg1.elements[f62_arg1.rowsOffset * f64_arg0.properties.elementsPerRow + f62_arg0] + if f64_local0 then + f64_arg0.m_focusable = true + CustomizePopupGridGenericButtonUpdateLock( f64_arg0, f62_arg1, f64_local0 ) + else + f64_arg0:makeNotFocusable() + f64_arg0:animateToState( "hidden" ) + end + end + , + button_over = function ( f65_arg0, f65_arg1 ) + CustomizePopupGridButtonOver( f65_arg0, f65_arg1, f62_arg0 ) + end + , + button_over_disable = function ( f66_arg0, f66_arg1 ) + CustomizePopupGridButtonOver( f66_arg0, f66_arg1, f62_arg0 ) + end + , + button_action = CustomizePopupGridButtonActionFactory( f62_arg0, f62_arg1 ), + button_action_disable = CustomizePopupGridButtonActionDisableFactory( f62_arg0, f62_arg1 ), + button_disable = function ( f67_arg0, f67_arg1 ) + if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f67_arg0.properties.elementsPerRow + f62_arg0] then + f67_arg0:animateToState( "default" ) + end + end + , + button_up = function ( f68_arg0, f68_arg1 ) + if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f68_arg0.properties.elementsPerRow + f62_arg0] then + f68_arg0:animateToState( "default" ) + end + end + + }, + children = { + { + type = "UIImage", + id = "patch", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + }, + disabled = { + alpha = 0.2 + } + }, + handlers = { + element_refresh = function ( f69_arg0, f69_arg1 ) + local f69_local0 = f62_arg1.elements[f62_arg1.rowsOffset * f69_arg0.properties.elementsPerRow + f62_arg0] + if f69_local0 then + f69_arg0:setImage( RegisterMaterial( f62_arg1.currentField.GetUIMaterial( f69_local0 ) ) ) + end + end + , + button_disable = function ( f70_arg0, f70_arg1 ) + if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f70_arg0.properties.elementsPerRow + f62_arg0] then + f70_arg0:animateToState( "disabled" ) + end + end + , + button_over_disable = function ( f71_arg0, f71_arg1 ) + if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f71_arg0.properties.elementsPerRow + f62_arg0] then + f71_arg0:animateToState( "disabled" ) + end + end + , + button_up = function ( f72_arg0, f72_arg1 ) + if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f72_arg0.properties.elementsPerRow + f62_arg0] then + f72_arg0:animateToState( "default" ) + end + end + , + button_over = function ( f73_arg0, f73_arg1 ) + if f62_arg1.rowsOffset and f62_arg1.elements[f62_arg1.rowsOffset * f73_arg0.properties.elementsPerRow + f62_arg0] then + f73_arg0:animateToState( "default" ) + end + end + + } + }, + CustomizePopupNewIconFactory( f62_arg0, f62_arg1, 2, nil ), + { + type = "UIImage", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + bottom = -5, + right = -5, + width = 16, + height = 16, + material = RegisterMaterial( "icon_lock_mini" ) + }, + button_up = { + alpha = 0 + }, + button_over = { + alpha = 0 + }, + button_disable = { + alpha = 1 + }, + button_over_disable = { + alpha = 1 + } + }, + handlers = { + button_up = MBh.AnimateToState( "button_up" ), + button_over = MBh.AnimateToState( "button_over" ), + button_disable = MBh.AnimateToState( "button_disable" ), + button_over_disable = MBh.AnimateToState( "button_over_disable" ) + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 5, + right = -2, + width = 24, + height = 24, + material = RegisterMaterial( "icon_dlc" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + button_no_dlc = MBh.AnimateToState( "default" ), + button_dlc = MBh.AnimateToState( "visible" ) + } + }, + { + type = "UIImage", + properties = { + elementsPerRow = MBh.Property( "elementsPerRow" ) + }, + states = { + default = CoD.ColorizeState( Colors.grey_4, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + material = RegisterMaterial( "widg_triangle" ), + top = 3, + left = 3, + width = 12, + height = 12 + } ), + button_up = CoD.ColorizeState( Colors.grey_4, { + alpha = 0 + } ), + button_disable = CoD.ColorizeState( Colors.grey_14, { + alpha = 0 + } ), + button_over = CoD.ColorizeState( Colors.white, { + alpha = 1 + } ), + button_over_disable = CoD.ColorizeState( Colors.white, { + alpha = 0 + } ), + button_selected = CoD.ColorizeState( Colors.frontend_hilite, { + alpha = 1 + } ) + }, + handlers = { + button_up = function ( f74_arg0, f74_arg1 ) + local f74_local0 = 0 + local f74_local1 = 1 + if f62_arg1.rowsOffset and f74_arg0.properties.elementsPerRow then + f74_local1 = f62_arg1.elements[f62_arg1.rowsOffset * f74_arg0.properties.elementsPerRow + f62_arg0] + f74_local0 = tostring( f62_arg1.currentField.GetSavedRef( f62_arg1.exclusiveControllerIndex, f62_arg1.squadLocation, f62_arg1.squadMemberIndex ) ) + end + if f74_local1 == f74_local0 then + f74_arg0:animateToState( "button_selected" ) + else + f74_arg0:animateToState( "button_up" ) + end + end + , + button_disable = MBh.AnimateToState( "button_disable" ), + button_over = function ( f75_arg0, f75_arg1 ) + local f75_local0 = 0 + local f75_local1 = 1 + if f62_arg1.rowsOffset and f75_arg0.properties.elementsPerRow then + f75_local1 = f62_arg1.elements[f62_arg1.rowsOffset * f75_arg0.properties.elementsPerRow + f62_arg0] + f75_local0 = tostring( f62_arg1.currentField.GetSavedRef( f62_arg1.exclusiveControllerIndex, f62_arg1.squadLocation, f62_arg1.squadMemberIndex ) ) + end + if f75_local1 == f75_local0 then + f75_arg0:animateToState( "button_selected" ) + else + f75_arg0:animateToState( "button_over" ) + end + end + , + button_over_disable = MBh.AnimateToState( "button_over_disable" ) + } + }, + { + type = "generic_border", + properties = { + inner = true, + thickness = Engine.IsConsoleGame() and 1 or 2, + border_red = Colors.grey_4.r, + border_green = Colors.grey_4.g, + border_blue = Colors.grey_4.b + }, + handlers = { + button_up = function ( f76_arg0, f76_arg1 ) + f76_arg0:processEvent( { + name = "updateBorderColor", + red = Colors.grey_4.r, + green = Colors.grey_4.g, + blue = Colors.grey_4.b + } ) + end + , + button_disable = function ( f77_arg0, f77_arg1 ) + f77_arg0:processEvent( { + name = "updateBorderColor", + red = Colors.grey_14.r, + green = Colors.grey_14.g, + blue = Colors.grey_14.b + } ) + end + , + button_over = function ( f78_arg0, f78_arg1 ) + f78_arg0:processEvent( { + name = "updateBorderColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + end + , + button_over_disable = function ( f79_arg0, f79_arg1 ) + f79_arg0:processEvent( { + name = "updateBorderColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + end + + } + } + } + } +end + +function CustomizePopupGridFeeder( f80_arg0 ) + local f80_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + if not f80_local0.popup then + return {} + end + local f80_local1 = {} + for f80_local2 = 1, f80_arg0.maxRows * f80_arg0.elementsPerRow, 1 do + table.insert( f80_local1, f80_local0.currentField.SelectionButtonFactory( f80_local2, f80_local0 ) ) + end + return f80_local1 +end + +function cac_customize_base_popup( f81_arg0 ) + local f81_local0 = f81_arg0.width or 448 + local f81_local1 = 10 + local f81_local2 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + if not f81_local2.currentField then + DebugPrint( "WARNING: Opening cac_customize_grid_popup while no field or page is currently selected, this should only happen on LUI reload. Closing popup." ) + return { + type = "UIElement", + handlers = { + menu_create = MBh.LeaveMenu() + } + } + end + local f81_local3 = { + type = "UIElement", + id = "cac_customize_popup", + properties = { + maxRows = f81_arg0.maxRows or 4, + elementsPerRow = f81_arg0.elementsPerRow or 4, + rowHeight = f81_arg0.rowHeight or 95, + elementWidth = f81_arg0.elementWidth or 95 + }, + states = { + visible = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 100, + top = 108, + width = f81_local0, + height = 530 + }, + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -f81_local0, + top = 108, + width = f81_local0, + height = 530 + } + }, + handlers = { + popup_active = function ( f83_arg0, f83_arg1 ) + f83_arg0.m_ignoreMouseFocus = true + UnbindShoulderButtons( f83_arg0, f83_arg1 ) + end, + popup_inactive = function ( f84_arg0, f84_arg1 ) + f84_arg0.m_ignoreMouseFocus = nil + RebindShoulderButtons( f84_arg0, f84_arg1 ) + end, + gamepad_button = CustomizePopupGamepadButton, + menu_create = function ( f85_arg0, f85_arg1 ) + f85_arg0:animateToState( "visible", 80 ) + local f85_local0 = f85_arg0:getFirstDescendentById( "custom_elements_grid" ) + f85_local0 = f85_local0.vlist + f81_local2.scrollbar = f85_arg0:getFirstDescendentById( "scrollbar" ) + f81_local2.scrollbar:setList( f85_local0 ) + f85_arg0:dispatchEventToRoot( { + name = "open_customize_popup", + immediate = true + } ) + if #f81_local2.categories <= 1 then + RebindShoulderButtons( f85_arg0, f85_arg1 ) + else + f85_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_shoulderl", + button_ref2 = "", + helper_text = "", + side = "left", + clickable = true, + immediate = true + } ) + end + f85_arg0:addElement( LUI.MenuBuilder.buildItems( { + type = "online_friends_widget", + states = { + default = { + scale = -1, + alpha = 0 + } + } + }, {} ) ) + f85_arg0:dispatchEventToRoot( { + name = "rebind_back_button", + immediate = true + } ) + if not Engine.IsAliensMode() and f81_local2.squadLocation == "squadMembers" then + f85_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + button_ref2 = "", + helper_text = Engine.Localize( "@LUA_MENU_OPERATIONS" ), + side = "left", + clickable = true, + immediate = true + } ) + else + f85_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + button_ref2 = "", + helper_text = "", + side = "left", + clickable = true, + immediate = true + } ) + end + f85_arg0:processEvent( { + name = "change_page", + diff = 0 + } ) + end, + close_customize_popup = function ( f86_arg0, f86_arg1 ) + f86_arg0:dispatchEventToRoot( { + name = "add_loadout_button_helper" + } ) + f86_arg0:dispatchEventToRoot( { + name = "update_camo" + } ) + f86_arg0:animateToState( "default", 80 ) + f86_arg0:registerEventHandler( LUI.FormatAnimStateFinishEvent( "default" ), MBh.LeaveMenu() ) + end, + menu_close = function ( f87_arg0, f87_arg1 ) + f87_arg0:dispatchEventToRoot( { + name = "character_full_refresh", + immediate = true + } ) + end, + change_page = function ( f82_arg0, f82_arg1 ) + assert( f82_arg1.diff, "Invalid page change" ) + if not f81_local2.categories then + return + elseif f82_arg1.diff ~= 0 and #f81_local2.categories <= 1 then + return + end + f81_local2.popup = f82_arg0 + if f82_arg1.diff ~= 0 then + f81_local2.currentPage = f81_local2.currentPage or 1 + f81_local2.currentPage = 1 + (f81_local2.currentPage - 1 + f82_arg1.diff) % #f81_local2.categories + f81_local2.rowsOffset = 0 + f81_local2.currentButtonSlot = 1 + end + f81_local2.elements = f81_local2.categories[f81_local2.currentPage].elements + f82_arg0:processEvent( { + name = "refresh_info_pane_header", + header = f81_local2.categories[f81_local2.currentPage].name + } ) + local f82_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f82_arg0 ) + if f82_arg1.diff ~= 0 then + f82_arg0:processEvent( { + name = "lose_focus" + } ) + end + if f82_local0.filledGrid then + f82_arg0:processEvent( { + name = "element_refresh", + page_change = true, + dispatchChildren = true + } ) + else + f82_arg0:processEvent( { + name = "menu_refresh" + } ) + f82_arg0:processEvent( { + name = "update_navigation" + } ) + f82_local0.filledGrid = true + end + if f82_arg1.diff ~= 0 then + f82_arg0:processEvent( { + name = "update_navigation" + } ) + f82_arg0:clearSavedState() + if not f82_arg1.mouse then + f82_arg0:processEvent( { + name = "gain_focus" + } ) + end + RefreshScrollbar( f82_arg0, f81_local2 ) + end + end, + dlc_mount_complete = function ( f88_arg0, f88_arg1 ) + f88_arg0:processEvent( { + name = "element_refresh" + } ) + end + } + } + local f81_local4 = {} + local f81_local5 = { + type = "cac_basic_info_pane_header", + properties = { + titleText = "Oink", + width = f81_local0, + height = GenericTitleBarDims.TitleBarHeight + }, + handlers = { + menu_create = function ( f89_arg0, f89_arg1 ) + if #f81_local2.categories > 1 then + f89_arg0:processEvent( { + name = "show_lt" + } ) + f89_arg0:processEvent( { + name = "show_rt" + } ) + else + f89_arg0:processEvent( { + name = "hide_lt" + } ) + f89_arg0:processEvent( { + name = "hide_rt" + } ) + end + end, + info_panel_go_left = MBh.EmitEventToParent( { + name = "change_page", + mouse = true, + diff = -1 + } ), + info_panel_go_right = MBh.EmitEventToParent( { + name = "change_page", + mouse = true, + diff = 1 + } ) + } + } + local f81_local6 = { + type = "generic_menu_background_withfade" + } + local f81_local7 = cac_customize_navigation_dots() + local f81_local8 = { + type = "UIVerticalScrollbar", + id = "scrollbar", + properties = { + maxRows = MBh.Property( "maxRows" ), + rowHeight = MBh.Property( "rowHeight" ), + elementsPerRow = MBh.Property( "elementsPerRow" ), + on_move_func = function ( f90_arg0, f90_arg1, f90_arg2, f90_arg3 ) + if f81_local2.elements then + local f90_local0 = math.ceil( #f81_local2.elements / f90_arg3.elementsPerRow ) + f81_local2.rowsOffset = math.floor( f90_arg2 * f90_local0 ) + f81_local2.rowsOffset = LUI.clamp( f81_local2.rowsOffset, 0, math.max( 0, f90_local0 - f90_arg3.maxRows ) ) + f90_arg1:processEvent( { + name = "element_refresh", + dispatchChildren = true, + immediate = true + } ) + f90_arg0:manualUpdate( f81_local2.rowsOffset, f90_arg3.maxRows, f90_local0, f90_arg3.rowHeight ) + end + end + } + } + local f81_local9 = {} + local f81_local10 = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true + } + local f81_local11 + if #f81_local2.categories > 1 then + f81_local11 = 64 + if not f81_local11 then + + else + f81_local10.top = f81_local11 + f81_local10.height = 2 + f81_arg0.maxRows * f81_arg0.rowHeight + f81_local1 * math.max( 0, f81_arg0.maxRows - 1 ) + f81_local10.width = 10 + f81_local10.right = -5 + f81_local9.default = f81_local10 + f81_local8.states = f81_local9 + f81_local8.handlers = { + init_scrollbar = function ( f91_arg0, f91_arg1 ) + local f91_local0 = f91_arg0.properties + if f81_local2.elements then + f91_arg0:manualUpdate( f81_local2.rowsOffset, f91_local0.maxRows, math.ceil( #f81_local2.elements / f91_local0.elementsPerRow ), f91_local0.rowHeight ) + end + end + } + f81_local8.children = { + { + type = "UITimer", + properties = { + event = "init_scrollbar", + interval = 1, + disposable = true, + deferNextFrame = true + } + } + } + f81_local9 = cac_customize_element_description() + f81_local10 = cac_customize_element_counter() + f81_local11 = { + type = "UIGrid", + id = "custom_elements_grid", + properties = { + maxRows = MBh.Property( "maxRows" ), + elementsPerRow = MBh.Property( "elementsPerRow" ), + rowHeight = MBh.Property( "rowHeight" ), + elementWidth = MBh.Property( "elementWidth" ), + hSpacing = 10, + vSpacing = f81_local1, + disableVWrap = true, + disableHWrap = true + } + } + local f81_local12 = {} + local f81_local13 = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true + } + local f81_local14 + if #f81_local2.categories > 1 then + f81_local14 = 64 + if not f81_local14 then + + else + f81_local13.top = f81_local14 + f81_local13.left = 6 + f81_local13.right = 0 + f81_local13.bottom = 0 + f81_local12.default = f81_local13 + f81_local11.states = f81_local12 + f81_local11.childrenFeeder = CustomizePopupGridFeeder + f81_local12 = { + type = "UIBindButton", + handlers = { + button_secondary = CloseCustomizeGrid, + button_shoulderl = function ( f92_arg0, f92_arg1 ) + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then + local f92_local0 = f92_arg0:getParent() + f92_local0:processEvent( { + name = "change_page", + diff = -1 + } ) + end + end, + button_shoulderr = function ( f93_arg0, f93_arg1 ) + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then + local f93_local0 = f93_arg0:getParent() + f93_local0:processEvent( { + name = "change_page", + diff = 1 + } ) + end + end, + button_alt1 = function ( f94_arg0, f94_arg1 ) + local f94_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + if not Engine.IsAliensMode() and f94_local0 and f94_local0.squadLocation == "squadMembers" then + LUI.FlowManager.RequestPopupMenu( f94_arg0, "operations_main_menu", true, f94_arg1.controller, false ) + end + end + } + } + f81_local4[1] = f81_local5 + f81_local4[2] = f81_local6 + f81_local4[3] = f81_local7 + f81_local4[4] = f81_local8 + f81_local4[5] = f81_local9 + f81_local4[6] = f81_local10 + f81_local4[7] = f81_local11 + f81_local4[8] = f81_local12 + f81_local3.children = f81_local4 + return f81_local3 + end + end + f81_local14 = 42 + end + end + f81_local11 = 42 +end + +function ComputeCustomizationPopupDefaultFocus( f95_arg0, f95_arg1, f95_arg2 ) + local f95_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + if not f95_local0.currentField then + return + end + local f95_local1 = f95_local0.currentField.GetSavedRef( f95_local0.exclusiveControllerIndex, f95_local0.squadLocation, f95_local0.squadMemberIndex ) + for f95_local8, f95_local9 in ipairs( f95_local0.categories ) do + for f95_local5, f95_local6 in ipairs( f95_local9.elements ) do + if Cac.ItemHasNewIcon( f95_local0.exclusiveControllerIndex, f95_local6, f95_local0.specialField and "Special" or f95_local0.currentField.UnlockType ) then + f95_local0.currentPage = f95_local8 + f95_local0.rowsOffset = LUI.clamp( math.ceil( f95_local5 / f95_arg2 ) - 1, 0, math.max( 0, math.ceil( #f95_local9.elements / f95_arg2 ) - f95_arg1 ) ) + if f95_local0.rowsOffset ~= f95_local5 - 1 then + f95_local0.autoFocusButtonNumber = f95_local5 - f95_local0.rowsOffset * f95_arg2 + f95_local0.currentButtonSlot = f95_local0.autoFocusButtonNumber + end + return + end + end + end + for f95_local8, f95_local9 in ipairs( f95_local0.categories ) do + for f95_local5, f95_local6 in ipairs( f95_local9.elements ) do + if tonumber( f95_local6 ) == f95_local1 then + f95_local0.currentPage = f95_local8 + f95_local0.rowsOffset = LUI.clamp( math.ceil( f95_local5 / f95_arg2 ) - 1, 0, math.max( 0, math.ceil( #f95_local9.elements / f95_arg2 ) - f95_arg1 ) ) + if f95_local0.rowsOffset ~= f95_local5 - 1 then + f95_local0.autoFocusButtonNumber = f95_local5 - f95_local0.rowsOffset * f95_arg2 + f95_local0.currentButtonSlot = f95_local0.autoFocusButtonNumber + end + end + end + end +end + +function cac_customize_buttons_popup() + local f96_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + local f96_local1 + if f96_local0.categories then + if #f96_local0.categories > 1 then + f96_local1 = 11 + if not f96_local1 then + + else + local f96_local2 = 1 + ComputeCustomizationPopupDefaultFocus( f96_local0, f96_local1, f96_local2 ) + return cac_customize_base_popup( { + width = 436, + maxRows = f96_local1, + elementsPerRow = f96_local2, + rowHeight = GenericButtonSettings.Styles.GlassButton.SubStyles.Default.height, + elementWidth = 410 + } ) + end + end + f96_local1 = 12 + if not f96_local1 then + f96_local1 = 1 + end + else + f96_local1 = 1 + end + local f96_local2 = 1 + ComputeCustomizationPopupDefaultFocus( f96_local0, f96_local1, f96_local2 ) + return cac_customize_base_popup( { + width = 436, + maxRows = f96_local1, + elementsPerRow = f96_local2, + rowHeight = GenericButtonSettings.Styles.GlassButton.SubStyles.Default.height, + elementWidth = 410 + } ) +end + +function cac_customize_vlist_popup() + local f97_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + local f97_local1 = 6 + local f97_local2 = 1 + ComputeCustomizationPopupDefaultFocus( f97_local0, f97_local1, f97_local2 ) + return cac_customize_base_popup( { + width = 436, + maxRows = f97_local1, + elementsPerRow = f97_local2, + rowHeight = 59, + elementWidth = 410 + } ) +end + +function cac_customize_grid_popup() + local f98_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + local f98_local1 = 4 + local f98_local2 = 4 + ComputeCustomizationPopupDefaultFocus( f98_local0, f98_local1, f98_local2 ) + return cac_customize_base_popup( { + width = 436, + maxRows = f98_local1, + elementsPerRow = f98_local2, + rowHeight = 95, + elementWidth = 95 + } ) +end + +function refresh_customize_new_icon( f99_arg0, f99_arg1, f99_arg2, f99_arg3, f99_arg4 ) + local f99_local0 = Cac.GetCurrentGender( f99_arg1, f99_arg2, f99_arg3 ) + if not Cac.IsCommonGender( f99_local0 ) then + f99_local0 = Cac.Customization.Gender.Male + end + if Cac.AnyUnseenMDLCItems( f99_arg1, { + f99_arg4.UnlockType + }, f99_local0 ) then + f99_arg0:processEvent( { + name = "show_new_icon" + } ) + else + f99_arg0:processEvent( { + name = "hide_new_icon" + } ) + end +end + +function refresh_customize_new_icon_gender( f100_arg0, f100_arg1, f100_arg2, f100_arg3, f100_arg4 ) + local f100_local0 = Cac.GetCurrentGender( f100_arg1, f100_arg2, f100_arg3 ) + local f100_local1 = nil + if f100_local0 == "m" then + f100_local1 = "f" + else + f100_local1 = "m" + end + if Cac.AnyUnseenMDLCItems( f100_arg1, { + "Head", + "Body" + }, f100_local1 ) then + f100_arg0:processEvent( { + name = "show_new_icon" + } ) + else + f100_arg0:processEvent( { + name = "hide_new_icon" + } ) + end +end + +function fields_vlist() + local f101_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_customize_main" ) + local f101_local1 = function ( f102_arg0, f102_arg1 ) + f102_arg0:dispatchEventToRoot( { + name = "show_playercard", + immediate = true, + fade = 100 + } ) + end + + local f101_local2 = function ( f103_arg0, f103_arg1 ) + f103_arg0:dispatchEventToRoot( { + name = "hide_playercard", + immediate = true, + fade = 100 + } ) + end + + local f101_local3 = function ( f104_arg0, f104_arg1 ) + if f104_arg1.ImpactsPlayercard then + f101_local1( f104_arg0, event ) + else + f101_local2( f104_arg0, event ) + end + end + + local f101_local4 = function ( f105_arg0, f105_arg1 ) + local f105_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f105_local1 = f105_arg1 == Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f105_local2 = f105_arg1 == Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + local f105_local3 = f105_arg1 == Cac.Customization.Fields[Cac.Customization.FieldIndexes.GuardDog] + local f105_local4 = f105_arg1 == Cac.Customization.Fields[Cac.Customization.FieldIndexes.Announcer] + local f105_local5 = f105_arg1 == f105_local0 + local f105_local6 = f105_arg1 == "gender" + local f105_local7 = f105_arg1 == "special" + local f105_local8 = not Cac.IsCommonGender( Cac.GetCurrentGender( f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex ) ) + if f105_local5 or f105_local2 or f105_local1 or f105_local6 then + if f105_local8 then + f105_arg0:dispatchEventToRoot( { + name = "show_warning", + immediate = true, + text = Engine.Localize( "LUA_MENU_CUSTOMIZATION_SPECIAL_WARNING" ) + } ) + elseif f105_local1 and not Cac.DoesHeadUseHelmet( f105_local0.GetSavedRef( f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex ) ) then + f105_arg0:dispatchEventToRoot( { + name = "show_warning", + immediate = true, + text = Engine.Localize( "LUA_MENU_CUSTOMIZATION_HELMET_WARNING" ) + } ) + else + f105_arg0:dispatchEventToRoot( { + name = "hide_warning", + immediate = true + } ) + end + elseif f105_local7 and not f105_local8 then + f105_arg0:dispatchEventToRoot( { + name = "show_warning", + immediate = true, + text = Engine.Localize( "LUA_MENU_CUSTOMIZATION_RESET_WARNING" ) + } ) + elseif f105_local3 then + f105_arg0:dispatchEventToRoot( { + name = "show_warning", + immediate = true, + text = Engine.Localize( "LUA_MENU_MP_CUSTOMIZATION_DOG_WARNING" ) + } ) + elseif f105_local4 then + f105_arg0:dispatchEventToRoot( { + name = "show_warning", + immediate = true, + text = Engine.Localize( "LUA_MENU_MP_CUSTOMIZATION_DOG_WARNING" ) + } ) + else + f105_arg0:dispatchEventToRoot( { + name = "hide_warning", + immediate = true + } ) + end + end + + local f101_local5 = { + type = "UIVerticalList", + id = "fields_vlist", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = 9000, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + open_customize_popup = MBh.AnimateToState( "hidden", 80 ), + close_customize_popup = MBh.AnimateToState( "default", 80 ) + }, + children = {} + } + table.insert( f101_local5.children, { + type = "UIGenericButton", + id = "button_special", + properties = { + button_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_SPECIAL_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_DESC_SPECIAL" ), + button_action_func = function ( f106_arg0, f106_arg1 ) + f101_local0.currentField = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + f101_local0.specialField = true + f101_local0.currentPage = 1 + f101_local0.rowsOffset = 0 + f101_local0.currentButtonSlot = 1 + f101_local0.categories = Cac.Customization.GetCategorizedElementRefsForField( f106_arg1.controller, f101_local0.currentField, function ( f107_arg0 ) + return not Cac.IsCommonGender( f107_arg0 ) + end ) + LUI.FlowManager.RequestPopupMenu( f106_arg0, "cac_customize_buttons_popup", true, f106_arg1.controller, false ) + end, + button_over_func = function ( f108_arg0, f108_arg1 ) + f101_local2( f108_arg0, f108_arg1 ) + f101_local4( f108_arg0, "special" ) + end, + additional_handlers = { + refresh_new_icons = function ( f109_arg0, f109_arg1 ) + if Cac.AnyUnseenMDLCItems( f101_local0.exclusiveControllerIndex, { + "Special" + } ) then + f109_arg0:processEvent( { + name = "show_new_icon" + } ) + else + f109_arg0:processEvent( { + name = "hide_new_icon" + } ) + end + end, + menu_create = function ( f110_arg0, f110_arg1 ) + if Cac.AnyUnseenMDLCItems( f101_local0.exclusiveControllerIndex or 0, { + "Special" + } ) then + f110_arg0:processEvent( { + name = "show_new_icon" + } ) + end + end + } + } + } ) + table.insert( f101_local5.children, { + type = "UIGenericButton", + id = "button_gender", + properties = { + button_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_GENDER_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_DESC_GENDER" ), + button_action_func = function ( f111_arg0, f111_arg1 ) + LUI.FlowManager.RequestPopupMenu( f111_arg0, "cac_customize_gender_popup", true, f111_arg1.controller, false, {} ) + end, + button_over_func = function ( f112_arg0, f112_arg1 ) + f101_local2( f112_arg0, f112_arg1 ) + f101_local4( f112_arg0, "gender" ) + end, + additional_handlers = { + refresh_new_icons = function ( f113_arg0, f113_arg1 ) + if Engine.IsAliensMode() then + refresh_customize_new_icon_gender( f113_arg0, f101_local0.exclusiveControllerIndex, "coopSquadMembers", 0, field ) + else + refresh_customize_new_icon_gender( f113_arg0, f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex, field ) + end + end, + menu_create = function ( f114_arg0, f114_arg1 ) + if Engine.IsAliensMode() then + refresh_customize_new_icon_gender( f114_arg0, f101_local0.exclusiveControllerIndex, "coopSquadMembers", 0, field ) + else + refresh_customize_new_icon_gender( f114_arg0, f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex, field ) + end + end + } + } + } ) + local f101_local6 = IsPublicMatch() + if not f101_local6 then + f101_local6 = IsOnlineAliens() + end + for f101_local22, f101_local23 in ipairs( Cac.Customization.Fields ) do + if not f101_local23.PublicOnly or f101_local6 then + local f101_local10 = f101_local22 == Cac.Customization.FieldIndexes.ClanTag + local f101_local11 = f101_local22 == Cac.Customization.FieldIndexes.Patchbacking + local f101_local12 = f101_local22 == Cac.Customization.FieldIndexes.GuardDog + local f101_local13 = f101_local22 == Cac.Customization.FieldIndexes.Announcer + local f101_local14 + if 1 == Engine.GetDvarInt( "igs_swp" ) then + f101_local14 = not Engine.IsAliensMode() + else + f101_local14 = false + end + local f101_local15 + if 0 ~= Engine.GetDvarInt( "igs_announcer" ) then + f101_local15 = not Engine.IsAliensMode() + else + f101_local15 = false + end + if not f101_local11 and (not f101_local10 or Engine.IsConsoleGame()) and (not f101_local12 or f101_local14) and (not f101_local13 or f101_local15) then + local f101_local16 = f101_local23.buttonVariant + if not f101_local16 then + f101_local16 = GenericButtonSettings.Variants.Plain + end + if f101_local12 then + table.insert( f101_local5.children, { + type = "generic_separator" + } ) + end + local f101_local17 = table.insert + local f101_local18 = f101_local5.children + local f101_local19 = { + type = "UIGenericButton", + id = "button_" .. f101_local23.LocName + } + local f101_local20 = {} + local f101_local21 + if f101_local16 ~= GenericButtonSettings.Variants.Plain then + f101_local21 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height, + right = GenericMenuDims.menu_right_wide, + left = 0 + } + if not f101_local21 then + + else + f101_local20.default = f101_local21 + f101_local19.states = f101_local20 + f101_local19.properties = { + variant = f101_local16, + button_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_" .. f101_local23.LocName .. "_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_DESC_" .. f101_local23.LocName ), + button_display_func = function ( f115_arg0, f115_arg1 ) + local f115_local0 = assert + local f115_local1 = f101_local23.GetSavedRef + if f115_local1 then + f115_local1 = f101_local23.GetName + end + f115_local0( f115_local1 ) + return Engine.Localize( f101_local23.GetName( f101_local23.GetSavedRef( f101_local0.exclusiveControllerIndex or 0 ) ) ) + end, + button_action_func = function ( f116_arg0, f116_arg1 ) + f101_local0.currentPage = 1 + f101_local0.rowsOffset = 0 + f101_local0.currentButtonSlot = 1 + if not f101_local10 then + local f116_local0 = Cac.GetCurrentGender( f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex ) + if not Cac.IsCommonGender( f116_local0 ) then + f116_local0 = Cac.Customization.Gender.Male + end + f101_local0.categories = Cac.Customization.GetCategorizedElementRefsForField( f116_arg1.controller, f101_local0.currentField, f116_local0 ) + end + LUI.FlowManager.RequestPopupMenu( f116_arg0, f101_local23.SelectionPopup, true, f116_arg1.controller, false ) + end, + button_over_func = function ( f117_arg0, f117_arg1 ) + f101_local0.currentField = f101_local23 + f101_local0.specialField = false + f117_arg0:dispatchEventToRoot( { + name = "current_field_changed", + immediate = true + } ) + f117_arg0:processEvent( { + name = "content_refresh" + } ) + f101_local3( f117_arg0, f101_local23 ) + f101_local4( f117_arg0, f101_local23 ) + end, + button_over_disable_func = function ( f118_arg0, f118_arg1 ) + f101_local3( f118_arg0, f101_local23 ) + f101_local4( f118_arg0, f101_local23 ) + end, + additional_handlers = { + refresh_new_icons = function ( f119_arg0, f119_arg1 ) + if Engine.IsAliensMode() then + refresh_customize_new_icon( f119_arg0, f101_local0.exclusiveControllerIndex, "coopSquadMembers", 0, f101_local23 ) + else + refresh_customize_new_icon( f119_arg0, f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex, f101_local23 ) + end + end, + menu_create = function ( f120_arg0, f120_arg1 ) + if Engine.IsAliensMode() then + refresh_customize_new_icon( f120_arg0, f101_local0.exclusiveControllerIndex, "coopSquadMembers", 0, f101_local23 ) + else + refresh_customize_new_icon( f120_arg0, f101_local0.exclusiveControllerIndex, f101_local0.squadLocation, f101_local0.squadMemberIndex, f101_local23 ) + end + end + }, + text_padding_with_content = 250, + content_width = 225 + } + f101_local17( f101_local18, f101_local19 ) + end + end + f101_local21 = {} + end + end + end + table.insert( f101_local5.children, { + type = "button_desc_text", + properties = { + lines = 1 + } + } ) + table.insert( f101_local5.children, { + type = "cac_customize_warning" + } ) + return f101_local5 +end + +function cac_customize_warning() + local f121_local0 = { + "icon_new", + "icon_new_2" + } + local f121_local1 = { + "default", + "alt" + } + return { + type = "UIElement", + id = "warning", + properties = { + text_offset = 2 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + hide_warning = MBh.AnimateToState( "default", 100 ), + show_warning = function ( f122_arg0, f122_arg1 ) + f122_arg0:animateToState( "visible", 100 ) + if f122_arg1.text then + local f122_local0 = f122_arg0:getChildById( "warning_text" ) + f122_local0:setText( f122_arg1.text ) + if f122_arg1.style and f122_arg1.style > 0 and f122_arg1.style <= #f121_local1 then + f122_local0 = f122_arg0:getChildById( "warning_text" ) + f122_local0:animateToState( f121_local1[f122_arg1.style] ) + end + end + if f122_arg1.style and f122_arg1.style > 0 and f122_arg1.style <= #f121_local0 then + local f122_local0 = f122_arg0:getChildById( "warning_exclamation" ) + f122_local0:setImage( RegisterMaterial( f121_local0[f122_arg1.style] ) ) + end + end + + }, + children = { + { + type = "UIImage", + id = "warning_exclamation", + states = { + default = { + material = RegisterMaterial( "icon_new" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 95, + width = 32, + top = 0, + height = 32 + } + } + }, + { + type = "UIText", + id = "warning_text", + states = { + default = CoD.ColorizeState( Cac.Swatches.warning_text, { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 130, + right = 0, + top = MBh.Property( "text_offset" ), + height = CoD.TextSettings.NormalFont.Height + } ), + alt = CoD.ColorizeState( Cac.Swatches.new_icon_text, { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 130, + right = 0, + top = MBh.Property( "text_offset" ), + height = CoD.TextSettings.NormalFont.Height + } ) + } + } + } + } +end + +function SetCamoButtonHelper( f123_arg0, f123_arg1 ) + f123_arg0:processEvent( { + name = "add_button_helper_text", + priority = 1, + button_ref = "button_shoulderl", + button_ref2 = "button_shoulderr", + helper_text = Engine.Localize( "PATCH_MENU_CAMO_PREVIEW" ), + side = "left", + clickable = true, + immediate = true + } ) +end + +function MenuCreate( f124_arg0, f124_arg1 ) + local f124_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f124_arg0 ) + if not f124_local0.exclusiveControllerIndex then + DebugPrint( "WARNING: Opening cac_customize_main menu without exclusive controller, controller index 0 will be used. This should ONLY happen on LUI reload." ) + f124_local0.exclusiveControllerIndex = 0 + end + f124_local0.currentCamo = 5 + f124_local0.camos = Cac.GetCamoRefs() + f124_local0.squadLocation = f124_arg0.properties.squadLocation + f124_local0.squadMemberIndex = f124_arg0.properties.squadMemberIndex + f124_arg0:processEvent( { + name = "update_playercard", + gamertag = Engine.GetUsernameByController and Engine.GetUsernameByController( f124_local0.exclusiveControllerIndex ) or nil + } ) + f124_arg0:processEvent( { + name = "hide_playercard" + } ) + f124_arg0:processEvent( { + name = "update_camo" + } ) +end + +function BackButtonAction( f125_arg0, f125_arg1 ) + local f125_local0 = CoD.GetStatsGroupForGameMode() + Cac.SyncPrivateDataFromPlayercard( f125_arg1.controller ) + Engine.Exec( "uploadstats", f125_arg1.controller ) + if f125_local0 == CoD.StatsGroup.Ranked or f125_local0 == CoD.StatsGroup.Coop then + Engine.Exec( "upload_playercard", f125_arg1.controller ) + end + local f125_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f125_arg0 ) + if f125_local1.alternateCacMenus then + local f125_local2 = GetInterMenuData( f125_arg0 ) + f125_local2.alternateCacMenus = not f125_local2.alternateCacMenus + LUI.FlowManager.RequestAddMenu( f125_arg0, "cac_edit_main", true, f125_arg1.controller, true, f125_local2 ) + else + LUI.FlowManager.RequestLeaveMenu( f125_arg0 ) + end +end + +function cac_customize_main() + local f126_local0 = { + type = "UIElement", + id = "cac_customize_main", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + properties = { + classLocation = "loadouts", + alternateCacMenus = false, + squadLocation = Cac.GetSquadLoc(), + squadMemberIndex = 0, + loadout_slot = 0 + }, + handlers = { + menu_create = MenuCreate, + preview_element = function ( f127_arg0, f127_arg1 ) + f127_arg0.currentSetup = f127_arg0.currentSetup or {} + local f127_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f127_arg0 ) + assert( f127_arg1.field, "Missing field for previewing element!" ) + assert( f127_arg1.field.PreviewFunction and f127_arg1.elementRef, "Missing data for previewing element" ) + local f127_local1 = f127_arg1.field.PreviewFunction( f127_local0.exclusiveControllerIndex, f127_arg0, "customize_char_handle", f127_arg1.elementRef, f127_local0.squadMemberIndex, f127_local0.camos[f127_local0.currentCamo] ) + if f127_local1 then + for f127_local5, f127_local6 in pairs( f127_local1 ) do + f127_arg0.currentSetup[f127_local5] = f127_local6 + end + end + end, + update_camo = function ( f128_arg0, f128_arg1 ) + f128_arg0.currentSetup = f128_arg0.currentSetup or {} + local f128_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f128_arg0 ) + local f128_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + local f128_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f128_local3 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f128_local4 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch] + local f128_local5 = f128_arg0.currentSetup[f128_local1] + if not f128_local5 then + f128_local5 = f128_local1.GetSavedRef( f128_local0.exclusiveControllerIndex, f128_local0.squadLocation, f128_local0.squadMemberIndex ) + end + local f128_local6 = f128_local1.MakeModelName( f128_local5, f128_local0.camos[f128_local0.currentCamo] ) + local f128_local7 = f128_local4.GetSavedRef( f128_local0.exclusiveControllerIndex, f128_local0.squadLocation, f128_local0.squadMemberIndex ) + local f128_local8 = f128_arg0.currentSetup[f128_local2] + if not f128_local8 then + f128_local8 = f128_local2.GetSavedRef( f128_local0.exclusiveControllerIndex, f128_local0.squadLocation, f128_local0.squadMemberIndex ) + end + local f128_local9 = f128_arg0.currentSetup[f128_local3] + if not f128_local9 then + f128_local9 = f128_local3.GetSavedRef( f128_local0.exclusiveControllerIndex, f128_local0.squadLocation, f128_local0.squadMemberIndex ) + end + local f128_local10 = f128_local2.MakeModelName( f128_local8, f128_local9, f128_local0.camos[f128_local0.currentCamo] ) + CharacterScene.ChangeBody( "customize_char_handle", f128_local6, f128_local7 ) + CharacterScene.ChangeHead( "customize_char_handle", f128_local10 ) + SetCamoButtonHelper( f128_arg0, f128_local0 ) + end, + text_input_complete = InputClanTagComplete + } + } + local f126_local1 = {} + local f126_local2 = { + type = "UIImage", + id = "menu_background", + states = { + default = { + material = RegisterMaterial( "bkgd_cas" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + } + local f126_local3 = { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_CUSTOMIZE_APPEARANCE_CAPS" ) + } + } + local f126_local4 = fields_vlist() + local f126_local5 = { + type = "UISquadMemberWindow" + } + local f126_local6 = { + use_playercard = true, + use_background = true + } + local f126_local7 = {} + local f126_local8 = IsPublicMatch() + if not f126_local8 then + f126_local8 = Engine.IsAliensMode() + end + f126_local7.use_level_progress = f126_local8 + f126_local6.card_props = f126_local7 + f126_local6.card_dims = { + top = -120, + bottom = -155, + left = -50, + right = -50 + } + f126_local6.card_scale = -0.15 + f126_local6.charHandle = "customize_char_handle" + f126_local6.default_anim = Cac.Customization.Animations.default + f126_local6.char_window_dims = { + top = 0, + bottom = 610, + left = -175, + right = 435 + } + f126_local6.uv_values = { + 0, + 0, + 1, + 1 + } + f126_local6.character_pos = CharacterCameraPresets.CustomizeMenu.Default.Position + f126_local6.controller = MBh.Property( "exclusiveController" ) + f126_local6.squad_member_index = MBh.Property( "squadMemberIndex" ) + f126_local6.squad_location = MBh.Property( "squadLocation" ) + f126_local6.loadout_slot = MBh.Property( "loadout_slot" ) + f126_local6.mask_pos_data = { + top = 17, + bottom = 0, + left = 0, + right = 0 + } + f126_local5.properties = f126_local6 + f126_local5.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 + } + } + f126_local5.handlers = { + character_full_refresh = function ( f129_arg0, f129_arg1 ) + local f129_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f129_arg0 ) + f129_arg0:updateSquadMember( f129_local0.exclusiveControllerIndex, f129_local0.squadMemberIndex ) + local f129_local1 = f129_arg0:getParent() + f129_local1.currentSetup = {} + f129_local1 = f129_arg0:getParent() + f129_local1:processEvent( { + name = "update_camo" + } ) + end, + current_field_changed = function ( f130_arg0, f130_arg1 ) + local f130_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f130_arg0 ) + assert( f130_local0.currentField ) + end, + character_init_complete = function ( f131_arg0, f131_arg1 ) + local f131_local0 = f131_arg0:getParent() + f131_local0 = f131_local0.currentSetup + if f131_local0 then + for f131_local4, f131_local5 in pairs( f131_local0 ) do + f131_arg0:dispatchEventToRoot( { + name = "preview_element", + immediate = true, + field = f131_local4, + elementRef = f131_local5 + } ) + end + end + end + } + f126_local6 = Cac.GetEditCurrency() + f126_local7 = { + type = "button_helper_text_main", + handlers = { + menu_create = function ( f132_arg0, f132_arg1 ) + f132_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + f132_arg0:processEvent( { + name = "add_loadout_button_helper" + } ) + end, + add_loadout_button_helper = function ( f133_arg0, f133_arg1 ) + if not Engine.IsAliensMode() then + f133_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_LOADOUT_EDIT" ), + side = "left", + clickable = true, + immediate = true + } ) + end + end, + rebind_shoulder_buttons = MBh.EmitEvent( { + name = "rebind", + buttonLeft = ButtonMap.button_shoulderl + } ), + rebind_back_button = MBh.EmitEvent( { + name = "rebind", + buttonLeft = ButtonMap.button_secondary + } ) + } + } + f126_local8 = { + type = "online_friends_widget", + properties = { + ignorePopups = true + } + } + local f126_local9 = { + type = "UIBindButton", + id = "customization_button_bind", + handlers = { + button_secondary = BackButtonAction, + button_alt1 = function ( f134_arg0, f134_arg1 ) + if not Engine.IsAliensMode() then + local f134_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f134_arg0 ) + f134_local0.alternateCacMenus = not f134_local0.alternateCacMenus + local f134_local1 = GetInterMenuData( f134_arg0 ) + f134_local1.alternateCacMenus = f134_local0.alternateCacMenus + LUI.FlowManager.RequestAddMenu( f134_arg0, "cac_edit_main", true, f134_arg1.controller, true, f134_local1 ) + end + end + } + } + local f126_local10 = { + type = "UIBindButton", + id = "customization_shoulder_buttons_bind", + handlers = { + button_shoulderl = function ( f135_arg0, f135_arg1 ) + Engine.PlaySound( CoD.SFX.SubMenuMouseOver ) + local f135_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f135_arg0 ) + f135_local0.currentCamo = 1 + (#f135_local0.camos + f135_local0.currentCamo - 2) % #f135_local0.camos + f135_arg0:dispatchEventToRoot( { + name = "update_camo" + } ) + end, + button_shoulderr = function ( f136_arg0, f136_arg1 ) + Engine.PlaySound( CoD.SFX.SubMenuMouseOver ) + local f136_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f136_arg0 ) + f136_local0.currentCamo = 1 + f136_local0.currentCamo % #f136_local0.camos + f136_arg0:dispatchEventToRoot( { + name = "update_camo" + } ) + end, + rebind_shoulder_buttons = function ( f137_arg0, f137_arg1 ) + LUI.UIBindButton.ElementEnable( f137_arg0 ) + end, + unbind_shoulder_buttons = function ( f138_arg0, f138_arg1 ) + LUI.UIBindButton.ElementDisable( f138_arg0 ) + end + } + } + f126_local1[1] = f126_local2 + f126_local1[2] = f126_local3 + f126_local1[3] = f126_local4 + f126_local1[4] = f126_local5 + f126_local1[5] = f126_local6 + f126_local1[6] = f126_local7 + f126_local1[7] = f126_local8 + f126_local1[8] = f126_local9 + f126_local1[9] = f126_local10 + f126_local0.children = f126_local1 + return f126_local0 +end + +LUI.MenuBuilder.registerDef( "cac_customize_buttons_popup", cac_customize_buttons_popup ) +LUI.MenuBuilder.registerDef( "cac_customize_vlist_popup", cac_customize_vlist_popup ) +LUI.MenuBuilder.registerDef( "cac_customize_grid_popup", cac_customize_grid_popup ) +LUI.MenuBuilder.registerType( "cac_customize_small_popup", cac_customize_small_popup ) +LUI.MenuBuilder.registerDef( "cac_customize_clan_tag_popup", cac_customize_clan_tag_popup ) +LUI.MenuBuilder.registerDef( "cac_customize_gender_popup", cac_customize_gender_popup ) +LUI.MenuBuilder.registerDef( "cac_customize_warning", cac_customize_warning ) +LUI.MenuBuilder.registerDef( "cac_customize_main", cac_customize_main ) +LockTable( _M ) diff --git a/lui/mp_menus/cacedit.dec.lua b/lui/mp_menus/cacedit.dec.lua new file mode 100644 index 0000000..2fd6b2a --- /dev/null +++ b/lui/mp_menus/cacedit.dec.lua @@ -0,0 +1,699 @@ +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 ) diff --git a/lui/mp_menus/caceditchooseimagepopup.dec.lua b/lui/mp_menus/caceditchooseimagepopup.dec.lua new file mode 100644 index 0000000..8e5e989 --- /dev/null +++ b/lui/mp_menus/caceditchooseimagepopup.dec.lua @@ -0,0 +1,1894 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" ) + unlockItem( f1_arg1.controller, f1_local0.item ) + local f1_local1 = f1_local0.ItemGetFunction( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot, f1_local0.itemIndex ) + f1_local0.ItemSetFunction( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot, f1_local0.itemIndex, f1_local0.item ) + local f1_local2 = false + if f1_local0.selection_id == "edit_lethal" then + f1_local2 = f1_local0.item ~= "specialty_null" + end + f1_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f1_arg1.controller, + dispatchChildren = true, + grenadeConflict = f1_local2 + } ) + if (f1_local0.item == "none" or f1_local1 == "none" or f1_local0.item == "specialty_null" or f1_local1 == "specialty_null" or f1_local0.item == "iw6_knifeonly" or f1_local1 == "iw6_knifeonly" or f1_local0.item == "uav" or f1_local1 == "uav") and f1_local0.item ~= f1_local1 then + f1_arg0:dispatchEventToRoot( { + name = "refresh_abilities_recap", + controller = f1_arg1.controller, + specialistType = false, + item = f1_local0.item + } ) + end + f1_arg0:dispatchEventToRoot( { + name = "cac_update_currency_text" + } ) + if f1_local0.selection_id == "edit_weapon_primary" then + + elseif f1_local0.selection_id == "edit_weapon_primary_reticle" or f1_local0.selection_id == "edit_weapon_primary_camo" then + f1_arg0:dispatchEventToRoot( { + name = "update_squad_member_window_weapon", + weapon = Cac.BuildPrimaryWeaponName( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot ) + } ) + elseif f1_local0.selection_id == "edit_weapon_secondary" then + f1_arg0:dispatchEventToRoot( { + name = "update_squad_member_window_stowed_weapon", + weapon = Cac.BuildSecondaryWeaponName( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot ) + } ) + end + Engine.PlaySound( CoD.SFX.CacSpendPoints ) + LUI.FlowManager.RequestLeaveMenu( f1_local0.openPopupItem ) + LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f2_arg0 ) +end + +function cac_cant_purchase_popup() + local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" ) + local f3_local1 = nil + local f3_local2 = 128 + local f3_local3 = 5 + local f3_local4 = Engine.Localize( "@LUA_MENU_UNABLE_TO_PURCHASE_N", f3_local0.itemName ) + local f3_local5 = f3_local0.cost + local f3_local6 = RegisterMaterial( "icon_unlock_token_active" ) + local f3_local7 = f3_local0.currency + if f3_local0.selection_id == "edit_lethal" or f3_local0.selection_id == "edit_tactical" then + f3_local1 = Cac.GetGrenadeImage( f3_local0.item, f3_local0.itemIndex ) + f3_local2 = 64 + f3_local3 = 35 + else + f3_local1 = Cac.GetWeaponImage( f3_local0.item, f3_local0.itemIndex ) + end + return { + type = "generic_yesno_with_image_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ), + message_image = RegisterMaterial( f3_local1 ), + message_image_width = f3_local2, + message_image_top = -15, + message_image_left = f3_local3, + message_cost_text = Engine.Localize( "@LUA_MENU_COST" ), + message_cost_image = f3_local6, + message_cost = f3_local5, + message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ), + message_squad_points_image = f3_local6, + message_squad_points = f3_local7, + no_text = f3_local4, + no_action = f0_local1 + } + } +end + +function cac_purchase_popup() + local f4_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" ) + local f4_local1 = nil + local f4_local2 = 128 + local f4_local3 = 5 + local f4_local4 = Engine.Localize( "@LUA_MENU_PURCHASE_N", f4_local0.itemName ) + local f4_local5 = f4_local0.cost + local f4_local6 = RegisterMaterial( "icon_unlock_token_active" ) + local f4_local7 = f4_local0.currency + if f4_local0.selection_id == "edit_lethal" or f4_local0.selection_id == "edit_tactical" then + f4_local1 = Cac.GetGrenadeImage( f4_local0.item, f4_local0.itemIndex ) + f4_local2 = 64 + f4_local3 = 35 + else + f4_local1 = Cac.GetWeaponImage( f4_local0.item, f4_local0.itemIndex ) + end + return { + type = "generic_yesno_with_image_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ), + message_image = RegisterMaterial( f4_local1 ), + message_image_width = f4_local2, + message_image_top = -15, + message_image_left = f4_local3, + message_cost_text = Engine.Localize( "@LUA_MENU_COST" ), + message_cost_image = f4_local6, + message_cost = f4_local5, + message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ), + message_squad_points_image = f4_local6, + message_squad_points = f4_local7, + yes_text = f4_local4, + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = f0_local0, + no_action = f0_local1 + }, + additional_handlers = { + menu_create = function ( f5_arg0, f5_arg1 ) + f5_arg0:setText( f4_local0.item ) + end + + } + } +end + +f0_local2 = function ( f6_arg0, f6_arg1 ) + DebugPrint( "default button action" ) +end + +local f0_local3 = function ( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + local f7_local1 = getProperUnlockTable( f7_arg0.properties.item ) + local f7_local2 = f7_arg0.properties + local f7_local3 = Cac.GetCurrency( f7_arg1.controller ) + local f7_local4, f7_local5 = nil + local f7_local6 = false + if f7_local0.selection_id == "edit_weapon_primary_camo" or f7_local0.selection_id == "edit_weapon_primary_reticle" then + f7_local5, f7_local6 = Cac.IsCamoOrReticleUnlocked( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot, f7_local0.itemIndex, f7_local2.item, f7_local0.selection_id and "camo" or "reticle" ) + elseif (f7_local0.selection_id == "edit_weapon_primary" or f7_local0.selection_id == "edit_weapon_secondary") and Cac.IsWeaponEntitlement( f7_local2.item ) then + f7_local6 = true + f7_local5 = Cac.IsWeaponEntitlementUnlocked( f7_arg1.controller, f7_local2.item ) + else + f7_local4 = tonumber( Engine.TableLookup( f7_local1, 0, Engine.TableLookup( f7_local1, 0, f7_local2.item, 3 ), 4 ) ) + f7_local5 = Cac.IsItemUnlocked( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local2.item ) + end + f7_local0.item = f7_local2.item + f7_local0.itemName = f7_local0.ItemGetNameFunction( f7_local2.item ) + f7_local0.cost = f7_local4 + f7_local0.currency = f7_local3 + if f7_local5 then + local f7_local7 = f7_local0.ItemGetFunction( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot, f7_local0.itemIndex ) + f7_local0.ItemSetFunction( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot, f7_local0.itemIndex, f7_local2.item ) + local f7_local8 = false + if f7_local0.selection_id == "edit_lethal" then + f7_local8 = f7_local0.item ~= "specialty_null" + end + f7_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f7_arg1.controller, + dispatchChildren = true, + grenadeConflict = f7_local8 + } ) + if (f7_local2.item == "none" or f7_local7 == "none" or f7_local2.item == "specialty_null" or f7_local7 == "specialty_null" or f7_local2.item == "iw6_knifeonly" or f7_local7 == "iw6_knifeonly" or f7_local2.item == "uav" or f7_local7 == "uav") and (f7_local2.item ~= f7_local7 or f7_local7 == "specialty_null") then + f7_arg0:dispatchEventToRoot( { + name = "refresh_abilities_recap", + controller = f7_arg1.controller, + specialistType = false, + item = f7_local2.item + } ) + end + if f7_local0.selection_id == "edit_weapon_primary" then + + elseif f7_local0.selection_id == "edit_weapon_primary_reticle" or f7_local0.selection_id == "edit_weapon_primary_camo" then + f7_arg0:dispatchEventToRoot( { + name = "update_squad_member_window_weapon", + weapon = Cac.BuildPrimaryWeaponName( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot ) + } ) + elseif f7_local0.selection_id == "edit_weapon_secondary" then + f7_arg0:dispatchEventToRoot( { + name = "update_squad_member_window_stowed_weapon", + weapon = Cac.BuildSecondaryWeaponName( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot ) + } ) + end + if f7_local0.openMenuOnClose and f7_local0.openMenuOnClose.openOnAction then + LUI.FlowManager.RequestPopupMenu( f7_arg0, f7_local0.openMenuOnClose.menu, true, f7_arg1.controller, true, f7_local0.openMenuOnClose ) + else + LUI.FlowManager.RequestLeaveMenu( f7_arg0 ) + end + elseif not f7_local4 then + Engine.PlaySound( CoD.SFX.DenySelect ) + if f7_local6 then + local f7_local7 = false + local f7_local8 = "" + if f7_local0.selection_id == "edit_weapon_primary_reticle" or f7_local0.selection_id == "edit_weapon_primary_camo" then + f7_local7 = Cac.IsCamoOrReticleDLC( f7_local2.item ) + if f7_local7 then + f7_local8 = Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f7_local2.item, CamoReticleUnlockTable.Cols.DLCPack ) + end + elseif f7_local0.selection_id == "edit_weapon_primary" or f7_local0.selection_id == "edit_weapon_secondary" then + f7_local7 = Cac.IsWeaponDLC( f7_local2.item ) + if f7_local7 then + f7_local8 = Engine.TableLookup( Cac.WeaponUnlockTable.File, Cac.WeaponUnlockTable.Cols.WeaponRef, f7_local2.item, Cac.WeaponUnlockTable.Cols.DLCPack ) + end + end + if f7_local7 then + DebugPrint( "DLC - Please Buy Me " .. f7_local2.item ) + if string.len( f7_local8 ) > 0 then + if Engine.IsPC() then + Sns.OpenStoreMenu( f7_arg1.controller ) + else + Sns.OpenStoreLinkConfirmPopup( f7_arg1.controller, f7_local8 ) + end + end + end + end + elseif f7_local4 <= f7_local3 then + f7_local0.item = f7_arg0.properties.item + f7_local0.openPopupItem = f7_arg0 + LUI.FlowManager.RequestPopupMenu( f7_arg0, "cac_purchase_popup", true, f7_arg1.controller, false ) + else + LUI.FlowManager.RequestPopupMenu( f7_arg0, "cac_cant_purchase_popup", true, f7_arg1.controller, false ) + end +end + +function CacEditButtonOver( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + local f8_local1 = f8_arg0.properties + local f8_local2 = f8_local0.exclusiveController + assert( f8_local2, "Cac: No controller specified, something went wrong" ) + local f8_local3 = f8_local0.classLocation + assert( f8_local3, "Cac: No class location specified, something went wrong" ) + local f8_local4 = f8_local0.slot + if not f8_local4 then + DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" ) + cacSlot = 0 + end + local f8_local5 = f8_local0.squadLocation + assert( f8_local5, "Cac: No squad location specified, something went wrong" ) + local f8_local6 = f8_local0.squadMemberIndex + if not f8_local6 then + DebugPrint( "[WARNING] CAC: using squad member index 0, this is only ok if you are editing a menu" ) + f8_local6 = 0 + end + local f8_local7 = f8_local0.itemIndex + if not f8_local7 then + DebugPrint( "[WARNING] CAC: using item index 0, this is only ok if you are editing a menu" ) + f8_local7 = 0 + end + if f8_local0.selection_id ~= "edit_weapon_primary_reticle" and f8_local0.selection_id ~= "edit_weapon_primary_camo" then + f8_arg0:dispatchEventToRoot( { + name = "refresh_info_pane", + controller = f8_local2, + classLocation = f8_local3, + squadLocation = f8_local5, + squadMemberIndex = f8_local6, + slot = f8_local4, + weaponIndex = f8_local7, + viewingWeapon = f8_local1.item, + selection_id = f8_local0.selection_id, + immediate = true, + dispatchChildren = true + } ) + end + if MatchRules.AllowCustomClasses( f8_local3 ) then + if f8_arg0.restricted then + f8_arg0:dispatchEventToRoot( { + name = "show_class_restrictions_warning", + immediate = true + } ) + else + f8_arg0:dispatchEventToRoot( { + name = "hide_class_restrictions_warning", + immediate = true + } ) + end + end +end + +local f0_local4 = function ( f9_arg0, f9_arg1 ) + local f9_local0 = f9_arg0.properties.itemSelected + local f9_local1 = f9_arg0.properties.itemLocked + local f9_local2 = f9_arg0.properties.itemDisabled + if f9_arg1.updateProperties then + local f9_local3 = f9_arg0:getParent() + repeat + f9_local3 = f9_local3:getParent() + assert( f9_local3, "cac_edit_choose_root was not found" ) + until f9_local3.id == "cac_edit_choose_root" + f9_local2 = f9_local3.properties.overrideChooseDisableCheck( f9_arg0 ) + f9_arg0.properties.itemDisabled = f9_local2 + end + if f9_local2 then + if f9_arg1.updateProperties then + f9_arg0:dispatchEventToChildren( { + name = "button_tab_focused_disabled" + } ) + f9_arg0:dispatchEventToChildren( { + name = "button_txt_focused_disabled" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_over.a + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + alpha = 0 + } ) + else + f9_arg0:dispatchEventToChildren( { + name = "button_txt_unfocused_disabled" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_up.a + } ) + end + elseif f9_local0 then + f9_arg0:dispatchEventToChildren( { + name = "button_txt_selected" + } ) + f9_arg0:dispatchEventToChildren( { + name = "button_tab_selected" + } ) + f9_arg0:dispatchEventToChildren( { + name = "button_icon_selected" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.a + } ) + elseif f9_local1 then + f9_arg0:dispatchEventToChildren( { + name = "button_txt_unfocused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "button_locked" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.a + } ) + else + if f9_arg1.updateProperties then + f9_arg0:dispatchEventToChildren( { + name = "button_tab_focused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "button_icon_focused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "button_txt_focused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + alpha = 0 + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_over.a + } ) + else + f9_arg0:dispatchEventToChildren( { + name = "button_txt_unfocused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.a + } ) + end + f9_arg0:dispatchEventToChildren( { + name = "button_unlocked" + } ) + end +end + +function updateNewIcon( f10_arg0, f10_arg1 ) + local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 ) + local f10_local1 = "" + if f10_local0.selection_id == "edit_weapon_primary_camo" then + f10_local1 = "Camo" + end + if f10_local0.selection_id == "edit_weapon_primary" then + f10_local1 = "Weapon_Primary" + end + if f10_local0.selection_id == "edit_weapon_secondary" then + f10_local1 = "Weapon_Secondary" + end + if Cac.ItemHasNewIcon( f10_local0.exclusiveController, f10_arg0.properties.item, f10_local1 ) then + f10_arg0:processEvent( { + name = "show_new_icon" + } ) + else + f10_arg0:processEvent( { + name = "hide_new_icon" + } ) + end +end + +local f0_local5 = function ( f11_arg0, f11_arg1 ) + local f11_local0 = f11_arg0.properties + local f11_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f11_arg0 ) + if not f11_local0 then + DebugPrint( "Missing properties on CacEditChooseImagePopup button" ) + return + end + local f11_local2 = false + local f11_local3 = false + if f11_local1.selection_id == "edit_weapon_primary_reticle" or f11_local1.selection_id == "edit_weapon_primary_camo" then + f11_local2 = Cac.IsCamoOrReticleDLC( f11_local0.item ) + if f11_local2 then + f11_local3 = Cac.IsCamoOrReticleUnlocked( f11_local1.exclusiveController, f11_local1.squadLocation, f11_local1.squadMemberIndex, f11_local1.classLocation, f11_local1.slot, f11_local1.itemIndex, f11_local0.item, f11_local1.selection_id and "camo" or "reticle" ) + end + elseif f11_local1.selection_id == "edit_weapon_primary" or f11_local1.selection_id == "edit_weapon_secondary" then + f11_local2 = Cac.IsWeaponDLC( f11_local0.item ) + if f11_local2 then + f11_local3 = Cac.IsWeaponEntitlementUnlocked( f11_local1.exclusiveController, f11_local0.item ) + end + end + if f11_local2 and f11_local3 and f11_arg0.properties.itemLocked then + f11_arg0.properties.itemLocked = false + f11_arg0:processEvent( { + name = "button_unlocked" + } ) + end +end + +local f0_local6 = function ( f12_arg0, f12_arg1 ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + local f12_local1 = f12_arg0.properties.itemSelected + local f12_local2 = f12_arg0.properties.itemLocked + local f12_local3 = f12_arg0.properties.itemDisabled + if f12_local3 then + f12_arg0:dispatchEventToChildren( { + name = "button_tab_focused_disabled" + } ) + f12_arg0:dispatchEventToChildren( { + name = "button_icon_focused_disabled" + } ) + f12_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_over.a + } ) + else + if not f12_local1 then + f12_arg0:dispatchEventToChildren( { + name = "button_txt_focused" + } ) + f12_arg0:dispatchEventToChildren( { + name = "button_tab_focused" + } ) + end + f12_arg0:dispatchEventToChildren( { + name = "button_icon_focused" + } ) + f12_arg0:dispatchEventToChildren( { + name = "button_bg_focused" + } ) + f12_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_over.a + } ) + end + local f12_local4 = f12_arg0.properties + if f12_local0.selection_id == "edit_weapon_primary_camo" then + f12_arg0:dispatchEventToRoot( { + name = "cac_progress_unlock_update", + parentItem = Cac.GetWeapon( f12_local0.exclusiveController, f12_local0.squadLocation, f12_local0.squadMemberIndex, f12_local0.classLocation, f12_local0.slot, f12_local0.itemIndex ), + item = f12_local4.item, + dispatchChildren = true, + immediate = true + } ) + end + local f12_local5 = "" + if f12_local0.selection_id == "edit_weapon_primary_camo" then + f12_local5 = "Camo" + end + if f12_local0.selection_id == "edit_weapon_primary" then + f12_local5 = "Weapon_Primary" + end + if f12_local0.selection_id == "edit_weapon_secondary" then + f12_local5 = "Weapon_Secondary" + end + if Cac.ItemHasNewIcon( f12_local0.exclusiveController, f12_local4.item, f12_local5 ) then + Cac.MarkItemNoMoreNewIcon( f12_local0.exclusiveControllerIndex, f12_local4.item, f12_local5 ) + f12_arg0:processEvent( { + name = "refresh_new_icon" + } ) + f12_arg0:dispatchEventToRoot( { + name = "refresh_new_icons" + } ) + end + if f12_local0.selection_id == "edit_weapon_primary_reticle" then + f12_arg0:dispatchEventToRoot( { + name = "cac_progress_unlock_update", + parentItem = Cac.GetAttachmentWithReticles( f12_local0.exclusiveController, f12_local0.squadLocation, f12_local0.squadMemberIndex, f12_local0.classLocation, f12_local0.slot, f12_local0.itemIndex ), + item = f12_local4.item, + dispatchChildren = true, + immediate = true + } ) + end + if f12_local0.selection_id == "edit_weapon_primary" or f12_local0.selection_id == "edit_weapon_secondary" or f12_local0.selection_id == "edit_lethal" or f12_local0.selection_id == "edit_tactical" then + f12_arg0:dispatchEventToRoot( { + name = "update_selection_info", + disabled = f12_local3 or f12_local2, + controller = f12_local0.exclusiveController, + classLocation = f12_local0.classLocation, + squadLocation = f12_local0.squadLocation, + squadMemberIndex = f12_local0.squadMemberIndex, + slot = f12_local0.slot, + selection_id = f12_local0.selection_id, + viewingItem = f12_local4.item, + dispatchChildren = true, + immediate = true + } ) + end +end + +local f0_local7 = function ( f13_arg0, f13_arg1 ) + local f13_local0 = f13_arg0.properties.itemSelected + local f13_local1 = f13_arg0.properties.itemLocked + if f13_arg0.properties.itemDisabled then + f13_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused_disabled" + } ) + f13_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused_disabled" + } ) + f13_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = 1, + green = 1, + blue = 1, + alpha = Cac.Selection.outline_up.a + } ) + else + if not f13_local0 then + f13_arg0:dispatchEventToChildren( { + name = "button_txt_unfocused" + } ) + f13_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused" + } ) + end + f13_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused" + } ) + f13_arg0:dispatchEventToChildren( { + name = "button_bg_unfocused" + } ) + f13_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = 1, + green = 1, + blue = 1, + alpha = Cac.Selection.background_up.a + } ) + end +end + +function cac_edit_choose_image_button_background( f14_arg0, f14_arg1 ) + local f14_local0 = f14_arg1.red or 1 + local f14_local1 = f14_arg1.green or 1 + local f14_local2 = f14_arg1.blue or 1 + local f14_local3 = f14_arg1.alpha or 1 + local f14_local4 = f14_arg1.colorLocked or false + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = top, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f14_local6 = LUI.UIImage.new() + f14_local6.id = "corner" + f14_local6:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 32, + left = 0, + right = 32, + material = RegisterMaterial( "btn_cas_item_topleft" ) + } ) + f14_local6:animateToState( "default" ) + self:addElement( f14_local6 ) + local f14_local7 = LUI.UIImage.new() + f14_local7.id = "top" + f14_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 32, + left = 32, + right = 0, + material = RegisterMaterial( "white" ) + } ) + f14_local7:animateToState( "default" ) + self:addElement( f14_local7 ) + local f14_local8 = LUI.UIImage.new() + f14_local8.id = "bottom" + f14_local8:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 32, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ) + } ) + f14_local8:animateToState( "default" ) + self:addElement( f14_local8 ) + self.colorize = function ( f15_arg0, f15_arg1, f15_arg2, f15_arg3 ) + for f15_local3, f15_local4 in ipairs( { + f14_local6, + f14_local7, + f14_local8 + } ) do + f15_local4:registerAnimationState( "current", { + red = f15_arg0, + green = f15_arg1, + blue = f15_arg2, + alpha = f15_arg3 + } ) + f15_local4:animateToState( "current" ) + end + end + + self.colorize( f14_local0, f14_local1, f14_local2, f14_local3 ) + if not f14_local4 then + self:registerEventHandler( "updateBackgroundColor", function ( element, event ) + element.colorize( event.red, event.green, event.blue, event.alpha ) + end ) + end + return self +end + +function cac_edit_choose_image_button_background_outline( f17_arg0, f17_arg1 ) + local f17_local0 = f17_arg1.red or 1 + local f17_local1 = f17_arg1.green or 1 + local f17_local2 = f17_arg1.blue or 1 + local f17_local3 = f17_arg1.alpha or 1 + local f17_local4 = 2 + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = top, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f17_local6 = LUI.UIImage.new() + f17_local6.id = "corner" + f17_local6:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 32, + left = 0, + right = 32, + material = RegisterMaterial( "btn_cas_item_topleft_stroke" ) + } ) + f17_local6:animateToState( "default" ) + self:addElement( f17_local6 ) + local f17_local7 = LUI.UIImage.new() + f17_local7.id = "top" + f17_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f17_local4, + left = 32, + right = 0, + material = RegisterMaterial( "white" ) + } ) + f17_local7:animateToState( "default" ) + self:addElement( f17_local7 ) + local f17_local8 = LUI.UIImage.new() + f17_local8.id = "bottom" + f17_local8:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -f17_local4, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ) + } ) + f17_local8:animateToState( "default" ) + self:addElement( f17_local8 ) + local f17_local9 = LUI.UIImage.new() + f17_local9.id = "left" + f17_local9:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 32, + bottom = -f17_local4, + left = 0, + right = f17_local4, + material = RegisterMaterial( "white" ) + } ) + f17_local9:animateToState( "default" ) + self:addElement( f17_local9 ) + local f17_local10 = LUI.UIImage.new() + f17_local10.id = "right" + f17_local10:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = f17_local4, + bottom = -f17_local4, + left = -f17_local4, + right = 0, + material = RegisterMaterial( "white" ) + } ) + f17_local10:animateToState( "default" ) + self:addElement( f17_local10 ) + self.colorize = function ( f18_arg0, f18_arg1, f18_arg2, f18_arg3 ) + for f18_local3, f18_local4 in ipairs( { + f17_local6, + f17_local7, + f17_local8, + f17_local9, + f17_local10 + } ) do + f18_local4:registerAnimationState( "current", { + red = f18_arg0, + green = f18_arg1, + blue = f18_arg2, + alpha = f18_arg3 + } ) + f18_local4:animateToState( "current" ) + end + end + + self.colorize( f17_local0, f17_local1, f17_local2, f17_local3 ) + self:registerEventHandler( "updateBackgroundOutlineColor", function ( element, event ) + element.colorize( event.red, event.green, event.blue, event.alpha ) + end ) + return self +end + +function cac_edit_choose_image_lock_feeder( f20_arg0 ) + local f20_local0 = {} + if f20_arg0.lock_num > 0 then + f20_local0[#f20_local0 + 1] = { + type = "UIImage", + id = "cac_edit_choose_btn_lock_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + material = RegisterMaterial( "icon_unlock_token_active" ), + left = 0, + width = 16, + height = 16 + } + } + } + f20_local0[#f20_local0 + 1] = { + type = "UIText", + id = "cac_edit_choose_btn_lock_num_id", + properties = { + text = MBh.Property( "lock_num" ) + }, + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 16, + right = 0, + height = CoD.TextSettings.TinyFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left + } ) + } + } + else + f20_local0[#f20_local0 + 1] = { + type = "UIImage", + id = "cac_edit_choose_btn_lock_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + material = RegisterMaterial( "icon_lock_mini" ), + left = 0, + width = 16, + height = 16 + } + } + } + if f20_arg0.dlc == true then + f20_local0[#f20_local0 + 1] = { + type = "UIImage", + id = "cac_edit_choose_btn_dlc_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + material = RegisterMaterial( "icon_dlc" ), + right = 0, + width = 24, + height = 24 + } + } + } + end + end + return f20_local0 +end + +function cac_edit_choose_image_button() + local f21_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" ) + return { + type = "UIButton", + focusable = true, + audio = { + button_over = CoD.SFX.SubMenuMouseOver + }, + properties = { + text = "", + itemSelected = false, + item = "", + itemLocked = false, + itemDisabled = false, + lock_num = 0, + width = f21_local0.scrollBar and 128 or 136, + height = 75 + CoD.TextSettings.NormalFont.Height, + button_action_func = f0_local2, + material_icon = RegisterMaterial( "specialty_ks_null" ), + dlc = false + }, + 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_up = f0_local7, + button_over = MBh.DoMultiple( { + f0_local6, + CacEditButtonOver + } ), + button_disable = f0_local7, + button_over_disable = f0_local6, + button_update = f0_local4, + menu_create = updateNewIcon, + refresh_new_icon = updateNewIcon, + dlc_mount_complete = f0_local5 + }, + children = { + { + type = "UIElement", + id = "marquee_text_container", + 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 + } + }, + children = { + { + type = "UIMarqueeText", + id = "cac_edit_choose_btn_txt_id", + properties = { + text = MBh.Property( "text" ), + scrollSpeed = 50 + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + font = CoD.TextSettings.NormalFont.Font + } ) + }, + handlers = { + button_txt_selected = function ( f22_arg0, f22_arg1 ) + f22_arg0:SetColor( Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b ) + end + , + button_txt_focused = function ( f23_arg0, f23_arg1 ) + f23_arg0:SetColor( Colors.white.r, Colors.white.g, Colors.white.b ) + end + , + button_txt_unfocused = function ( f24_arg0, f24_arg1 ) + f24_arg0:SetColor( Colors.grey_22.r, Colors.grey_22.g, Colors.grey_22.b ) + end + , + button_txt_focused_locked = function ( f25_arg0, f25_arg1 ) + f25_arg0:SetColor( Colors.generic_button_text_disabled_color.r, Colors.generic_button_text_disabled_color.g, Colors.generic_button_text_disabled_color.b ) + end + , + button_txt_unfocused_locked = function ( f26_arg0, f26_arg1 ) + f26_arg0:SetColor( Colors.secondary_text_color.r, Colors.secondary_text_color.g, Colors.secondary_text_color.b ) + end + , + button_txt_focused_disabled = function ( f27_arg0, f27_arg1 ) + f27_arg0:SetColor( Colors.generic_button_text_disabled_color.r, Colors.generic_button_text_disabled_color.g, Colors.generic_button_text_disabled_color.b ) + end + , + button_txt_unfocused_disabled = function ( f28_arg0, f28_arg1 ) + f28_arg0:SetColor( Colors.secondary_text_color.r, Colors.secondary_text_color.g, Colors.secondary_text_color.b ) + end + + } + } + } + }, + { + type = "UIImage", + id = "new_icon", + states = { + default = { + material = RegisterMaterial( "icon_new_2" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -32, + right = 0, + top = 0, + bottom = 32, + alpha = 0 + }, + visible = { + alpha = 1 + }, + darker = { + alpha = 0.5 + } + }, + handlers = { + show_new_icon = MBh.AnimateLoop( { + { + "visible", + 0 + }, + { + "darker", + 300 + }, + { + "visible", + 300 + } + } ), + hide_new_icon = MBh.AnimateToState( "default", 400 ) + } + }, + { + type = "UIElement", + properties = { + lock_num = MBh.Property( "lock_num" ), + material_icon = MBh.Property( "material_icon" ), + item = MBh.Property( "item" ), + dlc = MBh.Property( "dlc" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -CoD.TextSettings.NormalFont.Height, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = function ( f29_arg0, f29_arg1 ) + local f29_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f29_arg0 ) + if f29_local0.restrictType and MatchRules.AllowCustomClasses( f29_local0.classLocation ) then + local f29_local1 = false + if f29_local0.restrictType == "weaponRestricted" then + local f29_local2, f29_local3, f29_local4 = Cac.SafeGetMatchRule( "commonOption", "weaponClassRestricted", Cac.GetWeaponClass( f29_arg0.properties.item ) ) + f29_local1 = f29_local2 and f29_local3 + end + local f29_local5 = false + if not f29_local1 then + local f29_local2, f29_local3 = Cac.SafeGetMatchRule( "commonOption", f29_local0.restrictType, f29_arg0.properties.item ) + f29_local5 = f29_local2 and f29_local3 + end + if f29_local1 or f29_local5 then + local f29_local2 = Cac.GetRestrictIcon( 0, 2, 28 ) + f29_local2.id = "restrict_icon" .. f29_arg0.properties.item + f29_arg0:addElement( f29_local2 ) + local f29_local3 = f29_arg0:getParent() + f29_local3.restricted = true + else + local f29_local2 = f29_arg0:getParent() + f29_local2.restricted = false + end + end + end + + }, + children = { + { + type = "UIElement", + id = "cac_edit_choose_btn_bg_id", + 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 = "cac_edit_choose_btn_icon_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f21_local0.ImageDimensions.top, + bottom = f21_local0.ImageDimensions.bottom, + left = f21_local0.ImageDimensions.left, + right = f21_local0.ImageDimensions.right, + material = MBh.Property( "material_icon" ), + alpha = 1 + }, + selected = { + alpha = 1 + }, + focused = { + scale = 0.1 + }, + unfocused = { + scale = 0 + }, + focused_disabled = { + alpha = 0.75 + }, + unfocused_disabled = { + alpha = 0.5 + } + }, + 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_disabled = MBh.AnimateToState( "focused_disabled", 0 ), + button_icon_unfocused_disabled = MBh.AnimateToState( "unfocused_disabled", 0 ) + } + }, + { + type = "UIImage", + id = "cac_edit_choose_btn_sel_box_id", + 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 = { + alpha = 1 + }, + unfocused = { + alpha = 0 + }, + selected = { + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b, + alpha = 1 + }, + deselected = { + 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_deselected = MBh.AnimateToState( "deselected", 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 ) + } + }, + { + type = "UIElement", + id = "price_container", + properties = { + lock_num = MBh.Property( "lock_num" ), + dlc = MBh.Property( "dlc" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = -2, + left = 3, + right = 0, + height = 20, + alpha = 0 + }, + locked = { + alpha = 1 + }, + unlocked = { + alpha = 0 + } + }, + handlers = { + button_locked = MBh.AnimateToState( "locked", 0 ), + button_unlocked = MBh.AnimateToState( "unlocked", 0 ) + }, + childrenFeeder = cac_edit_choose_image_lock_feeder + } + } + } + } + } +end + +function CacEditChooseImageOnCreate( f30_arg0, f30_arg1 ) + local f30_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" ) + local f30_local1 = f30_local0.squadLocation + if not f30_local1 then + f30_local1 = f30_arg0.properties.squadLocation + end + f30_local0.squadLocation = f30_local1 + f30_local1 = f30_local0.squadMemberIndex + if not f30_local1 then + f30_local1 = f30_arg0.properties.squadMemberIndex + end + f30_local0.squadMemberIndex = f30_local1 + f30_local1 = f30_local0.slot + if not f30_local1 then + f30_local1 = f30_arg0.properties.slot + end + f30_local0.slot = f30_local1 + f30_local1 = f30_local0.classLocation + if not f30_local1 then + f30_local1 = f30_arg0.properties.classLocation + end + f30_local0.classLocation = f30_local1 + f30_local1 = f30_local0.itemIndex + if not f30_local1 then + f30_local1 = f30_arg0.properties.itemIndex + end + f30_local0.itemIndex = f30_local1 + f30_local1 = f30_local0.itemTypeString + if not f30_local1 then + f30_local1 = f30_arg0.properties.itemTypeString + end + f30_local0.itemTypeString = f30_local1 + f30_local1 = f30_local0.disableSetDefaultFocus + if not f30_local1 then + f30_local1 = f30_arg0.properties.disableSetDefaultFocus + end + f30_local0.disableSetDefaultFocus = f30_local1 + f30_local1 = f30_local0.selection_id + if not f30_local1 then + f30_local1 = f30_arg0.properties.selection_id + end + f30_local0.selection_id = f30_local1 + f30_local1 = f30_local0.ImageFunction + if not f30_local1 then + f30_local1 = f30_arg0.properties.ImageFunction + end + f30_local0.ImageFunction = f30_local1 + f30_local1 = f30_local0.ItemGetFunction + if not f30_local1 then + f30_local1 = f30_arg0.properties.ItemGetFunction + end + f30_local0.ItemGetFunction = f30_local1 + f30_local1 = f30_local0.ItemSetFunction + if not f30_local1 then + f30_local1 = f30_arg0.properties.ItemSetFunction + end + f30_local0.ItemSetFunction = f30_local1 + f30_local1 = f30_local0.ItemGetNameFunction + if not f30_local1 then + f30_local1 = f30_arg0.properties.ItemGetNameFunction + end + f30_local0.ItemGetNameFunction = f30_local1 + f30_local1 = f30_local0.itemList + if not f30_local1 then + f30_local1 = f30_arg0.properties.itemList + end + f30_local0.itemList = f30_local1 + f30_local1 = f30_local0.ImageDimensions + if not f30_local1 then + f30_local1 = f30_arg0.properties.ImageDimensions + end + f30_local0.ImageDimensions = f30_local1 + f30_local1 = f30_local0.scrollBar + if not f30_local1 then + f30_local1 = f30_arg0.properties.customBottom + end + f30_local0.scrollBar = f30_local1 + f30_local1 = f30_local0.customTop + if not f30_local1 then + f30_local1 = f30_arg0.properties.customTop + end + f30_local0.customTop = f30_local1 + f30_local1 = f30_local0.customLeft + if not f30_local1 then + f30_local1 = f30_arg0.properties.customLeft + end + f30_local0.customLeft = f30_local1 + f30_local1 = f30_local0.customRight + if not f30_local1 then + f30_local1 = f30_arg0.properties.customRight + end + f30_local0.customRight = f30_local1 + f30_local1 = f30_local0.customBottom + if not f30_local1 then + f30_local1 = f30_arg0.properties.customBottom + end + f30_local0.customBottom = f30_local1 + f30_local1 = f30_arg0:getFirstDescendentById( "scroll_bar_id" ) + local f30_local2 = f30_arg0:getFirstDescendentById( "edit_choose_grid" ) + f30_local1:setList( f30_local2.vlist ) +end + +function CacEditChooseChildrenFeeder( f31_arg0 ) + local f31_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" ) + local f31_local1 = {} + local f31_local2 = f31_local0.exclusiveController + if not f31_local2 then + DebugPrint( "[WARNING] CAC: using controller index 0, this is only ok if you are editing a menu" ) + f31_local2 = 0 + end + local f31_local3 = f31_local0.squadMemberIndex + if not f31_local3 then + DebugPrint( "[WARNING] CAC: using squad member index 0, this is only ok if you are editing a menu" ) + f31_local3 = 0 + end + local f31_local4 = f31_local0.slot + if not f31_local4 then + DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" ) + f31_local4 = 0 + end + local f31_local5 = f31_local0.squadLocation + assert( f31_local5, "Cac: No squad location specified, something went wrong" ) + local f31_local6 = f31_local0.classLocation + assert( f31_local6, "Cac: No class location specified, something went wrong" ) + local f31_local7 = f31_local0.itemIndex + if not f31_local7 then + DebugPrint( "[WARNING] CAC: using item index 0, this is only ok if you are editing a menu" ) + f31_local7 = 0 + end + local f31_local8 = f31_local0.ItemGetFunction( f31_local2, f31_local5, f31_local3, f31_local6, f31_local4, f31_local7 ) + local f31_local9 = f31_local0.itemList + local f31_local10 = {} + local f31_local11 = f0_local3 + if f31_local0.overrideChooseAction then + f31_local11 = f31_local0.overrideChooseAction + end + local f31_local12 = not f31_local0.disableSetDefaultFocus + local f31_local13 = Cac.GetWeapon( f31_local2, f31_local5, f31_local3, f31_local6, f31_local4, 0 ) + local f31_local14 = Cac.GetWeapon( f31_local2, f31_local5, f31_local3, f31_local6, f31_local4, 1 ) + local f31_local15 + if f31_local0.selection_id ~= "edit_weapon_primary" and f31_local0.selection_id ~= "edit_weapon_secondary" then + f31_local15 = false + else + f31_local15 = true + end + for f31_local27, f31_local28 in ipairs( f31_local9 ) do + local f31_local29 = Cac.IsAbilityPickedBySlotName( f31_local2, f31_local5, f31_local3, f31_local6, f31_local4, "Elite", "specialty_twoprimaries", "abilitiesPicked" ) + if (f31_local7 ~= 1 or f31_local28 ~= f31_local13 or not f31_local29 or not f31_local15) and (f31_local7 ~= 0 or f31_local28 ~= f31_local14 or not f31_local29 or not f31_local15) then + local f31_local19 = false + if f31_local8 == f31_local28 and not f31_local0.overrideChooseDisableCheck then + f31_local19 = true + end + f31_local10[#f31_local10 + 1] = { + type = "cac_edit_choose_image_button", + id = "edit_weapon_" .. f31_local28, + listDefaultFocus = f31_local12 and f31_local8 == f31_local28, + properties = { + text = f31_local0.ItemGetNameFunction( f31_local28 ), + slot = f31_local4, + itemIndex = f31_local7, + item = f31_local28, + itemSelected = f31_local19, + button_action_func = f31_local11, + material_icon = RegisterMaterial( f31_local0.ImageFunction( f31_local28 ) ) + } + } + local f31_local20 = f31_local10[#f31_local10] + if f31_local0.overrideChooseDisableCheck then + f31_local0.overrideChooseDisableCheck( f31_local20 ) + end + if (f31_local0.selection_id == "edit_weapon_primary_camo" or f31_local0.selection_id == "edit_weapon_primary_reticle") and Cac.IsCamoOrReticleEntitlement( f31_local28 ) then + if not Cac.IsCamoOrReticleEntitlementUnlocked( f31_local2, f31_local28 ) then + f31_local20.itemLocked = true + f31_local20.properties.itemLocked = true + f31_local20.properties.lock_num = nil + if Cac.IsCamoOrReticleDLC( f31_local28 ) then + f31_local20.properties.dlc = true + else + f31_local20.properties.dlc = false + goto basicblock_53: + end + end + end + if f31_local15 and Cac.IsWeaponEntitlement( f31_local28 ) then + if not Cac.IsWeaponEntitlementUnlocked( f31_local2, f31_local28 ) then + f31_local20.itemLocked = true + f31_local20.properties.itemLocked = true + f31_local20.properties.lock_num = nil + if Cac.IsWeaponDLC( f31_local28 ) then + f31_local20.properties.dlc = true + else + f31_local20.properties.dlc = false + goto basicblock_53: + end + end + end + local f31_local21, f31_local22, f31_local23 = false + if f31_local0.selection_id == "edit_weapon_primary_camo" or f31_local0.selection_id == "edit_weapon_primary_reticle" then + local f31_local24 = "" + if f31_local0.selection_id == "edit_weapon_primary_camo" then + f31_local24 = Cac.GetCamoRefUnique( f31_local13, f31_local28 ) + f31_local23 = Cac.GetCamoChallengeRef( f31_local13, f31_local28 ) + end + if f31_local0.selection_id == "edit_weapon_primary_reticle" then + local f31_local25 = Cac.GetAttachmentWithReticles( f31_local0.exclusiveController, f31_local0.squadLocation, f31_local0.squadMemberIndex, f31_local0.classLocation, f31_local0.slot, f31_local0.itemIndex ) + if f31_local25 then + f31_local24 = Cac.GetReticleRefUnique( f31_local25, f31_local28 ) + f31_local23 = Cac.GetReticleChallengeRef( f31_local25, f31_local28 ) or "" + end + end + f31_local22 = Cac.GetCamoOrReticleChallengeTier( f31_local24 ) + end + if Cac.IsItemUnlocked( f31_local2, f31_local5, f31_local0.squadMemberIndex, f31_local28, f31_local23, f31_local22 ) == false then + f31_local20.itemLocked = true + local f31_local24 = getProperUnlockTable( f31_local28 ) + local f31_local26 = tonumber( Engine.TableLookup( f31_local24, 0, Engine.TableLookup( f31_local24, 0, f31_local20.properties.item, 3 ), 4 ) ) + f31_local20.properties.itemLocked = true + f31_local20.properties.lock_num = f31_local26 + end + end + end + return f31_local10 +end + +function cacChooseImageUpdateTitleProgress( f32_arg0, f32_arg1 ) + local f32_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f32_arg0 ) + local f32_local1 = nil + local f32_local2 = "" + if f32_arg1.item ~= "none" then + if SvS.IsSvS() then + f32_local2 = "" + elseif Cac.IsCamoOrReticleEntitlement( f32_arg1.item ) then + f32_local2 = Cac.GetCamoOrReticleEntitlementTitle( f32_arg1.item ) + else + if f32_local0.selection_id == "edit_weapon_primary_camo" then + f32_local1 = Cac.GetCamoChallengeRef( f32_arg1.parentItem, f32_arg1.item ) + else + f32_local1 = Cac.GetReticleChallengeRef( f32_arg1.parentItem, f32_arg1.item ) + end + if f32_local1 then + f32_local2 = Cac.GetCamoOrReticleChallengeTitle( f32_local1 ) + end + end + end + f32_arg0:setText( Engine.Localize( f32_local2, "" ) ) +end + +function cacChooseImageUpdateTextProgress( f33_arg0, f33_arg1 ) + local f33_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f33_arg0 ) + local f33_local1, f33_local2 = nil + local f33_local3 = "" + if f33_arg1.item ~= "none" then + if SvS.IsSvS() then + f33_local3 = "" + elseif Cac.IsCamoOrReticleEntitlement( f33_arg1.item ) then + f33_local3 = "" + else + if f33_local0.selection_id == "edit_weapon_primary_camo" then + f33_local1 = Cac.GetCamoChallengeRef( f33_arg1.parentItem, f33_arg1.item ) + f33_local2 = Cac.IsCamoChallengeComplete( f33_local0.exclusiveController, f33_arg1.parentItem, f33_arg1.item ) + else + f33_local1 = Cac.GetReticleChallengeRef( f33_arg1.parentItem, f33_arg1.item ) + if f33_local1 then + f33_local2 = Cac.IsReticleChallengeComplete( f33_local0.exclusiveController, f33_arg1.parentItem, f33_arg1.item ) + end + end + if f33_local2 then + f33_local3 = Engine.Localize( "LUA_MENU_COMPLETED_CAPS" ) + elseif f33_local1 then + local f33_local4 = Cac.GetCamoOrReticleChallengeProgress( f33_local0.exclusiveController, f33_local1 ) + local f33_local5 = nil + if f33_local0.selection_id == "edit_weapon_primary_camo" then + f33_local5 = Cac.GetCamoChallengeTotal( f33_local0.exclusiveController, f33_arg1.parentItem, f33_arg1.item ) + else + f33_local5 = Cac.GetReticleChallengeTotal( f33_arg1.parentItem, f33_arg1.item ) + end + f33_local3 = f33_local4 .. "/" .. f33_local5 + end + end + end + f33_arg0:setText( f33_local3 ) +end + +function cacChooseImageUpdateDescProgress( f34_arg0, f34_arg1 ) + local f34_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f34_arg0 ) + local f34_local1 = nil + local f34_local2 = "" + if f34_arg1.item ~= "none" then + if SvS.IsSvS() then + f34_local2 = Engine.Localize( "LUA_MENU_PLAY_ONLINE_TO_UNLOCK" ) + elseif Cac.IsCamoOrReticleEntitlement( f34_arg1.item ) then + if Cac.IsCamoOrReticleDLC( f34_arg1.item ) and Cac.IsCamoOrReticleEntitlementUnlocked( f34_local0.controller, f34_arg1.item ) == true then + f34_local2 = Engine.Localize( "@DLC_ALREADY_PURCHASED" ) + else + f34_local2 = Engine.Localize( Cac.GetCamoOrReticleEntitlementDesc( f34_arg1.item ) ) + end + else + if f34_local0.selection_id == "edit_weapon_primary_camo" then + f34_local1 = Cac.GetCamoChallengeRef( f34_arg1.parentItem, f34_arg1.item ) + else + f34_local1 = Cac.GetReticleChallengeRef( f34_arg1.parentItem, f34_arg1.item ) + end + if f34_local1 then + f34_local2 = Cac.GetCamoOrReticleChallengeDesc( f34_local1 ) + local f34_local3 = nil + if f34_local0.selection_id == "edit_weapon_primary_camo" then + f34_local3 = Cac.GetCamoChallengeTotal( f34_local0.controller, f34_arg1.parentItem, f34_arg1.item ) + else + f34_local3 = Cac.GetReticleChallengeTotal( f34_arg1.parentItem, f34_arg1.item ) + end + f34_local2 = Engine.Localize( f34_local2, f34_local3 ) + end + end + end + f34_arg0:setText( f34_local2 ) +end + +function CacChooseImageRequirementsWindow( f35_arg0 ) + if f35_arg0 then + return { + type = "generic_menu_background", + id = "cac_progress_background_id", + properties = { + shadow_alpha = Cac.Swatches.Alphas.cac_panel_background_shadow + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = -101, + bottom = -1 + } + }, + children = { + { + type = "UIMarqueeText", + id = "cac_progress_unlock_title_id", + properties = { + text = "" + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 12, + right = 185, + top = 8, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.window_title_text_color.r, + green = Colors.window_title_text_color.g, + blue = Colors.window_title_text_color.b + } + }, + handlers = { + cac_progress_unlock_update = cacChooseImageUpdateTitleProgress + } + }, + { + type = "UIText", + id = "cac_progress_unlock_text_id", + properties = { + text = "" + }, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + right = -12, + top = 8, + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.window_title_text_color.r, + green = Colors.window_title_text_color.g, + blue = Colors.window_title_text_color.b + } + }, + handlers = { + cac_progress_unlock_update = cacChooseImageUpdateTextProgress + } + }, + { + type = "UIText", + id = "cac_progress_unlock_desc_id", + properties = { + text = "" + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 12, + right = -12, + top = 30, + 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 + } + }, + handlers = { + cac_progress_unlock_update = cacChooseImageUpdateDescProgress + } + } + } + } + else + + end +end + +function cac_edit_choose_image_popup() + local f36_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_choose_image_popup" ) + local f36_local1 = f36_local0.scrollBar and 1 or 0 + local f36_local2 + if not (f36_local0.selection_id == "edit_weapon_primary_camo" or f36_local0.selection_id == "edit_weapon_primary_reticle") or f36_local0.squadLocation == "privateMatchSquadMembers" then + f36_local2 = false + else + f36_local2 = true + end + local f36_local3 + if f36_local2 then + f36_local3 = -110 + if not f36_local3 then + + else + local f36_local4 = { + type = "UIElement", + id = "cac_edit_choose_root", + properties = { + squadLocation = "privateMatchSquadMembers", + squadMemberIndex = 0, + slot = 0, + classLocation = "loadouts", + itemIndex = 0, + itemTypeString = "", + disableSetDefaultFocus = false, + selection_id = false, + ImageFunction = function ( f37_arg0, f37_arg1 ) + return "" + end, + ItemGetFunction = function ( f38_arg0, f38_arg1 ) + return "" + end, + ItemSetFunction = function ( f39_arg0, f39_arg1 ) + return "" + end, + ItemGetNameFunction = function ( f40_arg0, f40_arg1 ) + return "" + end, + itemList = {}, + ImageDimensions = {}, + scrollBar = false, + elementsPerRow = 2, + customTop = 0, + customLeft = 0, + customRight = 0, + customBottom = 0, + customWidth = 305 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = MBh.Property( "customTop" ), + left = MBh.Property( "customLeft" ) + } + }, + handlers = { + menu_create = function ( f41_arg0, f41_arg1 ) + CacEditChooseImageOnCreate( f41_arg0, f41_arg1 ) + f41_arg0:dispatchEventToChildren( { + name = "button_update" + } ) + end + } + } + local f36_local5 = {} + local f36_local6 = { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = Cac.Layout.ChooseDialog.top, + left = Cac.Layout.ChooseDialog.left, + width = MBh.Property( "customWidth" ), + height = 540 + } + } + } + local f36_local7 = {} + local f36_local8 = { + type = "generic_menu_titlebar", + id = "cac_grenade_choose_titlebar", + properties = { + title_bar_text = f36_local0.itemTypeString, + font = CoD.TextSettings.BoldFont, + title_bar_text_indent = 25, + title_bar_alignment = LUI.Alignment.Left + } + } + local f36_local9 = { + type = "generic_menu_background_withfade", + id = "cac_background_id", + properties = { + fade_height = 100, + shadow_alpha = Cac.Swatches.Alphas.cac_panel_background_shadow + } + } + local f36_local10 = { + type = "UIStencil", + id = "grid_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 1, + bottom = f36_local3, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIGrid", + id = "edit_choose_grid", + properties = { + elementsPerRow = MBh.Property( "elementsPerRow" ), + hSpacing = 10, + rowHeight = 77 + CoD.TextSettings.NormalFont.Height, + hAlign = LUI.Alignment.Left, + vAlign = LUI.Alignment.Top, + sendScrollEvents = true, + scrollByChildHeight = true + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 5, + bottom = 0, + left = 10, + right = 0 + } + }, + childrenFeeder = CacEditChooseChildrenFeeder + }, + { + type = "UIVerticalScrollbar", + id = "scroll_bar_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 5, + bottom = -10, + right = -9, + width = 10, + alpha = f36_local1 + } + } + } + } + } + local f36_local11 = CacChooseImageRequirementsWindow( f36_local2 ) + f36_local6.children = f36_local8 + f36_local7 = { + type = "generic_back_button", + handlers = { + button_secondary = function ( f42_arg0, f42_arg1 ) + local f42_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f42_arg0 ) + if f42_local0.openMenuOnClose then + LUI.FlowManager.RequestPopupMenu( f42_arg0, f42_local0.openMenuOnClose.menu, true, f42_arg1.controller, true, f42_local0.openMenuOnClose ) + else + LUI.FlowManager.RequestLeaveMenu( f42_arg0 ) + end + end + } + } + f36_local5[1] = f36_local6 + f36_local5[2] = f36_local7 + f36_local4.children = f36_local5 + return f36_local4 + end + end + f36_local3 = -1 +end + +LUI.MenuBuilder.registerDef( "cac_cant_purchase_popup", cac_cant_purchase_popup ) +LUI.MenuBuilder.registerDef( "cac_purchase_popup", cac_purchase_popup ) +LUI.MenuBuilder.registerDef( "cac_edit_choose_image_popup", cac_edit_choose_image_popup ) +LUI.MenuBuilder.registerDef( "cac_edit_choose_image_button", cac_edit_choose_image_button ) +LUI.MenuBuilder.registerType( "cac_edit_choose_image_button_background", cac_edit_choose_image_button_background ) +LUI.MenuBuilder.registerType( "cac_edit_choose_image_button_background_outline", cac_edit_choose_image_button_background_outline ) +LockTable( _M ) diff --git a/lui/mp_menus/caceditpopup.dec.lua b/lui/mp_menus/caceditpopup.dec.lua new file mode 100644 index 0000000..2c6c2b4 --- /dev/null +++ b/lui/mp_menus/caceditpopup.dec.lua @@ -0,0 +1,213 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function AltButtonPressed( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + if f1_local0.overrideAltButtonPressed then + f1_arg1.itemType = f1_local0.currentHighlightedType + Engine.PlaySound( CoD.SFX.RestrictClass ) + f1_local0.overrideAltButtonPressed( f1_arg0, f1_arg1 ) + end +end + +function defaultActionToAvoidAssert( f2_arg0, f2_arg1 ) + DebugPrint( "[WARNING] CacEditPopup.lua: defaultActionToAvoidAssert() triggered." ) +end + +function OnMenuCreate( f3_arg0, f3_arg1 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + f3_local0.squadLocation = f3_arg0.properties.squadLocation + assert( f3_local0.squadLocation, "Cac: No squad location specified, something went wrong" ) + f3_local0.squadMemberIndex = f3_arg0.properties.squadMemberIndex + if not f3_local0.squadMemberIndex then + DebugPrint( "[WARNING] CAC: using squad member index 0, this is only ok if you are editing a menu" ) + f3_local0.squadMemberIndex = 0 + end + f3_local0.slot = f3_arg0.properties.slot + if not f3_local0.slot then + DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" ) + f3_local0.slot = 0 + end + f3_local0.classLocation = f3_arg0.properties.classLocation + assert( f3_local0.classLocation, "Cac: No class location specified, something went wrong" ) + f3_local0.itemIndex = f3_arg0.properties.itemIndex + f3_local0.buttonFeeder = f3_arg0.properties.buttonFeeder + f3_local0.customTop = f3_arg0.properties.customTop + f3_local0.customLeft = f3_arg0.properties.customLeft + f3_local0.customRight = f3_arg0.properties.customRight + f3_local0.customBottom = f3_arg0.properties.customBottom + f3_local0.overrideChooseAction = f3_arg0.properties.overrideChooseAction + f3_local0.disableSetDefaultFocus = f3_arg0.properties.disableSetDefaultFocus + f3_local0.overrideChooseDisableCheck = f3_arg0.properties.overrideChooseDisableCheck + f3_arg0:processEvent( { + name = "update_title", + title_text = f3_arg0.properties.titleBarText + } ) + if f3_local0.overrideAltButtonPressed and not MLG.AreMLGRulesEnabled() then + f3_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@MPUI_RULES_EXCLUDE_CATEGORY" ), + side = "right", + clickable = true, + immediate = true + } ) + end + f3_arg0:processEvent( { + name = "menu_refresh" + } ) + f3_arg0:processEvent( { + name = "gain_focus" + } ) +end + +function OnMenuClose( f4_arg0, f4_arg1 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + if f4_local0.overrideAltButtonPressed then + f4_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = "", + side = "right", + immediate = true + } ) + end +end + +function cac_edit_popup_main() + return { + type = "UIElement", + id = "cac_edit_popup_root", + properties = { + squadLocation = "privateMatchSquadMembers", + squadMemberIndex = 0, + slot = 0, + classLocation = "privateMatchCustomClasses", + itemIndex = 0, + buttonFeeder = function () + + end + , + titleBarText = "", + overrideChooseAction = nil, + disableSetDefaultFocus = false, + overrideChooseDisableCheck = nil, + customTop = 0, + customLeft = 0, + customRight = 0, + customBottom = 0 + }, + handlers = { + menu_create = OnMenuCreate, + menu_close = OnMenuClose, + hide_cac_edit_popup = function ( f7_arg0, f7_arg1 ) + f7_arg0:animateToState( "hidden", 0 ) + end + , + show_cac_edit_popup = function ( f8_arg0, f8_arg1 ) + f8_arg0:animateToState( "default", 0 ) + end + + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = MBh.Property( "customTop" ), + bottom = MBh.Property( "customBottom" ), + left = MBh.Property( "customLeft" ), + right = MBh.Property( "customRight" ), + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + children = { + { + type = "UIElement", + id = "edit_weapon_list", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = Cac.Layout.ChooseDialog.left, + top = Cac.Layout.ChooseDialog.top, + width = 305, + height = 540 + } + }, + properties = { + play_intro_anim = 1, + buttonFeeder = MBh.Property( "buttonFeeder" ) + }, + children = { + { + type = "generic_menu_titlebar", + id = "cac_weapon_types_titlebar", + properties = { + title_bar_text = genericTitle, + font = CoD.TextSettings.BoldFont, + title_bar_text_indent = 25, + title_bar_alignment = LUI.Alignment.Left + } + }, + { + type = "generic_menu_background_withfade", + id = "cac_weapon_background_id", + properties = { + fade_height = 100, + shadow_alpha = Cac.Swatches.Alphas.cac_panel_background_shadow + } + }, + { + type = "UIVerticalList", + id = "cac_weapon_types_list", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 4, + bottom = 0, + left = 4, + right = -4, + spacing = 4 + } + }, + childrenFeeder = MBh.Property( "buttonFeeder" ) + } + } + }, + { + type = "UIBindButton", + id = "cac_edit_weapon_button_bind_id", + handlers = { + button_alt1 = AltButtonPressed, + button_secondary = function ( f9_arg0, f9_arg1 ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 ) + if f9_local0.OnMenuBack then + f9_local0.OnMenuBack( f9_arg0, f9_arg1 ) + end + if f9_local0.editPopupOpenMenuOnClose then + LUI.FlowManager.RequestPopupMenu( f9_arg0, f9_local0.editPopupOpenMenuOnClose.menu, true, f9_arg1.controller, true, f9_local0.editPopupOpenMenuOnClose ) + else + LUI.FlowManager.RequestLeaveMenu( f9_arg0 ) + end + end + + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "cac_edit_popup_main", cac_edit_popup_main ) +LUI.MenuBuilder.registerDef( "cac_edit_popup_main_second", cac_edit_popup_main ) +LockTable( _M ) diff --git a/lui/mp_menus/caceditselectioninfo.dec.lua b/lui/mp_menus/caceditselectioninfo.dec.lua new file mode 100644 index 0000000..4245710 --- /dev/null +++ b/lui/mp_menus/caceditselectioninfo.dec.lua @@ -0,0 +1,846 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function selection_info_panel_header() + return { + type = "UIElement", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 30, + height = GenericButtonDims.button_height + } + }, + children = { + { + type = "UIText", + id = "info_panel_header_text", + properties = { + text = "" + }, + handlers = { + selection_info_set_header_text = function ( f2_arg0, f2_arg1 ) + assert( f2_arg1.newText ) + f2_arg0:setText( f2_arg1.newText ) + end + + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 25, + right = 0, + top = -0.5 * CoD.TextSettings.BoldFont.Height, + bottom = 0.5 * CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + } + } + } +end + +function selection_info_panel_footer() + return { + type = "UIElement", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = Cac.Layout.SelectionInfo.textTop, + bottom = Cac.Layout.SelectionInfo.textTop + 40 + } + }, + children = { + { + type = "UIImage", + id = "info_panel_description_new_icon", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 0, + left = -8, + width = 32, + height = 32, + material = RegisterMaterial( "icon_new" ), + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + selection_info_set_footer_text = function ( f4_arg0, f4_arg1 ) + if f4_arg1.newIcon then + f4_arg0:animateToState( "visible" ) + if f4_arg1.newIconMaterial then + CoD.SetMaterial( f4_arg0, RegisterMaterial( f4_arg1.newIconMaterial ) ) + end + else + f4_arg0:animateToState( "default" ) + end + end + + } + }, + { + type = "UIText", + id = "info_panel_footer_text", + properties = { + text = "" + }, + handlers = { + selection_info_set_footer_text = function ( f5_arg0, f5_arg1 ) + assert( f5_arg1.newText ) + f5_arg0:setText( f5_arg1.newText ) + end + + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 25, + right = 0, + top = 0, + bottom = 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 = "UIImage", + id = "warning_exclamation", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 0, + top = 0, + width = 32, + height = 32, + material = RegisterMaterial( "icon_new" ), + alpha = 0 + } + }, + handlers = { + update_warning_text = function ( f6_arg0, f6_arg1 ) + if f6_arg1.conflictFooter then + local f6_local0 = f6_arg0:getParent() + f6_local0 = f6_local0:getChildById( "info_panel_footer_text" ) + local f6_local1, f6_local2 = f6_local0:getElementTextDims() + f6_arg0:registerAnimationState( "visible", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = -10, + top = f6_local2 + 5, + width = 32, + height = 32, + alpha = 1 + } ) + f6_arg0:animateToState( "visible" ) + else + f6_arg0:animateToState( "default" ) + end + end + + } + }, + { + type = "UIMarqueeText", + id = "warning_text", + properties = { + text = Engine.Localize( "@LUA_MENU_LETHAL_WARNING" ) + }, + states = { + default = CoD.ColorizeState( Cac.Swatches.warning_text, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 32, + right = 0, + top = 10 + CoD.TextSettings.NormalFont.Height * 3, + bottom = 10 + CoD.TextSettings.NormalFont.Height * 4, + alpha = 0 + } ) + }, + properties = { + scrollSpeed = 100 + }, + handlers = { + update_warning_text = function ( f7_arg0, f7_arg1 ) + if f7_arg1.conflictFooter then + f7_arg0:setText( f7_arg1.conflictFooter ) + local f7_local0 = f7_arg0:getParent() + f7_local0 = f7_local0:getChildById( "info_panel_footer_text" ) + local f7_local1, f7_local2 = f7_local0:getElementTextDims() + f7_arg0:registerAnimationState( "visible", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 25, + right = 300, + top = 10 + f7_local2, + bottom = 10 + f7_local2 + CoD.TextSettings.NormalFont.Height, + alpha = 1 + } ) + f7_arg0:animateToState( "visible" ) + else + f7_arg0:animateToState( "default" ) + end + end + + } + } + } + } +end + +function UpdateAbilitiesInfoPanel( f8_arg0, f8_arg1 ) + f8_arg0:closeChildren() + if f8_arg1.selection_id == "edit_abilities" then + for f8_local6, f8_local7 in ipairs( Cac.GetAbilityTypes() ) do + for f8_local5 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.IsAbilityPicked( f8_arg1.controller, f8_arg1.squadLocation, f8_arg1.squadMemberIndex, f8_arg1.classLocation, f8_arg1.slot, f8_local7, f8_local5 - 1, "abilitiesPicked" ) then + local f8_local3 = Cac.GetAbilityRef( f8_local7 ) + local f8_local4 = Cac.GetAbilitySlotRef( f8_local3, f8_local5 ) + f8_arg0:addElement( abilities_info_container( nil, { + categoryColor = Colors.cac_ability[f8_local3], + iconImage = Cac.GetPerkImage( f8_local4 ), + costText = Cac.GetPerkCost( f8_local4 ), + title = Cac.GetPerkName( f8_local4 ), + description = Cac.GetPerkDesc( f8_local4 ), + iconSize = CoD.TextSettings.BoldFont.Height + CoD.TextSettings.NormalFont.Height, + id = "abilities_info_container_" .. f8_local5 .. "_" .. f8_local7, + menu_left = 10, + description_right = 325, + cost_left = 0 + } ) ) + end + end + end + f8_local0 = Cac.GetNumberAbilitiesPicked( f8_arg1.controller, f8_arg1.squadLocation, f8_arg1.squadMemberIndex, f8_arg1.classLocation, f8_arg1.slot, "abilitiesPicked" ) + f8_arg0:registerAnimationState( "compressed", { + spacing = math.min( (550 - f8_local0 * (CoD.TextSettings.BoldFont.Height + CoD.TextSettings.NormalFont.Height)) / f8_local0, 27 ) + } ) + f8_arg0:animateToState( "compressed" ) + elseif f8_arg1.selection_id == "edit_killstreaks" then + local f8_local0 = Cac.GetStreakType( f8_arg1.controller, f8_arg1.squadLocation, f8_arg1.squadMemberIndex, f8_arg1.classLocation, f8_arg1.slot ) + if f8_local0 == "specialty_null" then + f8_local0 = "streaktype_assault" + end + f8_local0 = Cac.GetStreakTypeReference( f8_local0 ) + local f8_local1 = 0 + for f8_local2 = 0, 2, 1 do + local f8_local8 = Cac.GetStreak( f8_arg1.controller, f8_arg1.squadLocation, f8_arg1.squadMemberIndex, f8_arg1.classLocation, f8_arg1.slot, f8_local0, f8_local2 ) + local f8_local9 = Cac.GetStreakIcon( f8_local8, f8_arg1.controller ) + local f8_local10 = 64 + local f8_local11 = 10 + local f8_local3 = -25 + if f8_local0 == "specialistStreaks" then + local f8_local4 = Cac.GetPerkCost( Cac.StripSuffix( f8_local8, "_ks" ) ) + if f8_local4 ~= "" and f8_local4 then + f8_local1 = f8_local1 + f8_local4 + 1 + end + else + f8_local1 = Cac.GetStreakCost( f8_local8 ) + end + local f8_local4 = abilities_info_container( nil, { + categoryColor = Colors.even_stripe, + iconImage = f8_local9, + costText = f8_local1, + title = Cac.GetStreakName( f8_local8 ), + iconSize = f8_local10, + description = Cac.GetStreakDesc( f8_local8 ), + id = "abilities_info_container_" .. f8_local2, + menu_left = f8_local11, + description_right = 300, + cost_left = f8_local3 + } ) + if f8_local8 ~= "none" then + f8_arg0:addElement( f8_local4 ) + end + end + f8_arg0:animateToState( "strike_spaced" ) + end + f8_arg0:animateToState( "visible" ) +end + +function abilities_info_container( menu, controller ) + local self = LUI.UIElement.new() + self.id = controller.id + self.properties = controller + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = controller.menu_left + math.abs( controller.cost_left ), + right = 0, + top = 0, + height = CoD.TextSettings.BoldFont.Height + CoD.TextSettings.NormalFont.Height + } ) + self:animateToState( "default" ) + local f9_local1 = LUI.UIElement.new() + f9_local1.id = "abilities_info_image_container" + f9_local1:registerAnimationState( "default", { + leftAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + width = 60, + top = 0, + bottom = 0 + } ) + f9_local1:animateToState( "default" ) + local f9_local2 = LUI.UIImage.new() + f9_local2.id = "abilities_info_tab_id" + f9_local2:registerAnimationState( "default", CoD.ColorizeState( controller.categoryColor, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 16, + left = 0, + right = 16, + material = RegisterMaterial( "widg_triangle" ) + } ) ) + f9_local2:animateToState( "default" ) + f9_local1:addElement( f9_local2 ) + local f9_local3 = LUI.UIImage.new() + f9_local3.id = "abilities_info_icon_id" + f9_local3:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + right = -3, + width = controller.iconSize, + height = controller.iconSize, + material = RegisterMaterial( controller.iconImage ), + alpha = 1 + } ) + f9_local3:animateToState( "default" ) + f9_local1:addElement( f9_local3 ) + local f9_local4 = LUI.UIText.new() + f9_local4.id = "abilities_info_cost_id" + f9_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.secondary_text_color, { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + left = controller.cost_left, + right = 0, + height = CoD.TextSettings.SmallFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) ) + f9_local4:animateToState( "default" ) + f9_local4:setText( controller.costText ) + f9_local1:addElement( f9_local4 ) + self:addElement( f9_local1 ) + local f9_local5 = LUI.UIElement.new() + f9_local5.id = "abilities_info_description_container_id" + f9_local5:registerAnimationState( "default", { + leftAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 60, + right = 0, + top = 0, + bottom = 0 + } ) + f9_local5:animateToState( "default" ) + local f9_local6 = LUI.UIText.new() + f9_local6.id = "abilities_info_description_title_id" + f9_local6:setText( controller.title ) + f9_local6:registerAnimationState( "default", { + font = CoD.TextSettings.BoldFont.Font, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 5, + right = 350 - controller.menu_left, + top = 0, + height = CoD.TextSettings.BoldFont.Height, + alignment = LUI.Alignment.Left + } ) + f9_local6:animateToState( "default" ) + f9_local5:addElement( f9_local6 ) + local f9_local7 = LUI.UIMarqueeText.new() + LUI.UIMarqueeText.SetSpeed( f9_local7, 100 ) + f9_local7.id = "abilities_info_description_text_id" + f9_local7:setText( controller.description ) + f9_local7:registerAnimationState( "default", CoD.ColorizeState( Colors.secondary_text_color, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 5, + right = controller.description_right, + top = CoD.TextSettings.BoldFont.Height, + bottom = CoD.TextSettings.BoldFont.Height + CoD.TextSettings.NormalFont.Height + } ) ) + f9_local7:animateToState( "default" ) + f9_local5:addElement( f9_local7 ) + self:addElement( f9_local5 ) + return self +end + +function abilities_info_panel() + return { + type = "UIVerticalList", + id = "abilities_info_panel_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 145, + bottom = 400, + alignment = LUI.Alignment.Middle, + spacing = 27 + }, + strike_spaced = { + spacing = 80 + } + }, + handlers = { + update_abilities_info_panel = UpdateAbilitiesInfoPanel, + hide_abilities_info_panel = function ( f11_arg0, f11_arg1 ) + f11_arg0:closeChildren() + end + + } + } +end + +function UpdateSelectionInfoPanelMainImage( f12_arg0, f12_arg1 ) + assert( f12_arg1.newImage ) + f12_arg0:animateToState( "visible", 0 ) + f12_arg0.properties.material = f12_arg1.newImage + f12_arg0:setImage( f12_arg1.newImage ) +end + +f0_local0 = function () + local f13_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + local f13_local1 = false + if GetCurrentGameType() == "infect" and Cac.IsDefaultClass( f13_local0.classLocation ) and f13_local0.currTeam == Teams.axis then + f13_local1 = true + end + return f13_local1 +end + +function UpdateSelectionInfoPanel( f14_arg0, f14_arg1 ) + assert( f14_arg1.selection_id ) + assert( f14_arg1.classLocation ) + assert( f14_arg1.slot ) + assert( f14_arg1.controller ) + local f14_local0 = f14_arg1.selection_id + local f14_local1 = f14_arg1.squadLocation + local f14_local2 = f14_arg1.squadMemberIndex + local f14_local3 = f14_arg1.classLocation + local f14_local4 = f14_arg1.slot + local f14_local5 = f14_arg1.controller + local f14_local6 = "UnknownSelectionId" + local f14_local7 = "" + local f14_local8 = "" + local f14_local9 = false + local f14_local10 = false + local f14_local11 = false + local f14_local12 = "icon_new" + if f14_local0 == "edit_weapon_primary" or f14_local0 == "edit_weapon_primary_camo" or f14_local0 == "edit_weapon_primary_reticle" then + if f14_arg1.viewingItem then + f14_local7 = f14_arg1.viewingItem + else + f14_local7 = Cac.GetWeapon( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, Cac.Indices.Weapons.Primary ) + end + f14_arg0:dispatchEventToRoot( { + name = "update_selection_info_panel_main_image", + newImage = RegisterMaterial( Cac.GetWeaponFullImage( f14_local7 ) ), + immediate = true + } ) + if f14_local7 == "iw6_knifeonly" then + f14_local9 = Engine.Localize( "@LUA_MENU_NONE_DESC", "LUA_MENU_PRIMARY" ) + end + f14_local6 = Cac.GetWeaponName( f14_local7 ) + elseif f14_local0 == "edit_weapon_secondary" then + if f14_arg1.viewingItem then + f14_local7 = f14_arg1.viewingItem + else + f14_local7 = Cac.GetWeapon( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, Cac.Indices.Weapons.Secondary ) + end + f14_arg0:dispatchEventToRoot( { + name = "update_selection_info_panel_main_image", + newImage = RegisterMaterial( Cac.GetWeaponFullImage( f14_local7 ) ), + immediate = true + } ) + f14_local6 = Cac.GetWeaponName( f14_local7 ) + if f14_local0 == "edit_weapon_secondary" and Cac.IsAbilityPickedBySlotName( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, "Elite", "specialty_twoprimaries", "abilitiesPicked" ) and not f14_arg1.viewingItem and Cac.IsWeaponClassSecondary( Cac.GetWeaponClass( Cac.GetWeapon( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, 1 ) ), true ) then + f14_local9 = Engine.Localize( "@LUA_MENU_SELECT_SECOND_PRIMARY" ) + f14_local11 = true + f14_local12 = "icon_perks_overkill" + elseif f14_local7 == "none" then + f14_local6 = "" + f14_local9 = Engine.Localize( "@LUA_MENU_NONE_DESC", "LUA_MENU_SECONDARY" ) + end + elseif f14_local0 == "edit_weapon_primary_attach1" or f14_local0 == "edit_weapon_primary_attach2" or f14_local0 == "edit_weapon_primary_attach3" or f14_local0 == "edit_weapon_secondary_attach1" or f14_local0 == "edit_weapon_secondary_attach2" then + local f14_local13 = nil + if f14_local0 == "edit_weapon_primary_attach1" then + f14_local13 = Cac.Indices.Attachments.PrimaryAttachment1 + elseif f14_local0 == "edit_weapon_primary_attach2" then + f14_local13 = Cac.Indices.Attachments.PrimaryAttachment2 + elseif f14_local0 == "edit_weapon_primary_attach3" then + f14_local13 = Cac.Indices.Attachments.PrimaryAttachment3 + elseif f14_local0 == "edit_weapon_secondary_attach1" then + f14_local13 = Cac.Indices.Attachments.SecondaryAttachment1 + elseif f14_local0 == "edit_weapon_secondary_attach2" then + f14_local13 = Cac.Indices.Attachments.SecondaryAttachment2 + else + assert( false, "How the hell did I get here?!" ) + end + local f14_local14 = f14_arg1.weaponIndex or 0 + local f14_local15 = Cac.GetWeapon( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, f14_local14 ) + local f14_local16 = Cac.GetWeaponClass( f14_local15 ) + local f14_local17 = Cac.GetAttachment( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, f14_local14, f14_local13 ) + local f14_local18 = RegisterMaterial( Cac.GetAttachmentImageFull( f14_local17, f14_local15 ) ) + f14_local7 = f14_local17 + f14_local6 = Cac.GetAttachmentName( f14_local17, f14_local15 ) + f14_local9 = Cac.GetAttachmentDesc( f14_local17, f14_local15 ) + if f14_local17 == "none" then + f14_local6 = "" + f14_local9 = "" + end + f14_arg0:dispatchEventToRoot( { + name = "update_selection_info_panel_main_image", + newImage = f14_local18, + immediate = true + } ) + if f14_local0 == "edit_weapon_primary_attach3" or f14_local0 == "edit_weapon_secondary_attach2" then + local f14_local19 = Cac.IsAbilityPickedBySlotName( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) + if f14_local19 and Cac.GetAttachment( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, 0, 2 ) == "none" and f14_local0 == "edit_weapon_primary_attach3" then + if f14_local15 == "iw6_knifeonly" or f14_local15 == "iw6_riotshield" then + f14_local9 = Engine.Localize( "PATCH_MENU_THIRD_ATTACHMENT_LOCKED" ) + else + f14_local9 = Engine.Localize( "LUA_MENU_SELECT_THIRD_ATTACHMENT" ) + end + f14_local11 = true + f14_local12 = "icon_perks_extra_attach" + elseif f14_local19 and Cac.GetAttachment( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, 1, 1 ) == "none" and f14_local0 == "edit_weapon_secondary_attach2" then + if f14_local15 == "iw6_riotshield" or f14_local15 == "none" or f14_local16 == "weapon_projectile" then + f14_local9 = Engine.Localize( "PATCH_MENU_SECOND_ATTACHMENT_LOCKED" ) + else + f14_local9 = Engine.Localize( "LUA_MENU_SELECT_SECOND_ATTACHMENT" ) + end + f14_local11 = true + f14_local12 = "icon_perks_extra_attach" + elseif not f14_local19 then + f14_local9 = Engine.Localize( "LUA_MENU_EQUIP_EXTRA_ATTACH" ) + end + end + elseif f14_local0 == "edit_lethal" then + if f14_arg1.viewingItem then + f14_local7 = f14_arg1.viewingItem + f14_local8 = Cac.StripSuffix( f14_local7, "_mp" ) + else + f14_local7 = Cac.GetPrimaryGrenade( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4 ) + f14_local8 = Cac.StripSuffix( f14_local7, "_mp" ) + end + local f14_local13 = nil + for f14_local17, f14_local18 in pairs( Cac.Indices.Weapons ) do + local f14_local19 + if f14_local18 == Cac.Indices.Weapons.Primary then + f14_local19 = 2 + if not f14_local19 then + + else + local f14_local20 = false + for f14_local21 = 0, f14_local19, 1 do + local f14_local24 = Cac.GetAttachment( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, f14_local18, f14_local21 ) + if f14_local24 == "shotgun" or f14_local24 == "gl" then + if f14_local7 == "specialty_null" and not f14_arg1.viewingItem then + + else + f14_local10 = Engine.Localize( "@LUA_MENU_LETHAL_WARNING" ) + end + local f14_local25 = Cac.GetWeapon( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, f14_local18 ) + f14_local6 = Cac.GetAttachmentName( f14_local24, f14_local25 ) + f14_local9 = Cac.GetAttachmentDesc( f14_local24, f14_local25 ) + f14_local10 = Engine.Localize( "@LUA_MENU_LETHAL_REPLACED_WARNING" ) + f14_local13 = RegisterMaterial( Cac.GetAttachmentImageFull( f14_local24, f14_local25 ) ) + end + end + if f14_local20 then + + end + end + end + f14_local19 = 1 + end + if not f14_local13 then + f14_local13 = RegisterMaterial( Cac.GetWeaponFullImage( f14_local8 ) ) + f14_local6 = Cac.GetWeaponName( f14_local8 ) + if f14_local7 == "specialty_null" then + f14_local6 = "" + f14_local9 = Engine.Localize( "@LUA_MENU_NONE_DESC", "MENU_EQUIPMENT" ) + end + end + if Cac.IsAbilityPickedBySlotName( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, "Equipment", "specialty_extra_deadly", "abilitiesPicked" ) and f14_local7 == "specialty_null" then + f14_local9 = Engine.Localize( "@LUA_MENU_SELECT_LETHAL" ) + f14_local11 = true + f14_local12 = "icon_perks_extra_lethal" + end + f14_arg0:dispatchEventToRoot( { + name = "update_selection_info_panel_main_image", + newImage = f14_local13, + immediate = true + } ) + elseif f14_local0 == "edit_tactical" then + if f14_arg1.viewingItem then + f14_local7 = f14_arg1.viewingItem + f14_local8 = Cac.StripSuffix( f14_local7, "_mp" ) + else + f14_local7 = Cac.GetSecondaryGrenade( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4 ) + f14_local8 = Cac.StripSuffix( f14_local7, "_mp" ) + end + f14_local6 = Cac.GetWeaponName( f14_local8 ) + if Cac.IsAbilityPickedBySlotName( f14_local5, f14_local1, f14_local2, f14_local3, f14_local4, "Equipment", "specialty_extra_equipment", "abilitiesPicked" ) and f14_local7 == "specialty_null" then + f14_local6 = "" + if f0_local0() then + f14_local9 = Engine.Localize( "@LUA_MENU_MP_INFECTED_SELECT_TACTICAL" ) + else + f14_local9 = Engine.Localize( "@LUA_MENU_SELECT_TACTICAL" ) + end + f14_local11 = true + f14_local12 = "icon_perks_extra_tactical" + elseif f14_local7 == "specialty_null" then + f14_local6 = "" + if f0_local0() then + f14_local9 = Engine.Localize( "@LUA_MENU_MP_INFECTED_TACTICAL" ) + f14_local11 = true + f14_local12 = "icon_perks_extra_tactical" + else + f14_local9 = Engine.Localize( "@LUA_MENU_NONE_DESC", "MENU_TACTICAL" ) + end + end + f14_arg0:dispatchEventToRoot( { + name = "update_selection_info_panel_main_image", + newImage = RegisterMaterial( Cac.GetWeaponFullImage( f14_local8 ) ), + immediate = true + } ) + elseif f14_local0 == "edit_killstreaks" or f14_local0 == "edit_abilities" then + f14_arg0:processEvent( { + name = "update_abilities_info_panel", + controller = f14_local5, + squadLocation = f14_local1, + squadMemberIndex = f14_local2, + classLocation = f14_local3, + slot = f14_local4, + selection_id = f14_local0 + } ) + f14_arg0:processEvent( { + name = "hide_main_info_panel" + } ) + else + assert( false, "Unknown selection_id in UpdateSelectionInfoPanel" ) + end + if f14_local0 ~= "edit_killstreaks" and f14_local0 ~= "edit_abilities" then + f14_arg0:processEvent( { + name = "hide_abilities_info_panel" + } ) + f14_arg0:processEvent( { + name = "show_main_info_panel" + } ) + end + if f14_local0 == "edit_lethal" or f14_local0 == "edit_tactical" or not IsOnlineMatch() or Engine.GetDvarBool( "xblive_privatematch" ) then + f14_arg0:dispatchEventToRoot( { + name = "hide_lt", + immediate = true + } ) + f14_arg0:dispatchEventToRoot( { + name = "hide_rt", + immediate = true + } ) + else + f14_arg0:dispatchEventToRoot( { + name = "show_lt" + } ) + f14_arg0:dispatchEventToRoot( { + name = "show_rt" + } ) + end + local f14_local13 = f14_arg0:getFirstDescendentById( "focus_dialog_header_id" ) + if f14_local13 then + f14_local13:processEvent( { + name = "selection_info_set_header_text", + newText = f14_local6, + immediate = true, + dispatchChildren = true + } ) + end + local f14_local14 = f14_arg0:getFirstDescendentById( "focus_dialog_footer_id" ) + if f14_local14 and f14_local7 ~= "" then + local f14_local15 = "" + if f14_local9 then + f14_local15 = f14_local9 + else + local f14_local16 = f14_local7 + if f14_local0 == "edit_tactical" or f14_local0 == "edit_lethal" then + f14_local16 = Cac.StripSuffix( f14_local7, "_mp" ) + end + f14_local15 = Cac.GetWeaponDesc( f14_local16 ) + end + f14_local14:processEvent( { + name = "selection_info_set_footer_text", + newText = f14_local15, + immediate = true, + dispatchChildren = true, + newIcon = f14_local11, + newIconMaterial = f14_local12 + } ) + f14_local14:processEvent( { + name = "update_warning_text", + attachment = attachFooter, + conflictFooter = f14_local10 + } ) + end +end + +function selection_info_panel_main() + return { + type = "UIElement", + id = "selection_info_panel_container_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = Cac.Layout.SelectionInfo.height + } + }, + handlers = { + menu_create = CreateSelectionInfoPanel, + update_selection_info = UpdateSelectionInfoPanel + }, + children = { + { + type = "abilities_info_panel", + id = "abilities_info_panel_id" + }, + { + type = "UIElement", + id = "selection_main_info_panel_container", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + show_main_info_panel = MBh.AnimateToState( "default" ), + hide_main_info_panel = MBh.AnimateToState( "hidden" ) + }, + children = { + { + type = "selection_info_panel_header", + id = "focus_dialog_header_id" + }, + { + type = "UIImage", + id = "selection_info_panel_main_image_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 85, + height = 155, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + update_selection_info_panel_main_image = UpdateSelectionInfoPanelMainImage + } + }, + { + type = "selection_info_panel_footer", + id = "focus_dialog_footer_id" + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "selection_info_panel_header", selection_info_panel_header ) +LUI.MenuBuilder.registerDef( "selection_info_panel_footer", selection_info_panel_footer ) +LUI.MenuBuilder.registerDef( "selection_info_panel_main", selection_info_panel_main ) +LUI.MenuBuilder.registerDef( "abilities_info_panel", abilities_info_panel ) +LUI.MenuBuilder.registerDef( "abilities_info_container", abilities_info_container ) +LockTable( _M ) diff --git a/lui/mp_menus/caceditweaponattachchoose.dec.lua b/lui/mp_menus/caceditweaponattachchoose.dec.lua new file mode 100644 index 0000000..8670b8b --- /dev/null +++ b/lui/mp_menus/caceditweaponattachchoose.dec.lua @@ -0,0 +1,1341 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_weapon_attach_choose_main" ) + local f1_local1 = f1_local0.attachName + unlockItem( f1_arg1.controller, Cac.GetAttachmentUnlockName( f1_local1, Cac.GetWeapon( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot, f1_local0.weaponIndex ) ) ) + Engine.PlaySound( CoD.SFX.CacSpendPoints ) + f1_arg0:dispatchEventToRoot( { + name = "cac_update_currency_text", + immediate = true + } ) + f1_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f1_arg1.controller, + dispatchChildren = true, + immediate = true + } ) + local f1_local2 = Cac.GetAttachments( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot, f1_local0.weaponIndex ) + if Cac.AreAttachmentsCompatible( f1_local2[1], f1_local1 ) and Cac.AreAttachmentsCompatible( f1_local2[2], f1_local1 ) and Cac.AreAttachmentsCompatible( f1_local2[3], f1_local1 ) then + setAttachment( f1_arg0, f1_arg1 ) + else + local f1_local3 = Cac.GetAttachmentClassInUse( f1_arg1.controller, f1_local0.squadLocation, f1_local0.squadMemberIndex, f1_local0.classLocation, f1_local0.slot, f1_local0.weaponIndex, Cac.GetAttachmentType( f1_local1 ) ) + if f1_local3 then + setAttachment( f1_arg0, f1_arg1, f1_local3 ) + end + end + LUI.FlowManager.RequestLeaveMenu( f1_arg0, true ) +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f2_arg0 ) +end + +function cac_cant_purchase_attach_popup() + local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_weapon_attach_choose_main" ) + local f3_local1 = Cac.GetWeapon( f3_local0.controller, f3_local0.squadLocation, f3_local0.squadMemberIndex, f3_local0.classLocation, f3_local0.slot, f3_local0.weaponIndex ) + local f3_local2 = Cac.GetAttachmentName( f3_local0.attachName, f3_local1 ) + local f3_local3 = Cac.GetAttachmentImage( f3_local0.attachName, f3_local1 ) + local f3_local4 = Cac.GetWeaponName( f3_local1 ) + local f3_local5 = Engine.Localize( "@LUA_MENU_UNABLE_TO_PURCHASE_N", f3_local2 ) + local f3_local6 = f3_local0.cost + local f3_local7 = RegisterMaterial( "icon_unlock_token_active" ) + return { + type = "generic_yesno_with_image_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ), + message_image = RegisterMaterial( f3_local3 ), + message_image_top = -15, + message_image_left = 35, + message_cost_text = Engine.Localize( "@LUA_MENU_COST" ), + message_cost_image = f3_local7, + message_cost = f3_local6, + message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ), + message_squad_points_image = f3_local7, + message_squad_points = f3_local0.currency, + no_text = f3_local5, + no_action = f0_local1 + } + } +end + +function cac_purchase_attach_popup() + local f4_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_weapon_attach_choose_main" ) + local f4_local1 = Cac.GetWeapon( f4_local0.controller, f4_local0.squadLocation, f4_local0.squadMemberIndex, f4_local0.classLocation, f4_local0.slot, f4_local0.weaponIndex ) + local f4_local2 = Cac.GetAttachmentName( f4_local0.attachName, f4_local1 ) + local f4_local3 = Cac.GetAttachmentImage( f4_local0.attachName, f4_local1 ) + local f4_local4 = Cac.GetWeaponName( f4_local1 ) + local f4_local5 = Engine.Localize( "@LUA_MENU_PURCHASE_N", f4_local2 ) + local f4_local6 = f4_local0.cost + local f4_local7 = RegisterMaterial( "icon_unlock_token_active" ) + return { + type = "generic_yesno_with_image_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ), + message_image = RegisterMaterial( f4_local3 ), + message_image_top = -15, + message_image_left = 35, + message_cost_text = Engine.Localize( "@LUA_MENU_COST" ), + message_cost_image = f4_local7, + message_cost = f4_local6, + message_squad_points_text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ), + message_squad_points_image = f4_local7, + message_squad_points = f4_local0.currency, + yes_text = f4_local5, + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = f0_local0, + no_action = f0_local1 + }, + additional_handlers = { + menu_create = function ( f5_arg0, f5_arg1 ) + f5_arg0:setText( f5_arg0.properties.weapon ) + end + + } + } +end + +function setAttachment( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_weapon_attach_choose_main" ) + local f6_local1 = Cac.AttachmentHasReticles( f6_local0.attachName ) + local f6_local2 = Cac.GetReticleDefault( f6_local0.attachName ) + local f6_local3 = Cac.GetFirstOpenAttachment( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex ) + if f6_arg2 then + Engine.PlaySound( CoD.SFX.MouseClick ) + local f6_local4 = Cac.GetAttachment( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex, f6_arg2 ) + local f6_local5 = f6_local4 == f6_local0.attachName + if f6_local5 then + Cac.SetAttachment( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex, f6_arg2, "none" ) + else + Cac.SetAttachment( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex, f6_arg2, f6_local0.attachName ) + end + if f6_local1 == true and not f6_local5 then + Cac.ValidateReticle( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex ) + elseif Cac.AttachmentHasReticles( f6_local4 ) then + Cac.SetWeaponReticle( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex, Cac.Reticles.None ) + end + elseif f6_local3 then + Engine.PlaySound( CoD.SFX.MouseClick ) + Cac.SetAttachment( f6_arg1.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex, f6_local3, f6_local0.attachName ) + if f6_local1 == true and Cac.GetReticle( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex ) == "none" then + Cac.SetWeaponReticle( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex, f6_local2 ) + end + else + Engine.PlaySound( CoD.SFX.DenySelect ) + end + Cac.ShuffleAttachmentsDown( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex, 0 ) + f6_arg0:dispatchEventToRoot( { + name = "change_attachment_lock", + weaponIndex = f6_local0.weaponIndex, + attachIndex = Cac.GetAttachmentClassInUse( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot, f6_local0.weaponIndex, Cac.GetAttachmentType( f6_local0.attachName ) ) + } ) + if f6_local0.weaponIndex == 0 then + f6_arg0:dispatchEventToRoot( { + name = "update_squad_member_window_weapon", + weapon = Cac.BuildPrimaryWeaponName( f6_arg1.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot ) + } ) + elseif f6_local0.weaponIndex == 1 then + f6_arg0:dispatchEventToRoot( { + 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 + local f6_local5 + if f6_local0.attachName ~= "shotgun" and f6_local0.attachName ~= "gl" then + f6_local5 = false + else + f6_local5 = true + end + if f6_arg2 or f6_local3 then + f6_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f6_arg1.controller, + dispatchChildren = true, + attachConflict = f6_local5 + } ) + end + if (f6_local5 or Cac.GetAttachmentType( f6_local0.attachName ) == "undermount") and (f6_local3 or f6_arg2) then + local f6_local6 = f6_arg0 + local f6_local7 = f6_arg0.dispatchEventToRoot + local f6_local8 = { + name = "refresh_abilities_recap", + controller = f6_arg1.controller, + specialistType = false + } + local f6_local9 + if Cac.GetPrimaryGrenade( f6_local0.controller, f6_local0.squadLocation, f6_local0.squadMemberIndex, f6_local0.classLocation, f6_local0.slot ) == "specialty_null" then + f6_local9 = f6_local0.attachName + else + f6_local9 = false + end + f6_local8.item = f6_local9 + f6_local7( f6_local6, f6_local8 ) + end + f6_arg0:dispatchEventToRoot( { + name = "element_refresh", + dispatchChildren = true + } ) +end + +function CacEditWeaponAttachChoose( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + local f7_local1 = f7_arg0.properties + local f7_local2 = f7_local1.attachItem + local f7_local3 = Cac.getAttachmentCost( f7_local2, f7_local1.weaponName ) + local f7_local4 = Cac.GetCurrency( f7_arg1.controller ) + f7_local0.cost = f7_local3 + f7_local0.currency = f7_local4 + local f7_local5 = Cac.GetAttachments( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot, f7_local0.weaponIndex ) + local f7_local6 = Cac.AreAttachmentsCompatible( f7_local5[1], f7_local2 ) + local f7_local7 = Cac.AreAttachmentsCompatible( f7_local5[2], f7_local2 ) + local f7_local8 = Cac.AreAttachmentsCompatible( f7_local5[3], f7_local2 ) + local f7_local9 = Cac.IsAttachmentUnlocked( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot, f7_local0.weaponIndex, f7_local2 ) + f7_local0.attachName = f7_local2 + if not f7_local9 then + if f7_local3 <= f7_local4 then + LUI.FlowManager.RequestPopupMenu( f7_arg0, "cac_purchase_attach_popup", true, f7_arg1.controller, false, f7_local1 ) + else + LUI.FlowManager.RequestPopupMenu( f7_arg0, "cac_cant_purchase_attach_popup", true, f7_arg1.controller, false, f7_local1 ) + end + return + elseif f7_local6 and f7_local7 and f7_local8 then + setAttachment( f7_arg0, f7_arg1 ) + else + local f7_local10 = Cac.GetAttachmentClassInUse( f7_arg1.controller, f7_local0.squadLocation, f7_local0.squadMemberIndex, f7_local0.classLocation, f7_local0.slot, f7_local0.weaponIndex, Cac.GetAttachmentType( f7_local2 ) ) + if f7_local10 then + setAttachment( f7_arg0, f7_arg1, f7_local10 ) + else + Engine.PlaySound( CoD.SFX.DenySelect ) + end + end +end + +function CacEditWeaponAttachButtonOver( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + local f8_local1 = f8_arg0.properties + local f8_local2 = f8_local0.controller + assert( f8_local2, "Cac: No controller specified, something went wrong" ) + local f8_local3 = f8_local0.squadLocation + assert( f8_local3, "Cac: No squad location specified, something went wrong" ) + local f8_local4 = f8_local0.classLocation + assert( f8_local4, "Cac: No class location specified, something went wrong" ) + local f8_local5 = f8_local0.slot + if not f8_local5 then + DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" ) + f8_local5 = 0 + end + local f8_local6 = f8_local0.squadMemberIndex + if not f8_local6 then + DebugPrint( "[WARNING] CAC: using squad member index 0, this is only ok if you are editing a menu" ) + f8_local6 = 0 + end + local f8_local7 = f8_local0.weaponIndex + if not f8_local7 then + DebugPrint( "[WARNING] CAC: using weapon index 0, this is only ok if you are editing a menu" ) + f8_local7 = 0 + end + assert( f8_local0.attachIndex, "Cac: No attach index specified, something went wrong" ) + f8_local0.attachmentOver = f8_local1.attachItem + local f8_local8 = Cac.GetAttachments( f8_local0.controller, f8_local0.squadLocation, f8_local0.squadMemberIndex, f8_local0.classLocation, f8_local0.slot, f8_local0.weaponIndex ) + local f8_local9 = Cac.GetAttachmentClassInUse( f8_local0.controller, f8_local0.squadLocation, f8_local0.squadMemberIndex, f8_local0.classLocation, f8_local0.slot, f8_local0.weaponIndex, Cac.GetAttachmentType( f8_local1.attachItem ) ) + f8_arg0:dispatchEventToRoot( { + name = "change_attachment_lock", + weaponIndex = f8_local7, + attachIndex = f8_local9, + immediate = true + } ) + local f8_local10 = {} + local f8_local11 = false + local f8_local12 = Cac.GetAttachmentNumber( f8_local0.controller, f8_local0.squadLocation, f8_local0.squadMemberIndex, f8_local0.classLocation, f8_local0.slot, f8_local0.weaponIndex ) + for f8_local13 = 1, f8_local12, 1 do + if f8_local13 - 1 == f8_local9 then + f8_local10[f8_local13] = f8_local1.attachItem + f8_local11 = true + end + if f8_local8[f8_local13] == "none" and not f8_local11 then + f8_local10[f8_local13] = f8_local1.attachItem + break + end + f8_local10[f8_local13] = f8_local8[f8_local13] + end + f8_arg0:dispatchEventToRoot( { + name = "refresh_info_pane", + controller = f8_local2, + classLocation = f8_local4, + squadLocation = f8_local3, + squadMemberIndex = f8_local6, + slot = f8_local5, + weaponIndex = f8_local7, + viewingAttach0 = f8_local10[1], + viewingAttach1 = f8_local10[2], + viewingAttach2 = f8_local10[3], + dispatchChildren = true, + immediate = true + } ) +end + +function UpdateAttachmentButton( f9_arg0, f9_arg1 ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 ) + local f9_local1 = Cac.GetAttachment( f9_local0.controller, f9_local0.squadLocation, f9_local0.squadMemberIndex, f9_local0.classLocation, f9_local0.slot, f9_local0.weaponIndex, f9_local0.attachIndex ) + local f9_local2 = Cac.IsAttachmentUnlocked( f9_local0.controller, f9_local0.squadLocation, f9_local0.squadMemberIndex, f9_local0.classLocation, f9_local0.slot, f9_local0.weaponIndex, f9_arg0.properties.attachItem ) + local f9_local3 = Cac.GetAttachments( f9_local0.controller, f9_local0.squadLocation, f9_local0.squadMemberIndex, f9_local0.classLocation, f9_local0.slot, f9_local0.weaponIndex ) + f9_arg0.properties.sameCategory = false + if Cac.GetAttachmentClassInUse( f9_local0.controller, f9_local0.squadLocation, f9_local0.squadMemberIndex, f9_local0.classLocation, f9_local0.slot, f9_local0.weaponIndex, Cac.GetAttachmentType( f9_arg0.properties.attachItem ) ) then + f9_arg0.properties.sameCategory = true + end + local f9_local4 + if f9_local3[1] ~= f9_arg0.properties.attachItem and f9_arg0.properties.attachItem ~= f9_local3[2] and f9_arg0.properties.attachItem ~= f9_local3[3] then + f9_local4 = false + else + f9_local4 = true + end + f9_arg0.properties.attachCompatible = Cac.AreAttachmentsCompatible( f9_local3[2], f9_arg0.properties.attachItem ) and Cac.AreAttachmentsCompatible( f9_local3[1], f9_arg0.properties.attachItem ) and Cac.AreAttachmentsCompatible( f9_local3[3], f9_arg0.properties.attachItem ) + local f9_local5 = Cac.GetFirstOpenAttachment( f9_local0.controller, f9_local0.squadLocation, f9_local0.squadMemberIndex, f9_local0.classLocation, f9_local0.slot, f9_local0.weaponIndex ) + if f9_local4 then + f9_arg0:dispatchEventToChildren( { + name = "button_unlocked" + } ) + f9_arg0:dispatchEventToChildren( { + name = "button_tab_selected" + } ) + if f9_local0.attachmentOver == f9_arg0.properties.attachItem then + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_over.a + } ) + else + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_up.a + } ) + end + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + alpha = 0 + } ) + elseif not (not (not f9_arg0.properties.attachCompatible or not f9_local5) or f9_arg0.properties.sameCategory) or not f9_local2 then + if not f9_local2 then + f9_arg0:dispatchEventToChildren( { + name = "button_locked" + } ) + else + f9_arg0:dispatchEventToChildren( { + name = "button_unlocked" + } ) + end + f9_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused" + } ) + if (not f9_arg0.properties.attachCompatible or not f9_local5) and not f9_arg0.properties.sameCategory then + if f9_local0.attachmentOver == f9_arg0.properties.attachItem then + f9_arg0:dispatchEventToChildren( { + name = "button_tab_focused_disabled" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_over.a + } ) + else + f9_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused_disabled" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_up.a + } ) + end + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + alpha = 0 + } ) + else + f9_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.a + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + alpha = 0 + } ) + end + else + f9_arg0:dispatchEventToChildren( { + name = "button_unlocked" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + alpha = 0 + } ) + if f9_arg0:isInFocus() then + f9_arg0:dispatchEventToChildren( { + name = "button_tab_focused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "button_icon_focused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "button_bg_focused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_over.a + } ) + else + f9_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused" + } ) + f9_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.a + } ) + end + end +end + +function HandleAttachmentButtonOver( f10_arg0, f10_arg1 ) + local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 ) + local f10_local1 = Cac.GetAttachment( f10_local0.controller, f10_local0.squadLocation, f10_local0.squadMemberIndex, f10_local0.classLocation, f10_local0.slot, f10_local0.weaponIndex, f10_local0.attachIndex ) + local f10_local2 = Cac.IsAttachmentUnlocked( f10_local0.controller, f10_local0.squadLocation, f10_local0.squadMemberIndex, f10_local0.classLocation, f10_local0.slot, f10_local0.weaponIndex, f10_arg0.properties.attachItem ) + local f10_local3 + if f10_local1 ~= f10_arg0.properties.attachItem and f10_arg0.properties.attachItem ~= Cac.GetAttachment( f10_local0.controller, f10_local0.squadLocation, f10_local0.squadMemberIndex, f10_local0.classLocation, f10_local0.slot, f10_local0.weaponIndex, (f10_local0.attachIndex + 1) % 3 ) and f10_arg0.properties.attachItem ~= Cac.GetAttachment( f10_local0.controller, f10_local0.squadLocation, f10_local0.squadMemberIndex, f10_local0.classLocation, f10_local0.slot, f10_local0.weaponIndex, (f10_local0.attachIndex + 2) % 3 ) then + f10_local3 = false + else + f10_local3 = true + end + local f10_local4 = f10_arg0.properties.attachCompatible + local f10_local5 = f10_arg0.properties.sameCategory + local f10_local6 = Cac.GetFirstOpenAttachment( f10_local0.controller, f10_local0.squadLocation, f10_local0.squadMemberIndex, f10_local0.classLocation, f10_local0.slot, f10_local0.weaponIndex ) + if f10_local3 then + f10_arg0:dispatchEventToChildren( { + name = "button_icon_focused" + } ) + f10_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_over.a + } ) + f10_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + alpha = 0 + } ) + else + f10_arg0:dispatchEventToChildren( { + name = "button_icon_focused" + } ) + if (not f10_local4 or not f10_local6) and not f10_local5 then + f10_arg0:dispatchEventToChildren( { + name = "button_tab_focused_disabled" + } ) + f10_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_over.a + } ) + f10_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + alpha = 0 + } ) + else + f10_arg0:dispatchEventToChildren( { + name = "button_tab_focused" + } ) + f10_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + alpha = 0 + } ) + f10_arg0:dispatchEventToChildren( { + name = "button_bg_focused" + } ) + f10_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_over.a + } ) + end + end + if MatchRules.AllowCustomClasses( f10_local0.classLocation ) then + if f10_arg0.restricted or f10_arg0.classRestricted then + f10_arg0:dispatchEventToRoot( { + name = "show_class_restrictions_warning", + immediate = true + } ) + else + f10_arg0:dispatchEventToRoot( { + name = "hide_class_restrictions_warning", + immediate = true + } ) + end + end +end + +function HandleAttachmentButtonUp( f11_arg0, f11_arg1 ) + local f11_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f11_arg0 ) + local f11_local1 = Cac.GetAttachment( f11_local0.controller, f11_local0.squadLocation, f11_local0.squadMemberIndex, f11_local0.classLocation, f11_local0.slot, f11_local0.weaponIndex, f11_local0.attachIndex ) + local f11_local2 = Cac.IsAttachmentUnlocked( f11_local0.controller, f11_local0.squadLocation, f11_local0.squadMemberIndex, f11_local0.classLocation, f11_local0.slot, f11_local0.weaponIndex, f11_arg0.properties.attachItem ) + local f11_local3 + if f11_local1 ~= f11_arg0.properties.attachItem and f11_arg0.properties.attachItem ~= Cac.GetAttachment( f11_local0.controller, f11_local0.squadLocation, f11_local0.squadMemberIndex, f11_local0.classLocation, f11_local0.slot, f11_local0.weaponIndex, (f11_local0.attachIndex + 1) % 3 ) and f11_arg0.properties.attachItem ~= Cac.GetAttachment( f11_local0.controller, f11_local0.squadLocation, f11_local0.squadMemberIndex, f11_local0.classLocation, f11_local0.slot, f11_local0.weaponIndex, (f11_local0.attachIndex + 2) % 3 ) then + f11_local3 = false + else + f11_local3 = true + end + local f11_local4 = f11_arg0.properties.attachCompatible + local f11_local5 = f11_arg0.properties.sameCategory + local f11_local6 = Cac.GetFirstOpenAttachment( f11_local0.controller, f11_local0.squadLocation, f11_local0.squadMemberIndex, f11_local0.classLocation, f11_local0.slot, f11_local0.weaponIndex ) + if f11_local3 then + f11_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused" + } ) + f11_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_up.a + } ) + else + f11_arg0:dispatchEventToChildren( { + name = "button_icon_unfocused" + } ) + if (not f11_local4 or not f11_local6) and not f11_local5 then + f11_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused_disabled" + } ) + f11_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.outline_up.a + } ) + f11_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + alpha = 0 + } ) + else + f11_arg0:dispatchEventToChildren( { + name = "button_tab_unfocused" + } ) + f11_arg0:dispatchEventToChildren( { + name = "updateBackgroundOutlineColor", + alpha = 0 + } ) + f11_arg0:dispatchEventToChildren( { + name = "button_bg_unfocused" + } ) + f11_arg0:dispatchEventToChildren( { + name = "updateBackgroundColor", + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = Cac.Selection.background_up.a + } ) + end + end +end + +function UpdateAttachmentText( f12_arg0, f12_arg1 ) + f12_arg0:dispatchEventToRoot( { + name = "update_attachment_text", + attachment_name = Cac.GetAttachmentName( f12_arg0.properties.attachItem, f12_arg0.properties.weaponName ), + attachment_desc = Cac.GetAttachmentDesc( f12_arg0.properties.attachItem, f12_arg0.properties.weaponName ), + immediate = true + } ) + f12_arg0:dispatchEventToRoot( { + name = "update_warning_text", + attachment = f12_arg0.properties.attachItem, + immediate = true + } ) +end + +function cac_attachment_button( menu, controller ) + local self = LUI.UIButton.new() + self.id = "generic_id" + self.audio = { + button_over = CoD.SFX.SubMenuMouseOver + } + self.properties = controller + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = Cac.Layout.AttachmentChooseDims.SelectButton.width, + top = 0, + bottom = Cac.Layout.AttachmentChooseDims.SelectButton.height + } ) + self:animateToState( "default" ) + self:registerEventHandler( "button_over", MBh.DoMultiple( { + HandleAttachmentButtonOver, + UpdateAttachmentText + } ) ) + self:registerEventHandler( "button_up", HandleAttachmentButtonUp ) + self:registerEventHandler( "menu_create", function ( element, event ) + UpdateAttachmentButton( element, event ) + local f14_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if MatchRules.AllowCustomClasses( f14_local0.classLocation ) then + local f14_local1, f14_local2 = Cac.SafeGetMatchRule( "commonOption", "attachmentRestricted", element.properties.attachItem ) + if f14_local1 and f14_local2 then + local f14_local3 = Cac.GetRestrictIcon( 0, 2, 28 ) + f14_local3.id = "restrict_icon" .. element.properties.attachItem + element:addElement( f14_local3 ) + element.restricted = true + else + element.restricted = false + end + local f14_local3, f14_local4 = Cac.SafeGetMatchRule( "commonOption", "attachmentClassRestricted", Cac.GetAttachmentType( element.properties.attachItem ) ) + if f14_local3 and f14_local4 then + element.classRestricted = true + else + element.classRestricted = false + end + end + end ) + self:registerEventHandler( "element_refresh", UpdateAttachmentButton ) + local f13_local1 = LUI.UIElement.new() + f13_local1:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + } ) + f13_local1:registerAnimationState( "dim", { + alpha = 0.8 + } ) + f13_local1:animateToState( "default" ) + f13_local1:registerEventHandler( "button_bg_focused", MBh.AnimateLoop( { + { + "dim", + 750, + true, + true + }, + { + "default", + 750 + } + } ) ) + f13_local1:registerEventHandler( "button_bg_unfocused", MBh.AnimateToState( "default", 0 ) ) + f13_local1:addElement( LUI.mp_menus.CacEditChooseImagePopup.cac_edit_choose_image_button_background( nil, { + alpha = 0 + } ) ) + self:addElement( f13_local1 ) + self:addElement( LUI.mp_menus.CacEditChooseImagePopup.cac_edit_choose_image_button_background_outline( nil, { + alpha = 0 + } ) ) + local f13_local2 = LUI.UIImage.new() + f13_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 16, + left = 0, + right = 16, + material = RegisterMaterial( "widg_triangle" ), + alpha = 0 + } ) + f13_local2:registerAnimationState( "focused", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } ) + f13_local2:registerAnimationState( "unfocused", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f13_local2:registerAnimationState( "selected", { + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b, + alpha = 1 + } ) + f13_local2:registerAnimationState( "unselected", { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 0 + } ) + f13_local2:registerAnimationState( "focused_disabled", { + material = RegisterMaterial( "widg_triangle_outline" ), + alpha = Cac.Selection.outline_over.a + } ) + f13_local2:registerAnimationState( "unfocused_disabled", { + material = RegisterMaterial( "widg_triangle" ), + alpha = 0 + } ) + f13_local2:animateToState( "default" ) + f13_local2:registerEventHandler( "button_tab_selected", MBh.AnimateToState( "selected", 0 ) ) + f13_local2:registerEventHandler( "button_tab_unselected", MBh.AnimateToState( "unselected", 0 ) ) + f13_local2:registerEventHandler( "button_tab_focused", MBh.AnimateToState( "focused", 0 ) ) + f13_local2:registerEventHandler( "button_tab_unfocused", MBh.AnimateToState( "unfocused", 0 ) ) + f13_local2:registerEventHandler( "button_tab_focused_disabled", MBh.AnimateToState( "focused_disabled", 0 ) ) + f13_local2:registerEventHandler( "button_tab_unfocused_disabled", MBh.AnimateToState( "unfocused_disabled", 0 ) ) + self:addElement( f13_local2 ) + local f13_local3 = LUI.UIImage.new() + f13_local3.id = "attachment_icon" + local f13_local4 = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + material = controller.image, + width = 48, + height = 48, + alpha = 1 + } + f13_local3:registerAnimationState( "default", f13_local4 ) + f13_local3:registerAnimationState( "selected", f13_local4 ) + f13_local4.scale = 0.1 + f13_local3:registerAnimationState( "focused", f13_local4 ) + f13_local4.scale = 0 + f13_local3:registerAnimationState( "unfocused", f13_local4 ) + f13_local3:registerAnimationState( "focused_blocked", { + alpha = 0.75 + } ) + f13_local3:registerAnimationState( "unfocused_blocked", { + alpha = 0.25 + } ) + f13_local3:animateToState( "default" ) + f13_local3:registerEventHandler( "button_icon_selected", MBh.AnimateToState( "selected", 0 ) ) + f13_local3:registerEventHandler( "button_icon_focused", MBh.AnimateSequence( { + { + "unfocused", + 0 + }, + { + "focused", + 100 + }, + { + "unfocused", + 100 + } + } ) ) + f13_local3:registerEventHandler( "button_icon_unfocused", MBh.AnimateToState( "unfocused", 0 ) ) + f13_local3:registerEventHandler( "button_icon_focused_blocked", MBh.AnimateToState( "focused_blocked", 0 ) ) + f13_local3:registerEventHandler( "button_icon_unfocused_blocked", MBh.AnimateToState( "unfocused_blocked", 0 ) ) + self:addElement( f13_local3 ) + local f13_local5 = LUI.UIElement.new() + f13_local5:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + } ) + f13_local5:registerAnimationState( "locked", { + alpha = 1 + } ) + f13_local5:registerAnimationState( "unlocked", { + alpha = 0 + } ) + f13_local5:animateToState( "default" ) + f13_local5:registerEventHandler( "button_locked", MBh.AnimateToState( "locked", 0 ) ) + f13_local5:registerEventHandler( "button_unlocked", MBh.AnimateToState( "unlocked", 0 ) ) + local f13_local6 = LUI.UIElement.new() + f13_local6:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + left = 2, + right = 0, + height = 20, + alpha = 1 + } ) + f13_local6:animateToState( "default" ) + local f13_local7 = LUI.UIImage.new() + f13_local7:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + material = RegisterMaterial( "icon_unlock_token_active" ), + left = 0, + width = 16, + height = 16 + } ) + f13_local7:animateToState( "default" ) + f13_local6:addElement( f13_local7 ) + local f13_local8 = LUI.UIText.new() + f13_local8:setText( tostring( controller.unlockCost ) ) + f13_local8:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 16, + right = 0, + height = CoD.TextSettings.TinyFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left + } ) ) + f13_local8:animateToState( "default" ) + f13_local6:addElement( f13_local8 ) + f13_local5:addElement( f13_local6 ) + self:addElement( f13_local5 ) + return self +end + +function attachment_decription() + local f15_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_weapon_attach_choose_main" ) + return { + type = "UIElement", + id = "attachment_decription_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 460, + right = 0, + top = 480, + bottom = 0 + } + }, + children = { + { + type = "UIText", + id = "window_title", + properties = { + text = "" + }, + states = { + default = { + font = CoD.TextSettings.BigFont.Font, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.BigFont.Height / 2, + bottom = CoD.TextSettings.BigFont.Height / 2 + } + }, + handlers = { + update_attachment_text = function ( f16_arg0, f16_arg1 ) + f16_arg0:setText( f16_arg1.attachment_name ) + end + + } + }, + { + type = "UIText", + id = "description_text", + properties = { + text = "" + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 300, + top = GenericTitleBarDims.TitleBarHeight, + bottom = GenericTitleBarDims.TitleBarHeight + CoD.TextSettings.NormalFont.Height, + red = Colors.cac_border.r, + green = Colors.cac_border.g, + blue = Colors.cac_border.b + } + }, + handlers = { + update_attachment_text = function ( f17_arg0, f17_arg1 ) + f17_arg0:setText( f17_arg1.attachment_desc ) + end + + } + }, + { + type = "UIImage", + id = "warning_exclamation", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericTitleBarDims.TitleBarHeight + CoD.TextSettings.NormalFont.Height * 4, + left = -18, + width = 32, + height = 32, + material = RegisterMaterial( "icon_new" ), + alpha = 0 + } + }, + handlers = { + update_warning_text = function ( f18_arg0, f18_arg1 ) + local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0 ) + if (f18_arg1.attachment == "shotgun" or f18_arg1.attachment == "gl") and Cac.GetPrimaryGrenade( f18_local0.controller, f18_local0.squadLocation, f18_local0.squadMemberIndex, f18_local0.classLocation, f18_local0.slot ) ~= "specialty_null" then + local f18_local1 = f18_arg0:getParent() + f18_local1 = f18_local1:getChildById( "description_text" ) + local f18_local2, f18_local3 = f18_local1:getElementTextDims() + f18_arg0:registerAnimationState( "visible", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericTitleBarDims.TitleBarHeight + f18_local3 + 9, + left = -18, + width = 32, + height = 32, + alpha = 1 + } ) + f18_arg0:animateToState( "visible" ) + else + f18_arg0:animateToState( "default" ) + end + end + + } + }, + { + type = "UIText", + id = "warning_text", + properties = { + text = Engine.Localize( "@LUA_MENU_UNDER_BARREL_WARNING" ) + }, + states = { + default = CoD.ColorizeState( Cac.Swatches.warning_text, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 20, + right = 300, + top = GenericTitleBarDims.TitleBarHeight + CoD.TextSettings.NormalFont.Height * 4, + bottom = GenericTitleBarDims.TitleBarHeight + CoD.TextSettings.NormalFont.Height * 5, + alpha = 0 + } ) + }, + handlers = { + update_warning_text = function ( f19_arg0, f19_arg1 ) + local f19_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f19_arg0 ) + if (f19_arg1.attachment == "shotgun" or f19_arg1.attachment == "gl") and Cac.GetPrimaryGrenade( f19_local0.controller, f19_local0.squadLocation, f19_local0.squadMemberIndex, f19_local0.classLocation, f19_local0.slot ) ~= "specialty_null" then + local f19_local1 = f19_arg0:getParent() + f19_local1 = f19_local1:getChildById( "description_text" ) + local f19_local2, f19_local3 = f19_local1:getElementTextDims() + f19_arg0:registerAnimationState( "visible", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 20, + right = 300, + top = GenericTitleBarDims.TitleBarHeight + f19_local3 + 5, + bottom = GenericTitleBarDims.TitleBarHeight + f19_local3 + CoD.TextSettings.NormalFont.Height + 5, + alpha = 1 + } ) + f19_arg0:animateToState( "visible" ) + else + f19_arg0:animateToState( "default" ) + end + end + + } + } + } + } +end + +function AttachmentGridShadeFeeder( f20_arg0 ) + local f20_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_weapon_attach_choose_main" ) + local f20_local1 = {} + for f20_local2 = 1, 4, 1 do + local f20_local5 = 0 + if #f20_local1 % 2 == 0 then + f20_local5 = 0.1 + end + f20_local1[#f20_local1 + 1] = { + type = "UIImage", + id = "dark_film_id_" .. f20_local2, + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 1, + right = -1, + top = 0, + red = 0, + green = 0, + blue = 0, + height = 80, + alpha = f20_local5 + } + } + } + end + return f20_local1 +end + +function AttachmentGridTextFeeder( f21_arg0 ) + local f21_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_weapon_attach_choose_main" ) + local f21_local1 = Cac.GetAttachmentTypeList( Cac.GetWeapon( f21_local0.controller, f21_local0.squadLocation, f21_local0.squadMemberIndex, f21_local0.classLocation, f21_local0.slot, f21_local0.weaponIndex ) ) + local f21_local2 = {} + for f21_local6, f21_local7 in ipairs( f21_local1 ) do + f21_local2[#f21_local2 + 1] = { + type = "UIText", + id = "attachment_category_name_" .. f21_local7, + properties = { + text = Cac.AttachmentTypes.Strings[f21_local7] + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 122, + top = -CoD.TextSettings.NormalFont.Height / 2, + bottom = CoD.TextSettings.NormalFont.Height / 2, + red = 1, + green = 1, + blue = 1 + } + }, + handlers = { + menu_create = function ( f22_arg0, f22_arg1 ) + local f22_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f22_arg0 ) + if MatchRules.AllowCustomClasses( f22_local0.classLocation ) then + local f22_local1, f22_local2 = Cac.SafeGetMatchRule( "commonOption", "attachmentClassRestricted", f21_local7 ) + if f22_local1 and f22_local2 then + local self = LUI.UIImage.new() + self.id = "restrict_icon" .. f21_local7 + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 85, + top = CoD.TextSettings.NormalFont.Height, + width = 28, + height = 28, + material = RegisterMaterial( "icon_new_3" ), + alpha = 1 + } ) + self:animateToState( "default" ) + f22_arg0:addElement( self ) + end + end + end + } + } + end + return f21_local2 +end + +function AttachmentSelectionFeeder( f23_arg0 ) + local f23_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_weapon_attach_choose_main" ) + local f23_local1 = Cac.GetWeapon( f23_local0.controller, f23_local0.squadLocation, f23_local0.squadMemberIndex, f23_local0.classLocation, f23_local0.slot, f23_local0.weaponIndex ) + local f23_local2 = Cac.GetAttachmentTypeList( f23_local1 ) + local f23_local3 = Cac.GetAttachment( f23_local0.controller, f23_local0.squadLocation, f23_local0.squadMemberIndex, f23_local0.classLocation, f23_local0.slot, f23_local0.weaponIndex, f23_local0.attachIndex ) + local f23_local4 = {} + for f23_local11, f23_local12 in ipairs( f23_local2 ) do + local f23_local13 = Cac.GetAttachmentListByType( f23_local1, f23_local12 ) + for f23_local10 = 1, f23_arg0.elementsPerRow, 1 do + local f23_local8 = {} + if #f23_local13 < f23_local10 then + f23_local8 = { + type = "UIImage", + id = "attachment_selection_spacer_at_" .. f23_local10 + f23_local11 - 1 * f23_arg0.elementsPerRow, + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 70, + top = 0, + bottom = 70, + red = 0.1, + green = 0.1, + blue = 0.1, + alpha = 0 + } + } + } + else + local f23_local9 = f23_local13[f23_local10] + f23_local8 = { + type = "cac_attachment_button", + id = "attachment_selections_button_id_" .. f23_local10 + f23_local11 - 1 * f23_arg0.elementsPerRow, + listDefaultFocus = f23_local3 == f23_local9, + properties = { + image = RegisterMaterial( Cac.GetAttachmentImage( f23_local9, f23_local1 ) ), + attachItem = f23_local9, + weaponName = f23_local1, + unlockCost = Cac.getAttachmentCost( f23_local9, f23_local1 ), + currentAttachment = f23_local3, + muteAction = true, + additional_handlers = { + button_action = CacEditWeaponAttachChoose, + button_over = CacEditWeaponAttachButtonOver, + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + } + } + end + f23_local4[#f23_local4 + 1] = f23_local8 + end + end + return f23_local4 +end + +function attachment_grid() + local f24_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_weapon_attach_choose_main" ) + local f24_local1 = Engine.Localize( "@LUA_MENU_ATTACHMENT_ONE_CAPS" ) + if f24_local0.attachIndex == 1 then + f24_local1 = Engine.Localize( "@LUA_MENU_ATTACHMENT_TWO_CAPS" ) + elseif f24_local0.attachIndex == 2 then + f24_local1 = Engine.Localize( "@LUA_MENU_ATTACHMENT_THREE_CAPS" ) + end + return { + type = "UIElement", + id = "abilities_grid_container", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = Cac.Layout.AttachmentChooseDims.Grid.menu_left, + width = 675, + top = Cac.Layout.AttachmentChooseDims.Grid.menu_top, + bottom = 452 + } + }, + 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_titlebar", + id = "window_title", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = f24_local1, + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left, + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + id = "window_background", + properties = { + fill_alpha = 1 + } + }, + { + type = "UIVerticalList", + id = "attachments_grid_shades", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = GenericTitleBarDims.TitleBarHeight, + bottom = 0 + } + }, + childrenFeeder = AttachmentGridShadeFeeder + }, + { + type = "UIVerticalList", + id = "attachments_grid_text", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = GenericTitleBarDims.TitleBarHeight + 30, + bottom = 0, + spacing = Cac.Layout.AttachmentChooseDims.Grid.row_height - CoD.TextSettings.NormalFont.Height + } + }, + childrenFeeder = AttachmentGridTextFeeder + }, + { + type = "UIGrid", + id = "attachment_selection_grid_id", + focusable = true, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 37, + left = Cac.Layout.AttachmentChooseDims.Grid.text_space, + width = 430, + height = 330 + } + }, + properties = { + elementsPerRow = 6, + hSpacing = Cac.Layout.AttachmentChooseDims.Grid.horizontal_spacing, + rowHeight = Cac.Layout.AttachmentChooseDims.Grid.row_height, + hAlign = LUI.Alignment.Left, + vAlign = LUI.Alignment.Top + }, + childrenFeeder = AttachmentSelectionFeeder + } + } + } +end + +function CacEditWeaponAttachLeave( f25_arg0, f25_arg1 ) + local f25_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f25_arg0 ) + local f25_local1 = Cac.GetAttachment( f25_local0.controller, f25_local0.squadLocation, f25_local0.squadMemberIndex, f25_local0.classLocation, f25_local0.slot, f25_local0.weaponIndex, f25_local0.attachIndex ) + Cac.ValidateReticle( f25_local0.controller, f25_local0.squadLocation, f25_local0.squadMemberIndex, f25_local0.classLocation, f25_local0.slot, f25_local0.weaponIndex ) + f25_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f25_local0.controller, + dispatchChildren = true + } ) +end + +function cac_edit_weapon_attach_choose_main() + return { + type = "UIElement", + id = "cac_edit_weapon_attach_choose_main_id", + properties = { + squadLocation = "privateMatchSquadMembers", + squadMemberIndex = 0, + slot = 0, + classLocation = "loadouts", + weaponIndex = 0, + attachIndex = 0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_close = CacEditWeaponAttachLeave, + open_reticle_popup = function ( f27_arg0, f27_arg1 ) + LUI.FlowManager.RequestPopupMenu( f27_arg0, "cac_edit_choose_image_popup", true, f27_arg1.controller, true, f27_arg1.data, nil, nil, false ) + end + + }, + children = { + attachment_grid(), + attachment_decription(), + { + type = "generic_back_button", + handlers = { + button_secondary = function ( f28_arg0, f28_arg1 ) + local f28_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f28_arg0 ) + f28_arg0:dispatchEventToRoot( { + name = "unlock_attachments", + weaponIndex = f28_local0.weaponIndex + } ) + LUI.FlowManager.RequestLeaveMenu( f28_arg0 ) + end + + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "cac_edit_weapon_attach_choose_main", cac_edit_weapon_attach_choose_main ) +LUI.MenuBuilder.registerType( "cac_attachment_button", cac_attachment_button ) +LUI.MenuBuilder.registerDef( "cac_purchase_attach_popup", cac_purchase_attach_popup ) +LUI.MenuBuilder.registerDef( "cac_cant_purchase_attach_popup", cac_cant_purchase_attach_popup ) +LockTable( _M ) diff --git a/lui/mp_menus/caceditweaponperformanceinfopane.dec.lua b/lui/mp_menus/caceditweaponperformanceinfopane.dec.lua new file mode 100644 index 0000000..77e186d --- /dev/null +++ b/lui/mp_menus/caceditweaponperformanceinfopane.dec.lua @@ -0,0 +1,468 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function CacWeaponPerformance( f1_arg0, f1_arg1 ) + local f1_local0 = f1_arg0.properties + if f1_arg1 ~= "specialty_null" then + if f1_arg1 == "uav" then + f1_arg1 = "iw6_knifeonly" or f1_arg1 + end + if f1_arg1 == "laser_designator" then + f1_arg1 = "iw6_pdw" or f1_arg1 + end + local f1_local1 = f1_local0.CacWeaponPerformanceFunc( f1_local0.exclusiveController, Cac.StripSuffix( f1_arg1, "_mp" ) ) + if f1_local0.isDecimal then + if f1_local0.isPercent then + f1_arg0:setText( string.format( "%3.2f", f1_local1 ) .. "%" ) + else + f1_arg0:setText( string.format( "%3.2f", f1_local1 ) ) + end + else + f1_arg0:setText( string.format( "%d", f1_local1 ) ) + end + end +end + +function CacViewingWeaponPerformance( f2_arg0, f2_arg1 ) + if f2_arg1.viewingWeapon then + CacWeaponPerformance( f2_arg0, f2_arg1.viewingWeapon ) + end +end + +function CacEquippedWeaponPerformance( f3_arg0, f3_arg1 ) + local f3_local0 = nil + if f3_arg1.selection_id == "edit_lethal" or f3_arg1.selection_id == "edit_tactical" then + f3_local0 = Cac.GetPerk( f3_arg1.controller, f3_arg1.squadLocation, f3_arg1.squadMemberIndex, f3_arg1.classLocation, f3_arg1.slot, f3_arg1.weaponIndex ) + else + f3_local0 = Cac.GetWeapon( f3_arg1.controller, f3_arg1.squadLocation, f3_arg1.squadMemberIndex, f3_arg1.classLocation, f3_arg1.slot, f3_arg1.weaponIndex ) + end + if f3_local0 then + CacWeaponPerformance( f3_arg0, f3_local0 ) + end +end + +function CacPerformanceStatCompare( f4_arg0, f4_arg1 ) + local f4_local0 = nil + if f4_arg1.selection_id == "edit_lethal" or f4_arg1.selection_id == "edit_tactical" then + f4_local0 = Cac.GetPerk( f4_arg1.controller, f4_arg1.squadLocation, f4_arg1.squadMemberIndex, f4_arg1.classLocation, f4_arg1.slot, f4_arg1.weaponIndex ) + else + f4_local0 = Cac.GetWeapon( f4_arg1.controller, f4_arg1.squadLocation, f4_arg1.squadMemberIndex, f4_arg1.classLocation, f4_arg1.slot, f4_arg1.weaponIndex ) + end + if f4_arg1.viewingWeapon and f4_arg1.viewingWeapon ~= f4_local0 and f4_arg1.viewingWeapon ~= "specialty_null" then + f4_arg0:animateToState( "statcompare", 0 ) + else + f4_arg0:animateToState( "statview", 0 ) + end +end + +function cac_weapon_info_pane_performance_stat() + return { + type = "UIElement", + properties = { + statTitle = "Empty", + isPercent = false, + isDecimal = false, + shadeAlpha = 1, + CacWeaponPerformanceFunc = MBh.Property( "CacWeaponPerformanceFunc" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 25, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + refresh_info_pane = function ( f6_arg0, f6_arg1 ) + f6_arg0:dispatchEventToChildren( f6_arg1 ) + local f6_local0 = false + local f6_local1 = f6_arg0.properties.CacWeaponPerformanceFunc + local f6_local2 = nil + if f6_arg1.selection_id == "edit_weapon_primary" or f6_arg1.selection_id == "edit_weapon_secondary" then + local f6_local3 = f6_arg1.viewingWeapon + if not f6_local3 then + f6_local3 = Cac.GetWeapon( f6_arg1.controller, f6_arg1.squadLocation, f6_arg1.squadMemberIndex, f6_arg1.classLocation, f6_arg1.slot, f6_arg1.weaponIndex ) + end + f6_local2 = Cac.GetWeaponClass( f6_local3 ) + for f6_local7, f6_local8 in pairs( Cac.Weapons.weapon_riot ) do + if not f6_local0 then + f6_local0 = f6_local3 == f6_local8 + end + end + end + if not (not f6_local0 or f6_local1 ~= Cac.GetPerformanceHeadshots and f6_local1 ~= Cac.GetPerformanceAccuracy) or f6_local2 == "weapon_projectile" and f6_local1 == Cac.GetPerformanceHeadshots then + f6_arg0:animateToState( "hidden" ) + else + f6_arg0:animateToState( "default" ) + end + end + + }, + children = { + { + type = "UIImage", + id = "performance_stat_outline", + states = { + default = CoD.ColorizeState( Colors.white, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = MBh.Property( "shadeAlpha" ) + } ) + } + }, + { + type = "UIText", + properties = { + text = MBh.Property( "statTitle" ) + }, + states = { + default = { + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 10, + right = 180, + top = -0.5 * CoD.TextSettings.NormalFont.Height, + bottom = 0.5 * CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + red = Colors.window_title_text_color.r, + green = Colors.window_title_text_color.g, + blue = Colors.window_title_text_color.b + } + } + }, + { + type = "UIText", + properties = { + text = "100.00", + isDecimal = MBh.Property( "isDecimal" ), + CacWeaponPerformanceFunc = MBh.Property( "CacWeaponPerformanceFunc" ), + isPercent = MBh.Property( "isPercent" ) + }, + states = { + default = CoD.ColorizeState( Colors.cac_performance_header, { + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 200, + right = -110, + top = -0.5 * CoD.TextSettings.NormalFont.Height, + bottom = 0.5 * CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alpha = 0 + } ), + statcompare = { + alpha = 1 + }, + statview = { + alpha = 0 + } + }, + handlers = { + refresh_info_pane = MBh.DoMultiple( { + CacPerformanceStatCompare, + CacViewingWeaponPerformance + } ) + } + }, + { + type = "UIText", + properties = { + text = "0", + isDecimal = MBh.Property( "isDecimal" ), + CacWeaponPerformanceFunc = MBh.Property( "CacWeaponPerformanceFunc" ), + isPercent = MBh.Property( "isPercent" ) + }, + states = { + default = CoD.ColorizeState( Colors.cac_performance_header, { + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 299, + right = -10, + top = -0.5 * CoD.TextSettings.NormalFont.Height, + bottom = 0.5 * CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alpha = 0.5 + } ) + }, + handlers = { + refresh_info_pane = CacEquippedWeaponPerformance + } + } + } + } +end + +function weapon_performance_stats() + return { + type = "UIVerticalList", + id = "cac_weapon_info_pane_performance_stats", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 20, + bottom = 0 + } + }, + children = { + { + type = "cac_weapon_info_pane_performance_stat", + id = "weapon_stats_info_1", + properties = { + shadeAlpha = 0.1, + statTitle = Cac.WeaponPerformanceTypes.KDR.Title, + CacWeaponPerformanceFunc = Cac.GetPerformanceKDR, + isDecimal = true + } + }, + { + type = "cac_weapon_info_pane_performance_stat", + id = "weapon_stats_info_2", + properties = { + shadeAlpha = 0, + statTitle = Cac.WeaponPerformanceTypes.Kills.Title, + CacWeaponPerformanceFunc = Cac.GetPerformanceKills + } + }, + { + type = "cac_weapon_info_pane_performance_stat", + id = "weapon_stats_info_3", + properties = { + shadeAlpha = 0.1, + statTitle = Cac.WeaponPerformanceTypes.Deaths.Title, + CacWeaponPerformanceFunc = Cac.GetPerformanceDeaths + } + }, + { + type = "cac_weapon_info_pane_performance_stat", + id = "weapon_stats_info_4", + properties = { + shadeAlpha = 0, + statTitle = Cac.WeaponPerformanceTypes.Accuracy.Title, + isPercent = true, + isDecimal = true, + CacWeaponPerformanceFunc = Cac.GetPerformanceAccuracy + } + }, + { + type = "cac_weapon_info_pane_performance_stat", + id = "weapon_stats_info_5", + properties = { + shadeAlpha = 0.1, + statTitle = Cac.WeaponPerformanceTypes.Headshots.Title, + CacWeaponPerformanceFunc = Cac.GetPerformanceHeadshots + } + } + } + } +end + +function lethal_performance_stats() + return { + type = "UIVerticalList", + id = "cac_lethal_info_pane_performance_stats", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 20, + bottom = 0 + } + }, + children = { + { + type = "cac_weapon_info_pane_performance_stat", + id = "lethal_stats_info_1", + properties = { + shadeAlpha = 0.1, + statTitle = Cac.WeaponPerformanceTypes.Usage.Title, + CacWeaponPerformanceFunc = Cac.GetPerformanceShots + } + }, + { + type = "cac_weapon_info_pane_performance_stat", + id = "lethal_stats_info_2", + properties = { + shadeAlpha = 0, + statTitle = Cac.WeaponPerformanceTypes.Kills.Title, + CacWeaponPerformanceFunc = Cac.GetPerformanceKills + } + }, + { + type = "cac_weapon_info_pane_performance_stat", + id = "lethal_stats_info_3", + properties = { + shadeAlpha = 0.1, + statTitle = Cac.WeaponPerformanceTypes.Hits.Title, + CacWeaponPerformanceFunc = Cac.GetPerformanceHits + } + } + } + } +end + +function tactical_performance_stats() + return { + type = "UIVerticalList", + id = "cac_tactical_info_pane_performance_stats", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 20, + bottom = 0 + } + }, + children = { + { + type = "cac_weapon_info_pane_performance_stat", + id = "tactical_stats_info_1", + properties = { + shadeAlpha = 0, + statTitle = Cac.WeaponPerformanceTypes.Usage.Title, + CacWeaponPerformanceFunc = Cac.GetPerformanceShots + } + }, + { + type = "cac_weapon_info_pane_performance_stat", + id = "tactical_stats_info_2", + properties = { + shadeAlpha = 0.1, + statTitle = Cac.WeaponPerformanceTypes.Hits.Title, + CacWeaponPerformanceFunc = Cac.GetPerformanceHits + } + } + } + } +end + +function cac_weapon_info_pane_performance_page( f10_arg0 ) + return function () + return { + type = "cac_basic_info_pane_page", + id = "cac_basic_info_pane_page_" .. f10_arg0, + children = { + { + type = "UIImage", + id = "text_header_shade_id", + states = { + default = CoD.ColorizeState( Colors.black, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 20, + material = RegisterMaterial( "white" ), + alpha = 0.2 + } ) + } + }, + { + type = "UIText", + properties = { + text = Engine.Localize( "@LUA_MENU_VIEWING_CAPS" ) + }, + states = { + default = CoD.ColorizeState( Colors.cac_sub_popup_text, { + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = -110, + top = 0, + bottom = CoD.TextSettings.SmallFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alpha = 0 + } ), + statcompare = { + alpha = 1 + }, + statview = { + alpha = 0 + } + }, + handlers = { + refresh_info_pane = CacPerformanceStatCompare + } + }, + { + type = "UIText", + properties = { + text = Engine.Localize( "@LUA_MENU_EQUIPPED_CAPS" ) + }, + states = { + default = CoD.ColorizeState( Colors.cac_sub_popup_text, { + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = -10, + top = 0, + bottom = CoD.TextSettings.SmallFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alpha = 1 + } ) + } + }, + { + type = f10_arg0 + } + } + } + end + +end + +LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_performance_page", cac_weapon_info_pane_performance_page ) +LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_performance_stat", cac_weapon_info_pane_performance_stat ) +LUI.MenuBuilder.registerDef( "weapon_performance_stats", weapon_performance_stats ) +LUI.MenuBuilder.registerDef( "lethal_performance_stats", lethal_performance_stats ) +LUI.MenuBuilder.registerDef( "tactical_performance_stats", tactical_performance_stats ) +LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_performance_page_weapon", cac_weapon_info_pane_performance_page( "weapon_performance_stats" ) ) +LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_performance_page_lethal", cac_weapon_info_pane_performance_page( "lethal_performance_stats" ) ) +LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_performance_page_tactical", cac_weapon_info_pane_performance_page( "tactical_performance_stats" ) ) +LockTable( _M ) diff --git a/lui/mp_menus/caceditweaponstatsinfopane.dec.lua b/lui/mp_menus/caceditweaponstatsinfopane.dec.lua new file mode 100644 index 0000000..f06114d --- /dev/null +++ b/lui/mp_menus/caceditweaponstatsinfopane.dec.lua @@ -0,0 +1,602 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function CacEditWeaponStatsInfoMeter( f1_arg0, f1_arg1, f1_arg2 ) + local f1_local0 = Cac.Layout.CacWeaponMeter.offset_max * f1_arg1 / 100 + if f1_arg2 < 0 then + f1_local0 = LUI.clamp( f1_local0 + Cac.Layout.CacWeaponMeter.offset_max * f1_arg2 / 100, 0, Cac.Layout.CacWeaponMeter.offset_max ) + end + f1_arg0:registerAnimationState( "meter", { + right = f1_local0 + } ) + f1_arg0:animateToState( "meter", 100 ) +end + +function CacEditWeaponStatsInfoViewingMeter( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0.properties + local f2_local1 = nil + if f2_arg1.viewingWeapon then + f2_local1 = f2_arg1.viewingWeapon + else + f2_local1 = Cac.GetWeapon( f2_arg1.controller, f2_arg1.squadLocation, f2_arg1.squadMemberIndex, f2_arg1.classLocation, f2_arg1.slot, f2_arg1.weaponIndex ) + end + local f2_local2 = 0 + if f2_local1 then + f2_local2 = f2_local0.CacWeaponStatFunc( f2_local1 ) + if f2_local2 == nil or f2_local2 == "" then + f2_local2 = 0 + end + end + local f2_local3 = 0 + if not f2_arg1.viewingWeapon then + local f2_local4 = nil + if f2_arg1.viewingAttach0 then + f2_local4 = f2_arg1.viewingAttach0 + else + f2_local4 = Cac.GetAttachment( f2_arg1.controller, f2_arg1.squadLocation, f2_arg1.squadMemberIndex, f2_arg1.classLocation, f2_arg1.slot, f2_arg1.weaponIndex, 0 ) + end + local f2_local5 = nil + if f2_arg1.viewingAttach1 then + f2_local5 = f2_arg1.viewingAttach1 + else + f2_local5 = Cac.GetAttachment( f2_arg1.controller, f2_arg1.squadLocation, f2_arg1.squadMemberIndex, f2_arg1.classLocation, f2_arg1.slot, f2_arg1.weaponIndex, 1 ) + end + local f2_local6 = nil + if f2_arg1.viewingAttach2 then + f2_local6 = f2_arg1.viewingAttach2 + else + f2_local6 = Cac.GetAttachment( f2_arg1.controller, f2_arg1.squadLocation, f2_arg1.squadMemberIndex, f2_arg1.classLocation, f2_arg1.slot, f2_arg1.weaponIndex, 2 ) + end + if f2_local4 and f2_local4 ~= "none" then + f2_local3 = f2_local3 + f2_local0.CacWeaponAttachStatFunc( f2_local4, f2_local1 ) + end + if f2_local5 and f2_local5 ~= "none" then + f2_local3 = f2_local3 + f2_local0.CacWeaponAttachStatFunc( f2_local5, f2_local1 ) + end + if f2_local6 and f2_local6 ~= "none" then + f2_local3 = f2_local3 + f2_local0.CacWeaponAttachStatFunc( f2_local6, f2_local1 ) + end + end + CacEditWeaponStatsInfoMeter( f2_arg0, f2_local2, f2_local3 ) +end + +function CacEditWeaponStatsInfoEquippedMeter( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0.properties + local f3_local1 = Cac.GetWeapon( f3_arg1.controller, f3_arg1.squadLocation, f3_arg1.squadMemberIndex, f3_arg1.classLocation, f3_arg1.slot, f3_arg1.weaponIndex ) + if f3_local1 then + local f3_local2 = f3_local0.CacWeaponStatFunc( f3_local1 ) + if f3_local2 == nil or f3_local2 == "" then + f3_local2 = 0 + end + local f3_local3 = Cac.GetAttachment( f3_arg1.controller, f3_arg1.squadLocation, f3_arg1.squadMemberIndex, f3_arg1.classLocation, f3_arg1.slot, f3_arg1.weaponIndex, 0 ) + local f3_local4 = Cac.GetAttachment( f3_arg1.controller, f3_arg1.squadLocation, f3_arg1.squadMemberIndex, f3_arg1.classLocation, f3_arg1.slot, f3_arg1.weaponIndex, 1 ) + local f3_local5 = Cac.GetAttachment( f3_arg1.controller, f3_arg1.squadLocation, f3_arg1.squadMemberIndex, f3_arg1.classLocation, f3_arg1.slot, f3_arg1.weaponIndex, 2 ) + local f3_local6 = 0 + if f3_local3 and f3_local3 ~= "none" then + f3_local6 = f3_local6 + f3_local0.CacWeaponAttachStatFunc( f3_local3, f3_local1 ) + end + if f3_local4 and f3_local4 ~= "none" then + f3_local6 = f3_local6 + f3_local0.CacWeaponAttachStatFunc( f3_local4, f3_local1 ) + end + if f3_local5 and f3_local5 ~= "none" then + f3_local6 = f3_local6 + f3_local0.CacWeaponAttachStatFunc( f3_local5, f3_local1 ) + end + CacEditWeaponStatsInfoMeter( f3_arg0, f3_local2, f3_local6 ) + end +end + +function CacEditWeaponStatsInfoAttachmentMeter( f4_arg0, f4_arg1, f4_arg2, f4_arg3, f4_arg4 ) + local f4_local0 = Colors.cac_weapon_meter_main.r + local f4_local1 = Colors.cac_weapon_meter_main.g + local f4_local2 = Colors.cac_weapon_meter_main.b + local f4_local3 = 1 + local f4_local4 = LUI.clamp( Cac.Layout.CacWeaponMeter.offset_max * f4_arg1 / 100, 0, Cac.Layout.CacWeaponMeter.offset_max ) + if f4_arg2 < 0 then + if f4_arg4 then + f4_local0 = Colors.cac_weapon_meter_worse_dark.r + f4_local1 = Colors.cac_weapon_meter_worse_dark.g + f4_local2 = Colors.cac_weapon_meter_worse_dark.b + else + f4_local0 = Colors.cac_weapon_meter_worse.r + f4_local1 = Colors.cac_weapon_meter_worse.g + f4_local2 = Colors.cac_weapon_meter_worse.b + end + f4_local3 = 1 + elseif f4_arg2 > 0 then + if f4_arg4 then + f4_local0 = Colors.cac_weapon_meter_better_dark.r + f4_local1 = Colors.cac_weapon_meter_better_dark.g + f4_local2 = Colors.cac_weapon_meter_better_dark.b + else + f4_local0 = Colors.cac_weapon_meter_better.r + f4_local1 = Colors.cac_weapon_meter_better.g + f4_local2 = Colors.cac_weapon_meter_better.b + end + f4_local3 = 1 + f4_local4 = LUI.clamp( f4_local4 + Cac.Layout.CacWeaponMeter.offset_max * f4_arg2 / 100, 0, Cac.Layout.CacWeaponMeter.offset_max ) + else + f4_local3 = 0 + end + f4_arg0:registerAnimationState( "meter", { + right = f4_local4, + red = f4_local0, + green = f4_local1, + blue = f4_local2, + alpha = f4_local3 + } ) + f4_arg0:animateToState( "meter", 100 ) + local f4_local5 = f4_arg0:getChildById( "generic_border_id" ) + if f4_local5 then + f4_local5:registerAnimationState( "meter", { + alpha = 1 + } ) + end +end + +function CacEditWeaponStatsInfoViewingAttachmentMeter( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0.properties + local f5_local1, f5_local2 = nil + if f5_arg1.viewingWeapon then + f5_local1 = f5_arg1.viewingWeapon + f5_local2 = Cac.GetWeapon( f5_arg1.controller, f5_arg1.squadLocation, f5_arg1.squadMemberIndex, f5_arg1.classLocation, f5_arg1.slot, f5_arg1.weaponIndex ) + else + f5_local1 = Cac.GetWeapon( f5_arg1.controller, f5_arg1.squadLocation, f5_arg1.squadMemberIndex, f5_arg1.classLocation, f5_arg1.slot, f5_arg1.weaponIndex ) + end + local f5_local3 = 0 + if f5_local1 then + f5_local3 = f5_local0.CacWeaponStatFunc( f5_local1 ) + if f5_local3 == nil or f5_local3 == "" then + f5_local3 = 0 + end + end + local f5_local4 = nil + if f5_local2 then + f5_local4 = f5_local0.CacWeaponStatFunc( f5_local2 ) + if f5_local4 == nil or f5_local4 == "" then + f5_local4 = 0 + end + end + local f5_local5 = nil + if f5_arg1.viewingAttach0 then + f5_local5 = f5_arg1.viewingAttach0 + else + f5_local5 = Cac.GetAttachment( f5_arg1.controller, f5_arg1.squadLocation, f5_arg1.squadMemberIndex, f5_arg1.classLocation, f5_arg1.slot, f5_arg1.weaponIndex, 0 ) + end + local f5_local6 = nil + if f5_arg1.viewingAttach1 then + f5_local6 = f5_arg1.viewingAttach1 + else + f5_local6 = Cac.GetAttachment( f5_arg1.controller, f5_arg1.squadLocation, f5_arg1.squadMemberIndex, f5_arg1.classLocation, f5_arg1.slot, f5_arg1.weaponIndex, 1 ) + end + local f5_local7 = nil + if f5_arg1.viewingAttach2 then + f5_local7 = f5_arg1.viewingAttach2 + else + f5_local7 = Cac.GetAttachment( f5_arg1.controller, f5_arg1.squadLocation, f5_arg1.squadMemberIndex, f5_arg1.classLocation, f5_arg1.slot, f5_arg1.weaponIndex, 2 ) + end + local f5_local8 = 0 + if f5_local5 and f5_local5 ~= "none" then + f5_local8 = f5_local8 + f5_local0.CacWeaponAttachStatFunc( f5_local5, f5_local1 ) + end + if f5_local6 and f5_local6 ~= "none" then + f5_local8 = f5_local8 + f5_local0.CacWeaponAttachStatFunc( f5_local6, f5_local1 ) + end + if f5_local7 and f5_local7 ~= "none" then + f5_local8 = f5_local8 + f5_local0.CacWeaponAttachStatFunc( f5_local7, f5_local1 ) + end + CacEditWeaponStatsInfoAttachmentMeter( f5_arg0, f5_local3, f5_local8, f5_local4 ) +end + +function CacEditWeaponStatsInfoEquippedAttachmentMeter( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0.properties + local f6_local1 = Cac.GetWeapon( f6_arg1.controller, f6_arg1.squadLocation, f6_arg1.squadMemberIndex, f6_arg1.classLocation, f6_arg1.slot, f6_arg1.weaponIndex ) + if f6_local1 then + local f6_local2 = f6_local0.CacWeaponStatFunc( f6_local1 ) + if f6_local2 == nil or f6_local2 == "" then + f6_local2 = 0 + end + local f6_local3 = Cac.GetAttachment( f6_arg1.controller, f6_arg1.squadLocation, f6_arg1.squadMemberIndex, f6_arg1.classLocation, f6_arg1.slot, f6_arg1.weaponIndex, 0 ) + local f6_local4 = Cac.GetAttachment( f6_arg1.controller, f6_arg1.squadLocation, f6_arg1.squadMemberIndex, f6_arg1.classLocation, f6_arg1.slot, f6_arg1.weaponIndex, 1 ) + local f6_local5 = Cac.GetAttachment( f6_arg1.controller, f6_arg1.squadLocation, f6_arg1.squadMemberIndex, f6_arg1.classLocation, f6_arg1.slot, f6_arg1.weaponIndex, 2 ) + local f6_local6 = 0 + if f6_local3 and f6_local3 ~= "none" then + f6_local6 = f6_local6 + f6_local0.CacWeaponAttachStatFunc( f6_local3, f6_local1 ) + end + if f6_local4 and f6_local4 ~= "none" then + f6_local6 = f6_local6 + f6_local0.CacWeaponAttachStatFunc( f6_local4, f6_local1 ) + end + if f6_local5 and f6_local5 ~= "none" then + f6_local6 = f6_local6 + f6_local0.CacWeaponAttachStatFunc( f6_local5, f6_local1 ) + end + CacEditWeaponStatsInfoAttachmentMeter( f6_arg0, f6_local2, f6_local6, nil, true ) + end +end + +function CacWeaponStatCompare( f7_arg0, f7_arg1 ) + if f7_arg1.viewingWeapon then + f7_arg0:animateToState( "statcompare", 0 ) + else + f7_arg0:animateToState( "statview", 0 ) + end +end + +function cac_weapon_info_pane_stat() + return { + type = "UIElement", + properties = { + statTitle = "Title", + CacWeaponStatFunc = MBh.Property( "CacWeaponStatFunc" ), + CacWeaponAttachStatFunc = MBh.Property( "CacWeaponAttachStatFunc" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 50, + right = 0, + top = 0, + bottom = 30 + } + }, + children = { + { + type = "UIVerticalList", + properties = { + statTitle = MBh.Property( "statTitle" ), + CacWeaponStatFunc = MBh.Property( "CacWeaponStatFunc" ), + CacWeaponAttachStatFunc = MBh.Property( "CacWeaponAttachStatFunc" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 4, + right = 0, + top = 2, + bottom = 0, + spacing = 1 + }, + statcompare = { + spacing = 1 + }, + statview = { + spacing = 9 + } + }, + handlers = { + refresh_info_pane = CacWeaponStatCompare + }, + children = { + { + type = "UIHorizontalList", + id = "viewing_meter", + properties = { + CacWeaponStatFunc = MBh.Property( "CacWeaponStatFunc" ), + CacWeaponAttachStatFunc = MBh.Property( "CacWeaponAttachStatFunc" ), + statTitle = MBh.Property( "statTitle" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 14, + spacing = 12 + } + }, + children = { + { + type = "UIText", + properties = { + text = MBh.Property( "statTitle" ), + statTitle = MBh.Property( "statTitle" ) + }, + states = { + default = { + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 97, + top = -0.5 * CoD.TextSettings.SmallFont.Height + 4, + bottom = 0.5 * CoD.TextSettings.SmallFont.Height + 4, + font = CoD.TextSettings.SmallFont.Font, + red = Colors.cac_sub_popup_text.r, + green = Colors.cac_sub_popup_text.g, + blue = Colors.cac_sub_popup_text.b, + alpha = 1 + } + }, + handlers = { + refresh_info_pane = CacViewingMeterText + } + }, + { + type = "UIElement", + id = "large_meter_id", + properties = { + CacWeaponStatFunc = MBh.Property( "CacWeaponStatFunc" ), + CacWeaponAttachStatFunc = MBh.Property( "CacWeaponAttachStatFunc" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UIImage", + properties = { + CacWeaponStatFunc = MBh.Property( "CacWeaponStatFunc" ), + CacWeaponAttachStatFunc = MBh.Property( "CacWeaponAttachStatFunc" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = Cac.Layout.CacWeaponMeter.left, + right = Cac.Layout.CacWeaponMeter.left, + top = Cac.Layout.CacWeaponMeter.top, + bottom = Cac.Layout.CacWeaponMeter.bottom, + material = RegisterMaterial( "white" ), + red = Colors.cac_weapon_meter_main.r, + green = Colors.cac_weapon_meter_main.g, + blue = Colors.cac_weapon_meter_main.b, + alpha = 1 + }, + statcompare = { + alpha = 0 + }, + statview = { + alpha = 1 + } + }, + handlers = { + refresh_info_pane = MBh.DoMultiple( { + CacEditWeaponStatsInfoViewingAttachmentMeter, + CacWeaponStatCompare + } ) + } + }, + { + type = "UIImage", + id = "large_front_bar_id", + properties = { + CacWeaponStatFunc = MBh.Property( "CacWeaponStatFunc" ), + CacWeaponAttachStatFunc = MBh.Property( "CacWeaponAttachStatFunc" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = Cac.Layout.CacWeaponMeter.left, + right = Cac.Layout.CacWeaponMeter.left, + top = Cac.Layout.CacWeaponMeter.top, + bottom = Cac.Layout.CacWeaponMeter.bottom, + material = RegisterMaterial( "white" ), + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + } + }, + handlers = { + refresh_info_pane = CacEditWeaponStatsInfoViewingMeter + } + } + } + } + } + }, + { + type = "UIHorizontalList", + id = "equipped_meter", + properties = { + CacWeaponStatFunc = MBh.Property( "CacWeaponStatFunc" ), + CacWeaponAttachStatFunc = MBh.Property( "CacWeaponAttachStatFunc" ), + statTitle = MBh.Property( "statTitle" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 109, + right = 0, + top = 0, + bottom = 6, + spacing = 12 + }, + statcompare = { + alpha = 1 + }, + statview = { + alpha = 0 + } + }, + handlers = { + refresh_info_pane = CacWeaponStatCompare + }, + children = { + { + type = "UIElement", + id = "equipped_select_overflow_meter", + properties = { + CacWeaponStatFunc = MBh.Property( "CacWeaponStatFunc" ), + CacWeaponAttachStatFunc = MBh.Property( "CacWeaponAttachStatFunc" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UIImage", + properties = { + CacWeaponStatFunc = MBh.Property( "CacWeaponStatFunc" ), + CacWeaponAttachStatFunc = MBh.Property( "CacWeaponAttachStatFunc" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = Cac.Layout.CacWeaponMeter.left, + right = Cac.Layout.CacWeaponMeter.left, + top = 0, + bottom = -Cac.Layout.CacWeaponMeter.bottom, + material = RegisterMaterial( "white" ), + red = Colors.cac_weapon_meter_main.r, + green = Colors.cac_weapon_meter_main.g, + blue = Colors.cac_weapon_meter_main.b, + alpha = 1 + } + }, + handlers = { + refresh_info_pane = CacEditWeaponStatsInfoEquippedAttachmentMeter + } + }, + { + type = "UIImage", + properties = { + CacWeaponStatFunc = MBh.Property( "CacWeaponStatFunc" ), + CacWeaponAttachStatFunc = MBh.Property( "CacWeaponAttachStatFunc" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = Cac.Layout.CacWeaponMeter.left, + right = Cac.Layout.CacWeaponMeter.left, + top = 0, + bottom = -Cac.Layout.CacWeaponMeter.bottom, + material = RegisterMaterial( "white" ), + red = Cac.Swatches.highlight.r, + green = Cac.Swatches.highlight.g, + blue = Cac.Swatches.highlight.b, + alpha = 1 + } + }, + handlers = { + refresh_info_pane = CacEditWeaponStatsInfoEquippedMeter + } + } + } + } + } + } + } + } + } + } +end + +function cac_weapon_info_pane_stats_page() + return { + type = "cac_basic_info_pane_page", + children = { + { + type = "UIVerticalList", + id = "cac_weapon_info_pane_stats", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 2, + bottom = 0, + spacing = 0 + } + }, + children = { + { + type = "cac_weapon_info_pane_stat", + id = "weapon_stats_info_1", + properties = { + statTitle = Cac.WeaponStatTypes.Accuracy.Title, + CacWeaponStatFunc = Cac.GetWeaponAccuracy, + CacWeaponAttachStatFunc = Cac.GetAttachmentAccuracy + } + }, + { + type = "cac_weapon_info_pane_stat", + id = "weapon_stats_info_2", + properties = { + statTitle = Cac.WeaponStatTypes.Damage.Title, + CacWeaponStatFunc = Cac.GetWeaponDamage, + CacWeaponAttachStatFunc = Cac.GetAttachmentDamage + } + }, + { + type = "cac_weapon_info_pane_stat", + id = "weapon_stats_info_3", + properties = { + statTitle = Cac.WeaponStatTypes.Range.Title, + CacWeaponStatFunc = Cac.GetWeaponRange, + CacWeaponAttachStatFunc = Cac.GetAttachmentRange + } + }, + { + type = "cac_weapon_info_pane_stat", + id = "weapon_stats_info_4", + properties = { + statTitle = Cac.WeaponStatTypes.FireRate.Title, + CacWeaponStatFunc = Cac.GetWeaponFireRate, + CacWeaponAttachStatFunc = Cac.GetAttachmentFireRate + } + }, + { + type = "cac_weapon_info_pane_stat", + id = "weapon_stats_info_5", + properties = { + statTitle = Cac.WeaponStatTypes.Mobility.Title, + CacWeaponStatFunc = Cac.GetWeaponMobility, + CacWeaponAttachStatFunc = Cac.GetAttachmentMobility + } + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_stats_page", cac_weapon_info_pane_stats_page ) +LUI.MenuBuilder.registerDef( "cac_weapon_info_pane_stat", cac_weapon_info_pane_stat ) +LockTable( _M ) diff --git a/lui/mp_menus/cacinfopanes.dec.lua b/lui/mp_menus/cacinfopanes.dec.lua new file mode 100644 index 0000000..01dbdfb --- /dev/null +++ b/lui/mp_menus/cacinfopanes.dec.lua @@ -0,0 +1,740 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function cac_weapon_stats_full_pane() + return { + type = "UIElement", + id = "cac_weapon_stats_full_pane_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0 + }, + hidden = { + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + children = { + { + type = "cac_basic_info_pane_header", + id = "cac_info_pane_header_stats", + properties = { + titleText = Engine.Localize( "LUA_MENU_WEAPON_STATS_CAPS" ) + } + }, + { + type = "cac_basic_info_pane_background" + }, + { + type = "cac_weapon_info_pane_stats_page", + id = "cac_weapon_info_pane_stats" + } + } + } +end + +function cac_performance_stats_full_pane( f2_arg0 ) + return function () + return { + type = "UIElement", + id = "cac_performance_stats_full_pane_" .. f2_arg0, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0 + }, + hidden = { + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + refresh_info_pane = function ( f4_arg0, f4_arg1 ) + if f4_arg1.selection_id == "edit_lethal" and f2_arg0 == "cac_weapon_info_pane_performance_page_lethal" then + local f4_local0 = false + for f4_local9, f4_local10 in pairs( Cac.Indices.Weapons ) do + local f4_local4 + if f4_local10 == Cac.Indices.Weapons.Primary then + f4_local4 = 2 + if not f4_local4 then + + else + for f4_local5 = 0, f4_local4, 1 do + local f4_local8 = Cac.GetAttachment( f4_arg1.controller, f4_arg1.squadLocation, f4_arg1.squadMemberIndex, f4_arg1.classLocation, f4_arg1.slot, f4_local10, f4_local5 ) + if f4_local8 == "shotgun" or f4_local8 == "gl" then + f4_arg0:animateToState( "hidden" ) + f4_local0 = true + end + end + end + end + f4_local4 = 1 + end + if not f4_local0 then + f4_arg0:animateToState( "visible" ) + end + end + end + + }, + children = { + { + type = "cac_basic_info_pane_header", + id = "cac_info_pane_header_performance", + properties = { + titleText = Engine.Localize( "LUA_MENU_PERFORMANCE_CAPS" ) + } + }, + { + type = "cac_basic_info_pane_background" + }, + { + type = f2_arg0, + id = "cac_weapon_info_performance_stats" + } + } + } + end + +end + +function CacRefreshInfoPaneHeaderTitle( f5_arg0, f5_arg1 ) + if f5_arg1.header ~= nil then + f5_arg0:setText( f5_arg1.header ) + end +end + +function cac_basic_info_pane_background() + return { + type = "generic_menu_background_withfade", + properties = { + fade_height = 100, + shadow_alpha = Cac.Swatches.Alphas.cac_panel_background_shadow, + top_offset = Cac.Layout.InfoPane.header_height - 1 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = 180 + } + } + } +end + +function cac_basic_info_pane_header( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg1.titleText or "" + local f7_local1 = f7_arg1.backgroundAlpha or 1 + local f7_local2 = f7_arg1.width + if not f7_local2 then + f7_local2 = Cac.Layout.CacEditPanel.right - Cac.Layout.CacEditPanel.left + end + local f7_local3 = f7_arg1.height + if not f7_local3 then + f7_local3 = Cac.Layout.InfoPane.header_height + end + local f7_local4 = Engine.IsConsoleGame() + if not f7_local4 then + f7_local4 = 1 == Engine.IsGamepadEnabled() + end + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = f7_local2, + height = f7_local3 + } ) + self:animateToState( "default" ) + local f7_local6 = LUI.MenuGenerics.generic_menu_background( {}, { + hide_bottom = true + } ) + f7_local6:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = f7_local3 + } ) + f7_local6:animateToState( "default" ) + self:addElement( f7_local6 ) + local f7_local7 = LUI.UIText.new() + f7_local7.id = "info_pane_header_text" + f7_local7:setText( f7_local0 ) + f7_local7:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + height = CoD.TextSettings.BoldFont.Height, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.BoldFont.Font, + red = Colors.window_title_text_color.r, + green = Colors.window_title_text_color.g, + blue = Colors.window_title_text_color.b + } ) + f7_local7:animateToState( "default" ) + f7_local7:registerEventHandler( "menu_create", CacRefreshInfoPaneHeaderTitle ) + f7_local7:registerEventHandler( "refresh_info_pane_header", CacRefreshInfoPaneHeaderTitle ) + self:addElement( f7_local7 ) + local f7_local8 + if f7_local4 then + f7_local8 = 40 + if not f7_local8 then + + else + local f7_local9 + if f7_local4 then + f7_local9 = 20 + if not f7_local9 then + + else + if IsOnlineMatch() then + local f7_local10 = LUI.UIButton.new() + f7_local10.id = "info_pane_header_page_lt_btn" + f7_local10.m_requireFocusType = FocusType.MouseOver + f7_local10:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 5, + width = f7_local8, + height = f7_local9, + alpha = 0 + } ) + f7_local10:registerAnimationState( "visible", { + alpha = 1 + } ) + f7_local10:animateToState( "default" ) + f7_local10:registerEventHandler( "show_lt", MBh.AnimateToState( "visible" ) ) + f7_local10:registerEventHandler( "hide_lt", MBh.AnimateToState( "default" ) ) + f7_local10:registerEventHandler( "button_action", MBh.EmitEventToParent( "info_panel_go_left" ) ) + f7_local10:registerEventHandler( "popup_active", nil ) + self:addElement( f7_local10 ) + local f7_local11 = nil + if f7_local4 then + f7_local11 = LUI.UIText.new() + f7_local11:setText( Engine.Localize( ButtonMap.button_shoulderl.string ) ) + f7_local11:registerAnimationState( "default", { + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.ExtraBigFont.Font, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + left = 0, + right = 0 + } ) + else + f7_local11 = LUI.UIImage.new() + f7_local11:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = f7_local8, + right = -f7_local8, + material = RegisterMaterial( "widg_lobby_arrow" ) + } ) + end + f7_local11:animateToState( "default" ) + f7_local10:addElement( f7_local11 ) + local f7_local12 = LUI.UIButton.new() + f7_local12.id = "info_pane_header_page_rt_btn" + f7_local12.m_requireFocusType = FocusType.MouseOver + f7_local12:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + right = -5, + width = f7_local8, + height = f7_local9, + alpha = 0 + } ) + f7_local12:registerAnimationState( "visible", { + alpha = 1 + } ) + f7_local12:animateToState( "default" ) + f7_local12:registerEventHandler( "show_rt", MBh.AnimateToState( "visible" ) ) + f7_local12:registerEventHandler( "hide_rt", MBh.AnimateToState( "default" ) ) + f7_local12:registerEventHandler( "button_action", MBh.EmitEventToParent( "info_panel_go_right" ) ) + f7_local12:registerEventHandler( "popup_active", nil ) + self:addElement( f7_local12 ) + local f7_local13 = nil + if f7_local4 then + f7_local13 = LUI.UIText.new() + f7_local13:setText( Engine.Localize( ButtonMap.button_shoulderr.string ) ) + f7_local13:registerAnimationState( "default", { + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.ExtraBigFont.Font, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + left = 0, + right = 0 + } ) + else + f7_local13 = LUI.UIImage.new() + f7_local13:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "widg_lobby_arrow" ) + } ) + end + f7_local13:animateToState( "default" ) + f7_local12:addElement( f7_local13 ) + end + return self + end + end + f7_local9 = 16 + end + end + f7_local8 = 16 +end + +function cac_abilities_perks_info_pane_header() + return { + type = "UIElement", + properties = { + titleText = "Title", + header_height = GenericButtonDims.button_height, + left_cap_width = GenericButtonDims.button_height, + right_cap_width = 4 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 1, + right = -1, + top = 0, + bottom = MBh.Property( "header_height" ) + } + }, + children = { + { + type = "UIElement", + id = "choose_item_box_header_container_id", + properties = { + left_cap_width = MBh.Property( "left_cap_width" ), + right_cap_width = MBh.Property( "right_cap_width" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -4, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UIImage", + id = "lefty_cap", + properties = { + left_cap_width = MBh.Property( "left_cap_width" ) + }, + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = MBh.Property( "left_cap_width" ), + top = 0, + bottom = 0, + red = 0.3, + green = 0.3, + blue = 0.3, + alpha = 0.5 + } + } + }, + { + type = "UIImage", + id = "middy_seg", + properties = { + left_cap_width = MBh.Property( "left_cap_width" ), + right_cap_width = MBh.Property( "right_cap_width" ) + }, + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = MBh.Property( "left_cap_width" ), + right = MBh.Property( "right_cap_width" ), + top = 0, + bottom = 0, + red = 0.3, + green = 0.3, + blue = 0.3, + alpha = 0.5 + } + } + } + } + }, + { + type = "UIText", + id = "info_pane_header_text", + properties = { + text = MBh.Property( "titleText" ), + button_text_indent = 30 + }, + states = { + default = { + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = MBh.Property( "button_text_indent" ), + right = 0, + top = -0.5 * CoD.TextSettings.BoldFont.Height, + bottom = 0.5 * CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + red = Colors.window_title_text_color.r, + green = Colors.window_title_text_color.g, + blue = Colors.window_title_text_color.b + } + }, + handlers = { + menu_create = CacRefreshInfoPaneHeaderTitle, + refresh_info_pane_header = CacRefreshInfoPaneHeaderTitle + } + } + } + } +end + +function cac_basic_info_pane_page() + return { + type = "UIElement", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 1, + right = -1, + top = Cac.Layout.InfoPane.header_height, + bottom = Cac.Layout.InfoPane.height + } + } + } +end + +function InfoPaneHandleRightBumper( f10_arg0, f10_arg1 ) + assert( f10_arg0.properties.selection_id ) + assert( f10_arg0.properties.currentPaneIndex ) + assert( f10_arg0.properties.currentPaneId ) + assert( f10_arg0.properties.InfoPaneMap[f10_arg0.properties.selection_id] ) + local f10_local0 = f10_arg0.properties.selection_id + local f10_local1 = f10_arg0.properties.currentPaneIndex + local f10_local2 = f10_arg0.properties.currentPaneId + local f10_local3 = f10_arg0.properties.InfoPaneMap[f10_arg0.properties.selection_id] + if #f10_local3 >= 1 then + local f10_local4 = f10_local1 + 1 + if #f10_local3 < f10_local4 then + f10_local4 = 1 + end + f10_arg0.properties.currentPaneIndex = f10_local4 + f10_arg0.properties.currentPaneId = f10_local3[f10_local4] .. "_id" + f10_arg0.properties.LastOpenPane[f10_local0] = f10_local4 + f10_arg0:dispatchEventToRoot( { + name = "refresh_info_pane_view", + immediate = true + } ) + end +end + +function InfoPaneHandleLeftBumper( f11_arg0, f11_arg1 ) + assert( f11_arg0.properties.selection_id ) + assert( f11_arg0.properties.currentPaneIndex ) + assert( f11_arg0.properties.currentPaneId ) + assert( f11_arg0.properties.InfoPaneMap[f11_arg0.properties.selection_id] ) + local f11_local0 = f11_arg0.properties.selection_id + local f11_local1 = f11_arg0.properties.currentPaneIndex + local f11_local2 = f11_arg0.properties.currentPaneId + local f11_local3 = f11_arg0.properties.InfoPaneMap[f11_arg0.properties.selection_id] + if #f11_local3 >= 1 then + local f11_local4 = f11_local1 - 1 + if f11_local4 <= 0 then + f11_local4 = #f11_local3 + end + f11_arg0.properties.currentPaneIndex = f11_local4 + f11_arg0.properties.currentPaneId = f11_local3[f11_local4] .. "_id" + f11_arg0.properties.LastOpenPane[f11_local0] = f11_local4 + f11_arg0:dispatchEventToRoot( { + name = "refresh_info_pane_view", + immediate = true + } ) + end +end + +function UpdateSelectionId( f12_arg0, f12_arg1 ) + assert( f12_arg1.selection_id ) + assert( f12_arg1.classLocation ) + assert( f12_arg1.slot ) + assert( f12_arg1.controller ) + assert( f12_arg0.properties.InfoPaneMap[f12_arg1.selection_id] ) + assert( f12_arg0.properties.PaneList ) + assert( f12_arg0.properties.currentPaneId ) + assert( f12_arg0.properties.selection_id ) + local f12_local0 = f12_arg1.selection_id + f12_arg0.properties.selection_id = f12_local0 + local f12_local1 = f12_arg0.properties.currentPaneId + local f12_local2 = f12_arg0.properties.InfoPaneMap[f12_arg1.selection_id] + local f12_local3 = f12_arg0.properties.PaneList + local f12_local4 = true + for f12_local5 = 1, #f12_local3, 1 do + local f12_local8 = f12_local3[f12_local5] + local f12_local9 = f12_local3[f12_local5] .. "_id" + local f12_local10 = false + local f12_local11 = 0 + for f12_local12 = 1, #f12_local2, 1 do + if f12_local3[f12_local5] == f12_local2[f12_local12] then + f12_local10 = true + f12_local11 = f12_local12 + break + end + end + local f12_local12 = f12_arg0:getChildById( f12_local9 ) + if f12_local10 then + if f12_local12 ~= nil and f12_local12.id == f12_local1 then + f12_local4 = false + f12_arg0.properties.LastOpenPane[f12_local0] = f12_local11 + end + if f12_local12 == nil then + local f12_local14 = LUI.MenuBuilder.buildMenu( f12_local8, { + exclusiveController = f12_arg0.properties.exclusiveController + } ) + f12_local14.id = f12_local9 + f12_arg0:addElement( f12_local14 ) + end + end + if f12_local12 then + f12_local12:close() + end + end + if f12_local4 then + if #f12_local2 >= 1 then + f12_arg0.properties.currentPaneIndex = f12_arg0.properties.LastOpenPane[f12_local0] + f12_arg0.properties.currentPaneId = f12_local2[f12_arg0.properties.currentPaneIndex] .. "_id" + f12_arg0:dispatchEventToRoot( { + name = "refresh_info_pane_view", + immediate = true + } ) + else + f12_arg0.properties.currentPaneIndex = 0 + f12_arg0.properties.currentPaneId = "" + end + end +end + +function refreshInfoPaneView( f13_arg0, f13_arg1 ) + assert( f13_arg0.properties.selection_id ) + assert( f13_arg0.properties.currentPaneIndex ) + assert( f13_arg0.properties.currentPaneId ) + assert( f13_arg0.properties.InfoPaneMap[f13_arg0.properties.selection_id] ) + local f13_local0 = f13_arg0.properties.selection_id + local f13_local1 = f13_arg0.properties.currentPaneIndex + local f13_local2 = f13_arg0.properties.currentPaneId + local f13_local3 = f13_arg0.properties.InfoPaneMap[f13_arg0.properties.selection_id] + for f13_local4 = 1, #f13_local3, 1 do + local f13_local7 = f13_local3[f13_local4] .. "_id" + local f13_local8 = f13_arg0:getChildById( f13_local7 ) + if f13_local8 then + if f13_local7 == f13_local2 then + f13_local8:animateToState( "visible", 0 ) + f13_local8.m_ignoreMouseFocus = nil + else + f13_local8:animateToState( "default", 0 ) + f13_local8.m_ignoreMouseFocus = true + end + end + end +end + +function ReEnable( f14_arg0, f14_arg1 ) + f14_arg0:processEvent( { + name = "enable" + } ) +end + +function cac_basic_info_pane_container() + local f15_local0 = { + "cac_weapon_stats_full_pane", + "cac_performance_stats_full_pane_weapon" + } + local f15_local1 = { + "cac_performance_stats_full_pane_lethal" + } + local f15_local2 = { + "cac_performance_stats_full_pane_tactical" + } + if not IsOnlineMatch() or Engine.GetDvarBool( "xblive_privatematch" ) then + f15_local0 = { + "cac_weapon_stats_full_pane" + } + f15_local1 = {} + f15_local2 = {} + end + return { + type = "UIBindButton", + properties = { + selection_id = "edit_weapon_primary", + slot = 0, + classLocation = "", + currentPaneIndex = 1, + currentPaneId = "", + InfoPaneMap = { + edit_weapon_primary = f15_local0, + edit_weapon_primary_attach1 = f15_local0, + edit_weapon_primary_attach2 = f15_local0, + edit_weapon_primary_attach3 = f15_local0, + edit_weapon_primary_camo = f15_local0, + edit_weapon_primary_reticle = f15_local0, + edit_weapon_secondary = f15_local0, + edit_weapon_secondary_attach = f15_local0, + edit_weapon_secondary_attach1 = f15_local0, + edit_weapon_secondary_attach2 = f15_local0, + edit_lethal = f15_local1, + edit_tactical = f15_local2, + edit_killstreaks = {}, + edit_abilities = {}, + edit_perk1 = {}, + edit_perk2 = {}, + edit_perk3 = {} + }, + LastOpenPane = { + edit_weapon_primary = 1, + edit_weapon_primary_attach1 = 1, + edit_weapon_primary_attach2 = 1, + edit_weapon_primary_attach3 = 1, + edit_weapon_primary_camo = 1, + edit_weapon_primary_reticle = 1, + edit_weapon_secondary = 1, + edit_weapon_secondary_attach1 = 1, + edit_weapon_secondary_attach2 = 1, + edit_lethal = 1, + edit_tactical = 1, + edit_killstreaks = 0, + edit_abilities = 0, + edit_perk1 = 0, + edit_perk2 = 0, + edit_perk3 = 0 + }, + PaneList = { + "cac_weapon_stats_full_pane", + "cac_performance_stats_full_pane_weapon", + "cac_performance_stats_full_pane_lethal", + "cac_performance_stats_full_pane_tactical" + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = Cac.Layout.InfoPane.height, + alpha = 1 + }, + shown = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + show_info_pane = MBh.AnimateToState( "shown", 0 ), + hide_info_pane = MBh.AnimateToState( "hidden", 0 ), + button_shoulderr = InfoPaneHandleRightBumper, + button_shoulderl = InfoPaneHandleLeftBumper, + info_panel_go_right = InfoPaneHandleRightBumper, + info_panel_go_left = InfoPaneHandleLeftBumper, + update_selection_info = UpdateSelectionId, + refresh_info_pane_view = refreshInfoPaneView, + popup_active = ReEnable + }, + children = {} + } +end + +LUI.MenuBuilder.registerDef( "cac_basic_info_pane_page", cac_basic_info_pane_page ) +LUI.MenuBuilder.registerType( "cac_basic_info_pane_header", cac_basic_info_pane_header ) +LUI.MenuBuilder.registerDef( "cac_basic_info_pane_container", cac_basic_info_pane_container ) +LUI.MenuBuilder.registerDef( "cac_basic_info_pane_background", cac_basic_info_pane_background ) +LUI.MenuBuilder.registerDef( "cac_weapon_stats_full_pane", cac_weapon_stats_full_pane ) +LUI.MenuBuilder.registerDef( "cac_performance_stats_full_pane", cac_performance_stats_full_pane ) +LUI.MenuBuilder.registerDef( "cac_performance_stats_full_pane_weapon", cac_performance_stats_full_pane( "cac_weapon_info_pane_performance_page_weapon" ) ) +LUI.MenuBuilder.registerDef( "cac_performance_stats_full_pane_tactical", cac_performance_stats_full_pane( "cac_weapon_info_pane_performance_page_tactical" ) ) +LUI.MenuBuilder.registerDef( "cac_performance_stats_full_pane_lethal", cac_performance_stats_full_pane( "cac_weapon_info_pane_performance_page_lethal" ) ) +LUI.MenuBuilder.registerDef( "cac_abilities_perks_info_pane_header", cac_abilities_perks_info_pane_header ) +LockTable( _M ) diff --git a/lui/mp_menus/cacloadoututils.dec.lua b/lui/mp_menus/cacloadoututils.dec.lua new file mode 100644 index 0000000..5509fe5 --- /dev/null +++ b/lui/mp_menus/cacloadoututils.dec.lua @@ -0,0 +1,3899 @@ +Cac = Cac or {} +if Engine.InFrontend() then + Cac.Layout = { + ChooseDialog = { + left = 445, + right = 695, + top = 100, + bottom = 640 + }, + CacEditPanel = { + left = 445, + right = 778, + top = 100, + bottom = 616, + shift_delta = -500 + }, + InfoPane = { + height = 280, + header_height = GenericTitleBarDims.TitleBarHeight + }, + KillstreakSelectionPanel = { + left = 760, + right = 1300, + top = 100, + bottom = 355 + }, + SelectionInfo = { + textTop = 250, + height = 355 + }, + ChooseWeaponIcon = { + left = -64, + right = 64, + top = -32, + bottom = 32 + }, + ChooseGrenadeIcon = { + left = -32, + right = 32, + top = -32, + bottom = 32 + }, + ChooseReticleIcon = { + left = -24, + right = 24, + top = -24, + bottom = 24 + }, + ChooseCamoIcon = { + left = -24, + right = 24, + top = -24, + bottom = 24 + }, + CacWeaponMeter = { + top = 2.6, + bottom = -3.5, + left = 0, + offset_max = 155 + }, + AttachmentChooseDims = { + SelectButton = { + width = 70, + height = 70 + }, + Grid = { + menu_top = 100, + menu_left = 445, + row_height = 80, + horizontal_spacing = 18, + text_space = 142 + } + }, + SpecialistStreak = { + row_offset = 68, + PreviewButton = { + width = 54, + height = 54 + } + }, + AbilitiesBar = { + slot_width = 40, + slot_height = 48, + slot_spacing = 1 + } + } + Cac.Selection = { + background_up = { + a = 0.05, + attach = 0.08 + }, + background_over = { + a = 0.4, + attach = 0.4 + }, + outline_up = { + a = 0.05, + attach = 0.05 + }, + outline_over = { + a = 0.2, + attach = 0.4 + } + } + Cac.TypeDescriptions = { + weapon_assault = Engine.Localize( "@LUA_MENU_WEAPTYPE_AR_DESC" ), + weapon_smg = Engine.Localize( "@LUA_MENU_WEAPTYPE_SMG_DESC" ), + weapon_lmg = Engine.Localize( "@LUA_MENU_WEAPTYPE_LMG_DESC" ), + weapon_dmr = Engine.Localize( "@LUA_MENU_WEAPTYPE_DMR_DESC" ), + weapon_sniper = Engine.Localize( "@LUA_MENU_WEAPTYPE_SNIPER_DESC" ), + weapon_shotgun = Engine.Localize( "@LUA_MENU_WEAPTYPE_SHOTGUN_DESC" ), + weapon_riot = Engine.Localize( "@LUA_MENU_WEAPTYPE_RIOT_DESC" ), + weapon_pistol = Engine.Localize( "@LUA_MENU_WEAPTYPE_HANDGUNS_DESC" ), + weapon_projectile = Engine.Localize( "@LUA_MENU_WEAPTYPE_LAUNCHERS_DESC" ), + streaktype_assault = Engine.Localize( "@LUA_MENU_WEAPTYPE_ASSAULT_DESC" ), + streaktype_support = Engine.Localize( "@LUA_MENU_WEAPTYPE_SUPPORT_DESC" ), + streaktype_specialist = Engine.Localize( "@LUA_MENU_STREAKTYPE_SPECIALIST_DESC" ), + weapon_knifefast = Engine.Localize( "@LUA_MENU_MP_WEAPTYPE_KNIFE_FAST_DESC" ) + } + Cac.WeaponStatTypes = { + Accuracy = { + Title = Engine.Localize( "LUA_MENU_WEAPSTATS_ACCURACY" ) + }, + Damage = { + Title = Engine.Localize( "LUA_MENU_WEAPSTATS_DAMAGE" ) + }, + Range = { + Title = Engine.Localize( "LUA_MENU_WEAPSTATS_RANGE" ) + }, + FireRate = { + Title = Engine.Localize( "LUA_MENU_WEAPSTATS_ROF" ) + }, + Mobility = { + Title = Engine.Localize( "LUA_MENU_WEAPSTATS_MOBILITY" ) + } + } + Cac.WeaponPerformanceTypes = { + KDR = { + Title = Engine.Localize( "LUA_MENU_WEAPPERF_KDR" ) + }, + Kills = { + Title = Engine.Localize( "LUA_MENU_WEAPPERF_KILLS" ) + }, + Deaths = { + Title = Engine.Localize( "LUA_MENU_WEAPPERF_DEATHS" ) + }, + Headshots = { + Title = Engine.Localize( "LUA_MENU_WEAPPERF_HEADSHOTS" ) + }, + Accuracy = { + Title = Engine.Localize( "LUA_MENU_WEAPPERF_ACCURACY" ) + }, + Usage = { + Title = Engine.Localize( "LUA_MENU_WEAPPERF_USAGE" ) + }, + Hits = { + Title = Engine.Localize( "LUA_MENU_WEAPPERF_HITS" ) + } + } + Cac.Weapons = { + weapon_assault = { + "iw6_dlcweap01", + "iw6_sc2010", + "iw6_bren", + "iw6_ak12", + "iw6_fads", + "iw6_r5rgp", + "iw6_msbs", + "iw6_honeybadger", + "iw6_arx160" + }, + weapon_smg = { + "iw6_dlcweap02", + "iw6_pp19", + "iw6_cbjms", + "iw6_kriss", + "iw6_vepr", + "iw6_k7", + "iw6_microtar" + }, + weapon_lmg = { + "iw6_ameli", + "iw6_m27", + "iw6_lsat", + "iw6_kac" + }, + weapon_dmr = { + "iw6_g28", + "iw6_mk14", + "iw6_imbel", + "iw6_svu" + }, + weapon_sniper = { + "iw6_dlcweap03", + "iw6_usr", + "iw6_l115a3", + "iw6_gm6", + "iw6_vks" + }, + weapon_shotgun = { + "iw6_maul", + "iw6_fp6", + "iw6_mts255", + "iw6_uts15" + }, + weapon_riot = { + "iw6_riotshield" + }, + weapon_pistol = { + "iw6_m9a1", + "iw6_mp443", + "iw6_p226", + "iw6_magnum", + "iw6_pdw", + "laser_designator" + }, + weapon_projectile = { + "iw6_rgm", + "iw6_panzerfaust3", + "iw6_mk32" + }, + weapon_knifefast = { + "uav" + } + } + Cac.Reticles = { + NumCustom = 5, + None = "none", + ClanReward = "retclan01", + Generics = { + "ret01", + "ret02", + "ret03", + "ret04", + "ret05" + } + } + Cac.PrimaryGrenades = { + "specialty_null", + "frag_grenade_mp", + "semtex_mp", + "throwingknife_mp", + "proximity_explosive_mp", + "c4_mp", + "mortar_shell_mp" + } + Cac.SecondaryGrenades = { + "specialty_null", + "flash_grenade_mp", + "concussion_grenade_mp", + "smoke_grenade_mp", + "trophy_mp", + "motion_sensor_mp", + "thermobaric_grenade_mp" + } + Cac.Perks = { + ability_speed = { + "specialty_fastsprintrecovery", + "specialty_fastreload", + "specialty_lightweight", + "specialty_marathon", + "specialty_stalker" + }, + ability_handling = { + "specialty_pitcher", + "specialty_sprintreload", + "specialty_quickswap", + "specialty_bulletaccuracy", + "specialty_quickdraw" + }, + ability_stealth = { + "specialty_silentkill", + "specialty_blindeye", + "specialty_quieter", + "specialty_incog", + "specialty_gpsjammer" + }, + ability_awareness = { + "specialty_paint", + "specialty_scavenger", + "specialty_detectexplosive", + "specialty_selectivehearing", + "specialty_comexp" + }, + ability_resistance = { + "specialty_falldamage", + "specialty_regenfaster", + "specialty_sharp_focus", + "specialty_stun_resistance", + "_specialty_blastshield" + }, + ability_equipment = { + "specialty_extra_equipment", + "specialty_extra_deadly", + "specialty_extraammo", + "specialty_extra_attachment", + "specialty_explosivedamage" + }, + ability_elite = { + "specialty_gambler", + "specialty_hardline", + "specialty_boom", + "specialty_twoprimaries", + "specialty_deadeye" + } + } + Cac.StreakTypes = { + "streaktype_assault", + "streaktype_support", + "streaktype_specialist" + } + Cac.Streaks = { + streaktype_assault = { + Streaks = { + "uplink", + "ims", + "guard_dog", + "sentry", + "drone_hive", + "helicopter", + "ball_drone_backup", + "vanguard", + "airdrop_juggernaut_maniac", + "airdrop_juggernaut", + "heli_pilot", + "odin_assault" + }, + Caps = "LUA_MENU_ASSAULT" + }, + streaktype_support = { + Streaks = { + "uplink_support", + "deployable_ammo", + "deployable_vest", + "aa_launcher", + "ball_drone_radar", + "recon_agent", + "jammer", + "air_superiority", + "heli_sniper", + "uav_3dping", + "airdrop_juggernaut_recon", + "odin_support" + }, + Caps = "PATCH_MENU_SUPPORT_CAPS" + }, + streaktype_specialist = { + Streaks = { + Cac.Perks + }, + Caps = "PATCH_MENU_SPECIALIST_CAPS" + } + } + Cac.StreakTypePopupMenus = { + streaktype_assault = "killstreak_selections", + streaktype_support = "killstreak_selections", + streaktype_specialist = "cac_ability_alt_main" + } + Cac.KillstreakRefArray = {} + AttachmentGunTable = { + Cols = { + Ref = 0, + UIRef = 1, + Name = 2, + Desc = 3, + Image = 4, + Group = 5 + } + } + AttachmentComboTable = { + File = "mp/attachmentCombos.csv", + Cols = { + Ref = 0 + } + } + UnlockTable = { + File = "mp/unlockTable.csv", + Cols = { + ItemId = 0, + Type = 1, + Rank = 2, + Challenge = 3, + ExtRank = 8, + Entitlement = 9, + ExtinctionPrestige = 10, + ExtinctionEscapes = 11, + HighestRelicEscape = 12, + ExtinctionKills = 13, + ExtinctionRevives = 14, + Prestige = 15, + PlayedMW3 = 16, + MW3Prestive = 17, + PlayedBO2 = 18, + BO2Prestige = 19, + UCD = 20, + DLCOffer = 21 + } + } +else + Cac.Layout = { + CacEditPanel = { + left = 600, + right = 933, + top = 105, + bottom = 616, + horizontal_outset = 7, + vertical_outset = 5, + shift_delta = -500 + }, + InfoPane = { + width = 355, + height = 280, + header_height = 26 + }, + ChooseWeaponIcon = { + left = -64, + right = 64, + top = -32, + bottom = 32 + }, + ChooseGrenadeIcon = { + left = -32, + right = 32, + top = -32, + bottom = 32 + }, + ChooseReticleIcon = { + left = -24, + right = 24, + top = -24, + bottom = 24 + }, + ChooseCamoIcon = { + left = -24, + right = 24, + top = -24, + bottom = 24 + }, + SpecialistStreak = { + row_offset = 68, + PreviewButton = { + width = 54, + height = 54 + } + }, + AbilitiesBar = { + slot_width = 40, + slot_height = 48, + slot_spacing = 1 + } + } + HuntedWeaponsTable = { + File = "mp/sotfWeapons.csv", + Cols = { + Index = 0, + Group = 1, + Ref = 2 + } + } +end +Cac.Abilities = { + Types = { + Speed = 0, + Handling = 1, + Stealth = 2, + Awareness = 3, + Resistance = 4, + Equipment = 5, + Elite = 6 + }, + Refs = { + None = "ability_null", + Speed = "ability_speed", + Handling = "ability_handling", + Stealth = "ability_stealth", + Awareness = "ability_awareness", + Resistance = "ability_resistance", + Equipment = "ability_equipment", + Elite = "ability_elite" + }, + Settings = { + minSlotsUnlocked = 2, + maxSlotsUnlocked = 5, + defaultSlotDistribution = 0, + GrabBagCapacity = 8, + SpecialistCapacity = 8, + AbilitiesNumCategories = 7, + AbilitiesPerCategory = 5, + SpecialistAbilityCount = 3 + }, + BlockedSpecialist = { + "specialty_twoprimaries", + "specialty_extra_attachment", + "specialty_extra_equipment", + "specialty_extra_deadly", + "specialty_extraammo" + } +} +Cac.PerkTypes = { + Refs = { + "ability_speed", + "ability_handling", + "ability_stealth", + "ability_awareness", + "ability_resistance", + "ability_equipment", + "ability_elite" + }, + Strings = { + ability_speed = "PATCH_MENU_PERK_SPEED", + ability_handling = "PATCH_MENU_PERK_HANDLING", + ability_stealth = "PATCH_MENU_PERK_STEALTH", + ability_awareness = "PATCH_MENU_PERK_AWARENESS", + ability_resistance = "PATCH_MENU_PERK_RESISTANCE", + ability_equipment = "PATCH_MENU_PERK_EQUIPMENT", + ability_elite = "PATCH_MENU_PERK_ELITE" + }, + Descriptions = { + ability_speed = "PATCH_MENU_PERK_SPEED_DESC", + ability_handling = "PATCH_MENU_PERK_HANDLING_DESC", + ability_stealth = "PATCH_MENU_PERK_STEALTH_DESC", + ability_awareness = "PATCH_MENU_PERK_AWARENESS_DESC", + ability_resistance = "PATCH_MENU_PERK_RESISTANCE_DESC", + ability_equipment = "PATCH_MENU_PERK_EQUIPMENT_DESC", + ability_elite = "PATCH_MENU_PERK_ELITE_DESC" + } +} +Cac.Indices = { + Weapons = { + Primary = 0, + Secondary = 1 + }, + Attachments = { + PrimaryAttachment1 = 0, + PrimaryAttachment2 = 1, + PrimaryAttachment3 = 2, + SecondaryAttachment1 = 0, + SecondaryAttachment2 = 1 + }, + Grenade = { + Primary = 0, + Secondary = 1 + }, + Killstreaks = { + Streak1 = 0, + Streak2 = 1, + Streak3 = 2 + }, + Perk1 = 2, + Perk2 = 3, + Perk3 = 4, + StreakType = 5 +} +Cac.Swatches = { + selection = Colors.white, + highlight = Colors.frontend_hilite, + slot = Colors.light_grey, + slot_over = Colors.very_dark_cyan, + overlay = Colors.very_dark_cyan, + warning_text = Colors.frontend_hilite, + new_icon_text = Colors.new_icon_green, + Alphas = { + cac_panel_background_shadow = 0.3 + } +} +StatsTable = { + File = "mp/StatsTable.csv", + Cols = { + WeaponRef = 4, + WeaponClass = 2, + WeaponName = 3, + WeaponCount = 5, + WeaponImage = 6, + WeaponDesc = 7, + WeaponAttachFirst = 10, + WeaponAttachLast = 29, + WeaponAcc = 30, + WeaponDam = 31, + WeaponRng = 32, + WeaponRof = 33, + WeaponMob = 34, + WeaponFullImage = 35, + WeaponBWImage = 36, + WeaponProfileImage = 39 + } +} +AttachmentTable = { + File = "mp/attachmentTable.csv", + Cols = { + Group = 2, + Ref = 4, + BaseRef = 5, + Name = 3, + Image = 6, + Desc = 7, + Reticles = 11, + Perk = 12, + Slot = 13, + Acc = 14, + Dam = 15, + Rng = 16, + Rof = 17, + Mob = 18, + BotDifficulty = 19, + ImageFull = 20 + } +} +AttachmentMap = { + File = "mp/attachmentmap.csv", + Rows = { + AttachRef = 0 + }, + Cols = { + WeapOrClass = 0 + } +} +PerkTable = { + File = "mp/perkTable.csv", + Cols = { + Index = 0, + Ref = 1, + Name = 2, + Image = 3, + Desc = 4, + Slot = 5, + Count = 6, + Type = 7, + Upgrade = 8, + UpgradeName = 9, + Cost = 10 + } +} +CamoTable = { + File = "mp/camoTable.csv", + ColIndexNone = 0, + Cols = { + Index = 0, + Ref = 1, + Name = 2, + Image = 3, + WeapIndex = 4, + DLC = 5 + }, + GoldRef = "gold", + GlobalList = { + clan01 = 1, + clan02 = 2 + } +} +ReticleTable = { + File = "mp/reticleTable.csv", + Cols = { + Index = 0, + Ref = 1, + Name = 2, + Desc = 3, + Image = 4, + WeapIndex = 5 + } +} +CamoReticleUnlockTable = { + File = "mp/camo_reticle_unlockTable.csv", + MaxRows = 500, + Cols = { + CamoReticleRef = 0, + ChallengeRef = 1, + Tier = 2, + IsEntitlement = 3, + HideIfLocked = 4, + Title = 5, + Desc = 6, + DLCPack = 7, + ReleaseKillswitch = 8 + }, + ChallengeIDList = { + crouch = 1, + assists = 1, + defender = 1, + noattach = 1, + hipfire = 1, + consecutive = 1, + pointblank = 1, + reload = 1, + sliding = 1, + leaning = 1, + allcamo = 1, + longshot = 1 + } +} +KillstreakTable = { + File = "mp/killstreakTable.csv", + Cols = { + Index = 0, + Ref = 1, + Name = 2, + Desc = 3, + Kills = 4, + EarnedHint = 5, + Sound = 6, + EarnedDialog = 7, + AlliesDialog = 8, + EnemyDialog = 9, + EnemyUseDialog = 10, + Weapon = 11, + Score = 12, + Icon = 13, + OverheadIcon = 14, + DPadIcon = 15, + UnearnedIcon = 16, + AllTeamStreak = 17 + } +} +AbilityTable = { + File = "mp/cacAbilityTable.csv", + Cols = { + Index = 0, + Ref = 1, + Name = 2, + Slot0 = 3, + Effect1Name = 14, + Effect1Val0 = 15, + Effect2Name = 26, + Effect2Val0 = 27 + } +} +GameTypesTable = { + File = "mp/gametypesTable.csv", + Cols = { + Ref = 0, + Name = 1, + Desc = 2, + Image = 3, + TeamChoice = 4, + ClassChoice = 5, + Category = 6, + Squads = 7, + WargameName = 8, + ObjectiveHintAttackers = 9, + ObjectiveHintDefenders = 10, + MLG = 11 + } +} +BackgroundsTable = { + File = "mp/cac/backgrounds.csv", + Cols = { + Ref = 0, + Image = 1, + Name = 2, + CardImage = 3, + Category = 4, + CategoryName = 5, + Entitlement = 6, + HideUnlessUnlocked = 7, + CustomUnlockString = 8, + DLCPack = 9 + } +} +PatchesTable = { + File = "mp/cac/patches.csv", + Cols = { + Ref = 0, + Image = 1, + Name = 2, + Quip = 3, + CardImage = 4, + Category = 5, + CategoryName = 6, + Entitlement = 7, + HideUnlessUnlocked = 8, + CustomUnlockString = 9, + DLCPack = 10 + } +} +PatchBackingsTable = { + File = "mp/cac/patchbackings.csv", + Cols = { + Ref = 0, + Name = 1, + CardImage = 2, + Category = 3, + CategoryName = 4 + } +} +FactionTable = { + File = "mp/factionTable.csv", + Cols = { + Ref = 0, + Name = 1, + ShortName = 2, + Eliminated = 3, + Forfeited = 4, + FactionIcon = 5, + FactionHudIcon = 6 + } +} +Cac.WeaponUnlockTable = { + File = "mp/squadUnlockTable.csv", + Cols = { + WeaponRef = 0, + Type = 1, + IsEntitlement = 6, + HideIfLocked = 7, + DLCPack = 8, + ReleaseKillswitch = 9 + } +} +Cac.WeaponTypes = { + Primary = { + "weapon_assault", + "weapon_smg", + "weapon_lmg", + "weapon_dmr", + "weapon_sniper", + "weapon_shotgun", + "weapon_riot", + "weapon_knifefast" + }, + Secondary = { + "weapon_pistol", + "weapon_projectile" + }, + WeaponTypeStrings = { + Cap = { + weapon_assault = Engine.Localize( "@LUA_MENU_ASSAULT_RIFLES_CAPS" ), + weapon_smg = Engine.Localize( "@LUA_MENU_SMGS_CAPS" ), + weapon_lmg = Engine.Localize( "@LUA_MENU_LMGS_CAPS" ), + weapon_dmr = Engine.Localize( "@LUA_MENU_DMRS_CAPS" ), + weapon_sniper = Engine.Localize( "@LUA_MENU_SNIPER_RIFLES_CAPS" ), + weapon_shotgun = Engine.Localize( "@LUA_MENU_SHOTGUNS_CAPS" ), + weapon_riot = Engine.Localize( "@LUA_MENU_RIOT_SHIELD_CAPS" ), + weapon_pistol = Engine.Localize( "@LUA_MENU_HANDGUNS_CAPS" ), + weapon_projectile = Engine.Localize( "@LUA_MENU_ROCKETS_CAPS" ), + weapon_knifefast = Engine.Localize( "@LUA_MENU_MP_KNIFE_FAST_CAPS" ) + }, + Single = { + weapon_assault = Engine.Localize( "@LUA_MENU_WEAPTYPE_SINGLE_AR" ), + weapon_smg = Engine.Localize( "@LUA_MENU_WEAPTYPE_SINGLE_SMG" ), + weapon_lmg = Engine.Localize( "@LUA_MENU_WEAPTYPE_SINGLE_LMG" ), + weapon_dmr = Engine.Localize( "@LUA_MENU_WEAPTYPE_SINGLE_DMR" ), + weapon_sniper = Engine.Localize( "@LUA_MENU_WEAPTYPE_SINGLE_SNIPER" ), + weapon_shotgun = Engine.Localize( "@LUA_MENU_WEAPTYPE_SINGLE_SHOTGUN" ), + weapon_riot = Engine.Localize( "@LUA_MENU_WEAPTYPE_SINGLE_RIOT" ), + weapon_pistol = Engine.Localize( "@LUA_MENU_WEAPTYPE_SINGLE_HANDGUN" ), + weapon_projectile = Engine.Localize( "@LUA_MENU_WEAPTYPE_SINGLE_LAUNCHER" ), + weapon_knifefast = Engine.Localize( "@LUA_MENU_MP_WEAPTYPE_KNIFE_FAST" ) + }, + weapon_assault = Engine.Localize( "@LUA_MENU_WEAPTYPE_AR" ), + weapon_smg = Engine.Localize( "@LUA_MENU_WEAPTYPE_SMG" ), + weapon_lmg = Engine.Localize( "@LUA_MENU_WEAPTYPE_LMG" ), + weapon_dmr = Engine.Localize( "@LUA_MENU_WEAPTYPE_DMR" ), + weapon_sniper = Engine.Localize( "@LUA_MENU_WEAPTYPE_SNIPER" ), + weapon_shotgun = Engine.Localize( "@LUA_MENU_WEAPTYPE_SHOTGUN" ), + weapon_riot = Engine.Localize( "@LUA_MENU_WEAPTYPE_RIOT" ), + weapon_pistol = Engine.Localize( "@LUA_MENU_WEAPTYPE_HANDGUNS" ), + weapon_projectile = Engine.Localize( "@LUA_MENU_WEAPTYPE_LAUNCHERS" ), + weapon_knifefast = Engine.Localize( "@LUA_MENU_MP_WEAPTYPE_KNIFE_FAST" ) + } +} +Cac.AttachmentTypes = { + Types = { + "rail", + "barrel", + "undermount", + "unique" + }, + Strings = { + rail = Engine.Localize( "@LUA_MENU_ATTACHMENT_SIGHTS" ), + barrel = Engine.Localize( "@LUA_MENU_ATTACHMENT_BARREL" ), + undermount = Engine.Localize( "@LUA_MENU_ATTACHMENT_UNDER_BARREL" ), + unique = Engine.Localize( "@LUA_MENU_ATTACHMENT_MOD" ) + }, + Caps = { + rail = Engine.Localize( "@PATCH_MENU_ATTACHMENT_SIGHTS_CAPS" ), + barrel = Engine.Localize( "@PATCH_MENU_ATTACHMENT_BARREL_CAPS" ), + undermount = Engine.Localize( "@PATCH_MENU_ATTACHMENT_UNDER_BARREL_CAPS" ), + unique = Engine.Localize( "@PATCH_MENU_ATTACHMENT_MOD_CAPS" ) + }, + Descriptions = { + rail = Engine.Localize( "@PATCH_MENU_ATTACHMENT_SIGHTS_DESC" ), + barrel = Engine.Localize( "@PATCH_MENU_ATTACHMENT_BARREL_DESC" ), + undermount = Engine.Localize( "@PATCH_MENU_ATTACHMENT_UNDER_BARREL_DESC" ), + unique = Engine.Localize( "@PATCH_MENU_ATTACHMENT_MOD_DESC" ) + } +} +local f0_local0 = { + "defaultClassesTeam0", + "defaultClassesTeam1", + "defaultClassesTeam2", + "defaultClassesTeam3" +} +if Engine.InFrontend() then + function getProperUnlockTable( f1_arg0 ) + local f1_local0 = nil + return "mp/squadUnlockTable.csv" + end + + Cac.GetSimpleAttachmentList = function ( f2_arg0 ) + local f2_local0 = {} + local f2_local1 = "" + local f2_local2 = "" + local f2_local3 = 0 + local f2_local4 = false + local f2_local5 = false + repeat + f2_local1 = Engine.TableLookupByRow( AttachmentTable.File, f2_local3, 0 ) + f2_local2 = Engine.TableLookupByRow( AttachmentTable.File, f2_local3, AttachmentTable.Cols.BaseRef ) + if f2_local2 == "none" then + f2_local4 = true + elseif f2_local4 and f2_local1 ~= "" and f2_local2 ~= "" then + if f2_local2 == "done" then + f2_local5 = true + elseif f2_local0[#f2_local0] ~= f2_local2 and (not f2_arg0 or f2_arg0 == Cac.GetAttachmentType( f2_local2 )) then + f2_local0[#f2_local0 + 1] = f2_local2 + end + elseif f2_local1 == "" and f2_local2 == "" then + f2_local5 = true + end + f2_local3 = f2_local3 + 1 + until f2_local5 + return f2_local0 + end + + Cac.getAttachmentCost = function ( f3_arg0, f3_arg1 ) + return tonumber( Engine.TableLookup( "mp/squadUnlockTable.csv", 0, Engine.TableLookup( "mp/squadUnlockTable.csv", 0, Cac.GetAttachmentUnlockName( f3_arg0, f3_arg1 ), 3 ), 4 ) ) + end + + Cac.GetAttachmentUnlockName = function ( f4_arg0, f4_arg1 ) + if string.match( f4_arg1, "iw5_" ) or string.match( f4_arg1, "iw6_" ) then + f4_arg1 = string.sub( f4_arg1, 5 ) + end + return f4_arg1 .. "_" .. f4_arg0 + end + + Cac.IsAttachmentUnlocked = function ( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5, f5_arg6 ) + if f5_arg6 == "none" then + return true + elseif f5_arg6 == nil then + return true + elseif f5_arg1 == "privateMatchSquadMembers" then + return true + end + local f5_local0 = Cac.GetWeapon( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5 ) + if string.match( f5_local0, "iw5_" ) or string.match( f5_local0, "iw6_" ) then + f5_local0 = string.sub( f5_local0, 5 ) + end + local f5_local1 = f5_local0 .. "_" .. f5_arg6 + local f5_local2 = Engine.TableLookup( "mp/squadUnlockTable.csv", 0, f5_local1, 3 ) + if f5_local2 == "" then + return true + elseif Engine.TableLookup( "mp/squadUnlockTable.csv", 0, f5_local1, 2 ) == "none" then + return true + elseif Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadMembers", f5_arg2, "challengeState", f5_local2 ) >= 1 then + return true + end + return false + end + + Cac.ValidateReticle = function ( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5 ) + if not Cac.WeaponHasReticles( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5 ) then + Cac.SetWeaponReticle( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5, Cac.Reticles.None ) + else + local f6_local0 = Cac.GetAttachmentWithReticles( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5 ) + local f6_local1 = Cac.GetReticle( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5 ) + if not Cac.IsReticleValid( f6_arg0, f6_local0, f6_local1 ) or Cac.GetReticleChallengeRef( f6_local0, f6_local1 ) and not Cac.IsReticleChallengeComplete( f6_arg0, f6_local0, f6_local1 ) then + Cac.SetWeaponReticle( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5, Cac.GetReticleDefault( f6_local0 ) ) + end + end + end + + Cac.IsPerkUnlocked = function ( f7_arg0, f7_arg1, f7_arg2, f7_arg3 ) + if f7_arg3 == "none" then + return true + elseif f7_arg1 == "privateMatchSquadMembers" then + return true + end + local f7_local0 = getProperUnlockTable( f7_arg3 ) + local f7_local1 = Engine.TableLookup( f7_local0, 0, f7_arg3, 3 ) + local f7_local2 = tonumber( Engine.TableLookup( f7_local0, 0, f7_arg3, 2 ) ) + if f7_local2 == nil then + f7_local2 = 0 + end + if (f7_local1 == "" or f7_local1 == "none") and (f7_local2 == "" or f7_local2 == "0") then + return true + end + local f7_local3 = Rank.GetRankDisplay( Lobby.GetRankForXP( Engine.GetPlayerDataEx( f7_arg0, CoD.StatsGroup.Ranked, "squadMembers", f7_arg2, "squadMemXP" ) ) ) + 0 + local f7_local4 = nil + if f7_local1 ~= nil and f7_local1 ~= "" and f7_local1 ~= "none" then + f7_local4 = tonumber( Engine.GetPlayerDataEx( f7_arg0, CoD.StatsGroup.Ranked, "squadMembers", f7_arg2, "challengeState", f7_local1 ) ) + else + f7_local4 = 99 + end + if f7_local4 >= 1 then + return true + elseif f7_local2 <= f7_local3 then + return true + end + return false + end + + Cac.IsItemUnlocked = function ( f8_arg0, f8_arg1, f8_arg2, f8_arg3, f8_arg4, f8_arg5 ) + if f8_arg3 == "none" then + return true + elseif f8_arg1 == "privateMatchSquadMembers" then + return true + elseif f8_arg3 == "uav" then + return Cac.GetPrestigeLevel( f8_arg0, f8_arg1 ) >= 5 + elseif f8_arg3 == "laser_designator" then + return Cac.GetPrestigeLevel( f8_arg0, f8_arg1 ) >= 10 + end + local f8_local0 = getProperUnlockTable( f8_arg3 ) + local f8_local1 = Engine.TableLookup( f8_local0, 0, f8_arg3, 3 ) + if f8_arg4 then + f8_local1 = f8_arg4 + end + local f8_local2 = tonumber( Engine.TableLookup( f8_local0, 0, f8_arg3, 2 ) ) + if f8_arg5 then + f8_local2 = tonumber( f8_arg5 ) + end + if f8_local2 == nil then + f8_local2 = 0 + end + if (f8_local1 == "" or f8_local1 == "none") and (f8_local2 == "" or f8_local2 == "0") then + return true + end + local f8_local3 = Lobby.GetRankForXP( Engine.GetPlayerDataEx( f8_arg0, CoD.StatsGroup.Ranked, "squadMembers", f8_arg2, "squadMemXP" ) ) + local f8_local4 = nil + if f8_local1 ~= nil and f8_local1 ~= "" and f8_local1 ~= "none" then + if not f8_arg4 then + f8_local4 = tonumber( Engine.GetPlayerDataEx( f8_arg0, CoD.StatsGroup.Ranked, "squadMembers", f8_arg2, "challengeState", f8_local1 ) ) + else + f8_local4 = tonumber( Engine.GetPlayerDataEx( f8_arg0, CoD.StatsGroup.Ranked, "challengeState", f8_local1 ) ) + end + else + f8_local4 = 99 + end + if f8_local4 >= 1 and f8_local2 == 0 then + return true + elseif f8_arg4 then + if tonumber( f8_local2 ) + 1 <= f8_local4 then + return true + end + elseif f8_local4 >= 1 and f8_local2 <= f8_local3 then + return true + elseif (f8_local1 == "none" or "" == unlockReqs) and f8_local2 <= f8_local3 then + return true + end + return false + end + + function syncXP( f9_arg0, f9_arg1 ) + if not Engine.IsAliensMode() then + if not f9_arg0 or not f9_arg1 then + return + end + Engine.SetPlayerDataEx( f9_arg0, CoD.StatsGroup.Ranked, "experience", Engine.GetPlayerDataEx( f9_arg0, CoD.StatsGroup.Ranked, "squadMembers", f9_arg1, "squadMemXP" ) ) + end + end + + function unlockItem( f10_arg0, f10_arg1 ) + local f10_local0 = getProperUnlockTable( f10_arg1 ) + local f10_local1 = Engine.TableLookup( f10_local0, 0, f10_arg1, 3 ) + local f10_local2 = Engine.TableLookup( f10_local0, 0, f10_local1, 4 ) + local f10_local3 = Engine.GetPlayerDataEx( f10_arg0, CoD.StatsGroup.Ranked, "unlockPoints" ) + local f10_local4 = Cac.GetEditSquadMember() + Cac.SetCurrency( f10_arg0, f10_local3 - f10_local2 ) + Engine.SetPlayerDataEx( f10_arg0, CoD.StatsGroup.Ranked, "squadMembers", f10_local4, "challengeState", f10_local1, 2 ) + return 1 + end + + Cac.GetEditCurrency = function ( f11_arg0 ) + if IsOnlineMatch() and not Engine.GetDvarBool( "xblive_privatematch" ) and not Engine.IsAliensMode() then + return { + type = "cac_edit_currency", + id = f11_arg0 + } + else + return { + type = "UIElement" + } + end + end + + Cac.GetItemClassDescriptions = function ( f12_arg0 ) + return Cac.TypeDescriptions[f12_arg0] + end + + Cac.GetItemCost = function ( f13_arg0 ) + local f13_local0 = getProperUnlockTable( f13_arg0 ) + return Engine.TableLookup( f13_local0, 0, Engine.TableLookup( f13_local0, 0, f13_arg0, 3 ), 4 ) + end + + Cac.GetItemLevel = function ( f14_arg0 ) + local f14_local0 = tonumber( Engine.TableLookup( getProperUnlockTable( f14_arg0 ), 0, f14_arg0, 2 ) ) + if f14_local0 == nil or f14_local0 == "" then + f14_local0 = 0 + end + return f14_local0 + end + + Cac.BuildPrimaryWeaponName = function ( f15_arg0, f15_arg1, f15_arg2, f15_arg3, f15_arg4 ) + local f15_local0 = Cac.GetWeapon( f15_arg0, f15_arg1, f15_arg2, f15_arg3, f15_arg4, 0 ) + local f15_local1 = Cac.GetAttachment( f15_arg0, f15_arg1, f15_arg2, f15_arg3, f15_arg4, 0, 0 ) + local f15_local2 = Cac.GetAttachment( f15_arg0, f15_arg1, f15_arg2, f15_arg3, f15_arg4, 0, 1 ) + local f15_local3 = Cac.IsAbilityPickedBySlotName( f15_arg0, f15_arg1, f15_arg2, f15_arg3, f15_arg4, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) + if f15_local3 then + f15_local3 = Cac.GetAttachment( f15_arg0, f15_arg1, f15_arg2, f15_arg3, f15_arg4, 0, 2 ) + end + local f15_local4 = Cac.GetCamo( f15_arg0, f15_arg1, f15_arg2, f15_arg3, f15_arg4, 0 ) + if f15_local4 then + f15_local4 = tonumber( Cac.GetCamoWeaponIndex( f15_local4 ) ) + end + local f15_local5 = Cac.GetReticle( f15_arg0, f15_arg1, f15_arg2, f15_arg3, f15_arg4, 0 ) + if f15_local5 then + f15_local5 = tonumber( Cac.GetReticleWeaponIndex( f15_local5 ) ) + end + return Cac.BuildWeaponName( f15_local0, f15_local1, f15_local2, f15_local4, f15_local5, f15_local3 ) + end + + Cac.BuildSecondaryWeaponName = function ( f16_arg0, f16_arg1, f16_arg2, f16_arg3, f16_arg4 ) + local f16_local0 = Cac.GetWeapon( f16_arg0, f16_arg1, f16_arg2, f16_arg3, f16_arg4, 1 ) + local f16_local1 = Cac.GetAttachment( f16_arg0, f16_arg1, f16_arg2, f16_arg3, f16_arg4, 1, 0 ) + local f16_local2 = Cac.IsAbilityPickedBySlotName( f16_arg0, f16_arg1, f16_arg2, f16_arg3, f16_arg4, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) + if f16_local2 then + f16_local2 = Cac.GetAttachment( f16_arg0, f16_arg1, f16_arg2, f16_arg3, f16_arg4, 1, 1 ) + end + return Cac.BuildWeaponName( f16_local0, f16_local1, f16_local2 ) + end + + Cac.BuildWeaponNameCamo = function ( f17_arg0, f17_arg1 ) + if not f17_arg1 or f17_arg1 <= 0 then + return f17_arg0 + else + return string.format( "%s_camo%02d", f17_arg0, f17_arg1 ) + end + end + + Cac.BuildWeaponNameReticle = function ( f18_arg0, f18_arg1 ) + if not f18_arg1 or f18_arg1 == "" or f18_arg1 == 0 then + return f18_arg0 + else + return string.format( "%s_scope%s", f18_arg0, f18_arg1 ) + end + end + + Cac.BuildWeaponName = function ( f19_arg0, f19_arg1, f19_arg2, f19_arg3, f19_arg4, f19_arg5 ) + if not f19_arg0 or f19_arg0 == "none" then + return "none" + elseif f19_arg0 == "uav" then + f19_arg0 = "iw6_knifeonlyfast" + end + if f19_arg0 == "laser_designator" then + f19_arg0 = "iw6_pdwauto" + end + if not f19_arg1 then + f19_arg1 = "none" + end + if not f19_arg2 then + f19_arg2 = "none" + end + if not f19_arg5 then + f19_arg5 = "none" + end + local f19_local0 = "" + local f19_local1 = "" + if f19_arg0:match( "iw5" ) or f19_arg0:match( "iw6" ) then + f19_local1 = f19_arg0 .. "_mp" + f19_local0 = f19_arg0:sub( 4, f19_arg0:len() ) + else + f19_local1 = f19_arg0 + end + local f19_local2 = Cac.GetWeaponClass( f19_arg0 ) + local f19_local3 + if f19_local2 ~= "weapon_sniper" and f19_local2 ~= "weapon_dmr" and f19_arg0 ~= "iw6_dlcweap02" then + f19_local3 = false + else + f19_local3 = true + end + local f19_local4 = {} + if f19_arg1 ~= "none" then + f19_local4[#f19_local4 + 1] = Cac.GetAttachmentUniqueRef( f19_arg1, f19_arg0 ) + end + if f19_arg2 ~= "none" then + f19_local4[#f19_local4 + 1] = Cac.GetAttachmentUniqueRef( f19_arg2, f19_arg0 ) + end + if f19_arg5 ~= "none" then + f19_local4[#f19_local4 + 1] = Cac.GetAttachmentUniqueRef( f19_arg5, f19_arg0 ) + end + if f19_local3 then + local f19_local5 = false + for f19_local9, f19_local10 in ipairs( f19_local4 ) do + if Cac.GetAttachmentType( f19_local10 ) == "rail" then + f19_local5 = true + break + end + end + if not f19_local5 then + f19_local4[#f19_local4 + 1] = f19_local0 .. "scope" + end + end + local f19_local5 = function ( f20_arg0, f20_arg1 ) + return f20_arg0 < f20_arg1 + end + + if f19_local4[#f19_local4] then + table.sort( f19_local4, f19_local5 ) + end + for f19_local9, f19_local10 in ipairs( f19_local4 ) do + f19_local1 = f19_local1 .. "_" .. f19_local10 + end + if f19_local1:match( "iw5" ) or f19_local1:match( "iw6" ) then + f19_local1 = Cac.BuildWeaponNameReticle( Cac.BuildWeaponNameCamo( f19_local1, f19_arg3 ), f19_arg4 ) + else + f19_local1 = Cac.BuildWeaponNameReticle( Cac.BuildWeaponNameCamo( f19_local1, f19_arg3 ), f19_arg4 ) .. "_mp" + end + return f19_local1 + end + + Cac.GetWeaponFullImage = function ( f21_arg0 ) + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f21_arg0, StatsTable.Cols.WeaponFullImage ) + end + + Cac.GetWeaponBWImage = function ( f22_arg0 ) + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f22_arg0, StatsTable.Cols.WeaponBWImage ) + end + + Cac.GetWeaponProfileImage = function ( f23_arg0 ) + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f23_arg0, StatsTable.Cols.WeaponProfileImage ) + end + + Cac.GetGrenadeDesc = function ( f24_arg0 ) + return Engine.Localize( "@" .. Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, Cac.StripSuffix( f24_arg0, "_mp" ), StatsTable.Cols.WeaponDesc ) ) + end + + Cac.GetWeaponDesc = function ( f25_arg0 ) + return Engine.Localize( "@" .. Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f25_arg0, StatsTable.Cols.WeaponDesc ) ) + end + + Cac.GetWeaponAccuracy = function ( f26_arg0 ) + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f26_arg0, StatsTable.Cols.WeaponAcc ) + end + + Cac.GetWeaponDamage = function ( f27_arg0 ) + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f27_arg0, StatsTable.Cols.WeaponDam ) + end + + Cac.GetWeaponRange = function ( f28_arg0 ) + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f28_arg0, StatsTable.Cols.WeaponRng ) + end + + Cac.GetWeaponFireRate = function ( f29_arg0 ) + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f29_arg0, StatsTable.Cols.WeaponRof ) + end + + Cac.GetWeaponMobility = function ( f30_arg0 ) + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f30_arg0, StatsTable.Cols.WeaponMob ) + end + + Cac.GetWeaponCategoryName = function ( f31_arg0 ) + return Cac.WeaponTypes.WeaponTypeStrings[f31_arg0] + end + + Cac.GetWeaponCategoryNameCaps = function ( f32_arg0 ) + return Cac.WeaponTypes.WeaponTypeStrings.Cap[f32_arg0] + end + + Cac.GetWeaponCategoryNameSingle = function ( f33_arg0 ) + return Cac.WeaponTypes.WeaponTypeStrings.Single[f33_arg0] + end + + Cac.GetAttachmentAccuracy = function ( f34_arg0, f34_arg1 ) + if f34_arg1 and f34_arg1 ~= "none" then + f34_arg0 = Cac.GetAttachmentUniqueRef( f34_arg0, f34_arg1 ) + end + return Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f34_arg0, AttachmentTable.Cols.Acc ) + end + + Cac.GetAttachmentDamage = function ( f35_arg0, f35_arg1 ) + if f35_arg1 and f35_arg1 ~= "none" then + f35_arg0 = Cac.GetAttachmentUniqueRef( f35_arg0, f35_arg1 ) + end + return Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f35_arg0, AttachmentTable.Cols.Dam ) + end + + Cac.GetAttachmentRange = function ( f36_arg0, f36_arg1 ) + if f36_arg1 and f36_arg1 ~= "none" then + f36_arg0 = Cac.GetAttachmentUniqueRef( f36_arg0, f36_arg1 ) + end + return Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f36_arg0, AttachmentTable.Cols.Rng ) + end + + Cac.GetAttachmentFireRate = function ( f37_arg0, f37_arg1 ) + if f37_arg1 and f37_arg1 ~= "none" then + f37_arg0 = Cac.GetAttachmentUniqueRef( f37_arg0, f37_arg1 ) + end + return Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f37_arg0, AttachmentTable.Cols.Rof ) + end + + Cac.GetAttachmentMobility = function ( f38_arg0, f38_arg1 ) + if f38_arg1 and f38_arg1 ~= "none" then + f38_arg0 = Cac.GetAttachmentUniqueRef( f38_arg0, f38_arg1 ) + end + return Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f38_arg0, AttachmentTable.Cols.Mob ) + end + + Cac.GetFirstOpenAttachment = function ( f39_arg0, f39_arg1, f39_arg2, f39_arg3, f39_arg4, f39_arg5 ) + local f39_local0 = Cac.GetAttachmentNumber( f39_arg0, f39_arg1, f39_arg2, f39_arg3, f39_arg4, f39_arg5 ) - 1 + for f39_local1 = 0, f39_local0, 1 do + if Cac.GetAttachment( f39_arg0, f39_arg1, f39_arg2, f39_arg3, f39_arg4, f39_arg5, f39_local1 ) == "none" then + return f39_local1 + end + end + end + + Cac.GetAttachmentName = function ( f40_arg0, f40_arg1 ) + if f40_arg1 and f40_arg1 ~= "none" then + f40_arg0 = Cac.GetAttachmentUniqueRef( f40_arg0, f40_arg1 ) + end + return Engine.Localize( "@" .. Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f40_arg0, AttachmentTable.Cols.Name ) ) + end + + Cac.GetAttachmentTypeName = function ( f41_arg0 ) + return Cac.AttachmentTypes.Strings[f41_arg0] + end + + Cac.GetAttachmentTypeNameCaps = function ( f42_arg0 ) + return Cac.AttachmentTypes.Caps[f42_arg0] + end + + Cac.GetAttachmentTypeDesc = function ( f43_arg0 ) + return Cac.AttachmentTypes.Descriptions[f43_arg0] + end + + Cac.GetAttachmentDesc = function ( f44_arg0, f44_arg1 ) + if f44_arg1 and f44_arg1 ~= "none" then + f44_arg0 = Cac.GetAttachmentUniqueRef( f44_arg0, f44_arg1 ) + end + return Engine.Localize( "@" .. Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f44_arg0, AttachmentTable.Cols.Desc ) ) + end + + Cac.GetAttachmentNumber = function ( f45_arg0, f45_arg1, f45_arg2, f45_arg3, f45_arg4, f45_arg5 ) + local f45_local0 = Cac.IsAbilityPickedBySlotName( f45_arg0, f45_arg1, f45_arg2, f45_arg3, f45_arg4, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) + local f45_local1 = 0 + if f45_arg5 == Cac.Indices.Weapons.Primary then + if f45_local0 then + local f45_local2 = 3 + end + f45_local1 = f45_local2 or 2 + else + if f45_local0 then + local f45_local3 = 2 + end + f45_local1 = f45_local3 or 1 + end + return f45_local1 + end + + Cac.GetPerk1 = function ( f46_arg0, f46_arg1, f46_arg2, f46_arg3, f46_arg4 ) + return Cac.GetCacConfig( f46_arg0, f46_arg1, f46_arg2, f46_arg3, f46_arg4, "perks", Cac.Indices.Perk1 ) + end + + Cac.GetPerk2 = function ( f47_arg0, f47_arg1, f47_arg2, f47_arg3, f47_arg4 ) + return Cac.GetCacConfig( f47_arg0, f47_arg1, f47_arg2, f47_arg3, f47_arg4, "perks", Cac.Indices.Perk2 ) + end + + Cac.GetPerk3 = function ( f48_arg0, f48_arg1, f48_arg2, f48_arg3, f48_arg4 ) + return Cac.GetCacConfig( f48_arg0, f48_arg1, f48_arg2, f48_arg3, f48_arg4, "perks", Cac.Indices.Perk3 ) + end + + Cac.GetPerkDesc = function ( f49_arg0 ) + return Engine.Localize( "@" .. Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f49_arg0, PerkTable.Cols.Desc ) ) + end + + Cac.GetPerkUnlockReq = function ( f50_arg0 ) + return Cac.GetItemLevel( f50_arg0 ) + end + + Cac.GetPerkUnlockReq = function ( f51_arg0 ) + return Cac.GetItemLevel( f51_arg0 ) + end + + Cac.GetCurrency = function ( f52_arg0 ) + return Engine.GetPlayerDataEx( f52_arg0, CoD.StatsGroup.Ranked, "unlockPoints" ) + end + + Cac.SetCurrency = function ( f53_arg0, f53_arg1 ) + return Engine.SetPlayerDataEx( f53_arg0, CoD.StatsGroup.Ranked, "unlockPoints", f53_arg1 ) + end + + Cac.GetCamoName = function ( f54_arg0 ) + return Engine.Localize( "@" .. Engine.TableLookup( CamoTable.File, CamoTable.Cols.Ref, f54_arg0, CamoTable.Cols.Name ) ) + end + + Cac.GetCamoIndex = function ( f55_arg0 ) + return Engine.TableLookup( CamoTable.File, CamoTable.Cols.Ref, f55_arg0, CamoTable.Cols.Index ) + end + + Cac.GetCamoWeaponIndex = function ( f56_arg0 ) + return Engine.TableLookup( CamoTable.File, CamoTable.Cols.Ref, f56_arg0, CamoTable.Cols.WeapIndex ) + end + + Cac.GetReticleName = function ( f57_arg0 ) + return Engine.Localize( "@" .. Engine.TableLookup( ReticleTable.File, ReticleTable.Cols.Ref, f57_arg0, ReticleTable.Cols.Name ) ) + end + + Cac.GetReticleIndex = function ( f58_arg0 ) + return Engine.TableLookup( ReticleTable.File, ReticleTable.Cols.Ref, f58_arg0, ReticleTable.Cols.Index ) + end + + Cac.GetReticleWeaponIndex = function ( f59_arg0 ) + return Engine.TableLookup( ReticleTable.File, ReticleTable.Cols.Ref, f59_arg0, ReticleTable.Cols.WeapIndex ) + end + + Cac.GetAbilityName = function ( f60_arg0 ) + return Engine.Localize( "@" .. Engine.TableLookup( AbilityTable.File, AbilityTable.Cols.Ref, f60_arg0, AbilityTable.Cols.Name ) ) + end + + Cac.GetAbilityEffectName = function ( f61_arg0, f61_arg1 ) + local f61_local0 = 0 + if f61_arg1 == 1 then + f61_local0 = AbilityTable.Cols.Effect1Name + elseif f61_arg1 == 2 then + f61_local0 = AbilityTable.Cols.Effect2Name + else + f61_local0 = AbilityTable.Cols.Effect1Name + end + return Engine.Localize( "@" .. Engine.TableLookup( AbilityTable.File, AbilityTable.Cols.Ref, f61_arg0, f61_local0 ) ) + end + + Cac.GetAbilityEffectValue = function ( f62_arg0, f62_arg1, f62_arg2 ) + local f62_local0 = 0 + if f62_arg1 == 1 then + f62_local0 = AbilityTable.Cols.Effect1Val0 + elseif f62_arg1 == 2 then + f62_local0 = AbilityTable.Cols.Effect2Val0 + else + f62_local0 = AbilityTable.Cols.Effect1Val0 + end + return Engine.TableLookup( AbilityTable.File, AbilityTable.Cols.Ref, f62_arg0, f62_local0 + f62_arg2 ) + end + + Cac.WeaponHasAttachments = function ( f63_arg0 ) + local f63_local0 = false + if Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f63_arg0, StatsTable.Cols.WeaponAttachFirst ) ~= "" then + f63_local0 = true + end + return f63_local0 + end + + Cac.AreAttachmentsCompatible = function ( f64_arg0, f64_arg1 ) + local f64_local0 = Engine.TableLookupGetRowNum( AttachmentComboTable.File, AttachmentComboTable.Cols.Ref, f64_arg1 ) + local f64_local1 = true + if f64_arg1 ~= "none" and f64_arg0 ~= "none" and Engine.TableLookup( AttachmentComboTable.File, AttachmentComboTable.Cols.Ref, f64_arg0, f64_local0 ) == "no" then + f64_local1 = false + end + return f64_local1 + end + + Cac.DefaultEditChooseStreakTypeAction = function ( f65_arg0, f65_arg1 ) + local f65_local0 = f65_arg0.properties + local f65_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f65_arg0 ) + local f65_local2 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + if f65_local2.defaultFocus and type( f65_local2.defaultFocus ) == "table" then + f65_local2.defaultFocus[#f65_local2.defaultFocus + 1] = f65_local0.itemType + end + Cac.SetPerk( f65_local0.exclusiveController, f65_local1.squadLocation, f65_local1.squadMemberIndex, f65_local1.classLocation, f65_local1.slot, f65_local1.itemIndex, f65_local0.itemType ) + f65_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f65_arg1.controller, + dispatchChildren = true + } ) + local f65_local3 = { + controller = f65_arg1.controller, + slot = f65_local1.slot, + squadLocation = f65_local1.squadLocation, + squadMemberIndex = f65_local1.squadMemberIndex, + classLocation = f65_local1.classLocation, + streakType = f65_local0.itemType, + openMenuOnClose = f65_local1.openMenuOnClose + } + local f65_local4 = false + if f65_local0.itemType == "streaktype_specialist" then + f65_local3.strikePackage = true + f65_local4 = true + else + InitKillstreakArrays( f65_local0.itemType ) + end + f65_arg0:processEvent( { + name = "button_lock" + } ) + f65_arg0:dispatchEventToRoot( { + name = "refresh_specialist_abilities_recap", + controller = f65_arg1.controller, + specialistType = f65_local3.strikePackage, + selected = true + } ) + f65_arg0:dispatchEventToRoot( { + name = "hide_character_image", + immediate = true + } ) + LUI.FlowManager.RequestPopupMenu( f65_arg0, Cac.StreakTypePopupMenus[f65_local0.itemType], true, f65_local0.exclusiveController, f65_local4, f65_local3 ) + end + + Cac.EditChooseSecondPrimary = function ( f66_arg0, f66_arg1 ) + local f66_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f66_arg0 ) + local f66_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + if f66_local1.defaultFocus and type( f66_local1.defaultFocus ) == "table" then + f66_local1.defaultFocus[#f66_local1.defaultFocus + 1] = "twoPrimaries" + end + local f66_local2 = { + squadLocation = f66_local0.squadLocation, + squadMemberIndex = f66_local0.squadMemberIndex, + classLocation = f66_local0.classLocation, + slot = f66_local0.slot, + itemIndex = f66_local0.itemIndex, + titleBarText = Engine.Localize( "MENU_PRIMARY_CAPS" ), + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetWeaponCategoryNameCaps, Cac.EditChooseWeaponTypeAction, Cac.GetWeaponTypes( true ), Cac.GetWeaponClass( Cac.GetWeapon( f66_arg1.controller, f66_local2.squadLocation, f66_local2.squadMemberIndex, f66_local2.classLocation, f66_local2.slot, f66_local2.itemIndex ) ), Cac.GetItemClassDescriptions, nil, Cac.GetWeapon( f66_arg1.controller, f66_local2.squadLocation, f66_local2.squadMemberIndex, f66_local2.classLocation, f66_local2.slot, f66_local2.itemIndex ), nil, Cac.GetWeapon( f66_arg1.controller, f66_local2.squadLocation, f66_local2.squadMemberIndex, f66_local2.classLocation, f66_local2.slot, 1 - f66_local2.itemIndex ), "cac_edit_main" ), + checkRestriction = function ( f67_arg0 ) + local f67_local0, f67_local1 = Cac.SafeGetMatchRule( "commonOption", "weaponClassRestricted", f67_arg0 ) + if f67_local0 then + local f67_local2 = f67_local1 + end + return f67_local2 or Cac.CheckWeaponTypeRestrictions( f67_arg0, f66_arg1.controller ) + end, + restrictType = "weaponRestricted", + editPopupOpenMenuOnClose = f66_local0.openMenuOnClose, + openMenuOnClose = f66_local2, + openMenuOnClose = "cac_edit_popup_main_second" + } + LUI.FlowManager.RequestPopupMenu( f66_arg0, "cac_edit_popup_main_second", true, f66_arg1.controller, true, f66_local2 ) + end + + Cac.EditChooseWeaponTypeAction = function ( f68_arg0, f68_arg1 ) + local f68_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f68_arg0 ) + local f68_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + if f68_local1.defaultFocus and type( f68_local1.defaultFocus ) == "table" then + f68_local1.defaultFocus[#f68_local1.defaultFocus + 1] = f68_arg0.properties.itemType + end + local f68_local2 = "edit_weapon_primary" + if f68_local0.itemIndex == 1 then + f68_local2 = "edit_weapon_secondary" + end + LUI.FlowManager.RequestPopupMenu( f68_arg0, "cac_edit_choose_image_popup", true, f68_arg0.properties.exclusiveController, true, { + squadMemberIndex = f68_local0.squadMemberIndex, + squadLocation = f68_local0.squadLocation, + slot = f68_local0.slot, + classLocation = f68_local0.classLocation, + itemIndex = f68_local0.itemIndex, + itemTypeString = Cac.WeaponTypes.WeaponTypeStrings.Cap[f68_arg0.properties.itemType], + disableSetDefaultFocus = f68_local0.disableSetDefaultFocus, + selection_id = f68_local2, + ImageFunction = Cac.GetWeaponBWImage, + ItemGetFunction = Cac.GetWeapon, + ItemSetFunction = Cac.SetWeapon, + itemList = Cac.GetWeaponList( f68_arg0.properties.itemType, f68_arg0.properties.exclusiveController ), + ItemGetNameFunction = Cac.GetWeaponName, + ImageDimensions = Cac.Layout.ChooseWeaponIcon, + overrideChooseAction = f68_local0.overrideChooseAction, + overrideChooseDisableCheck = f68_local0.overrideChooseDisableCheck, + openMenuOnClose = f68_local0.openMenuOnClose, + restrictType = f68_local0.restrictType, + noNewIcons = f68_local0.noNewIcons, + customTop = f68_local0.customTop, + customLeft = f68_local0.customLeft, + customRight = f68_local0.customRight, + customBottom = f68_local0.customBottom + } ) + end + + Cac.EditPopupButtonsFactory = function ( f69_arg0, f69_arg1, f69_arg2, f69_arg3, f69_arg4, f69_arg5, f69_arg6, f69_arg7, f69_arg8, f69_arg9, f69_arg10, f69_arg11 ) + return function () + local f70_local0 = function ( f71_arg0, f71_arg1 ) + local f71_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f71_arg0 ) + if f71_local0 then + f71_local0.currentHighlightedType = f71_arg0.properties.itemType + end + if f69_arg1 == Cac.EditChooseWeaponTypeAction then + local f71_local1 = { + controller = f71_local0.exclusiveController, + squadLocation = f71_local0.squadLocation, + squadMemberIndex = f71_local0.squadMemberIndex, + classLocation = f71_local0.classLocation, + slot = f71_local0.slot, + selection_id = f71_local0.itemIndex and "edit_weapon_primary" or "edit_weapon_secondary", + weaponIndex = f71_local0.itemIndex, + immediate = true, + dispatchChildren = true, + name = "update_selection_info" + } + f71_arg0:dispatchEventToRoot( f71_local1 ) + f71_local1.name = "refresh_info_pane" + f71_arg0:dispatchEventToRoot( f71_local1 ) + end + if MatchRules.AllowCustomClasses( f71_local0.classLocation ) then + if f71_arg0.restricted then + f71_arg0:dispatchEventToRoot( { + name = "show_class_restrictions_warning", + immediate = true + } ) + else + f71_arg0:dispatchEventToRoot( { + name = "hide_class_restrictions_warning", + immediate = true + } ) + end + end + local f71_local1 = f71_arg0:getParent() + f71_local1:processEvent( { + name = "update_loadout_description_text", + description_text = f71_arg0.properties.desc_text + } ) + end + + local f70_local1 = {} + local f70_local2 = true + if disableSetDefaultFocus then + f70_local2 = false + end + local f70_local3 = nil + if f69_arg9 then + f70_local3 = LUI.FlowManager.GetMenuScopedDataByMenuName( f69_arg9 ) + if not f70_local3.defaultFocus or not type( f70_local3.defaultFocus ) == "table" then + f70_local3.defaultFocus = {} + end + end + if f69_arg1 == Cac.EditChooseWeaponTypeAction then + local f70_local4 = false + if f70_local2 and (f69_arg3 == "" or f69_arg6 and f69_arg6 == "iw6_knifeonly") and f70_local3 and not f70_local3.defaultFocus then + f70_local4 = true + end + f70_local1[#f70_local1 + 1] = { + type = "UIGenericButton", + id = "cac_edit_type_none", + listDefaultFocus = f70_local4, + properties = { + button_text = Engine.Localize( "LUA_MENU_NONE_CAPS" ), + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text_align_without_content = LUI.Alignment.Left, + desc_text = "", + additional_handlers = { + button_action = function ( f72_arg0, f72_arg1 ) + local f72_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f72_arg0 ) + local f72_local1 = f72_local0.itemIndex and "iw6_knifeonly" or "none" + local f72_local2 = Cac.GetWeapon( f72_arg1.controller, f72_local0.squadLocation, f72_local0.squadMemberIndex, f72_local0.classLocation, f72_local0.slot, f72_local0.itemIndex ) + Cac.SetWeapon( f72_arg1.controller, f72_local0.squadLocation, f72_local0.squadMemberIndex, f72_local0.classLocation, f72_local0.slot, f72_local0.itemIndex, f72_local1 ) + LUI.FlowManager.RequestLeaveMenu( f72_arg0 ) + if f72_local1 ~= f72_local2 then + f72_arg0:dispatchEventToRoot( { + name = "refresh_abilities_recap", + controller = f72_arg1.controller, + specialistType = false, + item = f72_local1 + } ) + end + f72_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f72_arg1.controller, + dispatchChildren = true + } ) + end, + button_over = function ( f73_arg0, f73_arg1 ) + local f73_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f73_arg0 ) + f73_arg0:dispatchEventToRoot( { + name = "hide_class_restrictions_warning", + immediate = true + } ) + local f73_local1 = f73_arg0:getParent() + f73_local1:processEvent( { + name = "update_loadout_description_text", + description_text = f73_local0.itemIndex and Engine.Localize( "@LUA_MENU_WEAPTYPE_KNIFE_ONLY_DESC" ) or Engine.Localize( "LUA_MENU_SECONDARY_NONE" ) + } ) + end, + button_over_disable = nil, + menu_create = function ( f74_arg0, f74_arg1 ) + local f74_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f74_arg0 ) + f74_arg0:setText( f74_local0.itemIndex and Engine.Localize( "@LUA_MENU_KNIFE_ONLY_CAPS" ) or Engine.Localize( "LUA_MENU_NONE_CAPS" ) ) + end + } + } + } + end + assert( f70_local3 and f70_local3.exclusiveController ) + for f70_local9, f70_local10 in ipairs( f69_arg2 ) do + if f70_local10 == "weapon_riot" then + local f70_local7 = f69_arg8 + local f70_local8 = Cac.GetWeaponList( f70_local10, f70_local3.exclusiveController ) + if f70_local7 ~= f70_local8[1] then + + else + + end + end + local f70_local7 = false + if not (not f70_local2 or f69_arg3 ~= f70_local10 or f69_arg9) or f70_local2 and f70_local3 and f70_local3.defaultFocus[#f70_local3.defaultFocus] == f70_local10 then + f70_local7 = true + if f69_arg9 then + table.remove( f70_local3.defaultFocus ) + end + end + assert( f69_arg0( f70_local10 ) ) + f70_local1[#f70_local1 + 1] = { + type = "UIGenericButton", + id = "cac_edit_type_" .. f70_local10, + listDefaultFocus = f70_local7, + disabled = f69_arg10 and f69_arg10() or false, + audio = { + button_over = CoD.SFX.SubMenuMouseOver + }, + properties = { + button_text = f69_arg0( f70_local10 ), + variant = f69_arg5 and GenericButtonSettings.Variants.Checkbox or GenericButtonSettings.Variants.Plain, + itemType = f70_local10, + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text_align_without_content = LUI.Alignment.Left, + disable_padlock = true, + desc_text = f69_arg4( f70_local10 ), + disableSound = CoD.SFX.DenySelect, + additional_handlers = { + button_action = function ( f75_arg0, f75_arg1 ) + local f75_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f75_arg0 ) + if f70_local10 == "weapon_riot" and Cac.IsItemUnlocked( f75_arg1.controller, f75_local0.squadLocation, f75_local0.squadMemberIndex, "iw6_riotshield" ) and not f69_arg5 and not f69_arg11 then + local f75_local1 = Cac.SetWeapon + local f75_local2 = f75_arg1.controller + local f75_local3 = f75_local0.squadLocation + local f75_local4 = f75_local0.squadMemberIndex + local f75_local5 = f75_local0.classLocation + local f75_local6 = f75_local0.slot + local f75_local7 = f75_local0.itemIndex + local f75_local8 = Cac.GetWeaponList( f70_local10, f75_arg1.controller ) + f75_local1( f75_local2, f75_local3, f75_local4, f75_local5, f75_local6, f75_local7, f75_local8[1] ) + f75_arg0:dispatchEventToRoot( { + name = "update_squad_member_window_stowed_weapon", + weapon = Cac.BuildSecondaryWeaponName( f75_arg1.controller, f75_local0.squadLocation, f75_local0.squadMemberIndex, f75_local0.classLocation, f75_local0.slot ) + } ) + LUI.FlowManager.RequestLeaveMenu( f75_arg0 ) + f75_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f75_arg1.controller, + dispatchChildren = true + } ) + f75_arg0:dispatchEventToRoot( { + name = "refresh_abilities_recap", + controller = f75_arg1.controller, + specialistType = false, + item = "iw6_riotshield" + } ) + else + f69_arg1( f75_arg0, f75_arg1 ) + end + end, + button_over = f70_local0, + button_over_disable = f70_local0, + unlock_edit_popup = function ( f76_arg0, f76_arg1 ) + f76_arg0:processEvent( { + name = "button_unlock" + } ) + if f69_arg9 then + table.remove( f70_local3.defaultFocus ) + end + end, + menu_create = function ( f77_arg0, f77_arg1 ) + local f77_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f77_arg0 ) + if f77_local0.checkRestriction and f77_local0.checkRestriction( f77_arg0.properties.itemType, f77_arg0.properties.exclusiveController ) and MatchRules.AllowCustomClasses( f77_local0.classLocation ) then + local f77_local1 = Cac.GetRestrictIcon( 0, 2, 28 ) + f77_local1.id = "new_icon" .. f70_local10 + f77_arg0.restricted = true + f77_arg0:addElement( f77_local1 ) + else + f77_arg0.restricted = false + end + if f77_arg0.restricted == false and not f77_local0.noNewIcons and Cac.AnyNewIconsForWeaponsOfClass( f77_local0.exclusiveController, f77_arg0.properties.itemType ) then + local f77_local1 = Cac.GetRestrictIcon( 0, 2, 28 ) + f77_local1.id = "new_icon_2" + f77_local1:setImage( RegisterMaterial( "icon_new_2" ) ) + f77_arg0:addElement( f77_local1 ) + f77_arg0:registerEventHandler( "refresh_new_icons", function ( element, event ) + local f78_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if not Cac.AnyNewIconsForWeaponsOfClass( f78_local0.exclusiveController, element.properties.itemType ) then + local f78_local1 = element:getChildById( "new_icon_2" ) + if f78_local1 then + f78_local1:close() + end + end + end ) + end + if f69_arg5 then + f69_arg5( f77_arg0 ) + end + end, + allow = function ( f79_arg0, f79_arg1 ) + f79_arg0.restricted = false + end, + restrict = function ( f80_arg0, f80_arg1 ) + f80_arg0.restricted = true + end + } + } + } + end + if f69_arg7 then + f70_local4 = false + if not (not f70_local2 or not Cac.IsWeaponClassPrimary( f69_arg3 ) or f69_arg9) or not (not f70_local2 or not f70_local3 or f70_local3.defaultFocus[#f70_local3.defaultFocus] ~= "twoPrimaries") or f70_local2 and f70_local3 and Cac.IsWeaponClassPrimary( f70_local3.defaultFocus[#f70_local3.defaultFocus] ) then + f70_local4 = true + if f69_arg9 then + table.remove( f70_local3.defaultFocus ) + end + end + f70_local1[#f70_local1 + 1] = { + type = "UIGenericButton", + id = "cac_edit_secondary_primary", + listDefaultFocus = f70_local4, + properties = { + itemType = "weapon_pistol", + button_text = Engine.Localize( "MENU_PRIMARY_CAPS" ), + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text_align_without_content = LUI.Alignment.Left, + desc_text = Engine.Localize( "@LUA_MENU_SELECT_SECOND_PRIMARY" ), + additional_handlers = { + button_action = function ( f81_arg0, f81_arg1 ) + Cac.EditChooseSecondPrimary( f81_arg0, f81_arg1 ) + end, + button_over = f70_local0, + button_over_disable = f70_local0, + unlock_edit_popup = MBh.EmitEvent( { + name = "button_unlock" + } ) + } + }, + children = { + { + type = "UIImage", + id = "cac_edit_secondary_primary_new_icon", + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = -32, + right = 0, + top = -28, + bottom = 4, + material = RegisterMaterial( "icon_perks_overkill" ), + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + menu_create = function ( f82_arg0, f82_arg1 ) + if Engine.InFrontend() then + local f82_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f82_arg0 ) + if Cac.IsAbilityPickedBySlotName( f82_local0.controller, f82_local0.squadLocation, f82_local0.squadMemberIndex, f82_local0.classLocation, f82_local0.slot, "Elite", "specialty_twoprimaries", "abilitiesPicked" ) and Cac.IsWeaponClassSecondary( Cac.GetWeaponClass( Cac.GetWeapon( f82_local0.controller, f82_local0.squadLocation, f82_local0.squadMemberIndex, f82_local0.classLocation, f82_local0.slot, 1 ) ), true ) then + f82_arg0:animateToState( "visible" ) + else + f82_arg0:animateToState( "default" ) + end + end + end + } + } + } + } + end + f70_local1[#f70_local1 + 1] = { + type = "UIElement", + id = "cac_choose_type_button_spacer", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = GenericButtonDims.button_height + } + } + } + f70_local1[#f70_local1 + 1] = { + type = "UIText", + id = "cac_choose_type_button_description_id", + properties = { + text = "" + }, + handlers = { + update_loadout_description_text = function ( f83_arg0, f83_arg1 ) + f83_arg0:setText( f83_arg1.description_text ) + end + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 4, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left, + alpha = 0.5 + } + } + } + return f70_local1 + end + + end + + Cac.GetWeaponTypes = function ( f84_arg0 ) + if f84_arg0 then + return Cac.WeaponTypes.Primary + else + return Cac.WeaponTypes.Secondary + end + end + + Cac.GetWeaponList = function ( f85_arg0, f85_arg1 ) + assert( Cac.Weapons[f85_arg0] ) + local f85_local0 = {} + for f85_local5, f85_local6 in ipairs( Cac.Weapons[f85_arg0] ) do + local f85_local4 = Cac.IsWeaponEntitlement( f85_local6 ) + if f85_local4 then + f85_local4 = Cac.ShouldHideWeaponEntitlement( f85_arg1, f85_local6 ) + end + if not f85_local4 then + f85_local0[#f85_local0 + 1] = f85_local6 + end + end + return f85_local0 + end + + Cac.GetWeaponListReleased = function ( f86_arg0 ) + assert( Cac.Weapons[f86_arg0] ) + local f86_local0 = {} + for f86_local5, f86_local6 in ipairs( Cac.Weapons[f86_arg0] ) do + local f86_local7 = Engine.TableLookup( Cac.WeaponUnlockTable.File, Cac.WeaponUnlockTable.Cols.WeaponRef, f86_local6, Cac.WeaponUnlockTable.Cols.ReleaseKillswitch ) + local f86_local4 + if f86_local7 ~= "" and Engine.GetDvarInt( f86_local7 ) ~= 1 then + f86_local4 = false + else + f86_local4 = true + end + if f86_local4 then + f86_local0[#f86_local0 + 1] = f86_local6 + end + end + return f86_local0 + end + + Cac.IsWeaponEntitlement = function ( f87_arg0 ) + local f87_local0 = Engine.TableLookup( Cac.WeaponUnlockTable.File, Cac.WeaponUnlockTable.Cols.WeaponRef, f87_arg0, Cac.WeaponUnlockTable.Cols.IsEntitlement ) + local f87_local1 + if f87_local0 ~= "1" and f87_local0 ~= "2" and f87_local0 ~= "3" then + f87_local1 = false + else + f87_local1 = true + end + return f87_local1 + end + + Cac.IsWeaponEntitlementUnlocked = function ( f88_arg0, f88_arg1, f88_arg2 ) + return Cac.IsWeaponItemUnlocked( f88_arg0, { + UnlockType = "Weapon" + }, f88_arg1, f88_arg2 ) + end + + Cac.ShouldHideWeaponEntitlement = function ( f89_arg0, f89_arg1 ) + return Cac.ShouldConcealCacItem( f89_arg0, { + UnlockType = "Weapon", + csv = Cac.WeaponUnlockTable.File, + IsEntitlementColumn = Cac.WeaponUnlockTable.Cols.IsEntitlement, + HideUnlessUnlockedColumn = Cac.WeaponUnlockTable.Cols.HideIfLocked, + ReleaseKillswitch = Cac.WeaponUnlockTable.Cols.ReleaseKillswitch + }, f89_arg1 ) + end + + Cac.GetGameModeList = function ( f90_arg0 ) + local f90_local0 = {} + local f90_local1 = 0 + local f90_local2 = 1000 + for f90_local3 = f90_local1, f90_local2, 1 do + local f90_local6 = Engine.TableLookupByRow( GameTypesTable.File, f90_local3, GameTypesTable.Cols.Category ) + if f90_local6 == "" then + break + elseif f90_local6 == f90_arg0 then + table.insert( f90_local0, Engine.TableLookupByRow( GameTypesTable.File, f90_local3, GameTypesTable.Cols.Ref ) ) + end + end + return f90_local0 + end + + Cac.GetGameModeTypeString = function ( f91_arg0 ) + local f91_local0 = assert + local f91_local1 + if f91_arg0 ~= "Standard" and f91_arg0 ~= "Alternate" then + f91_local1 = false + else + f91_local1 = true + end + f91_local0( f91_local1 ) + if f91_arg0 == "Alternate" then + return Engine.Localize( "@LUA_MENU_ALTERNATE_MODES" ) + else + return Engine.Localize( "@LUA_MENU_STANDARD_MODES" ) + end + end + + Cac.WeaponHasAttachmentsOfType = function ( f92_arg0, f92_arg1 ) + local f92_local0 = Cac.GetAttachmentTypeList( f92_arg0 ) + local f92_local1 = false + for f92_local5, f92_local6 in ipairs( f92_local0 ) do + if f92_local6 == f92_arg1 then + f92_local1 = true + break + end + end + return f92_local1 + end + + Cac.GetAttachmentListByType = function ( f93_arg0, f93_arg1 ) + local f93_local0 = {} + for f93_local1 = StatsTable.Cols.WeaponAttachFirst, StatsTable.Cols.WeaponAttachLast, 1 do + local f93_local4 = Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f93_arg0, f93_local1 ) + if f93_local4 ~= "" then + if Cac.GetAttachmentType( f93_local4 ) == f93_arg1 then + f93_local0[#f93_local0 + 1] = f93_local4 + end + end + end + return f93_local0 + end + + Cac.GetGrenadeList = function ( f94_arg0 ) + if f94_arg0 == 0 then + return Cac.PrimaryGrenades + elseif f94_arg0 == 1 then + return Cac.SecondaryGrenades + else + + end + end + + Cac.GetGrenadeListNoNone = function ( f95_arg0 ) + local f95_local0 = {} + if f95_arg0 == 0 then + f95_local0 = Cac.PrimaryGrenades + elseif f95_arg0 == 1 then + f95_local0 = Cac.SecondaryGrenades + end + local f95_local1 = {} + for f95_local2 = 2, #f95_local0, 1 do + f95_local1[f95_local2 - 1] = f95_local0[f95_local2] + end + return f95_local1 + end + + Cac.GetPerkList = function ( f96_arg0 ) + return Cac.Perks[f96_arg0] + end + + Cac.GetPerkTypeDescription = function ( f97_arg0 ) + return Engine.Localize( Cac.PerkTypes.Descriptions[f97_arg0] ) + end + + Cac.GetPerkTypeNames = function ( f98_arg0 ) + return Engine.Localize( Cac.PerkTypes.Strings[f98_arg0] ) + end + + Cac.UpdateCamoGoldChallenge = function ( f99_arg0, f99_arg1, f99_arg2 ) + if f99_arg1 == "iw6_knifeonly" or f99_arg1 == "uav" then + return false + elseif Cac.IsCamoChallengeComplete( f99_arg0, f99_arg1, CamoTable.GoldRef ) then + return false + else + local f99_local0, f99_local1 = Cac.CountCamosForGold( f99_arg0, f99_arg1 ) + if f99_local1 <= f99_local0 then + if f99_arg2 then + local f99_local2 = Cac.GetCamoChallengeRef( f99_arg1, CamoTable.GoldRef ) + local f99_local3 = Cac.GetCamoChallengeTier( f99_arg1, CamoTable.GoldRef ) + Engine.SetPlayerDataEx( f99_arg0, CoD.StatsGroup.Ranked, "challengeState", f99_local2, 2 ) + end + return true + else + return false + end + end + end + + Cac.CountCamosForGold = function ( f100_arg0, f100_arg1 ) + local f100_local0 = 0 + local f100_local1 = 0 + for f100_local5, f100_local6 in ipairs( Cac.GetCamoList( f100_arg0, f100_arg1 ) ) do + if f100_local6 ~= "none" and f100_local6 ~= CamoTable.GoldRef and CamoTable.GlobalList[f100_local6] == nil and Cac.IsCamoOrReticleEntitlement( f100_local6 ) == false then + f100_local0 = f100_local0 + 1 + if Cac.IsCamoChallengeComplete( f100_arg0, f100_arg1, f100_local6 ) then + f100_local1 = f100_local1 + 1 + end + end + end + return f100_local1, f100_local0 + end + + Cac.GetCamoList = function ( f101_arg0, f101_arg1 ) + if f101_arg1 == "iw6_knifeonly" or f101_arg1 == "uav" then + local f101_local0 = {} + return Engine.TableLookup( CamoTable.File, CamoTable.Cols.Index, CamoTable.ColIndexNone, CamoTable.Cols.Ref ) + end + local f101_local0 = 0 + local f101_local1 = "" + local f101_local2 = {} + repeat + f101_local1 = Engine.TableLookup( CamoTable.File, CamoTable.Cols.Index, tostring( f101_local0 ), CamoTable.Cols.Ref ) + local f101_local3 + if f101_local1 ~= "none" then + f101_local3 = Cac.IsCamoOrReticleEntitlement( f101_local1 ) + if f101_local3 then + f101_local3 = Cac.ShouldHideCamoOrReticleEntitlement( f101_arg0, f101_local1 ) + end + else + f101_local3 = false + end + if f101_local1 ~= "" and not f101_local3 then + f101_local2[#f101_local2 + 1] = f101_local1 + end + f101_local0 = f101_local0 + 1 + until f101_local1 == "" + return f101_local2 + end + + Cac.GetCamoChallengeRef = function ( f102_arg0, f102_arg1 ) + local f102_local0 = nil + local f102_local1 = Cac.GetCamoRefUnique( f102_arg0, f102_arg1 ) + if CamoTable.GlobalList[f102_local1] then + f102_local0 = Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f102_local1, CamoReticleUnlockTable.Cols.ChallengeRef ) + else + f102_local0 = string.format( "ch_%s%s", f102_arg0, Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f102_local1, CamoReticleUnlockTable.Cols.ChallengeRef ) ) + end + return f102_local0 + end + + Cac.GetCamoOrReticleChallengeTier = function ( f103_arg0 ) + return Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f103_arg0, CamoReticleUnlockTable.Cols.Tier ) + end + + Cac.GetCamoOrReticleChallengeTitle = function ( f104_arg0 ) + return Engine.TableLookup( AllChallengesTable.File, AllChallengesTable.Cols.Ref, f104_arg0, AllChallengesTable.Cols.Label ) + end + + Cac.GetCamoOrReticleChallengeDesc = function ( f105_arg0 ) + return Engine.TableLookup( AllChallengesTable.File, AllChallengesTable.Cols.Ref, f105_arg0, AllChallengesTable.Cols.Desc ) + end + + Cac.GetCamoChallengeTier = function ( f106_arg0, f106_arg1 ) + return Cac.GetCamoOrReticleChallengeTier( Cac.GetCamoRefUnique( f106_arg0, f106_arg1 ) ) + end + + Cac.GetCamoChallengeProgress = function ( f107_arg0, f107_arg1, f107_arg2 ) + return Cac.GetCamoOrReticleChallengeProgress( f107_arg0, Cac.GetCamoChallengeRef( f107_arg1, f107_arg2 ) ) + end + + Cac.GetCamoChallengeSuffix = function ( f108_arg0 ) + return Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f108_arg0, CamoReticleUnlockTable.Cols.ChallengeRef ) + end + + Cac.GetCamoRefUnique = function ( f109_arg0, f109_arg1 ) + local f109_local0 = nil + if CamoTable.GlobalList[f109_arg1] then + f109_local0 = f109_arg1 + else + f109_local0 = string.format( "%s_%s", Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f109_arg0, StatsTable.Cols.WeaponClass ), f109_arg1 ) + end + return f109_local0 + end + + Cac.GetCamoChallengeTotal = function ( f110_arg0, f110_arg1, f110_arg2 ) + local f110_local0 = Cac.GetCamoChallengeRef( f110_arg1, f110_arg2 ) + local f110_local1 = Cac.GetCamoRefUnique( f110_arg1, f110_arg2 ) + if string.find( f110_local0, "_allcamo" ) then + local f110_local2, f110_local3 = Cac.CountCamosForGold( f110_arg0, f110_arg1 ) + return f110_local3 + else + return Cac.GetCamoOrReticleChallengeTotal( f110_local0, f110_local1 ) + end + end + + Cac.IsCamoChallengeComplete = function ( f111_arg0, f111_arg1, f111_arg2 ) + return Cac.IsCamoOrReticleChallengeComplete( f111_arg0, Cac.GetCamoChallengeRef( f111_arg1, f111_arg2 ), Cac.GetCamoRefUnique( f111_arg1, f111_arg2 ) ) + end + + Cac.IsCamoOrReticleEntitlement = function ( f112_arg0 ) + local f112_local0 = Cac.GetCamoOrReticleEntitlementType( f112_arg0 ) + local f112_local1 + if f112_local0 ~= "1" and f112_local0 ~= "2" and f112_local0 ~= "3" then + f112_local1 = false + else + f112_local1 = true + end + return f112_local1 + end + + Cac.GetCamoOrReticleEntitlementType = function ( f113_arg0 ) + return Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f113_arg0, CamoReticleUnlockTable.Cols.IsEntitlement ) + end + + Cac.IsCamoOrReticleHideIfLocked = function ( f114_arg0 ) + return "1" == Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f114_arg0, CamoReticleUnlockTable.Cols.HideIfLocked ) + end + + Cac.IsCamoOrReticleUnlockedInPrivate = function ( f115_arg0 ) + local f115_local0 + if Cac.IsCamoOrReticleEntitlement( f115_arg0 ) and (Cac.GetCamoOrReticleEntitlementType( f115_arg0 ) ~= "1" or Cac.IsCamoOrReticleHideIfLocked( f115_arg0 ) ~= false) then + f115_local0 = false + else + f115_local0 = true + end + return f115_local0 + end + + Cac.IsCamoOrReticleDLC = function ( f116_arg0 ) + return "2" == Cac.GetCamoOrReticleEntitlementType( f116_arg0 ) + end + + Cac.IsCamoOrReticleEntitlementUnlocked = function ( f117_arg0, f117_arg1, f117_arg2 ) + return Cac.IsCamoReticleItemUnlocked( f117_arg0, { + UnlockType = "CamoReticle" + }, f117_arg1, f117_arg2 ) + end + + Cac.ShouldHideCamoOrReticleEntitlement = function ( f118_arg0, f118_arg1 ) + return Cac.ShouldConcealCacItem( f118_arg0, { + UnlockType = "CamoReticle", + csv = CamoReticleUnlockTable.File, + IsEntitlementColumn = CamoReticleUnlockTable.Cols.IsEntitlement, + HideUnlessUnlockedColumn = CamoReticleUnlockTable.Cols.HideIfLocked, + ReleaseKillswitch = CamoReticleUnlockTable.Cols.ReleaseKillswitch + }, f118_arg1 ) + end + + Cac.GetCamoOrReticleEntitlementTitle = function ( f119_arg0 ) + return Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f119_arg0, CamoReticleUnlockTable.Cols.Title ) + end + + Cac.GetCamoOrReticleEntitlementDesc = function ( f120_arg0 ) + return Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f120_arg0, CamoReticleUnlockTable.Cols.Desc ) + end + + Cac.GetReticleDefault = function ( f121_arg0 ) + return f121_arg0 .. "def" + end + + Cac.GetReticleList = function ( f122_arg0, f122_arg1 ) + local f122_local0 = {} + if f122_arg1 then + f122_local0[#f122_local0 + 1] = Cac.GetReticleDefault( f122_arg1 ) + for f122_local4, f122_local5 in ipairs( Cac.Reticles.Generics ) do + f122_local0[#f122_local0 + 1] = f122_local5 + end + for f122_local1 = 1, Cac.Reticles.NumCustom, 1 do + f122_local0[#f122_local0 + 1] = string.format( "%s%02d", f122_arg1, f122_local1 ) + end + f122_local0[#f122_local0 + 1] = Cac.Reticles.ClanReward + f122_local1 = 0 + f122_local2 = "" + repeat + f122_local2 = Engine.TableLookupByRow( ReticleTable.File, f122_local1, ReticleTable.Cols.Ref ) + if f122_local2 and f122_local2 ~= "" and Cac.IsCamoOrReticleEntitlement( f122_local2 ) and not Cac.ShouldHideCamoOrReticleEntitlement( f122_arg0, f122_local2 ) then + f122_local0[#f122_local0 + 1] = f122_local2 + end + f122_local1 = f122_local1 + 1 + if f122_local2 then + + end + until f122_local2 == "" + else + f122_local0 = { + Cac.Reticles.None + } + end + return f122_local0 + end + + Cac.GetReticleRefUnique = function ( f123_arg0, f123_arg1 ) + return string.format( "%s_%s", f123_arg0, f123_arg1 ) + end + + Cac.GetReticleChallengeRef = function ( f124_arg0, f124_arg1 ) + local f124_local0 = Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, string.format( "%s_%s", f124_arg0, f124_arg1 ), CamoReticleUnlockTable.Cols.ChallengeRef ) + if f124_local0 == "" then + f124_local0 = nil + end + return f124_local0 + end + + Cac.GetReticleChallenge = function ( f125_arg0 ) + return Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f125_arg0, CamoReticleUnlockTable.Cols.ChallengeRef ) + end + + Cac.GetReticleChallengeTotal = function ( f126_arg0, f126_arg1 ) + return Cac.GetCamoOrReticleChallengeTotal( Cac.GetReticleChallengeRef( f126_arg0, f126_arg1 ), Cac.GetReticleRefUnique( f126_arg0, f126_arg1 ) ) + end + + Cac.IsReticleChallengeComplete = function ( f127_arg0, f127_arg1, f127_arg2 ) + return Cac.IsCamoOrReticleChallengeComplete( f127_arg0, Cac.GetReticleChallengeRef( f127_arg1, f127_arg2 ), Cac.GetReticleRefUnique( f127_arg1, f127_arg2 ) ) + end + + Cac.IsReticleValid = function ( f128_arg0, f128_arg1, f128_arg2 ) + if not f128_arg1 or not f128_arg2 then + return false + elseif f128_arg2 == Cac.Reticles.None then + return false + end + for f128_local3, f128_local4 in ipairs( Cac.GetReticleList( f128_arg0, f128_arg1 ) ) do + if f128_local4 == f128_arg2 then + return true + end + end + return false + end + + Cac.GetCamoOrReticleChallengeProgress = function ( f129_arg0, f129_arg1 ) + if string.find( f129_arg1, "_allcamo" ) then + local f129_local0, f129_local1 = Cac.CountCamosForGold( f129_arg0, getWeaponOperationWeaponName( f129_arg1 ) ) + return f129_local0 + else + return Engine.GetPlayerDataEx( f129_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f129_arg1 ) + end + end + + Cac.GetCamoOrReticleChallengeTotal = function ( f130_arg0, f130_arg1 ) + return tonumber( Engine.TableLookup( AllChallengesTable.File, AllChallengesTable.Cols.Ref, f130_arg0, AllChallengesTable.Cols["Target" .. Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f130_arg1, CamoReticleUnlockTable.Cols.Tier )] ) ) + end + + Cac.IsCamoOrReticleChallengeComplete = function ( f131_arg0, f131_arg1, f131_arg2 ) + if not IsPublicMatch() then + return true + else + return tonumber( Engine.TableLookup( CamoReticleUnlockTable.File, CamoReticleUnlockTable.Cols.CamoReticleRef, f131_arg2, CamoReticleUnlockTable.Cols.Tier ) ) < Engine.GetPlayerDataEx( f131_arg0, CoD.StatsGroup.Ranked, "challengeState", f131_arg1 ) + end + end + + Cac.SetAttachment = function ( f132_arg0, f132_arg1, f132_arg2, f132_arg3, f132_arg4, f132_arg5, f132_arg6, f132_arg7 ) + Cac.SetCacConfig( f132_arg0, f132_arg1, f132_arg2, f132_arg3, f132_arg4, "weaponSetups", f132_arg5, "attachment", f132_arg6, f132_arg7 ) + end + + Cac.SetLoadoutItem = function ( f133_arg0, f133_arg1, f133_arg2, f133_arg3, f133_arg4, f133_arg5, f133_arg6, f133_arg7, f133_arg8, f133_arg9, f133_arg10 ) + for f133_local8, f133_local9 in pairs( f133_arg9 ) do + if f133_arg10 then + for f133_local6, f133_local7 in pairs( f133_arg10 ) do + f133_arg7( f133_arg0, f133_arg1, f133_arg2, f133_arg3, f133_arg4, f133_local9, f133_local7, f133_arg8( f133_arg0, f133_arg1, f133_arg2, f133_arg5, f133_arg6, f133_local9, f133_local7 ) ) + end + end + f133_arg7( f133_arg0, f133_arg1, f133_arg2, f133_arg3, f133_arg4, f133_local9, f133_arg8( f133_arg0, f133_arg1, f133_arg2, f133_arg5, f133_arg6, f133_local9 ) ) + end + end + + Cac.SetAbilities = function ( f134_arg0, f134_arg1, f134_arg2, f134_arg3, f134_arg4, f134_arg5, f134_arg6, f134_arg7 ) + Cac.ResetAbilities( f134_arg0, f134_arg1, f134_arg2, f134_arg3, f134_arg4, f134_arg7, false, true ) + for f134_local4, f134_local5 in pairs( Cac.Abilities.Types ) do + for f134_local3 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.IsAbilityPicked( f134_arg0, f134_arg1, f134_arg2, f134_arg5, f134_arg6, f134_local5, f134_local3 - 1, f134_arg7 ) then + Cac.ToggleAbility( f134_arg0, f134_arg1, f134_arg2, f134_arg3, f134_arg4, f134_local5, f134_local3 - 1, f134_arg7, false, false, true ) + end + end + end + end + + Cac.SetLoadout = function ( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6 ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetWeapon, Cac.GetWeapon, { + Cac.Indices.Weapons.Primary + } ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetAttachment, Cac.GetAttachment, { + Cac.Indices.Weapons.Primary + }, { + Cac.Indices.Attachments.PrimaryAttachment1, + Cac.Indices.Attachments.PrimaryAttachment2, + Cac.Indices.Attachments.PrimaryAttachment3 + } ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetWeaponCamo, Cac.GetCamo, { + Cac.Indices.Weapons.Primary + } ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetWeaponReticle, Cac.GetReticle, { + Cac.Indices.Weapons.Primary + } ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetWeapon, Cac.GetWeapon, { + Cac.Indices.Weapons.Secondary + } ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetAttachment, Cac.GetAttachment, { + Cac.Indices.Weapons.Secondary + }, { + Cac.Indices.Attachments.SecondaryAttachment1, + Cac.Indices.Attachments.SecondaryAttachment2 + } ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetWeaponReticle, Cac.GetReticle, { + Cac.Indices.Weapons.Secondary + } ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetPerk, Cac.GetPerk, { + Cac.Indices.Grenade.Primary + } ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetPerk, Cac.GetPerk, { + Cac.Indices.Grenade.Secondary + } ) + Cac.SetAbilities( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, "abilitiesPicked" ) + local f135_local0 = Cac.GetStreakType( f135_arg0, f135_arg1, f135_arg2, f135_arg5, f135_arg6 ) + local f135_local1 = "specialistBonusStreaks" + if f135_local0 == "specialty_null" then + f135_local0 = "streaktype_assault" + end + f135_local0 = Cac.GetStreakTypeReference( f135_local0 ) + Cac.ResetKillstreak( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_local0 ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetPerk, Cac.GetPerk, { + Cac.Indices.StreakType + } ) + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetKillstreak, Cac.GetStreak, { + f135_local0 + }, { + Cac.Indices.Killstreaks.Streak1, + Cac.Indices.Killstreaks.Streak2, + Cac.Indices.Killstreaks.Streak3 + } ) + if f135_local0 == "specialistStreaks" then + Cac.SetLoadoutItem( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, Cac.SetSpecialistKills, Cac.GetSpecialistKills, { + Cac.Indices.Killstreaks.Streak1, + Cac.Indices.Killstreaks.Streak2, + Cac.Indices.Killstreaks.Streak3 + } ) + Cac.SetAbilities( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, f135_arg5, f135_arg6, f135_local1 ) + end + local f135_local2 = Cac.GetLoadoutName( f135_arg0, f135_arg1, f135_arg2, f135_arg5, f135_arg6 ) + if Cac.IsDefaultClass( f135_arg3 ) then + MatchRules.SetData( "defaultClasses", Cac.Settings.DataLoc[f135_arg3].teamName, f135_arg4, "class", "name", f135_local2 ) + else + Cac.SetCacConfig( f135_arg0, f135_arg1, f135_arg2, f135_arg3, f135_arg4, "name", f135_local2 ) + end + end + + Cac.SetWeaponCamo = function ( f136_arg0, f136_arg1, f136_arg2, f136_arg3, f136_arg4, f136_arg5, f136_arg6 ) + Cac.SetCacConfig( f136_arg0, f136_arg1, f136_arg2, f136_arg3, f136_arg4, "weaponSetups", f136_arg5, "camo", f136_arg6 ) + end + + Cac.SetWeaponBuff = function ( f137_arg0, f137_arg1, f137_arg2, f137_arg3, f137_arg4, f137_arg5, f137_arg6 ) + Cac.SetCacConfig( f137_arg0, f137_arg1, f137_arg2, f137_arg3, f137_arg4, "weaponSetups", f137_arg5, "buff", f137_arg6 ) + end + + Cac.SetWeaponReticle = function ( f138_arg0, f138_arg1, f138_arg2, f138_arg3, f138_arg4, f138_arg5, f138_arg6 ) + Cac.SetCacConfig( f138_arg0, f138_arg1, f138_arg2, f138_arg3, f138_arg4, "weaponSetups", f138_arg5, "reticle", f138_arg6 ) + end + + Cac.SetWeaponToDefaultUnlock = function ( f139_arg0, f139_arg1, f139_arg2, f139_arg3, f139_arg4 ) + local f139_local0 + if f139_arg4 == Cac.Indices.Weapons.Primary then + f139_local0 = "iw6_sc2010" + if not f139_local0 then + + else + Cac.SetCacConfig( f139_arg0, f139_arg1, f139_arg2, "loadouts", f139_arg3, "weaponSetups", f139_arg4, "weapon", f139_local0 ) + Cac.SetCacConfig( f139_arg0, f139_arg1, f139_arg2, "loadouts", f139_arg3, "weaponSetups", f139_arg4, "attachment", 0, "none" ) + Cac.SetCacConfig( f139_arg0, f139_arg1, f139_arg2, "loadouts", f139_arg3, "weaponSetups", f139_arg4, "attachment", 1, "none" ) + if f139_arg4 == Cac.Indices.Weapons.Primary then + Cac.SetCacConfig( f139_arg0, f139_arg1, f139_arg2, "loadouts", f139_arg3, "weaponSetups", f139_arg4, "attachment", 2, "none" ) + Cac.SetCacConfig( f139_arg0, f139_arg1, f139_arg2, "loadouts", f139_arg3, "weaponSetups", f139_arg4, "camo", "none" ) + Cac.SetCacConfig( f139_arg0, f139_arg1, f139_arg2, "loadouts", f139_arg3, "weaponSetups", f139_arg4, "reticle", "none" ) + end + end + end + f139_local0 = "none" + end + + Cac.SetWeapon = function ( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, f140_arg5, f140_arg6 ) + local f140_local0 = Cac.GetWeapon( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, f140_arg5 ) + if f140_local0 ~= f140_arg6 then + Cac.SetAttachment( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, f140_arg5, 0, "none" ) + Cac.SetAttachment( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, f140_arg5, 1, "none" ) + Cac.SetAttachment( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, f140_arg5, 2, "none" ) + Cac.SetWeaponBuff( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, f140_arg5, "none" ) + Cac.SetWeaponCamo( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, f140_arg5, "none" ) + if Cac.WeaponHasReticles( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, f140_arg5 ) then + Cac.SetWeaponReticle( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, f140_arg5, "default" ) + else + Cac.SetWeaponReticle( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, f140_arg5, "none" ) + end + Cac.SetCacConfig( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, "weaponSetups", f140_arg5, "weapon", f140_arg6 ) + if f140_arg5 == 0 then + local f140_local1 = Cac.BuildPrimaryWeaponName( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4 ) + local f140_local2 = Engine.GetLuiRoot() + f140_local2:processEvent( { + name = "weapon_change_start", + new_weapon = f140_local1, + prev_weapon = f140_local0 + } ) + else + local f140_local1 = Engine.GetLuiRoot() + f140_local1:processEvent( { + name = "weapon_changed_stowed", + weapon = f140_arg6 + } ) + end + end + local f140_local1 = Cac.GetWeaponClass( Cac.GetWeapon( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, Cac.Indices.Weapons.Primary ) ) + if f140_local1 == "weapon_assault" then + Cac.SetCacConfig( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, "type", "charactertype_assault" ) + elseif f140_local1 == "weapon_smg" then + Cac.SetCacConfig( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, "type", "charactertype_smg" ) + elseif f140_local1 == "weapon_lmg" then + Cac.SetCacConfig( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, "type", "charactertype_lmg" ) + elseif f140_local1 == "weapon_dmr" then + Cac.SetCacConfig( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, "type", "charactertype_dmr" ) + elseif f140_local1 == "weapon_sniper" then + Cac.SetCacConfig( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, "type", "charactertype_sniper" ) + elseif f140_local1 == "weapon_shotgun" then + Cac.SetCacConfig( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, "type", "charactertype_shotgun" ) + elseif f140_local1 == "weapon_riot" then + Cac.SetCacConfig( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, "type", "charactertype_assault" ) + elseif f140_local1 == "weapon_knifefast" then + Cac.SetCacConfig( f140_arg0, f140_arg1, f140_arg2, f140_arg3, f140_arg4, "type", "charactertype_smg" ) + end + end + + Cac.GetWeaponUnlockRank = function ( f141_arg0 ) + return Engine.TableLookup( getProperUnlockTable( f141_arg0 ), UnlockTable.Cols.ItemId, f141_arg0, UnlockTable.Cols.Rank ) + end + + Cac.SetPerk = function ( f142_arg0, f142_arg1, f142_arg2, f142_arg3, f142_arg4, f142_arg5, f142_arg6 ) + return Cac.SetCacConfig( f142_arg0, f142_arg1, f142_arg2, f142_arg3, f142_arg4, "perks", f142_arg5, f142_arg6 ) + end + + Cac.SetFirstUnlockedGrenade = function ( f143_arg0, f143_arg1, f143_arg2, f143_arg3, f143_arg4, f143_arg5 ) + local f143_local0 = Cac.GetGrenadeList( f143_arg5 ) + for f143_local1 = 1, #f143_local0, 1 do + if Cac.IsItemUnlocked( f143_arg0, f143_arg1, f143_arg2, f143_local0[f143_local1] ) then + Cac.SetPerk( f143_arg0, f143_arg1, f143_arg2, f143_arg3, f143_arg4, f143_arg5, f143_local0[f143_local1] ) + break + end + end + end + + Cac.SetFirstUnlockedPistol = function ( f144_arg0, f144_arg1, f144_arg2, f144_arg3, f144_arg4 ) + local f144_local0 = Cac.GetWeaponList( "weapon_pistol", f144_arg0 ) + for f144_local1 = 1, #f144_local0, 1 do + if Cac.IsItemUnlocked( f144_arg0, f144_arg1, f144_arg2, f144_local0[f144_local1] ) then + Cac.SetWeapon( f144_arg0, f144_arg1, f144_arg2, f144_arg3, f144_arg4, 1, f144_local0[f144_local1] ) + local f144_local4 = Engine.GetLuiRoot() + f144_local4:processEvent( { + name = "weapon_changed_stowed", + weapon = f144_local0[f144_local1] + } ) + return + end + end + Cac.SetWeapon( f144_arg0, f144_arg1, f144_arg2, f144_arg3, f144_arg4, 1, "none" ) + end + + Cac.SetKillstreak = function ( f145_arg0, f145_arg1, f145_arg2, f145_arg3, f145_arg4, f145_arg5, f145_arg6, f145_arg7 ) + return Cac.SetCacConfig( f145_arg0, f145_arg1, f145_arg2, f145_arg3, f145_arg4, f145_arg5, f145_arg6, f145_arg7 ) + end + + Cac.GetKillstreak = function ( f146_arg0, f146_arg1, f146_arg2, f146_arg3, f146_arg4, f146_arg5, f146_arg6 ) + return Cac.GetCacConfig( f146_arg0, f146_arg1, f146_arg2, f146_arg3, f146_arg4, f146_arg5, f146_arg6 ) + end + + Cac.SetSpecialistKills = function ( f147_arg0, f147_arg1, f147_arg2, f147_arg3, f147_arg4, f147_arg5, f147_arg6 ) + return Cac.SetCacConfig( f147_arg0, f147_arg1, f147_arg2, f147_arg3, f147_arg4, "specialistStreakKills", f147_arg5, f147_arg6 ) + end + + Cac.GetSpecialistKills = function ( f148_arg0, f148_arg1, f148_arg2, f148_arg3, f148_arg4, f148_arg5 ) + return Cac.GetCacConfig( f148_arg0, f148_arg1, f148_arg2, f148_arg3, f148_arg4, "specialistStreakKills", f148_arg5 ) + end + + Cac.AttachmentHasReticles = function ( f149_arg0 ) + return Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f149_arg0, AttachmentTable.Cols.Reticles ) == "TRUE" + end + + Cac.GetAttachments = function ( f150_arg0, f150_arg1, f150_arg2, f150_arg3, f150_arg4, f150_arg5 ) + local f150_local0 = {} + local f150_local1 = Cac.GetAttachment( f150_arg0, f150_arg1, f150_arg2, f150_arg3, f150_arg4, f150_arg5, 0 ) + local f150_local2 = Cac.GetAttachment( f150_arg0, f150_arg1, f150_arg2, f150_arg3, f150_arg4, f150_arg5, 1 ) + local f150_local3 = Cac.GetAttachment( f150_arg0, f150_arg1, f150_arg2, f150_arg3, f150_arg4, f150_arg5, 2 ) + return f150_local1 + end + + Cac.GetAttachmentClassInUse = function ( f151_arg0, f151_arg1, f151_arg2, f151_arg3, f151_arg4, f151_arg5, f151_arg6 ) + local f151_local0 = Cac.GetAttachments( f151_arg0, f151_arg1, f151_arg2, f151_arg3, f151_arg4, f151_arg5 ) + for f151_local1 = 1, #f151_local0, 1 do + if Cac.GetAttachmentType( f151_local0[f151_local1] ) == f151_arg6 then + return f151_local1 - 1 + end + end + end + + Cac.EquippedAttachmentsHaveReticles = function ( f152_arg0, f152_arg1, f152_arg2, f152_arg3, f152_arg4, f152_arg5 ) + for f152_local0 = 0, 2, 1 do + if Cac.AttachmentHasReticles( Cac.GetAttachment( f152_arg0, f152_arg1, f152_arg2, f152_arg3, f152_arg4, f152_arg5, f152_local0 ) ) then + return true + end + end + return false + end + + Cac.WeaponHasReticles = function ( f153_arg0, f153_arg1, f153_arg2, f153_arg3, f153_arg4, f153_arg5 ) + local f153_local0 = false + for f153_local1 = 0, 2, 1 do + if Cac.AttachmentHasReticles( Cac.GetAttachment( f153_arg0, f153_arg1, f153_arg2, f153_arg3, f153_arg4, f153_arg5, f153_local1 ) ) then + f153_local0 = true + break + end + end + return f153_local0 + end + + Cac.GetAttachmentWithReticles = function ( f154_arg0, f154_arg1, f154_arg2, f154_arg3, f154_arg4, f154_arg5 ) + local f154_local0, f154_local1 = nil + for f154_local2 = 0, 2, 1 do + local f154_local5 = Cac.GetAttachment( f154_arg0, f154_arg1, f154_arg2, f154_arg3, f154_arg4, f154_arg5, f154_local2 ) + if Cac.AttachmentHasReticles( f154_local5 ) then + f154_local0 = f154_local5 + f154_local1 = f154_local2 + break + end + end + return f154_local0, f154_local1 + end + + Cac.GetMaxAbilityLevel = function ( f155_arg0, f155_arg1, f155_arg2, f155_arg3 ) + return Engine.GetPlayerDataEx( f155_arg0, CoD.GetStatsGroupForGameMode(), f155_arg1 .. "AbilitySlotsUnlocked", f155_arg3 ) + end + + Cac.CountSpentPoints = function ( f156_arg0, f156_arg1, f156_arg2, f156_arg3, f156_arg4, f156_arg5 ) + local f156_local0 = 0 + for f156_local5, f156_local6 in pairs( Cac.Abilities.Types ) do + for f156_local4 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.IsAbilityPicked( f156_arg0, f156_arg1, f156_arg2, f156_arg3, f156_arg4, f156_local6, f156_local4 - 1, f156_arg5 ) then + f156_local0 = f156_local0 + Cac.GetPerkCost( Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f156_local6 ), f156_local4 ) ) + end + end + end + return f156_local0 + end + + Cac.ToggleAbility = function ( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, f157_arg5, f157_arg6, f157_arg7, f157_arg8, f157_arg9, f157_arg10 ) + local f157_local0 = Cac.IsAbilityPicked( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, f157_arg5, f157_arg6, f157_arg7 ) + local f157_local1 + if f157_arg9 then + f157_local1 = Cac.Abilities.Settings.SpecialistCapacity + if not f157_local1 then + + else + local f157_local2 = f157_local1 - Cac.CountSpentPoints( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, f157_arg7 ) + local f157_local3 = Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f157_arg5 ), f157_arg6 + 1 ) + local f157_local4 = tonumber( Cac.GetPerkCost( f157_local3 ) ) + if not f157_local4 then + DebugPrint( "The cost is not defined for the ability being toggled. This is alright as long as the ability you're toggling is placeholder." ) + elseif f157_local0 or f157_local4 <= f157_local2 then + Cac.SetCacConfig( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, f157_arg7, f157_arg5, f157_arg6, not f157_local0 ) + if f157_local3 == "specialty_extra_attachment" and not f157_arg10 then + Cac.SetAttachment( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, 0, 2, "none" ) + Cac.SetAttachment( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, 1, 1, "none" ) + Cac.ValidateReticle( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, 0 ) + elseif f157_local3 == "specialty_twoprimaries" and not f157_arg10 and Cac.IsWeaponClassPrimary( Cac.GetWeaponClass( Cac.GetWeapon( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, 1 ) ) ) then + Cac.SetFirstUnlockedPistol( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4 ) + Cac.SetAttachment( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, 1, 0, "none" ) + Cac.SetAttachment( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4, 1, 1, "none" ) + end + elseif f157_arg8 then + Engine.PlaySound( CoD.SFX.DenySelect ) + end + end + end + f157_local1 = Cac.CalculateAbilityCapacity( f157_arg0, f157_arg1, f157_arg2, f157_arg3, f157_arg4 ) + end + + Cac.RemoveLastPerk = function ( f158_arg0, f158_arg1, f158_arg2, f158_arg3, f158_arg4, f158_arg5, f158_arg6 ) + local f158_local0, f158_local1 = nil + for f158_local7, f158_local8 in ipairs( Cac.GetAbilityTypes() ) do + for f158_local6 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.IsAbilityPicked( f158_arg0, f158_arg1, f158_arg2, f158_arg3, f158_arg4, f158_local8, f158_local6 - 1, f158_arg5 ) then + local f158_local5 = Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f158_local8 ), f158_local6 ) + if (not f158_arg6 or f158_local5 ~= "specialty_extra_attachment") and (not f158_arg6 or f158_local5 ~= "specialty_twoprimaries") then + f158_local0 = f158_local8 + f158_local1 = f158_local6 + end + end + end + end + Cac.ToggleAbility( f158_arg0, f158_arg1, f158_arg2, f158_arg3, f158_arg4, f158_local0, f158_local1 - 1, f158_arg5, nil, true ) + end + + Cac.ResetAbilities = function ( f159_arg0, f159_arg1, f159_arg2, f159_arg3, f159_arg4, f159_arg5, f159_arg6, f159_arg7 ) + for f159_local4, f159_local5 in pairs( Cac.Abilities.Types ) do + for f159_local3 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.IsAbilityPicked( f159_arg0, f159_arg1, f159_arg2, f159_arg3, f159_arg4, f159_local5, f159_local3 - 1, f159_arg5 ) then + Cac.ToggleAbility( f159_arg0, f159_arg1, f159_arg2, f159_arg3, f159_arg4, f159_local5, f159_local3 - 1, f159_arg5, nil, f159_arg6, f159_arg7 ) + end + end + end + end + + Cac.ResetKillstreak = function ( f160_arg0, f160_arg1, f160_arg2, f160_arg3, f160_arg4, f160_arg5 ) + for f160_local0 = 1, 3, 1 do + Cac.SetKillstreak( f160_arg0, f160_arg1, f160_arg2, f160_arg3, f160_arg4, f160_arg5, f160_local0 - 1, "none" ) + if f160_arg5 == "specialistStreaks" then + Cac.SetSpecialistKills( f160_arg0, f160_arg1, f160_arg2, f160_arg3, f160_arg4, f160_local0 - 1, 0 ) + end + end + end + + Cac.GetPerformanceKills = function ( f161_arg0, f161_arg1 ) + return Engine.GetPlayerDataEx( f161_arg0, CoD.StatsGroup.Ranked, "weaponStats", f161_arg1, "kills" ) + end + + Cac.GetPerformanceDeaths = function ( f162_arg0, f162_arg1 ) + return Engine.GetPlayerDataEx( f162_arg0, CoD.StatsGroup.Ranked, "weaponStats", f162_arg1, "deaths" ) + end + + Cac.GetPerformanceHeadshots = function ( f163_arg0, f163_arg1 ) + return Engine.GetPlayerDataEx( f163_arg0, CoD.StatsGroup.Ranked, "weaponStats", f163_arg1, "headShots" ) + end + + Cac.GetPerformanceHits = function ( f164_arg0, f164_arg1 ) + return Engine.GetPlayerDataEx( f164_arg0, CoD.StatsGroup.Ranked, "weaponStats", f164_arg1, "hits" ) + end + + Cac.GetPerformanceShots = function ( f165_arg0, f165_arg1 ) + return Engine.GetPlayerDataEx( f165_arg0, CoD.StatsGroup.Ranked, "weaponStats", f165_arg1, "shots" ) + end + + Cac.GetPerformanceKDR = function ( f166_arg0, f166_arg1 ) + local f166_local0 = Cac.GetPerformanceKills( f166_arg0, f166_arg1 ) + local f166_local1 = Cac.GetPerformanceDeaths( f166_arg0, f166_arg1 ) + if f166_local1 == 0 then + return f166_local0 + else + return f166_local0 / f166_local1 + end + end + + Cac.GetPerformanceAccuracy = function ( f167_arg0, f167_arg1 ) + local f167_local0 = Cac.GetPerformanceHits( f167_arg0, f167_arg1 ) + local f167_local1 = Cac.GetPerformanceShots( f167_arg0, f167_arg1 ) + if f167_local1 == 0 then + return 0 + else + return 100 * f167_local0 / f167_local1 + end + end + + function InitKillstreakRefArray( f168_arg0 ) + local f168_local0 = 0 + local f168_local1 = {} + if f168_arg0 == "streaktype_assault" then + f168_local0 = 12 + f168_local1 = { + ks_1 = "uplink", + ks_2 = "ims", + ks_3 = "guard_dog", + ks_4 = "sentry", + ks_5 = "drone_hive", + ks_6 = "helicopter", + ks_7 = "ball_drone_backup", + ks_8 = "vanguard", + ks_9 = "airdrop_juggernaut_maniac", + ks_10 = "airdrop_juggernaut", + ks_11 = "heli_pilot", + ks_12 = "odin_assault" + } + elseif f168_arg0 == "streaktype_support" then + f168_local0 = 12 + f168_local1 = { + ks_1 = "uplink_support", + ks_2 = "deployable_ammo", + ks_3 = "deployable_vest", + ks_4 = "aa_launcher", + ks_5 = "ball_drone_radar", + ks_6 = "recon_agent", + ks_7 = "jammer", + ks_8 = "air_superiority", + ks_9 = "heli_sniper", + ks_10 = "uav_3dping", + ks_11 = "airdrop_juggernaut_recon", + ks_12 = "odin_support" + } + end + return f168_local1, f168_local0 + end + + function InitKillstreakArrays( f169_arg0 ) + local f169_local0 = f169_arg0 + local f169_local1 = Cac + local f169_local2 = Cac + f169_local1.KillstreakRefArray, f169_local2.KillstreakRefArraySize = InitKillstreakRefArray( f169_local0 ) + end + + Cac.GetStrippedWeaponName = function ( f170_arg0, f170_arg1 ) + local f170_local0 = nil + local f170_local1, f170_local2 = string.find( f170_arg0, "edit_grenade_" ) + if f170_local1 ~= nil and f170_local2 ~= nil then + f170_local0 = "grenade" + else + if f170_arg1 then + f170_local1, f170_local2 = string.find( f170_arg0, "iw6_" ) + if f170_local1 == nil then + f170_local1, f170_local2 = string.find( f170_arg0, "iw5_" ) + end + end + if f170_local1 == nil then + f170_local1, f170_local2 = string.find( f170_arg0, "edit_weapon_" ) + end + if f170_local1 ~= nil and f170_local2 ~= nil then + f170_local0 = "weapon" + end + end + local f170_local3 = nil + if f170_local1 ~= nil and f170_local2 ~= nil then + f170_local3 = string.sub( f170_arg0, f170_local2 + 1, string.len( f170_arg0 ) ) + end + if f170_arg1 and f170_local3 ~= nil then + f170_local1, f170_local2 = string.find( f170_local3, "_mp" ) + if f170_local1 ~= nil and f170_local2 ~= nil then + f170_local3 = string.sub( f170_local3, 0, f170_local1 - 1 ) + end + end + if f170_local3 ~= nil and string.len( f170_local3 ) then + return f170_local3, f170_local0 + else + return nil, nil + end + end + + Cac.GetChallengeIndexName = function ( f171_arg0 ) + local f171_local0 = Cac.GetStrippedWeaponName( f171_arg0, true ) + if f171_local0 ~= nil and string.len( f171_local0 ) > 0 then + return "ch_" .. f171_local0 .. "_purchase" + else + return nil + end + end + + Cac.PerformPermanentUnlock = function ( f172_arg0, f172_arg1, f172_arg2 ) + local f172_local0 = nil + if f172_arg2 ~= nil and string.len( f172_arg2 ) > 0 then + f172_local0 = "ch_" .. f172_arg2 .. "_purchase" + Engine.SetPlayerDataEx( f172_arg1.controller, CoD.StatsGroup.Ranked, "challengeState", f172_local0, 2 ) + Engine.SetPlayerDataEx( f172_arg1.controller, CoD.StatsGroup.Ranked, "challengeProgress", f172_local0, 2 ) + Cac.DecrementPrestigeToken( f172_arg0, f172_arg1 ) + end + end + + Cac.IsItemPermanentlyUnlocked = function ( f173_arg0 ) + local f173_local0, f173_local1 = false + local f173_local2 = Cac.GetChallengeIndexName( f173_arg0 ) + if f173_local2 == nil then + f173_local0 = false + f173_local1 = " N:ERR" + elseif Engine.CheckPlayerData( CoD.StatsGroup.Ranked, "challengeProgress", f173_local2 ) then + if Engine.GetPlayerData( CoD.StatsGroup.Ranked, "challengeProgress", f173_local2 ) >= 2 then + f173_local0 = true + f173_local1 = nil + end + else + f173_local0 = true + f173_local1 = " ERR" + end + return f173_local0, f173_local1 + end + + Cac.AddTeamName = function ( f174_arg0, f174_arg1, f174_arg2 ) + if Cac.IsDefaultClass( f174_arg0 ) then + return { + type = "UIText", + id = "team_name_text_" .. f174_arg1, + states = { + default = { + height = CoD.TextSettings.NormalFont.Height + 2, + font = CoD.TextSettings.NormalFont.Font, + left = f174_arg2 or 0, + right = GenericMenuDims.menu_right, + alignment = LUI.Alignment.Left + } + }, + properties = { + text = Cac.GetTeamName( f174_arg0 ) + } + } + else + return nil + end + end + + Cac.GetTeamName = function ( f175_arg0 ) + return GetCurrentGameType() and Cac.Settings.DataLoc[f175_arg0].infectedString or Cac.Settings.DataLoc[f175_arg0].string + end + + Cac.HasPrestigeTokens = function ( f176_arg0, f176_arg1 ) + return Engine.GetPlayerData( CoD.StatsGroup.Ranked, "prestigeShopTokens" ) > 0 + end + + Cac.DecrementPrestigeToken = function ( f177_arg0, f177_arg1 ) + local f177_local0 = Engine.GetPlayerData( CoD.StatsGroup.Ranked, "prestigeShopTokens" ) + if f177_local0 >= 1 then + Engine.SetPlayerDataEx( f177_arg1.controller, CoD.StatsGroup.Ranked, "prestigeShopTokens", f177_local0 - 1 ) + end + end + + Cac.GetActiveCharacterImageStates = function () + return { + default = CoD.ColorizeState( Colors.frontend_hilite, { + material = RegisterMaterial( "icon_party_leader" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 16, + top = 0, + bottom = 16, + alpha = 0 + } ), + button_up = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 16, + top = 0, + bottom = 16, + alpha = 1 + }, + button_over = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 40, + right = 56, + top = 0, + bottom = 16, + alpha = 1 + }, + popped = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 32, + right = 64, + top = -8, + bottom = 24, + alpha = 1 + }, + popped_unfocused = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 32, + top = -8, + bottom = 24, + alpha = 1 + } + } + end + + Cac.ShuffleAttachmentsDown = function ( f179_arg0, f179_arg1, f179_arg2, f179_arg3, f179_arg4, f179_arg5 ) + local f179_local0 = Cac.GetAttachment( f179_arg0, f179_arg1, f179_arg2, f179_arg3, f179_arg4, f179_arg5, 0 ) + local f179_local1 = Cac.GetAttachment( f179_arg0, f179_arg1, f179_arg2, f179_arg3, f179_arg4, f179_arg5, 1 ) + local f179_local2 = Cac.GetAttachment( f179_arg0, f179_arg1, f179_arg2, f179_arg3, f179_arg4, f179_arg5, 2 ) + if f179_local0 == "none" and f179_local1 == "none" and f179_local2 ~= "none" then + Cac.SetAttachment( f179_arg0, f179_arg1, f179_arg2, f179_arg3, f179_arg4, f179_arg5, 0, f179_local2 ) + Cac.SetAttachment( f179_arg0, f179_arg1, f179_arg2, f179_arg3, f179_arg4, f179_arg5, 2, "none" ) + f179_local0 = f179_local2 + f179_local2 = "none" + elseif f179_local0 == "none" and f179_local1 ~= "none" then + Cac.SetAttachment( f179_arg0, f179_arg1, f179_arg2, f179_arg3, f179_arg4, f179_arg5, 0, f179_local1 ) + Cac.SetAttachment( f179_arg0, f179_arg1, f179_arg2, f179_arg3, f179_arg4, f179_arg5, 1, "none" ) + f179_local0 = f179_local1 + f179_local1 = "none" + end + if f179_local1 == "none" and f179_local2 ~= "none" then + Cac.SetAttachment( f179_arg0, f179_arg1, f179_arg2, f179_arg3, f179_arg4, f179_arg5, 1, f179_local2 ) + Cac.SetAttachment( f179_arg0, f179_arg1, f179_arg2, f179_arg3, f179_arg4, f179_arg5, 2, "none" ) + f179_local1 = f179_local2 + f179_local2 = "none" + end + end + + Cac.IsCamoOrReticleUnlocked = function ( f180_arg0, f180_arg1, f180_arg2, f180_arg3, f180_arg4, f180_arg5, f180_arg6, f180_arg7 ) + local f180_local0, f180_local1, f180_local2 = false + if Cac.IsCamoOrReticleEntitlement( f180_arg6 ) then + f180_local0 = true + else + local f180_local3 = "" + if f180_arg7 == "camo" then + local f180_local4 = Cac.GetWeapon( f180_arg0, f180_arg1, f180_arg2, f180_arg3, f180_arg4, f180_arg5 ) + if (f180_local4 == "none" or f180_local4 == "iw6_knifeonly") and f180_arg6 ~= "none" then + return false, false + end + f180_local3 = Cac.GetCamoRefUnique( f180_local4, f180_arg6 ) + f180_local2 = Cac.GetCamoChallengeRef( f180_local4, f180_arg6 ) + elseif f180_arg7 == "reticle" then + local f180_local4 = Cac.GetAttachmentWithReticles( f180_arg0, f180_arg1, f180_arg2, f180_arg3, f180_arg4, f180_arg5 ) + if f180_local4 then + f180_local3 = Cac.GetReticleRefUnique( f180_local4, f180_arg6 ) + f180_local2 = Cac.GetReticleChallengeRef( f180_local4, f180_arg6 ) + end + end + f180_local1 = Cac.GetCamoOrReticleChallengeTier( f180_local3 ) + end + local f180_local3 = nil + if f180_local0 then + if f180_arg1 == "privateMatchSquadMembers" and Cac.IsCamoOrReticleUnlockedInPrivate( f180_arg6 ) then + f180_local3 = true + else + f180_local3 = Cac.IsCamoOrReticleEntitlementUnlocked( f180_arg0, f180_arg6, f180_arg1 == "privateMatchSquadMembers" ) + end + else + f180_local3 = Cac.IsItemUnlocked( f180_arg0, f180_arg1, f180_arg2, f180_arg6, f180_local2, f180_local1 ) + end + return f180_local3, f180_local0 + end + + Cac.ValidateAbilities = function ( f181_arg0, f181_arg1, f181_arg2, f181_arg3, f181_arg4, f181_arg5 ) + for f181_local4, f181_local5 in pairs( Cac.Abilities.Types ) do + for f181_local3 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.IsAbilityPicked( f181_arg0, f181_arg1, f181_arg2, f181_arg3, f181_arg4, f181_local5, f181_local3 - 1, f181_arg5 ) and not Cac.IsPerkUnlocked( f181_arg0, f181_arg1, f181_arg2, Cac.GetAbilitySlotRef( Cac.GetAbilityRef( f181_local5 ), f181_local3 ) ) then + DebugPrint( "Illegitimate equipped perk detected. Removing perk at category " .. f181_local5 .. " ability " .. f181_local3 - 1 .. " at loadout slot " .. f181_arg4 ) + Cac.ToggleAbility( f181_arg0, f181_arg1, f181_arg2, f181_arg3, f181_arg4, f181_local5, f181_local3 - 1, f181_arg5, false, f181_arg5 == "specialistBonusStreaks", false ) + end + end + end + end + + Cac.ValidateWeapon = function ( f182_arg0, f182_arg1, f182_arg2, f182_arg3, f182_arg4, f182_arg5, f182_arg6 ) + local f182_local0 = Cac.GetWeapon( f182_arg0, f182_arg1, f182_arg2, f182_arg3, f182_arg4, f182_arg5 ) + local f182_local1 = nil + if Cac.IsWeaponDLC( f182_local0 ) then + f182_local1 = Cac.IsWeaponEntitlementUnlocked( f182_arg0, f182_local0, true ) + else + f182_local1 = Cac.IsItemUnlocked( f182_arg0, f182_arg1, f182_arg2, f182_local0 ) + end + if not f182_local1 then + DebugPrint( "Illegitimate equipped weapon detected. Removing weapon number " .. f182_arg5 .. " at loadout slot " .. f182_arg4 ) + Cac.SetWeapon( f182_arg0, f182_arg1, f182_arg2, f182_arg3, f182_arg4, f182_arg5, f182_arg6 ) + end + end + + Cac.ValidateAttachments = function ( f183_arg0, f183_arg1, f183_arg2, f183_arg3, f183_arg4, f183_arg5 ) + for f183_local0 = 0, Cac.Indices.Attachments.PrimaryAttachment3, 1 do + local f183_local3 = Cac.GetAttachment( f183_arg0, f183_arg1, f183_arg2, f183_arg3, f183_arg4, f183_arg5, f183_local0 ) + if not Cac.IsAttachmentUnlocked( f183_arg0, f183_arg1, f183_arg2, f183_arg3, f183_arg4, f183_arg5, f183_local3 ) then + if Cac.AttachmentHasReticles( f183_local3 ) then + Cac.SetWeaponReticle( f183_arg0, f183_arg1, f183_arg2, f183_arg3, f183_arg4, f183_arg5, "none" ) + end + DebugPrint( "Illegitimate equipped attachment detected. Removing attachment number " .. f183_local0 .. " on weapon number " .. f183_arg5 .. " at loadout slot " .. f183_arg4 ) + Cac.SetAttachment( f183_arg0, f183_arg1, f183_arg2, f183_arg3, f183_arg4, f183_arg5, f183_local0, "none" ) + end + end + Cac.ShuffleAttachmentsDown( f183_arg0, f183_arg1, f183_arg2, f183_arg3, f183_arg4, f183_arg5 ) + end + + Cac.ValidateGrenades = function ( f184_arg0, f184_arg1, f184_arg2, f184_arg3, f184_arg4 ) + for f184_local0 = 0, Cac.Indices.Grenade.Secondary, 1 do + if not Cac.IsItemUnlocked( f184_arg0, f184_arg1, f184_arg2, Cac.GetPerk( f184_arg0, f184_arg1, f184_arg2, f184_arg3, f184_arg4, f184_local0 ) ) then + DebugPrint( "Illegitimate equipped grenade detected. Removing grenade number " .. f184_local0 .. " at loadout slot " .. f184_arg4 ) + Cac.SetPerk( f184_arg0, f184_arg1, f184_arg2, f184_arg3, f184_arg4, f184_local0, "specialty_null" ) + end + end + end + + Cac.ShuffleStreaks = function ( f185_arg0, f185_arg1, f185_arg2, f185_arg3, f185_arg4, f185_arg5 ) + local f185_local0 = Cac.GetStreak( f185_arg0, f185_arg1, f185_arg2, f185_arg3, f185_arg4, f185_arg5, Cac.Indices.Killstreaks.Streak1 ) + local f185_local1 = Cac.GetStreak( f185_arg0, f185_arg1, f185_arg2, f185_arg3, f185_arg4, f185_arg5, Cac.Indices.Killstreaks.Streak2 ) + local f185_local2 = Cac.GetStreak( f185_arg0, f185_arg1, f185_arg2, f185_arg3, f185_arg4, f185_arg5, Cac.Indices.Killstreaks.Streak3 ) + if f185_local0 == "none" and f185_local1 == "none" and f185_local2 ~= "none" then + Cac.SetKillstreak( f185_arg0, f185_arg1, f185_arg2, f185_arg3, f185_arg4, f185_arg5, Cac.Indices.Killstreaks.Streak1, f185_local2 ) + Cac.SetKillstreak( f185_arg0, f185_arg1, f185_arg2, f185_arg3, f185_arg4, f185_arg5, Cac.Indices.Killstreaks.Streak3, "none" ) + f185_local0 = f185_local2 + f185_local2 = "none" + elseif f185_local0 == "none" and f185_local1 ~= "none" then + Cac.SetKillstreak( f185_arg0, f185_arg1, f185_arg2, f185_arg3, f185_arg4, f185_arg5, Cac.Indices.Killstreaks.Streak1, f185_local1 ) + Cac.SetKillstreak( f185_arg0, f185_arg1, f185_arg2, f185_arg3, f185_arg4, f185_arg5, Cac.Indices.Killstreaks.Streak2, "none" ) + f185_local0 = f185_local1 + f185_local1 = "none" + end + if f185_local1 == "none" and f185_local2 ~= "none" then + Cac.SetKillstreak( f185_arg0, f185_arg1, f185_arg2, f185_arg3, f185_arg4, f185_arg5, Cac.Indices.Killstreaks.Streak2, f185_local2 ) + Cac.SetKillstreak( f185_arg0, f185_arg1, f185_arg2, f185_arg3, f185_arg4, f185_arg5, Cac.Indices.Killstreaks.Streak3, "none" ) + f185_local1 = f185_local2 + f185_local2 = "none" + end + end + + Cac.ValidateStrikePackage = function ( f186_arg0, f186_arg1, f186_arg2, f186_arg3, f186_arg4 ) + local f186_local0 = Cac.GetStreakType( f186_arg0, f186_arg1, f186_arg2, f186_arg3, f186_arg4 ) + if f186_local0 == "streaktype_specialist" then + Cac.ValidateAbilities( f186_arg0, f186_arg1, f186_arg2, f186_arg3, f186_arg4, "specialistBonusStreaks" ) + end + f186_local0 = Cac.GetStreakTypeReference( f186_local0 ) + for f186_local1 = 0, Cac.Indices.Killstreaks.Streak3, 1 do + local f186_local4 = Cac.GetStreak( f186_arg0, f186_arg1, f186_arg2, f186_arg3, f186_arg4, f186_local0, f186_local1 ) + local f186_local5 = Cac.IsItemUnlocked( f186_arg0, f186_arg1, f186_arg2, f186_local4 ) + if f186_local0 == "specialistStreaks" then + f186_local5 = Cac.IsPerkUnlocked( f186_arg0, f186_arg1, f186_arg2, Cac.StripSuffix( f186_local4, "_ks" ) ) + end + if not f186_local5 then + DebugPrint( "Illegitimate equipped killstreak detected. Removing streak number " .. f186_local1 .. " at loadout slot " .. f186_arg4 ) + Cac.SetKillstreak( f186_arg0, f186_arg1, f186_arg2, f186_arg3, f186_arg4, f186_local0, f186_local1, "none" ) + local f186_local6 = f186_local1 - 1 + end + end + Cac.ShuffleStreaks( f186_arg0, f186_arg1, f186_arg2, f186_arg3, f186_arg4, f186_local0 ) + end + + function ValidateExtendedLoadouts( f187_arg0, f187_arg1, f187_arg2, f187_arg3 ) + for f187_local0 = Cac.Settings.DataLoc[f187_arg3].baseClassSlots, Cac.Settings.DataLoc[f187_arg3].maxClassSlots - 1, 1 do + if Cac.IsClassInUse( f187_arg0, f187_arg1, f187_arg2, f187_arg3, f187_local0 ) and not Engine.HasExtendedLoadouts( f187_arg0 ) then + DebugPrint( "Illegitimate use of extended loadout number " .. f187_local0 .. " without purchase of the DLC. Setting to not in use." ) + Cac.SetClassInUse( f187_arg0, f187_arg1, f187_arg2, f187_arg3, f187_local0, false ) + end + end + end + + Cac.ValidateLoadoutItems = function ( f188_arg0, f188_arg1, f188_arg2, f188_arg3 ) + if not Cac.IsSquadMemberInUse( f188_arg0, f188_arg1, f188_arg2 ) then + if Cac.GetWeapon( f188_arg0, f188_arg1, f188_arg2, f188_arg3, 0, Cac.Indices.Weapons.Primary ) == "iw6_knifeonly" then + Cac.SetWeaponToDefaultUnlock( f188_arg0, f188_arg1, f188_arg2, 0, Cac.Indices.Weapons.Primary ) + Cac.SetWeaponToDefaultUnlock( f188_arg0, f188_arg1, f188_arg2, 0, Cac.Indices.Weapons.Secondary ) + end + return + end + for f188_local0 = 0, Cac.GetNumCustomSlots( f188_arg0, f188_arg3 ) - 1, 1 do + Cac.ValidateWeapon( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, Cac.Indices.Weapons.Primary, "iw6_knifeonly" ) + Cac.ValidateWeapon( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, Cac.Indices.Weapons.Secondary, "none" ) + for f188_local3 = 0, Cac.Indices.Weapons.Secondary, 1 do + Cac.ValidateAttachments( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, f188_local3 ) + if not Cac.IsCamoOrReticleUnlocked( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, f188_local3, Cac.GetCamo( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, f188_local3 ), "camo" ) then + DebugPrint( "Illegitimate equipped camo detected. Removing camo at loadout slot " .. f188_local0 ) + Cac.SetWeaponCamo( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, f188_local3, "none" ) + end + if not Cac.IsCamoOrReticleUnlocked( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, f188_local3, Cac.GetReticle( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, f188_local3 ), "reticle" ) then + DebugPrint( "Illegitimate equipped reticle detected. Removing reticle at loadout slot " .. f188_local0 ) + Cac.SetWeaponReticle( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, f188_local3, "none" ) + local f188_local6, f188_local7 = Cac.GetAttachmentWithReticles( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, f188_local3 ) + if f188_local6 then + Cac.SetAttachment( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, f188_local3, f188_local7, "none" ) + Cac.ShuffleAttachmentsDown( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, f188_local3 ) + end + end + end + Cac.ValidateGrenades( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0 ) + local f188_local3 = Cac.CountSpentPoints( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, "abilitiesPicked" ) + local f188_local4 = Cac.CalculateAbilityCapacity( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0 ) + if f188_local4 < f188_local3 then + DebugPrint( "Illegitimate abilities selected in loadout slot " .. f188_local0 .. ". " .. f188_local3 .. " points used, but only has space for " .. f188_local4 .. " points" ) + Cac.ResetAbilities( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, "abilitiesPicked", false ) + end + Cac.ValidateAbilities( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0, "abilitiesPicked" ) + Cac.ValidateStrikePackage( f188_arg0, f188_arg1, f188_arg2, f188_arg3, f188_local0 ) + ValidateExtendedLoadouts( f188_arg0, f188_arg1, f188_arg2, f188_arg3 ) + end + end + + Cac.GetKillstreakType = function ( f189_arg0 ) + for f189_local6, f189_local7 in pairs( Cac.Streaks ) do + for f189_local3, f189_local4 in ipairs( f189_local7.Streaks ) do + if f189_local4 == f189_arg0 then + return f189_local6 + end + end + end + end + + Cac.IsPrimaryGrenade = function ( f190_arg0 ) + for f190_local3, f190_local4 in ipairs( Cac.PrimaryGrenades ) do + if f190_local4 == f190_arg0 then + return true + end + end + return false + end + + Cac.IsSecondaryGrenade = function ( f191_arg0 ) + for f191_local3, f191_local4 in ipairs( Cac.SecondaryGrenades ) do + if f191_local4 == f191_arg0 then + return true + end + end + return false + end + + Cac.UpdateSpecialistKillCounts = function ( f192_arg0, f192_arg1, f192_arg2, f192_arg3, f192_arg4 ) + local f192_local0 = 0 + for f192_local1 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do + local f192_local4 = false + local f192_local5 = Cac.StripSuffix( Cac.GetCacConfig( f192_arg0, f192_arg1, f192_arg2, f192_arg3, f192_arg4, "specialistStreaks", f192_local1 - 1 ), "_ks" ) + if not f192_local5 or f192_local5 == "" or f192_local5 == "specialty_null" or f192_local5 == "none" then + Cac.SetSpecialistKills( f192_arg0, f192_arg1, f192_arg2, f192_arg3, f192_arg4, f192_local1 - 1, 0 ) + f192_local4 = true + else + assert( not f192_local4, "Attempting to update Specialist Kill Counts, but there is a blank ability in the middle of valid abilities" ) + Cac.SetSpecialistKills( f192_arg0, f192_arg1, f192_arg2, f192_arg3, f192_arg4, f192_local1 - 1, f192_local0 + Cac.GetPerkCost( f192_local5 ) + 1 ) + end + end + end + + Cac.GetBaseAttachRefFromUnlockRef = function ( f193_arg0 ) + return string.sub( f193_arg0, string.find( f193_arg0, "_" ) + 1 ) + end + +end +Cac.HasAttachments = function ( f194_arg0, f194_arg1, f194_arg2, f194_arg3, f194_arg4, f194_arg5, f194_arg6 ) + local f194_local0 = {} + local f194_local1 = Cac.GetAttachment( f194_arg0, f194_arg1, f194_arg2, f194_arg3, f194_arg4, f194_arg5, 0 ) + local f194_local2 = Cac.GetAttachment( f194_arg0, f194_arg1, f194_arg2, f194_arg3, f194_arg4, f194_arg5, 1 ) + local f194_local3 = Cac.GetAttachment( f194_arg0, f194_arg1, f194_arg2, f194_arg3, f194_arg4, f194_arg5, 2 ) + f194_local0 = f194_local1 + for f194_local1 = 1, #f194_local0, 1 do + for f194_local4 = 1, #f194_arg6, 1 do + if f194_local0[f194_local1] == f194_arg6[f194_local4] then + return f194_local1 + end + end + end + return false +end + +Cac.CalculateAbilityCapacity = function ( f195_arg0, f195_arg1, f195_arg2, f195_arg3, f195_arg4 ) + local f195_local0 = Cac.Abilities.Settings.GrabBagCapacity + local f195_local1 = {} + local f195_local2 = Cac.GetWeapon( f195_arg0, f195_arg1, f195_arg2, f195_arg3, f195_arg4, 0 ) + local f195_local3 = Cac.GetWeapon( f195_arg0, f195_arg1, f195_arg2, f195_arg3, f195_arg4, 1 ) + local f195_local4 = Cac.GetSecondaryGrenade( f195_arg0, f195_arg1, f195_arg2, f195_arg3, f195_arg4 ) + f195_local1 = f195_local2 + for f195_local2 = 1, #f195_local1, 1 do + if f195_local1[f195_local2] == "none" or f195_local1[f195_local2] == "specialty_null" or f195_local1[f195_local2] == "iw6_knifeonly" or f195_local1[f195_local2] == "uav" then + f195_local0 = f195_local0 + 1 + end + end + if Cac.GetPrimaryGrenade( f195_arg0, f195_arg1, f195_arg2, f195_arg3, f195_arg4 ) == "specialty_null" and not Cac.HasAttachments( f195_arg0, f195_arg1, f195_arg2, f195_arg3, f195_arg4, 0, { + "gl", + "shotgun" + } ) and not Cac.HasAttachments( f195_arg0, f195_arg1, f195_arg2, f195_arg3, f195_arg4, 1, { + "gl", + "shotgun" + } ) then + f195_local0 = f195_local0 + 1 + end + return f195_local0 +end + +Cac.StripSuffix = function ( f196_arg0, f196_arg1 ) + local f196_local0 = f196_arg0 + local f196_local1 = string.len( f196_arg0 ) + if string.sub( f196_arg0, f196_local1 - 2 ) == f196_arg1 then + f196_local0 = string.sub( f196_arg0, 0, f196_local1 - 3 ) + end + return f196_local0 +end + +Cac.GetWeapon = function ( f197_arg0, f197_arg1, f197_arg2, f197_arg3, f197_arg4, f197_arg5 ) + return Cac.GetCacConfig( f197_arg0, f197_arg1, f197_arg2, f197_arg3, f197_arg4, "weaponSetups", f197_arg5, "weapon" ) +end + +Cac.GetWeaponClass = function ( f198_arg0 ) + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f198_arg0, StatsTable.Cols.WeaponClass ) +end + +Cac.IsWeaponClassPrimary = function ( f199_arg0 ) + for f199_local0 = 1, #Cac.WeaponTypes.Primary, 1 do + if f199_arg0 == Cac.WeaponTypes.Primary[f199_local0] then + return true + end + end + return false +end + +Cac.IsWeaponClassSecondary = function ( f200_arg0, f200_arg1 ) + for f200_local0 = 1, #Cac.WeaponTypes.Secondary, 1 do + if f200_arg0 == Cac.WeaponTypes.Secondary[f200_local0] then + return true + elseif f200_arg1 and (not f200_arg0 or f200_arg0 == "") then + return true + end + end + return false +end + +Cac.GetWeaponName = function ( f201_arg0 ) + return Engine.Localize( "@" .. Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f201_arg0, StatsTable.Cols.WeaponName ) ) +end + +Cac.GetKillstreakName = function ( f202_arg0 ) + return Engine.Localize( "@" .. Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, f202_arg0, KillstreakTable.Cols.Name ) ) +end + +Cac.GetKillstreakDesc = function ( f203_arg0 ) + return Engine.Localize( "@" .. Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, f203_arg0, KillstreakTable.Cols.Desc ) ) +end + +Cac.GetWeaponImage = function ( f204_arg0, f204_arg1 ) + if not f204_arg1 or f204_arg0 and f204_arg0 ~= "none" and f204_arg0 ~= "specialty_null" and f204_arg0 ~= "" then + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f204_arg0, StatsTable.Cols.WeaponImage ) + else + local f204_local0 + if f204_arg1 == Cac.Indices.Weapons.Secondary then + f204_local0 = "secondary" + if not f204_local0 then + + else + return "icon_weapon_ph_" .. f204_local0 + end + end + end + f204_local0 = "primary" +end + +Cac.GetAttachment = function ( f205_arg0, f205_arg1, f205_arg2, f205_arg3, f205_arg4, f205_arg5, f205_arg6 ) + return Cac.GetCacConfig( f205_arg0, f205_arg1, f205_arg2, f205_arg3, f205_arg4, "weaponSetups", f205_arg5, "attachment", f205_arg6 ) +end + +Cac.GetAttachmentUniqueRef = function ( f206_arg0, f206_arg1 ) + local f206_local0 = f206_arg0 + local f206_local1 = "" + local f206_local2 = 0 + repeat + f206_local2 = f206_local2 + 1 + f206_local1 = Engine.TableLookupByRow( AttachmentMap.File, AttachmentMap.Rows.AttachRef, f206_local2 ) + until f206_local1 == f206_arg0 or f206_local1 == "" + if f206_local1 == f206_arg0 then + local f206_local3 = Engine.TableLookup( AttachmentMap.File, AttachmentMap.Cols.WeapOrClass, f206_arg1, f206_local2 ) + if f206_local3 == "" then + f206_local3 = Engine.TableLookup( AttachmentMap.File, AttachmentMap.Cols.WeapOrClass, Cac.GetWeaponClass( f206_arg1 ), f206_local2 ) + end + if f206_local3 ~= "" then + f206_local0 = f206_local3 + end + end + return f206_local0 +end + +Cac.GetAttachmentImage = function ( f207_arg0, f207_arg1, f207_arg2, f207_arg3 ) + if not (not f207_arg0 or f207_arg0 == "none" or f207_arg0 == "") or not f207_arg2 or not f207_arg3 then + if f207_arg1 and f207_arg1 ~= "none" then + f207_arg0 = Cac.GetAttachmentUniqueRef( f207_arg0, f207_arg1 ) + end + return Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f207_arg0, AttachmentTable.Cols.Image ) + elseif f207_arg2 ~= Cac.Indices.Weapons.Secondary or not "secondary" then + local f207_local0 = "primary" + end + return "icon_weapon_ph_sp_diamond_64" +end + +Cac.GetAttachmentImageFull = function ( f208_arg0, f208_arg1 ) + if f208_arg1 and f208_arg1 ~= "none" then + f208_arg0 = Cac.GetAttachmentUniqueRef( f208_arg0, f208_arg1 ) + end + return Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f208_arg0, AttachmentTable.Cols.ImageFull ) +end + +Cac.IsAbilityPickedBySlotName = function ( f209_arg0, f209_arg1, f209_arg2, f209_arg3, f209_arg4, f209_arg5, f209_arg6, f209_arg7 ) + local f209_local0 = nil + for f209_local1 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.GetAbilitySlotRef( Cac.Abilities.Refs[f209_arg5], f209_local1 ) == f209_arg6 then + f209_local0 = f209_local1 + end + end + if f209_local0 and Cac.IsAbilityPicked( f209_arg0, f209_arg1, f209_arg2, f209_arg3, f209_arg4, Cac.Abilities.Types[f209_arg5], f209_local0 - 1, f209_arg7 ) then + return true + else + return false + end +end + +Cac.GetNumberAbilitiesPicked = function ( f210_arg0, f210_arg1, f210_arg2, f210_arg3, f210_arg4, f210_arg5 ) + local f210_local0 = 0 + for f210_local5, f210_local6 in ipairs( Cac.GetAbilityTypes() ) do + for f210_local4 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.IsAbilityPicked( f210_arg0, f210_arg1, f210_arg2, f210_arg3, f210_arg4, f210_local6, f210_local4 - 1, f210_arg5 ) then + f210_local0 = f210_local0 + 1 + end + end + end + return f210_local0 +end + +Cac.GetCamo = function ( f211_arg0, f211_arg1, f211_arg2, f211_arg3, f211_arg4, f211_arg5 ) + return Cac.GetCacConfig( f211_arg0, f211_arg1, f211_arg2, f211_arg3, f211_arg4, "weaponSetups", f211_arg5, "camo" ) +end + +Cac.GetReticle = function ( f212_arg0, f212_arg1, f212_arg2, f212_arg3, f212_arg4, f212_arg5 ) + return Cac.GetCacConfig( f212_arg0, f212_arg1, f212_arg2, f212_arg3, f212_arg4, "weaponSetups", f212_arg5, "reticle" ) +end + +Cac.GetGrenade = function ( f213_arg0, f213_arg1, f213_arg2, f213_arg3, f213_arg4, f213_arg5 ) + local f213_local0 = assert + local f213_local1 + if f213_arg5 ~= Cac.Indices.Grenade.Primary and f213_arg5 ~= Cac.Indices.Grenade.Secondary then + f213_local1 = false + else + f213_local1 = true + end + f213_local0( f213_local1 ) + return Cac.GetCacConfig( f213_arg0, f213_arg1, f213_arg2, f213_arg3, f213_arg4, "perks", f213_arg5 ) +end + +Cac.GetGrenadeImage = function ( f214_arg0, f214_arg1 ) + if not f214_arg1 or f214_arg0 and f214_arg0 ~= "none" and f214_arg0 ~= "specialty_null" and f214_arg0 ~= "" then + return Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, Cac.StripSuffix( f214_arg0, "_mp" ), StatsTable.Cols.WeaponBWImage ) + else + local f214_local0 + if f214_arg1 == Cac.Indices.Grenade.Secondary then + f214_local0 = "tactical" + if not f214_local0 then + + else + return "icon_weapon_ph_" .. f214_local0 + end + end + end + f214_local0 = "lethal" +end + +Cac.GetPrimaryGrenade = function ( f215_arg0, f215_arg1, f215_arg2, f215_arg3, f215_arg4 ) + return Cac.GetCacConfig( f215_arg0, f215_arg1, f215_arg2, f215_arg3, f215_arg4, "perks", Cac.Indices.Grenade.Primary ) +end + +Cac.GetSecondaryGrenade = function ( f216_arg0, f216_arg1, f216_arg2, f216_arg3, f216_arg4 ) + return Cac.GetCacConfig( f216_arg0, f216_arg1, f216_arg2, f216_arg3, f216_arg4, "perks", Cac.Indices.Grenade.Secondary ) +end + +Cac.GetPerk = function ( f217_arg0, f217_arg1, f217_arg2, f217_arg3, f217_arg4, f217_arg5 ) + return Cac.GetCacConfig( f217_arg0, f217_arg1, f217_arg2, f217_arg3, f217_arg4, "perks", f217_arg5 ) +end + +Cac.GetPerkGroup = function ( f218_arg0 ) + local f218_local0 = nil + for f218_local5, f218_local6 in pairs( Cac.PerkTypes.Refs ) do + for f218_local4 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Engine.TableLookup( AbilityTable.File, AbilityTable.Cols.Ref, f218_local6, f218_local4 + AbilityTable.Cols.Slot0 ) == f218_arg0 then + f218_local0 = f218_local6 + end + end + end + return f218_local0 +end + +Cac.GetPerkIndices = function ( f219_arg0 ) + for f219_local4, f219_local5 in pairs( Cac.PerkTypes.Refs ) do + for f219_local3 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Engine.TableLookup( AbilityTable.File, AbilityTable.Cols.Ref, f219_local5, f219_local3 + AbilityTable.Cols.Slot0 ) == f219_arg0 then + return f219_local4, f219_local3 + end + end + end +end + +Cac.GetPerkName = function ( f220_arg0 ) + return Engine.Localize( "@" .. Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f220_arg0, PerkTable.Cols.Name ) ) +end + +Cac.GetStreak = function ( f221_arg0, f221_arg1, f221_arg2, f221_arg3, f221_arg4, f221_arg5, f221_arg6 ) + return Cac.GetCacConfig( f221_arg0, f221_arg1, f221_arg2, f221_arg3, f221_arg4, f221_arg5, f221_arg6 ) +end + +Cac.GetStreak1 = function ( f222_arg0, f222_arg1, f222_arg2, f222_arg3, f222_arg4 ) + return Cac.GetStreak( f222_arg0, f222_arg1, f222_arg2, f222_arg3, f222_arg4, Cac.GetStreakTypeReference( Cac.GetStreakType( f222_arg0, f222_arg1, f222_arg2, f222_arg3, f222_arg4 ) ), Cac.Indices.Killstreaks.Streak1 ) +end + +Cac.GetStreak2 = function ( f223_arg0, f223_arg1, f223_arg2, f223_arg3, f223_arg4 ) + return Cac.GetStreak( f223_arg0, f223_arg1, f223_arg2, f223_arg3, f223_arg4, Cac.GetStreakTypeReference( Cac.GetStreakType( f223_arg0, f223_arg1, f223_arg2, f223_arg3, f223_arg4 ) ), Cac.Indices.Killstreaks.Streak2 ) +end + +Cac.GetStreak3 = function ( f224_arg0, f224_arg1, f224_arg2, f224_arg3, f224_arg4 ) + return Cac.GetStreak( f224_arg0, f224_arg1, f224_arg2, f224_arg3, f224_arg4, Cac.GetStreakTypeReference( Cac.GetStreakType( f224_arg0, f224_arg1, f224_arg2, f224_arg3, f224_arg4 ) ), Cac.Indices.Killstreaks.Streak3 ) +end + +Cac.GetStreakType = function ( f225_arg0, f225_arg1, f225_arg2, f225_arg3, f225_arg4 ) + return Cac.GetCacConfig( f225_arg0, f225_arg1, f225_arg2, f225_arg3, f225_arg4, "perks", Cac.Indices.StreakType ) +end + +Cac.GetStreakName = function ( f226_arg0 ) + return Engine.Localize( Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, f226_arg0, KillstreakTable.Cols.Name ) ) +end + +Cac.GetStreakDesc = function ( f227_arg0 ) + return Engine.Localize( Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, f227_arg0, KillstreakTable.Cols.Desc ) ) +end + +Cac.GetStreakTypeReference = function ( f228_arg0 ) + local f228_local0 = "" + if f228_arg0 == "streaktype_support" then + f228_local0 = "supportStreaks" + elseif f228_arg0 == "streaktype_assault" then + f228_local0 = "assaultStreaks" + elseif f228_arg0 == "streaktype_specialist" then + f228_local0 = "specialistStreaks" + else + assert( f228_arg0 == "specialty_null" ) + f228_local0 = "assaultStreaks" + end + return f228_local0 +end + +Cac.GetStreakIcon = function ( f229_arg0, f229_arg1 ) + if f229_arg0 == "guard_dog" then + local f229_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.GuardDog] + local f229_local1 = f229_local0.GetUIMaterial( f229_local0.GetSavedRef( f229_arg1 ) ) + if f229_local1 and #f229_local1 > 0 then + return f229_local1 + end + end + if f229_arg0 and f229_arg0 ~= "none" and f229_arg0 ~= "specialty_null" and f229_arg0 ~= "" then + return Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, f229_arg0, KillstreakTable.Cols.Icon ) + end + return "icon_weapon_ph_sp_diamond_64" +end + +Cac.GetStreakList = function ( f230_arg0 ) + return Cac.Streaks[f230_arg0].Streaks +end + +Cac.GetStreakTypeCaps = function ( f231_arg0 ) + return Engine.Localize( Cac.Streaks[f231_arg0].Caps ) +end + +Cac.GetPerkImage = function ( f232_arg0 ) + return Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f232_arg0, PerkTable.Cols.Image ) +end + +Cac.GetPerkCost = function ( f233_arg0 ) + return Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f233_arg0, PerkTable.Cols.Cost ) +end + +Cac.GetStreakCost = function ( f234_arg0 ) + return Engine.TableLookup( KillstreakTable.File, KillstreakTable.Cols.Ref, f234_arg0, KillstreakTable.Cols.Kills ) +end + +Cac.GetCamoImage = function ( f235_arg0 ) + return Engine.TableLookup( CamoTable.File, CamoTable.Cols.Ref, f235_arg0, CamoTable.Cols.Image ) +end + +Cac.GetReticleImage = function ( f236_arg0 ) + return Engine.TableLookup( ReticleTable.File, ReticleTable.Cols.Ref, f236_arg0, ReticleTable.Cols.Image ) +end + +Cac.GetAbilityRef = function ( f237_arg0 ) + return Engine.TableLookup( AbilityTable.File, AbilityTable.Cols.Index, f237_arg0 + 1, AbilityTable.Cols.Ref ) +end + +Cac.GetAbilitySlotRef = function ( f238_arg0, f238_arg1 ) + return Engine.TableLookup( AbilityTable.File, AbilityTable.Cols.Ref, f238_arg0, AbilityTable.Cols.Slot0 + f238_arg1 ) +end + +Cac.GetAbilityTypes = function () + return { + Cac.Abilities.Types.Speed, + Cac.Abilities.Types.Handling, + Cac.Abilities.Types.Stealth, + Cac.Abilities.Types.Awareness, + Cac.Abilities.Types.Resistance, + Cac.Abilities.Types.Equipment, + Cac.Abilities.Types.Elite + } +end + +Cac.IsAbilityPicked = function ( f240_arg0, f240_arg1, f240_arg2, f240_arg3, f240_arg4, f240_arg5, f240_arg6, f240_arg7 ) + return Cac.GetCacConfig( f240_arg0, f240_arg1, f240_arg2, f240_arg3, f240_arg4, f240_arg7, f240_arg5, f240_arg6 ) +end + +Cac.IsAbilityPickedByName = function ( f241_arg0, f241_arg1, f241_arg2, f241_arg3, f241_arg4, f241_arg5, f241_arg6 ) + local f241_local0, f241_local1 = Cac.GetPerkIndices( f241_arg5 ) + return Cac.IsAbilityPicked( f241_arg0, f241_arg1, f241_arg2, f241_arg3, f241_arg4, f241_arg6, f241_local0 - 1, f241_local1 - 1 ) +end + +Cac.IsAbilityInUseForLoadout = function ( f242_arg0, f242_arg1, f242_arg2, f242_arg3, f242_arg4, f242_arg5 ) + local f242_local0, f242_local1 = Cac.GetPerkIndices( f242_arg5 ) + if Cac.IsAbilityPicked( f242_arg0, f242_arg1, f242_arg2, f242_arg3, f242_arg4, f242_local0 - 1, f242_local1 - 1, "abilitiesPicked" ) then + return true + elseif Cac.GetStreakType( f242_arg0, f242_arg1, f242_arg2, f242_arg3, f242_arg4 ) == "streaktype_specialist" then + if Cac.IsAbilityPicked( f242_arg0, f242_arg1, f242_arg2, f242_arg3, f242_arg4, f242_local0 - 1, f242_local1 - 1, "specialistBonusStreaks" ) then + return true + end + local f242_local2 = f242_arg5 .. "_ks" + for f242_local3 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do + if Cac.GetKillstreak( f242_arg0, f242_arg1, f242_arg2, f242_arg3, f242_arg4, "specialistStreaks", f242_local3 - 1 ) == f242_local2 then + return true + end + end + end + return false +end + +Cac.GetAttachmentType = function ( f243_arg0 ) + return Engine.TableLookup( AttachmentTable.File, AttachmentTable.Cols.Ref, f243_arg0, AttachmentTable.Cols.Group ) +end + +Cac.GetAttachmentList = function ( f244_arg0 ) + local f244_local0 = {} + for f244_local1 = StatsTable.Cols.WeaponAttachFirst, StatsTable.Cols.WeaponAttachLast, 1 do + local f244_local4 = Engine.TableLookup( StatsTable.File, StatsTable.Cols.WeaponRef, f244_arg0, f244_local1 ) + if f244_local4 ~= "" then + f244_local0[#f244_local0 + 1] = f244_local4 + end + end + return f244_local0 +end + +Cac.GetAttachmentTypeList = function ( f245_arg0 ) + local f245_local0 = {} + for f245_local4, f245_local5 in ipairs( Cac.GetAttachmentList( f245_arg0 ) ) do + local f245_local6 = Cac.GetAttachmentType( f245_local5 ) + if f245_local0[f245_local6] == nil then + f245_local0[f245_local6] = 1 + end + end + f245_local1 = {} + for f245_local5, f245_local6 in ipairs( Cac.AttachmentTypes.Types ) do + if f245_local0[f245_local6] ~= nil then + f245_local1[#f245_local1 + 1] = f245_local6 + end + end + return f245_local1 +end + +Cac.IsWeaponDLC = function ( f246_arg0 ) + return "2" == Engine.TableLookup( Cac.WeaponUnlockTable.File, Cac.WeaponUnlockTable.Cols.WeaponRef, f246_arg0, Cac.WeaponUnlockTable.Cols.IsEntitlement ) +end + +Cac.CheckMLGRestriction = function ( f247_arg0 ) + return Engine.GetDvarBool( "xblive_competitionmatch" ) and Cac.IsWeaponDLC( f247_arg0 ) +end + +Cac.SafeGetMatchRule = function ( f248_arg0, f248_arg1, f248_arg2 ) + local f248_local0, f248_local1 = false + local f248_local2 = false + if f248_arg2 ~= nil and f248_arg2 ~= "" then + f248_local2 = MatchRules.CheckData( f248_arg0, f248_arg1, f248_arg2 ) + end + if f248_local2 then + if Cac.CheckMLGRestriction( f248_arg2 ) then + f248_local0 = true + else + f248_local0 = MatchRules.GetData( f248_arg0, f248_arg1, f248_arg2 ) + end + else + f248_local1 = " ERR" + end + return f248_local2, f248_local0, f248_local1 +end + +Cac.PerformMatchRuleToggle = function ( f249_arg0, f249_arg1, f249_arg2 ) + local f249_local0 = false + local f249_local1 = false + if f249_arg2 ~= nil and f249_arg2 ~= "" then + f249_local1 = MatchRules.CheckData( f249_arg0, f249_arg1, f249_arg2 ) + end + if f249_local1 then + MatchRules.SetData( f249_arg0, f249_arg1, f249_arg2, not MatchRules.GetData( f249_arg0, f249_arg1, f249_arg2 ) ) + f249_local0 = true + end + return f249_local0 +end + +Cac.CheckWeaponRestrictions = function ( f250_arg0, f250_arg1 ) + local f250_local0, f250_local1, f250_local2 = nil + local f250_local3 = false + local f250_local4 = false + for f250_local11, f250_local12 in pairs( Cac.WeaponTypes[f250_arg0] ) do + local f250_local8, f250_local9, f250_local10 = Cac.SafeGetMatchRule( "commonOption", "weaponClassRestricted", f250_local12 ) + f250_local1 = f250_local10 + if f250_local8 and f250_local9 then + f250_local3 = true + break + end + f250_local4 = Cac.CheckWeaponTypeRestrictions( f250_local12, f250_arg1 ) + f250_local8, f250_local9, f250_local10 = Cac.SafeGetMatchRule( "commonOption", "weaponRestricted", "iw6_knifeonly" ) + f250_local1 = f250_local10 + if f250_local8 and f250_local9 then + f250_local4 = true + break + elseif f250_local4 then + break + end + end + return f250_local3 or f250_local4 +end + +Cac.CheckWeaponTypeRestrictions = function ( f251_arg0, f251_arg1 ) + local f251_local0, f251_local1, f251_local2 = nil + local f251_local3 = false + for f251_local7, f251_local8 in pairs( Cac.GetWeaponList( f251_arg0, f251_arg1 ) ) do + local f251_local9, f251_local10, f251_local11 = Cac.SafeGetMatchRule( "commonOption", "weaponRestricted", f251_local8 ) + f251_local1 = f251_local11 + if f251_local9 and f251_local10 then + f251_local3 = true + break + end + end + return f251_local3 +end + +Cac.CheckGrenadeRestrictions = function ( f252_arg0 ) + local f252_local0, f252_local1, f252_local2 = nil + local f252_local3 = false + for f252_local7, f252_local8 in pairs( Cac.GetGrenadeList( f252_arg0 ) ) do + local f252_local9, f252_local10, f252_local11 = Cac.SafeGetMatchRule( "commonOption", "perkRestricted", f252_local8 ) + f252_local1 = f252_local11 + if f252_local9 and f252_local10 then + f252_local3 = true + break + end + end + return f252_local3 +end + +Cac.CheckAttachmentRestrictionsHelper = function () + local f253_local0, f253_local1, f253_local2 = nil + local f253_local3 = false + local f253_local4 = false + for f253_local8, f253_local9 in pairs( Cac.AttachmentTypes.Types ) do + local f253_local10, f253_local11, f253_local12 = Cac.SafeGetMatchRule( "commonOption", "attachmentClassRestricted", f253_local9 ) + f253_local1 = f253_local12 + if f253_local10 and f253_local11 then + f253_local3 = true + break + end + f253_local4 = Cac.CheckAttachmentTypeRestrictions( f253_local9 ) + if f253_local4 then + break + end + end + return f253_local3 or f253_local4 +end + +Cac.CheckAttachmentTypeRestrictions = function ( f254_arg0 ) + local f254_local0, f254_local1, f254_local2 = nil + local f254_local3 = false + for f254_local7, f254_local8 in pairs( Cac.GetSimpleAttachmentList( f254_arg0 ) ) do + local f254_local9, f254_local10, f254_local11 = Cac.SafeGetMatchRule( "commonOption", "attachmentRestricted", f254_local8 ) + f254_local1 = f254_local11 + if f254_local9 and f254_local10 then + f254_local3 = true + break + end + end + return f254_local3 +end + +Cac.CheckKillstreakRestrictions = function () + local f255_local0, f255_local1, f255_local2 = nil + local f255_local3 = false + local f255_local4 = false + for f255_local8, f255_local9 in pairs( Cac.StreakTypes ) do + local f255_local10, f255_local11, f255_local12 = Cac.SafeGetMatchRule( "commonOption", "killstreakClassRestricted", f255_local9 ) + f255_local1 = f255_local12 + if f255_local10 and f255_local11 then + f255_local3 = true + break + end + f255_local4 = Cac.CheckKillstreakTypeRestrictions( f255_local9 ) + if f255_local4 then + break + end + end + return f255_local3 or f255_local4 +end + +Cac.CheckKillstreakTypeRestrictions = function ( f256_arg0 ) + local f256_local0, f256_local1, f256_local2 = nil + local f256_local3 = false + local f256_local4, f256_local5 = InitKillstreakRefArray( f256_arg0 ) + for f256_local6 = 1, f256_local5, 1 do + local f256_local9 = f256_local4["ks_" .. f256_local6] + if f256_local9 then + local f256_local10, f256_local11, f256_local12 = Cac.SafeGetMatchRule( "commonOption", "killstreakRestricted", f256_local9 ) + f256_local1 = f256_local12 + if f256_local10 and f256_local11 then + f256_local3 = true + break + end + end + end + local f256_local13 = f256_local3 + if f256_arg0 == "streaktype_specialist" then + f256_local6 = Cac.CheckPerkRestrictions() + else + local f256_local6 = false + end + return f256_local6 +end + +Cac.CheckPerkRestrictions = function () + local f257_local0, f257_local1, f257_local2 = nil + local f257_local3 = false + local f257_local4 = false + for f257_local8, f257_local9 in pairs( Cac.PerkTypes.Refs ) do + local f257_local10, f257_local11, f257_local12 = Cac.SafeGetMatchRule( "commonOption", "perkClassRestricted", f257_local9 ) + f257_local1 = f257_local12 + if f257_local10 and f257_local11 then + f257_local3 = true + break + end + f257_local4 = Cac.CheckPerkTypeRestrictions( f257_local9 ) + if f257_local4 then + break + end + end + return f257_local3 or f257_local4 +end + +Cac.CheckPerkTypeRestrictions = function ( f258_arg0 ) + local f258_local0, f258_local1, f258_local2 = nil + local f258_local3 = false + local f258_local4 = Cac.GetPerkList( f258_arg0 ) + for f258_local5 = 1, #f258_local4, 1 do + local f258_local8 = f258_local4[f258_local5] + if f258_local8 then + local f258_local9, f258_local10, f258_local11 = Cac.SafeGetMatchRule( "commonOption", "perkRestricted", f258_local8 ) + f258_local1 = f258_local11 + if f258_local9 and f258_local10 then + f258_local3 = true + break + end + end + end + return f258_local3 +end + +Cac.ArePerksRestricted = function ( f259_arg0, f259_arg1, f259_arg2, f259_arg3, f259_arg4, f259_arg5 ) + local f259_local0, f259_local1 = nil + local f259_local2 = false + local f259_local3 = true + for f259_local9, f259_local10 in pairs( Cac.Abilities.Types ) do + for f259_local8 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.IsAbilityPicked( f259_arg0, f259_arg1, f259_arg2, f259_arg3, f259_arg4, f259_local10, f259_local8 - 1, f259_arg5 ) then + f259_local3 = false + local f259_local7 = Cac.GetAbilityRef( f259_local10 ) + f259_local0, f259_local1 = Cac.SafeGetMatchRule( "commonOption", "perkRestricted", Cac.GetAbilitySlotRef( f259_local7, f259_local8 ) ) + if not f259_local2 then + f259_local2 = f259_local0 and f259_local1 + end + f259_local0, f259_local1 = Cac.SafeGetMatchRule( "commonOption", "perkClassRestricted", f259_local7 ) + if not f259_local2 then + f259_local2 = f259_local0 and f259_local1 + end + end + end + end + return f259_local2, f259_local3 +end + +Cac.GetLocalRankedPlayercardInfo = function ( f260_arg0 ) + local f260_local0 = Engine.GetPlayerDataEx( f260_arg0, CoD.StatsGroup.Ranked, "activeSquadMember" ) + return { + gamertag = Engine.GetUsernameByController( f260_arg0 ), + patch = Engine.GetPlayerDataEx( f260_arg0, CoD.StatsGroup.Ranked, "squadMembers", f260_local0, "patch" ) or 0, + background = Engine.GetPlayerDataEx( f260_arg0, CoD.StatsGroup.Ranked, "squadMembers", f260_local0, "background" ) or 0, + clantag = Engine.GetProfileDataUseEliteClanTag( f260_arg0 ) and Clan.GetTag( f260_arg0 ) or Engine.GetCustomClanTag( f260_arg0 ) or "", + rank = Lobby.GetRankForXP( Engine.GetPlayerDataEx( f260_arg0, CoD.StatsGroup.Ranked, "squadMembers", f260_local0, "squadMemXP" ) ), + prestige = Cac.GetPrestigeLevel( f260_arg0, "squadMembers" ) + } +end + +Cac.GetRestrictIcon = function ( f261_arg0, f261_arg1, f261_arg2 ) + local self = LUI.UIImage.new() + self:registerAnimationState( "default", { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + right = f261_arg0, + bottom = f261_arg1, + width = f261_arg2, + height = f261_arg2, + material = RegisterMaterial( "icon_new_3" ), + alpha = 1 + } ) + self:animateToState( "default" ) + return self +end + +Cac.IsDefaultClass = function ( f262_arg0 ) + for f262_local3, f262_local4 in ipairs( f0_local0 ) do + if f262_arg0 == f262_local4 then + return true + end + end + return false +end + diff --git a/lui/mp_menus/cacmain.dec.lua b/lui/mp_menus/cacmain.dec.lua new file mode 100644 index 0000000..8b187f0 --- /dev/null +++ b/lui/mp_menus/cacmain.dec.lua @@ -0,0 +1,1355 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function AILoadoutIconHandler( f1_arg0, f1_arg1, f1_arg2, f1_arg3, f1_arg4 ) + if Engine.GetPlayerDataEx( f1_arg0.properties.controller, CoD.GetStatsGroupForGameMode(), f1_arg0.properties.squadLocation, Cac.GetEditSquadMember(), "ai_loadout" ) == f1_arg0.properties.slot then + f1_arg0:animateToState( f1_arg1, f1_arg2 ) + else + f1_arg0:animateToState( f1_arg3, f1_arg4 ) + end +end + +function SetLoadoutIsFocused() + local f2_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + f2_local0.isLoadoutFocused = true +end + +function SetLoadoutNotFocused() + local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + f3_local0.isLoadoutFocused = false +end + +function cac_purchase_loadout_popup() + local f4_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + local f4_local1 = Cac.GetSquadMemberLoadoutUnlockCost( f4_local0.slot ) + return { + type = "generic_yesno_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ), + message_text = Engine.Localize( "@LUA_MENU_PURCHASE_LOADOUT", f4_local1 ), + yes_action = function ( f5_arg0, f5_arg1 ) + Cac.SetClassInUse( f5_arg1.controller, f4_local0.squadLocation, f4_local0.squadMemberIndex, f4_local0.classLocation, f4_local0.slot ) + Cac.SetCurrency( f5_arg1.controller, Cac.GetCurrency( f5_arg1.controller ) - f4_local1 ) + f5_arg0:dispatchEventToRoot( { + name = "cac_update_currency_text" + } ) + f5_arg0:dispatchEventToRoot( { + name = "cac_update_default_text_color", + controller = f5_arg1.controller + } ) + Engine.PlaySound( CoD.SFX.CacSpendPoints ) + LUI.FlowManager.RequestLeaveMenu( f5_arg0 ) + end + , + no_action = MBh.LeaveMenu() + } + } +end + +function cac_cant_purchase_loadout_popup() + local f6_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + return { + type = "generic_confirmation_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_PURCHASE_CAPS" ), + message_text = Engine.Localize( "@LUA_MENU_UNABLE_TO_PURCHASE_LOADOUT", Cac.GetSquadMemberLoadoutUnlockCost( f6_local0.slot ) ), + button_text = Engine.Localize( "@MENU_OK" ), + confirmation_action = MBh.LeaveMenu() + } + } +end + +function CacSlotButtonChildrenFeeder( f7_arg0 ) + local f7_local0 = {} + if SvS.IsSvS() and not Cac.IsDefaultClass( f7_arg0.classLocation ) then + f7_local0[#f7_local0 + 1] = { + type = "UIImage", + id = "ai_loadout_image", + properties = { + slot = f7_arg0.slot, + controller = f7_arg0.controller, + squadLocation = f7_arg0.squadLocation + }, + states = { + default = { + material = RegisterMaterial( "icon_ai_loadout" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 32, + top = 0, + bottom = 32, + alpha = 0 + }, + button_up = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 32, + top = 0, + bottom = 32, + alpha = 1 + }, + button_over = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 40, + right = 72, + top = 0, + bottom = 32, + alpha = 1 + }, + popped = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 32, + right = 80, + top = -8, + bottom = 40, + alpha = 1 + } + }, + handlers = { + menu_create = function ( f8_arg0, f8_arg1 ) + AILoadoutIconHandler( f8_arg0, "button_up", 0, "default", 0 ) + end, + button_over = function ( f9_arg0, f9_arg1 ) + AILoadoutIconHandler( f9_arg0, "button_over", 100, "default", 0 ) + end, + button_up = function ( f10_arg0, f10_arg1 ) + AILoadoutIconHandler( f10_arg0, "button_up", 0, "default", 0 ) + end, + button_update_ai_loadout = function ( f11_arg0, f11_arg1 ) + if f11_arg0:getParent() == f11_arg1.newActiveButton then + Engine.SetPlayerDataEx( f11_arg1.controller, CoD.GetStatsGroupForGameMode(), f7_arg0.squadLocation, Cac.GetEditSquadMember(), "ai_loadout", f11_arg0.properties.slot ) + local f11_local0 = MBh.AnimateSequence( { + { + "button_over", + 0 + }, + { + "popped", + 50 + }, + { + "button_over", + 50 + } + } ) + f11_local0( f11_arg0, f11_arg1 ) + else + f11_arg0:animateToState( "default", 0 ) + end + end + } + } + end + if Cac.IsDefaultClass( f7_arg0.classLocation ) then + f7_local0[#f7_local0 + 1] = { + type = "UIImage", + id = "default_classes_selected_icon", + states = Cac.GetActiveCharacterImageStates(), + properties = f7_arg0, + handlers = { + update_class_in_use = function ( f12_arg0, f12_arg1 ) + if f12_arg1.classLocation == f12_arg0.properties.classLocation and f12_arg1.slot == f12_arg0.properties.slot then + if f12_arg1.inUse then + local f12_local0 = MBh.AnimateSequence( { + { + "button_over", + 0 + }, + { + "popped", + 50 + }, + { + "button_over", + 50 + } + } ) + f12_local0( f12_arg0, f12_arg1 ) + else + f12_arg0:animateToState( "default" ) + end + end + end, + menu_create = function ( f13_arg0, f13_arg1 ) + if Cac.IsClassInUse( f13_arg1.controller, f13_arg0.properties.squadLocation, f13_arg0.properties.squadMemberIndex, f13_arg0.properties.classLocation, f13_arg0.properties.slot ) then + f13_arg0:animateToState( "button_up" ) + else + f13_arg0:animateToState( "default" ) + end + end, + button_over = function ( f14_arg0, f14_arg1 ) + local f14_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f14_arg0 ) + if Cac.IsClassInUse( f14_arg1.controller, f14_arg0.properties.squadLocation, f14_arg0.properties.squadMemberIndex, f14_arg0.properties.classLocation, f14_arg0.properties.slot ) then + f14_arg0:animateToState( "button_over" ) + end + end, + button_up = function ( f15_arg0, f15_arg1 ) + local f15_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f15_arg0 ) + if Cac.IsClassInUse( f15_arg1.controller, f15_arg0.properties.squadLocation, f15_arg0.properties.squadMemberIndex, f15_arg0.properties.classLocation, f15_arg0.properties.slot ) then + f15_arg0:animateToState( "button_up" ) + end + end + } + } + end + if MatchRules.AllowCustomClasses( f7_arg0.classLocation ) then + f7_local0[#f7_local0 + 1] = { + type = "UIImage", + id = "weapon_restriction_icon", + states = { + default = { + rightAnchor = true, + leftAnchor = false, + topAnchor = false, + bottomAnchor = true, + right = 32, + bottom = -7, + width = 32, + height = 32, + material = RegisterMaterial( "icon_new_3" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + properties = f7_arg0, + handlers = { + hide_restrictions_icon = HideRestrictionsIcon, + show_restrictions_icon = UpdateRestrictionsIcon, + menu_create = UpdateRestrictionsIcon + } + } + end + if f7_arg0.slot >= Cac.Settings.DataLoc.loadouts.baseClassSlots and Cac.IsCaCSlotLocked( f7_arg0.controller, f7_arg0.squadLocation, f7_arg0.squadMemberIndex, f7_arg0.classLocation, f7_arg0.slot ) and not Cac.IsDefaultClass( f7_arg0.classLocation ) then + local f7_local1, f7_local2, f7_local3, f7_local4 = GetTextDimensions( Cac.GetLoadoutName( f7_arg0.controller, f7_arg0.squadLocation, f7_arg0.squadMemberIndex, f7_arg0.classLocation, f7_arg0.slot ), CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + f7_local0[#f7_local0 + 1] = { + type = "UIImage", + id = "mdlc", + states = { + default = { + material = RegisterMaterial( "icon_dlc" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 7, + height = 24, + right = -(f7_local3 - f7_local1) - 60, + width = 24, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + menu_create = MBh.AnimateSequence( { + { + "default", + 200 + }, + { + "visible", + 150 + } + } ) + } + } + end + return f7_local0 +end + +function UpdateRestrictionsIcon( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg0:getParent() + if MatchRules.AllowCustomClasses( f16_arg0.properties.classLocation ) then + if MatchRules.CustomClassIsRestricted( f16_arg0.properties.controller, CoD.GetStatsGroupForGameMode(), f16_arg0.properties.squadLocation, f16_arg0.properties.squadMemberIndex, f16_arg0.properties.classLocation, f16_arg0.properties.slot ) then + f16_arg0:animateToState( "visible" ) + else + f16_arg0:animateToState( "default" ) + end + end +end + +function HideRestrictionsIcon( f17_arg0, f17_arg1 ) + if MatchRules.AllowCustomClasses( f17_arg0.properties.classLocation ) then + if MatchRules.CustomClassIsRestricted( f17_arg0.properties.controller, CoD.GetStatsGroupForGameMode(), f17_arg0.properties.squadLocation, f17_arg0.properties.squadMemberIndex, f17_arg0.properties.classLocation, f17_arg0.properties.slot ) then + f17_arg0:dispatchEventToRoot( { + name = "show_class_restrictions_warning", + immediate = true + } ) + else + f17_arg0:dispatchEventToRoot( { + name = "hide_class_restrictions_warning", + immediate = true + } ) + end + f17_arg0:animateToState( "default" ) + end +end + +function LoadoutButtonUp( f18_arg0, f18_arg1 ) + if not Cac.IsCaCSlotLocked( f18_arg0.properties.controller, f18_arg0.properties.squadLocation, f18_arg0.properties.squadMemberIndex, f18_arg0.properties.classLocation, f18_arg0.properties.slot ) then + f18_arg0:processEvent( { + name = "hide_new_icon" + } ) + end + if MatchRules.AllowCustomClasses( f18_arg0.properties.classLocation ) then + f18_arg0:processEvent( { + name = "show_restrictions_icon" + } ) + end +end + +function LoadoutButtonOver( f19_arg0, f19_arg1 ) + local f19_local0 = f19_arg0.properties.controller + local f19_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f19_arg0 ) + SetLoadoutIsFocused() + f19_local1.classLocation = f19_arg0.properties.classLocation + f19_local1.currSlot = f19_arg0.properties.slot + f19_arg0:dispatchEventToRoot( { + name = "cac_set_slot", + slot = f19_arg0.properties.slot, + controller = f19_local0, + dispatchChildren = true, + classLocation = f19_arg0.properties.classLocation, + immediate = true + } ) + f19_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f19_local0, + dispatchChildren = true, + classLocation = f19_arg0.properties.classLocation + } ) + f19_arg0:dispatchEventToRoot( { + name = "refresh_specialist_abilities_recap", + controller = f19_local0, + specialistType = Cac.GetPerk( f19_local0, f19_arg0.properties.squadLocation, f19_arg0.properties.squadMemberIndex, f19_arg0.properties.classLocation, f19_arg0.properties.slot, Cac.Indices.StreakType ) == "streaktype_specialist", + selected = false, + immediate = true + } ) + local f19_local2 = not Cac.IsCaCSlotLocked( f19_arg0.properties.controller, f19_arg0.properties.squadLocation, f19_arg0.properties.squadMemberIndex, f19_arg0.properties.classLocation, f19_arg0.properties.slot ) + if f19_local2 then + AddLoadoutSpecificButtonHelpers( f19_arg0, f19_arg1 ) + else + RemoveLoadoutSpecificButtonHelpers( f19_arg0, f19_arg1 ) + end + if f19_arg0.disabled and f19_local2 and not Cac.IsCaCSlotRestricted( f19_local0, f19_arg0.properties.squadLocation, f19_arg0.properties.squadMemberIndex, f19_arg0.properties.classLocation, f19_arg0.properties.slot ) then + f19_arg0:processEvent( { + name = "enable" + } ) + end + if MatchRules.AllowCustomClasses( f19_arg0.properties.classLocation ) then + f19_arg0:processEvent( { + name = "hide_restrictions_icon" + } ) + end + if f19_arg0.properties.slot >= Cac.Settings.DataLoc.loadouts.baseClassSlots then + Cac.MarkItemNoMoreNewIcon( f19_local0, tostring( f19_arg0.properties.slot - Cac.Settings.DataLoc.loadouts.baseClassSlots + 1 ), "LoadoutSlot" ) + f19_arg0:processEvent( { + name = "hide_new_icon" + } ) + end + if f19_local2 then + if Cac.AnyUnseenMDLCItems( f19_local0, { + "Camo", + "Weapon_Primary", + "Weapon_Secondary" + } ) then + f19_arg0:processEvent( { + name = "show_new_icon" + } ) + end + else + f19_arg0:processEvent( { + name = "hide_new_icon" + } ) + end + local f19_local3 = Cac.GetSquadMemberLoadoutUnlockCost( f19_arg0.properties.slot ) + if f19_local2 or f19_local3 <= 0 then + f19_arg0:dispatchEventToRoot( { + name = "hide_loadout_purchase_text", + immediate = true + } ) + else + f19_arg0:dispatchEventToRoot( { + name = "show_loadout_purchase_text", + immediate = true, + cost = f19_local3 + } ) + end + if SvS.IsSvS() then + if f19_arg0.properties.slot > SvS.MaxAILoadoutIndex then + f19_arg0:dispatchEventToRoot( { + name = "show_extended_loadout_warning" + } ) + else + f19_arg0:dispatchEventToRoot( { + name = "hide_extended_loadout_warning" + } ) + end + end +end + +function CacSlotListChildrenFeeder( f20_arg0 ) + local f20_local0 = {} + local f20_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + local f20_local2 = f20_arg0.exclusiveController + if not f20_local2 then + DebugPrint( "[WARNING] CAC: using controller index 0, this is only ok if you are editing a menu" ) + f20_local2 = 0 + end + local f20_local3 = 1 + local f20_local4 = 1 + local f20_local5 = false + if Cac.IsDefaultClass( f20_arg0.classLocation ) then + f20_local5 = true + f20_local4 = 2 + 1 + end + local f20_local6 = f20_arg0.classLocation + local f20_local7 = f20_arg0.squadLocation + local f20_local8 = f20_arg0.squadMemberIndex + repeat + if f20_local5 then + f20_local4 = f20_local4 - 1 + local f20_local9 = Cac.AddTeamName( "defaultClassesTeam" .. f20_local4, f20_local4 ) + if f20_local9 ~= nil then + f20_local0[#f20_local0 + 1] = f20_local9 + end + end + for f20_local9 = 0, Cac.GetNumCustomSlots( f20_local2, f20_local6 ) - 1, 1 do + local f20_local12 = f20_local9 + if Cac.IsCaCSlotLocked( f20_local2, f20_local7, f20_local8, f20_local6, f20_local12 ) and f20_local12 >= Cac.Settings.DataLoc.loadouts.baseClassSlots and Engine.HasExtendedLoadouts( f20_local2 ) then + Cac.SetClassInUse( f20_local2, f20_local7, f20_local8, f20_local6, f20_local12 ) + local f20_local13 = false + end + local f20_local14 = function () + local f21_local0 = Cac.GetLoadoutName( f20_local2, f20_local7, f20_local8, f20_local6, f20_local12 ) + if (GetCurrentGameType() == "sd" or GetCurrentGameType() == "sr") and f20_local12 == 5 and f20_local5 then + f21_local0 = Engine.Localize( "LUA_MENU_BOMB_CARRIER" ) + end + if GetCurrentGameType() == "infect" and f20_local12 == 1 and f20_local5 and f20_local4 == Teams.axis then + f21_local0 = Engine.Localize( "LUA_MENU_INFECT_SPECIAL_CLASS" ) + end + return f21_local0 + end + + local f20_local15 = f20_local14( class ) + local f20_local16 = function () + return Cac.IsCaCSlotLocked( f20_local2, f20_local7, f20_local8, f20_local6, f20_local12 ) or Cac.IsCaCSlotRestricted( f20_local2, f20_local7, f20_local8, f20_local6, f20_local12 ) + end + + local f20_local17 + if f20_local12 ~= f20_local1.slot or f20_local6 ~= f20_local1.classLocation then + f20_local17 = false + else + f20_local17 = true + end + f20_local0[#f20_local0 + 1] = { + type = "UIGenericButton", + id = "class_" .. f20_local4 .. "_" .. f20_local12, + disabled = f20_local16(), + listDefaultFocus = f20_local17, + properties = { + isLoadoutButton = true, + controller = f20_local2, + button_text = f20_local15, + allowDisabledAction = true, + button_over_func = LoadoutButtonOver, + button_over_disable_func = LoadoutButtonOver, + button_up_func = LoadoutButtonUp, + button_disable_func = LoadoutButtonUp, + squadLocation = f20_local7, + squadMemberIndex = f20_local8, + classLocation = f20_local6, + slot = f20_local12, + currentTeam = f20_local4 + }, + handlers = { + refresh_new_icons = function ( f23_arg0, f23_arg1 ) + local f23_local0 = f23_arg0.properties + local f23_local1 = f23_local0.slot >= Cac.Settings.DataLoc.loadouts.baseClassSlots + local f23_local2 = Cac.IsCaCSlotLocked( f23_local0.controller, f23_local0.squadLocation, f23_local0.squadMemberIndex, f23_local0.classLocation, f23_local0.slot ) + if f23_local1 and Cac.ItemHasNewIcon( f23_local0.controller, tostring( f23_arg0.properties.slot - Cac.Settings.DataLoc.loadouts.baseClassSlots + 1 ), "LoadoutSlot" ) then + f23_arg0:processEvent( { + name = "flash_new_icon" + } ) + end + end, + update_loadout_name = function ( f24_arg0, f24_arg1 ) + if f24_arg1.loadoutIndex == f20_local12 and f24_arg1.classLocation == f24_arg0.properties.classLocation then + f24_arg0:setText( f24_arg1.newName ) + end + end, + focus_loadout = function ( f25_arg0, f25_arg1 ) + f25_arg0.listDefaultFocus = f25_arg1.loadoutIndex == f20_local12 + end + }, + childrenFeeder = CacSlotButtonChildrenFeeder, + properties = function ( f26_arg0, f26_arg1 ) + local f26_local0 = Cac.GetCurrency( f26_arg1.controller ) + if Cac.Settings.DataLoc[f26_arg0.properties.classLocation].baseClassSlots <= f26_arg0.properties.slot then + if Engine.IsPC() then + Sns.OpenStoreMenu( f26_arg1.controller ) + else + Sns.OpenStoreLinkConfirmPopup( f26_arg1.controller, Engine.TableLookup( UnlockTable.File, UnlockTable.Cols.ItemId, "extraslots", UnlockTable.Cols.DLCOffer ) ) + end + elseif f26_local0 < Cac.GetSquadMemberLoadoutUnlockCost( f26_arg0.properties.slot ) then + LUI.FlowManager.RequestPopupMenu( f26_arg0, "cac_cant_purchase_loadout_popup", true, f26_arg1.controller, false, f20_arg0 ) + else + LUI.FlowManager.RequestPopupMenu( f26_arg0, "cac_purchase_loadout_popup", true, f26_arg1.controller, false, f20_arg0 ) + end + end, + properties = function ( f27_arg0, f27_arg1 ) + local f27_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + f27_local0.currTeam = f27_arg0.properties.currentTeam + local f27_local1 = f27_arg0:getParent() + f27_local1:processEvent( { + name = "disable" + } ) + f27_arg0:dispatchEventToRoot( { + name = "cac_recap_slide_left", + immediate = true + } ) + f27_arg0:dispatchEventToRoot( { + name = "squad_move_left", + immediate = true + } ) + f27_arg0:dispatchEventToRoot( { + name = "update_header_text", + string = f20_local14( f27_arg0 ), + immediate = true + } ) + f27_arg0:dispatchEventToRoot( { + name = "cac_update_currency_text", + immediate = true + } ) + end + } + if GetCurrentGameType() == "infect" and Cac.IsDefaultClass( f20_local6 ) and (not (f20_local4 ~= Teams.allies or f20_local12 ~= 0) or f20_local4 == Teams.axis and f20_local12 == 1) then + break + end + end + if not IsCurrentGameTypeteamBased() then + + else + + end + until not f20_local5 or f20_local5 and f20_local4 == 1 + if not Cac.IsDefaultClass( f20_arg0.classLocation ) then + local f20_local9, f20_local10, f20_local11, f20_local12 = GetTextDimensions( Engine.Localize( "@LUA_MENU_PURCHASE_COLON" ), CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f20_local13 = 16 + local f20_local14 = 16 + local f20_local15 = 32 + local f20_local16 = 8 + local f20_local17 = 10 + f20_local0[#f20_local0 + 1] = { + type = "UIElement", + id = "button_spacer", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = 10, + width = 100 + } + } + } + f20_local0[#f20_local0 + 1] = { + type = "UIHorizontalList", + id = "loadout_locked_for_purchase_hl", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 100, + height = CoD.TextSettings.NormalFont.Height, + width = 300, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + show_loadout_purchase_text = function ( f28_arg0, f28_arg1 ) + local f28_local0 = f28_arg0:getChildById( "loadout_locked_for_purchase_cost_text" ) + f28_local0:setText( f28_arg1.cost ) + f28_arg0:animateToState( "visible" ) + end, + hide_loadout_purchase_text = function ( f29_arg0, f29_arg1 ) + f29_arg0:animateToState( "default" ) + end + }, + children = { + { + type = "UIImage", + id = "left_bullet_point", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 3, + left = 100, + height = 13, + width = 5, + material = RegisterMaterial( "white" ), + alpha = 0.6 + } + } + }, + { + type = "UIElement", + id = "loadout_locked_for_purchase_spacer1", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = f20_local16 + } + } + }, + { + type = "UIText", + id = "loadout_locked_for_purchase_text", + properties = { + text = Engine.Localize( "@LUA_MENU_PURCHASE_COLON" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + width = f20_local11 - f20_local9, + font = CoD.TextSettings.NormalFont.Font, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alignment = LUI.Alignment.Right + } + } + }, + { + type = "UIElement", + id = "loadout_locked_for_purchase_spacer2", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = f20_local17 + } + } + }, + { + type = "UIImage", + id = "loadout_locked_for_purchase_image", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f20_local13 * 0.5, + left = -f20_local14 * 0.5, + height = f20_local13, + width = f20_local14, + material = RegisterMaterial( "icon_unlock_token_active" ) + } + } + }, + { + type = "UIText", + id = "loadout_locked_for_purchase_cost_text", + properties = { + text = "" + }, + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + width = f20_local15, + font = CoD.TextSettings.NormalFont.Font, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alignment = LUI.Alignment.Left + } + } + } + } + } + if SvS.IsSvS() then + f20_local0[#f20_local0 + 1] = { + type = "UIElement", + id = "loadout_locked_for_ai_spacer", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + height = 10 + } + } + } + f20_local0[#f20_local0 + 1] = { + type = "UIElement", + id = "loadout_locked_for_ai_container", + states = { + default = { + material = RegisterMaterial( "white" ), + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = 32, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + show_extended_loadout_warning = function ( f30_arg0, f30_arg1 ) + f30_arg0:animateToState( "visible" ) + end, + hide_extended_loadout_warning = function ( f31_arg0, f31_arg1 ) + f31_arg0:animateToState( "default" ) + end + }, + children = { + { + type = "UIImage", + id = "loadout_locked_for_ai_icon", + states = { + default = { + material = RegisterMaterial( "icon_new" ), + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = -6, + left = 93, + height = 32, + width = 32 + } + } + }, + { + type = "UIText", + id = "loadout_locked_for_ai_text", + properties = { + text = Engine.Localize( "PATCH_MENU_EXTRA_LOADOUT_NO_AI" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 125, + width = 300, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + red = Cac.Swatches.warning_text.r, + green = Cac.Swatches.warning_text.g, + blue = Cac.Swatches.warning_text.b, + alignment = LUI.Alignment.Left + } + } + } + } + } + end + end + return f20_local0 +end + +function IsLoadoutFocused() + local f32_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + return f32_local0.isLoadoutFocused +end + +function ChangeNameAction( f33_arg0, f33_arg1 ) + if not IsLoadoutFocused() then + return + end + local f33_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + local f33_local1 = f33_arg0:getParent() + local f33_local2 = f33_local1.properties.exclusiveController + local f33_local3 = f33_local1.properties.squadLocation + local f33_local4 = f33_local1.properties.squadMemberIndex + local f33_local5 = f33_local1.properties.classLocation + if f33_local0 and f33_local0.slot then + if Cac.IsCaCSlotLocked( f33_local2, f33_local3, f33_local4, f33_local5, f33_local0.slot ) then + Engine.PlaySound( CoD.SFX.DenySelect ) + else + Engine.PlaySound( CoD.SFX.MouseClick ) + local f33_local6 = Cac.GetLoadoutName( f33_local2, f33_local3, f33_local1.properties.squadMemberIndex, f33_local0.classLocation, f33_local0.slot ) + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), true, "OpenKeyboard" ) + local f33_local7 = Engine.OpenScreenKeyboard + local f33_local8 = f33_local2 + local f33_local9 = Engine.Localize( "@LUA_MENU_ENTER_NAME" ) + local f33_local10 = f33_local6 or "" + local f33_local11 = 15 + local f33_local12 = true + local f33_local13 = IsOnlineMatch() + if f33_local13 then + f33_local13 = Cac.IsDefaultClass( f33_local0.classLocation ) + end + f33_local7( f33_local8, f33_local9, f33_local10, f33_local11, f33_local12, f33_local13 ) + end + end +end + +function CopyLoadoutAction( f34_arg0, f34_arg1 ) + if not IsLoadoutFocused() then + return + end + local f34_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + local f34_local1 = {} + local f34_local2 = f34_arg0:getParent() + f34_local1.controller = f34_arg1.controller + f34_local1.squadLocation = f34_local2.properties.squadLocation + f34_local1.squadMemberIndex = f34_local2.properties.squadMemberIndex + f34_local1.classLocation = f34_local0.classLocation + f34_local1.slot = f34_local0.slot + local f34_local3 = not Cac.IsCaCSlotLocked( f34_local1.controller, f34_local1.squadLocation, f34_local1.squadMemberIndex, f34_local1.classLocation, f34_local1.slot ) + if GetCurrentGameType() == "infect" and Cac.IsDefaultClass( f34_local1.classLocation ) then + return + elseif not f34_local3 then + Engine.PlaySound( CoD.SFX.DenySelect ) + else + LUI.FlowManager.RequestPopupMenu( f34_arg0, "copy_loadout_popup", true, f34_arg1.controller, false, f34_local1 ) + end +end + +function OnNameChangeComplete( f35_arg0, f35_arg1 ) + local f35_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + local f35_local1 = f35_arg0:getParent() + local f35_local2 = f35_arg1.text + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), false, "CloseKeyboard" ) + if f35_local0 and f35_local0.slot and f35_local2 then + if Cac.IsDefaultClass( f35_local1.properties.classLocation ) then + MatchRules.SetData( "defaultClasses", Cac.Settings.DataLoc[f35_local0.classLocation].teamName, f35_local0.slot, "class", "name", f35_local2 ) + else + Cac.SetCacConfig( f35_local1.properties.exclusiveController, f35_local1.properties.squadLocation, f35_local1.properties.squadMemberIndex, f35_local0.classLocation, f35_local0.slot, "name", f35_local2 ) + end + f35_arg0:dispatchEventToRoot( { + name = "update_loadout_name", + newName = f35_local2, + loadoutIndex = f35_local0.slot, + classLocation = f35_local0.classLocation, + immediate = true + } ) + end +end + +function OnSelectSquadMemberAction( f36_arg0, f36_arg1 ) + local f36_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_main" ) + if f36_local0.allowMemberSwap then + f36_arg0:dispatchEventToRoot( { + name = "switch_to_member_select", + immediate = true, + controller = f36_arg1.controller + } ) + end +end + +function cac_class_vlist() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + 90 + } + } + } +end + +function AltButtonAction( f38_arg0, f38_arg1 ) + local f38_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f38_arg0 ) + local f38_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + if not Cac.IsDefaultClass( f38_local0.classLocation ) then + local f38_local2 = f38_arg0:getParent() + f38_local2.properties.alternateCacMenus = not f38_local2.properties.alternateCacMenus + LUI.FlowManager.RequestAddMenu( f38_arg0, "cac_customize_main", true, f38_arg1.controller, false, { + squadLocation = f38_local2.properties.squadLocation, + classLocation = f38_local2.properties.classLocation, + squadMemberIndex = f38_local2.properties.squadMemberIndex, + alternateCacMenus = f38_local2.properties.alternateCacMenus, + allowMemberSwap = f38_local2.properties.allowMemberSwap, + loadout_slot = f38_local1.slot + } ) + LUI.FlowManager.RequestLeaveMenuByName( "cac_main" ) + LUI.FlowManager.RequestLeaveMenuByName( "cac_edit_main" ) + else + local f38_local2 = not Cac.IsClassInUse( f38_arg1.controller, f38_local0.squadLocation, f38_local0.squadMemberIndex, f38_local0.classLocation, f38_local0.currSlot ) + Cac.SetClassInUse( f38_arg1.controller, f38_local0.squadLocation, f38_local0.squadMemberIndex, f38_local0.classLocation, f38_local0.currSlot, f38_local2 ) + local f38_local3 = f38_arg0:getParent() + f38_local3:processEvent( { + name = "update_class_in_use", + classLocation = f38_local0.classLocation, + slot = f38_local0.currSlot, + inUse = f38_local2 + } ) + end +end + +function cac_customize_char_btn_handlers() + return { + type = "UIBindButton", + id = "customize_char_button", + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = -200, + right = 0, + top = -50, + bottom = 0 + } + }, + handlers = { + button_alt1 = AltButtonAction, + button_alt2 = OnSelectSquadMemberAction, + button_shoulderr = ChangeNameAction, + button_shoulderl = CopyLoadoutAction, + text_input_complete = OnNameChangeComplete, + button_start = function ( f40_arg0, f40_arg1 ) + if not IsLoadoutFocused() then + return + end + local f40_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_main" ) + if SvS.IsSvS() and not Cac.IsDefaultClass( f40_local0.classLocation ) then + local f40_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + if Cac.IsCaCSlotLocked( f40_arg1.controller, f40_local0.squadLocation, f40_local0.squadMemberIndex, f40_local0.classLocation, f40_local1.slot ) or f40_local1.slot > SvS.MaxAILoadoutIndex then + Engine.PlaySound( CoD.SFX.DenySelect ) + else + Engine.PlaySound( CoD.SFX.CacSetAILoadout ) + local f40_local2 = f40_arg0:getParent() + f40_local2:processEvent( { + name = "update_ai_loadout", + controller = f40_arg1.controller + } ) + end + end + end + + } + } +end + +function AddLoadoutSpecificButtonHelpers( f41_arg0, f41_arg1 ) + local f41_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_main" ) + local f41_local1 = Cac.IsDefaultClass( f41_arg0.properties.classLocation ) + if not f41_local1 or GetCurrentGameType() ~= "infect" then + f41_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_shoulderl", + helper_text = Engine.Localize( "@LUA_MENU_COPY" ), + side = "left", + clickable = true, + immediate = true + } ) + end + f41_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_shoulderr", + helper_text = Engine.Localize( "@LUA_MENU_EDIT_LOADOUT_NAME" ), + side = "left", + clickable = true, + immediate = true + } ) + if SvS.IsSvS() and not f41_local1 then + if f41_arg0.properties.slot > SvS.MaxAILoadoutIndex then + f41_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + immediate = true + } ) + else + f41_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = Engine.Localize( "@LUA_MENU_SET_AI_LOADOUT" ), + side = "left", + clickable = true, + immediate = true + } ) + end + end +end + +function RemoveLoadoutSpecificButtonHelpers( f42_arg0, f42_arg1 ) + f42_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_shoulderl", + helper_text = "", + side = "left", + immediate = true + } ) + f42_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_shoulderr", + helper_text = "", + side = "left", + immediate = true + } ) + f42_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + immediate = true + } ) +end + +function SquadListOnCreate( f43_arg0, f43_arg1 ) + local f43_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_main" ) + f43_local0.allowMemberSwap = f43_arg0.properties.allowMemberSwap + f43_arg0:processEvent( { + name = "squad_move_right" + } ) + f43_arg0:processEvent( { + name = "refresh_new_icons", + immediate = true + } ) + f43_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + immediate = true + } ) + f43_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = "", + side = "left", + immediate = true + } ) + f43_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_shoulderl", + helper_text = "", + side = "left", + immediate = true + } ) + f43_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_shoulderr", + helper_text = "", + side = "left", + immediate = true + } ) + f43_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + immediate = true + } ) + f43_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true, + immediate = true, + ignorePopups = true + } ) + if not Cac.IsDefaultClass( f43_local0.classLocation ) then + f43_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_CUSTOMIZE_CHAR" ), + side = "left", + clickable = true, + immediate = true + } ) + if f43_local0.allowMemberSwap then + f43_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@LUA_MENU_SELECT_SQUAD_MEMBER" ), + side = "left", + clickable = true, + immediate = true + } ) + end + else + f43_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "PATCH_MENU_TOGGLE_DEFAULT_LOADOUT" ), + side = "left", + clickable = true, + immediate = true + } ) + end + AddLoadoutSpecificButtonHelpers( f43_arg0 ) +end + +function SquadListOnClose( f44_arg0, f44_arg1 ) + f44_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + immediate = true + } ) + f44_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = "", + side = "left", + immediate = true, + clickable = true + } ) + f44_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_shoulderl", + helper_text = "", + side = "left", + immediate = true + } ) + f44_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_shoulderr", + helper_text = "", + side = "left", + immediate = true + } ) + f44_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + immediate = true + } ) +end + +function CacExitFunction( f45_arg0, f45_arg1 ) + if f45_arg0.properties.alternateCacMenus then + LUI.FlowManager.RequestAddMenu( f45_arg0, "cac_customize_main", true, f45_arg1.controller, true, { + squadLocation = f45_arg0.properties.squadLocation, + classLocation = f45_arg0.properties.classLocation, + squadMemberIndex = f45_arg0.properties.squadMemberIndex + } ) + else + LUI.FlowManager.RequestLeaveMenu( f45_arg0, true ) + end +end + +function cac_main() + return { + type = "UIElement", + id = "cac_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = -600, + right = -600 + }, + onScreen = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + }, + hiddenLeft = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = -600, + right = -600 + } + }, + properties = { + slot = 0, + classLocation = "loadouts", + alternateCacMenus = false, + squadLocation = "privateMatchSquadMembers", + squadMemberIndex = 0, + allowMemberSwap = false + }, + handlers = { + cac_exit = CacExitFunction, + squad_move_left = MBh.AnimateToStateWithEvent( "hiddenLeft", 125 ), + squad_move_right = MBh.AnimateToState( "onScreen", 125 ), + transition_complete_hiddenLeft = MBh.LeaveMenu( false ), + menu_create = SquadListOnCreate, + menu_close = SquadListOnClose, + focus_loadout = function ( f47_arg0, f47_arg1 ) + f47_arg0:clearSavedState() + end + + }, + children = { + { + type = "cac_class_vlist", + id = "create_squad_list", + properties = { + slot = MBh.Property( "slot" ), + classLocation = MBh.Property( "classLocation" ), + alternateCacMenus = MBh.Property( "alternateCacMenus" ), + squadLocation = MBh.Property( "squadLocation" ), + squadMemberIndex = MBh.Property( "squadMemberIndex" ) + }, + handlers = { + update_ai_loadout = function ( f48_arg0, f48_arg1 ) + local f48_local0 = f48_arg0:getFirstChild() + while f48_local0 do + if f48_local0.properties.isLoadoutButton and f48_local0:isInFocus() then + f48_arg0:dispatchEventToChildren( { + name = "button_update_ai_loadout", + controller = f48_arg1.controller, + newActiveButton = f48_local0 + } ) + break + end + f48_local0 = f48_local0:getNextSibling() + end + end + + }, + childrenFeeder = CacSlotListChildrenFeeder + }, + { + type = "cac_customize_warning", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 5, + right = 0, + top = 610, + bottom = 0, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + properties = { + text_offset = 6, + additional_handlers = { + menu_create = function ( f49_arg0, f49_arg1 ) + local f49_local0 = f49_arg0:getParent() + f49_local0 = f49_local0.properties.exclusiveController + if not f49_local0 then + f49_local0 = Engine.GetFirstActiveController() + end + local f49_local1 = {} + for f49_local5, f49_local6 in ipairs( Cac.Customization.Fields ) do + if f49_local6.UnlockType then + table.insert( f49_local1, f49_local6.UnlockType ) + end + end + if Cac.AnyUnseenMDLCItems( f49_local0, f49_local1 ) then + f49_arg0:processEvent( { + name = "show_warning", + text = Engine.Localize( "LUA_MENU_NEW_ITEM_AVAILABLE" ), + style = 2 + } ) + end + end + + } + } + }, + { + type = "UIBindButton", + id = "back_button_to_old_menu", + handlers = { + button_secondary = MBh.EmitEventToRoot( { + name = "cac_exit", + dispatchChildren = true + } ) + } + }, + { + type = "cac_customize_char_btn_handlers", + id = "button_handlers_id" + } + } + } +end + +LUI.MenuBuilder.registerDef( "cac_main", cac_main ) +LUI.MenuBuilder.registerDef( "cac_class_vlist", cac_class_vlist ) +LUI.MenuBuilder.registerDef( "cac_customize_char_btn_handlers", cac_customize_char_btn_handlers ) +LUI.MenuBuilder.registerDef( "cac_purchase_loadout_popup", cac_purchase_loadout_popup ) +LUI.MenuBuilder.registerDef( "cac_cant_purchase_loadout_popup", cac_cant_purchase_loadout_popup ) +LockTable( _M ) diff --git a/lui/mp_menus/cacmemberselect.dec.lua b/lui/mp_menus/cacmemberselect.dec.lua new file mode 100644 index 0000000..601f4f1 --- /dev/null +++ b/lui/mp_menus/cacmemberselect.dec.lua @@ -0,0 +1,1377 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( "Registering " .. _NAME ) +SQUAD_MEMBER_NAME_LENGTH = 20 +function OnCreate( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + f1_local0.nextScreen = f1_arg0.properties.next_screen + f1_local0.classLocation = f1_arg0.properties.class_location + f1_local0.squadLocation = f1_arg0.properties.squad_location + f1_local0.forceToNextScreen = f1_arg0.properties.force_to_next_screen + f1_local0.exclusiveController = f1_arg0.properties.exclusiveController + f1_local0.memberWindow = f1_arg0:getChildById( "member_select_member_window_id" ) + f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + UpdateMemberWindow( f1_local0.exclusiveController, f1_local0.memberWindow, Cac.GetEditSquadMember(), true ) + local f1_local1 = false + local f1_local2 = CoD.GetStatsGroupForGameMode() + if f1_local2 == CoD.StatsGroup.Ranked then + f1_local1 = Engine.GetPlayerDataEx( f1_arg0.properties.exclusiveController, CoD.GetStatsGroupForGameMode(), "squadMembers", Cac.GetActiveSquadMember( f1_arg0.properties.exclusiveController ) or 0, "defaultSet" ) + end + if f1_local2 == CoD.StatsGroup.Ranked and (f1_local1 == nil or f1_local1 == false) and not f1_local0.alreadyWelcomed then + f1_arg0:dispatchEventToRoot( { + name = "first_time" + } ) + end + Engine.Exec( "uploadstats", f1_arg1.controller ) + f1_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "LUA_MENU_SET_ACTIVE_SQUAD_MEMBER_HELPER" ), + side = "left", + clickable = true + } ) +end + +function UpdateMemberWindow( f2_arg0, f2_arg1, f2_arg2, f2_arg3 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg1 ) + local f2_local1 = f2_local0.squadLocation + if not f2_local1 then + f2_local1 = f2_arg1.properties.squad_location + end + local f2_local2 + if f2_arg3 then + f2_local2 = Cac.GetSquadMemberName( f2_arg0, f2_local1, f2_arg2 ) + if not f2_local2 then + + else + local f2_local3 + if f2_arg3 then + f2_local3 = Engine.TableLookup( "mp/cac/backgrounds.csv", 0, Cac.GetBackgroundIndex( f2_arg0, f2_local1, f2_arg2 ), 1 ) + if not f2_local3 then + + else + local f2_local4 + if f2_arg3 then + f2_local4 = Cac.GetPatchIndex( f2_arg0, f2_local1, f2_arg2 ) + if not f2_local4 then + + else + local f2_local5 + if f2_arg3 then + f2_local5 = Cac.GetPatchbackingIndex( f2_arg0, f2_local1, f2_arg2 ) + if not f2_local5 then + + else + local f2_local6 = Cac.Customization.Animations.default + local f2_local7 + if f2_arg3 then + f2_local7 = tonumber( Engine.GetPlayerDataEx( f2_arg0, CoD.GetStatsGroupForGameMode(), f2_local1, f2_arg2, "squadMemXP" ) ) + if not f2_local7 then + + else + local f2_local8 = Lobby.GetRankForXP( f2_local7 ) + local f2_local9 = Cac.GetPrestigeLevel( f2_arg0, f2_local1 ) + local f2_local10 = Engine.GetUsernameByController and Engine.GetUsernameByController( f2_arg0 ) or f2_local2 + local f2_local11 = Engine.GetProfileDataUseEliteClanTag( f2_arg0 ) and Engine.GetClanTag( f2_arg0 ) or Engine.GetCustomClanTag( f2_arg0 ) + f2_arg1:setDisplayName( f2_local2 ) + f2_arg1:setBackground( f2_local3 ) + if Cac.HasSquadMemberPrestiged( f2_arg0, f2_local0.squadLocation, f2_arg2 ) then + local f2_local12 = Cac.GetSquadMemberPrestigeLevel( f2_arg0, f2_local0.squadLocation, f2_arg2 ) + f2_arg1:processEvent( { + name = "show_prestige_icon" + } ) + f2_arg1:setPrestigeIcon( RegisterMaterial( Rank.GetRankIcon( f2_local8, f2_local12 ) ) ) + else + f2_arg1:processEvent( { + name = "hide_prestige_icon" + } ) + end + f2_arg1:updateSquadMember( f2_arg0, f2_arg2 ) + f2_arg1:processEvent( { + name = "update_playercard", + gamertag = f2_local10, + clantag = f2_local11, + background = Cac.GetBackgroundIndex( f2_arg0, f2_local1, f2_arg2 ), + rank = f2_local8, + prestige = f2_local9, + patchShape = f2_local5, + patchEmblem = f2_local4, + experience = f2_local7 + } ) + if f2_arg3 then + f2_arg1:processEvent( { + name = "set_normal" + } ) + f2_arg1:processEvent( { + name = "show_playercard", + dispatchChildren = true + } ) + f2_arg1:dispatchEventToRoot( { + name = "hide_unlock_text", + dispatchChildren = true, + immediate = true + } ) + else + f2_arg1:processEvent( { + name = "set_silhouette" + } ) + f2_arg1:dispatchEventToRoot( { + name = "show_unlock_text", + dispatchChildren = true, + immediate = true + } ) + end + end + end + f2_local7 = 0 + end + end + f2_local5 = 0 + end + end + f2_local4 = 0 + end + end + f2_local3 = "" + end + end + f2_local2 = "" +end + +function OnButtonOver( f3_arg0, f3_arg1, f3_arg2 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + local f3_local1 = Cac.IsSquadMemberInUse( f3_arg1, f3_local0.squadLocation, f3_arg2 ) + f3_local0.memberIndex = f3_arg2 + UpdateMemberWindow( f3_arg1, f3_local0.memberWindow, f3_arg2, f3_local1 ) + f3_arg0:dispatchEventToRoot( { + name = "updateMemberIndex", + memIndex = f3_arg2 + } ) + f3_arg0:dispatchEventToRoot( { + name = "update_button_helpers", + valid = f3_local1, + memberIndex = f3_arg2, + controller = f3_arg1 + } ) +end + +function OnButtonAction( f4_arg0, f4_arg1, f4_arg2 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + local f4_local1 = Cac.IsSquadMemberInUse( f4_arg1, f4_local0.squadLocation, f4_arg2 ) + f4_local0.activeMember = f4_arg2 + if f4_local1 then + SelectSquadMember( f4_arg0, f4_arg2, f4_arg1 ) + else + SelectNewMember( f4_arg0, f4_arg2, f4_arg1 ) + end +end + +function SelectSquadMember( f5_arg0, f5_arg1, f5_arg2 ) + local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 ) + Engine.PlaySound( CoD.SFX.MouseClick ) + local f5_local1 = { + open_char_list = true, + squadLocation = f5_local0.squadLocation, + squadMemberIndex = f5_arg1, + classLocation = f5_local0.classLocation, + allowMemberSwap = f5_local0.forceToNextScreen, + findMatch = f5_local0.findMatch + } + Cac.SetEditSquadMember( f5_arg1 ) + local f5_local2 = CoD.GetStatsGroupForGameMode() + local f5_local3 = true + if f5_local2 == CoD.StatsGroup.Ranked then + f5_local3 = Engine.GetPlayerDataEx( f5_arg2, CoD.GetStatsGroupForGameMode(), f5_local0.squadLocation, f5_arg1, "defaultSet" ) + end + if f5_local3 == nil or f5_local3 == false then + syncXP( f5_arg2, f5_arg1 ) + LUI.FlowManager.RequestAddMenu( f5_arg0, "menu_archetype_select", true, f5_arg2, false, f5_local1 ) + elseif f5_local0.nextScreen then + LUI.FlowManager.RequestAddMenu( f5_arg0, f5_local0.nextScreen, true, f5_arg2, f5_local0.forceToNextScreen or false, f5_local1 ) + else + DebugPrint( "No next screen data available! Ensure the next_screen property is set and passes to this screen when adding it. Note that this is also normal during a LUI Reload." ) + end +end + +function SelectNewMember( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f6_arg0 ) + local f6_local1 = Cac.GetCurrency( f6_arg2 ) + local f6_local2 = Cac.MemberCost[f6_arg1 + 1] + Engine.PlaySound( CoD.SFX.MouseClick ) + if f6_local2 <= f6_local1 then + LUI.FlowManager.RequestPopupMenu( f6_arg0, "cac_unlock_member_popup", true, f6_arg2, false, { + callback_params = { + next_screen = f6_local0.nextScreen, + squad_location = f6_local0.squadLocation, + class_location = f6_local0.classLocation + } + } ) + else + LUI.FlowManager.RequestPopupMenu( f6_arg0, "cac_unlock_fail_popup", true, f6_arg2, false, false ) + end +end + +function CreateNewSquadMember( f7_arg0, f7_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f7_arg0, true ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_member_select_main" ) + Cac.UnlockSquadMember( f7_arg1.controller, f7_local0.squadLocation, f7_local0.memberIndex ) + Cac.SetCurrency( f7_arg1.controller, Cac.GetCurrency( f7_arg1.controller ) - Cac.MemberCost[f7_local0.memberIndex + 1] ) + Cac.SetEditSquadMember( f7_local0.memberIndex ) + LUI.FlowManager.RequestAddMenu( f7_arg0, "menu_archetype_select", true, f7_arg1.controller, false, { + open_char_list = true, + classLocation = f7_arg0.properties.callback_params.class_location, + squadLocation = f7_arg0.properties.callback_params.squad_location, + squadMemberIndex = f7_local0.memberIndex, + allowMemberSwap = f7_local0.forceToNextScreen, + findMatch = f7_local0.findMatch + } ) +end + +function GetMoveUpButtonRef() + return ShouldUseAlternateReorderUsage() and "button_right_trigger" or "button_shoulderl" +end + +function GetMoveDownButtonRef() + return "button_shoulderr" +end + +function ShouldUseAlternateReorderUsage() + local f10_local0 + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() ~= 0 then + f10_local0 = false + else + f10_local0 = true + end + return f10_local0 +end + +function ReorderSquad( f11_arg0, f11_arg1 ) + local f11_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_squad_order_popup" ) + if ShouldUseAlternateReorderUsage() and not f11_local0.clickedButton then + return + end + local f11_local1 = f11_local0.exclusiveController + local f11_local2 = f11_local0.clickedButton and f11_local0.clickedButton.properties.orderIndex or f11_local0.activeOrderIndex + local f11_local3 = f11_local2 + f11_arg1 + if not f11_local2 or f11_local3 < 0 or f11_local3 > SvS.OrderArraySize - 1 then + return + end + local f11_local4 = SvS.GetSquadMemberIndexFromOrderIndex( f11_local1, f11_local2 ) + local f11_local5 = SvS.GetSquadMemberIndexFromOrderIndex( f11_local1, f11_local3 ) + SvS.SetSquadMemberOrder( f11_local1, f11_local3, f11_local4 ) + SvS.SetSquadMemberOrder( f11_local1, f11_local2, f11_local5 ) + f11_arg0:dispatchEventToChildren( { + name = "refresh_order_button" + } ) + local f11_local6 = f11_arg0:getChildById( "squad_order_member_" .. f11_local2 ) + local f11_local7 = f11_arg0:getChildById( "squad_order_member_" .. f11_local3 ) + f11_local6:processEvent( { + name = "lose_focus", + controller = f11_local1 + } ) + f11_local7:processEvent( { + name = "gain_focus", + controller = f11_local1 + } ) + if f11_local0.clickedButton then + f11_local6:processEvent( { + name = "button_unlock" + } ) + f11_local7:processEvent( { + name = "button_lock" + } ) + f11_local7.m_ignoreMouseFocus = false + f11_local0.clickedButton = f11_local7 + end +end + +function ActiveMemberIconHandler( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + if Cac.GetActiveSquadMember( f12_arg0.properties.controller ) == f12_arg0.properties.memberIndex then + f12_arg0:animateToState( f12_arg1, f12_arg2 ) + else + f12_arg0:animateToState( f12_arg3, f12_arg4 ) + end +end + +function MemberButtonChildrenFeeder( f13_arg0 ) + local f13_local0 = { + [#f13_local0 + 1] = { + type = "UIImage", + id = "active_character_image", + properties = { + memberIndex = f13_arg0.memberIndex, + controller = f13_arg0.controller, + isUnlocked = f13_arg0.isUnlocked + }, + states = Cac.GetActiveCharacterImageStates(), + handlers = { + menu_create = function ( f14_arg0, f14_arg1 ) + ActiveMemberIconHandler( f14_arg0, "button_up", 0, "default", 0 ) + end, + button_over = function ( f15_arg0, f15_arg1 ) + ActiveMemberIconHandler( f15_arg0, "button_over", 100, "default", 0 ) + end, + button_up = function ( f16_arg0, f16_arg1 ) + ActiveMemberIconHandler( f16_arg0, "button_up", 0, "default", 0 ) + end, + button_update_active_member = function ( f17_arg0, f17_arg1 ) + if f17_arg0.properties and f17_arg0.properties.isUnlocked then + local f17_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f17_arg0 ) + local f17_local1 = true + local f17_local2 = true + if CoD.GetStatsGroupForGameMode() == CoD.StatsGroup.Ranked then + f17_local1 = Engine.GetPlayerDataEx( f17_arg0.properties.controller, CoD.GetStatsGroupForGameMode(), "squadMembers", f17_arg0.properties.memberIndex, "defaultSet" ) + f17_local2 = f17_local0.memberIndex and Engine.GetPlayerDataEx( f17_arg0.properties.controller, CoD.GetStatsGroupForGameMode(), "squadMembers", f17_local0.memberIndex, "defaultSet" ) + end + local f17_local3 = f17_local0.memberIndex + if f17_local3 then + f17_local3 = f17_arg0.properties.memberIndex == f17_local0.memberIndex + end + if f17_local3 and f17_local1 then + if f17_arg0.properties and f17_arg0.properties.controller and f17_arg0.properties.memberIndex then + Cac.SetActiveSquadMember( f17_arg0.properties.controller, f17_arg0.properties.memberIndex ) + Engine.PlaySound( CoD.SFX.CacSelectAbility ) + end + local f17_local4 = MBh.AnimateSequence( { + { + "button_over", + 0 + }, + { + "popped", + 50 + }, + { + "button_over", + 50 + } + } ) + f17_local4( f17_arg0, f17_arg1 ) + elseif not f17_local3 and Cac.GetActiveSquadMember( f17_arg0.properties.controller ) == f17_arg0.properties.memberIndex and not f17_local2 then + local f17_local5 = MBh.AnimateSequence( { + { + "button_up", + 0 + }, + { + "popped_unfocused", + 50 + }, + { + "button_up", + 50 + } + } ) + f17_local5( f17_arg0, f17_arg1 ) + else + f17_arg0:animateToState( "default", 0 ) + if f17_local3 and not f17_local1 then + Engine.PlaySound( CoD.SFX.DenySelect ) + end + end + end + end + } + }, + [#f13_local0 + 1] = { + type = "UIImage", + id = "character_locked_image", + properties = { + childNum = f13_arg0.memberIndex, + memberIndex = f13_arg0.memberIndex, + controller = f13_arg0.controller, + squadLocation = Cac.GetSquadLoc() + }, + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 10, + right = -25, + height = 16, + width = 16, + material = RegisterMaterial( "icon_lock_mini" ), + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + menu_create = function ( f18_arg0, f18_arg1 ) + if Cac.IsSquadMemberInUse( f18_arg0.properties.controller, f18_arg0.properties.squadLocation, f18_arg0.properties.memberIndex ) then + f18_arg0:animateToState( "default" ) + else + f18_arg0:animateToState( "visible" ) + end + end, + button_over = function ( f19_arg0, f19_arg1 ) + f19_arg0:animateToState( "default" ) + end, + button_up = function ( f20_arg0, f20_arg1 ) + if Cac.IsSquadMemberInUse( f20_arg0.properties.controller, f20_arg0.properties.squadLocation, f20_arg0.properties.memberIndex ) then + f20_arg0:animateToState( "default" ) + else + f20_arg0:animateToState( "visible" ) + end + end + } + } + } + return f13_local0 +end + +function MemberFeeder( f21_arg0 ) + local f21_local0 = {} + local f21_local1 = f21_arg0.squad_location + local f21_local2 = Cac.MaxSquadMemberCount( f21_local1 ) + local f21_local3 = f21_arg0.exclusiveController + local f21_local4 = Engine.GetUsernameByController( f21_local3 ) + local f21_local5 = Engine.GetProfileDataUseEliteClanTag( f21_local3 ) and Clan.GetTag( f21_local3 ) or Engine.GetCustomClanTag( f21_local3 ) + for f21_local6 = 0, f21_local2 - 1, 1 do + local f21_local9 = f21_local6 + local f21_local10 = Cac.GetSquadMemberName( f21_local3, f21_local1, f21_local9 ) + local f21_local11 = Cac.IsSquadMemberInUse( f21_local3, f21_local1, f21_local9 ) + local f21_local12 = #f21_local0 + 1 + local f21_local13 = { + type = "UIGenericButton", + id = "member_card_" .. f21_local9, + listDefaultFocus = Cac.GetActiveSquadMember( f21_local3 ) == f21_local9 + } + local f21_local14 = { + memberIndex = f21_local9, + controller = f21_local3, + isUnlocked = f21_local11, + button_text = f21_local10 + } + local f21_local15 + if f21_local11 then + f21_local15 = Colors.white + if not f21_local15 then + + else + f21_local14.text_default_color = f21_local15 + f21_local14.additional_children_func = MemberButtonChildrenFeeder + f21_local14.button_action_func = function ( f22_arg0, f22_arg1 ) + OnButtonAction( f22_arg0, f22_arg1.controller, f21_local9 ) + end + + f21_local14.button_over_func = function ( f23_arg0, f23_arg1 ) + local f23_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f23_arg0 ) + OnButtonOver( f23_arg0, f23_local0.exclusiveController, f21_local9 ) + if Cac.AnyUnseenMDLCItems( f21_local3, NewIconsTable.CACItemTypes ) then + f23_arg0:processEvent( { + name = "show_new_icon" + } ) + end + end + + f21_local14.button_up_func = function ( f24_arg0, f24_arg1 ) + f24_arg0:processEvent( { + name = "hide_new_icon" + } ) + end + + f21_local13.properties = f21_local14 + f21_local13.handlers = { + update_member_name = function ( f25_arg0, f25_arg1 ) + if f25_arg1.index == f21_local9 and f25_arg1.newName then + f25_arg0:setText( f25_arg1.newName ) + end + end + } + f21_local0[f21_local12] = f21_local13 + end + end + f21_local15 = Colors.grey_4 + end + return f21_local0 +end + +function SquadOrderMemberListChildrenFeeder( f26_arg0 ) + local f26_local0 = {} + local f26_local1 = f26_arg0.squad_location + local f26_local2 = Cac.MaxSquadMemberCount( f26_local1 ) + local f26_local3 = f26_arg0.exclusiveController + local f26_local4 = Cac.GetActiveSquadMember( f26_local3 ) + for f26_local5 = 0, SvS.OrderArraySize - 1, 1 do + local f26_local8 = SvS.GetSquadMemberIndexFromOrderIndex( f26_local3, f26_local5 ) + local f26_local9 = Cac.GetSquadMemberName( f26_local3, f26_local1, f26_local8 ) + local f26_local10 = f26_local8 == Cac.GetActiveSquadMember( f26_local3 ) + f26_local0[#f26_local0 + 1] = { + type = "UIGenericButton", + id = "squad_order_member_" .. f26_local5, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + variant = GenericButtonSettings.Variants.Plain, + text = f26_local9, + orderIndex = f26_local5, + squad_location = f26_local1, + controller = f26_local3 + }, + handlers = { + button_over = function ( f27_arg0, f27_arg1 ) + local f27_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f27_arg0 ) + f27_local0.activeOrderIndex = f27_arg0.properties.orderIndex + end, + refresh_order_button = function ( f28_arg0, f28_arg1 ) + local f28_local0 = f28_arg0.properties.controller + f26_local9 = Cac.GetSquadMemberName( f28_local0, f28_arg0.properties.squad_location, SvS.GetSquadMemberIndexFromOrderIndex( f28_local0, f28_arg0.properties.orderIndex ) ) + f28_arg0:setText( f26_local9 ) + f28_arg0:dispatchEventToChildren( f28_arg1 ) + end, + button_action = function ( f29_arg0, f29_arg1 ) + if ShouldUseAlternateReorderUsage() then + local f29_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f29_arg0 ) + if f29_local0.clickedButton == nil then + f29_local0.clickedButton = f29_arg0 + f29_arg0:processEvent( { + name = "button_lock" + } ) + f29_arg0.m_ignoreMouseFocus = false + elseif f29_local0.clickedButton == f29_arg0 then + f29_local0.clickedButton = nil + f29_arg0:processEvent( { + name = "button_unlock" + } ) + end + f29_arg0:dispatchEventToChildren( f29_arg1 ) + f29_arg0:dispatchEventToParent( { + name = "update_button_helpers" + } ) + end + end + }, + children = { + { + type = "UIImage", + id = "squad_order_in_squad_icon", + properties = { + orderIndex = f26_local5, + squad_location = f26_local1, + controller = f26_local3 + }, + states = { + default = CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( "icon_ai_loadout" ), + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 2, + left = 10, + bottom = 28, + right = 36, + alpha = 1 + } ), + squadLeader = CoD.ColorizeState( Colors.frontend_hilite, { + material = RegisterMaterial( "icon_ai_loadout" ), + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 2, + left = 10, + bottom = 28, + right = 36, + alpha = 1 + } ), + hidden = { + alpha = 0 + } + }, + handlers = { + menu_create = function ( f30_arg0, f30_arg1 ) + f30_arg0:processEvent( { + name = "refresh_order_button" + } ) + end, + refresh_order_button = function ( f31_arg0, f31_arg1 ) + local f31_local0 = Cac.GetActiveSquadMember( f31_arg0.properties.controller ) + local f31_local1 = f31_arg0.properties.orderIndex + local f31_local2 = SvS.MaxSquadSize - 1 + local f31_local3 = SvS.FindSquadMemberOrderIndex( f31_arg0.properties.controller, f31_local0 ) + local f31_local4 = SvS.GetSquadMemberIndexFromOrderIndex( f26_local3, f31_arg0.properties.orderIndex ) == Cac.GetActiveSquadMember( f26_local3 ) + if f31_local2 < f31_local3 then + f31_local2 = f31_local2 - 1 + end + if f31_local1 <= f31_local2 or f31_local1 == f31_local3 then + local f31_local5 = f31_arg0 + local f31_local6 = f31_arg0.animateToState + local f31_local7 + if f31_local4 then + f31_local7 = "squadLeader" + if not f31_local7 then + + else + f31_local6( f31_local5, f31_local7 ) + end + end + f31_local7 = "default" + else + f31_arg0:animateToState( "hidden" ) + end + end + } + } + } + } + end + return f26_local0 +end + +function SquadOrderPopupMainChildrenFeeder( f32_arg0 ) + local f32_local0 = {} + local f32_local1 = f32_arg0.exclusiveController + local f32_local2 = Engine.Localize( "LUA_MENU_SQUAD_LEADER_PREFIX", Engine.MarkLocalized( Cac.GetSquadMemberName( f32_local1, f32_arg0.squad_location, Cac.GetActiveSquadMember( f32_local1 ) ) ) ) + local f32_local3 = Engine.Localize( "LUA_MENU_ACTIVE_SQUAD_MEMBER_DESC" ) + local f32_local4, f32_local5, f32_local6, f32_local7 = GetTextDimensions( f32_local3, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f32_local8 = f32_local6 - f32_local4 + f32_local0[#f32_local0 + 1] = { + type = "UIElement", + id = "squad_order_player_bar", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + bottom = CoD.TextSettings.NormalFont.Height, + right = 0, + alpha = 1 + } + }, + children = { + { + type = "UIImage", + id = "squad_order_player_bar_BG", + properties = { + text = f32_local2 + }, + states = { + default = CoD.ColorizeState( { + r = 0.17, + g = 0.17, + b = 0.17 + }, { + material = RegisterMaterial( "white" ), + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = -4, + left = -4, + bottom = 4, + right = 4, + alpha = 1 + } ) + } + }, + { + type = "UIText", + id = "squad_order_player_bar_text", + properties = { + text = f32_local2 + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) + } + } + } + } + f32_local0[#f32_local0 + 1] = { + type = "UIVerticalList", + id = "squad_order_member_list", + focusable = true, + properties = { + squad_location = f32_arg0.squad_location + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + bottom = 270, + right = 0, + alpha = 1 + } + }, + handlers = { + shift_down = function ( f33_arg0, f33_arg1 ) + ReorderSquad( f33_arg0, 1 ) + end, + shift_up = function ( f34_arg0, f34_arg1 ) + ReorderSquad( f34_arg0, -1 ) + end + }, + childrenFeeder = SquadOrderMemberListChildrenFeeder + } + f32_local0[#f32_local0 + 1] = { + type = "UIMarqueeText", + id = "squad_order_desc_text_1", + properties = { + text = Engine.Localize( "LUA_MENU_SQUAD_ORDER_DESC" ) + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + bottom = CoD.TextSettings.NormalFont.Height, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1 + } ) + } + } + f32_local0[#f32_local0 + 1] = { + type = "UIElement", + id = "squad_order_desc_line_2", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + bottom = 26, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "squad_order_desc_image_2", + states = { + default = CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( "icon_ai_loadout" ), + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = -f32_local8 * 0.5 - 27, + bottom = 27, + right = -f32_local8 * 0.5, + alpha = 1 + } ) + } + }, + { + type = "UIText", + id = "squad_order_desc_text_2", + properties = { + text = f32_local3 + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 3, + left = 32, + bottom = CoD.TextSettings.NormalFont.Height + 3, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1 + } ) + } + } + } + } + f32_local0[#f32_local0 + 1] = { + type = "button_helper_text_main", + id = "squad_order_button_helpers", + properties = { + height = 70, + spacing = 0, + right_inset = 0, + left_inset = 0, + background_alpha = 0 + } + } + local f32_local9 = { + type = "UIBindButton", + id = "squad_order_bind_button", + handlers = {} + } + f32_local0[#f32_local0 + 1] = f32_local9 + f32_local9.handlers[GetMoveUpButtonRef()] = function ( f35_arg0, f35_arg1 ) + local f35_local0 = f35_arg0:getParent() + f35_local0:processEvent( { + name = "shift_up" + } ) + end + + f32_local9.handlers[GetMoveDownButtonRef()] = function ( f36_arg0, f36_arg1 ) + local f36_local0 = f36_arg0:getParent() + f36_local0:processEvent( { + name = "shift_down" + } ) + end + + return f32_local0 +end + +function cac_squad_order_popup() + return { + type = "generic_selectionList_popup", + properties = { + popup_title = Engine.Localize( "LUA_MENU_SQUAD_ORDER_TITLE" ), + popup_width = 525, + popup_list_spacing = 5, + popup_childfeeder = SquadOrderPopupMainChildrenFeeder + }, + handlers = { + menu_create = function ( f38_arg0, f38_arg1 ) + f38_arg0:processEvent( { + name = "update_button_helpers" + } ) + end + , + update_button_helpers = function ( f39_arg0, f39_arg1 ) + local f39_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f39_arg0 ) + if not ShouldUseAlternateReorderUsage() or f39_local0.clickedButton then + f39_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = GetMoveDownButtonRef(), + helper_text = Engine.Localize( "LUA_MENU_MOVE_DOWN" ), + side = "left", + clickable = true + } ) + f39_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = GetMoveUpButtonRef(), + helper_text = Engine.Localize( "LUA_MENU_MOVE_UP" ), + side = "left", + clickable = true + } ) + else + f39_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = GetMoveDownButtonRef(), + helper_text = "", + side = "left", + clickable = true + } ) + f39_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = GetMoveUpButtonRef(), + helper_text = "", + side = "left", + clickable = true + } ) + end + f39_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + end + + } + } +end + +function cac_unlock_member_popup() + local f40_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_member_select_main" ) + return { + type = "generic_yesno_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_NEW_MEMBER" ), + message_text = Engine.Localize( "@LUA_MENU_UNLOCK_SQUAD_MEMBER_CONFIRMATION", Cac.MemberCost[f40_local0.activeMember + 1] ), + yes_action = CreateNewSquadMember, + no_action = MBh.LeaveMenu() + } + } +end + +function cac_unlock_fail_popup() + local f41_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_member_select_main" ) + return { + type = "generic_confirmation_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_INSUFFICIENT_CURRENCY" ), + message_text = Engine.Localize( "@LUA_MENU_UNLOCK_SQUAD_MEMBER_FAIL", Cac.MemberCost[f41_local0.activeMember + 1] ), + button_text = Engine.Localize( "@MENU_OK" ), + confirmation_action = MBh.LeaveMenu() + } + } +end + +function cac_setup_first() + return { + type = "generic_confirmation_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_WELCOME" ), + message_text = Engine.Localize( "@LUA_MENU_SELECT_YOUR_LOADOUT" ), + button_text = Engine.Localize( "@MENU_OK" ), + confirmation_action = MBh.LeaveMenu() + } + } +end + +function cac_member_unlock_widget() + local f43_local0 = Engine.Localize( "@LUA_MENU_SQUAD_MEMBER_UNLOCK_COST", Cac.MemberCost[1] ) + local f43_local1, f43_local2, f43_local3, f43_local4 = GetTextDimensions( f43_local0, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f43_local5 = 32 + return { + type = "UIElement", + id = "member_select_unlock_widget_container", + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 555, + left = Cac.Layout.CacEditPanel.shift_delta, + bottom = 610, + right = Cac.Layout.CacEditPanel.shift_delta + 400, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + show_unlock_text = MBh.AnimateToState( "default" ), + hide_unlock_text = MBh.AnimateToState( "hidden" ) + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_background", + id = "cac_member_unlock_widget_background", + properties = { + top_offset = 0, + fill_alpha = 1, + border_alpha = 1 + } + }, + { + type = "UIHorizontalList", + id = "member_select_unlock_widget_hlist", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + top = 0, + right = 0, + bottom = 0, + alpha = 1, + alignment = LUI.Alignment.Center, + spacing = 2 + } + }, + children = { + { + type = "UIImage", + id = "cac_member_unlock_widget_point_icon", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + height = f43_local5, + left = 0, + right = f43_local5, + material = RegisterMaterial( "icon_unlock_token_32" ) + } + } + }, + { + type = "UIText", + id = "cac_member_unlock_widget_point_cost", + properties = { + text = f43_local0, + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + height = CoD.TextSettings.NormalFont.Height, + right = f43_local3 + 18, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + }, + handlers = { + updateMemberIndex = function ( f44_arg0, f44_arg1 ) + local f44_local0 = Engine.Localize( "@LUA_MENU_SQUAD_MEMBER_UNLOCK_COST", Cac.MemberCost[f44_arg1.memIndex + 1] ) + local f44_local1, f44_local2, f44_local3, f44_local4 = GetTextDimensions( f44_local0, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + f44_arg0:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + height = CoD.TextSettings.NormalFont.Height, + right = f44_local3 + 18, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f44_arg0:animateToState( "default" ) + f44_arg0:setText( f44_local0 ) + end + + } + } + } + } + } + } +end + +function cac_member_select_main() + local f45_local0 = { + type = "UIElement", + id = "cac_member_select_root", + properties = { + squad_location = Cac.GetSquadLoc() + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OnCreate, + first_time = function ( f46_arg0, f46_arg1 ) + LUI.FlowManager.RequestPopupMenu( nil, "cac_setup_first", true, f46_arg1.controller, false, false, false, false ) + end, + menu_close = function ( f47_arg0, f47_arg1 ) + Engine.Exec( "uploadstats", f47_arg1.controller ) + end, + text_input_complete = function ( f48_arg0, f48_arg1 ) + local f48_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f48_arg0 ) + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), false, "CloseKeyboard" ) + if f48_local0.renameIndex and f48_arg1.text then + Cac.SetSquadMemberName( f48_arg1.controller, f48_local0.squadLocation, f48_local0.renameIndex, f48_arg1.text ) + f48_arg0:processEvent( { + name = "update_member_name", + index = f48_local0.renameIndex, + newName = f48_arg1.text + } ) + Engine.Exec( "uploadstats", f48_arg1.controller ) + f48_local0.renameIndex = nil + end + end + } + } + local f45_local1 = {} + local f45_local2 = { + type = "UIImage", + id = "member_select_background", + states = { + default = { + material = RegisterMaterial( "bkgd_cas" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + } + local f45_local3 = { + type = "generic_menu_title", + id = "member_select_title_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_SELECT_SQUAD_MEMBER_CAPS" ) + } + } + local f45_local4 = Cac.GetEditCurrency( "select_member_currency_display_id" ) + local f45_local5 = { + type = "UIVerticalList", + id = "member_select_member_list", + childrenFeeder = MemberFeeder, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = 800 + } + } + } + local f45_local6 = { + type = "UISquadMemberWindow", + id = "member_select_member_window_id" + } + local f45_local7 = { + use_3d_model = true, + use_2d_character_image = false, + use_member_name = false, + use_prestige_icon = true, + use_playercard = true, + use_background = true, + use_border = false + } + local f45_local8 = {} + local f45_local9 = IsPublicMatch() + if not f45_local9 then + f45_local9 = Engine.IsAliensMode() + end + f45_local8.use_level_progress = f45_local9 + f45_local7.card_props = f45_local8 + f45_local7.card_dims = { + top = -130, + bottom = -165, + left = -725, + right = -725 + } + f45_local7.card_scale = -0.15 + f45_local7.default_anim = Cac.Customization.Animations.default + f45_local7.char_window_dims = { + top = 0, + bottom = 610, + left = -175, + right = 435 + } + f45_local7.uv_values = { + 0, + 0, + 1, + 1 + } + f45_local7.character_pos = CharacterCameraPresets.MemberSelect.Position + f45_local7.controller = MBh.Property( "exclusiveController" ) + f45_local7.squad_location = MBh.Property( "squad_location" ) + f45_local7.mask_pos_data = { + top = 17, + bottom = 0, + left = 0, + right = 0 + } + f45_local6.properties = f45_local7 + f45_local6.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 + } + } + f45_local6.handlers = { + menu_close = function ( f49_arg0, f49_arg1 ) + LUI.UISquadMemberWindow.Shutdown( f49_arg0 ) + end + } + f45_local7 = { + type = "cac_member_unlock_widget", + id = "cac_member_unlock_widget_id" + } + f45_local8 = { + type = "UIBindButton", + id = "member_select_bind_button_id", + handlers = { + button_secondary = function ( f50_arg0, f50_arg1 ) + local f50_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f50_arg0 ) + if f50_local0.forceToNextScreen then + Cac.SetEditSquadMember( Cac.GetActiveSquadMember( f50_arg1.controller ) ) + LUI.FlowManager.RequestAddMenu( element, f50_local0.nextScreen, true, f50_arg1.controller, true, { + open_char_list = true, + squadLocation = f50_local0.squadLocation, + squadMemberIndex = Cac.GetEditSquadMember(), + classLocation = f50_local0.classLocation, + allowMemberSwap = true + } ) + else + LUI.FlowManager.RequestLeaveMenu( f50_arg0 ) + end + end, + button_shoulderl = function ( f51_arg0, f51_arg1 ) + local f51_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f51_arg0 ) + if f51_local0.memberIndex and Cac.HasSquadMemberPrestiged( f51_arg1.controller, f51_local0.squadLocation, f51_local0.memberIndex ) then + Engine.PlaySound( CoD.SFX.MouseClick ) + LUI.FlowManager.RequestAddMenu( element, "prestige_details_main", true, f51_arg1.controller, false, { + squadLocation = f51_local0.squadLocation, + squadMemberIndex = f51_local0.memberIndex, + classLocation = f51_local0.classLocation + } ) + end + end, + button_shoulderr = function ( f52_arg0, f52_arg1 ) + local f52_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f52_arg0 ) + if f52_local0.memberIndex then + local f52_local1 = f52_local0.squadLocation + if not f52_local1 then + f52_local1 = Cac.GetSquadLoc() + end + if Cac.IsSquadMemberInUse( f52_arg1.controller, f52_local0.squadLocation, f52_local0.memberIndex ) then + Engine.PlaySound( CoD.SFX.MouseClick ) + local f52_local2 = Cac.GetSquadMemberName( f52_arg1.controller, f52_local1, f52_local0.memberIndex ) + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), true, "OpenKeyboard" ) + Engine.OpenScreenKeyboard( f52_arg1.controller, Engine.Localize( "@LUA_MENU_ENTER_NAME" ), f52_local2, SQUAD_MEMBER_NAME_LENGTH, true, true ) + f52_local0.renameIndex = f52_local0.memberIndex + end + end + end, + button_alt1 = function ( f53_arg0, f53_arg1 ) + local f53_local0 = f53_arg0:getParent() + f53_local0:processEvent( { + name = "button_update_active_member", + controller = f53_arg1.controller + } ) + end + } + } + f45_local9 = { + type = "button_helper_text_main", + id = "member_select_helper_text_id", + handlers = { + update_button_helpers = function ( f54_arg0, f54_arg1 ) + local f54_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f54_arg0 ) + local f54_local1 = f54_arg1.valid + if f54_local1 then + f54_local1 = Cac.HasSquadMemberPrestiged( f54_arg1.controller, f54_local0.squadLocation, f54_local0.memberIndex ) + end + f54_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = "", + side = "left", + clickable = true + } ) + f54_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_shoulderl", + helper_text = "", + side = "left", + clickable = true, + dispatchChildren = true + } ) + f54_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_shoulderr", + helper_text = "", + side = "left", + clickable = true, + dispatchChildren = true + } ) + f54_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = f54_arg1.valid and Engine.Localize( "LUA_MENU_SET_ACTIVE_SQUAD_MEMBER_HELPER" ) or "", + side = "left", + clickable = true + } ) + local f54_local2 = f54_arg0 + local f54_local3 = f54_arg0.processEvent + local f54_local4 = { + name = "add_button_helper_text", + button_ref = "button_shoulderl" + } + local f54_local5 + if f54_local1 then + f54_local5 = Engine.Localize( "@LUA_MENU_PRESTIGE_DETAILS" ) + if not f54_local5 then + + else + f54_local4.helper_text = f54_local5 + f54_local4.side = "left" + f54_local4.clickable = true + f54_local4.dispatchChildren = true + f54_local3( f54_local2, f54_local4 ) + f54_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_shoulderr", + helper_text = f54_arg1.valid and Engine.Localize( "@LUA_MENU_EDIT_MEMBER_NAME" ) or "", + side = "left", + clickable = true, + dispatchChildren = true + } ) + end + end + f54_local5 = "" + end + } + } + local f45_local10 = { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + f45_local1[1] = f45_local2 + f45_local1[2] = f45_local3 + f45_local1[3] = f45_local4 + f45_local1[4] = f45_local5 + f45_local1[5] = f45_local6 + f45_local1[6] = f45_local7 + f45_local1[7] = f45_local8 + f45_local1[8] = f45_local9 + f45_local1[9] = f45_local10 + f45_local0.children = f45_local1 + return f45_local0 +end + +LUI.MenuBuilder.registerDef( "cac_member_select_main", cac_member_select_main ) +LUI.MenuBuilder.registerDef( "cac_unlock_member_popup", cac_unlock_member_popup ) +LUI.MenuBuilder.registerDef( "cac_unlock_fail_popup", cac_unlock_fail_popup ) +LUI.MenuBuilder.registerDef( "cac_member_unlock_widget", cac_member_unlock_widget ) +LUI.MenuBuilder.registerDef( "cac_setup_first", cac_setup_first ) +LUI.MenuBuilder.registerDef( "cac_squad_order_popup", cac_squad_order_popup ) +LockTable( _M ) diff --git a/lui/mp_menus/cacprestigedetails.dec.lua b/lui/mp_menus/cacprestigedetails.dec.lua new file mode 100644 index 0000000..b359f94 --- /dev/null +++ b/lui/mp_menus/cacprestigedetails.dec.lua @@ -0,0 +1,369 @@ +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 ) diff --git a/lui/mp_menus/cacrecap.dec.lua b/lui/mp_menus/cacrecap.dec.lua new file mode 100644 index 0000000..ca9d0b2 --- /dev/null +++ b/lui/mp_menus/cacrecap.dec.lua @@ -0,0 +1,2487 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +RecapLayout = { + Width = 333, + GridH = 80.25, + GridHGutter = 4, + Height = 545, + GridVSlim = 60, + GridVTall = 80, + GridVGutter = 8, + XWhenLeft = 100, + XWhenRight = 560, + Y = 100, + LockAlpha = 0.25 +} +if Engine.UsingSplitscreenUpscaling() then + RecapLayout.Width = RecapLayout.GridH * 6 + RecapLayout.GridHGutter * 5 + RecapLayout.Height = RecapLayout.GridVTall * 3 + RecapLayout.GridVGutter * 2 +end +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = false + if f1_arg1 then + if f1_arg0 == "infect" and not Cac.IsClassInUse( f1_arg1, Cac.GetSquadLoc(), Cac.GetActiveSquadMember( f1_arg1 ), "defaultClassesTeam" .. Game.GetPlayerTeam(), 0 ) then + f1_local0 = true + elseif f1_arg0 == "horde" or f1_arg0 == "sotf" or f1_arg0 == "sotf_ffa" or f1_arg0 == "gun" then + f1_local0 = true + end + end + return f1_local0 +end + +f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2 ) + local f2_local0 = Engine.GetDvarString( "g_gametype" ) + if f0_local0( f2_local0, f2_arg2 ) then + if f2_arg1 == Cac.Indices.Weapons.Primary then + if f2_local0 == "infect" then + if Game.GetPlayerTeam() == Teams.allies then + f2_arg0 = "iw6_maul" + elseif Game.GetPlayerTeam() == Teams.axis then + f2_arg0 = "iw6_knifeonly" + end + elseif f2_local0 == "horde" then + f2_arg0 = "iw6_mp443" + elseif f2_local0 == "sotf" or f2_local0 == "sotf_ffa" then + f2_arg0 = Engine.TableLookup( HuntedWeaponsTable.File, HuntedWeaponsTable.Cols.Index, Game.GetOmnvar( "ui_sotf_pistol" ), HuntedWeaponsTable.Cols.Ref ) + elseif f2_local0 == "gun" then + local f2_local1 = Game.GetOmnvar( "ui_fakeloadout_weapon1" ) + if f2_local1 > -1 then + f2_arg0 = Engine.TableLookupByRow( StatsTable.File, f2_local1, StatsTable.Cols.WeaponRef ) + else + f2_arg0 = "none" + end + end + else + f2_arg0 = "none" + end + end + return f2_arg0 +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + if f0_local0( Engine.GetDvarString( "g_gametype" ), f3_arg1 ) then + f3_arg0 = "icon_weapon_ph_camo" + end + return f3_arg0 +end + +local f0_local3 = function ( f4_arg0, f4_arg1, f4_arg2, f4_arg3 ) + local f4_local0 = Engine.GetDvarString( "g_gametype" ) + if f0_local0( f4_local0, f4_arg3 ) then + if f4_local0 == "gun" and f4_arg2 == Cac.Indices.Weapons.Primary then + local f4_local1 = Game.GetOmnvar( "ui_fakeloadout_weapon1_attach" .. tostring( f4_arg1 + 1 ) ) + if f4_local1 > -1 then + f4_arg0 = Engine.TableLookupByRow( AttachmentTable.File, f4_local1, AttachmentTable.Cols.BaseRef ) + else + f4_arg0 = "none" + end + elseif f4_arg2 == Cac.Indices.Weapons.Primary and f4_arg1 == 0 then + if f4_local0 == "horde" then + f4_arg0 = "xmags" + elseif f4_local0 == "sotf" or f4_local0 == "sotf_ffa" or f4_local0 == "infect" then + f4_arg0 = "none" + end + else + f4_arg0 = "none" + end + end + return f4_arg0 +end + +local f0_local4 = function ( f5_arg0, f5_arg1 ) + if f0_local0( Engine.GetDvarString( "g_gametype" ), f5_arg1 ) then + f5_arg0 = "icon_weapon_ph_primary_reticle" + end + return f5_arg0 +end + +local f0_local5 = function ( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = Engine.GetDvarString( "g_gametype" ) + if f0_local0( f6_local0, f6_arg2 ) then + if f6_arg1 == Cac.Indices.Grenade.Primary then + if f6_local0 == "infect" then + if Game.GetPlayerTeam() == Teams.allies then + f6_arg0 = "proximity_explosive" + elseif Game.GetPlayerTeam() == Teams.axis then + f6_arg0 = "throwingknife" + end + elseif f6_local0 == "horde" then + f6_arg0 = "proximity_explosive" + elseif f6_local0 == "sotf" or f6_local0 == "sotf_ffa" then + f6_arg0 = "throwingknife" + elseif f6_local0 == "gun" then + f6_arg0 = "none" + end + elseif f6_local0 == "infect" then + if Game.GetPlayerTeam() == Teams.allies then + f6_arg0 = "concussion_grenade" + elseif Game.GetPlayerTeam() == Teams.axis then + f6_arg0 = "none" + end + elseif f6_local0 == "horde" then + f6_arg0 = "concussion_grenade" + elseif f6_local0 == "sotf" or f6_local0 == "sotf_ffa" then + f6_arg0 = "flash_grenade" + elseif f6_local0 == "gun" then + f6_arg0 = "none" + end + end + return f6_arg0 +end + +local f0_local6 = function ( f7_arg0 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + return { + controller = f7_local0.controller, + squadLocation = f7_local0.squadLocation, + squadMemberIndex = f7_local0.memberIndex, + classLocation = f7_local0.loadoutLocation, + slot = f7_local0.loadoutSlot + } +end + +local f0_local7 = function ( f8_arg0 ) + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + width = RecapLayout.GridHGutter + } ) + local f8_local1 = LUI.UIImage.new + local f8_local2 = { + material = RegisterMaterial( "white" ), + topAnchor = f8_arg0, + bottomAnchor = not f8_arg0, + leftAnchor = true, + rightAnchor = true + } + local f8_local3 + if f8_arg0 then + f8_local3 = 4 + if not f8_local3 then + + else + f8_local2.top = f8_local3 + f8_local2.left = 1 + if f8_arg0 then + f8_local3 = 16 + if not f8_local3 then + + else + f8_local2.bottom = f8_local3 + f8_local2.right = -1 + f8_local2.red = 1 + f8_local2.green = 1 + f8_local2.blue = 1 + f8_local2.alpha = 0.1 + f8_local1 = f8_local1( f8_local2 ) + self:addElement( f8_local1 ) + if f8_arg0 and Engine.InFrontend() then + f8_local1:registerAnimationState( "focus", { + red = 1, + green = 1, + blue = 1, + alpha = 0.1 + } ) + f8_local1:registerAnimationState( "locked", CoD.ColorizeState( Colors.cac_button ) ) + f8_local1:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f8_local1:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f8_local1:registerEventHandler( "button_lock", MBh.AnimateToState( "locked" ) ) + f8_local1:registerEventHandler( "button_unlock", MBh.AnimateToState( "default" ) ) + end + return self + end + end + f8_local3 = 0 + end + end + f8_local3 = -RecapLayout.GridVSlim +end + +local f0_local8 = function () + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = RecapLayout.GridVGutter, + right = 0 + } ) + self:addElement( LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -1, + left = 0, + bottom = 1, + right = 0, + red = 1, + green = 1, + blue = 1, + alpha = 0.2 + } ) ) + return self +end + +local f0_local9 = function ( f10_arg0, f10_arg1, f10_arg2, f10_arg3, f10_arg4, f10_arg5, f10_arg6, f10_arg7 ) + local f10_local0 = f10_arg7 or false + local self = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f10_arg1 - f10_arg3 / 2, + left = f10_arg0 - f10_arg2 / 2, + width = f10_arg2, + height = f10_arg3, + alpha = 0 + } ) + self.locked = false + self:registerAnimationState( "moved", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f10_arg1 - f10_arg3 / 2 - Cac.Layout.SpecialistStreak.row_offset / 2, + left = f10_arg0 - f10_arg2 / 2, + width = f10_arg2, + height = f10_arg3 + } ) + self:registerAnimationState( "restore_position", { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f10_arg1 - f10_arg3 / 2, + left = f10_arg0 - f10_arg2 / 2, + width = f10_arg2, + height = f10_arg3 + } ) + local f10_local2 = function ( f11_arg0, f11_arg1 ) + local f11_local0 = f10_arg4( f11_arg0, f11_arg1 ) + local f11_local1 = f11_local0.material + local f11_local2 = f11_local0.alpha and f11_local0.alpha or 1 + local f11_local3 = f11_arg0.locked and 2.63 or 1 + local f11_local4 = { + material = f11_local1, + alpha = f11_local2 + } + if f11_arg0.locked then + f11_local4.alphaMultiplier = f11_local3 + end + f11_arg0:registerAnimationState( "current", f11_local4 ) + f11_arg0:animateToState( "current" ) + end + + self:registerEventHandler( "update_cac_info_panel", function ( element, event ) + f10_local2( element, event ) + end ) + if Engine.InFrontend() then + self:registerAnimationState( "locked", CoD.ColorizeState( Colors.black, { + alphaMultiplier = 2.63 + } ) ) + if f10_arg5 then + if not f10_local0 then + self:registerEventHandler( "button_lock", function ( element, event ) + element.locked = true + f10_local2( element, event ) + element:animateToState( "locked" ) + end ) + end + self:registerEventHandler( "button_unlock", function ( element, event ) + local f14_local0 = f10_arg4( element, event ) + local f14_local1 = f14_local0.alpha and f14_local0.alpha or 1 + element.locked = false + f10_local2( element, event ) + element:registerAnimationState( "unlocked", CoD.ColorizeState( Colors.white, { + alpha = f14_local1 + } ) ) + element:animateToState( "unlocked" ) + end ) + if not f10_arg6 then + self:registerEventHandler( "button_over", f10_local2 ) + self:registerEventHandler( "button_up", f10_local2 ) + end + end + if f10_arg6 then + self:registerEventHandler( "button_over", function ( element, event ) + f10_local2( element, event ) + element:animateToState( "locked" ) + end ) + self:registerEventHandler( "button_up", function ( element, event ) + local f16_local0 = f10_arg4( element, event ) + local f16_local1 = f16_local0.alpha and f16_local0.alpha or 1 + f10_local2( element, event ) + element:registerAnimationState( "unlocked", CoD.ColorizeState( Colors.white, { + alpha = f16_local1 + } ) ) + element:animateToState( "unlocked" ) + end ) + end + end + return self +end + +local f0_local10 = function () + local f17_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_main" ) + local f17_local1 = nil + if Engine.InFrontend() then + f17_local1 = GetCurrentGameType() + else + f17_local1 = GameX.GetGameMode() + end + if f17_local1 == "infect" and Cac.IsDefaultClass( f17_local0.classLocation ) and f17_local0.currTeam == Teams.axis then + return true + else + return false + end +end + +local f0_local11 = function ( f18_arg0, f18_arg1, f18_arg2, f18_arg3, f18_arg4, f18_arg5, f18_arg6, f18_arg7 ) + local f18_local0 = f18_arg0 * RecapLayout.GridH + math.max( 0, f18_arg0 - 1 ) * RecapLayout.GridHGutter + local f18_local1 = 4 + local f18_local2 = 7 + local f18_local3 = 0 + if f18_arg3 then + local f18_local4, self, f18_local6, f18_local7 = GetTextDimensions( f18_arg3, CoD.TextSettings.SmallFont.Font, CoD.TextSettings.SmallFont.Height ) + f18_local3 = f18_local6 - f18_local4 + end + local f18_local4 = LUI.UIGenericButton.new + local self = {} + local f18_local6 = { + style = GenericButtonSettings.Styles.FlatButton, + force_disable_action_button = true, + disable_height_guard = true + } + local f18_local7 + if f18_arg5 then + f18_local7 = CoD.TextSettings.NormalFont.Height + if not f18_local7 then + + else + f18_local6.background_padding = f18_local7 + f18_local6.disable_border = true + f18_local6.use_locking = true + f18_local6.button_action_func = function ( f19_arg0, f19_arg1 ) + if f18_arg2 then + local f19_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f19_arg0 ) + f19_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = "", + side = "left", + immediate = true, + clickable = true + } ) + if f19_local0 and f19_local0.squadLocation == "squadMembers" then + f19_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + immediate = true, + clickable = true + } ) + end + f19_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + immediate = true, + clickable = true + } ) + f19_arg0:processEvent( { + name = "gain_focus" + } ) + if f19_arg0.id ~= "edit_killstreaks" then + if f19_arg0.id == "edit_weapon_primary_camo" or f19_arg0.id == "edit_weapon_primary_reticle" then + f19_arg0:dispatchEventToRoot( { + name = "close_info_column", + immediate = true + } ) + else + f19_arg0:dispatchEventToRoot( { + name = "expand_info_column", + immediate = true + } ) + end + f19_arg0:dispatchEventToRoot( { + name = "hide_character_image", + immediate = true + } ) + end + f18_arg2( f19_arg0, f19_arg1 ) + else + Engine.PlaySound( CoD.SFX.DenySelect ) + end + end + + f18_local6.button_over_func = function ( f20_arg0, f20_arg1 ) + local f20_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f20_arg0 ) + local f20_local1 = f0_local6( f20_arg0 ) + f20_local1.name = "update_selection_info" + f20_local1.selection_id = f20_arg0.id + f20_local1.weaponIndex = f20_arg0.properties.weaponIndex + f20_local1.immediate = true + f20_arg0:dispatchEventToRoot( f20_local1 ) + f20_local0.selectionIDFocused = f20_arg0.id + f20_local0.weaponIndexFocused = f20_arg0.properties.weaponIndex + f20_local0.attachIndexFocused = f20_arg0.properties.attachIndex + if f20_arg0.properties.weaponIndex then + local f20_local2 = f0_local6( f20_arg0 ) + f20_local2.name = "refresh_info_pane" + f20_local2.dispatchChildren = true + f20_local2.weaponIndex = f20_arg0.properties.weaponIndex + f20_local2.selection_id = f20_arg0.id + f20_local2.immediate = true + f20_arg0:dispatchEventToRoot( f20_local2 ) + end + f20_arg0:processEvent( { + name = "update_restriction_icon" + } ) + if MatchRules.AllowCustomClasses( f20_local0.classLocation ) then + if f20_arg0.restricted then + f20_arg0:dispatchEventToRoot( { + name = "show_class_restrictions_warning", + immediate = true + } ) + else + f20_arg0:dispatchEventToRoot( { + name = "hide_class_restrictions_warning", + immediate = true + } ) + end + end + f20_arg0:dispatchEventToRoot( { + name = "collapse_info_column", + immediate = true + } ) + f20_arg0:dispatchEventToRoot( { + name = "show_character_image", + immediate = true + } ) + end + + if f18_arg4 then + f18_local7 = GenericButtonSettings.Variants.Info + if not f18_local7 then + + else + f18_local6.variant = f18_local7 + f18_local6.button_text = f18_arg3 + f18_local6.button_display_func = f18_arg4 + f18_local6.text_align_without_content = LUI.Alignment.Left + f18_local6.text_padding_without_content = f18_local1 + f18_local7 = CoD.TextSettings.SmallFont.Height + local f18_local8 + if f18_arg1 then + f18_local8 = RecapLayout.GridVSlim + if not f18_local8 then + + else + f18_local6.y_offset = 0.5 * (f18_local7 - f18_local8) + f18_local6.text_default_color = Colors.cac_label_text + if f18_arg5 then + f18_local7 = Colors.cac_label_text + if not f18_local7 then + + else + f18_local6.text_focus_color = f18_local7 + if f18_arg5 then + f18_local7 = Colors.cac_label_text + if not f18_local7 then + + else + f18_local6.text_lock_color = f18_local7 + f18_local6.text_align_with_content = LUI.Alignment.Left + f18_local6.text_padding_with_content = f18_local1 + f18_local6.label_align = LUI.Alignment.Left + f18_local6.content_margin = -(f18_local1 + f18_local3 + 2 * f18_local2 + RecapLayout.GridHGutter) + f18_local6.content_width = f18_local0 + f18_local6.content_default_color = Colors.generic_button_content_focus_color + if f18_arg5 then + f18_local7 = Colors.generic_button_content_focus_color + if not f18_local7 then + + else + f18_local6.content_focus_color_without_bg = f18_local7 + if f18_arg5 then + f18_local7 = Colors.generic_button_content_focus_color + if not f18_local7 then + + else + f18_local6.content_lock_color = f18_local7 + f18_local4 = f18_local4( self, f18_local6 ) + if Engine.InFrontend() then + f18_local4:registerEventHandler( "button_lock", function ( element, event ) + element:dispatchEventToRoot( { + name = "lock_recap" + } ) + element:animateToState( "locked" ) + end ) + f18_local4:addEventHandler( "restore_focus", function ( f22_arg0, f22_arg1 ) + local f22_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f22_arg0 ) + f22_arg0:dispatchEventToRoot( { + name = "unlock_recap" + } ) + f22_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_CLEAR" ), + side = "left", + immediate = true, + clickable = true + } ) + local f22_local1 = nil + if f22_local0 and f22_local0.squadLocation == "squadMembers" then + f22_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@LUA_MENU_OPERATIONS" ), + side = "left", + immediate = true, + clickable = true + } ) + f22_local1 = "@LUA_MENU_MP_LB_HELPER_TEXT" + else + f22_local1 = "@LUA_MENU_MP_RANDOMIZE_LOADOUT" + end + if LUI.mp_menus.LoadoutBuilder.IsLoadoutBuilderEnabled() then + local f22_local2 = LUI.mp_menus.LoadoutBuilder.IsLoadoutBuilderButtonAnimEnabled() + f22_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = Engine.Localize( f22_local1 ), + side = "left", + immediate = true, + clickable = true, + useAnimIntro = f22_local2, + flash = f22_local2 + } ) + end + f22_arg0:animateToState( "default" ) + end ) + f18_local4:registerAnimationState( "locked", { + alphaMultiplier = 2.63 + } ) + if f18_arg3 == Engine.Localize( "@MENU_STRIKE_PACKAGE_CAPS" ) then + f18_local4:registerEventHandler( "cac_set_slot", function ( element, event ) + local f23_local0 = f0_local10() + local f23_local1 = element + local f23_local2 = element.processEvent + local f23_local3 = {} + local f23_local4 + if f23_local0 then + f23_local4 = "disable" + if not f23_local4 then + + else + f23_local3.name = f23_local4 + f23_local2( f23_local1, f23_local3 ) + end + end + f23_local4 = "enable" + end ) + end + end + f18_local4:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + bottom = 0, + right = f18_local0, + alpha = 1, + alphaMultiplier = 1 + } ) + f18_local4:animateToState( "default" ) + if f18_arg3 and f18_arg4 then + self = f0_local7( true ) + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = f18_local1 + f18_local3 + f18_local2, + bottom = 0, + width = RecapLayout.GridHGutter + } ) + self:animateToState( "default" ) + f18_local4:addElement( self ) + end + if Engine.IsConsoleGame() == false and Engine.InFrontend() == false then + f18_local4.m_ignoreMouseFocus = true + end + if f18_arg6 then + self = LUI.UIImage.new( { + rightAnchor = true, + leftAnchor = false, + topAnchor = false, + bottomAnchor = true, + right = 0, + bottom = 2, + width = 32, + height = 32, + material = RegisterMaterial( "icon_new_3" ), + alpha = 0 + } ) + self.id = "weapon_restriction_icon" + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self:setPriority( 1 ) + f18_local6 = function ( f24_arg0, f24_arg1 ) + if f18_arg6( f24_arg0 ) then + f24_arg0:animateToState( "visible" ) + f18_local4.restricted = true + else + f24_arg0:animateToState( "default" ) + f18_local4.restricted = false + end + if f24_arg1.resetSelected then + if f18_local4.restricted then + f24_arg0:dispatchEventToRoot( { + name = "show_class_restrictions_warning", + immediate = true + } ) + else + f24_arg0:dispatchEventToRoot( { + name = "hide_class_restrictions_warning", + immediate = true + } ) + end + end + end + + self:registerEventHandler( "update_cac_info_panel", f18_local6 ) + self:registerEventHandler( "update_restriction_icon", f18_local6 ) + f18_local4:addElement( self ) + end + if f18_arg7 and Engine.InFrontend() then + self = LUI.UIImage.new( { + rightAnchor = true, + leftAnchor = false, + topAnchor = false, + bottomAnchor = true, + right = 0, + bottom = 2, + width = 32, + height = 32, + material = RegisterMaterial( "icon_new_2" ), + alpha = 0 + } ) + self.id = "bnt_new_item_icon" + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self:setPriority( 1 ) + f18_local6 = function ( f25_arg0, f25_arg1 ) + if f18_arg7( f25_arg0 ) then + f25_arg0:animateToState( "visible" ) + else + f25_arg0:animateToState( "default" ) + end + end + + self:registerEventHandler( "menu_create", f18_local6 ) + self:registerEventHandler( "refresh_new_icons", f18_local6 ) + f18_local4:addElement( self ) + end + return f18_local4 + end + end + f18_local7 = Colors.cac_button + end + end + f18_local7 = nil + end + end + f18_local7 = nil + end + end + f18_local7 = nil + end + end + f18_local8 = RecapLayout.GridVTall + end + end + f18_local7 = GenericButtonSettings.Variants.Plain + end + end + f18_local7 = 0 +end + +local f0_local12 = function ( f26_arg0, f26_arg1, f26_arg2, f26_arg3 ) + local self = LUI.UIHorizontalList.new() + if Engine.InFrontend() then + LUI.UIHorizontalList.SetNoWrap( self, true ) + if f26_arg2 then + self.updateNavigation = function ( f27_arg0 ) + LUI.UIHorizontalList.UpdateNavigation( f27_arg0 ) + f26_arg2( f27_arg0 ) + end + + end + else + self.updateNavigation = function () + + end + + end + self.id = "row_" .. f26_arg0 + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = f26_arg1 + } ) + self:registerAnimationState( "expanded", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = f26_arg1 + Cac.Layout.SpecialistStreak.row_offset + } ) + self:animateToState( "default" ) + self:makeFocusable() + for f26_local4, f26_local5 in ipairs( f26_arg3 ) do + if f26_local4 > 1 then + self:addElement( f0_local7() ) + end + self:addElement( f26_local5 ) + end + return self +end + +local f0_local13 = function ( f29_arg0 ) + local f29_local0 = { + "@MENU_PRIMARY_CAPS", + "@MENU_SECONDARY_CAPS" + } + local f29_local1 = { + 3, + 2 + } + local f29_local2 = Engine.Localize( f29_local0[f29_arg0 + 1] ) + local f29_local3 = f0_local11( f29_local1[f29_arg0 + 1], false, function ( f30_arg0, f30_arg1 ) + local f30_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f30_arg0 ) + local f30_local1 = f0_local6( f30_arg0 ) + f30_local1.itemIndex = f29_arg0 + f30_local1.titleBarText = f29_local2 + local f30_local2 = Cac.GetWeaponClass( Cac.GetWeapon( f30_arg1.controller, f30_local1.squadLocation, f30_local1.squadMemberIndex, f30_local1.classLocation, f30_local1.slot, f29_arg0 ) ) + local f30_local3 = Cac.GetWeapon( f30_arg1.controller, f30_local1.squadLocation, f30_local1.squadMemberIndex, f30_local1.classLocation, f30_local1.slot, f29_arg0 ) + f30_local0.defaultFocus = {} + local f30_local4 = f30_local0.defaultFocus + local f30_local5 = #f30_local0.defaultFocus + 1 + local f30_local6 + if f30_local3 ~= "iw6_knifeonly" and f30_local2 ~= "" then + f30_local6 = f30_local2 + else + f30_local6 = false + end + f30_local4[f30_local5] = f30_local6 + f30_local4 = Cac.EditPopupButtonsFactory + f30_local5 = Cac.GetWeaponCategoryNameCaps + f30_local6 = Cac.EditChooseWeaponTypeAction + local f30_local7 = Cac.GetWeaponTypes( f29_arg0 == 0 ) + local f30_local8 = f30_local2 + local f30_local9 = Cac.GetItemClassDescriptions + local f30_local10 = nil + local f30_local11 = f30_local3 + local f30_local12 = Cac.IsAbilityPickedBySlotName( f30_arg1.controller, f30_local1.squadLocation, f30_local1.squadMemberIndex, f30_local1.classLocation, f30_local1.slot, "Elite", "specialty_twoprimaries", "abilitiesPicked" ) + if f30_local12 then + f30_local12 = f29_arg0 == 1 + end + f30_local1.buttonFeeder = f30_local4( f30_local5, f30_local6, f30_local7, f30_local8, f30_local9, f30_local10, f30_local11, f30_local12, Cac.GetWeapon( f30_arg1.controller, f30_local1.squadLocation, f30_local1.squadMemberIndex, f30_local1.classLocation, f30_local1.slot, 1 - f29_arg0 ), "cac_edit_main" ) + f30_local1.checkRestriction = function ( f31_arg0 ) + if MatchRules.AllowCustomClasses( f30_local1.classLocation ) then + local f31_local0, f31_local1 = Cac.SafeGetMatchRule( "commonOption", "weaponClassRestricted", f31_arg0 ) + if f31_local0 then + local f31_local2 = f31_local1 + end + return f31_local2 or Cac.CheckWeaponTypeRestrictions( f31_arg0, f30_arg1.controller ) + else + + end + end + + f30_local1.restrictType = "weaponRestricted" + f30_local1.openMenuOnClose = f30_local1 + f30_local1.openMenuOnClose.menu = "cac_edit_popup_main" + LUI.FlowManager.RequestPopupMenu( element, "cac_edit_popup_main", true, f30_arg1.controller, false, f30_local1 ) + end, f29_local2, function ( f32_arg0, f32_arg1 ) + local f32_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f32_arg0 ) + if not f32_local0.controller then + return "" + end + local f32_local1 = Cac.GetWeapon( f32_local0.controller, f32_local0.squadLocation, f32_local0.memberIndex, f32_local0.loadoutLocation, f32_local0.loadoutSlot, f29_arg0 ) + if not Engine.InFrontend() then + f32_local1 = f0_local1( f32_local1, f29_arg0, f32_local0.controller ) + end + return Cac.GetWeaponName( f32_local1 ) + end, true, function ( f33_arg0 ) + local f33_local0, f33_local1, f33_local2 = nil + local f33_local3 = LUI.FlowManager.GetMenuScopedDataFromElement( f33_arg0 ) + if MatchRules.AllowCustomClasses( f33_local3.loadoutLocation ) then + local f33_local4 = Cac.GetWeapon( f33_local3.controller, f33_local3.squadLocation, f33_local3.memberIndex, f33_local3.loadoutLocation, f33_local3.loadoutSlot, f29_arg0 ) + local f33_local5 = false + if f33_local4 ~= "none" and f33_local4 ~= "iw6_knifeonly" then + local f33_local6, f33_local7, f33_local8 = Cac.SafeGetMatchRule( "commonOption", "weaponClassRestricted", Cac.GetWeaponClass( f33_local4 ) ) + f33_local2 = f33_local8 + f33_local5 = f33_local6 and f33_local7 + end + local f33_local9, f33_local6, f33_local7 = Cac.SafeGetMatchRule( "commonOption", "weaponRestricted", f33_local4 ) + f33_local2 = f33_local7 + return f33_local9 and f33_local6 or f33_local5 + else + + end + end, function ( f34_arg0 ) + local f34_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f34_arg0 ) + if f34_local0.exclusiveController then + if f29_arg0 == Cac.Indices.Weapons.Primary then + return Cac.AnyUnseenMDLCItems( f34_local0.exclusiveController, { + "Weapon_Primary" + } ) + else + return Cac.AnyUnseenMDLCItems( f34_local0.exclusiveController, { + "Weapon_Secondary" + } ) + end + else + + end + end ) + local f29_local4 = "edit_weapon_" + local f29_local5 + if f29_arg0 == Cac.Indices.Weapons.Primary then + f29_local5 = "primary" + if not f29_local5 then + + else + f29_local3.id = f29_local4 .. f29_local5 + f29_local3.properties.weaponIndex = f29_arg0 + f29_local3:registerEventHandler( "update_cac_info_panel", MBh.EmitEvent( "content_refresh" ) ) + f29_local3:registerEventHandler( "second_primary_focus", function ( element, event ) + if f29_arg0 == 1 then + element:processEvent( { + name = "gain_focus" + } ) + end + end ) + f29_local3:addElement( f0_local9( 0, 10, 128, 64, function ( f36_arg0, f36_arg1 ) + local f36_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f29_local3 ) + local f36_local1 = Cac.GetWeapon( f36_local0.controller, f36_local0.squadLocation, f36_local0.memberIndex, f36_local0.loadoutLocation, f36_local0.loadoutSlot, f29_arg0 ) + if not Engine.InFrontend() then + f36_local1 = f0_local1( f36_local1, f29_arg0, f36_local0.controller ) + end + local f36_local2 = Cac.GetWeaponImage( f36_local1, f29_arg0 ) + if f36_local1 == "none" and (f36_arg1.name == "button_lock" or f36_arg1.name == "button_over" or f36_arg1.resetSelected == f29_local3.id) then + f36_local2 = f36_local2 .. "_black" + end + return { + material = RegisterMaterial( f36_local2 ) + } + end, true ) ) + if Engine.InFrontend() then + local self = LUI.UIImage.new() + self.id = "weapon_new_icon" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = 0, + bottom = 2, + width = 32, + height = 32, + material = RegisterMaterial( "icon_perks_overkill" ), + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 0 + } ) + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "update_cac_info_panel", function ( element, event ) + local f37_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if Cac.IsAbilityPickedBySlotName( f37_local0.controller, f37_local0.squadLocation, f37_local0.memberIndex, f37_local0.loadoutLocation, f37_local0.loadoutSlot, "Elite", "specialty_twoprimaries", "abilitiesPicked" ) and Cac.IsWeaponClassSecondary( Cac.GetWeaponClass( Cac.GetWeapon( f37_local0.controller, f37_local0.squadLocation, f37_local0.memberIndex, f37_local0.loadoutLocation, f37_local0.loadoutSlot, f29_arg0 ) ), true ) and f29_arg0 == 1 then + element:animateToState( "visible" ) + else + element:animateToState( "default" ) + end + end ) + f29_local3:addElement( self ) + end + return f29_local3 + end + end + f29_local5 = "secondary" +end + +local f0_local14 = function () + local f38_local0 = f0_local11( 1, true, function ( f39_arg0, f39_arg1 ) + local f39_local0 = f0_local6( f39_arg0 ) + local f39_local1 = Cac.GetWeapon( f39_local0.controller, f39_local0.squadLocation, f39_local0.squadMemberIndex, f39_local0.classLocation, f39_local0.slot, Cac.Indices.Weapons.Primary ) + if IsPublicMatch() then + Cac.UpdateCamoGoldChallenge( f39_local0.controller, f39_local1, true ) + end + f39_local0.itemIndex = Cac.Indices.Weapons.Primary + f39_local0.itemTypeString = Engine.Localize( "@LUA_MENU_CHOOSE_CAMO_CAPS" ) + f39_local0.ImageFunction = Cac.GetCamoImage + f39_local0.ItemGetFunction = Cac.GetCamo + f39_local0.ItemSetFunction = Cac.SetWeaponCamo + f39_local0.itemList = Cac.GetCamoList( f39_local0.controller, f39_local1 ) + f39_local0.ItemGetNameFunction = Cac.GetCamoName + f39_local0.ImageDimensions = Cac.Layout.ChooseCamoIcon + f39_local0.selection_id = "edit_weapon_primary_camo" + f39_local0.scrollBar = true + f39_local0.elementsPerRow = 5 + f39_local0.customWidth = 720 + LUI.FlowManager.RequestPopupMenu( f39_arg0, "cac_edit_choose_image_popup", true, f39_arg1.controller, false, f39_local0 ) + end, nil, nil, true, nil, function ( f40_arg0 ) + local f40_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f40_arg0 ) + if f40_local0.exclusiveController then + return Cac.AnyUnseenMDLCItems( f40_local0.exclusiveController, { + "Camo" + } ) + else + + end + end ) + f38_local0.id = "edit_weapon_primary_camo" + f38_local0.properties.weaponIndex = Cac.Indices.Weapons.Primary + f38_local0:addElement( f0_local9( 0, 10, 48, 48, function ( f41_arg0, f41_arg1 ) + local f41_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f38_local0 ) + local f41_local1 = Cac.GetCamo( f41_local0.controller, f41_local0.squadLocation, f41_local0.memberIndex, f41_local0.loadoutLocation, f41_local0.loadoutSlot, Cac.Indices.Weapons.Primary ) + local f41_local2 = Cac.GetCamoImage( f41_local1 ) + local f41_local3 = 0.8 + if f41_local1 == "none" and (f41_arg1.name == "button_lock" or f41_arg1.name == "button_over" or f41_arg1.resetSelected == f38_local0.id) then + f41_local2 = f41_local2 .. "_black" + end + if not Engine.InFrontend() then + f41_local2 = f0_local2( f41_local2, f41_local0.controller ) + end + return { + material = RegisterMaterial( f41_local2 ), + alpha = f41_local3 + } + end, true, nil, true ) ) + return f38_local0 +end + +local f0_local15 = function ( f42_arg0, f42_arg1 ) + local f42_local0 = "edit_weapon_" + local f42_local1 + if f42_arg0 then + f42_local1 = "secondary" + if not f42_local1 then + + else + f42_local0 = f42_local0 .. f42_local1 .. "_attach" .. f42_arg1 + 1 + if f42_arg0 then + f42_local1 = Cac.Indices.Weapons.Secondary + if not f42_local1 then + + else + local f42_local2 = nil + local f42_local3 = f0_local11( 1, true, function ( f43_arg0, f43_arg1 ) + local f43_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f43_arg0 ) + local f43_local1 = Cac.IsAbilityPickedBySlotName( f43_local0.controller, f43_local0.squadLocation, f43_local0.memberIndex, f43_local0.loadoutLocation, f43_local0.loadoutSlot, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) + if not (f42_local1 ~= Cac.Indices.Weapons.Primary or not f43_local1 and f42_arg1 >= 2) or not (f42_local1 ~= Cac.Indices.Weapons.Secondary or not f43_local1 and f42_arg1 >= 1) or f42_arg1 < #Cac.GetAttachmentTypeList( Cac.GetWeapon( f43_local0.controller, f43_local0.squadLocation, f43_local0.memberIndex, f43_local0.loadoutLocation, f43_local0.loadoutSlot, f42_local1 ) ) then + local f43_local2 = f0_local6( f43_arg0 ) + f43_local2.weaponIndex = f42_local1 + f43_local2.attachIndex = f42_arg1 + LUI.FlowManager.RequestPopupMenu( f43_arg0, "cac_edit_weapon_attach_choose_main", true, f43_arg1.controller, false, f43_local2 ) + f43_arg0:dispatchEventToRoot( { + name = "change_attachment_lock", + weaponIndex = f42_local1, + attachIndex = Cac.GetAttachmentClassInUse( f43_local0.controller, f43_local0.squadLocation, f43_local0.memberIndex, f43_local0.loadoutLocation, f43_local0.loadoutSlot, f42_local1, Cac.GetAttachmentType( Cac.GetAttachment( f43_local0.controller, f43_local0.squadLocation, f43_local0.memberIndex, f43_local0.loadoutLocation, f43_local0.loadoutSlot, f42_local1, f42_arg1 ) ) ) + } ) + end + end, nil, nil, f42_arg0, function ( f44_arg0 ) + local f44_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f44_arg0 ) + if MatchRules.AllowCustomClasses( f44_local0.loadoutLocation ) then + local f44_local1, f44_local2, f44_local3 = nil + local f44_local4 = Cac.GetAttachment( f44_local0.controller, f44_local0.squadLocation, f44_local0.memberIndex, f44_local0.loadoutLocation, f44_local0.loadoutSlot, f42_local1, f42_arg1 ) + local f44_local5 = false + if f44_local4 ~= "none" then + local f44_local6, f44_local7, f44_local8 = Cac.SafeGetMatchRule( "commonOption", "attachmentClassRestricted", Cac.GetAttachmentType( f44_local4 ) ) + f44_local3 = f44_local8 + f44_local5 = f44_local6 and f44_local7 + end + local f44_local9, f44_local6, f44_local7 = Cac.SafeGetMatchRule( "commonOption", "attachmentRestricted", f44_local4 ) + f44_local3 = f44_local7 + return f44_local9 and f44_local6 or f44_local5 + else + + end + end ) + f42_local3.id = f42_local0 + f42_local3.properties = f42_local3.properties or {} + f42_local3.properties.weaponIndex = f42_local1 + f42_local3.properties.attachIndex = f42_arg1 + f42_local3.properties.secondaryActionFunc = f42_local3.m_eventHandlers.button_action + f42_local3:addEventHandler( "gain_focus", function ( f45_arg0, f45_arg1 ) + local f45_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f45_arg0 ) + local f45_local1 = Cac.GetWeapon( f45_local0.controller, f45_local0.squadLocation, f45_local0.squadMemberIndex, f45_local0.classLocation, f45_local0.slot, f42_local1 ) + local f45_local2 = Cac.GetWeaponClass( f45_local1 ) + local f45_local3 = Cac.IsAbilityPickedBySlotName( f45_local0.controller, f45_local0.squadLocation, f45_local0.memberIndex, f45_local0.loadoutLocation, f45_local0.loadoutSlot, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) + if not (f45_local2 ~= "weapon_projectile" and f45_local1 ~= "none" and f45_local1 ~= "iw6_knifeonly" and (f45_local3 or f42_arg1 <= 1 or f42_local1 ~= 0)) or not (f45_local3 or f42_arg1 <= 0 or f42_local1 ~= 1) or #Cac.GetAttachmentTypeList( f45_local1 ) <= f42_arg1 then + f45_arg0.m_eventHandlers.button_action = function ( f46_arg0, f46_arg1 ) + Engine.PlaySound( CoD.SFX.DenySelect ) + end + + else + f45_arg0.m_eventHandlers.button_action = f42_local3.properties.secondaryActionFunc + end + end ) + f42_local3:registerEventHandler( "update_cac_info_panel", function ( element, event ) + if Engine.InFrontend() then + local f47_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if event.grenadeConflict then + f47_local0.attachConflict = false + end + local f47_local1 = Cac.IsAbilityPickedBySlotName( f47_local0.controller, f47_local0.squadLocation, f47_local0.memberIndex, f47_local0.loadoutLocation, f47_local0.loadoutSlot, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) + if not (f42_local1 ~= Cac.Indices.Weapons.Primary or not f47_local1 and f42_arg1 >= 2) or f42_local1 == Cac.Indices.Weapons.Secondary and (f47_local1 or f42_arg1 < 1) then + local f47_local2 = Cac.GetAttachment( f47_local0.controller, f47_local0.squadLocation, f47_local0.memberIndex, f47_local0.loadoutLocation, f47_local0.loadoutSlot, f42_local1, f42_arg1 ) + if event.grenadeConflict then + if f47_local2 == "shotgun" or f47_local2 == "gl" then + Cac.SetAttachment( f47_local0.controller, f47_local0.squadLocation, f47_local0.memberIndex, f47_local0.loadoutLocation, f47_local0.loadoutSlot, f42_local1, f42_arg1, "none" ) + f47_local2 = "none" + element:dispatchEventToRoot( { + name = "update_restriction_icon" + } ) + end + elseif f47_local2 == "shotgun" or f47_local2 == "gl" then + f47_local0.attachConflict = true + elseif f47_local0.attachConflict then + Cac.SetFirstUnlockedGrenade( f47_local0.controller, f47_local0.squadLocation, f47_local0.memberIndex, f47_local0.loadoutLocation, f47_local0.loadoutSlot, 0 ) + end + end + end + end ) + f42_local3:registerEventHandler( "third_attach_focus", function ( element, event ) + if f42_arg1 == 2 then + element:processEvent( { + name = "gain_focus" + } ) + end + end ) + f42_local3:registerEventHandler( "change_attachment_lock", function ( element, event ) + local f49_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + local f49_local1 = Cac.GetFirstOpenAttachment( f49_local0.controller, f49_local0.squadLocation, f49_local0.memberIndex, f49_local0.loadoutLocation, f49_local0.loadoutSlot, f42_local1 ) + if event.attachIndex then + if event.attachIndex == f42_arg1 and event.weaponIndex == element.properties.weaponIndex then + element:processEvent( { + name = "button_lock", + dispatchChildren = true + } ) + else + element:animateToState( "default" ) + element:processEvent( { + name = "button_unlock", + graphicsOnly = true + } ) + end + elseif f49_local1 == f42_arg1 and event.weaponIndex == element.properties.weaponIndex then + element:processEvent( { + name = "button_lock", + dispatchChildren = true + } ) + else + element:animateToState( "default" ) + element:processEvent( { + name = "button_unlock", + graphicsOnly = true + } ) + end + end ) + f42_local3:registerEventHandler( "unlock_attachments", function ( element, event ) + element:processEvent( { + name = "button_unlock" + } ) + end ) + local f42_local4 = function ( f51_arg0, f51_arg1 ) + local f51_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f42_local3 ) + local f51_local1 = nil + local f51_local2 = 1 + local f51_local3 + if Engine.InFrontend() or Engine.GetDvarString( "g_gametype" ) ~= gun then + f51_local3 = false + else + f51_local3 = true + end + local f51_local4 = f51_local3 or Cac.IsAbilityPickedBySlotName( f51_local0.controller, f51_local0.squadLocation, f51_local0.memberIndex, f51_local0.loadoutLocation, f51_local0.loadoutSlot, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) + if not (f51_local4 or f42_arg1 <= 1 or f42_local1 ~= 0) or not f51_local4 and f42_arg1 > 0 and f42_local1 == 1 then + f51_local1 = "icon_locked" + f51_local2 = 0.07 + if f51_arg1.name == "button_lock" or f51_arg1.name == "button_over" or f51_arg1.resetSelected == f42_local3.id then + f51_local1 = "icon_locked_black" + f51_local2 = 1 + end + else + local f51_local5 = Cac.GetAttachment( f51_local0.controller, f51_local0.squadLocation, f51_local0.memberIndex, f51_local0.loadoutLocation, f51_local0.loadoutSlot, f42_local1, f42_arg1 ) + local f51_local6 = Cac.GetWeapon( f51_local0.controller, f51_local0.squadLocation, f51_local0.memberIndex, f51_local0.loadoutLocation, f51_local0.loadoutSlot, f42_local1 ) + local f51_local7 = Cac.GetWeaponClass( f51_local6 ) + if not Engine.InFrontend() then + f51_local5 = f0_local3( f51_local5, f42_arg1, f42_local1, f51_local0.controller ) + end + f51_local1 = Cac.GetAttachmentImage( f51_local5, f51_local6, f42_local1, f42_arg1 + 1 ) + if not (f51_local7 ~= "weapon_projectile" and f51_local6 ~= "none" and f51_local6 ~= "iw6_knifeonly" and (f51_local4 or f42_arg1 <= 1 or f42_local1 ~= 0)) or not (f51_local4 or f42_arg1 <= 0 or f42_local1 ~= 1) or #Cac.GetAttachmentTypeList( f51_local6 ) <= f42_arg1 then + f51_local1 = "icon_locked" + f51_local2 = 0.07 + if f51_arg1.name == "button_lock" or f51_arg1.name == "button_over" or f51_arg1.resetSelected == f42_local3.id then + f51_local1 = "icon_locked_black" + f51_local2 = 1 + end + elseif f51_local5 == "none" then + local f51_local8 = f51_arg0:getParent() + if f51_arg1.name == "button_lock" or f51_arg1.name == "button_over" or f51_arg1.resetSelected == f42_local3.id or f51_arg1.name == "update_cac_info_panel" and (f51_arg0.locked or f51_local8:isInFocus()) then + f51_local1 = f51_local1 .. "_black" + f51_local2 = 1 + else + f51_local2 = 0.07 + end + end + end + return { + material = RegisterMaterial( f51_local1 ), + alpha = f51_local2 + } + end + + local f42_local5 + if f42_arg0 then + f42_local5 = 10 + if not f42_local5 then + + else + f42_local3:addElement( f0_local9( 0, f42_local5, 48, 48, f42_local4, true ) ) + if Engine.InFrontend() then + local self = LUI.UIImage.new() + self.id = "attachment_new_icon" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = 0, + bottom = 2, + width = 32, + height = 32, + material = RegisterMaterial( "icon_perks_extra_attach" ), + red = Colors.yellow.r, + green = Colors.yellow.g, + blue = Colors.yellow.b, + alpha = 0 + } ) + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "update_cac_info_panel", function ( element, event ) + local f52_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + local f52_local1 = Cac.IsAbilityPickedBySlotName( f52_local0.controller, f52_local0.squadLocation, f52_local0.memberIndex, f52_local0.loadoutLocation, f52_local0.loadoutSlot, "Equipment", "specialty_extra_attachment", "abilitiesPicked" ) + if (not (not f52_local1 or f42_arg1 <= 1 or f42_local1 ~= 0) or f52_local1 and f42_arg1 > 0 and f42_local1 == 1) and Cac.GetAttachment( f52_local0.controller, f52_local0.squadLocation, f52_local0.memberIndex, f52_local0.loadoutLocation, f52_local0.loadoutSlot, f42_local1, f42_arg1 ) == "none" then + element:animateToState( "visible" ) + else + element:animateToState( "default" ) + end + end ) + f42_local3:addElement( self ) + end + return f42_local3 + end + end + f42_local5 = 0 + end + end + f42_local1 = Cac.Indices.Weapons.Primary + end + end + f42_local1 = "primary" +end + +local f0_local16 = function () + local f53_local0 = f0_local11( 1, true, function ( f54_arg0, f54_arg1 ) + local f54_local0 = f0_local6( f54_arg0 ) + f54_local0.itemIndex = Cac.Indices.Weapons.Primary + f54_local0.itemList = Cac.GetReticleList( f54_local0.controller, Cac.GetAttachmentWithReticles( f54_local0.controller, f54_local0.squadLocation, f54_local0.squadMemberIndex, f54_local0.classLocation, f54_local0.slot, f54_local0.itemIndex ) ) + f54_local0.itemTypeString = Engine.Localize( "@LUA_MENU_CHOOSE_RETICLE_CAPS" ) + f54_local0.ImageFunction = Cac.GetReticleImage + f54_local0.ItemGetFunction = Cac.GetReticle + f54_local0.ItemSetFunction = Cac.SetWeaponReticle + f54_local0.ItemGetNameFunction = Cac.GetReticleName + f54_local0.ImageDimensions = Cac.Layout.ChooseReticleIcon + f54_local0.selection_id = "edit_weapon_primary_reticle" + f54_local0.scrollBar = true + f54_local0.elementsPerRow = 5 + f54_local0.customWidth = 720 + LUI.FlowManager.RequestPopupMenu( f54_arg0, "cac_edit_choose_image_popup", true, f54_arg1.controller, false, f54_local0 ) + end ) + f53_local0.id = "edit_weapon_primary_reticle" + f53_local0.properties.weaponIndex = Cac.Indices.Weapons.Primary + f53_local0.properties.secondaryActionFunc = f53_local0.m_eventHandlers.button_action + f53_local0:addEventHandler( "gain_focus", function ( f55_arg0, f55_arg1 ) + local f55_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f55_arg0 ) + if Cac.GetWeapon( f55_local0.controller, f55_local0.squadLocation, f55_local0.squadMemberIndex, f55_local0.classLocation, f55_local0.slot, Cac.Indices.Weapons.Primary ) == "iw6_knifeonly" then + f55_arg0.m_eventHandlers.button_action = function ( f56_arg0, f56_arg1 ) + Engine.PlaySound( CoD.SFX.DenySelect ) + end + + else + f55_arg0.m_eventHandlers.button_action = f53_local0.properties.secondaryActionFunc + end + end ) + f53_local0:addElement( f0_local9( 0, 0, 48, 48, function ( f57_arg0, f57_arg1 ) + local f57_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f53_local0 ) + local f57_local1 = Cac.GetReticle( f57_local0.controller, f57_local0.squadLocation, f57_local0.memberIndex, f57_local0.loadoutLocation, f57_local0.loadoutSlot, Cac.Indices.Weapons.Primary ) + local f57_local2 = Cac.GetReticleImage( f57_local1 ) + local f57_local3 = Cac.GetWeapon( f57_local0.controller, f57_local0.squadLocation, f57_local0.memberIndex, f57_local0.loadoutLocation, f57_local0.loadoutSlot, Cac.Indices.Weapons.Primary ) + local f57_local4 = 1 + if f57_local3 == "iw6_knifeonly" then + f57_local2 = "icon_locked" + f57_local4 = 0.07 + if f57_arg1.name == "button_lock" or f57_arg1.name == "button_over" or f57_arg1.resetSelected == f53_local0.id then + f57_local2 = "icon_locked_black" + f57_local4 = 1 + end + elseif f57_local1 == "none" and (f57_arg1.name == "button_lock" or f57_arg1.name == "button_over" or f57_arg1.resetSelected == f53_local0.id) then + f57_local2 = f57_local2 .. "_black" + end + if not Engine.InFrontend() then + f57_local2 = f0_local4( f57_local2, f57_local0.controller ) + end + return { + material = RegisterMaterial( f57_local2 ), + alpha = f57_local4 + } + end, true ) ) + return f53_local0 +end + +local f0_local17 = function ( f58_arg0 ) + local f58_local0 = function ( f59_arg0, f59_arg1 ) + local f59_local0 = f0_local6( f59_arg0 ) + f59_local0.itemIndex = f58_arg0 + f59_local0.itemTypeString = f58_arg0 and Engine.Localize( "@MENU_LETHAL_CAPS" ) or Engine.Localize( "@LUA_MENU_TACTICAL_CAPS" ) + f59_local0.disableSetDefaultFocus = false + f59_local0.selection_id = f58_arg0 and "edit_lethal" or "edit_tactical" + f59_local0.ImageFunction = Cac.GetGrenadeImage + f59_local0.ItemGetFunction = Cac.GetPerk + f59_local0.ItemSetFunction = Cac.SetPerk + f59_local0.itemList = Cac.GetGrenadeList( f58_arg0 ) + f59_local0.ItemGetNameFunction = Cac.GetPerkName + f59_local0.ImageDimensions = Cac.Layout.ChooseGrenadeIcon + f59_local0.restrictType = "perkRestricted" + LUI.FlowManager.RequestPopupMenu( f59_arg0, "cac_edit_choose_image_popup", true, f59_arg1.controller, false, f59_local0 ) + end + + local f58_local1 = { + "@MENU_LETHAL_CAPS", + "@MENU_SPECIAL_EQUIPMENT_CAPS" + } + local f58_local2 = { + Cac.GetPrimaryGrenade, + Cac.GetSecondaryGrenade + } + local f58_local3 = f0_local11( 2, true, f58_local0, Engine.Localize( f58_local1[f58_arg0 + 1] ), nil, nil, function ( f60_arg0 ) + local f60_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f60_arg0 ) + if MatchRules.AllowCustomClasses( f60_local0.loadoutLocation ) then + local f60_local1, f60_local2, f60_local3 = Cac.SafeGetMatchRule( "commonOption", "perkRestricted", Cac.GetPerk( f60_local0.controller, f60_local0.squadLocation, f60_local0.memberIndex, f60_local0.loadoutLocation, f60_local0.loadoutSlot, f58_arg0 ) ) + local f60_local4 = f60_local1 and f60_local2 + local f60_local5 = false + if f58_arg0 == 0 then + for f60_local14, f60_local15 in pairs( Cac.Indices.Weapons ) do + local f60_local9 + if f60_local15 == Cac.Indices.Weapons.Primary then + f60_local9 = 2 + if not f60_local9 then + + else + for f60_local10 = 0, f60_local9, 1 do + local f60_local13 = Cac.GetAttachment( f60_local0.controller, f60_local0.squadLocation, f60_local0.memberIndex, f60_local0.loadoutLocation, f60_local0.loadoutSlot, f60_local15, f60_local10 ) + if f60_local13 == "shotgun" or f60_local13 == "gl" then + f60_local1, f60_local2 = Cac.SafeGetMatchRule( "commonOption", "attachmentClassRestricted", "undermount" ) + if not f60_local5 then + f60_local5 = f60_local1 and f60_local2 + end + f60_local1, f60_local2 = Cac.SafeGetMatchRule( "commonOption", "attachmentRestricted", f60_local13 ) + if not f60_local5 then + f60_local5 = f60_local1 and f60_local2 + end + end + end + end + end + f60_local9 = 1 + end + end + return f60_local4 or f60_local5 + else + + end + end ) + local f58_local4 = "edit_" + local f58_local5 + if f58_arg0 == 0 then + f58_local5 = "lethal" + if not f58_local5 then + + else + f58_local3.id = f58_local4 .. f58_local5 + f58_local3.properties.weaponIndex = f58_arg0 + f58_local3:registerEventHandler( "update_cac_info_panel", function ( element, event ) + if Engine.InFrontend() then + local f61_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f58_local3 ) + if event.attachConflict then + f61_local0.attachConflict = event.attachConflict + end + if f58_arg0 == 0 and f61_local0.attachConflict then + for f61_local1 = 0, 2, 1 do + local f61_local4 = Cac.GetAttachment( f61_local0.controller, f61_local0.squadLocation, f61_local0.memberIndex, f61_local0.loadoutLocation, f61_local0.loadoutSlot, 0, f61_local1 ) + if f61_local4 == "shotgun" or f61_local4 == "gl" then + Cac.SetPerk( f61_local0.controller, f61_local0.squadLocation, f61_local0.memberIndex, f61_local0.loadoutLocation, f61_local0.loadoutSlot, 0, "specialty_null" ) + break + end + end + end + end + end ) + f58_local3:addElement( f0_local9( 0, 8, 40, 40, function ( f62_arg0, f62_arg1 ) + local f62_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f58_local3 ) + local f62_local1 = f58_local2[f58_arg0 + 1]( f62_local0.controller, f62_local0.squadLocation, f62_local0.memberIndex, f62_local0.loadoutLocation, f62_local0.loadoutSlot, f58_arg0 ) + local f62_local2 = nil + local f62_local3 = Engine.GetDvarString( "g_gametype" ) + if f58_arg0 == 0 then + for f62_local12, f62_local13 in pairs( Cac.Indices.Weapons ) do + local f62_local7 + if f62_local13 == Cac.Indices.Weapons.Primary then + f62_local7 = 2 + if not f62_local7 then + + else + for f62_local8 = 0, f62_local7, 1 do + local f62_local11 = Cac.GetAttachment( f62_local0.controller, f62_local0.squadLocation, f62_local0.memberIndex, f62_local0.loadoutLocation, f62_local0.loadoutSlot, f62_local13, f62_local8 ) + if f62_local11 == "shotgun" or f62_local11 == "gl" then + f62_local2 = Cac.GetAttachmentImage( f62_local11, Cac.GetWeapon( f62_local0.controller, f62_local0.squadLocation, f62_local0.memberIndex, f62_local0.loadoutLocation, f62_local0.loadoutSlot, f62_local13 ), f62_local13, f62_local8 ) + break + end + end + if f62_local2 then + + end + end + end + f62_local7 = 1 + end + end + if not Engine.InFrontend() then + if f0_local0( f62_local3, f62_local0.controller ) then + f62_local2 = nil + end + f62_local1 = f0_local5( f62_local1, f58_arg0, f62_local0.controller ) + end + if not f62_local2 then + f62_local2 = Cac.GetGrenadeImage( Cac.StripSuffix( f62_local1, "_mp" ), f58_arg0 ) + if f62_local1 == "specialty_null" and (f62_arg1.name == "button_lock" or f62_arg1.name == "button_over" or f62_arg1.resetSelected == f58_local3.id) then + f62_local2 = f62_local2 .. "_black" + end + end + return { + material = RegisterMaterial( f62_local2 ) + } + end, true ) ) + if Engine.InFrontend() then + local self = LUI.UIImage.new() + self.id = "grenade_new_icon_" .. f58_arg0 + local f58_local7 = self + local f58_local8 = self.registerAnimationState + local f58_local9 = "default" + local f58_local10 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = 0, + bottom = 2, + width = 32, + height = 32 + } + local f58_local11 + if f58_arg0 == Cac.Indices.Grenade.Primary then + f58_local11 = RegisterMaterial( "icon_perks_extra_lethal" ) + if not f58_local11 then + + else + f58_local10.material = f58_local11 + f58_local10.red = Colors.yellow.r + f58_local10.green = Colors.yellow.g + f58_local10.blue = Colors.yellow.b + f58_local10.alpha = 0 + f58_local8( f58_local7, f58_local9, f58_local10 ) + self:registerAnimationState( "visible", { + alpha = 1 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "update_cac_info_panel", function ( element, event ) + local f63_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if Cac.IsAbilityPickedBySlotName( f63_local0.controller, f63_local0.squadLocation, f63_local0.memberIndex, f63_local0.loadoutLocation, f63_local0.loadoutSlot, "Equipment", f58_arg0 and "specialty_extra_deadly" or "specialty_extra_equipment", "abilitiesPicked" ) and Cac.GetPerk( f63_local0.controller, f63_local0.squadLocation, f63_local0.memberIndex, f63_local0.loadoutLocation, f63_local0.loadoutSlot, f58_arg0 ) == "specialty_null" then + element:animateToState( "visible" ) + else + element:animateToState( "default" ) + end + end ) + f58_local3:addElement( self ) + end + end + f58_local11 = RegisterMaterial( "icon_perks_extra_tactical" ) + end + return f58_local3 + end + end + f58_local5 = "tactical" +end + +local f0_local18 = function ( f64_arg0, f64_arg1, f64_arg2, f64_arg3, f64_arg4, f64_arg5, f64_arg6, f64_arg7 ) + local f64_local0 = Engine.GetDvarString( "g_gametype" ) + local f64_local1 = false + local f64_local2 = LUI.FlowManager.GetMenuScopedDataFromElement( f64_arg0 ) + if not Engine.InFrontend() and f0_local0( f64_local0, f64_local2.controller ) then + f64_local1 = true + f64_arg2 = 40 + f64_arg3 = 48 + f64_arg4 = 1 + f64_arg7 = false + end + f64_arg0:closeChildren() + local f64_local3 = 0 + if f64_arg7 then + local f64_local4 = Cac.Abilities.Settings.GrabBagCapacity / Cac.CalculateAbilityCapacity( f64_local2.controller, f64_local2.squadLocation, f64_local2.memberIndex, f64_local2.loadoutLocation, f64_local2.loadoutSlot ) + f64_arg2 = f64_arg2 * f64_local4 + f64_arg3 = f64_arg3 * f64_local4 + f64_arg4 = f64_arg4 * f64_local4 + f64_arg0:registerAnimationState( "scaled", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = (8 - Cac.Layout.AbilitiesBar.slot_height / 2) * f64_local4, + left = 0, + right = 0, + height = Cac.Layout.AbilitiesBar.slot_height + } ) + f64_arg0:animateToState( "scaled", 0 ) + end + if not f64_local1 then + for f64_local15, f64_local16 in ipairs( Cac.GetAbilityTypes() ) do + for f64_local14 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + if Cac.IsAbilityPicked( f64_local2.controller, f64_local2.squadLocation, f64_local2.memberIndex, f64_local2.loadoutLocation, f64_local2.loadoutSlot, f64_local16, f64_local14 - 1, f64_arg5 ) then + local f64_local7 = Cac.GetAbilityRef( f64_local16 ) + local f64_local8 = Cac.GetAbilitySlotRef( f64_local7, f64_local14 ) + local f64_local9 = Cac.GetPerkImage( f64_local8 ) + local f64_local10 = Cac.GetPerkCost( f64_local8 ) + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = f64_arg2 * f64_local10 + f64_arg4 * math.max( 0, f64_local10 - 1 ), + height = f64_arg3 + } ) + f64_local3 = f64_local3 + f64_local10 + self.id = f64_arg6 .. "slot_" .. f64_local3 + local f64_local12 = LUI.UIImage.new( CoD.ColorizeState( Cac.Swatches.slot, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = 0.05 + } ) ) + f64_local12:registerAnimationState( "locked", CoD.ColorizeState( Cac.Swatches.selection, { + alpha = 1 + } ) ) + f64_local12:registerEventHandler( "button_over", MBh.AnimateToState( "locked" ) ) + f64_local12:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + if f64_arg0.editingAbilities then + f64_local12:animateToState( "locked" ) + end + f64_local12:registerEventHandler( "button_lock", function ( element, event ) + f64_arg0.editingAbilities = true + element:animateToState( "locked" ) + end ) + f64_local12:registerEventHandler( "button_unlock", function ( element, event ) + f64_arg0.editingAbilities = false + element:animateToState( "default" ) + end ) + self:addElement( f64_local12 ) + local f64_local13 = LUI.UIImage.new( CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( f64_local9 ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 1, + left = -(f64_arg2 - 2) / 2, + width = f64_arg2 - 2, + height = f64_arg2 - 2 + } ) ) + if Engine.InFrontend() then + f64_local13:registerAnimationState( "locked", CoD.ColorizeState( Colors.black ) ) + f64_local13:registerEventHandler( "button_lock", MBh.AnimateToState( "locked" ) ) + f64_local13:registerEventHandler( "button_unlock", MBh.AnimateToState( "default" ) ) + f64_local13:registerEventHandler( "button_over", MBh.AnimateToState( "locked" ) ) + f64_local13:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + if f64_arg0.editingAbilities then + f64_local13:animateToState( "locked" ) + end + end + self:addElement( f64_local13 ) + self:addElement( LUI.UIImage.new( CoD.ColorizeState( Colors.cac_ability[f64_local7], { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = f64_arg2, + left = 0, + right = 0, + height = 5, + material = RegisterMaterial( "white" ) + } ) ) ) + f64_arg0:addElement( self ) + end + end + end + end + local f64_local4 + if f64_arg7 then + f64_local4 = Cac.CalculateAbilityCapacity( f64_local2.controller, f64_local2.squadLocation, f64_local2.memberIndex, f64_local2.loadoutLocation, f64_local2.loadoutSlot ) + if not f64_local4 then + + else + if f64_arg7 and f64_local4 ~= f64_local2.upperBound then + f64_local2.upperBound = f64_local4 + f64_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f64_local2.controller, + dispatchChildren = true, + resetSelected = f64_arg1.resetSelected + } ) + end + for f64_local5 = f64_local3 + 1, f64_local4, 1 do + local f64_local14 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = f64_arg2, + height = f64_arg2 + } ) + f64_local14.id = f64_arg6 .. "empty_slot_" .. f64_local5 + local f64_local17 = LUI.UIImage.new( CoD.ColorizeState( Cac.Swatches.slot, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = 0.05 + } ) ) + if Engine.InFrontend() then + f64_local17:registerAnimationState( "over", CoD.ColorizeState( Cac.Swatches.slot_over, { + alpha = 0.5 + } ) ) + f64_local17:registerEventHandler( "button_over", MBh.AnimateToState( "over" ) ) + f64_local17:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f64_local17:registerEventHandler( "button_over_disabled", MBh.AnimateToState( "over" ) ) + f64_local17:registerEventHandler( "button_up_disabled", MBh.AnimateToState( "over" ) ) + f64_local17:registerEventHandler( "button_lock", function ( element, event ) + f64_arg0.editingAbilities = true + element:animateToState( "over" ) + end ) + f64_local17:registerEventHandler( "button_unlock", function ( element, event ) + f64_arg0.editingAbilities = false + element:animateToState( "default" ) + end ) + if f64_arg1.selected then + f64_local17:animateToState( "over", 0 ) + end + end + f64_local14:addElement( f64_local17 ) + f64_arg0:addElement( f64_local14 ) + end + end + end + f64_local4 = Cac.Abilities.Settings.GrabBagCapacity +end + +local f0_local19 = function () + local f69_local0 = Engine.GetDvarString( "g_gametype" ) + local f69_local1 = false + local f69_local2 = f0_local11( 4, false, function ( f70_arg0, f70_arg1 ) + local f70_local0 = f0_local6( f70_arg0 ) + local f70_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f70_arg0 ) + f70_local0.itemIndex = Cac.Indices.StreakType + f70_local0.titleBarText = Engine.Localize( "@LUA_MENU_STREAK_TYPE_CAPS" ) + if not f70_local1.defaultFocus then + f70_local1.defaultFocus = {} + end + f70_local1.defaultFocus[#f70_local1.defaultFocus + 1] = Cac.GetPerk( f70_arg1.controller, f70_local0.squadLocation, f70_local0.squadMemberIndex, f70_local0.classLocation, f70_local0.slot, Cac.Indices.StreakType ) + f70_local0.buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetPerkName, Cac.DefaultEditChooseStreakTypeAction, Cac.StreakTypes, Cac.GetPerk( f70_arg1.controller, f70_local0.squadLocation, f70_local0.squadMemberIndex, f70_local0.classLocation, f70_local0.slot, Cac.Indices.StreakType ), Cac.GetItemClassDescriptions, nil, nil, nil, nil, "cac_edit_main" ) + f70_local0.checkRestriction = function ( f71_arg0 ) + if MatchRules.AllowCustomClasses( f70_local0.classLocation ) then + local f71_local0, f71_local1, f71_local2 = Cac.SafeGetMatchRule( "commonOption", "killstreakClassRestricted", f71_arg0 ) + if f71_local0 then + local f71_local3 = f71_local1 + end + return f71_local3 or Cac.CheckKillstreakTypeRestrictions( f71_arg0 ) + else + + end + end + + f70_local0.openMenuOnClose = f70_local0 + f70_local0.openMenuOnClose.menu = "cac_edit_popup_main" + f70_arg0:dispatchEventToRoot( { + name = "hide_abilities_info_panel", + immediate = true + } ) + LUI.FlowManager.RequestPopupMenu( element, "cac_edit_popup_main", true, f70_arg1.controller, false, f70_local0 ) + end, Engine.Localize( "@MENU_STRIKE_PACKAGE_CAPS" ), function ( f72_arg0, f72_arg1 ) + local f72_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f72_arg0 ) + if not Engine.InFrontend() and f0_local0( f69_local0, f72_local0.exclusiveController ) then + f69_local1 = true + end + if f69_local1 then + return "" + elseif not f72_local0.controller then + return "" + end + local f72_local1 = Cac.GetStreakType( f72_local0.controller, f72_local0.squadLocation, f72_local0.memberIndex, f72_local0.loadoutLocation, f72_local0.loadoutSlot ) + if f72_local1 == "specialty_null" then + f72_local1 = "streaktype_assault" + end + return Cac.GetPerkName( f72_local1 ) + end, nil, function ( f73_arg0 ) + local f73_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f73_arg0 ) + if MatchRules.AllowCustomClasses( f73_local0.loadoutLocation ) then + local f73_local1 = false + local f73_local2 = true + local f73_local3 = Cac.GetStreakType( f73_local0.controller, f73_local0.squadLocation, f73_local0.memberIndex, f73_local0.loadoutLocation, f73_local0.loadoutSlot ) + if f73_local3 == "specialty_null" then + f73_local3 = "streaktype_assault" + end + local f73_local4, f73_local5, f73_local6 = Cac.SafeGetMatchRule( "commonOption", "killstreakClassRestricted", f73_local3 ) + local f73_local7 = f73_local4 and f73_local5 + local f73_local8 + if f73_local3 == "streaktype_specialist" then + f73_local8 = "perkRestricted" + if not f73_local8 then + + else + for f73_local9 = Cac.Indices.Killstreaks.Streak1, Cac.Indices.Killstreaks.Streak3, 1 do + local f73_local12 = Cac.GetStreak( f73_local0.controller, f73_local0.squadLocation, f73_local0.memberIndex, f73_local0.loadoutLocation, f73_local0.loadoutSlot, Cac.GetStreakTypeReference( f73_local3 ), f73_local9 ) + if f73_local12 ~= "none" then + f73_local2 = false + if f73_local3 == "streaktype_specialist" then + f73_local12 = Cac.StripSuffix( f73_local12, "_ks" ) + f73_local4, f73_local5, f73_local6 = Cac.SafeGetMatchRule( "commonOption", "perkClassRestricted", Cac.GetPerkGroup( f73_local12 ) ) + if not f73_local1 then + f73_local1 = f73_local4 and f73_local5 + end + end + f73_local4, f73_local5, f73_local6 = Cac.SafeGetMatchRule( "commonOption", f73_local8, f73_local12 ) + if not f73_local1 then + f73_local1 = f73_local4 and f73_local5 + end + end + end + local f73_local9, f73_local10 = Cac.ArePerksRestricted( f73_local0.controller, f73_local0.squadLocation, f73_local0.memberIndex, f73_local0.loadoutLocation, f73_local0.loadoutSlot, "specialistBonusStreaks" ) + if f73_local2 then + f73_local2 = f73_local10 + end + if f73_local3 == "streaktype_specialist" and not f73_local1 then + f73_local1 = f73_local9 + end + if not f73_local1 then + local f73_local13 = f73_local7 + end + return f73_local13 and not f73_local2 + end + end + f73_local8 = "killstreakRestricted" + else + + end + end ) + f69_local2:registerEventHandler( "update_cac_info_panel", MBh.EmitEvent( "content_refresh" ) ) + f69_local2:registerEventHandler( "refresh_specialist_abilities_recap", function ( element, event ) + local f74_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + local f74_local1 = f69_local2:getFirstDescendentById( "text_label" ) + local f74_local2 = f69_local2:getFirstDescendentById( "content_text_label" ) + local f74_local3 = 4 * RecapLayout.GridH + 3 * RecapLayout.GridHGutter + local f74_local4 = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = 4 - f74_local3 / 2, + right = f74_local3 / 2, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height + } + local f74_local5 = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -f74_local3 / 2, + right = f74_local3 / 2, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height + } + local f74_local6 = CoD.ColorizeState( Colors.cac_label_text, f74_local4 ) + local f74_local7 = CoD.ColorizeState( Colors.generic_button_content_focus_color, f74_local5 ) + f74_local1:registerAnimationState( "default", f74_local6 ) + f74_local2:registerAnimationState( "default", f74_local7 ) + if event.selected then + local f74_local8 = CoD.ColorizeState( Colors.cac_button, f74_local4 ) + local f74_local9 = CoD.ColorizeState( Colors.cac_button, f74_local5 ) + f74_local0.specialistStrike = true + f74_local1:registerAnimationState( "newState", f74_local8 ) + f74_local2:registerAnimationState( "newState", f74_local9 ) + f74_local1:animateToState( "newState" ) + f74_local2:animateToState( "newState" ) + else + f74_local1:animateToState( "default" ) + f74_local2:animateToState( "default" ) + end + element:dispatchEventToChildren( event ) + end ) + f69_local2.id = "edit_killstreaks" + local f69_local3 = { + Cac.GetStreak1, + Cac.GetStreak2, + Cac.GetStreak3 + } + if not f69_local1 then + local self = LUI.UIText.new( CoD.ColorizeState( Colors.white, { + font = CoD.TextSettings.SmallFont.Font, + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -Cac.Layout.AbilitiesBar.slot_height, + left = 0, + right = 32, + height = CoD.TextSettings.SmallFont.Height + } ) ) + self:setText( "" ) + self:registerAnimationState( "locked", CoD.ColorizeState( Colors.cac_button, {} ) ) + self:registerEventHandler( "update_cac_info_panel", function ( element, event ) + local f75_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f69_local2 ) + if Cac.GetPerk( f75_local0.controller, f75_local0.squadLocation, f75_local0.memberIndex, f75_local0.loadoutLocation, f75_local0.loadoutSlot, Cac.Indices.StreakType ) == "streaktype_specialist" then + local f75_local1 = 0 + for f75_local2 = 1, 3, 1 do + local f75_local5 = Cac.GetPerkCost( Cac.StripSuffix( f69_local3[f75_local2]( f75_local0.controller, f75_local0.squadLocation, f75_local0.memberIndex, f75_local0.loadoutLocation, f75_local0.loadoutSlot ), "_ks" ) ) + if f75_local5 ~= "" and f75_local5 then + f75_local1 = f75_local1 + f75_local5 + 1 + end + end + element:setText( Engine.Localize( "@LUA_MENU_BONUS_AT_N_KILLS", math.max( 8, f75_local1 + 2 ) ) ) + else + element:setText( "" ) + end + end ) + self:registerEventHandler( "button_lock", MBh.AnimateToState( "locked" ) ) + self:registerEventHandler( "button_unlock", MBh.AnimateToState( "default" ) ) + self:registerEventHandler( "button_over", MBh.AnimateToState( "locked" ) ) + self:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f69_local2:addElement( self ) + end + local self = Cac.Layout.SpecialistStreak.PreviewButton.width + local f69_local5 = Cac.Layout.SpecialistStreak.PreviewButton.height + for f69_local6 = 0, 2, 1 do + local f69_local9 = f69_local6 + local f69_local10 = f0_local9( (Cac.Layout.SpecialistStreak.PreviewButton.width + 40) * (f69_local9 - 1), 8, self, f69_local5, function ( f76_arg0, f76_arg1 ) + local f76_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f69_local2 ) + local f76_local1 = f69_local3[f69_local9 + 1]( f76_local0.controller, f76_local0.squadLocation, f76_local0.memberIndex, f76_local0.loadoutLocation, f76_local0.loadoutSlot ) + local f76_local2 = Cac.GetStreakIcon( f76_local1, f76_local0.controller ) + local f76_local3 = 1 + if f76_local1 == nil or f76_local1 == "none" or f76_local1 == "specialty_null" or f76_local1 == "" then + f76_local3 = 0.1 + end + if f76_local1 == "none" and (f76_arg1.name == "button_lock" or f76_arg1.name == "button_over" or f76_arg1.resetSelected == f69_local2.id) then + f76_local2 = f76_local2 .. "_black" + f76_local3 = 1 + end + if f69_local1 then + f76_local2 = "icon_weapon_ph_sp_diamond_64" + f76_local3 = 0.1 + end + return { + material = RegisterMaterial( f76_local2 ), + alpha = f76_local3 + } + end, true, true ) + if not f69_local1 then + f69_local10:registerEventHandler( "refresh_specialist_abilities_recap", function ( element, event ) + local f77_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + element:animateToState( event.specialistType and "moved" or "restore_position", 100 ) + end ) + local f69_local11 = LUI.UIText.new( CoD.ColorizeState( Colors.white, { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottom = 0, + left = -25, + width = 30, + height = CoD.TextSettings.SmallFont.Height + } ) ) + f69_local11:setText( "" ) + f69_local11:setTextStyle( CoD.TextStyle.Outlined ) + f69_local11:registerAnimationState( "invert", CoD.ColorizeState( Colors.black, {} ) ) + f69_local11:registerEventHandler( "update_cac_info_panel", function ( element, event ) + local f78_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f69_local2 ) + local f78_local1 = f69_local3[f69_local9 + 1]( f78_local0.controller, f78_local0.squadLocation, f78_local0.memberIndex, f78_local0.loadoutLocation, f78_local0.loadoutSlot ) + local f78_local2 = Cac.GetPerk( f78_local0.controller, f78_local0.squadLocation, f78_local0.memberIndex, f78_local0.loadoutLocation, f78_local0.loadoutSlot, Cac.Indices.StreakType ) + local f78_local3 = 0 + if f78_local2 == "streaktype_specialist" then + if f78_local1 ~= "none" then + for f78_local4 = 0, f69_local9, 1 do + local f78_local7 = Cac.GetPerkCost( Cac.StripSuffix( f69_local3[f78_local4 + 1]( f78_local0.controller, f78_local0.squadLocation, f78_local0.memberIndex, f78_local0.loadoutLocation, f78_local0.loadoutSlot ), "_ks" ) ) + if f78_local7 ~= "" and f78_local7 then + f78_local3 = f78_local3 + f78_local7 + 1 + end + end + else + f78_local3 = "" + end + else + f78_local3 = Cac.GetStreakCost( f78_local1 ) + end + element:setText( f78_local3 ) + end ) + f69_local11:registerEventHandler( "button_lock", function ( element, event ) + element:setTextStyle( CoD.TextStyle.None ) + element:animateToState( "invert" ) + end ) + f69_local11:registerEventHandler( "button_over", function ( element, event ) + element:setTextStyle( CoD.TextStyle.None ) + element:animateToState( "invert" ) + end ) + f69_local11:registerEventHandler( "button_up", function ( element, event ) + element:setTextStyle( CoD.TextStyle.Outlined ) + element:animateToState( "default" ) + end ) + f69_local10:addElement( f69_local11 ) + end + f69_local2:addElement( f69_local10 ) + end + local f69_local6 = LUI.UIHorizontalList.new() + f69_local6.id = "specialist_ability_recap" + f69_local6.editingAbilities = false + f69_local6:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = -2, + left = 0, + right = 0, + height = Cac.Layout.AbilitiesBar.slot_height, + alignment = LUI.Alignment.Center, + spacing = Cac.Layout.AbilitiesBar.slot_spacing, + alpha = 0 + } ) + f69_local6:animateToState( "default" ) + f69_local6:registerAnimationState( "visible", { + alpha = 1 + } ) + f69_local6:registerEventHandler( "refresh_specialist_abilities_recap", function ( element, event ) + local f82_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + element:animateToState( event.specialistType and "visible" or "default", 100 ) + f0_local18( element, event, Cac.Layout.AbilitiesBar.slot_width, Cac.Layout.AbilitiesBar.slot_height, Cac.Layout.AbilitiesBar.slot_spacing, "specialistBonusStreaks", "specialist_" ) + end ) + f69_local2:addElement( f69_local6 ) + return f69_local2 +end + +local f0_local20 = function () + local f83_local0 = f0_local11( 4, false, function ( f84_arg0, f84_arg1 ) + local f84_local0 = f0_local6( f84_arg0 ) + f84_arg0:dispatchEventToRoot( { + name = "hide_abilities_info_panel", + immediate = true + } ) + LUI.FlowManager.RequestPopupMenu( f84_arg0, "cac_ability_alt_main", true, f84_arg1.controller, false, f84_local0 ) + end, Engine.Localize( "@MENU_ABILITIES_CAPS" ), nil, nil, function ( f85_arg0 ) + local f85_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f85_arg0 ) + if MatchRules.AllowCustomClasses( f85_local0.loadoutLocation ) then + return Cac.ArePerksRestricted( f85_local0.controller, f85_local0.squadLocation, f85_local0.memberIndex, f85_local0.loadoutLocation, f85_local0.loadoutSlot, "abilitiesPicked" ) + else + + end + end ) + f83_local0.id = "edit_abilities" + f83_local0:registerEventHandler( "second_primary_focus", MBh.EmitEvent( "lose_focus" ) ) + f83_local0:registerEventHandler( "third_attach_focus", MBh.EmitEvent( "lose_focus" ) ) + local self = LUI.UIHorizontalList.new( { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 8 - Cac.Layout.AbilitiesBar.slot_height / 2, + left = 0, + right = 0, + height = Cac.Layout.AbilitiesBar.slot_height, + alignment = LUI.Alignment.Center, + spacing = Cac.Layout.AbilitiesBar.slot_spacing + } ) + self.id = "ability_recap" + self.editingAbilities = false + self:registerEventHandler( "refresh_abilities_recap", function ( element, event ) + local f86_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + f86_local0.editingAbilities = false + if event.item and Engine.InFrontend() and event.item ~= "specialty_null" and event.item ~= "none" and event.item ~= "iw6_knifeonly" and event.item ~= "uav" and Cac.CalculateAbilityCapacity( f86_local0.controller, f86_local0.squadLocation, f86_local0.memberIndex, f86_local0.loadoutLocation, f86_local0.loadoutSlot ) - Cac.CountSpentPoints( f86_local0.controller, f86_local0.squadLocation, f86_local0.memberIndex, f86_local0.loadoutLocation, f86_local0.loadoutSlot, "abilitiesPicked" ) < 0 then + Cac.RemoveLastPerk( f86_local0.controller, f86_local0.squadLocation, f86_local0.memberIndex, f86_local0.loadoutLocation, f86_local0.loadoutSlot, "abilitiesPicked", true ) + end + f0_local18( element, event, Cac.Layout.AbilitiesBar.slot_width, Cac.Layout.AbilitiesBar.slot_height, Cac.Layout.AbilitiesBar.slot_spacing, "abilitiesPicked", "abilities_", true ) + end ) + f83_local0:addElement( self ) + return f83_local0 +end + +local f0_local21 = function ( f87_arg0 ) + f87_arg0:processEvent( { + name = "update_cac_info_panel", + dispatchChildren = true + } ) + f87_arg0:processEvent( { + name = "refresh_abilities_recap" + } ) +end + +local f0_local22 = function ( f88_arg0, f88_arg1 ) + local f88_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f88_arg0 ) + f88_arg0.properties = f88_arg0.properties or {} + if not f88_arg0.properties.exclusiveController or not f88_arg0.properties.squad_location or not f88_arg0.properties.class_location then + DebugPrint( "WARNING: Missing init data for cac_edit_main. Placeholder values will be used." ) + end + f88_local0.controller = f88_arg0.properties.exclusiveController or 0 + local f88_local1 = f88_arg0.properties.squad_location + if not f88_local1 then + f88_local1 = Cac.GetSquadLoc() + end + f88_local0.squadLocation = f88_local1 + f88_local1 = f88_arg0.properties.member_index + if not f88_local1 then + f88_local1 = Cac.GetEditSquadMember() + end + f88_local0.memberIndex = f88_local1 + f88_local0.loadoutLocation = f88_arg0.properties.class_location or "loadouts" + f88_local0.loadoutSlot = f88_arg0.properties.loadout_slot or 0 + f88_local0.upperBound = Cac.CalculateAbilityCapacity( f88_local0.controller, f88_local0.squadLocation, f88_local0.memberIndex, f88_local0.loadoutLocation, f88_local0.loadoutSlot ) + f0_local21( f88_arg0 ) +end + +local f0_local23 = function ( f89_arg0, f89_arg1 ) + local f89_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f89_arg0 ) + local f89_local1 = f89_local0.selectionIDFocused + if f89_local1 then + if f89_local1 == "edit_weapon_primary" or f89_local1 == "edit_weapon_secondary" then + local f89_local2 = f89_local0.weaponIndexFocused + local f89_local3 = Cac.Indices.Weapons.Primary + f89_local2 = REG18 and "iw6_knifeonly" or "none" + Cac.SetWeapon( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, f89_local2 ) + f89_arg0:dispatchEventToRoot( { + name = "refresh_abilities_recap", + controller = f89_arg1.controller, + specialistType = false, + item = f89_local2, + resetSelected = f89_local1 + } ) + elseif f89_local1 == "edit_weapon_primary_attach1" or f89_local1 == "edit_weapon_primary_attach2" or f89_local1 == "edit_weapon_primary_attach3" or f89_local1 == "edit_weapon_secondary_attach1" or f89_local1 == "edit_weapon_secondary_attach2" or f89_local1 == "edit_lethal" then + if f89_local1 == "edit_lethal" then + local f89_local2 = Cac.HasAttachments( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, 0, { + "gl", + "shotgun" + } ) + local f89_local3 = Cac.HasAttachments( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, 1, { + "gl", + "shotgun" + } ) + if f89_local2 and f89_local1 == "edit_lethal" then + Cac.SetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, Cac.Indices.Weapons.Primary, f89_local2 - 1, "none" ) + elseif f89_local3 and f89_local1 == "edit_lethal" then + Cac.SetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, Cac.Indices.Weapons.Secondary, f89_local3 - 1, "none" ) + else + Cac.SetPerk( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, "specialty_null" ) + end + else + if Cac.AttachmentHasReticles( Cac.GetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, f89_local0.attachIndexFocused ) ) then + Cac.SetWeaponReticle( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, 0, "none" ) + end + Cac.SetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, f89_local0.attachIndexFocused, "none" ) + end + local f89_local2 = Cac.GetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, 0 ) + local f89_local3 = Cac.GetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, 1 ) + local f89_local4 = Cac.GetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, 2 ) + if f89_local2 == "none" and f89_local3 ~= "none" then + Cac.SetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, 0, f89_local3 ) + Cac.SetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, 1, "none" ) + f89_local2 = f89_local3 + f89_local3 = "none" + end + if f89_local3 == "none" and f89_local4 ~= "none" then + Cac.SetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, 1, f89_local4 ) + Cac.SetAttachment( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, 2, "none" ) + f89_local3 = f89_local4 + end + f89_arg0:dispatchEventToRoot( { + name = "refresh_abilities_recap", + controller = f89_arg1.controller, + specialistType = false, + resetSelected = f89_local1 + } ) + elseif f89_local1 == "edit_tactical" then + Cac.SetPerk( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, f89_local0.weaponIndexFocused, "specialty_null" ) + f89_arg0:dispatchEventToRoot( { + name = "refresh_abilities_recap", + controller = f89_arg1.controller, + specialistType = false, + resetSelected = f89_local1 + } ) + elseif f89_local1 == "edit_weapon_primary_camo" then + Cac.SetWeaponCamo( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, 0, "none" ) + elseif f89_local1 == "edit_weapon_primary_reticle" then + if Cac.EquippedAttachmentsHaveReticles( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, 0 ) then + local f89_local2 = Cac.GetAttachmentWithReticles( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, 0 ) + local f89_local3 = f89_local2 and Cac.GetReticleDefault( f89_local2 ) + if f89_local3 then + Cac.SetWeaponReticle( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, 0, f89_local3 ) + end + else + Cac.SetWeaponReticle( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, 0, "none" ) + end + elseif f89_local1 == "edit_killstreaks" then + local f89_local2 = Cac.GetStreakType( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot ) + if f89_local2 == "specialty_null" then + f89_local2 = "streaktype_assault" + end + if f89_local2 == "streaktype_specialist" then + Cac.ResetAbilities( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, "specialistBonusStreaks", true ) + f89_arg0:dispatchEventToRoot( { + name = "refresh_specialist_abilities_recap", + controller = f89_arg1.controller, + specialistType = true, + selected = true + } ) + end + Cac.ResetKillstreak( f89_arg1.controller, f89_local0.squadLocation, f89_local0.squadMemberIndex, f89_local0.classLocation, f89_local0.slot, Cac.GetStreakTypeReference( f89_local2 ) ) + elseif f89_local1 == "edit_abilities" then + Cac.ResetAbilities( f89_arg1.controller, f89_local0.squadLocation, f89_local0.memberIndex, f89_local0.loadoutLocation, f89_local0.loadoutSlot, "abilitiesPicked", false ) + f89_arg0:dispatchEventToRoot( { + name = "refresh_abilities_recap", + controller = f89_arg1.controller, + resetSelected = f89_local1, + selected = true + } ) + end + f89_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f89_arg1.controller, + dispatchChildren = true, + resetSelected = f89_local1 + } ) + local f89_local2 = f0_local6( f89_arg0 ) + f89_local2.name = "update_selection_info" + f89_local2.selection_id = f89_local1 + f89_local2.weaponIndex = f89_local0.weaponIndexFocused + f89_local2.immediate = true + f89_arg0:dispatchEventToRoot( f89_local2 ) + if f89_local0.weaponIndexFocused then + local f89_local3 = f0_local6( f89_arg0 ) + f89_local3.name = "refresh_info_pane" + f89_local3.dispatchChildren = true + f89_local3.weaponIndex = f89_local0.weaponIndexFocused + f89_local3.selection_id = f89_local1 + f89_local3.immediate = true + f89_arg0:dispatchEventToRoot( f89_local3 ) + if f89_local1 ~= "edit_lethal" and f89_local1 ~= "edit_tactical" and f89_local1 ~= "edit_weapon_primary" then + if f89_local0.weaponIndexFocused == Cac.Indices.Weapons.Primary then + f89_arg0:dispatchEventToRoot( { + name = "update_squad_member_window_weapon", + weapon = Cac.BuildPrimaryWeaponName( f89_arg1.controller, f89_local0.squadLocation, f89_local0.squadMemberIndex, f89_local0.classLocation, f89_local0.slot ) + } ) + elseif f89_local0.weaponIndexFocused == Cac.Indices.Weapons.Secondary then + f89_arg0:dispatchEventToRoot( { + name = "update_squad_member_window_stowed_weapon", + weapon = Cac.BuildSecondaryWeaponName( f89_arg1.controller, f89_local0.squadLocation, f89_local0.squadMemberIndex, f89_local0.classLocation, f89_local0.slot ) + } ) + end + end + end + end +end + +local f0_local24 = function ( f90_arg0, f90_arg1 ) + local f90_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f90_arg0 ) + if not f90_local0 or f90_local0.squadLocation ~= "squadMembers" then + return + else + LUI.FlowManager.RequestPopupMenu( f90_arg0, "operations_main_menu", true, f90_arg1.controller, false ) + end +end + +local f0_local25 = function ( f91_arg0, f91_arg1 ) + if not LUI.mp_menus.LoadoutBuilder.IsLoadoutBuilderEnabled() then + return + end + local f91_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f91_arg0 ) + local f91_local1 = {} + if f91_local0 and f91_local0.squadLocation ~= "squadMembers" then + LUI.mp_menus.LoadoutBuilder.RequestBuildLoadout( f91_arg1.controller, "Random", false ) + else + LUI.FlowManager.RequestPopupMenu( f91_arg0, "popup_lb_type", true, f91_arg1.controller, false ) + end +end + +LUI.MenuBuilder.registerType( "cac_recap", function ( menu, controller ) + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = RecapLayout.Y, + left = RecapLayout.XWhenRight, + width = RecapLayout.Width, + height = RecapLayout.Height + } ) + self.properties = controller + if Engine.InFrontend() then + self:registerAnimationState( "left", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = RecapLayout.Y, + left = RecapLayout.XWhenLeft, + width = RecapLayout.Width, + height = RecapLayout.Height + } ) + self:registerEventHandler( "cac_recap_slide_left", MBh.AnimateToState( "left", 125 ) ) + self:registerEventHandler( "cac_recap_slide_right", MBh.AnimateToState( "default", 125 ) ) + self:addEventHandler( "gain_focus", function ( f93_arg0, f93_arg1 ) + self:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_CLEAR" ), + side = "left", + immediate = true, + clickable = true + } ) + local f93_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f93_arg0 ) + local f93_local1 = nil + if f93_local0 and f93_local0.squadLocation == "squadMembers" then + self:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@LUA_MENU_OPERATIONS" ), + side = "left", + immediate = true, + clickable = true + } ) + f93_local1 = "@LUA_MENU_MP_LB_HELPER_TEXT" + else + f93_local1 = "@LUA_MENU_MP_RANDOMIZE_LOADOUT" + end + if LUI.mp_menus.LoadoutBuilder.IsLoadoutBuilderEnabled() then + local f93_local2 = LUI.mp_menus.LoadoutBuilder.IsLoadoutBuilderButtonAnimEnabled() + self:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = Engine.Localize( f93_local1 ), + side = "left", + immediate = true, + clickable = true, + useAnimIntro = f93_local2, + flash = f93_local2 + } ) + end + end ) + local f92_local1 = LUI.UIElement.new() + f92_local1:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -12, + left = -RecapLayout.XWhenRight, + bottom = 0, + right = 0, + alpha = 0 + } ) + f92_local1:animateToState( "default" ) + f92_local1:registerAnimationState( "visible", { + alpha = 1 + } ) + f92_local1:registerEventHandler( "lock_recap", MBh.AnimateToState( "visible" ) ) + f92_local1:registerEventHandler( "unlock_recap", MBh.AnimateToState( "default" ) ) + local f92_local2 = LUI.UIImage.new() + f92_local2:registerAnimationState( "default", CoD.ColorizeState( Cac.Swatches.overlay, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = 0.75 + } ) ) + f92_local2:animateToState( "default" ) + f92_local1:addElement( f92_local2 ) + local f92_local3 = LUI.UIImage.new() + f92_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -11, + width = 32, + material = RegisterMaterial( "box_dropshadow_vert_spacer" ), + alpha = 0.5 + } ) + f92_local3:animateToState( "default" ) + f92_local1:addElement( f92_local3 ) + self:addElement( f92_local1 ) + end + local f92_local1 = LUI.UIVerticalList.new() + f92_local1:makeFocusable() + LUI.UIHorizontalList.SetNoWrap( f92_local1, true ) + f92_local1:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alignment = LUI.Alignment.Middle, + alpha = 1 + } ) + f92_local1:registerAnimationState( "locked", { + alpha = RecapLayout.LockAlpha + } ) + f92_local1:animateToState( "default" ) + f92_local1:registerEventHandler( "lock_recap", MBh.AnimateToState( "locked" ) ) + f92_local1:registerEventHandler( "unlock_recap", MBh.AnimateToState( "default" ) ) + self:addElement( f92_local1 ) + local f92_local2 = f0_local13( Cac.Indices.Weapons.Primary ) + local f92_local3 = f0_local14() + local f92_local4 = f0_local15( false, 0 ) + local f92_local5 = f0_local15( false, 1 ) + local f92_local6 = f0_local15( false, 2 ) + local f92_local7 = f0_local16() + local f92_local8 = f0_local13( Cac.Indices.Weapons.Secondary ) + local f92_local9 = f0_local15( true, 0 ) + local f92_local10 = f0_local15( true, 1 ) + local f92_local11 = f0_local17( Cac.Indices.Grenade.Primary ) + local f92_local12 = f0_local17( Cac.Indices.Grenade.Secondary ) + local f92_local13 = f0_local20() + local f92_local14 = f0_local19() + if Engine.UsingSplitscreenUpscaling() then + f92_local1:addElement( f0_local12( 0, RecapLayout.GridVTall, nil, { + f92_local2, + f92_local4, + f92_local5, + f92_local6 + } ) ) + f92_local1:addElement( f0_local8() ) + f92_local1:addElement( f0_local12( 1, RecapLayout.GridVTall, nil, { + f92_local8, + f92_local9, + f92_local10, + f92_local11 + } ) ) + f92_local1:addElement( f0_local8() ) + f92_local1:addElement( f0_local12( 2, RecapLayout.GridVTall, nil, { + f92_local13, + f92_local12 + } ) ) + else + local f92_local15 = function ( f94_arg0 ) + f92_local2.navigation.up = f92_local14 + f92_local3.navigation.up = f92_local14 + f92_local2.navigation.down = f92_local4 + f92_local3.navigation.down = f92_local7 + end + + local f92_local16 = function ( f95_arg0 ) + f92_local4.navigation.up = f92_local2 + f92_local5.navigation.up = f92_local2 + f92_local6.navigation.up = f92_local2 + f92_local7.navigation.up = f92_local3 + f92_local4.navigation.down = f92_local8 + f92_local5.navigation.down = f92_local8 + f92_local6.navigation.down = f92_local9 + f92_local7.navigation.down = f92_local10 + end + + local f92_local17 = function ( f96_arg0 ) + f92_local8.navigation.up = f92_local4 + f92_local9.navigation.up = f92_local6 + f92_local10.navigation.up = f92_local7 + f92_local8.navigation.down = f92_local11 + f92_local9.navigation.down = f92_local12 + f92_local10.navigation.down = f92_local12 + end + + local f92_local18 = function ( f97_arg0 ) + f92_local11.navigation.up = f92_local8 + f92_local12.navigation.up = f92_local9 + f92_local11.navigation.down = f92_local13 + f92_local12.navigation.down = f92_local13 + end + + local f92_local19 = function ( f98_arg0 ) + f92_local13.navigation.up = f92_local11 + f92_local13.navigation.down = f92_local14 + end + + local f92_local20 = function ( f99_arg0 ) + f92_local14.navigation.up = f92_local13 + f92_local14.navigation.down = f92_local2 + end + + local f92_local21 = nil + if Engine.InFrontend() then + f92_local21 = { + f92_local2, + f92_local3 + } + else + f92_local21 = { + f92_local2 + } + end + f92_local1:addElement( f0_local12( 0, RecapLayout.GridVTall, f92_local15, f92_local21 ) ) + f92_local1:addSpacer( RecapLayout.GridVGutter, 0 ) + f92_local1:addElement( f0_local12( 1, RecapLayout.GridVSlim, f92_local16, { + f92_local4, + f92_local5, + f92_local6, + f92_local7 + } ) ) + f92_local1:addElement( f0_local8() ) + f92_local1:addElement( f0_local12( 2, RecapLayout.GridVTall, f92_local17, { + f92_local8, + f92_local9, + f92_local10 + } ) ) + f92_local1:addElement( f0_local8() ) + f92_local1:addElement( f0_local12( 3, RecapLayout.GridVSlim, f92_local18, { + f92_local11, + f92_local12 + } ) ) + f92_local1:addElement( f0_local8() ) + f92_local1:addElement( f0_local12( 4, RecapLayout.GridVTall, f92_local19, { + f92_local13 + } ) ) + f92_local1:addElement( f0_local8() ) + local f92_local22 = f0_local12( 5, RecapLayout.GridVTall, f92_local20, { + f92_local14 + } ) + self:registerEventHandler( "refresh_specialist_abilities_recap", function ( element, event ) + f92_local22:animateToState( event.specialistType and "expanded" or "default", 100 ) + if not event.dispatchChildren then + f92_local14:processEvent( event ) + return true + else + + end + end ) + f92_local1:addElement( f92_local22 ) + end + f92_local1:registerEventHandler( "refresh_abilities_recap", function ( element, event ) + if not event.dispatchChildren then + f92_local13:processEvent( event ) + return true + else + + end + end ) + f92_local1:registerEventHandler( "cac_set_slot", function ( element, event ) + assert( event.slot ) + local f102_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if not (f102_local0.loadoutSlot == event.slot and (not event.classLocation or f102_local0.loadoutLocation == event.classLocation)) or f102_local0.attachConflict then + if event.classLocation then + f102_local0.loadoutLocation = event.classLocation + end + f102_local0.loadoutSlot = event.slot + f102_local0.attachConflict = false + f0_local21( element ) + end + end ) + local f92_local15 = LUI.UIBindButton.new() + f92_local15.id = "cac_recap_bind_button" + f92_local15:registerEventHandler( "button_alt1", f0_local23 ) + f92_local15:registerEventHandler( "button_alt2", f0_local24 ) + if Engine.InFrontend() then + f92_local15:registerEventHandler( "button_start", f0_local25 ) + end + self:addElement( f92_local15 ) + self:registerEventHandler( "menu_create", f0_local22 ) + if not Engine.InFrontend() then + self:registerEventHandler( "gamepad_button", function () + + end ) + end + return self +end ) +LockTable( _M ) diff --git a/lui/mp_menus/casabilitybutton.dec.lua b/lui/mp_menus/casabilitybutton.dec.lua new file mode 100644 index 0000000..2422846 --- /dev/null +++ b/lui/mp_menus/casabilitybutton.dec.lua @@ -0,0 +1,648 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +menupos_left = 100 +menupos_right = 750 +menupos_top = 100 +menupos_bottom = 308 +wide_amount = 200 +spacer_height = 1 +cap_width = 32 +cap_height = 32 +button_height = 40 +text_height = 26 +function ability_button_template() + return { + type = "UIButton", + focusable = true, + properties = { + button_text_alignment = LUI.Alignment.Center, + button_text = "Button Text ", + action_func = function () + DebugPrint( "Button Action Func: Override me in specific button instances" ) + end + + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = button_height + } + }, + handlers = { + button_action = MBh.Property( "action_func" ) + }, + children = { + { + type = "ability_button" + } + } + } +end + +function ability_button() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 2, + right = menupos_right - 112 + } + }, + children = { + { + type = "UIImage", + id = "button_texture", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 2, + right = menupos_right - 112, + red = 1, + green = 1, + blue = 1, + alpha = 0, + material = RegisterMaterial( "btn_cas_fill_f" ) + }, + dim = { + red = 0.8, + green = 0.8, + blue = 0.8, + alpha = 1 + }, + brite = { + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateLoop( { + { + "dim", + 800 + }, + { + "brite", + 800 + } + } ), + button_up = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 1, + bottom = -1, + left = menupos_right - 152, + right = menupos_right - 100, + material = RegisterMaterial( "btn_cas_end_f" ), + alpha = 0 + }, + over = { + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over", 0 ), + button_up = MBh.AnimateToState( "default", 0 ) + }, + children = {} + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = -18, + left = 2, + right = menupos_right - 102, + material = RegisterMaterial( "white" ), + alpha = 0 + }, + over = { + alpha = 0.15 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over", 0 ), + button_up = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 12, + bottom = -12, + left = menupos_right - 142, + right = menupos_right - 110, + material = RegisterMaterial( "fluff_arrow_outline" ), + alpha = 1 + }, + button_over = { + alpha = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "button_over" ), + button_up = MBh.AnimateToState( "default" ) + } + } + } + } +end + +function ability_horizontal_spacer() + return { + type = "UIImage", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 10, + right = -10, + top = 0, + bottom = spacer_height, + material = RegisterMaterial( "white" ), + red = 0, + green = 0, + blue = 0, + alpha = 0.8 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = 1, + bottom = spacer_height + 1, + material = RegisterMaterial( "white" ), + red = 0.35, + green = 0.35, + blue = 0.35, + alpha = 1 + } + } + } + } + } +end + +function ability_button_design_template_list() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = menupos_left, + right = menupos_right, + top = menupos_top, + bottom = menupos_bottom, + spacing = 0 + } + } + } +end + +function CasAbilityButton() + return { + type = "UIElement", + id = "ability_button_template_main_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 1, + material = RegisterMaterial( "white" ) + } + } + }, + { + type = "UIVerticalList", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = menupos_left, + right = menupos_right, + top = menupos_top, + bottom = menupos_bottom + } + }, + children = { + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 24, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIHorizontalList", + id = "title_box_list", + states = { + default = { + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 200, + top = 0, + bottom = 24 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 32, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 1, + material = RegisterMaterial( "box_titlebar_angle_lt" ) + } + } + }, + { + type = "UIImage", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 492, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 1, + material = RegisterMaterial( "box_titlebar_angle_mid" ) + } + } + }, + { + type = "UIImage", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 64, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 1, + material = RegisterMaterial( "box_titlebar_angle_rt" ) + } + } + } + } + }, + { + type = "UIHorizontalList", + id = "title_text_list", + states = { + default = { + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 10, + right = 200, + top = -2, + bottom = 24, + spacing = 5 + } + }, + children = { + { + type = "UIText", + id = "ability_title_text", + properties = { + text = "ABILITIES" + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 10, + right = 400, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 1, + font = RegisterFont( "fonts/smallfont" ) + } + } + }, + { + type = "UIImage", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 29, + top = 2, + bottom = -2, + red = 1, + green = 1, + blue = 1, + alpha = 1, + material = RegisterMaterial( "box_number" ) + } + }, + children = { + { + type = "UIText", + id = "slot_unlock_text", + properties = { + text = "0" + }, + states = { + default = { + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = -1, + bottom = -1, + red = 1, + green = 0.29, + blue = 0.24, + alpha = 1, + font = RegisterFont( "fonts/smallfont" ) + } + } + } + } + }, + { + type = "UIText", + id = "slot_unlock_title", + properties = { + text = "Slot Unlocks" + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 42, + top = 3, + bottom = -3, + red = 1, + green = 1, + blue = 1, + alpha = 1, + font = RegisterFont( "fonts/smallfont" ) + } + } + } + } + } + } + }, + { + type = "UIImage", + id = "list_backround_texure", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 0.3, + green = 0.3, + blue = 0.3, + alpha = 1, + material = RegisterMaterial( "white" ) + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + rightAnchor = true, + leftAnchor = true, + bottomAnchor = true, + top = 2, + bottom = -2, + left = 2, + right = -2, + material = RegisterMaterial( "box_gradient_fill" ) + } + } + }, + { + type = "UIImage", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = -9, + right = 16, + top = -9, + bottom = 16, + red = 1, + green = 1, + blue = 1, + alpha = 1, + material = RegisterMaterial( "box_ability_shadow" ) + } + } + } + } + } + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 25, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "ability_button_design_template_list", + id = "button_list_id", + children = { + { + type = "ability_button_template", + id = "button_0" + }, + { + type = "ability_horizontal_spacer", + id = "spacer_0" + }, + { + type = "ability_button_template", + id = "button_1" + }, + { + type = "ability_horizontal_spacer", + id = "spacer_1" + }, + { + type = "ability_button_template", + id = "button_2" + }, + { + type = "ability_horizontal_spacer", + id = "spacer_3" + }, + { + type = "ability_button_template", + id = "button_3" + }, + { + type = "ability_horizontal_spacer", + id = "spacer_4" + }, + { + type = "ability_button_template", + id = "button_4" + } + } + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "ability_button_template", ability_button_template ) +LUI.MenuBuilder.registerDef( "ability_button", ability_button ) +LUI.MenuBuilder.registerDef( "ability_horizontal_spacer", ability_horizontal_spacer ) +LUI.MenuBuilder.registerDef( "ability_button_design_template_list", ability_button_design_template_list ) +LUI.MenuBuilder.registerDef( "CasAbilityButton", CasAbilityButton ) +LockTable( _M ) diff --git a/lui/mp_menus/choosecodanywhereplatform.dec.lua b/lui/mp_menus/choosecodanywhereplatform.dec.lua new file mode 100644 index 0000000..4ba8cc0 --- /dev/null +++ b/lui/mp_menus/choosecodanywhereplatform.dec.lua @@ -0,0 +1,618 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function popup_choose_platform_intro_create( f1_arg0, f1_arg1 ) + local f1_local0 = nil + if CoDAnywhere.HasUCDSaveGame( f1_arg1.controller ) then + f1_local0 = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_PLATFORM_CHOOSE_INTRO_UCD" ) + else + f1_local0 = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_PLATFORM_CHOOSE_INTRO_NO_UCD" ) + end + f1_arg0:dispatchEventToChildren( { + name = "update_message", + message_text = f1_local0 + } ) +end + +function popup_choose_platform_intro() + return { + type = "generic_confirmation_popup", + id = "popup_choose_platform_intro_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" ), + message_text = "", + confirmation_action = MBh.LeaveMenu() + }, + handlers = { + menu_create = popup_choose_platform_intro_create + } + } +end + +function popup_choose_platform_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_choose_platform_are_you_sure", + properties = { + platformIndex = -1, + popup_title = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" ), + message_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_USE_PLATFORM_FOR_GLOBAL" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f4_arg0, f4_arg1 ) + CoDAnywhere.StartContextSwitch( f4_arg1.controller, f4_arg0.properties.callback_params.platformIndex ) + end + + } + } +end + +function ChoosePlatform( f5_arg0, f5_arg1 ) + LUI.FlowManager.RequestPopupMenu( f5_arg0, "popup_choose_platform_are_you_sure", true, f5_arg1.controller, false, { + callback_params = { + platformIndex = f5_arg0.properties.index + } + } ) +end + +function CoDAnywherePlatformFeeder( f6_arg0 ) + local f6_local0 = {} + local f6_local1 = CoDAnywhere.NumFoundNonUCDPlatforms( f6_arg0.exclusiveController ) - 1 + if f6_local1 == -1 then + return f6_local0 + end + for f6_local2 = 0, f6_local1, 1 do + f6_local0[#f6_local0 + 1] = { + type = "UIGenericButton", + id = "cod_anywhere_platform_button_" .. f6_local2, + disabled = CoDAnywhere.IsUCDAccount( f6_local2 ), + listDefaultFocus = f6_local2 == 0, + properties = { + index = f6_local2, + button_text = CoDAnywhere.GetPlatformDescriptionString( f6_arg0.exclusiveController, f6_local2, CoD.CoDAnywhere.COD_ANYWHERE_PLATFORM_TEXT_TYPE_PLATFORM_NAME ), + button_action_func = ChoosePlatform, + button_over_disable_func = MBh.EmitEventToRoot( { + name = "update_desc", + platform_index = f6_local2 + } ), + button_over_func = MBh.EmitEventToRoot( { + name = "update_desc", + platform_index = f6_local2 + } ) + } + } + end + return f6_local0 +end + +function choose_cod_anywhere_platform_vlist() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + } + } +end + +function UpdatePlatformLastPlayed( f8_arg0, f8_arg1 ) + if f8_arg1.platform_index == nil then + return + end + local f8_local0 = f8_arg0:getParent() + local f8_local1 = f8_local0:getChildById( "platform_last_played" ) + if f8_local1 then + f8_local1:setText( CoDAnywhere.GetPlatformDescriptionString( f8_local0.properties.exclusiveController, f8_arg1.platform_index, CoD.CoDAnywhere.COD_ANYWHERE_PLATFORM_TEXT_TYPE_LAST_PLAYED ) ) + end +end + +function UpdatePlatformTimePlayed( f9_arg0, f9_arg1 ) + if f9_arg1.platform_index == nil then + return + end + local f9_local0 = f9_arg0:getParent() + local f9_local1 = f9_local0:getChildById( "platform_time_played" ) + if f9_local1 then + f9_local1:setText( CoDAnywhere.GetPlatformDescriptionString( f9_local0.properties.exclusiveController, f9_arg1.platform_index, CoD.CoDAnywhere.COD_ANYWHERE_PLATFORM_TEXT_TYPE_TIME_PLAYED ) ) + end +end + +function UpdatePlatformSquadMember( f10_arg0, f10_arg1, f10_arg2 ) + if f10_arg1.platform_index == nil then + return + end + local f10_local0 = f10_arg0:getParent() + local f10_local1 = f10_local0:getChildById( "platform_squad_member" .. tostring( f10_arg2 ) ) + local f10_local2 = "" + if f10_local1 then + f10_local1:setText( Engine.Localize( "@LUA_MENU_CODA_PROFILE_SQUAD_MEMBER" ) .. " " .. f10_arg2 .. ": " .. CoDAnywhere.GetPlatformDescriptionString( f10_local0.properties.exclusiveController, f10_arg1.platform_index, f10_arg2 + 1 ) ) + end +end + +function UpdatePlatformSquadMemberRank( f11_arg0, f11_arg1, f11_arg2 ) + if f11_arg1.platform_index == nil then + return + end + local f11_local0 = f11_arg0:getParent() + local f11_local1 = f11_arg0:getChildById( "platform_squad_member_rank" .. tostring( f11_arg2 ) ) + local f11_local2 = "1" + if f11_local1 then + f11_local1:setText( CoDAnywhere.GetPlatformDescriptionString( f11_local0.properties.exclusiveController, f11_arg1.platform_index, f11_arg2 + 11 ) ) + end +end + +function UpdatePlatformTokensEarned( f12_arg0, f12_arg1 ) + if f12_arg1.platform_index == nil then + return + end + local f12_local0 = f12_arg0:getParent() + local f12_local1 = f12_local0:getChildById( "platform_points_avail" ) + if f12_local1 then + f12_local1:setText( CoDAnywhere.GetPlatformDescriptionString( f12_local0.properties.exclusiveController, f12_arg1.platform_index, CoD.CoDAnywhere .. COD_ANYWHERE_PLATFORM_TEXT_TYPE_TOKENS_AVAILABLE ) ) + end +end + +function LeaveChooseCoDAnywherePlatformMenu( f13_arg0, f13_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f13_arg0 ) +end + +function OpenIntroPopup( f14_arg0, f14_arg1 ) + LUI.FlowManager.RequestPopupMenu( f14_arg0, "popup_choose_platform_intro", true, f14_arg1.controller ) +end + +function CoDAnywhereMenuCreate( f15_arg0, f15_arg1 ) + f15_arg0:dispatchEventToRoot( { + name = "open_intro", + controller = f15_arg1.controller + } ) +end + +function OpenCoDAnywhereErrorPopup( f16_arg0, f16_arg1 ) + LUI.FlowManager.RequestPopupMenu( f16_arg0, "cod_anywhere_error_popup_menu", true, f16_arg1.controller ) +end + +function OpenCoDAnywhereSuccessPopup( f17_arg0, f17_arg1 ) + LUI.FlowManager.RequestPopupMenu( f17_arg0, "cod_anywhere_success_popup_menu", true, f17_arg1.controller ) +end + +function SquadMemberBoxFactory( f18_arg0 ) + return { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 1, + right = -1, + top = 114 + f18_arg0 * 32, + bottom = 144 + f18_arg0 * 32, + alpha = 0.1, + material = RegisterMaterial( "white" ) + } + } + } +end + +function SquadMemberFactory( f19_arg0, f19_arg1 ) + return { + type = "UIText", + id = "platform_squad_member" .. tostring( f19_arg0 ), + states = { + default = { + left = -65, + top = -106 + f19_arg0 * 32, + width = 450, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1, + red = Colors.generic_button_text_default_color.r, + green = Colors.generic_button_text_default_color.g, + blue = Colors.generic_button_text_default_color.b + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_SQUAD_MEMBER" ) .. " " .. f19_arg0 .. ": " + }, + handlers = { + update_desc = function ( f20_arg0, f20_arg1 ) + UpdatePlatformSquadMember( f20_arg0, f20_arg1, f19_arg0 ) + UpdatePlatformSquadMemberRank( f20_arg0, f20_arg1, f19_arg0 ) + end + + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + material = RegisterMaterial( Rank.GetRankIcon( 22, 0 ) ), + left = -10, + right = 10, + alpha = 1 + } + } + }, + { + type = "UIText", + id = "platform_squad_member_rank" .. tostring( f19_arg0 ), + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + right = 40, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + alpha = 1 + } + }, + properties = { + text = "" + } + } + } + } +end + +function choose_cod_anywhere_platform() + local f21_local0 = { + type = "UIElement", + id = "choose_cod_anywhere_platform", + handlers = { + menu_create = CoDAnywhereMenuCreate, + open_intro = OpenIntroPopup, + open_cod_anywhere_error_popup = OpenCoDAnywhereErrorPopup, + open_cod_anywhere_success_popup = OpenCoDAnywhereSuccessPopup, + leave_platform_screen = LeaveChooseCoDAnywherePlatformMenu + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + } + local f21_local1 = {} + local f21_local2 = { + type = "generic_menu_title", + id = "cod_anywhere_title_text_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" ) + } + } + local f21_local3 = { + type = "generic_menu_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 135, + bottom = -120, + left = 550, + right = -200 + } + } + } + local f21_local4 = {} + local f21_local5 = { + type = "generic_menu_titlebar", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -30, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIText", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 25, + top = 5, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1 + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_TITLE" ) + } + } + } + } + local f21_local6 = { + type = "UIText", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 25, + right = 140, + top = 10, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1, + red = Colors.generic_button_text_default_color.r, + green = Colors.generic_button_text_default_color.g, + blue = Colors.generic_button_text_default_color.b + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_LAST_PLAY" ) + }, + children = { + { + type = "UIText", + id = "platform_last_played", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + left = 0, + right = 200, + top = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1 + } + }, + properties = { + text = "" + }, + handlers = { + update_desc = UpdatePlatformLastPlayed + } + } + } + } + local f21_local7 = { + type = "UIText", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 25, + right = 145, + top = 43, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1, + red = Colors.generic_button_text_default_color.r, + green = Colors.generic_button_text_default_color.g, + blue = Colors.generic_button_text_default_color.b + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_TIME_PLAY" ) + }, + children = { + { + type = "UIText", + id = "platform_time_played", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + left = 0, + right = 200, + top = 0, + alpha = 1 + } + }, + properties = { + text = "" + }, + handlers = { + update_desc = UpdatePlatformTimePlayed + } + } + } + } + local f21_local8 = { + type = "UIText", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 25, + right = 225, + top = 75, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1, + red = Colors.generic_button_text_default_color.r, + green = Colors.generic_button_text_default_color.g, + blue = Colors.generic_button_text_default_color.b + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_SQUAD_POINTS" ) + }, + children = { + { + type = "UIText", + id = "platform_points_avail", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + left = 15, + right = 200, + top = 0, + alpha = 1 + } + }, + properties = { + text = "" + }, + handlers = { + update_desc = UpdatePlatformTokensEarned + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + material = RegisterMaterial( "icon_unlock_token_32" ), + left = -10, + right = 10, + alpha = 1 + } + } + } + } + } + local f21_local9 = { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 1, + right = -1, + top = 112, + bottom = 142, + alpha = 0.2, + material = RegisterMaterial( "white" ) + } + } + } + local f21_local10 = { + type = "UIText", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 25, + top = 117, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1 + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_PROFILE_SQUAD_NAME" ) + } + } + local f21_local11 = SquadMemberBoxFactory( 2 ) + local f21_local12 = SquadMemberBoxFactory( 4 ) + local f21_local13 = SquadMemberBoxFactory( 6 ) + local f21_local14 = SquadMemberBoxFactory( 8 ) + local f21_local15 = SquadMemberBoxFactory( 10 ) + f21_local3.children = f21_local5 + f21_local4 = SquadMemberFactory( 1 ) + f21_local5 = SquadMemberFactory( 2 ) + f21_local6 = SquadMemberFactory( 3 ) + f21_local7 = SquadMemberFactory( 4 ) + f21_local8 = SquadMemberFactory( 5 ) + f21_local9 = SquadMemberFactory( 6 ) + f21_local10 = SquadMemberFactory( 7 ) + f21_local11 = SquadMemberFactory( 8 ) + f21_local12 = SquadMemberFactory( 9 ) + f21_local13 = SquadMemberFactory( 10 ) + f21_local14 = { + type = "choose_cod_anywhere_platform_vlist", + id = "choose_cod_anywhere_platform_vlist_id", + childrenFeeder = CoDAnywherePlatformFeeder + } + f21_local15 = { + type = "button_helper_text_main", + id = "barracks_button_helper_text_id" + } + local f21_local16 = { + type = "UIBindButton", + id = "squad_results_back_id", + handlers = { + button_secondary = LeaveChooseCoDAnywherePlatformMenu + } + } + f21_local1[1] = f21_local2 + f21_local1[2] = f21_local3 + f21_local1[3] = f21_local4 + f21_local1[4] = f21_local5 + f21_local1[5] = f21_local6 + f21_local1[6] = f21_local7 + f21_local1[7] = f21_local8 + f21_local1[8] = f21_local9 + f21_local1[9] = f21_local10 + f21_local1[10] = f21_local11 + f21_local1[11] = f21_local12 + f21_local1[12] = f21_local13 + f21_local1[13] = f21_local14 + f21_local1[14] = f21_local15 + f21_local1[15] = f21_local16 + f21_local0.children = f21_local1 + return f21_local0 +end + +LUI.MenuBuilder.registerDef( "choose_cod_anywhere_platform", choose_cod_anywhere_platform ) +LUI.MenuBuilder.registerDef( "choose_cod_anywhere_platform_vlist", choose_cod_anywhere_platform_vlist ) +LUI.MenuBuilder.registerDef( "popup_choose_platform_are_you_sure", popup_choose_platform_are_you_sure ) +LUI.MenuBuilder.registerDef( "popup_choose_platform_intro", popup_choose_platform_intro ) +LockTable( _M ) diff --git a/lui/mp_menus/clandetails.dec.lua b/lui/mp_menus/clandetails.dec.lua new file mode 100644 index 0000000..b8f61ba --- /dev/null +++ b/lui/mp_menus/clandetails.dec.lua @@ -0,0 +1,1348 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +HighlightType = { + MostHours = 0, + MVP = 1, + LatestRecruit = 2 +} +DownloadState = { + ClanInformation = 0, + PlayercardCache = 1, + Done = 2 +} +function OnCreate( f1_arg0, f1_arg1 ) + local f1_local0 = f1_arg1.controller + local f1_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + f1_local1.clanWindow = f1_arg0:getFirstDescendentById( "clan_member_models_id" ) + f1_local1.controller = f1_local0 + f1_local1.remoteView = f1_arg0.properties.remoteView + f1_local1.downloadState = DownloadState.ClanInformation + f1_arg0:processEvent( { + name = "hide_playercard" + } ) + f1_arg0:processEvent( { + name = "update_header_text", + string = Engine.Localize( "@CLANS_CLAN_PAGE_CAPS", Engine.MarkLocalized( f1_local1.remoteView and f1_arg0.properties.remotePlayerName or Engine.GetUsernameByController( f1_local0 ) ) ), + dispatchChildren = true + } ) +end + +function UpdateClanDetails( f2_arg0, f2_arg1 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) + local f2_local1 = f2_local0.controller + UpdateClanCard( f2_arg0, f2_arg1 ) + local f2_local2 = nil + if f2_local0.remoteView then + f2_local2 = Clan.GetRemoteClanWarInfo() + else + f2_local2 = { + position = Clan.GetWarPosition( f2_local1 ), + points = Clan.GetClanPoints( f2_local1 ), + nodes = Clan.GetHeldNodeCount( f2_local1 ), + division = Clan.GetClanDivision( f2_local1 ) + } + end + f2_local2.name = "update_clan_war_info" + f2_local2.dispatchChildren = true + f2_arg0:processEvent( f2_local2 ) + f2_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + if not f2_local0.remoteView then + f2_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@CLANS_ROSTER" ), + side = "right", + clickable = true, + width = 190, + priority = -1000 + } ) + end + if f2_local0.remoteView then + Clan.DownloadRemoteClanPlayercardCache( f2_local1 ) + else + Clan.DownloadClanPlayercardCache( f2_local1 ) + end +end + +function CheckDownloadStatus( f3_arg0, f3_arg1 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + if f3_local0.downloadState == DownloadState.ClanInformation then + local f3_local1 = false + if f3_local0.remoteView then + f3_local1 = not Clan.IsDownloadingRemoteData( f3_local0.controller ) + else + f3_local1 = not Clan.IsDownloadingData( f3_local0.controller ) + end + if f3_local1 then + local f3_local2 = f3_arg0:getFirstDescendentById( "clan_details_full_load_id" ) + if f3_local2 then + f3_local2:close() + end + UpdateClanDetails( f3_arg0, f3_arg1 ) + f3_arg0:processEvent( { + name = "show_clan_details" + } ) + f3_local0.downloadState = DownloadState.PlayercardCache + end + elseif f3_local0.downloadState == DownloadState.PlayercardCache then + if RefreshCacheInfo( f3_arg0, f3_arg1 ) then + f3_local0.downloadState = DownloadState.Done + end + else + local f3_local1 = f3_arg0:getFirstDescendentById( "download_update_timer_id" ) + f3_local1:close() + end +end + +function UpdateClanCard( f4_arg0, f4_arg1 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + local f4_local1 = f4_arg1.controller + if not f4_local1 then + f4_local1 = f4_arg0.properties.exclusiveController + end + local f4_local2 = { + name = "update_clan_card" + } + local f4_local3 = 0 + if f4_local0.remoteView then + local f4_local4 = Clan.GetRemoteClanCardData() + f4_local2.clan_name = f4_local4.name + f4_local2.clan_tag = f4_local4.tag + f4_local2.clan_level = f4_local4.level + f4_local2.current_xp = f4_local4.xp + f4_local2.xp_to_next = f4_local4.xpToNext + f4_local2.next_level_progress = f4_local4.nextLevelProgress + f4_local2.clan_motto = f4_local4.motto + f4_local2.kd_ratio = f4_local4.kdRatio + f4_local2.win_percent = f4_local4.winPercent + f4_local2.member_count = f4_local4.memberCount + f4_local2.reward_count = f4_local4.rewardCount + f4_local3 = f4_local4.background + else + f4_local2.clan_name = Clan.GetName( f4_local1 ) + f4_local2.clan_tag = Engine.GetClanTag( f4_local1 ) + f4_local2.clan_level = Clan.GetLevel( f4_local1 ) + f4_local2.current_xp = Clan.GetCurrentXP( f4_local1 ) + f4_local2.xp_to_next = Clan.GetXPToNext( f4_local1 ) + f4_local2.next_level_progress = Clan.GetNextLevelProgress( f4_local1 ) + f4_local2.clan_motto = Clan.GetMotto( f4_local1 ) + f4_local2.cxp_time = Clan.GetDCXPTime( f4_local1 ) + f4_local2.kd_ratio = Clan.GetKDRatio( f4_local1 ) + f4_local2.win_percent = Clan.GetWinPercent( f4_local1 ) + f4_local2.member_count = Clan.GetMemberCount( f4_local1 ) + f4_local2.reward_count = Clan.GetRewardCount( f4_local1 ) + f4_local3 = Clan.GetBackground( f4_local1 ) + end + local f4_local4 = Engine.TableLookup( "mp/cac/clanbackgrounds.csv", 0, f4_local3, 1 ) + if not f4_local4 or f4_local4 == "" then + f4_local4 = "clan_page_bkground_001" + end + f4_local2.clan_background = f4_local4 + if f4_local2.clan_tag == "" or f4_local2.clan_tag == nil then + f4_local2.clan_tag = Engine.Localize( "@CLANS_NO_CLAN_TAG" ) + end + if f4_local2.clan_motto == "" or f4_local2.clan_motto == nil then + f4_local2.clan_motto = Engine.Localize( "@CLANS_NO_CLAN_MOTTO" ) + end + f4_arg0:processEvent( f4_local2 ) +end + +function UpdateLeaderCard( f5_arg0, f5_arg1 ) + local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 ) + local f5_local1 = f5_local0.remoteView and Clan.GetRemoteLeaderPlayercard( f5_arg1 ) or Clan.GetLeaderPlayercard( f5_arg1 ) + local f5_local2 = { + name = "update_playercard" + } + if f5_local1.hasPlatformInfo then + f5_local2.hasPlatformInfo = true + f5_local2.gamertag = f5_local1.gamertag + f5_local2.clantag = f5_local1.clantag + f5_local2.rank = f5_local1.rank + f5_local2.prestige = f5_local1.prestige + f5_local2.background = f5_local1.background + f5_local2.patchEmblem = f5_local1.patchEmblem + f5_local2.patchShape = "0" + else + local f5_local3 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 ) + f5_local3.hasClassifiedInfo = true + f5_local2.gamertag = Engine.Localize( "@CLANS_NON_PLATFORM_NAME" ) + f5_local2.clantag = "" + end + f5_arg0:processEvent( f5_local2 ) + f5_arg0:processEvent( { + name = "show_playercard" + } ) +end + +function UpdateMemberHighlights( f6_arg0, f6_arg1 ) + local f6_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f6_arg0 ) + local f6_local1 = f6_local0.remoteView and Clan.GetRemoteHighlightCacheInfo( f6_arg1, HighlightType.MostHours ) or Clan.GetHighlightCacheInfo( f6_arg1, HighlightType.MostHours ) + local f6_local2 = f6_local0.remoteView and Clan.GetRemoteHighlightCacheInfo( f6_arg1, HighlightType.MVP ) or Clan.GetHighlightCacheInfo( f6_arg1, HighlightType.MVP ) + local f6_local3 = f6_local0.remoteView and Clan.GetRemoteHighlightCacheInfo( f6_arg1, HighlightType.LatestRecruit ) or Clan.GetHighlightCacheInfo( f6_arg1, HighlightType.LatestRecruit ) + local f6_local4 = f6_local0.hasClassifiedInfo + if not f6_local4 then + if f6_local1.hasPlatformInfo and f6_local2.hasPlatformInfo then + f6_local4 = not f6_local3.hasPlatformInfo + else + f6_local4 = true + end + end + f6_local0.hasClassifiedInfo = f6_local4 + f6_local0.clanWindow.modelData = { + f6_local1, + f6_local2, + f6_local3 + } + f6_local4 = Engine.Localize( "@CLANS_NON_PLATFORM_NAME" ) + f6_arg0:processEvent( { + name = "update_member_highlights", + controller = f6_arg1, + dispatchChildren = true, + most_hours = f6_local1.gamertag or f6_local4, + mvp_name = f6_local2.gamertag or f6_local4, + latest_name = f6_local3.gamertag or f6_local4 + } ) +end + +function RefreshCacheInfo( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + if not (not f7_local0.remoteView or not Clan.IsDownloadingRemoteClanPlayercards( f7_local0.controller )) or Clan.IsDownloadingClanPlayercards( f7_local0.controller ) then + return false + end + local f7_local1 = f7_arg0:getFirstDescendentById( "leader_loading_widget_id" ) + f7_local1:close() + UpdateLeaderCard( f7_arg0, f7_local0.controller ) + UpdateMemberHighlights( f7_arg0, f7_local0.controller ) + if f7_local0.hasClassifiedInfo then + f7_arg0:processEvent( { + name = "show_classified_note" + } ) + end + return true +end + +function OpenClanRoster( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + if not f8_local0.remoteView and Engine.IsNetworkConnected() and Engine.IsUserSignedInToLive( f8_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f8_arg0, "popup_friends", true, f8_arg1.controller, false, { + isClanRoster = true + } ) + end +end + +function GetDivisionImage( f9_arg0 ) + local f9_local0 = "" + if f9_arg0 == 1 then + f9_local0 = "icon_clan_level_diamond" + elseif f9_arg0 == 2 then + f9_local0 = "icon_clan_level_platinum" + elseif f9_arg0 == 3 then + f9_local0 = "icon_clan_level_gold" + elseif f9_arg0 == 4 then + f9_local0 = "icon_clan_level_silver" + elseif f9_arg0 == 5 then + f9_local0 = "icon_clan_level_bronze" + end + return f9_local0 +end + +function BonusFeeder( f10_arg0 ) + local f10_local0 = {} + local f10_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "clan_details_main" ) + local f10_local2 = f10_arg0.exclusiveController + local f10_local3 = math.min( 3, f10_local1.remoteView and Clan.GetRemoteClanBonusCount() or Clan.GetBonusCount( f10_local2 ) ) + local f10_local4, f10_local5 = nil + for f10_local6 = 0, f10_local3 - 1, 1 do + if f10_local1.remoteView then + f10_local4, f10_local5 = Clan.GetRemoteClanBonusByIndex( f10_local6 ) + else + f10_local4 = Clan.GetBonusValueByIndex( f10_local2, f10_local6 ) + f10_local5 = Clan.GetBonusTypeByIndex( f10_local2, f10_local6 ) + end + f10_local0[#f10_local0 + 1] = { + type = "clanwars_bonus_widget", + id = "bonus_widget" .. f10_local6, + properties = { + value = tostring( f10_local4 ), + gametype = f10_local5 + } + } + end + if #f10_local0 < 1 then + f10_local0[#f10_local0 + 1] = { + type = "UIText", + id = "no_bonus_text_id", + properties = { + text = Engine.Localize( "@CLANS_NO_BONUSES" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -CoD.TextSettings.NormalFont.Height * 0.5, + height = CoD.TextSettings.NormalFont.Height, + left = 0, + right = 0, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } + } + } + end + return f10_local0 +end + +function clan_details_member_highlight() + return { + type = "UIElement", + properties = { + charHandle = "default_handle", + highlight_text = "", + uv_values = { + 0, + 0, + 0.33, + 1 + }, + character_pos = CharacterCameraPresets.ClanDetails.Position + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + height = 420, + left = 0, + width = 215 + } + }, + children = { + { + type = "generic_menu_background_withfade", + properties = { + top_offset = GenericTitleBarDims.TitleBarHeight - 1, + fill_alpha = 1 + } + }, + { + type = "UIText", + id = "clan_member_highlight_name_id", + properties = { + text = "" + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericTitleBarDims.TitleBarHeight + 197, + height = CoD.TextSettings.NormalFont.Height, + left = -185, + width = 400, + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + alpha = 0.5, + zRot = 90 + } ) + }, + handlers = { + update_member_name = function ( f12_arg0, f12_arg1 ) + f12_arg0:setText( f12_arg1.member_name or "" ) + end + + } + }, + { + type = "UIElement", + id = "clan_member_highlight_award_bg_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + height = GenericTitleBarDims.TitleBarHeight, + left = 0, + right = 0 + } + }, + children = { + { + type = "generic_menu_background", + properties = { + top_offset = 0, + fill_alpha = 1, + hide_bottom = true + } + }, + { + type = "UIText", + id = "clan_member_highlight_award_text_id", + properties = { + text = MBh.Property( "highlight_text" ) + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + align = LUI.Alignment.Center + } ) + } + } + } + } + } + } +end + +function clan_details_member_highlight_window() + return { + type = "UIElement", + id = "clan_details_member_highlight_window_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 100, + height = 420, + left = 550, + width = 600 + } + }, + children = { + { + type = "UIHorizontalList", + id = "clan_details_member_highlights_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 0, + spacing = 10 + } + }, + children = { + { + type = "clan_details_member_highlight", + id = "clan_details_member_highlight_0", + properties = { + charHandle = "member_highlight_char_window_0", + highlight_text = Engine.Localize( "@CLANS_MOST_HOURS_PLAYED" ), + uv_values = { + 0, + 0, + 0.33, + 1 + }, + character_pos = CharacterCameraPresets.ClanDetails.Left.Position + }, + handlers = { + update_member_highlights = function ( f14_arg0, f14_arg1 ) + f14_arg0:processEvent( { + name = "update_member_name", + member_name = f14_arg1.most_hours + } ) + end + + } + }, + { + type = "clan_details_member_highlight", + id = "clan_details_member_highlight_1", + properties = { + charHandle = "member_highlight_char_window_1", + highlight_text = Engine.Localize( "@CLANS_MVP" ), + uv_values = { + 0.33, + 0, + 0.66, + 1 + }, + character_pos = CharacterCameraPresets.ClanDetails.Center.Position + }, + handlers = { + update_member_highlights = function ( f15_arg0, f15_arg1 ) + f15_arg0:processEvent( { + name = "update_member_name", + member_name = f15_arg1.mvp_name + } ) + end + + } + }, + { + type = "clan_details_member_highlight", + id = "clan_details_member_highlight_2", + properties = { + charHandle = "member_highlight_char_window_2", + highlight_text = Engine.Localize( "@CLANS_LATEST_RECRUIT" ), + uv_values = { + 0.66, + 0, + 1, + 1 + }, + character_pos = CharacterCameraPresets.ClanDetails.Right.Position + }, + handlers = { + update_member_highlights = function ( f16_arg0, f16_arg1 ) + f16_arg0:processEvent( { + name = "update_member_name", + member_name = f16_arg1.latest_name + } ) + end + + } + } + } + } + } + } +end + +function clanwars_bonus_widget() + return { + type = "UIElement", + id = "clanwars_bonus_widget_container_id", + properties = { + value = 0, + gametype = "" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 40, + left = 0, + right = 135 + } + }, + children = { + { + type = "UIElement", + id = "clanwars_bonus_widget_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 40, + left = 0, + right = 40 + } + }, + children = { + { + type = "UIImage", + id = "clanwars_bonus_widget_bg_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = 0.1 + } + } + }, + { + type = "UIText", + id = "clanwars_bonus_widget_bonus_id", + properties = { + text = MBh.Property( "value" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + height = CoD.TextSettings.NormalFont.Height, + left = 0, + right = 0, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + font = CoD.TextSettings.SmallFont.Font + } + } + } + } + }, + { + type = "UIMarqueeText", + id = "clanwars_bonus_widget_mode_id", + properties = { + text = MBh.Property( "gametype" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + height = CoD.TextSettings.SmallFont.Height, + left = 45, + right = 0, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + font = CoD.TextSettings.SmallFont.Font + } + } + } + } + } +end + +function clanwars_position_info_widget() + return { + type = "UIElement", + id = "clanwars_info_position_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 240 + } + }, + children = { + { + type = "generic_drop_shadow", + id = "clanwars_info_position_drop_shadow_id", + properties = { + offset_shadow = 0, + alpha = 0.4 + } + }, + { + type = "generic_menu_background", + id = "clanwars_info_position_background_id", + properties = { + fill_alpha = 1 + } + }, + { + type = "UIElement", + id = "clanwars_info_position_label_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = GenericTitleBarDims.TitleBarHeight, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "clanwars_info_position_label_bg_id", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.GenericMenu.BorderAlpha + } ) + } + }, + { + type = "UIImage", + id = "clanwars_info_position_division_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -24, + bottom = 24, + left = 0, + right = 48, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_clan_war_info = function ( f19_arg0, f19_arg1 ) + local f19_local0 = GetDivisionImage( f19_arg1.division ) + if f19_local0 and f19_local0 ~= "" then + f19_arg0:setImage( RegisterMaterial( f19_local0 ) ) + f19_arg0:animateToState( "default", 0 ) + else + f19_arg0:animateToState( "hidden", 0 ) + end + end + + } + }, + { + type = "UIMarqueeText", + id = "clanwars_info_position_label_id", + properties = { + text = Engine.Localize( "@CLANS_CURRENT_WAR_POSITION" ) + }, + handlers = { + update_clan_war_info = function ( f20_arg0, f20_arg1 ) + local f20_local0 = GetDivisionImage( f20_arg1.division ) + local f20_local1 = f20_local0 and f20_local0 ~= "" + local f20_local2 = f20_arg0 + local f20_local3 = f20_arg0.registerAnimationState + local f20_local4 = "default" + local f20_local5 = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = CoD.TextSettings.NormalFont.Height * -0.5, + bottom = CoD.TextSettings.NormalFont.Height * 0.5 + } + local f20_local6 + if f20_local1 then + f20_local6 = 50 + if not f20_local6 then + + else + f20_local5.left = f20_local6 + f20_local5.right = 0 + if f20_local1 then + f20_local6 = LUI.Alignment.Left + if not f20_local6 then + + else + f20_local5.alignment = f20_local6 + f20_local5.font = CoD.TextSettings.NormalFont.Font + f20_local3( f20_local2, f20_local4, f20_local5 ) + f20_arg0:animateToState( "default", 0 ) + end + end + f20_local6 = LUI.Alignment.Center + end + end + f20_local6 = 0 + end + + } + } + } + }, + { + type = "UIElement", + id = "clanwars_info_position_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 40, + height = 40, + left = 5, + width = 40 + } + }, + children = { + { + type = "UIImage", + id = "clanwars_info_position_bg_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -12, + bottom = 12, + left = -12, + right = 12, + material = RegisterMaterial( "box_clan_hexagon" ), + alpha = 0.1 + } + } + }, + { + type = "UIText", + id = "clanwars_info_position_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + height = CoD.TextSettings.NormalFont.Height, + left = 0, + right = 0, + alignment = LUI.Alignment.Center, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + font = CoD.TextSettings.NormalFont.Font + } + }, + handlers = { + update_clan_war_info = function ( f21_arg0, f21_arg1 ) + f21_arg0:setText( f21_arg1.position ) + end + + } + } + } + }, + { + type = "UIText", + id = "clanwars_info_total_cp_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 40, + left = 50, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + font = CoD.TextSettings.NormalFont.Font + } + }, + handlers = { + update_clan_war_info = function ( f22_arg0, f22_arg1 ) + f22_arg0:setText( Engine.Localize( "@CLANS_TOTAL_CP", f22_arg1.points ) ) + end + + } + }, + { + type = "UIText", + id = "clanwars_info_total_nodes_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 60, + left = 50, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + font = CoD.TextSettings.NormalFont.Font + } + }, + handlers = { + update_clan_war_info = function ( f23_arg0, f23_arg1 ) + f23_arg0:setText( Engine.Localize( "@CLANS_TOTAL_NODES_HELD", f23_arg1.nodes ) ) + end + + } + } + } + } +end + +function clanwars_bonuses_info_widget() + return { + type = "UIElement", + id = "clanwars_info_bonuses_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -420, + right = 0 + } + }, + children = { + { + type = "generic_drop_shadow", + id = "clanwars_info_bonuses_drop_shadow_id", + properties = { + offset_shadow = 0, + alpha = 0.4 + } + }, + { + type = "generic_menu_background", + id = "clanwars_info_bonuses_background_id", + properties = { + fill_alpha = 1 + } + }, + { + type = "UIElement", + id = "clanwars_info_bonuses_label_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = GenericTitleBarDims.TitleBarHeight, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "clanwars_info_bonuses_label_bg_id", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.GenericMenu.BorderAlpha + } ) + } + }, + { + type = "UIMarqueeText", + id = "clanwars_info_bonuses_label_id", + properties = { + text = Engine.Localize( "@CLANS_ACTIVE_BONUSES" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + height = CoD.TextSettings.NormalFont.Height, + left = 0, + right = 0, + valign = LUI.Alignment.Center, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + font = CoD.TextSettings.NormalFont.Font + } + } + } + } + }, + { + type = "UIHorizontalList", + id = "bonus_widget_hlist_id", + properties = { + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 40, + bottom = 0, + left = 5, + right = 0, + spacing = 5 + } + }, + childrenFeeder = BonusFeeder + } + } + } +end + +function clan_details_clanwars_info() + return { + type = "UIElement", + id = "clan_details_clanwars_info_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 530, + height = 88, + left = 550, + right = 1215 + } + }, + children = { + { + type = "clanwars_position_info_widget", + id = "clan_details_position_info_id" + }, + { + type = "clanwars_bonuses_info_widget", + id = "clan_details_bonuses_info_id" + } + } + } +end + +function clan_details_main() + return { + type = "UIElement", + id = "clan_details_root", + properties = { + remoteView = false + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OnCreate, + check_download_status = CheckDownloadStatus + }, + children = { + { + type = "UIImage", + id = "clan_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 = "clan_details_title_id", + properties = { + menu_title = "" + } + }, + { + type = "UIText", + id = "clan_details_in_clan_id", + properties = { + text = Engine.Localize( "@CLANS_NONPLATFORM_ON_MOBILE" ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + top = 58, + right = -100, + width = 500, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + }, + visible = { + alpha = 1 + } + }, + handlers = { + show_classified_note = function ( f27_arg0, f27_arg1 ) + f27_arg0:animateToState( "visible", 0 ) + end + + } + }, + { + type = "UIElement", + id = "clan_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + show_clan_details = MBh.AnimateToState( "visible" ) + }, + children = { + { + type = "UIElement", + id = "clan_details_background_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 100, + left = 70, + width = 460, + height = 550 + } + }, + children = { + { + type = "generic_menu_background_withfade", + properties = { + top_offset = 0, + fill_alpha = 1 + } + } + } + }, + { + type = "ClanCard", + id = "clan_card_id" + }, + { + type = "UIMarqueeText", + id = "clan_details_mobile_reminder_id", + properties = { + text = Engine.Localize( "@CLANS_MOBILE_REMINDER" ), + useTextWrapping = true, + textHeight = CoD.TextSettings.TinyFont.Height + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 420, + height = CoD.TextSettings.TinyFont.Height * 2, + left = 80, + width = 440, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + alpha = 0.4 + } + } + }, + { + type = "UIText", + id = "clan_details_leader_playercard_label_id", + properties = { + text = Engine.Localize( "@CLANS_CLAN_LEADER_CAPS" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 460, + height = CoD.TextSettings.BigFont.Height, + left = 85, + width = 440, + font = CoD.TextSettings.BigFont.Font + } + } + }, + { + type = "playercard", + id = "clan_details_leader_playercard_id", + properties = { + gamertag = "", + clantag = "", + background = "0", + patchEmblem = "0", + patchShape = "0" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 510, + bottom = 600, + left = 80, + width = 500, + alpha = 1 + } + } + }, + { + type = "clan_details_member_highlight_window", + id = "clan_details_member_highlight_window_id" + }, + { + type = "ClanMembersWindow", + id = "clan_member_models_id", + properties = { + char_window_dims = { + top = -30, + bottom = 482, + left = -100, + right = 412 + }, + character_pos = { + CharacterCameraPresets.ClanDetails.Left.Position, + CharacterCameraPresets.ClanDetails.Center.Position, + CharacterCameraPresets.ClanDetails.Right.Position + }, + controller = MBh.Property( "exclusiveController" ), + loadingOffset = 155 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 110, + height = 420, + left = 570, + width = 630 + } + } + }, + { + type = "clan_details_clanwars_info", + id = "clan_details_clanwars_info_id" + }, + { + type = "generic_loading_widget", + id = "leader_loading_widget_id", + properties = { + message = Engine.Localize( "@MENU_LOADING_DOTS" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 480, + bottom = 580, + left = 60, + right = 460 + } + } + } + } + }, + { + type = "live_dialog_text_box_with_cancel", + id = "clan_details_full_load_id", + properties = { + message = Engine.Localize( "@MENU_DOWNLOADING" ), + cancel_func = MBh.LeaveMenu() + } + }, + { + type = "button_helper_text_main", + id = "clan_details_helper_text_id" + }, + { + type = "UIBindButton", + id = "clan_details_bind_button_id", + handlers = { + button_secondary = MBh.LeaveMenu(), + button_alt2 = OpenClanRoster + } + }, + { + type = "UITimer", + id = "download_update_timer_id", + properties = { + event = "check_download_status", + interval = 100, + disposable = false + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "clan_details_member_highlight", clan_details_member_highlight ) +LUI.MenuBuilder.registerDef( "clan_details_member_highlight_window", clan_details_member_highlight_window ) +LUI.MenuBuilder.registerDef( "clan_details_main", clan_details_main ) +LUI.MenuBuilder.registerDef( "clanwars_position_info_widget", clanwars_position_info_widget ) +LUI.MenuBuilder.registerDef( "clanwars_bonuses_info_widget", clanwars_bonuses_info_widget ) +LUI.MenuBuilder.registerDef( "clan_details_clanwars_info", clan_details_clanwars_info ) +LUI.MenuBuilder.registerDef( "clanwars_bonus_widget", clanwars_bonus_widget ) +LockTable( _M ) diff --git a/lui/mp_menus/clanelements.dec.lua b/lui/mp_menus/clanelements.dec.lua new file mode 100644 index 0000000..f8aef08 --- /dev/null +++ b/lui/mp_menus/clanelements.dec.lua @@ -0,0 +1,540 @@ +LUI.ClanCard = {} +LUI.ClanMembersWindow = InheritFrom( LUI.UIElement ) +XP_BAR_WIDTH = 212 +LUI.ClanCard.new = function ( f1_arg0, f1_arg1, f1_arg2 ) + local f1_local0 = 128 + local self = LUI.UIElement.new( CoD.CreateState( 80, 110, 520, 390, CoD.AnchorTypes.TopLeft ) ) + self.id = "clan_card_id" + local f1_local2 = LUI.UIElement.new( CoD.CreateState( 0, 0, 0, 180, CoD.AnchorTypes.TopLeftRight ) ) + f1_local2.id = "clan_card_top_id" + self:addElement( f1_local2 ) + self.cardBG = LUI.UIImage.new( CoD.CreateState( 0, 0, 0, 144, CoD.AnchorTypes.TopLeftRight ) ) + f1_local2:addElement( self.cardBG ) + local f1_local3 = CoD.CreateState( -130, -10, -80, 40, CoD.AnchorTypes.TopRight ) + f1_local3.material = RegisterMaterial( "icon_clan_xp" ) + f1_local3.alpha = 0 + self.cxpIcon = LUI.UIImage.new( f1_local3 ) + self.cxpIcon:registerAnimationState( "visible", { + alpha = 1 + } ) + self.cxpIcon.id = "clan_card_dcxp_label_id" + f1_local2:addElement( self.cxpIcon ) + f1_local3 = CoD.CreateState( -60, 5, -3, 5 + CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.TopRight ) + f1_local3.font = CoD.TextSettings.NormalFont.Font + f1_local3.alignment = LUI.Alignment.Right + CoD.ColorizeState( Colors.primary_text_color, f1_local3 ) + f1_local3.alpha = 0 + self.cxpText = LUI.UIText.new( f1_local3 ) + self.cxpText:registerAnimationState( "visible", { + alpha = 1 + } ) + self.cxpText.id = "clan_card_dcxp_id" + f1_local2:addElement( self.cxpText ) + f1_local3 = CoD.CreateState( 20, 10, -10, -CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.All ) + f1_local3.spacing = 3 + local f1_local4 = LUI.UIVerticalList.new( f1_local3 ) + f1_local2:addElement( f1_local4 ) + f1_local3 = CoD.CreateState( 0, 0, 0, CoD.TextSettings.BigFont.Height, CoD.AnchorTypes.TopLeftRight ) + f1_local3.font = CoD.TextSettings.BigFont.Font + f1_local3.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.primary_text_color, f1_local3 ) + self.clanTag = LUI.UIText.new( f1_local3 ) + self.clanTag.id = "clan_card_clan_tag_id" + f1_local4:addElement( self.clanTag ) + f1_local3 = CoD.CreateState( 0, 0, 0, CoD.TextSettings.ExtraBigFont.Height, CoD.AnchorTypes.TopLeftRight ) + f1_local3.font = CoD.TextSettings.ExtraBigFont.Font + f1_local3.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.white, f1_local3 ) + self.clanName = LUI.UIMarqueeText.new( f1_local3 ) + self.clanName.id = "clan_card_clan_name_id" + f1_local4:addElement( self.clanName ) + local f1_local5 = LUI.UIHorizontalList.new( CoD.CreateState( 0, 0, 0, CoD.TextSettings.BigFont.Height, CoD.AnchorTypes.TopLeftRight ) ) + f1_local4:addElement( f1_local5 ) + local f1_local6, f1_local7, f1_local8, f1_local9 = GetTextDimensions( Engine.Localize( "@LUA_MENU_CLAN_LEVEL" ), CoD.TextSettings.BigFont.Font, CoD.TextSettings.BigFont.Height ) + f1_local3 = CoD.CreateState( 0, 0, f1_local8 + 10, CoD.TextSettings.BigFont.Height, CoD.AnchorTypes.TopLeft ) + f1_local3.font = CoD.TextSettings.BigFont.Font + f1_local3.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.primary_text_color, f1_local3 ) + local f1_local10 = LUI.UIText.new( f1_local3 ) + f1_local10.id = "clan_card_clan_level_label_id" + f1_local10:setText( Engine.Localize( "@LUA_MENU_CLAN_LEVEL" ) ) + f1_local10:setTextStyle( CoD.TextStyle.Shadowed ) + f1_local5:addElement( f1_local10 ) + f1_local3 = CoD.CreateState( 0, -20, 40, 20, CoD.AnchorTypes.Left ) + f1_local3.material = RegisterMaterial( "icon_clan_level_bg" ) + local f1_local11 = LUI.UIImage.new( f1_local3 ) + f1_local5:addElement( f1_local11 ) + f1_local3 = CoD.CreateState( 0, CoD.TextSettings.NormalFont.Height * -0.55, 0, CoD.TextSettings.NormalFont.Height * 0.45, CoD.AnchorTypes.None ) + f1_local3.font = CoD.TextSettings.NormalFont.Font + f1_local3.alignment = LUI.Alignment.Center + CoD.ColorizeState( Colors.black, f1_local3 ) + self.clanLevelText = LUI.UIText.new( f1_local3 ) + self.clanLevelText.id = "clan_card_clan_level_text_id" + f1_local11:addElement( self.clanLevelText ) + f1_local4:addElement( LUI.UIElement.new( CoD.CreateState( 0, 0, 0, 5, CoD.AnchorTypes.TopLeftRight ) ) ) + LUI.ClanCard.AddLevelProgressBar( f1_local4, self ) + f1_local3 = CoD.CreateState( 0, -CoD.TextSettings.NormalFont.Height - 11, 0, -CoD.TextSettings.NormalFont.Height - 10, CoD.AnchorTypes.BottomLeftRight ) + f1_local3.material = RegisterMaterial( "white" ) + f1_local3.alpha = 0.15 + local f1_local12 = LUI.UIImage.new( f1_local3 ) + f1_local12.id = "clan_card_motto_horizontal_line_id" + f1_local2:addElement( f1_local12 ) + f1_local3 = CoD.CreateState( 10, -CoD.TextSettings.NormalFont.Height - 5, 0, -5, CoD.AnchorTypes.BottomLeftRight ) + f1_local3.font = CoD.TextSettings.NormalFont.Font + f1_local3.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.primary_text_color, f1_local3 ) + self.clanMotto = LUI.UIText.new( f1_local3 ) + self.clanMotto.id = "clan_card_clan_motto_id" + f1_local2:addElement( self.clanMotto ) + local f1_local13 = LUI.UIElement.new( CoD.CreateState( 0, 190, 0, 0, CoD.AnchorTypes.All ) ) + f1_local13.id = "clan_card_stats_group_id" + self:addElement( f1_local13 ) + local f1_local14 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + f1_local14.spacing = 4 + local f1_local15 = LUI.UIVerticalList.new( f1_local14 ) + f1_local15.id = "clan_card_stats_id" + f1_local13:addElement( f1_local15 ) + self.kdRatio = LUI.ClanCard.AddClanStat( f1_local15, "clan_kd_id", Engine.Localize( "@LUA_MENU_CLAN_KD_RATIO" ), "Placeholder Value", 260, 160 ) + self.winPercent = LUI.ClanCard.AddClanStat( f1_local15, "clan_win_id", Engine.Localize( "@LUA_MENU_CLAN_WIN_PERCENTAGE" ), "Placeholder Value", 260, 160 ) + self.memberCount = LUI.ClanCard.AddClanStat( f1_local15, "clan_member_count_id", Engine.Localize( "@LUA_MENU_CLAN_MEMBERS" ), "Placeholder Value", 260, 160 ) + self.rewardsEarned = LUI.ClanCard.AddClanStat( f1_local15, "clan_hours_played_id", Engine.Localize( "@LUA_MENU_CLAN_REWARDS" ), "Placeholder Value", 260, 160 ) + self:registerEventHandler( "update_clan_card", LUI.ClanCard.FeedContent ) + LUI.ClanCard.FeedContent( self, f1_arg1 ) + return self +end + +LUI.ClanCard.AddClanStat = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4, f2_arg5 ) + local self = LUI.UIElement.new( CoD.CreateState( 0, 0, 0, 26, CoD.AnchorTypes.TopLeftRight ) ) + self.id = f2_arg1 + local f2_local1 = CoD.CreateState( 0, 0, -(f2_arg5 + 26), 0, CoD.AnchorTypes.All ) + f2_local1.material = RegisterMaterial( "white" ) + f2_local1.alpha = 0.15 + CoD.ColorizeState( Colors.black, f2_local1 ) + local f2_local2 = LUI.UIImage.new( f2_local1 ) + f2_local2.id = "clan_card_stat_base_left_bg_id" + self:addElement( f2_local2 ) + f2_local1 = CoD.CreateState( -f2_arg5, 0, 0, 0, CoD.AnchorTypes.TopBottomRight ) + f2_local1.material = RegisterMaterial( "white" ) + f2_local1.alpha = 0.05 + CoD.ColorizeState( Colors.white, f2_local1 ) + local f2_local3 = LUI.UIImage.new( f2_local1 ) + f2_local3.id = "clan_card_stat_base_right_bg_id" + self:addElement( f2_local3 ) + f2_local1 = CoD.CreateState( -(f2_arg5 + 26), 0, -f2_arg5, 0, CoD.AnchorTypes.TopBottomRight ) + f2_local1.material = RegisterMaterial( "box_stat_cap" ) + f2_local1.alpha = 0.15 + f2_local1.zRot = 180 + CoD.ColorizeState( Colors.black, f2_local1 ) + local f2_local4 = LUI.UIImage.new( f2_local1 ) + f2_local4.id = "clan_card_stat_base_left_cap_id" + self:addElement( f2_local4 ) + f2_local1 = CoD.CreateState( -(f2_arg5 + 26), 0, -f2_arg5, 0, CoD.AnchorTypes.TopBottomRight ) + f2_local1.material = RegisterMaterial( "box_stat_cap" ) + f2_local1.alpha = 0.05 + CoD.ColorizeState( Colors.white, f2_local1 ) + local f2_local5 = LUI.UIImage.new( f2_local1 ) + f2_local5.id = "clan_card_stat_base_right_cap_id" + self:addElement( f2_local5 ) + f2_local1 = CoD.CreateState( 5, -CoD.TextSettings.NormalFont.Height * 0.5, f2_arg4, CoD.TextSettings.NormalFont.Height * 0.5, CoD.AnchorTypes.Left ) + f2_local1.font = CoD.TextSettings.NormalFont.Font + f2_local1.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.primary_text_color, f2_local1 ) + local f2_local6 = LUI.UIText.new( f2_local1 ) + f2_local6.id = "clan_card_stat_label_id" + f2_local6:setText( f2_arg2 ) + self:addElement( f2_local6 ) + f2_local1 = CoD.CreateState( -f2_arg5, -CoD.TextSettings.NormalFont.Height * 0.5, -5, CoD.TextSettings.NormalFont.Height * 0.5, CoD.AnchorTypes.Right ) + f2_local1.font = CoD.TextSettings.NormalFont.Font + f2_local1.alignment = LUI.Alignment.Right + CoD.ColorizeState( Colors.white, f2_local1 ) + local f2_local7 = LUI.UIText.new( f2_local1 ) + f2_local7.id = "clan_card_stat_value_id" + f2_local7:setText( f2_arg3 ) + self:addElement( f2_local7 ) + f2_arg0:addElement( self ) + return f2_local7 +end + +LUI.ClanCard.AddLevelProgressBar = function ( f3_arg0, f3_arg1 ) + local f3_local0 = 400 + local f3_local1 = 10 + local self = LUI.UIElement.new( CoD.CreateState( 0, 0, f3_local0, f3_local1 + CoD.TextSettings.SmallFont.Height + 3, CoD.AnchorTypes.TopLeft ) ) + self.id = "ClanCard_level_bar_container_id" + local f3_local3 = CoD.CreateState( 0, 0, 0, f3_local1, CoD.AnchorTypes.TopLeftRight ) + CoD.ColorizeState( Colors.black, f3_local3 ) + local f3_local4 = LUI.UIImage.new( f3_local3 ) + f3_local4.id = "ClanCard_level_bar_bg_id" + self:addElement( f3_local4 ) + f3_local4:addElement( LUI.MenuGenerics.generic_border( {}, {} ) ) + f3_local3 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.TopBottomLeft ) + f3_local3.material = RegisterMaterial( "btn_cas_fill_f" ) + local f3_local5 = LUI.UIImage.new( { + f3_local3 + } ) + f3_local5.id = "ClanCard_level_bar_id" + f3_local5.maxWidth = f3_local0 - 1 + f3_local4:addElement( f3_local5 ) + f3_local3 = CoD.CreateState( 0, -CoD.TextSettings.SmallFont.Height, 0, 0, CoD.AnchorTypes.BottomLeftRight ) + f3_local3.font = CoD.TextSettings.SmallFont.Font + f3_local3.alignment = LUI.Alignment.Right + local f3_local6 = LUI.UIText.new( f3_local3 ) + f3_local6.id = "clan_card_xp_to_next_id" + self:addElement( f3_local6 ) + f3_arg1.XPFillBar = f3_local5 + f3_arg1.xpToNextText = f3_local6 + f3_arg0:addElement( self ) +end + +LUI.ClanCard.FeedContent = function ( f4_arg0, f4_arg1 ) + if not f4_arg1 then + f4_arg1 = {} + end + if f4_arg1.clan_background then + f4_arg0.cardBG:setImage( RegisterMaterial( f4_arg1.clan_background ) ) + end + if f4_arg1.clan_name then + f4_arg0.clanName:setText( f4_arg1.clan_name ) + f4_arg0.clanName:setTextStyle( CoD.TextStyle.Shadowed ) + end + if f4_arg1.clan_tag then + f4_arg0.clanTag:setText( f4_arg1.clan_tag ) + f4_arg0.clanTag:setTextStyle( CoD.TextStyle.Shadowed ) + end + if f4_arg1.clan_level and f4_arg1.current_xp and f4_arg1.xp_to_next then + f4_arg0.clanLevelText:setText( f4_arg1.clan_level ) + if f4_arg1.xp_to_next > 0 then + f4_arg0.xpToNextText:setText( Engine.Localize( "@CLANS_XP_TO_NEXT", f4_arg1.xp_to_next ) ) + else + f4_arg0.xpToNextText:setText( Engine.Localize( "@CLANS_MAX_LEVEL" ) ) + end + end + if f4_arg1.next_level_progress then + f4_arg0.XPFillBar:registerAnimationState( "default", { + top = 1, + bottom = -1, + left = 1, + right = f4_arg1.next_level_progress * f4_arg0.XPFillBar.maxWidth, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + material = RegisterMaterial( "btn_cas_fill_f" ) + } ) + f4_arg0.XPFillBar:animateToState( "default", 0 ) + end + if f4_arg1.clan_motto then + f4_arg0.clanMotto:setText( f4_arg1.clan_motto ) + end + if f4_arg1.kd_ratio then + f4_arg0.kdRatio:setText( f4_arg1.kd_ratio ) + end + if f4_arg1.win_percent then + f4_arg0.winPercent:setText( f4_arg1.win_percent ) + end + if f4_arg1.member_count then + f4_arg0.memberCount:setText( f4_arg1.member_count ) + end + if f4_arg1.reward_count then + f4_arg0.rewardsEarned:setText( f4_arg1.reward_count ) + end + if f4_arg1.hours_played then + f4_arg0.hoursPlayed:setText( f4_arg1.hours_played ) + end + if f4_arg1.session_cxp then + f4_arg0.sessionCXP:setText( f4_arg1.session_cxp ) + end + if f4_arg1.cxp_time and f4_arg1.cxp_time > 0 then + local f4_local0 = f4_arg1.cxp_time + local f4_local1 = math.floor( f4_local0 / 3600 ) + f4_local0 = f4_local0 % 3600 + f4_arg0.cxpText:setText( string.format( "%02d:%02d:%02d", f4_local1, math.floor( f4_local0 / 60 ), f4_local0 % 60 ) ) + f4_arg0.cxpIcon:animateToState( "visible", 0 ) + f4_arg0.cxpText:animateToState( "visible", 0 ) + end +end + +LUI.ClanMembersWindow.new = function ( f5_arg0, f5_arg1, f5_arg2 ) + local self = LUI.UIElement.new() + self.id = "ClanMembersWindow" + if not f5_arg1 then + f5_arg1 = {} + end + local f5_local1 = f5_arg1.char_window_dims + if not f5_local1 then + f5_local1 = { + left = 0, + top = 0, + right = 0, + bottom = 0 + } + end + f5_arg1.char_window_dims = f5_local1 + f5_local1 = f5_arg1.controller + if not f5_local1 then + DebugPrint( "WARNING: Using ClanMembersWindow without specifying controller. Defaulting to first active controller" ) + f5_local1 = Engine.GetFirstActiveController() + end + self.controller = f5_local1 + + local charWindow = LUI.UICharacterWindow.new() + charWindow.id = "clan_member_char_window_id" + charWindow:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f5_arg1.char_window_dims.top, + bottom = f5_arg1.char_window_dims.bottom, + left = f5_arg1.char_window_dims.left, + right = f5_arg1.char_window_dims.right + } ) + charWindow:animateToState( "default" ) + charWindow:registerEventHandler( "make_scene", LUI.ClanMembersWindow.InitCharacterWindow ) + charWindow:registerEventHandler( "animLooped", function ( element, event ) + LUI.ClanMembersWindow.DoAnimChange( element, event ) + end ) + charWindow:registerEventHandler( "animEnded", function ( element, event ) + LUI.ClanMembersWindow.DoAnimChange( element, event ) + end ) + local f5_local3 = LUI.UITimer.new( 50, "make_scene" ) + f5_local3.id = "createSceneTimer" + charWindow:addElement( f5_local3 ) + self:addElement( charWindow ) + self.charWindow = charWindow + + LUI.ClanMembersWindow.AddLoadingWidget( charWindow, f5_arg1.loadingOffset ) + self.close = function () + LUI.ClanMembersWindow.Shutdown( self, event ) + LUI.UIElement.close( self ) + end + + self.closeTree = function () + LUI.ClanMembersWindow.Shutdown( self, event ) + LUI.UIElement.closeTree( self ) + end + + self.characterHandles = {} + return self +end + +LUI.ClanMembersWindow.InitCharacterWindow = function ( f10_arg0, f10_arg1 ) + if not CharacterScene.IsReady() then + return + end + local f10_local0 = f10_arg0:getParent() + if not f10_local0 or not f10_local0.modelData then + return + end + f10_arg0:closeChildren() + local f10_local1 = f10_local0.properties + CharacterScene.SetVisionSet( "mp_character_room" ) + CharacterScene.SetFOV( 43 ) + CharacterScene.SetAmbient( 0, 0, 0 ) + f10_arg0.anim_states = {} + for f10_local2 = 1, 3, 1 do + local f10_local5 = f10_local0.modelData[f10_local2] + if f10_local5 and f10_local5.hasPlatformInfo then + local f10_local6 = f10_local5.bodyModel + if not f10_local6 then + f10_local6 = Cac.GetDefaultBodyModel( f10_local0.controller ) + end + f10_local6 = string.sub( f10_local6, 0, -6 ) .. "elite" + local f10_local7 = f10_local5.headModel + if not f10_local7 then + f10_local7 = Cac.GetDefaultHeadModel( f10_local0.controller ) + end + if Engine.TableLookup( "mp/cac/helmets.csv", 0, f10_local7, 4 ) == "1" and string.find( f10_local7, "alt", -4 ) ~= nil then + f10_local7 = string.sub( f10_local7, 0, -4 ) .. "alt_f" + end + local f10_local8 = "iw6_kriss_mp" + if f10_local5.weaponName and f10_local5.weaponName ~= "" then + local f10_local9 = 0 + if f10_local5.camoName then + f10_local9 = tonumber( Cac.GetCamoWeaponIndex( f10_local5.camoName ) ) + end + f10_local8 = Cac.BuildWeaponName( f10_local5.weaponName, f10_local5.attachName1, f10_local5.attachName2, f10_local9, 0, f10_local5.attachName3 ) + end + local f10_local9 = CharacterScene.CreateCharacter( "clan_model_" .. f10_local2, f10_local6, f10_local7, f10_local8 ) + CharacterScene.SetSpin( f10_local9, 0, 0, 0 ) + CharacterScene.SetBlendedRotation( f10_local9, 0, 0, 0, 0 ) + if f10_local1 and f10_local1.character_pos then + CharacterScene.SetCharacterUVs( f10_local9, 0, 0, 1, 1 ) + CharacterScene.PositionRelativeToCamera( f10_local9, f10_local1.character_pos[f10_local2][1], f10_local1.character_pos[f10_local2][2], f10_local1.character_pos[f10_local2][3] ) + end + f10_local0.characterHandles[f10_local2] = f10_local9 + f10_arg0.anim_states[f10_local2] = { + anim_name = Cac.GetRandomIdleAnim( f10_local8 ), + weapon_name = f10_local8 + } + LUI.ClanMembersWindow.SetAnimation( f10_arg0:getParent(), f10_local0.characterHandles[f10_local2], f10_arg0.anim_states[f10_local2].anim_name, 0.2 ) + else + local f10_local7 = CharacterScene.CreateCharacter( "clan_model_" .. f10_local2, "prop_dogtags_friend_iw6" ) + CharacterScene.SetSpin( f10_local7, 0, 5, 0 ) + if f10_local1 and f10_local1.character_pos then + CharacterScene.SetCharacterUVs( f10_local7, 0, 0, 1, 1 ) + CharacterScene.PositionRelativeToCamera( f10_local7, f10_local1.character_pos[f10_local2][1], f10_local1.character_pos[f10_local2][2], f10_local1.character_pos[f10_local2][3] ) + end + f10_local0.characterHandles[f10_local2] = f10_local7 + end + f10_arg0:setCharacterHandle( f10_local0.characterHandles[f10_local2] ) + end +end + +LUI.ClanMembersWindow.Shutdown = function ( f11_arg0, f11_arg1 ) + for f11_local0 = 1, #f11_arg0.characterHandles, 1 do + CharacterScene.FreeCharacter( f11_arg0.characterHandles[f11_local0] ) + end + f11_arg0.characterHandles = {} + f11_arg0.modelData = nil +end + +LUI.ClanMembersWindow.SetAnimation = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3 ) + if not CharacterScene.IsReady() then + return + elseif f12_arg1 then + CharacterScene.PlayAnim( f12_arg1, f12_arg2, f12_arg3 ) + end +end + +LUI.ClanMembersWindow.AddLoadingWidget = function ( f13_arg0, f13_arg1 ) + f13_arg0:addElement( LUI.MenuBuilder.buildItems( { + type = "generic_loading_widget", + id = "loading_widget_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = f13_arg1 or 0, + right = f13_arg1 or 0 + } + }, + properties = { + message = Engine.Localize( "@MENU_LOADING_DOTS" ) + } + }, {}, f13_arg0 ) ) +end + +LUI.ClanMembersWindow.DoAnimChange = function ( f14_arg0, f14_arg1 ) + local f14_local0 = f14_arg0:getParent() + local f14_local1 = nil + for f14_local2 = 1, 3, 1 do + if f14_local0.characterHandles[f14_local2] == f14_arg1.objectHandle then + f14_local1 = f14_local2 + break + end + end + if f14_local1 and f14_arg0.anim_states[f14_local1] then + local f14_local2 = f14_arg0.anim_states[f14_local1] + f14_local2.anim_name = Cac.GetRandomIdleAnim( f14_local2.weapon_name, f14_local2.anim_name ) + LUI.ClanMembersWindow.SetAnimation( f14_local0, f14_arg1.objectHandle, f14_local2.anim_name, 0.2 ) + end +end + +function clan_not_in_clan_popup() + return { + type = "generic_selectionList_popup", + properties = { + popup_title = Engine.Localize( "@CLANS_NOT_IN_CLAN_HEADER_CAPS" ), + popup_childfeeder = function () + return { + { + type = "UIElement", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = 10 + } + } + }, + { + type = "UIText", + id = "clan_popup_desc_text_id", + properties = { + text = Engine.Localize( "@CLANS_NOT_IN_CLAN_TEXT" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1 + } + } + }, + { + type = "UIElement", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = 10 + } + } + }, + { + type = "UIGenericButton", + id = "create_clan_button_id", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@CLANS_CREATE_CLAN" ), + button_action_func = function ( f17_arg0, f17_arg1 ) + if CoDAnywhere.ShouldShowLinkCreatePopup( f17_arg1.controller, true ) == true then + LUI.FlowManager.RequestPopupMenu( f17_arg0, "cod_anywhere_popup_menu", true, f17_arg1.controller ) + elseif CoDAnywhere.ShouldShowLinkUCDPopup( f17_arg1.controller, true ) == true then + LUI.FlowManager.RequestPopupMenu( f17_arg0, "cod_anywhere_link_ucd_popup_menu", true, f17_arg1.controller ) + else + Clan.Create( f17_arg1.controller ) + end + LUI.FlowManager.RequestLeaveMenu( f17_arg0 ) + end + + } + }, + { + type = "UIGenericButton", + id = "cancel_button_id", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@LUA_MENU_CANCEL" ), + button_action_func = function ( f18_arg0, f18_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f18_arg0 ) + end + + } + } + } + end + + } + } +end + +LUI.MenuBuilder.registerDef( "clan_not_in_clan_popup", clan_not_in_clan_popup ) +LUI.MenuBuilder.registerType( "ClanCard", LUI.ClanCard.new ) +LUI.MenuBuilder.registerType( "ClanMembersWindow", LUI.ClanMembersWindow.new ) diff --git a/lui/mp_menus/claninvites.dec.lua b/lui/mp_menus/claninvites.dec.lua new file mode 100644 index 0000000..42bd9e2 --- /dev/null +++ b/lui/mp_menus/claninvites.dec.lua @@ -0,0 +1,620 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +ClanInvites = { + leftPadding = 28 +} +function OnCreate( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + f1_local0.inviteCount = Clan.GetNumProposals( f1_arg1.controller ) + f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function AcceptClanInvite( f2_arg0, f2_arg1 ) + Clan.AcceptClanProposal( f2_arg1.controller, f2_arg0.properties.index ) + LUI.FlowManager.RequestLeaveMenu( f2_arg0 ) + f2_arg0:dispatchEventToRoot( { + name = "leave_clan_invites", + immediate = true + } ) +end + +function DeclineClanInvite( f3_arg0, f3_arg1 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "clan_invites" ) + Clan.DeclineClanProposal( f3_arg1.controller, f3_arg0.properties.index ) + LUI.FlowManager.RequestLeaveMenu( f3_arg0 ) + f3_local0.inviteCount = f3_local0.inviteCount - 1 + if f3_local0.inviteCount == 0 then + f3_arg0:dispatchEventToRoot( { + name = "leave_clan_invites", + immediate = true + } ) + end +end + +function ClanInviteDecisionFeeder( f4_arg0, f4_arg1 ) + local f4_local0 = { + [#f4_local0 + 1] = { + type = "UIGenericButton", + id = "invite", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@LUA_MENU_CLAN_ACCEPT_INVITATION" ), + index = f4_arg0.index, + button_action_func = AcceptClanInvite + } + }, + [#f4_local0 + 1] = { + type = "UIGenericButton", + id = "join", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@LUA_MENU_CLAN_DECLINE_INVITATION" ), + index = f4_arg0.index, + button_action_func = DeclineClanInvite + } + } + } + return f4_local0 +end + +function popup_invite_decision() + return { + type = "generic_selectionList_popup", + id = "popup_invite_decision", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_CLAN_INVITE_CAPS" ), + popup_childfeeder = ClanInviteDecisionFeeder + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + } + } +end + +function InviteDecision( f6_arg0, f6_arg1 ) + LUI.FlowManager.RequestPopupMenu( f6_arg0, "popup_invite_decision", true, f6_arg1.controller, false, { + index = f6_arg0.properties.index + } ) +end + +function ClanInviteFeeder( f7_arg0 ) + local f7_local0 = {} + local f7_local1 = Clan.GetNumProposals( f7_arg0.exclusiveController ) + for f7_local2 = 0, f7_local1 - 1, 1 do + local f7_local5 = { + type = "UIGenericButton", + id = "clan_invite_button_" .. f7_local2 + } + local f7_local6 = { + button_text = Engine.Localize( "PATCH_MENU_INVITE_NUMBER", f7_local2 + 1 ), + index = f7_local2, + button_action_func = InviteDecision + } + local f7_local7 = MBh.DoMultiple + local f7_local8 = {} + local f7_local9 = MBh.EmitEventToRoot( { + name = "update_clan_name", + newName = Clan.GetProposalClanName( f7_arg0.exclusiveController, f7_local2 ), + immediate = true + } ) + local f7_local10 = MBh.EmitEventToRoot( { + name = "update_clan_level", + newLevel = Clan.GetProposalClanLevel( f7_arg0.exclusiveController, f7_local2 ), + immediate = true + } ) + local f7_local11 = MBh.EmitEventToRoot( { + name = "update_clan_leader", + newLeader = Clan.GetProposalClanLeaderName( f7_arg0.exclusiveController, f7_local2 ), + immediate = true + } ) + local f7_local12 = MBh.EmitEventToRoot( { + name = "update_clan_kd", + newKD = Clan.GetProposalClanKD( f7_arg0.exclusiveController, f7_local2 ), + immediate = true + } ) + local f7_local13 = MBh.EmitEventToRoot( { + name = "update_clan_member_count", + newMemberCount = Clan.GetProposalClanMemberCount( f7_arg0.exclusiveController, f7_local2 ), + immediate = true + } ) + local f7_local14 = MBh.EmitEventToRoot( { + name = "update_clan_message", + newMessage = Clan.GetProposalMessage( f7_arg0.exclusiveController, f7_local2 ), + immediate = true + } ) + f7_local6.button_over_func = f7_local7( f7_local9 ) + f7_local5.properties = f7_local6 + f7_local0[#f7_local0 + 1] = f7_local5 + end + return f7_local0 +end + +function clan_invite_vlist() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + close_actions = function ( f9_arg0, f9_arg1 ) + f9_arg0:closeChildren() + f9_arg0:dispatchEventToRoot( { + name = "menu_refresh", + immediate = true + } ) + f9_arg0:processEvent( { + name = "gain_focus" + } ) + end + + } + } +end + +function LeaveClanInviteMenu( f10_arg0, f10_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f10_arg0 ) +end + +function UpdateClanName( f11_arg0, f11_arg1 ) + assert( f11_arg1.newName ) + f11_arg0:setText( f11_arg1.newName ) +end + +function UpdateClanLevel( f12_arg0, f12_arg1 ) + assert( f12_arg1.newLevel ) + f12_arg0:setText( f12_arg1.newLevel ) +end + +function UpdateClanLeader( f13_arg0, f13_arg1 ) + assert( f13_arg1.newLeader ) + f13_arg0:setText( f13_arg1.newLeader ) +end + +function UpdateClanKD( f14_arg0, f14_arg1 ) + assert( f14_arg1.newKD ) + f14_arg0:processEvent( { + name = "update_stat_text", + newStatText = f14_arg1.newKD + } ) +end + +function UpdateClanMemberCount( f15_arg0, f15_arg1 ) + assert( f15_arg1.newMemberCount ) + f15_arg0:processEvent( { + name = "update_stat_text", + newStatText = f15_arg1.newMemberCount + } ) +end + +function UpdateClanMessage( f16_arg0, f16_arg1 ) + assert( f16_arg1.newMessage ) + f16_arg0:setText( f16_arg1.newMessage ) +end + +function ClanInvitesInfoFeeder( f17_arg0 ) + local f17_local0 = { + [#f17_local0 + 1] = { + type = "UIMarqueeText", + id = "clan_name", + properties = { + text = "", + defaultAnimationState = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = ClanInvites.leftPadding, + top = 0, + right = -28, + height = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left + } + }, + handlers = { + update_clan_name = UpdateClanName + } + }, + [#f17_local0 + 1] = { + type = "UIElement", + id = "clan_level_container", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + top = 0, + right = 0, + bottom = CoD.TextSettings.NormalFont.Height + } + }, + children = { + { + type = "UIText", + id = "clan_level_text", + states = { + default = CoD.ColorizeState( Colors.grey_5, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = ClanInvites.leftPadding, + top = 0, + right = 0, + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + properties = { + text = Engine.Localize( "PATCH_MENU_CLAN_LEVEL_COLON_CAPS" ) + } + }, + { + type = "UIElement", + id = "clan_level_icon_container", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = ClanInvites.leftPadding + 110, + top = 0, + right = ClanInvites.leftPadding + 154, + bottom = 0 + } + }, + children = { + { + type = "UIImage", + id = "clan_level_icon", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + top = -10, + right = 0, + height = 44, + material = RegisterMaterial( "icon_clan_level_bg" ) + } + } + }, + { + type = "UIText", + id = "clan_level_number", + states = { + default = CoD.ColorizeState( Colors.black, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + top = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) + }, + properties = { + text = "" + }, + handlers = { + update_clan_level = UpdateClanLevel + } + } + } + } + } + }, + [#f17_local0 + 1] = { + type = "UIElement", + id = "clan_leader_container", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + top = 0, + right = 0, + bottom = CoD.TextSettings.NormalFont.Height + } + }, + children = { + { + type = "UIMarqueeText", + id = "clan_leader_text", + states = { + default = CoD.ColorizeState( Colors.grey_5, { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = ClanInvites.leftPadding, + top = 0, + right = 170, + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + properties = { + text = Engine.Localize( "PATCH_MENU_CLAN_LEADER_COLON_CAPS" ) + } + }, + { + type = "UIMarqueeText", + id = "clan_leader_name", + states = { + default = CoD.ColorizeState( Colors.frontend_hilite, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = ClanInvites.leftPadding + 142, + top = 0, + right = -28, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + properties = { + text = "" + }, + handlers = { + update_clan_leader = UpdateClanLeader + } + } + } + }, + [#f17_local0 + 1] = { + type = "UIElement", + id = "clan_stats_container", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = ClanInvites.leftPadding - 10, + top = 0, + right = -28, + bottom = 50 + } + }, + children = { + { + type = "aar_stats_widget", + id = "kd_stats_widget", + properties = { + label_text = Engine.Localize( "@LUA_MENU_CLAN_KD_RATIO" ), + stat_text = "", + stat_text_r = Colors.white.r, + stat_text_g = Colors.white.g, + stat_text_b = Colors.white.b, + label_text_r = Colors.white.r, + label_text_g = Colors.white.g, + label_text_b = Colors.white.b, + stat_text_indent = 235 + }, + handlers = { + update_clan_kd = UpdateClanKD + } + }, + { + type = "aar_stats_widget", + id = "members_stats_widget", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 26, + bottom = 50 + } + }, + properties = { + label_text = Engine.Localize( "@PATCH_MENU_MEMBERS" ), + stat_text = "", + stat_text_r = Colors.white.r, + stat_text_g = Colors.white.g, + stat_text_b = Colors.white.b, + label_text_r = Colors.white.r, + label_text_g = Colors.white.g, + label_text_b = Colors.white.b, + stat_text_indent = 235 + }, + handlers = { + update_clan_member_count = UpdateClanMemberCount + } + } + } + }, + [#f17_local0 + 1] = { + type = "UIStencil", + id = "clan_message_stencil", + states = { + default = CoD.ColorizeState( Colors.white, { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = ClanInvites.leftPadding, + top = 0, + right = 412, + height = CoD.TextSettings.NormalFont.Height * 8 + } ) + }, + children = { + { + type = "UIMarqueeText", + id = "clan_message", + states = { + default = CoD.ColorizeState( Colors.white, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + top = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + properties = { + text = "" + }, + handlers = { + update_clan_message = UpdateClanMessage + } + } + } + } + } + return f17_local0 +end + +function clan_invites() + return { + type = "UIElement", + id = "clan_invites", + handlers = { + menu_create = OnCreate, + leave_clan_invites = MBh.LeaveMenu() + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "generic_menu_title", + id = "clan_invites_title_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_CLAN_CLAN_INVITES_CAPS" ) + } + }, + { + type = "UIElement", + id = "clan_invites_info_container", + states = { + default = { + left = -100, + top = -250, + width = 440, + height = 536 + } + }, + children = { + { + type = "generic_menu_titlebar", + id = "clan_invites_title", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = Engine.Localize( "CLANS_CLAN_DETAILS_CAPS" ), + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left + } + }, + { + type = "generic_menu_background_withfade", + id = "clan_invites_background", + properties = { + shadow_alpha = 0.6, + fill_alpha = 0.8 + } + }, + { + type = "UIVerticalList", + id = "clan_invites_content", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 5, + bottom = 0, + left = 1, + right = -1, + spacing = 20 + } + }, + childrenFeeder = ClanInvitesInfoFeeder + } + } + }, + { + type = "clan_invite_vlist", + id = "clan_invite_list", + childrenFeeder = ClanInviteFeeder + }, + { + type = "button_helper_text_main", + id = "clans_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + }, + { + type = "UIBindButton", + id = "squad_results_back_id", + handlers = { + button_secondary = LeaveClanInviteMenu + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "clan_invites", clan_invites ) +LUI.MenuBuilder.registerDef( "clan_invite_vlist", clan_invite_vlist ) +LUI.MenuBuilder.registerDef( "popup_invite_decision", popup_invite_decision ) +LockTable( _M ) diff --git a/lui/mp_menus/killstreakselections.dec.lua b/lui/mp_menus/killstreakselections.dec.lua new file mode 100644 index 0000000..e389b5f --- /dev/null +++ b/lui/mp_menus/killstreakselections.dec.lua @@ -0,0 +1,1680 @@ +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 ) diff --git a/lui/mp_menus/leaderboards.dec.lua b/lui/mp_menus/leaderboards.dec.lua new file mode 100644 index 0000000..f005c86 --- /dev/null +++ b/lui/mp_menus/leaderboards.dec.lua @@ -0,0 +1,1464 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +Settings = { + Header = { + TextStart = 100 + } +} +function leaderboards_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_extinction_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_extinction_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienExtinctionFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_chaos_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_chaos_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienChaosFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_ex_global_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_ex_global_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienExtinctionGlobalFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_chaos_global_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_chaos_global_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienChaosGlobalFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_ex_poc_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_ex_poc_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienExPOCFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_chaos_poc_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_chaos_poc_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienChaosPOCFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_ex_nightfall_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_ex_nightfall_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienExNightfallFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_chaos_nightfall_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_chaos_nightfall_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienChaosNightfallFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_ex_mayday_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_ex_mayday_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienExMaydayFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_chaos_mayday_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_chaos_mayday_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienChaosMaydayFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_ex_dlc3_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_ex_dlc3_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienExDlc3Feeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_chaos_dlc3_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_chaos_dlc3_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienChaosDlc3Feeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_ex_last_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_ex_last_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienExLastFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function leaderboards_alien_chaos_last_selection_vlist() + return { + type = "UIScrollingVerticalList", + id = "leaderboards_alien_chaos_last_selection_vlist_id", + properties = { + use_arrows = true + }, + childrenFeeder = LeaderboardsSelectionAlienChaosLastFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 10 + 2 + 60 + } + } + } +end + +function LeaderboardAction( f16_arg0, f16_arg1 ) + LUI.FlowManager.RequestPopupMenu( f16_arg0, "mp_leaderboard_main", true, f16_arg1.controller, false, { + leaderboardType = f16_arg0.properties.leaderboardType, + filterType = f16_arg0.properties.filterType + } ) +end + +function LeaderboardsSelectionFeeder( f17_arg0 ) + local f17_local0 = nil + local f17_local1 = LUI.Alignment.Right + if Engine.IsAliensMode() then + f17_local0 = { + { + type = "UIGenericButton", + id = "by_aliens_global_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_ALIENS" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_EXTINCTION" ), + button_action_func = function ( f18_arg0, f18_arg1 ) + if Engine.IsUserAGuest( f18_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f18_arg0, "popup_no_guest", true, f18_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f18_arg0, "leaderboards_alien_extinction", true, f18_arg1.controller ) + end + end + } + }, + { + type = "UIGenericButton", + id = "by_aliens_chaos_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_CHAOS_MODE" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS" ), + button_action_func = function ( f19_arg0, f19_arg1 ) + if Engine.IsUserAGuest( f19_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f19_arg0, "popup_no_guest", true, f19_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f19_arg0, "leaderboards_alien_chaos", true, f19_arg1.controller ) + end + end + } + } + } + elseif SvS.IsSvS() then + f17_local0 = { + { + type = "UIGenericButton", + id = "by_squad_assault_button_id", + properties = { + leaderboardType = "SquadAssault", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_SQUAD_ASSAULT_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_SQUAD_ASSAULT" ) + } + }, + { + type = "UIGenericButton", + id = "by_safeguard_button_id", + properties = { + leaderboardType = "Safeguard", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_HORDE_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_HORDE" ) + } + } + } + else + f17_local0 = { + { + type = "UIGenericButton", + id = "by_score_button_id", + properties = { + leaderboardType = "Score", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_SCORE_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_CHECK_HOW_YOUR_SCORE" ) + } + }, + { + type = "UIGenericButton", + id = "by_wins_button_id", + properties = { + leaderboardType = "Wins", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_WINS_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_WINS" ) + } + }, + { + type = "UIGenericButton", + id = "by_kills_button_id", + properties = { + leaderboardType = "Kills", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_KILLS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_KILLS" ) + } + }, + { + type = "UIGenericButton", + id = "by_accuracy_button_id", + properties = { + leaderboardType = "Accuracy", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_ACCURACY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_ACCURACY" ) + } + }, + { + type = "UIGenericButton", + id = "by_dm_button_id", + properties = { + leaderboardType = "FreeForAll", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_DEATHMATCH_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_DM" ) + } + }, + { + type = "UIGenericButton", + id = "by_war_button_id", + properties = { + leaderboardType = "TeamDeathmatch", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_TEAM_DEATHMATCH_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_WAR" ) + } + }, + { + type = "UIGenericButton", + id = "by_gun_button_id", + properties = { + leaderboardType = "GunGame", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_GUN_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_GUN" ) + } + }, + { + type = "UIGenericButton", + id = "by_sr_button_id", + properties = { + leaderboardType = "SearchAndRescue", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_SR_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_SR" ) + } + }, + { + type = "UIGenericButton", + id = "by_dom_button_id", + properties = { + leaderboardType = "Domination", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_DOMINATION_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_DOM" ) + } + }, + { + type = "UIGenericButton", + id = "by_conf_button_id", + properties = { + leaderboardType = "KillConfirmed", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_CONF_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_CONF" ) + } + }, + { + type = "UIGenericButton", + id = "by_blitz_button_id", + properties = { + leaderboardType = "Blitz", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_BLITZ_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_BLITZ" ) + } + }, + { + type = "UIGenericButton", + id = "by_cranked_button_id", + properties = { + leaderboardType = "Cranked", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_CRANKED_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_CRANKED" ) + } + }, + { + type = "UIGenericButton", + id = "by_huntedffa_button_id", + properties = { + leaderboardType = "HuntedFFA", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_SOTF_FFA_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_SOTF_FFA" ) + } + }, + { + type = "UIGenericButton", + id = "by_infected_button_id", + properties = { + leaderboardType = "Infected", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_INFECT_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_INFECT" ) + } + }, + { + type = "UIGenericButton", + id = "by_sd_button_id", + properties = { + leaderboardType = "SearchAndDestroy", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_SEARCH_AND_DESTROY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_SD" ) + } + }, + { + type = "UIGenericButton", + id = "by_grnd_button_id", + properties = { + leaderboardType = "DropZone", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@MPUI_GRND_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_GRND" ) + } + }, + { + type = "UIGenericButton", + id = "by_siege_button_id", + properties = { + leaderboardType = "Reinforce", + filterType = "Friends", + button_action_func = LeaderboardAction, + button_text = Engine.Localize( "@LUA_MENU_MP_SIEGE_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_REINFORCE" ) + } + } + } + end + return f17_local0 +end + +function LeaderboardsSelectionAlienExtinctionFeeder( f20_arg0 ) + local f20_local0 = nil + local f20_local1 = LUI.Alignment.Right + return { + { + type = "UIGenericButton", + id = "by_aliens_ex_global_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_GLOBAL" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_GLOBAL" ), + button_action_func = function ( f21_arg0, f21_arg1 ) + if Engine.IsUserAGuest( f21_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f21_arg0, "popup_no_guest", true, f21_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f21_arg0, "leaderboards_alien_ex_global", true, f21_arg1.controller ) + end + end + + } + }, + { + type = "UIGenericButton", + id = "by_aliens_ex_poc_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_POC" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARDS_POC" ), + button_action_func = function ( f22_arg0, f22_arg1 ) + if Engine.IsUserAGuest( f22_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f22_arg0, "popup_no_guest", true, f22_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f22_arg0, "leaderboards_alien_ex_poc", true, f22_arg1.controller ) + end + end + + } + }, + { + type = "UIGenericButton", + id = "by_aliens_ex_nightfall_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_NIGHTFALL" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_NIGHTFALL" ), + button_action_func = function ( f23_arg0, f23_arg1 ) + if Engine.IsUserAGuest( f23_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f23_arg0, "popup_no_guest", true, f23_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f23_arg0, "leaderboards_alien_ex_nightfall", true, f23_arg1.controller ) + end + end + + } + }, + { + type = "UIGenericButton", + id = "by_aliens_ex_mayday_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_MAYDAY" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_MAYDAY" ), + button_action_func = function ( f24_arg0, f24_arg1 ) + if Engine.IsUserAGuest( f24_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f24_arg0, "popup_no_guest", true, f24_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f24_arg0, "leaderboards_alien_ex_mayday", true, f24_arg1.controller ) + end + end + + } + }, + { + type = "UIGenericButton", + id = "by_aliens_ex_dlc3_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_DLC3" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_DLC3" ), + button_action_func = function ( f25_arg0, f25_arg1 ) + if Engine.IsUserAGuest( f25_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f25_arg0, "popup_no_guest", true, f25_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f25_arg0, "leaderboards_alien_ex_dlc3", true, f25_arg1.controller ) + end + end + + } + }, + { + type = "UIGenericButton", + id = "by_aliens_ex_last_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_LAST" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_LAST" ), + button_action_func = function ( f26_arg0, f26_arg1 ) + if Engine.IsUserAGuest( f26_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f26_arg0, "popup_no_guest", true, f26_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f26_arg0, "leaderboards_alien_ex_last", true, f26_arg1.controller ) + end + end + + } + } + } +end + +function LeaderboardsSelectionAlienChaosFeeder( f27_arg0 ) + local f27_local0 = nil + local f27_local1 = LUI.Alignment.Right + return { + { + type = "UIGenericButton", + id = "by_aliens_chaos_global_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_GLOBAL" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_GLOBAL" ), + button_action_func = function ( f28_arg0, f28_arg1 ) + if Engine.IsUserAGuest( f28_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f28_arg0, "popup_no_guest", true, f28_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f28_arg0, "leaderboards_alien_chaos_global", true, f28_arg1.controller ) + end + end + + } + }, + { + type = "UIGenericButton", + id = "by_aliens_chaos_poc_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_POC" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_POC" ), + button_action_func = function ( f29_arg0, f29_arg1 ) + if Engine.IsUserAGuest( f29_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f29_arg0, "popup_no_guest", true, f29_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f29_arg0, "leaderboards_alien_chaos_poc", true, f29_arg1.controller ) + end + end + + } + }, + { + type = "UIGenericButton", + id = "by_aliens_chaos_nightfall_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_NIGHTFALL" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_NIGHTFALL" ), + button_action_func = function ( f30_arg0, f30_arg1 ) + if Engine.IsUserAGuest( f30_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f30_arg0, "popup_no_guest", true, f30_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f30_arg0, "leaderboards_alien_chaos_nightfall", true, f30_arg1.controller ) + end + end + + } + }, + { + type = "UIGenericButton", + id = "by_aliens_chaos_mayday_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_MAYDAY" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_MAYDAY" ), + button_action_func = function ( f31_arg0, f31_arg1 ) + if Engine.IsUserAGuest( f31_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f31_arg0, "popup_no_guest", true, f31_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f31_arg0, "leaderboards_alien_chaos_mayday", true, f31_arg1.controller ) + end + end + + } + }, + { + type = "UIGenericButton", + id = "by_aliens_chaos_dlc3_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_DLC3" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_DLC3" ), + button_action_func = function ( f32_arg0, f32_arg1 ) + if Engine.IsUserAGuest( f32_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f32_arg0, "popup_no_guest", true, f32_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f32_arg0, "leaderboards_alien_chaos_dlc3", true, f32_arg1.controller ) + end + end + + } + }, + { + type = "UIGenericButton", + id = "by_aliens_chaos_last_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_LAST" ), + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_LAST" ), + button_action_func = function ( f33_arg0, f33_arg1 ) + if Engine.IsUserAGuest( f33_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f33_arg0, "popup_no_guest", true, f33_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f33_arg0, "leaderboards_alien_chaos_last", true, f33_arg1.controller ) + end + end + + } + } + } +end + +function LeaderboardsSelectionAlienExtinctionGlobalFeeder( f34_arg0 ) + local f34_local0 = nil + local f34_local1 = LUI.Alignment.Right + f34_local0 = { + [#f34_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_score_button_id", + properties = { + leaderboardType = "AlienScore", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_SCORE_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_SCORE" ) + } + }, + [#f34_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_kills_button_id", + properties = { + leaderboardType = "AlienKills", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_KILLS_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_ALIENKILLS" ) + } + }, + [#f34_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_hives_button_id", + properties = { + leaderboardType = "AlienHives", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_HIVES_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_HIVES" ) + } + }, + [#f34_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_revives_button_id", + properties = { + leaderboardType = "AlienRevives", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_REVIVES_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_REVIVES" ) + } + }, + [#f34_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_downs_button_id", + properties = { + leaderboardType = "AlienDowns", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_DOWNED_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_DOWNED" ) + } + }, + [#f34_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_challenges_button_id", + properties = { + leaderboardType = "AlienChallenges", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_CHALLENGES_COMPLETED_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_CHALLENGE" ) + } + }, + [#f34_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_cashflow_button_id", + properties = { + leaderboardType = "AlienCashFlow", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_CASHFLOW_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_CASHFLOW" ) + } + } + } + return f34_local0 +end + +function LeaderboardsSelectionAlienChaosGlobalFeeder( f35_arg0 ) + local f35_local0 = nil + local f35_local1 = LUI.Alignment.Right + f35_local0 = { + [#f35_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_chaos_score_button_id", + properties = { + leaderboardType = "AlienChaosSolo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_CHAOS_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_SOLO" ) + } + }, + [#f35_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_chaos_kills_button_id", + properties = { + leaderboardType = "AlienChaosCoop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_CHAOS_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_COOP" ) + } + } + } + return f35_local0 +end + +function LeaderboardsSelectionAlienExPOCFeeder( f36_arg0 ) + local f36_local0 = nil + local f36_local1 = LUI.Alignment.Right + f36_local0 = { + [#f36_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_townsolo_button_id", + properties = { + leaderboardType = "AlienTownSolo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_POC_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_POC_SOLO" ) + } + }, + [#f36_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_towncoop_button_id", + properties = { + leaderboardType = "AlienTownCoop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_POC_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_POC_COOP" ) + } + }, + [#f36_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_townescapes_button_id", + properties = { + leaderboardType = "AlienTownEscapes", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_POC_ESCAPES_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_POC_ESCAPES" ) + } + } + } + return f36_local0 +end + +function LeaderboardsSelectionAlienExNightfallFeeder( f37_arg0 ) + local f37_local0 = nil + local f37_local1 = LUI.Alignment.Right + f37_local0 = { + [#f37_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_armorysolo_button_id", + properties = { + leaderboardType = "AlienArmorySolo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_NIGHTFALL_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_NIGHTFALL_SOLO" ) + } + }, + [#f37_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_armorycoop_button_id", + properties = { + leaderboardType = "AlienArmoryCoop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_NIGHTFALL_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_NIGHTFALL_COOP" ) + } + }, + [#f37_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_armoryescapes_button_id", + properties = { + leaderboardType = "AlienArmoryEscapes", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_NIGHTFALL_ESCAPES_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARD_NIGHTFALL_ESCAPES" ) + } + } + } + return f37_local0 +end + +function LeaderboardsSelectionAlienExMaydayFeeder( f38_arg0 ) + local f38_local0 = nil + local f38_local1 = LUI.Alignment.Right + f38_local0 = {} + if Engine.GetDvarBool( "extinction_map_selection_enabled" ) then + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_beaconsolo_button_id", + properties = { + leaderboardType = "AlienBeaconSolo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_MAYDAY_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_MAYDAY_SOLO" ) + } + } + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_beaconcoop_button_id", + properties = { + leaderboardType = "AlienBeaconCoop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_MAYDAY_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_MAYDAY_COOP" ) + } + } + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_beaconescapes_button_id", + properties = { + leaderboardType = "AlienBeaconEscapes", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_MAYDAY_ESCAPES_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_MAYDAY_ESCAPES" ) + } + } + end + return f38_local0 +end + +function LeaderboardsSelectionAlienExDlc3Feeder( f39_arg0 ) + local f39_local0 = nil + local f39_local1 = LUI.Alignment.Right + f39_local0 = {} + if Engine.GetDvarBool( "extinction_map_selection_enabled" ) then + f39_local0[#f39_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_dlc3solo_button_id", + properties = { + leaderboardType = "AlienDlc3Solo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_DLC3_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_DLC3_SOLO" ) + } + } + f39_local0[#f39_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_dlc3coop_button_id", + properties = { + leaderboardType = "AlienDlc3Coop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_DLC3_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_DLC3_COOP" ) + } + } + f39_local0[#f39_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_dlc3escapes_button_id", + properties = { + leaderboardType = "AlienDlc3Escapes", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_DLC3_ESCAPES_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_DLC3_ESCAPES" ) + } + } + end + return f39_local0 +end + +function LeaderboardsSelectionAlienExLastFeeder( f40_arg0 ) + local f40_local0 = nil + local f40_local1 = LUI.Alignment.Right + f40_local0 = {} + if Engine.GetDvarBool( "extinction_map_selection_enabled" ) then + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_lastsolo_button_id", + properties = { + leaderboardType = "AlienLastSolo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_LAST_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_LAST_SOLO" ) + } + } + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_lastcoop_button_id", + properties = { + leaderboardType = "AlienLastCoop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_LAST_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_LAST_COOP" ) + } + } + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_lastescapes_button_id", + properties = { + leaderboardType = "AlienLastEscapes", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_LAST_ESCAPES_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_LAST_ESCAPES" ) + } + } + end + return f40_local0 +end + +function LeaderboardsSelectionAlienChaosPOCFeeder( f41_arg0 ) + local f41_local0 = nil + local f41_local1 = LUI.Alignment.Right + f41_local0 = { + [#f41_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_townsolo_button_id", + properties = { + leaderboardType = "AlienTownChaosSolo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_POC_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_POC_SOLO" ) + } + }, + [#f41_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_towncoop_button_id", + properties = { + leaderboardType = "AlienTownChaosCoop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_POC_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_POC_COOP" ) + } + } + } + return f41_local0 +end + +function LeaderboardsSelectionAlienChaosNightfallFeeder( f42_arg0 ) + local f42_local0 = nil + local f42_local1 = LUI.Alignment.Right + f42_local0 = { + [#f42_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_armorysolo_button_id", + properties = { + leaderboardType = "AlienArmoryChaosSolo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_NIGHTFALL_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_NIGHTFALL_SOLO" ) + } + }, + [#f42_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_armorycoop_button_id", + properties = { + leaderboardType = "AlienArmoryChaosCoop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_NIGHTFALL_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_NIGHTFALL_COOP" ) + } + } + } + return f42_local0 +end + +function LeaderboardsSelectionAlienChaosMaydayFeeder( f43_arg0 ) + local f43_local0 = nil + local f43_local1 = LUI.Alignment.Right + f43_local0 = {} + if Engine.GetDvarBool( "extinction_map_selection_enabled" ) then + f43_local0[#f43_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_beaconsolo_button_id", + properties = { + leaderboardType = "AlienBeaconChaosSolo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_MAYDAY_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_MAYDAY_SOLO" ) + } + } + f43_local0[#f43_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_beaconcoop_button_id", + properties = { + leaderboardType = "AlienBeaconChaosCoop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_MAYDAY_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_MAYDAY_COOP" ) + } + } + end + return f43_local0 +end + +function LeaderboardsSelectionAlienChaosDlc3Feeder( f44_arg0 ) + local f44_local0 = nil + local f44_local1 = LUI.Alignment.Right + f44_local0 = {} + if Engine.GetDvarBool( "extinction_map_selection_enabled" ) then + f44_local0[#f44_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_dlc3solo_button_id", + properties = { + leaderboardType = "AlienDlc3ChaosSolo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_DLC3_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_DLC3_SOLO" ) + } + } + f44_local0[#f44_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_dlc3coop_button_id", + properties = { + leaderboardType = "AlienDlc3ChaosCoop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_DLC3_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_DLC3_COOP" ) + } + } + end + return f44_local0 +end + +function LeaderboardsSelectionAlienChaosLastFeeder( f45_arg0 ) + local f45_local0 = nil + local f45_local1 = LUI.Alignment.Right + f45_local0 = {} + if Engine.GetDvarBool( "extinction_map_selection_enabled" ) then + f45_local0[#f45_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_dlc3solo_button_id", + properties = { + leaderboardType = "AlienLastChaosSolo", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_LAST_SOLO_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_LAST_SOLO" ) + } + } + f45_local0[#f45_local0 + 1] = { + type = "UIGenericButton", + id = "by_aliens_lastcoop_button_id", + properties = { + leaderboardType = "AlienLastChaosCoop", + filterType = "Friends", + button_text = Engine.Localize( "@LUA_MENU_MP_LEADERBOARD_LAST_COOP_CAPS" ), + button_action_func = LeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_DESC_LEADERBOARD_CHAOS_LAST_COOP" ) + } + } + end + return f45_local0 +end + +function LeaderboardsMainCreate( f46_arg0, f46_arg1 ) + f46_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) +end + +function leaderboards() + return { + type = "UIElement", + id = "leaderboards_menu_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = LeaderboardsMainCreate + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ) + } + }, + { + type = "leaderboards_selection_vlist", + id = "leaderboards_selection_vlist_id" + }, + { + type = "button_desc_text", + id = "button_info_text", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericMenuDims.menu_bottom_scroll + 60, + bottom = GenericMenuDims.menu_bottom_scroll + 60 + CoD.TextSettings.SmallFont.Height, + left = 0, + right = GenericMenuDims.menu_right + } + } + }, + { + type = "button_helper_text_main", + id = "leaderboards_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + }, + { + type = "generic_back_button" + } + } + } +end + +function LeaderboardMenuFactory( f48_arg0, f48_arg1, f48_arg2 ) + return function () + return { + type = "UIElement", + id = "leaderboards_" .. f48_arg1, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = LeaderboardsMainCreate + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = f48_arg2 and Engine.Localize( f48_arg2 ) or Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ) + } + }, + { + type = f48_arg0, + id = theID + }, + { + type = "button_desc_text", + id = "button_info_text", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericMenuDims.menu_bottom_scroll + 60, + bottom = GenericMenuDims.menu_bottom_scroll + 60 + CoD.TextSettings.SmallFont.Height, + left = 0, + right = GenericMenuDims.menu_right + } + } + }, + { + type = "button_helper_text_main", + id = "leaderboards_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + }, + { + type = "generic_back_button" + } + } + } + end + +end + +LUI.MenuBuilder.registerDef( "leaderboards_alien_extinction_selection_vlist", leaderboards_alien_extinction_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_selection_vlist", leaderboards_alien_chaos_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_global_selection_vlist", leaderboards_alien_ex_global_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_global_selection_vlist", leaderboards_alien_chaos_global_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_poc_selection_vlist", leaderboards_alien_ex_poc_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_poc_selection_vlist", leaderboards_alien_chaos_poc_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_nightfall_selection_vlist", leaderboards_alien_ex_nightfall_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_nightfall_selection_vlist", leaderboards_alien_chaos_nightfall_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_mayday_selection_vlist", leaderboards_alien_ex_mayday_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_mayday_selection_vlist", leaderboards_alien_chaos_mayday_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_dlc3_selection_vlist", leaderboards_alien_ex_dlc3_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_dlc3_selection_vlist", leaderboards_alien_chaos_dlc3_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_last_selection_vlist", leaderboards_alien_ex_last_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_last_selection_vlist", leaderboards_alien_chaos_last_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards_selection_vlist", leaderboards_selection_vlist ) +LUI.MenuBuilder.registerDef( "leaderboards", leaderboards ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_extinction", LeaderboardMenuFactory( "leaderboards_alien_extinction_selection_vlist", "leaderboards_alien_extinction_selection_vlist_id" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos", LeaderboardMenuFactory( "leaderboards_alien_chaos_selection_vlist", "leaderboards_alien_chaos_selection_vlist_id", "@LUA_MENU_MP_LEADERBOARDS_CAPS_CHAOS" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_global", LeaderboardMenuFactory( "leaderboards_alien_ex_global_selection_vlist", "leaderboards_alien_ex_global_selection_vlist_id" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_global", LeaderboardMenuFactory( "leaderboards_alien_chaos_global_selection_vlist", "leaderboards_alien_chaos_global_selection_vlist_id", "@LUA_MENU_MP_LEADERBOARDS_CAPS_CHAOS" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_poc", LeaderboardMenuFactory( "leaderboards_alien_ex_poc_selection_vlist", "leaderboards_alien_extinction_poc_selection_vlist_id" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_poc", LeaderboardMenuFactory( "leaderboards_alien_chaos_poc_selection_vlist", "leaderboards_alien_chaos_poc_selection_vlist_id", "@LUA_MENU_MP_LEADERBOARDS_CAPS_CHAOS" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_nightfall", LeaderboardMenuFactory( "leaderboards_alien_ex_nightfall_selection_vlist", "leaderboards_alien_extinction_nightfall_selection_vlist_id" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_nightfall", LeaderboardMenuFactory( "leaderboards_alien_chaos_nightfall_selection_vlist", "leaderboards_alien_chaos_nightfall_selection_vlist_id", "@LUA_MENU_MP_LEADERBOARDS_CAPS_CHAOS" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_mayday", LeaderboardMenuFactory( "leaderboards_alien_ex_mayday_selection_vlist", "leaderboards_alien_extinction_mayday_selection_vlist_id" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_mayday", LeaderboardMenuFactory( "leaderboards_alien_chaos_mayday_selection_vlist", "leaderboards_alien_chaos_mayday_selection_vlist_id", "@LUA_MENU_MP_LEADERBOARDS_CAPS_CHAOS" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_dlc3", LeaderboardMenuFactory( "leaderboards_alien_ex_dlc3_selection_vlist", "leaderboards_alien_extinction_dlc3_selection_vlist_id" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_dlc3", LeaderboardMenuFactory( "leaderboards_alien_chaos_dlc3_selection_vlist", "leaderboards_alien_chaos_dlc3_selection_vlist_id", "@LUA_MENU_MP_LEADERBOARDS_CAPS_CHAOS" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_ex_last", LeaderboardMenuFactory( "leaderboards_alien_ex_last_selection_vlist", "leaderboards_alien_extinction_last_selection_vlist_id" ) ) +LUI.MenuBuilder.registerDef( "leaderboards_alien_chaos_last", LeaderboardMenuFactory( "leaderboards_alien_chaos_last_selection_vlist", "leaderboards_alien_chaos_last_selection_vlist_id", "@LUA_MENU_MP_LEADERBOARDS_CAPS_CHAOS" ) ) +LockTable( _M ) diff --git a/lui/mp_menus/leaderboardutils.dec.lua b/lui/mp_menus/leaderboardutils.dec.lua new file mode 100644 index 0000000..2d3582e --- /dev/null +++ b/lui/mp_menus/leaderboardutils.dec.lua @@ -0,0 +1,2206 @@ +Leaderboards.Layout = { + HeaderHeight = 45, + SubtitleBannerWidth = 600, + NumRows = 18, + RowHeight = 26, + Width = 1150, + FilterWidth = 500, + FilterHeight = 200 +} +Leaderboards.DurationDefs = { + Alltime = { + OptionText = "@LUA_MENU_LB_FILTER_DURATION_ALLTIME", + Duration = "TRK_ALLTIME" + }, + Weekly = { + OptionText = "@LUA_MENU_LB_FILTER_DURATION_WEEKLY", + Duration = "TRK_WEEKLY" + }, + Monthly = { + OptionText = "@LUA_MENU_LB_FILTER_DURATION_MONTHLY", + Duration = "TRK_MONTHLY" + }, + PrestigeAlltime = { + OptionText = "@LUA_MENU_LB_FILTER_DURATION_PRESTIGE_ALLTIME", + Duration = "TRK_PRESTIGE_ALLTIME" + }, + PrestigeWeekly = { + OptionText = "@LUA_MENU_LB_FILTER_DURATION_PRESTIGE_WEEKLY", + Duration = "TRK_PRESTIGE_WEEKLY" + }, + PrestigeMonthly = { + OptionText = "@LUA_MENU_LB_FILTER_DURATION_PRESTIGE_MONTHLY", + Duration = "TRK_PRESTIGE_MONTHLY" + } +} +Leaderboards.Filters = { + None = { + Title = "@LUA_MENU_GHOSTS_LEADERBOARD_ALL_CAPS", + OptionText = "@LUA_MENU_LB_FILTER_GROUP_ALL", + Value = "none" + }, + Friends = { + Title = "@LUA_MENU_GHOSTS_LEADERBOARD_FRIENDS_CAPS", + OptionText = "@LUA_MENU_LB_FILTER_GROUP_FRIENDS", + Value = "friends" + }, + FacebookFriends = { + Title = "@LUA_MENU_GHOSTS_LEADERBOARD_FACEBOOKFRIENDS_CAPS", + OptionText = "@LUA_MENU_LB_FILTER_GROUP_FACEBOOKFRIENDS", + Value = "facebook_friends" + }, + LobbyMembers = { + Title = "@LUA_MENU_GHOSTS_LEADERBOARD_LOBBY_CAPS", + OptionText = "@LUA_MENU_LB_FILTER_GROUP_LOBBY_MEMBERS", + Value = "lobby_members" + }, + Clan = { + Title = "@LUA_MENU_GHOSTS_LEADERBOARD_CLAN_CAPS", + OptionText = "@LUA_MENU_LB_FILTER_GROUP_CLAN", + Value = "clan" + } +} +Leaderboards.Boards = { + Common = { + NumColumns = 3, + HeaderNames = { + "@LUA_MENU_RANK_CAPS", + "@LUA_MENU_LEVEL_CAPS", + "@LUA_MENU_PLAYER_NAME_CAPS" + }, + ColumnWidths = { + 100, + 63, + 310 + }, + DataColumnIndexes = { + 0, + 1, + 3 + } + }, + Score = { + NumColumns = 4, + Title = "@LUA_MENU_SCORE_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_TOTALXP_AT", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_TOTALXP_LT", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_TOTALXP_LT", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_AVG_SCORE_CAPS" + }, + ColumnWidths = { + 150, + 150, + 150, + 150 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + Wins = { + NumColumns = 4, + Title = "@LUA_MENU_WINS_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_WINS_AT", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_WINS_LT", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_WINS_LT", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_WINS_CAPS", + "@LUA_MENU_LOSSES_CAPS", + "@LUA_MENU_RATIO_CAPS", + "@LUA_MENU_STREAK_CAPS" + }, + ColumnWidths = { + 150, + 150, + 150, + 150 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + Kills = { + NumColumns = 5, + Title = "@LUA_MENU_KILLS_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_KILLS_AT", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_KILLS_LT", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_KILLS_LT", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_DEATHS_CAPS", + "@LUA_MENU_RATIO_CAPS", + "@LUA_MENU_STREAK_CAPS", + "@LUA_MENU_AVG_KILLS_CAPS" + }, + ColumnWidths = { + 135, + 135, + 135, + 135, + 134 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8 + } + }, + Accuracy = { + NumColumns = 3, + Title = "@LUA_MENU_ACCURACY_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_ACCURACY_AT", + DurationDef = Leaderboards.DurationDefs.Alltime + } + }, + HeaderNames = { + "@LUA_MENU_ACCURACY_CAPS", + "@LUA_MENU_HITS_CAPS", + "@LUA_MENU_MISSES_CAPS" + }, + ColumnWidths = { + 225, + 225, + 224 + }, + DataColumnIndexes = { + 4, + 5, + 6 + } + }, + FreeForAll = { + NumColumns = 4, + Title = "@LUA_MENU_DEATHMATCH_CAPS", + GameType = "dm", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_DM", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_DM", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_DM", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_DEATHS_CAPS", + "@LUA_MENU_RATIO_CAPS" + }, + ColumnWidths = { + 150, + 150, + 150, + 150 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + TeamDeathmatch = { + NumColumns = 5, + Title = "@LUA_MENU_TEAM_DEATHMATCH_CAPS", + GameType = "war", + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_WAR", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_WAR", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_WAR", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_DEATHS_CAPS", + "@LUA_MENU_RATIO_CAPS", + "@LUA_MENU_ASSISTS_CAPS" + }, + ColumnWidths = { + 135, + 135, + 135, + 135, + 134 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8 + } + }, + GunGame = { + NumColumns = 5, + Title = "@LUA_MENU_GUN_CAPS", + GameType = "gun", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_GUN", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_GUN", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_GUN", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_DEATHS_CAPS", + "@LUA_MENU_RATIO_CAPS", + "@LUA_MENU_MP_STABS_CAPS" + }, + ColumnWidths = { + 135, + 135, + 135, + 135, + 134 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8 + } + }, + SearchAndRescue = { + NumColumns = 6, + Title = "@LUA_MENU_SR_CAPS", + GameType = "sr", + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_SR", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_SR", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_SR", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_PLANTS_CAPS", + "@LUA_MENU_DEFUSES_CAPS", + "@LUA_MENU_DEFENDS_CAPS", + "@LUA_MENU_RESCUES_CAPS", + "@LUA_MENU_KILLS_CAPS" + }, + ColumnWidths = { + 100, + 100, + 100, + 100, + 100, + 100 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8, + 9 + } + }, + SearchAndDestroy = { + NumColumns = 5, + Title = "@LUA_MENU_SEARCH_AND_DESTROY_CAPS", + GameType = "sd", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_SD", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_SD", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_SD", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_PLANTS_CAPS", + "@LUA_MENU_DEFUSES_CAPS", + "@LUA_MENU_DEFENDS_CAPS", + "@LUA_MENU_KILLS_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8 + } + }, + Domination = { + NumColumns = 4, + Title = "@LUA_MENU_DOMINATION_CAPS", + GameType = "dom", + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_DOM", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_DOM", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_DOM", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_CAPTURES_CAPS", + "@LUA_MENU_DEFENDS_CAPS", + "@LUA_MENU_KILLS_CAPS" + }, + ColumnWidths = { + 150, + 150, + 150, + 150 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + Blitz = { + NumColumns = 5, + Title = "@LUA_MENU_BLITZ_CAPS", + GameType = "blitz", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_BLITZ", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_BLITZ", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_BLITZ", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_CAPTURES_CAPS", + "@LUA_MENU_AVG_CAPTURES_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125, + 172 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8 + } + }, + KillConfirmed = { + NumColumns = 4, + Title = "@LUA_MENU_CONF_CAPS", + GameType = "conf", + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_CONF", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_CONF", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_CONF", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_CONFIRMS_CAPS", + "@LUA_MENU_DENIES_CAPS", + "@LUA_MENU_KILLS_CAPS" + }, + ColumnWidths = { + 150, + 150, + 150, + 150 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + Cranked = { + NumColumns = 4, + Title = "@LUA_MENU_CRANKED_CAPS", + GameType = "cranked", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_CRANKED", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_CRANKED", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_CRANKED", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_KILL_CHAINS_CAPS", + "@LUA_MENU_AVG_CHAINS_CAPS" + }, + ColumnWidths = { + 150, + 150, + 150, + 150 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + HuntedFFA = { + NumColumns = 3, + Title = "@LUA_MENU_SOTF_FFA_CAPS", + GameType = "sotf_ffa", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_SOTF_FFA", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_SOTF_FFA", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_SOTF_FFA", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_KILLS_CAPS" + }, + ColumnWidths = { + 225, + 225, + 224 + }, + DataColumnIndexes = { + 4, + 5, + 6 + } + }, + Infected = { + NumColumns = 4, + Title = "@LUA_MENU_INFECT_CAPS", + GameType = "infect", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_INFECT", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_INFECT", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_INFECT", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_SURVIVOR_KILLS_CAPS", + "@LUA_MENU_INFECTED_KILLS_CAPS" + }, + ColumnWidths = { + 150, + 150, + 170, + 170 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + DropZone = { + NumColumns = 5, + Title = "@MPUI_GRND_CAPS", + GameType = "grnd", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_GRND", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_GRND", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_GRND", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_DEATHS_CAPS", + "@LUA_MENU_RATIO_CAPS", + "@LUA_MENU_ASSISTS_CAPS" + }, + ColumnWidths = { + 135, + 135, + 135, + 135, + 134 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8 + } + }, + Reinforce = { + NumColumns = 4, + Title = "@LUA_MENU_MP_SIEGE_CAPS", + GameType = "siege", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_SIEGE", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_SIEGE", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_SIEGE", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_CAPTURES_CAPS", + "@LUA_MENU_DEFENDS_CAPS" + }, + ColumnWidths = { + 150, + 150, + 150, + 150 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + SquadAssault = { + NumColumns = 4, + Title = "@LUA_MENU_SQUAD_ASSAULT_CAPS", + GameType = "", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_SQUAD_ASSAULT", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_SQUAD_ASSAULT", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_SQUAD_ASSAULT", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_WINS_CAPS", + "@LUA_MENU_LOSSES_CAPS", + "@LUA_MENU_RATIO_CAPS" + }, + ColumnWidths = { + 156, + 156, + 156, + 156 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + Safeguard = { + NumColumns = 7, + Title = "@LUA_MENU_HORDE_CAPS", + GameType = "horde", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GM_HORDE", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GM_HORDE", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GM_HORDE", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_AVG_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@MENU_WAVES_CAPS", + "@LUA_MENU_MAX_WAVE_CAPS", + "@LUA_MENU_MAX_WEAPON_LEVEL_CAPS" + }, + ColumnWidths = { + 94, + 75, + 105, + 94, + 80, + 115, + 94 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8, + 9, + 10 + } + }, + AlienHives = { + NumColumns = 3, + Title = "@LUA_MENU_HIVES_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_ALIEN_HIVES", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_ALIEN_HIVES", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_ALIEN_HIVES", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_HIVES_DESTROYED_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_PER_GAME_CAPS" + }, + ColumnWidths = { + 200, + 200, + 200 + }, + DataColumnIndexes = { + 4, + 5, + 6 + } + }, + AlienKills = { + NumColumns = 3, + Title = "@LUA_MENU_KILLS_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_ALIEN_KILLS", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_ALIEN_KILLS", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_ALIEN_KILLS", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_PER_GAME_CAPS" + }, + ColumnWidths = { + 200, + 200, + 200 + }, + DataColumnIndexes = { + 4, + 5, + 6 + } + }, + AlienRevives = { + NumColumns = 5, + Title = "@LUA_MENU_REVIVES_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_ALIEN_REVIVES", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_ALIEN_REVIVES", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_ALIEN_REVIVES", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_REVIVES_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_PER_GAME_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RATIO_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8 + } + }, + AlienDowns = { + NumColumns = 3, + Title = "@LUA_MENU_DOWNED_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_ALIEN_DOWNED", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_ALIEN_DOWNED", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_ALIEN_DOWNED", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_PER_GAME_CAPS" + }, + ColumnWidths = { + 200, + 200, + 200 + }, + DataColumnIndexes = { + 4, + 5, + 6 + } + }, + AlienScore = { + NumColumns = 3, + Title = "@LUA_MENU_SCORE_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_ALIEN_SCORE", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_ALIEN_SCORE", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_ALIEN_SCORE", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_PER_GAME_CAPS" + }, + ColumnWidths = { + 200, + 200, + 200 + }, + DataColumnIndexes = { + 4, + 5, + 6 + } + }, + AlienChallenges = { + NumColumns = 5, + Title = "@LUA_MENU_CHALLENGES_COMPLETED_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_ALIEN_CHALLENGES", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_ALIEN_CHALLENGES", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_ALIEN_CHALLENGES", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_COMPLETED_CAPS", + "@LUA_MENU_ATTEMPTED_CAPS", + "@LUA_MENU_PERCENT_COMPLETED_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_PER_GAME_CAPS" + }, + ColumnWidths = { + 130, + 130, + 140, + 100, + 110 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8 + } + }, + AlienCashFlow = { + NumColumns = 4, + Title = "@LUA_MENU_CASHFLOW_CAPS", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_ALIEN_CASHFLOW", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_ALIEN_CASHFLOW", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_ALIEN_CASHFLOW", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_CASH_EARNED_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS", + "@LUA_MENU_CASH_SPENT_CAPS", + "@LUA_MENU_SPEND_RATE_CAPS" + }, + ColumnWidths = { + 150, + 150, + 150, + 150 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienTownSolo = { + NumColumns = 4, + Title = "@LUA_MENU_POC_SOLO_CAPS", + MapName = "mp_alien_town", + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_TOWN_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_TOWN_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_TOWN_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_HIVES_DESTROYED_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RELICS_USED_CAPS" + }, + ColumnWidths = { + 140, + 180, + 140, + 140 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienTownCoop = { + NumColumns = 4, + Title = "@LUA_MENU_POC_COOP_CAPS", + MapName = "mp_alien_town", + isAlienCoop = true, + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_TOWN_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_TOWN_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_TOWN_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_HIVES_DESTROYED_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RELICS_USED_CAPS" + }, + ColumnWidths = { + 140, + 180, + 140, + 140 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienTownEscapes = { + NumColumns = 5, + Title = "@LUA_MENU_POC_ESCAPES_CAPS", + MapName = "mp_alien_town", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_TOWN_ESCAPES", + DurationDef = Leaderboards.DurationDefs.Alltime + } + }, + HeaderNames = { + "@LUA_MENU_ESCAPES_CAPS", + "@LUA_MENU_PLATINUM_CAPS", + "@LUA_MENU_GOLD_CAPS", + "@LUA_MENU_SILVER_CAPS", + "@LUA_MENU_BRONZE_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7, + 8 + } + }, + AlienArmorySolo = { + NumColumns = 4, + Title = "@LUA_MENU_NIGHTFALL_SOLO_CAPS", + MapName = "mp_alien_armory", + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_ARMORY_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_ARMORY_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_ARMORY_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_HIVES_DESTROYED_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RELICS_USED_CAPS" + }, + ColumnWidths = { + 140, + 180, + 140, + 140 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienArmoryCoop = { + NumColumns = 4, + Title = "@LUA_MENU_NIGHTFALL_COOP_CAPS", + MapName = "mp_alien_armory", + isAlienCoop = true, + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_ARMORY_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_ARMORY_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_ARMORY_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_HIVES_DESTROYED_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RELICS_USED_CAPS" + }, + ColumnWidths = { + 140, + 180, + 140, + 140 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienArmoryEscapes = { + NumColumns = 5, + Title = "@LUA_MENU_NIGHTFALL_ESCAPES_CAPS", + MapName = "mp_alien_armory", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_ARMORY_ESCAPES", + DurationDef = Leaderboards.DurationDefs.Alltime + } + }, + HeaderNames = { + "@LUA_MENU_ESCAPES_CAPS", + "@LUA_MENU_PLATINUM_CAPS", + "@LUA_MENU_GOLD_CAPS", + "@LUA_MENU_SILVER_CAPS", + "@LUA_MENU_BRONZE_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 8, + 7, + 6, + 5 + } + }, + AlienBeaconSolo = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_MAYDAY_SOLO_CAPS", + MapName = "mp_alien_beacon", + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_BEACON_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_BEACON_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_BEACON_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_HIVES_DESTROYED_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RELICS_USED_CAPS" + }, + ColumnWidths = { + 140, + 180, + 140, + 140 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienBeaconCoop = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_MAYDAY_COOP_CAPS", + MapName = "mp_alien_beacon", + isAlienCoop = true, + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_BEACON_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_BEACON_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_BEACON_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_HIVES_DESTROYED_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RELICS_USED_CAPS" + }, + ColumnWidths = { + 140, + 180, + 140, + 140 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienBeaconEscapes = { + NumColumns = 5, + Title = "@LUA_MENU_MP_LEADERBOARD_MAYDAY_ESCAPES_CAPS", + MapName = "mp_alien_beacon", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_BEACON_ESCAPES", + DurationDef = Leaderboards.DurationDefs.Alltime + } + }, + HeaderNames = { + "@LUA_MENU_ESCAPES_CAPS", + "@LUA_MENU_PLATINUM_CAPS", + "@LUA_MENU_GOLD_CAPS", + "@LUA_MENU_SILVER_CAPS", + "@LUA_MENU_BRONZE_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 8, + 7, + 6, + 5 + } + }, + AlienDlc3Solo = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_DLC3_SOLO_CAPS", + MapName = "mp_alien_dlc3", + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_DLC3_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_DLC3_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_DLC3_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_MP_OBELISKS_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RELICS_USED_CAPS" + }, + ColumnWidths = { + 140, + 180, + 140, + 140 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienDlc3Coop = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_DLC3_COOP_CAPS", + MapName = "mp_alien_dlc3", + isAlienCoop = true, + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_DLC3_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_DLC3_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_DLC3_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_MP_OBELISKS_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RELICS_USED_CAPS" + }, + ColumnWidths = { + 140, + 180, + 140, + 140 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienDlc3Escapes = { + NumColumns = 5, + Title = "@LUA_MENU_MP_LEADERBOARD_DLC3_ESCAPES_CAPS", + MapName = "mp_alien_dlc3", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_DLC3_ESCAPES", + DurationDef = Leaderboards.DurationDefs.Alltime + } + }, + HeaderNames = { + "@LUA_MENU_ESCAPES_CAPS", + "@LUA_MENU_PLATINUM_CAPS", + "@LUA_MENU_GOLD_CAPS", + "@LUA_MENU_SILVER_CAPS", + "@LUA_MENU_BRONZE_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 8, + 7, + 6, + 5 + } + }, + AlienLastSolo = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_LAST_SOLO_CAPS", + MapName = "mp_alien_last", + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_LAST_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_LAST_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_LAST_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_MP_GENERATORS_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RELICS_USED_CAPS" + }, + ColumnWidths = { + 140, + 180, + 140, + 140 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienLastCoop = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_LAST_COOP_CAPS", + MapName = "mp_alien_last", + isAlienCoop = true, + HasHardcoreMode = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_LAST_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_LAST_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_LAST_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_MP_GENERATORS_CAPS", + "@LUA_MENU_DOWNED_CAPS", + "@LUA_MENU_RELICS_USED_CAPS" + }, + ColumnWidths = { + 140, + 180, + 140, + 140 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienLastEscapes = { + NumColumns = 5, + Title = "@LUA_MENU_MP_LEADERBOARD_LAST_ESCAPES_CAPS", + MapName = "mp_alien_last", + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_LAST_ESCAPES", + DurationDef = Leaderboards.DurationDefs.Alltime + } + }, + HeaderNames = { + "@LUA_MENU_ESCAPES_CAPS", + "@LUA_MENU_PLATINUM_CAPS", + "@LUA_MENU_GOLD_CAPS", + "@LUA_MENU_SILVER_CAPS", + "@LUA_MENU_BRONZE_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 8, + 7, + 6, + 5 + } + }, + AlienChaosSolo = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_CHAOS_SOLO_CAPS", + chaos = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_ALIEN_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_ALIEN_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_ALIEN_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_AVG_KILLS_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienChaosCoop = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_CHAOS_COOP_CAPS", + chaos = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_GB_ALIEN_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_GB_ALIEN_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_GB_ALIEN_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_GAMES_CAPS", + "@LUA_MENU_AVG_KILLS_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienTownChaosSolo = { + NumColumns = 4, + Title = "@LUA_MENU_POC_SOLO_CAPS", + MapName = "mp_alien_town", + chaos = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_TOWN_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_TOWN_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_TOWN_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_MP_COMBO_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienTownChaosCoop = { + NumColumns = 4, + Title = "@LUA_MENU_POC_COOP_CAPS", + MapName = "mp_alien_town", + chaos = true, + isAlienCoop = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_TOWN_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_TOWN_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_TOWN_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_MP_COMBO_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienArmoryChaosSolo = { + NumColumns = 4, + Title = "@LUA_MENU_NIGHTFALL_SOLO_CAPS", + MapName = "mp_alien_armory", + chaos = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_ARMORY_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_ARMORY_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_ARMORY_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_MP_COMBO_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienArmoryChaosCoop = { + NumColumns = 4, + Title = "@LUA_MENU_NIGHTFALL_COOP_CAPS", + MapName = "mp_alien_armory", + chaos = true, + isAlienCoop = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_ARMORY_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_ARMORY_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_ARMORY_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_MP_COMBO_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienBeaconChaosSolo = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_MAYDAY_SOLO_CAPS", + MapName = "mp_alien_beacon", + chaos = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_BEACON_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_BEACON_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_BEACON_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_MP_COMBO_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienBeaconChaosCoop = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_MAYDAY_COOP_CAPS", + MapName = "mp_alien_beacon", + chaos = true, + isAlienCoop = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_BEACON_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_BEACON_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_BEACON_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_MP_COMBO_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienDlc3ChaosSolo = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_DLC3_SOLO_CAPS", + MapName = "mp_alien_dlc3", + chaos = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_DLC3_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_DLC3_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_DLC3_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_MP_COMBO_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienDlc3ChaosCoop = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_DLC3_COOP_CAPS", + MapName = "mp_alien_dlc3", + chaos = true, + isAlienCoop = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_DLC3_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_DLC3_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_DLC3_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_MP_COMBO_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienLastChaosSolo = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_LAST_SOLO_CAPS", + MapName = "mp_alien_last", + chaos = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_LAST_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_LAST_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_LAST_CHAOS_SOLO", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_MP_COMBO_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + }, + AlienLastChaosCoop = { + NumColumns = 4, + Title = "@LUA_MENU_MP_LEADERBOARD_LAST_COOP_CAPS", + MapName = "mp_alien_last", + chaos = true, + isAlienCoop = true, + DefaultDurationKey = "Alltime", + Durations = { + Alltime = { + File = "LB_MP_ALIEN_LAST_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Alltime + }, + Weekly = { + File = "LB_MP_ALIEN_LAST_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Weekly + }, + Monthly = { + File = "LB_MP_ALIEN_LAST_CHAOS_COOP", + DurationDef = Leaderboards.DurationDefs.Monthly + } + }, + HeaderNames = { + "@LUA_MENU_SCORE_CAPS", + "@LUA_MENU_KILLS_CAPS", + "@LUA_MENU_MP_COMBO_CAPS", + "@LUA_MENU_TIME_PLAYED_CAPS" + }, + ColumnWidths = { + 125, + 125, + 125, + 125 + }, + DataColumnIndexes = { + 4, + 5, + 6, + 7 + } + } +} +Leaderboards.OpenLeaderboard = function ( f1_arg0, f1_arg1, f1_arg2, f1_arg3, f1_arg4 ) + Engine.SetDvarString( "lb_filter", Leaderboards.GetLeaderboardFilterValue( f1_arg2 ) ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + f1_local0.filterDurationKey = f1_arg3 + f1_local0.isHardcore = f1_arg4 + f1_arg0:dispatchEventToRoot( { + name = "aar_set_subtitle_text", + new_text = Engine.Localize( Leaderboards.GetLeaderboardFilterTitle( f1_arg2 ), Engine.Localize( Leaderboards.GetLeaderboardTitle( f1_arg1 ) ) ) + } ) + local f1_local1 = f1_arg0.properties.exclusiveController + if not f1_local1 then + f1_local1 = Engine.GetFirstActiveController() + end + local f1_local2 = Leaderboards.GetLeaderboardDurationDef( f1_arg1, f1_arg3 ) + Leaderboards.Open( Leaderboards.GetLeaderboardDurationFile( f1_arg1, f1_arg3, f1_arg4 ), f1_local2.Duration ) + Leaderboards.UpdateLeaderboard( f1_local1, Leaderboards.GetCurrentIndex( f1_local1 ) ) +end + +Leaderboards.LeaderboardFilterGetDurationKeys = function ( f2_arg0 ) + local f2_local0 = {} + for f2_local4, f2_local5 in pairs( Leaderboards.Boards[f2_arg0].Durations ) do + f2_local0[#f2_local0 + 1] = f2_local4 + end + return f2_local0 +end + +Leaderboards.GetLeaderboardTitle = function ( f3_arg0 ) + return Leaderboards.Boards[f3_arg0].Title +end + +Leaderboards.GetLeaderboardNumColumns = function ( f4_arg0 ) + return Leaderboards.Boards[f4_arg0].NumColumns +end + +Leaderboards.GetLeaderboardDefaultDurationKey = function ( f5_arg0 ) + return Leaderboards.Boards[f5_arg0].DefaultDurationKey +end + +Leaderboards.GetLeaderboardHasHardcoreMode = function ( f6_arg0 ) + return Leaderboards.Boards[f6_arg0].HasHardcoreMode +end + +Leaderboards.GetLeaderboardHeaderName = function ( f7_arg0, f7_arg1 ) + return Leaderboards.Boards[f7_arg0].HeaderNames[f7_arg1] +end + +Leaderboards.GetLeaderboardColumnWidth = function ( f8_arg0, f8_arg1 ) + return Leaderboards.Boards[f8_arg0].ColumnWidths[f8_arg1] +end + +Leaderboards.GetLeaderboardDataColumnIndex = function ( f9_arg0, f9_arg1 ) + return Leaderboards.Boards[f9_arg0].DataColumnIndexes[f9_arg1] +end + +Leaderboards.GetLeaderboardDurationFile = function ( f10_arg0, f10_arg1, f10_arg2 ) + local f10_local0 = Leaderboards.Boards[f10_arg0].Durations[f10_arg1].File + if f10_arg2 then + f10_local0 = f10_local0 .. "_HC" + end + return f10_local0 +end + +Leaderboards.GetLeaderboardDurationDef = function ( f11_arg0, f11_arg1 ) + return Leaderboards.Boards[f11_arg0].Durations[f11_arg1].DurationDef +end + +Leaderboards.GetLeaderboardByGameType = function ( f12_arg0 ) + local f12_local0 = nil + for f12_local4, f12_local5 in pairs( Leaderboards.Boards ) do + if f12_local5.GameType ~= nil and f12_local5.GameType == f12_arg0 then + f12_local0 = f12_local4 + end + end + return f12_local0 +end + +Leaderboards.GetAlienCoopLeaderboardByMapName = function ( f13_arg0 ) + local f13_local0 = LUI.mp_menus.Aliens.IsChaosEnabled() + local f13_local1 = nil + for f13_local5, f13_local6 in pairs( Leaderboards.Boards ) do + if f13_local6.isAlienCoop and (not (f13_local0 or f13_local6.chaos) or f13_local0 and f13_local6.chaos) and f13_local6.MapName ~= nil and f13_local6.MapName == f13_arg0 then + f13_local1 = f13_local5 + end + end + return f13_local1 +end + +Leaderboards.GetLeaderboardFilterTitle = function ( f14_arg0 ) + return Leaderboards.Filters[f14_arg0].Title +end + +Leaderboards.GetLeaderboardFilterOptionText = function ( f15_arg0 ) + return Leaderboards.Filters[f15_arg0].OptionText +end + +Leaderboards.GetLeaderboardFilterValue = function ( f16_arg0 ) + return Leaderboards.Filters[f16_arg0].Value +end + diff --git a/lui/mp_menus/loadoutbuilder.dec.lua b/lui/mp_menus/loadoutbuilder.dec.lua new file mode 100644 index 0000000..f0225fc --- /dev/null +++ b/lui/mp_menus/loadoutbuilder.dec.lua @@ -0,0 +1,2098 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = { + Type = { + "TrackedOps", + "ProgressedOps", + "MostOps", + "Random" + }, + TypeConfigs = { + TrackedOps = { + name = "lb_type_tracked", + text = Engine.Localize( "LUA_MENU_MP_LB_TYPE_TRACKED" ), + desc = Engine.Localize( "LUA_MENU_MP_LB_TYPE_DESC_TRACKED" ), + type = "TrackedOps" + }, + ProgressedOps = { + name = "lb_type_progressed", + text = Engine.Localize( "LUA_MENU_MP_LB_TYPE_PROGRESSED" ), + desc = Engine.Localize( "LUA_MENU_MP_LB_TYPE_DESC_PROGRESSED" ), + type = "ProgressedOps" + }, + MostOps = { + name = "lb_type_most", + text = Engine.Localize( "LUA_MENU_MP_LB_TYPE_MOST" ), + desc = Engine.Localize( "LUA_MENU_MP_LB_TYPE_DESC_MOST" ), + type = "MostOps" + }, + Random = { + name = "lb_type_random", + text = Engine.Localize( "LUA_MENU_MP_LB_TYPE_RANDOM" ), + desc = Engine.Localize( "LUA_MENU_MP_LB_TYPE_DESC_RANDOM" ), + type = "Random" + } + }, + LoadoutBuilderTable = { + File = "mp/loadoutBuilderTable.csv", + MaxItems = 3, + MaxRows = 1000, + Cols = { + ChallengeRef = 0, + Type1 = 1, + Item1 = 2, + Weight1 = 3 + } + }, + ScopedName = "cac_edit_main", + MinPerksForSpecialst = 7, + AttachmentSettings = { + UnderbarrelWeaponNames = { + "gl", + "shotgun" + } + }, + WeaponSettings = { + Primary = { + MaxDefaultAttachments = 2, + DefaultWeapon = "iw6_knifeonly", + DefaultWeaponBaseName = "knifeonly" + }, + Secondary = { + MaxDefaultAttachments = 1, + DefaultWeapon = "none", + DefaultWeaponBaseName = "none" + }, + PrimaryGrenade = { + DefaultWeapon = "specialty_null" + }, + SecondaryGrenade = { + DefaultWeapon = "specialty_null" + }, + TypeLists = { + "primaryWeapons", + "secondaryWeapons" + } + }, + KillstreakTypes = { + streaktype_assault = { + DataName = "assaultStreaks" + }, + streaktype_support = { + DataName = "supportStreaks" + }, + streaktype_specialist = { + DataName = "specialistStreaks" + } + }, + Explosives = { + Weapons = { + "iw6_rgm", + "iw6_panzerfaust3", + "iw6_mk32" + }, + Grenades = { + "frag_grenade_mp", + "semtex_mp", + "proximity_explosive_mp", + "c4_mp", + "mortar_shell_mp", + "flash_grenade_mp", + "concussion_grenade_mp", + "thermobaric_grenade_mp" + }, + Attachments = { + "gl" + } + }, + ChallengeItemsLists = { + "primaryWeapons", + "secondaryWeapons", + "primaryGrenades", + "secondaryGrenades", + "abilities", + "assaultStreaks", + "supportStreaks" + }, + Layout = { + TypeButton = { + Height = CoD.TextSettings.NormalFont.Height * 2 + 10 + } + } +} +function IsLoadoutBuilderButtonAnimEnabled() + return false +end + +function IsLoadoutBuilderEnabled() + return Engine.GetDvarInt( "ui_lbDisable" ) ~= 1 +end + +function AbilityRule_RequiresPrimary( f3_arg0 ) + local f3_local0 = Cac.GetWeapon( f3_arg0.controller, f3_arg0.squadLocation, f3_arg0.memberIndex, f3_arg0.classLocation, f3_arg0.loadoutSlot, Cac.Indices.Weapons.Primary ) + local f3_local1 = f3_local0 + local f3_local2 + if f3_local0 == "" or f3_local0 == f0_local0.WeaponSettings.Primary.DefaultWeapon then + f3_local2 = false + else + f3_local2 = f3_local1 and true + end + return f3_local2 +end + +function AbilityRule_RequiresStandardPrimary( f4_arg0 ) + local f4_local0 = Cac.GetWeapon( f4_arg0.controller, f4_arg0.squadLocation, f4_arg0.memberIndex, f4_arg0.classLocation, f4_arg0.loadoutSlot, Cac.Indices.Weapons.Primary ) + local f4_local1 = f4_local0 + local f4_local2 + if f4_local0 == "" or f4_local0 == f0_local0.WeaponSettings.Primary.DefaultWeapon or f4_local0 == "iw6_riotshield" then + f4_local2 = false + else + f4_local2 = f4_local1 and true + end + return f4_local2 +end + +function AbilityRule_RequiresSecondary( f5_arg0 ) + local f5_local0 = Cac.GetWeapon( f5_arg0.controller, f5_arg0.squadLocation, f5_arg0.memberIndex, f5_arg0.classLocation, f5_arg0.loadoutSlot, Cac.Indices.Weapons.Secondary ) + local f5_local1 = f5_local0 + local f5_local2 + if f5_local0 == "" or f5_local0 == f0_local0.WeaponSettings.Secondary.DefaultWeapon then + f5_local2 = false + else + f5_local2 = f5_local1 and true + end + return f5_local2 +end + +function AbilityRule_RequiresGun( f6_arg0 ) + local f6_local0 = AbilityRule_RequiresStandardPrimary( f6_arg0 ) + if not f6_local0 then + f6_local0 = AbilityRule_RequiresSecondary( f6_arg0 ) + end + return f6_local0 +end + +function AbilityRule_RequiresPrimaryGrenade( f7_arg0 ) + local f7_local0 = Cac.GetGrenade( f7_arg0.controller, f7_arg0.squadLocation, f7_arg0.memberIndex, f7_arg0.classLocation, f7_arg0.loadoutSlot, Cac.Indices.Grenade.Primary ) + local f7_local1 = f7_local0 + local f7_local2 + if f7_local0 == "" or f7_local0 == f0_local0.WeaponSettings.PrimaryGrenade.DefaultWeapon then + f7_local2 = false + else + f7_local2 = f7_local1 and true + end + return f7_local2 +end + +function AbilityRule_RequiresSecondaryGrenade( f8_arg0 ) + local f8_local0 = Cac.GetGrenade( f8_arg0.controller, f8_arg0.squadLocation, f8_arg0.memberIndex, f8_arg0.classLocation, f8_arg0.loadoutSlot, Cac.Indices.Grenade.Secondary ) + local f8_local1 = f8_local0 + local f8_local2 + if f8_local0 == "" or f8_local0 == f0_local0.WeaponSettings.SecondaryGrenade.DefaultWeapon then + f8_local2 = false + else + f8_local2 = f8_local1 and true + end + return f8_local2 +end + +function AbilityRule_RequiresGrenade( f9_arg0 ) + local f9_local0 = AbilityRule_RequiresPrimaryGrenade( f9_arg0 ) + if not f9_local0 then + f9_local0 = AbilityRule_RequiresSecondaryGrenade( f9_arg0 ) + end + return f9_local0 +end + +function AbilityRule_RequiresAnyWeapon( f10_arg0 ) + local f10_local0 = AbilityRule_RequiresGun( f10_arg0 ) + if not f10_local0 then + f10_local0 = AbilityRule_RequiresGrenade( f10_arg0 ) + end + return f10_local0 +end + +function AbilityRule_RequiresTwoPrimariesUnlocked( f11_arg0 ) + return #f11_arg0.unlocks.primaryWeapons >= 3 +end + +function AbilityRule_RequiresExplosive( f12_arg0 ) + if LUI.IsItemInArray( f0_local0.Explosives.Grenades, Cac.GetGrenade( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Grenade.Primary ) ) or LUI.IsItemInArray( Cac.GetGrenade( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Grenade.Secondary ), f0_local0.Explosives.Grenades ) then + return true + end + if LUI.IsItemInArray( f0_local0.Explosives.Weapons, Cac.GetWeapon( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Weapons.Primary ) ) or LUI.IsItemInArray( f0_local0.Explosives.Weapons, Cac.GetWeapon( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Weapons.Secondary ) ) then + return true + end + local f12_local0 = Cac.GetAttachments( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Weapons.Primary ) + LUI.ConcatenateToTable( f12_local0, Cac.GetAttachments( f12_arg0.controller, f12_arg0.squadLocation, f12_arg0.memberIndex, f12_arg0.classLocation, f12_arg0.loadoutSlot, Cac.Indices.Weapons.Secondary ) ) + for f12_local4, f12_local5 in pairs( f12_local0 ) do + if LUI.IsItemInArray( f0_local0.Explosives.Attachments, f12_local5 ) then + return true + end + end +end + +AbilityRuleTable = { + specialty_fastsprintrecovery = { + AbilityRule_RequiresGun + }, + specialty_fastreload = { + AbilityRule_RequiresGun + }, + specialty_lightweight = nil, + specialty_marathon = nil, + specialty_stalker = { + AbilityRule_RequiresGun + }, + specialty_pitcher = { + AbilityRule_RequiresGrenade + }, + specialty_sprintreload = { + AbilityRule_RequiresGun + }, + specialty_quickswap = { + AbilityRule_RequiresPrimary, + AbilityRule_RequiresSecondary + }, + specialty_bulletaccuracy = { + AbilityRule_RequiresGun + }, + specialty_quickdraw = { + AbilityRule_RequiresGun + }, + specialty_silentkill = nil, + specialty_blindeye = nil, + specialty_quieter = nil, + specialty_incog = nil, + specialty_gpsjammer = nil, + specialty_paint = { + AbilityRule_RequiresExplosive + }, + specialty_scavenger = { + AbilityRule_RequiresGun + }, + specialty_detectexplosive = nil, + specialty_selectivehearing = nil, + specialty_comexp = nil, + specialty_falldamage = nil, + specialty_regenfaster = nil, + specialty_sharp_focus = { + AbilityRule_RequiresGun + }, + specialty_stun_resistance = nil, + _specialty_blastshield = nil, + specialty_extra_equipment = { + AbilityRule_RequiresSecondaryGrenade + }, + specialty_extra_deadly = { + AbilityRule_RequiresPrimaryGrenade + }, + specialty_extraammo = { + AbilityRule_RequiresGun + }, + specialty_extra_attachment = { + AbilityRule_RequiresGun + }, + specialty_explosivedamage = { + AbilityRule_RequiresExplosive + }, + specialty_gambler = nil, + specialty_hardline = nil, + specialty_boom = nil, + specialty_twoprimaries = { + AbilityRule_RequiresPrimary, + AbilityRule_RequiresSecondary, + AbilityRule_RequiresTwoPrimariesUnlocked + }, + specialty_deadeye = { + AbilityRule_RequiresGun + } +} +function CheckAbilityRules( f13_arg0, f13_arg1, f13_arg2, f13_arg3, f13_arg4, f13_arg5, f13_arg6 ) + local f13_local0 = { + controller = f13_arg0, + squadLocation = f13_arg3, + memberIndex = f13_arg4, + loadoutSlot = f13_arg6, + classLocation = f13_arg5, + unlocks = f13_arg2, + ability = f13_arg1 + } + local f13_local1 = AbilityRuleTable[f13_arg1] + if f13_local1 then + for f13_local5, f13_local6 in pairs( f13_local1 ) do + if not f13_local6( f13_local0 ) then + return false + end + end + end + return true +end + +function ApplyAbilityRulesToList( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5, f14_arg6 ) + for f14_local0 = #f14_arg1, 1, -1 do + if not CheckAbilityRules( f14_arg0, f14_arg1[f14_local0], f14_arg2, f14_arg3, f14_arg4, f14_arg5, f14_arg6 ) then + table.remove( f14_arg1, f14_local0 ) + end + end +end + +function IsAttachmentAnUnderbarrelWeapon( f15_arg0 ) + for f15_local3, f15_local4 in pairs( f0_local0.AttachmentSettings.UnderbarrelWeaponNames ) do + if f15_arg0 == f15_local4 then + return true + end + end +end + +function SelectRandomUnlockedWeapon( f16_arg0, f16_arg1 ) + local f16_local0 = math.random( 1, #f16_arg0 ) + for f16_local1 = 0, #f16_arg0 - 1, 1 do + local f16_local4 = f16_local0 + f16_local1 + if #f16_arg0 < f16_local4 then + f16_local4 = f16_local4 - #f16_arg0 + end + local f16_local5 = f16_arg0[f16_local4] + local f16_local6 = false + for f16_local10, f16_local11 in pairs( f16_arg1 ) do + if f16_local5.name == f16_local11 then + f16_local6 = true + break + end + end + if not f16_local6 then + return f16_local5 + end + end +end + +function SelectRandomAbilityFromList( f17_arg0, f17_arg1 ) + if #f17_arg0 < 1 then + return + end + local f17_local0 = math.random( 1, #f17_arg0 ) + for f17_local1 = 0, #f17_arg0 - 1, 1 do + local f17_local4 = f17_local0 + f17_local1 + if #f17_arg0 < f17_local4 then + f17_local4 = f17_local4 - #f17_arg0 + end + local f17_local5 = f17_arg0[f17_local4] + local f17_local6 = tonumber( Cac.GetPerkCost( f17_local5 ) ) + if f17_local6 <= f17_arg1 then + return f17_local5, f17_local6, f17_local4 + end + end +end + +function SelectRandomKillstreakFromList( f18_arg0, f18_arg1 ) + local f18_local0 = math.random( 1, #f18_arg0 ) + for f18_local1 = 0, #f18_arg0 - 1, 1 do + local f18_local4 = f18_local0 + f18_local1 + if #f18_arg0 < f18_local4 then + f18_local4 = f18_local4 - #f18_arg0 + end + local f18_local5 = false + local f18_local6 = f18_arg0[f18_local4] + local f18_local7 = Cac.GetStreakCost( f18_local6 ) + for f18_local11, f18_local12 in pairs( f18_arg1 ) do + if f18_local6 == f18_local12 then + f18_local5 = true + break + end + if f18_local7 == Cac.GetStreakCost( f18_local12 ) then + f18_local5 = true + break + end + end + if not f18_local5 then + return f18_local6 + end + end +end + +function SelectRandomAttachmentFromList( f19_arg0, f19_arg1, f19_arg2 ) + local f19_local0 = math.random( 1, #f19_arg0 ) + for f19_local1 = 0, #f19_arg0 - 1, 1 do + local f19_local4 = f19_local0 + f19_local1 + if #f19_arg0 < f19_local4 then + f19_local4 = f19_local4 - #f19_arg0 + end + local f19_local5 = false + local f19_local6 = f19_arg0[f19_local4] + local f19_local7 = Cac.GetAttachmentType( f19_local6 ) + for f19_local11, f19_local12 in pairs( f19_arg1 ) do + if f19_local7 == Cac.GetAttachmentType( f19_local12 ) then + f19_local5 = true + end + end + if not f19_local5 and f19_arg2 then + for f19_local11, f19_local12 in pairs( f19_arg2 ) do + if f19_local6 == f19_local12 then + f19_local5 = true + end + end + end + if not f19_local5 then + return f19_local6 + end + end +end + +function SelectRandomAttachmentsForWeapon( f20_arg0, f20_arg1, f20_arg2, f20_arg3 ) + if not f20_arg0.unlockedAttachments or #f20_arg0.unlockedAttachments == 0 then + return + end + for f20_local0 = 1, f20_arg1, 1 do + local f20_local3 = f20_local0 + local f20_local4 = SelectRandomAttachmentFromList( f20_arg0.unlockedAttachments, f20_arg2, f20_arg3 ) + if f20_local4 then + f20_arg2[#f20_arg2 + 1] = f20_local4 + end + end +end + +function GetUnlockedItems() + local f21_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + return f21_local0.unlockedItems +end + +function CacheWeapon( f22_arg0, f22_arg1 ) + local f22_local0 = GetUnlockedItems() + if f22_arg1 == f0_local0.WeaponSettings.Primary.DefaultWeapon or f22_arg1 == f0_local0.WeaponSettings.Secondary.DefaultWeapon then + return + end + local f22_local1 = Cac.GetWeaponClass( f22_arg1 ) + assert( f22_local1 ) + if f22_local1 == "" then + local f22_local2 = Cac.IsPrimaryGrenade( f22_arg1 ) + assert( f22_local2 or Cac.IsSecondaryGrenade( f22_arg1 ), "Weapon is not a primary/secondary weapon or lethal/tactical" ) + local f22_local3 + if f22_local2 then + f22_local3 = "primaryGrenades" + if not f22_local3 then + + else + f22_local0[f22_local3][#f22_local0[f22_local3] + 1] = f22_arg1 + end + end + f22_local3 = "secondaryGrenades" + else + local f22_local3 + if Cac.IsWeaponClassPrimary( f22_local1 ) then + f22_local3 = "primaryWeapons" + if not f22_local3 then + + else + f22_local0[f22_local3][#f22_local0[f22_local3] + 1] = { + name = f22_arg1, + baseName = string.sub( f22_arg1, string.len( "iw6_" ) + 1 ), + unlockedAttachments = {} + } + end + end + f22_local3 = "secondaryWeapons" + end +end + +function CacheAttachment( f23_arg0, f23_arg1 ) + local f23_local0 = GetUnlockedItems() + local f23_local1, f23_local2 = string.find( f23_arg1, ".+_" ) + assert( f23_local2 and f23_local1 and f23_local2 > 1 ) + local f23_local3 = string.sub( f23_arg1, f23_local1, f23_local2 - 1 ) + local f23_local4 = string.sub( f23_arg1, f23_local2 + 1 ) + local f23_local5 = Engine.TableLookupGetRowNum( StatsTable.File, StatsTable.Cols.WeaponRef, "iw6_" .. f23_local3 ) + assert( f23_local5 and f23_local5 >= 0 ) + local f23_local6 = false + for f23_local7 = StatsTable.Cols.WeaponAttachFirst, StatsTable.Cols.WeaponAttachLast, 1 do + local f23_local10 = Engine.TableLookupByRow( StatsTable.File, f23_local5, f23_local7 ) + if f23_local10 and f23_local10 == f23_local4 then + f23_local6 = true + break + end + end + if not f23_local6 then + return + end + local f23_local7 = nil + for f23_local15, f23_local16 in pairs( { + f23_local0.primaryWeapons, + f23_local0.secondaryWeapons + } ) do + for f23_local12, f23_local13 in pairs( f23_local16 ) do + if f23_local13.baseName == f23_local3 then + f23_local7 = f23_local13 + end + end + end + if f23_local7 then + f23_local7.unlockedAttachments[#f23_local7.unlockedAttachments + 1] = f23_local4 + end +end + +function CacheKillstreak( f24_arg0, f24_arg1 ) + local f24_local0 = GetUnlockedItems() + local f24_local1 = Cac.GetKillstreakType( f24_arg1 ) + assert( f24_local1 ) + local f24_local2 + if f24_local1 == "streaktype_assault" then + f24_local2 = "assaultStreaks" + if not f24_local2 then + + else + f24_local0[f24_local2][#f24_local0[f24_local2] + 1] = f24_arg1 + end + end + f24_local2 = "supportStreaks" +end + +function CacheAbility( f25_arg0, f25_arg1 ) + local f25_local0 = GetUnlockedItems() + f25_local0.abilities[#f25_local0.abilities + 1] = f25_arg1 +end + +f0_local1 = { + weapon = CacheWeapon, + killstreak = CacheKillstreak, + perk = CacheAbility, + attachment = CacheAttachment +} +function IsItemUnlocked( f26_arg0, f26_arg1, f26_arg2, f26_arg3, f26_arg4, f26_arg5, f26_arg6 ) + if f26_arg6 == "weapon" then + if Cac.IsWeaponEntitlement( f26_arg5 ) then + if not Cac.IsWeaponEntitlementUnlocked( f26_arg0, f26_arg5 ) then + return false + elseif Cac.ShouldHideWeaponEntitlement( f26_arg0, f26_arg5 ) then + return false + end + end + elseif f26_arg6 == "perk" then + return Cac.IsPerkUnlocked( f26_arg0, f26_arg1, f26_arg2, f26_arg5 ) + end + return Cac.IsItemUnlocked( f26_arg0, f26_arg1, f26_arg2, f26_arg5 ) +end + +function CacheUnlockedItems( f27_arg0 ) + local f27_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + f27_local0.unlockedItems = { + primaryWeapons = {}, + secondaryWeapons = {}, + primaryGrenades = {}, + secondaryGrenades = {}, + assaultStreaks = {}, + supportStreaks = {}, + abilities = {} + } + local f27_local1 = 1500 + for f27_local2 = 0, f27_local1 - 1, 1 do + local f27_local5 = Engine.TableLookupByRow( Cac.WeaponUnlockTable.File, f27_local2, Cac.WeaponUnlockTable.Cols.Type ) + if f27_local5 and f27_local5 ~= "" then + local f27_local6 = Engine.TableLookupByRow( Cac.WeaponUnlockTable.File, f27_local2, Cac.WeaponUnlockTable.Cols.WeaponRef ) + if f27_local6 and f27_local6 ~= "" and IsItemUnlocked( f27_arg0, f27_local0.squadLocation, f27_local0.memberIndex, f27_local0.classLocation, f27_local0.loadoutLocation, f27_local6, f27_local5 ) then + local f27_local7 = f0_local1[f27_local5] + if f27_local7 then + f27_local7( f27_arg0, f27_local6 ) + end + end + end + end + f27_local0.unlockedItems.primaryWeapons[#f27_local0.unlockedItems.primaryWeapons + 1] = { + name = f0_local0.WeaponSettings.Primary.DefaultWeapon, + baseName = f0_local0.WeaponSettings.Primary.DefaultWeaponBaseName, + unlockedAttachments = {} + } + f27_local0.unlockedItems.secondaryWeapons[#f27_local0.unlockedItems.secondaryWeapons + 1] = { + name = f0_local0.WeaponSettings.Secondary.DefaultWeapon, + baseName = f0_local0.WeaponSettings.Secondary.DefaultWeaponBaseName, + unlockedAttachments = {} + } + f27_local0.unlockedItems.primaryGrenades[#f27_local0.unlockedItems.primaryGrenades + 1] = f0_local0.WeaponSettings.PrimaryGrenade.DefaultWeapon + f27_local0.unlockedItems.secondaryGrenades[#f27_local0.unlockedItems.secondaryGrenades + 1] = f0_local0.WeaponSettings.SecondaryGrenade.DefaultWeapon + return f27_local0.unlockedItems +end + +function AddWeightForItemInList( f28_arg0, f28_arg1, f28_arg2 ) + for f28_local3, f28_local4 in pairs( f28_arg0 ) do + if f28_local4.name == f28_arg1 then + f28_local4.weight = f28_local4.weight + f28_arg2 + return true + end + end + return false +end + +function AddWeightForKillstreakType( f29_arg0, f29_arg1, f29_arg2 ) + assert( Cac.Streaks[f29_arg1], "Invalid killstreak type " .. f29_arg1 .. " loaded from LoadoutBuilder.csv." ) + f29_arg0.killstreakTypes[f29_arg1].weight = f29_arg0.killstreakTypes[f29_arg1].weight + f29_arg2 +end + +function AddWeightForPerk( f30_arg0, f30_arg1, f30_arg2 ) + assert( f30_arg1 == 1, "Perk weights are assumed to be one. This could be changed, but when regular perks are picked, it has to lower the weight of the specialisttype by the appropriate amount." ) + assert( Cac.GetPerkCost( f30_arg0 ), "Could not get perk cost for perk " .. f30_arg0 .. ". Is this a valid perk? (from LoadoutBuilder.csv)" ) + if AddWeightForItemInList( f30_arg2.abilities, f30_arg0, f30_arg1 ) then + AddWeightForKillstreakType( f30_arg2, "streaktype_specialist", f30_arg1 ) + end +end + +f0_local2 = { + perk = function ( f31_arg0, f31_arg1, f31_arg2, f31_arg3 ) + AddWeightForPerk( f31_arg1, f31_arg2, f31_arg3 ) + end, + attachment = function ( f32_arg0, f32_arg1, f32_arg2, f32_arg3 ) + if f32_arg1 == "no_attach" then + + else + + end + for f32_local6, f32_local7 in pairs( f0_local0.WeaponSettings.TypeLists ) do + for f32_local3, f32_local4 in pairs( f32_arg3[f32_local7] ) do + AddWeightForItemInList( f32_local4.attachments, f32_arg1, f32_arg2 ) + end + end + end, + weaponclass = function ( f33_arg0, f33_arg1, f33_arg2, f33_arg3 ) + assert( Cac.Weapons[f33_arg1], "Unknown weaponclass " .. f33_arg1 .. " loaded from LoadoutBuilder.csv." ) + for f33_local6, f33_local7 in pairs( f0_local0.WeaponSettings.TypeLists ) do + for f33_local3, f33_local4 in pairs( f33_arg3[f33_local7] ) do + if f33_local4.weaponClass == f33_arg1 then + f33_local4.weight = f33_local4.weight + f33_arg2 + end + end + end + end, + weapon = function ( f34_arg0, f34_arg1, f34_arg2, f34_arg3 ) + assert( Cac.GetWeaponClass( f34_arg1 ), "Unknown weapon " .. f34_arg1 .. " loaded from LoadoutBuilder.csv." ) + for f34_local3, f34_local4 in pairs( f0_local0.WeaponSettings.TypeLists ) do + AddWeightForItemInList( f34_arg3[f34_local4], f34_arg1, f34_arg2 ) + end + end, + grenade = function ( f35_arg0, f35_arg1, f35_arg2, f35_arg3 ) + assert( LUI.IsItemInArray( Cac.PrimaryGrenades, f35_arg1 ), "Unknown primary (lethal) grenade " .. f35_arg1 .. " loaded from LoadoutBuilder.csv." ) + AddWeightForItemInList( f35_arg3.primaryGrenades, f35_arg1, f35_arg2 ) + end, + tactical = function ( f36_arg0, f36_arg1, f36_arg2, f36_arg3 ) + assert( LUI.IsItemInArray( Cac.SecondaryGrenades, f36_arg1 ), "Unknown secondary (tactical) grenade " .. f36_arg1 .. " loaded from LoadoutBuilder.csv." ) + AddWeightForItemInList( f36_arg3.secondaryGrenades, f36_arg1, f36_arg2 ) + end, + streaktype_assault = function ( f37_arg0, f37_arg1, f37_arg2, f37_arg3 ) + assert( Cac.GetKillstreakType( f37_arg1 ) == "streaktype_assault", "Invalid assault killstreak " .. f37_arg1 .. " loaded from LoadoutBuilder.csv." ) + if AddWeightForItemInList( f37_arg3.assaultStreaks, f37_arg1, f37_arg2 ) then + AddWeightForKillstreakType( f37_arg3, "streaktype_assault", f37_arg2 ) + end + end, + streaktype_support = function ( f38_arg0, f38_arg1, f38_arg2, f38_arg3 ) + assert( Cac.GetKillstreakType( f38_arg1 ) == "streaktype_support", "Invalid support killstreak " .. f38_arg1 .. " loaded from LoadoutBuilder.csv." ) + if AddWeightForItemInList( f38_arg3.supportStreaks, f38_arg1, f38_arg2 ) then + AddWeightForKillstreakType( f38_arg3, "streaktype_support", f38_arg2 ) + end + end, + killstreaktype = function ( f39_arg0, f39_arg1, f39_arg2, f39_arg3 ) + AddWeightForKillstreakType( f39_arg3, f39_arg1, f39_arg2 ) + end, + gamemode = function ( f40_arg0, f40_arg1, f40_arg2, f40_arg3 ) + + end, + playlist = function ( f41_arg0, f41_arg1, f41_arg2, f41_arg3 ) + + end, + special = function ( f42_arg0, f42_arg1, f42_arg2, f42_arg3 ) + if f42_arg1 == "clueless" then + for f42_local3, f42_local4 in pairs( f42_arg3.secondaryWeapons ) do + if f42_local4.name == "iw6_magnum" then + f42_local4.weight = f42_local4.weight + f42_arg2 + AddWeightForItemInList( f42_local4.attachments, "akimbo", f42_arg2 ) + AddWeightForItemInList( f42_local4.attachments, "acog", f42_arg2 ) + break + end + end + AddWeightForPerk( "specialty_extra_attachment", f42_arg2, f42_arg3 ) + elseif f42_arg1 == "twoweapons" then + + else + assert( nil, "Unhandled \"special\" item " .. f42_arg1 .. " from LoadoutBuilder.csv" ) + end + end +} +function ProcessItemForChallenge( f43_arg0, f43_arg1, f43_arg2, f43_arg3, f43_arg4 ) + local f43_local0 = f0_local2[f43_arg1] + assert( f43_local0 ) + if f43_local0 then + f43_local0( f43_arg0, f43_arg2, f43_arg3, f43_arg4 ) + end +end + +function ProcessLoadoutBuilderTableRow( f44_arg0, f44_arg1, f44_arg2 ) + for f44_local0 = 1, f0_local0.LoadoutBuilderTable.MaxItems, 1 do + local f44_local3 = f0_local0.LoadoutBuilderTable.Cols.Type1 + (f44_local0 - 1) * f0_local0.LoadoutBuilderTable.MaxItems + local f44_local4 = f0_local0.LoadoutBuilderTable.Cols.Item1 + (f44_local0 - 1) * f0_local0.LoadoutBuilderTable.MaxItems + local f44_local5 = f0_local0.LoadoutBuilderTable.Cols.Weight1 + (f44_local0 - 1) * f0_local0.LoadoutBuilderTable.MaxItems + local f44_local6 = Engine.TableLookupByRow( f0_local0.LoadoutBuilderTable.File, f44_arg1, f44_local3 ) + local f44_local7 = Engine.TableLookupByRow( f0_local0.LoadoutBuilderTable.File, f44_arg1, f44_local4 ) + local f44_local8 = Engine.TableLookupByRow( f0_local0.LoadoutBuilderTable.File, f44_arg1, f44_local5 ) + if f44_local8 then + if f44_local8 == "" then + f44_local8 = 1 + else + f44_local8 = tonumber( f44_local8 ) + end + else + f44_local8 = 1 + end + if f44_local6 and f44_local6 ~= "" and f44_local7 and f44_local7 ~= "" then + assert( f44_local8 ) + ProcessItemForChallenge( f44_arg0, f44_local6, f44_local7, f44_local8, f44_arg2 ) + end + local f44_local9 = assert + local f44_local10 + if f44_local6 and f44_local6 ~= "" and f44_local7 and f44_local7 ~= "" then + f44_local10 = false + else + f44_local10 = true + end + f44_local9( f44_local10, "LoadoutBuilderTable.csv is malformed. Row " .. f44_arg1 .. " does not have correct type/item pairs" ) + end +end + +function ProcessItemsForChallenge( f45_arg0, f45_arg1, f45_arg2 ) + local f45_local0 = Engine.TableLookupGetRowNum( f0_local0.LoadoutBuilderTable.File, f0_local0.LoadoutBuilderTable.Cols.ChallengeRef, f45_arg1 ) + if not f45_local0 or f45_local0 < 0 then + return + else + ProcessLoadoutBuilderTableRow( f45_arg0, f45_local0, f45_arg2 ) + end +end + +function InitChallengeItemTable( f46_arg0 ) + local f46_local0 = { + primaryWeapons = {}, + secondaryWeapons = {}, + primaryGrenades = {}, + secondaryGrenades = {}, + assaultStreaks = {}, + supportStreaks = {}, + abilities = {}, + killstreakTypes = { + streaktype_assault = { + name = "streaktype_assault", + weight = 0 + }, + streaktype_support = { + name = "streaktype_support", + weight = 0 + }, + streaktype_specialist = { + name = "streaktype_specialist", + weight = 0 + } + } + } + local f46_local1 = function ( f47_arg0 ) + local f47_local0 = {} + for f47_local4, f47_local5 in ipairs( f47_arg0 ) do + f47_local0[f47_local4] = { + name = f47_local5, + weight = 0 + } + end + return f47_local0 + end + + for f46_local8, f46_local9 in pairs( f0_local0.WeaponSettings.TypeLists ) do + for f46_local5, f46_local6 in pairs( f46_arg0[f46_local9] ) do + f46_local0[f46_local9][#f46_local0[f46_local9] + 1] = { + name = f46_local6.name, + attachments = f46_local1( f46_local6.unlockedAttachments ), + weaponClass = Cac.GetWeaponClass( f46_local6.name ), + weight = 0 + } + end + end + f46_local0.primaryGrenades = f46_local1( f46_arg0.primaryGrenades ) + f46_local0.secondaryGrenades = f46_local1( f46_arg0.secondaryGrenades ) + f46_local0.abilities = f46_local1( f46_arg0.abilities ) + f46_local0.assaultStreaks = f46_local1( f46_arg0.assaultStreaks ) + f46_local0.supportStreaks = f46_local1( f46_arg0.supportStreaks ) + return f46_local0 +end + +function SortChallengeItemTable( f48_arg0 ) + local f48_local0 = function ( f49_arg0, f49_arg1 ) + return f49_arg1.weight < f49_arg0.weight + end + + for f48_local12, f48_local13 in pairs( f0_local0.WeaponSettings.TypeLists ) do + for f48_local9, f48_local10 in pairs( f48_arg0[f48_local13] ) do + if f48_local10.attachments then + table.sort( f48_local10.attachments, f48_local0 ) + local f48_local4 + if f48_local10.weaponClass and Cac.IsWeaponClassPrimary( f48_local10.weaponClass ) or false then + f48_local4 = f0_local0.WeaponSettings.Primary.MaxDefaultAttachments + if not f48_local4 then + + else + f48_local4 = f48_local4 + 1 + for f48_local5 = 1, f48_local4, 1 do + local f48_local8 = f48_local10.attachments[f48_local5] + if f48_local8 then + f48_local10.weight = f48_local10.weight + f48_local8.weight + end + end + end + end + f48_local4 = f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments + end + end + table.sort( f48_arg0[f48_local13], f48_local0 ) + end + table.sort( f48_arg0.primaryGrenades, f48_local0 ) + table.sort( f48_arg0.secondaryGrenades, f48_local0 ) + table.sort( f48_arg0.abilities, f48_local0 ) + table.sort( f48_arg0.assaultStreaks, f48_local0 ) + table.sort( f48_arg0.supportStreaks, f48_local0 ) +end + +function ProcessItemsForChallengeList( f50_arg0, f50_arg1, f50_arg2 ) + local f50_local0 = InitChallengeItemTable( f50_arg2 ) + for f50_local4, f50_local5 in pairs( f50_arg1 ) do + ProcessItemsForChallenge( f50_arg0, f50_local5, f50_local0 ) + end + SortChallengeItemTable( f50_local0 ) + return f50_local0 +end + +function ProcessItemsForAllChallenges( f51_arg0, f51_arg1 ) + local f51_local0 = InitChallengeItemTable( f51_arg1 ) + for f51_local1 = 1, f0_local0.LoadoutBuilderTable.MaxRows, 1 do + local f51_local4 = Engine.TableLookupByRow( f0_local0.LoadoutBuilderTable.File, f51_local1, f0_local0.LoadoutBuilderTable.Cols.ChallengeRef ) + if f51_local4 ~= "" then + if not f51_local4 then + break + end + ProcessLoadoutBuilderTableRow( f51_arg0, f51_local1, f51_local0 ) + end + end + SortChallengeItemTable( f51_local0 ) + return f51_local0 +end + +function RemoveChallengeItemAbility( f52_arg0, f52_arg1, f52_arg2 ) + LUI.RemoveSingleItemFromArray( f52_arg1, f52_arg0 ) + for f52_local4, f52_local5 in pairs( f52_arg2.abilities ) do + if f52_local5.name == f52_arg0 then + local f52_local3 = f52_local5.weight + if f52_local3 > 0 then + AddWeightForKillstreakType( f52_arg2, "streaktype_specialist", -f52_local3 ) + assert( f52_arg2.killstreakTypes.streaktype_specialist.weight >= 0 ) + end + return + end + end + assert( nil, "RemoveChallengeItemAbility attempted to remove an item that wasn't in the challengeItems list." ) +end + +function SelectChallengeItemAbility( f53_arg0, f53_arg1, f53_arg2 ) + local f53_local0 = nil + for f53_local1 = 1, #f53_arg0, 1 do + f53_local0 = f53_arg0[f53_local1] + local f53_local4 = tonumber( Cac.GetPerkCost( f53_local0 ) ) + if f53_local4 <= f53_arg1 then + RemoveChallengeItemAbility( f53_local0, f53_arg0, f53_arg2 ) + return f53_local0, f53_arg1 - f53_local4 + end + end +end + +function SelectChallengeItem( f54_arg0, f54_arg1, f54_arg2 ) + local f54_local0 = {} + local f54_local1 = nil + for f54_local2 = 1, #f54_arg0, 1 do + local f54_local5 = f54_arg0[f54_local2] + if f54_local5.weight <= 0 and not f54_arg1 then + break + end + local f54_local6 = false + if f54_arg2 then + for f54_local10, f54_local11 in pairs( f54_arg2 ) do + if f54_local5.name == f54_local11 then + f54_local6 = true + break + end + end + end + if not f54_local6 then + if not f54_local1 then + f54_local1 = f54_local5.weight + elseif f54_local5.weight ~= f54_local1 then + + end + f54_local0[#f54_local0 + 1] = { + item = f54_local5, + index = f54_local2 + } + end + end + if #f54_local0 == 0 then + return + else + local f54_local3 = f54_local0[math.random( 1, #f54_local0 )] + return f54_local3.item, f54_local3.index + end +end + +function SelectAttachmentFromChallengeItems( f55_arg0, f55_arg1, f55_arg2 ) + for f55_local7, f55_local8 in ipairs( f55_arg0 ) do + local f55_local9 = Cac.GetAttachmentType( f55_local8.name ) + local f55_local3 = false + for f55_local4, f55_local5 in pairs( f55_arg1 ) do + if f55_local9 == Cac.GetAttachmentType( f55_local5 ) then + f55_local3 = true + break + end + end + if not f55_local3 and f55_arg2 and IsAttachmentAnUnderbarrelWeapon( f55_local8.name ) then + f55_local3 = true + end + if not f55_local3 then + f55_arg1[#f55_arg1 + 1] = f55_local8.name + end + end +end + +function SelectWeaponAttachmentsFromChallengeItems( f56_arg0, f56_arg1, f56_arg2 ) + if not f56_arg0.attachments or #f56_arg0.attachments == 0 then + return + end + for f56_local0 = 1, f56_arg1, 1 do + local f56_local3 = f56_local0 + SelectAttachmentFromChallengeItems( f56_arg0.attachments, f56_arg2 ) + end +end + +function SelectKillstreakTypeFromChallengeItems( f57_arg0 ) + local f57_local0 = nil + for f57_local4, f57_local5 in pairs( f57_arg0.killstreakTypes ) do + if f57_local5.weight > 0 and (not f57_local0 or f57_local0.weight < f57_local5.weight) then + f57_local0 = f57_local5 + end + end + if f57_local0 then + return f57_local0.name + else + + end +end + +function SelectWeaponsFromChallengeItems( f58_arg0, f58_arg1 ) + for f58_local3, f58_local4 in ipairs( { + { + listName = "primaryWeapons", + outputName = "primaryWeapon", + outputAttachmentList = "primaryAttachments", + maxAttachments = f0_local0.WeaponSettings.Primary.MaxDefaultAttachments, + isPrimary = true + }, + { + listName = "secondaryWeapons", + outputName = "secondaryWeapon", + outputAttachmentList = "secondaryAttachments", + maxAttachments = f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments, + isPrimary = false + } + } ) do + local f58_local5 = SelectChallengeItem( f58_arg0[f58_local4.listName] ) + if f58_local5 then + f58_arg1[f58_local4.outputName] = f58_local5.name + f58_arg1[f58_local4.outputAttachmentList] = {} + SelectWeaponAttachmentsFromChallengeItems( f58_local5, f58_local4.maxAttachments, f58_arg1[f58_local4.outputAttachmentList] ) + end + end +end + +function StoreOldAbilities( f59_arg0, f59_arg1, f59_arg2, f59_arg3, f59_arg4 ) + local f59_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + for f59_local6, f59_local7 in pairs( Cac.Abilities.Types ) do + for f59_local5 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + local f59_local4 = Cac.GetAbilitySlotRef( Cac.Abilities.Refs[f59_local6], f59_local5 ) + if Cac.IsAbilityPicked( f59_arg0, f59_local0.squadLocation, f59_local0.memberIndex, f59_local0.classLocation, f59_local0.loadoutSlot, f59_local7, f59_local5 - 1, "abilitiesPicked" ) then + f59_arg1[#f59_arg1 + 1] = f59_local4 + end + end + end + for f59_local1 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do + f59_local7 = Cac.GetKillstreak( f59_arg0, f59_local0.squadLocation, f59_local0.memberIndex, f59_local0.classLocation, f59_local0.loadoutSlot, "specialistStreaks", f59_local1 - 1 ) + if f59_local7 and f59_local7 ~= "none" then + f59_local7 = Cac.StripSuffix( f59_local7, "_ks" ) + f59_arg2[#f59_arg2 + 1] = f59_local7 + f59_arg1[#f59_arg1 + 1] = f59_local7 + end + end + for f59_local6, f59_local7 in pairs( Cac.Abilities.Types ) do + for f59_local5 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do + local f59_local4 = Cac.GetAbilitySlotRef( Cac.Abilities.Refs[f59_local6], f59_local5 ) + if Cac.IsAbilityPicked( f59_arg0, f59_local0.squadLocation, f59_local0.memberIndex, f59_local0.classLocation, f59_local0.loadoutSlot, f59_local7, f59_local5 - 1, "specialistBonusStreaks" ) then + f59_arg3[#f59_arg3 + 1] = f59_local4 + f59_arg1[#f59_arg1 + 1] = f59_local4 + end + end + end +end + +function SelectSpecialistAbilitiesFromChallengeItems( f60_arg0, f60_arg1, f60_arg2 ) + f60_arg1.specialistAbilities = {} + for f60_local0 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do + local f60_local3 = f60_local0 + local f60_local4, f60_local5 = SelectChallengeItemAbility( f60_arg0, Cac.Abilities.Settings.GrabBagCapacity, f60_arg2 ) + if f60_local4 then + f60_arg1.specialistAbilities[#f60_arg1.specialistAbilities + 1] = f60_local4 + end + end + f60_arg1.specialistBonusAbilities = {} + local f60_local0 = Cac.Abilities.Settings.SpecialistCapacity + for f60_local1 = 1, f60_local0, 1 do + local f60_local4 = f60_local1 + local f60_local5, f60_local6 = SelectChallengeItemAbility( f60_arg0, f60_local0, f60_arg2 ) + if f60_local5 then + f60_arg1.specialistBonusAbilities[#f60_arg1.specialistBonusAbilities + 1] = f60_local5 + f60_local0 = f60_local6 + end + end +end + +function SelectKillstreaksFromChallengeItems( f61_arg0, f61_arg1, f61_arg2, f61_arg3 ) + local f61_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + local f61_local1 = f0_local0.KillstreakTypes[f61_arg3].DataName + f61_arg2.killstreaks = {} + for f61_local2 = 1, 3, 1 do + local f61_local5 = f61_arg1[f61_local1][f61_local2] + if f61_local5 then + if f61_local5.weight <= 0 then + break + end + local f61_local6 = false + local f61_local7 = Cac.GetStreakCost( f61_local5.name ) + for f61_local11, f61_local12 in pairs( f61_arg2.killstreaks ) do + if f61_local7 == Cac.GetStreakCost( f61_local12 ) then + f61_local6 = true + break + end + end + if not f61_local6 then + f61_arg2.killstreaks[#f61_arg2.killstreaks + 1] = f61_local5.name + end + end + end + local f61_local2 = 3 - #f61_arg2.killstreaks + assert( f61_local2 >= 0 ) + for f61_local3 = 1, f61_local2, 1 do + local f61_local5 = f61_local3 + for f61_local6 = 1, 3, 1 do + local f61_local10 = Cac.GetCacConfig( f61_arg0, f61_local0.squadLocation, f61_local0.memberIndex, f61_local0.loadoutLocation, f61_local0.loadoutSlot, f61_local1, f61_local6 - 1 ) + local f61_local11 = Cac.GetStreakCost( f61_local10 ) + local f61_local12 = false + for f61_local14 = 1, #f61_arg2.killstreaks, 1 do + if f61_local11 == Cac.GetStreakCost( f61_arg2.killstreaks[f61_local14] ) then + f61_local12 = true + break + end + end + if not f61_local12 then + f61_arg2.killstreaks[#f61_arg2.killstreaks + 1] = f61_local10 + end + end + end +end + +function SelectExtraAttachment( f62_arg0, f62_arg1, f62_arg2, f62_arg3, f62_arg4, f62_arg5, f62_arg6, f62_arg7, f62_arg8 ) + local f62_local0 = Cac.GetAttachments( f62_arg0, f62_arg5, f62_arg6, f62_arg7, f62_arg8, f62_arg2 ) + for f62_local1 = #f62_local0, 1, -1 do + if f62_local0[f62_local1] == "none" or f62_local0[f62_local1] == "" then + table.remove( f62_local0, f62_local1 ) + end + end + assert( #f62_local0 < (Cac.Indices.Weapons.Primary and f0_local0.WeaponSettings.Primary.MaxDefaultAttachments + 1 or f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments + 1) ) + for f62_local10, f62_local11 in pairs( f0_local0.WeaponSettings.TypeLists ) do + for f62_local7, f62_local8 in pairs( f62_arg3[f62_local11] ) do + if f62_local8.name == f62_arg1 then + SelectAttachmentFromChallengeItems( f62_local8.attachments, f62_local0, true ) + local f62_local5 + if f62_arg2 == Cac.Indices.Weapons.Primary then + f62_local5 = "primaryWeapon" + if not f62_local5 then + + else + local f62_local6 + if f62_arg2 == Cac.Indices.Weapons.Primary then + f62_local6 = "primaryAttachments" + if not f62_local6 then + + else + f62_arg4[f62_local5] = f62_arg1 + f62_arg4[f62_local6] = f62_local0 + return + end + end + f62_local6 = "secondaryAttachments" + end + end + f62_local5 = "secondaryWeapon" + end + end + end +end + +function CreateAbilityListFromChallengeItems( f63_arg0, f63_arg1 ) + local f63_local0 = {} + local f63_local1 = false + for f63_local10, f63_local11 in ipairs( f63_arg0.abilities ) do + if f63_local11.weight <= 0 and not f63_local1 then + for f63_local8, f63_local9 in pairs( f63_arg1 ) do + if not LUI.IsItemInArray( f63_local0, f63_local9 ) then + f63_local0[#f63_local0 + 1] = f63_local9 + end + end + f63_local1 = true + end + if not LUI.IsItemInArray( f63_local0, f63_local11.name ) then + f63_local0[#f63_local0 + 1] = f63_local11.name + end + end + return f63_local0 +end + +function GetBestWeightForChallengeItemCategory( f64_arg0, f64_arg1 ) + if f64_arg0[f64_arg1] and 0 < #f64_arg0[f64_arg1] then + return f64_arg0[f64_arg1][1].weight + else + return 0 + end +end + +function GetTotalBestWeightsForChallengeItems( f65_arg0 ) + local f65_local0 = 0 + for f65_local4, f65_local5 in pairs( f0_local0.ChallengeItemsLists ) do + f65_local0 = f65_local0 + GetBestWeightForChallengeItemCategory( f65_arg0, f65_local5 ) + end + return f65_local0 +end + +function BuildLoadoutFromChallengeItems( f66_arg0, f66_arg1, f66_arg2 ) + local f66_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + local f66_local1 = {} + local f66_local2 = {} + StoreOldAbilities( f66_arg0, f66_local1, f66_local2, {}, f66_arg1 ) + local f66_local3 = CreateAbilityListFromChallengeItems( f66_arg1, f66_local1 ) + local f66_local4 = {} + SelectWeaponsFromChallengeItems( f66_arg1, f66_local4, false, false ) + local f66_local5 = SelectChallengeItem( f66_arg1.primaryGrenades ) + if f66_local5 then + f66_local4.primaryGrenade = f66_local5.name + end + local f66_local6 = SelectChallengeItem( f66_arg1.secondaryGrenades ) + if f66_local6 then + f66_local4.secondaryGrenade = f66_local6.name + end + Cac.ResetAbilities( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, "abilitiesPicked", false ) + ApplyLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, f66_local4 ) + f66_local4 = {} + for f66_local7 = #f66_local3, 1, -1 do + local f66_local10 = f66_local3[f66_local7] + if not CheckAbilityRules( f66_arg0, f66_local10, f66_arg2, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot ) then + RemoveChallengeItemAbility( f66_local10, f66_local3, f66_arg1 ) + end + end + f66_local4.abilities = {} + local f66_local7 = Cac.CalculateAbilityCapacity( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot ) + for f66_local8 = 1, f66_local7, 1 do + local f66_local10 = f66_local8 + local f66_local12, f66_local13 = SelectChallengeItemAbility( f66_local3, f66_local7, f66_arg1 ) + if f66_local12 then + f66_local4.abilities[#f66_local4.abilities + 1] = f66_local12 + f66_local7 = f66_local13 + end + end + for f66_local10, f66_local12 in pairs( Cac.Abilities.BlockedSpecialist ) do + for f66_local13 = 1, #f66_local3, 1 do + local f66_local14 = f66_local3[f66_local13] + if f66_local12 == f66_local14 then + RemoveChallengeItemAbility( f66_local14, f66_local3, f66_arg1 ) + end + end + end + f66_local8 = SelectKillstreakTypeFromChallengeItems( f66_arg1 ) + if f66_local8 then + f66_local4.killstreakType = f66_local8 + if f66_local4.killstreakType == "streaktype_specialist" then + SelectSpecialistAbilitiesFromChallengeItems( f66_local3, f66_local4, f66_arg1 ) + else + SelectKillstreaksFromChallengeItems( f66_arg0, f66_arg1, f66_local4, f66_local8 ) + end + end + if f66_local8 ~= "streaktype_specialist" then + f66_local4.specialistAbilities = {} + for f66_local9 = 1, #f66_local2, 1 do + local f66_local13 = f66_local2[f66_local9] + if not LUI.IsItemInArray( f66_local4.abilities, f66_local13 ) then + f66_local4.specialistAbilities[#f66_local4.specialistAbilities + 1] = f66_local13 + end + end + f66_local4.specialistBonusAbilities = {} + f66_local9 = Cac.Abilities.Settings.SpecialistCapacity + for f66_local11 = 1, f66_local9, 1 do + local f66_local13 = f66_local11 + local f66_local15, f66_local16 = SelectChallengeItemAbility( f66_local3, f66_local9, f66_arg1 ) + if f66_local15 and not LUI.IsItemInArray( f66_local4.abilities, curAbility ) then + f66_local4.specialistBonusAbilities[#f66_local4.specialistBonusAbilities + 1] = f66_local15 + f66_local9 = f66_local16 + end + end + end + ApplyLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, f66_local4 ) + f66_local4 = {} + if Cac.IsAbilityInUseForLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, "specialty_twoprimaries" ) then + f66_local4 = {} + assert( #f66_arg1.primaryWeapons >= 3 ) + f66_local11 = Cac.GetWeapon( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, Cac.Indices.Weapons.Primary ) + assert( Cac.GetWeapon( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, Cac.Indices.Weapons.Secondary ) ~= f0_local0.WeaponSettings.Secondary.DefaultWeapon, "Somehow attempted to use the two-primaries perk without already using a secondary weapon. AbilityRules should stop this." ) + f66_local10 = SelectChallengeItem( f66_arg1.primaryWeapons, true, { + f66_local11 + } ) + if f66_local10 then + f66_local4.secondaryWeapon = f66_local10.name + f66_local4.secondaryAttachments = {} + SelectWeaponAttachmentsFromChallengeItems( f66_local10, f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments, f66_local4.secondaryAttachments ) + end + ApplyLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, f66_local4 ) + end + if Cac.IsAbilityInUseForLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, "specialty_extra_attachment" ) then + f66_local4 = {} + SelectExtraAttachment( f66_arg0, Cac.GetWeapon( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, Cac.Indices.Weapons.Primary ), Cac.Indices.Weapons.Primary, f66_arg1, f66_local4, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot ) + SelectExtraAttachment( f66_arg0, Cac.GetWeapon( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, Cac.Indices.Weapons.Secondary ), Cac.Indices.Weapons.Secondary, f66_arg1, f66_local4, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot ) + ApplyLoadout( f66_arg0, f66_local0.squadLocation, f66_local0.memberIndex, f66_local0.classLocation, f66_local0.loadoutSlot, f66_local4 ) + end +end + +function BuildLoadout_TrackedOps( f67_arg0 ) + local f67_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + local f67_local1 = CacheUnlockedItems( f67_arg0 ) + local f67_local2 = {} + for f67_local3 = 1, MaxTrackedOperations, 1 do + f67_local2[#f67_local2 + 1] = GetTrackedOp( f67_arg0, f67_local3 - 1 ) + end + local f67_local3 = ProcessItemsForChallengeList( f67_arg0, f67_local2, f67_local1 ) + if GetTotalBestWeightsForChallengeItems( f67_local3 ) == 0 then + LUI.FlowManager.RequestPopupMenu( self, "generic_confirmation_popup", true, f67_arg0, false, { + popup_title = Engine.Localize( "MENU_NOTICE" ), + message_text = Engine.Localize( "LUA_MENU_MP_LB_NO_TRACKED_OPS" ), + button_text = Engine.Localize( "MENU_OK" ) + } ) + return + else + BuildLoadoutFromChallengeItems( f67_arg0, f67_local3, f67_local1 ) + end +end + +function BuildLoadout_MostOps( f68_arg0 ) + local f68_local0 = CacheUnlockedItems( f68_arg0 ) + BuildLoadoutFromChallengeItems( f68_arg0, ProcessItemsForAllChallenges( f68_arg0, f68_local0 ), f68_local0 ) +end + +function BuildLoadout_ProgressedOps( f69_arg0 ) + local f69_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + local f69_local1 = CacheUnlockedItems( f69_arg0 ) + local f69_local2 = {} + for f69_local3 = 1, 1000, 1 do + local f69_local6 = Engine.TableLookupByRow( AllChallengesTable.File, f69_local3, AllChallengesTable.Cols.Ref ) + if f69_local6 then + if f69_local6 == "" then + break + end + local f69_local7 = getTierForActiveOperation( f69_arg0, f69_local6 ) + if tonumber( f69_local7 ) ~= 0 then + f69_local2[#f69_local2 + 1] = { + challenge = f69_local6, + progress = operationGetProgress( f69_arg0, f69_local6 ) / tonumber( operationGetTargetForTier( f69_local6, f69_local7 ) ) + } + end + end + end + table.sort( f69_local2, function ( f70_arg0, f70_arg1 ) + return f70_arg1.progress < f70_arg0.progress + end ) + local f69_local4 = {} + for f69_local7, f69_local9 in pairs( f69_local2 ) do + if f69_local9.progress >= 0.5 then + if #f69_local4 > 50 then + break + end + f69_local4[#f69_local4 + 1] = f69_local9.challenge + end + end + if #f69_local4 == 0 then + LUI.FlowManager.RequestPopupMenu( self, "generic_confirmation_popup", true, f69_arg0, false, { + popup_title = Engine.Localize( "MENU_NOTICE" ), + message_text = Engine.Localize( "LUA_MENU_MP_LB_NO_OP_PROGRESS" ), + button_text = Engine.Localize( "MENU_OK" ) + } ) + return + else + BuildLoadoutFromChallengeItems( f69_arg0, ProcessItemsForChallengeList( f69_arg0, f69_local4, f69_local1 ), f69_local1 ) + end +end + +function BuildLoadout_Random( f71_arg0 ) + local f71_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + local f71_local1 = CacheUnlockedItems( f71_arg0 ) + local f71_local2 = {} + for f71_local6, f71_local7 in pairs( f71_local1.abilities ) do + f71_local2[f71_local6] = f71_local7 + end + f71_local3 = {} + assert( #f71_local1.primaryWeapons > 0 ) + f71_local4 = math.random( 1, #f71_local1.primaryWeapons ) + f71_local3.primaryWeapon = f71_local1.primaryWeapons[f71_local4].name + f71_local3.primaryAttachments = {} + SelectRandomAttachmentsForWeapon( f71_local1.primaryWeapons[f71_local4], f0_local0.WeaponSettings.Primary.MaxDefaultAttachments, f71_local3.primaryAttachments ) + assert( #f71_local1.secondaryWeapons > 0 ) + f71_local4 = math.random( 1, #f71_local1.secondaryWeapons ) + f71_local3.secondaryWeapon = f71_local1.secondaryWeapons[f71_local4].name + f71_local3.secondaryAttachments = {} + SelectRandomAttachmentsForWeapon( f71_local1.secondaryWeapons[f71_local4], f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments, f71_local3.secondaryAttachments ) + f71_local5 = false + for f71_local9, f71_local10 in pairs( f71_local3.primaryAttachments ) do + if IsAttachmentAnUnderbarrelWeapon( f71_local10 ) then + f71_local5 = true + break + end + end + if not f71_local5 then + assert( #f71_local1.primaryGrenades > 0 ) + f71_local3.primaryGrenade = f71_local1.primaryGrenades[math.random( 1, #f71_local1.primaryGrenades )] + else + f71_local3.primaryGrenade = f0_local0.WeaponSettings.PrimaryGrenade.DefaultWeapon + end + assert( #f71_local1.secondaryGrenades > 0 ) + f71_local3.secondaryGrenade = f71_local1.secondaryGrenades[math.random( 1, #f71_local1.secondaryGrenades )] + Cac.ResetAbilities( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, "abilitiesPicked", false ) + ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 ) + f71_local3 = {} + ApplyAbilityRulesToList( f71_arg0, f71_local2, f71_local1, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot ) + assert( #f71_local2 > 0 ) + f71_local6 = Cac.CalculateAbilityCapacity( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot ) + f71_local7 = 0 + for f71_local8 = 1, f71_local6, 1 do + local f71_local11 = f71_local8 + if #f71_local2 <= 0 then + break + else + local f71_local12, f71_local13, f71_local14 = SelectRandomAbilityFromList( f71_local2, f71_local6 ) + if f71_local12 and f71_local13 then + if not f71_local14 then + break + end + f71_local6 = f71_local6 - f71_local13 + assert( f71_local6 >= 0 ) + assert( f71_local7 <= Cac.CalculateAbilityCapacity( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot ) ) + if not f71_local3.abilities then + f71_local3.abilities = {} + end + else + for f71_local11, f71_local12 in pairs( Cac.Abilities.BlockedSpecialist ) do + for f71_local13 = 1, #f71_local2, 1 do + if f71_local12 == f71_local2[f71_local13] then + table.remove( f71_local2, f71_local13 ) + end + end + end + f71_local8 = { + "streaktype_assault", + "streaktype_support" + } + if f0_local0.MinPerksForSpecialst < #f71_local2 then + f71_local8[#f71_local8 + 1] = "streaktype_specialist" + end + f71_local3.killstreakType = f71_local8[math.random( 1, #f71_local8 )] + if f71_local3.killstreakType == "streaktype_specialist" then + f71_local3.specialistAbilities = {} + for f71_local9 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do + local f71_local13, f71_local14, f71_local15 = SelectRandomAbilityFromList( f71_local2, Cac.Abilities.Settings.GrabBagCapacity ) + if f71_local13 then + if not f71_local14 then + break + end + f71_local3.specialistAbilities[f71_local9] = f71_local13 + table.remove( f71_local2, f71_local15 ) + end + end + f71_local3.specialistBonusAbilities = {} + f71_local9 = Cac.Abilities.Settings.SpecialistCapacity + for f71_local10 = 1, f71_local9, 1 do + local f71_local13 = f71_local10 + local f71_local14, f71_local15, f71_local16 = SelectRandomAbilityFromList( f71_local2, f71_local9 ) + if f71_local14 then + if not f71_local15 then + + end + f71_local9 = f71_local9 - f71_local15 + assert( f71_local9 >= 0 ) + f71_local3.specialistBonusAbilities[#f71_local3.specialistBonusAbilities + 1] = f71_local14 + table.remove( f71_local2, f71_local16 ) + end + end + else + f71_local9 = f71_local1[f0_local0.KillstreakTypes[f71_local3.killstreakType].DataName] + f71_local3.killstreaks = {} + for f71_local10 = 1, 3, 1 do + local f71_local13 = f71_local10 + f71_local3.killstreaks[#f71_local3.killstreaks + 1] = SelectRandomKillstreakFromList( f71_local9, f71_local3.killstreaks ) + end + end + ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 ) + if Cac.IsAbilityInUseForLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, "specialty_twoprimaries" ) then + f71_local3 = {} + assert( #f71_local1.primaryWeapons >= 3 ) + f71_local9 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Primary ) + assert( Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Secondary ) ~= f0_local0.WeaponSettings.Secondary.DefaultWeapon, "Somehow attempted to use the two-primaries perk without already using a secondary weapon. AbilityRules should stop this." ) + f71_local10 = SelectRandomUnlockedWeapon( f71_local1.primaryWeapons, { + f71_local9, + f0_local0.WeaponSettings.Primary.DefaultWeapon + } ) + f71_local3.secondaryWeapon = f71_local10.name + f71_local3.secondaryAttachments = {} + SelectRandomAttachmentsForWeapon( f71_local10, f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments, f71_local3.secondaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames ) + ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 ) + end + if Cac.IsAbilityInUseForLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, "specialty_extra_attachment" ) then + f71_local3 = {} + f71_local9 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Primary ) + for f71_local13, f71_local14 in pairs( f71_local1.primaryWeapons ) do + if f71_local14.name == f71_local9 then + f71_local3.primaryWeapon = f71_local14.name + f71_local3.primaryAttachments = {} + SelectRandomAttachmentsForWeapon( f71_local14, f0_local0.WeaponSettings.Primary.MaxDefaultAttachments + 1, f71_local3.primaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames ) + break + end + end + f71_local10 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Secondary ) + for f71_local14, f71_local15 in pairs( { + f71_local1.primaryWeapons, + f71_local1.secondaryWeapons + } ) do + for f71_local17, f71_local18 in pairs( f71_local15 ) do + if f71_local18.name == f71_local10 then + f71_local3.secondaryWeapon = f71_local18.name + f71_local3.secondaryAttachments = {} + SelectRandomAttachmentsForWeapon( f71_local18, f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments + 1, f71_local3.secondaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames ) + end + end + end + ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 ) + end + end + end + f71_local3.abilities[#f71_local3.abilities + 1] = f71_local12 + table.remove( f71_local2, f71_local14 ) + end + for f71_local11, f71_local12 in pairs( Cac.Abilities.BlockedSpecialist ) do + for f71_local13 = 1, #f71_local2, 1 do + if f71_local12 == f71_local2[f71_local13] then + table.remove( f71_local2, f71_local13 ) + end + end + end + f71_local8 = { + "streaktype_assault", + "streaktype_support" + } + if f0_local0.MinPerksForSpecialst < #f71_local2 then + f71_local8[#f71_local8 + 1] = "streaktype_specialist" + end + f71_local3.killstreakType = f71_local8[math.random( 1, #f71_local8 )] + if f71_local3.killstreakType == "streaktype_specialist" then + f71_local3.specialistAbilities = {} + for f71_local9 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do + local f71_local13, f71_local14, f71_local15 = SelectRandomAbilityFromList( f71_local2, Cac.Abilities.Settings.GrabBagCapacity ) + if f71_local13 then + if not f71_local14 then + break + end + f71_local3.specialistAbilities[f71_local9] = f71_local13 + table.remove( f71_local2, f71_local15 ) + end + end + f71_local3.specialistBonusAbilities = {} + f71_local9 = Cac.Abilities.Settings.SpecialistCapacity + for f71_local10 = 1, f71_local9, 1 do + local f71_local13 = f71_local10 + local f71_local14, f71_local15, f71_local16 = SelectRandomAbilityFromList( f71_local2, f71_local9 ) + if f71_local14 then + if not f71_local15 then + + end + f71_local9 = f71_local9 - f71_local15 + assert( f71_local9 >= 0 ) + f71_local3.specialistBonusAbilities[#f71_local3.specialistBonusAbilities + 1] = f71_local14 + table.remove( f71_local2, f71_local16 ) + end + end + else + f71_local9 = f71_local1[f0_local0.KillstreakTypes[f71_local3.killstreakType].DataName] + f71_local3.killstreaks = {} + for f71_local10 = 1, 3, 1 do + local f71_local13 = f71_local10 + f71_local3.killstreaks[#f71_local3.killstreaks + 1] = SelectRandomKillstreakFromList( f71_local9, f71_local3.killstreaks ) + end + end + ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 ) + if Cac.IsAbilityInUseForLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, "specialty_twoprimaries" ) then + f71_local3 = {} + assert( #f71_local1.primaryWeapons >= 3 ) + f71_local9 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Primary ) + assert( Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Secondary ) ~= f0_local0.WeaponSettings.Secondary.DefaultWeapon, "Somehow attempted to use the two-primaries perk without already using a secondary weapon. AbilityRules should stop this." ) + f71_local10 = SelectRandomUnlockedWeapon( f71_local1.primaryWeapons, { + f71_local9, + f0_local0.WeaponSettings.Primary.DefaultWeapon + } ) + f71_local3.secondaryWeapon = f71_local10.name + f71_local3.secondaryAttachments = {} + SelectRandomAttachmentsForWeapon( f71_local10, f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments, f71_local3.secondaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames ) + ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 ) + end + if Cac.IsAbilityInUseForLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, "specialty_extra_attachment" ) then + f71_local3 = {} + f71_local9 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Primary ) + for f71_local13, f71_local14 in pairs( f71_local1.primaryWeapons ) do + if f71_local14.name == f71_local9 then + f71_local3.primaryWeapon = f71_local14.name + f71_local3.primaryAttachments = {} + SelectRandomAttachmentsForWeapon( f71_local14, f0_local0.WeaponSettings.Primary.MaxDefaultAttachments + 1, f71_local3.primaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames ) + break + end + end + f71_local10 = Cac.GetWeapon( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, Cac.Indices.Weapons.Secondary ) + for f71_local14, f71_local15 in pairs( { + f71_local1.primaryWeapons, + f71_local1.secondaryWeapons + } ) do + for f71_local17, f71_local18 in pairs( f71_local15 ) do + if f71_local18.name == f71_local10 then + f71_local3.secondaryWeapon = f71_local18.name + f71_local3.secondaryAttachments = {} + SelectRandomAttachmentsForWeapon( f71_local18, f0_local0.WeaponSettings.Secondary.MaxDefaultAttachments + 1, f71_local3.secondaryAttachments, f0_local0.AttachmentSettings.UnderbarrelWeaponNames ) + end + end + end + ApplyLoadout( f71_arg0, f71_local0.squadLocation, f71_local0.memberIndex, f71_local0.classLocation, f71_local0.loadoutSlot, f71_local3 ) + end +end + +function ValidateLoadout( f72_arg0, f72_arg1, f72_arg2, f72_arg3, f72_arg4, f72_arg5 ) + Cac.ValidateLoadoutItems( f72_arg0, f72_arg1, f72_arg2, f72_arg3 ) +end + +function ApplyLoadout( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_arg5 ) + if f73_arg5.primaryWeapon then + Cac.SetWeapon( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Weapons.Primary, f73_arg5.primaryWeapon ) + if f73_arg5.primaryAttachments and #f73_arg5.primaryAttachments > 0 then + for f73_local3, f73_local4 in pairs( f73_arg5.primaryAttachments ) do + Cac.SetAttachment( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Weapons.Primary, f73_local3 - 1, f73_local4 ) + end + end + Cac.ValidateReticle( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Weapons.Primary ) + end + if f73_arg5.secondaryWeapon then + Cac.SetWeapon( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Weapons.Secondary, f73_arg5.secondaryWeapon ) + if f73_arg5.secondaryAttachments and #f73_arg5.secondaryAttachments > 0 then + for f73_local3, f73_local4 in pairs( f73_arg5.secondaryAttachments ) do + Cac.SetAttachment( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Weapons.Secondary, f73_local3 - 1, f73_local4 ) + end + end + end + if f73_arg5.primaryGrenade then + Cac.SetPerk( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Grenade.Primary, f73_arg5.primaryGrenade ) + end + if f73_arg5.secondaryGrenade then + Cac.SetPerk( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.Grenade.Secondary, f73_arg5.secondaryGrenade ) + end + if f73_arg5.abilities then + Cac.ResetKillstreak( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, "specialistStreaks" ) + Cac.ResetAbilities( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, "specialistBonusStreaks", false ) + for f73_local3, f73_local4 in ipairs( f73_arg5.abilities ) do + local f73_local5, f73_local6 = Cac.GetPerkIndices( f73_local4 ) + if not Cac.IsAbilityPicked( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local5 - 1, f73_local6 - 1, "abilitiesPicked" ) then + Cac.ToggleAbility( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local5 - 1, f73_local6 - 1, "abilitiesPicked", false, false, true ) + end + end + end + if f73_arg5.specialistAbilities then + for f73_local0 = 1, #f73_arg5.specialistAbilities, 1 do + Cac.SetKillstreak( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, "specialistStreaks", f73_local0 - 1, f73_arg5.specialistAbilities[f73_local0] .. "_ks" ) + end + Cac.UpdateSpecialistKillCounts( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4 ) + end + if f73_arg5.specialistBonusAbilities then + Cac.ResetAbilities( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, "specialistBonusStreaks", false ) + local f73_local0 = 0 + for f73_local1 = 1, Cac.Abilities.Settings.SpecialistAbilityCount, 1 do + local f73_local5 = Cac.GetKillstreak( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, "specialistStreaks", f73_local1 - 1 ) + if f73_local5 and f73_local5 ~= "none" then + f73_local0 = f73_local0 + 1 + end + end + if f73_local0 >= 2 then + for f73_local1 = 1, #f73_arg5.specialistBonusAbilities, 1 do + local f73_local6, f73_local7 = Cac.GetPerkIndices( f73_arg5.specialistBonusAbilities[f73_local1] ) + assert( not Cac.IsAbilityPicked( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local6 - 1, f73_local7 - 1, "specialistBonusStreaks" ) ) + Cac.ToggleAbility( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local6 - 1, f73_local7 - 1, "specialistBonusStreaks", false, true, true ) + end + end + end + if f73_arg5.killstreakType then + Cac.SetPerk( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, Cac.Indices.StreakType, f73_arg5.killstreakType ) + if f73_arg5.killstreakType ~= "streaktype_specialist" then + table.sort( f73_arg5.killstreaks, function ( f74_arg0, f74_arg1 ) + local f74_local0 + if f74_arg0 ~= "none" then + f74_local0 = tonumber( Cac.GetStreakCost( f74_arg0 ) ) + if not f74_local0 then + + else + local f74_local1 + if f74_arg1 ~= "none" then + f74_local1 = tonumber( Cac.GetStreakCost( f74_arg1 ) ) + if not f74_local1 then + + else + return f74_local0 < f74_local1 + end + end + f74_local1 = 1000 + end + end + f74_local0 = 1000 + end ) + local f73_local1 = f0_local0.KillstreakTypes[f73_arg5.killstreakType].DataName + Cac.ResetKillstreak( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local1 ) + for f73_local5, f73_local6 in ipairs( f73_arg5.killstreaks ) do + Cac.SetKillstreak( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_local1, f73_local5 - 1, f73_local6 ) + end + end + end + ValidateLoadout( f73_arg0, f73_arg1, f73_arg2, f73_arg3, f73_arg4, f73_arg5 ) +end + +local f0_local3 = { + TrackedOps = BuildLoadout_TrackedOps, + ProgressedOps = BuildLoadout_ProgressedOps, + MostOps = BuildLoadout_MostOps, + Random = BuildLoadout_Random +} +function BuildLoadoutAction( f75_arg0, f75_arg1 ) + local f75_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + if f75_local0.currentType then + f0_local3[f75_local0.currentType]( f75_arg1.controller ) + end + f75_arg0:dispatchEventToRoot( { + name = "update_cac_info_panel", + controller = f75_arg1.controller, + dispatchChildren = true, + classLocation = f75_local0.loadoutLocation, + attachConflict = false + } ) + local f75_local1 = Cac.GetPerk( f75_arg1.controller, f75_local0.squadLocation, f75_local0.memberIndex, f75_local0.loadoutLocation, f75_local0.loadoutSlot, Cac.Indices.StreakType ) == "streaktype_specialist" + f75_arg0:dispatchEventToRoot( { + name = "refresh_abilities_recap", + controller = f75_arg1.controller, + specialistType = f75_local1, + selected = false, + immediate = true + } ) + f75_arg0:dispatchEventToRoot( { + name = "refresh_specialist_abilities_recap", + controller = f75_arg1.controller, + specialistType = f75_local1, + selected = false, + immediate = true + } ) + f75_arg0:dispatchEventToRoot( { + name = "cac_set_slot", + slot = f75_local0.loadoutSlot, + controller = f75_arg1.controller, + dispatchChildren = true, + classLocation = f75_local0.loadoutLocation, + immediate = true + } ) +end + +function popup_lb_button() + local f76_local0 = 5 + local f76_local1 = 1 + local f76_local2 = 20 + local f76_local3 = 20 + local f76_local4 = { + r = 1, + g = 1, + b = 1, + a = 0.3 + } + return { + type = "UIButton", + id = "popup_lb_button_id", + properties = {}, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = f0_local0.Layout.TypeButton.Height + } + }, + children = { + { + type = "UIImage", + id = "popup_lb_button_bg_fade_id", + states = { + default = CoD.ColorizeState( { + r = 1, + g = 1, + b = 1, + a = 0.08 + }, { + material = RegisterMaterial( "box_white_gradient_top" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = -f0_local0.Layout.TypeButton.Height * 0.4 + } ) + } + }, + { + type = "UIImage", + id = "popup_lb_button_bg_id", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = -f76_local1, + alpha = 0 + }, + focus = { + alpha = 0.8 + }, + focus_dim = { + alpha = 0.5 + } + }, + handlers = { + button_over = MBh.AnimateLoop( { + { + "focus", + 0, + true, + true + }, + { + "focus", + 350, + true, + true + }, + { + "focus_dim", + 750, + true, + true + }, + { + "focus", + 750, + true, + true + } + } ), + button_up = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIImage", + id = "popup_lb_button_corner_tick_id", + states = { + default = CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( "widg_triangle" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f76_local1, + width = 16, + top = f76_local1, + height = 16, + alpha = 0.5 + } ), + focus = { + alpha = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIText", + id = "popup_lb_button_name_id", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f76_local2, + right = 0, + top = f76_local0, + bottom = f76_local0 + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ), + focus = CoD.ColorizeState( Colors.generic_button_text_focus_color, {} ) + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIMarqueeText", + id = "popup_lb_button_desc_id", + properties = { + text = MBh.Property( "desc" ), + textStyle = CoD.TextStyle.None + }, + states = { + default = CoD.ColorizeState( Colors.secondary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = f76_local3, + right = 0, + top = -f76_local0 - CoD.TextSettings.NormalFont.Height, + bottom = -f76_local0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) + }, + handlers = { + button_over = function ( f77_arg0, f77_arg1 ) + f77_arg0:SetColor( Colors.grey_14.r, Colors.grey_14.g, Colors.grey_14.b ) + end + , + button_up = function ( f78_arg0, f78_arg1 ) + f78_arg0:SetColor( Colors.secondary_text_color.r, Colors.secondary_text_color.g, Colors.secondary_text_color.b ) + end + + } + }, + { + type = "UIImage", + id = "popup_lb_button_spacer_top_id", + states = { + default = CoD.ColorizeState( f76_local4, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f76_local1 + } ), + focus = CoD.ColorizeState( Colors.black, {} ) + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIImage", + id = "popup_lb_button_spacer_bottom_id", + states = { + default = CoD.ColorizeState( f76_local4, { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = -f76_local1, + bottom = 0 + } ), + focus = CoD.ColorizeState( Colors.black, {} ) + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIImage", + id = "popup_lb_button_spacer_left_id", + states = { + default = CoD.ColorizeState( f76_local4, { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f76_local1, + top = f76_local1, + bottom = -f76_local1 + } ), + focus = CoD.ColorizeState( Colors.black, {} ) + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIImage", + id = "popup_lb_button_spacer_right_id", + states = { + default = CoD.ColorizeState( f76_local4, { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = -f76_local1, + right = 0, + top = f76_local1, + bottom = -f76_local1 + } ), + focus = CoD.ColorizeState( Colors.black, {} ) + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ) + } + } + } + } +end + +function RequestBuildLoadout( f79_arg0, f79_arg1, f79_arg2 ) + local f79_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + f79_local0.currentType = f79_arg1 + LUI.FlowManager.RequestPopupMenu( self, "generic_yesno_popup", true, f79_arg0, f79_arg2, { + popup_title = Engine.Localize( "MENU_WARNING" ), + message_text = Engine.Localize( "LUA_MENU_MP_LB_OVERWRITE_WARNING" ), + yes_action = BuildLoadoutAction + } ) +end + +function LBTypeButtonAction( f80_arg0, f80_arg1 ) + RequestBuildLoadout( f80_arg1.controller, f80_arg0.properties.loadoutBuilderType, true ) +end + +function GetLoadoutBuilderTypeList() + local f81_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( f0_local0.ScopedName ) + if f81_local0.squadLocation == "squadMembers" then + return { + f0_local0.TypeConfigs.TrackedOps, + f0_local0.TypeConfigs.ProgressedOps, + f0_local0.TypeConfigs.MostOps, + f0_local0.TypeConfigs.Random + } + else + return { + f0_local0.TypeConfigs.Random + } + end +end + +function GetButtonPopupContentHeight() + return #GetLoadoutBuilderTypeList() * (f0_local0.Layout.TypeButton.Height + 5) +end + +function LBTypeButtonChildrenFeeder( f83_arg0 ) + local f83_local0 = f83_arg0.exclusiveController + local f83_local1 = {} + local f83_local2 = GetLoadoutBuilderTypeList() + for f83_local3 = 1, #f83_local2, 1 do + local f83_local6 = f83_local2[f83_local3] + f83_local1[#f83_local1 + 1] = { + type = "popup_lb_button", + id = f83_local6.name, + properties = { + text = f83_local6.text, + desc = f83_local6.desc, + loadoutBuilderType = f83_local6.type + }, + handlers = { + button_action = LBTypeButtonAction + } + } + end + return f83_local1 +end + +function LBTypePopupChildrenFeeder( f84_arg0 ) + local f84_local0 = f84_arg0.exclusiveController + local f84_local1 = { + [#f84_local1 + 1] = { + type = "UIVerticalList", + id = "ops_list", + focusable = true, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = GetButtonPopupContentHeight( f84_arg0.squadLocation ), + spacing = 5 + } + }, + childrenFeeder = LBTypeButtonChildrenFeeder + } + } + return f84_local1 +end + +function popup_lb_type() + return { + type = "generic_selectionList_popup", + id = "popup_lb_type_id", + properties = { + popup_title = Engine.Localize( "LUA_MENU_MP_LB_TYPE_TITLE" ), + popup_width = 575, + popup_childfeeder = LBTypePopupChildrenFeeder + } + } +end + +LUI.MenuBuilder.registerDef( "popup_lb_type", popup_lb_type ) +LUI.MenuBuilder.registerDef( "popup_lb_button", popup_lb_button ) +LockTable( _M ) diff --git a/lui/mp_menus/luisquadmemberwindow.dec.lua b/lui/mp_menus/luisquadmemberwindow.dec.lua new file mode 100644 index 0000000..5bd3b17 --- /dev/null +++ b/lui/mp_menus/luisquadmemberwindow.dec.lua @@ -0,0 +1,923 @@ +LUI.UISquadMemberWindow = InheritFrom( LUI.UIElement ) +LUI.UISquadMemberWindow.build = function ( f1_arg0, f1_arg1 ) + return LUI.UISquadMemberWindow.new( f1_arg1 ) +end + +LUI.UISquadMemberWindow.new = function ( f2_arg0 ) + local self = LUI.UIElement.new() + self.id = "UISquadMemberWindow" + self.setDisplayName = LUI.UISquadMemberWindow.SetDisplayName + self.setPrestigeIcon = LUI.UISquadMemberWindow.SetPrestigeIcon + self.moveTo = LUI.UISquadMemberWindow.MoveTo + self.setCharacterAnim = LUI.UISquadMemberWindow.SetAnimation + self.setBackground = LUI.UISquadMemberWindow.SetBackground + self.updateSquadMember = LUI.UISquadMemberWindow.UpdateSavedCharacterWindow + self.updateCharacter = LUI.UISquadMemberWindow.UpdateCharacterWindow + assert( f2_arg0, "UISquadMemberWindow requires a properties table. At the very least, you must specify char_window_dims, uv_values, and character_pos" ) + if not f2_arg0 then + f2_arg0 = { + char_window_dims = { + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + end + self.squadMemberIndex = f2_arg0.squad_member_index + self.loadoutSlot = f2_arg0.loadout_slot + local f2_local1 = f2_arg0.squad_location + if not f2_local1 then + DebugPrint( "WARNING: Using UISquadMemberWindow without specifying squad_location. Defaulting to privateMatchSquadMembers" ) + f2_local1 = "privateMatchSquadMembers" + end + self.squadLocation = f2_local1 + local f2_local2 = f2_arg0.controller + if not f2_local2 then + DebugPrint( "WARNING: Using UISquadMemberWindow without specifying controller. Defaulting to first active controller" ) + f2_local2 = Engine.GetFirstActiveController() + end + self.controller = f2_local2 + if f2_arg0.use_background then + local charWindow = f2_arg0.mask_pos_data + if not charWindow then + charWindow = { + left = 0, + top = 0, + right = 0, + bottom = 0 + } + end + local f2_local4 = f2_arg0.mask_dims_data + if not f2_local4 then + f2_local4 = { + width = 512, + height = 512 + } + end + self.background_mask = LUI.UIImage.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = charWindow.top, + left = charWindow.left, + width = f2_local4.width, + height = f2_local4.height, + material = RegisterMaterial( "img_bg_alpha_stencil" ), + alpha = 1 + } ) + self.background_mask:setUseStencil( true ) + self.background_mask.id = "member_window_background_mask_id" + self:addElement( self.background_mask ) + local f2_local5 = f2_arg0.bg_anchor_data + if not f2_local5 then + f2_local5 = { + left = true, + top = true, + right = true, + bottom = true + } + end + local f2_local6 = f2_arg0.bg_pos_data + if not f2_local6 then + f2_local6 = { + left = 1, + top = 1, + right = -1, + bottom = -1 + } + end + self.background = LUI.UIImage.new( { + left = f2_local6.left, + top = f2_local6.top, + right = f2_local6.right, + bottom = f2_local6.bottom, + leftAnchor = f2_local5.left, + topAnchor = f2_local5.top, + rightAnchor = f2_local5.right, + bottomAnchor = f2_local5.bottom, + alpha = 1 + } ) + self.background.id = "member_window_background_id" + self.background:registerAnimationState( "hidden", { + alpha = 0 + } ) + self.background:animateToState( "hidden", 0 ) + self.background:registerEventHandler( "update_character_bg", function ( element, event ) + if event.material then + element:setImage( event.material ) + element:animateToState( "default", 0 ) + end + end ) + self.background_mask:addElement( self.background ) + end + if f2_arg0.use_border then + local f2_local4 = LUI.MenuBuilder.buildItems( { + type = "generic_border", + id = "member_window_bg_border_id", + properties = { + thickness = 1, + border_red = 1, + border_green = 1, + border_blue = 1, + border_alpha = 0.5 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.2 + } + } + }, f2_arg0, self ) + f2_local4:registerAnimationState( "focused", { + alpha = 0.4 + } ) + f2_local4:registerAnimationState( "hidden", { + alpha = 0 + } ) + f2_local4:registerEventHandler( "set_border_state", function ( element, event ) + element:animateToState( event.border_state ) + end ) + self:addElement( f2_local4 ) + end + if f2_arg0.use_3d_model and f2_arg0.use_2d_character_image then + DebugPrint( "ERROR: Both use_3d_model and use_2d_character_image are set to true! Defaulting to using the 2d model." ) + f2_arg0.use_3d_model = false + end + if f2_arg0.use_3d_model ~= false then + local charWindow = LUI.UICharacterWindow.new() + charWindow.id = "member_window_character_id" + charWindow:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f2_arg0.char_window_dims.top, + bottom = f2_arg0.char_window_dims.bottom, + left = f2_arg0.char_window_dims.left, + right = f2_arg0.char_window_dims.right, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + charWindow:registerAnimationState( "silhouette", { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } ) + charWindow:registerAnimationState( "hidden", { + red = 0, + green = 0, + blue = 0, + alpha = 0 + } ) + charWindow:animateToState( "default" ) + charWindow:registerEventHandler( "make_scene", LUI.UISquadMemberWindow.InitCharacterWindow ) + charWindow:registerEventHandler( "set_silhouette", function ( element, event ) + element:animateToState( "silhouette", event.anim_length or 0 ) + end ) + charWindow:registerEventHandler( "set_normal", function ( element, event ) + element:animateToState( "default", event.anim_length or 0 ) + end ) + charWindow:registerEventHandler( "hide_character", function ( element, event ) + element:animateToState( "hidden", event.anim_length or 0 ) + end ) + charWindow:registerEventHandler( "animLooped", LUI.UISquadMemberWindow.ChangeAnimOnLoopedEnd ) + charWindow:registerEventHandler( "animEnded", LUI.UISquadMemberWindow.ChangeAnimOnEnd ) + charWindow:registerEventHandler( "weapon_changed", LUI.UISquadMemberWindow.WeaponChangeAnim ) + charWindow:registerEventHandler( "weapon_changed_stowed", LUI.UISquadMemberWindow.WeaponChangeStowed ) + charWindow:registerEventHandler( "idle_changed", LUI.UISquadMemberWindow.IdleChangeAnim ) + charWindow:registerEventHandler( "gamepad_sticks", LUI.UISquadMemberWindow.RightStickSpin ) + charWindow:registerEventHandler( "leftmousedown", function ( element, event ) + + end ) + charWindow:registerEventHandler( "leftmouseup", function ( element, event ) + local f9_local0 = element:getParent() + CharacterScene.SetSpin( f9_local0.handle, 0, 0, 0 ) + end ) + charWindow:registerEventHandler( "mousemove", LUI.UISquadMemberWindow.PCSpin ) + charWindow:setHandleMouseButton( true ) + local f2_local4 = LUI.UITimer.new( 50, "make_scene" ) + f2_local4.id = "createSceneTimer" + charWindow:addElement( f2_local4 ) + self:addElement( charWindow ) + self.charWindow = charWindow + + LUI.UISquadMemberWindow.AddLoadingWidget( self, f2_arg0 ) + end + if f2_arg0.use_2d_character_image == true then + local charWindow = LUI.UIImage.new() + charWindow.id = "member_window_character_id" + charWindow:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f2_arg0.char_window_dims.top, + bottom = f2_arg0.char_window_dims.bottom, + left = f2_arg0.char_window_dims.left, + right = f2_arg0.char_window_dims.right, + material = RegisterMaterial( "img_char_cas" ), + red = 0.6, + green = 0.6, + blue = 0.6, + alpha = 0.25 + } ) + charWindow:registerAnimationState( "hidden", { + alpha = 0 + } ) + charWindow:animateToState( "default" ) + charWindow:registerEventHandler( "set_normal", function ( element, event ) + element:animateToState( "default", event.anim_length or 0 ) + end ) + charWindow:registerEventHandler( "set_silhouette", function ( element, event ) + element:animateToState( "default", event.anim_length or 0 ) + end ) + charWindow:registerEventHandler( "hide_character", function ( element, event ) + element:animateToState( "hidden", event.anim_length or 0 ) + end ) + self:addElement( charWindow ) + self.charImage = charWindow + end + if f2_arg0.use_member_name then + LUI.UISquadMemberWindow.AddMemberName( self ) + end + if f2_arg0.use_prestige_icon then + self.prestigeIcon = LUI.UIImage.new() + self.prestigeIcon.id = "member_window_prestige_icon_id" + self.prestigeIcon:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 30, + top = 100, + right = 94, + bottom = 164, + material = RegisterMaterial( "white" ), + alpha = 1 + } ) + self.prestigeIcon:registerAnimationState( "shown", { + alpha = 1 + } ) + self.prestigeIcon:registerAnimationState( "hidden", { + alpha = 0 + } ) + self.prestigeIcon:animateToState( "default" ) + self.prestigeIcon:registerEventHandler( "show_prestige_icon", function ( element, event ) + element:animateToState( "shown", event.anim_length or 0 ) + end ) + self.prestigeIcon:registerEventHandler( "hide_prestige_icon", function ( element, event ) + element:animateToState( "hidden", event.anim_length or 0 ) + end ) + self:addElement( self.prestigeIcon ) + end + if f2_arg0.use_playercard then + local charWindow = LUI.Playercard.new( nil, f2_arg0.card_props or {}, childNum ) + charWindow.id = "playercard_id" + local f2_local4 = f2_arg0.card_dims + if not f2_local4 then + f2_local4 = { + top = -15, + bottom = 35, + left = -50, + right = 6 + } + end + charWindow:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f2_local4.top, + bottom = f2_local4.bottom, + left = f2_local4.left, + right = f2_local4.right, + scale = f2_arg0.card_scale or 0, + alpha = 1 + } ) + charWindow:animateToState( "default" ) + self:addElement( charWindow ) + end + self.close = function () + LUI.UISquadMemberWindow.Shutdown( self, event ) + LUI.UIElement.close( self ) + end + + self.closeTree = function () + LUI.UISquadMemberWindow.Shutdown( self, event ) + LUI.UIElement.closeTree( self ) + end + + if self.squadMemberIndex and (f2_arg0.use_playercard or f2_arg0.use_3d_model) then + self:updateSquadMember( self.controller, self.squadMemberIndex ) + end + return self +end + +LUI.UISquadMemberWindow.InitCharacterWindow = function ( f17_arg0, f17_arg1 ) + if not CharacterScene.IsReady() then + return + end + local f17_local0 = f17_arg0:getParent() + f17_local0:processEvent( { + name = "close_loading_character_scene" + } ) + f17_arg0:closeChildren() + if f17_arg0.handle then + CharacterScene.FreeCharacter( f17_arg0.handle ) + end + f17_local0 = f17_arg0:getParent() + if not f17_local0 then + return + end + local f17_local1 = "iw6_kriss_mp" + local f17_local2 = "iw6_pp19_mp" + local f17_local3 = Cac.GetDefaultBodyModel( f17_local0.controller ) + local f17_local4 = Cac.GetDefaultHeadModel( f17_local0.controller ) + local f17_local5 = f17_arg0.storedCharacterData or {} + if f17_local0.squadMemberIndex then + f17_local5 = GetCharDataForSquadMember( f17_local0, f17_local0.controller, f17_local0.squadMemberIndex ) + end + f17_local1 = f17_local5.primaryWeaponName or f17_local1 + f17_local2 = f17_local5.secondaryWeaponName or f17_local2 + f17_local3 = f17_local5.bodyModel or f17_local3 + f17_local4 = f17_local5.headModel or f17_local4 + local f17_local6 = f17_local0.properties + local f17_local7 = f17_local6.charHandle + if not f17_local7 then + f17_local7 = f17_local0.id .. "_character_render" + end + local f17_local8 = CharacterScene.CreateCharacter( f17_local7, f17_local3, f17_local4, f17_local1 ) + CharacterScene.SetVisionSet( "mp_character_room" ) + CharacterScene.SetFOV( 43 ) + CharacterScene.SetAmbient( 0, 0, 0 ) + CharacterScene.SetSpin( f17_local8, 0, 0, 0 ) + if f17_local6 then + CharacterScene.SetCharacterUVs( f17_local8, f17_local6.uv_values[1], f17_local6.uv_values[2], f17_local6.uv_values[3], f17_local6.uv_values[4] ) + CharacterScene.PositionRelativeToCamera( f17_local8, f17_local6.character_pos[1], f17_local6.character_pos[2], f17_local6.character_pos[3] ) + if f17_local6.character_rot then + CharacterScene.SetBlendedRotation( f17_local8, f17_local6.character_rot[1], f17_local6.character_rot[2], f17_local6.character_rot[3], 0 ) + end + end + f17_local0.handle = f17_local8 + f17_local0.current_weapon = f17_local1 + f17_arg0:setCharacterHandle( f17_local8 ) + if f17_local0.storedCharacterData then + f17_local0:updateCharacter( f17_local0.storedCharacterData ) + elseif f17_local0.squadMemberIndex then + f17_local0:updateSquadMember( f17_local0.controller, f17_local0.squadMemberIndex ) + end + local self = LUI.UIElement.new() + self.id = "anim_handling_elem" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 1, + left = 0, + right = 1, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + self:registerAnimationState( "weapon_change_start", { + alpha = 1 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "weapon_change_start", LUI.UISquadMemberWindow.WeaponChangeStart ) + self:registerEventHandler( "transition_complete_weapon_change_start", function ( element, event ) + if not event.interrupted then + local f18_local0 = element:getParent() + f18_local0:processEvent( { + name = "weapon_changed", + new_weapon = element.new_weapon, + prev_weapon = element.prev_weapon, + offline_weapon = element.offline_weapon + } ) + end + end ) + f17_arg0:addElement( self ) + f17_arg0.anim_states = {} + f17_arg0.anim_states[1] = { + anim_state = "idle", + anim_name = Cac.GetRandomIdleAnim( f17_local0.current_weapon ), + weapon_name = f17_local0.current_weapon + } + LUI.UISquadMemberWindow.SetAnimation( f17_arg0:getParent(), f17_arg0.anim_states[1].anim_name, 0.2 ) + f17_local0:processEvent( { + name = "character_init_complete" + } ) +end + +LUI.UISquadMemberWindow.MoveTo = function ( f19_arg0, f19_arg1, f19_arg2 ) + if not CharacterScene.IsReady() then + return + elseif f19_arg0.handle then + CharacterScene.SetMovement( f19_arg0.handle, f19_arg1.Position[1], f19_arg1.Position[2], f19_arg1.Position[3], f19_arg2 or 0 ) + CharacterScene.SetBlendedRotation( f19_arg0.handle, f19_arg1.Rotation[1], f19_arg1.Rotation[2], f19_arg1.Rotation[3], f19_arg2 or 0 ) + end +end + +function GetCharDataForSquadMember( f20_arg0, f20_arg1, f20_arg2 ) + local f20_local0 = { + bodyModel = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body].GetSavedModel( f20_arg1, f20_arg0.squadLocation, f20_arg2 ), + headModel = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head].GetSavedModel( f20_arg1, f20_arg0.squadLocation, f20_arg2 ) + } + if not Engine.IsAliensMode() then + f20_local0.primaryWeaponName = Cac.BuildPrimaryWeaponName( f20_arg1, f20_arg0.squadLocation, f20_arg2, "loadouts", f20_arg0.loadoutSlot or 0 ) + f20_local0.secondaryWeaponName = Cac.BuildSecondaryWeaponName( f20_arg1, f20_arg0.squadLocation, f20_arg2, "loadouts", f20_arg0.loadoutSlot or 0 ) + f20_local0.experience = Engine.GetPlayerDataEx( f20_arg1, CoD.GetStatsGroupForGameMode(), f20_arg0.squadLocation, f20_arg2, "squadMemXP" ) + f20_local0.rank = Lobby.GetRankForXP( f20_local0.experience ) + f20_local0.prestige = Cac.GetPrestigeLevel( f20_arg1, f20_arg0.squadLocation ) + else + f20_local0.primaryWeaponName = "iw6_" .. string.sub( LUI.mp_menus.Aliens.GetAlienPerk( f20_arg1, 1 ), string.len( "perk_pistol_" ) + 1 ) .. "_mp" + f20_local0.experience = LUI.mp_menus.Aliens.getAliensExperience( f20_arg1 ) + f20_local0.rank = Lobby.GetAlienRankForXP( f20_local0.experience ) + f20_local0.prestige = LUI.mp_menus.Aliens.getAliensPrestigeLevel( f20_arg1 ) + end + f20_local0.background = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Background].GetSavedRef( f20_arg1, f20_arg0.squadLocation, f20_arg2 ) + f20_local0.patch = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch].GetSavedRef( f20_arg1, f20_arg0.squadLocation, f20_arg2 ) + f20_local0.clanTag = Cac.Customization.Fields[Cac.Customization.FieldIndexes.ClanTag].GetSavedRef( f20_arg1 ) + return f20_local0 +end + +LUI.UISquadMemberWindow.UpdateSavedCharacterWindow = function ( f21_arg0, f21_arg1, f21_arg2 ) + f21_arg0.squadMemberIndex = f21_arg2 + f21_arg0:updateCharacter( GetCharDataForSquadMember( f21_arg0, f21_arg1, f21_arg2 ) ) +end + +LUI.UISquadMemberWindow.UpdateCharacterWindow = function ( f22_arg0, f22_arg1 ) + if f22_arg1.background then + Cac.Customization.Fields[Cac.Customization.FieldIndexes.Background].PreviewFunction( controller, f22_arg0, nil, f22_arg1.background ) + end + if f22_arg1.patch then + Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch].InitFunction( controller, f22_arg0, nil, f22_arg1.patch ) + end + if f22_arg1.clanTag then + Cac.Customization.Fields[Cac.Customization.FieldIndexes.ClanTag].PreviewFunction( controller, f22_arg0, nil, f22_arg1.clanTag ) + end + f22_arg0:processEvent( { + name = "update_playercard", + experience = f22_arg1.experience, + rank = f22_arg1.rank, + prestige = f22_arg1.prestige + } ) + if not f22_arg0.handle then + f22_arg0.storedCharacterData = f22_arg1 + return + elseif f22_arg1.bodyModel then + if f22_arg1.patch then + CharacterScene.ChangeBody( f22_arg0.handle, f22_arg1.bodyModel, f22_arg1.patch ) + else + CharacterScene.ChangeBody( f22_arg0.handle, f22_arg1.bodyModel ) + end + end + if f22_arg1.headModel then + CharacterScene.ChangeHead( f22_arg0.handle, f22_arg1.headModel ) + end + if f22_arg1.primaryWeaponName then + CharacterScene.ChangeWeapon( f22_arg0.handle, f22_arg1.primaryWeaponName and "iw6_knifeonlymenu_mp" or f22_arg1.primaryWeaponName ) + LUI.UISquadMemberWindow.IdleChangeAnim( f22_arg0.charWindow, { + name = "idle_changed", + new_weapon = f22_arg1.primaryWeaponName + } ) + f22_arg0.current_weapon = f22_arg1.primaryWeaponName + end + if f22_arg1.secondaryWeaponName then + CharacterScene.ChangeStowedWeapon( f22_arg0.handle, f22_arg1.secondaryWeaponName ) + end +end + +LUI.UISquadMemberWindow.Shutdown = function ( f23_arg0, f23_arg1 ) + if f23_arg0.handle then + CharacterScene.FreeCharacter( f23_arg0.handle ) + f23_arg0.handle = nil + end +end + +LUI.UISquadMemberWindow.SetDisplayName = function ( f24_arg0, f24_arg1 ) + if f24_arg0.displayName then + f24_arg0.displayName:setText( f24_arg1 ) + end +end + +LUI.UISquadMemberWindow.SetPrestigeIcon = function ( f25_arg0, f25_arg1 ) + if f25_arg0.prestigeIcon then + f25_arg0.prestigeIcon:setImage( f25_arg1 ) + end +end + +LUI.UISquadMemberWindow.SetAnimation = function ( f26_arg0, f26_arg1, f26_arg2 ) + if not CharacterScene.IsReady() then + return + elseif f26_arg0.handle then + f26_arg0.playing_anim = f26_arg1 + if not f26_arg2 then + CharacterScene.PlayAnim( f26_arg0.handle, f26_arg1 ) + else + CharacterScene.PlayAnim( f26_arg0.handle, f26_arg1, f26_arg2 ) + end + end +end + +LUI.UISquadMemberWindow.SetBackground = function ( f27_arg0, f27_arg1 ) + if f27_arg0.background then + if f27_arg1 == nil or f27_arg1 == "" then + f27_arg0.background:animateToState( "hidden", 0 ) + else + f27_arg0.background:setImage( RegisterMaterial( f27_arg1 ) ) + f27_arg0.background:animateToState( "default", 0 ) + end + end +end + +LUI.UISquadMemberWindow.AddMemberName = function ( f28_arg0 ) + local f28_local0 = -15 + local self = LUI.UIElement.new( { + top = -60, + bottom = 0, + left = 1, + right = -1, + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true + } ) + self.id = "member_window_name_container_id" + local f28_local2 = LUI.UIImage.new( { + top = 0, + bottom = 0, + left = 0, + right = 0, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.g, + alpha = 0.5, + material = RegisterMaterial( "gradient_bottom" ) + } ) + f28_local2.id = "member_window_text_bg_id" + self:addElement( f28_local2 ) + f28_arg0.displayName = LUI.UIMarqueeText.new() + f28_arg0.displayName.id = "member_window_name_id" + f28_arg0.displayName:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + top = -CoD.TextSettings.ExtraBigFont.Height + f28_local0, + right = 0, + bottom = f28_local0, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f28_arg0.displayName:animateToState( "default" ) + self:addElement( f28_arg0.displayName ) + local f28_local3 = nil + f28_local3 = LUI.UIHorizontalList.new() + f28_local3.id = "member_window_unlock_text" + f28_local3:registerAnimationState( "default", { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + top = 0, + right = 0, + bottom = 0, + alpha = 1, + alignment = LUI.Alignment.Center, + spacing = 2 + } ) + f28_local3:registerAnimationState( "hidden", { + alpha = 0 + } ) + f28_local3:animateToState( "default" ) + f28_local3:registerEventHandler( "show_unlock_text", function ( element, event ) + element:animateToState( "default" ) + end ) + f28_local3:registerEventHandler( "hide_unlock_text", function ( element, event ) + element:animateToState( "hidden" ) + end ) + local f28_local4 = LUI.UIImage.new( { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + height = 32, + left = 0, + right = 32, + material = RegisterMaterial( "icon_unlock_token_32" ) + } ) + local f28_local5 = Engine.Localize( "@LUA_MENU_SQUAD_MEMBER_UNLOCK_COST", Cac.MemberCost[1] ) + local f28_local6, f28_local7, f28_local8, f28_local9 = GetTextDimensions( f28_local5, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f28_local10 = LUI.UIText.new( { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + height = CoD.TextSettings.NormalFont.Height, + right = f28_local8 + 1, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f28_local10:setText( f28_local5 ) + f28_local3:addElement( f28_local4 ) + f28_local3:addElement( f28_local10 ) + self:addElement( f28_local3 ) + f28_arg0:addElement( self ) +end + +LUI.UISquadMemberWindow.AddLoadingWidget = function ( f31_arg0, f31_arg1 ) + local f31_local0 = f31_arg1.mask_pos_data + if not f31_local0 then + f31_local0 = { + left = 0, + top = 0, + right = 0, + bottom = 0 + } + end + local f31_local1 = f31_arg1.mask_dims_data + if not f31_local1 then + f31_local1 = { + width = 512, + height = 512 + } + end + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f31_local0.top, + left = f31_local0.left, + width = f31_local1.width, + height = f31_local1.height + } ) + self:registerEventHandler( "close_loading_character_scene", function ( element, event ) + element:close() + end ) + f31_arg0:addElement( self ) + local f31_local3 = LUI.MenuBuilder.buildItems( { + type = "live_dialog_text_box", + id = "loading_widget_id", + properties = { + message = Engine.Localize( "@MENU_LOADING_DOTS" ), + overlay_alpha = 0 + } + }, {}, f31_arg0 ) + f31_local3:processEvent( { + name = "hide_popup_background" + } ) + self:addElement( f31_local3 ) +end + +LUI.UISquadMemberWindow.RightStickSpin = function ( f33_arg0, f33_arg1 ) + if Engine.IsGamepadEnabled() ~= 1 then + return + end + local f33_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f33_arg0 ) + if f33_local0 and f33_local0.exclusiveController and f33_arg1.controller and f33_local0.exclusiveController ~= f33_arg1.controller then + return + end + local f33_local1 = f33_arg1.rightStickDirection + local f33_local2 = f33_arg1.rightStickMagnitude + local f33_local3 = f33_arg0:getParent() + f33_local3 = f33_local3.handle + if f33_local2 > 0.1 then + if f33_local1 < 35 and f33_local1 > -35 then + CharacterScene.SetSpin( f33_local3, 0, f33_local2 * 3, 0 ) + elseif not (f33_local1 >= -145 or f33_local1 < -180) or f33_local1 <= 180 and f33_local1 > 145 then + CharacterScene.SetSpin( f33_local3, 0, -f33_local2 * 3, 0 ) + else + CharacterScene.SetSpin( f33_local3, 0, 0, 0 ) + end + else + CharacterScene.SetSpin( f33_local3, 0, 0, 0 ) + end +end + +LUI.UISquadMemberWindow.PCSpin = function ( f34_arg0, f34_arg1 ) + if Engine.IsGamepadEnabled() == 1 then + return + end + local f34_local0 = f34_arg0:getParent() + f34_local0 = f34_local0.handle + if not f34_arg0.m_leftMouseDown or not f34_arg1.x then + CharacterScene.SetSpin( f34_local0, 0, 0, 0 ) + return + end + local f34_local1 = LUI.clamp( ((f34_arg0.mouse_last_x or 0) - f34_arg1.x) * -100, -10, 10 ) + if f34_local1 ~= 0 then + CharacterScene.SetSpin( f34_local0, 0, f34_local1, 0 ) + else + CharacterScene.SetSpin( f34_local0, 0, 0, 0 ) + end + f34_arg0.mouse_last_x = f34_arg1.x +end + +LUI.UISquadMemberWindow.ChangeAnimOnLoopedEnd = function ( f35_arg0, f35_arg1 ) + LUI.UISquadMemberWindow.DoAnimChange( f35_arg0, f35_arg1 ) +end + +LUI.UISquadMemberWindow.ChangeAnimOnEnd = function ( f36_arg0, f36_arg1 ) + LUI.UISquadMemberWindow.DoAnimChange( f36_arg0, f36_arg1 ) +end + +LUI.UISquadMemberWindow.WeaponChangeStowed = function ( f37_arg0, f37_arg1 ) + local f37_local0 = f37_arg0:getParent() + if f37_local0.handle then + f37_local0 = f37_arg1.weapon + if not f37_local0 then + f37_local0 = Cac.BuildWeaponName( f37_arg1.weapon ) + end + local f37_local1 = CharacterScene.ChangeStowedWeapon + local f37_local2 = f37_arg0:getParent() + f37_local1( f37_local2.handle, f37_local0 ) + end +end + +LUI.UISquadMemberWindow.WeaponChangeStart = function ( f38_arg0, f38_arg1 ) + f38_arg0.new_weapon = f38_arg1.new_weapon + f38_arg0.prev_weapon = f38_arg1.prev_weapon + f38_arg0.offline_weapon = f38_arg1.offline_weapon + f38_arg0:cancelAnimateToState() + f38_arg0:animateToState( "weapon_change_start", 400 ) +end + +LUI.UISquadMemberWindow.IdleChangeAnim = function ( f39_arg0, f39_arg1 ) + local f39_local0 = f39_arg0:getParent() + local f39_local1 = f39_local0.handle + local f39_local2 = string.find( f39_arg1.new_weapon, "riotshield" ) + local f39_local3 = string.find( f39_arg1.new_weapon, "knifeonly" ) + local f39_local4 = Cac.Customization.Animations.idles.normal[math.random( 1, #Cac.Customization.Animations.idles.normal )] + if f39_local2 then + f39_local4 = Cac.Customization.Animations.idles.riotshield[math.random( 1, #Cac.Customization.Animations.idles.riotshield )] + elseif f39_local3 then + f39_local4 = Cac.Customization.Animations.idles.knifeonly[math.random( 1, #Cac.Customization.Animations.idles.knifeonly )] + end + if not f39_local0.current_weapon then + LUI.UISquadMemberWindow.SetAnimation( f39_local0, f39_local4, 0 ) + else + local f39_local5 = string.find( f39_local0.current_weapon, "riotshield" ) + local f39_local6 = string.find( f39_local0.current_weapon, "knifeonly" ) + if not (not f39_local2 or f39_local5) or f39_local3 and not f39_local6 then + LUI.UISquadMemberWindow.SetAnimation( f39_local0, f39_local4, 0 ) + elseif not (f39_local2 or not f39_local5) or not f39_local3 and f39_local6 then + LUI.UISquadMemberWindow.SetAnimation( f39_local0, f39_local4, 0 ) + end + end + f39_local0.current_weapon = f39_arg1.new_weapon + if not f39_arg0.anim_states then + f39_arg0.anim_states = {} + end + f39_arg0.anim_states[1] = { + anim_state = "idle", + anim_name = f39_local4, + weapon_name = f39_local0.current_weapon + } +end + +LUI.UISquadMemberWindow.AnimateToFirst = function ( f40_arg0, f40_arg1 ) + local f40_local0 = f40_arg0:getParent() + local f40_local1 = f40_arg0.anim_states[1] + if f40_local1.anim_state == "grab" then + CharacterScene.ChangeWeapon( f40_local0.handle, f40_local1.weapon_name and "iw6_knifeonlymenu_mp" or f40_local1.weapon_name ) + f40_local0.current_weapon = f40_local1.weapon_name + local f40_local2 = LUI.FlowManager.GetMenuScopedDataFromElement( f40_local0 ) + if f40_local2.slot then + local f40_local3 = Cac.BuildPrimaryWeaponName( f40_local2.controller or f40_local2.exclusiveController, f40_local2.squadLocation, f40_local2.squadMemberIndex, f40_local2.classLocation, f40_local2.slot ) + if f40_local3 ~= f40_local1.weapon_name then + f40_arg0:processEvent( { + name = "weapon_change_start", + new_weapon = f40_local3, + prev_weapon = f40_local1.weapon_name + } ) + end + end + end + LUI.UISquadMemberWindow.SetAnimation( f40_local0, f40_local1.anim_name, 0.2 ) +end + +LUI.UISquadMemberWindow.DoAnimChange = function ( f41_arg0, f41_arg1 ) + local f41_local0 = f41_arg0:getParent() + if f41_arg0.anim_states[1].anim_state == "idle" then + local f41_local1 = f41_arg0.anim_states[1] + f41_local1.anim_name = Cac.GetRandomIdleAnim( f41_local1.weapon_name, f41_local1.anim_name ) + LUI.UISquadMemberWindow.SetAnimation( f41_local0, f41_local1.anim_name, 0.2 ) + else + local f41_local1 = f41_local0.handle + if #f41_arg0.anim_states > 1 then + for f41_local2 = 1, #f41_arg0.anim_states, 1 do + f41_arg0.anim_states[f41_local2] = f41_arg0.anim_states[f41_local2 + 1] + end + end + LUI.UISquadMemberWindow.AnimateToFirst( f41_arg0, f41_arg1 ) + end +end + +LUI.UISquadMemberWindow.WeaponChangeAnim = function ( f42_arg0, f42_arg1 ) + local f42_local0 = f42_arg0:getParent() + local f42_local1 = f42_local0.current_weapon + local f42_local2 = nil + if f42_arg1.offline_weapon then + f42_local2 = f42_arg1.offline_weapon + else + f42_local2 = f42_arg1.new_weapon + end + if f42_local1 == f42_local2 then + return + end + local f42_local3, f42_local4 = nil + if f42_local1 and string.find( f42_local1, "riotshield" ) then + f42_local3 = Cac.Customization.Animations.weapon_grabs.riotshield[1] + elseif f42_local1 and string.find( f42_local1, "knifeonly" ) then + f42_local3 = Cac.Customization.Animations.weapon_grabs.knifeonly[1] + elseif math.random( 1, 2 ) == 1 then + f42_local3 = Cac.Customization.Animations.weapon_grabs.normal_1[1] + else + f42_local3 = Cac.Customization.Animations.weapon_grabs.normal_2[1] + end + if string.find( f42_local2, "riotshield" ) then + f42_local4 = Cac.Customization.Animations.weapon_grabs.riotshield[2] + elseif string.find( f42_local2, "knifeonly" ) then + f42_local4 = Cac.Customization.Animations.weapon_grabs.knifeonly[2] + elseif math.random( 1, 2 ) == 1 then + f42_local4 = Cac.Customization.Animations.weapon_grabs.normal_1[2] + else + f42_local4 = Cac.Customization.Animations.weapon_grabs.normal_2[2] + end + if f42_arg0.anim_states[1].anim_state == "idle" then + f42_arg0.anim_states[1] = { + anim_state = "toss", + anim_name = f42_local3, + weapon_name = f42_local1 + } + f42_arg0.anim_states[2] = { + anim_state = "grab", + anim_name = f42_local4, + weapon_name = f42_local2 + } + f42_arg0.anim_states[3] = { + anim_state = "idle", + anim_name = Cac.GetRandomIdleAnim( f42_local2 ), + weapon_name = f42_local2 + } + LUI.UISquadMemberWindow.AnimateToFirst( f42_arg0, f42_arg1 ) + elseif f42_arg0.anim_states[1].anim_state == "toss" then + f42_arg0.anim_states[2] = { + anim_state = "grab", + anim_name = f42_local4, + weapon_name = f42_local2 + } + f42_arg0.anim_states[3] = { + anim_state = "idle", + anim_name = Cac.GetRandomIdleAnim( f42_local2 ), + weapon_name = f42_local2 + } + elseif f42_arg0.anim_states[1].anim_state == "grab" then + f42_arg0.anim_states[2] = { + anim_state = "toss", + anim_name = f42_local3, + weapon_name = f42_local1 + } + f42_arg0.anim_states[3] = { + anim_state = "grab", + anim_name = f42_local4, + weapon_name = f42_local2 + } + f42_arg0.anim_states[4] = { + anim_state = "idle", + anim_name = Cac.GetRandomIdleAnim( f42_local2 ), + weapon_name = f42_local2 + } + end +end + +LUI.MenuBuilder.registerType( "UISquadMemberWindow", LUI.UISquadMemberWindow.build ) diff --git a/lui/mp_menus/main.dec.lua b/lui/mp_menus/main.dec.lua new file mode 100644 index 0000000..84dd066 --- /dev/null +++ b/lui/mp_menus/main.dec.lua @@ -0,0 +1,217 @@ +DebugPrint( "Running main.lua" ) +require( "LUI.CoD" ) +require( "LUI.mp_menus.MenuData" ) +require( "LUI.MenuGenerics" ) +require( "LUI.MenuGenericButtons" ) +require( "LUI.common_menus.CommonPopups" ) +require( "LUI.ButtonHelperText" ) +if Engine.HasSpeechFeature() then + require( "LUI.MenuAutoNav" ) + require( "LUI.Speech" ) + require( "LUI.common_menus.KinectControlMenu" ) + require( "LUI.common_menus.KinectUtils" ) + require( "LUI.common_menus.WhatCanISay" ) +end +if Engine.InFrontend() then + require( "LUI.mp_menus.CacCustomize" ) +end +require( "LUI.common_menus.RankUtils" ) +require( "LUI.common_menus.CacUtils" ) +require( "LUI.common_menus.CacCustomizeUtils" ) +require( "LUI.mp_menus.CacLoadoutUtils" ) +require( "LUI.mp_menus.PlayerDataInit" ) +if Engine.InFrontend() or Engine.IsAliensMode() then + require( "LUI.mp_menus.Aliens" ) + require( "LUI.mp_menus.AliensPurchasables" ) +end +require( "LUI.common_menus.OptionsLayout" ) +require( "LUI.common_menus.Options" ) +require( "LUI.mp_menus.CacRecap" ) +require( "LUI.common_menus.FriendsWidget" ) +require( "LUI.common_menus.FriendsList" ) +require( "LUI.common_menus.FriendsListUtils" ) +require( "LUI.mp_menus.MPLobbyUtils" ) +if Engine.InFrontend() then + require( "LUI.PersistentBackground" ) + require( "LUI.mp_menus.MLGUtils" ) + require( "LUI.mp_menus.SvSUtils" ) + require( "LUI.mp_menus.AliensIntel" ) + require( "LUI.mp_menus.AliensLoadout" ) + require( "LUI.ButtonDescText" ) + require( "LUI.common_menus.GameManual" ) + require( "LUI.common_menus.ProfilePopup" ) + require( "LUI.common_menus.PlayerCard" ) + require( "LUI.common_menus.VirtualKeyboard" ) + require( "LUI.mp_menus.AARUtils" ) + require( "LUI.mp_menus.AARUnlockScreen" ) + require( "LUI.mp_menus.AARCommon" ) + require( "LUI.mp_menus.AARSummary" ) + require( "LUI.mp_menus.AARMain" ) + require( "LUI.mp_menus.AARMini" ) + require( "LUI.mp_menus.CacMain" ) + require( "LUI.mp_menus.CacEdit" ) + require( "LUI.mp_menus.CacEditSelectionInfo" ) + require( "LUI.mp_menus.CacEditPopup" ) + require( "LUI.mp_menus.CacEditChooseImagePopup" ) + require( "LUI.mp_menus.CacEditWeaponAttachChoose" ) + require( "LUI.mp_menus.CacEditWeaponStatsInfoPane" ) + require( "LUI.mp_menus.CacEditWeaponPerformanceInfoPane" ) + require( "LUI.mp_menus.CacInfoPanes" ) + require( "LUI.mp_menus.CacAbilitiesAlt" ) + require( "LUI.mp_menus.CacMemberSelect" ) + require( "LUI.mp_menus.CacPrestigeDetails" ) + require( "LUI.mp_menus.MPPlaylist" ) + require( "LUI.mp_menus.MPPopups" ) + require( "LUI.mp_menus.MPLobbySearchWidget" ) + require( "LUI.mp_menus.mpLobbyWidgets" ) + require( "LUI.mp_menus.MPLobbyNavigation" ) + require( "LUI.mp_menus.MPLobbyCharacterView" ) + require( "LUI.mp_menus.MPLobbyPlayerStats" ) + require( "LUI.mp_menus.MPMainMenu" ) + require( "LUI.mp_menus.MPXboxLiveMenu" ) + require( "LUI.mp_menus.SystemLinkMenu" ) + require( "LUI.mp_menus.SystemLinkJoinMenu" ) + require( "LUI.mp_menus.SystemLinkGameSetupMenu" ) + require( "LUI.mp_menus.SplitScreenGameSetupMenu" ) + require( "LUI.mp_menus.MPPlayerPopups" ) + require( "LUI.mp_menus.MPLivePrivateLobby" ) + require( "LUI.mp_menus.MPLivePublicLobby" ) + require( "LUI.mp_menus.SplitScreenSignIn" ) + require( "LUI.mp_menus.MPBarracks" ) + require( "LUI.mp_menus.MPCoDAnywhere" ) + require( "LUI.mp_menus.MPCustomClassRestrictions" ) + require( "LUI.mp_menus.MPMemberList" ) + require( "LUI.mp_menus.MPGameModeSelectMenu" ) + require( "LUI.mp_menus.MPGameSetupMenu" ) + require( "LUI.mp_menus.MPGameSetupModeMenu" ) + require( "LUI.mp_menus.MPGameSetupOptionsMenu" ) + require( "LUI.mp_menus.MPLeaderboard" ) + require( "LUI.mp_menus.MPLeaderboardPopups" ) + require( "LUI.mp_menus.MPPrestigeReset" ) + require( "LUI.mp_menus.MPStatsReset" ) + require( "LUI.mp_menus.AARScoreboard" ) + require( "LUI.mp_menus.AAROperationProgress" ) + require( "LUI.mp_menus.KillstreakSelections" ) + require( "LUI.mp_menus.SquadPrePartyLobby" ) + require( "LUI.mp_menus.Leaderboards" ) + require( "LUI.mp_menus.LeaderboardUtils" ) + require( "LUI.mp_menus.MPMapSetupMenu" ) + require( "LUI.mp_menus.MPSavedModeSelectMenu" ) + require( "LUI.mp_menus.LUISquadMemberWindow" ) + require( "LUI.mp_menus.Operations" ) + require( "LUI.mp_menus.OperationsUtils" ) + require( "LUI.mp_menus.ClanElements" ) + require( "LUI.mp_menus.ClanInvites" ) + require( "LUI.mp_menus.ClanDetails" ) + require( "LUI.BootScreenMargins" ) + require( "LUI.mp_menus.ChooseCoDAnywherePlatform" ) + require( "LUI.mp_menus.SnsUtils" ) + require( "LUI.mp_menus.SnsElements" ) + require( "LUI.mp_menus.Store" ) + require( "LUI.mp_menus.SquadReports" ) + require( "LUI.mp_menus.SquadReportDetail" ) + require( "LUI.mp_menus.ArchetypeSelect" ) + require( "LUI.mp_menus.AARSquadSummary" ) + require( "LUI.mp_menus.SquadsModeSelect" ) + require( "LUI.mp_menus.MOTDWidgets" ) + require( "LUI.mp_menus.MOTDUtils" ) + require( "LUI.mp_menus.SocialFeed" ) + require( "LUI.mp_menus.LoadoutBuilder" ) + if not Engine.IsConsoleGame() then + require( "LUI.PCOptions" ) + require( "LUI.AdvancedVideo" ) + require( "LUI.MovementControls" ) + require( "LUI.ActionsControls" ) + require( "LUI.ChatControls" ) + require( "LUI.GamepadControls" ) + require( "LUI.LookControls" ) + end + require( "LUI.luitest" ) +end +if not Engine.InFrontend() then + local f0_local0 = Engine.GetDvarString( "ui_gametype" ) + local f0_local1 = Engine.GetDvarString( "ui_mapname" ) + require( "LUI.mp_hud.MLGHud" ) + require( "LUI.mp_hud.OptionsMenu" ) + require( "LUI.mp_hud.endGameMenu" ) + require( "LUI.mp_hud.DamageFeedbackHud" ) + require( "LUI.mp_hud.GameMessageHud" ) + require( "LUI.mp_hud.ScreenEffectsHud" ) + require( "LUI.mp_hud.Hints" ) + require( "LUI.mp_hud.PredatorMissileOverlayHud" ) + require( "LUI.mp_hud.MatchStartHud" ) + require( "LUI.mp_hud.MutePlayers" ) + require( "LUI.mp_hud.HostMigration" ) + require( "LUI.mp_hud.VanguardOverlayHud" ) + require( "LUI.mp_hud.WeaponAttachment" ) + require( "LUI.mp_hud.TalkerHud" ) + if Engine.IsPS4() then + require( "LUI.common_menus.VitaHud" ) + end + if Engine.IsAliensMode() then + require( "LUI.mp_hud.AlienHud" ) + require( "LUI.mp_hud.AlienHudTechTree" ) + require( "LUI.mp_hud.AlienScoreboards" ) + require( "LUI.mp_hud.AlienCapturingHud" ) + require( "LUI.mp_hud.AlienChaos" ) + require( "LUI.mp_hud.AlienVanguardOverlayHud" ) + else + require( "LUI.mp_hud.hudUtils" ) + require( "LUI.mp_hud.hud" ) + if CoD.IsFireTeamMode() then + require( "LUI.mp_hud.FireTeamMenu" ) + end + require( "LUI.mp_hud.PlayerCardHud" ) + require( "LUI.mp_hud.PointsPopupHud" ) + require( "LUI.mp_hud.TimersHud" ) + require( "LUI.mp_hud.ScorelistHud" ) + require( "LUI.mp_hud.Scoreboard" ) + require( "LUI.mp_hud.WeaponInfoHud" ) + require( "LUI.mp_hud.PlayerInfoHud" ) + require( "LUI.mp_hud.MinimapHud" ) + require( "LUI.mp_hud.jammerEffectHud" ) + require( "LUI.mp_hud.TeamScoresHud" ) + require( "LUI.mp_hud.KillstreakHud" ) + require( "LUI.mp_hud.SplashesHud" ) + require( "LUI.mp_hud.CapturingHud" ) + if f0_local0 == "horde" then + require( "LUI.mp_hud.HordeHud" ) + require( "LUI.mp_hud.HordePerksHud" ) + end + require( "LUI.mp_hud.IntelChallenges" ) + require( "LUI.mp_hud.KillCamHud" ) + require( "LUI.mp_hud.OverlayHud" ) + require( "LUI.mp_hud.CharSelectMenu" ) + require( "LUI.mp_hud.TeamSelect" ) + require( "LUI.mp_hud.ObituaryHud" ) + require( "LUI.mp_hud.SpectatorHud" ) + require( "LUI.mp_hud.OptionsMenuScoreboard" ) + require( "LUI.mp_hud.HelicopterPilotOverlayHud" ) + require( "LUI.mp_hud.OdinOverlayHud" ) + require( "LUI.mp_hud.JuggernautOverlayHud" ) + require( "LUI.mp_hud.A10OverlayHud" ) + require( "LUI.mp_hud.PerksOnSpawnHud" ) + require( "LUI.mp_hud.RoundEndHud" ) + if f0_local1 == "mp_battery3" then + require( "LUI.mp_hud.PredatorOverlayHud2" ) + end + if f0_local1 == "mp_favela_iw6" then + require( "LUI.mp_hud.AC130OverlayHud" ) + end + if f0_local1 == "mp_dig" then + require( "LUI.mp_hud.DigHud" ) + end + end + if not Engine.IsConsoleGame() then + require( "LUI.mp_hud.inGamePCOptions" ) + require( "LUI.mp_hud.inGameAdvancedVideo" ) + require( "LUI.mp_hud.inGameMovementControls" ) + require( "LUI.mp_hud.inGameActionsControls" ) + require( "LUI.mp_hud.inGameChatControls" ) + require( "LUI.mp_hud.inGameGamepadControls" ) + require( "LUI.mp_hud.inGameLookControls" ) + else + require( "LUI.mp_hud.inGameControls" ) + end +end +DisableGlobals() diff --git a/lui/mp_menus/menudata.dec.lua b/lui/mp_menus/menudata.dec.lua new file mode 100644 index 0000000..5ab9209 --- /dev/null +++ b/lui/mp_menus/menudata.dec.lua @@ -0,0 +1,19 @@ +DebugPrint( "Running MenuData.lua" ) +MPConfig = { + default_dvars = "exec dvar_defaults.cfg", + default_xboxlive = "exec default_xboxlive.cfg", + default_splitscreen = "exec default_splitscreen.cfg", + default_systemlink = "exec default_systemlink.cfg", + default_aliens = "exec default_aliens.cfg" +} +function ConfigureResolution() + if Engine.GetDvarBool( "hidef" ) then + Engine.Exec( "exec default_720p.cfg" ) + else + Engine.Exec( "exec default_480p.cfg" ) + end +end + +FireTeam = { + tactic_name = "@MPUI_FT_TACTIC_NONE" +} diff --git a/lui/mp_menus/mlgutils.dec.lua b/lui/mp_menus/mlgutils.dec.lua new file mode 100644 index 0000000..281cf16 --- /dev/null +++ b/lui/mp_menus/mlgutils.dec.lua @@ -0,0 +1,140 @@ +MLG = MLG or {} +MLG.GetRulesVersionNumber = function () + return Engine.MarkLocalized( MatchRules.GetData( "mlgVersion" ) or "0.0.0" ) +end + +MLG.IsFeatureAvailable = function () + local f2_local0 = Engine.GetDvarBool( "systemlink" ) + if not f2_local0 then + f2_local0 = IsPrivateMatch and IsPrivateMatch() + end + if f2_local0 then + f2_local0 = not Engine.IsAliensMode() + end + if f2_local0 then + f2_local0 = Engine.GetDvarBool( "using_mlg" ) + end + return f2_local0 +end + +MLG.CanIAdjustMLGSettings = function () + if not MLG.IsFeatureAvailable() then + return false + end + local f3_local0 = Engine.GetDvarBool( "systemlink" ) + if not f3_local0 then + f3_local0 = Lobby.IsGameHost() + end + return f3_local0 +end + +MLG.AreMLGRulesEnabled = function () + if not MLG.IsFeatureAvailable() then + return false + end + local f4_local0 = Engine.GetDvarBool( "systemlink" ) + if Engine.GetDvarBool( "xblive_competitionmatch" ) == nil then + Engine.Exec( "set xblive_competitionmatch 0" ) + end + local f4_local1 + if not f4_local0 then + f4_local1 = Lobby.IsUsingMLGRules() + if not f4_local1 then + + else + return f4_local1 + end + end + f4_local1 = f4_local0 and Engine.GetDvarBool( "xblive_competitionmatch" ) +end + +MLG.SetUsingMLGRules = function ( f5_arg0 ) + Engine.SetDvarBool( "xblive_competitionmatch", f5_arg0 ) + if not Engine.GetDvarBool( "systemlink" ) then + Lobby.SetUsingMLGRules( f5_arg0 ) + end + if (Engine.SplitscreenPlayerCount() > 1) or CoD.IsUsingAspectRatio( 1.33 ) then + for f5_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do + LobbyMember.SelectedMember_SetLocalMemberMLGSpectator( false, f5_local0 ) + end + end +end + +MLG.ToggleMLGRules = function ( f6_arg0 ) + if MLG.CanIAdjustMLGSettings() then + if not MLG.AreMLGRulesEnabled() then + if Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, Engine.GetDvarString( "ui_gametype" ), GameTypesTable.Cols.MLG ) == "1" and MatchRules.HasMLGRecipeAvailable() then + MLG.SetUsingMLGRules( true ) + MatchRules.LoadMLGRecipe() + elseif not Engine.UserCanPlayOnline( f6_arg0 ) then + LUI.FlowManager.RequestPopupMenu( self, "mlg_error_no_rules_available_offline", false, f6_arg0, false ) + else + LUI.FlowManager.RequestPopupMenu( self, "mlg_error_no_rules_available", false, f6_arg0, false ) + end + else + MLG.SetUsingMLGRules( false ) + MatchRules.LoadMatchRulesDataDefault() + end + end +end + +MLG.Refresh = function ( f7_arg0 ) + local f7_local0 = MLG.AreMLGRulesEnabled() + f7_arg0.properties = f7_arg0.properties or {} + if f7_arg0.properties.cacheMLGenabled ~= f7_local0 then + local f7_local1 = "mlg_" + local f7_local2 + if f7_local0 then + f7_local2 = "enabled" + if not f7_local2 then + + else + f7_arg0:dispatchEventToRoot( { + name = f7_local1 .. f7_local2, + immediate = true + } ) + MLG.SetButtonHelper( f7_arg0, f7_local0 ) + f7_arg0.properties.cacheMLGenabled = f7_local0 + end + end + f7_local2 = "disabled" + end +end + +MLG.SetButtonHelper = function ( f8_arg0, f8_arg1 ) + local f8_local0 = "" + if MLG.CanIAdjustMLGSettings() then + if f8_arg1 then + f8_local0 = Engine.Localize( "PATCH_MENU_DISABLE_MLG_RULES" ) + else + f8_local0 = Engine.Localize( "PATCH_MENU_ENABLE_MLG_RULES" ) + end + end + f8_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = f8_local0, + side = "left", + clickable = true + } ) +end + +MLG.Toggle = function ( f9_arg0, f9_arg1 ) + if MLG.CanIAdjustMLGSettings() then + MLG.ToggleMLGRules( f9_arg1.controller ) + end + MLG.Refresh( f9_arg0 ) +end + +MLG.Hide = function ( f10_arg0 ) + f10_arg0:processEvent( { + name = "mlg_disabled" + } ) + f10_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left" + } ) +end + diff --git a/lui/mp_menus/motdutils.dec.lua b/lui/mp_menus/motdutils.dec.lua new file mode 100644 index 0000000..c0dc4d2 --- /dev/null +++ b/lui/mp_menus/motdutils.dec.lua @@ -0,0 +1,318 @@ +function TryForceOpenMOTD() + if Lobby.IsInPrivateParty() and not Lobby.IsPrivatePartyHost() then + return + end + local f1_local0 = Engine.GetFirstActiveController() + if not Engine.IsProfileSignedIn( f1_local0 ) then + return false + elseif not CanReadReserveData( f1_local0 ) then + return false + end + local f1_local1 = {} + local f1_local2 = 2 + if HasSeenMOTDToday( f1_local0 ) and Engine.GetDvarString( "alwaysShowMOTD" ) ~= "1" then + return false + elseif Engine.HasSpeechFeature() and LUI.MenuAutoNav.IsRunning() then + return false + end + SetHasSeenMOTDToday( f1_local0 ) + local f1_local3 = GetWelcomeScreenType( f1_local0 ) + if f1_local3 then + table.insert( f1_local1, f1_local3 ) + end + if #f1_local1 < f1_local2 and ShouldShowCodAnywherePrompt( f1_local0 ) then + table.insert( f1_local1, "codAnywhereUpsell" ) + end + if Engine.GetDvarString( "motd" ) ~= "" then + table.insert( f1_local1, "motd" ) + end + local f1_local4 = GetVotingLayout( f1_local0 ) + if f1_local4 then + StartVoteImageDownload( f1_local0 ) + table.insert( f1_local1, f1_local4 ) + end + if #f1_local1 < f1_local2 and ShouldShowFestivePackUpsell( f1_local0 ) then + table.insert( f1_local1, "festiveUpsell" ) + end + if #f1_local1 < f1_local2 and ShouldShowWolfPackUpsell( f1_local0 ) then + table.insert( f1_local1, "wolfpackUpsell" ) + end + if #f1_local1 < f1_local2 and ShouldShowSeasonPassUpsell( f1_local0 ) then + table.insert( f1_local1, "seasonPassUpsell" ) + end + if #f1_local1 < f1_local2 and ShouldShowDownloadReminder( f1_local0 ) then + table.insert( f1_local1, "downloadReminder" ) + end + if #f1_local1 > 0 then + LUI.FlowManager.RequestPopupMenu( self, "motd_main", false, f1_local0, false, { + layoutQueue = f1_local1 + }, nil, nil, false ) + return true + end + return false +end + +function CanReadReserveData( f2_arg0 ) + if Engine.GetPlayerDataReservedInt( f2_arg0, CoD.StatsGroup.Common, "welcome_screen_count" ) then + return true + else + return false + end +end + +function ResetMOTDCounters( f3_arg0 ) + Engine.SetPlayerDataReservedInt( f3_arg0, CoD.StatsGroup.Common, "welcome_screen_count", 0 ) + Engine.SetPlayerDataReservedInt( f3_arg0, CoD.StatsGroup.Common, "cod_anywhere_screen_count", 0 ) + Engine.SetPlayerDataReservedInt( f3_arg0, CoD.StatsGroup.Common, "season_pass_upsell_count", 0 ) + Engine.SetPlayerDataReservedInt( f3_arg0, CoD.StatsGroup.Common, "motd_today_day", 0 ) + Engine.SetPlayerDataReservedInt( f3_arg0, CoD.StatsGroup.Common, "motd_today_month", 0 ) +end + +function HasSeenWelcomeScreen( f4_arg0 ) + return Engine.GetPlayerDataReservedInt( f4_arg0, CoD.StatsGroup.Common, "welcome_screen_count" ) >= 1 +end + +function SetHasSeenWelcomeScreen( f5_arg0 ) + Engine.SetPlayerDataReservedInt( f5_arg0, CoD.StatsGroup.Common, "welcome_screen_count", 1 ) +end + +function HasPlayedBlops2( f6_arg0 ) + return Engine.GetPlayerDataEx( f6_arg0, CoD.StatsGroup.Common, "pastTitleData", "playedblackops2" ) +end + +function Blops2Prestige( f7_arg0 ) + return Engine.GetPlayerDataEx( f7_arg0, CoD.StatsGroup.Common, "pastTitleData", "blackops2prestige" ) +end + +function HasPlayedMW3( f8_arg0 ) + return Engine.GetPlayerDataEx( f8_arg0, CoD.StatsGroup.Common, "pastTitleData", "playedmw3" ) +end + +function MW3Prestige( f9_arg0 ) + return Engine.GetPlayerDataEx( f9_arg0, CoD.StatsGroup.Common, "pastTitleData", "mw3prestige" ) +end + +function GetWelcomeScreenType( f10_arg0 ) + if not HasSeenWelcomeScreen( f10_arg0 ) then + local f10_local0 = false + local f10_local1 = HasPlayedMW3( f10_arg0 ) + if not f10_local1 then + f10_local1 = HasPlayedBlops2( f10_arg0 ) + end + SetHasSeenWelcomeScreen( f10_arg0 ) + if f10_local0 then + return "welcomeFounder" + elseif f10_local1 then + return "welcomeSoldier" + else + return "welcomeNoob" + end + else + return nil + end +end + +function HasSeenMOTDToday( f11_arg0 ) + local f11_local0 = Engine.GetRawMonthDayYear() + if f11_local0 then + if f11_local0.day ~= Engine.GetPlayerDataReservedInt( f11_arg0, CoD.StatsGroup.Common, "motd_today_day" ) then + return false + elseif f11_local0.month ~= Engine.GetPlayerDataReservedInt( f11_arg0, CoD.StatsGroup.Common, "motd_today_month" ) then + return false + end + end + return true +end + +function SetHasSeenMOTDToday( f12_arg0 ) + local f12_local0 = Engine.GetRawMonthDayYear() + if f12_local0 and f12_local0.day and f12_local0.month then + Engine.SetPlayerDataReservedInt( f12_arg0, CoD.StatsGroup.Common, "motd_today_day", f12_local0.day ) + Engine.SetPlayerDataReservedInt( f12_arg0, CoD.StatsGroup.Common, "motd_today_month", f12_local0.month ) + end +end + +function GetNumTimesSeenSeasonPassUpsell( f13_arg0 ) + return Engine.GetPlayerDataReservedInt( f13_arg0, CoD.StatsGroup.Common, "season_pass_upsell_count" ) +end + +function GetNumTimesPlayerShouldSeeSeasonPassUpsell() + return 6 +end + +function IncNumTimesPlayerHasSeenSeasonPassUpsell( f15_arg0 ) + Engine.SetPlayerDataReservedInt( f15_arg0, CoD.StatsGroup.Common, "season_pass_upsell_count", Engine.GetPlayerDataReservedInt( f15_arg0, CoD.StatsGroup.Common, "season_pass_upsell_count" ) + 1 ) +end + +function ShouldShowSeasonPassUpsell( f16_arg0 ) + if not Engine.AnyoneHasSeasonPass() and GetNumTimesSeenSeasonPassUpsell( f16_arg0 ) < GetNumTimesPlayerShouldSeeSeasonPassUpsell() then + IncNumTimesPlayerHasSeenSeasonPassUpsell( f16_arg0 ) + return true + else + return false + end +end + +function GetNumTimesSeenCodAnywherePrompt( f17_arg0 ) + return Engine.GetPlayerDataReservedInt( f17_arg0, CoD.StatsGroup.Common, "cod_anywhere_screen_count" ) +end + +function GetNumTimesPlayerShouldSeeCodAnywherePrompt() + return 3 +end + +function IncNumTimesPlayerHasSeenCodAnywherePrompt( f19_arg0 ) + Engine.SetPlayerDataReservedInt( f19_arg0, CoD.StatsGroup.Common, "cod_anywhere_screen_count", Engine.GetPlayerDataReservedInt( f19_arg0, CoD.StatsGroup.Common, "cod_anywhere_screen_count" ) + 1 ) +end + +function ShouldShowCodAnywherePrompt( f20_arg0 ) + local f20_local0 = true + if CoDAnywhere.ShouldShowLinkCreatePopup( f20_arg0, true ) == true then + f20_local0 = false + end + if not f20_local0 and GetNumTimesSeenCodAnywherePrompt( f20_arg0 ) < GetNumTimesPlayerShouldSeeCodAnywherePrompt() then + IncNumTimesPlayerHasSeenCodAnywherePrompt( f20_arg0 ) + return true + else + return false + end +end + +function GetNumTimesSeenFestivePackUpsell( f21_arg0 ) + return Engine.GetPlayerDataReservedInt( f21_arg0, CoD.StatsGroup.Common, "mp_upsell_holiday_count" ) +end + +function GetNumTimesPlayerShouldSeeFestivePackUpsell() + return 4 +end + +function IncNumTimesPlayerHasSeenFestivePackUpsell( f23_arg0 ) + Engine.SetPlayerDataReservedInt( f23_arg0, CoD.StatsGroup.Common, "mp_upsell_holiday_count", Engine.GetPlayerDataReservedInt( f23_arg0, CoD.StatsGroup.Common, "mp_upsell_holiday_count" ) + 1 ) +end + +function ShouldShowFestivePackUpsell( f24_arg0 ) + if not Cac.IsCustomizationItemUnlocked( f24_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch], 574 ) and GetNumTimesSeenFestivePackUpsell( f24_arg0 ) < GetNumTimesPlayerShouldSeeFestivePackUpsell() then + IncNumTimesPlayerHasSeenFestivePackUpsell( f24_arg0 ) + return true + else + return false + end +end + +function GetNumTimesSeenWolfPackUpsell( f25_arg0 ) + return Engine.GetPlayerDataReservedInt( f25_arg0, CoD.StatsGroup.Common, "mp_upsell_wolfpack_count" ) +end + +function GetNumTimesPlayerShouldSeeWolfPackUpsell() + return 4 +end + +function IncNumTimesPlayerHasSeenWolfPackUpsell( f27_arg0 ) + Engine.SetPlayerDataReservedInt( f27_arg0, CoD.StatsGroup.Common, "mp_upsell_wolfpack_count", Engine.GetPlayerDataReservedInt( f27_arg0, CoD.StatsGroup.Common, "mp_upsell_wolfpack_count" ) + 1 ) +end + +function ShouldShowWolfPackUpsell( f28_arg0 ) + if not (1 == Engine.GetDvarInt( "igs_swp" )) then + return false + elseif not Lobby.IsItemOfTypeUnlocked( f28_arg0, "wolf", "DLC" ) and GetNumTimesSeenWolfPackUpsell( f28_arg0 ) < GetNumTimesPlayerShouldSeeWolfPackUpsell() then + IncNumTimesPlayerHasSeenWolfPackUpsell( f28_arg0 ) + return true + else + return false + end +end + +function GetVotingLayout( f29_arg0 ) + if ShouldDisplayVoteScreen( f29_arg0 ) then + return "voting" + else + return nil + end +end + +function GetVotingImageFileID( f30_arg0 ) + local f30_local0 = 0 + if f30_arg0 == 0 then + f30_local0 = 347 + else + f30_local0 = 348 + end + return f30_local0 +end + +function GetVotingPageHeader() + return Engine.MarkLocalized( Engine.GetVotingHeader( GetActiveVoteIndex() ) ) +end + +function GetVotingItemHeader( f32_arg0 ) + local f32_local0 = "" + if Engine.GetActiveVotes() == 1 then + f32_local0 = Engine.GetVoteItemText( 0, f32_arg0 ) + end + return Engine.MarkLocalized( f32_local0 ) +end + +function GetNumberOfImagesForVote() + local f33_local0 = 0 + if Engine.GetActiveVotes() == 1 then + f33_local0 = Engine.GetNumberOfImagesForVote( 0 ) + end + return f33_local0 +end + +function CastVoteForItem( f34_arg0, f34_arg1 ) + if Engine.GetActiveVotes() == 1 then + Engine.VoteForDLCItem( f34_arg0, GetActiveVoteIndex(), f34_arg1 ) + Engine.SetPlayerDataReservedShort( f34_arg0, CoD.StatsGroup.Common, "common_last_vote_base_counter", Engine.GetVotingID( GetActiveVoteIndex() ) ) + end +end + +function ShouldDisplayVoteScreen( f35_arg0 ) + if Engine.GetActiveVotes() > 0 then + local f35_local0 = Engine.GetPlayerDataReservedShort( f35_arg0, CoD.StatsGroup.Common, "common_last_vote_base_counter" ) + local f35_local1 = Engine.GetVotingID( GetActiveVoteIndex() ) + if f35_local1 > -1 and f35_local1 ~= f35_local0 then + return true + end + end + return false +end + +function StartVoteImageDownload( f36_arg0 ) + Engine.StartVoteImageDownload( f36_arg0 ) +end + +function IsVoteImageDownloaded( f37_arg0 ) + return Engine.IsVoteImageDownloaded( f37_arg0 ) +end + +function GetActiveVoteIndex() + return 0 +end + +function ShouldShowDownloadReminder( f39_arg0 ) + return #GetMapPacksUserCanDownloadViaSeasonPass() > 0 +end + +function GetMapPacksUserCanDownloadViaSeasonPass() + local f40_local0 = {} + if not Engine.AnyoneHasSeasonPass() then + return f40_local0 + end + local f40_local1 = Engine.GetDvarInt( "num_available_map_packs" ) + for f40_local2 = 1, f40_local1, 1 do + if not Engine.AnyoneHasSpecificDLCPack( "dlc" .. 2 + f40_local2 ) then + table.insert( f40_local0, f40_local2 ) + end + end + return f40_local0 +end + +function GetDownloadReminderMessage() + local f41_local0 = Engine.Localize( "LUA_MENU_MP_MOTD_DOWNLOAD_PURCHASED_DLC" ) + for f41_local4, f41_local5 in ipairs( GetMapPacksUserCanDownloadViaSeasonPass() ) do + f41_local0 = f41_local0 .. "\n - " .. Engine.Localize( "DLC_MAP_PACK_" .. f41_local5 ) + end + return f41_local0 +end + diff --git a/lui/mp_menus/motdwidgets.dec.lua b/lui/mp_menus/motdwidgets.dec.lua new file mode 100644 index 0000000..591d478 --- /dev/null +++ b/lui/mp_menus/motdwidgets.dec.lua @@ -0,0 +1,891 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +MOTD_WIDTH = 892 +MOTD_HEIGHT = 590 +MOTD_ANIM_DELTA = 600 +MOTD_ANIM_TIME_MS = 100 +MOTD_IMAGE_TOP_INDENT = 90 +MOTD_IMAGE_LEFT_INDENT = 58 +MOTD_IMAGE_SIZE = 340 +MOTD_TEXT_TOP_INDENT = MOTD_IMAGE_TOP_INDENT +MOTD_TEXT_LEFT_INTENT = 490 +MOTD_TEXT_WIDTH = 367 +MOTD_UPSELL_MENU_CONTINUE_EVENT = 0 +MOTD_UPSELL_OPEN_STORE_EVENT = 1 +MOTD_UPSELL_MAX_EVENT_RECORDED = 2 +MOTDLayoutType = { + DEFAULT = 0, + VOTING = 1 +} +function UpsellAction( f1_arg0, f1_arg1 ) + f1_arg0:dispatchEventToParent( { + name = "motd_continue", + exitMotd = true, + controller = f1_arg1.controller, + upsellEvent = MOTD_UPSELL_OPEN_STORE_EVENT + } ) + Sns.OpenStoreMenu( f1_arg1.controller, "upsell_menu", true ) +end + +function RecordUpsellMenuAction( f2_arg0, f2_arg1 ) + local f2_local0 = (Engine.GetPlayerDataReservedInt( f2_arg0, CoD.StatsGroup.Common, "sp_upsell_recent_updated_record" ) + 1) % MOTD_UPSELL_MAX_EVENT_RECORDED + Engine.SetUpsellMenuCloseTimestamp() + local f2_local1 = Engine.GetUpsellMenuViewTime() + if f2_local0 == 0 then + Engine.SetPlayerDataReservedInt( f2_arg0, CoD.StatsGroup.Common, "sp_upsell_view_time_0", f2_local1 ) + Engine.SetPlayerDataReservedInt( f2_arg0, CoD.StatsGroup.Common, "sp_upsell_action_0", f2_arg1 ) + Engine.SetPlayerDataReservedInt( f2_arg0, CoD.StatsGroup.Common, "sp_upsell_open_timestamp_0", Engine.GetUpsellMenuOpenTimestamp() ) + else + Engine.SetPlayerDataReservedInt( f2_arg0, CoD.StatsGroup.Common, "sp_upsell_view_time_1", f2_local1 ) + Engine.SetPlayerDataReservedInt( f2_arg0, CoD.StatsGroup.Common, "sp_upsell_action_1", f2_arg1 ) + Engine.SetPlayerDataReservedInt( f2_arg0, CoD.StatsGroup.Common, "sp_upsell_open_timestamp_1", Engine.GetUpsellMenuOpenTimestamp() ) + end + Engine.SetPlayerDataReservedInt( f2_arg0, CoD.StatsGroup.Common, "sp_upsell_recent_updated_record", f2_local0 ) +end + +function CodAnywhereAction( f3_arg0, f3_arg1 ) + f3_arg0:dispatchEventToParent( { + name = "motd_continue", + exitMotd = true, + controller = f3_arg1.controller + } ) + OpenCoDAnywhere( f3_arg1.controller ) +end + +function OpenStoreAction( f4_arg0, f4_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) + Sns.OpenStoreMenu( f4_arg1.controller, "motd" ) +end + +motdLayouts = { + welcomeFounder = { + title = Engine.Localize( "@LUA_MENU_WELCOME_FOUNDER_TITLE" ), + message = Engine.Localize( "@LUA_MENU_WELCOME_FOUNDER_MESSAGE" ), + image = "image_motd_founder" + }, + welcomeSoldier = { + title = Engine.Localize( "@LUA_MENU_WELCOME_SOLDIER_TITLE" ), + message = Engine.Localize( "@LUA_MENU_WELCOME_SOLDIER_MESSAGE" ), + image = "image_motd_soldier" + }, + welcomeNoob = { + title = Engine.Localize( "@LUA_MENU_WELCOME_NOOB_TITLE" ), + message = Engine.Localize( "@LUA_MENU_WELCOME_NOOB_MESSAGE" ), + image = "image_motd_new_guy" + }, + seasonPassUpsell = { + title = Engine.Localize( "@LUA_MENU_SEASON_PASS_TITLE" ), + message = Engine.Localize( "@LUA_MENU_SEASON_PASS_MESSAGE" ), + image = "image_motd_season_pass", + additional_buttons = { + { + helperTextRef = "button_alt1", + eventAction = "button_alt1", + label = Engine.Localize( "@LUA_MENU_PURCHASE_NOW" ), + handler = UpsellAction, + enabled = function () + return true + end + } + } + }, + festiveUpsell = { + title = Engine.Localize( "@LUA_MENU_FESTIVE_UPSELL_TITLE" ), + message = Engine.Localize( "@LUA_MENU_FESTIVE_UPSELL_MSG" ), + image = "image_motd_holiday", + additional_buttons = { + { + helperTextRef = "button_alt1", + eventAction = "button_alt1", + label = Engine.Localize( "@LUA_MENU_FREE" ), + handler = UpsellAction, + enabled = function () + return true + end + } + } + }, + wolfpackUpsell = { + title = Engine.Localize( "@LUA_MENU_WOLF_UPSELL_TITLE" ), + message = Engine.Localize( "@LUA_MENU_WOLF_UPSELL_MSG" ), + image = "image_motd_wolfskin", + additional_buttons = { + { + helperTextRef = "button_alt1", + eventAction = "button_alt1", + label = Engine.Localize( "@LUA_MENU_PURCHASE_NOW" ), + handler = UpsellAction, + enabled = function () + return true + end + } + } + }, + codAnywhereUpsell = { + title = Engine.Localize( "@LUA_MENU_MOTD_CODA_PLEASE_REGISTER_TITLE" ), + message = Engine.Localize( "@LUA_MENU_MOTD_CODA_PLEASE_REGISTER_MESSAGE" ), + image = "image_motd_cod_account_generic", + additional_buttons = { + { + helperTextRef = "button_alt1", + eventAction = "button_alt1", + label = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_CREATE_ACCOUNT" ), + handler = CodAnywhereAction, + enabled = function () + return true + end + } + } + }, + downloadReminder = { + title = Engine.Localize( "@LUA_MENU_MP_MOTD_DOWNLOAD_PURCHASED_DLC_CAPS" ), + message = function () + return GetDownloadReminderMessage() + end, + image = "image_motd_season_pass" + }, + motd = { + title = Engine.Localize( "@LUA_MENU_MOTD_CAPS" ), + message = function () + return Engine.GetDvarString( "motd" ) + end, + image = "iotd_image", + additional_buttons = { + { + helperTextRef = "button_alt1", + eventAction = "button_alt1", + label = Engine.Localize( "@MPUI_OPEN_STORE" ), + handler = OpenStoreAction, + enabled = function () + return Engine.GetDvarInt( "motd_store_link" ) == 1 + end + } + } + }, + voting = { + type = MOTDLayoutType.VOTING, + title = Engine.Localize( "@LUA_MENU_MP_MOTD_VOTING_TITLE" ), + message = function () + return GetVotingPageHeader() + end, + button_action_text = Engine.Localize( "@LUA_MENU_MP_MOTD_VOTING_SKIP" ), + additional_buttons = { + { + helperTextRef = "button_dpad_left", + eventAction = "button_left", + label = Engine.Localize( "@LUA_MENU_MP_MOTD_VOTING_ITEM_HELPER", 1 ), + handler = function ( f13_arg0, f13_arg1 ) + CastVoteForItem( f13_arg1.controller, 0 ) + f13_arg0:dispatchEventToParent( { + name = "motd_continue", + controller = f13_arg1.controller, + upsellEvent = MOTD_UPSELL_MENU_CONTINUE_EVENT + } ) + end, + enabled = function () + return true + end + }, + { + helperTextRef = "button_dpad_up", + eventAction = "button_up", + label = Engine.Localize( "@LUA_MENU_MP_MOTD_VOTING_ITEM_HELPER", 2 ), + handler = function ( f15_arg0, f15_arg1 ) + CastVoteForItem( f15_arg1.controller, 1 ) + f15_arg0:dispatchEventToParent( { + name = "motd_continue", + controller = f15_arg1.controller, + upsellEvent = MOTD_UPSELL_MENU_CONTINUE_EVENT + } ) + end, + enabled = function () + return true + end + }, + { + helperTextRef = "button_dpad_right", + eventAction = "button_right", + label = Engine.Localize( "@LUA_MENU_MP_MOTD_VOTING_ITEM_HELPER", 3 ), + handler = function ( f17_arg0, f17_arg1 ) + CastVoteForItem( f17_arg1.controller, 2 ) + f17_arg0:dispatchEventToParent( { + name = "motd_continue", + controller = f17_arg1.controller, + upsellEvent = MOTD_UPSELL_MENU_CONTINUE_EVENT + } ) + end, + enabled = function () + return true + end + }, + { + helperTextRef = "button_dpad_down", + eventAction = "button_down", + label = Engine.Localize( "@LUA_MENU_MP_MOTD_VOTING_ITEM_HELPER", 4 ), + handler = function ( f19_arg0, f19_arg1 ) + CastVoteForItem( f19_arg1.controller, 3 ) + f19_arg0:dispatchEventToParent( { + name = "motd_continue", + controller = f19_arg1.controller, + upsellEvent = MOTD_UPSELL_MENU_CONTINUE_EVENT + } ) + end, + enabled = function () + return true + end + } + } + } +} +function UpdateActionText( f21_arg0, f21_arg1 ) + f21_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = Engine.IsConsoleGame() and "button_action" or "button_secondary", + helper_text = f21_arg1, + side = "left", + clickable = true + } ) +end + +function UpdateAdditionalButtons( f22_arg0, f22_arg1 ) + if not f22_arg1 then + return + end + for f22_local0 = 1, #f22_arg1, 1 do + if f22_arg1[f22_local0].enabled() then + f22_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = f22_arg1[f22_local0].helperTextRef, + helper_text = f22_arg1[f22_local0].label, + side = "left", + clickable = true + } ) + f22_arg0:dispatchEventToRoot( { + name = "update_button_handler", + eventAction = f22_arg1[f22_local0].eventAction, + newHandler = f22_arg1[f22_local0].handler, + immediate = true + } ) + end + end +end + +function motdContinueFunc( f23_arg0, f23_arg1 ) + local f23_local0 = f23_arg0.properties + local f23_local1 = "" + if f23_local0.layout then + f23_local1 = f23_local0.layout + end + if f23_local1 == "seasonPassUpsell" and f23_arg1.upsellEvent then + RecordUpsellMenuAction( f23_arg1.controller, f23_arg1.upsellEvent ) + end + local f23_local2 = nil + if f23_local0 and f23_local0.layoutQueue and #f23_local0.layoutQueue >= 1 and not f23_arg1.exitMotd then + f23_local2 = table.remove( f23_local0.layoutQueue, 1 ) + f23_local0.layout = f23_local2 + local f23_local3 = MOTDLayoutType.DEFAULT + if motdLayouts[f23_local2] and motdLayouts[f23_local2].type then + f23_local3 = motdLayouts[f23_local2].type + end + f23_arg0:processEvent( { + name = "update_layout_type", + layout_type = f23_local3 + } ) + if f23_local2 == "seasonPassUpsell" then + Engine.SetUpsellMenuOpenTimestamp() + end + if motdLayouts[f23_local2] and motdLayouts[f23_local2].title then + f23_arg0:processEvent( { + name = "update_title", + title_text = motdLayouts[f23_local2].title + } ) + end + if motdLayouts[f23_local2] and motdLayouts[f23_local2].message then + local f23_local4 = motdLayouts[f23_local2].message + if type( f23_local4 ) == "function" then + f23_local4 = motdLayouts[f23_local2].message() + end + f23_arg0:processEvent( { + name = "motd_update_message", + message = f23_local4 + } ) + end + if motdLayouts[f23_local2] and motdLayouts[f23_local2].image then + if motdLayouts[f23_local2].image == "iotd_image" then + f23_arg0:processEvent( { + name = "show_iotd_image" + } ) + else + f23_arg0:processEvent( { + name = "show_custom_image", + image = motdLayouts[f23_local2].image + } ) + end + end + f23_arg0:processEvent( { + name = "clear_button_helper_text", + side = "left" + } ) + local f23_local4 = Engine.Localize( "@MENU_CONTINUE" ) + if motdLayouts[f23_local2] and motdLayouts[f23_local2].button_action_text then + f23_local4 = motdLayouts[f23_local2].button_action_text + end + UpdateActionText( f23_arg0, f23_local4 ) + if motdLayouts[f23_local2] and motdLayouts[f23_local2].additional_buttons then + UpdateAdditionalButtons( f23_arg0, motdLayouts[f23_local2].additional_buttons ) + end + else + f23_arg0:processEvent( { + name = "exit_transition" + } ) + if f23_arg1.controller then + Engine.ExecNow( "uploadstats", f23_arg1.controller ) + end + end +end + +function motd_main( f24_arg0, f24_arg1, f24_arg2 ) + local f24_local0 = f24_arg1 or {} + local f24_local1, f24_local2, f24_local3, f24_local4 = nil + if f24_local0.layoutQueue and #f24_local0.layoutQueue >= 1 then + f24_local1 = table.remove( f24_local0.layoutQueue, 1 ) + elseif f24_local0.layout then + f24_local1 = f24_local0.layout + end + local f24_local5 + if f24_local1 then + f24_local5 = motdLayouts[f24_local1].title + if not f24_local5 then + f24_local5 = f24_local0.title + if not f24_local5 then + f24_local5 = "" + end + end + else + f24_local5 = f24_local0.title + if not f24_local5 then + f24_local5 = "" + end + end + local f24_local6 + if f24_local1 then + f24_local6 = motdLayouts[f24_local1].message + if not f24_local6 then + f24_local6 = f24_local0.message + if not f24_local6 then + f24_local6 = "" + end + end + else + f24_local6 = f24_local0.message + if not f24_local6 then + f24_local6 = "" + end + end + local f24_local7 + if f24_local1 then + f24_local7 = motdLayouts[f24_local1].image + if not f24_local7 then + f24_local7 = f24_local0.image + if not f24_local7 then + f24_local7 = "white" + end + end + else + f24_local7 = f24_local0.image + if not f24_local7 then + f24_local7 = "white" + end + end + if type( f24_local6 ) == "function" then + f24_local6 = motdLayouts[f24_local1].message() + end + local self = LUI.UIElement.new() + self.id = "the_root_id" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f24_local9 = LUI.UIImage.new() + f24_local9.id = "dimOverlay_id" + f24_local9:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = 0 + } ) + f24_local9:registerAnimationState( "visible", { + alpha = 0.85 + } ) + f24_local9:animateToState( "default" ) + f24_local9:animateToState( "visible", MOTD_ANIM_TIME_MS ) + self:addElement( f24_local9 ) + local f24_local10 = LUI.UIElement.new() + f24_local10.id = "motd_root" + f24_local10.properties = { + layoutQueue = f24_local0.layoutQueue, + layout = f24_local1 + } + f24_local10:registerAnimationState( "default0", { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -MOTD_WIDTH / 2, + right = MOTD_WIDTH / 2, + top = -MOTD_HEIGHT / 2, + bottom = MOTD_HEIGHT / 2, + alpha = 0 + } ) + f24_local10:registerAnimationState( "visible", { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -MOTD_WIDTH / 2, + right = MOTD_WIDTH / 2, + top = -MOTD_HEIGHT / 2, + bottom = MOTD_HEIGHT / 2, + alpha = 1 + } ) + f24_local10:registerAnimationState( "exit", { + alpha = 0 + } ) + f24_local10:registerEventHandler( "motd_continue", motdContinueFunc ) + f24_local10:registerEventHandler( "menu_create", MBh.AnimateToState( "visible", MOTD_ANIM_TIME_MS ) ) + f24_local10:registerEventHandler( "exit_transition", MBh.AnimateToStateWithEvent( "exit", MOTD_ANIM_TIME_MS ) ) + f24_local10:registerEventHandler( "transition_complete_exit", MBh.LeaveMenu() ) + f24_local10:animateToState( "default0" ) + self:addElement( f24_local10 ) + local f24_local11 = LUI.MenuGenerics.generic_drop_shadow( nil, { + offset_shadow = 0, + alpha = 0.35 + } ) + f24_local11.id = "motd_root_ds" + f24_local10:addElement( f24_local11 ) + local f24_local12 = LUI.MenuGenerics.generic_menu_titlebar( nil, { + title_bar_text = f24_local5, + fill_alpha = 1 + } ) + f24_local12.id = "motd_title_bar" + f24_local10:addElement( f24_local12 ) + local f24_local13 = LUI.MenuGenerics.generic_menu_background( nil, { + fill_alpha = 1 + } ) + f24_local13.id = "bkg1_id" + f24_local10:addElement( f24_local13 ) + local f24_local14 = motd_default_view_element( f24_local6, f24_local7 ) + f24_local14.id = "motd_default_view_id" + f24_local10:addElement( f24_local14 ) + local f24_local15 = motd_vote_view_element( f24_local6 ) + f24_local15.id = "motd_vote_view_id" + f24_local10:addElement( f24_local15 ) + if Engine.IsConsoleGame() then + local f24_local16 = LUI.UIButton.new() + f24_local16.id = "continuebutton_id" + f24_local16:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + f24_local16:registerEventHandler( "button_action", function ( element, event ) + element:dispatchEventToParent( { + name = "motd_continue", + controller = event.controller, + upsellEvent = MOTD_UPSELL_MENU_CONTINUE_EVENT + } ) + end ) + f24_local16:animateToState( "default" ) + f24_local10:addElement( f24_local16 ) + end + LUI.MenuBuilder.BuildAddChild( f24_local10, { + type = "UIElement", + id = "help_padding", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 1, + right = -1, + top = 0, + bottom = -1 + } + }, + children = { + { + type = "button_helper_text_main", + id = "help_texts", + properties = { + left_inset = 10, + top_margin = GenericFooterDims.TopMargin_WithoutBackground, + background_alpha = 0, + hideAlienBar = true + }, + handlers = { + menu_create = function ( f26_arg0, f26_arg1 ) + local f26_local0 = Engine.Localize( "@MENU_CONTINUE" ) + if motdLayouts[f24_local1] and motdLayouts[f24_local1].button_action_text then + f26_local0 = motdLayouts[f24_local1].button_action_text + end + UpdateActionText( f26_arg0, f26_local0 ) + if motdLayouts[f24_local1] and motdLayouts[f24_local1].additional_buttons then + UpdateAdditionalButtons( f26_arg0, motdLayouts[f24_local1].additional_buttons ) + end + end + } + } + } + } ) + local f24_local16 = LUI.UIImage.new() + f24_local16.id = "horizontal_line_id" + f24_local16:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 1, + right = -1, + top = MOTD_HEIGHT - 43, + bottom = MOTD_HEIGHT - 42, + red = Colors.generic_button_border_color.r, + green = Colors.generic_button_border_color.g, + blue = Colors.generic_button_border_color.b, + alpha = 1 + } ) + f24_local16:animateToState( "default" ) + f24_local10:addElement( f24_local16 ) + local f24_local17 = LUI.UIBindButton.new() + f24_local17.id = "back" + f24_local17:registerEventHandler( "update_button_handler", function ( element, event ) + if event.eventAction and event.newHandler then + f24_local17:registerEventHandler( event.eventAction, event.newHandler ) + end + end ) + if not Engine.IsConsoleGame() then + f24_local17:registerEventHandler( "button_secondary", function ( element, event ) + element:dispatchEventToParent( { + name = "motd_continue", + controller = event.controller + } ) + end ) + end + f24_local10:addElement( f24_local17 ) + return self +end + +function motd_default_view_element( menu, controller ) + local self = LUI.UIElement.new() + self.id = "motd_default_view_root_id" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "update_layout_type", function ( element, event ) + local f30_local0 = element + local f30_local1 = element.animateToState + local f30_local2 = event.layout_type + local f30_local3 = MOTDLayoutType.DEFAULT + f30_local1( f30_local0, REG6 and "default" or "hidden", 0 ) + end ) + local f29_local1 = LUI.UIText.new() + f29_local1.id = "motdMessageText_id" + f29_local1:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = MOTD_TEXT_LEFT_INTENT, + right = MOTD_TEXT_LEFT_INTENT + MOTD_TEXT_WIDTH, + top = MOTD_TEXT_TOP_INDENT, + bottom = MOTD_TEXT_TOP_INDENT + CoD.TextSettings.NormalFont.Height + } ) + f29_local1:registerEventHandler( "motd_update_message", function ( element, event ) + if event.message then + element:setText( event.message ) + end + end ) + f29_local1:setText( menu ) + f29_local1:animateToState( "default" ) + self:addElement( f29_local1 ) + local f29_local2 = LUI.UIElement.new() + f29_local2.id = "image_layout_container_id" + f29_local2:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = MOTD_IMAGE_LEFT_INDENT, + top = MOTD_IMAGE_TOP_INDENT, + height = MOTD_IMAGE_SIZE + 2, + width = MOTD_IMAGE_SIZE + 2 + } ) + f29_local2:animateToState( "default" ) + self:addElement( f29_local2 ) + local f29_local3 = LUI.MenuGenerics.generic_drop_shadow( nil, { + offset_shadow = -3 + } ) + f29_local2.id = "motd_image_ds" + f29_local2:addElement( f29_local3 ) + local f29_local4 = LUI.UIImage.new() + f29_local4.id = "motd_image_border" + f29_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.generic_button_border_color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ) + } ) ) + f29_local4:animateToState( "default" ) + f29_local2:addElement( f29_local4 ) + local f29_local5 = LUI.UIImage.new() + f29_local5.id = "custom_image_id" + f29_local5:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 1, + right = -1, + top = 1, + bottom = -1, + alpha = 1 + } ) + f29_local5:registerAnimationState( "hidden", { + alpha = 0 + } ) + f29_local5:registerEventHandler( "show_custom_image", function ( element, event ) + element:animateToState( "default" ) + if event.image then + element:setImage( RegisterMaterial( event.image ) ) + end + end ) + f29_local5:registerEventHandler( "show_iotd_image", function ( element, event ) + element:animateToState( "hidden" ) + end ) + if controller == "iotd_image" then + f29_local5:animateToState( "hidden" ) + else + f29_local5:animateToState( "default" ) + f29_local5:setImage( RegisterMaterial( controller ) ) + end + f29_local2:addElement( f29_local5 ) + local f29_local6 = LUI.MenuBuilder.BuildAddChild( f29_local4, { + type = "UIOwnerdraw", + id = "motd_iotd_id", + properties = { + ownerDraw = CoD.Ownerdraw.UIIOTD + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 1, + right = -1, + top = 1, + bottom = -1, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + show_iotd_image = MBh.AnimateToState( "default" ), + show_custom_image = MBh.AnimateToState( "hidden" ) + } + } ) + if controller ~= "iotd_image" then + f29_local6:animateToState( "hidden" ) + end + local f29_local7 = LUI.UIImage.new() + f29_local7.id = "vertLine_line_id" + f29_local7:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 446, + right = 447, + top = 90, + bottom = -160, + red = Colors.generic_button_border_color.r, + green = Colors.generic_button_border_color.g, + blue = Colors.generic_button_border_color.b, + alpha = 1 + } ) + f29_local7:animateToState( "default" ) + self:addElement( f29_local7 ) + return self +end + +function motd_vote_view_element( f34_arg0 ) + local f34_local0 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + f34_local0.alpha = 0 + local self = LUI.UIElement.new( f34_local0 ) + self.id = "motd_vote_view_root_id" + f34_local0.alpha = 1 + self:registerAnimationState( "visible", f34_local0 ) + self:registerEventHandler( "update_layout_type", function ( element, event ) + local f35_local0 = element + local f35_local1 = element.animateToState + local f35_local2 = event.layout_type + local f35_local3 = MOTDLayoutType.VOTING + f35_local1( f35_local0, REG6 and "visible" or "default", 0 ) + end ) + f34_local0 = CoD.CreateState( 10, 40, -10, 40 + CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.TopLeftRight ) + CoD.ColorizeState( Colors.primary_text_color, f34_local0 ) + f34_local0.alignment = LUI.Alignment.Center + f34_local0.font = CoD.TextSettings.NormalFont.Font + local f34_local2 = LUI.UIText.new( f34_local0 ) + f34_local2.id = "motd_vote_view_header_text_id" + f34_local2:setText( f34_arg0 ) + f34_local2:registerEventHandler( "motd_update_message", function ( element, event ) + if event.message then + element:setText( event.message ) + end + end ) + self:addElement( f34_local2 ) + self:addElement( VotingItemFactory( 0, "motd_vote_item_1", 82, 226 ) ) + self:addElement( VotingItemFactory( 1, "motd_vote_item_2", 326, 75 ) ) + self:addElement( VotingItemFactory( 2, "motd_vote_item_3", 570, 226 ) ) + self:addElement( VotingItemFactory( 3, "motd_vote_item_4", 326, 375 ) ) + local f34_local3 = 32 + local f34_local4 = f34_local3 / 2 + f34_local0 = CoD.CreateState( 414, 273, 478, 337, CoD.AnchorTypes.TopLeft ) + f34_local0.material = RegisterMaterial( "alien_cash_dpad" ) + local f34_local5 = LUI.UIImage.new( f34_local0 ) + f34_local5.id = "motd_vote_view_dpad_id" + self:addElement( f34_local5 ) + f34_local0 = CoD.CreateState( -f34_local3, -f34_local4, 0, f34_local4, CoD.AnchorTypes.Left ) + f34_local0.material = RegisterMaterial( "cont_arrow_lt" ) + local f34_local6 = LUI.UIImage.new( f34_local0 ) + f34_local6.id = "motd_vote_view_left_arrow_id" + f34_local5:addElement( f34_local6 ) + f34_local0 = CoD.CreateState( 0, -f34_local4, f34_local3, f34_local4, CoD.AnchorTypes.Right ) + f34_local0.material = RegisterMaterial( "cont_arrow_rt" ) + local f34_local7 = LUI.UIImage.new( f34_local0 ) + f34_local7.id = "motd_vote_view_right_arrow_id" + f34_local5:addElement( f34_local7 ) + f34_local0 = CoD.CreateState( -f34_local4, -f34_local3, f34_local4, 0, CoD.AnchorTypes.Top ) + f34_local0.material = RegisterMaterial( "cont_arrow_up" ) + local f34_local8 = LUI.UIImage.new( f34_local0 ) + f34_local8.id = "motd_vote_view_up_arrow_id" + f34_local5:addElement( f34_local8 ) + f34_local0 = CoD.CreateState( -f34_local4, 0, f34_local4, f34_local3, CoD.AnchorTypes.Bottom ) + f34_local0.material = RegisterMaterial( "cont_arrow_down" ) + local f34_local9 = LUI.UIImage.new( f34_local0 ) + f34_local9.id = "motd_vote_view_down_arrow_id" + f34_local5:addElement( f34_local9 ) + return self +end + +function VotingItemFactory( f37_arg0, f37_arg1, f37_arg2, f37_arg3 ) + local f37_local0 = 220 + local f37_local1 = 124 + local f37_local2 = 10 + local f37_local3 = 8 + local self = LUI.UIElement.new( CoD.CreateState( f37_arg2, f37_arg3, f37_arg2 + f37_local0 + f37_local2 * 2, f37_arg3 + 160, CoD.AnchorTypes.TopLeft ) ) + self.id = f37_arg1 + self:registerEventHandler( "check_vote_image_download_status", function ( element, event ) + local f38_local0 = Engine.GetVoteItemFileID( GetActiveVoteIndex(), f37_arg0 ) + if IsVoteImageDownloaded( f38_local0 ) then + if element.loadingWidget then + element.loadingWidget:close() + end + element.loadingWidget = nil + if element.timerElem then + element.timerElem:close() + end + element.timerElem = nil + if element.image then + element.image:setImage( Engine.GetVoteImageHandle( f38_local0 ) ) + element.image:animateToState( "visible", 0 ) + end + end + end ) + local f37_local5 = CoD.CreateState( 0, f37_local3, 0, f37_local3 + CoD.TextSettings.BoldFont.Height, CoD.AnchorTypes.TopLeftRight ) + f37_local5.alignment = LUI.Alignment.Center + f37_local5.font = CoD.TextSettings.BoldFont.Font + local f37_local6 = LUI.UIText.new( f37_local5 ) + f37_local6.id = "voting_item_header_id" + f37_local6:setText( GetVotingItemHeader( f37_arg0 ) ) + self:addElement( f37_local6 ) + f37_local5 = CoD.CreateState( -f37_local0 / 2, -f37_local1 - f37_local3, f37_local0 / 2, -f37_local3, CoD.AnchorTypes.Bottom ) + f37_local5.alpha = 0 + self.image = LUI.UIImage.new( f37_local5 ) + self.image:registerAnimationState( "visible", { + alpha = 1 + } ) + self.image.id = "voting_item_image_id" + self:addElement( self.image ) + self.loadingWidget = LUI.MenuBuilder.buildItems( { + type = "generic_loading_widget", + id = "voting_item_loading_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + }, {}, image ) + self:addElement( self.loadingWidget ) + self.timerElem = LUI.UITimer.new( 500, "check_vote_image_download_status", "voting_image_timer", false, self ) + self.timerElem.id = "voting_item_timer_id" + self:addElement( self.timerElem ) + return self +end + +LUI.MenuBuilder.registerType( "motd_main", motd_main ) +LockTable( _M ) diff --git a/lui/mp_menus/mpbarracks.dec.lua b/lui/mp_menus/mpbarracks.dec.lua new file mode 100644 index 0000000..6029116 --- /dev/null +++ b/lui/mp_menus/mpbarracks.dec.lua @@ -0,0 +1,456 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function BarrackLeaderboardsAction( f1_arg0, f1_arg1 ) + if Engine.IsWaitingForOnlineServices( f1_arg1.controller ) then + Engine.Exec( "xopenonlineservicesdialog", f1_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f1_arg0, "leaderboards", true, f1_arg1.controller ) + end +end + +function BarrackOperationsAction( f2_arg0, f2_arg1 ) + LUI.FlowManager.RequestAddMenu( f2_arg0, "operations_main_menu", true, f2_arg1.controller ) +end + +function BarrackCreateClanAction( f3_arg0, f3_arg1 ) + if CoDAnywhere.ShouldShowLinkCreatePopup( f3_arg1.controller, true ) == true then + LUI.FlowManager.RequestPopupMenu( f3_arg0, "cod_anywhere_popup_menu", true, f3_arg1.controller ) + elseif CoDAnywhere.ShouldShowLinkUCDPopup( f3_arg1.controller, true ) == true and Engine.GetDvarInt( "ca_intra_only" ) == 0 then + LUI.FlowManager.RequestPopupMenu( f3_arg0, "cod_anywhere_link_ucd_popup_menu", true, f3_arg1.controller ) + else + Clan.Create( f3_arg1.controller ) + end +end + +function BarrackClanDetailsAction( f4_arg0, f4_arg1 ) + if Clan.AlreadyMember( f4_arg1.controller ) then + LUI.FlowManager.RequestAddMenu( f4_arg0, "clan_details_main", true, f4_arg1.controller ) + end +end + +function BarrackClanInviteAction( f5_arg0, f5_arg1 ) + if Clan.CanAcceptInvites( f5_arg1.controller ) == false then + LUI.FlowManager.RequestPopupMenu( f5_arg0, "user_generated_content_restriction_popup", true, f5_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f5_arg0, "clan_invites", true, f5_arg1.controller ) + end +end + +function BarrackCoDAnywhereAction( f6_arg0, f6_arg1 ) + if CoDAnywhere.ServiceAvailable( f6_arg1.controller ) then + OpenCoDAnywhere( f6_arg1.controller ) + else + LUI.FlowManager.RequestPopupMenu( f6_arg0, "generic_confirmation_popup", true, f6_arg1.controller, false, { + popup_title = Engine.Localize( "MENU_ERROR" ), + message_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_ERROR_SERVICE" ) + } ) + end +end + +function BarrackPrestigeResetStatsAction( f7_arg0, f7_arg1 ) + LUI.FlowManager.RequestAddMenu( f7_arg0, "prestige_reset", true, f7_arg1.controller ) +end + +function BarracksOptionsFeeder( f8_arg0 ) + local f8_local0 = Engine.IsAliensMode() + local f8_local1 = not f8_arg0.is_offline_barracks + local f8_local2 = Engine.InLobby() + local f8_local3 = f8_arg0.exclusiveController + if not f8_local3 then + DebugPrint( "[WARNING] Barracks: using controller index 0, this is only ok if you are editing a menu" ) + f8_local3 = Engine.GetFirstActiveController() + end + local f8_local4 = {} + if f8_local1 then + f8_local4[#f8_local4 + 1] = { + type = "UIGenericButton", + id = "leaderboard_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ), + button_action_func = BarrackLeaderboardsAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARDS" ) + } + } + end + if not f8_local0 and IsPublicMatch() then + if Clan.IsEnabled() then + local f8_local5 = #f8_local4 + 1 + local f8_local6 = { + type = "UIGenericButton", + id = "create_clan_button_id" + } + local f8_local7 = Engine.IsUserAGuest( f8_local3 ) + if not f8_local7 then + f8_local7 = Clan.AlreadyMember( f8_local3 ) + if not f8_local7 then + f8_local7 = not CoDAnywhere.ServiceAvailable( f8_local3 ) + end + end + f8_local6.disabled = f8_local7 + f8_local6.properties = { + button_text = Engine.Localize( "@LUA_MENU_CREATE_CLAN_CAPS" ), + button_action_func = BarrackCreateClanAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_CLAN" ) + } + f8_local6.handlers = { + element_refresh = function ( f9_arg0, f9_arg1 ) + local f9_local0 = Engine.IsUserAGuest( f8_local3 ) + if not f9_local0 then + f9_local0 = Clan.AlreadyMember( f8_local3 ) + if not f9_local0 then + f9_local0 = not CoDAnywhere.ServiceAvailable( f8_local3 ) + end + end + local f9_local1 = f9_arg0 + local f9_local2 = f9_arg0.processEvent + local f9_local3 = {} + local f9_local4 + if f9_local0 then + f9_local4 = "disable" + if not f9_local4 then + + else + f9_local3.name = f9_local4 + f9_local2( f9_local1, f9_local3 ) + end + end + f9_local4 = "enable" + end + } + f8_local4[f8_local5] = f8_local6 + f8_local5 = #f8_local4 + 1 + f8_local6 = { + type = "UIGenericButton", + id = "clan_details_button_id" + } + f8_local7 = Engine.IsUserAGuest( f8_local3 ) + if not f8_local7 then + if Clan.AlreadyMember( f8_local3 ) then + f8_local7 = Clan.IsDownloadingData( f8_local3 ) + else + f8_local7 = true + end + end + f8_local6.disabled = f8_local7 + f8_local6.properties = { + button_text = Engine.Localize( "@CLANS_CLAN_DETAILS_CAPS" ), + button_action_func = BarrackClanDetailsAction, + desc_text = Engine.Localize( "@CLANS_CLAN_DETAILS_DESC_TEXT" ) + } + f8_local6.handlers = { + element_refresh = function ( f10_arg0, f10_arg1 ) + local f10_local0 = Engine.IsUserAGuest( f8_local3 ) + if not f10_local0 then + if Clan.AlreadyMember( f8_local3 ) then + f10_local0 = Clan.IsDownloadingData( f8_local3 ) + else + f10_local0 = true + end + end + local f10_local1 = f10_arg0 + local f10_local2 = f10_arg0.processEvent + local f10_local3 = {} + local f10_local4 + if f10_local0 then + f10_local4 = "disable" + if not f10_local4 then + + else + f10_local3.name = f10_local4 + f10_local2( f10_local1, f10_local3 ) + end + end + f10_local4 = "enable" + end + } + f8_local4[f8_local5] = f8_local6 + f8_local5 = #f8_local4 + 1 + f8_local6 = { + type = "UIGenericButton", + id = "clan_invite_button_id" + } + f8_local7 = Engine.IsUserAGuest( f8_local3 ) + if not f8_local7 then + f8_local7 = Clan.GetNumProposals( f8_local3 ) == 0 + end + f8_local6.disabled = f8_local7 + f8_local6.properties = { + button_text = Engine.Localize( "@LUA_MENU_CLAN_CLAN_INVITES_CAPS" ), + button_action_func = BarrackClanInviteAction, + desc_text = Engine.Localize( "@LUA_MENU_CLAN_CLAN_INVITES_DESC" ) + } + f8_local6.handlers = { + element_refresh = function ( f11_arg0, f11_arg1 ) + local f11_local0 = Engine.IsUserAGuest( f8_local3 ) + if not f11_local0 then + f11_local0 = Clan.GetNumProposals( f8_local3 ) == 0 + end + local f11_local1 = f11_arg0 + local f11_local2 = f11_arg0.processEvent + local f11_local3 = {} + local f11_local4 + if f11_local0 then + f11_local4 = "disable" + if not f11_local4 then + + else + f11_local3.name = f11_local4 + f11_local2( f11_local1, f11_local3 ) + end + end + f11_local4 = "enable" + end + } + f8_local4[f8_local5] = f8_local6 + end + if Engine.GetDvarInt( "allow_cod_anywhere" ) == 1 then + f8_local4[#f8_local4 + 1] = { + type = "UIGenericButton", + id = "cod_anywhere_button_id", + disabled = Engine.IsUserAGuest( f8_local3 ), + properties = { + button_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_CAPS" ), + button_action_func = BarrackCoDAnywhereAction, + desc_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_DESC" ) + } + } + end + if not f8_local2 then + local f8_local5 = #f8_local4 + 1 + local f8_local6 = { + type = "UIGenericButton", + id = "reset_stats_button_id" + } + local f8_local7 + if Cac.GetPrestigeLevel( f8_local3, Cac.GetSquadLoc() ) == 10 then + f8_local7 = Engine.IsUserAGuest( f8_local3 ) + else + f8_local7 = true + end + f8_local6.disabled = f8_local7 + f8_local6.properties = { + button_text = Engine.Localize( "@LUA_MENU_MP_RESET_STATS_CAPS" ), + button_action_func = BarrackPrestigeResetStatsAction, + desc_text = Engine.Localize( "@LUA_MENU_MP_RESET_STATS_DESC" ) + } + f8_local6.handlers = { + element_refresh = function ( f12_arg0, f12_arg1 ) + local f12_local0 + if Cac.GetPrestigeLevel( f8_local3, Cac.GetSquadLoc() ) == 10 then + f12_local0 = Engine.IsUserAGuest( f8_local3 ) + else + f12_local0 = true + end + local f12_local1 = f12_arg0 + local f12_local2 = f12_arg0.processEvent + local f12_local3 = {} + local f12_local4 + if f12_local0 then + f12_local4 = "disable" + if not f12_local4 then + + else + f12_local3.name = f12_local4 + f12_local2( f12_local1, f12_local3 ) + end + end + f12_local4 = "enable" + end + } + f8_local4[f8_local5] = f8_local6 + end + end + f8_local4[#f8_local4 + 1] = { + type = "button_desc_text", + id = "barracks_button_description_id" + } + return f8_local4 +end + +function BarracksButtonHelper( f13_arg0, f13_arg1 ) + Engine.ExecNow( "eliteclan_refresh", f13_arg0.properties.exclusiveController ) + f13_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function menu_barracks() + return { + type = "UIElement", + id = "menu_barracks_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = { + is_offline_barracks = false + }, + handlers = { + menu_create = BarracksButtonHelper, + refresh_clan_data = function ( f15_arg0, f15_arg1 ) + Engine.ExecNow( "eliteclan_refresh", f15_arg0.properties.exclusiveController ) + end + + }, + children = { + { + type = "generic_menu_title", + id = "barracks_title_text_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_BARRACKS_CAPS" ) + } + }, + { + type = "UIText", + id = "clan_details_downloading", + properties = { + text = Engine.Localize( "LUA_MENU_DOWNLOADING_CLAN" ) + }, + states = { + default = CoD.ColorizeState( Colors.white, { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + right = -140, + top = 59, + width = 300, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alpha = 0 + } ), + visible = CoD.ColorizeState( Colors.white, { + alpha = 1 + } ), + dark = CoD.ColorizeState( Colors.secondary_text_color, { + alpha = 1 + } ) + }, + handlers = { + update_downloading_text = function ( f16_arg0, f16_arg1 ) + if Clan.IsDownloadingData( f16_arg0.properties.exclusiveController ) then + if not f16_arg0.properties.animating then + local f16_local0 = MBh.AnimateLoop( { + { + "visible", + 400 + }, + { + "dark", + 400 + } + } ) + f16_local0( f16_arg0 ) + f16_arg0.properties.animating = true + end + else + f16_arg0.properties.animating = false + f16_arg0:animateToState( "default" ) + end + end + , + menu_create = MBh.EmitEvent( { + name = "update_downloading_text" + } ) + }, + children = { + { + type = "UITimer", + id = "downloading_text_timer", + properties = { + event = "update_downloading_text", + interval = 100, + disposable = false, + broadcastToRoot = false + } + } + } + }, + { + type = "UIVerticalList", + id = "barracks_options_vlist_id", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + childrenFeeder = BarracksOptionsFeeder + }, + { + type = "button_helper_text_main", + id = "barracks_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + }, + { + type = "UIBindButton", + id = "barracks_bind_buttons_id", + handlers = { + button_secondary = MBh.LeaveMenu() + } + }, + { + type = "UITimer", + id = "button_refresh_timer", + properties = { + event = { + name = "element_refresh" + }, + interval = 1000 + } + }, + { + type = "UITimer", + id = "clan_refresh_timer", + properties = { + event = { + name = "refresh_clan_data" + }, + interval = 60000 + } + } + } + } +end + +function barracks_options_vlist() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + } + } +end + +LUI.MenuBuilder.registerDef( "menu_barracks", menu_barracks ) +LUI.MenuBuilder.registerDef( "barracks_options_vlist", barracks_options_vlist ) +LockTable( _M ) diff --git a/lui/mp_menus/mpcodanywhere.dec.lua b/lui/mp_menus/mpcodanywhere.dec.lua new file mode 100644 index 0000000..e17ef6b --- /dev/null +++ b/lui/mp_menus/mpcodanywhere.dec.lua @@ -0,0 +1,2920 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) + CoDAnywhere.DoNotShowPopup( f1_arg1.controller ) +end + +f0_local1 = function ( f2_arg0 ) + assert( self.properties.exclusiveController ) + local f2_local0 = self.properties.exclusiveController + local f2_local1 = {} + local f2_local2 = "" + local f2_local3 = "Error: Failed to find string for CoDA Intro Feeder" + local f2_local4 = "Error: Failed to find string for CoDA Intro Feeder" + if CoDAnywhere.ShouldShowFounderPopup( f2_local0, true ) == true then + f2_local2 = "white" + f2_local3 = "@LUA_MENU_COD_ANYWHERE_INTRO_FOUNDER_1" + f2_local4 = "@LUA_MENU_COD_ANYWHERE_INTRO_FOUNDER_2" + elseif CoDAnywhere.ShouldShowWelcomeBackPopup( f2_local0, true ) == true then + f2_local2 = "white" + f2_local3 = "@LUA_MENU_COD_ANYWHERE_INTRO_WELCOME_1" + f2_local4 = "@LUA_MENU_COD_ANYWHERE_INTRO_WELCOME_2" + else + f2_local2 = "white" + f2_local3 = "@LUA_MENU_COD_ANYWHERE_INTRO_NEW_1" + f2_local4 = "@LUA_MENU_COD_ANYWHERE_INTRO_NEW_2" + end + return { + { + type = "generic_menu_background", + properties = { + top_offset = GenericTitleBarDims.TitleBarHeight, + menu_frame_r = 0.4, + menu_frame_g = 0.4, + menu_frame_b = 0.4, + background_alpha = 0.25, + border_alpha = 0.25 + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( f2_local2 ) + } + } + }, + { + type = "UIText", + id = "cod_anywhere_intro_text1", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -215, + top = -190, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1, + width = 430, + blue = 0 + } + }, + properties = { + text = Engine.Localize( f2_local3 ) + } + }, + { + type = "UIText", + id = "cod_anywhere_intro_text2", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -215, + top = -190, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1, + width = 430, + blue = 0 + } + }, + properties = { + text = Engine.Localize( f2_local4 ) + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_intro_button", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@LUA_MENU_CONTINUE" ), + button_action_func = f0_local0 + } + } + } +end + +function cod_anywhere_intro_popup() + return { + type = "UIElement", + id = "cod_anywhere_intro_popup", + properties = { + childrenFeeder = f0_local1, + func = nil + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = childfeeder + } +end + +function cod_anywhere_import_continue( f4_arg0, f4_arg1, f4_arg2 ) + LUI.FlowManager.RequestAddMenu( f4_arg0, "cod_anywhere_registration_menu", true, f4_arg1.controller, true ) +end + +f0_local2 = function ( f5_arg0 ) + local f5_local0 = {} + local f5_local1 = { + false, + true + } + local f5_local2 = { + { + text = Engine.Localize( "@LUA_MENU_ACCEPT" ), + func = function ( f6_arg0, f6_arg1 ) + cod_anywhere_import_continue( f6_arg0, f6_arg1, true ) + end, + import = true + }, + { + text = Engine.Localize( "@LUA_MENU_CODA_IMPORT_REFUSE" ), + func = function ( f7_arg0, f7_arg1 ) + cod_anywhere_import_continue( f7_arg0, f7_arg1, false ) + end, + import = false + } + } + for f5_local3 = 1, #f5_local2, 1 do + f5_local0[#f5_local0 + 1] = { + type = "UIGenericButton", + id = "cod_anywhere_button_" .. f5_local3, + listDefaultFocus = f5_local1[f5_local3], + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = f5_local2[f5_local3].text, + button_action_func = f5_local2[f5_local3].func + } + } + end + return f5_local0 +end + +function cod_anywhere_import_popup() + return { + type = "UIElement", + id = "cod_anywhere_import_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_CODA_IMPORT_TITLE" ), + popup_childfeeder = f0_local2, + popup_title_alignment = LUI.Alignment.Center + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = 576, + top = -200, + bottom = 150 + } + }, + handlers = { + menu_create = updateSelectionListPopup + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + properties = { + title_bar_text = MBh.Property( "popup_title" ), + title_bar_alignment = MBh.Property( "popup_title_alignment" ), + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + properties = { + fill_alpha = 1 + } + }, + { + type = "UIText", + id = "cod_anywhere_import_text1", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -100, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1, + blue = 0 + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_IMPORT_TEXT1" ) + } + }, + { + type = "UIText", + id = "cod_anywhere_import_text2", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -70, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1 + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_IMPORT_TEXT2" ) + } + }, + { + type = "UIText", + id = "cod_anywhere_import_text3", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 10, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 0.75 + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_IMPORT_TEXT3" ) + } + }, + { + type = "UIVerticalList", + id = "selection_list_popup_vert_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 6 + 256, + bottom = 0, + left = 0, + right = 0, + alignment = LUI.Alignment.Top + } + }, + childrenFeeder = MBh.Property( "popup_childfeeder" ) + }, + { + type = "UIBindButton", + id = "cod_anywhere_import_back_id", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } + } + } +end + +function cod_anywhere_email_confirm_continue( f9_arg0, f9_arg1 ) + LUI.FlowManager.RequestPopupMenu( f9_arg0, "cod_anywhere_agreement_popup", true, f9_arg1.controller, true ) +end + +local f0_local3 = function ( f10_arg0 ) + local f10_local0 = {} + local f10_local1 = { + { + text = Engine.Localize( "@LUA_MENU_ACCEPT" ), + func = cod_anywhere_email_confirm_continue + }, + { + text = Engine.Localize( "@LUA_MENU_CANCEL" ), + func = MBh.LeaveMenu() + } + } + for f10_local2 = 1, #f10_local1, 1 do + f10_local0[#f10_local0 + 1] = { + type = "UIGenericButton", + id = "cod_anywhere_button_" .. f10_local2, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = f10_local1[f10_local2].text, + button_action_func = f10_local1[f10_local2].func + } + } + end + return f10_local0 +end + +function cod_anywhere_email_confirm_popup() + return { + type = "UIElement", + id = "cod_anywhere_email_confirm_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_CODA_EMAIL_CONFIRM_TITLE" ), + popup_childfeeder = f0_local3, + popup_title_alignment = LUI.Alignment.Center + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = 576, + top = -155, + bottom = 155 + } + }, + handlers = { + menu_create = updateSelectionListPopup + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + properties = { + title_bar_text = MBh.Property( "popup_title" ), + title_bar_alignment = MBh.Property( "popup_title_alignment" ), + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + properties = { + fill_alpha = 1 + } + }, + { + type = "UIText", + id = "cod_anywhere_email_confirm_text1", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -100, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1, + blue = 0 + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_EMAIL_CONFIRM_TEXT1" ) + } + }, + { + type = "UIText", + id = "cod_anywhere_email_confirm_text2", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -75, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.generic_button_text_default_color.r, + green = Colors.generic_button_text_default_color.g, + blue = Colors.generic_button_text_default_color.b + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_EMAIL_CONFIRM_TEXT2" ) + } + }, + { + type = "UIMarqueeText", + id = "cod_anywhere_email_confirm_text3", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 20, + right = -20, + top = -30, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.generic_button_content_focus_color.r, + green = Colors.generic_button_content_focus_color.g, + blue = Colors.generic_button_content_focus_color.b + } + }, + properties = { + text = "" + }, + handlers = { + menu_create = function ( f12_arg0, f12_arg1 ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + local f12_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_local0.reg_menu ) + f12_arg0:setText( f12_local1.reg_email or "error" ) + end + + } + }, + { + type = "UIText", + id = "cod_anywhere_email_confirm_text4", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 10, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.generic_button_text_default_color.r, + green = Colors.generic_button_text_default_color.g, + blue = Colors.generic_button_text_default_color.b + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_EMAIL_CONFIRM_TEXT3" ) + } + }, + { + type = "UIVerticalList", + id = "selection_list_popup_vert_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 6 + 210, + bottom = -8, + left = 5, + right = -5, + alignment = LUI.Alignment.Top + } + }, + childrenFeeder = MBh.Property( "popup_childfeeder" ) + }, + { + type = "UIBindButton", + id = "cod_anywhere_email_back_id", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } + } + } +end + +function cod_anywhere_quit_confirm_popup() + return { + type = "generic_yesno_popup", + id = "cod_anywhere_quit_confirm_popup", + properties = { + popup_title = Engine.Localize( "@PLATFORM_QUIT" ), + message_text = Engine.Localize( "@MENU_ARE_YOU_SURE_QUIT" ), + yes_action = function ( f14_arg0, f14_arg1 ) + f14_arg0:dispatchEventToRoot( { + name = "cod_anywhere_success_exit", + id = "coda_registration" + } ) + end + , + no_action = MBh.LeaveMenu(), + yes_text = Engine.Localize( "@MENU_QUIT" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function SignInSetup( f15_arg0, f15_arg1 ) + local f15_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f15_arg0 ) + f15_local0.signin_email = RegistrationDefaults.reg_email + f15_local0.signin_password = RegistrationDefaults.reg_password + f15_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function SignInEmailPopup( f16_arg0, f16_arg1 ) + local f16_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f16_arg0 ) + Engine.OpenScreenKeyboard( f16_arg1.controller, f16_arg0.properties.field_name, f16_local0.signin_email and f16_local0.signin_email or "", f16_arg0.properties.max_length, false, false, f16_arg0.properties.keyboard_type ) + f16_arg0.properties.active = true +end + +function SignInEmailDisplayChanged( f17_arg0, f17_arg1 ) + local f17_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f17_arg0 ) + local f17_local1 = f17_local0.signin_email or "" + if string.len( f17_local1 ) >= 16 then + f17_local1 = string.sub( f17_local1, 1, 16 ) .. " ..." + end + return f17_local1 +end + +function SignInEmailChanged( f18_arg0, f18_arg1 ) + local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0 ) + if f18_arg1.text == nil or string.find( f18_arg1.text, " " ) ~= nil then + return + elseif f18_arg0.properties.active then + f18_arg0.properties.active = false + f18_local0.signin_email = f18_arg1.text + f18_arg0:processEvent( { + name = "content_refresh", + dispatchChildren = true + } ) + end +end + +function SignInPasswordChanged( f19_arg0, f19_arg1 ) + local f19_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f19_arg0 ) + f19_local0.signin_password = f19_arg1.text + if f19_local0.signin_email and string.len( f19_local0.signin_email ) > 0 and f19_local0.signin_password and string.len( f19_local0.signin_password ) > 0 then + f19_arg0:dispatchEventToRoot( { + name = "enable_confirm", + id = "cod_anywhere_signin_confirm" + } ) + else + f19_arg0:dispatchEventToRoot( { + name = "disable_confirm", + id = "cod_anywhere_signin_confirm" + } ) + end +end + +function SignInContinue( f20_arg0, f20_arg1 ) + local f20_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f20_arg0 ) + CoDAnywhere.StartAccountLinking( f20_arg1.controller, f20_local0.signin_email, f20_local0.signin_password ) +end + +function cod_anywhere_sign_in_popup() + return { + type = "UIElement", + id = "cod_anywhere_signin_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_CODA_SIGNIN_TITLE" ), + popup_title_alignment = LUI.Alignment.Center + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = SignInSetup, + signin_continue = SignInContinue, + open_cod_anywhere_success_popup = MBh.LeaveMenu(), + open_cod_anywhere_error_popup = OpenCoDAnywhereErrorPopup + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "white" ), + top = -360, + bottom = 360, + left = 0, + right = 0, + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = 0.85 + } + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + left = -425, + right = 425, + top = -175, + bottom = 175 + } + }, + handlers = { + menu_create = updateSelectionListPopup + }, + children = { + { + type = "generic_menu_titlebar", + properties = { + title_bar_text = MBh.Property( "popup_title" ), + title_bar_alignment = MBh.Property( "popup_title_alignment" ), + border_alpha = 1, + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + properties = { + top_offset = GenericTitleBarDims.TitleBarHeight, + menu_frame_r = 0.4, + menu_frame_g = 0.4, + menu_frame_b = 0.4, + background_alpha = 1, + border_alpha = 1, + fill_alpha = 1 + } + }, + { + type = "UIVerticalList", + id = "cod_anywhere_signin_vlist", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + top = 50 + } + }, + children = { + { + type = "UIGenericButton", + id = "cod_anywhere_signin_email", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 80, + right = -80, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_EMAIL" ), + content_width = 350, + content_margin = 55, + text_padding_with_content = 420, + button_display_func = SignInEmailDisplayChanged, + button_action_func = SignInEmailPopup, + text_alignment = LUI.Alignment.Center, + keyboard_type = CoD.KeyboardInputTypes.Email, + field_name = Engine.Localize( "@LUA_MENU_CODA_REGISTER_EMAIL" ), + max_length = 53, + additional_handlers = { + text_input_complete = SignInEmailChanged + } + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_signin_password", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 80, + right = -80, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Input, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_PASSWORD" ), + content_width = 350, + content_margin = 55, + text_padding_with_content = 420, + field_edited_func = SignInPasswordChanged, + text_alignment = LUI.Alignment.Center, + keyboard_type = CoD.KeyboardInputTypes.Password, + field_name = Engine.Localize( "@LUA_MENU_CODA_REGISTER_PASSWORD" ), + password_field = true + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 8, + material = RegisterMaterial( "white" ), + alpha = 0 + } + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 1, + right = -1, + top = 0, + bottom = 1, + material = RegisterMaterial( "white" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + } + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 10, + material = RegisterMaterial( "white" ), + alpha = 0 + } + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_signin_confirm", + disabled = true, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 80, + right = -80, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_SIGNIN_CONFIRM" ), + button_action_func = SignInContinue, + text_align_without_content = LUI.Alignment.Center, + text_padding_without_content = 50 + }, + handlers = { + enable_confirm = function ( f22_arg0, f22_arg1 ) + f22_arg0:processEvent( { + name = "enable" + } ) + end + , + disable_confirm = function ( f23_arg0, f23_arg1 ) + f23_arg0:processEvent( { + name = "disable" + } ) + end + + } + } + } + }, + { + type = "UIText", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 10, + right = -10, + top = 210, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.generic_button_text_default_color.r, + green = Colors.generic_button_text_default_color.g, + blue = Colors.generic_button_text_default_color.b, + alpha = 0.65 + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_SIGNIN_TEXT" ) + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 1, + right = -1, + top = -42, + bottom = -41, + material = RegisterMaterial( "white" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.25 + } + } + }, + { + type = "UIBindButton", + id = "cod_anywhere_signin_buttons", + handlers = { + button_secondary = MBh.LeaveMenu() + } + }, + { + type = "button_helper_text_main", + properties = { + left_inset = 20, + right_inset = -75, + top_margin = GenericFooterDims.TopMargin_WithoutBackground, + bottom_margin = 0, + height = GenericFooterDims.Height, + spacing = 12, + background_alpha = 0 + } + } + } + } + } + } +end + +function cod_anywhere_agreement_continue( f24_arg0, f24_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f24_arg0 ) + f24_arg0:dispatchEventToRoot( { + name = "cod_anywhere_start_registration", + id = "coda_registration" + } ) +end + +function AgreementScrollLeftRight( f25_arg0, f25_arg1, f25_arg2 ) + local f25_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f25_arg0 ) + local f25_local1 = "" + local f25_local2 = "" + if f25_arg1.name == "button_shoulderr" then + if f25_local0.current_page + 1 <= f25_local0.num_pages then + f25_local0.current_page = f25_local0.current_page + 1 + else + return + end + elseif f25_arg1.name == "button_shoulderl" then + if f25_local0.current_page - 1 >= 1 then + f25_local0.current_page = f25_local0.current_page - 1 + else + return + end + end + if f25_local0.current_page > 1 then + f25_arg0:dispatchEventToRoot( { + name = "enable_agreement_left_arrow", + id = "cod_anywhere_agreement_popup" + } ) + else + f25_arg0:dispatchEventToRoot( { + name = "disable_agreement_left_arrow", + id = "cod_anywhere_agreement_popup" + } ) + end + if f25_local0.current_page < f25_local0.num_pages then + f25_arg0:dispatchEventToRoot( { + name = "enable_agreement_right_arrow", + id = "cod_anywhere_agreement_popup" + } ) + else + f25_arg0:dispatchEventToRoot( { + name = "disable_agreement_right_arrow", + id = "cod_anywhere_agreement_popup" + } ) + end + f25_local0.top_offset = f25_local0.top_offset_buffer + f25_arg0:dispatchEventToRoot( { + name = "set_agreement_text", + id = "cod_anywhere_agreement_text", + page = "" + } ) + f25_arg0:dispatchEventToRoot( { + name = "agreement_scroll_up", + id = "cod_anywhere_agreement_text" + } ) + f25_local1 = f25_local0.agreement_pages[f25_local0.current_page].text + f25_local2 = Engine.Localize( "@LUA_MENU_CODA_AGREEMENT_PAGES" ) .. f25_local0.current_page .. "/" .. f25_local0.num_pages + f25_arg0:dispatchEventToRoot( { + name = "set_agreement_text", + id = "cod_anywhere_agreement_text", + page = f25_local1 + } ) + f25_arg0:dispatchEventToRoot( { + name = "set_pages_text", + id = "cod_anywhere_agreement_pages_text", + text = f25_local2 + } ) +end + +function AgreementScroll( f26_arg0, f26_arg1 ) + if f26_arg1.name == "button_up" then + f26_arg0:dispatchEventToRoot( { + name = "agreement_scroll_up", + id = "cod_anywhere_agreement_text" + } ) + elseif f26_arg1.name == "button_down" then + f26_arg0:dispatchEventToRoot( { + name = "agreement_scroll_down", + id = "cod_anywhere_agreement_text" + } ) + end +end + +function AgreementScrollUp( f27_arg0, f27_arg1 ) + local f27_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f27_arg0 ) + local f27_local1, f27_local2 = f27_arg0:getElementTextDims() + if f27_local0.top_offset < f27_local0.top_offset_buffer * 2 then + f27_local0.top_offset = f27_local0.top_offset + CoD.TextSettings.NormalFont.Height + end + f27_arg0:registerAnimationState( "scroll", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 40, + right = -40, + top = f27_local0.top_offset, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1 + } ) + f27_arg0:animateToState( "scroll" ) +end + +function AgreementScrollDown( f28_arg0, f28_arg1 ) + local f28_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f28_arg0 ) + local f28_local1, f28_local2 = f28_arg0:getElementTextDims() + if f28_local0.top_offset * -1 < f28_local2 - 300 then + f28_local0.top_offset = f28_local0.top_offset - CoD.TextSettings.NormalFont.Height + end + f28_arg0:registerAnimationState( "scroll", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 40, + right = -40, + top = f28_local0.top_offset, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1 + } ) + f28_arg0:animateToState( "scroll" ) +end + +function AgreementSetup( f29_arg0, f29_arg1 ) + local f29_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f29_arg0 ) + local f29_local1 = "" + local f29_local2 = "" + local f29_local3 = Engine.GetCurrentLanguage() + f29_local0.top_offset_buffer = 0 + f29_local0.bottom_offset_buffer = 300 + f29_local0.top_offset = f29_local0.top_offset_buffer + f29_local0.current_page = 1 + f29_local0.agreement_pages = { + { + text = Engine.LocalizeLong( "@LUA_MENU_CODA_AGREEMENT_TEXT1" ) + }, + { + text = Engine.LocalizeLong( "@LUA_MENU_CODA_AGREEMENT_TEXT2" ) + }, + { + text = Engine.LocalizeLong( "@LUA_MENU_CODA_AGREEMENT_TEXT3" ) + }, + { + text = Engine.LocalizeLong( "@LUA_MENU_CODA_AGREEMENT_TEXT4" ) + }, + { + text = Engine.LocalizeLong( "@LUA_MENU_CODA_AGREEMENT_TEXT5" ) + }, + { + text = Engine.LocalizeLong( "@LUA_MENU_CODA_AGREEMENT_TEXT6" ) + }, + { + text = Engine.LocalizeLong( "@LUA_MENU_CODA_AGREEMENT_TEXT7" ) + }, + { + text = Engine.LocalizeLong( "@LUA_MENU_CODA_AGREEMENT_TEXT8" ) + } + } + if Languages[Engine.GetCurrentLanguage and Engine.GetCurrentLanguage() or 0] == "LANGUAGE_ENGLISH" then + f29_local0.num_pages = 8 + else + f29_local0.num_pages = 8 + end + f29_local1 = f29_local0.agreement_pages[f29_local0.current_page].text + f29_arg0:dispatchEventToRoot( { + name = "set_pages_text", + id = "cod_anywhere_agreement_pages_text", + text = Engine.Localize( "@LUA_MENU_CODA_AGREEMENT_PAGES" ) .. f29_local0.current_page .. "/" .. f29_local0.num_pages + } ) + f29_arg0:dispatchEventToRoot( { + name = "enable_agreement_right_arrow", + id = "cod_anywhere_agreement_popup" + } ) + f29_arg0:dispatchEventToRoot( { + name = "disable_agreement_left_arrow", + id = "cod_anywhere_agreement_popup" + } ) + f29_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addAcceptButton ) + f29_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addDeclineButton ) + f29_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addLeftButton ) + f29_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addRightButton ) +end + +function cod_anywhere_agreement_popup() + return { + type = "UIElement", + id = "cod_anywhere_agreement_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_CODA_AGREEMENT_TITLE" ), + popup_title_alignment = LUI.Alignment.Center + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = AgreementSetup, + agreement_continue = cod_anywhere_agreement_continue + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIBindButton", + handlers = { + button_alt1 = cod_anywhere_agreement_continue, + button_shoulderr = AgreementScrollLeftRight, + button_shoulderl = AgreementScrollLeftRight, + button_up = AgreementScroll, + button_down = AgreementScroll, + button_secondary = MBh.LeaveMenu() + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = 880, + height = 600 + } + }, + handlers = { + menu_create = updateSelectionListPopup + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + properties = { + title_bar_text = MBh.Property( "popup_title" ), + title_bar_alignment = MBh.Property( "popup_title_alignment" ), + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + properties = { + fill_alpha = 1 + } + }, + { + type = "UIText", + id = "cod_anywhere_agreement_subtitle", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 40, + right = -40, + top = 45, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1 + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_AGREEMENT_SUBTITLE" ) + } + }, + { + type = "UIStencil", + id = "cod_anywhere_agreement_stencil", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 80, + bottom = -60, + alpha = 1 + } + }, + children = { + { + type = "UIText", + id = "cod_anywhere_agreement_text", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 40, + right = -40, + top = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1, + red = Colors.cac_label_text.r, + green = Colors.cac_label_text.g, + blue = Colors.cac_label_text.b + } + }, + properties = { + text = Engine.LocalizeLong( "@LUA_MENU_CODA_AGREEMENT_TEXT1" ) + }, + handlers = { + set_agreement_text = function ( f31_arg0, f31_arg1 ) + if f31_arg1.page then + f31_arg0:setText( f31_arg1.page ) + end + end + , + agreement_scroll_up = AgreementScrollUp, + agreement_scroll_down = AgreementScrollDown + } + } + } + }, + { + type = "UIText", + id = "cod_anywhere_agreement_pages_text", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + left = -100, + right = -10, + top = -30, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + alpha = 1 + } + }, + properties = { + text = "" + }, + handlers = { + set_pages_text = function ( f32_arg0, f32_arg1 ) + if f32_arg1.text then + f32_arg0:setText( f32_arg1.text ) + end + end + + } + }, + { + type = "UIImage", + id = "left_nav_arrow_image_id", + states = { + default = { + material = RegisterMaterial( "widg_btn_arrow_lt" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 0, + width = 32, + height = 64, + alpha = 0 + }, + bright = { + alpha = 1 + } + }, + handlers = { + disable_agreement_left_arrow = MBh.AnimateToState( "default", 0 ), + enable_agreement_left_arrow = MBh.AnimateToState( "bright", 0 ) + } + }, + { + type = "UIImage", + id = "right_nav_arrow_image_id", + states = { + default = { + material = RegisterMaterial( "widg_btn_arrow_rt" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + right = 0, + width = 32, + height = 64, + alpha = 0 + }, + bright = { + alpha = 1 + } + }, + handlers = { + disable_agreement_right_arrow = MBh.AnimateToState( "default", 0 ), + enable_agreement_right_arrow = MBh.AnimateToState( "bright", 0 ) + } + }, + { + type = "UIImage", + states = { + default = { + material = RegisterMaterial( "" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = -35, + right = 0, + top = 20, + bottom = -20, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b, + alpha = 0 + } + } + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id", + properties = { + left_inset = 20, + right_inset = -75, + top_margin = GenericFooterDims.TopMargin_WithoutBackground, + bottom_margin = 0, + height = GenericFooterDims.Height, + spacing = 12, + background_alpha = 0 + } + } + } + } + } + } +end + +function RegisterFirstNameChanged( f33_arg0, f33_arg1 ) + local f33_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f33_arg0 ) + if f33_arg1.text then + f33_local0.reg_firstname = f33_arg1.text + CheckShowConfirmButton( f33_arg0, f33_arg1 ) + end +end + +function RegisterLastNameChanged( f34_arg0, f34_arg1 ) + local f34_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f34_arg0 ) + if f34_arg1.text then + f34_local0.reg_lastname = f34_arg1.text + CheckShowConfirmButton( f34_arg0, f34_arg1 ) + end +end + +function GetCountryText( f35_arg0, f35_arg1 ) + local f35_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f35_arg0 ) + local f35_local1 = f35_local0.reg_country or 1 + return Engine.Localize( RegistrationDefaults.country_list[f35_local0.reg_country or 1].display_string ) +end + +function CountryNext( f36_arg0, f36_arg1, f36_arg2 ) + local f36_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f36_arg0 ) + local f36_local1 = f36_local0.reg_country + 1 + if f36_local1 > #RegistrationDefaults.country_list then + f36_local1 = 1 + end + f36_local0.reg_country = f36_local1 +end + +function CountryPrev( f37_arg0, f37_arg1, f37_arg2 ) + local f37_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f37_arg0 ) + local f37_local1 = f37_local0.reg_country - 1 + if f37_local1 < 1 then + f37_local1 = #RegistrationDefaults.country_list + end + f37_local0.reg_country = f37_local1 +end + +function RegisterZipChanged( f38_arg0, f38_arg1 ) + local f38_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f38_arg0 ) + if f38_arg1.text then + f38_local0.reg_zipcode = f38_arg1.text + CheckShowConfirmButton( f38_arg0, f38_arg1 ) + end +end + +function RegisterUsernameChanged( f39_arg0, f39_arg1 ) + local f39_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f39_arg0 ) + if f39_arg0.properties.active then + f39_arg0.properties.active = false + if f39_arg1.text ~= nil then + f39_local0.reg_community_name = f39_arg1.text + VerifyUsername( f39_arg0, f39_arg1, f39_arg1.text, true ) + CheckShowConfirmButton( f39_arg0, f39_arg1 ) + end + f39_arg0:processEvent( { + name = "content_refresh" + } ) + end +end + +function RegisterUsernameDisplayChanged( f40_arg0, f40_arg1 ) + local f40_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f40_arg0 ) + return f40_local0.reg_community_name or "" +end + +function RegisterUsernamePopup( f41_arg0, f41_arg1 ) + local f41_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f41_arg0 ) + Engine.OpenScreenKeyboard( f41_arg1.controller, f41_arg0.properties.field_name, f41_local0.reg_community_name and f41_local0.reg_community_name or "", f41_arg0.properties.max_length, false, true, f41_arg0.properties.keyboard_type ) + f41_arg0.properties.active = true +end + +function VerifyUsername( f42_arg0, f42_arg1, f42_arg2, f42_arg3 ) + local f42_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f42_arg0 ) + local f42_local1 = Engine.Localize( "@LUA_MENU_CODA_REGISTER_USERNAME" ) + if f42_arg2 == nil or not string.find( f42_arg2, "^[%w_]+$" ) then + if f42_arg3 and f42_arg3 == true then + LUI.FlowManager.RequestPopupMenu( f42_arg0, "cod_anywhere_entry_error_popup", true, f42_arg1.controller, false, { + cancel_will_close = false, + popup_title = Engine.Localize( "@LUA_MENU_CODA_REGISTER_ENTRY_ERROR" ), + button_text = Engine.Localize( "@LUA_MENU_CONTINUE" ), + message_text = f42_local1 + } ) + end + f42_arg0:dispatchEventToRoot( { + name = "show_problem_icon", + id = "cod_anywhere_register_username_icon" + } ) + f42_local0.community_name_error = true + return f42_local1 + else + f42_local0.community_name_error = false + f42_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_username_icon" + } ) + end +end + +function RegisterEmailPopup( f43_arg0, f43_arg1 ) + local f43_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f43_arg0 ) + Engine.OpenScreenKeyboard( f43_arg1.controller, f43_arg0.properties.field_name, f43_local0.reg_email and f43_local0.reg_email or "", f43_arg0.properties.max_length, false, false, f43_arg0.properties.keyboard_type ) + f43_arg0.properties.active = true +end + +function RegisterEmailDisplayChanged( f44_arg0, f44_arg1 ) + local f44_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f44_arg0 ) + local f44_local1 = f44_local0.reg_email or "" + if string.len( f44_local1 ) >= 24 then + f44_local1 = string.sub( f44_local1, 1, 25 ) .. " ..." + end + return f44_local1 +end + +function RegisterEmailChanged( f45_arg0, f45_arg1 ) + local f45_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f45_arg0 ) + if f45_arg0.properties.active then + f45_arg0.properties.active = false + if f45_arg1.text ~= nil then + f45_local0.reg_email = f45_arg1.text + VerifyEmail( f45_arg0, f45_arg1, f45_arg1.text, true ) + CheckShowConfirmButton( f45_arg0, f45_arg1 ) + end + f45_arg0:processEvent( { + name = "content_refresh" + } ) + end +end + +function VerifyEmail( f46_arg0, f46_arg1, f46_arg2, f46_arg3 ) + local f46_local0 = Engine.Localize( "@LUA_MENU_CODA_REGISTER_EMAIL" ) + if f46_arg2 == nil or string.find( f46_arg2, "@" ) == nil or string.find( f46_arg2, "." ) == nil then + if f46_arg3 and f46_arg3 == true then + LUI.FlowManager.RequestPopupMenu( f46_arg0, "cod_anywhere_entry_error_popup", true, f46_arg1.controller, false, { + cancel_will_close = false, + popup_title = Engine.Localize( "@LUA_MENU_CODA_REGISTER_ENTRY_ERROR" ), + button_text = Engine.Localize( "@LUA_MENU_CONTINUE" ), + message_text = f46_local0 + } ) + end + f46_arg0:dispatchEventToRoot( { + name = "show_problem_icon", + id = "cod_anywhere_register_email_icon" + } ) + return f46_local0 + else + f46_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_email_icon" + } ) + end +end + +function RegisterPasswordChanged( f47_arg0, f47_arg1 ) + local f47_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f47_arg0 ) + if f47_arg1.text then + f47_local0.reg_password = f47_arg1.text + VerifyPassword( f47_arg0, f47_arg1, f47_arg1.text, true ) + VerifyConfirmPassword( f47_arg0, f47_arg1, f47_local0.reg_password_confirm, true ) + CheckShowConfirmButton( f47_arg0, f47_arg1 ) + end +end + +function VerifyPassword( f48_arg0, f48_arg1, f48_arg2, f48_arg3 ) + local f48_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f48_arg0 ) + local f48_local1 = Engine.Localize( "@LUA_MENU_CODA_REGISTER_PASSWORD" ) + local f48_local2 = true + if f48_arg2 == nil or f48_arg2 == "" then + f48_local2 = false + end + if f48_local2 == false or string.len( f48_arg2 ) < 8 or string.len( f48_arg2 ) > 20 then + f48_local2 = false + end + if f48_local2 == false or f48_arg2 == f48_local0.reg_email then + f48_local2 = false + end + if f48_local2 == false then + if show_popup and show_popup == true then + LUI.FlowManager.RequestPopupMenu( f48_arg0, "cod_anywhere_entry_error_popup", true, f48_arg1.controller, false, { + cancel_will_close = false, + popup_title = Engine.Localize( "@LUA_MENU_CODA_REGISTER_ENTRY_ERROR" ), + button_text = Engine.Localize( "@LUA_MENU_CONTINUE" ), + message_text = f48_local1 + } ) + end + f48_arg0:dispatchEventToRoot( { + name = "show_problem_icon", + id = "cod_anywhere_register_password_icon" + } ) + return f48_local1 + else + f48_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_password_icon" + } ) + end +end + +function RegisterConfirmPasswordChanged( f49_arg0, f49_arg1 ) + local f49_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f49_arg0 ) + if f49_arg1.text then + f49_local0.reg_password_confirm = f49_arg1.text + VerifyConfirmPassword( f49_arg0, f49_arg1, f49_arg1.text, true ) + CheckShowConfirmButton( f49_arg0, f49_arg1 ) + end +end + +function VerifyConfirmPassword( f50_arg0, f50_arg1, f50_arg2, f50_arg3 ) + local f50_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f50_arg0 ) + local f50_local1 = Engine.Localize( "@LUA_MENU_CODA_REGISTER_PASS_CONFIRM" ) + if f50_arg2 == nil or f50_arg2 ~= f50_local0.reg_password then + if show_popup and show_popup == true then + LUI.FlowManager.RequestPopupMenu( f50_arg0, "cod_anywhere_entry_error_popup", true, f50_arg1.controller, false, { + cancel_will_close = false, + popup_title = Engine.Localize( "@LUA_MENU_CODA_REGISTER_ENTRY_ERROR" ), + button_text = Engine.Localize( "@LUA_MENU_CONTINUE" ), + message_text = f50_local1 + } ) + end + f50_arg0:dispatchEventToRoot( { + name = "show_problem_icon", + id = "cod_anywhere_register_confirm_password_icon" + } ) + return f50_local1 + else + f50_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_confirm_password_icon" + } ) + end +end + +function GetSubscribeSelection( f51_arg0, f51_arg1 ) + local f51_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f51_arg0 ) + return RegistrationDefaults.subscribe_list[f51_local0.reg_subscribe or 1] +end + +function SubscribeNext( f52_arg0, f52_arg1, f52_arg2 ) + local f52_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f52_arg0 ) + local f52_local1 = f52_local0.reg_subscribe + 1 + if f52_local1 > #RegistrationDefaults.subscribe_list then + f52_local1 = 1 + end + f52_local0.reg_subscribe = f52_local1 +end + +function SubscribePrev( f53_arg0, f53_arg1, f53_arg2 ) + local f53_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f53_arg0 ) + local f53_local1 = f53_local0.reg_subscribe - 1 + if f53_local1 < 1 then + f53_local1 = #RegistrationDefaults.subscribe_list + end + f53_local0.reg_subscribe = f53_local1 +end + +function GetMonthText( f54_arg0, f54_arg1 ) + local f54_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f54_arg0 ) + return Engine.Localize( RegistrationDefaults.month_list[f54_local0.reg_dob_month or 1] ) +end + +function MonthNext( f55_arg0, f55_arg1, f55_arg2 ) + local f55_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f55_arg0 ) + local f55_local1 = f55_local0.reg_dob_month + 1 + if f55_local1 > #RegistrationDefaults.month_list then + f55_local1 = 1 + end + f55_local0.reg_dob_month = f55_local1 + VerifyDoB( f55_arg0, f55_arg1, f55_arg1.text, true ) + if RegistrationDefaults.month_days[f55_local0.reg_dob_month] < f55_local0.reg_dob_day then + f55_local0.reg_dob_day = RegistrationDefaults.month_days[f55_local0.reg_dob_month] + f55_arg0:dispatchEventToRoot( { + name = "content_refresh", + dispatchChildren = true + } ) + end +end + +function MonthPrev( f56_arg0, f56_arg1, f56_arg2 ) + local f56_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f56_arg0 ) + local f56_local1 = f56_local0.reg_dob_month - 1 + if f56_local1 < 1 then + f56_local1 = #RegistrationDefaults.month_list + end + f56_local0.reg_dob_month = f56_local1 + VerifyDoB( f56_arg0, f56_arg1, f56_arg1.text, true ) + if RegistrationDefaults.month_days[f56_local0.reg_dob_month] < f56_local0.reg_dob_day then + f56_local0.reg_dob_day = RegistrationDefaults.month_days[f56_local0.reg_dob_month] + f56_arg0:dispatchEventToRoot( { + name = "content_refresh", + dispatchChildren = true + } ) + end +end + +function GetDayNum( f57_arg0, f57_arg1 ) + local f57_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f57_arg0 ) + return f57_local0.reg_dob_day or 1 +end + +function DayNext( f58_arg0, f58_arg1, f58_arg2 ) + local f58_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f58_arg0 ) + local f58_local1 = f58_local0.reg_dob_day + 1 + local f58_local2 = RegistrationDefaults.month_days[f58_local0.reg_dob_month] + if f58_local0.is_leap_year and f58_local0.reg_dob_month == 2 then + f58_local2 = f58_local2 + 1 + end + if f58_local2 < f58_local1 then + f58_local1 = 1 + end + f58_local0.reg_dob_day = f58_local1 + VerifyDoB( f58_arg0, f58_arg1, f58_arg1.text, true ) +end + +function DayPrev( f59_arg0, f59_arg1, f59_arg2 ) + local f59_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f59_arg0 ) + local f59_local1 = f59_local0.reg_dob_day - 1 + local f59_local2 = RegistrationDefaults.month_days[f59_local0.reg_dob_month] + if f59_local0.is_leap_year and f59_local0.reg_dob_month == 2 then + f59_local2 = f59_local2 + 1 + end + if f59_local1 < 1 then + f59_local1 = f59_local2 + end + f59_local0.reg_dob_day = f59_local1 + VerifyDoB( f59_arg0, f59_arg1, f59_arg1.text, true ) +end + +function GetYearNum( f60_arg0, f60_arg1 ) + local f60_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f60_arg0 ) + return f60_local0.reg_dob_year or 2000 +end + +function YearNext( f61_arg0, f61_arg1, f61_arg2 ) + local f61_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f61_arg0 ) + local f61_local1 = f61_local0.reg_dob_year + 1 + if f61_local1 > RegistrationDefaults.max_year then + f61_local1 = RegistrationDefaults.min_year + end + f61_local0.reg_dob_year = f61_local1 + VerifyDoB( f61_arg0, f61_arg1, f61_arg1.text, true ) + local f61_local2 + if f61_local0.reg_dob_year % 400 ~= 0 and (f61_local0.reg_dob_year % 4 ~= 0 or f61_local0.reg_dob_year % 100 <= 0) then + f61_local2 = false + else + f61_local2 = true + end + f61_local0.is_leap_year = f61_local2 + if f61_local0.is_leap_year == false and f61_local0.reg_dob_day == 29 then + f61_local0.reg_dob_day = RegistrationDefaults.month_days[f61_local0.reg_dob_month] + f61_arg0:dispatchEventToRoot( { + name = "content_refresh", + dispatchChildren = true + } ) + end +end + +function YearPrev( f62_arg0, f62_arg1, f62_arg2 ) + local f62_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f62_arg0 ) + local f62_local1 = f62_local0.reg_dob_year - 1 + if f62_local1 < RegistrationDefaults.min_year then + f62_local1 = RegistrationDefaults.max_year + end + f62_local0.reg_dob_year = f62_local1 + VerifyDoB( f62_arg0, f62_arg1, f62_arg1.text, true ) + local f62_local2 + if f62_local0.reg_dob_year % 400 ~= 0 and (f62_local0.reg_dob_year % 4 ~= 0 or f62_local0.reg_dob_year % 100 <= 0) then + f62_local2 = false + else + f62_local2 = true + end + f62_local0.is_leap_year = f62_local2 + if f62_local0.is_leap_year == false and f62_local0.reg_dob_day == 29 then + f62_local0.reg_dob_day = RegistrationDefaults.month_days[f62_local0.reg_dob_month] + f62_arg0:dispatchEventToRoot( { + name = "content_refresh", + dispatchChildren = true + } ) + end +end + +function VerifyDoB( f63_arg0, f63_arg1 ) + local f63_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f63_arg0 ) + local f63_local1 = 13 + local f63_local2 = 18 + local f63_local3, f63_local4, f63_local5 = Engine.GetCurrentDayMonthYear() + local f63_local6 = Engine.Localize( "@LUA_MENU_CODA_REGISTER_DOB" ) + local f63_local7 = false + if f63_local0.reg_dob_year + f63_local1 < f63_local5 then + f63_local7 = true + elseif f63_local0.reg_dob_year + f63_local1 == f63_local5 then + if f63_local0.reg_dob_month < f63_local4 then + f63_local7 = true + elseif f63_local0.reg_dob_month == f63_local4 then + if f63_local0.reg_dob_day <= f63_local3 then + f63_local7 = true + else + f63_arg0:dispatchEventToRoot( { + name = "show_problem_icon", + id = "cod_anywhere_register_day_icon" + } ) + f63_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_year_icon" + } ) + f63_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_month_icon" + } ) + end + else + f63_arg0:dispatchEventToRoot( { + name = "show_problem_icon", + id = "cod_anywhere_register_month_icon" + } ) + f63_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_day_icon" + } ) + f63_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_year_icon" + } ) + end + else + f63_arg0:dispatchEventToRoot( { + name = "show_problem_icon", + id = "cod_anywhere_register_year_icon" + } ) + f63_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_month_icon" + } ) + f63_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_day_icon" + } ) + end + if f63_local0.reg_dob_year == nil or not f63_local7 then + if show_popup and show_popup == true then + LUI.FlowManager.RequestPopupMenu( f63_arg0, "cod_anywhere_entry_error_popup", true, f63_arg1.controller, false, { + cancel_will_close = false, + popup_title = Engine.Localize( "@LUA_MENU_CODA_REGISTER_ENTRY_ERROR" ), + button_text = Engine.Localize( "@LUA_MENU_CONTINUE" ), + message_text = f63_local6 + } ) + end + return f63_local6 + else + f63_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_year_icon" + } ) + f63_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_month_icon" + } ) + f63_arg0:dispatchEventToRoot( { + name = "hide_problem_icon", + id = "cod_anywhere_register_day_icon" + } ) + end +end + +function codanywhere_age_error_popup() + return { + type = "generic_confirmation_popup", + id = "codanywhere_age_error_popup", + properties = { + popup_title = Engine.Localize( "MENU_ERROR" ), + message_text = Engine.Localize( "@LUA_MENU_CODA_AGE_ERROR" ) + } + } +end + +function CheckShowConfirmButton( f65_arg0, f65_arg1 ) + local f65_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f65_arg0 ) + local f65_local1 = true + if f65_local0.reg_firstname == nil or #f65_local0.reg_firstname == 0 or f65_local0.reg_lastname == nil or #f65_local0.reg_lastname == 0 or f65_local0.reg_zipcode == nil or #f65_local0.reg_zipcode == 0 or f65_local0.reg_community_name == nil or #f65_local0.reg_community_name == 0 or f65_local0.reg_email == nil or #f65_local0.reg_email == 0 or f65_local0.reg_password == nil or #f65_local0.reg_password == 0 or f65_local0.reg_password_confirm == nil or #f65_local0.reg_password_confirm == 0 or f65_local0.community_name_error then + f65_local1 = false + end + if f65_local1 == true then + f65_arg0:dispatchEventToRoot( { + name = "show_confirm_button" + } ) + return true + else + f65_arg0:dispatchEventToRoot( { + name = "hide_confirm_button" + } ) + return false + end +end + +function ContinueRegister( f66_arg0, f66_arg1 ) + if (CheckShowConfirmButton( f66_arg0, f66_arg1 ) or false) == false then + return + end + local f66_local0 = false + if RegisterConfirm( f66_arg0, f66_arg1, true ) == true then + LUI.FlowManager.RequestPopupMenu( f66_arg0, "cod_anywhere_email_confirm_popup", true, f66_arg1.controller, false, { + reg_menu = f66_arg0 + } ) + end +end + +function RegisterConfirm( f67_arg0, f67_arg1, f67_arg2 ) + local f67_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f67_arg0 ) + local f67_local1 = {} + if f67_arg1.controller == nil then + f67_arg1.controller = f67_local0.controller + end + f67_local1[#f67_local1 + 1] = VerifyUsername( f67_arg0, f67_arg1, f67_local0.reg_community_name, false ) + f67_local1[#f67_local1 + 1] = VerifyEmail( f67_arg0, f67_arg1, f67_local0.reg_email, false ) + f67_local1[#f67_local1 + 1] = VerifyPassword( f67_arg0, f67_arg1, f67_local0.reg_password, false ) + f67_local1[#f67_local1 + 1] = VerifyConfirmPassword( f67_arg0, f67_arg1, f67_local0.reg_password_confirm, false ) + f67_local1[#f67_local1 + 1] = VerifyDoB( f67_arg0, f67_arg1, f67_local0.reg_dob_year, false ) + if #f67_local1 ~= 0 then + local f67_local2 = "" + for f67_local3 = 1, #f67_local1, 1 do + f67_local2 = f67_local2 .. f67_local1[f67_local3] + if f67_local3 < #f67_local1 then + f67_local2 = f67_local2 .. ",\n" + end + end + local f67_local3 = { + cancel_will_close = false, + popup_title = Engine.Localize( "@LUA_MENU_CODA_REGISTER_ENTRY_ERROR" ), + message_text = f67_local2, + button_text = Engine.Localize( "@LUA_MENU_CONTINUE" ) + } + if VerifyDoB( f67_arg0, f67_arg1 ) ~= nil then + LUI.FlowManager.RequestPopupMenu( f67_arg0, "codanywhere_age_error_popup", true, f67_arg1.controller ) + return + end + LUI.FlowManager.RequestPopupMenu( f67_arg0, "cod_anywhere_entry_error_popup", true, f67_arg1.controller, false, f67_local3 ) + else + if f67_arg2 == true then + return true + end + local f67_local2 = f67_local0.reg_dob_month + if f67_local0.reg_dob_month < 10 then + f67_local2 = "0" .. f67_local0.reg_dob_month + end + local f67_local3 = f67_local0.reg_dob_day + if f67_local0.reg_dob_day < 10 then + f67_local3 = "0" .. f67_local0.reg_dob_day + end + CoDAnywhere.StartAccountCreation( f67_arg1.controller, f67_local0.reg_firstname, f67_local0.reg_lastname, f67_local0.reg_email, f67_local0.reg_subscribe == 1, f67_local3 .. "-" .. f67_local2 .. "-" .. f67_local0.reg_dob_year, RegistrationDefaults.country_list[f67_local0.reg_country].code, f67_local0.reg_zipcode, f67_local0.reg_password, f67_local0.reg_community_name ) + end +end + +function RegistrationOptionsFeeder( f68_arg0 ) + local f68_local0 = nil + Engine.MenuDvarsSetup( f68_arg0.exclusiveController ) + return { + { + type = "UIGenericButton", + id = "cod_anywhere_register_firstname", + states = DefaultButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Input, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_FIRSTNAME" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_FIRSTNAME_DESC" ), + content_width = ButtonDefaults.content_width, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content, + field_edited_func = RegisterFirstNameChanged, + text_alignment = LUI.Alignment.Center, + field_name = Engine.Localize( "@LUA_MENU_CODA_REGISTER_FIRSTNAME" ) + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_lastname", + states = DefaultButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Input, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_LASTNAME" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_LASTNAME_DESC" ), + content_width = ButtonDefaults.content_width, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content, + field_edited_func = RegisterLastNameChanged, + text_alignment = LUI.Alignment.Center, + field_name = Engine.Localize( "@LUA_MENU_CODA_REGISTER_LASTNAME" ) + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_country", + states = DefaultButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_COUNTRY" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_COUNTRY_DESC" ), + content_width = ButtonDefaults.content_width, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content, + button_display_func = GetCountryText, + button_left_func = function ( f69_arg0, f69_arg1 ) + return CountryPrev( f69_arg0, f69_arg1, f68_arg0.exclusiveController ) + end + , + button_right_func = function ( f70_arg0, f70_arg1 ) + return CountryNext( f70_arg0, f70_arg1, f68_arg0.exclusiveController ) + end + + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_zip", + states = DefaultButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Input, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_ZIP" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_ZIP_DESC" ), + content_width = ButtonDefaults.content_width, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content, + field_edited_func = RegisterZipChanged, + text_alignment = LUI.Alignment.Center, + field_name = Engine.Localize( "@LUA_MENU_CODA_REGISTER_ZIP" ) + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_username", + states = DefaultButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_USERNAME" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_USERNAME_DESC" ), + content_width = ButtonDefaults.content_width, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content, + button_display_func = RegisterUsernameDisplayChanged, + button_action_func = RegisterUsernamePopup, + text_alignment = LUI.Alignment.Center, + field_name = Engine.Localize( "@LUA_MENU_CODA_REGISTER_USERNAME" ), + keyboard_type = CoD.KeyboardInputTypes.Email, + max_length = 20, + additional_handlers = { + text_input_complete = RegisterUsernameChanged + }, + filter_profanity = true + }, + children = { + { + type = "UIImage", + id = "cod_anywhere_register_username_icon", + states = DefaultIconState(), + handlers = DefaultIconHandlers + } + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_email", + states = DefaultButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_EMAIL" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_EMAIL_DESC" ), + content_width = ButtonDefaults.content_width, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content, + button_display_func = RegisterEmailDisplayChanged, + button_action_func = RegisterEmailPopup, + text_alignment = LUI.Alignment.Center, + field_name = Engine.Localize( "@LUA_MENU_CODA_REGISTER_EMAIL" ), + keyboard_type = CoD.KeyboardInputTypes.Email, + max_length = 53, + additional_handlers = { + text_input_complete = RegisterEmailChanged + } + }, + children = { + { + type = "UIImage", + id = "cod_anywhere_register_email_icon", + states = DefaultIconState(), + handlers = DefaultIconHandlers + } + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_password", + states = DefaultButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Input, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_PASSWORD" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_PASSWORD_DESC" ), + content_width = ButtonDefaults.content_width, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content, + field_edited_func = RegisterPasswordChanged, + text_alignment = LUI.Alignment.Center, + keyboard_type = CoD.KeyboardInputTypes.Password, + field_name = Engine.Localize( "@LUA_MENU_CODA_REGISTER_PASSWORD" ), + password_field = true + }, + children = { + { + type = "UIImage", + id = "cod_anywhere_register_password_icon", + states = DefaultIconState(), + handlers = DefaultIconHandlers + } + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_password_confirm", + states = DefaultButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Input, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_PASS_CONFIRM" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_PASS_CONFIRM_DESC" ), + content_width = ButtonDefaults.content_width, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content, + field_edited_func = RegisterConfirmPasswordChanged, + text_alignment = LUI.Alignment.Center, + keyboard_type = CoD.KeyboardInputTypes.Password, + field_name = Engine.Localize( "@LUA_MENU_CODA_REGISTER_PASS_CONFIRM" ), + password_field = true + }, + children = { + { + type = "UIImage", + id = "cod_anywhere_register_confirm_password_icon", + states = DefaultIconState(), + handlers = DefaultIconHandlers + } + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_subscribe", + states = DefaultButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_SUBSCRIBE" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_SUBSCRIBE_DESC" ), + content_width = ButtonDefaults.content_width, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content, + button_display_func = GetSubscribeSelection, + button_left_func = function ( f71_arg0, f71_arg1 ) + return SubscribePrev( f71_arg0, f71_arg1, f68_arg0.exclusiveController ) + end + , + button_right_func = function ( f72_arg0, f72_arg1 ) + return SubscribeNext( f72_arg0, f72_arg1, f68_arg0.exclusiveController ) + end + + } + }, + { + type = "UIElement", + id = "cod_anywhere_register_blank_spacer", + focusable = false, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 320, + top = 0, + bottom = 28 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 453, + top = 0, + bottom = 138, + material = RegisterMaterial( "box_registration" ), + alpha = 1 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + left = 0, + right = 30, + top = 0, + bottom = 0, + material = RegisterMaterial( "box_registration_rtcap" ), + alpha = 1 + } + } + } + } + }, + { + type = "UIText", + id = "cod_anywhere_register_dob_spacer", + focusable = false, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 4, + left = 0, + bottom = CoD.TextSettings.NormalFont.Height + 5, + right = 325, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + alpha = 1 + } ) + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_DOB" ) + } + } + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_dob_month", + states = DefaultDoBButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_DOB_MONTH" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_DOB_MONTH_DESC" ), + content_width = ButtonDefaults.content_width - 40, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content - 20, + button_display_func = GetMonthText, + button_left_func = function ( f73_arg0, f73_arg1 ) + return MonthPrev( f73_arg0, f73_arg1, f68_arg0.exclusiveController ) + end + , + button_right_func = function ( f74_arg0, f74_arg1 ) + return MonthNext( f74_arg0, f74_arg1, f68_arg0.exclusiveController ) + end + , + text_default_color = Colors.secondary_text_color + }, + children = { + { + type = "UIImage", + id = "cod_anywhere_register_month_icon", + states = DefaultIconState(), + handlers = DefaultIconHandlers + } + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_dob_day", + states = DefaultDoBButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_DOB_DAY" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_DOB_DAY_DESC" ), + content_width = ButtonDefaults.content_width - 40, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content - 20, + button_display_func = GetDayNum, + button_left_func = function ( f75_arg0, f75_arg1 ) + return DayPrev( f75_arg0, f75_arg1, f68_arg0.exclusiveController ) + end + , + button_right_func = function ( f76_arg0, f76_arg1 ) + return DayNext( f76_arg0, f76_arg1, f68_arg0.exclusiveController ) + end + , + text_default_color = Colors.secondary_text_color + }, + children = { + { + type = "UIImage", + id = "cod_anywhere_register_day_icon", + states = DefaultIconState(), + handlers = DefaultIconHandlers + } + } + }, + { + type = "UIGenericButton", + id = "cod_anywhere_register_dob_year", + states = DefaultDoBButtonStates, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_DOB_YEAR" ), + desc_text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_DOB_YEAR_DESC" ), + content_width = ButtonDefaults.content_width - 40, + content_margin = ButtonDefaults.content_margin, + text_padding_with_content = ButtonDefaults.text_padding_with_content - 20, + button_display_func = GetYearNum, + button_left_func = function ( f77_arg0, f77_arg1 ) + return YearPrev( f77_arg0, f77_arg1, f68_arg0.exclusiveController ) + end + , + button_right_func = function ( f78_arg0, f78_arg1 ) + return YearNext( f78_arg0, f78_arg1, f68_arg0.exclusiveController ) + end + , + text_default_color = Colors.secondary_text_color + }, + children = { + { + type = "UIImage", + id = "cod_anywhere_register_year_icon", + states = DefaultIconState(), + handlers = DefaultIconHandlers + } + } + } + } +end + +function coda_menu_setup( f79_arg0, f79_arg1 ) + local f79_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f79_arg0 ) + f79_local0.reg_firstname = RegistrationDefaults.reg_firstname + f79_local0.reg_lastname = RegistrationDefaults.reg_lastname + f79_local0.reg_country = RegistrationDefaults.reg_country + f79_local0.reg_zipcode = RegistrationDefaults.reg_zipcode + f79_local0.reg_dob_month = RegistrationDefaults.reg_dob_month + f79_local0.reg_dob_day = RegistrationDefaults.reg_dob_day + f79_local0.reg_dob_year = RegistrationDefaults.reg_dob_year + f79_local0.reg_community_name = RegistrationDefaults.reg_community_name + f79_local0.reg_email = RegistrationDefaults.reg_email + f79_local0.reg_password = RegistrationDefaults.reg_password + f79_local0.reg_password_confirm = RegistrationDefaults.reg_password_confirm + f79_local0.reg_subscribe = RegistrationDefaults.reg_subscribe + f79_local0.controller = f79_arg1.controller + f79_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +local f0_local4 = { + reg_firstname = "", + reg_lastname = "", + reg_country = 1, + reg_zipcode = "", + reg_dob_month = 1, + reg_dob_day = 1, + reg_dob_year = 2000, + reg_community_name = "", + reg_email = "", + reg_password = "", + reg_password_confirm = "", + reg_subscribe = 1, + is_leap_year = true, + min_year = 1900, + max_year = Engine.GetCurrentYear(), + country_list = { + { + display_string = "@LUA_MENU_CODA_COUNTRY_US", + code = "US" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_AU", + code = "AU" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_AT", + code = "AT" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_BE", + code = "BE" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_BR", + code = "BR" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_CA", + code = "CA" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_CZ", + code = "CZ" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_DK", + code = "DK" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_FI", + code = "FI" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_FR", + code = "FR" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_DE", + code = "DE" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_GR", + code = "GR" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_HU", + code = "HU" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_IE", + code = "IE" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_IT", + code = "IT" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_MX", + code = "MX" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_NL", + code = "NL" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_NZ", + code = "NZ" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_NO", + code = "NO" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_PL", + code = "PL" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_PT", + code = "PT" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_RU", + code = "RU" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_ES", + code = "ES" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_SE", + code = "SE" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_CH", + code = "CH" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_GB", + code = "GB" + }, + { + display_string = "@LUA_MENU_CODA_COUNTRY_JP", + code = "JP" + } + }, + month_list = { + "@LUA_MENU_CODA_REGISTER_MONTH_1", + "@LUA_MENU_CODA_REGISTER_MONTH_2", + "@LUA_MENU_CODA_REGISTER_MONTH_3", + "@LUA_MENU_CODA_REGISTER_MONTH_4", + "@LUA_MENU_CODA_REGISTER_MONTH_5", + "@LUA_MENU_CODA_REGISTER_MONTH_6", + "@LUA_MENU_CODA_REGISTER_MONTH_7", + "@LUA_MENU_CODA_REGISTER_MONTH_8", + "@LUA_MENU_CODA_REGISTER_MONTH_9", + "@LUA_MENU_CODA_REGISTER_MONTH_10", + "@LUA_MENU_CODA_REGISTER_MONTH_11", + "@LUA_MENU_CODA_REGISTER_MONTH_12" + }, + month_days = { + 31, + 28, + 31, + 30, + 31, + 30, + 31, + 31, + 30, + 31, + 30, + 31 + } +} +local f0_local5 = {} +local f0_local6 = Engine.Localize( "LUA_MENU_YES" ) +local f0_local7 = Engine.Localize( "LUA_MENU_NO" ) +f0_local4.subscribe_list = f0_local6 +RegistrationDefaults = f0_local4 +DefaultButtonStates = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 800, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } +} +DefaultDoBButtonStates = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 780, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } +} +ButtonDefaults = { + content_width = 400, + content_margin = 56, + text_padding_with_content = 475 +} +function DefaultIconState() + return { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + left = -52, + right = -20, + top = 0, + bottom = -5, + material = RegisterMaterial( "icon_new" ), + alpha = 0 + }, + show = { + alpha = 1 + } + } +end + +DefaultIconHandlers = { + show_problem_icon = function ( f81_arg0, f81_arg1, f81_arg2 ) + if f81_arg1.id == f81_arg0.id then + f81_arg0:animateToState( "show", 0 ) + end + end, + hide_problem_icon = function ( f82_arg0, f82_arg1, f82_arg2 ) + if f82_arg1.id == f82_arg0.id then + f82_arg0:animateToState( "default", 0 ) + end + end +} +function PlatformSpecificConfirmIcon( f83_arg0, f83_arg1 ) + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then + return Engine.Localize( ButtonMap.button_alt1.string ) .. " " .. Engine.Localize( "@LUA_MENU_CODA_REGISTER_CONFIRM" ) + else + return Engine.Localize( ButtonMap.button_alt1.keyboard_string ) .. " " .. Engine.Localize( "@LUA_MENU_CODA_REGISTER_CONFIRM" ) + end +end + +function OpenCoDAnywhereErrorPopup( f84_arg0, f84_arg1 ) + LUI.FlowManager.RequestPopupMenu( f84_arg0, "cod_anywhere_error_popup_menu", true, f84_arg1.controller ) +end + +function OpenCoDAnywhereSuccessPopup( f85_arg0, f85_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f85_arg0 ) + f85_arg0:dispatchEventToRoot( { + name = "cod_anywhere_success_exit", + id = "coda_registration" + } ) + LUI.FlowManager.RequestPopupMenu( f85_arg0, "cod_anywhere_success_popup_menu", true, f85_arg1.controller ) +end + +function LeaveCoDAnywhereMenu( f86_arg0, f86_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f86_arg0 ) +end + +function cod_anywhere_registration_menu() + return { + type = "UIElement", + id = "coda_registration", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = {}, + handlers = { + menu_create = coda_menu_setup, + open_cod_anywhere_error_popup = OpenCoDAnywhereErrorPopup, + open_cod_anywhere_success_popup = OpenCoDAnywhereSuccessPopup, + cod_anywhere_start_registration = RegisterConfirm, + cod_anywhere_success_exit = MBh.LeaveMenu(), + leave_platform_screen = LeaveCoDAnywhereMenu + }, + children = { + { + type = "UIImage", + id = "coda_registration_background_img", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + top = 0, + right = 0, + bottom = 0, + material = RegisterMaterial( "bkgd_cas" ) + } + } + }, + { + type = "generic_menu_title", + id = "coda_registration_title_text_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_CODA_REGISTER_TITLE" ) + } + }, + { + type = "UIVerticalList", + id = "coda_registration_vlist_id", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom_tall + } + }, + childrenFeeder = RegistrationOptionsFeeder + }, + { + type = "generic_menu_background", + id = "coda_registration_desc_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 115, + bottom = 634, + left = -430, + right = -75 + } + }, + properties = { + top_offset = 0 + }, + children = { + { + type = "UIText", + id = "coda_registration_desc_text_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + left = 15, + right = -15, + top = 15, + bottom = CoD.TextSettings.NormalFont.Height + 15, + red = 1, + green = 1, + blue = 1 + } + }, + properties = { + text = "" + }, + handlers = { + set_button_info_text = function ( f88_arg0, f88_arg1 ) + if f88_arg1.text then + f88_arg0:setText( f88_arg1.text ) + end + end + + } + }, + { + type = "UIText", + id = "coda_registration_ratings_text_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + left = 15, + right = -15, + top = -170, + bottom = -170 + CoD.TextSettings.NormalFont.Height, + alpha = 0.4 + } + }, + properties = { + text = Engine.Localize( "@LUA_MENU_CODA_REGISTER_RATINGS" ) + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -35, + bottom = 0, + material = RegisterMaterial( "white" ), + red = 0.22, + green = 0.22, + blue = 0.22, + alpha = 0 + }, + show = { + alpha = 1 + } + }, + handlers = { + show_confirm_button = function ( f89_arg0, f89_arg1 ) + f89_arg0:animateToState( "show", 0 ) + end + , + hide_confirm_button = function ( f90_arg0, f90_arg1 ) + f90_arg0:animateToState( "default", 0 ) + end + + }, + children = { + { + type = "UIBindButton", + id = "coda_registration_confirm button", + handlers = { + button_alt1 = ContinueRegister + } + }, + { + type = "UIText", + id = "coda_registration_confirm_text_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + left = 5, + right = -5, + top = 3, + bottom = CoD.TextSettings.NormalFont.Height + 10, + alpha = 1 + } + }, + properties = { + text = PlatformSpecificConfirmIcon() + } + } + } + } + } + }, + { + type = "button_helper_text_main", + id = "coda_registration_text_id" + }, + { + type = "UIBindButton", + id = "coda_registration_bind_buttons_id", + handlers = { + button_secondary = function ( f91_arg0, f91_arg1 ) + if Engine.HasSpeechFeature() and LUI.MenuAutoNav.IsRunning() then + LUI.FlowManager.RequestLeaveMenu( f91_arg0 ) + else + LUI.FlowManager.RequestPopupMenu( f91_arg0, "cod_anywhere_quit_confirm_popup", false, f91_arg1.controller, false ) + end + end + + } + } + } + } +end + +function cod_anywhere_entry_error_popup() + return { + type = "generic_confirmation_popup", + id = "cod_anywhere_entry_error_popup", + properties = { + cancel_will_close = false, + popup_title = "", + message_text = "", + button_text = "" + } + } +end + +LUI.MenuBuilder.registerDef( "cod_anywhere_intro_popup", cod_anywhere_intro_popup ) +LUI.MenuBuilder.registerDef( "cod_anywhere_registration_menu", cod_anywhere_registration_menu ) +LUI.MenuBuilder.registerDef( "cod_anywhere_entry_error_popup", cod_anywhere_entry_error_popup ) +LUI.MenuBuilder.registerDef( "cod_anywhere_import_popup", cod_anywhere_import_popup ) +LUI.MenuBuilder.registerDef( "cod_anywhere_email_confirm_popup", cod_anywhere_email_confirm_popup ) +LUI.MenuBuilder.registerDef( "cod_anywhere_agreement_popup", cod_anywhere_agreement_popup ) +LUI.MenuBuilder.registerDef( "cod_anywhere_quit_confirm_popup", cod_anywhere_quit_confirm_popup ) +LUI.MenuBuilder.registerDef( "cod_anywhere_sign_in_popup", cod_anywhere_sign_in_popup ) +LUI.MenuBuilder.registerDef( "codanywhere_age_error_popup", codanywhere_age_error_popup ) +LockTable( _M ) diff --git a/lui/mp_menus/mpcustomclassrestrictions.dec.lua b/lui/mp_menus/mpcustomclassrestrictions.dec.lua new file mode 100644 index 0000000..3aea9a9 --- /dev/null +++ b/lui/mp_menus/mpcustomclassrestrictions.dec.lua @@ -0,0 +1,607 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function () + return 0 +end + +f0_local1 = function () + return 200 +end + +f0_local2 = function () + return 0 +end + +local f0_local3 = function () + return 0 +end + +function ToggleRestrictionsStates( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0:getParent() + local f5_local1 = f5_local0:getFirstDescendentById( "cac_edit_type_" .. f5_arg1 ) + if f5_local1 then + f5_local1:processEvent( { + name = f5_local1.restricted and "allow" or "restrict" + } ) + end + return f5_local1 +end + +function RestrictionsChanged( f6_arg0, f6_arg1, f6_arg2, f6_arg3 ) + local f6_local0 = f6_arg0:getRootParent() + local f6_local1 = f6_local0:getFirstDescendentById( "menu_custom_class_restrictions_root" ) + if f6_arg2 then + f6_local1:dispatchEventToRoot( { + name = "menu_refresh", + controller = f6_arg1.controller, + dispatchChildren = true, + immediate = true + } ) + end + if f6_arg3 then + f6_local1:dispatchEventToRoot( { + name = "content_refresh", + type = f6_arg1.contentRefreshType, + controller = f6_arg1.controller, + dispatchChildren = true, + immediate = true + } ) + end +end + +function ToggleTypeRestricted( f7_arg0, f7_arg1 ) + if not MLG.AreMLGRulesEnabled() then + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + local f7_local1 = f7_arg0.properties.itemType + if Cac.PerformMatchRuleToggle( "commonOption", f7_local0.restrictedMatchRule, f7_local1 ) and ToggleRestrictionsStates( f7_arg0, f7_local1 ) then + f7_arg1.contentRefreshType = f7_local0.contentRefreshType + RestrictionsChanged( f7_arg0, f7_arg1, false, true ) + if f7_local0.extraContentRefreshType then + f7_arg1.contentRefreshType = f7_local0.extraContentRefreshType + RestrictionsChanged( f7_arg0, f7_arg1, false, true ) + end + end + end +end + +function CustomClassDisableCheck( f8_arg0 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + local f8_local1, f8_local2, f8_local3 = Cac.SafeGetMatchRule( "commonOption", f8_local0.restrictedMatchRule, f8_arg0.properties.itemType ) + local f8_local4 = f8_local1 and f8_local2 + f8_arg0:processEvent( { + name = "set_checked", + checkBox = f8_local4 + } ) + local f8_local5 = f8_arg0 + local f8_local6 = f8_arg0.processEvent + local f8_local7 = {} + local f8_local8 + if f8_local4 then + f8_local8 = "restrict" + if not f8_local8 then + + else + f8_local7.name = f8_local8 + f8_local6( f8_local5, f8_local7 ) + if f8_local3 then + f8_arg0.properties.button_text = f8_arg0.properties.button_text .. f8_local3 + end + end + end + f8_local8 = "allow" +end + +function ToggleClassRestricted( f9_arg0, f9_arg1 ) + if not MLG.AreMLGRulesEnabled() then + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 ) + local f9_local1 = f9_arg1.itemType + local f9_local2, f9_local3, f9_local4 = Cac.SafeGetMatchRule( "commonOption", f9_local0.restrictedMatchRule, f9_local1 ) + if f9_local2 then + local f9_local5 = f9_arg0:getParent() + local f9_local6 = f9_local5:getFirstDescendentById( "cac_edit_type_" .. f9_local1 ) + if f9_local6 then + MatchRules.SetData( "commonOption", f9_local0.restrictedMatchRule, f9_local1, not f9_local6.restricted ) + f9_local6:processEvent( { + name = "set_checked", + checkBox = not f9_local6.restricted + } ) + f9_local6:processEvent( { + name = f9_local6.restricted and "allow" or "restrict" + } ) + f9_arg1.contentRefreshType = f9_local0.contentRefreshType + RestrictionsChanged( f9_arg0, f9_arg1, false, true ) + if f9_local0.extraContentRefreshType then + f9_arg1.contentRefreshType = f9_local0.extraContentRefreshType + RestrictionsChanged( f9_arg0, f9_arg1, false, true ) + end + end + end + else + Engine.PlaySound( CoD.SFX.DenySelect ) + end +end + +function GetWeaponClassData( f10_arg0 ) + local f10_local0 = { + overrideAltButtonPressed = ToggleClassRestricted, + itemIndex = f10_arg0, + restrictedMatchRule = "weaponClassRestricted", + checkRestriction = Cac.CheckWeaponTypeRestrictions, + contentRefreshType = "weapon_restrictions_changed", + customTop = f0_local0(), + customLeft = f0_local1(), + customRight = f0_local2(), + customBottom = f0_local3() + } + local f10_local1 + if f10_arg0 == Cac.Indices.Weapons.Primary then + f10_local1 = Engine.Localize( "@MPUI_PRIMARY_WEAPON_CAPS" ) + if not f10_local1 then + + else + f10_local0.titleBarText = f10_local1 + f10_local0.buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetWeaponCategoryName, ClassRestrictionsChooseWeaponTypeAction, Cac.GetWeaponTypes( f10_arg0 == Cac.Indices.Weapons.Primary ), nil, Cac.GetItemClassDescriptions, CustomClassDisableCheck, nil, nil, nil, "menu_custom_class_restrictions" ) + return f10_local0 + end + end + f10_local1 = Engine.Localize( "@MPUI_SECONDARY_WEAPON_CAPS" ) +end + +function ClassRestrictionsChooseWeaponTypeAction( f11_arg0, f11_arg1 ) + local f11_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f11_arg0 ) + local f11_local1 = GetWeaponClassData( f11_local0.itemIndex ) + f11_local1.menu = "cac_edit_popup_main" + local f11_local2 = LUI.FlowManager.GetMenuScopedDataByMenuName( "menu_custom_class_restrictions" ) + if f11_local2.defaultFocus and type( f11_local2.defaultFocus ) == "table" then + f11_local2.defaultFocus[#f11_local2.defaultFocus + 1] = f11_arg0.properties.itemType + end + LUI.FlowManager.RequestPopupMenu( f11_arg0, "cac_edit_popup_main_second", true, f11_arg1.controller, true, { + itemIndex = f11_local0.itemIndex, + restrictedMatchRule = "weaponRestricted", + contentRefreshType = "weapon_restrictions_changed", + customTop = f0_local0(), + customLeft = f0_local1(), + customRight = f0_local2(), + customBottom = f0_local3(), + titleBarText = Cac.GetWeaponCategoryNameCaps( f11_arg0.properties.itemType ), + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetWeaponName, ToggleTypeRestricted, Cac.GetWeaponListReleased( f11_arg0.properties.itemType ), nil, Cac.GetWeaponDesc, CustomClassDisableCheck, nil, nil, nil, "menu_custom_class_restrictions", MLG.AreMLGRulesEnabled ), + editPopupOpenMenuOnClose = f11_local1 + } ) +end + +function PrimaryButtonAction( f12_arg0, f12_arg1 ) + LUI.FlowManager.RequestPopupMenu( f12_arg0, "cac_edit_popup_main", true, f12_arg1.controller, false, GetWeaponClassData( 0 ) ) +end + +function SecondaryButtonAction( f13_arg0, f13_arg1 ) + LUI.FlowManager.RequestPopupMenu( f13_arg0, "cac_edit_popup_main", true, f13_arg1.controller, false, GetWeaponClassData( 1 ) ) +end + +function GetAttachmentClassData() + return { + overrideAltButtonPressed = ToggleClassRestricted, + restrictedMatchRule = "attachmentClassRestricted", + checkRestriction = Cac.CheckAttachmentTypeRestrictions, + contentRefreshType = "attachment_restrictions_changed", + customTop = f0_local0(), + customLeft = f0_local1(), + customRight = f0_local2(), + customBottom = f0_local3(), + titleBarText = Engine.Localize( "@MENU_ATTACHMENTS_CAPS" ), + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetAttachmentTypeName, ChooseAttachmentsClassButtonAction, Cac.AttachmentTypes.Types, nil, Cac.GetAttachmentTypeDesc, CustomClassDisableCheck, nil, nil, nil, "menu_custom_class_restrictions" ) + } +end + +function ChooseAttachmentsClassButtonAction( f15_arg0, f15_arg1 ) + local f15_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f15_arg0 ) + local f15_local1 = GetAttachmentClassData() + f15_local1.menu = "cac_edit_popup_main" + local f15_local2 = LUI.FlowManager.GetMenuScopedDataByMenuName( "menu_custom_class_restrictions" ) + if f15_local2.defaultFocus and type( f15_local2.defaultFocus ) == "table" then + f15_local2.defaultFocus[#f15_local2.defaultFocus + 1] = f15_arg0.properties.itemType + end + LUI.FlowManager.RequestPopupMenu( f15_arg0, "cac_edit_popup_main_second", true, f15_arg1.controller, true, { + ChooseAttachAction = ToggleAttachmentRestricted, + AttachDisableCheck = AttachmentDisableCheck, + restrictedMatchRule = "attachmentRestricted", + contentRefreshType = "attachment_restrictions_changed", + customTop = f0_local0(), + customLeft = f0_local1(), + customRight = f0_local2(), + customBottom = f0_local3(), + titleBarText = Cac.GetAttachmentTypeNameCaps( f15_arg0.properties.itemType ), + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetAttachmentName, ToggleTypeRestricted, Cac.GetSimpleAttachmentList( f15_arg0.properties.itemType ), nil, Cac.GetAttachmentDesc, CustomClassDisableCheck, nil, nil, nil, "menu_custom_class_restrictions", MLG.AreMLGRulesEnabled ), + editPopupOpenMenuOnClose = f15_local1 + } ) +end + +function AttachmentsButtonAction( f16_arg0, f16_arg1 ) + LUI.FlowManager.RequestPopupMenu( f16_arg0, "cac_edit_popup_main", true, f16_arg1.controller, false, GetAttachmentClassData() ) +end + +function LethalButtonAction( f17_arg0, f17_arg1 ) + LUI.FlowManager.RequestPopupMenu( f17_arg0, "cac_edit_popup_main", true, f17_arg1.controller, false, { + itemIndex = 0, + restrictedMatchRule = "perkRestricted", + contentRefreshType = "grenade_restrictions_changed", + customTop = f0_local0(), + customLeft = f0_local1(), + customRight = f0_local2(), + customBottom = f0_local3(), + titleBarText = Engine.Localize( "@MENU_LETHAL_CAPS" ), + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetPerkName, ToggleTypeRestricted, Cac.GetGrenadeListNoNone( 0 ), nil, Cac.GetGrenadeDesc, CustomClassDisableCheck, nil, nil, nil, "menu_custom_class_restrictions", MLG.AreMLGRulesEnabled ) + } ) +end + +function TacticalButtonAction( f18_arg0, f18_arg1 ) + LUI.FlowManager.RequestPopupMenu( f18_arg0, "cac_edit_popup_main", true, f18_arg1.controller, false, { + itemIndex = 1, + restrictedMatchRule = "perkRestricted", + contentRefreshType = "grenade_restrictions_changed", + customTop = f0_local0(), + customLeft = f0_local1(), + customRight = f0_local2(), + customBottom = f0_local3(), + titleBarText = Engine.Localize( "@LUA_MENU_TACTICAL_CAPS" ), + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetPerkName, ToggleTypeRestricted, Cac.GetGrenadeListNoNone( 1 ), nil, Cac.GetGrenadeDesc, CustomClassDisableCheck, nil, nil, nil, "menu_custom_class_restrictions", MLG.AreMLGRulesEnabled ) + } ) +end + +function GetStrikePackageClassData() + return { + overrideAltButtonPressed = ToggleClassRestricted, + restrictedMatchRule = "killstreakClassRestricted", + checkRestriction = Cac.CheckKillstreakTypeRestrictions, + contentRefreshType = "killstreak_restrictions_changed", + customTop = f0_local0(), + customLeft = f0_local1(), + customRight = f0_local2(), + customBottom = f0_local3(), + titleBarText = Engine.Localize( "@LUA_MENU_STREAK_TYPE_CAPS" ), + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetPerkName, ClassRestrictionsChooseStrikePackageTypeAction, Cac.StreakTypes, nil, Cac.GetItemClassDescriptions, CustomClassDisableCheck, nil, nil, nil, "menu_custom_class_restrictions" ) + } +end + +function ClassRestrictionsChooseStrikePackageTypeAction( f20_arg0, f20_arg1 ) + local f20_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "menu_custom_class_restrictions" ) + if f20_local0.defaultFocus and type( f20_local0.defaultFocus ) == "table" then + f20_local0.defaultFocus[#f20_local0.defaultFocus + 1] = f20_arg0.properties.itemType + end + if f20_arg0.properties.itemType == "streaktype_specialist" then + f20_arg1.specialist = true + PerkButtonAction( f20_arg0, f20_arg1 ) + else + local f20_local1 = GetStrikePackageClassData() + f20_local1.menu = "cac_edit_popup_main" + LUI.FlowManager.RequestPopupMenu( f20_arg0, "cac_edit_popup_main_second", true, f20_arg1.controller, true, { + restrictedMatchRule = "killstreakRestricted", + contentRefreshType = "killstreak_restrictions_changed", + customTop = f0_local0(), + customLeft = f0_local1(), + customRight = f0_local2(), + customBottom = f0_local3(), + titleBarText = Cac.GetStreakTypeCaps( f20_arg0.properties.itemType ), + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetStreakName, ToggleTypeRestricted, Cac.GetStreakList( f20_arg0.properties.itemType ), nil, Cac.GetKillstreakDesc, CustomClassDisableCheck, nil, nil, nil, "menu_custom_class_restrictions", MLG.AreMLGRulesEnabled ), + editPopupOpenMenuOnClose = f20_local1 + } ) + end +end + +function StrikePackageButtonAction( f21_arg0, f21_arg1 ) + LUI.FlowManager.RequestPopupMenu( f21_arg0, "cac_edit_popup_main", true, f21_arg1.controller, false, GetStrikePackageClassData() ) +end + +function GetPerkClassData( f22_arg0 ) + local f22_local0 = GetStrikePackageClassData() + f22_local0.menu = "cac_edit_popup_main" + return { + overrideAltButtonPressed = ToggleClassRestricted, + restrictedMatchRule = "perkClassRestricted", + checkRestriction = Cac.CheckPerkTypeRestrictions, + contentRefreshType = "perk_restrictions_changed", + extraContentRefreshType = "killstreak_restrictions_changed", + customTop = f0_local0(), + customLeft = f0_local1(), + customRight = f0_local2(), + customBottom = f0_local3(), + specialist = f22_arg0, + titleBarText = Engine.Localize( "@MENU_ABILITIES_CAPS" ), + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetPerkTypeNames, ChoosePerkGroupAction, Cac.PerkTypes.Refs, nil, Cac.GetPerkTypeDescription, CustomClassDisableCheck, nil, nil, nil, "menu_custom_class_restrictions" ), + editPopupOpenMenuOnClose = f22_arg0 and f22_local0 + } +end + +function ChoosePerkGroupAction( f23_arg0, f23_arg1 ) + local f23_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f23_arg0 ) + local f23_local1 = GetPerkClassData( f23_local0.specialist ) + f23_local1.menu = "cac_edit_popup_main_second" + local f23_local2 = LUI.FlowManager.GetMenuScopedDataByMenuName( "menu_custom_class_restrictions" ) + if f23_local2.defaultFocus and type( f23_local2.defaultFocus ) == "table" then + f23_local2.defaultFocus[#f23_local2.defaultFocus + 1] = f23_arg0.properties.itemType + end + LUI.FlowManager.RequestPopupMenu( f23_arg0, "cac_edit_popup_main", true, f23_arg1.controller, true, { + restrictedMatchRule = "perkRestricted", + contentRefreshType = "perk_restrictions_changed", + extraContentRefreshType = "killstreak_restrictions_changed", + customTop = f0_local0(), + customLeft = f0_local1(), + customRight = f0_local2(), + customBottom = f0_local3(), + titleBarText = Cac.GetAbilityName( f23_arg0.properties.itemType ), + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetPerkName, ToggleTypeRestricted, Cac.GetPerkList( f23_arg0.properties.itemType ), nil, Cac.GetPerkDesc, CustomClassDisableCheck, nil, nil, nil, "menu_custom_class_restrictions", MLG.AreMLGRulesEnabled ), + editPopupOpenMenuOnClose = f23_local1 + } ) +end + +function PerkButtonAction( f24_arg0, f24_arg1 ) + LUI.FlowManager.RequestPopupMenu( f24_arg0, "cac_edit_popup_main_second", true, f24_arg1.controller, f24_arg1.specialist, GetPerkClassData( f24_arg1.specialist ) ) +end + +function GetCheckRestrictionResultString( f25_arg0 ) + if f25_arg0 == nil then + return nil + elseif f25_arg0 then + return Engine.Localize( "@MENU_CUSTOM" ) + else + return Engine.Localize( "@MENU_ALL" ) + end +end + +function CheckPrimaryRestrictions( f26_arg0, f26_arg1 ) + local f26_local0 = nil + if f26_arg1 and (f26_arg1.name == "menu_create" or f26_arg1.type == "weapon_restrictions_changed") then + f26_local0 = Cac.CheckWeaponRestrictions( "Primary", f26_arg1.controller ) + end + return GetCheckRestrictionResultString( f26_local0 ) +end + +function CheckSecondaryRestrictions( f27_arg0, f27_arg1 ) + local f27_local0 = nil + if f27_arg1 and (f27_arg1.name == "menu_create" or f27_arg1.type == "weapon_restrictions_changed") then + f27_local0 = Cac.CheckWeaponRestrictions( "Secondary", f27_arg1.controller ) + end + return GetCheckRestrictionResultString( f27_local0 ) +end + +function CheckAttachmentRestrictions( f28_arg0, f28_arg1 ) + local f28_local0 = nil + if f28_arg1 and (f28_arg1.name == "menu_create" or f28_arg1.type == "attachment_restrictions_changed") then + f28_local0 = Cac.CheckAttachmentRestrictionsHelper() + end + return GetCheckRestrictionResultString( f28_local0 ) +end + +function CheckLethalRestrictions( f29_arg0, f29_arg1 ) + local f29_local0 = nil + if f29_arg1 and (f29_arg1.name == "menu_create" or f29_arg1.type == "grenade_restrictions_changed") then + f29_local0 = Cac.CheckGrenadeRestrictions( 0 ) + end + return GetCheckRestrictionResultString( f29_local0 ) +end + +function CheckTacticalRestrictions( f30_arg0, f30_arg1 ) + local f30_local0 = nil + if f30_arg1 and (f30_arg1.name == "menu_create" or f30_arg1.type == "grenade_restrictions_changed") then + f30_local0 = Cac.CheckGrenadeRestrictions( 1 ) + end + return GetCheckRestrictionResultString( f30_local0 ) +end + +function CheckStrikePackageRestrictions( f31_arg0, f31_arg1 ) + local f31_local0 = nil + if f31_arg1 and (f31_arg1.name == "menu_create" or f31_arg1.type == "killstreak_restrictions_changed") then + f31_local0 = Cac.CheckKillstreakRestrictions() + end + return GetCheckRestrictionResultString( f31_local0 ) +end + +function CheckPerkRestrictions( f32_arg0, f32_arg1 ) + local f32_local0 = nil + if f32_arg1 and (f32_arg1.name == "menu_create" or f32_arg1.type == "perk_restrictions_changed") then + f32_local0 = Cac.CheckPerkRestrictions() + end + return GetCheckRestrictionResultString( f32_local0 ) +end + +function MenuCustomClassRestrictionsFeeder( f33_arg0 ) + local f33_local0 = nil + return { + { + type = "UIGenericButton", + id = "restrictions_primary_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_PRIMARY_CAPS" ), + button_display_func = CheckPrimaryRestrictions, + button_action_func = PrimaryButtonAction, + button_text_alignment = LUI.Alignment.Right, + desc_text = nil, + button_over_func = nil, + button_over_disable_func = nil + } + }, + { + type = "UIGenericButton", + id = "restrictions_secondary_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_SECONDARY_CAPS" ), + button_display_func = CheckSecondaryRestrictions, + button_action_func = SecondaryButtonAction, + button_text_alignment = LUI.Alignment.Right, + desc_text = nil, + button_over_func = nil, + button_over_disable_func = nil + } + }, + { + type = "UIGenericButton", + id = "restrictions_attachments_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_ATTACHMENTS_CAPS" ), + button_display_func = CheckAttachmentRestrictions, + button_action_func = AttachmentsButtonAction, + button_text_alignment = LUI.Alignment.Right, + desc_text = nil, + button_over_func = nil, + button_over_disable_func = nil + } + }, + { + type = "UIGenericButton", + id = "restrictions_lethal_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_EQUIPMENT_CAPS" ), + button_display_func = CheckLethalRestrictions, + button_action_func = LethalButtonAction, + button_text_alignment = LUI.Alignment.Right, + desc_text = nil, + button_over_func = nil, + button_over_disable_func = nil + } + }, + { + type = "UIGenericButton", + id = "restrictions_tactical_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_SPECIAL_EQUIPMENT_CAPS" ), + button_display_func = CheckTacticalRestrictions, + button_action_func = TacticalButtonAction, + button_text_alignment = LUI.Alignment.Right, + desc_text = nil, + button_over_func = nil, + button_over_disable_func = nil + } + }, + { + type = "UIGenericButton", + id = "restrictions_strikepackage_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_STREAK_TYPE_CAPS" ), + button_display_func = CheckStrikePackageRestrictions, + button_action_func = StrikePackageButtonAction, + button_text_alignment = LUI.Alignment.Right, + desc_text = nil, + button_over_func = nil, + button_over_disable_func = nil + } + }, + { + type = "UIGenericButton", + id = "restrictions_abilities_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_ABILITIES_CAPS" ), + button_display_func = CheckPerkRestrictions, + button_action_func = PerkButtonAction, + button_text_alignment = LUI.Alignment.Right + } + } + } +end + +local f0_local4 = function ( f34_arg0, f34_arg1 ) + f34_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) +end + +function menu_custom_class_restrictions() + return { + type = "UIElement", + id = "menu_custom_class_restrictions_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = { + additional_handlers = { + primary_button_refresh = PrimaryButtonRefresh + } + }, + handlers = { + menu_create = f0_local4 + }, + children = { + { + type = "UIImage", + id = "menu_custom_class_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "bkgd_cas" ), + alpha = 0.8 + } + } + }, + { + type = "generic_menu_title", + id = "menu_custom_class_restrictions_title_text_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_RULES_CLASS_RESTRICT_SHORT" ) + } + }, + { + type = "menu_custom_class_restrictions_options_vlist", + id = "menu_custom_class_restrictions_options_id", + childrenFeeder = MenuCustomClassRestrictionsFeeder + }, + { + type = "generic_back_button" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + } + } + } +end + +function menu_custom_class_restrictions_options_vlist() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + } + } +end + +LUI.MenuBuilder.registerDef( "menu_custom_class_restrictions", menu_custom_class_restrictions ) +LUI.MenuBuilder.registerDef( "menu_custom_class_restrictions_options_vlist", menu_custom_class_restrictions_options_vlist ) +LockTable( _M ) diff --git a/lui/mp_menus/mpgamemodeselectmenu.dec.lua b/lui/mp_menus/mpgamemodeselectmenu.dec.lua new file mode 100644 index 0000000..d7dc9cf --- /dev/null +++ b/lui/mp_menus/mpgamemodeselectmenu.dec.lua @@ -0,0 +1,571 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GameModeChooseAction( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + if f1_local0.squadBaseSelect then + Engine.SetPlayerDataEx( f1_local0.exclusiveControllerIndex, CoD.StatsGroup.Ranked, "squadHQ", "squad_mode", f1_arg0.properties.gameType ) + else + local f1_local1 = MatchRules.GetData( "gametype" ) + if f1_local1 then + FixTeamLimitsAndDifficultiesIfNecessary( f1_local1, f1_arg0.properties.gameType ) + end + MatchRules.SetData( "gametype", f1_arg0.properties.gameType ) + if MLG.AreMLGRulesEnabled() then + MLG.LoadMatchRulesData() + else + MatchRules.LoadMatchRulesDataDefault() + end + if Engine.GetDvarBool( "splitscreen" ) == 1 then + Engine.ExecNow( MPConfig.default_splitscreen, f1_arg1.controller ) + end + if Engine.GetDvarBool( "systemlink" ) == 1 then + Engine.ExecNow( MPConfig.default_systemlink, f1_arg1.controller ) + end + if Engine.GetDvarBool( "xblive_privatematch" ) == 1 then + Engine.ExecNow( MPConfig.default_xboxlive, f1_arg1.controller ) + end + if Engine.GetDvarBool( "xblive_privatematch" ) == true and not Engine.IsAliensMode() then + local f1_local2 = Engine.GetDvarInt( "party_maxPrivatePartyPlayers" ) + if f1_arg0.properties.gameType == "horde" then + f1_local2 = CoD.MaxSafeguardPlayers + end + if f1_local2 ~= Engine.GetDvarInt( "party_maxplayers" ) then + Engine.SetDvarInt( "party_maxplayers", f1_local2 ) + Engine.Exec( "xtogprivateslots; xtogprivateslots; xsessionupdate;" ) + end + end + end + GameModeSelectMenuClose( f1_arg0, f1_arg1 ) + if f1_local0.squadBaseSelect then + LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) + else + LUI.FlowManager.RequestRestoreMenu( f1_arg0, "gamesetup_menu_main", true, f1_arg1.controller, true ) + end + if SvS.IsSvS() then + MatchRules.SetData( "commonOption", "allowCustomClasses", false ) + end +end + +function ShouldHordeBeDisabled() + if Engine.GetDvarBool( "xblive_privatematch" ) == true then + local f2_local0 = Lobby.GetMemberCount( Lobby.MemberListStates.Lobby ) + assert( f2_local0 > 0 ) + return f2_local0 > CoD.MaxSafeguardPlayers + else + + end +end + +function UpdateHordeButtonDisabled( f3_arg0, f3_arg1 ) + local f3_local0 = ShouldHordeBeDisabled() + if f3_local0 ~= f3_arg0.disabled then + local f3_local1 = f3_arg0 + local f3_local2 = f3_arg0.processEvent + local f3_local3 = {} + local f3_local4 + if f3_local0 then + f3_local4 = "disable" + if not f3_local4 then + + else + f3_local3.name = f3_local4 + f3_local2( f3_local1, f3_local3 ) + end + end + f3_local4 = "enable" + end +end + +function HordeButtonFeeder( f4_arg0 ) + local f4_local0 = { + [#f4_local0 + 1] = { + type = "UITimer", + id = "horde_button_refresh_timer", + properties = { + event = "mode_button_disabled", + interval = 100, + disposable = false, + broadcastToRoot = false + } + } + } + return f4_local0 +end + +function EmitGameModeSelectionUpdate( f5_arg0, f5_arg1 ) + f5_arg0:dispatchEventToRoot( { + name = "gamemode_selection_update", + gameType = f5_arg0.properties.gameType, + dispatchChildren = true, + immediate = true, + disabled = f5_arg0.disabled + } ) +end + +function GameModeSelectFeeder( f6_arg0 ) + local f6_local0 = Cac.GetGameModeList( f6_arg0.requestedGameMode ) + local f6_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "settings_recipe_choosetype" ) + local f6_local2 = {} + for f6_local11, f6_local12 in ipairs( f6_local0 ) do + local f6_local6 = false + local f6_local7 = true + local f6_local8, f6_local9, f6_local10 = nil + if f6_local1.squadBaseSelect then + f6_local6 = f6_local12 == Engine.GetPlayerDataEx( f6_local1.exclusiveControllerIndex, CoD.StatsGroup.Ranked, "squadHQ", "squad_mode" ) + f6_local7 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f6_local12, GameTypesTable.Cols.Squads ) == "1" + else + if f6_local1.teamsOnly then + f6_local7 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f6_local12, GameTypesTable.Cols.TeamChoice ) == "1" + end + if f6_local12 == Engine.GetDvarString( "ui_gametype" ) then + f6_local6 = true + end + if f6_local12 == "horde" and Engine.GetDvarBool( "xblive_privatematch" ) == true then + f6_local8 = HordeButtonFeeder + f6_local9 = UpdateHordeButtonDisabled + f6_local10 = ShouldHordeBeDisabled + end + end + if f6_local7 then + f6_local2[#f6_local2 + 1] = { + type = "UIGenericButton", + id = "gameMode_" .. f6_local12, + listDefaultFocus = f6_local6, + disabled = f6_local10 and f6_local10(), + properties = { + button_text = Engine.Localize( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f6_local12, GameTypesTable.Cols.Name ) .. "_CAPS" ), + gameType = f6_local12, + button_over_func = EmitGameModeSelectionUpdate, + button_over_disable_func = EmitGameModeSelectionUpdate, + additional_handlers = { + button_action = GameModeChooseAction + } + }, + handlers = { + mode_button_disabled = f6_local9 + }, + childrenFeeder = f6_local8 + } + end + end + return f6_local2 +end + +function GameModeSelectMenuCreate( f7_arg0, f7_arg1 ) + f7_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function GameModeSelectMenuClose( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + if not f8_local0.squadBaseSelect then + Engine.ExecNow( "xupdatepartystate" ) + end +end + +function UpdateGamemodeIcon( f9_arg0, f9_arg1 ) + f9_arg0:setImage( RegisterMaterial( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f9_arg1.gameType, GameTypesTable.Cols.Image ) or "" ) ) +end + +function UpdateGamemodeTitle( f10_arg0, f10_arg1 ) + f10_arg0:setText( Engine.Localize( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f10_arg1.gameType, GameTypesTable.Cols.Name ) or "" ) ) +end + +function UpdateGamemodeDesc( f11_arg0, f11_arg1 ) + f11_arg0:setText( Engine.Localize( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f11_arg1.gameType, GameTypesTable.Cols.Desc ) or "" ) ) +end + +function UpdateDisabledDesc( f12_arg0, f12_arg1 ) + if f12_arg1.disabled then + f12_arg0:animateToState( "default" ) + else + f12_arg0:animateToState( "hidden" ) + end +end + +function gamemode_desc_pane() + return { + type = "UIElement", + id = "gamemode_desc_pane_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "generic_menu_titlebar", + id = "gamemode_header_id", + properties = { + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left, + title_bar_text = Engine.Localize( "@LUA_MENU_MODE_DETAILS_CAPS" ), + font = CoD.TextSettings.BoldFont + } + }, + { + type = "generic_menu_background_withfade", + id = "gamemode_bg_fade_id", + children = { + { + type = "UIImage", + id = "gamemode_image_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 16, + bottom = 272, + left = -128, + right = 128, + material = RegisterMaterial( "icon_playlist_generic" ) + } + }, + handlers = { + gamemode_selection_update = UpdateGamemodeIcon + } + }, + { + type = "UIText", + id = "gamemode_name_id", + properties = { + text = "" + }, + states = { + default = { + left = -144, + top = 32, + width = 240, + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left + } + }, + handlers = { + gamemode_selection_update = UpdateGamemodeTitle + } + }, + { + type = "UIText", + id = "gamemode_desc_id", + properties = { + text = "" + }, + states = { + default = { + left = -144, + top = 52, + width = 296, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + }, + handlers = { + gamemode_selection_update = UpdateGamemodeDesc + } + }, + { + type = "UIImage", + id = "gamemode_disabled_icon_id", + states = { + default = { + material = RegisterMaterial( "icon_new" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + left = 10, + top = -82, + right = 42, + bottom = -50, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + gamemode_selection_update = UpdateDisabledDesc + } + }, + { + type = "UIText", + id = "gamemode_disabled_desc_id", + properties = { + text = Engine.Localize( "LUA_MENU_DESC_TOO_MANY_PLAYERS_HORDE" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 48, + top = -65 - CoD.TextSettings.NormalFont.Height, + right = -10, + bottom = -65, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + gamemode_selection_update = UpdateDisabledDesc + } + } + } + } + } + } +end + +function settings_recipe_choosetype() + return { + type = "UIElement", + id = "settings_recipe_choosetype_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = { + requestedGameMode = "Standard", + menu_title = Cac.GetGameModeTypeString( "Standard" ) + }, + handlers = { + menu_close = GameModeSelectMenuClose, + menu_create = GameModeSelectMenuCreate + }, + children = { + { + type = "generic_menu_title", + id = "settings_recipe_choosetype_title_text_id", + properties = { + menu_title = MBh.Property( "menu_title" ) + } + }, + { + type = "UIStencil", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + children = { + { + type = "settings_recipe_choosetype_options_vlist", + id = "settings_recipe_choosetype_options_vlist_id", + childrenFeeder = GameModeSelectFeeder, + properties = { + requestedGameMode = MBh.Property( "requestedGameMode" ) + } + } + } + }, + { + type = "gamemode_desc_pane", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -64, + right = 288, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + } + }, + { + type = "generic_back_button" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + } +end + +function settings_recipe_choosetype_options_vlist() + return { + type = "UIVerticalList", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -45, + top = 0, + bottom = 0 + } + } + } +end + +function SquadsTypeChildrenFeeder( f16_arg0 ) + local f16_local0 = { + [#f16_local0 + 1] = { + type = "UIGenericButton", + id = "settings_squads_type_safeguard_button", + properties = { + button_text = Engine.Localize( "LUA_MENU_HORDE" ), + gameType = "horde", + additional_handlers = { + button_action = GameModeChooseAction + } + } + }, + [#f16_local0 + 1] = { + type = "UIGenericButton", + id = "settings_squads_type_wargames_button", + properties = { + button_text = Engine.Localize( "LUA_MENU_WARGAME" ), + additional_handlers = { + button_action = function ( f17_arg0, f17_arg1 ) + LUI.FlowManager.RequestAddMenu( f17_arg0, "settings_recipe_choosetype", true, f17_arg1.controller, false, { + requestedGameMode = "Standard", + menu_title = Cac.GetGameModeTypeString( "Standard" ), + teamsOnly = true + } ) + end + } + } + }, + [#f16_local0 + 1] = { + type = "UIGenericButton", + id = "recent_modes_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_RECENT_MODES" ), + button_action_func = function ( f18_arg0, f18_arg1 ) + MatchRules.OpenSelectionMenu( f18_arg1.controller, { + savedMode = "history", + menu_title = Engine.Localize( "@LUA_MENU_RECENT_MODES" ), + teamsOnly = SvS.IsSvS() + } ) + end + } + }, + [#f16_local0 + 1] = { + type = "UIGenericButton", + id = "my_modes_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MY_MODES" ), + button_action_func = LUI.mp_menus.MPGameSetupModeMenu.ChooseMyModeMenu + } + } + } + return f16_local0 +end + +function settings_recipe_choosetype_squads() + return { + type = "UIElement", + id = "settings_recipe_choosetype_squads_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_close = GameModeSelectMenuClose, + menu_create = function ( f20_arg0, f20_arg1 ) + f20_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + end + + }, + children = { + { + type = "generic_menu_title", + id = "settings_recipe_choosetype_title_text_id", + properties = { + menu_title = Engine.Localize( "LUA_MENU_MODE_CAPS" ) + } + }, + { + type = "UIVerticalList", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + childrenFeeder = SquadsTypeChildrenFeeder + }, + { + type = "generic_back_button" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + } +end + +LUI.MenuBuilder.registerDef( "gamemode_desc_pane", gamemode_desc_pane ) +LUI.MenuBuilder.registerDef( "settings_recipe_choosetype", settings_recipe_choosetype ) +LUI.MenuBuilder.registerDef( "settings_recipe_choosetype_options_vlist", settings_recipe_choosetype_options_vlist ) +LUI.MenuBuilder.registerDef( "settings_recipe_choosetype_squads", settings_recipe_choosetype_squads ) +LockTable( _M ) diff --git a/lui/mp_menus/mpgamesetupmenu.dec.lua b/lui/mp_menus/mpgamesetupmenu.dec.lua new file mode 100644 index 0000000..a0b91fd --- /dev/null +++ b/lui/mp_menus/mpgamesetupmenu.dec.lua @@ -0,0 +1,516 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function PrivatePartyHostSetupMapAction( f1_arg0, f1_arg1 ) + LUI.FlowManager.RequestAddMenu( f1_arg0, "mapsetup_menu_main", true, f1_arg1.controller, false, { + rotationAllowed = not Engine.IsAliensMode() + } ) +end + +function SetupMapAction( f2_arg0, f2_arg1 ) + local f2_local0 = { + rotationAllowed = false + } + LUI.FlowManager.RequestAddMenu( f2_arg0, "mapsetup_menu_main", true, f2_arg1.controller, false ) +end + +function SetupModeAction( f3_arg0, f3_arg1 ) + if SvS.IsSvS() then + LUI.FlowManager.RequestAddMenu( f3_arg0, "settings_recipe_choosetype_squads", true, f3_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f3_arg0, "popup_recipesetup_modes", true, f3_arg1.controller ) + end +end + +function SetupOptionsAction( f4_arg0, f4_arg1 ) + LUI.FlowManager.RequestAddMenu( f4_arg0, "settings_recipe_rules_base", true, f4_arg1.controller, false ) +end + +function GameSetupMenuCreate( f5_arg0, f5_arg1 ) + MatchRules.SetUsingMatchRulesData( 1 ) + if Lobby.IsInPrivateParty() and Lobby.IsPrivatePartyHost() then + Lobby.StopIntermissionTimer() + end + local f5_local0 = Engine.GetFirstActiveController() + if f5_arg0.properties.exclusiveController then + f5_local0 = f5_arg0.properties.exclusiveController + end + Engine.SetOldLocalVarBool( f5_local0, "lui_gamesetup_menu", false ) + f5_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) + if not Engine.IsAliensMode() then + f5_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_RECIPE_SAVE_CUSTOM" ) or "", + side = "left", + clickable = true + } ) + end + MLG.Refresh( f5_arg0 ) +end + +function JIPButtonDisplayText() + if Engine.GetDvarInt( "sv_privateClients" ) == Engine.GetDvarInt( "party_maxPlayers" ) then + return Engine.Localize( "@LUA_MENU_NOTALLOWED" ) + else + return Engine.Localize( "@LUA_MENU_ALLOWED" ) + end +end + +function JIPHandleOptionToggle() + Engine.Exec( "xtogprivateslots; xsessionupdate;" ) +end + +function IntermissionButtonDisplayText() + if Lobby.IsUsingIntermissionTimer() then + return Engine.Localize( "@LUA_MENU_ENABLED" ) + else + return Engine.Localize( "@LUA_MENU_DISABLED" ) + end +end + +function IntermissionHandleOptionToggle() + if Lobby.IsUsingIntermissionTimer() then + Lobby.UseIntermissionTimer( false ) + else + Lobby.UseIntermissionTimer( true ) + end +end + +function SaveRecipeToMyModes( f10_arg0, f10_arg1 ) + if not Engine.IsAliensMode() then + MatchRules.OpenSelectionMenu( f10_arg1.controller, { + savedMode = "save", + menuAction = "save", + menu_title = Engine.Localize( "@LUA_MENU_MY_MODES" ), + return_menu = "gamesetup_menu_main" + } ) + end +end + +function SaveToVaultAction( f11_arg0, f11_arg1 ) + Engine.ExecNow( "incnosplitscreencontrol popup_recipesetup", f11_arg1.controller ) + LUI.FlowManager.RequestOldMenu( f11_arg0, "popup_recipesetup", true ) +end + +function LoadFromHistoryAction( f12_arg0, f12_arg1 ) + MatchRules.LoadDataFromHistory( 0 ) + f12_arg0:dispatchEventToRoot( { + name = "content_refresh", + dispatchChildren = true + } ) +end + +function SaveToHistoryAction( f13_arg0, f13_arg1 ) + MatchRules.SaveDataToHistory() +end + +function SaveToPlayer0Action( f14_arg0, f14_arg1 ) + MatchRules.SaveDataToPlayer( 0 ) +end + +function LoadFromPlayer0Action( f15_arg0, f15_arg1 ) + MatchRules.LoadDataFromPlayer( 0 ) + f15_arg0:dispatchEventToRoot( { + name = "content_refresh", + dispatchChildren = true + } ) +end + +function SaveToPlayer2Action( f16_arg0, f16_arg1 ) + MatchRules.SaveDataToPlayer( 2 ) +end + +function LoadFromPlayer2Action( f17_arg0, f17_arg1 ) + MatchRules.LoadDataFromPlayer( 2 ) + f17_arg0:dispatchEventToRoot( { + name = "content_refresh", + dispatchChildren = true + } ) +end + +function SaveDefaultsAction( f18_arg0, f18_arg1 ) + for f18_local0 = 0, 5, 1 do + MatchRules.SetData( "defaultClasses", "axis", f18_local0, "class", "inUse", false ) + MatchRules.SetData( "defaultClasses", "allies", f18_local0, "class", "inUse", false ) + MatchRules.SetData( "defaultClasses", "axis", f18_local0, "class", "name", "" ) + MatchRules.SetData( "defaultClasses", "allies", f18_local0, "class", "name", "" ) + end + MatchRules.SaveMatchRulesDataDefault() +end + +function SaveForPlaylistAction( f19_arg0, f19_arg1 ) + MatchRules.SaveMatchRulesDataDefault() +end + +function ModeButtonDisplayFunc() + if SvS.IsSvS() then + local f20_local0 = MatchRules.GetData( "gametype" ) + if f20_local0 == "horde" then + return Lobby.GameTypeNameAbbreviated() + else + return Engine.Localize( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f20_local0, GameTypesTable.Cols.WargameName ) ) + end + else + return Lobby.GameTypeNameAbbreviated() + end +end + +function GameSetupMenuOptionsFeeder( f21_arg0 ) + local f21_local0 = Engine.Localize( "@LUA_MENU_MAP_CAPS" ) + local f21_local1 = SetupMapAction + if Lobby.IsInPrivateParty() and Lobby.IsPrivatePartyHost() then + f21_local0 = Engine.Localize( "@LUA_MENU_MAPS_CAPS" ) + f21_local1 = PrivatePartyHostSetupMapAction + end + local f21_local2 = "None" + if Lobby.IsInPrivateParty() and MatchRules.IsUsingCustomMapRotation() then + f21_local2 = Engine.Localize( "@LUA_MENU_ROTATION" ) + else + f21_local2 = Lobby.GetMapName() + end + local f21_local3 = {} + if not Engine.IsAliensMode() then + f21_local3[#f21_local3 + 1] = { + type = "UIGenericButton", + id = "maps_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = f21_local0, + button_display_func = function () + return f21_local2 + end, + button_action_func = f21_local1 + } + } + f21_local3[#f21_local3 + 1] = { + type = "UIGenericButton", + id = "mode_button_id", + disabled = MLG.AreMLGRulesEnabled(), + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@LUA_MENU_MODE_CAPS" ), + button_display_func = ModeButtonDisplayFunc, + button_action_func = SetupModeAction + }, + handlers = { + mlg_enabled = MBh.EmitEvent( { + name = "disable" + } ), + mlg_disabled = MBh.EmitEvent( { + name = "enable" + } ) + } + } + end + if not Engine.IsAliensMode() or Engine.IsDevelopmentBuild() and Engine.GetDvarString( "showAliensOptions" ) == "1" then + f21_local3[#f21_local3 + 1] = { + type = "UIGenericButton", + id = "options_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ), + button_display_func = function () + local f23_local0 = "PATCH_MENU_MATCHRULES_CUSTOM" + if MLG.AreMLGRulesEnabled() then + f23_local0 = "PATCH_MENU_MATCHRULES_MLG" + elseif MatchRules.AreMatchRulesDefaultFromFF() then + f23_local0 = "PATCH_MENU_MATCHRULES_DEFAULT" + end + return Engine.Localize( f23_local0 ) + end, + button_action_func = SetupOptionsAction + }, + handlers = { + mlg_enabled = MBh.EmitEvent( { + name = "content_refresh" + } ), + mlg_disabled = MBh.EmitEvent( { + name = "content_refresh" + } ) + } + } + end + if Lobby.IsInPrivateParty() and Lobby.IsPrivatePartyHost() and not Engine.IsAliensMode() and Lobby.GetPartyPrivacy() >= 0 then + f21_local3[#f21_local3 + 1] = { + type = "UIGenericButton", + id = "privacy_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@PATCH_MENU_PARTY_PRIVACY_CAPS" ), + button_display_func = function ( f24_arg0, f24_arg1 ) + return Engine.Localize( Lobby.PrivacySettings.Texts[Lobby.GetPartyPrivacy()] ) + end, + button_left_func = function ( f25_arg0, f25_arg1 ) + local f25_local0 = Lobby.GetPartyPrivacy() - 1 + if f25_local0 < Lobby.PrivacySettings.Min then + f25_local0 = Lobby.PrivacySettings.Max + end + Lobby.SetPartyPrivacy( f25_local0 ) + end, + button_right_func = function ( f26_arg0, f26_arg1 ) + local f26_local0 = Lobby.GetPartyPrivacy() + 1 + if Lobby.PrivacySettings.Max < f26_local0 then + f26_local0 = Lobby.PrivacySettings.Min + end + Lobby.SetPartyPrivacy( f26_local0 ) + end + } + } + end + if Lobby.IsInPrivateParty() and Lobby.IsPrivatePartyHost() and not Engine.IsAliensMode() and Lobby.GetPlayerLimit() >= 0 then + local f21_local4 = 2 + local f21_local5 = 18 + f21_local3[#f21_local3 + 1] = { + type = "UIGenericButton", + id = "limit_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@PATCH_MENU_PLAYER_LIMIT_CAPS" ), + button_display_func = function ( f27_arg0, f27_arg1 ) + return Lobby.GetPlayerLimit() + end, + button_left_func = function ( f28_arg0, f28_arg1 ) + local f28_local0 = Lobby.GetPlayerLimit() - 1 + if f28_local0 < f21_local4 then + f28_local0 = f21_local5 + end + Lobby.SetPlayerLimit( f28_local0 ) + end, + button_right_func = function ( f29_arg0, f29_arg1 ) + local f29_local0 = Lobby.GetPlayerLimit() + 1 + if f21_local5 < f29_local0 then + f29_local0 = f21_local4 + end + Lobby.SetPlayerLimit( f29_local0 ) + end + } + } + end + if not Engine.GetDvarBool( "systemlink" ) and Engine.GetDvarBool( "onlinegame" ) and not f21_arg0.isSoloMode then + if Engine.IsConsoleGame() then + f21_local3[#f21_local3 + 1] = { + type = "UIGenericButton", + id = "jip_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_JIP_CAPS" ), + button_display_func = JIPButtonDisplayText, + button_left_func = JIPHandleOptionToggle, + button_right_func = JIPHandleOptionToggle + }, + handlers = { + refresh_jip_button_text = function ( f30_arg0, f30_arg1 ) + local f30_local0 = JIPButtonDisplayText() + local f30_local1 = f30_arg0:getFirstDescendentById( "content_text_label" ) + f30_local1:setText( f30_local0 ) + end + }, + children = { + { + type = "UITimer", + id = "jip_button_refresh_timer_id", + properties = { + event = "refresh_jip_button_text", + interval = 100, + disposable = false, + broadcastToRoot = false + } + } + } + } + elseif Engine.GetDvarBool( "xblive_privatematch" ) then + f21_local3[#f21_local3 + 1] = { + type = "UIGenericButton", + id = "password_button_id", + disabled = not AreWePrivatePartyHost(), + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "PATCH_MENU_CHANGE_PASSWORD_CAPS" ), + button_display_func = function () + local f31_local0 = Engine.GetDvarString( "privateMatch_serverPassword" ) + if f31_local0 then + f31_local0 = Engine.GetDvarString( "privateMatch_serverPassword" ) ~= "" + end + local f31_local1 + if f31_local0 then + f31_local1 = Engine.Localize( "PATCH_MENU_PASSWORD_SET" ) + if not f31_local1 then + + else + return f31_local1 + end + end + f31_local1 = Engine.Localize( "MENU_NONE" ) + end, + button_action_func = function ( f32_arg0, f32_arg1 ) + Engine.ExecNow( "setfromdvar ui_password privateMatch_serverPassword" ) + Engine.OpenScreenKeyboard( f32_arg1.controller, Engine.Localize( "MENU_PASSWORD" ), Engine.GetDvarString( "ui_password" ) or "", Lobby.PasswordLength, false, false, CoD.KeyboardInputTypes.Password ) + end + }, + handlers = { + text_input_complete = function ( f33_arg0, f33_arg1 ) + if f33_arg1.text then + Engine.SetDvarString( "privateMatch_serverPassword", f33_arg1.text ) + f33_arg0:processEvent( { + name = "content_refresh" + } ) + end + end + } + } + end + end + if Lobby.IsInPrivateParty() and Lobby.IsPrivatePartyHost() and not Engine.IsAliensMode() then + f21_local3[#f21_local3 + 1] = { + type = "UIGenericButton", + id = "intermission_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_INTERMISSION_CAPS" ), + button_display_func = IntermissionButtonDisplayText, + button_left_func = IntermissionHandleOptionToggle, + button_right_func = IntermissionHandleOptionToggle + } + } + end + if Engine.IsDevelopmentBuild() then + f21_local3[#f21_local3 + 1] = { + type = "UIGenericButton", + id = "save_defaults_button_id", + properties = { + button_text = "Save for Default to devkit", + button_action_func = SaveDefaultsAction, + height = 28 + } + } + f21_local3[#f21_local3 + 1] = { + type = "UIGenericButton", + id = "save_for_playlist_button_id", + properties = { + button_text = "Save for Playlist/MLG to devkit", + button_action_func = SaveForPlaylistAction, + height = 28 + } + } + end + return f21_local3 +end + +function gamesetup_menu_main() + return { + type = "UIElement", + id = "gamesetup_menu_main_root", + properties = { + isSoloMode = false + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = GameSetupMenuCreate, + update_timer = MLG.Refresh + }, + children = { + { + type = "UITimer", + id = "update_timer", + properties = { + event = "update_timer", + disposable = false, + interval = 200 + } + }, + { + type = "generic_menu_title", + id = "system_link_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_GAME_SETUP_CAPS" ) + } + }, + { + type = "gamesetup_menu_options", + id = "gamesetup_menu_options_id", + properties = { + isSoloMode = MBh.Property( "isSoloMode" ) + }, + childrenFeeder = GameSetupMenuOptionsFeeder, + handlers = { + mode_changed = function ( f35_arg0, f35_arg1 ) + f35_arg0:processEvent( { + name = "content_refresh", + dispatchChildren = true + } ) + end + + } + }, + { + type = "UIBindButton", + id = "gamesetup_bind_buttons_id", + handlers = { + button_secondary = MBh.LeaveMenu(), + button_start = function ( f36_arg0, f36_arg1 ) + MLG.Toggle( f36_arg0:getParent(), f36_arg1 ) + end + + } + }, + { + type = "button_helper_text_main", + id = "gamesetup_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + }, + { + type = "UIBindButton", + id = "save_recipe_bind", + handlers = { + button_alt1 = SaveRecipeToMyModes + } + } + } + } +end + +function gamesetup_menu_options() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + } + } +end + +LUI.MenuBuilder.registerDef( "gamesetup_menu_main", gamesetup_menu_main ) +LUI.MenuBuilder.registerDef( "gamesetup_menu_options", gamesetup_menu_options ) +LockTable( _M ) diff --git a/lui/mp_menus/mpgamesetupmodemenu.dec.lua b/lui/mp_menus/mpgamesetupmodemenu.dec.lua new file mode 100644 index 0000000..6c024ba --- /dev/null +++ b/lui/mp_menus/mpgamesetupmodemenu.dec.lua @@ -0,0 +1,174 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function ChooseStandardGameModeMenu( f1_arg0, f1_arg1 ) + LUI.FlowManager.RequestAddMenu( f1_arg0, "settings_recipe_choosetype", true, f1_arg1.controller, false, { + requestedGameMode = "Standard", + menu_title = Cac.GetGameModeTypeString( "Standard" ), + teamsOnly = SvS.IsSvS() + } ) +end + +function ChooseAlternateGameModeMenu( f2_arg0, f2_arg1 ) + LUI.FlowManager.RequestAddMenu( f2_arg0, "settings_recipe_choosetype", true, f2_arg1.controller, false, { + requestedGameMode = "Alternate", + menu_title = Cac.GetGameModeTypeString( "Alternate" ), + teamsOnly = SvS.IsSvS() + } ) +end + +function ChooseRecentModeMenu( f3_arg0, f3_arg1 ) + MatchRules.OpenSelectionMenu( f3_arg1.controller, { + savedMode = "history", + menu_title = Engine.Localize( "@LUA_MENU_RECENT_MODES" ), + teamsOnly = SvS.IsSvS() + } ) +end + +function ChooseMyModeMenu( f4_arg0, f4_arg1 ) + MatchRules.OpenSelectionMenu( f4_arg1.controller, { + savedMode = "save", + menuAction = "load", + menu_title = Engine.Localize( "@LUA_MENU_MY_MODES" ), + teamsOnly = SvS.IsSvS() + } ) +end + +function CountModesForCategory( f5_arg0, f5_arg1 ) + local f5_local0 = Cac.GetGameModeList( f5_arg0 ) + local f5_local1 = 0 + for f5_local6, f5_local7 in ipairs( f5_local0 ) do + local f5_local5 = true + if f5_arg1 then + f5_local5 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f5_local7, GameTypesTable.Cols.TeamChoice ) == "1" + end + if f5_local5 then + f5_local1 = f5_local1 + 1 + end + end + return f5_local1 +end + +function GameModeFeeder( f6_arg0 ) + local f6_local0 = nil + local f6_local1 = LUI.Alignment.Right + f6_local0 = {} + local f6_local2 = SvS.IsSvS() + if CountModesForCategory( "Standard", f6_local2 ) > 0 then + f6_local0[#f6_local0 + 1] = { + type = "UIGenericButton", + id = "standard_modes_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_STANDARD_MODES" ), + button_action_func = ChooseStandardGameModeMenu + } + } + end + if CountModesForCategory( "Alternate", f6_local2 ) > 0 then + f6_local0[#f6_local0 + 1] = { + type = "UIGenericButton", + id = "alternate_modes_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_ALTERNATE_MODES" ), + button_action_func = ChooseAlternateGameModeMenu + } + } + end + if not SvS.IsSvS() then + f6_local0[#f6_local0 + 1] = { + type = "UIGenericButton", + id = "recent_modes_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_RECENT_MODES" ), + button_action_func = ChooseRecentModeMenu + } + } + end + if not SvS.IsSvS() then + f6_local0[#f6_local0 + 1] = { + type = "UIGenericButton", + id = "my_modes_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_MY_MODES" ), + button_action_func = ChooseMyModeMenu + } + } + end + return f6_local0 +end + +function OnMenuCreate( f7_arg0, f7_arg1 ) + f7_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function popup_recipesetup_modes() + return { + type = "UIElement", + id = "popup_recipesetup_modes_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OnMenuCreate + }, + properties = {}, + children = { + { + type = "generic_menu_title", + id = "popup_recipesetup_modes_title_text_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_MODE_CAPS" ) + } + }, + { + type = "xboxlive_options_vlist", + id = "popup_recipesetup_modes_vlist_id", + childrenFeeder = GameModeFeeder + }, + { + type = "generic_back_button" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + } +end + +function popup_recipesetup_modes_vlist() + return { + type = "UIVerticalList", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + } + } +end + +LUI.MenuBuilder.registerDef( "popup_recipesetup_modes", popup_recipesetup_modes ) +LUI.MenuBuilder.registerDef( "popup_recipesetup_modes_vlist", popup_recipesetup_modes_vlist ) +LockTable( _M ) diff --git a/lui/mp_menus/mpgamesetupoptionsmenu.dec.lua b/lui/mp_menus/mpgamesetupoptionsmenu.dec.lua new file mode 100644 index 0000000..5d3707c --- /dev/null +++ b/lui/mp_menus/mpgamesetupoptionsmenu.dec.lua @@ -0,0 +1,2439 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +FFAGameType = "dm" +TDMGameType = "war" +SDGameType = "sd" +DomGameType = "dom" +ConfGameType = "conf" +MuggerGameType = "mugger" +AliensGameType = "aliens" +SRGameType = "sr" +InfectGameType = "infect" +BlitzGameType = "blitz" +GrindGameType = "grind" +CrankedGameType = "cranked" +SOTFGameType = "sotf" +SOTF_FFA_GameType = "sotf_ffa" +SafeguardGameType = "horde" +GunGameType = "gun" +GrndGameType = "grnd" +SiegeGameType = "siege" +function count( f1_arg0 ) + if f1_arg0 == nil then + return 0 + end + local f1_local0 = 0 + for f1_local4, f1_local5 in pairs( f1_arg0 ) do + f1_local0 = f1_local0 + 1 + end + return f1_local0 +end + +GameTypeRefCol = 0 +GameTypeNameCol = 1 +GameTypeDescCol = 2 +GameTypeImageCol = 3 +function GetCurrentGameTypeLocalizedInfo( f2_arg0 ) + local f2_local0 = Engine.TableLookup( "mp/gameTypesTable.csv", GameTypeRefCol, GetCurrentGameType(), f2_arg0 ) + local f2_local1 = "@" + local f2_local2 + if f2_arg0 == GameTypeNameCol then + f2_local2 = "_CAPS" + if not f2_local2 then + + else + local f2_local3 + if f2_local0 then + f2_local3 = Engine.Localize( f2_local1 .. f2_local0 .. f2_local2 ) + if not f2_local3 then + + else + return f2_local3 + end + end + f2_local3 = "GAMETYPE NOT FOUND" + end + end + f2_local2 = "" +end + +function GetGameTypeIcon() + local f3_local0 = GetCurrentGameType() + assert( f3_local0, "GAMETYPE NOT FOUND" ) + local f3_local1 = Engine.TableLookup( "mp/gameTypesTable.csv", GameTypeRefCol, f3_local0, GameTypeImageCol ) + local f3_local2 + if f3_local1 then + f3_local2 = RegisterMaterial( f3_local1 ) + if not f3_local2 then + + else + return f3_local2 + end + end + f3_local2 = RegisterMaterial( "icon_playlist_generic" ) +end + +function CreateDefaultClassesAction( f4_arg0, f4_arg1 ) + LUI.FlowManager.RequestAddMenu( f4_arg0, "cac_edit_main", true, f4_arg1.controller, false, { + open_char_list = true, + classLocation = "defaultClassesTeam2" + } ) +end + +function RestrictCustomClassesAction( f5_arg0, f5_arg1 ) + LUI.FlowManager.RequestAddMenu( f5_arg0, "menu_custom_class_restrictions", true, f5_arg1.controller ) +end + +function LeaveGameSetupOptionsMenu( f6_arg0, f6_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) +end + +function GetLeaveOptionsWindowFunctionForButton( f7_arg0 ) + return function ( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "settings_recipe_rules_base" ) + f8_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + Engine.PlaySound( CoD.SFX.SelectBack ) + f8_arg0:dispatchEventToRoot( { + name = "button_unlock", + immediate = true + } ) + f8_arg0:dispatchEventToRoot( { + name = "options_window_unfocus", + immediate = true + } ) + f8_arg0:dispatchEventToRoot( { + name = "options_categories_window_focus", + immediate = true + } ) + if f7_arg0 then + f7_arg0:processEvent( { + name = "gain_focus", + immediate = true + } ) + end + end + +end + +function BackButtonAction( f9_arg0, f9_arg1 ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 ) + f9_local0.currentBackButtonAction( f9_arg0, f9_arg1 ) +end + +function SaveRecipeToMyModes( f10_arg0, f10_arg1 ) + MatchRules.OpenSelectionMenu( f10_arg1.controller, { + savedMode = "save", + menuAction = "save", + menu_title = Engine.Localize( "@LUA_MENU_MY_MODES" ), + return_menu = "settings_recipe_rules_base" + } ) +end + +function IsHardcoreModeFunc() + return MatchRules.GetData( "commonOption", "hardcoreModeOn" ) +end + +function OptionFactory( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4, f12_arg5 ) + local f12_local0 = function () + local f13_local0 = MatchRules.GetData( f12_arg0, f12_arg1 ) + for f13_local4, f13_local5 in pairs( f12_arg3 ) do + if f13_local5.value == f13_local0 then + return f13_local4 + end + end + return 1 + end + + local f12_local1 = function ( f14_arg0, f14_arg1 ) + MatchRules.SetData( f12_arg0, f12_arg1, f12_arg3[f14_arg1.currentIndex].value ) + f14_arg0:dispatchEventToRoot( { + name = "rule_changed_" .. f12_arg0 .. "_" .. f12_arg1, + immediate = true + } ) + end + + if not f12_arg5 then + f12_arg5 = {} + end + f12_arg5.element_refresh = MBh.EmitEvent( "content_refresh" ) + return { + type = "UIGenericButton", + id = "option_" .. f12_arg0 .. "_" .. f12_arg1, + disabledFunc = function ( f15_arg0, f15_arg1 ) + if MLG.AreMLGRulesEnabled() then + return true + elseif f12_arg4 then + return f12_arg4( f15_arg0, f15_arg1 ) + else + return false + end + end + , + audio = { + button_over = CoD.SFX.SubMenuMouseOver + }, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f12_arg2 ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function ( f16_arg0, f16_arg1 ) + local f16_local0 = f12_local0() + return Engine.Localize( f12_arg3[f12_local0()].text ) + end + , + button_left_func = function ( f17_arg0, f17_arg1 ) + f17_arg1.currentIndex = 1 + (#f12_arg3 + f12_local0() - 1 - 1) % #f12_arg3 + f12_local1( f17_arg0, f17_arg1 ) + end + , + button_right_func = function ( f18_arg0, f18_arg1 ) + f18_arg1.currentIndex = 1 + (f12_local0() - 1 + 1) % #f12_arg3 + f12_local1( f18_arg0, f18_arg1 ) + end + + }, + handlers = f12_arg5 or {} + } +end + +function OptionFactoryDvarInt( f19_arg0, f19_arg1, f19_arg2, f19_arg3, f19_arg4 ) + local f19_local0 = 1 + local f19_local1 = Engine.GetDvarInt( f19_arg0 ) + for f19_local5, f19_local6 in pairs( f19_arg2 ) do + if f19_local6.value == f19_local1 then + f19_local0 = f19_local5 + break + end + end + return { + type = "UIGenericButton", + id = "option_" .. f19_arg0, + audio = { + button_over = CoD.SFX.SubMenuMouseOver + }, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f19_arg1 ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function ( f20_arg0, f20_arg1 ) + return Engine.Localize( f19_arg2[f19_local0].text ) + end + , + button_left_func = function ( f21_arg0, f21_arg1 ) + f19_local0 = 1 + (#f19_arg2 + f19_local0 - 1 - 1) % #f19_arg2 + Engine.SetDvarInt( f19_arg0, f19_arg2[f19_local0].value ) + end + , + button_right_func = function ( f22_arg0, f22_arg1 ) + f19_local0 = 1 + (f19_local0 - 1 + 1) % #f19_arg2 + Engine.SetDvarInt( f19_arg0, f19_arg2[f19_local0].value ) + end + + }, + handlers = f19_arg4 or {} + } +end + +function OptionFactoryUserString( f23_arg0, f23_arg1, f23_arg2, f23_arg3, f23_arg4 ) + local f23_local0 = function () + local f24_local0 = MatchRules.GetData( f23_arg0, f23_arg1 ) + if f24_local0 and f24_local0 ~= "" then + return f24_local0 + else + return Engine.Localize( f23_arg3 ) + end + end + + return { + type = "UIGenericButton", + id = "option_" .. f23_arg0 .. "_" .. f23_arg1, + disabledFunc = function ( f25_arg0, f25_arg1 ) + return false + end + , + audio = { + button_over = CoD.SFX.SubMenuMouseOver + }, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f23_arg2 ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function ( f26_arg0, f26_arg1 ) + return Engine.Localize( f23_local0() ) + end + , + button_action_func = function ( f27_arg0, f27_arg1 ) + local f27_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f27_arg0 ) + f27_local0.OnscreenKeyboardListener = f27_arg0 + Engine.OpenScreenKeyboard( f27_arg1.controller, Engine.Localize( "@LUA_MENU_ENTER_NAME" ), f23_local0() or "", f23_arg4, true, false ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + set_string_option_value = function ( f28_arg0, f28_arg1 ) + assert( f28_arg1.text ~= nil ) + MatchRules.SetData( f23_arg0, f23_arg1, f28_arg1.text ) + f28_arg0:processEvent( { + name = "content_refresh", + immediate = true + } ) + end + + } + } +end + +function GameOptionsFeeder() + local f29_local0 = {} + local f29_local1 = GetCurrentGameType() + local f29_local2 = function () + return true + end + + if f29_local1 == FFAGameType or f29_local1 == TDMGameType or f29_local1 == DomGameType or f29_local1 == ConfGameType or f29_local1 == AliensGameType or f29_local1 == BlitzGameType or f29_local1 == GrindGameType or f29_local1 == CrankedGameType or f29_local1 == SOTFGameType or f29_local1 == SOTF_FFA_GameType or f29_local1 == GunGameType or f29_local1 == GrndGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "timeLimit", "@LUA_MENU_RULES_TIME_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_5MINUTES", + value = 5 + }, + { + text = "@LUA_MENU_RULES_10MINUTES", + value = 10 + }, + { + text = "@LUA_MENU_RULES_20MINUTES", + value = 20 + }, + { + text = "@LUA_MENU_RULES_30MINUTES", + value = 30 + } + } ) + end + if f29_local1 == FFAGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_10POINTS", + value = 10 + }, + { + text = "@LUA_MENU_RULES_15POINTS", + value = 15 + }, + { + text = "@LUA_MENU_RULES_30POINTS", + value = 30 + }, + { + text = "@LUA_MENU_RULES_50POINTS", + value = 50 + }, + { + text = "@LUA_MENU_RULES_75POINTS", + value = 75 + } + } ) + end + if f29_local1 == SOTFGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_20POINTS", + value = 20 + }, + { + text = "@LUA_MENU_RULES_50POINTS", + value = 50 + }, + { + text = "@LUA_MENU_RULES_65POINTS", + value = 65 + }, + { + text = "@LUA_MENU_RULES_75POINTS", + value = 75 + }, + { + text = "@LUA_MENU_RULES_100POINTS", + value = 100 + } + } ) + end + if f29_local1 == SOTF_FFA_GameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_10POINTS", + value = 10 + }, + { + text = "@LUA_MENU_RULES_15POINTS", + value = 15 + }, + { + text = "@LUA_MENU_RULES_25POINTS", + value = 25 + }, + { + text = "@LUA_MENU_RULES_30POINTS", + value = 30 + }, + { + text = "@LUA_MENU_RULES_50POINTS", + value = 50 + }, + { + text = "@LUA_MENU_RULES_65POINTS", + value = 65 + } + } ) + end + if f29_local1 == TDMGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_20POINTS", + value = 20 + }, + { + text = "@LUA_MENU_RULES_50POINTS", + value = 50 + }, + { + text = "@LUA_MENU_RULES_75POINTS", + value = 75 + }, + { + text = "@LUA_MENU_RULES_100POINTS", + value = 100 + }, + { + text = "@LUA_MENU_RULES_150POINTS", + value = 150 + } + } ) + end + if f29_local1 == CrankedGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_40POINTS", + value = 40 + }, + { + text = "@LUA_MENU_RULES_100POINTS", + value = 100 + }, + { + text = "@LUA_MENU_RULES_150POINTS", + value = 150 + }, + { + text = "@LUA_MENU_RULES_200POINTS", + value = 200 + }, + { + text = "@LUA_MENU_RULES_300POINTS", + value = 300 + } + } ) + end + if f29_local1 == GrndGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@DLC_MENU_RULES_1000", + value = 1000 + }, + { + text = "@DLC_MENU_RULES_4000", + value = 4000 + }, + { + text = "@DLC_MENU_RULES_7500", + value = 7500 + }, + { + text = "@DLC_MENU_RULES_9000", + value = 9000 + }, + { + text = "@DLC_MENU_RULES_12000", + value = 12000 + } + } ) + end + if f29_local1 == GrndGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "grndData", "dropTime", "@DLC_MENU_RULES_DROP_TIME", { + { + text = "@LUA_MENU_RULES_NEVER", + value = 0 + }, + { + text = "@LUA_MENU_RULES_5SECONDS", + value = 5 + }, + { + text = "@LUA_MENU_RULES_15SECONDS", + value = 15 + }, + { + text = "@LUA_MENU_RULES_30SECONDS", + value = 30 + }, + { + text = "@LUA_MENU_RULES_45SECONDS", + value = 45 + }, + { + text = "@LUA_MENU_RULES_1MINUTE", + value = 60 + } + } ) + end + if f29_local1 == GrndGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "grndData", "zoneSwitchTime", "@DLC_MENU_RULES_ZONE_TIME", { + { + text = "@DLC_MENU_RULES_1_MINUTES", + value = 1 + }, + { + text = "@DLC_MENU_RULES_2_MINUTES", + value = 2 + }, + { + text = "@LUA_MENU_RULES_3MINUTES", + value = 3 + }, + { + text = "@LUA_MENU_RULES_5MINUTES", + value = 5 + }, + { + text = "@LUA_MENU_RULES_8MINUTES", + value = 8 + } + } ) + end + if f29_local1 == SDGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "sdData", "roundLength", "@LUA_MENU_RULES_ROUND_LENGTH", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_1_5MINUTES", + value = 1.5 + }, + { + text = "@LUA_MENU_RULES_2_5MINUTES", + value = 2.5 + }, + { + text = "@LUA_MENU_RULES_3MINUTES", + value = 3 + }, + { + text = "@LUA_MENU_RULES_5MINUTES", + value = 5 + }, + { + text = "@LUA_MENU_RULES_8MINUTES", + value = 8 + } + } ) + end + if f29_local1 == SRGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "srData", "roundLength", "@LUA_MENU_RULES_ROUND_LENGTH", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_1_5MINUTES", + value = 1.5 + }, + { + text = "@LUA_MENU_RULES_2_5MINUTES", + value = 2.5 + }, + { + text = "@LUA_MENU_RULES_3MINUTES", + value = 3 + }, + { + text = "@LUA_MENU_RULES_5MINUTES", + value = 5 + }, + { + text = "@LUA_MENU_RULES_8MINUTES", + value = 8 + } + } ) + end + if f29_local1 == SDGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "sdData", "bombTimer", "@LUA_MENU_RULES_BOMB_TIMER", { + { + text = "@LUA_MENU_RULES_5SECONDS", + value = 5 + }, + { + text = "@LUA_MENU_RULES_15SECONDS", + value = 15 + }, + { + text = "@LUA_MENU_RULES_30SECONDS", + value = 30 + }, + { + text = "@LUA_MENU_RULES_45SECONDS", + value = 45 + }, + { + text = "@LUA_MENU_RULES_1MINUTE", + value = 60 + } + } ) + end + if f29_local1 == SRGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "srData", "bombTimer", "@LUA_MENU_RULES_BOMB_TIMER", { + { + text = "@LUA_MENU_RULES_5SECONDS", + value = 5 + }, + { + text = "@LUA_MENU_RULES_15SECONDS", + value = 15 + }, + { + text = "@LUA_MENU_RULES_30SECONDS", + value = 30 + }, + { + text = "@LUA_MENU_RULES_45SECONDS", + value = 45 + }, + { + text = "@LUA_MENU_RULES_1MINUTE", + value = 60 + } + } ) + end + if f29_local1 == SDGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "sdData", "plantTime", "@LUA_MENU_RULES_PLANT_TIME", { + { + text = "@LUA_MENU_RULES_1SECOND", + value = 1 + }, + { + text = "@LUA_MENU_RULES_2_5SECONDS", + value = 2.5 + }, + { + text = "@LUA_MENU_RULES_5SECONDS", + value = 5 + }, + { + text = "@LUA_MENU_RULES_7_5SECONDS", + value = 7.5 + }, + { + text = "@LUA_MENU_RULES_10SECONDS", + value = 10 + } + } ) + end + if f29_local1 == SRGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "srData", "plantTime", "@LUA_MENU_RULES_PLANT_TIME", { + { + text = "@LUA_MENU_RULES_1SECOND", + value = 1 + }, + { + text = "@LUA_MENU_RULES_2_5SECONDS", + value = 2.5 + }, + { + text = "@LUA_MENU_RULES_5SECONDS", + value = 5 + }, + { + text = "@LUA_MENU_RULES_7_5SECONDS", + value = 7.5 + }, + { + text = "@LUA_MENU_RULES_10SECONDS", + value = 10 + } + } ) + end + if f29_local1 == SDGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "sdData", "defuseTime", "@LUA_MENU_RULES_DEFUSE_TIME", { + { + text = "@LUA_MENU_RULES_1SECOND", + value = 1 + }, + { + text = "@LUA_MENU_RULES_2_5SECONDS", + value = 2.5 + }, + { + text = "@LUA_MENU_RULES_5SECONDS", + value = 5 + }, + { + text = "@LUA_MENU_RULES_7_5SECONDS", + value = 7.5 + }, + { + text = "@LUA_MENU_RULES_10SECONDS", + value = 10 + } + } ) + end + if f29_local1 == SRGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "srData", "defuseTime", "@LUA_MENU_RULES_DEFUSE_TIME", { + { + text = "@LUA_MENU_RULES_1SECOND", + value = 1 + }, + { + text = "@LUA_MENU_RULES_2_5SECONDS", + value = 2.5 + }, + { + text = "@LUA_MENU_RULES_5SECONDS", + value = 5 + }, + { + text = "@LUA_MENU_RULES_7_5SECONDS", + value = 7.5 + }, + { + text = "@LUA_MENU_RULES_10SECONDS", + value = 10 + } + } ) + end + if f29_local1 == SOTFGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "sotfData", "crateAmount", "@LUA_MENU_RULES_SOTF_CRATE_AMOUNT", { + { + text = "@LUA_MENU_RULES_SOTF_1CRATE", + value = 1 + }, + { + text = "@LUA_MENU_RULES_SOTF_2CRATE", + value = 2 + }, + { + text = "@LUA_MENU_RULES_SOTF_3CRATE", + value = 3 + }, + { + text = "@LUA_MENU_RULES_SOTF_4CRATE", + value = 4 + }, + { + text = "@LUA_MENU_RULES_SOTF_5CRATE", + value = 5 + } + } ) + f29_local0[#f29_local0 + 1] = OptionFactory( "sotfData", "crateGunAmount", "@LUA_MENU_RULES_SOTF_CRATE_GUN", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_1GUN", + value = 1 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_3GUN", + value = 3 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_6GUN", + value = 6 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_9GUN", + value = 9 + } + } ) + f29_local0[#f29_local0 + 1] = OptionFactory( "sotfData", "crateDropTimer", "@LUA_MENU_RULES_SOTF_CRATE_TIMER", { + { + text = "@LUA_MENU_RULES_SOTF_CRATE_5SECOND", + value = 5 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_15SECOND", + value = 15 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_30SECOND", + value = 30 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_45SECOND", + value = 45 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_60SECOND", + value = 60 + } + } ) + end + if f29_local1 == SOTF_FFA_GameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "sotfFFAData", "crateAmount", "@LUA_MENU_RULES_SOTF_CRATE_AMOUNT", { + { + text = "@LUA_MENU_RULES_SOTF_1CRATE", + value = 1 + }, + { + text = "@LUA_MENU_RULES_SOTF_2CRATE", + value = 2 + }, + { + text = "@LUA_MENU_RULES_SOTF_3CRATE", + value = 3 + }, + { + text = "@LUA_MENU_RULES_SOTF_4CRATE", + value = 4 + }, + { + text = "@LUA_MENU_RULES_SOTF_5CRATE", + value = 5 + } + } ) + f29_local0[#f29_local0 + 1] = OptionFactory( "sotfFFAData", "crateGunAmount", "@LUA_MENU_RULES_SOTF_CRATE_GUN", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_1GUN", + value = 1 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_3GUN", + value = 3 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_6GUN", + value = 6 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_9GUN", + value = 9 + } + } ) + f29_local0[#f29_local0 + 1] = OptionFactory( "sotfFFAData", "crateDropTimer", "@LUA_MENU_RULES_SOTF_CRATE_TIMER", { + { + text = "@LUA_MENU_RULES_SOTF_CRATE_5SECOND", + value = 5 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_15SECOND", + value = 15 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_30SECOND", + value = 30 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_45SECOND", + value = 45 + }, + { + text = "@LUA_MENU_RULES_SOTF_CRATE_60SECOND", + value = 60 + } + } ) + end + if f29_local1 == SDGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "sdData", "multiBomb", "@LUA_MENU_RULES_MULTI_BOMB", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + } ) + end + if f29_local1 == SRGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "srData", "multiBomb", "@LUA_MENU_RULES_MULTI_BOMB", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + } ) + end + if f29_local1 == SDGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_1POINT", + value = 1 + }, + { + text = "@LUA_MENU_RULES_2POINTS", + value = 2 + }, + { + text = "@LUA_MENU_RULES_4POINTS", + value = 4 + }, + { + text = "@LUA_MENU_RULES_6POINTS", + value = 6 + }, + { + text = "@LUA_MENU_RULES_8POINTS", + value = 8 + }, + { + text = "@LUA_MENU_RULES_12POINTS", + value = 12 + } + } ) + end + if f29_local1 == SRGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_1POINT", + value = 1 + }, + { + text = "@LUA_MENU_RULES_2POINTS", + value = 2 + }, + { + text = "@LUA_MENU_RULES_4POINTS", + value = 4 + }, + { + text = "@LUA_MENU_RULES_6POINTS", + value = 6 + }, + { + text = "@LUA_MENU_RULES_8POINTS", + value = 8 + }, + { + text = "@LUA_MENU_RULES_12POINTS", + value = 12 + } + } ) + end + if f29_local1 == SDGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "sdData", "roundSwitch", "@LUA_MENU_RULES_ROUND_SWITCH", { + { + text = "@LUA_MENU_RULES_NEVER", + value = 0 + }, + { + text = "@LUA_MENU_RULES_EVERY_ROUND", + value = 1 + }, + { + text = "@LUA_MENU_RULES_EVERY_2ROUNDS", + value = 2 + }, + { + text = "@LUA_MENU_RULES_EVERY_3ROUNDS", + value = 3 + }, + { + text = "@LUA_MENU_RULES_EVERY_4ROUNDS", + value = 4 + } + } ) + end + if f29_local1 == SRGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "srData", "roundSwitch", "@LUA_MENU_RULES_ROUND_SWITCH", { + { + text = "@LUA_MENU_RULES_NEVER", + value = 0 + }, + { + text = "@LUA_MENU_RULES_EVERY_ROUND", + value = 1 + }, + { + text = "@LUA_MENU_RULES_EVERY_2ROUNDS", + value = 2 + }, + { + text = "@LUA_MENU_RULES_EVERY_3ROUNDS", + value = 3 + }, + { + text = "@LUA_MENU_RULES_EVERY_4ROUNDS", + value = 4 + } + } ) + end + if f29_local1 == DomGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_50POINTS", + value = 50 + }, + { + text = "@LUA_MENU_RULES_100POINTS", + value = 100 + }, + { + text = "@LUA_MENU_RULES_200POINTS", + value = 200 + }, + { + text = "@LUA_MENU_RULES_500POINTS", + value = 500 + }, + { + text = "@LUA_MENU_RULES_750POINTS", + value = 750 + } + } ) + end + if f29_local1 == ConfGameType or f29_local1 == GrindGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_10POINTS", + value = 10 + }, + { + text = "@LUA_MENU_RULES_30POINTS", + value = 30 + }, + { + text = "@LUA_MENU_RULES_65POINTS", + value = 65 + }, + { + text = "@LUA_MENU_RULES_80POINTS", + value = 80 + }, + { + text = "@LUA_MENU_RULES_100POINTS", + value = 100 + } + } ) + end + if f29_local1 == MuggerGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "timeLimit", "@LUA_MENU_RULES_TIME_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_3MINUTES", + value = 3 + }, + { + text = "@LUA_MENU_RULES_7MINUTES", + value = 7 + }, + { + text = "@LUA_MENU_RULES_10MINUTES", + value = 10 + }, + { + text = "@LUA_MENU_RULES_20MINUTES", + value = 20 + } + } ) + end + if f29_local1 == MuggerGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_1500POINTS", + value = 1500 + }, + { + text = "@LUA_MENU_RULES_2500POINTS", + value = 2500 + }, + { + text = "@LUA_MENU_RULES_5000POINTS", + value = 5000 + }, + { + text = "@LUA_MENU_RULES_7500POINTS", + value = 7500 + }, + { + text = "@LUA_MENU_RULES_10000POINTS", + value = 10000 + } + } ) + end + if f29_local1 == MuggerGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "muggerData", "bankLimit", "@LUA_MENU_RULES_MUGGER_BANK_LIMIT", { + { + text = "@LUA_MENU_1", + value = 1 + }, + { + text = "@LUA_MENU_5", + value = 5 + }, + { + text = "@LUA_MENU_10", + value = 10 + }, + { + text = "@LUA_MENU_20", + value = 20 + } + }, IsHardcoreModeFunc ) + end + if f29_local1 == MuggerGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "muggerData", "jackpotLimit", "@LUA_MENU_RULES_MUGGER_JACKPOT_LIMIT", { + { + text = "LUA_MENU_RULES_NONE", + value = 0 + }, + { + text = "LUA_MENU_RULES_HALF", + value = 100 + }, + { + text = "LUA_MENU_RULES_NORMAL", + value = 50 + }, + { + text = "LUA_MENU_RULES_DOUBLE", + value = 25 + } + }, IsHardcoreModeFunc ) + end + if f29_local1 == MuggerGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "muggerData", "throwKnifeFrac", "@LUA_MENU_RULES_MUGGER_THROW_KNIFE_FRAC", { + { + text = "LUA_MENU_RULES_NO_TAGS", + value = 0 + }, + { + text = "LUA_MENU_RULES_HALF_TAGS", + value = 0.5 + }, + { + text = "LUA_MENU_RULES_ALL_TAGS", + value = 1 + } + }, IsHardcoreModeFunc ) + end + if f29_local1 == InfectGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + } + }, f29_local2 ) + end + if f29_local1 == BlitzGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_4POINTS", + value = 4 + }, + { + text = "@LUA_MENU_RULES_6POINTS", + value = 6 + }, + { + text = "@LUA_MENU_RULES_10POINTS", + value = 10 + }, + { + text = "@LUA_MENU_RULES_16POINTS", + value = 16 + }, + { + text = "@LUA_MENU_RULES_20POINTS", + value = 20 + }, + { + text = "@LUA_MENU_RULES_30POINTS", + value = 30 + } + } ) + end + if f29_local1 == AliensGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_1000POINTS", + value = 1000 + }, + { + text = "@LUA_MENU_RULES_1500POINTS", + value = 1500 + }, + { + text = "@LUA_MENU_RULES_3000POINTS", + value = 3000 + }, + { + text = "@LUA_MENU_RULES_5000POINTS", + value = 5000 + }, + { + text = "@LUA_MENU_RULES_7000POINTS", + value = 7000 + } + } ) + end + if f29_local1 == SafeguardGameType then + f29_local0[#f29_local0 + 1] = OptionFactory( "hordeData", "difficulty", "@LUA_MENU_SAFEGUARD_MODE_TYPE", { + { + text = "@LUA_MENU_SAFEGUARD_DIFFICULTY_EASY", + value = 1 + }, + { + text = "@LUA_MENU_SAFEGUARD_DIFFICULTY_HARD", + value = 2 + }, + { + text = "@LUA_MENU_SAFEGUARD_DIFFICULTY_INFINITE", + value = 3 + } + } ) + end + if f29_local1 == SiegeGameType then + local f29_local3 = function () + return not MatchRules.GetData( "siegeData", "rushTimer" ) + end + + f29_local0[#f29_local0 + 1] = OptionFactory( "commonOption", "scoreLimit", "@LUA_MENU_RULES_SCORE_LIMIT", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_1POINT", + value = 1 + }, + { + text = "@LUA_MENU_RULES_2POINTS", + value = 2 + }, + { + text = "@LUA_MENU_RULES_4POINTS", + value = 4 + }, + { + text = "@LUA_MENU_RULES_6POINTS", + value = 6 + }, + { + text = "@LUA_MENU_RULES_8POINTS", + value = 8 + }, + { + text = "@LUA_MENU_RULES_12POINTS", + value = 12 + } + } ) + f29_local0[#f29_local0 + 1] = OptionFactory( "siegeData", "roundSwitch", "@LUA_MENU_RULES_ROUND_SWITCH", { + { + text = "@LUA_MENU_RULES_NEVER", + value = 0 + }, + { + text = "@LUA_MENU_RULES_EVERY_ROUND", + value = 1 + }, + { + text = "@LUA_MENU_RULES_EVERY_2ROUNDS", + value = 2 + }, + { + text = "@LUA_MENU_RULES_EVERY_3ROUNDS", + value = 3 + }, + { + text = "@LUA_MENU_RULES_EVERY_4ROUNDS", + value = 4 + } + } ) + f29_local0[#f29_local0 + 1] = OptionFactory( "siegeData", "roundLength", "@LUA_MENU_RULES_ROUND_LENGTH", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_1_5MINUTES", + value = 1.5 + }, + { + text = "@LUA_MENU_RULES_2_5MINUTES", + value = 2.5 + }, + { + text = "@LUA_MENU_RULES_3MINUTES", + value = 3 + }, + { + text = "@LUA_MENU_RULES_5MINUTES", + value = 5 + }, + { + text = "@LUA_MENU_RULES_8MINUTES", + value = 8 + } + } ) + f29_local0[#f29_local0 + 1] = OptionFactory( "siegeData", "capRate", "@LUA_MENU_MP_RULES_CAP_RATE", { + { + text = "@LUA_MENU_RULES_1SECOND", + value = 1 + }, + { + text = "@LUA_MENU_RULES_2_5SECONDS", + value = 2.5 + }, + { + text = "@LUA_MENU_RULES_5SECONDS", + value = 5 + }, + { + text = "@LUA_MENU_RULES_7_5SECONDS", + value = 7.5 + }, + { + text = "@LUA_MENU_RULES_10SECONDS", + value = 10 + } + } ) + f29_local0[#f29_local0 + 1] = OptionFactory( "siegeData", "rushTimer", "@LUA_MENU_MP_RULES_RUSH_TIMER", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + } ) + f29_local0[#f29_local0 + 1] = OptionFactory( "siegeData", "rushTimerAmount", "@LUA_MENU_MP_RULES_RUSH_TIMER_AMOUNT", { + { + text = "@LUA_MENU_RULES_30SECONDS", + value = 30 + }, + { + text = "@LUA_MENU_RULES_45SECONDS", + value = 45 + }, + { + text = "@LUA_MENU_RULES_1MINUTE", + value = 60 + } + }, f29_local3, { + rule_changed_siegeData_rushTimer = function ( f32_arg0, f32_arg1 ) + if f29_local3() then + f32_arg0:disable() + else + f32_arg0:enable() + end + end + } ) + f29_local0[#f29_local0 + 1] = OptionFactory( "siegeData", "preCapPoints", "@LUA_MENU_MP_RULES_PRE_CAP", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + } ) + end + if Engine.GetDvarBool( "xblive_competitionmatch" ) and (Engine.GetDvarBool( "systemlink" ) or IsPrivateMatch()) then + if not Engine.GetDvarInt( "scr_game_graceperiod_comp" ) then + Engine.Exec( "set scr_game_graceperiod_comp 60" ) + end + f29_local0[#f29_local0 + 1] = OptionFactoryDvarInt( "scr_game_graceperiod_comp", "@LUA_MENU_PREMATCH_COUNTDOWN", { + { + text = "@LUA_MENU_RULES_1MINUTE", + value = 60 + }, + { + text = "@LUA_MENU_RULES_15SECONDS", + value = 15 + }, + { + text = "@LUA_MENU_RULES_30SECONDS", + value = 30 + }, + { + text = "@LUA_MENU_RULES_45SECONDS", + value = 45 + } + } ) + end + return f29_local0 +end + +function PlayerOptionsFeeder() + local f33_local0 = {} + local f33_local1 = GetCurrentGameType() + if f33_local1 ~= SafeguardGameType and f33_local1 ~= InfectGameType then + f33_local0[#f33_local0 + 1] = OptionFactory( "commonOption", "numLives", "@LUA_MENU_RULES_NUMBER_OF_LIVES", { + { + text = "@LUA_MENU_RULES_UNLIMITED", + value = 0 + }, + { + text = "@LUA_MENU_RULES_ITEM_LIFE", + value = 1 + }, + { + text = "@LUA_MENU_RULES_ITEM_2LIVES", + value = 2 + }, + { + text = "@LUA_MENU_RULES_ITEM_3LIVES", + value = 3 + }, + { + text = "@LUA_MENU_RULES_ITEM_5LIVES", + value = 5 + }, + { + text = "@LUA_MENU_RULES_ITEM_9LIVES", + value = 9 + } + } ) + end + f33_local0[#f33_local0 + 1] = OptionFactory( "commonOption", "maxHealth", "@LUA_MENU_RULES_MAX_HEALTH", { + { + text = "@LUA_MENU_RULES_MINISCULE", + value = 30 + }, + { + text = "@LUA_MENU_RULES_HALF", + value = 50 + }, + { + text = "@LUA_MENU_RULES_NORMAL", + value = 100 + }, + { + text = "@LUA_MENU_MP_RULES_1_3_HEALTH", + value = 130 + }, + { + text = "@LUA_MENU_MP_RULES_1_5_HEALTH", + value = 150 + }, + { + text = "@LUA_MENU_RULES_DOUBLE", + value = 200 + } + }, IsHardcoreModeFunc ) + f33_local0[#f33_local0 + 1] = OptionFactory( "commonOption", "healthRegen", "@LUA_MENU_RULES_HEALTH_REGEN", { + { + text = "@LUA_MENU_RULES_NONE", + value = 0 + }, + { + text = "@LUA_MENU_RULES_SLOW", + value = 10 + }, + { + text = "@LUA_MENU_RULES_NORMAL", + value = 5 + }, + { + text = "@LUA_MENU_RULES_FAST", + value = 2 + } + }, IsHardcoreModeFunc ) + if f33_local1 ~= SafeguardGameType and f33_local1 ~= SOTFGameType and f33_local1 ~= SOTF_FFA_GameType and f33_local1 ~= GunGameType then + f33_local0[#f33_local0 + 1] = { + type = "UIGenericButton", + id = "create_default_classes", + disabledFunc = MLG.AreMLGRulesEnabled, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Info, + button_display_func = function ( f34_arg0, f34_arg1 ) + local f34_local0 = Cac.HasCustomClasses( 0, "privateMatchSquadMembers", 0, "defaultClassesTeam1" ) + if not f34_local0 then + f34_local0 = Cac.HasCustomClasses( 0, "privateMatchSquadMembers", 0, "defaultClassesTeam2" ) + end + local f34_local1 + if f34_local0 then + f34_local1 = Engine.Localize( "MENU_CUSTOM" ) + if not f34_local1 then + + else + return f34_local1 + end + end + f34_local1 = Engine.Localize( "MENU_NONE" ) + end, + button_text = Engine.Localize( "@LUA_MENU_RULES_EDIT_DEF_CLASSES" ), + button_action_func = CreateDefaultClassesAction, + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + } + end + return f33_local0 +end + +function TeamOptionsFeeder() + local f35_local0 = {} + local f35_local1 = GetCurrentGameType() + f35_local0[#f35_local0 + 1] = OptionFactory( "commonOption", "spectateModeAllowed", "@LUA_MENU_RULES_SPECTATING", { + { + text = "@LUA_MENU_DISABLED", + value = 0 + }, + { + text = IsCurrentGameTypeteamBased() and "@LUA_MENU_RULES_TEAM_ONLY" or "@LUA_MENU_RULES_PLAYERS_ONLY", + value = 1 + }, + { + text = "@LUA_MENU_RULES_FREE", + value = 2 + } + } ) + f35_local0[#f35_local0 + 1] = OptionFactory( "commonOption", "showKillcam", "@LUA_MENU_RULES_KILLCAM", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, IsHardcoreModeFunc ) + f35_local0[#f35_local0 + 1] = OptionFactory( "commonOption", "radarAlwaysOn", "@LUA_MENU_RULES_RADAR_ALWAYS_ON", { + { + text = "@LUA_MENU_NO", + value = false + }, + { + text = "@LUA_MENU_YES", + value = true + } + }, IsHardcoreModeFunc ) + if f35_local1 ~= InfectGameType and f35_local1 ~= GunGameType then + f35_local0[#f35_local0 + 1] = OptionFactory( "commonOption", "respawnDelay", "@LUA_MENU_RULES_RESPAWN_DELAY", { + { + text = "@LUA_MENU_RULES_NONE", + value = 0 + }, + { + text = "@LUA_MENU_RULES_5SECONDS", + value = 5 + }, + { + text = "@LUA_MENU_RULES_7_5SECONDS", + value = 7.5 + }, + { + text = "@LUA_MENU_RULES_10SECONDS", + value = 10 + }, + { + text = "@LUA_MENU_RULES_15SECONDS", + value = 15 + }, + { + text = "@LUA_MENU_RULES_30SECONDS", + value = 30 + } + } ) + f35_local0[#f35_local0 + 1] = OptionFactory( "commonOption", "waveRespawnDelay", "@LUA_MENU_RULES_WAVE_DELAY", { + { + text = "@LUA_MENU_RULES_NONE", + value = 0 + }, + { + text = "@LUA_MENU_RULES_5SECONDS", + value = 5 + }, + { + text = "@LUA_MENU_RULES_10SECONDS", + value = 10 + }, + { + text = "@LUA_MENU_RULES_15SECONDS", + value = 15 + }, + { + text = "@LUA_MENU_RULES_30SECONDS", + value = 30 + } + } ) + f35_local0[#f35_local0 + 1] = OptionFactory( "commonOption", "forceRespawn", "@LUA_MENU_RULES_FORCE_RESPAWN", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + } ) + if IsCurrentGameTypeteamBased() then + f35_local0[#f35_local0 + 1] = OptionFactory( "commonOption", "friendlyFire", "@LUA_MENU_RULES_FRIENDLY_FIRE", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, IsHardcoreModeFunc ) + end + end + if MLG.AreMLGRulesEnabled() then + f35_local0[#f35_local0 + 1] = OptionFactoryUserString( "commonOption", "ghostsTeamName", "@LUA_MENU_MP_GHOSTS_TEAM_NAME_OVERRIDE", "@LUA_MENU_ALLIES_CAPS", 12 ) + f35_local0[#f35_local0 + 1] = OptionFactoryUserString( "commonOption", "fedTeamName", "@LUA_MENU_MP_FEDERATION_TEAM_NAME_OVERRIDE", "@LUA_MENU_AXIS_CAPS", 12 ) + end + return f35_local0 +end + +function GameplayOptionsFeeder( f36_arg0 ) + local f36_local0 = {} + local f36_local1 = GetCurrentGameType() + local f36_local2 = function () + local f37_local0 + if not SvS.IsSvS() then + f37_local0 = MatchRules.GetData( "commonOption", "allowCustomClasses" ) + else + f37_local0 = false + end + return f37_local0 + end + + if f36_local1 ~= InfectGameType and f36_local1 ~= GunGameType then + f36_local0[#f36_local0 + 1] = OptionFactory( "commonOption", "allowPerks", "@LUA_MENU_RULES_PERKS", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + } ) + end + f36_local0[#f36_local0 + 1] = OptionFactory( "commonOption", "hardcoreModeOn", "@LUA_MENU_RULES_HARDCORE", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, nil, { + rule_changed_commonOption_hardcoreModeOn = function () + if IsHardcoreModeFunc() then + if f36_local1 == MuggerGameType then + MatchRules.SetData( "muggerData", "bankLimit", 10 ) + MatchRules.SetData( "muggerData", "jackpotLimit", 0 ) + MatchRules.SetData( "muggerData", "throwKnifeFrac", 1 ) + end + MatchRules.SetData( "commonOption", "friendlyFire", true ) + MatchRules.SetData( "commonOption", "maxHealth", 30 ) + MatchRules.SetData( "commonOption", "respawnDelay", 10 ) + MatchRules.SetData( "commonOption", "showKillcam", false ) + MatchRules.SetData( "commonOption", "radarAlwaysOn", false ) + MatchRules.SetData( "commonOption", "healthRegen", 0 ) + end + end + } ) + f36_local0[#f36_local0 + 1] = OptionFactory( "commonOption", "headshotsOnly", "@LUA_MENU_RULES_HEADSHOTS_ONLY", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + } ) + if f36_local1 ~= SOTFGameType and f36_local1 ~= SOTF_FFA_GameType and f36_local1 ~= InfectGameType and f36_local1 ~= GunGameType then + f36_local0[#f36_local0 + 1] = OptionFactory( "commonOption", "allowKillstreaks", "@LUA_MENU_RULES_KILLSTREAKS", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + } ) + f36_local0[#f36_local0 + 1] = OptionFactory( "commonOption", "allowIntel", "@LUA_MENU_RULES_INTEL", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + } ) + if not SvS.IsSvS() and f36_local1 ~= SOTFGameType and f36_local1 ~= SOTF_FFA_GameType and f36_local1 ~= InfectGameType then + f36_local0[#f36_local0 + 1] = OptionFactory( "commonOption", "allowCustomClasses", "@LUA_MENU_RULES_CUSTOM_CLASSES", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + } ) + f36_local0[#f36_local0 + 1] = { + type = "UIGenericButton", + id = "restrict_classes", + disabledFunc = function () + return not f36_local2() + end, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Info, + button_display_func = function ( f40_arg0, f40_arg1 ) + local f40_local0 = MatchRules.AllowCustomClasses() + if f40_local0 then + f40_local0 = Cac.CheckWeaponRestrictions( "Primary", f36_arg0 ) + if not f40_local0 then + f40_local0 = Cac.CheckWeaponRestrictions( "Secondary", f36_arg0 ) + if not f40_local0 then + f40_local0 = Cac.CheckAttachmentRestrictionsHelper() + if not f40_local0 then + f40_local0 = Cac.CheckGrenadeRestrictions( 0 ) + if not f40_local0 then + f40_local0 = Cac.CheckGrenadeRestrictions( 1 ) + if not f40_local0 then + f40_local0 = Cac.CheckKillstreakRestrictions() + if not f40_local0 then + f40_local0 = Cac.CheckPerkRestrictions() + end + end + end + end + end + end + end + local f40_local1 + if f40_local0 then + f40_local1 = Engine.Localize( "MENU_CUSTOM" ) + if not f40_local1 then + + else + return f40_local1 + end + end + f40_local1 = Engine.Localize( "MENU_NONE" ) + end, + button_text = Engine.Localize( "@LUA_MENU_RULES_CLASS_RESTRICT" ), + button_action_func = RestrictCustomClassesAction, + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left + }, + handlers = { + rule_changed_commonOption_allowCustomClasses = function ( f41_arg0, f41_arg1 ) + if f36_local2() then + f41_arg0:enable() + else + f41_arg0:disable() + end + end, + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + } + end + end + return f36_local0 +end + +function OptionsFeeder() + local f42_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "settings_recipe_rules_base" ) + local f42_local1 = f42_local0.currentOptionsCategory + if f42_local1 == "gameplay_options" then + return GameplayOptionsFeeder( f42_local0.exclusiveController ) + elseif f42_local1 == "team_options" then + return TeamOptionsFeeder() + elseif f42_local1 == "player_options" then + return PlayerOptionsFeeder() + else + return GameOptionsFeeder() + end +end + +function OptionCategoryButtonOver( f43_arg0, f43_arg1 ) + local f43_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f43_arg0 ) + f43_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + OptionsWindowTriggerRefresh( f43_arg0, f43_arg1 ) +end + +function OptionsWindowTriggerRefresh( f44_arg0, f44_arg1 ) + f44_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f44_arg1.name, + options_category = f44_arg0.properties.options_category, + focusType = f44_arg1.focusType, + source_button = f44_arg0, + immediate = true + } ) +end + +function OptionCategoryButtonAction( f45_arg0, f45_arg1 ) + local f45_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f45_arg0 ) + OptionsWindowTriggerRefresh( f45_arg0, f45_arg1 ) + local f45_local1 = f45_arg0:getParent() + f45_local1:dispatchEventToChildren( { + name = "button_unlock", + immediate = true + } ) + if not f45_arg1.mouse then + f45_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f45_arg0 ) + f45_local1.currentBackButtonAction = GetLeaveOptionsWindowFunctionForButton( f45_arg0 ) + f45_arg0:dispatchEventToRoot( { + name = "options_window_focus", + immediate = true + } ) + f45_arg0:dispatchEventToRoot( { + name = "options_categories_window_unfocus", + immediate = true + } ) + end + f45_arg0:processEvent( { + name = "button_lock" + } ) + f45_local0.unlocked = false +end + +function OptionsWindowRefresh( f46_arg0, f46_arg1 ) + if not (not Engine.IsConsoleGame() or f46_arg1.source_input ~= "button_over") or not (Engine.IsConsoleGame() or f46_arg1.source_input ~= "button_action") or not Engine.IsConsoleGame() and f46_arg1.source_input == "button_over" and f46_arg1.focusType ~= FocusType.MouseOver then + local f46_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f46_arg0 ) + f46_arg0:processEvent( { + name = "pre_menu_refresh", + options_category = f46_arg1.options_category + } ) + f46_arg0:processEvent( { + name = "menu_refresh" + } ) + f46_arg0:processEvent( { + name = "refresh_content" + } ) + OptionsWindowResize( f46_arg0, f46_arg1 ) + OptionsWindowTitleUpdate( f46_arg0, f46_arg1 ) + if not f46_local0.unlocked then + f46_local0.unlocked = true + f46_arg0:dispatchEventToRoot( { + name = "button_unlock", + immediate = true + } ) + f46_arg1.source_button:processEvent( { + name = "gain_focus", + immediate = true + } ) + end + end +end + +function OptionsWindowTitleUpdate( f47_arg0, f47_arg1 ) + local f47_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f47_arg0 ) + local f47_local1 = f47_local0.currentOptionsCategory + local f47_local2 = "" + if f47_local1 == "gameplay_options" then + f47_local2 = Engine.Localize( "@LUA_MENU_RULES_GAMEPLAY_OPTIONS" ) + elseif f47_local1 == "team_options" then + f47_local2 = Engine.Localize( "@LUA_MENU_RULES_TEAM_OPTIONS" ) + elseif f47_local1 == "player_options" then + f47_local2 = Engine.Localize( "@LUA_MENU_RULES_PLAYER_OPTIONS" ) + else + f47_local2 = Engine.Localize( "@LUA_MENU_GAME_RULES" ) + end + f47_arg0:processEvent( { + name = "update_title", + title_text = f47_local2 + } ) +end + +function PrepareMenuRefresh( f48_arg0, f48_arg1 ) + f48_arg0:closeChildren() + f48_arg0:clearSavedState() + local f48_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f48_arg0 ) + if f48_arg1.options_category then + f48_local0.currentOptionsCategory = f48_arg1.options_category + end +end + +function OptionsWindowResize( f49_arg0, f49_arg1 ) + local f49_local0 = f49_arg0 + local f49_local1 = f49_arg0.processEvent + local f49_local2 = { + name = "window_resize" + } + local f49_local3 = f49_arg0:getChildById( "gamesetup_options_window_content" ) + f49_local2.options = f49_local3.childRecord + f49_local1( f49_local0, f49_local2 ) +end + +function OptionsWindowBGResize( f50_arg0, f50_arg1 ) + f50_arg0:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight, + bottom = GenericTitleBarDims.TitleBarHeight + count( f50_arg1.options ) * (GenericButtonSettings.Styles.GlassButton.SubStyles.Default.height + GAMESETUP_OPTIONS_WINDOW_SPACING) + 2 * GAMESETUP_OPTIONS_WINDOW_PADDING, + left = 0, + right = 0 + } ) + f50_arg0:animateToState( "current", 0 ) +end + +function OptionsWindowShadowResize( f51_arg0, f51_arg1 ) + f51_arg0:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = GenericTitleBarDims.TitleBarHeight + count( f51_arg1.options ) * (GenericButtonSettings.Styles.GlassButton.SubStyles.Default.height + GAMESETUP_OPTIONS_WINDOW_SPACING) + 2 * GAMESETUP_OPTIONS_WINDOW_PADDING + } ) + f51_arg0:animateToState( "current", 0 ) +end + +function LockCurrentButton( f52_arg0, f52_arg1 ) + local f52_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f52_arg0 ) + local f52_local1 = f52_arg0:getChildById( f52_local0.currentOptionsCategory ) + if f52_local1 then + f52_local1:processEvent( { + name = "button_lock" + } ) + f52_local0.unlocked = false + end +end + +function CategoriesFeeder( f53_arg0 ) + local f53_local0 = {} + local f53_local1 = GetCurrentGameType() + f53_local0[#f53_local0 + 1] = { + type = "UIGenericButton", + id = "game_options", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + substyle = GenericButtonSettings.Styles.FlatButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_GAME_RULES" ), + options_category = "game_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction + } + } + f53_local0[#f53_local0 + 1] = { + type = "UIGenericButton", + id = "player_options", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + substyle = GenericButtonSettings.Styles.FlatButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_RULES_PLAYER_OPTIONS" ), + options_category = "player_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction + } + } + if f53_local1 ~= SafeguardGameType then + f53_local0[#f53_local0 + 1] = { + type = "UIGenericButton", + id = "team_options", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + substyle = GenericButtonSettings.Styles.FlatButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_RULES_TEAM_OPTIONS" ), + options_category = "team_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction + } + } + end + if f53_local1 ~= SafeguardGameType then + f53_local0[#f53_local0 + 1] = { + type = "UIGenericButton", + id = "gameplay_options", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + substyle = GenericButtonSettings.Styles.FlatButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_RULES_GAMEPLAY_OPTIONS" ), + options_category = "gameplay_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction + } + } + end + f53_local0[#f53_local0 + 1] = { + type = "UIGenericButton", + id = "reset_options", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + substyle = GenericButtonSettings.Styles.FlatButton.SubStyles.SubMenu, + button_text = Engine.Localize( "LUA_MENU_SET_DEFAULT_CONTROLS" ) + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = function ( f54_arg0, f54_arg1 ) + LUI.FlowManager.RequestPopupMenu( f54_arg0, "popup_reset_game_options", true, f54_arg1.controller ) + end + } + } + return f53_local0 +end + +function gamesetup_options_categories() + return { + type = "UIElement", + id = "gamesetup_options_categories_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 120, + height = 500, + left = 134, + width = 270 + } + }, + handlers = { + options_categories_window_focus = MBh.EmitEvent( "gain_focus" ), + options_categories_window_unfocus = MBh.EmitEvent( "lose_focus" ) + }, + children = { + { + type = "generic_menu_background_withfade", + properties = { + top_offset = 0 + } + }, + { + type = "UIElement", + id = "padding", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIVerticalList", + id = "options_categories_vlist", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 1, + right = -1, + top = 1, + bottom = 0, + spacing = 0 + } + }, + handlers = { + menu_create = LockCurrentButton + }, + childrenFeeder = CategoriesFeeder + }, + { + type = "UIImage", + id = "game_mode_icon", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 173, + width = 256, + height = 256, + material = GetGameTypeIcon() + } + } + }, + { + type = "UIText", + id = "game_mode_description", + properties = { + text = GetCurrentGameTypeLocalizedInfo( GameTypeDescCol ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 393, + height = CoD.TextSettings.NormalFont.Height, + left = 20, + right = -20, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + } + } + } + } + } +end + +GAMESETUP_OPTIONS_WINDOW_PADDING = 1 +GAMESETUP_OPTIONS_WINDOW_SPACING = 2 +function gamesetup_options_window() + return { + type = "UIElement", + id = "gamesetup_options_window_id", + properties = { + options_category = "game_options" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 120, + bottom = 219, + left = 460, + right = 1040 + } + }, + handlers = { + options_window_force_resize = OptionsWindowResize, + menu_create = OptionsWindowResize, + options_window_title_update = OptionsWindowTitleUpdate, + options_window_refresh = OptionsWindowRefresh, + options_window_focus = MBh.EmitEvent( "gain_focus" ), + options_window_unfocus = MBh.EmitEvent( "lose_focus" ), + mlg_enabled = function ( f57_arg0, f57_arg1 ) + f57_arg0:processEvent( { + name = "menu_refresh" + } ) + end + , + mlg_disabled = function ( f58_arg0, f58_arg1 ) + f58_arg0:processEvent( { + name = "menu_refresh" + } ) + end + , + text_input_complete = function ( f59_arg0, f59_arg1 ) + local f59_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f59_arg0 ) + if not f59_arg1.text then + f59_local0.OnscreenKeyboardListener = nil + return + end + assert( f59_local0.OnscreenKeyboardListener ) + if f59_local0.OnscreenKeyboardListener then + f59_local0.OnscreenKeyboardListener:processEvent( { + name = "set_string_option_value", + text = f59_arg1.text, + controller = f59_arg1.controller + } ) + f59_local0.OnscreenKeyboardListener = nil + end + end + + }, + children = { + { + type = "generic_drop_shadow", + id = "gamesetup_options_window_shadow", + properties = { + offset_shadow = 0 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0.75 + } + }, + handlers = { + window_resize = OptionsWindowShadowResize + } + }, + { + type = "generic_menu_titlebar", + id = "gamesetup_options_window_title", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = "", + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left + }, + handlers = { + menu_create = MBh.EmitEventToParent( "options_window_title_update" ) + } + }, + { + type = "generic_menu_background", + id = "gamesetup_options_window_background", + handlers = { + window_resize = OptionsWindowBGResize + } + }, + { + type = "UIVerticalList", + id = "gamesetup_options_window_content", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + GAMESETUP_OPTIONS_WINDOW_PADDING, + bottom = 600, + left = GAMESETUP_OPTIONS_WINDOW_PADDING, + right = -GAMESETUP_OPTIONS_WINDOW_PADDING, + spacing = GAMESETUP_OPTIONS_WINDOW_SPACING + } + }, + handlers = { + pre_menu_refresh = PrepareMenuRefresh + }, + childrenFeeder = OptionsFeeder + } + } + } +end + +function gamesetup_options() + return { + type = "UIElement", + id = "gamesetup_options_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = GameSetupOptionsMainCreate, + update_timer = MLG.Refresh, + popup_inactive = function ( f61_arg0, f61_arg1 ) + f61_arg0.properties = f61_arg0.properties or {} + f61_arg0.properties.cacheMLGenabled = nil + MLG.Refresh( f61_arg0, f61_arg1 ) + end + + }, + children = { + { + type = "UITimer", + id = "update_timer", + properties = { + event = "update_timer", + disposable = false, + interval = 200 + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.Alpha + } ) + } + }, + { + type = "generic_menu_title", + properties = { + menu_title = GetCurrentGameTypeLocalizedInfo( GameTypeNameCol ) + } + }, + { + type = "gamesetup_options_window", + id = "gamesetup_options_window_id" + }, + { + type = "gamesetup_options_categories", + id = "gamesetup_options_categories_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = BackButtonAction, + button_alt1 = SaveRecipeToMyModes, + button_start = function ( f62_arg0, f62_arg1 ) + local f62_local0 = f62_arg0:getParent() + MLG.Toggle( f62_local0, f62_arg1 ) + f62_local0:processEvent( { + name = "options_window_force_resize" + } ) + end + + } + } + } + } +end + +function GameSetupOptionsMainCreate( f63_arg0, f63_arg1 ) + local f63_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f63_arg0 ) + if not f63_local0.currentBackButtonAction then + f63_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + end + if Engine.IsGamepadEnabled() == 1 and not Engine.IsConsoleGame() then + f63_local0.currentBackButtonAction = GetLeaveOptionsWindowFunctionForButton( f63_arg0:getChildById( "game_options" ) ) + end + f63_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) + f63_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_RECIPE_SAVE_CUSTOM" ) or "", + side = "left", + clickable = true + } ) + MLG.Refresh( f63_arg0 ) +end + +LUI.MenuBuilder.registerDef( "gamesetup_options_categories", gamesetup_options_categories ) +LUI.MenuBuilder.registerDef( "gamesetup_options_window", gamesetup_options_window ) +LUI.MenuBuilder.registerDef( "settings_recipe_rules_base", gamesetup_options ) +LockTable( _M ) diff --git a/lui/mp_menus/mpleaderboard.dec.lua b/lui/mp_menus/mpleaderboard.dec.lua new file mode 100644 index 0000000..897743f --- /dev/null +++ b/lui/mp_menus/mpleaderboard.dec.lua @@ -0,0 +1,1516 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function LeaderboardPop() + Leaderboards.Clear() +end + +function LeaderboardButtonSetFocusable( f2_arg0, f2_arg1 ) + if f2_arg0.properties.focusable then + f2_arg0:makeFocusable() + else + f2_arg0:makeNotFocusable() + end +end + +function LeaderboardListRowFeeder( f3_arg0 ) + local f3_local0 = { + [#f3_local0 + 1] = { + type = "UIImage", + id = "leaderboard_header_bg", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = Leaderboards.Layout.HeaderHeight, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = 0.05 + } + } + } + } + for f3_local1 = 1, Leaderboards.Layout.NumRows, 1 do + local f3_local4 = 0.15 + if f3_local1 % 2 == 1 then + f3_local4 = 0 + end + f3_local0[#f3_local0 + 1] = { + type = "UIImage", + id = "leaderboard_row_bg_" .. f3_local1, + states = { + default = CoD.ColorizeState( Colors.black, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = Leaderboards.Layout.RowHeight, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = f3_local4 + } ) + }, + id = "leaderboard_line_button_" .. f3_local1 + } + end + return f3_local0 +end + +function LeaderboardHeaderRowFeeder( f4_arg0 ) + local f4_local0 = {} + local f4_local1 = Leaderboards.GetLeaderboardNumColumns( "Common" ) + local f4_local2 = f4_local1 + Leaderboards.GetLeaderboardNumColumns( f4_arg0.leaderboardType ) + local f4_local3 = {} + for f4_local4 = 1, f4_local1, 1 do + f4_local3[f4_local4] = Engine.Localize( Leaderboards.GetLeaderboardHeaderName( "Common", f4_local4 ) ) + end + for f4_local4 = 1, Leaderboards.GetLeaderboardNumColumns( f4_arg0.leaderboardType ), 1 do + f4_local3[f4_local1 + f4_local4] = Engine.Localize( Leaderboards.GetLeaderboardHeaderName( f4_arg0.leaderboardType, f4_local4 ) ) + end + local f4_local4 = {} + for f4_local5 = 1, f4_local1, 1 do + f4_local4[f4_local5] = Leaderboards.GetLeaderboardColumnWidth( "Common", f4_local5 ) + end + for f4_local5 = 1, Leaderboards.GetLeaderboardNumColumns( f4_arg0.leaderboardType ), 1 do + f4_local4[f4_local1 + f4_local5] = Leaderboards.GetLeaderboardColumnWidth( f4_arg0.leaderboardType, f4_local5 ) + end + for f4_local5 = 1, f4_local2, 1 do + f4_local0[#f4_local0 + 1] = { + type = "UIText", + id = "leaderboard_header_name_" .. f4_local5, + properties = { + text = f4_local3[f4_local5] + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -CoD.TextSettings.SmallFont.Height - 10, + bottom = -10, + left = 0, + right = f4_local4[f4_local5], + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.SmallFont.Font, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } + } + } + end + return f4_local0 +end + +function LeaderboardPlayerRowFeeder( f5_arg0 ) + local f5_local0 = {} + local f5_local1 = Leaderboards.GetLeaderboardNumColumns( "Common" ) + local f5_local2 = f5_local1 + Leaderboards.GetLeaderboardNumColumns( f5_arg0.leaderboardType ) + local f5_local3 = {} + for f5_local4 = 1, f5_local1, 1 do + f5_local3[f5_local4] = Leaderboards.GetLeaderboardColumnWidth( "Common", f5_local4 ) + end + for f5_local4 = 1, Leaderboards.GetLeaderboardNumColumns( f5_arg0.leaderboardType ), 1 do + f5_local3[f5_local1 + f5_local4] = Leaderboards.GetLeaderboardColumnWidth( f5_arg0.leaderboardType, f5_local4 ) + end + local f5_local4 = {} + for f5_local5 = 1, f5_local1, 1 do + f5_local4[f5_local5] = Leaderboards.GetLeaderboardDataColumnIndex( "Common", f5_local5 ) + end + for f5_local5 = 1, Leaderboards.GetLeaderboardNumColumns( f5_arg0.leaderboardType ), 1 do + f5_local4[f5_local1 + f5_local5] = Leaderboards.GetLeaderboardDataColumnIndex( f5_arg0.leaderboardType, f5_local5 ) + end + for f5_local5 = 1, f5_local2, 1 do + local f5_local8 = {} + if f5_local4[f5_local5] == 1 then + local f5_local9 = f5_arg0.exclusiveController + if not f5_local9 then + f5_local9 = Engine.GetFirstActiveController() + end + local f5_local10 = Leaderboards.GetPlayerValue( f5_local9, f5_local4[f5_local5] ) + local f5_local11 = Leaderboards.GetPlayerValue( f5_local9, f5_local4[f5_local5] + 1 ) + if f5_local11 == nil then + f5_local11 = "" + end + f5_local0[#f5_local0 + 1] = { + type = "UIText", + id = "leaderboard_cell_value_player_rank_" .. f5_local5, + properties = { + text = f5_local11 + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -CoD.TextSettings.NormalFont.Height, + bottom = 0, + left = 0, + right = 0.5 * f5_local3[f5_local5], + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b + } + } + } + local f5_local12 = 1 + if f5_local10 == nil or f5_local10 == "" then + f5_local12 = 0 + end + f5_local0[#f5_local0 + 1] = { + type = "UIImage", + id = "leaderboard_cell_value_player_rankicon_" .. f5_local5, + properties = { + columnIndex = f5_local4[f5_local5] + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 0, + width = 24, + height = 24, + material = RegisterMaterial( f5_local10 ), + animateOnRefresh = true, + alpha = f5_local12 + } + } + } + f5_local0[#f5_local0 + 1] = { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = treu, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f5_local3[f5_local5] * 0.5 - 24, + alpha = 0 + } + } + } + end + local f5_local9 = f5_arg0.exclusiveController + if not f5_local9 then + f5_local9 = Engine.GetFirstActiveController() + end + local f5_local10 = Leaderboards.GetPlayerValue( f5_local9, f5_local4[f5_local5] ) + if f5_local10 == nil then + f5_local10 = "" + end + local f5_local11 = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r + local f5_local13 = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g + local f5_local12 = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b + if f5_local4[f5_local5] == 3 then + f5_local0[#f5_local0 + 1] = { + type = "mp_leaderboard_cell_marquee_value", + id = "leaderboard_cell_value_player_" .. f5_local5, + properties = { + text = f5_local10, + columnWidth = f5_local3[f5_local5] - 10, + red = f5_local11, + green = f5_local13, + blue = f5_local12 + } + } + f5_local0[#f5_local0 + 1] = { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 10, + alpha = 0 + } + } + } + else + f5_local0[#f5_local0 + 1] = { + type = "mp_leaderboard_cell_value", + id = "leaderboard_cell_value_player_" .. f5_local5, + properties = { + text = f5_local10, + columnWidth = f5_local3[f5_local5], + red = f5_local11, + green = f5_local13, + blue = f5_local12 + } + } + end + end + return f5_local0 +end + +function mp_leaderboard_cell_value() + return { + type = "UIText", + id = "mp_leaderboard_cell_value", + properties = { + text = "", + columnWidth = 100, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -CoD.TextSettings.NormalFont.Height, + bottom = 0, + left = 0, + right = MBh.Property( "columnWidth" ), + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + red = MBh.Property( "red" ), + green = MBh.Property( "green" ), + blue = MBh.Property( "blue" ) + }, + hilite = { + red = 0, + green = 0, + blue = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "hilite" ), + button_up = MBh.AnimateToState( "default" ) + } + } +end + +function HandleLeaderboardCellMarqueeSetHilite( f7_arg0, f7_arg1 ) + f7_arg0:SetColor( 0, 0, 0 ) +end + +function HandleLeaderboardCellMarqueeSetNotHilite( f8_arg0, f8_arg1 ) + local f8_local0 = f8_arg0.properties + f8_arg0:SetColor( f8_local0.red, f8_local0.green, f8_local0.blue ) +end + +function mp_leaderboard_cell_marquee_value() + return { + type = "UIMarqueeText", + id = "mp_leaderboard_cell_marquee_value", + properties = { + text = "", + columnWidth = 100, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -CoD.TextSettings.NormalFont.Height, + bottom = 0, + left = 0, + right = MBh.Property( "columnWidth" ), + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + red = MBh.Property( "red" ), + green = MBh.Property( "green" ), + blue = MBh.Property( "blue" ) + } + }, + handlers = { + button_over = HandleLeaderboardCellMarqueeSetHilite, + button_up = HandleLeaderboardCellMarqueeSetNotHilite + } + } +end + +f0_local0 = function ( f10_arg0, f10_arg1 ) + local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 ) + f10_arg0:processEvent( { + name = "lose_focus" + } ) + f10_arg0:clearSavedState() + local f10_local1 = false + local f10_local2 = f10_arg0:getFirstChild() + while f10_local2 do + local self = f10_local2:getNextSibling() + if f10_local2.properties and f10_local2.properties.rankIndex and f10_local2.properties.rankIndex == f10_local0.newRankIndex then + f10_local1 = true + f10_local2.listDefaultFocus = true + else + f10_local2.listDefaultFocus = false + end + f10_local2 = self + end + if not f10_local1 then + local self = f10_arg0:getFirstChild() + while self do + local f10_local4 = self:getNextSibling() + if self.properties and self.properties.rowIndex and self.properties.rowIndex == 1 then + self.listDefaultFocus = true + else + self.listDefaultFocus = false + end + self = f10_local4 + end + end + Leaderboards.UpdateCurrentIndex( f10_arg1.controller, f10_local0.newRankIndex ) + Leaderboards.UpdateLeaderboard( f10_arg1.controller, f10_local0.newRankIndex ) + if f10_local0.readDelayFail then + if f10_arg0:getChildById( "leaderboard_changeindex_timer_id" ) == nil then + local self = LUI.UITimer.new( 50, { + name = "try_change_index", + controller = f10_arg1.controller + } ) + self.id = "leaderboard_changeindex_timer_id" + f10_arg0:addElement( self ) + end + f10_local0.readDelayFail = false + else + local self = f10_arg0:getChildById( "leaderboard_changeindex_timer_id" ) + if self then + self:close() + end + f10_arg0:processEvent( { + name = "leaderboard_refresh" + } ) + end +end + +f0_local1 = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3 ) + local f11_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f11_arg0 ) + f11_local0.currentRankIndex = f11_arg3 + f11_local0.newRankIndex = f11_arg2 + f11_arg0:processEvent( { + name = "try_change_index", + controller = f11_arg1 + } ) +end + +function HandleLeaderboardWrap( f12_arg0, f12_arg1 ) + local f12_local0 = f12_arg0.properties.exclusiveController + if not f12_local0 then + f12_local0 = Engine.GetFirstActiveController() + end + f0_local1( f12_arg0:getParent(), f12_local0, f12_arg0.properties.index, Leaderboards.GetCurrentIndex( f12_local0 ) ) +end + +function LeaderboardSelectAction( f13_arg0, f13_arg1 ) + if Engine.IsPS3() or Engine.IsPS4() then + return + end + local f13_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + f13_local0.selectedRowIndex = f13_arg0.properties.rankIndex + local f13_local1 = f13_arg0.properties.exclusiveController + if not f13_local1 then + f13_local1 = Engine.GetFirstActiveController() + end + Leaderboards.UpdateCurrentIndex( f13_local1, f13_arg0.properties.rankIndex ) + Leaderboards.OnSelect( f13_local1 ) +end + +f0_local2 = function ( f14_arg0, f14_arg1 ) + local f14_local0 = Engine.GetLuiRoot() + local f14_local1 = "" + if f14_local0 then + local f14_local2 = LUI.FlowManager.GetTopMenuInfo( f14_local0.flowManager.menuInfoStack ) + if f14_local2 and f14_local2.name then + f14_local1 = f14_local2.name + end + end + if f14_local1 == "mp_leaderboard_main" and f14_arg1.down == true then + local f14_local2 = f14_arg0.properties.exclusiveController + if not f14_local2 then + f14_local2 = Engine.GetFirstActiveController() + end + local f14_local3 = Leaderboards.GetCurrentIndex( f14_local2 ) + local f14_local4 = Leaderboards.GetPlayerCount() + local f14_local5 + if f14_arg1.button ~= "dpad_up" and f14_arg1.button ~= "page_up" and (f14_arg1.button ~= "up" or f14_arg1.qualifier ~= "dpad") then + f14_local5 = false + else + f14_local5 = true + end + local f14_local6 + if f14_arg1.button ~= "dpad_down" and f14_arg1.button ~= "page_down" and (f14_arg1.button ~= "down" or f14_arg1.qualifier ~= "dpad") then + f14_local6 = false + else + f14_local6 = true + end + if f14_local5 then + if Leaderboards.IsUpdating and Leaderboards.IsUpdating() then + return true + elseif f14_local4 <= 0 then + return true + elseif f14_local3 == 0 then + return true + end + local self = f14_local3 - Leaderboards.Layout.NumRows - 1 + if self < 0 then + self = 0 + end + f0_local1( f14_arg0, f14_local2, self, f14_local3 ) + return true + elseif f14_local6 then + if Leaderboards.IsUpdating and Leaderboards.IsUpdating() then + return true + elseif f14_local4 <= 0 then + return true + elseif f14_local3 == f14_local4 - 1 then + return true + end + local self = f14_local3 + Leaderboards.Layout.NumRows - 1 + if f14_local4 - 1 < self then + self = f14_local4 - 1 + end + f0_local1( f14_arg0, f14_local2, self, f14_local3 ) + return true + elseif f14_arg1.button == "up" then + if Leaderboards.IsUpdating and Leaderboards.IsUpdating() then + return true + elseif f14_local4 <= 0 then + return true + elseif f14_arg0:getChildById( "leaderboard_scrolldelay_timer_id" ) then + return true + end + local self = LUI.UITimer.new( 50, { + name = "scroll_delay_complete" + }, nil, true ) + self.id = "leaderboard_scrolldelay_timer_id" + f14_arg0:addElement( self ) + local f14_local8 = f14_local3 - 1 + if f14_local8 < 0 then + f14_local8 = f14_local4 - 1 + end + f0_local1( f14_arg0, f14_local2, f14_local8, f14_local3 ) + return true + elseif f14_arg1.button == "down" then + if Leaderboards.IsUpdating and Leaderboards.IsUpdating() then + return true + elseif f14_local4 <= 0 then + return true + elseif f14_arg0:getChildById( "leaderboard_scrolldelay_timer_id" ) then + return true + end + local self = LUI.UITimer.new( 50, { + name = "scroll_delay_complete" + }, nil, true ) + self.id = "leaderboard_scrolldelay_timer_id" + f14_arg0:addElement( self ) + local f14_local8 = f14_local3 + 1 + if f14_local4 - 1 < f14_local8 then + f14_local8 = 0 + end + f0_local1( f14_arg0, f14_local2, f14_local8, f14_local3 ) + return true + elseif f14_arg1.button == "home" then + f0_local1( f14_arg0, f14_local2, 0, f14_local3 ) + return true + end + end + return LUI.UIButton.GamepadButton( f14_arg0, f14_arg1 ) +end + +function LeaderboardRankIconRefresh( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg0.properties + local f15_local1 = f15_arg0.properties.exclusiveController + if not f15_local1 then + f15_local1 = Engine.GetFirstActiveController() + end + local f15_local2 = Leaderboards.GetValue( f15_local1, f15_local0.rankIndex, f15_local0.columnIndex ) + if f15_local2 == nil or f15_local2 == "" then + f15_arg0:animateToState( "hidden" ) + else + f15_arg0:setImage( RegisterMaterial( f15_local2 ) ) + if f15_arg0.properties.focusable then + f15_arg0:animateToState( "default" ) + else + f15_arg0:animateToState( "hidden" ) + end + end +end + +function LeaderboardLineButtonFeeder( f16_arg0 ) + local f16_local0 = {} + local f16_local1 = Leaderboards.GetLeaderboardNumColumns( "Common" ) + local f16_local2 = f16_local1 + Leaderboards.GetLeaderboardNumColumns( f16_arg0.leaderboardType ) + local f16_local3 = {} + for f16_local4 = 1, f16_local1, 1 do + f16_local3[f16_local4] = Leaderboards.GetLeaderboardColumnWidth( "Common", f16_local4 ) + end + for f16_local4 = 1, Leaderboards.GetLeaderboardNumColumns( f16_arg0.leaderboardType ), 1 do + f16_local3[f16_local1 + f16_local4] = Leaderboards.GetLeaderboardColumnWidth( f16_arg0.leaderboardType, f16_local4 ) + end + local f16_local4 = {} + for f16_local5 = 1, f16_local1, 1 do + f16_local4[f16_local5] = Leaderboards.GetLeaderboardDataColumnIndex( "Common", f16_local5 ) + end + for f16_local5 = 1, Leaderboards.GetLeaderboardNumColumns( f16_arg0.leaderboardType ), 1 do + f16_local4[f16_local1 + f16_local5] = Leaderboards.GetLeaderboardDataColumnIndex( f16_arg0.leaderboardType, f16_local5 ) + end + for f16_local5 = 1, f16_local2, 1 do + if f16_local4[f16_local5] == 1 then + local f16_local8 = f16_arg0.exclusiveController + if not f16_local8 then + f16_local8 = Engine.GetFirstActiveController() + end + local f16_local9 = Leaderboards.GetValue( f16_local8, f16_arg0.rankIndex, f16_local4[f16_local5] ) + local f16_local10 = Leaderboards.GetValue( f16_local8, f16_arg0.rankIndex, f16_local4[f16_local5] + 1 ) + if f16_arg0.memTest == true then + f16_local10 = "99" + f16_local9 = "rank_pvt1" + end + f16_local0[#f16_local0 + 1] = { + type = "mp_leaderboard_cell_value", + id = "leaderboard_cell_value_rank_" .. f16_local5, + properties = { + text = f16_local10, + columnWidth = 0.5 * f16_local3[f16_local5] + } + } + local f16_local11 = RegisterMaterial( f16_local9 ) + f16_local0[#f16_local0 + 1] = { + type = "UIImage", + id = "leaderboard_cell_value_rankicon_" .. f16_local5, + properties = { + rankIndex = f16_arg0.rankIndex, + columnIndex = f16_local4[f16_local5], + focusable = f16_arg0.focusable + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 0, + width = 24, + height = 24, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + leaderboard_update_elements = LeaderboardRankIconRefresh, + menu_create = LeaderboardRankIconRefresh + } + } + f16_local0[#f16_local0 + 1] = { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f16_local3[f16_local5] * 0.5 - 24, + alpha = 0 + } + } + } + end + local f16_local8 = "0" + if f16_arg0.memTest == true then + if f16_local4[f16_local5] == 0 then + f16_local8 = "00000000" + elseif f16_local4[f16_local5] == 3 then + f16_local8 = "WWWWWWWWWWWWWWWW" + end + else + local f16_local9 = f16_arg0.exclusiveController + if not f16_local9 then + f16_local9 = Engine.GetFirstActiveController() + end + f16_local8 = Leaderboards.GetValue( f16_local9, f16_arg0.rankIndex, f16_local4[f16_local5] ) + end + if f16_local4[f16_local5] == 3 then + f16_local0[#f16_local0 + 1] = { + type = "mp_leaderboard_cell_marquee_value", + id = "leaderboard_cell_value_" .. f16_local5, + properties = { + text = f16_local8, + columnWidth = f16_local3[f16_local5] - 10 + } + } + f16_local0[#f16_local0 + 1] = { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 10, + alpha = 0 + } + } + } + else + f16_local0[#f16_local0 + 1] = { + type = "mp_leaderboard_cell_value", + id = "leaderboard_cell_value_" .. f16_local5, + properties = { + text = f16_local8, + columnWidth = f16_local3[f16_local5] + } + } + end + end + return f16_local0 +end + +function mp_leaderboard_line_button() + return { + type = "UIButton", + id = "mp_leaderboard_line_button", + properties = { + rankIndex = 0, + leaderboardType = "Kills", + memTest = false, + focusable = false + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = Leaderboards.Layout.RowHeight, + left = 0, + right = 0 + } + }, + handlers = { + button_action = LeaderboardSelectAction, + leaderboard_update_elements = LeaderboardButtonSetFocusable + }, + children = { + { + type = "UIImage", + id = "leaderboard_row_hilite", + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 1, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 1, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 1, + material = RegisterMaterial( "white" ), + alpha = 0 + } ), + dim = { + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 1, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 1, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 1, + alpha = 0.5 + }, + focus = { + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 1, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 1, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 1, + alpha = 0.8 + } + }, + handlers = { + button_over = MBh.AnimateLoop( { + { + "focus", + 0 + }, + { + "dim", + 750 + }, + { + "focus", + 750 + } + } ), + button_up = MBh.AnimateToState( "default" ), + lose_focus = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIHorizontalList", + id = "leaderboard_row", + properties = { + rankIndex = MBh.Property( "rankIndex" ), + leaderboardType = MBh.Property( "leaderboardType" ), + memTest = MBh.Property( "memTest" ), + focusable = MBh.Property( "focusable" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = Leaderboards.Layout.RowHeight, + left = 5, + right = 0 + } + }, + childrenFeeder = LeaderboardLineButtonFeeder + } + } + } +end + +local f0_local3 = function ( f18_arg0, f18_arg1, f18_arg2 ) + local f18_local0 = Leaderboards.GetOffset( f18_arg0 ) + local f18_local1 = 0 + if f18_arg2 <= Leaderboards.Layout.NumRows - 1 then + f18_local1 = 0 + else + f18_local1 = f18_arg1 - Leaderboards.Layout.NumRows / 2 - 1 + if f18_local1 < f18_local0 then + f18_local1 = f18_local0 + elseif f18_arg2 - Leaderboards.Layout.NumRows - 1 < f18_local1 then + f18_local1 = f18_arg2 - Leaderboards.Layout.NumRows - 1 + end + end + return f18_local1 +end + +function LeaderboardDataListRowFeeder( f19_arg0 ) + local f19_local0 = {} + local f19_local1 = 0 + local f19_local2 = 0 + local f19_local3 = 0 + if f19_arg0.memTest == true then + f19_local1 = 200 + f19_local2 = 0 + f19_local3 = 25 + else + f19_local1 = Leaderboards.GetPlayerCount() + local f19_local4 = f19_arg0.exclusiveController + if not f19_local4 then + f19_local4 = Engine.GetFirstActiveController() + end + f19_local3 = Leaderboards.GetCurrentIndex( f19_local4 ) + f19_local2 = f0_local3( f19_local4, f19_local3, f19_local1 ) + end + for f19_local4 = 1, Leaderboards.Layout.NumRows - 1, 1 do + local f19_local7 = f19_local2 + f19_local4 - 1 + local f19_local8 = f19_local7 < f19_local1 + local f19_local9 = nil + if f19_local7 == f19_local3 then + f19_local9 = true + end + f19_local0[#f19_local0 + 1] = { + type = "mp_leaderboard_line_button", + id = "leaderboard_button_" .. f19_local4, + listDefaultFocus = f19_local9, + focusable = f19_local8, + disabled = not f19_local8, + properties = { + rowIndex = f19_local4, + rankIndex = f19_local7, + leaderboardType = f19_arg0.leaderboardType, + memTest = f19_arg0.memTest, + focusable = f19_local8 + } + } + end + return f19_local0 +end + +function LeaderboardVertStripeFeeder( f20_arg0 ) + local f20_local0 = {} + local f20_local1 = Leaderboards.GetLeaderboardNumColumns( "Common" ) + local f20_local2 = f20_local1 + Leaderboards.GetLeaderboardNumColumns( f20_arg0.leaderboardType ) + local f20_local3 = {} + for f20_local4 = 1, f20_local1, 1 do + f20_local3[f20_local4] = Leaderboards.GetLeaderboardColumnWidth( "Common", f20_local4 ) + end + for f20_local4 = 1, Leaderboards.GetLeaderboardNumColumns( f20_arg0.leaderboardType ), 1 do + f20_local3[f20_local1 + f20_local4] = Leaderboards.GetLeaderboardColumnWidth( f20_arg0.leaderboardType, f20_local4 ) + end + local f20_local4 = {} + for f20_local5 = 1, f20_local2, 1 do + local f20_local8 = 0 + if f20_local5 % 2 == 0 then + f20_local8 = 0.15 + end + f20_local0[#f20_local0 + 1] = { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f20_local3[f20_local5], + material = RegisterMaterial( "white" ), + red = 0, + green = 0, + blue = 0, + alpha = f20_local8 + } + }, + id = "vert_stripe_" .. f20_local5 + } + end + return f20_local0 +end + +function mp_leaderboard_page_bg() + return { + type = "UIVerticalList", + id = "mp_leaderboard_page_bg_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight * Leaderboards.Layout.NumRows, + left = 1, + right = -1 + } + }, + childrenFeeder = LeaderboardListRowFeeder + } +end + +function mp_leaderboard_page_vert_stripes() + return { + type = "UIHorizontalList", + id = "mp_leaderboard_page_vert_stripes_id", + properties = { + leaderboardType = "Kills" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight * Leaderboards.Layout.NumRows, + left = 1, + right = -1 + } + }, + childrenFeeder = LeaderboardVertStripeFeeder + } +end + +local f0_local4 = function ( f23_arg0, f23_arg1 ) + f23_arg0:clearSavedState() +end + +local f0_local5 = function ( f24_arg0, f24_arg1 ) + local f24_local0 = f24_arg0:getFirstChild() + while f24_local0 do + local f24_local1 = f24_local0:getNextSibling() + f24_local0.listDefaultFocus = false + if f24_local0.properties and f24_local0.properties.rowIndex == 1 then + f24_local0.listDefaultFocus = true + end + f24_local0 = f24_local1 + end +end + +local f0_local6 = function ( f25_arg0, f25_arg1 ) + collectgarbage( "collect" ) + local f25_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f25_arg0 ) + f25_local0.readDelayFail = false + f25_arg0:processEvent( { + name = "lose_focus" + } ) + f25_arg0:processEvent( { + name = "menu_refresh" + } ) + f25_arg0:processEvent( { + name = "leaderboard_update_elements", + dispatchChildren = true + } ) + f25_arg0:processEvent( { + name = "update_navigation", + dispatchChildren = true + } ) + local f25_local1 = f25_arg0.properties.exclusiveController + if not f25_local1 then + f25_local1 = Engine.GetFirstActiveController() + end + local f25_local2 = Leaderboards.GetCurrentIndex( f25_local1 ) + local f25_local3 = f25_arg0:getFirstChild() + while f25_local3 do + local f25_local4 = f25_local3:getNextSibling() + f25_local3.listDefaultFocus = false + if f25_local3:isInFocus() then + f25_local3:processEvent( { + name = "lose_focus" + } ) + end + if f25_local3.properties and f25_local3.properties.rankIndex == f25_local2 then + f25_local3:processEvent( { + name = "gain_focus" + } ) + f25_local3.listDefaultFocus = true + end + f25_local3 = f25_local4 + end + if f25_local0.scrollbar then + local f25_local4 = Leaderboards.GetPlayerCount() + local f25_local5 = f0_local3( f25_local1, Leaderboards.GetCurrentIndex( f25_local1 ), f25_local4 ) + if f25_local4 <= Leaderboards.Layout.NumRows then + f25_local0.scrollbar:processEvent( { + name = "hide_scrollbar", + immediate = true + } ) + else + f25_local0.scrollbar:processEvent( { + name = "show_scrollbar", + immediate = true + } ) + f25_local0.scrollbar:manualUpdate( f25_local5, Leaderboards.Layout.NumRows, f25_local4, Leaderboards.Layout.RowHeight ) + end + end +end + +function LeaderboardClose( f26_arg0, f26_arg1 ) + if Leaderboards.Clear then + Leaderboards.Clear() + end + LUI.FlowManager.RequestLeaveMenu( f26_arg0 ) +end + +function mp_leaderboard_page_data() + return { + type = "UIElement", + id = "mp_leaderboard_page_data_id", + properties = { + leaderboardType = "Kills", + filterType = "Friends", + memTest = false + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight * Leaderboards.Layout.NumRows, + left = 1, + right = -1 + } + }, + handlers = { + menu_create = function ( f28_arg0, f28_arg1 ) + if f28_arg0.properties and not f28_arg0.properties.memTest then + local f28_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f28_arg0 ) + f28_local0.scrollbar = f28_arg0:getFirstDescendentById( "scrollbar" ) + f28_local0.leaderboardType = f28_arg0.properties.leaderboardType + local f28_local1 = Leaderboards.GetLeaderboardDefaultDurationKey( f28_arg0.properties.leaderboardType ) + if f28_local1 == nil or f28_local1 == "" then + local f28_local2 = Leaderboards.LeaderboardFilterGetDurationKeys( f28_arg0.properties.leaderboardType ) + if #f28_local2 > 0 then + f28_local1 = f28_local2[1] + else + f28_local1 = "" + end + end + local f28_local2 = false + if Engine.GetDvarBool( "g_hardcore" ) and Leaderboards.GetLeaderboardHasHardcoreMode( f28_arg0.properties.leaderboardType ) then + f28_local2 = true + end + if f28_local0.isPublicLobbyLeaderboard and Engine.IsAliensMode() and Leaderboards.GetLeaderboardHasHardcoreMode( f28_arg0.properties.leaderboardType ) and LUI.mp_menus.Aliens.ExtinctionDetermineDifficulty() == LUI.mp_menus.Aliens.ExtinctionDifficluty.Hard then + f28_local2 = true + end + Leaderboards.OpenLeaderboard( f28_arg0, f28_arg0.properties.leaderboardType, f28_arg0.properties.filterType, f28_local1, f28_local2 ) + Leaderboards.Refresh() + end + end + + }, + children = { + { + type = "UIHorizontalList", + id = "mp_leaderboard_page_header_id", + properties = { + leaderboardType = MBh.Property( "leaderboardType" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = Leaderboards.Layout.HeaderHeight, + left = 0, + right = 0 + } + }, + handlers = { + leaderboard_refresh = MBh.EmitEvent( "menu_refresh" ) + }, + childrenFeeder = LeaderboardHeaderRowFeeder + }, + { + type = "UIHorizontalList", + id = "mp_leaderboard_page_player_id", + properties = { + leaderboardType = MBh.Property( "leaderboardType" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = Leaderboards.Layout.HeaderHeight, + bottom = Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight, + left = 5, + right = -10 + } + }, + handlers = { + leaderboard_refresh = MBh.EmitEvent( "menu_refresh" ) + }, + childrenFeeder = LeaderboardPlayerRowFeeder + }, + { + type = "UIStencil", + id = "mp_leaderboard_page_stencil_id", + properties = { + leaderboardType = MBh.Property( "leaderboardType" ), + memTest = MBh.Property( "memTest" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight, + bottom = 0, + left = 0, + right = -10 + } + }, + children = { + { + type = "UIVerticalList", + id = "mp_leaderboard_page_list_id", + properties = { + leaderboardType = MBh.Property( "leaderboardType" ), + memTest = MBh.Property( "memTest" ), + disableOutsideChildren = true + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = Leaderboards.Layout.RowHeight * (Leaderboards.Layout.NumRows - 1), + left = 0, + right = -10 + } + }, + handlers = { + leaderboard_clear = f0_local5, + leaderboard_refresh = f0_local6, + leaderboard_read_delayfail = function ( f29_arg0, f29_arg1 ) + local f29_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f29_arg0 ) + f29_local0.readDelayFail = true + end + , + menu_create = function ( f30_arg0, f30_arg1 ) + local f30_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f30_arg0 ) + f30_local0.readDelayFail = false + f30_local0.leaderboardList = f30_arg0 + end + , + try_change_index = f0_local0, + gamepad_button = f0_local2 + }, + childrenFeeder = LeaderboardDataListRowFeeder + } + } + }, + { + type = "UIVerticalScrollbar", + id = "scrollbar", + properties = { + on_move_func = function ( f31_arg0, f31_arg1, f31_arg2, f31_arg3 ) + local f31_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f31_arg0 ) + local f31_local1 = Leaderboards.GetPlayerCount() + local f31_local2 = LUI.clamp( math.floor( f31_arg2 * f31_local1 ), 0, math.max( 0, f31_local1 - Leaderboards.Layout.NumRows ) ) + local f31_local3 = f31_arg3.exclusiveController + if not f31_local3 then + f31_local3 = Engine.GetFirstActiveController() + end + f0_local1( f31_local0.leaderboardList, f31_local3, f31_local2, Leaderboards.GetCurrentIndex( f31_local3 ) ) + end + + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = Leaderboards.Layout.HeaderHeight, + bottom = 0, + left = -14, + right = -2, + alpha = 1 + }, + visible = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + hide_scrollbar = MBh.AnimateToState( "hidden", 0 ), + show_scrollbar = MBh.AnimateToState( "visible", 0 ), + init_scrollbar = function ( f32_arg0, f32_arg1 ) + local f32_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f32_arg0 ) + f32_arg0:manualUpdate( 0, Leaderboards.Layout.NumRows, 100, Leaderboards.Layout.RowHeight ) + end + + }, + children = { + { + type = "UITimer", + properties = { + event = "init_scrollbar", + interval = 1, + disposable = true, + deferNextFrame = true + } + } + } + } + } + } +end + +function LeaderboardGoToTop( f33_arg0, f33_arg1 ) + local f33_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f33_arg0 ) + local f33_local1 = f33_arg0.properties.exclusiveController + if not f33_local1 then + f33_local1 = Engine.GetFirstActiveController() + end + f0_local1( f33_local0.leaderboardList, f33_local1, 0, Leaderboards.GetCurrentIndex( f33_local1 ) ) +end + +function LeaderboardPageUp( f34_arg0, f34_arg1 ) + local f34_local0 = f34_arg0.properties.exclusiveController + if not f34_local0 then + f34_local0 = Engine.GetFirstActiveController() + end + local f34_local1 = Leaderboards.GetCurrentIndex( f34_local0 ) + if f34_local1 == 0 then + return + end + local f34_local2 = f34_local1 - Leaderboards.Layout.NumRows - 1 + if f34_local2 < 0 then + f34_local2 = 0 + end + f0_local1( scoped.leaderboardList, f34_local0, f34_local2, f34_local1 ) +end + +function LeaderboardPageDown( f35_arg0, f35_arg1 ) + local f35_local0 = f35_arg0.properties.exclusiveController + if not f35_local0 then + f35_local0 = Engine.GetFirstActiveController() + end + local f35_local1 = Leaderboards.GetCurrentIndex( f35_local0 ) + if f35_local1 == count - 1 then + return + end + newIdx = f35_local1 + Leaderboards.Layout.NumRows - 1 + if count - 1 < newIdx then + newIdx = count - 1 + end + f0_local1( scoped.leaderboardList, f35_local0, newIdx, f35_local1 ) +end + +function LeaderboardOpenFiltersMenu( f36_arg0, f36_arg1 ) + LUI.FlowManager.RequestPopupMenu( f36_arg0, "mp_leaderboard_filters_popup", true, f36_arg1.controller, false, {} ) +end + +function LeaderboardMainFeeder( f37_arg0 ) + local f37_local0 = { + [#f37_local0 + 1] = { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + [#f37_local0 + 1] = { + type = "generic_menu_background", + id = "leaderboard_border", + properties = { + fill_alpha = 1 + } + }, + [#f37_local0 + 1] = { + type = "aar_title_bar", + id = "leaderboard_title_bar_id", + properties = { + title_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ), + subtitle_text = Engine.Localize( Leaderboards.GetLeaderboardFilterTitle( f37_arg0.filterType ), Engine.Localize( Leaderboards.GetLeaderboardTitle( f37_arg0.leaderboardType ) ) ), + subtitle_banner_width = Leaderboards.Layout.SubtitleBannerWidth + } + }, + [#f37_local0 + 1] = { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight, + bottom = 0, + left = 1, + right = -1 + } + }, + children = { + { + type = "mp_leaderboard_page_bg" + }, + { + type = "mp_leaderboard_page_vert_stripes", + properties = { + leaderboardType = f37_arg0.leaderboardType + } + }, + { + type = "mp_leaderboard_page_data", + properties = { + leaderboardType = f37_arg0.leaderboardType, + filterType = f37_arg0.filterType + } + }, + { + type = "button_helper_text_main", + id = "help_texts", + properties = { + left_inset = 10, + top_margin = GenericFooterDims.TopMargin_WithoutBackground, + background_alpha = 0, + height = AAR.Layout.FooterHeight - 1, + spacing = 65 + } + }, + { + type = "UIBindButton", + id = "leaderboard_bind_buttons_id", + handlers = { + button_secondary = LeaderboardClose, + button_alt1 = LeaderboardGoToTop, + button_alt2 = LeaderboardOpenFiltersMenu, + button_dpad_up = LeaderboardPageUp, + button_dpad_down = LeaderboardPageDown + } + } + } + } + } + return f37_local0 +end + +function LeaderboardMainCreate( f38_arg0, f38_arg1 ) + f38_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) + if Engine.IsGamepadEnabled() == 1 and not Engine.IsPS3() and not Engine.IsPS4() then + f38_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = Engine.Localize( "@LUA_MENU_SELECT" ), + side = "left", + clickable = true + } ) + end + f38_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@LUA_MENU_FILTER" ), + side = "left", + clickable = true + } ) + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then + f38_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_TOP" ), + side = "left", + clickable = true + } ) + f38_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_dpad_up", + helper_text = Engine.Localize( "@LUA_MENU_PAGE_UP" ), + side = "left", + clickable = true + } ) + f38_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_dpad_down", + helper_text = Engine.Localize( "@LUA_MENU_PAGE_DOWN" ), + side = "left", + clickable = true + } ) + else + f38_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_home", + helper_text = Engine.Localize( "@LUA_MENU_TOP" ), + side = "left", + clickable = true + } ) + f38_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_page_up", + helper_text = Engine.Localize( "@LUA_MENU_PAGE_UP" ), + side = "left", + clickable = true + } ) + f38_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_page_down", + helper_text = Engine.Localize( "@LUA_MENU_PAGE_DOWN" ), + side = "left", + clickable = true + } ) + end +end + +function mp_leaderboard_main() + return { + type = "UIElement", + id = "mp_leaderboard_main_id", + properties = { + leaderboardType = "Kills", + filterType = "Friends" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + leaderboard_clear = f0_local4 + }, + children = { + { + type = "UIImage", + id = "darken_bg", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIElement", + id = "mp_leaderboard_main_popup_id", + properties = { + leaderboardType = MBh.Property( "leaderboardType" ), + filterType = MBh.Property( "filterType" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -1 * (AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight + Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight * Leaderboards.Layout.NumRows + AAR.Layout.FooterHeight) * 0.5, + bottom = (AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight + Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight * Leaderboards.Layout.NumRows + AAR.Layout.FooterHeight) * 0.5, + left = -1 * Leaderboards.Layout.Width * 0.5, + right = Leaderboards.Layout.Width * 0.5 + } + }, + handlers = { + menu_create = LeaderboardMainCreate + }, + childrenFeeder = LeaderboardMainFeeder + } + } + } +end + +LUI.MenuBuilder.registerDef( "mp_leaderboard_main", mp_leaderboard_main ) +LUI.FlowManager.RegisterStackPopBehaviour( "mp_leaderboard_main", LeaderboardPop ) +LUI.MenuBuilder.registerDef( "mp_leaderboard_page_bg", mp_leaderboard_page_bg ) +LUI.MenuBuilder.registerDef( "mp_leaderboard_page_vert_stripes", mp_leaderboard_page_vert_stripes ) +LUI.MenuBuilder.registerDef( "mp_leaderboard_page_data", mp_leaderboard_page_data ) +LUI.MenuBuilder.registerDef( "mp_leaderboard_cell_value", mp_leaderboard_cell_value ) +LUI.MenuBuilder.registerDef( "mp_leaderboard_cell_marquee_value", mp_leaderboard_cell_marquee_value ) +LUI.MenuBuilder.registerDef( "mp_leaderboard_line_button", mp_leaderboard_line_button ) +LockTable( _M ) diff --git a/lui/mp_menus/mpleaderboardpopups.dec.lua b/lui/mp_menus/mpleaderboardpopups.dec.lua new file mode 100644 index 0000000..b911d5f --- /dev/null +++ b/lui/mp_menus/mpleaderboardpopups.dec.lua @@ -0,0 +1,421 @@ +function FiltersPopupClose( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + local f1_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + local f1_local2 = f1_local1.leaderboardType + if f1_local2 and f1_local2 ~= "" then + Leaderboards.OpenLeaderboard( f1_arg0, f1_local2, f1_local0.filterKey, f1_local1.filterDurationKey, f1_local1.isHardcore ) + end +end + +function LeaderboardFilterGetGroupKeys( f2_arg0 ) + local f2_local0 = { + [#f2_local0 + 1] = "None", + [#f2_local0 + 1] = "Friends" + } + local f2_local1 = f2_arg0.properties.exclusiveController + if not f2_local1 then + f2_local1 = Engine.GetFirstActiveController() + end + if f2_local1 then + if Friends.IsEliteClanAllowed( f2_local1 ) and Friends.EliteClanIsMember( f2_local1 ) then + f2_local0[#f2_local0 + 1] = "Clan" + end + if Engine.GetDvarInt( "party_matchedPlayerCount" ) <= Engine.GetDvarInt( "party_partyPlayerCountNum" ) then + f2_local0[#f2_local0 + 1] = "LobbyMembers" + end + end + return f2_local0 +end + +function LeaderboardActionsFeeder( f3_arg0 ) + local f3_local0 = {} + local f3_local1 = Engine.IsXbox360() + if not f3_local1 then + f3_local1 = Engine.IsXB3() + end + if f3_local1 then + f3_local0[#f3_local0 + 1] = { + type = "UIGenericButton", + id = "profile", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@XBOXLIVE_VIEW_PROFILE" ), + button_action_func = function ( f4_arg0, f4_arg1 ) + Leaderboards.ShowGamercard( f4_arg1.controller ) + end + } + } + end + if not Engine.IsPS4() and not Engine.IsPS3() then + local f3_local2 = #f3_local0 + 1 + local f3_local3 = { + type = "UIGenericButton", + id = "friendrequest" + } + local f3_local4 = Leaderboards.IsPlayerMe( f3_arg0.exclusiveController ) + if not f3_local4 then + f3_local4 = Leaderboards.IsPlayerAFriend( f3_arg0.exclusiveController ) + end + f3_local3.disabled = f3_local4 + f3_local3.properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_FRIEND_REQUEST" ), + button_action_func = function ( f5_arg0, f5_arg1 ) + Leaderboards.SendFriendRequest( f5_arg1.controller ) + end + } + f3_local0[f3_local2] = f3_local3 + end + return f3_local0 +end + +function PushLeaderboardFilter() + local f6_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_filters_popup" ) + f6_local0.filterKey = "None" + for f6_local4, f6_local5 in pairs( Leaderboards.Filters ) do + if f6_local5.Value == Engine.GetDvarString( "lb_filter" ) then + f6_local0.filterKey = f6_local4 + break + end + end +end + +function LeaderboardFiltersPopupItems( f7_arg0 ) + local f7_local0 = { + [#f7_local0 + 1] = { + type = "UIGenericButton", + id = "leaderboard_filters_1", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_GROUP_CAPS" ), + button_display_func = function ( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + return Engine.Localize( Leaderboards.GetLeaderboardFilterOptionText( f8_local0.filterKey ) ) + end, + button_left_func = function ( f9_arg0, f9_arg1 ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 ) + local f9_local1 = LeaderboardFilterGetGroupKeys( f9_arg0 ) + local f9_local2 = 1 + for f9_local3 = 1, #f9_local1, 1 do + if f9_local1[f9_local3] == f9_local0.filterKey then + f9_local2 = f9_local3 + break + end + end + f9_local2 = f9_local2 - 1 + if f9_local2 < 1 then + f9_local0.filterKey = f9_local1[#f9_local1] + else + f9_local0.filterKey = f9_local1[f9_local2] + end + end, + button_right_func = function ( f10_arg0, f10_arg1 ) + local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 ) + local f10_local1 = LeaderboardFilterGetGroupKeys( f10_arg0 ) + local f10_local2 = 1 + for f10_local3 = 1, #f10_local1, 1 do + if f10_local1[f10_local3] == f10_local0.filterKey then + f10_local2 = f10_local3 + break + end + end + f10_local2 = f10_local2 + 1 + if #f10_local1 < f10_local2 then + f10_local0.filterKey = f10_local1[1] + else + f10_local0.filterKey = f10_local1[f10_local2] + end + end + } + }, + [#f7_local0 + 1] = { + type = "UIGenericButton", + id = "leaderboard_filters_2", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_DURATION_CAPS" ), + button_display_func = function ( f11_arg0, f11_arg1 ) + local f11_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f11_arg0 ) + local f11_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + local f11_local2 = f11_local1.leaderboardType + if f11_local2 == nil or f11_local2 == "" then + return Engine.Localize( Leaderboards.DurationDefs.Alltime.OptionText ) + else + local f11_local3 = Leaderboards.GetLeaderboardDurationDef( f11_local2, f11_local1.filterDurationKey ) + if f11_local3 then + return Engine.Localize( f11_local3.OptionText ) + else + assert( false, "Leaderboard Filter Duration not found" ) + return Engine.Localize( "@LUA_MENU_DURATION_CAPS" ) + end + end + end, + button_left_func = function ( f12_arg0, f12_arg1 ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + local f12_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + local f12_local2 = f12_local1.leaderboardType + if f12_local2 and f12_local2 ~= "" then + local f12_local3 = Leaderboards.LeaderboardFilterGetDurationKeys( f12_local2 ) + local f12_local4 = 1 + for f12_local5 = 1, #f12_local3, 1 do + if f12_local3[f12_local5] == f12_local1.filterDurationKey then + f12_local4 = f12_local5 + break + end + end + f12_local4 = f12_local4 - 1 + if f12_local4 < 1 then + f12_local1.filterDurationKey = f12_local3[#f12_local3] + end + f12_local1.filterDurationKey = f12_local3[f12_local4] + end + end, + button_right_func = function ( f13_arg0, f13_arg1 ) + local f13_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f13_arg0 ) + local f13_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + local f13_local2 = f13_local1.leaderboardType + if f13_local2 and f13_local2 ~= "" then + local f13_local3 = Leaderboards.LeaderboardFilterGetDurationKeys( f13_local2 ) + local f13_local4 = 1 + for f13_local5 = 1, #f13_local3, 1 do + if f13_local3[f13_local5] == f13_local1.filterDurationKey then + f13_local4 = f13_local5 + break + end + end + f13_local4 = f13_local4 + 1 + if #f13_local3 < f13_local4 then + f13_local1.filterDurationKey = f13_local3[1] + end + f13_local1.filterDurationKey = f13_local3[f13_local4] + end + end + } + } + } + if Engine.GetDvarBool( "extinction_hardcore_enabled" ) and not SvS.IsSvS() then + local f7_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + if Leaderboards.GetLeaderboardHasHardcoreMode( f7_local1.leaderboardType ) then + f7_local0[#f7_local0 + 1] = { + type = "UIGenericButton", + id = "leaderboard_filters_3", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_HARDCORE_CAPS" ), + button_display_func = function ( f14_arg0, f14_arg1 ) + local f14_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + return f14_local0.isHardcore and Engine.Localize( "@MENU_ON" ) or Engine.Localize( "@MENU_OFF" ) + end, + button_left_func = function ( f15_arg0, f15_arg1 ) + local f15_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + f15_local0.isHardcore = not f15_local0.isHardcore + end, + button_right_func = function ( f16_arg0, f16_arg1 ) + local f16_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + f16_local0.isHardcore = not f16_local0.isHardcore + end + } + } + end + end + return f7_local0 +end + +function mp_leaderboard_actions_popup() + local f17_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) + local f17_local1 = f17_local0.selectedRowIndex or 0 + local f17_local2 = f17_local0.exclusiveControllerIndex + if not f17_local2 then + f17_local2 = Engine.GetFirstActiveController() + end + return { + type = "generic_selectionList_popup", + id = "mp_leaderboard_actions_popup_id", + handlers = { + close_actions = MBh.LeaveMenu() + }, + properties = { + popup_title = Leaderboards.GetValue( f17_local2, f17_local1, 3 ), + popup_childfeeder = LeaderboardActionsFeeder + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + } + } +end + +function mp_leaderboard_filters_popup_page() + return { + type = "UIElement", + id = "mp_leaderboard_filters_popup_page_id", + properties = {}, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = AAR.Layout.TitleBarHeight + 1, + bottom = -1, + left = 1, + right = -1 + } + }, + children = { + { + type = "UIText", + id = "leaderboard_filters_instruction", + properties = { + text = Engine.Localize( "@LUA_MENU_FILTER_POPUP_INSTR" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 10, + bottom = 10 + CoD.TextSettings.NormalFont.Height, + left = 75, + right = -75, + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.NormalFont.Font, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } + } + }, + { + type = "UIVerticalList", + id = "leaderboard_filters_popup_vlist", + properties = {}, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -90, + bottom = 0, + left = 2, + right = -2, + spacing = 2 + } + }, + childrenFeeder = LeaderboardFiltersPopupItems + } + } + } +end + +function mp_leaderboard_filters_popup() + return { + type = "UIElement", + id = "mp_leaderboard_filters_popup_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "darken_bg", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIElement", + id = "mp_leaderboard_filters_popup_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -1 * Leaderboards.Layout.FilterHeight * 0.6, + width = Leaderboards.Layout.FilterWidth, + height = Leaderboards.Layout.FilterHeight + } + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + id = "leaderboard_filters_popup_title_bar_id", + properties = { + title_bar_text = Engine.Localize( "@LUA_MENU_FILTER_CAPS" ), + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + id = "leaderboard_filters_popup_background", + properties = { + fill_alpha = 1 + } + }, + { + type = "mp_leaderboard_filters_popup_page" + }, + { + type = "UIBindButton", + id = "filters_popup_back_button", + handlers = { + button_secondary = MBh.DoMultiple( { + MBh.LeaveMenu(), + FiltersPopupClose + } ) + } + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "mp_leaderboard_actions_popup", mp_leaderboard_actions_popup ) +LUI.MenuBuilder.registerDef( "mp_leaderboard_filters_popup", mp_leaderboard_filters_popup ) +LUI.MenuBuilder.registerDef( "mp_leaderboard_filters_popup_page", mp_leaderboard_filters_popup_page ) +LUI.FlowManager.RegisterStackPushBehaviour( "mp_leaderboard_filters_popup", PushLeaderboardFilter ) diff --git a/lui/mp_menus/mpliveprivatelobby.dec.lua b/lui/mp_menus/mpliveprivatelobby.dec.lua new file mode 100644 index 0000000..b673538 --- /dev/null +++ b/lui/mp_menus/mpliveprivatelobby.dec.lua @@ -0,0 +1,1097 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function StartGameOrReadyUpAction( f1_arg0, f1_arg1 ) + if Lobby.UsingReadyUpFeature() then + if not Lobby.GetLocalReadyUpFlag() then + Lobby.SetLocalReadyUpFlag() + f1_arg0:dispatchEventToRoot( { + name = "refresh_ready_up" + } ) + return + elseif not Lobby.GetPartyReadyUpStatus() then + return + end + end + if Engine.GetDvarString( "ui_gametype" ) == "horde" then + Lobby.SetBotsConnectType( 0 ) + elseif not Engine.IsAliensMode() and Lobby.GetBotsConnectType() == 0 then + Lobby.SetBotsConnectType( 1 ) + end + local f1_local0 = LUI.mp_menus.Aliens.LobbyGetIntroVideo() + if isAliensSolo() and f1_local0 and not LUI.mp_menus.Aliens.HasSeenVideo( f1_arg1.controller, f1_local0 ) then + LUI.mp_menus.Aliens.SetHasSeenVideo( f1_arg1.controller, f1_local0 ) + LUI.mp_menus.Aliens.AliensPlayVideo( f1_arg1.controller, f1_local0, { + name = "start_transition_to_game", + immediate = true + } ) + else + f1_arg0:dispatchEventToRoot( { + name = "start_transition_to_game", + immediate = true + } ) + end +end + +function HandleStartTheGame( f2_arg0, f2_arg1 ) + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), false, "TransitionToGame" ) + Engine.Exec( "xpartygo" ) +end + +function GameSetupAction( f3_arg0, f3_arg1, f3_arg2 ) + LUI.FlowManager.RequestAddMenu( f3_arg0, "gamesetup_menu_main", true, f3_arg1.controller, false, { + isSoloMode = f3_arg2 + } ) +end + +function CreateSquadAction( f4_arg0, f4_arg1 ) + local f4_local0 = false + local f4_local1 = true + Cac.SetEditSquadMember( Cac.GetActiveSquadMember( f4_arg1.controller ) ) + LUI.FlowManager.RequestAddMenu( f4_arg0, "cac_edit_main", f4_local1, f4_arg1.controller, f4_local0, { + open_char_list = true, + classLocation = "loadouts", + squadLocation = "privateMatchSquadMembers", + squadMemberIndex = Cac.GetEditSquadMember(), + allowMemberSwap = true + } ) +end + +function RefreshButtonDisable( f5_arg0, f5_arg1 ) + assert( f5_arg0.properties.disabledFunc ) + local f5_local0 = f5_arg0.properties.disabledFunc() + if f5_local0 and not f5_arg0.disabled then + f5_arg0:processEvent( { + name = "disable" + } ) + elseif not f5_local0 and f5_arg0.disabled then + f5_arg0:processEvent( { + name = "enable" + } ) + end +end + +function LivePrivateLobbyMenuCreate( f6_arg0, f6_arg1 ) + LUI.FlowManager.RequestSetStack( f6_arg0, { + { + name = "mp_main_menu" + }, + { + name = "menu_xboxlive" + } + } ) + local f6_local0 = Engine.GetFirstActiveController() + f6_arg0:dispatchEventToRoot( LUI.ButtonHelperText.CommonEvents.addBackButton ) + f6_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addGameSummaryButton ) + if not Engine.IsAliensMode() then + MLG.Refresh( f6_arg0 ) + end + if Engine.IsAliensMode() then + LUI.mp_menus.Aliens.AliensRunConfig( f6_local0 ) + LUI.mp_menus.Aliens.InitGameTypeToAliens() + end + TryForceOpenAfterActionReport( f6_arg0, f6_arg1 ) + if Lobby.IsGameHost() and Engine.GetDvarString( "ui_gametype" ) == "horde" and not Engine.IsAliensMode() then + local f6_local1 = Lobby.GetMemberCount( Lobby.MemberListStates.Lobby ) + assert( f6_local1 > 0 ) + if f6_local1 > CoD.MaxSafeguardPlayers then + MatchRules.SetData( "gametype", "war" ) + MatchRules.LoadMatchRulesDataDefault() + end + end + RefreshMLGRules( f6_arg0, f6_local0 ) + Cac.ValidateAllPlayersPrivateSquadMembers() +end + +function LivePrivateLobbyMenuSpeechHandler( f7_arg0, f7_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.ProcessActionEvent( f7_arg0, f7_arg1, Kinect.LobbySpeechGrammarHandlersArray ) + end +end + +function RequestExitPrivateLobby( f8_arg0, f8_arg1 ) + if Engine.HasSpeechFeature() and LUI.MenuAutoNav.IsRunning() then + LUI.mp_menus.mpLobbyWidgets.leaveLobbyAndPartyYesActionWithExitLobby( f8_arg0, f8_arg1 ) + elseif IsOurPrivatePartyHostInLobby() then + LUI.FlowManager.RequestPopupMenu( f8_arg0, "leavelobbyandpartywarning", true, f8_arg1.controller, false, {} ) + else + LUI.FlowManager.RequestPopupMenu( f8_arg0, "leavelobbywarning", true, f8_arg1.controller, false, {} ) + end +end + +function UpdateStartGameOrReadyUpText( f9_arg0, f9_arg1 ) + if not f9_arg0.properties.is_exiting then + if GetStartGameOrReadyUpDisableValue( f9_arg0, f9_arg1 ) then + if not f9_arg0.disabled then + f9_arg0:processEvent( { + name = "disable" + } ) + end + elseif f9_arg0.disabled then + f9_arg0:processEvent( { + name = "enable" + } ) + end + f9_arg0:setText( GetStartGameOrReadyUpDisplayString( f9_arg0, f9_arg1 ) ) + end +end + +function GetStartGameOrReadyUpDisableValue() + if Lobby.UsingReadyUpFeature() then + if not Lobby.GetLocalReadyUpFlag() then + return false + elseif not Lobby.GetPartyReadyUpStatus() then + return true + end + end + if not IsGameHost() then + return true + elseif not Engine.PartyEveryoneHasMap( Engine.GetDvarString( "ui_mapname" ) ) then + return true + elseif Lobby.IsPartyHostWaitingOnMembers() then + return true + elseif not Lobby.PartyClientsUpToDate() then + return true + elseif Engine.GetDvarString( "ui_gametype" ) == "horde" and Lobby.GetMemberCount( Lobby.MemberListStates.Lobby ) > CoD.MaxSafeguardPlayers then + return true + end + return false +end + +function GetStartGameOrReadyUpDisplayString( f11_arg0, f11_arg1 ) + if Lobby.UsingReadyUpFeature() then + if not Lobby.GetLocalReadyUpFlag() then + return Engine.Localize( "@LUA_MENU_READY_UP_CAPS" ) + elseif not Lobby.GetPartyReadyUpStatus() then + return Engine.Localize( "@LUA_MENU_WAITING_FOR_OTHER_PLAYERS_CAPS" ) + end + end + if IsGameHost() then + return Engine.Localize( "@LUA_MENU_START_GAME_CAPS" ) + end + return Engine.Localize( "@LUA_MENU_WAITING_FOR_HOST_CAPS" ) +end + +function GetStartGameOrReadyUpDescText( f12_arg0, f12_arg1 ) + if Lobby.UsingReadyUpFeature() then + if not Lobby.GetLocalReadyUpFlag() then + return Engine.Localize( "@LUA_MENU_DESC_READY_UP" ) + elseif not Lobby.GetPartyReadyUpStatus() then + return Engine.Localize( "@LUA_MENU_DESC_WAITING_FOR_OTHER_PLAYERS" ) + end + end + if GetStartGameOrReadyUpDisableValue() then + if Engine.GetDvarString( "ui_gametype" ) == "horde" then + return Engine.Localize( "@LUA_MENU_DESC_TOO_MANY_PLAYERS_HORDE" ) + elseif Lobby.IsPartyHostWaitingOnMembers() then + return Engine.Localize( "@LUA_MENU_DESC_LOCKED_WAITING_FOR_PARTY_MEMBERS" ) + elseif not Engine.PartyEveryoneHasMap( Engine.GetDvarString( "ui_mapname" ) ) then + return Engine.Localize( "@LUA_MENU_MP_DESC_PLAYERS_MISSING_MAP", Engine.Localize( "@" .. Engine.TableLookup( "mp/mapNames.csv", 0, Engine.GetDvarString( "ui_mapname" ), 1 ) ) ) + end + return Engine.Localize( "@LUA_MENU_DESC_START_MATCH_LOCKED" ) + end + return Engine.Localize( "@LUA_MENU_DESC_START_MATCH" ) +end + +function getSetupButtonDescText( f13_arg0, f13_arg1 ) + local f13_local0 = "" + if IsGameHost() then + if Engine.IsAliensMode() then + f13_local0 = Engine.Localize( "@LUA_MENU_DESC_GAME_SETUP_ALIENS" ) + else + f13_local0 = Engine.Localize( "@LUA_MENU_DESC_GAME_SETUP" ) + end + else + f13_local0 = Engine.Localize( "@LUA_MENU_DESC_GAME_SETUP_LOCKED" ) + end + return f13_local0 +end + +function getMapSetupButtonDescText( f14_arg0, f14_arg1 ) + local f14_local0 = "" + if IsGameHost() then + f14_local0 = Engine.Localize( "@MENU_DESC_CHANGE_MAP" ) + else + f14_local0 = Engine.Localize( "@LUA_MENU_DESC_GAME_SETUP_LOCKED" ) + end + return f14_local0 +end + +function getDifficultySetupButtonDescText( f15_arg0, f15_arg1 ) + local f15_local0 = "" + if IsGameHost() then + if LUI.mp_menus.Aliens.IsChaosEnabled() then + f15_local0 = Engine.Localize( "@ALIENS_CHAOS_DIFF_DESC" ) + else + f15_local0 = Engine.Localize( "@LUA_MENU_MP_DIFFICULTY_DESC" ) + end + else + f15_local0 = Engine.Localize( "@LUA_MENU_DESC_GAME_SETUP_LOCKED" ) + end + return f15_local0 +end + +function getModeSetupButtonDescText( f16_arg0, f16_arg1 ) + local f16_local0 = "" + if IsGameHost() then + f16_local0 = Engine.Localize( "@ALIENS_GAME_MODE_DESC" ) + else + f16_local0 = Engine.Localize( "@LUA_MENU_DESC_GAME_SETUP_LOCKED" ) + end + return f16_local0 +end + +function LivePrivateLobbyOptionsFeeder( f17_arg0 ) + local f17_local0 = {} + local f17_local1 = Engine.IsAliensMode() + local f17_local2 = f17_arg0.aliensSoloMode + if not f17_arg0.slot then + DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" ) + local f17_local3 = 0 + end + local f17_local4 = Cac.GetCustomClassLoc( f17_arg0.classLocation ) + f17_local0[#f17_local0 + 1] = { + type = "UIGenericButton", + id = "start_match_button_id", + disabledFunc = GetStartGameOrReadyUpDisableValue, + properties = { + disabledFunc = GetStartGameOrReadyUpDisableValue, + button_text = "", + button_action_func = StartGameOrReadyUpAction, + desc_text = GetStartGameOrReadyUpDescText, + additional_handlers = { + recheck_start_button_lock = RefreshButtonDisable, + element_refresh = UpdateStartGameOrReadyUpText, + menu_create = UpdateStartGameOrReadyUpText, + start_match_button_refresh = UpdateStartGameOrReadyUpText, + exit_private_lobby = function ( f18_arg0, f18_arg1 ) + f18_arg0.properties.is_exiting = true + end + }, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_enable", + dispatchChildren = true, + immediate = true + } ) + }, + children = { + { + type = "UITimer", + id = "start_match_button_refresh_timer_id", + properties = { + event = "start_match_button_refresh", + interval = 100, + disposable = false, + broadcastToRoot = false + } + } + } + } + if f17_local2 == false then + f17_local0[#f17_local0 + 1] = { + type = "UIGenericButton", + id = "setup_match_button_id", + disabledFunc = IsNotGameHost, + properties = { + disabledFunc = IsNotGameHost, + button_text = Engine.Localize( "@LUA_MENU_GAME_SETUP_CAPS" ), + button_action_func = function ( f19_arg0, f19_arg1 ) + GameSetupAction( f19_arg0, f19_arg1, f17_local2 ) + end, + desc_text = getSetupButtonDescText, + additional_handlers = { + recheck_start_button_lock = RefreshButtonDisable + }, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_enable", + dispatchChildren = true, + immediate = true + } ) + } + } + end + if not f17_local1 then + f17_local0[#f17_local0 + 1] = { + type = "UIGenericButton", + id = "create_squad_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ), + button_action_func = CreateSquadAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" ), + button_over_func = TriggerUpdateRestrictionsIcon, + button_up_func = TriggerUpdateRestrictionsIcon + }, + handlers = { + create_class_update_restrictions = TriggerUpdateRestrictionsIcon, + mlg_enabled = TriggerUpdateRestrictionsIcon, + mlg_disabled = TriggerUpdateRestrictionsIcon + }, + children = { + { + type = "lobby_restriction_icon" + } + } + } + else + f17_local0[#f17_local0 + 1] = LUI.mp_menus.AliensLoadout.GetAliensLoadoutButton() + if LUI.mp_menus.Aliens.ExtinctionHasMapSelection() then + local f17_local5 = LUI.mp_menus.Aliens.MapSelectionButton() + f17_local5.properties.desc_text = getMapSetupButtonDescText + f17_local5.disabledFunc = IsNotGameHost + f17_local5.properties.disabledFunc = IsNotGameHost + f17_local5.properties.additional_handlers = { + recheck_start_button_lock = RefreshButtonDisable + } + f17_local0[#f17_local0 + 1] = f17_local5 + end + if LUI.mp_menus.Aliens.ExtinctionHasModeSelection() then + local f17_local5 = LUI.mp_menus.Aliens.ModeSelectionButton() + f17_local5.properties.desc_text = getModeSetupButtonDescText + f17_local5.disabledFunc = IsNotGameHost + f17_local5.properties.disabledFunc = IsNotGameHost + f17_local5.properties.additional_handlers = { + recheck_start_button_lock = RefreshButtonDisable + } + f17_local0[#f17_local0 + 1] = f17_local5 + end + if LUI.mp_menus.Aliens.ExtinctionHasDifficultySelection() then + local f17_local5 = LUI.mp_menus.Aliens.DifficultySelectionButton() + f17_local5.properties.desc_text = getDifficultySetupButtonDescText + f17_local5.disabledFunc = function () + local f20_local0 = IsNotGameHost() + if not f20_local0 then + f20_local0 = LUI.mp_menus.Aliens.IsChaosEnabled() + end + return f20_local0 + end + + f17_local5.properties.disabledFunc = function () + local f21_local0 = IsNotGameHost() + if not f21_local0 then + f21_local0 = LUI.mp_menus.Aliens.IsChaosEnabled() + end + return f21_local0 + end + + f17_local5.properties.additional_handlers = { + recheck_start_button_lock = RefreshButtonDisable, + update_chaos_enabled = RefreshButtonDisable + } + f17_local0[#f17_local0 + 1] = f17_local5 + end + end + if f17_local1 then + f17_local0[#f17_local0 + 1] = { + type = "UIGenericButton", + id = "leaderboards_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARDS" ), + button_action_func = function ( f22_arg0, f22_arg1 ) + if Engine.IsUserAGuest( f22_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f22_arg0, "popup_no_guest", true, f22_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f22_arg0, "leaderboards", true, f22_arg1.controller ) + end + end, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_enable", + dispatchChildren = true, + immediate = true + } ) + } + } + if LUI.mp_menus.Aliens.CanAccessIntelMenu() then + f17_local0[#f17_local0 + 1] = LUI.mp_menus.AliensIntel.GetAliensIntelButton() + end + end + local f17_local5 = Engine.GetDvarString( "ui_gametype" ) + if not f17_local1 and Lobby.IsGameHost() and f17_local5 ~= "horde" then + local f17_local6 = tonumber( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f17_local5, GameTypesTable.Cols.TeamChoice ) ) + if f17_local6 and f17_local6 == 1 then + f17_local0[#f17_local0 + 1] = { + type = "UIGenericButton", + id = "friendly_bot_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_med, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_FRIENDLY_BOTS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_FRIENDLY_BOTS_DESC" ), + button_display_func = FriendlyBotButtonDisplayText, + button_left_func = FriendlyBotButtonLeft, + button_right_func = FriendlyBotButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f17_local0[#f17_local0 + 1] = { + type = "UIGenericButton", + id = "friendly_bots_difficulty_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_med, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_FRIENDLY_BOTDIFFICULTY_DESC" ), + button_display_func = FriendlyBotsDifficultyButtonDisplayText, + button_left_func = FriendlyBotsDifficultyButtonLeft, + button_right_func = FriendlyBotsDifficultyButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f17_local0[#f17_local0 + 1] = { + type = "UIGenericButton", + id = "enemy_bot_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_med, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_ENEMY_BOTS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_ENEMY_BOTS_DESC" ), + button_display_func = EnemyBotButtonDisplayText, + button_left_func = EnemyBotButtonLeft, + button_right_func = EnemyBotButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f17_local0[#f17_local0 + 1] = { + type = "UIGenericButton", + id = "enemy_bots_difficulty_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_med, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_ENEMY_BOTDIFFICULTY_DESC" ), + button_display_func = EnemyBotsDifficultyButtonDisplayText, + button_left_func = EnemyBotsDifficultyButtonLeft, + button_right_func = EnemyBotsDifficultyButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + else + f17_local0[#f17_local0 + 1] = { + type = "UIGenericButton", + id = "bot_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_med, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_BOTS_DESC" ), + button_display_func = FFABotButtonDisplayText, + button_left_func = FFABotButtonLeft, + button_right_func = FFABotButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f17_local0[#f17_local0 + 1] = { + type = "UIGenericButton", + id = "bots_difficulty_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_med, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_DESC" ), + button_display_func = FFABotsDifficultyButtonDisplayText, + button_left_func = FFABotsDifficultyButtonLeft, + button_right_func = FFABotsDifficultyButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + end + f17_local0[#f17_local0 + 1] = { + type = "UITimer", + id = "bot_button_timer_id", + properties = { + event = "bot_button_refresh", + interval = 200 + } + } + end + f17_local0[#f17_local0 + 1] = { + type = "button_desc_text", + id = "private_lobby_description_id" + } + f17_local0[#f17_local0 + 1] = { + type = "UIText", + id = "missing_dlc_text", + properties = { + text = "" + }, + states = { + default = CoD.ColorizeState( Colors.orange, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 100, + right = 80, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + handlers = { + lobby_update_timer = function ( f23_arg0, f23_arg1 ) + local f23_local0, f23_local1, f23_local2 = Engine.PartyMissingMapPacks() + if f23_local0 and f23_local2 and f23_local1 and #f23_local1 > 0 then + f23_arg0:setText( Engine.Localize( "DLC_PLAYER_DOESNT_HAVE_MAP_PACK", Engine.MarkLocalized( f23_local2 ), Engine.Localize( f23_local1 ) ) ) + else + f23_arg0:setText( "" ) + end + end + } + } + f17_local0[#f17_local0 + 1] = { + type = "UITimer", + id = "bnt_lock_tmr", + properties = { + event = "recheck_start_button_lock", + interval = 500, + disposable = false, + broadcastToRoot = true + } + } + return f17_local0 +end + +function menu_xboxlive_privatelobby() + local f24_local0 = Engine.IsAliensMode() + local f24_local1 = { + type = "UIElement" + } + local f24_local2 + if f24_local0 then + f24_local2 = "menu_xboxlive_ext_privatelobby_root" + if not f24_local2 then + + else + f24_local1.id = f24_local2 + f24_local1.states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + f24_local1.properties = { + aliensSoloMode = isAliensSolo() + } + f24_local1.handlers = { + menu_create = LivePrivateLobbyMenuCreate, + speech_action = LivePrivateLobbyMenuSpeechHandler, + exit_private_lobby = MBh.LeaveMenu(), + open_after_action_report = OpenAfterActionReport, + start_transition_to_game = HandleStartTransitionToGame, + lobby_transition_complete = HandleStartTheGame, + lobby_update_timer = function ( f25_arg0, f25_arg1 ) + f25_arg0:processEvent( { + name = "refresh_player_count" + } ) + MLG.Refresh( f25_arg0 ) + end + } + f24_local1.children = { + { + type = "UITimer", + id = "lobby_update_timer", + properties = { + event = { + name = "lobby_update_timer", + dispatchChildren = true + }, + disposable = false, + interval = 200 + } + }, + { + type = "lobby_navigation", + properties = { + aliensSoloMode = MBh.Property( "aliensSoloMode" ), + lobbyNavigationPages = PrivateLobbyNavigationPages + } + }, + { + type = "UIBindText", + id = "private_lobby_party_status_id", + properties = { + dataSource = "PrivatePartyStatus" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 93, + left = 655, + width = 525, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + }, + { + type = "UIBindButton", + id = "lobby_bind_buttons_id", + handlers = { + button_secondary = RequestExitPrivateLobby, + button_select = OpenAfterActionReport, + button_start = function ( f26_arg0, f26_arg1 ) + MLG.Toggle( f26_arg0:getParent(), f26_arg1 ) + if MatchRules.AllowCustomClasses( "loadouts" ) then + f26_arg0:dispatchEventToRoot( { + name = "create_class_update_restrictions", + controller = f26_arg1.controller + } ) + end + end + } + }, + { + type = "lobby_loading_widget" + }, + { + type = "lobby_game_type_title" + }, + { + type = "lobby_game_type_icon" + }, + { + type = "UIElement", + id = "LowerSliderID", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 1 + }, + hidden = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 100, + bottom = 100, + alpha = 0 + } + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ), + refresh_player_count = function ( f27_arg0, f27_arg1 ) + if not SvS.IsSvS() then + local f27_local0 = Engine.GetDvarString( "party_lobbyPlayerCount" ) + local f27_local1 = f27_arg0:getParent() + f27_local1:processEvent( { + name = "add_button_helper_text", + button_ref = "players", + helper_text = f27_local0, + side = "right", + clickable = false + } ) + end + end + }, + children = { + { + type = "map_info_text", + id = "map_info_text_id" + }, + { + type = "character_playing_as", + id = "character_playing_as_id" + }, + { + type = "SocialFeedTicker", + id = "social_ticker_id", + properties = { + isLobbyTicker = true + } + }, + { + type = "button_helper_text_main", + id = "cac_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + }, + { + type = "UIElement", + id = "max_members_refresh_container_id", + handlers = { + max_members_refresh = function ( f28_arg0, f28_arg1 ) + if Lobby.IsGameHost() and not Engine.IsAliensMode() then + if Engine.GetDvarString( "ui_gametype" ) == "horde" then + if Engine.GetDvarInt( "party_maxplayers" ) ~= CoD.MaxSafeguardPlayers then + Engine.SetDvarInt( "party_maxplayers", CoD.MaxSafeguardPlayers ) + Engine.Exec( "xtogprivateslots; xtogprivateslots; xsessionupdate" ) + end + else + local f28_local0 = Engine.GetDvarInt( "party_maxPrivatePartyPlayers" ) + if f28_local0 ~= Engine.GetDvarInt( "party_maxplayers" ) then + Engine.SetDvarInt( "party_maxplayers", f28_local0 ) + Engine.Exec( "xtogprivateslots; xtogprivateslots; xsessionupdate" ) + end + end + end + end + }, + children = { + { + type = "UITimer", + id = "max_members_refresh_timer_id", + properties = { + event = "max_members_refresh", + interval = 100, + disposable = false, + broadcastToRoot = false + } + } + } + } + } + return f24_local1 + end + end + f24_local2 = "menu_xboxlive_privatelobby_root" +end + +function menu_xboxlive_privatelobby_push() + if Engine.IsAliensMode() then + Lobby.ClearLocalReadyUpFlag() + end + MatchRules.SetUsingMatchRulesData( 1 ) +end + +function live_private_lobby_options() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_med, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + bot_button_refresh = BotButtonRefresh, + menu_create = BotButtonRefresh + } + } +end + +function GetPrivateLobbyTitleText() + if Engine.IsAliensMode() then + if isAliensSolo() then + return Engine.Localize( "@LUA_MENU_SOLO_MATCH_CAPS" ) + else + return Engine.Localize( "@LUA_MENU_CUSTOM_MATCH_CAPS" ) + end + else + return Engine.Localize( "@LUA_MENU_PRIVATE_MATCH_LOBBY" ) + end +end + +function PrivateLobbyNavigationPages( f32_arg0 ) + local f32_local0 = {} + local f32_local1 = 25 + f32_local0[#f32_local0 + 1] = { + title = GetPrivateLobbyTitleText(), + element = { + type = "UIElement", + id = "lobby_options_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "live_private_lobby_options", + id = "live_private_lobby_options_id", + properties = { + aliensSoloMode = f32_arg0.aliensSoloMode, + additional_handlers = { + refresh_ready_up = MBh.EmitEvent( "menu_refresh" ) + } + }, + childrenFeeder = LivePrivateLobbyOptionsFeeder + } + } + } + } + f32_local0[#f32_local0 + 1] = { + title = Engine.Localize( "@LUA_MENU_LOBBY_LIST_CAPS" ), + element = { + type = "UIElement", + id = "members_page", + properties = { + additional_handlers = { + lobby_page_left = function ( f33_arg0, f33_arg1 ) + f33_arg0:animateToState( "page_left", f33_arg1.animTime or 0, true ) + end, + lobby_page_right = function ( f34_arg0, f34_arg1 ) + f34_arg0:animateToState( "page_right", f34_arg1.animTime or 0, true ) + end + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 550, + top = 0, + bottom = 0 + }, + page_left = { + leftAnchor = false, + rightAnchor = true, + left = -550, + right = 0 + }, + page_right = { + leftAnchor = true, + rightAnchor = false, + left = 0, + right = 550 + } + }, + children = { + { + type = "member_list", + properties = { + memberListState = Lobby.MemberListStates.Lobby, + isPrivateLobby = true + }, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + f32_local1, + spacing = GetMemberListSpacing() + } + } + } + } + } + } + if not Engine.IsAliensMode() or Engine.GetDvarBool( "extinction_cac_enabled" ) then + f32_local0[#f32_local0 + 1] = { + title = Engine.Localize( "@LUA_MENU_PLAYER_STATS_CAPS" ), + element = { + type = "lobby_character_view", + id = "lobby_character_view_id", + properties = { + squad_location = "privateMatchSquadMembers" + } + } + } + end + if Engine.IsAliensMode() and Engine.GetDvarBool( "extinction_cac_enabled" ) then + f32_local0[#f32_local0 + 1] = { + title = Engine.Localize( "@LUA_MENU_PLAYER_COMPARISON_CAPS" ), + element = { + type = "lobby_player_stats", + id = "lobby_player_stats_id", + properties = { + additional_handlers = { + lobby_page_left = function ( f35_arg0, f35_arg1 ) + f35_arg0:animateToState( "page_left", f35_arg1.animTime or 0, true ) + end, + lobby_page_right = function ( f36_arg0, f36_arg1 ) + f36_arg0:animateToState( "page_right", f36_arg1.animTime or 0, true ) + end + } + }, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 550, + top = 0, + bottom = 0 + }, + page_left = { + leftAnchor = false, + rightAnchor = true, + left = -550, + right = 0 + }, + page_right = { + leftAnchor = true, + rightAnchor = false, + left = 0, + right = 550 + } + } + } + } + end + return f32_local0 +end + +LUI.MenuBuilder.registerDef( "menu_xboxlive_privatelobby", menu_xboxlive_privatelobby ) +LUI.FlowManager.RegisterStackPushBehaviour( "menu_xboxlive_privatelobby", menu_xboxlive_privatelobby_push ) +LUI.MenuBuilder.registerDef( "live_private_lobby_options", live_private_lobby_options ) +LockTable( _M ) diff --git a/lui/mp_menus/mplivepubliclobby.dec.lua b/lui/mp_menus/mplivepubliclobby.dec.lua new file mode 100644 index 0000000..613f5f5 --- /dev/null +++ b/lui/mp_menus/mplivepubliclobby.dec.lua @@ -0,0 +1,1455 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function CreateSquadAction( f1_arg0, f1_arg1 ) + Cac.SetEditSquadMember( Cac.GetActiveSquadMember( f1_arg1.controller ) ) + LUI.FlowManager.RequestAddMenu( f1_arg0, "cac_edit_main", true, f1_arg1.controller, false, { + open_char_list = true, + classLocation = "loadouts", + squadLocation = "squadMembers", + squadMemberIndex = Cac.GetEditSquadMember(), + allowMemberSwap = true + } ) +end + +function BarracksAction( f2_arg0, f2_arg1 ) + if Engine.IsUserAGuest( f2_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f2_arg0, "popup_no_guest", true, f2_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f2_arg0, "menu_barracks", true, f2_arg1.controller ) + end +end + +function LobbyLeaderboardAction( f3_arg0, f3_arg1 ) + if Engine.IsUserAGuest( f3_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f3_arg0, "popup_no_guest", true, f3_arg1.controller ) + else + local f3_local0 = nil + if Engine.IsAliensMode() then + f3_local0 = Leaderboards.GetAlienCoopLeaderboardByMapName( Engine.GetDvarString( "ui_mapname" ) ) + else + f3_local0 = Leaderboards.GetLeaderboardByGameType( Engine.GetDvarString( "ui_gametype" ) ) + end + assert( f3_local0 ~= nil ) + LUI.FlowManager.RequestPopupMenu( f3_arg0, "mp_leaderboard_main", true, f3_arg1.controller, false, { + leaderboardType = f3_local0, + filterType = "LobbyMembers", + isPublicLobbyLeaderboard = true + } ) + end +end + +function LivePublicLobbyMenuCreate( f4_arg0, f4_arg1 ) + if SvS.IsSvS() then + LUI.FlowManager.RequestSetStack( f4_arg0, { + { + name = "mp_main_menu" + }, + { + name = "squads_mode_select_menu" + }, + { + name = "menu_xboxlive" + } + } ) + else + LUI.FlowManager.RequestSetStack( f4_arg0, { + { + name = "mp_main_menu" + }, + { + name = "menu_xboxlive" + } + } ) + end + local f4_local0 = Engine.GetFirstActiveController() + f4_arg0:dispatchEventToRoot( { + name = "lobby_update_title", + immediate = true + } ) + if SvS.GetCurrentSquadModeInfo() == SvS.SquadModes.SquadAssault then + f4_arg0:dispatchEventToRoot( { + name = "member_list_refresh", + dispatchChildren = true + } ) + end + if Engine.GetDvarBool( "squad_match" ) and Engine.GetDvarBool( "squad_find_match" ) then + Squad.FindMatch( f4_local0 ) + Engine.SetDvarBool( "squad_find_match", false ) + if SvS.IsSvS() then + Engine.SetDvarInt( "pt_gameStartTimerLength", 10 ) + end + end + if Engine.GetDvarBool( "squad_match" ) and Engine.GetDvarBool( "squad_send_results" ) then + SvS.CachePostMatchData( { + enemyName = Squad.GetEnemySquadOwnerName(), + enemySquadName = Squad.GetEnemySquadName(), + enemyPlayercard = {}, + enemyPlayercard = 0, + enemyPlayercard = 0, + enemyPlayercard = 0, + enemyPlayercard = "", + enemyPlayercard = 0 + } ) + Engine.SetDvarBool( "squad_send_results", false ) + end + if not Engine.IsAliensMode() then + for f4_local1 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.HasActiveLocalClient( f4_local1 ) then + Cac.SyncPrestigeLevel( f4_local1 ) + end + end + end + TryForceOpenAfterActionReport( f4_arg0, f4_arg1 ) + if Engine.IsCoreMode() then + Engine.ExecNow( "eliteclan_refresh", f4_local0 ) + end + Engine.ExecNow( "upload_playercard", f4_local0 ) + Lobby.EnteredLobby() + f4_arg0:processEvent( { + name = "check_button_disable_status", + dispatchChildren = true + } ) + f4_arg0:processEvent( { + name = "update_double_xp_icon" + } ) + Cac.ValidateAllPlayersPublicSquadMembers() +end + +function LivePublicLobbyMenuSpeechHandler( f5_arg0, f5_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.ProcessActionEvent( f5_arg0, f5_arg1, Kinect.LobbySpeechGrammarHandlersArray ) + end +end + +function RequestExitPublicLobby( f6_arg0, f6_arg1 ) + if Engine.HasSpeechFeature() and LUI.MenuAutoNav.IsRunning() then + LUI.mp_menus.mpLobbyWidgets.leaveLobbyAndPartyYesActionWithExitLobby( f6_arg0, f6_arg1 ) + elseif IsOurPrivatePartyHostInLobby() then + LUI.FlowManager.RequestPopupMenu( f6_arg0, "leavelobbyandpartywarning", true, f6_arg1.controller, false, {} ) + else + LUI.FlowManager.RequestPopupMenu( f6_arg0, "leavelobbywarning", true, f6_arg1.controller, false, {} ) + end +end + +function ExitPublicLobby( f7_arg0, f7_arg1 ) + f7_arg0:dispatchEventToRoot( { + name = "exit_public_lobby" + } ) +end + +function VoteForMap( f8_arg0, f8_arg1, f8_arg2 ) + local f8_local0 = assert + local f8_local1 + if f8_arg2 ~= MapVoting.MapA.voteIndex and f8_arg2 ~= MapVoting.MapB.voteIndex then + f8_local1 = false + else + f8_local1 = true + end + f8_local0( f8_local1 ) + if Engine.GetMilliseconds then + f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + if f8_local0.voteDelayEndTime and f8_local0.voteDelayEndTime > Engine.GetMilliseconds() then + f8_arg0:dispatchEventToRoot( { + name = "set_button_info_text", + text = Engine.Localize( "@PATCH_MENU_WAIT_TO_VOTE", f8_local0.voteCount or 1 ) + } ) + return + elseif not f8_local0.voteCount then + f8_local0.voteCount = 1 + elseif f8_local0.voteCount < 6 then + f8_local0.voteCount = f8_local0.voteCount + 1 + end + f8_local0.voteDelayEndTime = Engine.GetMilliseconds() + 1000 * f8_local0.voteCount + end + Engine.Exec( "xpartyvote " .. f8_arg2, f8_arg1 ) +end + +function GetLobbyLeaderboardStatus() + local f9_local0 = Engine.GetDvarString( "ui_gametype" ) + local f9_local1 = Engine.GetDvarString( "ui_mapname" ) + local f9_local2 = false + for f9_local6, f9_local7 in pairs( Leaderboards.Boards ) do + if Engine.IsAliensMode() then + if f9_local7.isAlienCoop and f9_local7.MapName and f9_local7.MapName == f9_local1 then + f9_local2 = true + break + end + end + if f9_local7.GameType and f9_local7.GameType == f9_local0 then + f9_local2 = true + break + end + end + return f9_local2 and Engine.GetDvarInt( "party_matchedPlayerCount" ) <= Engine.GetDvarInt( "party_partyPlayerCountNum" ) +end + +function CheckLobbyLeaderboardStatus( f10_arg0, f10_arg1 ) + if GetLobbyLeaderboardStatus() then + f10_arg0:processEvent( { + name = "enable" + } ) + else + f10_arg0:processEvent( { + name = "disable" + } ) + end +end + +function ReadyUpAction( f11_arg0, f11_arg1 ) + if Lobby.UsingReadyUpFeature() and not Lobby.GetLocalReadyUpFlag() then + Lobby.SetLocalReadyUpFlag() + f11_arg0:dispatchEventToRoot( { + name = "refresh_ready_up" + } ) + end +end + +function GetReadyUpDisableValue() + if not Lobby.UsingReadyUpFeature() then + return true + elseif not Lobby.GetLocalReadyUpFlag() then + return false + else + return true + end +end + +function GetReadyUpDisplayString( f13_arg0, f13_arg1 ) + if Lobby.UsingReadyUpFeature() then + if not Lobby.GetLocalReadyUpFlag() then + return Engine.Localize( "@LUA_MENU_READY_UP_CAPS" ) + end + local f13_local0 = Engine.GetDvarInt( "party_minplayers" ) + local f13_local1 = Lobby.GetMemberCount( Lobby.MemberListStates.Lobby ) + local f13_local2 = 0 + for f13_local3 = 1, f13_local1, 1 do + if Lobby.IsActiveMemberSlot( f13_local3 - 1 ) then + f13_local2 = f13_local2 + 1 + end + end + if f13_local2 < 1 then + return Engine.Localize( "@MENU_WAITING" ) + end + local f13_local3 = f13_local0 - f13_local2 + if f13_local3 == 1 then + return Engine.Localize( "@LUA_MENU_WAITING_FOR_1_MORE_PLAYER_CAPS" ) + elseif f13_local3 > 1 then + return Engine.Localize( "@LUA_MENU_WAITING_FOR_MORE_PLAYERS_CAPS" ) + elseif not Lobby.GetPartyReadyUpStatus() then + return Engine.Localize( "@LUA_MENU_WAITING_FOR_OTHER_PLAYERS_CAPS" ) + end + return Engine.Localize( "@LUA_MENU_WAITING_FOR_GAME_TO_START_CAPS" ) + else + return Engine.Localize( "@MENU_WAITING" ) + end +end + +function GetReadyUpDescText( f14_arg0, f14_arg1 ) + if Lobby.UsingReadyUpFeature() then + if not Lobby.GetLocalReadyUpFlag() then + return Engine.Localize( "@LUA_MENU_DESC_READY_UP" ) + elseif not Lobby.GetPartyReadyUpStatus() then + return Engine.Localize( "@LUA_MENU_DESC_WAITING_FOR_OTHER_PLAYERS" ) + end + end + return Engine.Localize( "@LUA_MENU_DESC_LOCKED_WAITING_FOR_PARTY_MEMBERS" ) +end + +function UpdateReadyUpText( f15_arg0, f15_arg1 ) + if GetReadyUpDisableValue( f15_arg0, f15_arg1 ) then + if not f15_arg0.disabled then + f15_arg0:processEvent( { + name = "disable" + } ) + end + elseif f15_arg0.disabled then + f15_arg0:processEvent( { + name = "enable" + } ) + end + f15_arg0:setText( GetReadyUpDisplayString( f15_arg0, f15_arg1 ) ) +end + +function RefreshButtonDisable( f16_arg0, f16_arg1 ) + assert( f16_arg0.properties.disabledFunc ) + local f16_local0 = f16_arg0.properties.disabledFunc() + if f16_local0 and not f16_arg0.disabled then + f16_arg0:processEvent( { + name = "disable" + } ) + elseif not f16_local0 and f16_arg0.disabled then + f16_arg0:processEvent( { + name = "enable" + } ) + end +end + +function CheckSquadCompareDisabled() + return not Squad.FoundMatch() +end + +function LivePublicLobbyOptionsFeeder( f18_arg0 ) + local f18_local0 = Lobby.GetVoteMapName( MapVoting.MapA.refNum ) + local f18_local1 = Lobby.GetVoteMapName( MapVoting.MapB.refNum ) + local f18_local2 = Lobby.GetVoteMapImage( MapVoting.MapA.refNum ) + local f18_local3 = Lobby.GetVoteMapImage( MapVoting.MapB.refNum ) + local f18_local4 = LUI.mp_menus.Aliens.FixGameModeTextForChaos( Lobby.GetVoteMapGametype( MapVoting.MapA.refNum ) ) + local f18_local5 = LUI.mp_menus.Aliens.FixGameModeTextForChaos( Lobby.GetVoteMapGametype( MapVoting.MapB.refNum ) ) + local f18_local6 = IsVotingFinished() + local f18_local7 = not GetLobbyLeaderboardStatus() + local f18_local8 = Engine.IsAliensMode() + local f18_local9 = SvS.IsSvS() + if not f18_local9 then + f18_local9 = Engine.GetDvarBool( "squad_match" ) + end + local f18_local10 = 14 + local f18_local11 = {} + if not f18_arg0.slot then + DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" ) + local f18_local12 = 0 + end + local f18_local13 = Cac.GetCustomClassLoc( f18_arg0.classLocation ) + if f18_local8 then + local f18_local14 = Engine.GetDvarInt( "pt_AliensReadyUpPublicInUse" ) + if f18_local14 ~= nil and f18_local14 ~= 0 then + f18_local11[#f18_local11 + 1] = { + type = "UIGenericButton", + id = "ready_up_button_id", + disabledFunc = GetReadyUpDisableValue, + properties = { + disabledFunc = GetReadyUpDisableValue, + button_text = "", + button_action_func = ReadyUpAction, + desc_text = GetReadyUpDescText, + additional_handlers = { + recheck_start_button_lock = RefreshButtonDisable, + element_refresh = UpdateReadyUpText, + menu_create = UpdateReadyUpText, + ready_up_button_refresh = UpdateReadyUpText + } + }, + children = { + { + type = "UITimer", + id = "ready_up_button_refresh_timer_id", + properties = { + event = "ready_up_button_refresh", + interval = 100, + disposable = false, + broadcastToRoot = false + } + } + } + } + end + end + if not f18_local8 then + if not SvS.IsSvS() or SvS.GetCurrentSquadModeInfo() ~= SvS.SquadModes.SquadAssault then + f18_local11[#f18_local11 + 1] = { + type = "UIGenericButton", + id = "create_squad_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ), + button_action_func = CreateSquadAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" ) + } + } + end + else + f18_local11[#f18_local11 + 1] = LUI.mp_menus.AliensLoadout.GetAliensLoadoutButton() + end + if not f18_local8 and not f18_local9 then + f18_local11[#f18_local11 + 1] = { + type = "UIGenericButton", + id = "operations_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_OPERATIONS_TITLE" ), + button_action_func = LUI.mp_menus.MPBarracks.BarrackOperationsAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_CHALLENGES" ) + } + } + end + if not f18_local9 and not f18_local8 then + f18_local11[#f18_local11 + 1] = { + type = "UIGenericButton", + id = "barracks_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_BARRACKS_CAPS" ), + button_action_func = BarracksAction, + desc_text = Clan.IsEnabled() and Engine.Localize( "@LUA_MENU_DESC_BARRACKS" ) or Engine.Localize( "@LUA_MENU_DESC_BARRACKS_PRIVATE" ) + } + } + end + if not f18_local9 then + f18_local11[#f18_local11 + 1] = { + type = "UIGenericButton", + id = "lobby_leaderboard_button_id", + disabled = f18_local7, + properties = { + button_text = Engine.Localize( "@LUA_MENU_LOBBY_LEADERBOARD" ), + button_action_func = LobbyLeaderboardAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_LOBBY_LEADERBOARDS" ), + additional_handlers = { + check_button_disable_status = CheckLobbyLeaderboardStatus + } + } + } + end + if f18_local9 then + local f18_local14 = SvS.GetCurrentSquadModeInfo() + if f18_local14 and f18_local14.HasReports then + f18_local11[#f18_local11 + 1] = { + type = "UIGenericButton", + id = "squad_reports_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS" ), + desc_text = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS_DESC" ), + button_action_func = function ( f19_arg0, f19_arg1 ) + LUI.FlowManager.RequestAddMenu( f19_arg0, "squad_reports_menu", false, f19_arg1.controller, false, { + controller = f19_arg1.controller, + fromLiveLobby = true + } ) + end + } + } + end + if f18_local14 and f18_local14.HasCompare then + f18_local11[#f18_local11 + 1] = { + type = "UIGenericButton", + id = "squad_compare_button_id", + disabled = CheckSquadCompareDisabled(), + properties = { + button_text = Engine.Localize( "@LUA_MENU_SQUAD_COMPARE" ), + desc_text = Engine.Localize( "@LUA_MENU_SQUAD_COMPARE_DESC" ), + button_action_func = function ( f20_arg0, f20_arg1 ) + if Squad.FoundMatch() then + local f20_local0 = SvS.BuildSquadCompareData( f20_arg1.controller ) + if f20_local0 then + LUI.FlowManager.RequestAddMenu( f20_arg0, "squad_report_detail_menu", false, f20_arg1.controller, false, { + reportData = f20_local0, + controller = f20_arg1.controller, + isCompare = true + } ) + end + end + end + }, + handlers = { + check_button_disable_status = function ( f21_arg0, f21_arg1 ) + local f21_local0 = f21_arg0 + local f21_local1 = f21_arg0.processEvent + local f21_local2 = {} + local f21_local3 + if not CheckSquadCompareDisabled() then + f21_local3 = "enable" + if not f21_local3 then + + else + f21_local2.name = f21_local3 + f21_local1( f21_local0, f21_local2 ) + end + end + f21_local3 = "disable" + end + } + } + end + end + if f18_local9 then + local f18_local14 = SvS.GetCurrentSquadModeInfo() + if not f18_local14.HasLeaderboard then + + else + f18_local11[#f18_local11 + 1] = { + type = "UIGenericButton", + id = "leaderboards_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARDS" ), + button_action_func = function ( f22_arg0, f22_arg1 ) + if Engine.IsUserAGuest( f22_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f22_arg0, "popup_no_guest", true, f22_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f22_arg0, "leaderboards", true, f22_arg1.controller ) + end + end + } + } + end + end + if f18_local8 then + f18_local11[#f18_local11 + 1] = { + type = "UIGenericButton", + id = "leaderboards_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARDS" ), + button_action_func = function ( f22_arg0, f22_arg1 ) + if Engine.IsUserAGuest( f22_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f22_arg0, "popup_no_guest", true, f22_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f22_arg0, "leaderboards", true, f22_arg1.controller ) + end + end + } + } + end + if f18_local8 and LUI.mp_menus.Aliens.CanAccessIntelMenu() then + f18_local11[#f18_local11 + 1] = LUI.mp_menus.AliensIntel.GetAliensIntelButton() + end + f18_local11[#f18_local11 + 1] = { + type = "button_desc_text", + id = "public_lobby_description_id", + properties = { + lines = 1 + } + } + f18_local11[#f18_local11 + 1] = { + type = "UIElement", + id = "just_a_spacer_id", + focusable = false, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f18_local10 + } + } + } + f18_local11[#f18_local11 + 1] = { + type = "UITimer", + id = "check_status_tmr", + properties = { + event = "check_button_disable_status", + interval = 500, + disposable = false, + broadcastToRoot = true + } + } + if not f18_local9 and not f18_local6 then + f18_local11[#f18_local11 + 1] = { + type = "map_button", + id = "map_button_1", + properties = { + mapVoteIndex = MapVoting.MapA.refNum, + mapImage = RegisterMaterial( f18_local2 ), + mapName = f18_local0, + gamemode = f18_local4, + votesText = Engine.GetDvarString( "party_nextMapVoteStatus" ), + votesDvarName = "party_nextMapVoteStatus", + action = function ( f23_arg0, f23_arg1 ) + VoteForMap( f23_arg0, f23_arg1.controller, MapVoting.MapA.voteIndex ) + end + } + } + f18_local11[#f18_local11 + 1] = { + type = "UIElement", + id = "just_another_spacer_id", + focusable = false, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 40 + } + } + } + f18_local11[#f18_local11 + 1] = { + type = "map_button", + id = "map_button_2", + properties = { + mapVoteIndex = MapVoting.MapB.refNum, + mapImage = RegisterMaterial( f18_local3 ), + mapName = f18_local1, + gamemode = f18_local5, + votesText = Engine.GetDvarString( "party_alternateMapVoteStatus" ), + votesDvarName = "party_alternateMapVoteStatus", + action = function ( f24_arg0, f24_arg1 ) + VoteForMap( f24_arg0, f24_arg1.controller, MapVoting.MapB.voteIndex ) + end + } + } + end + return f18_local11 +end + +function UpdatePlaylistTitleText( f25_arg0, f25_arg1 ) + local f25_local0 = Engine.GetDvarString( "playlist_name" ) + if f25_local0 then + f25_arg0:processEvent( { + name = "update_header_text", + string = f25_local0 + } ) + end +end + +function HandleTransitionToGame( f26_arg0, f26_arg1 ) + if not Lobby.SafeToStartLobbyTransition then + return + end + local f26_local0, f26_local1 = Lobby.GetPartyStatus() + if f26_local1 and f26_local1 > 0 and f26_local1 <= 1 and f26_arg0.properties.transitionToGameStarted == false and Lobby.SafeToStartLobbyTransition() then + f26_arg0.properties.transitionToGameStarted = true + f26_arg0:processEvent( { + name = "lose_focus" + } ) + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), true, "MenuTransition" ) + f26_arg0:dispatchEventToRoot( { + name = "lobby_transition_to_game", + dispatchChildren = true, + immediate = true + } ) + end + if f26_local1 == -1 and f26_arg0.properties.transitionToGameStarted then + f26_arg0:processEvent( { + name = "gain_focus" + } ) + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), false, "MenuTransition" ) + f26_arg0.properties.transitionToGameStarted = false + f26_arg0:dispatchEventToRoot( { + name = "lobby_rollback_transition_to_game", + dispatchChildren = true, + immediate = true + } ) + end +end + +function menu_xboxlive_lobby() + local f27_local0 = Engine.IsAliensMode() + local f27_local1 + if SvS.IsSvS() ~= false then + f27_local1 = SvS.ShouldDisplayAAR() + else + f27_local1 = true + end + local f27_local2 = nil + if f27_local1 then + f27_local2 = OpenAfterActionReport + end + return { + type = "UIElement", + id = "menu_xboxlive_publiclobby_root", + properties = { + transitionToGameStarted = false + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = LivePublicLobbyMenuCreate, + speech_action = LivePublicLobbyMenuSpeechHandler, + exit_public_lobby = MBh.LeaveMenu(), + open_after_action_report = OpenAfterActionReport, + check_transition_to_game = HandleTransitionToGame + }, + children = { + { + type = "UITimer", + id = "check_transition_to_game_id", + properties = { + event = "check_transition_to_game", + interval = 100, + disposable = false + } + }, + { + type = "lobby_navigation", + properties = { + lobbyNavigationPages = PublicLobbyNavigationPages + } + }, + { + type = "UITimer", + id = "options_list_tmr", + properties = { + event = "check_refresh_lobby_options", + interval = 500, + disposable = false, + broadcastToRoot = true + } + }, + { + type = "UIBindButton", + id = "lobby_bind_buttons_id", + handlers = { + button_secondary = RequestExitPublicLobby, + button_select = f27_local2 + } + }, + { + type = "lobby_loading_widget" + }, + { + type = "lobby_game_type_title" + }, + { + type = "lobby_game_type_icon", + properties = { + online = true + } + }, + { + type = "aar_mini", + id = "the_mini_aar_id" + }, + { + type = "UIElement", + id = "LowerSliderID", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 1 + }, + hidden = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 100, + bottom = 100, + alpha = 0 + } + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ), + menu_create = function ( f28_arg0, f28_arg1 ) + f28_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + if f27_local1 then + f28_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addGameSummaryButton ) + end + end + , + refresh_player_count = function ( f29_arg0, f29_arg1 ) + if not SvS.IsSvS() then + local f29_local0 = Engine.GetDvarString( "party_lobbyPlayerCount" ) + local f29_local1 = f29_arg0:getParent() + f29_local1:processEvent( { + name = "add_button_helper_text", + button_ref = "players", + helper_text = f29_local0, + side = "right", + clickable = false + } ) + end + end + + }, + children = { + { + type = "map_info_text", + id = "map_info_text_id" + }, + { + type = "lobby_status", + id = "lobby_status_id" + }, + { + type = "lobby_search_status", + id = "lobby_search_status_id" + }, + { + type = "character_playing_as", + id = "character_playing_as_id" + }, + { + type = "SocialFeedTicker", + id = "social_ticker_id", + properties = { + isLobbyTicker = true + } + }, + { + type = "button_helper_text_main", + id = "cac_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + }, + { + type = "UITimer", + id = "player_count_timer", + properties = { + event = "refresh_player_count", + interval = 200, + disposable = false + } + } + } + } + } + } +end + +function menu_xboxlive_lobby_push() + if Engine.IsAliensMode() then + Lobby.ClearLocalReadyUpFlag() + end +end + +function PublicLobbyNavigationPages( f31_arg0 ) + local f31_local0 = {} + local f31_local1 = 25 + local f31_local2 = GenericMenuDims.menu_top + if SvS.IsSvS() and SvS.GetCurrentSquadModeInfo() == SvS.SquadModes.SquadAssault then + f31_local2 = GenericMenuDims.menu_top - 20 + end + f31_local0[#f31_local0 + 1] = { + title = "Playlist Name", + title_update_func = UpdatePlaylistTitleText, + element = { + type = "UIElement", + id = "live_public_lobby_options_container", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + getXPIcon(), + { + type = "live_public_lobby_options", + id = "live_public_lobby_options_id", + properties = { + additional_handlers = { + refresh_ready_up = MBh.EmitEvent( "menu_refresh" ) + } + }, + childrenFeeder = LivePublicLobbyOptionsFeeder + } + } + } + } + f31_local0[#f31_local0 + 1] = { + title = Engine.Localize( "@LUA_MENU_LOBBY_LIST_CAPS" ), + element = { + type = "UIElement", + id = "members_page", + properties = { + additional_handlers = { + lobby_page_left = function ( f32_arg0, f32_arg1 ) + f32_arg0:animateToState( "page_left", f32_arg1.animTime or 0, true ) + end, + lobby_page_right = function ( f33_arg0, f33_arg1 ) + f33_arg0:animateToState( "page_right", f33_arg1.animTime or 0, true ) + end + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 550, + top = 0, + bottom = 0 + }, + page_left = { + leftAnchor = false, + rightAnchor = true, + left = -550, + right = 0 + }, + page_right = { + leftAnchor = true, + rightAnchor = false, + left = 0, + right = 550 + } + }, + children = { + { + type = "lobby_search_widget", + id = "public_lobby_search_widget" + }, + { + type = "member_list", + properties = { + memberListState = Lobby.MemberListStates.Lobby, + isPublicLobby = true, + delayMemberList = SvS.GetCurrentSquadModeInfo() == SvS.SquadModes.SquadAssault + }, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = f31_local2, + bottom = GenericMenuDims.menu_bottom + f31_local1, + spacing = GetMemberListSpacing() + } + } + } + } + } + } + if not Engine.IsAliensMode() or Engine.GetDvarBool( "extinction_cac_enabled" ) then + f31_local0[#f31_local0 + 1] = { + title = Engine.Localize( "@LUA_MENU_PLAYER_STATS_CAPS" ), + element = { + type = "lobby_character_view", + id = "lobby_character_view_id", + properties = { + squad_location = "squadMembers" + } + } + } + end + f31_local0[#f31_local0 + 1] = { + title = Engine.Localize( "@LUA_MENU_PLAYER_COMPARISON_CAPS" ), + element = { + type = "lobby_player_stats", + id = "lobby_player_stats_id", + properties = { + additional_handlers = { + lobby_page_left = function ( f34_arg0, f34_arg1 ) + f34_arg0:animateToState( "page_left", f34_arg1.animTime or 0, true ) + end, + lobby_page_right = function ( f35_arg0, f35_arg1 ) + f35_arg0:animateToState( "page_right", f35_arg1.animTime or 0, true ) + end + } + }, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 550, + top = 0, + bottom = 0 + }, + page_left = { + leftAnchor = false, + rightAnchor = true, + left = -550, + right = 0 + }, + page_right = { + leftAnchor = true, + rightAnchor = false, + left = 0, + right = 550 + } + } + } + } + if not Engine.IsAliensMode() or Engine.GetDvarBool( "extinction_cac_enabled" ) then + f31_local0[#f31_local0 + 1] = { + element = { + type = "lobby_player_stats", + id = "lobby_player_comparison_id", + properties = { + isComparison = true, + additional_handlers = { + lobby_page_left = function ( f36_arg0, f36_arg1 ) + f36_arg0:animateToState( "page_left", f36_arg1.animTime or 0, true ) + end, + lobby_page_right = function ( f37_arg0, f37_arg1 ) + f37_arg0:animateToState( "page_right", f37_arg1.animTime or 0, true ) + end + } + }, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 550, + top = 0, + bottom = 0 + }, + page_left = { + leftAnchor = false, + rightAnchor = true, + left = -550, + right = 0 + }, + page_right = { + leftAnchor = true, + rightAnchor = false, + left = 0, + right = 550 + } + } + } + } + end + return f31_local0 +end + +function checkRefreshLobbyOptions( f38_arg0, f38_arg1 ) + local f38_local0 = false + local f38_local1 = IsVotingFinished() + local f38_local2 = Lobby.GetHostName() + if f38_arg0.properties.map_voting_complete ~= f38_local1 then + f38_arg0.properties.map_voting_complete = f38_local1 + f38_local0 = true + end + if f38_arg0.properties.hostname ~= f38_local2 then + f38_arg0.properties.hostname = f38_local2 + f38_local0 = true + end + if f38_local0 then + f38_arg0:processEvent( { + name = "menu_refresh" + } ) + end +end + +function CreateLobbyOptions( f39_arg0, f39_arg1 ) + f39_arg0.properties.hostname = Lobby.GetHostName() +end + +function live_public_lobby_options() + return { + type = "UIVerticalList", + id = "live_public_lobby_options_list_id", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_more, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom_tall + } + }, + handlers = { + menu_create = CreateLobbyOptions, + check_refresh_lobby_options = checkRefreshLobbyOptions + } + } +end + +function UpdateVotesText( f41_arg0, f41_arg1 ) + if f41_arg0.properties.votesDvarName ~= "" then + f41_arg0:setText( Engine.GetDvarString( f41_arg0.properties.votesDvarName ) ) + end +end + +function UpdateMyMapImage( f42_arg0, f42_arg1 ) + local f42_local0 = Lobby.GetVoteMapImage( f42_arg0.properties.mapVoteIndex ) + if f42_local0 then + f42_arg0:setImage( RegisterMaterial( f42_local0 ) ) + end +end + +function UpdateMapNameText( f43_arg0, f43_arg1 ) + local f43_local0 = Lobby.GetVoteMapName( f43_arg0.properties.mapVoteIndex ) + if f43_local0 then + f43_arg0:setText( f43_local0 ) + end +end + +function UpdateGameTypeText( f44_arg0, f44_arg1 ) + local f44_local0 = Lobby.GetVoteMapGametype( f44_arg0.properties.mapVoteIndex ) + if f44_local0 then + f44_arg0:setText( LUI.mp_menus.Aliens.FixGameModeTextForChaos( f44_local0 ) ) + end +end + +function MapButtonRefreshAll( f45_arg0, f45_arg1 ) + f45_arg0:processEvent( { + name = "map_button_refresh_all" + } ) +end + +function ExtendMapPanel( f46_arg0, f46_arg1 ) + local f46_local0 = f46_arg0:getParent() + f46_local0:dispatchEventToChildren( { + name = "expand" + } ) + f46_local0:dispatchEventToChildren( { + name = "updateBorderColor", + red = Colors.grey_3.r, + green = Colors.grey_3.g, + blue = Colors.grey_3.b, + alpha = 1 + } ) +end + +function ContractMapPanel( f47_arg0, f47_arg1 ) + local f47_local0 = f47_arg0:getParent() + f47_local0:dispatchEventToChildren( { + name = "contract" + } ) + f47_local0:dispatchEventToChildren( { + name = "updateBorderColor", + red = Colors.grey_2.r, + green = Colors.grey_2.g, + blue = Colors.grey_2.b, + alpha = 1 + } ) +end + +function map_button() + local f48_local0 = Engine.IsAliensMode() and 80 or 114 + local f48_local1 = Engine.IsAliensMode() and 130 or 0 + return { + type = "UIElement", + focusable = true, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = -34, + bottom = f48_local0 + } + }, + properties = { + mapVoteIndex = -1, + mapImage = RegisterMaterial( "" ), + mapName = "", + gamemode = "", + votesText = "", + votesDvarName = "", + action = function () + DebugPrint( "OverrideMe" ) + end + + }, + handlers = { + map_info_refresh = MapButtonRefreshAll + }, + children = { + { + type = "UITimer", + id = "map_button_timer", + properties = { + event = "map_info_refresh", + interval = 200, + disposable = false + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.black, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + width = 100, + material = RegisterMaterial( "white" ) + } ) + } + }, + { + type = "UIImage", + id = "map_image_shadow", + states = { + default = { + material = RegisterMaterial( "img_lobby_map_shadow" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 40, + top = -30, + bottom = 70 + }, + focused = { + material = RegisterMaterial( "img_lobby_map_shadow" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 70, + top = -30, + bottom = 70 + } + }, + handlers = { + expand = MBh.AnimateToState( "focused", 100 ), + contract = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIButton", + id = "map_panel_container", + properties = { + action = MBh.Property( "action" ), + mapImage = MBh.Property( "mapImage" ), + mapVoteIndex = MBh.Property( "mapVoteIndex" ), + votesDvarName = MBh.Property( "votesDvarName" ), + votesText = MBh.Property( "votesText" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = -12, + right = -12 + }, + focused = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 28, + right = 28 + } + }, + handlers = { + expand = MBh.AnimateToState( "focused", 100 ), + contract = MBh.AnimateToState( "default", 0 ), + button_action = function ( f50_arg0, f50_arg1 ) + f50_arg0.properties:action( f50_arg1 ) + end + + }, + children = { + { + type = "UIStencil", + id = "map_stencil_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UIImage", + id = "map_image_id", + states = { + default = { + material = MBh.Property( "mapImage" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0 - f48_local1, + bottom = 0 + f48_local1 + } + }, + handlers = { + map_button_refresh_all = UpdateMyMapImage, + element_refresh = UpdateMyMapImage + } + } + } + }, + { + type = "UIImage", + id = "map_text_darken", + states = { + default = { + material = RegisterMaterial( "img_map_darken" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 1, + right = -1, + top = -40, + bottom = -1 * f48_local0, + alpha = 0.75 + } + } + }, + { + type = "UIText", + id = "gamemode_name_text_id", + properties = { + text = "", + textStyle = CoD.TextStyle.Shadowed, + mapVoteIndex = MBh.Property( "mapVoteIndex" ) + }, + states = { + default = { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = -10, + top = 3, + bottom = 3 + CoD.TextSettings.NormalFont.Height, + red = 0.5, + green = 0.5, + blue = 0.5 + } + }, + handlers = { + map_button_refresh_all = UpdateGameTypeText, + element_refresh = UpdateGameTypeText + } + }, + { + type = "UIText", + id = "num_votes_text_id", + properties = { + text = "", + textStyle = CoD.TextStyle.Shadowed, + votesDvarName = MBh.Property( "votesDvarName" ) + }, + states = { + default = { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = -10, + top = 20, + bottom = 20 + CoD.TextSettings.NormalFont.Height + } + }, + handlers = { + map_button_refresh_all = UpdateVotesText, + element_refresh = UpdateVotesText + } + }, + { + type = "generic_border", + id = "boarder_image_id", + properties = { + inner = true, + thickness = 2, + border_red = Colors.grey_2.r, + border_green = Colors.grey_2.g, + border_blue = Colors.grey_2.b, + border_alpha = 1 + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.black, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + width = 100, + material = RegisterMaterial( "box_white_gradient_fade" ) + } ) + } + } + } + }, + { + type = "UIGenericButton", + id = "map_button", + properties = { + button_text = MBh.Property( "mapName" ), + desc_text = Engine.Localize( "@LUA_MENU_VOTE_FOR_MAP" ), + action = MBh.Property( "action" ), + mapVoteIndex = MBh.Property( "mapVoteIndex" ), + button_over_func = ExtendMapPanel, + button_up_func = ContractMapPanel + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = f48_local0 - 1, + bottom = f48_local0 - 1 + GenericButtonSettings.Styles.GradientButton.height, + left = 0, + right = -5 + } + }, + handlers = { + button_action = function ( f51_arg0, f51_arg1 ) + f51_arg0.properties:action( f51_arg1 ) + end + , + map_button_refresh_all = UpdateMapNameText + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "map_button", map_button ) +LUI.MenuBuilder.registerDef( "menu_xboxlive_lobby", menu_xboxlive_lobby ) +LUI.FlowManager.RegisterStackPushBehaviour( "menu_xboxlive_lobby", menu_xboxlive_lobby_push ) +LUI.MenuBuilder.registerDef( "live_public_lobby_options", live_public_lobby_options ) +LockTable( _M ) diff --git a/lui/mp_menus/mplobbycharacterview.dec.lua b/lui/mp_menus/mplobbycharacterview.dec.lua new file mode 100644 index 0000000..0d6fbac --- /dev/null +++ b/lui/mp_menus/mplobbycharacterview.dec.lua @@ -0,0 +1,324 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function UpdateMemberWindowProperties( f1_arg0, f1_arg1 ) + f1_arg0.properties.memberListState = f1_arg1.memberListState + f1_arg0.properties.memberSlot = f1_arg1.memberSlot + f1_arg0.properties.team = f1_arg1.team + f1_arg0:processEvent( { + name = "refresh_member_window" + } ) +end + +function RefreshMemberWindow( f2_arg0, f2_arg1 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) + local f2_local1 = f2_arg0.properties + local f2_local2 = f2_local1.memberListState + local f2_local3 = f2_local1.memberSlot + local f2_local4 = f2_local1.team + if f2_local2 == Lobby.MemberListStates.None then + return + elseif f2_local0.selectedMemberUniqueId ~= GetLobbyMemberUniqueId( f2_local2, f2_local3, f2_local4 ) then + return + end + local f2_local5 = Engine.TableLookup( BackgroundsTable.File, BackgroundsTable.Cols.Ref, Lobby.GetMemberBackground and Lobby.GetMemberBackground( f2_local2, f2_local3, f2_local4 ) or 0, BackgroundsTable.Cols.Image ) + if f2_local5 ~= nil then + f2_arg0:setBackground( f2_local5 ) + end + local f2_local6 = {} + local f2_local7 = Lobby.GetMemberPartModelName( f2_local2, f2_local3, f2_local4, Lobby.CustomizationTypes.Head ) + if f2_local7 and f2_local7 ~= "" then + if Engine.TableLookup( "mp/cac/helmets.csv", 0, f2_local7, 4 ) == "1" and string.find( f2_local7, "alt", -4 ) ~= nil then + f2_local7 = string.sub( f2_local7, 0, -4 ) .. "alt_f" + end + f2_local6.headModel = f2_local7 + end + local f2_local8 = Lobby.GetMemberPartModelName( f2_local2, f2_local3, f2_local4, Lobby.CustomizationTypes.Body ) + if f2_local8 and f2_local8 ~= "" then + f2_local6.bodyModel = string.sub( f2_local8, 0, -6 ) .. "elite" + end + local f2_local9 = Lobby.GetMemberPatch( f2_local2, f2_local3, f2_local4 ) + if f2_local9 then + f2_local6.patch = f2_local9 + end + if Engine.IsAliensMode() then + local f2_local10 = Lobby.GetMemberPerk( f2_local3, 1 ) + if f2_local10 then + f2_local6.primaryWeaponName = "iw6_" .. string.sub( f2_local10, string.len( "perk_pistol_" ) + 1 ) .. "_mp" + end + else + local f2_local10 = Lobby.GetMemberWeaponSetup( f2_local2, f2_local3, f2_local4 ) + local f2_local11 = 0 + if f2_local10.camoName then + f2_local11 = tonumber( Cac.GetCamoWeaponIndex( f2_local10.camoName ) ) + end + local f2_local12 = Cac.BuildWeaponName( f2_local10.weaponName, f2_local10.attachName1, f2_local10.attachName2, f2_local11, 0, f2_local10.attachName3 ) + if f2_local12 then + f2_local6.primaryWeaponName = f2_local12 + end + end + f2_arg0:updateCharacter( f2_local6 ) +end + +function LobbyCharacterViewUpdateSquadBotInfo( f3_arg0, f3_arg1 ) + if Lobby.IsMemberAISquadMember and Lobby.IsMemberAISquadMember( f3_arg1.memberListState, f3_arg1.memberSlot, f3_arg1.team ) then + f3_arg0:animateToState( "default" ) + else + f3_arg0:animateToState( "hidden" ) + end +end + +function LobbyCharacterViewSetSquadBotWeaponClassText( f4_arg0, f4_arg1 ) + local f4_local0 = Lobby.IsMemberAISquadMember + if f4_local0 then + f4_local0 = Lobby.IsMemberAISquadMember( f4_arg1.memberListState, f4_arg1.memberSlot, f4_arg1.team ) + end + if not f4_local0 or not Lobby.IsActiveMemberSlot( f4_arg1.memberIndex - 1 ) or not Lobby.GetSquadMemberWeaponName then + return + end + local f4_local1 = Lobby.GetSquadMemberWeaponName( f4_arg1.memberListState, f4_arg1.memberSlot, f4_arg1.team, f4_arg1.controller ) + local f4_local2 = "" + if f4_local1 == "iw6_knifeonly" then + f4_local2 = Cac.GetWeaponName( f4_local1 ) + else + f4_local2 = Cac.GetWeaponCategoryNameSingle( Cac.GetWeaponClass( f4_local1 ) ) + end + if f4_local2 then + f4_arg0:setText( f4_local2 ) + end + f4_arg0:animateToState( "default" ) +end + +function LobbyCharacterViewSetSquadBotWeaponText( f5_arg0, f5_arg1 ) + local f5_local0 = Lobby.IsMemberAISquadMember + if f5_local0 then + f5_local0 = Lobby.IsMemberAISquadMember( f5_arg1.memberListState, f5_arg1.memberSlot, f5_arg1.team ) + end + if not f5_local0 or not Lobby.IsActiveMemberSlot( f5_arg1.memberIndex - 1 ) or not Lobby.GetSquadMemberWeaponName then + return + end + local f5_local1 = Lobby.GetSquadMemberWeaponName( f5_arg1.memberListState, f5_arg1.memberSlot, f5_arg1.team, f5_arg1.controller ) + if f5_local1 == "iw6_knifeonly" then + f5_arg0:setText( "" ) + else + f5_arg0:setText( Cac.GetWeaponName( f5_local1 ) ) + end + f5_arg0:animateToState( "default" ) +end + +function CharacterViewChildFeeder( f6_arg0 ) + local f6_local0 = { + { + type = "UISquadMemberWindow", + id = "CharacterViewSquadMemberWindow", + properties = { + use_member_name = false, + use_prestige_icon = false, + use_playercard = false, + use_background = true, + default_anim = Cac.Customization.Animations.default, + uv_values = { + 0, + 0, + 1, + 1 + }, + character_pos = CharacterCameraPresets.Lobby.Position, + char_window_dims = { + top = 0, + bottom = 610, + left = -175, + right = 435 + }, + card_scale = -0.15, + squad_location = MBh.Property( "squad_location" ), + mask_pos_data = { + top = 17, + bottom = 0, + left = 0, + right = 0 + }, + memberListState = Lobby.MemberListStates.None, + memberSlot = 0, + team = Teams.free + }, + 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 = function ( f7_arg0, f7_arg1 ) + f7_arg0:processEvent( { + name = "set_border_state", + border_state = "hidden" + } ) + end, + lobby_detail_update = UpdateMemberWindowProperties, + refresh_member_window = RefreshMemberWindow, + menu_close = function ( f8_arg0, f8_arg1 ) + LUI.UISquadMemberWindow.Shutdown( f8_arg0 ) + end + } + }, + { + type = "UITimer", + id = "member_window_refresh_timer", + properties = { + event = "refresh_member_window", + interval = 300, + disposable = false + } + } + } + if SvS.IsSvS() then + f6_local0[#f6_local0 + 1] = { + type = "UIVerticalList", + id = "lobby_character_view_squad_weapon_container", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = 20, + right = 500, + top = -200, + bottom = -250, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + lobby_detail_update = LobbyCharacterViewUpdateSquadBotInfo + }, + children = { + { + type = "UIText", + id = "lobby_character_view_squad_weapon_cat", + properties = { + text = "" + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + textStyle = CoD.TextStyle.ShadowedMore, + alignment = LUI.Alignment.Right, + alpha = 1, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + }, + hidden = { + alpha = 0 + } + }, + handlers = { + lobby_detail_update = LobbyCharacterViewSetSquadBotWeaponClassText + } + }, + { + type = "UIText", + id = "lobby_character_view_squad_weapon_name", + properties = { + text = "" + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + textStyle = CoD.TextStyle.ShadowedMore, + alignment = LUI.Alignment.Right, + alpha = 1, + red = Colors.grey_4.r, + green = Colors.grey_4.g, + blue = Colors.grey_4.b + }, + hidden = { + alpha = 0 + } + }, + handlers = { + lobby_detail_update = LobbyCharacterViewSetSquadBotWeaponText + } + } + } + } + end + return f6_local0 +end + +function lobby_character_view() + return { + type = "UIElement", + id = "lobby_character_view_id", + focusable = true, + properties = { + squad_location = "privateMatchSquadMembers" + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } + }, + handlers = { + lobby_detail_update = function ( f10_arg0, f10_arg1 ) + local f10_local0 = false + if SvS.IsSvS() and (not Lobby.IsMemberAISquadMember or Lobby.IsMemberAISquadMember( f10_arg1.memberListState, f10_arg1.memberSlot, f10_arg1.team )) then + f10_local0 = true + end + if not Lobby.ShowMemberInfo( f10_arg1.memberListState, f10_arg1.memberSlot, f10_arg1.team ) then + f10_local0 = true + end + if f10_local0 then + f10_arg0:dispatchEventToParent( { + name = "page_disable", + immediate = true + } ) + else + f10_arg0:dispatchEventToParent( { + name = "page_enable", + immediate = true + } ) + end + end + + }, + childrenFeeder = CharacterViewChildFeeder + } +end + +LUI.MenuBuilder.registerDef( "lobby_character_view", lobby_character_view ) +LockTable( _M ) diff --git a/lui/mp_menus/mplobbynavigation.dec.lua b/lui/mp_menus/mplobbynavigation.dec.lua new file mode 100644 index 0000000..23da119 --- /dev/null +++ b/lui/mp_menus/mplobbynavigation.dec.lua @@ -0,0 +1,725 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function DefaultLobbyTitleUpdateStub( f1_arg0, f1_arg1 ) + +end + +function DefaultShouldDisableSlideRightFunc( f2_arg0, f2_arg1 ) + return false +end + +function LobbyNavigationFeeder( f3_arg0 ) + local f3_local0 = {} + local f3_local1 = f3_arg0:lobbyNavigationPages() + local f3_local2 = #f3_local1 + for f3_local3 = 1, f3_local2, 1 do + local f3_local6 = f3_local1[f3_local3].title or "" + local f3_local7 = f3_local1[f3_local3].title_update_func or DefaultLobbyTitleUpdateStub + assert( f3_local1[f3_local3].element ) + assert( f3_local1[f3_local3].element.id ) + f3_local0[#f3_local0 + 1] = { + type = "UIElement", + id = "lobby_navigation_slide_button_" .. f3_local3, + properties = { + pageIndex = f3_local3, + pageCount = f3_local2, + aliensSoloMode = f3_arg0.aliensSoloMode, + isDisabled = false, + elementId = f3_local1[f3_local3].element.id, + should_disable_slide_right_func = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0:getChildById( f4_arg0.properties.elementId ) + if f4_local0.properties and f4_local0.properties.should_disable_slide_right_func then + return f4_local0.properties:should_disable_slide_right_func( f4_arg1 ) + else + return false + end + end + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 640 + } + }, + handlers = { + page_disable = function ( f5_arg0, f5_arg1 ) + f5_arg0.properties.isDisabled = true + f5_arg0:dispatchEventToParent( { + name = "refresh_arrows", + immediate = true + } ) + end, + page_enable = function ( f6_arg0, f6_arg1 ) + f6_arg0.properties.isDisabled = false + f6_arg0:dispatchEventToParent( { + name = "refresh_arrows", + immediate = true + } ) + end + }, + children = { + { + type = "generic_menu_title", + id = "mp_lobby_title_text_id", + properties = { + menu_title = f3_local1[f3_local3].title, + disableLobbyStatus = true, + additional_handlers = { + lobby_page_left = function ( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg1.animTime or 0 + f7_arg0:processEvent( { + name = "menu_title_show", + preAnimTime = f7_local0 * 0.5, + animTime = f7_local0 * 0.5 + } ) + end, + lobby_page_right = function ( f8_arg0, f8_arg1 ) + f8_arg0:processEvent( { + name = "menu_title_hide", + preAnimTime = (f8_arg1.animTime or 0) * 0.5, + animTime = 0 + } ) + end, + lobby_page_leave = function ( f9_arg0, f9_arg1 ) + local f9_local0 = f9_arg1.animTime or 0 + f9_arg0:processEvent( { + name = "menu_title_hide", + preAnimTime = f9_local0 * 0.5, + animTime = f9_local0 * 0.5 + } ) + end + } + }, + handlers = { + lobby_update_title = f3_local7, + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + }, + f3_local1[f3_local3].element + } + } + end + return f3_local0 +end + +function HandleLobbyNavigationPagesCreate( f10_arg0, f10_arg1 ) + local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 ) + if not f10_local0.focusedPage then + f10_local0.focusedPage = 1 + elseif f10_local0.focusedPage > 2 then + f10_local0.focusedPage = 2 + f10_arg0:processEvent( { + name = "refocus_member_list", + inFocus = true + } ) + end + local f10_local1 = f10_arg0.properties:lobbyNavigationPages() + for f10_local2 = 1, #f10_local1, 1 do + local f10_local5 = -1 * (f10_local2 - 1) * 640 + f10_arg0:registerAnimationState( "slide_" .. f10_local2, { + leftAnchor = true, + rightAnchor = false, + left = f10_local5, + right = f10_local5 + 1280 + } ) + f10_arg0:registerEventHandler( "transition_complete_slide_" .. f10_local2, HandleLobbyNavigationTransitionComplete ) + end + f10_arg0:animateToState( "slide_" .. f10_local0.focusedPage, 0, true ) + local f10_local2 = f10_arg0:getFirstChild() + while f10_local2 do + if f10_local2.properties.pageIndex == f10_local0.focusedPage then + f10_local2:processEvent( { + name = "lobby_page_left", + dispatchChildren = true + } ) + f10_local2:processEvent( { + name = "lobby_page_enter", + dispatchChildren = true + } ) + elseif f10_local2.properties.pageIndex == f10_local0.focusedPage + 1 then + f10_local2:processEvent( { + name = "lobby_page_right", + dispatchChildren = true + } ) + f10_local2:processEvent( { + name = "lobby_page_enter", + dispatchChildren = true + } ) + else + f10_local2:processEvent( { + name = "lobby_page_leave", + dispatchChildren = true + } ) + end + f10_local2 = f10_local2:getNextSibling() + end +end + +function HandleLobbyNavigationRefreshArrows( f11_arg0, f11_arg1 ) + local f11_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f11_arg0 ) + local f11_local1 = f11_arg0.properties:lobbyNavigationPages() + local f11_local2 = f11_arg0:getParent() + if f11_local0.focusedPage <= 1 then + f11_local2:processEvent( { + name = "lobby_arrow_lt_hide" + } ) + else + f11_local2:processEvent( { + name = "lobby_arrow_lt_show" + } ) + end + local f11_local3 = false + local f11_local4 = f11_arg0:getFirstChild() + while f11_local4 do + if f11_local4.properties.pageIndex == f11_local0.focusedPage + 1 then + if f11_local4.properties.isDisabled or f11_local4.properties.should_disable_slide_right_func and f11_local4.properties:should_disable_slide_right_func( f11_arg1.controller ) then + f11_local3 = true + break + end + f11_local3 = false + end + f11_local4 = f11_local4:getNextSibling() + end + if not f11_local3 then + if #f11_local1 - 1 <= f11_local0.focusedPage then + f11_local3 = true + else + f11_local3 = false + end + end + if f11_local3 then + f11_local2:processEvent( { + name = "lobby_arrow_rt_hide" + } ) + else + f11_local2:processEvent( { + name = "lobby_arrow_rt_show" + } ) + end +end + +function HandleLobbyNavigationSlideLeft( f12_arg0, f12_arg1 ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + if f12_local0.animating then + return + elseif f12_arg0.properties.slideDisabled then + return + elseif not isNavMenuOnTop() then + return + end + local f12_local1 = f12_arg0.properties:lobbyNavigationPages() + if f12_local0.focusedPage > 1 then + local f12_local2 = false + local f12_local3 = f12_arg0:getFirstChild() + while f12_local3 do + if f12_local3.properties.pageIndex == f12_local0.focusedPage - 1 then + f12_local2 = f12_local3.properties.isDisabled + end + end + if not f12_local2 then + f12_local0.animating = true + f12_arg0:animateToState( "slide_" .. f12_local0.focusedPage - 1, 200, true ) + local f12_local4 = f12_arg0:getFirstChild() + while f12_local4 do + if f12_local4.properties.pageIndex == f12_local0.focusedPage then + f12_local4:processEvent( { + name = "lobby_page_right", + animTime = 200, + dispatchChildren = true + } ) + f12_local4:processEvent( { + name = "lose_focus" + } ) + elseif f12_local4.properties.pageIndex == f12_local0.focusedPage - 1 then + f12_local4:processEvent( { + name = "lobby_page_enter", + animTime = 200, + controller = f12_arg1.controller, + dispatchChildren = true + } ) + f12_local4:processEvent( { + name = "lobby_page_left", + animTime = 200, + dispatchChildren = true + } ) + elseif f12_local4.properties.pageIndex == f12_local0.focusedPage + 1 then + f12_local4:processEvent( { + name = "lobby_page_leave", + animTime = 200, + controller = f12_arg1.controller, + dispatchChildren = true + } ) + end + f12_local4 = f12_local4:getNextSibling() + end + f12_local0.focusedPage = f12_local0.focusedPage - 1 + local f12_local5 = f12_arg0:getFirstChild() + while f12_local5 do + if f12_local5.properties.pageIndex == f12_local0.focusedPage then + f12_local5:processEvent( { + name = "gain_focus" + } ) + end + f12_local5 = f12_local5:getNextSibling() + end + f12_arg0:processEvent( { + name = "refresh_arrows" + } ) + else + + end + f12_local3 = f12_local3:getNextSibling() + elseif not Engine.IsConsoleGame() then + local f12_local2 = f12_arg0:getFirstChild() + if not f12_local2:isInFocus() then + f12_local2 = f12_arg0:getFirstChild() + while f12_local2 do + if f12_local2.properties.pageIndex == f12_local0.focusedPage + 1 then + f12_local2:processEvent( { + name = "lose_focus" + } ) + end + f12_local2 = f12_local2:getNextSibling() + end + f12_local2 = f12_arg0:getFirstChild() + while f12_local2 do + if f12_local2.properties.pageIndex == f12_local0.focusedPage then + f12_local2:processEvent( { + name = "gain_focus" + } ) + end + f12_local2 = f12_local2:getNextSibling() + end + end + end +end + +function HandleLobbyNavigationSlideRight( f13_arg0, f13_arg1 ) + local f13_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f13_arg0 ) + if f13_local0.animating then + return + elseif f13_arg0.properties.slideDisabled then + return + elseif not isNavMenuOnTop() then + return + elseif f13_local0.focusedPage < #f13_arg0.properties:lobbyNavigationPages() - 1 then + local f13_local1 = false + local f13_local2 = f13_arg0:getFirstChild() + while f13_local2 do + if f13_local2.properties.pageIndex == f13_local0.focusedPage + 1 then + f13_local1 = f13_local2.properties.should_disable_slide_right_func and (f13_local2.properties.isDisabled or f13_local2.properties:should_disable_slide_right_func( f13_arg1.controller )) + end + end + if not f13_local1 then + f13_local0.animating = true + f13_arg0:animateToState( "slide_" .. f13_local0.focusedPage + 1, 200, true ) + local f13_local3 = f13_arg0:getFirstChild() + while f13_local3 do + if f13_local3.properties.pageIndex == f13_local0.focusedPage + 1 then + f13_local3:processEvent( { + name = "lobby_page_left", + animTime = 200, + dispatchChildren = true + } ) + elseif f13_local3.properties.pageIndex == f13_local0.focusedPage + 2 then + f13_local3:processEvent( { + name = "lobby_page_enter", + animTime = 200, + controller = f13_arg1.controller, + dispatchChildren = true + } ) + f13_local3:processEvent( { + name = "lobby_page_right", + animTime = 200, + dispatchChildren = true + } ) + elseif f13_local3.properties.pageIndex == f13_local0.focusedPage then + f13_local3:processEvent( { + name = "lobby_page_leave", + animTime = 200, + controller = f13_arg1.controller, + dispatchChildren = true + } ) + f13_local3:processEvent( { + name = "lose_focus" + } ) + end + f13_local3 = f13_local3:getNextSibling() + end + f13_local0.focusedPage = f13_local0.focusedPage + 1 + local f13_local4 = f13_arg0:getFirstChild() + while f13_local4 do + if f13_local4.properties.pageIndex == f13_local0.focusedPage then + f13_local4:processEvent( { + name = "gain_focus" + } ) + end + f13_local4 = f13_local4:getNextSibling() + end + f13_arg0:processEvent( { + name = "refresh_arrows", + controller = f13_arg1.controller + } ) + else + + end + f13_local2 = f13_local2:getNextSibling() + end +end + +function HandleLobbyNavigationSlideEnable( f14_arg0, f14_arg1 ) + f14_arg0.properties.slideDisabled = false +end + +function HandleLobbyNavigationSlideDisable( f15_arg0, f15_arg1 ) + f15_arg0.properties.slideDisabled = true +end + +function HandleLobbyNavigationGamepadButton( f16_arg0, f16_arg1 ) + if f16_arg0.properties.slideDisabled then + f16_arg0:dispatchEventToChildren( f16_arg1 ) + return false + end + local f16_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f16_arg0 ) + if f16_arg1.down == true then + if f16_arg1.button == "left" then + if f16_local0.animating then + return true + end + f16_arg0:processEvent( { + name = "lobby_slide_left", + controller = f16_arg1.controller, + dispatchChildren = true + } ) + elseif f16_arg1.button == "right" then + if f16_local0.animating then + return true + end + f16_arg0:processEvent( { + name = "lobby_slide_right", + controller = f16_arg1.controller, + dispatchChildren = true + } ) + end + end + return LUI.UIElement.GamepadButton( f16_arg0, f16_arg1 ) +end + +function HandleLobbyNavigationTransitionComplete( f17_arg0, f17_arg1 ) + local f17_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f17_arg0 ) + f17_local0.animating = false + if f17_local0.force_press_lobby_navigation_arrow_right_btn == true then + f17_local0.force_press_lobby_navigation_arrow_right_btn = false + Kinect.PressMenuButton( "lobby_navigation_arrow_right_btn" ) + end +end + +function HandleLobbyArrowLeft( f18_arg0, f18_arg1 ) + local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0:getParent() ) + local f18_local1 = f18_arg0.properties:lobbyNavigationPages() + if f18_local0.focusedPage > 1 then + f18_arg0:dispatchEventToRoot( { + name = "lobby_slide_left", + focusedPage = f18_local0.focusedPage, + dispatchChildren = true + } ) + end +end + +function HandleLobbyArrowRight( f19_arg0, f19_arg1 ) + local f19_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f19_arg0:getParent() ) + if f19_local0.focusedPage < #f19_arg0.properties:lobbyNavigationPages() - 1 then + f19_arg0:dispatchEventToRoot( { + name = "lobby_slide_right", + focusedPage = f19_local0.focusedPage, + dispatchChildren = true + } ) + end +end + +function HandleLobbyNavigationCreate( f20_arg0, f20_arg1 ) + local f20_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f20_arg0 ) + f20_local0.animating = false + f20_arg0:processEvent( { + name = "refresh_arrows" + } ) +end + +function HandleLobbyNavigationListGainFocus( f21_arg0, f21_arg1 ) + local f21_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f21_arg0 ) + local f21_local1 = f21_arg0:getFirstChild() + while f21_local1 do + if f21_local1.properties.pageIndex == f21_local0.focusedPage then + f21_local1:processEvent( { + name = "gain_focus" + } ) + break + end + f21_local1 = f21_local1:getNextSibling() + end +end + +function HandleLobbyNavigationListLoseFocus( f22_arg0, f22_arg1 ) + local f22_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f22_arg0 ) + local f22_local1 = f22_arg0:getFirstChild() + while f22_local1 do + if f22_local1.properties.pageIndex == f22_local0.focusedPage then + f22_local1:processEvent( { + name = "lose_focus" + } ) + end + if not Engine.IsConsoleGame() and f22_local1.properties.pageIndex == f22_local0.focusedPage + 1 then + f22_local1:processEvent( { + name = "lose_focus" + } ) + end + f22_local1 = f22_local1:getNextSibling() + end +end + +function HandleArrowOnOver( f23_arg0, f23_arg1 ) + if isNavMenuOnTop() and f23_arg1.focusType == FocusType.MouseOver then + f23_arg0:dispatchEventToRoot( { + name = "lobby_slide_enable", + dispatchChildren = true + } ) + end +end + +function lobby_navigation() + return { + type = "UIElement", + id = "lobby_navigation_id", + properties = { + lobbyNavigationPages = function ( f25_arg0 ) + return {} + end + , + aliensSoloMode = false + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = HandleLobbyNavigationCreate + }, + children = { + { + type = "UIHorizontalList", + id = "lobby_navigation_list_id", + properties = { + lobbyNavigationPages = MBh.Property( "lobbyNavigationPages" ), + aliensSoloMode = MBh.Property( "aliensSoloMode" ), + noWrap = true, + slideDisabled = false + }, + states = { + default = { + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + menu_create = HandleLobbyNavigationPagesCreate, + gamepad_button = HandleLobbyNavigationGamepadButton, + lobby_slide_left = HandleLobbyNavigationSlideLeft, + lobby_slide_right = HandleLobbyNavigationSlideRight, + lobby_slide_enable = HandleLobbyNavigationSlideEnable, + lobby_slide_disable = HandleLobbyNavigationSlideDisable, + refresh_arrows = HandleLobbyNavigationRefreshArrows, + gain_focus = HandleLobbyNavigationListGainFocus, + lose_focus = HandleLobbyNavigationListLoseFocus, + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + }, + childrenFeeder = LobbyNavigationFeeder + }, + { + type = "UIButton", + id = "lobby_navigation_arrow_left_btn", + properties = { + lobbyNavigationPages = MBh.Property( "lobbyNavigationPages" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 75, + right = 91, + top = 57, + bottom = 73 + }, + pan = MBh.BaseState( "default", { + left = 70, + right = 86 + } ) + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "pan", + 500, + true, + true + }, + { + "default", + 500, + true, + true + } + } ), + button_action = HandleLobbyArrowLeft, + button_over = HandleArrowOnOver, + lobby_arrow_lt_show = MBh.EmitEvent( "enable" ), + lobby_arrow_lt_hide = MBh.EmitEvent( "disable" ) + }, + children = { + { + type = "UIImage", + id = "lobby_navigation_arrow_left", + states = { + default = { + material = RegisterMaterial( "widg_lobby_arrow" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 16, + right = 0, + top = 0, + bottom = 0, + alpha = 0.5 + }, + over = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + button_disable = MBh.AnimateToState( "hidden" ), + button_over_disable = MBh.AnimateToState( "hidden" ), + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + } + } + }, + { + type = "UIButton", + id = "lobby_navigation_arrow_right_btn", + properties = { + lobbyNavigationPages = MBh.Property( "lobbyNavigationPages" ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -91, + right = -75, + top = 57, + bottom = 73 + }, + pan = MBh.BaseState( "default", { + left = -86, + right = -70 + } ) + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "pan", + 500, + true, + true + }, + { + "default", + 500, + true, + true + } + } ), + button_action = HandleLobbyArrowRight, + button_over = HandleArrowOnOver, + lobby_arrow_rt_show = MBh.EmitEvent( "enable" ), + lobby_arrow_rt_hide = MBh.EmitEvent( "disable" ) + }, + children = { + { + type = "UIImage", + id = "lobby_navigation_arrow_right", + states = { + default = { + material = RegisterMaterial( "widg_lobby_arrow" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0.5 + }, + over = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + button_disable = MBh.AnimateToState( "hidden" ), + button_over_disable = MBh.AnimateToState( "hidden" ), + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "lobby_navigation", lobby_navigation ) +LockTable( _M ) diff --git a/lui/mp_menus/mplobbyplayerstats.dec.lua b/lui/mp_menus/mplobbyplayerstats.dec.lua new file mode 100644 index 0000000..85b3289 --- /dev/null +++ b/lui/mp_menus/mplobbyplayerstats.dec.lua @@ -0,0 +1,828 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function ShowHistory() + local f1_local0 + if not Engine.IsAliensMode() then + f1_local0 = not SvS.IsSvS() + else + f1_local0 = false + end + return f1_local0 +end + +function LobbyPlayerStatsGetPlayerInfo( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4 ) + local f2_local0 = {} + local f2_local1 = f2_arg2 + local f2_local2 = f2_arg3 + if f2_arg0 then + assert( f2_arg4 ) + if f2_arg1 == Lobby.MemberListStates.Teams and Lobby.GetLocalPlayerTeam then + f2_local2 = Lobby.GetLocalPlayerTeam( f2_arg1, f2_arg4 ) + end + local f2_local3 = Lobby.GetMemberCount( f2_arg1, f2_local2 ) + for f2_local4 = 1, f2_local3, 1 do + if Lobby.GetMemberControllerIndex( f2_arg1, f2_local4 - 1, f2_local2 ) == f2_arg4 then + f2_local1 = f2_local4 - 1 + break + end + end + end + f2_local0.gamertag = Lobby.GetMemberName( f2_arg1, f2_local1, f2_local2 ) + if Engine.IsAliensMode() then + f2_local0.memberPrestige = Lobby.GetMemberAlienPrestigeLevel( f2_arg1, f2_local1, f2_local2 ) + f2_local0.memberRank = Lobby.GetMemberAlienRank( f2_arg1, f2_local1, f2_local2 ) + else + f2_local0.memberPrestige = Lobby.GetMemberPrestigeLevel( f2_arg1, f2_local1, f2_local2 ) + f2_local0.memberRank = Lobby.GetMemberRank( f2_arg1, f2_local1, f2_local2 ) + end + f2_local0.clantag = "" + if Lobby.HasMemberClanTag( f2_arg1, f2_local1, f2_local2 ) then + f2_local0.clantag = Lobby.GetMemberClanTag( f2_arg1, f2_local1, f2_local2 ) + end + f2_local0.patch = Lobby.GetMemberPatch and Lobby.GetMemberPatch( f2_arg1, f2_local1, f2_local2 ) or 0 + f2_local0.patchBG = Lobby.GetMemberPatchbacking and Lobby.GetMemberPatchbacking( f2_arg1, f2_local1, f2_local2 ) or 0 + f2_local0.background = Lobby.GetMemberBackground and Lobby.GetMemberBackground( f2_arg1, f2_local1, f2_local2 ) or 0 + f2_local0.memberSlot = f2_local1 + f2_local0.memberTeam = f2_local2 + return f2_local0 +end + +function LobbyPlayerHistoryGetPoints( f3_arg0, f3_arg1, f3_arg2, f3_arg3 ) + local f3_local0 = Lobby.GetMemberKDHistory( f3_arg1.memberListState, f3_arg0.memberSlot, f3_arg0.memberTeam, f3_arg1.controller ) + if f3_local0 == nil then + f3_local0 = { + 0, + 0, + 0, + 0, + 0 + } + end + local f3_local1 = 5 + for f3_local2 = 1, #f3_local0, 1 do + if f3_local1 < f3_local0[f3_local2] then + f3_local1 = f3_local0[f3_local2] + end + end + local f3_local2 = function ( f4_arg0 ) + local f4_local0 = f3_arg3 * 1 / (#f3_local0 - 1) * (f4_arg0 - 1) + local f4_local1 = nil + if 1 < f3_local0[f4_arg0] then + f4_local1 = f3_arg2 * 0.5 * (1 - f3_local0[f4_arg0] / f3_local1) + else + f4_local1 = f3_arg2 * 0.5 + f3_arg2 * 0.5 * (1 - f3_local0[f4_arg0]) + end + return { + x = f4_local0, + y = f4_local1 + } + end + + local f3_local3 = {} + for f3_local4 = 1, #f3_local0, 1 do + f3_local3[#f3_local3 + 1] = f3_local2( f3_local4 ) + end + return f3_local3 +end + +function LobbyPlayerHistoryFactory( f5_arg0, f5_arg1, f5_arg2 ) + local f5_local0 = f5_arg2.bottom - f5_arg2.top - f5_arg2.header - f5_arg2.footer + local f5_local1 = f5_arg2.width - f5_arg2.left + f5_arg2.right + local f5_local2, f5_local3, f5_local4 = Lobby.GetMemberKDHistory( f5_arg1.memberListState, f5_arg0.memberSlot, f5_arg0.memberTeam, f5_arg1.controller ) + if f5_local2 == nil or #f5_local2 <= 1 then + return + end + local f5_local5 = 1 / (#f5_local2 - 1) + local f5_local6 = LobbyPlayerHistoryGetPoints( f5_arg0, f5_arg1, f5_local0, f5_local1 ) + local f5_local7 = { + type = "UIElement", + id = "lobby_player_history_graph", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f5_local1, + top = f5_arg2.header, + bottom = -1 * f5_arg2.footer + } + }, + children = { + { + type = "UIImage", + id = "lobby_player_history_zero_line", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = f5_local0 * 0.5 - 1, + bottom = f5_local0 * 0.5 + 1, + red = 0, + green = 0, + blue = 0 + } + } + }, + { + type = "UIImage", + id = "lobby_player_history_bg", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 0.1 + } + } + } + } + } + local f5_local8 = { + type = "UIElement", + id = "lobby_player_history", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f5_arg2.left, + right = f5_arg2.right, + top = f5_arg2.top, + bottom = f5_arg2.bottom + } + }, + children = { + f5_local7, + { + type = "UIText", + id = "lobby_player_history_title", + properties = { + text = Engine.Localize( "LUA_MENU_MP_KILL_DEATH_RATIO", #f5_local2 ) + }, + states = { + default = { + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.SmallFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.SmallFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + } + } + } + for f5_local9 = 2, #f5_local2 - 1, 1 do + f5_local7.children[#f5_local7.children + 1] = { + type = "UIImage", + id = "lobby_player_history_" .. f5_local9 .. "_line", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = f5_local1 * f5_local5 * (f5_local9 - 1) - 1, + right = f5_local1 * f5_local5 * (f5_local9 - 1) + 1, + top = 0, + bottom = 0, + red = 0, + green = 0, + blue = 0 + } + } + } + end + for f5_local9 = 2, #f5_local2, 1 do + local f5_local12 = f5_local6[f5_local9].x - f5_local6[f5_local9 - 1].x + local f5_local13 = f5_local6[f5_local9].y - f5_local6[f5_local9 - 1].y + local f5_local14 = math.sqrt( f5_local12 * f5_local12 + f5_local13 * f5_local13 ) + local f5_local15 = f5_local6[f5_local9 - 1].x + f5_local12 * 0.5 + local f5_local16 = f5_local6[f5_local9 - 1].y + f5_local13 * 0.5 + f5_local7.children[#f5_local7.children + 1] = { + type = "UIImage", + id = "lobby_player_history_connect_" .. f5_local9, + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f5_local6[f5_local9 - 1].x - (f5_local14 - f5_local12) / 2, + right = f5_local6[f5_local9 - 1].x + f5_local14 - (f5_local14 - f5_local12) / 2, + top = f5_local6[f5_local9 - 1].y + f5_local13 / 2 - 1, + bottom = f5_local6[f5_local9 - 1].y + f5_local13 / 2 + 1, + zRot = -1 * math.deg( math.atan( f5_local13 / f5_local12 ) ), + red = 1, + green = 1, + blue = 1, + alpha = 0.5 + } + } + } + end + for f5_local9 = 1, #f5_local2, 1 do + local f5_local12 = { + red = 0, + green = 0, + blue = 0 + } + if f5_local2[f5_local9] >= 1 then + f5_local12.green = 0.75 + else + f5_local12.red = 0.75 + end + f5_local7.children[#f5_local7.children + 1] = { + type = "UIImage", + id = "lobby_player_history_point_" .. f5_local9, + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f5_local6[f5_local9].x - 3, + right = f5_local6[f5_local9].x + 3, + top = f5_local6[f5_local9].y - 3, + bottom = f5_local6[f5_local9].y + 3, + red = f5_local12.red, + green = f5_local12.green, + blue = f5_local12.blue, + alpha = 1 + } + } + } + end + for f5_local9 = 1, #f5_local2, 1 do + f5_local7.children[#f5_local7.children + 1] = { + type = "UIText", + id = "lobby_player_history_value_" .. f5_local9, + properties = { + text = string.format( "%.2f", f5_local2[f5_local9] ) + }, + states = { + default = { + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.SmallFont.Font, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f5_local6[f5_local9].x, + right = f5_local6[f5_local9].x, + top = f5_local0, + bottom = f5_local0 + CoD.TextSettings.SmallFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + } + end + return f5_local8 +end + +function LobbyPlayerStatsFeeder( f6_arg0 ) + local f6_local0 = {} + local f6_local1 = LobbyPlayerStatsGetPlayerInfo( f6_arg0.isComparison, f6_arg0.memberListState, f6_arg0.memberSlot, f6_arg0.team, f6_arg0.controller ) + local f6_local2 = 0 + f6_local0[#f6_local0 + 1] = { + type = "playercard", + id = "lobby_basic_playercard_id", + properties = { + gamertag = f6_local1.gamertag, + clantag = f6_local1.clantag, + rank = f6_local1.memberRank, + prestige = f6_local1.memberPrestige, + background = f6_local1.background, + patchShape = f6_local1.patchBG, + patchEmblem = f6_local1.patch + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 55, + right = -55, + top = 130, + bottom = 200 + } + } + } + if not Engine.IsAliensMode() or Engine.GetDvarBool( "extinction_cac_enabled" ) then + if ShowHistory() then + f6_local2 = 85 + CoD.TextSettings.SmallFont.Height + CoD.TextSettings.SmallFont.Height + end + local f6_local3 = {} + local f6_local4 = 25 + local f6_local5 = { + material = RegisterMaterial( "white" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = -150, + right = 0, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 0.1 + } + local f6_local6 = { + material = RegisterMaterial( "box_angle_rtcap" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = -150, + right = -182, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 0.1 + } + local f6_local7 = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 6, + right = -150, + top = 2, + bottom = 2 + CoD.TextSettings.SmallFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.SmallFont.Font + } + local f6_local8 = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -150, + right = -6, + top = 2, + bottom = 2 + CoD.TextSettings.SmallFont.Height, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.SmallFont.Font + } + if f6_arg0.isComparison then + f6_local5 = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 150, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 0.1 + } + f6_local6 = { + material = RegisterMaterial( "box_angle_ltcap" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 182, + right = 150, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 0.1 + } + f6_local7 = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 150, + right = -6, + top = 2, + bottom = 2 + CoD.TextSettings.SmallFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.SmallFont.Font + } + f6_local8 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 6, + right = 150, + top = 2, + bottom = 2 + CoD.TextSettings.SmallFont.Height, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.SmallFont.Font + } + end + local f6_local9 = nil + if SvS.IsSvS() then + f6_local9 = Lobby.SquadsPlayerStatsCategories + elseif Engine.IsAliensMode() then + f6_local9 = Lobby.AliensPlayerStatsCategories + else + f6_local9 = Lobby.PlayerStatsCategories + end + for f6_local10 = 1, #f6_local9, 1 do + if f6_local9[f6_local10].Visible == nil or f6_local9[f6_local10].Visible( f6_arg0.memberListState, f6_local1.memberSlot, f6_local1.memberTeam ) then + local f6_local13 = "---" + if Lobby.GetMemberStat then + local f6_local14 = tonumber( Lobby.GetMemberStat( f6_arg0.memberListState, f6_local1.memberSlot, f6_local1.memberTeam, Lobby.MemberStatTypes.GamesPlayed ) ) + if f6_local9[f6_local10].Getter then + f6_local13 = f6_local9[f6_local10].Getter( f6_arg0.memberListState, f6_local1.memberSlot, f6_local1.memberTeam ) + elseif f6_local9[f6_local10].Type and (not (f6_local14 == nil or f6_local14 <= 0) or SvS.IsSvS() or Engine.IsAliensMode()) then + f6_local13 = Lobby.GetMemberStat( f6_arg0.memberListState, f6_local1.memberSlot, f6_local1.memberTeam, f6_local9[f6_local10].Type ) or "" + end + end + f6_local3[#f6_local3 + 1] = { + type = "UIElement", + id = "lobby_player_stat_" .. f6_local10 .. "_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f6_local4 + } + }, + children = { + { + type = "UIImage", + id = "lobby_player_stat_bg_title", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = Colors.very_dark_cyan.r, + green = Colors.very_dark_cyan.g, + blue = Colors.very_dark_cyan.b, + alpha = 0.5 + } + } + }, + { + type = "UIImage", + id = "lobby_player_stat_bg_value", + states = { + default = f6_local5 + } + }, + { + type = "UIImage", + id = "lobby_player_stat_bg_cap", + states = { + default = f6_local6 + } + }, + { + type = "UIText", + id = "lobby_player_stat_text_title", + properties = { + text = Engine.Localize( f6_local9[f6_local10].Title ) + }, + states = { + default = f6_local7 + } + }, + { + type = "UIMarqueeText", + id = "lobby_player_stat_text_value", + properties = { + text = f6_local13 + }, + states = { + default = f6_local8 + } + } + } + } + end + end + f6_local0[#f6_local0 + 1] = { + type = "UIVerticalList", + id = "lobby_player_stats_list_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 40, + right = -40, + top = 250 + f6_local2 + 10, + bottom = 250 + f6_local2 + 20 + #Lobby.PlayerStatsCategories * (f6_local4 + 2), + spacing = 3 + } + }, + children = f6_local3 + } + if f6_arg0.isComparison then + f6_local0[#f6_local0 + 1] = { + type = "UIText", + id = "lobby_player_stat_text_value", + properties = { + text = Engine.Localize( "@LUA_MENU_VERSUS" ) + }, + states = { + default = { + alignment = LUI.Alignment.Center, + font = CoD.TextSettings.ExtraBigFont.Font, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -20, + right = 20, + top = 205, + bottom = 205 + CoD.TextSettings.ExtraBigFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + }, + shown = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + lobby_page_enter = function ( f7_arg0, f7_arg1 ) + f7_arg0:animateToState( "shown", f7_arg1.animTime or 0, true ) + end, + lobby_page_leave = function ( f8_arg0, f8_arg1 ) + f8_arg0:animateToState( "hidden", f8_arg1.animTime or 0, true ) + end + } + } + end + if ShouldShowEliteIcon( f6_arg0.memberListState, f6_local1.memberSlot, f6_local1.memberTeam ) then + local f6_local10 = 300 + #f6_local9 * (f6_local4 + 2) + f6_local4 + 2 + f6_local0[#f6_local0 + 1] = { + type = "UIHorizontalList", + id = "lobby_player_mobile_app_info_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 64, + right = -54, + top = f6_local10, + bottom = f6_local10 + f6_local4 + 2, + spacing = 8 + } + }, + children = { + { + type = "UIImage", + id = "lobby_player_mobile_app_icon_id", + states = { + default = { + material = RegisterMaterial( "widg_arrow_dn" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 7, + bottom = 19, + left = 3, + right = 29, + red = 0.33, + green = 0.71, + blue = 0.23 + } + } + }, + { + type = "UIText", + id = "lobby_player_mobile_app_text_id", + properties = { + text = Engine.Localize( "@LUA_MENU_MOBILE_APP_RUNNING" ) + }, + states = { + default = { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.SmallFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 20, + right = -14, + top = 2, + bottom = f6_local4, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + } + } + } + } + } + end + end + return f6_local0 +end + +function LobbyPlayerStatsUpdateProps( f9_arg0, f9_arg1 ) + assert( f9_arg1.memberListState ) + assert( f9_arg1.memberSlot ) + assert( f9_arg1.team ) + local f9_local0 = f9_arg0.properties + local f9_local1 = f9_arg1.memberListState + if not f9_local1 then + f9_local1 = Lobby.MemberListStates.None + end + f9_local0.memberListState = f9_local1 + f9_arg0.properties.memberSlot = f9_arg1.memberSlot or 0 + f9_arg0.properties.team = f9_arg1.team or 1 +end + +function LobbyPlayerStatsEnter( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0.properties + local f10_local1 = f10_arg0.properties + local f10_local2 = f10_arg1.controller + if not f10_local2 then + f10_local2 = Engine.GetFirstActiveController() + end + f10_local1.controller = f10_local2 + if f10_local0.isComparison then + f10_arg0:processEvent( { + name = "menu_refresh" + } ) + end + f10_local1 = LobbyPlayerStatsGetPlayerInfo( f10_local0.isComparison, f10_local0.memberListState, f10_local0.memberSlot, f10_local0.team, f10_arg0.properties.controller ) + f10_arg0:processEvent( { + name = "update_playercard", + gamertag = f10_local1.gamertag, + clantag = f10_local1.clantag, + rank = f10_local1.memberRank, + prestige = f10_local1.memberPrestige, + background = f10_local1.background, + patchShape = f10_local1.patchBG, + patchEmblem = f10_local1.patch + } ) +end + +function sendPlayerCardUpdate( f11_arg0, f11_arg1 ) + if Engine.IsAliensMode() then + local f11_local0 = LobbyPlayerStatsGetPlayerInfo( false, f11_arg1.memberListState, f11_arg1.memberSlot, f11_arg1.team, f11_arg1.controller ) + f11_arg0:processEvent( { + name = "update_playercard", + gamertag = f11_local0.gamertag, + clantag = f11_local0.clantag, + rank = f11_local0.memberRank, + prestige = f11_local0.memberPrestige, + background = f11_local0.background, + patchShape = f11_local0.patchBG, + patchEmblem = f11_local0.patch + } ) + end +end + +function LobbyPlayerStatsBuildHistory( f12_arg0, f12_arg1 ) + if ShowHistory() then + local f12_local0 = f12_arg0:getFirstDescendentById( "lobby_player_history" ) + local f12_local1 = f12_arg0.properties + if f12_local0 then + f12_local0:close() + end + local f12_local2 = LobbyPlayerHistoryFactory( LobbyPlayerStatsGetPlayerInfo( f12_local1.isComparison, f12_local1.memberListState, f12_local1.memberSlot, f12_local1.team, f12_arg0.properties.controller ), f12_local1, { + left = 40, + right = -40, + top = 250, + width = 550, + bottom = 250 + 85 + CoD.TextSettings.SmallFont.Height + CoD.TextSettings.SmallFont.Height, + footer = CoD.TextSettings.SmallFont.Height, + header = CoD.TextSettings.SmallFont.Height + } ) + if f12_local2 ~= nil then + LUI.MenuBuilder.BuildAddChild( f12_arg0, f12_local2 ) + end + end +end + +function lobby_player_stats() + return { + type = "UIElement", + id = "lobby_player_stats_id", + focusable = true, + properties = { + memberListState = Lobby.MemberListStates.Lobby, + memberSlot = 0, + team = Teams.free, + isComparison = false, + controller = Engine.GetFirstActiveController(), + should_disable_slide_right_func = function ( f14_arg0, f14_arg1 ) + local f14_local0 = f14_arg0.properties + if not f14_local0.isComparison then + if (Lobby.GetMemberControllerIndex and Lobby.GetMemberControllerIndex( f14_local0.memberListState, f14_local0.memberSlot, f14_local0.team ) or 0) == f14_arg1 then + return true + elseif not Engine.IsConsoleGame() and Lobby.IsMemberALocalPlayer( f14_local0.memberListState, f14_local0.memberSlot, f14_local0.team ) then + return true + end + end + return false + end + + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + lobby_detail_update = function ( f15_arg0, f15_arg1 ) + LobbyPlayerStatsUpdateProps( f15_arg0, f15_arg1 ) + sendPlayerCardUpdate( f15_arg0, f15_arg1 ) + f15_arg0:processEvent( { + name = "menu_refresh" + } ) + LobbyPlayerStatsBuildHistory( f15_arg0, f15_arg1 ) + end + , + lobby_page_enter = function ( f16_arg0, f16_arg1 ) + LobbyPlayerStatsEnter( f16_arg0, f16_arg1 ) + LobbyPlayerStatsBuildHistory( f16_arg0, f16_arg1 ) + end + + }, + childrenFeeder = LobbyPlayerStatsFeeder + } +end + +LUI.MenuBuilder.registerDef( "lobby_player_stats", lobby_player_stats ) +LockTable( _M ) diff --git a/lui/mp_menus/mplobbysearchwidget.dec.lua b/lui/mp_menus/mplobbysearchwidget.dec.lua new file mode 100644 index 0000000..3617f27 --- /dev/null +++ b/lui/mp_menus/mplobbysearchwidget.dec.lua @@ -0,0 +1,644 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +SearchWidgetStatus = { + INACTIVE = 0, + FOUND_NO_GAMES = 1, + SEARCHING = 2, + FOUND_GAMES = 3, + WAITING_FOR_PLAYERS = 4, + WAITING_FOR_HOST = 5, + JOINING = 6, + STARTING = 7 +} +function lobby_search_widget() + local f1_local0 = function ( f2_arg0, f2_arg1, f2_arg2 ) + if f2_arg0.currentState ~= f2_arg1 then + f2_arg0:animateToState( f2_arg1, f2_arg2 or 200 ) + f2_arg0.currentState = f2_arg1 + end + end + + local f1_local1 = 320 + local self = LUI.UIElement.new() + self.id = "search_widget" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 0, + top = f1_local1, + width = 512, + height = 256, + alpha = 1 + } ) + self:registerAnimationState( "disabled", { + alpha = 0 + } ) + self:animateToState( "default" ) + local f1_local3 = LUI.UITimer.new( 50, "main_update" ) + f1_local3.id = "mainTimer" + self:addElement( f1_local3 ) + self:registerEventHandler( "main_update", function ( element, event ) + if SvS.IsSvS() then + local f3_local0 = SvS.GetCurrentSquadModeInfo() + if f3_local0 == SvS.SquadModes.SquadAssault then + if Squad.FoundMatch() then + element:animateToState( "disabled" ) + event.timer:close() + end + elseif f3_local0 == SvS.SquadModes.SquadVsSquad then + local f3_local1 = Lobby.GetSearchWidgetStatus() >= SearchWidgetStatus.WAITING_FOR_PLAYERS + if f3_local1 and not element.disableForSquadVsSquad then + element:animateToState( "disabled" ) + element.disableForSquadVsSquad = true + elseif not f3_local1 and element.disableForSquadVsSquad then + element:animateToState( "default" ) + element.disableForSquadVsSquad = false + end + end + end + if Lobby.GetSearchWidgetStatus then + local f3_local0 = element.status or -1 + local f3_local1 = Lobby.GetSearchWidgetStatus() + if f3_local1 ~= element.status then + element.status = f3_local1 + DebugPrint( "Search widget status is now " .. f3_local1 ) + element:processEvent( { + name = "update_search_status", + oldStatus = f3_local0, + status = element.status, + dispatchChildren = true + } ) + end + end + end ) + local f1_local4 = LUI.UIImage.new() + f1_local4.id = "bg" + f1_local4:registerAnimationState( "default", { + material = RegisterMaterial( "widg_grid_fade" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.1 + } ) + f1_local4:animateToState( "default" ) + self:addElement( f1_local4 ) + local f1_local5 = { + { + 268, + 85 + }, + { + 352, + 72 + }, + { + 170, + 136 + }, + { + 384, + 28 + }, + { + 408, + 139 + }, + { + 234, + 173 + }, + { + 157, + 4 + }, + { + 92, + 145 + }, + { + 412, + 227 + }, + { + 285, + 114 + }, + { + 98, + 40 + }, + { + 112, + 77 + }, + { + 330, + 168 + }, + { + 421, + 8 + }, + { + 105, + 189 + }, + { + 381, + 106 + }, + { + 305, + 12 + }, + { + 136, + 89 + }, + { + 224, + 33 + } + } + local f1_local6 = LUI.UIElement.new() + f1_local6.id = "techyDigits" + f1_local6:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + } ) + f1_local6:registerAnimationState( "hidden", { + alpha = 0 + } ) + f1_local6:animateToState( "default" ) + f1_local6:registerEventHandler( "update_search_status", function ( element, event ) + assert( event.status ) + if event.status >= SearchWidgetStatus.FOUND_GAMES then + f1_local0( f1_local6, "hidden" ) + else + f1_local0( f1_local6, "default" ) + end + end ) + self:addElement( f1_local6 ) + local f1_local7 = LUI.UITimer.new( 450, "update_digits_bg" ) + f1_local7.id = "digitsTimer" + f1_local6:addElement( f1_local7 ) + f1_local6.animIndex = 0 + f1_local6:registerEventHandler( "update_digits_bg", function ( element, event ) + local f5_local0 = element:getFirstChild() + while f5_local0 do + if f5_local0.index == element.animIndex then + local f5_local1 = MBh.AnimateSequence( { + { + "visible", + 800, + true, + true + }, + { + "visible", + 2400, + false, + false + }, + { + "default", + 1200, + true, + true + } + } ) + f5_local1( f5_local0, {} ) + end + f5_local0 = f5_local0:getNextSibling() + end + element.animIndex = (element.animIndex + 1) % #f1_local5 + end ) + for f1_local11, f1_local12 in ipairs( f1_local5 ) do + local f1_local13 = LUI.UITechyDigits.new() + f1_local13.id = "digits_" .. f1_local11 + f1_local13.index = f1_local11 + f1_local13:registerAnimationState( "default", { + font = CoD.TextSettings.TinyFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = f1_local12[1], + top = f1_local12[2], + width = 0, + height = CoD.TextSettings.TinyFont.Height, + alpha = 0 + } ) + f1_local13:registerAnimationState( "visible", { + alpha = 0.3 + } ) + f1_local13:animateToState( "default", 0 ) + local f1_local14 = MBh.AnimateLoop( { + { + "default", + (f1_local11 - 1) * 600, + false, + false + }, + { + "visible", + 800, + true, + true + }, + { + "visible", + 2400, + false, + false + }, + { + "default", + 1200, + true, + true + }, + { + "default", + (#f1_local5 - f1_local11) * 400, + false, + false + } + } ) + f1_local14( f1_local13, {} ) + f1_local6:addElement( f1_local13 ) + f1_local14 = LUI.UIImage.new() + f1_local14.id = "blip" + f1_local14:registerAnimationState( "default", { + material = RegisterMaterial( "icon_lobby_map_blip2" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 15, + height = 8, + left = -4, + width = 8, + alpha = 0.6 + } ) + f1_local14:animateToState( "default" ) + f1_local13:addElement( f1_local14 ) + end + f1_local8 = LUI.UITechyDigits.new() + f1_local8.id = "middleDigits" + f1_local8:registerAnimationState( "default", { + font = CoD.TextSettings.TinyFont.Font, + alignment = LUI.Alignment.Center, + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -50, + top = -8, + width = 100, + height = CoD.TextSettings.TinyFont.Height, + alpha = 0 + } ) + f1_local8:registerAnimationState( "visible", { + alpha = 0.5 + } ) + f1_local8:animateToState( "default", 0 ) + f1_local8:registerEventHandler( "update_search_status", function ( element, event ) + assert( event.status ) + if event.status >= SearchWidgetStatus.FOUND_GAMES and event.status < SearchWidgetStatus.JOINING then + f1_local0( f1_local8, "visible", 400 ) + else + f1_local0( f1_local8, "default", 100 ) + end + end ) + self:addElement( f1_local8 ) + f1_local9 = 48 + f1_local10 = 8 + f1_local11 = LUI.UIElement.new() + f1_local11.id = "spinner" + f1_local11:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -f1_local9, + bottom = f1_local9, + left = -f1_local9, + right = f1_local9 + } ) + f1_local11:registerEventHandler( "update_search_status", function ( element, event ) + local f7_local0 + if event.status < SearchWidgetStatus.FOUND_GAMES or event.status >= SearchWidgetStatus.JOINING then + f7_local0 = false + else + f7_local0 = true + end + element.spinningRequested = f7_local0 + end ) + f1_local11:animateToState( "default" ) + self:addElement( f1_local11 ) + f1_local12 = LUI.UITimer.new( 80, "update_spinner" ) + f1_local12.id = "spinnerTimer" + f1_local11:addElement( f1_local12 ) + f1_local11.spinningPossible = false + f1_local11.spinningRequested = false + f1_local11.spinIndex = 0 + f1_local11:registerEventHandler( "update_spinner", function ( element, event ) + if element.spinningPossible and element.spinningRequested then + local f8_local0 = element:getFirstChild() + while f8_local0 do + if f8_local0.index and f8_local0.index == element.spinIndex then + local f8_local1 = MBh.AnimateSequence( { + { + "positioned", + 80 + }, + { + "faded", + 140 + } + } ) + f8_local1( f8_local0, {} ) + end + f8_local0 = f8_local0:getNextSibling() + end + element.spinIndex = (f1_local10 + element.spinIndex - 1) % f1_local10 + end + end ) + for f1_local13 = 0, f1_local10 - 1, 1 do + local f1_local16 = LUI.UIImage.new() + f1_local16.id = "dot_" .. f1_local13 + f1_local16.index = f1_local13 + f1_local16:registerAnimationState( "default", { + material = RegisterMaterial( "icon_lobby_map_blip2" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -4, + bottom = 4, + left = -4, + right = 4, + alpha = 0 + } ) + local f1_local17 = -(f1_local13 / 8) * 2 * math.pi + local f1_local18 = f1_local9 * math.cos( f1_local17 ) + local f1_local19 = f1_local9 * math.sin( f1_local17 ) + f1_local16:registerAnimationState( "positioned", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f1_local19 - 4, + bottom = f1_local19 + 4, + left = f1_local18 - 4, + right = f1_local18 + 4, + alpha = 1 + } ) + f1_local16:registerAnimationState( "faded", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f1_local19 - 4, + bottom = f1_local19 + 4, + left = f1_local18 - 4, + right = f1_local18 + 4, + alpha = 0.3 + } ) + f1_local16:registerAnimationState( "final_blink", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f1_local19 - 4, + bottom = f1_local19 + 4, + left = f1_local18 - 4, + right = f1_local18 + 4, + alpha = 0.3 + } ) + f1_local16:registerAnimationState( "vanished", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f1_local19 - 4 + 2 * f1_local18, + bottom = f1_local19 + 4 + 2 * f1_local18, + left = f1_local18 - 4 - 2 * f1_local19, + right = f1_local18 + 4 - 2 * f1_local19, + alpha = 0 + } ) + f1_local16:animateToState( "default" ) + f1_local16:addEventHandler( LUI.FormatAnimStateFinishEvent( "final_blink" ), function ( f9_arg0, f9_arg1 ) + f1_local11.spinningPossible = true + end ) + f1_local16:registerEventHandler( "update_search_status", function ( element, event ) + if event.oldStatus < SearchWidgetStatus.FOUND_GAMES and event.status >= SearchWidgetStatus.FOUND_GAMES and event.status < SearchWidgetStatus.JOINING then + f1_local11.spinningPossible = false + local f10_local0 = MBh.AnimateSequence( { + { + "default", + 20 + }, + { + "positioned", + 250 + }, + { + "faded", + 250 + }, + { + "positioned", + 120 + }, + { + "faded", + 250 + }, + { + "positioned", + 120 + }, + { + "faded", + 250 + }, + { + "positioned", + 120 + }, + { + "final_blink", + 250 + } + } ) + f10_local0( f1_local16, {} ) + elseif event.status < SearchWidgetStatus.FOUND_GAMES then + f1_local11.spinningPossible = false + f1_local16:animateToState( "default", 140 ) + elseif event.status == SearchWidgetStatus.JOINING then + f1_local16:animateToState( "faded", 100 ) + elseif event.status == SearchWidgetStatus.STARTING then + f1_local16:animateToState( "vanished", 300 ) + end + end ) + f1_local11:addElement( f1_local16 ) + end + local f1_local13 = 3 + local f1_local14 = LUI.UIElement.new() + f1_local14.id = "gameFound" + f1_local14:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f1_local14:animateToState( "default" ) + self:addElement( f1_local14 ) + f1_local14:registerEventHandler( "update_search_status", function ( element, event ) + element.pulseRequested = event.status >= SearchWidgetStatus.JOINING + end ) + local f1_local15 = LUI.UITimer.new( 400, "update_game_found" ) + f1_local15.id = "gameFoundTimer" + f1_local14:addElement( f1_local15 ) + f1_local14.pulseRequested = false + f1_local14.pulsePossible = false + f1_local14.pulseIndex = 0 + f1_local14:registerEventHandler( "update_game_found", function ( element, event ) + if element.pulsePossible and element.pulseRequested then + local f12_local0 = element:getFirstChild() + while f12_local0 do + if f12_local0.index and f12_local0.index == element.pulseIndex then + local f12_local1 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "expanded", + 1000, + true, + true + } + } ) + f12_local1( f12_local0, {} ) + end + f12_local0 = f12_local0:getNextSibling() + end + element.pulseIndex = (element.pulseIndex + 1) % f1_local13 + end + end ) + local f1_local20 = LUI.UIImage.new() + f1_local20.id = "foundBlip" + local f1_local16 = -(3 / f1_local10) * 2 * math.pi + f1_local20:registerAnimationState( "default", { + material = RegisterMaterial( "icon_lobby_map_blip3" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f1_local9 * math.sin( f1_local16 ) - 4, + height = 8, + left = f1_local9 * math.cos( f1_local16 ) - 4, + width = 8, + alpha = 0 + } ) + f1_local20:registerAnimationState( "visible", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -4, + height = 8, + left = -4, + width = 8, + alpha = 1 + } ) + f1_local20:registerAnimationState( "invisible", { + alpha = 0 + } ) + f1_local20:animateToState( "default" ) + f1_local14:addElement( f1_local20 ) + f1_local20:addEventHandler( LUI.FormatAnimStateFinishEvent( "visible" ), function ( f13_arg0, f13_arg1 ) + f1_local14.pulsePossible = true + end ) + f1_local20:registerEventHandler( "update_search_status", function ( element, event ) + if event.oldStatus < SearchWidgetStatus.JOINING and event.status >= SearchWidgetStatus.JOINING then + f1_local14.pulsePossible = false + local f14_local0 = MBh.AnimateSequence( { + { + "invisible", + 20 + }, + { + "default", + 0 + }, + { + "visible", + 250 + } + } ) + f14_local0( element, {} ) + elseif event.status < SearchWidgetStatus.JOINING then + f1_local14.pulsePossible = false + element:animateToState( "invisible", 140 ) + end + end ) + for f1_local19 = 0, f1_local13 - 1, 1 do + local f1_local23 = LUI.UIImage.new() + f1_local23.id = "pulse_" .. f1_local19 + f1_local23.index = f1_local19 + f1_local23:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + material = RegisterMaterial( "widg_circle" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5 + } ) ) + f1_local23:registerAnimationState( "expanded", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -32, + bottom = 32, + left = -32, + right = 32, + alpha = 0 + } ) + f1_local23:animateToState( "default" ) + f1_local14:addElement( f1_local23 ) + end + return self +end + +LUI.MenuBuilder.registerType( "lobby_search_widget", lobby_search_widget ) +LockTable( _M ) diff --git a/lui/mp_menus/mplobbyutils.dec.lua b/lui/mp_menus/mplobbyutils.dec.lua new file mode 100644 index 0000000..fbb2743 --- /dev/null +++ b/lui/mp_menus/mplobbyutils.dec.lua @@ -0,0 +1,1408 @@ +Lobby = Lobby or {} +if Engine.InFrontend() then + Lobby.MemberListStates = { + None = 0, + Prelobby = 1, + Lobby = 2, + Teams = 3 + } + Lobby.MaxMemberListSlots = 18 + Lobby.MemberListRefreshTime = 1000 + Lobby.TransitionTime = 750 + Lobby.MemberListMemberHeight = 26 + Lobby.MemberListSquadMemberHeight = 25 + Lobby.PasswordLength = 24 + Lobby.Teams = { + Free = 0, + Bad = 0, + Axis = 1, + Allies = 2 + } + Lobby.BotTeams = { + Friendly = 0, + Enemy = 1, + FFA = 2 + } + Lobby.CurrGenBotLimit = 12 + Lobby.NextGenBotLimit = 18 + Lobby.BotDifficulties = { + Recruit = 0, + Regular = 1, + Hardened = 2, + Veteran = 3, + Mixed = 4 + } + Lobby.CustomizationTypes = { + Head = 0, + Body = 1, + ViewHands = 2 + } + local f0_local0 = Lobby + local f0_local1 = { + Min = 0, + Max = 2 + } + local f0_local2 = { + [0] = "PATCH_MENU_OPEN" + } + local f0_local3 = "PATCH_MENU_FRIENDS_ONLY" + local f0_local4 = "PATCH_MENU_CLOSED" + f0_local2[1] = f0_local3 + f0_local2[2] = f0_local4 + f0_local1.Texts = f0_local2 + f0_local0.PrivacySettings = f0_local1 + Lobby.MemberStatTypes = { + Score = 0, + Divider = 1, + Deaths = 2, + BestWeapon = 3, + Wins = 4, + KDRatio = 5, + CurrentWinStreak = 6, + GamesPlayed = 7, + WinLossRatio = 8, + TimePlayed = 9, + Revives = 10, + Escapes = 11, + NerfEscapes = 12, + AliensKilled = 13 + } + MapVoting = { + MapA = { + refNum = 0, + voteIndex = 1 + }, + MapB = { + refNum = 1, + voteIndex = 2 + } + } + Lobby.UnlockTypes = { + PERK = "perk", + FEATURE = "feature", + PROFILE_FEATURE = "profileFeature", + TITLE = "title", + ICON = "icon", + KILLSTREAK = "killstreak", + CHALLENGE = "challenge", + PRESTIGE = "prestige", + WEAPON = "weapon", + WEAPON_ATTACHMENT = "weaponAttachment", + WEAPON_CAMO = "weaponCamo", + WEAPON_BUFF = "weaponBuff", + WEAPON_RETICLE = "weaponReticle" + } + Lobby.Swatch = { + axis = Colors.orange, + allies = Colors.cyan, + party_member = Colors.seafoam_blue + } + f0_local0 = { + Title = "@LUA_MENU_DOUBLE_XP_REMAINING", + Visible = function ( f1_arg0, f1_arg1, f1_arg2 ) + if CoD.GetStatsGroupForGameMode() ~= CoD.StatsGroup.Ranked then + return false + elseif not Lobby.IsMemberALocalPlayer( f1_arg0, f1_arg1, f1_arg2 ) then + return false + else + local f1_local0 = Lobby.GetMemberControllerIndex( f1_arg0, f1_arg1, f1_arg2 ) + local f1_local1 = Engine.GetPlayerDataEx( f1_local0, CoD.GetStatsGroupForGameMode(), "xpMaxMultiplierTimePlayed", 0 ) + local f1_local2 = Engine.GetPlayerDataEx( f1_local0, CoD.GetStatsGroupForGameMode(), "xpMultiplierTimePlayed", 0 ) + if not f1_local2 or not f1_local1 then + return false + else + return f1_local2 < f1_local1 + end + end + end, + Getter = function ( f2_arg0, f2_arg1, f2_arg2 ) + if CoD.GetStatsGroupForGameMode() ~= CoD.StatsGroup.Ranked then + return "" + elseif not Lobby.IsMemberALocalPlayer( f2_arg0, f2_arg1, f2_arg2 ) then + return "" + else + local f2_local0 = Lobby.GetMemberControllerIndex( f2_arg0, f2_arg1, f2_arg2 ) + local f2_local1 = Engine.GetPlayerDataEx( f2_local0, CoD.GetStatsGroupForGameMode(), "xpMaxMultiplierTimePlayed", 0 ) + local f2_local2 = Engine.GetPlayerDataEx( f2_local0, CoD.GetStatsGroupForGameMode(), "xpMultiplierTimePlayed", 0 ) + if not f2_local2 or not f2_local1 then + return 0 + else + return Engine.FormatTimeHoursMinutesSeconds( f2_local1 - f2_local2 ) + end + end + end + } + Lobby.PlayerStatsCategories = { + { + Title = "@LUA_MENU_KD_RATIO", + Type = Lobby.MemberStatTypes.KDRatio + }, + { + Title = "@LUA_MENU_PREFERRED_WEAPON", + Type = Lobby.MemberStatTypes.BestWeapon + }, + { + Title = "@LUA_MENU_CURRENT_STREAK", + Type = Lobby.MemberStatTypes.CurrentWinStreak + }, + { + Title = "@LUA_MENU_WINS", + Type = Lobby.MemberStatTypes.Wins + }, + { + Title = "@LUA_MENU_GAMES_PLAYED", + Type = Lobby.MemberStatTypes.GamesPlayed + }, + { + Title = "@LUA_MENU_WL_RATIO", + Type = Lobby.MemberStatTypes.WinLossRatio + }, + { + Title = "@LUA_MENU_TIME_PLAYED", + Type = Lobby.MemberStatTypes.TimePlayed + }, + f0_local0 + } + Lobby.SquadsPlayerStatsCategories = { + { + Title = "@LUA_MENU_WINS", + Type = Lobby.MemberStatTypes.Wins + }, + { + Title = "@LUA_MENU_CURRENT_STREAK", + Type = Lobby.MemberStatTypes.CurrentWinStreak + }, + { + Title = "@LUA_MENU_WL_RATIO", + Type = Lobby.MemberStatTypes.WinLossRatio + }, + f0_local0 + } + Lobby.AliensPlayerStatsCategories = { + { + Title = "@LUA_MENU_ESCAPES", + Type = Lobby.MemberStatTypes.Escapes + }, + { + Title = "@LUA_MENU_NERFESCAPES", + Type = Lobby.MemberStatTypes.NerfEscapes + }, + { + Title = "@LUA_MENU_REVIVES", + Type = Lobby.MemberStatTypes.Revives + }, + { + Title = "@LUA_MENU_ALIENS_KILLED", + Type = Lobby.MemberStatTypes.AliensKilled + }, + f0_local0 + } + function OpenCoDAnywhere( f3_arg0 ) + if Engine.GetDvarInt( "ca_intra_only" ) == 1 then + if CoDAnywhere.ShouldShowLinkCreatePopup( f3_arg0, true ) == true then + LUI.FlowManager.RequestPopupMenu( nil, "cod_anywhere_popup_menu", true, f3_arg0 ) + else + LUI.FlowManager.RequestPopupMenu( nil, "cod_anywhere_all_done_popup_menu", true, f3_arg0 ) + end + elseif CoDAnywhere.ShouldShowLinkCreatePopup( f3_arg0, true ) == true then + LUI.FlowManager.RequestPopupMenu( nil, "cod_anywhere_popup_menu", true, f3_arg0 ) + elseif CoDAnywhere.ShouldShowLinkUCDPopup( f3_arg0, true ) == true then + LUI.FlowManager.RequestPopupMenu( nil, "cod_anywhere_link_ucd_popup_menu", true, f3_arg0 ) + else + CoDAnywhere.DownloadNonUCDPlatforms( f3_arg0 ) + end + end + + function clearMatchData() + Engine.ClearMatchData() + Engine.ClearUnlockData() + end + + function isNavMenuOnTop() + local f5_local0 = false + if LUI.FlowManager.IsTopMenuModal() then + return false + end + local f5_local1 = Engine.GetLuiRoot() + local f5_local2 = "" + if f5_local1 then + local f5_local3 = LUI.FlowManager.GetTopMenuInfo( f5_local1.flowManager.menuInfoStack ) + if f5_local3 and f5_local3.name then + f5_local2 = f5_local3.name + end + end + local f5_local3 + if f5_local2 ~= "menu_xboxlive" and f5_local2 ~= "menu_xboxlive_privatelobby" and f5_local2 ~= "menu_xboxlive_lobby" then + f5_local3 = false + else + f5_local3 = true + end + return f5_local3 + end + + function RefreshLargeMapImage( f6_arg0, f6_arg1 ) + local f6_local0 = Engine.GetLuiRoot() + local f6_local1 = LUI.FlowManager.IsInStack( f6_local0.flowManager, "menu_xboxlive_privatelobby" ) + local f6_local2 = LUI.FlowManager.IsInStack( f6_local0.flowManager, "menu_xboxlive_lobby" ) + local f6_local3 = LUI.FlowManager.IsInStack( f6_local0.flowManager, "menu_gamesetup_systemlink" ) or f6_local1 or f6_local2 or LUI.FlowManager.IsInStack( f6_local0.flowManager, "menu_gamesetup_splitscreen" ) + local f6_local4 = Engine.IsAliensMode() + if f6_local3 then + local f6_local5 = f6_arg0.properties.map + local f6_local6 + if f6_local4 then + f6_local6 = GetLobbyBlurImage() + if not f6_local6 then + + elseif f6_local2 then + if IsVotingFinished() and f6_local6 ~= "" then + if f6_local6 ~= f6_local5 then + f6_arg0.properties.map = f6_local6 + f6_arg0:registerAnimationState( "default", { + material = RegisterMaterial( f6_local6 ), + alpha = 1 + } ) + f6_arg0:animateToState( "default", 1500 ) + if f6_local4 then + LUI.mp_menus.Aliens.SwapExtinctionMapMusic( LUI.mp_menus.Aliens.GetExtinctionMapMusic() ) + end + end + elseif f6_arg0.properties.map ~= "hidden" then + f6_arg0.properties.map = "hidden" + f6_arg0:animateToState( "hidden", 750 ) + if f6_local4 then + LUI.mp_menus.Aliens.SwapExtinctionMapMusic( CoD.Music.MainExtinctMusic ) + end + end + elseif f6_local6 ~= f6_local5 then + f6_arg0.properties.map = f6_local6 + f6_arg0:registerAnimationState( "default", { + material = RegisterMaterial( f6_local6 ), + alpha = 1 + } ) + f6_arg0:animateToState( "default", 1500 ) + if f6_local4 then + LUI.mp_menus.Aliens.SwapExtinctionMapMusic( LUI.mp_menus.Aliens.GetExtinctionMapMusic() ) + end + end + end + f6_local6 = GetLobbyTransitionMapImage() + elseif f6_arg0.properties.map ~= "hidden" then + f6_arg0.properties.map = "hidden" + f6_arg0:animateToState( "hidden", 750 ) + if f6_local4 then + LUI.mp_menus.Aliens.SwapExtinctionMapMusic( CoD.Music.MainExtinctMusic ) + end + end + end + + function ShowAliensCleanLobbyBkg( f7_arg0, f7_arg1 ) + if Engine.IsAliensMode() then + f7_arg0:setImage( RegisterMaterial( GetLobbyTransitionMapImage() ) ) + f7_arg0:animateToState( "visible", Lobby.TransitionTime * 0.7 ) + end + end + + function InitLargeMapImage( f8_arg0, f8_arg1 ) + f8_arg0:animateToState( "hidden", 0 ) + f8_arg0.properties.map = "hidden" + end + + function GetLobbyTransitionMapImage() + local f9_local0 = Lobby.GetMapImage() + local f9_local1 + if f9_local0 and f9_local0 ~= "" then + f9_local1 = f9_local0 .. "_lobby" + if not f9_local1 then + + else + return f9_local1 + end + end + f9_local1 = "" + end + + function GetLobbyBlurImage() + return Lobby.GetMapImage() .. "_blur" + end + + function HandleStartTransitionToGame( f11_arg0, f11_arg1 ) + f11_arg0:processEvent( { + name = "lose_focus" + } ) + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), true, "MenuTransition" ) + f11_arg0:dispatchEventToRoot( { + name = "lobby_transition_to_game", + dispatchChildren = true, + immediate = true + } ) + end + + function IsGameHost() + return Lobby.IsGameHost() + end + + function IsNotGameHost() + return not IsGameHost() + end + + function AreWePrivatePartyHost() + return Lobby.IsInPrivateParty() and Lobby.IsPrivatePartyHost() + end + + function IsOurPrivatePartyHostInLobby() + local f15_local0 = Lobby.IsInPrivateParty() + local f15_local1 = Lobby.IsPrivatePartyHost() + local f15_local2 = Lobby.IsPrivatePartyHostInLobby() + local f15_local3 = f15_local0 + local f15_local4 + if not f15_local1 then + f15_local4 = f15_local2 + else + f15_local4 = false + end + return f15_local4 + end + + function IsPublicMatch() + if Engine.GetDvarBool( "onlinegame" ) == true and Engine.GetDvarBool( "xblive_privatematch" ) == false then + return true + else + return false + end + end + + function IsOfflineMatch() + return Engine.GetDvarBool( "onlinegame" ) == false + end + + function IsVotingFinished() + local f18_local0 = Lobby.HasVotePassed() + local f18_local1 = Engine.GetDvarBool( "party_teamsVisible" ) + if f18_local1 then + f18_local1 = Engine.GetDvarBool( "party_teamBased" ) + end + local f18_local2 + if Lobby.GetVoteMapName( MapVoting.MapA.refNum ) ~= Lobby.GetVoteMapName( MapVoting.MapB.refNum ) or Lobby.GetVoteMapGametype( MapVoting.MapA.refNum ) ~= Lobby.GetVoteMapGametype( MapVoting.MapB.refNum ) then + f18_local2 = false + else + f18_local2 = true + end + return f18_local1 or f18_local0 or f18_local2 + end + + function IsOnlineAliens() + return Engine.GetDvarBool( "onlinegame" ) and Engine.IsAliensMode() + end + + function ExitLobby( f20_arg0, f20_arg1 ) + f20_arg0:dispatchEventToRoot( { + name = "exit_private_lobby", + dispatchChildren = true + } ) + f20_arg0:dispatchEventToRoot( { + name = "exit_public_lobby" + } ) + end + + function TryForceOpenAfterActionReport( f21_arg0, f21_arg1 ) + local f21_local0 = false + local f21_local1 = Engine.GetDvarBool( "ui_opensummary" ) + local f21_local2 = Engine.IsAliensMode() + if f21_local1 then + local f21_local3 = Engine.GetFirstActiveController() + local f21_local4 = GetAARUnlockCount( f21_local3 ) > 0 + if f21_arg1.controller then + f21_local3 = f21_arg1.controller + end + if IsPublicMatch() and not f21_local2 then + if f21_local4 then + OpenAfterActionReport( f21_arg0, { + name = "open_after_action_report", + controller = f21_local3 + } ) + else + ExpandMiniAAR( f21_arg0, f21_arg1, f21_local3 ) + end + else + local f21_local5 = LUI.mp_menus.Aliens.ExtinctionLobbyGetOutroVideo( f21_local3 ) + if f21_local5 and f21_local5 ~= "" and not LUI.mp_menus.Aliens.HasSeenVideo( f21_local3, f21_local5 ) then + LUI.mp_menus.Aliens.SetHasSeenVideo( f21_local3, f21_local5 ) + LUI.mp_menus.Aliens.AliensPlayVideo( f21_local3, f21_local5, { + name = "open_after_action_report", + controller = f21_local3, + notExclusive = true, + immediate = true, + target = f21_arg0 + } ) + else + f21_arg0:dispatchEventToRoot( { + name = "open_after_action_report", + controller = f21_local3, + notExclusive = true, + immediate = true + } ) + end + f21_local0 = true + end + Engine.SetDvarBool( "ui_opensummary", false ) + end + return f21_local0 + end + + function ExpandMiniAAR( f22_arg0, f22_arg1, f22_arg2 ) + if Engine.IsAliensMode() then + return + else + f22_arg0:dispatchEventToRoot( { + name = "expand_mini_aar", + controller = f22_arg2, + num_unlocks = #getUnlocksData( f22_arg2 ), + dispatchChildren = true + } ) + end + end + + function OpenAfterActionReport( f23_arg0, f23_arg1 ) + local f23_local0 = true + if f23_arg1.notExclusive then + f23_local0 = false + end + LUI.FlowManager.RequestPopupMenu( f23_arg0, "aar_summary_main", f23_local0, f23_arg1.controller, false, { + controller = f23_arg1.controller + }, nil, false, true ) + end + + function getUnlocksData( f24_arg0 ) + local f24_local0 = {} + local f24_local1 = Lobby.GetItemsUnlockedLastGame( f24_arg0 ) + if f24_local1 then + for f24_local2 = 1, #f24_local1, 1 do + local f24_local5 = Engine.TableLookupByRow( UnlockTable.File, f24_local1[f24_local2], UnlockTable.Cols.ItemId ) + local f24_local6 = Engine.TableLookupByRow( UnlockTable.File, f24_local1[f24_local2], UnlockTable.Cols.Type ) + local f24_local7, f24_local8 = getUnlockReqsForRow( f24_local1[f24_local2] ) + local f24_local9 = f24_local7.rank + local f24_local10 = f24_local7.prestige + local f24_local11 = f24_local7.rankExt + local f24_local12 = f24_local7.chalAndTier + local f24_local13 = f24_local7.dlc + local f24_local14 = "" + if f24_local12 ~= "" then + local f24_local15, f24_local16 = parseChallengeName( f24_local12 ) + local f24_local17 = operationGetTargetForTier( f24_local15, f24_local16 ) + local f24_local18 = 528 + if f24_local15 == "ch_longersprint_pro" then + f24_local17 = math.floor( f24_local17 / f24_local18 ) + end + f24_local14 = operationGetDesc( f24_local15, f24_local17 ) + elseif f24_local10 ~= "" then + f24_local14 = Engine.Localize( "@LUA_MENU_UNLOCK_PRESTIGE", f24_local10 ) + end + if f24_local13 == "" then + if Engine.IsAliensMode() and f24_local8 then + if IsOnlineMatch() or f24_local6 == "AlienAbility" or f24_local6 == "AlienPerk" or f24_local6 == "AlienPrestige" then + table.insert( f24_local0, { + item = f24_local5, + type = f24_local6, + ch_desc = f24_local14, + rankReq = f24_local9, + rankReqExt = f24_local11 + } ) + end + end + if not Engine.IsAliensMode() and not f24_local8 then + if f24_local10 ~= "" then + table.insert( f24_local0, 1, { + item = f24_local5, + type = f24_local6, + ch_desc = f24_local14, + rankReq = f24_local9, + rankReqExt = f24_local11 + } ) + else + table.insert( f24_local0, { + item = f24_local5, + type = f24_local6, + ch_desc = f24_local14, + rankReq = f24_local9, + rankReqExt = f24_local11 + } ) + end + end + end + end + end + if not Engine.IsAliensMode() then + local f24_local2, f24_local3, f24_local4 = getRankIncreaseForRoundSquadMember( f24_arg0 ) + if f24_local2 < f24_local3 then + local f24_local19 = getPerksUnlockedAtRankRange( f24_local2 + 1, f24_local3 ) + for f24_local5 = 1, #f24_local19, 1 do + local f24_local9 = f24_local19[f24_local5].purchaseReq + local f24_local10 = false + if f24_local9 and f24_local9 ~= "" and tonumber( Engine.GetPlayerDataEx( f24_arg0, CoD.StatsGroup.Ranked, "squadMembers", f24_local4, "challengeState", f24_local9 ) ) > 1 then + f24_local10 = true + end + if not f24_local10 then + table.insert( f24_local0, f24_local19[f24_local5] ) + end + end + end + local f24_local19 = determineCamosUnlocked( f24_arg0 ) + for f24_local5 = 1, #f24_local19, 1 do + table.insert( f24_local0, f24_local19[f24_local5] ) + end + local f24_local5 = determineReticlesUnlocked( f24_arg0 ) + for f24_local6 = 1, #f24_local5, 1 do + table.insert( f24_local0, f24_local5[f24_local6] ) + end + end + return f24_local0 + end + + function getUnlockReqsForItemOfType( f25_arg0, f25_arg1 ) + local f25_local0 = {} + local f25_local1, f25_local2 = nil + local f25_local3 = 0 + repeat + f25_local1 = Engine.TableLookupByRow( UnlockTable.File, f25_local3, UnlockTable.Cols.ItemId ) + if f25_arg0 == f25_local1 and f25_arg1 == Engine.TableLookupByRow( UnlockTable.File, f25_local3, UnlockTable.Cols.Type ) then + f25_local0 = getUnlockReqsForRow( f25_local3 ) + break + else + f25_local3 = f25_local3 + 1 + end + until f25_local1 == "" + return f25_local0 + end + + function getUnlockReqsForRow( f26_arg0 ) + local f26_local0 = { + entitlement = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.Entitlement ), + rank = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.Rank ), + rankExt = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.ExtRank ), + chalAndTier = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.Challenge ), + prestigeExt = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.ExtinctionPrestige ), + escapesExt = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.ExtinctionEscapes ), + highestRelicEscapeExt = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.HighestRelicEscape ), + killsExt = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.ExtinctionKills ), + revivesExt = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.ExtinctionRevives ), + prestige = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.Prestige ), + dlc = Engine.TableLookupByRow( UnlockTable.File, f26_arg0, UnlockTable.Cols.DLCOffer ) + } + local f26_local1 + if f26_local0.rankExt == "" and f26_local0.prestigeExt == "" and f26_local0.escapesExt == "" and f26_local0.highestRelicEscapeExt == "" and f26_local0.killsExt == "" and f26_local0.revivesExt == "" then + f26_local1 = false + else + f26_local1 = true + end + return f26_local0, f26_local1 + end + + function getPerksUnlockedAtRankRange( f27_arg0, f27_arg1 ) + if f27_arg1 < f27_arg0 then + return + end + local f27_local0 = {} + local f27_local1 = getProperUnlockTable( item ) + for f27_local2 = 0, 2500, 1 do + local f27_local5 = Engine.TableLookupByRow( f27_local1, f27_local2, 0 ) + local f27_local6 = Engine.TableLookupByRow( f27_local1, f27_local2, 1 ) + if f27_local5 == "" and f27_local6 == "" then + break + elseif f27_local6 == "perk" then + local f27_local7 = Engine.TableLookupByRow( f27_local1, f27_local2, 2 ) + local f27_local8 = Engine.TableLookupByRow( f27_local1, f27_local2, 3 ) + if f27_local7 ~= "" and f27_arg0 <= tonumber( f27_local7 ) and tonumber( f27_local7 ) <= f27_arg1 then + table.insert( f27_local0, { + item = f27_local5, + type = f27_local6, + rankReq = f27_local7, + purchaseReq = f27_local8 + } ) + end + end + end + return f27_local0 + end + + function getRankIncreaseForRoundSquadMember( f28_arg0 ) + local f28_local0 = AAR.GetRoundSquadMember( f28_arg0 ) + local f28_local1 = AAR.GetCareerExperienceForSquadMember( f28_arg0, f28_local0 ) + return tonumber( Rank.GetRankDisplay( Lobby.GetRankForXP( f28_local1 - AAR.GetRoundTotalXP( f28_arg0 ) ) ) ), tonumber( Rank.GetRankDisplay( Lobby.GetRankForXP( f28_local1 ) ) ), f28_local0 + end + + function checkIsReticleChallenge( f29_arg0 ) + local f29_local0 = { + acog = 1, + eotech = 1, + hybrid = 1, + reflex = 1 + } + local f29_local1 = { + longshot = 1, + prone = 1, + headshot = 1, + double = 1, + oneshot = 1, + burst = 1, + lean = 1, + consecutive = 1, + zoomin = 1, + zoomout = 1, + penetrate = 1, + moving = 1, + crouch = 1, + ammoslug = 1, + crouch = 1, + altshotgun = 1 + } + local f29_local2 = {} + for f29_local6 in string.gmatch( f29_arg0, "%w+" ) do + f29_local2[#f29_local2 + 1] = f29_local6 + end + if #f29_local2 == 3 and f29_local2[1] == "ch" and f29_local0[f29_local2[2]] == 1 and f29_local1[f29_local2[3]] == 1 then + return true + else + return false + end + end + + function determineReticlesUnlocked( f30_arg0 ) + local f30_local0 = {} + local f30_local1 = Engine.GetPlayerDataEx( f30_arg0, CoD.StatsGroup.Common, "round", "challengeNumCompleted" ) + for f30_local2 = 1, f30_local1, 1 do + local f30_local5 = Engine.GetPlayerDataEx( f30_arg0, CoD.StatsGroup.Common, "round", "challengesCompleted", f30_local2 - 1 ) + local f30_local6 = Engine.GetPlayerDataEx( f30_arg0, CoD.StatsGroup.Ranked, "challengeState", f30_local5 ) + if checkIsReticleChallenge( f30_local5 ) then + for f30_local7 = 0, CamoReticleUnlockTable.MaxRows, 1 do + local f30_local10 = Engine.TableLookupByRow( CamoReticleUnlockTable.File, f30_local7, CamoReticleUnlockTable.Cols.CamoReticleRef ) + local f30_local11 = Engine.TableLookupByRow( CamoReticleUnlockTable.File, f30_local7, CamoReticleUnlockTable.Cols.ChallengeRef ) + local f30_local12 = tonumber( Engine.TableLookupByRow( CamoReticleUnlockTable.File, f30_local7, CamoReticleUnlockTable.Cols.Tier ) ) + if f30_local10 == "" then + + end + if f30_local5 == f30_local11 and f30_local12 and f30_local6 == f30_local12 + 1 then + local f30_local13 = {} + for f30_local17 in string.gmatch( f30_local10, "%w+" ) do + f30_local13[#f30_local13 + 1] = f30_local17 + end + if #f30_local13 == 2 then + table.insert( f30_local0, { + type = "reticle", + item = f30_local13[2], + sight = f30_local13[1], + ch_desc = operationGetDesc( f30_local5, operationGetTargetForTier( f30_local5, f30_local12 ) ) + } ) + end + end + end + end + end + return f30_local0 + end + + function parseCamoChallengeName( f31_arg0 ) + local f31_local0 = {} + for f31_local4 in string.gmatch( f31_arg0, "%w+" ) do + f31_local0[#f31_local0 + 1] = f31_local4 + end + if f31_local0[1] ~= "ch" or f31_local0[2] ~= "iw6" or #f31_local0 < 3 then + DebugPrint( "challenge_ref does not begin with ch_iw6, or contains less then 3 tokens" ) + return false + end + f31_local1 = f31_local0[2] .. "_" .. f31_local0[3] + f31_local2 = Cac.GetWeaponClass( f31_local1 ) + if f31_local1 == "iw6_knifeonly" then + return false + elseif not f31_local2 or f31_local2 == "" then + DebugPrint( "Invalid Weapon Or Weapon Class" ) + return false + end + f31_local3 = nil + if #f31_local0 == 3 then + f31_local3 = "" + elseif #f31_local0 == 4 then + f31_local3 = f31_local0[4] + if not CamoReticleUnlockTable.ChallengeIDList[f31_local3] then + DebugPrint( "unknown challenge postfix" ) + return false + end + f31_local3 = "_" .. f31_local3 + else + DebugPrint( "unknown challenge postfix" ) + return false + end + return true, f31_local1, f31_local2, f31_local3 + end + + function determineCamosUnlocked( f32_arg0 ) + local f32_local0 = {} + local f32_local1 = {} + local f32_local2 = Engine.GetPlayerDataEx( f32_arg0, CoD.StatsGroup.Common, "round", "challengeNumCompleted" ) + for f32_local3 = 1, f32_local2, 1 do + local f32_local6 = Engine.GetPlayerDataEx( f32_arg0, CoD.StatsGroup.Common, "round", "challengesCompleted", f32_local3 - 1 ) + local f32_local7 = Engine.GetPlayerDataEx( f32_arg0, CoD.StatsGroup.Ranked, "challengeState", f32_local6 ) + local f32_local8, f32_local9, f32_local10, f32_local11 = parseCamoChallengeName( f32_local6 ) + if f32_local8 then + for f32_local12 = 0, CamoReticleUnlockTable.MaxRows, 1 do + local f32_local15 = Engine.TableLookupByRow( CamoReticleUnlockTable.File, f32_local12, CamoReticleUnlockTable.Cols.CamoReticleRef ) + local f32_local16 = Engine.TableLookupByRow( CamoReticleUnlockTable.File, f32_local12, CamoReticleUnlockTable.Cols.ChallengeRef ) + local f32_local17 = tonumber( Engine.TableLookupByRow( CamoReticleUnlockTable.File, f32_local12, CamoReticleUnlockTable.Cols.Tier ) ) + if f32_local15 == "" then + + end + local f32_local18 = {} + for f32_local22 in string.gmatch( f32_local15, "%w+" ) do + f32_local18[#f32_local18 + 1] = f32_local22 + end + if #f32_local18 == 3 and Cac.WeaponTypes.WeaponTypeStrings[f32_local18[1] .. "_" .. f32_local18[2]] then + f32_local19 = f32_local18[3] + if f32_local11 == f32_local16 and f32_local10 == f32_local18[1] .. "_" .. f32_local18[2] and f32_local17 and f32_local7 == f32_local17 + 1 then + table.insert( f32_local1, { + type = "camo", + item = f32_local19, + weapon = f32_local9, + ch_desc = operationGetDesc( f32_local6, operationGetTargetForTier( f32_local6, f32_local17 ) ) + } ) + if Cac.UpdateCamoGoldChallenge( f32_arg0, f32_local9, false ) and f32_local0[f32_local9] ~= 1 then + table.insert( f32_local1, { + type = "camo", + item = "gold", + weapon = f32_local9, + ch_desc = Engine.Localize( "@OPERATIONS_KILLS_ALLCAMO_DESC" ) + } ) + f32_local0[f32_local9] = 1 + end + end + end + end + end + end + return f32_local1 + end + + function GetAARUnlockCount( f33_arg0 ) + return #getUnlocksData( f33_arg0 ) + end + + function TryForceOpenUnlocksScreens( f34_arg0, f34_arg1, f34_arg2 ) + local f34_local0 = getUnlocksData( f34_arg2 ) + if #f34_local0 > 0 then + f34_arg0:dispatchEventToRoot( { + name = "open_after_action_report_unlocks", + controller = f34_arg2, + data = { + unlockData = f34_local0, + num_pages = math.ceil( #f34_local0 / AAR.NumUnlocksPerPage ) + } + } ) + end + end + + function OpenUnlockScreens( f35_arg0, f35_arg1 ) + LUI.FlowManager.RequestPopupMenu( f35_arg0, "aar_unlock_main", true, f35_arg1.controller, false, f35_arg1.data ) + end + + function SplitScreenSignInExit( f36_arg0 ) + Engine.Exec( "splitscreen 0" ) + Engine.Exec( "forcesplitscreencontrol menu_splitscreensignin_EXIT" ) + Engine.Exec( "endsplitscreensignin" ) + Engine.Exec( "clearcontrollermap" ) + clearMatchData() + end + + function GetMemberListSpacing( f37_arg0 ) + if SvS.IsSvS() and SvS.GetCurrentSquadModeInfo() == SvS.SquadModes.SquadVsSquad and not f37_arg0 then + return 25 + else + return Engine.IsAliensMode() and LUI.mp_menus.Aliens.AliensMemberListSpacing or 2 + end + end + + function LobbyMemberListGetState( f38_arg0 ) + local f38_local0 = Engine.GetDvarBool( "party_teamsVisible" ) + if f38_local0 then + f38_local0 = Engine.GetDvarBool( "party_teamBased" ) + end + if f38_arg0 == Lobby.MemberListStates.Lobby and f38_local0 then + return Lobby.MemberListStates.Teams + elseif f38_arg0 == Lobby.MemberListStates.Teams and not f38_local0 then + return Lobby.MemberListStates.Lobby + else + return f38_arg0 + end + end + + function LobbyMemberIsBot( f39_arg0, f39_arg1, f39_arg2 ) + return Lobby.IsMemberABot( f39_arg0, f39_arg1, f39_arg2 ) + end + + function GetLobbyMemberUniqueId( f40_arg0, f40_arg1, f40_arg2 ) + return Lobby.GetMemberName( f40_arg0, f40_arg1, f40_arg2 ) + end + + function GetUpperGradient() + return { + type = "UIImage", + id = "upper_gradient_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = -360, + bottom = 360, + material = RegisterMaterial( "gradient_top" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "visible", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + } + end + + function GetLowerGradient() + return { + type = "UIImage", + id = "lower_gradient_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = -320, + bottom = 0, + material = RegisterMaterial( "gradient_bottom" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "visible", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + } + end + + function GetMaxBotLimit() + local f43_local0 = Lobby.CurrGenBotLimit + if Engine.IsPS4() or Engine.IsXB3() or not Engine.IsConsoleGame() then + f43_local0 = Lobby.NextGenBotLimit + end + if Engine.GetDvarBool( "onlinegame" ) == false and Engine.GetDvarBool( "splitscreen" ) == true then + f43_local0 = f43_local0 - Engine.SplitscreenPlayerCount() + end + if Engine.GetDvarBool( "xblive_privatematch" ) == true then + f43_local0 = math.max( math.min( Lobby.HowManyPlayersCanWeHost(), Engine.GetDvarInt( "party_maxplayers" ) ) - Lobby.GetMemberCount( Lobby.MemberListStates.Lobby ), 0 ) + end + if Engine.GetDvarBool( "systemlink" ) == true then + f43_local0 = f43_local0 - 1 + end + return f43_local0 + end + + function BotButtonDisplayText( f44_arg0 ) + local f44_local0 = 0 + if Lobby.GetBotsTeamLimit then + f44_local0 = Lobby.GetBotsTeamLimit( f44_arg0 ) + end + return tostring( f44_local0 ) + end + + function FriendlyBotButtonDisplayText( f45_arg0, f45_arg1 ) + return BotButtonDisplayText( Lobby.BotTeams.Friendly ) + end + + function EnemyBotButtonDisplayText( f46_arg0, f46_arg1 ) + return BotButtonDisplayText( Lobby.BotTeams.Enemy ) + end + + function FFABotButtonDisplayText( f47_arg0, f47_arg1 ) + return BotButtonDisplayText( Lobby.BotTeams.FFA ) + end + + function BotButtonLeft( f48_arg0 ) + if Lobby.GetBotsTeamLimit then + local f48_local0 = Lobby.GetBotsTeamLimit( f48_arg0 ) - 1 + if Lobby.SetBotsTeamLimit then + if f48_local0 < 0 then + Lobby.SetBotsTeamLimit( f48_arg0, 0 ) + else + Lobby.SetBotsTeamLimit( f48_arg0, f48_local0 ) + end + end + end + end + + function FriendlyBotButtonLeft( f49_arg0, f49_arg1 ) + BotButtonLeft( Lobby.BotTeams.Friendly ) + end + + function EnemyBotButtonLeft( f50_arg0, f50_arg1 ) + BotButtonLeft( Lobby.BotTeams.Enemy ) + end + + function FFABotButtonLeft( f51_arg0, f51_arg1 ) + BotButtonLeft( Lobby.BotTeams.FFA ) + end + + function BotButtonRight( f52_arg0, f52_arg1, f52_arg2 ) + if Lobby.GetBotsTeamLimit and Lobby.SetBotsTeamLimit then + local f52_local0 = Lobby.GetBotsTeamLimit( f52_arg0 ) + 1 + if f52_arg1 == Lobby.BotTeams.FFA then + if f52_arg2 < f52_local0 then + Lobby.SetBotsTeamLimit( f52_arg0, f52_arg2 ) + else + Lobby.SetBotsTeamLimit( f52_arg0, f52_local0 ) + end + else + local f52_local1 = Lobby.GetBotsTeamLimit( f52_arg1 ) + if f52_arg2 < f52_local0 + f52_local1 then + if f52_local1 > 0 then + Lobby.SetBotsTeamLimit( f52_arg0, f52_local0 ) + Lobby.SetBotsTeamLimit( f52_arg1, f52_local1 - 1 ) + else + Lobby.SetBotsTeamLimit( f52_arg0, f52_arg2 ) + end + else + Lobby.SetBotsTeamLimit( f52_arg0, f52_local0 ) + end + end + end + end + + function FriendlyBotButtonRight( f53_arg0, f53_arg1 ) + BotButtonRight( Lobby.BotTeams.Friendly, Lobby.BotTeams.Enemy, GetMaxBotLimit() ) + f53_arg0:dispatchEventToParent( { + name = "bot_button_refresh" + } ) + end + + function EnemyBotButtonRight( f54_arg0, f54_arg1 ) + BotButtonRight( Lobby.BotTeams.Enemy, Lobby.BotTeams.Friendly, GetMaxBotLimit() ) + f54_arg0:dispatchEventToParent( { + name = "bot_button_refresh" + } ) + end + + function FFABotButtonRight( f55_arg0, f55_arg1 ) + BotButtonRight( Lobby.BotTeams.FFA, Lobby.BotTeams.FFA, GetMaxBotLimit() ) + end + + function BotButtonRefresh( f56_arg0, f56_arg1 ) + local f56_local0 = MatchRules.GetData( "gametype" ) + if f56_local0 ~= nil and SvS.IsSvS() == false then + local f56_local1 = tonumber( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f56_local0, GameTypesTable.Cols.TeamChoice ) ) + if f56_local1 and f56_local1 == 1 then + local f56_local2 = Lobby.GetBotsTeamLimit( Lobby.BotTeams.Friendly ) + local f56_local3 = Lobby.GetBotsTeamLimit( Lobby.BotTeams.Enemy ) + while f56_local2 + f56_local3 > GetMaxBotLimit() do + if f56_local2 < f56_local3 then + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Enemy, f56_local3 - 1 ) + end + if f56_local3 < f56_local2 then + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Friendly, f56_local2 - 1 ) + else + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Enemy, f56_local3 - 1 ) + end + end + elseif Lobby.GetBotsTeamLimit( Lobby.BotTeams.FFA ) > GetMaxBotLimit() then + Lobby.SetBotsTeamLimit( Lobby.BotTeams.FFA, GetMaxBotLimit() ) + end + end + f56_arg0:processEvent( { + name = "content_refresh" + } ) + end + + function BotsDifficultyButtonDisplayText( f57_arg0 ) + local f57_local0 = Lobby.BotDifficulties.Regular + if Lobby.GetBotsDifficulty then + f57_local0 = Lobby.GetBotsDifficulty( f57_arg0 ) + end + if f57_local0 == Lobby.BotDifficulties.Recruit then + return Engine.Localize( "@LUA_MENU_BOTS_RECRUIT" ) + elseif f57_local0 == Lobby.BotDifficulties.Regular then + return Engine.Localize( "@LUA_MENU_BOTS_REGULAR" ) + elseif f57_local0 == Lobby.BotDifficulties.Hardened then + return Engine.Localize( "@LUA_MENU_BOTS_HARDENED" ) + elseif f57_local0 == Lobby.BotDifficulties.Veteran then + return Engine.Localize( "@LUA_MENU_BOTS_VETERAN" ) + elseif f57_local0 == Lobby.BotDifficulties.Mixed then + return Engine.Localize( "@LUA_MENU_BOTS_MIXED" ) + else + return "FIXME Missing option" + end + end + + function FriendlyBotsDifficultyButtonDisplayText( f58_arg0, f58_arg1 ) + return BotsDifficultyButtonDisplayText( Lobby.BotTeams.Friendly ) + end + + function EnemyBotsDifficultyButtonDisplayText( f59_arg0, f59_arg1 ) + return BotsDifficultyButtonDisplayText( Lobby.BotTeams.Enemy ) + end + + function FFABotsDifficultyButtonDisplayText( f60_arg0, f60_arg1 ) + return BotsDifficultyButtonDisplayText( Lobby.BotTeams.FFA ) + end + + function BotsDifficultyButtonLeft( f61_arg0 ) + if Lobby.GetBotsDifficulty then + local f61_local0 = Lobby.GetBotsDifficulty( f61_arg0 ) - 1 + if Lobby.GetBotsDifficultyCount then + if f61_local0 < 0 then + f61_local0 = Lobby.GetBotsDifficultyCount() - 1 + end + else + f61_local0 = 0 + end + if Lobby.SetBotsDifficulty then + Lobby.SetBotsDifficulty( f61_arg0, f61_local0 ) + end + end + end + + function FriendlyBotsDifficultyButtonLeft( f62_arg0, f62_arg1 ) + BotsDifficultyButtonLeft( Lobby.BotTeams.Friendly ) + end + + function EnemyBotsDifficultyButtonLeft( f63_arg0, f63_arg1 ) + BotsDifficultyButtonLeft( Lobby.BotTeams.Enemy ) + end + + function FFABotsDifficultyButtonLeft( f64_arg0, f64_arg1 ) + BotsDifficultyButtonLeft( Lobby.BotTeams.FFA ) + end + + function BotsDifficultyButtonRight( f65_arg0 ) + if Lobby.GetBotsDifficulty then + local f65_local0 = Lobby.GetBotsDifficulty( f65_arg0 ) + 1 + if Lobby.GetBotsDifficultyCount then + if Lobby.GetBotsDifficultyCount() <= f65_local0 then + f65_local0 = 0 + end + else + f65_local0 = 0 + end + if Lobby.SetBotsDifficulty then + Lobby.SetBotsDifficulty( f65_arg0, f65_local0 ) + end + end + end + + function FriendlyBotsDifficultyButtonRight( f66_arg0, f66_arg1 ) + BotsDifficultyButtonRight( Lobby.BotTeams.Friendly ) + end + + function EnemyBotsDifficultyButtonRight( f67_arg0, f67_arg1 ) + BotsDifficultyButtonRight( Lobby.BotTeams.Enemy ) + end + + function FFABotsDifficultyButtonRight( f68_arg0, f68_arg1 ) + BotsDifficultyButtonRight( Lobby.BotTeams.FFA ) + end + + function FixTeamLimitsAndDifficultiesIfNecessary( f69_arg0, f69_arg1 ) + local f69_local0 = tonumber( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f69_arg0, GameTypesTable.Cols.TeamChoice ) ) + local f69_local1 = tonumber( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f69_arg1, GameTypesTable.Cols.TeamChoice ) ) + if f69_local0 == 1 and f69_local1 == 0 then + if Lobby.SetBotsTeamLimit and Lobby.GetBotsTeamLimit then + local f69_local2 = Lobby.GetBotsTeamLimit( Lobby.BotTeams.Friendly ) + local f69_local3 = Lobby.GetBotsTeamLimit( Lobby.BotTeams.Enemy ) + if f69_local2 + f69_local3 > GetMaxBotLimit() then + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Friendly, 0 ) + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Enemy, 0 ) + Lobby.SetBotsTeamLimit( Lobby.BotTeams.FFA, GetMaxBotLimit() ) + else + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Friendly, 0 ) + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Enemy, 0 ) + Lobby.SetBotsTeamLimit( Lobby.BotTeams.FFA, f69_local2 + f69_local3 ) + end + end + if Lobby.SetBotsDifficulty and Lobby.GetBotsDifficulty then + Lobby.SetBotsDifficulty( Lobby.BotTeams.FFA, Lobby.GetBotsDifficulty( Lobby.BotTeams.Enemy ) ) + end + end + if f69_local0 == 0 and f69_local1 == 1 then + if Lobby.SetBotsTeamLimit and Lobby.GetBotsTeamLimit then + local f69_local2 = GetMaxBotLimit() + local f69_local3 = Lobby.GetBotsTeamLimit( Lobby.BotTeams.FFA ) + if f69_local2 < f69_local3 then + f69_local3 = f69_local2 + end + Lobby.SetBotsTeamLimit( Lobby.BotTeams.FFA, 0 ) + local f69_local4 = math.floor( f69_local3 / 2 ) + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Friendly, f69_local4 ) + if f69_local3 % 2 == 1 then + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Enemy, f69_local4 + 1 ) + else + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Enemy, f69_local4 ) + end + end + if Lobby.SetBotsDifficulty and Lobby.GetBotsDifficulty then + local f69_local2 = Lobby.GetBotsDifficulty( Lobby.BotTeams.FFA ) + Lobby.SetBotsDifficulty( Lobby.BotTeams.Friendly, f69_local2 ) + Lobby.SetBotsDifficulty( Lobby.BotTeams.Enemy, f69_local2 ) + end + end + end + + function SetIsAliensSolo( f70_arg0 ) + if f70_arg0 then + Engine.SetDvarBool( "xblive_privatematch_solo", true ) + else + Engine.SetDvarBool( "xblive_privatematch_solo", false ) + end + end + + function GetGameTypeIcon( f71_arg0 ) + return Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f71_arg0, GameTypesTable.Cols.Image ) + end + + function IsFirstTimeFlowRequired( f72_arg0 ) + local f72_local0 = true + if not Engine.IsAliensMode() then + f72_local0 = Engine.GetPlayerDataEx( f72_arg0, CoD.GetStatsGroupForGameMode(), "squadMembers", Cac.GetActiveSquadMember( f72_arg0 ), "defaultSet" ) + end + local f72_local1 + if f72_local0 ~= nil and f72_local0 ~= false then + f72_local1 = false + else + f72_local1 = true + end + return f72_local1 + end + + function getXPIcon( f73_arg0 ) + if not f73_arg0 then + f73_arg0 = Engine.GetDvarString( "playlist_name" ) + end + local f73_local0, f73_local1, f73_local2 = GetTextDimensions( f73_arg0, CoD.TextSettings.ExtraBigFont.Font, CoD.TextSettings.ExtraBigFont.Height ) + return { + type = "UIElement", + id = "double_xp_container_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + update_double_xp_icon = function ( f74_arg0, f74_arg1 ) + local f74_local0 = false + if Engine.IsAliensMode() then + local self = Engine.GetDvarInt( "scr_aliens_xpscale" ) + if self and self > 1 then + f74_local0 = true + end + else + for self = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.HasActiveLocalClient( self ) then + local f74_local4 = Engine.GetPlayerDataEx( self, CoD.StatsGroup.Ranked, "xpMaxMultiplierTimePlayed", 0 ) + local f74_local5 = Engine.GetPlayerDataEx( self, CoD.StatsGroup.Ranked, "xpMultiplierTimePlayed", 0 ) + local f74_local6 = f74_local5 and f74_local4 and f74_local5 < f74_local4 + local f74_local7 = Engine.GetDvarInt( "scr_xpscale" ) + if f74_local7 then + f74_local7 = Engine.GetDvarInt( "scr_xpscale" ) > 1 + end + if f74_local6 or f74_local7 then + f74_local0 = true + break + end + end + end + end + if f74_local0 then + if not f74_arg0:getFirstDescendentById( "doubleXpTimer" ) then + local self = LUI.UITimer.new( 2000, { + name = "animate_double_xp" + } ) + self.id = "doubleXpTimer" + f74_arg0:addElement( self ) + end + f74_arg0:animateToState( "visible" ) + else + f74_arg0:animateToState( "default" ) + end + end + + }, + children = { + { + type = "UIImage", + id = "double_xp_icon_id", + priority = 10, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f73_local2 + 116 + 10, + right = f73_local2 + 180 + 10, + top = 35, + bottom = 99, + material = RegisterMaterial( "icon_xp" ), + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 1, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 1, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 1 + } + }, + children = { + { + type = "UIImage", + id = "double_xp_icon_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "icon_xp" ), + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 1, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 1, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 1, + alpha = 0 + }, + visible = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 1 + }, + expanded = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = -5, + right = 5, + top = -5, + bottom = 5, + alpha = 0 + } + }, + handlers = { + animate_double_xp = function ( f75_arg0, f75_arg1 ) + local f75_local0 = MBh.AnimateSequence( { + { + "visible", + 200 + }, + { + "expanded", + 0 + } + } ) + f75_local0( f75_arg0 ) + end + + } + } + } + } + } + } + end + + function ShouldShowEliteIcon( f76_arg0, f76_arg1, f76_arg2 ) + local f76_local0 = Lobby.ShowMemberInfo( f76_arg0, f76_arg1, f76_arg2 ) + if f76_local0 then + if not LobbyMemberIsBot( f76_arg0, f76_arg1, f76_arg2 ) and not Engine.IsAliensMode() then + f76_local0 = Lobby.IsUsingSecondScreen( f76_arg0, f76_arg1, f76_arg2 ) + else + f76_local0 = false + end + end + return f76_local0 + end + + function GetCurrentGameType() + local f77_local0 = Engine.GetDvarString( "ui_gametype" ) + if MatchRules.IsUsingMatchRulesData() then + f77_local0 = MatchRules.GetData( "gametype" ) + end + return f77_local0 + end + + function IsCurrentGameTypeteamBased() + local f78_local0 = GetCurrentGameType() + local f78_local1 + if f78_local0 == "dm" or f78_local0 == "mugger" or f78_local0 == "sotf_ffa" or f78_local0 == "gun" then + f78_local1 = false + else + f78_local1 = true + end + return f78_local1 + end + + function RefreshMLGRules( f79_arg0, f79_arg1 ) + if Engine.GetDvarBool( "remove_mlg_rules" ) and not Engine.IsAliensMode() then + MatchRules.LoadMatchRulesDataDefault() + Engine.SetDvarBool( "remove_mlg_rules", false ) + f79_arg0:processEvent( { + name = "create_class_update_restrictions", + controller = f79_arg1 + } ) + end + end + +end +function IsOnlineMatch() + return Engine.GetDvarBool( "onlinegame" ) == true +end + +function IsPrivateMatch() + if Engine.GetDvarBool( "onlinegame" ) == true and Engine.GetDvarBool( "xblive_privatematch" ) == true then + return true + else + return false + end +end + +function isAliensSolo() + return Engine.GetDvarBool( "xblive_privatematch" ) and Engine.IsAliensMode() and Engine.GetDvarBool( "xblive_privatematch_solo" ) +end + +function TriggerUpdateRestrictionsIcon( f83_arg0, f83_arg1 ) + if MatchRules.AllowCustomClasses( "loadouts" ) then + f83_arg0:processEvent( { + name = "update_restrictions_icon", + controller = f83_arg1.controller, + inFocus = f83_arg0:isInFocus() + } ) + end +end + diff --git a/lui/mp_menus/mplobbywidgets.dec.lua b/lui/mp_menus/mplobbywidgets.dec.lua new file mode 100644 index 0000000..163f874 --- /dev/null +++ b/lui/mp_menus/mplobbywidgets.dec.lua @@ -0,0 +1,1853 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function mpLobbyWidgets() + return { + type = "UIElement", + id = "mpLobbyWidgets", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIHorizontalList", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 100, + bottom = 132, + left = 100, + right = 568 + } + }, + children = { + { + type = "UIImage", + id = "left_cap", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 32, + material = RegisterMaterial( "box_lobby_name_lt" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.35 + } + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 468, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + }, + children = { + { + type = "UIImage", + id = "middle", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "box_lobby_name_mid" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.35 + } + } + }, + { + type = "rank_icon_name" + } + } + }, + { + type = "UIImage", + id = "right_cap", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 4, + material = RegisterMaterial( "box_lobby_name_rt" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.35 + } + } + } + } + }, + { + type = "UIImage", + id = "speaker_icon", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 42, + left = -21, + right = 21, + material = RegisterMaterial( "icon_online_chat" ), + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + } + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + }, + { + type = "global_activity_map", + id = "global_activity_map_id" + }, + { + type = "map_digital_anim", + id = "map_digital_anim_id" + } + } + } +end + +function map_digital_anim() + return { + type = "UIElement", + id = "map_container", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "left_side_meters", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = -48, + right = -16, + material = RegisterMaterial( "fluff_lobby_meters_lt" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.2 + } + } + }, + { + type = "UIImage", + id = "rt_map_arrow", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -8, + bottom = 0, + left = 364, + right = 396, + material = RegisterMaterial( "fluff_arrow_tick" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.15 + }, + moveup1 = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -8, + bottom = 0, + left = 364, + right = 396, + red = 1, + green = 1, + blue = 1, + alpha = 0.2 + }, + moveup2 = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -78, + bottom = -70, + left = 364, + right = 396, + red = 1, + green = 1, + blue = 1, + alpha = 0.3 + }, + moveup3 = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -33, + bottom = -25, + left = 364, + right = 392, + red = 1, + green = 1, + blue = 1, + alpha = 0.15 + }, + moveup4 = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -180, + bottom = -172, + left = 364, + right = 396, + red = 1, + green = 1, + blue = 1, + alpha = 0.3 + }, + moveup5 = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -8, + bottom = 0, + left = 364, + right = 396, + red = 1, + green = 1, + blue = 1, + alpha = 0.2 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "moveup1", + 0, + true, + true + }, + { + "moveup2", + 5000, + true, + true + }, + { + "moveup3", + 5000, + true, + true + }, + { + "moveup4", + 5000, + true, + true + }, + { + "moveup5", + 5000, + true, + true + } + } ) + } + }, + { + type = "UIImage", + id = "blinky", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 16, + bottom = 32, + left = -32, + right = -16, + material = RegisterMaterial( "fluff_lobby_register_tick" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.5 + }, + moveup1 = { + red = 1, + green = 1, + blue = 1, + alpha = 0.1, + zRot = 0 + }, + moveup2 = { + red = 1, + green = 1, + blue = 1, + alpha = 0.25, + zRot = 90 + }, + moveup3 = { + red = 1, + green = 1, + blue = 1, + alpha = 0.1, + zRot = 180 + }, + moveup4 = { + red = 1, + green = 1, + blue = 1, + alpha = 0.35, + zRot = 270 + }, + moveup5 = { + red = 1, + green = 1, + blue = 1, + alpha = 0.1, + zRot = 360 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "moveup1", + 0 + }, + { + "moveup2", + 500 + }, + { + "moveup3", + 500 + }, + { + "moveup4", + 500 + }, + { + "moveup5", + 500 + } + } ) + } + } + } + } +end + +function rank_icon_name() + return { + type = "UIHorizontalList", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1, + spacing = 3 + }, + dim = { + alpha = 0.65 + }, + disabled = { + alpha = 0.2 + } + }, + handlers = { + button_over = MBh.AnimateLoop( { + { + "dim", + 200 + }, + { + "default", + 200 + } + } ), + button_up = MBh.AnimateToState( "default" ), + button_disable = MBh.AnimateToState( "disabled", 0 ) + }, + children = { + { + type = "UIText", + id = "rank_text", + properties = { + text = "65" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 3, + bottom = -3, + left = 0, + right = 32, + font = RegisterFont( "fonts/smallfont" ) + } + } + }, + { + type = "UIImage", + id = "rank_icon", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 5, + bottom = -5, + left = 0, + right = 21, + material = RegisterMaterial( "icon_mp_rank" ), + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + } + }, + { + type = "UIText", + id = "clan_tag_text", + properties = { + text = "[WWWW]" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 3, + bottom = -3, + left = 0, + right = 75, + red = 0.5, + green = 0.5, + blue = 0.5, + font = RegisterFont( "fonts/smallfont" ) + } + } + }, + { + type = "UIText", + id = "gamertag_text", + properties = { + text = "WWWWWWWWWWWWWWWW" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 3, + bottom = -3, + left = 0, + right = -200, + font = RegisterFont( "fonts/smallfont" ) + } + } + } + } + } +end + +function updateGlobalActivityMap( f4_arg0, f4_arg1 ) + local f4_local0 = 10 + local f4_local1 = Playlist.GetTotalActivePlayersCount() + if f4_local1 == nil or not f4_local1 then + f4_local1 = "" + end + local f4_local2, f4_local3, f4_local4, f4_local5 = GetTextDimensions( Engine.Localize( "@LUA_MENU_PLAYERS_ONLINE" ), CoD.TextSettings.NormalFont.Font, 16 ) + local f4_local6 = f4_local4 - f4_local2 + f4_arg0:setText( tostring( f4_local1 ) ) + f4_arg0:registerAnimationState( "updated", { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = f4_local6 + f4_local0, + bottom = -34, + width = 200, + top = -50 + } ) + f4_arg0:animateToState( "updated", 0 ) +end + +function global_activity_map() + return { + type = "UIElement", + id = "map_container", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 415, + left = 100, + height = 200, + width = 345 + } + }, + handlers = { + update_map = MBh.EmitEvent( "update_map_activity" ) + }, + children = { + { + type = "UIImage", + id = "map_shadow", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -31.5, + bottom = 0, + left = -37, + right = 34, + material = RegisterMaterial( "box_xbl_map_shadow" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.95 + } + } + }, + { + type = "UIImage", + id = "map_graph", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 164, + bottom = 4, + left = -85, + right = 85, + material = RegisterMaterial( "img_lobby_map_graph_bg" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.75 + } + } + }, + { + type = "UIPopulationMap", + id = "population_map", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + }, + { + type = "UIText", + id = "players_online_label", + properties = { + text = Engine.Localize( "@LUA_MENU_PLAYERS_ONLINE" ) + }, + states = { + default = { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 6, + right = 0, + top = -50, + bottom = -34, + red = 0.39, + green = 0.39, + blue = 0.39, + alpha = 1 + } + } + }, + { + type = "UIText", + id = "players_online", + properties = { + text = "4,443,235,012" + }, + states = { + default = { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = -50, + bottom = -34, + red = 0.6, + green = 0.6, + blue = 0.6, + alpha = 1 + } + }, + handlers = { + menu_create = updateGlobalActivityMap, + update_map_activity = updateGlobalActivityMap + } + }, + { + type = "UIImage", + id = "map_graph_line", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -23, + bottom = 220, + left = -8, + right = 0, + material = RegisterMaterial( "img_lobby_map_graph_line" ), + red = 1, + green = 1, + blue = 1, + alpha = 0.5 + }, + move1 = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -23, + bottom = 220, + left = -8, + right = 0 + }, + move2 = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -23, + bottom = 220, + left = 340, + right = 348 + } + }, + handlers = { + menu_create = MBh.EmitEvent( "start_map_scan" ), + start_map_scan = MBh.AnimateLoop( { + { + "move1", + 0 + }, + { + "move2", + 10000 + } + } ) + } + }, + { + type = "UIImage", + id = "map_graph_brackets", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 166, + bottom = 4, + left = -8, + right = 4, + material = RegisterMaterial( "img_lobby_map_graph_brackets" ), + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + move1 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 166, + bottom = 4, + left = -8, + right = 4 + }, + move2 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 166, + bottom = 4, + left = 340, + right = 352 + } + }, + handlers = { + menu_create = MBh.EmitEvent( "start_map_scan" ), + start_map_scan = MBh.AnimateLoop( { + { + "move1", + 0 + }, + { + "move2", + 10000 + } + } ) + } + }, + { + type = "UITimer", + id = "map_scan_timer", + properties = { + event = "update_map", + interval = 1000 + } + } + } + } +end + +function theater_recording_widget() + return { + type = "UIImage", + id = "theater_recording_widget_id", + states = { + default = { + material = RegisterMaterial( "box_theater_bg" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 790, + right = 955, + top = 651, + bottom = 683 + } + }, + children = { + { + type = "UIText", + id = "theater_text_id", + properties = { + text = Engine.Localize( "@LUA_MENU_THEATER" ) + }, + states = { + default = { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 8, + right = 0, + top = 8, + bottom = 24, + red = 0.39, + green = 0.39, + blue = 0.39 + } + } + }, + { + type = "UIText", + id = "recording_text_id", + properties = { + text = Engine.Localize( "@LUA_MENU_RECORDING" ) + }, + states = { + default = { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 80, + right = 0, + top = 8, + bottom = 24, + red = Colors.cac_ability_text.r, + green = Colors.cac_ability_text.g, + blue = Colors.cac_ability_text.b + } + } + }, + { + type = "UIText", + id = "onoff_text_id", + properties = { + text = Engine.Localize( "@MENU_ON" ) + }, + states = { + default = { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 137, + right = 0, + top = 8, + bottom = 24, + red = 0.39, + green = 0.39, + blue = 0.39 + } + }, + handlers = { + theater_widget_recording_on = function ( f7_arg0, f7_arg1 ) + f7_arg0.setText( Engine.Localize( "@MENU_ON" ) ) + end + , + theater_widget_recording_off = function ( f8_arg0, f8_arg1 ) + f8_arg0.setText( Engine.Localize( "@MENU_OFF" ) ) + end + + } + }, + { + type = "UIImage", + id = "recording_light_id", + states = { + default = { + material = RegisterMaterial( "fluff_circle" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 114, + right = 129, + top = 8, + bottom = -8, + red = 0.95, + green = 0.42, + blue = 0.31 + } + } + } + } + } +end + +function leaveprelobbywarning() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@XBOXLIVE_LEAVEPARTYANDLOBBY" ), + popup_title = Engine.Localize( "@MENU_NOTICE" ), + yes_action = MBh.EmitEventToRoot( { + name = "exit_live_lobby", + immediate = true + } ), + default_focus_index = 2 + } + } +end + +function leaveLobbyWarningYesAction( f10_arg0, f10_arg1 ) + if AreWePrivatePartyHost() then + Engine.Exec( "xstoplobbybackout leavelobbywarning", f10_arg1.controller ) + else + Engine.Exec( "xstopparty leavelobbywarning", f10_arg1.controller ) + end + Engine.Exec( "xblive_privatematch 0", f10_arg1.controller ) + SetIsAliensSolo( false ) + Engine.SetDvarBool( "squad_match", false ) + if Lobby.GetBotsConnectType() > 0 then + Lobby.SetBotsConnectType( 0 ) + end + if MLG.AreMLGRulesEnabled() then + MLG.Toggle( f10_arg0, f10_arg1 ) + end + f10_arg0:dispatchEventToRoot( { + name = "private_match_dvar_updated", + controller = f10_arg1.controller + } ) +end + +function leavelobbywarning() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@XBOXLIVE_LEAVELOBBY" ), + popup_title = Engine.Localize( "@MENU_NOTICE" ), + yes_action = MBh.DoMultiple( { + leaveLobbyWarningYesAction, + ExitLobby + } ), + default_focus_index = 2 + } + } +end + +function leavelobbybadsquad() + return { + type = "generic_confirmation_popup", + properties = { + message_text = Engine.Localize( "@LUA_MENU_BAD_SQUAD" ), + popup_title = Engine.Localize( "@MENU_NOTICE" ), + confirmation_action = MBh.DoMultiple( { + leaveLobbyWarningYesAction, + ExitLobby + } ) + } + } +end + +function leavelobbybadsquadmap() + return { + type = "generic_confirmation_popup", + properties = { + message_text = Engine.Localize( "@PLATFORM_MISSINGMAP" ), + popup_title = Engine.Localize( "@MENU_NOTICE" ), + confirmation_action = MBh.DoMultiple( { + leaveLobbyWarningYesAction, + ExitLobby + } ), + cancel_will_close = false + } + } +end + +function leaveLobbyAndPartyYesAction( f14_arg0, f14_arg1 ) + local f14_local0 = Engine.Exec + if f14_arg1.execNow then + f14_local0 = Engine.ExecNow + end + f14_local0( "xstopparty leavelobbyandpartywarning" ) + f14_local0( "xstopprivateparty" ) + f14_local0( "xstartprivateparty" ) + f14_local0( "xblive_privatematch 0" ) + SetIsAliensSolo( false ) + Engine.SetDvarBool( "squad_match", false ) + if Lobby.GetBotsConnectType() > 0 then + Lobby.SetBotsConnectType( 0 ) + end + if MLG.AreMLGRulesEnabled() then + MLG.Toggle( f14_arg0, f14_arg1 ) + end +end + +function leaveLobbyAndPartyYesActionWithExitLobby( f15_arg0, f15_arg1 ) + leaveLobbyAndPartyYesAction( f15_arg0, f15_arg1 ) + ExitLobby( f15_arg0, f15_arg1 ) +end + +function leavelobbyandpartywarning() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@XBOXLIVE_LEAVEPARTYANDLOBBY" ), + popup_title = Engine.Localize( "@MENU_NOTICE" ), + yes_action = MBh.DoMultiple( { + leaveLobbyAndPartyYesAction, + ExitLobby + } ), + default_focus_index = 2 + } + } +end + +function leaveLobbyBlockedPlayerWarningYesAction( f17_arg0, f17_arg1 ) + if AreWePrivatePartyHost() then + Engine.Exec( "xstoplobbybackout leavelobbyblockedplayerwarning", f17_arg1.controller ) + else + Engine.Exec( "xstopparty leavelobbyblockedplayerwarning", f17_arg1.controller ) + end + Engine.Exec( "xblive_privatematch 0" ) + SetIsAliensSolo( false ) + if Lobby.GetBotsConnectType() > 0 then + Lobby.SetBotsConnectType( 0 ) + end + if MLG.AreMLGRulesEnabled() then + MLG.Toggle( f17_arg0, f17_arg1 ) + end +end + +function leavelobbyblockedplayerwarning() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@XBOXLIVE_LEAVELOBBYBLOCKEDPLAYER" ), + popup_title = Engine.Localize( "@MENU_NOTICE" ), + yes_action = MBh.DoMultiple( { + leaveLobbyBlockedPlayerWarningYesAction, + ExitLobby + } ), + default_focus_index = 2 + } + } +end + +function ShouldShowMapInfo( f19_arg0 ) + if IsPublicMatch() then + if Lobby.HasVotePassed() or Engine.GetDvarBool( "squad_match" ) == true then + f19_arg0:animateToState( "default", 200 ) + else + f19_arg0:animateToState( "hidden", 0 ) + return + end + end +end + +function MapInfoSetMapName( f20_arg0, f20_arg1 ) + local f20_local0 = Lobby.GetMapName() + local f20_local1 = CoD.TextSettings.BoldFont + local f20_local2, f20_local3, f20_local4, f20_local5 = GetTextDimensions( f20_local0, f20_local1.Font, f20_local1.Height ) + f20_arg0:registerAnimationState( "current", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 20 + f20_local4 - f20_local2, + top = 0, + bottom = 0 + } ) + f20_arg0:setText( f20_local0 ) + f20_arg0:animateToState( "current", 0 ) +end + +function MapInfoSetGameMode( f21_arg0, f21_arg1 ) + if IsPublicMatch() then + if Lobby.HasVotePassed() or squad_mode == true then + f21_arg0:animateToState( "default", 0 ) + else + f21_arg0:animateToState( "hidden", 0 ) + return + end + end + local f21_local0 = LUI.mp_menus.Aliens.FixGameModeTextForChaos( Lobby.GameTypeNameAbbreviated() ) + local f21_local1 = CoD.TextSettings.NormalFont + local f21_local2, f21_local3, f21_local4, f21_local5 = GetTextDimensions( f21_local0, f21_local1.Font, f21_local1.Height ) + f21_arg0:registerAnimationState( "current", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 20 + f21_local4 - f21_local2, + top = 0, + bottom = 0 + } ) + f21_arg0:setText( f21_local0 ) + f21_arg0:animateToState( "current", 0 ) +end + +function MapInfoSetExtinctionDifficulty( f22_arg0, f22_arg1 ) + if not LUI.mp_menus.Aliens.ExtinctionHasDifficultySelection() then + f22_arg0:animateToState( "hidden", 0 ) + return + elseif not Engine.IsAliensMode() then + f22_arg0:animateToState( "hidden", 0 ) + return + elseif LUI.mp_menus.Aliens.IsChaosEnabled() then + f22_arg0:animateToState( "hidden", 0 ) + return + elseif IsPublicMatch() then + if Lobby.HasVotePassed() or squad_mode == true then + f22_arg0:animateToState( "default", 0 ) + else + f22_arg0:animateToState( "hidden", 0 ) + return + end + end + local f22_local0 = LUI.mp_menus.Aliens.ExtinctionDifficultyDisplayText( LUI.mp_menus.Aliens.ExtinctionDetermineDifficulty() ) + local f22_local1 = CoD.TextSettings.NormalFont + local f22_local2, f22_local3, f22_local4, f22_local5 = GetTextDimensions( f22_local0, f22_local1.Font, f22_local1.Height ) + f22_arg0:registerAnimationState( "current", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 20 + f22_local4 - f22_local2, + top = 0, + bottom = 0, + alpha = 1 + } ) + f22_arg0:setText( f22_local0 ) + f22_arg0:animateToState( "current", 0 ) +end + +function map_info_text() + local f23_local0, f23_local1, f23_local2, f23_local3 = GetTextDimensions( text, CoD.TextSettings.BoldFont.Font, CoD.TextSettings.BoldFont.Height ) + local f23_local4, f23_local5, f23_local6, f23_local7 = GetTextDimensions( text, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f23_local8 = 20 + f23_local2 - f23_local0 + local f23_local9 = 20 + f23_local6 - f23_local4 + return { + type = "UIElement", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 100, + right = 0, + top = 594, + bottom = 594 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_info_text = ShouldShowMapInfo, + menu_create = ShouldShowMapInfo + }, + children = { + { + type = "UIImage", + id = "bg_bot", + states = { + default = { + material = RegisterMaterial( "box_white_gradient_bot" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = -200, + right = 0, + top = -38, + bottom = 5, + red = 0, + green = 0, + blue = 0, + alpha = 0.5 + } + } + }, + { + type = "UIHorizontalList", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UIText", + id = "map_name_text", + properties = { + text = Lobby.GetMapName() + }, + states = { + default = { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f23_local8, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_info_text = MapInfoSetMapName, + menu_create = MapInfoSetMapName + } + }, + { + type = "UIText", + id = "game_mode_text", + properties = { + text = Lobby.GameTypeNameAbbreviated() + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f23_local9, + top = 0, + bottom = 0, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_info_text = MapInfoSetGameMode, + menu_create = MapInfoSetGameMode + } + }, + { + type = "UIText", + id = "extinction_difficulty_text", + properties = { + text = "" + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f23_local9, + top = 0, + bottom = 0, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_info_text = MapInfoSetExtinctionDifficulty, + menu_create = MapInfoSetExtinctionDifficulty + } + } + } + }, + { + type = "UITimer", + id = "map_info_text_timer_id", + properties = { + event = { + name = "update_info_text", + dispatchChildren = true + }, + interval = 200, + disposable = false + } + } + } + } +end + +function lobby_status( menu, controller ) + local self = LUI.UIElement.new() + self.id = "lobby_status_widget_id" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 655, + width = 525, + top = 43, + bottom = 0, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + local f24_local1 = LUI.UIText.new() + f24_local1.id = "status_text_line_one" + f24_local1:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = -10, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + alpha = 1 + } ) ) + f24_local1:registerAnimationState( "hidden", { + alpha = 0 + } ) + f24_local1:animateToState( "default" ) + f24_local1:registerEventHandler( "lobby_page_enter", function ( element, event ) + element:animateToState( "default", event.animTime or 0 ) + end ) + self:addElement( f24_local1 ) + local f24_local2 = function ( f26_arg0, f26_arg1 ) + f24_local1:setText( Lobby.GetPartyStatus() ) + end + + local f24_local3 = LUI.UITimer.new( 200, { + name = "refresh_lobby_status_text" + }, nil, false, self, false ) + f24_local3.id = "lobby_status_refresh_timer_id" + self:addElement( f24_local3 ) + self:registerEventHandler( "menu_create", f24_local2 ) + self:registerEventHandler( "refresh_lobby_status_text", f24_local2 ) + self:registerEventHandler( "lobby_page_leave", function ( element, event ) + element:animateToState( "hidden", event.animTime or 0 ) + end ) + self:registerEventHandler( "lobby_page_enter", function ( element, event ) + element:animateToState( "default", event.animTime or 0 ) + end ) + return self +end + +function lobby_search_status( menu, controller ) + local self = LUI.UIElement.new() + self.id = "lobby_search_status_widget_id" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 655, + width = 525, + top = 43, + bottom = 0, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + if SvS.IsSvS() and SvS.GetCurrentSquadModeInfo() == SvS.SquadModes.SquadAssault then + self:animateToState( "hidden" ) + else + self:animateToState( "default" ) + end + local f29_local1 = LUI.UIText.new() + f29_local1.id = "search_status_text_line_two" + f29_local1:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 50, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) ) + f29_local1:registerAnimationState( "hidden", { + alpha = 0 + } ) + f29_local1:animateToState( "default" ) + self:addElement( f29_local1 ) + local f29_local2 = function ( f30_arg0, f30_arg1 ) + f29_local1:setText( Lobby.GetSearchStatus() ) + end + + local f29_local3 = LUI.UITimer.new( 200, { + name = "refresh_lobby_search_status_text" + }, nil, false, self, false ) + f29_local3.id = "lobby_search_status_refresh_timer_id" + self:addElement( f29_local3 ) + self:registerEventHandler( "menu_create", f29_local2 ) + self:registerEventHandler( "refresh_lobby_search_status_text", f29_local2 ) + self:registerEventHandler( "lobby_page_leave", function ( element, event ) + element:animateToState( "hidden", event.animTime or 0 ) + end ) + self:registerEventHandler( "lobby_page_enter", function ( element, event ) + element:animateToState( "default", event.animTime or 0 ) + end ) + return self +end + +function lobby_loading_widget() + local f33_local0 = Engine.GetDvarBool( "wideScreen" ) + if not Engine.IsAliensMode() then + local f33_local1 = { + type = "UIImage", + id = "empty_load_bar_id" + } + local f33_local2 = {} + local f33_local3 = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true + } + local f33_local4 + if f33_local0 then + f33_local4 = -208 + if not f33_local4 then + + else + f33_local3.left = f33_local4 + if f33_local0 then + f33_local4 = -73 + if not f33_local4 then + + else + f33_local3.right = f33_local4 + f33_local3.top = -228 + f33_local3.bottom = -93 + f33_local3.alpha = 0 + f33_local3.material = RegisterMaterial( "img_load_diamond_000" ) + f33_local2.default = f33_local3 + f33_local3 = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true + } + if f33_local0 then + f33_local4 = -208 + if not f33_local4 then + + else + f33_local3.left = f33_local4 + if f33_local0 then + f33_local4 = -73 + if not f33_local4 then + + else + f33_local3.right = f33_local4 + f33_local3.top = -228 + f33_local3.bottom = -93 + f33_local3.alpha = 1 + f33_local2.visible = f33_local3 + f33_local1.states = f33_local2 + f33_local1.children = { + { + type = "UILoadingDots", + id = "loading_dots", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -42, + right = 20, + top = 21, + bottom = 46, + alpha = 0.4, + font = CoD.TextSettings.ExtraBigFont.Font + } + } + } + } + f33_local1.handlers = { + lobby_transition_to_game = MBh.AnimateToState( "visible", 500 ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + return f33_local1 + end + end + f33_local4 = -162 + end + end + f33_local4 = -296 + end + end + f33_local4 = -162 + end + end + f33_local4 = -296 + else + return { + type = "UIImage", + id = "empty_load_bar_id", + states = { + default = CoD.ColorizeState( Colors.white, { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 121, + right = -237, + top = -91, + bottom = -87, + alpha = 0, + material = RegisterMaterial( "white" ) + } ), + visible = { + alpha = 0.25 + } + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "visible", 500, true ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + } + end +end + +function lobby_game_type_title() + return { + type = "UIText", + id = "game_type_name_id", + properties = { + text = "", + textStyle = CoD.TextStyle.OutlinedMore + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 202, + right = 438, + top = 56, + bottom = 96, + alpha = 0, + font = CoD.TextSettings.ExtraBigFont.Font + }, + visible = { + alpha = 1 + } + }, + handlers = { + lobby_transition_to_game = function ( f35_arg0, f35_arg1 ) + if not Engine.IsAliensMode() then + if SvS.IsSvS() then + local f35_local0 = Engine.GetDvarBool( "squad_match" ) + local f35_local1 = Squad.GetEnemyGameMode() + end + f35_arg0:setText( Engine.Localize( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f35_local0 and f35_local1 or Engine.GetDvarString( "ui_gametype" ), GameTypesTable.Cols.Name ) ) ) + else + f35_arg0:setText( Lobby.GameTypeNameAbbreviated() ) + end + f35_arg0:animateToState( "visible", 500 ) + end + , + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + } +end + +function GetLobbyIconMaterial( f36_arg0 ) + if f36_arg0 and Engine.GetDvarString( "playlist_image" ) then + return RegisterMaterial( Engine.GetDvarString( "playlist_image" ) ) + else + return RegisterMaterial( GetGameTypeIcon( Engine.GetDvarString( "ui_gametype" ) ) ) + end +end + +function lobby_game_type_icon( menu, controller ) + local self = LUI.UIImage.new() + self.id = "game_type_icon_id" + if not controller then + controller = {} + end + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 88, + right = 217, + top = 24, + bottom = 148, + alpha = 0, + material = GetLobbyIconMaterial( controller.online ) + } ) + self:animateToState( "default" ) + self:registerEventHandler( "lobby_transition_to_game", function ( element, event ) + element:registerAnimationState( "visible", { + alpha = 1, + material = GetLobbyIconMaterial( element.properties.online ) + } ) + element:animateToState( "visible", 500 ) + end ) + self:registerEventHandler( "lobby_rollback_transition_to_game", function ( element, event ) + element:animateToState( "default", Lobby.TransitionTime ) + end ) + return self +end + +function character_playing_as( menu, controller ) + local self = LUI.UIElement.new() + self.id = "character_playing_as_widget_id" + self:registerAnimationState( "default", { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 55, + right = -100, + height = CoD.TextSettings.NormalFont.Height, + width = 520, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + if not Engine.IsAliensMode() then + local f40_local1 = Engine.GetFirstActiveController() + local f40_local2 = Cac.GetActiveSquadMember( f40_local1 ) + local f40_local3 = Cac.GetSquadMemberName( f40_local1, Cac.GetSquadLoc(), f40_local2 ) or "" + local f40_local4 = Engine.Localize( "@LUA_MENU_PLAYING_AS", Engine.MarkLocalized( f40_local3 ) ) + local f40_local5 = LUI.UIMarqueeText.new() + f40_local5.id = "character_playing_as_text" + local f40_local6 = f40_local5 + local f40_local7 = f40_local5.setText + if f40_local3 then + local f40_local8 = f40_local4 + end + f40_local7( f40_local6, f40_local8 or "" ) + f40_local5:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right + } ) ) + f40_local5:animateToState( "default" ) + f40_local5:registerEventHandler( "private_match_dvar_updated", function ( element, event ) + local f41_local0 = Cac.GetSquadMemberName( f40_local1, Cac.GetSquadLoc(), f40_local2 ) or "" + local f41_local1 = Engine.Localize( "@LUA_MENU_PLAYING_AS", Engine.MarkLocalized( f41_local0 ) ) + local f41_local2 = element + local f41_local3 = element.setText + if f41_local0 then + local f41_local4 = f41_local1 + end + f41_local3( f41_local2, f41_local4 or "" ) + end ) + self:addElement( f40_local5 ) + f40_local5:registerEventHandler( "online_data_finished", function ( element, event ) + local f42_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + local f42_local1 = f42_local0.exclusiveController + if not f42_local1 then + f42_local1 = Engine.GetFirstActiveController() + end + local f42_local2 = Cac.GetSquadMemberName( f42_local1, Cac.GetSquadLoc(), Cac.GetActiveSquadMember( f42_local1 ) ) or "" + local f42_local3 = Engine.Localize( "@LUA_MENU_PLAYING_AS", Engine.MarkLocalized( f42_local2 ) ) + local f42_local4 = element + local f42_local5 = element.setText + if f42_local2 then + local f42_local6 = f42_local3 + end + f42_local5( f42_local4, f42_local6 or "" ) + end ) + f40_local5:registerEventHandler( "menu_create", function ( element, event ) + local f43_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + local f43_local1 = f43_local0.exclusiveController + if not f43_local1 then + f43_local1 = Engine.GetFirstActiveController() + end + local f43_local2 = Cac.GetSquadMemberName( f43_local1, Cac.GetSquadLoc(), Cac.GetActiveSquadMember( f43_local1 ) ) or "" + local f43_local3 = Engine.Localize( "@LUA_MENU_PLAYING_AS", Engine.MarkLocalized( f43_local2 ) ) + local f43_local4 = element + local f43_local5 = element.setText + if f43_local2 then + local f43_local6 = f43_local3 + end + f43_local5( f43_local4, f43_local6 or "" ) + end ) + end + return self +end + +function UpdateRestrictionsIcon( f44_arg0, f44_arg1 ) + local f44_local0 = f44_arg1.controller + if not f44_arg1.controller then + f44_local0 = Engine.GetFirstActiveController() + end + local f44_local1 = "loadouts" + local f44_local2 = "privateMatchSquadMembers" + local f44_local3 = Cac.GetActiveSquadMember( f44_local0 ) + local f44_local4 = true + if MatchRules.AllowCustomClasses( f44_local1 ) then + for f44_local5 = 0, Cac.Settings.DataLoc[f44_local2].maxClassSlots - 1, 1 do + if not MatchRules.CustomClassIsRestricted( f44_local0, CoD.GetStatsGroupForGameMode(), f44_local2, f44_local3, f44_local1, f44_local5 ) then + f44_local4 = false + break + end + end + if f44_local4 then + f44_arg0:animateToState( f44_arg1.inFocus and "expand" or "default" ) + f44_arg0:animateToState( "visible" ) + end + f44_arg0:animateToState( "default" ) + end +end + +function lobby_restriction_icon( f45_arg0, f45_arg1 ) + return { + type = "UIImage", + id = "weapon_restriction_icon", + states = { + default = { + rightAnchor = true, + leftAnchor = false, + topAnchor = false, + bottomAnchor = true, + right = 32, + bottom = -7, + width = 32, + height = 32, + material = RegisterMaterial( "icon_new_3" ), + alpha = 0 + }, + expand = { + rightAnchor = true, + leftAnchor = false, + topAnchor = false, + bottomAnchor = true, + right = 71, + bottom = -7, + width = 32, + height = 32, + material = RegisterMaterial( "icon_new_3" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + update_restrictions_icon = UpdateRestrictionsIcon, + menu_create = UpdateRestrictionsIcon + } + } +end + +LUI.MenuBuilder.registerType( "lobby_status", lobby_status ) +LUI.MenuBuilder.registerType( "lobby_search_status", lobby_search_status ) +LUI.MenuBuilder.registerDef( "theater_recording_widget", theater_recording_widget ) +LUI.MenuBuilder.registerDef( "leaveprelobbywarning", leaveprelobbywarning ) +LUI.MenuBuilder.registerDef( "leavelobbywarning", leavelobbywarning ) +LUI.MenuBuilder.registerDef( "leavelobbyandpartywarning", leavelobbyandpartywarning ) +LUI.MenuBuilder.registerDef( "global_activity_map", global_activity_map ) +LUI.MenuBuilder.registerDef( "mpLobbyWidgets", mpLobbyWidgets ) +LUI.MenuBuilder.registerDef( "rank_icon_name", rank_icon_name ) +LUI.MenuBuilder.registerDef( "leavelobbyblockedplayerwarning", leavelobbyblockedplayerwarning ) +LUI.MenuBuilder.registerDef( "map_info_text", map_info_text ) +LUI.MenuBuilder.registerDef( "map_digital_anim", map_digital_anim ) +LUI.MenuBuilder.registerDef( "leavelobbybadsquad", leavelobbybadsquad ) +LUI.MenuBuilder.registerDef( "lobby_loading_widget", lobby_loading_widget ) +LUI.MenuBuilder.registerDef( "lobby_game_type_title", lobby_game_type_title ) +LUI.MenuBuilder.registerType( "lobby_game_type_icon", lobby_game_type_icon ) +LUI.MenuBuilder.registerType( "character_playing_as", character_playing_as ) +LUI.MenuBuilder.registerDef( "leavelobbybadsquadmap", leavelobbybadsquadmap ) +LUI.MenuBuilder.registerDef( "lobby_restriction_icon", lobby_restriction_icon ) +LockTable( _M ) diff --git a/lui/mp_menus/mpmainmenu.dec.lua b/lui/mp_menus/mpmainmenu.dec.lua new file mode 100644 index 0000000..170464a --- /dev/null +++ b/lui/mp_menus/mpmainmenu.dec.lua @@ -0,0 +1,702 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function mpMainMenuPushFunc() + Engine.StopMusic( 200 ) + if Engine.IsAliensMode() then + Engine.PlayMusic( CoD.Music.MainExtinctMusic ) + elseif SvS.IsSvS() then + Engine.PlayMusic( CoD.Music.MainSquadMusic ) + else + Engine.PlayMusic( CoD.Music.MainMPMusic ) + end + if Engine.SplitscreenPlayerCount() > 0 then + local f1_local0 = Engine.GetFirstActiveController() + if f1_local0 and Engine.IsUserSignedIn( f1_local0 ) then + Engine.PLMRefreshData() + end + end +end + +function mpMainMenuCheckRequiredDLC( f2_arg0, f2_arg1 ) + if Engine.IsXbox360() then + LUI.mp_menus.MPPopups.UpdateRequiredDLCNotification( f2_arg0, f2_arg1 ) + end +end + +function mpMainMenuCreateHandler( f3_arg0, f3_arg1 ) + Engine.SetDvarString( "ui_version_show", "0" ) + Engine.SetDvarBool( "ui_onlineRequired", false ) + f3_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@MENU_MAIN_MENU" ), + side = "left", + clickable = true + } ) + mpMainMenuCheckRequiredDLC( f3_arg0, f3_arg1 ) +end + +function resolveXboxLiveButtonAction( f4_arg0 ) + Engine.ExecNow( "forcenosplitscreencontrol main_XBOXLIVE_1", f4_arg0 ) + local f4_local0, f4_local1 = Engine.UserCanPlayOnline( f4_arg0 ) + if not f4_local0 and f4_local1 == CoD.PlayOnlineFailure.OPFR_XBOXLIVE_MPNOTALLOWED and Engine.IsXB3() then + f4_local0 = Engine.ShowXB3GoldUpsell( f4_arg0 ) + end + if not f4_local0 then + Engine.ExecWithResolve( "xrequirelivesignin", resolveXboxLiveButtonAction, f4_arg0 ) + Engine.Exec( "forcenosplitscreencontrol main_XBOXLIVE_2", f4_arg0 ) + else + if Engine.IsXbox360() and Engine.AnyContentDamaged and Engine.AnyContentDamaged() then + LUI.FlowManager.RequestPopupMenu( self, "mp_damaged_content_popup", false, f4_arg0 ) + return + elseif SvS.IsSvS() then + Engine.Exec( "profile_SetHasEverPlayed_SP", f4_arg0 ) + end + Engine.ExecNow( "resetSplitscreenSignIn", f4_arg0 ) + Engine.ExecNow( "forcenosplitscreencontrol main_XBOXLIVE_3", f4_arg0 ) + Engine.SetDvarBool( "systemlink", false ) + Engine.SetDvarBool( "splitscreen", false ) + Engine.SetDvarBool( "onlinegame", true ) + Engine.SetDvarBool( "xblive_privatematch", false ) + Engine.SetDvarBool( "ui_opensummary", false ) + Engine.SetDvarBool( "squad_match", false ) + if Engine.GetDvarBool( "xblive_competitionmatch" ) then + Engine.SetDvarBool( "xblive_competitionmatch", false ) + Engine.Exec( "set remove_mlg_rules 1" ) + end + Engine.ExecNow( MPConfig.default_xboxlive, f4_arg0 ) + if not SvS.IsSvS() then + Engine.ExecNow( "xstartprivateparty", f4_arg0 ) + end + Engine.Exec( "startentitlements", f4_arg0 ) + Engine.CacheUserDataForController( f4_arg0 ) + if SvS.IsSvS() then + LUI.FlowManager.RequestAddMenu( nil, "squads_mode_select_menu", false, f4_arg0, false ) + else + LUI.FlowManager.RequestAddMenu( nil, "menu_xboxlive", false, f4_arg0, false ) + end + end +end + +function xboxLiveButtonAction( f5_arg0, f5_arg1 ) + resolveXboxLiveButtonAction( f5_arg1.controller ) +end + +function splitScreenButtonAction( f6_arg0, f6_arg1 ) + if Engine.IsXbox360() and Engine.AnyContentDamaged and Engine.AnyContentDamaged() then + LUI.FlowManager.RequestPopupMenu( f6_arg0, "mp_damaged_content_popup", false, controller ) + return + elseif SvS.IsSvS() then + Engine.Exec( "profile_SetHasEverPlayed_SP", f6_arg1.controller ) + end + Engine.Exec( "resetSplitscreenSignIn" ) + Engine.Exec( "forcesplitscreencontrol main_SPLITSCREEN" ) + Engine.SetDvarBool( "systemlink", false ) + Engine.SetDvarBool( "splitscreen", true ) + Engine.SetDvarBool( "onlinegame", false ) + Engine.SetDvarBool( "xblive_privatematch", false ) + Engine.SetDvarBool( "ui_opensummary", false ) + Engine.Exec( MPConfig.default_splitscreen ) + Engine.CacheUserDataForController( f6_arg1.controller ) + if Engine.GetDvarBool( "lui_splitscreensignin_menu" ) then + LUI.FlowManager.RequestAddMenu( f6_arg0, "menu_splitscreensignin", false, f6_arg1.controller, false ) + else + assert( not Engine.IsAliensMode(), "Splitscreen sign in UI not supported by .menu." ) + LUI.FlowManager.RequestOldMenu( f6_arg0, "menu_splitscreensignin", false ) + end +end + +function systemLinkButtonResolveAction( f7_arg0 ) + Engine.SetDvarBool( "systemlink", true ) + Engine.SetDvarBool( "splitscreen", false ) + Engine.SetDvarBool( "onlinegame", false ) + Engine.SetDvarBool( "xblive_privatematch", false ) + Engine.SetDvarBool( "ui_opensummary", false ) + Engine.Exec( MPConfig.default_systemlink, f7_arg0 ) + Engine.CacheUserDataForController( f7_arg0 ) + if Engine.IsUserSignedIn( f7_arg0 ) == true and Engine.IsUserAGuest( f7_arg0 ) == false then + if Engine.IsPS3() then + if Engine.OfflineProfileIsSelected( Engine.GetFirstActiveController() ) then + Engine.Exec( "forcenosplitscreencontrol main_SYSTEMLINK_3", f7_arg0 ) + LUI.FlowManager.RequestAddMenu( nil, "menu_systemlink", false, f7_arg0, false ) + else + LUI.FlowManager.RequestPopupMenu( nil, "menu_ps3_profile", true, f7_arg0, false ) + end + else + if Engine.IsXbox360() and Engine.AnyContentDamaged and Engine.AnyContentDamaged() then + LUI.FlowManager.RequestPopupMenu( self, "mp_damaged_content_popup", false, f7_arg0 ) + return + end + Engine.Exec( "forcenosplitscreencontrol main_SYSTEMLINK_3", f7_arg0 ) + LUI.FlowManager.RequestAddMenu( nil, "menu_systemlink", false, f7_arg0, false ) + end + end +end + +function systemLinkButtonAction( f8_arg0, f8_arg1 ) + Engine.ExecNow( "forcenosplitscreencontrol main_SYSTEMLINK_1", f8_arg1.controller ) + if not Engine.IsUserSignedIn( f8_arg1.controller ) or Engine.IsUserAGuest( f8_arg1.controller ) then + Engine.ExecWithResolve( "xrequiresignin", systemLinkButtonResolveAction, f8_arg1.controller ) + Engine.Exec( "forcesplitscreencontrol main_SYSTEMLINK_2", f8_arg1.controller ) + else + systemLinkButtonResolveAction( f8_arg1.controller ) + end +end + +function eliteButtonAction( f9_arg0, f9_arg1 ) + if not Engine.IsEliteAppAvailable( f9_arg1.controller ) then + Engine.ExecNow( "incnosplitscreencontrol main_ELITE_1", f9_arg1.controller ) + if not Engine.IsUserSignedInForCommerce( f9_arg1.controller ) then + Engine.Exec( "xrequirelivesigninforcommerce", f9_arg1.controller ) + Engine.Exec( "decnosplitscreencontrol main_ELITE_2" ) + else + Engine.ExecNow( "decnosplitscreencontrol main_ELITE_3" ) + LUI.FlowManager.RequestPopupMenu( f9_arg0, "popup_elite_sell", false, f9_arg1.controller ) + end + end +end + +function resolveStoreButtonAction( f10_arg0 ) + if not Engine.UserCanAccessStore( f10_arg0 ) then + Engine.ExecNow( "forcenosplitscreencontrol main_XBOXLIVE_STORE_1", f10_arg0 ) + Engine.ExecWithResolve( "xrequirelivesigninforstore", resolveStoreButtonAction, f10_arg0 ) + Engine.Exec( "forcesplitscreencontrol main_XBOXLIVE_STORE_2", f10_arg0 ) + else + Engine.SetDvarBool( "ui_onlineRequired", true ) + if not Sns.OpenStoreMenu( f10_arg0 ) then + Engine.SetDvarBool( "ui_onlineRequired", false ) + end + end +end + +function storeButtonAction( f11_arg0, f11_arg1 ) + Engine.SetDvarBool( "systemlink", false ) + resolveStoreButtonAction( f11_arg1.controller ) +end + +function optionsButtonAction( f12_arg0, f12_arg1 ) + if Engine.IsConsoleGame() then + Engine.ExecNow( "forcenosplitscreencontrol main_options_menu", f12_arg1.controller ) + LUI.FlowManager.RequestAddMenu( f12_arg0, "controls", true, f12_arg1.controller, false ) + else + LUI.FlowManager.RequestAddMenu( f12_arg0, "pc_controls", true, f12_arg1.controller, false ) + end +end + +function mainMenuButtonAction( f13_arg0, f13_arg1 ) + Engine.StartSingleplayer() +end + +function updateDescText( f14_arg0, f14_arg1 ) + f14_arg0:setText( Engine.Localize( f14_arg1.string ) ) +end + +function MainMenuChildFeeder( f15_arg0 ) + local f15_local0 = SvS.IsSvS() + local f15_local1 = nil + if Engine.IsAliensMode() then + f15_local1 = Engine.Localize( "@LUA_MENU_ALIENS" ) + elseif f15_local0 then + f15_local1 = Engine.Localize( "@LUA_MENU_SQUAD_TITLE_CAPS" ) + else + f15_local1 = Engine.Localize( "@LUA_MENU_MULTIPLAYER_CAPS" ) + end + local f15_local2 = { + [#f15_local2 + 1] = { + type = "generic_menu_title", + id = "mp_main_title_text_id", + properties = { + menu_title = f15_local1 + } + }, + [#f15_local2 + 1] = { + type = "main_mp_menu_options" + }, + [#f15_local2 + 1] = { + type = "button_helper_text_main", + id = "mp_main_button_helper_text_id" + }, + [#f15_local2 + 1] = { + type = "UICharacterWindow", + id = "characterwindow", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + right = -150, + bottom = -150, + height = 256, + width = 154 + } + }, + children = { + { + type = "UITimer", + id = "createSceneTimer", + properties = { + event = "make_scene", + interval = 200 + } + } + } + }, + [#f15_local2 + 1] = { + type = "generic_back_button", + handlers = { + button_secondary = MBh.PopupMenu( "main_choose_exe_popup_menu", false, false ) + } + } + } + if Engine.IsXbox360() then + f15_local2[#f15_local2 + 1] = { + type = "UITimer", + id = "checkRequiredDLCTimer", + properties = { + event = "check_required_dlc", + interval = 1000 + } + } + end + return f15_local2 +end + +function mp_main_menu() + return { + type = "UIElement", + id = "mp_main_menu_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = mpMainMenuCreateHandler, + check_required_dlc = mpMainMenuCheckRequiredDLC + }, + childrenFeeder = MainMenuChildFeeder + } +end + +function main_menu_options_feeder( f17_arg0 ) + local f17_local0 = Engine.IsAliensMode() + local f17_local1 = SvS.IsSvS() + local f17_local2 = false + if Engine.GetDvarInt( "allow_online_squads" ) == 1 or not Engine.IsConsoleGame() then + f17_local2 = true + end + local f17_local3 = Engine.DoWeNeedCompatibilityPacks() + if f17_local1 then + local f17_local4 = f17_local2 + end + local f17_local5 = f17_local4 or not f17_local1 + local f17_local6 = {} + if Engine.AllowOnline() and f17_local5 then + local f17_local7, f17_local8 = nil + if f17_local1 then + f17_local8 = Engine.Localize( "@PLATFORM_PLAY_ONLINE_SQUADS_CAPS" ) + f17_local7 = Engine.Localize( "@LUA_MENU_SQUADS_INTRO" ) + elseif f17_local0 then + f17_local8 = Engine.Localize( "@PLATFORM_PLAY_ONLINE_CAPS" ) + f17_local7 = Engine.Localize( "@LUA_MENU_PLAY_EXTINCTION_ONLINE_DESC" ) + else + f17_local8 = Engine.Localize( "@PLATFORM_PLAY_ONLINE_CAPS" ) + f17_local7 = Engine.Localize( "@PLATFORM_PLAY_ONLINE_DESC" ) + end + f17_local6[#f17_local6 + 1] = { + type = "UIGenericButton", + id = "btn_MPMain_0", + disabled = f17_local3, + disabledFunc = Engine.DoWeNeedCompatibilityPacks, + properties = { + button_text = f17_local8, + button_action_func = xboxLiveButtonAction, + desc_text = f17_local7, + button_over_func = function ( f18_arg0, f18_arg1 ) + PersistentBackground.SetToDefault() + end + } + } + end + if Engine.IsConsoleGame() then + local f17_local7 = "@LUA_MENU_SPLITSCREEN_CAPS" + if f17_local0 then + f17_local7 = "@LUA_MENU_LOCAL_CAPS" + elseif f17_local1 then + f17_local7 = "@LUA_MENU_LOCAL_CAPS" + end + local f17_local8 = #f17_local6 + 1 + local f17_local9 = { + type = "UIGenericButton", + id = "btn_MPMain_1", + disabled = f17_local3, + disabledFunc = Engine.DoWeNeedCompatibilityPacks + } + local f17_local10 = { + button_text = Engine.Localize( f17_local7 ), + button_action_func = splitScreenButtonAction + } + local f17_local11 + if f17_local1 then + f17_local11 = Engine.Localize( "@LUA_MENU_SQUAD_LOCAL_PLAY_DESC" ) + if not f17_local11 then + + else + f17_local10.desc_text = f17_local11 + f17_local10.button_over_func = function ( f19_arg0, f19_arg1 ) + PersistentBackground.SetToDefault() + end + + f17_local9.properties = f17_local10 + f17_local6[f17_local8] = f17_local9 + if not f17_local1 then + f17_local6[#f17_local6 + 1] = { + type = "UIGenericButton", + id = "btn_MPMain_2", + disabled = f17_local3, + disabledFunc = Engine.DoWeNeedCompatibilityPacks, + properties = { + button_text = Engine.Localize( "@PLATFORM_SYSTEM_LINK_CAPS" ), + button_action_func = systemLinkButtonAction, + desc_text = Engine.Localize( "@PLATFORM_SYSTEM_LINK_DESC" ), + button_over_func = function ( f20_arg0, f20_arg1 ) + PersistentBackground.SetToDefault() + end + } + } + end + end + end + f17_local11 = Engine.Localize( "@LUA_MENU_SPLITSCREEN_DESC" ) + end + if not f17_local1 then + f17_local6[#f17_local6 + 1] = { + type = "UIGenericButton", + id = "btn_MPMain_5", + properties = { + button_text = Engine.Localize( "@LUA_MENU_STORE_CAPS" ), + button_action_func = storeButtonAction, + desc_text = Engine.Localize( "@LUA_MENU_STORE_DESC" ), + button_over_func = function ( f21_arg0, f21_arg1 ) + PersistentBackground.SetToDefault() + end + } + } + end + f17_local6[#f17_local6 + 1] = { + type = "UIGenericButton", + id = "btn_MPMain_6", + properties = { + button_text = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ), + button_action_func = optionsButtonAction, + desc_text = Engine.Localize( "@LUA_MENU_OPTIONS_DESC" ), + button_over_func = function ( f22_arg0, f22_arg1 ) + PersistentBackground.SetToDefault() + end + } + } + f17_local6[#f17_local6 + 1] = { + type = "generic_separator", + id = "main_menu_spacer_id" + } + if not Engine.IsCoreMode() then + f17_local6[#f17_local6 + 1] = { + type = "UIGenericButton", + id = "btn_MPMain_7", + properties = { + text = Engine.Localize( "@LUA_MENU_MULTIPLAYER_CAPS" ), + button_action_func = function ( f23_arg0, f23_arg1 ) + Engine.StopMusic( 200 ) + Engine.SwitchToCoreMode() + Engine.PlayMusic( CoD.Music.MainMPMusic ) + Engine.SetActiveMenu( ActiveMenus.None ) + Engine.SetActiveMenu( ActiveMenus.Main ) + end, + button_over_func = function ( f24_arg0, f24_arg1 ) + PersistentBackground.Set( PersistentBackground.Variants.MPBackground ) + end, + desc_text = Engine.Localize( "@PLATFORM_PLAY_ONLINE_DESC" ) + } + } + end + if not SvS.IsSvS() then + f17_local6[#f17_local6 + 1] = { + type = "UIGenericButton", + id = "btn_MPMain_8", + properties = { + button_text = Engine.Localize( "@LUA_MENU_SQUAD_MODE_CAP" ), + button_action_func = function ( f25_arg0, f25_arg1 ) + Engine.StopMusic( 200 ) + Engine.SwitchToSquadVsSquadMode() + Engine.PlayMusic( CoD.Music.MainSquadMusic ) + Engine.SetActiveMenu( ActiveMenus.None ) + Engine.SetActiveMenu( ActiveMenus.Main ) + end, + button_over_func = function ( f26_arg0, f26_arg1 ) + PersistentBackground.Set( PersistentBackground.Variants.SvSBackground ) + end, + desc_text = Engine.Localize( "@LUA_MENU_SVS_MAIN_MENU_DESC" ) + } + } + end + if not Engine.IsAliensMode() and Engine.UnlockedAliens() then + f17_local6[#f17_local6 + 1] = { + type = "UIGenericButton", + id = "btn_MPMain_9", + properties = { + button_text = Engine.Localize( "@LUA_MENU_ALIENS_CAPS" ), + button_action_func = function ( f27_arg0, f27_arg1 ) + Engine.StopMusic( 200 ) + Engine.SwitchToAliensMode() + Engine.PlayMusic( CoD.Music.MainExtinctMusic ) + Engine.SetActiveMenu( ActiveMenus.None ) + Engine.SetActiveMenu( ActiveMenus.Main ) + end, + button_over_func = function ( f28_arg0, f28_arg1 ) + PersistentBackground.Set( PersistentBackground.Variants.AliensBackground ) + end, + desc_text = Engine.Localize( "@LUA_MENU_ALIENS_MAIN_MENU_DESC" ), + additional_handlers = { + menu_create = AddExtinctionGlowBackground + } + } + } + end + f17_local6[#f17_local6 + 1] = { + type = "button_desc_text", + id = "mp_menu_button_description_id", + properties = { + lines = SvS.IsSvS() and 8 or nil + } + } + return f17_local6 +end + +f0_local0 = function () + return { + type = "UIVerticalList", + id = "mp_main_menu_id", + childrenFeeder = main_menu_options_feeder, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + alignment = LUI.Alignment.Top + } + }, + handlers = { + dlc_mount_complete = function ( f30_arg0, f30_arg1 ) + f30_arg0:processEvent( { + name = "menu_refresh" + } ) + end + , + dlc_mount_fail = function ( f31_arg0, f31_arg1 ) + f31_arg0:processEvent( { + name = "menu_refresh" + } ) + end + , + dlc_download_fail = function ( f32_arg0, f32_arg1 ) + f32_arg0:processEvent( { + name = "menu_refresh" + } ) + end + + } + } +end + +function SquadsDescTextFeeder( f33_arg0 ) + local f33_local0 = { + [#f33_local0 + 1] = { + type = "UIText", + id = "squads_desc_text_main", + properties = { + text = Engine.Localize( "LUA_MENU_SQUADS_INTRO" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + left = 0, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } + } + } + } + return f33_local0 +end + +function AddExtinctionGlowBackground( f34_arg0, f34_arg1 ) + local f34_local0 = f34_arg0:getFirstDescendentById( "hlist" ) + local f34_local1 = f34_local0:getChildById( "bgRightCap" ) + if f34_local1 then + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then + f34_local1:registerAnimationState( "focus", { + material = RegisterMaterial( "btn_alien_00a_rtcap_f" ) + } ) + else + f34_local1:registerAnimationState( "focus", { + material = RegisterMaterial( "btn_alien_00a_rtcap_f_pc" ) + } ) + end + local self = LUI.UIImage.new( { + material = RegisterMaterial( "btn_alien_overlay" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -44, + bottom = 16, + left = -208, + right = -48, + alpha = 0 + } ) + self.id = "blood_splat_glow" + self:registerAnimationState( "glow", { + alpha = 0.12 + } ) + self:registerAnimationState( "heavyglow", { + alpha = 0.5 + } ) + self:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "default", + 0 + }, + { + "heavyglow", + 1200 + }, + { + "default", + 1200 + } + } ) ) + self:registerEventHandler( "button_up", MBh.AnimateLoop( { + { + "default", + 0 + }, + { + "glow", + 1200 + }, + { + "default", + 1200 + } + } ) ) + local f34_local3 = MBh.AnimateLoop( { + { + "default", + 1200 + }, + { + "glow", + 1200 + } + } ) + f34_local3( self ) + f34_local1:addElement( self ) + f34_local3 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_alien_overlay_02" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -28, + bottom = 32, + left = -208, + right = -48, + alpha = 0 + } ) + f34_local3.id = "blood_splat_glow_02" + f34_local3:registerAnimationState( "glow", { + alpha = 0.12 + } ) + f34_local3:registerAnimationState( "heavyglow", { + alpha = 0.5 + } ) + f34_local3:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "default", + 0 + }, + { + "heavyglow", + 1800 + }, + { + "default", + 1800 + } + } ) ) + f34_local3:registerEventHandler( "button_up", MBh.AnimateLoop( { + { + "default", + 0 + }, + { + "glow", + 1800 + }, + { + "default", + 1800 + } + } ) ) + local f34_local4 = MBh.AnimateLoop( { + { + "default", + 1800 + }, + { + "glow", + 1800 + } + } ) + f34_local4( f34_local3 ) + f34_local1:addElement( f34_local3 ) + end + local self = f34_local0:getChildById( "bgLeftCap" ) + if self then + self:registerAnimationState( "focus", { + material = RegisterMaterial( "btn_alien_00a_ltcap_f" ) + } ) + end + local f34_local3 = f34_local0:getChildById( "bgMid" ) + if f34_local3 then + f34_local3:registerAnimationState( "focus", { + material = RegisterMaterial( "btn_alien_00a_mid_f" ) + } ) + end +end + +LUI.MenuBuilder.registerDef( "mp_main_menu", mp_main_menu ) +LUI.MenuBuilder.registerDef( "main_mp_menu_options", f0_local0 ) +LUI.FlowManager.RegisterStackPushBehaviour( "mp_main_menu", mpMainMenuPushFunc ) +LockTable( _M ) diff --git a/lui/mp_menus/mpmapsetupmenu.dec.lua b/lui/mp_menus/mpmapsetupmenu.dec.lua new file mode 100644 index 0000000..724719c --- /dev/null +++ b/lui/mp_menus/mpmapsetupmenu.dec.lua @@ -0,0 +1,550 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function MapFeeder( f1_arg0 ) + local f1_local0 = {} + local f1_local1 = Lobby.GetMapFeederCount() + local f1_local2 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mapsetup_menu_main" ) or {} + local f1_local3 = nil + if f1_local2.squadBaseSelect then + f1_local3 = Engine.GetPlayerDataEx( f1_local2.exclusiveControllerIndex, CoD.StatsGroup.Ranked, "squadHQ", "squad_base" ) + end + for f1_local4 = 0, f1_local1 - 1, 1 do + local f1_local7 = nil + local f1_local8 = Lobby.GetMapLoadNameByIndex( f1_local4 ) + local f1_local9 = false + if f1_local2.squadBaseSelect then + f1_local9 = f1_local8 == f1_local3 + end + if f1_local8 == "bonus_map" or f1_local8 == "more_maps" then + f1_local7 = { + type = "UIGenericButton", + id = "mapsetup_rotationmap" .. f1_local4, + properties = { + button_text = GetButtonMapName( f1_local4 ), + button_action_func = MBh.EmitEventToRoot( { + name = "select_map", + idx = f1_local4 + } ), + button_over_func = MBh.EmitEventToRoot( { + name = "update_map", + idx = f1_local4 + } ) + } + } + else + f1_local7 = { + type = "UIGenericButton", + id = "mapsetup_rotationmap" .. f1_local4, + listDefaultFocus = f1_local9, + properties = { + variant = GenericButtonSettings.Variants.Checkbox, + button_text = Lobby.GetMapNameByIndex( f1_local4 ), + button_action_func = MBh.EmitEventToRoot( { + name = "select_map", + idx = f1_local4 + } ), + button_over_func = MBh.EmitEventToRoot( { + name = "update_map", + idx = f1_local4 + } ) + } + } + end + if f1_local4 == 0 and Engine.GetDvarBool( "accessToSubscriberContent" ) then + f1_local0[#f1_local0 + 1] = f1_local7 + end + if Engine.IsAliensMode() and Lobby.GetMapSupportsAliensByIdx( f1_local4 ) then + f1_local0[#f1_local0 + 1] = f1_local7 + end + if not Engine.IsAliensMode() and not Lobby.GetMapSupportsAliensByIdx( f1_local4 ) then + f1_local0[#f1_local0 + 1] = f1_local7 + end + end + return f1_local0 +end + +function MapSetupCreate( f2_arg0, f2_arg1 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) or {} + f2_local0.rotationAllowed = f2_arg0.properties.rotationAllowed + f2_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true, + immediate = true + } ) + f2_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = Engine.Localize( "@LUA_MENU_SELECT" ), + side = "left", + clickable = true, + immediate = true + } ) + f2_arg0:dispatchEventToRoot( { + name = "update_lists", + immediate = true + } ) + UpdateMapRotation( f2_arg0, f2_arg1 ) + UpdateMap( f2_arg0, { + idx = 0 + } ) +end + +function UpdateMapRotation( f3_arg0, f3_arg1 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + if not f3_local0.squadBaseSelect then + local f3_local1 = Lobby.GetMapFeederCount() + for f3_local2 = 0, f3_local1 - 1, 1 do + local f3_local5 = Lobby.GetMapLoadNameByIndex( f3_local2 ) + local f3_local6 = f3_arg0:getFirstDescendentById( "mapsetup_rotationmap" .. f3_local2 ) + if Lobby.IsMapInRotation( f3_local5 ) then + f3_local6:processEvent( { + name = "set_checked", + dispatchChildren = true + } ) + end + end + end +end + +function GetButtonMapName( f4_arg0 ) + local f4_local0 = Lobby.GetMapNameByIndex( f4_arg0 ) + if Engine.MarkLocalized( f4_local0 ) == Engine.Localize( "DLC_MAPSTORE" ) then + f4_local0 = Engine.Localize( "PATCH_MENU_MORE_MAPS" ) + end + return f4_local0 +end + +function UpdateMap( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0:getFirstDescendentById( "mapsetup_mapname" ) + local f5_local1 = f5_arg0:getFirstDescendentById( "mapsetup_mapdesc" ) + local f5_local2 = f5_arg0:getFirstDescendentById( "mapsetup_mapimage" ) + local f5_local3 = f5_arg1.idx + local f5_local4 = Lobby.GetMapDescByIndex( f5_local3 ) + if f5_local0 then + f5_local0:setText( Lobby.GetMapNameByIndex( f5_local3 ) ) + end + if f5_local1 then + f5_local1:setText( Engine.Localize( f5_local4 ) ) + end + f5_arg0:processEvent( { + name = "adjust_desc_text", + dispatchChildren = true, + descText = f5_local4 + } ) + if f5_local2 then + local f5_local5 = Lobby.GetMapLoadNameByIndex( f5_local3 ) + if f5_local5 == "bonus_map" or f5_local5 == "more_maps" then + f5_local2:setImage( RegisterMaterial( "loadscreen_mp_bonusmaps" ) ) + else + f5_local2:setImage( RegisterMaterial( Lobby.GetMapImageByIndex( f5_local3 ) ) ) + end + end +end + +function SelectMap( f6_arg0, f6_arg1 ) + local f6_local0 = Lobby.GetMapLoadNameByIndex( f6_arg1.idx ) + if f6_local0 == "bonus_map" then + if Lobby.GetDLCMapCount() > 0 then + Engine.SetDvarBool( "ui_showDLCMaps", true ) + f6_arg0:dispatchEventToRoot( { + name = "refresh_maps" + } ) + elseif Engine.GetDvarBool( "onlinegame" ) then + LUI.FlowManager.RequestPopupMenu( f6_arg0, "you_dont_have_bonus_maps", true, f6_arg1.controller, nil, nil, nil, nil, false ) + else + LUI.FlowManager.RequestPopupMenu( f6_arg0, "you_dont_have_bonus_maps_offline", true, f6_arg1.controller, nil, nil, nil, nil, false ) + end + elseif f6_local0 == "more_maps" then + if Engine.GetDvarBool( "onlinegame" ) then + LUI.FlowManager.RequestPopupMenu( f6_arg0, "get_more_maps", true, f6_arg1.controller, nil, nil, nil, nil, false ) + else + LUI.FlowManager.RequestPopupMenu( f6_arg0, "get_more_maps_offline", true, f6_arg1.controller, nil, nil, nil, nil, false ) + end + elseif f6_arg0.properties.rotationAllowed and MatchRules.IsUsingCustomMapRotation() then + SelectMap_Rotation( f6_arg0, f6_arg1 ) + else + SelectMap_Single( f6_arg0, f6_arg1 ) + end +end + +function SelectMap_Single( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) or {} + local f7_local1 = f7_arg1.idx + if f7_local1 == nil then + return + end + local f7_local2 = Lobby.GetMapLoadNameByIndex( f7_local1 ) + if f7_local0.squadBaseSelect then + Engine.SetPlayerDataEx( f7_local0.exclusiveControllerIndex, CoD.StatsGroup.Ranked, "squadHQ", "squad_base", f7_local2 ) + else + Engine.SetDvarString( "ui_mapname", f7_local2 ) + end + ExitMenu( f7_arg0, f7_arg1 ) +end + +function SelectMap_Rotation( f8_arg0, f8_arg1 ) + local f8_local0 = Lobby.GetMapLoadNameByIndex( f8_arg1.idx ) + if Lobby.IsMapInRotation( f8_local0 ) then + Lobby.IncludeMapInRotation( f8_local0, false ) + else + Lobby.IncludeMapInRotation( f8_local0, true ) + end + Engine.ExecNow( "xupdatepartystate" ) +end + +function ToggleMultiMap( f9_arg0, f9_arg1 ) + if f9_arg0.properties.rotationAllowed then + Engine.PlaySound( CoD.SFX.MouseClick ) + MatchRules.SetUsingCustomMapRotation( MatchRules.IsUsingCustomMapRotation() ) + f9_arg0:dispatchEventToRoot( { + name = "update_lists" + } ) + end +end + +function UpdateLists( f10_arg0, f10_arg1 ) + local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 ) or {} + if not f10_local0.squadBaseSelect then + local f10_local1 = f10_local0.rotationAllowed + local f10_local2 = MatchRules.IsUsingCustomMapRotation() + end + local f10_local3 = f10_local1 and f10_local2 or false + f10_arg0:processEvent( { + name = "show_checkbox", + showBox = f10_local3, + dispatchChildren = true + } ) + if f10_local3 then + f10_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_RULES_TOGGLE_ROTATION_OFF" ), + side = "left", + clickable = true, + immediate = true + } ) + elseif f10_arg0.properties.rotationAllowed then + f10_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_RULES_TOGGLE_ROTATION_ON" ), + side = "left", + clickable = true, + immediate = true + } ) + end +end + +function RefreshMapList( f11_arg0, f11_arg1 ) + f11_arg0:processEvent( { + name = "refresh_scroll_list", + dispatchChildren = true + } ) + f11_arg0:processEvent( { + name = "update_lists" + } ) + f11_arg0:processEvent( { + name = "gain_focus" + } ) + UpdateMapRotation( f11_arg0, f11_arg1 ) +end + +function ExitMenu( f12_arg0, f12_arg1 ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) or {} + local f12_local1 + if not f12_local0.squadBaseSelect then + f12_local1 = f12_local0.rotationAllowed + if f12_local1 then + f12_local1 = MatchRules.IsUsingCustomMapRotation() + end + else + f12_local1 = false + end + if f12_local1 == false then + Engine.ExecNow( "xupdatepartystate" ) + end + Engine.SetDvarBool( "ui_showDLCMaps", false ) + LUI.FlowManager.RequestLeaveMenu( f12_arg0 ) +end + +function BackButtonFunc( f13_arg0, f13_arg1 ) + if Engine.GetDvarBool( "ui_showDLCMaps" ) then + Engine.SetDvarBool( "ui_showDLCMaps", false ) + f13_arg0:dispatchEventToRoot( { + name = "refresh_maps" + } ) + else + ExitMenu( f13_arg0, f13_arg1 ) + end +end + +function mapsetup_map_vlist() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -50, + top = 0, + bottom = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + } + } +end + +function mapsetup_details_window() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 140, + bottom = 600, + left = 560, + right = 1040 + } + }, + children = { + { + type = "generic_menu_titlebar", + id = "mapsetup_details_title", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = Engine.Localize( "@LUA_MENU_MAP_DETAILS_CAPS" ), + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left, + fill_alpha = 1 + } + }, + { + type = "generic_menu_background_withfade", + id = "mapsetup_details_window_bg", + properties = { + fill_alpha = 1 + } + }, + { + type = "UIImage", + id = "mapsetup_mapimage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "" ), + left = 10, + right = -10, + top = GenericTitleBarDims.TitleBarHeight + 10, + height = 240 + } + } + }, + { + type = "UIText", + id = "mapsetup_mapname", + properties = { + text = "" + }, + states = { + default = { + left = -220, + top = 65, + width = 380, + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "mapsetup_mapdesc", + states = { + default = { + left = -220, + top = 85, + width = 450, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + }, + adjusted = { + top = 105, + height = CoD.TextSettings.NormalFont.Height + } + }, + handlers = { + adjust_desc_text = function ( f16_arg0, f16_arg1 ) + if f16_arg1.descText == "@DLC_MAPS_DESC" then + f16_arg0:animateToState( "adjusted" ) + else + f16_arg0:animateToState( "default" ) + end + end + + } + } + } + } +end + +function mapsetup_menu_main() + return { + type = "UIElement", + id = "mapsetup_root", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_MAP_SELECT_CAPS" ), + rotationAllowed = false + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = MapSetupCreate, + update_map = UpdateMap, + update_lists = UpdateLists, + select_map = SelectMap, + refresh_maps = RefreshMapList + }, + children = { + { + type = "generic_menu_title", + id = "mapsetup_title", + properties = { + menu_title = MBh.Property( "menu_title" ) + } + }, + { + type = "UIScrollingVerticalList", + id = "mapsetup_rptatopmmaplist", + childrenFeeder = MapFeeder, + properties = { + use_arrows = true, + use_scrollbar = false, + bar_width = 20 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 11 + 2 + 60 + } + } + }, + { + type = "mapsetup_details_window", + id = "mapsetup_details_window_id" + }, + { + type = "UIBindButton", + id = "mapsetup_bindbuttons", + handlers = { + button_secondary = BackButtonFunc, + button_alt1 = ToggleMultiMap + } + }, + { + type = "button_helper_text_main", + id = "mapsetup_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + } +end + +function you_dont_have_bonus_maps() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@LUA_MENU_NO_BONUS_MAPS" ), + popup_title = Engine.Localize( "@MENU_NOTICE" ), + yes_action = function ( f19_arg0, f19_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f19_arg0 ) + Sns.OpenStoreMenu( f19_arg1.controller, "map_select_menu" ) + end + + } + } +end + +function get_more_maps() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@LUA_MENU_PURCHASE_MAPS" ), + popup_title = Engine.Localize( "@MENU_NOTICE" ), + yes_action = function ( f21_arg0, f21_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f21_arg0 ) + Sns.OpenStoreMenu( f21_arg1.controller, "map_select_menu" ) + end + + } + } +end + +function you_dont_have_bonus_maps_offline() + return { + type = "generic_confirmation_popup", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_NO_BONUS_MAPS_OFFLINE" ) + } + } +end + +function get_more_maps_offline() + return { + type = "generic_confirmation_popup", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_PURCHASE_MAPS_OFFLINE" ) + } + } +end + +LUI.MenuBuilder.registerDef( "mapsetup_menu_main", mapsetup_menu_main ) +LUI.MenuBuilder.registerDef( "mapsetup_map_vlist", mapsetup_map_vlist ) +LUI.MenuBuilder.registerDef( "mapsetup_details_window", mapsetup_details_window ) +LUI.MenuBuilder.registerDef( "you_dont_have_bonus_maps", you_dont_have_bonus_maps ) +LUI.MenuBuilder.registerDef( "get_more_maps", get_more_maps ) +LUI.MenuBuilder.registerDef( "you_dont_have_bonus_maps_offline", you_dont_have_bonus_maps_offline ) +LUI.MenuBuilder.registerDef( "get_more_maps_offline", get_more_maps_offline ) +LockTable( _M ) diff --git a/lui/mp_menus/mpmemberlist.dec.lua b/lui/mp_menus/mpmemberlist.dec.lua new file mode 100644 index 0000000..9921375 --- /dev/null +++ b/lui/mp_menus/mpmemberlist.dec.lua @@ -0,0 +1,2453 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function UsingSvSPlayercards( f1_arg0 ) + assert( f1_arg0 ~= nil ) + local f1_local0 = SvS.IsSvS() + if f1_local0 then + if SvS.GetCurrentSquadModeInfo() ~= SvS.SquadModes.SquadVsSquad or f1_arg0 == Lobby.MemberListStates.Prelobby then + f1_local0 = false + else + f1_local0 = true + end + end + return f1_local0 +end + +function HideEmptyLobbySlots( f2_arg0 ) + local f2_local0 = UsingSvSPlayercards( f2_arg0 ) + if not f2_local0 then + f2_local0 = SvS.IsSvS() + if f2_local0 then + f2_local0 = SvS.GetCurrentSquadModeInfo() == SvS.SquadModes.SquadAssault + end + end + return f2_local0 +end + +function HandleRefocusMemberList( f3_arg0, f3_arg1 ) + f3_arg0:clearSavedState() + local f3_local0 = f3_arg0:getFirstChild() + while f3_local0 ~= nil do + local f3_local1 = f3_local0.properties + if f3_local1 and f3_local1.isActiveMemberSlot then + if f3_arg1.inFocus then + f3_local0:processEvent( { + name = "gain_focus" + } ) + break + end + LUI.savedMenuStates[f3_arg0.id] = {} + LUI.savedMenuStates[f3_arg0.id][1] = { + id = f3_local0.id, + data = f3_local0.saveData + } + end + f3_local0 = f3_local0:getNextSibling() + end +end + +function HandleLobbyMemberRestoreFocus( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0.properties + if f4_arg0.id == f4_arg1.id then + if f4_local0.isActiveMemberSlot then + f4_arg0:processEvent( { + name = "gain_focus" + } ) + else + local f4_local1 = f4_arg0:getParent() + f4_local1:processEvent( { + name = "refocus_member_list", + inFocus = true + } ) + end + return true + else + return false + end +end + +function LobbyMemberGetLocalPlayerTeam( f5_arg0 ) + local f5_local0 = Engine.GetFirstActiveController() + if Lobby.GetLocalPlayerTeam then + return Lobby.GetLocalPlayerTeam( f5_arg0, f5_local0 ) + else + return Teams.allies + end +end + +function LobbyMemberGetSlot( f6_arg0, f6_arg1 ) + if f6_arg0 == Lobby.MemberListStates.Teams then + local f6_local0 = Teams.allies + local f6_local1 = Teams.axis + local f6_local2 = LobbyMemberGetLocalPlayerTeam( f6_arg0 ) + if f6_local2 == Teams.axis or f6_local2 == Teams.allies then + f6_local0 = f6_local2 + f6_local1 = otherTeamLookup[f6_local2] + end + local f6_local3 = Lobby.GetMemberCount( f6_arg0, f6_local0 ) + local f6_local4 = Lobby.GetMemberCount( f6_arg0, f6_local1 ) + local f6_local5 = Lobby.GetMemberCount( f6_arg0, Teams.spectator ) + if f6_arg1 - 1 < f6_local3 then + return f6_arg1 - 1 + elseif f6_arg1 - 1 < f6_local3 + f6_local4 then + return f6_arg1 - f6_local3 - 1 + elseif f6_arg1 - 1 < f6_local3 + f6_local4 + f6_local5 then + return f6_arg1 - f6_local3 - f6_local4 - 1 + else + return f6_arg1 - f6_local3 - f6_local4 - f6_local5 - 1 + end + else + return f6_arg1 - 1 + end +end + +function LobbyMemberGetTeam( f7_arg0, f7_arg1 ) + if f7_arg0 == Lobby.MemberListStates.Teams then + local f7_local0 = Teams.allies + local f7_local1 = Teams.axis + local f7_local2 = LobbyMemberGetLocalPlayerTeam( f7_arg0 ) + if f7_local2 == Teams.axis or f7_local2 == Teams.allies then + f7_local0 = f7_local2 + f7_local1 = otherTeamLookup[f7_local2] + end + local f7_local3 = Lobby.GetMemberCount( f7_arg0, f7_local0 ) + local f7_local4 = Lobby.GetMemberCount( f7_arg0, f7_local1 ) + local f7_local5 = Lobby.GetMemberCount( f7_arg0, Teams.spectator ) + if f7_arg1 - 1 < f7_local3 then + return f7_local0 + elseif f7_arg1 - 1 < f7_local3 + f7_local4 then + return f7_local1 + elseif f7_arg1 - 1 < f7_local3 + f7_local4 + f7_local5 then + return Teams.spectator + else + return Teams.free + end + else + return Teams.free + end +end + +function HandleLobbyMemberButtonRefresh( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + f8_arg0.properties.memberListState = LobbyMemberListGetState( f8_arg0.properties.memberListState ) + f8_arg0.properties.memberSlot = LobbyMemberGetSlot( f8_arg0.properties.memberListState, f8_arg0.properties.memberIndex ) + f8_arg0.properties.team = LobbyMemberGetTeam( f8_arg0.properties.memberListState, f8_arg0.properties.memberIndex ) + f8_arg0.properties.isActiveMemberSlot = Lobby.IsActiveMemberSlot( f8_arg0.properties.memberIndex - 1 ) + if not f8_local0.selectedMemberUniqueId and f8_arg0.properties.memberIndex == 0 then + f8_local0.selectedMemberUniqueId = GetLobbyMemberUniqueId( f8_arg0.properties.memberListState, f8_arg0.properties.memberSlot, f8_arg0.properties.team ) + end + if SvS.IsSvS() and SvS.GetCurrentSquadModeInfo() == SvS.SquadModes.SquadAssault then + f8_arg0:dispatchEventToParent( { + name = "update_squad_member", + playerElement = f8_arg0, + team = f8_arg0.properties.team, + memberSlot = f8_arg0.properties.memberSlot, + memberListState = f8_arg0.properties.memberListState + } ) + end + local f8_local1 = f8_arg0.properties.isActiveMemberSlot + f8_arg0:processEvent( { + name = "lobby_member_update_ss_prompt", + memberListState = f8_arg0.properties.memberListState, + immediate = true, + isActiveMemberSlot = f8_local1 + } ) + if f8_local1 then + f8_arg0:processEvent( { + name = "lobby_member_update_content", + memberListState = f8_arg0.properties.memberListState, + memberSlot = f8_arg0.properties.memberSlot, + team = f8_arg0.properties.team, + immediate = true + } ) + f8_arg0:processEvent( { + name = "lobby_member_update_bg", + memberListState = f8_arg0.properties.memberListState, + team = f8_arg0.properties.team, + isActiveMemberSlot = f8_local1, + dispatchChildren = true, + immediate = true + } ) + end +end + +function LobbyMemberIsSplitscreenPrompt( f9_arg0, f9_arg1 ) + if UsingSvSPlayercards( f9_arg0 ) then + return false + elseif f9_arg0 == Lobby.MemberListStates.Prelobby and Lobby.IsPrivatePartyHost() then + local f9_local0 = Lobby.GetNonPlayingLocalClientCount() + local f9_local1 = Lobby.GetMemberCount( f9_arg0 ) + if f9_local1 > 0 and f9_local1 < f9_arg1 and f9_arg1 <= f9_local1 + f9_local0 then + return true + end + end + return false +end + +function HandleLobbyMemberButtonIsActive( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0.properties + if not (not f10_local0.isActiveMemberSlot and ((f10_local0.memberListState == Lobby.MemberListStates.Prelobby) or not Lobby.IsSearching() or f10_local0.memberIndex > Lobby.GetMemberCount( f10_local0.memberListState, Teams.free ) or HideEmptyLobbySlots( f10_local0.memberListState ))) or LobbyMemberIsSplitscreenPrompt( f10_local0.memberListState, f10_local0.memberIndex ) then + f10_arg0:animateToState( "default", 0 ) + else + f10_arg0:animateToState( "hidden", 0 ) + end + if f10_local0.isActiveMemberSlot then + f10_arg0:makeFocusable() + if not f10_local0.wasActiveMemberSlot and not f10_local0.isLocalMember then + f10_arg0:dispatchEventToRoot( { + name = "update_double_xp_icon" + } ) + Engine.PlaySound( CoD.SFX.MPLobbyPlayerJoin ) + end + f10_local0.wasActiveMemberSlot = true + else + if f10_local0.isFocused then + f10_arg0:processEvent( { + name = "lose_focus" + } ) + local f10_local1 = f10_arg0:getParent() + f10_local1:processEvent( { + name = "refocus_member_list", + inFocus = true + } ) + else + local f10_local1 = f10_arg0:getParent() + if LUI.savedMenuStates[f10_local1.id] ~= nil then + for f10_local5, f10_local6 in ipairs( LUI.savedMenuStates[f10_local1.id] ) do + if f10_local6.id == f10_arg0.id then + f10_local1:processEvent( { + name = "refocus_member_list", + inFocus = false + } ) + break + end + end + end + end + if f10_local0.wasActiveMemberSlot then + f10_arg0:dispatchEventToRoot( { + name = "update_double_xp_icon" + } ) + Engine.PlaySound( CoD.SFX.MPLobbyPlayerExit ) + f10_local0.wasActiveMemberSlot = false + end + f10_arg0:makeNotFocusable() + end + f10_arg0:dispatchEventToParent( { + name = "update_navigation" + } ) +end + +function LobbyMemberButtonShouldBeDisabled( f11_arg0, f11_arg1, f11_arg2 ) + local f11_local0 = LobbyMemberIsSplitscreenPrompt( f11_arg0, f11_arg1 ) + local f11_local1 = Lobby.IsSearching() + local f11_local2 = f11_arg0 == Lobby.MemberListStates.Prelobby + if HideEmptyLobbySlots( f11_arg0 ) then + return not f11_arg2 + elseif not (f11_arg2 and (f11_local2 or not f11_local1 or f11_arg2)) or f11_local0 then + return true + else + return false + end +end + +function HandleLobbyMemberButtonIsDisabled( f12_arg0, f12_arg1 ) + local f12_local0 = f12_arg0.properties + local f12_local1 = LobbyMemberButtonShouldBeDisabled( f12_local0.memberListState, f12_local0.memberIndex, f12_local0.isActiveMemberSlot ) + if not f12_arg0.disabled and f12_local1 then + f12_arg0:processEvent( { + name = "disable", + immediate = true + } ) + elseif f12_arg0.disabled and not f12_local1 then + f12_arg0:processEvent( { + name = "enable", + immediate = true + } ) + end +end + +function HandleLobbyMemberButtonAction( f13_arg0, f13_arg1 ) + local f13_local0 = { + memberListState = f13_arg0.properties.memberListState, + memberSlot = f13_arg0.properties.memberSlot, + team = f13_arg0.properties.team + } + if f13_arg0.properties.isPublicLobby then + f13_local0.isPublicLobby = true + end + if f13_arg0.properties.isPrivateLobby then + f13_local0.isPrivateLobby = true + end + LUI.FlowManager.RequestPopupMenu( f13_arg0, "player_popup_party", true, f13_arg1.controller, false, f13_local0 ) +end + +function HandleLobbyMemberButtonOver( f14_arg0, f14_arg1 ) + local f14_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f14_arg0 ) + local f14_local1 = f14_arg0.properties + local f14_local2 = LobbyMemberIsBot( f14_local1.memberListState, f14_local1.memberSlot, f14_local1.team ) + if not Engine.IsConsoleGame() then + f14_arg0:dispatchEventToRoot( { + name = "lobby_slide_enable", + dispatchChildren = true + } ) + end + f14_local0.selectedMemberUniqueId = GetLobbyMemberUniqueId( f14_local1.memberListState, f14_local1.memberSlot, f14_local1.team ) + f14_arg0:dispatchEventToRoot( { + name = "lobby_detail_update", + memberListState = f14_local1.memberListState, + memberSlot = f14_local1.memberSlot, + team = f14_local1.team, + isBot = f14_local2, + memberIndex = f14_local1.memberIndex, + dispatchChildren = true, + controller = f14_arg1.controller, + immediate = true + } ) +end + +function HandleLobbyMemberUpdateSplitscreenPrompt( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg0.properties + if LobbyMemberIsSplitscreenPrompt( f15_arg1.memberListState or f15_local0.memberListState, f15_local0.memberIndex ) then + f15_arg0:animateToState( "default", 0 ) + f15_arg0:setText( Lobby.GetNonPlayingLocalClientText( f15_local0.memberIndex - 1 ) ) + else + f15_arg0:animateToState( "hidden", 0 ) + end +end + +function HandleLobbyMemberUpdateHostIconProperties( f16_arg0, f16_arg1 ) + f16_arg0.properties.memberListState = f16_arg1.memberListState + f16_arg0.properties.memberSlot = f16_arg1.memberSlot + f16_arg0.properties.team = f16_arg1.team +end + +function HandleLobbyMemberShowHostIcon( f17_arg0, f17_arg1 ) + local f17_local0 = f17_arg0.properties + if Lobby.ShowMemberPrivatePartyHostIcon( f17_local0.memberListState, f17_local0.memberSlot, f17_local0.team ) then + f17_arg0:animateToState( "shown", 0 ) + else + f17_arg0:animateToState( "default", 0 ) + end +end + +function HandleLobbyMemberUpdateEliteIcon( f18_arg0, f18_arg1 ) + local f18_local0 = f18_arg0.properties + if ShouldShowEliteIcon( f18_local0.memberListState, f18_local0.memberSlot, f18_local0.team ) then + f18_arg0:animateToState( "visible", 0 ) + else + f18_arg0:animateToState( "default", 0 ) + end +end + +function HandleLobbyMemberUpdateEliteIconProperties( f19_arg0, f19_arg1 ) + f19_arg0.properties.memberListState = f19_arg1.memberListState + f19_arg0.properties.memberSlot = f19_arg1.memberSlot + f19_arg0.properties.team = f19_arg1.team +end + +function HandleLobbyMemberUpdateRankVisibility( f20_arg0, f20_arg1 ) + local f20_local0 = f20_arg0.properties + local f20_local1 = Lobby.ShowMemberInfo( f20_local0.memberListState, f20_local0.memberSlot, f20_local0.team ) + if f20_local1 then + f20_local1 = not LobbyMemberIsBot( f20_local0.memberListState, f20_local0.memberSlot, f20_local0.team ) + end + if not f20_local1 then + f20_arg0:animateToState( "hidden", 0 ) + elseif f20_local0.isFocused then + f20_arg0:animateToState( "highlighted", 0 ) + else + f20_arg0:animateToState( "default", 0 ) + end +end + +function HandleLobbyMemberUpdateRank( f21_arg0, f21_arg1 ) + local f21_local0 = f21_arg0.properties + local f21_local1 = nil + if Engine.IsAliensMode() then + f21_arg0:setText( Rank.GetRankDisplay( Lobby.GetMemberAlienRank( f21_local0.memberListState, f21_local0.memberSlot, f21_local0.team ), CoD.PlayMode.Aliens ) ) + else + f21_arg0:setText( Rank.GetRankDisplay( Lobby.GetMemberRank( f21_local0.memberListState, f21_local0.memberSlot, f21_local0.team ) ) ) + end +end + +function HandleLobbyMemberUpdateRankProperties( f22_arg0, f22_arg1 ) + f22_arg0.properties.memberListState = f22_arg1.memberListState + f22_arg0.properties.memberSlot = f22_arg1.memberSlot + f22_arg0.properties.team = f22_arg1.team +end + +f0_local0 = function ( f23_arg0, f23_arg1, f23_arg2 ) + return Lobby.ShowMemberInfo( f23_arg0, f23_arg1, f23_arg2 ) and not LobbyMemberIsBot( f23_arg0, f23_arg1, f23_arg2 ) +end + +function HandleLobbyMemberUpdateRankIcon( f24_arg0, f24_arg1 ) + local f24_local0 = f24_arg0.properties + local f24_local1, f24_local2 = nil + if Engine.IsAliensMode() then + f24_local2 = Lobby.GetMemberAlienRank( f24_local0.memberListState, f24_local0.memberSlot, f24_local0.team ) + f24_local1 = Lobby.GetMemberAlienPrestigeLevel( f24_local0.memberListState, f24_local0.memberSlot, f24_local0.team ) + else + f24_local2 = Lobby.GetMemberRank( f24_local0.memberListState, f24_local0.memberSlot, f24_local0.team ) + f24_local1 = Lobby.GetMemberPrestigeLevel( f24_local0.memberListState, f24_local0.memberSlot, f24_local0.team ) + end + f24_arg0:setImage( RegisterMaterial( Rank.GetRankIcon( f24_local2, f24_local1, Engine.GetCurrentCoDPlayMode() ) ) ) + if f0_local0( f24_local0.memberListState, f24_local0.memberSlot, f24_local0.team ) then + f24_arg0:animateToState( "default", 0 ) + else + f24_arg0:animateToState( "hidden", 0 ) + end +end + +function HandleLobbyMemberUpdateRankIconProperties( f25_arg0, f25_arg1 ) + f25_arg0.properties.memberListState = f25_arg1.memberListState + f25_arg0.properties.memberSlot = f25_arg1.memberSlot + f25_arg0.properties.team = f25_arg1.team +end + +function HandleLobbyMemberUpdateBotDifficultyIcon( f26_arg0, f26_arg1 ) + local f26_local0 = f26_arg0.properties + local f26_local1 = Lobby.GetMemberBotDifficulty( f26_local0.memberListState, f26_local0.memberSlot, f26_local0.team ) + if LobbyMemberIsBot( f26_local0.memberListState, f26_local0.memberSlot, f26_local0.team ) then + f26_arg0:animateToState( "default", 0 ) + else + f26_arg0:animateToState( "hidden", 0 ) + end +end + +function HandleLobbyMemberUpdateBotDifficultyIconProperties( f27_arg0, f27_arg1 ) + f27_arg0.properties.memberListState = f27_arg1.memberListState + f27_arg0.properties.memberSlot = f27_arg1.memberSlot + f27_arg0.properties.team = f27_arg1.team +end + +function HandleLobbyMemberUpdateClantag( f28_arg0, f28_arg1 ) + local f28_local0 = f28_arg0.properties + if LobbyMemberIsBot( f28_local0.memberListState, f28_local0.memberSlot, f28_local0.team ) then + f28_arg0:setText( "BOT" ) + if f28_local0.isFocused then + f28_arg0:animateToState( "highlighted", 0 ) + else + f28_arg0:animateToState( "default", 0 ) + end + elseif Lobby.HasMemberClanTag( f28_local0.memberListState, f28_local0.memberSlot, f28_local0.team ) then + f28_arg0:setText( Lobby.GetMemberClanTag( f28_local0.memberListState, f28_local0.memberSlot, f28_local0.team ) ) + if f28_local0.isFocused then + f28_arg0:animateToState( "highlighted", 0 ) + else + f28_arg0:animateToState( "default", 0 ) + end + else + f28_arg0:animateToState( "hidden", 0 ) + end +end + +function HandleLobbyMemberUpdateClantagProperties( f29_arg0, f29_arg1 ) + f29_arg0.properties.memberListState = f29_arg1.memberListState + f29_arg0.properties.memberSlot = f29_arg1.memberSlot + f29_arg0.properties.team = f29_arg1.team +end + +function GetReadyUpIndicatorStateString( f30_arg0, f30_arg1, f30_arg2 ) + local f30_local0 = "hidden" + if Lobby.UsingReadyUpFeature() and not LobbyMemberIsBot( f30_arg0, f30_arg1, f30_arg2 ) then + if (Lobby.GetMemberReadyUpFlag( f30_arg0, f30_arg1, f30_arg2 ) or false) == true then + f30_local0 = "ready" + else + f30_local0 = "notready" + end + end + return f30_local0 +end + +function HandleLobbyMemberUpdateReadyUpFlag( f31_arg0, f31_arg1 ) + local f31_local0 = f31_arg0.properties + f31_arg0:animateToState( GetReadyUpIndicatorStateString( f31_local0.memberListState, f31_local0.memberSlot, f31_local0.team ), 0 ) +end + +function HandleLobbyMemberUpdateReadyUpFlagProperties( f32_arg0, f32_arg1 ) + f32_arg0.properties.memberListState = f32_arg1.memberListState + f32_arg0.properties.memberSlot = f32_arg1.memberSlot + f32_arg0.properties.team = f32_arg1.team +end + +function HandleLobbyMemberUpdateGamertag( f33_arg0, f33_arg1 ) + local f33_local0 = f33_arg0.properties + f33_arg0:setText( Lobby.GetMemberName( f33_local0.memberListState, f33_local0.memberSlot, f33_local0.team ) ) +end + +function HandleLobbyMemberUpdateGamertagColor( f34_arg0, f34_arg1 ) + local f34_local0 = f34_arg0.properties + if f34_local0.isFocused then + f34_arg0:animateToState( "highlighted", 0 ) + elseif LobbyMemberIsBot( f34_local0.memberListState, f34_local0.memberSlot, f34_local0.team ) then + f34_arg0:animateToState( "default", 0 ) + else + local f34_local1 = Lobby.IsMemberALocalPlayer( f34_local0.memberListState, f34_local0.memberSlot, f34_local0.team ) + local f34_local2 = Lobby.IsMemberInPrivateParty( f34_local0.memberListState, f34_local0.memberSlot, f34_local0.team ) + if f34_local1 then + f34_arg0:animateToState( "local", 0 ) + elseif f34_local2 then + f34_arg0:animateToState( "party", 0 ) + else + f34_arg0:animateToState( "default", 0 ) + end + end +end + +f0_local1 = function ( f35_arg0, f35_arg1, f35_arg2 ) + local f35_local0 + if f35_arg0 ~= Lobby.MemberListStates.Prelobby then + f35_local0 = Lobby.ShowMemberInfo( f35_arg0, f35_arg1, f35_arg2 ) + else + f35_local0 = false + end + return f35_local0 +end + +function HandleLobbyMemberUpdateScoreVisibility( f36_arg0, f36_arg1 ) + local f36_local0 = f36_arg0.properties + if not f0_local1( f36_local0.memberListState, f36_local0.memberSlot, f36_local0.team ) or Engine.IsAliensMode() then + f36_arg0:animateToState( "hidden", 0 ) + elseif f36_local0.isFocused then + f36_arg0:animateToState( "highlighted", 0 ) + else + f36_arg0:animateToState( "default", 0 ) + end +end + +function HandleLobbyMemberUpdateScore( f37_arg0, f37_arg1 ) + local f37_local0 = f37_arg0.properties + f37_arg0:setText( Lobby.GetMemberStat( f37_local0.memberListState, f37_local0.memberSlot, f37_local0.team, Lobby.MemberStatTypes.Score ) or "" ) +end + +function HandleLobbyMemberUpdateScoreProperties( f38_arg0, f38_arg1 ) + f38_arg0.properties.memberListState = f38_arg1.memberListState + f38_arg0.properties.memberSlot = f38_arg1.memberSlot + f38_arg0.properties.team = f38_arg1.team +end + +function HandleLobbyMemberUpdateSetFocused( f39_arg0, f39_arg1 ) + f39_arg0.properties.isFocused = true +end + +function HandleLobbyMemberUpdateSetNotFocused( f40_arg0, f40_arg1 ) + f40_arg0.properties.isFocused = false +end + +function HandleLobbyMemberUpdateGamertagProperties( f41_arg0, f41_arg1 ) + f41_arg0.properties.memberListState = f41_arg1.memberListState + f41_arg0.properties.memberSlot = f41_arg1.memberSlot + f41_arg0.properties.team = f41_arg1.team +end + +function buildMemberButtonRank( f42_arg0, f42_arg1, f42_arg2, f42_arg3 ) + local self = LUI.UIText.new() + self.id = "member_button_rank_text_id" + self.properties = { + memberListState = f42_arg0, + memberSlot = f42_arg1, + team = f42_arg2 + } + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -1 * CoD.TextSettings.SmallFont.Height * 0.5, + bottom = CoD.TextSettings.SmallFont.Height * 0.5, + left = 0, + right = 32, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerAnimationState( "highlighted", { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } ) + self:animateToState( "default" ) + if not f0_local0( f42_arg0, f42_arg1, f42_arg2 ) then + self:animateToState( "hidden", 0 ) + end + self:setText( f42_arg3 ) + self:registerEventHandler( "button_over", MBh.DoMultiple( { + HandleLobbyMemberUpdateSetFocused, + HandleLobbyMemberUpdateRankVisibility + } ) ) + self:registerEventHandler( "button_up", MBh.DoMultiple( { + HandleLobbyMemberUpdateSetNotFocused, + HandleLobbyMemberUpdateRankVisibility + } ) ) + self:registerEventHandler( "lobby_member_update_content", MBh.DoMultiple( { + HandleLobbyMemberUpdateRankProperties, + HandleLobbyMemberUpdateRank, + HandleLobbyMemberUpdateRankVisibility + } ) ) + return self +end + +function buildMemberButtonRankIcon( f43_arg0, f43_arg1, f43_arg2, f43_arg3 ) + local self = LUI.UIImage.new() + self.id = "member_button_rank_icon_id" + self.properties = { + memberListState = f43_arg0, + memberSlot = f43_arg1, + team = f43_arg2 + } + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 32, + right = 58, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + self:setImage( f43_arg3 ) + local f43_local1 = Lobby.ShowMemberInfo( f43_arg0, f43_arg1, f43_arg2 ) + if f43_local1 then + f43_local1 = not LobbyMemberIsBot( f43_arg0, f43_arg1, f43_arg2 ) + end + if not f43_local1 then + self:animateToState( "hidden", 0 ) + end + self:registerEventHandler( "lobby_member_update_content", MBh.DoMultiple( { + HandleLobbyMemberUpdateRankIconProperties, + HandleLobbyMemberUpdateRankIcon + } ) ) + return self +end + +function buildMemberButtonBotDifficultyIcon( f44_arg0, f44_arg1, f44_arg2, f44_arg3 ) + local self = LUI.UIImage.new() + self.id = "member_button_bot_difficulty_icon_id" + self.properties = { + memberListState = f44_arg0, + memberSlot = f44_arg1, + team = f44_arg2 + } + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 5, + bottom = -5, + left = 0, + right = 48, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + self:setImage( f44_arg3 ) + if not LobbyMemberIsBot( f44_arg0, f44_arg1, f44_arg2 ) then + self:animateToState( "hidden", 0 ) + end + self:registerEventHandler( "lobby_member_update_content", MBh.DoMultiple( { + HandleLobbyMemberUpdateBotDifficultyIconProperties, + HandleLobbyMemberUpdateBotDifficultyIcon + } ) ) + return self +end + +function buildMemberButtonRankElement( f45_arg0, f45_arg1, f45_arg2, f45_arg3, f45_arg4, f45_arg5, f45_arg6 ) + local self = LUI.UIElement.new() + self.id = "member_button_rank_element_id" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 48, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + if f45_arg6 and not Engine.IsAliensMode() then + self:animateToState( "hidden" ) + end + self:addElement( buildMemberButtonRank( f45_arg0, f45_arg1, f45_arg2, f45_arg3 ) ) + self:addElement( buildMemberButtonRankIcon( f45_arg0, f45_arg1, f45_arg2, f45_arg4 ) ) + self:addElement( buildMemberButtonBotDifficultyIcon( f45_arg0, f45_arg1, f45_arg2, f45_arg5 ) ) + return self +end + +function buildMemberButtonClantag( f46_arg0, f46_arg1, f46_arg2, f46_arg3, f46_arg4 ) + local self = LUI.UIText.new() + self.id = "member_button_clantag_id" + self.properties = { + memberListState = f46_arg0, + memberSlot = f46_arg1, + team = f46_arg2 + } + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -1 * CoD.TextSettings.SmallFont.Height * 0.5, + bottom = CoD.TextSettings.SmallFont.Height * 0.5, + left = 60, + right = 135, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 1, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerAnimationState( "highlighted", { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + local f46_local1 = LobbyMemberIsBot( f46_arg0, f46_arg1, f46_arg2 ) + if not (Lobby.ShowMemberInfo( f46_arg0, f46_arg1, f46_arg2 ) or f46_local1) or not f46_arg3 then + self:animateToState( "hidden", 0 ) + end + if f46_local1 then + self:setText( "BOT" ) + else + self:setText( f46_arg4 ) + end + self:registerEventHandler( "button_over", MBh.DoMultiple( { + HandleLobbyMemberUpdateSetFocused, + HandleLobbyMemberUpdateClantag + } ) ) + self:registerEventHandler( "button_up", MBh.DoMultiple( { + HandleLobbyMemberUpdateSetNotFocused, + HandleLobbyMemberUpdateClantag + } ) ) + self:registerEventHandler( "lobby_member_update_content", MBh.DoMultiple( { + HandleLobbyMemberUpdateClantagProperties, + HandleLobbyMemberUpdateClantag + } ) ) + return self +end + +function buildMemberButtonReadyUpIndicator( f47_arg0, f47_arg1, f47_arg2, f47_arg3 ) + local f47_local0 = -75 + local f47_local1 = 6 + local f47_local2 = 16 + local f47_local3 = 16 + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f47_local1, + bottom = f47_local1 + f47_local3, + left = f47_local0, + right = f47_local0 + f47_local2 + } ) + self:animateToState( "default", 0 ) + local f47_local5 = GetReadyUpIndicatorStateString( f47_arg0, f47_arg1, f47_arg2 ) + local f47_local6 = LUI.UIImage.new() + f47_local6.id = "member_button_readyupindicatorframe_id" + f47_local6.properties = { + memberListState = f47_arg0, + memberSlot = f47_arg1, + team = f47_arg2 + } + f47_local6:registerAnimationState( "ready", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Center, + material = RegisterMaterial( "box_empty" ) + } ) + f47_local6:registerAnimationState( "notready", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Center, + material = RegisterMaterial( "box_empty" ) + } ) + f47_local6:registerAnimationState( "hidden", { + alpha = 0 + } ) + f47_local6:animateToState( f47_local5, 0 ) + f47_local6:registerEventHandler( "lobby_member_update_content", MBh.DoMultiple( { + HandleLobbyMemberUpdateReadyUpFlagProperties, + HandleLobbyMemberUpdateReadyUpFlag + } ) ) + self:addElement( f47_local6 ) + local f47_local7 = LUI.UIImage.new() + f47_local7.id = "member_button_readyupindicatorcenter_id" + f47_local7.properties = { + memberListState = f47_arg0, + memberSlot = f47_arg1, + team = f47_arg2 + } + f47_local7:registerAnimationState( "ready", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 4, + bottom = -4, + left = 4, + right = -4, + red = 1, + green = 0.24, + blue = 0.04, + alpha = 0.85, + alignment = LUI.Alignment.Center, + material = RegisterMaterial( "white" ) + } ) + f47_local7:registerAnimationState( "notready", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 4, + bottom = -4, + left = 4, + right = -4, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 0, + alignment = LUI.Alignment.Center + } ) + f47_local7:registerAnimationState( "hidden", { + alpha = 0 + } ) + f47_local7:animateToState( f47_local5, 0 ) + f47_local7:registerEventHandler( "lobby_member_update_content", MBh.DoMultiple( { + HandleLobbyMemberUpdateReadyUpFlagProperties, + HandleLobbyMemberUpdateReadyUpFlag + } ) ) + self:addElement( f47_local7 ) + return self +end + +function buildMemberButtonGamertag( f48_arg0, f48_arg1, f48_arg2, f48_arg3 ) + local self = LUI.UIText.new() + self.id = "member_button_gamertag_id" + self.properties = { + memberListState = f48_arg0, + memberSlot = f48_arg1, + team = f48_arg2, + isFocused = false + } + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -1 * CoD.TextSettings.SmallFont.Height * 0.5, + bottom = CoD.TextSettings.SmallFont.Height * 0.5, + left = 145, + right = 445, + font = CoD.TextSettings.SmallFont.Font, + red = 1, + green = 1, + blue = 1 + } ) + self:registerAnimationState( "local", { + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b + } ) + self:registerAnimationState( "party", { + red = Lobby.Swatch.party_member.r, + green = Lobby.Swatch.party_member.g, + blue = Lobby.Swatch.party_member.b + } ) + self:registerAnimationState( "highlighted", { + red = 0, + green = 0, + blue = 0 + } ) + self:animateToState( "default", 0 ) + if not LobbyMemberIsBot( f48_arg0, f48_arg1, f48_arg2 ) then + local f48_local1 = Lobby.IsMemberALocalPlayer( f48_arg0, f48_arg1, f48_arg2 ) + local f48_local2 = Lobby.IsMemberInPrivateParty( f48_arg0, f48_arg1, f48_arg2 ) + if f48_local1 then + self:animateToState( "local", 0 ) + elseif f48_local2 then + self:animateToState( "party", 0 ) + end + end + self:setText( f48_arg3 ) + self:registerEventHandler( "lobby_member_update_content", MBh.DoMultiple( { + HandleLobbyMemberUpdateGamertagProperties, + HandleLobbyMemberUpdateGamertag, + HandleLobbyMemberUpdateGamertagColor + } ) ) + self:registerEventHandler( "button_over", MBh.DoMultiple( { + HandleLobbyMemberUpdateSetFocused, + HandleLobbyMemberUpdateGamertagColor + } ) ) + self:registerEventHandler( "button_up", MBh.DoMultiple( { + HandleLobbyMemberUpdateSetNotFocused, + HandleLobbyMemberUpdateGamertagColor + } ) ) + return self +end + +function buildMemberButtonScore( f49_arg0, f49_arg1, f49_arg2, f49_arg3 ) + local self = LUI.UIText.new() + self.id = "member_button_score_id" + self.properties = { + memberListState = f49_arg0, + memberSlot = f49_arg1, + team = f49_arg2 + } + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -1 * CoD.TextSettings.SmallFont.Height * 0.5, + bottom = CoD.TextSettings.SmallFont.Height * 0.5, + left = 460, + right = 540, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Right, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerAnimationState( "highlighted", { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } ) + self:animateToState( "default" ) + if not f0_local1( f49_arg0, f49_arg1, f49_arg2 ) then + self:animateToState( "hidden" ) + end + self:setText( f49_arg3 ) + self:registerEventHandler( "button_over", MBh.DoMultiple( { + HandleLobbyMemberUpdateSetFocused, + HandleLobbyMemberUpdateScoreVisibility + } ) ) + self:registerEventHandler( "button_up", MBh.DoMultiple( { + HandleLobbyMemberUpdateSetNotFocused, + HandleLobbyMemberUpdateScoreVisibility + } ) ) + self:registerEventHandler( "lobby_member_update_content", MBh.DoMultiple( { + HandleLobbyMemberUpdateScoreProperties, + HandleLobbyMemberUpdateScore, + HandleLobbyMemberUpdateScoreVisibility + } ) ) + return self +end + +function buildMemberButtonContent( f50_arg0, f50_arg1, f50_arg2, f50_arg3, f50_arg4, f50_arg5, f50_arg6, f50_arg7, f50_arg8, f50_arg9, f50_arg10, f50_arg11 ) + local self = LUI.UIElement.new() + self.id = "member_button_content_id" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1, + spacing = 3 + } ) + self:registerAnimationState( "glow", { + alpha = 0.65 + } ) + self:registerAnimationState( "disabled", { + alpha = 0 + } ) + self:animateToState( "default" ) + self:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled", 0 ) ) + self:registerEventHandler( "button_up", MBh.AnimateToState( "default", 0 ) ) + self:registerEventHandler( "button_over", MBh.AnimateToState( "default", 0 ) ) + self:addElement( buildMemberButtonRankElement( f50_arg0, f50_arg1, f50_arg2, f50_arg3, f50_arg4, f50_arg5, f50_arg11 ) ) + if Engine.IsAliensMode() then + self:addElement( buildMemberButtonReadyUpIndicator( f50_arg0, f50_arg1, f50_arg2, f50_arg10 ) ) + end + self:addElement( buildMemberButtonClantag( f50_arg0, f50_arg1, f50_arg2, f50_arg6, f50_arg7 ) ) + self:addElement( buildMemberButtonGamertag( f50_arg0, f50_arg1, f50_arg2, f50_arg8 ) ) + self:addElement( buildMemberButtonScore( f50_arg0, f50_arg1, f50_arg2, f50_arg9 ) ) + return self +end + +function buildMemberButtonTeamBorder( f51_arg0, f51_arg1, f51_arg2, f51_arg3, f51_arg4 ) + local self = LUI.UIImage.new() + self.properties = { + memberListState = f51_arg0, + team = f51_arg2, + isActiveMemberSlot = f51_arg3 + } + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( f51_arg4 ), + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + self:registerAnimationState( "team_friendly", { + red = Lobby.Swatch.allies.r, + green = Lobby.Swatch.allies.g, + blue = Lobby.Swatch.allies.b, + alpha = 1 + } ) + self:registerAnimationState( "team_enemy", { + red = Lobby.Swatch.axis.r, + green = Lobby.Swatch.axis.g, + blue = Lobby.Swatch.axis.b, + alpha = 1 + } ) + self:animateToState( "default", 0 ) + local f51_local1 = LobbyMemberGetLocalPlayerTeam( f51_arg0 ) + if f51_arg0 == Lobby.MemberListStates.Teams and f51_arg2 == otherTeamLookup[f51_local1] then + self:animateToState( "team_enemy", 0 ) + elseif f51_arg0 == Lobby.MemberListStates.Teams and f51_arg2 == f51_local1 then + self:animateToState( "team_friendly", 0 ) + end + self:registerEventHandler( "button_disable", MBh.AnimateToState( "default", 0 ) ) + self:registerEventHandler( "button_up", HandleLobbyMemberSetBackgroundBorder ) + self:registerEventHandler( "lobby_member_update_bg", MBh.DoMultiple( { + HandleLobbyMemberUpdateBackgroundProperties, + HandleLobbyMemberSetBackgroundBorder + } ) ) + return self +end + +function buildMemberButtonHilite( f52_arg0 ) + local self = LUI.UIImage.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( f52_arg0 ), + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + self:registerAnimationState( "fade", { + alpha = 0.7 + } ) + self:animateToState( "default", 0 ) + local f52_local1 = MBh.AnimateLoop( { + { + "fade", + 1200, + true, + true + }, + { + "default", + 1200, + true, + true + } + } ) + f52_local1( self ) + return self +end + +f0_local2 = function ( f53_arg0, f53_arg1 ) + local f53_local0 = f53_arg0:getChildById( f53_arg1 ) + if f53_local0 then + f53_local0:close() + end +end + +local f0_local3 = function ( f54_arg0, f54_arg1, f54_arg2, f54_arg3 ) + if f54_arg0:getChildById( f54_arg2 ) then + return + end + local f54_local0 = f54_arg0:getChildById( f54_arg1 ) + local f54_local1 = buildMemberButtonHilite( f54_arg3 ) + f54_local1.id = f54_arg2 + if f54_local0 then + LUI.UIElement.addElementAfter( f54_local1, f54_local0 ) + else + f54_arg0:addElement( f54_local1 ) + end +end + +function HandleLobbyMemberMidButtonUp( f55_arg0, f55_arg1 ) + f0_local2( f55_arg0, "member_button_mid_bg_hilite_id" ) +end + +function HandleLobbyMemberMidButtonOver( f56_arg0, f56_arg1 ) + f0_local3( f56_arg0, "member_button_mid_bg_id", "member_button_mid_bg_hilite_id", Engine.IsAliensMode() and "box_alien_lobby_name_mid_f" or "box_lobby_name_f_mid" ) +end + +function HandleLobbyMemberLeftButtonUp( f57_arg0, f57_arg1 ) + f0_local2( f57_arg0, "member_button_lt_bg_hilite_id" ) +end + +function HandleLobbyMemberLeftButtonOver( f58_arg0, f58_arg1 ) + f0_local3( f58_arg0, "member_button_lt_bg_id", "member_button_lt_bg_hilite_id", Engine.IsAliensMode() and "box_alien_lobby_name_lt_f" or "box_lobby_name_f_lt" ) +end + +function HandleLobbyMemberRightButtonUp( f59_arg0, f59_arg1 ) + f0_local2( f59_arg0, "member_button_rt_bg_hilite_id" ) +end + +function HandleLobbyMemberRightButtonOver( f60_arg0, f60_arg1 ) + f0_local3( f60_arg0, "member_button_rt_bg_id", "member_button_rt_bg_hilite_id", Engine.IsAliensMode() and "box_alien_lobby_name_rt_f" or "box_lobby_name_f_rt" ) +end + +function HandleLobbyMemberSetBackground( f61_arg0, f61_arg1 ) + if f61_arg0.properties.isActiveMemberSlot then + f61_arg0:animateToState( "default", 0 ) + else + f61_arg0:animateToState( "disabled", 0 ) + end +end + +function HandleLobbyMemberSetBackgroundBorder( f62_arg0, f62_arg1 ) + local f62_local0 = f62_arg0.properties + local f62_local1 = LobbyMemberGetLocalPlayerTeam( f62_local0.memberListState ) + if f62_local0.memberListState == Lobby.MemberListStates.Teams and f62_local0.team == otherTeamLookup[f62_local1] then + f62_arg0:animateToState( "team_enemy", 0 ) + elseif f62_local0.memberListState == Lobby.MemberListStates.Teams and f62_local0.team == f62_local1 then + f62_arg0:animateToState( "team_friendly", 0 ) + else + f62_arg0:animateToState( "default", 0 ) + end +end + +function HandleLobbyMemberUpdateBackgroundProperties( f63_arg0, f63_arg1 ) + f63_arg0.properties.memberListState = f63_arg1.memberListState + f63_arg0.properties.team = f63_arg1.team + f63_arg0.properties.isActiveMemberSlot = f63_arg1.isActiveMemberSlot +end + +function HandleUpdatePerkIcon( f64_arg0, f64_arg1, f64_arg2, f64_arg3 ) + local f64_local0 = LUI.mp_menus.Aliens + local f64_local1 = Lobby.GetMemberPerk( f64_arg1.memberSlot, f64_arg2 ) + if f64_local1 then + local f64_local2 = f64_local0.GetFieldForPerk( f64_local1, f64_local0.AlienPerks.Cols.Icon ) + if f64_local2 and f64_local2 ~= "" then + f64_arg0:setImage( RegisterMaterial( f64_local2 ) ) + if f64_arg3 and Engine.InLobby() and LUI.mp_menus.Aliens.IsChaosEnabled() then + f64_arg0:animateToState( "collapsed" ) + else + f64_arg0:animateToState( "visible" ) + end + else + f64_arg0:animateToState( "default" ) + end + else + f64_arg0:animateToState( "default" ) + end +end + +function HandleUpdateAbilityIcon( f65_arg0, f65_arg1, f65_arg2, f65_arg3 ) + local f65_local0 = LUI.mp_menus.Aliens + local f65_local1 = Lobby.GetMemberAbility( f65_arg1.memberSlot, f65_arg2 ) + local f65_local2 = LUI.mp_menus.Aliens.IsChaosEnabled() + if f65_local1 then + local f65_local3 = f65_local0.GetFieldForAbility( f65_local1, f65_local0.AlienAbilities.Cols.Icon ) + if f65_local3 and f65_local3 ~= "" then + if f65_local2 and f65_local3 == "alien_icon_nerf_9" and f65_arg2 == f65_local0.AlienAbilities.Left then + f65_local3 = "alien_icon_manned_turret" + elseif f65_local2 and f65_local3 == "alien_icon_nerf_9" and f65_arg2 == f65_local0.AlienAbilities.Right then + f65_local3 = "alien_icon_ims" + end + f65_arg0:setImage( RegisterMaterial( f65_local3 ) ) + if f65_arg3 and Engine.InLobby() and LUI.mp_menus.Aliens.IsChaosEnabled() then + f65_arg0:animateToState( "collapsed" ) + else + f65_arg0:animateToState( "visible" ) + end + else + f65_arg0:animateToState( "default" ) + end + else + f65_arg0:animateToState( "default" ) + end +end + +function HandleLobbyMemberUpdateSplitscreenPromptAliens( f66_arg0, f66_arg1 ) + local f66_local0 = f66_arg0.properties + if LobbyMemberIsSplitscreenPrompt( f66_arg1.memberListState or f66_local0.memberListState, f66_local0.memberIndex ) or f66_arg1.isActiveMemberSlot == false then + f66_arg0:animateToState( "default", 0 ) + else + f66_arg0:animateToState( "visible", 0 ) + end +end + +function DispatchSvSPlayercardUpdate( f67_arg0, f67_arg1 ) + if not UsingSvSPlayercards( f67_arg0.properties.memberListState ) then + return + end + local f67_local0 = f67_arg0:getParent() + if f67_local0 then + f67_local0:processEvent( { + name = "update_svs_playercards", + controller = f67_arg1.controller + } ) + end +end + +function UpdateSvSPlayercard( f68_arg0, f68_arg1 ) + if f68_arg0.properties.memberElement.properties.isActiveMemberSlot then + f68_arg0:animateToState( "active", 0 ) + local f68_local0 = f68_arg0.properties.memberElement + local f68_local1 = f68_local0.properties.memberListState + local f68_local2 = f68_local0.properties.memberSlot + local f68_local3 = f68_local0.properties.team + local f68_local4 = Lobby.GetMemberName( f68_local1, f68_local2, f68_local3 ) or "" + local f68_local5 = Lobby.GetMemberRank( f68_local1, f68_local2, f68_local3 ) or 0 + local f68_local6 = Lobby.GetMemberPrestigeLevel( f68_local1, f68_local2, f68_local3 ) or 0 + local f68_local7 = Lobby.GetMemberPatch( f68_local1, f68_local2, f68_local3 ) or 0 + local f68_local8 = Lobby.GetMemberPatchbacking( f68_local1, f68_local2, f68_local3 ) or 0 + f68_arg0:dispatchEventToChildren( { + name = "update_playercard", + gamertag = f68_local4, + rank = f68_local5, + prestige = f68_local6, + patchEmblem = f68_local7, + background = Lobby.GetMemberBackground( f68_local1, f68_local2, f68_local3 ) or 0, + clantag = Lobby.GetMemberClanTag( f68_local1, f68_local2, f68_local3 ) or "" + } ) + else + f68_arg0:animateToState( "default", 0 ) + end +end + +function SqauadVsSquadElementChildFeeder( f69_arg0 ) + local f69_local0 = f69_arg0.memberElement + local f69_local1 = f69_local0.properties.memberListState + local f69_local2 = f69_local0.properties.memberSlot + local f69_local3 = f69_local0.properties.team + local f69_local4 = { + [#f69_local4 + 1] = { + type = "UIImage", + id = "svs_member_list_bg_id", + states = { + default = CoD.ColorizeState( Colors.black, { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -28, + right = 23, + top = 0, + bottom = 170, + alpha = 0.2 + } ) + } + }, + [#f69_local4 + 1] = { + type = "UIElement", + id = "svs_memberlist_playercard_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottm = 0, + left = 25, + right = 0 + } + }, + children = { + { + type = "playercard", + id = "svs_member_list_playercard_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 25, + left = 25, + height = 90, + width = 100 + } + }, + properties = { + gamertag = Lobby.GetMemberName( f69_local1, f69_local2, f69_local3 ) or "", + rank = Lobby.GetMemberRank( f69_local1, f69_local2, f69_local3 ) or 0, + prestige = Lobby.GetMemberPrestigeLevel( f69_local1, f69_local2, f69_local3 ) or 0, + patchEmblem = Lobby.GetMemberPatch( f69_local1, f69_local2, f69_local3 ) or 0, + patchbacking = Lobby.GetMemberPatchbacking( f69_local1, f69_local2, f69_local3 ) or 0, + background = Lobby.GetMemberBackground( f69_local1, f69_local2, f69_local3 ) or 0, + clantag = Lobby.GetMemberClanTag( f69_local1, f69_local2, f69_local3 ) or "" + } + } + } + } + } + return f69_local4 +end + +function BuildSquadVsSquadListElement( f70_arg0, f70_arg1, f70_arg2 ) + return { + type = "UIElement", + id = "svs_member_list_element_id" .. f70_arg1, + focusable = false, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = -10, + top = 0, + bottom = 115, + alpha = 0 + }, + active = { + alpha = 1 + } + }, + properties = { + memberElement = f70_arg0 + }, + handlers = { + menu_create = UpdateSvSPlayercard, + update_svs_playercards = UpdateSvSPlayercard + }, + childrenFeeder = SqauadVsSquadElementChildFeeder + } +end + +function MemberListFeeder( f71_arg0 ) + local f71_local0 = {} + assert( f71_arg0.memberListState, "Member list needs initial state" ) + local f71_local1 = f71_arg0.isPublicLobby + local f71_local2 = f71_arg0.isPrivateLobby + local f71_local3 = LobbyMemberListGetState( f71_arg0.memberListState ) + local f71_local4 = Engine.IsAliensMode() and 4 or Lobby.MaxMemberListSlots + for f71_local5 = 1, f71_local4, 1 do + local f71_local8 = LobbyMemberGetSlot( f71_local3, f71_local5 ) + local f71_local9 = LobbyMemberGetTeam( f71_local3, f71_local5 ) + local f71_local10 + if not f71_arg0.delayMemberList or f71_local5 <= 1 then + f71_local10 = Lobby.IsActiveMemberSlot( f71_local5 - 1 ) + if not f71_local10 then + + else + local f71_local11 = f71_local10 + local f71_local12 = Engine.IsAliensMode() + if f71_local12 then + f71_local12 = f71_local11 and Lobby.GetMemberReadyUpFlag( f71_local3, f71_local8, f71_local9 ) + end + local f71_local13 + if f71_local10 then + f71_local13 = Lobby.GetMemberName( f71_local3, f71_local8, f71_local9 ) + if not f71_local13 then + + else + local f71_local14 + if f71_local10 then + f71_local14 = Lobby.GetMemberStat( f71_local3, f71_local8, f71_local9, Lobby.MemberStatTypes.Score ) + if not f71_local14 then + + else + local f71_local15 = nil + if Engine.IsAliensMode() then + if f71_local10 then + local f71_local16 = Lobby.GetMemberAlienRank( f71_local3, f71_local8, f71_local9 ) + end + f71_local15 = f71_local16 or 0 + else + if f71_local10 then + local f71_local17 = Lobby.GetMemberRank( f71_local3, f71_local8, f71_local9 ) + end + f71_local15 = f71_local17 or 0 + end + local f71_local18 + if f71_local10 then + f71_local18 = Rank.GetRankDisplay( f71_local15, Engine.GetCurrentCoDPlayMode() ) + if not f71_local18 then + + else + local f71_local19 = nil + if Engine.IsAliensMode() then + if f71_local10 then + local f71_local20 = Lobby.GetMemberAlienPrestigeLevel( f71_local3, f71_local8, f71_local9 ) + end + f71_local19 = f71_local20 or 0 + else + if f71_local10 then + local f71_local21 = Lobby.GetMemberPrestigeLevel( f71_local3, f71_local8, f71_local9 ) + end + f71_local19 = f71_local21 or 0 + end + local f71_local22 + if f71_local10 then + f71_local22 = Rank.GetRankIcon( f71_local15, f71_local19, Engine.GetCurrentCoDPlayMode() ) + if not f71_local22 then + + else + if not f71_local10 or not Lobby.GetMemberBotDifficulty( f71_local3, f71_local8, f71_local9 ) then + local f71_local23 = 1 + end + local f71_local24 = "white" + local f71_local25 = false + local f71_local26 = "" + if f71_local10 and Lobby.HasMemberClanTag( f71_local3, f71_local8, f71_local9 ) then + f71_local26 = Lobby.GetMemberClanTag( f71_local3, f71_local8, f71_local9 ) + f71_local25 = true + end + local f71_local27 = LobbyMemberIsSplitscreenPrompt( f71_local3, f71_local5 ) + local f71_local28 + if f71_local10 then + f71_local28 = Lobby.IsMemberALocalPlayer( f71_local3, f71_local8, f71_local9 ) + if not f71_local28 then + + else + local f71_local29 = { + type = "member_button", + properties = { + isPublicLobby = f71_local1, + isPrivateLobby = f71_local2, + memberListState = f71_local3, + memberIndex = f71_local5, + memberSlot = f71_local8, + team = f71_local9, + isActiveMemberSlot = f71_local10, + memberRank = f71_local18, + memberRankIcon = RegisterMaterial( f71_local22 ), + memberBotDifficultyIcon = RegisterMaterial( f71_local24 ), + memberReadyUpFlag = f71_local12, + gamerTag = f71_local13, + score = f71_local14, + hasClanTag = f71_local25, + clanTag = f71_local26, + isSplitscreenPrompt = f71_local27, + isLocalMember = f71_local28 + } + } + if LobbyMemberButtonShouldBeDisabled( f71_local3, f71_local5, f71_local10 ) then + f71_local29.disabled = true + end + if not f71_local10 or f71_local27 then + f71_local29.focusable = false + end + if UsingSvSPlayercards( f71_local3 ) and f71_local5 <= 2 then + f71_local0[#f71_local0 + 1] = BuildSquadVsSquadListElement( f71_local29, f71_local5, f71_local10 ) + end + f71_local29.id = "member_" .. f71_local5 + f71_local0[#f71_local0 + 1] = f71_local29 + end + end + f71_local28 = false + end + end + f71_local22 = "white" + end + end + f71_local18 = "" + end + end + f71_local14 = "" + end + end + f71_local13 = "" + end + end + f71_local10 = false + end + f71_local0[#f71_local0 + 1] = { + type = "UITimer", + id = "member_list_tmr", + properties = { + event = { + name = "member_list_refresh", + dispatchChildren = true + }, + interval = Lobby.MemberListRefreshTime, + disposable = false, + broadcastToRoot = true + } + } + return f71_local0 +end + +function GetSquadBackgroundSize( f72_arg0 ) + local f72_local0 = Lobby.MemberListSquadMemberHeight + local f72_local1 = GetMemberListSpacing() + local f72_local2 = 110 + local f72_local3 = SvS.MaxSquadSize * (f72_local0 + f72_local1) + if f72_arg0 == Lobby.Teams.Axis then + f72_local3 = f72_local3 + f72_local2 + f72_local1 * 2 + end + return f72_local3 +end + +function UpdateLocalSquadHeader( f73_arg0, f73_arg1, f73_arg2, f73_arg3 ) + local f73_local0 = f73_arg2:getParent() == f73_arg0 + if f73_arg1 and not f73_local0 then + LUI.UIElement.addElementBefore( f73_arg2, f73_arg3 ) + elseif not f73_arg1 and f73_local0 then + f73_arg0:removeElement( f73_arg2 ) + end +end + +function UpdateSquadHeaders( f74_arg0, f74_arg1 ) + f74_arg0.properties.memberListState = LobbyMemberListGetState( f74_arg0.properties.memberListState ) + if not f74_arg0.properties.localSquadHeader then + return + end + local f74_local0 = f74_arg0.properties.firstLocalSquadMember + if f74_local0 then + UpdateLocalSquadHeader( f74_arg0, true, f74_arg0.properties.localSquadHeader, f74_local0 ) + else + UpdateLocalSquadHeader( f74_arg0, false, f74_arg0.properties.localSquadHeader ) + end + local f74_local1 = f74_arg0.properties.firstOpposingSquadMember + if f74_local1 and (f74_local1.properties.team ~= Lobby.Teams.Axis or not f74_local1.properties.isActiveMemberSlot) then + f74_local1 = nil + f74_arg0.properties.firstOpposingSquadMember = nil + end + if f74_arg0.properties and f74_arg0.properties.opposingSquadHeaderElements then + if f74_local1 then + for f74_local5, f74_local6 in ipairs( f74_arg0.properties.opposingSquadHeaderElements ) do + UpdateLocalSquadHeader( f74_arg0, true, f74_local6, f74_local1 ) + end + else + for f74_local5, f74_local6 in ipairs( f74_arg0.properties.opposingSquadHeaderElements ) do + UpdateLocalSquadHeader( f74_arg0, false, f74_local6 ) + end + end + end +end + +function BuildSquadHeader( f75_arg0 ) + local self = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -26, + right = 10, + top = 0, + height = GenericTitleBarDims.TitleBarHeight + 3, + alpha = 1 + } ) + local f75_local1 = LUI.MenuGenerics.generic_menu_titlebar( nil, { + font = CoD.TextSettings.ExtraBigFont, + title_bar_text = f75_arg0.text or "", + title_bar_alignment = LUI.Alignment.Center, + fill_alpha = 0.6 + } ) + f75_local1:registerEventHandler( "set_squad_header_text", function ( element, event ) + element:dispatchEventToChildren( { + name = "update_title", + title_text = Engine.Localize( "@LUA_MENU_SQUAD_LABEL", event.text ) + } ) + end ) + self:addElement( f75_local1 ) + local f75_local2 = LUI.MenuGenerics.generic_menu_background_withfade( {}, { + top_offset = 0, + shadow_alpha = 0, + fill_alpha = 0.6 + } ) + local f75_local3 = f75_local2 + local f75_local4 = f75_local2.registerAnimationState + local f75_local5 = "default" + local f75_local6 = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight, + left = 0, + right = 0 + } + local f75_local7 = GetSquadBackgroundSize + local f75_local8 = f75_arg0.team + if not f75_local8 then + f75_local8 = Lobby.Teams.Free + end + f75_local6.height = f75_local7( f75_local8 ) + f75_local4( f75_local3, f75_local5, f75_local6 ) + f75_local2:animateToState( "default" ) + self:addElement( f75_local2 ) + return self +end + +function BuildOpposingSquadHeaderElements() + local f77_local0 = { + [#f77_local0 + 1] = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -55, + right = 40, + top = 0, + bottom = 10, + alpha = 0 + } ), + [#f77_local0 + 1] = BuildSquadHeader( { + text = "", + team = Lobby.Teams.Axis + } ), + [#f77_local0 + 1] = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 5, + alpha = 0 + } ) + } + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 45, + height = 103, + width = 512 + } ) + f77_local0[#f77_local0 + 1] = self + self:addElement( LUI.Playercard.new( nil, { + gamertag = "", + clantag = "", + rank = 0, + prestige = 0, + background = "0", + patchEmblem = "0", + patchShape = "0", + patchScale = -0.15 + }, 0 ) ) + return f77_local0 +end + +function SetupSquadHeaders( f78_arg0, f78_arg1 ) + f78_arg0.properties.localSquadHeader = BuildSquadHeader( { + team = Lobby.Teams.Allies + } ) + f78_arg0.properties.opposingSquadHeaderElements = BuildOpposingSquadHeaderElements() +end + +function UpdateSquadMember( f79_arg0, f79_arg1 ) + if f79_arg0.properties.memberListState ~= Lobby.MemberListStates.Teams and f79_arg0.properties.memberListState ~= Lobby.MemberListStates.Lobby then + return + elseif f79_arg1.team == Lobby.Teams.Axis then + if not f79_arg0.properties.firstOpposingSquadMember then + local f79_local0 = Squad.GetEnemySquadName() + local f79_local1 = Lobby.GetMemberName( f79_arg1.memberListState, f79_arg1.memberSlot, f79_arg1.team ) or "" + local f79_local2 = Lobby.GetMemberRank( f79_arg1.memberListState, f79_arg1.memberSlot, f79_arg1.team ) or 0 + local f79_local3 = Lobby.GetMemberPrestigeLevel( f79_arg1.memberListState, f79_arg1.memberSlot, f79_arg1.team ) or 0 + local f79_local4 = Lobby.GetMemberPatch( f79_arg1.memberListState, f79_arg1.memberSlot, f79_arg1.team ) or 0 + local f79_local5 = Lobby.GetMemberPatchbacking( f79_arg1.memberListState, f79_arg1.memberSlot, f79_arg1.team ) or 0 + local f79_local6 = Lobby.GetMemberBackground( f79_arg1.memberListState, f79_arg1.memberSlot, f79_arg1.team ) or 0 + local f79_local7 = Lobby.GetMemberClanTag( f79_arg1.memberListState, f79_arg1.memberSlot, f79_arg1.team ) or "" + if f79_arg0.properties and f79_arg0.properties.opposingSquadHeaderElements then + for f79_local11, f79_local12 in ipairs( f79_arg0.properties.opposingSquadHeaderElements ) do + f79_local12:processEvent( { + name = "set_squad_header_text", + text = Engine.MarkLocalized( f79_local0 ) + } ) + f79_local12:processEvent( { + name = "update_playercard", + gamertag = f79_local1, + rank = f79_local2, + prestige = f79_local3, + patchEmblem = f79_local4, + background = f79_local6, + clantag = f79_local7 + } ) + end + end + f79_arg0.properties.firstOpposingSquadMember = f79_arg1.playerElement + end + else + if not f79_arg0.properties.firstLocalSquadMember then + local f79_local0 = Engine.GetFirstActiveController() + f79_arg0.properties.firstLocalSquadMember = f79_arg1.playerElement + end + if f79_arg0.properties.localSquadHeader then + f79_arg0.properties.localSquadHeader:processEvent( { + name = "set_squad_header_text", + text = Engine.MarkLocalized( Squad.GetHostSquadName() ) + } ) + end + end +end + +function member_list() + return { + type = "UIVerticalList", + id = "member_list", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 640, + right = 1190, + top = GenericMenuDims.menu_top + 26, + bottom = GenericMenuDims.menu_bottom, + spacing = Engine.IsAliensMode() and 6 or 2 + } + }, + properties = { + memberListState = MBh.Property( "memberListState" ) + }, + handlers = { + update_squad_member = UpdateSquadMember, + menu_create = SetupSquadHeaders, + member_list_refresh = UpdateSquadHeaders, + refocus_member_list = HandleRefocusMemberList, + menu_close = function ( f81_arg0, f81_arg1 ) + f81_arg0.properties.firstLocalSquadMember = nil + f81_arg0.properties.firstOpposingSquadMember = nil + end + + }, + childrenFeeder = MemberListFeeder + } +end + +if Engine.IsConsoleGame() then + function GetTalkIconState( f82_arg0, f82_arg1, f82_arg2 ) + if Lobby.IsMemberMuted( f82_arg0, f82_arg1, f82_arg2 ) then + return "muted" + elseif not Lobby.IsMemberHeadsetConnected( f82_arg0, f82_arg1, f82_arg2 ) then + return "disabled" + elseif Lobby.IsMemberTalking( f82_arg0, f82_arg1, f82_arg2 ) then + return "talking" + else + return "quiet" + end + end + +else + function GetTalkIconState( f83_arg0, f83_arg1, f83_arg2 ) + if Lobby.IsMemberMuted( f83_arg0, f83_arg1, f83_arg2 ) then + return "muted" + elseif Lobby.IsMemberTalking( f83_arg0, f83_arg1, f83_arg2 ) then + return "talking" + else + return "disabled" + end + end + +end +function HandleTalkIconUpdate( f84_arg0, f84_arg1 ) + f84_arg0:animateToState( GetTalkIconState( f84_arg1.memberListState, f84_arg1.memberSlot, f84_arg1.team ), 0 ) +end + +function member_button( f85_arg0, f85_arg1, f85_arg2 ) + local f85_local0 = LUI.mp_menus.Aliens + local f85_local1 = Lobby.MemberListMemberHeight + if SvS.IsSvS() then + f85_local1 = Lobby.MemberListSquadMemberHeight + end + local f85_local2 = 0.5 + local f85_local3 = Engine.IsAliensMode() + local f85_local4 = f85_arg1.isPublicLobby or false + local f85_local5 = f85_arg1.isPrivateLobby or false + local f85_local6 = f85_arg1.isActiveMemberSlot or false + local f85_local7 = f85_arg1.memberReadyUpFlag or false + local f85_local8 = f85_arg1.gamerTag or "" + local f85_local9 = f85_arg1.score or "" + local f85_local10 = f85_arg1.clanTag or "" + local f85_local11 = f85_arg1.hasClanTag or false + local f85_local12 = f85_arg1.memberRank or "" + local f85_local13 = f85_arg1.memberRankIcon + if not f85_local13 then + f85_local13 = RegisterMaterial( "white" ) + end + local f85_local14 = f85_arg1.memberBotDifficultyIcon + if not f85_local14 then + f85_local14 = RegisterMaterial( "white" ) + end + local f85_local15 = f85_arg1.memberListState + if not f85_local15 then + f85_local15 = Lobby.MemberListStates.None + end + local f85_local16 = f85_arg1.memberIndex or 1 + local f85_local17 = f85_arg1.memberSlot or 0 + local f85_local18 = f85_arg1.team + if not f85_local18 then + f85_local18 = Teams.free + end + local f85_local19 = f85_arg1.isSplitscreenPrompt or false + local f85_local20 = f85_arg1.isLocalMember or false + local self = LUI.UIButton.new() + self.id = "member_button_id" + self.properties = { + isActiveMemberSlot = f85_local6, + memberIndex = f85_local16, + team = f85_local18, + isPublicLobby = f85_local4, + isPrivateLobby = f85_local5, + isSplitscreenPrompt = f85_local19, + memberListState = f85_local15 + } + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -55, + right = 0, + top = 0, + bottom = f85_local1, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + if not (not f85_local6 and ((f85_local15 == Lobby.MemberListStates.Prelobby) or not Lobby.IsSearching() or f85_local16 > Lobby.GetMemberCount( f85_local15, Teams.free ) or HideEmptyLobbySlots( f85_local15 ))) or f85_local19 then + self:animateToState( "default", 0 ) + else + self:animateToState( "hidden", 0 ) + end + self:registerEventHandler( "menu_create", MBh.DoMultiple( { + HandleLobbyMemberButtonIsActive, + HandleLobbyMemberButtonIsDisabled + } ) ) + self:registerEventHandler( "member_list_refresh", MBh.DoMultiple( { + HandleLobbyMemberButtonRefresh, + HandleLobbyMemberButtonIsActive, + HandleLobbyMemberButtonIsDisabled, + DispatchSvSPlayercardUpdate + } ) ) + self:registerEventHandler( "popup_inactive", function ( menu, controller ) + local self = LUI.UITimer.new( 70, { + name = "member_list_refresh" + }, nil, true, menu, false ) + self.id = "member_button_popup_restore_timer_id" + menu:addElement( self ) + LUI.UIButton.popupInactive( menu, controller ) + end ) + self:registerEventHandler( "button_action", HandleLobbyMemberButtonAction ) + self:registerEventHandler( "button_over", MBh.DoMultiple( { + HandleLobbyMemberUpdateSetFocused, + HandleLobbyMemberButtonOver + } ) ) + self:registerEventHandler( "button_up", HandleLobbyMemberUpdateSetNotFocused ) + self:registerEventHandler( "restore_focus", HandleLobbyMemberRestoreFocus ) + local f85_local22 = LUI.UITimer.new( 250, { + name = "member_list_refresh" + }, nil, true, memberButtonSplitscreenPrompt, false ) + f85_local22.id = "member_button_initial_timer_id" + self:addElement( f85_local22 ) + local f85_local23 = LUI.UIText.new() + f85_local23.id = "member_button_ss_prompt_id" + f85_local23.properties = { + memberListState = f85_local15, + memberIndex = f85_local16 + } + f85_local23:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -1 * CoD.TextSettings.SmallFont.Height * 0.5, + bottom = CoD.TextSettings.SmallFont.Height * 0.5, + left = 74, + right = 625, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) + f85_local23:registerAnimationState( "hidden", { + alpha = 0 + } ) + f85_local23:animateToState( "default", 0 ) + if not f85_local19 then + f85_local23:animateToState( "hidden", 0 ) + else + f85_local23:setText( Lobby.GetNonPlayingLocalClientText( f85_local16 - 1 ) ) + end + f85_local23:registerEventHandler( "lobby_member_update_ss_prompt", HandleLobbyMemberUpdateSplitscreenPrompt ) + self:addElement( f85_local23 ) + local f85_local24 = LUI.UIHorizontalList.new() + f85_local24.id = "member_button_list_id" + f85_local24:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = f85_local1, + left = 0, + right = 611, + alpha = 1 + } ) + f85_local24:animateToState( "default", 0 ) + local f85_local25 = LUI.UIImage.new() + f85_local25.id = "member_button_talk_icon_id" + f85_local25:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 33, + left = 0, + right = 33, + material = RegisterMaterial( "icon_online_chat_quiet" ), + alpha = 0 + } ) + f85_local25:registerAnimationState( "disabled", { + alpha = 0 + } ) + f85_local25:registerAnimationState( "talking", { + alpha = 1, + material = RegisterMaterial( "icon_online_chat" ) + } ) + f85_local25:registerAnimationState( "muted", { + alpha = 1, + material = RegisterMaterial( "icon_online_chat_mute" ) + } ) + f85_local25:registerAnimationState( "quiet", { + alpha = 1, + material = RegisterMaterial( "icon_online_chat_quiet" ) + } ) + f85_local25:animateToState( "default", 0 ) + f85_local25:animateToState( GetTalkIconState( f85_local15, f85_local17, f85_local18 ), 0 ) + f85_local25:registerEventHandler( "lobby_member_update_content", HandleTalkIconUpdate ) + f85_local25:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled", 0 ) ) + f85_local24:addElement( f85_local25 ) + local f85_local26 = LUI.UIElement.new() + f85_local26.id = "member_button_lt_id" + f85_local26:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 26 + } ) + f85_local26:animateToState( "default", 0 ) + f85_local26:registerEventHandler( "button_up", HandleLobbyMemberLeftButtonUp ) + f85_local26:registerEventHandler( "button_over", HandleLobbyMemberLeftButtonOver ) + local f85_local27 = LUI.UIImage.new() + f85_local27.id = "member_button_lt_bg_id" + f85_local27.properties = { + memberListState = f85_local15, + team = f85_local18, + isActiveMemberSlot = f85_local6 + } + f85_local27:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "box_lobby_name_lt" ), + red = 1, + green = 1, + blue = 1, + alpha = f85_local2 + } ) + f85_local27:registerAnimationState( "disabled", { + alpha = 0.25 + } ) + f85_local27:animateToState( "default", 0 ) + f85_local27:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled", 0 ) ) + f85_local27:registerEventHandler( "button_up", HandleLobbyMemberSetBackground ) + f85_local27:registerEventHandler( "lobby_member_update_bg", MBh.DoMultiple( { + HandleLobbyMemberUpdateBackgroundProperties, + HandleLobbyMemberSetBackground + } ) ) + local f85_local28 = buildMemberButtonTeamBorder( f85_local15, f85_local17, f85_local18, f85_local6, "box_lobby_name_match_lt" ) + f85_local28.id = "member_button_lt_bg_border_id" + local f85_local29 = LUI.UIImage.new() + f85_local29.id = "member_button_party_host_id" + f85_local29.properties = { + memberListState = f85_local15, + memberSlot = f85_local17, + team = f85_local18 + } + f85_local29:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -16, + bottom = 0, + left = 0, + right = 16, + material = RegisterMaterial( "icon_party_leader" ), + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f85_local29:registerAnimationState( "shown", { + alpha = 1 + } ) + f85_local29:animateToState( "default", 0 ) + if Lobby.ShowMemberPrivatePartyHostIcon( f85_local15, f85_local17, f85_local18 ) then + f85_local29:animateToState( "shown", 0 ) + end + f85_local29:registerEventHandler( "lobby_member_update_content", MBh.DoMultiple( { + HandleLobbyMemberUpdateHostIconProperties, + HandleLobbyMemberShowHostIcon + } ) ) + f85_local29:registerEventHandler( "button_disable", MBh.AnimateToState( "default", 0 ) ) + local f85_local30 = LUI.UIImage.new() + f85_local30.id = "member_button_elite_icon_id" + f85_local30.properties = { + memberListState = f85_local15, + memberSlot = f85_local17, + team = f85_local18 + } + f85_local30:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 2, + bottom = 14, + left = 3, + right = 29, + material = RegisterMaterial( "widg_arrow_dn" ), + red = 0.33, + green = 0.71, + blue = 0.23, + alpha = 0 + } ) + f85_local30:registerAnimationState( "visible", { + alpha = 1 + } ) + f85_local30:animateToState( "default", 0 ) + if ShouldShowEliteIcon( f85_local15, f85_local17, f85_local18 ) then + f85_local30:animateToState( "visible", 0 ) + end + f85_local30:registerEventHandler( "lobby_member_update_content", MBh.DoMultiple( { + HandleLobbyMemberUpdateEliteIconProperties, + HandleLobbyMemberUpdateEliteIcon + } ) ) + f85_local30:registerEventHandler( "button_disable", MBh.AnimateToState( "default", 0 ) ) + f85_local26:addElement( f85_local27 ) + f85_local26:addElement( f85_local28 ) + f85_local26:addElement( f85_local29 ) + f85_local26:addElement( f85_local30 ) + f85_local24:addElement( f85_local26 ) + local f85_local31 = LUI.UIElement.new() + f85_local31.id = "member_button_mid_id" + f85_local31:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 544 + } ) + f85_local31:animateToState( "default" ) + f85_local31:registerEventHandler( "button_up", HandleLobbyMemberMidButtonUp ) + f85_local31:registerEventHandler( "button_over", HandleLobbyMemberMidButtonOver ) + local f85_local32 = LUI.UIImage.new() + f85_local32.id = "member_button_mid_bg_id" + f85_local32.properties = { + memberListState = f85_local15, + team = f85_local18, + isActiveMemberSlot = f85_local6 + } + f85_local32:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "box_lobby_name_mid" ), + red = 1, + green = 1, + blue = 1, + alpha = f85_local2 + } ) + f85_local32:registerAnimationState( "disabled", { + alpha = 0.25 + } ) + f85_local32:animateToState( "default", 0 ) + f85_local32:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled", 0 ) ) + f85_local32:registerEventHandler( "button_up", HandleLobbyMemberSetBackground ) + f85_local32:registerEventHandler( "lobby_member_update_bg", MBh.DoMultiple( { + HandleLobbyMemberUpdateBackgroundProperties, + HandleLobbyMemberSetBackground + } ) ) + local f85_local33 = buildMemberButtonTeamBorder( f85_local15, f85_local17, f85_local18, f85_local6, "box_lobby_name_match_mid" ) + f85_local33.id = "member_button_mid_bg_border_id" + f85_local31:addElement( f85_local32 ) + f85_local31:addElement( f85_local33 ) + f85_local31:addElement( buildMemberButtonContent( f85_local15, f85_local17, f85_local18, f85_local12, f85_local13, f85_local14, f85_local11, f85_local10, f85_local8, f85_local9, f85_local7, f85_local5 ) ) + f85_local24:addElement( f85_local31 ) + local f85_local34 = LUI.UIElement.new() + f85_local34.id = "member_button_rt_id" + f85_local34:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 8 + } ) + f85_local34:animateToState( "default", 0 ) + f85_local34:registerEventHandler( "button_up", HandleLobbyMemberRightButtonUp ) + f85_local34:registerEventHandler( "button_over", HandleLobbyMemberRightButtonOver ) + local f85_local35 = LUI.UIImage.new() + f85_local35.id = "member_button_rt_bg_id" + f85_local35.properties = { + memberListState = f85_local15, + team = f85_local18, + isActiveMemberSlot = f85_local6 + } + f85_local35:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "box_lobby_name_rt" ), + red = 1, + green = 1, + blue = 1, + alpha = f85_local2 + } ) + f85_local35:registerAnimationState( "disabled", { + alpha = 0.25 + } ) + f85_local35:animateToState( "default", 0 ) + f85_local35:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled", 0 ) ) + f85_local35:registerEventHandler( "button_up", HandleLobbyMemberSetBackground ) + f85_local35:registerEventHandler( "lobby_member_update_bg", MBh.DoMultiple( { + HandleLobbyMemberUpdateBackgroundProperties, + HandleLobbyMemberSetBackground + } ) ) + local f85_local36 = buildMemberButtonTeamBorder( f85_local15, f85_local17, f85_local18, f85_local6, "box_lobby_name_match_rt" ) + f85_local36.id = "member_button_rt_bg_border_id" + f85_local34:addElement( f85_local35 ) + f85_local34:addElement( f85_local36 ) + f85_local24:addElement( f85_local34 ) + if Engine.IsAliensMode() then + local f85_local37 = LUI.UIImage.new() + f85_local37.id = "member_button_alien_splat_id" + f85_local37:registerAnimationState( "default", { + material = RegisterMaterial( "box_alien_lobby_name_overlay" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -20, + bottom = 20, + left = 40, + right = 24, + alpha = 0 + } ) + f85_local37:animateToState( "default" ) + f85_local37:registerAnimationState( "glow", { + alpha = 1 + } ) + f85_local37:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f85_local37:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f85_local37:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f85_local37:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "glow", + 1200 + }, + { + "default", + 1200 + } + } ) ) + self:addElement( f85_local37 ) + end + self:addElement( f85_local24 ) + if f85_local5 then + local f85_local37 = LUI.UIImage.new() + f85_local37.id = "MLGTag" + f85_local37:registerAnimationState( "default", { + material = RegisterMaterial( "icon_mlg_cam" ), + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 80, + top = 6, + width = 32, + height = 16, + alpha = 0 + } ) + f85_local37:animateToState( "default" ) + f85_local37:registerAnimationState( "visible", { + alpha = 1 + } ) + f85_local37:registerAnimationState( "dark", { + red = 0, + green = 0, + blue = 0 + } ) + f85_local37:registerAnimationState( "light", { + red = 1, + green = 1, + blue = 1 + } ) + f85_local37:registerEventHandler( "button_over", MBh.AnimateToState( "dark" ) ) + f85_local37:registerEventHandler( "button_up", MBh.AnimateToState( "light" ) ) + f85_local37:registerEventHandler( "lobby_member_update_content", function ( element, event ) + if Lobby.IsMemberMLGSpectator( f85_local17, Lobby.IsMemberALocalPlayer( event.memberListState, event.memberSlot, event.team ) and Lobby.GetMemberControllerIndex( event.memberListState, event.memberSlot, event.team ) or Engine.GetFirstActiveController() ) then + element:animateToState( "visible" ) + else + element:animateToState( "default" ) + end + end ) + self:addElement( f85_local37 ) + end + if f85_local3 and not f85_local19 then + local f85_local37 = 32 + local f85_local38 = LUI.UIImage.new() + f85_local38.id = "debugelem" + f85_local38.properties = { + memberListState = f85_local15, + memberIndex = f85_local16 + } + f85_local38:registerAnimationState( "default", { + material = RegisterMaterial( "box_white_gradient_fade_rt" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 4, + top = f85_local1 + 1, + bottom = f85_local1 + f85_local0.AliensMemberListSpacing + 1, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } ) + f85_local38:registerAnimationState( "visible", { + alpha = 0.1 + } ) + f85_local38:registerEventHandler( "lobby_member_update_ss_prompt", HandleLobbyMemberUpdateSplitscreenPromptAliens ) + f85_local38:animateToState( "default" ) + self:addElement( f85_local38 ) + local f85_local39 = LUI.UIHorizontalList.new() + f85_local39.id = "loadout_list_id" + f85_local39.properties = { + memberListState = f85_local15, + memberIndex = f85_local16 + } + f85_local39:registerAnimationState( "default", { + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = f85_local1 + 1, + bottom = f85_local1 + f85_local0.AliensMemberListSpacing + 1, + spacing = 10, + alpha = 0 + } ) + f85_local39:registerAnimationState( "visible", { + alpha = 1 + } ) + f85_local39:registerEventHandler( "lobby_member_update_ss_prompt", HandleLobbyMemberUpdateSplitscreenPromptAliens ) + f85_local39:animateToState( "default" ) + self:addElement( f85_local39 ) + local f85_local40 = { + material = RegisterMaterial( "white" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = -f85_local37, + right = 0, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 0 + } + local f85_local41 = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + local f85_local42 = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = -f85_local37, + right = 0, + top = 0, + bottom = 0, + alpha = 1 + } + local f85_local43 = LUI.UIImage.new() + f85_local43.id = "perk0_icon" + f85_local43:registerAnimationState( "default", f85_local40 ) + f85_local43:registerAnimationState( "collapsed", f85_local41 ) + f85_local43:registerAnimationState( "visible", f85_local42 ) + f85_local43:registerEventHandler( "lobby_member_update_content", function ( element, event ) + HandleUpdatePerkIcon( element, event, 0, true ) + end ) + f85_local43:animateToState( "default" ) + local f85_local44 = LUI.UIImage.new() + f85_local44.id = "perk1_icon" + f85_local44:registerAnimationState( "default", f85_local40 ) + f85_local44:registerAnimationState( "collapsed", f85_local41 ) + f85_local44:registerAnimationState( "visible", f85_local42 ) + f85_local44:registerEventHandler( "lobby_member_update_content", function ( element, event ) + HandleUpdatePerkIcon( element, event, 1, true ) + end ) + f85_local44:animateToState( "default" ) + local f85_local45 = LUI.UIImage.new() + f85_local45.id = "munitions_elem" + f85_local45:registerAnimationState( "default", f85_local40 ) + f85_local45:registerAnimationState( "collapsed", f85_local41 ) + f85_local45:registerAnimationState( "visible", f85_local42 ) + f85_local45:registerEventHandler( "lobby_member_update_content", function ( element, event ) + HandleUpdateAbilityIcon( element, event, f85_local0.AlienAbilities.Up, true ) + end ) + f85_local45:animateToState( "default" ) + local f85_local46 = LUI.UIImage.new() + f85_local46.id = "support_elem" + f85_local46:registerAnimationState( "default", f85_local40 ) + f85_local46:registerAnimationState( "collapsed", f85_local41 ) + f85_local46:registerAnimationState( "visible", f85_local42 ) + f85_local46:registerEventHandler( "lobby_member_update_content", function ( element, event ) + HandleUpdateAbilityIcon( element, event, f85_local0.AlienAbilities.Down, true ) + end ) + f85_local46:animateToState( "default" ) + local f85_local47 = LUI.UIImage.new() + f85_local47.id = "offense_elem" + f85_local47:registerAnimationState( "default", f85_local40 ) + f85_local47:registerAnimationState( "collapsed", f85_local41 ) + f85_local47:registerAnimationState( "visible", f85_local42 ) + f85_local47:registerEventHandler( "lobby_member_update_content", function ( element, event ) + HandleUpdateAbilityIcon( element, event, f85_local0.AlienAbilities.Right, false ) + end ) + f85_local47:animateToState( "default" ) + local f85_local48 = LUI.UIImage.new() + f85_local48.id = "defense_elem" + f85_local48:registerAnimationState( "default", f85_local40 ) + f85_local48:registerAnimationState( "collapsed", f85_local41 ) + f85_local48:registerAnimationState( "visible", f85_local42 ) + f85_local48:registerEventHandler( "lobby_member_update_content", function ( element, event ) + HandleUpdateAbilityIcon( element, event, f85_local0.AlienAbilities.Left, false ) + end ) + f85_local48:animateToState( "default" ) + f85_local39:addElement( f85_local48 ) + f85_local39:addElement( f85_local47 ) + f85_local39:addElement( f85_local46 ) + f85_local39:addElement( f85_local45 ) + f85_local39:addElement( f85_local44 ) + f85_local39:addElement( f85_local43 ) + end + return self +end + +LUI.MenuBuilder.registerDef( "member_list", member_list ) +LUI.MenuBuilder.registerType( "member_button", member_button ) +LockTable( _M ) diff --git a/lui/mp_menus/mponlinevault.dec.lua b/lui/mp_menus/mponlinevault.dec.lua new file mode 100644 index 0000000..207edf9 --- /dev/null +++ b/lui/mp_menus/mponlinevault.dec.lua @@ -0,0 +1,1241 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +FileTypes = { + All = 0, + Film = 1, + Clip = 2, + Screenshot = 3, + AVI = 4, + CustomGame = 5, + RCU = 6, + FB_AVI = 7 +} +VaultNotifications = { + Copy = 0, + Update = 1, + Delete = 2, + LoadMode = 3, + SaveMode = 4 +} +function OnCreate( f1_arg0, f1_arg1 ) + local f1_local0 = f1_arg1.controller + if not f1_local0 then + f1_local0 = Engine.GetFirstActiveController() + end + OnlineVault.Open( f1_local0, "" .. f1_arg0.properties.vaultMode .. " " .. f1_arg0.properties.vaultCategory .. " " .. "invalid" ) + if OnlineVault.GetSlotCount( f1_local0 ) < 1 then + LUI.FlowManager.RequestPopupMenu( f1_arg0, "online_vault_fetching_popup", true, f1_local0, false ) + end + f1_arg0:dispatchEventToRoot( { + name = "vault_refresh", + dispatchChildren = true, + immediate = true + } ) + f1_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true, + immediate = true + } ) + f1_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@MENU_FRIENDS" ), + side = "right", + clickable = true + } ) +end + +function VaultItemDisabled( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg1.controller + if not f2_local0 then + f2_local0 = Engine.GetFirstActiveController() + end + return not OnlineVault.IsItemEnabled( f2_local0, f2_arg1.slot_index ) +end + +function LeaveVault( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg1.controller + if not f3_local0 then + f3_local0 = Engine.GetFirstActiveController() + end + OnlineVault.Close( f3_local0, true ) + if f3_arg1 and f3_arg1.restoreMenu then + LUI.FlowManager.RequestRestoreMenu( f3_arg0, f3_arg1.restoreMenu, true, f3_arg1.controller, true ) + else + LUI.FlowManager.RequestLeaveMenu( f3_arg0 ) + end +end + +function OnActionButton( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg1.vaultMode + local f4_local1 = f4_arg1.idx + if f4_local0 == "browse" then + HandleBrowseSelection( f4_arg0, f4_arg1.controller, f4_local1 ) + elseif f4_local0 == "load" then + OnlineVault.LoadItem( f4_arg1.controller, f4_local1 ) + LUI.FlowManager.RequestPopupMenu( f4_arg0, "online_vault_please_wait_popup", true, controller, false ) + elseif f4_local0 == "save" then + if OnlineVault.IsValidSlot( f4_arg1.controller, f4_local1 ) then + LUI.FlowManager.RequestPopupMenu( f4_arg0, "online_vault_confirm_overwrite_popup", true, f4_arg1.controller, false, { + callback_params = { + saveToSlot = f4_local1 + } + } ) + else + OnlineVault.Save( f4_arg1.controller, f4_local1 ) + LUI.FlowManager.RequestPopupMenu( f4_arg0, "online_vault_please_wait_popup", true, controller, false ) + end + elseif f4_local0 == "copy" then + + else + DebugPrint( "Button pressed during unknown vault mode! Ignoring... " ) + end +end + +function HandleBrowseSelection( f5_arg0, f5_arg1, f5_arg2 ) + local f5_local0 = OnlineVault.GetItemFiletype( f5_arg1 or Engine.GetFirstActiveController(), f5_arg2 ) + local f5_local1 = { + callback_params = { + slotIndex = f5_arg2 + } + } + local f5_local2 = "" + if f5_local0 == FileTypes.Film then + f5_local2 = "online_vault_browse_film_popup" + elseif f5_local0 == FileTypes.Clip then + f5_local2 = "online_vault_browse_clip_popup" + elseif f5_local0 == FileTypes.Screenshot then + f5_local2 = "online_vault_browse_screenshot_popup" + elseif f5_local0 == FileTypes.CustomGame then + f5_local2 = "online_vault_browse_cgm_popup" + else + DebugPrint( "OnlineVault browse selection of unknown type!" ) + end + if f5_local2 ~= "" then + LUI.FlowManager.RequestPopupMenu( f5_arg0, f5_local2, true, f5_arg1, false, f5_local1 ) + end +end + +function UpdateSelection( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg1.controller + if not f6_local0 then + f6_local0 = Engine.GetFirstActiveController() + end + local f6_local1 = f6_arg1.idx + local f6_local2 = LUI.FlowManager.GetMenuScopedDataFromElement( f6_arg0 ) + local f6_local3 = f6_local2.itemType + local f6_local4 = OnlineVault.GetItemFiletype( f6_local0, f6_local1 ) + if f6_local3 == nil or f6_local3 ~= f6_local4 then + f6_local2.itemType = f6_local4 + f6_arg0:dispatchEventToRoot( { + name = "refresh_details", + dispatchChildren = true, + immediate = true + } ) + end + local f6_local5 = OnlineVault.GetItemText( f6_local0, f6_local1 ) + local f6_local6 = OnlineVault.GetItemData( f6_local0, f6_local1, "author" ) + local f6_local7 = OnlineVault.GetItemData( f6_local0, f6_local1, "desc" ) + local f6_local8 = OnlineVault.GetItemData( f6_local0, f6_local1, "gametype" ) + local f6_local9 = OnlineVault.GetItemData( f6_local0, f6_local1, "map" ) + local f6_local10 = OnlineVault.GetItemData( f6_local0, f6_local1, "duration" ) + local f6_local11 = OnlineVault.GetItemData( f6_local0, f6_local1, "createTime" ) + local f6_local12 + if f6_local4 == FileTypes.CustomGame then + f6_local12 = "icon_playlist_generic" + if not f6_local12 then + + else + f6_arg0:dispatchEventToRoot( { + name = "update_details", + dispatchChildren = true, + immediate = true, + title = f6_local5, + creator = f6_local6, + desc = f6_local7, + baseMode = f6_local8, + map = f6_local9, + duration = f6_local10, + timestamp = f6_local11, + image = f6_local12 + } ) + end + end + f6_local12 = OnlineVault.GetItemData( f6_local0, f6_local1, "mapImage" ) +end + +function DoRefresh( f7_arg0, f7_arg1 ) + f7_arg0:closeChildren() + f7_arg0:clearSavedState() + f7_arg0:processEvent( { + name = "menu_refresh", + dispatchChildren = true + } ) +end + +function CancelFetch( f8_arg0, f8_arg1 ) + OnlineVault.AbortOperation( f8_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f8_arg0 ) + f8_arg0:dispatchEventToRoot( { + name = "leave_vault", + dispatchChildren = true, + immediate = true + } ) +end + +function HandleVaultNotification( f9_arg0, f9_arg1 ) + local f9_local0 = f9_arg1.type + if f9_local0 == VaultNotifications.Copy then + + elseif f9_local0 == VaultNotifications.Delete then + HandleDeleteResult( f9_arg0, f9_arg1 ) + elseif f9_local0 == VaultNotifications.LoadMode then + HandleModeLoadResult( f9_arg0, f9_arg1 ) + elseif f9_local0 == VaultNotifications.SaveMode then + HandleModeSaveResult( f9_arg0, f9_arg1 ) + else + DebugPrint( "OnlineVault got notification message with unknown type " .. f9_local0 ) + end +end + +function HandleModeLoadResult( f10_arg0, f10_arg1 ) + if not f10_arg1.controller then + local f10_local0 = Engine.GetFirstActiveController() + end + if f10_arg1.success then + LUI.FlowManager.RequestPopupMenu( f10_arg0, "online_vault_load_mode_success_popup", true, f10_arg1.controller, true ) + else + LUI.FlowManager.RequestPopupMenu( f10_arg0, "online_vault_load_mode_fail_popup", true, f10_arg1.controller, true ) + end +end + +function HandleModeSaveResult( f11_arg0, f11_arg1 ) + if not f11_arg1.controller then + local f11_local0 = Engine.GetFirstActiveController() + end + local f11_local1 = f11_arg1.success + local f11_local2 = nil + if f11_local1 then + f11_local2 = Engine.Localize( "@MENU_CGM_SAVE_SUCCESS" ) + else + f11_local2 = Engine.Localize( "@MENU_CGM_SAVE_FAILED" ) + end + LUI.FlowManager.RequestPopupMenu( f11_arg0, "online_vault_save_mode_result_popup", true, f11_arg1.controller, true, { + message_text = f11_local2 + } ) +end + +function HandleDeleteResult( f12_arg0, f12_arg1 ) + if not f12_arg1.controller then + local f12_local0 = Engine.GetFirstActiveController() + end + if f12_arg1.success then + LUI.FlowManager.RequestPopupMenu( f12_arg0, "online_vault_delete_success_popup", true, f12_arg1.controller, true ) + else + LUI.FlowManager.RequestPopupMenu( f12_arg0, "online_vault_delete_fail_popup", true, f12_arg1.controller, true ) + end +end + +function SaveVaultItem( f13_arg0, f13_arg1 ) + OnlineVault.Save( f13_arg1.controller, f13_arg0.properties.callback_params.saveToSlot ) + LUI.FlowManager.RequestPopupMenu( f13_arg0, "online_vault_please_wait_popup", true, controller, false ) +end + +function ViewScreenshot( f14_arg0, f14_arg1 ) + local f14_local0 = f14_arg1.controller + if not f14_local0 then + f14_local0 = Engine.GetFirstActiveController() + end + local f14_local1 = f14_arg0.properties.callback_params.slotIndex + LUI.FlowManager.RequestLeaveMenu( f14_arg0 ) + f14_arg0:dispatchEventToRoot( { + name = "open_screenshot_viewer", + controller = f14_local0, + slotIndex = f14_local1, + dispatchChildren = true, + immediate = false + } ) +end + +function OpenScreenshotViewer( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg1.controller + if not f15_local0 then + f15_local0 = Engine.GetFirstActiveController() + end + OnlineVault.LoadItem( f15_local0, f15_arg1.slotIndex ) +end + +function DoDeleteConfirm( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg1.controller + if not f16_local0 then + f16_local0 = Engine.GetFirstActiveController() + end + LUI.FlowManager.RequestPopupMenu( f16_arg0, "online_vault_confirm_delete_popup", true, f16_local0, true, { + callback_params = { + deleteSlot = f16_arg0.properties.callback_params.slotIndex + } + } ) +end + +function OnConfirmDelete( f17_arg0, f17_arg1 ) + local f17_local0 = f17_arg1.controller + if not f17_local0 then + f17_local0 = Engine.GetFirstActiveController() + end + local f17_local1 = f17_arg0.properties.callback_params.deleteSlot + LUI.FlowManager.RequestPopupMenu( f17_arg0, "online_vault_please_wait_popup", true, f17_local0, false ) + OnlineVault.DeleteItem( f17_local0, f17_local1 ) +end + +function VaultEntryFeeder( f18_arg0 ) + local f18_local0 = {} + local f18_local1 = f18_arg0.controller + if not f18_local1 then + f18_local1 = Engine.GetFirstActiveController() + end + local f18_local2 = OnlineVault.GetSlotCount( f18_local1 ) + for f18_local3 = 0, f18_local2 - 1, 1 do + local f18_local6 = OnlineVault.GetItemText( f18_local1, f18_local3 ) + local f18_local7 = OnlineVault.GetItemIcon( f18_local1, f18_local3 ) + if f18_local6 == "" then + f18_local6 = Engine.Localize( "@MPUI_EMPTY" ) + end + f18_local0[#f18_local0 + 1] = { + type = "online_vault_entry_widget", + id = "vault_entry_" .. f18_local3, + disabledFunc = VaultItemDisabled, + properties = { + slot_index = f18_local3, + index_text = f18_local3 + 1, + button_text = f18_local6, + type_image = RegisterMaterial( f18_local7 ) + }, + handlers = { + button_action = MBh.EmitEventToRoot( { + name = "select_item", + controller = f18_local1, + vaultMode = f18_arg0.vaultMode, + idx = f18_local3 + } ), + button_disable = MBh.AnimateToState( "disabled", 0 ), + button_over = MBh.EmitEventToRoot( { + name = "update_selection", + vaultMode = f18_arg0.vaultMode, + idx = f18_local3 + } ), + button_over_disable = MBh.EmitEventToRoot( { + name = "update_selection", + savedMode = f18_arg0.savedMode, + idx = f18_local3 + } ) + } + } + end + return f18_local0 +end + +function DetailTextFactory( f19_arg0, f19_arg1, f19_arg2, f19_arg3, f19_arg4 ) + return { + type = "online_vault_details_text", + id = f19_arg0, + properties = { + label_text = f19_arg1 or "", + value_text = f19_arg2 or "", + label_update_func = f19_arg3, + value_update_func = f19_arg4 + } + } +end + +function GameModeDetailsFeeder( f20_arg0 ) + local f20_local0 = {} + local f20_local1 = {} + local f20_local2 = "online_vault_detail_creator_id" + local f20_local3 = Engine.Localize( "@MPUI_VAULT_CREATOR" ) + local f20_local4, f20_local5 = nil + local f20_local6 = function ( f21_arg0, f21_arg1 ) + f21_arg0:setText( f21_arg1.creator ) + end + + f20_local1[1] = f20_local2 + f20_local1[2] = f20_local3 + f20_local1[3] = f20_local4 + f20_local1[4] = f20_local5 + f20_local1[5] = f20_local6 + f20_local2 = {} + f20_local3 = "online_vault_detail_desc_label_id" + f20_local4 = Engine.Localize( "@MPUI_VAULT_DESCRIPTION" ) + local f20_local5, f20_local6, f20_local7 = nil + f20_local2[1] = f20_local3 + f20_local2[2] = f20_local4 + f20_local2[3] = f20_local5 + f20_local2[4] = f20_local6 + f20_local2[5] = f20_local7 + f20_local3 = {} + f20_local4 = "online_vault_detail_desc_value_id" + f20_local5, f20_local6 = nil + f20_local7 = function ( f22_arg0, f22_arg1 ) + f22_arg0:setText( f22_arg1.desc ) + end + + local f20_local8 = nil + f20_local3[1] = f20_local4 + f20_local3[2] = f20_local5 + f20_local3[3] = f20_local6 + f20_local3[4] = f20_local7 + f20_local3[5] = f20_local8 + f20_local4 = {} + f20_local5 = "online_vault_detail_blank_id" + local f20_local6, f20_local7, f20_local8, f20_local9 = nil + f20_local4[1] = f20_local5 + f20_local4[2] = f20_local6 + f20_local4[3] = f20_local7 + f20_local4[4] = f20_local8 + f20_local4[5] = f20_local9 + f20_local5 = {} + f20_local6 = "online_vault_detail_base_mode_id" + f20_local7 = Engine.Localize( "@MPUI_VAULT_BASEGAMEMODE" ) + f20_local8, f20_local9 = nil + local f20_local10 = function ( f23_arg0, f23_arg1 ) + f23_arg0:setText( f23_arg1.baseMode ) + end + + f20_local5[1] = f20_local6 + f20_local5[2] = f20_local7 + f20_local5[3] = f20_local8 + f20_local5[4] = f20_local9 + f20_local5[5] = f20_local10 + f20_local0[1] = f20_local1 + f20_local0[2] = f20_local2 + f20_local0[3] = f20_local3 + f20_local0[4] = f20_local4 + f20_local0[5] = f20_local5 + f20_local1 = {} + for f20_local5, f20_local6 in pairs( f20_local0 ) do + f20_local1[f20_local5] = DetailTextFactory( f20_local6[1], f20_local6[2], f20_local6[3], f20_local6[4], f20_local6[5] ) + end + return f20_local1 +end + +function ScreenshotDetailsFeeder( f24_arg0 ) + local f24_local0 = {} + local f24_local1 = {} + local f24_local2 = "online_vault_detail_creator_id" + local f24_local3 = Engine.Localize( "@MPUI_VAULT_CREATOR" ) + local f24_local4, f24_local5 = nil + local f24_local6 = function ( f25_arg0, f25_arg1 ) + f25_arg0:setText( f25_arg1.creator ) + end + + f24_local1[1] = f24_local2 + f24_local1[2] = f24_local3 + f24_local1[3] = f24_local4 + f24_local1[4] = f24_local5 + f24_local1[5] = f24_local6 + f24_local2 = {} + f24_local3 = "online_vault_detail_mode_id" + f24_local4 = Engine.Localize( "@MPUI_VAULT_GAMETYPE" ) + f24_local5, f24_local6 = nil + local f24_local7 = function ( f26_arg0, f26_arg1 ) + f26_arg0:setText( f26_arg1.baseMode ) + end + + f24_local2[1] = f24_local3 + f24_local2[2] = f24_local4 + f24_local2[3] = f24_local5 + f24_local2[4] = f24_local6 + f24_local2[5] = f24_local7 + f24_local3 = {} + f24_local4 = "online_vault_detail_map_id" + f24_local5 = Engine.Localize( "@MPUI_VAULT_MAP" ) + f24_local6, f24_local7 = nil + local f24_local8 = function ( f27_arg0, f27_arg1 ) + f27_arg0:setText( f27_arg1.map ) + end + + f24_local3[1] = f24_local4 + f24_local3[2] = f24_local5 + f24_local3[3] = f24_local6 + f24_local3[4] = f24_local7 + f24_local3[5] = f24_local8 + f24_local4 = {} + f24_local5 = "online_vault_detail_create_time_id" + f24_local6 = Engine.Localize( "@MPUI_VAULT_DATETIME" ) + f24_local7, f24_local8 = nil + local f24_local9 = function ( f28_arg0, f28_arg1 ) + f28_arg0:setText( f28_arg1.timestamp ) + end + + f24_local4[1] = f24_local5 + f24_local4[2] = f24_local6 + f24_local4[3] = f24_local7 + f24_local4[4] = f24_local8 + f24_local4[5] = f24_local9 + f24_local5 = {} + f24_local6 = "online_vault_detail_desc_label_id" + f24_local7 = Engine.Localize( "@MPUI_VAULT_DESCRIPTION" ) + local f24_local8, f24_local9, f24_local10 = nil + f24_local5[1] = f24_local6 + f24_local5[2] = f24_local7 + f24_local5[3] = f24_local8 + f24_local5[4] = f24_local9 + f24_local5[5] = f24_local10 + f24_local6 = {} + f24_local7 = "online_vault_detail_desc_value_id" + f24_local8, f24_local9 = nil + f24_local10 = function ( f29_arg0, f29_arg1 ) + f29_arg0:setText( f29_arg1.desc ) + end + + local f24_local11 = nil + f24_local6[1] = f24_local7 + f24_local6[2] = f24_local8 + f24_local6[3] = f24_local9 + f24_local6[4] = f24_local10 + f24_local6[5] = f24_local11 + f24_local0[1] = f24_local1 + f24_local0[2] = f24_local2 + f24_local0[3] = f24_local3 + f24_local0[4] = f24_local4 + f24_local0[5] = f24_local5 + f24_local0[6] = f24_local6 + f24_local1 = {} + for f24_local5, f24_local6 in pairs( f24_local0 ) do + f24_local1[f24_local5] = DetailTextFactory( f24_local6[1], f24_local6[2], f24_local6[3], f24_local6[4], f24_local6[5] ) + end + return f24_local1 +end + +function ClipDetailsFeeder( f30_arg0 ) + local f30_local0 = {} + local f30_local1 = {} + for f30_local5, f30_local6 in pairs( f30_local0 ) do + f30_local1[f30_local5] = DetailTextFactory( f30_local6[1], f30_local6[2], f30_local6[3], f30_local6[4], f30_local6[5] ) + end + return f30_local1 +end + +function FilmDetailsFeeder( f31_arg0 ) + local f31_local0 = {} + local f31_local1 = {} + local f31_local2 = "online_vault_detail_creator_id" + local f31_local3 = Engine.Localize( "@MPUI_VAULT_CREATOR" ) + local f31_local4, f31_local5 = nil + local f31_local6 = function ( f32_arg0, f32_arg1 ) + f32_arg0:setText( f32_arg1.creator ) + end + + f31_local1[1] = f31_local2 + f31_local1[2] = f31_local3 + f31_local1[3] = f31_local4 + f31_local1[4] = f31_local5 + f31_local1[5] = f31_local6 + f31_local2 = {} + f31_local3 = "online_vault_detail_mode_id" + f31_local4 = Engine.Localize( "@MPUI_VAULT_GAMETYPE" ) + f31_local5, f31_local6 = nil + local f31_local7 = function ( f33_arg0, f33_arg1 ) + f33_arg0:setText( f33_arg1.baseMode ) + end + + f31_local2[1] = f31_local3 + f31_local2[2] = f31_local4 + f31_local2[3] = f31_local5 + f31_local2[4] = f31_local6 + f31_local2[5] = f31_local7 + f31_local3 = {} + f31_local4 = "online_vault_detail_map_id" + f31_local5 = Engine.Localize( "@MPUI_VAULT_MAP" ) + f31_local6, f31_local7 = nil + local f31_local8 = function ( f34_arg0, f34_arg1 ) + f34_arg0:setText( f34_arg1.map ) + end + + f31_local3[1] = f31_local4 + f31_local3[2] = f31_local5 + f31_local3[3] = f31_local6 + f31_local3[4] = f31_local7 + f31_local3[5] = f31_local8 + f31_local4 = {} + f31_local5 = "online_vault_detail_duration_id" + f31_local6 = Engine.Localize( "@MPUI_VAULT_DURATION" ) + f31_local7, f31_local8 = nil + local f31_local9 = function ( f35_arg0, f35_arg1 ) + f35_arg0:setText( f35_arg1.duration ) + end + + f31_local4[1] = f31_local5 + f31_local4[2] = f31_local6 + f31_local4[3] = f31_local7 + f31_local4[4] = f31_local8 + f31_local4[5] = f31_local9 + f31_local5 = {} + f31_local6 = "online_vault_detail_desc_label_id" + f31_local7 = Engine.Localize( "@MPUI_VAULT_DESCRIPTION" ) + local f31_local8, f31_local9, f31_local10 = nil + f31_local5[1] = f31_local6 + f31_local5[2] = f31_local7 + f31_local5[3] = f31_local8 + f31_local5[4] = f31_local9 + f31_local5[5] = f31_local10 + f31_local6 = {} + f31_local7 = "online_vault_detail_desc_value_id" + f31_local8, f31_local9 = nil + f31_local10 = function ( f36_arg0, f36_arg1 ) + f36_arg0:setText( f36_arg1.desc ) + end + + local f31_local11 = nil + f31_local6[1] = f31_local7 + f31_local6[2] = f31_local8 + f31_local6[3] = f31_local9 + f31_local6[4] = f31_local10 + f31_local6[5] = f31_local11 + f31_local0[1] = f31_local1 + f31_local0[2] = f31_local2 + f31_local0[3] = f31_local3 + f31_local0[4] = f31_local4 + f31_local0[5] = f31_local5 + f31_local0[6] = f31_local6 + f31_local1 = {} + for f31_local5, f31_local6 in pairs( f31_local0 ) do + f31_local1[f31_local5] = DetailTextFactory( f31_local6[1], f31_local6[2], f31_local6[3], f31_local6[4], f31_local6[5] ) + end + return f31_local1 +end + +function DetailsFeeder( f37_arg0 ) + local f37_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "online_vault_main" ) + local f37_local1 = f37_local0.itemType + if f37_local1 == FileTypes.Film then + return FilmDetailsFeeder( f37_arg0 ) + elseif f37_local1 == FileTypes.Clip then + return ClipDetailsFeeder( f37_arg0 ) + elseif f37_local1 == FileTypes.Screenshot then + return ScreenshotDetailsFeeder( f37_arg0 ) + elseif f37_local1 == FileTypes.CustomGame then + return GameModeDetailsFeeder( f37_arg0 ) + else + DebugPrint( "OnlineVault attempting to get details for unsupported type!" ) + return {} + end +end + +function BrowseRenameOption( f38_arg0 ) + return { + type = "UIGenericButton", + id = f38_arg0 or "browse_rename_option_id", + disabled = true, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_ONLINEVAULT_RENAME" ), + callback_params = MBh.Property( "callback_params" ), + button_action_func = RenameVaultItem + } + } +end + +function BrowseDeleteOption( f39_arg0 ) + return { + type = "UIGenericButton", + id = f39_arg0 or "browse_delete_option_id", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_ONLINEVAULT_DELETE" ), + callback_params = MBh.Property( "callback_params" ), + button_action_func = DoDeleteConfirm + } + } +end + +function BrowseScreenshotFeeder( f40_arg0 ) + local f40_local0 = {} + local f40_local1 = { + type = "UIGenericButton", + id = "browse_screenshot_view_id", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_ONLINEVAULT_VIEW" ), + callback_params = MBh.Property( "callback_params" ), + button_action_func = ViewScreenshot + } + } + local f40_local2 = { + type = "UIGenericButton", + id = "browse_screenshot_share", + disabled = true, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_ONLINEVAULT_FACEBOOK" ), + callback_params = MBh.Property( "callback_params" ) + } + } + local f40_local3 = BrowseRenameOption( "browse_screenshot_rename" ) + local f40_local4 = BrowseDeleteOption( "browse_screenshot_delete_id" ) + return f40_local1 +end + +function BrowseGameModeFeeder( f41_arg0 ) + local f41_local0 = {} + local f41_local1 = BrowseRenameOption( "browse_mode_rename_id" ) + local f41_local2 = BrowseDeleteOption( "browse_mode_delete_id" ) + return f41_local1 +end + +function BrowseFilmFeeder( f42_arg0 ) + local f42_local0 = {} + local f42_local1 = { + type = "UIGenericButton", + id = "browse_film_play_id", + disabled = true, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_ONLINEVAULT_PLAY" ), + callback_params = MBh.Property( "callback_params" ) + } + } + local f42_local2 = BrowseRenameOption( "browse_film_rename" ) + local f42_local3 = BrowseDeleteOption( "browse_film_delete_id" ) + return f42_local1 +end + +function online_vault_fetching_popup() + return { + type = "generic_confirmation_popup", + id = "online_vault_fetching_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_PLEASE_WAIT" ), + message_text = Engine.Localize( "@MENU_ONLINEVAULT_FETCHING" ), + button_text = Engine.Localize( "@MENU_CANCEL" ), + confirmation_action = CancelFetch + }, + handlers = { + live_storage_private_data_update = MBh.LeaveMenu() + } + } +end + +function online_vault_please_wait_popup() + return { + type = "generic_popup_message", + id = "online_vault_please_wait_popup_id", + properties = { + message_text = Engine.Localize( "@MENU_PLEASE_WAIT" ) + } + } +end + +function online_vault_load_mode_success_popup() + return { + type = "generic_confirmation_popup", + id = "online_vault_load_mode_success_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_ONLINEVAULT_CAPS" ), + message_text = Engine.Localize( "@MENU_CGM_LOAD_SUCCESS" ), + button_text = Engine.Localize( "@MENU_OK" ), + confirmation_action = MBh.EmitEventToRoot( { + name = "leave_vault", + restoreMenu = "gamesetup_menu_main", + dispatchChildren = true, + immediate = true + } ) + } + } +end + +function online_vault_save_mode_result_popup() + return { + type = "generic_confirmation_popup", + id = "online_vault_save_mode_result_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_ONLINEVAULT_CAPS" ), + button_text = Engine.Localize( "@MENU_OK" ), + confirmation_action = MBh.EmitEventToRoot( { + name = "leave_vault", + dispatchChildren = true, + immediate = true + } ) + } + } +end + +function online_vault_load_mode_fail_popup() + return { + type = "generic_confirmation_popup", + id = "online_vault_load_mode_fail_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_ONLINEVAULT_CAPS" ), + message_text = Engine.Localize( "@MENU_CGM_LOAD_FAILED" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } +end + +function online_vault_confirm_overwrite_popup() + return { + type = "generic_yesno_popup", + id = "online_vault_confirm_overwrite_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_ONLINEVAULT_CONFIRM_OVERWRITE" ), + callback_params = { + saveToSlot = -1 + }, + yes_action = SaveVaultItem + } + } +end + +function online_vault_browse_cgm_popup() + return { + type = "generic_selectionList_popup", + id = "online_vault_browse_cgm_popup_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ), + popup_childfeeder = BrowseGameModeFeeder + } + } +end + +function online_vault_browse_screenshot_popup() + return { + type = "generic_selectionList_popup", + id = "online_vault_browse_screenshot_popup_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ), + popup_childfeeder = BrowseScreenshotFeeder, + callback_params = { + slotIndex = -1 + } + } + } +end + +function online_vault_browse_film_popup() + return { + type = "generic_selectionList_popup", + id = "online_vault_browse_film_popup_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ), + popup_childfeeder = BrowseFilmFeeder, + callback_params = { + slotIndex = -1 + } + } + } +end + +function online_vault_browse_clip_popup() + return { + type = "generic_selectionList_popup", + id = "online_vault_browse_clip_popup_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ), + popup_childfeeder = BrowseClipFeeder, + callback_params = { + slotIndex = -1 + } + } + } +end + +function online_vault_confirm_delete_popup() + return { + type = "generic_yesno_popup", + id = "online_vault_confirm_delete_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_WARNING" ), + message_text = Engine.Localize( "@MENU_ONLINEVAULT_CONFIRM_DELETE" ), + callback_params = { + deleteSlot = -1 + }, + yes_action = OnConfirmDelete + } + } +end + +function online_vault_delete_success_popup() + return { + type = "generic_confirmation_popup", + id = "online_vault_delete_success_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_ONLINEVAULT_CAPS" ), + message_text = Engine.Localize( "@MENU_VAULT_DEL_SUCCESS" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } +end + +function online_vault_delete_fail_popup() + return { + type = "generic_confirmation_popup", + id = "online_vault_delete_fail_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_ONLINEVAULT_CAPS" ), + message_text = Engine.Localize( "@MENU_VAULT_DEL_FAILED" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } +end + +function online_vault_entry_widget() + return { + type = "UIButton", + focusable = true, + properties = { + slot_index = 0, + index_text = "", + button_text = "", + button_height = GenericButtonDims.button_height + 15, + type_image = RegisterMaterial( "menu_mp_lobby_icon_film" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = MBh.Property( "button_height" ) + } + }, + children = { + { + type = "UIGenericButton", + properties = { + button_text = MBh.Property( "button_text" ) + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 10, + bottom = -10, + left = -50, + right = -25, + material = MBh.Property( "type_image" ), + alpha = 1 + }, + disabled = { + alpha = 0 + } + }, + handlers = { + button_disable = MBh.AnimateToState( "disabled", 0 ) + } + }, + { + type = "UIText", + id = "entry_index_text_id", + properties = { + text = MBh.Property( "index_text" ) + }, + states = { + default = { + left = 0, + top = 0, + width = 20, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } + } + } + } + } +end + +function online_vault_details_text() + return { + type = "UIElement", + properties = { + label_text = "", + value_text = "", + label_update_func = function ( f58_arg0, f58_arg1 ) + + end + , + value_update_func = function ( f59_arg0, f59_arg1 ) + + end + + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = GenericButtonDims.button_height, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIText", + id = "online_vault_detail_label_id", + properties = { + text = MBh.Property( "label_text" ), + label_update_func = MBh.Property( "label_update_func" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 480, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } + }, + handlers = { + update_details = MBh.Property( "label_update_func" ) + } + }, + { + type = "UIText", + id = "online_vault_detail_value_id", + properties = { + text = MBh.Property( "value_text" ), + value_update_func = MBh.Property( "value_update_func" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.SmallFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Right + } + }, + handlers = { + update_details = MBh.Property( "value_update_func" ) + } + } + } + } +end + +function online_vault_details_widget() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 120, + bottom = 600, + left = 560, + right = 1040 + } + }, + children = { + { + type = "generic_menu_titlebar", + id = "online_vault_details_title", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = "Item Details", + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left + }, + handlers = { + update_details = function ( f61_arg0, f61_arg1 ) + f61_arg0:processEvent( { + name = "update_title", + dispatchChildren = true, + title_text = f61_arg1.title + } ) + end + + } + }, + { + type = "generic_menu_background", + id = "online_vault_details_window_bg", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + } + } + }, + { + type = "UIImage", + id = "online_vault_details_image", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "" ), + left = 10, + right = -10, + top = GenericTitleBarDims.TitleBarHeight + 10, + height = 240 + } + }, + handlers = { + update_details = function ( f62_arg0, f62_arg1 ) + f62_arg0:setImage( RegisterMaterial( f62_arg1.image ) ) + end + + } + }, + { + type = "UIVerticalList", + id = "online_vault_details_vlist", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 250 + 4, + bottom = 600, + left = 4, + right = -4, + spacing = 2 + } + }, + handlers = { + refresh_details = DoRefresh + }, + childrenFeeder = DetailsFeeder + } + } + } +end + +function online_vault_main() + return { + type = "UIElement", + id = "online_vault_root", + properties = { + menu_title = Engine.Localize( "@MPUI_ONLINE_VAULT" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OnCreate, + select_item = OnActionButton, + update_selection = UpdateSelection, + vault_notification = HandleVaultNotification, + leave_vault = LeaveVault, + open_screenshot_viewer = OpenScreenshotViewer + }, + children = { + { + type = "generic_menu_title", + id = "online_vault_title_id", + properties = { + menu_title = MBh.Property( "menu_title" ) + } + }, + { + type = "UIVerticalList", + id = "vault_entry_vlist_id", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + vault_refresh = DoRefresh, + live_storage_private_data_update = DoRefresh + }, + childrenFeeder = VaultEntryFeeder + }, + { + type = "online_vault_details_widget", + id = "online_vault_details_widget_id" + }, + { + type = "online_friends_widget", + id = "online_vault_friends_widget_id" + }, + { + type = "UIBindButton", + id = "online_vault_bind_button_id", + handlers = { + button_secondary = LeaveVault + } + }, + { + type = "button_helper_text_main", + id = "online_vault_helper_text_id" + } + } + } +end + +LUI.MenuBuilder.registerDef( "online_vault_main", online_vault_main ) +LUI.MenuBuilder.registerDef( "online_vault_entry_widget", online_vault_entry_widget ) +LUI.MenuBuilder.registerDef( "online_vault_fetching_popup", online_vault_fetching_popup ) +LUI.MenuBuilder.registerDef( "online_vault_load_mode_success_popup", online_vault_load_mode_success_popup ) +LUI.MenuBuilder.registerDef( "online_vault_load_mode_fail_popup", online_vault_load_mode_fail_popup ) +LUI.MenuBuilder.registerDef( "online_vault_confirm_overwrite_popup", online_vault_confirm_overwrite_popup ) +LUI.MenuBuilder.registerDef( "online_vault_details_widget", online_vault_details_widget ) +LUI.MenuBuilder.registerDef( "online_vault_details_text", online_vault_details_text ) +LUI.MenuBuilder.registerDef( "online_vault_browse_screenshot_popup", online_vault_browse_screenshot_popup ) +LUI.MenuBuilder.registerDef( "online_vault_browse_cgm_popup", online_vault_browse_cgm_popup ) +LUI.MenuBuilder.registerDef( "online_vault_browse_film_popup", online_vault_browse_film_popup ) +LUI.MenuBuilder.registerDef( "online_vault_browse_clip_popup", online_vault_browse_clip_popup ) +LUI.MenuBuilder.registerDef( "online_vault_confirm_delete_popup", online_vault_confirm_delete_popup ) +LUI.MenuBuilder.registerDef( "online_vault_delete_success_popup", online_vault_delete_success_popup ) +LUI.MenuBuilder.registerDef( "online_vault_delete_fail_popup", online_vault_delete_fail_popup ) +LUI.MenuBuilder.registerDef( "online_vault_please_wait_popup", online_vault_please_wait_popup ) +LUI.MenuBuilder.registerDef( "online_vault_save_mode_result_popup", online_vault_save_mode_result_popup ) +LockTable( _M ) diff --git a/lui/mp_menus/mpplayerpopups.dec.lua b/lui/mp_menus/mpplayerpopups.dec.lua new file mode 100644 index 0000000..28796b5 --- /dev/null +++ b/lui/mp_menus/mpplayerpopups.dec.lua @@ -0,0 +1,524 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +if not LobbyMember then + LobbyMember = {} +end +LobbyMember.ReportPlayerButtonAction = function ( f1_arg0, f1_arg1 ) + LUI.FlowManager.RequestPopupMenu( f1_arg0, "popup_friend_report", true, f1_arg1.controller, false, { + friendIndex = -1, + reportFunction = LobbyMember.SelectedMember_Report, + confirmationAction = function ( f2_arg0, f2_arg1, f2_arg2 ) + LUI.FlowManager.RequestPopupMenu( f2_arg0, "popup_confirm_report", true, controller, false, { + message_text = f2_arg2 + } ) + end + } ) +end + +LobbyMember.Options = { + xboxProfile = { + text = "@XBOXLIVE_VIEW_PROFILE", + action = LobbyMember.SelectedMember_ShowGamerCard, + disabled = function () + return not Engine.GetDvarBool( "party_playervisible" ) + end + }, + psSendFriendInvite = { + text = "@XBOXLIVE_ADDFRIEND", + action = LobbyMember.SelectedMember_AddFriend, + disabled = function () + local f4_local0 + if Engine.GetDvarBool( "party_playervisible" ) then + f4_local0 = Engine.GetDvarBool( "party_IsLocalClientSelected" ) + if not f4_local0 then + f4_local0 = LobbyMember.SelectedMember_IsFriend() + if not f4_local0 then + f4_local0 = LobbyMember.SelectedMember_IsGuest() + end + end + else + f4_local0 = true + end + return f4_local0 + end + }, + inviteToClan = { + text = "@LUA_MENU_CLAN_INVITE_TO_CLAN", + action = function ( f5_arg0, f5_arg1 ) + if Engine.IsChatRestricted() then + LUI.FlowManager.RequestPopupMenu( f5_arg0, "user_generated_content_restriction_popup", true, f5_arg1.controller ) + else + LobbyMember.SelectedMember_InviteToClan( f5_arg1.controller ) + end + end, + disabled = function ( f6_arg0 ) + local f6_local0 + if LobbyMember.SelectedMember_CanInviteToClan( f6_arg0 ) and Engine.GetDvarBool( "party_playervisible" ) then + f6_local0 = LobbyMember.SelectedMember_IsGuest() + else + f6_local0 = true + end + return f6_local0 + end + }, + viewClan = function ( f7_arg0, f7_arg1, f7_arg2 ) + local f7_local0 = Lobby.GetMemberName( f7_arg0, f7_arg1, f7_arg2 ) + return { + text = "@CLANS_VIEW_CLAN", + action = function ( f8_arg0, f8_arg1 ) + if not CoDAnywhere.ServiceAvailable( f8_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f8_arg0, "generic_confirmation_popup", true, f8_arg1.controller, false, { + popup_title = Engine.Localize( "MENU_ERROR" ), + message_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_ERROR_SERVICE" ) + } ) + elseif not CoDAnywhere.HasUCDAccount( f8_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f8_arg0, "generic_confirmation_popup", true, f8_arg1.controller, false, { + popup_title = Engine.Localize( "MENU_NOTICE" ), + message_text = Engine.Localize( "@PATCH_MENU_REQUIRES_COD_ACCOUNT" ) + } ) + else + LobbyMember.SelectedMember_FetchClan( f8_arg1.controller ) + LUI.FlowManager.RequestAddMenu( f8_arg0, "clan_details_main", true, f8_arg1.controller, false, { + remoteView = true, + remotePlayerName = f7_local0 + } ) + end + end + , + disabled = function ( f9_arg0 ) + local f9_local0 = LobbyMember.SelectedMember_IsGuest() + if not f9_local0 then + if Engine.GetDvarBool( "party_playervisible" ) then + f9_local0 = not Lobby.IsInClan( f7_arg0, f7_arg1, f7_arg2, f9_arg0 ) + else + f9_local0 = true + end + end + return f9_local0 + end + + } + end, + toggleMute = { + text = "@XBOXLIVE_PLAYER_MUTE", + action = LobbyMember.SelectedMember_ToggleMute, + disabled = function () + local f10_local0 = Engine.GetDvarBool( "party_IsLocalClientSelected" ) + if not f10_local0 then + if Engine.GetDvarBool( "party_playervisible" ) then + f10_local0 = LobbyMember.SelectedMember_IsAway() + else + f10_local0 = true + end + end + return f10_local0 + end + }, + showCommonGroups = { + text = "@MENU_SHOW_COMMON_GROUPS", + action = LobbyMember.SelectedMember_ShowCommonGroups, + disabled = function () + local f11_local0 = Engine.GetDvarBool( "party_IsLocalClientSelected" ) + if not f11_local0 then + f11_local0 = not Engine.GetDvarBool( "party_playervisible" ) + end + return f11_local0 + end, + exclude = function ( f12_arg0 ) + return not Engine.UserGroupsAllowed( f12_arg0 ) + end + }, + tryMigrateHost = { + text = "@MPUI_SETASHOST", + action = LobbyMember.SelectedMember_TryMigrateHost, + disabled = function () + local f13_local0 + if Lobby.IsPrivatePartyHost() and Engine.GetDvarBool( "party_playervisible" ) then + f13_local0 = Engine.GetDvarBool( "party_IsLocalClientSelected" ) + if not f13_local0 then + f13_local0 = LobbyMember.SelectedMember_IsAway() + end + else + f13_local0 = true + end + return f13_local0 + end + }, + reportPlayer = { + text = "@MENU_REPORT_PLAYER", + action = LobbyMember.ReportPlayerButtonAction, + disabled = function () + local f14_local0 = Engine.GetDvarBool( "party_IsLocalClientSelected" ) + if not f14_local0 then + f14_local0 = not Engine.GetDvarBool( "party_playervisible" ) + end + return f14_local0 + end + }, + kickPlayer = { + text = "@XBOXLIVE_KICK", + action = LobbyMember.SelectedMember_TryKick, + disabled = function () + local f15_local0 = Lobby.IsPrivatePartyHost() + if f15_local0 then + f15_local0 = IsPublicMatch() + end + local f15_local1 = Lobby.IsGameHost() + if f15_local1 then + f15_local1 = IsPrivateMatch() + end + local f15_local2 = f15_local1 or f15_local0 + local f15_local3 = Engine.GetDvarBool( "party_playervisible" ) + local f15_local4 = Engine.GetDvarBool( "party_IsLocalClientSelected" ) + local f15_local5 + if f15_local2 and f15_local3 then + f15_local5 = f15_local4 + else + f15_local5 = true + end + return f15_local5 + end + }, + makeMLGSpectator = function ( f16_arg0 ) + local f16_local0 = Lobby.IsMemberMLGSpectator( f16_arg0 ) + if not f16_local0 or not "PATCH_MENU_UNSET_MLG_SPECTATOR" then + local f16_local1 = "PATCH_MENU_SET_MLG_SPECTATOR" + end + if CoD.IsUsingAspectRatio( 1.33 ) then + local f16_local1 = "LUA_MENU_MLG_SPECTATOR_DISABLED_ASPECT" + end + return { + text = f16_local1, + action = function ( f17_arg0, f17_arg1 ) + LobbyMember.SelectedMember_SetLocalMemberMLGSpectator( not f16_local0 ) + end + , + disabled = function () + local f18_local0 + if MLG.AreMLGRulesEnabled() and Engine.GetDvarBool( "party_IsLocalClientSelected" ) then + f18_local0 = Engine.GetDvarBool( "splitscreen" ) + if not f18_local0 then + f18_local0 = CoD.IsUsingAspectRatio( 1.33 ) + end + else + f18_local0 = true + end + return f18_local0 + end + + } + end +} +f0_local0 = function ( f19_arg0, f19_arg1, f19_arg2, f19_arg3, f19_arg4 ) + local f19_local0 = Engine.IsXbox360() + if not f19_local0 then + f19_local0 = Engine.IsXB3() + end + local f19_local1 = {} + if Lobby.IsMemberABot( f19_arg0, f19_arg1, f19_arg2 ) then + return { + { + text = "@LUA_MENU_REMOVE_BOT", + customActionFunc = function ( f20_arg0, f20_arg1 ) + Lobby.RemoveMemberBot( f19_arg0, f19_arg1, f19_arg2 ) + end + , + disabled = function () + return not Lobby.IsPrivatePartyHost() + end + + }, + { + variant = "select", + text = "@LUA_MENU_DIFFICULTY", + display = function ( f22_arg0, f22_arg1 ) + local f22_local0 = Lobby.GetMemberBotDifficulty( f19_arg0, f19_arg1, f19_arg2 ) + if f22_local0 == Lobby.BotDifficulties.Recruit then + return Engine.Localize( "@LUA_MENU_BOTS_RECRUIT" ) + elseif f22_local0 == Lobby.BotDifficulties.Regular then + return Engine.Localize( "@LUA_MENU_BOTS_REGULAR" ) + elseif f22_local0 == Lobby.BotDifficulties.Hardened then + return Engine.Localize( "@LUA_MENU_BOTS_HARDENED" ) + elseif f22_local0 == Lobby.BotDifficulties.Veteran then + return Engine.Localize( "@LUA_MENU_BOTS_VETERAN" ) + else + return "FIXME Missing option" + end + end + , + left = function ( f23_arg0, f23_arg1 ) + local f23_local0 = Lobby.GetMemberBotDifficulty( f19_arg0, f19_arg1, f19_arg2 ) + local f23_local1 = Lobby.BotDifficulties.Regular + if f23_local0 == Lobby.BotDifficulties.Recruit then + f23_local1 = Lobby.BotDifficulties.Veteran + elseif f23_local0 == Lobby.BotDifficulties.Regular then + f23_local1 = Lobby.BotDifficulties.Recruit + elseif f23_local0 == Lobby.BotDifficulties.Hardened then + f23_local1 = Lobby.BotDifficulties.Regular + elseif f23_local0 == Lobby.BotDifficulties.Veteran then + f23_local1 = Lobby.BotDifficulties.Hardened + else + f23_local1 = Lobby.BotDifficulties.Regular + end + Lobby.SetMemberBotDifficulty( f19_arg0, f19_arg1, f19_arg2, f23_local1 ) + end + , + right = function ( f24_arg0, f24_arg1 ) + local f24_local0 = Lobby.GetMemberBotDifficulty( f19_arg0, f19_arg1, f19_arg2 ) + local f24_local1 = Lobby.BotDifficulties.Regular + if f24_local0 == Lobby.BotDifficulties.Recruit then + f24_local1 = Lobby.BotDifficulties.Regular + elseif f24_local0 == Lobby.BotDifficulties.Regular then + f24_local1 = Lobby.BotDifficulties.Hardened + elseif f24_local0 == Lobby.BotDifficulties.Hardened then + f24_local1 = Lobby.BotDifficulties.Veteran + elseif f24_local0 == Lobby.BotDifficulties.Veteran then + f24_local1 = Lobby.BotDifficulties.Recruit + else + f24_local1 = Lobby.BotDifficulties.Regular + end + Lobby.SetMemberBotDifficulty( f19_arg0, f19_arg1, f19_arg2, f24_local1 ) + end + , + disabled = function () + return not Lobby.IsPrivatePartyHost() + end + + }, + { + variant = "select", + text = "@LUA_MENU_PERSONALITY", + display = function ( f26_arg0, f26_arg1 ) + return tostring( Lobby.GetMemberBotPersonality( f19_arg0, f19_arg1, f19_arg2 ) ) + end + , + left = function ( f27_arg0, f27_arg1 ) + local f27_local0 = Lobby.GetMemberBotPersonality( f19_arg0, f19_arg1, f19_arg2 ) - 1 + if f27_local0 < 1 then + f27_local0 = 5 + end + Lobby.SetMemberBotPersonality( f19_arg0, f19_arg1, f19_arg2, f27_local0 ) + end + , + right = function ( f28_arg0, f28_arg1 ) + local f28_local0 = Lobby.GetMemberBotPersonality( f19_arg0, f19_arg1, f19_arg2 ) + 1 + if f28_local0 > 5 then + f28_local0 = 1 + end + Lobby.SetMemberBotPersonality( f19_arg0, f19_arg1, f19_arg2, f28_local0 ) + end + , + disabled = function () + return not Lobby.IsPrivatePartyHost() + end + + } + } + elseif f19_arg0 == Lobby.MemberListStates.Prelobby then + if Engine.IsConsoleGame() then + local f19_local2 = {} + local f19_local3 + if f19_local0 or Engine.IsPS4() then + f19_local3 = LobbyMember.Options.xboxProfile + if not f19_local3 then + + else + local f19_local4 = LobbyMember.Options.toggleMute + local f19_local5 = LobbyMember.Options.tryMigrateHost + local f19_local6 = LobbyMember.Options.reportPlayer + local f19_local7 = LobbyMember.Options.kickPlayer + f19_local2[1] = f19_local3 + f19_local2[2] = f19_local4 + f19_local2[3] = f19_local5 + f19_local2[4] = f19_local6 + f19_local2[5] = f19_local7 + f19_local1 = f19_local2 + end + end + f19_local3 = LobbyMember.Options.psSendFriendInvite + else + f19_local1 = { + LobbyMember.Options.toggleMute, + LobbyMember.Options.tryMigrateHost, + LobbyMember.Options.reportPlayer, + LobbyMember.Options.kickPlayer + } + end + elseif f19_arg0 == Lobby.MemberListStates.Lobby or f19_arg0 == Lobby.MemberListStates.Teams then + if f19_arg4 then + f19_local1 = {} + if Engine.IsConsoleGame() then + local f19_local2 = #f19_local1 + 1 + local f19_local3 + if f19_local0 or Engine.IsPS4() then + f19_local3 = LobbyMember.Options.xboxProfile + if not f19_local3 then + + else + f19_local1[f19_local2] = f19_local3 + end + end + f19_local3 = LobbyMember.Options.psSendFriendInvite + end + f19_local1[#f19_local1 + 1] = LobbyMember.Options.toggleMute + f19_local1[#f19_local1 + 1] = LobbyMember.Options.kickPlayer + f19_local1[#f19_local1 + 1] = LobbyMember.Options.reportPlayer + if MLG.IsFeatureAvailable() then + f19_local1[#f19_local1 + 1] = LobbyMember.Options.makeMLGSpectator( f19_arg1 ) + end + elseif f19_arg3 then + if Engine.IsConsoleGame() then + local f19_local2 = {} + local f19_local3 + if f19_local0 or Engine.IsPS4() then + f19_local3 = LobbyMember.Options.xboxProfile + if not f19_local3 then + + else + local f19_local4 = LobbyMember.Options.toggleMute + local f19_local5 = LobbyMember.Options.reportPlayer + f19_local2[1] = f19_local3 + f19_local2[2] = f19_local4 + f19_local2[3] = f19_local5 + f19_local1 = f19_local2 + end + end + f19_local3 = LobbyMember.Options.psSendFriendInvite + else + f19_local1 = { + LobbyMember.Options.toggleMute, + LobbyMember.Options.reportPlayer + } + end + end + end + if Clan.IsEnabled() then + f19_local1[#f19_local1 + 1] = LobbyMember.Options.inviteToClan + end + if Clan.IsRemoteViewEnabled() and not Engine.IsAliensMode() then + f19_local1[#f19_local1 + 1] = LobbyMember.Options.viewClan( f19_arg0, f19_arg1, f19_arg2 ) + end + return f19_local1 +end + +function playerPopupMenuFeeder( f30_arg0 ) + assert( f30_arg0.memberListState ) + assert( f30_arg0.memberSlot ) + assert( f30_arg0.team ) + assert( f30_arg0.exclusiveController ) + local f30_local0 = f30_arg0.exclusiveController + local f30_local1 = Lobby.IsMemberAISquadMember( f30_arg0.memberListState, f30_arg0.memberSlot, f30_arg0.team ) + if not f30_local1 then + LobbyMember.SelectMember( f30_arg0.exclusiveController, f30_arg0.memberListState, f30_arg0.memberSlot, f30_arg0.team ) + end + local f30_local2 = f0_local0( f30_arg0.memberListState, f30_arg0.memberSlot, f30_arg0.team, f30_arg0.isPublicLobby, f30_arg0.isPrivateLobby ) + local f30_local3 = {} + for f30_local4 = 1, #f30_local2, 1 do + local f30_local7 = f30_local4 + if not f30_local2[f30_local7].exclude or f30_local2[f30_local7].exclude( f30_local0 ) == false then + if f30_local2[f30_local7].variant and f30_local2[f30_local7].variant == "select" then + f30_local3[#f30_local3 + 1] = { + type = "UIGenericButton", + id = "member_option_" .. f30_local7, + disabled = f30_local2[f30_local7].disabled( f30_local0 ) or f30_local1, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f30_local2[f30_local7].text ), + button_display_func = f30_local2[f30_local7].display, + button_left_func = f30_local2[f30_local7].left, + button_right_func = f30_local2[f30_local7].right + } + } + else + f30_local3[#f30_local3 + 1] = { + type = "UIGenericButton", + id = "member_option_" .. f30_local7, + disabled = f30_local2[f30_local7].disabled( f30_local0 ) or f30_local1, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( f30_local2[f30_local7].text ), + button_action_func = function ( f31_arg0, f31_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f31_arg0 ) + if f30_local2[f30_local7].customActionFunc then + f30_local2[f30_local7].customActionFunc( f31_arg0, f31_arg1 ) + else + f30_local2[f30_local7].action( f31_arg0, f31_arg1 ) + end + end + } + } + end + end + end + return f30_local3 +end + +function player_popup_party() + return { + type = "generic_selectionList_popup", + id = "player_popup_menu_id", + properties = { + memberSlot = nil, + memberListState = nil, + team = nil, + popup_title = Engine.Localize( "@MPUI_PLAYER_OPTIONS" ), + popup_childfeeder = playerPopupMenuFeeder + } + } +end + +function kickwarning() + return { + type = "generic_yesno_popup", + id = "kick_player_question_id", + properties = { + message_text = Engine.GetDvarString( "party_kickplayerquestion" ), + popup_title = Engine.Localize( "@MPUI_KICK_PLAYER" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_NO" ), + yes_action = LobbyMember.SelectedMember_Kick, + default_focus_index = 2 + } + } +end + +function hostchangewarning() + return { + type = "generic_yesno_popup", + id = "migrate_host_question_id", + properties = { + message_text = Engine.GetDvarString( "party_makehostquestion" ), + popup_title = Engine.Localize( "@MPUI_CHANGEHOSTTITLE" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_NO" ), + yes_action = LobbyMember.SelectedMember_MigrateHost, + default_focus_index = 2 + } + } +end + +function playerUnmutable() + return { + type = "generic_confirmation_popup", + id = "player_unmutable_popup_id", + properties = { + message_text = Engine.Localize( "@XBOXLIVE_EXTERNALMUTE_TITLE" ), + popup_title = Engine.Localize( "@MENU_NOTICE" ), + button_text = Engine.Localize( "@MENU_OK" ), + confirmation_action = nil, + dialog_top = -75, + dialog_bottom = 75 + } + } +end + +LUI.MenuBuilder.registerDef( "player_popup_party", player_popup_party ) +LUI.MenuBuilder.registerDef( "kickwarning", kickwarning ) +LUI.MenuBuilder.registerDef( "hostchangewarning", hostchangewarning ) +LUI.MenuBuilder.registerDef( "playerUnmutable", playerUnmutable ) +LockTable( _M ) diff --git a/lui/mp_menus/mpplaylist.dec.lua b/lui/mp_menus/mpplaylist.dec.lua new file mode 100644 index 0000000..8da8a4e --- /dev/null +++ b/lui/mp_menus/mpplaylist.dec.lua @@ -0,0 +1,1031 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function EmitPlaylistSelectionUpdate( f1_arg0, f1_arg1 ) + local f1_local0 = f1_arg0.properties.category + local f1_local1 = f1_arg0.properties.index + f1_arg0:dispatchEventToRoot( { + name = "playlist_selection_update", + index = f1_local1, + category = f1_local0, + dispatchChildren = true, + immediate = true + } ) + f1_arg0:dispatchEventToRoot( { + name = "update_players_in_playlist", + category = f1_local0, + index = f1_local1, + dispatchChildren = true, + immediate = true + } ) + local f1_local2 = Playlist.WillCXPBeAwarded() + local f1_local3 = f1_arg0 + local f1_local4 = f1_arg0.dispatchEventToRoot + local f1_local5 = {} + local f1_local6 + if f1_local2 then + f1_local6 = "show_cxp_notification" + if not f1_local6 then + + else + f1_local5.name = f1_local6 + f1_local5.dispatchChildren = true + f1_local5.immediate = true + f1_local4( f1_local3, f1_local5 ) + end + end + f1_local6 = "hide_cxp_notification" +end + +function PlaylistHasClanModifiers( f2_arg0, f2_arg1, f2_arg2 ) + if not Clan.IsEnabled() then + return false + else + local f2_local0 + if not Clan.GetModifierForPlaylist or Clan.GetModifierForPlaylist( f2_arg0, f2_arg1, f2_arg2 ) <= 0 then + f2_local0 = false + else + f2_local0 = true + end + end + return f2_local0 +end + +function DoesAnyPlayerHaveClanModifier( f3_arg0, f3_arg1 ) + for f3_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if PlaylistHasClanModifiers( f3_local0, f3_arg0, f3_arg1 ) then + return true + end + end + return false +end + +function GetModifierText( f4_arg0, f4_arg1 ) + local f4_local0 = "" + local f4_local1 = nil + if not Clan.GetModifierForPlaylist then + return f4_local0 + end + for f4_local2 = 0, Engine.GetMaxControllerCount() - 1, 1 do + f4_local1 = math.floor( Clan.GetModifierForPlaylist( f4_local2, f4_arg0, f4_arg1 ) * 100 + 0.5 ) + if f4_local1 > 0 then + f4_local0 = Engine.Localize( "@CLANS_PLAYLIST_MODIFIER", f4_local1, Engine.MarkLocalized( Clan.GetName( f4_local2 ) ) ) + break + end + end + return f4_local0 +end + +function PlaylistChooseCategory( f5_arg0, f5_arg1 ) + if f5_arg0.properties and f5_arg0.properties.category and f5_arg0.properties.index and Playlist.GetItemEnabled( f5_arg0.properties.category, f5_arg0.properties.index ) then + LUI.FlowManager.RequestPopupMenu( f5_arg0, "playlist_sub_menu", false, f5_arg1.controller, false, { + category = f5_arg0.properties.index + 1, + subtitle_text = Playlist.GetItemName( f5_arg0.properties.category, f5_arg0.properties.index ) + } ) + else + f5_arg0:dispatchEventToParent( { + name = "menu_refresh" + } ) + end +end + +function PlaylistCategoryFeeder( f6_arg0 ) + local f6_local0 = {} + local f6_local1 = 2 + if Engine.IsAliensMode() then + f6_local1 = 3 + elseif Engine.IsSquadVsSquadMode() then + f6_local1 = 4 + end + local f6_local2 = Playlist.GetPreselectedCategory and Playlist.GetPreselectedCategory() or 0 + local f6_local3 = f6_arg0.category + local f6_local4 = Playlist.GetCategoryCount( f6_local3 ) + for f6_local5 = 0, f6_local4 - 1, 1 do + local f6_local8 = { + type = "UIGenericButton", + id = "playlist_cat_button_" .. f6_local5, + audio = { + button_over = CoD.SFX.SubMenuMouseOver + }, + disabled = not Playlist.GetItemEnabled( f6_local3, f6_local5 ), + listDefaultFocus = f6_local5 + 1 == f6_local2, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + index = f6_local5, + category = f6_local3, + button_text = Playlist.GetItemName( f6_local3, f6_local5 ), + button_action_func = PlaylistChooseCategory, + button_over_func = EmitPlaylistSelectionUpdate, + button_over_disable_func = EmitPlaylistSelectionUpdate + } + } + local f6_local9 = Playlist.GetItemCategoryClass( f6_local3, f6_local5 ) + if (f6_local9 == -1 or f6_local9 == 1 or f6_local9 == f6_local1) and Playlist.GetCanShowItem( f6_local3, f6_local5 ) == true then + f6_local0[#f6_local0 + 1] = f6_local8 + end + end + return f6_local0 +end + +function PlaylistMatchmake( f7_arg0, f7_arg1 ) + if f7_arg0.properties and f7_arg0.properties.category and f7_arg0.properties.index and Playlist.GetItemEnabled( f7_arg0.properties.category, f7_arg0.properties.index ) then + local f7_local0 = Playlist.GetItemVideo( f7_arg0.properties.category, f7_arg0.properties.index ) + if f7_local0 and f7_local0 ~= "" and not LUI.mp_menus.Aliens.HasSeenVideo( f7_arg1.controller, f7_local0 ) and not f7_arg1.skipVideo then + local f7_local1 = { + name = "button_action", + target = f7_arg0, + controller = f7_arg1.controller, + skipVideo = true + } + LUI.mp_menus.Aliens.SetHasSeenVideo( f7_arg1.controller, f7_local0 ) + LUI.mp_menus.Aliens.AliensPlayVideo( f7_arg1.controller, f7_local0, f7_local1 ) + elseif Playlist.DoAction( f7_arg0.properties.category, f7_arg0.properties.index, false, false ) then + local f7_local1 = false + local f7_local2 = false + local f7_local3 = {} + if Engine.GetDvarBool( "squad_match" ) then + Squad.StartMatch( f7_arg1.controller, true ) + Engine.SetDvarBool( "squad_find_match", true ) + end + LUI.FlowManager.RequestAddMenu( f7_arg0, "menu_xboxlive_lobby", f7_local2, f7_arg1.controller, f7_local1, f7_local3 ) + end + end +end + +function PlaylistSubMenuFeeder( f8_arg0 ) + local f8_local0 = {} + local f8_local1 = Playlist.GetPreselectedCategory and Playlist.GetPreselectedCategory() or 0 + local f8_local2 = Playlist.GetPreselectedIndexInCategory and Playlist.GetPreselectedIndexInCategory() or 0 + local f8_local3 = f8_arg0.category + local f8_local4 = Playlist.GetCategoryCount( f8_local3 ) + for f8_local5 = 0, f8_local4 - 1, 1 do + local f8_local8 = f8_local5 + local f8_local9 = { + type = "UIGenericButton", + id = "playlist_button_" .. f8_local8, + audio = { + button_over = CoD.SFX.SubMenuMouseOver + }, + disabled = not Playlist.GetItemEnabled( f8_local3, f8_local8 ) + } + local f8_local10 + if f8_local3 ~= f8_local1 or f8_local8 ~= f8_local2 then + f8_local10 = false + else + f8_local10 = true + end + f8_local9.listDefaultFocus = f8_local10 + f8_local9.properties = { + index = f8_local8, + category = f8_local3, + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Playlist.GetItemName( f8_local3, f8_local8 ), + button_action_func = PlaylistMatchmake, + button_over_func = EmitPlaylistSelectionUpdate, + button_over_disable_func = EmitPlaylistSelectionUpdate, + additional_handlers = { + playlist_button_disabled = function ( f9_arg0, f9_arg1 ) + if Playlist.GetItemEnabled( f8_local3, f8_local8 ) then + f9_arg0:processEvent( { + name = "enable" + } ) + else + f9_arg0:processEvent( { + name = "disable" + } ) + end + end + } + } + f8_local9.children = { + { + type = "UITimer", + id = "find_match_playlist_refresh_timer_id", + properties = { + event = "playlist_button_disabled", + interval = 100, + disposable = false, + broadcastToRoot = false + } + } + } + if DoesAnyPlayerHaveClanModifier( f8_local3, f8_local8 ) then + f8_local9.children = { + { + type = "UIImage", + id = "playerlist_button_clan_modifier_image", + states = { + default = { + material = RegisterMaterial( "white" ), + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 12, + left = 0, + right = 12 + } + } + } + } + end + if Playlist.GetCanShowItem( f8_local3, f8_local8 ) == true then + f8_local0[#f8_local0 + 1] = f8_local9 + end + end + return f8_local0 +end + +f0_local0 = function ( f10_arg0, f10_arg1 ) + local f10_local0 = nil + if f10_arg1.category == 0 then + f10_local0 = Playlist.GetActivePlayersCountForCategory( f10_arg1.index + 1 ) + else + f10_local0 = Playlist.GetActivePlayersCount( f10_arg1.category, f10_arg1.index ) + end + f10_arg0:setText( f10_local0 ) +end + +f0_local1 = function ( f11_arg0, f11_arg1 ) + f11_arg0:setText( GetPlayersOnlineText() ) +end + +function playlist_vlist() + return { + type = "UIVerticalList", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 150, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + } + } +end + +function playlist_detailsWidget() + return { + type = "UIElement", + properties = { + headerText = "", + messageText = "" + }, + children = { + { + type = "UIText", + properties = { + text = MBh.Property( "headerText" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = CoD.TextSettings.SmallFont.Height, + left = 0, + right = 0, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alpha = 1 + } + } + }, + { + type = "UIText", + properties = { + text = MBh.Property( "messageText" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -1 * CoD.TextSettings.SmallFont.Height, + bottom = 0, + left = 0, + right = 0, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + alpha = 1 + } + }, + handlers = { + update_players_in_playlist_text = f0_local0, + update_players_online_text = f0_local1 + } + } + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + } +end + +function UpdatePlaylistIcon( f14_arg0, f14_arg1 ) + f14_arg0:setImage( RegisterMaterial( Playlist.GetItemImage( f14_arg1.category, f14_arg1.index ) ) ) +end + +function UpdatePlaylistHeader( f15_arg0, f15_arg1 ) + f15_arg0:setText( Playlist.GetItemName( f15_arg1.category, f15_arg1.index ) ) +end + +function UpdatePlaylistDescription( f16_arg0, f16_arg1 ) + f16_arg0:setText( Playlist.GetItemDesc( f16_arg1.category, f16_arg1.index ) ) +end + +function GetPlayersOnlineText() + return tostring( Playlist.GetTotalActivePlayersCount() ) +end + +function PropagatePlayersInPlaylistUpdate( f18_arg0, f18_arg1 ) + f18_arg0:processEvent( { + name = "update_players_in_playlist_text", + category = f18_arg1.category, + index = f18_arg1.index, + dispatchChildren = true + } ) +end + +function PropagatePlayersOnlineUpdate( f19_arg0, f19_arg1 ) + f19_arg0:processEvent( { + name = "update_players_online_text", + category = f19_arg1.category, + index = f19_arg1.index, + dispatchChildren = true + } ) +end + +function playlist_detailsPanel() + return { + type = "UIElement", + properties = { + headerText = "", + descriptionText = "" + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -25, + bottom = 231, + left = -128, + right = 128, + material = RegisterMaterial( "icon_playlist_generic" ) + } + }, + handlers = { + playlist_selection_update = UpdatePlaylistIcon + } + }, + { + type = "UIText", + properties = { + text = "" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 231, + bottom = 231 + CoD.TextSettings.NormalFont.Height, + left = 5, + right = -5, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alpha = 1 + } + }, + handlers = { + playlist_selection_update = UpdatePlaylistHeader + } + }, + { + type = "UIText", + properties = { + text = "" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 231 + CoD.TextSettings.NormalFont.Height, + bottom = 231 + CoD.TextSettings.NormalFont.Height * 2, + left = 5, + right = -5, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + alpha = 1 + } + }, + handlers = { + playlist_selection_update = UpdatePlaylistDescription + } + }, + { + type = "UIText", + properties = { + text = Engine.Localize( "@CLANS_CXP_AWARDED" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -135, + bottom = -135 + CoD.TextSettings.SmallFont.Height, + left = 5, + right = -5, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + show_cxp_notification = MBh.AnimateToState( "visible", 0 ), + hide_cxp_notification = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "playlist_detailsWidget", + properties = { + headerText = Engine.Localize( "@LUA_MENU_PLAYERS_IN_PLAYLIST" ), + messageText = "" + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -110, + bottom = -70, + left = 5, + right = -5 + } + }, + handlers = { + update_players_in_playlist = PropagatePlayersInPlaylistUpdate + } + }, + { + type = "playlist_detailsWidget", + properties = { + headerText = Engine.Localize( "@LUA_MENU_PLAYERS_ONLINE" ), + messageText = GetPlayersOnlineText() + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -60, + bottom = -20, + left = 5, + right = -5 + } + }, + handlers = { + update_players_in_playlist = PropagatePlayersOnlineUpdate + } + } + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + } +end + +function playlist_titleBar() + return { + type = "UIElement", + properties = { + title_text = "", + subtitle_text = "" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = GenericTitleBarDims.TitleBarHeight, + left = 0, + right = 0 + } + }, + children = { + { + type = "generic_menu_titlebar", + properties = { + font = CoD.TextSettings.ExtraBigFont, + title_bar_text = MBh.Property( "title_text" ), + title_bar_text_indent = 50, + title_bar_alignment = LUI.Alignment.Left, + fill_alpha = 1, + reversed = true + } + }, + { + type = "UIText", + id = "bar_subtitle", + properties = { + text = MBh.Property( "subtitle_text" ) + }, + states = { + default = CoD.ColorizeState( Colors.secondary_text_color, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + right = -35, + width = 200, + height = CoD.TextSettings.SmallFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center + } ) + } + } + } + } +end + +function playlist_main() + return { + type = "UIElement", + id = "playlist_container", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = { + category = 0 + }, + children = { + { + type = "UIImage", + id = "playlist_background_overlay", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIElement", + id = "playlist_menu", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 85, + height = 600, + left = -690, + right = -50 + }, + onScreen = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 85, + height = 600, + left = 0, + right = 640, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + properties = { + category = MBh.Property( "category" ), + title_text = Engine.Localize( "@PLATFORM_FIND_GAME_CAPS" ), + subtitle_text = "" + }, + handlers = { + menu_create = function ( f23_arg0, f23_arg1 ) + f23_arg0:animateToState( "onScreen", 200 ) + end + , + playlist_submenu_open = MBh.AnimateToState( "hidden" ), + playlist_submenu_close = MBh.AnimateToState( "onScreen" ) + }, + children = { + { + type = "playlist_titleBar", + id = "playlist_main_title_bar", + properties = { + title_text = MBh.Property( "title_text" ), + subtitle_text = MBh.Property( "subtitle_text" ) + } + }, + { + type = "generic_menu_background_withfade", + properties = { + shadow_top_offset = 15, + shadow_alpha = 0.5, + fill_alpha = 1 + } + }, + { + type = "UIElement", + id = "playlist_main_container", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 50, + bottom = 0, + left = 65, + right = -260 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "box_white_gradient_top" ), + red = 0, + green = 0, + blue = 0, + alpha = 0.45 + } + } + }, + { + type = "playlist_vlist", + id = "playlist_list", + properties = { + category = MBh.Property( "category" ) + }, + childrenFeeder = PlaylistCategoryFeeder, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + spacing = 3 + } + }, + handlers = { + popup_inactive = function ( f24_arg0, f24_arg1 ) + f24_arg0:processEvent( { + name = "menu_refresh" + } ) + end + + } + } + } + }, + { + type = "playlist_detailsPanel", + id = "playlist_main_details", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 40, + bottom = 0, + left = -256, + right = 0 + } + } + } + } + }, + { + type = "UIBindButton", + id = "playlist_back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +function playlist_sub_menu() + return { + type = "UIElement", + id = "playlist_sub_menu_container", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = { + category = 0, + subtitle_text = "" + }, + handlers = { + menu_create = MBh.EmitEventToRoot( "playlist_submenu_open" ), + menu_close = MBh.EmitEventToRoot( "playlist_submenu_close" ) + }, + children = { + { + type = "UIElement", + id = "playlist_sub_menu", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 85, + height = 600, + left = 0, + right = 640 + } + }, + properties = { + category = MBh.Property( "category" ), + title_text = Engine.Localize( "@MENU_PLAYERMATCH_PLAYLISTS" ), + subtitle_text = MBh.Property( "subtitle_text" ), + barHeight = 32 + }, + children = { + { + type = "playlist_titleBar", + id = "playlist_sub_title_bar", + properties = { + title_text = MBh.Property( "title_text" ), + subtitle_text = MBh.Property( "subtitle_text" ) + } + }, + { + type = "generic_menu_background_withfade", + properties = { + shadow_top_offset = 15, + shadow_alpha = 0.5, + fill_alpha = 1 + } + }, + { + type = "UIElement", + id = "playlist_sub_container", + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "gradient_top" ), + alpha = 0.45 + } + } + }, + { + type = "playlist_vlist", + id = "playlist_list", + properties = { + category = MBh.Property( "category" ) + }, + childrenFeeder = PlaylistSubMenuFeeder, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -30, + left = 0, + right = 0, + spacing = 3 + } + } + }, + { + type = "UIImage", + id = "clan_modifier_desc_background", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -30, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b, + alpha = 0.8 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + playlist_selection_update = function ( f26_arg0, f26_arg1 ) + if DoesAnyPlayerHaveClanModifier( f26_arg1.category, f26_arg1.index ) then + f26_arg0:animateToState( "default", 0 ) + else + f26_arg0:animateToState( "hidden", 0 ) + end + end + + }, + children = { + { + type = "UIMarqueeText", + id = "clan_modifier_desc_text", + properties = { + text = "", + scrollSpeed = 60 + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = CoD.TextSettings.NormalFont.Height * -0.5, + bottom = CoD.TextSettings.NormalFont.Height * 0.5, + left = 10, + right = -10, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } + }, + handlers = { + playlist_selection_update = function ( f27_arg0, f27_arg1 ) + f27_arg0:setText( GetModifierText( f27_arg1.category, f27_arg1.index ) ) + end + + } + } + } + } + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 50, + bottom = 0, + left = 65, + right = -260 + } + } + }, + { + type = "playlist_detailsPanel", + id = "playlist_sub_details", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 40, + bottom = 0, + left = -256, + right = 0 + } + } + } + } + }, + { + type = "UIBindButton", + id = "playlist_back_button", + handlers = { + button_secondary = function ( f28_arg0, f28_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f28_arg0, true ) + end + + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "playlist_detailsWidget", playlist_detailsWidget ) +LUI.MenuBuilder.registerDef( "playlist_detailsPanel", playlist_detailsPanel ) +LUI.MenuBuilder.registerDef( "playlist_main", playlist_main ) +LUI.MenuBuilder.registerDef( "playlist_sub_menu", playlist_sub_menu ) +LUI.MenuBuilder.registerDef( "playlist_vlist", playlist_vlist ) +LUI.MenuBuilder.registerDef( "playlist_titleBar", playlist_titleBar ) +LockTable( _M ) diff --git a/lui/mp_menus/mppopups.dec.lua b/lui/mp_menus/mppopups.dec.lua new file mode 100644 index 0000000..0499e81 --- /dev/null +++ b/lui/mp_menus/mppopups.dec.lua @@ -0,0 +1,1685 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function popup_elite_sell() + return { + type = "generic_yesno_popup", + id = "sell_elite_popup_id", + properties = { + popup_title = Engine.Localize( "@MPUI_ELITE_SELL_TITLE" ), + message_text = Engine.Localize( "@MPUI_ELITE_SELL_DESC" ), + yes_action = eliteConfirmSaleHandler, + yes_text = Engine.Localize( "@MPUI_ELITE_SELL_CONFIRM" ), + no_text = Engine.Localize( "@MPUI_ELITE_SELL_NOTHANKS" ) + } + } +end + +f0_local0 = function ( f2_arg0, f2_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f2_arg0, nil ) +end + +partyEndedDialogHeight = 400 +f0_local1 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = Engine.Localize( "@MENU_NOTICE" ) + local f3_local1 = Engine.Localize( Engine.GetDvarString( "partyend_reason" ) ) + f3_arg0:dispatchEventToChildren( { + name = "update_title", + title_text = f3_local0 + } ) + f3_arg0:dispatchEventToChildren( { + name = "update_message", + message_text = f3_local1 + } ) +end + +f0_local2 = function ( f4_arg0, f4_arg1 ) + Engine.ResolveError( f4_arg1.controller ) + Engine.ClearError( f4_arg1.controller ) +end + +function menu_xboxlive_partyended() + return { + type = "generic_confirmation_popup", + id = "menu_xboxlive_partyended_id", + properties = { + confirmation_action = f0_local2, + dialog_top = -partyEndedDialogHeight / 2, + dialog_bottom = partyEndedDialogHeight / 2 + }, + handlers = { + menu_create = f0_local1, + menu_close = xlivePartyEndedClose, + popup_back = function ( f6_arg0, f6_arg1 ) + if Engine.ClearCompletionResolve then + Engine.ClearCompletionResolve() + end + end + + } + } +end + +function CancelButton( f7_arg0, f7_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f7_arg0 ) +end + +function popup_gettingdata() + return { + type = "live_dialog_text_box_with_cancel", + id = "popup_gettingdata_id", + properties = { + message = Engine.Localize( "@MENU_POPUP_ONLINEDATA" ), + cancel_func = LUI.common_menus.CommonPopups.CancelAcceptingInvite + }, + handlers = { + menu_close = MBh.EmitEventToRoot( { + name = "online_data_finished" + } ) + } + } +end + +function popup_gettinglb() + return { + type = "live_dialog_text_box", + id = "popup_gettinglb_id", + properties = { + message = Engine.Localize( "@MENU_DOWNLOADING" ), + cancel_func = CancelButton + } + } +end + +function popup_getting_socialconfig() + return { + type = "live_dialog_text_box", + id = "popup_getting_socialconfig_id", + properties = { + message = Engine.Localize( "@MENU_PLEASE_WAIT" ) + } + } +end + +function ResetStatsConfirm( f11_arg0, f11_arg1 ) + Engine.ResetStatsConfirm( f11_arg1.controller ) +end + +function ResetStatsCancel( f12_arg0, f12_arg1 ) + Engine.ExecNow( "forcenosplitscreencontrol resetStats_Cancel", f12_arg1.controller ) + Engine.ResetStatsCancel( f12_arg1.controller ) +end + +function menu_resetstats_warning() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.GetDvarString( "com_errorMessage" ), + popup_title = Engine.GetDvarString( "com_errorTitle" ), + yes_text = Engine.Localize( "@MENU_STATS_RESET_YES" ), + no_text = Engine.Localize( "@MENU_STATS_RESET_NO" ), + yes_action = ResetStatsConfirm, + no_action = ResetStatsCancel + } + } +end + +local f0_local3 = function ( f14_arg0, f14_arg1 ) + Engine.Exec( "downloadplaylist", f14_arg1.controller ) +end + +function downloadingplaylist() + return { + type = "generic_confirmation_popup", + id = "menu_xboxlive_downloading_id", + properties = { + confirmation_action = f0_local3, + dialog_top = -100, + dialog_bottom = 100, + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MPUI_DOWNLOADPLAYLIST" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } +end + +local f0_local4 = function ( f16_arg0, f16_arg1 ) + local f16_local0 = Engine.GetDvarString( "com_errorTitle" ) + local f16_local1 = Engine.GetDvarString( "com_errorMessage" ) + f16_arg0:dispatchEventToChildren( { + name = "update_title", + title_text = f16_local0 + } ) + f16_arg0:dispatchEventToChildren( { + name = "update_message", + message_text = f16_local1 + } ) +end + +local f0_local5 = function ( f17_arg0, f17_arg1 ) + Engine.ClearError( f17_arg1.controller ) +end + +function error_popmenu_lobby() + return { + type = "generic_confirmation_popup", + id = "error_popmenu_lobby_id", + properties = { + confirmation_action = f0_local5 + }, + handlers = { + menu_create = f0_local4 + } + } +end + +local f0_local6 = function ( f19_arg0, f19_arg1 ) + local f19_local0 = Engine.Localize( "@MENU_NOTICE" ) + local f19_local1 = Engine.Localize( "@MPUI_YOUAREHOST" ) + f19_arg0:dispatchEventToChildren( { + name = "update_title", + title_text = f19_local0 + } ) + f19_arg0:dispatchEventToChildren( { + name = "update_message", + message_text = f19_local1 + } ) +end + +local f0_local7 = function ( f20_arg0, f20_arg1 ) + +end + +function youarehost() + return { + type = "generic_confirmation_popup", + id = "youarehost", + properties = { + confirmation_action = f0_local7 + }, + handlers = { + menu_create = f0_local6 + } + } +end + +local f0_local8 = function ( f22_arg0, f22_arg1 ) + +end + +function makehostfailed() + return { + type = "generic_confirmation_popup", + id = "makehostfailed", + properties = { + title_text = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( Engine.GetDvarString( "party_makehosterrormsg" ) ), + confirmation_action = f0_local8 + } + } +end + +local f0_local9 = function ( f24_arg0, f24_arg1 ) + Engine.Exec( "party_acceptinvite" ) +end + +local f0_local10 = function ( f25_arg0, f25_arg1 ) + +end + +function partyinviteconfirm() + return { + type = "generic_yesno_popup", + id = "partyinviteconfirm", + properties = { + message_text = Engine.GetDvarString( "party_invitequestion" ), + popup_title = Engine.Localize( "@MPUI_PARTY_INVITE_TITLE" ), + yes_text = Engine.Localize( "@MPUI_PARTY_INVITE_ACCEPT" ), + no_text = Engine.Localize( "@MPUI_PARTY_INVITE_DECLINE" ), + yes_action = f0_local9, + no_action = f0_local10 + } + } +end + +function ShowSigninWarning( f27_arg0 ) + if Engine.GetDvarBool( "splitscreen" ) and not Engine.AllSplitscreenProfilesSignedIn() then + return true + elseif not Engine.GetDvarBool( "splitscreen" ) and Engine.OfflineProfileCanSave( f27_arg0 ) then + return true + else + return false + end +end + +function ShowSaveWarning( f28_arg0 ) + if Engine.GetDvarBool( "splitscreen" ) and not Engine.AllSplitscreenProfilesCanSave() then + return true + elseif not Engine.GetDvarBool( "splitscreen" ) and not Engine.OfflineProfileCanSave( f28_arg0 ) then + return true + else + return false + end +end + +function GetSaveWarningText( f29_arg0 ) + if ShowSigninWarning( f29_arg0 ) then + return Engine.Localize( "@MENU_NO_SAVE_DEVICE_WARNING_MP" ) + elseif Engine.GetDvarBool( "ui_multiplayer" ) then + return Engine.Localize( "@MENU_NO_SAVE_DEVICE_WARNING_MP" ) + else + return Engine.UserWithoutOfflineProfile() + end +end + +function GetGuestSaveWarningText( f30_arg0 ) + if ShowSigninWarning( f30_arg0 ) then + return Engine.Localize( "@MENU_NO_SIGNIN_WARNING_MP" ) + elseif Engine.GetDvarBool( "ui_multiplayer" ) then + return Engine.Localize( "@MENU_NO_SIGNIN_WARNING_MP" ) + else + return Engine.UserWithoutOfflineProfile() + end +end + +local f0_local11 = function ( f31_arg0, f31_arg1 ) + assert( f31_arg0.properties.exclusiveController ) + local f31_local0 = f31_arg0.properties.exclusiveController + local f31_local1 = "" + if ShowSigninWarning( f31_local0 ) or ShowSaveWarning( f31_local0 ) then + if Engine.IsUserAGuest( f31_local0 ) or not Engine.IsUserSignedIn( f31_local0 ) then + f31_local1 = GetGuestSaveWarningText( f31_local0 ) + else + f31_local1 = GetSaveWarningText( f31_local0 ) + end + end + f31_arg0:dispatchEventToChildren( { + name = "update_message", + message_text = f31_local1 + } ) +end + +function SaveErrorContinue( f32_arg0, f32_arg1 ) + DebugPrint( "Save Error Continue" ) + if Engine.GetDvarBool( "splitscreen" ) then + Engine.Exec( "endsplitscreensignin" ) + if Engine.GetDvarBool( "ui_multiplayer" ) then + LUI.FlowManager.RequestAddMenu( f32_arg0, "menu_gamesetup_splitscreen", false, f32_arg1.controller, false, {} ) + else + LUI.FlowManager.RequestAddMenu( f32_arg0, "menu_splitscreen_setup", false, f32_arg1.controller, false, {} ) + end + else + assert( f32_arg0.properties.callback_params.continue_to_menu ) + LUI.FlowManager.RequestAddMenu( f32_arg0, f32_arg0.properties.callback_params.continue_to_menu, false, f32_arg1.controller, true, {} ) + end +end + +function SaveErrorReturn( f33_arg0, f33_arg1 ) + DebugPrint( "Save Error Cancel" ) + if Engine.GetDvarBool( "splitscreen" ) then + Engine.ExecNow( "startsplitscreensignin" ) + end +end + +function saveGameErrorAbort( f34_arg0, f34_arg1 ) + SaveErrorReturn( f34_arg0, f34_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f34_arg0, true ) +end + +function savegame_error_mp() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@MENU_SAVE_ERROR_MP" ), + popup_title = Engine.Localize( "@MENU_SAVE_ERROR_MP" ), + yes_text = Engine.Localize( "@MENU_RESUMEGAME_NOSAVE_MP" ), + no_text = Engine.Localize( "@MENU_RETURN_SIGNIN_MP" ), + yes_action = SaveErrorContinue, + no_action = SaveErrorReturn + }, + handlers = { + menu_create = f0_local11, + popup_back = function ( f36_arg0, f36_arg1 ) + f36_arg0.properties:no_action( f36_arg1 ) + end + , + ss_controller_unplugged = saveGameErrorAbort + } + } +end + +local f0_local12 = function ( f37_arg0, f37_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f37_arg0 ) + LUI.FlowManager.RequestPopupMenu( f37_arg0, "cod_anywhere_sign_in_popup", true, f37_arg1.controller, true ) +end + +local f0_local13 = function ( f38_arg0, f38_arg1 ) + LUI.FlowManager.RequestAddMenu( f38_arg0, "cod_anywhere_registration_menu", true, f38_arg1.controller, true ) +end + +local f0_local14 = function ( f39_arg0, f39_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f39_arg0 ) + CoDAnywhere.DoNotShowPopup( f39_arg1.controller ) +end + +local f0_local15 = function ( f40_arg0 ) + local f40_local0 = {} + local f40_local1 = { + { + text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_SIGN_IN" ), + func = f0_local12 + }, + { + text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_CREATE_ACCOUNT" ), + func = f0_local13 + } + } + for f40_local2 = 1, #f40_local1, 1 do + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "cod_anywhere_button_" .. f40_local2, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = f40_local1[f40_local2].text, + button_action_func = f40_local1[f40_local2].func + } + } + end + return f40_local0 +end + +local f0_local16 = function ( f41_arg0 ) + local f41_local0 = { + [#f41_local0 + 1] = { + type = "UIText", + id = "cod_anywhere_account_text_id", + properties = { + text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_NO_LINKED_ACCOUNT" ) + }, + states = { + default = CoD.ColorizeState( Colors.frontend_hilite, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + } + } + } + for f41_local1 = 1, 4, 1 do + local f41_local4 + if f41_local1 == 4 then + f41_local4 = Colors.grey_4 + if not f41_local4 then + + else + f41_local0[#f41_local0 + 1] = { + type = "UIText", + id = "cod_anywhere_marketing_text_" .. f41_local1 .. "_id", + properties = { + text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_MARKETING" .. f41_local1 ) + }, + states = { + default = CoD.ColorizeState( f41_local4, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + } + } + end + end + f41_local4 = Colors.white + end + return f41_local0 +end + +function cod_anywhere_popup_menu() + return { + type = "UIElement", + id = "cod_anywhere_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" ), + popup_childfeeder = f0_local15, + popup_title_alignment = LUI.Alignment.Center, + func = nil + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -220, + width = 500, + height = 430 + } + }, + handlers = { + menu_create = updateSelectionListPopup + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + properties = { + title_bar_text = MBh.Property( "popup_title" ), + title_bar_alignment = MBh.Property( "popup_title_alignment" ), + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + properties = { + fill_alpha = 1 + } + }, + { + type = "UIVerticalList", + id = "cod_anywhere_marketing_text_vlist_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 45, + bottom = 0, + left = 10, + right = -10, + alignment = LUI.Alignment.Top, + spacing = 15 + } + }, + childrenFeeder = f0_local16 + }, + { + type = "UIVerticalList", + id = "selection_list_popup_vert_list_id", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -60, + bottom = 0, + left = 5, + right = -5, + alignment = LUI.Alignment.Top + } + }, + childrenFeeder = MBh.Property( "popup_childfeeder" ) + }, + { + type = "UIBindButton", + handlers = { + button_secondary = f0_local14 + } + } + } + } + } + } +end + +local f0_local17 = function ( f43_arg0, f43_arg1 ) + local f43_local0 = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" ) + local f43_local1 = Engine.GetDvarString( "cod_anywhere_errorMessage" ) + f43_arg0:dispatchEventToChildren( { + name = "update_title", + title_text = f43_local0 + } ) + f43_arg0:dispatchEventToChildren( { + name = "update_message", + message_text = f43_local1 + } ) +end + +local f0_local18 = function ( f44_arg0, f44_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f44_arg0 ) +end + +function cod_anywhere_error_popup_menu() + return { + type = "generic_confirmation_popup", + id = "cod_anywhere_error_popup_menu_id", + properties = { + confirmation_action = f0_local18 + }, + handlers = { + menu_create = f0_local17 + } + } +end + +function cod_anywhere_working_popup_menu() + return { + type = "live_dialog_text_box", + id = "cod_anywhere_working_popup_menu_id", + properties = { + message = Engine.Localize( "@MENU_FACEBOOK_UPLOADING" ) + } + } +end + +local f0_local19 = function ( f47_arg0, f47_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f47_arg0 ) + f47_arg0:dispatchEventToRoot( { + name = "leave_platform_screen" + } ) +end + +function cod_anywhere_success_popup_menu( f48_arg0, f48_arg1 ) + local f48_local0 = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" ) + local f48_local1 = Engine.GetDvarString( "cod_anywhere_single_task_popup_text" ) + local f48_local2 = f0_local19 + local f48_local3 = "image_motd_ghost_app" + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f48_local5 = LUI.UIImage.new() + f48_local5:registerAnimationState( "default", CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -200, + bottom = 200, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) ) + f48_local5:animateToState( "default" ) + self:addElement( f48_local5 ) + local f48_local6 = LUI.UIElement.new() + f48_local6:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = 892, + height = 590 + } ) + f48_local6:animateToState( "default" ) + self:addElement( f48_local6 ) + f48_local6:addElement( LUI.MenuGenerics.generic_drop_shadow( nil, { + offset_shadow = 0, + alpha = 0.35 + } ) ) + f48_local6:addElement( LUI.MenuGenerics.generic_menu_titlebar( nil, { + title_bar_text = f48_local0, + fill_alpha = 1 + } ) ) + f48_local6:addElement( LUI.MenuGenerics.generic_menu_background( nil, { + fill_alpha = 1 + } ) ) + local f48_local7 = LUI.UIText.new() + f48_local7:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 490, + top = 90, + width = 367, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + f48_local7:setText( f48_local1 ) + f48_local7:animateToState( "default" ) + f48_local6:addElement( f48_local7 ) + local f48_local8 = LUI.UIElement.new() + f48_local8:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 58, + top = 90, + height = 342, + width = 342 + } ) + f48_local8:animateToState( "default" ) + f48_local6:addElement( f48_local8 ) + f48_local8:addElement( LUI.MenuGenerics.generic_drop_shadow( nil, { + offset_shadow = -3 + } ) ) + local f48_local9 = LUI.UIImage.new() + f48_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.generic_button_border_color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ) + } ) ) + f48_local9:animateToState( "default" ) + f48_local8:addElement( f48_local9 ) + local f48_local10 = LUI.UIImage.new() + f48_local10:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 1, + right = -1, + top = 1, + bottom = -1, + material = RegisterMaterial( f48_local3 ), + alpha = 1 + } ) + f48_local10:animateToState( "default" ) + f48_local8:addElement( f48_local10 ) + local f48_local11 = LUI.UIImage.new() + f48_local11:registerAnimationState( "default", CoD.ColorizeState( Colors.generic_button_border_color, { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 446, + width = 1, + top = 90, + height = 342, + material = RegisterMaterial( "white" ), + alpha = 1 + } ) ) + f48_local11:animateToState( "default" ) + f48_local6:addElement( f48_local11 ) + local f48_local12 = LUI.UIImage.new() + f48_local12.id = "horizontal_line_id" + f48_local12:registerAnimationState( "default", CoD.ColorizeState( Colors.generic_button_border_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 1, + right = -1, + bottom = -43, + height = 1, + material = RegisterMaterial( "white" ), + alpha = 1 + } ) ) + f48_local12:animateToState( "default" ) + f48_local6:addElement( f48_local12 ) + local f48_local13 = LUI.UIButton.new() + f48_local13.id = "continuebutton_id" + f48_local13:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + f48_local13:registerEventHandler( "button_action", f48_local2 ) + f48_local13:animateToState( "default" ) + f48_local6:addElement( f48_local13 ) + LUI.MenuBuilder.BuildAddChild( f48_local6, { + type = "UIElement", + id = "help_padding", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 1, + right = -1, + top = 0, + bottom = -1 + } + }, + children = { + { + type = "button_helper_text_main", + id = "help_texts", + properties = { + left_inset = 10, + top_margin = GenericFooterDims.TopMargin_WithoutBackground, + background_alpha = 0, + hideAlienBar = true + }, + handlers = { + menu_create = function ( f49_arg0, f49_arg1 ) + f49_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addActionButton ) + end + } + } + } + } ) + return self +end + +local f0_local20 = function ( f50_arg0, f50_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f50_arg0 ) + CoDAnywhere.DoNotShowPopup( f50_arg1.controller ) + CoDAnywhere.DownloadNonUCDPlatforms( f50_arg0.properties.exclusiveController ) +end + +function cod_anywhere_link_ucd_popup_menu() + return { + type = "generic_confirmation_popup", + id = "cod_anywhere_link_ucd_popup_menu_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" ), + message_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_LINK_UCD_DESC" ), + button_text = Engine.Localize( "@MENU_OK" ), + confirmation_action = f0_local20 + }, + handlers = {} + } +end + +function cod_anywhere_all_done_popup_menu() + return { + type = "generic_confirmation_popup", + id = "cod_anywhere_all_done_popup_menu_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_COD_ANYWHERE" ), + message_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_ALL_DONE" ), + confirmation_action = MBh.LeaveMenu() + }, + handlers = {} + } +end + +function MainChooseExeChildrenFeeder() + local f53_local0 = { + [#f53_local0 + 1] = { + type = "UIMarqueeText", + id = "switch_to_sp_text", + properties = { + text = Engine.Localize( "@MENU_SWITCH_TO_SINGLE_PLAYER" ) + }, + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) + } + }, + [#f53_local0 + 1] = { + type = "UIGenericButton", + id = "main_choose_sp_button", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_YES" ), + button_action_func = function ( f54_arg0, f54_arg1 ) + Engine.StartSingleplayer() + end + } + }, + [#f53_local0 + 1] = { + type = "UIGenericButton", + id = "main_choose_cancel_button", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@LUA_MENU_CANCEL" ), + button_action_func = MBh.LeaveMenu() + } + } + } + if not Engine.IsConsoleGame() then + f53_local0[#f53_local0 + 1] = { + type = "UIGenericButton", + id = "main_choose_exit_button", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@LUA_MENU_EXIT_GAME" ), + button_action_func = MBh.PopupMenu( "quit_popmenu", false, false ) + } + } + end + return f53_local0 +end + +function main_choose_exe_popup_menu() + return { + type = "generic_selectionList_popup", + id = "main_choose_exe_popup_menu_id", + properties = { + popup_title = Engine.Localize( "@MENU_MAIN_MENU" ), + popup_childfeeder = MainChooseExeChildrenFeeder + }, + handlers = { + menu_create = function ( f56_arg0, f56_arg1 ) + Engine.Exec( "forcenosplitscreencontrol openChooseExe" ) + end + , + menu_close = function ( f57_arg0, f57_arg1 ) + Engine.Exec( "forcesplitscreencontrol closeChooseExe" ) + end + + } + } +end + +function AcceptInviteWarningConfirm( f58_arg0, f58_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f58_arg0, nil ) + Engine.ExecNow( "confirmInvite" ) +end + +function AcceptInviteWarningCancel( f59_arg0, f59_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f59_arg0, nil ) +end + +function acceptinvite_warning() + return { + type = "generic_yesno_popup", + id = "acceptinvite_warning_id", + properties = { + message_text = Engine.Localize( "@MENU_LEAVEPARTYWARNING" ), + popup_title = Engine.Localize( "@MENU_ACCEPTINVITETITLE" ), + yes_text = Engine.Localize( "@MENU_CONFIRMINVITE" ), + no_text = Engine.Localize( "@MENU_RESUMEGAME" ), + yes_action = AcceptInviteWarningConfirm, + no_action = AcceptInviteWarningCancel + } + } +end + +function CopyLoadoutChildrenFeeder( f61_arg0 ) + local f61_local0 = {} + local f61_local1 = f61_arg0.controller + if not f61_local1 then + DebugPrint( "[WARNING] CAC: using controller index 0, this is only ok if you are editing a menu" ) + f61_local1 = 0 + end + local f61_local2 = 1 + local f61_local3 = 1 + local f61_local4 = false + if Cac.IsDefaultClass( f61_arg0.classLocation ) then + f61_local4 = true + f61_local3 = 2 + 1 + end + local f61_local5 = f61_arg0.classLocation + local f61_local6 = f61_arg0.squadLocation + local f61_local7 = f61_arg0.squadMemberIndex + repeat + if f61_local4 then + f61_local3 = f61_local3 - 1 + if f61_local3 == 1 then + f61_local0[#f61_local0 + 1] = { + type = "UIElement", + id = "copy_spacer", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 10 + } + } + } + end + local f61_local8 = Cac.AddTeamName( "defaultClassesTeam" .. f61_local3, f61_local3, -200 ) + if f61_local8 ~= nil then + f61_local0[#f61_local0 + 1] = f61_local8 + end + end + for f61_local8 = 0, Cac.GetNumCustomSlots( f61_local1, f61_local5 ) - 1, 1 do + local f61_local11 = { + type = "UIGenericButton", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + squadLocation = f61_local6, + squadMemberIndex = f61_local7, + classLocation = f61_local5, + slot = f61_local8, + button_text = Cac.GetLoadoutName( f61_local1, f61_local6, f61_local7, f61_local5, f61_local8 ), + button_action_func = function ( f62_arg0, f62_arg1 ) + local f62_local0 = f62_arg0.properties + Cac.SetLoadout( f61_local1, f62_local0.squadLocation, f62_local0.squadMemberIndex, f62_local0.classLocation, f62_local0.slot, f61_arg0.classLocation, f61_arg0.slot ) + f62_arg0:dispatchEventToRoot( { + name = "focus_loadout", + loadoutIndex = f62_local0.slot, + immediate = true, + dispatchChildren = true + } ) + f62_arg0:dispatchEventToRoot( { + name = "update_loadout_name", + newName = Cac.GetLoadoutName( f61_local1, f62_local0.squadLocation, f62_local0.squadMemberIndex, f62_local0.classLocation, f62_local0.slot ), + loadoutIndex = f62_local0.slot, + immediate = true, + classLocation = f62_local0.classLocation + } ) + LUI.FlowManager.RequestLeaveMenu( f62_arg0 ) + end + } + } + local f61_local12 + if f61_local8 ~= f61_arg0.slot or f61_local5 ~= f61_arg0.classLocation then + f61_local12 = Cac.IsCaCSlotLocked( f61_local1, f61_local6, f61_local7, f61_local5, f61_local8 ) + else + f61_local12 = true + end + f61_local11.disabled = f61_local12 + f61_local11.id = "copy_class_" .. f61_local3 .. "_" .. f61_local8 + f61_local0[#f61_local0 + 1] = f61_local11 + end + until not f61_local4 or f61_local4 and f61_local3 == 1 + return f61_local0 +end + +function copy_loadout_popup() + return { + type = "generic_selectionList_popup", + id = "copy_loadout_popup_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_DESTINATION" ), + popup_childfeeder = CopyLoadoutChildrenFeeder, + controller = 0, + squadLocation = "privateMatchSquadMembers", + squadMemberIndex = 0, + classLocation = "privateMatchCustomClasses", + slot = 0 + } + } +end + +function user_generated_content_restriction_popup() + return { + type = "generic_confirmation_popup", + id = "clan_invite_restriction_popup_id", + properties = { + popup_title = Engine.Localize( "@GAME_WARNING" ), + message_text = Engine.Localize( "@LUA_MENU_USER_CONTENT_RESTRICTIONS" ), + confirmation_action = MBh.LeaveMenu() + }, + handlers = {} + } +end + +function cod_anywhere_unavailable_popup() + return { + type = "generic_confirmation_popup", + id = "cod_anywhere_unavailable_popup_id", + properties = { + popup_title = Engine.Localize( "@GAME_WARNING" ), + message_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_UNAVAILABLE" ), + confirmation_action = MBh.LeaveMenu() + }, + handlers = {} + } +end + +function CancelJoinInProgressWithPassword( f66_arg0, f66_arg1 ) + Engine.SetDvarBool( "onlinegame", false ) + Engine.SetDvarBool( "systemlink", false ) + Engine.Exec( "stopListening" ) + Engine.Exec( "useonlinestats 0" ) + Engine.Exec( "statsdownloadcancel" ) + Engine.Exec( "xstopparty PASSWORD_POPUP_CANCELED_ACTION" ) + Engine.Exec( "xstopprivateparty" ) + Engine.Exec( "xcancelconnectingdialog" ) + Engine.Exec( "resetautoconnect" ) + LUI.FlowManager.RequestSetStack( f66_arg0, { + { + name = "mp_main_menu" + } + } ) + LUI.FlowManager.RequestLeaveMenu( f66_arg0 ) +end + +function jip_with_password() + local self = LUI.UIElement.new() + self.id = "jip_with_password_id" + self:registerEventHandler( "menu_create", function ( element, event ) + Engine.SetDvarString( "privateMatch_joinPassword", "" ) + Engine.OpenScreenKeyboard( 0, Engine.Localize( "MENU_PASSWORD" ), "", Lobby.PasswordLength, false, false, CoD.KeyboardInputTypes.Password, true ) + end ) + self:registerEventHandler( "text_input_complete", function ( element, event ) + if not event.text then + CancelJoinInProgressWithPassword( element, event ) + else + Engine.SetDvarString( "privateMatch_joinPassword", event.text ) + Engine.Exec( "xjoinpasswordparty" ) + LUI.FlowManager.RequestLeaveMenu( element ) + end + end ) + return self +end + +function squad_challenge_invalid_popup() + return { + type = "generic_confirmation_popup", + id = "squad_challenge_invalid_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_SQUADS_CANT_FIGHT_PARTY_MEMBER" ), + confirmation_action = MBh.LeaveMenu() + } + } +end + +function ContineueSearching() + Engine.SetDvarBool( "party_search_for_dlc_content", true ) + Engine.Exec( "resetdlcsearchtimer" ) +end + +function StopSearching() + Engine.SetDvarBool( "party_search_for_dlc_content", false ) + Engine.Exec( "xstoplobbybackout" ) + Engine.Exec( "xblive_privatematch 0" ) + LUI.FlowManager.RequestRestoreMenu( nil, "menu_xboxlive" ) +end + +function mp_dlc_switch_searchtype() + return { + type = "generic_yesno_popup", + id = "mp_dlc_switch_searchtype_id", + properties = { + message_text = Engine.Localize( "@DLC_SEARCH_IS_TAKING_TIME" ), + popup_title = Engine.Localize( "@MENU_WARNING" ), + no_text = Engine.Localize( "@DLC_SEARCH_CONTINUE" ), + yes_text = Engine.Localize( "@DLC_SEARCH_STOP" ), + no_action = ContineueSearching, + yes_action = StopSearching + } + } +end + +function popup_throttling() + return { + type = "UIElement", + id = "popup_throttling_id", + handlers = { + move_to_lobby = function ( f75_arg0, f75_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f75_arg0, nil ) + local f75_local0 = f75_arg0.properties.eventData or {} + f75_local0.name = "find_match_after_throttle" + f75_arg1.controller = f75_arg0.properties.exclusiveController + f75_arg0:dispatchEventToRoot( f75_local0 ) + end + + }, + children = { + { + type = "live_dialog_text_box_with_cancel", + id = "live_dialog_text_box_with_cancel_id", + properties = { + message = Engine.Localize( "@MENU_PLEASE_WAIT" ), + cancel_func = MBh.LeaveMenu() + } + }, + { + type = "UITimer", + id = "move_to_lobby_id", + properties = { + event = "move_to_lobby", + interval = Engine.GetDvarInt( "lb_throttle_time" ) * 1000, + disposable = false + } + } + } + } +end + +function mlg_error_no_rules_available_offline() + return { + type = "generic_confirmation_popup", + id = "mlg_error_no_rules_available_offline", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_MLG_NO_RULES_AVAILABLE_OFFLINE" ) + } + } +end + +function mlg_error_no_rules_available() + return { + type = "generic_confirmation_popup", + id = "mlg_error_no_rules_available", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_MLG_NO_RULES_AVAILABLE" ) + } + } +end + +function mp_damaged_content_popup() + return { + type = "generic_confirmation_popup", + id = "mp_damaged_content_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_XENON_DAMAGED_DLC" ), + confirmation_action = MBh.LeaveMenu() + } + } +end + +function mp_no_guest_popup() + return { + type = "generic_confirmation_popup", + id = "mp_no_guest_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_NO_GUEST" ) + } + } +end + +if Engine.IsPS3() or Engine.IsPS4() then + function mp_no_squad_assault() + return { + type = "generic_confirmation_popup", + id = "mp_no_squad_assault_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@XBOXLIVE_SQUADASSAULTNOTALLOWED" ) + } + } + end + +end +if Engine.IsPS3() then + function mp_wrong_controller_popup() + return { + type = "generic_confirmation_popup", + id = "mp_wrong_controller_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@PLATFORM_USECONTROLLER1" ) + } + } + end + +end +function popup_no_guest() + return { + type = "generic_confirmation_popup", + id = "no_guest_leaderboards_id", + properties = { + popup_title = Engine.Localize( "MENU_NOTICE" ), + message_text = Engine.Localize( "PATCH_MENU_NO_GUEST" ) + } + } +end + +function popup_reset_game_options() + return { + type = "generic_yesno_popup", + id = "popup_reset_game_options_id", + properties = { + message_text = Engine.Localize( "PATCH_MENU_RESET_OPTIONS" ), + popup_title = Engine.Localize( "LUA_MENU_SET_DEFAULT_CONTROLS" ), + no_action = function ( f84_arg0, f84_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f84_arg0 ) + end + , + yes_action = function ( f85_arg0, f85_arg1 ) + if MLG.AreMLGRulesEnabled() then + MLG.Toggle( f85_arg0, f85_arg1 ) + end + MatchRules.LoadMatchRulesDataDefault() + end + + } + } +end + +function goto_store() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@LUA_MENU_GOTO_STORE" ), + popup_title = Engine.Localize( "@MENU_NOTICE" ), + yes_text = Engine.Localize( "@MENU_YES" ), + no_text = Engine.Localize( "@MENU_NO" ), + yes_action = function ( f87_arg0, f87_arg1 ) + Engine.ExecNow( "uploadstats", f87_arg1.controller ) + local f87_local0 = Engine.GetLuiRoot() + local f87_local1 = LUI.FlowManager.IsInStack( f87_local0.flowManager, "menu_xboxlive_privatelobby" ) + local f87_local2 = LUI.FlowManager.IsInStack( f87_local0.flowManager, "menu_xboxlive_lobby" ) + Engine.ExecNow( "forcesplitscreencontrol goToStore" ) + if f87_local1 or f87_local2 then + f87_arg1.execNow = true + LUI.mp_menus.mpLobbyWidgets.leaveLobbyAndPartyYesActionWithExitLobby( f87_arg0, f87_arg1 ) + end + LUI.FlowManager.RequestRestoreMenu( nil, "menu_xboxlive" ) + Sns.OpenStoreMenu( f87_arg1.controller, "cac", false, f87_arg0.properties.callback_params.dlcName ) + end + , + no_action = function ( f88_arg0, f88_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f88_arg0 ) + end + + } + } +end + +function finding_player_purchases() + return { + type = "UIElement", + id = "finding_player_purchases_id", + handlers = { + menu_create = function ( f90_arg0, f90_arg1 ) + Store.FindPlayerPurchases( f90_arg1.controller ) + end + , + move_to_store = function ( f91_arg0, f91_arg1 ) + if Store.FoundPlayerPurchases() == true then + LUI.FlowManager.RequestLeaveMenu( f91_arg0, nil ) + LUI.FlowManager.RequestAddMenu( f91_arg0, "store_main", true, controller, replaceTop, f91_arg0.properties.storeData ) + end + end + + }, + children = { + { + type = "live_dialog_text_box_with_cancel", + id = "live_dialog_text_box_with_cancel_id", + properties = { + message = Engine.Localize( "@MENU_PLEASE_WAIT" ), + cancel_func = MBh.LeaveMenu() + } + }, + { + type = "UITimer", + id = "move_to_store_id", + properties = { + event = "move_to_store", + interval = 1000, + disposable = false + } + } + } + } +end + +if Engine.IsXbox360() then + function StartDownloadRequiredDLC( f92_arg0, f92_arg1 ) + Engine.Exec( "restart_compatibility_tasks" ) + LUI.FlowManager.RequestLeaveMenu( f92_arg0 ) + end + + function AnyUserSignedIn() + for f93_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.IsUserSignedIn( f93_local0 ) then + return true + end + end + return false + end + + function AnyUserSignedInToLive() + for f94_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.IsUserSignedInToLive( f94_local0 ) then + return true + end + end + return false + end + + function HandleRequiredDLCPopup() + local f95_local0 = Engine.GetDvarString( "com_errorMessage" ) + if f95_local0 and f95_local0 ~= "" then + return nil + elseif not Engine.DoWeNeedCompatibilityPacks() then + return nil + elseif not AnyUserSignedIn() then + return "missing_content_signin" + elseif not Engine.FinishedMountingContent() then + return "missing_content_discovery" + elseif not AnyUserSignedInToLive() then + return "missing_content_signin" + elseif Engine.ErrorDownloadingRequiredDLC() then + return "missing_content_error" + elseif Engine.AnyoneDownloadingRequiredDLC() then + return "missing_content_downloading" + else + return "missing_content_download" + end + end + + function RequestNextRequiredPopup( f96_arg0 ) + local f96_local0 = HandleRequiredDLCPopup() + if f96_local0 then + LUI.FlowManager.RequestPopupMenu( nil, f96_local0, false, f96_arg0, false, false, false, true, false ) + end + end + + function SignInRequiredDLCComplete( f97_arg0 ) + Engine.ExecNow( "forcenosplitscreencontrol SignInRequiredDLCComplete", f97_arg0 ) + RequestNextRequiredPopup( f97_arg0 ) + end + + function SignInRequiredDLC( f98_arg0, f98_arg1 ) + if HandleRequiredDLCPopup() ~= "missing_content_signin" then + UpdateRequiredDLCNotification( f98_arg0, f98_arg1 ) + else + Engine.ExecWithResolve( "xsigninlive", SignInRequiredDLCComplete, f98_arg1.controller ) + Engine.Exec( "forcesplitscreencontrol SignInRequiredDLC", f98_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f98_arg0 ) + end + end + + function DownloadRequiredDLC( f99_arg0, f99_arg1 ) + Engine.ExecWithResolve( "restart_compatibility_tasks", RequestNextRequiredPopup, f99_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f99_arg0 ) + end + + function StartSinglePlayerExe( f100_arg0, f100_arg1 ) + Engine.Exec( "forcenosplitscreencontrol StartSinglePlayerExe" ) + Engine.Exec( "startSingleplayer" ) + end + + function UpdateRequiredDLCNotification( f101_arg0, f101_arg1 ) + local f101_local0 = Engine.GetLuiRoot() + local f101_local1 = HandleRequiredDLCPopup() + if f101_local1 ~= "missing_content_discovery" and f101_local0:IsMenuOpenAndVisible( "missing_content_discovery" ) then + LUI.FlowManager.RequestLeaveMenuByName( "missing_content_discovery" ) + end + if f101_local1 ~= "missing_content_downloading" and f101_local0:IsMenuOpenAndVisible( "missing_content_downloading" ) then + LUI.FlowManager.RequestLeaveMenuByName( "missing_content_downloading" ) + end + if f101_local1 ~= "missing_content_signin" and f101_local0:IsMenuOpenAndVisible( "missing_content_signin" ) then + LUI.FlowManager.RequestLeaveMenuByName( "missing_content_signin" ) + end + if f101_local1 ~= "missing_content_download" and f101_local0:IsMenuOpenAndVisible( "missing_content_download" ) then + LUI.FlowManager.RequestLeaveMenuByName( "missing_content_download" ) + end + if f101_local1 ~= "missing_content_error" and f101_local0:IsMenuOpenAndVisible( "missing_content_error" ) then + LUI.FlowManager.RequestLeaveMenuByName( "missing_content_error" ) + end + local f101_local2 = f101_arg1.controller + if not f101_local2 and Engine.SplitscreenPlayerCount() ~= 0 then + f101_local2 = Engine.GetFirstActiveController() + end + if f101_local1 and not f101_local0:IsMenuOpenAndVisible( f101_local1 ) then + LUI.FlowManager.RequestPopupMenu( nil, f101_local1, false, f101_local2, false, false, false, false, false ) + end + end + + function ErrorRequiredDLC() + local f102_local0, f102_local1 = Engine.ErrorDownloadingRequiredDLC() + if f102_local0 then + if f102_local1 == CoD.RequiredDLCError.COMPATIBILITY_ERROR_DISK_FULL then + return Engine.Localize( "@LUA_MENU_MP_ERROR_FULL_REQUIRED_DLC" ) + elseif f102_local1 == CoD.RequiredDLCError.COMPATIBILITY_ERROR_CORRUPTED then + return Engine.Localize( "@LUA_MENU_MP_ERROR_CORRUPT_REQUIRED_DLC" ) + elseif f102_local1 == CoD.RequiredDLCError.COMPATIBILITY_ERROR_CANCELED then + return Engine.Localize( "@LUA_MENU_MP_ERROR_CANCEL_REQUIRED_DLC" ) + else + return Engine.Localize( "@LUA_MENU_MP_ERROR_REQUIRED_DLC" ) + end + else + return Engine.Localize( "@LUA_MENU_MP_ERROR_REQUIRED_DLC" ) + end + end + + function need_to_download_required_dlc() + return { + type = "generic_yesno_popup", + id = "need_to_download_required_dlc", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_MP_NEED_REQUIRED_DLC" ), + yes_action = StartDownloadRequiredDLC, + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } + end + + function currently_downloading_required_dlc() + return { + type = "generic_confirmation_popup", + id = "currently_downloading_required_dlc", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_MP_DOWNLOADING_REQUIRED_DLC" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } + end + + function missing_content_signin() + return { + type = "generic_yesno_popup", + id = "missing_content_signin", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = AnyUserSignedIn() and Engine.Localize( "@LUA_MENU_MP_LIVE_SIGNIN_REQUIRED_DLC" ) or Engine.Localize( "@LUA_MENU_MP_SIGNIN_REQUIRED_DLC" ), + message_text_alignment = LUI.Alignment.Left, + default_focus_index = 1, + yes_action = SignInRequiredDLC, + yes_text = AnyUserSignedIn() and Engine.Localize( "@XBOXLIVE_SIGNIN" ) or Engine.Localize( "LUA_MENU_COD_ANYWHERE_SIGN_IN" ), + no_action = StartSinglePlayerExe, + no_text = Engine.Localize( "@MENU_SWITCH_TO_SINGLE_PLAYER" ), + additional_handlers = { + dlc_mount_complete = UpdateRequiredDLCNotification, + dlc_mount_fail = UpdateRequiredDLCNotification, + dlc_download_fail = UpdateRequiredDLCNotification + } + } + } + end + + function missing_content_download() + return { + type = "generic_yesno_popup", + id = "missing_content_download", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_MP_NEED_REQUIRED_DLC" ), + message_text_alignment = LUI.Alignment.Left, + default_focus_index = 1, + yes_action = DownloadRequiredDLC, + no_action = StartSinglePlayerExe, + no_text = Engine.Localize( "@MENU_SWITCH_TO_SINGLE_PLAYER" ), + additional_handlers = { + dlc_mount_complete = UpdateRequiredDLCNotification, + dlc_mount_fail = UpdateRequiredDLCNotification, + dlc_download_fail = UpdateRequiredDLCNotification + } + } + } + end + + function missing_content_error() + return { + type = "generic_yesno_popup", + id = "missing_content_error", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = ErrorRequiredDLC(), + message_text_alignment = LUI.Alignment.Left, + default_focus_index = 1, + yes_action = DownloadRequiredDLC, + no_action = StartSinglePlayerExe, + no_text = Engine.Localize( "@MENU_SWITCH_TO_SINGLE_PLAYER" ) + } + } + end + + function missing_content_downloading() + return { + type = "generic_confirmation_popup", + id = "missing_content_downloading", + properties = { + cancel_will_close = false, + confirmation_action = StartSinglePlayerExe, + message_text_alignment = LUI.Alignment.Left, + message_text = Engine.Localize( "LUA_MENU_MP_DOWNLOADING_REQUIRED_DLC" ), + button_text = Engine.Localize( "@MENU_SWITCH_TO_SINGLE_PLAYER" ), + popup_title = Engine.Localize( "MENU_NOTICE" ) + }, + handlers = { + dlc_mount_complete = UpdateRequiredDLCNotification, + dlc_mount_fail = UpdateRequiredDLCNotification, + dlc_download_fail = UpdateRequiredDLCNotification + } + } + end + + function missing_content_discovery() + return { + type = "UIElement", + id = "missing_content_discovery", + children = { + { + type = "live_dialog_text_box", + id = "missing_content_discovery_popup", + properties = { + message = Engine.Localize( "LUA_MENU_MP_WAITING_REQUIRED_DLC" ), + dialog_width = 500 + } + }, + { + type = "UITimer", + id = "content_discovery_refresh_timer", + properties = { + event = { + name = "update_content_discovery" + }, + interval = 3000 + } + } + }, + handlers = { + dlc_mount_complete = UpdateRequiredDLCNotification, + dlc_mount_fail = UpdateRequiredDLCNotification, + dlc_download_fail = UpdateRequiredDLCNotification, + update_content_discovery = UpdateRequiredDLCNotification + } + } + end + +end +LUI.MenuBuilder.registerDef( "downloadingplaylist", downloadingplaylist ) +LUI.MenuBuilder.registerDef( "menu_resetstats_warning", menu_resetstats_warning ) +LUI.MenuBuilder.registerDef( "popup_gettingdata", popup_gettingdata ) +LUI.MenuBuilder.registerDef( "popup_gettinglb", popup_gettinglb ) +LUI.MenuBuilder.registerDef( "popup_getting_socialconfig", popup_getting_socialconfig ) +LUI.MenuBuilder.registerDef( "popup_elite_sell", popup_elite_sell ) +LUI.MenuBuilder.registerDef( "menu_xboxlive_partyended", menu_xboxlive_partyended ) +LUI.MenuBuilder.registerDef( "error_popmenu_lobby", error_popmenu_lobby ) +LUI.MenuBuilder.registerDef( "youarehost", youarehost ) +LUI.MenuBuilder.registerDef( "partyinviteconfirm", partyinviteconfirm ) +LUI.MenuBuilder.registerDef( "makehostfailed", makehostfailed ) +LUI.MenuBuilder.registerDef( "savegame_error_mp", savegame_error_mp ) +LUI.MenuBuilder.registerDef( "cod_anywhere_popup_menu", cod_anywhere_popup_menu ) +LUI.MenuBuilder.registerDef( "cod_anywhere_error_popup_menu", cod_anywhere_error_popup_menu ) +LUI.MenuBuilder.registerDef( "cod_anywhere_working_popup_menu", cod_anywhere_working_popup_menu ) +LUI.MenuBuilder.registerType( "cod_anywhere_success_popup_menu", cod_anywhere_success_popup_menu ) +LUI.MenuBuilder.registerDef( "cod_anywhere_link_ucd_popup_menu", cod_anywhere_link_ucd_popup_menu ) +LUI.MenuBuilder.registerDef( "main_choose_exe_popup_menu", main_choose_exe_popup_menu ) +LUI.MenuBuilder.registerDef( "acceptinvite_warning", acceptinvite_warning ) +LUI.MenuBuilder.registerDef( "user_generated_content_restriction_popup", user_generated_content_restriction_popup ) +LUI.MenuBuilder.registerDef( "copy_loadout_popup", copy_loadout_popup ) +LUI.MenuBuilder.registerDef( "cod_anywhere_unavailable_popup", cod_anywhere_unavailable_popup ) +LUI.MenuBuilder.registerDef( "cod_anywhere_all_done_popup_menu", cod_anywhere_all_done_popup_menu ) +LUI.MenuBuilder.registerDef( "squad_challenge_invalid_popup", squad_challenge_invalid_popup ) +LUI.MenuBuilder.registerDef( "mp_dlc_switch_searchtype", mp_dlc_switch_searchtype ) +LUI.MenuBuilder.registerDef( "popup_throttling", popup_throttling ) +LUI.MenuBuilder.registerDef( "mlg_error_no_rules_available_offline", mlg_error_no_rules_available_offline ) +LUI.MenuBuilder.registerDef( "mlg_error_no_rules_available", mlg_error_no_rules_available ) +LUI.MenuBuilder.registerDef( "mp_damaged_content_popup", mp_damaged_content_popup ) +LUI.MenuBuilder.registerDef( "mp_no_guest_popup", mp_no_guest_popup ) +if Engine.IsPS3() then + LUI.MenuBuilder.registerDef( "mp_wrong_controller_popup", mp_wrong_controller_popup ) +end +if Engine.IsPS3() or Engine.IsPS4() then + LUI.MenuBuilder.registerDef( "mp_no_squad_assault", mp_no_squad_assault ) +end +LUI.MenuBuilder.registerType( "jip_with_password", jip_with_password ) +LUI.MenuBuilder.registerDef( "popup_no_guest", popup_no_guest ) +LUI.MenuBuilder.registerDef( "popup_reset_game_options", popup_reset_game_options ) +LUI.MenuBuilder.registerDef( "goto_store", goto_store ) +LUI.MenuBuilder.registerDef( "finding_player_purchases", finding_player_purchases ) +if Engine.IsXbox360() then + LUI.MenuBuilder.registerDef( "need_to_download_required_dlc", need_to_download_required_dlc ) + LUI.MenuBuilder.registerDef( "currently_downloading_required_dlc", currently_downloading_required_dlc ) + LUI.MenuBuilder.registerDef( "missing_content_downloading", missing_content_downloading ) + LUI.MenuBuilder.registerDef( "missing_content_discovery", missing_content_discovery ) + LUI.MenuBuilder.registerDef( "missing_content_signin", missing_content_signin ) + LUI.MenuBuilder.registerDef( "missing_content_download", missing_content_download ) + LUI.MenuBuilder.registerDef( "missing_content_error", missing_content_error ) +end +LockTable( _M ) diff --git a/lui/mp_menus/mpprestigereset.dec.lua b/lui/mp_menus/mpprestigereset.dec.lua new file mode 100644 index 0000000..f36bbd7 --- /dev/null +++ b/lui/mp_menus/mpprestigereset.dec.lua @@ -0,0 +1,147 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +ItemStatsTable = { + "deaths", + "headShots", + "hits", + "kills", + "shots" +} +PrestigeResetTable = { + File = "mp/PrestigeResetTable.csv", + MaxRows = 1000, + Cols = { + Index = 0, + Purchases = 1, + WeaponStats = 2, + PlayerStats = 3 + } +} +function prestigeresetaction( f1_arg0, f1_arg1 ) + if Engine.IsAliensMode() then + Lobby.ExecAliensPrestigeReset( f1_arg1.controller, LUI.mp_menus.Aliens.getAliensRank( f1_arg1.controller ) ) + else + PlayerStatsReset( f1_arg1 ) + SquadMemXPReset( f1_arg1 ) + WeaponStatsReset( f1_arg1 ) + SquadMemPurchasesReset( f1_arg1 ) + SquadMemUnlockReset( f1_arg1 ) + ValidateLoadoutsAfterReset( f1_arg1 ) + Engine.ExecNow( "uploadstats", f1_arg1.controller ) + end + f1_arg0:dispatchEventToRoot( { + name = "prestige_mode_reset", + controller = f1_arg1.controller, + immediate = true + } ) +end + +function prestigereset3() + return { + type = "generic_yesno_popup", + id = "prestige_reset_popup_3", + properties = { + message_text = Engine.Localize( "@MENU_PRESTIGE_RESET_WARNING3" ), + popup_title = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE3" ), + yes_action = prestigeresetaction, + yes_text = Engine.Localize( "@LUA_MENU_MP_RESET_STATS" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function prestigereset2() + return { + type = "generic_yesno_popup", + id = "prestige_reset_popup_2", + properties = { + message_text = Engine.Localize( "@MENU_RESET_STATS_WARNING2" ), + popup_title = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE2" ), + yes_action = MBh.PopupMenu( "prestige_reset3", true ), + yes_text = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE3" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function prestigereset() + return { + type = "generic_yesno_popup", + id = "prestige_reset_popup", + properties = { + message_text = Engine.Localize( "@MENU_RESET_STATS_WARNING1" ), + popup_title = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE1" ), + yes_action = MBh.PopupMenu( "prestige_reset2", true ), + yes_text = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE2" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function PlayerStatsReset( f5_arg0 ) + for f5_local0 = 0, PrestigeResetTable.MaxRows, 1 do + local f5_local3 = Engine.TableLookupByRow( PrestigeResetTable.File, f5_local0, PrestigeResetTable.Cols.PlayerStats ) + if f5_local3 ~= "" then + Engine.SetPlayerDataEx( f5_arg0.controller, CoD.StatsGroup.Ranked, f5_local3, 0 ) + end + end + for f5_local4, f5_local3 in pairs( ItemStatsTable ) do + Engine.SetPlayerDataEx( f5_arg0.controller, CoD.StatsGroup.Ranked, "bestWeapon", f5_local3, 0 ) + end +end + +function SquadMemXPReset( f6_arg0 ) + for f6_local0 = 0, 9, 1 do + Engine.SetPlayerDataEx( f6_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", f6_local0, "squadMemXP", 0 ) + Engine.SetPlayerDataEx( f6_arg0.controller, CoD.StatsGroup.Ranked, "characterXP", f6_local0, 0 ) + Engine.SetPlayerDataEx( f6_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", f6_local0, "experienceToPrestige", 0 ) + end + Engine.SetPlayerDataReservedInt( f6_arg0.controller, CoD.StatsGroup.Ranked, "prestigeLevel", 0 ) +end + +function WeaponStatsReset( f7_arg0 ) + for f7_local0 = 0, PrestigeResetTable.MaxRows, 1 do + local f7_local3 = Engine.TableLookupByRow( PrestigeResetTable.File, f7_local0, PrestigeResetTable.Cols.WeaponStats ) + if f7_local3 ~= "" then + for f7_local7, f7_local8 in pairs( ItemStatsTable ) do + Engine.SetPlayerDataEx( f7_arg0.controller, CoD.StatsGroup.Ranked, "weaponStats", f7_local3, f7_local8, 0 ) + end + end + end +end + +function SquadMemPurchasesReset( f8_arg0 ) + for f8_local0 = 0, PrestigeResetTable.MaxRows, 1 do + local f8_local3 = Engine.TableLookupByRow( PrestigeResetTable.File, f8_local0, PrestigeResetTable.Cols.Purchases ) + if f8_local3 ~= "" then + for f8_local4 = 0, 9, 1 do + Engine.SetPlayerDataEx( f8_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", f8_local4, "challengeState", f8_local3, 0 ) + end + end + end +end + +function SquadMemUnlockReset( f9_arg0 ) + for f9_local0 = 0, 9, 1 do + Engine.SetPlayerDataEx( f9_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", f9_local0, "inUse", false ) + Engine.SetPlayerDataEx( f9_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", f9_local0, "defaultSet", false ) + end + Engine.SetPlayerDataEx( f9_arg0.controller, CoD.StatsGroup.Ranked, "squadMembers", 0, "inUse", true ) + Engine.SetPlayerDataEx( f9_arg0.controller, CoD.StatsGroup.Ranked, "challengeState", "ch_squad_member1_purchase", 2 ) + Cac.SetActiveSquadMember( f9_arg0.controller, 0 ) +end + +function ValidateLoadoutsAfterReset( f10_arg0 ) + local f10_local0 = Cac.GetSquadLoc() + local f10_local1 = f10_arg0.controller + for f10_local2 = 0, Cac.MaxSquadMemberCount( f10_local0 ) - 1, 1 do + Cac.ValidateCustomizationItems( f10_local1, f10_local0, f10_local2 ) + end +end + +LUI.MenuBuilder.registerDef( "prestige_reset", prestigereset ) +LUI.MenuBuilder.registerDef( "prestige_reset2", prestigereset2 ) +LUI.MenuBuilder.registerDef( "prestige_reset3", prestigereset3 ) +LockTable( _M ) diff --git a/lui/mp_menus/mpsavedmodeselectmenu.dec.lua b/lui/mp_menus/mpsavedmodeselectmenu.dec.lua new file mode 100644 index 0000000..c05aa40 --- /dev/null +++ b/lui/mp_menus/mpsavedmodeselectmenu.dec.lua @@ -0,0 +1,422 @@ +MatchRules.OpenSelectionMenu = function ( f1_arg0, f1_arg1 ) + MatchRules.SelectSaveDevice( f1_arg0 ) + if Engine.UserIsGuest( f1_arg0 ) then + LUI.FlowManager.RequestPopupMenu( self, "recipe_save_failed_no_guests_popup", false, f1_arg0, false ) + elseif not Engine.HasSaveDevice( f1_arg0 ) then + LUI.FlowManager.RequestPopupMenu( self, "recipe_save_failed_no_device_popup", false, f1_arg0, false ) + else + Engine.ExecNow( "incnosplitscreencontrol menu_RECIPE_SELECT" ) + LUI.FlowManager.RequestAddMenu( self, "savedmode_select_main", true, f1_arg0, false, f1_arg1 ) + end +end + +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function ModeButtonFeeder( f2_arg0 ) + local f2_local0 = {} + local f2_local1 = MatchRules.GetSavedModeMax() + local f2_local2 = Engine.Localize( "@MPUI_EMPTY" ) + for f2_local3 = 0, f2_local1 - 1, 1 do + local f2_local6 = MatchRules.GetMetaData( f2_arg0.savedMode, f2_local3, "name" ) + local f2_local7 + if f2_local6 ~= nil and f2_local6 ~= "" then + f2_local7 = false + else + f2_local7 = true + end + local f2_local8 = MatchRules.GetMetaData( f2_arg0.savedMode, f2_local3, "rawgametype" ) + local f2_local9 = false + local f2_local10 = false + if SvS.IsSvS() and f2_local8 and not (Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f2_local8, GameTypesTable.Cols.TeamChoice ) == "1") and f2_local8 ~= "horde" then + f2_local9 = true + end + if f2_local7 then + f2_local6 = f2_local2 + end + f2_local10 = f2_local7 or f2_local9 + if f2_arg0.savedMode == "save" and f2_arg0.menuAction == "save" then + f2_local10 = false + end + f2_local0[#f2_local0 + 1] = { + type = "UIGenericButton", + id = "savedmode_" .. f2_local3, + disabled = f2_local10, + properties = { + button_text = f2_local6, + button_over_func = MBh.EmitEventToRoot( { + name = "update_selection", + savedMode = f2_arg0.savedMode, + idx = f2_local3, + showVaultText = true + } ), + button_action_func = MBh.EmitEventToRoot( { + name = "select_mode", + savedMode = f2_arg0.savedMode, + idx = f2_local3, + menuAction = f2_arg0.menuAction + } ), + button_over_disable_func = MBh.EmitEventToRoot( { + name = "update_selection", + savedMode = f2_arg0.savedMode, + idx = -1, + showVaultText = false + } ) + } + } + end + return f2_local0 +end + +function ModeDetailFeeder( f3_arg0 ) + local f3_local0 = {} + local f3_local1 = MatchRules.GetSavedModeMax() + for f3_local2 = 0, f3_local1 - 1, 1 do + f3_local0[#f3_local0 + 1] = { + type = "savedmode_details_widget", + id = "savedmode_" .. f3_local2 .. "_details", + properties = { + time_text = MatchRules.GetMetaData( f3_arg0.savedMode, f3_local2, "timestamp" ), + type_text = MatchRules.GetMetaData( f3_arg0.savedMode, f3_local2, "gametype" ) + } + } + end + return f3_local0 +end + +function SaveModeItem( f4_arg0, f4_arg1 ) + if MatchRules.SaveDataToPlayer( f4_arg0.properties.callback_params.saveToSlot ) then + LUI.FlowManager.RequestLeaveMenuByName( "savedmode_select_main" ) + end +end + +function savedmode_confirm_overwrite_popup() + return { + type = "generic_yesno_popup", + id = "mode_select_confirm_overwrite_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_ONLINEVAULT_CONFIRM_OVERWRITE" ), + message_text = Engine.Localize( "@MENU_OVERWRITE_EXISTING_FILE" ), + callback_params = { + saveToSlot = -1 + }, + yes_action = SaveModeItem + } + } +end + +function SelectMode( f6_arg0, f6_arg1 ) + local f6_local0 = MatchRules.GetData( "gametype" ) + local f6_local1 = f6_arg1.idx + if f6_arg1.savedMode == "save" then + if f6_arg1.menuAction == "save" then + local f6_local2 = MatchRules.GetMetaData( f6_arg1.savedMode, f6_local1, "name" ) + local f6_local3 + if f6_local2 ~= nil and f6_local2 ~= "" then + f6_local3 = false + else + f6_local3 = true + end + if f6_local3 then + if not MatchRules.SaveDataToPlayer( f6_local1 ) then + return + end + else + LUI.FlowManager.RequestPopupMenu( f6_arg0, "savedmode_confirm_overwrite_popup", true, f6_arg1.controller, false, { + callback_params = { + saveToSlot = f6_local1 + } + } ) + return + end + elseif f6_arg1.menuAction == "load" then + MatchRules.LoadDataFromPlayer( f6_local1 ) + end + elseif f6_arg1.savedMode == "history" then + MatchRules.LoadDataFromHistory( f6_local1 ) + end + FixTeamLimitsAndDifficultiesIfNecessary( f6_local0, MatchRules.GetData( "gametype" ) ) + if SvS.IsSvS() then + MatchRules.SetData( "commonOption", "allowCustomClasses", false ) + end + local f6_local3 = MatchRules.GetData( "mlgVersion" ) ~= "" + if f6_local3 ~= MLG.AreMLGRulesEnabled() then + MLG.SetUsingMLGRules( f6_local3 ) + end + LUI.FlowManager.RequestRestoreMenu( f6_arg0, "gamesetup_menu_main", true, f6_arg1.controller, true ) +end + +function UpdateSelection( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg1.idx + local f7_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + f7_local1.mode = f7_arg1.savedMode + f7_local1.index = f7_local0 + f7_arg0:dispatchEventToRoot( { + name = "stop_pulse", + dispatchChildren = true, + immediate = true + } ) + if f7_local0 >= 0 then + local f7_local2 = f7_arg0:getFirstDescendentById( "savedmode_" .. f7_local0 .. "_details" ) + if f7_local2 then + f7_local2:processEvent( { + name = "play_pulse", + dispatchChildren = true + } ) + end + end +end + +function SaveToVault( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + if f8_local0.index and f8_local0.index >= 0 then + if f8_local0.mode == "history" then + MatchRules.LoadDataFromHistory( f8_local0.index ) + else + MatchRules.LoadDataFromPlayer( f8_local0.index ) + end + LUI.FlowManager.RequestAddMenu( f8_arg0, "online_vault_main", true, f8_arg1.controller, false, { + vaultMode = "save", + vaultCategory = "cgm", + menu_title = Engine.Localize( "@MPUI_ONLINE_VAULT" ) + } ) + end +end + +function SaveToMyModes( f9_arg0, f9_arg1 ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 ) + if f9_local0.index and f9_local0.index >= 0 and f9_local0.mode == "history" then + local f9_local1 = MatchRules.GetData() + MatchRules.OpenSelectionMenu( f9_arg1.controller, { + vaultMode = "save", + vaultCategory = "cgm", + menu_title = Engine.Localize( "@LUA_MENU_MY_MODES" ) + } ) + end +end + +function OnCreate( f10_arg0, f10_arg1 ) + f10_arg0:clearSavedState() + f10_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true, + immediate = true + } ) +end + +function savedmode_details_widget() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = GenericButtonDims.button_height + 13.5, + left = 0, + right = 0 + } + }, + properties = { + time_text = "", + type_text = "" + }, + children = { + { + type = "UIText", + id = "mapsetup_timestamp", + properties = { + text = MBh.Property( "time_text" ) + }, + states = { + default = { + left = 0, + top = 0, + width = 200, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + }, + dark = { + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + alpha = 1 + } + }, + handlers = { + play_pulse = MBh.AnimateLoop( { + { + "dark", + 400 + }, + { + "default", + 400 + } + } ), + stop_pulse = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIText", + id = "savedmode_gametype", + properties = { + text = MBh.Property( "type_text" ) + }, + states = { + default = { + left = 220, + top = 0, + width = 480, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b, + alpha = 1 + }, + dark = { + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + alpha = 1 + } + }, + handlers = { + play_pulse = MBh.AnimateLoop( { + { + "dark", + 400 + }, + { + "default", + 400 + } + } ), + stop_pulse = MBh.AnimateToState( "default", 0 ) + } + } + } + } +end + +function savedmode_select_main() + return { + type = "UIElement", + id = "savedmode_select_root", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_RECENT_MODES" ), + savedMode = "history", + menuAction = "load" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OnCreate, + select_mode = SelectMode, + update_selection = UpdateSelection + }, + children = { + { + type = "generic_menu_title", + id = "savedmode_select_title_text_id", + properties = { + menu_title = MBh.Property( "menu_title" ) + } + }, + { + type = "UIVerticalList", + id = "savedmode_select_modelist_id", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + properties = { + savedMode = MBh.Property( "savedMode" ), + menuAction = MBh.Property( "menuAction" ) + }, + childrenFeeder = ModeButtonFeeder + }, + { + type = "UIVerticalList", + id = "savedmode_details_list_id", + focusable = false, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 520, + right = 0, + top = GenericMenuDims.menu_top - 12, + bottom = GenericMenuDims.menu_bottom + } + }, + properties = { + savedMode = MBh.Property( "savedMode" ) + }, + childrenFeeder = ModeDetailFeeder + }, + { + type = "UIBindButton", + id = "savedmode_bind_buttons", + handlers = { + button_secondary = MBh.LeaveMenu() + } + }, + { + type = "button_helper_text_main", + id = "savedmode_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + } +end + +LUI.MenuBuilder.registerDef( "savedmode_select_main", savedmode_select_main ) +LUI.MenuBuilder.registerDef( "savedmode_details_widget", savedmode_details_widget ) +LUI.MenuBuilder.registerDef( "savedmode_confirm_overwrite_popup", savedmode_confirm_overwrite_popup ) +LUI.FlowManager.RegisterStackPushBehaviour( "savedmode_select_main", function () + MatchRules.ClearMetaDataCache() +end ) +LUI.FlowManager.RegisterStackPopBehaviour( "savedmode_select_main", function () + Engine.ExecNow( "decnosplitscreencontrol menu_RECIPE_SELECT" ) +end ) +LockTable( _M ) diff --git a/lui/mp_menus/mpscreenshotviewer.dec.lua b/lui/mp_menus/mpscreenshotviewer.dec.lua new file mode 100644 index 0000000..cd0a790 --- /dev/null +++ b/lui/mp_menus/mpscreenshotviewer.dec.lua @@ -0,0 +1,140 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function ExitViewer( f1_arg0, f1_arg1 ) + local f1_local0 = OnlineVault.AbortScreenshotDownload + local f1_local1 = f1_arg0.controller + if not f1_local1 then + f1_local1 = Engine.GetFirstActiveController() + end + f1_local0( f1_local1 ) + LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) +end + +function menu_screenshot() + return { + type = "UIElement", + id = "menu_screenshot_root", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UIImage", + id = "menu_screenshot_background_id", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0.5 + } + } + }, + { + type = "UIImage", + id = "menu_screenshot_border_id", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 200, + right = -200, + top = 120, + bottom = -80, + red = Colors.window_border_color.r, + green = Colors.window_border_color.g, + blue = Colors.window_border_color.b + } + }, + children = { + { + type = "UIBindText", + id = "menu_screenshot_download_percent_id", + properties = { + dataSource = "DownloadProgress", + textFormat = Engine.Localize( "@LUA_MENU_ONLINEVAULT_DOWNLOADING_PERCENT" ) + }, + states = { + default = { + width = 400, + height = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center + } + } + }, + { + type = "UIScreenshotViewer", + id = "menu_screenshot_screenshot_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 2, + right = -2, + top = 2, + bottom = -40 + } + } + }, + { + type = "UIText", + id = "menu_screenshot_back_button_id", + properties = { + text = Engine.Localize( ButtonMap.button_secondary.string ) .. " " .. Engine.Localize( "@LUA_MENU_BACK" ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + right = -5, + bottom = -5, + width = 80, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right + } + } + } + } + }, + { + type = "UIBindButton", + id = "menu_screenshot_bind_button_id", + handlers = { + button_secondary = ExitViewer + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "menu_screenshot", menu_screenshot ) +LockTable( _M ) diff --git a/lui/mp_menus/mpstatsreset.dec.lua b/lui/mp_menus/mpstatsreset.dec.lua new file mode 100644 index 0000000..83ef33f --- /dev/null +++ b/lui/mp_menus/mpstatsreset.dec.lua @@ -0,0 +1,54 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function statsresetaction( f1_arg0, f1_arg1 ) + f1_arg0:dispatchEventToRoot( { + name = "prestige_shop_reset_all_stats", + controller = f1_arg1.controller + } ) +end + +function statsreset3() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@MENU_PRESTIGE_RESET_WARNING3" ), + popup_title = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE3" ), + yes_action = statsresetaction, + yes_text = Engine.Localize( "@MPUI_PRESTIGE_RESET_STATS" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function statsreset2() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@MENU_RESET_STATS_WARNING2" ), + popup_title = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE2" ), + yes_action = MBh.PopupMenu( "stats_reset3", true ), + yes_text = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE3" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function statsreset() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@MENU_RESET_STATS_WARNING1" ), + popup_title = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE1" ), + yes_action = MBh.PopupMenu( "stats_reset2", true ), + yes_text = Engine.Localize( "@MENU_PRESTIGE_RESET_TITLE2" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +LUI.MenuBuilder.registerDef( "stats_reset", statsreset ) +LUI.MenuBuilder.registerDef( "stats_reset2", statsreset2 ) +LUI.MenuBuilder.registerDef( "stats_reset3", statsreset3 ) +LockTable( _M ) diff --git a/lui/mp_menus/mpvault.dec.lua b/lui/mp_menus/mpvault.dec.lua new file mode 100644 index 0000000..e0dd0ce --- /dev/null +++ b/lui/mp_menus/mpvault.dec.lua @@ -0,0 +1,136 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function OnCreate( f1_arg0, f1_arg1 ) + f1_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) + f1_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@MENU_FRIENDS" ), + side = "right", + clickable = true + } ) +end + +function OnlineVaultAction( f2_arg0, f2_arg1 ) + LUI.FlowManager.RequestAddMenu( f2_arg0, "online_vault_main", true, f2_arg1.controller, false, { + vaultMode = "browse", + vaultCategory = "all", + menu_title = Engine.Localize( "@MPUI_ONLINE_VAULT" ) + } ) +end + +function FriendVaultAction( f3_arg0, f3_arg1 ) + +end + +function TheaterAction( f4_arg0, f4_arg1 ) + +end + +function ButtonFeeder( f5_arg0 ) + return { + { + type = "UIGenericButton", + id = "vault_button_0", + properties = { + button_text = Engine.Localize( "@MENU_ONLINEVAULT_CAPS" ), + button_action_func = OnlineVaultAction + } + }, + { + type = "UIGenericButton", + id = "vault_button_1", + properties = { + button_text = Engine.Localize( "@MENU_FRIENDS_ONLINEVAULT_CAPS" ), + button_action_func = FriendVaultAction + } + }, + { + type = "UIGenericButton", + id = "vault_button_2", + properties = { + button_text = Engine.Localize( "@MENU_THEATRE_CAPS" ), + button_action_func = TheaterAction + } + } + } +end + +function vault_main() + return { + type = "UIElement", + id = "vault_root", + properties = { + menu_title = Engine.Localize( "@MENU_VAULT_CAPS" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OnCreate + }, + children = { + { + type = "generic_menu_title", + id = "vault_title_id", + properties = { + menu_title = MBh.Property( "menu_title" ) + } + }, + { + type = "UIVerticalList", + id = "vault_entry_vlist_id", + focusable = true, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + vault_refresh = DoRefresh + }, + childrenFeeder = ButtonFeeder + }, + { + type = "online_friends_widget", + id = "vault_friends_widget_id" + }, + { + type = "button_helper_text_main", + id = "vault_helper_text_id" + }, + { + type = "generic_back_button", + id = "vault_bind_button_id" + } + } + } +end + +LUI.MenuBuilder.registerDef( "vault_main", vault_main ) +LockTable( _M ) diff --git a/lui/mp_menus/mpxboxlivemenu.dec.lua b/lui/mp_menus/mpxboxlivemenu.dec.lua new file mode 100644 index 0000000..d6d02e0 --- /dev/null +++ b/lui/mp_menus/mpxboxlivemenu.dec.lua @@ -0,0 +1,1109 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function CheckHasRequiredDLC( f1_arg0 ) + if Engine.GetDvarInt( "req_cpdlc" ) == 1 and Engine.IsXbox360() and not Engine.AnyoneHasRequiredDLC() then + if not Engine.AnyoneDownloadingRequiredDLC() then + LUI.FlowManager.RequestPopupMenu( f1_arg0, "need_to_download_required_dlc" ) + else + LUI.FlowManager.RequestPopupMenu( f1_arg0, "currently_downloading_required_dlc" ) + end + return false + else + return true + end +end + +f0_local0 = false +function DisplayLowRepWarning( f2_arg0, f2_arg1 ) + if not f0_local0 and Engine.AnyoneHasBadReputation() then + f0_local0 = true + LUI.FlowManager.RequestPopupMenu( f2_arg0, "generic_confirmation_popup", false, f2_arg1.controller, false, { + popup_title = Engine.Localize( "MENU_WARNING" ), + message_text = Engine.Localize( "LUA_MENU_MP_X1_LOW_REP_WARNING" ), + button_text = Engine.Localize( "MENU_OK" ), + confirmation_action = function ( f3_arg0, f3_arg1 ) + FindMatchAfterThrottleEvent( f3_arg0, f2_arg1 ) + end + } ) + return true + else + return false + end +end + +function FindMatchAfterThrottleEvent( f4_arg0, f4_arg1 ) + local f4_local0 = false + local f4_local1 = -1 + for f4_local2 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.HasActiveLocalClient( f4_local2 ) and IsFirstTimeFlowRequired( f4_local2 ) then + f4_local0 = true + if f4_local1 < 0 then + f4_local1 = f4_local2 + end + end + end + if f4_local0 then + LUI.FlowManager.RequestAddMenu( f4_arg0, "cac_member_select_main", true, f4_local1, false, { + next_screen = "cac_edit_main", + squad_location = "squadMembers", + class_location = "loadouts", + findMatch = true + } ) + elseif not disableCreateGameButtons() then + Engine.Exec( "xblive_privatematch 0" ) + if Engine.IsAliensMode() then + LUI.mp_menus.Aliens.AliensRunConfig( f4_arg1.controller ) + end + if CheckHasRequiredDLC( f4_arg0 ) then + if DisplayLowRepWarning( f4_arg0, f4_arg1 ) then + return + elseif SvS.IsSvS() then + local f4_local3 = SvS.GetCurrentSquadModeInfo() + local f4_local4, f4_local5 = SvS.GetPlaylistFromSquadMode( f4_local3 ) + local f4_local6 = false + if f4_arg1.squadsPlayNow then + f4_local6 = true + end + if not f4_arg1.squadsPlayNow and f4_local3.DynamicMatchmaking then + Playlist.DoAction( f4_local4, f4_local5, true, f4_local6 ) + else + Playlist.DoAction( f4_local4, f4_local5, false, f4_local6 ) + end + if Engine.GetDvarBool( "squad_match" ) then + Squad.StartMatch( f4_arg1.controller, true ) + Engine.SetDvarBool( "squad_find_match", true ) + end + LUI.FlowManager.RequestAddMenu( f4_arg0, "menu_xboxlive_lobby", false, f4_arg1.controller, false ) + else + LUI.FlowManager.RequestPopupMenu( f4_arg0, "playlist_main" ) + end + end + end +end + +function FindMatchAction( f5_arg0, f5_arg1 ) + if Lobby.EnteringLobby() == true then + LUI.FlowManager.RequestPopupMenu( f5_arg0, "popup_throttling", true, f5_arg1.controller, false, { + eventData = f5_arg1 + } ) + else + FindMatchAfterThrottleEvent( f5_arg0, f5_arg1 ) + end +end + +function SoloMatchAction( f6_arg0, f6_arg1 ) + if not shouldDisableSoloMatch() then + Engine.Exec( MPConfig.default_xboxlive, f6_arg1.controller ) + Engine.Exec( "ui_enumeratesaved", f6_arg1.controller ) + Engine.Exec( "xblive_privatematch 1" ) + SetIsAliensSolo( true ) + Engine.SetDvarInt( "party_maxplayers", 1 ) + Engine.Exec( "xstartprivatematch" ) + LUI.FlowManager.RequestAddMenu( f6_arg0, "menu_xboxlive_privatelobby", false, f6_arg1.controller, false, {} ) + end +end + +function PrivateMatchAction( f7_arg0, f7_arg1 ) + if not disableCreateGameButtons() then + Engine.Exec( MPConfig.default_xboxlive, f7_arg1.controller ) + Engine.Exec( "ui_enumeratesaved", f7_arg1.controller ) + Engine.Exec( "xblive_privatematch 1" ) + SetIsAliensSolo( false ) + Engine.Exec( "xstartprivatematch" ) + LUI.FlowManager.RequestAddMenu( f7_arg0, "menu_xboxlive_privatelobby", false, f7_arg1.controller, false, {} ) + end +end + +function CreateSquadAction( f8_arg0, f8_arg1 ) + Cac.ValidateAllPlayersPublicSquadMembers() + LUI.FlowManager.RequestAddMenu( f8_arg0, "cac_member_select_main", true, f8_arg1.controller, false, { + next_screen = "cac_edit_main", + squad_location = "squadMembers", + class_location = "loadouts" + } ) +end + +function BarracksAction( f9_arg0, f9_arg1 ) + if Engine.IsUserAGuest( f9_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f9_arg0, "popup_no_guest", true, f9_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f9_arg0, "menu_barracks", true, f9_arg1.controller ) + end +end + +function storeButtonAction( f10_arg0, f10_arg1 ) + Sns.OpenStoreMenu( f10_arg1.controller ) +end + +function LiveMenuCoDAnywhereAction( f11_arg0, f11_arg1 ) + if Engine.GetDvarInt( "ca_intra_only" ) == 1 then + if CoDAnywhere.ShouldShowLinkCreatePopup( f11_arg1.controller, true ) == true then + LUI.FlowManager.RequestPopupMenu( f11_arg0, "cod_anywhere_popup_menu", true, f11_arg1.controller ) + else + LUI.FlowManager.RequestPopupMenu( f11_arg0, "cod_anywhere_all_done_popup_menu", true, f11_arg1.controller ) + end + elseif CoDAnywhere.ShouldShowLinkCreatePopup( f11_arg1.controller, true ) == true then + LUI.FlowManager.RequestPopupMenu( f11_arg0, "cod_anywhere_popup_menu", true, f11_arg1.controller ) + elseif CoDAnywhere.ShouldShowLinkUCDPopup( f11_arg1.controller, true ) == true then + LUI.FlowManager.RequestPopupMenu( f11_arg0, "cod_anywhere_link_ucd_popup_menu", true, f11_arg1.controller ) + else + CoDAnywhere.DownloadNonUCDPlatforms( f11_arg1.controller ) + end +end + +function disableCreateGameButtons() + if SvS.IsSvS() and SvS.IsCurrentSquadModeDisabled() then + return true + end + local f12_local0 = Lobby.IsInPrivateParty() + local f12_local1 = Lobby.IsPrivatePartyHost() + local f12_local2 = Lobby.IsPartyHostWaitingOnMembers() + local f12_local3 + if not f12_local0 or f12_local1 then + f12_local3 = f12_local2 + else + f12_local3 = true + end + return f12_local3 +end + +function shouldDisableSoloMatch() + return Lobby.GetMemberCount( Lobby.MemberListStates.Prelobby ) ~= 1 +end + +function checkInParty() + return Lobby.IsInPrivateParty() and not Lobby.IsAloneInPrivateParty() +end + +function TriggerLeaveLiveMenu( f15_arg0, f15_arg1 ) + local f15_local0 = Engine.HasActiveLocalClient( f15_arg1.controller ) + if f15_local0 then + f15_local0 = not Engine.IsActiveLocalClientPrimary( f15_arg1.controller ) + end + if f15_local0 then + local f15_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f15_arg0 ) + if f15_local1 and f15_local1.focusedPage and f15_local1.focusedPage > 2 then + f15_arg0:dispatchEventToRoot( { + name = "lobby_slide_left", + immediate = true + } ) + end + elseif checkInParty() then + LUI.FlowManager.RequestPopupMenu( f15_arg0, "leaveprelobbywarning", true, f15_arg1.controller, false, {} ) + else + LeaveXboxLive( f15_arg0, f15_arg1 ) + end +end + +function LeaveXboxLive( f16_arg0, f16_arg1 ) + local f16_local0 = Engine.GetFirstActiveController() + Engine.Exec( "xstopprivateparty", f16_local0 ) + if not SvS.IsSvS() then + Engine.SetDvarBool( "onlinegame", false ) + Engine.SetDvarBool( "splitscreen", false ) + Engine.Exec( "forcesplitscreencontrol menu_xboxlive_CLOSE", f16_local0 ) + end + LUI.FlowManager.RequestLeaveMenuByName( "menu_xboxlive" ) +end + +function XboxliveMainSpeechHandler( f17_arg0, f17_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.ProcessActionEvent( f17_arg0, f17_arg1, Kinect.LobbySpeechGrammarHandlersArray ) + end +end + +function XboxliveMainCreate( f18_arg0, f18_arg1 ) + if SvS.IsSvS() then + LUI.FlowManager.RequestSetStack( f18_arg0, { + { + name = "mp_main_menu" + }, + { + name = "squads_mode_select_menu" + } + } ) + else + LUI.FlowManager.RequestSetStack( f18_arg0, { + { + name = "mp_main_menu" + } + } ) + end + local f18_local0 = Engine.GetFirstActiveController() + f18_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + if Lobby.GetNATType then + local f18_local1 = Lobby.GetNATType() + if f18_local1 then + f18_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "nat", + helper_text = Engine.Localize( "NETWORK_YOURNATTYPE", f18_local1 ), + side = "right", + clickable = false + } ) + end + end + ConfigureResolution() + if not Engine.GetDvarBool( "splitscreen" ) then + Engine.Exec( "forcenosplitscreencontrol menu_xboxlive_OPEN", f18_local0 ) + end + Engine.SetDvarBool( "squad_match", false ) + if Engine.IsAliensMode() then + Engine.SetDvarInt( "party_maxplayers", 4 ) + LUI.mp_menus.Aliens.SetEnableChaosMode( false ) + end + if not Engine.IsAliensMode() then + syncXP( f18_local0, Cac.GetActiveSquadMember( f18_local0 ) ) + MLG.SetUsingMLGRules( false ) + end + if SvS.IsSvS() then + assert( Engine.GetDvarBool( "onlinegame" ) ) + end + Engine.ExecNow( "uploadstats", f18_local0 ) +end + +function getTitleText() + local f19_local0 = "" + if SvS.IsSvS() then + local f19_local1 = SvS.GetCurrentSquadModeInfo() + if f19_local1 then + local f19_local2 = SvS.GetSquadModeTitleText( f19_local1 ) + end + f19_local0 = f19_local2 or "" + else + f19_local0 = Engine.Localize( "@PLATFORM_PLAY_ONLINE_CAPS" ) + end + return f19_local0 +end + +function PreLobbyNavigationPages( f20_arg0 ) + local f20_local0 = { + [#f20_local0 + 1] = { + title = getTitleText(), + element = { + type = "UIElement", + id = "lobby_options_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + lobby_page_enter = MBh.EmitEventToRoot( "show_persistent_background" ), + lobby_page_leave = MBh.EmitEventToRoot( "hide_persistent_background" ) + }, + children = { + { + type = "xboxlive_options_vlist", + id = "xboxlive_options_vlist_id", + childrenFeeder = XboxLiveOptionsFeeder + }, + { + type = "global_activity_map", + id = "global_activity_map_id" + } + } + } + }, + [#f20_local0 + 1] = { + title = Engine.Localize( "@LUA_MENU_LOBBY_LIST_CAPS" ), + element = { + type = "member_list", + id = "lobby_member_list_id", + properties = { + memberListState = Lobby.MemberListStates.Prelobby, + additional_handlers = { + lobby_page_left = function ( f21_arg0, f21_arg1 ) + f21_arg0:animateToState( "page_left", f21_arg1.animTime or 0, true ) + end, + lobby_page_right = function ( f22_arg0, f22_arg1 ) + f22_arg0:animateToState( "page_right", f22_arg1.animTime or 0, true ) + end + } + }, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 550, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + 25, + spacing = GetMemberListSpacing and GetMemberListSpacing( true ) or 2 + }, + page_left = { + leftAnchor = false, + rightAnchor = true, + left = -550, + right = 0 + }, + page_right = { + leftAnchor = true, + rightAnchor = false, + left = 0, + right = 550 + } + } + } + } + } + if not Engine.IsAliensMode() or Engine.GetDvarBool( "extinction_cac_enabled" ) then + f20_local0[#f20_local0 + 1] = { + title = Engine.Localize( "@LUA_MENU_PLAYER_STATS_CAPS" ), + element = { + type = "lobby_character_view", + id = "lobby_character_view_id", + properties = { + squad_location = "squadMembers" + } + } + } + end + f20_local0[#f20_local0 + 1] = { + title = Engine.Localize( "@LUA_MENU_PLAYER_COMPARISON_CAPS" ), + element = { + type = "lobby_player_stats", + id = "lobby_player_stats_id", + properties = { + additional_handlers = { + lobby_page_left = function ( f23_arg0, f23_arg1 ) + f23_arg0:animateToState( "page_left", f23_arg1.animTime or 0, true ) + end, + lobby_page_right = function ( f24_arg0, f24_arg1 ) + f24_arg0:animateToState( "page_right", f24_arg1.animTime or 0, true ) + end + } + }, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 550, + top = 0, + bottom = 0 + }, + page_left = { + leftAnchor = false, + rightAnchor = true, + left = -550, + right = 0 + }, + page_right = { + leftAnchor = true, + rightAnchor = false, + left = 0, + right = 550 + } + } + } + } + f20_local0[#f20_local0 + 1] = { + element = { + type = "lobby_player_stats", + id = "lobby_player_comparison_id", + properties = { + isComparison = true, + additional_handlers = { + lobby_page_left = function ( f25_arg0, f25_arg1 ) + f25_arg0:animateToState( "page_left", f25_arg1.animTime or 0, true ) + end, + lobby_page_right = function ( f26_arg0, f26_arg1 ) + f26_arg0:animateToState( "page_right", f26_arg1.animTime or 0, true ) + end + } + }, + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 550, + top = 0, + bottom = 0 + }, + page_left = { + leftAnchor = false, + rightAnchor = true, + left = -550, + right = 0 + }, + page_right = { + leftAnchor = true, + rightAnchor = false, + left = 0, + right = 550 + } + } + } + } + return f20_local0 +end + +function UpdatePlayersInPartyText( f27_arg0, f27_arg1 ) + assert( f27_arg0.properties.text ) + f27_arg0:setText( Engine.GetDvarString( "party_partyplayercount" ) ) +end + +function disableStoreButton() + if Engine.IsPS3() or Engine.IsPS4() then + return disableCreateGameButtons() + else + return false + end +end + +function XboxLiveOptionsFeeder( f29_arg0 ) + local f29_local0 = Engine.IsAliensMode() + local f29_local1 = SvS.IsSvS() + local f29_local2 = SvS.IsSvS() + if f29_local2 then + f29_local2 = SvS.GetCurrentSquadModeInfo() + end + local f29_local3 = {} + local f29_local4 = nil + if f29_local0 then + f29_local4 = Engine.Localize( "@LUA_MENU_PUBLIC_MATCH_CAPS" ) + elseif f29_local1 then + f29_local4 = Engine.Localize( "@PLATFORM_FIND_GAME_CAPS" ) + else + f29_local4 = Engine.Localize( "@PLATFORM_FIND_GAME_CAPS" ) + end + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "find_match_button_id", + disabled = disableCreateGameButtons(), + properties = { + button_text = f29_local4, + button_action_func = FindMatchAction, + desc_text = SvS.IsSvS() and Engine.Localize( "@LUA_MENU_SQUADS_FIND_MATCH_DESC" ) or Engine.Localize( "@PLATFORM_DESC_FIND_GAME" ), + disabledFunc = disableCreateGameButtons, + additional_handlers = { + check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable + } + } + } + if f29_local0 then + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "solo_match_button_id", + disabled = shouldDisableSoloMatch(), + properties = { + button_text = Engine.Localize( "@LUA_MENU_SOLO_MATCH_CAPS" ), + button_action_func = SoloMatchAction, + desc_text = Engine.Localize( "@LUA_MENU_SOLO_MATCH_DESC" ), + disabledFunc = shouldDisableSoloMatch, + additional_handlers = { + check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable + } + } + } + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "private_match_button_id", + disabled = disableCreateGameButtons(), + properties = { + button_text = Engine.Localize( "@LUA_MENU_CUSTOM_MATCH_CAPS" ), + button_action_func = PrivateMatchAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_PRIVATE_MATCH" ), + disabledFunc = disableCreateGameButtons, + additional_handlers = { + check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable + } + } + } + end + if not f29_local0 then + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "create_squad_button_id", + disabled = false, + properties = { + button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ), + button_action_func = CreateSquadAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" ), + additional_handlers = { + refresh_new_icons = function ( f30_arg0, f30_arg1 ) + if Cac.AnyUnseenMDLCItems( Engine.GetFirstActiveController(), NewIconsTable.CACItemTypes ) then + f30_arg0:processEvent( { + name = "show_new_icon" + } ) + end + end + } + } + } + else + f29_local3[#f29_local3 + 1] = LUI.mp_menus.AliensLoadout.GetAliensLoadoutButton() + end + local f29_local5 = { + type = "UIGenericButton", + id = "leaderboards_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARDS" ), + button_action_func = function ( f31_arg0, f31_arg1 ) + if Engine.IsUserAGuest( f31_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f31_arg0, "popup_no_guest", true, f31_arg1.controller ) + else + LUI.FlowManager.RequestAddMenu( f31_arg0, "leaderboards", true, f31_arg1.controller ) + end + end + } + } + if f29_local1 and f29_local2.HasLeaderboard then + f29_local3[#f29_local3 + 1] = f29_local5 + end + if f29_local1 and f29_local2 and f29_local2.HasReports then + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "squad_reports_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS" ), + desc_text = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS_DESC" ), + button_action_func = function ( f32_arg0, f32_arg1 ) + LUI.FlowManager.RequestAddMenu( f32_arg0, "squad_reports_menu", false, f32_arg1.controller, false, { + controller = f32_arg1.controller + } ) + end + } + } + end + if not f29_local0 and not f29_local1 then + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "operations_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_OPERATIONS_TITLE" ), + button_action_func = LUI.mp_menus.MPBarracks.BarrackOperationsAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_CHALLENGES" ) + } + } + end + if not f29_local0 then + if not f29_local1 then + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "barracks_button_id", + disabled = false, + properties = { + button_text = Engine.Localize( "@LUA_MENU_BARRACKS_CAPS" ), + button_action_func = BarracksAction, + desc_text = Clan.IsEnabled() and Engine.Localize( "@LUA_MENU_DESC_BARRACKS" ) or Engine.Localize( "@LUA_MENU_DESC_BARRACKS_PRIVATE" ) + } + } + end + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "store_button_id", + disabled = disableStoreButton(), + properties = { + button_text = Engine.Localize( "@LUA_MENU_STORE_CAPS" ), + button_action_func = storeButtonAction, + desc_text = Engine.Localize( "@LUA_MENU_STORE_DESC" ), + disabledFunc = disableStoreButton, + additional_handlers = { + refresh_new_icons = function ( f33_arg0, f33_arg1 ) + if Cac.AnyUnseenMDLCItems( Engine.GetFirstActiveController(), { + "Store" + } ) then + f33_arg0:processEvent( { + name = "show_new_icon" + } ) + end + end, + button_action = function ( f34_arg0, f34_arg1 ) + Cac.ClearAllNewIconsForType( f34_arg1.controller, "Store" ) + end + } + } + } + if not f29_local1 or f29_local2 ~= SvS.SquadModes.SquadVsSquad then + f29_local3[#f29_local3 + 1] = { + type = "generic_separator" + } + end + if not f29_local1 then + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "private_match_button_id", + disabled = disableCreateGameButtons(), + properties = { + button_text = Engine.Localize( "@LUA_MENU_PRIVATE_MATCH_CAPS" ), + button_action_func = PrivateMatchAction, + desc_text = Engine.Localize( "@LUA_MENU_DESC_PRIVATE_MATCH" ), + disabledFunc = disableCreateGameButtons, + additional_handlers = { + check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable + } + } + } + end + if f29_local1 then + if f29_local2 == SvS.SquadModes.SquadAssault then + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "squad_match_button_id", + disabled = disableCreateGameButtons(), + properties = { + button_text = Engine.Localize( "LUA_MENU_CHALLENGE_FRIEND_CAPS" ), + button_action_func = function ( f35_arg0, f35_arg1 ) + if IsFirstTimeFlowRequired( f35_arg1.controller ) then + LUI.FlowManager.RequestAddMenu( f35_arg0, "cac_member_select_main", true, f35_arg1.controller, false, { + next_screen = "cac_edit_main", + squad_location = "squadMembers", + class_location = "loadouts", + findMatch = true + } ) + elseif CheckHasRequiredDLC( f35_arg0 ) then + LUI.FlowManager.RequestPopupMenu( f35_arg0, "popup_friends", true, f35_arg1.controller, false, { + challengeMode = true + } ) + end + end, + desc_text = Engine.Localize( "LUA_MENU_CHALLENGE_FRIEND_DESC" ), + disabledFunc = disableCreateGameButtons, + additional_handlers = { + check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable + } + } + } + end + if f29_local2 and not f29_local2.RequiresMatchmaking then + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "play_now_button_id", + disabled = disableCreateGameButtons(), + properties = { + button_text = Engine.Localize( "LUA_MENU_PLAY_NOW_CAPS" ), + button_action_func = function ( f36_arg0, f36_arg1 ) + f36_arg1.squadsPlayNow = true + FindMatchAction( f36_arg0, f36_arg1 ) + end, + desc_text = Engine.Localize( "LUA_MENU_PLAY_NOW_DESC" ), + disabledFunc = disableCreateGameButtons, + additional_handlers = { + check_buttons = LUI.mp_menus.MPLivePrivateLobby.RefreshButtonDisable + } + } + } + end + end + end + if f29_local0 then + f29_local3[#f29_local3 + 1] = f29_local5 + if LUI.mp_menus.Aliens.CanAccessIntelMenu() then + f29_local3[#f29_local3 + 1] = LUI.mp_menus.AliensIntel.GetAliensIntelButton() + end + f29_local3[#f29_local3 + 1] = { + type = "UIGenericButton", + id = "coda_button_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_CAPS" ), + button_action_func = LiveMenuCoDAnywhereAction, + desc_text = Engine.Localize( "@LUA_MENU_COD_ANYWHERE_DESC" ) + } + } + end + local f29_local6 = #f29_local3 + 1 + local f29_local7 = { + type = "button_desc_text", + id = "prelobby_description_id" + } + local f29_local8 = {} + local f29_local9 + if not (not SvS.IsSvS() or f29_local2 ~= SvS.SquadModes.SquadAssault) or Engine.IsAliensMode() or Engine.IsCoreMode() then + f29_local9 = 1 + if not f29_local9 then + + else + f29_local8.lines = f29_local9 + f29_local7.properties = f29_local8 + f29_local3[f29_local6] = f29_local7 + f29_local3[#f29_local3 + 1] = { + type = "UITimer", + id = "bnt_lock_tmr", + properties = { + event = "check_buttons", + interval = 500, + disposable = false, + broadcastToRoot = true + } + } + return f29_local3 + end + end + f29_local9 = nil +end + +function xboxlive_options_vlist() + local f37_local0 = { + type = "UIVerticalList", + focusable = true + } + local f37_local1 = {} + local f37_local2 = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + if Engine.IsAliensMode() then + local f37_local3 = LUI.mp_menus.Aliens.CanAccessIntelMenu() + local f37_local4 = -2 + end + f37_local2.spacing = f37_local3 and f37_local4 or 0 + f37_local1.default = f37_local2 + f37_local0.states = f37_local1 + return f37_local0 +end + +function menu_xboxlive() + local f38_local0 = Engine.IsAliensMode() + local f38_local1 = { + type = "UIElement", + id = "xboxlive_main_root" + } + local f38_local2 + if SvS.IsSvS() and SvS.GetCurrentSquadModeInfo() == SvS.SquadModes.SquadVsSquad then + f38_local2 = false + else + f38_local2 = true + end + f38_local1.isSignInMenu = f38_local2 + f38_local1.states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + f38_local1.properties = { + additional_handlers = { + gain_focus = function ( f39_arg0, f39_arg1 ) + f39_arg0:dispatchEventToRoot( { + name = "refresh_new_icons", + immediate = true + } ) + f39_arg0:dispatchEventToRoot( { + name = "open_motd", + immediate = true + } ) + if Engine.IsAliensMode() then + LUI.mp_menus.Aliens.syncEggXP() + end + end, + restore_focus = function ( f40_arg0, f40_arg1 ) + f40_arg0:dispatchEventToRoot( { + name = "refresh_new_icons", + immediate = true + } ) + if Engine.IsAliensMode() then + LUI.mp_menus.Aliens.syncEggXP() + end + end + } + } + f38_local1.handlers = { + menu_create = XboxliveMainCreate, + speech_action = XboxliveMainSpeechHandler, + find_match_after_throttle = FindMatchAfterThrottleEvent, + xboxlive_refresh_menu = function ( f41_arg0, f41_arg1 ) + f41_arg0:processEvent( { + name = "menu_refresh" + } ) + f41_arg0:dispatchEventToChildren( { + name = "update_header_text", + string = getTitleText(), + immediate = true + } ) + end + } + f38_local1.children = { + { + type = "UIImage", + id = "xboxlive_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, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + show_persistent_background = MBh.AnimateToState( "default", 200 ), + hide_persistent_background = MBh.AnimateToState( "visible", 200 ) + } + }, + { + type = "lobby_navigation", + properties = { + lobbyNavigationPages = PreLobbyNavigationPages + } + }, + { + type = "UIText", + id = "party_size_text_id", + properties = { + text = "" + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 720, + right = 1118, + top = 67, + bottom = 67 + CoD.TextSettings.SmallFont.Height, + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.SmallFont.Font, + red = 0.5, + green = 0.5, + blue = 0.5, + alpha = 1 + } + }, + handlers = { + member_list_refresh = UpdatePlayersInPartyText + } + }, + { + type = "UIElement", + id = "squads_mode_too_many_players_container_id", + properties = { + initialSquadMode = SvS.GetCurrentSquadModeInfo() + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0 + }, + active = { + alpha = 1 + } + }, + handlers = { + update_too_many_players = function ( f42_arg0, f42_arg1 ) + if not SvS.IsSvS() then + return + end + local f42_local0 = true + local f42_local1 = SvS.GetCurrentSquadModeInfo() + if SvS.IsSquadModeDisabled( f42_local1 ) then + local f42_local2, f42_local3 = SvS.GetPlaylistFromSquadMode( f42_local1 ) + f42_local0 = Playlist.GetItemMaxParty( f42_local2, f42_local3 ) >= Lobby.GetMemberCount( Lobby.MemberListStates.Prelobby ) + end + local f42_local3 = f42_arg0 + local f42_local2 = f42_arg0.animateToState + local f42_local4 + if f42_local0 then + f42_local4 = "default" + if not f42_local4 then + + else + f42_local2( f42_local3, f42_local4, 200 ) + if (Engine.IsPS3() or Engine.IsPS4()) and (f42_local1 == SvS.SquadModes.SquadAssault or f42_local1 == SvS.SquadModes.SquadVsSquad) and Engine.CanViewClanTags() == false then + LeaveXboxLive( f42_arg0, f42_arg1 ) + SvS.ShowChatRestrict = true + end + if f42_arg0.properties.initialSquadMode and f42_arg0.properties.initialSquadMode ~= f42_local1 then + f42_arg0.properties.initialSquadMode = f42_local1 + f42_arg0:dispatchEventToParent( { + name = "xboxlive_refresh_menu" + } ) + end + end + end + f42_local4 = "active" + end + }, + children = { + { + type = "UIImage", + id = "too_many_players_icon", + states = { + default = { + material = RegisterMaterial( "icon_new" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 80, + width = 28, + top = 88, + height = 28 + } + } + }, + { + type = "UIMarqueeText", + id = "too_many_players_text", + properties = { + text = Engine.Localize( "LUA_MENU_TOO_MANY_PLAYERS" ) + }, + states = { + default = CoD.ColorizeState( Colors.frontend_hilite, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 111, + right = -23, + top = 91, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + } + }, + { + type = "UITimer", + id = "too_many_layers_timer", + properties = { + event = "update_too_many_players", + interval = 100 + } + } + } + }, + { + type = "UIMarqueeText", + id = "missing_dlc_text", + properties = { + text = "" + }, + states = { + default = CoD.ColorizeState( Colors.orange, { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -660, + right = -60, + top = 91, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + handlers = { + update_missing_dlc_text = function ( f43_arg0, f43_arg1 ) + local f43_local0, f43_local1, f43_local2 = Engine.PartyMissingMapPacks() + if f43_local0 and f43_local2 then + f43_arg0:setText( Engine.Localize( "DLC_PLAYER_DOESNT_HAVE_MAP_PACK", Engine.MarkLocalized( f43_local2 ), Engine.Localize( f43_local1 ) ) ) + else + f43_arg0:setText( "" ) + end + end + }, + children = { + { + type = "UITimer", + id = "missing_dlc_text_timer", + properties = { + event = "update_missing_dlc_text", + interval = 100 + } + } + } + }, + { + type = "UIBindButton", + id = "lobby_bind_buttons_id", + handlers = { + button_secondary = TriggerLeaveLiveMenu, + exit_live_lobby = LeaveXboxLive + } + }, + { + type = "SocialFeedTicker", + id = "social_ticker_id" + }, + { + type = "character_playing_as", + id = "character_playing_as_id" + }, + { + type = "button_helper_text_main", + id = "cac_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + return f38_local1 +end + +function MPXboxLivePopFunc() + clearMatchData() + if not SvS.IsSvS() then + PersistentBackground.ProcessEvent( { + name = "unblur_persistent_background", + duration = 500 + } ) + end +end + +function MPXboxLivePushFunc() + if not SvS.IsSvS() then + PersistentBackground.ProcessEvent( { + name = "blur_persistent_background", + duration = 500 + } ) + end + Engine.PLMRefreshData() +end + +LUI.MenuBuilder.registerDef( "menu_xboxlive", menu_xboxlive ) +LUI.FlowManager.RegisterStackPopBehaviour( "menu_xboxlive", MPXboxLivePopFunc ) +LUI.FlowManager.RegisterStackPushBehaviour( "menu_xboxlive", MPXboxLivePushFunc ) +LUI.MenuBuilder.registerDef( "xboxlive_options_vlist", xboxlive_options_vlist ) +LockTable( _M ) diff --git a/lui/mp_menus/operations.dec.lua b/lui/mp_menus/operations.dec.lua new file mode 100644 index 0000000..8d01810 --- /dev/null +++ b/lui/mp_menus/operations.dec.lua @@ -0,0 +1,3389 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +DebugPrint( "Registering " .. _NAME ) +OPERATIONS_LIST_WIDTH = 480 +function RequestOperationListPopup( f1_arg0, f1_arg1, f1_arg2, f1_arg3 ) + f1_arg0:dispatchEventToRoot( { + name = "hide_groups", + immediate = true, + dispatchChildren = true + } ) + f1_arg0:dispatchEventToRoot( { + name = "hide_tracked_ops", + immediate = true + } ) + f1_arg0:dispatchEventToRoot( { + name = "show_widget" + } ) + f1_arg0:dispatchEventToRoot( { + name = "update_operations_title", + string = f1_arg2 + } ) + f1_arg0:dispatchEventToRoot( { + name = "setup_operation_list_button_helpers" + } ) + LUI.FlowManager.RequestPopupMenu( f1_arg0, "operations_selection_popup", true, f1_arg1, false, f1_arg3 ) +end + +function OpenOperationGroup( f2_arg0, f2_arg1, f2_arg2, f2_arg3 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + f2_local0.currentGroupRef = f2_arg3 + f2_local0.isWeaponGroup = false + f2_local0.currentWeaponClass = nil + f2_local0.currentWeaponRef = nil + RequestOperationListPopup( f2_arg0, f2_arg1, f2_arg2, { + groupRef = f2_arg3 + } ) +end + +function OpenWeaponOperations( f3_arg0, f3_arg1, f3_arg2, f3_arg3, f3_arg4 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + f3_local0.isWeaponGroup = true + f3_local0.currentWeaponClass = f3_arg3 + f3_local0.currentWeaponRef = f3_arg4 + f3_local0.currentGroupRef = nil + RequestOperationListPopup( f3_arg0, f3_arg1, f3_arg2 ) +end + +function OnWeaponTypesPopupClosed( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "show_tracked_ops", + controller = f4_arg1.controller + } ) + f4_arg0:dispatchEventToRoot( { + name = "show_widget" + } ) +end + +function GetWeaponClassPopupData() + local f5_local0 = Cac.GetWeaponTypes( true ) + local f5_local1 = {} + for f5_local5, f5_local6 in ipairs( f5_local0 ) do + if f5_local6 ~= "weapon_knifefast" then + f5_local1[#f5_local1 + 1] = f5_local6 + end + end + return { + customTop = 15, + customLeft = 135, + customRight = 0, + customBottom = 0, + titleBarText = Engine.Localize( "@MPUI_PRIMARY_WEAPON_CAPS" ), + noNewIcons = true, + OnMenuBack = OnWeaponTypesPopupClosed, + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetWeaponCategoryName, OpenWeaponPopup, f5_local1, nil, Cac.GetItemClassDescriptions, nil, nil, nil, nil, "cac_edit_popup_main", nil, true ) + } +end + +function OpenWeaponTypesPopup( f6_arg0, f6_arg1 ) + f6_arg0:dispatchEventToRoot( { + name = "hide_tracked_ops", + controller = f6_arg1.controller + } ) + f6_arg0:dispatchEventToRoot( { + name = "hide_widget" + } ) + LUI.FlowManager.RequestPopupMenu( f6_arg0, "cac_edit_popup_main", true, f6_arg1.controller, false, GetWeaponClassPopupData() ) +end + +function OpenWeaponPopup( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + if f7_arg0.properties.itemType == "weapon_riot" then + OpenWeaponOperationsPopup( f7_arg0, { + controller = f7_arg1.controller, + weaponClass = "weapon_riot", + weaponName = "iw6_riotshield" + } ) + return + else + local f7_local1 = GetWeaponClassPopupData() + f7_local1.menu = "cac_edit_popup_main" + LUI.FlowManager.RequestPopupMenu( f7_arg0, "cac_edit_popup_main_second", true, f7_arg1.controller, true, { + itemIndex = f7_local0.itemIndex, + weaponClass = f7_local0.currentHighlightedType, + customTop = 15, + customLeft = 135, + customRight = 0, + customBottom = 0, + titleBarText = Cac.GetWeaponCategoryNameCaps( f7_arg0.properties.itemType ), + noNewIcons = true, + buttonFeeder = Cac.EditPopupButtonsFactory( Cac.GetWeaponName, OpenWeaponOperationsPopup, Cac.GetWeaponList( f7_arg0.properties.itemType, f7_arg1.controller ), nil, Cac.GetWeaponDesc, nil, nil, nil, nil, "cac_edit_popup_main_second", nil, true ), + editPopupOpenMenuOnClose = f7_local1 + } ) + end +end + +function OpenWeaponOperationsPopup( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "cac_edit_popup_main_second" ) + local f8_local1 = f8_arg1.weaponName or f8_local0.currentHighlightedType + local f8_local2 = f8_arg1.weaponClass or f8_local0.weaponClass + Cac.UpdateCamoGoldChallenge( f8_arg1.controller, f8_local1, true ) + OpenWeaponOperations( f8_arg0, f8_arg1.controller, Cac.GetWeaponName( f8_local1 ), f8_local2, f8_local1 ) + f8_arg0:dispatchEventToRoot( { + name = "hide_cac_edit_popup", + controller = f8_arg1.controller, + immediate = true + } ) +end + +function GroupButtonsFeeder( f9_arg0 ) + local f9_local0 = f9_arg0.exclusiveController + local f9_local1 = nil + f9_local1 = GetAllOpGroupRefs() + local f9_local2 = {} + for f9_local6, f9_local7 in ipairs( f9_local1 ) do + f9_local2[#f9_local2 + 1] = { + type = "UIGenericButton", + id = f9_local7 .. "_id", + properties = { + text = Engine.Localize( GetFieldForOperationsGroup( f9_local7, OperationGroups.Cols.Name ) ), + groupRef = f9_local7, + groupDescText = Engine.Localize( GetFieldForOperationsGroup( f9_local7, OperationGroups.Cols.Desc ) ), + additional_handlers = { + button_over = function ( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0:getParent() + f10_local0:processEvent( { + name = "set_button_info_text", + groupDescText = f10_arg0.properties.groupDescText + } ) + f10_arg0:dispatchEventToRoot( { + name = "notify_category_focused", + groupRef = f10_arg0.properties.groupRef + } ) + end, + button_up = function ( f11_arg0, f11_arg1 ) + f11_arg0:dispatchEventToRoot( { + name = "notify_category_focused", + groupRef = nil, + immediate = true + } ) + end + } + }, + handlers = { + button_action = function ( f12_arg0, f12_arg1 ) + if f12_arg0.properties.groupRef == "weapon_ops" then + OpenWeaponTypesPopup( f12_arg0, f12_arg1 ) + else + OpenOperationGroup( f12_arg0, f12_arg1.controller, f12_arg0.properties.text, f12_arg0.properties.groupRef, false ) + end + end + } + } + end + f9_local2[#f9_local2 + 1] = { + type = "button_desc_text", + id = "operations_main_menu_desc_id", + handlers = { + set_button_info_text = function ( f13_arg0, f13_arg1 ) + if f13_arg1.groupDescText then + f13_arg1.text = f13_arg1.groupDescText + f13_arg0:dispatchEventToChildren( f13_arg1 ) + end + end + } + } + return f9_local2 +end + +function SetupMainMenuButtonHelpers( f14_arg0, f14_arg1 ) + f14_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = "", + side = "left", + clickable = false, + immediate = true, + priority = 1 + } ) + f14_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_shoulderl", + button_ref2 = "", + helper_text = "", + side = "left", + clickable = true, + immediate = true, + priority = 2 + } ) + f14_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_shoulderr", + button_ref2 = "", + helper_text = "", + side = "left", + clickable = true, + immediate = true, + priority = 3 + } ) +end + +function SetupSortButtonHelper( f15_arg0, f15_arg1 ) + f15_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_shoulderr", + button_ref2 = "", + helper_text = Engine.Localize( "@LUA_MENU_MP_OP_SORT_PREFIX", OperationUtilsCache.SortTypeNames[OperationUtilsCache.CurrentSortType] ), + side = "left", + clickable = true, + immediate = true, + priority = 3 + } ) +end + +function SetupOperationListMenuButtonHelpers( f16_arg0, f16_arg1 ) + local f16_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f16_arg0 ) + if f16_arg1.showTrackHelper then + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then + f16_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = Engine.Localize( "@LUA_MENU_TRACK_OPS" ), + side = "left", + clickable = false, + immediate = true, + priority = 1 + } ) + end + else + f16_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = "", + side = "left", + clickable = false, + immediate = true, + priority = 1 + } ) + end + f16_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_shoulderl", + button_ref2 = "", + helper_text = Engine.Localize( "@LUA_MENU_TOP" ), + side = "left", + clickable = true, + immediate = true, + priority = 2 + } ) + f16_arg0:processEvent( { + name = "setup_sort_type_button_helper" + } ) +end + +function GetTrackedOpsButton( f17_arg0, f17_arg1, f17_arg2, f17_arg3 ) + local f17_local0 = { + name = "", + progressText = "", + progressValue = 0, + desc = "", + category = "", + groupRef = "" + } + if f17_arg2 ~= "" then + local f17_local1 = GetOperationData( f17_arg0, f17_arg2 ) + local f17_local2 = getGroupRefForOperation( f17_arg2 ) + local f17_local3 = Engine.Localize( GetFieldForOperationsGroup( f17_local2, OperationGroups.Cols.Name ) ) + f17_local0.name = f17_local1.Name + f17_local0.progressText = f17_local1.ProgressText + f17_local0.progressValue = f17_local1.PercentProgress + f17_local0.desc = f17_local1.Desc + f17_local0.category = f17_local3 + f17_local0.groupRef = f17_local2 + end + return { + type = "popup_track_op_button", + id = "tracked_op_button_" .. f17_arg1, + properties = { + controller = f17_arg0, + index = f17_arg1 - 1, + text = f17_local0.name, + progressText = f17_local0.progressText, + progressValue = f17_local0.progressValue, + desc = f17_local0.desc, + progressBarWidth = 450, + number = f17_arg1, + category = f17_local0.category, + trackOpsPopup = f17_arg3 or false, + groupRef = f17_local0.groupRef + }, + disabled = not f17_arg3 + } +end + +function TrackedOpsPanelFeeder( f18_arg0 ) + local f18_local0 = f18_arg0.exclusiveController + local f18_local1 = { + [#f18_local1 + 1] = { + type = "UIElement", + id = "spacer", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = 20 + } + } + } + } + for f18_local2 = 1, MaxTrackedOperations, 1 do + f18_local1[#f18_local1 + 1] = GetTrackedOpsButton( f18_local0, f18_local2, GetTrackedOp( f18_local0, f18_local2 - 1 ) ) + end + return f18_local1 +end + +function operations_main_menu() + return { + type = "UIElement", + id = "operations_main_menu", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + properties = { + currency = "200" + }, + handlers = { + menu_create = function ( f20_arg0, f20_arg1 ) + assert( f20_arg0.properties.exclusiveController ) + local f20_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f20_arg0 ) + f20_local0.controller = f20_arg0.properties.exclusiveController + end + + }, + children = { + { + type = "UIImage", + id = "main_background", + states = { + default = { + material = RegisterMaterial( "bkgd_cas" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + } + } + }, + { + type = "generic_menu_title", + id = "menu_title_text", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_OPERATIONS_TITLE" ), + additional_handlers = { + update_operations_title = function ( f21_arg0, f21_arg1 ) + if f21_arg1.string then + f21_arg0:processEvent( { + name = "update_header_text", + string = f21_arg1.string + } ) + end + end + + } + } + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id", + handlers = { + menu_create = function ( f22_arg0, f22_arg1 ) + local f22_local0 = LUI.ButtonHelperText.CommonEvents.addBackButton + f22_local0.ignorePopups = true + f22_arg0:processEvent( f22_local0 ) + SetupMainMenuButtonHelpers( f22_arg0, f22_arg1 ) + end + , + setup_main_menu_button_helpers = SetupMainMenuButtonHelpers, + setup_operation_list_button_helpers = SetupOperationListMenuButtonHelpers, + setup_sort_type_button_helper = SetupSortButtonHelper + } + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id", + properties = { + ignorePopups = true + } + }, + { + type = "cac_edit_currency", + id = "cac_edit_currency_id" + }, + { + type = "UIElement", + id = "left_panel_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UIImage", + id = "vlist_background", + states = { + default = { + material = RegisterMaterial( "gradient_top" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 100, + right = 100 + OPERATIONS_LIST_WIDTH, + top = 120, + bottom = -72, + red = 0, + green = 0, + blue = 0, + alpha = 0 + }, + visible = { + alpha = 0.15 + } + }, + handlers = { + hide_groups = MBh.AnimateToState( "visible", 0 ), + show_groups = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIVerticalList", + id = "group_options_list", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + alignment = LUI.Alignment.Top, + alpha = 1, + spacing = 1 + }, + hidden = { + alpha = 0 + } + }, + childrenFeeder = GroupButtonsFeeder, + handlers = { + hide_groups = MBh.AnimateToState( "hidden", 0 ), + show_groups = MBh.AnimateToState( "default", 0 ) + } + } + } + }, + { + type = "operations_info_panel" + }, + { + type = "UIElement", + id = "tracked_operations_panel", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom, + left = -700, + right = -150, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + hide_tracked_ops = MBh.AnimateToState( "hidden", 0 ), + show_tracked_ops = MBh.AnimateToState( "default", 0 ) + }, + children = { + { + type = "UIVerticalList", + id = "tracked_operations_layout_list", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "generic_menu_titlebar", + id = "tracked_operations_title", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = Engine.Localize( "LUA_MENU_MP_TRACKED_OPS" ), + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left + } + }, + { + type = "generic_menu_background_withfade", + id = "bkgd", + properties = { + top_offset = 0, + fade_height = defaultHeight, + hide_shadow = true + }, + children = { + { + type = "UIVerticalList", + id = "tracked_operations_ops_vlist", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + childrenFeeder = TrackedOpsPanelFeeder + } + } + } + } + } + } + }, + { + type = "UIBindButton", + id = "bind_button_id", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +function operation_button( f23_arg0, f23_arg1, f23_arg2 ) + local f23_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + local f23_local1 = 48 + local f23_local2 = 5 + local f23_local3 = 10 + local f23_local4 = -18 + local f23_local5 = 28 + local f23_local6 = 9 + local f23_local7 = f23_arg1.controller + local f23_local8 = f23_arg1.groupRef + local f23_local9 = f23_arg1.opIdx + local f23_local10 = nil + if f23_local0.isWeaponGroup then + f23_local10 = GetOperationForWeaponFromCache( f23_local7, f23_local0.currentWeaponClass, f23_local0.currentWeaponRef, f23_local9 ) + else + f23_local10 = GetCachedOpForGroup( f23_local7, f23_local8, f23_local9 ) + end + local f23_local11 = IsOpTracked( f23_local7, f23_local10 ) + local f23_local12 = GetCachedOperationData( f23_local7, f23_local10 ) + local f23_local13 = f23_local12.Name or "Active OP" + local f23_local14 = f23_local12.ProgressText or "0/0" + local f23_local15 = f23_local12.PercentProgress or 0.5 + local f23_local16 + if f23_local11 then + f23_local16 = 1 + if not f23_local16 then + + else + local f23_local17 + if f23_local11 then + f23_local17 = 0 + if not f23_local17 then + + else + local self = LUI.UIButton.new() + self.id = "operation_button_id" + self.properties = { + Name = f23_local13, + ProgressText = f23_local14, + Progress = f23_local15, + ShowActiveOverlay = f23_local16, + FooterAlpha = f23_local17, + opIdx = f23_local9 + } + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 32, + right = -12, + top = 0, + bottom = f23_local1 + } ) + self:animateToState( "default" ) + local f23_local19 = LUI.UIImage.new() + f23_local19.id = "bnt_bkg_id" + f23_local19:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0 + } ) + f23_local19:registerAnimationState( "dimmed", { + alpha = 0.5 + } ) + f23_local19:registerAnimationState( "focus", { + alpha = 0.8 + } ) + f23_local19:animateToState( "default", 0 ) + f23_local19:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "focus", + 0, + true, + true + }, + { + "focus", + 350, + true, + true + }, + { + "dimmed", + 750, + true, + true + }, + { + "focus", + 750, + true, + true + } + } ) ) + f23_local19:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + self:addElement( f23_local19 ) + local f23_local20 = LUI.UIMarqueeText.new() + f23_local20.id = "op_name_id" + f23_local20.properties = { + groupRef = f23_local8, + opIdx = f23_local9, + controller = f23_local7 + } + f23_local20:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f23_local3, + right = -140, + top = f23_local2, + bottom = f23_local2 + CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f23_local20:registerAnimationState( "hilight", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f23_local3, + right = -140, + top = f23_local2, + bottom = f23_local2 + CoD.TextSettings.NormalFont.Height, + alpha = 1 + } ) + f23_local20:registerEventHandler( "button_over", function ( element, event ) + element:SetColor( Colors.grey_2.r, Colors.grey_2.g, Colors.grey_2.b ) + local f24_local0 = element.properties.controller + local f24_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + local f24_local2 = nil + if f24_local1.isWeaponGroup then + f24_local2 = GetOperationForWeaponFromCache( f24_local0, f24_local1.currentWeaponClass, f24_local1.currentWeaponRef, element.properties.opIdx ) + else + f24_local2 = GetCachedOpForGroup( f24_local0, element.properties.groupRef, element.properties.opIdx ) + end + element:dispatchEventToRoot( { + name = "setup_operation_list_button_helpers", + showTrackHelper = not IsOpTracked( f24_local0, f24_local2 ) + } ) + end ) + f23_local20:registerEventHandler( "button_up", function ( element, event ) + local f25_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + local f25_local1 = nil + if f25_local0.isWeaponGroup then + f25_local1 = GetOperationForWeaponFromCache( f23_local7, f25_local0.currentWeaponClass, f25_local0.currentWeaponRef, element.properties.opIdx ) + else + f25_local1 = GetCachedOpForGroup( f23_local7, element.properties.groupRef, element.properties.opIdx ) + end + if IsOpTracked( f23_local7, f25_local1 ) then + element:animateToState( "hilight" ) + element:SetColor( Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b ) + else + element:SetColor( Colors.white.r, Colors.white.g, Colors.white.b ) + element:animateToState( "default" ) + end + end ) + f23_local20:registerEventHandler( "refresh_available_ops", function ( element, event ) + local f26_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + local f26_local1 = nil + if f26_local0.isWeaponGroup then + f26_local1 = GetOperationForWeaponFromCache( f23_local7, f26_local0.currentWeaponClass, f26_local0.currentWeaponRef, element.properties.opIdx ) + else + f26_local1 = GetCachedOpForGroup( f23_local7, element.properties.groupRef, element.properties.opIdx ) + end + local f26_local2 = GetCachedOperationData( event.controller, f26_local1 ) + element:setText( f26_local2.Name ) + if IsOpTracked( f23_local7, f26_local1 ) then + if element:isParentInFocus() then + element:SetColor( Colors.grey_2.r, Colors.grey_2.g, Colors.grey_2.b ) + else + element:animateToState( "hilight" ) + element:SetColor( Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b ) + end + else + element:animateToState( "default" ) + element:SetColor( Colors.white.r, Colors.white.g, Colors.white.b ) + end + end ) + f23_local20:setText( f23_local13 ) + if f23_local16 == 1 then + f23_local20:animateToState( "hilight" ) + else + f23_local20:animateToState( "default" ) + end + self:addElement( f23_local20 ) + local f23_local21 = LUI.UIText.new() + f23_local21.id = "prog_text_id" + f23_local21.properties = { + groupRef = f23_local8, + opIdx = f23_local9, + weaponClass = f23_local0.currentWeaponClass, + weaponRef = f23_local0.currentWeaponRef + } + f23_local21:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = f23_local4, + top = 5, + bottom = 5 + CoD.TextSettings.NormalFont.Height, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 1 + } ) + f23_local21:registerAnimationState( "focus", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = f23_local4, + top = 5, + bottom = 5 + CoD.TextSettings.NormalFont.Height, + red = 0.2, + green = 0.2, + blue = 0.2, + alpha = 1 + } ) + f23_local21:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f23_local21:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f23_local21:registerEventHandler( "refresh_operations_progress", function ( element, event ) + local f27_local0 = nil + if f23_local0.isWeaponGroup then + f27_local0 = GetOperationForWeaponFromCache( event.controller, element.properties.weaponClass, element.properties.weaponRef, element.properties.opIdx ) + else + f27_local0 = GetCachedOpForGroup( event.controller, element.properties.groupRef, element.properties.opIdx ) + end + local f27_local1 = GetCachedOperationData( event.controller, f27_local0 ) + element:setText( f27_local1.ProgressText ) + end ) + f23_local21:setText( f23_local14 ) + f23_local21:animateToState( "default" ) + self:addElement( f23_local21 ) + local f23_local22 = operation_progress_bar( nil, { + width = OPERATIONS_LIST_WIDTH - f23_local3 + f23_local4, + progress = f23_local15, + groupRef = f23_local8, + opIdx = f23_local9, + weaponClass = f23_local0.currentWeaponClass, + weaponRef = f23_local0.currentWeaponRef + } ) + f23_local22:registerAnimationState( "positioned", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f23_local3, + right = f23_local4, + top = f23_local5, + bottom = f23_local5 + f23_local6 + } ) + f23_local22:registerEventHandler( "refresh_operations_progress", function ( element, event ) + local f28_local0 = nil + if f23_local0.isWeaponGroup then + f28_local0 = GetOperationForWeaponFromCache( event.controller, element.properties.weaponClass, element.properties.weaponRef, element.properties.opIdx ) + else + f28_local0 = GetCachedOpForGroup( event.controller, element.properties.groupRef, element.properties.opIdx ) + end + local f28_local1 = GetCachedOperationData( event.controller, f28_local0 ) + element:updateProgressBar( f28_local1.PercentProgress, 1000 ) + end ) + f23_local22:animateToState( "positioned" ) + self:addElement( f23_local22 ) + local f23_local23 = 0 + self:addElement( HairlineBorderType( "bottom", 0.5, 0.5, 0.5, 0.4 ) ) + local f23_local24 = LUI.UIElement.new() + f23_local24.id = "current_selection_overlay_container" + f23_local24.properties = { + groupRef = f23_local8, + opIdx = f23_local9 + } + f23_local24:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } ) + f23_local24:registerEventHandler( "refresh_available_ops", function ( element, event ) + local f29_local0 = nil + if f23_local0.isWeaponGroup then + f29_local0 = GetOperationForWeaponFromCache( f23_local7, f23_local0.currentWeaponClass, f23_local0.currentWeaponRef, element.properties.opIdx ) + else + f29_local0 = GetCachedOpForGroup( f23_local7, element.properties.groupRef, element.properties.opIdx ) + end + local f29_local1 = IsOpTracked( event.controller, f29_local0 ) + local f29_local2 = element:getChildById( "current_selection_overlay" ) + if f29_local1 and not f29_local2 then + AddOverlay( element, f23_local23 ) + elseif not f29_local1 and f29_local2 then + element:closeChildren() + end + end ) + f23_local24:animateToState( "default" ) + self:addElement( f23_local24 ) + if f23_local16 == 1 then + AddOverlay( f23_local24, f23_local23 ) + end + return self + end + end + f23_local17 = 0.5 + end + end + f23_local16 = 0 +end + +function AddOverlay( menu, controller ) + local self = LUI.UIImage.new() + local f30_local1 = "current_selection_overlay" + self:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 0.08 + } ) + self.id = f30_local1 + self:animateToState( "default" ) + menu:addElement( self ) + f30_local1 = LUI.UIImage.new() + local f30_local2 = "overlay_yellow_block" + f30_local1:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + width = 8, + right = -5, + top = 5, + bottom = -5, + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b, + alpha = 1 + } ) + f30_local1.id = f30_local2 + f30_local1:animateToState( "default" ) + menu:addElement( f30_local1 ) + f30_local2 = HairlineBorderType( "left", Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b, 1 ) + local f30_local3 = HairlineBorderType( "right", Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b, 1 ) + local f30_local4 = HairlineBorderType( "top", Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b, 1 ) + local f30_local5 = HairlineBorderType( "bottom", Colors.frontend_hilite.r, Colors.frontend_hilite.g, Colors.frontend_hilite.b, 1 ) + menu:addElement( f30_local2 ) + menu:addElement( f30_local3 ) + menu:addElement( f30_local4 ) + menu:addElement( f30_local5 ) +end + +function GetOperationButton( f31_arg0, f31_arg1, f31_arg2 ) + local f31_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + local f31_local1, f31_local2 = nil + if f31_local0.isWeaponGroup then + f31_local1 = GetOperationForWeaponFromCache( f31_arg0, f31_local0.currentWeaponClass, f31_local0.currentWeaponRef, f31_arg2 ) + else + f31_local1 = GetCachedOpForGroup( f31_arg0, f31_arg1, f31_arg2 ) + end + return { + type = "operation_button", + id = "op_button_" .. f31_local1 .. "_id", + properties = { + controller = f31_arg0, + groupRef = f31_arg1, + opIdx = f31_arg2 + }, + handlers = { + button_action = function ( f32_arg0, f32_arg1 ) + local f32_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + local f32_local1 = f32_arg0.properties.groupRef + local f32_local2 = f32_arg0.properties.opIdx + local f32_local3 = nil + if f32_local0.isWeaponGroup then + f32_local3 = GetOperationForWeaponFromCache( f32_arg0.properties.exclusiveController, f32_local0.currentWeaponClass, f32_local0.currentWeaponRef, f32_local2 ) + else + f32_local3 = GetCachedOpForGroup( f32_arg0.properties.exclusiveController, f32_local1, f32_arg0.properties.opIdx ) + end + if not IsOpTracked( f32_arg0.properties.exclusiveController, f32_local3 ) then + LUI.FlowManager.RequestPopupMenu( f32_arg0, "popup_track_op", true, f32_arg1.controller, false, { + newOp = f32_local3 + } ) + end + end + , + button_over = function ( f33_arg0, f33_arg1 ) + local f33_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + local f33_local1 = f33_arg0.properties.groupRef + local f33_local2 = f33_arg0.properties.opIdx + local f33_local3 = nil + if f33_local0.isWeaponGroup then + f33_local3 = GetOperationForWeaponFromCache( f33_arg0.properties.exclusiveController, f33_local0.currentWeaponClass, f33_local0.currentWeaponRef, f33_local2 ) + else + f33_local3 = GetCachedOpForGroup( f33_arg0.properties.exclusiveController, f33_local1, f33_arg0.properties.opIdx ) + end + local f33_local4 = GetCachedOperationData( f33_arg0.properties.exclusiveController, f33_local3 ) + f33_arg0:dispatchEventToRoot( { + name = "update_focused_op", + opRef = f33_local3 + } ) + f33_arg0:dispatchEventToRoot( { + name = "refresh_operation_info_panel", + opData = f33_local4, + immediate = true + } ) + end + + } + } +end + +function OperationButtonsFeeder( f34_arg0 ) + local f34_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + local f34_local1 = nil + if f34_local0.isWeaponGroup then + f34_local1 = GetWeaponOpsForClass( f34_local0.currentWeaponClass ) + else + f34_local1 = GetCachedOpsInGroup( f34_arg0.exclusiveController, f34_arg0.groupRef ) + end + local f34_local2 = {} + for f34_local6, f34_local7 in ipairs( f34_local1 ) do + f34_local2[#f34_local2 + 1] = GetOperationButton( f34_arg0.exclusiveController, f34_arg0.groupRef, f34_local6 ) + end + return f34_local2 +end + +function exitSelectionPopup( f35_arg0, f35_arg1 ) + local f35_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + if f35_local0.isWeaponGroup then + local f35_local1 = LUI.FlowManager.RequestRestoreMenu + local f35_local2 = f35_arg0 + local f35_local3 = LUI.FlowManager.IsInStack + local f35_local4 = Engine.GetLuiRoot() + f35_local1( f35_local2, f35_local3( f35_local4.flowManager, "cac_edit_popup_main_second" ) and "cac_edit_popup_main_second" or "cac_edit_popup_main", true, f35_arg1.controller, true ) + f35_arg0:dispatchEventToRoot( { + name = "show_cac_edit_popup", + controller = f35_arg1.controller, + immediate = true + } ) + f35_arg0:dispatchEventToRoot( { + name = "hide_widget" + } ) + else + LUI.FlowManager.RequestRestoreMenu( f35_arg0, "operations_main_menu", true, f35_arg1.controller, true ) + f35_arg0:dispatchEventToRoot( { + name = "show_tracked_ops", + immediate = true + } ) + end + f35_arg0:dispatchEventToRoot( { + name = "refresh_operation_info_panel", + immediate = true + } ) + f35_arg0:dispatchEventToRoot( { + name = "show_groups", + immediate = true, + dispatchChildren = true + } ) + f35_arg0:dispatchEventToRoot( { + name = "update_operations_title", + string = Engine.Localize( "@LUA_MENU_OPERATIONS_TITLE" ) + } ) + f35_arg0:dispatchEventToRoot( { + name = "setup_main_menu_button_helpers" + } ) +end + +function CycleSortMethod( f36_arg0, f36_arg1 ) + OperationUtilsCache.CurrentSortType = OperationUtilsCache.CurrentSortType + 1 + if #OperationUtilsCache.SortTypes < OperationUtilsCache.CurrentSortType then + OperationUtilsCache.CurrentSortType = 1 + end + f36_arg0:dispatchEventToRoot( { + name = "refresh_selection_popup", + controller = f36_arg1.controller + } ) + f36_arg0:dispatchEventToRoot( { + name = "setup_sort_type_button_helper", + controller = f36_arg1.controller + } ) +end + +function JumpToTop( f37_arg0, f37_arg1 ) + local f37_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + f37_arg0:dispatchEventToRoot( { + name = "refresh_selection_popup", + controller = f37_arg1.controller + } ) + f37_arg0:dispatchEventToRoot( { + name = "reset_list_focus" + } ) + Engine.PlaySound( CoD.SFX.ChangeScreen ) +end + +function operations_selection_popup() + return { + type = "UIStencil", + id = "operations_selection_popup_id", + properties = { + focusedOpRef = "", + sendScrollEvents = true, + scrollByChildHeight = true, + disableOutsideChildren = true + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 68, + right = 110 + OPERATIONS_LIST_WIDTH, + top = 125, + height = 490 + } + }, + handlers = { + update_focused_op = function ( f39_arg0, f39_arg1 ) + f39_arg0.properties.focusedOpRef = f39_arg1.opRef + end + , + menu_create = function ( f40_arg0, f40_arg1 ) + local f40_local0 = f40_arg0:getFirstDescendentById( "scroll_bar_id" ) + f40_local0:setList( f40_arg0:getFirstDescendentById( "operations_selection_popup_list_id" ) ) + end + , + refresh_selection_popup = function ( f41_arg0, f41_arg1 ) + f41_arg0:processEvent( { + name = "menu_refresh", + controller = f41_arg1.controller + } ) + end + + }, + children = { + { + type = "UIVerticalList", + id = "operations_selection_popup_list_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alignment = LUI.Alignment.Top, + spacing = 1 + } + }, + childrenFeeder = OperationButtonsFeeder, + handlers = { + reset_list_focus = function ( f42_arg0, f42_arg1 ) + f42_arg0:processEvent( { + name = "lose_focus", + immediate = true + } ) + f42_arg0:clearSavedState() + f42_arg0:processEvent( { + name = "gain_focus", + immediate = true + } ) + end + + } + }, + { + type = "UIVerticalScrollbar", + id = "scroll_bar_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + right = 0, + width = 10, + alpha = scrollBarAlpha + } + } + }, + { + type = "online_friends_widget", + states = { + default = { + scale = -1, + alpha = 0 + } + } + }, + { + type = "UIBindButton", + id = "bind_button_id", + handlers = { + button_secondary = exitSelectionPopup, + button_shoulderr = CycleSortMethod, + button_shoulderl = JumpToTop + } + } + } + } +end + +function operation_progress_bar( f43_arg0, f43_arg1, f43_arg2 ) + local f43_local0 = 9 + local f43_local1 = 300 + local f43_local2 = f43_arg1.progress or 0 + local f43_local3 = f43_arg1.width or f43_local1 + local f43_local4 = f43_arg1.groupRef or "" + local f43_local5 = f43_arg1.opIdx or 0 + local self = LUI.UIElement.new() + self.id = "progress_bar_root_container" + self.properties = { + progress = f43_local2, + width = f43_local3, + groupRef = f43_local4, + opIdx = f43_local5 + } + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = f43_local3, + top = 0, + bottom = f43_local0 + } ) + self:animateToState( "default" ) + local f43_local7 = LUI.UIImage.new() + f43_local7.id = "background_id" + f43_local7:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 1 + } ) + f43_local7:animateToState( "default" ) + self:addElement( f43_local7 ) + local f43_local8 = LUI.UIImage.new() + f43_local8.id = "forground_id" + f43_local8:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 1, + right = -1, + top = 1, + bottom = -1, + red = 0.1, + green = 0.1, + blue = 0.1, + alpha = 1 + } ) + f43_local8:animateToState( "default" ) + self:addElement( f43_local8 ) + if f43_local2 > 1 then + f43_local2 = 1 + end + if f43_local2 < 0 then + f43_local2 = 0 + end + local f43_local9 = f43_local3 * f43_local2 + local f43_local10 = LUI.UIImage.new() + f43_local10.id = "fill_id" + f43_local10:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 0.7, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 0.7, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 0.7, + alpha = 1 + } ) + f43_local10:registerAnimationState( "fill", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f43_local9, + top = 0, + bottom = 0, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 0.7, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 0.7, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 0.7 + } ) + f43_local10:registerAnimationState( "focus", { + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b + } ) + f43_local10:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f43_local10:registerEventHandler( "button_up", MBh.AnimateToState( "fill" ) ) + f43_local10:animateToState( "default" ) + f43_local10:animateToState( "fill", 1000 ) + self:addElement( f43_local10 ) + self.updateProgressBar = function ( f44_arg0, f44_arg1, f44_arg2 ) + f43_local10:registerAnimationState( "fill", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = math.min( f44_arg1, 1 ) * f44_arg0.properties.width, + top = 0, + bottom = 0, + red = 0.7, + green = 0.7, + blue = 0.7 + } ) + f43_local10:animateToState( "fill", f44_arg2 ) + end + + return self +end + +function operations_info_panel() + return { + type = "UIVerticalList", + id = "operations_info_panel_id", + properties = { + name = "OPERATION NAME", + desc = "Some text about how to complete Airborne operation.", + progress_text = "20/25", + progress_percent = 0.8, + reward_xp = "2500 xp", + reward_currency = "1", + image = RegisterMaterial( "white" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 650, + right = 1050, + top = 120, + bottom = 490, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + refresh_operation_info_panel = function ( f46_arg0, f46_arg1 ) + if f46_arg1.opData then + f46_arg0:animateToState( "visible", 0 ) + f46_arg0:dispatchEventToChildren( f46_arg1 ) + else + f46_arg0:animateToState( "default", 0 ) + end + end + + }, + children = { + { + type = "generic_menu_titlebar", + id = "info_panel_header_id", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = MBh.Property( "name" ), + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left, + marquee = true + }, + handlers = { + refresh_operation_info_panel = function ( f47_arg0, f47_arg1 ) + local f47_local0 = f47_arg0:getChildById( "title" ) + if f47_local0 then + f47_local0:setText( f47_arg1.opData.Name ) + end + end + + } + }, + { + type = "operations_info_panel_desc", + id = "info_panel_desc_id", + properties = { + text = MBh.Property( "desc" ) + } + }, + { + type = "operations_info_panel_sub_header", + id = "info_panel_sub_header_1_id", + properties = { + text = Engine.Localize( "@LUA_MENU_PROGRESS" ), + show_completed_text = true + } + }, + { + type = "operations_info_panel_progress", + id = "progress_widget_id", + properties = { + progressText = "0/0", + progressPercent = 0.5 + } + }, + { + type = "operations_info_panel_sub_header", + id = "info_panel_sub_header_2_id", + properties = { + text = Engine.Localize( "@LUA_MENU_REWARD" ) + } + }, + { + type = "operations_info_panel_rewards", + id = "info_panel_rewards_widget_id", + properties = { + reward_xp = "5000 xp", + reward_currency = "2" + } + } + } + } +end + +function operations_info_panel_header() + return { + type = "UIElement", + properties = { + text = Engine.Localize( "@LUA_MENU_TITLE" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 24 + } + }, + children = { + { + type = "UIImage", + id = "info_pane_header_bg_lt", + states = { + default = { + material = RegisterMaterial( "box_titlebar_angle_lt" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 20, + top = 0, + bottom = 0, + alpha = 0.5 + } + } + }, + { + type = "UIImage", + id = "info_pane_header_bg_mid", + states = { + default = { + material = RegisterMaterial( "box_titlebar_angle_mid" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 20, + right = -20, + top = 0, + bottom = 0, + alpha = 0.5 + } + } + }, + { + type = "UIImage", + id = "info_pane_header_bg_rt", + states = { + default = { + material = RegisterMaterial( "box_titlebar_angle_lt" ), + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -20, + top = 0, + bottom = 0, + alpha = 0.5 + } + } + }, + { + type = "UIText", + id = "info_pane_header_text", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 10, + right = 0, + top = -0.5 * CoD.TextSettings.BoldFont.Height, + bottom = 0.5 * CoD.TextSettings.BoldFont.Height, + red = 0.8, + green = 0.8, + blue = 0.8 + } + }, + handlers = { + refresh_operation_info_panel = function ( f49_arg0, f49_arg1 ) + f49_arg0:setText( f49_arg1.opData.Name ) + end + + } + } + } + } +end + +function operations_info_panel_sub_header() + local f50_local0 = 10 + return { + type = "UIElement", + properties = { + text = "sub header", + show_completed_text = false + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 25 + } + }, + children = { + { + type = "generic_menu_background", + id = "bkg", + properties = { + top_offset = 0, + fill_color = { + red = 1, + green = 1, + blue = 1 + }, + fill_alpha = 0.2, + show_completed_text = MBh.Property( "show_completed_text" ) + } + }, + { + type = "UIText", + id = "info_pane_header_text", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = f50_local0, + right = -f50_local0, + top = -CoD.TextSettings.BoldFont.Height / 2, + bottom = CoD.TextSettings.BoldFont.Height / 2, + red = 0.7, + green = 0.7, + blue = 0.7 + } + } + }, + { + type = "UIText", + id = "info_pane_completed_text", + properties = { + text = "", + show_completed_text = MBh.Property( "show_completed_text" ) + }, + states = { + default = { + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = f50_local0, + right = -f50_local0, + top = -CoD.TextSettings.BoldFont.Height / 2, + bottom = CoD.TextSettings.BoldFont.Height / 2, + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b + } + }, + handlers = { + refresh_operation_info_panel = function ( f51_arg0, f51_arg1 ) + if f51_arg0.properties.show_completed_text and f51_arg1.opData and f51_arg1.opData.Completed then + if f51_arg1.opData.PercentProgress < 1 then + f51_arg0:setText( Engine.Localize( "@LUA_MENU_PREVIOUSLY_COMPLETED" ) ) + else + f51_arg0:setText( Engine.Localize( "@LUA_MENU_COMPLETED" ) ) + end + else + f51_arg0:setText( "" ) + end + end + + } + } + } + } +end + +function operations_info_panel_desc() + local f52_local0 = 10 + local f52_local1 = 5 + return { + type = "UIElement", + properties = { + text = "desc" + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 55 + } + }, + children = { + { + type = "generic_menu_background", + id = "bkg", + properties = { + top_offset = 0 + } + }, + { + type = "UIText", + id = "info_pane_header_text", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f52_local0, + right = -f52_local0, + top = f52_local1, + bottom = f52_local1 + CoD.TextSettings.NormalFont.Height, + red = 0.7, + green = 0.7, + blue = 0.7 + } + }, + handlers = { + refresh_operation_info_panel = function ( f53_arg0, f53_arg1 ) + f53_arg0:setText( f53_arg1.opData.Desc ) + end + + } + } + } + } +end + +function operations_info_panel_progress() + local f54_local0 = 50 + local f54_local1 = 10 + local f54_local2 = 85 + local f54_local3 = 9 + local f54_local4 = 380 + return { + type = "UIElement", + id = "progress_widget_id", + properties = { + progressText = "0/0", + progressPercent = 0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f54_local0 + } + }, + children = { + { + type = "generic_menu_background", + id = "bkg", + properties = { + top_offset = 0 + } + }, + { + type = "UIText", + id = "progress_text_id", + properties = { + text = MBh.Property( "progressText" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = f54_local1, + right = 0, + top = -8 - CoD.TextSettings.NormalFont.Height / 2, + bottom = -8 + CoD.TextSettings.NormalFont.Height / 2, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + }, + handlers = { + refresh_operation_info_panel = function ( f55_arg0, f55_arg1 ) + f55_arg0:setText( f55_arg1.opData.Progress .. "/" .. f55_arg1.opData.MaxProgress ) + end + + } + }, + { + type = "operation_progress_bar", + id = "btn_progress_bar", + properties = { + progress = MBh.Property( "progressPercent" ), + width = f54_local4 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = f54_local1, + right = f54_local1 + f54_local4, + top = 10 - f54_local3 / 2, + bottom = 10 + f54_local3 / 2 + } + }, + handlers = { + refresh_operation_info_panel = function ( f56_arg0, f56_arg1 ) + f56_arg0:updateProgressBar( f56_arg1.opData.PercentProgress, 100 ) + end + + } + } + } + } +end + +function squadPointsRewardsFeeder( f57_arg0 ) + local f57_local0 = 16 + local f57_local1 = 16 + local f57_local2 = {} + local f57_local3, f57_local4, f57_local5, f57_local6 = GetTextDimensions( Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ), CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + f57_local2[#f57_local2 + 1] = { + type = "UIText", + id = "currency_text_id", + properties = { + text = Engine.Localize( "@LUA_MENU_CAC_COMMENDATIONS" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 0, + width = f57_local5 - f57_local3 + 3, + height = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + } + } + f57_local2[#f57_local2 + 1] = { + type = "UIImage", + id = "space_0_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + material = RegisterMaterial( "white" ), + left = 0, + top = 0, + width = 8, + bottom = 0, + alpha = 0 + } + } + } + f57_local2[#f57_local2 + 1] = { + type = "UIImage", + id = "token", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + material = RegisterMaterial( "icon_unlock_token_active" ), + left = 0, + top = (CoD.TextSettings.NormalFont.Height - f57_local1) / 2, + width = f57_local0, + height = f57_local1 + } + } + } + f57_local2[#f57_local2 + 1] = { + type = "UIImage", + id = "space_1_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + material = RegisterMaterial( "white" ), + left = 0, + top = 0, + width = 8, + bottom = 0, + alpha = 0 + } + } + } + f57_local2[#f57_local2 + 1] = { + type = "UIText", + id = "count", + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 110, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + }, + handlers = { + refresh_operation_info_panel = function ( f58_arg0, f58_arg1 ) + f58_arg0:setText( f58_arg1.opData.RewardCurrency ) + end + } + } + return f57_local2 +end + +function operations_info_panel_rewards() + local f59_local0 = 190 + local f59_local1 = 5 + local f59_local2 = -250 + local f59_local3 = 75 + local f59_local4 = 55 + local f59_local5 = 24 + local f59_local6 = -20 + local f59_local7 = 45 + local f59_local8 = -130 + local f59_local9 = 130 + local f59_local10 = 100 + return { + type = "UIElement", + id = "rewards_widget_id", + properties = { + reward_xp = "2500 xp", + reward_currency = "Currency: 1", + reward_icon = RegisterMaterial( "white" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f59_local0 + } + }, + children = { + { + type = "generic_menu_background_withfade", + id = "bkg", + properties = { + top_offset = 0, + fade_height = f59_local0 - 3, + hide_shadow = true + } + }, + { + type = "UIVerticalList", + id = "rewards_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f59_local1, + right = -f59_local1, + top = 10 + } + }, + children = { + { + type = "UIText", + id = "reward_xp_text_id", + properties = { + text = MBh.Property( "reward_xp" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f59_local1, + right = 0, + top = 32, + bottom = 32 + CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + }, + handlers = { + refresh_operation_info_panel = function ( f60_arg0, f60_arg1 ) + f60_arg0:setText( f60_arg1.opData.RewardXP .. " " .. Engine.Localize( "@LUA_MENU_XP" ) ) + end + + } + }, + { + type = "UIHorizontalList", + id = "squad_points_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f59_local1, + right = 0, + top = 10, + bottom = 10 + CoD.TextSettings.NormalFont.Height + } + }, + childrenFeeder = squadPointsRewardsFeeder + }, + { + type = "UIText", + id = "reward_item_text_id", + properties = { + text = "" + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f59_local1, + right = 0, + top = 32, + bottom = 32 + CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + }, + handlers = { + refresh_operation_info_panel = function ( f61_arg0, f61_arg1 ) + local f61_local0 = f61_arg1.opData + local f61_local1 = getUnlocksByChallenge( f61_local0.Ref, f61_local0.ActiveTier ) + local f61_local2 = "" + for f61_local6, f61_local7 in ipairs( f61_local1 ) do + if f61_local7.type ~= "Patch" and isUnlockItem( f61_local7.type ) then + f61_local2 = f61_local2 .. Engine.Localize( "LUA_MENU_OPS_REWARD", getLocNameForUnlockType( f61_local7.type ), Engine.Localize( getNameForUnlockItem( f61_local7.type, f61_local7.item ) ) ) + end + end + f61_arg0:setText( f61_local2 ) + end + + } + }, + { + type = "UIElement", + id = "reward_icon_container", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f59_local8 * 0.5, + right = -f59_local8 * 0.5, + top = 0, + bottom = f59_local9, + alpha = 1 + } + }, + handlers = {}, + children = { + { + type = "UIElement", + id = "reward_icon_bg", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + refresh_operation_info_panel = function ( f62_arg0, f62_arg1 ) + if f62_arg1.opData.RewardImage and f62_arg1.opData.RewardType == "Camo" then + f62_arg0:animateToState( "default", 0 ) + else + f62_arg0:animateToState( "hidden", 0 ) + end + end + + }, + children = { + { + type = "UIImage", + id = "reward_icon_bg_outline1", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -26, + width = 8, + top = -26, + height = 8 + } + } + }, + { + type = "UIImage", + id = "reward_icon_bg_outline2", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 18, + width = 8, + top = -26, + height = 8 + } + } + }, + { + type = "UIImage", + id = "reward_icon_bg_outline3", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -26, + width = 8, + top = 18, + height = 8 + } + } + }, + { + type = "UIImage", + id = "reward_icon_bg_outline4", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 18, + width = 8, + top = 18, + height = 8 + } + } + } + } + }, + { + type = "UIImage", + id = "reward_icon", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + alpha = 1 + }, + default_camo = { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -25, + right = 25, + top = -25, + bottom = 25, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + refresh_operation_info_panel = function ( f63_arg0, f63_arg1 ) + if f63_arg1.opData.RewardImage then + f63_arg0:setImage( f63_arg1.opData.RewardImage ) + if f63_arg1.opData.RewardType == "Camo" then + f63_arg0:animateToState( "default_camo", 0 ) + else + f63_arg0:animateToState( "default", 0 ) + end + else + f63_arg0:animateToState( "hidden", 0 ) + end + end + + } + } + } + } + } + } + } + } +end + +function RefreshOpsCompleted( f64_arg0, f64_arg1 ) + local f64_local0 = OperationsTimeoutRewards[#OperationsTimeoutRewards].req + local f64_local1 = GetNumCompletedOps( f64_arg0.properties.exclusiveController ) + local f64_local2 = f64_arg0:getChildById( "bonus_progress_text_id" ) + f64_local2:setText( math.min( f64_local1, f64_local0 ) .. "/" .. f64_local0 ) + local f64_local3 = f64_local1 / f64_local0 + local f64_local4 = f64_arg0:getChildById( "bonus_progress_bar_id" ) + f64_local4:updateProgressBar( f64_local3, 100 ) + local f64_local5 = f64_arg0:getChildById( "ops_completed_list" ) + f64_local5:closeChildren() + f64_local5:processEvent( { + name = "menu_refresh" + } ) +end + +function OpsCompletedFeeder( f65_arg0 ) + local f65_local0 = GetNumCompletedOps( f65_arg0.exclusiveController ) + local f65_local1 = { + { + req = OperationsTimeoutRewards[1].req, + xp_bonus = 5 + }, + { + req = OperationsTimeoutRewards[2].req, + xp_bonus = 5 + }, + { + req = OperationsTimeoutRewards[3].req, + xp_bonus = 5 + }, + { + req = OperationsTimeoutRewards[4].req, + xp_bonus = 5 + }, + { + req = OperationsTimeoutRewards[5].req, + xp_bonus = 5 + } + } + local f65_local2 = {} + for f65_local3 = 1, #OperationsTimeoutRewards, 1 do + local f65_local6 = 0.7 + local f65_local7 = 0.7 + local f65_local8 = 0.7 + if f65_local1[f65_local3].req <= f65_local0 then + f65_local6 = Colors.frontend_hilite.r + f65_local7 = Colors.frontend_hilite.g + f65_local8 = Colors.frontend_hilite.b + end + f65_local2[#f65_local2 + 1] = { + type = "operations_completed_info_tab", + id = "tab_" .. f65_local3, + properties = { + num_required = f65_local1[f65_local3].req, + xp_bonus = f65_local1[f65_local3].xp_bonus, + text_r = f65_local6, + text_g = f65_local7, + text_b = f65_local8 + } + } + end + return f65_local2 +end + +function operations_completed_info() + local f66_local0 = 50 + local f66_local1 = 10 + local f66_local2 = 85 + local f66_local3 = 9 + local f66_local4 = OPERATIONS_LIST_WIDTH - 2 * f66_local1 - 15 + return { + type = "UIElement", + id = "operations_completed_id", + properties = { + progressText = "0/5", + progressPercent = 0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f66_local0 + } + }, + children = { + { + type = "generic_menu_background", + id = "bkg", + properties = { + top_offset = 0 + } + }, + { + type = "UIText", + id = "bonus_progress_text_id", + properties = { + text = MBh.Property( "progressText" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = f66_local1, + right = 0, + top = -8 - CoD.TextSettings.NormalFont.Height / 2, + bottom = -8 + CoD.TextSettings.NormalFont.Height / 2, + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + } + }, + { + type = "UIHorizontalList", + id = "ops_completed_list", + states = { + default = { + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = f66_local1 + f66_local4 / #OperationsTimeoutRewards - 12, + width = f66_local4, + top = -8 - CoD.TextSettings.NormalFont.Height / 2, + bottom = -8 + CoD.TextSettings.NormalFont.Height / 2, + spacing = f66_local4 / #OperationsTimeoutRewards - 30 + } + }, + childrenFeeder = OpsCompletedFeeder + }, + { + type = "operation_progress_bar", + id = "bonus_progress_bar_id", + properties = { + progress = MBh.Property( "progressPercent" ), + width = f66_local4 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = f66_local1, + right = f66_local1 + f66_local4, + top = 10 - f66_local3 / 2, + bottom = 10 + f66_local3 / 2 + } + } + } + }, + handlers = { + refresh_ops_completed = RefreshOpsCompleted, + menu_create = RefreshOpsCompleted + } + } +end + +function operations_completed_info_tab() + local f67_local0 = 0 + local f67_local1 = 4 + local f67_local2 = 16 + local f67_local3 = 16 + return { + type = "UIHorizontalList", + id = "list_id", + properties = { + xp_bonus = MBh.Property( "xp_bonus" ), + text_r = MBh.Property( "text_r" ), + text_g = MBh.Property( "text_g" ), + text_b = MBh.Property( "text_b" ) + }, + states = { + default = { + alignment = LUI.Alignment.Right, + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + right = f67_local2, + width = 30, + top = f67_local0 - CoD.TextSettings.NormalFont.Height, + bottom = f67_local0, + spacing = 0 + } + }, + children = { + { + type = "UIText", + id = "xp_bonus_text", + properties = { + text = MBh.Property( "xp_bonus" ), + text_r = MBh.Property( "text_r" ), + text_g = MBh.Property( "text_g" ), + text_b = MBh.Property( "text_b" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 10, + top = 0, + bottom = 0, + red = MBh.Property( "text_r" ), + green = MBh.Property( "text_g" ), + blue = MBh.Property( "text_b" ), + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "token", + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + material = RegisterMaterial( "icon_unlock_token_active" ), + left = 0, + top = (CoD.TextSettings.NormalFont.Height - f67_local3) / 2, + width = f67_local2, + height = f67_local3 + } + } + } + } + } +end + +function HairlineBorder( f68_arg0, f68_arg1, f68_arg2, f68_arg3, f68_arg4 ) + local f68_local0 = nil + f68_local0 = f68_arg0 ~= "right" + local f68_local1 = nil + f68_local1 = f68_arg0 ~= "left" + local f68_local2 = nil + f68_local2 = f68_arg0 ~= "bottom" + local f68_local3 = nil + f68_local3 = f68_arg0 ~= "top" + local f68_local4 + if f68_arg0 == "right" then + f68_local4 = -1 + if not f68_local4 then + + else + local f68_local5 + if f68_arg0 == "left" then + f68_local5 = 1 + if not f68_local5 then + + else + local f68_local6 + if f68_arg0 == "bottom" then + f68_local6 = -1 + if not f68_local6 then + + else + local f68_local7 + if f68_arg0 == "top" then + f68_local7 = 1 + if not f68_local7 then + + else + return { + type = "UIImage", + id = f68_arg0 .. "_hairline", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = f68_local0, + rightAnchor = f68_local1, + topAnchor = f68_local2, + bottomAnchor = f68_local3, + left = f68_local4, + right = f68_local5, + top = f68_local6, + bottom = f68_local7, + red = f68_arg1, + green = f68_arg2, + blue = f68_arg3, + alpha = f68_arg4 + } + } + } + end + end + f68_local7 = 0 + end + end + f68_local6 = 0 + end + end + f68_local5 = 0 + end + end + f68_local4 = 0 +end + +function HairlineBorderType( f69_arg0, f69_arg1, f69_arg2, f69_arg3, f69_arg4 ) + local f69_local0 = nil + f69_local0 = f69_arg0 ~= "right" + local f69_local1 = nil + f69_local1 = f69_arg0 ~= "left" + local f69_local2 = nil + f69_local2 = f69_arg0 ~= "bottom" + local f69_local3 = nil + f69_local3 = f69_arg0 ~= "top" + local f69_local4 + if f69_arg0 == "right" then + f69_local4 = -1 + if not f69_local4 then + + else + local f69_local5 + if f69_arg0 == "left" then + f69_local5 = 1 + if not f69_local5 then + + else + local f69_local6 + if f69_arg0 == "bottom" then + f69_local6 = -1 + if not f69_local6 then + + else + local f69_local7 + if f69_arg0 == "top" then + f69_local7 = 1 + if not f69_local7 then + + else + local self = LUI.UIImage.new() + self.id = f69_arg0 .. "_hairline" + self:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + leftAnchor = f69_local0, + rightAnchor = f69_local1, + topAnchor = f69_local2, + bottomAnchor = f69_local3, + left = f69_local4, + right = f69_local5, + top = f69_local6, + bottom = f69_local7, + red = f69_arg1, + green = f69_arg2, + blue = f69_arg3, + alpha = f69_arg4 + } ) + self:animateToState( "default" ) + return self + end + end + f69_local7 = 0 + end + end + f69_local6 = 0 + end + end + f69_local5 = 0 + end + end + f69_local4 = 0 +end + +function WidgetBackground( f70_arg0, f70_arg1, f70_arg2, f70_arg3 ) + return { + type = "UIImage", + id = "bkg", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = f70_arg0 or 0, + green = f70_arg1 or 0, + blue = f70_arg2 or 0, + alpha = f70_arg3 or 0.1 + } + } + } +end + +function AddCostToPopup( f71_arg0, f71_arg1 ) + local f71_local0 = f71_arg0:getChildById( "generic_selectionList_window_id" ) + if not f71_local0 then + return + end + local f71_local1 = f71_local0:getChildById( "generic_selectionList_content_id" ) + if not f71_local1 then + return + end + local f71_local2 = f71_local1:getChildById( "spacer" ) + if f71_local2 then + f71_local2:registerAnimationState( "spaced", { + bottom = CoD.TextSettings.NormalFont.Height + 10 + } ) + f71_local2:animateToState( "spaced", 0 ) + addCostTextToElement( f71_local2 ) + end +end + +function addCostTextToElement( f72_arg0 ) + local self = LUI.UIHorizontalList.new() + local f72_local1 = "cost_text_hlist_id" + self:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -CoD.TextSettings.NormalFont.Height / 2, + bottom = CoD.TextSettings.NormalFont.Height / 2, + left = 0, + right = 0, + alignment = LUI.Alignment.Center + } ) + self.id = f72_local1 + self:animateToState( "default" ) + f72_arg0:addElement( self ) + f72_local1 = Engine.Localize( "@LUA_MENU_OPS_COST", CostOfNewOperations ) + local f72_local2, f72_local3, f72_local4, f72_local5 = GetTextDimensions( f72_local1, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f72_local6 = f72_local4 - f72_local2 + local f72_local7 = LUI.UIText.new() + f72_local7.id = "costTextId" + f72_local7:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f72_local6, + top = 0, + bottom = 0, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f72_local7:animateToState( "default" ) + f72_local7:setText( f72_local1 ) + self:addElement( f72_local7 ) + local f72_local8 = LUI.UIImage.new() + f72_local8.id = "spImageId" + f72_local8:registerAnimationState( "default", { + material = RegisterMaterial( "icon_unlock_token_active" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = CoD.TextSettings.NormalFont.Height, + top = 0, + bottom = 0 + } ) + f72_local8:animateToState( "default" ) + self:addElement( f72_local8 ) +end + +function popup_confirm_you_cant_afford_new_ops() + return { + type = "generic_confirmation_popup", + id = "popup_confirm_new_ops", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_NOT_ENOUGH_SP_FOR_NEW_OPS" ) + }, + handlers = { + menu_create = AddCostToPopup + } + } +end + +function popup_confirm_new_ops() + return { + type = "generic_confirmation_popup", + id = "popup_confirm_new_ops", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_NEW_OPS_AVAILABLE" ), + confirmation_action = NewOpsHandleConfirmation, + dialog_top = -100, + dialog_bottom = 100 + }, + handlers = { + popup_back = function ( f75_arg0, f75_arg1 ) + NewOpsHandleConfirmation( f75_arg0, f75_arg1 ) + end + , + menu_create = function ( f76_arg0, f76_arg1 ) + f76_arg0:dispatchEventToChildren( { + name = "update_message", + message_text = Engine.Localize( "@LUA_MENU_NEW_OPS_AVAILABLE" ) + } ) + end + + } + } +end + +function popup_confirm_new_ops_purchase() + return { + type = "generic_yesno_popup", + id = "popup_confirm_new_ops", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_CONFIRM_OPS_PURCHASE" ), + yes_action = HandlePurchaseOpsConfirmation, + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_NO" ) + }, + handlers = { + menu_create = AddCostToPopup + } + } +end + +function TrackOperationOpListPopupChildrenFeeder( f78_arg0 ) + local f78_local0 = f78_arg0.exclusiveController + local f78_local1 = {} + for f78_local2 = 1, MaxTrackedOperations, 1 do + f78_local1[#f78_local1 + 1] = GetTrackedOpsButton( f78_local0, f78_local2, GetTrackedOp( f78_local0, f78_local2 - 1 ), true ) + end + return f78_local1 +end + +function TrackOperationPopupChildrenFeeder( f79_arg0 ) + local f79_local0 = f79_arg0.exclusiveController + local f79_local1 = { + [#f79_local1 + 1] = { + type = "UIVerticalList", + id = "ops_list", + focusable = true, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = 400 + } + }, + childrenFeeder = TrackOperationOpListPopupChildrenFeeder + }, + [#f79_local1 + 1] = { + type = "UIElement", + id = "tracked_op_desc_spacer", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = 15 + } + } + }, + [#f79_local1 + 1] = { + type = "UIElement", + id = "tracked_op_desc_container", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = CoD.TextSettings.NormalFont.Height * 3 + } + }, + children = { + { + type = "UIText", + id = "tracked_op_category_text", + properties = { + text = "" + }, + states = { + default = CoD.ColorizeState( Colors.secondary_text_color, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -250, + right = 250, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height + } ) + }, + handlers = { + refresh_tracked_op_desc = function ( f80_arg0, f80_arg1 ) + if f80_arg1.categoryText and f80_arg1.categoryText ~= "" then + f80_arg0:setText( f80_arg1.categoryText ) + end + end + } + }, + { + type = "UIText", + id = "tracked_op_desc_text", + properties = { + text = "" + }, + states = { + default = CoD.ColorizeState( Colors.generic_button_text_default_color, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -250, + right = 250, + top = CoD.TextSettings.NormalFont.Height, + bottom = CoD.TextSettings.NormalFont.Height * 2 + } ) + }, + handlers = { + refresh_tracked_op_desc = function ( f81_arg0, f81_arg1 ) + f81_arg0:setText( f81_arg1.text ) + end + } + } + } + } + } + return f79_local1 +end + +function popup_track_op() + return { + type = "generic_selectionList_popup", + id = "popup_track_op", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_MP_SELECT_TRACK_SLOT" ), + popup_width = 550, + popup_childfeeder = TrackOperationPopupChildrenFeeder + } + } +end + +function popup_track_op_button() + local f83_local0 = 40 + local f83_local1 = 15 + local f83_local2 = 35 + local f83_local3 = 145 + return { + type = "UIButton", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -250, + right = 250, + top = 0, + bottom = f83_local0 + } + }, + handlers = { + button_over = function ( f84_arg0, f84_arg1 ) + f84_arg0:dispatchEventToRoot( { + name = "refresh_tracked_op_desc", + text = f84_arg0.properties.desc, + categoryText = f84_arg0.properties.category + } ) + f84_arg0:dispatchEventToChildren( f84_arg0, f84_arg1 ) + end + , + button_action = function ( f85_arg0, f85_arg1 ) + if f85_arg0.properties.trackOpsPopup then + local f85_local0 = f85_arg0.properties.controller + local f85_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f85_arg0 ) + local f85_local2 = f85_local1.newOp + SetTrackedOp( f85_local0, f85_arg0.properties.index, f85_local2 ) + Engine.ExecNow( "uploadstats", f85_local0 ) + f85_arg0:dispatchEventToRoot( { + name = "refresh_available_ops", + controller = f85_arg1.controller, + immediate = true + } ) + local f85_local3 = GetCachedOperationData( f85_local0, f85_local2 ) + f85_arg0:dispatchEventToRoot( { + name = "refresh_tracked_ops", + number = f85_arg0.properties.number, + controller = f85_local0, + opRef = f85_local2, + groupRef = getGroupRefForOperation( f85_local2 ), + opData = f85_local3, + text = f85_local3.Name, + progressText = f85_local3.ProgressText, + progressPercent = f85_local3.PercentProgress + } ) + LUI.FlowManager.RequestLeaveMenu( f85_arg0 ) + end + end + + }, + children = { + { + type = "UIElement", + properties = { + text = MBh.Property( "text" ), + progressValue = MBh.Property( "progressValue" ), + progressText = MBh.Property( "progressText" ), + index = MBh.Property( "index" ), + progressBarWidth = MBh.Property( "progressBarWidth" ), + number = MBh.Property( "number" ), + trackOpsPopup = MBh.Property( "trackOpsPopup" ), + groupRef = MBh.Property( "groupRef" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UIImage", + id = "popup_track_op_btn_bg", + states = { + default = CoD.ColorizeState( Colors.white, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0.05 + } ), + focus = CoD.ColorizeState( Colors.white, { + alpha = 0.8 + } ), + dimmed = CoD.ColorizeState( Colors.white, { + alpha = 0.5 + } ), + category_hilite = CoD.ColorizeState( Colors.white, { + alpha = 0.2 + } ), + category_hilite_dim = CoD.ColorizeState( Colors.white, { + alpha = 0.12 + } ) + }, + handlers = { + button_over = MBh.AnimateLoop( { + { + "focus", + 0, + true, + true + }, + { + "focus", + 350, + true, + true + }, + { + "dimmed", + 750, + true, + true + }, + { + "focus", + 750, + true, + true + } + } ), + button_up = MBh.AnimateToState( "default" ), + refresh_tracked_ops = function ( f86_arg0, f86_arg1 ) + if f86_arg0.properties.number == f86_arg1.number then + f86_arg0.properties.groupRef = f86_arg1.groupRef + end + end + , + notify_category_focused = function ( f87_arg0, f87_arg1 ) + if not f87_arg0.properties.trackOpsPopup then + if f87_arg0.properties.groupRef == f87_arg1.groupRef then + local f87_local0 = MBh.AnimateLoop( { + { + "category_hilite", + 0, + true, + true + }, + { + "category_hilite", + 350, + true, + true + }, + { + "category_hilite_dim", + 750, + true, + true + }, + { + "category_hilite", + 750, + true, + true + } + } ) + f87_local0( f87_arg0, f87_arg1 ) + else + f87_arg0:animateToState( "default", 0 ) + end + end + end + + } + }, + { + type = "UIMarqueeText", + id = "popup_track_op_btn_name_text", + properties = { + text = MBh.Property( "text" ), + index = MBh.Property( "index" ), + groupRef = MBh.Property( "groupRef" ), + number = MBh.Property( "number" ), + usingFocusColor = false + }, + states = { + default = CoD.ColorizeState( Colors.generic_button_text_default_color, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f83_local2, + right = -f83_local3, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height + } ) + }, + handlers = { + use_focused_color = function ( f88_arg0 ) + if not f88_arg0.properties.usingFocusColor then + f88_arg0:SetColor( Colors.generic_button_text_focus_color.r, Colors.generic_button_text_focus_color.g, Colors.generic_button_text_focus_color.b, 1 ) + f88_arg0.properties.usingFocusColor = true + end + end + , + use_default_color = function ( f89_arg0 ) + if f89_arg0.properties.usingFocusColor then + f89_arg0:SetColor( Colors.generic_button_text_default_color.r, Colors.generic_button_text_default_color.g, Colors.generic_button_text_default_color.b, 1 ) + f89_arg0.properties.usingFocusColor = false + end + end + , + button_over = function ( f90_arg0, f90_arg1 ) + f90_arg0:processEvent( { + name = "use_focused_color" + } ) + end + , + button_up = function ( f91_arg0, f91_arg1 ) + f91_arg0:processEvent( { + name = "use_default_color" + } ) + end + , + refresh_tracked_ops = function ( f92_arg0, f92_arg1 ) + if f92_arg0.properties.number == f92_arg1.number then + f92_arg0.properties.groupRef = f92_arg1.groupRef + if f92_arg1.text then + f92_arg0:setText( f92_arg1.text ) + f92_arg0:animateToState( "default" ) + end + end + end + + } + }, + { + type = "UIText", + id = "popup_track_op_btn_progress_text", + properties = { + text = MBh.Property( "progressText" ), + index = MBh.Property( "index" ), + groupRef = MBh.Property( "groupRef" ), + number = MBh.Property( "number" ) + }, + states = { + default = CoD.ColorizeState( Colors.generic_button_text_default_color, { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = -f83_local3, + right = -f83_local1, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height + } ), + focus = CoD.ColorizeState( Colors.generic_button_text_focus_color, {} ) + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ), + refresh_tracked_ops = function ( f93_arg0, f93_arg1 ) + if f93_arg0.properties.number == f93_arg1.number then + f93_arg0.properties.groupRef = f93_arg1.groupRef + if f93_arg1.progressText then + f93_arg0:setText( f93_arg1.progressText ) + end + end + end + + } + }, + { + type = "operation_progress_bar", + id = "popup_track_op_btn_progress_bar", + properties = { + progress = MBh.Property( "progressValue" ), + width = MBh.Property( "progressBarWidth" ), + index = MBh.Property( "index" ), + groupRef = MBh.Property( "groupRef" ), + number = MBh.Property( "number" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = f83_local2, + right = -f83_local1, + top = -15, + height = 10, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + refresh_tracked_ops = function ( f94_arg0, f94_arg1 ) + if f94_arg0.properties.number == f94_arg1.number then + f94_arg0.properties.groupRef = f94_arg1.groupRef + if f94_arg1.progressPercent then + f94_arg0:updateProgressBar( f94_arg1.progressPercent ) + f94_arg0:animateToState( "default" ) + end + end + end + , + notify_category_focused = function ( f95_arg0, f95_arg1 ) + if not f95_arg0.properties.trackOpsPopup then + if f95_arg0.properties.groupRef == f95_arg1.groupRef then + f95_arg0:dispatchEventToChildren( { + name = "button_over" + } ) + else + f95_arg0:dispatchEventToChildren( { + name = "button_up" + } ) + end + end + end + + } + }, + { + type = "UIText", + id = "popup_track_op_btn_number", + properties = { + text = MBh.Property( "number" ), + groupRef = MBh.Property( "groupRef" ), + number = MBh.Property( "number" ) + }, + states = { + default = CoD.ColorizeState( Colors.generic_button_text_default_color, { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = f83_local2, + top = CoD.TextSettings.NormalFont.Height * -0.5, + bottom = CoD.TextSettings.NormalFont.Height * 0.5, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ), + focus = CoD.ColorizeState( Colors.generic_button_text_focus_color, {} ) + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ), + refresh_tracked_ops = function ( f96_arg0, f96_arg1 ) + if f96_arg0.properties.number == f96_arg1.number then + f96_arg0.properties.groupRef = f96_arg1.groupRef + end + end + + } + }, + { + type = "UIImage", + id = "popup_track_op_btn_spacer", + properties = { + groupRef = MBh.Property( "groupRef" ), + number = MBh.Property( "number" ) + }, + states = { + default = CoD.ColorizeState( Colors.white, { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = -1, + bottom = 0, + alpha = 0.15 + } ), + focus = CoD.ColorizeState( Colors.black, { + alpha = 1 + } ) + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ), + refresh_tracked_ops = function ( f97_arg0, f97_arg1 ) + if f97_arg0.properties.number == f97_arg1.number then + f97_arg0.properties.groupRef = f97_arg1.groupRef + end + end + , + notify_category_focused = function ( f98_arg0, f98_arg1 ) + if not f98_arg0.properties.trackOpsPopup then + if f98_arg0.properties.groupRef == f98_arg1.groupRef then + f98_arg0:animateToState( "focus", 0 ) + else + f98_arg0:animateToState( "default", 0 ) + end + end + end + + } + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "operations_main_menu", operations_main_menu ) +LUI.MenuBuilder.registerType( "operation_button", operation_button ) +LUI.MenuBuilder.registerDef( "operations_selection_popup", operations_selection_popup ) +LUI.MenuBuilder.registerType( "operation_progress_bar", operation_progress_bar ) +LUI.MenuBuilder.registerDef( "operations_info_panel", operations_info_panel ) +LUI.MenuBuilder.registerDef( "operations_info_panel_header", operations_info_panel_header ) +LUI.MenuBuilder.registerDef( "operations_info_panel_sub_header", operations_info_panel_sub_header ) +LUI.MenuBuilder.registerDef( "operations_info_panel_desc", operations_info_panel_desc ) +LUI.MenuBuilder.registerDef( "operations_info_panel_progress", operations_info_panel_progress ) +LUI.MenuBuilder.registerDef( "operations_info_panel_rewards", operations_info_panel_rewards ) +LUI.MenuBuilder.registerDef( "operations_completed_info", operations_completed_info ) +LUI.MenuBuilder.registerDef( "operations_completed_info_tab", operations_completed_info_tab ) +LUI.MenuBuilder.registerDef( "popup_confirm_new_ops", popup_confirm_new_ops ) +LUI.MenuBuilder.registerDef( "popup_confirm_new_ops_purchase", popup_confirm_new_ops_purchase ) +LUI.MenuBuilder.registerDef( "popup_confirm_you_cant_afford_new_ops", popup_confirm_you_cant_afford_new_ops ) +LUI.MenuBuilder.registerDef( "popup_track_op", popup_track_op ) +LUI.MenuBuilder.registerDef( "popup_track_op_button", popup_track_op_button ) +LockTable( _M ) diff --git a/lui/mp_menus/operationsutils.dec.lua b/lui/mp_menus/operationsutils.dec.lua new file mode 100644 index 0000000..23d8412 --- /dev/null +++ b/lui/mp_menus/operationsutils.dec.lua @@ -0,0 +1,1093 @@ +StandardChallengeColumns = { + Ref = 0, + Name = 1, + Desc = 2, + Label = 3, + Weight = 4, + Filter = 5, + UnlockLevel = 6, + ChallengeUnlock = 7, + PrestigeShotUnlock = 8, + Target1 = 9, + XP1 = 10, + Target2 = 11, + XP2 = 12, + Target3 = 13, + XP3 = 14, + Target4 = 15, + XP4 = 16, + Target5 = 17, + XP5 = 18, + Target6 = 19, + XP6 = 20, + Target7 = 21, + XP7 = 22, + Target8 = 23, + XP8 = 24, + Target9 = 25, + XP9 = 26, + SP1 = 27, + SP2 = 28, + SP3 = 29, + SP4 = 30, + SP5 = 31, + SP6 = 32, + SP7 = 33, + SP8 = 34, + SP9 = 35 +} +AllChallengesTable = { + File = "mp/allChallengesTable.csv", + Cols = StandardChallengeColumns +} +DailyChallengesTable = { + File = "mp/dailyChallengesTable.csv", + Cols = StandardChallengeColumns +} +WeekleyChallengesTable = { + File = "mp/weekleyChallengesTable.csv", + Cols = StandardChallengeColumns +} +OperationGroups = { + File = "mp/OperationsTable.csv", + Cols = { + Idx = 0, + Ref = 1, + Name = 2, + Desc = 3, + File = 4, + FormattedName = 5 + }, + MaxGroups = 6 +} +AnynonOpsTable = { + Cols = { + Idx = 0, + Ref = 1 + }, + MaxOps = 500, + MaxAvailOps = 10 +} +WeaponChallenge = { + ChallengesPerClass = 12, + ChallengeSuffixes = { + weapon_assault = { + "", + "_crouch", + "_assists", + "_defender", + "_noattach", + "_longshot", + "_consecutive", + "_pointblank", + "_reload", + "_sliding", + "_leaning", + "_allcamo" + }, + weapon_smg = { + "", + "_crouch", + "_assists", + "_defender", + "_noattach", + "_hipfire", + "_consecutive", + "_pointblank", + "_reload", + "_sliding", + "_leaning", + "_allcamo" + }, + weapon_lmg = { + "", + "_crouch", + "_assists", + "_defender", + "_noattach", + "_hipfire", + "_consecutive", + "_pointblank", + "_penetrate", + "_sliding", + "_leaning", + "_allcamo" + }, + weapon_dmr = { + "", + "_crouch", + "_assists", + "_defender", + "_longshot", + "_headshot", + "_consecutive", + "_noattach", + "_reload", + "_pointblank", + "_leaning", + "_allcamo" + }, + weapon_sniper = { + "", + "_crouch", + "_noattach", + "_defender", + "_prone", + "_oneshotkill", + "_consecutive", + "_pointblank", + "_reload", + "_penetrate", + "_leaning", + "_allcamo" + }, + weapon_shotgun = { + "", + "_crouch", + "_assist", + "_defender", + "_noattach", + "_hipfire", + "_consecutive", + "_pointblank", + "_reload", + "_sliding", + "_headshot", + "_allcamo" + }, + weapon_riot = { + "", + "_crouch", + "_assist", + "_damage", + "_throwingknife", + "_c4", + "_pistol", + "_explosive", + "_backsmasher", + "_consecutive", + "_noperks", + "_allcamo" + } + } +} +WeaponChallengeTable = { + File = "mp/challenges/challengeTable_WeaponOps.csv", + Cols = AnynonOpsTable.Cols +} +OperationsTimeoutRewards = { + { + req = 5, + reward = 5 + }, + { + req = 10, + reward = 10 + }, + { + req = 15, + reward = 15 + }, + { + req = 20, + reward = 20 + }, + { + req = 25, + reward = 25 + } +} +TierStrings = { + "@LUA_MENU_ROMAN_ONE", + "@LUA_MENU_ROMAN_TWO", + "@LUA_MENU_ROMAN_THREE", + "@LUA_MENU_ROMAN_FOUR", + "@LUA_MENU_ROMAN_FIVE", + "@LUA_MENU_ROMAN_SIX", + "@LUA_MENU_ROMAN_SEVEN", + "@LUA_MENU_ROMAN_EIGHT", + "@LUA_MENU_ROMAN_NINE" +} +CostOfNewOperations = 1 +OperationUtilsCache = { + SortTypes = { + "Alphabetical", + "Progress" + }, + SortTypeNames = { + "LUA_MENU_MP_OP_SORT_TYPE_ALPHA", + "LUA_MENU_MP_OP_SORT_TYPE_PROGRESS" + }, + CurrentSortType = nil, + Types = { + Groups = "groups", + OpData = "op_data", + OpRows = "op_rows", + WeaponOps = "weapon_ops" + }, + CurrentSortType = 1 +} +MaxTrackedOperations = 10 +local f0_local0 = 528 +function parseChallengeName( f1_arg0 ) + local f1_local0 = f1_arg0 + local f1_local1 = 1 + if f1_arg0 ~= "" then + local f1_local2 = string.len( f1_arg0 ) + local f1_local3 = string.sub( f1_arg0, 1, f1_local2 - 2 ) + local f1_local4 = string.sub( f1_arg0, f1_local2 - 1, f1_local2 - 1 ) + local f1_local5 = tonumber( string.sub( f1_arg0, f1_local2 ) ) + if f1_local4 == "_" and TierStrings[f1_local5] ~= nil then + f1_local1 = f1_local5 + f1_local0 = f1_local3 + else + DebugPrint( "ref " .. f1_arg0 .. "does not contain valid tier, defaulting to tier 1" ) + end + end + return f1_local0, f1_local1 +end + +function getUnlockInfoStrings( f2_arg0, f2_arg1, f2_arg2, f2_arg3 ) + local f2_local0, f2_local1 = parseChallengeName( f2_arg0 ) + local f2_local2 = operationGetNameWithTierPostFix( f2_local0, f2_local1 ) + local f2_local3 = getGroupRefForOperation( f2_local0 ) + local f2_local4 = Engine.Localize( GetFieldForOperationsGroup( f2_local3, OperationGroups.Cols.FormattedName ), f2_local2 ) + local f2_local5 = nil + local f2_local6 = f2_local3 and f2_local3 ~= "" + local f2_local7 = false + if f2_local6 then + f2_local7 = f2_local1 < getOperationState( f2_arg1, f2_local0 ) + end + if f2_local6 and not f2_local7 and f2_arg3 and not isOpActive( f2_arg1, f2_local0 ) then + f2_local5 = Engine.Localize( "@LUA_MENU_OP_INACTIVE" ) + else + local f2_local8 = operationGetTargetForTier( f2_local0, f2_local1, f2_arg2 ) + if f2_local0 == "ch_longersprint_pro" then + f2_local8 = math.floor( f2_local8 / f0_local0 ) + end + f2_local5 = operationGetDesc( f2_local0, f2_local8 ) + end + return f2_local4, f2_local5 +end + +function getGroupRefForOperation( f3_arg0 ) + local f3_local0 = "" + for f3_local1 = 1, OperationGroups.MaxGroups, 1 do + local f3_local4 = Engine.TableLookup( OperationGroups.File, OperationGroups.Cols.Idx, tostring( f3_local1 - 1 ), OperationGroups.Cols.Ref ) + if isOperationInGroup( f3_arg0, f3_local4 ) then + f3_local0 = f3_local4 + break + end + end + return f3_local0 +end + +function isOperationInGroup( f4_arg0, f4_arg1 ) + local f4_local0 = AnynonOpsTable.MaxOps + local f4_local1 = GetFieldForOperationsGroup( f4_arg1, OperationGroups.Cols.File ) + for f4_local2 = 1, f4_local0, 1 do + if Engine.TableLookup( f4_local1, AnynonOpsTable.Cols.Idx, tostring( f4_local2 - 1 ), AnynonOpsTable.Cols.Ref ) == f4_arg0 then + return true + end + end + return false +end + +function GetFieldForOperationsGroup( f5_arg0, f5_arg1 ) + local f5_local0 = assert + local f5_local1 + if f5_arg1 < OperationGroups.Cols.Idx or f5_arg1 > OperationGroups.Cols.FormattedName then + f5_local1 = false + else + f5_local1 = true + end + f5_local0( f5_local1, "Invalid column in GetFieldForOperationsGroup( groupRef, column )" ) + return Engine.TableLookup( OperationGroups.File, OperationGroups.Cols.Ref, f5_arg0, f5_arg1 ) +end + +function GetFieldForChallenge( f6_arg0, f6_arg1 ) + local f6_local0 = assert + local f6_local1 + if f6_arg1 < AllChallengesTable.Cols.Ref or f6_arg1 > AllChallengesTable.Cols.SP9 then + f6_local1 = false + else + f6_local1 = true + end + f6_local0( f6_local1, "Invalid column in GetFieldForChallenge( challenge_ref, column )" ) + if not CanAcessOperationCache() then + return Engine.TableLookup( AllChallengesTable.File, AllChallengesTable.Cols.Ref, f6_arg0, f6_arg1 ) + else + return Engine.TableLookupByRow( AllChallengesTable.File, GetCachedChallengeTableRowForOp( f6_arg0 ), f6_arg1 ) + end +end + +function GetFieldForDailyChallenge( f7_arg0, f7_arg1 ) + local f7_local0 = assert + local f7_local1 + if f7_arg1 < DailyChallengesTable.Cols.Ref or f7_arg1 > DailyChallengesTable.Cols.XP9 then + f7_local1 = false + else + f7_local1 = true + end + f7_local0( f7_local1, "Invalid column in GetFieldForDailyChallenge( challenge_ref, column )" ) + return Engine.TableLookup( DailyChallengesTable.File, DailyChallengesTable.Cols.Ref, f7_arg0, f7_arg1 ) +end + +function GetFieldForWeekleyChallenge( f8_arg0, f8_arg1 ) + local f8_local0 = assert + local f8_local1 + if f8_arg1 < WeekleyChallengesTable.Cols.Ref or f8_arg1 > WeekleyChallengesTable.Cols.XP9 then + f8_local1 = false + else + f8_local1 = true + end + f8_local0( f8_local1, "Invalid column in GetFieldForWeekleyChallenge( challenge_ref, column )" ) + return Engine.TableLookup( WeekleyChallengesTable.File, WeekleyChallengesTable.Cols.Ref, f8_arg0, f8_arg1 ) +end + +function GetGroupIndex( f9_arg0 ) + return tonumber( GetFieldForOperationsGroup( f9_arg0, OperationGroups.Cols.Idx ) ) +end + +function GetTrackedOp( f10_arg0, f10_arg1 ) + return Engine.GetPlayerDataEx( f10_arg0, CoD.StatsGroup.Ranked, "currentChallenges", 0, f10_arg1 ) +end + +function GetOperationForWeapon( f11_arg0, f11_arg1, f11_arg2, f11_arg3 ) + local f11_local0 = assert + local f11_local1 + if f11_arg3 < 0 or f11_arg3 >= WeaponChallenge.ChallengesPerClass then + f11_local1 = false + else + f11_local1 = true + end + f11_local0( f11_local1 ) + return "ch_" .. f11_arg2 .. WeaponChallenge.ChallengeSuffixes[f11_arg1][f11_arg3 + 1] +end + +function GetOperationForWeaponFromCache( f12_arg0, f12_arg1, f12_arg2, f12_arg3 ) + local f12_local0 = GetOperationCache( OperationUtilsCache.Types.WeaponOps ) + if not f12_local0[f12_arg2] then + CacheWeaponOps( f12_arg0, f12_arg1, f12_arg2 ) + end + assert( f12_local0[f12_arg2] ~= nil ) + local f12_local1 = f12_local0[f12_arg2].sortedRefLists + local f12_local2 = OperationUtilsCache.SortTypes + return f12_local1[OperationUtilsCache.SortTypes[OperationUtilsCache.CurrentSortType]][f12_arg3] +end + +function GetOpForGroup( f13_arg0, f13_arg1, f13_arg2 ) + return GetOpForGroupIndex( f13_arg0, GetGroupIndex( f13_arg1 ), f13_arg2 ) +end + +function GetOpForGroupIndex( f14_arg0, f14_arg1, f14_arg2 ) + local f14_local0 = Engine.TableLookup( OperationGroups.File, OperationGroups.Cols.Idx, f14_arg1, OperationGroups.Cols.File ) + if f14_local0 == "" then + return "" + else + return Engine.TableLookupByRow( f14_local0, f14_arg2, AnynonOpsTable.Cols.Ref ) + end +end + +function GetCachedOpForGroup( f15_arg0, f15_arg1, f15_arg2 ) + return GetOperationFromCache( f15_arg0, GetGroupIndex( f15_arg1 ), f15_arg2 ) +end + +function SetTrackedOp( f16_arg0, f16_arg1, f16_arg2 ) + Engine.SetPlayerDataEx( f16_arg0, CoD.StatsGroup.Ranked, "currentChallenges", 0, f16_arg1, f16_arg2 ) +end + +function GetAllOpGroupRefs() + local f17_local0 = {} + for f17_local1 = 1, OperationGroups.MaxGroups, 1 do + local f17_local4 = Engine.TableLookup( OperationGroups.File, OperationGroups.Cols.Idx, tostring( f17_local1 - 1 ), OperationGroups.Cols.Ref ) + if f17_local4 == "" then + break + end + f17_local0[f17_local1] = f17_local4 + end + return f17_local0 +end + +function GetOpsInGroup( f18_arg0, f18_arg1 ) + local f18_local0 = Engine.TableLookup( OperationGroups.File, OperationGroups.Cols.Idx, GetGroupIndex( f18_arg1 ), OperationGroups.Cols.File ) + if f18_local0 == "" then + return {} + end + local f18_local1 = {} + for f18_local2 = 1, AnynonOpsTable.MaxOps, 1 do + local f18_local5 = Engine.TableLookupByRow( f18_local0, f18_local2, AnynonOpsTable.Cols.Ref ) + if f18_local5 ~= "" then + f18_local1[f18_local2] = f18_local5 + end + end + return f18_local1 +end + +function GetCachedOpsInGroup( f19_arg0, f19_arg1 ) + return GetGroupOperationsFromCache( f19_arg0, GetGroupIndex( f19_arg1 ) ) +end + +function GetWeaponOpsForClass( f20_arg0 ) + return WeaponChallenge.ChallengeSuffixes[f20_arg0] +end + +function isOpActive( f21_arg0, f21_arg1 ) + return true +end + +function IsOpTracked( f22_arg0, f22_arg1 ) + for f22_local0 = 0, MaxTrackedOperations - 1, 1 do + if f22_arg1 == GetTrackedOp( f22_arg0, f22_local0 ) then + return true + end + end + return false +end + +function ClearProgressForOp( f23_arg0, f23_arg1 ) + Engine.SetPlayerDataEx( f23_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f23_arg1, 0 ) +end + +function GetNumOpsInGroupFile( f24_arg0 ) + local f24_local0 = 0 + for f24_local1 = 0, 500, 1 do + if Engine.TableLookup( f24_arg0, AnynonOpsTable.Cols.Idx, tostring( f24_local1 ), AnynonOpsTable.Cols.Ref ) == "" then + break + end + f24_local0 = f24_local0 + 1 + end + return f24_local0 +end + +function InitOperationsData( f25_arg0 ) + for f25_local5, f25_local6 in ipairs( GetAllOpGroupRefs() ) do + for f25_local4 = 0, AnynonOpsTable.MaxOps, 1 do + local f25_local3 = GetOpForGroup( f25_arg0, f25_local6, f25_local4 ) + if f25_local3 and f25_local3 ~= "" then + Engine.SetPlayerDataEx( f25_arg0, CoD.StatsGroup.Ranked, "challengeState", f25_local3, 1 ) + end + end + end + for f25_local0 = 0, MaxTrackedOperations - 1, 1 do + f25_local6 = nil + if f25_local0 < 5 then + f25_local6 = GetOpForGroupIndex( f25_arg0, f25_local0, 0 ) + else + local f25_local4 = Cac.WeaponTypes.Primary[f25_local0 - 4] + assert( #Cac.Weapons[f25_local4] >= 2 ) + f25_local6 = "ch_" .. Cac.Weapons[f25_local4][2] + end + assert( f25_local6 ) + Engine.SetPlayerDataEx( f25_arg0, CoD.StatsGroup.Ranked, "currentChallenges", 0, f25_local0, f25_local6 ) + end +end + +function AwardSquadPoints( f26_arg0, f26_arg1 ) + if 0 < f26_arg1 then + Engine.SetPlayerDataEx( f26_arg0, CoD.StatsGroup.Ranked, "unlockPoints", Engine.GetPlayerDataEx( f26_arg0, CoD.StatsGroup.Ranked, "unlockPoints" ) + f26_arg1 ) + Engine.SetPlayerDataEx( f26_arg0, CoD.StatsGroup.Ranked, "squadMembers", 0, "commendationsEarned", Engine.GetPlayerDataEx( f26_arg0, CoD.StatsGroup.Ranked, "squadMembers", 0, "commendationsEarned" ) + f26_arg1 ) + end +end + +function GetOperationData( f27_arg0, f27_arg1 ) + local f27_local0 = isWeaponOperation( f27_arg1 ) + local f27_local1 = 3000 + local f27_local2 = { + Ref = f27_arg1, + Name = "", + Desc = "", + Label = "", + Progress = 0, + MaxProgress = 0, + PercentProgress = 0, + RewardXP = 0, + RewardCurrency = 0, + RewardImage = nil, + RewardType = nil, + ExtraRewardImages = nil, + ExtraRewardTypes = nil, + ProgressText = "", + OpState = 0, + NumTiers = 0, + ActiveTier = 0, + Completed = false, + Name = operationGetName( f27_arg1 ) + } + if f27_local2.Name == nil then + DebugPrint( "its nil" ) + end + if f27_local2.Name ~= "" then + f27_local2.NumTiers = operationGetNumTiers( f27_arg1 ) + f27_local2.OpState = getOperationState( f27_arg0, f27_arg1 ) + f27_local2.ActiveTier = getTierForActiveOperation( f27_arg0, f27_arg1 ) + f27_local2.Completed = f27_local2.ActiveTier < f27_local2.OpState + local f27_local3 + if f27_local0 then + f27_local3 = weaponOperationGetNameWithTierPostFix( f27_arg1, f27_local2.ActiveTier ) + if not f27_local3 then + + else + f27_local2.Name = f27_local3 + f27_local3 = operationGetTargetForTier( f27_arg1, f27_local2.ActiveTier ) + local f27_local4 = operationGetXPRewardForTier( f27_arg1, f27_local2.ActiveTier ) + f27_local2.RewardXP = f27_local4 + f27_local2.Progress = operationGetProgress( f27_arg0, f27_arg1 ) + f27_local2.MaxProgress = tonumber( f27_local3 ) + f27_local2.PercentProgress = f27_local2.Progress / f27_local2.MaxProgress + if f27_arg1 == "ch_longersprint_pro" then + local f27_local5 = math.floor( f27_local2.Progress / f0_local0 ) + local f27_local6 = math.floor( f27_local2.MaxProgress / f0_local0 ) + f27_local2.Desc = operationGetDesc( f27_arg1, f27_local6 ) + f27_local2.Progress = f27_local5 + f27_local2.MaxProgress = f27_local6 + elseif f27_local0 and string.find( f27_arg1, "_allcamo" ) then + f27_local2.Progress, f27_local2.MaxProgress = Cac.CountCamosForGold( f27_arg0, getWeaponOperationWeaponName( f27_arg1 ) ) + f27_local2.Completed = f27_local7 <= f27_local6 + f27_local2.PercentProgress = f27_local2.Progress / f27_local2.MaxProgress + f27_local2.Desc = operationGetDesc( f27_arg1, f27_local3 ) + else + f27_local2.Desc = operationGetDesc( f27_arg1, f27_local3 ) + end + if f27_local0 then + f27_local2.Label = operationGetLabel( f27_arg1 ) + end + f27_local2.ProgressText = tostring( f27_local2.Progress ) .. "/" .. tostring( f27_local2.MaxProgress ) + f27_local2.RewardCurrency = operationGetSPRewardForTier( f27_arg1, f27_local2.ActiveTier ) + local f27_local5 = math.floor( f27_local4 / f27_local1 ) + if f27_local2.RewardCurrency ~= "" then + f27_local2.RewardCurrency = f27_local5 + tonumber( f27_local2.RewardCurrency ) + else + f27_local2.RewardCurrency = f27_local5 + end + local f27_local6 = getUnlocksByChallenge( f27_arg1, f27_local2.ActiveTier ) + if #f27_local6 > 0 then + if isUnlockItem( f27_local6[1].type ) then + f27_local2.RewardImage = RegisterMaterial( getMaterialForUnlockItem( f27_local6[1].type, f27_local6[1].item ) ) + f27_local2.RewardType = f27_local6[1].type + table.remove( f27_local6, 1 ) + end + for f27_local7 = 1, #f27_local6, 1 do + if isUnlockItem( f27_local6[f27_local7].type ) then + if not f27_local2.ExtraRewardImages then + f27_local2.ExtraRewardImages = {} + f27_local2.ExtraRewardTypes = {} + end + table.insert( f27_local2.ExtraRewardImages, RegisterMaterial( getMaterialForUnlockItem( f27_local6[f27_local7].type, f27_local6[f27_local7].item ) ) ) + table.insert( f27_local2.ExtraRewardTypes, f27_local6[f27_local7].type ) + end + end + end + end + end + f27_local3 = operationGetNameWithTierPostFix( f27_arg1, f27_local2.ActiveTier ) + end + return f27_local2 +end + +function GetCachedOperationData( f28_arg0, f28_arg1 ) + local f28_local0 = GetOperationCache( OperationUtilsCache.Types.OpData ) + if not f28_local0[f28_arg1] then + f28_local0[f28_arg1] = GetOperationData( f28_arg0, f28_arg1 ) + end + return f28_local0[f28_arg1] +end + +function getUnlocksByChallenge( f29_arg0, f29_arg1 ) + if isWeaponOperation( f29_arg0 ) then + return getUnlocksByWeaponChallenge( f29_arg0, f29_arg1 ) + end + local f29_local0 = f29_arg0 .. "_" .. f29_arg1 + local f29_local1 = {} + local f29_local2 = "" + local f29_local3 = "" + local f29_local4 = "" + local f29_local5 = 0 + while true do + f29_local3 = Engine.TableLookupByRow( UnlockTable.File, f29_local5, UnlockTable.Cols.ItemId ) + f29_local2 = Engine.TableLookupByRow( UnlockTable.File, f29_local5, UnlockTable.Cols.Challenge ) + if f29_local3 == "" then + return f29_local1 + elseif f29_local2 == f29_local0 then + f29_local4 = Engine.TableLookupByRow( UnlockTable.File, f29_local5, UnlockTable.Cols.Type ) + if f29_local4 == "Patch" then + table.insert( f29_local1, 1, { + row = f29_local5, + item = f29_local3, + type = f29_local4 + } ) + else + table.insert( f29_local1, { + row = f29_local5, + item = f29_local3, + type = f29_local4 + } ) + end + end + f29_local5 = f29_local5 + 1 + end +end + +function getUnlocksByWeaponChallenge( f30_arg0, f30_arg1 ) + local f30_local0 = tostring( f30_arg1 ) + local f30_local1 = getWeaponOperationSuffix( f30_arg0 ) + local f30_local2 = getWeaponOperationWeaponClass( f30_arg0 ) + if not f30_local2 or f30_local2 == "" or not f30_local1 then + return {} + end + local f30_local3 = string.len( f30_local2 ) + local f30_local4 = {} + for f30_local5 = 0, CamoReticleUnlockTable.MaxRows, 1 do + if Engine.TableLookupByRow( CamoReticleUnlockTable.File, f30_local5, CamoReticleUnlockTable.Cols.ChallengeRef ) == f30_local1 then + local f30_local8 = Engine.TableLookupByRow( CamoReticleUnlockTable.File, f30_local5, CamoReticleUnlockTable.Cols.CamoReticleRef ) + if string.sub( f30_local8, 0, f30_local3 ) == f30_local2 then + if Engine.TableLookupByRow( CamoReticleUnlockTable.File, f30_local5, CamoReticleUnlockTable.Cols.Tier ) == f30_local0 then + table.insert( f30_local4, 1, { + item = string.sub( f30_local8, f30_local3 + 2 ), + type = "Camo" + } ) + break + end + end + end + end + return f30_local4 +end + +function operationIsComplete( f31_arg0 ) + return f31_arg0.MaxProgress <= f31_arg0.Progress +end + +function operationGetNumTiers( f32_arg0 ) + local f32_local0 = 0 + local f32_local1 = 9 + for f32_local2 = 1, f32_local1, 1 do + if GetFieldForChallenge( f32_arg0, AllChallengesTable.Cols["Target" .. f32_local2] ) == "" then + break + end + f32_local0 = f32_local0 + 1 + end + return f32_local0 +end + +function operationGetNameWithTierPostFix( f33_arg0, f33_arg1 ) + local f33_local0 = operationGetName( f33_arg0 ) + if operationGetNumTiers( f33_arg0 ) > 1 then + f33_local0 = Engine.Localize( "@LUA_MENU_CHALLENGE_AND_TIER", f33_local0, Engine.Localize( TierStrings[f33_arg1] ) ) + end + return f33_local0 +end + +function weaponOperationGetNameWithTierPostFix( f34_arg0, f34_arg1 ) + return Engine.Localize( "LUA_MENU_MP_WEAPON_OP_PREFIX", operationGetLabel( f34_arg0 ) .. (getWeaponOperationSuffix( f34_arg0 ) and "" or " ") .. Engine.Localize( TierStrings[f34_arg1] ), operationGetName( f34_arg0 ) ) +end + +function operationGetName( f35_arg0 ) + local f35_local0 = GetFieldForChallenge( f35_arg0, AllChallengesTable.Cols.Name ) + if f35_local0 == "" then + DebugPrint( "Warning, challenge " .. f35_arg0 .. " not found in the challenges table" ) + return f35_local0 + else + return Engine.Localize( f35_local0 ) + end +end + +function operationGetDesc( f36_arg0, f36_arg1 ) + return Engine.Localize( GetFieldForChallenge( f36_arg0, AllChallengesTable.Cols.Desc ), f36_arg1, "" ) +end + +function operationGetLabel( f37_arg0 ) + return Engine.Localize( GetFieldForChallenge( f37_arg0, AllChallengesTable.Cols.Label ), "", "" ) +end + +function getTierForActiveOperation( f38_arg0, f38_arg1 ) + local f38_local0 = Engine.GetPlayerDataEx( f38_arg0, CoD.StatsGroup.Ranked, "challengeState", f38_arg1 ) + local f38_local1 = operationGetNumTiers( f38_arg1 ) + if not f38_local0 then + f38_local0 = 0 + end + if f38_local1 < f38_local0 then + local f38_local2 = f38_local1 + end + return f38_local2 or f38_local0 +end + +function getOperationState( f39_arg0, f39_arg1 ) + return Engine.GetPlayerDataEx( f39_arg0, CoD.StatsGroup.Ranked, "challengeState", f39_arg1 ) +end + +function operationGetTargetForTier( f40_arg0, f40_arg1, f40_arg2 ) + local f40_local0 = 0 + if f40_arg2 then + + else + f40_local0 = GetFieldForChallenge( f40_arg0, AllChallengesTable.Cols["Target" .. f40_arg1] ) + end + f40_local0 = f40_local0 + GetFieldForChallenge( f40_arg0, AllChallengesTable.Cols["Target" .. f40_arg1] ) + f40_arg1 = f40_arg1 - 1 + repeat + f40_local0 = f40_local0 + GetFieldForChallenge( f40_arg0, AllChallengesTable.Cols["Target" .. f40_arg1] ) + f40_arg1 = f40_arg1 - 1 + repeat + f40_local0 = f40_local0 + GetFieldForChallenge( f40_arg0, AllChallengesTable.Cols["Target" .. f40_arg1] ) + f40_arg1 = f40_arg1 - 1 + repeat + f40_local0 = f40_local0 + GetFieldForChallenge( f40_arg0, AllChallengesTable.Cols["Target" .. f40_arg1] ) + f40_arg1 = f40_arg1 - 1 + repeat + f40_local0 = f40_local0 + GetFieldForChallenge( f40_arg0, AllChallengesTable.Cols["Target" .. f40_arg1] ) + f40_arg1 = f40_arg1 - 1 + repeat + -- ERROR: Infinite loop detected + until f40_arg1 <= 0 + until f40_arg1 <= 0 + until f40_arg1 <= 0 + until f40_arg1 <= 0 + until f40_arg1 <= 0 +end + +function operationGetXPRewardForTier( f41_arg0, f41_arg1 ) + return GetFieldForChallenge( f41_arg0, AllChallengesTable.Cols["XP" .. f41_arg1] ) +end + +function operationGetSPRewardForTier( f42_arg0, f42_arg1 ) + return GetFieldForChallenge( f42_arg0, AllChallengesTable.Cols["SP" .. f42_arg1] ) +end + +function operationGetProgress( f43_arg0, f43_arg1 ) + return Engine.GetPlayerDataEx( f43_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f43_arg1 ) +end + +function OperationGetReqs( f44_arg0, f44_arg1 ) + local f44_local0 = "" + local f44_local1 = "" + local f44_local2 = "" + local f44_local3 = "" + local f44_local4 = "" + local f44_local5 = 1500 + for f44_local6 = 0, f44_local5, 1 do + f44_local3 = Engine.TableLookupByRow( UnlockTable.File, f44_local6, UnlockTable.Cols.ItemId ) + if f44_local3 == "" then + break + elseif f44_local3 == f44_arg0 and Engine.TableLookupByRow( UnlockTable.File, f44_local6, UnlockTable.Cols.Type ) == f44_arg1 then + f44_local1 = Engine.TableLookupByRow( UnlockTable.File, f44_local6, UnlockTable.Cols.Rank ) + f44_local0 = Engine.TableLookupByRow( UnlockTable.File, f44_local6, UnlockTable.Cols.Challenge ) + f44_local2 = Engine.TableLookupByRow( UnlockTable.File, f44_local6, UnlockTable.Cols.ExtRank ) + break + end + end + return f44_local0, f44_local1, f44_local2 +end + +function operationGetMatchCompleted( f45_arg0 ) + local f45_local0 = {} + for f45_local1 = 0, 4, 1 do + local f45_local4 = Engine.GetPlayerDataEx( f45_arg0, CoD.StatsGroup.Common, "round", "operationsCompleted", f45_local1 ) + if f45_local4 ~= "" then + table.insert( f45_local0, { + opRef = f45_local4, + tier = getTierForActiveOperation( f45_arg0, f45_local4 ) + } ) + end + end + return f45_local0 +end + +function isUnlockItem( f46_arg0 ) + if not (f46_arg0 == "ClanTag" or not Cac.Customization.FieldIndexes[f46_arg0]) or f46_arg0 == "Camo" then + return true + else + return false + end +end + +function getNameForUnlockItem( f47_arg0, f47_arg1 ) + assert( isUnlockItem( f47_arg0 ) ) + local f47_local0 = "" + if f47_arg0 == "Camo" then + f47_local0 = Engine.TableLookup( CamoTable.File, CamoTable.Cols.Ref, f47_arg1, CamoTable.Cols.Name ) + else + f47_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes[f47_arg0]].GetName( f47_arg1 ) + end + return f47_local0 +end + +function getMaterialForUnlockItem( f48_arg0, f48_arg1 ) + assert( isUnlockItem( f48_arg0 ) ) + local f48_local0 = "" + if f48_arg0 == "Camo" then + f48_local0 = Engine.TableLookup( CamoTable.File, CamoTable.Cols.Ref, f48_arg1, CamoTable.Cols.Image ) + else + f48_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes[f48_arg0]].GetUIMaterial( f48_arg1 ) + end + return f48_local0 +end + +function getLocNameForUnlockType( f49_arg0 ) + assert( isUnlockItem( f49_arg0 ) ) + if f49_arg0 == "Camo" then + return Engine.Localize( "@MENU_CAMO_CAPS" ) + else + return Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_" .. Cac.Customization.Fields[Cac.Customization.FieldIndexes[f49_arg0]].LocName .. "_CAPS" ) + end +end + +function isWeaponOperation( f50_arg0 ) + return Engine.TableLookup( WeaponChallengeTable.File, WeaponChallengeTable.Cols.Ref, f50_arg0, WeaponChallengeTable.Cols.Idx ) ~= "" +end + +function getWeaponOperationWeaponName( f51_arg0 ) + assert( isWeaponOperation( f51_arg0 ) ) + local f51_local0 = GetFieldForChallenge( f51_arg0, AllChallengesTable.Cols.Filter ) + assert( f51_local0 ~= "" ) + return f51_local0 +end + +function getWeaponOperationWeaponClass( f52_arg0 ) + local f52_local0 = getWeaponOperationWeaponName( f52_arg0 ) + for f52_local7, f52_local8 in pairs( Cac.Weapons ) do + for f52_local4, f52_local5 in ipairs( f52_local8 ) do + if f52_local5 == f52_local0 then + return f52_local7 + end + end + end +end + +function getWeaponOperationSuffix( f53_arg0 ) + return string.sub( f53_arg0, string.len( getWeaponOperationWeaponName( f53_arg0 ) ) + 4 ) +end + +function CanAcessOperationCache() + local f54_local0 = LUI.FlowManager.IsInStack + local f54_local1 = Engine.GetLuiRoot() + return f54_local0( f54_local1.flowManager, "operations_main_menu" ) +end + +function GetOperationCache( f55_arg0 ) + local f55_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "operations_main_menu" ) + assert( f55_local0 ) + if not f55_local0[f55_arg0] then + f55_local0[f55_arg0] = {} + end + return f55_local0[f55_arg0] +end + +function OperationCacheSortFunction( f56_arg0, f56_arg1 ) + return f56_arg0.sortValue < f56_arg1.sortValue +end + +function OperationCacheReverseSortFunction( f57_arg0, f57_arg1 ) + return f57_arg1.sortValue < f57_arg0.sortValue +end + +function CacheOperationGroupInfo( f58_arg0, f58_arg1 ) + local f58_local0 = GetOperationCache( OperationUtilsCache.Types.Groups ) + if f58_local0[f58_arg1] then + return + end + f58_local0[f58_arg1] = {} + f58_local0[f58_arg1].sortedRefLists = {} + local f58_local1 = {} + local f58_local2 = {} + local f58_local3 = Engine.TableLookup( OperationGroups.File, OperationGroups.Cols.Idx, f58_arg1, OperationGroups.Cols.File ) + local f58_local4 = nil + if f58_local3 ~= "" then + for f58_local5 = 0, AnynonOpsTable.MaxOps, 1 do + local f58_local8 = Engine.TableLookupByRow( f58_local3, f58_local5, AnynonOpsTable.Cols.Ref ) + if f58_local8 ~= "" then + local f58_local9 = GetCachedOperationData( f58_arg0, f58_local8 ) + f58_local1[f58_local5 + 1] = { + ref = f58_local8, + sortValue = Engine.Localize( GetFieldForChallenge( f58_local8, AllChallengesTable.Cols.Name ) ) + } + f58_local2[f58_local5 + 1] = { + ref = f58_local8, + sortValue = f58_local9.PercentProgress + } + end + end + table.sort( f58_local1, OperationCacheSortFunction ) + table.sort( f58_local2, OperationCacheReverseSortFunction ) + local f58_local5 = {} + f58_local0[f58_arg1].sortedRefLists.Alphabetical = f58_local5 + local f58_local6 = {} + f58_local0[f58_arg1].sortedRefLists.Progress = f58_local6 + for f58_local7 = 1, #f58_local1, 1 do + f58_local5[f58_local7] = f58_local1[f58_local7].ref + f58_local6[f58_local7] = f58_local2[f58_local7].ref + end + end +end + +function CacheWeaponOps( f59_arg0, f59_arg1, f59_arg2 ) + local f59_local0 = GetOperationCache( OperationUtilsCache.Types.WeaponOps ) + local f59_local1 = GetOperationCache( OperationUtilsCache.Types.OpRows ) + if f59_local0[f59_arg2] ~= nil then + return + end + f59_local0[f59_arg2] = {} + local f59_local2 = {} + local f59_local3 = {} + for f59_local8, f59_local9 in pairs( WeaponChallenge.ChallengeSuffixes[f59_arg1] ) do + local f59_local10 = "ch_" .. f59_arg2 .. f59_local9 + local f59_local11 = Engine.TableLookupGetRowNum( AllChallengesTable.File, AllChallengesTable.Cols.Ref, f59_local10 ) + if f59_local11 and f59_local11 ~= -1 then + f59_local1[f59_local10] = f59_local11 + end + local f59_local7 = GetCachedOperationData( f59_arg0, f59_local10 ) + f59_local2[#f59_local2 + 1] = { + ref = f59_local10, + sortValue = f59_local7.Name + } + f59_local3[#f59_local3 + 1] = { + ref = f59_local10, + sortValue = f59_local7.PercentProgress + } + end + f59_local0[f59_arg2].sortedRefLists = {} + table.sort( f59_local2, OperationCacheSortFunction ) + table.sort( f59_local3, OperationCacheReverseSortFunction ) + f59_local4 = {} + f59_local0[f59_arg2].sortedRefLists.Alphabetical = f59_local4 + f59_local5 = {} + f59_local0[f59_arg2].sortedRefLists.Progress = f59_local5 + for f59_local6 = 1, #f59_local2, 1 do + f59_local4[f59_local6] = f59_local2[f59_local6].ref + f59_local5[f59_local6] = f59_local3[f59_local6].ref + end +end + +function GetGroupOperationsFromCache( f60_arg0, f60_arg1 ) + local f60_local0 = GetOperationCache( OperationUtilsCache.Types.Groups ) + if not f60_local0[f60_arg1] then + CacheOperationGroupInfo( f60_arg0, f60_arg1 ) + end + assert( f60_local0[f60_arg1] ~= nil ) + return f60_local0[f60_arg1].sortedRefLists[OperationUtilsCache.SortTypes[OperationUtilsCache.CurrentSortType]] +end + +function GetOperationFromCache( f61_arg0, f61_arg1, f61_arg2 ) + local f61_local0 = GetOperationCache( OperationUtilsCache.Types.Groups ) + if not f61_local0[f61_arg1] then + CacheOperationGroupInfo( f61_arg0, f61_arg1 ) + end + assert( f61_local0[f61_arg1] ~= nil ) + local f61_local1 = f61_local0[f61_arg1].sortedRefLists + local f61_local2 = OperationUtilsCache.SortTypes + return f61_local1[OperationUtilsCache.SortTypes[OperationUtilsCache.CurrentSortType]][f61_arg2] +end + +function GetCachedChallengeTableRowForOp( f62_arg0 ) + local f62_local0 = GetOperationCache( OperationUtilsCache.Types.OpRows ) + if not f62_local0[f62_arg0] then + f62_local0[f62_arg0] = Engine.TableLookupGetRowNum( AllChallengesTable.File, AllChallengesTable.Cols.Ref, f62_arg0 ) + end + return f62_local0[f62_arg0] +end + +function RandomizeOperationData( f63_arg0 ) + if not Engine.IsDevelopmentBuild() then + return + end + for f63_local0 = 0, 1000, 1 do + local f63_local3 = Engine.TableLookupByRow( AllChallengesTable.File, f63_local0, AllChallengesTable.Cols.Ref ) + if f63_local3 and f63_local3 ~= "" then + local f63_local4 = operationGetNumTiers( f63_local3 ) + local f63_local5 = f63_local4 + local f63_local6 = math.floor( math.random() * f63_local4 + 1 ) + local f63_local7 = operationGetTargetForTier( f63_local3, f63_local6 ) + Engine.SetPlayerDataEx( f63_arg0, CoD.StatsGroup.Ranked, "challengeState", f63_local3, f63_local6 ) + local f63_local8 = math.floor( math.random() * 6 ) + if f63_local8 < 3 then + Engine.SetPlayerDataEx( f63_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f63_local3, math.floor( math.random() * f63_local7 ) ) + end + if f63_local8 == 4 then + Engine.SetPlayerDataEx( f63_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f63_local3, f63_local7 ) + end + if f63_local8 == 5 then + Engine.SetPlayerDataEx( f63_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f63_local3, 0 ) + end + end + end +end + +function ValidateOperations( f64_arg0 ) + if Engine.HasActiveLocalClient( f64_arg0 ) then + ConvertOldTrackedOpertions( f64_arg0 ) + local f64_local0 = "ch_iw6_riotshield_damage" + local f64_local1 = getTierForActiveOperation( f64_arg0, f64_local0 ) + local f64_local2 = operationGetNumTiers( f64_local0 ) + if f64_local1 == f64_local2 then + local f64_local3 = operationGetProgress( f64_arg0, f64_local0 ) + local f64_local4 = tonumber( operationGetTargetForTier( f64_local0, f64_local2 ) ) + if f64_local3 < 0 or f64_local4 <= f64_local3 then + Engine.SetPlayerDataEx( f64_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f64_local0, f64_local4 - 1 ) + end + end + local f64_local3 = "ch_hijacker" + local f64_local4 = getTierForActiveOperation( f64_arg0, f64_local3 ) + local f64_local5 = operationGetNumTiers( f64_local3 ) + if f64_local4 == f64_local5 then + local f64_local6 = Engine.GetPlayerDataEx( f64_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f64_local3 ) + if f64_local6 < 0 or tonumber( operationGetTargetForTier( f64_local3, f64_local5 ) ) <= f64_local6 then + Engine.SetPlayerDataEx( f64_arg0, CoD.StatsGroup.Ranked, "challengeState", f64_local3, f64_local5 + 1 ) + Engine.SetPlayerDataEx( f64_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f64_local3, 0 ) + end + end + end +end + +function ConvertOldTrackedOpertions( f65_arg0 ) + if Engine.HasActiveLocalClient( f65_arg0 ) then + local f65_local0 = true + for f65_local1 = 0, 4, 1 do + local f65_local4 = f65_local1 + local f65_local5 = Engine.GetPlayerDataEx( f65_arg0, CoD.StatsGroup.Ranked, "activeChallenges", 0 ) + if not f65_local5 or f65_local5 == "" then + f65_local0 = false + break + end + end + if f65_local0 then + for f65_local5, f65_local9 in ipairs( GetAllOpGroupRefs() ) do + for f65_local8 = 0, AnynonOpsTable.MaxOps, 1 do + local f65_local6 = GetOpForGroup( f65_arg0, f65_local9, f65_local8 ) + if f65_local6 and f65_local6 ~= "" then + if Engine.GetPlayerDataEx( f65_arg0, CoD.StatsGroup.Ranked, "challengeState", f65_local6 ) == 0 then + Engine.SetPlayerDataEx( f65_arg0, CoD.StatsGroup.Ranked, "challengeState", f65_local6, 1 ) + end + local f65_local7 = getTierForActiveOperation( f65_arg0, f65_local6 ) + if tonumber( operationGetTargetForTier( f65_local6, f65_local7 ) ) <= Engine.GetPlayerDataEx( f65_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f65_local6 ) and f65_local7 <= operationGetNumTiers( f65_local6 ) then + Engine.SetPlayerDataEx( f65_arg0, CoD.StatsGroup.Ranked, "challengeState", f65_local6, f65_local7 + 1 ) + Engine.SetPlayerDataEx( f65_arg0, CoD.StatsGroup.Ranked, "challengeProgress", f65_local6, 0 ) + end + end + end + end + for f65_local2 = 0, MaxTrackedOperations - 1, 1 do + f65_local9 = nil + if f65_local2 < 5 then + f65_local9 = Engine.GetPlayerDataEx( f65_arg0, CoD.StatsGroup.Ranked, "activeChallenges", f65_local2 ) + assert( f65_local9 and f65_local9 ~= "" ) + Engine.SetPlayerDataEx( f65_arg0, CoD.StatsGroup.Ranked, "activeChallenges", f65_local2, "" ) + else + local f65_local8 = Cac.WeaponTypes.Primary[f65_local2 - 4] + local f65_local10 = -1 + local f65_local11 = "" + for f65_local12 = 1, #Cac.Weapons[f65_local8], 1 do + local f65_local14 = Cac.Weapons[f65_local8][f65_local12] + local f65_local15 = Engine.GetPlayerDataEx( f65_arg0, CoD.StatsGroup.Ranked, "weaponStats", f65_local14, "kills" ) + if f65_local10 < f65_local15 then + f65_local11 = f65_local14 + f65_local10 = f65_local15 + end + end + f65_local9 = "ch_" .. f65_local11 + end + Engine.SetPlayerDataEx( f65_arg0, CoD.StatsGroup.Ranked, "currentChallenges", 0, f65_local2, f65_local9 ) + end + end + end +end + diff --git a/lui/mp_menus/playerdatainit.dec.lua b/lui/mp_menus/playerdatainit.dec.lua new file mode 100644 index 0000000..22c0e1d --- /dev/null +++ b/lui/mp_menus/playerdatainit.dec.lua @@ -0,0 +1,239 @@ +local f0_local0 = function ( f1_arg0, f1_arg1, f1_arg2, f1_arg3 ) + if f1_arg0 and Cac.Settings.DataLoc.loadouts.baseClassSlots <= f1_arg0 then + return Engine.TableLookup( "mp/classTable.csv", 0, f1_arg1, 12 ) + elseif f1_arg2 == nil or f1_arg2 == "privateMatchSquadMembers" then + return Engine.TableLookup( "mp/classTable.csv", 0, f1_arg1, f1_arg0 % 10 + 1 ) + elseif f1_arg3 == 0 then + return Engine.TableLookup( "mp/classTableAssault.csv", 0, f1_arg1, 1 ) + elseif f1_arg3 == 1 then + return Engine.TableLookup( "mp/classTableCQB.csv", 0, f1_arg1, 1 ) + elseif f1_arg3 == 2 then + return Engine.TableLookup( "mp/classTableAssassin.csv", 0, f1_arg1, 1 ) + elseif f1_arg3 == 3 then + return Engine.TableLookup( "mp/classTableHeavyGunner.csv", 0, f1_arg1, 1 ) + elseif f1_arg3 == 4 then + return Engine.TableLookup( "mp/classTableSniper.csv", 0, f1_arg1, 1 ) + else + return Engine.TableLookup( "mp/classTableAssault.csv", 0, f1_arg1, 1 ) + end +end + +local f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2 ) + local f2_local0 = {} + local f2_local1 = 0 + local f2_local2 = Engine.TableLookupByRow( f2_arg0, f2_local1, f2_arg2 ) + while f2_local2 ~= "" do + if f2_local2 == f2_arg1 then + f2_local0[#f2_local0 + 1] = f2_local1 + end + f2_local1 = f2_local1 + 1 + f2_local2 = Engine.TableLookupByRow( f2_arg0, f2_local1, f2_arg2 ) + end + return f2_local0 +end + +local f0_local2 = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3, f3_arg4, f3_arg5 ) + local f3_local0 = f0_local0( f3_arg3, "loadout" .. f3_arg5, f3_arg1, f3_arg2 ) + local f3_local1 = f0_local0( f3_arg3, "loadout" .. f3_arg5 .. "Attachment", f3_arg1, f3_arg2 ) + local f3_local2 = f0_local0( f3_arg3, "loadout" .. f3_arg5 .. "Attachment2", f3_arg1, f3_arg2 ) + local f3_local3 = f0_local0( f3_arg3, "loadout" .. f3_arg5 .. "Attachment3", f3_arg1, f3_arg2 ) + local f3_local4 = f0_local0( f3_arg3, "loadout" .. f3_arg5 .. "Camo", f3_arg1, f3_arg2 ) + Cac.SetCacConfig( f3_arg0, f3_arg1, f3_arg2, "loadouts", f3_arg3, "weaponSetups", f3_arg4, "weapon", f3_local0 ) + Cac.SetCacConfig( f3_arg0, f3_arg1, f3_arg2, "loadouts", f3_arg3, "weaponSetups", f3_arg4, "attachment", 0, f3_local1 ) + Cac.SetCacConfig( f3_arg0, f3_arg1, f3_arg2, "loadouts", f3_arg3, "weaponSetups", f3_arg4, "attachment", 1, f3_local2 ) + Cac.SetCacConfig( f3_arg0, f3_arg1, f3_arg2, "loadouts", f3_arg3, "weaponSetups", f3_arg4, "attachment", 2, f3_local3 ) + Cac.SetCacConfig( f3_arg0, f3_arg1, f3_arg2, "loadouts", f3_arg3, "weaponSetups", f3_arg4, "camo", f3_local4 ) + local f3_local5 = { + f3_local1, + f3_local2, + f3_local3 + } + local f3_local6 = "none" + for f3_local10, f3_local11 in ipairs( f3_local5 ) do + if f3_local11 and f3_local11 ~= "" and Cac.AttachmentHasReticles( f3_local11 ) then + f3_local6 = Cac.GetReticleDefault( f3_local11 ) + break + end + end + Cac.SetCacConfig( f3_arg0, f3_arg1, f3_arg2, "loadouts", f3_arg3, "weaponSetups", f3_arg4, "reticle", f3_local6 ) +end + +local f0_local3 = function ( f4_arg0, f4_arg1, f4_arg2, f4_arg3, f4_arg4, f4_arg5 ) + f0_local2( f4_arg0, f4_arg1, f4_arg2, f4_arg3, 0, "Primary" ) + f0_local2( f4_arg0, f4_arg1, f4_arg2, f4_arg3, 1, "Secondary" ) +end + +local f0_local4 = function ( f5_arg0, f5_arg1, f5_arg2, f5_arg3 ) + local f5_local0 = Cac.GetCacConfig( f5_arg0, f5_arg1, f5_arg2, "loadouts", f5_arg3, "perks", Cac.Indices.Grenade.Primary ) + local f5_local1 = Cac.GetCacConfig( f5_arg0, f5_arg1, f5_arg2, "loadouts", f5_arg3, "perks", Cac.Indices.Grenade.Secondary ) + Cac.SetCacConfig( f5_arg0, f5_arg1, f5_arg2, "loadouts", f5_arg3, "perks", Cac.Indices.Grenade.Primary, f0_local0( f5_arg3, "loadoutEquipment", f5_arg1, f5_arg2 ) ) + Cac.SetCacConfig( f5_arg0, f5_arg1, f5_arg2, "loadouts", f5_arg3, "perks", Cac.Indices.Grenade.Secondary, f0_local0( f5_arg3, "loadoutOffhand", f5_arg1, f5_arg2 ) ) +end + +local f0_local5 = function ( f6_arg0, f6_arg1, f6_arg2, f6_arg3 ) + for f6_local0 = 1, 8, 1 do + local f6_local3 = f0_local0( f6_arg3, "loadoutPerk" .. f6_local0, f6_arg1, f6_arg2 ) + if f6_local3 then + if f6_local3 == "" then + break + end + local f6_local4 = tonumber( string.sub( f6_local3, 1, 1 ) ) + local f6_local5 = tonumber( string.sub( f6_local3, 2, 2 ) ) + if f6_local4 then + if not f6_local5 then + break + end + Cac.SetCacConfig( f6_arg0, f6_arg1, f6_arg2, "loadouts", f6_arg3, "abilitiesPicked", f6_local4 - 1, f6_local5 - 1, true ) + end + end + end +end + +local f0_local6 = function ( f7_arg0, f7_arg1, f7_arg2, f7_arg3 ) + for f7_local0 = 0, 5, 1 do + local f7_local3 = f0_local0( f7_arg3, "loadoutStreak" .. f7_local0, f7_arg1, f7_arg2 ) + local f7_local4 = "assaultStreaks" + local f7_local5 = f7_local0 + if f7_local0 > 2 then + f7_local4 = "supportStreaks" + f7_local5 = f7_local0 - 3 + end + Cac.SetCacConfig( f7_arg0, f7_arg1, f7_arg2, "loadouts", f7_arg3, f7_local4, f7_local5, f7_local3 ) + end +end + +local f0_local7 = function ( f8_arg0, f8_arg1, f8_arg2 ) + for f8_local0 = 0, Cac.Settings.DataLoc.loadouts.baseClassSlots - 1, 1 do + Cac.SetCacConfig( f8_arg0, f8_arg1, f8_arg2, "loadouts", f8_local0, "name", Engine.Localize( f0_local0( f8_local0, "loadoutName" ) ) ) + f0_local3( f8_arg0, f8_arg1, f8_arg2, f8_local0, 0, "Primary" ) + f0_local3( f8_arg0, f8_arg1, f8_arg2, f8_local0, 1, "Secondary" ) + f0_local4( f8_arg0, f8_arg1, f8_arg2, f8_local0 ) + f0_local5( f8_arg0, f8_arg1, f8_arg2, f8_local0 ) + f0_local6( f8_arg0, f8_arg1, f8_arg2, f8_local0 ) + if f8_arg1 ~= "privateMatchSquadMembers" then + local f8_local3 = false + if f8_local0 <= 2 then + f8_local3 = true + end + Cac.SetCacConfig( f8_arg0, f8_arg1, f8_arg2, "loadouts", f8_local0, "inUse", f8_local3 ) + end + end +end + +local f0_local8 = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_arg4, f9_arg5 ) + local f9_local0 = { + 0, + 4, + 8, + 12, + 18, + 22, + 26, + 30, + 34, + 40 + } + local f9_local1 = math.random( 1, #f9_local0 ) + local f9_local2 = { + 0, + 4, + 9, + 13, + 27 + } + local f9_local3 = math.random( 1, #f9_local2 ) + local f9_local4 = Cac.GetGenderFromBodyRef( f9_local0[f9_local1] ) + local f9_local5 = 0 + if f9_local4 == "m" then + if math.random( 0, 1 ) == 1 then + f9_local5 = 0 + else + f9_local5 = 8 + end + else + f9_local5 = 20 + end + Engine.SetPlayerDataEx( f9_arg0, f9_arg1, f9_arg2, f9_arg3, "name", f9_arg4 ) + Engine.SetPlayerDataEx( f9_arg0, f9_arg1, f9_arg2, f9_arg3, "head", f9_local5 ) + Engine.SetPlayerDataEx( f9_arg0, f9_arg1, f9_arg2, f9_arg3, "helmet", f9_local2[f9_local3] ) + Engine.SetPlayerDataEx( f9_arg0, f9_arg1, f9_arg2, f9_arg3, "body", f9_local0[f9_local1] ) + if f9_arg5 then + f0_local7( f9_arg0, f9_arg2, f9_arg3 ) + end +end + +local f0_local9 = function ( f10_arg0, f10_arg1, f10_arg2, f10_arg3 ) + local f10_local0 = Cac.MaxSquadMemberCount( f10_arg2 ) + local f10_local1 = f0_local1( "mp/namesTable.csv", "american", 0 ) + for f10_local2 = 1, f10_local0, 1 do + local f10_local5 = math.random( f10_local2, #f10_local1 ) + f10_local1[f10_local5] = f10_local1[f10_local2] + f10_local1[f10_local2] = f10_local1[f10_local5] + end + for f10_local2 = 1, f10_local0, 1 do + f0_local8( f10_arg0, f10_arg1, f10_arg2, f10_local2 - 1, Engine.TableLookupByRow( "mp/namesTable.csv", f10_local1[f10_local2], 1 ), f10_arg3 ) + end +end + +local f0_local10 = function ( f11_arg0, f11_arg1 ) + local f11_local0 = Engine.GetPlayerDataEx( f11_arg0, f11_arg1, "prestige" ) + Engine.SetPlayerDataEx( f11_arg0, f11_arg1, "challengeState", "ch_prestige", f11_local0 + 1 ) + Engine.SetPlayerDataEx( f11_arg0, f11_arg1, "challengeProgress", "ch_prestige", f11_local0 + 1 ) + if f11_local0 == 10 then + Engine.SetPlayerDataEx( f11_arg0, f11_arg1, "challengeState", "ch_prestige", 2 ) + Engine.SetPlayerDataEx( f11_arg0, f11_arg1, "challengeProgress", "ch_prestige", 1 ) + end +end + +function InitPlayerData( f12_arg0, f12_arg1 ) + local f12_local0 = f12_arg1.controller or 0 + f0_local9( f12_local0, CoD.StatsGroup.Ranked, "squadMembers", true ) + f0_local9( f12_local0, CoD.StatsGroup.Private, "privateMatchSquadMembers", true ) + Engine.SetPlayerDataEx( f12_local0, CoD.StatsGroup.Ranked, "squadMembers", 0, "inUse", true ) + Engine.SetPlayerDataEx( f12_local0, CoD.StatsGroup.Ranked, "challengeState", "ch_squad_member1_purchase", 2 ) + for f12_local1 = 0, Cac.MaxSquadMemberCount( "privateMatchSquadMembers" ) - 1, 1 do + local f12_local4 = f12_local1 + Engine.SetPlayerDataEx( f12_local0, CoD.StatsGroup.Private, "privateMatchSquadMembers", 0, "inUse", true ) + end + f0_local9( f12_local0, CoD.StatsGroup.Coop, "coopSquadMembers", false ) + f0_local10( f12_local0, CoD.StatsGroup.Ranked ) + Engine.SetPlayerDataEx( f12_local0, CoD.StatsGroup.Common, "enableBattleBuddy", false ) + local f12_local1 = f0_local1( "mp/squadDefaults.csv", "squadname", 0 ) + Engine.SetPlayerDataEx( f12_local0, CoD.StatsGroup.Ranked, "squadHQ", "squad_name", Engine.TableLookupByRow( "mp/squadDefaults.csv", f12_local1[math.random( 1, #f12_local1 )], 1 ) ) + local f12_local4 = f0_local1( "mp/squadDefaults.csv", "mapname", 0 ) + Engine.SetPlayerDataEx( f12_local0, CoD.StatsGroup.Ranked, "squadHQ", "squad_base", Engine.TableLookupByRow( "mp/squadDefaults.csv", f12_local4[math.random( 1, #f12_local4 )], 1 ) ) + Engine.SetPlayerDataEx( f12_local0, CoD.StatsGroup.Ranked, "squadHQ", "squad_mode", "war" ) + for f12_local5 = 0, 9, 1 do + Engine.SetPlayerDataEx( f12_local0, CoD.StatsGroup.Ranked, "squadHQ", "aiSquadMembers", f12_local5, f12_local5 ) + end + InitOperationsData( f12_local0 ) + ResetMOTDCounters( f12_local0 ) +end + +function InitPlayerDataExtended( f13_arg0, f13_arg1 ) + local f13_local0 = { + "privateMatchSquadMembers", + "squadMembers" + } + local f13_local1 = f13_arg1.controller + if not f13_local1 then + return + end + for f13_local10, f13_local11 in ipairs( f13_local0 ) do + local f13_local12 = Cac.MaxSquadMemberCount( f13_local11 ) + local f13_local13 = Cac.Settings.DataLoc.loadouts.baseClassSlots + local f13_local14 = Cac.Settings.DataLoc.loadouts.maxClassSlots + for f13_local9 = 0, f13_local12 - 1, 1 do + for f13_local5 = 0, f13_local14 - f13_local13 - 1, 1 do + local f13_local8 = f13_local5 + f13_local13 + f0_local3( f13_local1, f13_local11, f13_local9, f13_local8, 0, "Primary" ) + f0_local3( f13_local1, f13_local11, f13_local9, f13_local8, 1, "Secondary" ) + f0_local4( f13_local1, f13_local11, f13_local9, f13_local8 ) + f0_local5( f13_local1, f13_local11, f13_local9, f13_local8 ) + f0_local6( f13_local1, f13_local11, f13_local9, f13_local8 ) + Cac.SetCacConfig( f13_local1, f13_local11, f13_local9, "loadouts", f13_local8, "name", Engine.Localize( "LUA_MENU_EXTRA_LOADOUT", f13_local5 + 1 ) ) + end + end + end +end + diff --git a/lui/mp_menus/snselements.dec.lua b/lui/mp_menus/snselements.dec.lua new file mode 100644 index 0000000..365b59c --- /dev/null +++ b/lui/mp_menus/snselements.dec.lua @@ -0,0 +1,1410 @@ +function sns_category_window() + return { + type = "UIElement", + id = "sns_category_window_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 120, + height = 500, + left = 100, + width = 270 + } + }, + properties = { + feeder = nil, + initialDlcName = "" + }, + children = { + { + type = "generic_menu_background_withfade", + id = "category_window_bg_id", + properties = { + top_offset = 0 + } + }, + { + type = "UIElement", + id = "padding", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + top = 1, + bottom = 0, + left = 1, + right = -1 + } + }, + children = { + { + type = "UIVerticalList", + id = "category_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + spacing = 0 + } + }, + childrenFeeder = MBh.Property( "feeder" ) + } + } + } + } + } +end + +function sns_thumbnail() + return { + type = "UIButton", + id = "sns_category_window_id", + properties = { + item_id = -1, + file_id = "", + item_index = -1, + thumbName = "" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = Sns.Dims.Thumbnail.height, + left = 0, + right = Sns.Dims.Thumbnail.width + } + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = -1 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.45 + } + } + }, + { + type = "ContentServerImage", + id = "sns_thumbnail_image", + properties = { + file_id = MBh.Property( "file_id" ), + thumbName = MBh.Property( "thumbName" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 1, + right = -1, + top = 1, + bottom = -1, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + download_complete = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0:getParent() + f3_local0:processEvent( { + name = "done_loading" + } ) + end + , + material_lost = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0:getParent() + f4_local0:processEvent( { + name = "start_loading" + } ) + end + , + start_loading = function ( f5_arg0, f5_arg1 ) + f5_arg0:animateToState( "default", 0 ) + end + , + done_loading = function ( f6_arg0, f6_arg1 ) + f6_arg0:animateToState( "visible", 150 ) + end + , + update_hack_banner = function ( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + if CrossGameHackVisual( f7_local0.category ) then + f7_arg0.m_fileId = nil + f7_arg0:setImage( RegisterMaterial( "img_store_advanced_warfare" ) ) + local f7_local1 = f7_arg0:getParent() + f7_local1:processEvent( { + name = "done_loading" + } ) + end + end + + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 1, + right = -1, + top = 1, + bottom = -1, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + start_loading = MBh.AnimateToState( "default", 0 ), + done_loading = MBh.AnimateToState( "hidden", 50 ) + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "white" ), + red = 0, + green = 0, + blue = 0, + alpha = 0.25 + } + } + }, + { + type = "live_dialog_processing_widget", + id = "popup_diamond_id" + } + } + }, + { + type = "UIImage", + id = "sns_thumbnail_sale_banner", + properties = { + item_id = MBh.Property( "item_id" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + bottom = -1, + width = 48, + right = -1, + height = 32, + material = RegisterMaterial( "icon_sale" ), + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_sale_banners = function ( f8_arg0, f8_arg1 ) + local f8_local0 = Sns.GetScopedArticleInfo( f8_arg0, "sale" ) + local f8_local1 = f8_arg0 + local f8_local2 = f8_arg0.animateToState + local f8_local3 + if f8_local0 and f8_local0 > 0 then + f8_local3 = "default" + if not f8_local3 then + + else + f8_local2( f8_local1, f8_local3, 0 ) + end + end + f8_local3 = "hidden" + end + + } + }, + { + type = "UIImage", + id = "sns_thumbnail_purchased_checkbox", + properties = { + item_index = MBh.Property( "item_index" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 3, + width = 16, + left = 3, + height = 16, + material = RegisterMaterial( "box_empty" ), + alpha = 1 + }, + checked = { + material = RegisterMaterial( "box_check" ), + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_purchase_checkboxes = function ( f9_arg0, f9_arg1 ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 ) + if CrossGameHackVisual( f9_local0.category ) then + f9_arg0:animateToState( "hidden" ) + else + local f9_local1 = Store.IsItemPurchasedByIndex( f9_local0.category, f9_arg0.properties.item_index ) + local f9_local2 = f9_arg0 + local f9_local3 = f9_arg0.animateToState + local f9_local4 + if f9_local1 then + f9_local4 = "checked" + if not f9_local4 then + + else + f9_local3( f9_local2, f9_local4, 0 ) + end + end + f9_local4 = "default" + end + end + + } + }, + { + type = "generic_border", + id = "sns_thumbnail_border_id", + properties = { + border_red = Colors.white.r, + border_green = Colors.white.g, + border_blue = Colors.white.b, + thickness = 3 + }, + states = { + default = { + alpha = 0 + }, + dim = { + alpha = 0.5 + }, + focused = { + alpha = 0.8 + } + }, + handlers = { + gain_focus = MBh.AnimateLoop( { + { + "focused", + 0, + true, + true + }, + { + "focused", + 350, + true, + true + }, + { + "dim", + 750, + true, + true + }, + { + "focused", + 750, + true, + true + } + } ), + lose_focus = MBh.AnimateToState( "default" ) + } + } + } + } +end + +function sns_thumbnail_window() + return { + type = "UIElement", + id = "store_thumbnail_window_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 113, + height = 120, + left = 430, + width = 730 + } + }, + properties = { + feeder = nil, + initialDlcName = "" + }, + children = { + { + type = "UIStencil", + id = "thumbnail_window_stencil_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIHorizontalList", + id = "thumbnail_list_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = Sns.HListOffset, + right = -Sns.HListOffset, + top = Sns.HListOffset, + bottom = -Sns.HListOffset, + spacing = Sns.HListSpacing + } + }, + childrenFeeder = MBh.Property( "feeder" ), + handlers = { + refresh_thumbnails = RefreshThumbnails + } + } + } + }, + { + type = "UIButton", + id = "thumbnail_list_left_arrow_id", + properties = { + visible = false + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 40, + left = -20, + width = 20, + height = 40, + alpha = 1 + }, + shifted = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 40, + left = -25, + width = 20, + height = 40, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_thumbnail_arrows = function ( f11_arg0, f11_arg1 ) + if f11_arg1.left_visible then + if not f11_arg0.properties.visible then + local f11_local0 = MBh.AnimateLoop( { + { + "shifted", + 500, + true, + true + }, + { + "default", + 500, + true, + true + } + } ) + f11_local0( f11_arg0, f11_arg1 ) + f11_arg0.properties.visible = true + end + else + f11_arg0:animateToState( "hidden", 0 ) + f11_arg0.properties.visible = false + end + end + + }, + children = { + { + type = "UIImage", + id = "thumbnail_list_left_arrow_image_id", + states = { + default = { + material = RegisterMaterial( "widg_btn_arrow_lt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + } + } + }, + { + type = "UIButton", + id = "thumbnail_list_right_arrow_id", + properties = { + visible = false + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 40, + right = 30, + width = 20, + height = 40, + alpha = 1 + }, + shifted = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 40, + right = 35, + width = 20, + height = 40, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_thumbnail_arrows = function ( f12_arg0, f12_arg1 ) + if f12_arg1.right_visible then + if not f12_arg0.properties.visible then + local f12_local0 = MBh.AnimateLoop( { + { + "shifted", + 500, + true, + true + }, + { + "default", + 500, + true, + true + } + } ) + f12_local0( f12_arg0, f12_arg1 ) + f12_arg0.properties.visible = true + end + else + f12_arg0:animateToState( "hidden", 0 ) + f12_arg0.properties.visible = false + end + end + + }, + children = { + { + type = "UIImage", + id = "thumbnail_list_right_arrow_image_id", + states = { + default = { + material = RegisterMaterial( "widg_btn_arrow_rt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + } + } + } + } + } +end + +function sns_article_detail_widget() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = { + label_text = "Placeholder Label", + value_text = "Placeholder Value", + width = 160 + }, + children = { + { + type = "UIMarqueeText", + id = "sns_article_detail_widget_label_id", + properties = { + text = MBh.Property( "label_text" ), + width = MBh.Property( "width" ) + }, + states = { + default = CoD.ColorizeState( Colors.secondary_text_color, { + left = 0, + top = 0, + width = MBh.Property( "width" ), + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center + } ) + } + }, + { + type = "UIElement", + id = "sns_article_detail_widget_value_bg_id", + states = { + default = { + top = CoD.TextSettings.BoldFont.Height + 2, + left = 0, + width = MBh.Property( "width" ), + height = 24 + } + }, + children = { + { + type = "generic_border", + properties = { + border_red = Swatches.GenericMenu.Border.r, + border_green = Swatches.GenericMenu.Border.g, + border_blue = Swatches.GenericMenu.Border.b + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Background, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + } ) + } + }, + { + type = "UIMarqueeText", + id = "sns_article_detail_widget_value_id", + properties = { + text = MBh.Property( "value_text" ), + width = MBh.Property( "width" ) + }, + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center + } ) + }, + handlers = { + update_article_detail_value = function ( f14_arg0, f14_arg1 ) + f14_arg0:setText( f14_arg1.value ) + end + + } + } + } + } + } + } +end + +function sns_article_countdown_widget() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + show_article_countdown = MBh.AnimateToState( "visible", 0 ), + show_article_purchaseinfo = MBh.AnimateToState( "default", 0 ), + hide_article_overlays = MBh.AnimateToState( "default", 0 ) + }, + children = { + { + type = "UIText", + id = "sns_countdown_widget_label_id", + properties = { + text = "Time Left: " + }, + states = { + default = { + left = -80, + top = 45, + width = 160, + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center, + red = 0.7, + green = 0.7, + blue = 0.7 + } + } + }, + { + type = "UILongCountdown", + id = "sns_countdown_widget_time_id", + properties = { + end_time = 0 + }, + states = { + default = { + left = -80, + top = 65, + width = 160, + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center + } + }, + handlers = { + update_article_details = function ( f16_arg0, f16_arg1 ) + if f16_arg1.end_time then + f16_arg0:setEndTime( Sns.GetScopedArticleInfo( f16_arg0, "endTime" ) ) + end + end + + } + } + } + } +end + +function sns_article_purchaseinfo_widget() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -35, + bottom = 0, + left = 29, + right = -29, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + show_article_countdown = MBh.AnimateToState( "default", 0 ), + show_article_purchaseinfo = MBh.AnimateToState( "visible", 0 ), + hide_article_overlays = MBh.AnimateToState( "default", 0 ) + }, + children = { + { + type = "sns_value_bar", + id = "sns_article_cost_bar", + properties = { + title_text = Engine.Localize( "@LUA_MENU_COST" ), + top = 228 + } + } + } + } +end + +function sns_article() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 230, + height = 380, + left = 420, + width = 780, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + show_fetching_metadata = MBh.AnimateToState( "default" ), + hide_fetching_metadata = MBh.AnimateToState( "visible" ) + }, + children = { + { + type = "generic_menu_titlebar", + id = "article_details_window_title_id", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left + }, + handlers = { + update_article_details = function ( f19_arg0, f19_arg1 ) + f19_arg0:processEvent( { + name = "update_title", + title_text = Sns.GetScopedArticleInfo( f19_arg0, "title" ) + } ) + end + + } + }, + { + type = "generic_menu_background_withfade", + id = "article_details_window_bg_id" + }, + { + type = "UIElement", + id = "article_details_window_backdrpo_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 2, + right = 400, + top = GenericTitleBarDims.TitleBarHeight + 2, + bottom = 380 + } + }, + children = { + { + type = "UIImage", + id = "article_details_window_backdrpo_image_id", + states = { + default = CoD.ColorizeState( Colors.black, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "gradient_top" ), + alpha = 0.4 + } ) + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 29, + right = -29, + top = 12, + bottom = 182 + } + }, + children = { + { + type = "ContentServerImage", + id = "article_details_window_image_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + update_article_details = function ( f20_arg0, f20_arg1 ) + local f20_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f20_arg0 ) + if CrossGameHackVisual( f20_local0.category ) then + f20_arg0.m_fileId = nil + f20_arg0:setImage( RegisterMaterial( "img_store_advanced_warfare" ) ) + local f20_local1 = f20_arg0:getParent() + f20_local1:processEvent( { + name = "done_loading" + } ) + else + local f20_local1 = Sns.GetScopedArticleInfo( f20_arg0, "image" ) + local f20_local2 = f20_arg0:getParent() + f20_local2:processEvent( { + name = "start_loading" + } ) + f20_arg0:setFileId( f20_local1 ) + end + end + , + download_complete = function ( f21_arg0, f21_arg1 ) + local f21_local0 = f21_arg0:getParent() + f21_local0:processEvent( { + name = "done_loading" + } ) + end + , + material_lost = function ( f22_arg0, f22_arg1 ) + local f22_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f22_arg0 ) + if not CrossGameHackVisual( f22_local0.category ) then + local f22_local1 = f22_arg0:getParent() + f22_local1:processEvent( { + name = "start_loading" + } ) + end + end + , + start_loading = MBh.AnimateToState( "default", 0 ), + done_loading = MBh.AnimateToState( "visible", 150 ) + } + }, + { + type = "UIElement", + states = { + default = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + start_loading = MBh.AnimateToState( "default", 0 ), + done_loading = MBh.AnimateToState( "hidden", 50 ) + }, + children = { + { + type = "live_dialog_processing_widget", + id = "popup_diamond_id" + } + } + } + } + }, + { + type = "sns_article_purchaseinfo_widget" + }, + { + type = "sns_article_countdown_widget" + } + } + }, + { + type = "UIMarqueeText", + id = "article_details_window_desc_id", + properties = { + textHeight = CoD.TextSettings.BoldFont.Height, + scrollSpeed = 50, + useTextWrapping = true + }, + states = { + default = CoD.ColorizeState( Colors.md_grey, { + left = 35, + top = -145, + width = 340, + height = 15 * CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Left, + alpha = 1 + } ) + }, + handlers = { + update_article_details = function ( f23_arg0, f23_arg1 ) + f23_arg0:setText( Sns.GetScopedArticleInfo( f23_arg0, "details" ) ) + f23_arg0.text:setForceLineBreaks( true ) + end + + } + } + } + } +end + +function sns_fetching_category_spinner() + return { + type = "UIElement", + states = { + default = { + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + hide_fetching_metadata = MBh.AnimateToState( "default" ), + show_fetching_metadata = MBh.AnimateToState( "visible" ) + }, + children = { + { + type = "live_dialog_text_box", + id = "live_dialog_text_box_id", + properties = { + message = Engine.Localize( "LUA_MENU_RETRIEVING_INFO" ), + overlay_alpha = 0, + top = -DialogPopupDims.Height / 2, + left = -15 + } + } + } + } +end + +function sns_value_bar_children_feeder( f25_arg0 ) + local f25_local0 = { + [#f25_local0 + 1] = { + type = "UIImage", + id = "sns_value_bar_bg", + states = { + default = CoD.ColorizeState( Colors.very_dark_cyan, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = 1 + } ) + } + }, + [#f25_local0 + 1] = { + type = "UIImage", + id = "sns_value_bar_cap", + states = { + default = CoD.ColorizeState( Colors.grey_22, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -212, + right = -180, + material = RegisterMaterial( "box_angle_ltcap" ), + alpha = 0.5 + } ) + } + }, + [#f25_local0 + 1] = { + type = "UIImage", + id = "sns_value_bar_alt_bg", + states = { + default = CoD.ColorizeState( Colors.grey_22, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -180, + right = 0, + material = RegisterMaterial( "white" ), + alpha = 0.5 + } ) + } + }, + [#f25_local0 + 1] = { + type = "UIText", + id = "sns_value_bar_title_text", + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 3, + bottom = 3 + CoD.TextSettings.NormalFont.Height, + left = 5, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + properties = { + text = f25_arg0.title_text + } + }, + [#f25_local0 + 1] = { + type = "UIText", + id = "sns_value_bar_value_text", + states = { + default = CoD.ColorizeState( Colors.frontend_hilite, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 3, + bottom = 3 + CoD.TextSettings.NormalFont.Height, + left = -180, + right = -10, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right + } ), + purchased = CoD.ColorizeState( Colors.primary_text_color, {} ) + }, + handlers = { + show_article_purchaseinfo = function ( f26_arg0, f26_arg1 ) + if Sns.GetScopedArticleInfo( f26_arg0, "purchased" ) then + f26_arg0:setText( Engine.Localize( "@LUA_MENU_PURCHASED_CAPS" ) ) + f26_arg0:animateToState( "purchased" ) + else + local f26_local0 = Sns.GetScopedArticleInfo( f26_arg0, "sale" ) + if f26_local0 == 0 then + f26_arg0:setText( Sns.GetScopedArticleInfo( f26_arg0, "cost" ) ) + else + f26_arg0:setText( f26_local0 ) + end + f26_arg0:animateToState( "default" ) + end + end + } + }, + [#f25_local0 + 1] = { + type = "UIText", + id = "sns_value_bar_old_cost_text", + states = { + default = CoD.ColorizeState( Colors.secondary_text_color, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 3, + bottom = 3 + CoD.TextSettings.NormalFont.Height, + left = -180, + right = -10, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + alpha = 1 + } ), + hidden = { + alpha = 0 + } + }, + handlers = { + show_article_purchaseinfo = function ( f27_arg0, f27_arg1 ) + if Sns.GetScopedArticleInfo( f27_arg0, "purchased" ) then + f27_arg0:animateToState( "hidden", 0 ) + return false + end + local f27_local0 = Sns.GetScopedArticleInfo( f27_arg0, "sale" ) + if f27_local0 == 0 then + f27_arg0:animateToState( "hidden", 0 ) + else + local f27_local1 = Sns.GetScopedArticleInfo( f27_arg0, "cost" ) + local f27_local2, f27_local3, f27_local4, f27_local5 = GetTextDimensions( f27_local0, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f27_local6 = f27_local4 - f27_local2 + local f27_local7, f27_local8, f27_local9, f27_local10 = GetTextDimensions( f27_local1, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + f27_arg0:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 3, + bottom = 3 + CoD.TextSettings.NormalFont.Height, + left = -(f27_local9 - f27_local7) - f27_local6 - 25, + right = -f27_local6 - 25, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + alpha = 1 + } ) + f27_arg0:animateToState( "default", 0 ) + f27_arg0:setText( f27_local1 ) + end + return false + end + }, + children = { + { + type = "UIImage", + id = "sns_value_bar_old_cost_strikethrough_id", + states = { + default = CoD.ColorizeState( Colors.secondary_text_color, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 9, + height = 2, + left = -4, + right = 4 + } ) + } + } + } + } + } + return f25_local0 +end + +function sns_value_bar() + return { + type = "UIElement", + properties = { + value_text = "", + top = 0 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = MBh.Property( "top" ), + height = 26, + left = 0, + right = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + show_article_purchaseinfo = function ( f29_arg0, f29_arg1 ) + local f29_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f29_arg0 ) + if CrossGameHackVisual( f29_local0.category ) then + f29_arg0:animateToState( "hidden" ) + else + f29_arg0:animateToState( "default" ) + end + end + + }, + childrenFeeder = sns_value_bar_children_feeder + } +end + +LUI.SocialFeedTicker = {} +LUI.SocialFeedTicker = InheritFrom( LUI.UIElement ) +LUI.SocialFeedTicker.new = function ( f30_arg0, f30_arg1, f30_arg2 ) + if not Sns.SocialFeedEnabled() then + return LUI.UIElement.new() + end + local f30_local0 = 0.75 + local f30_local1 = 95 + local self = LUI.UIElement.new( CoD.CreateState( 0, -124, 0, -54, CoD.AnchorTypes.BottomLeftRight ) ) + self.id = "social_feed_ticker_id" + self:registerEventHandler( "change_ticker_story", Sns.ChangeTickerStory ) + local f30_local3 = CoD.CreateState( 0, 0, 20, 0, CoD.AnchorTypes.TopBottomLeft ) + f30_local3.material = RegisterMaterial( "box_feed_content_lt" ) + f30_local3.alpha = f30_local0 + local f30_local4 = LUI.UIImage.new( f30_local3 ) + f30_local4.id = "ticker_left_cap_id" + self:addElement( f30_local4 ) + f30_local3 = CoD.CreateState( 20, 0, -20, 0, CoD.AnchorTypes.All ) + f30_local3.material = RegisterMaterial( "box_feed_content_mid" ) + f30_local3.alpha = f30_local0 + local f30_local5 = LUI.UIImage.new( f30_local3 ) + f30_local5.id = "ticker_mid_bg_id" + self:addElement( f30_local5 ) + f30_local3 = CoD.CreateState( -20, 0, 0, 0, CoD.AnchorTypes.TopBottomRight ) + f30_local3.material = RegisterMaterial( "box_feed_content_rt" ) + f30_local3.alpha = f30_local0 + local f30_local6 = LUI.UIImage.new( f30_local3 ) + f30_local6.id = "ticker_right_cap_id" + self:addElement( f30_local6 ) + local f30_local7 = LUI.UIButton.new( CoD.CreateState( 5, 26, -5, -21, CoD.AnchorTypes.All ) ) + f30_local7.id = "ticker_stencil_id" + f30_local7:setUseStencil( true ) + f30_local7.requireFocusType = FocusType.MouseOver + f30_local7:registerEventHandler( "button_action", function ( element, event ) + Sns.OpenSocialFeed( element, event.controller, f30_arg1 and f30_arg1.isLobbyTicker or false ) + end ) + self:addElement( f30_local7 ) + local f30_local8 = 30 + local f30_local9 = 20 + local f30_local10 = f30_local1 + if SocialFeed.HasUnreadArticles( Engine.GetControllerForLocalClient( 0 ) ) then + f30_local3 = CoD.CreateState( f30_local1 - 30, -12, f30_local1 - 6, 12, CoD.AnchorTypes.Left ) + f30_local3.material = RegisterMaterial( "icon_new" ) + local f30_local11 = LUI.UIImage.new( f30_local3 ) + f30_local11.id = "ticker_new_icon_id" + f30_local7:addElement( f30_local11 ) + end + if CoD.UsingController() then + f30_local10 = f30_local10 + f30_local8 + 7 + f30_local3 = CoD.CreateState( f30_local1, -f30_local8 / 2, f30_local1 + f30_local8, f30_local8 / 2, CoD.AnchorTypes.Left ) + f30_local3.font = CoD.TextSettings.NormalFont.Font + f30_local3.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.white, f30_local3 ) + local f30_local11 = LUI.UIText.new( f30_local3 ) + f30_local11.id = "ticker_button_icon_id" + f30_local11:setText( Engine.Localize( "@LUA_MENU_PAD_LEFT_SHOULDER_BUTTON" ) ) + f30_local7:addElement( f30_local11 ) + end + local f30_local11 = CoD.TextSettings.NormalFont.Height / 2 + f30_local3 = CoD.CreateState( f30_local10, -f30_local11, f30_local10, f30_local11, CoD.AnchorTypes.LeftRight ) + f30_local3.font = CoD.TextSettings.NormalFont.Font + f30_local3.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.white, f30_local3 ) + self.tickerText = LUI.UIText.new( f30_local3 ) + self.tickerText.id = "ticker_text_id" + f30_local7:addElement( self.tickerText ) + local f30_local12 = Sns.GetTickerHeader( Sns.TickerCategory, Sns.TickerIndex ) + if f30_local12 == "" then + f30_local12 = Engine.Localize( "@SOCIALFEED_TICKER_DEFAULT_TEXT" ) + end + self.tickerText:setText( f30_local12 ) + f30_local3 = CoD.CreateState( f30_local10, -f30_local11 + f30_local9, f30_local10, f30_local11 + f30_local9, CoD.AnchorTypes.LeftRight ) + f30_local3.font = CoD.TextSettings.NormalFont.Font + f30_local3.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.white, f30_local3 ) + self.nextText = LUI.UIText.new( f30_local3 ) + self.nextText.id = "ticker_next_text_id" + f30_local7:addElement( self.nextText ) + f30_local3 = CoD.CreateState( f30_local10, -f30_local11 - f30_local9, f30_local10, f30_local11 - f30_local9, CoD.AnchorTypes.LeftRight ) + f30_local3.font = CoD.TextSettings.NormalFont.Font + f30_local3.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.white, f30_local3 ) + self.tickerText:registerAnimationState( "transition_to_next", f30_local3 ) + f30_local3 = CoD.CreateState( f30_local10, -f30_local11, f30_local10, f30_local11, CoD.AnchorTypes.LeftRight ) + f30_local3.font = CoD.TextSettings.NormalFont.Font + f30_local3.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.white, f30_local3 ) + self.nextText:registerAnimationState( "transition_to_next", f30_local3 ) + self.nextText:registerEventHandler( "transition_complete_transition_to_next", function ( element, event ) + local f32_local0 = element:getParent() + Sns.TickerScrollEnded( f32_local0:getParent(), event ) + end ) + local f30_local13 = LUI.UITimer.new( Sns.TickerUpdateInterval, "change_ticker_story", "social_feed_ticker", false, self ) + f30_local13.id = "ticker_timer_id" + self:addElement( f30_local13 ) + if CoD.UsingController() then + local f30_local14 = LUI.UIBindButton.new() + f30_local14.id = "ticker_bind_button_id" + f30_local14:registerEventHandler( "button_shoulderl", function ( element, event ) + Sns.OpenSocialFeed( element, event.controller, f30_arg1 and f30_arg1.isLobbyTicker or false ) + end ) + self:addElement( f30_local14 ) + end + return self +end + +function popup_social_to_store_lobby_confirm() + return { + type = "generic_yesno_popup", + id = "popup_social_leave_lobby_confirm", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@SOCIALFEED_TO_STORE_WARNING" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f35_arg0, f35_arg1 ) + LUI.mp_menus.mpLobbyWidgets.leaveLobbyAndPartyYesActionWithExitLobby( f35_arg0, f35_arg1 ) + LUI.FlowManager.RequestRestoreMenu( f35_arg0, "menu_xboxlive" ) + Sns.OpenStoreMenu( f35_arg1.controller, "social_feed", false, f35_arg0.properties.callback_params.itemID ) + end + + } + } +end + +LUI.MenuBuilder.registerType( "SocialFeedTicker", LUI.SocialFeedTicker.new ) +LUI.MenuBuilder.registerDef( "sns_category_window", sns_category_window ) +LUI.MenuBuilder.registerDef( "sns_thumbnail", sns_thumbnail ) +LUI.MenuBuilder.registerDef( "sns_thumbnail_window", sns_thumbnail_window ) +LUI.MenuBuilder.registerDef( "sns_article", sns_article ) +LUI.MenuBuilder.registerDef( "sns_article_purchaseinfo_widget", sns_article_purchaseinfo_widget ) +LUI.MenuBuilder.registerDef( "sns_article_countdown_widget", sns_article_countdown_widget ) +LUI.MenuBuilder.registerDef( "sns_article_detail_widget", sns_article_detail_widget ) +LUI.MenuBuilder.registerDef( "sns_fetching_category_spinner", sns_fetching_category_spinner ) +LUI.MenuBuilder.registerDef( "sns_value_bar", sns_value_bar ) +LUI.MenuBuilder.registerDef( "popup_social_to_store_lobby_confirm", popup_social_to_store_lobby_confirm ) diff --git a/lui/mp_menus/snsutils.dec.lua b/lui/mp_menus/snsutils.dec.lua new file mode 100644 index 0000000..6657924 --- /dev/null +++ b/lui/mp_menus/snsutils.dec.lua @@ -0,0 +1,333 @@ +NewsType = { + News = 0, + Item = 1 +} +FeedCategory = { + MOTD = 0, + News = 1, + Clans = 2, + Squads = 3, + Social = 4 +} +FeedSubCategory = { + { + News = 0, + Event = 1, + NewItems = 2, + Sale = 3 + }, + { + GettingStarted = 0, + Invite = 1, + ClanWarUpdate = 2 + }, + { + Default = 0 + }, + { + AverageScore = 0, + GamesPlayed = 1, + TimePlayed = 2, + Wins = 3, + WinStreak = 4, + KDRatio = 5, + Kills = 6, + KillStreak = 7 + } +} +StoreCategory = { + SeasonPass = 0, + MapPacks = 1, + Personalization = 2, + Customization = 3, + ExtraSlots = 4, + AnnouncerVoices = 5, + AdditionalItems = 6, + Avatar = 7, + Crossgame = 8 +} +Sns = { + Dims = { + Thumbnail = { + width = 160, + height = 80 + }, + DefaultArticleImage = { + width = 320, + height = 320, + maxWidth = 370, + maxHeight = 340 + } + }, + MaxVisibleArticles = 4, + MaxPrefetchArticles = 4, + HListOffset = 10, + HListSpacing = 25, + TickerCategory = FeedCategory.News, + TickerIndex = 0, + TickerScrollSpeed = 1000, + TickerUpdateInterval = 12000 +} +function CrossGameHackVisual( f1_arg0 ) + local f1_local0 + if not Engine.IsXbox360() and not Engine.IsXB3() and not Engine.IsPS3() then + f1_local0 = Engine.IsPS4() + if f1_local0 then + + else + return f1_local0 + end + end + f1_local0 = f1_arg0 == StoreCategory.Crossgame +end + +function CrossGameHackData( f2_arg0 ) + local f2_local0 + if not Engine.IsXbox360() and not Engine.IsXB3() then + f2_local0 = Engine.IsPS4() + if f2_local0 then + + else + return f2_local0 + end + end + f2_local0 = f2_arg0 == StoreCategory.Crossgame +end + +Sns.UpdateScopedArticleInfo = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg1 or LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + local f3_local1 = CrossGameHackData( f3_local0.category ) + local f3_local2, f3_local3 = nil + if f3_local1 then + f3_local2 = { + title = Engine.Localize( "LUA_MENU_STORE_CROSS_GAME" ), + details = Engine.Localize( "LUA_MENU_STORE_CROSS_GAME_DESC" ), + image = "", + thumbName = "", + cost = -1, + sale = 0 + } + else + f3_local2 = Store.GetCompleteItemInfoByIndex( f3_local0.category, f3_local0.articleIndex ) + f3_local3 = Store.IsItemPurchasedByIndex( f3_local0.category, f3_local0.articleIndex ) + DebugPrint( "Proper image info " .. tostring( f3_local2.image ) .. " " .. tostring( f3_local2.thumbName ) ) + end + local f3_local4 = { + itemId = f3_local0.articleId + } + local f3_local5 = f3_local2.title + if not f3_local5 then + f3_local5 = "Content " .. itemId .. " has no title" + end + f3_local4.title = f3_local5 + f3_local5 = f3_local2.details + if not f3_local5 then + f3_local5 = "Content " .. itemId .. " has no text" + end + f3_local4.details = f3_local5 + f3_local4.image = f3_local2.image + f3_local4.thumbName = f3_local2.thumbName + f3_local4.cost = f3_local2.cost + f3_local4.sale = f3_local2.sale + f3_local4.endTime = 0 + f3_local4.purchased = f3_local3 + f3_local0.articleInfo = f3_local4 + f3_local0.articleInfo.details = f3_local0.articleInfo.details .. "\n" +end + +Sns.GetScopedArticleInfo = function ( f4_arg0, f4_arg1 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + if f4_arg1 and f4_local0.articleInfo then + return f4_local0.articleInfo[f4_arg1] + else + return f4_local0.articleInfo + end +end + +Sns.IsRedeemCodeDisabled = function () + return Engine.GetDvarInt( "ui_disableTokenRedemption" ) == 1 +end + +Sns.IsStoreDisabled = function () + return Engine.GetDvarInt( "ui_disableInGameStore" ) == 1 +end + +Sns.SetContextualMenuLocation = function ( f7_arg0 ) + Engine.SetStoreEnterTimestamp() + if f7_arg0 then + Engine.SetDvarString( "ui_contextualMenuLocation", f7_arg0 ) + else + Engine.SetDvarString( "ui_contextualMenuLocation", "store" ) + end +end + +Sns.OpenStoreLinkConfirmPopup = function ( f8_arg0, f8_arg1 ) + local f8_local0 = { + callback_params = { + dlcName = f8_arg1 + } + } + if Engine.IsXbox360() and Engine.GetCurrentLanguage() ~= 5 and Engine.GetCurrentLanguage() ~= 10 then + Sns.SetContextualMenuLocation( "cac" ) + Store.ShowSystemOffer( f8_arg0, f8_arg1 ) + else + LUI.FlowManager.RequestPopupMenu( self, "goto_store", true, f8_arg0, false, f8_local0 ) + end +end + +Sns.OpenStoreMenu = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3 ) + local f9_local0 = assert + local f9_local1 = Engine.GetDvarBool( "onlinegame" ) + if not f9_local1 then + f9_local1 = Engine.GetDvarBool( "ui_onlineRequired" ) + end + f9_local0( f9_local1 ) + if Engine.IsConsoleGame() then + if Sns.IsStoreDisabled() then + LUI.FlowManager.RequestPopupMenu( self, "store_disabled_error", false, f9_arg0, false ) + elseif Engine.UserIsGuest( f9_arg0 ) then + LUI.FlowManager.RequestPopupMenu( self, "store_noguests_error", false, f9_arg0, false ) + elseif Engine.IsPS3() and f9_arg0 ~= 0 then + LUI.FlowManager.RequestPopupMenu( self, "mp_wrong_controller_popup", false, f9_arg0, false ) + else + Store.ClearContentCache( f9_arg0 ) + Sns.SetContextualMenuLocation( f9_arg1 ) + Engine.ExecNow( "incnosplitscreencontrol menu_STORE" ) + f9_local0 = { + initialDlcName = f9_arg3 + } + if Engine.GetDvarInt( "igs_sosp" ) == 1 or Engine.IsXbox360() == false then + LUI.FlowManager.RequestAddMenu( self, "store_main", true, f9_arg0, f9_arg2, f9_local0 ) + else + LUI.FlowManager.RequestPopupMenu( self, "finding_player_purchases", true, f9_arg0, false, { + storeData = f9_local0 + } ) + end + return true + end + else + Engine.Exec( "xshowmarketplace" ) + end + return false +end + +Sns.GetTickerHeader = function ( f10_arg0, f10_arg1 ) + if f10_arg0 == FeedCategory.Squads then + local f10_local0 = SvS.GetSquadReportData( Engine.GetControllerForLocalClient( 0 ), f10_arg1 ) + return Engine.Localize( "SOCIALFEED_SQUAD_HEADER", Engine.MarkLocalized( f10_local0.enemyName ) ) + else + return SocialFeed.GetArticleHeader( f10_arg0, f10_arg1 ) + end +end + +function RefreshThumbnails( f11_arg0, f11_arg1 ) + f11_arg0:closeChildren() + f11_arg0:clearSavedState() + f11_arg0:processEvent( { + name = "menu_refresh" + } ) + if LUI.FlowManager.IsMenuTopmost( Engine.GetLuiRoot(), "store_main" ) then + f11_arg0:processEvent( { + name = "gain_focus" + } ) + end + f11_arg0:processEvent( { + name = "update_sale_banners" + } ) + f11_arg0:processEvent( { + name = "update_purchase_checkboxes" + } ) + f11_arg0:processEvent( { + name = "update_hack_banner" + } ) +end + +Sns.OpenStore = function ( f12_arg0, f12_arg1 ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + LUI.FlowManager.RequestAddMenu( f12_arg0, "store_main", true, f12_local0.exclusiveController, false, { + reqiestedItem = f12_arg1 + } ) +end + +Sns.OpenSocialFeed = function ( f13_arg0, f13_arg1, f13_arg2 ) + if Engine.IsUserAGuest( f13_arg1 ) then + LUI.FlowManager.RequestPopupMenu( f13_arg0, "mp_no_guest_popup", false, f13_arg1, false ) + else + Squad.UpdateReportPlayerCardCache( f13_arg1 ) + LUI.FlowManager.RequestAddMenu( f13_arg0, "social_feed_main", true, f13_arg1, false, { + fromLobby = f13_arg2 or false + } ) + end +end + +Sns.SocialFeedEnabled = function () + local f14_local0 = false + if Engine.GetDvarInt( "social_feed_motd_active" ) == 1 then + f14_local0 = true + elseif Engine.GetDvarInt( "social_feed_news_active" ) == 1 then + f14_local0 = true + elseif Engine.GetDvarInt( "social_feed_clans_active" ) == 1 then + f14_local0 = true + elseif Engine.GetDvarInt( "social_feed_squads_active" ) == 1 then + f14_local0 = true + elseif Engine.GetDvarInt( "social_feed_social_active" ) == 1 then + f14_local0 = true + end + return f14_local0 +end + +Sns.ChangeTickerStory = function ( f15_arg0, f15_arg1 ) + local f15_local0 = Engine.GetControllerForLocalClient( 0 ) + local f15_local1 = SocialFeed.GetArticleCount( f15_local0, Sns.TickerCategory ) + Sns.TickerIndex = Sns.TickerIndex + 1 + if f15_local1 <= Sns.TickerIndex then + local f15_local2 = Sns.TickerCategory + repeat + f15_local2 = f15_local2 + 1 + if f15_local2 > FeedCategory.Social then + f15_local2 = FeedCategory.News + end + if SocialFeed.GetArticleCount( f15_local0, f15_local2 ) > 0 then + Sns.TickerCategory = f15_local2 + break + else + + end + until f15_local2 == Sns.TickerCategory + Sns.TickerIndex = 0 + end + if f15_arg0.tickerText and f15_local1 > Sns.TickerIndex then + f15_arg0.nextText:setText( Sns.GetTickerHeader( Sns.TickerCategory, Sns.TickerIndex ) ) + f15_arg0.tickerText:animateToState( "transition_to_next", Sns.TickerScrollSpeed ) + f15_arg0.nextText:animateToState( "transition_to_next", Sns.TickerScrollSpeed ) + end +end + +Sns.TickerScrollEnded = function ( f16_arg0, f16_arg1 ) + f16_arg0.tickerText:setText( Sns.GetTickerHeader( Sns.TickerCategory, Sns.TickerIndex ) ) + f16_arg0.tickerText:animateToState( "default", 0 ) + f16_arg0.nextText:animateToState( "default", 0 ) +end + +Sns.GetArticleImageDims = function ( f17_arg0, f17_arg1 ) + local f17_local0 = Sns.Dims.DefaultArticleImage.width + local f17_local1 = Sns.Dims.DefaultArticleImage.height + if f17_arg0 then + f17_local0 = math.min( f17_arg0, Sns.Dims.DefaultArticleImage.maxWidth ) + end + if f17_arg1 then + f17_local1 = math.min( f17_arg1, Sns.Dims.DefaultArticleImage.maxHeight ) + end + return f17_local0, f17_local1 +end + +Sns.IsSeasonPassAccessible = function () + local f18_local0 + if Engine.GetCurrentLanguage() == 5 or Engine.GetCurrentLanguage() == 10 then + f18_local0 = false + else + f18_local0 = true + end + return f18_local0 +end + diff --git a/lui/mp_menus/socialfeed.dec.lua b/lui/mp_menus/socialfeed.dec.lua new file mode 100644 index 0000000..b5d4351 --- /dev/null +++ b/lui/mp_menus/socialfeed.dec.lua @@ -0,0 +1,1337 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( "Registering " .. _NAME ) +SOCIAL_TOP_PADDING = 20 +ArticleLayout = { + Default = 0, + List = 1, + SocialCompare = 2, + SquadReport = 3 +} +function GetLayoutType( f1_arg0, f1_arg1, f1_arg2 ) + local f1_local0 = ArticleLayout.Default + if f1_arg0 == FeedCategory.Clans and f1_arg1 == 0 then + f1_local0 = ArticleLayout.List + end + if f1_arg0 == FeedCategory.Social and not f1_arg2 then + f1_local0 = ArticleLayout.SocialCompare + end + if f1_arg0 == FeedCategory.Squads and not f1_arg2 then + f1_local0 = ArticleLayout.SquadReport + end + return f1_local0 +end + +function GetDefaultArticleInfo( f2_arg0 ) + local f2_local0 = {} + if f2_arg0 == FeedCategory.News then + f2_local0.header = Engine.Localize( "@SOCIALFEED_DEFAULT_NEWS_HEADER" ) + f2_local0.body = Engine.Localize( "@SOCIALFEED_DEFAULT_NEWS_BODY" ) + elseif f2_arg0 == FeedCategory.Clans then + f2_local0.header = Engine.Localize( "@SOCIALFEED_DEFAULT_CLAN_HEADER" ) + f2_local0.listHeader = Engine.Localize( "@SOCIALFEED_DEFAULT_CLAN_BODY" ) + f2_local0.listFeeder = ClanBenefitsFeeder + elseif f2_arg0 == FeedCategory.Squads then + f2_local0.header = Engine.Localize( "@LUA_MENU_NO_REPORTS_TITLE" ) + f2_local0.body = Engine.Localize( "@LUA_MENU_NO_REPORTS_DESC" ) + elseif f2_arg0 == FeedCategory.Social then + f2_local0.header = Engine.Localize( "@SOCIALFEED_DEFAULT_SOCIAL_HEADER" ) + f2_local0.body = Engine.Localize( "@SOCIALFEED_DEFAULT_SOCIAL_BODY" ) + end + f2_local0.image = GetDefaultArticleImage( f2_arg0 ) + return f2_local0 +end + +function GetDefaultArticleImage( f3_arg0 ) + local f3_local0 = "" + if f3_arg0 == FeedCategory.News then + f3_local0 = "img_sf_generic_news1" + elseif f3_arg0 == FeedCategory.Squads then + f3_local0 = "img_sf_generic_news4" + end + return f3_local0 +end + +function GetActionTextForType( f4_arg0, f4_arg1 ) + local f4_local0 = "" + if f4_arg0 == FeedCategory.News then + if f4_arg1 == NewsType.Item then + f4_local0 = Engine.Localize( "@LUA_MENU_STORE_CAPS" ) + end + elseif f4_arg0 == FeedCategory.MOTD and Engine.GetDvarInt( "motd_store_link" ) == 1 then + f4_local0 = Engine.Localize( "@LUA_MENU_STORE_CAPS" ) + end + return f4_local0 +end + +function GetArticleInfo( f5_arg0, f5_arg1, f5_arg2 ) + local f5_local0 = nil + if SocialFeed.GetArticleCount( f5_arg0, f5_arg1 ) < 1 then + f5_local0 = GetDefaultArticleInfo( f5_arg1 ) + else + f5_local0 = SocialFeed.GetArticleInfo( f5_arg0, f5_arg1, f5_arg2 ) + end + f5_local0.index = f5_arg2 + f5_local0.category = f5_arg1 + return f5_local0 +end + +function OnCreate( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg1.controller + f6_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + local f6_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f6_arg0 ) + f6_arg0:processEvent( { + name = "update_header_text", + string = Engine.Localize( "@SOCIALFEED_TITLE_CAPS", Engine.MarkLocalized( Engine.GetUsernameByController( f6_local0 ) ) ), + dispatchChildren = true + } ) + f6_local1.forcedArticleIndex = Sns.TickerIndex +end + +function OnStoreButtonPressed( f7_arg0, f7_arg1, f7_arg2 ) + if f7_arg1 then + LUI.FlowManager.RequestPopupMenu( self, "popup_social_to_store_lobby_confirm", true, f7_arg0, false, { + callback_params = { + itemID = f7_arg2 + } + } ) + else + Sns.OpenStoreMenu( f7_arg0, "social_feed", true, f7_arg2 ) + end +end + +function OnActionPressed( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + if f8_local0.category == FeedCategory.News then + if SocialFeed.GetNewsType( f8_local0.articleIndex ) == NewsType.Item then + OnStoreButtonPressed( f8_arg1.controller, f8_local0.fromLobby, SocialFeed.GetNewsItemID( f8_local0.articleIndex ) ) + end + elseif f8_local0.category == FeedCategory.MOTD and Engine.GetDvarInt( "motd_store_link" ) == 1 then + OnStoreButtonPressed( f8_arg1.controller, f8_local0.fromLobby ) + end +end + +function ChangeCategory( f9_arg0, f9_arg1 ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 ) + f9_local0.category = f9_arg0.properties.article_category + f9_local0.articleIndex = 0 + if f9_local0.forcedArticleIndex then + f9_local0.articleIndex = f9_local0.forcedArticleIndex + f9_local0.forcedArticleIndex = nil + end + f9_arg0:dispatchEventToRoot( { + name = "refresh_thumbnails", + immediate = true + } ) + f9_arg0:dispatchEventToRoot( { + name = "change_article", + immediate = true + } ) +end + +function ChangeArticle( f10_arg0, f10_arg1 ) + local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 ) + if f10_arg1 and f10_arg1.delta then + f10_local0.articleIndex = f10_local0.articleIndex + f10_arg1.delta + end + local f10_local1 = SocialFeed.GetArticleCount( f10_local0.exclusiveControllerIndex, f10_local0.category ) + f10_local0.articleIndex = math.min( f10_local1 - 1, f10_local0.articleIndex ) + f10_local0.articleIndex = math.max( 0, f10_local0.articleIndex ) + f10_arg0:processEvent( { + name = "refresh_article", + layoutType = GetLayoutType( f10_local0.category, f10_local0.articleIndex, f10_local1 < 1 ) + } ) + f10_arg0:processEvent( { + name = "update_thumbnail_arrows", + left_visible = f10_local0.articleIndex > 0, + right_visible = f10_local0.articleIndex < f10_local1 - 1 + } ) + SocialFeed.SetArticleRead( f10_local0.exclusiveControllerIndex, f10_local0.category, f10_local0.articleIndex ) + f10_arg0:processEvent( { + name = "update_unread_count", + category = f10_local0.category, + dispatchChildren = true + } ) + f10_arg0:processEvent( { + name = "update_thumbnail_states" + } ) +end + +function RefreshArticle( f11_arg0, f11_arg1 ) + if f11_arg1.layoutType ~= f11_arg0.layoutType then + f11_arg0:animateToState( "hidden", 0 ) + return + end + f11_arg0:animateToState( "default", 0 ) + local f11_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f11_arg0 ) + local f11_local1 = f11_local0.category + local f11_local2 = f11_local0.articleIndex + local f11_local3 = SocialFeed.GetArticleCount( f11_local0.exclusiveControllerIndex, f11_local1 ) < 1 + local f11_local4 = GetArticleInfo( f11_local0.exclusiveControllerIndex, f11_local1, f11_local2 ) + if f11_local1 == FeedCategory.Social and not f11_local3 then + f11_local4.header = Engine.Localize( SocialArticleStrings.Header[f11_local4.subCategory + 1] ) + f11_local4.summary = Sns.GetSocialArticleBodyString( f11_local4 ) + end + if f11_local1 == FeedCategory.Squads and not f11_local3 then + f11_local4.reportData = SvS.GetSquadReportData( f11_local0.exclusiveControllerIndex, f11_local2 ) + f11_local4.header = Engine.Localize( "SOCIALFEED_SQUAD_HEADER", Engine.MarkLocalized( f11_local4.reportData.enemyName ) ) + f11_local4.image = SvS.GetBasePreviewImageLarge( f11_local4.reportData.mapName ) + end + if not f11_local3 then + f11_local4.actionText = GetActionTextForType( f11_local1, f11_local4.subCategory ) + end + f11_arg0:dispatchEventToMenuRoot( { + name = "update_title", + title_text = f11_local4.header + } ) + f11_arg0:dispatchEventToChildren( { + name = "update_article_details", + articleInfo = f11_local4, + immediate = true, + dispatchChildren = true + } ) +end + +function RefreshThumbnails( f12_arg0, f12_arg1 ) + f12_arg0:closeChildren() + f12_arg0:clearSavedState() + f12_arg0:processEvent( { + name = "menu_refresh" + } ) + f12_arg0:processEvent( { + name = "gain_focus" + } ) +end + +function UpdateActionButton( f13_arg0, f13_arg1 ) + local f13_local0 = f13_arg1.articleInfo.actionText + local f13_local1 = 32 + local f13_local2 = 20 + local f13_local3 = 160 + local f13_local4 = 40 + if not f13_local0 or f13_local0 == "" then + f13_arg0:animateToState( "hidden", 0 ) + return + end + local f13_local5, f13_local6 = Sns.GetArticleImageDims( f13_arg1.articleInfo.imageWidth, f13_arg1.articleInfo.imageHeight ) + local f13_local7 = f13_local6 + SOCIAL_TOP_PADDING + 30 + local f13_local8 = CoD.CreateState( 0, f13_local7, 0, f13_local7 + CoD.TextSettings.BoldFont.Height + f13_local2, CoD.AnchorTypes.TopLeft ) + f13_local8.alpha = 1 + local f13_local9, f13_local10, f13_local11, f13_local12 = GetTextDimensions( f13_arg1.articleInfo.actionText, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f13_local13 = f13_local11 - f13_local9 + f13_local1 + f13_local2 + local f13_local14 = f13_local13 / 2 + f13_local8.left = f13_local4 + (f13_local3 - f13_local13) / 2 + f13_local8.right = f13_local8.left + f13_local13 + f13_arg0:registerAnimationState( "default", f13_local8 ) + f13_arg0:animateToState( "default", 0 ) + f13_arg0.hList:closeChildren() + local f13_local15 = {} + if 1 == Engine.IsGamepadEnabled() then + local f13_local16 = CoD.CreateState( 0, -f13_local1 / 2, f13_local1, f13_local1 / 2, CoD.AnchorTypes.Left ) + f13_local16.font = CoD.TextSettings.NormalFont.Font + f13_local16.alignment = LUI.Alignment.Left + local self = LUI.UIText.new( f13_local16 ) + self:setText( Engine.Localize( ButtonMap.button_action.string ) ) + f13_arg0.hList:addElement( self ) + end + f13_local15 = CoD.CreateState( 0, -CoD.TextSettings.NormalFont.Height / 2, f13_local11, CoD.TextSettings.NormalFont.Height / 2, CoD.AnchorTypes.Left ) + CoD.ColorizeState( Colors.white, f13_local15 ) + f13_local15.font = CoD.TextSettings.NormalFont.Font + f13_local15.alignment = LUI.Alignment.Left + local f13_local16 = LUI.UIText.new( f13_local15 ) + CoD.ColorizeState( Colors.generic_button_text_focus_color, f13_local15 ) + f13_local16:registerAnimationState( "focus", f13_local15 ) + f13_local16:setText( f13_arg1.articleInfo.actionText ) + f13_arg0.hList:addElement( f13_local16 ) + f13_local16:registerEventHandler( "button_over", function ( element, event ) + local f14_local0 = element:getParent() + if f14_local0:isInFocus() then + element:animateToState( "focus", 0 ) + end + end ) + f13_local16:registerEventHandler( "button_up", function ( element, event ) + element:animateToState( "default", 0 ) + end ) +end + +function SocialCategoryFeeder( f16_arg0 ) + local f16_local0 = f16_arg0.exclusiveController + local f16_local1 = {} + if not SocialFeed.HasIOTD() then + SocialFeed.DownloadIOTD() + end + if Engine.GetDvarInt( "social_feed_motd_active" ) == 1 then + f16_local1[#f16_local1 + 1] = { + type = "socialfeed_category_button", + id = "category_motd_id", + listDefaultFocus = Sns.TickerCategory == FeedCategory.MOTD, + properties = { + button_text = Engine.Localize( "@SOCIALFEED_CATEGORY_MOTD" ), + button_over_func = ChangeCategory, + button_action_func = OnActionPressed, + article_category = FeedCategory.MOTD, + category_icon = RegisterMaterial( "icon_social_feed_motd" ) + } + } + end + if Engine.GetDvarInt( "social_feed_news_active" ) == 1 then + f16_local1[#f16_local1 + 1] = { + type = "socialfeed_category_button", + id = "category_news_id", + listDefaultFocus = Sns.TickerCategory == FeedCategory.News, + properties = { + button_text = Engine.Localize( "@SOCIALFEED_CATEGORY_NEWS" ), + button_over_func = ChangeCategory, + button_action_func = OnActionPressed, + article_category = FeedCategory.News, + info_text = SocialFeed.GetUnreadArticleCount( f16_local0, FeedCategory.News ), + category_icon = RegisterMaterial( "icon_social_feed_news" ) + } + } + end + if Engine.GetDvarInt( "social_feed_clans_active" ) == 1 and not Engine.IsAliensMode() then + f16_local1[#f16_local1 + 1] = { + type = "socialfeed_category_button", + id = "category_clans_id", + listDefaultFocus = Sns.TickerCategory == FeedCategory.Clans, + properties = { + button_text = Engine.Localize( "@SOCIALFEED_CATEGORY_CLANS" ), + button_over_func = ChangeCategory, + button_action_func = OnActionPressed, + article_category = FeedCategory.Clans, + info_text = SocialFeed.GetUnreadArticleCount( f16_local0, FeedCategory.Clans ), + category_icon = RegisterMaterial( "icon_social_feed_clans" ) + } + } + end + if Engine.GetDvarInt( "social_feed_squads_active" ) == 1 and not Engine.IsAliensMode() then + f16_local1[#f16_local1 + 1] = { + type = "socialfeed_category_button", + id = "category_squad_id", + listDefaultFocus = Sns.TickerCategory == FeedCategory.Squads, + properties = { + button_text = Engine.Localize( "@SOCIALFEED_CATEGORY_SQUADS" ), + button_over_func = ChangeCategory, + button_action_func = OnActionPressed, + article_category = FeedCategory.Squads, + info_text = SocialFeed.GetUnreadArticleCount( f16_local0, FeedCategory.Squads ), + category_icon = RegisterMaterial( "icon_social_feed_squads" ) + } + } + end + if Engine.GetDvarInt( "social_feed_social_active" ) == 1 then + f16_local1[#f16_local1 + 1] = { + type = "socialfeed_category_button", + id = "category_social_id", + listDefaultFocus = Sns.TickerCategory == FeedCategory.Social, + properties = { + button_text = Engine.Localize( "@SOCIALFEED_CATEGORY_SOCIAL" ), + button_over_func = ChangeCategory, + button_action_func = OnActionPressed, + article_category = FeedCategory.Social, + info_text = SocialFeed.GetUnreadArticleCount( f16_local0, FeedCategory.Social ), + category_icon = RegisterMaterial( "icon_social_feed_social" ) + } + } + end + return f16_local1 +end + +function ThumbnailFeeder( f17_arg0 ) + local f17_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "social_feed_main" ) + local f17_local1 = f17_local0.category + if not f17_local1 then + f17_local1 = FeedCategory.News + end + local f17_local2 = f17_local0.articleIndex or 0 + local f17_local3 = f17_arg0.exclusiveController + local f17_local4 = {} + local f17_local5 = 12 + local f17_local6 = SocialFeed.GetArticleCount( f17_local3, f17_local1 ) + if f17_local6 < 1 then + f17_local6 = 1 + end + for f17_local7 = 0, f17_local6 - 1, 1 do + local f17_local10 = f17_local7 + f17_local4[#f17_local4 + 1] = { + type = "UIImage", + id = "thumbnail_" .. f17_local10, + listDefaultFocus = f17_local2 == f17_local10, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = f17_local5, + top = 0, + bottom = f17_local5, + material = RegisterMaterial( "widg_circle_empty" ) + }, + focused = { + material = RegisterMaterial( "widg_circle_fill" ) + } + }, + handlers = { + update_thumbnail_states = function ( f18_arg0, f18_arg1 ) + if f17_local0.articleIndex == f17_local10 then + f18_arg0:animateToState( "focused", 0 ) + else + f18_arg0:animateToState( "default", 0 ) + end + end + } + } + end + return f17_local4 +end + +function ClanBenefitsFeeder( f19_arg0 ) + local f19_local0 = {} + local f19_local1 = { + "-Member count is still 100", + "-25 Clan levels", + "-Gain Clan XP(CXP) while playing with a clan mate in multiplayer", + "-Earn CXP while playing in the clan v clan playlist", + "-Each clan levels gets your clan cool entitlements. Camos, backgrounds, patches and much more", + "-Earn CXP for winning a clan war", + "-View your clans progress in your Clan Profile", + "-Download the mobile app for more advanced options" + } + for f19_local2 = 1, #f19_local1, 1 do + local f19_local5 = nil + f19_local0[#f19_local0 + 1] = { + type = "UIText", + id = "clan_benefit_" .. f19_local2, + properties = { + text = f19_local1[f19_local2] + }, + states = { + default = { + leftAnchor = true, + topAnchor = true, + bottomAnchor = false, + rightAnchor = true, + left = 0, + top = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } + } + } + end + return f19_local0 +end + +function socialfeed_category_button() + return { + type = "UIGenericButton", + id = "socialfeed_category_button_id", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + substyle = GenericButtonSettings.Styles.FlatButton.SubStyles.SubMenu, + use_locking = false, + info_text = "", + article_category = FeedCategory.News, + category_icon = RegisterMaterial( "white" ), + text_padding_without_content = 45 + }, + children = { + { + type = "UIImage", + id = "socialfeed_category_button_category_image_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 4, + right = 36, + top = -16, + bottom = 16, + material = MBh.Property( "category_icon" ), + red = 1, + green = 1, + blue = 1 + }, + focus = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 4, + right = 36, + top = -16, + bottom = 16, + material = MBh.Property( "category_icon" ), + red = 0, + green = 0, + blue = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIElement", + id = "socialfeed_category_button_info_vis_control_id", + properties = { + info_text = MBh.Property( "info_text" ), + article_category = MBh.Property( "article_category" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + left = -30, + right = -2, + top = -16, + bottom = 16, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_unread_count = function ( f21_arg0, f21_arg1 ) + local f21_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f21_arg0 ) + local f21_local1 = SocialFeed.GetUnreadArticleCount( f21_local0.exclusiveControllerIndex, f21_arg0.properties.article_category ) + local f21_local2 = f21_arg0 + local f21_local3 = f21_arg0.animateToState + local f21_local4 + if f21_local1 > 0 then + f21_local4 = "default" + if not f21_local4 then + + else + f21_local3( f21_local2, f21_local4, 0 ) + end + end + f21_local4 = "hidden" + end + + }, + children = { + { + type = "UIImage", + id = "socialfeed_category_button_info_image_id", + properties = { + info_text = MBh.Property( "info_text" ), + article_category = MBh.Property( "article_category" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 1, + green = 1, + blue = 1, + material = RegisterMaterial( "icon_social_feed_notification" ) + }, + focus = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = 0, + green = 0, + blue = 0, + material = RegisterMaterial( "icon_social_feed_notification" ) + } + }, + handlers = { + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIText", + id = "socialfeed_category_button_info_text_id", + properties = { + text = MBh.Property( "info_text" ), + article_category = MBh.Property( "article_category" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -CoD.TextSettings.NormalFont.Height * 0.5, + bottom = CoD.TextSettings.NormalFont.Height * 0.5, + red = 0, + green = 0, + blue = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + }, + focus = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -CoD.TextSettings.NormalFont.Height * 0.5, + bottom = CoD.TextSettings.NormalFont.Height * 0.5, + red = 1, + green = 1, + blue = 1, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } + }, + handlers = { + update_unread_count = function ( f22_arg0, f22_arg1 ) + local f22_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f22_arg0 ) + f22_arg0:setText( SocialFeed.GetUnreadArticleCount( f22_local0.exclusiveControllerIndex, f22_arg0.properties.article_category ) ) + end + , + button_over = MBh.AnimateToState( "focus" ), + button_up = MBh.AnimateToState( "default" ) + } + } + } + } + } + } +end + +function social_feed_header_window() + return { + type = "UIElement", + id = "social_feed_header_window_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 100, + bottom = 140, + left = 400, + right = 1200 + } + }, + children = { + { + type = "UIStencil", + id = "header_window_stencil_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIHorizontalList", + id = "header_list_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 10, + right = -10, + top = 10, + bottom = -10, + spacing = 25, + alignment = LUI.Alignment.Center + } + }, + childrenFeeder = ThumbnailFeeder, + handlers = { + refresh_thumbnails = RefreshThumbnails + } + } + } + } + } + } +end + +function social_article_base() + return { + type = "UIElement", + id = "social_feed_article_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 140, + bottom = 600, + left = 400, + right = 1200 + } + }, + children = { + { + type = "generic_menu_titlebar", + id = "article_details_window_title_id", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = "", + title_bar_text_indent = 4, + title_bar_alignment = LUI.Alignment.Center + } + }, + { + type = "UIButton", + id = "header_list_left_arrow_id", + requireFocusType = FocusType.MouseOver, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 5, + bottom = 30, + left = 20, + right = 45 + } + }, + handlers = { + button_action = MBh.EmitEventToRoot( { + name = "change_article", + delta = -1, + immediate = true + } ), + update_thumbnail_arrows = function ( f25_arg0, f25_arg1 ) + f25_arg0:processEvent( { + name = f25_arg1.left_visible and "enable" or "disable" + } ) + end + + }, + children = { + { + type = "UIImage", + id = "member_select_left_arrow_image_id", + states = { + default = { + material = RegisterMaterial( "widg_margin_arrow_lt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5 + }, + over = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + button_disable = MBh.AnimateToState( "hidden" ), + button_over_disable = MBh.AnimateToState( "hidden" ) + } + } + } + }, + { + type = "UIButton", + id = "header_list_right_arrow_id", + requireFocusType = FocusType.MouseOver, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 5, + bottom = 30, + left = -35, + right = -10 + } + }, + handlers = { + button_action = MBh.EmitEventToRoot( { + name = "change_article", + delta = 1, + immediate = true + } ), + update_thumbnail_arrows = function ( f26_arg0, f26_arg1 ) + f26_arg0:processEvent( { + name = f26_arg1.right_visible and "enable" or "disable" + } ) + end + + }, + children = { + { + type = "UIImage", + id = "member_select_right_arrow_image_id", + states = { + default = { + material = RegisterMaterial( "widg_margin_arrow_rt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5 + }, + over = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + button_disable = MBh.AnimateToState( "hidden" ), + button_over_disable = MBh.AnimateToState( "hidden" ) + } + } + } + }, + { + type = "generic_menu_background_withfade", + id = "article_details_window_bg_id" + }, + { + type = "SnSDefaultArticle", + id = "sns_default_article_id" + }, + { + type = "SnSListArticle", + id = "sns_list_article_id" + }, + { + type = "SnSSquadArticle", + id = "sns_squad_article_id" + } + } + } +end + +function social_feed_main() + return { + type = "UIElement", + id = "social_feed_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OnCreate, + change_article = ChangeArticle + }, + children = { + { + type = "UIImage", + id = "social_feed_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", + properties = { + menu_title = "" + } + }, + { + type = "sns_category_window", + id = "social_feed_category_window_id", + properties = { + feeder = SocialCategoryFeeder + } + }, + { + type = "social_feed_header_window", + id = "social_feed_header_window_id" + }, + { + type = "social_article_base", + id = "social_article_base_id" + }, + { + type = "button_helper_text_main", + id = "social_feed_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu(), + button_left = MBh.EmitEventToRoot( { + name = "change_article", + delta = -1, + immediate = true + } ), + button_right = MBh.EmitEventToRoot( { + name = "change_article", + delta = 1, + immediate = true + } ) + } + } + } + } +end + +function AddDefaultLeftPane( f28_arg0 ) + local f28_local0 = 30 + local self = LUI.UIElement.new( CoD.CreateState( 1, GenericTitleBarDims.TitleBarHeight + 1, 400, 0, CoD.AnchorTypes.TopBottomLeft ) ) + self.id = "article_left_pane_id" + f28_arg0:addElement( self ) + local f28_local2 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + f28_local2.material = RegisterMaterial( "gradient_top" ) + f28_local2.alpha = 0.4 + self:addElement( LUI.UIImage.new( f28_local2 ) ) + local f28_local3 = LUI.UIElement.new( CoD.CreateState( 40, 20, -40, 340, CoD.AnchorTypes.TopLeftRight ) ) + f28_local3.id = "article_image_container_id" + self:addElement( f28_local3 ) + f28_local3:registerEventHandler( "update_article_details", function ( element, event ) + local f29_local0, f29_local1 = Sns.GetArticleImageDims( event.articleInfo.imageWidth, event.articleInfo.imageHeight ) + element:registerAnimationState( "default", CoD.CreateState( -f29_local0 / 2, SOCIAL_TOP_PADDING, f29_local0 / 2, SOCIAL_TOP_PADDING + f29_local1, CoD.AnchorTypes.Top ) ) + element:animateToState( "default", 0 ) + end ) + local f28_local4 = LUI.MenuGenerics.generic_drop_shadow( nil, { + offset_shadow = 0 + } ) + f28_local4.id = "article_image_shadow_id" + f28_local3:addElement( f28_local4 ) + f28_local2 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + CoD.ColorizeState( Swatches.GenericMenu.Border, f28_local2 ) + local f28_local5 = LUI.UIImage.new( f28_local2 ) + f28_local5.id = "article_image_border_id" + f28_local3:addElement( f28_local5 ) + local f28_local6 = LUI.UIImage.new( CoD.CreateState( 1, 1, -1, -1, CoD.AnchorTypes.All ) ) + f28_local6:registerEventHandler( "update_article_details", function ( element, event ) + if event.articleInfo.localJPEGImage then + SocialFeed.SetNewsArticleImageJPEG( event.articleInfo.index ) + element:setImage( RegisterMaterial( "news_jpeg_image" ) ) + else + element:setImage( RegisterMaterial( event.articleInfo.image ) ) + end + end ) + f28_local3:addElement( f28_local6 ) + local f28_local7 = LUI.UIText.new( CoD.CreateState( -180, 360, -40, 360 + CoD.TextSettings.BoldFont.Height, CoD.AnchorTypes.TopRight ) ) + f28_local7.id = "article_timer_header_id" + f28_local7:registerAnimationState( "hidden", { + alpha = 0 + } ) + f28_local7:registerEventHandler( "update_article_details", function ( element, event ) + if event.articleInfo.endTime and event.articleInfo.endTime > 0 then + local f31_local0, f31_local1 = Sns.GetArticleImageDims( event.articleInfo.imageWidth, event.articleInfo.imageHeight ) + local f31_local2 = f31_local1 + SOCIAL_TOP_PADDING + f28_local0 + local f31_local3 = CoD.CreateState( -180, f31_local2, -40, f31_local2 + CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.TopRight ) + f31_local3.font = CoD.TextSettings.NormalFont.Font + f31_local3.alignment = LUI.Alignment.Center + f31_local3.alpha = 1 + element:registerAnimationState( "default", f31_local3 ) + local f31_local4 = element + local f31_local5 = element.setText + local f31_local6 = event.articleInfo.timerHeader + if not f31_local6 then + f31_local6 = Engine.Localize( "@SOCIALFEED_TIME_LEFT" ) + end + f31_local5( f31_local4, f31_local6 ) + element:animateToState( "default", 0 ) + else + element:animateToState( "hidden", 0 ) + end + end ) + self:addElement( f28_local7 ) + local f28_local8 = LUI.UILongCountdown.new( 0 ) + f28_local8:animateToState( "default" ) + f28_local8:registerAnimationState( "hidden", { + alpha = 0 + } ) + f28_local8:registerEventHandler( "update_article_details", function ( element, event ) + if event.articleInfo.endTime and event.articleInfo.endTime > 0 then + local f32_local0, f32_local1 = Sns.GetArticleImageDims( event.articleInfo.imageWidth, event.articleInfo.imageHeight ) + local f32_local2 = f32_local1 + SOCIAL_TOP_PADDING + f28_local0 + 20 + local f32_local3 = CoD.CreateState( -180, f32_local2, -40, f32_local2 + CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.TopRight ) + CoD.ColorizeState( Colors.primary_text_color, f32_local3 ) + f32_local3.font = CoD.TextSettings.NormalFont.Font + f32_local3.alignment = LUI.Alignment.Center + f32_local3.alpha = 1 + element:registerAnimationState( "default", f32_local3 ) + element:setEndTime( event.articleInfo.endTime ) + element:animateToState( "default", 0 ) + else + element:animateToState( "hidden", 0 ) + end + end ) + self:addElement( f28_local8 ) + local f28_local9 = LUI.UIButton.new( CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.TopLeft ) ) + f28_local9.id = "article_action_button_id" + f28_local9:registerAnimationState( "hidden", { + alpha = 0 + } ) + f28_local9.m_requireFocusType = FocusType.MouseOver + self:addElement( f28_local9 ) + f28_local9:registerEventHandler( "update_article_details", UpdateActionButton ) + f28_local9:registerEventHandler( "button_action", OnActionPressed ) + f28_local2 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + CoD.ColorizeState( Colors.grey_2, f28_local2 ) + f28_local2.material = RegisterMaterial( "white" ) + f28_local2.alpha = 0 + local f28_local10 = LUI.UIImage.new( f28_local2 ) + CoD.ColorizeState( Colors.generic_button_content_focus_color, f28_local2 ) + f28_local2.alpha = 0.2 + f28_local10:registerAnimationState( "focus", f28_local2 ) + f28_local9:addElement( f28_local10 ) + f28_local10:registerEventHandler( "button_over", function ( element, event ) + local f33_local0 = element:getParent() + if f33_local0:isInFocus() then + element:animateToState( "focus", 0 ) + end + end ) + f28_local10:registerEventHandler( "button_up", function ( element, event ) + element:animateToState( "default", 0 ) + end ) + f28_local2 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + f28_local2.alignment = LUI.Alignment.Center + f28_local9.hList = LUI.UIHorizontalList.new( f28_local2 ) + f28_local9:addElement( f28_local9.hList ) +end + +function SquadReportScoreBar( f35_arg0, f35_arg1, f35_arg2, f35_arg3 ) + local f35_local0 = 10 + local f35_local1 = 320 + local f35_local2 = 100 + local self = LUI.UIElement.new( CoD.CreateState( f35_local0, f35_arg3, -f35_local0, f35_arg3 + 26, CoD.AnchorTypes.TopLeftRight ) ) + self.id = f35_arg1 + local f35_local4 = CoD.CreateState( 0, 0, -(f35_local2 + 26), 0, CoD.AnchorTypes.All ) + f35_local4.material = RegisterMaterial( "white" ) + f35_local4.alpha = 0.15 + CoD.ColorizeState( Colors.black, f35_local4 ) + local f35_local5 = LUI.UIImage.new( f35_local4 ) + f35_local5.id = "squad_report_score_base_left_bg_id" + self:addElement( f35_local5 ) + f35_local4 = CoD.CreateState( -f35_local2, 0, 0, 0, CoD.AnchorTypes.TopBottomRight ) + f35_local4.material = RegisterMaterial( "white" ) + f35_local4.alpha = 0.05 + CoD.ColorizeState( Colors.white, f35_local4 ) + local f35_local6 = LUI.UIImage.new( f35_local4 ) + f35_local6.id = "squad_report_score_base_right_bg_id" + self:addElement( f35_local6 ) + f35_local4 = CoD.CreateState( -(f35_local2 + 26), 0, -f35_local2, 0, CoD.AnchorTypes.TopBottomRight ) + f35_local4.material = RegisterMaterial( "box_stat_cap" ) + f35_local4.alpha = 0.15 + f35_local4.zRot = 180 + CoD.ColorizeState( Colors.black, f35_local4 ) + local f35_local7 = LUI.UIImage.new( f35_local4 ) + f35_local7.id = "squad_report_score_base_left_cap_id" + self:addElement( f35_local7 ) + f35_local4 = CoD.CreateState( -(f35_local2 + 26), 0, -f35_local2, 0, CoD.AnchorTypes.TopBottomRight ) + f35_local4.material = RegisterMaterial( "box_stat_cap" ) + f35_local4.alpha = 0.05 + CoD.ColorizeState( Colors.white, f35_local4 ) + local f35_local8 = LUI.UIImage.new( f35_local4 ) + f35_local8.id = "squad_report_score_base_right_cap_id" + self:addElement( f35_local8 ) + f35_local4 = CoD.CreateState( 5, -CoD.TextSettings.NormalFont.Height * 0.5, f35_local1, CoD.TextSettings.NormalFont.Height * 0.5, CoD.AnchorTypes.Left ) + f35_local4.font = CoD.TextSettings.NormalFont.Font + f35_local4.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.primary_text_color, f35_local4 ) + local f35_local9 = LUI.UIText.new( f35_local4 ) + f35_local9.id = "squad_report_score_label_id" + f35_local9:setText( f35_arg2 ) + self:addElement( f35_local9 ) + f35_local4 = CoD.CreateState( -f35_local2, -CoD.TextSettings.NormalFont.Height * 0.5, -5, CoD.TextSettings.NormalFont.Height * 0.5, CoD.AnchorTypes.Right ) + f35_local4.font = CoD.TextSettings.NormalFont.Font + f35_local4.alignment = LUI.Alignment.Right + CoD.ColorizeState( Colors.white, f35_local4 ) + self.statValue = LUI.UIText.new( f35_local4 ) + self.statValue.id = "squad_report_score_value_id" + self:addElement( self.statValue ) + return self +end + +LUI.SnSDefaultArticle = {} +LUI.SnSDefaultArticle.new = function ( f36_arg0, f36_arg1, f36_arg2 ) + local f36_local0 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + f36_local0.alpha = 1 + local self = LUI.UIElement.new( f36_local0 ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerEventHandler( "refresh_article", RefreshArticle ) + AddDefaultLeftPane( self ) + local f36_local2 = LUI.UIElement.new( CoD.CreateState( -400, GenericTitleBarDims.TitleBarHeight, 0, 0, CoD.AnchorTypes.TopBottomRight ) ) + f36_local2.id = "article_right_pane_id" + self:addElement( f36_local2 ) + f36_local0 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + f36_local0.material = RegisterMaterial( "gradient_top" ) + f36_local0.alpha = 0.1 + f36_local2:addElement( LUI.UIImage.new( f36_local0 ) ) + f36_local0 = CoD.CreateState( 10, 20, -10, -10, CoD.AnchorTypes.All ) + CoD.ColorizeState( Colors.primary_text_color, f36_local0 ) + f36_local0.font = CoD.TextSettings.NormalFont.Font + f36_local0.alignment = LUI.Alignment.Left + f36_local0.alpha = 1 + local f36_local3 = LUI.UIMarqueeText.new( f36_local0 ) + f36_local3:SetUseTextWrapping( true ) + f36_local3:SetTextHeight( CoD.TextSettings.SmallFont.Height ) + f36_local3:registerAnimationState( "hidden", { + alpha = 0 + } ) + f36_local3.id = "article_body_id" + f36_local3:registerEventHandler( "update_article_details", function ( element, event ) + element:setText( event.articleInfo.body ) + end ) + f36_local2:addElement( f36_local3 ) + self.layoutType = ArticleLayout.Default + return self +end + +LUI.SnSListArticle = {} +LUI.SnSListArticle.new = function ( f38_arg0, f38_arg1, f38_arg2 ) + local f38_local0 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + f38_local0.alpha = 1 + local self = LUI.UIElement.new( f38_local0 ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerEventHandler( "refresh_article", RefreshArticle ) + AddDefaultLeftPane( self ) + local f38_local2 = LUI.UIElement.new( CoD.CreateState( -400, GenericTitleBarDims.TitleBarHeight, 0, 0, CoD.AnchorTypes.TopBottomRight ) ) + f38_local2.id = "article_right_pane_id" + self:addElement( f38_local2 ) + f38_local0 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + f38_local0.material = RegisterMaterial( "gradient_top" ) + f38_local0.alpha = 0.1 + f38_local2:addElement( LUI.UIImage.new( f38_local0 ) ) + f38_local0 = CoD.CreateState( 10, 10, -10, 10 + CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.TopLeftRight ) + f38_local0.font = CoD.TextSettings.NormalFont.Font + f38_local0.alignment = LUI.Alignment.Left + local f38_local3 = LUI.UIText.new( f38_local0 ) + f38_local3.id = "article_list_header_id" + f38_local3:registerEventHandler( "update_article_details", function ( element, event ) + element:setText( event.articleInfo.listHeader ) + end ) + f38_local2:addElement( f38_local3 ) + local f38_local4 = LUI.UIVerticalList.new( CoD.CreateState( 10, 20 + CoD.TextSettings.NormalFont.Height, -10, 0, CoD.AnchorTypes.All ), false, false, false ) + f38_local4:registerEventHandler( "update_article_details", function ( element, event ) + element:closeChildren() + element:clearSavedState() + LUI.MenuBuilder.buildChildren( element, element.properties, event.articleInfo.listFeeder and event.articleInfo.listFeeder( element.properties ) or {} ) + end ) + f38_local2:addElement( f38_local4 ) + self.layoutType = ArticleLayout.List + return self +end + +LUI.SnSSquadArticle = {} +LUI.SnSSquadArticle.new = function ( f41_arg0, f41_arg1, f41_arg2 ) + local f41_local0 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + f41_local0.alpha = 1 + local self = LUI.UIElement.new( f41_local0 ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerEventHandler( "refresh_article", RefreshArticle ) + local f41_local2 = LUI.UIElement.new( CoD.CreateState( 1, GenericTitleBarDims.TitleBarHeight + 1, 440, 0, CoD.AnchorTypes.TopBottomLeft ) ) + f41_local2.id = "article_left_pane_id" + self:addElement( f41_local2 ) + local f41_local3 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + f41_local3.material = RegisterMaterial( "gradient_top" ) + f41_local3.alpha = 0.4 + f41_local2:addElement( LUI.UIImage.new( f41_local3 ) ) + local f41_local4 = LUI.UIElement.new( CoD.CreateState( 30, 20, 400, 260, CoD.AnchorTypes.TopLeft ) ) + f41_local4.id = "article_image_container_id" + f41_local2:addElement( f41_local4 ) + local f41_local5 = LUI.MenuGenerics.generic_drop_shadow( nil, { + offset_shadow = 0 + } ) + f41_local5.id = "article_image_shadow_id" + f41_local4:addElement( f41_local5 ) + f41_local3 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.All ) + CoD.ColorizeState( Swatches.GenericMenu.Border, f41_local3 ) + local f41_local6 = LUI.UIImage.new( f41_local3 ) + f41_local6.id = "article_image_border_id" + f41_local4:addElement( f41_local6 ) + local f41_local7 = LUI.UIImage.new( CoD.CreateState( 1, 1, -1, -1, CoD.AnchorTypes.All ) ) + f41_local7:registerEventHandler( "update_article_details", function ( element, event ) + element:setImage( RegisterMaterial( event.articleInfo.image ) ) + end ) + f41_local4:addElement( f41_local7 ) + local f41_local8 = LUI.Playercard.new( nil, {}, f41_arg2 ) + f41_local8:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 300, + bottom = 420, + left = 5, + right = 325, + scale = -0.15 + } ) + f41_local8:animateToState( "default" ) + f41_local8.id = "article_squad_playercard_id" + f41_local8:registerEventHandler( "update_article_details", function ( element, event ) + local f43_local0 = event.articleInfo.reportData.enemyPlayercardProps + f43_local0.name = "update_playercard" + element:processEvent( f43_local0 ) + end ) + f41_local2:addElement( f41_local8 ) + local f41_local9 = LUI.UIElement.new( CoD.CreateState( -360, GenericTitleBarDims.TitleBarHeight, 0, 0, CoD.AnchorTypes.TopBottomRight ) ) + f41_local9.id = "article_right_pane_id" + self:addElement( f41_local9 ) + f41_local3 = CoD.CreateState( 10, 15, -10, 15 + CoD.TextSettings.ExtraBigFont.Height, CoD.AnchorTypes.TopLeftRight ) + f41_local3.font = CoD.TextSettings.ExtraBigFont.Font + f41_local3.alignment = LUI.Alignment.Center + local f41_local10 = LUI.UIText.new( f41_local3 ) + for f41_local14, f41_local15 in ipairs( SvS.Reports.MatchOutcomeArray ) do + f41_local10:registerAnimationState( f41_local15, CoD.ColorizeState( SvS.Reports.MatchOutcomeColors[f41_local15].textColor, {} ) ) + end + f41_local10.id = "article_squad_outcome_id" + f41_local10:registerEventHandler( "update_article_details", function ( element, event ) + element:setText( SvS.GetReportOutcomeText( event.articleInfo.reportData.matchOutcome ) ) + element:animateToState( event.articleInfo.reportData.matchOutcome ) + end ) + f41_local9:addElement( f41_local10 ) + f41_local3 = CoD.CreateState( 15, 45, -15, 46, CoD.AnchorTypes.TopLeftRight ) + CoD.ColorizeState( Swatches.GenericMenu.Border, f41_local3 ) + f41_local3.alpha = 0.5 + f41_local11 = LUI.UIImage.new( f41_local3 ) + f41_local11.id = "article_hbreak_id" + f41_local9:addElement( f41_local11 ) + f41_local3 = CoD.CreateState( 10, 65, -10, 65 + CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.TopLeftRight ) + f41_local3.font = CoD.TextSettings.NormalFont.Font + f41_local3.alignment = LUI.Alignment.Center + f41_local12 = LUI.UIText.new( f41_local3 ) + f41_local12.id = "article_squad_name_id" + f41_local12:registerEventHandler( "update_article_details", function ( element, event ) + element:setText( Engine.Localize( "LUA_MENU_SQUAD_LABEL", Engine.MarkLocalized( event.articleInfo.reportData.enemySquadName ) ) ) + end ) + f41_local9:addElement( f41_local12 ) + f41_local3 = CoD.CreateState( 10, 90, -10, 90 + CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.TopLeftRight ) + CoD.ColorizeState( Colors.primary_text_color, f41_local3 ) + f41_local3.font = CoD.TextSettings.NormalFont.Font + f41_local3.alignment = LUI.Alignment.Center + f41_local13 = LUI.UIText.new( f41_local3 ) + f41_local13:registerAnimationState( "highlight", CoD.ColorizeState( Colors.frontend_hilite, {} ) ) + f41_local13.id = "article_squad_xp_earned_id" + f41_local13:registerEventHandler( "update_article_details", function ( element, event ) + element:animateToState( event.articleInfo.reportData.didEarnXP and "highlight" or "default" ) + element:setText( event.articleInfo.reportData.xpString ) + end ) + f41_local9:addElement( f41_local13 ) + f41_local3 = CoD.CreateState( 10, 140, -10, 140 + CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.TopLeftRight ) + CoD.ColorizeState( Colors.primary_text_color, f41_local3 ) + f41_local3.font = CoD.TextSettings.NormalFont.Font + f41_local3.alignment = LUI.Alignment.Center + f41_local14 = LUI.UIText.new( f41_local3 ) + f41_local14.id = "article_game_type_id" + f41_local14:registerEventHandler( "update_article_details", function ( element, event ) + element:setText( Engine.Localize( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, event.articleInfo.reportData.gametype, GameTypesTable.Cols.Name ) ) ) + end ) + f41_local9:addElement( f41_local14 ) + f41_local3 = CoD.CreateState( 10, 165, -10, 165 + CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.TopLeftRight ) + CoD.ColorizeState( Colors.primary_text_color, f41_local3 ) + f41_local3.font = CoD.TextSettings.NormalFont.Font + f41_local3.alignment = LUI.Alignment.Center + f41_local15 = LUI.UIText.new( f41_local3 ) + f41_local15.id = "article_squad_base_text_id" + f41_local15:registerEventHandler( "update_article_details", function ( element, event ) + element:setText( Squad.GetRealBaseNameFromLoadName( event.articleInfo.reportData.mapName ) ) + end ) + f41_local9:addElement( f41_local15 ) + f41_local3 = CoD.CreateState( 10, 190, -10, 190 + CoD.TextSettings.NormalFont.Height, CoD.AnchorTypes.TopLeftRight ) + CoD.ColorizeState( Colors.secondary_text_color, f41_local3 ) + f41_local3.font = CoD.TextSettings.NormalFont.Font + f41_local3.alignment = LUI.Alignment.Center + local f41_local16 = LUI.UIText.new( f41_local3 ) + f41_local16.id = "article_squad_time_text_id" + f41_local16:registerEventHandler( "update_article_details", function ( element, event ) + element:setText( event.articleInfo.reportData.timeString ) + end ) + f41_local9:addElement( f41_local16 ) + local f41_local17 = SquadReportScoreBar( self, "article_squad_your_score_id", Engine.Localize( "LUA_MENU_YOUR_SQUAD_SCORE" ), 240 ) + f41_local17.id = "article_squad_your_score_id" + f41_local17.statValue:registerEventHandler( "update_article_details", function ( element, event ) + element:setText( event.articleInfo.reportData.yourScore ) + end ) + f41_local9:addElement( f41_local17 ) + local f41_local18 = SquadReportScoreBar( self, "article_squad_their_score_id", Engine.Localize( "LUA_MENU_ENEMY_SQUAD_SCORE" ), 265 ) + f41_local18.id = "article_squad_their_score_id" + f41_local18.statValue:registerEventHandler( "update_article_details", function ( element, event ) + element:setText( event.articleInfo.reportData.enemyScore ) + end ) + f41_local9:addElement( f41_local18 ) + self.layoutType = ArticleLayout.SquadReport + return self +end + +LUI.MenuBuilder.registerDef( "social_feed_main", social_feed_main ) +LUI.MenuBuilder.registerDef( "social_feed_header_window", social_feed_header_window ) +LUI.MenuBuilder.registerDef( "socialfeed_category_button", socialfeed_category_button ) +LUI.MenuBuilder.registerDef( "social_article_base", social_article_base ) +LUI.MenuBuilder.registerType( "SnSDefaultArticle", LUI.SnSDefaultArticle.new ) +LUI.MenuBuilder.registerType( "SnSListArticle", LUI.SnSListArticle.new ) +LUI.MenuBuilder.registerType( "SnSSquadArticle", LUI.SnSSquadArticle.new ) +LockTable( _M ) diff --git a/lui/mp_menus/splitscreengamesetupmenu.dec.lua b/lui/mp_menus/splitscreengamesetupmenu.dec.lua new file mode 100644 index 0000000..0aa5149 --- /dev/null +++ b/lui/mp_menus/splitscreengamesetupmenu.dec.lua @@ -0,0 +1,689 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function PushSplitScreenMenu() + MatchRules.SetUsingMatchRulesData( 1 ) + Engine.PLMRefreshData() +end + +function SplitScreenStartGame( f2_arg0, f2_arg1 ) + if Engine.GetDvarString( "ui_gametype" ) == "horde" then + Lobby.SetBotsConnectType( 0 ) + Engine.SetDvarBool( "squad_use_hosts_squad", false ) + elseif SvS.IsSvS() then + if Lobby.GetBotsConnectType() == 0 then + Lobby.SetBotsConnectType( 1 ) + end + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Friendly, SvS.MaxSquadSize ) + Lobby.SetBotsTeamLimit( Lobby.BotTeams.Enemy, SvS.MaxSquadSize ) + Engine.SetDvarBool( "squad_use_hosts_squad", true ) + elseif Lobby.GetBotsConnectType() == 0 then + Lobby.SetBotsConnectType( 1 ) + Engine.SetDvarBool( "squad_use_hosts_squad", false ) + end + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) + f2_local0.startingController = f2_arg1.controller + CharacterScene.FreeCharacterScene() + local f2_local1 = LUI.mp_menus.Aliens.LobbyGetIntroVideo() + if f2_local1 and f2_local1 ~= "" and not LUI.mp_menus.Aliens.HasSeenVideo( f2_arg1.controller, f2_local1 ) then + LUI.mp_menus.Aliens.SetHasSeenVideo( f2_arg1.controller, f2_local1 ) + LUI.mp_menus.Aliens.AliensPlayVideo( f2_arg1.controller, f2_local1, { + name = "start_transition_to_game", + immediate = true + } ) + else + f2_arg0:dispatchEventToRoot( { + name = "start_transition_to_game", + immediate = true + } ) + end +end + +function StartTheGameHandler( f3_arg0, f3_arg1 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + Engine.SetDvarBool( "splitscreen_ingame", true ) + Lobby.StartServer( f3_local0.startingController ) + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), false, "LobbyTransitionToGame" ) +end + +function SplitScreenGameSetup( f4_arg0, f4_arg1 ) + LUI.FlowManager.RequestAddMenu( f4_arg0, "gamesetup_menu_main", true, f4_arg1.controller, false ) +end + +function SplitScreenEditSquad( f5_arg0, f5_arg1 ) + Cac.SetEditSquadMember( Cac.GetActiveSquadMember( f5_arg1.controller ) ) + LUI.FlowManager.RequestAddMenu( f5_arg0, "cac_edit_main", true, f5_arg1.controller, false, { + open_char_list = true, + squadLocation = "privateMatchSquadMembers", + squadMemberIndex = Cac.GetEditSquadMember(), + classLocation = "loadouts", + allowMemberSwap = true + } ) +end + +function LeaveSplitScreen( f6_arg0, f6_arg1 ) + if Lobby.GetBotsConnectType() > 0 then + Lobby.SetBotsConnectType( 0 ) + end + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) +end + +function GameSetupCreateHandler( f7_arg0, f7_arg1 ) + LUI.FlowManager.RequestSetStack( f7_arg0, { + { + name = "mp_main_menu" + }, + { + name = "menu_splitscreensignin" + } + } ) + local f7_local0 = Engine.GetFirstActiveController() + f7_arg0:dispatchEventToRoot( LUI.ButtonHelperText.CommonEvents.addBackButton ) + f7_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addGameSummaryButton ) + Engine.SetDvarBool( "splitscreen_ingame", false ) + Engine.Exec( MPConfig.default_dvars, f7_local0 ) + if Engine.IsAliensMode() then + LUI.mp_menus.Aliens.AliensRunConfig( f7_local0 ) + LUI.mp_menus.Aliens.InitGameTypeToAliens() + end + if Engine.IsXbox360() and Engine.AnyContentDamaged and Engine.AnyContentDamaged() then + LUI.FlowManager.RequestPopupMenu( f7_arg0, "mp_damaged_content_popup", false, f7_local0 ) + else + TryForceOpenAfterActionReport( f7_arg0, f7_arg1 ) + end + if Engine.GetDvarBool( "xblive_competitionmatch" ) and not Engine.IsAliensMode() then + MLG.SetUsingMLGRules( false ) + MatchRules.LoadMatchRulesDataDefault() + f7_arg0:processEvent( { + name = "create_class_update_restrictions", + controller = f7_local0 + } ) + end + Cac.ValidateAllPlayersPrivateSquadMembers() +end + +function GameSetupOptionsFeeder( f8_arg0 ) + local f8_local0 = Engine.IsAliensMode() + local f8_local1 = {} + if not f8_arg0.slot then + DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" ) + local f8_local2 = 0 + end + local f8_local3 = Cac.GetCustomClassLoc( f8_arg0.classLocation ) + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "start_game_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_START_GAME_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_START_MATCH" ), + button_action_func = SplitScreenStartGame + } + } + if not f8_local0 then + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "game_setup_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_GAME_SETUP_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_GAME_SETUP" ), + button_action_func = SplitScreenGameSetup + } + } + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "create_squad_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" ), + button_action_func = SplitScreenEditSquad, + button_over_func = TriggerUpdateRestrictionsIcon, + button_up_func = TriggerUpdateRestrictionsIcon + }, + handlers = { + create_class_update_restrictions = TriggerUpdateRestrictionsIcon + }, + children = { + { + type = "lobby_restriction_icon" + } + } + } + else + f8_local1[#f8_local1 + 1] = LUI.mp_menus.AliensLoadout.GetAliensLoadoutButton() + if LUI.mp_menus.Aliens.ExtinctionHasMapSelection() then + f8_local1[#f8_local1 + 1] = LUI.mp_menus.Aliens.MapSelectionButton() + end + if LUI.mp_menus.Aliens.ExtinctionHasModeSelection() then + f8_local1[#f8_local1 + 1] = LUI.mp_menus.Aliens.ModeSelectionButton() + end + if LUI.mp_menus.Aliens.ExtinctionHasDifficultySelection() then + f8_local1[#f8_local1 + 1] = LUI.mp_menus.Aliens.DifficultySelectionButton() + end + if LUI.mp_menus.Aliens.CanAccessIntelMenu() then + f8_local1[#f8_local1 + 1] = LUI.mp_menus.AliensIntel.GetAliensIntelButton() + end + end + local f8_local4 = MatchRules.GetData( "gametype" ) + if not f8_local0 and f8_local4 ~= "horde" then + local f8_local5 = tonumber( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f8_local4, GameTypesTable.Cols.TeamChoice ) ) + if f8_local5 and f8_local5 == 1 then + if not SvS.IsSvS() then + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "friendly_bot_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_FRIENDLY_BOTS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_FRIENDLY_BOTS_DESC" ), + button_display_func = FriendlyBotButtonDisplayText, + button_left_func = FriendlyBotButtonLeft, + button_right_func = FriendlyBotButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "friendly_bots_difficulty_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_FRIENDLY_BOTDIFFICULTY_DESC" ), + button_display_func = FriendlyBotsDifficultyButtonDisplayText, + button_left_func = FriendlyBotsDifficultyButtonLeft, + button_right_func = FriendlyBotsDifficultyButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "enemy_bot_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_ENEMY_BOTS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_ENEMY_BOTS_DESC" ), + button_display_func = EnemyBotButtonDisplayText, + button_left_func = EnemyBotButtonLeft, + button_right_func = EnemyBotButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + end + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "enemy_bots_difficulty_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_ENEMY_BOTDIFFICULTY_DESC" ), + button_display_func = EnemyBotsDifficultyButtonDisplayText, + button_left_func = EnemyBotsDifficultyButtonLeft, + button_right_func = EnemyBotsDifficultyButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + else + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "bot_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_BOTS_DESC" ), + button_display_func = FFABotButtonDisplayText, + button_left_func = FFABotButtonLeft, + button_right_func = FFABotButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "bots_difficulty_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_DESC" ), + button_display_func = FFABotsDifficultyButtonDisplayText, + button_left_func = FFABotsDifficultyButtonLeft, + button_right_func = FFABotsDifficultyButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + end + f8_local1[#f8_local1 + 1] = { + type = "UITimer", + id = "bot_button_timer_id", + properties = { + event = "bot_button_refresh", + interval = 200 + } + } + end + f8_local1[#f8_local1 + 1] = { + type = "button_desc_text", + id = "splitscreen_gamesetup_description_id" + } + return f8_local1 +end + +function menu_gamesetup_splitscreen() + local f9_local0 = Engine.IsAliensMode() + local f9_local1 = { + type = "UIElement", + id = "menu_splitscreen_gamesetup_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = GameSetupCreateHandler, + start_transition_to_game = HandleStartTransitionToGame, + open_after_action_report = OpenAfterActionReport, + lobby_transition_complete = StartTheGameHandler + } + } + local f9_local2 = {} + local f9_local3 = { + type = "generic_menu_title", + id = "splitscreen_menu_title" + } + local f9_local4 = {} + local f9_local5 + if f9_local0 then + f9_local5 = Engine.Localize( "@LUA_MENU_LOCAL_PLAY_CAPS" ) + if not f9_local5 then + + else + f9_local4.menu_title = f9_local5 + f9_local3.properties = f9_local4 + f9_local3.handlers = { + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + f9_local4 = { + type = "UIVerticalList", + id = "live_splitscreen_options_id", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + childrenFeeder = GameSetupOptionsFeeder, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ), + bot_button_refresh = BotButtonRefresh, + menu_create = BotButtonRefresh + } + } + f9_local5 = { + type = "splitscreen_member_list" + } + local f9_local6 = { + type = "lobby_loading_widget" + } + local f9_local7 = { + type = "lobby_game_type_title" + } + local f9_local8 = { + type = "lobby_game_type_icon" + } + local f9_local9 = { + type = "UIBindButton", + id = "lobby_bind_buttons_id", + handlers = { + button_secondary = LeaveSplitScreen, + button_select = OpenAfterActionReport + } + } + local f9_local10 = { + type = "UIElement", + id = "LowerSliderID", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 1 + }, + hidden = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 100, + bottom = 100, + alpha = 0 + } + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + }, + children = { + { + type = "map_info_text", + id = "map_info_text_id" + }, + { + type = "button_helper_text_main", + id = "cac_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + } + f9_local2[1] = f9_local3 + f9_local2[2] = f9_local4 + f9_local2[3] = f9_local5 + f9_local2[4] = f9_local6 + f9_local2[5] = f9_local7 + f9_local2[6] = f9_local8 + f9_local2[7] = f9_local9 + f9_local2[8] = f9_local10 + f9_local1.children = f9_local2 + return f9_local1 + end + end + f9_local5 = Engine.Localize( "@LUA_MENU_SPLITSCREEN_CAPS" ) +end + +function PlayerCardDummyData( f10_arg0, f10_arg1, f10_arg2 ) + f10_arg0:processEvent( { + gamertag = "player" .. f10_arg2 + 1, + clantag = "NVST", + rank = 18, + prestige = 0, + background = "0", + patchEmblem = "0", + patchShape = "0", + name = "update_playercard" + } ) +end + +function FillPlayerData( f11_arg0, f11_arg1, f11_arg2 ) + if not Lobby.GetControllerForSplitScreenSlot then + PlayerCardDummyData( f11_arg0, f11_arg1, f11_arg2 ) + return + end + local f11_local0 = Lobby.GetControllerForSplitScreenSlot( f11_arg2 ) + if f11_local0 and Engine.HasPlayerData( f11_local0 ) then + local f11_local1 = LUI.mp_menus.Aliens + local f11_local2 = nil + if Engine.IsAliensMode() then + f11_local2 = Lobby.GetAlienRankForXP( f11_local1.getAliensExperience( f11_local0 ) ) + else + f11_local2 = Lobby.GetRankForXP( Engine.GetPlayerDataEx( f11_local0, CoD.StatsGroup.Ranked, "experience" ) ) + end + local f11_local3 = { + gamertag = Engine.GetUsernameByController( f11_local0 ), + clantag = Engine.GetCustomClanTag( f11_local0 ) or "", + rank = f11_local2 + } + if Engine.IsAliensMode() then + f11_local3.prestige = f11_local1.getAliensPrestigeLevel( f11_local0 ) + else + f11_local3.prestige = Engine.GetPlayerDataEx( f11_local0, CoD.StatsGroup.Ranked, "prestige" ) + end + if Engine.IsAliensMode() then + local f11_local4 = "squadMembers" + local f11_local5 = 0 + f11_local3.background = Engine.GetPlayerDataEx( f11_local0, CoD.StatsGroup.Ranked, f11_local4, f11_local5, "background" ) + f11_local3.patchEmblem = Engine.GetPlayerDataEx( f11_local0, CoD.StatsGroup.Ranked, f11_local4, f11_local5, "patch" ) + f11_local3.patchShape = Engine.GetPlayerDataEx( f11_local0, CoD.StatsGroup.Ranked, f11_local4, f11_local5, "patchbacking" ) + else + local f11_local4 = Cac.GetSquadLoc() + local f11_local5 = AAR.GetRoundSquadMember( f11_local0 ) + f11_local3.background = Cac.GetBackgroundIndex( f11_local0, f11_local4, f11_local5 ) + f11_local3.patchEmblem = Cac.GetPatchIndex( f11_local0, f11_local4, f11_local5 ) + f11_local3.patchShape = Cac.GetPatchbackingIndex( f11_local0, f11_local4, f11_local5 ) + end + f11_local3.name = "update_playercard" + f11_arg0:processEvent( f11_local3 ) + end +end + +function splitscreenMemberFeeder( f12_arg0 ) + local f12_local0 = {} + local f12_local1 = Engine.SplitscreenPlayerCount() + local f12_local2 = 70 + for f12_local3 = 1, f12_local1, 1 do + local f12_local6 = f12_local3 + f12_local0[#f12_local0 + 1] = { + type = "playercard", + id = "playercard_id" .. f12_local6, + properties = { + additional_handlers = { + menu_create = function ( f13_arg0, f13_arg1 ) + FillPlayerData( f13_arg0, f13_arg1, f12_local6 - 1 ) + end, + update_cards = function ( f14_arg0, f14_arg1 ) + FillPlayerData( f14_arg0, f14_arg1, f12_local6 - 1 ) + end + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f12_local2 + } + } + } + end + f12_local0[#f12_local0 + 1] = { + type = "UITimer", + properties = { + event = "update_player_cards", + interval = 750, + disposable = false + } + } + return f12_local0 +end + +function HandleUpdatePlayerCards( f15_arg0, f15_arg1 ) + if f15_arg0.properties.numPlayers ~= Engine.SplitscreenPlayerCount() then + f15_arg0.properties.numPlayers = Engine.SplitscreenPlayerCount() + f15_arg0:closeChildren() + f15_arg0:processEvent( { + name = "menu_refresh" + } ) + end + f15_arg0:processEvent( { + name = "update_cards" + } ) +end + +function splitscreen_member_list() + return { + type = "UIVerticalList", + id = "splitscreen_memberlist_id", + properties = { + numPlayers = Engine.SplitscreenPlayerCount() + }, + childrenFeeder = splitscreenMemberFeeder, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = -500, + right = -50, + top = 150, + bottom = 0, + spacing = 60 + }, + hidden = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 100, + right = 650, + top = 150, + bottom = 0, + spacing = 60 + } + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ), + update_player_cards = HandleUpdatePlayerCards + } + } +end + +LUI.MenuBuilder.registerDef( "menu_gamesetup_splitscreen", menu_gamesetup_splitscreen ) +LUI.MenuBuilder.registerDef( "splitscreen_member_list", splitscreen_member_list ) +LUI.FlowManager.RegisterStackPushBehaviour( "menu_gamesetup_splitscreen", PushSplitScreenMenu ) +LockTable( _M ) diff --git a/lui/mp_menus/splitscreensignin.dec.lua b/lui/mp_menus/splitscreensignin.dec.lua new file mode 100644 index 0000000..ddedaff --- /dev/null +++ b/lui/mp_menus/splitscreensignin.dec.lua @@ -0,0 +1,622 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = { + ButtonPos1 = 75, + ButtonPos2 = 100, + ButtonPos3 = 125, + ButtonPos4 = 150, + ButtonPos5 = 175, + ButtonPos6 = 200 +} +function SplitScreenSignInCreate( f1_arg0, f1_arg1 ) + Engine.PlaySound( CoD.SFX.MouseOver ) + if not f1_arg1.stackRestore then + Engine.Exec( "startsplitscreensignin", 0 ) + end +end + +function SplitscreensigninRefresh( f2_arg0, f2_arg1 ) + f2_arg0:dispatchEventToRoot( { + name = "refresh_quadrant_options", + immediate = true + } ) + f2_arg0:dispatchEventToRoot( { + name = "refresh_quadrant_leds", + immediate = true + } ) +end + +function GetQuadsLayoutData( f3_arg0 ) + local f3_local0 = assert + local f3_local1 + if f3_arg0 ~= 2 and f3_arg0 ~= 4 then + f3_local1 = false + else + f3_local1 = true + end + f3_local0( f3_local1, "numQuads must be 2 or 4" ) + f3_local0 = 245 + f3_local1 = 517 + local f3_local2 = {} + if f3_arg0 == 4 then + f3_local2 = { + { + x = 100, + y = 124 + }, + { + x = 660, + y = 124 + }, + { + x = 100, + y = 395 + }, + { + x = 660, + y = 395 + } + } + else + f3_local2 = { + { + x = 370, + y = 124 + }, + { + x = 370, + y = 395 + } + } + end + return f3_local0, f3_local1, f3_local2 +end + +function QuadrantFeeder( f4_arg0 ) + local f4_local0 = f4_arg0.numQuads + local f4_local1 = 245 + local f4_local2 = 517 + local f4_local3 = nil + f4_local1, f4_local2, f4_local3 = GetQuadsLayoutData( f4_local0 ) + local f4_local4 = {} + for f4_local5 = 1, #f4_local3, 1 do + f4_local4[#f4_local4 + 1] = { + type = "menu_splitscreensignin_quadrant", + id = "quadrant_" .. f4_local5, + properties = { + qid = f4_local5 - 1, + listen_on_controller = -1 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f4_local3[f4_local5].x, + right = f4_local3[f4_local5].x + f4_local2, + top = f4_local3[f4_local5].y, + bottom = f4_local3[f4_local5].y + f4_local1 + } + } + } + end + return f4_local4 +end + +function menu_splitscreensignin() + return { + type = "UIElement", + id = "menu_splitscreensigninmain", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + properties = { + numQuads = 2 + }, + handlers = { + menu_create = SplitScreenSignInCreate, + refresh_splitscreensignin_menu = SplitscreensigninRefresh + }, + children = { + { + type = "generic_menu_title", + id = "splitscreen_signin_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_LOCAL_PLAY_SIGNIN_CAPS" ) + } + }, + { + type = "UIImage", + id = "horizontal_line_id", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = 21.5, + bottom = 22.5, + red = 1, + green = 1, + blue = 1, + alpha = 0.3 + } + } + }, + { + type = "UIElement", + id = "quadrants_container_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + childrenFeeder = QuadrantFeeder, + handlers = { + refresh_quadrant_leds = RefreshQuadrantLEDs + } + } + } + } +end + +function GetOptionsList( f6_arg0 ) + local f6_local0 = 200 + local f6_local1 = { + { + string = Engine.Localize( "@XBOXLIVE_JOINSPLITSCREENGAME_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_JOINSPLITSCREENGAME_MW3" ), + visarg = Engine.GetDvarBool( "joingame" .. f6_arg0.listen_on_controller .. "_vis" ), + xpos = f6_local0, + ypos = f0_local0.ButtonPos1 + }, + { + string = Engine.Localize( "@XBOXLIVE_BACK_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_BACK_MW3" ), + visarg = Engine.GetDvarBool( "joingame" .. f6_arg0.listen_on_controller .. "_vis" ), + xpos = f6_local0, + ypos = f0_local0.ButtonPos2 + }, + { + string = Engine.Localize( "@MENU_WAITING_FOR_MORE_PLAYERS1" ), + visarg = Engine.GetDvarBool( "waiting" .. f6_arg0.listen_on_controller .. "_vis" ), + xpos = f6_local0, + ypos = f0_local0.ButtonPos3 + }, + { + string = Engine.Localize( "@XBOXLIVE_STARTGAME_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_STARTGAME_MW3" ), + visarg = Engine.GetDvarBool( "startgame" .. f6_arg0.listen_on_controller .. "_vis" ), + xpos = f6_local0, + ypos = f0_local0.ButtonPos3 + }, + { + string = Engine.Localize( "@XBOXLIVE_LEAVESPLITSCREENGAME_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_LEAVESPLITSCREENGAME_MW3" ), + visarg = Engine.GetDvarBool( "leavegame" .. f6_arg0.listen_on_controller .. "_vis" ), + xpos = f6_local0, + ypos = f0_local0.ButtonPos4 + } + } + if Engine.IsPS3() then + f6_local1[#f6_local1 + 1] = { + string = Engine.Localize( "@XBOXLIVE_CHANGEOFFLINEPROFILE_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_CHANGEOFFLINEPROFILE_MW3" ), + visarg = Engine.GetDvarBool( "changeusers" .. f6_arg0.listen_on_controller .. "_vis" ), + xpos = f6_local0, + ypos = f0_local0.ButtonPos5 + } + elseif not Engine.IsPS4() then + f6_local1[#f6_local1 + 1] = { + string = Engine.Localize( "@XBOXLIVE_SIGNINPROFILE_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_SIGNINPROFILE_MW3" ), + visarg = Engine.GetDvarBool( "signin" .. f6_arg0.listen_on_controller .. "_vis" ), + xpos = f6_local0, + ypos = f0_local0.ButtonPos5, + xbox_only = true + } + f6_local1[#f6_local1 + 1] = { + string = Engine.Localize( "@XBOXLIVE_CHANGEPROFILE_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_CHANGEPROFILE_MW3" ), + visarg = Engine.GetDvarBool( "changeusers" .. f6_arg0.listen_on_controller .. "_vis" ), + xpos = f6_local0, + ypos = f0_local0.ButtonPos5, + xbox_only = true + } + if not Engine.IsXB3() then + f6_local1[#f6_local1 + 1] = { + string = Engine.Localize( "@XBOXLIVE_SELECTSAVEDEVICE_BUTTON" ) .. " " .. Engine.Localize( "@XBOXLIVE_SELECTSAVEDEVICE_MW3" ), + visarg = Engine.GetDvarBool( "changeusers" .. f6_arg0.listen_on_controller .. "_vis" ), + xpos = f6_local0, + ypos = f0_local0.ButtonPos6, + xbox_only = true + } + end + end + return f6_local1 +end + +function QuadrantOptionsListFeeder( f7_arg0 ) + local f7_local0 = {} + local f7_local1 = 0.7 + local f7_local2 = 0.7 + local f7_local3 = 0.7 + local f7_local4 = CoD.TextSettings.BigFont.Height + local f7_local5 = GetOptionsList( f7_arg0 ) + for f7_local6 = 1, #f7_local5, 1 do + local f7_local9 = 0 + if f7_local5[f7_local6].visarg == true then + f7_local9 = 1 + end + f7_local0[#f7_local0 + 1] = { + type = "UIText", + id = "option_" .. f7_local6 .. "id_controller" .. f7_arg0.listen_on_controller, + properties = { + text = f7_local5[f7_local6].string + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f7_local5[f7_local6].xpos, + right = 0, + top = f7_local5[f7_local6].ypos, + bottom = f7_local5[f7_local6].ypos + f7_local4, + red = f7_local1, + green = f7_local2, + blue = f7_local3, + alpha = f7_local9, + animateOnRefresh = true + } + } + } + end + if Engine.GetDvarBool( "startgame" .. f7_arg0.listen_on_controller .. "_vis" ) then + f7_local0[#f7_local0 + 1] = { + type = "playercard", + id = "basic_playercard_for_controller_" .. f7_arg0.listen_on_controller, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 20, + left = 40, + height = 128, + width = 512 + } + } + } + end + return f7_local0 +end + +function ToggleQuadrantLED( f8_arg0, f8_arg1, f8_arg2 ) + local f8_local0 = assert + local f8_local1 + if f8_arg2 ~= "on" and f8_arg2 ~= "off" then + f8_local1 = false + else + f8_local1 = true + end + f8_local0( f8_local1 ) + f8_arg0:dispatchEventToRoot( { + name = "quadrant_" .. f8_arg1 .. "_led_" .. f8_arg2, + immediate = true + } ) +end + +function RefreshQuadrantOptions( f9_arg0, f9_arg1 ) + local f9_local0 = f9_arg0.properties + if not f9_local0 then + DebugPrint( "Warning: could not resolve properties for Split screen sign in quadrant" ) + return + end + local f9_local1 = "basic_playercard_for_controller_" .. f9_local0.listen_on_controller + local f9_local2 = f9_arg0:getChildById( f9_local1 ) + if f9_local2 then + f9_local2:close() + end + f9_arg0:processEvent( { + name = "menu_refresh" + } ) + f9_local2 = f9_arg0:getChildById( f9_local1 ) + if f9_local2 then + local f9_local3 = nil + if Engine.IsAliensMode() then + f9_local3 = Lobby.GetMemberAlienRank( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller ) + else + f9_local3 = Lobby.GetMemberRank( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller ) + end + if not f9_local3 then + f9_local3 = 0 + end + local f9_local4 = "" + if Lobby.HasMemberClanTag( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller ) then + f9_local4 = Lobby.GetMemberClanTag( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller ) + end + local f9_local5 = nil + if Engine.IsAliensMode() then + f9_local5 = Lobby.GetMemberAlienPrestigeLevel( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller ) + else + f9_local5 = Lobby.GetMemberPrestigeLevel( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller ) + end + f9_local2:processEvent( { + gamertag = Lobby.GetMemberName( Lobby.MemberListStates.Prelobby, f9_local0.qid, 0, f9_local0.listen_on_controller ), + clantag = f9_local4, + prestige = f9_local5, + background = "0", + patchEmblem = "0", + patchShape = "0", + name = "update_playercard" + } ) + end +end + +function AssignControllerToQuadrant( f10_arg0, f10_arg1 ) + if f10_arg0.properties.qid == f10_arg1.qid then + f10_arg0.properties.listen_on_controller = f10_arg1.controller + end +end + +function menu_splitscreensignin_quadrant() + return { + type = "UIElement", + properties = { + qid = -1, + listen_on_controller = -1 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + assign_controller_to_quadrant = AssignControllerToQuadrant + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0.5 + } + } + }, + { + type = "UIImage", + states = { + default = { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b, + alpha = 0.75 + } + } + }, + { + type = "generic_border", + properties = { + border_red = Colors.window_border_color.r, + border_green = Colors.window_border_color.g, + border_blue = Colors.window_border_color.b + } + }, + { + type = "UIElement", + id = "quadrant_options_list", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + refresh_quadrant_options = RefreshQuadrantOptions + }, + childrenFeeder = QuadrantOptionsListFeeder + } + } + } +end + +function RefreshQuadrantLEDs( f12_arg0, f12_arg1 ) + for f12_local0 = 1, 4, 1 do + local f12_local3 = false + local f12_local4 = f12_local0 - 1 + for f12_local5 = 1, 4, 1 do + local f12_local8 = f12_arg0:getChildById( "quadrant_" .. f12_local5 ) + if f12_local8 and f12_local8.properties.listen_on_controller == f12_local4 then + f12_local3 = true + break + end + end + if f12_local3 then + ToggleQuadrantLED( f12_arg0, f12_local4, "on" ) + else + ToggleQuadrantLED( f12_arg0, f12_local4, "off" ) + end + end +end + +function controller_port_indicators() + return { + type = "UIImage", + id = "console_logo_icon_id", + states = { + default = { + material = RegisterMaterial( "cont_port_indicators_bg" ), + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -20, + right = 20, + top = 2, + bottom = 42, + alpha = 1 + } + }, + children = { + { + type = "UIImage", + id = "quadrant_1_led", + states = { + default = { + material = RegisterMaterial( "cont_port_0_on" ), + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -20, + right = 0, + top = -20, + bottom = 0, + alpha = 0 + }, + on = { + alpha = 1 + } + }, + handlers = { + quadrant_0_led_on = MBh.AnimateToState( "on", 0 ), + quadrant_0_led_off = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIImage", + id = "quadrant_2_led", + states = { + default = { + material = RegisterMaterial( "cont_port_1_on" ), + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 20, + top = -20, + bottom = 0, + alpha = 0 + }, + on = { + alpha = 1 + } + }, + handlers = { + quadrant_1_led_on = MBh.AnimateToState( "on", 0 ), + quadrant_1_led_off = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIImage", + id = "quadrant_3_led", + states = { + default = { + material = RegisterMaterial( "cont_port_2_on" ), + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -20, + right = 0, + top = 0, + bottom = 20, + alpha = 0 + }, + on = { + alpha = 1 + } + }, + handlers = { + quadrant_2_led_on = MBh.AnimateToState( "on", 0 ), + quadrant_2_led_off = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIImage", + id = "quadrant_4_led", + states = { + default = { + material = RegisterMaterial( "cont_port_3_on" ), + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 20, + top = 0, + bottom = 20, + alpha = 0 + }, + on = { + alpha = 1 + } + }, + handlers = { + quadrant_3_led_on = MBh.AnimateToState( "on", 0 ), + quadrant_3_led_off = MBh.AnimateToState( "default", 0 ) + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "controller_port_indicators", controller_port_indicators ) +LUI.MenuBuilder.registerDef( "menu_splitscreensignin_quadrant", menu_splitscreensignin_quadrant ) +LUI.MenuBuilder.registerDef( "menu_splitscreensignin", menu_splitscreensignin ) +LUI.FlowManager.RegisterStackPopBehaviour( "menu_splitscreensignin", SplitScreenSignInExit ) +LockTable( _M ) diff --git a/lui/mp_menus/squadprepartylobby.dec.lua b/lui/mp_menus/squadprepartylobby.dec.lua new file mode 100644 index 0000000..9cc923d --- /dev/null +++ b/lui/mp_menus/squadprepartylobby.dec.lua @@ -0,0 +1,77 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function squad_pre_party_lobby() + return { + type = "UIElement", + id = "squad_pre_party_lobby", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = function ( f2_arg0, f2_arg1 ) + + end + , + menu_close = function ( f3_arg0, f3_arg1 ) + + end + + }, + children = { + { + type = "generic_header", + properties = { + text = Engine.Localize( "@LUA_MENU_SQUAD_V_SQUAD" ) + } + }, + { + type = "UIImage", + id = "results_bg", + states = { + default = { + material = RegisterMaterial( "white" ), + left = -320, + top = -240, + width = 640, + height = 480, + alpha = 0.2 + } + } + }, + { + type = "UIText", + id = "text1", + states = { + default = { + height = CoD.TextSettings.NormalFont.Height * 1.5, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + alpha = 1, + width = 640, + top = -100, + red = 0.9, + green = 0.9, + blue = 0 + } + }, + properties = { + text = "Host is finding a squad game." + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "squad_pre_party_lobby", squad_pre_party_lobby ) +LockTable( _M ) diff --git a/lui/mp_menus/squadreportdetail.dec.lua b/lui/mp_menus/squadreportdetail.dec.lua new file mode 100644 index 0000000..6ce0755 --- /dev/null +++ b/lui/mp_menus/squadreportdetail.dec.lua @@ -0,0 +1,1247 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = { + TeamWindow = { + Top = 90, + Bottom = -80, + Width = 400, + SideMargin = 175, + XPBannerHeight = 52, + FriendlyBGColor = Colors.cyan, + EnemyBGColor = Colors.orange, + InfoBar = { + Height = CoD.TextSettings.NormalFont.Height + 2, + BreakWidth = 220, + CapWidth = 32, + Alpha = 0.5, + TextMargin = 10, + TextTop = 1, + DarkColor = { + r = 0, + g = 0, + b = 0, + a = 0.15 + }, + LightColor = { + r = 1, + g = 1, + b = 1, + a = 0.05 + } + }, + MemberInfo = { + Height = 54, + EdgeMargin = 8, + TextMargin = 64, + BarHeight = 2, + LineOneTop = 4, + LineTwoTop = 7 + CoD.TextSettings.NormalFont.Height, + RankTextTop = 16, + RankIconTop = 12, + RankTextWidth = 24, + RankIconSize = 28, + WeaponIconTop = 17, + WeaponIconWidth = 76, + WeaponIconHeight = 38, + MVPOffset = 10, + MVPWidth = 64, + MVPHeight = 32 + } + }, + CompareStats = { + WinsTop = 228, + LossesTop = 256, + StreakTop = 284, + BGWidth = 65, + ArrowSize = 6, + BGColors = { + Better = { + r = 0, + g = 1, + b = 0 + }, + Worse = { + r = 1, + g = 0, + b = 0 + }, + Same = Colors.white + }, + TextColors = { + Better = { + r = 0.04, + g = 0.94, + b = 0.04 + }, + Worse = { + r = 0.94, + g = 0.04, + b = 0.04 + }, + Same = Colors.white + } + } +} +function CreateDetailMenu( f1_arg0, f1_arg1 ) + local f1_local0 = f1_arg0.properties.reportData + if not f1_local0 then + f1_local0 = { + enemyPlayercardProps = {} + } + end + f1_arg0:dispatchEventToRoot( LUI.ButtonHelperText.CommonEvents.addBackButton ) + local f1_local1 = f1_arg0:getChildById( "squad_report_detail_local_player" ) + local f1_local2 = f1_arg0:getChildById( "squad_report_detail_enemy_player" ) + local f1_local3 = Cac.GetLocalRankedPlayercardInfo( f1_arg0.properties.controller ) + f1_local3.name = "update_playercard" + f1_local3.patchEmblem = f1_local3.patch + f1_local1:processEvent( f1_local3 ) + f1_local2:processEvent( { + name = "update_playercard", + gamertag = f1_local0.enemyPlayercardProps.gamertag, + clantag = f1_local0.enemyPlayercardProps.clanTag, + rank = f1_local0.enemyPlayercardProps.rank, + prestige = f1_local0.enemyPlayercardProps.prestige, + background = f1_local0.enemyPlayercardProps.background, + patchEmblem = f1_local0.enemyPlayercardProps.patchEmblem, + patchShape = f1_local0.enemyPlayercardProps.patchShape + } ) +end + +function OutcomeTextChildFeeder( f2_arg0 ) + local f2_local0 = {} + local f2_local1 = f2_arg0.reportData + local f2_local2 = SvS.GetReportOutcomeLayoutInfo( f2_local1.matchOutcome ) + f2_local0[#f2_local0 + 1] = { + type = "UIText", + id = "squad_report_detail_result_text", + states = { + default = CoD.ColorizeState( f2_local2.textColor, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 60, + bottom = 60 + CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + alignment = textAlign + } ) + }, + properties = { + text = f2_local2.text + } + } + f2_local0[#f2_local0 + 1] = { + type = "UIText", + id = "squad_report_detail_clock_text", + states = { + default = CoD.ColorizeState( Colors.secondary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 35, + bottom = 35 + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = textAlign + } ) + }, + properties = { + text = f2_local1.timeString + } + } + return f2_local0 +end + +function CompareStatsFeeder( f3_arg0 ) + local f3_local0 = {} + local f3_local1 = f3_arg0.reportData + if not f3_local1.isCompare then + return f3_local0 + else + f3_local0[#f3_local0 + 1] = { + type = "squad_report_detail_stat_compare", + id = "squad_report_detail_stat_compare_wins", + states = { + default = CoD.ColorizeState( Colors.window_title_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f0_local0.TeamWindow.SideMargin + f0_local0.TeamWindow.Width, + right = -f0_local0.TeamWindow.SideMargin - f0_local0.TeamWindow.Width, + top = f0_local0.CompareStats.WinsTop, + bottom = f0_local0.CompareStats.WinsTop + f0_local0.TeamWindow.InfoBar.Height + } ) + }, + properties = { + value = f3_local1.yourWins - f3_local1.enemyWins + } + } + f3_local0[#f3_local0 + 1] = { + type = "squad_report_detail_stat_compare", + id = "squad_report_detail_stat_compare_losses", + states = { + default = CoD.ColorizeState( Colors.window_title_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f0_local0.TeamWindow.SideMargin + f0_local0.TeamWindow.Width, + right = -f0_local0.TeamWindow.SideMargin - f0_local0.TeamWindow.Width, + top = f0_local0.CompareStats.LossesTop, + bottom = f0_local0.CompareStats.LossesTop + f0_local0.TeamWindow.InfoBar.Height + } ) + }, + properties = { + value = f3_local1.enemyLosses - f3_local1.yourLosses + } + } + f3_local0[#f3_local0 + 1] = { + type = "squad_report_detail_stat_compare", + id = "squad_report_detail_stat_compare_streak", + states = { + default = CoD.ColorizeState( Colors.window_title_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f0_local0.TeamWindow.SideMargin + f0_local0.TeamWindow.Width, + right = -f0_local0.TeamWindow.SideMargin - f0_local0.TeamWindow.Width, + top = f0_local0.CompareStats.StreakTop, + bottom = f0_local0.CompareStats.StreakTop + f0_local0.TeamWindow.InfoBar.Height + } ) + }, + properties = { + value = f3_local1.yourWinStreak - f3_local1.enemyWinStreak + } + } + return f3_local0 + end +end + +function squad_report_detail_menu() + return { + type = "UIElement", + id = "squad_report_detail_menu", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = CreateDetailMenu + }, + children = { + { + type = "UIElement", + id = "squad_report_detail_title_info_container", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + }, + { + type = "generic_menu_title", + id = "squad_report_detail_title_text_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_SQUAD_COMPARE_CAPS" ) + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = f0_local0.TeamWindow.Top, + bottom = f0_local0.TeamWindow.Bottom, + width = 200, + alpha = 0.5 + } + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.black, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -200, + left = 0, + right = 0, + material = RegisterMaterial( "box_white_gradient_bot" ) + } ) + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.black, { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -200, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ) + } ) + } + } + } + }, + { + type = "squad_report_detail_team_window", + id = "squad_report_detail_local_player", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = f0_local0.TeamWindow.Top, + bottom = f0_local0.TeamWindow.Bottom, + left = f0_local0.TeamWindow.SideMargin, + right = f0_local0.TeamWindow.SideMargin + f0_local0.TeamWindow.Width + } + }, + properties = { + isEnemy = false + } + }, + { + type = "squad_report_detail_team_window", + id = "squad_report_detail_enemy_player", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = f0_local0.TeamWindow.Top, + bottom = f0_local0.TeamWindow.Bottom, + left = -f0_local0.TeamWindow.SideMargin - f0_local0.TeamWindow.Width, + right = -f0_local0.TeamWindow.SideMargin + } + }, + properties = { + isEnemy = true + } + }, + { + type = "UIText", + id = "squad_report_detail_vs_text", + states = { + default = CoD.ColorizeState( Colors.window_title_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 160, + height = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = textAlign, + textStyle = CoD.TextStyle.ShadowedMore + } ) + }, + properties = { + text = Engine.Localize( "LUA_MENU_VERSUS" ), + textStyle = CoD.TextStyle.Shadowed + } + }, + { + type = "UIElement", + id = "squad_report_detail_compare_stats_container", + states = { + default = CoD.ColorizeState( Colors.window_title_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + }, + childrenFeeder = CompareStatsFeeder + }, + { + type = "button_helper_text_main", + id = "squad_report_detail_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "squad_report_detail_friends_widget_id" + }, + { + type = "generic_back_button" + } + } + } +end + +function InfoBarChildFeeder( f5_arg0 ) + local f5_local0 = {} + local f5_local1 = f5_arg0.isEnemy or false + local f5_local2 = f5_arg0.infoBar or 0 + local f5_local3 = f0_local0.TeamWindow.InfoBar + local f5_local4 = 9 + local f5_local5, f5_local6, f5_local7, f5_local8, f5_local9, f5_local10, f5_local11, f5_local12, f5_local13, f5_local14 = nil + if f5_local1 then + f5_local5 = f0_local0.TeamWindow.Width - f5_local3.BreakWidth + f5_local6 = 0 + f5_local7 = 0 + f5_local8 = f5_local3.Height + f5_local9 = -f5_local3.Height + f5_local10 = f5_local3.LightColor + f5_local11 = f5_local3.DarkColor + f5_local12 = LUI.Alignment.Right + f5_local13 = 0 + f5_local14 = f5_local5 + else + f5_local5 = f5_local3.BreakWidth - f5_local3.CapWidth + f5_local6 = f5_local3.Height + f5_local7 = -f5_local3.Height + f5_local8 = 0 + f5_local9 = 0 + f5_local10 = f5_local3.DarkColor + f5_local11 = f5_local3.LightColor + f5_local12 = LUI.Alignment.Left + f5_local13 = f5_local5 + f5_local3.CapWidth + f5_local4 + f5_local14 = f5_local3.Width + end + local f5_local15 = f5_local5 + f5_local3.CapWidth + f5_local0[#f5_local0 + 1] = { + type = "UIImage", + id = "report_detail_infoBar_bg_left", + states = { + default = CoD.ColorizeState( f5_local10, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f5_local5, + alpha = f5_local3.Alpha + } ) + } + } + f5_local0[#f5_local0 + 1] = { + type = "UIImage", + id = "report_detail_infoBar_bg_left_cap", + states = { + default = CoD.ColorizeState( f5_local10, { + material = RegisterMaterial( "box_angle_rtcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = f5_local6, + bottom = f5_local7, + left = f5_local5, + right = f5_local15, + alpha = f5_local3.Alpha + } ) + } + } + f5_local0[#f5_local0 + 1] = { + type = "UIImage", + id = "report_detail_infoBar_bg_right_cap", + states = { + default = CoD.ColorizeState( f5_local11, { + material = RegisterMaterial( "box_angle_ltcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = f5_local8, + bottom = f5_local9, + left = f5_local5 + f5_local4, + right = f5_local15 + f5_local4, + alpha = f5_local3.Alpha + } ) + } + } + f5_local0[#f5_local0 + 1] = { + type = "UIImage", + id = "report_detail_infoBar_bg_right", + states = { + default = CoD.ColorizeState( f5_local11, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = f5_local15 + f5_local4, + right = 0, + alpha = f5_local3.Alpha + } ) + } + } + f5_local0[#f5_local0 + 1] = { + type = "UIText", + id = "report_detail_infoBar_label_text", + states = { + default = CoD.ColorizeState( Colors.secondary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = f5_local3.TextMargin, + right = -f5_local3.TextMargin, + top = f5_local3.TextTop, + bottom = f5_local3.TextTop + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = f5_local12 + } ) + }, + properties = { + text = MBh.Property( "labelText" ) + } + } + f5_local0[#f5_local0 + 1] = { + type = "UIText", + id = "report_detail_infoBar_value_text", + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f5_local13, + right = f5_local14, + top = f5_local3.TextTop, + bottom = f5_local3.TextTop + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = f5_local12 + } ) + }, + properties = { + text = MBh.Property( "valueText" ) + } + } + return f5_local0 +end + +function MemberListFeeder( f6_arg0 ) + local f6_local0 = {} + local f6_local1 = f6_arg0.isEnemy or false + local f6_local2 = f6_arg0.reportData or {} + local f6_local3 = f0_local0.TeamWindow.MemberInfo + local f6_local4, f6_local5, f6_local6, f6_local7, f6_local8, f6_local9, f6_local10, f6_local11, f6_local12, f6_local13, f6_local14 = nil + if f6_local1 then + f6_local4 = f6_local2.enemyTeam + f6_local6 = f0_local0.TeamWindow.Width - f6_local3.RankTextWidth + f6_local3.EdgeMargin * 2 + f6_local7 = f0_local0.TeamWindow.Width - f6_local3.RankTextWidth + f6_local3.RankIconSize + f6_local3.EdgeMargin * 2 + f6_local8 = f6_local3.WeaponIconWidth + f6_local3.EdgeMargin + f6_local9 = f0_local0.TeamWindow.Width - f6_local3.TextMargin + f6_local3.EdgeMargin + f6_local10 = LUI.Alignment.Right + f6_local11 = f6_local3.EdgeMargin + f6_local12 = f0_local0.TeamWindow.Width + f6_local3.MVPOffset + f6_local13 = f0_local0.TeamWindow.EnemyBGColor + f6_local14 = f0_local0.TeamWindow.EnemyBGColor + else + f6_local4 = f6_local2.yourTeam + f6_local6 = f6_local3.EdgeMargin + f6_local7 = f6_local3.EdgeMargin + f6_local3.RankTextWidth + f6_local8 = f6_local3.TextMargin + f6_local9 = f0_local0.TeamWindow.Width - f6_local3.WeaponIconWidth + f6_local3.EdgeMargin * 2 + f6_local10 = LUI.Alignment.Left + f6_local11 = f0_local0.TeamWindow.Width - f6_local3.WeaponIconWidth + f6_local3.EdgeMargin * 2 + f6_local12 = -1 * (f6_local3.MVPOffset + f6_local3.MVPWidth + f6_local3.EdgeMargin) + f6_local13 = f0_local0.TeamWindow.FriendlyBGColor + f6_local14 = f0_local0.TeamWindow.FriendlyBGColor + end + local f6_local15 = 0 + local f6_local16 = 0 + for f6_local17 = 1, SvS.MaxSquadSize, 1 do + local f6_local20 = f6_local4[f6_local17] + if f6_local16 < f6_local20.rank then + f6_local15 = f6_local17 + f6_local16 = f6_local20.rank + end + end + for f6_local17 = 1, SvS.MaxSquadSize, 1 do + local f6_local20 = f6_local4[f6_local17] + local f6_local21 = Squad.GetWeaponNameFromIndex and Squad.GetWeaponNameFromIndex( f6_local20.weaponIndex ) or "" + local f6_local22 = Cac.GetWeaponName( f6_local21 ) or "" + local f6_local23 = Cac.GetWeaponProfileImage( f6_local21 ) or "white" + local f6_local24 = f6_local17 == f6_local15 + local f6_local25 = { + [#f6_local25 + 1] = { + type = "UIImage", + id = "report_detail_member_bg", + states = { + default = CoD.ColorizeState( f6_local14, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.1 + } ) + } + } + } + local f6_local26 = #f6_local25 + 1 + local f6_local27 = { + type = "UIMarqueeText", + id = "report_detail_member_name" + } + local f6_local28 = {} + local f6_local29 = CoD.ColorizeState + if f6_local24 then + local f6_local30 = f6_local13 + end + f6_local28.default = f6_local29( f6_local30 or Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f6_local8, + right = f6_local9, + top = f6_local3.LineOneTop, + bottom = f6_local3.LineOneTop + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = f6_local10 + } ) + f6_local27.states = f6_local28 + f6_local27.properties = { + text = f6_local20.name + } + f6_local25[f6_local26] = f6_local27 + f6_local25[#f6_local25 + 1] = { + type = "UIText", + id = "report_detail_member_rank_text", + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f6_local6, + right = f6_local6 + f6_local3.RankTextWidth, + top = f6_local3.RankTextTop, + bottom = f6_local3.RankTextTop + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = f6_local10 + } ) + }, + properties = { + text = Rank.GetRankDisplay( f6_local20.rank, CoD.PlayMode.SquadVsSquad ) + } + } + f6_local26 = #f6_local25 + 1 + f6_local27 = { + type = "UIImage", + id = "report_detail_member_rank_icon" + } + f6_local28 = {} + f6_local29 = CoD.ColorizeState + local f6_local31 = Colors.primary_text_color + local f6_local32 = {} + local f6_local33 = RegisterMaterial + local f6_local34 = Rank.GetRankIcon( f6_local20.rank, f6_local20.prestige, CoD.PlayMode.SquadVsSquad ) + if not f6_local34 then + f6_local34 = "white" + end + f6_local32.material = f6_local33( f6_local34 ) + f6_local32.leftAnchor = true + f6_local32.rightAnchor = false + f6_local32.topAnchor = true + f6_local32.bottomAnchor = false + f6_local32.left = f6_local7 + f6_local32.right = f6_local7 + f6_local3.RankIconSize + f6_local32.top = f6_local3.RankIconTop + f6_local32.bottom = f6_local3.RankIconTop + f6_local3.RankIconSize + f6_local28.default = f6_local29( f6_local31, f6_local32 ) + f6_local27.states = f6_local28 + f6_local25[f6_local26] = f6_local27 + f6_local25[#f6_local25 + 1] = { + type = "UIMarqueeText", + id = "report_detail_member_weapon_name", + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f6_local8, + right = f6_local9, + top = f6_local3.LineTwoTop, + bottom = f6_local3.LineTwoTop + CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = f6_local10 + } ) + }, + properties = { + text = f6_local22 + } + } + f6_local25[#f6_local25 + 1] = { + type = "UIImage", + id = "report_detail_member_weapon_icon", + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + material = RegisterMaterial( f6_local23 ), + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = f6_local11, + right = f6_local11 + f6_local3.WeaponIconWidth, + height = f6_local3.WeaponIconHeight + } ) + } + } + f6_local25[#f6_local25 + 1] = { + type = "UIImage", + id = "report_detail_member_bar", + states = { + default = CoD.ColorizeState( Colors.grey_4, { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = f6_local3.Height - f6_local3.BarHeight, + bottom = 0, + alpha = 0.5 + } ) + } + } + if f6_local24 then + f6_local25[#f6_local25 + 1] = { + type = "UIImage", + id = "report_detail_member_mvp_bg", + states = { + default = CoD.ColorizeState( f6_local13, { + material = RegisterMaterial( "box_squad_mvp" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = f6_local12, + right = f6_local12 + f6_local3.MVPWidth, + height = f6_local3.MVPHeight + } ) + }, + children = { + { + type = "UIMarqueeText", + id = "report_detail_mvp_text", + properties = { + text = Engine.Localize( "LUA_MENU_MVP_SHORT" ) + }, + states = { + default = CoD.ColorizeState( Colors.black, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 4, + height = CoD.TextSettings.BoldFont.Height, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center + } ) + } + } + } + } + end + f6_local0[#f6_local0 + 1] = { + type = "UIElement", + id = "report_detail_member_" .. f6_local17, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f6_local3.Height + } + }, + children = f6_local25 + } + end + return f6_local0 +end + +function TeamWindowContentFeeder( f7_arg0 ) + if not f7_arg0 then + f7_arg0 = {} + end + local f7_local0 = f7_arg0.reportData or {} + local f7_local1 = f7_arg0.isEnemy or false + local f7_local2 = f7_arg0.controller + local f7_local3 = f7_local0.isCompare + assert( f7_local2 ) + if not f7_local2 then + f7_local2 = Engine.GetFirstActiveController() + DebugPrint( "[WARNING] Squad Report Detail: using controller index 0, this is only ok if you are editing a menu" ) + end + local f7_local4, f7_local5 = nil + if f7_local1 then + f7_local4 = f7_local0.enemyScore + f7_local5 = f7_local0.enemyXPEarned + else + f7_local4 = f7_local0.yourScore + f7_local5 = f7_local0.yourXPEarned + end + local f7_local6 = { + [#f7_local6 + 1] = { + type = "UIElement", + id = "playercard_container", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = -35, + height = 100, + width = 100 + } + }, + children = { + { + type = "playercard", + id = "report_detail_playercard", + states = { + default = { + scale = -0.18 + } + } + } + } + } + } + if f7_local3 then + local f7_local7 = #f7_local6 + 1 + local f7_local8 = { + type = "UIElement", + id = "report_detail_wins_container", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f0_local0.TeamWindow.InfoBar.Height, + left = 0, + right = 0 + } + } + } + local f7_local9 = { + isEnemy = f7_local1 + } + local f7_local10 + if f7_local1 then + f7_local10 = f7_local0.enemyInfoBar + if not f7_local10 then + + else + f7_local9.infoBar = f7_local10 + f7_local9.labelText = Engine.Localize( "LUA_MENU_WINS" ) + f7_local10 = tostring + local f7_local11 + if f7_local1 then + f7_local11 = f7_local0.enemyWins + if not f7_local11 then + + else + f7_local9.valueText = f7_local10( f7_local11 ) + f7_local8.properties = f7_local9 + f7_local8.childrenFeeder = InfoBarChildFeeder + f7_local6[f7_local7] = f7_local8 + f7_local7 = #f7_local6 + 1 + f7_local8 = { + type = "UIElement", + id = "report_detail_losses_container", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f0_local0.TeamWindow.InfoBar.Height, + left = 0, + right = 0 + } + } + } + f7_local9 = { + isEnemy = f7_local1 + } + if f7_local1 then + f7_local10 = f7_local0.enemyInfoBar + if not f7_local10 then + + else + f7_local9.infoBar = f7_local10 + f7_local9.labelText = Engine.Localize( "MENU_LOSSES" ) + f7_local10 = tostring + if f7_local1 then + f7_local11 = f7_local0.enemyLosses + if not f7_local11 then + + else + f7_local9.valueText = f7_local10( f7_local11 ) + f7_local8.properties = f7_local9 + f7_local8.childrenFeeder = InfoBarChildFeeder + f7_local6[f7_local7] = f7_local8 + f7_local7 = #f7_local6 + 1 + f7_local8 = { + type = "UIElement", + id = "report_detail_streak_container", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f0_local0.TeamWindow.InfoBar.Height, + left = 0, + right = 0 + } + } + } + f7_local9 = { + isEnemy = f7_local1 + } + if f7_local1 then + f7_local10 = f7_local0.enemyInfoBar + if not f7_local10 then + + else + f7_local9.infoBar = f7_local10 + f7_local9.labelText = Engine.Localize( "LUA_MENU_CURRENT_STREAK" ) + f7_local10 = tostring + if f7_local1 then + f7_local11 = f7_local0.enemyWinStreak + if not f7_local11 then + + else + f7_local9.valueText = f7_local10( f7_local11 ) + f7_local8.properties = f7_local9 + f7_local8.childrenFeeder = InfoBarChildFeeder + f7_local6[f7_local7] = f7_local8 + end + end + f7_local11 = f7_local0.yourWinStreak or 0 + end + end + f7_local10 = f7_local0.yourInfoBar + end + end + f7_local11 = f7_local0.yourLosses or 0 + end + end + f7_local10 = f7_local0.yourInfoBar + end + end + f7_local11 = f7_local0.yourWins or 0 + end + end + f7_local10 = f7_local0.yourInfoBar + end + f7_local6[#f7_local6 + 1] = { + type = "UIVerticalList", + id = "report_detail_member_list", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = { + isEnemy = f7_local1, + reportData = f7_local0 + }, + childrenFeeder = MemberListFeeder + } + return f7_local6 +end + +function TeamWindowChildFeeder( f8_arg0 ) + local f8_local0 = {} + local f8_local1 = f8_arg0.isEnemy or false + local f8_local2 = nil + if f8_local1 then + f8_local2 = f8_arg0.reportData.enemySquadName + else + f8_local2 = Squad.GetPlayerSquadName( f8_arg0.controller ) + end + f8_local0[#f8_local0 + 1] = { + type = "generic_drop_shadow", + id = "report_detail_main_dropshadow", + properties = { + offset_shadow = -5 + } + } + f8_local0[#f8_local0 + 1] = { + type = "generic_menu_background", + id = "report_detail_main_titlebar", + properties = { + hide_bottom = true, + fill_alpha = 1 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = GenericTitleBarDims.TitleBarHeight + } + }, + children = { + { + type = "UIText", + id = "report_detail_title_text", + states = { + default = CoD.ColorizeState( Colors.window_title_text_color, { + 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 + } ) + }, + properties = { + text = Engine.Localize( "LUA_MENU_SQUAD_LABEL", Engine.MarkLocalized( f8_local2 ) ) + } + } + } + } + f8_local0[#f8_local0 + 1] = { + type = "generic_menu_background", + id = "report_detail_main_background", + properties = { + fill_alpha = 1, + top_offset = Cac.Layout.InfoPane.header_height - 1 + } + } + f8_local0[#f8_local0 + 1] = { + type = "UIVerticalList", + id = "report_detail_main_vlist", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight, + bottom = 0, + left = 5, + right = -5, + spacing = 5 + } + }, + childrenFeeder = TeamWindowContentFeeder, + properties = { + reportData = f8_arg0.reportData, + controller = f8_arg0.controller, + isEnemy = f8_local1 + } + } + return f8_local0 +end + +function squad_report_detail_team_window() + return { + type = "UIElement", + id = "squad_report_detail_team_window", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = { + reportData = MBh.Property( "reportData" ), + controller = MBh.Property( "controller" ) + }, + handlers = {}, + childrenFeeder = TeamWindowChildFeeder + } +end + +function squad_report_detail_stat_compare( f10_arg0, f10_arg1 ) + if not f10_arg1 then + f10_arg1 = {} + end + local f10_local0 = f10_arg1.value or 0 + local f10_local1 = tostring( f10_local0 ) + local f10_local2 = f0_local0.CompareStats.BGColors.Same + local f10_local3 = f0_local0.CompareStats.TextColors.Same + local f10_local4 = nil + if f10_local0 > 0 then + f10_local2 = f0_local0.CompareStats.BGColors.Better + f10_local3 = f0_local0.CompareStats.TextColors.Better + f10_local4 = RegisterMaterial( "widg_arrow_up" ) + f10_local1 = string.format( "%+d", f10_local0 ) + elseif f10_local0 < 0 then + f10_local2 = f0_local0.CompareStats.BGColors.Worse + f10_local3 = f0_local0.CompareStats.TextColors.Worse + f10_local4 = RegisterMaterial( "widg_arrow_dn" ) + f10_local1 = string.format( "%+d", f10_local0 ) + end + local self = LUI.UIElement.new() + self.id = "squad_report_detail_stat_compare_container" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default", 0 ) + local f10_local6 = LUI.UIImage.new() + f10_local6.id = "stat_compare_bg_left" + f10_local6:registerAnimationState( "default", CoD.ColorizeState( f10_local2, { + material = RegisterMaterial( "box_white_gradient_fade_rt" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f0_local0.CompareStats.BGWidth, + top = 0, + bottom = 0, + alpha = 0.12 + } ) ) + f10_local6:animateToState( "default", 0 ) + self:addElement( f10_local6 ) + local f10_local7 = LUI.UIImage.new() + f10_local7.id = "stat_compare_bg_right" + f10_local7:registerAnimationState( "default", CoD.ColorizeState( f10_local2, { + material = RegisterMaterial( "box_white_gradient_fade" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = f0_local0.CompareStats.BGWidth, + right = 0, + top = 0, + bottom = 0, + alpha = 0.12 + } ) ) + f10_local7:animateToState( "default", 0 ) + self:addElement( f10_local7 ) + local f10_local8 = LUI.UIText.new() + f10_local8.id = "stat_compare_value_text" + f10_local8:registerAnimationState( "default", CoD.ColorizeState( f10_local3, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 5, + bottom = CoD.TextSettings.SmallFont.Height + 5, + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Center + } ) ) + f10_local8:animateToState( "default", 0 ) + f10_local8:setText( f10_local1 ) + self:addElement( f10_local8 ) + if f10_local4 then + local f10_local9 = LUI.UIImage.new() + f10_local9.id = "stat_compare_arrow" + f10_local9:registerAnimationState( "default", CoD.ColorizeState( f10_local2, { + material = f10_local4, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f0_local0.CompareStats.BGWidth - f0_local0.CompareStats.ArrowSize * 0.5, + right = f0_local0.CompareStats.BGWidth + f0_local0.CompareStats.ArrowSize, + top = 1, + bottom = 1 + f0_local0.CompareStats.ArrowSize, + alpha = 1 + } ) ) + f10_local9:animateToState( "default", 0 ) + self:addElement( f10_local9 ) + end + return self +end + +LUI.MenuBuilder.registerDef( "squad_report_detail_menu", squad_report_detail_menu ) +LUI.MenuBuilder.registerDef( "squad_report_detail_team_window", squad_report_detail_team_window ) +LUI.MenuBuilder.registerType( "squad_report_detail_stat_compare", squad_report_detail_stat_compare ) +LockTable( _M ) diff --git a/lui/mp_menus/squadreports.dec.lua b/lui/mp_menus/squadreports.dec.lua new file mode 100644 index 0000000..480b855 --- /dev/null +++ b/lui/mp_menus/squadreports.dec.lua @@ -0,0 +1,1140 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = { + Settings = { + BARREL_ANIM_SPEED = 100, + FADED_ALPHA = 0.5 + }, + ReportWindow = { + Top = 100, + Bottom = -70, + Width = 370, + Height = 854 + }, + ScoreBar = { + Height = 26, + HorizontalTextMargin = 10, + VerticalTextMargin = 2, + ValueAreaWidth = 123, + SplitImageWidth = 32, + ValueAreaBorder = 2, + PrimaryColor = { + r = 0.1, + g = 0.1, + b = 0.1, + a = 0.8 + }, + ValueAreaColor = { + r = 0.4, + g = 0.4, + b = 0.4, + a = 0.6 + } + }, + VisibleWindowsIDs = { + Left = "squad_report_entry_window_1", + Center = "squad_report_entry_window_2", + Right = "squad_report_entry_window_3" + } +} +function InitReportWindow( f1_arg0, f1_arg1 ) + RefreshReportWindow( f1_arg0, f1_arg1.controller, f1_arg1.reportIndex ) + if f1_arg0.id == f0_local0.VisibleWindowsIDs.Center then + f1_arg0:dispatchEventToChildren( { + name = "squad_report_set_primary", + animSpeed = 0 + } ) + else + f1_arg0:dispatchEventToChildren( { + name = "squad_report_set_secondary", + animSpeed = 0 + } ) + end +end + +function RefreshReportWindow( f2_arg0, f2_arg1, f2_arg2 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "squad_reports_menu" ) + f2_arg0.properties.reportIndex = f2_arg2 + f2_arg0:processEvent( { + name = "squad_report_set_report_index", + reportIndex = f2_arg2, + maxIndex = f2_local0.reportCount + } ) + if not f2_local0 or not f2_local0.reportData or #f2_local0.reportData == 0 then + return + end + local f2_local1 = f2_local0.reportData[f2_arg2] + f2_arg0.reportData = f2_local1 + if f2_local1.enemySquadName then + f2_arg0:processEvent( { + name = "squad_report_set_squad_name", + enemyName = f2_local1.enemySquadName + } ) + end + f2_arg0:processEvent( { + name = "squad_report_set_match_info", + mapName = f2_local1.mapName, + gametype = f2_local1.gametype, + timeText = f2_local1.timeString + } ) + f2_arg0:processEvent( { + name = "update_playercard", + gamertag = f2_local1.enemyPlayercardProps.gamertag, + clantag = f2_local1.enemyPlayercardProps.clantag, + rank = f2_local1.enemyPlayercardProps.rank, + prestige = f2_local1.enemyPlayercardProps.prestige, + background = f2_local1.enemyPlayercardProps.background, + patchEmblem = f2_local1.enemyPlayercardProps.patchEmblem, + patchShape = f2_local1.enemyPlayercardProps.patchShape + } ) + f2_arg0:processEvent( { + name = "squad_report_set_match_outcome", + reportData = f2_local1 + } ) + f2_arg0:processEvent( { + name = "set_score_value_text_your_score", + text = f2_local1.yourScore + } ) + f2_arg0:processEvent( { + name = "set_score_value_text_enemy_score", + text = f2_local1.enemyScore + } ) + f2_arg0:processEvent( { + name = "set_xp_text", + text = f2_local1.xpString, + didEarnXP = f2_local1.didEarnXP + } ) +end + +function RefreshReportData( f3_arg0 ) + local f3_local0 = f3_arg0.controller + f3_arg0.reportData = {} + local f3_local1 = 0 + local f3_local2 = nil + for f3_local3 = 0, SvS.Reports.MaxReports - 1, 1 do + f3_local2 = SvS.GetSquadReportData( f3_local0, f3_local3 ) + if f3_local2 then + f3_local1 = f3_local1 + 1 + f3_arg0.reportData[f3_local1] = f3_local2 + end + end + return f3_local1 +end + +function SquadReportsCreate( f4_arg0, f4_arg1 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + local f4_local1 = f4_local0.controller + Squad.UpdateReportPlayerCardCache( f4_local1 ) + f4_arg0:dispatchEventToRoot( LUI.ButtonHelperText.CommonEvents.addBackButton ) + local f4_local2 = f4_arg0:getFirstDescendentById( "reports_list" ) + f4_local0.barrelList = f4_local2 + f4_local2:setupForAnimation( squad_reports_entry, {}, true ) + f4_local0.reportCount = RefreshReportData( f4_local0 ) + if f4_local0.reportCount == 0 then + f4_arg0:dispatchEventToChildren( { + name = "hide_squad_reports_list", + [1] = f4_arg1.controller + } ) + return + end + f4_arg0:dispatchEventToChildren( { + name = "init_report_1", + controller = f4_local1, + reportIndex = f4_local0.reportCount + } ) + f4_arg0:dispatchEventToChildren( { + name = "init_report_2", + controller = f4_local1, + reportIndex = 1 + } ) + local f4_local3 = f4_arg0 + local f4_local4 = f4_arg0.dispatchEventToChildren + local f4_local5 = { + name = "init_report_3", + controller = f4_local1 + } + local f4_local6 + if f4_local0.reportCount > 1 then + f4_local6 = 2 + if not f4_local6 then + + else + f4_local5.reportIndex = f4_local6 + f4_local4( f4_local3, f4_local5 ) + if CanChallenge() then + f4_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "LUA_MENU_CHALLENGE" ), + side = "left", + clickable = true + } ) + end + end + end + f4_local6 = 1 +end + +function HandleDataRefresh( f5_arg0, f5_arg1 ) + local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 ) + if f5_local0.reportCount == 0 then + return + else + f5_local0.reportCount = RefreshReportData( f5_local0 ) + f5_arg0:processEvent( { + name = "refresh_report_window", + controller = f5_local0.controller + } ) + LUI.FlowManager.RequestPopupMenu( f5_arg0, "updating_squad_reports", true, f5_local0.controller ) + end +end + +function SetReportWindowAsPrimary( f6_arg0, f6_arg1 ) + f6_arg0:animateToState( "default", f6_arg1.animSpeed or 0, true, true ) +end + +function SetReportWindowAsSecondary( f7_arg0, f7_arg1 ) + f7_arg0:animateToState( "faded", f7_arg1.animSpeed or 0, true, true ) +end + +function OnBarrelAnimStart( f8_arg0, f8_arg1 ) + local f8_local0 = f8_arg1.barrelList:getCurrentIndex() + local f8_local1 = false + if not (not f8_arg1.movingRight or f8_arg0.id ~= f0_local0.VisibleWindowsIDs.Left) or f8_arg1.movingLeft and f8_arg0.id == f0_local0.VisibleWindowsIDs.Right then + f8_local1 = true + end + local f8_local2 = f8_arg0 + local f8_local3 = f8_arg0.dispatchEventToChildren + local f8_local4 = {} + local f8_local5 + if f8_local1 then + f8_local5 = "squad_report_set_primary" + if not f8_local5 then + + else + f8_local4.name = f8_local5 + f8_local4.animSpeed = f0_local0.Settings.BARREL_ANIM_SPEED + f8_local3( f8_local2, f8_local4 ) + end + end + f8_local5 = "squad_report_set_secondary" +end + +function OnBarrelAnimFinished( f9_arg0, f9_arg1 ) + if f9_arg0.id == f0_local0.VisibleWindowsIDs.Center then + f9_arg0:dispatchEventToChildren( { + name = "squad_report_set_primary", + animSpeed = 0 + } ) + else + f9_arg0:dispatchEventToChildren( { + name = "squad_report_set_secondary", + animSpeed = 0 + } ) + end +end + +function OnBarrelIndexUpdate( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg1.controller + if not f10_local0 then + f10_local0 = Engine.GetFirstActiveController() + end + local f10_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "squad_reports_menu" ) + if not f10_local1 or not f10_local1.reportCount or f10_local1.reportCount == 0 then + return + else + RefreshReportWindow( f10_arg0, f10_local0, ConvertBarrelIndex( f10_arg1.index, f10_local1.reportCount ) ) + end +end + +function ConvertBarrelIndex( f11_arg0, f11_arg1 ) + return f11_arg0 % f11_arg1 + 1 +end + +function OnBarrelScrollStart( f12_arg0 ) + Engine.PlaySound( CoD.SFX.CharacterSlide ) +end + +function CanChallenge() + local f13_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "squad_reports_menu" ) + if not f13_local0 or not f13_local0.reportCount or f13_local0.reportCount < 1 then + return + elseif Engine.InLobby() or Lobby.IsInPrivateParty() and not Lobby.IsPrivatePartyHost() then + return false + elseif f13_local0.fromSquadsModeMenu or f13_local0.fromLiveLobby then + return false + else + return true + end +end + +function ChallengeSquad( f14_arg0, f14_arg1 ) + local f14_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "squad_reports_menu" ) + if not CanChallenge() then + return + elseif IsFirstTimeFlowRequired( f14_arg1.controller ) then + LUI.FlowManager.RequestAddMenu( f14_arg0, "cac_member_select_main", true, f14_arg1.controller, false, { + next_screen = "cac_edit_main", + squad_location = "squadMembers", + class_location = "loadouts", + findMatch = true + } ) + return + elseif f14_local0.fromSquadsModeMenu then + return + end + local f14_local1, f14_local2 = Squad.ChallengePlayer( f14_arg1.controller, f14_local0.reportData[f14_arg0.properties.reportIndex].reportIndex ) + if f14_local1 == -1 or f14_local2 == -1 then + return + elseif Playlist.DoAction( f14_local1, f14_local2, false, false ) then + local f14_local3 = false + local f14_local4 = false + local f14_local5 = {} + Squad.StartMatch( f14_arg1.controller, false ) + Engine.SetDvarBool( "squad_find_match", true ) + if SvS.GetCurrentSquadModeInfo() ~= SvS.SquadModes.SquadAssault then + SvS.SetCurrentSquadModeInfo( SvS.SquadModes.SquadAssault ) + end + LUI.FlowManager.RequestAddMenu( f14_arg0, "menu_xboxlive_lobby", f14_local4, f14_arg1.controller, f14_local3, f14_local5 ) + end +end + +function BuildScoreBar( f15_arg0, f15_arg1 ) + local f15_local0 = f0_local0.ScoreBar + local self = LUI.UIElement.new() + self.id = "squad_report_score_bar_bg_" .. f15_arg0 + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = f15_local0.Height + } ) + self:animateToState( "default", 0 ) + local f15_local2 = LUI.UIImage.new() + f15_local2:registerAnimationState( "default", CoD.ColorizeState( Colors.black, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = -112, + alpha = 0.15 + } ) ) + f15_local2:animateToState( "default", 0 ) + self:addElement( f15_local2 ) + local f15_local3 = LUI.UIImage.new() + f15_local3:registerAnimationState( "default", CoD.ColorizeState( Colors.black, { + material = RegisterMaterial( "box_stat_cap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -112, + right = -80, + zRot = 180, + alpha = 0.15 + } ) ) + f15_local3:animateToState( "default", 0 ) + self:addElement( f15_local3 ) + local f15_local4 = LUI.UIImage.new() + f15_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( "box_stat_cap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -112, + right = -80, + alpha = 0.05 + } ) ) + f15_local4:animateToState( "default", 0 ) + self:addElement( f15_local4 ) + local f15_local5 = LUI.UIImage.new() + f15_local5.id = "squad_report_score_bar_value_area_bg" + f15_local5:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -80, + right = 0, + alpha = 0.05 + } ) ) + f15_local5:animateToState( "default", 0 ) + self:addElement( f15_local5 ) + local f15_local6 = LUI.UIMarqueeText.new() + f15_local6.id = "squad_report_score_bar_title_text" + f15_local6:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = f15_local0.HorizontalTextMargin, + right = -112, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) ) + f15_local6:animateToState( "default", 0 ) + f15_local6:setText( f15_arg1 ) + self:addElement( f15_local6 ) + local f15_local7 = LUI.UIText.new() + f15_local7.id = "squad_report_score_bar_value_text" + f15_local7:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = -112, + right = -f15_local0.HorizontalTextMargin, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right + } ) ) + f15_local7:animateToState( "default", 0 ) + f15_local7:registerEventHandler( "set_score_value_text_" .. f15_arg0, function ( element, event ) + element:setText( event.text ) + end ) + self:addElement( f15_local7 ) + return self +end + +function BuildSquadWindowBase( f17_arg0, f17_arg1 ) + if not f17_arg0 then + f17_arg0 = {} + end + local f17_local0 = f17_arg0.reportIndex or 0 + local self = LUI.UIElement.new() + self.id = "squad_reports_entry" + if not f17_arg1 then + f17_arg1 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f0_local0.ReportWindow.Width + } + end + self:registerAnimationState( "default", f17_arg1 ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self.properties = { + reportIndex = f17_local0 + } + self:registerEventHandler( "barrel_index_update", OnBarrelIndexUpdate ) + self:registerEventHandler( "on_scroll_func", OnBarrelScrollStart ) + self:registerEventHandler( "barrel_anim_start", OnBarrelAnimStart ) + self:registerEventHandler( "barrel_default_state", OnBarrelAnimFinished ) + self:registerEventHandler( "barrel_list_button_alt1", ChallengeSquad ) + self:registerEventHandler( "refresh_report_window", function ( element, event ) + if element.properties.reportIndex then + RefreshReportWindow( element, event.controller, element.properties.reportIndex ) + end + end ) + self:animateToState( "default", 0 ) + local f17_local2 = LUI.MenuGenerics.generic_menu_background( {}, { + fill_alpha = 1, + hide_bottom = true + } ) + f17_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = GenericTitleBarDims.TitleBarHeight + } ) + f17_local2:animateToState( "default" ) + self:addElement( f17_local2 ) + local f17_local3 = LUI.MenuGenerics.generic_menu_background_withfade( {}, { + fill_alpha = 1, + top_offset = Cac.Layout.InfoPane.header_height - 1 + } ) + f17_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f17_local3:animateToState( "default" ) + self:addElement( f17_local3 ) + local f17_local4 = LUI.UIVerticalList.new() + f17_local4.id = "squad_report_outer_list" + f17_local4:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = Cac.Layout.InfoPane.header_height + 4, + bottom = 0, + spacing = 10 + } ) + f17_local4:animateToState( "default", 0 ) + self:addElement( f17_local4 ) + local f17_local5 = LUI.UIText.new() + f17_local5.id = "title_text" + f17_local5:registerAnimationState( "default", CoD.ColorizeState( Colors.window_title_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + height = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center + } ) ) + f17_local5:setTextStyle( CoD.TextStyle.Outlined ) + for f17_local9, f17_local10 in ipairs( SvS.Reports.MatchOutcomeArray ) do + f17_local5:registerAnimationState( f17_local10, CoD.ColorizeState( SvS.Reports.MatchOutcomeColors[f17_local10].textColor, {} ) ) + end + f17_local5:registerEventHandler( "squad_report_set_match_outcome", function ( element, event ) + local f19_local0 = event.reportData + element:setText( SvS.GetReportOutcomeText( f19_local0.matchOutcome ) ) + element:animateToState( f19_local0.matchOutcome ) + end ) + if f17_arg0.titleText then + f17_local5:setText( f17_arg0.titleText ) + end + f17_local5:animateToState( "default", 0 ) + f17_local2:addElement( f17_local5 ) + return self, f17_local4 +end + +function squad_reports_entry( f20_arg0, f20_arg1 ) + if not f20_arg1 then + f20_arg1 = {} + end + local f20_local0, f20_local1 = BuildSquadWindowBase( f20_arg1 ) + local self = LUI.UIText.new() + self.id = "squad_name_text" + self:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center + } ) ) + self:registerEventHandler( "squad_report_set_squad_name", function ( element, event ) + element:setText( Engine.Localize( "LUA_MENU_SQUAD_LABEL", Engine.MarkLocalized( event.enemyName ) ) ) + end ) + self:animateToState( "default", 0 ) + f20_local1:addElement( self ) + local f20_local3 = LUI.Playercard.new( nil, {}, 0 ) + f20_local3.id = "playercard_id" + f20_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -5, + left = 0, + height = 90, + width = 100, + alpha = 1, + scale = -0.19 + } ) + f20_local3:registerEventHandler( "refresh_report_playercard", function ( element, event ) + local f22_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if not f22_local0 or f22_local0.reportCount == 0 then + return + end + local f22_local1 = f22_local0.reportData[f20_arg1.reportIndex] + local f22_local2 = Squad.GetReportPlayercard( f22_local0.controller, f22_local1.reportIndex ) + if f22_local2 then + local f22_local3 = { + name = "update_playercard", + gamertag = f22_local1.enemyPlayercardProps.gamertag, + clantag = f22_local1.enemyPlayercardProps.clantag, + rank = f22_local2.rank, + prestige = f22_local2.prestige, + background = f22_local2.background, + patchEmblem = f22_local2.patchEmblem + } + element:processEvent( f22_local3 ) + f22_local1.enemyPlayercardProps = f22_local3 + end + end ) + f20_local3:animateToState( "default", 0 ) + f20_local1:addElement( f20_local3 ) + if f20_arg1.reportIndex then + local f20_local4 = LUI.UITimer.new( 250, "refresh_report_playercard", "report_playercards" ) + f20_local4.id = "playercard_refresh_timer_id" + f20_local3:addElement( f20_local4 ) + end + local f20_local4 = LUI.UIText.new() + f20_local4.id = "squad_report_xp_text" + f20_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.yellow, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) ) + f20_local4:registerAnimationState( "color_yellow", CoD.ColorizeState( Colors.yellow, {} ) ) + f20_local4:registerAnimationState( "color_normal", CoD.ColorizeState( Colors.primary_text_color, {} ) ) + f20_local4:registerEventHandler( "set_xp_text", function ( element, event ) + if event.didEarnXP then + element:animateToState( "color_yellow" ) + else + element:animateToState( "color_normal" ) + end + element:setText( event.text or "" ) + end ) + f20_local4:animateToState( "default", 0 ) + f20_local1:addElement( f20_local4 ) + local f20_local5 = LUI.UIElement.new() + f20_local5.id = "match_info_container" + f20_local5:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 10, + right = -10, + top = 0, + bottom = 369 + } ) + f20_local5:animateToState( "default", 0 ) + f20_local1:addElement( f20_local5 ) + local f20_local6 = LUI.UIImage.new() + f20_local6.id = "match_info_background" + f20_local6:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( "box_white_gradient_top" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0.05 + } ) ) + f20_local6:animateToState( "default", 0 ) + f20_local5:addElement( f20_local6 ) + local f20_local7 = LUI.UIVerticalList.new() + f20_local7.id = "match_info_list" + f20_local7:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 10, + right = -10, + top = 7, + bottom = 0, + spacing = 6 + } ) + f20_local7:animateToState( "default", 0 ) + f20_local5:addElement( f20_local7 ) + local f20_local8 = LUI.UIText.new() + f20_local8.id = "match_info_map_text" + f20_local8:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) ) + f20_local8:registerEventHandler( "squad_report_set_match_info", function ( element, event ) + local f24_local0 = "" + local f24_local1 = Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, event.gametype, GameTypesTable.Cols.Name ) + if f24_local1 and f24_local1 ~= "" then + element:setText( Engine.Localize( "LUA_MENU_MODE_AND_MAP_FORMAT", f24_local1, Engine.MarkLocalized( Squad.GetRealBaseNameFromLoadName( event.mapName ) ) ) ) + end + end ) + f20_local8:animateToState( "default", 0 ) + f20_local7:addElement( f20_local8 ) + local f20_local9 = LUI.UIText.new() + f20_local9.id = "match_info_time_text" + f20_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.secondary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) ) + f20_local9:registerEventHandler( "squad_report_set_match_info", function ( element, event ) + element:setText( event.timeText or "" ) + end ) + f20_local9:animateToState( "default", 0 ) + f20_local7:addElement( f20_local9 ) + f20_local7:addElement( BuildScoreBar( "your_score", Engine.Localize( "LUA_MENU_YOUR_SQUAD_SCORE" ) ) ) + f20_local7:addElement( BuildScoreBar( "enemy_score", Engine.Localize( "LUA_MENU_ENEMY_SQUAD_SCORE" ) ) ) + local f20_local10 = LUI.UIImage.new() + f20_local10.id = "match_info_map_image" + f20_local10:registerAnimationState( "default", { + material = RegisterMaterial( "preview_mp_snow" ), + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 3, + right = 327, + top = 0, + bottom = 184, + red = 1, + blue = 1, + green = 1, + alpha = 1 + } ) + f20_local10:registerEventHandler( "squad_report_set_match_info", function ( element, event ) + CoD.SetMaterial( element, RegisterMaterial( "preview_" .. event.mapName ) ) + end ) + f20_local10:animateToState( "default", 0 ) + f20_local7:addElement( f20_local10 ) + local f20_local11 = LUI.UIText.new() + f20_local11.id = "count_text" + f20_local11:registerAnimationState( "default", CoD.ColorizeState( { + r = 0.6, + b = 0.6, + g = 0.6 + }, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) ) + f20_local11:registerEventHandler( "squad_report_set_report_index", function ( element, event ) + element:setText( Engine.Localize( "LUA_MENU_REPORT_COUNT_FORMAT", event.reportIndex or 0, event.maxIndex or 0 ) ) + end ) + f20_local11:animateToState( "default", 0 ) + f20_local7:addElement( f20_local11 ) + local f20_local12 = LUI.UIImage.new() + f20_local12.id = "squad_reports_fade_overlay" + f20_local12:registerAnimationState( "default", CoD.ColorizeState( { + r = 0, + b = 0, + g = 0 + }, { + material = RegisterMaterial( "white" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0 + } ) ) + f20_local12:registerAnimationState( "faded", { + alpha = f0_local0.Settings.FADED_ALPHA + } ) + f20_local12:registerEventHandler( "squad_report_set_primary", SetReportWindowAsPrimary ) + f20_local12:registerEventHandler( "squad_report_set_secondary", SetReportWindowAsSecondary ) + f20_local12:animateToState( "default", 0 ) + f20_local0:addElement( f20_local12 ) + return f20_local0 +end + +function squad_reports_empty_entry( f28_arg0, f28_arg1 ) + if not f28_arg1 then + f28_arg1 = {} + end + local f28_local0 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 640 - f0_local0.ReportWindow.Width / 2, + right = -640 + f0_local0.ReportWindow.Width / 2, + top = f0_local0.ReportWindow.Top, + bottom = f0_local0.ReportWindow.Bottom, + alpha = 1 + } + f28_arg1.titleText = Engine.Localize( "LUA_MENU_NO_REPORTS_TITLE" ) + local f28_local1, f28_local2 = BuildSquadWindowBase( f28_arg1, f28_local0 ) + local self = LUI.UIElement.new() + self.id = "squad_report_no_reports_spacer_1" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + height = 200 + } ) + self:animateToState( "default", 0 ) + f28_local2:addElement( self ) + local f28_local4 = LUI.UIText.new() + f28_local4.id = "squad_report_no_reports_text" + f28_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 10, + right = -10, + top = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) ) + f28_local4:setText( Engine.Localize( "LUA_MENU_NO_REPORTS_DESC" ) ) + f28_local4:animateToState( "default", 0 ) + f28_local2:addElement( f28_local4 ) + f28_local1:animateToState( "hidden", 0 ) + return f28_local1 +end + +function SquadReportsFeeder( f29_arg0 ) + local f29_local0 = { + [#f29_local0 + 1] = { + type = "squad_reports_entry", + id = f0_local0.VisibleWindowsIDs.Left, + properties = { + reportIndex = 1 + }, + handlers = { + init_report_1 = InitReportWindow + } + }, + [#f29_local0 + 1] = { + type = "squad_reports_entry", + id = f0_local0.VisibleWindowsIDs.Center, + properties = { + reportIndex = 2 + }, + handlers = { + init_report_2 = InitReportWindow + } + }, + [#f29_local0 + 1] = { + type = "squad_reports_entry", + id = f0_local0.VisibleWindowsIDs.Right, + properties = { + reportIndex = 3 + }, + handlers = { + init_report_3 = InitReportWindow + } + } + } + return f29_local0 +end + +function squad_reports_menu() + return { + type = "UIElement", + id = "squad_reports_menu", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = SquadReportsCreate, + squad_reports_refresh_data = HandleDataRefresh + }, + children = { + { + type = "generic_menu_title", + id = "squad_reports_title_text_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS" ) + } + }, + { + type = "UIBarrelList", + id = "reports_list", + focusable = true, + properties = { + spacing = 56, + anim_speed = f0_local0.Settings.BARREL_ANIM_SPEED + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f0_local0.ReportWindow.Top, + bottom = f0_local0.ReportWindow.Bottom, + left = 28, + right = 0, + alignemnt = LUI.Alignment.Center + }, + hidden = { + alpha = 0 + } + }, + handlers = { + hide_squad_reports_list = function ( f31_arg0, f31_arg1 ) + f31_arg0:animateToState( "hidden", 0 ) + end + + }, + childrenFeeder = SquadReportsFeeder + }, + { + type = "squad_reports_empty_entry", + id = "squad_reports_empty_entry_window", + handlers = { + hide_squad_reports_list = function ( f32_arg0, f32_arg1 ) + f32_arg0:animateToState( "default", 0 ) + end + + } + }, + { + type = "UIButton", + id = "squad_reports_left_arrow", + requireFocusType = FocusType.MouseOver, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 100, + bottom = 130, + left = 420, + right = 445 + }, + shifted = MBh.BaseState( "default", { + left = 415, + right = 440 + } ), + hidden = { + alpha = 0 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "shifted", + 500, + true, + true + }, + { + "default", + 500, + true, + true + } + } ), + button_action = function ( f33_arg0, f33_arg1 ) + local f33_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f33_arg0 ) + if f33_local0.barrelList then + f33_local0.barrelList:decrement() + end + end + , + hide_squad_reports_list = function ( f34_arg0, f34_arg1 ) + f34_arg0:animateToState( "hidden", 0 ) + f34_arg0:processEvent( { + name = "disable" + } ) + f34_arg0.m_ignoreMouseFocus = true + end + + }, + children = { + { + type = "UIImage", + id = "squad_reports_left_arrow_image", + states = { + default = { + material = RegisterMaterial( "widg_margin_arrow_lt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5 + }, + over = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + hide_squad_reports_list = function ( f35_arg0, f35_arg1 ) + f35_arg0:animateToState( "hidden", 0 ) + end + + } + } + } + }, + { + type = "UIButton", + id = "squad_reports_right_arrow", + requireFocusType = FocusType.MouseOver, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 100, + bottom = 130, + left = 835, + right = 860 + }, + shifted = MBh.BaseState( "default", { + left = 840, + right = 865 + } ), + hidden = { + alpha = 0 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "shifted", + 500, + true, + true + }, + { + "default", + 500, + true, + true + } + } ), + button_action = function ( f36_arg0, f36_arg1 ) + local f36_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f36_arg0 ) + if f36_local0.barrelList then + f36_local0.barrelList:increment() + end + end + , + hide_squad_reports_list = function ( f37_arg0, f37_arg1 ) + f37_arg0:animateToState( "hidden", 0 ) + f37_arg0:processEvent( { + name = "disable" + } ) + f37_arg0.m_ignoreMouseFocus = true + end + + }, + children = { + { + type = "UIImage", + id = "squad_reports_right_arrow_image", + states = { + default = { + material = RegisterMaterial( "widg_margin_arrow_rt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5 + }, + over = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + hide_squad_reports_list = function ( f38_arg0, f38_arg1 ) + f38_arg0:animateToState( "hidden", 0 ) + end + + } + } + } + }, + { + type = "button_helper_text_main", + id = "squad_reports_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "squad_reports_friends_widget_id" + }, + { + type = "generic_back_button" + } + } + } +end + +LUI.MenuBuilder.registerDef( "squad_reports_menu", squad_reports_menu ) +LUI.MenuBuilder.registerType( "squad_reports_entry", squad_reports_entry ) +LUI.MenuBuilder.registerType( "squad_reports_empty_entry", squad_reports_empty_entry ) +LockTable( _M ) diff --git a/lui/mp_menus/squadsmodeselect.dec.lua b/lui/mp_menus/squadsmodeselect.dec.lua new file mode 100644 index 0000000..02cee3f --- /dev/null +++ b/lui/mp_menus/squadsmodeselect.dec.lua @@ -0,0 +1,1293 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function SquadsModeMenuCreate( f1_arg0, f1_arg1 ) + local f1_local0 = Engine.GetFirstActiveController() + assert( Engine.GetDvarBool( "onlinegame" ) ) + Engine.SetDvarBool( "squad_match", false ) + f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + if (Engine.IsPS3() or Engine.IsPS4()) and SvS.ShowChatRestrict == true then + f1_arg0:dispatchEventToRoot( { + name = "show_chat_restrict", + controller = f1_arg1.controller + } ) + SvS.ShowChatRestrict = false + end +end + +function SquadsHQCreate( f2_arg0, f2_arg1 ) + f2_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + Engine.ExecNow( "uploadstats", f2_arg1.controller ) +end + +function OnMenuBackOut( f3_arg0, f3_arg1 ) + local f3_local0 = Engine.GetFirstActiveController() + Engine.SetDvarBool( "onlinegame", false ) + Engine.SetDvarBool( "splitscreen", false ) + Engine.ExecNow( "forcesplitscreencontrol menu_xboxlive_CLOSE", f3_local0 ) + LUI.FlowManager.RequestLeaveMenu( f3_arg0 ) +end + +function SelectMode( f4_arg0, f4_arg1 ) + if not SvS.IsSquadModeDisabled( f4_arg1 ) then + Engine.ExecNow( "resetSplitscreenSignIn", f4_arg0 ) + Engine.SetDvarBool( "splitscreen", false ) + Engine.ExecNow( "xstartprivateparty", f4_arg0 ) + SvS.SetCurrentSquadModeInfo( f4_arg1 ) + LUI.FlowManager.RequestAddMenu( nil, "menu_xboxlive", false, f4_arg0, false ) + end +end + +function DisplaySubModePopup( f5_arg0, f5_arg1 ) + LUI.FlowManager.RequestPopupMenu( self, "squads_mode_sub_mode_popup", true, f5_arg0, false, { + categoryInfo = f5_arg1 + } ) +end + +function SubMenuSelectionAction( f6_arg0, f6_arg1 ) + return SelectMode( f6_arg1.controller, f6_arg0.properties.modeInfo ) +end + +function CategoryButtonAction( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0.properties.categoryInfo + if #f7_local0.Modes == 1 then + return SelectMode( f7_arg1.controller, f7_local0.Modes[1] ) + else + return DisplaySubModePopup( f7_arg1.controller, f7_local0 ) + end +end + +function CheckCategoryDisabled( f8_arg0 ) + for f8_local0 = 1, #f8_arg0.Modes, 1 do + if not SvS.IsSquadModeDisabled( f8_arg0.Modes[f8_local0] ) then + return false + end + end + return true +end + +function RefreshCategoryButtonDisabled( f9_arg0, f9_arg1 ) + local f9_local0 = CheckCategoryDisabled( f9_arg0.properties.categoryInfo ) + if f9_local0 and not f9_arg0.disabled then + f9_arg0:processEvent( { + name = "disable" + } ) + elseif not f9_local0 and f9_arg0.disabled then + f9_arg0:processEvent( { + name = "enable" + } ) + end +end + +function SubModePopupChildfeeder( f10_arg0 ) + assert( f10_arg0 and f10_arg0.categoryInfo ) + local f10_local0 = f10_arg0.categoryInfo + local f10_local1 = {} + for f10_local2 = 1, #f10_local0.Modes, 1 do + local f10_local5 = f10_local0.Modes[f10_local2] + if not SvS.IsSquadModeDisabled( f10_local5 ) then + local f10_local6, f10_local7 = SvS.GetPlaylistFromSquadMode( f10_local5 ) + f10_local1[#f10_local1 + 1] = { + type = "UIGenericButton", + id = "sub_mode_popup_" .. f10_local2, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Playlist.GetItemName( f10_local6, f10_local7 ), + modeInfo = f10_local5 + }, + handlers = { + button_action = SubMenuSelectionAction, + button_over = function ( f11_arg0, f11_arg1 ) + f11_arg0:dispatchEventToRoot( { + name = "update_popup_desc_text", + modeInfo = f11_arg0.properties.modeInfo, + immediate = true + } ) + end + } + } + end + end + return f10_local1 +end + +function squads_mode_sub_mode_popup() + local f12_local0 = 550 + local f12_local1 = 250 + local f12_local2 = 30 + return { + type = "UIElement", + id = "squads_mode_sub_mode_popup_container_id", + properties = { + categoryInfo = {} + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "squads_mode_sub_mode_popup_overlay_id", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = -200, + bottom = 175, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIElement", + id = "squads_mode_sub_mode_popup_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -(f12_local1 / 2 + f12_local2), + bottom = f12_local1 / 2 - f12_local2, + width = f12_local0 + } + }, + children = { + { + type = "generic_drop_shadow", + id = "squads_mode_sub_mode_popup_dropshadow_id", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + id = "squads_mode_sub_mode_popup_titlebar_id", + properties = { + title_bar_text = Engine.Localize( "MENU_GAME_TYPES" ), + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + id = "squads_mode_sub_mode_popup_background_id", + properties = { + fill_alpha = 1, + categoryInfo = MBh.Property( "categoryInfo" ) + }, + children = { + { + type = "UIElement", + id = "squads_mode_sub_mode_popup_icon_container_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 3, + left = 3, + width = 128, + height = 128 + } + }, + children = { + { + type = "UIImage", + id = "squads_mode_sub_mode_popup_icon_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -20, + width = 192, + height = 192 + } + }, + handlers = { + update_popup_desc_text = function ( f13_arg0, f13_arg1 ) + if f13_arg1.modeInfo then + local f13_local0 = SvS.GetSquadPlaylistImageByMode( f13_arg1.modeInfo ) + if f13_arg1.modeInfo == SvS.SquadModes.SafeguardExtended and f13_local0 == "icon_pl_safeguard" then + f13_local0 = "icon_pl_safeguard_extended" + end + if f13_local0 and f13_local0 ~= "" then + f13_arg0:setImage( RegisterMaterial( f13_local0 ) ) + end + end + end + + } + } + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 1, + bottom = -1, + left = 133, + width = 1, + material = RegisterMaterial( "white" ), + alpha = Swatches.GenericMenu.BackgroundAlpha + } ) + } + }, + { + type = "UIStencil", + id = "squads_mode_sub_mode_popup_list_container_id", + properties = { + categoryInfo = MBh.Property( "categoryInfo" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 5, + left = 138, + right = -5, + height = 115, + alignment = LUI.Alignment.Top + } + }, + children = { + { + type = "UIVerticalList", + id = "squads_mode_sub_mode_popup_list_id", + properties = { + categoryInfo = MBh.Property( "categoryInfo" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + childrenFeeder = SubModePopupChildfeeder + } + } + }, + { + type = "UIMarqueeText", + id = "squads_mode_sub_mode_popup_mode_desc_id", + properties = { + text = "", + useTextWrapping = true, + textHeight = CoD.TextSettings.NormalFont.Height + }, + states = { + default = CoD.ColorizeState( Colors.secondary_text_color, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 115, + left = 138, + right = -5, + height = 3 * CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) + }, + handlers = { + update_popup_desc_text = function ( f14_arg0, f14_arg1 ) + if f14_arg1.modeInfo then + f14_arg0:setText( SvS.GetSquadModeDesc( f14_arg1.modeInfo ) ) + end + end + + } + }, + { + type = "UIText", + id = "squads_mode_sub_mode_popup_player_desc_id", + properties = { + categoryInfo = MBh.Property( "categoryInfo" ) + }, + states = { + default = CoD.ColorizeState( Colors.secondary_text_color, { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = -10, + left = 138, + right = -5, + height = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center + } ) + }, + handlers = { + menu_create = function ( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg0.properties.categoryInfo.PlayersAltDescLocRef + local f15_local1 = "" + if f15_local0 ~= "" then + f15_local1 = Engine.Localize( f15_local0 ) + end + f15_arg0:setText( f15_local1 ) + end + + } + } + } + } + } + }, + { + type = "UIBindButton", + handlers = { + button_secondary = function ( f16_arg0, f16_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f16_arg0 ) + end + + } + } + } + } +end + +function BuildSquadsCategoryButton( f17_arg0 ) + return { + type = "UIGenericButton", + id = "squads_mode_button_" .. f17_arg0.Devname, + disabled = CheckCategoryDisabled( f17_arg0 ), + listDefaultFocus = SvS.GetSquadCategoryFromMode( SvS.GetCurrentSquadModeInfo() ) == f17_arg0, + properties = { + button_text = Engine.Localize( f17_arg0.NameLocRefCaps ), + button_action_func = CategoryButtonAction, + categoryInfo = f17_arg0, + additional_handlers = { + check_buttons = RefreshCategoryButtonDisabled + } + }, + handlers = { + button_over = function ( f18_arg0, f18_arg1 ) + f18_arg0:dispatchEventToRoot( { + name = "update_squads_mode_desc", + categoryInfo = f17_arg0 + } ) + end + , + button_over_disable = function ( f19_arg0, f19_arg1 ) + f19_arg0:dispatchEventToRoot( { + name = "update_squads_mode_desc", + categoryInfo = f17_arg0 + } ) + end + + } + } +end + +function HideDescPanelEvent( f20_arg0, f20_arg1 ) + f20_arg0:dispatchEventToRoot( { + name = "update_squads_mode_desc" + } ) +end + +function SquadsModeMainButtonListChildFeeder( f21_arg0 ) + local f21_local0 = {} + for f21_local1 = 1, #SvS.SquadCategories, 1 do + f21_local0[#f21_local0 + 1] = BuildSquadsCategoryButton( SvS.SquadCategories[f21_local1] ) + end + local f21_local1 = Engine.GetDvarInt( "num_available_map_packs" ) + if 1 <= f21_local1 or f21_local1 < #SvS.SquadDLCCategories then + f21_local0[#f21_local0 + 1] = BuildSquadsCategoryButton( SvS.SquadDLCCategories[f21_local1] ) + end + f21_local0[#f21_local0 + 1] = { + type = "generic_separator", + id = "spacer_line_id" + } + f21_local0[#f21_local0 + 1] = { + type = "UIGenericButton", + id = "squads_mode_button_squad_reports", + properties = { + button_text = Engine.Localize( "@LUA_MENU_SQUAD_HQ_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_SQUAD_HQ_DESC" ), + button_action_func = function ( f22_arg0, f22_arg1 ) + LUI.FlowManager.RequestAddMenu( f22_arg0, "squads_hq_menu", true, f22_arg1.controller, false, { + controller = f22_arg1.controller + } ) + end, + additional_handlers = { + button_over = HideDescPanelEvent + } + } + } + f21_local0[#f21_local0 + 1] = { + type = "UIGenericButton", + id = "store_button_id", + disabled = false, + properties = { + button_text = Engine.Localize( "@LUA_MENU_STORE_CAPS" ), + button_action_func = function ( f23_arg0, f23_arg1 ) + Cac.ClearAllNewIconsForType( f23_arg1.controller, "Store" ) + Sns.OpenStoreMenu( f23_arg1.controller ) + end, + desc_text = Engine.Localize( "@LUA_MENU_STORE_DESC" ), + additional_handlers = { + button_over = HideDescPanelEvent, + refresh_new_icons = function ( f24_arg0, f24_arg1 ) + if Cac.AnyUnseenMDLCItems( Engine.GetFirstActiveController(), { + "Store" + } ) then + f24_arg0:processEvent( { + name = "show_new_icon" + } ) + end + end + } + } + } + f21_local0[#f21_local0 + 1] = { + type = "button_desc_text", + id = "squads_mode_desc_text_id", + states = { + default = {}, + visible = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_squads_mode_desc = function ( f25_arg0, f25_arg1 ) + if f25_arg1.categoryInfo then + f25_arg0:animateToState( "hidden", 100 ) + else + f25_arg0:animateToState( "visible", 100 ) + end + end + } + } + return f21_local0 +end + +function squad_mode_desc_pane() + local f26_local0 = 100 - GenericTitleBarDims.TitleBarHeight + local f26_local1 = 650 + return { + type = "UIElement", + id = "gamemode_desc_pane_id", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = -120, + right = 576, + top = 1024, + bottom = 1024 + f26_local1 - f26_local0 + }, + visible = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -120, + right = 576, + top = f26_local0, + bottom = f26_local1 + } + }, + handlers = { + update_squads_mode_desc = function ( f27_arg0, f27_arg1 ) + if f27_arg1.categoryInfo and f27_arg1.categoryInfo.Image ~= "" then + f27_arg0:animateToState( "visible", 250 ) + else + f27_arg0:animateToState( "default", 250 ) + end + f27_arg0:dispatchEventToChildren( f27_arg1 ) + end + + }, + children = { + { + type = "generic_menu_background_withfade", + id = "gamemode_bg_fade_id", + properties = { + shadow_top_offset = GenericTitleBarDims.TitleBarHeight + }, + children = { + { + type = "UIImage", + id = "gamemode_image_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericTitleBarDims.TitleBarHeight + 10, + left = 10, + height = 370, + width = 676 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_squads_mode_desc = function ( f28_arg0, f28_arg1 ) + if f28_arg1.categoryInfo and f28_arg1.categoryInfo.Image ~= "" then + f28_arg0:setImage( RegisterMaterial( f28_arg1.categoryInfo.Image ) ) + end + end + + } + }, + { + type = "UIImage", + id = "playlist_image_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 325, + left = -40, + width = 256, + height = 256, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_squads_mode_desc = function ( f29_arg0, f29_arg1 ) + if f29_arg1.categoryInfo then + local f29_local0 = SvS.GetSquadPlaylistImage( f29_arg1.categoryInfo ) + if f29_local0 == "" and f29_arg1.categoryInfo.Devname == "squads_dlc" then + f29_local0 = SvS.GetSquadPlaylistImage( SvS.SquadDLCCategories[1] ) + end + if f29_local0 and f29_local0 ~= "" then + f29_arg0:setImage( RegisterMaterial( f29_local0 ) ) + f29_arg0:animateToState( "default", 0 ) + else + f29_arg0:animateToState( "hidden", 0 ) + end + end + end + + } + }, + { + type = "UIMarqueeText", + id = "gamemode_desc_id", + properties = { + textHeight = CoD.TextSettings.NormalFont.Height, + useTextWrapping = true + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 165, + top = 415, + right = -5, + height = CoD.TextSettings.NormalFont.Height * 3, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + }, + handlers = { + update_squads_mode_desc = function ( f30_arg0, f30_arg1 ) + if f30_arg1.categoryInfo then + f30_arg0:setText( SvS.GetSquadCategoryDesc( f30_arg1.categoryInfo ) ) + end + end + + } + }, + { + type = "UIText", + id = "gamemode_players_desc_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 165, + top = 490, + right = -5, + height = CoD.TextSettings.ExtraBigFont.Height + 10, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + } + }, + handlers = { + update_squads_mode_desc = function ( f31_arg0, f31_arg1 ) + local f31_local0 = "" + if f31_arg1.categoryInfo and f31_arg1.categoryInfo.PlayersDescLocRef ~= "" then + f31_local0 = Engine.Localize( f31_arg1.categoryInfo.PlayersDescLocRef ) + end + f31_arg0:setText( f31_local0 ) + end + + } + } + } + } + } + } +end + +function SquadsShowChatRestrict( f32_arg0, f32_arg1 ) + if Engine.IsPS3() or Engine.IsPS4() then + LUI.FlowManager.RequestPopupMenu( f32_arg0, "mp_no_squad_assault", true, f32_arg1.controller, false ) + end +end + +function squads_mode_select_menu() + return { + type = "UIElement", + id = "squads_mode_select_menu", + properties = { + additional_handlers = { + gain_focus = function ( f34_arg0, f34_arg1 ) + f34_arg0:dispatchEventToRoot( { + name = "refresh_new_icons", + immediate = true + } ) + f34_arg0:dispatchEventToRoot( { + name = "open_motd", + immediate = true + } ) + end + , + restore_focus = function ( f35_arg0, f35_arg1 ) + f35_arg0:dispatchEventToRoot( { + name = "refresh_new_icons", + immediate = true + } ) + end + + } + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = SquadsModeMenuCreate, + show_chat_restrict = SquadsShowChatRestrict + }, + children = { + { + type = "generic_menu_title", + id = "squads_mode_select_menu_title_text_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_SQUAD_MODE_CAPS" ) + } + }, + { + type = "UIVerticalList", + id = "squads_mode_select_menu_button_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + alignment = LUI.Alignment.Top + } + }, + childrenFeeder = SquadsModeMainButtonListChildFeeder + }, + { + type = "squad_mode_desc_pane", + id = "squads_mode_select_desc_pane_id" + }, + { + type = "button_helper_text_main", + id = "squads_mode_select_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "squads_mode_select_friends_widget_id" + }, + { + type = "SocialFeedTicker", + id = "social_ticker_id" + }, + { + type = "UIBindButton", + id = "squads_mode_select_bind_button", + handlers = { + button_secondary = OnMenuBackOut + } + }, + { + type = "UITimer", + id = "bnt_lock_tmr", + properties = { + event = "check_buttons", + interval = 100, + disposable = false + } + } + } + } +end + +function squads_hq_stat_bar() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 26, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "squads_hq_stat_bar_bg", + states = { + default = CoD.ColorizeState( Colors.very_dark_cyan, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = 0.8 + } ) + } + }, + { + type = "UIImage", + id = "squads_hq_stat_bar_cap", + states = { + default = CoD.ColorizeState( Colors.grey_22, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -272, + right = -240, + material = RegisterMaterial( "box_angle_ltcap" ), + alpha = 0.5 + } ) + } + }, + { + type = "UIImage", + id = "squads_hq_stat_bar_alt_bg", + states = { + default = CoD.ColorizeState( Colors.grey_22, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -240, + right = 0, + material = RegisterMaterial( "white" ), + alpha = 0.5 + } ) + } + }, + { + type = "UIText", + id = "squads_hq_stat_bar_title_text", + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 3, + bottom = 3 + CoD.TextSettings.NormalFont.Height, + left = 5, + right = 300, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left + } ) + }, + properties = { + text = MBh.Property( "title_text" ) + } + }, + { + type = "UIText", + id = "squads_hq_stat_bar_value_text", + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 3, + bottom = 3 + CoD.TextSettings.NormalFont.Height, + left = -240, + right = -10, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ) + }, + properties = { + text = MBh.Property( "value_text" ) + }, + handlers = { + set_stat_value = function ( f37_arg0, f37_arg1 ) + f37_arg0:setText( f37_arg1.text ) + end + + } + } + } + } +end + +function SquadsHQStatListChildFeeder( f38_arg0 ) + local f38_local0 = {} + local f38_local1 = f38_arg0.exclusiveController + local f38_local2 = SvS.GetLocalPlayerBaseName( f38_local1 ) + local f38_local3 = Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "squadHQ", "squad_mode" ) + local f38_local4 = nil + if f38_local3 then + f38_local4 = Engine.Localize( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f38_local3, GameTypesTable.Cols.Name ) ) + end + local f38_local5 = Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "squadHQ", "wins" ) + local f38_local6 = Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "squadHQ", "loses" ) + local f38_local7 = Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "squadHQ", "win_streak" ) + local f38_local8 = Engine.FormatTimeHoursMinutesSeconds( Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "prestigeDoubleXpMaxTimePlayed" ) - Engine.GetPlayerDataEx( f38_local1, CoD.StatsGroup.Ranked, "prestigeDoubleXpTimePlayed" ) ) + local f38_local9 = nil + if f38_local5 + f38_local6 == 0 then + f38_local9 = 0 + elseif f38_local6 == 0 then + f38_local9 = f38_local5 + elseif f38_local5 == 0 then + f38_local9 = 0 + else + f38_local9 = f38_local5 / f38_local6 + end + local f38_local10 = string.format( "%.3f", f38_local9 ) + f38_local0[#f38_local0 + 1] = { + type = "UIImage", + id = "squads_hq_stat_map_image_id", + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + height = 256, + width = 512, + material = RegisterMaterial( SvS.GetBasePreviewImageLarge( f38_local2 ) ) + } ) + } + } + f38_local0[#f38_local0 + 1] = { + type = "squads_hq_stat_bar", + id = "squads_hq_stat_name_id", + properties = { + title_text = Engine.Localize( "LUA_MENU_SQUAD_NAME" ), + value_text = Engine.MarkLocalized( Squad.GetPlayerSquadName( f38_arg0.exclusiveController ) ), + exclusiveController = f38_arg0.exclusiveController + }, + handlers = { + update_squad_name = function ( f39_arg0, f39_arg1 ) + f39_arg0:processEvent( { + name = "set_stat_value", + text = Engine.MarkLocalized( Squad.GetPlayerSquadName( f39_arg0.properties.exclusiveController ) ) + } ) + end + } + } + f38_local0[#f38_local0 + 1] = { + type = "squads_hq_stat_bar", + id = "squads_hq_stat_mode_id", + properties = { + title_text = Engine.Localize( "LUA_MENU_SQUAD_GAME_MODE" ), + value_text = f38_local4 + } + } + f38_local0[#f38_local0 + 1] = { + type = "squads_hq_stat_bar", + id = "squads_hq_stat_map_id", + properties = { + title_text = Engine.Localize( "LUA_MENU_SQUAD_BASE" ), + value_text = Engine.MarkLocalized( Squad.GetRealBaseNameFromLoadName( SvS.GetLocalPlayerBaseName( f38_local1 ) ) ) + } + } + f38_local0[#f38_local0 + 1] = { + type = "UIImage", + id = "squads_hq_stat_spacer_id", + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = 4, + alpha = 0.15, + material = RegisterMaterial( "white" ) + } ) + } + } + f38_local0[#f38_local0 + 1] = { + type = "squads_hq_stat_bar", + id = "squads_hq_stat_wins_id", + properties = { + title_text = Engine.Localize( "LUA_MENU_WINS" ), + value_text = f38_local5 + } + } + f38_local0[#f38_local0 + 1] = { + type = "squads_hq_stat_bar", + id = "squads_hq_stat_losses_id", + properties = { + title_text = Engine.Localize( "MENU_LOSSES" ), + value_text = f38_local6 + } + } + f38_local0[#f38_local0 + 1] = { + type = "squads_hq_stat_bar", + id = "squads_hq_stat_ratio_id", + properties = { + title_text = Engine.Localize( "LUA_MENU_WL_RATIO" ), + value_text = f38_local10 + } + } + f38_local0[#f38_local0 + 1] = { + type = "squads_hq_stat_bar", + id = "squads_hq_stat_streak_id", + properties = { + title_text = Engine.Localize( "LUA_MENU_CURRENT_STREAK" ), + value_text = f38_local7 + } + } + f38_local0[#f38_local0 + 1] = { + type = "squads_hq_stat_bar", + id = "squads_hq_stat_xp_time_id", + properties = { + title_text = Engine.Localize( "LUA_MENU_XP_TIME_REMAINING" ), + value_text = f38_local8 + } + } + return f38_local0 +end + +function SquadsHQMainButtonListChildFeeder( f40_arg0 ) + local f40_local0 = {} + local f40_local1 = f40_arg0.exclusiveController + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "squads_mode_button_create_a_class", + disabled = false, + properties = { + button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" ), + button_action_func = function ( f41_arg0, f41_arg1 ) + Cac.ValidateAllPlayersPublicSquadMembers() + LUI.FlowManager.RequestAddMenu( f41_arg0, "cac_member_select_main", true, f41_arg1.controller, false, { + next_screen = "cac_edit_main", + squad_location = "squadMembers", + class_location = "loadouts" + } ) + end + } + } + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "squads_mode_button_leaderboards", + properties = { + button_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_LEADERBOARDS_SQUADS" ), + button_action_func = function ( f42_arg0, f42_arg1 ) + LUI.FlowManager.RequestAddMenu( f42_arg0, "leaderboards", true, f42_arg1.controller ) + end + } + } + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "squads_mode_button_squad_reports", + properties = { + button_text = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS" ), + desc_text = Engine.Localize( "@LUA_MENU_SQUAD_REPORTS_DESC" ), + button_action_func = function ( f43_arg0, f43_arg1 ) + LUI.FlowManager.RequestAddMenu( f43_arg0, "squad_reports_menu", false, f43_arg1.controller, false, { + controller = f43_arg1.controller, + fromSquadsModeMenu = true + } ) + end + } + } + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "squad_name_button", + properties = { + button_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_NAME_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_NAME_DESC" ), + button_action_func = function ( f44_arg0, f44_arg1 ) + Squad.ChangeName( f44_arg1.controller ) + end + } + } + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "squad_game_mode_button", + properties = { + button_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_GAME_MODE_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_GAME_MODE_DESC" ), + button_action_func = function ( f45_arg0, f45_arg1 ) + LUI.FlowManager.RequestAddMenu( f45_arg0, "settings_recipe_choosetype", true, f45_arg1.controller, false, { + requestedGameMode = "Standard", + menu_title = Cac.GetGameModeTypeString( "Standard" ), + squadBaseSelect = true, + teamsOnly = true + } ) + end + } + } + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "squad_base_button", + properties = { + button_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_BASE_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_EDIT_SQUAD_BASE_DESC" ), + button_action_func = function ( f46_arg0, f46_arg1 ) + LUI.FlowManager.RequestAddMenu( f46_arg0, "mapsetup_menu_main", true, f46_arg1.controller, false, { + rotationAllowed = false, + squadBaseSelect = true + } ) + end + } + } + f40_local0[#f40_local0 + 1] = { + type = "UIGenericButton", + id = "squad_order_button", + properties = { + button_text = Engine.Localize( "@LUA_MENU_SET_SQUAD_ORDER_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_SET_SQUAD_ORDER_DESC" ), + button_action_func = function ( f47_arg0, f47_arg1 ) + LUI.FlowManager.RequestPopupMenu( f47_arg0, "cac_squad_order_popup", true, f47_arg1.controller, false, { + squad_location = "squadMembers" + } ) + end + } + } + f40_local0[#f40_local0 + 1] = { + type = "button_desc_text", + id = "squads_mode_desc_text_id", + properties = { + lines = 4 + } + } + return f40_local0 +end + +function squads_hq_menu() + return { + type = "UIElement", + id = "squads_hq_menu", + properties = {}, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = SquadsHQCreate, + cac_update_header_text = function ( f49_arg0, f49_arg1 ) + if f49_arg0.properties.exclusiveController then + Engine.Exec( "uploadstats", f49_arg0.properties.exclusiveController ) + end + f49_arg0:processEvent( { + name = "update_squad_name" + } ) + end + + }, + children = { + { + type = "generic_menu_title", + id = "squads_hq_menu_title_text_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_SQUAD_HQ_CAPS" ) + } + }, + { + type = "UIVerticalList", + id = "squads_hq_menu_button_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + alignment = LUI.Alignment.Top + } + }, + childrenFeeder = SquadsHQMainButtonListChildFeeder + }, + { + type = "generic_menu_background_withfade", + id = "squads_hq_menu_stats_pane_id", + properties = { + shadow_top_offset = GenericTitleBarDims.TitleBarHeight + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 100 - GenericTitleBarDims.TitleBarHeight, + bottom = 650, + left = -720, + width = 532 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_squads_mode_desc = function ( f50_arg0, f50_arg1 ) + if f50_arg1.categoryInfo then + f50_arg0:setImage( RegisterMaterial( f50_arg1.categoryInfo.Image ) ) + end + end + + }, + children = { + { + type = "UIVerticalList", + id = "squads_hq_menu_stat_list_id", + states = { + default = { + spacing = 4, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 10, + bottom = 0, + left = 10, + right = -10 + } + }, + childrenFeeder = SquadsHQStatListChildFeeder + } + } + }, + { + type = "button_helper_text_main", + id = "squads_hq_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "squads_hq_friends_widget_id" + }, + { + type = "generic_back_button" + } + } + } +end + +LUI.MenuBuilder.registerDef( "squads_mode_select_menu", squads_mode_select_menu ) +LUI.MenuBuilder.registerDef( "squads_mode_sub_mode_popup", squads_mode_sub_mode_popup ) +LUI.MenuBuilder.registerDef( "squad_mode_desc_pane", squad_mode_desc_pane ) +LUI.FlowManager.RegisterStackPushBehaviour( "squads_mode_select_menu", function () + PersistentBackground.ProcessEvent( { + name = "blur_persistent_background", + duration = 500 + } ) +end ) +LUI.FlowManager.RegisterStackPopBehaviour( "squads_mode_select_menu", function () + PersistentBackground.ProcessEvent( { + name = "unblur_persistent_background", + duration = 500 + } ) +end ) +LUI.MenuBuilder.registerDef( "squads_hq_menu", squads_hq_menu ) +LUI.MenuBuilder.registerDef( "squads_hq_stat_bar", squads_hq_stat_bar ) +LockTable( _M ) diff --git a/lui/mp_menus/store.dec.lua b/lui/mp_menus/store.dec.lua new file mode 100644 index 0000000..5f77d11 --- /dev/null +++ b/lui/mp_menus/store.dec.lua @@ -0,0 +1,622 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( "Registering " .. _NAME ) +function EndAnnouncerPreviewSound( f1_arg0 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + if f1_local0.announcerPreview then + Engine.StopSound( f1_local0.announcerPreview ) + f1_local0.announcerPreview = nil + end +end + +function OnCreate( f2_arg0, f2_arg1 ) + f2_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) + f2_local0.detailsVisible = false + f2_local0.hList = f2_arg0:getFirstDescendentById( "thumbnail_list_id" ) + f2_arg0:processEvent( { + name = "update_tags" + } ) + f2_arg0:processEvent( { + name = "update_thumbnail_arrows", + left_visible = showLeft, + right_visible = showRight + } ) +end + +function ChangeCategory( f3_arg0, f3_arg1 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + f3_local0.category = f3_arg0.properties.article_category + f3_local0.articleIndex = nil + EndAnnouncerPreviewSound( f3_arg0 ) + f3_arg0:dispatchEventToRoot( { + name = "refresh_thumbnails", + immediate = true + } ) + f3_arg0:dispatchEventToRoot( { + name = "update_store_helper_text", + immediate = true + } ) +end + +function ChangeArticle( f4_arg0, f4_arg1 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + f4_local0.articleIndex = f4_arg1.headerIndex + f4_local0.articleId = f4_arg1.itemId + local f4_local1, f4_local2, f4_local3, f4_local4 = f4_local0.hList:GetAnchorData() + local f4_local5 = math.max( f4_local0.articleIndex - Sns.MaxVisibleArticles - 1, 0 ) + local f4_local6 = f4_local5 * -(Sns.Dims.Thumbnail.width + Sns.HListSpacing) + f4_local0.minVisibleArticle = f4_local5 + f4_local0.hList:registerAnimationState( "default", { + leftAnchor = f4_local1, + rightAnchor = f4_local3, + topAnchor = f4_local2, + bottomAnchor = f4_local4, + left = f4_local6 + Sns.HListOffset, + right = -Sns.HListOffset, + top = Sns.HListOffset, + bottom = -Sns.HListOffset + } ) + f4_local0.hList:animateToState( "default", 100 ) + f4_arg0:processEvent( { + name = "refresh_article", + itemId = f4_arg1.itemId + } ) + local f4_local7 = Store.GetNumItemsInCategory( f4_local0.category ) + local f4_local8 = f4_local0.articleIndex >= Sns.MaxVisibleArticles + local f4_local9 + if f4_local7 <= Sns.MaxVisibleArticles or f4_local0.articleIndex >= f4_local7 - 1 then + f4_local9 = false + else + f4_local9 = true + end + f4_arg0:processEvent( { + name = "update_thumbnail_arrows", + left_visible = f4_local8, + right_visible = f4_local9 + } ) + EndAnnouncerPreviewSound( f4_arg0 ) + if f4_local0.category == StoreCategory.AnnouncerVoices then + local f4_local10 = Engine.TableLookup( "mp/cac/announcers.csv", 0, tostring( f4_local0.articleIndex + 1 ), 2 ) + if f4_local10 ~= "" then + f4_local0.announcerPreview = Engine.PlaySound( f4_local10 ) + end + end +end + +function RefreshArticle( f5_arg0, f5_arg1 ) + local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 ) + local f5_local1 = CrossGameHackData( f5_local0.category ) + assert( f5_arg1.itemId == f5_local0.articleId ) + Sns.UpdateScopedArticleInfo( f5_arg0, f5_local0 ) + f5_local0.detailsVisible = false + local f5_local2 = {} + if f5_local0.articleCount > 0 then + f5_local2[1] = { + fileId = Sns.GetScopedArticleInfo( f5_arg0, "image" ), + thumbName = Sns.GetScopedArticleInfo( f5_arg0, "thumbName" ) + } + local f5_local3 = f5_local0.minVisibleArticle + local f5_local4 = math.min( f5_local0.articleCount - 1, f5_local3 + Sns.MaxPrefetchArticles - 1 ) + for f5_local5 = f5_local3, f5_local4, 1 do + local f5_local8 = nil + if f5_local1 then + f5_local8 = { + dlcName = "s1", + id = -1, + thumb = "s1", + thumbName = "s1" + } + else + f5_local8 = Store.GetItemInfoByCategory( f5_local0.category, f5_local5 ) + end + if f5_local8.thumb ~= f5_local2[1] then + f5_local2[#f5_local2 + 1] = { + fileId = f5_local8.thumb, + thumbName = f5_local8.thumbName + } + end + end + end + Store.RequestContentServerImages( unpack( f5_local2 ) ) + f5_arg0:dispatchEventToChildren( { + name = "hide_more_details" + } ) + f5_arg0:dispatchEventToChildren( { + name = "update_article_details", + end_time = endTime + } ) + f5_arg0:dispatchEventToChildren( { + name = "show_article_purchaseinfo", + itemID = itemId, + dispatchChildren = true + } ) + f5_arg0:dispatchEventToChildren( { + name = "update_purchase_checkboxes" + } ) + f5_arg0:dispatchEventToRoot( { + name = "update_store_helper_text", + immediate = true + } ) +end + +function UpdateHelperText( f6_arg0, f6_arg1 ) + local f6_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f6_arg0 ) + local f6_local1 = f6_local0.category + f6_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = "", + side = "left" + } ) + f6_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = "", + side = "left" + } ) + if f6_local0.articleIndex then + local f6_local2 = nil + if f6_local0.articleInfo then + if f6_local0.articleInfo.purchased then + f6_local2 = Engine.Localize( "@LUA_MENU_DOWNLOAD" ) + else + f6_local2 = Engine.Localize( "@LUA_MENU_PURCHASE" ) + end + else + f6_local2 = "" + end + f6_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = f6_local2, + side = "left", + clickable = true + } ) + end + if not Sns.IsRedeemCodeDisabled() then + if not f6_local0.articleIndex and Engine.IsPS3() then + return + end + f6_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_REDEEM_CODE" ), + side = "left", + clickable = true + } ) + end +end + +function OnActionPressed( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + if not f7_local0.articleIndex then + return + end + DebugPrint( "Action pressed. Category: " .. f7_local0.category .. " Index: " .. f7_local0.articleIndex ) + DebugPrint( "Attempting to purchase..." ) + if Engine.IsXbox360() then + if f7_local0.category == StoreCategory.Crossgame then + Engine.ExecNow( "downloadSelectedOffer 0x0 " .. StoreCategory.Crossgame ) + else + Engine.ExecNow( "downloadSelectedOffer " .. f7_local0.articleId .. " " .. f7_local0.category ) + end + elseif Engine.IsPS3() or Engine.IsPS4() then + if f7_local0.category == StoreCategory.Crossgame and Engine.IsPS4() then + Engine.ExecNow( "crossGameSelectedOffer " .. f7_local0.articleId ) + elseif f7_local0.articleInfo.purchased then + Engine.ExecNow( "downloadSelectedOffer " .. f7_local0.articleId ) + else + Engine.ExecNow( "purchaseSelectedOffer " .. f7_local0.articleId ) + end + elseif Engine.IsXB3() then + Engine.ExecNow( "purchaseSelectedOffer " .. f7_local0.articleIndex .. " " .. f7_local0.category ) + end +end + +function OnAltPressed( f8_arg0, f8_arg1 ) + if Sns.IsRedeemCodeDisabled() then + return + else + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + if not f8_local0.articleIndex and Engine.IsPS3() then + return + else + Engine.Exec( "showTokenRedemptionUI" ) + end + end +end + +function CategoryFetchCompleted( f9_arg0, f9_arg1 ) + DebugPrint( "CategoryFetchCompleted" ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "store_main" ) + local f9_local1 + if f9_local0 then + f9_local1 = f9_local0.category + if not f9_local1 then + + else + if f9_local1 == f9_arg1.category then + f9_arg0:processEvent( { + name = "refresh_thumbnails" + } ) + elseif not Store.HasContentForCategory( f9_local1 ) then + f9_arg0:processEvent( { + name = "show_fetching_metadata" + } ) + Store.FetchContentForCategory( f9_local1 ) + end + end + end + f9_local1 = StoreCategory.SeasonPass +end + +function ThumbnailFeeder( f10_arg0 ) + local f10_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "store_main" ) + local f10_local1 = f10_local0 and f10_local0.category + if not f10_local1 then + if Sns.IsSeasonPassAccessible() then + local f10_local2 = StoreCategory.SeasonPass + end + f10_local1 = f10_local2 or StoreCategory.MapPacks + end + local f10_local3 = {} + local f10_local4 = CrossGameHackData( f10_local1 ) + if not f10_local4 and not Store.HasContentForCategory( f10_local1 ) then + DebugPrint( "Fetch content" ) + local f10_local5 = Engine.GetLuiRoot() + f10_local5:processEvent( { + name = "show_fetching_metadata", + immediate = true + } ) + Store.FetchContentForCategory( f10_local1 ) + return f10_local3 + end + local f10_local5 = Engine.GetLuiRoot() + f10_local5:processEvent( { + name = "hide_fetching_metadata", + immediate = true + } ) + f10_local5 = Store.GetNumItemsInCategory( f10_local1 ) + f10_local0.articleCount = f10_local5 + for f10_local6 = 0, f10_local5 - 1, 1 do + local f10_local9 = nil + if not f10_local4 then + f10_local9 = Store.GetItemInfoByCategory( f10_local1, f10_local6 ) + else + f10_local9 = { + dlcName = "s1", + id = -1, + thumb = "s1", + thumb_name = "s1" + } + end + f10_local3[#f10_local3 + 1] = { + type = "sns_thumbnail", + id = "thumbnail_" .. f10_local6, + listDefaultFocus = f10_local9.dlcName == f10_arg0.initialDlcName, + properties = { + item_id = f10_local9.id, + file_id = f10_local9.thumb, + item_index = f10_local6, + thumbName = f10_local9.thumbName + }, + handlers = { + button_over = MBh.EmitEventToRoot( { + name = "change_article", + headerIndex = f10_local6, + itemId = f10_local9.id, + immediate = true + } ) + } + } + end + f10_arg0.initialDlcName = "" + return f10_local3 +end + +function CategoryButtonFactory( f11_arg0, f11_arg1, f11_arg2, f11_arg3 ) + if not Store.GetCategoryInfo( f11_arg2 ) then + return nil + else + return { + type = "store_category_button", + id = f11_arg0, + listDefaultFocus = f11_arg2 == f11_arg3, + properties = { + button_text = f11_arg1, + button_over_func = ChangeCategory, + button_action_func = OnActionPressed, + article_category = f11_arg2 + } + } + end +end + +function CategoryFeeder( f12_arg0 ) + local f12_local0 = {} + local f12_local1 = Store.GetCategoryForDLCName( f12_arg0.initialDlcName ) + if f12_local1 >= 0 then + local f12_local2 = f12_local1 + end + local f12_local3 = f12_local2 or StoreCategory.SeasonPass + if Sns.IsSeasonPassAccessible() then + f12_local0[#f12_local0 + 1] = CategoryButtonFactory( "seasonpass_id", Engine.Localize( "@LUA_MENU_STORE_SEASON_PASS" ), StoreCategory.SeasonPass, f12_local3 ) + end + if 1 == Engine.GetDvarInt( "igs_smappacks" ) then + f12_local0[#f12_local0 + 1] = CategoryButtonFactory( "mappacks_id", Engine.Localize( "@LUA_MENU_STORE_MAP_PACKS" ), StoreCategory.MapPacks, f12_local3 ) + end + f12_local0[#f12_local0 + 1] = CategoryButtonFactory( "mappacks_id", Engine.Localize( "@LUA_MENU_STORE_MAP_PACKS" ), StoreCategory.MapPacks, f12_local3 ) + f12_local0[#f12_local0 + 1] = CategoryButtonFactory( "personalization_id", Engine.Localize( "@LUA_MENU_MP_STORE_PERSONALIZATION_PACKS" ), StoreCategory.Personalization, f12_local3 ) + f12_local0[#f12_local0 + 1] = CategoryButtonFactory( "customization_id", Engine.Localize( "@LUA_MENU_STORE_CUSTOMIZATION_PACKS" ), StoreCategory.Customization, f12_local3 ) + f12_local0[#f12_local0 + 1] = CategoryButtonFactory( "extraslots_id", Engine.Localize( "@LUA_MENU_MP_STORE_EXTRA_SLOTS" ), StoreCategory.ExtraSlots, f12_local3 ) + if 0 ~= Engine.GetDvarInt( "igs_announcer" ) then + f12_local0[#f12_local0 + 1] = CategoryButtonFactory( "voices_id", Engine.Localize( "@LUA_MENU_MP_STORE_ANNOUNCER_VOICES" ), StoreCategory.AnnouncerVoices, f12_local3 ) + end + f12_local0[#f12_local0 + 1] = CategoryButtonFactory( "additional_id", Engine.Localize( "@LUA_MENU_MP_STORE_ADDITIONAL_ITEMS" ), StoreCategory.AdditionalItems, f12_local3 ) + if Engine.IsXbox360() then + f12_local0[#f12_local0 + 1] = CategoryButtonFactory( "avatar_id", Engine.Localize( "@LUA_MENU_STORE_AVATAR_UNIFORM" ), StoreCategory.Avatar, f12_local3 ) + end + if 1 == Engine.GetDvarInt( "igs_crossgame" ) then + f12_local0[#f12_local0 + 1] = CategoryButtonFactory( "crossgame_id", Engine.Localize( "@LUA_MENU_STORE_CROSS_GAME" ), StoreCategory.Crossgame, f12_local3 ) + end + return f12_local0 +end + +function store_category_button() + return { + type = "UIGenericButton", + id = "store_category_button_id", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + substyle = GenericButtonSettings.Styles.FlatButton.SubStyles.SubMenu, + use_locking = false, + article_category = StoreCategory.SeasonPass + }, + handlers = { + update_tags = function ( f14_arg0, f14_arg1 ) + local f14_local0 = Store.GetCategoryInfo( f14_arg0.properties.article_category ) + assert( f14_local0 ) + f14_arg0.properties.hasNew = f14_local0.hasNew + f14_arg0.properties.hasSale = f14_local0.hasSale + f14_arg0:dispatchEventToChildren( f14_arg1 ) + end + + }, + children = { + { + type = "UIImage", + id = "store_category_button_new_image_id", + properties = { + article_category = MBh.Property( "article_category" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + left = -20, + right = 0, + top = -10, + bottom = 10, + red = 0.5, + green = 0.5, + blue = 0.5, + material = RegisterMaterial( "icon_new" ), + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_tags = function ( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg0 + local f15_local1 = f15_arg0.animateToState + local f15_local2 = f15_arg0:getParent() + f15_local1( f15_local0, f15_local2.properties.hasNew and "default" or "hidden", 0 ) + end + + } + }, + { + type = "UIImage", + id = "store_category_button_sale_image_id", + properties = { + article_category = MBh.Property( "article_category" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + left = -20, + right = 20, + top = -10, + bottom = 10, + red = 0.5, + green = 0.5, + blue = 0.5, + material = RegisterMaterial( "icon_sale" ), + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + update_tags = function ( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg0 + local f16_local1 = f16_arg0.animateToState + local f16_local2 = f16_arg0:getParent() + f16_local1( f16_local0, f16_local2.properties.hasSale and "default" or "hidden", 0 ) + end + + } + } + } + } +end + +function store_main() + return { + type = "UIElement", + id = "store_root", + properties = { + initialDlcName = "" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OnCreate, + gain_focus = nil, + update_store_helper_text = UpdateHelperText, + change_article = ChangeArticle, + store_got_metadata = CategoryFetchCompleted, + menu_close = function ( f18_arg0, f18_arg1 ) + if Engine.GetDvarString( "ui_contextualMenuLocation" ) == "squad_menu" then + LUI.FlowManager.RequestRestoreMenu( f18_arg0, "menu_xboxlive", false, f18_arg1.controller, false ) + end + EndAnnouncerPreviewSound( f18_arg0 ) + end + , + purchase_complete = function ( f19_arg0, f19_arg1 ) + Sns.UpdateScopedArticleInfo( f19_arg0 ) + f19_arg0:dispatchEventToRoot( { + name = "refresh_thumbnails", + immediate = true + } ) + end + + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_STORE_CAPS" ) + } + }, + { + type = "UIImage", + id = "store_playstation_logo_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 49, + right = -80, + width = 128, + height = 32, + material = RegisterMaterial( "logo_playstation_store" ), + alpha = 0 + }, + show = { + alpha = 1 + } + }, + handlers = { + menu_create = function ( f20_arg0, f20_arg1 ) + if Engine.IsPS3() or Engine.IsPS4() then + f20_arg0:animateToState( "show", 0 ) + end + end + + } + }, + { + type = "sns_category_window", + id = "store_category_window_id", + properties = { + feeder = CategoryFeeder, + initialDlcName = MBh.Property( "initialDlcName" ) + } + }, + { + type = "sns_thumbnail_window", + id = "store_thumbnail_window_id", + properties = { + feeder = ThumbnailFeeder, + initialDlcName = MBh.Property( "initialDlcName" ) + } + }, + { + type = "sns_article", + id = "sns_article_id", + properties = { + additional_handlers = { + refresh_article = RefreshArticle + } + } + }, + { + type = "sns_fetching_category_spinner", + id = "sns_fetching_category_spinner_id" + }, + { + type = "button_helper_text_main", + id = "store_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + }, + { + type = "UIBindButton", + id = "store_bind_button_id", + handlers = { + button_secondary = MBh.LeaveMenu(), + button_alt1 = OnAltPressed + } + } + } + } +end + +function store_noguests_error() + return { + type = "generic_confirmation_popup", + id = "store_noguests_error_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_STORE_NOGUESTACCOUNTS" ) + } + } +end + +function store_disabled_error() + return { + type = "generic_confirmation_popup", + id = "store_disabled_error_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_STORE_RESTRICTED" ) + } + } +end + +LUI.MenuBuilder.registerDef( "store_main", store_main ) +LUI.MenuBuilder.registerDef( "store_noguests_error", store_noguests_error ) +LUI.MenuBuilder.registerDef( "store_disabled_error", store_disabled_error ) +LUI.MenuBuilder.registerDef( "store_category_button", store_category_button ) +LUI.FlowManager.RegisterStackPushBehaviour( "store_main", function () + +end ) +LUI.FlowManager.RegisterStackPopBehaviour( "store_main", function () + Engine.ExecNow( "decnosplitscreencontrol menu_STORE" ) +end ) +LockTable( _M ) diff --git a/lui/mp_menus/svsutils.dec.lua b/lui/mp_menus/svsutils.dec.lua new file mode 100644 index 0000000..013041f --- /dev/null +++ b/lui/mp_menus/svsutils.dec.lua @@ -0,0 +1,642 @@ +SvS = { + MaxSquadSize = 6, + OrderArraySize = 10, + MaxAILoadoutIndex = 5, + SquadModeDvar = "ui_squad_mode", + SquadPlaylistCategory = 5, + ShowChatRestrict = false, + PlaylistTags = { + Invalid = 0, + SquadAssault = 1, + SquadVsSquad = 2, + Safeguard = 3, + SafeguardExtended = 4, + SafeguardInfinite = 5, + Wargame1 = 6, + Wargame2 = 7, + Wargame3 = 8, + Wargame4 = 9, + Wargame5 = 10, + Wargame6 = 11, + Wargame7 = 12, + Wargame8 = 13, + DLC_Safeguard1 = 14, + DLC_Safeguard2 = 15, + DLC_Safeguard3 = 16, + DLC_Safeguard4 = 17, + DLC_Wargame1 = 18, + DLC_Wargame2 = 19, + DLC_Wargame3 = 20, + DLC_Wargame4 = 21 + }, + Reports = { + MaxReports = 5, + MatchOutcomeKeys = { + Victory = "Victory", + Defeat = "Defeat", + Draw = "Draw", + Forfeit = "Forfeit" + }, + MatchOutcomeArray = { + "Victory", + "Defeat", + "Draw", + "Forfeit" + }, + MatchOutcomeStrings = { + Victory = "LUA_MENU_REPORT_VICTORY", + Defeat = "LUA_MENU_REPORT_DEFEAT", + Draw = "LUA_MENU_REPORT_DRAW", + Forfeit = "LUA_MENU_REPORT_REASON_FORFEIT" + }, + MatchOutcomeColors = { + Victory = { + textColor = { + r = 0.55, + g = 0.78, + b = 0.24 + }, + bgColor = { + r = 0, + g = 1, + b = 0 + } + }, + Defeat = { + textColor = { + r = 0.94, + g = 0.12, + b = 0.12 + }, + bgColor = Colors.red + }, + Draw = { + textColor = Colors.window_title_text_color, + bgColor = Colors.white + }, + Forfeit = { + textColor = { + r = 0.55, + g = 0.78, + b = 0.24 + }, + bgColor = { + r = 0, + g = 1, + b = 0 + } + } + } + }, + PostMatchDataCache = { + enemyPlayercard = {} + }, + SquadModes = { + SquadAssault = { + ModeDvarValue = 0, + PlaylistTagValue = SvS.PlaylistTags.SquadAssault, + RequiresMatchmaking = true, + HasReports = true, + HasCompare = true, + RecordsStats = true, + DynamicMatchmaking = false, + HasLeaderboard = true + }, + SquadVsSquad = { + ModeDvarValue = 4, + PlaylistTagValue = SvS.PlaylistTags.SquadVsSquad, + RequiresMatchmaking = true, + HasReports = false, + HasCompare = false, + RecordsStats = true, + DynamicMatchmaking = false, + HasLeaderboard = false + }, + Safeguard = { + ModeDvarValue = 1, + PlaylistTagValue = SvS.PlaylistTags.Safeguard, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = true + }, + SafeguardExtended = { + ModeDvarValue = 2, + PlaylistTagValue = SvS.PlaylistTags.SafeguardExtended, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = true + }, + SafeguardInfinite = { + ModeDvarValue = 3, + PlaylistTagValue = SvS.PlaylistTags.SafeguardInfinite, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = true + }, + Wargame1 = { + ModeDvarValue = 5, + PlaylistTagValue = SvS.PlaylistTags.Wargame1, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + Wargame2 = { + ModeDvarValue = 6, + PlaylistTagValue = SvS.PlaylistTags.Wargame2, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + Wargame3 = { + ModeDvarValue = 7, + PlaylistTagValue = SvS.PlaylistTags.Wargame3, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + Wargame4 = { + ModeDvarValue = 8, + PlaylistTagValue = SvS.PlaylistTags.Wargame4, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + Wargame5 = { + ModeDvarValue = 9, + PlaylistTagValue = SvS.PlaylistTags.Wargame5, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + Wargame6 = { + ModeDvarValue = 10, + PlaylistTagValue = SvS.PlaylistTags.Wargame6, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + Wargame7 = { + ModeDvarValue = 11, + PlaylistTagValue = SvS.PlaylistTags.Wargame7, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + Wargame8 = { + ModeDvarValue = 12, + PlaylistTagValue = SvS.PlaylistTags.Wargame8, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + DLC_Safeguard1 = { + ModeDvarValue = 13, + PlaylistTagValue = SvS.PlaylistTags.DLC_Safeguard1, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = true + }, + DLC_Safeguard2 = { + ModeDvarValue = 14, + PlaylistTagValue = SvS.PlaylistTags.DLC_Safeguard2, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = true + }, + DLC_Safeguard3 = { + ModeDvarValue = 15, + PlaylistTagValue = SvS.PlaylistTags.DLC_Safeguard3, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = true + }, + DLC_Safeguard4 = { + ModeDvarValue = 16, + PlaylistTagValue = SvS.PlaylistTags.DLC_Safeguard4, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = true + }, + DLC_Wargame1 = { + ModeDvarValue = 17, + PlaylistTagValue = SvS.PlaylistTags.DLC_Wargame1, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + DLC_Wargame2 = { + ModeDvarValue = 18, + PlaylistTagValue = SvS.PlaylistTags.DLC_Wargame2, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + DLC_Wargame3 = { + ModeDvarValue = 19, + PlaylistTagValue = SvS.PlaylistTags.DLC_Wargame3, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + }, + DLC_Wargame4 = { + ModeDvarValue = 20, + PlaylistTagValue = SvS.PlaylistTags.DLC_Wargame4, + RequiresMatchmaking = false, + HasReports = false, + HasCompare = false, + RecordsStats = false, + DynamicMatchmaking = true, + HasLeaderboard = false + } + }, + SquadCategories = { + { + Devname = "squad_assault", + NameLocRefCaps = "LUA_MENU_SQUAD_ASSAULT_CAPS", + DescLocRef = "LUA_MENU_SQUAD_ASSAULT_DESC", + PlayersDescLocRef = "LUA_MENU_SQUAD_ASSAULT_PLAYER_DESC", + PlayersAltDescLocRef = "", + Image = "img_squadmode_01", + Modes = { + SvS.SquadModes.SquadAssault + } + }, + { + Devname = "squad_vs_squad", + NameLocRefCaps = "LUA_MENU_SQUAD_VS_SQUAD_CAPS", + DescLocRef = "LUA_MENU_SQUAD_VS_SQUAD_DESC", + PlayersDescLocRef = "LUA_MENU_SQUAD_VS_SQUAD_PLAYER_DESC", + PlayersAltDescLocRef = "", + Image = "img_squadmode_02", + Modes = { + SvS.SquadModes.SquadVsSquad + } + }, + { + Devname = "safeguard", + NameLocRefCaps = "LUA_MENU_HORDE_CAPS", + DescLocRef = "LUA_MENU_SAFEGUARD_DESC", + PlayersDescLocRef = "LUA_MENU_SAFEGUARD_PLAYER_DESC", + PlayersAltDescLocRef = "LUA_MENU_SAFEGUARD_PLAYER_DESC_ALT", + Image = "img_squadmode_03", + Modes = { + SvS.SquadModes.Safeguard, + SvS.SquadModes.SafeguardExtended, + SvS.SquadModes.SafeguardInfinite + } + }, + { + Devname = "wargame", + NameLocRefCaps = "LUA_MENU_WARGAME_CAPS", + DescLocRef = "LUA_MENU_WARGAME_DESC", + PlayersDescLocRef = "LUA_MENU_WARGAME_PLAYER_DESC", + PlayersAltDescLocRef = "LUA_MENU_WARGAME_PLAYER_DESC_ALT", + Image = "img_squadmode_04", + Modes = { + SvS.SquadModes.Wargame1, + SvS.SquadModes.Wargame2, + SvS.SquadModes.Wargame3, + SvS.SquadModes.Wargame4, + SvS.SquadModes.Wargame5, + SvS.SquadModes.Wargame6, + SvS.SquadModes.Wargame7, + SvS.SquadModes.Wargame8 + } + } + }, + SquadDLCCategories = { + { + Devname = "squads_dlc", + NameLocRefCaps = "PATCH_MENU_SQUADS_DLC_CATEGORY_CAPS", + DescLocRef = "PATCH_MENU_SQUADS_DLC_DESC", + PlayersDescLocRef = "", + PlayersAltDescLocRef = "", + Image = "img_squadmode_dlc", + Modes = { + SvS.SquadModes.DLC_Safeguard1, + SvS.SquadModes.DLC_Wargame1 + } + }, + { + Devname = "squads_dlc", + NameLocRefCaps = "LUA_MENU_MP_SQUADS_DLC_CATEGORY_2_CAPS", + DescLocRef = "LUA_MENU_MP_SQUADS_DLC_DESC_2", + PlayersDescLocRef = "", + PlayersAltDescLocRef = "", + Image = "img_squadmode_dlc", + Modes = { + SvS.SquadModes.DLC_Safeguard2, + SvS.SquadModes.DLC_Wargame2 + } + }, + { + Devname = "squads_dlc", + NameLocRefCaps = "LUA_MENU_MP_SQUADS_DLC_CATEGORY_3_CAPS", + DescLocRef = "LUA_MENU_MP_SQUADS_DLC_DESC_3", + PlayersDescLocRef = "", + PlayersAltDescLocRef = "", + Image = "img_squadmode_dlc", + Modes = { + SvS.SquadModes.DLC_Safeguard3, + SvS.SquadModes.DLC_Wargame3 + } + }, + { + Devname = "squads_dlc", + NameLocRefCaps = "LUA_MENU_MP_SQUADS_DLC_CATEGORY_4_CAPS", + DescLocRef = "LUA_MENU_MP_SQUADS_DLC_DESC_4", + PlayersDescLocRef = "", + PlayersAltDescLocRef = "", + Image = "img_squadmode_dlc", + Modes = { + SvS.SquadModes.DLC_Safeguard4, + SvS.SquadModes.DLC_Wargame4 + } + } + }, + IsSvS = function () + return Engine.IsSquadVsSquadMode and Engine.IsSquadVsSquadMode() + end, + GetLocalPlayerBaseName = function ( f2_arg0 ) + return Engine.GetPlayerDataEx( f2_arg0, CoD.StatsGroup.Ranked, "squadHQ", "squad_base" ) + end, + GetBasePreviewImageSmall = function ( f3_arg0 ) + return "preview_" .. f3_arg0 .. "_vote" + end, + GetBasePreviewImageLarge = function ( f4_arg0 ) + return "preview_" .. f4_arg0 + end, + GetSquadReportData = function ( f5_arg0, f5_arg1 ) + local f5_local0 = function ( f6_arg0 ) + local f6_local0 = Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reports", f6_arg0, "time" ) + return f6_local0 and f6_local0 ~= 0 + end + + f5_arg1 = ((Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reportIndex" ) - 1) % SvS.Reports.MaxReports - f5_arg1) % SvS.Reports.MaxReports + if not f5_local0( f5_arg1 ) then + return nil + end + local f5_local1 = Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reports", f5_arg1, "time" ) or 0 + local f5_local2 = Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reports", f5_arg1, "squadName" ) or "" + local f5_local3 = Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reports", f5_arg1, "enemyName" ) or "" + local f5_local4 = Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reports", f5_arg1, "your_score" ) or 0 + local f5_local5 = Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reports", f5_arg1, "their_score" ) or 0 + local f5_local6 = Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reports", f5_arg1, "squad_mode" ) or "" + local f5_local7 = Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reports", f5_arg1, "squad_base" ) or "" + local f5_local8 = Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reports", f5_arg1, "won_match" ) or 0 + local f5_local9 = Engine.GetPlayerDataEx( f5_arg0, CoD.StatsGroup.Ranked, "squadHQ", "reports", f5_arg1, "xp" ) or 0 + local f5_local10 = { + isReport = true, + reportIndex = f5_arg1 + } + if f5_local1 then + local f5_local11 = Engine.GetFormattedDateTimeForEvent + local f5_local12 = Engine.GetFormattedDateTimeForEvent( f5_local1 ) + end + f5_local10.timeString = f5_local11 and f5_local12 or "" + f5_local10.gametype = f5_local6 + f5_local10.mapName = f5_local7 + f5_local10.matchOutcome = SvS.GetReportOutcomeKeyFromPlayerdataValue( f5_local8 ) + f5_local10.enemySquadName = f5_local2 + f5_local10.enemyName = f5_local3 + f5_local10.enemyScore = f5_local5 + f5_local10.yourScore = f5_local4 + if f5_local9 < 0 then + f5_local10.didEarnXP = false + f5_local10.xpString = Engine.Localize( "LUA_MENU_CHALLENGE_MATCH_CAPS" ) + elseif f5_local9 == 0 then + f5_local10.didEarnXP = true + f5_local10.xpString = Engine.Localize( "LUA_MENU_XP_BONUS_CAPPED_OUT" ) + else + f5_local10.didEarnXP = true + f5_local10.xpString = Engine.Localize( "LUA_MENU_XP_BONUS_EARNED", Engine.MarkLocalized( Engine.FormatTimeHoursMinutesSeconds( f5_local9 ) ) ) + end + f5_local10.enemyPlayercardProps = Squad.GetReportPlayercard( f5_arg0, f5_local10.reportIndex ) + if f5_local10.enemyPlayercardProps then + f5_local10.enemyPlayercardProps.gamertag = f5_local3 + f5_local10.enemyPlayercardProps.clantag = Squad.GetClanTagForReport( f5_arg0, f5_local10.reportIndex ) + else + f5_local10.enemyPlayercardProps = {} + f5_local10.enemyPlayercardProps.valid = false + f5_local10.enemyPlayercardProps.gamertag = f5_local3 + f5_local10.enemyPlayercardProps.clantag = Squad.GetClanTagForReport( f5_arg0, f5_local10.reportIndex ) + f5_local10.enemyPlayercardProps.rank = 0 + f5_local10.enemyPlayercardProps.prestige = nil + f5_local10.enemyPlayercardProps.background = 0 + f5_local10.enemyPlayercardProps.patchEmblem = 0 + end + return f5_local10 + end, + GetReportOutcomeKeyFromWinLoss = function ( f7_arg0, f7_arg1 ) + local f7_local0 = nil + if f7_arg0 then + f7_local0 = SvS.Reports.MatchOutcomeKeys.Victory + elseif f7_arg1 then + f7_local0 = SvS.Reports.MatchOutcomeKeys.Defeat + else + f7_local0 = SvS.Reports.MatchOutcomeKeys.Draw + end + return f7_local0 + end, + GetReportOutcomeKeyFromPlayerdataValue = function ( f8_arg0 ) + local f8_local0 = assert + local f8_local1 + if f8_arg0 < 0 and f8_arg0 >= #SvS.Reports.MatchOutcomeArray then + f8_local1 = false + else + f8_local1 = true + end + f8_local0( f8_local1 ) + return SvS.Reports.MatchOutcomeArray[f8_arg0 + 1] + end, + GetReportOutcomeText = function ( f9_arg0 ) + return Engine.Localize( SvS.Reports.MatchOutcomeStrings[f9_arg0] ) + end, + BuildSquadMemberCompareData = function ( f10_arg0, f10_arg1, f10_arg2 ) + if not Lobby.GetSquadMemberInfo then + return + else + local f10_local0 = Lobby.GetSquadMemberInfo( f10_arg1 - 1, f10_arg2, f10_arg0 ) + f10_local0.name = f10_local0.gamertag + f10_local0.weaponIndex = f10_local0.weapon + return f10_local0 + end + end, + BuildSquadCompareData = function ( f11_arg0 ) + if not Squad.FoundMatch() then + return + end + local f11_local0 = { + isCompare = true, + enemySquadName = Squad.GetEnemySquadName() or "" + } + local f11_local1 = Squad.GetCompareInfoForLobby( f11_arg0 ) + f11_local0.yourWins = f11_local1.friendlyWins or 0 + f11_local0.yourLosses = f11_local1.friendlyLosses or 0 + f11_local0.yourWinStreak = f11_local1.friendlyWinStreak or 0 + f11_local0.enemyWins = f11_local1.enemyWins or 0 + f11_local0.enemyLosses = f11_local1.enemyLosses or 0 + f11_local0.enemyWinStreak = f11_local1.enemyWinStreak or 0 + f11_local0.enemyTeam = {} + f11_local0.yourTeam = {} + for f11_local2 = 1, SvS.MaxSquadSize, 1 do + f11_local0.enemyTeam[f11_local2] = SvS.BuildSquadMemberCompareData( f11_arg0, f11_local2, true, memberInfo ) + if not f11_local0.enemyTeam[f11_local2].name then + return nil + end + f11_local0.yourTeam[f11_local2] = SvS.BuildSquadMemberCompareData( f11_arg0, f11_local2, false, memberInfo ) + if not f11_local0.yourTeam[f11_local2].name then + return nil + end + end + local f11_local2 = Lobby.GetSquadMemberInfo( 0, true, f11_arg0 ) + f11_local0.enemyPlayercardProps = { + gamertag = f11_local2.gamertag, + clantag = f11_local2.clantag, + rank = f11_local2.rank, + prestige = f11_local2.prestige, + background = f11_local2.background, + patchEmblem = f11_local2.patch + } + return f11_local0 + end, + CachePostMatchData = function ( f12_arg0 ) + SvS.PostMatchDataCache = f12_arg0 + end, + GetCachedPostMatchData = function () + return SvS.PostMatchDataCache + end, + ShouldDisplayAAR = function () + return Engine.GetClientMatchData( "alliesScore" ) ~= nil + end, + GetPlaylistFromSquadMode = function ( f15_arg0 ) + local f15_local0, f15_local1 = Squad.GetSquadModePlaylist( Engine.GetFirstActiveController(), f15_arg0.PlaylistTagValue ) + return f15_local0, f15_local1 + end, + GetCurrentSquadModeInfo = function () + local f16_local0 = Engine.GetDvarInt( SvS.SquadModeDvar ) + for f16_local4, f16_local5 in pairs( SvS.SquadModes ) do + if f16_local5.ModeDvarValue == f16_local0 then + return f16_local5 + end + end + end, + SetCurrentSquadModeInfo = function ( f17_arg0 ) + Engine.SetDvarInt( SvS.SquadModeDvar, f17_arg0.ModeDvarValue ) + end, + IsSquadModeDisabled = function ( f18_arg0 ) + local f18_local0, f18_local1 = SvS.GetPlaylistFromSquadMode( f18_arg0 ) + if f18_local0 == -1 or f18_local1 == -1 then + return true + else + return not Playlist.GetItemEnabled( f18_local0, f18_local1 ) + end + end, + IsCurrentSquadModeDisabled = function () + return SvS.IsSquadModeDisabled( SvS.GetCurrentSquadModeInfo() ) + end, + GetSquadPlaylistImage = function ( f20_arg0 ) + local f20_local0, f20_local1 = SvS.GetPlaylistFromSquadMode( f20_arg0.Modes[1] ) + if f20_local0 == -1 or f20_local1 == -1 then + return "" + else + return Playlist.GetItemImage( f20_local0, f20_local1 ) + end + end, + GetSquadPlaylistImageByMode = function ( f21_arg0 ) + local f21_local0, f21_local1 = SvS.GetPlaylistFromSquadMode( f21_arg0 ) + if f21_local0 == -1 or f21_local1 == -1 then + return "" + else + return Playlist.GetItemImage( f21_local0, f21_local1 ) + end + end, + GetSquadCategoryDesc = function ( f22_arg0 ) + return f22_arg0.DescLocRef and Engine.Localize( f22_arg0.DescLocRef ) or "" + end, + GetSquadModeDesc = function ( f23_arg0 ) + local f23_local0, f23_local1 = SvS.GetPlaylistFromSquadMode( f23_arg0 ) + return Engine.MarkLocalized( Playlist.GetItemDesc( f23_local0, f23_local1 ) ) + end, + GetSquadModeTitleText = function ( f24_arg0 ) + local f24_local0, f24_local1 = SvS.GetPlaylistFromSquadMode( f24_arg0 ) + return Engine.MarkLocalized( Playlist.GetItemName( f24_local0, f24_local1 ) ) + end, + GetSquadCategoryFromMode = function ( f25_arg0 ) + for f25_local0 = 1, #SvS.SquadCategories, 1 do + local f25_local3 = SvS.SquadCategories[f25_local0] + for f25_local4 = 1, #f25_local3.Modes, 1 do + if f25_local3.Modes[f25_local4] == f25_arg0 then + return f25_local3 + end + end + end + end, + GetSquadMemberIndexFromOrderIndex = function ( f26_arg0, f26_arg1 ) + return Engine.GetPlayerDataEx( f26_arg0, CoD.StatsGroup.Ranked, "squadHQ", "aiSquadMembers", f26_arg1 ) or 0 + end, + SetSquadMemberOrder = function ( f27_arg0, f27_arg1, f27_arg2 ) + return Engine.SetPlayerDataEx( f27_arg0, CoD.StatsGroup.Ranked, "squadHQ", "aiSquadMembers", f27_arg1, f27_arg2 ) + end, + FindSquadMemberOrderIndex = function ( f28_arg0, f28_arg1 ) + for f28_local0 = 0, SvS.OrderArraySize - 1, 1 do + if Engine.GetPlayerDataEx( f28_arg0, CoD.StatsGroup.Ranked, "squadHQ", "aiSquadMembers", f28_local0 ) == f28_arg1 then + return f28_local0 + end + end + end +} diff --git a/lui/mp_menus/systemlinkgamesetupmenu.dec.lua b/lui/mp_menus/systemlinkgamesetupmenu.dec.lua new file mode 100644 index 0000000..1464ab2 --- /dev/null +++ b/lui/mp_menus/systemlinkgamesetupmenu.dec.lua @@ -0,0 +1,512 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function PushSystemLinkGameSetupMenu() + Engine.SetDvarBool( "systemlink_host", true ) + MatchRules.SetUsingMatchRulesData( 1 ) +end + +function SystemLinkStartGame( f2_arg0, f2_arg1 ) + if Engine.GetDvarString( "ui_gametype" ) == "horde" then + Lobby.SetBotsConnectType( 0 ) + elseif Lobby.GetBotsConnectType() == 0 then + Lobby.SetBotsConnectType( 1 ) + end + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) + f2_local0.startingController = f2_arg1.controller + CharacterScene.FreeCharacterScene() + local f2_local1 = LUI.mp_menus.Aliens.LobbyGetIntroVideo() + if f2_local1 and f2_local1 ~= "" and not LUI.mp_menus.Aliens.HasSeenVideo( f2_arg1.controller, f2_local1 ) then + LUI.mp_menus.Aliens.SetHasSeenVideo( f2_arg1.controller, f2_local1 ) + LUI.mp_menus.Aliens.AliensPlayVideo( f2_arg1.controller, f2_local1, { + name = "start_transition_to_game", + immediate = true + } ) + else + f2_arg0:dispatchEventToRoot( { + name = "start_transition_to_game", + immediate = true + } ) + end +end + +function StartTheGameHandler( f3_arg0, f3_arg1 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + Lobby.StartServer( f3_local0.startingController ) + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), false, "MenuTransition" ) +end + +function SystemLinkGameSetup( f4_arg0, f4_arg1 ) + LUI.FlowManager.RequestAddMenu( f4_arg0, "gamesetup_menu_main", true, f4_arg1.controller, false ) +end + +function SystemLinkEditSquad( f5_arg0, f5_arg1 ) + Cac.SetEditSquadMember( Cac.GetActiveSquadMember( f5_arg1.controller ) ) + LUI.FlowManager.RequestAddMenu( f5_arg0, "cac_edit_main", true, f5_arg1.controller, false, { + open_char_list = true, + classLocation = "loadouts", + squadLocation = "privateMatchSquadMembers", + squadMemberIndex = Cac.GetEditSquadMember(), + allowMemberSwap = true + } ) +end + +function LeaveSystemLink( f6_arg0, f6_arg1 ) + if Lobby.GetBotsConnectType() > 0 then + Lobby.SetBotsConnectType( 0 ) + end + if MLG.AreMLGRulesEnabled() then + MLG.Toggle( f6_arg0, f6_arg1 ) + end + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) +end + +function GameSetupCreateHandler( f7_arg0, f7_arg1 ) + local f7_local0 = Engine.GetFirstActiveController() + f7_arg0:dispatchEventToRoot( LUI.ButtonHelperText.CommonEvents.addBackButton ) + f7_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addGameSummaryButton ) + Engine.Exec( MPConfig.default_dvars, f7_local0 ) + if Engine.IsAliensMode() then + LUI.mp_menus.Aliens.AliensRunConfig( f7_local0 ) + LUI.mp_menus.Aliens.InitGameTypeToAliens() + end + RefreshMLGRules( f7_arg0, f7_local0 ) + MLG.Refresh( f7_arg0 ) +end + +function GameSetupOptionsFeeder( f8_arg0 ) + local f8_local0 = Engine.IsAliensMode() + local f8_local1 = {} + if not f8_arg0.slot then + DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" ) + local f8_local2 = 0 + end + local f8_local3 = Cac.GetCustomClassLoc( f8_arg0.classLocation ) + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "start_game_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_START_GAME_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_START_MATCH" ), + button_action_func = SystemLinkStartGame + } + } + if not f8_local0 then + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "game_setup_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_GAME_SETUP_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_GAME_SETUP" ), + button_action_func = SystemLinkGameSetup + } + } + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "create_squad_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" ), + button_action_func = SystemLinkEditSquad, + button_over_func = TriggerUpdateRestrictionsIcon, + button_up_func = TriggerUpdateRestrictionsIcon + }, + handlers = { + create_class_update_restrictions = TriggerUpdateRestrictionsIcon + }, + children = { + { + type = "lobby_restriction_icon" + } + } + } + else + if LUI.mp_menus.Aliens.ExtinctionHasMapSelection() then + f8_local1[#f8_local1 + 1] = LUI.mp_menus.Aliens.MapSelectionButton() + end + if LUI.mp_menus.Aliens.ExtinctionHasModeSelection() then + f8_local1[#f8_local1 + 1] = LUI.mp_menus.Aliens.ModeSelectionButton() + end + if LUI.mp_menus.Aliens.ExtinctionHasDifficultySelection() then + f8_local1[#f8_local1 + 1] = LUI.mp_menus.Aliens.DifficultySelectionButton() + end + end + local f8_local4 = Engine.GetDvarString( "ui_gametype" ) + if not f8_local0 and f8_local4 ~= "horde" then + local f8_local5 = tonumber( Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f8_local4, GameTypesTable.Cols.TeamChoice ) ) + if f8_local5 and f8_local5 == 1 then + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "friendly_bot_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_FRIENDLY_BOTS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_FRIENDLY_BOTS_DESC" ), + button_display_func = FriendlyBotButtonDisplayText, + button_left_func = FriendlyBotButtonLeft, + button_right_func = FriendlyBotButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "friendly_bots_difficulty_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_FRIENDLY_BOTDIFFICULTY_DESC" ), + button_display_func = FriendlyBotsDifficultyButtonDisplayText, + button_left_func = FriendlyBotsDifficultyButtonLeft, + button_right_func = FriendlyBotsDifficultyButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "enemy_bot_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_ENEMY_BOTS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_ENEMY_BOTS_DESC" ), + button_display_func = EnemyBotButtonDisplayText, + button_left_func = EnemyBotButtonLeft, + button_right_func = EnemyBotButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "enemy_bots_difficulty_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_ENEMY_BOTDIFFICULTY_DESC" ), + button_display_func = EnemyBotsDifficultyButtonDisplayText, + button_left_func = EnemyBotsDifficultyButtonLeft, + button_right_func = EnemyBotsDifficultyButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + else + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "bot_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_BOTS_DESC" ), + button_display_func = FFABotButtonDisplayText, + button_left_func = FFABotButtonLeft, + button_right_func = FFABotButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + f8_local1[#f8_local1 + 1] = { + type = "UIGenericButton", + id = "bots_difficulty_button_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = GenericMenuDims.menu_right_more, + top = 0, + bottom = GenericButtonSettings.Styles.GradientButton.height + } + }, + properties = { + variant = GenericButtonSettings.Variants.Select, + content_margin = 40, + content_width = 225, + text_padding_with_content = 275, + button_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_BOTDIFFICULTY_DESC" ), + button_display_func = FFABotsDifficultyButtonDisplayText, + button_left_func = FFABotsDifficultyButtonLeft, + button_right_func = FFABotsDifficultyButtonRight, + button_over_func = MBh.EmitEventToRoot( { + name = "lobby_slide_disable", + dispatchChildren = true, + immediate = true + } ) + } + } + end + f8_local1[#f8_local1 + 1] = { + type = "UITimer", + id = "bot_button_timer_id", + properties = { + event = "bot_button_refresh", + interval = 200 + } + } + end + f8_local1[#f8_local1 + 1] = { + type = "button_desc_text", + id = "systemlink_gamesetup_description_id" + } + return f8_local1 +end + +function menu_gamesetup_systemlink() + local f9_local0 = Engine.IsAliensMode() + return { + type = "UIElement", + id = "menu_systemlink_gamesetup_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = GameSetupCreateHandler, + start_transition_to_game = HandleStartTransitionToGame, + lobby_transition_complete = StartTheGameHandler, + lobby_update_timer = function ( f10_arg0, f10_arg1 ) + MLG.Refresh( f10_arg0 ) + end + + }, + children = { + { + type = "UITimer", + id = "lobby_update_timer", + properties = { + event = { + name = "lobby_update_timer" + }, + disposable = false, + interval = 200 + } + }, + { + type = "generic_menu_title", + id = "system_link_menu_title", + properties = { + menu_title = Engine.Localize( "@PLATFORM_SYSTEM_LINK_TITLE" ) + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + }, + { + type = "character_playing_as", + id = "character_playing_as_id" + }, + { + type = "lobby_loading_widget" + }, + { + type = "lobby_game_type_title" + }, + { + type = "lobby_game_type_icon" + }, + { + type = "UIVerticalList", + id = "live_systemlink_options_id", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + childrenFeeder = GameSetupOptionsFeeder, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ), + bot_button_refresh = BotButtonRefresh, + menu_create = BotButtonRefresh + } + }, + { + type = "UIBindButton", + id = "lobby_bind_buttons_id", + handlers = { + button_secondary = LeaveSystemLink, + button_select = OpenAfterActionReport, + button_start = function ( f11_arg0, f11_arg1 ) + MLG.Toggle( f11_arg0:getParent(), f11_arg1 ) + if MatchRules.AllowCustomClasses( "loadouts" ) then + f11_arg0:dispatchEventToRoot( { + name = "create_class_update_restrictions", + controller = f11_arg1.controller + } ) + end + end + + } + }, + { + type = "UIElement", + id = "LowerSliderID", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 1 + }, + hidden = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 100, + bottom = 100, + alpha = 0 + } + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToState( "hidden", Lobby.TransitionTime ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + }, + children = { + { + type = "map_info_text", + id = "map_info_text_id" + }, + { + type = "button_helper_text_main", + id = "cac_button_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "menu_gamesetup_systemlink", menu_gamesetup_systemlink ) +LUI.FlowManager.RegisterStackPushBehaviour( "menu_gamesetup_systemlink", PushSystemLinkGameSetupMenu ) +LUI.FlowManager.RegisterStackPopBehaviour( "menu_gamesetup_systemlink", function () + Engine.SetDvarBool( "systemlink_host", false ) +end ) +LockTable( _M ) diff --git a/lui/mp_menus/systemlinkjoinmenu.dec.lua b/lui/mp_menus/systemlinkjoinmenu.dec.lua new file mode 100644 index 0000000..eb758da --- /dev/null +++ b/lui/mp_menus/systemlinkjoinmenu.dec.lua @@ -0,0 +1,429 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +DebugPrint( "Registering " .. _NAME ) +GameDataColumn = { + Host = 0, + Map = 1, + Clients = 2, + Game = 3, + Ping = 4 +} +COLUMN_0 = 0 +COLUMN_1 = 360 +COLUMN_2 = 560 +COLUMN_3 = 700 +function OnCreate( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + f1_local0.serverCount = 0 + f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + f1_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = Engine.Localize( "@MENU_JOIN_GAME1" ), + side = "left", + clickable = true + } ) + f1_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@MENU_SB_TOOLTIP_BTN_REFRESH" ), + side = "left", + clickable = true + } ) + local f1_local1 = Lobby.BuildServerList + local f1_local2 = f1_arg1.controller + if not f1_local2 then + f1_local2 = Engine.GetFirstActiveController() + end + f1_local1( f1_local2 ) +end + +function JoinGame( f2_arg0, f2_arg1 ) + local f2_local0 = Lobby.JoinServer + local f2_local1 = f2_arg1.controller + if not f2_local1 then + f2_local1 = Engine.GetFirstActiveController() + end + f2_local0( f2_local1, f2_arg1.idx ) +end + +function UpdateGameList( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg1.controller + if not f3_local0 then + f3_local0 = Engine.GetFirstActiveController() + end + local f3_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + Lobby.UpdateServerDisplayList( f3_local0 ) + local f3_local2 = Lobby.GetServerCount( f3_local0 ) + if f3_local2 ~= f3_local1.serverCount then + f3_local1.serverCount = f3_local2 + f3_arg0:processEvent( { + name = "menu_refresh", + immediate = true + } ) + f3_arg0:processEvent( { + name = "gain_focus", + immediate = true + } ) + end +end + +function RefreshServers( f4_arg0, f4_arg1 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + f4_local0.serverCount = 0 + if f4_local0.serverList then + local f4_local1 = Lobby.RefreshServerList + local f4_local2 = f4_arg1.controller + if not f4_local2 then + f4_local2 = Engine.GetFirstActiveController() + end + f4_local1( f4_local2 ) + f4_local0.serverList:processEvent( { + name = "lose_focus", + immediate = true + } ) + f4_local0.serverList:clearSavedState() + f4_local0.serverList:processEvent( { + name = "menu_refresh", + dispatchChildren = true + } ) + end +end + +function CreateHeaderDef() + local f5_local0 = { + type = "UIElement", + id = "header_row_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 2, + left = 2, + right = -2, + height = GenericTitleBarDims.TitleBarHeight + } + } + } + local f5_local1 = { + [#f5_local1 + 1] = CreateRowBackground( Colors.generic_menu_bg_color ), + [#f5_local1 + 1] = CreateColumnShade( "column_shade_rect_id", false, COLUMN_1, COLUMN_2 ), + [#f5_local1 + 1] = CreateColumnShade( "column_shade_rect_2_id", true, COLUMN_3, -1 ), + [#f5_local1 + 1] = CreateColumnText( "host_header", Engine.Localize( "@MENU_HOST_NAME" ), true, false, COLUMN_0, COLUMN_1 ), + [#f5_local1 + 1] = CreateColumnText( "map_header", Engine.Localize( "@MENU_MAP" ), true, false, COLUMN_1, COLUMN_2 ), + [#f5_local1 + 1] = CreateColumnText( "players_header", Engine.Localize( "@MENU_NUMPLAYERS" ), true, false, COLUMN_2, COLUMN_3 ), + [#f5_local1 + 1] = CreateColumnText( "type_header", Engine.Localize( "@MENU_TYPE1" ), true, true, COLUMN_3, 0 ) + } + f5_local0.children = f5_local1 + return f5_local0 +end + +function CreateRowDef( f6_arg0, f6_arg1, f6_arg2, f6_arg3 ) + local f6_local0 = { + type = "UIButton", + id = "row_" .. f6_arg1, + disabled = f6_arg2, + focusable = not f6_arg2, + properties = { + button_height = GenericButtonDims.button_height + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = MBh.Property( "button_height" ), + left = 0, + right = 0 + } + }, + handlers = { + button_action = MBh.EmitEventToRoot( { + name = "select_game", + idx = f6_arg1 + } ) + } + } + local f6_local1 = { + [#f6_local1 + 1] = CreateRowBackground( f6_arg3 ), + [#f6_local1 + 1] = CreateColumnShade( "column_shade_rect_id", false, COLUMN_1, COLUMN_2 ), + [#f6_local1 + 1] = CreateColumnShade( "column_shade_rect_2_id", true, COLUMN_3, -1 ), + [#f6_local1 + 1] = CreateColumnText( "host_text", Lobby.GetServerData( f6_arg0, f6_arg1, GameDataColumn.Host ), true, false, COLUMN_0, COLUMN_1 ), + [#f6_local1 + 1] = CreateColumnText( "map_text", Lobby.GetServerData( f6_arg0, f6_arg1, GameDataColumn.Map ), true, false, COLUMN_1, COLUMN_2 ), + [#f6_local1 + 1] = CreateColumnText( "players_text", Lobby.GetServerData( f6_arg0, f6_arg1, GameDataColumn.Clients ), true, false, COLUMN_2, COLUMN_3 ), + [#f6_local1 + 1] = CreateColumnText( "type_text", Lobby.GetServerData( f6_arg0, f6_arg1, GameDataColumn.Game ), true, true, COLUMN_3, 0 ) + } + f6_local0.children = f6_local1 + return f6_local0 +end + +function CreateRowBackground( f7_arg0 ) + return { + type = "UIImage", + id = "background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 1, + right = -1, + red = f7_arg0.r, + green = f7_arg0.g, + blue = f7_arg0.b, + material = RegisterMaterial( "white" ), + alpha = 0.05 + }, + over = { + material = RegisterMaterial( "btn_cas_fill_f" ), + red = 1, + green = 1, + blue = 1, + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ) + } + } +end + +function CreateColumnShade( f8_arg0, f8_arg1, f8_arg2, f8_arg3 ) + return { + type = "UIImage", + id = f8_arg0, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = f8_arg1, + top = 0, + bottom = 0, + left = f8_arg2, + right = f8_arg3, + red = 0.05, + green = 0.05, + blue = 0.05, + alpha = 0.25, + material = RegisterMaterial( "white" ) + }, + over = { + alpha = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ) + } + } +end + +function CreateColumnText( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_arg4, f9_arg5 ) + return { + type = "UIText", + id = f9_arg0, + properties = { + text = f9_arg1 + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = f9_arg2, + rightAnchor = f9_arg3, + topAnchor = false, + bottomAnchor = false, + left = f9_arg4 + 5, + right = f9_arg5, + top = -CoD.TextSettings.NormalFont.Height / 2, + bottom = CoD.TextSettings.NormalFont.Height / 2, + red = Colors.cac_label_text.r, + green = Colors.cac_label_text.g, + blue = Colors.cac_label_text.b, + alpha = 1 + }, + over = { + red = Colors.cac_focus_text.r, + green = Colors.cac_focus_text.g, + blue = Colors.cac_focus_text.b, + alpha = 1 + }, + disabled = { + alpha = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + button_disable = MBh.AnimateToState( "disabled" ) + } + } +end + +function LinkGamesFeeder( f10_arg0 ) + local f10_local0 = f10_arg0.controller + if not f10_local0 then + f10_local0 = Engine.GetFirstActiveController() + end + local f10_local1 = Lobby.GetServerCount( f10_local0 ) + local f10_local2 = 16 + local f10_local3 = {} + for f10_local4 = 0, f10_local2 - 1, 1 do + f10_local3[#f10_local3 + 1] = CreateRowDef( f10_local0, f10_local4, f10_local1 <= f10_local4, f10_local4 % 2 and Colors.white or Colors.black ) + end + return f10_local3 +end + +function menu_systemlink_join() + return { + type = "UIElement", + id = "menu_systemlink_join_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OnCreate, + select_game = JoinGame + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 200, + right = -200, + height = 550 + } + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + id = "menu_systemlink_join_title_id", + properties = { + fill_alpha = 1, + font = CoD.TextSettings.BoldFont, + title_bar_text = Engine.Localize( "@PLATFORM_SYSTEM_LINK_TITLE" ), + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left + } + }, + { + type = "generic_menu_background", + id = "menu_systemlink_join_bg_id", + properties = { + fill_alpha = 1 + }, + children = { + CreateHeaderDef(), + { + type = "UIVerticalList", + id = "menu_systemlink_join_game_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 4, + bottom = 600, + left = 2, + right = -2 + } + }, + childrenFeeder = LinkGamesFeeder, + handlers = { + update_game_list = UpdateGameList, + menu_create = function ( f12_arg0, f12_arg1 ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + f12_local0.serverList = f12_arg0 + RefreshServers( f12_arg0, f12_arg1 ) + end + + } + }, + { + type = "button_helper_text_main", + id = "online_vault_helper_text_id", + properties = { + left_inset = 10, + right_inset = -10, + top_margin = GenericFooterDims.TopMargin_WithoutBackground, + height = 42, + spacing = 12, + background_alpha = 0 + } + } + } + } + } + }, + { + type = "UITimer", + id = "menu_systemlink_join_update_timer", + properties = { + event = "update_game_list", + interval = 250, + disposable = false, + broadcastToRoot = true + } + }, + { + type = "UIBindButton", + id = "menu_systemlink_join_bind_button_id", + handlers = { + button_secondary = MBh.LeaveMenu(), + button_alt1 = RefreshServers + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "menu_systemlink_join", menu_systemlink_join ) +LockTable( _M ) diff --git a/lui/mp_menus/systemlinkmenu.dec.lua b/lui/mp_menus/systemlinkmenu.dec.lua new file mode 100644 index 0000000..18b64dc --- /dev/null +++ b/lui/mp_menus/systemlinkmenu.dec.lua @@ -0,0 +1,204 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function SystemLinkJoinGame( f1_arg0, f1_arg1 ) + Cac.ValidateAllPlayersPrivateSquadMembers() + if Engine.IsConsoleGame() then + if Engine.OfflineProfileCanSave( f1_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f1_arg0, "menu_systemlink_join", true, f1_arg1.controller, false ) + else + LUI.FlowManager.RequestPopupMenu( f1_arg0, "savegame_error_mp", true, f1_arg1.controller, false, { + callback_params = { + continue_to_menu = "menu_systemlink_join" + } + } ) + end + else + DebugPrint( "Menu Unsupported on PC at the moment..." ) + end +end + +function SystemLinkCreateGame( f2_arg0, f2_arg1 ) + local f2_local0 = Engine.OfflineProfileCanSave( f2_arg1.controller ) + Cac.ValidateAllPlayersPrivateSquadMembers() + if f2_local0 then + LUI.FlowManager.RequestAddMenu( f2_arg0, "menu_gamesetup_systemlink", false, f2_arg1.controller, false, {} ) + else + LUI.FlowManager.RequestPopupMenu( f2_arg0, "savegame_error_mp", true, f2_arg1.controller, false, { + callback_params = { + continue_to_menu = "menu_gamesetup_systemlink" + } + } ) + end +end + +f0_local0 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = "loadouts" + Cac.ValidateAllPlayersPrivateSquadMembers() + LUI.FlowManager.RequestAddMenu( f3_arg0, "cac_member_select_main", true, f3_arg1.controller, false, { + next_screen = "cac_edit_main", + squad_location = "privateMatchSquadMembers", + class_location = f3_local0 + } ) +end + +function SystemLinkCreateHandler( f4_arg0, f4_arg1 ) + LUI.FlowManager.RequestSetStack( f4_arg0, { + { + name = "mp_main_menu" + } + } ) + ConfigureResolution() + Engine.Exec( MPConfig.default_dvars ) + f4_arg0:dispatchEventToRoot( LUI.ButtonHelperText.CommonEvents.addBackButton ) + f4_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addGameSummaryButton ) + local f4_local0 = TryForceOpenAfterActionReport( f4_arg0, f4_arg1 ) + if MLG.AreMLGRulesEnabled() then + MLG.Toggle( f4_arg0, f4_arg1 ) + MLG.Hide( f4_arg0 ) + end + if not f4_local0 then + Engine.Exec( "SelectOfflineProfile" ) + end + Engine.PLMRefreshData() +end + +f0_local1 = function ( f5_arg0, f5_arg1 ) + LUI.FlowManager.RequestPopupMenu( f5_arg0, "menu_ps3_profile", true, f5_arg1.controller, false ) +end + +f0_local2 = function ( f6_arg0, f6_arg1 ) + Engine.SetDvarBool( "systemlink", false ) + Engine.Exec( "forcesplitscreencontrol systemLinkExit" ) + LUI.FlowManager.RequestLeaveMenu( self ) +end + +function SystemLinkOptionsFeeder( f7_arg0 ) + local f7_local0 = Engine.IsAliensMode() + local f7_local1 = { + [#f7_local1 + 1] = { + type = "UIGenericButton", + id = "join_game_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_JOIN_GAME_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_JOIN_GAME" ), + button_action_func = SystemLinkJoinGame + } + }, + [#f7_local1 + 1] = { + type = "UIGenericButton", + id = "create_game_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_CREATE_GAME_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_GAME" ), + button_action_func = SystemLinkCreateGame + } + } + } + if not f7_local0 then + f7_local1[#f7_local1 + 1] = { + type = "UIGenericButton", + id = "create_squad_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_CREATE_A_CLASS_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_DESC_CREATE_A_CLASS" ), + button_action_func = f0_local0 + } + } + else + f7_local1[#f7_local1 + 1] = LUI.mp_menus.AliensLoadout.GetAliensLoadoutButton() + if LUI.mp_menus.Aliens.CanAccessIntelMenu() then + f7_local1[#f7_local1 + 1] = LUI.mp_menus.AliensIntel.GetAliensIntelButton() + end + end + if Engine.IsPS3() then + f7_local1[#f7_local1 + 1] = { + type = "UIGenericButton", + id = "create_offline_profile_btn_id", + properties = { + button_text = Engine.Localize( "@LUA_MENU_CHANGE_OFFLINE_PROFILE" ), + desc_text = Engine.Localize( "@LUA_MENU_CHANGE_OFFLINE_PROFILE_DESC" ), + button_action_func = f0_local1 + } + } + end + f7_local1[#f7_local1 + 1] = { + type = "button_desc_text", + id = "systemlink_description_id" + } + return f7_local1 +end + +function menu_systemlink() + local f8_local0 = Engine.IsAliensMode() + return { + type = "UIElement", + id = "menu_systemlink_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = SystemLinkCreateHandler, + open_after_action_report = OpenAfterActionReport, + open_ps3_profile_menu = f0_local1, + exit_system_link = f0_local2 + }, + children = { + { + type = "generic_menu_title", + id = "system_link_menu_title", + properties = { + menu_title = Engine.Localize( "@PLATFORM_SYSTEM_LINK_TITLE" ) + } + }, + { + type = "UIVerticalList", + id = "live_systemlink_options_id", + states = { + default = { + alignment = LUI.Alignment.Top, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + childrenFeeder = SystemLinkOptionsFeeder + }, + { + type = "UIBindButton", + id = "lobby_bind_buttons_id", + handlers = { + button_secondary = f0_local2, + button_select = OpenAfterActionReport + } + }, + { + type = "button_helper_text_main", + id = "system_link_helper_text_id" + }, + { + type = "online_friends_widget", + id = "online_friends_widget_id" + } + } + } +end + +LUI.MenuBuilder.registerDef( "menu_systemlink", menu_systemlink ) +LUI.FlowManager.RegisterStackPopBehaviour( "menu_systemlink", clearMatchData ) +LockTable( _M ) diff --git a/lui/pcoptions.dec.lua b/lui/pcoptions.dec.lua new file mode 100644 index 0000000..c8ecb8f --- /dev/null +++ b/lui/pcoptions.dec.lua @@ -0,0 +1,1159 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function ButtonMenuAction( f1_arg0, f1_arg1 ) + LUI.FlowManager.RequestAddMenu( f1_arg0, f1_arg0.properties.menu, true, f1_arg1.controller, false ) +end + +function ChatDisableFunc( f2_arg0, f2_arg1 ) + local f2_local0 = SinglePlayerDisabled( f2_arg0, f2_arg1 ) + if not f2_local0 then + f2_local0 = GamepadDisabledFunc( f2_arg0, f2_arg1 ) + end + return f2_local0 +end + +function GamepadDisabledFunc( f3_arg0, f3_arg1 ) + return Engine.IsGamepadEnabled() == 1 +end + +function LeaveGameSetupOptionsMenu( f4_arg0, f4_arg1 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + if Engine.GetDvarString( "r_mode" ) ~= Engine.GetDvarString( "ui_r_mode" ) or Engine.GetDvarString( "r_displayMode" ) ~= Engine.GetDvarString( "ui_r_displayMode" ) then + LUI.FlowManager.RequestPopupMenu( f4_arg0, "apply_settings_restart_popmenu", false, f4_arg1.controller, false ) + end + LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) +end + +function GetLeaveOptionsWindowFunctionForButton( f5_arg0 ) + return function ( f6_arg0, f6_arg1 ) + local f6_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "pc_controls" ) + f6_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + Engine.PlaySound( CoD.SFX.SelectBack ) + f6_arg0:dispatchEventToRoot( { + name = "button_unlock", + immediate = true + } ) + f6_arg0:dispatchEventToRoot( { + name = "options_window_unfocus", + immediate = true + } ) + f6_arg0:dispatchEventToRoot( { + name = "options_categories_window_focus", + immediate = true + } ) + if f5_arg0 then + f5_arg0:processEvent( { + name = "gain_focus", + immediate = true + } ) + end + end + +end + +function BackButtonAction( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + if not f7_local0.currentBackButtonAction then + f7_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + end + f7_local0.currentBackButtonAction( f7_arg0, f7_arg1 ) +end + +function LockCurrentButton( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + local f8_local1 = f8_arg0:getChildById( f8_local0.currentOptionsCategory ) + if f8_local1 then + f8_local1:processEvent( { + name = "button_lock", + immediate = true + } ) + f8_local0.unlocked = true + end +end + +function optimal_notice() + return { + type = "generic_yesno_popup", + properties = { + popup_title = Engine.Localize( "@MENU_RESET_SYSTEM_DEFAULTS" ), + message_text = Engine.Localize( "@MENU_RESTORE_DEFAULTS" ), + yes_action = function ( f10_arg0, f10_arg1 ) + Engine.SetRecommended() + Engine.Exec( "wait; wait; r_applyPicmip;" ) + end + , + no_action = function ( f11_arg0, f11_arg1 ) + DebugPrint( "Running generic_onfirmation_popup no action" ) + end + , + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_NO" ) + } + } +end + +function OptionCategoryButtonAction( f12_arg0, f12_arg1 ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + OptionsWindowTriggerRefresh( f12_arg0, f12_arg1 ) + local f12_local1 = f12_arg0:getParent() + f12_local1:dispatchEventToChildren( { + name = "button_unlock", + immediate = true + } ) + if not f12_arg1.mouse then + f12_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 ) + f12_local1.currentBackButtonAction = GetLeaveOptionsWindowFunctionForButton( f12_arg0 ) + f12_arg0:dispatchEventToRoot( { + name = "options_window_focus", + immediate = true + } ) + f12_arg0:dispatchEventToRoot( { + name = "options_categories_window_unfocus", + immediate = true + } ) + end + f12_arg0:processEvent( { + name = "button_lock", + immediate = true + } ) + f12_local0.unlocked = false + f12_local1 = f12_arg0:getParent() + f12_local1:dispatchEventToChildren( { + name = "sp_voice_disable", + immediate = true + } ) +end + +function OptionCategoryButtonOver( f13_arg0, f13_arg1 ) + local f13_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f13_arg0 ) + if f13_arg1.focusType ~= FocusType.MenuFlow then + f13_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + end + local f13_local1 = OptionsWindowTriggerRefresh + local f13_local2 = f13_arg0 + local f13_local3 = f13_arg1 + local f13_local4 + if f13_arg1.focusType ~= FocusType.MenuFlow or Engine.IsGamepadEnabled() ~= 0 then + f13_local4 = false + else + f13_local4 = true + end + f13_local1( f13_local2, f13_local3, f13_local4 ) +end + +function OptionFactory( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5 ) + local f14_local0 = nil + local f14_local1 = 1 + local f14_local2 = Engine.GetDvarType( f14_arg0 ) + if f14_local2 == DvarTypeTable.DvarString then + f14_local0 = Engine.GetDvarString( f14_arg0 ) + elseif f14_local2 == DvarTypeTable.DvarInt then + f14_local0 = Engine.GetDvarInt( f14_arg0 ) + elseif f14_local2 == DvarTypeTable.DvarBool then + f14_local0 = Engine.GetDvarBool( f14_arg0 ) + end + for f14_local6, f14_local7 in pairs( f14_arg2 ) do + if f14_local7.value == f14_local0 then + f14_local1 = f14_local6 + break + end + end + f14_local3 = function ( f15_arg0, f15_arg1 ) + if f14_local2 == DvarTypeTable.DvarString then + Engine.SetDvarString( f14_arg0, f14_arg2[f14_local1].value ) + elseif f14_local2 == DvarTypeTable.DvarInt then + Engine.SetDvarInt( f14_arg0, f14_arg2[f14_local1].value ) + elseif f14_local2 == DvarTypeTable.DvarBool then + Engine.SetDvarBool( f14_arg0, f14_arg2[f14_local1].value ) + end + if f14_arg4 then + local f15_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f15_arg0 ) + f15_local0.showApplySettings = true + end + OptionsWindowTriggerPartialRefresh( f15_arg0, f15_arg1 ) + end + + return { + type = "UIGenericButton", + id = "option_" .. f14_arg0, + disabledFunc = f14_arg3 or function () + return false + end + , + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f14_arg1 ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function ( f17_arg0, f17_arg1 ) + local f17_local0 + if not f14_arg5 then + f17_local0 = Engine.Localize( f14_arg2[f14_local1].text ) + if not f17_local0 then + + else + return f17_local0 + end + end + f17_local0 = f14_arg2[f14_local1].text + end + , + button_left_func = function ( f18_arg0, f18_arg1 ) + f14_local1 = 1 + (#f14_arg2 + f14_local1 - 1 - 1) % #f14_arg2 + f14_local3( f18_arg0, f18_arg1 ) + end + , + button_right_func = function ( f19_arg0, f19_arg1 ) + f14_local1 = 1 + (f14_local1 - 1 + 1) % #f14_arg2 + f14_local3( f19_arg0, f19_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + } +end + +function OptionFactoryProfileData( f20_arg0, f20_arg1, f20_arg2, f20_arg3, f20_arg4 ) + local f20_local0 = Engine.GetProfileData( f20_arg0 ) + local f20_local1 = 1 + for f20_local5, f20_local6 in pairs( f20_arg3 ) do + if f20_local6.value == f20_local0 then + f20_local1 = f20_local5 + break + end + end + f20_local2 = function ( f21_arg0, f21_arg1 ) + Engine.Exec( f20_arg1 ) + OptionsWindowTriggerPartialRefresh( f21_arg0, f21_arg1 ) + end + + return { + type = "UIGenericButton", + id = "option_" .. f20_arg0, + disabledFunc = f20_arg4 or function () + return false + end + , + properties = { + style = GenericButtonSettings.Styles.GlassButton, + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f20_arg2 ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function ( f23_arg0, f23_arg1 ) + return Engine.Localize( f20_arg3[f20_local1].text ) + end + , + button_left_func = function ( f24_arg0, f24_arg1 ) + f20_local1 = 1 + (#f20_arg3 + f20_local1 - 1 - 1) % #f20_arg3 + f20_local2( f24_arg0, f24_arg1 ) + end + , + button_right_func = function ( f25_arg0, f25_arg1 ) + f20_local1 = 1 + (f20_local1 - 1 + 1) % #f20_arg3 + f20_local2( f25_arg0, f25_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + } +end + +function PCOptionsMainCreate( f26_arg0, f26_arg1 ) + local f26_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f26_arg0 ) + if not f26_local0.currentBackButtonAction or Engine.IsGamepadEnabled() == 0 then + f26_local0.currentBackButtonAction = LeaveGameSetupOptionsMenu + end + Engine.ExecNow( "profile_menuDvarsSetup" ) + f26_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + if not f26_local0.showApplySettings and not f26_local0.picmipApplySettings then + Engine.ExecNow( "exec options_graphics.cfg" ) + end + if Engine.IsGamepadEnabled() == 1 and f26_local0.currentOptionsCategory then + f26_local0.currentBackButtonAction = GetLeaveOptionsWindowFunctionForButton( f26_arg0:getFirstDescendentById( f26_local0.currentOptionsCategory ) ) + end + if f26_local0.currentOptionsCategory then + local f26_local1 = f26_arg0:getFirstDescendentById( f26_local0.currentOptionsCategory .. "_id" ) + if f26_local1 then + f26_local1:processEvent( { + name = "button_lock", + immediate = false + } ) + f26_local0.unlocked = false + end + end + if not f26_local0.currentOptionsCategory then + f26_local0.currentOptionsCategory = "video_options" + end + OptionsWindowTriggerRefresh( f26_arg0, f26_arg1, true ) +end + +function SliderOptionFactory( f27_arg0, f27_arg1, f27_arg2, f27_arg3, f27_arg4, f27_arg5, f27_arg6, f27_arg7, f27_arg8, f27_arg9 ) + local f27_local0 = function ( f28_arg0, f28_arg1, f28_arg2, f28_arg3, f28_arg4 ) + local f28_local0 = Engine.GetDvarFloat( f27_arg0 ) + if f28_local0 then + Engine.SetDvarFloat( f27_arg0, math.min( f28_arg3, math.max( f28_arg2, f28_local0 + f28_arg4 ) ) ) + if f27_arg9 ~= nil then + f28_arg0:dispatchEventToRoot( { + name = f27_arg9, + immediate = true + } ) + end + end + Engine.MenuDvarsFinish( f28_arg1.controller ) + end + + return { + type = "UIGenericButton", + id = "options_" .. f27_arg0, + disabledFunc = f27_arg8 or function () + return false + end + , + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( f27_arg1 ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function ( f30_arg0, f30_arg1 ) + local f30_local0 = Engine.GetDvarFloat( f27_arg0 ) + if f30_local0 then + local f30_local1 = (f30_local0 - f27_arg2) / (f27_arg3 - f27_arg2) + if f27_arg7 then + f30_local1 = 1 - f30_local1 + end + return f30_local1 + else + + end + end + , + button_left_func = function ( f31_arg0, f31_arg1 ) + f27_local0( f31_arg0, f31_arg1, f27_arg2, f27_arg3, -f27_arg4 ) + end + , + button_right_func = function ( f32_arg0, f32_arg1 ) + f27_local0( f32_arg0, f32_arg1, f27_arg2, f27_arg3, f27_arg4 ) + end + , + button_over_func = f27_arg5, + button_up_func = f27_arg6 + } + } +end + +function OptionsFeeder() + local f33_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "pc_controls" ) + local f33_local1 = f33_local0.currentOptionsCategory + if f33_local1 == "video_options" then + return VideoOptionsFeeder() + elseif f33_local1 == "audio_options" then + return AudioOptionsFeeder() + elseif f33_local1 == "voice_options" then + return VoiceOptionsFeeder() + elseif f33_local1 == "control_options" then + return ControlOptionsFeeder() + else + return VideoOptionsFeeder() + end +end + +function PCOptionsMainClose( f34_arg0, f34_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + if Engine.GetDvarString( "r_lodScaleRigid" ) == "2" then + Engine.SetDvarString( "r_lodScaleSkinned", "4" ) + Engine.SetDvarString( "r_lodBiasSkinned", "-200" ) + Engine.SetDvarString( "r_lodBiasRigid", "-100" ) + end + if Engine.GetDvarString( "r_lodScaleRigid" ) == "1" then + Engine.SetDvarString( "r_lodScaleSkinned", "1" ) + Engine.SetDvarString( "r_lodBiasSkinned", "0" ) + Engine.SetDvarString( "r_lodBiasRigid", "0" ) + end + Engine.Exec( "updategamerprofile" ) +end + +function OptionsWindowBGResize( f35_arg0, f35_arg1 ) + f35_arg0:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight, + bottom = GenericTitleBarDims.TitleBarHeight + CountFields( f35_arg1.options ) * (GenericButtonSettings.Styles.GlassButton.SubStyles.Default.height + PCOptionsMenuDimensions.Spacing) + 2 * PCOptionsMenuDimensions.Padding, + left = 0, + right = 0 + } ) + f35_arg0:animateToState( "current", 0 ) +end + +function OptionsWindowRefresh( f36_arg0, f36_arg1 ) + if f36_arg1.source_input == "button_action" or f36_arg1.source_input == "menu_create" or f36_arg1.source_input == "button_over" and f36_arg1.focusType ~= FocusType.MouseOver then + local f36_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f36_arg0 ) + local f36_local1 = f36_arg0 + local f36_local2 = f36_arg0.processEvent + local f36_local3 = { + name = "pre_menu_refresh" + } + local f36_local4 + if not f36_arg1.noCategoryChange then + f36_local4 = f36_arg1.options_category + if not f36_local4 then + + else + f36_local3.options_category = f36_local4 + f36_local2( f36_local1, f36_local3 ) + f36_arg0:processEvent( { + name = "menu_refresh" + } ) + OptionsWindowResize( f36_arg0, f36_arg1 ) + OptionsWindowTitleUpdate( f36_arg0, f36_arg1 ) + if not f36_local0.unlocked and f36_arg1.source_input ~= "menu_create" then + f36_local0.unlocked = true + f36_arg0:dispatchEventToRoot( { + name = "button_unlock", + immediate = true + } ) + f36_arg1.source_button:processEvent( { + name = "gain_focus", + immediate = true + } ) + end + end + end + f36_local4 = nil + end +end + +function OptionsWindowPartialRefresh( f37_arg0, f37_arg1 ) + if not Engine.IsConsoleGame() and (f37_arg1.source_input == "button_action" or f37_arg1.source_input == "button_left" or f37_arg1.source_input == "button_right") then + f37_arg0:processEvent( { + name = "menu_refresh" + } ) + end +end + +function OptionsWindowResize( f38_arg0, f38_arg1 ) + local f38_local0 = f38_arg0 + local f38_local1 = f38_arg0.processEvent + local f38_local2 = { + name = "window_resize" + } + local f38_local3 = f38_arg0:getChildById( "pc_controls_window_content" ) + f38_local2.options = f38_local3.childRecord + f38_local1( f38_local0, f38_local2 ) +end + +function OptionsWindowShadowResize( f39_arg0, f39_arg1 ) + f39_arg0:registerAnimationState( "current", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = GenericTitleBarDims.TitleBarHeight + CountFields( f39_arg1.options ) * (GenericButtonSettings.Styles.GlassButton.SubStyles.Default.height + PCOptionsMenuDimensions.Spacing) + 2 * PCOptionsMenuDimensions.Padding + } ) + f39_arg0:animateToState( "current", 0 ) +end + +function OptionsWindowTitleUpdate( f40_arg0, f40_arg1 ) + local f40_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f40_arg0 ) + local f40_local1 = f40_local0.currentOptionsCategory + local f40_local2 = "" + if f40_local1 then + if f40_local1 == "video_options" then + f40_local2 = Engine.Localize( "@LUA_MENU_VIDEO_OPTIONS_CAPS" ) + elseif f40_local1 == "audio_options" then + f40_local2 = Engine.Localize( "@LUA_MENU_AUDIO_OPTIONS_CAPS" ) + elseif f40_local1 == "control_options" then + f40_local2 = Engine.Localize( "@LUA_MENU_CONTROL_OPTIONS_CAPS" ) + elseif f40_local1 == "voice_options" then + f40_local2 = Engine.Localize( "@LUA_MENU_VOICE_OPTIONS_CAPS" ) + else + f40_local2 = Engine.Localize( "@LUA_MENU_VIDEO_OPTIONS_CAPS" ) + end + else + f40_local2 = Engine.Localize( "@LUA_MENU_VIDEO_OPTIONS_CAPS" ) + end + f40_arg0:processEvent( { + name = "update_title", + title_text = f40_local2 + } ) +end + +function OptionsWindowTriggerRefresh( f41_arg0, f41_arg1, f41_arg2 ) + local f41_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f41_arg0 ) + f41_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f41_arg1.name, + options_category = f41_arg0.properties.options_category, + focusType = f41_arg1.focusType, + noCategoryChange = f41_arg2, + source_button = f41_arg0, + immediate = true + } ) +end + +function OptionsWindowTriggerPartialRefresh( f42_arg0, f42_arg1 ) + f42_arg0:dispatchEventToRoot( { + name = "options_window_partial_refresh", + source_input = f42_arg1.name, + options_category = f42_arg0.properties.options_category, + immediate = true + } ) +end + +function PrepareMenuRefresh( f43_arg0, f43_arg1 ) + f43_arg0:closeChildren() + f43_arg0:clearSavedState() + local f43_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f43_arg0 ) + if f43_arg1.options_category then + f43_local0.currentOptionsCategory = f43_arg1.options_category + end +end + +function PrepareMenuPartialRefresh( f44_arg0, f44_arg1 ) + f44_arg0:closeChildren() + f44_arg0:clearSavedState() +end + +function ResolutionDisabledFunc( f45_arg0, f45_arg1 ) + return Engine.GetDvarString( "ui_r_displayMode" ) == "windowed (no border)" +end + +function BrightnessOverFunc( f46_arg0, f46_arg1 ) + if f46_arg1.focusType ~= FocusType.MenuFlow then + f46_arg0:dispatchEventToRoot( { + name = "brightness_over" + } ) + end +end + +function VideoOptionsFeeder() + local f47_local0 = {} + local f47_local1 = {} + for f47_local5, f47_local6 in pairs( Engine.GetDvarEnumList( "r_mode" ) ) do + f47_local1[#f47_local1 + 1] = { + text = f47_local6, + value = f47_local6 + } + end + f47_local0[#f47_local0 + 1] = OptionFactory( "ui_r_mode", "@LUA_MENU_VIDEO_MODE", f47_local1, ResolutionDisabledFunc, true, true ) + f47_local0[#f47_local0 + 1] = OptionFactory( "ui_r_displayMode", "@LUA_MENU_DISPLAY_MODE", { + { + text = "@LUA_MENU_MODE_FULLSCREEN", + value = "fullscreen" + }, + { + text = "@LUA_MENU_MODE_WINDOWED_NO_BORDER", + value = "windowed (no border)" + }, + { + text = "@LUA_MENU_MODE_WINDOWED", + value = "windowed" + } + }, nil, true ) + f47_local0[#f47_local0 + 1] = SliderOptionFactory( "profileMenuOption_blacklevel", "@MENU_BRIGHTNESS", SliderBounds.PCBrightness.Min, SliderBounds.PCBrightness.Max, SliderBounds.PCBrightness.Step, BrightnessOverFunc, MBh.EmitEventToRoot( { + name = "brightness_up" + } ), true, nil, "brightness_updated" ) + f47_local0[#f47_local0 + 1] = OptionFactoryProfileData( "renderColorBlind", "profile_toggleRenderColorBlind", "@LUA_MENU_COLORBLIND_FILTER", { + { + text = "@LUA_MENU_ENABLED", + value = true + }, + { + text = "@LUA_MENU_DISABLED", + value = false + } + } ) + f47_local0[#f47_local0 + 1] = { + type = "UIGenericButton", + id = "option_advanced_video", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + button_text = Engine.Localize( "@LUA_MENU_ADVANCED_VIDEO" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "advanced_video" + } + } + return f47_local0 +end + +function AudioOptionsFeeder() + local f48_local0 = { + [#f48_local0 + 1] = SliderOptionFactory( "profileMenuOption_volume", "@MENU_MASTER_VOLUME", SliderBounds.Volume.Min, SliderBounds.Volume.Max, SliderBounds.Volume.PCStep ) + } + if Engine.GetCurrentLanguage() ~= 6 and SinglePlayerDisabled() then + f48_local0[#f48_local0 + 1] = OptionFactoryProfileData( "subtitles", "profile_toggleSubtitles", "@LUA_MENU_SUBTITLES", { + { + text = "@LUA_MENU_ENABLED", + value = true + }, + { + text = "@LUA_MENU_DISABLED", + value = false + } + } ) + end + return f48_local0 +end + +function ControlOptionsFeeder() + local f49_local0 = { + [#f49_local0 + 1] = { + type = "UIGenericButton", + id = "option_movement_controls", + disabledFunc = GamepadDisabledFunc, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_MOVEMENT" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "movement_controls" + } + }, + [#f49_local0 + 1] = { + type = "UIGenericButton", + id = "option_actions_controls", + disabledFunc = GamepadDisabledFunc, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_ACTIONS" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "actions_controls" + } + }, + [#f49_local0 + 1] = { + type = "UIGenericButton", + id = "option_look_controls", + disabledFunc = GamepadDisabledFunc, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_LOOK" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "look_controls" + } + }, + [#f49_local0 + 1] = { + type = "UIGenericButton", + id = "option_chat_controls", + disabledFunc = ChatDisableFunc, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_CHAT" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "chat_controls" + } + }, + [#f49_local0 + 1] = { + type = "UIGenericButton", + id = "option_gamepad_controls", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_GAMEPAD" ), + button_action_func = ButtonMenuAction, + text_align_without_content = LUI.Alignment.Left, + menu = "gamepad_controls" + } + }, + [#f49_local0 + 1] = { + type = "UIGenericButton", + id = "option_restore_controls", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, + button_text = Engine.Localize( "@LUA_MENU_RESTORE_DEFAULT_CONTROLS" ), + button_action_func = MBh.PopupMenu( "reset_controls", false, false ), + text_align_without_content = LUI.Alignment.Left + } + } + } + return f49_local0 +end + +function SinglePlayerDisabled( f50_arg0, f50_arg1 ) + return not Engine.IsMultiplayer() +end + +function SinglePlayerVoiceDisable( f51_arg0, f51_arg1 ) + if SinglePlayerDisabled( f51_arg0, f51_arg1 ) then + f51_arg0:processEvent( { + name = "disable" + } ) + end +end + +function MicThreshDisable() + return Engine.GetDvarBool( "cl_pushToTalk" ) +end + +function VoiceOptionsFeeder() + local f53_local0 = { + [#f53_local0 + 1] = SliderOptionFactory( "winvoice_mic_reclevel", "@LUA_MENU_VOICECHAT_RECORD_LEVEL", SliderBounds.VoiceRecord.Min, SliderBounds.VoiceRecord.Max, SliderBounds.VoiceRecord.Step ), + [#f53_local0 + 1] = { + type = "UIGenericButton", + id = "option_voice_indicator_button", + disabled = true, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@LUA_MENU_VOICECHAT_LEVEL_INDICATOR" ), + text_padding_with_content = 10, + text_align_with_content = LUI.Alignment.Left, + button_display_func = function () + return "" + end, + disable_padlock = true + }, + children = { + { + type = "UIOwnerdraw", + id = "indicator_owner_draw", + properties = { + ownerDraw = CoD.Ownerdraw.UIRecordLevel + }, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = -212, + right = -64, + top = 8, + bottom = -5, + alpha = 1 + } + } + } + } + }, + [#f53_local0 + 1] = SliderOptionFactory( "winvoice_mic_threshold", "@LUA_MENU_PICKUP_THRESHOLD", SliderBounds.VoiceThreshold.Min, SliderBounds.VoiceThreshold.Max, SliderBounds.VoiceThreshold.Step, nil, nil, nil, MicThreshDisable ), + [#f53_local0 + 1] = OptionFactory( "cl_pushToTalk", "@LUA_MENU_PUSH_TO_TALK", { + { + text = "@LUA_MENU_NO", + value = false + }, + { + text = "@LUA_MENU_YES", + value = true + } + } ), + [#f53_local0 + 1] = OptionFactory( "cl_voice", "@LUA_MENU_USE_VOICE_COMMUNICATIONS", { + { + text = "@LUA_MENU_NO", + value = false + }, + { + text = "@LUA_MENU_YES", + value = true + } + } ), + [#f53_local0 + 1] = OptionFactory( "cl_textChatEnabled", "@LUA_MENU_TEXTCHATENABLED", { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } ) + } + return f53_local0 +end + +function ResetControlsYesAction( f55_arg0, f55_arg1 ) + Engine.ExecNow( "profile_toggleLean 1", f55_arg1.controller ) + if Engine.IsGamepadEnabled() == 1 then + Engine.ExecNow( "profile_setSticksConfig thumbstick_default", f55_arg1.controller ) + Engine.ExecNow( "profile_setButtonsConfig buttons_default", f55_arg1.controller ) + Engine.ExecNow( "profile_toggleInvertedPitch 0", f55_arg1.controller ) + Engine.ExecNow( "profile_toggleRumble 1", f55_arg1.controller ) + Engine.ExecNow( "profile_toggleAutoAim 1", f55_arg1.controller ) + Engine.SetDvarFloat( "profileMenuOption_sensitivity", 3 ) + else + Engine.Exec( "exec default_smp_controls.cfg" ) + end +end + +function reset_controls() + return { + type = "generic_yesno_popup", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_SET_DEFAULT_CONTROLS" ), + message_text = Engine.Localize( "@LUA_MENU_RESTORE_EACH_SETTING" ), + yes_action = ResetControlsYesAction, + no_action = function ( f57_arg0, f57_arg1 ) + DebugPrint( "Running generic_confirmation_popup no action" ) + end + , + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function pc_controls_window() + return { + type = "UIElement", + id = "pc_controls_window_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 120, + bottom = 219, + left = 460, + right = 940 + } + }, + handlers = { + options_window_force_resize = OptionsWindowResize, + menu_create = OptionsWindowResize, + options_window_title_update = OptionsWindowTitleUpdate, + options_window_refresh = OptionsWindowRefresh, + options_window_partial_refresh = OptionsWindowPartialRefresh, + options_window_focus = MBh.EmitEvent( "gain_focus" ), + options_window_unfocus = MBh.EmitEvent( "lose_focus" ) + }, + children = { + { + type = "generic_drop_shadow", + id = "pc_controls_window_shadow_id", + properties = { + offset_shadow = 0 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alpha = 0.75 + } + }, + handlers = { + window_resize = OptionsWindowShadowResize + } + }, + { + type = "generic_menu_titlebar", + id = "pc_controls_window_title_id", + properties = { + font = CoD.TextSettings.BoldFont, + title_bar_text = "", + title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth, + title_bar_alignment = LUI.Alignment.Left, + fill_alpha = 1, + border_alpha = 1 + }, + handlers = { + menu_create = MBh.EmitEventToParent( "options_window_title_update" ) + } + }, + { + type = "generic_menu_background", + id = "pc_controls_window_background_id", + properties = { + fill_alpha = 1, + border_alpha = 1 + }, + handlers = { + window_resize = OptionsWindowBGResize + } + }, + { + type = "UIVerticalList", + id = "pc_controls_window_content", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + PCOptionsMenuDimensions.Padding, + bottom = 600, + left = PCOptionsMenuDimensions.Padding, + right = -PCOptionsMenuDimensions.Padding, + spacing = PCOptionsMenuDimensions.Spacing + } + }, + handlers = { + pre_menu_refresh = PrepareMenuRefresh, + pre_menu_partial_refresh = PrepareMenuPartialRefresh + }, + childrenFeeder = OptionsFeeder + } + } + } +end + +function pc_controls_categories() + local f59_local0 = { + [#f59_local0 + 1] = { + type = "UIGenericButton", + id = "video_options_id", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_VIDEO_OPTIONS_CAPS" ), + options_category = "video_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction + } + }, + [#f59_local0 + 1] = { + type = "UIGenericButton", + id = "audio_options_id", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_AUDIO_OPTIONS_CAPS" ), + options_category = "audio_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction + } + }, + [#f59_local0 + 1] = { + type = "UIGenericButton", + id = "control_options_id", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_CONTROL_OPTIONS_CAPS" ), + options_category = "control_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction + } + } + } + if Engine.IsMultiplayer() then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "voice_options_id", + disabledFunc = SinglePlayerDisabled, + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_VOICE_OPTIONS_CAPS" ), + options_category = "voice_options" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = OptionCategoryButtonAction, + sp_voice_disable = SinglePlayerVoiceDisable + } + } + end + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "optimal_video_and_audio_button_id", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_OPTIMAL_VIDEO_AUDIO_CAPS" ), + options_category = "optimal_video_and_audio_button" + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = MBh.PopupMenu( "optimal_notice", false, false ) + } + } + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "manual_button_id", + properties = { + style = GenericButtonSettings.Styles.FlatButton, + button_text = Engine.Localize( "@LUA_MENU_GAME_MANUAL_CAPS" ) + }, + handlers = { + button_over = OptionCategoryButtonOver, + button_action = function ( f60_arg0, f60_arg1 ) + local f60_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f60_arg0 ) + f60_local0.currentOptionsCategory = nil + LUI.FlowManager.RequestAddMenu( f60_arg0, "game_manual", true, f60_arg1.controller, false ) + end + } + } + return { + type = "UIElement", + id = "pc_controls_categories_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 120, + bottom = 620, + left = 130, + right = 420 + } + }, + handlers = { + options_categories_window_focus = MBh.EmitEvent( { + name = "gain_focus" + } ), + options_categories_window_unfocus = MBh.EmitEvent( "lose_focus" ) + }, + children = { + { + type = "generic_menu_background_withfade", + properties = { + top_offset = 0, + fill_alpha = 1, + border_alpha = 1 + } + }, + { + type = "UIElement", + id = "padding_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + top = 6, + bottom = -6, + left = 6, + right = -6 + } + }, + children = { + { + type = "UIVerticalList", + id = "options_categories_vlist_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + spacing = 6 + } + }, + handlers = { + menu_create = LockCurrentButton + }, + children = f59_local0 + } + } + } + } + } +end + +function pc_controls() + return { + type = "UIElement", + id = "pc_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = PCOptionsMainCreate, + menu_close = PCOptionsMainClose + }, + children = { + { + type = "generic_menu_title", + id = "options_menu_title_id", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ) + } + }, + { + type = "pc_controls_window", + id = "pc_controls_window_id" + }, + { + type = "pc_controls_categories", + id = "pc_controls_categories_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "brightness_guide", + id = "brightness_guide_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 330, + left = 575, + width = 255, + height = 255, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + properties = { + band_height = 85 + } + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = BackButtonAction + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "optimal_notice", optimal_notice ) +LUI.MenuBuilder.registerDef( "reset_controls", reset_controls ) +LUI.MenuBuilder.registerDef( "pc_controls", pc_controls ) +LUI.MenuBuilder.registerDef( "pc_controls_categories", pc_controls_categories ) +LUI.MenuBuilder.registerDef( "pc_controls_window", pc_controls_window ) +LockTable( _M ) diff --git a/lui/persistentbackground.dec.lua b/lui/persistentbackground.dec.lua new file mode 100644 index 0000000..15eef2c --- /dev/null +++ b/lui/persistentbackground.dec.lua @@ -0,0 +1,1055 @@ +PersistentBackground = { + Init = function () + PersistentBackground.SetToDefault() + end, + SetToDefault = function () + if not Engine.IsMultiplayer() then + PersistentBackground.Set( PersistentBackground.Variants.SPBackground ) + elseif Engine.IsAliensMode() then + PersistentBackground.Set( PersistentBackground.Variants.AliensBackground ) + elseif SvS.IsSvS() then + PersistentBackground.Set( PersistentBackground.Variants.SvSBackground ) + else + PersistentBackground.Set( PersistentBackground.Variants.MPBackground ) + end + end, + Set = function ( f3_arg0 ) + local f3_local0 = Engine.GetLuiRoot() + if f3_arg0 == PersistentBackground.current then + PersistentBackground.ProcessEvent( { + name = "refresh_alien_tint" + } ) + return + elseif not f3_local0.background then + local self = LUI.UIElement.new() + self.id = "persistent_bg_container" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + self:setupLetterboxElement() + self:setUseStencil( true ) + f3_local0.background = self + f3_local0.background:setPriority( -1000 ) + f3_local0:addElement( self ) + end + if f3_arg0 then + local self = f3_arg0() + f3_local0.background:closeChildren() + f3_local0.background:addElement( self ) + f3_local0.background:processEvent( { + name = "menu_create", + dispatchChildren = true + } ) + end + PersistentBackground.current = f3_arg0 + end, + ProcessEvent = function ( f4_arg0 ) + local f4_local0 = Engine.GetLuiRoot() + if f4_local0.background then + f4_local0.background:processEvent( f4_arg0 ) + end + end, + Hide = function ( f5_arg0 ) + local f5_local0 = Engine.GetLuiRoot() + if f5_local0.background then + f5_local0.background:animateToState( "hidden", f5_arg0 or 0 ) + end + end, + Show = function ( f6_arg0 ) + local f6_local0 = Engine.GetLuiRoot() + if f6_local0.background then + f6_local0.background:animateToState( "default", f6_arg0 or 0 ) + else + DebugPrint( "WARNING: Trying to show menu persistent background but none has been set" ) + end + end +} +local f0_local0 = function () + local self = LUI.UIImage.new() + self:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 300, + height = 256, + right = 0, + width = 256 + } ) ) + self:registerAnimationState( "far", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 300, + height = 256, + left = 0, + width = 256 + } ) + self:animateToState( "default" ) + local f7_local1 = MBh.AnimateLoop( { + { + "default", + 0 + }, + { + "far", + 5000 + } + } ) + f7_local1( self, {} ) + return self +end + +local f0_local1 = function () + local f8_local0 = "background_start" + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f8_local2 = LUI.UIImage.new() + f8_local2:registerAnimationState( "default", { + material = RegisterMaterial( f8_local0 ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f8_local2:animateToState( "default" ) + f8_local2:registerEventHandler( "update_sp_persistent_background", function ( element, event ) + element:setImage( event.newImage ) + end ) + self:addElement( f8_local2 ) + local f8_local3 = { + type = "UIElement", + id = "smoky_bg_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "background_smoky_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "frontend_sp_alpha_shards" ), + alpha = 0.75 + }, + left = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = -1280, + right = -1280 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "default", + 0, + false, + false + }, + { + "left", + 60000, + false, + false + } + } ) + } + }, + { + type = "UIImage", + id = "background_smoky_2_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 1280, + right = 1280, + material = RegisterMaterial( "frontend_sp_alpha_shards" ), + alpha = 0.75 + }, + right = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "default", + 0, + false, + false + }, + { + "right", + 60000, + false, + false + } + } ) + } + } + } + } + local f8_local4 = { + type = "UIElement", + id = "skull_image_container_id", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -750, + bottom = 30, + left = 100, + right = -680, + alpha = 0 + }, + normal = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -750, + bottom = 30, + left = 100, + right = -680, + alpha = 1 + } + }, + handlers = { + enter_lockout_menu = MBh.AnimateToState( "default", 500 ), + menu_create = function ( f10_arg0 ) + f10_arg0:animateToState( "normal", 500 ) + end + }, + children = { + { + type = "UIImage", + id = "skull_image_intro01_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "frontend_sp_alpha_art_01" ), + alpha = 0 + }, + intro1 = { + alpha = 0 + }, + loopstate1 = { + alpha = 0.2 + } + }, + handlers = { + menu_create = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "intro1", + 500 + } + } ), + transition_complete_intro1 = MBh.AnimateLoop( { + { + "loopstate1", + 2000 + }, + { + "intro1", + 2000 + } + } ) + } + }, + { + type = "UIImage", + id = "skull_image_intro02_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "frontend_sp_alpha_art_02" ), + alpha = 0 + }, + intro2 = { + alpha = 0 + }, + loopstate2 = { + alpha = 0.2 + } + }, + handlers = { + menu_create = MBh.AnimateSequence( { + { + "default", + 1000 + }, + { + "intro2", + 2000 + } + } ), + transition_complete_intro2 = MBh.AnimateLoop( { + { + "loopstate2", + 2000 + }, + { + "intro2", + 2000 + } + } ) + } + }, + { + type = "UIImage", + id = "skull_image_intro03_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "frontend_sp_alpha_art_03" ), + alpha = 0 + }, + intro3 = { + alpha = 0 + }, + loopstate3 = { + alpha = 0.2 + } + }, + handlers = { + menu_create = MBh.AnimateSequence( { + { + "default", + 2000 + }, + { + "intro3", + 2000 + } + } ), + transition_complete_intro3 = MBh.AnimateLoop( { + { + "loopstate3", + 2000 + }, + { + "intro3", + 2000 + } + } ) + } + }, + { + type = "UIImage", + id = "skull_image_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "frontend_sp_alpha_art" ), + alpha = 0 + }, + intro4 = { + alpha = 0.2 + }, + loopstate4 = { + alpha = 0.3 + } + }, + handlers = { + menu_create = MBh.AnimateSequence( { + { + "default", + 3000 + }, + { + "intro4", + 3000 + } + } ), + transition_complete_intro4 = MBh.AnimateLoop( { + { + "loopstate4", + 3000 + }, + { + "intro4", + 3000 + } + } ) + } + } + } + } + LUI.MenuBuilder.BuildAddChild( self, f8_local3 ) + self:registerEventHandler( "enter_main_menu", function ( element, event ) + if self.skull then + self.skull:close() + end + self.skull = LUI.MenuBuilder.BuildAddChild( self, f8_local4 ) + self.skull:processEvent( { + name = "menu_create", + dispatchChildren = true + } ) + end ) + return self +end + +local f0_local2 = function ( f12_arg0 ) + local f12_local0 = "frontend_mp_alpha_art" + local f12_local1 = "frontend_mp_alpha_art_blur" + local f12_local2 = "frontend_mp_alpha_shards_mid" + local f12_local3 = "frontend_mp_alpha_shards_fore" + local f12_local4 = "frontend_mp_add_glints" + local f12_local5 + if f12_arg0 then + f12_local5 = 1 + if not f12_local5 then + + else + local f12_local6 + if f12_arg0 then + f12_local6 = 0 + if not f12_local6 then + + else + local f12_local7 + if f12_arg0 then + f12_local7 = 0 + if not f12_local7 then + + else + local f12_local8 + if f12_arg0 then + f12_local8 = 0 + if not f12_local8 then + + else + local f12_local9 + if f12_arg0 then + f12_local9 = true + else + f12_local9 = false + end + local f12_local10 + if f12_arg0 then + f12_local10 = 0 + if not f12_local10 then + + else + if f12_arg0 then + if f12_arg0.squads then + f12_local0 = "frontend_sq_art" + f12_local1 = "frontend_sq_art_blur" + elseif f12_arg0.aliens then + f12_local0 = "frontend_aliens_art" + f12_local1 = "frontend_aliens_art_blur" + end + if f12_arg0.squads or f12_arg0.aliens then + f12_local2 = "frontend_sp_alpha_shards" + end + end + return LUI.MenuBuilder.buildItems( { + type = "UIElement", + id = "mp_bg_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "bg_image_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( f12_local0 ) + } + } + }, + { + type = "UIImage", + id = "bg_image_blurry_id", + states = { + default = { + material = RegisterMaterial( f12_local1 ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + }, + active = { + alpha = 1 + } + }, + handlers = { + unblur_persistent_background = function ( f13_arg0, f13_arg1 ) + f13_arg0:animateToState( "default", f13_arg1.duration or 0 ) + end + , + blur_persistent_background = function ( f14_arg0, f14_arg1 ) + f14_arg0:animateToState( "active", f14_arg1.duration or 0 ) + end + + } + }, + { + type = "UIImage", + id = "background_shards_mid_img_id", + states = { + default = { + topAnchor = f12_local9, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f12_local10, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( f12_local2 ), + alpha = f12_local5 + }, + left = { + topAnchor = f12_local9, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f12_local10, + bottom = 0, + left = -1280, + right = -1280 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "default", + 0, + false, + false + }, + { + "left", + 60000, + false, + false + } + } ) + } + }, + { + type = "UIImage", + id = "background_shards2_mid_img_id", + states = { + default = { + topAnchor = f12_local9, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f12_local10, + bottom = 0, + left = 1280, + right = 1280, + material = RegisterMaterial( f12_local2 ), + alpha = f12_local5 + }, + right = { + topAnchor = f12_local9, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f12_local10, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "default", + 0, + false, + false + }, + { + "right", + 60000, + false, + false + } + } ) + } + }, + { + type = "UIImage", + id = "background_fore_img_id", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -190, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( f12_local3 ), + alpha = f12_local6 + }, + left = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -190, + bottom = 0, + left = -1280, + right = -1280 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "default", + 0, + false, + false + }, + { + "left", + 40000, + false, + false + } + } ) + } + }, + { + type = "UIImage", + id = "background_fore2_img_id", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -190, + bottom = 0, + left = 1280, + right = 1280, + material = RegisterMaterial( f12_local3 ), + alpha = f12_local6 + }, + right = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -190, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "default", + 0, + false, + false + }, + { + "right", + 40000, + false, + false + } + } ) + } + }, + { + type = "UIImage", + id = "background_mp_glints_img_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( f12_local4 ), + alpha = f12_local7 + }, + left = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = -640, + right = -640, + alpha = f12_local8 + }, + left2 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = -1280, + right = -1280, + alpha = f12_local7 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "default", + 0, + false, + false + }, + { + "left", + 15000, + false, + false + }, + { + "left2", + 15000, + false, + false + } + } ) + } + }, + { + type = "UIImage", + id = "background_mp_glints2_img_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 1280, + right = 1280, + material = RegisterMaterial( f12_local4 ), + alpha = f12_local7 + }, + right = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 640, + right = 640, + alpha = f12_local8 + }, + right2 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = f12_local7 + } + }, + handlers = { + menu_create = MBh.AnimateLoop( { + { + "default", + 0, + false, + false + }, + { + "right", + 15000, + false, + false + }, + { + "right2", + 15000, + false, + false + } + } ) + } + }, + { + type = "UIImage", + id = "large_map_preview_id", + states = { + default = { + material = RegisterMaterial( "loadscreen_mp_prisonbreak" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + background_transition_timer = RefreshLargeMapImage, + menu_create = InitLargeMapImage + }, + children = { + { + type = "UIImage", + id = "large_map_preview_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + lobby_transition_to_game = ShowAliensCleanLobbyBkg, + lobby_rollback_transition_to_game = MBh.AnimateToState( "default", Lobby.TransitionTime ) + } + }, + { + type = "UIImage", + id = "large_map_preview_overlay_id", + states = { + default = { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + red = Swatches.Overlay.Color.r, + green = Swatches.Overlay.Color.g, + blue = Swatches.Overlay.Color.b, + alpha = Swatches.Overlay.AlphaMedium + }, + hidden = { + alpha = 0 + }, + rollback = { + alpha = Swatches.Overlay.AlphaMedium + } + }, + handlers = { + lobby_transition_to_game = MBh.AnimateToStateWithEvent( "hidden", Lobby.TransitionTime, false, false ), + transition_complete_hidden = MBh.EmitEventToRoot( "lobby_transition_complete" ), + lobby_rollback_transition_to_game = MBh.AnimateToState( "rollback", Lobby.TransitionTime ) + } + }, + GetUpperGradient(), + GetLowerGradient(), + { + type = "UITimer", + properties = { + event = "background_transition_timer", + interval = 200, + disposable = false + } + } + } + }, + { + type = "UIImage", + id = "bg_image_tint_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "box_alien_color_tint" ), + red = Colors.alien_frontend_hilite.r, + green = Colors.alien_frontend_hilite.g, + blue = Colors.alien_frontend_hilite.b, + alpha = 0 + }, + aliens = { + alpha = 0.2 + } + }, + handlers = { + menu_create = MBh.EmitEvent( { + name = "refresh_alien_tint" + } ), + refresh_alien_tint = function ( f15_arg0, f15_arg1 ) + local f15_local0 = "default" + if Engine.IsAliensMode() then + f15_local0 = "aliens" + end + f15_arg0:animateToState( f15_local0 ) + end + + } + } + } + }, {}, nil ) + end + end + f12_local10 = -320 + end + end + f12_local8 = 0.75 + end + end + f12_local7 = 1 + end + end + f12_local6 = 1 + end + end + f12_local5 = 0.85 +end + +PersistentBackground.Variants = { + DebugBackground = f0_local0, + SPBackground = f0_local1, + MPBackground = function () + return f0_local2() + end, + SvSBackground = function () + return f0_local2( { + squads = true + } ) + end, + AliensBackground = function () + return f0_local2( { + aliens = true + } ) + end +} diff --git a/lui/speech.dec.lua b/lui/speech.dec.lua new file mode 100644 index 0000000..d9e4de4 --- /dev/null +++ b/lui/speech.dec.lua @@ -0,0 +1,188 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +DEBUG_DISABLE_LUI_SPEECH_PROCESSING = false +waitingForOutstandingCommandConfirmation = false +root = 0 +timerElement = 0 +defaultConfidence = 0.16 +whatCanISayConfidence = 0.65 +pauseConfidence = 0.65 +changeViewConfidence = 0.65 +showMenuConfidence = 0.65 +goBackConfidence = 0.65 +muteConfidence = 0.65 +compareConfidence = 0.65 +shortcutMenuConfidence = 0.65 +function EnableGrammars( f1_arg0 ) + local f1_local0 = nil + f1_local0 = 0 + if Engine.HasSpeechFeature() then + if f1_arg0 then + if 0 < #f1_arg0 then + for f1_local4, f1_local5 in ipairs( f1_arg0 ) do + Engine.SpeechEnableGrammar( f1_local5, true ) + f1_local0 = f1_local0 + 1 + end + end + else + DebugPrint( "Speech: WARNING! EnableGrammars() called with no grammar file array!" ) + end + if 0 < f1_local0 then + Engine.SpeechEnable( true ) + end + end +end + +function DisableGrammars( f2_arg0 ) + if Engine.HasSpeechFeature() then + if f2_arg0 and #f2_arg0 > 0 then + for f2_local3, f2_local4 in ipairs( f2_arg0 ) do + Engine.SpeechEnableGrammar( f2_local4, false ) + end + end + Engine.SpeechEnable( false ) + end +end + +function Restart( f3_arg0 ) + if Engine.HasSpeechFeature() then + DisableGrammars( f3_arg0 ) + EnableGrammars( f3_arg0 ) + end +end + +function PlayGoodSound() + if Engine.HasSpeechFeature() and Engine.InFrontend() then + if Engine.IsVideoPlaying and Engine.IsVideoPlaying() == true then + return + end + Engine.PlaySound( CoD.SFX.UIKinectCommandGood ) + end +end + +function PlayBadSound() + if Engine.HasSpeechFeature() and Engine.InFrontend() then + if Engine.IsVideoPlaying and Engine.IsVideoPlaying() == true then + return + end + Engine.PlaySound( CoD.SFX.UIKinectCommandBad ) + end +end + +function PerformingSpeechAction() + if Engine.HasSpeechFeature() then + PlayGoodSound() + waitingForOutstandingCommandConfirmation = false + CancelSpeechFailTimer() + end +end + +function SquelchSpeechAction() + if Engine.HasSpeechFeature() then + waitingForOutstandingCommandConfirmation = false + CancelSpeechFailTimer() + end +end + +function LaunchSpeechFailTimer() + if Engine.HasSpeechFeature() then + local f8_local0 = Engine.GetLuiRoot() + if f8_local0 then + CancelSpeechFailTimer() + local self = LUI.UITimer.new( 250, { + name = "speech_fail_timer" + } ) + self.id = "MenuSpeechFailTimer" + root = f8_local0 + timerElement = self + waitingForOutstandingCommandConfirmation = true + root:addElement( timerElement ) + end + end +end + +function CancelSpeechFailTimer() + if Engine.HasSpeechFeature() then + waitingForOutstandingCommandConfirmation = false + if timerElement and timerElement ~= 0 and root and 0 ~= root then + root:removeElement( timerElement ) + timerElement:close() + end + root = 0 + timerElement = 0 + end +end + +ConfidenceOverrideForLanguageTable = { + LANGUAGE_ITALIAN = { + pause = { + overriddenConfidence = 0.32 + } + }, + LANGUAGE_SPANISH = { + pause = { + overriddenConfidence = 0.32 + } + }, + LANGUAGE_SPANISHNA = { + pause = { + overriddenConfidence = 0.32 + } + } +} +function GetOverriddenConfidenceLevelForLanguage( f10_arg0, f10_arg1, f10_arg2 ) + local f10_local0 = ConfidenceOverrideForLanguageTable[f10_arg2] + if f10_local0 ~= nil then + local f10_local1 = f10_local0[f10_arg0] + if f10_local1 ~= nil then + DebugPrint( "Speech: Overriding default confidence of " .. tostring( f10_arg1 ) .. " for action \"" .. tostring( f10_local1 ) .. "\" and instead using " .. tostring( f10_local1.overriddenConfidence ) .. " because our language is \"" .. tostring( f10_arg2 ) .. "\"." ) + return f10_local1.overriddenConfidence + end + end + return f10_arg1 +end + +function IsOKToProcessSpeechActionForThisController( f11_arg0 ) + local f11_local0 = Engine.GetLuiRoot() + if not f11_local0 then + return false + end + local f11_local1 = f11_local0.flowManager + if f11_local1 and f11_local1.menuInfoStack then + for f11_local5, f11_local6 in ipairs( f11_local1.menuInfoStack ) do + if f11_local6.menu ~= nil and f11_local6.menu.properties.exclusiveController ~= nil and f11_local6.menu.properties.exclusiveController ~= f11_arg0 then + return false + end + end + end + return true +end + +function ProcessActionEvent( f12_arg0, f12_arg1, f12_arg2 ) + if Engine.HasSpeechFeature() then + if DEBUG_DISABLE_LUI_SPEECH_PROCESSING == true then + DebugPrint( "Speech: LUI SPEECH IS DISABLED. TOSSING EVENT " .. f12_arg1.action .. " (" .. f12_arg1.confidence .. ")" ) + return true + elseif IsOKToProcessSpeechActionForThisController( f12_arg1.controller ) == false then + DebugPrint( "Speech: AN EXCLUSIVE MENU IS OPEN FOR A CONTROLLER THAT IS NOT CONTROLLER #" .. f12_arg1.controller .. ", THEREFORE WE ARE IGNORING THIS SPEECH COMMAND!" ) + return false + elseif f12_arg2 and #f12_arg2 > 0 then + local f12_local0 = Languages[Engine.GetCurrentLanguage()] + local f12_local1 = nil + for f12_local5, f12_local6 in ipairs( f12_arg2 ) do + if string.lower( f12_arg1.action ) == string.lower( f12_local6.action ) then + if GetOverriddenConfidenceLevelForLanguage( f12_arg1.action, f12_local6.confidence, f12_local0 ) <= f12_arg1.confidence then + f12_local6.handler( f12_arg0, f12_arg1, f12_local6.extradata ) + return true + end + DebugPrint( "Speech: WARNING! Ignoring \"" .. tostring( f12_arg1.action ) .. "\" because confidence level " .. tostring( f12_arg1.confidence ) .. " < " .. tostring( f12_local6.confidence ) .. "!" ) + end + end + end + end + return false +end + +LockTable( _M )