Advertisement
Guest User

missionlist.lua

a guest
Mar 8th, 2015
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.56 KB | None | 0 0
  1. -- List of missions presented to the user for IA/MP/splitscreen/etc.
  2. -- This list is kept in alphabetical order (in English, anyhow).
  3. --
  4. -- Each entry should be in the following form:
  5. -- {    -- starts a table entry
  6. --   mapluafile = "END1", -- base name of map, w/o attacking side, no ".lua" either
  7. --   showstr = "planets.endor.name1", -- localization key in DB of item to show
  8. --   side_a = 1,  -- [OPTIONAL] Put this in the table if there is a "a" version of the map
  9. --   side_c = 1,  -- [OPTIONAL] Put this in the table if there is a "c" version of the map
  10. --   side_i = 1,  -- [OPTIONAL] Put this in the table if there is a "i" version of the map
  11. --   side_r = 1,  -- [OPTIONAL] Put this in the table if there is a "r" version of the map
  12. --   side_a_team1 = "common.sides.all.name" -- [OPTIONAL] -- localized name of team1 in an 'a' version of this map
  13. --   side_a_team2 = "common.sides.imp.name" -- [OPTIONAL] -- localized name of team2 in an 'a' version of this map
  14. --    -- Note, there's also OPTIONAL side_c_team1, side_i_team1, side_r_team1,
  15. --    -- side_c_team2, side_i_team2, side_r_team2 fields.
  16. --
  17. -- },   -- ends a table entry
  18. --
  19. -- Below, things are in one-entry-per-line format to make it easier to
  20. -- comment in/out maps by commenting in/out a single line
  21.  
  22. ReadDataFile("dc:...\\...\\...\\MPM\\data\\_lvl_pc\\mission.lvl")
  23.  
  24. -- Names for the attacking team. Entries must have same tags as the
  25. -- next list, and the button layout list
  26. gMissionSelectAttackerTeams = {
  27.     a = "common.sides.all.name",
  28.     i = "common.sides.imp.name",
  29.     r = "common.sides.rep.name",
  30.     c = "common.sides.cis.name",
  31. }
  32.  
  33. gMissionSelectDefenderTeams = {
  34.     a = "common.sides.imp.name",
  35.     i = "common.sides.all.name",
  36.     r = "common.sides.cis.name",
  37.     c = "common.sides.rep.name",
  38. }
  39.  
  40. -- For making the 'seal_XXX' name
  41. gExpandedSideNames = {
  42.     a = "all",
  43.     i = "imp",
  44.     r = "rep",
  45.     c = "cis",
  46. }
  47.  
  48. sp_missionselect_listbox_contents = {
  49.     { mapluafile = "BES1", showstr = "planets.bespin.mapname1", side_r = 1, side_a = 1},
  50.     { mapluafile = "MPMBES1", showstr = "[MPM6] BESPIN: PLATFORMS", side_r = 1, side_a = 1},
  51.     { mapluafile = "BES2", showstr = "planets.bespin.mapname2", side_r = 1, side_a = 1},
  52.     { mapluafile = "MPMBES2", showstr = "[MPM6] BESPIN: CLOUD CITY", side_r = 1, side_a = 1},
  53.  
  54.     { mapluafile = "END1", showstr = "planets.endor.mapname1", side_a = 1},
  55.     { mapluafile = "MPMEND1", showstr = "[MPM6] ENDOR: BUNKER", side_a = 1},
  56.  
  57.     { mapluafile = "GEO1", showstr = "planets.geonosis.mapname1", side_r = 1},
  58.     { mapluafile = "MPMGEO1", showstr = "[MPM6] GEONOSIS: SPIRE", side_r = 1},
  59.  
  60.     { mapluafile = "HOT1", showstr = "planets.hoth.mapname1", side_i = 1},
  61.     { mapluafile = "MPMHOT1", showstr = "[MPM6] HOTH: ECHO BASE", side_i = 1},
  62.  
  63.     { mapluafile = "KAM1", showstr = "planets.kamino.mapname1", side_c = 1},
  64.     { mapluafile = "MPMKAM1", showstr = "[MPM6] KAMINO: TIPOCA CITY", side_c = 1},
  65.  
  66.     { mapluafile = "KAS1", showstr = "planets.kashyyyk.mapname1", side_c = 1, side_i = 1},
  67.     { mapluafile = "MPMKAS1", showstr = "[MPM6] KASHYYYK: ISLANDS", side_c = 1, side_i = 1},
  68.     { mapluafile = "KAS2", showstr = "planets.kashyyyk.mapname2", side_c = 1, side_i = 1},
  69.     { mapluafile = "MPMKAS2", showstr = "[MPM6] KASHYYYK: DOCKS", side_c = 1, side_i = 1},
  70.  
  71.     { mapluafile = "NAB1", showstr = "planets.naboo.mapname1", side_c = 1, side_i = 1},
  72.     { mapluafile = "MPMNAB1", showstr = "[MPM6] NABOO: PLAINS", side_c = 1, side_i = 1},
  73.     { mapluafile = "NAB2", showstr = "planets.naboo.mapname2", side_c = 1, side_a = 1},
  74.     { mapluafile = "MPMNAB2", showstr = "[MPM6] NABOO: THEED", side_c = 1, side_a = 1},
  75.  
  76.     { mapluafile = "RHN1", showstr = "planets.rhenvar.mapname1", side_r = 1, side_i = 1},
  77.     { mapluafile = "MPMRHN1", showstr = "[MPM6] RHEN VAR: HARBOR", side_r = 1, side_i = 1},
  78.     { mapluafile = "RHN2", showstr = "planets.rhenvar.mapname2", side_c = 1, side_a = 1},
  79.     { mapluafile = "MPMRHN2", showstr = "[MPM6] RHEN VAR: CITADEL", side_c = 1, side_a = 1},
  80.  
  81.     { mapluafile = "TAT1", showstr = "planets.tatooine.mapname1", side_r = 1, side_i = 1},
  82.     { mapluafile = "MPMTAT1", showstr = "[MPM6] TATOOINE: DUNE SEA", side_r = 1, side_i = 1},
  83.     { mapluafile = "TAT2", showstr = "planets.tatooine.mapname2", side_r = 1, side_i = 1},
  84.     { mapluafile = "MPMTAT2", showstr = "[MPM6] TATOOINE: MOS EISLEY", side_r = 1, side_i = 1},
  85.  
  86.     { mapluafile = "YAV1", showstr = "planets.yavin.mapname1", side_c = 1, side_i = 1},
  87.     { mapluafile = "MPMYAV1", showstr = "[MPM6] YAVIN 4: TEMPLE", side_c = 1, side_i = 1},
  88.     { mapluafile = "YAV2", showstr = "planets.yavin.mapname2", side_r = 1, side_i = 1},
  89.     { mapluafile = "MPMYAV2", showstr = "[MPM6] YAVIN 4: ARENA ", side_r = 1, side_i = 1},
  90.  
  91. }
  92.  
  93. mp_missionselect_listbox_contents = {
  94.     { mapluafile = "BES1", showstr = "planets.bespin.mapname1", side_r = 1, side_a = 1},
  95.     { mapluafile = "BES2", showstr = "planets.bespin.mapname2", side_r = 1, side_a = 1},
  96.  
  97.     { mapluafile = "END1", showstr = "planets.endor.mapname1", side_a = 1},
  98.  
  99.     { mapluafile = "GEO1", showstr = "planets.geonosis.mapname1", side_r = 1},
  100.  
  101.     { mapluafile = "HOT1", showstr = "planets.hoth.mapname1", side_i = 1},
  102.  
  103.     { mapluafile = "KAM1", showstr = "planets.kamino.mapname1", side_c = 1},
  104.  
  105.     { mapluafile = "KAS1", showstr = "planets.kashyyyk.mapname1", side_c = 1, side_i = 1},
  106.     { mapluafile = "KAS2", showstr = "planets.kashyyyk.mapname2", side_c = 1, side_i = 1},
  107.  
  108.     { mapluafile = "NAB1", showstr = "planets.naboo.mapname1", side_c = 1, side_i = 1},
  109.     { mapluafile = "NAB2", showstr = "planets.naboo.mapname2", side_c = 1, side_a = 1},
  110.  
  111.     { mapluafile = "RHN1", showstr = "planets.rhenvar.mapname1", side_r = 1, side_i = 1},
  112.     { mapluafile = "RHN2", showstr = "planets.rhenvar.mapname2", side_c = 1, side_a = 1},
  113.  
  114.     { mapluafile = "TAT1", showstr = "planets.tatooine.mapname1", side_r = 1, side_i = 1},
  115.     { mapluafile = "TAT2", showstr = "planets.tatooine.mapname2", side_r = 1, side_i = 1},
  116.  
  117.     { mapluafile = "YAV1", showstr = "planets.yavin.mapname1", side_c = 1, side_i = 1},
  118.     { mapluafile = "YAV2", showstr = "planets.yavin.mapname2", side_r = 1, side_i = 1},
  119. }
  120.  
  121. -- List of maps usable in attract mode. These should be the raw lua
  122. -- filenames (without ".lua"), and one per line, so we can turn them
  123. -- on/off easily. Historical missions could go in here if desired.
  124. attract_mode_maps = {
  125.     "bes1a",
  126.     "bes1r",
  127.         "MPMbes1a",
  128.     "MPMbes1r",
  129.     "bes2a",
  130.     "bes2r",
  131.     "MPMbeS2a",
  132.     "MPMbes2r",
  133.     "end1a",
  134.     "MPMend1a",
  135.     "geo1r",
  136.     "MPMgeo1r",
  137.     "hot1i",
  138.     "MPMhot1i",
  139.     "kam1c",
  140.     "MPMkam1c",
  141.     "kas1c",
  142.     "kas1i",
  143.     "MPMkas1c",
  144.     "MPMkas1i",
  145.     "kas2c",
  146.     "kas2i",
  147.     "MPMkas2c",
  148.     "MPMkas2i",
  149.     "nab1c",
  150.     "nab1i",
  151.     "MPMnab1c",
  152.     "MPMnab1i",
  153.     "nab2a",
  154.     "nab2c",
  155.     "MPMnab2a",
  156.     "MPMnab2c",
  157.     "rhn1i",
  158.     "rhn1r",
  159.     "MPMrhn1i",
  160.     "MPMrhn1r",
  161.     "rhn2i",
  162.     "rhn2r",
  163.     "MPMrhn2i",
  164.     "MPMrhn2r",
  165.     "tat1i",
  166.     "tat1r",
  167.     "MPMtat1i",
  168.     "MPMtat1r",
  169.     "tat2i",
  170.     "tat2r",
  171.     "MPMtat2i",
  172.     "MPMtat2r",
  173.     "yav1c",
  174.     "yav1i",
  175.     "MPMyav1c",
  176.     "MPMyav1i",
  177.     "yav2i",
  178.     "yav2r",
  179.     "MPMyav2i",
  180.     "MPMyav2r",
  181.  
  182.     -- Historical maps, off by default
  183.     "nab1c_h",
  184.     "nab2c_h",
  185.     "kas1c_h",
  186.     "geo1r_h",
  187.     "kam1c_h",
  188.     "rhn1r_h",
  189.     "kas2c_h",
  190.     "tat1i_h",
  191.     "tat2i_h",
  192.     "rhn2a_h",
  193.     "yav2i_h",
  194.     "yav1i_h",
  195.     "hot1i_h",
  196.     "bes2a_h",
  197.     "bes1a_h",
  198.     "end1a_h",
  199. }
  200.  
  201.  
  202. -- Singleplayer campaigns. Each of these tables has a set of
  203. -- sub-tables, one sub-table per mission. These are run through in
  204. -- order. Note: there is a max of 255 missions in a campaign. Todo:
  205. -- add in listings for VOs, backgrounds, etc.
  206. --
  207. -- Optional params per line:
  208. --   side = 2,    -- forces the user to team 2 (defender). If omitted, team 1 (attacker) is forced
  209. --   intromovie = "", --movie played before yoda
  210. --   outtromovie = "", --movie played after yoda, before mission
  211. --   exitmovie = "", --movie played after mission is done (and you win)
  212. -- [More will be coming, which refer to text to print, voiceover, etc.]
  213.  
  214. SPCampaign_CW = {
  215.     --Player is CIS
  216.     {
  217.         mapluafile = "nab1c_h",
  218.         side = 1,
  219.         showstr = "ifs.sp.cw.map1name",
  220.         description = "ifs.sp.cw.map1descr",
  221.         movie = "nab1fly",
  222.         voiceover = "cis_missionbriefing_nab1",
  223.         intromovie = "nab1h01",
  224. --no tutorials on the pc
  225. --      outtromovie = "tutorial01cw",
  226. --      outtromovie_left = 90,
  227. --      outtromovie_top = 60,
  228. --      outtromovie_width = 460,
  229. --      outtromovie_height = 350,
  230. --      outtromovielocalized = 1,
  231.         briefingmusic = "shell_droidinvasion",
  232.         iconmodel = "com_icon_CIS"
  233.     }, --Player is CIS
  234.     {
  235.         mapluafile = "nab2c_h",
  236.         side = 1,
  237.         showstr = "ifs.sp.cw.map2name",
  238.         description = "ifs.sp.cw.map2descr",
  239.         movie = "nab2fly",
  240.         voiceover = "cis_missionbriefing_nab2",
  241.         outtromovie = "nab2h01",
  242.         briefingmusic = "shell_droidinvasion",
  243.         --unlockable = 1,
  244.         iconmodel = "com_icon_CIS"
  245.     }, --Player is CIS
  246.     {
  247.         mapluafile = "kas1c_h",
  248.         side = 1,
  249.         showstr = "ifs.sp.cw.map3name",
  250.         description = "ifs.sp.cw.map3descr",
  251.         movie = "kas1fly",
  252.         voiceover = "cis_missionbriefing_kas1",
  253.         briefingmusic = "shell_droidinvasion",
  254.         --unlockable = 2,
  255.         iconmodel = "com_icon_CIS"
  256.     },
  257.  
  258.     --Player is Republic
  259.     {
  260.         mapluafile = "geo1r_h",
  261.         side = 1,
  262.         showstr = "ifs.sp.cw.map4name",
  263.         description = "ifs.sp.cw.map4descr",
  264.         movie = "geo1fly",
  265.         outtromovie = "geo1h01",
  266.         voiceover = "rep_missionbriefing_geo1",
  267.         briefingmusic = "shell_clonewars",
  268.         --unlockable = 3,
  269.         iconmodel = "com_icon_republic"
  270.     },
  271.    
  272.     --Player is Republic
  273.     {
  274.         mapluafile = "kam1c_h",
  275.         side = 2,
  276.         showstr = "ifs.sp.cw.map5name",
  277.         description = "ifs.sp.cw.map5descr",
  278.         movie = "kam1fly",
  279.         intromovie = "kam1h01",
  280.         outtromovie = "kam1h02",
  281.         voiceover = "rep_missionbriefing_kam1",
  282.         briefingmusic = "shell_clonewars",
  283.         --unlockable = 4,  
  284.         iconmodel = "com_icon_republic"
  285.     },--Player is Republic
  286.     {
  287.         mapluafile = "rhn1r_h",
  288.         side = 1,
  289.         showstr = "ifs.sp.cw.map6name",
  290.         description = "ifs.sp.cw.map6descr",
  291.         movie = "rhn1fly",
  292.         voiceover = "rep_missionbriefing_rhn1",
  293.         briefingmusic = "shell_clonewars",
  294.         --unlockable = 5,
  295.         iconmodel = "com_icon_republic"
  296.     },--Player is Republic
  297.     {
  298.         mapluafile = "kas2c_h",
  299.         side = 2,
  300.         showstr = "ifs.sp.cw.map7name",
  301.         description = "ifs.sp.cw.map7descr", side = 2,
  302.         movie = "kas2fly",
  303.         voiceover = "rep_missionbriefing_kas1",
  304.         briefingmusic = "shell_clonewars",
  305.         exitmovie = "kas2h01",
  306.         iconmodel = "com_icon_republic"
  307.     },--Player is Republic
  308. }
  309.  
  310. SPCampaign_GCW = {
  311.     --Player is the Empire
  312.     {
  313.         mapluafile = "tat1i_h",
  314.         side = 1,
  315.         showstr = "ifs.sp.gcw.map1name",
  316.         description = "ifs.sp.gcw.map1descr",
  317.         movie = "tat1fly",
  318.         intromovie = "tat1h01",
  319. -- no tutorials on pc
  320. --      outtromovie = "tutorial01gcw",
  321. --      outtromovie_left = 90,
  322. --      outtromovie_top = 60,
  323. --      outtromovie_width = 460,
  324. --      outtromovie_height = 350,
  325. --      outtromovielocalized = 1,
  326.         voiceover = "imp_missionbriefing_tat1",
  327.         briefingmusic = "shell_imperialmarch",
  328.         iconmodel = "com_icon_imperial"
  329.     },--Player is the Empire
  330.     {
  331.         mapluafile = "tat2i_h",
  332.         side = 1,      
  333.         showstr = "ifs.sp.gcw.map2name",
  334.         description = "ifs.sp.gcw.map2descr",
  335.         movie = "tat2fly",
  336.         intromovie = "tat2h01",
  337.         voiceover = "imp_missionbriefing_tat2",
  338.         briefingmusic = "shell_imperialmarch",
  339.         --unlockable = 6,
  340.         iconmodel = "com_icon_imperial"
  341.     },--Player is the Empire
  342.     {
  343.         mapluafile = "rhn2a_h",
  344.         side = 2,
  345.         showstr = "ifs.sp.gcw.map3name",
  346.         description = "ifs.sp.gcw.map3descr",
  347.         movie = "rhn2fly",
  348.         voiceover = "imp_missionbriefing_rhn1",
  349.         briefingmusic = "shell_imperialmarch",
  350.         iconmodel = "com_icon_imperial"
  351.     },--Player is the Empire
  352.     {
  353.         mapluafile = "yav2i_h",
  354.         side = 1,      
  355.         showstr = "ifs.sp.gcw.map4name",
  356.         description = "ifs.sp.gcw.map4descr",
  357.         movie = "yav2fly",
  358.         intromovie = "yav2h01",
  359.         voiceover = "imp_missionbriefing_yav1",
  360.         briefingmusic = "shell_imperialmarch",
  361.         iconmodel = "com_icon_imperial"
  362.     },--Player is the Alliance
  363.     {
  364.         mapluafile = "yav1i_h",
  365.         side = 2,      
  366.         showstr = "ifs.sp.gcw.map5name",
  367.         description = "ifs.sp.gcw.map5descr",
  368.         movie = "yav1fly",
  369.         intromovie = "yav1h01",
  370.         voiceover = "all_missionbriefing_yav1",
  371.         briefingmusic = "shell_clash",
  372.         --unlockable = 7,
  373.         iconmodel = "com_icon_alliance"    
  374.     },--Player is the Alliance
  375.  
  376.     --Player is the Alliance
  377.     {
  378.         mapluafile = "hot1i_h",
  379.         side = 2,      
  380.         showstr = "ifs.sp.gcw.map6name",
  381.         description = "ifs.sp.gcw.map6descr", side = 2,
  382.         movie = "hot1fly",
  383.         outtromovie = "hot1h02",
  384.         voiceover = "all_missionbriefing_hot1",
  385.         briefingmusic = "shell_clash",
  386.         --unlockable = 8,
  387.         iconmodel = "com_icon_alliance"    
  388.     },--Player is the Alliance
  389.     {
  390.         mapluafile = "bes2a_h",
  391.         side = 1,
  392.         showstr = "ifs.sp.gcw.map7name",
  393.         description = "ifs.sp.gcw.map7descr",
  394.         movie = "bes2fly",
  395.         intromovie = "bes2h01",
  396.         voiceover = "all_missionbriefing_bes1",
  397.         briefingmusic = "shell_clash",
  398.         --unlockable = 9,
  399.         iconmodel = "com_icon_alliance"    
  400.     },--Player is the Alliance
  401.     {
  402.         mapluafile = "bes1a_h",
  403.         side = 1,
  404.         showstr = "ifs.sp.gcw.map8name",
  405.         description = "ifs.sp.gcw.map8descr",
  406.         movie = "bes1fly",
  407.         outtromovie = "bes1h01",
  408.         voiceover = "all_missionbriefing_bes2",
  409.         briefingmusic = "shell_clash",
  410.         --unlockable = 10,
  411.         iconmodel = "com_icon_alliance"    
  412.     },--Player is the Alliance
  413.     {
  414.         mapluafile = "end1a_h",
  415.         side = 1,      
  416.         showstr = "ifs.sp.gcw.map9name",
  417.         description = "ifs.sp.gcw.map9descr",
  418.         movie = "end1fly",
  419.         outtromovie = "end1h02",
  420.         exitmovie = "end1h03",
  421.         voiceover = "all_missionbriefing_end1",
  422.         briefingmusic = "shell_clash",
  423.         iconmodel = "com_icon_alliance"    
  424.     },--Player is the Alliance
  425. }
  426.  
  427.  
  428. -- Tables for cached mapname lookups. The key for each entry will
  429. -- be the 'abbrev' passed into missionlist_GetLocalizedMapName(abbrev)
  430. -- if present.
  431. gMapName0Table = {}
  432. gMapName1Table = {}
  433. gMapName2Table = {}
  434.  
  435. -- API
  436. -- ShowUStr, iSource = missionlist_GetLocalizedName("tat3a")
  437. --
  438. -- Given an abbreviation (e.g. "tat3a"), returns a localized unicode
  439. -- string that should be shown. Also returns an index of where that
  440. -- string came from:
  441. -- 0: localize database
  442. -- 1: addon map w/ English-only string
  443. -- 2: fallback (abbrev upconverted to Unicode)
  444. function missionlist_GetLocalizedMapName(abbrev)
  445.     -- Look in cached lookups first
  446.     local CacheUStr
  447.  
  448.     CacheUStr = gMapName0Table[abbrev]
  449.     if(CacheUStr) then
  450.         --      print("gMapName0Table["..abbrev.."] found")
  451.         return CacheUStr, 0
  452.     end
  453.  
  454.     CacheUStr = gMapName1Table[abbrev]
  455.     if(CacheUStr) then
  456.         --      print("gMapName1Table["..abbrev.."] found")
  457.         return CacheUStr, 1
  458.     end
  459.  
  460.     CacheUStr = gMapName2Table[abbrev]
  461.     if(CacheUStr) then
  462.         --      print("gMapName2Table["..abbrev.."] found")
  463.         return CacheUStr, 2
  464.     end
  465.  
  466.     ------- Not cached. Do lookup, stick it in cache
  467.  
  468.     local i,j,l
  469.     l = strlen(abbrev)
  470.  
  471.     -- Pass #1, try and find it in current missionlist
  472.     if(missionselect_listbox_contents) then
  473.         for i = 0,1 do
  474.             local TrimmedStr = strupper(strsub(abbrev, 1, l - i))
  475.             for j = 1,getn(missionselect_listbox_contents) do
  476.                 if(TrimmedStr == strupper(missionselect_listbox_contents[j].mapluafile)) then
  477.                     local DisplayUStr = ScriptCB_getlocalizestr(missionselect_listbox_contents[j].showstr, 1) -- 2nd param: return nil if not found
  478.                     if(DisplayUStr) then
  479.                         gMapName0Table[abbrev] = DisplayUStr
  480.                         return DisplayUStr, 0
  481.                     else
  482.                         DisplayUStr = ScriptCB_tounicode(missionselect_listbox_contents[j].showstr)
  483.                         gMapName1Table[abbrev] = DisplayUStr
  484.                         return DisplayUStr, 1
  485.                     end
  486.                 end
  487.             end -- j loop over missionselect_listbox_contents
  488.         end -- i loop over trimming suffixes
  489.     end
  490.  
  491.     -- Final fallback: show what was received
  492.     local DisplayUStr = ScriptCB_tounicode(abbrev)
  493.     gMapName2Table[abbrev] = DisplayUStr
  494.     return DisplayUStr, 2
  495. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement