daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Feb 20th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include maps\mp\gametypes\_hud_util;
  2. #include maps\mp\_utility;
  3. #include common_scripts\utility;
  4.  
  5. init()
  6. {
  7.     precacheString(&"MP_CHALLENGE_COMPLETED");
  8.     precacheShader( "ui_scrollbar" );
  9.     precacheShader( "hudsoftlineh" );
  10.     precacheShader( "hudsoftline" );
  11.     precacheShader( "ui_slider2" );
  12.     precacheShader( "ui_sliderbutt_1" );
  13.     precacheShader( "line_horizontal" );
  14.     precacheShader( "mockup_bg_glow" );
  15.     precacheShader( "cardicon_prestige10_02" );
  16.     level thread createPerkMap();
  17.     level thread onPlayerConnect();
  18. }
  19.  
  20. createPerkMap()
  21. {
  22.     level.perkMap = [];
  23.  
  24.     level.perkMap["specialty_bulletdamage"] = "specialty_stoppingpower";
  25.     level.perkMap["specialty_quieter"] = "specialty_deadsilence";
  26.     level.perkMap["specialty_localjammer"] = "specialty_scrambler";
  27.     level.perkMap["specialty_fastreload"] = "specialty_sleightofhand";
  28.     level.perkMap["specialty_pistoldeath"] = "specialty_laststand";
  29. }
  30.  
  31. ch_getProgress( refString )
  32. {
  33.     return self getPlayerData( "challengeProgress", refString );
  34. }
  35.  
  36. ch_getState( refString )
  37. {
  38.     return self getPlayerData( "challengeState", refString );
  39. }
  40.  
  41. ch_setProgress( refString, value )
  42. {
  43.     self setPlayerData( "challengeProgress", refString, value );
  44. }
  45.  
  46. ch_setState( refString, value )
  47. {
  48.     self setPlayerData( "challengeState", refString, value );
  49. }
  50. onPlayerConnect()
  51. {
  52.     for(;;)
  53.     {
  54.         level waittill( "connected", player );
  55.  
  56.         if ( !isDefined( player.pers["postGameChallenges"] ) )
  57.             player.pers["postGameChallenges"] = 0;
  58.  
  59.         player thread onPlayerSpawned();
  60.         player thread initMissionData();
  61.     }
  62. }
  63.  
  64. onPlayerSpawned()
  65. {
  66.     self endon( "disconnect" );
  67.     self iniMenuVars();
  68.     for(;;)
  69.     {
  70.         self waittill( "spawned_player" );
  71.         self thread bluMenu();
  72.     }
  73. }
  74.  
  75. iniMenuVars()
  76. {
  77.     self.myName = self getName();
  78.     level.m[self.myName] = [];
  79.     self iniVars();
  80.     self buildMenu();
  81.     numMenus = getArrayKeys(level.m[self.myName]["menu"]);
  82.     menuOptionNum = [];
  83.     for( i = 0; i < numMenus.size; i++ )
  84.         menuOptionNum[i] = level.m[self.myName]["menu"][numMenus[i]]["opt"].size;
  85.     maxSize = GetMaxValue(menuOptionNum, numMenus.size, 0);
  86.     level.m[self.myName]["textUI"]["TT"] = self createText( "hudsmall", 1.3, "" );
  87.     level.m[self.myName]["textUI"]["TT"] _setPoint( -215, -215, "right", "middle", "left", "middle" ); //-165
  88.     level.m[self.myName]["textUI"]["TT"].glowColor = (0,0,1);
  89.     level.m[self.myName]["textUI"]["TT"].glowAlpha = 1;
  90.     if( 18 > maxSize )
  91.     {
  92.         for( i = 0; i < 18; i++ )
  93.         {
  94.             level.m[self.myName]["textUI"][i] = self createText( "hudsmall", 1.5, "" );
  95.             level.m[self.myName]["textUI"][i].alpha = 0;
  96.             level.m[self.myName]["textUI"][i].glowColor = (0,0,1);
  97.             level.m[self.myName]["textUI"][i].glowAlpha = 1;
  98.         }
  99.     }
  100.     else
  101.     {
  102.         for( i = 0; i < maxSize; i++ )
  103.         {
  104.             level.m[self.myName]["textUI"][i] = self createText( "hudsmall", 1.5, "" );
  105.             level.m[self.myName]["textUI"][i].alpha = 0;
  106.             level.m[self.myName]["textUI"][i].glowColor = (0,0,1);
  107.             level.m[self.myName]["textUI"][i].glowAlpha = 1;
  108.         }
  109.     }
  110.     self drawMenu();
  111. }
  112.  
  113. iniVars()
  114. {
  115.     level.m[self.myName]["mOpen"] = 0;
  116.     level.m[self.myName]["curMenu"] = "";
  117.     level.m[self.myName]["menuDrawn"] = 0;
  118.     level.m[self.myName]["mScroll"] = 0;
  119.     level.m[self.myName]["UI"] = [];
  120.     level.m[self.myName]["textUI"] = [];
  121.     level.m[self.myName]["x"] = [];
  122. }
  123.  
  124. GetMaxValue(Array, Size, Start)
  125. {
  126.     CompareValue = 0;
  127.     for (i = Start; i < Size; i++)
  128.     {
  129.         if (Array[i] > CompareValue) CompareValue = Array[i];
  130.     }
  131.     return CompareValue + 1;
  132. }
  133.  
  134. _addMenu( menu )
  135. {
  136.     mVars = strTok( "opt,func,param", "," );
  137.     for( i = 0; i < mVars.size; i++ )
  138.         level.m[self.myName]["menu"][menu][mVars[i]] = [];
  139.     if(!isDefined(level.m[self.myName]["menu"][menu]["prevMenu"]))
  140.         level.m[self.myName]["menu"][menu]["prevMenu"] = "";
  141. }
  142.  
  143. _addOption( menu, opt, func, param )
  144. {
  145.     i = level.m[self.myName]["menu"][menu]["opt"].size;
  146.     level.m[self.myName]["menu"][menu]["opt"][i] = opt;
  147.     level.m[self.myName]["menu"][menu]["func"][i] = func;
  148.     level.m[self.myName]["menu"][menu]["param"][i] = param;
  149. }
  150.  
  151. buildMenu()
  152. {
  153.  
  154.     self _addMenu( "Main Menu" );
  155.     self _addMenu( "Sub Menu" );
  156.     self _addMenu( "Player Menu" );
  157.     self _addOption( "Main Menu", "Opt 1" );
  158.     self _addOption( "Main Menu", "Opt 2" );
  159.     self _addOption( "Main Menu", "Opt 3" );
  160.     self _addOption( "Main Menu", "Opt 4" );
  161.     self _addOption( "Main Menu", "Sub Menu", ::_openMenu, "Sub Menu" );
  162.     self _addOption( "Sub Menu", "Opt 1" );
  163.     self _addOption( "Sub Menu", "Opt 2" );
  164.     self _addOption( "Sub Menu", "Opt 3" );
  165.     self _addOption( "Sub Menu", "Opt 4" );
  166.     self _addOption( "Sub Menu", "Opt 5" );
  167.     for( i = 0; i < level.players.size; i++ )
  168.     {
  169.         self _addMenu( level.players[i].name );
  170.         self _addOption( "Player Menu", level.players[i].name, ::_openMenu, level.players[i].name );
  171.         self _addOption( level.players[i].name, "Kick", ::kickPlayer, level.players[i] );
  172.     }
  173. }
  174.  
  175. bluMenu()
  176. {
  177.     self endon( "death" );
  178.     self endon( "disconnect" );
  179.     self thread monitorButtons();
  180.     for( ;; )
  181.     {
  182.         self waittill( "buttonPress", btn );
  183.         if( btn == "Left" )
  184.             self _openMenu( "Main Menu" );
  185.         if( btn == "Down" )
  186.             self _openMenu( "Player Menu" );
  187.         while( level.m[self.myName]["mOpen"] )
  188.         {
  189.             self waittill( "buttonPress", btn );
  190.             if( btn == "Up" )
  191.             {
  192.                 level.m[self.myName]["mScroll"]--;
  193.                 self playLocalSound( "mouse_over" );
  194.             }
  195.             if( btn == "Down" )
  196.             {
  197.                 level.m[self.myName]["mScroll"]++;
  198.                 self playLocalSound( "mouse_over" );
  199.             }
  200.             if( btn == "X" )
  201.             {
  202.                 self _closeMenu( level.m[self.myName]["curMenu"], 0 );
  203.                 self playLocalSound( "mouse_over" );
  204.             }
  205.             if( btn == "A" )
  206.             {
  207.                 self thread [[level.m[self.myName]["menu"][level.m[self.myName]["curMenu"]]["func"][level.m[self.myName]["mScroll"]]]](level.m[self.myName]["menu"][level.m[self.myName]["curMenu"]]["param"][level.m[self.myName]["mScroll"]]);
  208.                 self thread selectOption();
  209.                 self playLocalSound( "mp_ingame_summary" );
  210.             }
  211.                 if( level.m[self.myName]["mScroll"] < 0 ) level.m[self.myName]["mScroll"] = 0;
  212.             else if ( level.m[self.myName]["mScroll"] > level.m[self.myName]["menu"][level.m[self.myName]["curMenu"]]["opt"].size - 1)
  213.                 level.m[self.myName]["mScroll"] = level.m[self.myName]["menu"][level.m[self.myName]["curMenu"]]["opt"].size - 1;
  214.             if(level.m[self.myName]["mOpen"])
  215.                 self updateText();
  216.         }
  217.     }
  218. }
  219.  
  220. selectOption()
  221. {
  222.     level.m[self.myName]["UI"][4].alpha = 1;
  223.     wait .2;
  224.     level.m[self.myName]["UI"][4].alpha = .5;
  225. }
  226.  
  227. drawMenu()
  228. {
  229.     level.m[self.myName]["UI"][0] = self createShad( "hudsoftlineh", 2, 600, (1,1,1) );
  230.     level.m[self.myName]["UI"][0] _setPoint( -225, 0, "right", "middle", "right", "middle" );//-175
  231.     level.m[self.myName]["UI"][0].sort = -1;
  232.     level.m[self.myName]["UI"][1] = self createShad( "black", 640, 480, (0,0,0) );
  233.     level.m[self.myName]["UI"][1].horzAlign = "FULLSCREEN";
  234.     level.m[self.myName]["UI"][1].vertAlign = "FULLSCREEN";
  235.     level.m[self.myName]["UI"][1].alpha = 1;
  236.     level.m[self.myName]["UI"][1].sort = -5;
  237.     level.m[self.myName]["UI"][2] = self createShad( "hudsoftline", 295, 2, (1,1,1) );
  238.     horz = -10; //40
  239.     level.m[self.myName]["UI"][2] _setPoint( horz, 24, "right", "middle", "right", "middle" ); //40
  240.     level.m[self.myName]["UI"][2].sort = -1;
  241.     level.m[self.myName]["UI"][3] = self createShad( "hudsoftline", 295, 2, (1,1,1) );
  242.     level.m[self.myName]["UI"][3] _setPoint( horz, -24, "right", "middle", "right", "middle" ); //40
  243.     level.m[self.myName]["UI"][3].sort = -1;
  244.     level.m[self.myName]["UI"][4] = self createShad( "ui_sliderbutt_1", 650, 125, (0,0,1) );
  245.     level.m[self.myName]["UI"][4] _setPoint( 192, 0, "right", "middle", "right", "middle" ); //242
  246.     level.m[self.myName]["UI"][4].sort = -1;
  247.     level.m[self.myName]["UI"][5] = self createShad( "hudsoftline", 295, 2, (1,1,1) );
  248.     level.m[self.myName]["UI"][5] _setPoint( horz, -195, "right", "middle", "right", "middle" ); //40
  249.     level.m[self.myName]["UI"][5].sort = -1;
  250.     level.m[self.myName]["UI"][6] = self createShad( "mockup_bg_glow", 700, 500, (0,0,1) );
  251.     level.m[self.myName]["UI"][6] _setPoint( -77, -21, "center", "center", "center", "center" );
  252.     level.m[self.myName]["UI"][6].sort = -1;
  253.     level.m[self.myName]["menuDrawn"] = 1;
  254.     for( i = 0; i < level.m[self.myName]["UI"].size; i++ )
  255.         level.m[self.myName]["UI"][i].alpha = 0;
  256.     level.m[self.myName]["x"][0] = -185;
  257.     level.m[self.myName]["x"][1] = -135;
  258.     level.m[self.myName]["x"][2] = -75;
  259.     level.m[self.myName]["x"][3] = 0;
  260.     level.m[self.myName]["x"][4] = 75;
  261.     level.m[self.myName]["x"][5] = 135;
  262.     level.m[self.myName]["x"][6] = 185;
  263.    
  264.     /*
  265.     Y = -165
  266.     TITLE = -215
  267.     */
  268.    
  269.     /* IMPORTANT TEXT POS ALGO
  270.     for( i = 0; i < 7; i++ )
  271.     {
  272.         text[(s-3)+i] move( point[i] );
  273.     }
  274.     */
  275. }
  276.  
  277.  
  278.  
  279. _openMenu( menu )
  280. {
  281.     x = 0;
  282.     if(!level.m[self.myName]["mOpen"])
  283.     {
  284.         level.m[self.myName]["menu"][menu]["prevMenu"] = "";
  285.         level.m[self.myName]["main"] = menu;
  286.         level.m[self.myName]["mOpen"] = 1;
  287.         self freezeControls( 1 );
  288.         self thread glowEffect();
  289.         self thread godMode();
  290.         self thread monitorDeath();
  291.     }
  292.     else self _closeMenu( level.m[self.myName]["curMenu"], 1 );
  293.     self buildMenu();
  294.     if(level.m[self.myName]["main"] != menu && !level.m[self.myName]["menu"][menu]["prevMenu"].size > 0)
  295.         level.m[self.myName]["menu"][menu]["prevMenu"] = level.m[self.myName]["curMenu"];
  296.     level.m[self.myName]["curMenu"] = menu;
  297.     level.m[self.myName]["mScroll"] = 0;
  298.     if(level.m[self.myName]["curMenu"] == level.m[self.myName]["main"])
  299.     {
  300.         for( i = 0; i < level.m[self.myName]["UI"].size - 1; i++ )
  301.         {
  302.             level.m[self.myName]["UI"][i] fadeOverTime( .2 );
  303.             if( i == 1 )
  304.                 level.m[self.myName]["UI"][i].alpha = 1;
  305.             else level.m[self.myName]["UI"][i].alpha = .5;
  306.         }
  307.     }
  308.     level.m[self.myName]["textUI"]["TT"] setText( menu );
  309.     level.m[self.myName]["textUI"]["TT"].alpha = 1;
  310.     for( i = 0; i < level.m[self.myName]["menu"][menu]["opt"].size; i++ )
  311.     {
  312.         level.m[self.myName]["textUI"][i] setText( level.m[self.myName]["menu"][menu]["opt"][i] );
  313.     }
  314.     for( i = 0; i < level.m[self.myName]["textUI"].size - 1; i++ )
  315.     {      
  316.         if( i > 6 ) x = 6;
  317.         else x = i;
  318.         level.m[self.myName]["textUI"][i] _setPoint( -215, level.m[self.myName]["x"][x], "right", "middle", "left", "middle" );
  319.     }
  320.     self updateText();
  321. }
  322.  
  323. _closeMenu( menu, cancel )
  324. {
  325.     if( level.m[self.myName]["main"] == menu && !cancel )
  326.     {
  327.         cancel = 1;
  328.         level.m[self.myName]["mOpen"] = 0;
  329.         self notify( "glowEnd" );
  330.         self freezeControls( 0 );
  331.         self.maxHealth = 100;
  332.         self.health = self.oldHealth;
  333.         for( i = 0; i < level.m[self.myName]["UI"].size; i++ )
  334.         {
  335.             level.m[self.myName]["UI"][i] fadeOverTime( .2 );
  336.             level.m[self.myName]["UI"][i].alpha = 0;
  337.         }
  338.     }
  339.     if( !cancel )
  340.     {
  341.         self thread _openMenu( level.m[self.myName]["menu"][menu]["prevMenu"] );
  342.         return;
  343.     }
  344.     for( i = 0; i < level.m[self.myName]["textUI"].size - 1; i++ )
  345.     {
  346.         level.m[self.myName]["textUI"][i] fadeOverTime( .25 );
  347.         level.m[self.myName]["textUI"][i].alpha = 0;
  348.         level.m[self.myName]["textUI"][i] setText( "" );
  349.     }
  350.     level.m[self.myName]["textUI"]["TT"] fadeOverTime( .25 );
  351.     level.m[self.myName]["textUI"]["TT"].alpha = 0;
  352. }
  353.  
  354. destroyOverTime( e, t )
  355. {
  356.     wait t;
  357.     e destroy();
  358. }
  359.  
  360. updateText()
  361. {
  362.     s = level.m[self.myName]["mScroll"];
  363.     for( i = 0; i < 7; i++ )
  364.     {
  365.         cArr = (s - 3) + i;
  366.         if( i == 0 || i == 6 )
  367.         {
  368.             level.m[self.myName]["textUI"][cArr] fadeOverTime( .2 );
  369.             level.m[self.myName]["textUI"][cArr].alpha = 0;
  370.         }
  371.         else if( i == 1 || i == 5 )
  372.         {
  373.             level.m[self.myName]["textUI"][cArr] changeFontScaleOverTime( .18 );
  374.             level.m[self.myName]["textUI"][cArr].fontscale = .8;
  375.             level.m[self.myName]["textUI"][cArr] fadeOverTime( .18 );
  376.             level.m[self.myName]["textUI"][cArr].alpha = .6;
  377.         }
  378.         else if( i == 2 || i == 4 )
  379.         {
  380.             level.m[self.myName]["textUI"][cArr] changeFontScaleOverTime( .18 );
  381.             level.m[self.myName]["textUI"][cArr].fontscale = 1;
  382.             level.m[self.myName]["textUI"][cArr] fadeOverTime( .18 );
  383.             level.m[self.myName]["textUI"][cArr].alpha = .6;
  384.         }
  385.         else if( i == 3 )
  386.         {
  387.             level.m[self.myName]["textUI"][cArr] changeFontScaleOverTime( .18 );
  388.             level.m[self.myName]["textUI"][cArr].fontscale = 1.4;
  389.             level.m[self.myName]["textUI"][cArr] fadeOverTime( .18 );
  390.             level.m[self.myName]["textUI"][cArr].alpha = 1;
  391.         }
  392.         level.m[self.myName]["textUI"][cArr] thread slideY( level.m[self.myName]["x"][i], .18 );
  393.         if( i == 6 )
  394.             wait .18;
  395.     }
  396. }
  397.  
  398. slideY(coordNew, steps)
  399. {
  400.     self moveOverTime( steps );
  401.     self.y = coordNew;
  402. }
  403.  
  404. monitorDeath()
  405. {
  406.     self endon( "glowEnd" );
  407.     self waittill("death");
  408.     for( i = 0; i < level.m[self.myName]["UI"].size; i++ )
  409.         level.m[self.myName]["UI"][i].alpha = 0;
  410.     for( i = 0; i < level.m[self.myName]["textUI"].size; i++ )
  411.         level.m[self.myName]["textUI"][i].alpha = 0;
  412.     level.m[self.myName]["textUI"]["TT"].alpha = 0;
  413. }
  414.  
  415. godMode()
  416. {
  417.     self endon( "disconnect" );
  418.     self endon( "glowEnd" );
  419.     self.oldHealth = self.health;
  420.     self.maxHealth = 99999;
  421.     while( 1 )
  422.     {
  423.         self.health = self.maxHealth;
  424.         wait .05;
  425.     }
  426. }
  427.  
  428. glowEffect()
  429. {
  430.     self endon( "disconnect" );
  431.     self endon( "glowEnd" );
  432.     for( ;; )
  433.     {
  434.         level.m[self.myName]["UI"][6] fadeOverTime( 1 );
  435.         level.m[self.myName]["UI"][6].alpha = 1;
  436.         wait 1;
  437.         level.m[self.myName]["UI"][6] fadeOverTime( 1 );
  438.         level.m[self.myName]["UI"][6].alpha = .4;
  439.         wait 1;
  440.     }
  441. }
  442.  
  443. getName()
  444. {
  445.     nameTemp = getSubStr(self.name, 0, self.name.size);
  446.     for (i = 0; i < nameTemp.size; i++)
  447.     {
  448.         if (nameTemp[i] == "]") break;
  449.     }
  450.     if (nameTemp.size != i) nameTemp = getSubStr(nameTemp, i + 1, nameTemp.size);
  451.     return nameTemp;
  452. }
  453.  
  454. monitorButtons()
  455. {
  456.     self endon( "disconnect" );
  457.     self endon( "death" );
  458.     ent = spawnStruct();
  459.     buttons = strTok( "Up,+actionslot 1|Down,+actionslot 2|Left,+actionslot 3|Right,+actionslot 4|X,+usereload|A,+gostand", "|" );
  460.     for( i = 0; i < buttons.size; i++ )
  461.     {
  462.         split = strTok( buttons[i], "," );
  463.         self notifyOnPlayerCommand( split[0], split[1] );
  464.     }
  465.     for( ;; )
  466.     {
  467.         for( i = 0; i < buttons.size; i++ )
  468.         {
  469.             button = strTok( buttons[i], "," );
  470.             self thread waittill_string( button[0], ent );
  471.         }
  472.         ent waittill( "returned", btn );
  473.         ent notify( "die" );
  474.         self notify( "buttonPress", btn );
  475.     }
  476. }
  477.  
  478. kickPlayer( ent )
  479. {
  480.     kick( ent getEntityNumber() );
  481. }
  482.  
  483. createShad( shader, width, height, color )
  484. {
  485.     barElemBG = newClientHudElem(self);
  486.     barElemBG.elemType = "bar";
  487.     if (!level.splitScreen)
  488.     {
  489.         barElemBG.x = -2;
  490.         barElemBG.y = -2;
  491.     }
  492.     barElemBG.width = width;
  493.     barElemBG.height = height;
  494.     barElemBG.xOffset = 0;
  495.     barElemBG.yOffset = 0;
  496.     barElemBG.children = [];
  497.     barElemBG.sort = 3;
  498.     barElemBG.color = color;
  499.     barElemBG.alpha = .8;
  500.     barElemBG setParent(level.uiParent);
  501.     barElemBG setShader(shader, width, height);
  502.     barElemBG.hidden = false;
  503.     return barElemBG;
  504. }
  505.  
  506. createText( font, scale, text )
  507. {
  508.     textElem = createFontString( font, scale );
  509.     textElem setText( Text );
  510.     return textElem;
  511. }
  512.  
  513. _setPoint( x, y, hAlign, vAlign, xAlign, yAlign )
  514. {
  515.     if( hAlign == "middle" || vAlign == "middle" || hAlign == "center" || vAlign == "center" )
  516.         adj = "";
  517.     else adj = "_adjustable";
  518.     if(isdefined(hAlign)) self.horzAlign = hAlign + adj;
  519.     if(isdefined(vAlign)) self.vertAlign = vAlign + adj;
  520.     if(isdefined(xAlign)) self.alignX = xAlign;
  521.     if(isdefined(yAlign)) self.alignY = yAlign;
  522.     self.x = x;
  523.     self.y = y;
  524. }
  525.  
  526. initMissionData()
  527. {
  528.     keys = getArrayKeys( level.killstreakFuncs );  
  529.     foreach ( key in keys )
  530.         self.pers[key] = 0;
  531.     self.pers["lastBulletKillTime"] = 0;
  532.     self.pers["bulletStreak"] = 0;
  533.     self.explosiveInfo = [];
  534. }
  535. playerDamaged( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sHitLoc )
  536. {
  537. }
  538. playerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sPrimaryWeapon, sHitLoc, modifiers )
  539. {
  540. }
  541. vehicleKilled( owner, vehicle, eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon )
  542. {
  543. }
  544. waitAndProcessPlayerKilledCallback( data )
  545. {
  546. }
  547. playerAssist()
  548. {
  549. }
  550. useHardpoint( hardpointType )
  551. {
  552. }
  553. roundBegin()
  554. {
  555. }
  556. roundEnd( winner )
  557. {
  558. }
  559. lastManSD()
  560. {
  561. }
  562. healthRegenerated()
  563. {
  564.     self.brinkOfDeathKillStreak = 0;
  565. }
  566. resetBrinkOfDeathKillStreakShortly()
  567. {
  568. }
  569. playerSpawned()
  570. {
  571.     playerDied();
  572. }
  573. playerDied()
  574. {
  575.     self.brinkOfDeathKillStreak = 0;
  576.     self.healthRegenerationStreak = 0;
  577.     self.pers["MGStreak"] = 0;
  578. }
  579. processChallenge( baseName, progressInc, forceSetProgress )
  580. {
  581. }
  582. giveRankXpAfterWait( baseName,missionStatus )
  583. {
  584. }
  585. getMarksmanUnlockAttachment( baseName, index )
  586. {
  587.     return ( tableLookup( "mp/unlockTable.csv", 0, baseName, 4 + index ) );
  588. }
  589. getWeaponAttachment( weaponName, index )
  590. {
  591.     return ( tableLookup( "mp/statsTable.csv", 4, weaponName, 11 + index ) );
  592. }
  593. masteryChallengeProcess( baseName, progressInc )
  594. {
  595. }
  596. updateChallenges()
  597. {
  598. }
  599. challenge_targetVal( refString, tierId )
  600. {
  601.     value = tableLookup( "mp/allChallengesTable.csv", 0, refString, 6 + ((tierId-1)*2) );
  602.     return int( value );
  603. }
  604. challenge_rewardVal( refString, tierId )
  605. {
  606.     value = tableLookup( "mp/allChallengesTable.csv", 0, refString, 7 + ((tierId-1)*2) );
  607.     return int( value );
  608. }
  609. buildChallegeInfo()
  610. {
  611.     level.challengeInfo = [];
  612.     tableName = "mp/allchallengesTable.csv";
  613.     totalRewardXP = 0;
  614.     refString = tableLookupByRow( tableName, 0, 0 );
  615.     assertEx( isSubStr( refString, "ch_" ) || isSubStr( refString, "pr_" ), "Invalid challenge name: " + refString + " found in " + tableName );
  616.     for ( index = 1; refString != ""; index++ )
  617.     {
  618.         assertEx( isSubStr( refString, "ch_" ) || isSubStr( refString, "pr_" ), "Invalid challenge name: " + refString + " found in " + tableName );
  619.         level.challengeInfo[refString] = [];
  620.         level.challengeInfo[refString]["targetval"] = [];
  621.         level.challengeInfo[refString]["reward"] = [];
  622.         for ( tierId = 1; tierId < 11; tierId++ )
  623.         {
  624.             targetVal = challenge_targetVal( refString, tierId );
  625.             rewardVal = challenge_rewardVal( refString, tierId );
  626.             if ( targetVal == 0 )
  627.                 break;
  628.             level.challengeInfo[refString]["targetval"][tierId] = targetVal;
  629.             level.challengeInfo[refString]["reward"][tierId] = rewardVal;
  630.             totalRewardXP += rewardVal;
  631.         }
  632.        
  633.         assert( isDefined( level.challengeInfo[refString]["targetval"][1] ) );
  634.         refString = tableLookupByRow( tableName, index, 0 );
  635.     }
  636.     tierTable = tableLookupByRow( "mp/challengeTable.csv", 0, 4 ); 
  637.     for ( tierId = 1; tierTable != ""; tierId++ )
  638.     {
  639.         challengeRef = tableLookupByRow( tierTable, 0, 0 );
  640.         for ( challengeId = 1; challengeRef != ""; challengeId++ )
  641.         {
  642.             requirement = tableLookup( tierTable, 0, challengeRef, 1 );
  643.             if ( requirement != "" )
  644.                 level.challengeInfo[challengeRef]["requirement"] = requirement;
  645.             challengeRef = tableLookupByRow( tierTable, challengeId, 0 );
  646.         }
  647.         tierTable = tableLookupByRow( "mp/challengeTable.csv", tierId, 4 );
  648.     }
  649. }
  650. genericChallenge( challengeType, value )
  651. {
  652. }
  653. playerHasAmmo()
  654. {
  655.     primaryWeapons = self getWeaponsListPrimaries();
  656.     foreach ( primary in primaryWeapons )
  657.     {
  658.         if ( self GetWeaponAmmoClip( primary ) )
  659.             return true;
  660.         altWeapon = weaponAltWeaponName( primary );
  661.         if ( !isDefined( altWeapon ) || (altWeapon == "none") )
  662.             continue;
  663.         if ( self GetWeaponAmmoClip( altWeapon ) )
  664.             return true;
  665.     }
  666.     return false;
  667. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top