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 |
class LadderInfo extends Object abstract; /* * LadderInfo contains all the information needed to determine * the contents of each step in the single-player ladder, and * to determine what match is next in each ladder. * * author: polge * last edit: capps */ var() editinline array<MatchInfo> DMMatches; var() editinline array<MatchInfo> TDMMatches; var() editinline array<MatchInfo> DOMMatches; var() editinline array<MatchInfo> CTFMatches; var() editinline array<MatchInfo> BRMatches; var() editinline array<MatchInfo> ChampionshipMatches; const DMLadderIndex = 0; const TDMLadderIndex = 1; const DOMLadderIndex = 2; const CTFLadderIndex = 3; const BRLadderIndex = 4; const ChampionshipLadderIndex = 5; var int OpenNextLadderAtRung[5]; static function string UpdateLadders(GameProfile G, int CurrentLadder) { local string SpecialEvent; if ( G.LadderRung[CurrentLadder] > G.CurrentMenuRung ) { // they've chosen to play a match they've completed previously return ""; } // updates ladder rungs appropriately switch( CurrentLadder ) { case DMLadderIndex: /*if ( Default.OpenNextLadderAtRung[CurrentLadder] == G.LadderRung[CurrentLadder] ) { G.LadderRung[TDMLadderIndex] = 0; SpecialEvent = "TDM OPENED"; } else if ( G.LadderRung[CurrentLadder] >= Default.DMMatches.Length ) { G.LadderRung[CurrentLadder] = Default.DMMatches.Length; SpecialEvent = "DM COMPLETE"; } else */ SpecialEvent = Default.DMMatches[G.LadderRung[CurrentLadder]].SpecialEvent; break; case TDMLadderIndex: /*if ( G.LadderRung[CurrentLadder] >= Default.TDMMatches.Length ) { G.LadderRung[CurrentLadder] = Default.TDMMatches.Length; SpecialEvent = "TDM COMPLETE"; } else if ( Default.OpenNextLadderAtRung[CurrentLadder] == G.LadderRung[CurrentLadder] ) { G.LadderRung[DOMLadderIndex] = 0; SpecialEvent = "DOM OPENED"; } else */ SpecialEvent = Default.TDMMatches[G.LadderRung[CurrentLadder]].SpecialEvent; break; case DOMLadderIndex: /*if ( G.LadderRung[CurrentLadder] >= Default.DOMMatches.Length ) { G.LadderRung[CurrentLadder] = Default.DOMMatches.Length; SpecialEvent = "DOM COMPLETE"; } else if ( Default.OpenNextLadderAtRung[CurrentLadder] == G.LadderRung[CurrentLadder] ) { G.LadderRung[CTFLadderIndex] = 0; SpecialEvent = "CTF OPENED"; } else */ SpecialEvent = Default.DOMMatches[G.LadderRung[CurrentLadder]].SpecialEvent; break; case CTFLadderIndex: /*if ( G.LadderRung[CurrentLadder] >= Default.CTFMatches.Length ) { G.LadderRung[CurrentLadder] = Default.CTFMatches.Length; SpecialEvent = "CTF COMPLETE"; } else if ( Default.OpenNextLadderAtRung[CurrentLadder] == G.LadderRung[CurrentLadder] ) { G.LadderRung[BRLadderIndex] = 0; SpecialEvent = "BR OPENED"; } else */ SpecialEvent = Default.CTFMatches[G.LadderRung[CurrentLadder]].SpecialEvent; break; case BRLadderIndex: /*if ( G.LadderRung[CurrentLadder] >= Default.BRMatches.Length ) { G.LadderRung[CurrentLadder] = Default.BRMatches.Length; SpecialEvent = "BR COMPLETE"; } else */ SpecialEvent = Default.BRMatches[G.LadderRung[CurrentLadder]].SpecialEvent; break; case ChampionshipLadderIndex: /* if ( G.LadderRung[CurrentLadder] >= Default.ChampionshipMatches.Length ) { G.LadderRung[CurrentLadder] = Default.ChampionshipMatches.Length; SpecialEvent = "CHAMPIONSHIP COMPLETE"; } else */ SpecialEvent = Default.ChampionshipMatches[G.LadderRung[CurrentLadder]].SpecialEvent; break; } // open new ladder if appropriate if ( InStr (SpecialEvent, "OPENED") >= 0 ) { if ( Left (SpecialEvent, 3) == "TDM" ) { G.LadderRung[TDMLadderIndex] = 0; } else if ( Left (SpecialEvent, 3) == "CTF" ) { G.LadderRung[CTFLadderIndex] = 0; } else if ( Left (SpecialEvent, 3) == "DOM" ) { G.LadderRung[DOMLadderIndex] = 0; } else if ( Left (SpecialEvent, 2) == "BR" ) { G.LadderRung[BRLadderIndex] = 0; } } G.LadderRung[CurrentLadder] += 1; // check if championship ladder should be opened if ( (G.LadderRung[5] == -1) && (G.LadderRung[0] >= Default.DMMatches.Length) && (G.LadderRung[1] >= Default.TDMMatches.Length) && (G.LadderRung[2] >= Default.DOMMatches.Length) && (G.LadderRung[3] >= Default.CTFMatches.Length) && (G.LadderRung[4] >= Default.BRMatches.Length) ) { G.LadderRung[5] = 0; SpecialEvent = "CHAMPIONSHIP OPENED"; } return SpecialEvent; } // robust checks are in LadderInfo, returns none if not found static function MatchInfo GetMatchInfo(int ladder, int rung) { local array<MatchInfo> matcharray; if (rung < 0) { return none; } switch (ladder) { case DMLadderIndex: matcharray = Default.DMMatches; break; case TDMLadderIndex: matcharray = Default.TDMMatches; break; case DOMLadderIndex: matcharray = Default.DOMMatches; break; case CTFLadderIndex: matcharray = Default.CTFMatches; break; case BRLadderIndex: matcharray = Default.BRMatches; break; case ChampionshipLadderIndex: matcharray = Default.ChampionshipMatches; break; } if ( matcharray.Length <= 0 ) { return none; } if ( rung >= matcharray.Length ) { return matcharray[matcharray.Length-1]; } return matcharray[rung]; } static function MatchInfo GetCurrentMatchInfo(GameProfile G) { return GetMatchInfo (G.CurrentLadder, G.CurrentMenuRung); } static function string MakeURLFor(GameProfile G) { local MatchInfo M; local string URL; M = GetCurrentMatchInfo(G); if ( M == none ) { Log("SINGLEPLAYER LadderInfo::MakeURLFor MatchInfo invalid."); return ""; } G.EnemyTeam = M.EnemyTeamName; G.Difficulty = G.BaseDifficulty + M.DifficultyModifier; URL = M.LevelName$"?Name="$G.PlayerName$"?Character="$G.PlayerCharacter$"?SaveGame="$G.PackageName$M.URLString; if ( M.GoalScore != 0 ) URL = URL$"?GoalScore="$M.GoalScore; if ( M.NumBots > 0 ) URL = URL$"?NumBots="$M.NumBots; if ( M.GameType != "" ) URL = URL$"?Game="$M.GameType; URL = URL$"?Team=1"; // always blue team return URL; } // Used in menus: this is the gametype info for the next match //FIXME!! Useless and unfortunate code, must use localization mechanism //@@ LOCALIZE ME static function string GetMatchDescription (GameProfile G){ local string retval; switch (G.CurrentLadder) { case DMLadderIndex: retval = "Deathmatch"; break; case TDMLadderIndex: retval = "Team Deathmatch"; break; case DOMLadderIndex: retval = "Domination"; break; case CTFLadderIndex: retval = "Capture the Flag"; break; case BRLadderIndex: retval = "Bombing Run"; break; case ChampionshipLadderIndex: retval = "Championship Match"; break; } return retval; } // handy helper function to convert numbers to lengths static function int LengthOfLadder(int ladder) { switch (ladder) { case DMLadderIndex: return Default.DMMatches.Length; case TDMLadderIndex: return Default.TDMMatches.Length; case DOMLadderIndex: return Default.DOMMatches.Length; case CTFLadderIndex: return Default.CTFMatches.Length; case BRLadderIndex: return Default.BRMatches.Length; case ChampionshipLadderIndex: return Default.ChampionshipMatches.Length; default: return -1; } } defaultproperties { OpenNextLadderAtRung(0)=3 OpenNextLadderAtRung(1)=3 OpenNextLadderAtRung(2)=2 OpenNextLadderAtRung(3)=3 OpenNextLadderAtRung(4)=3 Begin Object Class=MatchInfo Name=CTFMatchInfo1 LevelName="CTF-Maul" EnemyTeamName="xGame.TeamIronGuard" SpecialEvent="" DifficultyModifier=0.0 GoalScore=3 URLString="?mutator=xgame.mutinstagib" MenuDescription="Instagib!" End Object CTFMatches(0)=MatchInfo'CTFMatchInfo1' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |