home *** CD-ROM | disk | FTP | other *** search
- //Copyright (c) 2002 Electronic Arts Inc. All rights reserved.
-
- var lArray = new locArray();
- var oGameFace = window.external.GameInterface;
- var oLeagueFace = oGameFace.LeagueServerInterface.LeagueDispatch;
- var oManagerFace = oLeagueFace.ManagerInterface;
- var oGameData = oLeagueFace.ProviderInterface.GameDataInterface;
- var oPlayerInfo = new PlayerInfoObject();
- var oAwayTeamPerf = new TeamPerfObject();
- var oHomeTeamPerf = new TeamPerfObject();
-
- var imgPath = "../../NHL/images2/logos/";
- var arenaImgPath = "../../NHL/images2/screen_images/";
-
- document.onselectstart = function() { return false; };
-
- function getLocalizedText(bank, msg, bUpper, bDoc)
- {
- //955 - "HOT_STREAK"
- //956 - "COLD_STREAK"
- //2093 - "KEY_PLAYERS"
- //2092 - "PLAY_STATUS"
- //85 - "OVERALL"
- //2096 - "BIG_HITTER"
- //597 - "SNIPER"
- //2098 - "HERO"
- //2097 - "BIG_SHOOTER"
- //2793 - "GAME_HINT"
- //2792 - "GAME_BREAKER_METER"
- //2803 - GAME_BREAKER_DESC1
- //2804 - GAME_BREAKER_DESC2
- //2095 - PLAYER_ICONS
- //2102 - BIG_HITTER_DESC
- //2103 - BIG_SHOOTER_DESC
- //2104 - SNIPER_DESC
- //2105 - HERO_DESC
-
- var isUpper;
-
- if (bUpper)
- isUpper = 1;
- else
- isUpper = 0;
-
- if (bDoc)
- document.write(window.external.GameInterface.GetLocalizedText(bank, lArray.lookup(bank, msg), isUpper));
- else
- return (window.external.GameInterface.GetLocalizedText(bank, lArray.lookup(bank, msg), isUpper));
- }
-
- function prepTeamPerformance()
- {
- oManagerFace.GetTeamPerformance(oGameData.HomeTeam, oHomeTeamPerf);
- oManagerFace.GetTeamPerformance(oGameData.AwayTeam, oAwayTeamPerf);
- }
-
- function setStadiumInfo()
- {
- var oTeamInfo = new TeamInfoObject();
- oGameData.GetTeamInfo(0, oTeamInfo);
- /*
- if ( oTeamInfo.ArenaName.length == 0 )
- {
- stadiumNameText.innerText = oTeamInfo.CityName.toUpperCase();
- }
- else
- {
- stadiumNameText.innerText = (oTeamInfo.ArenaName + ", " + oTeamInfo.CityName).toUpperCase();
- }
- */
- if (parseInt(oTeamInfo.sArenaFile.substring(4,6)) > 50 && parseInt(oTeamInfo.sArenaFile.substring(4,6)) != 63 &&
- parseInt(oTeamInfo.sArenaFile.substring(4,6)) != 65 && parseInt(oTeamInfo.sArenaFile.substring(4,6)) != 68 &&
- parseInt(oTeamInfo.sArenaFile.substring(4,6)) != 84)
- {
- stadiumImg.src = arenaImgPath + "load_arena_99.jpg";
- }
- else
- {
- stadiumImg.src = arenaImgPath + "load_arena_" + oTeamInfo.sArenaFile.substring(4,6) + ".jpg";
- }
-
- //custom team check
- if (oTeamInfo.ArtID >= 100)
- {
- stadiumImg.src = arenaImgPath + "load_arena_99.jpg";
- }
- }
-
- function setAwayTeamInfo()
- {
- var oTeamInfo = new TeamInfoObject();
- oGameData.GetTeamInfo(1, oTeamInfo);
-
- //set team logo
- awayLogo.src = imgPath + oTeamInfo.sLogoFile;
- //set team names
- var awayFullName = oTeamInfo.FullName.toString();
- awayNameText.innerText = awayFullName.toUpperCase();
-
- //set record
- if (oAwayTeamPerf.Games > 0)
- {
- awayRecordText.innerText = oAwayTeamPerf.Wins + " - " + oAwayTeamPerf.Losses + " - " + oAwayTeamPerf.Ties + " - " + oAwayTeamPerf.OTLosses;
- }
- else
- {
- awayRecordText.innerText = "";
- }
- //set overall stat
-
- awayOverallText.innerText = getLocalizedText(0, "OVERALL", true) + ": " + oTeamInfo.Overall;
- }
-
- function setHomeTeamInfo()
- {
- var oTeamInfo = new TeamInfoObject();
- oGameData.GetTeamInfo(0, oTeamInfo);
-
- //set team logo
- homeLogo.src = imgPath + oTeamInfo.sLogoFile;
- //set team names
- var fullHomeName = oTeamInfo.FullName.toString();
- homeNameText.innerText = fullHomeName.toUpperCase();
-
- //set record
- if (oHomeTeamPerf.Games > 0)
- {
- homeRecordText.innerText = oHomeTeamPerf.Wins + " - " + oHomeTeamPerf.Losses + " - " + oHomeTeamPerf.Ties + " - " + oHomeTeamPerf.OTLosses;
- }
- else
- {
- homeRecordText.innerText = "";
- }
- //set overall stat
- homeOverallText.innerText = getLocalizedText(0, "OVERALL", true) + ": " + oTeamInfo.Overall;
- }
-
- function setKeyPlayers()
- {
- playerHeaderAway.innerText = getLocalizedText(0, "KEY_PLAYERS", true);
- playerHeaderHome.innerText = getLocalizedText(0, "KEY_PLAYERS", true);
-
- var homePlayerList = oGameData.GetKeyPlayers(0);
- var count = 0;
-
- if (homePlayerList.length != 0)
- {
- // split it and use the player info
- var aPlayerId = homePlayerList.split(",");
-
- for (var i=0; i<aPlayerId.length; i++)
- {
- oGameData.GetPlayerInfo(0, aPlayerId[i], oPlayerInfo);
- document.all["homePlayer" + i].innerText = oPlayerInfo.sName;
- document.all["homePlayerJersey" + i].innerText = oPlayerInfo.nJersey;
- document.all["homePlayerPosition" + i].innerText = oPlayerInfo.sPosition;
-
- //document.all["homePlayerWhite" + i].innerText = oPlayerInfo.sName;
-
- var aImgObj = Array(document.all["homePlayerIconA" + i], document.all["homePlayerIconB" + i], document.all["homePlayerIconC" + i], document.all["homePlayerIconD" + i]);
-
- count = 0;
-
- if (oPlayerInfo.bIsHero)
- {
- aImgObj[count].src = "../images2/common/icon_hero.gif";
- count++;
- }
- if (oPlayerInfo.bIsBigShooter)
- {
- aImgObj[count].src = "../images2/common/icon_shooter.gif";
- count++;
- }
- if (oPlayerInfo.bIsSniper)
- {
- aImgObj[count].src = "../images2/common/icon_sniper.gif";
- count++;
- }
- if (oPlayerInfo.bIsBigHitter)
- {
- aImgObj[count].src = "../images2/common/icon_hitter.gif";
- count++;
- }
-
- }
- }
-
- var awayPlayerList = oGameData.GetKeyPlayers(1);
-
- if (awayPlayerList.length != 0)
- {
- aPlayerId = awayPlayerList.split(",");
-
- for (var i=0; i<aPlayerId.length; i++)
- {
- oGameData.GetPlayerInfo(1, aPlayerId[i], oPlayerInfo);
- document.all["awayPlayer" + i].innerText = oPlayerInfo.sName;
- document.all["awayPlayerJersey" + i].innerText = oPlayerInfo.nJersey;
- document.all["awayPlayerPosition" + i].innerText = oPlayerInfo.sPosition;
-
- var aImgObj = Array(document.all["awayPlayerIconA" + i], document.all["awayPlayerIconB" + i], document.all["awayPlayerIconC" + i], document.all["awayPlayerIconD" + i]);
-
- count = 0;
-
- if (oPlayerInfo.bIsHero)
- {
- aImgObj[count].src = "../images2/common/icon_hero.gif";
- count++;
- }
- if (oPlayerInfo.bIsBigShooter)
- {
- aImgObj[count].src = "../images2/common/icon_shooter.gif";
- count++;
- }
- if (oPlayerInfo.bIsSniper)
- {
- aImgObj[count].src = "../images2/common/icon_sniper.gif";
- count++;
- }
- if (oPlayerInfo.bIsBigHitter)
- {
- aImgObj[count].src = "../images2/common/icon_hitter.gif";
- count++;
- }
-
- }
- }
- }
-
- function formatPlayerName( sPlayerName )
- {
- var aPlayerName = sPlayerName.split(" ");
- //we'll display players first initial, plus all components of their last name (ie: "Mario De Rosa" --> "M. De Rosa")
- sPlayerName = aPlayerName[0].substring(0, 1) + ". ";
- var aLen = aPlayerName.length;
-
- for( var j = 1; j < aLen; j++ )
- {
- sPlayerName += aPlayerName[j].toUpperCase();
- if( j < aLen - 1 )
- {
- sPlayerName += " ";
- }
- }
-
- return sPlayerName;
- }
-
- function setPlayerStatus()
- {
- playerHeaderAway.innerText = getLocalizedText(0, "PLAYER_STATUS", true);
- playerHeaderHome.innerText = getLocalizedText(0, "PLAYER_STATUS", true);
-
- //key players
- for (var i=0; i<5; i++)
- {
- if (i == oAwayTeamPerf.StreakPlayersNum)
- break;
-
- if (oAwayTeamPerf.StreakPlayers[i].match(getLocalizedText(0, "HOT_STREAK")))
- {
- var sPlayerName = oAwayTeamPerf.StreakPlayers[i].replace(getLocalizedText(0, "HOT_STREAK"), "");
- sPlayerName = formatPlayerName( sPlayerName );
-
- document.all["awayPlayer" + i].innerText = sPlayerName;
-
- //document.all["awayPlayerJersey" + i].innerText = ;
- //document.all["awayPlayerPosition" + i].innerText = ;
-
- document.all["awayPlayerIconA" + i].src = "../images2/common/icon_hot.gif";
- }
- else
- {
- var sPlayerName = oAwayTeamPerf.StreakPlayers[i].replace(getLocalizedText(0, "COLD_STREAK"), "");
- var aPlayerName = sPlayerName.split(" ");
- sPlayerName = formatPlayerName( sPlayerName );
-
- document.all["awayPlayer" + i].innerText = sPlayerName;
-
- //document.all["awayPlayerJersey" + i].innerText = ;
- //document.all["awayPlayerPosition" + i].innerText = ;
-
- document.all["awayPlayerIconA" + i].src = "../images2/common/icon_cold.gif";
- }
- }
-
- //key players
- for (var i=0; i<5; i++)
- {
- if (i == oHomeTeamPerf.StreakPlayersNum)
- break;
-
- if (oHomeTeamPerf.StreakPlayers[i].match(getLocalizedText(0, "HOT_STREAK")))
- {
- var sPlayerName = oHomeTeamPerf.StreakPlayers[i].replace(getLocalizedText(0, "HOT_STREAK"), "");
- var aPlayerName = sPlayerName.split(" ");
- sPlayerName = formatPlayerName( sPlayerName );
-
- document.all["homePlayer" + i].innerText = sPlayerName;
-
- //document.all["homePlayerJersey" + i].innerText = ;
- //document.all["homePlayerPosition" + i].innerText = ;
-
- document.all["homePlayerIconA" + i].src = "../images2/common/icon_hot.gif";
- }
- else
- {
- var sPlayerName = oHomeTeamPerf.StreakPlayers[i].replace(getLocalizedText(0, "COLD_STREAK"), "");
- var aPlayerName = sPlayerName.split(" ");
- sPlayerName = formatPlayerName( sPlayerName );
-
- document.all["homePlayer" + i].innerText = sPlayerName;
-
- //document.all["homePlayerJersey" + i].innerText = ;
- //document.all["homePlayerPosition" + i].innerText = ;
-
- document.all["homePlayerIconA" + i].src = "../images2/common/icon_cold.gif";
- }
- }
- }
-
- function displayGameHint()
- {
- var nRandomNumber = Math.round(Math.random()*parseInt(25));
- gameHint.innerText = getLocalizedText(3, "HINTTEXT" + nRandomNumber);
- }
-
-
- function TeamInfoObject()
- {
- this.Name = "";
- this.FullName ="";
- this.ArenaName = "";
- this.CityName = "";
- this.sArenaFile = "load_arena_99.jpg";
- this.sLogoFile = "";
- this.Overall = 0;
- this.ArtID = -1;
- }
-
-
- function TeamPerfObject()
- {
- this.Games = -1;
- this.Wins = -1;
- this.Losses = -1;
- this.Ties = -1;
- this.OTLosses = -1;
- this.Points = -1;
- this.GF = -1;
- this.GA = -1;
- this.PP = "";
- this.PK = "";
-
- this.RecentWins = -1;
- this.RecentLosses = -1;
- this.RecentTies = -1;
- this.RecentOTLosses = -1;
-
- this.StreakPlayersNum = 0;
- this.StreakPlayers = new Array();
- this.InjuredPlayersNum = 0;
- this.InjuredPlayers = new Array();
- this.SuspendedPlayersNum = 0;
- this.SuspendedPlayers = new Array();
- for (rosterIndex = 0; rosterIndex < 10; rosterIndex++)
- {
- this.StreakPlayers[rosterIndex] = "";
- this.InjuredPlayers[rosterIndex] = "";
- this.SuspendedPlayers[rosterIndex] = "";
- }
- }
-
- function PlayerInfoObject()
- {
- this.sName = "";
- this.sFullName = "";
- this.nJersey = -1;
- this.sPosition = "";
-
- this.bIsHero = false;
- this.bIsBigShooter = false;
- this.bIsSniper = false;
- this.bIsBigHitter = false;
- }
-
-