//============================================================================== // Exports the profile to a text file // // Written by Michiel Hendriks // (c) 2003, Epic Games, Inc. All Rights Reserved //============================================================================== class SPProfileExporter extends Object; var string ResultFile; var protected string FileName; var protected string FileExt; var protected UT2K4GameProfile GP; var protected FileLog Output; var protected LevelInfo Level; function bool Create(UT2K4GameProfile myGP, LevelInfo myLevel, optional string myFilename, optional string myExt) { GP = myGP; Level = myLevel; if (myFilename != "") filename = myFilename; filename = FormatString(filename); if (myExt != "") FileExt = MyExt; return (GP != none) && (Level != none); } function ExportProfile() { if (!(GP != none) && (Level != none)) return; Output = Level.spawn(class'FileLog'); Output.OpenLog(FileName, FileExt, true); ResultFile = Output.LogFileName; expHeader(); expBody(); expFooter(); Output.CloseLog(); } /** export the header */ protected function expHeader() { output.Logf(""); output.Logf(""); output.Logf("UT2004 Exported Single Player Details -"@GP.PackageName@""); output.Logf(""); expStyle(); output.Logf(""); output.Logf("
UT2004 Exported Profile
"); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf("
BasicAwardsLaddersBot statsTeam statsLast matchFight history
"); } /** write inline style */ protected function expStyle() { output.Logf(""); } /** export the footer */ protected function expFooter() { output.Logf(""); output.Logf(""); } /** export all the content */ protected function expBody() { expBasic(); expSprees(); expMultiKills(); expSpecialAwards(); expLadderStatus(); expBotstats(); expTeamstats(); expLastmatch(); expOtherMatches(); expHistory(); } protected function expBasic() { output.Logf("
"); output.Logf("

Profile

"); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); if (GP.IsCheater()) output.logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf("
Profile name"@GP.PackageName@"
Player name"@GP.PlayerName@"
Difficulty"@GP.BaseDifficulty@"
CHEATEDtrue
Character"@GP.PlayerCharacter@"
Team name"@GP.TeamName@"
Team members"@JoinArray(GP.PlayerTeam, "
", true)@"
Balance"@GP.MoneyToString(GP.Balance)@"
Matches"@GP.matches@"
Wins"@GP.wins@"
Kills"@GP.kills@"
Deaths"@GP.deaths@"
"); output.Logf("
"); } protected function expSprees() { output.Logf("
"); output.Logf("

Killing sprees

"); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf("
Killing Spree"@GP.spree[0]@"
Rampage"@GP.spree[1]@"
Dominating"@GP.spree[2]@"
Unstoppable"@GP.spree[3]@"
GODLIKE"@GP.spree[4]@"
WICKED SICK"@GP.spree[5]@"
"); } protected function expMultiKills() { output.Logf("

Multi kills

"); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf("
Double Kill"@GP.MultiKills[0]@"
MultiKill"@GP.MultiKills[1]@"
MegaKill"@GP.MultiKills[2]@"
UltraKill"@GP.MultiKills[3]@"
MONSTER KILL"@GP.MultiKills[4]@"
LUDICROUS KILL"@GP.MultiKills[5]@"
HOLY SHIT"@GP.MultiKills[6]@"
"); } protected function expSpecialAwards() { output.Logf("

Special awards

"); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf("
Flak Monkey"@GP.SpecialAwards[0]@"
Combo Whore"@GP.SpecialAwards[1]@"
Head Hunter"@GP.SpecialAwards[2]@"
Road Rampage"@GP.SpecialAwards[3]@"
Hat Trick"@GP.SpecialAwards[4]@"
Untouchable"@GP.SpecialAwards[5]@"
"); output.Logf("
"); } protected function expLadderStatus() { local int i; local class cl; output.Logf("
"); output.Logf("

Ladder status

"); output.Logf(""); if (GP.LadderProgress[GP.UT2K4GameLadder.default.LID_DM] > -1) output.Logf(""); else output.Logf(""); if (GP.LadderProgress[GP.UT2K4GameLadder.default.LID_TDM] > -1) output.Logf(""); else output.Logf(""); if (GP.LadderProgress[GP.UT2K4GameLadder.default.LID_CTF] > -1) output.Logf(""); else output.Logf(""); if (GP.LadderProgress[GP.UT2K4GameLadder.default.LID_BR] > -1) output.Logf(""); else output.Logf(""); if (GP.LadderProgress[GP.UT2K4GameLadder.default.LID_DOM] > -1) output.Logf(""); else output.Logf(""); if (GP.LadderProgress[GP.UT2K4GameLadder.default.LID_AS] > -1) output.Logf(""); else output.Logf(""); if (GP.LadderProgress[GP.UT2K4GameLadder.default.LID_CHAMP] > -1) output.Logf(""); else output.Logf(""); if (GP.CustomLadders.Length > 0) { output.Logf(""); for (i = 0; i < GP.CustomLadders.Length; i++) { cl = class(DynamicLoadObject(GP.CustomLadders[i].LadderClass, class'Class')); if (cl != none) { output.Logf(""); } else { output.Logf(""); } } } output.Logf("
Qualification"$(GP.LadderProgress[GP.UT2K4GameLadder.default.LID_DM]*100/GP.LengthOfLadder(GP.UT2K4GameLadder.default.LID_DM))$"%
Qualificationlocked
Team Qualification"$(GP.LadderProgress[GP.UT2K4GameLadder.default.LID_TDM]*100/GP.LengthOfLadder(GP.UT2K4GameLadder.default.LID_TDM))$"%
Team Qualificationlocked
Capture The Flag"$(GP.LadderProgress[GP.UT2K4GameLadder.default.LID_CTF]*100/GP.LengthOfLadder(GP.UT2K4GameLadder.default.LID_CTF))$"%
Capture The Flaglocked
Bombing Run"$(GP.LadderProgress[GP.UT2K4GameLadder.default.LID_BR]*100/GP.LengthOfLadder(GP.UT2K4GameLadder.default.LID_BR))$"%
Bombing Runlocked
Double Domination"$(GP.LadderProgress[GP.UT2K4GameLadder.default.LID_DOM]*100/GP.LengthOfLadder(GP.UT2K4GameLadder.default.LID_DOM))$"%
Double Dominationlocked
Assault"$(GP.LadderProgress[GP.UT2K4GameLadder.default.LID_AS]*100/GP.LengthOfLadder(GP.UT2K4GameLadder.default.LID_AS))$"%
Assaultlocked
Championship"$(GP.LadderProgress[GP.UT2K4GameLadder.default.LID_CHAMP]*100/GP.LengthOfLadder(GP.UT2K4GameLadder.default.LID_CHAMP))$"%
Championshiplocked
Additional ladders
"$cl.default.LadderName$""$(GP.CustomLadders[i].progress*100/cl.default.Matches.Length)$"%
"$GP.CustomLadders[i].LadderClass$""$GP.CustomLadders[i].progress@"matches
"); output.Logf("
"); } protected function expBotstats() { local int i; output.Logf("
"); output.Logf("

Bot stats

"); output.Logf(""); output.Logf(""); for (i = 0; i < GP.BotStats.length; i++) { output.Logf(""); } output.Logf("
NamePriceHealthTeam ID
"$GP.BotStats[i].Name$""$GP.MoneyToString(GP.BotStats[i].Price)$""$GP.BotStats[i].Health$"%"$GP.BotStats[i].TeamId$"
"); output.Logf("
"); } protected function expTeamstats() { local int i; local string tmp; output.Logf("
"); output.Logf("

Team stats

"); output.Logf(""); output.Logf(""); for (i = 0; i < GP.TeamStats.length; i++) { if (GP.TeamStats[i].Name == "") continue; output.Logf(""); } output.Logf("
IDNameMatchesLost fromRatingLevelRoster
"$i$""$getTeamName(GP.TeamStats[i].Name, tmp)$""$GP.TeamStats[i].Matches$""$GP.TeamStats[i].Won$""$GP.TeamStats[i].Rating$""$GP.TeamStats[i].Level$""$tmp$"
"); output.Logf("
"); } protected function expLastmatch() { local int i; local string tmp; output.Logf("
"); output.Logf("

Last match

"); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); if (GP.lmdInjury > -1) { output.Logf(""); output.Logf(""); output.Logf(""); } output.Logf("
Game type"$GP.lmdGameType$"
Map"$GP.lmdMap$"
Won match"$GP.lmdWonMatch$"
Game time"$(GP.lmdGameTime/60)@"minutes
Prize money"$GP.MoneyToString(GP.lmdPrizeMoney)$"
Total bonus money"$GP.MoneyToString(GP.lmdTotalBonusMoney)$"
Balance change"$GP.MoneyToString(GP.lmdBalanceChange)$"
Injured team mate"$GP.BotStats[GP.lmdInjury].Name$"
Injury health"$GP.lmdInjuryHealth$"
Injury treatment"$GP.MoneyToString(GP.lmdInjuryTreatment)$"
"); if (GP.PayCheck.length > 0) { output.Logf("

Pay check overview

"); output.Logf(""); output.Logf(""); for (i = 0; i < GP.PayCheck.length; i++) { output.Logf(""); } output.Logf("
NamePayment
"$GP.BotStats[GP.PayCheck[i].BotId].Name$""$GP.MoneyToString(GP.PayCheck[i].Payment)$"
"); } output.Logf("

Last match player overview

"); output.Logf(""); output.Logf(""); if (GP.lmdTeamGame) { output.Logf(""); for (i = 0; i < GP.PlayerMatchDetails.length; i++) { if (GP.PlayerMatchDetails[i].Team == GP.lmdMyTeam) { output.Logf(""); for (i = 0; i < GP.PlayerMatchDetails.length; i++) { if (GP.PlayerMatchDetails[i].Team != GP.lmdMyTeam) { output.Logf(""); } protected function expOtherMatches() { local int i; local string tmp; local UT2K4MatchInfo MI; if (GP.PhantomMatches.length <= 0) { output.Logf(""); return; } output.Logf("

Other tournament matches

"); output.Logf("
NameKillsScoreDeathsSpecial Awards
"$GP.TeamName$"
"$GP.PlayerMatchDetails[i].Name$""$GP.PlayerMatchDetails[i].Kills$""$GP.PlayerMatchDetails[i].Score$""$GP.PlayerMatchDetails[i].Deaths$""$JoinArray(GP.PlayerMatchDetails[i].SpecialAwards, ", ")$""$getTeamName(GP.lmdEnemyTeam, tmp)$"
"$GP.PlayerMatchDetails[i].Name$""$GP.PlayerMatchDetails[i].Kills$""$GP.PlayerMatchDetails[i].Score$""$GP.PlayerMatchDetails[i].Deaths$""$JoinArray(GP.PlayerMatchDetails[i].SpecialAwards, ", ")$""$GP.PlayerMatchDetails[i].Name$""$GP.PlayerMatchDetails[i].Kills$""$GP.PlayerMatchDetails[i].Score$""$GP.PlayerMatchDetails[i].Deaths$""$JoinArray(GP.PlayerMatchDetails[i].SpecialAwards, ", ")$"
"); for (i = 0; i < GP.PhantomMatches.length; i++) { output.Logf(""); MI = UT2K4MatchInfo(GP.getMatchInfo(GP.PhantomMatches[i].LadderId, GP.PhantomMatches[i].MatchId)); output.Logf(""); output.Logf(""); output.Logf(""); } output.Logf("
"$getTeamName(GP.TeamStats[GP.PhantomMatches[i].Team1].Name, tmp)@"vs"@getTeamName(GP.TeamStats[GP.PhantomMatches[i].Team2].Name, tmp)$"
"$GP.GetLadderDescription(GP.PhantomMatches[i].LadderId, GP.PhantomMatches[i].MatchId)@"in"@MI.LevelName$"
Score"@int(round(GP.PhantomMatches[i].ScoreTeam1))@"-"@int(round(GP.PhantomMatches[i].ScoreTeam2))$"
Game time"@(GP.PhantomMatches[i].GameTime/60)@"minutes
"); output.Logf("
"); } protected function expHistory() { local int i; local array tmpa; local string tmp; if (GP.FightHistory.Length == 0) return; output.Logf("
"); output.Logf("

Fight history

