home *** CD-ROM | disk | FTP | other *** search
- _global.home = this;
- gk1 = "whomp";
- loadVariables(userInfoURL,this);
- gotKey = true;
- _global.loadScores = function(score, obj)
- {
- trace("load obj: " + obj);
- delete home.scoreList;
- home.scoreList = new LoadVars();
- trace("Initiating Load");
- home.scoreList.onLoad = function(success)
- {
- if(success)
- {
- trace("Highscores loaded successfully.");
- for(var _loc1_ in home.scoreList)
- {
- trace(_loc1_ + " -> " + home.scoreList[_loc1_]);
- }
- setScores(1,obj);
- }
- else
- {
- setScores(0,obj);
- trace("An error occurred while loading highscores.");
- }
- };
- if(score != undefined)
- {
- trace("You have submitted a score to the list");
- home.scoreList.load(score);
- }
- else
- {
- var _loc2_ = home.highScoresURL + "?gk=" + home.gk1;
- trace("You have requested the highscore list");
- home.scoreList.load(_loc2_);
- }
- };
- _global.getScores = function(score, obj)
- {
- trace("get obj: " + obj);
- if(score != undefined || score != null)
- {
- var _loc1_ = score;
- var _loc4_ = home.highScoresURL + "?gk=" + home.gk1 + "&uk=" + home.userKey + "&s=" + _loc1_ + "&es=" + encrypt(_loc1_) + "&sd=" + home.seed;
- loadScores(_loc4_,obj);
- }
- else
- {
- loadScores(null,obj);
- }
- };
- _global.setScores = function(type, obj)
- {
- trace("set obj: " + obj);
- if(type)
- {
- if(home.scoreList.rank != undefined)
- {
- home.returnedInfo = "Good Job, you\'ve made the list. Your RANK is " + home.scoreList.rank;
- }
- else
- {
- home.returnedInfo = "You\'re score did not make the list";
- }
- var _loc1_ = 1;
- while(_loc1_ <= 10)
- {
- obj["total_" + _loc1_] = home.scoreList["hs_" + _loc1_ + "_score"] + " pts - " + home.scoreList["hs_" + _loc1_ + "_username"];
- _loc1_ = _loc1_ + 1;
- }
- }
- };
- _global.encrypt = function(encScore)
- {
- encScore = encScore.toString();
- my_date = new Date();
- my_date.hours = my_date.getUTCHours();
- my_date.minutes = my_date.getUTCMinutes();
- my_date.seconds = my_date.getUTCSeconds();
- if(my_date.seconds < 10)
- {
- my_date.seconds = "0" + my_date.seconds;
- }
- if(my_date.minutes < 10)
- {
- my_date.minutes = "0" + my_date.minutes;
- }
- if(my_date.hours < 10)
- {
- my_date.hours = "0" + my_date.hours;
- }
- home.seed = my_date.hours + ":" + my_date.minutes + ":" + my_date.seconds + ":28";
- charList = new Array(2,8,10,5,4,1,11,7);
- keyChars = new Array();
- i = 0;
- while(i < 8)
- {
- var _loc1_ = charList[i];
- keyChars.push(seed.charAt(_loc1_ - 1));
- i++;
- }
- snafuText = "";
- i = 0;
- while(i < encScore.length)
- {
- tempHolder = keyChars.shift();
- keyChars.push(tempHolder);
- tempName = "ascii" + i;
- tempName = encScore.charCodeAt(i) + Math.round(tempHolder);
- snafuText = snafuText add String.fromCharCode(tempName);
- i++;
- }
- return snafuText;
- };
-