home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 2003 November / CD1_JOY_153.iso / demos / NHL2004Demo.exe / fe / COMMON / js / User_Stats_Base.js < prev   
Text File  |  2003-08-20  |  3KB  |  120 lines

  1. function User_Stats_Base()
  2. {
  3.     if( !(this instanceof User_Stats_Base)) return new User_Stats_Base( );
  4.     var protect        = this.createProtection(JAX_Object);
  5.     protect.gamesPlayed            = "";
  6.     protect.wins                = "";
  7.     protect.losses                = "";
  8.     protect.disconnects            = "";
  9.     protect.rating                = "";
  10.     protect.winPercentage        = "";
  11. };
  12. User_Stats_Base.prototype    = new JAX_Object;
  13. User_Stats_Base.prototype.getGamesPlayed            = function()
  14. {
  15.     try {
  16.         var protect        = this.getProtection(User_Stats_Base);
  17.         return protect.gamesPlayed;
  18.     } catch (e) {
  19.         return -1;
  20.     };
  21. };
  22. User_Stats_Base.prototype.getWins                    = function()
  23. {
  24.     try {
  25.         var protect        = this.getProtection(User_Stats_Base);
  26.         return protect.wins;
  27.     } catch (e) {
  28.         return -1;
  29.     };
  30. };
  31. User_Stats_Base.prototype.getLosses                = function()
  32. {
  33.     try {
  34.         var protect        = this.getProtection(User_Stats_Base);
  35.         return protect.losses;
  36.     } catch (e) {
  37.         return -1;
  38.     };
  39. };
  40. User_Stats_Base.prototype.getDisconnects                = function()
  41. {
  42.     try {
  43.         var protect        = this.getProtection(User_Stats_Base);
  44.         return protect.disconnects;
  45.     } catch (e) {
  46.         return -1;
  47.     };
  48. };
  49. User_Stats_Base.prototype.getRating                = function()
  50. {
  51.     try {
  52.         var protect        = this.getProtection(User_Stats_Base);
  53.         return protect.rating;
  54.     } catch (e) {
  55.         return -1;
  56.     };
  57. };
  58. User_Stats_Base.prototype.getWinPercentage                = function()
  59. {
  60.     try {
  61.         var protect        = this.getProtection(User_Stats_Base);
  62.         return protect.winPercentage;
  63.     } catch (e) {
  64.         return -1;
  65.     };
  66. };
  67. User_Stats_Base.prototype.setGamesPlayed            = function(gameCount)
  68. {
  69.     var protect        = this.getProtection(User_Stats_Base);
  70.     if ( !(isNaN(parseInt(gameCount))) )     {
  71.         protect.gamesPlayed        = gameCount;
  72.     } else {
  73.         protect.gamesPlayed        = 0;
  74.     };
  75. };
  76. User_Stats_Base.prototype.setWins                    = function(winCount)
  77. {
  78.     var protect        = this.getProtection(User_Stats_Base);
  79.     if ( !(isNaN(parseInt(winCount))) )     {
  80.         protect.wins        = winCount;
  81.     } else {
  82.         protect.wins        = 0;
  83.     };
  84. };
  85. User_Stats_Base.prototype.setLosses                = function(lossCount)
  86. {
  87.     var protect        = this.getProtection(User_Stats_Base);
  88.     if ( !(isNaN(parseInt(lossCount))) )     {
  89.         protect.losses        = lossCount;
  90.     } else {
  91.         protect.losses        = lossCount;
  92.     };
  93. };
  94. User_Stats_Base.prototype.setDisconnects                = function(disConnCount)
  95. {
  96.     var protect        = this.getProtection(User_Stats_Base);
  97.     if ( !(isNaN(parseInt(disConnCount))) )     {
  98.         protect.disconnects        = disConnCount;
  99.     } else {
  100.         protect.disconnects        = 0;
  101.     };
  102. };
  103. User_Stats_Base.prototype.setRating                = function(rating)
  104. {
  105.     var protect        = this.getProtection(User_Stats_Base);
  106.     if ( !(isNaN(parseInt(rating))) )     {
  107.         protect.rating        = rating;
  108.     } else {
  109.         protect.rating        = 0;
  110.     };
  111. };
  112. User_Stats_Base.prototype.setWinPercentage                = function(winPercnt)
  113. {
  114.     var protect        = this.getProtection(User_Stats_Base);
  115.     if ( !(isNaN(parseInt(winPercnt))) )     {
  116.         protect.winPercentage        = winPercnt;
  117.     } else {
  118.         protect.winPercentage        = 0;
  119.     };
  120. };