"); for (i = 0; i < GP.FightHistory.Length; i++) { output.Logf(""); output.Logf(""); split(GP.FightHistory[i].MatchData, ";", tmpa); output.Logf(""); if (GP.FightHistory[i].MatchExtra != "") output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); if (GP.FightHistory[i].TeamGame) { output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); } output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf(""); output.Logf("
"$GP.FightHistory[i].Date[0]$"-"$Right("0"$GP.FightHistory[i].Date[1], 2)$"-"$Right("0"$GP.FightHistory[i].Date[2], 2)$" "$Right("0"$GP.FightHistory[i].Time[0], 2)$":"$Right("0"$GP.FightHistory[i].Time[1], 2)$"
"$tmpa[0]$""$tmpa[1]$"
Additional info"$GP.FightHistory[i].MatchExtra$"
Game type"$getGameTypeString(GP.FightHistory[i].GameType)@"
Map"$GP.FightHistory[i].Level$"
Prize money"$GP.MoneyToString(GP.FightHistory[i].PriceMoney)$"
Balance change"$GP.MoneyToString(GP.FightHistory[i].BalanceChange)$"
Bonus money"$GP.MoneyToString(GP.FightHistory[i].BonusMoney)$"
Game time"$(GP.FightHistory[i].GameTime/60)$" minutes
Won game"$GP.FightHistory[i].WonGame$"
Team 1 name"$getTeamName(GP.FightHistory[i].EnemyTeam, tmp)$"
Team 1 layout"$GP.FightHistory[i].TeamLayout[0]$"
Team 1 score"$GP.FightHistory[i].TeamScore[0]$"
Team 2 name"$GP.TeamName$"
Team 2 layout"$GP.FightHistory[i].TeamLayout[1]$"
Team 2 score"$GP.FightHistory[i].TeamScore[1]$"
My score"$GP.FightHistory[i].MyScore$"
My kills"$GP.FightHistory[i].MyKills$"
My deaths"$GP.FightHistory[i].MyDeaths$"
My awards"$GP.FightHistory[i].MyAwards$"
My rating"$GP.FightHistory[i].MyRating$"

"); } output.Logf("
"); } /** return the official name of a gametype */ function string getGameTypeString(string GameType) { local CacheManager.GameRecord GR; GR = class'CacheManager'.static.GetGameRecord(GameType); if (GR.GameName != "") return GR.GameName; return GameType; } /** get the real team name and the list of players */ function string getTeamName(string TeamClass, out string TeamRoster) { local class ETI; local array Roster; ETI = class(DynamicLoadObject(TeamClass, class'Class')); if (ETI == none) { Warn(TeamClass@"is not a valid UT2K4TeamRoster subclass"); return ""; } if (!GP.GetAltTeamRoster(TeamClass, Roster)) { Roster = ETI.default.RosterNames; } TeamRoster = JoinArray(Roster, ", ", true); return ETI.default.TeamName; } /** return the filename to use for the log file. The following formatting rules are accepted: %N profile name (the actual filename) %P player name %Y year %M month %D day %H hour %I minute %S second %W day of the week %% '%' */ protected function string FormatString(string LogFileName) { local string result; result = LogFileName; result = repl(result, "%Y", Right("0000"$string(Level.Year), 4)); result = repl(result, "%M", Right("00"$string(Level.Month), 2)); result = repl(result, "%D", Right("00"$string(Level.Day), 2)); result = repl(result, "%H", Right("00"$string(Level.Hour), 2)); result = repl(result, "%I", Right("00"$string(Level.Minute), 2)); result = repl(result, "%W", Right("0"$string(Level.DayOfWeek), 1)); result = repl(result, "%S", Right("00"$string(Level.Second), 2)); result = repl(result, "%%", "%"); result = repl(result, "%N", GP.PackageName); result = repl(result, "%P", GP.PlayerName); return result; } /** Join together array elements into a single string */ static final function string JoinArray(array StringArray, optional string delim, optional bool bIgnoreBlanks) { local int i; local string s; if (delim == "") delim = ","; for (i = 0; i < StringArray.Length; i++) { if ((StringArray[i] != "") || (!bIgnoreBlanks)) { if (s != "") s $= delim; s $= StringArray[i]; } } return s; } defaultproperties { FileName="%N_%Y_%M_%D_%H_%I" FileExt="html" }