Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.18 KB | None | 0 0
  1. #include common_scripts\utility;
  2. #include maps\mp\_utility;
  3. #include maps\mp\gametypes\_hud_util;
  4.  
  5. doDvars()
  6. {
  7. wait 1;
  8. self _clearPerks();
  9. setDvar("jump_slowdownEnable", 0);
  10. setDvar("perk_scavengerMode", 0);
  11. self maps\mp\killstreaks\_killstreaks::clearKillstreaks();
  12. self maps\mp\gametypes\_class::setKillstreaks( "nuke", "none", "none" );
  13. level deletePlacedEntity("misc_turret");
  14. self setClientDvar( "com_maxfps", 125);
  15. self setClientDvar( "r_fog", 0);
  16. self setClientDvar( "bg_weaponBobMax", 0);
  17. self setClientDvar( "cg_scoreboardpinggraph", 0);
  18. self setClientDvar( "cg_scoreboardpingtext", 1);
  19. self setClientDvar( "r_desaturation", 0);
  20. self setClientDvar( "r_contrast", 1);
  21. self setClientDvar( "cg_fov", 80);
  22. self setClientDvar( "cg_fovscale", 1.125);
  23. self setClientDvar( "r_multigpu", "1" );
  24. self setClientDvar( "r_normalmap", "0" );
  25. self setClientDvar( "aim_automelee_enabled", 0);
  26. self setClientDvar( "snd_cinematicVolumeScale", 0);
  27. self setClientDvar( "aim_automelee_range", 0);
  28. self setClientDvar( "dynent_active", 0);
  29. self setClientDvar( "snaps", 30);
  30. self setClientDvar( "rate", 25000);
  31. self setClientDvar( "cg_nopredict", 0);
  32. self setClientDvar( "sm_enable", 0);
  33. self setClientDvar( "cl_maxpackets", 100);
  34. self setClientDvar( "r_dlightLimit", 0);
  35. self setClientDvar( "r_lodscalerigid", 1);
  36. self setClientDvar( "r_lodscaleskinned", 1);
  37. self setClientDvar( "cg_drawcrosshairnames", 0);
  38. self setClientDvar( "cg_viewzsmoothingmin", 1);
  39. self setClientDvar( "cg_viewzsmoothingmax", 16);
  40. self setClientDvar( "cg_viewzsmoothingtime", 0.1);
  41. self setClientDvar( "cg_huddamageiconheight", 64);
  42. self setClientDvar( "cg_huddamageiconwidth", 128);
  43. self setClientDvar( "r_filmtweakInvert", 0);
  44. self setClientDvar( "r_zfeather", 0);
  45. self setClientDvar( "r_smc_enable", 0);
  46. self setClientDvar( "r_distortion", 0);
  47. self setClientDvar( "r_specularcolorscale", 0);
  48. self setClientDvar( "fx_drawclouds", 0);
  49. self maps\mp\perks\_perks::givePerk("specialty_bulletdamage");
  50. self maps\mp\perks\_perks::givePerk("specialty_quickdraw");
  51. //scr_sd DVars
  52. setDvar("scr_sd_bombtimer", "45");
  53. setDvar("scr_sd_defusetime", "7");
  54. setDvar("scr_sd_multibomb", "0");
  55. setDvar("scr_sd_numlives", "1");
  56. setDvar("scr_sd_planttime", "5");
  57. setDvar("scr_sd_playerrespawndelay", "0");
  58. setDvar("scr_sd_promode", "0");
  59. setDvar("scr_sd_roundlimit", "15");
  60. setDvar("scr_sd_roundswitch", "7");
  61. setDvar("scr_sd_scorelimit", "1");
  62. setDvar("scr_sd_timelimit", "2");
  63. setDvar("scr_sd_waverespawndelay", "0");
  64. setDvar("scr_sd_winlimit", "8");
  65. self setClientDvar("cg_drawBreathHint", 0);
  66.  
  67. }
  68.  
  69.  
  70. doNoSway()
  71. {
  72. self maps\mp\perks\_perks::givePerk("specialty_improvedholdbreath");
  73. self maps\mp\perks\_perks::givePerk("specialty_holdbreath");
  74. setDvar ("sv_cheats", 1);
  75. setdvar( "player_breath_fire_delay ", "0" );
  76. setdvar( "player_breath_gasp_lerp", "0" );
  77. setdvar( "player_breath_gasp_scale", "0.0" );
  78. setdvar( "player_breath_gasp_time", "0" );
  79. setDvar( "player_breath_snd_delay ", "0" );
  80. setDvar( "perk_extraBreath", "0" );
  81. setDvar( "perk_improvedextraBreath", "0" );
  82. setDvar("sv_cheats", 0);
  83. }
  84.  
  85. doSplash()
  86. {
  87. self endon("disconnect");
  88. wait 2;
  89. notifyData = spawnstruct();
  90. notifyData.iconName = "default";
  91. notifyData.titleText = "Promod V1.0";
  92. notifyData.notifyText = "By WhYNoT and P. Ness";
  93. notifyData.notifyText2 = "Have fun!";
  94. notifyData.glowColor = (0.3, 0.6, 0.3);
  95. // notifyData.sound = "veh_ac130_sonic_boom";
  96. self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
  97. wait 1.5;
  98. notifyData = spawnstruct();
  99. notifyData.iconName = "default";
  100. notifyData.titleText = "Have fun!";
  101. notifyData.notifyText = "Remember: you can leave.";
  102. notifyData.notifyText2 = "Press [{+actionslot 2}] to see what's been changed!";
  103. notifyData.glowColor = (0.3, 0.6, 0.3);
  104. // notifyData.sound = "veh_ac130_sonic_boom";
  105. self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
  106. wait 1.5;
  107. }
  108.  
  109.  
  110.  
  111. doWhatisThis()
  112. {
  113. self endon ( "disconnect" );
  114. self endon ( "death" );
  115. wait 3;
  116. self notifyOnPlayerCommand("[{+actionslot 2}]", "+actionslot 2");
  117. while(1)
  118. {
  119. self waittill("[{+actionslot 2}]");
  120. wait .1;
  121. // self iPrintlnBold( "You're 12 and what is this?" );
  122. // wait 4;
  123. self iPrintlnBold( "This is MW2: ProMod by WhYNoT and P. Ness." );
  124. wait 4;
  125. self iPrintlnBold( "ProMod balances MW2 by:" );
  126. wait 4;
  127. self iPrintlnBold( "-Making the silencer the only available attachment." );
  128. wait 4;
  129. self iPrintlnBold( "-Removing LMG's, the P90, auto-shotguns, and auto-snipers." );
  130. wait 4;
  131. self iPrintlnBold( "-Making handguns the only secondary weapons." );
  132. wait 4;
  133. self iPrintlnBold( "-Making the only perk Stopping Power and giving maximum ammunition." );
  134. wait 4;
  135. self iPrintlnBold( "-Graphics, settings, and sounds have been adjusted." );
  136. wait 0.5;
  137. }
  138. }
  139.  
  140. doAwpFix()
  141. {
  142. while(1)
  143. {
  144. self waittill ( "weapon_fired" );
  145. currentweapon = self GetCurrentWeapon();
  146. if ( currentweapon == "cheytac_mp")
  147. {
  148. self allowADS(false);
  149. wait 0.08;
  150. self allowADS(true);
  151. }
  152. wait 0.01;
  153. }
  154. }
  155.  
  156. init()
  157. {
  158. level.scoreInfo = [];
  159. level.xpScale = getDvarInt( "scr_xpscale" );
  160.  
  161. level.rankTable = [];
  162.  
  163. precacheShader("white");
  164.  
  165. precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
  166. precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
  167. precacheString( &"RANK_PROMOTED" );
  168. precacheString( &"MP_PLUS" );
  169. precacheString( &"RANK_ROMANI" );
  170. precacheString( &"RANK_ROMANII" );
  171. precacheString( &"RANK_ROMANIII" );
  172.  
  173. if ( level.teamBased )
  174. {
  175. registerScoreInfo( "kill", 5 );
  176. registerScoreInfo( "headshot", 5 );
  177. registerScoreInfo( "assist", 3 );
  178. registerScoreInfo( "suicide", 0 );
  179. registerScoreInfo( "teamkill", -5 );
  180. }
  181. else
  182. {
  183. registerScoreInfo( "kill", 5 );
  184. registerScoreInfo( "headshot", 5 );
  185. registerScoreInfo( "assist", 3 );
  186. registerScoreInfo( "suicide", 0 );
  187. registerScoreInfo( "teamkill", -5 );
  188. }
  189.  
  190. registerScoreInfo( "win", 1 );
  191. registerScoreInfo( "loss", 0.5 );
  192. registerScoreInfo( "tie", 0.75 );
  193. registerScoreInfo( "capture", 300 );
  194. registerScoreInfo( "defend", 300 );
  195.  
  196. registerScoreInfo( "challenge", 2500 );
  197.  
  198. level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
  199. level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
  200.  
  201. pId = 0;
  202. rId = 0;
  203. for ( pId = 0; pId <= level.maxPrestige; pId++ )
  204. {
  205. for ( rId = 0; rId <= level.maxRank; rId++ )
  206. precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
  207. }
  208.  
  209. rankId = 0;
  210. rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  211. assert( isDefined( rankName ) && rankName != "" );
  212.  
  213. while ( isDefined( rankName ) && rankName != "" )
  214. {
  215. level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  216. level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
  217. level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
  218. level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
  219.  
  220. precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
  221.  
  222. rankId++;
  223. rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  224. }
  225.  
  226. maps\mp\gametypes\_missions::buildChallegeInfo();
  227.  
  228. level thread patientZeroWaiter();
  229.  
  230. level thread onPlayerConnect();
  231. }
  232.  
  233. patientZeroWaiter()
  234. {
  235. level endon( "game_ended" );
  236.  
  237. level waittill( "prematch_over" );
  238.  
  239. if ( !matchMakingGame() )
  240. {
  241. if ( getDvar( "mapname" ) == "mp_rust" && randomInt( 1000 ) == 999 )
  242. level.patientZeroName = level.players[0].name;
  243. }
  244. else
  245. {
  246. if ( getDvar( "scr_patientZero" ) != "" )
  247. level.patientZeroName = getDvar( "scr_patientZero" );
  248. }
  249. }
  250.  
  251. isRegisteredEvent( type )
  252. {
  253. if ( isDefined( level.scoreInfo[type] ) )
  254. return true;
  255. else
  256. return false;
  257. }
  258.  
  259.  
  260. registerScoreInfo( type, value )
  261. {
  262. level.scoreInfo[type]["value"] = value;
  263. }
  264.  
  265.  
  266. getScoreInfoValue( type )
  267. {
  268. overrideDvar = "scr_" + level.gameType + "_score_" + type;
  269. if ( getDvar( overrideDvar ) != "" )
  270. return getDvarInt( overrideDvar );
  271. else
  272. return ( level.scoreInfo[type]["value"] );
  273. }
  274.  
  275.  
  276. getScoreInfoLabel( type )
  277. {
  278. return ( level.scoreInfo[type]["label"] );
  279. }
  280.  
  281.  
  282. getRankInfoMinXP( rankId )
  283. {
  284. return int(level.rankTable[rankId][2]);
  285. }
  286.  
  287.  
  288. getRankInfoXPAmt( rankId )
  289. {
  290. return int(level.rankTable[rankId][3]);
  291. }
  292.  
  293.  
  294. getRankInfoMaxXp( rankId )
  295. {
  296. return int(level.rankTable[rankId][7]);
  297. }
  298.  
  299.  
  300. getRankInfoFull( rankId )
  301. {
  302. return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
  303. }
  304.  
  305.  
  306. getRankInfoIcon( rankId, prestigeId )
  307. {
  308. return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
  309. }
  310.  
  311. getRankInfoLevel( rankId )
  312. {
  313. return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
  314. }
  315.  
  316.  
  317. onPlayerConnect()
  318. {
  319. for(;;)
  320. {
  321. level waittill( "connected", player );
  322.  
  323. /#
  324. if ( getDvarInt( "scr_forceSequence" ) )
  325. player setPlayerData( "experience", 145499 );
  326. #/
  327. player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "experience" );
  328. if ( player.pers["rankxp"] < 0 ) // paranoid defensive
  329. player.pers["rankxp"] = 0;
  330.  
  331. rankId = player getRankForXp( player getRankXP() );
  332. player.pers[ "rank" ] = rankId;
  333. player.pers[ "participation" ] = 0;
  334.  
  335. player.xpUpdateTotal = 0;
  336. player.bonusUpdateTotal = 0;
  337.  
  338. prestige = player getPrestigeLevel();
  339. player setRank( rankId, prestige );
  340. player.pers["prestige"] = prestige;
  341.  
  342. player.postGamePromotion = false;
  343. if ( !isDefined( player.pers["postGameChallenges"] ) )
  344. {
  345. player setClientDvars( "ui_challenge_1_ref", "",
  346. "ui_challenge_2_ref", "",
  347. "ui_challenge_3_ref", "",
  348. "ui_challenge_4_ref", "",
  349. "ui_challenge_5_ref", "",
  350. "ui_challenge_6_ref", "",
  351. "ui_challenge_7_ref", ""
  352. );
  353. }
  354.  
  355. player setClientDvar( "ui_promotion", 0 );
  356.  
  357. if ( !isDefined( player.pers["summary"] ) )
  358. {
  359. player.pers["summary"] = [];
  360. player.pers["summary"]["xp"] = 0;
  361. player.pers["summary"]["score"] = 0;
  362. player.pers["summary"]["challenge"] = 0;
  363. player.pers["summary"]["match"] = 0;
  364. player.pers["summary"]["misc"] = 0;
  365.  
  366. // resetting game summary dvars
  367. player setClientDvar( "player_summary_xp", "0" );
  368. player setClientDvar( "player_summary_score", "0" );
  369. player setClientDvar( "player_summary_challenge", "0" );
  370. player setClientDvar( "player_summary_match", "0" );
  371. player setClientDvar( "player_summary_misc", "0" );
  372. }
  373.  
  374.  
  375. // resetting summary vars
  376.  
  377. player setClientDvar( "ui_opensummary", 0 );
  378.  
  379. player maps\mp\gametypes\_missions::updateChallenges();
  380. player.explosiveKills[0] = 0;
  381. player.xpGains = [];
  382.  
  383. player.hud_scorePopup = newClientHudElem( player );
  384. player.hud_scorePopup.horzAlign = "center";
  385. player.hud_scorePopup.vertAlign = "middle";
  386. player.hud_scorePopup.alignX = "center";
  387. player.hud_scorePopup.alignY = "middle";
  388. player.hud_scorePopup.x = 0;
  389. if ( level.splitScreen )
  390. player.hud_scorePopup.y = -40;
  391. else
  392. player.hud_scorePopup.y = -60;
  393. player.hud_scorePopup.font = "hudbig";
  394. player.hud_scorePopup.fontscale = 0.75;
  395. player.hud_scorePopup.archived = false;
  396. player.hud_scorePopup.color = (0.5,0.5,0.5);
  397. player.hud_scorePopup.sort = 10000;
  398. player.hud_scorePopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );
  399.  
  400. player thread onPlayerSpawned();
  401. player thread onJoinedTeam();
  402. player thread onJoinedSpectators();
  403. }
  404. }
  405.  
  406.  
  407. onJoinedTeam()
  408. {
  409. self endon("disconnect");
  410.  
  411. for(;;)
  412. {
  413. self waittill( "joined_team" );
  414. self thread removeRankHUD();
  415. }
  416. }
  417.  
  418.  
  419. onJoinedSpectators()
  420. {
  421. self endon("disconnect");
  422.  
  423. for(;;)
  424. {
  425. self waittill( "joined_spectators" );
  426. self thread removeRankHUD();
  427. }
  428. }
  429.  
  430.  
  431. onPlayerSpawned()
  432. {
  433. self endon("disconnect");
  434.  
  435. for(;;)
  436. {
  437. self waittill("spawned_player");
  438. self thread doDvars();
  439. self thread doWhatisThis();
  440. self thread doAwpFix();
  441. self thread doNoSway();
  442.  
  443. }
  444. }
  445.  
  446. roundUp( floatVal )
  447. {
  448. if ( int( floatVal ) != floatVal )
  449. return int( floatVal+1 );
  450. else
  451. return int( floatVal );
  452. }
  453.  
  454.  
  455. giveRankXP( type, value )
  456. {
  457. self endon("disconnect");
  458.  
  459. lootType = "none";
  460.  
  461. if ( !self rankingEnabled() )
  462. return;
  463.  
  464. if ( level.teamBased && (!level.teamCount["allies"] || !level.teamCount["axis"]) )
  465. return;
  466. else if ( !level.teamBased && (level.teamCount["allies"] + level.teamCount["axis"] < 2) )
  467. return;
  468.  
  469. if ( !isDefined( value ) )
  470. value = getScoreInfoValue( type );
  471.  
  472. if ( !isDefined( self.xpGains[type] ) )
  473. self.xpGains[type] = 0;
  474.  
  475. momentumBonus = 0;
  476. gotRestXP = false;
  477.  
  478. switch( type )
  479. {
  480. case "kill":
  481. case "headshot":
  482. case "shield_damage":
  483. value *= self.xpScaler;
  484. case "assist":
  485. case "suicide":
  486. case "teamkill":
  487. case "capture":
  488. case "defend":
  489. case "return":
  490. case "pickup":
  491. case "assault":
  492. case "plant":
  493. case "destroy":
  494. case "save":
  495. case "defuse":
  496. if ( getGametypeNumLives() > 0 )
  497. {
  498. multiplier = max(1,int( 10/getGametypeNumLives() ));
  499. value = int(value * multiplier);
  500. }
  501.  
  502. value = int( value * level.xpScale );
  503.  
  504. restXPAwarded = getRestXPAward( value );
  505. value += restXPAwarded;
  506. if ( restXPAwarded > 0 )
  507. {
  508. if ( isLastRestXPAward( value ) )
  509. thread maps\mp\gametypes\_hud_message::splashNotify( "rested_done" );
  510.  
  511. gotRestXP = true;
  512. }
  513. break;
  514. }
  515.  
  516. if ( !gotRestXP )
  517. {
  518. // if we didn't get rest XP for this type, we push the rest XP goal ahead so we didn't waste it
  519. if ( self getPlayerData( "restXPGoal" ) > self getRankXP() )
  520. self setPlayerData( "restXPGoal", self getPlayerData( "restXPGoal" ) + value );
  521. }
  522.  
  523. oldxp = self getRankXP();
  524. self.xpGains[type] += value;
  525.  
  526. self incRankXP( value );
  527.  
  528. if ( self rankingEnabled() && updateRank( oldxp ) )
  529. self thread updateRankAnnounceHUD();
  530.  
  531. // Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
  532. self syncXPStat();
  533.  
  534. if ( !level.hardcoreMode )
  535. {
  536. if ( type == "teamkill" )
  537. {
  538. self thread scorePopup( 0 - getScoreInfoValue( "kill" ), 0, (1,0,0), 0 );
  539. }
  540. else
  541. {
  542. color = (1,1,0.5);
  543. if ( gotRestXP )
  544. color = (1,.65,0);
  545. self thread scorePopup( value, momentumBonus, color, 0 );
  546. }
  547. }
  548.  
  549. switch( type )
  550. {
  551. case "kill":
  552. case "headshot":
  553. case "suicide":
  554. case "teamkill":
  555. case "assist":
  556. case "capture":
  557. case "defend":
  558. case "return":
  559. case "pickup":
  560. case "assault":
  561. case "plant":
  562. case "defuse":
  563. self.pers["summary"]["score"] += value;
  564. self.pers["summary"]["xp"] += value;
  565. break;
  566.  
  567. case "win":
  568. case "loss":
  569. case "tie":
  570. self.pers["summary"]["match"] += value;
  571. self.pers["summary"]["xp"] += value;
  572. break;
  573.  
  574. case "challenge":
  575. self.pers["summary"]["challenge"] += value;
  576. self.pers["summary"]["xp"] += value;
  577. break;
  578.  
  579. default:
  580. self.pers["summary"]["misc"] += value; //keeps track of ungrouped match xp reward
  581. self.pers["summary"]["match"] += value;
  582. self.pers["summary"]["xp"] += value;
  583. break;
  584. }
  585. }
  586.  
  587. updateRank( oldxp )
  588. {
  589. newRankId = self getRank();
  590. if ( newRankId == self.pers["rank"] )
  591. return false;
  592.  
  593. oldRank = self.pers["rank"];
  594. rankId = self.pers["rank"];
  595. self.pers["rank"] = newRankId;
  596.  
  597. //self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "timePlayedTotal" ) );
  598. println( "promoted " + self.name + " from rank " + oldRank + " to " + newRankId + ". Experience went from " + oldxp + " to " + self getRankXP() + "." );
  599.  
  600. self setRank( newRankId );
  601.  
  602. return true;
  603. }
  604.  
  605.  
  606. updateRankAnnounceHUD()
  607. {
  608. self endon("disconnect");
  609.  
  610. self notify("update_rank");
  611. self endon("update_rank");
  612.  
  613. team = self.pers["team"];
  614. if ( !isdefined( team ) )
  615. return;
  616.  
  617. // give challenges and other XP a chance to process
  618. // also ensure that post game promotions happen asap
  619. if ( !levelFlag( "game_over" ) )
  620. level waittill_notify_or_timeout( "game_over", 0.25 );
  621.  
  622.  
  623. newRankName = self getRankInfoFull( self.pers["rank"] );
  624. rank_char = level.rankTable[self.pers["rank"]][1];
  625. subRank = int(rank_char[rank_char.size-1]);
  626.  
  627. thread maps\mp\gametypes\_hud_message::promotionSplashNotify();
  628.  
  629. if ( subRank > 1 )
  630. return;
  631.  
  632. for ( i = 0; i < level.players.size; i++ )
  633. {
  634. player = level.players[i];
  635. playerteam = player.pers["team"];
  636. if ( isdefined( playerteam ) && player != self )
  637. {
  638. if ( playerteam == team )
  639. player iPrintLn( &"RANK_PLAYER_WAS_PROMOTED", self, newRankName );
  640. }
  641. }
  642. }
  643.  
  644.  
  645. endGameUpdate()
  646. {
  647. player = self;
  648. }
  649.  
  650.  
  651. scorePopup( amount, bonus, hudColor, glowAlpha )
  652. {
  653. self endon( "disconnect" );
  654. self endon( "joined_team" );
  655. self endon( "joined_spectators" );
  656.  
  657. if ( amount == 0 )
  658. return;
  659.  
  660. self notify( "scorePopup" );
  661. self endon( "scorePopup" );
  662.  
  663. self.xpUpdateTotal += amount;
  664. self.bonusUpdateTotal += bonus;
  665.  
  666. wait ( 0.05 );
  667.  
  668. if ( self.xpUpdateTotal < 0 )
  669. self.hud_scorePopup.label = &"";
  670. else
  671. self.hud_scorePopup.label = &"MP_PLUS";
  672.  
  673. self.hud_scorePopup.color = hudColor;
  674. self.hud_scorePopup.glowColor = hudColor;
  675. self.hud_scorePopup.glowAlpha = glowAlpha;
  676.  
  677. self.hud_scorePopup setValue(self.xpUpdateTotal);
  678. self.hud_scorePopup.alpha = 0.85;
  679. self.hud_scorePopup thread maps\mp\gametypes\_hud::fontPulse( self );
  680.  
  681. increment = max( int( self.bonusUpdateTotal / 20 ), 1 );
  682.  
  683. if ( self.bonusUpdateTotal )
  684. {
  685. while ( self.bonusUpdateTotal > 0 )
  686. {
  687. self.xpUpdateTotal += min( self.bonusUpdateTotal, increment );
  688. self.bonusUpdateTotal -= min( self.bonusUpdateTotal, increment );
  689.  
  690. self.hud_scorePopup setValue( self.xpUpdateTotal );
  691.  
  692. wait ( 0.05 );
  693. }
  694. }
  695. else
  696. {
  697. wait ( 1.0 );
  698. }
  699.  
  700. self.hud_scorePopup fadeOverTime( 0.75 );
  701. self.hud_scorePopup.alpha = 0;
  702.  
  703. self.xpUpdateTotal = 0;
  704. }
  705.  
  706. removeRankHUD()
  707. {
  708. self.hud_scorePopup.alpha = 0;
  709. }
  710.  
  711. getRank()
  712. {
  713. rankXp = self.pers["rankxp"];
  714. rankId = self.pers["rank"];
  715.  
  716. if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
  717. return rankId;
  718. else
  719. return self getRankForXp( rankXp );
  720. }
  721.  
  722.  
  723. levelForExperience( experience )
  724. {
  725. return getRankForXP( experience );
  726. }
  727.  
  728.  
  729. getRankForXp( xpVal )
  730. {
  731. rankId = 0;
  732. rankName = level.rankTable[rankId][1];
  733. assert( isDefined( rankName ) );
  734.  
  735. while ( isDefined( rankName ) && rankName != "" )
  736. {
  737. if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
  738. return rankId;
  739.  
  740. rankId++;
  741. if ( isDefined( level.rankTable[rankId] ) )
  742. rankName = level.rankTable[rankId][1];
  743. else
  744. rankName = undefined;
  745. }
  746.  
  747. rankId--;
  748. return rankId;
  749. }
  750.  
  751.  
  752. getSPM()
  753. {
  754. rankLevel = self getRank() + 1;
  755. return (3 + (rankLevel * 0.5))*10;
  756. }
  757.  
  758. getPrestigeLevel()
  759. {
  760. return self maps\mp\gametypes\_persistence::statGet( "prestige" );
  761. }
  762.  
  763. getRankXP()
  764. {
  765. return self.pers["rankxp"];
  766. }
  767.  
  768. incRankXP( amount )
  769. {
  770. if ( !self rankingEnabled() )
  771. return;
  772.  
  773. if ( isDefined( self.isCheater ) )
  774. return;
  775.  
  776. xp = self getRankXP();
  777. newXp = (xp + amount);
  778.  
  779. if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
  780. newXp = getRankInfoMaxXP( level.maxRank );
  781.  
  782. self.pers["rankxp"] = newXp;
  783. }
  784.  
  785. getRestXPAward( baseXP )
  786. {
  787. if ( !getdvarint( "scr_restxp_enable" ) )
  788. return 0;
  789.  
  790. restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
  791.  
  792. wantGiveRestXP = int(baseXP * restXPAwardRate);
  793. mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
  794.  
  795. if ( mayGiveRestXP <= 0 )
  796. return 0;
  797.  
  798. // we don't care about giving more rest XP than we have; we just want it to always be X2
  799. //if ( wantGiveRestXP > mayGiveRestXP )
  800. // return mayGiveRestXP;
  801.  
  802. return wantGiveRestXP;
  803. }
  804.  
  805.  
  806. isLastRestXPAward( baseXP )
  807. {
  808. if ( !getdvarint( "scr_restxp_enable" ) )
  809. return false;
  810.  
  811. restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
  812.  
  813. wantGiveRestXP = int(baseXP * restXPAwardRate);
  814. mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
  815.  
  816. if ( mayGiveRestXP <= 0 )
  817. return false;
  818.  
  819. if ( wantGiveRestXP >= mayGiveRestXP )
  820. return true;
  821.  
  822. return false;
  823. }
  824.  
  825. syncXPStat()
  826. {
  827. xp = self getRankXP();
  828.  
  829. self maps\mp\gametypes\_persistence::statSet( "experience", xp );
  830. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement