Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 00409 00410 00411 00412 00413 00414 00415 00416 00417 00418 00419 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00438 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00490 00491 00492 00493 00494 00495 00496 00497 00498 00499 00500 00501 00502 00503 00504 00505 00506 00507 00508 00509 00510 00511 00512 00513 00514 00515 00516 00517 00518 00519 00520 00521 00522 00523 00524 00525 00526 00527 00528 00529 00530 00531 00532 00533 00534 00535 00536 00537 00538 00539 00540 00541 00542 00543 00544 00545 00546 00547 00548 00549 00550 00551 00552 00553 00554 00555 00556 00557 00558 00559 00560 00561 00562 00563 00564 00565 00566 00567 00568 00569 00570 00571 00572 00573 00574 00575 00576 00577 00578 00579 00580 00581 00582 00583 00584 00585 00586 00587 00588 00589 00590 00591 00592 00593 00594 00595 00596 00597 00598 00599 00600 00601 00602 00603 00604 00605 00606 00607 00608 00609 00610 00611 00612 00613 00614 00615 00616 00617 00618 00619 00620 00621 00622 00623 00624 00625 00626 00627 00628 00629 00630 00631 00632 00633 00634 00635 00636 00637 00638 00639 00640 00641 00642 00643 00644 00645 00646 00647 00648 00649 00650 00651 00652 00653 00654 00655 00656 00657 00658 00659 00660 00661 00662 00663 00664 00665 00666 00667 00668 00669 00670 00671 00672 00673 00674 00675 00676 00677 00678 00679 00680 00681 00682 00683 00684 00685 00686 00687 00688 00689 00690 00691 00692 00693 00694 00695 00696 00697 00698 00699 00700 00701 00702 00703 00704 00705 00706 00707 00708 00709 00710 00711 00712 00713 00714 00715 00716 00717 00718 00719 00720 00721 00722 00723 00724 00725 00726 00727 00728 00729 00730 00731 00732 00733 00734 00735 00736 00737 00738 00739 00740 00741 00742 00743 00744 00745 00746 00747 00748 00749 00750 00751 00752 00753 00754 00755 00756 00757 00758 00759 00760 00761 00762 00763 00764 00765 00766 00767 00768 00769 00770 00771 00772 00773 00774 00775 00776 00777 00778 00779 00780 00781 00782 00783 00784 00785 00786 00787 00788 00789 00790 00791 00792 00793 00794 00795 00796 00797 00798 00799 00800 00801 00802 00803 00804 00805 00806 00807 00808 00809 00810 00811 00812 00813 00814 00815 00816 00817 00818 00819 00820 00821 00822 00823 00824 00825 00826 00827 00828 00829 00830 00831 00832 00833 00834 00835 00836 00837 00838 00839 00840 00841 00842 00843 00844 00845 00846 00847 00848 00849 00850 00851 00852 00853 00854 00855 00856 00857 00858 00859 00860 00861 00862 00863 00864 00865 00866 00867 00868 00869 00870 00871 00872 00873 00874 00875 00876 00877 00878 00879 00880 00881 00882 00883 00884 00885 00886 00887 00888 00889 00890 00891 00892 00893 00894 00895 00896 00897 00898 00899 00900 00901 00902 00903 00904 00905 00906 00907 00908 00909 00910 00911 00912 00913 00914 00915 00916 00917 00918 00919 00920 00921 00922 00923 00924 00925 00926 00927 00928 00929 00930 00931 00932 00933 00934 00935 00936 00937 00938 00939 00940 00941 00942 00943 00944 00945 00946 00947 00948 00949 00950 00951 00952 00953 00954 00955 00956 00957 00958 00959 00960 00961 00962 00963 00964 00965 00966 00967 00968 00969 00970 00971 00972 00973 00974 00975 00976 00977 00978 00979 00980 00981 00982 00983 00984 00985 00986 00987 00988 00989 00990 00991 00992 00993 00994 00995 00996 00997 00998 00999 01000 01001 01002 01003 01004 01005 01006 01007 01008 01009 01010 01011 01012 01013 01014 01015 01016 01017 01018 01019 01020 01021 01022 01023 01024 01025 01026 01027 01028 01029 01030 01031 01032 01033 01034 01035 01036 01037 01038 01039 01040 01041 01042 01043 01044 01045 01046 01047 01048 01049 01050 01051 01052 01053 01054 01055 01056 01057 01058 01059 01060 01061 01062 01063 01064 01065 01066 01067 01068 01069 01070 01071 01072 01073 01074 01075 01076 01077 01078 01079 01080 01081 01082 01083 01084 01085 01086 01087 01088 01089 01090 01091 01092 01093 01094 01095 01096 01097 01098 01099 01100 01101 01102 01103 01104 01105 01106 01107 01108 01109 01110 01111 01112 01113 01114 01115 01116 01117 01118 01119 01120 01121 01122 01123 01124 01125 01126 01127 01128 01129 01130 01131 01132 01133 01134 01135 01136 01137 01138 01139 01140 01141 01142 01143 01144 01145 01146 01147 01148 01149 01150 01151 01152 01153 01154 01155 01156 01157 01158 01159 01160 01161 01162 01163 01164 01165 01166 01167 01168 01169 01170 01171 01172 01173 01174 01175 01176 01177 01178 01179 01180 01181 01182 01183 01184 01185 01186 01187 01188 01189 01190 01191 01192 01193 01194 01195 01196 01197 01198 01199 01200 01201 01202 01203 01204 01205 01206 01207 01208 01209 01210 01211 01212 01213 01214 01215 01216 01217 01218 01219 01220 01221 01222 01223 01224 01225 01226 01227 01228 01229 01230 01231 01232 01233 01234 01235 01236 01237 01238 01239 01240 01241 01242 01243 01244 01245 01246 01247 01248 01249 01250 01251 01252 01253 01254 01255 01256 01257 01258 01259 01260 01261 01262 01263 01264 01265 01266 01267 01268 01269 01270 01271 01272 01273 01274 01275 01276 01277 01278 01279 01280 01281 01282 01283 01284 01285 01286 01287 01288 01289 01290 01291 01292 01293 01294 01295 01296 01297 01298 01299 01300 01301 01302 01303 01304 01305 01306 01307 01308 01309 01310 01311 01312 01313 01314 01315 01316 01317 01318 01319 01320 01321 01322 01323 01324 01325 01326 01327 01328 01329 01330 01331 01332 01333 01334 01335 01336 01337 01338 01339 01340 01341 01342 01343 01344 01345 01346 01347 01348 01349 01350 01351 01352 01353 01354 01355 01356 01357 01358 01359 01360 01361 01362 01363 01364 01365 01366 01367 01368 01369 01370 01371 01372 01373 01374 01375 01376 01377 01378 01379 01380 01381 01382 01383 01384 01385 01386 01387 01388 01389 01390 01391 01392 01393 01394 01395 01396 01397 01398 01399 01400 01401 01402 01403 01404 01405 01406 01407 01408 01409 01410 01411 01412 01413 01414 01415 01416 01417 01418 01419 01420 01421 01422 01423 01424 01425 01426 01427 01428 01429 01430 01431 01432 01433 01434 01435 01436 01437 01438 01439 01440 01441 01442 01443 01444 01445 01446 01447 01448 01449 01450 01451 01452 01453 01454 01455 01456 01457 01458 01459 01460 01461 01462 01463 01464 01465 01466 01467 01468 01469 01470 01471 01472 01473 01474 01475 01476 01477 01478 01479 01480 01481 01482 01483 01484 01485 01486 01487 01488 01489 01490 01491 01492 01493 01494 01495 01496 01497 01498 01499 01500 01501 01502 01503 01504 01505 01506 01507 01508 01509 01510 01511 01512 01513 01514 01515 01516 01517 01518 01519 01520 01521 01522 01523 01524 01525 01526 01527 01528 01529 01530 01531 01532 01533 01534 01535 01536 01537 01538 01539 01540 01541 01542 01543 01544 01545 01546 01547 01548 01549 01550 01551 01552 01553 01554 01555 01556 01557 01558 01559 01560 01561 01562 01563 01564 01565 01566 01567 01568 01569 01570 01571 01572 01573 01574 01575 01576 01577 01578 01579 01580 01581 01582 01583 01584 01585 01586 01587 01588 01589 01590 01591 01592 01593 01594 01595 01596 01597 01598 01599 01600 01601 01602 01603 01604 01605 01606 01607 01608 01609 01610 01611 01612 01613 01614 01615 01616 01617 01618 01619 01620 01621 01622 01623 01624 01625 01626 01627 01628 01629 01630 01631 01632 01633 01634 01635 01636 01637 01638 01639 01640 01641 01642 01643 01644 01645 01646 01647 01648 01649 01650 01651 01652 01653 01654 01655 01656 01657 01658 01659 01660 01661 01662 01663 01664 01665 01666 01667 01668 01669 01670 01671 01672 01673 01674 01675 01676 01677 01678 01679 01680 01681 01682 01683 01684 01685 01686 01687 01688 01689 01690 01691 01692 01693 01694 01695 01696 01697 01698 01699 01700 01701 01702 01703 01704 01705 01706 01707 01708 01709 01710 01711 01712 01713 01714 01715 01716 01717 01718 01719 01720 01721 01722 01723 01724 01725 |
//============================================================================== // Single Player Game Profile for storing the additional info // // Written by Michiel Hendriks // (c) 2003, 2004, Epic Games, Inc. All Rights Reserved //============================================================================== class UT2K4GameProfile extends UT2003GameProfile; /** used to keep track of future changes */ var protected int revision; var bool bDebug; var class<UT2K4LadderInfo> UT2K4GameLadder; /** Progression in the ladders */ var array<int> LadderProgress; /** The map that will be played, set by the "play" button */ var CacheManager.MapRecord ActiveMap; /** seed to select the random level */ var int AltPath; /** map selection record, this will override the default behavior of map selection for a match */ struct LevelPathRecord { /** the selected ladder */ var byte ladder; /** match in the selected ladder */ var byte rung; /** the offset in the AltLevel array */ var byte selection; }; /** the selected path */ var array<LevelPathRecord> LevelRoute; /** The actual team size Warning, absolute max size is 7 (set by GameProfile) Don't use this variable, call GetMaxTeamSize() instead */ var protected int MaxTeamSize; /** Statistics for each bot in this profile. Saved per profile because they change during the tournament */ struct BotStatsRecord { var string Name; /** updated price to 'buy' the player, this is also used to calculate the fee and injury treatment */ var int Price; /** injury stats, 0 = dead (you don't want that ;)) */ var byte Health; /** is this a free agent, e.g. can you hire him/her */ var bool FreeAgent; /** location of his team in the TeamStats list */ var int TeamId; }; var array<BotStatsRecord> BotStats; /** Stats for each team */ struct TeamStatsRecord { /** the fully qualified name of the team class */ var string Name; /** the difficulty level of this team */ var int Level; /** number of games played against this team */ var int Matches; /** number of games this team won from you */ var int Won; /** the rating of this team compared to you */ var float Rating; }; var array<TeamStatsRecord> TeamStats; /** The current Player Balance */ var int Balance; /** the minimal balance */ var int MinBalance; /** total ingame time */ var float TotalTime; /** Set to 'true' when the SP has been completed */ var bool bCompleted; /** the best team played against, used for championship */ var string FinalEnemyTeam; /** Player used a cheat */ var protected bool bCheater; /** if set to true users can't unlock characters with this profile */ var protected bool bLocked; /** prevent some cheating */ var protected string PlayerIDHash; /** Team percentage modifier This value is multiplied with the fee for each player, lower value = lower take of the earnings */ var float TeamPercentage; /** Percentage of the Match price that counts as bonus (per player) **/ var float MatchBonus; /** The percentage of the team players fee to pay out when the team loses */ var float LoserFee; /** Every time a bot played a match and won his fee increases with this */ var float FeeIncrease; /** The chance a team player get's injured */ var float InjuryChance; /** the offset in the BotStats array of the last injured player */ var int LastInjured; /** injury treatment modifier */ var float InjuryTreatment; /** Chance the losing enemy team will challenge you for a rematch */ var float ChallengeChance; // Last match details -- /** if set to true the details are new and the detail window should be displayed */ var bool lmdFreshInfo; /** player details from the last match */ struct PlayerMatchDetailsRecord { var int ID; var string Name; var float Kills; var float Score; var float Deaths; var int Team; /** special awards won by this player, like Flag Monkey */ var array<string> SpecialAwards; }; /** per player details */ var array<PlayerMatchDetailsRecord> PlayerMatchDetails; /** total change in the balance, includes payment and bonuses */ var int lmdBalanceChange; /** true if the player won the match */ var bool lmdWonMatch; /** enemy team class */ var string lmdEnemyTeam; /** game type string */ var string lmdGameType; /** true if the last match was a challenge match */ var bool lmdbChallengeGame; /** map title */ var string lmdMap; /** total prizemoney */ var int lmdPrizeMoney; /** total bonus money */ var int lmdTotalBonusMoney; /** last spree count */ var int lmdSpree[6]; /** last multikill count */ var int lmdMultiKills[7]; /** player ID of injured player */ var int lmdInjury; /** health, stored here because player could have been healed */ var byte lmdInjuryHealth; /** injury treatment gost */ var int lmdInjuryTreatment; /** total match time */ var float lmdGameTime; /** true if it was a team game */ var bool lmdTeamGame; /** teamID of the player's team (usualy 1) */ var int lmdMyTeam; struct PayCheckRecord { var int BotId; var int Payment; }; /** payment overview of you team mates */ var array<PayCheckRecord> PayCheck; struct PhantomMatchRecord { var int Team1; // team id in the team stats array var int Team2; var float ScoreTeam1; var float ScoreTeam2; var int LadderId; var int MatchId; var float GameTime; }; /** phantom match overview */ var array<PhantomMatchRecord> PhantomMatches; // -- Last match details struct TeamMateRankingRecord { var int BotID; var float Rank; }; /** Used for payment and injuries, only valid during RegisterGame() */ var array<TeamMateRankingRecord> TeamMateRanking; /** Phantom Teams to choose from */ var array<string> PhantomTeams; /** when true use ChallengeInfo for information */ var bool bIsChallenge; /** the challenge match info, obsolete? */ var UT2K4MatchInfo ChallengeInfo; /** will be set to the challenge game class used if bIsChallenge = true*/ var class<ChallengeGame> ChallengeGameClass; /** true we we got challenged, false if we took the initiative */ var bool bGotChallenged; /** contains data about the challenge variables, used for fighthistory */ var string ChallengeVariable; /** When set override the default LoginMenuClass with this one */ var string LoginMenuClass; /** @ignore */ var name LogPrefix; // more all time stats -- var int Spree[6]; var int MultiKills[7]; var int SpecialAwards[6]; // -- more all time stats /** bonus received for each killing spree */ var int SpreeBonus[6]; /** bonus received for each multikill */ var int MultiKillBonus[7]; /** Special Awards labels */ var localized string msgSpecialAward[6]; /** special award levels */ var int sae_flackmonkey, sae_combowhore, sae_headhunter, sae_roadrampage, sae_hattrick, sae_untouchable; var localized string msgCheater, msgCredits, msgCredit; /** The fee you have to pay when you forfeit the game */ var protected float ForFeitFee; /** percentage of the match prize a map challenge costs */ var float MapChallengeCost; struct FightHistoryRecord { /** yyyy-mm-dd */ var int Date[3]; /** hh:mm */ var int Time[2]; /** magic string, fields seperated by ';' <br /> field 1: match type (Ladder game, challenge game, custom ladder game) <br /> field 2: match description */ var string MatchData; /** additional data, depends on the MatchData type */ var string MatchExtra; /** map name */ var string Level; /** gametype class, fully qualified */ var string GameType; /** enemy team class, fully qualified */ var string EnemyTeam; /** price money */ var float PriceMoney; /** balance change */ var float BalanceChange; /** bonus money won */ var float BonusMoney; /** game time */ var float GameTime; var bool WonGame; /** team scores, 1 = our team, 0 = enemy team */ var float TeamScore[2]; /** gee, what would this be then */ var bool TeamGame; /** team layout */ var string TeamLayout[2]; /** player's score in this game */ var float MyScore; /** number of kills */ var int MyKills; /** number of deaths */ var int MyDeaths; /** my awards */ var string MyAwards; /** final position in the scoring table */ var byte MyRating; }; /** the history of all fights */ var array<FightHistoryRecord> FightHistory; /** localized strings used for the fighthistory */ var localized string msgChallengeGame, msgAdditionalLadder, msgMatch, msgLadderGame, msgChampionship; /** team roster override record */ struct TeamRosterRecord { /** fully qualified name of the team roster class */ var string name; /** the alternative roster */ var array<string> roster; }; /** team roster override records */ var array<TeamRosterRecord> AltTeamRoster; /** information about a custom ladder */ struct CustomLadderRecord { /** the fully qualified name to the ladder class */ var string LadderClass; /** current progress */ var int progress; }; /** custom ladders */ var array<CustomLadderRecord> CustomLadders; /** will be set when a custom ladder has been played, and unset when not */ var class<CustomLadderInfo> LastCustomCladder; /** if true match details will be shown after a match */ var bool bShowDetails; /** call this when you create a new profile, this will set the protection data */ function CreateProfile(PlayerController PlayerOwner) { if (PlayerIDHash == "") PlayerIDHash = PlayerOwner.GetPlayerIDHash(); } /** call this when you load the profile, it will lock the profile when the PlayerIDHash has changed */ function LoadProfile(PlayerController PlayerOwner) { if (PlayerIDHash != PlayerOwner.GetPlayerIDHash()) { bLocked = true; PlayerIDHash = PlayerOwner.GetPlayerIDHash(); } } /** initialize the profile, called at the beginning of each game */ function Initialize(GameInfo currentGame, string pn) { local Controller C; if (UT2K4GameLadder == none) { UT2K4GameLadder = class<UT2K4LadderInfo>(DynamicLoadObject(GameLadderName, class'Class')); GameLadder = UT2K4GameLadder; } PackageName=pn; UpgradeGP(); // set character, player in current game for ( C=currentGame.Level.ControllerList; C!=None; C=C.NextController ) { if ( PlayerController(C) != None ) { currentGame.ChangeName (PlayerController(C), PlayerName, false); break; } } NextMatchObject=None; ChampBorderObject=None; Playerteam.length = GetMaxTeamSize(); // make sure it's never larger than this if ((DeathMatch(currentGame) != none) && (LoginMenuClass != "")) { DeathMatch(currentGame).LoginMenuClass = LoginMenuClass; } //if (Balance < MinBalance) Balance = MinBalance; } /** Called on gamerestart */ function ContinueSinglePlayerGame(LevelInfo level, optional bool bReplace) { local Controller C; local PlayerController PC; // set character, player in current game PC = none; for ( C=level.ControllerList; C!=None; C=C.NextController ) { if ( PlayerController(C) != None ) { PC = PlayerController(C); break; } } if ( PC == none ) { return; } //if (Balance < MinBalance) Balance = MinBalance; if (!level.game.SavePackage(PackageName)) { Warn("level.game.SavePackage("@PackageName@") FAILED."); } bIsChallenge = false; PC.ConsoleCommand("disconnect"); } function CheatSkipMatch(GameInfo CurrentGame) { local UT2K4MatchInfo MI; MI = UT2K4MatchInfo(GetMatchInfo(CurrentLadder, CurrentMenuRung)); Balance = Balance + ForfeitFee + MI.PrizeMoney;; Super.CheatSkipMatch(CurrentGame); } /** After a game is completed, this function should be called to record the player's statistics and update the ladder. Currently called from Deathmatch 'MatchOver' state */ function RegisterGame(GameInfo currentGame, PlayerReplicationInfo PRI) { local UT2K4MatchInfo MI; local int i, j, OldBalance; local float TeamRating; local array<PlayerReplicationInfo> PRIarray; local bool TempbIsChallenge, doPayTeamMates; local string tmp; MI = UT2K4MatchInfo(GetMatchInfo(CurrentLadder, CurrentMenuRung)); Balance += ForFeitFee; // payback forfeitfee OldBalance = Balance; PayCheck.length = 0; SpecialEvent = ""; TempbIsChallenge = bIsChallenge; if (bIsChallenge && ChallengeGameClass != none) ChallengeGameClass.static.PreRegisterGame(self, currentGame, PRI); Kills += PRI.Kills; Goals += PRI.GoalsScored; Deaths += PRI.Deaths; Matches++; TotalTime += currentGame.Level.TimeSeconds-currentGame.StartTime; lmdTotalBonusMoney = 0; LastInjured = -1; PayCheck.length = 0; PlayerMatchDetails.length = 0; if (TeamPlayerReplicationInfo(PRI) != none) { for (i = 0; i < 6; i++) { Spree[i] += TeamPlayerReplicationInfo(PRI).Spree[i]; lmdSpree[i] = TeamPlayerReplicationInfo(PRI).Spree[i]; lmdTotalBonusMoney += TeamPlayerReplicationInfo(PRI).Spree[i]*SpreeBonus[i]; } for (i = 0; i < 7; i++) { MultiKills[i] += TeamPlayerReplicationInfo(PRI).MultiKills[i]; lmdMultiKills[i] = TeamPlayerReplicationInfo(PRI).MultiKills[i]; lmdTotalBonusMoney += TeamPlayerReplicationInfo(PRI).MultiKills[i]*MultiKillBonus[i]; } } Balance += lmdTotalBonusMoney; if (CurrentLadder != UT2K4GameLadder.default.LID_DM) { i = GetTeamPosition(EnemyTeam, true); TeamStats[i].Matches++; if (!bWonMatch) TeamStats[i].Won++; TeamRating = 0; if (currentGame.bTeamGame) { // Rating is: team score / other team score * (team won match) // Rating will increase faster than it will decrease TeamRating = (TeamGame(currentGame).Teams[(PRI.Team.TeamIndex+1) % 2].Score+1.0)/(TeamGame(currentGame).Teams[PRI.Team.TeamIndex].Score+1.0); RankTeamMates(currentGame, PRI); if (TempbIsChallenge && ChallengeGameClass != none) doPayTeamMates = ChallengeGameClass.static.injureTeamMate(self); else doPayTeamMates = true; if (doPayTeamMates) InjureTeamMate(); } else { // won from the whole team currentGame.GameReplicationInfo.GetPRIArray(PRIarray); for (j = 0; j < PRIarray.length; j++) { if ((PRIarray[j] != PRI) && (TeamRating < PRIarray[j].Score)) { TeamRating = PRIarray[j].Score; } } TeamRating /= (PRI.Score+1.0); } if (bDebug) log("TeamRating ="@TeamRating, LogPrefix); if (bWonMatch) TeamRating *= -1; // enemy lost to rating is negative TeamStats[i].Rating += TeamRating; } if (currentGame.bTeamGame && !bIsChallenge /*&& (completedLadder(class'UT2K4LadderInfo'.default.LID_TDM))*/) { /* rating -3/4 -- increase chance -2/4 -- decrease chance -1/4 -- increase chance 4/3 ->3/4 -- increase chance 4/2 ->3/2 -- decrease chance 4/1 ->1/4 -- decrease chance */ if (TeamRating > 0) TeamRating = 0.5/TeamRating; else if (TeamRating > -0.5) TeamRating = -1-TeamRating; TeamRating = 0.5+abs(TeamRating); if (bDebug) Log("Challenge chance ="@TeamRating@(ChallengeChance*TeamRating)); if ((frand() < ChallengeChance*TeamRating )) { // challene enemyteam game tmp = string(GetChallengeGame()); if (tmp != "") SpecialEvent = "CHALLENGE"@EnemyTeam@tmp$";"$SpecialEvent; // make first because of possible message window } } if (TempbIsChallenge && ChallengeGameClass != none) doPayTeamMates = ChallengeGameClass.static.payTeamMates(self); else doPayTeamMates = true; if ( bWonMatch ) { SpecialEvent $= ";"$GameLadder.static.UpdateLadders(self,CurrentLadder); // updates LadderRungs appropriately Wins++; // calculate new balance Balance += MI.PrizeMoney; if (currentGame.bTeamGame && doPayTeamMates) PayTeamMates(MI.PrizeMoney, TeamPercentage, (TeamMateRanking.length/2), FeeIncrease); // increase fee of 50% of the best players } else { // team mates take an percentage of the current balance if (currentGame.bTeamGame && doPayTeamMates) PayTeamMates(Balance, LoserFee, (TeamMateRanking.length/3), (FeeIncrease/2)); } // Stats -- lmdBalanceChange = Balance-OldBalance; procLastMatchDetails(currentGame, PRI, MI); AddHistoryRecord(currentGame, PRI, MI); // bIsChallenge must not been reset // only create phantom matches when we entered the tournament bIsChallenge = false; // to get proper match info if (completedLadder(UT2K4GameLadder.default.LID_DM)) procPhantomMatches(ceil(float(TeamStats.length-1)/2.0 * frand())); // -- Stats if (TempbIsChallenge && ChallengeGameClass != none) ChallengeGameClass.static.PostRegisterGame(self, currentGame, PRI); if (Balance < MinBalance) { Balance = MinBalance; SpecialEvent $= ";DONATION"; } bWonMatch = false; } /** Send the player to the next match in the given ladder */ function StartNewMatch(int PickedLadder, LevelInfo CurrentLevel) { local Controller C; local string NewURL; local int i; local bool doCancelFee; lmdFreshInfo= false; bWonMatch = false; bInLadderGame = true; CurrentLadder = PickedLadder; if (PickedLadder >= 10) LastCustomCladder = UT2K4GameLadder.default.AdditionalLadders[PickedLadder - 10]; else LastCustomCladder = none; if (!bIsChallenge) ChallengeGameClass = none; NewURL = GameLadder.static.MakeURLFor(self); EnemyTeam = GetEnemyTeamName(EnemyTeam); // find enemy team, if needed if (bDebug) Log("Selected EnemyTeam ="@EnemyTeam, LogPrefix); if (!bIsChallenge) SpecialEvent = ""; // challenge class will/should do this doCancelFee = true; if (bIsChallenge && (ChallengeGameClass != none)) doCancelFee = ChallengeGameClass.static.payTeamMates(self); // calculate lamer forfeitfee TeamMateRanking.length = 0; if (doCancelFee) { for (i = 0; i < GetNumTeammatesForMatch(); i++) { TeamMateRanking.length = TeamMateRanking.length+1; TeamMateRanking[TeamMateRanking.length-1].BotID = GetBotPosition(PlayerTeam[PlayerLineup[i]]); } ForFeitFee = PayTeamMates(Balance, LoserFee); if (bDebug) log("ForFeitFee ="@ForFeitFee); } else ForFeitFee = 0; CurrentLevel.Game.SavePackage(PackageName); // open game for ( C=currentLevel.ControllerList; C!=None; C=C.NextController ) { if ( PlayerController(C) != None ) { PlayerController(C).ConsoleCommand("START"@NewURL); return; } } Warn("No local player controller found"); } /** Will be called in case of a cheat */ function ReportCheat(PlayerController Cheater, string cheat) { local string s; s = msgCheater; if (Cheater != none) { Cheater.ClearProgressMessages(); Cheater.SetProgressTime(6); Cheater.SetProgressMessage(0, s, class'Canvas'.Static.MakeColor(255,0,0)); } if (cheat != "") s @= "Player used cheat:"@cheat; Log(s, LogPrefix); bCheater = true; } /** return true of the Cheat flag has been set */ function bool IsCheater() { return bCheater; } /** never allow team change unless we're god */ function bool CanChangeTeam(Controller Other, int NewTeam) { if (Other.bGodMode) return true; return ( !Other.Level.Game.GameReplicationInfo.bMatchHasBegun && (Other.PlayerReplicationInfo != None) && (Other.PlayerReplicationInfo.Team == None) ); } /** Overwritten to get alt matches */ function MatchInfo GetMatchInfo(int ladder, int rung) { local int i; if ( bIsChallenge ) return ChallengeInfo; if ( UT2K4GameLadder != none ) { i = GetSelectedLevel(ladder, rung); if (i > -1) return UT2K4GameLadder.static.GetUT2K4MatchInfo(ladder, rung, i, true); else return UT2K4GameLadder.static.GetUT2K4MatchInfo(ladder, rung, AltPath); } else { Warn("UT2K4GameLadder == none"); return none; } } /** return a selected UT2K4MatchInfo record */ function UT2K4MatchInfo GetSelectedMatchInfo(int ladder, int rung, int selection, optional bool bOrig) { if ( UT2K4GameLadder != none ) { if (bOrig) return UT2K4GameLadder.static.GetUT2K4MatchInfo(ladder, rung, AltPath); else return UT2K4GameLadder.static.GetUT2K4MatchInfo(ladder, rung, selection, true); } Warn("UT2K4GameLadder == none"); return none; } /** check if there is an alternative level */ function bool HasAltLevel(int ladder, int rung) { if ( UT2K4GameLadder != none ) return UT2K4GameLadder.static.HasAltLevel(ladder, rung); Warn("UT2K4GameLadder == none"); return false; } /** get the alternative match ID */ function byte GetAltLevel(int ladder, int rung) { if ( UT2K4GameLadder != none ) return UT2K4GameLadder.static.GetAltLevel(ladder, rung, AltPath, GetSelectedLevel(ladder, rung)); Warn("UT2K4GameLadder == none"); return -1; } /** Get the friendly game type name */ function string GetMatchDescription() { local int i; local array<CacheManager.GameRecord> gr; if ( bIsChallenge ) { class'CacheManager'.static.GetGameTypeList(gr); for (i = 0; i < gr.length; i++) { if (gr[i].classname ~= ChallengeInfo.GameType) return gr[i].GameName; } return ""; } return GameLadder.static.GetMatchDescription(self); } /** return number of teammates needed for currently selected match assumes player team always gets an odd player */ function int GetNumTeammatesForMatch() { local MatchInfo M; if ( bIsChallenge ) M = ChallengeInfo; else M = GameLadder.static.GetCurrentMatchInfo(self); return GetNumTeammatesForMatchInfo(m); } /** return number of teammates needed for the provided assumes player team always gets an odd player */ function int GetNumTeammatesForMatchInfo(MatchInfo M) { if ( !IsTeamGametype(M.GameType) ) return 0; else return M.NumBots / 2; } /** return true if it's a team game type */ function bool IsTeamGametype(string gametype) { local CacheManager.GameRecord GR; if (gametype == "") return false; GR = class'CacheManager'.static.GetGameRecord(gametype); return GR.bTeamGame; } /** return the length of a selected ladder */ function int LengthOfLadder(int LadderId) { if (GameLadder != none) { return GameLadder.static.LengthOfLadder(LadderId); } else { Warn("PC Load Letter"); return -1; } } /** return the maximum size of a team that you manage */ function int GetMaxTeamSize() { return MaxTeamSize; } /** Enable a ladder, this makes sure a ladder is not reset Special case, ladderid=-1 this will set all ladders except the championship */ function enableLadder(int ladderId) { if (ladderId > LadderProgress.length) return; if (ladderId == -1) { enableLadder(UT2K4GameLadder.default.LID_DM); // DM enableLadder(UT2K4GameLadder.default.LID_TDM); // TDM enableLadder(UT2K4GameLadder.default.LID_CTF); // CTF enableLadder(UT2K4GameLadder.default.LID_BR); // BR enableLadder(UT2K4GameLadder.default.LID_DOM); // DDOM enableLadder(UT2K4GameLadder.default.LID_AS); // AS } else { if (LadderProgress[ladderId] == -1) LadderProgress[ladderId] = 0; } } /** get the progres of a custom ladder */ function int GetCustomLadderProgress(string LadderName) { local int i; i = GetCustomLadder(LadderName); if (i == -1) return -1; return CustomLadders[i].progress; } /** set the progress of a custom ladder */ function SetCustomLadderProgress(string LadderName, int increase) { local int i; i = GetCustomLadder(LadderName); if (i == -1) return; CustomLadders[i].progress += increase; } /** add a new custom ladder */ function RegisterCustomLadder(string LadderName) { if (GetCustomLadder(LadderName) > -1) return; CustomLadders.length = CustomLadders.length+1; CustomLadders[CustomLadders.length-1].LadderClass = LadderName; CustomLadders[CustomLadders.length-1].progress = 0; } /** return the id of a custom ladder */ function int GetCustomLadder(string LadderName) { local int i; for (i = 0; i < CustomLadders.length; i++) { if (CustomLadders[i].LadderClass ~= LadderName) return i; } return -1; } /** add teammate to the next available position on the team return false if not added because already on team or no room assumes it's a legal player record */ function bool AddTeammate(string botname) { local int i; if ( botname == "" ) return false; for ( i=0; i < GetMaxTeamSize(); i++ ) { if ( i >= PlayerTeam.Length || PlayerTeam[i] == "" ) { Playerteam[i] = botname; i = GetBotPosition(botname, true); BotStats[i].FreeAgent = false; BotStats[i].TeamId = -1; if (bDebug) log("Added team mate:"@botname, LogPrefix); return true; } if ( PlayerTeam[i] ~= botname ) { // already on team return false; } } return false; // never found space } /** remove teammate from the team return false if not removed because not on team */ function bool ReleaseTeammate(string botname) { local int i, j; if ( botname == "" ) return false; for ( i=0; i < GetMaxTeamSize(); i++ ) { if ( PlayerTeam[i] ~= botname ) { // player is on team, shuffle list for ( j=i; j<PlayerTeam.Length-1; j++ ) { PlayerTeam[j] = PlayerTeam[j+1]; } PlayerTeam[PlayerTeam.Length-1] = ""; j = GetBotPosition(botname, true); BotStats[j].FreeAgent = true; BotStats[j].TeamId = -1; if (bDebug) log("Released team mate:"@botname, LogPrefix); return true; } } return false; // never found botname } /** Return true if the bot is a teammate */ function bool IsTeammate(string botname) { local int i; for ( i=0; i < GetMaxTeamSize(); i++ ) { if ( PlayerTeam[i] ~= botname ) return true; } return false; } /** returns the friendly name of the gametype selected */ function string GetLadderDescription(int LadderId, optional int MatchId) { return UT2K4GameLadder.static.GetLadderDescription(LadderId, MatchId); } /** return true when the ladder has been completed */ function bool completedLadder(int LadderId) { return LadderProgress[ladderId] >= LengthOfLadder(LadderId); } /** return true when the ChampionshipLadder is within reach*/ function bool openChampionshipLadder() { return completedLadder(UT2K4GameLadder.default.LID_DOM) && completedLadder(UT2K4GameLadder.default.LID_CTF) && completedLadder(UT2K4GameLadder.default.LID_AS) && completedLadder(UT2K4GameLadder.default.LID_BR); } /** Rank team mates based on how they did in the last match */ function RankTeamMates(GameInfo Game, PlayerReplicationInfo Me) { local array<PlayerReplicationInfo> PRI; local int i, j; local float Rank; local TeamMateRankingRecord temp; TeamMateRanking.length = 0; Game.GameReplicationInfo.GetPRIArray(PRI); // create index for (i = 0; i < PRI.length; i++) { if ((PRI[i].Team == Me.Team) && (PRI[i] != Me)) { Rank = (PRI[i].Kills+1)/(PRI[i].Deaths+1); TeamMateRanking.length = TeamMateRanking.length+1; TeamMateRanking[TeamMateRanking.length-1].BotID = GetBotPosition(PRI[i].PlayerName, true); TeamMateRanking[TeamMateRanking.length-1].Rank = Rank; } } // sort, since it's a small array, just use selection sort for (i = 0; i < TeamMateRanking.length; i++) { for (j = i+1; j < TeamMateRanking.length; j++) { if (TeamMateRanking[i].Rank < TeamMateRanking[j].Rank) // swap { temp = TeamMateRanking[i]; TeamMateRanking[i] = TeamMateRanking[j]; TeamMateRanking[j] = temp; } } } if (bDebug) { log("Rand team mates", LogPrefix); for (i = 0; i < TeamMateRanking.length; i++) { log(i$"]"@BotStats[TeamMateRanking[i].BotID].Name@TeamMateRanking[i].Rank); } } } /** Pay out the participating team mates and increase their fee A percentage of the match earnings is added/removed from their fee IncreaseFeeOf = number of team mates to pay updateFee = percentage to increase the fee Return the total payment */ function float PayTeamMates(int Money, float FeeModifier, optional int IncreaseFeeOf, optional float updateFee) { local int i, botid; local float fee, totalFee; totalFee = 0; PayCheck.length = TeamMateRanking.Length; for (i = 0; i < TeamMateRanking.Length; i++) { botid = TeamMateRanking[i].BotID; fee = GetBotPrice(, botid) * FeeModifier; // Bonus: MatchPrize * MaxMatchBonus * Rank fee += Money * MatchBonus * ((TeamMateRanking.Length - i) / TeamMateRanking.Length); PayCheck[i].BotId = BotId; PayCheck[i].Payment = Fee; if (bDebug) log("Paycheck: "$i$"]"@BotStats[PayCheck[i].BotID].Name@PayCheck[i].Payment); balance -= Fee; totalFee += Fee; //Log("UT2K4GameProfile::PayTeamMates() - "@PlayerTeam[PlayerLineup[i]]@"earns"@fee, LogPrefix); } // increase payment of IncreaseFeeOf best team mates IncreaseFeeOf = TeamMateRanking.length-Min(IncreaseFeeOf, TeamMateRanking.length); for (i = TeamMateRanking.length-1; i >= IncreaseFeeOf; i--) { GetBotPrice(, TeamMateRanking[i].BotId, updateFee); if (bDebug) log("Increase fee: "$i$"]"@BotStats[TeamMateRanking[i].BotID].Name@updateFee); } return totalFee; } /** Find the price of this player If increase > 1 increase the fee with that amouth if 1 > increase > 0 multiply the fee with that amouth if increase == 0 do nothing */ function int GetBotPrice(optional string botname, optional int botid, optional float increase, optional bool bAdd) { if (botname != "") botid = GetBotPosition(botname, bAdd); if ((botid == -1) || (botid > BotStats.length)) return -1; if (increase > 1) BotStats[botid].Price += increase; else if (increase > 0) BotStats[botid].Price *= (1+increase); return BotStats[botid].Price; } /** return the position of the bot in the botstats array */ function int GetBotPosition(string botname, optional bool bAdd) { local int i; for (i = 0; i < BotStats.length; i++) { if (BotStats[i].Name ~= botname) return i; } if (bAdd) { //log("UT2K4GameProfile::GetBotPosition() - adding bot:"@botname, LogPrefix); BotStats.length = i+1; BotStats[i].Name = botname; BotStats[i].Price = class'xUtil'.static.GetSalaryFor(class'xUtil'.static.FindPlayerRecord(botname)); BotStats[i].Health = 100; BotStats[i].FreeAgent = true; BotStats[i].TeamId = -1; return i; } return -1; } /** Find the worst team mate(s) and injure it Only one injury is supported */ function InjureTeamMate(optional int Number) { local int i; if (Number <= 0) Number = 1; Number = TeamMateRanking.length-Min(Number, TeamMateRanking.length); for (i = TeamMateRanking.length-1; i >= Number; i--) { if (FRand() > InjuryChance) continue; // injury at least 5% // injury not more than 75% // player did bad = rank is low (kills/deaths) BotStats[TeamMateRanking[i].BotID].Health = min(TeamMateRanking[i].Rank*25, 60)+25+(10*frand()); LastInjured = TeamMateRanking[i].BotID; if (bDebug) log("InjureTeamMate ="@BotStats[TeamMateRanking[i].BotID].Name@"got injured, health"@BotStats[TeamMateRanking[i].BotID].Health$"%", LogPrefix); } } /** Returns true when the player has a full team */ function bool HasFullTeam() { local int i; for (i = 0; i < GetMaxTeamSize(); i++) { if (PlayerTeam[i] == "") return false; } return true; } /** Return the team name based on a magic string A magic string starts with a ';', if not asume it's a real team name */ function string GetEnemyTeamName(string MagicString) { local array<string> parts, teams; local class<UT2K4RosterGroup> RGclass; local float X, mod; local int i, j; if (Left(MagicString, 1) != ";") return MagicString; if (Split(MagicString, ";", parts) < 3) { Warn("invalid magic string:"@MagicString); return ""; } RGclass = class<UT2K4RosterGroup>(DynamicLoadObject(parts[1], class'Class')); if (RGclass == none) { Warn("Invalid team roster class:"@parts[1]); return ""; } teams.length = 0; // final is the best team but set statically for each profile at the end if ((parts[2] ~= "final") && (FinalEnemyTeam != "")) { return FinalEnemyTeam; } if ((parts[2] ~= "least") || (parts[2] ~= "most")) // least/most played with this team { if (parts[2] ~= "most") mod = -1; else mod = 1; X = mod*MaxInt; for (i = 0; i < RGclass.default.Rosters.length; i++) { j = GetTeamPosition(RGclass.default.Rosters[i], true); if ((TeamStats[j].Matches*mod) == X) // same, so add { teams[teams.length] = RGclass.default.Rosters[i]; } else if ((TeamStats[j].Matches*mod) < X) // reset list { X = TeamStats[j].Matches*mod; teams.length = 1; teams[0] = RGclass.default.Rosters[i]; } } } else if ((parts[2] ~= "best") || (parts[2] ~= "worst") || (parts[2] ~= "final")) // best/worst team you played against { if (parts[2] ~= "worst") mod = -1; else mod = 1; X = mod*MaxInt*-1; for (i = 0; i < RGclass.default.Rosters.length; i++) { j = GetTeamPosition(RGclass.default.Rosters[i], true); if ((TeamStats[j].Rating*mod) == X) // same, so add { teams[teams.length] = RGclass.default.Rosters[i]; } else if ((TeamStats[j].Rating*mod) > X) // reset list { X = TeamStats[j].Rating*mod; teams.length = 1; teams[0] = RGclass.default.Rosters[i]; } } } else if (parts[2] ~= "random") { teams = RGclass.default.Rosters; } else { Warn("unsupported magic string:"@parts[2]); } if (teams.length == 0) { X = rand(RGclass.default.Rosters.length); Warn("empty team list, will use:"@RGclass.default.Rosters[X]); return RGclass.default.Rosters[X]; } if (parts[2] ~= "final") // set final team { FinalEnemyTeam = teams[rand(teams.length)]; return FinalEnemyTeam; } return teams[rand(teams.length)]; // return a random team } /** Find the position of this team in the list */ function int GetTeamPosition(string teamname, optional bool bAdd) { local int j, i, k; local class<UT2K4TeamRoster> tr; for (j = 0; j < TeamStats.length; j++) { if (TeamStats[j].Name ~= teamname) return j; } if (bAdd) // team not found, add it { //log("UT2K4GameProfile::GetTeamPosition() - adding team:"@teamname, LogPrefix); TeamStats.length = j+1; TeamStats[j].Name = teamname; TeamStats[j].Matches = 0; TeamStats[j].Won = 0; // Add ream bots tr = class<UT2K4TeamRoster>(DynamicLoadObject(teamname, class'Class')); TeamStats[j].Level = tr.default.TeamLevel; for (i = 0; i < tr.default.RosterNames.length; i++) { k = GetBotPosition(tr.default.RosterNames[i], true); BotStats[k].TeamId = j; BotStats[k].FreeAgent = false; // default not free } return j; } return -1; } /** Generate stats for the last match, all except the balance change */ function procLastMatchDetails(GameInfo currentGame, PlayerReplicationInfo PRI, UT2K4MatchInfo MI) { local array<PlayerReplicationInfo> PRIArray; local int i; lmdFreshInfo= true; lmdbChallengeGame = bIsChallenge; lmdTeamGame = currentGame.bTeamGame; lmdWonMatch = bWonMatch; lmdEnemyTeam = EnemyTeam; lmdGameType = currentGame.GameName; lmdGameTime = currentGame.Level.TimeSeconds-currentGame.StartTime; lmdMap = Left(string(currentGame.Level), InStr(string(currentGame.Level), ".")); if (PRI.Team != none) lmdMyTeam = PRI.Team.TeamIndex; else lmdMyTeam = 0; if (MI != none) { lmdPrizeMoney = MI.PrizeMoney; } else { lmdPrizeMoney = 0; } lmdInjury = LastInjured; if (lmdInjury > -1) { lmdInjuryHealth = BotStats[lmdInjury].Health; lmdInjuryTreatment = int(round((100-lmdInjuryHealth)*BotStats[lmdInjury].Price/100*InjuryTreatment)); } currentGame.GameReplicationInfo.GetPRIArray(PRIArray); PlayerMatchDetails.Length = PRIArray.Length; for (i = 0; i < PRIArray.Length; i++) { PlayerMatchDetails[i].ID = PRIArray[i].PlayerID; PlayerMatchDetails[i].Name = PRIArray[i].PlayerName; PlayerMatchDetails[i].Kills = PRIArray[i].Kills; //PlayerMatchDetails[i].Score = PRIArray[i].GoalsScored; PlayerMatchDetails[i].Score = PRIArray[i].Score; // use score instead PlayerMatchDetails[i].Deaths = PRIArray[i].Deaths; if (PRIArray[i].Team != none) PlayerMatchDetails[i].Team = PRIArray[i].Team.TeamIndex; else if (PRIArray[i] == PRI) PlayerMatchDetails[i].Team = 0; else { PlayerMatchDetails[i].Team = -1; } PlayerMatchDetails[i].SpecialAwards.Length = 0; if (TeamPlayerReplicationInfo(PRIArray[i]) != none) { if ( TeamPlayerReplicationInfo(PRIArray[i]).flakcount >= sae_flackmonkey ) { PlayerMatchDetails[i].SpecialAwards[PlayerMatchDetails[i].SpecialAwards.length] = msgSpecialAward[0]; if (PRIArray[i] == PRI) SpecialAwards[0]++; } if ( TeamPlayerReplicationInfo(PRIArray[i]).combocount >= sae_combowhore ) { PlayerMatchDetails[i].SpecialAwards[PlayerMatchDetails[i].SpecialAwards.length] = msgSpecialAward[1]; if (PRIArray[i] == PRI) SpecialAwards[1]++; } if ( TeamPlayerReplicationInfo(PRIArray[i]).headcount >= sae_headhunter ) { PlayerMatchDetails[i].SpecialAwards[PlayerMatchDetails[i].SpecialAwards.length] = msgSpecialAward[2]; if (PRIArray[i] == PRI) SpecialAwards[2]++; } if ( TeamPlayerReplicationInfo(PRIArray[i]).ranovercount >= sae_roadrampage ) { PlayerMatchDetails[i].SpecialAwards[PlayerMatchDetails[i].SpecialAwards.length] = msgSpecialAward[3]; if (PRIArray[i] == PRI) SpecialAwards[3]++; } } if ( PRIArray[i].GoalsScored >= sae_hattrick ) { PlayerMatchDetails[i].SpecialAwards[PlayerMatchDetails[i].SpecialAwards.length] = msgSpecialAward[4]; if (PRIArray[i] == PRI) SpecialAwards[4]++; } if (( PRIArray[i].Deaths == sae_untouchable ) && !lmdTeamGame) { PlayerMatchDetails[i].SpecialAwards[PlayerMatchDetails[i].SpecialAwards.length] = msgSpecialAward[5]; if (PRIArray[i] == PRI) SpecialAwards[5]++; } } } /** Create information about other matches played by other teams */ function procPhantomMatches(int games) { local array<int> MatchHistory; local array<TeamStatsRecord> PhantomEnemies; local UT2K4MatchInfo MI; local int i, j, n1, n2; PhantomMatches.Length = games; if (games == 0) return; // to save time PhantomEnemies = TeamStats; for (i = 0; i < PhantomEnemies.length; i++) { if (PhantomEnemies[i].Name ~= EnemyTeam) { PhantomEnemies.Remove(i, 1); break; } } MatchHistory[MatchHistory.length] = CurrentLadder*100+CurrentMenuRung; // remove own match while (games > 0) { if (PhantomEnemies.length <= 1) break; // no more enemies // find a random match do { PhantomMatches[games-1].LadderId = UT2K4GameLadder.static.GetRandomLadder(); PhantomMatches[games-1].MatchId = rand(LengthOfLadder(PhantomMatches[games-1].LadderId)); n1 = PhantomMatches[games-1].LadderId*100+PhantomMatches[games-1].MatchId; for (j = 0; j < MatchHistory.length; j++) { if (MatchHistory[j] == n1) break; } } until (j >= MatchHistory.length); MatchHistory[MatchHistory.length] = n1; // add this item MI = UT2K4MatchInfo(GetMatchInfo(PhantomMatches[games-1].LadderId, PhantomMatches[games-1].MatchId)); // find team 1 j = rand(PhantomEnemies.length); PhantomMatches[games-1].Team1 = GetTeamPosition(PhantomEnemies[j].Name); n1 = PhantomEnemies[j].Level; PhantomEnemies.Remove(j, 1); // find team 2 j = rand(PhantomEnemies.length); PhantomMatches[games-1].Team2 = GetTeamPosition(PhantomEnemies[j].Name); n2 = PhantomEnemies[j].Level; PhantomEnemies.Remove(j, 1); // normalize levels, -1 -> equal team strength if (n1 == -1) n1 = max(n2, 0); if (n2 == -1) n2 = max(n1, 0); n1++; n2++; // calculate the odds that team1 wins if (rand(n1+n2) >= n2) { n2 = PhantomMatches[games-1].Team1; PhantomMatches[games-1].ScoreTeam1 = MI.GoalScore; PhantomMatches[games-1].ScoreTeam2 = (MI.GoalScore-1)*frand(); } else { n2 = PhantomMatches[games-1].Team2; PhantomMatches[games-1].ScoreTeam1 = (MI.GoalScore-1)*frand(); PhantomMatches[games-1].ScoreTeam2 = MI.GoalScore; } PhantomMatches[games-1].GameTime = (PhantomMatches[games-1].ScoreTeam1+1)*(PhantomMatches[games-1].ScoreTeam2+1)+(frand()*MI.PrizeMoney); // n2 is set to the winning team RandomIncreaseBotFee(n2, FeeIncrease/2); games--; } } /** Increase fee of a few bots that belong to TeamId */ function RandomIncreaseBotFee(int TeamId, float updateFee) { local int i; for (i = 0; i < Botstats.length; i++) { if ((BotStats[i].TeamId == TeamId) && (frand() > 0.5)) { GetBotPrice(, i, updateFee); } } } /** converts money to a formatted string */ static function string MoneyToString(int money) { local string res, tmp, prefix; if (money == 0) return "0"@default.msgCredits; if (money < 0) { prefix = "-"; money *= -1; } else prefix = ""; res = ""; if (money == 1) return prefix$"1"@default.msgCredit; while (money > 0) { if (tmp != "") res = ","$res; tmp = string(int(money%1000)); money = money / 1000; if (money > 0) tmp = Right("00"$tmp,3); res = tmp$res; } return prefix$res@default.msgCredits; } /** return the stored player id, use this to check a profile before loading it */ function string StoredPlayerID() { return PlayerIDHash; } /** return if a profile has been locked out for character unlocking */ function bool IsLocked() { return bLocked; } /** return the level ID selected, or -1 if no selection */ function int GetSelectedLevel(int ladder, int rung) { local int i; for (i = 0; i < LevelRoute.length; i++) { if (LevelRoute[i].ladder == ladder && LevelRoute[i].rung == rung) return LevelRoute[i].selection; } return -1; } /** set a level selection */ function SetSelectedLevel(int ladder, int rung, byte id) { local int i; for (i = 0; i < LevelRoute.length; i++) { if (LevelRoute[i].ladder == ladder && LevelRoute[i].rung == rung) break; } if (i <= LevelRoute.length) LevelRoute.length = i+1; LevelRoute[i].ladder = ladder; LevelRoute[i].rung = rung; LevelRoute[i].selection = id; } /** remove a previous set selection */ function ResetSelectedLevel(int ladder, int rung) { local int i; for (i = 0; i < LevelRoute.length; i++) { if (LevelRoute[i].ladder == ladder && LevelRoute[i].rung == rung) { LevelRoute.remove(i, 1); return; } } } /** get the alternative team roster */ function bool GetAltTeamRoster(string TeamRosterName, out array<string> result) { local int i; result.length = 0; if (TeamRosterName == "") return false; //Log("GetAltTeamRoster"@TeamRosterName); for (i = 0; i < AltTeamRoster.length; i++) { if (AltTeamRoster[i].name ~= TeamRosterName) { result = AltTeamRoster[i].roster; return true; } } return false; } /** set the alternative team roster */ function SetAltTeamRoster(string TeamRosterName, array<string> NewRoster) { local int i; if (TeamRosterName == "") return; for (i = 0; i < AltTeamRoster.length; i++) { if (AltTeamRoster[i].name ~= TeamRosterName) break; } if (AltTeamRoster.length <= i) { AltTeamRoster.length = i+1; AltTeamRoster[i].name = TeamRosterName; } AltTeamRoster[i].roster = NewRoster; } /** Adds the current match info to the history table */ function AddHistoryRecord(GameInfo Game, PlayerReplicationInfo PRI, UT2K4MatchInfo MI) { local int i, j, n; local array<PlayerReplicationInfo> PRIArray; local string tmp; i = FightHistory.length; FightHistory.length = FightHistory.length+1; FightHistory[i].Date[0] = Game.Level.Year; FightHistory[i].Date[1] = Game.Level.Month; FightHistory[i].Date[2] = Game.Level.Day; FightHistory[i].Time[0] = Game.Level.Hour; FightHistory[i].Time[1] = Game.Level.Minute; FightHistory[i].Level = Left(string(Game.Level), InStr(string(Game.Level), ".")); FightHistory[i].GameType = Game.GameName; FightHistory[i].EnemyTeam = EnemyTeam; if (MI != none) FightHistory[i].PriceMoney = MI.PrizeMoney; FightHistory[i].BalanceChange = lmdBalanceChange; FightHistory[i].BonusMoney = lmdTotalBonusMoney; FightHistory[i].GameTime = Game.Level.TimeSeconds-Game.StartTime; FightHistory[i].WonGame = bWonMatch; FightHistory[i].TeamGame = Game.bTeamGame; if (Game.bTeamGame) { Game.GameReplicationInfo.GetPRIArray(PRIArray); tmp = ""; for (j = 0; j < PRIArray.Length; j++) { if (PRIArray[j].Team.TeamIndex == ((PRI.Team.TeamIndex+1) % 2)) { if (tmp != "") tmp $= ", "; tmp $= PRIArray[j].PlayerName; } } FightHistory[i].TeamScore[0] = TeamGame(Game).Teams[(PRI.Team.TeamIndex+1) % 2].Score; FightHistory[i].TeamLayout[0] = tmp; tmp = ""; for (j = 0; j < PRIArray.Length; j++) { if (PRIArray[j].Team.TeamIndex == PRI.Team.TeamIndex) { if (tmp != "") tmp $= ", "; tmp $= PRIArray[j].PlayerName; } } FightHistory[i].TeamScore[1] = TeamGame(Game).Teams[PRI.Team.TeamIndex].Score; FightHistory[i].TeamLayout[1] = tmp; } for (j = 0; j < PlayerMatchDetails.length; j++) { if (PlayerMatchDetails[j].ID == PRI.PlayerID) { FightHistory[i].MyScore = PlayerMatchDetails[j].Score; FightHistory[i].MyKills = PlayerMatchDetails[j].Kills; FightHistory[i].MyDeaths = PlayerMatchDetails[j].Deaths; for (n = 0; n < PlayerMatchDetails[j].SpecialAwards.length; n++) { if (FightHistory[i].MyAwards != "") FightHistory[i].MyAwards $= ", "; FightHistory[i].MyAwards $= PlayerMatchDetails[j].SpecialAwards[n]; } break; } } if (bIsChallenge) { FightHistory[i].MatchData = msgChallengeGame$";"$ChallengeGameClass.default.ChallengeName; ChallengeGameClass.static.AddHistoryRecord(self, i, Game, PRI, MI); } else if (CurrentLadder >= 10) { FightHistory[i].MatchData = msgAdditionalLadder$";"$LastCustomCladder.default.LadderName@msgMatch@CurrentMenuRung; LastCustomCladder.static.AddHistoryRecord(self, i, Game, PRI, MI); } else { FightHistory[i].MatchData = msgLadderGame$";"; switch (CurrentLadder) { case UT2K4GameLadder.default.LID_DM: case UT2K4GameLadder.default.LID_TDM: case UT2K4GameLadder.default.LID_CTF: case UT2K4GameLadder.default.LID_DOM: case UT2K4GameLadder.default.LID_BR: case UT2K4GameLadder.default.LID_AS: FightHistory[i].MatchData $= GetLadderDescription(CurrentLadder); break; case UT2K4GameLadder.default.LID_CHAMP: FightHistory[i].MatchData $= msgChampionship; } FightHistory[i].MatchData @= msgMatch@CurrentMenuRung; } } /** return a random or selected challenge game */ function class<ChallengeGame> GetChallengeGame(optional string ClassName) { return UT2K4GameLadder.static.GetChallengeGame(ClassName, self); } /** return the minimal fee for x team members, only uses team mates that are healthy */ function float getMinimalTeamFee(int members, optional bool bIgnoreHealth) { local array<int> fees; local int i, j, n, tmp; for (i = 0; i < GetMaxTeamSize(); i++) { j = GetBotPosition(PlayerTeam[i]); if ((j > -1) && ((BotStats[j].Health >= 100) || bIgnoreHealth)) { tmp = BotStats[j].Price*LoserFee; for (n = 0; n < fees.Length; n++) { if (fees[n] > tmp) { fees.Insert(n, 1); fees[n] = tmp; break; } } if (n == fees.length) { fees.length = fees.length+1; fees[fees.length-1] = tmp; } } } if (fees.length < members) return 2147483647; j = 0; for (i = 0; i < members; i++) { j += fees[i]; } return j; } /** get the minimal fee for this match, based on the entry fee for the match and the minimal fee to pay out to your team mates if you lose. If you don't have enough team mates the result is negative */ function int getMinimalEntryFeeFor(UT2K4MatchInfo MI, optional bool bIgnoreHealth) { local int res; res = MI.EntryFee; if (IsTeamGametype(MI.GameType)) { res += getMinimalTeamFee(MI.NumBots / 2, bIgnoreHealth); } if (bDebug) log("getMinimalEntryFeeFor ="@res); return res; } function UpgradeGP() { local int i; if (revision == 0) { log("Revision upgrade to 1", LogPrefix); MinBalance = 75; InjuryChance = 0.30+(BaseDifficulty / 30); ChallengeChance = 0.30+(BaseDifficulty / 30); FeeIncrease = 0.02+(BaseDifficulty / 300); TeamPercentage = 0.35+(BaseDifficulty / 30); MatchBonus = 0.03+(TeamPercentage / 10); revision = 1; } if (revision == 1) { log("Revision upgrade to 2", LogPrefix); TeamPercentage = 0.25+(BaseDifficulty / 30); MatchBonus = 0.05+(TeamPercentage / 10); revision = 2; } if (revision == 2) { log("Revision upgrade to 3", LogPrefix); InjuryTreatment = 0.75+(BaseDifficulty / 50); MapChallengeCost = 0.10+(BaseDifficulty / 100); revision = 3; } if (revision == 3) { log("Revision upgrade to 4", LogPrefix); for (i = TeamStats.Length-1; i >= 0; i--) { if (TeamStats[i].Name == "") TeamStats.Remove(i, 1); } for (i = BotStats.Length-1; i >= 0; i--) { if (BotStats[i].Name == "") BotStats.Remove(i, 1); } revision = 4; } if (revision == 4) { log("Revision upgrade to 5", LogPrefix); if (bCompleted && !bLocked && !bCheater) { if (completedLadder(UT2K4GameLadder.default.LID_CHAMP)) { bCompleted = false; SpecialEvent = "COMPLETED CHAMP"; } } revision = 5; } } defaultproperties { Revision=5 LadderProgress(0)=1 LadderProgress(1)=-1 LadderProgress(2)=-1 LadderProgress(3)=-1 LadderProgress(4)=-1 LadderProgress(5)=-1 LadderProgress(6)=-1 MaxTeamSize=5 Balance=250 MinBalance=75 TeamPercentage=0.250000 MatchBonus=0.050000 LoserFee=0.100000 FeeIncrease=0.020000 InjuryChance=0.300000 LastInjured=-1 InjuryTreatment=0.750000 ChallengeChance=0.300000 ChallengeInfo=UT2K4MatchInfo'XGame.UT2K4GameProfile.GPCHALINFO' LoginMenuClass="GUI2K4.UT2K4SinglePlayerLoginMenu" LogPrefix="SinglePlayer" SpreeBonus(0)=20 SpreeBonus(1)=60 SpreeBonus(2)=120 SpreeBonus(3)=200 SpreeBonus(4)=300 SpreeBonus(5)=420 MultiKillBonus(0)=10 MultiKillBonus(1)=30 MultiKillBonus(2)=60 MultiKillBonus(3)=100 MultiKillBonus(4)=150 MultiKillBonus(5)=210 MultiKillBonus(6)=280 msgSpecialAward(0)="Flak Monkey" msgSpecialAward(1)="Combo Whore" msgSpecialAward(2)="Head Hunter" msgSpecialAward(3)="Road Rampage" msgSpecialAward(4)="Hat Trick" msgSpecialAward(5)="Untouchable" sae_flackmonkey=15 sae_combowhore=15 sae_headhunter=15 sae_roadrampage=10 sae_hattrick=3 msgCheater="CHEATER!!!" msgCredits="credits" msgCredit="credit" MapChallengeCost=0.100000 msgChallengeGame="Challenge game" msgAdditionalLadder="Additional ladder game" msgMatch="match" msgLadderGame="Ladder game" msgChampionship="Championship" bShowDetails=True GameLadderName="xGame.UT2K4LadderInfo" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |