Section 1
//KingAPI (com.midasplayer.KingAPI)
package com.midasplayer {
import flash.events.*;
import flash.net.*;
import flash.external.*;
public class KingAPI {
public static const LINK_TYPE_RIGHT_CLICK:String = "rightclick";
public static const USER_TYPE_SUBSCRIPTION:int = 3;
public static const LINK_TYPE_HIGHSCORES:String = "highscores";
public static const LINK_TYPE_SIGN:String = "sign";
public static const INITIALIZED_EVENT:String = "initialized";
public static const LINK_TYPE_OTHER_GAMES:String = "other_games";
public static const USER_TYPE_REGISTERED:int = 1;
private static const SAK:String = "ggfd7sday923mdsfd8csfds34";
private static const loadHomeParametersURL:String = "http://www.king.com/servlet/FreeGameServlet?action=load";
public static const LINK_TYPE_LOADER_MOVIE:String = "loader_movie";
private static const bounceURL:String = "http://www.mygame.com/king/bounce.jsp";
public static const LINK_TYPE_PROTECT:String = "protect";
public static const LINK_TYPE_ADD_GAME:String = "add_game";
public static const USER_TYPE_GOLD:int = 2;
public static const USER_TYPE_UNREGISTERED:int = 0;
public static const HOST_BANNED_EVENT:String = "hostBanned";
private static const SK:String = "vf78hxcsjak77cxzhjkwad87s";
private static const loadCountURL:String = "http://www.mygame.com/king/loadcount.jsp";
public static const LINK_TYPE_LOADER_PROGRESS:String = "loader_progress";
private static var check:String = null;
public static var gameName:String;
public static var banned:Boolean = false;
protected static var dispatcher:EventDispatcher;
public static var isHome:Boolean = false;
private static var sessionID:String;
private static var iscore:int = 123;
public static var fromURL:String;
private static var SSK:String = "ng43ui54hy35tdsnd6f54rews";
private static function loadUrlErrorHandler(_arg1:Event):void{
trace(("Unable to load url: " + _arg1));
}
public static function resetScore():void{
iscore = 123;
check = null;
}
public static function openOfflineProtectionLink():void{
openKingPage(LINK_TYPE_PROTECT);
}
public static function init(_arg1:String, _arg2:String):void{
var loadCounter:URLLoader;
var reqvars:URLVariables;
var request:URLRequest;
var so:SharedObject;
var rnd1:Number;
var rnd2:Number;
var name = _arg1;
var from = _arg2;
gameName = name;
fromURL = from;
loadCounter = new URLLoader();
reqvars = new URLVariables();
reqvars.game = gameName;
reqvars.from = fromURL;
try {
so = SharedObject.getLocal("sessionId");
if (so.data.sessionID == null){
rnd1 = Math.abs(Math.floor((Math.random() * 4294967295)));
rnd2 = Math.abs(Math.floor((Math.random() * 4294967295)));
so.data.sessionID = (rnd1.toString(16) + rnd2.toString(16));
so.flush();
};
sessionID = so.data.sessionID;
} catch(e:Error) {
sessionID = "error";
};
reqvars.session = sessionID;
request = new URLRequest(((loadCountURL + "?") + reqvars.toString()));
loadCounter.addEventListener(Event.COMPLETE, loadCountHandler);
loadCounter.addEventListener(IOErrorEvent.IO_ERROR, loadUrlErrorHandler);
loadCounter.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loadUrlErrorHandler);
try {
loadCounter.load(request);
} catch(error:Error) {
trace(("Unable to load loadcount url: " + loadCountURL));
trace(error.message);
};
}
private static function loadHomeParametersHandler(_arg1:Event):void{
var _local2:URLLoader;
_local2 = URLLoader(_arg1.target);
trace(("loadCounter.data" + _local2.data));
}
public static function submitInternalScore():void{
var _local1:int;
checkScore();
_local1 = ((iscore - 123) / 2);
submitScore(_local1);
}
public static function openOtherGamesLink():void{
openKingPage(LINK_TYPE_OTHER_GAMES);
}
public static function openKingPage(_arg1:String, _arg2:String=null):void{
var _local3:URLVariables;
var _local4:String;
_local3 = new URLVariables();
_local3.game = gameName;
_local3.from = fromURL;
_local3.type = _arg1;
_local3.session = sessionID;
if (_arg2 != null){
_local3.redirect = _arg2;
};
_local4 = "_blank";
if (isHome){
_local4 = "_top";
};
navigateToURL(new URLRequest(((bounceURL + "?") + _local3.toString())), _local4);
}
private static function loadCountHandler(_arg1:Event):void{
var loadCounter:URLLoader;
var vars:URLVariables;
var event = _arg1;
loadCounter = URLLoader(event.target);
trace(("loadCounter.data :" + loadCounter.data));
try {
vars = new URLVariables(loadCounter.data);
if (vars.h == "true"){
isHome = true;
};
if (vars.b == "true"){
banned = true;
dispatcher.dispatchEvent(new Event(HOST_BANNED_EVENT));
} else {
dispatcher.dispatchEvent(new Event(INITIALIZED_EVENT));
};
trace((("::" + vars.h) + "::"));
trace((("::" + vars.b) + "::"));
} catch(e:Error) {
trace(("Error reading data from loadcount url: " + e));
};
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
if (dispatcher == null){
dispatcher = new EventDispatcher();
};
dispatcher.addEventListener(_arg1, _arg2);
}
public static function openLoaderMovieLink():void{
openKingPage(LINK_TYPE_LOADER_MOVIE);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
if (dispatcher == null){
return;
};
dispatcher.removeEventListener(_arg1, _arg2);
}
public static function submitScore(_arg1:int):void{
var hash:String;
var score = _arg1;
hash = md5.encrypt(((((score + ":") + gameName) + ":") + SSK));
try {
if (isHome){
ExternalInterface.call("submitScore", score, hash);
} else {
openKingPage(LINK_TYPE_HIGHSCORES, ((((("game/" + gameName) + "/submit/") + score) + ":") + hash));
};
} catch(e:Error) {
trace(e);
};
}
public static function submitLevel(_arg1:int):void{
var hash:String;
var level = _arg1;
hash = md5.encrypt(((((level + ":") + gameName) + ":") + SSK));
try {
if (isHome){
ExternalInterface.call("submitLevel", level, hash);
};
} catch(e:Error) {
trace(e);
};
}
public static function openHighscoresLink():void{
openKingPage(LINK_TYPE_HIGHSCORES, (("game/" + gameName) + "/highscores"));
}
public static function openSignLink():void{
openKingPage(LINK_TYPE_SIGN);
}
public static function openRightClickLink():void{
openKingPage(LINK_TYPE_RIGHT_CLICK);
}
private static function checkScore():void{
if (check != null){
if (check != md5.encrypt(((((iscore + ":") + gameName) + ":") + SK))){
SSK = "ng41ui54hy35tdsnd6f54rews";
};
};
}
public static function addScore(_arg1:int):int{
var _local2:int;
checkScore();
_local2 = ((iscore - 123) / 2);
_local2 = (_local2 + _arg1);
iscore = ((_local2 * 2) + 123);
check = md5.encrypt(((((iscore + ":") + gameName) + ":") + SK));
return (_local2);
}
public static function openLoaderProgressLink():void{
openKingPage(LINK_TYPE_LOADER_PROGRESS);
}
public static function openAddToWebsiteLink():void{
openKingPage(LINK_TYPE_ADD_GAME, "website_content.jsp");
}
public static function submitAchievement(_arg1:String):void{
var hash:String;
var achievement = _arg1;
hash = md5.encrypt(((((achievement + ":") + gameName) + ":") + SAK));
try {
if (isHome){
ExternalInterface.call("submitAchievement", achievement, hash);
};
} catch(e:Error) {
trace(e);
};
}
}
}//package com.midasplayer
Section 2
//md5 (com.midasplayer.md5)
package com.midasplayer {
public class md5 {
public static const HEX_FORMAT_LOWERCASE:uint = 0;
public static const HEX_FORMAT_UPPERCASE:uint = 1;
public static const BASE64_PAD_CHARACTER_DEFAULT_COMPLIANCE:String = "";
public static const BASE64_PAD_CHARACTER_RFC_COMPLIANCE:String = "=";
public static var hexcase:uint = 0;
public static var b64pad:String = "";
public static function md5_gg(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg4) | (_arg3 & ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function md5_cmn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
return (safe_add(bit_rol(safe_add(safe_add(_arg2, _arg1), safe_add(_arg4, _arg6)), _arg5), _arg3));
}
public static function binl_md5(_arg1:Array, _arg2:Number):Array{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (_arg2 % 32)));
_arg1[((((_arg2 + 64) >>> 9) << 4) + 14)] = _arg2;
_local3 = 1732584193;
_local4 = -271733879;
_local5 = -1732584194;
_local6 = 271733878;
_local7 = 0;
while (_local7 < _arg1.length) {
_local8 = _local3;
_local9 = _local4;
_local10 = _local5;
_local11 = _local6;
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 7, -680876936);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 1)], 12, -389564586);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 17, 606105819);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 3)], 22, -1044525330);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 7, -176418897);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 5)], 12, 1200080426);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 17, -1473231341);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 7)], 22, -45705983);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 7, 1770035416);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 9)], 12, -1958414417);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 17, -42063);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 11)], 22, -1990404162);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 7, 1804603682);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 13)], 12, -40341101);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 17, -1502002290);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 15)], 22, 1236535329);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 5, -165796510);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 6)], 9, -1069501632);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 14, 643717713);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 0)], 20, -373897302);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 5, -701558691);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 10)], 9, 38016083);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 14, -660478335);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 4)], 20, -405537848);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 5, 568446438);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 14)], 9, -1019803690);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 14, -187363961);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 8)], 20, 1163531501);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 5, -1444681467);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 2)], 9, -51403784);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 14, 1735328473);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 12)], 20, -1926607734);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 4, -378558);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 8)], 11, -2022574463);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 16, 1839030562);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 14)], 23, -35309556);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 4, -1530992060);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 4)], 11, 1272893353);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 16, -155497632);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 10)], 23, -1094730640);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 4, 681279174);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 0)], 11, -358537222);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 16, -722521979);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 6)], 23, 76029189);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 4, -640364487);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 12)], 11, -421815835);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 16, 530742520);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 2)], 23, -995338651);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 6, -198630844);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 7)], 10, 1126891415);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 15, -1416354905);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 5)], 21, -57434055);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 6, 1700485571);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 3)], 10, -1894986606);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 15, -1051523);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 1)], 21, -2054922799);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 6, 1873313359);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 15)], 10, -30611744);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 15, -1560198380);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 13)], 21, 1309151649);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 6, -145523070);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 11)], 10, -1120210379);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 15, 718787259);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 9)], 21, -343485551);
_local3 = safe_add(_local3, _local8);
_local4 = safe_add(_local4, _local9);
_local5 = safe_add(_local5, _local10);
_local6 = safe_add(_local6, _local11);
_local7 = (_local7 + 16);
};
return ([_local3, _local4, _local5, _local6]);
}
public static function str2rstr_utf16le(_arg1:String):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode((_arg1.charCodeAt(_local3) & 0xFF), ((_arg1.charCodeAt(_local3) >>> 8) & 0xFF)));
_local3++;
};
return (_local2);
}
public static function hex_hmac_md5(_arg1:String, _arg2:String):String{
return (rstr2hex(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2))));
}
public static function binl2rstr(_arg1:Array):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < (_arg1.length * 32)) {
_local2 = (_local2 + String.fromCharCode(((_arg1[(_local3 >> 5)] >>> (_local3 % 32)) & 0xFF)));
_local3 = (_local3 + 8);
};
return (_local2);
}
public static function md5_ff(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg3) | (~(_arg2) & _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function md5_ii(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn((_arg3 ^ (_arg2 | ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function rstr2binl(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array((_arg1.length >> 2));
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3] = 0;
_local3++;
};
_local3 = 0;
while (_local3 < (_arg1.length * 8)) {
_local2[(_local3 >> 5)] = (_local2[(_local3 >> 5)] | ((_arg1.charCodeAt((_local3 / 8)) & 0xFF) << (_local3 % 32)));
_local3 = (_local3 + 8);
};
return (_local2);
}
public static function md5_vm_test():Boolean{
return ((hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"));
}
public static function b64_md5(_arg1:String):String{
return (rstr2b64(rstr_md5(str2rstr_utf8(_arg1))));
}
public static function any_hmac_md5(_arg1:String, _arg2:String, _arg3:String):String{
return (rstr2any(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2)), _arg3));
}
public static function hex_md5(_arg1:String):String{
return (rstr2hex(rstr_md5(str2rstr_utf8(_arg1))));
}
public static function bit_rol(_arg1:Number, _arg2:Number):Number{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public static function encrypt(_arg1:String):String{
return (hex_md5(_arg1));
}
public static function md5_hh(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 ^ _arg3) ^ _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function rstr2hex(_arg1:String):String{
var _local2:String;
var _local3:String;
var _local4:Number;
var _local5:Number;
_local2 = (hexcase) ? "0123456789ABCDEF" : "0123456789abcdef";
_local3 = "";
_local5 = 0;
while (_local5 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local5);
_local3 = (_local3 + (_local2.charAt(((_local4 >>> 4) & 15)) + _local2.charAt((_local4 & 15))));
_local5++;
};
return (_local3);
}
public static function any_md5(_arg1:String, _arg2:String):String{
return (rstr2any(rstr_md5(str2rstr_utf8(_arg1)), _arg2));
}
public static function b64_hmac_md5(_arg1:String, _arg2:String):String{
return (rstr2b64(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2))));
}
public static function rstr2b64(_arg1:String):String{
var _local2:String;
var _local3:String;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
_local3 = "";
_local4 = _arg1.length;
_local5 = 0;
while (_local5 < _local4) {
_local6 = (((_arg1.charCodeAt(_local5) << 16) | (((_local5 + 1) < _local4)) ? (_arg1.charCodeAt((_local5 + 1)) << 8) : 0) | (((_local5 + 2) < _local4)) ? _arg1.charCodeAt((_local5 + 2)) : 0);
_local7 = 0;
while (_local7 < 4) {
if (((_local5 * 8) + (_local7 * 6)) > (_arg1.length * 8)){
_local3 = (_local3 + b64pad);
} else {
_local3 = (_local3 + _local2.charAt(((_local6 >>> (6 * (3 - _local7))) & 63)));
};
_local7++;
};
_local5 = (_local5 + 3);
};
return (_local3);
}
public static function safe_add(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
_local3 = ((_arg1 & 0xFFFF) + (_arg2 & 0xFFFF));
_local4 = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | (_local3 & 0xFFFF)));
}
public static function str2rstr_utf8(_arg1:String):String{
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = "";
_local3 = -1;
while (++_local3 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local3);
_local5 = (((_local3 + 1) < _arg1.length)) ? _arg1.charCodeAt((_local3 + 1)) : 0;
if ((((((((0xD800 <= _local4)) && ((_local4 <= 56319)))) && ((0xDC00 <= _local5)))) && ((_local5 <= 57343)))){
_local4 = ((65536 + ((_local4 & 1023) << 10)) + (_local5 & 1023));
_local3++;
};
if (_local4 <= 127){
_local2 = (_local2 + String.fromCharCode(_local4));
} else {
if (_local4 <= 2047){
_local2 = (_local2 + String.fromCharCode((192 | ((_local4 >>> 6) & 31)), (128 | (_local4 & 63))));
} else {
if (_local4 <= 0xFFFF){
_local2 = (_local2 + String.fromCharCode((224 | ((_local4 >>> 12) & 15)), (128 | ((_local4 >>> 6) & 63)), (128 | (_local4 & 63))));
} else {
if (_local4 <= 2097151){
_local2 = (_local2 + String.fromCharCode((240 | ((_local4 >>> 18) & 7)), (128 | ((_local4 >>> 12) & 63)), (128 | ((_local4 >>> 6) & 63)), (128 | (_local4 & 63))));
};
};
};
};
};
return (_local2);
}
public static function rstr_hmac_md5(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = rstr2binl(_arg1);
if (_local3.length > 16){
_local3 = binl_md5(_local3, (_arg1.length * 8));
};
_local4 = new Array(16);
_local5 = new Array(16);
_local6 = 0;
while (_local6 < 16) {
_local4[_local6] = (_local3[_local6] ^ 909522486);
_local5[_local6] = (_local3[_local6] ^ 1549556828);
_local6++;
};
_local7 = binl_md5(_local4.concat(rstr2binl(_arg2)), (0x0200 + (_arg2.length * 8)));
return (binl2rstr(binl_md5(_local5.concat(_local7), (0x0200 + 128))));
}
public static function str2rstr_utf16be(_arg1:String):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(((_arg1.charCodeAt(_local3) >>> 8) & 0xFF), (_arg1.charCodeAt(_local3) & 0xFF)));
_local3++;
};
return (_local2);
}
public static function rstr2any(_arg1:String, _arg2:String):String{
var _local3:Number;
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Array;
var _local9:Array;
var _local10:String;
_local3 = _arg2.length;
_local4 = [];
_local9 = new Array((_arg1.length / 2));
_local5 = 0;
while (_local5 < _local9.length) {
_local9[_local5] = ((_arg1.charCodeAt((_local5 * 2)) << 8) | _arg1.charCodeAt(((_local5 * 2) + 1)));
_local5++;
};
while (_local9.length > 0) {
_local8 = [];
_local7 = 0;
_local5 = 0;
while (_local5 < _local9.length) {
_local7 = ((_local7 << 16) + _local9[_local5]);
_local6 = Math.floor((_local7 / _local3));
_local7 = (_local7 - (_local6 * _local3));
if ((((_local8.length > 0)) || ((_local6 > 0)))){
_local8[_local8.length] = _local6;
};
_local5++;
};
_local4[_local4.length] = _local7;
_local9 = _local8;
};
_local10 = "";
_local5 = (_local4.length - 1);
while (_local5 >= 0) {
_local10 = (_local10 + _arg2.charAt(_local4[_local5]));
_local5--;
};
return (_local10);
}
public static function rstr_md5(_arg1:String):String{
return (binl2rstr(binl_md5(rstr2binl(_arg1), (_arg1.length * 8))));
}
}
}//package com.midasplayer
Section 3
//GraphicHolder_1 (TowerOfGreed_fla.GraphicHolder_1)
package TowerOfGreed_fla {
import flash.display.*;
public dynamic class GraphicHolder_1 extends MovieClip {
public function GraphicHolder_1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package TowerOfGreed_fla
Section 4
//MainTimeline (TowerOfGreed_fla.MainTimeline)
package TowerOfGreed_fla {
import flash.events.*;
import flash.display.*;
import com.midasplayer.*;
import flash.net.*;
public dynamic class MainTimeline extends MovieClip {
public var loaderBar:Bitmap;
public var loaderFill:Bitmap;
public var preloader:Sprite;
public var kingLoader:KingLoaderMovie;
public var frames:int;
public var main:Main;
public var mochi:String;
public var eseLogo:Bitmap;
public var game_name:String;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 5, frame6, 6, frame7);
}
public function preload(_arg1:Event):void{
addEventListener(MouseEvent.CLICK, openKingPage);
addEventListener(Event.ENTER_FRAME, runPreloader);
addChild((preloader = new Sprite()));
preloader.scaleX = (preloader.scaleY = 3);
preloader.addChild((loaderBar = new Bitmap(new PreloaderBar(0, 0))));
loaderBar.x = 24;
loaderBar.y = 54;
preloader.addChild((loaderFill = new Bitmap(new PreloaderFill(0, 0))));
loaderFill.x = 30;
loaderFill.y = 83;
}
public function runPreloader(_arg1:Event):void{
if (framesLoaded == totalFrames){
removeChild(preloader);
removeEventListener(MouseEvent.CLICK, openKingPage);
removeEventListener(Event.ENTER_FRAME, runPreloader);
preloader = null;
loaderBar = null;
loaderFill = null;
if (!KingAPI.isHome){
gotoAndPlay(2);
} else {
gotoAndPlay(3);
};
} else {
loaderFill.height = 4;
loaderFill.width = Math.floor(((root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal) * 100));
};
}
public function openKingPage(_arg1:Event):void{
KingAPI.openLoaderProgressLink();
}
function frame6(){
frames = 0;
stage.addEventListener(Event.ENTER_FRAME, handleESELogo);
stage.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
addChild((eseLogo = new Bitmap(new ESELogo(0, 0))));
eseLogo.scaleX = (eseLogo.scaleY = 3);
stop();
}
function frame7(){
main = new Main(stage);
addChild(main);
stop();
}
function frame1(){
game_name = "tower-of-greed";
mochi = "ed7f7a7f";
KingAPI.addEventListener(KingAPI.INITIALIZED_EVENT, preload);
KingAPI.addEventListener(KingAPI.HOST_BANNED_EVENT, preload);
KingAPI.init(game_name, root.loaderInfo.url);
stop();
}
function frame2(){
MochiBot.track(this, mochi);
addChild((kingLoader = new KingLoaderMovie(stage)));
kingLoader.scaleX = (kingLoader.scaleY = 3);
addEventListener(Event.ENTER_FRAME, runKingLogo);
stop();
}
public function handleMouseDown(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.epicshadow.com/towerofgreed.php"), "_blank");
}
public function handleESELogo(_arg1:Event):void{
frames++;
if (frames >= 80){
removeChild(eseLogo);
eseLogo = null;
stage.removeEventListener(Event.ENTER_FRAME, handleESELogo);
stage.removeEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
gotoAndPlay(7);
};
}
public function runKingLogo(_arg1:Event):void{
kingLoader.run();
if (kingLoader.finished){
removeChild(kingLoader);
removeEventListener(Event.ENTER_FRAME, runKingLogo);
kingLoader.destroy();
kingLoader = null;
gotoAndPlay(3);
};
}
}
}//package TowerOfGreed_fla
Section 5
//SoundHolder_6 (TowerOfGreed_fla.SoundHolder_6)
package TowerOfGreed_fla {
import flash.display.*;
public dynamic class SoundHolder_6 extends MovieClip {
public function SoundHolder_6(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package TowerOfGreed_fla
Section 6
//AchievementBar (AchievementBar)
package {
import flash.display.*;
public dynamic class AchievementBar extends BitmapData {
public function AchievementBar(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 7
//Animations (Animations)
package {
import flash.display.*;
public dynamic class Animations extends BitmapData {
public function Animations(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 8
//Collectible (Collectible)
package {
import flash.display.*;
public class Collectible extends Bitmap {
public var type:int;// = 0
public var attracting:Boolean;// = false
public var bling:int;// = 50
public var ease:int;// = 4
public function Collectible(_arg1:BitmapData):void{
bling = 50;
type = 0;
attracting = false;
ease = 4;
super();
bitmapData = _arg1;
ease = Toolkit.randomInt(6, 12);
}
public function approachPlayer():void{
var _local1:Player;
var _local2:int;
var _local3:int;
if (attracting){
if (type != 3){
_local1 = Global.PLAYER;
_local2 = ((_local1.x + (_local1.hitWidth / 2)) - 12);
_local3 = ((_local1.y + (_local1.hitHeight / 2)) - 16);
x = (x + Math.ceil(((_local2 - x) / ease)));
y = (y + Math.ceil(((_local3 - y) / ease)));
};
};
}
public function setType(_arg1:int):void{
type = _arg1;
switch (_arg1){
case 0:
bling = 50;
break;
case 1:
bling = 500;
break;
case 2:
bling = 5000;
break;
case 3:
bling = 100;
break;
};
}
}
}//package
Section 9
//Collectibles (Collectibles)
package {
import flash.display.*;
public dynamic class Collectibles extends BitmapData {
public function Collectibles(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 10
//Collision (Collision)
package {
import flash.display.*;
import flash.geom.*;
public class Collision {
public static function getCollisionRect(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Rectangle{
var _local6:Rectangle;
var _local7:Rectangle;
var _local8:Rectangle;
var _local9:BitmapData;
var _local10:BitmapData;
var _local11:uint;
var _local12:Rectangle;
var _local13:int;
_local6 = _arg1.getBounds(_arg3);
_local7 = _arg2.getBounds(_arg3);
_local8 = _local6.intersection(_local7);
if (_local8.size.length > 0){
if (_arg4){
_local8.width = Math.ceil(_local8.width);
_local8.height = Math.ceil(_local8.height);
_local9 = getAlphaMap(_arg1, _local8, BitmapDataChannel.RED, _arg3);
_local10 = getAlphaMap(_arg2, _local8, BitmapDataChannel.GREEN, _arg3);
_local9.draw(_local10, null, null, BlendMode.LIGHTEN);
if (_arg5 <= 0){
_local11 = 65792;
} else {
if (_arg5 > 1){
_arg5 = 1;
};
_local13 = Math.round((_arg5 * 0xFF));
_local11 = (((_local13 << 16) | (_local13 << 8)) | 0);
};
_local12 = _local9.getColorBoundsRect(_local11, _local11);
_local9.getColorBoundsRect(_local11, _local11).x = (_local12.x + _local8.x);
_local12.y = (_local12.y + _local8.y);
return (_local12);
} else {
return (_local8);
};
//unresolved jump
};
return (null);
}
public static function isColliding(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Boolean{
var _local6:Rectangle;
_local6 = getCollisionRect(_arg1, _arg2, _arg3, _arg4, _arg5);
if (((!((_local6 == null))) && ((_local6.size.length > 0)))){
return (true);
};
return (false);
}
public static function getCollisionPoint(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Point{
var _local6:Rectangle;
var _local7:Number;
var _local8:Number;
_local6 = getCollisionRect(_arg1, _arg2, _arg3, _arg4, _arg5);
if (((!((_local6 == null))) && ((_local6.size.length > 0)))){
_local7 = ((_local6.left + _local6.right) / 2);
_local8 = ((_local6.top + _local6.bottom) / 2);
return (new Point(_local7, _local8));
};
return (null);
}
private static function getAlphaMap(_arg1:DisplayObject, _arg2:Rectangle, _arg3:uint, _arg4:DisplayObjectContainer):BitmapData{
var _local5:Matrix;
var _local6:Matrix;
var _local7:BitmapData;
var _local8:BitmapData;
_local5 = _arg4.transform.concatenatedMatrix.clone();
_local5.invert();
_local6 = _arg1.transform.concatenatedMatrix.clone();
_local6.concat(_local5);
_local6.translate(-(_arg2.x), -(_arg2.y));
_local7 = new BitmapData(_arg2.width, _arg2.height, true, 0);
_local7.draw(_arg1, _local6);
_local8 = new BitmapData(_arg2.width, _arg2.height, false, 0);
_local8.copyChannel(_local7, _local7.rect, new Point(0, 0), BitmapDataChannel.ALPHA, _arg3);
return (_local8);
}
}
}//package
Section 11
//Control (Control)
package {
import flash.events.*;
import flash.media.*;
import flash.geom.*;
public class Control {
public static var LEFT:int = 65;
public static var MOUSEPOINT:Point;
public static var MOUSEPOS:Point;
public static var MOUSEUPPOINT:Point;
public static var CONFIRM2:int = 74;
public static var LEFT2:int = 37;
public static var UP:int = 87;
public static var CONFIRM:int = 32;
public static var MOUSEDOWNPOINT:Point;
public static var MOUSEDOWNPOS:Point;
public static var MOUSEDOWN:Boolean;
public static var DOWN:int = 83;
public static var ENTER:int = 13;
private static var main:Main;
public static var RIGHT2:int = 39;
public static var LOOPCHANNEL:SoundChannel;
public static var POWERUP:int = 75;
private static var keysHeld:Array = new Array();
public static var DOWN2:int = 40;
public static var MOUSEUPPOS:Point;
public static var LOOPPLAYING:Boolean = false;
public static var POWERUP2:int = 16;
public static var POWERUP3:int = 16;
public static var UP2:int = 38;
public static var CANCEL:int = 90;
private static var keys:Array = new Array();
public static var RIGHT:int = 68;
public static function changeLoop(_arg1:int):void{
if (LOOPPLAYING){
LOOPCHANNEL.stop();
LOOPPLAYING = false;
};
switch (_arg1){
case 0:
LOOPCHANNEL = Global.SOUNDMENULOOP.play(0, 999999);
break;
case 1:
LOOPCHANNEL = Global.SOUNDMUSICLOOP.play(0, 999999);
break;
};
LOOPPLAYING = true;
}
private static function mouseDownHandler(_arg1:MouseEvent):void{
MOUSEDOWN = true;
MOUSEDOWNPOINT = new Point(_arg1.stageX, _arg1.stageY);
}
private static function mouseUpHandler(_arg1:MouseEvent):void{
MOUSEDOWN = false;
MOUSEUPPOINT = new Point(_arg1.stageX, _arg1.stageY);
}
public static function init(_arg1:Main):void{
main = _arg1;
main.gameStage.addEventListener(Event.ENTER_FRAME, run);
main.gameStage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
main.gameStage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
main.gameStage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
main.gameStage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
main.gameStage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
MOUSEDOWN = false;
MOUSEPOINT = new Point();
MOUSEDOWNPOINT = new Point();
MOUSEUPPOINT = new Point();
}
private static function keyUpHandler(_arg1:KeyboardEvent):void{
keys[_arg1.keyCode] = false;
keysHeld[_arg1.keyCode] = false;
}
private static function run(_arg1:Event):void{
main.run();
if (Global.MUSICOFF){
LOOPCHANNEL.stop();
LOOPPLAYING = false;
};
if (((!(Global.MUSICOFF)) && (!(LOOPPLAYING)))){
changeLoop(Global.CURRENTLOOP);
};
}
public static function setMouseDown(_arg1:Boolean):void{
MOUSEDOWN = _arg1;
}
public static function isKeyDown(_arg1:Number):Boolean{
var _local2:Boolean;
if ((((keys[_arg1] == undefined)) || ((keys[_arg1] == null)))){
return (false);
};
_local2 = keys[_arg1];
keys[_arg1] = false;
if (_local2){
keysHeld[_arg1] = true;
};
return (_local2);
}
public static function isKeyHeld(_arg1:Number):Boolean{
if ((((keysHeld[_arg1] == undefined)) || ((keysHeld[_arg1] == null)))){
return (false);
};
return (keysHeld[_arg1]);
}
public static function clearMousePoints():void{
MOUSEDOWN = false;
MOUSEDOWNPOINT = new Point();
MOUSEUPPOINT = new Point();
}
private static function mouseMoveHandler(_arg1:MouseEvent):void{
MOUSEPOINT = new Point(_arg1.stageX, _arg1.stageY);
}
private static function keyDownHandler(_arg1:KeyboardEvent):void{
if ((((keys[_arg1.keyCode] == null)) || ((keys[_arg1.keyCode] == undefined)))){
keys[_arg1.keyCode] = false;
};
if ((((keysHeld[_arg1.keyCode] == null)) || ((keys[_arg1.keyCode] == undefined)))){
keys[_arg1.keyCode] = false;
};
if (((keys[_arg1.keyCode]) || (keysHeld[_arg1.keyCode]))){
keysHeld[_arg1.keyCode] = true;
keys[_arg1.keyCode] = false;
} else {
keys[_arg1.keyCode] = true;
keysHeld[_arg1.keyCode] = false;
};
MOUSEPOINT = new Point(-1, -1);
}
public static function setScreen(_arg1:int):void{
main.gameStage.focus = main.gameStage;
main.setScreen(_arg1);
}
}
}//package
Section 12
//ControlsBackground (ControlsBackground)
package {
import flash.display.*;
public dynamic class ControlsBackground extends BitmapData {
public function ControlsBackground(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 13
//ControlsScreen (ControlsScreen)
package {
import flash.display.*;
public class ControlsScreen extends GameScreen {
public var enterText:GameText;
public var bg:Bitmap;
public function ControlsScreen():void{
addChild((bg = new Bitmap(new ControlsBackground(0, 0))));
bg.y = -16;
addChild(new Bitmap(new ControlsScreenImage(0, 0)));
}
override public function run():void{
bg.x--;
bg.y++;
if (bg.y == 0){
bg.x = 0;
bg.y = -16;
};
if (((((((Control.isKeyDown(Control.ENTER)) || (Control.isKeyDown(Control.CONFIRM)))) || (Control.isKeyDown(Control.CONFIRM2)))) || (Control.MOUSEDOWN))){
Global.playSound(Global.SOUNDMENUCONFIRM);
Global.resetGlobals();
Control.setScreen(Global.MENUSCREEN);
Control.setMouseDown(false);
};
if (((Control.isKeyDown(Control.POWERUP)) || (Control.isKeyDown(Control.POWERUP2)))){
Global.playSound(Global.SOUNDMENUCANCEL);
Global.resetGlobals();
Control.setScreen(Global.TITLESCREEN);
};
}
}
}//package
Section 14
//ControlsScreenImage (ControlsScreenImage)
package {
import flash.display.*;
public dynamic class ControlsScreenImage extends BitmapData {
public function ControlsScreenImage(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 15
//DeathScreen (DeathScreen)
package {
import flash.display.*;
import com.midasplayer.*;
public class DeathScreen extends GameScreen {
public var cursorPos:int;// = 0
public var cursor:Bitmap;
public var sweatDrop:Bitmap;
public var frames:int;// = 0
public var kingButton:Bitmap;
public function DeathScreen():void{
cursorPos = 0;
frames = 0;
super();
addChild(new Bitmap(new DeathScreenImage(0, 0)));
addChild((cursor = new Bitmap(new MenuCursor(0, 0))));
cursor.x = 112;
cursor.y = 118;
cursor.visible = false;
addChild((sweatDrop = new Bitmap(new SweatDrop(0, 0))));
sweatDrop.x = 80;
sweatDrop.y = 60;
addChild((kingButton = new Bitmap(new KingButton(0, 0))));
kingButton.x = 2;
kingButton.y = 111;
}
public function menuSelect():void{
if (cursorPos == 0){
Global.playSound(Global.SOUNDMENUCONFIRM);
Global.resetGlobals();
Control.setScreen(Global.PLAYSCREEN);
} else {
Global.playSound(Global.SOUNDMENUCONFIRM);
Global.resetGlobals();
Control.setScreen(Global.MENUSCREEN);
};
Global.TROPHYHANDLER.resetData();
}
public function moveCursor():void{
cursorPos = ((cursorPos)==0) ? 1 : 0;
cursor.y = (118 + (cursorPos * 13));
Global.playSound(Global.SOUNDMENUMOVE);
}
override public function run():void{
if (frames < 16){
if ((frames % 2) == 0){
sweatDrop.y++;
};
frames++;
} else {
cursor.visible = true;
if ((((Control.MOUSEPOINT.x >= (100 * Global.SCALE))) && ((Control.MOUSEPOINT.x < (160 * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (116 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (129 * Global.SCALE))))){
if (cursorPos == 1){
moveCursor();
};
if (Control.MOUSEDOWN){
menuSelect();
};
};
if ((((Control.MOUSEPOINT.y >= (130 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (163 * Global.SCALE))))){
if (cursorPos == 0){
moveCursor();
};
if (Control.MOUSEDOWN){
menuSelect();
};
};
};
if (Control.MOUSEDOWN){
if ((((Control.MOUSEPOINT.x >= (kingButton.x * Global.SCALE))) && ((Control.MOUSEPOINT.x < ((kingButton.x + kingButton.width) * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (kingButton.y * Global.SCALE))) && ((Control.MOUSEPOINT.y < ((kingButton.y + kingButton.height) * Global.SCALE))))){
Global.playSound(Global.SOUNDMENUCONFIRM);
KingAPI.openOtherGamesLink();
Control.setMouseDown(false);
};
};
};
if (((Control.isKeyDown(Control.UP)) || (Control.isKeyDown(Control.UP2)))){
moveCursor();
};
if (((Control.isKeyDown(Control.DOWN)) || (Control.isKeyDown(Control.DOWN2)))){
moveCursor();
};
if (((((Control.isKeyDown(Control.ENTER)) || (Control.isKeyDown(Control.CONFIRM)))) || (Control.isKeyDown(Control.CONFIRM2)))){
menuSelect();
};
};
}
}
}//package
Section 16
//DeathScreenImage (DeathScreenImage)
package {
import flash.display.*;
public dynamic class DeathScreenImage extends BitmapData {
public function DeathScreenImage(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 17
//DoorMenu (DoorMenu)
package {
import flash.display.*;
public class DoorMenu extends Sprite {
public var confirmText:GameText;
public var cursorPos:int;// = 0
public var cursorMax:int;// = 0
public var image:Bitmap;
public var cursor:Bitmap;
public var menu:Bitmap;
public var frames:int;// = 0
public function DoorMenu():void{
cursorPos = 0;
cursorMax = 0;
frames = 0;
super();
addChild((image = new Bitmap(new DoorMenuImage(0, 0))));
addChild((confirmText = new GameText("Exit the tower to\nsubmit your score and\nsave your trophies?")));
confirmText.x = 4;
confirmText.y = 4;
addChild((cursor = new Bitmap(new MenuCursor(0, 0))));
cursor.x = 4;
cursor.y = (119 + ((1 - cursorMax) * 13));
if (Global.GAMEMODE == 0){
menu = new Bitmap(new DoorMenuArcade(0, 0));
cursorMax = 1;
} else {
menu = new Bitmap(new DoorMenuSurvival(0, 0));
cursorMax = 2;
};
addChild(menu);
menu.x = 16;
menu.y = (141 - menu.height);
}
public function init():void{
frames = 1;
cursorPos = 0;
}
public function exit():void{
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setScreen(Global.VICTORYSCREEN);
}
public function menuSelect():void{
switch (cursorPos){
case 0:
cancel();
break;
case 1:
if (cursorMax == 2){
bank();
} else {
exit();
};
break;
case 2:
exit();
break;
};
}
public function bank():void{
Global.playSound(Global.SOUNDMENUCONFIRM);
Global.bankScore();
Global.softResetGlobals();
Control.setScreen(Global.PLAYSCREEN);
}
public function moveCursor(_arg1:int):void{
cursorPos = (cursorPos + _arg1);
if (cursorPos < 0){
cursorPos = cursorMax;
};
if (cursorPos > cursorMax){
cursorPos = 0;
};
Global.playSound(Global.SOUNDMENUMOVE);
}
public function run():void{
if ((((Control.MOUSEPOINT.y > (102 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (140 * Global.SCALE))))){
if ((((Control.MOUSEPOINT.x > 0)) && ((Control.MOUSEPOINT.x < (88 * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y > (116 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (128 * Global.SCALE))))){
if (Global.GAMEMODE == 0){
if (cursorPos != 0){
Global.playSound(Global.SOUNDMENUMOVE);
cursorPos = 0;
};
} else {
if (cursorPos != 1){
Global.playSound(Global.SOUNDMENUMOVE);
cursorPos = 1;
};
};
};
if ((((Control.MOUSEPOINT.y > (130 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (140 * Global.SCALE))))){
if (Global.GAMEMODE == 0){
if (cursorPos != 1){
Global.playSound(Global.SOUNDMENUMOVE);
cursorPos = 1;
};
} else {
if (cursorPos != 2){
Global.playSound(Global.SOUNDMENUMOVE);
cursorPos = 2;
};
};
};
if (Global.GAMEMODE == 1){
if ((((Control.MOUSEPOINT.y > (102 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (110 * Global.SCALE))))){
if (cursorPos != 0){
Global.playSound(Global.SOUNDMENUMOVE);
cursorPos = 0;
};
};
};
};
};
cursor.y = ((119 + (cursorPos * 13)) + ((1 - cursorMax) * 13));
if (((Control.isKeyDown(Control.UP)) || (Control.isKeyDown(Control.UP2)))){
moveCursor(-1);
};
if (((Control.isKeyDown(Control.DOWN)) || (Control.isKeyDown(Control.DOWN2)))){
moveCursor(1);
};
if (((Control.isKeyDown(Control.POWERUP)) || (Control.isKeyDown(Control.POWERUP2)))){
cancel();
};
if (((((((Control.isKeyDown(Control.ENTER)) || (Control.isKeyDown(Control.CONFIRM)))) || (Control.isKeyDown(Control.CONFIRM2)))) || (Control.MOUSEDOWN))){
menuSelect();
Control.setMouseDown(false);
};
}
public function cancel():void{
visible = false;
Global.playSound(Global.SOUNDMENUCANCEL);
}
}
}//package
Section 18
//DoorMenuArcade (DoorMenuArcade)
package {
import flash.display.*;
public dynamic class DoorMenuArcade extends BitmapData {
public function DoorMenuArcade(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 19
//DoorMenuImage (DoorMenuImage)
package {
import flash.display.*;
public dynamic class DoorMenuImage extends BitmapData {
public function DoorMenuImage(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 20
//DoorMenuSurvival (DoorMenuSurvival)
package {
import flash.display.*;
public dynamic class DoorMenuSurvival extends BitmapData {
public function DoorMenuSurvival(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 21
//Enemy (Enemy)
package {
public class Enemy extends Entity {
public var active:Boolean;// = false
public var dying:Boolean;// = false
public var moving:int;// = 0
public var type:int;// = 0
public var dx:int;// = 1
public function Enemy():void{
dx = 1;
type = 0;
active = false;
moving = 0;
dying = false;
super();
gotoAndStop((1 + (type * 2)));
if (Toolkit.randomInt(1, 100) <= 50){
dx = -1;
};
}
public function die():void{
if (!dying){
collidable = false;
dying = true;
velocity = -(Math.ceil((maxVel * 0.5)));
};
}
override public function run():void{
if (((y + hitHeight) + 1) >= 0){
active = true;
};
if (active){
velocity = (velocity + Global.GRAVITY);
if (velocity > maxVel){
velocity = maxVel;
};
if (!dying){
if (hitWall){
hitWall = false;
dx = (dx * -1);
};
if (!ladderLock){
moveChar(dx, 0, false, false, false);
};
if (dx < 0){
gotoAndStop((2 + (type * 2)));
} else {
gotoAndStop((1 + (type * 2)));
};
if ((((type == 1)) && (!(jumping)))){
jump();
};
if (type == 2){
if (!onLadder){
if ((((dx < 0)) && ((Global.PLAYER.x < x)))){
moveChar(dx, 0, false, false, true);
};
if ((((dx > 0)) && ((Global.PLAYER.x > x)))){
moveChar(dx, 0, false, false, true);
};
};
if (Math.abs((y - Global.PLAYER.y)) >= 0){
if (Global.PLAYER.y >= y){
ladderLock = false;
moveChar(0, 1, false, true, false);
moving = 1;
} else {
moveChar(0, -1, false, true, false);
moving = -1;
};
} else {
if (ladderLock){
moveChar(0, moving, false, true, false);
};
};
};
} else {
moveChar(-(dx), 0, false, false, false);
visible = (visible) ? false : true;
};
fall();
};
}
public function setType(_arg1:int):void{
type = _arg1;
gotoAndStop((2 + (type * 2)));
}
}
}//package
Section 22
//Entity (Entity)
package {
import flash.display.*;
public class Entity extends MovieClip {
public var hitWidth:int;// = 8
public var takingDamage:Boolean;// = false
public var environment:PlayScreen;
public var pc:Boolean;// = false
public var jumping:Boolean;// = false
public var invincible:Boolean;// = false
public var ladderLock:Boolean;// = false
public var invincibletimer:int;// = 32
public var maxVel:int;// = 8
public var hitHeight:int;// = 12
public var spd:int;// = 3
public var velocity:int;// = 0
public var onLadder:Boolean;// = false
public var collidable:Boolean;// = true
public var hitWall:Boolean;// = false
public function Entity():void{
jumping = false;
velocity = 0;
maxVel = 8;
hitWidth = 8;
hitHeight = 12;
spd = 3;
onLadder = false;
ladderLock = false;
hitWall = false;
pc = false;
invincible = false;
invincibletimer = 32;
takingDamage = false;
collidable = true;
super();
}
protected function jump():void{
if (!onLadder){
jumping = true;
velocity = -(maxVel);
if (pc){
Global.playSound(Global.SOUNDPCJUMP);
} else {
Global.playSound(Global.SOUNDNMEJUMP);
};
};
}
public function setEnvironment(_arg1:PlayScreen):void{
environment = _arg1;
}
protected function fall():void{
if (velocity < 0){
moveChar(0, -1, true, false, false);
};
if (velocity > 0){
moveChar(0, 1, true, false, false);
};
}
protected function getCorners(_arg1:Number, _arg2:Number):Array{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:Array;
_local3 = Math.floor((_arg1 / 16));
_local4 = Math.floor((_arg2 / 16));
_local5 = Math.floor((((_arg1 + hitWidth) - 1) / 16));
_local6 = Math.floor((((_arg2 + hitHeight) - 1) / 16));
_local7 = false;
_local8 = false;
if (Global.MAPHANDLER.dataArr[_local4] != undefined){
if (Global.MAPHANDLER.dataArr[_local4][_local3] != undefined){
_local7 = Global.MAPHANDLER.dataArr[_local4][_local3];
};
if (Global.MAPHANDLER.dataArr[_local4][_local5] != undefined){
_local8 = Global.MAPHANDLER.dataArr[_local4][_local5];
};
};
_local9 = false;
_local10 = false;
if (Global.MAPHANDLER.dataArr[_local6] != undefined){
if (Global.MAPHANDLER.dataArr[_local6][_local3] != undefined){
_local9 = Global.MAPHANDLER.dataArr[_local6][_local3];
};
if (Global.MAPHANDLER.dataArr[_local6][_local5] != undefined){
_local10 = Global.MAPHANDLER.dataArr[_local6][_local5];
};
};
_local11 = [_local7, _local8, _local9, _local10];
return (_local11);
}
public function run():void{
}
protected function bounce():void{
jumping = true;
velocity = -(Math.round((maxVel * 1.75)));
Global.playSound(Global.SOUNDSPRINGJUMP);
}
protected function moveChar(_arg1:int, _arg2:int, _arg3:Boolean, _arg4:Boolean, _arg5:Boolean):void{
var _local6:Array;
var _local7:Array;
var _local8:int;
var _local9:Boolean;
var _local10:int;
_local8 = Math.abs(velocity);
if (_arg3){
_local6 = getCorners((x + (_arg1 * spd)), (((y - Global.MAPHANDLER.offsetImg) + 32) + (_arg2 * _local8)));
} else {
if (((_arg5) && (!(Global.TIMESTOP)))){
_local6 = getCorners((x + (_arg1 * 2)), (((y - Global.MAPHANDLER.offsetImg) + 32) + (_arg2 * 2)));
} else {
_local6 = getCorners((x + (_arg1 * spd)), (((y - Global.MAPHANDLER.offsetImg) + 32) + (_arg2 * spd)));
};
};
_local7 = getCorners(x, ((y - Global.MAPHANDLER.offsetImg) + 32));
if (_arg1 == -1){
if (collidable){
if (((!((_local6[0] == false))) && (!((_local6[2] == false))))){
if (((_local6[0].walkable) && (_local6[2].walkable))){
if (((_arg5) && (!(Global.TIMESTOP)))){
x = (x - 2);
} else {
x = (x - spd);
};
} else {
x = (_local6[0].x + 16);
hitWall = true;
if (((_local6[0].spikes) || (_local6[2].spikes))){
takeDamage();
};
};
} else {
hitWall = true;
};
} else {
x = (x - spd);
};
};
if (_arg2 == -1){
if (collidable){
if (((!((_local6[0] == false))) && (!((_local6[1] == false))))){
if (((_local6[0].walkable) && (_local6[1].walkable))){
if (_arg3){
y = (y - _local8);
} else {
if (_arg4){
if (((_local6[0].door) && (_local6[1].door))){
if (pc){
environment.showDoorMenu();
};
};
if (((_local6[0].ladder) && (_local6[1].ladder))){
onLadder = true;
ladderLock = true;
} else {
onLadder = false;
};
if (((!((_local7[2] == false))) && (!((_local7[3] == false))))){
if (((_local7[2].ladder) && (_local7[3].ladder))){
onLadder = true;
};
} else {
onLadder = false;
};
if (onLadder){
velocity = 0;
y = (y - spd);
} else {
ladderLock = false;
};
};
};
} else {
if (((_local6[0].spikes) || (_local6[1].spikes))){
takeDamage();
};
if (((((((!((_local7[1] == false))) && (!((_local7[2] == false))))) && (!((_local7[3] == false))))) && (!((_local7[4] == false))))){
if (((((((((((_local6[2].walkable) && (_local6[3].walkable))) && (_local7[0].walkable))) && (_local7[1].walkable))) && (_local7[2].walkable))) && (_local7[3].walkable))){
if (_arg3){
velocity = 0;
y = (_local6[0].y + 16);
};
};
};
};
};
} else {
y = (y - _local8);
};
};
if (_arg1 == 1){
if (collidable){
if (((!((_local6[1] == false))) && (!((_local6[3] == false))))){
if (((_local6[1].walkable) && (_local6[3].walkable))){
if (((_arg5) && (!(Global.TIMESTOP)))){
x = (x + 2);
} else {
x = (x + spd);
};
} else {
x = (_local6[3].x - hitWidth);
hitWall = true;
if (((_local6[1].spikes) || (_local6[3].spikes))){
takeDamage();
};
};
} else {
hitWall = true;
};
} else {
x = (x + spd);
};
};
if (_arg2 == 1){
if (collidable){
if (((!((_local6[2] == false))) && (!((_local6[3] == false))))){
if (((!(_local6[2].walkable)) || (!(_local6[3].walkable)))){
onLadder = false;
velocity = 0;
jumping = false;
y = (_local6[3].y - hitHeight);
_local6[2].hit(this);
_local6[3].hit(this);
if (((_local6[2].spikes) || (_local6[3].spikes))){
if (((((pc) && (invincible))) && ((invincibletimer > 32)))){
Global.TROPHYHANDLER.sendStat("spikewalk", 1);
};
takeDamage();
};
} else {
_local9 = true;
if (((_local6[2].ladder) && (_local6[3].ladder))){
if (_arg4){
onLadder = true;
};
if (onLadder){
jumping = true;
velocity = 0;
if (_arg4){
y = (y + spd);
};
_local9 = false;
};
} else {
onLadder = false;
};
if (((_local6[2].cloud) || (_local6[3].cloud))){
if (y <= ((_local6[3].y - hitHeight) + 2)){
onLadder = false;
jumping = false;
velocity = 0;
y = (_local6[3].y - hitHeight);
_local9 = false;
if (((_local6[2].spring) || (_local6[3].spring))){
if (!takingDamage){
bounce();
};
};
if (((_local6[2].treadmill) || (_local6[3].treadmill))){
_local10 = (_local6[2].treadDir + _local6[3].treadDir);
if (_local10 > 1){
_local10 = 1;
};
if (_local10 < -1){
_local10 = -1;
};
if (!Global.TIMESTOP){
moveChar(_local10, 0, false, false, true);
};
};
_local6[2].hit(this);
_local6[3].hit(this);
};
};
if (((_local9) && (!(_arg4)))){
onLadder = false;
y = (y + _local8);
jumping = true;
};
};
};
} else {
y = (y + _local8);
};
};
}
public function takeDamage():void{
}
}
}//package
Section 23
//ESELogo (ESELogo)
package {
import flash.display.*;
public dynamic class ESELogo extends BitmapData {
public function ESELogo(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 24
//FlameGraphic (FlameGraphic)
package {
import flash.display.*;
import flash.geom.*;
public class FlameGraphic extends Bitmap {
public var flameSheet:FlameSheet;
public var blankBmp:BitmapData;
public var frames:int;// = 99
public function FlameGraphic():void{
frames = 99;
super();
flameSheet = new FlameSheet(0, 0);
blankBmp = new BitmapData(16, 16, true, 0);
bitmapData = blankBmp;
}
public function run():void{
var _local1:int;
frames++;
_local1 = Math.floor((frames / 2));
if (_local1 < 8){
bitmapData = getImage(_local1);
};
if (_local1 >= 8){
bitmapData = blankBmp;
};
}
public function getImage(_arg1:int):BitmapData{
var _local2:BitmapData;
var _local3:Rectangle;
var _local4:Point;
_local2 = new BitmapData(16, 16, true, 0);
_local3 = new Rectangle((_arg1 * 16), 0, 16, 16);
_local4 = new Point();
_local2.copyPixels(flameSheet, _local3, _local4, null, null, true);
return (_local2);
}
public function restart(_arg1:int):void{
var _local2:int;
frames = _arg1;
_local2 = Math.floor((frames / 2));
bitmapData = getImage(_local2);
}
}
}//package
Section 25
//FlameSheet (FlameSheet)
package {
import flash.display.*;
public dynamic class FlameSheet extends BitmapData {
public function FlameSheet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 26
//GameFont (GameFont)
package {
import flash.text.*;
public dynamic class GameFont extends Font {
}
}//package
Section 27
//GameScreen (GameScreen)
package {
import flash.display.*;
public class GameScreen extends Sprite {
public function GameScreen():void{
}
public function run():void{
}
}
}//package
Section 28
//GameText (GameText)
package {
import flash.display.*;
import flash.text.*;
public class GameText extends Sprite {
private var sField:TextField;
private var sFormat:TextFormat;
private var sField3:TextField;
private var sField2:TextField;
private var format:TextFormat;
private var field:TextField;
public function GameText(_arg1:String):void{
field = new TextField();
field.selectable = false;
field.autoSize = TextFieldAutoSize.LEFT;
field.embedFonts = true;
sField = new TextField();
sField.selectable = false;
sField.autoSize = TextFieldAutoSize.LEFT;
sField.embedFonts = true;
sField2 = new TextField();
sField2.selectable = false;
sField2.autoSize = TextFieldAutoSize.LEFT;
sField2.embedFonts = true;
sField3 = new TextField();
sField3.selectable = false;
sField3.autoSize = TextFieldAutoSize.LEFT;
sField3.embedFonts = true;
format = new TextFormat();
format.color = 0xFFFFFF;
format.font = new GameFont().fontName;
format.size = 16;
sFormat = new TextFormat();
sFormat.color = 0x202020;
sFormat.font = new GameFont().fontName;
sFormat.size = 16;
addChild(sField);
addChild(sField2);
addChild(sField3);
sField.x = 1;
sField2.y = 1;
sField3.x = (sField3.y = 1);
addChild(field);
setText(_arg1);
}
public function setTextSize(_arg1:int):void{
format.size = _arg1;
sFormat.size = _arg1;
field.setTextFormat(format);
sField.setTextFormat(sFormat);
sField2.setTextFormat(sFormat);
sField3.setTextFormat(sFormat);
}
public function setText(_arg1:String):void{
field.text = _arg1;
sField.text = _arg1;
sField2.text = _arg1;
sField3.text = _arg1;
field.setTextFormat(format);
sField.setTextFormat(sFormat);
sField2.setTextFormat(sFormat);
sField3.setTextFormat(sFormat);
}
}
}//package
Section 29
//GameText2 (GameText2)
package {
import flash.display.*;
import flash.text.*;
public class GameText2 extends Sprite {
private var format:TextFormat;
private var field:TextField;
public function GameText2(_arg1:String):void{
field = new TextField();
field.selectable = false;
field.autoSize = TextFieldAutoSize.LEFT;
field.embedFonts = true;
format = new TextFormat();
format.color = 0x202020;
format.font = new GameFont().fontName;
format.size = 16;
addChild(field);
setText(_arg1);
}
public function setTextSize(_arg1:int):void{
format.size = _arg1;
field.setTextFormat(format);
}
public function setText(_arg1:String):void{
field.text = _arg1;
field.setTextFormat(format);
}
}
}//package
Section 30
//Global (Global)
package {
import flash.media.*;
import flash.system.*;
public class Global {
public static var SOUNDOFF:Boolean = false;
public static var SCORENAME:Array = [0, 0, 0, 0, 0, 0, 0, 0];
public static var SPARKLESHEET:SparkleGraphic = new SparkleGraphic(0, 0);
public static var SOUNDSHIELDACTIVATE:SoundShieldActivate = new SoundShieldActivate();
public static var DIED:Boolean = false;
public static var SOUNDMENUCONFIRM:SoundMenuConfirm = new SoundMenuConfirm();
public static var SOUNDMUSICLOOP:SoundMusicLoop = new SoundMusicLoop();
public static var SOUNDENEMYDEATH:SoundEnemyDeath = new SoundEnemyDeath();
public static var BLINKRATE:int = 32;
public static var SOUNDDAMAGE:SoundDamage = new SoundDamage();
public static var MENUBUTTONS:MenuButtons = new MenuButtons(0, 0);
public static var TROPHYHANDLER:TrophyHandler = new TrophyHandler();
public static var SCALE:int = 3;
public static var GRAVITY:int = 1;
public static var BANKFLOOR:int = 0;
public static var MUSICOFF:Boolean = false;
public static var SOUNDPAUSE:SoundPause = new SoundPause();
public static var SOUNDGEMCOLLECTED:SoundGemCollected = new SoundGemCollected();
public static var TIMESTOP:Boolean = false;
public static var SOUNDPCJUMP:SoundPCJump = new SoundPCJump();
public static var TILESHEET:TileSheet = new TileSheet(0, 0);
public static var SOUNDTIMESTOPACTIVATE:SoundTimeStopActivate = new SoundTimeStopActivate();
public static var SCORESCREEN:int = 8;
public static var SOUNDGROUNDBREAK:SoundGroundBreak = new SoundGroundBreak();
public static var OPTIONSSCREEN:int = 7;
public static var MAPHANDLER:MapHandler;
public static var ANIMATIONS:Animations = new Animations(0, 0);
public static var SCORE:int = 0;
public static var COLLECTIBLES:Collectibles = new Collectibles(0, 0);
public static var SECTIONRANGE:int = 8;
public static var SOUNDMENULOOP:SoundMenuLoop = new SoundMenuLoop();
public static var CURRENTLOOP:int = 0;
public static var TROPHYSOCKETIMAGE:TrophySocketImage = new TrophySocketImage(0, 0);
public static var MAPSHEET:MapSheet = new MapSheet(0, 0);
public static var MENUSCREEN:int = 2;
public static var MEMORYCARD:MemoryCard = new MemoryCard();
public static var SOUNDSUMMONGEMS:SoundSummonGems = new SoundSummonGems();
public static var GAMEMODE:int = 0;
public static var GAMEH:int = 144;
public static var HANDHOLDSCREEN:int = 9;
public static var TROPHYSCREEN:int = 6;
public static var BLINKVISIBLE:Boolean = true;
public static var SOUNDMENUMOVE:SoundMenuMove = new SoundMenuMove();
public static var PLAYSCREEN:int = 3;
public static var ENTERVISIBLE:Boolean = true;
public static var TITLESCREEN:int = 0;
public static var GAMEW:int = 160;
public static var FRAMES:int = 1;
public static var CONTROLSSCREEN:int = 1;
public static var CONSECUTIVEGEMS:int = 0;
public static var MAINMENUBUTTONIMAGE:MainMenuButtonImage = new MainMenuButtonImage(0, 0);
public static var OPTIONBUTTONIMAGE:OptionButtonImage = new OptionButtonImage(0, 0);
public static var BANKSCORE:int = 0;
private static var main:Main;
public static var DEATHSCREEN:int = 5;
public static var SOUNDPLAYERDEATH:SoundPlayerDeath = new SoundPlayerDeath();
public static var SOUNDNMEJUMP:SoundNMEJump = new SoundNMEJump();
public static var SOUNDMENUCANCEL:SoundMenuCancel = new SoundMenuCancel();
public static var VICTORYSCREEN:int = 4;
public static var PLAYER:Player;
public static var FLOORS:int = 0;
public static var SOUNDSPRINGJUMP:SoundSpringJump = new SoundSpringJump();
public static var ENEMIESDODGED:int = 0;
public static var SOUNDITEMCOLLECTED:SoundItemCollected = new SoundItemCollected();
public static var FIRSTSCREEN:Boolean = false;
public static var SECTIONMOD:int = 12;
public static var TOWERSPD:int = 1000000;
public static function speedTower():void{
TOWERSPD--;
if (TOWERSPD < 1){
TOWERSPD = 1;
};
}
public static function init(_arg1:Main):void{
main = _arg1;
TROPHYHANDLER.setGoal("Wealthy", "score", 10000, false, "Earn $10,000 in a \nsingle game.");
TROPHYHANDLER.setGoal("Filthy Rich", "score", 25000, false, "Earn $25,000 in a \nsingle game.");
TROPHYHANDLER.setGoal("Miser", "score", 50000, false, "Earn $50,000 in a \nsingle game.");
TROPHYHANDLER.setGoal("Money McGee", "score", 100000, false, "Earn $100,000 in a \nsingle game.");
TROPHYHANDLER.setGoal("Warrior of Greed", "score", 250000, false, "Earn $250,000 in a \nsingle game.");
TROPHYHANDLER.setGoal("Banker", "score", 500000, true, "Earn $500,000 across \nall games.");
TROPHYHANDLER.setGoal("Investor", "score", 1000000, true, "Earn $1,000,000 \nacross all games.");
TROPHYHANDLER.setGoal("Bernie Madoff", "score", 2500000, true, "Earn $2,500,000 \nacross all games.");
TROPHYHANDLER.setGoal("Adventurer", "floors", 10, false, "Reach Floor 10.");
TROPHYHANDLER.setGoal("Expeditionist", "floors", 25, false, "Reach Floor 25.");
TROPHYHANDLER.setGoal("Tower Prowler", "floors", 50, false, "Reach Floor 50.");
TROPHYHANDLER.setGoal("Lord of the Tower", "floors", 100, false, "Reach Floor 100.");
TROPHYHANDLER.setGoal("Tower Climber", "floors", 250, true, "Traverse 250 floors \nacross all games.");
TROPHYHANDLER.setGoal("Stairs Master", "floors", 500, true, "Traverse 500 floors \nacross all games.");
TROPHYHANDLER.setGoal("One With The Tower", "floors", 1000, true, "Traverse 1000 floors \nacross all games.");
TROPHYHANDLER.setGoal("Enemy Death!", "enemieskilled", 1, false, "Kill an enemy.");
TROPHYHANDLER.setGoal("Death To Enemies!", "enemieskilled", 5, false, "Kill 5 enemies in a \nsingle game.");
TROPHYHANDLER.setGoal("Terminator", "enemieskilled", 10, false, "Kill 10 enemies in a \nsingle game.");
TROPHYHANDLER.setGoal("Small Pile", "enemieskilled", 25, true, "Kill 25 enemies \nacross all games.");
TROPHYHANDLER.setGoal("Medium Pile", "enemieskilled", 50, true, "Kill 50 enemies \nacross all games.");
TROPHYHANDLER.setGoal("Large Pile", "enemieskilled", 100, true, "Kill 100 enemies \nacross all games.");
TROPHYHANDLER.setGoal("Hold It!", "usehourglass", 1, false, "Use item: Hourglass.");
TROPHYHANDLER.setGoal("Can't Touch This!", "useshield", 1, false, "Use item: Shield.");
TROPHYHANDLER.setGoal("Die Die Die!", "useskull", 1, false, "Use item: Skull.");
TROPHYHANDLER.setGoal("Get Over Here!", "usegem", 1, false, "Use item: Gem Magnet.");
TROPHYHANDLER.setGoal("Variety King", "useall", 1, false, "Use each item in a \nsingle game.");
TROPHYHANDLER.setGoal("Utilizer", "useitem", 10, false, "Use 10 items in a \nsingle game.");
TROPHYHANDLER.setGoal("Item User", "useitem", 25, true, "Use 25 items across \nall games.");
TROPHYHANDLER.setGoal("Item Lover", "useitem", 50, true, "Use 50 items across \nall games.");
TROPHYHANDLER.setGoal("Master Of Items", "useitem", 100, true, "Use 100 items across \nall games.");
TROPHYHANDLER.setGoal("Greedy", "anygem", 100, false, "Collect 100 gems in \na single game.");
TROPHYHANDLER.setGoal("Greedy Collector", "anygem", 250, false, "Collect 250 gems in \na single game.");
TROPHYHANDLER.setGoal("Gem Collector", "anygem", 500, true, "Collect 500 gems \nacross all games.");
TROPHYHANDLER.setGoal("Gem Hoarder", "anygem", 1000, true, "Collect 1000 gems \nacross all games.");
TROPHYHANDLER.setGoal("Gem Specialist", "anygem", 2500, true, "Collect 2500 gems \nacross all games.");
TROPHYHANDLER.setGoal("Gem Enthusiast", "anygem", 5000, true, "Collect 5000 gems \nacross all games.");
TROPHYHANDLER.setGoal("Green Collector", "greengems", 100, true, "Collect 100 emeralds \nacross all games.");
TROPHYHANDLER.setGoal("Green Hoarder", "greengems", 250, true, "Collect 250 emeralds \nacross all games.");
TROPHYHANDLER.setGoal("Green Specialist", "greengems", 500, true, "Collect 500 emeralds \nacross all games.");
TROPHYHANDLER.setGoal("Green Enthusiast", "greengems", 1000, true, "Collect 1000 \nemeralds across all \ngames.");
TROPHYHANDLER.setGoal("Blue Collector", "bluegems", 25, true, "Collect 25 sapphires \nacross all games.");
TROPHYHANDLER.setGoal("Blue Hoarder", "bluegems", 50, true, "Collect 50 sapphires \nacross all games.");
TROPHYHANDLER.setGoal("Blue Specialist", "bluegems", 100, true, "Collect 100 \nsapphires across all \ngames.");
TROPHYHANDLER.setGoal("Blue Enthusiast", "bluegems", 250, true, "Collect 250 \nsapphires across all \ngames.");
TROPHYHANDLER.setGoal("White Collector", "whitegems", 1, true, "Collect a diamond.");
TROPHYHANDLER.setGoal("White Hoarder", "whitegems", 5, true, "Collect 5 diamonds \nacross all games.");
TROPHYHANDLER.setGoal("White Specialist", "whitegems", 10, true, "Collect 10 diamonds \nacross all games.");
TROPHYHANDLER.setGoal("White Enthusiast", "whitegems", 25, true, "Collect 25 diamonds \nacross all games.");
TROPHYHANDLER.setGoal("Item Swap", "replaceitem", 1, false, "Grab an item while \none remains in your \ninventory.");
TROPHYHANDLER.setGoal("Completist", "completist", 1, false, "Collect 50 gems \nbefore any leave the \nscreen.");
TROPHYHANDLER.setGoal("2 Birds, 1 Stone", "multikill", 1, false, "Kill 2 or more \nenemies at once.");
TROPHYHANDLER.setGoal("Parked Car", "taketimedamage", 1, false, "Get hit by an enemy \nwhile time is frozen.");
TROPHYHANDLER.setGoal("Razor's Edge", "spikewalk", 1, false, "Walk on spikes while \ninvincible.");
TROPHYHANDLER.setGoal("Nice Try", "wastegem", 1, false, "Use a Gem Magnet and \npull in absolutely \nnothing.");
TROPHYHANDLER.setGoal("Firing Blanks", "wasteskull", 1, false, "Use a Skull on \nabsolutely nothing.");
TROPHYHANDLER.setGoal("Close Call", "closecall", 1, false, "Get incredibly close \nto death below the \nscreen and live to \ntell the tale.");
TROPHYHANDLER.setGoal("Impatient much?", "forceup", 160, false, "Force the tower to \nrise for a while.");
TROPHYHANDLER.setGoal("Dodge Master", "dodgemaster", 1, false, "Encounter 10 enemies \nwithout being hit in \na single game.");
TROPHYHANDLER.setGoal("Clumsy", "takedamage", 10, false, "Get hit 10 times in \na single game.");
TROPHYHANDLER.setGoal("Heavy Stepping", "breakbricks", 50, true, "Break 50 breakable \nblocks across all \ngames");
TROPHYHANDLER.setGoal("10th Trophy", "trophies", 9, true, "Collect 9 trophies.");
TROPHYHANDLER.setGoal("25th Trophy", "trophies", 24, true, "Collect 24 trophies.");
TROPHYHANDLER.setGoal("50th Trophy", "trophies", 49, true, "Collect 49 trophies.");
TROPHYHANDLER.setGoal("The Final Trophy", "trophies", 63, true, "Collect all trophies.");
TROPHYHANDLER.loadData(MEMORYCARD);
}
public static function setEnterVisible():void{
ENTERVISIBLE = true;
}
public static function resetEnemiesDodged():void{
ENEMIESDODGED = 0;
}
public static function softResetGlobals():void{
FRAMES = 1;
TOWERSPD = 1000000;
ENTERVISIBLE = true;
CONSECUTIVEGEMS = 0;
}
public static function setGameMode(_arg1:int):void{
GAMEMODE = _arg1;
}
public static function toggleSound():void{
SOUNDOFF = (SOUNDOFF) ? false : true;
}
public static function playSound(_arg1:Sound):void{
if (!SOUNDOFF){
_arg1.play();
};
}
public static function resetConGems():void{
CONSECUTIVEGEMS = 0;
}
public static function modEnemiesDodged():void{
ENEMIESDODGED++;
if (ENEMIESDODGED >= 10){
TROPHYHANDLER.sendStat("dodgemaster", 1);
};
}
public static function setMapHandler(_arg1:MapHandler):void{
MAPHANDLER = _arg1;
}
public static function modConGems():void{
CONSECUTIVEGEMS++;
if (CONSECUTIVEGEMS >= 50){
TROPHYHANDLER.sendStat("completist", 1);
};
}
public static function setDied():void{
DIED = true;
}
public static function modRange():void{
SECTIONRANGE = (SECTIONRANGE + 4);
if (SECTIONRANGE > 24){
SECTIONRANGE = 24;
};
}
public static function changeLoop(_arg1:int):void{
if (CURRENTLOOP != _arg1){
CURRENTLOOP = _arg1;
Control.changeLoop(_arg1);
};
}
public static function setFirstScreen(_arg1:Boolean):void{
FIRSTSCREEN = _arg1;
}
public static function toggleMusic():void{
MUSICOFF = (MUSICOFF) ? false : true;
}
public static function toggleMute():void{
if (((SOUNDOFF) && (MUSICOFF))){
SOUNDOFF = false;
MUSICOFF = false;
} else {
SOUNDOFF = true;
MUSICOFF = true;
};
}
public static function modMod():void{
SECTIONMOD = (SECTIONMOD + 2);
if (SECTIONMOD > 40){
SECTIONMOD = 40;
};
}
public static function loadPolicy():void{
Security.loadPolicyFile("http://www.epicshadow.com/crossdomain.xml");
}
public static function bankScore():void{
SCORE = Math.floor((SCORE * 0.9));
BANKSCORE = SCORE;
BANKFLOOR = FLOORS;
}
public static function towerGo():void{
if (TOWERSPD >= 10){
TOWERSPD = 6;
};
ENTERVISIBLE = false;
}
public static function incrementFloor():void{
FLOORS++;
if (FLOORS > 1){
TROPHYHANDLER.sendStat("floors", 1);
};
}
public static function setPlayer(_arg1:Player):void{
PLAYER = _arg1;
}
public static function resetGlobals():void{
FLOORS = 0;
SCORE = 0;
SECTIONMOD = 12;
SECTIONRANGE = 8;
ENEMIESDODGED = 0;
BANKSCORE = 0;
BANKFLOOR = 0;
DIED = false;
softResetGlobals();
}
public static function setTimeStop(_arg1:Boolean):void{
TIMESTOP = _arg1;
}
public static function incrementFrames():void{
FRAMES++;
if ((FRAMES % BLINKRATE) == 0){
BLINKVISIBLE = (BLINKVISIBLE) ? false : true;
};
}
public static function setScoreName(_arg1:Array):void{
SCORENAME = _arg1;
}
public static function modifyScore(_arg1:int):void{
SCORE = (SCORE + _arg1);
TROPHYHANDLER.sendStat("score", _arg1);
}
}
}//package
Section 31
//HandHoldEnemies (HandHoldEnemies)
package {
import flash.display.*;
public dynamic class HandHoldEnemies extends BitmapData {
public function HandHoldEnemies(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 32
//HandHoldItems (HandHoldItems)
package {
import flash.display.*;
public dynamic class HandHoldItems extends BitmapData {
public function HandHoldItems(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 33
//HandHoldScreen (HandHoldScreen)
package {
import flash.display.*;
public class HandHoldScreen extends GameScreen {
public var bg:Bitmap;
public var screen:Bitmap;
public function HandHoldScreen():void{
addChild((bg = new Bitmap(new ControlsBackground(0, 0))));
bg.y = -16;
if (!Global.FIRSTSCREEN){
screen = new Bitmap(new HandHoldItems(0, 0));
Global.setFirstScreen(true);
} else {
switch (Toolkit.randomInt(1, 4)){
case 1:
screen = new Bitmap(new ControlsScreenImage(0, 0));
break;
case 2:
screen = new Bitmap(new HandHoldItems(0, 0));
break;
case 3:
screen = new Bitmap(new HandHoldEnemies(0, 0));
break;
case 4:
screen = new Bitmap(new HandHoldTiles(0, 0));
break;
};
};
addChild(screen);
}
override public function run():void{
bg.x--;
bg.y++;
if (bg.y == 0){
bg.x = 0;
bg.y = -16;
};
if (((((((Control.isKeyDown(Control.ENTER)) || (Control.isKeyDown(Control.CONFIRM)))) || (Control.isKeyDown(Control.CONFIRM2)))) || (Control.MOUSEDOWN))){
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setScreen(Global.PLAYSCREEN);
Control.setMouseDown(false);
};
if (((Control.isKeyDown(Control.POWERUP)) || (Control.isKeyDown(Control.POWERUP2)))){
Global.playSound(Global.SOUNDMENUCANCEL);
Control.setScreen(Global.MENUSCREEN);
};
}
}
}//package
Section 34
//HandHoldTiles (HandHoldTiles)
package {
import flash.display.*;
public dynamic class HandHoldTiles extends BitmapData {
public function HandHoldTiles(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 35
//KingButton (KingButton)
package {
import flash.display.*;
public dynamic class KingButton extends BitmapData {
public function KingButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 36
//KingLoaderMovie (KingLoaderMovie)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import com.midasplayer.*;
public class KingLoaderMovie extends Sprite {
private var gameStage:Stage;
private var mouseUpPoint:Point;
private var scale:int;// = 3
public var finished:Boolean;// = false
private var playBtn:Bitmap;
private var frames:int;// = 0
private var kingButton:Bitmap;
private var isMouseDown:Boolean;// = false
private var flameArray:Array;
private var mouseDownPoint:Point;
public function KingLoaderMovie(_arg1:Stage):void{
var _local2:int;
var _local3:FlameGraphic;
flameArray = new Array();
frames = 0;
mouseDownPoint = new Point();
mouseUpPoint = new Point();
isMouseDown = false;
scale = 3;
finished = false;
super();
gameStage = _arg1;
addChild((kingButton = new Bitmap(new KingButton(0, 0))));
kingButton.x = 48;
kingButton.y = 40;
kingButton.visible = false;
addChild((playBtn = new Bitmap(new PlayButton(0, 0))));
playBtn.x = 61;
playBtn.y = 76;
playBtn.visible = false;
_local2 = 0;
while (_local2 < 7) {
_local3 = new FlameGraphic();
_local3.x = (96 - (_local2 * 8));
_local3.y = 48;
if ((_local2 % 2) == 0){
_local3.y = (_local3.y - 8);
};
flameArray.push(_local3);
addChild(_local3);
_local2++;
};
_local2 = 0;
while (_local2 < 7) {
_local3 = new FlameGraphic();
_local3.x = (96 - (_local2 * 8));
_local3.y = 56;
if ((_local2 % 2) == 0){
_local3.y = (_local3.y - 8);
};
flameArray.push(_local3);
addChild(_local3);
_local2++;
};
gameStage.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
gameStage.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseUp);
}
public function destroy():void{
gameStage.removeEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
gameStage.removeEventListener(MouseEvent.MOUSE_DOWN, handleMouseUp);
}
public function run():void{
var _local1:int;
if (frames < flameArray.length){
flameArray[frames].restart(0);
};
frames++;
if (frames >= 16){
kingButton.visible = true;
};
if (frames >= 48){
playBtn.visible = true;
};
_local1 = 0;
while (_local1 < flameArray.length) {
flameArray[_local1].run();
_local1++;
};
}
private function handleMouseDown(_arg1:MouseEvent):void{
isMouseDown = true;
mouseDownPoint = new Point(_arg1.stageX, _arg1.stageY);
if ((((mouseDownPoint.x >= (48 * scale))) && ((mouseDownPoint.x <= (112 * scale))))){
if ((((mouseDownPoint.y >= (40 * scale))) && ((mouseDownPoint.y <= (72 * scale))))){
handleClick(0);
};
if ((((mouseDownPoint.y >= (76 * scale))) && ((mouseDownPoint.y <= (92 * scale))))){
handleClick(1);
};
};
}
private function handleClick(_arg1:int):void{
if (_arg1 == 0){
KingAPI.openLoaderMovieLink();
} else {
if (playBtn.visible){
finished = true;
};
};
}
private function handleMouseUp(_arg1:MouseEvent):void{
isMouseDown = false;
mouseUpPoint = new Point(_arg1.stageX, _arg1.stageY);
}
}
}//package
Section 37
//KingMiniButton (KingMiniButton)
package {
import flash.display.*;
public dynamic class KingMiniButton extends BitmapData {
public function KingMiniButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 38
//LetterCursor (LetterCursor)
package {
import flash.display.*;
public dynamic class LetterCursor extends BitmapData {
public function LetterCursor(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 39
//Main (Main)
package {
import flash.display.*;
public class Main extends Sprite {
public var trophyHandler:TrophyHandler;
public var gameStage:Stage;
private var screen:GameScreen;
public function Main(_arg1:Stage):void{
gameStage = _arg1;
Control.init(this);
Global.init(this);
trophyHandler = Global.TROPHYHANDLER;
setScreen(Global.TITLESCREEN);
scaleX = (scaleY = Global.SCALE);
}
public function setScreen(_arg1:Number):void{
if (screen != null){
removeChild(screen);
removeChild(trophyHandler);
};
switch (_arg1){
case Global.TITLESCREEN:
screen = new TitleScreen();
break;
case Global.CONTROLSSCREEN:
screen = new ControlsScreen();
break;
case Global.MENUSCREEN:
screen = new MenuScreen();
break;
case Global.PLAYSCREEN:
screen = new PlayScreen();
break;
case Global.VICTORYSCREEN:
screen = new VictoryScreen();
break;
case Global.DEATHSCREEN:
screen = new DeathScreen();
break;
case Global.TROPHYSCREEN:
screen = new TrophyScreen();
break;
case Global.OPTIONSSCREEN:
screen = new OptionsScreen();
break;
case Global.SCORESCREEN:
screen = new ScoreScreen();
break;
case Global.HANDHOLDSCREEN:
screen = new HandHoldScreen();
break;
};
addChild(screen);
addChild(trophyHandler);
}
public function run():void{
if (((!((screen == null))) && (!(Toolkit.SITELOCKED)))){
screen.run();
};
trophyHandler.run();
if (Control.isKeyDown(77)){
Global.toggleMute();
};
}
}
}//package
Section 40
//MainMenuButton (MainMenuButton)
package {
import flash.display.*;
import flash.geom.*;
public class MainMenuButton extends Bitmap {
public var activated:Boolean;// = false
public function MainMenuButton():void{
activated = false;
super();
setImage();
}
public function setImage():void{
bitmapData = getImage();
}
private function getImage():BitmapData{
var _local1:int;
var _local2:BitmapData;
var _local3:Rectangle;
var _local4:Point;
_local1 = (activated) ? 21 : 0;
_local2 = new BitmapData(173, 21, true, 0);
_local3 = new Rectangle(0, _local1, 173, 21);
_local4 = new Point();
_local2.copyPixels(Global.MAINMENUBUTTONIMAGE, _local3, _local4, null, null, true);
return (_local2);
}
}
}//package
Section 41
//MainMenuButtonImage (MainMenuButtonImage)
package {
import flash.display.*;
public dynamic class MainMenuButtonImage extends BitmapData {
public function MainMenuButtonImage(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 42
//MapBackground (MapBackground)
package {
import flash.display.*;
public dynamic class MapBackground extends Sprite {
}
}//package
Section 43
//MapHandler (MapHandler)
package {
import flash.display.*;
import flash.geom.*;
public class MapHandler {
private var tileLayer:Sprite;
public var offsetMap:int;// = 25
private var mapImg:Sprite;
public var dataArr:Array;
private var frames:int;// = 0
private var enemyLayer:Sprite;
public var enemies:Array;
public var offsetImg:int;// = 0
private var usedMaps:Array;
private var collectibleLayer:Sprite;
public var collectibles:Array;
private var dataImg:BitmapData;
public function MapHandler():void{
offsetMap = 25;
offsetImg = 0;
frames = 0;
super();
mapImg = new Sprite();
mapImg.addChild((tileLayer = new Sprite()));
mapImg.addChild((collectibleLayer = new Sprite()));
mapImg.addChild((enemyLayer = new Sprite()));
dataArr = Toolkit.create2DArray(10, 13);
dataImg = new BitmapData(10, 36, true, 0);
dataImg.copyPixels(getTileImage(10, 18, Global.MAPSHEET, Toolkit.randomInt(0, 3)), new Rectangle(0, 0, 10, 18), new Point(0, 0), null, null, true);
Global.incrementFloor();
collectibles = new Array();
enemies = new Array();
usedMaps = new Array();
swapMaps();
drawMap();
}
public function placeEnemy(_arg1:uint, _arg2:int, _arg3:int):void{
var _local4:int;
var _local5:int;
var _local6:Enemy;
_local4 = -1;
switch (_arg1){
case 2064191:
_local4 = 0;
break;
case 24351:
_local4 = 1;
break;
case 0x3F00:
_local4 = 2;
break;
};
_local5 = Math.floor((25 + (Global.FLOORS * 2.5)));
if ((((_local4 >= 0)) && ((Toolkit.randomInt(1, 100) <= _local5)))){
_local6 = new Enemy();
_local6.setType(_local4);
_local6.x = (_arg2 * 16);
_local6.y = ((_arg3 - 2) * 16);
enemyLayer.addChild(_local6);
enemies.push(_local6);
};
}
public function swapMaps():void{
var _local1:BitmapData;
_local1 = new BitmapData(10, 18, true, 0);
_local1.copyPixels(dataImg, new Rectangle(0, 0, 10, 18), new Point(0, 0), null, null, true);
dataImg.copyPixels(getTileImage(10, 18, Global.MAPSHEET, getStage()), new Rectangle(0, 0, 10, 18), new Point(0, 0), null, null, true);
dataImg.copyPixels(_local1, new Rectangle(0, 0, 10, 18), new Point(0, 18), null, null, true);
}
public function run():void{
var _local1:Array;
var _local2:int;
var _local3:int;
var _local4:int;
frames++;
_local1 = Toolkit.copyArray(enemies);
_local2 = 0;
while (_local2 < _local1.length) {
if (_local1[_local2] != null){
_local1[_local2].run();
};
_local2++;
};
if ((frames % 32) == 0){
Global.speedTower();
};
if ((frames % Global.TOWERSPD) == 0){
moveTower();
};
_local3 = 0;
while (_local3 < dataArr.length) {
_local4 = 0;
while (_local4 < dataArr[_local3].length) {
if (dataArr[_local3][_local4] != null){
dataArr[_local3][_local4].run();
};
_local4++;
};
_local3++;
};
}
public function removeCollectible(_arg1:Collectible, _arg2:Boolean):void{
var _local3:int;
if (_arg2){
Global.modifyScore(_arg1.bling);
switch (_arg1.type){
case 0:
Global.TROPHYHANDLER.sendStat("anygem", 1);
Global.TROPHYHANDLER.sendStat("greengems", 1);
Global.modConGems();
break;
case 1:
Global.TROPHYHANDLER.sendStat("anygem", 1);
Global.TROPHYHANDLER.sendStat("bluegems", 1);
Global.modConGems();
break;
case 2:
Global.TROPHYHANDLER.sendStat("anygem", 1);
Global.TROPHYHANDLER.sendStat("whitegems", 1);
Global.modConGems();
break;
};
} else {
if (_arg1.type < 3){
Global.resetConGems();
};
};
_local3 = 0;
while (_local3 < collectibles.length) {
if (collectibles[_local3] == _arg1){
collectibleLayer.removeChild(_arg1);
collectibles[_local3] = null;
_local3 = collectibles.length;
};
_local3++;
};
collectibles = Toolkit.cleanArray(collectibles);
}
public function getStage():int{
var _local1:int;
var _local2:int;
var _local3:Boolean;
var _local4:int;
var _local5:int;
Global.incrementFloor();
if ((Global.FLOORS % 5) == 0){
Global.modMod();
Global.modRange();
return (Toolkit.randomInt(4, 11));
};
_local1 = 0;
_local2 = 0;
_local3 = false;
while (((!(_local3)) && ((_local2 < 64)))) {
_local4 = 0;
_local1 = Toolkit.randomInt(Global.SECTIONMOD, ((Global.SECTIONMOD + Global.SECTIONRANGE) - 1));
_local5 = 0;
while (_local5 < usedMaps.length) {
if (_local1 == usedMaps[_local5]){
_local4++;
};
_local5++;
};
if (_local4 == 0){
_local3 = true;
};
_local2++;
};
usedMaps.push(_local1);
if (usedMaps.length > 8){
usedMaps[0] = null;
};
usedMaps = Toolkit.cleanArray(usedMaps);
return (_local1);
}
public function getTileImage(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:int):BitmapData{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Rectangle;
var _local9:Point;
var _local10:BitmapData;
_local5 = (_arg3.width / _arg1);
_local6 = (_arg4 % _local5);
_local7 = Math.floor((_arg4 / _local5));
_local8 = new Rectangle((_local6 * _arg1), (_local7 * _arg2), _arg1, _arg2);
_local9 = new Point(0, 0);
_local10 = new BitmapData(_arg1, _arg2, true, 0);
_local10.copyPixels(_arg3, _local8, _local9, null, null, true);
return (_local10);
}
public function getTile(_arg1:uint):BitmapData{
var _local2:int;
_local2 = -1;
switch (_arg1){
case 0:
_local2 = 4;
break;
case 0x5F5F5F:
_local2 = 0;
break;
case 0xBF3F00:
_local2 = 3;
break;
case 0xFF7F00:
_local2 = 7;
break;
case 16760639:
_local2 = 11;
break;
case 0xBFBFBF:
_local2 = 8;
break;
case 0x9F9F9F:
_local2 = 12;
break;
case 0xFF00CC:
_local2 = 14;
break;
case 0xBF00FF:
_local2 = 13;
break;
case 30719:
_local2 = 9;
break;
case 60159:
_local2 = 10;
break;
case 0xFFF600:
_local2 = 15;
break;
case 65309:
_local2 = 5;
break;
case 7601795:
_local2 = 1;
break;
case 0xFF0000:
_local2 = 6;
break;
case 16208209:
_local2 = 2;
break;
};
return (((_local2)<0) ? new BitmapData(16, 16, true, 0) : getTileImage(16, 16, Global.TILESHEET, _local2));
}
public function getImage():Sprite{
return (mapImg);
}
public function removeEnemy(_arg1:Enemy):void{
var _local2:int;
_local2 = 0;
while (_local2 < enemies.length) {
if (enemies[_local2] == _arg1){
enemyLayer.removeChild(_arg1);
enemies[_local2] = null;
_local2 = enemies.length;
Global.modEnemiesDodged();
};
_local2++;
};
enemies = Toolkit.cleanArray(enemies);
}
public function shift2DArray(_arg1:int):void{
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = Toolkit.copyArray(dataArr);
_local3 = (_local2.length - 1);
_local4 = 0;
while (_local4 < _local2[_local3].length) {
if (_local2[_local3][_local4] != null){
tileLayer.removeChild(_local2[_local3][_local4]);
};
_local4++;
};
_local5 = 0;
while (_local5 < _local2.length) {
if ((_local5 + 1) < _local2.length){
dataArr[(_local5 + 1)] = _local2[_local5];
};
_local5++;
};
}
public function getWalkable(_arg1:uint):Boolean{
switch (_arg1){
case 0:
return (false);
case 0x5F5F5F:
return (false);
};
return (true);
}
public function drawRow():void{
var _local1:int;
var _local2:uint;
var _local3:BitmapData;
var _local4:MapTile;
shift2DArray(1);
dataArr[0] = new Array(10);
_local1 = 0;
while (_local1 < 10) {
_local2 = dataImg.getPixel(_local1, offsetMap);
_local3 = getTile(_local2);
_local4 = new MapTile(_local3);
_local4.setColor(_local2);
tileLayer.addChild(_local4);
dataArr[0][_local1] = _local4;
_local4.x = (_local1 * 16);
_local4.y = (-2 * 16);
placeCollectible(_local2, _local1, 0);
placeEnemy(_local2, _local1, 0);
_local1++;
};
}
public function drawMap():void{
var _local1:int;
var _local2:int;
var _local3:uint;
var _local4:BitmapData;
var _local5:MapTile;
_local1 = 0;
while (_local1 < 13) {
_local2 = 0;
while (_local2 < 10) {
_local3 = dataImg.getPixel(_local2, (_local1 + offsetMap));
_local4 = getTile(_local3);
_local5 = new MapTile(_local4);
_local5.setColor(_local3);
tileLayer.addChild(_local5);
dataArr[_local1][_local2] = _local5;
_local5.x = (_local2 * 16);
_local5.y = ((_local1 - 2) * 16);
placeCollectible(_local3, _local2, _local1);
placeEnemy(_local3, _local2, _local1);
_local2++;
};
_local1++;
};
}
public function placeCollectible(_arg1:uint, _arg2:int, _arg3:int):void{
var _local4:int;
var _local5:BitmapData;
var _local6:Collectible;
_local4 = -1;
switch (_arg1){
case 8363967:
_local4 = 0;
break;
case 4153215:
_local4 = 1;
break;
case 7999:
_local4 = 2;
break;
case 11778416:
_local4 = 3;
break;
};
if (_local4 >= 0){
_local5 = getTileImage(16, 16, Global.COLLECTIBLES, _local4);
_local6 = new Collectible(_local5);
_local6.setType(_local4);
_local6.x = (_arg2 * 16);
_local6.y = ((_arg3 - 2) * 16);
collectibleLayer.addChild(_local6);
collectibles.push(_local6);
};
}
public function moveTower():void{
var _local1:int;
var _local2:Array;
var _local3:int;
var _local4:Array;
var _local5:int;
var _local6:int;
offsetImg++;
_local1 = 0;
while (_local1 < dataArr.length) {
_local6 = 0;
while (_local6 < dataArr[_local1].length) {
dataArr[_local1][_local6].y++;
_local6++;
};
_local1++;
};
_local2 = Toolkit.copyArray(collectibles);
_local3 = 0;
while (_local3 < _local2.length) {
if (_local2[_local3] != null){
_local2[_local3].y++;
if (_local2[_local3].y > 192){
removeCollectible(_local2[_local3], false);
};
};
_local3++;
};
_local4 = Toolkit.copyArray(enemies);
_local5 = 0;
while (_local5 < _local4.length) {
if (_local4[_local5] != null){
_local4[_local5].y++;
if (_local4[_local5].y > 192){
removeEnemy(_local4[_local5]);
};
};
_local5++;
};
if (offsetImg >= 16){
offsetImg = (offsetImg - 16);
offsetMap--;
if (offsetMap <= 5){
offsetMap = 23;
swapMaps();
};
drawRow();
};
}
}
}//package
Section 44
//MapSheet (MapSheet)
package {
import flash.display.*;
public dynamic class MapSheet extends BitmapData {
public function MapSheet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 45
//MapTile (MapTile)
package {
import flash.display.*;
import flash.geom.*;
public class MapTile extends Bitmap {
public var spring:Boolean;// = false
public var playerhit:Boolean;// = false
public var ladder:Boolean;// = false
public var treadDir:int;// = 0
public var treadmill:Boolean;// = false
public var spikes:Boolean;// = false
public var cloud:Boolean;// = false
public var blinkCloud:Boolean;// = false
public var current:int;// = 0
public var breakTimer:int;// = 16
public var frames:int;// = 0
public var door:Boolean;// = false
public var blinkSolid:Boolean;// = false
public var walkable:Boolean;// = true
public var sequence:Array;// = null
public var struck:Boolean;// = false
public var breakable:Boolean;// = false
public function MapTile(_arg1:BitmapData):void{
walkable = true;
cloud = false;
ladder = false;
spring = false;
treadmill = false;
treadDir = 0;
spikes = false;
blinkCloud = false;
blinkSolid = false;
breakable = false;
struck = false;
frames = 0;
breakTimer = 16;
door = false;
playerhit = false;
sequence = null;
current = 0;
super();
bitmapData = _arg1;
}
private function setImage(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Rectangle;
var _local6:Point;
_local2 = 4;
_local3 = (_arg1 % _local2);
_local4 = Math.floor((_arg1 / _local2));
_local5 = new Rectangle((_local3 * 16), (_local4 * 16), 16, 16);
_local6 = new Point(0, 0);
bitmapData = new BitmapData(16, 16, true, 0);
bitmapData.copyPixels(Global.ANIMATIONS, _local5, _local6, null, null, true);
}
public function setColor(_arg1:uint):void{
switch (_arg1){
case 0:
walkable = false;
break;
case 0x5F5F5F:
cloud = true;
break;
case 0xBF3F00:
cloud = true;
ladder = true;
break;
case 0xFF7F00:
ladder = true;
break;
case 16760639:
ladder = true;
break;
case 0xFF00CC:
walkable = false;
spikes = true;
break;
case 0xBF00FF:
walkable = false;
spikes = true;
break;
case 30719:
cloud = true;
treadmill = true;
treadDir = -1;
sequence = [12, 13, 14, 15];
break;
case 60159:
cloud = true;
treadmill = true;
treadDir = 1;
sequence = [8, 9, 10, 11];
break;
case 0xFFF600:
cloud = true;
spring = true;
sequence = [16, 17, 18, 19, 18, 17];
break;
case 65309:
walkable = false;
blinkSolid = true;
break;
case 7601795:
cloud = true;
blinkCloud = true;
break;
case 0xFF0000:
walkable = false;
breakable = true;
sequence = [4, 5, 6, 7];
break;
case 16208209:
cloud = true;
breakable = true;
sequence = [0, 1, 2, 3];
break;
case 0x9F9F9F:
door = true;
break;
};
}
public function run():void{
frames++;
if (sequence != null){
if (((!((current == 0))) || (treadmill))){
current++;
if (current > (sequence.length - 1)){
current = 0;
};
setImage(sequence[current]);
};
};
if (blinkSolid){
if (Global.BLINKVISIBLE){
walkable = false;
visible = true;
} else {
walkable = true;
visible = false;
};
};
if (blinkCloud){
if (Global.BLINKVISIBLE){
cloud = true;
visible = true;
} else {
cloud = false;
visible = false;
};
};
if (((breakable) && (struck))){
if ((breakTimer - frames) == 3){
current = 1;
};
if ((frames % breakTimer) == 0){
if (visible){
Global.playSound(Global.SOUNDGROUNDBREAK);
};
walkable = true;
cloud = false;
visible = false;
breakable = false;
if (playerhit){
Global.TROPHYHANDLER.sendStat("breakbricks", 1);
};
};
};
}
public function hit(_arg1:Entity):void{
if (spring){
current = 1;
};
if (((breakable) && (!(struck)))){
frames = 1;
struck = true;
playerhit = _arg1.pc;
};
}
}
}//package
Section 46
//Marquee (Marquee)
package {
import flash.display.*;
public class Marquee extends Sprite {
public var range:int;// = 24
public var pos:int;// = 0
public var key:int;// = 0
public var marqueeText:GameText;
public var frames:int;// = 0
public var texts:Array;
public function Marquee():void{
range = 24;
frames = 0;
pos = 0;
key = 0;
texts = [" Escape the tower with as much treasure as you can!", " Play until you fall from the tower. Use exit doors to bank your treasure!", " View the top 10 scores for each game mode!", " View which trophies you have collected!", " Configure sound options or erase your saved data!", " Download this game for your website!", " Play more games at King.com!"];
super();
addChild((marqueeText = new GameText("")));
}
public function getMarquee():String{
var _local1:String;
frames++;
if ((frames % 6) == 0){
pos++;
};
if ((frames % 3) == 0){
marqueeText.x = ((marqueeText.x)==0) ? -3 : 0;
};
_local1 = texts[key].substr(pos, range);
if (_local1.length <= 0){
pos = 0;
};
return (_local1);
}
public function run():void{
marqueeText.setText(getMarquee());
}
public function setText(_arg1:int):void{
if (key != _arg1){
key = _arg1;
pos = 0;
};
}
}
}//package
Section 47
//MemoryCard (MemoryCard)
package {
import flash.net.*;
public class MemoryCard {
public var sharedObject:SharedObject;
public var trophies:Array;
public var datatypes:Array;
public function MemoryCard():void{
sharedObject = SharedObject.getLocal("tower-of-greed");
}
public function loadData():Array{
return (new Array(sharedObject.data.datatypes, sharedObject.data.trophies, sharedObject.data.scoreName));
}
public function saveData(_arg1:Array, _arg2:Array):void{
var _local3:Object;
var _local4:*;
var _local5:int;
datatypes = new Array();
for (_local4 in _arg1) {
_local3 = new Object();
_local3.dataname = _local4;
_local3.amount = _arg1[_local4];
datatypes.push(_local3);
};
trophies = new Array();
_local5 = 0;
while (_local5 < _arg2.length) {
_local3 = new Object();
_local3.trophyname = _arg2[_local5].trophyName;
_local3.achieved = _arg2[_local5].achieved;
trophies.push(_local3);
_local5++;
};
sharedObject.data.datatypes = datatypes;
sharedObject.data.trophies = trophies;
sharedObject.data.scoreName = Toolkit.copyArray(Global.SCORENAME);
sharedObject.flush();
}
}
}//package
Section 48
//MenuBackground (MenuBackground)
package {
import flash.display.*;
public dynamic class MenuBackground extends BitmapData {
public function MenuBackground(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 49
//MenuButtons (MenuButtons)
package {
import flash.display.*;
public dynamic class MenuButtons extends BitmapData {
public function MenuButtons(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 50
//MenuCursor (MenuCursor)
package {
import flash.display.*;
public dynamic class MenuCursor extends BitmapData {
public function MenuCursor(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 51
//MenuHero (MenuHero)
package {
import flash.display.*;
public class MenuHero extends Sprite {
public var blinking:Boolean;// = false
public var eyesClosed:MenuHeroEyesBlink;
public var mhEyes:Bitmap;
public var frames:int;// = 1
public var menuHeroBMP:Bitmap;
public var eyesOpen:MenuHeroEyes;
public var sPos:int;// = 18
public var cPos:int;// = 0
public function MenuHero():void{
cPos = 0;
sPos = 18;
frames = 1;
blinking = false;
eyesOpen = new MenuHeroEyes(0, 0);
eyesClosed = new MenuHeroEyesBlink(0, 0);
super();
addChild((menuHeroBMP = new Bitmap(new MenuHeroBMP(0, 0))));
addChild((mhEyes = new Bitmap(new MenuHeroEyes(0, 0))));
mhEyes.x = 9;
mhEyes.y = sPos;
}
public function blink():void{
frames = 1;
blinking = true;
removeChild(mhEyes);
addChild((mhEyes = new Bitmap(eyesClosed)));
mhEyes.x = 9;
mhEyes.y = (sPos + cPos);
}
public function setPos(_arg1:int):void{
cPos = _arg1;
}
public function run():void{
frames++;
if (((((frames % 8) == 0)) && (blinking))){
blinking = false;
removeChild(mhEyes);
addChild((mhEyes = new Bitmap(eyesOpen)));
mhEyes.x = 9;
mhEyes.y = (sPos + cPos);
};
if (((((frames % 16) == 0)) && (!(blinking)))){
if (Toolkit.randomInt(1, 100) <= 10){
blink();
};
};
mhEyes.y = (sPos + cPos);
}
}
}//package
Section 52
//MenuHeroBMP (MenuHeroBMP)
package {
import flash.display.*;
public dynamic class MenuHeroBMP extends BitmapData {
public function MenuHeroBMP(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 53
//MenuHeroEyes (MenuHeroEyes)
package {
import flash.display.*;
public dynamic class MenuHeroEyes extends BitmapData {
public function MenuHeroEyes(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 54
//MenuHeroEyesBlink (MenuHeroEyesBlink)
package {
import flash.display.*;
public dynamic class MenuHeroEyesBlink extends BitmapData {
public function MenuHeroEyesBlink(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 55
//MenuItem (MenuItem)
package {
import flash.display.*;
import flash.geom.*;
public class MenuItem extends Bitmap {
public function MenuItem():void{
setImage(0);
}
public function setImage(_arg1:int):void{
bitmapData = getImage(_arg1);
}
private function getImage(_arg1:int):BitmapData{
var _local2:int;
var _local3:BitmapData;
var _local4:Rectangle;
var _local5:Point;
_local2 = (_arg1 * 17);
_local3 = new BitmapData(81, 17, true, 0);
_local4 = new Rectangle(0, _local2, 81, 17);
_local5 = new Point();
_local3.copyPixels(Global.MENUBUTTONS, _local4, _local5, null, null, true);
return (_local3);
}
}
}//package
Section 56
//MenuScreen (MenuScreen)
package {
import flash.display.*;
import com.midasplayer.*;
public class MenuScreen extends GameScreen {
public var cursorPos:int;// = 0
public var marquee:Marquee;
public var enterText:GameText;
public var buttons:Array;
public var menuCursor:Bitmap;
public var frames:int;// = 0
public var kingButton:Bitmap;
public var demoText:GameText;
public var menuBG:Bitmap;
public var menuHero:MenuHero;
public function MenuScreen():void{
var _local1:int;
var _local2:MenuItem;
cursorPos = 0;
frames = 0;
super();
Global.changeLoop(0);
addChild((menuBG = new Bitmap(new MenuBackground(0, 0))));
menuBG.y = -16;
addChild((menuHero = new MenuHero()));
menuHero.x = ((160 - menuHero.width) - 2);
menuHero.y = ((144 - menuHero.height) - 2);
buttons = new Array();
_local1 = 0;
while (_local1 < 7) {
_local2 = new MenuItem();
_local2.x = 8;
_local2.y = ((_local1 * 16) + 8);
_local2.setImage(_local1);
buttons.push(_local2);
addChild(_local2);
_local1++;
};
addChild((menuCursor = new Bitmap(new MenuCursor(0, 0))));
menuCursor.x = 4;
menuCursor.y = 12;
addChild((marquee = new Marquee()));
marquee.x = -2;
marquee.y = 128;
addChild((kingButton = new Bitmap(new KingMiniButton(0, 0))));
kingButton.x = ((160 - kingButton.width) - 1);
kingButton.y = 1;
}
public function sortButtons():void{
var _local1:int;
_local1 = 0;
while (_local1 < buttons.length) {
buttons[_local1].x = 8;
if (_local1 == cursorPos){
buttons[_local1].x = 16;
};
_local1++;
};
menuCursor.y = ((cursorPos * 16) + 12);
}
public function menuSelect():void{
switch (cursorPos){
case 0:
Global.resetGlobals();
Global.setGameMode(0);
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setScreen(Global.HANDHOLDSCREEN);
break;
case 1:
Global.resetGlobals();
Global.setGameMode(1);
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setScreen(Global.HANDHOLDSCREEN);
break;
case 2:
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setScreen(Global.SCORESCREEN);
break;
case 3:
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setScreen(Global.TROPHYSCREEN);
break;
case 4:
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setScreen(Global.OPTIONSSCREEN);
break;
case 5:
Global.playSound(Global.SOUNDMENUCONFIRM);
KingAPI.openAddToWebsiteLink();
break;
case 6:
Global.playSound(Global.SOUNDMENUCONFIRM);
KingAPI.openOtherGamesLink();
break;
};
}
override public function run():void{
var _local1:int;
menuBG.x--;
menuBG.y++;
if (menuBG.y == 0){
menuBG.x = 0;
menuBG.y = -16;
};
marquee.setText(cursorPos);
marquee.run();
frames++;
if (((Control.isKeyDown(Control.UP)) || (Control.isKeyDown(Control.UP2)))){
cursorPos--;
if (cursorPos < 0){
cursorPos = (buttons.length - 1);
};
Global.playSound(Global.SOUNDMENUMOVE);
};
if (((Control.isKeyDown(Control.DOWN)) || (Control.isKeyDown(Control.DOWN2)))){
cursorPos++;
if (cursorPos > (buttons.length - 1)){
cursorPos = 0;
};
Global.playSound(Global.SOUNDMENUMOVE);
};
_local1 = 0;
while (_local1 < buttons.length) {
if ((((Control.MOUSEPOINT.x >= (buttons[_local1].x * Global.SCALE))) && ((Control.MOUSEPOINT.x < (((buttons[_local1].x + buttons[_local1].width) - 1) * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (buttons[_local1].y * Global.SCALE))) && ((Control.MOUSEPOINT.y < (((buttons[_local1].y + buttons[_local1].height) - 1) * Global.SCALE))))){
if (cursorPos != _local1){
cursorPos = _local1;
Global.playSound(Global.SOUNDMENUMOVE);
};
if (Control.MOUSEDOWN){
menuSelect();
Control.setMouseDown(false);
};
};
};
_local1++;
};
if (Control.MOUSEDOWN){
if ((((Control.MOUSEPOINT.x >= (kingButton.x * Global.SCALE))) && ((Control.MOUSEPOINT.x < ((kingButton.x + kingButton.width) * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (kingButton.y * Global.SCALE))) && ((Control.MOUSEPOINT.y < ((kingButton.y + kingButton.height) * Global.SCALE))))){
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setMouseDown(false);
KingAPI.openOtherGamesLink();
};
};
};
sortButtons();
menuHero.setPos(cursorPos);
menuHero.run();
if (((((Control.isKeyDown(Control.ENTER)) || (Control.isKeyDown(Control.CONFIRM)))) || (Control.isKeyDown(Control.CONFIRM2)))){
menuSelect();
};
if (((Control.isKeyDown(Control.POWERUP)) || (Control.isKeyDown(Control.POWERUP2)))){
Global.playSound(Global.SOUNDMENUCANCEL);
Global.resetGlobals();
Control.setScreen(Global.TITLESCREEN);
};
}
}
}//package
Section 57
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 58
//OptionButton (OptionButton)
package {
import flash.display.*;
import flash.geom.*;
public class OptionButton extends Bitmap {
public var activated:Boolean;// = false
public function OptionButton():void{
activated = false;
super();
setImage();
}
public function setImage():void{
bitmapData = getImage();
}
private function getImage():BitmapData{
var _local1:int;
var _local2:BitmapData;
var _local3:Rectangle;
var _local4:Point;
_local1 = (activated) ? 21 : 0;
_local2 = new BitmapData(125, 21, true, 0);
_local3 = new Rectangle(0, _local1, 125, 21);
_local4 = new Point();
_local2.copyPixels(Global.OPTIONBUTTONIMAGE, _local3, _local4, null, null, true);
return (_local2);
}
}
}//package
Section 59
//OptionButtonImage (OptionButtonImage)
package {
import flash.display.*;
public dynamic class OptionButtonImage extends BitmapData {
public function OptionButtonImage(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 60
//OptionsBackground (OptionsBackground)
package {
import flash.display.*;
public dynamic class OptionsBackground extends BitmapData {
public function OptionsBackground(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 61
//OptionsHeading (OptionsHeading)
package {
import flash.display.*;
public dynamic class OptionsHeading extends BitmapData {
public function OptionsHeading(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 62
//OptionsScreen (OptionsScreen)
package {
import flash.display.*;
public class OptionsScreen extends GameScreen {
public var cursorPos:int;// = 0
public var textArray:Array;
public var cursor:Bitmap;
public var buttonArray:Array;
public var textValueArray:Array;
public var optionsHeading:Bitmap;
public var menuBG:Bitmap;
public function OptionsScreen():void{
var _local1:int;
var _local2:MainMenuButton;
var _local3:OptionButton;
var _local4:GameText2;
textValueArray = ["Sound: On", "Music: On", "Erase Data?"];
cursorPos = 0;
super();
addChild((menuBG = new Bitmap(new OptionsBackground(0, 0))));
menuBG.y = -16;
addChild((optionsHeading = new Bitmap(new OptionsHeading(0, 0))));
optionsHeading.x = (optionsHeading.y = 4);
addChild((cursor = new Bitmap(new MenuCursor(0, 0))));
cursor.x = 12;
cursor.y = 38;
buttonArray = new Array();
textArray = new Array();
_local1 = 0;
while (_local1 < 3) {
_local3 = new OptionButton();
addChild(_local3);
_local3.x = 22;
_local3.y = (32 + (_local1 * 24));
buttonArray.push(_local3);
_local4 = new GameText2(textValueArray[_local1]);
addChild(_local4);
_local4.x = 26;
_local4.y = (34 + (_local1 * 24));
textArray.push(_local4);
_local1++;
};
_local2 = new MainMenuButton();
addChild(_local2);
_local2.x = 84;
_local2.y = 120;
buttonArray.push(_local2);
}
public function moveCursor(_arg1:int):void{
cursorPos = (cursorPos + _arg1);
if (cursorPos < 0){
cursorPos = (cursorPos + 4);
};
if (cursorPos > 3){
cursorPos = (cursorPos - 4);
};
Global.playSound(Global.SOUNDMENUMOVE);
}
override public function run():void{
var _local1:int;
var _local2:int;
menuBG.x--;
menuBG.y++;
if (menuBG.y == 0){
menuBG.x = 0;
menuBG.y = -16;
};
cursor.x = (buttonArray[cursorPos].x - 12);
cursor.y = (buttonArray[cursorPos].y + 6);
_local1 = 0;
while (_local1 < buttonArray.length) {
buttonArray[_local1].activated = false;
_local1++;
};
buttonArray[cursorPos].activated = true;
_local2 = 0;
while (_local2 < buttonArray.length) {
buttonArray[_local2].setImage();
_local2++;
};
if (Global.SOUNDOFF){
textArray[0].setText("Sound: Off");
} else {
textArray[0].setText("Sound: On");
};
if (Global.MUSICOFF){
textArray[1].setText("Music: Off");
} else {
textArray[1].setText("Music: On");
};
_local1 = 0;
while (_local1 < buttonArray.length) {
if ((((((((Control.MOUSEPOINT.x > (buttonArray[_local1].x * Global.SCALE))) && ((Control.MOUSEPOINT.x < ((buttonArray[_local1].x + buttonArray[_local1].width) * Global.SCALE))))) && ((Control.MOUSEPOINT.y > (buttonArray[_local1].y * Global.SCALE))))) && ((Control.MOUSEPOINT.y < ((buttonArray[_local1].y + buttonArray[_local1].height) * Global.SCALE))))){
if (cursorPos != _local1){
cursorPos = _local1;
Global.playSound(Global.SOUNDMENUMOVE);
};
};
_local1++;
};
if (((Control.isKeyDown(Control.UP)) || (Control.isKeyDown(Control.UP2)))){
moveCursor(-1);
};
if (((Control.isKeyDown(Control.DOWN)) || (Control.isKeyDown(Control.DOWN2)))){
moveCursor(1);
};
if (((Control.isKeyDown(Control.POWERUP)) || (Control.isKeyDown(Control.POWERUP2)))){
cancel();
};
if (((((((Control.isKeyDown(Control.CONFIRM)) || (Control.isKeyDown(Control.CONFIRM2)))) || (Control.isKeyDown(Control.ENTER)))) || (Control.MOUSEDOWN))){
confirm();
Control.setMouseDown(false);
};
}
public function cancel():void{
Global.playSound(Global.SOUNDMENUCANCEL);
Global.resetGlobals();
Control.setScreen(Global.MENUSCREEN);
}
public function confirm():void{
switch (cursorPos){
case 0:
Global.toggleSound();
break;
case 1:
Global.toggleMusic();
break;
case 2:
Global.TROPHYHANDLER.clearData();
textArray[2].setText("Data cleared!");
break;
case 3:
Control.setScreen(Global.MENUSCREEN);
break;
};
Global.playSound(Global.SOUNDMENUCONFIRM);
}
}
}//package
Section 63
//PauseMenu (PauseMenu)
package {
import flash.display.*;
public dynamic class PauseMenu extends BitmapData {
public function PauseMenu(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 64
//PlayButton (PlayButton)
package {
import flash.display.*;
public dynamic class PlayButton extends BitmapData {
public function PlayButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 65
//Player (Player)
package {
public class Player extends Entity {
public var moving:Boolean;// = false
public var animation:int;// = 0
public var animmod:int;// = 0
public var frames:int;// = 1
public var facing:int;// = 1
public function Player():void{
facing = 1;
frames = 1;
animation = 0;
animmod = 0;
moving = false;
super();
Global.setPlayer(this);
pc = true;
gotoAndStop(1);
}
public function setInvincible():void{
frames = 1;
invincible = true;
invincibletimer = 192;
}
public function takeTimeDamage():void{
if (((!(takingDamage)) && (!(invincible)))){
frames = 1;
velocity = -(Math.ceil((maxVel * 0.5)));
jumping = true;
onLadder = false;
takingDamage = true;
Global.playSound(Global.SOUNDDAMAGE);
Global.TROPHYHANDLER.sendStat("taketimedamage", 1);
Global.resetEnemiesDodged();
};
}
override public function run():void{
if (y < 72){
Global.towerGo();
};
velocity = (velocity + Global.GRAVITY);
if (velocity > maxVel){
velocity = maxVel;
};
moving = false;
if ((animation % 4) == 0){
animmod = ((animmod)==0) ? 1 : 0;
};
if (!takingDamage){
if (((((((Control.isKeyDown(Control.UP)) || (Control.isKeyDown(Control.UP2)))) || (Control.isKeyHeld(Control.UP)))) || (Control.isKeyHeld(Control.UP2)))){
moveChar(0, -1, false, true, false);
moving = true;
} else {
ladderLock = false;
};
if (((((((Control.isKeyDown(Control.LEFT)) || (Control.isKeyDown(Control.LEFT2)))) || (Control.isKeyHeld(Control.LEFT)))) || (Control.isKeyHeld(Control.LEFT2)))){
if (!ladderLock){
moveChar(-1, 0, false, false, false);
gotoAndStop((3 + animmod));
facing = -1;
moving = true;
};
};
if (((((((Control.isKeyDown(Control.RIGHT)) || (Control.isKeyDown(Control.RIGHT2)))) || (Control.isKeyHeld(Control.RIGHT)))) || (Control.isKeyHeld(Control.RIGHT2)))){
if (!ladderLock){
moveChar(1, 0, false, false, false);
gotoAndStop((1 + animmod));
facing = 1;
moving = true;
};
};
if (((((((((((((((!(Control.isKeyDown(Control.RIGHT))) && (!(Control.isKeyDown(Control.RIGHT2))))) && (!(Control.isKeyDown(Control.LEFT))))) && (!(Control.isKeyDown(Control.LEFT2))))) && (!(Control.isKeyHeld(Control.RIGHT))))) && (!(Control.isKeyHeld(Control.RIGHT2))))) && (!(Control.isKeyHeld(Control.LEFT))))) && (!(Control.isKeyHeld(Control.LEFT2))))){
ladderLock = false;
};
if (((((((Control.isKeyDown(Control.DOWN)) || (Control.isKeyDown(Control.DOWN2)))) || (Control.isKeyHeld(Control.DOWN)))) || (Control.isKeyHeld(Control.DOWN2)))){
moveChar(0, 1, false, true, false);
moving = true;
};
if (onLadder){
if (moving){
gotoAndStop((5 + animmod));
};
} else {
if (currentFrame >= 5){
if (facing > 0){
gotoAndStop((1 + animmod));
};
if (facing < 0){
gotoAndStop((3 + animmod));
};
};
};
if (((((Control.isKeyDown(Control.CONFIRM)) || (Control.isKeyDown(Control.CONFIRM2)))) && (!(jumping)))){
jump();
};
if (((((Control.isKeyDown(Control.POWERUP)) || (Control.isKeyDown(Control.POWERUP2)))) || (Control.isKeyDown(Control.POWERUP3)))){
environment.usePowerUp();
};
if (moving){
animation++;
};
} else {
moveChar(-(facing), 0, false, false, false);
frames++;
visible = (visible) ? false : true;
if (((((frames % 8) == 0)) && (!(jumping)))){
frames = 1;
takingDamage = false;
invincible = true;
invincibletimer = 32;
visible = true;
};
};
if (invincible){
frames++;
visible = (visible) ? false : true;
if ((frames % invincibletimer) == 0){
frames = 1;
invincible = false;
visible = true;
};
};
fall();
if (y > 176){
Global.playSound(Global.SOUNDPLAYERDEATH);
Global.setDied();
if (Global.GAMEMODE == 0){
Control.setScreen(Global.DEATHSCREEN);
} else {
if ((((Global.BANKSCORE == 0)) || ((Global.BANKFLOOR == 0)))){
Control.setScreen(Global.DEATHSCREEN);
} else {
Control.setScreen(Global.VICTORYSCREEN);
};
};
};
}
override public function takeDamage():void{
if (((!(takingDamage)) && (!(invincible)))){
frames = 1;
velocity = -(Math.ceil((maxVel * 0.5)));
jumping = true;
onLadder = false;
takingDamage = true;
Global.playSound(Global.SOUNDDAMAGE);
Global.TROPHYHANDLER.sendStat("takedamage", 1);
Global.resetEnemiesDodged();
};
}
}
}//package
Section 66
//PlayScreen (PlayScreen)
package {
import flash.display.*;
import com.midasplayer.*;
public class PlayScreen extends GameScreen {
public var pauseArray:Array;
public var cursorPos:int;// = 0
public var powerUpDisplay:PowerUpDisplay;
public var jumping:Boolean;// = true
public var cursorMax:int;// = 2
public var doorMenu:DoorMenu;
public var continueTxt:GameText2;
public var pauseHeld:Boolean;// = false
public var gravity:int;// = 1
public var mapImage:Sprite;
public var mapHandler:MapHandler;
public var timestop:Boolean;// = false
public var moreGamesTxt:GameText2;
public var cursor:Bitmap;
public var survivalClock:int;// = 0
public var timestopper:int;// = 0
public var pauseMenu:Bitmap;
public var powerUp:int;// = 0
public var scoreTxt:GameText;
public var mainMenuTxt:GameText2;
public var maxVel:int;// = 12
public var frames:int;// = 0
public var kingButton:Bitmap;
public var mapBackground:MapBackground;
public var gamePaused:Boolean;// = false
public var floorTxt:GameText;
public var velocity:int;// = 0
public var player:Player;
public function PlayScreen():void{
frames = 0;
jumping = true;
velocity = 0;
gravity = 1;
maxVel = 12;
floorTxt = new GameText("F-1");
scoreTxt = new GameText(("$" + String(Global.SCORE)));
continueTxt = new GameText2("");
mainMenuTxt = new GameText2("");
moreGamesTxt = new GameText2("");
pauseArray = new Array(continueTxt, mainMenuTxt, moreGamesTxt);
cursorPos = 0;
cursorMax = 2;
powerUpDisplay = new PowerUpDisplay();
powerUp = 0;
timestop = false;
timestopper = 0;
gamePaused = false;
pauseHeld = false;
survivalClock = 0;
super();
Global.changeLoop(1);
Global.setMapHandler((mapHandler = new MapHandler()));
addChild((mapBackground = new MapBackground()));
addChild((mapImage = mapHandler.getImage()));
addChild((player = new Player()));
addChild(floorTxt);
addChild(scoreTxt);
addChild(powerUpDisplay);
addChild((pauseMenu = new Bitmap(new PauseMenu(0, 0))));
addChild(continueTxt);
continueTxt.x = 49;
continueTxt.y = 54;
addChild(mainMenuTxt);
mainMenuTxt.x = 50;
mainMenuTxt.y = 67;
addChild(moreGamesTxt);
moreGamesTxt.x = 50;
moreGamesTxt.y = 80;
addChild((cursor = new Bitmap(new MenuCursor(0, 0))));
cursor.x = 42;
cursor.y = (58 + (cursorPos * 13));
cursor.visible = false;
addChild((kingButton = new Bitmap(new KingMiniButton(0, 0))));
addChild((doorMenu = new DoorMenu()));
pauseMenu.x = 32;
pauseMenu.y = 32;
pauseMenu.visible = false;
kingButton.x = 1;
kingButton.y = ((144 - kingButton.height) - 1);
doorMenu.visible = false;
powerUpDisplay.x = 74;
powerUpDisplay.y = 2;
powerUpDisplay.gotoAndStop(1);
scoreTxt.x = (Global.GAMEW - scoreTxt.width);
player.x = 16;
player.y = ((144 - player.hitHeight) - 16);
player.setEnvironment(this);
}
public function invincible():void{
player.setInvincible();
Global.playSound(Global.SOUNDSHIELDACTIVATE);
Global.TROPHYHANDLER.sendStat("useshield", 1);
}
public function showDoorMenu():void{
doorMenu.visible = true;
doorMenu.init();
}
public function collectGems():void{
var _local1:Array;
var _local2:int;
_local1 = Toolkit.copyArray(Global.MAPHANDLER.collectibles);
if (_local1.length < 1){
Global.TROPHYHANDLER.sendStat("wastegem", 1);
};
_local2 = 0;
while (_local2 < _local1.length) {
_local1[_local2].attracting = true;
_local2++;
};
Global.playSound(Global.SOUNDSUMMONGEMS);
Global.TROPHYHANDLER.sendStat("usegem", 1);
}
override public function run():void{
var _local1:Array;
var _local2:int;
var _local3:Array;
var _local4:int;
if (((!(gamePaused)) && (!(doorMenu.visible)))){
if (((((Control.isKeyDown(Control.ENTER)) || (Control.isKeyDown(80)))) || (Control.MOUSEDOWN))){
gamePaused = true;
pauseMenu.visible = gamePaused;
Global.playSound(Global.SOUNDPAUSE);
if (((((Control.MOUSEDOWN) && ((Control.MOUSEPOINT.x >= (kingButton.x * Global.SCALE))))) && ((Control.MOUSEPOINT.x < ((kingButton.x + kingButton.width) * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (kingButton.y * Global.SCALE))) && ((Control.MOUSEPOINT.y < ((kingButton.y + kingButton.height) * Global.SCALE))))){
KingAPI.openOtherGamesLink();
};
};
Control.setMouseDown(false);
};
if (!timestop){
mapHandler.run();
frames++;
if ((frames % Global.TOWERSPD) == 0){
player.y++;
};
if ((frames % (Global.TOWERSPD * 2)) == 0){
mapBackground.y++;
if (mapBackground.y >= 144){
mapBackground.y = (mapBackground.y - 144);
};
};
} else {
timestopper--;
if (timestopper <= 0){
timestopper = 0;
Global.setTimeStop(false);
timestop = false;
};
};
player.run();
if (player.y < 4){
Global.MAPHANDLER.moveTower();
player.y++;
Global.TROPHYHANDLER.sendStat("forceup", 1);
};
if (player.y < -8){
Global.MAPHANDLER.moveTower();
player.y++;
};
if (survivalClock > 0){
survivalClock++;
};
if (player.y >= ((144 + player.hitHeight) + 8)){
survivalClock = 1;
};
if ((((survivalClock >= 32)) && ((player.y <= 72)))){
Global.TROPHYHANDLER.sendStat("closecall", 1);
survivalClock = 0;
};
_local1 = Toolkit.copyArray(Global.MAPHANDLER.collectibles);
_local2 = 0;
while (_local2 < _local1.length) {
_local1[_local2].approachPlayer();
if (Collision.isColliding(player, _local1[_local2], this, true, 0)){
if (_local1[_local2].type == 3){
if (powerUp > 0){
Global.modifyScore(1000);
Global.TROPHYHANDLER.sendStat("replaceitem", 1);
};
powerUp = Math.ceil((Toolkit.randomInt(1, 16) / 4));
Global.playSound(Global.SOUNDITEMCOLLECTED);
} else {
Global.playSound(Global.SOUNDGEMCOLLECTED);
};
Global.MAPHANDLER.removeCollectible(_local1[_local2], true);
};
_local2++;
};
_local3 = Toolkit.copyArray(Global.MAPHANDLER.enemies);
_local4 = 0;
while (_local4 < _local3.length) {
if (_local3[_local4].collidable){
if (Collision.isColliding(player, _local3[_local4], this, true, 0)){
if (timestop){
player.takeTimeDamage();
} else {
player.takeDamage();
};
};
};
_local4++;
};
Global.incrementFrames();
floorTxt.setText(("F-" + String((Global.FLOORS - 1))));
scoreTxt.setText(("$" + String(Global.SCORE)));
scoreTxt.x = (Global.GAMEW - scoreTxt.width);
powerUpDisplay.gotoAndStop((powerUp + 1));
} else {
if (gamePaused){
cursor.visible = true;
continueTxt.setText("Continue");
mainMenuTxt.setText("Main Menu");
moreGamesTxt.setText("More Games");
cursor.y = (58 + (cursorPos * 13));
if (((Control.isKeyDown(Control.UP)) || (Control.isKeyDown(Control.UP2)))){
moveCursor(-1);
};
if (((Control.isKeyDown(Control.DOWN)) || (Control.isKeyDown(Control.DOWN2)))){
moveCursor(1);
};
if ((((Control.MOUSEPOINT.x >= (46 * Global.SCALE))) && ((Control.MOUSEPOINT.x < (120 * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (54 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (67 * Global.SCALE))))){
if (cursorPos != 0){
cursorPos = 0;
Global.playSound(Global.SOUNDMENUMOVE);
};
if (Control.MOUSEDOWN){
gamePaused = false;
cursor.visible = false;
continueTxt.setText("");
mainMenuTxt.setText("");
moreGamesTxt.setText("");
pauseMenu.visible = gamePaused;
Global.playSound(Global.SOUNDPAUSE);
Control.setMouseDown(false);
};
};
if ((((Control.MOUSEPOINT.y >= (67 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (80 * Global.SCALE))))){
if (cursorPos != 1){
cursorPos = 1;
Global.playSound(Global.SOUNDMENUMOVE);
};
if (Control.MOUSEDOWN){
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setScreen(Global.MENUSCREEN);
Control.setMouseDown(false);
};
};
if ((((Control.MOUSEPOINT.y >= (80 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (93 * Global.SCALE))))){
if (cursorPos != 2){
cursorPos = 2;
Global.playSound(Global.SOUNDMENUMOVE);
};
if (Control.MOUSEDOWN){
Global.playSound(Global.SOUNDMENUCONFIRM);
KingAPI.openOtherGamesLink();
Control.setMouseDown(false);
};
};
};
if (((((((Control.isKeyDown(Control.ENTER)) || (Control.isKeyDown(80)))) || (Control.isKeyDown(Control.POWERUP)))) || (Control.isKeyDown(Control.POWERUP2)))){
gamePaused = false;
cursor.visible = false;
continueTxt.setText("");
mainMenuTxt.setText("");
moreGamesTxt.setText("");
pauseMenu.visible = gamePaused;
Global.playSound(Global.SOUNDPAUSE);
};
if (((Control.isKeyDown(Control.CONFIRM)) || (Control.isKeyDown(Control.CONFIRM2)))){
if (cursorPos == 0){
gamePaused = false;
cursor.visible = false;
continueTxt.setText("");
mainMenuTxt.setText("");
moreGamesTxt.setText("");
pauseMenu.visible = gamePaused;
Global.playSound(Global.SOUNDPAUSE);
};
if (cursorPos == 1){
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setScreen(Global.MENUSCREEN);
};
if (cursorPos == 2){
Global.playSound(Global.SOUNDMENUCONFIRM);
KingAPI.openOtherGamesLink();
};
if (((((Control.MOUSEDOWN) && ((Control.MOUSEPOINT.x >= (kingButton.x * Global.SCALE))))) && ((Control.MOUSEPOINT.x < ((kingButton.x + kingButton.width) * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (kingButton.y * Global.SCALE))) && ((Control.MOUSEPOINT.y < ((kingButton.y + kingButton.height) * Global.SCALE))))){
gamePaused = true;
pauseMenu.visible = gamePaused;
KingAPI.openOtherGamesLink();
};
};
Control.setMouseDown(false);
};
} else {
doorMenu.run();
};
};
}
public function moveCursor(_arg1:int):void{
cursorPos = (cursorPos + _arg1);
if (cursorPos < 0){
cursorPos = cursorMax;
};
if (cursorPos > cursorMax){
cursorPos = 0;
};
Global.playSound(Global.SOUNDMENUMOVE);
}
public function freezeTower():void{
Global.setTimeStop(true);
timestop = true;
timestopper = 192;
Global.playSound(Global.SOUNDTIMESTOPACTIVATE);
Global.TROPHYHANDLER.sendStat("usehourglass", 1);
}
public function destroyEnemies():void{
var _local1:Array;
var _local2:int;
_local1 = Toolkit.copyArray(Global.MAPHANDLER.enemies);
if (_local1.length < 1){
Global.TROPHYHANDLER.sendStat("wasteskull", 1);
};
if (_local1.length >= 2){
Global.TROPHYHANDLER.sendStat("multikill", 1);
};
_local2 = 0;
while (_local2 < _local1.length) {
_local1[_local2].die();
Global.TROPHYHANDLER.sendStat("enemieskilled", 1);
_local2++;
};
Global.playSound(Global.SOUNDENEMYDEATH);
Global.TROPHYHANDLER.sendStat("useskull", 1);
}
public function usePowerUp():void{
var _local1:Array;
switch (powerUp){
case 1:
collectGems();
break;
case 2:
destroyEnemies();
break;
case 3:
invincible();
break;
case 4:
freezeTower();
break;
};
if (powerUp > 0){
Global.TROPHYHANDLER.sendStat("useitem", 1);
_local1 = Global.TROPHYHANDLER.dataArray;
if (_local1["useall"] <= 0){
if ((((((((_local1["usegem"] > 0)) && ((_local1["useskull"] > 0)))) && ((_local1["useshield"] > 0)))) && ((_local1["usehourglass"] > 0)))){
Global.TROPHYHANDLER.sendStat("useall", 1);
};
};
};
powerUp = 0;
}
}
}//package
Section 67
//PowerUpDisplay (PowerUpDisplay)
package {
import flash.display.*;
public dynamic class PowerUpDisplay extends MovieClip {
}
}//package
Section 68
//PreloaderBar (PreloaderBar)
package {
import flash.display.*;
public dynamic class PreloaderBar extends BitmapData {
public function PreloaderBar(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 69
//PreloaderFill (PreloaderFill)
package {
import flash.display.*;
public dynamic class PreloaderFill extends BitmapData {
public function PreloaderFill(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 70
//ScoreBackground (ScoreBackground)
package {
import flash.display.*;
public dynamic class ScoreBackground extends BitmapData {
public function ScoreBackground(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 71
//ScoreScreen (ScoreScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class ScoreScreen extends GameScreen {
public var cursorPos:int;// = 0
public var menuText:GameText;
public var arcadeText:GameText;
public var scoreTable:Sprite;
public var menuPos:Array;
public var nameArray:Array;
public var menuCursor:Bitmap;
public var survivalText:GameText;
public var csText:GameText;
public var menuBG:Bitmap;
public var scoreArray:Array;
public function ScoreScreen():void{
var _local1:GameText;
var _local2:int;
menuPos = [2, 55, 120];
cursorPos = 0;
super();
Global.loadPolicy();
addChild((menuBG = new Bitmap(new ScoreBackground(0, 0))));
menuBG.y = -16;
addChild((csText = new GameText("Scores : ARCADE")));
csText.x = 4;
csText.y = 4;
addChild((scoreTable = new Sprite()));
scoreTable.x = 4;
scoreTable.y = 16;
addChild((arcadeText = new GameText("Arcade")));
arcadeText.x = 9;
arcadeText.y = (144 - arcadeText.height);
addChild((survivalText = new GameText("Survival")));
survivalText.x = 62;
survivalText.y = (144 - survivalText.height);
addChild((menuText = new GameText("Exit")));
menuText.x = 127;
menuText.y = (144 - menuText.height);
addChild((menuCursor = new Bitmap(new MenuCursor(0, 0))));
menuCursor.x = 2;
menuCursor.y = 132;
nameArray = new Array();
scoreArray = new Array();
_local2 = 0;
while (_local2 < 10) {
_local1 = new GameText((String((_local2 + 1)) + "."));
scoreTable.addChild(_local1);
_local1.y = (_local2 * 10);
_local1 = new GameText("loading.");
scoreTable.addChild(_local1);
_local1.x = 20;
_local1.y = (_local2 * 10);
nameArray.push(_local1);
_local1 = new GameText("0");
scoreTable.addChild(_local1);
_local1.x = ((160 - _local1.width) - 4);
_local1.y = (_local2 * 10);
scoreArray.push(_local1);
_local2++;
};
getScores();
}
public function getScores():void{
var _local1:String;
var _local2:int;
var _local3:URLRequest;
var _local4:URLLoader;
_local1 = "";
if (cursorPos == 0){
_local1 = "ARCADE";
} else {
_local1 = "SURVIVAL";
};
csText.setText(("Scores : " + _local1));
_local2 = 0;
while (_local2 < 10) {
nameArray[_local2].setText("loading.");
scoreArray[_local2].setText("--");
scoreArray[_local2].x = ((160 - scoreArray[_local2].width) - 4);
_local2++;
};
_local3 = new URLRequest((("http://www.epicshadow.com/towerofgreed/getscores_" + cursorPos) + ".php"));
_local4 = new URLLoader();
_local4.dataFormat = URLLoaderDataFormat.VARIABLES;
_local3.method = URLRequestMethod.POST;
_local4.addEventListener(Event.COMPLETE, updateScores);
_local4.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
_local4.load(_local3);
}
public function menuSelect():void{
switch (cursorPos){
case 0:
getScores();
break;
case 1:
getScores();
break;
case 2:
Global.playSound(Global.SOUNDMENUCONFIRM);
Control.setScreen(Global.MENUSCREEN);
break;
};
}
public function updateScores(_arg1:Event):void{
var _local2:URLLoader;
var _local3:int;
_local2 = URLLoader(_arg1.target);
_local3 = 0;
while (_local3 < 10) {
nameArray[_local3].setText(_local2.data[("name" + String((_local3 + 1)))]);
scoreArray[_local3].setText(_local2.data[("score" + String((_local3 + 1)))]);
scoreArray[_local3].x = ((160 - scoreArray[_local3].width) - 4);
_local3++;
};
}
public function moveCursor(_arg1:int):void{
cursorPos = (cursorPos + _arg1);
if (cursorPos < 0){
cursorPos = (cursorPos + 3);
};
if (cursorPos > 2){
cursorPos = (cursorPos - 3);
};
}
override public function run():void{
menuBG.x--;
menuBG.y++;
if (menuBG.y == 0){
menuBG.x = 0;
menuBG.y = -16;
};
menuCursor.x = menuPos[cursorPos];
if ((((Control.MOUSEPOINT.y > (126 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (140 * Global.SCALE))))){
if ((((Control.MOUSEPOINT.x > 0)) && ((Control.MOUSEPOINT.x < (54 * Global.SCALE))))){
if (cursorPos != 0){
Global.playSound(Global.SOUNDMENUMOVE);
cursorPos = 0;
};
};
if ((((Control.MOUSEPOINT.x > (56 * Global.SCALE))) && ((Control.MOUSEPOINT.x < (118 * Global.SCALE))))){
if (cursorPos != 1){
Global.playSound(Global.SOUNDMENUMOVE);
cursorPos = 1;
};
};
if ((((Control.MOUSEPOINT.x > (120 * Global.SCALE))) && ((Control.MOUSEPOINT.x < (160 * Global.SCALE))))){
if (cursorPos != 2){
Global.playSound(Global.SOUNDMENUMOVE);
cursorPos = 2;
};
};
};
if (((Control.isKeyDown(Control.LEFT)) || (Control.isKeyDown(Control.LEFT2)))){
moveCursor(-1);
};
if (((Control.isKeyDown(Control.RIGHT)) || (Control.isKeyDown(Control.RIGHT2)))){
moveCursor(1);
};
if (((Control.isKeyDown(Control.POWERUP)) || (Control.isKeyDown(Control.POWERUP2)))){
cancel();
};
if (((((((Control.isKeyDown(Control.ENTER)) || (Control.isKeyDown(Control.CONFIRM)))) || (Control.isKeyDown(Control.CONFIRM2)))) || (Control.MOUSEDOWN))){
menuSelect();
Control.setMouseDown(false);
};
}
public function cancel():void{
Global.playSound(Global.SOUNDMENUCANCEL);
Global.resetGlobals();
Control.setScreen(Global.MENUSCREEN);
}
public function onIOError(_arg1:IOErrorEvent):void{
var _local2:int;
_local2 = 0;
while (_local2 < 10) {
nameArray[_local2].setText("error...");
scoreArray[_local2].setText("--");
scoreArray[_local2].x = ((160 - scoreArray[_local2].width) - 4);
_local2++;
};
}
}
}//package
Section 72
//SoundDamage (SoundDamage)
package {
import flash.media.*;
public dynamic class SoundDamage extends Sound {
}
}//package
Section 73
//SoundEnemyDeath (SoundEnemyDeath)
package {
import flash.media.*;
public dynamic class SoundEnemyDeath extends Sound {
}
}//package
Section 74
//SoundGemCollected (SoundGemCollected)
package {
import flash.media.*;
public dynamic class SoundGemCollected extends Sound {
}
}//package
Section 75
//SoundGroundBreak (SoundGroundBreak)
package {
import flash.media.*;
public dynamic class SoundGroundBreak extends Sound {
}
}//package
Section 76
//SoundItemCollected (SoundItemCollected)
package {
import flash.media.*;
public dynamic class SoundItemCollected extends Sound {
}
}//package
Section 77
//SoundMenuCancel (SoundMenuCancel)
package {
import flash.media.*;
public dynamic class SoundMenuCancel extends Sound {
}
}//package
Section 78
//SoundMenuConfirm (SoundMenuConfirm)
package {
import flash.media.*;
public dynamic class SoundMenuConfirm extends Sound {
}
}//package
Section 79
//SoundMenuLoop (SoundMenuLoop)
package {
import flash.media.*;
public dynamic class SoundMenuLoop extends Sound {
}
}//package
Section 80
//SoundMenuMove (SoundMenuMove)
package {
import flash.media.*;
public dynamic class SoundMenuMove extends Sound {
}
}//package
Section 81
//SoundMusicLoop (SoundMusicLoop)
package {
import flash.media.*;
public dynamic class SoundMusicLoop extends Sound {
}
}//package
Section 82
//SoundNMEJump (SoundNMEJump)
package {
import flash.media.*;
public dynamic class SoundNMEJump extends Sound {
}
}//package
Section 83
//SoundPause (SoundPause)
package {
import flash.media.*;
public dynamic class SoundPause extends Sound {
}
}//package
Section 84
//SoundPCJump (SoundPCJump)
package {
import flash.media.*;
public dynamic class SoundPCJump extends Sound {
}
}//package
Section 85
//SoundPlayerDeath (SoundPlayerDeath)
package {
import flash.media.*;
public dynamic class SoundPlayerDeath extends Sound {
}
}//package
Section 86
//SoundShieldActivate (SoundShieldActivate)
package {
import flash.media.*;
public dynamic class SoundShieldActivate extends Sound {
}
}//package
Section 87
//SoundSpringJump (SoundSpringJump)
package {
import flash.media.*;
public dynamic class SoundSpringJump extends Sound {
}
}//package
Section 88
//SoundSummonGems (SoundSummonGems)
package {
import flash.media.*;
public dynamic class SoundSummonGems extends Sound {
}
}//package
Section 89
//SoundTimeStopActivate (SoundTimeStopActivate)
package {
import flash.media.*;
public dynamic class SoundTimeStopActivate extends Sound {
}
}//package
Section 90
//Sparkle (Sparkle)
package {
import flash.display.*;
import flash.geom.*;
public class Sparkle extends Bitmap {
public var current:int;// = 0
public var remove:Boolean;// = false
public var blankData:BitmapData;
public var sequence:Array;
public function Sparkle():void{
remove = false;
sequence = [0, 1, 1, 2, 2, 3, 3, 2, 2, 1, 1, 0];
current = 0;
super();
blankData = new BitmapData(7, 7, true, 0);
bitmapData = blankData;
}
public function run():void{
if (current > (sequence.length - 1)){
remove = true;
} else {
setImage();
};
current++;
}
public function setImage():void{
var _local1:Rectangle;
var _local2:Point;
if (sequence[current] == 0){
bitmapData = blankData;
} else {
bitmapData = new BitmapData(7, 7, true, 0);
_local1 = new Rectangle(((sequence[current] - 1) * 7), 0, 7, 7);
_local2 = new Point();
bitmapData.copyPixels(Global.SPARKLESHEET, _local1, _local2, null, null, true);
};
}
}
}//package
Section 91
//SparkleGraphic (SparkleGraphic)
package {
import flash.display.*;
public dynamic class SparkleGraphic extends BitmapData {
public function SparkleGraphic(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 92
//SubmitConfirm (SubmitConfirm)
package {
import flash.display.*;
public dynamic class SubmitConfirm extends BitmapData {
public function SubmitConfirm(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 93
//SweatDrop (SweatDrop)
package {
import flash.display.*;
public dynamic class SweatDrop extends BitmapData {
public function SweatDrop(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 94
//TileSheet (TileSheet)
package {
import flash.display.*;
public dynamic class TileSheet extends BitmapData {
public function TileSheet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 95
//TitleScreen (TitleScreen)
package {
import flash.display.*;
import com.midasplayer.*;
public class TitleScreen extends GameScreen {
public var sparkles:Array;
public var enterText:GameText;
public var versionText:GameText2;
public var frames:int;// = 0
public var sparkleLayer:Sprite;
public var kingLogo:Bitmap;
public function TitleScreen():void{
frames = 0;
super();
Global.changeLoop(0);
addChild(new Bitmap(new TitleScreenImage(0, 0)));
addChild((enterText = new GameText("Press ENTER")));
addChild((versionText = new GameText2("v1.0.5")));
enterText.x = ((160 - enterText.width) - 4);
enterText.y = ((144 - enterText.height) - 2);
enterText.visible = false;
versionText.x = (159 - versionText.width);
versionText.y = -2;
addChild((kingLogo = new Bitmap(new KingButton(0, 0))));
kingLogo.x = 2;
kingLogo.y = 111;
addChild((sparkleLayer = new Sprite()));
sparkles = new Array();
}
override public function run():void{
var _local1:int;
var _local2:Sparkle;
_local1 = 0;
while (_local1 < sparkles.length) {
if (sparkles[_local1] != null){
if (sparkles[_local1].remove){
sparkleLayer.removeChild(sparkles[_local1]);
sparkles[_local1] = null;
} else {
sparkles[_local1].run();
};
};
_local1++;
};
sparkles = Toolkit.cleanArray(sparkles);
if (Toolkit.randomInt(1, 100) < 10){
_local2 = new Sparkle();
sparkleLayer.addChild(_local2);
sparkles.push(_local2);
_local2.x = Toolkit.randomInt(39, 149);
_local2.y = Toolkit.randomInt(14, 29);
};
frames++;
if ((frames % 16) == 0){
enterText.visible = (enterText.visible) ? false : true;
};
if (((((Control.isKeyDown(Control.ENTER)) || (Control.isKeyDown(Control.CONFIRM)))) || (Control.isKeyDown(Control.CONFIRM2)))){
Global.playSound(Global.SOUNDMENUCONFIRM);
Global.resetGlobals();
Control.setScreen(Global.CONTROLSSCREEN);
};
if (Control.MOUSEDOWN){
if ((((Control.MOUSEPOINT.x >= (kingLogo.x * Global.SCALE))) && ((Control.MOUSEPOINT.x < ((kingLogo.x + kingLogo.width) * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (kingLogo.y * Global.SCALE))) && ((Control.MOUSEPOINT.y < ((kingLogo.y + kingLogo.height) * Global.SCALE))))){
Global.playSound(Global.SOUNDMENUCONFIRM);
KingAPI.openOtherGamesLink();
Control.setMouseDown(false);
} else {
Global.playSound(Global.SOUNDMENUCONFIRM);
Global.resetGlobals();
Control.setScreen(Global.CONTROLSSCREEN);
Control.setMouseDown(false);
};
} else {
Global.playSound(Global.SOUNDMENUCONFIRM);
Global.resetGlobals();
Control.setScreen(Global.CONTROLSSCREEN);
Control.setMouseDown(false);
};
};
}
}
}//package
Section 96
//TitleScreenImage (TitleScreenImage)
package {
import flash.display.*;
public dynamic class TitleScreenImage extends BitmapData {
public function TitleScreenImage(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 97
//Toolkit (Toolkit)
package {
import flash.display.*;
import flash.net.*;
public class Toolkit {
public static var SITELOCKED:Boolean = false;
public static function cleanArray(_arg1:Array):Array{
var _local2:*;
var _local3:int;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
if (_arg1[_local3] != null){
_local2.push(_arg1[_local3]);
};
_local3++;
};
return (_local2);
}
public static function copyArray(_arg1:Array):Array{
var _local2:*;
var _local3:int;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push(_arg1[_local3]);
_local3++;
};
return (_local2);
}
public static function siteLock(_arg1:Stage, _arg2:String, _arg3:Array):void{
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:String;
var _local8:int;
var _local9:int;
var _local10:int;
SITELOCKED = true;
_local4 = _arg1.loaderInfo.url;
_local5 = (_local4.indexOf("://") + 3);
_local6 = _local4.indexOf("/", _local5);
_local7 = _local4.substring(_local5, _local6);
_local8 = (_local7.lastIndexOf(".") - 1);
_local9 = (_local7.lastIndexOf(".", _local8) + 1);
_local7 = _local7.substring(_local9, _local7.length);
_local10 = 0;
while (_local10 < _arg3.length) {
if (_local7 == _arg3[_local10]){
SITELOCKED = false;
return;
};
_local10++;
};
if (SITELOCKED){
navigateToURL(new URLRequest(_arg2), "_top");
};
}
public static function create2DArray(_arg1:Number, _arg2:Number):Array{
var _local3:*;
var _local4:int;
_local3 = new Array(_arg2);
_local4 = 0;
while (_local4 < _arg2) {
_local3[_local4] = new Array(_arg1);
_local4++;
};
return (_local3);
}
public static function randomInt(_arg1:Number, _arg2:Number):Number{
return (Math.round((_arg1 + (Math.random() * (_arg2 - _arg1)))));
}
public static function randomDec(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
var _local5:int;
_local4 = 1;
_local5 = 0;
while (_local5 < _arg3) {
_local4 = (_local4 * 10);
_local5++;
};
return ((Math.round(((_arg1 + (Math.random() * (_arg2 - _arg1))) * _local4)) / _local4));
}
}
}//package
Section 98
//TrophyBackground (TrophyBackground)
package {
import flash.display.*;
public dynamic class TrophyBackground extends BitmapData {
public function TrophyBackground(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 99
//TrophyCursor (TrophyCursor)
package {
import flash.display.*;
public dynamic class TrophyCursor extends BitmapData {
public function TrophyCursor(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 100
//TrophyDescPanel (TrophyDescPanel)
package {
import flash.display.*;
public dynamic class TrophyDescPanel extends BitmapData {
public function TrophyDescPanel(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 101
//TrophyGoal (TrophyGoal)
package {
public class TrophyGoal {
public var requirement:int;
public var totalit:Boolean;
public var achieved:Boolean;
public var type:String;
public var trophyName:String;
public var description:String;
public function TrophyGoal(_arg1:String, _arg2:String, _arg3:int, _arg4:Boolean, _arg5:String):void{
trophyName = _arg1;
type = _arg2;
requirement = _arg3;
achieved = false;
totalit = _arg4;
description = _arg5;
}
public function checkGoal(_arg1:Array, _arg2:Array):Boolean{
var _local3:int;
if (!achieved){
if (!totalit){
_local3 = _arg1[type];
} else {
_local3 = (_arg1[type] + _arg2[type]);
};
if (_local3 >= requirement){
achieved = true;
return (true);
};
};
return (false);
}
}
}//package
Section 102
//TrophyHandler (TrophyHandler)
package {
import flash.display.*;
public class TrophyHandler extends Sprite {
public var goalArray:Array;
public var processing:Boolean;// = false
public var pDataArray:Array;
public var achievementBar:Bitmap;
public var pGoalArray:Array;
public var trophyText:GameText;
public var frames:int;// = 0
public var trophyIcon:TrophyIcon;
public var dataArray:Array;
public function TrophyHandler():void{
frames = 0;
processing = false;
super();
dataArray = new Array();
goalArray = new Array();
pDataArray = new Array();
pGoalArray = new Array();
addChild((achievementBar = new Bitmap(new AchievementBar(0, 0))));
achievementBar.x = 5;
achievementBar.y = 120;
achievementBar.visible = false;
addChild((trophyIcon = new TrophyIcon()));
trophyIcon.x = 6;
trophyIcon.y = 120;
addChild((trophyText = new GameText("")));
trophyText.x = 24;
trophyText.y = 121;
}
public function sendStat(_arg1:String, _arg2:int):void{
dataArray[_arg1] = (dataArray[_arg1] + _arg2);
}
public function getAmount():int{
return (pGoalArray.length);
}
public function setGoal(_arg1:String, _arg2:String, _arg3:int, _arg4:Boolean, _arg5:String):void{
dataArray[_arg2] = 0;
pDataArray[_arg2] = 0;
goalArray.push(new TrophyGoal(_arg1, _arg2, _arg3, _arg4, _arg5));
pGoalArray.push(new TrophyGoal(_arg1, _arg2, _arg3, _arg4, _arg5));
}
public function clearData():void{
var _local1:*;
var _local2:int;
Global.setScoreName([0, 0, 0, 0, 0, 0, 0, 0]);
for (_local1 in pDataArray) {
pDataArray[_local1] = 0;
};
_local2 = 0;
while (_local2 < pGoalArray.length) {
pGoalArray[_local2].achieved = false;
_local2++;
};
Global.MEMORYCARD.saveData(pDataArray, pGoalArray);
}
public function run():void{
var _local1:int;
_local1 = 0;
while (_local1 < goalArray.length) {
if (((!(processing)) && (!(pGoalArray[_local1].achieved)))){
if (goalArray[_local1].checkGoal(dataArray, pDataArray)){
awardTrophy(goalArray[_local1].trophyName);
};
};
_local1++;
};
trophyIcon.run();
frames++;
if (frames > 48){
achievementBar.visible = false;
trophyText.setText("");
processing = false;
};
}
public function resetData():void{
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < goalArray.length) {
goalArray[_local1].achieved = false;
_local1++;
};
for (_local2 in dataArray) {
dataArray[_local2] = 0;
};
}
public function loadData(_arg1:MemoryCard):void{
var _local2:Array;
var _local3:Array;
var _local4:Array;
var _local5:Array;
var _local6:int;
var _local7:int;
var _local8:*;
_local2 = _arg1.loadData();
_local3 = _local2[0];
_local4 = _local2[1];
_local5 = _local2[2];
if (_local3 != null){
_local6 = 0;
while (_local6 < _local3.length) {
pDataArray[_local3[_local6].dataname] = _local3[_local6].amount;
_local6++;
};
};
if (_local4 != null){
_local7 = 0;
while (_local7 < _local4.length) {
_local8 = 0;
while (_local8 < pGoalArray.length) {
if (_local4[_local7].trophyname == pGoalArray[_local8].trophyName){
pGoalArray[_local8].achieved = _local4[_local7].achieved;
};
_local8++;
};
_local7++;
};
};
if (_local5 != null){
Global.setScoreName(Toolkit.copyArray(_local5));
};
}
public function saveData():void{
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < goalArray.length) {
if (goalArray[_local1].achieved){
pGoalArray[_local1].achieved = true;
};
_local1++;
};
for (_local2 in dataArray) {
pDataArray[_local2] = (pDataArray[_local2] + dataArray[_local2]);
};
Global.MEMORYCARD.saveData(pDataArray, pGoalArray);
resetData();
}
public function awardTrophy(_arg1:String):void{
sendStat("trophies", 1);
frames = 0;
processing = true;
achievementBar.visible = true;
trophyIcon.restart(0);
trophyText.setText(_arg1);
Global.playSound(Global.SOUNDMENUCONFIRM);
}
}
}//package
Section 103
//TrophyIcon (TrophyIcon)
package {
import flash.display.*;
import flash.geom.*;
public class TrophyIcon extends Bitmap {
public var blankBmp:BitmapData;
public var frames:int;// = 99
public var trophySheet:TrophySheet;
public function TrophyIcon():void{
frames = 99;
super();
trophySheet = new TrophySheet(0, 0);
blankBmp = new BitmapData(16, 18, true, 0);
bitmapData = blankBmp;
}
public function run():void{
var _local1:int;
frames++;
_local1 = Math.floor((frames / 2));
if (_local1 < 5){
bitmapData = getImage(_local1);
};
if (frames > 48){
bitmapData = blankBmp;
};
}
public function getImage(_arg1:int):BitmapData{
var _local2:BitmapData;
var _local3:Rectangle;
var _local4:Point;
_local2 = new BitmapData(16, 18, true, 0);
_local3 = new Rectangle((_arg1 * 16), 0, 16, 18);
_local4 = new Point();
_local2.copyPixels(trophySheet, _local3, _local4, null, null, true);
return (_local2);
}
public function restart(_arg1:int):void{
var _local2:int;
frames = _arg1;
_local2 = Math.floor((frames / 2));
bitmapData = getImage(_local2);
}
}
}//package
Section 104
//TrophyScreen (TrophyScreen)
package {
import flash.display.*;
public class TrophyScreen extends GameScreen {
public var descPanel:Bitmap;
public var trophySockets:Array;
public var cursorPos:int;// = 0
public var achievementBar:Bitmap;
public var menuButton:MainMenuButton;
public var achievementCursor:Bitmap;
public var descText:GameText;
public var trophyText:GameText;
public var menuCursor:Bitmap;
public var progText:GameText;
public var trophyIcon:TrophyIcon;
public var menuBG:Bitmap;
public function TrophyScreen():void{
cursorPos = 0;
super();
addChild((menuBG = new Bitmap(new TrophyBackground(0, 0))));
menuBG.y = -16;
addChild((achievementBar = new Bitmap(new AchievementBar(0, 0))));
achievementBar.x = 5;
achievementBar.y = 5;
addChild((trophyIcon = new TrophyIcon()));
trophyIcon.x = 6;
trophyIcon.y = 5;
trophyIcon.restart(0);
addChild((trophyText = new GameText("")));
trophyText.x = 24;
trophyText.y = 6;
buildSockets();
addChild((achievementCursor = new Bitmap(new TrophyCursor(0, 0))));
achievementCursor.x = 5;
achievementCursor.y = 29;
addChild((menuButton = new MainMenuButton()));
menuButton.x = 82;
menuButton.y = 120;
addChild((menuCursor = new Bitmap(new MenuCursor(0, 0))));
menuCursor.x = 70;
menuCursor.y = 126;
menuCursor.visible = false;
addChild((descPanel = new Bitmap(new TrophyDescPanel(0, 0))));
descPanel.x = 5;
descPanel.y = 29;
descPanel.visible = false;
addChild((descText = new GameText("")));
descText.x = 7;
descText.y = 29;
addChild((progText = new GameText("")));
progText.x = 7;
progText.y = 124;
}
public function buildSockets():void{
var _local1:Array;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:TrophySocket;
var _local7:int;
trophySockets = new Array();
_local1 = Global.TROPHYHANDLER.pGoalArray;
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
while (_local5 < _local1.length) {
_local6 = new TrophySocket();
_local7 = Global.TROPHYHANDLER.pDataArray[_local1[_local5].type];
_local6.setData((5 + _local2), (29 + _local3), _local1[_local5].trophyName, _local1[_local5].achieved, _local1[_local5].description, _local7, _local1[_local5].requirement, _local1[_local5].totalit);
_local2 = (_local2 + 15);
_local4++;
if (_local4 == 10){
_local4 = 0;
_local2 = 0;
_local3 = (_local3 + 15);
};
addChild(_local6);
trophySockets.push(_local6);
_local5++;
};
}
public function sortButtons():void{
if (cursorPos == 64){
achievementCursor.visible = false;
menuCursor.visible = true;
trophyIcon.visible = false;
trophyText.setText("Go to Main Menu");
menuButton.activated = true;
menuButton.setImage();
} else {
achievementCursor.visible = true;
menuCursor.visible = false;
trophyIcon.visible = true;
trophyText.setText(trophySockets[cursorPos].trophyName);
if (trophySockets[cursorPos].obtained){
trophyIcon.restart(4);
} else {
trophyIcon.restart(0);
};
achievementCursor.x = trophySockets[cursorPos].x;
achievementCursor.y = trophySockets[cursorPos].y;
menuButton.activated = false;
menuButton.setImage();
};
}
public function menuSelect():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:String;
if (cursorPos == 64){
Global.playSound(Global.SOUNDMENUCONFIRM);
Global.resetGlobals();
Control.setScreen(Global.MENUSCREEN);
} else {
descPanel.visible = (descPanel.visible) ? false : true;
descText.setText("");
progText.setText("");
if (descPanel.visible){
descText.setText(trophySockets[cursorPos].description);
_local1 = trophySockets[cursorPos].current;
_local2 = (_local1 + "");
if (trophySockets[cursorPos].current >= 1000000){
_local1 = (Math.floor((trophySockets[cursorPos].current / 100000)) / 10);
_local2 = (_local1 + "m");
} else {
if (trophySockets[cursorPos].current >= 1000){
_local1 = (Math.floor((trophySockets[cursorPos].current / 100)) / 10);
_local2 = (_local1 + "k");
};
};
_local3 = trophySockets[cursorPos].max;
_local4 = (_local3 + "");
if (trophySockets[cursorPos].max >= 1000000){
_local3 = (Math.ceil((trophySockets[cursorPos].max / 100000)) / 10);
_local4 = (_local3 + "m");
} else {
if (trophySockets[cursorPos].max >= 1000){
_local3 = (Math.floor((trophySockets[cursorPos].max / 100)) / 10);
_local4 = (_local3 + "k");
};
};
if ((((((trophySockets[cursorPos].max > 1)) && (trophySockets[cursorPos].showProgress))) && (!(trophySockets[cursorPos].obtained)))){
progText.setText(((("Progress: " + _local2) + "/") + _local4));
};
};
};
}
override public function run():void{
var _local1:int;
menuBG.x--;
menuBG.y++;
if (menuBG.y == 0){
menuBG.x = 0;
menuBG.y = -16;
};
if (((Control.isKeyDown(Control.LEFT)) || (Control.isKeyDown(Control.LEFT2)))){
menuMove(-1, 0);
};
if (((Control.isKeyDown(Control.RIGHT)) || (Control.isKeyDown(Control.RIGHT2)))){
menuMove(1, 0);
};
if (((Control.isKeyDown(Control.UP)) || (Control.isKeyDown(Control.UP2)))){
menuMove(0, -1);
};
if (((Control.isKeyDown(Control.DOWN)) || (Control.isKeyDown(Control.DOWN2)))){
menuMove(0, 1);
};
_local1 = 0;
while (_local1 < trophySockets.length) {
if ((((Control.MOUSEPOINT.x >= (trophySockets[_local1].x * Global.SCALE))) && ((Control.MOUSEPOINT.x < (((trophySockets[_local1].x + trophySockets[_local1].width) - 1) * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (trophySockets[_local1].y * Global.SCALE))) && ((Control.MOUSEPOINT.y < (((trophySockets[_local1].y + trophySockets[_local1].height) - 1) * Global.SCALE))))){
if (!descPanel.visible){
if (cursorPos != _local1){
cursorPos = _local1;
Global.playSound(Global.SOUNDMENUMOVE);
};
};
};
if (Control.MOUSEDOWN){
menuSelect();
Control.setMouseDown(false);
};
};
_local1++;
};
if ((((Control.MOUSEPOINT.x >= (menuButton.x * Global.SCALE))) && ((Control.MOUSEPOINT.x < (((menuButton.x + menuButton.width) - 1) * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (menuButton.y * Global.SCALE))) && ((Control.MOUSEPOINT.y < (((menuButton.y + menuButton.height) - 1) * Global.SCALE))))){
if (!descPanel.visible){
if (cursorPos != 64){
cursorPos = 64;
Global.playSound(Global.SOUNDMENUMOVE);
};
};
};
if (Control.MOUSEDOWN){
menuSelect();
Control.setMouseDown(false);
};
};
sortButtons();
if (((((Control.isKeyDown(Control.ENTER)) || (Control.isKeyDown(Control.CONFIRM)))) || (Control.isKeyDown(Control.CONFIRM2)))){
menuSelect();
};
if (((Control.isKeyDown(Control.POWERUP)) || (Control.isKeyDown(Control.POWERUP2)))){
cancel();
};
if (((descPanel.visible) && (Control.MOUSEDOWN))){
menuSelect();
Control.setMouseDown(false);
};
}
public function cancel():void{
if (!descPanel.visible){
Global.playSound(Global.SOUNDMENUCANCEL);
Global.resetGlobals();
Control.setScreen(Global.MENUSCREEN);
} else {
menuSelect();
};
}
public function menuMove(_arg1:int, _arg2:int):void{
if (!descPanel.visible){
cursorPos = (cursorPos + _arg1);
cursorPos = (cursorPos + (_arg2 * 10));
if (cursorPos < 0){
cursorPos = 64;
};
if (cursorPos > trophySockets.length){
cursorPos = 64;
};
Global.playSound(Global.SOUNDMENUMOVE);
};
}
}
}//package
Section 105
//TrophySheet (TrophySheet)
package {
import flash.display.*;
public dynamic class TrophySheet extends BitmapData {
public function TrophySheet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 106
//TrophySocket (TrophySocket)
package {
import flash.display.*;
import flash.geom.*;
public class TrophySocket extends Bitmap {
public var current:int;// = 0
public var obtained:Boolean;// = false
public var max:int;// = 0
public var description:String;// = ""
public var trophyName:String;// = ""
public var showProgress:Boolean;// = false
public function TrophySocket():void{
obtained = false;
trophyName = "";
description = "";
current = 0;
max = 0;
showProgress = false;
super();
bitmapData = getImage();
}
public function getImage():BitmapData{
var _local1:int;
var _local2:BitmapData;
var _local3:Point;
var _local4:Rectangle;
_local1 = 0;
if (obtained){
_local1 = 15;
};
_local2 = new BitmapData(15, 15, true, 0);
_local3 = new Point(0, 0);
_local4 = new Rectangle(_local1, 0, 15, 15);
_local2.copyPixels(Global.TROPHYSOCKETIMAGE, _local4, _local3, null, null, true);
return (_local2);
}
public function setData(_arg1:int, _arg2:int, _arg3:String, _arg4:Boolean, _arg5:String, _arg6:int, _arg7:int, _arg8:Boolean):void{
x = _arg1;
y = _arg2;
trophyName = _arg3;
obtained = _arg4;
description = _arg5;
current = _arg6;
max = _arg7;
showProgress = _arg8;
bitmapData = getImage();
}
}
}//package
Section 107
//TrophySocketImage (TrophySocketImage)
package {
import flash.display.*;
public dynamic class TrophySocketImage extends BitmapData {
public function TrophySocketImage(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 108
//VictoryScreen (VictoryScreen)
package {
import flash.display.*;
import flash.net.*;
public class VictoryScreen extends GameScreen {
public var lCursorPos:int;// = 0
public var charList:Array;
public var letterCursor:Bitmap;
public var cursorPos:int;// = 0
public var scoreName:Array;
public var cursor:Bitmap;
public var nameText:GameText2;
public var submitConfirm:Bitmap;
public var vsImage:Bitmap;
public var menuBG:Bitmap;
public var resultText:GameText;
public function VictoryScreen():void{
charList = [" ", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "-", "_"];
scoreName = Toolkit.copyArray(Global.SCORENAME);
lCursorPos = 0;
cursorPos = 0;
super();
addChild((menuBG = new Bitmap(new ScoreBackground(0, 0))));
menuBG.y = -16;
addChild((vsImage = new Bitmap(new VictoryScreenImage(0, 0))));
if ((((Global.GAMEMODE == 1)) && (Global.DIED))){
addChild((resultText = new GameText((((("Congratulations!\n\nYou reached Floor " + String((Global.BANKFLOOR - 1))) + "\nwith $") + Global.BANKSCORE) + "!\n\nEnter your name:"))));
} else {
addChild((resultText = new GameText((((("Congratulations!\n\nYou reached Floor " + String((Global.FLOORS - 1))) + "\nwith $") + Global.SCORE) + "!\n\nEnter your name:"))));
};
resultText.x = 4;
resultText.y = 4;
addChild((letterCursor = new Bitmap(new LetterCursor(0, 0))));
letterCursor.x = 50;
letterCursor.y = 77;
addChild((nameText = new GameText2("")));
nameText.x = 50;
nameText.y = 80;
addChild((cursor = new Bitmap(new MenuCursor(0, 0))));
cursor.x = 61;
cursor.y = 120;
addChild((submitConfirm = new Bitmap(new SubmitConfirm(0, 0))));
submitConfirm.x = 16;
submitConfirm.y = 40;
submitConfirm.visible = false;
Global.loadPolicy();
}
public function submitScore():void{
var _local1:URLVariables;
var _local2:String;
var _local3:int;
var _local4:URLRequest;
var _local5:URLLoader;
_local1 = new URLVariables();
_local2 = "";
_local3 = 0;
while (_local3 < scoreName.length) {
_local2 = (_local2 + charList[scoreName[_local3]]);
_local3++;
};
_local1.togName = _local2;
_local1.togScore = Global.SCORE;
_local1.togFloor = (Global.FLOORS - 1);
_local1.togMode = Global.GAMEMODE;
if ((((Global.GAMEMODE == 1)) && (Global.DIED))){
_local1.togScore = Global.BANKSCORE;
_local1.togFloor = (Global.BANKFLOOR - 1);
};
_local4 = new URLRequest("http://www.epicshadow.com/towerofgreed/scores.php");
_local4.method = "POST";
_local4.data = _local1;
_local5 = new URLLoader();
_local5.load(_local4);
}
public function moveCursor(_arg1:int, _arg2:int):void{
var _local3:int;
lCursorPos = (lCursorPos + _arg1);
if (lCursorPos < 0){
lCursorPos = (lCursorPos + 9);
};
if (lCursorPos > 8){
lCursorPos = (lCursorPos - 9);
};
if (lCursorPos == 8){
if (_arg2 != 0){
cursorPos = ((cursorPos)==1) ? 0 : 1;
};
} else {
_local3 = scoreName[lCursorPos];
_local3 = (_local3 + _arg2);
if (_local3 < 0){
_local3 = (_local3 + charList.length);
};
if (_local3 > (charList.length - 1)){
_local3 = (_local3 - charList.length);
};
scoreName[lCursorPos] = _local3;
};
Global.playSound(Global.SOUNDMENUMOVE);
}
override public function run():void{
var _local1:String;
var _local2:int;
menuBG.x--;
menuBG.y++;
if (menuBG.y == 0){
menuBG.x = 0;
menuBG.y = -16;
};
if (lCursorPos == 8){
letterCursor.visible = false;
cursor.visible = true;
} else {
letterCursor.visible = true;
cursor.visible = false;
};
letterCursor.x = (50 + (7 * lCursorPos));
cursor.y = (120 + (cursorPos * 12));
_local1 = "";
_local2 = 0;
while (_local2 < scoreName.length) {
_local1 = (_local1 + charList[scoreName[_local2]]);
_local2++;
};
nameText.setText(_local1);
if (!submitConfirm.visible){
if (((Control.isKeyDown(Control.LEFT)) || (Control.isKeyDown(Control.LEFT2)))){
moveCursor(-1, 0);
};
if (((Control.isKeyDown(Control.RIGHT)) || (Control.isKeyDown(Control.RIGHT2)))){
moveCursor(1, 0);
};
if (((Control.isKeyDown(Control.UP)) || (Control.isKeyDown(Control.UP2)))){
moveCursor(0, 1);
};
if (((Control.isKeyDown(Control.DOWN)) || (Control.isKeyDown(Control.DOWN2)))){
moveCursor(0, -1);
};
if (((Control.isKeyDown(Control.POWERUP)) || (Control.isKeyDown(Control.POWERUP2)))){
cancel();
};
if (((Control.isKeyDown(Control.CONFIRM)) || (Control.isKeyDown(Control.CONFIRM2)))){
confirm();
};
if (Control.isKeyDown(Control.ENTER)){
lCursorPos = 8;
confirm();
};
if ((((Control.MOUSEPOINT.x >= (70 * Global.SCALE))) && ((Control.MOUSEPOINT.x < (160 * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (116 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (128 * Global.SCALE))))){
if (((!((lCursorPos == 8))) || (!((cursorPos == 0))))){
Global.playSound(Global.SOUNDMENUMOVE);
};
lCursorPos = 8;
cursorPos = 0;
if (Control.MOUSEDOWN){
confirm();
Control.setMouseDown(false);
};
};
if ((((Control.MOUSEPOINT.y >= (130 * Global.SCALE))) && ((Control.MOUSEPOINT.y < (160 * Global.SCALE))))){
if (((!((lCursorPos == 8))) || (!((cursorPos == 1))))){
Global.playSound(Global.SOUNDMENUMOVE);
};
lCursorPos = 8;
cursorPos = 1;
if (Control.MOUSEDOWN){
confirm();
Control.setMouseDown(false);
};
};
};
if ((((Control.MOUSEPOINT.x >= (50 * Global.SCALE))) && ((Control.MOUSEPOINT.x < ((99 + letterCursor.width) * Global.SCALE))))){
if ((((Control.MOUSEPOINT.y >= (77 * Global.SCALE))) && ((Control.MOUSEPOINT.y < ((77 + letterCursor.height) * Global.SCALE))))){
_local2 = 0;
while (_local2 < 8) {
if ((((Control.MOUSEPOINT.x >= ((50 + (7 * _local2)) * Global.SCALE))) && ((Control.MOUSEPOINT.x < (((50 + letterCursor.width) + (7 * _local2)) * Global.SCALE))))){
if (lCursorPos != _local2){
Global.playSound(Global.SOUNDMENUMOVE);
};
lCursorPos = _local2;
if (Control.MOUSEDOWN){
if (Control.MOUSEPOINT.y < Math.floor((77 + (letterCursor.height / 2)))){
moveCursor(0, -1);
} else {
moveCursor(0, 1);
};
Control.setMouseDown(false);
};
};
_local2++;
};
};
};
} else {
if (((((Control.isKeyDown(Control.CONFIRM)) || (Control.isKeyDown(Control.CONFIRM2)))) || (Control.isKeyDown(Control.ENTER)))){
finish();
};
if (Control.MOUSEDOWN){
finish();
Control.setMouseDown(false);
};
};
}
public function cancel():void{
moveCursor(-1, 0);
}
public function finish():void{
Global.playSound(Global.SOUNDMENUCONFIRM);
Global.resetGlobals();
Control.setScreen(Global.MENUSCREEN);
}
public function confirm():void{
if (lCursorPos == 8){
Global.playSound(Global.SOUNDMENUCONFIRM);
if ((((Global.GAMEMODE == 1)) && (Global.DIED))){
Global.TROPHYHANDLER.resetData();
};
Global.setScoreName(Toolkit.copyArray(scoreName));
submitScore();
Global.TROPHYHANDLER.saveData();
submitConfirm.visible = true;
} else {
moveCursor(1, 0);
};
}
}
}//package
Section 109
//VictoryScreenImage (VictoryScreenImage)
package {
import flash.display.*;
public dynamic class VictoryScreenImage extends BitmapData {
public function VictoryScreenImage(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package